mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-21 13:01:01 +08:00
refactor(item): rename indices to indexes
This commit is contained in:
@ -72,8 +72,8 @@ class ApiDemoPage {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
reorderData(indices: any) {
|
reorderData(indexes: any) {
|
||||||
this.chats = reorderArray(this.chats, indices);
|
this.chats = reorderArray(this.chats, indexes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ import { ItemReorderGesture } from '../item/item-reorder-gesture';
|
|||||||
import { isTrueProperty } from '../../util/util';
|
import { isTrueProperty } from '../../util/util';
|
||||||
|
|
||||||
|
|
||||||
export interface ReorderIndices {
|
export interface ReorderIndexes {
|
||||||
from: number;
|
from: number;
|
||||||
to: number;
|
to: number;
|
||||||
}
|
}
|
||||||
@ -61,9 +61,9 @@ export interface ReorderIndices {
|
|||||||
* Once the user drags an item and drops it in the new position, this directive fires the `(ionItemReorder)`
|
* Once the user drags an item and drops it in the new position, this directive fires the `(ionItemReorder)`
|
||||||
* event providing the initial index (from) and the new index (to) of the reordered item.
|
* event providing the initial index (from) and the new index (to) of the reordered item.
|
||||||
* For example, if an user drags the first item to the 5th position, `(ionItemReorder)` would fire
|
* For example, if an user drags the first item to the 5th position, `(ionItemReorder)` would fire
|
||||||
* `{from:0, to: 4}` (note that the indices start at zero).
|
* `{from:0, to: 4}` (note that the index starts at zero).
|
||||||
*
|
*
|
||||||
* In order to integrate reordering in your app, it's a MUST to implement your own function that takes this indices and perform
|
* In order to integrate reordering in your app, it's a MUST to implement your own function that takes this indexes and perform
|
||||||
* the actual reordering of the data models. Here's is an example of how this can be done:
|
* the actual reordering of the data models. Here's is an example of how this can be done:
|
||||||
*
|
*
|
||||||
* @usage
|
* @usage
|
||||||
@ -78,14 +78,14 @@ export interface ReorderIndices {
|
|||||||
* }
|
* }
|
||||||
* }
|
* }
|
||||||
*
|
*
|
||||||
* reorderItem(indices) {
|
* reorderItem(indexes) {
|
||||||
* let element = this.items[indices.from];
|
* let element = this.items[indexes.from];
|
||||||
* this.items.splice(indices.from, 1);
|
* this.items.splice(indexes.from, 1);
|
||||||
* this.items.splice(indices.to, 0, element);
|
* this.items.splice(indexes.to, 0, element);
|
||||||
*
|
*
|
||||||
* // For maximum convenience, ionic already provides an helper function:
|
* // For maximum convenience, ionic already provides an helper function:
|
||||||
* // import { reorderArray } from 'ionic-angular';
|
* // import { reorderArray } from 'ionic-angular';
|
||||||
* // this.item = reorderArray(this.item, indices);
|
* // this.item = reorderArray(this.item, indexes);
|
||||||
* }
|
* }
|
||||||
* }
|
* }
|
||||||
* ```
|
* ```
|
||||||
@ -117,7 +117,7 @@ export class ItemReorder {
|
|||||||
private _lastToIndex: number = -1;
|
private _lastToIndex: number = -1;
|
||||||
private _element: HTMLElement;
|
private _element: HTMLElement;
|
||||||
|
|
||||||
@Output() ionItemReorder: EventEmitter<ReorderIndices> = new EventEmitter<ReorderIndices>();
|
@Output() ionItemReorder: EventEmitter<ReorderIndexes> = new EventEmitter<ReorderIndexes>();
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
elementRef: ElementRef,
|
elementRef: ElementRef,
|
||||||
|
Reference in New Issue
Block a user