@syncfusion/ej2-lists 30.2.4 → 31.1.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/dist/ej2-lists.min.js +1 -1
  2. package/dist/ej2-lists.umd.min.js +1 -1
  3. package/dist/global/ej2-lists.min.js +1 -1
  4. package/dist/global/index.d.ts +1 -1
  5. package/dist/ts/common/index.d.ts +4 -0
  6. package/dist/ts/common/index.ts +4 -0
  7. package/dist/ts/common/list-base.d.ts +415 -0
  8. package/dist/ts/common/list-base.ts +1362 -0
  9. package/dist/ts/component.d.ts +4 -0
  10. package/dist/ts/component.ts +4 -0
  11. package/dist/ts/index.d.ts +6 -0
  12. package/dist/ts/index.ts +6 -0
  13. package/dist/ts/list-view/index.d.ts +6 -0
  14. package/dist/ts/list-view/index.ts +6 -0
  15. package/dist/ts/list-view/list-view-model.d.ts +324 -0
  16. package/dist/ts/list-view/list-view.d.ts +845 -0
  17. package/dist/ts/list-view/list-view.ts +2740 -0
  18. package/dist/ts/list-view/virtualization.d.ts +97 -0
  19. package/dist/ts/list-view/virtualization.ts +947 -0
  20. package/dist/ts/sortable/index.d.ts +5 -0
  21. package/dist/ts/sortable/index.ts +5 -0
  22. package/dist/ts/sortable/sortable-model.d.ts +80 -0
  23. package/dist/ts/sortable/sortable.d.ts +146 -0
  24. package/dist/ts/sortable/sortable.ts +483 -0
  25. package/package.json +56 -12
  26. package/styles/bds-lite.css +9 -0
  27. package/styles/bds.css +9 -0
  28. package/styles/bootstrap-dark-lite.css +9 -0
  29. package/styles/bootstrap-dark.css +9 -0
  30. package/styles/bootstrap-lite.css +9 -0
  31. package/styles/bootstrap.css +9 -0
  32. package/styles/bootstrap4-lite.css +9 -0
  33. package/styles/bootstrap4.css +9 -0
  34. package/styles/bootstrap5-dark-lite.css +9 -0
  35. package/styles/bootstrap5-dark.css +9 -0
  36. package/styles/bootstrap5-lite.css +9 -0
  37. package/styles/bootstrap5.3-lite.css +9 -0
  38. package/styles/bootstrap5.3.css +9 -0
  39. package/styles/bootstrap5.css +9 -0
  40. package/styles/fabric-dark-lite.css +9 -0
  41. package/styles/fabric-dark.css +9 -0
  42. package/styles/fabric-lite.css +9 -0
  43. package/styles/fabric.css +9 -0
  44. package/styles/fluent-dark-lite.css +9 -0
  45. package/styles/fluent-dark.css +9 -0
  46. package/styles/fluent-lite.css +9 -0
  47. package/styles/fluent.css +9 -0
  48. package/styles/fluent2-lite.css +9 -0
  49. package/styles/fluent2.css +9 -0
  50. package/styles/highcontrast-light-lite.css +9 -0
  51. package/styles/highcontrast-light.css +9 -0
  52. package/styles/highcontrast-lite.css +9 -0
  53. package/styles/highcontrast.css +9 -0
  54. package/styles/list-view/_layout.scss +9 -0
  55. package/styles/list-view/bds.css +9 -0
  56. package/styles/list-view/bootstrap-dark.css +9 -0
  57. package/styles/list-view/bootstrap.css +9 -0
  58. package/styles/list-view/bootstrap4.css +9 -0
  59. package/styles/list-view/bootstrap5-dark.css +9 -0
  60. package/styles/list-view/bootstrap5.3.css +9 -0
  61. package/styles/list-view/bootstrap5.css +9 -0
  62. package/styles/list-view/fabric-dark.css +9 -0
  63. package/styles/list-view/fabric.css +9 -0
  64. package/styles/list-view/fluent-dark.css +9 -0
  65. package/styles/list-view/fluent.css +9 -0
  66. package/styles/list-view/fluent2.css +9 -0
  67. package/styles/list-view/highcontrast-light.css +9 -0
  68. package/styles/list-view/highcontrast.css +9 -0
  69. package/styles/list-view/material-dark.css +9 -0
  70. package/styles/list-view/material.css +9 -0
  71. package/styles/list-view/material3-dark.css +9 -0
  72. package/styles/list-view/material3.css +9 -0
  73. package/styles/list-view/tailwind-dark.css +9 -0
  74. package/styles/list-view/tailwind.css +9 -0
  75. package/styles/list-view/tailwind3.css +9 -0
  76. package/styles/material-dark-lite.css +9 -0
  77. package/styles/material-dark.css +9 -0
  78. package/styles/material-lite.css +9 -0
  79. package/styles/material.css +9 -0
  80. package/styles/material3-dark-lite.css +9 -0
  81. package/styles/material3-dark.css +9 -0
  82. package/styles/material3-lite.css +9 -0
  83. package/styles/material3.css +9 -0
  84. package/styles/tailwind-dark-lite.css +9 -0
  85. package/styles/tailwind-dark.css +9 -0
  86. package/styles/tailwind-lite.css +9 -0
  87. package/styles/tailwind.css +9 -0
  88. package/styles/tailwind3-lite.css +9 -0
  89. package/styles/tailwind3.css +9 -0
