@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
|
const defaultAriaAttributes = {
|
|
58
59
|
level: 1,
|
|
@@ -584,7 +585,7 @@ var ListBase;
|
|
|
584
585
|
const curOpt = extend({}, defaultListBaseOptions, options);
|
|
585
586
|
const curFields = extend({}, ListBase.defaultMappedFields, fields);
|
|
586
587
|
// eslint-disable-next-line
|
|
587
|
-
const compiledString =
|
|
588
|
+
const compiledString = compileTemplate(template);
|
|
588
589
|
const liCollection = [];
|
|
589
590
|
let value;
|
|
590
591
|
const id = generateId(); // generate id for drop-down-list option.
|
|
@@ -681,7 +682,7 @@ var ListBase;
|
|
|
681
682
|
// eslint-disable-next-line
|
|
682
683
|
headerItems, options, componentInstance) {
|
|
683
684
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
684
|
-
const compiledString =
|
|
685
|
+
const compiledString = compileTemplate(groupTemplate);
|
|
685
686
|
const curFields = extend({}, ListBase.defaultMappedFields, fields);
|
|
686
687
|
const curOpt = extend({}, defaultListBaseOptions, options);
|
|
687
688
|
const category = curFields.groupBy;
|
|
@@ -865,16 +866,9 @@ var ListBase;
|
|
|
865
866
|
else {
|
|
866
867
|
li.setAttribute('data-uid', generateId());
|
|
867
868
|
}
|
|
868
|
-
const blazId = 'BlazId';
|
|
869
|
-
if (options && !!options.removeBlazorID
|
|
870
|
-
&& typeof item === 'object'
|
|
871
|
-
// eslint-disable-next-line no-prototype-builtins
|
|
872
|
-
&& item.hasOwnProperty(blazId)) {
|
|
873
|
-
delete item[blazId];
|
|
874
|
-
}
|
|
875
869
|
if (grpLI && options && options.groupTemplate) {
|
|
876
870
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
877
|
-
const compiledString =
|
|
871
|
+
const compiledString = compileTemplate(options.groupTemplate);
|
|
878
872
|
// eslint-disable-next-line
|
|
879
873
|
const compiledElement = compiledString(item, componentInstance, 'groupTemplate', curOpt.groupTemplateID, !!curOpt.isStringTemplate, null, li);
|
|
880
874
|
if (compiledElement) {
|
|
@@ -883,7 +877,7 @@ var ListBase;
|
|
|
883
877
|
}
|
|
884
878
|
else if (!grpLI && options && options.template) {
|
|
885
879
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
886
|
-
const compiledString =
|
|
880
|
+
const compiledString = compileTemplate(options.template);
|
|
887
881
|
// eslint-disable-next-line
|
|
888
882
|
const compiledElement = compiledString(item, componentInstance, 'template', curOpt.templateID, !!curOpt.isStringTemplate, null, li);
|
|
889
883
|
if (compiledElement) {
|
|
@@ -984,6 +978,19 @@ function getFieldValues(dataItem, fields) {
|
|
|
984
978
|
}
|
|
985
979
|
return fieldData;
|
|
986
980
|
}
|
|
981
|
+
function compileTemplate(template) {
|
|
982
|
+
if (template) {
|
|
983
|
+
try {
|
|
984
|
+
if (document.querySelector(template)) {
|
|
985
|
+
return compile(document.querySelector(template).innerHTML.trim());
|
|
986
|
+
}
|
|
987
|
+
}
|
|
988
|
+
catch (e) {
|
|
989
|
+
return compile(template);
|
|
990
|
+
}
|
|
991
|
+
}
|
|
992
|
+
return undefined;
|
|
993
|
+
}
|
|
987
994
|
|
|
988
995
|
var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
989
996
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -1110,7 +1117,6 @@ let ListView = class ListView extends Component {
|
|
|
1110
1117
|
*/
|
|
1111
1118
|
constructor(options, element) {
|
|
1112
1119
|
super(options, element);
|
|
1113
|
-
this.itemReRender = false;
|
|
1114
1120
|
this.previousSelectedItems = [];
|
|
1115
1121
|
this.hiddenItems = [];
|
|
1116
1122
|
this.enabledItems = [];
|
|
@@ -1146,14 +1152,9 @@ let ListView = class ListView extends Component {
|
|
|
1146
1152
|
// eslint-disable-next-line
|
|
1147
1153
|
this.listBaseOption.fields = this.fields.properties;
|
|
1148
1154
|
if (this.enableVirtualization) {
|
|
1149
|
-
|
|
1150
|
-
this.virtualizationModule.reRenderUiVirtualization();
|
|
1151
|
-
}
|
|
1155
|
+
this.virtualizationModule.reRenderUiVirtualization();
|
|
1152
1156
|
}
|
|
1153
1157
|
else {
|
|
1154
|
-
if (isBlazor() && this.isServerRendered && !this.enableVirtualization) {
|
|
1155
|
-
this.itemReRender = true;
|
|
1156
|
-
}
|
|
1157
1158
|
this.reRender();
|
|
1158
1159
|
}
|
|
1159
1160
|
break;
|
|
@@ -1164,14 +1165,9 @@ let ListView = class ListView extends Component {
|
|
|
1164
1165
|
break;
|
|
1165
1166
|
case 'query':
|
|
1166
1167
|
if (this.enableVirtualization) {
|
|
1167
|
-
|
|
1168
|
-
this.virtualizationModule.reRenderUiVirtualization();
|
|
1169
|
-
}
|
|
1168
|
+
this.virtualizationModule.reRenderUiVirtualization();
|
|
1170
1169
|
}
|
|
1171
1170
|
else {
|
|
1172
|
-
if (isBlazor() && this.isServerRendered && !this.enableVirtualization) {
|
|
1173
|
-
this.itemReRender = true;
|
|
1174
|
-
}
|
|
1175
1171
|
this.reRender();
|
|
1176
1172
|
}
|
|
1177
1173
|
break;
|
|
@@ -1186,50 +1182,35 @@ let ListView = class ListView extends Component {
|
|
|
1186
1182
|
break;
|
|
1187
1183
|
case 'showCheckBox':
|
|
1188
1184
|
case 'checkBoxPosition':
|
|
1189
|
-
if (
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
this.setCheckbox();
|
|
1195
|
-
}
|
|
1185
|
+
if (this.enableVirtualization) {
|
|
1186
|
+
this.virtualizationModule.reRenderUiVirtualization();
|
|
1187
|
+
}
|
|
1188
|
+
else {
|
|
1189
|
+
this.setCheckbox();
|
|
1196
1190
|
}
|
|
1197
1191
|
break;
|
|
1198
1192
|
case 'dataSource':
|
|
1199
1193
|
if (this.enableVirtualization) {
|
|
1200
|
-
|
|
1201
|
-
this.virtualizationModule.reRenderUiVirtualization();
|
|
1202
|
-
}
|
|
1194
|
+
this.virtualizationModule.reRenderUiVirtualization();
|
|
1203
1195
|
}
|
|
1204
1196
|
else {
|
|
1205
|
-
if (isBlazor() && this.isServerRendered && !this.enableVirtualization) {
|
|
1206
|
-
this.itemReRender = true;
|
|
1207
|
-
}
|
|
1208
1197
|
this.reRender();
|
|
1209
1198
|
}
|
|
1210
1199
|
break;
|
|
1211
1200
|
case 'sortOrder':
|
|
1212
1201
|
case 'template':
|
|
1213
1202
|
if (!this.enableVirtualization) {
|
|
1214
|
-
|
|
1215
|
-
this.refresh();
|
|
1216
|
-
}
|
|
1203
|
+
this.refresh();
|
|
1217
1204
|
}
|
|
1218
1205
|
break;
|
|
1219
1206
|
case 'showIcon':
|
|
1220
|
-
if (
|
|
1221
|
-
|
|
1222
|
-
this.interopAdaptor.invokeMethodAsync('ItemSorting');
|
|
1207
|
+
if (this.enableVirtualization) {
|
|
1208
|
+
this.virtualizationModule.reRenderUiVirtualization();
|
|
1223
1209
|
}
|
|
1224
1210
|
else {
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
else {
|
|
1229
|
-
this.listBaseOption.showIcon = this.showIcon;
|
|
1230
|
-
this.curViewDS = this.getSubDS();
|
|
1231
|
-
this.resetCurrentList();
|
|
1232
|
-
}
|
|
1211
|
+
this.listBaseOption.showIcon = this.showIcon;
|
|
1212
|
+
this.curViewDS = this.getSubDS();
|
|
1213
|
+
this.resetCurrentList();
|
|
1233
1214
|
}
|
|
1234
1215
|
break;
|
|
1235
1216
|
default:
|
|
@@ -1277,76 +1258,68 @@ let ListView = class ListView extends Component {
|
|
|
1277
1258
|
}
|
|
1278
1259
|
// Support Component Functions
|
|
1279
1260
|
header(text, showBack, prop) {
|
|
1280
|
-
if (
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1261
|
+
if (this.headerEle === undefined && this.showHeader) {
|
|
1262
|
+
if (this.enableHtmlSanitizer) {
|
|
1263
|
+
this.setProperties({ headerTitle: SanitizeHtmlHelper.sanitize(this.headerTitle) }, true);
|
|
1264
|
+
}
|
|
1265
|
+
this.headerEle = this.createElement('div', { className: classNames.header });
|
|
1266
|
+
const innerHeaderEle = this.createElement('span', { className: classNames.headerText, innerHTML: this.headerTitle });
|
|
1267
|
+
const textEle = this.createElement('div', { className: classNames.text, innerHTML: innerHeaderEle.outerHTML });
|
|
1268
|
+
const hedBackButton = this.createElement('div', {
|
|
1269
|
+
className: classNames.icon + ' ' + classNames.backIcon + ' e-but-back',
|
|
1270
|
+
attrs: { style: 'display:none;' }
|
|
1271
|
+
});
|
|
1272
|
+
this.headerEle.appendChild(hedBackButton);
|
|
1273
|
+
this.headerEle.appendChild(textEle);
|
|
1274
|
+
if (this.headerTemplate) {
|
|
1275
|
+
// eslint-disable-next-line
|
|
1276
|
+
const compiledString = compile(this.headerTemplate);
|
|
1277
|
+
const headerTemplateEle = this.createElement('div', { className: classNames.headerTemplateText });
|
|
1278
|
+
// eslint-disable-next-line
|
|
1279
|
+
const compiledElement = compiledString({}, this, prop, this.LISTVIEW_HEADERTEMPLATE_ID, null, null, this.headerEle);
|
|
1280
|
+
if (compiledElement) {
|
|
1281
|
+
append(compiledElement, headerTemplateEle);
|
|
1282
|
+
}
|
|
1283
|
+
append([headerTemplateEle], this.headerEle);
|
|
1284
|
+
// eslint-disable-next-line
|
|
1285
|
+
if (this.isReact) {
|
|
1286
|
+
this.renderReactTemplates();
|
|
1287
|
+
}
|
|
1288
|
+
}
|
|
1289
|
+
if (this.headerTemplate && this.headerTitle) {
|
|
1290
|
+
textEle.classList.add('header');
|
|
1291
|
+
}
|
|
1292
|
+
this.element.classList.add('e-has-header');
|
|
1293
|
+
prepend([this.headerEle], this.element);
|
|
1284
1294
|
}
|
|
1285
|
-
else {
|
|
1286
|
-
if (this.
|
|
1295
|
+
else if (this.headerEle) {
|
|
1296
|
+
if (this.showHeader) {
|
|
1297
|
+
this.headerEle.style.display = '';
|
|
1298
|
+
const textEle = this.headerEle.querySelector('.' + classNames.headerText);
|
|
1299
|
+
const hedBackButton = this.headerEle.querySelector('.' + classNames.backIcon);
|
|
1287
1300
|
if (this.enableHtmlSanitizer) {
|
|
1288
|
-
|
|
1289
|
-
}
|
|
1290
|
-
this.headerEle = this.createElement('div', { className: classNames.header });
|
|
1291
|
-
const innerHeaderEle = this.createElement('span', { className: classNames.headerText, innerHTML: this.headerTitle });
|
|
1292
|
-
const textEle = this.createElement('div', { className: classNames.text, innerHTML: innerHeaderEle.outerHTML });
|
|
1293
|
-
const 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
|
-
const compiledString = compile(this.headerTemplate);
|
|
1302
|
-
const headerTemplateEle = this.createElement('div', { className: classNames.headerTemplateText });
|
|
1303
|
-
// eslint-disable-next-line
|
|
1304
|
-
const 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
|
-
this.updateBlazorTemplates(false, true, true);
|
|
1310
|
-
// eslint-disable-next-line
|
|
1311
|
-
if (this.isReact) {
|
|
1312
|
-
this.renderReactTemplates();
|
|
1313
|
-
}
|
|
1301
|
+
text = SanitizeHtmlHelper.sanitize(text);
|
|
1314
1302
|
}
|
|
1315
|
-
|
|
1316
|
-
|
|
1303
|
+
textEle.innerHTML = text;
|
|
1304
|
+
if (this.headerTemplate && showBack) {
|
|
1305
|
+
textEle.parentElement.classList.remove('header');
|
|
1306
|
+
this.headerEle.querySelector('.' + classNames.headerTemplateText).classList.add('nested-header');
|
|
1317
1307
|
}
|
|
1318
|
-
this.
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
const hedBackButton = this.headerEle.querySelector('.' + classNames.backIcon);
|
|
1326
|
-
if (this.enableHtmlSanitizer) {
|
|
1327
|
-
text = SanitizeHtmlHelper.sanitize(text);
|
|
1328
|
-
}
|
|
1329
|
-
textEle.innerHTML = text;
|
|
1330
|
-
if (this.headerTemplate && showBack) {
|
|
1331
|
-
textEle.parentElement.classList.remove('header');
|
|
1332
|
-
this.headerEle.querySelector('.' + classNames.headerTemplateText).classList.add('nested-header');
|
|
1333
|
-
}
|
|
1334
|
-
if (this.headerTemplate && !showBack) {
|
|
1335
|
-
textEle.parentElement.classList.add('header');
|
|
1336
|
-
this.headerEle.querySelector('.' + classNames.headerTemplateText).classList.remove('nested-header');
|
|
1337
|
-
this.headerEle.querySelector('.' + classNames.headerTemplateText).classList.add('header');
|
|
1338
|
-
}
|
|
1339
|
-
if (showBack === true) {
|
|
1340
|
-
hedBackButton.style.display = '';
|
|
1341
|
-
}
|
|
1342
|
-
else {
|
|
1343
|
-
hedBackButton.style.display = 'none';
|
|
1344
|
-
}
|
|
1308
|
+
if (this.headerTemplate && !showBack) {
|
|
1309
|
+
textEle.parentElement.classList.add('header');
|
|
1310
|
+
this.headerEle.querySelector('.' + classNames.headerTemplateText).classList.remove('nested-header');
|
|
1311
|
+
this.headerEle.querySelector('.' + classNames.headerTemplateText).classList.add('header');
|
|
1312
|
+
}
|
|
1313
|
+
if (showBack === true) {
|
|
1314
|
+
hedBackButton.style.display = '';
|
|
1345
1315
|
}
|
|
1346
1316
|
else {
|
|
1347
|
-
|
|
1317
|
+
hedBackButton.style.display = 'none';
|
|
1348
1318
|
}
|
|
1349
1319
|
}
|
|
1320
|
+
else {
|
|
1321
|
+
this.headerEle.style.display = 'none';
|
|
1322
|
+
}
|
|
1350
1323
|
}
|
|
1351
1324
|
}
|
|
1352
1325
|
// Animation Related Functions
|
|
@@ -1396,7 +1369,7 @@ let ListView = class ListView extends Component {
|
|
|
1396
1369
|
if (this.template) {
|
|
1397
1370
|
try {
|
|
1398
1371
|
if (document.querySelectorAll(this.template).length) {
|
|
1399
|
-
this.template
|
|
1372
|
+
this.setProperties({ template: document.querySelector(this.template).innerHTML.trim() }, true);
|
|
1400
1373
|
}
|
|
1401
1374
|
}
|
|
1402
1375
|
catch (e) {
|
|
@@ -1419,39 +1392,10 @@ let ListView = class ListView extends Component {
|
|
|
1419
1392
|
templateID: `${this.element.id}${LISTVIEW_TEMPLATE_PROPERTY}`,
|
|
1420
1393
|
groupTemplateID: `${this.element.id}${LISTVIEW_GROUPTEMPLATE_PROPERTY}`,
|
|
1421
1394
|
enableHtmlSanitizer: this.enableHtmlSanitizer,
|
|
1422
|
-
removeBlazorID: true
|
|
1423
1395
|
};
|
|
1424
1396
|
this.initialization();
|
|
1425
1397
|
}
|
|
1426
|
-
updateLiElementHeight() {
|
|
1427
|
-
const liContainer = this.element.querySelector('.' + classNames.virtualElementContainer);
|
|
1428
|
-
if (liContainer.children[0]) {
|
|
1429
|
-
this.liElementHeight = liContainer.children[0].getBoundingClientRect().height;
|
|
1430
|
-
// eslint-disable-next-line
|
|
1431
|
-
this.interopAdaptor.invokeMethodAsync('LiElementHeight', this.liElementHeight);
|
|
1432
|
-
}
|
|
1433
|
-
}
|
|
1434
1398
|
initialization() {
|
|
1435
|
-
if (isBlazor() && this.isServerRendered && this.enableVirtualization) {
|
|
1436
|
-
const ulContainer = this.element.querySelector('.' + classNames.virtualElementContainer);
|
|
1437
|
-
if (ulContainer !== null) {
|
|
1438
|
-
if (this.height === '') {
|
|
1439
|
-
// eslint-disable-next-line
|
|
1440
|
-
this.interopAdaptor.invokeMethodAsync('SetComponentHeight', window.innerHeight);
|
|
1441
|
-
this.isWindow = true;
|
|
1442
|
-
ulContainer.scrollIntoView();
|
|
1443
|
-
}
|
|
1444
|
-
if (this.height.toString().indexOf('%') !== -1) {
|
|
1445
|
-
// eslint-disable-next-line
|
|
1446
|
-
this.interopAdaptor.invokeMethodAsync('SetContainerHeight', this.element.getBoundingClientRect().height.toString());
|
|
1447
|
-
}
|
|
1448
|
-
if (ulContainer.children[0]) {
|
|
1449
|
-
this.liElementHeight = ulContainer.children[0].getBoundingClientRect().height;
|
|
1450
|
-
// eslint-disable-next-line
|
|
1451
|
-
this.interopAdaptor.invokeMethodAsync('LiElementHeight', this.liElementHeight);
|
|
1452
|
-
}
|
|
1453
|
-
}
|
|
1454
|
-
}
|
|
1455
1399
|
this.curDSLevel = [];
|
|
1456
1400
|
this.animateOptions = {};
|
|
1457
1401
|
this.curViewDS = [];
|
|
@@ -1701,38 +1645,6 @@ let ListView = class ListView extends Component {
|
|
|
1701
1645
|
}
|
|
1702
1646
|
}
|
|
1703
1647
|
}
|
|
1704
|
-
if (isBlazor() && this.isServerRendered && this.enableVirtualization) {
|
|
1705
|
-
const ulElementContainer = this.element.querySelector('.' + classNames.virtualElementContainer);
|
|
1706
|
-
if (ulElementContainer.querySelector('.e-active')) {
|
|
1707
|
-
// eslint-disable-next-line
|
|
1708
|
-
const selectedElements = ulElementContainer.querySelectorAll('.e-active');
|
|
1709
|
-
if (this.showCheckBox) {
|
|
1710
|
-
for (let i = 0; i < selectedElements.length; i++) {
|
|
1711
|
-
// eslint-disable-next-line
|
|
1712
|
-
if (!this.previousSelectedItems.includes(selectedElements[i].getAttribute('data-uid'))) {
|
|
1713
|
-
this.previousSelectedItems.push(selectedElements[i].getAttribute('data-uid'));
|
|
1714
|
-
}
|
|
1715
|
-
}
|
|
1716
|
-
}
|
|
1717
|
-
else {
|
|
1718
|
-
this.previousSelectedItems[0] = (ulElementContainer.querySelector('.e-active').getAttribute('data-uid'));
|
|
1719
|
-
}
|
|
1720
|
-
}
|
|
1721
|
-
if (ulElementContainer.querySelector('.e-focused')) {
|
|
1722
|
-
// eslint-disable-next-line
|
|
1723
|
-
const focusElement = ulElementContainer.querySelector('.e-focused');
|
|
1724
|
-
if (!focusElement.classList.contains('e-active')) {
|
|
1725
|
-
const focusElementId = focusElement.getAttribute('data-uid');
|
|
1726
|
-
// eslint-disable-next-line
|
|
1727
|
-
if (this.previousSelectedItems.includes(focusElementId)) {
|
|
1728
|
-
const selectedElement1 = this.previousSelectedItems.slice(0, this.previousSelectedItems.indexOf(focusElementId));
|
|
1729
|
-
const selectedElement2 = this.previousSelectedItems.
|
|
1730
|
-
slice(this.previousSelectedItems.indexOf(focusElementId) + 1, this.previousSelectedItems.length);
|
|
1731
|
-
this.previousSelectedItems = selectedElement1.concat(selectedElement2);
|
|
1732
|
-
}
|
|
1733
|
-
}
|
|
1734
|
-
}
|
|
1735
|
-
}
|
|
1736
1648
|
}
|
|
1737
1649
|
removeElement(element) {
|
|
1738
1650
|
return element && element.parentNode && element.parentNode.removeChild(element);
|
|
@@ -2218,14 +2130,14 @@ let ListView = class ListView extends Component {
|
|
|
2218
2130
|
setViewDataSource(dataSource = this.localData) {
|
|
2219
2131
|
if (dataSource && this.fields.groupBy) {
|
|
2220
2132
|
if (this.sortOrder !== 'None') {
|
|
2221
|
-
this.curViewDS = ListBase.groupDataSource(ListBase.getDataSource(dataSource, ListBase.addSorting(this.sortOrder, this.fields.sortBy)), this.listBaseOption.fields, this.sortOrder);
|
|
2133
|
+
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);
|
|
2222
2134
|
}
|
|
2223
2135
|
else {
|
|
2224
2136
|
this.curViewDS = ListBase.groupDataSource(dataSource, this.listBaseOption.fields, this.sortOrder);
|
|
2225
2137
|
}
|
|
2226
2138
|
}
|
|
2227
2139
|
else if (dataSource && this.sortOrder !== 'None') {
|
|
2228
|
-
this.curViewDS = ListBase.getDataSource(dataSource, ListBase.addSorting(this.sortOrder, this.fields.sortBy));
|
|
2140
|
+
this.curViewDS = ListBase.getDataSource(dataSource, ListBase.addSorting(this.sortOrder, (isNullOrUndefined(this.fields.sortBy)) ? this.fields.text : this.fields.sortBy));
|
|
2229
2141
|
}
|
|
2230
2142
|
else {
|
|
2231
2143
|
this.curViewDS = dataSource;
|
|
@@ -2234,27 +2146,44 @@ let ListView = class ListView extends Component {
|
|
|
2234
2146
|
isInAnimation() {
|
|
2235
2147
|
return this.curUL.classList.contains('.e-animate');
|
|
2236
2148
|
}
|
|
2149
|
+
renderRemoteLists(e, listViewComponent) {
|
|
2150
|
+
if (this.isDestroyed) {
|
|
2151
|
+
return;
|
|
2152
|
+
}
|
|
2153
|
+
this.localData = e.result;
|
|
2154
|
+
listViewComponent.removeElement(listViewComponent.contentContainer);
|
|
2155
|
+
this.renderList();
|
|
2156
|
+
this.trigger('actionComplete', e);
|
|
2157
|
+
}
|
|
2158
|
+
triggerActionFailure(e) {
|
|
2159
|
+
if (this.isDestroyed) {
|
|
2160
|
+
return;
|
|
2161
|
+
}
|
|
2162
|
+
this.trigger('actionFailure', e);
|
|
2163
|
+
}
|
|
2237
2164
|
setLocalData() {
|
|
2238
2165
|
this.trigger('actionBegin');
|
|
2239
2166
|
// eslint-disable-next-line
|
|
2240
2167
|
const listViewComponent = this;
|
|
2241
2168
|
if (this.dataSource instanceof DataManager) {
|
|
2242
|
-
this.dataSource.
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
}
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
}
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2169
|
+
if (this.dataSource.ready) {
|
|
2170
|
+
this.dataSource.ready.then((e) => {
|
|
2171
|
+
/* eslint-disable */
|
|
2172
|
+
this.isOffline = this.dataSource.dataSource.offline;
|
|
2173
|
+
if (this.dataSource instanceof DataManager && this.isOffline) {
|
|
2174
|
+
this.renderRemoteLists(e, listViewComponent);
|
|
2175
|
+
}
|
|
2176
|
+
}).catch((e) => {
|
|
2177
|
+
this.triggerActionFailure(e);
|
|
2178
|
+
});
|
|
2179
|
+
}
|
|
2180
|
+
else {
|
|
2181
|
+
this.dataSource.executeQuery(this.getQuery()).then((e) => {
|
|
2182
|
+
this.renderRemoteLists(e, listViewComponent);
|
|
2183
|
+
}).catch((e) => {
|
|
2184
|
+
this.triggerActionFailure(e);
|
|
2185
|
+
});
|
|
2186
|
+
}
|
|
2258
2187
|
}
|
|
2259
2188
|
else if (!this.dataSource || !this.dataSource.length) {
|
|
2260
2189
|
const ul = this.element.querySelector('ul');
|
|
@@ -2273,25 +2202,21 @@ let ListView = class ListView extends Component {
|
|
|
2273
2202
|
}
|
|
2274
2203
|
}
|
|
2275
2204
|
reRender() {
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
if (Object.keys(window).indexOf('ejsInterop') === -1) {
|
|
2286
|
-
this.element.innerHTML = '';
|
|
2287
|
-
}
|
|
2288
|
-
this.headerEle = this.ulElement = this.liCollection = undefined;
|
|
2289
|
-
this.header();
|
|
2205
|
+
this.removeElement(this.headerEle);
|
|
2206
|
+
this.removeElement(this.ulElement);
|
|
2207
|
+
this.removeElement(this.contentContainer);
|
|
2208
|
+
// eslint-disable-next-line
|
|
2209
|
+
if (this.isReact) {
|
|
2210
|
+
this.clearTemplate();
|
|
2211
|
+
}
|
|
2212
|
+
if (Object.keys(window).indexOf('ejsInterop') === -1) {
|
|
2213
|
+
this.element.innerHTML = '';
|
|
2290
2214
|
}
|
|
2215
|
+
this.headerEle = this.ulElement = this.liCollection = undefined;
|
|
2216
|
+
this.header();
|
|
2291
2217
|
this.setLocalData();
|
|
2292
2218
|
}
|
|
2293
2219
|
resetCurrentList() {
|
|
2294
|
-
this.resetBlazorTemplates();
|
|
2295
2220
|
this.setViewDataSource(this.curViewDS);
|
|
2296
2221
|
this.contentContainer.innerHTML = '';
|
|
2297
2222
|
this.createList();
|
|
@@ -2313,33 +2238,6 @@ let ListView = class ListView extends Component {
|
|
|
2313
2238
|
this.ulElement = this.curUL = ListBase.createList(this.createElement, this.curViewDS, this.listBaseOption, null, this);
|
|
2314
2239
|
this.liCollection = this.curUL.querySelectorAll('.' + classNames.listItem);
|
|
2315
2240
|
this.setAttributes(this.liCollection);
|
|
2316
|
-
this.updateBlazorTemplates(true);
|
|
2317
|
-
}
|
|
2318
|
-
resetBlazorTemplates() {
|
|
2319
|
-
// eslint-disable-next-line
|
|
2320
|
-
const templateCollection = blazorTemplates;
|
|
2321
|
-
if (this.template) {
|
|
2322
|
-
templateCollection[this.LISTVIEW_TEMPLATE_ID] = [];
|
|
2323
|
-
resetBlazorTemplate(this.LISTVIEW_TEMPLATE_ID, LISTVIEW_TEMPLATE_PROPERTY);
|
|
2324
|
-
}
|
|
2325
|
-
if (this.groupTemplate) {
|
|
2326
|
-
templateCollection[this.LISTVIEW_GROUPTEMPLATE_ID] = [];
|
|
2327
|
-
resetBlazorTemplate(this.LISTVIEW_GROUPTEMPLATE_ID, LISTVIEW_GROUPTEMPLATE_PROPERTY);
|
|
2328
|
-
}
|
|
2329
|
-
if (this.headerTemplate) {
|
|
2330
|
-
resetBlazorTemplate(this.LISTVIEW_HEADERTEMPLATE_ID, LISTVIEW_HEADERTEMPLATE_PROPERTY);
|
|
2331
|
-
}
|
|
2332
|
-
}
|
|
2333
|
-
updateBlazorTemplates(template = false, headerTemplate = false, resetExistingElements = false) {
|
|
2334
|
-
if (this.template && template && !this.enableVirtualization) {
|
|
2335
|
-
updateBlazorTemplate(this.LISTVIEW_TEMPLATE_ID, LISTVIEW_TEMPLATE_PROPERTY, this, resetExistingElements);
|
|
2336
|
-
}
|
|
2337
|
-
if (this.groupTemplate && template && !this.enableVirtualization) {
|
|
2338
|
-
updateBlazorTemplate(this.LISTVIEW_GROUPTEMPLATE_ID, LISTVIEW_GROUPTEMPLATE_PROPERTY, this, resetExistingElements);
|
|
2339
|
-
}
|
|
2340
|
-
if (this.headerTemplate && headerTemplate) {
|
|
2341
|
-
updateBlazorTemplate(this.LISTVIEW_HEADERTEMPLATE_ID, LISTVIEW_HEADERTEMPLATE_PROPERTY, this, resetExistingElements);
|
|
2342
|
-
}
|
|
2343
2241
|
}
|
|
2344
2242
|
exceptionEvent(e) {
|
|
2345
2243
|
this.trigger('actionFailure', e);
|
|
@@ -2351,97 +2249,6 @@ let ListView = class ListView extends Component {
|
|
|
2351
2249
|
this.liCollection = this.curUL.querySelectorAll('.' + classNames.listItem);
|
|
2352
2250
|
}
|
|
2353
2251
|
}
|
|
2354
|
-
removeActiveClass() {
|
|
2355
|
-
// eslint-disable-next-line
|
|
2356
|
-
const listViewComponent = this;
|
|
2357
|
-
setTimeout(() => {
|
|
2358
|
-
const ulContainer = listViewComponent.element.querySelector('.' + classNames.virtualElementContainer);
|
|
2359
|
-
for (let i = 0; i < ulContainer.childElementCount; i++) {
|
|
2360
|
-
const selectedElement = ulContainer.children[i];
|
|
2361
|
-
let elementIndex;
|
|
2362
|
-
let hiddenElementIndex;
|
|
2363
|
-
if (listViewComponent.showCheckBox) {
|
|
2364
|
-
if (listViewComponent.previousSelectedItems.length > 0) {
|
|
2365
|
-
for (let j = 0; j < listViewComponent.previousSelectedItems.length; j++) {
|
|
2366
|
-
if (selectedElement.getAttribute('data-uid') === listViewComponent.previousSelectedItems[j]) {
|
|
2367
|
-
selectedElement.classList.add('e-active');
|
|
2368
|
-
selectedElement.setAttribute('aria-selected', 'true');
|
|
2369
|
-
if (selectedElement.querySelector('.e-frame.e-icons')) {
|
|
2370
|
-
selectedElement.querySelector('.e-frame.e-icons').classList.add('e-check');
|
|
2371
|
-
}
|
|
2372
|
-
elementIndex = i;
|
|
2373
|
-
}
|
|
2374
|
-
else {
|
|
2375
|
-
if (elementIndex !== i) {
|
|
2376
|
-
selectedElement.classList.remove('e-active');
|
|
2377
|
-
selectedElement.removeAttribute('aria-selected');
|
|
2378
|
-
if (selectedElement.querySelector('.e-check')) {
|
|
2379
|
-
selectedElement.querySelector('.e-check').classList.remove('e-check');
|
|
2380
|
-
}
|
|
2381
|
-
}
|
|
2382
|
-
}
|
|
2383
|
-
}
|
|
2384
|
-
}
|
|
2385
|
-
else {
|
|
2386
|
-
selectedElement.classList.remove('e-active');
|
|
2387
|
-
selectedElement.removeAttribute('aria-selected');
|
|
2388
|
-
if (selectedElement.querySelector('.e-check')) {
|
|
2389
|
-
selectedElement.querySelector('.e-check').classList.remove('e-check');
|
|
2390
|
-
}
|
|
2391
|
-
}
|
|
2392
|
-
}
|
|
2393
|
-
else {
|
|
2394
|
-
if (selectedElement.getAttribute('data-uid') === listViewComponent.previousSelectedItems[0]) {
|
|
2395
|
-
selectedElement.classList.add('e-active');
|
|
2396
|
-
selectedElement.setAttribute('aria-selected', 'true');
|
|
2397
|
-
}
|
|
2398
|
-
else {
|
|
2399
|
-
selectedElement.classList.remove('e-active');
|
|
2400
|
-
selectedElement.removeAttribute('aria-selected');
|
|
2401
|
-
}
|
|
2402
|
-
}
|
|
2403
|
-
if (listViewComponent.hiddenItems.length > 0) {
|
|
2404
|
-
for (let k = 0; k < listViewComponent.hiddenItems.length; k++) {
|
|
2405
|
-
if (selectedElement.getAttribute('data-uid') === listViewComponent.previousSelectedItems[k]) {
|
|
2406
|
-
selectedElement.style.display = 'none';
|
|
2407
|
-
hiddenElementIndex = i;
|
|
2408
|
-
}
|
|
2409
|
-
else {
|
|
2410
|
-
if (hiddenElementIndex !== i) {
|
|
2411
|
-
selectedElement.style.display = null;
|
|
2412
|
-
}
|
|
2413
|
-
}
|
|
2414
|
-
}
|
|
2415
|
-
}
|
|
2416
|
-
if (listViewComponent.enabledItems.length > 0) {
|
|
2417
|
-
for (let x = 0; x < listViewComponent.enabledItems.length; x++) {
|
|
2418
|
-
if (selectedElement.getAttribute('data-uid') === listViewComponent.enabledItems[x]) {
|
|
2419
|
-
if (selectedElement.classList.contains('e-disabled')) {
|
|
2420
|
-
selectedElement.classList.remove('e-disabled');
|
|
2421
|
-
}
|
|
2422
|
-
}
|
|
2423
|
-
}
|
|
2424
|
-
}
|
|
2425
|
-
if (listViewComponent.disabledItems.length > 0) {
|
|
2426
|
-
for (let y = 0; y < listViewComponent.disabledItems.length; y++) {
|
|
2427
|
-
if (selectedElement.getAttribute('data-uid') === listViewComponent.disabledItems[y]) {
|
|
2428
|
-
if (!selectedElement.classList.contains('e-disabled')) {
|
|
2429
|
-
selectedElement.classList.add('e-disabled');
|
|
2430
|
-
}
|
|
2431
|
-
}
|
|
2432
|
-
}
|
|
2433
|
-
}
|
|
2434
|
-
}
|
|
2435
|
-
}, 200);
|
|
2436
|
-
}
|
|
2437
|
-
renderingNestedList() {
|
|
2438
|
-
const ul = closest(this.liElement.parentNode, '.' + classNames.parentItem);
|
|
2439
|
-
const ctrlId = this.element.id;
|
|
2440
|
-
const ulElement = document.getElementById(ctrlId);
|
|
2441
|
-
const currentListItem = ulElement.getElementsByTagName('UL')[ulElement.getElementsByTagName('UL').length - 1];
|
|
2442
|
-
this.switchView(ul, currentListItem);
|
|
2443
|
-
this.liElement = null;
|
|
2444
|
-
}
|
|
2445
2252
|
renderSubList(li) {
|
|
2446
2253
|
this.liElement = li;
|
|
2447
2254
|
const uID = li.getAttribute('data-uid');
|
|
@@ -2452,27 +2259,18 @@ let ListView = class ListView extends Component {
|
|
|
2452
2259
|
this.setViewDataSource(this.getSubDS());
|
|
2453
2260
|
if (!ele) {
|
|
2454
2261
|
const data = this.curViewDS;
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
else {
|
|
2460
|
-
ele = ListBase.createListFromJson(this.createElement, data, this.listBaseOption, this.curDSLevel.length, null, this);
|
|
2461
|
-
// eslint-disable-next-line
|
|
2462
|
-
if (this.isReact) {
|
|
2463
|
-
this.renderReactTemplates();
|
|
2464
|
-
}
|
|
2465
|
-
const lists = ele.querySelectorAll('.' + classNames.listItem);
|
|
2466
|
-
this.setAttributes(lists);
|
|
2467
|
-
ele.setAttribute('pID', uID);
|
|
2468
|
-
ele.style.display = 'none';
|
|
2469
|
-
this.renderIntoDom(ele);
|
|
2470
|
-
this.updateBlazorTemplates(true);
|
|
2262
|
+
ele = ListBase.createListFromJson(this.createElement, data, this.listBaseOption, this.curDSLevel.length, null, this);
|
|
2263
|
+
// eslint-disable-next-line
|
|
2264
|
+
if (this.isReact) {
|
|
2265
|
+
this.renderReactTemplates();
|
|
2471
2266
|
}
|
|
2267
|
+
const lists = ele.querySelectorAll('.' + classNames.listItem);
|
|
2268
|
+
this.setAttributes(lists);
|
|
2269
|
+
ele.setAttribute('pID', uID);
|
|
2270
|
+
ele.style.display = 'none';
|
|
2271
|
+
this.renderIntoDom(ele);
|
|
2472
2272
|
}
|
|
2473
|
-
|
|
2474
|
-
this.switchView(ul, ele);
|
|
2475
|
-
}
|
|
2273
|
+
this.switchView(ul, ele);
|
|
2476
2274
|
this.liCollection = this.curUL.querySelectorAll('.' + classNames.listItem);
|
|
2477
2275
|
if (this.selectedItems) {
|
|
2478
2276
|
const fieldData = getFieldValues(this.selectedItems.data, this.listBaseOption.fields);
|
|
@@ -2487,38 +2285,34 @@ let ListView = class ListView extends Component {
|
|
|
2487
2285
|
}
|
|
2488
2286
|
renderList(data) {
|
|
2489
2287
|
this.setViewDataSource(data);
|
|
2490
|
-
if (
|
|
2491
|
-
if (this.
|
|
2492
|
-
if (
|
|
2493
|
-
if (
|
|
2494
|
-
if (
|
|
2495
|
-
|
|
2496
|
-
if (typeof this.template == "string") {
|
|
2497
|
-
this.listBaseOption.template = null;
|
|
2498
|
-
}
|
|
2499
|
-
if (typeof this.groupTemplate == "string") {
|
|
2500
|
-
this.listBaseOption.groupTemplate = null;
|
|
2501
|
-
}
|
|
2502
|
-
}
|
|
2503
|
-
else {
|
|
2504
|
-
this.listBaseOption.template = null;
|
|
2505
|
-
this.listBaseOption.groupTemplate = null;
|
|
2506
|
-
}
|
|
2507
|
-
this.listBaseOption.itemCreated = this.virtualizationModule.createUIItem.bind(this.virtualizationModule);
|
|
2288
|
+
if (this.enableVirtualization) {
|
|
2289
|
+
if (Object.keys(this.dataSource).length) {
|
|
2290
|
+
if ((this.template || this.groupTemplate) && !this.virtualizationModule.isNgTemplate()) {
|
|
2291
|
+
if (this.isReact) {
|
|
2292
|
+
if (typeof this.template == "string") {
|
|
2293
|
+
this.listBaseOption.template = null;
|
|
2508
2294
|
}
|
|
2295
|
+
if (typeof this.groupTemplate == "string") {
|
|
2296
|
+
this.listBaseOption.groupTemplate = null;
|
|
2297
|
+
}
|
|
2298
|
+
}
|
|
2299
|
+
else {
|
|
2300
|
+
this.listBaseOption.template = null;
|
|
2301
|
+
this.listBaseOption.groupTemplate = null;
|
|
2509
2302
|
}
|
|
2303
|
+
this.listBaseOption.itemCreated = this.virtualizationModule.createUIItem.bind(this.virtualizationModule);
|
|
2510
2304
|
}
|
|
2511
|
-
this.virtualizationModule.uiVirtualization();
|
|
2512
2305
|
}
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2306
|
+
this.virtualizationModule.uiVirtualization();
|
|
2307
|
+
}
|
|
2308
|
+
else {
|
|
2309
|
+
this.createList();
|
|
2310
|
+
this.contentContainer = this.createElement('div', { className: classNames.content });
|
|
2311
|
+
this.element.appendChild(this.contentContainer);
|
|
2312
|
+
this.renderIntoDom(this.ulElement);
|
|
2313
|
+
// eslint-disable-next-line
|
|
2314
|
+
if (this.isReact) {
|
|
2315
|
+
this.renderReactTemplates();
|
|
2522
2316
|
}
|
|
2523
2317
|
}
|
|
2524
2318
|
}
|
|
@@ -2537,42 +2331,25 @@ let ListView = class ListView extends Component {
|
|
|
2537
2331
|
* Initializes the ListView component rendering.
|
|
2538
2332
|
*/
|
|
2539
2333
|
render() {
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
this.setHTMLAttribute();
|
|
2551
|
-
}
|
|
2552
|
-
else {
|
|
2553
|
-
this.initBlazor(true);
|
|
2554
|
-
}
|
|
2334
|
+
this.element.classList.add(classNames.root);
|
|
2335
|
+
attributes(this.element, { role: 'list', tabindex: '0' });
|
|
2336
|
+
this.setCSSClass();
|
|
2337
|
+
this.setEnableRTL();
|
|
2338
|
+
this.setEnable();
|
|
2339
|
+
this.setSize();
|
|
2340
|
+
this.wireEvents();
|
|
2341
|
+
this.header();
|
|
2342
|
+
this.setLocalData();
|
|
2343
|
+
this.setHTMLAttribute();
|
|
2555
2344
|
this.rippleFn = rippleEffect(this.element, {
|
|
2556
2345
|
selector: '.' + classNames.listItem
|
|
2557
2346
|
});
|
|
2558
2347
|
this.renderComplete();
|
|
2559
2348
|
}
|
|
2560
|
-
initBlazor(firstRender) {
|
|
2561
|
-
if (firstRender === null) {
|
|
2562
|
-
firstRender = false;
|
|
2563
|
-
}
|
|
2564
|
-
this.setLocalData();
|
|
2565
|
-
this.setViewDataSource(this.localData);
|
|
2566
|
-
this.contentContainer = this.element.querySelector('.' + classNames.content);
|
|
2567
|
-
if (firstRender) {
|
|
2568
|
-
this.wireEvents();
|
|
2569
|
-
}
|
|
2570
|
-
}
|
|
2571
2349
|
/**
|
|
2572
2350
|
* It is used to destroy the ListView component.
|
|
2573
2351
|
*/
|
|
2574
2352
|
destroy() {
|
|
2575
|
-
this.resetBlazorTemplates();
|
|
2576
2353
|
// eslint-disable-next-line
|
|
2577
2354
|
if (this.isReact) {
|
|
2578
2355
|
this.clearTemplate();
|
|
@@ -2584,13 +2361,8 @@ let ListView = class ListView extends Component {
|
|
|
2584
2361
|
this.element.removeAttribute('role');
|
|
2585
2362
|
this.element.removeAttribute('tabindex');
|
|
2586
2363
|
this.curUL = this.ulElement = this.liCollection = this.headerEle = undefined;
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
super.destroy();
|
|
2590
|
-
}
|
|
2591
|
-
else {
|
|
2592
|
-
this.element.style.display = 'none';
|
|
2593
|
-
}
|
|
2364
|
+
this.element.innerHTML = '';
|
|
2365
|
+
super.destroy();
|
|
2594
2366
|
}
|
|
2595
2367
|
/**
|
|
2596
2368
|
* Switches back from the navigated sub list item.
|
|
@@ -2610,12 +2382,7 @@ let ListView = class ListView extends Component {
|
|
|
2610
2382
|
toUL = this.curUL;
|
|
2611
2383
|
}
|
|
2612
2384
|
else {
|
|
2613
|
-
|
|
2614
|
-
toUL = toUL.parentElement.parentElement.parentElement;
|
|
2615
|
-
}
|
|
2616
|
-
else {
|
|
2617
|
-
toUL = toUL.parentElement;
|
|
2618
|
-
}
|
|
2385
|
+
toUL = toUL.parentElement;
|
|
2619
2386
|
}
|
|
2620
2387
|
const fieldData = getFieldValues(this.curDSJSON, this.listBaseOption.fields);
|
|
2621
2388
|
// eslint-disable-next-line
|
|
@@ -2733,7 +2500,6 @@ let ListView = class ListView extends Component {
|
|
|
2733
2500
|
/**
|
|
2734
2501
|
* Gets the details of the currently selected item from the list items.
|
|
2735
2502
|
*
|
|
2736
|
-
* @blazorType ListSelectedItem<TValue>
|
|
2737
2503
|
*/
|
|
2738
2504
|
getSelectedItems() {
|
|
2739
2505
|
// eslint-disable-next-line
|
|
@@ -2821,55 +2587,12 @@ let ListView = class ListView extends Component {
|
|
|
2821
2587
|
}
|
|
2822
2588
|
}
|
|
2823
2589
|
}
|
|
2824
|
-
|
|
2825
|
-
// eslint-disable-next-line
|
|
2826
|
-
return this.blazorGetSelectedItems(finalValue);
|
|
2827
|
-
}
|
|
2828
|
-
else {
|
|
2829
|
-
return finalValue;
|
|
2830
|
-
}
|
|
2831
|
-
}
|
|
2832
|
-
// eslint-disable-next-line
|
|
2833
|
-
blazorGetSelectedItems(finalGetSelectedItem) {
|
|
2834
|
-
const blazorSelectedItem = {
|
|
2835
|
-
data: [],
|
|
2836
|
-
index: [],
|
|
2837
|
-
parentId: [],
|
|
2838
|
-
text: []
|
|
2839
|
-
};
|
|
2840
|
-
if (!isNullOrUndefined(finalGetSelectedItem)) {
|
|
2841
|
-
if (!isNullOrUndefined(finalGetSelectedItem.data)) {
|
|
2842
|
-
if (this.showCheckBox && this.isNestedList) {
|
|
2843
|
-
for (let i = 0; i < finalGetSelectedItem.data.length; i++) {
|
|
2844
|
-
blazorSelectedItem.data.push(finalGetSelectedItem.data[i].data);
|
|
2845
|
-
}
|
|
2846
|
-
if (!isNullOrUndefined(finalGetSelectedItem.data[0])
|
|
2847
|
-
&& !isNullOrUndefined(finalGetSelectedItem.data[0].parentId)) {
|
|
2848
|
-
blazorSelectedItem.parentId = finalGetSelectedItem.data[0].parentId;
|
|
2849
|
-
}
|
|
2850
|
-
}
|
|
2851
|
-
else {
|
|
2852
|
-
blazorSelectedItem.data = this.convertItemsToArray(finalGetSelectedItem.data);
|
|
2853
|
-
}
|
|
2854
|
-
}
|
|
2855
|
-
if (!isNullOrUndefined(finalGetSelectedItem.text)) {
|
|
2856
|
-
blazorSelectedItem.text = this.convertItemsToArray(finalGetSelectedItem.text);
|
|
2857
|
-
}
|
|
2858
|
-
if (!isNullOrUndefined(finalGetSelectedItem.index)) {
|
|
2859
|
-
blazorSelectedItem.index = this.convertItemsToArray(finalGetSelectedItem.index);
|
|
2860
|
-
}
|
|
2861
|
-
}
|
|
2862
|
-
return blazorSelectedItem;
|
|
2863
|
-
}
|
|
2864
|
-
// eslint-disable-next-line
|
|
2865
|
-
convertItemsToArray(items) {
|
|
2866
|
-
return Array.isArray(items) ? [...items] : [items];
|
|
2590
|
+
return finalValue;
|
|
2867
2591
|
}
|
|
2868
2592
|
/**
|
|
2869
2593
|
* Finds out an item details from the current list.
|
|
2870
2594
|
*
|
|
2871
2595
|
* @param {Fields | HTMLElement | Element} item - We can pass element Object or Fields as Object with ID and Text fields.
|
|
2872
|
-
* @blazorType TValue
|
|
2873
2596
|
*/
|
|
2874
2597
|
findItem(item) {
|
|
2875
2598
|
return this.getItemData(item);
|
|
@@ -2966,7 +2689,6 @@ let ListView = class ListView extends Component {
|
|
|
2966
2689
|
*
|
|
2967
2690
|
* @param {Fields} fields - Target item to add the given data as its children (can be null).
|
|
2968
2691
|
*
|
|
2969
|
-
* @blazorType data|object,fields|object
|
|
2970
2692
|
*/
|
|
2971
2693
|
addItem(data, fields = undefined) {
|
|
2972
2694
|
const dataSource = this.dataSource instanceof DataManager
|
|
@@ -3008,9 +2730,6 @@ let ListView = class ListView extends Component {
|
|
|
3008
2730
|
this.reRender();
|
|
3009
2731
|
}
|
|
3010
2732
|
}
|
|
3011
|
-
if (this.curUL) {
|
|
3012
|
-
this.updateBlazorTemplates(true);
|
|
3013
|
-
}
|
|
3014
2733
|
this.liCollection = this.curUL.querySelectorAll('.' + classNames.listItem);
|
|
3015
2734
|
}
|
|
3016
2735
|
else {
|
|
@@ -3036,15 +2755,12 @@ let ListView = class ListView extends Component {
|
|
|
3036
2755
|
: null;
|
|
3037
2756
|
const targetDS = isAlreadyRenderedUL ? targetChildDS : [targetItemData];
|
|
3038
2757
|
const isTargetEmptyChild = targetLi ? !targetLi.classList.contains(classNames.hasChild) : false;
|
|
3039
|
-
let isRefreshTemplateNeeded = false;
|
|
3040
|
-
// if li element is already rendered, that element needs to be refreshed so that
|
|
3041
|
-
// it becomes child viewable due to new child items are added now
|
|
3042
2758
|
if (isTargetEmptyChild) {
|
|
3043
2759
|
const targetRefreshedElement = ListBase.createListItemFromJson(this.createElement, targetDS, this.listBaseOption, null, null, this);
|
|
3044
2760
|
this.setAttributes(targetRefreshedElement);
|
|
3045
2761
|
targetUL.insertBefore(targetRefreshedElement[0], targetLi);
|
|
3046
2762
|
detach(targetLi);
|
|
3047
|
-
|
|
2763
|
+
|
|
3048
2764
|
}
|
|
3049
2765
|
// if it is already rendered element, we need to create and append new elements
|
|
3050
2766
|
if (isAlreadyRenderedUL && itemQueue) {
|
|
@@ -3052,10 +2768,7 @@ let ListView = class ListView extends Component {
|
|
|
3052
2768
|
targetDS.push(itemQueue[i]);
|
|
3053
2769
|
this.addItemIntoDom(itemQueue[i], targetUL, targetDS);
|
|
3054
2770
|
}
|
|
3055
|
-
|
|
3056
|
-
}
|
|
3057
|
-
if (isRefreshTemplateNeeded) {
|
|
3058
|
-
this.updateBlazorTemplates(true);
|
|
2771
|
+
|
|
3059
2772
|
}
|
|
3060
2773
|
}
|
|
3061
2774
|
addItemIntoDom(currentItem, targetUL, curViewDS) {
|
|
@@ -3097,7 +2810,6 @@ let ListView = class ListView extends Component {
|
|
|
3097
2810
|
}
|
|
3098
2811
|
else {
|
|
3099
2812
|
this.removeItemFromList(item, listDataSource);
|
|
3100
|
-
this.updateBlazorTemplates(true);
|
|
3101
2813
|
}
|
|
3102
2814
|
}
|
|
3103
2815
|
removeItemFromList(obj, listDataSource) {
|
|
@@ -3174,7 +2886,6 @@ let ListView = class ListView extends Component {
|
|
|
3174
2886
|
for (let i = 0; i < item.length; i++) {
|
|
3175
2887
|
this.removeItem(item[i]);
|
|
3176
2888
|
}
|
|
3177
|
-
this.updateBlazorTemplates(true);
|
|
3178
2889
|
}
|
|
3179
2890
|
}
|
|
3180
2891
|
// eslint-disable-next-line
|
|
@@ -3318,66 +3029,43 @@ class Virtualization {
|
|
|
3318
3029
|
this.wireScrollEvent(false);
|
|
3319
3030
|
const curViewDS = this.listViewInstance.curViewDS;
|
|
3320
3031
|
const firstDs = curViewDS.slice(0, 1);
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
|
|
3327
|
-
this.listViewInstance.contentContainer.appendChild(this.listViewInstance.ulElement);
|
|
3328
|
-
}
|
|
3032
|
+
this.listViewInstance.ulElement = this.listViewInstance.curUL = ListBase.createList(
|
|
3033
|
+
// eslint-disable-next-line
|
|
3034
|
+
this.listViewInstance.createElement, firstDs, this.listViewInstance.listBaseOption, null, this.listViewInstance);
|
|
3035
|
+
this.listViewInstance.contentContainer = this.listViewInstance.createElement('div', { className: classNames.content });
|
|
3036
|
+
this.listViewInstance.element.appendChild(this.listViewInstance.contentContainer);
|
|
3037
|
+
this.listViewInstance.contentContainer.appendChild(this.listViewInstance.ulElement);
|
|
3329
3038
|
this.listItemHeight = this.listViewInstance.ulElement.firstElementChild.getBoundingClientRect().height;
|
|
3330
3039
|
this.expectedDomItemCount = this.ValidateItemCount(10000);
|
|
3331
3040
|
this.domItemCount = this.ValidateItemCount(Object.keys(this.listViewInstance.curViewDS).length);
|
|
3332
3041
|
this.uiFirstIndex = 0;
|
|
3333
3042
|
this.uiLastIndex = this.domItemCount - 1;
|
|
3334
3043
|
const otherDs = curViewDS.slice(1, this.domItemCount);
|
|
3335
|
-
|
|
3336
|
-
|
|
3337
|
-
|
|
3338
|
-
|
|
3339
|
-
|
|
3340
|
-
|
|
3341
|
-
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
this.bottomElementHeight = this.totalHeight;
|
|
3350
|
-
}
|
|
3351
|
-
else {
|
|
3352
|
-
this.listViewInstance.contentContainer = this.listViewInstance.element.querySelector('.e-content');
|
|
3353
|
-
this.listViewInstance.liCollection = this.listViewInstance.curUL.querySelectorAll('li');
|
|
3354
|
-
}
|
|
3044
|
+
const listItems = ListBase.createListItemFromJson(
|
|
3045
|
+
// eslint-disable-next-line
|
|
3046
|
+
this.listViewInstance.createElement, otherDs, this.listViewInstance.listBaseOption, null, null, this.listViewInstance);
|
|
3047
|
+
append(listItems, this.listViewInstance.ulElement);
|
|
3048
|
+
this.listViewInstance.liCollection = this.listViewInstance.curUL.querySelectorAll('li');
|
|
3049
|
+
this.topElement = this.listViewInstance.createElement('div');
|
|
3050
|
+
this.listViewInstance.ulElement.insertBefore(this.topElement, this.listViewInstance.ulElement.firstElementChild);
|
|
3051
|
+
this.bottomElement = this.listViewInstance.createElement('div');
|
|
3052
|
+
this.listViewInstance.ulElement.insertBefore(this.bottomElement, null);
|
|
3053
|
+
this.totalHeight = (Object.keys(curViewDS).length * this.listItemHeight) - (this.domItemCount * this.listItemHeight);
|
|
3054
|
+
this.topElement.style.height = 0 + 'px';
|
|
3055
|
+
this.bottomElement.style.height = this.totalHeight + 'px';
|
|
3056
|
+
this.topElementHeight = 0;
|
|
3057
|
+
this.bottomElementHeight = this.totalHeight;
|
|
3355
3058
|
this.listDiff = 0;
|
|
3356
3059
|
this.uiIndicesInitialization();
|
|
3357
3060
|
}
|
|
3358
3061
|
wireScrollEvent(destroy) {
|
|
3359
3062
|
if (!destroy) {
|
|
3360
|
-
if (
|
|
3361
|
-
|
|
3362
|
-
|
|
3363
|
-
window.addEventListener('scroll', this.onVirtualScroll);
|
|
3364
|
-
}
|
|
3365
|
-
else {
|
|
3366
|
-
EventHandler.add(this.listViewInstance.element, 'scroll', this.onVirtualUiScroll, this);
|
|
3367
|
-
}
|
|
3063
|
+
if (this.listViewInstance.isWindow) {
|
|
3064
|
+
this.onVirtualScroll = this.onVirtualUiScroll.bind(this);
|
|
3065
|
+
window.addEventListener('scroll', this.onVirtualScroll);
|
|
3368
3066
|
}
|
|
3369
3067
|
else {
|
|
3370
|
-
|
|
3371
|
-
// eslint-disable-next-line
|
|
3372
|
-
this.onVirtualScroll = debounce(this.onVirtualUiScroll.bind(this), 350);
|
|
3373
|
-
this.updateUl = this.updateUlContainer.bind(this);
|
|
3374
|
-
window.addEventListener('scroll', this.onVirtualScroll);
|
|
3375
|
-
window.addEventListener('scroll', this.updateUl);
|
|
3376
|
-
}
|
|
3377
|
-
else {
|
|
3378
|
-
EventHandler.add(this.listViewInstance.element, 'scroll', debounce(this.onVirtualUiScroll, 350), this);
|
|
3379
|
-
EventHandler.add(this.listViewInstance.element, 'scroll', this.updateUlContainer, this);
|
|
3380
|
-
}
|
|
3068
|
+
EventHandler.add(this.listViewInstance.element, 'scroll', this.onVirtualUiScroll, this);
|
|
3381
3069
|
}
|
|
3382
3070
|
}
|
|
3383
3071
|
else {
|
|
@@ -3456,16 +3144,10 @@ class Virtualization {
|
|
|
3456
3144
|
refreshItemHeight() {
|
|
3457
3145
|
if (this.listViewInstance.curViewDS.length) {
|
|
3458
3146
|
const curViewDS = this.listViewInstance.curViewDS;
|
|
3459
|
-
|
|
3460
|
-
|
|
3461
|
-
|
|
3462
|
-
|
|
3463
|
-
else {
|
|
3464
|
-
this.listItemHeight = this.topElement.nextSibling.getBoundingClientRect().height;
|
|
3465
|
-
this.totalHeight = (Object.keys(curViewDS).length * this.listItemHeight) - (this.domItemCount * this.listItemHeight);
|
|
3466
|
-
this.bottomElementHeight = this.totalHeight;
|
|
3467
|
-
this.bottomElement.style.height = this.totalHeight + 'px';
|
|
3468
|
-
}
|
|
3147
|
+
this.listItemHeight = this.topElement.nextSibling.getBoundingClientRect().height;
|
|
3148
|
+
this.totalHeight = (Object.keys(curViewDS).length * this.listItemHeight) - (this.domItemCount * this.listItemHeight);
|
|
3149
|
+
this.bottomElementHeight = this.totalHeight;
|
|
3150
|
+
this.bottomElement.style.height = this.totalHeight + 'px';
|
|
3469
3151
|
}
|
|
3470
3152
|
}
|
|
3471
3153
|
getscrollerHeight(startingHeight) {
|
|
@@ -3488,54 +3170,31 @@ class Virtualization {
|
|
|
3488
3170
|
this.bottomElementHeight = this.totalHeight - this.topElementHeight;
|
|
3489
3171
|
[this.topElementHeight, this.bottomElementHeight] = scroll <= this.totalHeight ?
|
|
3490
3172
|
[this.topElementHeight, this.bottomElementHeight] : [this.totalHeight, 0];
|
|
3491
|
-
if (
|
|
3492
|
-
|
|
3493
|
-
|
|
3494
|
-
|
|
3495
|
-
|
|
3496
|
-
|
|
3497
|
-
|
|
3498
|
-
|
|
3499
|
-
|
|
3500
|
-
|
|
3501
|
-
listDiff = Math.round(e.target.scrollTop / this.listViewInstance.liElementHeight);
|
|
3502
|
-
}
|
|
3503
|
-
if ((listDiff - 2) - this.elementDifference >= 3 || (listDiff - 2) - this.elementDifference <= -1) {
|
|
3504
|
-
const args = { listDiff: listDiff - 2, selectedItems: this.listViewInstance.previousSelectedItems };
|
|
3505
|
-
this.listViewInstance.interopAdaptor.invokeMethodAsync('VirtalScrolling', args);
|
|
3506
|
-
if (this.listViewInstance.ulElement.querySelector('.e-focused')) {
|
|
3507
|
-
this.listViewInstance.ulElement.querySelector('.e-focused').classList.remove('e-focused');
|
|
3173
|
+
if (this.topElementHeight !== parseFloat(this.topElement.style.height)) {
|
|
3174
|
+
this.topElement.style.height = this.topElementHeight + 'px';
|
|
3175
|
+
this.bottomElement.style.height = this.bottomElementHeight + 'px';
|
|
3176
|
+
if (scroll > this.scrollPosition) {
|
|
3177
|
+
const listDiff = Math.round(((this.topElementHeight / this.listItemHeight) - this.listDiff));
|
|
3178
|
+
if (listDiff > (this.expectedDomItemCount + 5)) {
|
|
3179
|
+
this.onLongScroll(listDiff, true);
|
|
3180
|
+
}
|
|
3181
|
+
else {
|
|
3182
|
+
this.onNormalScroll(listDiff, true);
|
|
3508
3183
|
}
|
|
3509
|
-
this.elementDifference = listDiff - 2;
|
|
3510
3184
|
}
|
|
3511
|
-
|
|
3512
|
-
|
|
3513
|
-
|
|
3514
|
-
|
|
3515
|
-
this.bottomElement.style.height = this.bottomElementHeight + 'px';
|
|
3516
|
-
if (scroll > this.scrollPosition) {
|
|
3517
|
-
const listDiff = Math.round(((this.topElementHeight / this.listItemHeight) - this.listDiff));
|
|
3518
|
-
if (listDiff > (this.expectedDomItemCount + 5)) {
|
|
3519
|
-
this.onLongScroll(listDiff, true);
|
|
3520
|
-
}
|
|
3521
|
-
else {
|
|
3522
|
-
this.onNormalScroll(listDiff, true);
|
|
3523
|
-
}
|
|
3185
|
+
else {
|
|
3186
|
+
const listDiff = Math.round((this.listDiff - (this.topElementHeight / this.listItemHeight)));
|
|
3187
|
+
if (listDiff > (this.expectedDomItemCount + 5)) {
|
|
3188
|
+
this.onLongScroll(listDiff, false);
|
|
3524
3189
|
}
|
|
3525
3190
|
else {
|
|
3526
|
-
|
|
3527
|
-
if (listDiff > (this.expectedDomItemCount + 5)) {
|
|
3528
|
-
this.onLongScroll(listDiff, false);
|
|
3529
|
-
}
|
|
3530
|
-
else {
|
|
3531
|
-
this.onNormalScroll(listDiff, false);
|
|
3532
|
-
}
|
|
3191
|
+
this.onNormalScroll(listDiff, false);
|
|
3533
3192
|
}
|
|
3534
3193
|
}
|
|
3535
|
-
|
|
3536
|
-
|
|
3537
|
-
|
|
3538
|
-
|
|
3194
|
+
}
|
|
3195
|
+
this.listDiff = Math.round(this.topElementHeight / this.listItemHeight);
|
|
3196
|
+
if (typeof this.listViewInstance.onUIScrolled === 'function') {
|
|
3197
|
+
this.listViewInstance.onUIScrolled();
|
|
3539
3198
|
}
|
|
3540
3199
|
this.scrollPosition = scroll;
|
|
3541
3200
|
}
|
|
@@ -3719,14 +3378,6 @@ class Virtualization {
|
|
|
3719
3378
|
}
|
|
3720
3379
|
}
|
|
3721
3380
|
else {
|
|
3722
|
-
if (isBlazor() && this.listViewInstance.isServerRendered) {
|
|
3723
|
-
let scrollDiff = Math.round(this.listViewInstance.element.scrollTop /
|
|
3724
|
-
this.listViewInstance.liElementHeight) - 2;
|
|
3725
|
-
if (scrollDiff < 0) {
|
|
3726
|
-
scrollDiff = 0;
|
|
3727
|
-
}
|
|
3728
|
-
this.activeIndex += scrollDiff;
|
|
3729
|
-
}
|
|
3730
3381
|
const curViewDS = this.listViewInstance.curViewDS;
|
|
3731
3382
|
const text = this.listViewInstance.fields.text;
|
|
3732
3383
|
if (this.listViewInstance.showCheckBox) {
|
|
@@ -3819,114 +3470,35 @@ class Virtualization {
|
|
|
3819
3470
|
this.listViewInstance.removeSelect();
|
|
3820
3471
|
this.activeIndex = undefined;
|
|
3821
3472
|
}
|
|
3822
|
-
if (isBlazor() && this.listViewInstance.isServerRendered) {
|
|
3823
|
-
// eslint-disable-next-line
|
|
3824
|
-
const elementId = resutJSON.data[this.listViewInstance.fields.id];
|
|
3825
|
-
if (this.listViewInstance.showCheckBox) {
|
|
3826
|
-
if (!this.listViewInstance.previousSelectedItems.includes(elementId)) {
|
|
3827
|
-
this.listViewInstance.previousSelectedItems.push(elementId);
|
|
3828
|
-
}
|
|
3829
|
-
else {
|
|
3830
|
-
const indexPosition = this.listViewInstance.previousSelectedItems.indexOf(elementId);
|
|
3831
|
-
if (indexPosition > -1) {
|
|
3832
|
-
this.listViewInstance.previousSelectedItems.splice(indexPosition, 1);
|
|
3833
|
-
}
|
|
3834
|
-
}
|
|
3835
|
-
}
|
|
3836
|
-
else {
|
|
3837
|
-
this.listViewInstance.previousSelectedItems[0] = elementId;
|
|
3838
|
-
}
|
|
3839
|
-
this.listViewInstance.removeActiveClass();
|
|
3840
|
-
}
|
|
3841
3473
|
}
|
|
3842
3474
|
enableItem(obj) {
|
|
3843
3475
|
const resutJSON = this.findDSAndIndexFromId(this.listViewInstance.curViewDS, obj);
|
|
3844
|
-
if (
|
|
3845
|
-
|
|
3846
|
-
const itemId = resutJSON.data[this.listViewInstance.fields.id];
|
|
3847
|
-
if (!this.listViewInstance.enabledItems.includes(itemId)) {
|
|
3848
|
-
this.listViewInstance.enabledItems.push(itemId);
|
|
3849
|
-
this.listViewInstance.removeActiveClass();
|
|
3850
|
-
}
|
|
3851
|
-
if (this.listViewInstance.disabledItems.includes(itemId)) {
|
|
3852
|
-
const indexPosition = this.listViewInstance.disabledItems.indexOf(itemId);
|
|
3853
|
-
if (indexPosition > -1) {
|
|
3854
|
-
this.listViewInstance.disabledItems.splice(indexPosition, 1);
|
|
3855
|
-
}
|
|
3856
|
-
}
|
|
3857
|
-
}
|
|
3858
|
-
else {
|
|
3859
|
-
if (Object.keys(resutJSON).length) {
|
|
3860
|
-
this.uiIndices.disabledItemIndices.splice(this.uiIndices.disabledItemIndices.indexOf(resutJSON.index), 1);
|
|
3861
|
-
}
|
|
3476
|
+
if (Object.keys(resutJSON).length) {
|
|
3477
|
+
this.uiIndices.disabledItemIndices.splice(this.uiIndices.disabledItemIndices.indexOf(resutJSON.index), 1);
|
|
3862
3478
|
}
|
|
3863
3479
|
}
|
|
3864
3480
|
disableItem(obj) {
|
|
3865
3481
|
const resutJSON = this.findDSAndIndexFromId(this.listViewInstance.curViewDS, obj);
|
|
3866
|
-
if (
|
|
3867
|
-
|
|
3868
|
-
const liElementId = resutJSON.data[this.listViewInstance.fields.id];
|
|
3869
|
-
if (!this.listViewInstance.disabledItems.includes(liElementId)) {
|
|
3870
|
-
this.listViewInstance.disabledItems.push(liElementId);
|
|
3871
|
-
this.listViewInstance.removeActiveClass();
|
|
3872
|
-
}
|
|
3873
|
-
if (this.listViewInstance.enabledItems.includes(liElementId)) {
|
|
3874
|
-
const indexPosition = this.listViewInstance.enabledItems.indexOf(liElementId);
|
|
3875
|
-
if (indexPosition > -1) {
|
|
3876
|
-
this.listViewInstance.enabledItems.splice(indexPosition, 1);
|
|
3877
|
-
}
|
|
3878
|
-
}
|
|
3879
|
-
}
|
|
3880
|
-
else {
|
|
3881
|
-
if (Object.keys(resutJSON).length && this.uiIndices.disabledItemIndices.indexOf(resutJSON.index) === -1) {
|
|
3882
|
-
this.uiIndices.disabledItemIndices.push(resutJSON.index);
|
|
3883
|
-
}
|
|
3482
|
+
if (Object.keys(resutJSON).length && this.uiIndices.disabledItemIndices.indexOf(resutJSON.index) === -1) {
|
|
3483
|
+
this.uiIndices.disabledItemIndices.push(resutJSON.index);
|
|
3884
3484
|
}
|
|
3885
3485
|
}
|
|
3886
3486
|
showItem(obj) {
|
|
3887
3487
|
const resutJSON = this.findDSAndIndexFromId(this.listViewInstance.curViewDS, obj);
|
|
3888
|
-
if (
|
|
3889
|
-
|
|
3890
|
-
const hiddenElementId = resutJSON.data[this.listViewInstance.fields.id];
|
|
3891
|
-
if (this.listViewInstance.hiddenItems.includes(hiddenElementId)) {
|
|
3892
|
-
const indexPosition = this.listViewInstance.hiddenItems.indexOf(hiddenElementId);
|
|
3893
|
-
if (indexPosition > -1) {
|
|
3894
|
-
this.listViewInstance.previousSelectedItems.splice(indexPosition, 1);
|
|
3895
|
-
this.listViewInstance.removeActiveClass();
|
|
3896
|
-
}
|
|
3897
|
-
}
|
|
3898
|
-
}
|
|
3899
|
-
else {
|
|
3900
|
-
if (Object.keys(resutJSON).length) {
|
|
3901
|
-
this.uiIndices.hiddenItemIndices.splice(this.uiIndices.hiddenItemIndices.indexOf(resutJSON.index), 1);
|
|
3902
|
-
}
|
|
3488
|
+
if (Object.keys(resutJSON).length) {
|
|
3489
|
+
this.uiIndices.hiddenItemIndices.splice(this.uiIndices.hiddenItemIndices.indexOf(resutJSON.index), 1);
|
|
3903
3490
|
}
|
|
3904
3491
|
}
|
|
3905
3492
|
hideItem(obj) {
|
|
3906
3493
|
const resutJSON = this.findDSAndIndexFromId(this.listViewInstance.curViewDS, obj);
|
|
3907
|
-
if (
|
|
3908
|
-
|
|
3909
|
-
let elementId = resutJSON.data[this.listViewInstance.fields.id];
|
|
3910
|
-
if (!this.listViewInstance.hiddenItems.includes(elementId)) {
|
|
3911
|
-
this.listViewInstance.hiddenItems.push(elementId);
|
|
3912
|
-
this.listViewInstance.removeActiveClass();
|
|
3913
|
-
}
|
|
3914
|
-
}
|
|
3915
|
-
else {
|
|
3916
|
-
if (Object.keys(resutJSON).length && this.uiIndices.hiddenItemIndices.indexOf(resutJSON.index) === -1) {
|
|
3917
|
-
this.uiIndices.hiddenItemIndices.push(resutJSON.index);
|
|
3918
|
-
}
|
|
3494
|
+
if (Object.keys(resutJSON).length && this.uiIndices.hiddenItemIndices.indexOf(resutJSON.index) === -1) {
|
|
3495
|
+
this.uiIndices.hiddenItemIndices.push(resutJSON.index);
|
|
3919
3496
|
}
|
|
3920
3497
|
}
|
|
3921
3498
|
removeItem(obj) {
|
|
3922
3499
|
let dataSource;
|
|
3923
3500
|
const curViewDS = this.listViewInstance.curViewDS;
|
|
3924
3501
|
const resutJSON = this.findDSAndIndexFromId(curViewDS, obj);
|
|
3925
|
-
if (isBlazor() && this.listViewInstance.isServerRendered) {
|
|
3926
|
-
if (resutJSON.index !== undefined) {
|
|
3927
|
-
this.listViewInstance.interopAdaptor.invokeMethodAsync('RemoveItemPosition', resutJSON.index);
|
|
3928
|
-
}
|
|
3929
|
-
}
|
|
3930
3502
|
if (Object.keys(resutJSON).length) {
|
|
3931
3503
|
dataSource = resutJSON.data;
|
|
3932
3504
|
if (curViewDS[resutJSON.index - 1] &&
|
|
@@ -3937,9 +3509,7 @@ class Virtualization {
|
|
|
3937
3509
|
this.removeUiItem(resutJSON.index - 1);
|
|
3938
3510
|
}
|
|
3939
3511
|
else {
|
|
3940
|
-
|
|
3941
|
-
this.removeUiItem(resutJSON.index);
|
|
3942
|
-
}
|
|
3512
|
+
this.removeUiItem(resutJSON.index);
|
|
3943
3513
|
}
|
|
3944
3514
|
}
|
|
3945
3515
|
const listDataSource = this.listViewInstance.dataSource instanceof DataManager
|
|
@@ -3955,12 +3525,6 @@ class Virtualization {
|
|
|
3955
3525
|
}
|
|
3956
3526
|
// eslint-disable-next-line
|
|
3957
3527
|
setCheckboxLI(li, e) {
|
|
3958
|
-
if (isBlazor() && this.listViewInstance.isServerRendered) {
|
|
3959
|
-
this.uiFirstIndex = Math.round(this.listViewInstance.element.scrollTop / 36) - 4;
|
|
3960
|
-
if (this.uiFirstIndex < 0) {
|
|
3961
|
-
this.uiFirstIndex = 0;
|
|
3962
|
-
}
|
|
3963
|
-
}
|
|
3964
3528
|
const index = Array.prototype.indexOf.call(this.listViewInstance.curUL.querySelectorAll('li'), li) + this.uiFirstIndex;
|
|
3965
3529
|
this.activeIndex = Array.prototype.indexOf.call(this.listViewInstance.curUL.querySelectorAll('li'), li) + this.uiFirstIndex;
|
|
3966
3530
|
if (li.classList.contains(classNames.selected)) {
|
|
@@ -4590,10 +4154,6 @@ let Sortable = Sortable_1 = class Sortable extends Base {
|
|
|
4590
4154
|
element.style.height = `${target.offsetHeight}px`;
|
|
4591
4155
|
}
|
|
4592
4156
|
addClass([element], ['e-sortableclone']);
|
|
4593
|
-
removeClass([element], ['e-listboxtool-container']);
|
|
4594
|
-
if (element && element.className.indexOf("e-listbox-wrapper") < 0) {
|
|
4595
|
-
addClass([element], ['e-listbox-wrapper']);
|
|
4596
|
-
}
|
|
4597
4157
|
document.body.appendChild(element);
|
|
4598
4158
|
return element;
|
|
4599
4159
|
};
|
|
@@ -4706,9 +4266,8 @@ let Sortable = Sortable_1 = class Sortable extends Base {
|
|
|
4706
4266
|
const isPlaceHolderPresent = this.isPlaceHolderPresent(dropInst);
|
|
4707
4267
|
if (isPlaceHolderPresent) {
|
|
4708
4268
|
const curIdx = this.getIndex(dropInst.placeHolderElement, dropInst);
|
|
4709
|
-
let prevIndx = this === dropInst && (prevIdx - curIdx) > 0 ? prevIdx - 1 : prevIdx;
|
|
4710
4269
|
const args = {
|
|
4711
|
-
previousIndex:
|
|
4270
|
+
previousIndex: prevIdx, currentIndex: curIdx, target: e.target, droppedElement: this.target,
|
|
4712
4271
|
helper: e.helper, cancel: false, handled: false
|
|
4713
4272
|
};
|
|
4714
4273
|
this.trigger('beforeDrop', args, (observedArgs) => {
|
|
@@ -4735,8 +4294,7 @@ let Sortable = Sortable_1 = class Sortable extends Base {
|
|
|
4735
4294
|
// eslint-disable-next-line prefer-const
|
|
4736
4295
|
curIdx = dropInst.element.childElementCount;
|
|
4737
4296
|
prevIdx = this.getIndex(this.target);
|
|
4738
|
-
|
|
4739
|
-
if (dropInst.element === target || (!isPlaceHolderPresent && this.curTarget === this.target)) {
|
|
4297
|
+
if (dropInst.element === e.target || (!isPlaceHolderPresent && this.curTarget === this.target)) {
|
|
4740
4298
|
const beforeDropArgs = {
|
|
4741
4299
|
previousIndex: prevIdx, currentIndex: this.curTarget === this.target ? prevIdx : curIdx,
|
|
4742
4300
|
target: e.target, droppedElement: this.target, helper: e.helper, cancel: false
|