@syncfusion/ej2-lists 25.2.3 → 26.1.35-750253
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
|
@@ -26,6 +26,7 @@ import { Animation, rippleEffect, Touch, animationMode } from '@syncfusion/ej2-b
|
|
|
26
26
|
import { DataManager, Query } from '@syncfusion/ej2-data';
|
|
27
27
|
import { createCheckBox } from '@syncfusion/ej2-buttons';
|
|
28
28
|
import { ListBase, getFieldValues } from '../common/list-base';
|
|
29
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
29
30
|
// Effect Configuration Effect[] = [fromViewBackward,fromViewForward,toViewBackward,toviewForward];
|
|
30
31
|
var effectsConfig = {
|
|
31
32
|
'None': [],
|
|
@@ -187,7 +188,6 @@ var ListView = /** @class */ (function (_super) {
|
|
|
187
188
|
this.setEnableRTL();
|
|
188
189
|
break;
|
|
189
190
|
case 'fields':
|
|
190
|
-
// eslint-disable-next-line
|
|
191
191
|
this.listBaseOption.fields = this.fields.properties;
|
|
192
192
|
if (this.enableVirtualization) {
|
|
193
193
|
this.virtualizationModule.reRenderUiVirtualization();
|
|
@@ -258,7 +258,7 @@ var ListView = /** @class */ (function (_super) {
|
|
|
258
258
|
};
|
|
259
259
|
// Model Changes
|
|
260
260
|
ListView.prototype.setHTMLAttribute = function () {
|
|
261
|
-
if (Object.keys(this.htmlAttributes).length) {
|
|
261
|
+
if (!isNullOrUndefined(this.htmlAttributes) && Object.keys(this.htmlAttributes).length) {
|
|
262
262
|
attributes(this.element, this.htmlAttributes);
|
|
263
263
|
}
|
|
264
264
|
};
|
|
@@ -316,13 +316,11 @@ var ListView = /** @class */ (function (_super) {
|
|
|
316
316
|
if (this.headerTemplate) {
|
|
317
317
|
var compiledString = compile(this.headerTemplate);
|
|
318
318
|
var headerTemplateEle = this.createElement('div', { className: classNames.headerTemplateText });
|
|
319
|
-
// eslint-disable-next-line
|
|
320
319
|
var compiledElement = compiledString({}, this, prop, this.LISTVIEW_HEADERTEMPLATE_ID, null, null, this.headerEle);
|
|
321
320
|
if (compiledElement) {
|
|
322
321
|
append(compiledElement, headerTemplateEle);
|
|
323
322
|
}
|
|
324
323
|
append([headerTemplateEle], this.headerEle);
|
|
325
|
-
// eslint-disable-next-line
|
|
326
324
|
if (this.isReact) {
|
|
327
325
|
this.renderReactTemplates();
|
|
328
326
|
}
|
|
@@ -387,8 +385,7 @@ var ListView = /** @class */ (function (_super) {
|
|
|
387
385
|
name: (reverse === true ? anim[0] : anim[1]),
|
|
388
386
|
duration: (duration === 0 && animationMode === 'Enable') ? 400 : duration,
|
|
389
387
|
timingFunction: this.animation.easing,
|
|
390
|
-
|
|
391
|
-
end: function (model) {
|
|
388
|
+
end: function () {
|
|
392
389
|
fromView.style.display = 'none';
|
|
393
390
|
_this.element.style.overflow = overflow_1;
|
|
394
391
|
fromView.style.position = fPos_1;
|
|
@@ -426,7 +423,6 @@ var ListView = /** @class */ (function (_super) {
|
|
|
426
423
|
itemRole: 'listitem', listRole: 'list', itemText: '',
|
|
427
424
|
groupItemRole: 'presentation', wrapperRole: 'presentation'
|
|
428
425
|
},
|
|
429
|
-
// eslint-disable-next-line
|
|
430
426
|
fields: (this.fields.properties),
|
|
431
427
|
sortOrder: this.sortOrder,
|
|
432
428
|
showIcon: this.showIcon,
|
|
@@ -461,10 +457,8 @@ var ListView = /** @class */ (function (_super) {
|
|
|
461
457
|
this.isNestedList = true;
|
|
462
458
|
}
|
|
463
459
|
if (this.showCheckBox && args.item.classList.contains(classNames.listItem)) {
|
|
464
|
-
var checkboxElement = void 0;
|
|
465
460
|
var fieldData_1;
|
|
466
|
-
|
|
467
|
-
checkboxElement = createCheckBox(this.createElement, false, {
|
|
461
|
+
var checkboxElement = createCheckBox(this.createElement, false, {
|
|
468
462
|
checked: false, enableRtl: this.enableRtl,
|
|
469
463
|
cssClass: classNames.listviewCheckbox
|
|
470
464
|
});
|
|
@@ -601,7 +595,6 @@ var ListView = /** @class */ (function (_super) {
|
|
|
601
595
|
for (var i = 0; i < liCollection.length; i++) {
|
|
602
596
|
var element = liCollection[i];
|
|
603
597
|
args.item = element;
|
|
604
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
605
598
|
args.curData = this.getItemData(element);
|
|
606
599
|
if (element.querySelector('.' + classNames.checkboxWrapper)) {
|
|
607
600
|
this.removeElement(element.querySelector('.' + classNames.checkboxWrapper));
|
|
@@ -716,8 +709,7 @@ var ListView = /** @class */ (function (_super) {
|
|
|
716
709
|
var curLi = closest(e.target.parentNode, '.' + classNames.listItem);
|
|
717
710
|
this.setHoverLI(curLi);
|
|
718
711
|
};
|
|
719
|
-
|
|
720
|
-
ListView.prototype.leaveHandler = function (e) {
|
|
712
|
+
ListView.prototype.leaveHandler = function () {
|
|
721
713
|
this.removeHover();
|
|
722
714
|
};
|
|
723
715
|
ListView.prototype.homeKeyHandler = function (e, end) {
|
|
@@ -971,7 +963,8 @@ var ListView = /** @class */ (function (_super) {
|
|
|
971
963
|
if (!isNullOrUndefined(this.scroll)) {
|
|
972
964
|
EventHandler.remove(this.element, 'scroll', this.onListScroll);
|
|
973
965
|
}
|
|
974
|
-
this.touchModule
|
|
966
|
+
if (this.touchModule)
|
|
967
|
+
this.touchModule.destroy();
|
|
975
968
|
this.touchModule = null;
|
|
976
969
|
};
|
|
977
970
|
ListView.prototype.removeFocus = function () {
|
|
@@ -1056,7 +1049,6 @@ var ListView = /** @class */ (function (_super) {
|
|
|
1056
1049
|
selectedItem =
|
|
1057
1050
|
{
|
|
1058
1051
|
item: li, text: fieldData && fieldData[this.listBaseOption.fields.text],
|
|
1059
|
-
// eslint-disable-next-line
|
|
1060
1052
|
data: data
|
|
1061
1053
|
};
|
|
1062
1054
|
}
|
|
@@ -1074,7 +1066,6 @@ var ListView = /** @class */ (function (_super) {
|
|
|
1074
1066
|
};
|
|
1075
1067
|
ListView.prototype.setSelectedItemData = function (li) {
|
|
1076
1068
|
var data = this.getItemData(li);
|
|
1077
|
-
// eslint-disable-next-line
|
|
1078
1069
|
var fieldData = getFieldValues(data, this.listBaseOption.fields);
|
|
1079
1070
|
if (!isNullOrUndefined(data) && ((typeof this.dataSource[0] === 'string') ||
|
|
1080
1071
|
(typeof this.dataSource[0] === 'number'))) {
|
|
@@ -1087,9 +1078,7 @@ var ListView = /** @class */ (function (_super) {
|
|
|
1087
1078
|
else {
|
|
1088
1079
|
this.selectedItems = {
|
|
1089
1080
|
item: li,
|
|
1090
|
-
// eslint-disable-next-line
|
|
1091
1081
|
text: fieldData && fieldData[this.listBaseOption.fields.text],
|
|
1092
|
-
// eslint-disable-next-line
|
|
1093
1082
|
data: data
|
|
1094
1083
|
};
|
|
1095
1084
|
}
|
|
@@ -1134,7 +1123,6 @@ var ListView = /** @class */ (function (_super) {
|
|
|
1134
1123
|
for (var _i = 0, levelKeys_1 = levelKeys; _i < levelKeys_1.length; _i++) {
|
|
1135
1124
|
var key = levelKeys_1[_i];
|
|
1136
1125
|
var field = {};
|
|
1137
|
-
// eslint-disable-next-line
|
|
1138
1126
|
field[this.fields.id] = key;
|
|
1139
1127
|
this.curDSJSON = this.findItemFromDS(ds, field);
|
|
1140
1128
|
var fieldData = getFieldValues(this.curDSJSON, this.listBaseOption.fields);
|
|
@@ -1162,9 +1150,7 @@ var ListView = /** @class */ (function (_super) {
|
|
|
1162
1150
|
var resultJSON;
|
|
1163
1151
|
if (dataSource && dataSource.length && fields) {
|
|
1164
1152
|
dataSource.some(function (data) {
|
|
1165
|
-
var fieldData =
|
|
1166
|
-
// eslint-disable-next-line
|
|
1167
|
-
getFieldValues(data, _this.listBaseOption.fields);
|
|
1153
|
+
var fieldData = getFieldValues(data, _this.listBaseOption.fields);
|
|
1168
1154
|
//(!(fid) || id === fid) && (!(ftext) || text === ftext) && (!!fid || !!ftext)
|
|
1169
1155
|
if ((fields[_this.fields.id] || fields[_this.fields.text]) &&
|
|
1170
1156
|
(!fields[_this.fields.id] || (!isNullOrUndefined(fieldData[_this.fields.id]) &&
|
|
@@ -1178,13 +1164,12 @@ var ListView = /** @class */ (function (_super) {
|
|
|
1178
1164
|
else if (!isNullOrUndefined(fields[_this.fields.id]) && isNullOrUndefined(fieldData[_this.fields.id])) {
|
|
1179
1165
|
var li = _this.element.querySelector('[data-uid="'
|
|
1180
1166
|
+ fields[_this.fields.id] + '"]');
|
|
1181
|
-
// eslint-disable-next-line
|
|
1182
1167
|
if (li && li.innerText.trim() === fieldData[_this.fields.text]) {
|
|
1183
1168
|
resultJSON = data;
|
|
1184
1169
|
}
|
|
1185
|
-
// eslint-disable-next-line
|
|
1186
1170
|
}
|
|
1187
|
-
else if (
|
|
1171
|
+
else if (Object.prototype.hasOwnProperty.call(fieldData, _this.fields.child) &&
|
|
1172
|
+
fieldData[_this.fields.child].length) {
|
|
1188
1173
|
resultJSON = _this.findItemFromDS(fieldData[_this.fields.child], fields, parent);
|
|
1189
1174
|
}
|
|
1190
1175
|
return !!resultJSON;
|
|
@@ -1199,7 +1184,6 @@ var ListView = /** @class */ (function (_super) {
|
|
|
1199
1184
|
var columns = [];
|
|
1200
1185
|
var query = (this.query ? this.query : new Query());
|
|
1201
1186
|
if (!this.query) {
|
|
1202
|
-
// eslint-disable-next-line
|
|
1203
1187
|
for (var _i = 0, _a = Object.keys(this.fields.properties); _i < _a.length; _i++) {
|
|
1204
1188
|
var column = _a[_i];
|
|
1205
1189
|
if (column !== 'tableName' && !!(this.fields["" + column]) &&
|
|
@@ -1210,8 +1194,7 @@ var ListView = /** @class */ (function (_super) {
|
|
|
1210
1194
|
}
|
|
1211
1195
|
}
|
|
1212
1196
|
query.select(columns);
|
|
1213
|
-
|
|
1214
|
-
if (this.fields.properties.hasOwnProperty('tableName')) {
|
|
1197
|
+
if (Object.prototype.hasOwnProperty.call(this.fields.properties, 'tableName')) {
|
|
1215
1198
|
query.from(this.fields.tableName);
|
|
1216
1199
|
}
|
|
1217
1200
|
}
|
|
@@ -1219,7 +1202,6 @@ var ListView = /** @class */ (function (_super) {
|
|
|
1219
1202
|
};
|
|
1220
1203
|
ListView.prototype.setViewDataSource = function (dataSource) {
|
|
1221
1204
|
if (dataSource === void 0) { dataSource = this.localData; }
|
|
1222
|
-
// eslint-disable-next-line
|
|
1223
1205
|
var fieldValue = (isNullOrUndefined(this.fields.sortBy)) ? this.fields.text : this.fields.sortBy;
|
|
1224
1206
|
var query = ListBase.addSorting(this.sortOrder, fieldValue);
|
|
1225
1207
|
if (dataSource && this.fields.groupBy) {
|
|
@@ -1258,15 +1240,12 @@ var ListView = /** @class */ (function (_super) {
|
|
|
1258
1240
|
ListView.prototype.setLocalData = function () {
|
|
1259
1241
|
var _this = this;
|
|
1260
1242
|
this.trigger('actionBegin');
|
|
1261
|
-
// eslint-disable-next-line
|
|
1262
|
-
var listViewComponent = this;
|
|
1263
1243
|
if (this.dataSource instanceof DataManager) {
|
|
1264
1244
|
if (this.dataSource.ready) {
|
|
1265
1245
|
this.dataSource.ready.then(function (e) {
|
|
1266
|
-
/* eslint-disable */
|
|
1267
1246
|
_this.isOffline = _this.dataSource.dataSource.offline;
|
|
1268
1247
|
if (_this.dataSource instanceof DataManager && _this.isOffline) {
|
|
1269
|
-
_this.renderRemoteLists(e,
|
|
1248
|
+
_this.renderRemoteLists(e, _this);
|
|
1270
1249
|
}
|
|
1271
1250
|
}).catch(function (e) {
|
|
1272
1251
|
_this.triggerActionFailure(e);
|
|
@@ -1274,7 +1253,7 @@ var ListView = /** @class */ (function (_super) {
|
|
|
1274
1253
|
}
|
|
1275
1254
|
else {
|
|
1276
1255
|
this.dataSource.executeQuery(this.getQuery()).then(function (e) {
|
|
1277
|
-
_this.renderRemoteLists(e,
|
|
1256
|
+
_this.renderRemoteLists(e, _this);
|
|
1278
1257
|
}).catch(function (e) {
|
|
1279
1258
|
_this.triggerActionFailure(e);
|
|
1280
1259
|
});
|
|
@@ -1318,7 +1297,7 @@ var ListView = /** @class */ (function (_super) {
|
|
|
1318
1297
|
};
|
|
1319
1298
|
ListView.prototype.setAttributes = function (liElements) {
|
|
1320
1299
|
for (var i = 0; i < liElements.length; i++) {
|
|
1321
|
-
var element = liElements[i];
|
|
1300
|
+
var element = liElements[parseInt(i.toString(), 10)];
|
|
1322
1301
|
if (element.classList.contains('e-list-item')) {
|
|
1323
1302
|
element.setAttribute('id', this.element.id + '_' + element.getAttribute('data-uid'));
|
|
1324
1303
|
element.setAttribute('tabindex', '-1');
|
|
@@ -1332,15 +1311,6 @@ var ListView = /** @class */ (function (_super) {
|
|
|
1332
1311
|
this.liCollection = this.curUL.querySelectorAll('.' + classNames.listItem);
|
|
1333
1312
|
this.setAttributes(this.liCollection);
|
|
1334
1313
|
};
|
|
1335
|
-
ListView.prototype.exceptionEvent = function (e) {
|
|
1336
|
-
this.trigger('actionFailure', e);
|
|
1337
|
-
};
|
|
1338
|
-
ListView.prototype.UpdateCurrentUL = function () {
|
|
1339
|
-
this.ulElement = this.curUL = this.element.querySelector('.' + classNames.parentItem);
|
|
1340
|
-
if (this.curUL) {
|
|
1341
|
-
this.liCollection = this.curUL.querySelectorAll('.' + classNames.listItem);
|
|
1342
|
-
}
|
|
1343
|
-
};
|
|
1344
1314
|
ListView.prototype.renderSubList = function (li) {
|
|
1345
1315
|
this.liElement = li;
|
|
1346
1316
|
var uID = li.getAttribute('data-uid');
|
|
@@ -1432,7 +1402,7 @@ var ListView = /** @class */ (function (_super) {
|
|
|
1432
1402
|
}
|
|
1433
1403
|
this.unWireEvents();
|
|
1434
1404
|
var classAr = [classNames.root, classNames.disable, 'e-rtl',
|
|
1435
|
-
'e-has-header', 'e-lib'].concat(this.cssClass.split(' ').filter(function (css) { return css; }));
|
|
1405
|
+
'e-has-header', 'e-lib'].concat(this.cssClass ? this.cssClass.split(' ').filter(function (css) { return css; }) : []);
|
|
1436
1406
|
removeClass([this.element], classAr);
|
|
1437
1407
|
this.element.removeAttribute('role');
|
|
1438
1408
|
this.element.removeAttribute('tabindex');
|
|
@@ -1529,8 +1499,8 @@ var ListView = /** @class */ (function (_super) {
|
|
|
1529
1499
|
if (obj instanceof Element) {
|
|
1530
1500
|
var uid = obj.getAttribute('data-uid').toString();
|
|
1531
1501
|
for (var i = 0; i < this.liCollection.length; i++) {
|
|
1532
|
-
if (this.liCollection[i].getAttribute('data-uid').toString() === uid) {
|
|
1533
|
-
li = this.liCollection[i];
|
|
1502
|
+
if (this.liCollection[parseInt(i.toString(), 10)].getAttribute('data-uid').toString() === uid) {
|
|
1503
|
+
li = this.liCollection[parseInt(i.toString(), 10)];
|
|
1534
1504
|
break;
|
|
1535
1505
|
}
|
|
1536
1506
|
}
|
|
@@ -1556,8 +1526,9 @@ var ListView = /** @class */ (function (_super) {
|
|
|
1556
1526
|
if (!this.enableVirtualization && isNullOrUndefined(li)) {
|
|
1557
1527
|
var curLi = this.element.querySelectorAll('.' + classNames.listItem);
|
|
1558
1528
|
for (var i = 0; i < curLi.length; i++) {
|
|
1559
|
-
if (curLi[i].innerText.trim() ===
|
|
1560
|
-
|
|
1529
|
+
if (curLi[parseInt(i.toString(), 10)].innerText.trim() ===
|
|
1530
|
+
fieldData[this.fields.text]) {
|
|
1531
|
+
li = curLi[parseInt(i.toString(), 10)];
|
|
1561
1532
|
}
|
|
1562
1533
|
}
|
|
1563
1534
|
}
|
|
@@ -1575,8 +1546,8 @@ var ListView = /** @class */ (function (_super) {
|
|
|
1575
1546
|
ListView.prototype.selectMultipleItems = function (item) {
|
|
1576
1547
|
if (!isNullOrUndefined(item)) {
|
|
1577
1548
|
for (var i = 0; i < item.length; i++) {
|
|
1578
|
-
if (!isNullOrUndefined(item[i])) {
|
|
1579
|
-
this.selectItem(item[i]);
|
|
1549
|
+
if (!isNullOrUndefined(item[parseInt(i.toString(), 10)])) {
|
|
1550
|
+
this.selectItem(item[parseInt(i.toString(), 10)]);
|
|
1580
1551
|
}
|
|
1581
1552
|
}
|
|
1582
1553
|
}
|
|
@@ -1585,7 +1556,7 @@ var ListView = /** @class */ (function (_super) {
|
|
|
1585
1556
|
var parentId = [];
|
|
1586
1557
|
if (this.isNestedList) {
|
|
1587
1558
|
for (var i = this.curDSLevel.length - 1; i >= 0; i--) {
|
|
1588
|
-
parentId.push(this.curDSLevel[i]);
|
|
1559
|
+
parentId.push(this.curDSLevel[parseInt(i.toString(), 10)]);
|
|
1589
1560
|
}
|
|
1590
1561
|
}
|
|
1591
1562
|
return parentId;
|
|
@@ -1594,7 +1565,7 @@ var ListView = /** @class */ (function (_super) {
|
|
|
1594
1565
|
this.selectedId = [];
|
|
1595
1566
|
var liCollection = this.curUL.getElementsByClassName(classNames.selected);
|
|
1596
1567
|
for (var i = 0; i < liCollection.length; i++) {
|
|
1597
|
-
var tempData = this.getItemData(liCollection[i]);
|
|
1568
|
+
var tempData = this.getItemData(liCollection[parseInt(i.toString(), 10)]);
|
|
1598
1569
|
if (!isNullOrUndefined(tempData) && tempData[this.listBaseOption.fields.id]) {
|
|
1599
1570
|
this.selectedId.push(tempData[this.listBaseOption.fields.id]);
|
|
1600
1571
|
}
|
|
@@ -1622,10 +1593,10 @@ var ListView = /** @class */ (function (_super) {
|
|
|
1622
1593
|
var dataParent = [];
|
|
1623
1594
|
for (var i = 0; i < liCollection.length; i++) {
|
|
1624
1595
|
if (typeof dataSource[0] === 'string' || typeof dataSource[0] === 'number') {
|
|
1625
|
-
liTextCollection.push(liCollection[i].innerText.trim());
|
|
1596
|
+
liTextCollection.push(liCollection[parseInt(i.toString(), 10)].innerText.trim());
|
|
1626
1597
|
}
|
|
1627
1598
|
else {
|
|
1628
|
-
var tempData = this.getItemData(liCollection[i]);
|
|
1599
|
+
var tempData = this.getItemData(liCollection[parseInt(i.toString(), 10)]);
|
|
1629
1600
|
var fieldData = getFieldValues(tempData, this.listBaseOption.fields);
|
|
1630
1601
|
if (this.isNestedList) {
|
|
1631
1602
|
dataParent.push({ data: tempData, parentId: this.getParentId() });
|
|
@@ -1812,7 +1783,7 @@ var ListView = /** @class */ (function (_super) {
|
|
|
1812
1783
|
// check for whether target is nested level or top level in list
|
|
1813
1784
|
if (ds instanceof Array) {
|
|
1814
1785
|
for (var i = 0; i < data.length; i++) {
|
|
1815
|
-
dataSource = this.addItemAtIndex(index, dataSource, data[i]);
|
|
1786
|
+
dataSource = this.addItemAtIndex(index, dataSource, data[parseInt(i.toString(), 10)]);
|
|
1816
1787
|
this.setViewDataSource(dataSource);
|
|
1817
1788
|
// since it is top level target, get the content container's first child
|
|
1818
1789
|
// as it is always the top level UL
|
|
@@ -1822,7 +1793,7 @@ var ListView = /** @class */ (function (_super) {
|
|
|
1822
1793
|
// check for whether the list was previously empty or not, if it is
|
|
1823
1794
|
// proceed to call initial render
|
|
1824
1795
|
if (this.contentContainer && targetUL) {
|
|
1825
|
-
this.addItemIntoDom(data[i], targetUL, this.curViewDS);
|
|
1796
|
+
this.addItemIntoDom(data[parseInt(i.toString(), 10)], targetUL, this.curViewDS);
|
|
1826
1797
|
}
|
|
1827
1798
|
else {
|
|
1828
1799
|
this.reRender();
|
|
@@ -1841,7 +1812,8 @@ var ListView = /** @class */ (function (_super) {
|
|
|
1841
1812
|
}
|
|
1842
1813
|
};
|
|
1843
1814
|
ListView.prototype.addItemAtIndex = function (index, newDataSource, itemData) {
|
|
1844
|
-
var isIndexValid = !(isNullOrUndefined(index)) && index >= 0 &&
|
|
1815
|
+
var isIndexValid = !(isNullOrUndefined(index)) && index >= 0 &&
|
|
1816
|
+
index < newDataSource.length && isNullOrUndefined(this.listBaseOption.fields.groupBy);
|
|
1845
1817
|
if (isIndexValid) {
|
|
1846
1818
|
newDataSource.splice(index, 0, itemData);
|
|
1847
1819
|
}
|
|
@@ -1862,7 +1834,6 @@ var ListView = /** @class */ (function (_super) {
|
|
|
1862
1834
|
: null;
|
|
1863
1835
|
var targetDS = isAlreadyRenderedUL ? targetChildDS : [targetItemData];
|
|
1864
1836
|
var isTargetEmptyChild = targetLi ? !targetLi.classList.contains(classNames.hasChild) : false;
|
|
1865
|
-
var isRefreshTemplateNeeded = false;
|
|
1866
1837
|
// if li element is already rendered, that element needs to be refreshed so that
|
|
1867
1838
|
// it becomes child viewable due to new child items are added now
|
|
1868
1839
|
if (isTargetEmptyChild) {
|
|
@@ -1870,15 +1841,13 @@ var ListView = /** @class */ (function (_super) {
|
|
|
1870
1841
|
this.setAttributes(targetRefreshedElement);
|
|
1871
1842
|
targetUL.insertBefore(targetRefreshedElement[0], targetLi);
|
|
1872
1843
|
detach(targetLi);
|
|
1873
|
-
isRefreshTemplateNeeded = true;
|
|
1874
1844
|
}
|
|
1875
1845
|
// if it is already rendered element, we need to create and append new elements
|
|
1876
1846
|
if (isAlreadyRenderedUL && itemQueue) {
|
|
1877
1847
|
for (var i = 0; i < itemQueue.length; i++) {
|
|
1878
|
-
targetDS.push(itemQueue[i]);
|
|
1879
|
-
this.addItemIntoDom(itemQueue[i], targetUL, targetDS);
|
|
1848
|
+
targetDS.push(itemQueue[parseInt(i.toString(), 10)]);
|
|
1849
|
+
this.addItemIntoDom(itemQueue[parseInt(i.toString(), 10)], targetUL, targetDS);
|
|
1880
1850
|
}
|
|
1881
|
-
isRefreshTemplateNeeded = true;
|
|
1882
1851
|
}
|
|
1883
1852
|
};
|
|
1884
1853
|
ListView.prototype.addItemIntoDom = function (currentItem, targetUL, curViewDS) {
|
|
@@ -1925,11 +1894,9 @@ var ListView = /** @class */ (function (_super) {
|
|
|
1925
1894
|
var _this = this;
|
|
1926
1895
|
var curViewDS = this.curViewDS;
|
|
1927
1896
|
var fields = obj instanceof Element ? this.getElementUID(obj) : obj;
|
|
1928
|
-
var dataSource;
|
|
1929
|
-
dataSource = this.findItemFromDS(listDataSource, fields, true);
|
|
1897
|
+
var dataSource = this.findItemFromDS(listDataSource, fields, true);
|
|
1930
1898
|
if (dataSource) {
|
|
1931
|
-
var data_1;
|
|
1932
|
-
data_1 = this.findItemFromDS(dataSource, fields);
|
|
1899
|
+
var data_1 = this.findItemFromDS(dataSource, fields);
|
|
1933
1900
|
var index = curViewDS.indexOf(data_1);
|
|
1934
1901
|
var li = this.getLiFromObjOrElement(obj);
|
|
1935
1902
|
var groupLi = void 0;
|
|
@@ -1989,18 +1956,18 @@ var ListView = /** @class */ (function (_super) {
|
|
|
1989
1956
|
ListView.prototype.removeMultipleItems = function (item) {
|
|
1990
1957
|
if (item.length) {
|
|
1991
1958
|
for (var i = 0; i < item.length; i++) {
|
|
1992
|
-
this.removeItem(item[i]);
|
|
1959
|
+
this.removeItem(item[parseInt(i.toString(), 10)]);
|
|
1993
1960
|
}
|
|
1994
1961
|
}
|
|
1995
1962
|
};
|
|
1996
1963
|
ListView.prototype.findParent = function (dataSource, id, callback, parent) {
|
|
1997
|
-
if (
|
|
1964
|
+
if (Object.prototype.hasOwnProperty.call(dataSource, id) && callback(dataSource[id]) === true) {
|
|
1998
1965
|
return extend({}, dataSource);
|
|
1999
1966
|
}
|
|
2000
1967
|
for (var i = 0; i < Object.keys(dataSource).length; i++) {
|
|
2001
|
-
if (dataSource[Object.keys(dataSource)[i]]
|
|
2002
|
-
&& typeof dataSource[Object.keys(dataSource)[i]] === 'object') {
|
|
2003
|
-
var result = this.findParent(dataSource[Object.keys(dataSource)[i]], id, callback, dataSource);
|
|
1968
|
+
if (dataSource[Object.keys(dataSource)[parseInt(i.toString(), 10)]]
|
|
1969
|
+
&& typeof dataSource[Object.keys(dataSource)[parseInt(i.toString(), 10)]] === 'object') {
|
|
1970
|
+
var result = this.findParent(dataSource[Object.keys(dataSource)[parseInt(i.toString(), 10)]], id, callback, dataSource);
|
|
2004
1971
|
if (result != null) {
|
|
2005
1972
|
if (!result.parent) {
|
|
2006
1973
|
result.parent = parent;
|
|
@@ -2023,15 +1990,15 @@ var ListView = /** @class */ (function (_super) {
|
|
|
2023
1990
|
return modules;
|
|
2024
1991
|
};
|
|
2025
1992
|
ListView.prototype.onListScroll = function (e) {
|
|
2026
|
-
var args = { originalEvent: e, scrollDirection:
|
|
1993
|
+
var args = { originalEvent: e, scrollDirection: 'Bottom', distanceY: this.element.scrollHeight - this.element.scrollTop };
|
|
2027
1994
|
var currentScrollTop = this.element.scrollTop;
|
|
2028
1995
|
if (currentScrollTop > this.previousScrollTop) {
|
|
2029
|
-
args.scrollDirection =
|
|
1996
|
+
args.scrollDirection = 'Bottom';
|
|
2030
1997
|
args.distanceY = this.element.scrollHeight - this.element.clientHeight - this.element.scrollTop;
|
|
2031
1998
|
this.trigger('scroll', args);
|
|
2032
1999
|
}
|
|
2033
2000
|
else if (this.previousScrollTop > currentScrollTop) {
|
|
2034
|
-
args.scrollDirection =
|
|
2001
|
+
args.scrollDirection = 'Top';
|
|
2035
2002
|
args.distanceY = this.element.scrollTop;
|
|
2036
2003
|
this.trigger('scroll', args);
|
|
2037
2004
|
}
|