@@ -0,0 +1,483 @@
1
+ import { Base, Event, getUniqueID, NotifyPropertyChanges, INotifyPropertyChanged, Property, detach, Browser } from '@syncfusion/ej2-base';
2
+ import { closest, Draggable, DragPosition, MouseEventArgs, remove, compareElementParent } from '@syncfusion/ej2-base';
3
+ import { addClass, isNullOrUndefined, getComponent, isBlazor, BlazorDragEventArgs, EventHandler } from '@syncfusion/ej2-base';
4
+ import { SortableModel } from './sortable-model';
5
+
6
+ /* eslint-disable @typescript-eslint/no-explicit-any */
7
+ /**
8
+ * Sortable Module provides support to enable sortable functionality in Dom Elements.
9
+ * ```html
10
+ * <div id="sortable">
11
+ * <div>Item 1</div>
12
+ * <div>Item 2</div>
13
+ * <div>Item 3</div>
14
+ * <div>Item 4</div>
15
+ * <div>Item 5</div>
16
+ * </div>
17
+ * ```
18
+ * ```typescript
19
+ * let ele: HTMLElement = document.getElementById('sortable');
20
+ * let sortObj: Sortable = new Sortable(ele, {});
21
+ * ```
22
+ */
23
+ @NotifyPropertyChanges
24
+ export class Sortable extends Base<HTMLElement> implements INotifyPropertyChanged {
25
+ private target: HTMLElement;
26
+ private curTarget: HTMLElement;
27
+ private placeHolderElement: HTMLElement;
28
+ /**
29
+ * It is used to enable or disable the built-in animations. The default value is `false`
30
+ *
31
+ * @default false
32
+ */
33
+
34
+ @Property(false)
35
+ public enableAnimation: boolean;
36
+ /**
37
+ * Specifies the sortable item class.
38
+ *
39
+ * @default null
40
+ */
41
+ @Property(null)
42
+ public itemClass: string;
43
+ /**
44
+ * Defines the scope value to group sets of sortable libraries.
45
+ * More than one Sortable with same scope allows to transfer elements between different sortable libraries which has same scope value.
46
+ */
47
+ @Property(null)
48
+ public scope: string;
49
+ /**
50
+ * Defines the callback function for customizing the cloned element.
51
+ */
52
+ @Property()
53
+ public helper: (Element: object) => HTMLElement;
54
+ /**
55
+ * Defines the callback function for customizing the placeHolder element.
56
+ */
57
+ @Property()
58
+ public placeHolder: (Element: object) => HTMLElement;
59
+ /**
60
+ * Specifies the callback function for drag event.
61
+ *
62
+ * @event 'object'
63
+ */
64
+
65
+
66
+ @Event()
67
+ public drag: (e: any) => void;
68
+ /**
69
+ * Specifies the callback function for beforeDragStart event.
70
+ *
71
+ * @event 'object'
72
+ */
73
+
74
+ @Event()
75
+ public beforeDragStart: (e: any) => void;
76
+ /**
77
+ * Specifies the callback function for dragStart event.
78
+ *
79
+ * @event 'object'
80
+ */
81
+
82
+ @Event()
83
+ public dragStart: (e: any) => void;
84
+ /**
85
+ * Specifies the callback function for beforeDrop event.
86
+ *
87
+ * @event 'object'
88
+ */
89
+
90
+ @Event()
91
+ public beforeDrop: (e: any) => void;
92
+ /**
93
+ * Specifies the callback function for drop event.
94
+ *
95
+ * @event 'object'
96
+ */
97
+
98
+ @Event()
99
+ public drop: (e: any) => void;
100
+ constructor(element: HTMLElement, options?: SortableModel) {
101
+ super(options, element);
102
+ this.bind();
103
+ }
104
+ protected bind(): void {
105
+ if (!this.element.id) {
106
+ this.element.id = getUniqueID('sortable');
107
+ }
108
+ if (!this.itemClass) {
109
+ this.itemClass = 'e-sort-item';
110
+ this.dataBind();
111
+ }
112
+ this.initializeDraggable();
113
+ }
114
+ private initializeDraggable(): void {
115
+ new Draggable(this.element, {
116
+ helper: this.getHelper,
117
+ dragStart: this.onDragStart,
118
+ drag: this.onDrag,
119
+ dragStop: this.onDragStop,
120
+ dragTarget: `.${this.itemClass}`,
121
+ enableTapHold: true,
122
+ tapHoldThreshold: 200,
123
+ queryPositionInfo: this.queryPositionInfo,
124
+ distance: 1
125
+ });
126
+ this.wireEvents();
127
+ }
128
+ private wireEvents(): void {
129
+ const wrapper: Element = this.element;
130
+ EventHandler.add(wrapper, 'keydown', this.keyDownHandler, this);
131
+ }
132
+ private unwireEvents(): void {
133
+ const wrapper: Element = this.element;
134
+ EventHandler.remove(wrapper, 'keydown', this.keyDownHandler);
135
+ }
136
+ private keyDownHandler(e: KeyboardEvent): void {
137
+ if (e.keyCode === 27) {
138
+ const dragStop: Draggable = getComponent(this.element, 'draggable');
139
+ if (dragStop) {
140
+ dragStop.intDestroy(null);
141
+ }
142
+ const dragWrapper: Element = document.getElementsByClassName('e-sortableclone')[0];
143
+ if (dragWrapper) {
144
+ dragWrapper.remove();
145
+ }
146
+ const dragPlaceholder: Element = document.getElementsByClassName('e-sortable-placeholder')[0];
147
+ if (dragPlaceholder) {
148
+ dragPlaceholder.remove();
149
+ }
150
+ }
151
+ }
152
+
153
+ private getPlaceHolder(target: HTMLElement, instance: Sortable): HTMLElement {
154
+ if (instance.placeHolder) {
155
+ const placeHolderElement: HTMLElement = instance.placeHolder(
156
+ { element: instance.element, grabbedElement: this.target, target: target });
157
+ placeHolderElement.classList.add('e-sortable-placeholder');
158
+ return placeHolderElement;
159
+ }
160
+ return null;
161
+ }
162
+
163
+ private getHelper: Function = (e: { sender: MouseEventArgs, element: HTMLElement }) => {
164
+ const target: HTMLElement = this.getSortableElement(e.sender.target as HTMLElement);
165
+ if (!this.isValidTarget(target as Element, this)) {
166
+ return false;
167
+ }
168
+ let element: HTMLElement;
169
+ if (this.helper) {
170
+ element = this.helper({ sender: target, element: e.element });
171
+ } else {
172
+ element = target.cloneNode(true) as HTMLElement;
173
+ element.style.width = `${target.offsetWidth}px`; element.style.height = `${target.offsetHeight}px`;
174
+ }
175
+ addClass([element], ['e-sortableclone']);
176
+ document.body.appendChild(element);
177
+ return element;
178
+ }
179
+ private isValidTarget(target: Element, instance: Sortable): boolean {
180
+ return target && compareElementParent(target, instance.element) && target.classList.contains(instance.itemClass) &&
181
+ !target.classList.contains('e-disabled');
182
+ }
183
+ private onDrag: Function = (e: { target: HTMLElement, event: MouseEventArgs }) => {
184
+ if (!e.target) { return; }
185
+ this.trigger('drag', { event: e.event, element: this.element, target: e.target });
186
+ let newInst: Sortable = this.getSortableInstance(e.target); let target: HTMLElement = this.getSortableElement(e.target, newInst);
187
+ if ((this.isValidTarget(target, newInst) || (e.target && typeof e.target.className === 'string' && e.target.className.indexOf('e-list-group-item') > -1)) && (this.curTarget !== target ||
188
+ !isNullOrUndefined(newInst.placeHolder)) && (newInst.placeHolderElement ? newInst.placeHolderElement !== e.target : true)) {
189
+ if (e.target.classList.contains('e-list-group-item')) {
190
+ target = e.target;
191
+ }
192
+ this.curTarget = target;
193
+ if (this.target === target) { return; }
194
+ let oldIdx: number = this.getIndex(newInst.placeHolderElement, newInst);
195
+ const placeHolder: HTMLElement = this.getPlaceHolder(target, newInst);
196
+ let newIdx: number;
197
+ if (placeHolder) {
198
+ oldIdx = isNullOrUndefined(oldIdx) ? this.getIndex(this.target) : oldIdx;
199
+ newIdx = this.getIndex(target, newInst, e.event);
200
+ const isPlaceHolderPresent: boolean = this.isPlaceHolderPresent(newInst);
201
+ if (isPlaceHolderPresent && oldIdx === newIdx) { return; }
202
+ if (isPlaceHolderPresent) { this.removePlaceHolder(newInst); }
203
+ newInst.placeHolderElement = placeHolder;
204
+ if (e.target && typeof e.target.className === 'string' && e.target.className.indexOf('e-list-group-item') > -1) {
205
+ newInst.element.insertBefore(newInst.placeHolderElement, newInst.element.children[newIdx as number]);
206
+ } else if (newInst.element !== this.element && newIdx === newInst.element.childElementCount) {
207
+ newInst.element.appendChild(newInst.placeHolderElement);
208
+ } else {
209
+ newInst.element.insertBefore(newInst.placeHolderElement, newInst.element.children[newIdx as number]);
210
+ }
211
+ } else {
212
+ oldIdx = isNullOrUndefined(oldIdx) ? this.getIndex(this.target) :
213
+ this.getIndex(target, newInst) < oldIdx || !oldIdx ? oldIdx : oldIdx - 1;
214
+ newIdx = this.getIndex(target, newInst);
215
+ const idx: number = newInst.element !== this.element ? newIdx : oldIdx < newIdx ? newIdx + 1 : newIdx;
216
+ this.updateItemClass(newInst);
217
+ newInst.element.insertBefore(this.target, newInst.element.children[idx as number]);
218
+ this.curTarget = this.target;
219
+ this.trigger('drop', {
220
+ droppedElement: this.target, element: newInst.element, previousIndex: oldIdx, currentIndex: newIdx,
221
+ target: e.target, helper: document.getElementsByClassName('e-sortableclone')[0], event: e.event, scope: this.scope
222
+ });
223
+ }
224
+ } else if (this.curTarget !== this.target && this.scope && this.curTarget !== target && !isNullOrUndefined(newInst.placeHolder)) {
225
+ this.removePlaceHolder(this.getSortableInstance(this.curTarget));
226
+ this.curTarget = this.target;
227
+ }
228
+ newInst = this.getSortableInstance(this.curTarget);
229
+ if (isNullOrUndefined(target) && e.target !== newInst.placeHolderElement) {
230
+ if (this.isPlaceHolderPresent(newInst)) { this.removePlaceHolder(newInst); }
231
+ } else {
232
+ const placeHolders: Element[] = [].slice.call(document.getElementsByClassName('e-sortable-placeholder')); let inst: Sortable;
233
+ placeHolders.forEach((placeHolder: Element) => {
234
+ inst = this.getSortableInstance(placeHolder);
235
+ if (inst.element && inst !== newInst) { this.removePlaceHolder(inst); }
236
+ });
237
+ }
238
+ }
239
+ private removePlaceHolder(instance: Sortable): void {
240
+ remove(instance.placeHolderElement);
241
+ instance.placeHolderElement = null;
242
+ }
243
+ private updateItemClass(instance: Sortable): void {
244
+ if (this !== instance) {
245
+ this.target.classList.remove(this.itemClass);
246
+ this.target.classList.add(instance.itemClass);
247
+ }
248
+ }
249
+ private getSortableInstance(element: Element): Sortable {
250
+ element = closest(element, `.e-${this.getModuleName()}`);
251
+ if (element) {
252
+ const inst: Sortable = getComponent(element as HTMLElement, Sortable) as Sortable;
253
+ return inst.scope && this.scope && inst.scope === this.scope ? inst : this;
254
+ } else {
255
+ return this;
256
+ }
257
+ }
258
+ private getIndex(target: Element, instance: Sortable = this, e?: MouseEventArgs): number {
259
+ let idx: number; let placeHolderPresent: boolean;
260
+ [].slice.call(instance.element.children).forEach((element: HTMLElement, index: number): void => {
261
+ if (element.classList.contains('e-sortable-placeholder')) { placeHolderPresent = true; }
262
+ if (element === target) {
263
+ idx = index;
264
+ if (!isNullOrUndefined(e)) {
265
+ if (placeHolderPresent) { idx -= 1; }
266
+ const offset: ClientRect = target.getBoundingClientRect();
267
+ const clientY: number = offset.bottom - ((offset.bottom - offset.top) / 2);
268
+ const cltY: number = e.changedTouches ? e.changedTouches[0].clientY : e.clientY;
269
+ idx = cltY <= clientY ? idx : idx + 1;
270
+ }
271
+ return;
272
+ }
273
+ });
274
+ return idx;
275
+ }
276
+ private getSortableElement(element: HTMLElement, instance: Sortable = this): HTMLElement {
277
+ return closest(element, `.${instance.itemClass}`) as HTMLElement;
278
+ }
279
+
280
+ private onDragStart: Function = (e: { target: HTMLElement, event: MouseEventArgs, helper: Element } & BlazorDragEventArgs) => {
281
+ this.target = this.getSortableElement(e.target);
282
+ if (isNullOrUndefined(this.target) && closest(this.element, '.e-listbox-container') && Browser.isDevice) {
283
+ detach(e.dragElement);
284
+ (getComponent(this.element, 'draggable') as any).intDestroy(e.event);
285
+ return;
286
+ }
287
+ let cancelDrag: boolean = false;
288
+ this.target.classList.add('e-grabbed');
289
+ this.curTarget = this.target;
290
+ e.helper = document.getElementsByClassName('e-sortableclone')[0];
291
+ const args: object = { cancel: false, element: this.element, target: this.target };
292
+ this.trigger('beforeDragStart', args, (observedArgs: BeforeDragEventArgs) => {
293
+ if (observedArgs.cancel) {
294
+ cancelDrag = observedArgs.cancel;
295
+ this.onDragStop(e);
296
+ }
297
+ });
298
+ if (cancelDrag) {
299
+ return;
300
+ }
301
+ if (isBlazor) {
302
+ this.trigger('dragStart', {
303
+ event: e.event, element: this.element, target: this.target,
304
+ bindEvents: e.bindEvents, dragElement: e.dragElement
305
+ });
306
+ } else {
307
+ this.trigger('dragStart', { event: e.event, element: this.element, target: this.target });
308
+ }
309
+ }
310
+ private queryPositionInfo(value: DragPosition): DragPosition {
311
+ value.left = scrollX ? `${parseFloat(value.left) - scrollX}px` : value.left;
312
+ value.top = scrollY ? `${parseFloat(value.top) - scrollY}px` : value.top;
313
+ return value;
314
+ }
315
+ private isPlaceHolderPresent(instance: Sortable): boolean {
316
+ return instance.placeHolderElement && !!closest(instance.placeHolderElement, `#${instance.element.id}`);
317
+ }
318
+
319
+ private onDragStop: Function = (e: { target: HTMLElement, event: MouseEvent & TouchEvent, helper: Element }) => {
320
+ let dropInst: Sortable = this.getSortableInstance(this.curTarget); let prevIdx: number; let curIdx: number; let handled: boolean;
321
+ prevIdx = this.getIndex(this.target);
322
+ const isPlaceHolderPresent: boolean = this.isPlaceHolderPresent(dropInst);
323
+ if (isPlaceHolderPresent) {
324
+ const curIdx: number = this.getIndex(dropInst.placeHolderElement, dropInst);
325
+ prevIdx = this === dropInst && (prevIdx - curIdx) >= 1 ? prevIdx - 1 : prevIdx;
326
+ const args: DropEventArgs = {
327
+ previousIndex: prevIdx, currentIndex: curIdx, target: e.target, droppedElement: this.target,
328
+ helper: e.helper, cancel: false, handled: false
329
+ };
330
+ this.trigger('beforeDrop', args, (observedArgs: DropEventArgs) => {
331
+ if (!observedArgs.cancel) {
332
+ handled = observedArgs.handled;
333
+ this.updateItemClass(dropInst);
334
+ if (observedArgs.handled) {
335
+ const ele: Node = this.target.cloneNode(true);
336
+ this.target.classList.remove('e-grabbed');
337
+ this.target = ele as HTMLElement;
338
+ }
339
+ dropInst.element.insertBefore(this.target, dropInst.placeHolderElement);
340
+ const curIdx: number = this.getIndex(this.target, dropInst);
341
+ if (observedArgs.currentIndex > observedArgs.previousIndex) {
342
+ prevIdx = this === dropInst && (prevIdx - curIdx) >= 1 ? prevIdx - 1 : prevIdx;
343
+ }
344
+ this.trigger('drop', {
345
+ event: e.event, element: dropInst.element, previousIndex: prevIdx, currentIndex: curIdx,
346
+ target: e.target, helper: e.helper, droppedElement: this.target, scopeName: this.scope, handled: handled
347
+ });
348
+ }
349
+ this.removePlaceHolder(dropInst);
350
+ });
351
+ }
352
+ dropInst = this.getSortableInstance(e.target);
353
+ curIdx = dropInst.element.childElementCount;
354
+ prevIdx = this.getIndex(this.target);
355
+ if (dropInst.element.querySelector('.e-list-nrt')) {
356
+ curIdx = curIdx - 1;
357
+ }
358
+ if (this.curTarget === this.target && e.target === this.curTarget) {
359
+ curIdx = prevIdx;
360
+ }
361
+ if (dropInst.element === e.target || (!isPlaceHolderPresent && this.curTarget === this.target)) {
362
+ const beforeDropArgs: DropEventArgs = {
363
+ previousIndex: prevIdx, currentIndex: curIdx,
364
+ target: e.target, droppedElement: this.target, helper: e.helper, cancel: false
365
+ };
366
+ this.trigger('beforeDrop', beforeDropArgs, (observedArgs: DropEventArgs) => {
367
+ if ((dropInst.element === e.target || (typeof e.target.className === 'string' && e.target.className.indexOf('e-list-nrt') > -1) || (typeof e.target.className === 'string' && e.target.className.indexOf('e-list-nr-template') > -1)
368
+ || e.target.closest('.e-list-nr-template')) && !observedArgs.cancel) {
369
+ this.updateItemClass(dropInst);
370
+ dropInst.element.appendChild(this.target);
371
+ this.trigger('drop', {
372
+ event: e.event, element: dropInst.element, previousIndex: prevIdx, currentIndex: curIdx,
373
+ target: e.target, helper: e.helper, droppedElement: this.target, scopeName: this.scope
374
+ });
375
+ }
376
+ });
377
+ }
378
+ this.target.classList.remove('e-grabbed');
379
+ this.target = null;
380
+ this.curTarget = null;
381
+ remove(e.helper);
382
+ (getComponent(this.element, 'draggable') as Draggable).intDestroy(e.event);
383
+ }
384
+ /**
385
+ * It is used to sort array of elements from source element to destination element.
386
+ *
387
+ * @param destination - Defines the destination element to which the sortable elements needs to be appended.
388
+ *
389
+ * If it is null, then the Sortable library element will be considered as destination.
390
+ * @param targetIndexes - Specifies the sortable elements indexes which needs to be sorted.
391
+ * @param insertBefore - Specifies the index before which the sortable elements needs to be appended.
392
+ * If it is null, elements will be appended as last child.
393
+ * @function moveTo
394
+ * @returns {void}
395
+ */
396
+
397
+ public moveTo(destination?: HTMLElement, targetIndexes?: number[], insertBefore?: number): void {
398
+ moveTo(this.element, destination, targetIndexes, insertBefore);
399
+ }
400
+
401
+ /**
402
+ * It is used to destroy the Sortable library.
403
+ */
404
+
405
+ public destroy(): void {
406
+ this.unwireEvents();
407
+ if (this.itemClass === 'e-sort-item') { this.itemClass = null; this.dataBind(); }
408
+ (getComponent(this.element, Draggable) as Draggable).destroy();
409
+ super.destroy();
410
+ }
411
+ public getModuleName(): string {
412
+ return 'sortable';
413
+ }
414
+ public onPropertyChanged(newProp: SortableModel, oldProp: SortableModel): void {
415
+ for (const prop of Object.keys(newProp)) {
416
+ switch (prop) {
417
+ case 'itemClass':
418
+ [].slice.call(this.element.children).forEach((element: HTMLElement): void => {
419
+ if (element.classList.contains(oldProp.itemClass)) {
420
+ element.classList.remove(oldProp.itemClass);
421
+ }
422
+ if (newProp.itemClass) {
423
+ element.classList.add(newProp.itemClass);
424
+ }
425
+ });
426
+ break;
427
+ }
428
+ }
429
+ }
430
+ }
431
+
432
+ /**
433
+ * It is used to sort array of elements from source element to destination element.
434
+ *
435
+ * @param {HTMLElement} from - The source element from which to move elements.
436
+ * @param {HTMLElement} [to=from] - The destination element to which to move elements. Defaults to the source element.
437
+ * @param {number[]} [targetIndexes] - The indexes of elements to move. If not provided, all children of the source element will be moved.
438
+ * @param {number} [insertBefore] - The index before which to insert the moved elements in the destination element. If not provided, elements will be appended to the end of the destination element.
439
+ * @returns {void}
440
+ * @private
441
+ */
442
+ export function moveTo(from: HTMLElement, to?: HTMLElement, targetIndexes?: number[], insertBefore?: number): void {
443
+ let targetElements: Element[] = [];
444
+ if (!to) { to = from; }
445
+ if (targetIndexes && targetIndexes.length) {
446
+ targetIndexes.forEach((index: number): void => {
447
+ targetElements.push(from.children[index as number]);
448
+ });
449
+ } else {
450
+ targetElements = [].slice.call(from.children);
451
+ }
452
+ if (isNullOrUndefined(insertBefore)) {
453
+ targetElements.forEach((target: Element): void => {
454
+ to.appendChild(target);
455
+ });
456
+ } else {
457
+ const insertElement: HTMLElement = to.children[insertBefore as number] as HTMLElement;
458
+ targetElements.forEach((target: Element): void => {
459
+ to.insertBefore(target, insertElement);
460
+ });
461
+ }
462
+ }
463
+
464
+ /**
465
+ * An interface that holds item drop event arguments
466
+ */
467
+ export interface DropEventArgs {
468
+ previousIndex: number;
469
+ currentIndex: number;
470
+ droppedElement: Element;
471
+ target: Element;
472
+ helper: Element;
473
+ cancel?: boolean;
474
+ handled?: boolean;
475
+ }
476
+
477
+ /**
478
+ * An interface that holds item before drag event arguments
479
+ */
480
+ export interface BeforeDragEventArgs {
481
+ cancel?: boolean;
482
+ target: Element;
483
+ }
package/package.json CHANGED
@@ -1,19 +1,58 @@
1
1
  {
2
- "name": "@syncfusion/ej2-lists",
3
- "version": "30.2.4",
4
- "description": "The listview control allows you to select an item or multiple items from a list-like interface and represents the data in interactive hierarchical structure across different layouts or views.",
5
- "author": "Syncfusion Inc.",
6
- "license": "SEE LICENSE IN license",
7
- "main": "./dist/ej2-lists.umd.min.js",
8
- "module": "./index.js",
9
- "es2015": "./dist/es6/ej2-lists.es5.js",
2
+ "_from": "@syncfusion/ej2-lists@*",
3
+ "_id": "@syncfusion/ej2-lists@18.24.0",
4
+ "_inBundle": false,
5
+ "_integrity": "sha512-gXKLoF0xBPfnnWYWkIKNvNeqPilx56afTPDzuCCs8MmO6q5pbYwqwduSYOMPk1lBemMQutinEmEMsfIkZBHVxw==",
6
+ "_location": "/@syncfusion/ej2-lists",
7
+ "_phantomChildren": {},
8
+ "_requested": {
9
+ "type": "range",
10
+ "registry": true,
11
+ "raw": "@syncfusion/ej2-lists@*",
12
+ "name": "@syncfusion/ej2-lists",
13
+ "escapedName": "@syncfusion%2fej2-lists",
14
+ "scope": "@syncfusion",
15
+ "rawSpec": "*",
16
+ "saveSpec": null,
17
+ "fetchSpec": "*"
18
+ },
19
+ "_requiredBy": [
20
+ "/",
21
+ "/@syncfusion/ej2",
22
+ "/@syncfusion/ej2-angular-lists",
23
+ "/@syncfusion/ej2-calendars",
24
+ "/@syncfusion/ej2-diagrams",
25
+ "/@syncfusion/ej2-dropdowns",
26
+ "/@syncfusion/ej2-filemanager",
27
+ "/@syncfusion/ej2-gantt",
28
+ "/@syncfusion/ej2-grids",
29
+ "/@syncfusion/ej2-inplace-editor",
30
+ "/@syncfusion/ej2-navigations",
31
+ "/@syncfusion/ej2-pdfviewer",
32
+ "/@syncfusion/ej2-pivotview",
33
+ "/@syncfusion/ej2-react-lists",
34
+ "/@syncfusion/ej2-ribbon",
35
+ "/@syncfusion/ej2-schedule",
36
+ "/@syncfusion/ej2-vue-lists"
37
+ ],
38
+ "_resolved": "https://nexus.syncfusioninternal.com/repository/ej2-development/@syncfusion/ej2-lists/-/ej2-lists-18.24.0.tgz",
39
+ "_shasum": "6c99b1f6bb7bae415b9a9b556645ac885d7d25e2",
40
+ "_spec": "@syncfusion/ej2-lists@*",
41
+ "_where": "D:\\SF3992\\WFH\\Nexus\\release",
42
+ "author": {
43
+ "name": "Syncfusion Inc."
44
+ },
45
+ "bundleDependencies": false,
10
46
  "dependencies": {
11
- "@syncfusion/ej2-base": "~30.2.4",
12
- "@syncfusion/ej2-buttons": "~30.2.4",
13
- "@syncfusion/ej2-data": "~30.2.4",
14
- "@syncfusion/ej2-popups": "~30.2.4"
47
+ "@syncfusion/ej2-base": "~31.1.17",
48
+ "@syncfusion/ej2-buttons": "~31.1.17",
49
+ "@syncfusion/ej2-data": "~31.1.17",
50
+ "@syncfusion/ej2-popups": "~31.1.17"
15
51
  },
52
+ "deprecated": false,
53
+ "description": "The listview control allows you to select an item or multiple items from a list-like interface and represents the data in interactive hierarchical structure across different layouts or views.",
16
54
  "devDependencies": {},
55
+ "es2015": "./dist/es6/ej2-lists.es5.js",
17
56
  "keywords": [
18
57
  "ej2",
19
58
  "Syncfusion",
@@ -39,11 +78,16 @@
39
78
  "es6 list",
40
79
  "dynamic list"
41
80
  ],
81
+ "license": "SEE LICENSE IN license",
82
+ "main": "./dist/ej2-lists.umd.min.js",
83
+ "module": "./index.js",
84
+ "name": "@syncfusion/ej2-lists",
42
85
  "repository": {
43
86
  "type": "git",
44
87
  "url": "https://github.com/syncfusion/ej2-javascript-ui-controls/tree/master/controls/lists"
45
88
  },
46
89
  "typings": "index.d.ts",
90
+ "version": "31.1.17",
47
91
  "sideEffects": false,
48
92
  "homepage": "https://www.syncfusion.com/javascript-ui-controls"
49
93
  }
@@ -48,6 +48,15 @@
48
48
  cursor: default;
49
49
  }
50
50
 
51
+ .e-listview.e-listview-template .e-list-item .e-checkbox {
52
+ display: -webkit-box;
53
+ display: -ms-flexbox;
54
+ display: flex;
55
+ -webkit-box-align: baseline;
56
+ -ms-flex-align: baseline;
57
+ align-items: baseline;
58
+ }
59
+
51
60
  .e-listview .e-list-parent {
52
61
  margin: 0;
53
62
  padding: 0;
package/styles/bds.css CHANGED
@@ -48,6 +48,15 @@
48
48
  cursor: default;
49
49
  }
50
50
 
51
+ .e-listview.e-listview-template .e-list-item .e-checkbox {
52
+ display: -webkit-box;
53
+ display: -ms-flexbox;
54
+ display: flex;
55
+ -webkit-box-align: baseline;
56
+ -ms-flex-align: baseline;
57
+ align-items: baseline;
58
+ }
59
+
51
60
  .e-listview .e-list-parent {
52
61
  margin: 0;
53
62
  padding: 0;
@@ -30,6 +30,15 @@
30
30
  cursor: default;
31
31
  }
32
32
 
33
+ .e-listview.e-listview-template .e-list-item .e-checkbox {
34
+ display: -webkit-box;
35
+ display: -ms-flexbox;
36
+ display: flex;
37
+ -webkit-box-align: baseline;
38
+ -ms-flex-align: baseline;
39
+ align-items: baseline;
40
+ }
41
+
33
42
  .e-listview .e-list-parent {
34
43
  margin: 0;
35
44
  padding: 0;
@@ -30,6 +30,15 @@
30
30
  cursor: default;
31
31
  }
32
32
 
33
+ .e-listview.e-listview-template .e-list-item .e-checkbox {
34
+ display: -webkit-box;
35
+ display: -ms-flexbox;
36
+ display: flex;
37
+ -webkit-box-align: baseline;
38
+ -ms-flex-align: baseline;
39
+ align-items: baseline;
40
+ }
41
+
33
42
  .e-listview .e-list-parent {
34
43
  margin: 0;
35
44
  padding: 0;
@@ -31,6 +31,15 @@
31
31
  cursor: default;
32
32
  }
33
33
 
34
+ .e-listview.e-listview-template .e-list-item .e-checkbox {
35
+ display: -webkit-box;
36
+ display: -ms-flexbox;
37
+ display: flex;
38
+ -webkit-box-align: baseline;
39
+ -ms-flex-align: baseline;
40
+ align-items: baseline;
41
+ }
42
+
34
43
  .e-listview .e-list-parent {
35
44
  margin: 0;
36
45
  padding: 0;
@@ -31,6 +31,15 @@
31
31
  cursor: default;
32
32
  }
33
33
 
34
+ .e-listview.e-listview-template .e-list-item .e-checkbox {
35
+ display: -webkit-box;
36
+ display: -ms-flexbox;
37
+ display: flex;
38
+ -webkit-box-align: baseline;
39
+ -ms-flex-align: baseline;
40
+ align-items: baseline;
41
+ }
42
+
34
43
  .e-listview .e-list-parent {
35
44
  margin: 0;
36
45
  padding: 0;
@@ -31,6 +31,15 @@
31
31
  cursor: default;
32
32
  }
33
33
 
34
+ .e-listview.e-listview-template .e-list-item .e-checkbox {
35
+ display: -webkit-box;
36
+ display: -ms-flexbox;
37
+ display: flex;
38
+ -webkit-box-align: baseline;
39
+ -ms-flex-align: baseline;
40
+ align-items: baseline;
41
+ }
42
+
34
43
  .e-listview .e-list-parent {
35
44
  margin: 0;
36
45
  padding: 0;