@syncfusion/ej2-lists 19.2.49 → 19.3.44
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 +1 -1
- package/CHANGELOG.md +16 -0
- 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 +243 -685
- package/dist/es6/ej2-lists.es2015.js.map +1 -1
- package/dist/es6/ej2-lists.es5.js +243 -688
- 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 +8 -8
- package/src/common/list-base.d.ts +1 -16
- package/src/common/list-base.js +19 -12
- package/src/list-view/list-view-model.d.ts +1 -6
- package/src/list-view/list-view.d.ts +3 -19
- package/src/list-view/list-view.js +163 -460
- package/src/list-view/virtualization.js +56 -204
- package/src/sortable/sortable-model.d.ts +1 -1
- package/src/sortable/sortable.js +3 -9
- package/styles/bootstrap5-dark.css +533 -0
- package/styles/bootstrap5-dark.scss +2 -0
- package/styles/bootstrap5.css +533 -0
- package/styles/bootstrap5.scss +2 -0
- package/styles/list-view/_bootstrap5-dark-definition.scss +1 -0
- package/styles/list-view/_bootstrap5-definition.scss +129 -0
- package/styles/list-view/_layout.scss +26 -26
- package/styles/list-view/_tailwind-dark-definition.scss +1 -116
- package/styles/list-view/_tailwind-definition.scss +33 -29
- package/styles/list-view/_theme.scss +35 -10
- package/styles/list-view/bootstrap5-dark.css +506 -0
- package/styles/list-view/bootstrap5-dark.scss +5 -0
- package/styles/list-view/bootstrap5.css +506 -0
- package/styles/list-view/bootstrap5.scss +5 -0
- package/styles/list-view/icons/_bootstrap5-dark.scss +1 -0
- package/styles/list-view/icons/_bootstrap5.scss +8 -0
- package/styles/list-view/material-dark.css +1 -1
- package/styles/material-dark.css +1 -1
- package/styles/sortable/bootstrap5-dark.css +26 -0
- package/styles/sortable/bootstrap5-dark.scss +2 -0
- package/styles/sortable/bootstrap5.css +26 -0
- package/styles/sortable/bootstrap5.scss +2 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Animation, Base, ChildProperty, Complex, Component, Draggable, Event, EventHandler, NotifyPropertyChanges, Property, SanitizeHtmlHelper, Touch, addClass, append, attributes,
|
|
1
|
+
import { Animation, Base, ChildProperty, Complex, Component, Draggable, Event, EventHandler, NotifyPropertyChanges, Property, SanitizeHtmlHelper, Touch, addClass, append, attributes, closest, compareElementParent, compile, detach, extend, formatUnit, getComponent, getUniqueID, getValue, isBlazor, isNullOrUndefined, isVisible, merge, prepend, remove, removeClass, rippleEffect } from '@syncfusion/ej2-base';
|
|
2
2
|
import { DataManager, Query } from '@syncfusion/ej2-data';
|
|
3
3
|
import { createCheckBox } from '@syncfusion/ej2-buttons';
|
|
4
4
|
|
|
@@ -52,7 +52,8 @@ var ListBase;
|
|
|
52
52
|
urlAttributes: 'urlAttributes',
|
|
53
53
|
imageAttributes: 'imageAttributes',
|
|
54
54
|
imageUrl: 'imageUrl',
|
|
55
|
-
groupBy: null
|
|
55
|
+
groupBy: null,
|
|
56
|
+
sortBy: null
|
|
56
57
|
};
|
|
57
58
|
var defaultAriaAttributes = {
|
|
58
59
|
level: 1,
|
|
@@ -586,7 +587,7 @@ var ListBase;
|
|
|
586
587
|
var curOpt = extend({}, defaultListBaseOptions, options);
|
|
587
588
|
var curFields = extend({}, ListBase.defaultMappedFields, fields);
|
|
588
589
|
// eslint-disable-next-line
|
|
589
|
-
var compiledString =
|
|
590
|
+
var compiledString = compileTemplate(template);
|
|
590
591
|
var liCollection = [];
|
|
591
592
|
var value;
|
|
592
593
|
var id = generateId(); // generate id for drop-down-list option.
|
|
@@ -683,7 +684,7 @@ var ListBase;
|
|
|
683
684
|
// eslint-disable-next-line
|
|
684
685
|
headerItems, options, componentInstance) {
|
|
685
686
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
686
|
-
var compiledString =
|
|
687
|
+
var compiledString = compileTemplate(groupTemplate);
|
|
687
688
|
var curFields = extend({}, ListBase.defaultMappedFields, fields);
|
|
688
689
|
var curOpt = extend({}, defaultListBaseOptions, options);
|
|
689
690
|
var category = curFields.groupBy;
|
|
@@ -868,16 +869,9 @@ var ListBase;
|
|
|
868
869
|
else {
|
|
869
870
|
li.setAttribute('data-uid', generateId());
|
|
870
871
|
}
|
|
871
|
-
var blazId = 'BlazId';
|
|
872
|
-
if (options && !!options.removeBlazorID
|
|
873
|
-
&& typeof item === 'object'
|
|
874
|
-
// eslint-disable-next-line no-prototype-builtins
|
|
875
|
-
&& item.hasOwnProperty(blazId)) {
|
|
876
|
-
delete item[blazId];
|
|
877
|
-
}
|
|
878
872
|
if (grpLI && options && options.groupTemplate) {
|
|
879
873
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
880
|
-
var compiledString =
|
|
874
|
+
var compiledString = compileTemplate(options.groupTemplate);
|
|
881
875
|
// eslint-disable-next-line
|
|
882
876
|
var compiledElement = compiledString(item, componentInstance, 'groupTemplate', curOpt.groupTemplateID, !!curOpt.isStringTemplate, null, li);
|
|
883
877
|
if (compiledElement) {
|
|
@@ -886,7 +880,7 @@ var ListBase;
|
|
|
886
880
|
}
|
|
887
881
|
else if (!grpLI && options && options.template) {
|
|
888
882
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
889
|
-
var compiledString =
|
|
883
|
+
var compiledString = compileTemplate(options.template);
|
|
890
884
|
// eslint-disable-next-line
|
|
891
885
|
var compiledElement = compiledString(item, componentInstance, 'template', curOpt.templateID, !!curOpt.isStringTemplate, null, li);
|
|
892
886
|
if (compiledElement) {
|
|
@@ -988,6 +982,19 @@ function getFieldValues(dataItem, fields) {
|
|
|
988
982
|
}
|
|
989
983
|
return fieldData;
|
|
990
984
|
}
|
|
985
|
+
function compileTemplate(template) {
|
|
986
|
+
if (template) {
|
|
987
|
+
try {
|
|
988
|
+
if (document.querySelector(template)) {
|
|
989
|
+
return compile(document.querySelector(template).innerHTML.trim());
|
|
990
|
+
}
|
|
991
|
+
}
|
|
992
|
+
catch (e) {
|
|
993
|
+
return compile(template);
|
|
994
|
+
}
|
|
995
|
+
}
|
|
996
|
+
return undefined;
|
|
997
|
+
}
|
|
991
998
|
|
|
992
999
|
var __extends = (undefined && undefined.__extends) || (function () {
|
|
993
1000
|
var extendStatics = function (d, b) {
|
|
@@ -1133,7 +1140,6 @@ var ListView = /** @__PURE__ @class */ (function (_super) {
|
|
|
1133
1140
|
*/
|
|
1134
1141
|
function ListView(options, element) {
|
|
1135
1142
|
var _this = _super.call(this, options, element) || this;
|
|
1136
|
-
_this.itemReRender = false;
|
|
1137
1143
|
_this.previousSelectedItems = [];
|
|
1138
1144
|
_this.hiddenItems = [];
|
|
1139
1145
|
_this.enabledItems = [];
|
|
@@ -1171,14 +1177,9 @@ var ListView = /** @__PURE__ @class */ (function (_super) {
|
|
|
1171
1177
|
// eslint-disable-next-line
|
|
1172
1178
|
this.listBaseOption.fields = this.fields.properties;
|
|
1173
1179
|
if (this.enableVirtualization) {
|
|
1174
|
-
|
|
1175
|
-
this.virtualizationModule.reRenderUiVirtualization();
|
|
1176
|
-
}
|
|
1180
|
+
this.virtualizationModule.reRenderUiVirtualization();
|
|
1177
1181
|
}
|
|
1178
1182
|
else {
|
|
1179
|
-
if (isBlazor() && this.isServerRendered && !this.enableVirtualization) {
|
|
1180
|
-
this.itemReRender = true;
|
|
1181
|
-
}
|
|
1182
1183
|
this.reRender();
|
|
1183
1184
|
}
|
|
1184
1185
|
break;
|
|
@@ -1189,14 +1190,9 @@ var ListView = /** @__PURE__ @class */ (function (_super) {
|
|
|
1189
1190
|
break;
|
|
1190
1191
|
case 'query':
|
|
1191
1192
|
if (this.enableVirtualization) {
|
|
1192
|
-
|
|
1193
|
-
this.virtualizationModule.reRenderUiVirtualization();
|
|
1194
|
-
}
|
|
1193
|
+
this.virtualizationModule.reRenderUiVirtualization();
|
|
1195
1194
|
}
|
|
1196
1195
|
else {
|
|
1197
|
-
if (isBlazor() && this.isServerRendered && !this.enableVirtualization) {
|
|
1198
|
-
this.itemReRender = true;
|
|
1199
|
-
}
|
|
1200
1196
|
this.reRender();
|
|
1201
1197
|
}
|
|
1202
1198
|
break;
|
|
@@ -1211,50 +1207,35 @@ var ListView = /** @__PURE__ @class */ (function (_super) {
|
|
|
1211
1207
|
break;
|
|
1212
1208
|
case 'showCheckBox':
|
|
1213
1209
|
case 'checkBoxPosition':
|
|
1214
|
-
if (
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
this.setCheckbox();
|
|
1220
|
-
}
|
|
1210
|
+
if (this.enableVirtualization) {
|
|
1211
|
+
this.virtualizationModule.reRenderUiVirtualization();
|
|
1212
|
+
}
|
|
1213
|
+
else {
|
|
1214
|
+
this.setCheckbox();
|
|
1221
1215
|
}
|
|
1222
1216
|
break;
|
|
1223
1217
|
case 'dataSource':
|
|
1224
1218
|
if (this.enableVirtualization) {
|
|
1225
|
-
|
|
1226
|
-
this.virtualizationModule.reRenderUiVirtualization();
|
|
1227
|
-
}
|
|
1219
|
+
this.virtualizationModule.reRenderUiVirtualization();
|
|
1228
1220
|
}
|
|
1229
1221
|
else {
|
|
1230
|
-
if (isBlazor() && this.isServerRendered && !this.enableVirtualization) {
|
|
1231
|
-
this.itemReRender = true;
|
|
1232
|
-
}
|
|
1233
1222
|
this.reRender();
|
|
1234
1223
|
}
|
|
1235
1224
|
break;
|
|
1236
1225
|
case 'sortOrder':
|
|
1237
1226
|
case 'template':
|
|
1238
1227
|
if (!this.enableVirtualization) {
|
|
1239
|
-
|
|
1240
|
-
this.refresh();
|
|
1241
|
-
}
|
|
1228
|
+
this.refresh();
|
|
1242
1229
|
}
|
|
1243
1230
|
break;
|
|
1244
1231
|
case 'showIcon':
|
|
1245
|
-
if (
|
|
1246
|
-
|
|
1247
|
-
this.interopAdaptor.invokeMethodAsync('ItemSorting');
|
|
1232
|
+
if (this.enableVirtualization) {
|
|
1233
|
+
this.virtualizationModule.reRenderUiVirtualization();
|
|
1248
1234
|
}
|
|
1249
1235
|
else {
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
else {
|
|
1254
|
-
this.listBaseOption.showIcon = this.showIcon;
|
|
1255
|
-
this.curViewDS = this.getSubDS();
|
|
1256
|
-
this.resetCurrentList();
|
|
1257
|
-
}
|
|
1236
|
+
this.listBaseOption.showIcon = this.showIcon;
|
|
1237
|
+
this.curViewDS = this.getSubDS();
|
|
1238
|
+
this.resetCurrentList();
|
|
1258
1239
|
}
|
|
1259
1240
|
break;
|
|
1260
1241
|
default:
|
|
@@ -1302,76 +1283,68 @@ var ListView = /** @__PURE__ @class */ (function (_super) {
|
|
|
1302
1283
|
};
|
|
1303
1284
|
// Support Component Functions
|
|
1304
1285
|
ListView.prototype.header = function (text, showBack, prop) {
|
|
1305
|
-
if (
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1286
|
+
if (this.headerEle === undefined && this.showHeader) {
|
|
1287
|
+
if (this.enableHtmlSanitizer) {
|
|
1288
|
+
this.setProperties({ headerTitle: SanitizeHtmlHelper.sanitize(this.headerTitle) }, true);
|
|
1289
|
+
}
|
|
1290
|
+
this.headerEle = this.createElement('div', { className: classNames.header });
|
|
1291
|
+
var innerHeaderEle = this.createElement('span', { className: classNames.headerText, innerHTML: this.headerTitle });
|
|
1292
|
+
var textEle = this.createElement('div', { className: classNames.text, innerHTML: innerHeaderEle.outerHTML });
|
|
1293
|
+
var hedBackButton = this.createElement('div', {
|
|
1294
|
+
className: classNames.icon + ' ' + classNames.backIcon + ' e-but-back',
|
|
1295
|
+
attrs: { style: 'display:none;' }
|
|
1296
|
+
});
|
|
1297
|
+
this.headerEle.appendChild(hedBackButton);
|
|
1298
|
+
this.headerEle.appendChild(textEle);
|
|
1299
|
+
if (this.headerTemplate) {
|
|
1300
|
+
// eslint-disable-next-line
|
|
1301
|
+
var compiledString = compile(this.headerTemplate);
|
|
1302
|
+
var headerTemplateEle = this.createElement('div', { className: classNames.headerTemplateText });
|
|
1303
|
+
// eslint-disable-next-line
|
|
1304
|
+
var compiledElement = compiledString({}, this, prop, this.LISTVIEW_HEADERTEMPLATE_ID, null, null, this.headerEle);
|
|
1305
|
+
if (compiledElement) {
|
|
1306
|
+
append(compiledElement, headerTemplateEle);
|
|
1307
|
+
}
|
|
1308
|
+
append([headerTemplateEle], this.headerEle);
|
|
1309
|
+
// eslint-disable-next-line
|
|
1310
|
+
if (this.isReact) {
|
|
1311
|
+
this.renderReactTemplates();
|
|
1312
|
+
}
|
|
1313
|
+
}
|
|
1314
|
+
if (this.headerTemplate && this.headerTitle) {
|
|
1315
|
+
textEle.classList.add('header');
|
|
1316
|
+
}
|
|
1317
|
+
this.element.classList.add('e-has-header');
|
|
1318
|
+
prepend([this.headerEle], this.element);
|
|
1309
1319
|
}
|
|
1310
|
-
else {
|
|
1311
|
-
if (this.
|
|
1320
|
+
else if (this.headerEle) {
|
|
1321
|
+
if (this.showHeader) {
|
|
1322
|
+
this.headerEle.style.display = '';
|
|
1323
|
+
var textEle = this.headerEle.querySelector('.' + classNames.headerText);
|
|
1324
|
+
var hedBackButton = this.headerEle.querySelector('.' + classNames.backIcon);
|
|
1312
1325
|
if (this.enableHtmlSanitizer) {
|
|
1313
|
-
|
|
1314
|
-
}
|
|
1315
|
-
this.headerEle = this.createElement('div', { className: classNames.header });
|
|
1316
|
-
var innerHeaderEle = this.createElement('span', { className: classNames.headerText, innerHTML: this.headerTitle });
|
|
1317
|
-
var textEle = this.createElement('div', { className: classNames.text, innerHTML: innerHeaderEle.outerHTML });
|
|
1318
|
-
var hedBackButton = this.createElement('div', {
|
|
1319
|
-
className: classNames.icon + ' ' + classNames.backIcon + ' e-but-back',
|
|
1320
|
-
attrs: { style: 'display:none;' }
|
|
1321
|
-
});
|
|
1322
|
-
this.headerEle.appendChild(hedBackButton);
|
|
1323
|
-
this.headerEle.appendChild(textEle);
|
|
1324
|
-
if (this.headerTemplate) {
|
|
1325
|
-
// eslint-disable-next-line
|
|
1326
|
-
var compiledString = compile(this.headerTemplate);
|
|
1327
|
-
var headerTemplateEle = this.createElement('div', { className: classNames.headerTemplateText });
|
|
1328
|
-
// eslint-disable-next-line
|
|
1329
|
-
var compiledElement = compiledString({}, this, prop, this.LISTVIEW_HEADERTEMPLATE_ID, null, null, this.headerEle);
|
|
1330
|
-
if (compiledElement) {
|
|
1331
|
-
append(compiledElement, headerTemplateEle);
|
|
1332
|
-
}
|
|
1333
|
-
append([headerTemplateEle], this.headerEle);
|
|
1334
|
-
this.updateBlazorTemplates(false, true, true);
|
|
1335
|
-
// eslint-disable-next-line
|
|
1336
|
-
if (this.isReact) {
|
|
1337
|
-
this.renderReactTemplates();
|
|
1338
|
-
}
|
|
1326
|
+
text = SanitizeHtmlHelper.sanitize(text);
|
|
1339
1327
|
}
|
|
1340
|
-
|
|
1341
|
-
|
|
1328
|
+
textEle.innerHTML = text;
|
|
1329
|
+
if (this.headerTemplate && showBack) {
|
|
1330
|
+
textEle.parentElement.classList.remove('header');
|
|
1331
|
+
this.headerEle.querySelector('.' + classNames.headerTemplateText).classList.add('nested-header');
|
|
1342
1332
|
}
|
|
1343
|
-
this.
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
var hedBackButton = this.headerEle.querySelector('.' + classNames.backIcon);
|
|
1351
|
-
if (this.enableHtmlSanitizer) {
|
|
1352
|
-
text = SanitizeHtmlHelper.sanitize(text);
|
|
1353
|
-
}
|
|
1354
|
-
textEle.innerHTML = text;
|
|
1355
|
-
if (this.headerTemplate && showBack) {
|
|
1356
|
-
textEle.parentElement.classList.remove('header');
|
|
1357
|
-
this.headerEle.querySelector('.' + classNames.headerTemplateText).classList.add('nested-header');
|
|
1358
|
-
}
|
|
1359
|
-
if (this.headerTemplate && !showBack) {
|
|
1360
|
-
textEle.parentElement.classList.add('header');
|
|
1361
|
-
this.headerEle.querySelector('.' + classNames.headerTemplateText).classList.remove('nested-header');
|
|
1362
|
-
this.headerEle.querySelector('.' + classNames.headerTemplateText).classList.add('header');
|
|
1363
|
-
}
|
|
1364
|
-
if (showBack === true) {
|
|
1365
|
-
hedBackButton.style.display = '';
|
|
1366
|
-
}
|
|
1367
|
-
else {
|
|
1368
|
-
hedBackButton.style.display = 'none';
|
|
1369
|
-
}
|
|
1333
|
+
if (this.headerTemplate && !showBack) {
|
|
1334
|
+
textEle.parentElement.classList.add('header');
|
|
1335
|
+
this.headerEle.querySelector('.' + classNames.headerTemplateText).classList.remove('nested-header');
|
|
1336
|
+
this.headerEle.querySelector('.' + classNames.headerTemplateText).classList.add('header');
|
|
1337
|
+
}
|
|
1338
|
+
if (showBack === true) {
|
|
1339
|
+
hedBackButton.style.display = '';
|
|
1370
1340
|
}
|
|
1371
1341
|
else {
|
|
1372
|
-
|
|
1342
|
+
hedBackButton.style.display = 'none';
|
|
1373
1343
|
}
|
|
1374
1344
|
}
|
|
1345
|
+
else {
|
|
1346
|
+
this.headerEle.style.display = 'none';
|
|
1347
|
+
}
|
|
1375
1348
|
}
|
|
1376
1349
|
};
|
|
1377
1350
|
// Animation Related Functions
|
|
@@ -1422,7 +1395,7 @@ var ListView = /** @__PURE__ @class */ (function (_super) {
|
|
|
1422
1395
|
if (this.template) {
|
|
1423
1396
|
try {
|
|
1424
1397
|
if (document.querySelectorAll(this.template).length) {
|
|
1425
|
-
this.template
|
|
1398
|
+
this.setProperties({ template: document.querySelector(this.template).innerHTML.trim() }, true);
|
|
1426
1399
|
}
|
|
1427
1400
|
}
|
|
1428
1401
|
catch (e) {
|
|
@@ -1445,39 +1418,10 @@ var ListView = /** @__PURE__ @class */ (function (_super) {
|
|
|
1445
1418
|
templateID: "" + this.element.id + LISTVIEW_TEMPLATE_PROPERTY,
|
|
1446
1419
|
groupTemplateID: "" + this.element.id + LISTVIEW_GROUPTEMPLATE_PROPERTY,
|
|
1447
1420
|
enableHtmlSanitizer: this.enableHtmlSanitizer,
|
|
1448
|
-
removeBlazorID: true
|
|
1449
1421
|
};
|
|
1450
1422
|
this.initialization();
|
|
1451
1423
|
};
|
|
1452
|
-
ListView.prototype.updateLiElementHeight = function () {
|
|
1453
|
-
var liContainer = this.element.querySelector('.' + classNames.virtualElementContainer);
|
|
1454
|
-
if (liContainer.children[0]) {
|
|
1455
|
-
this.liElementHeight = liContainer.children[0].getBoundingClientRect().height;
|
|
1456
|
-
// eslint-disable-next-line
|
|
1457
|
-
this.interopAdaptor.invokeMethodAsync('LiElementHeight', this.liElementHeight);
|
|
1458
|
-
}
|
|
1459
|
-
};
|
|
1460
1424
|
ListView.prototype.initialization = function () {
|
|
1461
|
-
if (isBlazor() && this.isServerRendered && this.enableVirtualization) {
|
|
1462
|
-
var ulContainer = this.element.querySelector('.' + classNames.virtualElementContainer);
|
|
1463
|
-
if (ulContainer !== null) {
|
|
1464
|
-
if (this.height === '') {
|
|
1465
|
-
// eslint-disable-next-line
|
|
1466
|
-
this.interopAdaptor.invokeMethodAsync('SetComponentHeight', window.innerHeight);
|
|
1467
|
-
this.isWindow = true;
|
|
1468
|
-
ulContainer.scrollIntoView();
|
|
1469
|
-
}
|
|
1470
|
-
if (this.height.toString().indexOf('%') !== -1) {
|
|
1471
|
-
// eslint-disable-next-line
|
|
1472
|
-
this.interopAdaptor.invokeMethodAsync('SetContainerHeight', this.element.getBoundingClientRect().height.toString());
|
|
1473
|
-
}
|
|
1474
|
-
if (ulContainer.children[0]) {
|
|
1475
|
-
this.liElementHeight = ulContainer.children[0].getBoundingClientRect().height;
|
|
1476
|
-
// eslint-disable-next-line
|
|
1477
|
-
this.interopAdaptor.invokeMethodAsync('LiElementHeight', this.liElementHeight);
|
|
1478
|
-
}
|
|
1479
|
-
}
|
|
1480
|
-
}
|
|
1481
1425
|
this.curDSLevel = [];
|
|
1482
1426
|
this.animateOptions = {};
|
|
1483
1427
|
this.curViewDS = [];
|
|
@@ -1727,38 +1671,6 @@ var ListView = /** @__PURE__ @class */ (function (_super) {
|
|
|
1727
1671
|
}
|
|
1728
1672
|
}
|
|
1729
1673
|
}
|
|
1730
|
-
if (isBlazor() && this.isServerRendered && this.enableVirtualization) {
|
|
1731
|
-
var ulElementContainer = this.element.querySelector('.' + classNames.virtualElementContainer);
|
|
1732
|
-
if (ulElementContainer.querySelector('.e-active')) {
|
|
1733
|
-
// eslint-disable-next-line
|
|
1734
|
-
var selectedElements = ulElementContainer.querySelectorAll('.e-active');
|
|
1735
|
-
if (this.showCheckBox) {
|
|
1736
|
-
for (var i = 0; i < selectedElements.length; i++) {
|
|
1737
|
-
// eslint-disable-next-line
|
|
1738
|
-
if (!this.previousSelectedItems.includes(selectedElements[i].getAttribute('data-uid'))) {
|
|
1739
|
-
this.previousSelectedItems.push(selectedElements[i].getAttribute('data-uid'));
|
|
1740
|
-
}
|
|
1741
|
-
}
|
|
1742
|
-
}
|
|
1743
|
-
else {
|
|
1744
|
-
this.previousSelectedItems[0] = (ulElementContainer.querySelector('.e-active').getAttribute('data-uid'));
|
|
1745
|
-
}
|
|
1746
|
-
}
|
|
1747
|
-
if (ulElementContainer.querySelector('.e-focused')) {
|
|
1748
|
-
// eslint-disable-next-line
|
|
1749
|
-
var focusElement = ulElementContainer.querySelector('.e-focused');
|
|
1750
|
-
if (!focusElement.classList.contains('e-active')) {
|
|
1751
|
-
var focusElementId = focusElement.getAttribute('data-uid');
|
|
1752
|
-
// eslint-disable-next-line
|
|
1753
|
-
if (this.previousSelectedItems.includes(focusElementId)) {
|
|
1754
|
-
var selectedElement1 = this.previousSelectedItems.slice(0, this.previousSelectedItems.indexOf(focusElementId));
|
|
1755
|
-
var selectedElement2 = this.previousSelectedItems.
|
|
1756
|
-
slice(this.previousSelectedItems.indexOf(focusElementId) + 1, this.previousSelectedItems.length);
|
|
1757
|
-
this.previousSelectedItems = selectedElement1.concat(selectedElement2);
|
|
1758
|
-
}
|
|
1759
|
-
}
|
|
1760
|
-
}
|
|
1761
|
-
}
|
|
1762
1674
|
};
|
|
1763
1675
|
ListView.prototype.removeElement = function (element) {
|
|
1764
1676
|
return element && element.parentNode && element.parentNode.removeChild(element);
|
|
@@ -2251,14 +2163,14 @@ var ListView = /** @__PURE__ @class */ (function (_super) {
|
|
|
2251
2163
|
if (dataSource === void 0) { dataSource = this.localData; }
|
|
2252
2164
|
if (dataSource && this.fields.groupBy) {
|
|
2253
2165
|
if (this.sortOrder !== 'None') {
|
|
2254
|
-
this.curViewDS = ListBase.groupDataSource(ListBase.getDataSource(dataSource, ListBase.addSorting(this.sortOrder, this.fields.sortBy)), this.listBaseOption.fields, this.sortOrder);
|
|
2166
|
+
this.curViewDS = ListBase.groupDataSource(ListBase.getDataSource(dataSource, ListBase.addSorting(this.sortOrder, (isNullOrUndefined(this.fields.sortBy)) ? this.fields.text : this.fields.sortBy)), this.listBaseOption.fields, this.sortOrder);
|
|
2255
2167
|
}
|
|
2256
2168
|
else {
|
|
2257
2169
|
this.curViewDS = ListBase.groupDataSource(dataSource, this.listBaseOption.fields, this.sortOrder);
|
|
2258
2170
|
}
|
|
2259
2171
|
}
|
|
2260
2172
|
else if (dataSource && this.sortOrder !== 'None') {
|
|
2261
|
-
this.curViewDS = ListBase.getDataSource(dataSource, ListBase.addSorting(this.sortOrder, this.fields.sortBy));
|
|
2173
|
+
this.curViewDS = ListBase.getDataSource(dataSource, ListBase.addSorting(this.sortOrder, (isNullOrUndefined(this.fields.sortBy)) ? this.fields.text : this.fields.sortBy));
|
|
2262
2174
|
}
|
|
2263
2175
|
else {
|
|
2264
2176
|
this.curViewDS = dataSource;
|
|
@@ -2267,28 +2179,45 @@ var ListView = /** @__PURE__ @class */ (function (_super) {
|
|
|
2267
2179
|
ListView.prototype.isInAnimation = function () {
|
|
2268
2180
|
return this.curUL.classList.contains('.e-animate');
|
|
2269
2181
|
};
|
|
2182
|
+
ListView.prototype.renderRemoteLists = function (e, listViewComponent) {
|
|
2183
|
+
if (this.isDestroyed) {
|
|
2184
|
+
return;
|
|
2185
|
+
}
|
|
2186
|
+
this.localData = e.result;
|
|
2187
|
+
listViewComponent.removeElement(listViewComponent.contentContainer);
|
|
2188
|
+
this.renderList();
|
|
2189
|
+
this.trigger('actionComplete', e);
|
|
2190
|
+
};
|
|
2191
|
+
ListView.prototype.triggerActionFailure = function (e) {
|
|
2192
|
+
if (this.isDestroyed) {
|
|
2193
|
+
return;
|
|
2194
|
+
}
|
|
2195
|
+
this.trigger('actionFailure', e);
|
|
2196
|
+
};
|
|
2270
2197
|
ListView.prototype.setLocalData = function () {
|
|
2271
2198
|
var _this = this;
|
|
2272
2199
|
this.trigger('actionBegin');
|
|
2273
2200
|
// eslint-disable-next-line
|
|
2274
2201
|
var listViewComponent = this;
|
|
2275
2202
|
if (this.dataSource instanceof DataManager) {
|
|
2276
|
-
this.dataSource.
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
}
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
}
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2203
|
+
if (this.dataSource.ready) {
|
|
2204
|
+
this.dataSource.ready.then(function (e) {
|
|
2205
|
+
/* eslint-disable */
|
|
2206
|
+
_this.isOffline = _this.dataSource.dataSource.offline;
|
|
2207
|
+
if (_this.dataSource instanceof DataManager && _this.isOffline) {
|
|
2208
|
+
_this.renderRemoteLists(e, listViewComponent);
|
|
2209
|
+
}
|
|
2210
|
+
}).catch(function (e) {
|
|
2211
|
+
_this.triggerActionFailure(e);
|
|
2212
|
+
});
|
|
2213
|
+
}
|
|
2214
|
+
else {
|
|
2215
|
+
this.dataSource.executeQuery(this.getQuery()).then(function (e) {
|
|
2216
|
+
_this.renderRemoteLists(e, listViewComponent);
|
|
2217
|
+
}).catch(function (e) {
|
|
2218
|
+
_this.triggerActionFailure(e);
|
|
2219
|
+
});
|
|
2220
|
+
}
|
|
2292
2221
|
}
|
|
2293
2222
|
else if (!this.dataSource || !this.dataSource.length) {
|
|
2294
2223
|
var ul = this.element.querySelector('ul');
|
|
@@ -2307,25 +2236,21 @@ var ListView = /** @__PURE__ @class */ (function (_super) {
|
|
|
2307
2236
|
}
|
|
2308
2237
|
};
|
|
2309
2238
|
ListView.prototype.reRender = function () {
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
if (Object.keys(window).indexOf('ejsInterop') === -1) {
|
|
2320
|
-
this.element.innerHTML = '';
|
|
2321
|
-
}
|
|
2322
|
-
this.headerEle = this.ulElement = this.liCollection = undefined;
|
|
2323
|
-
this.header();
|
|
2239
|
+
this.removeElement(this.headerEle);
|
|
2240
|
+
this.removeElement(this.ulElement);
|
|
2241
|
+
this.removeElement(this.contentContainer);
|
|
2242
|
+
// eslint-disable-next-line
|
|
2243
|
+
if (this.isReact) {
|
|
2244
|
+
this.clearTemplate();
|
|
2245
|
+
}
|
|
2246
|
+
if (Object.keys(window).indexOf('ejsInterop') === -1) {
|
|
2247
|
+
this.element.innerHTML = '';
|
|
2324
2248
|
}
|
|
2249
|
+
this.headerEle = this.ulElement = this.liCollection = undefined;
|
|
2250
|
+
this.header();
|
|
2325
2251
|
this.setLocalData();
|
|
2326
2252
|
};
|
|
2327
2253
|
ListView.prototype.resetCurrentList = function () {
|
|
2328
|
-
this.resetBlazorTemplates();
|
|
2329
2254
|
this.setViewDataSource(this.curViewDS);
|
|
2330
2255
|
this.contentContainer.innerHTML = '';
|
|
2331
2256
|
this.createList();
|
|
@@ -2347,36 +2272,6 @@ var ListView = /** @__PURE__ @class */ (function (_super) {
|
|
|
2347
2272
|
this.ulElement = this.curUL = ListBase.createList(this.createElement, this.curViewDS, this.listBaseOption, null, this);
|
|
2348
2273
|
this.liCollection = this.curUL.querySelectorAll('.' + classNames.listItem);
|
|
2349
2274
|
this.setAttributes(this.liCollection);
|
|
2350
|
-
this.updateBlazorTemplates(true);
|
|
2351
|
-
};
|
|
2352
|
-
ListView.prototype.resetBlazorTemplates = function () {
|
|
2353
|
-
// eslint-disable-next-line
|
|
2354
|
-
var templateCollection = blazorTemplates;
|
|
2355
|
-
if (this.template) {
|
|
2356
|
-
templateCollection[this.LISTVIEW_TEMPLATE_ID] = [];
|
|
2357
|
-
resetBlazorTemplate(this.LISTVIEW_TEMPLATE_ID, LISTVIEW_TEMPLATE_PROPERTY);
|
|
2358
|
-
}
|
|
2359
|
-
if (this.groupTemplate) {
|
|
2360
|
-
templateCollection[this.LISTVIEW_GROUPTEMPLATE_ID] = [];
|
|
2361
|
-
resetBlazorTemplate(this.LISTVIEW_GROUPTEMPLATE_ID, LISTVIEW_GROUPTEMPLATE_PROPERTY);
|
|
2362
|
-
}
|
|
2363
|
-
if (this.headerTemplate) {
|
|
2364
|
-
resetBlazorTemplate(this.LISTVIEW_HEADERTEMPLATE_ID, LISTVIEW_HEADERTEMPLATE_PROPERTY);
|
|
2365
|
-
}
|
|
2366
|
-
};
|
|
2367
|
-
ListView.prototype.updateBlazorTemplates = function (template, headerTemplate, resetExistingElements) {
|
|
2368
|
-
if (template === void 0) { template = false; }
|
|
2369
|
-
if (headerTemplate === void 0) { headerTemplate = false; }
|
|
2370
|
-
if (resetExistingElements === void 0) { resetExistingElements = false; }
|
|
2371
|
-
if (this.template && template && !this.enableVirtualization) {
|
|
2372
|
-
updateBlazorTemplate(this.LISTVIEW_TEMPLATE_ID, LISTVIEW_TEMPLATE_PROPERTY, this, resetExistingElements);
|
|
2373
|
-
}
|
|
2374
|
-
if (this.groupTemplate && template && !this.enableVirtualization) {
|
|
2375
|
-
updateBlazorTemplate(this.LISTVIEW_GROUPTEMPLATE_ID, LISTVIEW_GROUPTEMPLATE_PROPERTY, this, resetExistingElements);
|
|
2376
|
-
}
|
|
2377
|
-
if (this.headerTemplate && headerTemplate) {
|
|
2378
|
-
updateBlazorTemplate(this.LISTVIEW_HEADERTEMPLATE_ID, LISTVIEW_HEADERTEMPLATE_PROPERTY, this, resetExistingElements);
|
|
2379
|
-
}
|
|
2380
2275
|
};
|
|
2381
2276
|
ListView.prototype.exceptionEvent = function (e) {
|
|
2382
2277
|
this.trigger('actionFailure', e);
|
|
@@ -2388,97 +2283,6 @@ var ListView = /** @__PURE__ @class */ (function (_super) {
|
|
|
2388
2283
|
this.liCollection = this.curUL.querySelectorAll('.' + classNames.listItem);
|
|
2389
2284
|
}
|
|
2390
2285
|
};
|
|
2391
|
-
ListView.prototype.removeActiveClass = function () {
|
|
2392
|
-
// eslint-disable-next-line
|
|
2393
|
-
var listViewComponent = this;
|
|
2394
|
-
setTimeout(function () {
|
|
2395
|
-
var ulContainer = listViewComponent.element.querySelector('.' + classNames.virtualElementContainer);
|
|
2396
|
-
for (var i = 0; i < ulContainer.childElementCount; i++) {
|
|
2397
|
-
var selectedElement = ulContainer.children[i];
|
|
2398
|
-
var elementIndex = void 0;
|
|
2399
|
-
var hiddenElementIndex = void 0;
|
|
2400
|
-
if (listViewComponent.showCheckBox) {
|
|
2401
|
-
if (listViewComponent.previousSelectedItems.length > 0) {
|
|
2402
|
-
for (var j = 0; j < listViewComponent.previousSelectedItems.length; j++) {
|
|
2403
|
-
if (selectedElement.getAttribute('data-uid') === listViewComponent.previousSelectedItems[j]) {
|
|
2404
|
-
selectedElement.classList.add('e-active');
|
|
2405
|
-
selectedElement.setAttribute('aria-selected', 'true');
|
|
2406
|
-
if (selectedElement.querySelector('.e-frame.e-icons')) {
|
|
2407
|
-
selectedElement.querySelector('.e-frame.e-icons').classList.add('e-check');
|
|
2408
|
-
}
|
|
2409
|
-
elementIndex = i;
|
|
2410
|
-
}
|
|
2411
|
-
else {
|
|
2412
|
-
if (elementIndex !== i) {
|
|
2413
|
-
selectedElement.classList.remove('e-active');
|
|
2414
|
-
selectedElement.removeAttribute('aria-selected');
|
|
2415
|
-
if (selectedElement.querySelector('.e-check')) {
|
|
2416
|
-
selectedElement.querySelector('.e-check').classList.remove('e-check');
|
|
2417
|
-
}
|
|
2418
|
-
}
|
|
2419
|
-
}
|
|
2420
|
-
}
|
|
2421
|
-
}
|
|
2422
|
-
else {
|
|
2423
|
-
selectedElement.classList.remove('e-active');
|
|
2424
|
-
selectedElement.removeAttribute('aria-selected');
|
|
2425
|
-
if (selectedElement.querySelector('.e-check')) {
|
|
2426
|
-
selectedElement.querySelector('.e-check').classList.remove('e-check');
|
|
2427
|
-
}
|
|
2428
|
-
}
|
|
2429
|
-
}
|
|
2430
|
-
else {
|
|
2431
|
-
if (selectedElement.getAttribute('data-uid') === listViewComponent.previousSelectedItems[0]) {
|
|
2432
|
-
selectedElement.classList.add('e-active');
|
|
2433
|
-
selectedElement.setAttribute('aria-selected', 'true');
|
|
2434
|
-
}
|
|
2435
|
-
else {
|
|
2436
|
-
selectedElement.classList.remove('e-active');
|
|
2437
|
-
selectedElement.removeAttribute('aria-selected');
|
|
2438
|
-
}
|
|
2439
|
-
}
|
|
2440
|
-
if (listViewComponent.hiddenItems.length > 0) {
|
|
2441
|
-
for (var k = 0; k < listViewComponent.hiddenItems.length; k++) {
|
|
2442
|
-
if (selectedElement.getAttribute('data-uid') === listViewComponent.previousSelectedItems[k]) {
|
|
2443
|
-
selectedElement.style.display = 'none';
|
|
2444
|
-
hiddenElementIndex = i;
|
|
2445
|
-
}
|
|
2446
|
-
else {
|
|
2447
|
-
if (hiddenElementIndex !== i) {
|
|
2448
|
-
selectedElement.style.display = null;
|
|
2449
|
-
}
|
|
2450
|
-
}
|
|
2451
|
-
}
|
|
2452
|
-
}
|
|
2453
|
-
if (listViewComponent.enabledItems.length > 0) {
|
|
2454
|
-
for (var x = 0; x < listViewComponent.enabledItems.length; x++) {
|
|
2455
|
-
if (selectedElement.getAttribute('data-uid') === listViewComponent.enabledItems[x]) {
|
|
2456
|
-
if (selectedElement.classList.contains('e-disabled')) {
|
|
2457
|
-
selectedElement.classList.remove('e-disabled');
|
|
2458
|
-
}
|
|
2459
|
-
}
|
|
2460
|
-
}
|
|
2461
|
-
}
|
|
2462
|
-
if (listViewComponent.disabledItems.length > 0) {
|
|
2463
|
-
for (var y = 0; y < listViewComponent.disabledItems.length; y++) {
|
|
2464
|
-
if (selectedElement.getAttribute('data-uid') === listViewComponent.disabledItems[y]) {
|
|
2465
|
-
if (!selectedElement.classList.contains('e-disabled')) {
|
|
2466
|
-
selectedElement.classList.add('e-disabled');
|
|
2467
|
-
}
|
|
2468
|
-
}
|
|
2469
|
-
}
|
|
2470
|
-
}
|
|
2471
|
-
}
|
|
2472
|
-
}, 200);
|
|
2473
|
-
};
|
|
2474
|
-
ListView.prototype.renderingNestedList = function () {
|
|
2475
|
-
var ul = closest(this.liElement.parentNode, '.' + classNames.parentItem);
|
|
2476
|
-
var ctrlId = this.element.id;
|
|
2477
|
-
var ulElement = document.getElementById(ctrlId);
|
|
2478
|
-
var currentListItem = ulElement.getElementsByTagName('UL')[ulElement.getElementsByTagName('UL').length - 1];
|
|
2479
|
-
this.switchView(ul, currentListItem);
|
|
2480
|
-
this.liElement = null;
|
|
2481
|
-
};
|
|
2482
2286
|
ListView.prototype.renderSubList = function (li) {
|
|
2483
2287
|
this.liElement = li;
|
|
2484
2288
|
var uID = li.getAttribute('data-uid');
|
|
@@ -2489,27 +2293,18 @@ var ListView = /** @__PURE__ @class */ (function (_super) {
|
|
|
2489
2293
|
this.setViewDataSource(this.getSubDS());
|
|
2490
2294
|
if (!ele) {
|
|
2491
2295
|
var data = this.curViewDS;
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
else {
|
|
2497
|
-
ele = ListBase.createListFromJson(this.createElement, data, this.listBaseOption, this.curDSLevel.length, null, this);
|
|
2498
|
-
// eslint-disable-next-line
|
|
2499
|
-
if (this.isReact) {
|
|
2500
|
-
this.renderReactTemplates();
|
|
2501
|
-
}
|
|
2502
|
-
var lists = ele.querySelectorAll('.' + classNames.listItem);
|
|
2503
|
-
this.setAttributes(lists);
|
|
2504
|
-
ele.setAttribute('pID', uID);
|
|
2505
|
-
ele.style.display = 'none';
|
|
2506
|
-
this.renderIntoDom(ele);
|
|
2507
|
-
this.updateBlazorTemplates(true);
|
|
2296
|
+
ele = ListBase.createListFromJson(this.createElement, data, this.listBaseOption, this.curDSLevel.length, null, this);
|
|
2297
|
+
// eslint-disable-next-line
|
|
2298
|
+
if (this.isReact) {
|
|
2299
|
+
this.renderReactTemplates();
|
|
2508
2300
|
}
|
|
2301
|
+
var lists = ele.querySelectorAll('.' + classNames.listItem);
|
|
2302
|
+
this.setAttributes(lists);
|
|
2303
|
+
ele.setAttribute('pID', uID);
|
|
2304
|
+
ele.style.display = 'none';
|
|
2305
|
+
this.renderIntoDom(ele);
|
|
2509
2306
|
}
|
|
2510
|
-
|
|
2511
|
-
this.switchView(ul, ele);
|
|
2512
|
-
}
|
|
2307
|
+
this.switchView(ul, ele);
|
|
2513
2308
|
this.liCollection = this.curUL.querySelectorAll('.' + classNames.listItem);
|
|
2514
2309
|
if (this.selectedItems) {
|
|
2515
2310
|
var fieldData = getFieldValues(this.selectedItems.data, this.listBaseOption.fields);
|
|
@@ -2524,38 +2319,34 @@ var ListView = /** @__PURE__ @class */ (function (_super) {
|
|
|
2524
2319
|
};
|
|
2525
2320
|
ListView.prototype.renderList = function (data) {
|
|
2526
2321
|
this.setViewDataSource(data);
|
|
2527
|
-
if (
|
|
2528
|
-
if (this.
|
|
2529
|
-
if (
|
|
2530
|
-
if (
|
|
2531
|
-
if (
|
|
2532
|
-
|
|
2533
|
-
if (typeof this.template == "string") {
|
|
2534
|
-
this.listBaseOption.template = null;
|
|
2535
|
-
}
|
|
2536
|
-
if (typeof this.groupTemplate == "string") {
|
|
2537
|
-
this.listBaseOption.groupTemplate = null;
|
|
2538
|
-
}
|
|
2539
|
-
}
|
|
2540
|
-
else {
|
|
2541
|
-
this.listBaseOption.template = null;
|
|
2542
|
-
this.listBaseOption.groupTemplate = null;
|
|
2543
|
-
}
|
|
2544
|
-
this.listBaseOption.itemCreated = this.virtualizationModule.createUIItem.bind(this.virtualizationModule);
|
|
2322
|
+
if (this.enableVirtualization) {
|
|
2323
|
+
if (Object.keys(this.dataSource).length) {
|
|
2324
|
+
if ((this.template || this.groupTemplate) && !this.virtualizationModule.isNgTemplate()) {
|
|
2325
|
+
if (this.isReact) {
|
|
2326
|
+
if (typeof this.template == "string") {
|
|
2327
|
+
this.listBaseOption.template = null;
|
|
2545
2328
|
}
|
|
2329
|
+
if (typeof this.groupTemplate == "string") {
|
|
2330
|
+
this.listBaseOption.groupTemplate = null;
|
|
2331
|
+
}
|
|
2332
|
+
}
|
|
2333
|
+
else {
|
|
2334
|
+
this.listBaseOption.template = null;
|
|
2335
|
+
this.listBaseOption.groupTemplate = null;
|
|
2546
2336
|
}
|
|
2337
|
+
this.listBaseOption.itemCreated = this.virtualizationModule.createUIItem.bind(this.virtualizationModule);
|
|
2547
2338
|
}
|
|
2548
|
-
this.virtualizationModule.uiVirtualization();
|
|
2549
2339
|
}
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2340
|
+
this.virtualizationModule.uiVirtualization();
|
|
2341
|
+
}
|
|
2342
|
+
else {
|
|
2343
|
+
this.createList();
|
|
2344
|
+
this.contentContainer = this.createElement('div', { className: classNames.content });
|
|
2345
|
+
this.element.appendChild(this.contentContainer);
|
|
2346
|
+
this.renderIntoDom(this.ulElement);
|
|
2347
|
+
// eslint-disable-next-line
|
|
2348
|
+
if (this.isReact) {
|
|
2349
|
+
this.renderReactTemplates();
|
|
2559
2350
|
}
|
|
2560
2351
|
}
|
|
2561
2352
|
};
|
|
@@ -2574,42 +2365,25 @@ var ListView = /** @__PURE__ @class */ (function (_super) {
|
|
|
2574
2365
|
* Initializes the ListView component rendering.
|
|
2575
2366
|
*/
|
|
2576
2367
|
ListView.prototype.render = function () {
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
this.setHTMLAttribute();
|
|
2588
|
-
}
|
|
2589
|
-
else {
|
|
2590
|
-
this.initBlazor(true);
|
|
2591
|
-
}
|
|
2368
|
+
this.element.classList.add(classNames.root);
|
|
2369
|
+
attributes(this.element, { role: 'list', tabindex: '0' });
|
|
2370
|
+
this.setCSSClass();
|
|
2371
|
+
this.setEnableRTL();
|
|
2372
|
+
this.setEnable();
|
|
2373
|
+
this.setSize();
|
|
2374
|
+
this.wireEvents();
|
|
2375
|
+
this.header();
|
|
2376
|
+
this.setLocalData();
|
|
2377
|
+
this.setHTMLAttribute();
|
|
2592
2378
|
this.rippleFn = rippleEffect(this.element, {
|
|
2593
2379
|
selector: '.' + classNames.listItem
|
|
2594
2380
|
});
|
|
2595
2381
|
this.renderComplete();
|
|
2596
2382
|
};
|
|
2597
|
-
ListView.prototype.initBlazor = function (firstRender) {
|
|
2598
|
-
if (firstRender === null) {
|
|
2599
|
-
firstRender = false;
|
|
2600
|
-
}
|
|
2601
|
-
this.setLocalData();
|
|
2602
|
-
this.setViewDataSource(this.localData);
|
|
2603
|
-
this.contentContainer = this.element.querySelector('.' + classNames.content);
|
|
2604
|
-
if (firstRender) {
|
|
2605
|
-
this.wireEvents();
|
|
2606
|
-
}
|
|
2607
|
-
};
|
|
2608
2383
|
/**
|
|
2609
2384
|
* It is used to destroy the ListView component.
|
|
2610
2385
|
*/
|
|
2611
2386
|
ListView.prototype.destroy = function () {
|
|
2612
|
-
this.resetBlazorTemplates();
|
|
2613
2387
|
// eslint-disable-next-line
|
|
2614
2388
|
if (this.isReact) {
|
|
2615
2389
|
this.clearTemplate();
|
|
@@ -2621,13 +2395,8 @@ var ListView = /** @__PURE__ @class */ (function (_super) {
|
|
|
2621
2395
|
this.element.removeAttribute('role');
|
|
2622
2396
|
this.element.removeAttribute('tabindex');
|
|
2623
2397
|
this.curUL = this.ulElement = this.liCollection = this.headerEle = undefined;
|
|
2624
|
-
|
|
2625
|
-
|
|
2626
|
-
_super.prototype.destroy.call(this);
|
|
2627
|
-
}
|
|
2628
|
-
else {
|
|
2629
|
-
this.element.style.display = 'none';
|
|
2630
|
-
}
|
|
2398
|
+
this.element.innerHTML = '';
|
|
2399
|
+
_super.prototype.destroy.call(this);
|
|
2631
2400
|
};
|
|
2632
2401
|
/**
|
|
2633
2402
|
* Switches back from the navigated sub list item.
|
|
@@ -2647,12 +2416,7 @@ var ListView = /** @__PURE__ @class */ (function (_super) {
|
|
|
2647
2416
|
toUL = this.curUL;
|
|
2648
2417
|
}
|
|
2649
2418
|
else {
|
|
2650
|
-
|
|
2651
|
-
toUL = toUL.parentElement.parentElement.parentElement;
|
|
2652
|
-
}
|
|
2653
|
-
else {
|
|
2654
|
-
toUL = toUL.parentElement;
|
|
2655
|
-
}
|
|
2419
|
+
toUL = toUL.parentElement;
|
|
2656
2420
|
}
|
|
2657
2421
|
var fieldData = getFieldValues(this.curDSJSON, this.listBaseOption.fields);
|
|
2658
2422
|
// eslint-disable-next-line
|
|
@@ -2770,7 +2534,6 @@ var ListView = /** @__PURE__ @class */ (function (_super) {
|
|
|
2770
2534
|
/**
|
|
2771
2535
|
* Gets the details of the currently selected item from the list items.
|
|
2772
2536
|
*
|
|
2773
|
-
* @blazorType ListSelectedItem<TValue>
|
|
2774
2537
|
*/
|
|
2775
2538
|
ListView.prototype.getSelectedItems = function () {
|
|
2776
2539
|
// eslint-disable-next-line
|
|
@@ -2858,55 +2621,12 @@ var ListView = /** @__PURE__ @class */ (function (_super) {
|
|
|
2858
2621
|
}
|
|
2859
2622
|
}
|
|
2860
2623
|
}
|
|
2861
|
-
|
|
2862
|
-
// eslint-disable-next-line
|
|
2863
|
-
return this.blazorGetSelectedItems(finalValue);
|
|
2864
|
-
}
|
|
2865
|
-
else {
|
|
2866
|
-
return finalValue;
|
|
2867
|
-
}
|
|
2868
|
-
};
|
|
2869
|
-
// eslint-disable-next-line
|
|
2870
|
-
ListView.prototype.blazorGetSelectedItems = function (finalGetSelectedItem) {
|
|
2871
|
-
var blazorSelectedItem = {
|
|
2872
|
-
data: [],
|
|
2873
|
-
index: [],
|
|
2874
|
-
parentId: [],
|
|
2875
|
-
text: []
|
|
2876
|
-
};
|
|
2877
|
-
if (!isNullOrUndefined(finalGetSelectedItem)) {
|
|
2878
|
-
if (!isNullOrUndefined(finalGetSelectedItem.data)) {
|
|
2879
|
-
if (this.showCheckBox && this.isNestedList) {
|
|
2880
|
-
for (var i = 0; i < finalGetSelectedItem.data.length; i++) {
|
|
2881
|
-
blazorSelectedItem.data.push(finalGetSelectedItem.data[i].data);
|
|
2882
|
-
}
|
|
2883
|
-
if (!isNullOrUndefined(finalGetSelectedItem.data[0])
|
|
2884
|
-
&& !isNullOrUndefined(finalGetSelectedItem.data[0].parentId)) {
|
|
2885
|
-
blazorSelectedItem.parentId = finalGetSelectedItem.data[0].parentId;
|
|
2886
|
-
}
|
|
2887
|
-
}
|
|
2888
|
-
else {
|
|
2889
|
-
blazorSelectedItem.data = this.convertItemsToArray(finalGetSelectedItem.data);
|
|
2890
|
-
}
|
|
2891
|
-
}
|
|
2892
|
-
if (!isNullOrUndefined(finalGetSelectedItem.text)) {
|
|
2893
|
-
blazorSelectedItem.text = this.convertItemsToArray(finalGetSelectedItem.text);
|
|
2894
|
-
}
|
|
2895
|
-
if (!isNullOrUndefined(finalGetSelectedItem.index)) {
|
|
2896
|
-
blazorSelectedItem.index = this.convertItemsToArray(finalGetSelectedItem.index);
|
|
2897
|
-
}
|
|
2898
|
-
}
|
|
2899
|
-
return blazorSelectedItem;
|
|
2900
|
-
};
|
|
2901
|
-
// eslint-disable-next-line
|
|
2902
|
-
ListView.prototype.convertItemsToArray = function (items) {
|
|
2903
|
-
return Array.isArray(items) ? items.slice() : [items];
|
|
2624
|
+
return finalValue;
|
|
2904
2625
|
};
|
|
2905
2626
|
/**
|
|
2906
2627
|
* Finds out an item details from the current list.
|
|
2907
2628
|
*
|
|
2908
2629
|
* @param {Fields | HTMLElement | Element} item - We can pass element Object or Fields as Object with ID and Text fields.
|
|
2909
|
-
* @blazorType TValue
|
|
2910
2630
|
*/
|
|
2911
2631
|
ListView.prototype.findItem = function (item) {
|
|
2912
2632
|
return this.getItemData(item);
|
|
@@ -3003,7 +2723,6 @@ var ListView = /** @__PURE__ @class */ (function (_super) {
|
|
|
3003
2723
|
*
|
|
3004
2724
|
* @param {Fields} fields - Target item to add the given data as its children (can be null).
|
|
3005
2725
|
*
|
|
3006
|
-
* @blazorType data|object,fields|object
|
|
3007
2726
|
*/
|
|
3008
2727
|
ListView.prototype.addItem = function (data, fields) {
|
|
3009
2728
|
if (fields === void 0) { fields = undefined; }
|
|
@@ -3046,9 +2765,6 @@ var ListView = /** @__PURE__ @class */ (function (_super) {
|
|
|
3046
2765
|
this.reRender();
|
|
3047
2766
|
}
|
|
3048
2767
|
}
|
|
3049
|
-
if (this.curUL) {
|
|
3050
|
-
this.updateBlazorTemplates(true);
|
|
3051
|
-
}
|
|
3052
2768
|
this.liCollection = this.curUL.querySelectorAll('.' + classNames.listItem);
|
|
3053
2769
|
}
|
|
3054
2770
|
else {
|
|
@@ -3074,15 +2790,12 @@ var ListView = /** @__PURE__ @class */ (function (_super) {
|
|
|
3074
2790
|
: null;
|
|
3075
2791
|
var targetDS = isAlreadyRenderedUL ? targetChildDS : [targetItemData];
|
|
3076
2792
|
var isTargetEmptyChild = targetLi ? !targetLi.classList.contains(classNames.hasChild) : false;
|
|
3077
|
-
var isRefreshTemplateNeeded = false;
|
|
3078
|
-
// if li element is already rendered, that element needs to be refreshed so that
|
|
3079
|
-
// it becomes child viewable due to new child items are added now
|
|
3080
2793
|
if (isTargetEmptyChild) {
|
|
3081
2794
|
var targetRefreshedElement = ListBase.createListItemFromJson(this.createElement, targetDS, this.listBaseOption, null, null, this);
|
|
3082
2795
|
this.setAttributes(targetRefreshedElement);
|
|
3083
2796
|
targetUL.insertBefore(targetRefreshedElement[0], targetLi);
|
|
3084
2797
|
detach(targetLi);
|
|
3085
|
-
|
|
2798
|
+
|
|
3086
2799
|
}
|
|
3087
2800
|
// if it is already rendered element, we need to create and append new elements
|
|
3088
2801
|
if (isAlreadyRenderedUL && itemQueue) {
|
|
@@ -3090,10 +2803,7 @@ var ListView = /** @__PURE__ @class */ (function (_super) {
|
|
|
3090
2803
|
targetDS.push(itemQueue[i]);
|
|
3091
2804
|
this.addItemIntoDom(itemQueue[i], targetUL, targetDS);
|
|
3092
2805
|
}
|
|
3093
|
-
|
|
3094
|
-
}
|
|
3095
|
-
if (isRefreshTemplateNeeded) {
|
|
3096
|
-
this.updateBlazorTemplates(true);
|
|
2806
|
+
|
|
3097
2807
|
}
|
|
3098
2808
|
};
|
|
3099
2809
|
ListView.prototype.addItemIntoDom = function (currentItem, targetUL, curViewDS) {
|
|
@@ -3135,7 +2845,6 @@ var ListView = /** @__PURE__ @class */ (function (_super) {
|
|
|
3135
2845
|
}
|
|
3136
2846
|
else {
|
|
3137
2847
|
this.removeItemFromList(item, listDataSource);
|
|
3138
|
-
this.updateBlazorTemplates(true);
|
|
3139
2848
|
}
|
|
3140
2849
|
};
|
|
3141
2850
|
ListView.prototype.removeItemFromList = function (obj, listDataSource) {
|
|
@@ -3213,7 +2922,6 @@ var ListView = /** @__PURE__ @class */ (function (_super) {
|
|
|
3213
2922
|
for (var i = 0; i < item.length; i++) {
|
|
3214
2923
|
this.removeItem(item[i]);
|
|
3215
2924
|
}
|
|
3216
|
-
this.updateBlazorTemplates(true);
|
|
3217
2925
|
}
|
|
3218
2926
|
};
|
|
3219
2927
|
// eslint-disable-next-line
|
|
@@ -3358,66 +3066,43 @@ var Virtualization = /** @__PURE__ @class */ (function () {
|
|
|
3358
3066
|
this.wireScrollEvent(false);
|
|
3359
3067
|
var curViewDS = this.listViewInstance.curViewDS;
|
|
3360
3068
|
var firstDs = curViewDS.slice(0, 1);
|
|
3361
|
-
|
|
3362
|
-
|
|
3363
|
-
|
|
3364
|
-
|
|
3365
|
-
|
|
3366
|
-
|
|
3367
|
-
this.listViewInstance.contentContainer.appendChild(this.listViewInstance.ulElement);
|
|
3368
|
-
}
|
|
3069
|
+
this.listViewInstance.ulElement = this.listViewInstance.curUL = ListBase.createList(
|
|
3070
|
+
// eslint-disable-next-line
|
|
3071
|
+
this.listViewInstance.createElement, firstDs, this.listViewInstance.listBaseOption, null, this.listViewInstance);
|
|
3072
|
+
this.listViewInstance.contentContainer = this.listViewInstance.createElement('div', { className: classNames.content });
|
|
3073
|
+
this.listViewInstance.element.appendChild(this.listViewInstance.contentContainer);
|
|
3074
|
+
this.listViewInstance.contentContainer.appendChild(this.listViewInstance.ulElement);
|
|
3369
3075
|
this.listItemHeight = this.listViewInstance.ulElement.firstElementChild.getBoundingClientRect().height;
|
|
3370
3076
|
this.expectedDomItemCount = this.ValidateItemCount(10000);
|
|
3371
3077
|
this.domItemCount = this.ValidateItemCount(Object.keys(this.listViewInstance.curViewDS).length);
|
|
3372
3078
|
this.uiFirstIndex = 0;
|
|
3373
3079
|
this.uiLastIndex = this.domItemCount - 1;
|
|
3374
3080
|
var otherDs = curViewDS.slice(1, this.domItemCount);
|
|
3375
|
-
|
|
3376
|
-
|
|
3377
|
-
|
|
3378
|
-
|
|
3379
|
-
|
|
3380
|
-
|
|
3381
|
-
|
|
3382
|
-
|
|
3383
|
-
|
|
3384
|
-
|
|
3385
|
-
|
|
3386
|
-
|
|
3387
|
-
|
|
3388
|
-
|
|
3389
|
-
this.bottomElementHeight = this.totalHeight;
|
|
3390
|
-
}
|
|
3391
|
-
else {
|
|
3392
|
-
this.listViewInstance.contentContainer = this.listViewInstance.element.querySelector('.e-content');
|
|
3393
|
-
this.listViewInstance.liCollection = this.listViewInstance.curUL.querySelectorAll('li');
|
|
3394
|
-
}
|
|
3081
|
+
var listItems = ListBase.createListItemFromJson(
|
|
3082
|
+
// eslint-disable-next-line
|
|
3083
|
+
this.listViewInstance.createElement, otherDs, this.listViewInstance.listBaseOption, null, null, this.listViewInstance);
|
|
3084
|
+
append(listItems, this.listViewInstance.ulElement);
|
|
3085
|
+
this.listViewInstance.liCollection = this.listViewInstance.curUL.querySelectorAll('li');
|
|
3086
|
+
this.topElement = this.listViewInstance.createElement('div');
|
|
3087
|
+
this.listViewInstance.ulElement.insertBefore(this.topElement, this.listViewInstance.ulElement.firstElementChild);
|
|
3088
|
+
this.bottomElement = this.listViewInstance.createElement('div');
|
|
3089
|
+
this.listViewInstance.ulElement.insertBefore(this.bottomElement, null);
|
|
3090
|
+
this.totalHeight = (Object.keys(curViewDS).length * this.listItemHeight) - (this.domItemCount * this.listItemHeight);
|
|
3091
|
+
this.topElement.style.height = 0 + 'px';
|
|
3092
|
+
this.bottomElement.style.height = this.totalHeight + 'px';
|
|
3093
|
+
this.topElementHeight = 0;
|
|
3094
|
+
this.bottomElementHeight = this.totalHeight;
|
|
3395
3095
|
this.listDiff = 0;
|
|
3396
3096
|
this.uiIndicesInitialization();
|
|
3397
3097
|
};
|
|
3398
3098
|
Virtualization.prototype.wireScrollEvent = function (destroy) {
|
|
3399
3099
|
if (!destroy) {
|
|
3400
|
-
if (
|
|
3401
|
-
|
|
3402
|
-
|
|
3403
|
-
window.addEventListener('scroll', this.onVirtualScroll);
|
|
3404
|
-
}
|
|
3405
|
-
else {
|
|
3406
|
-
EventHandler.add(this.listViewInstance.element, 'scroll', this.onVirtualUiScroll, this);
|
|
3407
|
-
}
|
|
3100
|
+
if (this.listViewInstance.isWindow) {
|
|
3101
|
+
this.onVirtualScroll = this.onVirtualUiScroll.bind(this);
|
|
3102
|
+
window.addEventListener('scroll', this.onVirtualScroll);
|
|
3408
3103
|
}
|
|
3409
3104
|
else {
|
|
3410
|
-
|
|
3411
|
-
// eslint-disable-next-line
|
|
3412
|
-
this.onVirtualScroll = debounce(this.onVirtualUiScroll.bind(this), 350);
|
|
3413
|
-
this.updateUl = this.updateUlContainer.bind(this);
|
|
3414
|
-
window.addEventListener('scroll', this.onVirtualScroll);
|
|
3415
|
-
window.addEventListener('scroll', this.updateUl);
|
|
3416
|
-
}
|
|
3417
|
-
else {
|
|
3418
|
-
EventHandler.add(this.listViewInstance.element, 'scroll', debounce(this.onVirtualUiScroll, 350), this);
|
|
3419
|
-
EventHandler.add(this.listViewInstance.element, 'scroll', this.updateUlContainer, this);
|
|
3420
|
-
}
|
|
3105
|
+
EventHandler.add(this.listViewInstance.element, 'scroll', this.onVirtualUiScroll, this);
|
|
3421
3106
|
}
|
|
3422
3107
|
}
|
|
3423
3108
|
else {
|
|
@@ -3496,16 +3181,10 @@ var Virtualization = /** @__PURE__ @class */ (function () {
|
|
|
3496
3181
|
Virtualization.prototype.refreshItemHeight = function () {
|
|
3497
3182
|
if (this.listViewInstance.curViewDS.length) {
|
|
3498
3183
|
var curViewDS = this.listViewInstance.curViewDS;
|
|
3499
|
-
|
|
3500
|
-
|
|
3501
|
-
|
|
3502
|
-
|
|
3503
|
-
else {
|
|
3504
|
-
this.listItemHeight = this.topElement.nextSibling.getBoundingClientRect().height;
|
|
3505
|
-
this.totalHeight = (Object.keys(curViewDS).length * this.listItemHeight) - (this.domItemCount * this.listItemHeight);
|
|
3506
|
-
this.bottomElementHeight = this.totalHeight;
|
|
3507
|
-
this.bottomElement.style.height = this.totalHeight + 'px';
|
|
3508
|
-
}
|
|
3184
|
+
this.listItemHeight = this.topElement.nextSibling.getBoundingClientRect().height;
|
|
3185
|
+
this.totalHeight = (Object.keys(curViewDS).length * this.listItemHeight) - (this.domItemCount * this.listItemHeight);
|
|
3186
|
+
this.bottomElementHeight = this.totalHeight;
|
|
3187
|
+
this.bottomElement.style.height = this.totalHeight + 'px';
|
|
3509
3188
|
}
|
|
3510
3189
|
};
|
|
3511
3190
|
Virtualization.prototype.getscrollerHeight = function (startingHeight) {
|
|
@@ -3529,54 +3208,31 @@ var Virtualization = /** @__PURE__ @class */ (function () {
|
|
|
3529
3208
|
this.bottomElementHeight = this.totalHeight - this.topElementHeight;
|
|
3530
3209
|
_a = scroll <= this.totalHeight ?
|
|
3531
3210
|
[this.topElementHeight, this.bottomElementHeight] : [this.totalHeight, 0], this.topElementHeight = _a[0], this.bottomElementHeight = _a[1];
|
|
3532
|
-
if (
|
|
3533
|
-
|
|
3534
|
-
|
|
3535
|
-
|
|
3536
|
-
|
|
3537
|
-
|
|
3538
|
-
|
|
3539
|
-
|
|
3540
|
-
|
|
3541
|
-
|
|
3542
|
-
listDiff = Math.round(e.target.scrollTop / this.listViewInstance.liElementHeight);
|
|
3543
|
-
}
|
|
3544
|
-
if ((listDiff - 2) - this.elementDifference >= 3 || (listDiff - 2) - this.elementDifference <= -1) {
|
|
3545
|
-
var args = { listDiff: listDiff - 2, selectedItems: this.listViewInstance.previousSelectedItems };
|
|
3546
|
-
this.listViewInstance.interopAdaptor.invokeMethodAsync('VirtalScrolling', args);
|
|
3547
|
-
if (this.listViewInstance.ulElement.querySelector('.e-focused')) {
|
|
3548
|
-
this.listViewInstance.ulElement.querySelector('.e-focused').classList.remove('e-focused');
|
|
3211
|
+
if (this.topElementHeight !== parseFloat(this.topElement.style.height)) {
|
|
3212
|
+
this.topElement.style.height = this.topElementHeight + 'px';
|
|
3213
|
+
this.bottomElement.style.height = this.bottomElementHeight + 'px';
|
|
3214
|
+
if (scroll > this.scrollPosition) {
|
|
3215
|
+
var listDiff = Math.round(((this.topElementHeight / this.listItemHeight) - this.listDiff));
|
|
3216
|
+
if (listDiff > (this.expectedDomItemCount + 5)) {
|
|
3217
|
+
this.onLongScroll(listDiff, true);
|
|
3218
|
+
}
|
|
3219
|
+
else {
|
|
3220
|
+
this.onNormalScroll(listDiff, true);
|
|
3549
3221
|
}
|
|
3550
|
-
this.elementDifference = listDiff - 2;
|
|
3551
3222
|
}
|
|
3552
|
-
|
|
3553
|
-
|
|
3554
|
-
|
|
3555
|
-
|
|
3556
|
-
this.bottomElement.style.height = this.bottomElementHeight + 'px';
|
|
3557
|
-
if (scroll > this.scrollPosition) {
|
|
3558
|
-
var listDiff = Math.round(((this.topElementHeight / this.listItemHeight) - this.listDiff));
|
|
3559
|
-
if (listDiff > (this.expectedDomItemCount + 5)) {
|
|
3560
|
-
this.onLongScroll(listDiff, true);
|
|
3561
|
-
}
|
|
3562
|
-
else {
|
|
3563
|
-
this.onNormalScroll(listDiff, true);
|
|
3564
|
-
}
|
|
3223
|
+
else {
|
|
3224
|
+
var listDiff = Math.round((this.listDiff - (this.topElementHeight / this.listItemHeight)));
|
|
3225
|
+
if (listDiff > (this.expectedDomItemCount + 5)) {
|
|
3226
|
+
this.onLongScroll(listDiff, false);
|
|
3565
3227
|
}
|
|
3566
3228
|
else {
|
|
3567
|
-
|
|
3568
|
-
if (listDiff > (this.expectedDomItemCount + 5)) {
|
|
3569
|
-
this.onLongScroll(listDiff, false);
|
|
3570
|
-
}
|
|
3571
|
-
else {
|
|
3572
|
-
this.onNormalScroll(listDiff, false);
|
|
3573
|
-
}
|
|
3229
|
+
this.onNormalScroll(listDiff, false);
|
|
3574
3230
|
}
|
|
3575
3231
|
}
|
|
3576
|
-
|
|
3577
|
-
|
|
3578
|
-
|
|
3579
|
-
|
|
3232
|
+
}
|
|
3233
|
+
this.listDiff = Math.round(this.topElementHeight / this.listItemHeight);
|
|
3234
|
+
if (typeof this.listViewInstance.onUIScrolled === 'function') {
|
|
3235
|
+
this.listViewInstance.onUIScrolled();
|
|
3580
3236
|
}
|
|
3581
3237
|
this.scrollPosition = scroll;
|
|
3582
3238
|
};
|
|
@@ -3764,14 +3420,6 @@ var Virtualization = /** @__PURE__ @class */ (function () {
|
|
|
3764
3420
|
}
|
|
3765
3421
|
}
|
|
3766
3422
|
else {
|
|
3767
|
-
if (isBlazor() && this.listViewInstance.isServerRendered) {
|
|
3768
|
-
var scrollDiff = Math.round(this.listViewInstance.element.scrollTop /
|
|
3769
|
-
this.listViewInstance.liElementHeight) - 2;
|
|
3770
|
-
if (scrollDiff < 0) {
|
|
3771
|
-
scrollDiff = 0;
|
|
3772
|
-
}
|
|
3773
|
-
this.activeIndex += scrollDiff;
|
|
3774
|
-
}
|
|
3775
3423
|
var curViewDS_2 = this.listViewInstance.curViewDS;
|
|
3776
3424
|
var text = this.listViewInstance.fields.text;
|
|
3777
3425
|
if (this.listViewInstance.showCheckBox) {
|
|
@@ -3866,114 +3514,35 @@ var Virtualization = /** @__PURE__ @class */ (function () {
|
|
|
3866
3514
|
this.listViewInstance.removeSelect();
|
|
3867
3515
|
this.activeIndex = undefined;
|
|
3868
3516
|
}
|
|
3869
|
-
if (isBlazor() && this.listViewInstance.isServerRendered) {
|
|
3870
|
-
// eslint-disable-next-line
|
|
3871
|
-
var elementId = resutJSON.data[this.listViewInstance.fields.id];
|
|
3872
|
-
if (this.listViewInstance.showCheckBox) {
|
|
3873
|
-
if (!this.listViewInstance.previousSelectedItems.includes(elementId)) {
|
|
3874
|
-
this.listViewInstance.previousSelectedItems.push(elementId);
|
|
3875
|
-
}
|
|
3876
|
-
else {
|
|
3877
|
-
var indexPosition = this.listViewInstance.previousSelectedItems.indexOf(elementId);
|
|
3878
|
-
if (indexPosition > -1) {
|
|
3879
|
-
this.listViewInstance.previousSelectedItems.splice(indexPosition, 1);
|
|
3880
|
-
}
|
|
3881
|
-
}
|
|
3882
|
-
}
|
|
3883
|
-
else {
|
|
3884
|
-
this.listViewInstance.previousSelectedItems[0] = elementId;
|
|
3885
|
-
}
|
|
3886
|
-
this.listViewInstance.removeActiveClass();
|
|
3887
|
-
}
|
|
3888
3517
|
};
|
|
3889
3518
|
Virtualization.prototype.enableItem = function (obj) {
|
|
3890
3519
|
var resutJSON = this.findDSAndIndexFromId(this.listViewInstance.curViewDS, obj);
|
|
3891
|
-
if (
|
|
3892
|
-
|
|
3893
|
-
var itemId = resutJSON.data[this.listViewInstance.fields.id];
|
|
3894
|
-
if (!this.listViewInstance.enabledItems.includes(itemId)) {
|
|
3895
|
-
this.listViewInstance.enabledItems.push(itemId);
|
|
3896
|
-
this.listViewInstance.removeActiveClass();
|
|
3897
|
-
}
|
|
3898
|
-
if (this.listViewInstance.disabledItems.includes(itemId)) {
|
|
3899
|
-
var indexPosition = this.listViewInstance.disabledItems.indexOf(itemId);
|
|
3900
|
-
if (indexPosition > -1) {
|
|
3901
|
-
this.listViewInstance.disabledItems.splice(indexPosition, 1);
|
|
3902
|
-
}
|
|
3903
|
-
}
|
|
3904
|
-
}
|
|
3905
|
-
else {
|
|
3906
|
-
if (Object.keys(resutJSON).length) {
|
|
3907
|
-
this.uiIndices.disabledItemIndices.splice(this.uiIndices.disabledItemIndices.indexOf(resutJSON.index), 1);
|
|
3908
|
-
}
|
|
3520
|
+
if (Object.keys(resutJSON).length) {
|
|
3521
|
+
this.uiIndices.disabledItemIndices.splice(this.uiIndices.disabledItemIndices.indexOf(resutJSON.index), 1);
|
|
3909
3522
|
}
|
|
3910
3523
|
};
|
|
3911
3524
|
Virtualization.prototype.disableItem = function (obj) {
|
|
3912
3525
|
var resutJSON = this.findDSAndIndexFromId(this.listViewInstance.curViewDS, obj);
|
|
3913
|
-
if (
|
|
3914
|
-
|
|
3915
|
-
var liElementId = resutJSON.data[this.listViewInstance.fields.id];
|
|
3916
|
-
if (!this.listViewInstance.disabledItems.includes(liElementId)) {
|
|
3917
|
-
this.listViewInstance.disabledItems.push(liElementId);
|
|
3918
|
-
this.listViewInstance.removeActiveClass();
|
|
3919
|
-
}
|
|
3920
|
-
if (this.listViewInstance.enabledItems.includes(liElementId)) {
|
|
3921
|
-
var indexPosition = this.listViewInstance.enabledItems.indexOf(liElementId);
|
|
3922
|
-
if (indexPosition > -1) {
|
|
3923
|
-
this.listViewInstance.enabledItems.splice(indexPosition, 1);
|
|
3924
|
-
}
|
|
3925
|
-
}
|
|
3926
|
-
}
|
|
3927
|
-
else {
|
|
3928
|
-
if (Object.keys(resutJSON).length && this.uiIndices.disabledItemIndices.indexOf(resutJSON.index) === -1) {
|
|
3929
|
-
this.uiIndices.disabledItemIndices.push(resutJSON.index);
|
|
3930
|
-
}
|
|
3526
|
+
if (Object.keys(resutJSON).length && this.uiIndices.disabledItemIndices.indexOf(resutJSON.index) === -1) {
|
|
3527
|
+
this.uiIndices.disabledItemIndices.push(resutJSON.index);
|
|
3931
3528
|
}
|
|
3932
3529
|
};
|
|
3933
3530
|
Virtualization.prototype.showItem = function (obj) {
|
|
3934
3531
|
var resutJSON = this.findDSAndIndexFromId(this.listViewInstance.curViewDS, obj);
|
|
3935
|
-
if (
|
|
3936
|
-
|
|
3937
|
-
var hiddenElementId = resutJSON.data[this.listViewInstance.fields.id];
|
|
3938
|
-
if (this.listViewInstance.hiddenItems.includes(hiddenElementId)) {
|
|
3939
|
-
var indexPosition = this.listViewInstance.hiddenItems.indexOf(hiddenElementId);
|
|
3940
|
-
if (indexPosition > -1) {
|
|
3941
|
-
this.listViewInstance.previousSelectedItems.splice(indexPosition, 1);
|
|
3942
|
-
this.listViewInstance.removeActiveClass();
|
|
3943
|
-
}
|
|
3944
|
-
}
|
|
3945
|
-
}
|
|
3946
|
-
else {
|
|
3947
|
-
if (Object.keys(resutJSON).length) {
|
|
3948
|
-
this.uiIndices.hiddenItemIndices.splice(this.uiIndices.hiddenItemIndices.indexOf(resutJSON.index), 1);
|
|
3949
|
-
}
|
|
3532
|
+
if (Object.keys(resutJSON).length) {
|
|
3533
|
+
this.uiIndices.hiddenItemIndices.splice(this.uiIndices.hiddenItemIndices.indexOf(resutJSON.index), 1);
|
|
3950
3534
|
}
|
|
3951
3535
|
};
|
|
3952
3536
|
Virtualization.prototype.hideItem = function (obj) {
|
|
3953
3537
|
var resutJSON = this.findDSAndIndexFromId(this.listViewInstance.curViewDS, obj);
|
|
3954
|
-
if (
|
|
3955
|
-
|
|
3956
|
-
var elementId = resutJSON.data[this.listViewInstance.fields.id];
|
|
3957
|
-
if (!this.listViewInstance.hiddenItems.includes(elementId)) {
|
|
3958
|
-
this.listViewInstance.hiddenItems.push(elementId);
|
|
3959
|
-
this.listViewInstance.removeActiveClass();
|
|
3960
|
-
}
|
|
3961
|
-
}
|
|
3962
|
-
else {
|
|
3963
|
-
if (Object.keys(resutJSON).length && this.uiIndices.hiddenItemIndices.indexOf(resutJSON.index) === -1) {
|
|
3964
|
-
this.uiIndices.hiddenItemIndices.push(resutJSON.index);
|
|
3965
|
-
}
|
|
3538
|
+
if (Object.keys(resutJSON).length && this.uiIndices.hiddenItemIndices.indexOf(resutJSON.index) === -1) {
|
|
3539
|
+
this.uiIndices.hiddenItemIndices.push(resutJSON.index);
|
|
3966
3540
|
}
|
|
3967
3541
|
};
|
|
3968
3542
|
Virtualization.prototype.removeItem = function (obj) {
|
|
3969
3543
|
var dataSource;
|
|
3970
3544
|
var curViewDS = this.listViewInstance.curViewDS;
|
|
3971
3545
|
var resutJSON = this.findDSAndIndexFromId(curViewDS, obj);
|
|
3972
|
-
if (isBlazor() && this.listViewInstance.isServerRendered) {
|
|
3973
|
-
if (resutJSON.index !== undefined) {
|
|
3974
|
-
this.listViewInstance.interopAdaptor.invokeMethodAsync('RemoveItemPosition', resutJSON.index);
|
|
3975
|
-
}
|
|
3976
|
-
}
|
|
3977
3546
|
if (Object.keys(resutJSON).length) {
|
|
3978
3547
|
dataSource = resutJSON.data;
|
|
3979
3548
|
if (curViewDS[resutJSON.index - 1] &&
|
|
@@ -3984,9 +3553,7 @@ var Virtualization = /** @__PURE__ @class */ (function () {
|
|
|
3984
3553
|
this.removeUiItem(resutJSON.index - 1);
|
|
3985
3554
|
}
|
|
3986
3555
|
else {
|
|
3987
|
-
|
|
3988
|
-
this.removeUiItem(resutJSON.index);
|
|
3989
|
-
}
|
|
3556
|
+
this.removeUiItem(resutJSON.index);
|
|
3990
3557
|
}
|
|
3991
3558
|
}
|
|
3992
3559
|
var listDataSource = this.listViewInstance.dataSource instanceof DataManager
|
|
@@ -4002,12 +3569,6 @@ var Virtualization = /** @__PURE__ @class */ (function () {
|
|
|
4002
3569
|
};
|
|
4003
3570
|
// eslint-disable-next-line
|
|
4004
3571
|
Virtualization.prototype.setCheckboxLI = function (li, e) {
|
|
4005
|
-
if (isBlazor() && this.listViewInstance.isServerRendered) {
|
|
4006
|
-
this.uiFirstIndex = Math.round(this.listViewInstance.element.scrollTop / 36) - 4;
|
|
4007
|
-
if (this.uiFirstIndex < 0) {
|
|
4008
|
-
this.uiFirstIndex = 0;
|
|
4009
|
-
}
|
|
4010
|
-
}
|
|
4011
3572
|
var index = Array.prototype.indexOf.call(this.listViewInstance.curUL.querySelectorAll('li'), li) + this.uiFirstIndex;
|
|
4012
3573
|
this.activeIndex = Array.prototype.indexOf.call(this.listViewInstance.curUL.querySelectorAll('li'), li) + this.uiFirstIndex;
|
|
4013
3574
|
if (li.classList.contains(classNames.selected)) {
|
|
@@ -4663,10 +4224,6 @@ var Sortable = /** @__PURE__ @class */ (function (_super) {
|
|
|
4663
4224
|
element.style.height = target.offsetHeight + "px";
|
|
4664
4225
|
}
|
|
4665
4226
|
addClass([element], ['e-sortableclone']);
|
|
4666
|
-
removeClass([element], ['e-listboxtool-container']);
|
|
4667
|
-
if (element && element.className.indexOf("e-listbox-wrapper") < 0) {
|
|
4668
|
-
addClass([element], ['e-listbox-wrapper']);
|
|
4669
|
-
}
|
|
4670
4227
|
document.body.appendChild(element);
|
|
4671
4228
|
return element;
|
|
4672
4229
|
};
|
|
@@ -4779,9 +4336,8 @@ var Sortable = /** @__PURE__ @class */ (function (_super) {
|
|
|
4779
4336
|
var isPlaceHolderPresent = _this.isPlaceHolderPresent(dropInst);
|
|
4780
4337
|
if (isPlaceHolderPresent) {
|
|
4781
4338
|
var curIdx_1 = _this.getIndex(dropInst.placeHolderElement, dropInst);
|
|
4782
|
-
var prevIndx = _this === dropInst && (prevIdx - curIdx_1) > 0 ? prevIdx - 1 : prevIdx;
|
|
4783
4339
|
var args = {
|
|
4784
|
-
previousIndex:
|
|
4340
|
+
previousIndex: prevIdx, currentIndex: curIdx_1, target: e.target, droppedElement: _this.target,
|
|
4785
4341
|
helper: e.helper, cancel: false, handled: false
|
|
4786
4342
|
};
|
|
4787
4343
|
_this.trigger('beforeDrop', args, function (observedArgs) {
|
|
@@ -4808,8 +4364,7 @@ var Sortable = /** @__PURE__ @class */ (function (_super) {
|
|
|
4808
4364
|
// eslint-disable-next-line prefer-const
|
|
4809
4365
|
curIdx = dropInst.element.childElementCount;
|
|
4810
4366
|
prevIdx = _this.getIndex(_this.target);
|
|
4811
|
-
|
|
4812
|
-
if (dropInst.element === target || (!isPlaceHolderPresent && _this.curTarget === _this.target)) {
|
|
4367
|
+
if (dropInst.element === e.target || (!isPlaceHolderPresent && _this.curTarget === _this.target)) {
|
|
4813
4368
|
var beforeDropArgs = {
|
|
4814
4369
|
previousIndex: prevIdx, currentIndex: _this.curTarget === _this.target ? prevIdx : curIdx,
|
|
4815
4370
|
target: e.target, droppedElement: _this.target, helper: e.helper, cancel: false
|