@syncfusion/ej2-lists 25.2.3 → 26.1.35
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.
- package/.eslintrc.json +3 -2
- package/dist/ej2-lists.min.js +2 -2
- package/dist/ej2-lists.umd.min.js +2 -2
- package/dist/ej2-lists.umd.min.js.map +1 -1
- package/dist/es6/ej2-lists.es2015.js +255 -279
- package/dist/es6/ej2-lists.es2015.js.map +1 -1
- package/dist/es6/ej2-lists.es5.js +241 -265
- package/dist/es6/ej2-lists.es5.js.map +1 -1
- package/dist/global/ej2-lists.min.js +2 -2
- package/dist/global/ej2-lists.min.js.map +1 -1
- package/dist/global/index.d.ts +1 -1
- package/package.json +10 -10
- package/src/common/list-base.d.ts +61 -30
- package/src/common/list-base.js +167 -94
- package/src/list-view/list-view.d.ts +7 -9
- package/src/list-view/list-view.js +42 -75
- package/src/list-view/virtualization.d.ts +0 -1
- package/src/list-view/virtualization.js +10 -66
- package/src/sortable/sortable.d.ts +5 -0
- package/src/sortable/sortable.js +14 -7
- package/styles/bootstrap-dark.css +100 -122
- package/styles/bootstrap-dark.scss +8 -2
- package/styles/bootstrap.css +100 -122
- package/styles/bootstrap.scss +8 -2
- package/styles/bootstrap4.css +139 -161
- package/styles/bootstrap4.scss +8 -2
- package/styles/bootstrap5-dark.css +101 -125
- package/styles/bootstrap5-dark.scss +8 -2
- package/styles/bootstrap5.css +101 -125
- package/styles/bootstrap5.scss +8 -2
- package/styles/fabric-dark.css +100 -122
- package/styles/fabric-dark.scss +8 -2
- package/styles/fabric.css +100 -122
- package/styles/fabric.scss +8 -2
- package/styles/fluent-dark.css +143 -165
- package/styles/fluent-dark.scss +8 -2
- package/styles/fluent.css +143 -165
- package/styles/fluent.scss +8 -2
- package/styles/fluent2.css +1485 -0
- package/styles/fluent2.scss +8 -0
- package/styles/highcontrast-light.css +100 -122
- package/styles/highcontrast-light.scss +8 -2
- package/styles/highcontrast.css +100 -122
- package/styles/highcontrast.scss +8 -2
- package/styles/list-view/_bootstrap4-definition.scss +5 -0
- package/styles/list-view/_bootstrap5.3-definition.scss +132 -0
- package/styles/list-view/_fluent2-definition.scss +132 -0
- package/styles/list-view/_layout.scss +377 -393
- package/styles/list-view/_material3-definition.scss +0 -7
- package/styles/list-view/_theme.scss +84 -95
- package/styles/list-view/bootstrap-dark.css +97 -121
- package/styles/list-view/bootstrap.css +97 -121
- package/styles/list-view/bootstrap4.css +136 -160
- package/styles/list-view/bootstrap5-dark.css +98 -124
- package/styles/list-view/bootstrap5.css +98 -124
- package/styles/list-view/fabric-dark.css +97 -121
- package/styles/list-view/fabric.css +97 -121
- package/styles/list-view/fluent-dark.css +140 -164
- package/styles/list-view/fluent.css +140 -164
- package/styles/list-view/fluent2.css +1455 -0
- package/styles/list-view/fluent2.scss +5 -0
- package/styles/list-view/highcontrast-light.css +97 -121
- package/styles/list-view/highcontrast.css +97 -121
- package/styles/list-view/icons/_bootstrap5.3.scss +8 -0
- package/styles/list-view/icons/_fluent2.scss +10 -0
- package/styles/list-view/material-dark.css +97 -121
- package/styles/list-view/material.css +97 -121
- package/styles/list-view/material3-dark.css +112 -136
- package/styles/list-view/material3.css +112 -136
- package/styles/list-view/tailwind-dark.css +207 -235
- package/styles/list-view/tailwind.css +207 -235
- package/styles/material-dark.css +100 -122
- package/styles/material-dark.scss +8 -2
- package/styles/material.css +100 -122
- package/styles/material.scss +8 -2
- package/styles/material3-dark.css +115 -137
- package/styles/material3-dark.scss +8 -2
- package/styles/material3.css +115 -137
- package/styles/material3.scss +8 -2
- package/styles/sortable/_bootstrap5.3-definition.scss +1 -0
- package/styles/sortable/_fluent2-definition.scss +1 -0
- package/styles/sortable/bootstrap-dark.css +3 -1
- package/styles/sortable/bootstrap.css +3 -1
- package/styles/sortable/bootstrap4.css +3 -1
- package/styles/sortable/bootstrap5-dark.css +3 -1
- package/styles/sortable/bootstrap5.css +3 -1
- package/styles/sortable/fabric-dark.css +3 -1
- package/styles/sortable/fabric.css +3 -1
- package/styles/sortable/fluent-dark.css +3 -1
- package/styles/sortable/fluent.css +3 -1
- package/styles/sortable/fluent2.css +1063 -0
- package/styles/sortable/fluent2.scss +3 -0
- package/styles/sortable/highcontrast-light.css +3 -1
- package/styles/sortable/highcontrast.css +3 -1
- package/styles/sortable/material-dark.css +3 -1
- package/styles/sortable/material.css +3 -1
- package/styles/sortable/material3-dark.css +4 -2
- package/styles/sortable/material3.css +4 -2
- package/styles/sortable/tailwind-dark.css +3 -1
- package/styles/sortable/tailwind.css +3 -1
- package/styles/tailwind-dark.css +210 -236
- package/styles/tailwind-dark.scss +8 -2
- package/styles/tailwind.css +210 -236
- package/styles/tailwind.scss +8 -2
- package/CHANGELOG.md +0 -544
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { isNullOrUndefined, getValue, extend, prepend, SanitizeHtmlHelper, merge, addClass, isVisible, attributes, append, compile, Property, ChildProperty, detach, removeClass, formatUnit, animationMode, Animation, closest, EventHandler, Touch, remove, rippleEffect, Complex, Event, NotifyPropertyChanges, Component, select, isBlazor, getComponent, getUniqueID, Draggable, compareElementParent, Base } from '@syncfusion/ej2-base';
|
|
2
|
+
import { Query, DataManager } from '@syncfusion/ej2-data';
|
|
3
3
|
import { createCheckBox } from '@syncfusion/ej2-buttons';
|
|
4
4
|
|
|
5
5
|
/* eslint-disable no-inner-declarations */
|
|
@@ -89,17 +89,15 @@ var ListBase;
|
|
|
89
89
|
*
|
|
90
90
|
* @param {{Object}[]} dataSource - Specifies an array of JSON data.
|
|
91
91
|
*
|
|
92
|
-
* @param {ListBaseOptions} options
|
|
92
|
+
* @param {ListBaseOptions} [options] - Specifies the list options that need to provide.
|
|
93
93
|
*
|
|
94
|
-
* @param {boolean} isSingleLevel
|
|
94
|
+
* @param {boolean} [isSingleLevel] - Specifies the list options that need to provide.
|
|
95
95
|
*
|
|
96
|
-
* @param {any} componentInstance
|
|
96
|
+
* @param {any} [componentInstance] - Specifies the list options that need to provide.
|
|
97
97
|
*
|
|
98
98
|
* @returns {createElement} createListFromJson - Specifies the list options that need to provide.
|
|
99
99
|
*/
|
|
100
|
-
function createList(createElement, dataSource,
|
|
101
|
-
// eslint-disable-next-line
|
|
102
|
-
options, isSingleLevel, componentInstance) {
|
|
100
|
+
function createList(createElement, dataSource, options, isSingleLevel, componentInstance) {
|
|
103
101
|
var curOpt = extend({}, defaultListBaseOptions, options);
|
|
104
102
|
var ariaAttributes = extend({}, defaultAriaAttributes, curOpt.ariaAttributes);
|
|
105
103
|
var type = typeofData(dataSource).typeof;
|
|
@@ -118,18 +116,15 @@ var ListBase;
|
|
|
118
116
|
*
|
|
119
117
|
* @param {{Object}[]} dataSource - Specifies an array of JSON data.
|
|
120
118
|
*
|
|
121
|
-
* @param {
|
|
119
|
+
* @param {boolean} [isSingleLevel] - Specifies the list options that need to provide.
|
|
122
120
|
*
|
|
123
|
-
* @param {
|
|
121
|
+
* @param {ListBaseOptions} [options] - Specifies the list options that need to provide.
|
|
124
122
|
*
|
|
125
|
-
* @param {any} componentInstance
|
|
123
|
+
* @param {any} [componentInstance] - Specifies the list options that need to provide.
|
|
126
124
|
*
|
|
127
125
|
* @returns {createElement} generateUL - returns the list options that need to provide.
|
|
128
126
|
*/
|
|
129
|
-
function createListFromArray(createElement, dataSource,
|
|
130
|
-
// tslint:disable-next-line
|
|
131
|
-
// eslint-disable-next-line
|
|
132
|
-
isSingleLevel, options, componentInstance) {
|
|
127
|
+
function createListFromArray(createElement, dataSource, isSingleLevel, options, componentInstance) {
|
|
133
128
|
var subChild = createListItemFromArray(createElement, dataSource, isSingleLevel, options, componentInstance);
|
|
134
129
|
return generateUL(createElement, subChild, null, options);
|
|
135
130
|
}
|
|
@@ -141,17 +136,15 @@ var ListBase;
|
|
|
141
136
|
*
|
|
142
137
|
* @param {{Object}[]} dataSource - Specifies an array of JSON data.
|
|
143
138
|
*
|
|
144
|
-
* @param {
|
|
139
|
+
* @param {boolean} [isSingleLevel] - Specifies the list options that need to provide.
|
|
145
140
|
*
|
|
146
|
-
* @param {
|
|
141
|
+
* @param {ListBaseOptions} [options] - Specifies the list options that need to provide.
|
|
147
142
|
*
|
|
148
|
-
* @param {any} componentInstance
|
|
143
|
+
* @param {any} [componentInstance] - Specifies the list options that need to provide.
|
|
149
144
|
*
|
|
150
145
|
* @returns {HTMLElement[]} subChild - returns the list options that need to provide.
|
|
151
146
|
*/
|
|
152
|
-
function createListItemFromArray(createElement, dataSource,
|
|
153
|
-
// eslint-disable-next-line
|
|
154
|
-
isSingleLevel, options, componentInstance) {
|
|
147
|
+
function createListItemFromArray(createElement, dataSource, isSingleLevel, options, componentInstance) {
|
|
155
148
|
var subChild = [];
|
|
156
149
|
var curOpt = extend({}, defaultListBaseOptions, options);
|
|
157
150
|
cssClass = getModuleClass(curOpt.moduleName);
|
|
@@ -198,19 +191,17 @@ var ListBase;
|
|
|
198
191
|
*
|
|
199
192
|
* @param {{Object}[]} dataSource - Specifies an array of JSON data.
|
|
200
193
|
*
|
|
201
|
-
* @param {ListBaseOptions} options
|
|
194
|
+
* @param {ListBaseOptions} [options] - Specifies the list options that need to provide.
|
|
202
195
|
*
|
|
203
|
-
* @param {
|
|
196
|
+
* @param {number} [level] - Specifies the list options that need to provide.
|
|
204
197
|
*
|
|
205
|
-
* @param {
|
|
198
|
+
* @param {boolean} [isSingleLevel] - Specifies the list options that need to provide.
|
|
206
199
|
*
|
|
207
|
-
* @param {any} componentInstance
|
|
200
|
+
* @param {any} [componentInstance] - Specifies the list options that need to provide.
|
|
208
201
|
*
|
|
209
202
|
* @returns {HTMLElement[]} child - returns the list options that need to provide.
|
|
210
203
|
*/
|
|
211
|
-
function createListItemFromJson(createElement, dataSource,
|
|
212
|
-
// eslint-disable-next-line
|
|
213
|
-
options, level, isSingleLevel, componentInstance) {
|
|
204
|
+
function createListItemFromJson(createElement, dataSource, options, level, isSingleLevel, componentInstance) {
|
|
214
205
|
var curOpt = extend({}, defaultListBaseOptions, options);
|
|
215
206
|
cssClass = getModuleClass(curOpt.moduleName);
|
|
216
207
|
var fields = (componentInstance &&
|
|
@@ -226,8 +217,7 @@ var ListBase;
|
|
|
226
217
|
var li;
|
|
227
218
|
var anchorElement;
|
|
228
219
|
if (dataSource && dataSource.length && !isNullOrUndefined(typeofData(dataSource).item) &&
|
|
229
|
-
|
|
230
|
-
!typeofData(dataSource).item.hasOwnProperty(fields.id)) {
|
|
220
|
+
!Object.prototype.hasOwnProperty.call(typeofData(dataSource).item, fields.id)) {
|
|
231
221
|
id = generateId(); // generate id for drop-down-list option.
|
|
232
222
|
}
|
|
233
223
|
for (var i = 0; i < dataSource.length; i++) {
|
|
@@ -249,8 +239,7 @@ var ListBase;
|
|
|
249
239
|
if (curOpt.itemCreating && typeof curOpt.itemCreating === 'function') {
|
|
250
240
|
fieldData = getFieldValues(dataSource[i], fields);
|
|
251
241
|
}
|
|
252
|
-
|
|
253
|
-
if (fieldData.hasOwnProperty(fields.id) && !isNullOrUndefined(fieldData[fields.id])) {
|
|
242
|
+
if (Object.prototype.hasOwnProperty.call(fieldData, fields.id) && !isNullOrUndefined(fieldData[fields.id])) {
|
|
254
243
|
id = fieldData[fields.id];
|
|
255
244
|
}
|
|
256
245
|
var innerEle = [];
|
|
@@ -263,13 +252,11 @@ var ListBase;
|
|
|
263
252
|
}
|
|
264
253
|
}
|
|
265
254
|
if (isSingleLevel === true) {
|
|
266
|
-
|
|
267
|
-
|
|
255
|
+
if (curOpt.showIcon && Object.prototype.hasOwnProperty.call(fieldData, fields.iconCss)
|
|
256
|
+
&& !isNullOrUndefined(fieldData[fields.iconCss])) {
|
|
268
257
|
innerEle.push(createElement('span', { className: cssClass.icon + ' ' + fieldData[fields.iconCss] }));
|
|
269
258
|
}
|
|
270
|
-
li = generateSingleLevelLI(createElement, curItem, fieldData, fields, curOpt.itemClass, innerEle,
|
|
271
|
-
// eslint-disable-next-line no-prototype-builtins
|
|
272
|
-
(curItem.hasOwnProperty('isHeader') &&
|
|
259
|
+
li = generateSingleLevelLI(createElement, curItem, fieldData, fields, curOpt.itemClass, innerEle, (Object.prototype.hasOwnProperty.call(curItem, 'isHeader') &&
|
|
273
260
|
curItem.isHeader) ? true : false, id, i, options);
|
|
274
261
|
anchorElement = li.querySelector('.' + cssClass.anchorWrap);
|
|
275
262
|
if (curOpt.itemNavigable && checkboxElement.length) {
|
|
@@ -284,8 +271,7 @@ var ListBase;
|
|
|
284
271
|
li.removeAttribute('aria-level');
|
|
285
272
|
}
|
|
286
273
|
anchorElement = li.querySelector('.' + cssClass.anchorWrap);
|
|
287
|
-
|
|
288
|
-
if (fieldData.hasOwnProperty(fields.tooltip)) {
|
|
274
|
+
if (Object.prototype.hasOwnProperty.call(fieldData, fields.tooltip)) {
|
|
289
275
|
var tooltipText = fieldData[fields.tooltip];
|
|
290
276
|
if (options && options.enableHtmlSanitizer) {
|
|
291
277
|
tooltipText = SanitizeHtmlHelper.sanitize(tooltipText);
|
|
@@ -297,8 +283,7 @@ var ListBase;
|
|
|
297
283
|
}
|
|
298
284
|
li.setAttribute('title', tooltipText);
|
|
299
285
|
}
|
|
300
|
-
|
|
301
|
-
if (fieldData.hasOwnProperty(fields.htmlAttributes) && fieldData[fields.htmlAttributes]) {
|
|
286
|
+
if (Object.prototype.hasOwnProperty.call(fieldData, fields.htmlAttributes) && fieldData[fields.htmlAttributes]) {
|
|
302
287
|
var htmlAttributes = fieldData[fields.htmlAttributes];
|
|
303
288
|
// Check if 'class' attribute is present and not an empty string
|
|
304
289
|
if ('class' in htmlAttributes && typeof htmlAttributes['class'] === 'string' && htmlAttributes['class'].trim() === '') {
|
|
@@ -306,18 +291,15 @@ var ListBase;
|
|
|
306
291
|
}
|
|
307
292
|
setAttribute(li, htmlAttributes);
|
|
308
293
|
}
|
|
309
|
-
|
|
310
|
-
if (fieldData.hasOwnProperty(fields.enabled) && fieldData[fields.enabled] === false) {
|
|
294
|
+
if (Object.prototype.hasOwnProperty.call(fieldData, fields.enabled) && fieldData[fields.enabled] === false) {
|
|
311
295
|
li.classList.add(cssClass.disabled);
|
|
312
296
|
}
|
|
313
|
-
|
|
314
|
-
if (fieldData.hasOwnProperty(fields.isVisible) && fieldData[fields.isVisible] === false) {
|
|
297
|
+
if (Object.prototype.hasOwnProperty.call(fieldData, fields.isVisible) && fieldData[fields.isVisible] === false) {
|
|
315
298
|
li.style.display = 'none';
|
|
316
299
|
}
|
|
317
|
-
|
|
318
|
-
if (fieldData.hasOwnProperty(fields.imageUrl) && !isNullOrUndefined(fieldData[fields.imageUrl])
|
|
300
|
+
if (Object.prototype.hasOwnProperty.call(fieldData, fields.imageUrl) && !isNullOrUndefined(fieldData[fields.imageUrl])
|
|
319
301
|
&& !curOpt.template) {
|
|
320
|
-
var attr = { src: fieldData[fields.imageUrl] };
|
|
302
|
+
var attr = { src: fieldData[fields.imageUrl], alt: !isNullOrUndefined(fieldData.name) ? ('Displaying ' + fieldData.name + ' Image') : 'Displaying Image' };
|
|
321
303
|
merge(attr, fieldData[fields.imageAttributes]);
|
|
322
304
|
var imageElemnt = createElement('img', { className: cssClass.image, attrs: attr });
|
|
323
305
|
if (anchorElement) {
|
|
@@ -327,8 +309,7 @@ var ListBase;
|
|
|
327
309
|
prepend([imageElemnt], li.firstElementChild);
|
|
328
310
|
}
|
|
329
311
|
}
|
|
330
|
-
|
|
331
|
-
if (curOpt.showIcon && fieldData.hasOwnProperty(fields.iconCss) &&
|
|
312
|
+
if (curOpt.showIcon && Object.prototype.hasOwnProperty.call(fieldData, fields.iconCss) &&
|
|
332
313
|
!isNullOrUndefined(fieldData[fields.iconCss]) && !curOpt.template) {
|
|
333
314
|
var iconElement = createElement('div', { className: cssClass.icon + ' ' + fieldData[fields.iconCss] });
|
|
334
315
|
if (anchorElement) {
|
|
@@ -373,19 +354,17 @@ var ListBase;
|
|
|
373
354
|
*
|
|
374
355
|
* @param {{Object}[]} dataSource - Specifies an array of JSON data.
|
|
375
356
|
*
|
|
376
|
-
* @param {ListBaseOptions} options
|
|
357
|
+
* @param {ListBaseOptions} [options] - Specifies the list options that need to provide.
|
|
377
358
|
*
|
|
378
|
-
* @param {number} level
|
|
359
|
+
* @param {number} [level] - Specifies the list options that need to provide.
|
|
379
360
|
*
|
|
380
|
-
* @param {boolean} isSingleLevel
|
|
361
|
+
* @param {boolean} [isSingleLevel] - Specifies the list options that need to provide.
|
|
381
362
|
*
|
|
382
|
-
* @param {any} componentInstance
|
|
363
|
+
* @param {any} [componentInstance] - Specifies the list options that need to provide.
|
|
383
364
|
*
|
|
384
365
|
* @returns {createElement} generateUL - Specifies the list options that need to provide.
|
|
385
366
|
*/
|
|
386
|
-
function createListFromJson(createElement, dataSource,
|
|
387
|
-
// eslint-disable-next-line
|
|
388
|
-
options, level, isSingleLevel, componentInstance) {
|
|
367
|
+
function createListFromJson(createElement, dataSource, options, level, isSingleLevel, componentInstance) {
|
|
389
368
|
var curOpt = extend({}, defaultListBaseOptions, options);
|
|
390
369
|
var li = createListItemFromJson(createElement, dataSource, options, level, isSingleLevel, componentInstance);
|
|
391
370
|
return generateUL(createElement, li, curOpt.listClass, options);
|
|
@@ -395,8 +374,9 @@ var ListBase;
|
|
|
395
374
|
* Return the next or previous visible element.
|
|
396
375
|
*
|
|
397
376
|
* @param {Element[]|NodeList} elementArray - An element array to find next or previous element.
|
|
398
|
-
* @param {Element}
|
|
399
|
-
* @param {boolean} isPrevious
|
|
377
|
+
* @param {Element} element - An element to find next or previous after this element.
|
|
378
|
+
* @param {boolean} [isPrevious] - Specify when the need get previous element from array.
|
|
379
|
+
* @returns {Element|undefined} The next or previous visible element, or undefined if the element array is empty.
|
|
400
380
|
*/
|
|
401
381
|
function getSiblingLI(elementArray, element, isPrevious) {
|
|
402
382
|
cssClass = getModuleClass(defaultListBaseOptions.moduleName);
|
|
@@ -425,6 +405,7 @@ var ListBase;
|
|
|
425
405
|
*
|
|
426
406
|
* @param {Element} item - An element to find next or previous after this element.
|
|
427
407
|
* @param {Element[]} elementArray - An element array to find index of given li.
|
|
408
|
+
* @returns {number} - The index of the item in the element array, or undefined if either parameter is false.
|
|
428
409
|
*/
|
|
429
410
|
function indexOf(item, elementArray) {
|
|
430
411
|
if (!elementArray || !item) {
|
|
@@ -442,7 +423,8 @@ var ListBase;
|
|
|
442
423
|
*
|
|
443
424
|
* @param {{Object}[]} dataSource - The JSON data which is necessary to process.
|
|
444
425
|
* @param {FieldsMapping} fields - Fields that are mapped from the data source.
|
|
445
|
-
* @param {SortOrder} sortOrder- Specifies final result sort order.
|
|
426
|
+
* @param {SortOrder} [sortOrder='None'] - Specifies final result sort order. Defaults to 'None'.
|
|
427
|
+
* @returns {Object[]} - The grouped data.
|
|
446
428
|
*/
|
|
447
429
|
function groupDataSource(dataSource, fields, sortOrder) {
|
|
448
430
|
if (sortOrder === void 0) { sortOrder = 'None'; }
|
|
@@ -480,6 +462,7 @@ var ListBase;
|
|
|
480
462
|
* @param {SortOrder} sortOrder - Specifies that sort order.
|
|
481
463
|
* @param {string} sortBy - Specifies sortBy fields.
|
|
482
464
|
* @param {Query} query - Pass if any existing query.
|
|
465
|
+
* @returns {Query} - The updated query object with sorting applied.
|
|
483
466
|
*/
|
|
484
467
|
function addSorting(sortOrder, sortBy, query) {
|
|
485
468
|
if (query === void 0) { query = new Query(); }
|
|
@@ -505,9 +488,10 @@ var ListBase;
|
|
|
505
488
|
* @param {{Object}[]} dataSource - Specifies local JSON data source.
|
|
506
489
|
*
|
|
507
490
|
* @param {Query} query - Specifies query that need to process.
|
|
491
|
+
*
|
|
492
|
+
* @returns {Object[]} - An array of objects representing the retrieved data.
|
|
508
493
|
*/
|
|
509
494
|
function getDataSource(dataSource, query) {
|
|
510
|
-
// eslint-disable-next-line
|
|
511
495
|
return new DataManager(dataSource)
|
|
512
496
|
.executeLocal(query);
|
|
513
497
|
}
|
|
@@ -516,7 +500,8 @@ var ListBase;
|
|
|
516
500
|
* Created JSON data based the UL and LI element
|
|
517
501
|
*
|
|
518
502
|
* @param {HTMLElement|Element} element - UL element that need to convert as a JSON
|
|
519
|
-
* @param {ListBaseOptions} options
|
|
503
|
+
* @param {ListBaseOptions} [options] - Specifies ListBase option for fields.
|
|
504
|
+
* @returns {Object[]} - An array of objects representing the JSON data.
|
|
520
505
|
*/
|
|
521
506
|
function createJsonFromElement(element, options) {
|
|
522
507
|
var curOpt = extend({}, defaultListBaseOptions, options);
|
|
@@ -563,6 +548,12 @@ var ListBase;
|
|
|
563
548
|
return jsonAr;
|
|
564
549
|
}
|
|
565
550
|
ListBase.createJsonFromElement = createJsonFromElement;
|
|
551
|
+
/**
|
|
552
|
+
* Determines the type of data in an array of objects, strings, or numbers.
|
|
553
|
+
*
|
|
554
|
+
* @param {Object[] | string[] | number[]} data - The array containing objects, strings, or numbers.
|
|
555
|
+
* @returns {{typeof: (string | null), item: (Object | string | number)}} - An object containing the type of data and the corresponding item.
|
|
556
|
+
*/
|
|
566
557
|
function typeofData(data) {
|
|
567
558
|
var match = { typeof: null, item: null };
|
|
568
559
|
for (var i = 0; i < data.length; i++) {
|
|
@@ -572,6 +563,13 @@ var ListBase;
|
|
|
572
563
|
}
|
|
573
564
|
return match;
|
|
574
565
|
}
|
|
566
|
+
/**
|
|
567
|
+
* Sets attributes on an HTML element.
|
|
568
|
+
*
|
|
569
|
+
* @param {HTMLElement} element - The HTML element to set attributes on.
|
|
570
|
+
* @param {Object.<string, string>} elementAttributes - An object containing attribute names and their corresponding values.
|
|
571
|
+
* @returns {void}
|
|
572
|
+
*/
|
|
575
573
|
function setAttribute(element, elementAttributes) {
|
|
576
574
|
var attr = {};
|
|
577
575
|
merge(attr, elementAttributes);
|
|
@@ -581,24 +579,32 @@ var ListBase;
|
|
|
581
579
|
}
|
|
582
580
|
attributes(element, attr);
|
|
583
581
|
}
|
|
582
|
+
/**
|
|
583
|
+
* Retrieves all attributes of an HTML element.
|
|
584
|
+
*
|
|
585
|
+
* @param {HTMLElement} element - The HTML element to retrieve attributes from.
|
|
586
|
+
* @returns {Object.<string, string>} - An object containing attribute names as keys and their corresponding values as values.
|
|
587
|
+
*/
|
|
584
588
|
function getAllAttributes(element) {
|
|
585
|
-
var attributes
|
|
589
|
+
var attributes = {};
|
|
586
590
|
var attr = element.attributes;
|
|
587
591
|
for (var index = 0; index < attr.length; index++) {
|
|
588
|
-
attributes
|
|
592
|
+
attributes[attr[index].nodeName] = attr[index].nodeValue;
|
|
589
593
|
}
|
|
590
|
-
return attributes
|
|
594
|
+
return attributes;
|
|
591
595
|
}
|
|
592
596
|
/**
|
|
593
597
|
* Created UL element from content template.
|
|
594
598
|
*
|
|
599
|
+
* @param {createElementParams} createElement - Specifies an array of JSON data.
|
|
595
600
|
* @param {string} template - that need to convert and generate li element.
|
|
596
601
|
* @param {{Object}[]} dataSource - Specifies local JSON data source.
|
|
597
|
-
* @param {
|
|
602
|
+
* @param {FieldsMapping} [fields] - Specifies fields for mapping the dataSource.
|
|
603
|
+
* @param {ListBaseOptions} [options] - Specifies ListBase option for fields.
|
|
604
|
+
* @param {any} [componentInstance] - Specifies component instance.
|
|
605
|
+
* @returns {HTMLElement} - The generated LI element.
|
|
598
606
|
*/
|
|
599
|
-
function renderContentTemplate(createElement, template, dataSource,
|
|
600
|
-
// eslint-disable-next-line
|
|
601
|
-
fields, options, componentInstance) {
|
|
607
|
+
function renderContentTemplate(createElement, template, dataSource, fields, options, componentInstance) {
|
|
602
608
|
cssClass = getModuleClass(defaultListBaseOptions.moduleName);
|
|
603
609
|
var ulElement = createElement('ul', { className: cssClass.ul, attrs: { role: 'presentation' } });
|
|
604
610
|
var curOpt = extend({}, defaultListBaseOptions, options);
|
|
@@ -652,7 +658,6 @@ var ListBase;
|
|
|
652
658
|
var currentID = isHeader ? curOpt.groupTemplateID : curOpt.templateID;
|
|
653
659
|
if (isHeader) {
|
|
654
660
|
if (componentInstance && componentInstance.getModuleName() !== 'listview') {
|
|
655
|
-
// eslint-disable-next-line
|
|
656
661
|
var compiledElement = compiledString(curItem, componentInstance, 'headerTemplate', currentID, !!curOpt.isStringTemplate, null, li);
|
|
657
662
|
if (compiledElement) {
|
|
658
663
|
append(compiledElement, li);
|
|
@@ -664,7 +669,6 @@ var ListBase;
|
|
|
664
669
|
}
|
|
665
670
|
else {
|
|
666
671
|
if (componentInstance && componentInstance.getModuleName() !== 'listview') {
|
|
667
|
-
// eslint-disable-next-line
|
|
668
672
|
var compiledElement = compiledString(curItem, componentInstance, 'template', currentID, !!curOpt.isStringTemplate, null, li);
|
|
669
673
|
if (compiledElement) {
|
|
670
674
|
append(compiledElement, li);
|
|
@@ -697,18 +701,23 @@ var ListBase;
|
|
|
697
701
|
/**
|
|
698
702
|
* Created header items from group template.
|
|
699
703
|
*
|
|
700
|
-
* @param {string}
|
|
704
|
+
* @param {string | Function} groupTemplate - that need to convert and generate li element.
|
|
701
705
|
*
|
|
702
|
-
* @param
|
|
706
|
+
* @param {{Object}[]} groupDataSource - Specifies local JSON data source.
|
|
703
707
|
*
|
|
704
708
|
* @param {FieldsMapping} fields - Specifies fields for mapping the dataSource.
|
|
705
709
|
*
|
|
706
|
-
* @param {Element[]} headerItems
|
|
710
|
+
* @param {Element[]} headerItems - Specifies ListBase header items.
|
|
711
|
+
*
|
|
712
|
+
* @param {ListBaseOptions} [options] - Optional ListBase options.
|
|
713
|
+
*
|
|
714
|
+
* @param {*} [componentInstance] - Optional component instance.
|
|
715
|
+
*
|
|
716
|
+
* @returns {Element[]} - An array of header elements with the rendered group template content.
|
|
707
717
|
*/
|
|
718
|
+
function renderGroupTemplate(groupTemplate,
|
|
708
719
|
// tslint:disable-next-line
|
|
709
|
-
|
|
710
|
-
// eslint-disable-next-line
|
|
711
|
-
headerItems, options, componentInstance) {
|
|
720
|
+
groupDataSource, fields, headerItems, options, componentInstance) {
|
|
712
721
|
var compiledString = compileTemplate(groupTemplate);
|
|
713
722
|
var curFields = extend({}, ListBase.defaultMappedFields, fields);
|
|
714
723
|
var curOpt = extend({}, defaultListBaseOptions, options);
|
|
@@ -719,7 +728,6 @@ var ListBase;
|
|
|
719
728
|
headerData["" + category] = header.textContent;
|
|
720
729
|
header.innerHTML = '';
|
|
721
730
|
if (componentInstance && componentInstance.getModuleName() !== 'listview') {
|
|
722
|
-
// eslint-disable-next-line
|
|
723
731
|
var compiledElement = compiledString(headerData, componentInstance, 'groupTemplate', curOpt.groupTemplateID, !!curOpt.isStringTemplate, null, header);
|
|
724
732
|
if (compiledElement) {
|
|
725
733
|
append(compiledElement, header);
|
|
@@ -732,12 +740,29 @@ var ListBase;
|
|
|
732
740
|
return headerItems;
|
|
733
741
|
}
|
|
734
742
|
ListBase.renderGroupTemplate = renderGroupTemplate;
|
|
743
|
+
/**
|
|
744
|
+
* Generates a random hexadecimal ID string.
|
|
745
|
+
*
|
|
746
|
+
* @returns {string} - The generated ID string.
|
|
747
|
+
*/
|
|
735
748
|
function generateId() {
|
|
736
749
|
return Math.floor((1 + Math.random()) * 0x10000)
|
|
737
750
|
.toString(16)
|
|
738
751
|
.substring(1);
|
|
739
752
|
}
|
|
740
753
|
ListBase.generateId = generateId;
|
|
754
|
+
/**
|
|
755
|
+
* Processes the sub-child elements and creates corresponding elements based on the provided field data and options.
|
|
756
|
+
*
|
|
757
|
+
* @param {Function} createElement - Function for creating elements.
|
|
758
|
+
* @param {Object} fieldData - Field data containing sub-child information.
|
|
759
|
+
* @param {FieldsMapping} fields - Field mappings.
|
|
760
|
+
* @param {Object[]} ds - The data source array containing sub-child elements.
|
|
761
|
+
* @param {ListBaseOptions} options - ListBase options.
|
|
762
|
+
* @param {HTMLElement} element - The parent HTML element to append sub-child elements to.
|
|
763
|
+
* @param {number} level - The level of the sub-child elements.
|
|
764
|
+
* @returns {void}
|
|
765
|
+
*/
|
|
741
766
|
function processSubChild(createElement, fieldData, fields, ds, options, element, level) {
|
|
742
767
|
// Get SubList
|
|
743
768
|
var subDS = fieldData[fields.child] || [];
|
|
@@ -758,6 +783,21 @@ var ListBase;
|
|
|
758
783
|
expandElement([createElement('div', { className: 'e-icons ' + options.expandIconClass })], element.querySelector('.' + cssClass.textContent));
|
|
759
784
|
}
|
|
760
785
|
}
|
|
786
|
+
/**
|
|
787
|
+
* Generates a single-level LI (list item) element based on the provided item and field data.
|
|
788
|
+
*
|
|
789
|
+
* @param {Function} createElement - Function for creating elements.
|
|
790
|
+
* @param {string | Object | number} item - The item data.
|
|
791
|
+
* @param {Object} fieldData - Field data mapped from the item.
|
|
792
|
+
* @param {FieldsMapping} [fields] - Field mappings.
|
|
793
|
+
* @param {string} [className] - Optional class name to add to the created LI element.
|
|
794
|
+
* @param {HTMLElement[]} [innerElements] - Optional array of inner elements to append to the LI element.
|
|
795
|
+
* @param {boolean} [grpLI] - Indicates if the LI element is a group item.
|
|
796
|
+
* @param {string} [id] - The ID of the LI element.
|
|
797
|
+
* @param {number} [index] - The index of the LI element.
|
|
798
|
+
* @param {ListBaseOptions} [options] - Optional ListBase options.
|
|
799
|
+
* @returns {HTMLElement} - The generated LI element.
|
|
800
|
+
*/
|
|
761
801
|
function generateSingleLevelLI(createElement, item, fieldData, fields, className, innerElements, grpLI, id, index, options) {
|
|
762
802
|
var curOpt = extend({}, defaultListBaseOptions, options);
|
|
763
803
|
var ariaAttributes = extend({}, defaultAriaAttributes, curOpt.ariaAttributes);
|
|
@@ -783,8 +823,7 @@ var ListBase;
|
|
|
783
823
|
id: elementID, attrs: (ariaAttributes.groupItemRole !== '' && ariaAttributes.itemRole !== '' ?
|
|
784
824
|
{ role: (grpLI === true ? ariaAttributes.groupItemRole : ariaAttributes.itemRole) } : {})
|
|
785
825
|
});
|
|
786
|
-
|
|
787
|
-
if (dataSource && fieldData.hasOwnProperty(fields.enabled) && fieldData[fields.enabled].toString() === 'false') {
|
|
826
|
+
if (dataSource && Object.prototype.hasOwnProperty.call(fieldData, fields.enabled) && fieldData[fields.enabled].toString() === 'false') {
|
|
788
827
|
li.classList.add(cssClass.disabled);
|
|
789
828
|
}
|
|
790
829
|
if (grpLI) {
|
|
@@ -793,8 +832,7 @@ var ListBase;
|
|
|
793
832
|
else {
|
|
794
833
|
li.setAttribute('data-value', isNullOrUndefined(value) ? 'null' : value);
|
|
795
834
|
li.setAttribute('role', 'option');
|
|
796
|
-
|
|
797
|
-
if (dataSource && fieldData.hasOwnProperty(fields.htmlAttributes) && fieldData[fields.htmlAttributes]) {
|
|
835
|
+
if (dataSource && Object.prototype.hasOwnProperty.call(fieldData, fields.htmlAttributes) && fieldData[fields.htmlAttributes]) {
|
|
798
836
|
setAttribute(li, fieldData[fields.htmlAttributes]);
|
|
799
837
|
}
|
|
800
838
|
if (innerElements.length && !curOpt.itemNavigable) {
|
|
@@ -813,6 +851,12 @@ var ListBase;
|
|
|
813
851
|
}
|
|
814
852
|
return li;
|
|
815
853
|
}
|
|
854
|
+
/**
|
|
855
|
+
* Returns a set of CSS class names based on the provided module name.
|
|
856
|
+
*
|
|
857
|
+
* @param {string} moduleName - The name of the module.
|
|
858
|
+
* @returns {ClassList} - The CSS class names associated with the module.
|
|
859
|
+
*/
|
|
816
860
|
function getModuleClass(moduleName) {
|
|
817
861
|
var moduleClass;
|
|
818
862
|
// eslint-disable-next-line
|
|
@@ -838,11 +882,21 @@ var ListBase;
|
|
|
838
882
|
navigable: 'e-navigable'
|
|
839
883
|
};
|
|
840
884
|
}
|
|
885
|
+
/**
|
|
886
|
+
* Creates an anchor tag (<a>) element based on the provided data source, fields, and text.
|
|
887
|
+
*
|
|
888
|
+
* @param {Function} createElement - Function for creating elements.
|
|
889
|
+
* @param {object} dataSource - The data source containing URL-related fields.
|
|
890
|
+
* @param {FieldsMapping} fields - Field mappings for the data source.
|
|
891
|
+
* @param {string} text - The text content of the anchor tag.
|
|
892
|
+
* @param {HTMLElement[]} innerElements - Optional array of inner elements to append to the anchor tag.
|
|
893
|
+
* @param {boolean} isFullNavigation - Indicates whether the anchor tag should be for full navigation.
|
|
894
|
+
* @returns {HTMLElement} The created anchor tag element.
|
|
895
|
+
*/
|
|
841
896
|
function anchorTag(createElement, dataSource, fields, text, innerElements, isFullNavigation) {
|
|
842
897
|
var fieldData = getFieldValues(dataSource, fields);
|
|
843
898
|
var attr = { href: fieldData[fields.url] };
|
|
844
|
-
|
|
845
|
-
if (fieldData.hasOwnProperty(fields.urlAttributes) && fieldData[fields.urlAttributes]) {
|
|
899
|
+
if (Object.prototype.hasOwnProperty.call(fieldData, fields.urlAttributes) && fieldData[fields.urlAttributes]) {
|
|
846
900
|
merge(attr, fieldData[fields.urlAttributes]);
|
|
847
901
|
attr.href = fieldData[fields.url] ? fieldData[fields.url] :
|
|
848
902
|
fieldData[fields.urlAttributes].href;
|
|
@@ -863,11 +917,19 @@ var ListBase;
|
|
|
863
917
|
setAttribute(anchorTag, attr);
|
|
864
918
|
return anchorTag;
|
|
865
919
|
}
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
920
|
+
/**
|
|
921
|
+
* Generates an LI element based on the provided item and field data.
|
|
922
|
+
*
|
|
923
|
+
* @param {Function} createElement - Function for creating elements.
|
|
924
|
+
* @param {string | Object | number} item - The item data.
|
|
925
|
+
* @param {Object} fieldData - Field data mapped from the item.
|
|
926
|
+
* @param {FieldsMapping} fields - Field mappings.
|
|
927
|
+
* @param {string} [className] - Optional class name to add to the created LI element.
|
|
928
|
+
* @param {ListBaseOptions} [options] - Optional ListBase options.
|
|
929
|
+
* @param {*} [componentInstance] - Optional component instance.
|
|
930
|
+
* @returns {HTMLElement} - The generated LI element.
|
|
931
|
+
*/
|
|
932
|
+
function generateLI(createElement, item, fieldData, fields, className, options, componentInstance) {
|
|
871
933
|
var curOpt = extend({}, defaultListBaseOptions, options);
|
|
872
934
|
var ariaAttributes = extend({}, defaultAriaAttributes, curOpt.ariaAttributes);
|
|
873
935
|
var text = item;
|
|
@@ -877,10 +939,8 @@ var ListBase;
|
|
|
877
939
|
if (typeof item !== 'string' && typeof item !== 'number') {
|
|
878
940
|
dataSource = item;
|
|
879
941
|
text = fieldData[fields.text] || '';
|
|
880
|
-
// tslint:disable-next-line
|
|
881
942
|
uID = (isNullOrUndefined(fieldData['_id'])) ? fieldData[fields.id] : fieldData['_id'];
|
|
882
|
-
|
|
883
|
-
grpLI = (item.hasOwnProperty('isHeader') && item.isHeader)
|
|
943
|
+
grpLI = (Object.prototype.hasOwnProperty.call(item, 'isHeader') && item.isHeader)
|
|
884
944
|
? true : false;
|
|
885
945
|
}
|
|
886
946
|
if (options && options.enableHtmlSanitizer) {
|
|
@@ -901,7 +961,6 @@ var ListBase;
|
|
|
901
961
|
if (grpLI && options && options.groupTemplate) {
|
|
902
962
|
var compiledString = compileTemplate(options.groupTemplate);
|
|
903
963
|
if (componentInstance && componentInstance.getModuleName() !== 'listview') {
|
|
904
|
-
// eslint-disable-next-line
|
|
905
964
|
var compiledElement = compiledString(item, componentInstance, 'groupTemplate', curOpt.groupTemplateID, !!curOpt.isStringTemplate, null, li);
|
|
906
965
|
if (compiledElement) {
|
|
907
966
|
append(compiledElement, li);
|
|
@@ -914,7 +973,6 @@ var ListBase;
|
|
|
914
973
|
else if (!grpLI && options && options.template) {
|
|
915
974
|
var compiledString = compileTemplate(options.template);
|
|
916
975
|
if (componentInstance && componentInstance.getModuleName() !== 'listview') {
|
|
917
|
-
// eslint-disable-next-line
|
|
918
976
|
var compiledElement = compiledString(item, componentInstance, 'template', curOpt.templateID, !!curOpt.isStringTemplate, null, li);
|
|
919
977
|
if (compiledElement) {
|
|
920
978
|
append(compiledElement, li);
|
|
@@ -953,11 +1011,15 @@ var ListBase;
|
|
|
953
1011
|
/**
|
|
954
1012
|
* Returns UL element based on the given LI element.
|
|
955
1013
|
*
|
|
1014
|
+
* @param {Function} createElement - Function for creating elements.
|
|
1015
|
+
*
|
|
956
1016
|
* @param {HTMLElement[]} liElement - Specifies array of LI element.
|
|
957
1017
|
*
|
|
958
|
-
* @param {string} className
|
|
1018
|
+
* @param {string} [className] - Specifies class name that need to be added in UL element.
|
|
1019
|
+
*
|
|
1020
|
+
* @param {ListBaseOptions} [options] - Specifies ListBase options.
|
|
959
1021
|
*
|
|
960
|
-
* @
|
|
1022
|
+
* @returns {HTMLElement} - The created UL element.
|
|
961
1023
|
*/
|
|
962
1024
|
function generateUL(createElement, liElement, className, options) {
|
|
963
1025
|
var curOpt = extend({}, defaultListBaseOptions, options);
|
|
@@ -974,11 +1036,15 @@ var ListBase;
|
|
|
974
1036
|
/**
|
|
975
1037
|
* Returns LI element with additional DIV tag based on the given LI element.
|
|
976
1038
|
*
|
|
1039
|
+
* @param {Function} createElement - Function for creating elements.
|
|
1040
|
+
*
|
|
977
1041
|
* @param {liElement} liElement - Specifies LI element.
|
|
978
1042
|
*
|
|
979
|
-
* @param {string} className
|
|
1043
|
+
* @param {string} [className] - Specifies class name that need to be added in created DIV element.
|
|
980
1044
|
*
|
|
981
|
-
* @param {ListBaseOptions} options
|
|
1045
|
+
* @param {ListBaseOptions} [options] - Specifies ListBase options.
|
|
1046
|
+
*
|
|
1047
|
+
* @returns {HTMLElement} - The modified LI element.
|
|
982
1048
|
*/
|
|
983
1049
|
function generateIcon(createElement, liElement, className, options) {
|
|
984
1050
|
var curOpt = extend({}, defaultListBaseOptions, options);
|
|
@@ -995,9 +1061,10 @@ var ListBase;
|
|
|
995
1061
|
/**
|
|
996
1062
|
* Used to get dataSource item from complex data using fields.
|
|
997
1063
|
*
|
|
998
|
-
* @param {Object}
|
|
1064
|
+
* @param {Object} dataItem - Specifies an JSON or String data.
|
|
999
1065
|
*
|
|
1000
1066
|
* @param {FieldsMapping} fields - Fields that are mapped from the dataSource.
|
|
1067
|
+
* @returns {Object|string|number} - The retrieved field values.
|
|
1001
1068
|
*/
|
|
1002
1069
|
function getFieldValues(dataItem, fields) {
|
|
1003
1070
|
var fieldData = {};
|
|
@@ -1018,6 +1085,12 @@ function getFieldValues(dataItem, fields) {
|
|
|
1018
1085
|
}
|
|
1019
1086
|
return fieldData;
|
|
1020
1087
|
}
|
|
1088
|
+
/**
|
|
1089
|
+
* Compiles a template string or function into a compiled function.
|
|
1090
|
+
*
|
|
1091
|
+
* @param {string | Function} template - The template string or function to compile.
|
|
1092
|
+
* @returns {Function | undefined} - The compiled function, or undefined if the input is false.
|
|
1093
|
+
*/
|
|
1021
1094
|
function compileTemplate(template) {
|
|
1022
1095
|
if (template) {
|
|
1023
1096
|
try {
|
|
@@ -1054,6 +1127,7 @@ var __decorate = (undefined && undefined.__decorate) || function (decorators, ta
|
|
|
1054
1127
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1055
1128
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1056
1129
|
};
|
|
1130
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
1057
1131
|
// Effect Configuration Effect[] = [fromViewBackward,fromViewForward,toViewBackward,toviewForward];
|
|
1058
1132
|
var effectsConfig = {
|
|
1059
1133
|
'None': [],
|
|
@@ -1214,7 +1288,6 @@ var ListView = /** @__PURE__ @class */ (function (_super) {
|
|
|
1214
1288
|
this.setEnableRTL();
|
|
1215
1289
|
break;
|
|
1216
1290
|
case 'fields':
|
|
1217
|
-
// eslint-disable-next-line
|
|
1218
1291
|
this.listBaseOption.fields = this.fields.properties;
|
|
1219
1292
|
if (this.enableVirtualization) {
|
|
1220
1293
|
this.virtualizationModule.reRenderUiVirtualization();
|
|
@@ -1278,14 +1351,12 @@ var ListView = /** @__PURE__ @class */ (function (_super) {
|
|
|
1278
1351
|
this.resetCurrentList();
|
|
1279
1352
|
}
|
|
1280
1353
|
break;
|
|
1281
|
-
default:
|
|
1282
|
-
break;
|
|
1283
1354
|
}
|
|
1284
1355
|
}
|
|
1285
1356
|
};
|
|
1286
1357
|
// Model Changes
|
|
1287
1358
|
ListView.prototype.setHTMLAttribute = function () {
|
|
1288
|
-
if (Object.keys(this.htmlAttributes).length) {
|
|
1359
|
+
if (!isNullOrUndefined(this.htmlAttributes) && Object.keys(this.htmlAttributes).length) {
|
|
1289
1360
|
attributes(this.element, this.htmlAttributes);
|
|
1290
1361
|
}
|
|
1291
1362
|
};
|
|
@@ -1343,13 +1414,11 @@ var ListView = /** @__PURE__ @class */ (function (_super) {
|
|
|
1343
1414
|
if (this.headerTemplate) {
|
|
1344
1415
|
var compiledString = compile(this.headerTemplate);
|
|
1345
1416
|
var headerTemplateEle = this.createElement('div', { className: classNames.headerTemplateText });
|
|
1346
|
-
// eslint-disable-next-line
|
|
1347
1417
|
var compiledElement = compiledString({}, this, prop, this.LISTVIEW_HEADERTEMPLATE_ID, null, null, this.headerEle);
|
|
1348
1418
|
if (compiledElement) {
|
|
1349
1419
|
append(compiledElement, headerTemplateEle);
|
|
1350
1420
|
}
|
|
1351
1421
|
append([headerTemplateEle], this.headerEle);
|
|
1352
|
-
// eslint-disable-next-line
|
|
1353
1422
|
if (this.isReact) {
|
|
1354
1423
|
this.renderReactTemplates();
|
|
1355
1424
|
}
|
|
@@ -1414,8 +1483,7 @@ var ListView = /** @__PURE__ @class */ (function (_super) {
|
|
|
1414
1483
|
name: (reverse === true ? anim[0] : anim[1]),
|
|
1415
1484
|
duration: (duration === 0 && animationMode === 'Enable') ? 400 : duration,
|
|
1416
1485
|
timingFunction: this.animation.easing,
|
|
1417
|
-
|
|
1418
|
-
end: function (model) {
|
|
1486
|
+
end: function () {
|
|
1419
1487
|
fromView.style.display = 'none';
|
|
1420
1488
|
_this.element.style.overflow = overflow_1;
|
|
1421
1489
|
fromView.style.position = fPos_1;
|
|
@@ -1453,7 +1521,6 @@ var ListView = /** @__PURE__ @class */ (function (_super) {
|
|
|
1453
1521
|
itemRole: 'listitem', listRole: 'list', itemText: '',
|
|
1454
1522
|
groupItemRole: 'presentation', wrapperRole: 'presentation'
|
|
1455
1523
|
},
|
|
1456
|
-
// eslint-disable-next-line
|
|
1457
1524
|
fields: (this.fields.properties),
|
|
1458
1525
|
sortOrder: this.sortOrder,
|
|
1459
1526
|
showIcon: this.showIcon,
|
|
@@ -1488,10 +1555,8 @@ var ListView = /** @__PURE__ @class */ (function (_super) {
|
|
|
1488
1555
|
this.isNestedList = true;
|
|
1489
1556
|
}
|
|
1490
1557
|
if (this.showCheckBox && args.item.classList.contains(classNames.listItem)) {
|
|
1491
|
-
var checkboxElement = void 0;
|
|
1492
1558
|
var fieldData_1;
|
|
1493
|
-
|
|
1494
|
-
checkboxElement = createCheckBox(this.createElement, false, {
|
|
1559
|
+
var checkboxElement = createCheckBox(this.createElement, false, {
|
|
1495
1560
|
checked: false, enableRtl: this.enableRtl,
|
|
1496
1561
|
cssClass: classNames.listviewCheckbox
|
|
1497
1562
|
});
|
|
@@ -1628,7 +1693,6 @@ var ListView = /** @__PURE__ @class */ (function (_super) {
|
|
|
1628
1693
|
for (var i = 0; i < liCollection.length; i++) {
|
|
1629
1694
|
var element = liCollection[i];
|
|
1630
1695
|
args.item = element;
|
|
1631
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1632
1696
|
args.curData = this.getItemData(element);
|
|
1633
1697
|
if (element.querySelector('.' + classNames.checkboxWrapper)) {
|
|
1634
1698
|
this.removeElement(element.querySelector('.' + classNames.checkboxWrapper));
|
|
@@ -1743,8 +1807,7 @@ var ListView = /** @__PURE__ @class */ (function (_super) {
|
|
|
1743
1807
|
var curLi = closest(e.target.parentNode, '.' + classNames.listItem);
|
|
1744
1808
|
this.setHoverLI(curLi);
|
|
1745
1809
|
};
|
|
1746
|
-
|
|
1747
|
-
ListView.prototype.leaveHandler = function (e) {
|
|
1810
|
+
ListView.prototype.leaveHandler = function () {
|
|
1748
1811
|
this.removeHover();
|
|
1749
1812
|
};
|
|
1750
1813
|
ListView.prototype.homeKeyHandler = function (e, end) {
|
|
@@ -1998,7 +2061,8 @@ var ListView = /** @__PURE__ @class */ (function (_super) {
|
|
|
1998
2061
|
if (!isNullOrUndefined(this.scroll)) {
|
|
1999
2062
|
EventHandler.remove(this.element, 'scroll', this.onListScroll);
|
|
2000
2063
|
}
|
|
2001
|
-
this.touchModule
|
|
2064
|
+
if (this.touchModule)
|
|
2065
|
+
this.touchModule.destroy();
|
|
2002
2066
|
this.touchModule = null;
|
|
2003
2067
|
};
|
|
2004
2068
|
ListView.prototype.removeFocus = function () {
|
|
@@ -2083,7 +2147,6 @@ var ListView = /** @__PURE__ @class */ (function (_super) {
|
|
|
2083
2147
|
selectedItem =
|
|
2084
2148
|
{
|
|
2085
2149
|
item: li, text: fieldData && fieldData[this.listBaseOption.fields.text],
|
|
2086
|
-
// eslint-disable-next-line
|
|
2087
2150
|
data: data
|
|
2088
2151
|
};
|
|
2089
2152
|
}
|
|
@@ -2101,7 +2164,6 @@ var ListView = /** @__PURE__ @class */ (function (_super) {
|
|
|
2101
2164
|
};
|
|
2102
2165
|
ListView.prototype.setSelectedItemData = function (li) {
|
|
2103
2166
|
var data = this.getItemData(li);
|
|
2104
|
-
// eslint-disable-next-line
|
|
2105
2167
|
var fieldData = getFieldValues(data, this.listBaseOption.fields);
|
|
2106
2168
|
if (!isNullOrUndefined(data) && ((typeof this.dataSource[0] === 'string') ||
|
|
2107
2169
|
(typeof this.dataSource[0] === 'number'))) {
|
|
@@ -2114,9 +2176,7 @@ var ListView = /** @__PURE__ @class */ (function (_super) {
|
|
|
2114
2176
|
else {
|
|
2115
2177
|
this.selectedItems = {
|
|
2116
2178
|
item: li,
|
|
2117
|
-
// eslint-disable-next-line
|
|
2118
2179
|
text: fieldData && fieldData[this.listBaseOption.fields.text],
|
|
2119
|
-
// eslint-disable-next-line
|
|
2120
2180
|
data: data
|
|
2121
2181
|
};
|
|
2122
2182
|
}
|
|
@@ -2161,7 +2221,6 @@ var ListView = /** @__PURE__ @class */ (function (_super) {
|
|
|
2161
2221
|
for (var _i = 0, levelKeys_1 = levelKeys; _i < levelKeys_1.length; _i++) {
|
|
2162
2222
|
var key = levelKeys_1[_i];
|
|
2163
2223
|
var field = {};
|
|
2164
|
-
// eslint-disable-next-line
|
|
2165
2224
|
field[this.fields.id] = key;
|
|
2166
2225
|
this.curDSJSON = this.findItemFromDS(ds, field);
|
|
2167
2226
|
var fieldData = getFieldValues(this.curDSJSON, this.listBaseOption.fields);
|
|
@@ -2189,9 +2248,7 @@ var ListView = /** @__PURE__ @class */ (function (_super) {
|
|
|
2189
2248
|
var resultJSON;
|
|
2190
2249
|
if (dataSource && dataSource.length && fields) {
|
|
2191
2250
|
dataSource.some(function (data) {
|
|
2192
|
-
var fieldData =
|
|
2193
|
-
// eslint-disable-next-line
|
|
2194
|
-
getFieldValues(data, _this.listBaseOption.fields);
|
|
2251
|
+
var fieldData = getFieldValues(data, _this.listBaseOption.fields);
|
|
2195
2252
|
//(!(fid) || id === fid) && (!(ftext) || text === ftext) && (!!fid || !!ftext)
|
|
2196
2253
|
if ((fields[_this.fields.id] || fields[_this.fields.text]) &&
|
|
2197
2254
|
(!fields[_this.fields.id] || (!isNullOrUndefined(fieldData[_this.fields.id]) &&
|
|
@@ -2205,13 +2262,12 @@ var ListView = /** @__PURE__ @class */ (function (_super) {
|
|
|
2205
2262
|
else if (!isNullOrUndefined(fields[_this.fields.id]) && isNullOrUndefined(fieldData[_this.fields.id])) {
|
|
2206
2263
|
var li = _this.element.querySelector('[data-uid="'
|
|
2207
2264
|
+ fields[_this.fields.id] + '"]');
|
|
2208
|
-
// eslint-disable-next-line
|
|
2209
2265
|
if (li && li.innerText.trim() === fieldData[_this.fields.text]) {
|
|
2210
2266
|
resultJSON = data;
|
|
2211
2267
|
}
|
|
2212
|
-
// eslint-disable-next-line
|
|
2213
2268
|
}
|
|
2214
|
-
else if (
|
|
2269
|
+
else if (Object.prototype.hasOwnProperty.call(fieldData, _this.fields.child) &&
|
|
2270
|
+
fieldData[_this.fields.child].length) {
|
|
2215
2271
|
resultJSON = _this.findItemFromDS(fieldData[_this.fields.child], fields, parent);
|
|
2216
2272
|
}
|
|
2217
2273
|
return !!resultJSON;
|
|
@@ -2226,7 +2282,6 @@ var ListView = /** @__PURE__ @class */ (function (_super) {
|
|
|
2226
2282
|
var columns = [];
|
|
2227
2283
|
var query = (this.query ? this.query : new Query());
|
|
2228
2284
|
if (!this.query) {
|
|
2229
|
-
// eslint-disable-next-line
|
|
2230
2285
|
for (var _i = 0, _a = Object.keys(this.fields.properties); _i < _a.length; _i++) {
|
|
2231
2286
|
var column = _a[_i];
|
|
2232
2287
|
if (column !== 'tableName' && !!(this.fields["" + column]) &&
|
|
@@ -2237,8 +2292,7 @@ var ListView = /** @__PURE__ @class */ (function (_super) {
|
|
|
2237
2292
|
}
|
|
2238
2293
|
}
|
|
2239
2294
|
query.select(columns);
|
|
2240
|
-
|
|
2241
|
-
if (this.fields.properties.hasOwnProperty('tableName')) {
|
|
2295
|
+
if (Object.prototype.hasOwnProperty.call(this.fields.properties, 'tableName')) {
|
|
2242
2296
|
query.from(this.fields.tableName);
|
|
2243
2297
|
}
|
|
2244
2298
|
}
|
|
@@ -2246,7 +2300,6 @@ var ListView = /** @__PURE__ @class */ (function (_super) {
|
|
|
2246
2300
|
};
|
|
2247
2301
|
ListView.prototype.setViewDataSource = function (dataSource) {
|
|
2248
2302
|
if (dataSource === void 0) { dataSource = this.localData; }
|
|
2249
|
-
// eslint-disable-next-line
|
|
2250
2303
|
var fieldValue = (isNullOrUndefined(this.fields.sortBy)) ? this.fields.text : this.fields.sortBy;
|
|
2251
2304
|
var query = ListBase.addSorting(this.sortOrder, fieldValue);
|
|
2252
2305
|
if (dataSource && this.fields.groupBy) {
|
|
@@ -2285,15 +2338,12 @@ var ListView = /** @__PURE__ @class */ (function (_super) {
|
|
|
2285
2338
|
ListView.prototype.setLocalData = function () {
|
|
2286
2339
|
var _this = this;
|
|
2287
2340
|
this.trigger('actionBegin');
|
|
2288
|
-
// eslint-disable-next-line
|
|
2289
|
-
var listViewComponent = this;
|
|
2290
2341
|
if (this.dataSource instanceof DataManager) {
|
|
2291
2342
|
if (this.dataSource.ready) {
|
|
2292
2343
|
this.dataSource.ready.then(function (e) {
|
|
2293
|
-
/* eslint-disable */
|
|
2294
2344
|
_this.isOffline = _this.dataSource.dataSource.offline;
|
|
2295
2345
|
if (_this.dataSource instanceof DataManager && _this.isOffline) {
|
|
2296
|
-
_this.renderRemoteLists(e,
|
|
2346
|
+
_this.renderRemoteLists(e, _this);
|
|
2297
2347
|
}
|
|
2298
2348
|
}).catch(function (e) {
|
|
2299
2349
|
_this.triggerActionFailure(e);
|
|
@@ -2301,7 +2351,7 @@ var ListView = /** @__PURE__ @class */ (function (_super) {
|
|
|
2301
2351
|
}
|
|
2302
2352
|
else {
|
|
2303
2353
|
this.dataSource.executeQuery(this.getQuery()).then(function (e) {
|
|
2304
|
-
_this.renderRemoteLists(e,
|
|
2354
|
+
_this.renderRemoteLists(e, _this);
|
|
2305
2355
|
}).catch(function (e) {
|
|
2306
2356
|
_this.triggerActionFailure(e);
|
|
2307
2357
|
});
|
|
@@ -2345,7 +2395,7 @@ var ListView = /** @__PURE__ @class */ (function (_super) {
|
|
|
2345
2395
|
};
|
|
2346
2396
|
ListView.prototype.setAttributes = function (liElements) {
|
|
2347
2397
|
for (var i = 0; i < liElements.length; i++) {
|
|
2348
|
-
var element = liElements[i];
|
|
2398
|
+
var element = liElements[parseInt(i.toString(), 10)];
|
|
2349
2399
|
if (element.classList.contains('e-list-item')) {
|
|
2350
2400
|
element.setAttribute('id', this.element.id + '_' + element.getAttribute('data-uid'));
|
|
2351
2401
|
element.setAttribute('tabindex', '-1');
|
|
@@ -2359,15 +2409,6 @@ var ListView = /** @__PURE__ @class */ (function (_super) {
|
|
|
2359
2409
|
this.liCollection = this.curUL.querySelectorAll('.' + classNames.listItem);
|
|
2360
2410
|
this.setAttributes(this.liCollection);
|
|
2361
2411
|
};
|
|
2362
|
-
ListView.prototype.exceptionEvent = function (e) {
|
|
2363
|
-
this.trigger('actionFailure', e);
|
|
2364
|
-
};
|
|
2365
|
-
ListView.prototype.UpdateCurrentUL = function () {
|
|
2366
|
-
this.ulElement = this.curUL = this.element.querySelector('.' + classNames.parentItem);
|
|
2367
|
-
if (this.curUL) {
|
|
2368
|
-
this.liCollection = this.curUL.querySelectorAll('.' + classNames.listItem);
|
|
2369
|
-
}
|
|
2370
|
-
};
|
|
2371
2412
|
ListView.prototype.renderSubList = function (li) {
|
|
2372
2413
|
this.liElement = li;
|
|
2373
2414
|
var uID = li.getAttribute('data-uid');
|
|
@@ -2459,7 +2500,7 @@ var ListView = /** @__PURE__ @class */ (function (_super) {
|
|
|
2459
2500
|
}
|
|
2460
2501
|
this.unWireEvents();
|
|
2461
2502
|
var classAr = [classNames.root, classNames.disable, 'e-rtl',
|
|
2462
|
-
'e-has-header', 'e-lib'].concat(this.cssClass.split(' ').filter(function (css) { return css; }));
|
|
2503
|
+
'e-has-header', 'e-lib'].concat(this.cssClass ? this.cssClass.split(' ').filter(function (css) { return css; }) : []);
|
|
2463
2504
|
removeClass([this.element], classAr);
|
|
2464
2505
|
this.element.removeAttribute('role');
|
|
2465
2506
|
this.element.removeAttribute('tabindex');
|
|
@@ -2556,8 +2597,8 @@ var ListView = /** @__PURE__ @class */ (function (_super) {
|
|
|
2556
2597
|
if (obj instanceof Element) {
|
|
2557
2598
|
var uid = obj.getAttribute('data-uid').toString();
|
|
2558
2599
|
for (var i = 0; i < this.liCollection.length; i++) {
|
|
2559
|
-
if (this.liCollection[i].getAttribute('data-uid').toString() === uid) {
|
|
2560
|
-
li = this.liCollection[i];
|
|
2600
|
+
if (this.liCollection[parseInt(i.toString(), 10)].getAttribute('data-uid').toString() === uid) {
|
|
2601
|
+
li = this.liCollection[parseInt(i.toString(), 10)];
|
|
2561
2602
|
break;
|
|
2562
2603
|
}
|
|
2563
2604
|
}
|
|
@@ -2583,8 +2624,9 @@ var ListView = /** @__PURE__ @class */ (function (_super) {
|
|
|
2583
2624
|
if (!this.enableVirtualization && isNullOrUndefined(li)) {
|
|
2584
2625
|
var curLi = this.element.querySelectorAll('.' + classNames.listItem);
|
|
2585
2626
|
for (var i = 0; i < curLi.length; i++) {
|
|
2586
|
-
if (curLi[i].innerText.trim() ===
|
|
2587
|
-
|
|
2627
|
+
if (curLi[parseInt(i.toString(), 10)].innerText.trim() ===
|
|
2628
|
+
fieldData[this.fields.text]) {
|
|
2629
|
+
li = curLi[parseInt(i.toString(), 10)];
|
|
2588
2630
|
}
|
|
2589
2631
|
}
|
|
2590
2632
|
}
|
|
@@ -2602,8 +2644,8 @@ var ListView = /** @__PURE__ @class */ (function (_super) {
|
|
|
2602
2644
|
ListView.prototype.selectMultipleItems = function (item) {
|
|
2603
2645
|
if (!isNullOrUndefined(item)) {
|
|
2604
2646
|
for (var i = 0; i < item.length; i++) {
|
|
2605
|
-
if (!isNullOrUndefined(item[i])) {
|
|
2606
|
-
this.selectItem(item[i]);
|
|
2647
|
+
if (!isNullOrUndefined(item[parseInt(i.toString(), 10)])) {
|
|
2648
|
+
this.selectItem(item[parseInt(i.toString(), 10)]);
|
|
2607
2649
|
}
|
|
2608
2650
|
}
|
|
2609
2651
|
}
|
|
@@ -2612,7 +2654,7 @@ var ListView = /** @__PURE__ @class */ (function (_super) {
|
|
|
2612
2654
|
var parentId = [];
|
|
2613
2655
|
if (this.isNestedList) {
|
|
2614
2656
|
for (var i = this.curDSLevel.length - 1; i >= 0; i--) {
|
|
2615
|
-
parentId.push(this.curDSLevel[i]);
|
|
2657
|
+
parentId.push(this.curDSLevel[parseInt(i.toString(), 10)]);
|
|
2616
2658
|
}
|
|
2617
2659
|
}
|
|
2618
2660
|
return parentId;
|
|
@@ -2621,7 +2663,7 @@ var ListView = /** @__PURE__ @class */ (function (_super) {
|
|
|
2621
2663
|
this.selectedId = [];
|
|
2622
2664
|
var liCollection = this.curUL.getElementsByClassName(classNames.selected);
|
|
2623
2665
|
for (var i = 0; i < liCollection.length; i++) {
|
|
2624
|
-
var tempData = this.getItemData(liCollection[i]);
|
|
2666
|
+
var tempData = this.getItemData(liCollection[parseInt(i.toString(), 10)]);
|
|
2625
2667
|
if (!isNullOrUndefined(tempData) && tempData[this.listBaseOption.fields.id]) {
|
|
2626
2668
|
this.selectedId.push(tempData[this.listBaseOption.fields.id]);
|
|
2627
2669
|
}
|
|
@@ -2649,10 +2691,10 @@ var ListView = /** @__PURE__ @class */ (function (_super) {
|
|
|
2649
2691
|
var dataParent = [];
|
|
2650
2692
|
for (var i = 0; i < liCollection.length; i++) {
|
|
2651
2693
|
if (typeof dataSource[0] === 'string' || typeof dataSource[0] === 'number') {
|
|
2652
|
-
liTextCollection.push(liCollection[i].innerText.trim());
|
|
2694
|
+
liTextCollection.push(liCollection[parseInt(i.toString(), 10)].innerText.trim());
|
|
2653
2695
|
}
|
|
2654
2696
|
else {
|
|
2655
|
-
var tempData = this.getItemData(liCollection[i]);
|
|
2697
|
+
var tempData = this.getItemData(liCollection[parseInt(i.toString(), 10)]);
|
|
2656
2698
|
var fieldData = getFieldValues(tempData, this.listBaseOption.fields);
|
|
2657
2699
|
if (this.isNestedList) {
|
|
2658
2700
|
dataParent.push({ data: tempData, parentId: this.getParentId() });
|
|
@@ -2839,7 +2881,7 @@ var ListView = /** @__PURE__ @class */ (function (_super) {
|
|
|
2839
2881
|
// check for whether target is nested level or top level in list
|
|
2840
2882
|
if (ds instanceof Array) {
|
|
2841
2883
|
for (var i = 0; i < data.length; i++) {
|
|
2842
|
-
dataSource = this.addItemAtIndex(index, dataSource, data[i]);
|
|
2884
|
+
dataSource = this.addItemAtIndex(index, dataSource, data[parseInt(i.toString(), 10)]);
|
|
2843
2885
|
this.setViewDataSource(dataSource);
|
|
2844
2886
|
// since it is top level target, get the content container's first child
|
|
2845
2887
|
// as it is always the top level UL
|
|
@@ -2849,7 +2891,7 @@ var ListView = /** @__PURE__ @class */ (function (_super) {
|
|
|
2849
2891
|
// check for whether the list was previously empty or not, if it is
|
|
2850
2892
|
// proceed to call initial render
|
|
2851
2893
|
if (this.contentContainer && targetUL) {
|
|
2852
|
-
this.addItemIntoDom(data[i], targetUL, this.curViewDS);
|
|
2894
|
+
this.addItemIntoDom(data[parseInt(i.toString(), 10)], targetUL, this.curViewDS);
|
|
2853
2895
|
}
|
|
2854
2896
|
else {
|
|
2855
2897
|
this.reRender();
|
|
@@ -2868,7 +2910,8 @@ var ListView = /** @__PURE__ @class */ (function (_super) {
|
|
|
2868
2910
|
}
|
|
2869
2911
|
};
|
|
2870
2912
|
ListView.prototype.addItemAtIndex = function (index, newDataSource, itemData) {
|
|
2871
|
-
var isIndexValid = !(isNullOrUndefined(index)) && index >= 0 &&
|
|
2913
|
+
var isIndexValid = !(isNullOrUndefined(index)) && index >= 0 &&
|
|
2914
|
+
index < newDataSource.length && isNullOrUndefined(this.listBaseOption.fields.groupBy);
|
|
2872
2915
|
if (isIndexValid) {
|
|
2873
2916
|
newDataSource.splice(index, 0, itemData);
|
|
2874
2917
|
}
|
|
@@ -2889,20 +2932,20 @@ var ListView = /** @__PURE__ @class */ (function (_super) {
|
|
|
2889
2932
|
: null;
|
|
2890
2933
|
var targetDS = isAlreadyRenderedUL ? targetChildDS : [targetItemData];
|
|
2891
2934
|
var isTargetEmptyChild = targetLi ? !targetLi.classList.contains(classNames.hasChild) : false;
|
|
2935
|
+
// if li element is already rendered, that element needs to be refreshed so that
|
|
2936
|
+
// it becomes child viewable due to new child items are added now
|
|
2892
2937
|
if (isTargetEmptyChild) {
|
|
2893
2938
|
var targetRefreshedElement = ListBase.createListItemFromJson(this.createElement, targetDS, this.listBaseOption, null, null, this);
|
|
2894
2939
|
this.setAttributes(targetRefreshedElement);
|
|
2895
2940
|
targetUL.insertBefore(targetRefreshedElement[0], targetLi);
|
|
2896
2941
|
detach(targetLi);
|
|
2897
|
-
|
|
2898
2942
|
}
|
|
2899
2943
|
// if it is already rendered element, we need to create and append new elements
|
|
2900
2944
|
if (isAlreadyRenderedUL && itemQueue) {
|
|
2901
2945
|
for (var i = 0; i < itemQueue.length; i++) {
|
|
2902
|
-
targetDS.push(itemQueue[i]);
|
|
2903
|
-
this.addItemIntoDom(itemQueue[i], targetUL, targetDS);
|
|
2946
|
+
targetDS.push(itemQueue[parseInt(i.toString(), 10)]);
|
|
2947
|
+
this.addItemIntoDom(itemQueue[parseInt(i.toString(), 10)], targetUL, targetDS);
|
|
2904
2948
|
}
|
|
2905
|
-
|
|
2906
2949
|
}
|
|
2907
2950
|
};
|
|
2908
2951
|
ListView.prototype.addItemIntoDom = function (currentItem, targetUL, curViewDS) {
|
|
@@ -2949,11 +2992,9 @@ var ListView = /** @__PURE__ @class */ (function (_super) {
|
|
|
2949
2992
|
var _this = this;
|
|
2950
2993
|
var curViewDS = this.curViewDS;
|
|
2951
2994
|
var fields = obj instanceof Element ? this.getElementUID(obj) : obj;
|
|
2952
|
-
var dataSource;
|
|
2953
|
-
dataSource = this.findItemFromDS(listDataSource, fields, true);
|
|
2995
|
+
var dataSource = this.findItemFromDS(listDataSource, fields, true);
|
|
2954
2996
|
if (dataSource) {
|
|
2955
|
-
var data_1;
|
|
2956
|
-
data_1 = this.findItemFromDS(dataSource, fields);
|
|
2997
|
+
var data_1 = this.findItemFromDS(dataSource, fields);
|
|
2957
2998
|
var index = curViewDS.indexOf(data_1);
|
|
2958
2999
|
var li = this.getLiFromObjOrElement(obj);
|
|
2959
3000
|
var groupLi = void 0;
|
|
@@ -3013,18 +3054,18 @@ var ListView = /** @__PURE__ @class */ (function (_super) {
|
|
|
3013
3054
|
ListView.prototype.removeMultipleItems = function (item) {
|
|
3014
3055
|
if (item.length) {
|
|
3015
3056
|
for (var i = 0; i < item.length; i++) {
|
|
3016
|
-
this.removeItem(item[i]);
|
|
3057
|
+
this.removeItem(item[parseInt(i.toString(), 10)]);
|
|
3017
3058
|
}
|
|
3018
3059
|
}
|
|
3019
3060
|
};
|
|
3020
3061
|
ListView.prototype.findParent = function (dataSource, id, callback, parent) {
|
|
3021
|
-
if (
|
|
3062
|
+
if (Object.prototype.hasOwnProperty.call(dataSource, id) && callback(dataSource[id]) === true) {
|
|
3022
3063
|
return extend({}, dataSource);
|
|
3023
3064
|
}
|
|
3024
3065
|
for (var i = 0; i < Object.keys(dataSource).length; i++) {
|
|
3025
|
-
if (dataSource[Object.keys(dataSource)[i]]
|
|
3026
|
-
&& typeof dataSource[Object.keys(dataSource)[i]] === 'object') {
|
|
3027
|
-
var result = this.findParent(dataSource[Object.keys(dataSource)[i]], id, callback, dataSource);
|
|
3066
|
+
if (dataSource[Object.keys(dataSource)[parseInt(i.toString(), 10)]]
|
|
3067
|
+
&& typeof dataSource[Object.keys(dataSource)[parseInt(i.toString(), 10)]] === 'object') {
|
|
3068
|
+
var result = this.findParent(dataSource[Object.keys(dataSource)[parseInt(i.toString(), 10)]], id, callback, dataSource);
|
|
3028
3069
|
if (result != null) {
|
|
3029
3070
|
if (!result.parent) {
|
|
3030
3071
|
result.parent = parent;
|
|
@@ -3047,15 +3088,15 @@ var ListView = /** @__PURE__ @class */ (function (_super) {
|
|
|
3047
3088
|
return modules;
|
|
3048
3089
|
};
|
|
3049
3090
|
ListView.prototype.onListScroll = function (e) {
|
|
3050
|
-
var args = { originalEvent: e, scrollDirection:
|
|
3091
|
+
var args = { originalEvent: e, scrollDirection: 'Bottom', distanceY: this.element.scrollHeight - this.element.scrollTop };
|
|
3051
3092
|
var currentScrollTop = this.element.scrollTop;
|
|
3052
3093
|
if (currentScrollTop > this.previousScrollTop) {
|
|
3053
|
-
args.scrollDirection =
|
|
3094
|
+
args.scrollDirection = 'Bottom';
|
|
3054
3095
|
args.distanceY = this.element.scrollHeight - this.element.clientHeight - this.element.scrollTop;
|
|
3055
3096
|
this.trigger('scroll', args);
|
|
3056
3097
|
}
|
|
3057
3098
|
else if (this.previousScrollTop > currentScrollTop) {
|
|
3058
|
-
args.scrollDirection =
|
|
3099
|
+
args.scrollDirection = 'Top';
|
|
3059
3100
|
args.distanceY = this.element.scrollTop;
|
|
3060
3101
|
this.trigger('scroll', args);
|
|
3061
3102
|
}
|
|
@@ -3182,9 +3223,7 @@ var Virtualization = /** @__PURE__ @class */ (function () {
|
|
|
3182
3223
|
this.wireScrollEvent(false);
|
|
3183
3224
|
var curViewDS = this.listViewInstance.curViewDS;
|
|
3184
3225
|
var firstDs = curViewDS.slice(0, 1);
|
|
3185
|
-
this.listViewInstance.ulElement = this.listViewInstance.curUL = ListBase.createList(
|
|
3186
|
-
// eslint-disable-next-line
|
|
3187
|
-
this.listViewInstance.createElement, firstDs, this.listViewInstance.listBaseOption, null, this.listViewInstance);
|
|
3226
|
+
this.listViewInstance.ulElement = this.listViewInstance.curUL = ListBase.createList(this.listViewInstance.createElement, firstDs, this.listViewInstance.listBaseOption, null, this.listViewInstance);
|
|
3188
3227
|
this.listViewInstance.contentContainer = this.listViewInstance.createElement('div', { className: classNames.container });
|
|
3189
3228
|
this.listViewInstance.element.appendChild(this.listViewInstance.contentContainer);
|
|
3190
3229
|
this.listViewInstance.contentContainer.appendChild(this.listViewInstance.ulElement);
|
|
@@ -3194,9 +3233,7 @@ var Virtualization = /** @__PURE__ @class */ (function () {
|
|
|
3194
3233
|
this.uiFirstIndex = 0;
|
|
3195
3234
|
this.uiLastIndex = this.domItemCount - 1;
|
|
3196
3235
|
var otherDs = curViewDS.slice(1, this.domItemCount);
|
|
3197
|
-
var listItems = ListBase.createListItemFromJson(
|
|
3198
|
-
// eslint-disable-next-line
|
|
3199
|
-
this.listViewInstance.createElement, otherDs, this.listViewInstance.listBaseOption, null, null, this.listViewInstance);
|
|
3236
|
+
var listItems = ListBase.createListItemFromJson(this.listViewInstance.createElement, otherDs, this.listViewInstance.listBaseOption, null, null, this.listViewInstance);
|
|
3200
3237
|
append(listItems, this.listViewInstance.ulElement);
|
|
3201
3238
|
this.listViewInstance.liCollection = this.listViewInstance.curUL.querySelectorAll('li');
|
|
3202
3239
|
this.topElement = this.listViewInstance.createElement('div');
|
|
@@ -3228,31 +3265,9 @@ var Virtualization = /** @__PURE__ @class */ (function () {
|
|
|
3228
3265
|
}
|
|
3229
3266
|
else {
|
|
3230
3267
|
EventHandler.remove(this.listViewInstance.element, 'scroll', this.onVirtualUiScroll);
|
|
3231
|
-
EventHandler.remove(this.listViewInstance.element, 'scroll', this.updateUlContainer);
|
|
3232
3268
|
}
|
|
3233
3269
|
}
|
|
3234
3270
|
};
|
|
3235
|
-
Virtualization.prototype.updateUlContainer = function (e) {
|
|
3236
|
-
var listDiff;
|
|
3237
|
-
var virtualElementContainer = this.listViewInstance.ulElement.querySelector('.' + classNames.virtualElementContainer);
|
|
3238
|
-
if (isNullOrUndefined(this.listViewInstance.liElementHeight)) {
|
|
3239
|
-
this.listViewInstance.updateLiElementHeight();
|
|
3240
|
-
}
|
|
3241
|
-
if (this.listViewInstance.isWindow) {
|
|
3242
|
-
// eslint-disable-next-line
|
|
3243
|
-
listDiff = Math.round(e.target.documentElement.scrollTop / this.listViewInstance.liElementHeight) - 2;
|
|
3244
|
-
}
|
|
3245
|
-
else {
|
|
3246
|
-
// eslint-disable-next-line
|
|
3247
|
-
listDiff = Math.round(e.target.scrollTop / this.listViewInstance.liElementHeight) - 2;
|
|
3248
|
-
}
|
|
3249
|
-
if (((listDiff - 1) * this.listViewInstance.liElementHeight) < 0) {
|
|
3250
|
-
virtualElementContainer.style.top = '0px';
|
|
3251
|
-
}
|
|
3252
|
-
else {
|
|
3253
|
-
virtualElementContainer.style.top = (listDiff) * this.listViewInstance.liElementHeight + 'px';
|
|
3254
|
-
}
|
|
3255
|
-
};
|
|
3256
3271
|
Virtualization.prototype.ValidateItemCount = function (dataSourceLength) {
|
|
3257
3272
|
var height = parseFloat(formatUnit(this.listViewInstance.height));
|
|
3258
3273
|
var itemCount;
|
|
@@ -3261,7 +3276,6 @@ var Virtualization = /** @__PURE__ @class */ (function () {
|
|
|
3261
3276
|
}
|
|
3262
3277
|
else {
|
|
3263
3278
|
if (typeof this.listViewInstance.height === 'string' && this.listViewInstance.height.indexOf('%') !== -1) {
|
|
3264
|
-
// eslint-disable-next-line max-len
|
|
3265
3279
|
itemCount = Math.round((this.listViewInstance.element.getBoundingClientRect().height / this.listItemHeight) * listElementCount);
|
|
3266
3280
|
}
|
|
3267
3281
|
else {
|
|
@@ -3280,10 +3294,8 @@ var Virtualization = /** @__PURE__ @class */ (function () {
|
|
|
3280
3294
|
if (this.listViewInstance.showCheckBox && data[i][this.listViewInstance.fields.isChecked]) {
|
|
3281
3295
|
this.uiIndices.activeIndices.push(i);
|
|
3282
3296
|
}
|
|
3283
|
-
|
|
3284
|
-
if (!isNullOrUndefined(data[i][this.listViewInstance.fields.enabled]) &&
|
|
3297
|
+
if (!isNullOrUndefined(data[parseInt(i.toString(), 10)][this.listViewInstance.fields.enabled]) &&
|
|
3285
3298
|
!data[i][this.listViewInstance.fields.enabled]) {
|
|
3286
|
-
// eslint-disable-next-line
|
|
3287
3299
|
(this.uiIndices.disabledItemIndices.push(i));
|
|
3288
3300
|
}
|
|
3289
3301
|
}
|
|
@@ -3308,7 +3320,7 @@ var Virtualization = /** @__PURE__ @class */ (function () {
|
|
|
3308
3320
|
(pageYOffset - startingHeight)) : ((this.listViewInstance.element.scrollTop - startingHeight) <= 0) ? 0 :
|
|
3309
3321
|
(this.listViewInstance.element.scrollTop - startingHeight);
|
|
3310
3322
|
};
|
|
3311
|
-
Virtualization.prototype.onVirtualUiScroll = function (
|
|
3323
|
+
Virtualization.prototype.onVirtualUiScroll = function () {
|
|
3312
3324
|
var _a;
|
|
3313
3325
|
var startingHeight;
|
|
3314
3326
|
var curViewDS = this.listViewInstance.curViewDS;
|
|
@@ -3383,7 +3395,6 @@ var Virtualization = /** @__PURE__ @class */ (function () {
|
|
|
3383
3395
|
}
|
|
3384
3396
|
};
|
|
3385
3397
|
Virtualization.prototype.updateUiContent = function (element, index) {
|
|
3386
|
-
// eslint-disable-next-line
|
|
3387
3398
|
var curViewDs = this.listViewInstance.curViewDS;
|
|
3388
3399
|
if (typeof this.listViewInstance.dataSource[0] === 'string' ||
|
|
3389
3400
|
typeof this.listViewInstance.dataSource[0] === 'number') {
|
|
@@ -3392,13 +3403,10 @@ var Virtualization = /** @__PURE__ @class */ (function () {
|
|
|
3392
3403
|
this.listViewInstance.curViewDS[index].toString();
|
|
3393
3404
|
}
|
|
3394
3405
|
else {
|
|
3395
|
-
|
|
3396
|
-
|
|
3397
|
-
// eslint-disable-next-line
|
|
3398
|
-
(curViewDs[index][this.listViewInstance.fields.id]) : ListBase.generateId();
|
|
3406
|
+
element.dataset.uid = (curViewDs[parseInt(index.toString(), 10)][this.listViewInstance.fields.id]) ?
|
|
3407
|
+
(curViewDs[parseInt(index.toString(), 10)][this.listViewInstance.fields.id]) : ListBase.generateId();
|
|
3399
3408
|
element.getElementsByClassName(classNames.listItemText)[0].innerHTML =
|
|
3400
|
-
|
|
3401
|
-
(curViewDs[index][this.listViewInstance.fields.text]);
|
|
3409
|
+
(curViewDs[parseInt(index.toString(), 10)][this.listViewInstance.fields.text]);
|
|
3402
3410
|
}
|
|
3403
3411
|
if (this.listViewInstance.showIcon) {
|
|
3404
3412
|
if (element.querySelector('.' + classNames.listIcon)) {
|
|
@@ -3501,9 +3509,7 @@ var Virtualization = /** @__PURE__ @class */ (function () {
|
|
|
3501
3509
|
if (!isNullOrUndefined(fields)) {
|
|
3502
3510
|
ds.some(function (data, index) {
|
|
3503
3511
|
if ((fields[_this.listViewInstance.fields.id] &&
|
|
3504
|
-
// eslint-disable-next-line
|
|
3505
3512
|
fields[_this.listViewInstance.fields.id]
|
|
3506
|
-
// eslint-disable-next-line
|
|
3507
3513
|
=== (data[_this.listViewInstance.fields.id] && data[_this.listViewInstance.fields.id]) || fields === data)) {
|
|
3508
3514
|
resultJSON.index = index;
|
|
3509
3515
|
resultJSON.data = data;
|
|
@@ -3531,7 +3537,6 @@ var Virtualization = /** @__PURE__ @class */ (function () {
|
|
|
3531
3537
|
}
|
|
3532
3538
|
return {
|
|
3533
3539
|
text: dataCollection,
|
|
3534
|
-
// eslint-disable-next-line
|
|
3535
3540
|
data: dataCollection,
|
|
3536
3541
|
index: this.uiIndices.activeIndices.map(function (index) {
|
|
3537
3542
|
return _this.listViewInstance.dataSource.indexOf(curViewDS_1[index]);
|
|
@@ -3553,15 +3558,12 @@ var Virtualization = /** @__PURE__ @class */ (function () {
|
|
|
3553
3558
|
var indexArray = this.uiIndices.activeIndices;
|
|
3554
3559
|
for (var i = 0; i < indexArray.length; i++) {
|
|
3555
3560
|
textCollection.push(curViewDS_2[indexArray[i]]["" + text]);
|
|
3556
|
-
|
|
3557
|
-
dataCollection.push(curViewDS_2[indexArray[i]]);
|
|
3561
|
+
dataCollection.push(curViewDS_2[indexArray[parseInt(i.toString(), 10)]]);
|
|
3558
3562
|
}
|
|
3559
|
-
// eslint-disable-next-line
|
|
3560
3563
|
var dataSource_1 = this.listViewInstance.dataSource instanceof DataManager
|
|
3561
3564
|
? curViewDS_2 : this.listViewInstance.dataSource;
|
|
3562
3565
|
return {
|
|
3563
3566
|
text: textCollection,
|
|
3564
|
-
// eslint-disable-next-line
|
|
3565
3567
|
data: dataCollection,
|
|
3566
3568
|
index: this.uiIndices.activeIndices.map(function (index) {
|
|
3567
3569
|
return dataSource_1.indexOf(curViewDS_2[index]);
|
|
@@ -3569,12 +3571,10 @@ var Virtualization = /** @__PURE__ @class */ (function () {
|
|
|
3569
3571
|
};
|
|
3570
3572
|
}
|
|
3571
3573
|
else {
|
|
3572
|
-
// eslint-disable-next-line
|
|
3573
3574
|
var dataSource = this.listViewInstance.dataSource instanceof DataManager
|
|
3574
3575
|
? curViewDS_2 : this.listViewInstance.dataSource;
|
|
3575
3576
|
return {
|
|
3576
3577
|
text: curViewDS_2[this.activeIndex][this.listViewInstance.fields.text],
|
|
3577
|
-
// eslint-disable-next-line
|
|
3578
3578
|
data: curViewDS_2[this.activeIndex],
|
|
3579
3579
|
index: dataSource.indexOf(curViewDS_2[this.activeIndex])
|
|
3580
3580
|
};
|
|
@@ -3586,7 +3586,6 @@ var Virtualization = /** @__PURE__ @class */ (function () {
|
|
|
3586
3586
|
}
|
|
3587
3587
|
};
|
|
3588
3588
|
Virtualization.prototype.selectItem = function (obj) {
|
|
3589
|
-
// eslint-disable-next-line
|
|
3590
3589
|
var resutJSON = this.findDSAndIndexFromId(this.listViewInstance.curViewDS, obj);
|
|
3591
3590
|
if (Object.keys(resutJSON).length) {
|
|
3592
3591
|
var isSelected = this.activeIndex === resutJSON.index;
|
|
@@ -3614,7 +3613,6 @@ var Virtualization = /** @__PURE__ @class */ (function () {
|
|
|
3614
3613
|
}
|
|
3615
3614
|
}
|
|
3616
3615
|
else {
|
|
3617
|
-
// eslint-disable-next-line
|
|
3618
3616
|
var eventArgs = void 0;
|
|
3619
3617
|
if (typeof this.listViewInstance.dataSource[0] === 'string' ||
|
|
3620
3618
|
typeof this.listViewInstance.dataSource[0] === 'number') {
|
|
@@ -3648,28 +3646,24 @@ var Virtualization = /** @__PURE__ @class */ (function () {
|
|
|
3648
3646
|
}
|
|
3649
3647
|
};
|
|
3650
3648
|
Virtualization.prototype.enableItem = function (obj) {
|
|
3651
|
-
// eslint-disable-next-line
|
|
3652
3649
|
var resutJSON = this.findDSAndIndexFromId(this.listViewInstance.curViewDS, obj);
|
|
3653
3650
|
if (Object.keys(resutJSON).length) {
|
|
3654
3651
|
this.uiIndices.disabledItemIndices.splice(this.uiIndices.disabledItemIndices.indexOf(resutJSON.index), 1);
|
|
3655
3652
|
}
|
|
3656
3653
|
};
|
|
3657
3654
|
Virtualization.prototype.disableItem = function (obj) {
|
|
3658
|
-
// eslint-disable-next-line
|
|
3659
3655
|
var resutJSON = this.findDSAndIndexFromId(this.listViewInstance.curViewDS, obj);
|
|
3660
3656
|
if (Object.keys(resutJSON).length && this.uiIndices.disabledItemIndices.indexOf(resutJSON.index) === -1) {
|
|
3661
3657
|
this.uiIndices.disabledItemIndices.push(resutJSON.index);
|
|
3662
3658
|
}
|
|
3663
3659
|
};
|
|
3664
3660
|
Virtualization.prototype.showItem = function (obj) {
|
|
3665
|
-
// eslint-disable-next-line
|
|
3666
3661
|
var resutJSON = this.findDSAndIndexFromId(this.listViewInstance.curViewDS, obj);
|
|
3667
3662
|
if (Object.keys(resutJSON).length) {
|
|
3668
3663
|
this.uiIndices.hiddenItemIndices.splice(this.uiIndices.hiddenItemIndices.indexOf(resutJSON.index), 1);
|
|
3669
3664
|
}
|
|
3670
3665
|
};
|
|
3671
3666
|
Virtualization.prototype.hideItem = function (obj) {
|
|
3672
|
-
// eslint-disable-next-line
|
|
3673
3667
|
var resutJSON = this.findDSAndIndexFromId(this.listViewInstance.curViewDS, obj);
|
|
3674
3668
|
if (Object.keys(resutJSON).length && this.uiIndices.hiddenItemIndices.indexOf(resutJSON.index) === -1) {
|
|
3675
3669
|
this.uiIndices.hiddenItemIndices.push(resutJSON.index);
|
|
@@ -3678,7 +3672,6 @@ var Virtualization = /** @__PURE__ @class */ (function () {
|
|
|
3678
3672
|
Virtualization.prototype.removeItem = function (obj) {
|
|
3679
3673
|
var dataSource;
|
|
3680
3674
|
var curViewDS = this.listViewInstance.curViewDS;
|
|
3681
|
-
// eslint-disable-next-line
|
|
3682
3675
|
var resutJSON = this.findDSAndIndexFromId(curViewDS, obj);
|
|
3683
3676
|
if (Object.keys(resutJSON).length) {
|
|
3684
3677
|
dataSource = resutJSON.data;
|
|
@@ -3899,7 +3892,6 @@ var Virtualization = /** @__PURE__ @class */ (function () {
|
|
|
3899
3892
|
}
|
|
3900
3893
|
}
|
|
3901
3894
|
else {
|
|
3902
|
-
// eslint-disable-next-line
|
|
3903
3895
|
var index_2 = this.listViewInstance.curViewDS.indexOf(currentItem);
|
|
3904
3896
|
// virtually new add list item based on the scollbar position
|
|
3905
3897
|
this.addUiItem(index_2);
|
|
@@ -3914,9 +3906,7 @@ var Virtualization = /** @__PURE__ @class */ (function () {
|
|
|
3914
3906
|
Virtualization.prototype.createAndInjectNewItem = function (itemData, index) {
|
|
3915
3907
|
// generate li item for given datasource
|
|
3916
3908
|
var target;
|
|
3917
|
-
var li = ListBase.createListItemFromJson(this.listViewInstance.createElement,
|
|
3918
|
-
// eslint-disable-next-line
|
|
3919
|
-
[itemData], this.listViewInstance.listBaseOption, null, null, this.listViewInstance);
|
|
3909
|
+
var li = ListBase.createListItemFromJson(this.listViewInstance.createElement, [itemData], this.listViewInstance.listBaseOption, null, null, this.listViewInstance);
|
|
3920
3910
|
// check for target element whether to insert before last item or group item
|
|
3921
3911
|
if ((Object.keys(this.listViewInstance.curViewDS).length - 1) === index) {
|
|
3922
3912
|
target = this.listViewInstance.curUL.lastElementChild;
|
|
@@ -3949,7 +3939,6 @@ var Virtualization = /** @__PURE__ @class */ (function () {
|
|
|
3949
3939
|
this.templateData = args.curData.isHeader ? args.curData.items[0] :
|
|
3950
3940
|
args.curData;
|
|
3951
3941
|
if (this.listViewInstance.showCheckBox) {
|
|
3952
|
-
// eslint-disable-next-line
|
|
3953
3942
|
this.listViewInstance.renderCheckbox(args);
|
|
3954
3943
|
if ((!isNullOrUndefined(this.listViewInstance.virtualCheckBox)) &&
|
|
3955
3944
|
(!isNullOrUndefined(this.listViewInstance.virtualCheckBox.outerHTML))) {
|
|
@@ -4005,9 +3994,7 @@ var Virtualization = /** @__PURE__ @class */ (function () {
|
|
|
4005
3994
|
var onChange = this.isNgTemplate() ? this.onNgChange : this.onChange;
|
|
4006
3995
|
if (this.listViewInstance.template || this.listViewInstance.groupTemplate) {
|
|
4007
3996
|
var curViewDS = this.listViewInstance.curViewDS[index];
|
|
4008
|
-
// eslint-disable-next-line
|
|
4009
3997
|
element.dataset.uid = (curViewDS[this.listViewInstance.fields.id]) ?
|
|
4010
|
-
// eslint-disable-next-line
|
|
4011
3998
|
(curViewDS[this.listViewInstance.fields.id]) : ListBase.generateId();
|
|
4012
3999
|
onChange(curViewDS, element, this);
|
|
4013
4000
|
}
|
|
@@ -4028,9 +4015,7 @@ var Virtualization = /** @__PURE__ @class */ (function () {
|
|
|
4028
4015
|
* @returns {void}
|
|
4029
4016
|
*/
|
|
4030
4017
|
Virtualization.prototype.onChange = function (newData, listElement, virtualThis) {
|
|
4031
|
-
var liItem = ListBase.createListItemFromJson(virtualThis.listViewInstance.createElement,
|
|
4032
|
-
// eslint-disable-next-line
|
|
4033
|
-
[newData], virtualThis.listViewInstance.listBaseOption, null, null, virtualThis.listViewInstance);
|
|
4018
|
+
var liItem = ListBase.createListItemFromJson(virtualThis.listViewInstance.createElement, [newData], virtualThis.listViewInstance.listBaseOption, null, null, virtualThis.listViewInstance);
|
|
4034
4019
|
if (virtualThis.listViewInstance.isReact) {
|
|
4035
4020
|
virtualThis.listViewInstance.renderReactTemplates();
|
|
4036
4021
|
}
|
|
@@ -4061,14 +4046,6 @@ var Virtualization = /** @__PURE__ @class */ (function () {
|
|
|
4061
4046
|
return Virtualization;
|
|
4062
4047
|
}());
|
|
4063
4048
|
|
|
4064
|
-
/**
|
|
4065
|
-
* Listview Component
|
|
4066
|
-
*/
|
|
4067
|
-
|
|
4068
|
-
/**
|
|
4069
|
-
* Listview Component
|
|
4070
|
-
*/
|
|
4071
|
-
|
|
4072
4049
|
var __extends$1 = (undefined && undefined.__extends) || (function () {
|
|
4073
4050
|
var extendStatics = function (d, b) {
|
|
4074
4051
|
extendStatics = Object.setPrototypeOf ||
|
|
@@ -4088,6 +4065,7 @@ var __decorate$1 = (undefined && undefined.__decorate) || function (decorators,
|
|
|
4088
4065
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
4089
4066
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4090
4067
|
};
|
|
4068
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
4091
4069
|
/**
|
|
4092
4070
|
* Sortable Module provides support to enable sortable functionality in Dom Elements.
|
|
4093
4071
|
* ```html
|
|
@@ -4109,7 +4087,6 @@ var Sortable = /** @__PURE__ @class */ (function (_super) {
|
|
|
4109
4087
|
function Sortable(element, options) {
|
|
4110
4088
|
var _this = _super.call(this, options, element) || this;
|
|
4111
4089
|
_this.getHelper = function (e) {
|
|
4112
|
-
// eslint-disable-next-line prefer-const
|
|
4113
4090
|
var target = _this.getSortableElement(e.sender.target);
|
|
4114
4091
|
if (!_this.isValidTarget(target, _this)) {
|
|
4115
4092
|
return false;
|
|
@@ -4127,7 +4104,6 @@ var Sortable = /** @__PURE__ @class */ (function (_super) {
|
|
|
4127
4104
|
document.body.appendChild(element);
|
|
4128
4105
|
return element;
|
|
4129
4106
|
};
|
|
4130
|
-
// eslint-disable-next-line
|
|
4131
4107
|
_this.onDrag = function (e) {
|
|
4132
4108
|
if (!e.target) {
|
|
4133
4109
|
return;
|
|
@@ -4205,7 +4181,6 @@ var Sortable = /** @__PURE__ @class */ (function (_super) {
|
|
|
4205
4181
|
});
|
|
4206
4182
|
}
|
|
4207
4183
|
};
|
|
4208
|
-
// eslint-disable-next-line
|
|
4209
4184
|
_this.onDragStart = function (e) {
|
|
4210
4185
|
_this.target = _this.getSortableElement(e.target);
|
|
4211
4186
|
var cancelDrag = false;
|
|
@@ -4232,11 +4207,10 @@ var Sortable = /** @__PURE__ @class */ (function (_super) {
|
|
|
4232
4207
|
_this.trigger('dragStart', { event: e.event, element: _this.element, target: _this.target });
|
|
4233
4208
|
}
|
|
4234
4209
|
};
|
|
4235
|
-
// eslint-disable-next-line
|
|
4236
4210
|
_this.onDragStop = function (e) {
|
|
4237
4211
|
var dropInst = _this.getSortableInstance(_this.curTarget);
|
|
4238
|
-
var prevIdx;
|
|
4239
4212
|
var curIdx;
|
|
4213
|
+
var prevIdx;
|
|
4240
4214
|
var handled;
|
|
4241
4215
|
prevIdx = _this.getIndex(_this.target);
|
|
4242
4216
|
var isPlaceHolderPresent = _this.isPlaceHolderPresent(dropInst);
|
|
@@ -4267,12 +4241,17 @@ var Sortable = /** @__PURE__ @class */ (function (_super) {
|
|
|
4267
4241
|
});
|
|
4268
4242
|
}
|
|
4269
4243
|
dropInst = _this.getSortableInstance(e.target);
|
|
4270
|
-
// eslint-disable-next-line prefer-const
|
|
4271
4244
|
curIdx = dropInst.element.childElementCount;
|
|
4272
4245
|
prevIdx = _this.getIndex(_this.target);
|
|
4246
|
+
if (dropInst.element.querySelector('.e-list-nrt')) {
|
|
4247
|
+
curIdx = curIdx - 1;
|
|
4248
|
+
}
|
|
4249
|
+
if (_this.curTarget === _this.target && e.target === _this.curTarget) {
|
|
4250
|
+
curIdx = prevIdx;
|
|
4251
|
+
}
|
|
4273
4252
|
if (dropInst.element === e.target || (!isPlaceHolderPresent && _this.curTarget === _this.target)) {
|
|
4274
4253
|
var beforeDropArgs = {
|
|
4275
|
-
previousIndex: prevIdx, currentIndex:
|
|
4254
|
+
previousIndex: prevIdx, currentIndex: curIdx,
|
|
4276
4255
|
target: e.target, droppedElement: _this.target, helper: e.helper, cancel: false
|
|
4277
4256
|
};
|
|
4278
4257
|
_this.trigger('beforeDrop', beforeDropArgs, function (observedArgs) {
|
|
@@ -4519,6 +4498,11 @@ var Sortable = /** @__PURE__ @class */ (function (_super) {
|
|
|
4519
4498
|
/**
|
|
4520
4499
|
* It is used to sort array of elements from source element to destination element.
|
|
4521
4500
|
*
|
|
4501
|
+
* @param {HTMLElement} from - The source element from which to move elements.
|
|
4502
|
+
* @param {HTMLElement} [to=from] - The destination element to which to move elements. Defaults to the source element.
|
|
4503
|
+
* @param {number[]} [targetIndexes] - The indexes of elements to move. If not provided, all children of the source element will be moved.
|
|
4504
|
+
* @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.
|
|
4505
|
+
* @returns {void}
|
|
4522
4506
|
* @private
|
|
4523
4507
|
*/
|
|
4524
4508
|
function moveTo(from, to, targetIndexes, insertBefore) {
|
|
@@ -4547,13 +4531,5 @@ function moveTo(from, to, targetIndexes, insertBefore) {
|
|
|
4547
4531
|
}
|
|
4548
4532
|
}
|
|
4549
4533
|
|
|
4550
|
-
|
|
4551
|
-
* Sortable Module
|
|
4552
|
-
*/
|
|
4553
|
-
|
|
4554
|
-
/**
|
|
4555
|
-
* List Components
|
|
4556
|
-
*/
|
|
4557
|
-
|
|
4558
|
-
export { classNames, FieldSettings, ListView, Virtualization, cssClass, ListBase, getFieldValues, Sortable, moveTo };
|
|
4534
|
+
export { FieldSettings, ListBase, ListView, Sortable, Virtualization, classNames, cssClass, getFieldValues, moveTo };
|
|
4559
4535
|
//# sourceMappingURL=ej2-lists.es5.js.map
|