MCPcopy
hub / github.com/ionic-team/ionic-framework / ReorderGroup

Class ReorderGroup

core/src/components/reorder-group/reorder-group.tsx:25–354  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23 styleUrl: 'reorder-group.scss',
24})
25export class ReorderGroup implements ComponentInterface {
26 private selectedItemEl?: HTMLElement;
27 private selectedItemHeight!: number;
28 private lastToIndex = -1;
29 private cachedHeights: number[] = [];
30 private scrollEl?: HTMLElement;
31 private gesture?: Gesture;
32
33 private scrollElTop = 0;
34 private scrollElBottom = 0;
35 private scrollElInitial = 0;
36
37 private containerTop = 0;
38 private containerBottom = 0;
39
40 @State() state = ReorderGroupState.Idle;
41
42 @Element() el!: HTMLStencilElement;
43
44 /**
45 * If `true`, the reorder will be hidden.
46 */
47 @Prop() disabled = true;
48 @Watch('disabled')
49 disabledChanged() {
50 if (this.gesture) {
51 this.gesture.enable(!this.disabled);
52 }
53 }
54
55 // TODO(FW-6590): Remove this in a major release.
56 /**
57 * Event that needs to be listened to in order to complete the reorder action.
58 * @deprecated Use `ionReorderEnd` instead. If you are accessing
59 * `event.detail.from` or `event.detail.to` and relying on them
60 * being different you should now add checks as they are always emitted
61 * in `ionReorderEnd`, even when they are the same.
62 */
63 @Event() ionItemReorder!: EventEmitter<ItemReorderEventDetail>;
64
65 /**
66 * Event that is emitted when the reorder gesture starts.
67 */
68 @Event() ionReorderStart!: EventEmitter<void>;
69
70 /**
71 * Event that is emitted as the reorder gesture moves.
72 */
73 @Event() ionReorderMove!: EventEmitter<ReorderMoveEventDetail>;
74
75 /**
76 * Event that is emitted when the reorder gesture ends.
77 * The from and to properties are always available, regardless of
78 * if the reorder gesture moved the item. If the item did not change
79 * from its start position, the from and to properties will be the same.
80 * Once the event has been emitted, the `complete()` method then needs
81 * to be called in order to finalize the reorder action.
82 */

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected