@syncfusion/ej2-dropdowns 24.2.9 → 25.1.37
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/CHANGELOG.md +27 -150
- package/dist/ej2-dropdowns.min.js +2 -2
- package/dist/ej2-dropdowns.umd.min.js +2 -2
- package/dist/ej2-dropdowns.umd.min.js.map +1 -1
- package/dist/es6/ej2-dropdowns.es2015.js +2014 -514
- package/dist/es6/ej2-dropdowns.es2015.js.map +1 -1
- package/dist/es6/ej2-dropdowns.es5.js +2030 -513
- package/dist/es6/ej2-dropdowns.es5.js.map +1 -1
- package/dist/global/ej2-dropdowns.min.js +2 -2
- package/dist/global/ej2-dropdowns.min.js.map +1 -1
- package/dist/global/index.d.ts +1 -1
- package/package.json +13 -13
- package/src/auto-complete/auto-complete-model.d.ts +3 -1
- package/src/auto-complete/auto-complete.d.ts +2 -0
- package/src/auto-complete/auto-complete.js +51 -6
- package/src/combo-box/combo-box-model.d.ts +10 -1
- package/src/combo-box/combo-box.d.ts +10 -2
- package/src/combo-box/combo-box.js +55 -23
- package/src/common/interface.d.ts +32 -0
- package/src/common/virtual-scroll.d.ts +1 -3
- package/src/common/virtual-scroll.js +157 -27
- package/src/drop-down-base/drop-down-base-model.d.ts +1 -1
- package/src/drop-down-base/drop-down-base.d.ts +64 -5
- package/src/drop-down-base/drop-down-base.js +241 -24
- package/src/drop-down-list/drop-down-list-model.d.ts +10 -1
- package/src/drop-down-list/drop-down-list.d.ts +16 -50
- package/src/drop-down-list/drop-down-list.js +150 -196
- package/src/drop-down-tree/drop-down-tree-model.d.ts +16 -12
- package/src/drop-down-tree/drop-down-tree.d.ts +13 -3
- package/src/drop-down-tree/drop-down-tree.js +55 -49
- package/src/global.js +1 -1
- package/src/list-box/list-box.js +9 -4
- package/src/mention/mention.d.ts +2 -0
- package/src/mention/mention.js +16 -8
- package/src/multi-select/checkbox-selection.d.ts +2 -0
- package/src/multi-select/checkbox-selection.js +16 -3
- package/src/multi-select/float-label.d.ts +5 -5
- package/src/multi-select/index.d.ts +1 -0
- package/src/multi-select/index.js +1 -0
- package/src/multi-select/interface.d.ts +1 -0
- package/src/multi-select/multi-select-model.d.ts +17 -2
- package/src/multi-select/multi-select.d.ts +35 -4
- package/src/multi-select/multi-select.js +1282 -174
- package/styles/auto-complete/_bds-definition.scss +2 -0
- package/styles/bootstrap-dark.css +7 -1
- package/styles/bootstrap.css +7 -1
- package/styles/bootstrap4.css +2 -1
- package/styles/bootstrap5-dark.css +2 -1
- package/styles/bootstrap5.css +2 -1
- package/styles/combo-box/_bds-definition.scss +2 -0
- package/styles/drop-down-base/_bds-definition.scss +134 -0
- package/styles/drop-down-list/_bds-definition.scss +134 -0
- package/styles/drop-down-list/icons/_bds.scss +14 -0
- package/styles/drop-down-tree/_bds-definition.scss +61 -0
- package/styles/drop-down-tree/icons/_bds.scss +11 -0
- package/styles/fabric-dark.css +3 -1
- package/styles/fabric.css +3 -1
- package/styles/fluent-dark.css +7 -1
- package/styles/fluent.css +7 -1
- package/styles/highcontrast-light.css +3 -1
- package/styles/highcontrast.css +3 -1
- package/styles/list-box/_bds-definition.scss +136 -0
- package/styles/list-box/icons/_bds.scss +25 -0
- package/styles/material-dark.css +11 -1
- package/styles/material.css +11 -1
- package/styles/material3-dark.css +2 -1
- package/styles/material3.css +2 -1
- package/styles/mention/_bds-definition.scss +1 -0
- package/styles/multi-select/_bds-definition.scss +235 -0
- package/styles/multi-select/_bootstrap-dark-definition.scss +4 -0
- package/styles/multi-select/_bootstrap-definition.scss +4 -0
- package/styles/multi-select/_fluent-definition.scss +5 -0
- package/styles/multi-select/_layout.scss +8 -1
- package/styles/multi-select/_material-dark-definition.scss +11 -0
- package/styles/multi-select/_material-definition.scss +11 -0
- package/styles/multi-select/bootstrap-dark.css +7 -1
- package/styles/multi-select/bootstrap.css +7 -1
- package/styles/multi-select/bootstrap4.css +2 -1
- package/styles/multi-select/bootstrap5-dark.css +2 -1
- package/styles/multi-select/bootstrap5.css +2 -1
- package/styles/multi-select/fabric-dark.css +3 -1
- package/styles/multi-select/fabric.css +3 -1
- package/styles/multi-select/fluent-dark.css +7 -1
- package/styles/multi-select/fluent.css +7 -1
- package/styles/multi-select/highcontrast-light.css +3 -1
- package/styles/multi-select/highcontrast.css +3 -1
- package/styles/multi-select/icons/_bds.scss +26 -0
- package/styles/multi-select/material-dark.css +11 -1
- package/styles/multi-select/material.css +11 -1
- package/styles/multi-select/material3-dark.css +2 -1
- package/styles/multi-select/material3.css +2 -1
- package/styles/multi-select/tailwind-dark.css +2 -1
- package/styles/multi-select/tailwind.css +2 -1
- package/styles/tailwind-dark.css +2 -1
- package/styles/tailwind.css +2 -1
|
@@ -21,7 +21,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
21
21
|
/// <reference path='../drop-down-base/drop-down-base-model.d.ts'/>
|
|
22
22
|
import { DropDownBase, dropDownBaseClasses } from '../drop-down-base/drop-down-base';
|
|
23
23
|
import { FieldSettings } from '../drop-down-base/drop-down-base';
|
|
24
|
-
import { Popup, createSpinner, showSpinner, hideSpinner } from '@syncfusion/ej2-popups';
|
|
24
|
+
import { isCollide, Popup, createSpinner, showSpinner, hideSpinner } from '@syncfusion/ej2-popups';
|
|
25
25
|
import { Input } from '@syncfusion/ej2-inputs';
|
|
26
26
|
import { attributes, setValue, getValue } from '@syncfusion/ej2-base';
|
|
27
27
|
import { NotifyPropertyChanges, extend } from '@syncfusion/ej2-base';
|
|
@@ -104,8 +104,12 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
104
104
|
_this.selectAllEventEle = [];
|
|
105
105
|
_this.resetMainList = null;
|
|
106
106
|
_this.resetFilteredData = false;
|
|
107
|
+
_this.preventSetCurrentData = false;
|
|
107
108
|
_this.scrollFocusStatus = false;
|
|
108
109
|
_this.keyDownStatus = false;
|
|
110
|
+
_this.IsScrollerAtEnd = function () {
|
|
111
|
+
return this.list && this.list.scrollTop + this.list.clientHeight >= this.list.scrollHeight;
|
|
112
|
+
};
|
|
109
113
|
return _this;
|
|
110
114
|
}
|
|
111
115
|
MultiSelect.prototype.enableRTL = function (state) {
|
|
@@ -122,6 +126,9 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
122
126
|
};
|
|
123
127
|
MultiSelect.prototype.requiredModules = function () {
|
|
124
128
|
var modules = [];
|
|
129
|
+
if (this.enableVirtualization) {
|
|
130
|
+
modules.push({ args: [this], member: 'VirtualScroll' });
|
|
131
|
+
}
|
|
125
132
|
if (this.mode === 'CheckBox') {
|
|
126
133
|
this.isGroupChecking = this.enableGroupCheckBox;
|
|
127
134
|
if (this.enableGroupCheckBox) {
|
|
@@ -262,6 +269,9 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
262
269
|
attributes(_this.inputElement, { 'aria-expanded': 'true', 'aria-owns': _this.element.id + '_popup', 'aria-controls': _this.element.id });
|
|
263
270
|
_this.updateAriaActiveDescendant();
|
|
264
271
|
if (_this.isFirstClick) {
|
|
272
|
+
if (_this.enableVirtualization && _this.mode === 'CheckBox' && _this.value) {
|
|
273
|
+
_this.updateVirtualReOrderList();
|
|
274
|
+
}
|
|
265
275
|
_this.loadTemplate();
|
|
266
276
|
}
|
|
267
277
|
if (_this.mode === 'CheckBox' && _this.showSelectAll) {
|
|
@@ -270,6 +280,33 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
270
280
|
}
|
|
271
281
|
});
|
|
272
282
|
};
|
|
283
|
+
MultiSelect.prototype.updateVirtualReOrderList = function (isCheckBoxUpdate) {
|
|
284
|
+
var query = this.getForQuery(this.value, true).clone();
|
|
285
|
+
this.resetList(this.dataSource, this.fields, query);
|
|
286
|
+
this.UpdateSkeleton();
|
|
287
|
+
this.liCollections = this.list.querySelectorAll('.' + dropDownBaseClasses.li);
|
|
288
|
+
this.virtualItemCount = this.itemCount;
|
|
289
|
+
if (this.mode !== 'CheckBox') {
|
|
290
|
+
this.totalItemCount = this.value && this.value.length ? this.totalItemCount - this.value.length : this.totalItemCount;
|
|
291
|
+
}
|
|
292
|
+
if (!this.list.querySelector('.e-virtual-ddl')) {
|
|
293
|
+
var virualElement = this.createElement('div', {
|
|
294
|
+
id: this.element.id + '_popup', className: 'e-virtual-ddl', styles: this.GetVirtualTrackHeight()
|
|
295
|
+
});
|
|
296
|
+
this.popupWrapper.querySelector('.e-dropdownbase').appendChild(virualElement);
|
|
297
|
+
}
|
|
298
|
+
else {
|
|
299
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
300
|
+
this.list.getElementsByClassName('e-virtual-ddl')[0].style = this.GetVirtualTrackHeight();
|
|
301
|
+
}
|
|
302
|
+
if (this.list.querySelector('.e-virtual-ddl-content')) {
|
|
303
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
304
|
+
this.list.getElementsByClassName('e-virtual-ddl-content')[0].style = this.getTransformValues();
|
|
305
|
+
}
|
|
306
|
+
if (isCheckBoxUpdate) {
|
|
307
|
+
this.loadTemplate();
|
|
308
|
+
}
|
|
309
|
+
};
|
|
273
310
|
MultiSelect.prototype.updateListItems = function (listItems, mainListItems) {
|
|
274
311
|
for (var i = 0; i < listItems.length; i++) {
|
|
275
312
|
this.findGroupStart(listItems[i]);
|
|
@@ -279,19 +316,33 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
279
316
|
};
|
|
280
317
|
MultiSelect.prototype.loadTemplate = function () {
|
|
281
318
|
this.refreshListItems(null);
|
|
319
|
+
if (this.enableVirtualization && this.list && this.mode === 'CheckBox') {
|
|
320
|
+
var reOrderList = this.list.querySelectorAll('.e-reorder')[0];
|
|
321
|
+
if (this.list.querySelector('.e-virtual-ddl-content') && reOrderList) {
|
|
322
|
+
this.list.querySelector('.e-virtual-ddl-content').removeChild(reOrderList);
|
|
323
|
+
}
|
|
324
|
+
}
|
|
282
325
|
if (this.mode === 'CheckBox') {
|
|
283
326
|
this.removeFocus();
|
|
284
327
|
}
|
|
285
328
|
this.notify('reOrder', { module: 'CheckBoxSelection', enable: this.mode === 'CheckBox', e: this });
|
|
329
|
+
this.isPreventScrollAction = true;
|
|
286
330
|
};
|
|
287
331
|
MultiSelect.prototype.setScrollPosition = function () {
|
|
288
332
|
if (((!this.hideSelectedItem && this.mode !== 'CheckBox') || (this.mode === 'CheckBox' && !this.enableSelectionOrder)) &&
|
|
289
333
|
(!isNullOrUndefined(this.value) && (this.value.length > 0))) {
|
|
290
|
-
var
|
|
334
|
+
var value = this.allowObjectBinding ? getValue((this.fields.value) ? this.fields.value : '', this.value[this.value.length - 1]) : this.value[this.value.length - 1];
|
|
335
|
+
var valueEle = this.findListElement((this.hideSelectedItem ? this.ulElement : this.list), 'li', 'data-value', value);
|
|
291
336
|
if (!isNullOrUndefined(valueEle)) {
|
|
292
337
|
this.scrollBottom(valueEle);
|
|
293
338
|
}
|
|
294
339
|
}
|
|
340
|
+
if (this.enableVirtualization) {
|
|
341
|
+
var focusedItem = this.list.querySelector('.' + dropDownBaseClasses.focus);
|
|
342
|
+
if (focusedItem) {
|
|
343
|
+
this.scrollBottom(focusedItem);
|
|
344
|
+
}
|
|
345
|
+
}
|
|
295
346
|
};
|
|
296
347
|
MultiSelect.prototype.focusAtFirstListItem = function () {
|
|
297
348
|
if (this.ulElement && this.ulElement.querySelector('li.'
|
|
@@ -302,9 +353,15 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
302
353
|
return;
|
|
303
354
|
}
|
|
304
355
|
else {
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
356
|
+
if (this.enableVirtualization) {
|
|
357
|
+
element = this.ulElement.querySelector('li.'
|
|
358
|
+
+ dropDownBaseClasses.li + ':not(.e-virtual-list)' + ':not(.e-hide-listitem)');
|
|
359
|
+
}
|
|
360
|
+
else {
|
|
361
|
+
element = this.ulElement.querySelector('li.'
|
|
362
|
+
+ dropDownBaseClasses.li + ':not(.'
|
|
363
|
+
+ HIDE_LIST + ')');
|
|
364
|
+
}
|
|
308
365
|
}
|
|
309
366
|
if (element !== null) {
|
|
310
367
|
this.removeFocus();
|
|
@@ -319,7 +376,8 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
319
376
|
}
|
|
320
377
|
else {
|
|
321
378
|
if (this.value && this.value.length) {
|
|
322
|
-
|
|
379
|
+
var value = this.allowObjectBinding ? getValue(((this.fields.value) ? this.fields.value : ''), this.value[this.value.length - 1]) : this.value[this.value.length - 1];
|
|
380
|
+
Search(value, this.liCollections, 'StartsWith', this.ignoreCase);
|
|
323
381
|
}
|
|
324
382
|
else {
|
|
325
383
|
activeElement = null;
|
|
@@ -327,7 +385,7 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
327
385
|
}
|
|
328
386
|
if (activeElement && activeElement.item !== null) {
|
|
329
387
|
this.addListFocus(activeElement.item);
|
|
330
|
-
if (((this.allowCustomValue || this.allowFiltering) && this.isPopupOpen() && this.closePopupOnSelect) || this.closePopupOnSelect) {
|
|
388
|
+
if (((this.allowCustomValue || this.allowFiltering) && this.isPopupOpen() && this.closePopupOnSelect && !this.enableVirtualization) || this.closePopupOnSelect && !this.enableVirtualization) {
|
|
331
389
|
this.scrollBottom(activeElement.item, activeElement.index);
|
|
332
390
|
}
|
|
333
391
|
}
|
|
@@ -369,9 +427,9 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
369
427
|
var elements = this.chipCollectionWrapper.querySelectorAll('span.' + CHIP);
|
|
370
428
|
var value = elements[elements.length - 1].getAttribute('data-value');
|
|
371
429
|
if (!isNullOrUndefined(this.value)) {
|
|
372
|
-
this.tempValues = this.value.slice();
|
|
430
|
+
this.tempValues = this.allowObjectBinding ? this.value.slice() : this.value.slice();
|
|
373
431
|
}
|
|
374
|
-
var customValue = this.getFormattedValue(value);
|
|
432
|
+
var customValue = this.allowObjectBinding ? this.getDataByValue(value) : this.getFormattedValue(value);
|
|
375
433
|
if (this.allowCustomValue && (value !== 'false' && customValue === false || (!isNullOrUndefined(customValue) &&
|
|
376
434
|
customValue.toString() === 'NaN'))) {
|
|
377
435
|
customValue = value;
|
|
@@ -397,15 +455,43 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
397
455
|
}
|
|
398
456
|
return this.targetInputElement.value;
|
|
399
457
|
};
|
|
400
|
-
MultiSelect.prototype.getForQuery = function (valuecheck) {
|
|
458
|
+
MultiSelect.prototype.getForQuery = function (valuecheck, isCheckbox) {
|
|
401
459
|
var predicate;
|
|
402
460
|
var field = isNullOrUndefined(this.fields.value) ? this.fields.text : this.fields.value;
|
|
403
|
-
|
|
404
|
-
if (
|
|
405
|
-
|
|
461
|
+
if (this.enableVirtualization) {
|
|
462
|
+
if (isCheckbox) {
|
|
463
|
+
for (var i = 0; i < valuecheck.length; i++) {
|
|
464
|
+
var value = this.allowObjectBinding ? getValue((this.fields.value) ? this.fields.value : '', valuecheck[i]) : valuecheck[i];
|
|
465
|
+
if (i === 0) {
|
|
466
|
+
predicate = new Predicate(field, 'equal', value);
|
|
467
|
+
}
|
|
468
|
+
else {
|
|
469
|
+
predicate = predicate.or(field, 'equal', value);
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
return new Query().where(predicate);
|
|
406
473
|
}
|
|
407
474
|
else {
|
|
408
|
-
|
|
475
|
+
for (var i = 0; i < valuecheck.length; i++) {
|
|
476
|
+
var value = this.allowObjectBinding ? getValue((this.fields.value) ? this.fields.value : '', valuecheck[i]) : valuecheck[i];
|
|
477
|
+
if (i === 0) {
|
|
478
|
+
predicate = new Predicate(field, 'notequal', value);
|
|
479
|
+
}
|
|
480
|
+
else {
|
|
481
|
+
predicate = predicate.and(field, 'notequal', value);
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
return new Query().where(predicate);
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
else {
|
|
488
|
+
for (var i = 0; i < valuecheck.length; i++) {
|
|
489
|
+
if (i === 0) {
|
|
490
|
+
predicate = new Predicate(field, 'equal', valuecheck[i]);
|
|
491
|
+
}
|
|
492
|
+
else {
|
|
493
|
+
predicate = predicate.or(field, 'equal', valuecheck[i]);
|
|
494
|
+
}
|
|
409
495
|
}
|
|
410
496
|
}
|
|
411
497
|
if (this.dataSource instanceof DataManager && this.dataSource.adaptor instanceof JsonAdaptor) {
|
|
@@ -417,14 +503,20 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
417
503
|
};
|
|
418
504
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
419
505
|
MultiSelect.prototype.onActionComplete = function (ulElement, list, e, isUpdated) {
|
|
506
|
+
if (this.dataSource instanceof DataManager && !isNullOrUndefined(e) && !this.virtualGroupDataSource) {
|
|
507
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
508
|
+
this.totalItemCount = e.count;
|
|
509
|
+
}
|
|
420
510
|
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
421
511
|
_super.prototype.onActionComplete.call(this, ulElement, list, e);
|
|
512
|
+
this.skeletonCount = this.totalItemCount != 0 && this.totalItemCount < (this.itemCount * 2) ? 0 : this.skeletonCount;
|
|
422
513
|
this.updateSelectElementData(this.allowFiltering);
|
|
423
514
|
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
424
515
|
var proxy = this;
|
|
425
|
-
if (!isNullOrUndefined(this.value) && !this.allowCustomValue) {
|
|
516
|
+
if (!isNullOrUndefined(this.value) && !this.allowCustomValue && !this.enableVirtualization) {
|
|
426
517
|
for (var i = 0; i < this.value.length; i++) {
|
|
427
|
-
var
|
|
518
|
+
var value = this.allowObjectBinding ? getValue((this.fields.value) ? this.fields.value : '', proxy.value[i]) : proxy.value[i];
|
|
519
|
+
var checkEle = this.findListElement(((this.allowFiltering && !isNullOrUndefined(this.mainList)) ? this.mainList : ulElement), 'li', 'data-value', value);
|
|
428
520
|
if (!checkEle && !(this.dataSource instanceof DataManager)) {
|
|
429
521
|
this.value.splice(i, 1);
|
|
430
522
|
i -= 1;
|
|
@@ -512,7 +604,7 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
512
604
|
dropDownBaseClasses.selected;
|
|
513
605
|
if (!isNullOrUndefined(this.value)) {
|
|
514
606
|
for (var index = 0; !isNullOrUndefined(this.value[index]); index++) {
|
|
515
|
-
value = this.value[index];
|
|
607
|
+
value = this.allowObjectBinding ? getValue((this.fields.value) ? this.fields.value : '', this.value[index]) : this.value[index];
|
|
516
608
|
element = this.findListElement(this.list, 'li', 'data-value', value);
|
|
517
609
|
if (element) {
|
|
518
610
|
addClass([element], className);
|
|
@@ -611,13 +703,13 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
611
703
|
MultiSelect.prototype.checkSelectAll = function () {
|
|
612
704
|
var groupItemLength = this.list.querySelectorAll('li.e-list-group-item.e-active').length;
|
|
613
705
|
var listItem = this.list.querySelectorAll('li.e-list-item');
|
|
614
|
-
var searchCount = this.list.querySelectorAll('li.' + dropDownBaseClasses.li).length;
|
|
706
|
+
var searchCount = this.enableVirtualization ? this.list.querySelectorAll('li.' + dropDownBaseClasses.li + ':not(.e-virtual-list)').length : this.list.querySelectorAll('li.' + dropDownBaseClasses.li).length;
|
|
615
707
|
var searchActiveCount = this.list.querySelectorAll('li.' + dropDownBaseClasses.selected).length;
|
|
616
708
|
if (this.enableGroupCheckBox && !isNullOrUndefined(this.fields.groupBy)) {
|
|
617
709
|
searchActiveCount = searchActiveCount - groupItemLength;
|
|
618
710
|
}
|
|
619
|
-
if ((searchCount === searchActiveCount || searchActiveCount === this.maximumSelectionLength)
|
|
620
|
-
&& (this.mode === 'CheckBox' && this.showSelectAll)) {
|
|
711
|
+
if ((!this.enableVirtualization && ((searchCount === searchActiveCount || searchActiveCount === this.maximumSelectionLength)
|
|
712
|
+
&& (this.mode === 'CheckBox' && this.showSelectAll))) || (this.enableVirtualization && this.mode === 'CheckBox' && this.showSelectAll && this.virtualSelectAll && this.value && this.value.length === this.totalItemCount)) {
|
|
621
713
|
this.notify('checkSelectAll', { module: 'CheckBoxSelection', enable: this.mode === 'CheckBox', value: 'check' });
|
|
622
714
|
}
|
|
623
715
|
else if ((searchCount !== searchActiveCount) && (this.mode === 'CheckBox' && this.showSelectAll)) {
|
|
@@ -654,7 +746,7 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
654
746
|
}
|
|
655
747
|
this.isValidKey = (this.isPopupOpen() && e.keyCode === 8) || this.isValidKey;
|
|
656
748
|
this.isValidKey = e.ctrlKey && e.keyCode === 86 ? false : this.isValidKey;
|
|
657
|
-
if (this.isValidKey) {
|
|
749
|
+
if (this.isValidKey && this.inputElement) {
|
|
658
750
|
this.isValidKey = false;
|
|
659
751
|
this.expandTextbox();
|
|
660
752
|
this.showOverAllClear();
|
|
@@ -684,7 +776,7 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
684
776
|
return filterQuery;
|
|
685
777
|
}
|
|
686
778
|
if (this.filterAction) {
|
|
687
|
-
if (this.targetElement() !== null) {
|
|
779
|
+
if ((this.targetElement() !== null && !this.enableVirtualization) || (this.enableVirtualization && this.targetElement() !== null && this.targetElement().trim() !== '')) {
|
|
688
780
|
var dataType = this.typeOfData(this.dataSource).typeof;
|
|
689
781
|
if (!(this.dataSource instanceof DataManager) && dataType === 'string' || dataType === 'number') {
|
|
690
782
|
filterQuery.where('', this.filterType, this.targetElement(), this.ignoreCase, this.ignoreAccent);
|
|
@@ -694,21 +786,89 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
694
786
|
filterQuery.where(!isNullOrUndefined(fields.text) ? fields.text : '', this.filterType, this.targetElement(), this.ignoreCase, this.ignoreAccent);
|
|
695
787
|
}
|
|
696
788
|
}
|
|
789
|
+
if (this.enableVirtualization && (this.viewPortInfo.endIndex != 0) && !this.virtualSelectAll) {
|
|
790
|
+
return this.virtualFilterQuery(filterQuery);
|
|
791
|
+
}
|
|
697
792
|
return filterQuery;
|
|
698
793
|
}
|
|
699
794
|
else {
|
|
795
|
+
if (this.enableVirtualization && (this.viewPortInfo.endIndex != 0) && !this.virtualSelectAll && (!(this.dataSource instanceof DataManager) || (this.dataSource instanceof DataManager && this.virtualGroupDataSource))) {
|
|
796
|
+
return this.virtualFilterQuery(filterQuery);
|
|
797
|
+
}
|
|
700
798
|
return query ? query : this.query ? this.query : new Query();
|
|
701
799
|
}
|
|
702
800
|
};
|
|
801
|
+
MultiSelect.prototype.virtualFilterQuery = function (filterQuery) {
|
|
802
|
+
var takeValue = this.getTakeValue();
|
|
803
|
+
var isReOrder = true;
|
|
804
|
+
var isSkip = true;
|
|
805
|
+
var isTake = true;
|
|
806
|
+
for (var queryElements = 0; queryElements < filterQuery.queries.length; queryElements++) {
|
|
807
|
+
if (this.getModuleName() === 'multiselect' && ((filterQuery.queries[queryElements].e && filterQuery.queries[queryElements].e.condition == 'or') || (filterQuery.queries[queryElements].e && filterQuery.queries[queryElements].e.operator == 'equal'))) {
|
|
808
|
+
isReOrder = false;
|
|
809
|
+
}
|
|
810
|
+
if (filterQuery.queries[queryElements].fn === 'onSkip') {
|
|
811
|
+
isSkip = false;
|
|
812
|
+
}
|
|
813
|
+
if (filterQuery.queries[queryElements].fn === 'onTake') {
|
|
814
|
+
isTake = false;
|
|
815
|
+
}
|
|
816
|
+
}
|
|
817
|
+
if ((this.allowFiltering && isSkip) || !isReOrder || (!this.allowFiltering && isSkip)) {
|
|
818
|
+
if (!isReOrder) {
|
|
819
|
+
filterQuery.skip(this.viewPortInfo.startIndex);
|
|
820
|
+
}
|
|
821
|
+
else {
|
|
822
|
+
filterQuery.skip(this.virtualItemStartIndex);
|
|
823
|
+
}
|
|
824
|
+
}
|
|
825
|
+
if (isTake) {
|
|
826
|
+
if (this.isIncrementalRequest) {
|
|
827
|
+
filterQuery.take(this.incrementalEndIndex);
|
|
828
|
+
}
|
|
829
|
+
else {
|
|
830
|
+
filterQuery.take(takeValue);
|
|
831
|
+
}
|
|
832
|
+
}
|
|
833
|
+
filterQuery.requiresCount();
|
|
834
|
+
return filterQuery;
|
|
835
|
+
};
|
|
836
|
+
MultiSelect.prototype.getTakeValue = function () {
|
|
837
|
+
return this.allowFiltering && Browser.isDevice ? Math.round(window.outerHeight / this.listItemHeight) : this.itemCount;
|
|
838
|
+
};
|
|
703
839
|
MultiSelect.prototype.dataUpdater = function (dataSource, query, fields) {
|
|
704
840
|
this.isDataFetched = false;
|
|
841
|
+
var isNoData = this.list.classList.contains(dropDownBaseClasses.noData);
|
|
705
842
|
if (this.targetElement().trim() === '') {
|
|
706
|
-
var list = this.mainList.cloneNode ? this.mainList.cloneNode(true) : this.mainList;
|
|
843
|
+
var list = this.enableVirtualization ? this.list.cloneNode(true) : this.mainList.cloneNode ? this.mainList.cloneNode(true) : this.mainList;
|
|
707
844
|
if (this.backCommand) {
|
|
708
845
|
this.remoteCustomValue = false;
|
|
709
846
|
if (this.allowCustomValue && list.querySelectorAll('li').length == 0 && this.mainData.length > 0) {
|
|
710
847
|
this.mainData = [];
|
|
711
848
|
}
|
|
849
|
+
if (this.enableVirtualization) {
|
|
850
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
851
|
+
this.totalItemCount = this.dataSource && this.dataSource.length ? this.dataSource.length : 0;
|
|
852
|
+
this.resetList(dataSource, fields, query);
|
|
853
|
+
if (this.mode !== 'CheckBox') {
|
|
854
|
+
this.totalItemCount = this.value && this.value.length ? this.totalItemCount - this.value.length : this.totalItemCount;
|
|
855
|
+
}
|
|
856
|
+
this.UpdateSkeleton();
|
|
857
|
+
if ((isNoData || this.allowCustomValue) && !this.list.classList.contains(dropDownBaseClasses.noData)) {
|
|
858
|
+
if (!this.list.querySelector('.e-virtual-ddl-content')) {
|
|
859
|
+
this.list.appendChild(this.createElement('div', {
|
|
860
|
+
className: 'e-virtual-ddl-content',
|
|
861
|
+
styles: this.getTransformValues()
|
|
862
|
+
})).appendChild(this.list.querySelector('.e-list-parent'));
|
|
863
|
+
}
|
|
864
|
+
if (!this.list.querySelector('.e-virtual-ddl')) {
|
|
865
|
+
var virualElement = this.createElement('div', {
|
|
866
|
+
id: this.element.id + '_popup', className: 'e-virtual-ddl', styles: this.GetVirtualTrackHeight()
|
|
867
|
+
});
|
|
868
|
+
document.getElementsByClassName('e-popup')[0].querySelector('.e-dropdownbase').appendChild(virualElement);
|
|
869
|
+
}
|
|
870
|
+
}
|
|
871
|
+
}
|
|
712
872
|
this.onActionComplete(list, this.mainData);
|
|
713
873
|
if (this.value && this.value.length) {
|
|
714
874
|
this.refreshSelection();
|
|
@@ -720,7 +880,30 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
720
880
|
}
|
|
721
881
|
}
|
|
722
882
|
else {
|
|
883
|
+
if (this.enableVirtualization && this.allowFiltering) {
|
|
884
|
+
this.isPreventScrollAction = true;
|
|
885
|
+
this.list.scrollTop = 0;
|
|
886
|
+
this.previousStartIndex = 0;
|
|
887
|
+
this.virtualListInfo = null;
|
|
888
|
+
}
|
|
723
889
|
this.resetList(dataSource, fields, query);
|
|
890
|
+
if (this.enableVirtualization && (isNoData || this.allowCustomValue) && !this.list.classList.contains(dropDownBaseClasses.noData)) {
|
|
891
|
+
if (!this.list.querySelector('.e-virtual-ddl-content')) {
|
|
892
|
+
this.list.appendChild(this.createElement('div', {
|
|
893
|
+
className: 'e-virtual-ddl-content',
|
|
894
|
+
styles: this.getTransformValues()
|
|
895
|
+
})).appendChild(this.list.querySelector('.e-list-parent'));
|
|
896
|
+
}
|
|
897
|
+
if (this.mode !== 'CheckBox') {
|
|
898
|
+
this.totalItemCount = this.value && this.value.length ? this.totalItemCount - this.value.length : this.totalItemCount;
|
|
899
|
+
}
|
|
900
|
+
if (!this.list.querySelector('.e-virtual-ddl')) {
|
|
901
|
+
var virualElement = this.createElement('div', {
|
|
902
|
+
id: this.element.id + '_popup', className: 'e-virtual-ddl', styles: this.GetVirtualTrackHeight()
|
|
903
|
+
});
|
|
904
|
+
document.getElementsByClassName('e-popup')[0].querySelector('.e-dropdownbase').appendChild(virualElement);
|
|
905
|
+
}
|
|
906
|
+
}
|
|
724
907
|
if (this.allowCustomValue) {
|
|
725
908
|
if (!(dataSource instanceof DataManager)) {
|
|
726
909
|
this.checkForCustomValue(query, fields);
|
|
@@ -731,6 +914,9 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
731
914
|
}
|
|
732
915
|
}
|
|
733
916
|
}
|
|
917
|
+
if (this.enableVirtualization && this.allowFiltering) {
|
|
918
|
+
this.getFilteringSkeletonCount();
|
|
919
|
+
}
|
|
734
920
|
this.refreshPopup();
|
|
735
921
|
if (this.mode === 'CheckBox') {
|
|
736
922
|
this.removeFocus();
|
|
@@ -744,18 +930,43 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
744
930
|
var customData = (!isNullOrUndefined(this.mainData) && this.mainData.length > 0) ?
|
|
745
931
|
this.mainData[0] : this.mainData;
|
|
746
932
|
if (customData && typeof (customData) !== 'string' && typeof (customData) !== 'number' && typeof (customData) !== 'boolean') {
|
|
747
|
-
var
|
|
748
|
-
setValue(field.text, value,
|
|
933
|
+
var dataItem_1 = {};
|
|
934
|
+
setValue(field.text, value, dataItem_1);
|
|
749
935
|
if (typeof getValue((this.fields.value ? this.fields.value : 'value'), customData)
|
|
750
936
|
=== 'number') {
|
|
751
|
-
setValue(field.value, Math.random(),
|
|
937
|
+
setValue(field.value, Math.random(), dataItem_1);
|
|
752
938
|
}
|
|
753
939
|
else {
|
|
754
|
-
setValue(field.value, value,
|
|
940
|
+
setValue(field.value, value, dataItem_1);
|
|
941
|
+
}
|
|
942
|
+
var emptyObject_1 = {};
|
|
943
|
+
if (this.allowObjectBinding) {
|
|
944
|
+
var keys = this.listData && this.listData.length > 0 ? Object.keys(this.listData[0]) : this.firstItem ? Object.keys(this.firstItem) : Object.keys(dataItem_1);
|
|
945
|
+
// Create an empty object with predefined keys
|
|
946
|
+
keys.forEach(function (key) {
|
|
947
|
+
emptyObject_1[key] = ((key === fields.value) || (key === fields.text)) ? getValue(fields.value, dataItem_1) : null;
|
|
948
|
+
});
|
|
949
|
+
}
|
|
950
|
+
dataItem_1 = this.allowObjectBinding ? emptyObject_1 : dataItem_1;
|
|
951
|
+
if (this.enableVirtualization) {
|
|
952
|
+
this.virtualCustomData = dataItem_1;
|
|
953
|
+
var tempData = this.virtualGroupDataSource ? JSON.parse(JSON.stringify(this.virtualGroupDataSource)) : JSON.parse(JSON.stringify(this.dataSource));
|
|
954
|
+
var totalData = [];
|
|
955
|
+
if (this.virtualCustomSelectData && this.virtualCustomSelectData.length > 0) {
|
|
956
|
+
totalData = tempData.concat(this.virtualCustomSelectData);
|
|
957
|
+
}
|
|
958
|
+
tempData.splice(0, 0, dataItem_1);
|
|
959
|
+
this.isCustomDataUpdated = true;
|
|
960
|
+
this.viewPortInfo.startIndex = this.virtualItemStartIndex = 0;
|
|
961
|
+
this.viewPortInfo.endIndex = this.virtualItemEndIndex = this.itemCount;
|
|
962
|
+
this.resetList(tempData, field, query);
|
|
963
|
+
this.isCustomDataUpdated = false;
|
|
964
|
+
}
|
|
965
|
+
else {
|
|
966
|
+
var tempData = JSON.parse(JSON.stringify(this.listData));
|
|
967
|
+
tempData.splice(0, 0, dataItem_1);
|
|
968
|
+
this.resetList(tempData, field, query);
|
|
755
969
|
}
|
|
756
|
-
var tempData = JSON.parse(JSON.stringify(this.listData));
|
|
757
|
-
tempData.splice(0, 0, dataItem);
|
|
758
|
-
this.resetList(tempData, field, query);
|
|
759
970
|
}
|
|
760
971
|
else if (this.listData) {
|
|
761
972
|
var tempData = JSON.parse(JSON.stringify(this.listData));
|
|
@@ -789,6 +1000,8 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
789
1000
|
};
|
|
790
1001
|
MultiSelect.prototype.wrapperClick = function (e) {
|
|
791
1002
|
this.setDynValue = false;
|
|
1003
|
+
this.keyboardEvent = null;
|
|
1004
|
+
this.isKeyBoardAction = false;
|
|
792
1005
|
if (!this.enabled) {
|
|
793
1006
|
return;
|
|
794
1007
|
}
|
|
@@ -988,8 +1201,8 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
988
1201
|
if (this.initStatus && this.validateValues(newValue, oldValue)) {
|
|
989
1202
|
var eventArgs = {
|
|
990
1203
|
e: event,
|
|
991
|
-
oldValue: oldVal,
|
|
992
|
-
value: newVal,
|
|
1204
|
+
oldValue: this.allowObjectBinding ? oldVal : oldVal,
|
|
1205
|
+
value: this.allowObjectBinding ? newVal : newVal,
|
|
993
1206
|
isInteracted: event ? true : false,
|
|
994
1207
|
element: this.element,
|
|
995
1208
|
event: event
|
|
@@ -1005,13 +1218,14 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
1005
1218
|
this.dispatchEvent(this.hiddenElement, 'change');
|
|
1006
1219
|
}
|
|
1007
1220
|
}
|
|
1221
|
+
this.selectedValueInfo = this.viewPortInfo;
|
|
1008
1222
|
};
|
|
1009
1223
|
MultiSelect.prototype.updateTempValue = function () {
|
|
1010
1224
|
if (!this.value) {
|
|
1011
1225
|
this.tempValues = this.value;
|
|
1012
1226
|
}
|
|
1013
1227
|
else {
|
|
1014
|
-
this.tempValues = this.value.slice();
|
|
1228
|
+
this.tempValues = this.allowObjectBinding ? this.value.slice() : this.value.slice();
|
|
1015
1229
|
}
|
|
1016
1230
|
};
|
|
1017
1231
|
MultiSelect.prototype.updateAriaActiveDescendant = function () {
|
|
@@ -1019,26 +1233,44 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
1019
1233
|
attributes(this.inputElement, { 'aria-activedescendant': this.ulElement.getElementsByClassName('e-item-focus')[0].id });
|
|
1020
1234
|
}
|
|
1021
1235
|
};
|
|
1022
|
-
MultiSelect.prototype.
|
|
1023
|
-
var height = this.list.classList.contains(dropDownBaseClasses.noData) ? null :
|
|
1024
|
-
getComputedStyle(this.getItems()[0], null).getPropertyValue('height');
|
|
1025
|
-
return Math.round(this.list.offsetHeight / parseInt(height, 10));
|
|
1026
|
-
};
|
|
1027
|
-
MultiSelect.prototype.pageUpSelection = function (steps) {
|
|
1236
|
+
MultiSelect.prototype.pageUpSelection = function (steps, isVirtualKeyAction) {
|
|
1028
1237
|
var collection = this.list.querySelectorAll('li.'
|
|
1029
1238
|
+ dropDownBaseClasses.li + ':not(.' + HIDE_LIST + ')' + ':not(.e-reorder-hide)');
|
|
1030
1239
|
var previousItem = steps >= 0 ? collection[steps + 1] : collection[0];
|
|
1031
|
-
this.
|
|
1032
|
-
|
|
1240
|
+
if (this.enableVirtualization && isVirtualKeyAction) {
|
|
1241
|
+
previousItem = steps >= 0 && this.viewPortInfo.startIndex != 0 ? this.liCollections[steps + this.skeletonCount + 1] : this.liCollections[this.skeletonCount];
|
|
1242
|
+
}
|
|
1243
|
+
if (!isNullOrUndefined(previousItem) && previousItem.classList.contains('e-virtual-list')) {
|
|
1244
|
+
previousItem = this.liCollections[this.skeletonCount];
|
|
1245
|
+
}
|
|
1246
|
+
if (this.enableVirtualization) {
|
|
1247
|
+
if (!isNullOrUndefined(previousItem) && !previousItem.classList.contains('e-item-focus')) {
|
|
1248
|
+
this.addListFocus(previousItem);
|
|
1249
|
+
this.scrollTop(previousItem, this.getIndexByValue(previousItem.getAttribute('data-value')), this.keyboardEvent.keyCode);
|
|
1250
|
+
}
|
|
1251
|
+
else if (this.viewPortInfo.startIndex == 0) {
|
|
1252
|
+
this.scrollTop(previousItem, this.getIndexByValue(previousItem.getAttribute('data-value')), this.keyboardEvent.keyCode);
|
|
1253
|
+
}
|
|
1254
|
+
}
|
|
1255
|
+
else {
|
|
1256
|
+
this.addListFocus(previousItem);
|
|
1257
|
+
this.scrollTop(previousItem, this.getIndexByValue(previousItem.getAttribute('data-value')), this.keyboardEvent.keyCode);
|
|
1258
|
+
}
|
|
1033
1259
|
};
|
|
1034
|
-
MultiSelect.prototype.pageDownSelection = function (steps) {
|
|
1260
|
+
MultiSelect.prototype.pageDownSelection = function (steps, isVirtualKeyAction) {
|
|
1035
1261
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
1036
1262
|
var list = this.getItems();
|
|
1037
1263
|
var collection = this.list.querySelectorAll('li.'
|
|
1038
1264
|
+ dropDownBaseClasses.li + ':not(.' + HIDE_LIST + ')' + ':not(.e-reorder-hide)');
|
|
1039
1265
|
var previousItem = steps <= collection.length ? collection[steps - 1] : collection[collection.length - 1];
|
|
1266
|
+
if (this.enableVirtualization && this.skeletonCount > 0) {
|
|
1267
|
+
previousItem = steps < list.length ? this.liCollections[steps] : this.liCollections[list.length - 1];
|
|
1268
|
+
}
|
|
1269
|
+
if (this.enableVirtualization && isVirtualKeyAction) {
|
|
1270
|
+
previousItem = steps <= list.length ? this.liCollections[steps] : this.liCollections[list.length - 1];
|
|
1271
|
+
}
|
|
1040
1272
|
this.addListFocus(previousItem);
|
|
1041
|
-
this.scrollBottom(previousItem, this.getIndexByValue(previousItem.getAttribute('data-value')));
|
|
1273
|
+
this.scrollBottom(previousItem, this.getIndexByValue(previousItem.getAttribute('data-value')), false, this.keyboardEvent.keyCode);
|
|
1042
1274
|
};
|
|
1043
1275
|
MultiSelect.prototype.getItems = function () {
|
|
1044
1276
|
if (!this.list) {
|
|
@@ -1157,21 +1389,110 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
1157
1389
|
}
|
|
1158
1390
|
}
|
|
1159
1391
|
};
|
|
1160
|
-
MultiSelect.prototype.homeNavigation = function (isHome) {
|
|
1392
|
+
MultiSelect.prototype.homeNavigation = function (isHome, isVirtualKeyAction) {
|
|
1161
1393
|
this.removeFocus();
|
|
1394
|
+
if (this.enableVirtualization) {
|
|
1395
|
+
if (isHome) {
|
|
1396
|
+
if (this.enableVirtualization && this.viewPortInfo.startIndex !== 0) {
|
|
1397
|
+
this.viewPortInfo.startIndex = 0;
|
|
1398
|
+
this.viewPortInfo.endIndex = this.itemCount;
|
|
1399
|
+
this.updateVirtualItemIndex();
|
|
1400
|
+
this.resetList(this.dataSource, this.fields, this.query);
|
|
1401
|
+
}
|
|
1402
|
+
}
|
|
1403
|
+
else {
|
|
1404
|
+
if (this.enableVirtualization && ((!this.value && this.viewPortInfo.endIndex !== this.totalItemCount) || (this.value && this.value.length > 0 && this.viewPortInfo.endIndex !== this.totalItemCount + this.value.length))) {
|
|
1405
|
+
this.viewPortInfo.startIndex = this.totalItemCount - this.itemCount;
|
|
1406
|
+
this.viewPortInfo.endIndex = this.totalItemCount;
|
|
1407
|
+
this.updateVirtualItemIndex();
|
|
1408
|
+
var query = new Query().clone();
|
|
1409
|
+
if (this.value && this.value.length > 0) {
|
|
1410
|
+
query = this.getForQuery(this.value).clone();
|
|
1411
|
+
query = query.skip(this.totalItemCount - this.itemCount);
|
|
1412
|
+
}
|
|
1413
|
+
this.resetList(this.dataSource, this.fields, query);
|
|
1414
|
+
}
|
|
1415
|
+
}
|
|
1416
|
+
}
|
|
1417
|
+
this.UpdateSkeleton();
|
|
1162
1418
|
var scrollEle = this.ulElement.querySelectorAll('li.' + dropDownBaseClasses.li
|
|
1163
1419
|
+ ':not(.' + HIDE_LIST + ')' + ':not(.e-reorder-hide)');
|
|
1164
1420
|
if (scrollEle.length > 0) {
|
|
1165
1421
|
var element = scrollEle[(isHome) ? 0 : (scrollEle.length - 1)];
|
|
1422
|
+
if (this.enableVirtualization && isHome) {
|
|
1423
|
+
element = scrollEle[this.skeletonCount];
|
|
1424
|
+
}
|
|
1425
|
+
this.removeFocus();
|
|
1166
1426
|
element.classList.add(dropDownBaseClasses.focus);
|
|
1167
|
-
this.
|
|
1427
|
+
if (this.enableVirtualization && isHome) {
|
|
1428
|
+
this.scrollTop(element, undefined, this.keyboardEvent.keyCode);
|
|
1429
|
+
}
|
|
1430
|
+
else if (!isVirtualKeyAction) {
|
|
1431
|
+
this.scrollBottom(element, undefined, false, this.keyboardEvent.keyCode);
|
|
1432
|
+
}
|
|
1168
1433
|
this.updateAriaActiveDescendant();
|
|
1169
1434
|
}
|
|
1170
1435
|
};
|
|
1436
|
+
MultiSelect.prototype.updateSelectionList = function () {
|
|
1437
|
+
if (!isNullOrUndefined(this.value) && this.value.length) {
|
|
1438
|
+
for (var index = 0; index < this.value.length; index++) {
|
|
1439
|
+
var value = this.allowObjectBinding ? getValue(((this.fields.value) ? this.fields.value : ''), this.value[index]) : this.value[index];
|
|
1440
|
+
var selectedItem = this.getElementByValue(value);
|
|
1441
|
+
if (selectedItem && !selectedItem.classList.contains(dropDownBaseClasses.selected)) {
|
|
1442
|
+
selectedItem.classList.add('e-active');
|
|
1443
|
+
}
|
|
1444
|
+
}
|
|
1445
|
+
}
|
|
1446
|
+
};
|
|
1447
|
+
MultiSelect.prototype.handleVirtualKeyboardActions = function (e, pageCount) {
|
|
1448
|
+
var focusedItem = this.list.querySelector('.' + dropDownBaseClasses.focus);
|
|
1449
|
+
var activeIndex;
|
|
1450
|
+
this.isKeyBoardAction = true;
|
|
1451
|
+
switch (e.keyCode) {
|
|
1452
|
+
case 40:
|
|
1453
|
+
this.arrowDown(e, true);
|
|
1454
|
+
break;
|
|
1455
|
+
case 38:
|
|
1456
|
+
this.arrowUp(e, true);
|
|
1457
|
+
break;
|
|
1458
|
+
case 33:
|
|
1459
|
+
e.preventDefault();
|
|
1460
|
+
if (focusedItem) {
|
|
1461
|
+
var count = (this.getPageCount() * 2) - 4;
|
|
1462
|
+
activeIndex = Math.round(count);
|
|
1463
|
+
activeIndex = this.getIndexByValue(focusedItem.getAttribute('data-value'));
|
|
1464
|
+
this.pageUpSelection(activeIndex - this.getPageCount(), true);
|
|
1465
|
+
this.updateAriaAttribute();
|
|
1466
|
+
}
|
|
1467
|
+
break;
|
|
1468
|
+
case 34:
|
|
1469
|
+
e.preventDefault();
|
|
1470
|
+
if (focusedItem) {
|
|
1471
|
+
activeIndex = this.getIndexByValue(focusedItem.getAttribute('data-value'));
|
|
1472
|
+
this.pageDownSelection(activeIndex + this.getPageCount() + 1, true);
|
|
1473
|
+
this.updateAriaAttribute();
|
|
1474
|
+
}
|
|
1475
|
+
break;
|
|
1476
|
+
case 35:
|
|
1477
|
+
case 36:
|
|
1478
|
+
this.isMouseScrollAction = true;
|
|
1479
|
+
this.homeNavigation((e.keyCode === 36) ? true : false, true);
|
|
1480
|
+
this.isPreventScrollAction = true;
|
|
1481
|
+
break;
|
|
1482
|
+
}
|
|
1483
|
+
this.keyboardEvent = null;
|
|
1484
|
+
this.isScrollChanged = true;
|
|
1485
|
+
this.isKeyBoardAction = false;
|
|
1486
|
+
};
|
|
1171
1487
|
MultiSelect.prototype.onKeyDown = function (e) {
|
|
1172
1488
|
if (this.readonly || !this.enabled && this.mode !== 'CheckBox') {
|
|
1173
1489
|
return;
|
|
1174
1490
|
}
|
|
1491
|
+
this.preventSetCurrentData = false;
|
|
1492
|
+
this.keyboardEvent = e;
|
|
1493
|
+
if (this.isPreventKeyAction && this.enableVirtualization) {
|
|
1494
|
+
e.preventDefault();
|
|
1495
|
+
}
|
|
1175
1496
|
this.keyCode = e.keyCode;
|
|
1176
1497
|
this.keyDownStatus = true;
|
|
1177
1498
|
if (e.keyCode > 111 && e.keyCode < 124) {
|
|
@@ -1184,16 +1505,18 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
1184
1505
|
else if (this.isPopupOpen()) {
|
|
1185
1506
|
var focusedItem = this.list.querySelector('.' + dropDownBaseClasses.focus);
|
|
1186
1507
|
var activeIndex = void 0;
|
|
1508
|
+
this.isKeyBoardAction = true;
|
|
1187
1509
|
switch (e.keyCode) {
|
|
1188
1510
|
case 36:
|
|
1189
1511
|
case 35:
|
|
1512
|
+
this.isMouseScrollAction = true;
|
|
1190
1513
|
this.homeNavigation((e.keyCode === 36) ? true : false);
|
|
1191
1514
|
break;
|
|
1192
1515
|
case 33:
|
|
1193
1516
|
e.preventDefault();
|
|
1194
1517
|
if (focusedItem) {
|
|
1195
|
-
this.getIndexByValue(focusedItem.getAttribute('data-value'));
|
|
1196
|
-
this.pageUpSelection(activeIndex - this.
|
|
1518
|
+
activeIndex = this.getIndexByValue(focusedItem.getAttribute('data-value'));
|
|
1519
|
+
this.pageUpSelection(activeIndex - this.getPageCount() - 1);
|
|
1197
1520
|
this.updateAriaAttribute();
|
|
1198
1521
|
}
|
|
1199
1522
|
return;
|
|
@@ -1201,7 +1524,7 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
1201
1524
|
e.preventDefault();
|
|
1202
1525
|
if (focusedItem) {
|
|
1203
1526
|
this.getIndexByValue(focusedItem.getAttribute('data-value'));
|
|
1204
|
-
this.pageDownSelection(activeIndex + this.
|
|
1527
|
+
this.pageDownSelection(activeIndex + this.getPageCount());
|
|
1205
1528
|
this.updateAriaAttribute();
|
|
1206
1529
|
}
|
|
1207
1530
|
return;
|
|
@@ -1267,10 +1590,11 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
1267
1590
|
if (!(this.mode === 'CheckBox' && this.showSelectAll)) {
|
|
1268
1591
|
this.refreshPopup();
|
|
1269
1592
|
}
|
|
1593
|
+
this.isKeyBoardAction = false;
|
|
1270
1594
|
};
|
|
1271
|
-
MultiSelect.prototype.arrowDown = function (e) {
|
|
1595
|
+
MultiSelect.prototype.arrowDown = function (e, isVirtualKeyAction) {
|
|
1272
1596
|
e.preventDefault();
|
|
1273
|
-
this.moveByList(1);
|
|
1597
|
+
this.moveByList(1, isVirtualKeyAction);
|
|
1274
1598
|
this.keyAction = true;
|
|
1275
1599
|
if (document.activeElement.classList.contains(FILTERINPUT)
|
|
1276
1600
|
|| (this.mode === 'CheckBox' && !this.allowFiltering && document.activeElement !== this.list)) {
|
|
@@ -1278,7 +1602,7 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
1278
1602
|
}
|
|
1279
1603
|
this.updateAriaAttribute();
|
|
1280
1604
|
};
|
|
1281
|
-
MultiSelect.prototype.arrowUp = function (e) {
|
|
1605
|
+
MultiSelect.prototype.arrowUp = function (e, isVirtualKeyAction) {
|
|
1282
1606
|
e.preventDefault();
|
|
1283
1607
|
this.keyAction = true;
|
|
1284
1608
|
var list = this.list.querySelectorAll('li.'
|
|
@@ -1296,7 +1620,7 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
1296
1620
|
this.keyAction = false;
|
|
1297
1621
|
this.notify('inputFocus', { module: 'CheckBoxSelection', enable: this.mode === 'CheckBox', value: 'focus' });
|
|
1298
1622
|
}
|
|
1299
|
-
this.moveByList(-1);
|
|
1623
|
+
this.moveByList(-1, isVirtualKeyAction);
|
|
1300
1624
|
this.updateAriaAttribute();
|
|
1301
1625
|
};
|
|
1302
1626
|
MultiSelect.prototype.spaceKeySelection = function (e) {
|
|
@@ -1347,8 +1671,8 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
1347
1671
|
else if (e.keyCode === 8 && this.mode === 'Delimiter') {
|
|
1348
1672
|
if (this.value && this.value.length) {
|
|
1349
1673
|
e.preventDefault();
|
|
1350
|
-
var temp = this.value[this.value.length - 1];
|
|
1351
|
-
this.removeValue(
|
|
1674
|
+
var temp = this.allowObjectBinding ? getValue(((this.fields.value) ? this.fields.value : ''), this.value[this.value.length - 1]) : this.value[this.value.length - 1];
|
|
1675
|
+
this.removeValue(this.value[this.value.length - 1], e);
|
|
1352
1676
|
this.updateDelimeter(this.delimiterChar, e);
|
|
1353
1677
|
this.focusAtLastListItem(temp);
|
|
1354
1678
|
}
|
|
@@ -1363,6 +1687,9 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
1363
1687
|
};
|
|
1364
1688
|
MultiSelect.prototype.escapeAction = function () {
|
|
1365
1689
|
var temp = this.tempValues ? this.tempValues.slice() : [];
|
|
1690
|
+
if (this.allowObjectBinding) {
|
|
1691
|
+
temp = this.tempValues ? this.tempValues.slice() : [];
|
|
1692
|
+
}
|
|
1366
1693
|
if (this.value && this.validateValues(this.value, temp)) {
|
|
1367
1694
|
if (this.mode !== 'CheckBox') {
|
|
1368
1695
|
this.value = temp;
|
|
@@ -1384,36 +1711,104 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
1384
1711
|
}
|
|
1385
1712
|
this.makeTextBoxEmpty();
|
|
1386
1713
|
};
|
|
1387
|
-
MultiSelect.prototype.scrollBottom = function (selectedLI, activeIndex) {
|
|
1714
|
+
MultiSelect.prototype.scrollBottom = function (selectedLI, activeIndex, isInitialSelection, keyCode) {
|
|
1715
|
+
if (isInitialSelection === void 0) { isInitialSelection = false; }
|
|
1716
|
+
if (keyCode === void 0) { keyCode = null; }
|
|
1717
|
+
if ((!isNullOrUndefined(selectedLI) && selectedLI.classList.contains('e-virtual-list')) || (this.enableVirtualization && isNullOrUndefined(selectedLI))) {
|
|
1718
|
+
selectedLI = this.liCollections[this.skeletonCount];
|
|
1719
|
+
}
|
|
1720
|
+
this.isUpwardScrolling = false;
|
|
1721
|
+
var virtualListCount = this.list.querySelectorAll('.e-virtual-list').length;
|
|
1722
|
+
var lastElementValue = this.list.querySelector('li:last-of-type') ? this.list.querySelector('li:last-of-type').getAttribute('data-value') : null;
|
|
1723
|
+
var selectedLiOffsetTop = this.virtualListInfo && this.virtualListInfo.startIndex ? selectedLI.offsetTop + (this.virtualListInfo.startIndex * selectedLI.offsetHeight) : selectedLI.offsetTop;
|
|
1388
1724
|
var currentOffset = this.list.offsetHeight;
|
|
1389
|
-
var nextBottom = selectedLI.
|
|
1725
|
+
var nextBottom = selectedLiOffsetTop - (virtualListCount * selectedLI.offsetHeight) + selectedLI.offsetHeight - this.list.scrollTop;
|
|
1390
1726
|
var nextOffset = this.list.scrollTop + nextBottom - currentOffset;
|
|
1391
|
-
var
|
|
1727
|
+
var isScrollerCHanged = false;
|
|
1728
|
+
var isScrollTopChanged = false;
|
|
1729
|
+
var boxRange = selectedLiOffsetTop - (virtualListCount * selectedLI.offsetHeight) + selectedLI.offsetHeight - this.list.scrollTop;
|
|
1392
1730
|
boxRange = this.fields.groupBy && !isNullOrUndefined(this.fixedHeaderElement) ?
|
|
1393
1731
|
boxRange - this.fixedHeaderElement.offsetHeight : boxRange;
|
|
1394
|
-
if (activeIndex === 0) {
|
|
1732
|
+
if (activeIndex === 0 && !this.enableVirtualization) {
|
|
1395
1733
|
this.list.scrollTop = 0;
|
|
1396
1734
|
}
|
|
1397
|
-
else if (nextBottom > currentOffset) {
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1735
|
+
else if (nextBottom > currentOffset || !(boxRange > 0 && this.list.offsetHeight > boxRange)) {
|
|
1736
|
+
var currentElementValue = selectedLI ? selectedLI.getAttribute('data-value') : null;
|
|
1737
|
+
var liCount = keyCode == 34 ? this.getPageCount() - 1 : 1;
|
|
1738
|
+
if (!this.enableVirtualization || this.isKeyBoardAction || isInitialSelection) {
|
|
1739
|
+
if (this.isKeyBoardAction && this.enableVirtualization && lastElementValue && currentElementValue === lastElementValue && keyCode != 35 && !this.isVirtualScrolling) {
|
|
1740
|
+
this.isPreventKeyAction = true;
|
|
1741
|
+
this.list.scrollTop += selectedLI.offsetHeight * liCount;
|
|
1742
|
+
this.isPreventKeyAction = this.IsScrollerAtEnd() ? false : this.isPreventKeyAction;
|
|
1743
|
+
this.isKeyBoardAction = false;
|
|
1744
|
+
this.isPreventScrollAction = false;
|
|
1745
|
+
}
|
|
1746
|
+
else if (this.enableVirtualization && keyCode == 35) {
|
|
1747
|
+
this.isPreventKeyAction = false;
|
|
1748
|
+
this.isKeyBoardAction = false;
|
|
1749
|
+
this.isPreventScrollAction = false;
|
|
1750
|
+
this.list.scrollTop = this.list.scrollHeight;
|
|
1751
|
+
}
|
|
1752
|
+
else {
|
|
1753
|
+
if (keyCode == 34 && this.enableVirtualization && !this.isVirtualScrolling) {
|
|
1754
|
+
this.isPreventKeyAction = false;
|
|
1755
|
+
this.isKeyBoardAction = false;
|
|
1756
|
+
this.isPreventScrollAction = false;
|
|
1757
|
+
nextOffset = nextOffset + (selectedLI.offsetHeight * liCount);
|
|
1758
|
+
}
|
|
1759
|
+
this.list.scrollTop = nextOffset;
|
|
1760
|
+
}
|
|
1761
|
+
}
|
|
1762
|
+
else {
|
|
1763
|
+
this.list.scrollTop = this.virtualListInfo && this.virtualListInfo.startIndex ? this.virtualListInfo.startIndex * this.listItemHeight : 0;
|
|
1764
|
+
}
|
|
1765
|
+
isScrollerCHanged = this.isKeyBoardAction;
|
|
1766
|
+
isScrollTopChanged = true;
|
|
1402
1767
|
}
|
|
1768
|
+
this.isKeyBoardAction = isScrollerCHanged;
|
|
1403
1769
|
};
|
|
1404
|
-
MultiSelect.prototype.scrollTop = function (selectedLI, activeIndex) {
|
|
1405
|
-
|
|
1770
|
+
MultiSelect.prototype.scrollTop = function (selectedLI, activeIndex, keyCode) {
|
|
1771
|
+
if (keyCode === void 0) { keyCode = null; }
|
|
1772
|
+
var virtualListCount = this.list.querySelectorAll('.e-virtual-list').length;
|
|
1773
|
+
var selectedLiOffsetTop = (this.virtualListInfo && this.virtualListInfo.startIndex) ? selectedLI.offsetTop + (this.virtualListInfo.startIndex * selectedLI.offsetHeight) : selectedLI.offsetTop;
|
|
1774
|
+
var nextOffset = selectedLiOffsetTop - (virtualListCount * selectedLI.offsetHeight) - this.list.scrollTop;
|
|
1775
|
+
var firstElementValue = this.list.querySelector('li.e-list-item:not(.e-virtual-list)') ? this.list.querySelector('li.e-list-item:not(.e-virtual-list)').getAttribute('data-value') : null;
|
|
1406
1776
|
nextOffset = this.fields.groupBy && !isUndefined(this.fixedHeaderElement) ?
|
|
1407
1777
|
nextOffset - this.fixedHeaderElement.offsetHeight : nextOffset;
|
|
1408
|
-
var boxRange = (selectedLI.
|
|
1409
|
-
|
|
1778
|
+
var boxRange = (selectedLiOffsetTop - (virtualListCount * selectedLI.offsetHeight) + selectedLI.offsetHeight - this.list.scrollTop);
|
|
1779
|
+
var isPageUpKeyAction = this.enableVirtualization && this.getModuleName() === 'autocomplete' && nextOffset <= 0;
|
|
1780
|
+
if (activeIndex === 0 && !this.enableVirtualization) {
|
|
1410
1781
|
this.list.scrollTop = 0;
|
|
1411
1782
|
}
|
|
1412
|
-
else if (nextOffset < 0) {
|
|
1413
|
-
|
|
1783
|
+
else if (nextOffset < 0 || isPageUpKeyAction) {
|
|
1784
|
+
var currentElementValue = selectedLI ? selectedLI.getAttribute('data-value') : null;
|
|
1785
|
+
var liCount = keyCode == 33 ? this.getPageCount() - 2 : 1;
|
|
1786
|
+
if (this.enableVirtualization && this.isKeyBoardAction && firstElementValue && currentElementValue === firstElementValue && keyCode != 36 && !this.isVirtualScrolling) {
|
|
1787
|
+
this.isUpwardScrolling = true;
|
|
1788
|
+
this.isPreventKeyAction = true;
|
|
1789
|
+
this.list.scrollTop -= selectedLI.offsetHeight * liCount;
|
|
1790
|
+
this.isPreventKeyAction = this.list.scrollTop != 0 ? this.isPreventKeyAction : false;
|
|
1791
|
+
this.isKeyBoardAction = false;
|
|
1792
|
+
this.isPreventScrollAction = false;
|
|
1793
|
+
}
|
|
1794
|
+
else if (this.enableVirtualization && keyCode == 36) {
|
|
1795
|
+
this.isPreventScrollAction = false;
|
|
1796
|
+
this.isPreventKeyAction = true;
|
|
1797
|
+
this.isKeyBoardAction = false;
|
|
1798
|
+
this.list.scrollTo(0, 0);
|
|
1799
|
+
}
|
|
1800
|
+
else {
|
|
1801
|
+
if (keyCode == 33 && this.enableVirtualization && !this.isVirtualScrolling) {
|
|
1802
|
+
this.isPreventKeyAction = false;
|
|
1803
|
+
this.isKeyBoardAction = false;
|
|
1804
|
+
this.isPreventScrollAction = false;
|
|
1805
|
+
nextOffset = nextOffset - (selectedLI.offsetHeight * liCount);
|
|
1806
|
+
}
|
|
1807
|
+
this.list.scrollTop = this.list.scrollTop + nextOffset;
|
|
1808
|
+
}
|
|
1414
1809
|
}
|
|
1415
1810
|
else if (!(boxRange > 0 && this.list.offsetHeight > boxRange)) {
|
|
1416
|
-
this.list.scrollTop = selectedLI.offsetTop - (this.fields.groupBy && !
|
|
1811
|
+
this.list.scrollTop = selectedLI.offsetTop - (this.fields.groupBy && !isNullOrUndefined(this.fixedHeaderElement) ?
|
|
1417
1812
|
this.fixedHeaderElement.offsetHeight : 0);
|
|
1418
1813
|
}
|
|
1419
1814
|
};
|
|
@@ -1500,7 +1895,19 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
1500
1895
|
if ((this.allowFiltering || (this.mode === 'CheckBox' && this.enableSelectionOrder === true)
|
|
1501
1896
|
|| this.allowCustomValue) && this.mainList && this.listData) {
|
|
1502
1897
|
var list = this.mainList.cloneNode ? this.mainList.cloneNode(true) : this.mainList;
|
|
1503
|
-
|
|
1898
|
+
if (this.enableVirtualization) {
|
|
1899
|
+
if (this.allowCustomValue && this.virtualCustomData && data == null && this.virtualCustomData && this.viewPortInfo && this.viewPortInfo.startIndex === 0 && this.viewPortInfo.endIndex === this.itemCount) {
|
|
1900
|
+
this.virtualCustomData = null;
|
|
1901
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1902
|
+
this.renderItems(this.mainData, this.fields);
|
|
1903
|
+
}
|
|
1904
|
+
else {
|
|
1905
|
+
this.onActionComplete(this.list, this.listData);
|
|
1906
|
+
}
|
|
1907
|
+
}
|
|
1908
|
+
else {
|
|
1909
|
+
this.onActionComplete(list, this.mainData);
|
|
1910
|
+
}
|
|
1504
1911
|
this.focusAtLastListItem(data);
|
|
1505
1912
|
if (this.value && this.value.length) {
|
|
1506
1913
|
this.refreshSelection();
|
|
@@ -1515,14 +1922,15 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
1515
1922
|
var temp;
|
|
1516
1923
|
if (selectedElem !== null) {
|
|
1517
1924
|
if (!isNullOrUndefined(this.value)) {
|
|
1518
|
-
this.tempValues = this.value.slice();
|
|
1925
|
+
this.tempValues = this.allowObjectBinding ? this.value.slice() : this.value.slice();
|
|
1519
1926
|
}
|
|
1520
1927
|
temp = selectedElem.nextElementSibling;
|
|
1521
1928
|
if (temp !== null) {
|
|
1522
1929
|
this.removeChipSelection();
|
|
1523
1930
|
this.addChipSelection(temp, e);
|
|
1524
1931
|
}
|
|
1525
|
-
this.
|
|
1932
|
+
var currentChip = this.allowObjectBinding ? this.getDataByValue(selectedElem.getAttribute('data-value')) : selectedElem.getAttribute('data-value');
|
|
1933
|
+
this.removeValue(currentChip, e);
|
|
1526
1934
|
this.makeTextBoxEmpty();
|
|
1527
1935
|
}
|
|
1528
1936
|
if (this.closePopupOnSelect) {
|
|
@@ -1549,7 +1957,7 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
1549
1957
|
selectAllParent.classList.remove('e-item-focus');
|
|
1550
1958
|
}
|
|
1551
1959
|
};
|
|
1552
|
-
MultiSelect.prototype.moveByList = function (position) {
|
|
1960
|
+
MultiSelect.prototype.moveByList = function (position, isVirtualKeyAction) {
|
|
1553
1961
|
if (this.list) {
|
|
1554
1962
|
var elements = this.list.querySelectorAll('li.'
|
|
1555
1963
|
+ dropDownBaseClasses.li
|
|
@@ -1560,6 +1968,9 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
1560
1968
|
+ ':not(.' + HIDE_LIST + ')' + ':not(.e-reorder-hide)');
|
|
1561
1969
|
}
|
|
1562
1970
|
var selectedElem = this.list.querySelector('li.' + dropDownBaseClasses.focus);
|
|
1971
|
+
if (this.enableVirtualization && isVirtualKeyAction && !isNullOrUndefined(this.currentFocuedListElement)) {
|
|
1972
|
+
selectedElem = this.getElementByValue(this.getFormattedValue(this.currentFocuedListElement.getAttribute('data-value')));
|
|
1973
|
+
}
|
|
1563
1974
|
var temp = -1;
|
|
1564
1975
|
var selectAllParent = document.getElementsByClassName('e-selectall-parent')[0];
|
|
1565
1976
|
if (this.mode === 'CheckBox' && this.showSelectAll && position == 1 && !isNullOrUndefined(selectAllParent) && !selectAllParent.classList.contains('e-item-focus') && this.list.getElementsByClassName('e-item-focus').length == 0 && this.liCollections.length > 1) {
|
|
@@ -1588,22 +1999,57 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
1588
1999
|
if (position > 0) {
|
|
1589
2000
|
if (temp < (elements.length - 1)) {
|
|
1590
2001
|
this.removeFocus();
|
|
1591
|
-
this.
|
|
1592
|
-
|
|
1593
|
-
|
|
2002
|
+
if (this.enableVirtualization && isVirtualKeyAction) {
|
|
2003
|
+
this.addListFocus(elements[temp]);
|
|
2004
|
+
}
|
|
2005
|
+
else {
|
|
2006
|
+
this.addListFocus(elements[++temp]);
|
|
2007
|
+
}
|
|
2008
|
+
if (temp > -1) {
|
|
2009
|
+
this.updateCheck(elements[temp]);
|
|
2010
|
+
this.scrollBottom(elements[temp], temp);
|
|
2011
|
+
this.currentFocuedListElement = elements[temp];
|
|
2012
|
+
}
|
|
1594
2013
|
}
|
|
1595
2014
|
}
|
|
1596
2015
|
else {
|
|
1597
2016
|
if (temp > 0) {
|
|
1598
|
-
this.
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
2017
|
+
if (this.enableVirtualization) {
|
|
2018
|
+
var isVirtualElement = elements[temp - 1].classList.contains('e-virtual-list');
|
|
2019
|
+
var elementIndex = isVirtualKeyAction ? temp : temp - 1;
|
|
2020
|
+
if (isVirtualKeyAction || !isVirtualElement) {
|
|
2021
|
+
this.removeFocus();
|
|
2022
|
+
}
|
|
2023
|
+
if (isVirtualKeyAction || !isVirtualElement) {
|
|
2024
|
+
this.addListFocus(elements[elementIndex]);
|
|
2025
|
+
this.updateCheck(elements[elementIndex]);
|
|
2026
|
+
this.scrollTop(elements[elementIndex], temp);
|
|
2027
|
+
this.currentFocuedListElement = elements[elementIndex];
|
|
2028
|
+
}
|
|
2029
|
+
}
|
|
2030
|
+
else {
|
|
2031
|
+
this.removeFocus();
|
|
2032
|
+
this.addListFocus(elements[--temp]);
|
|
2033
|
+
this.updateCheck(elements[temp]);
|
|
2034
|
+
this.scrollTop(elements[temp], temp);
|
|
2035
|
+
}
|
|
1602
2036
|
}
|
|
1603
2037
|
}
|
|
1604
2038
|
}
|
|
1605
2039
|
}
|
|
1606
2040
|
};
|
|
2041
|
+
MultiSelect.prototype.getElementByValue = function (value) {
|
|
2042
|
+
var item;
|
|
2043
|
+
var listItems = this.getItems();
|
|
2044
|
+
for (var _i = 0, listItems_1 = listItems; _i < listItems_1.length; _i++) {
|
|
2045
|
+
var liItem = listItems_1[_i];
|
|
2046
|
+
if (this.getFormattedValue(liItem.getAttribute('data-value')) === value) {
|
|
2047
|
+
item = liItem;
|
|
2048
|
+
break;
|
|
2049
|
+
}
|
|
2050
|
+
}
|
|
2051
|
+
return item;
|
|
2052
|
+
};
|
|
1607
2053
|
MultiSelect.prototype.updateCheck = function (element) {
|
|
1608
2054
|
if (this.mode === 'CheckBox' && this.enableGroupCheckBox &&
|
|
1609
2055
|
!isNullOrUndefined(this.fields.groupBy)) {
|
|
@@ -1665,7 +2111,7 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
1665
2111
|
if (this.enabled && !this.readonly) {
|
|
1666
2112
|
var element = e.target.parentElement;
|
|
1667
2113
|
var customVal = element.getAttribute('data-value');
|
|
1668
|
-
var value = this.getFormattedValue(customVal);
|
|
2114
|
+
var value = this.allowObjectBinding ? this.getDataByValue(customVal) : this.getFormattedValue(customVal);
|
|
1669
2115
|
if (this.allowCustomValue && ((customVal !== 'false' && value === false) ||
|
|
1670
2116
|
(!isNullOrUndefined(value) && value.toString() === 'NaN'))) {
|
|
1671
2117
|
value = customVal;
|
|
@@ -1677,6 +2123,7 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
1677
2123
|
this.inputElement.focus();
|
|
1678
2124
|
}
|
|
1679
2125
|
this.removeValue(value, e);
|
|
2126
|
+
value = this.allowObjectBinding ? getValue((this.fields.value) ? this.fields.value : '', value) : value;
|
|
1680
2127
|
if (isNullOrUndefined(this.findListElement(this.list, 'li', 'data-value', value)) && this.mainList && this.listData) {
|
|
1681
2128
|
var list = this.mainList.cloneNode ? this.mainList.cloneNode(true) : this.mainList;
|
|
1682
2129
|
this.onActionComplete(list, this.mainData);
|
|
@@ -1711,7 +2158,7 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
1711
2158
|
this.expandTextbox();
|
|
1712
2159
|
};
|
|
1713
2160
|
MultiSelect.prototype.removeAllItems = function (value, eve, isClearAll, element, mainElement) {
|
|
1714
|
-
var index = this.value.indexOf(value);
|
|
2161
|
+
var index = this.allowObjectBinding ? this.indexOfObjectInArray(value, this.value) : this.value.indexOf(value);
|
|
1715
2162
|
var removeVal = this.value.slice(0);
|
|
1716
2163
|
removeVal.splice(index, 1);
|
|
1717
2164
|
this.setProperties({ value: [].concat([], removeVal) }, true);
|
|
@@ -1726,7 +2173,8 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
1726
2173
|
e: this, index: index
|
|
1727
2174
|
});
|
|
1728
2175
|
this.invokeCheckboxSelection(element, eve, isClearAll);
|
|
1729
|
-
this.
|
|
2176
|
+
var currentValue = this.allowObjectBinding ? getValue(((this.fields.value) ? this.fields.value : ''), value) : value;
|
|
2177
|
+
this.updateMainList(true, currentValue, mainElement);
|
|
1730
2178
|
this.updateChipStatus();
|
|
1731
2179
|
};
|
|
1732
2180
|
MultiSelect.prototype.invokeCheckboxSelection = function (element, eve, isClearAll) {
|
|
@@ -1743,9 +2191,9 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
1743
2191
|
};
|
|
1744
2192
|
MultiSelect.prototype.removeValue = function (value, eve, length, isClearAll) {
|
|
1745
2193
|
var _this = this;
|
|
1746
|
-
var index = this.value.indexOf(this.getFormattedValue(value));
|
|
2194
|
+
var index = this.allowObjectBinding ? this.indexOfObjectInArray(value, this.value) : this.value.indexOf(this.getFormattedValue(value));
|
|
1747
2195
|
if (index === -1 && this.allowCustomValue && !isNullOrUndefined(value)) {
|
|
1748
|
-
index = this.value.indexOf(value.toString());
|
|
2196
|
+
index = this.allowObjectBinding ? this.indexOfObjectInArray(value, this.value) : this.value.indexOf(value.toString());
|
|
1749
2197
|
}
|
|
1750
2198
|
var targetEle = eve && eve.target;
|
|
1751
2199
|
isClearAll = (isClearAll || targetEle && targetEle.classList.contains('e-close-hooker')) ? true : null;
|
|
@@ -1753,7 +2201,8 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
1753
2201
|
HIDE_LIST :
|
|
1754
2202
|
dropDownBaseClasses.selected;
|
|
1755
2203
|
if (index !== -1) {
|
|
1756
|
-
var
|
|
2204
|
+
var currentValue = this.allowObjectBinding ? getValue(((this.fields.value) ? this.fields.value : ''), value) : value;
|
|
2205
|
+
var element_1 = this.findListElement(this.list, 'li', 'data-value', currentValue);
|
|
1757
2206
|
var val_1 = this.getDataByValue(value);
|
|
1758
2207
|
var eventArgs = {
|
|
1759
2208
|
e: eve,
|
|
@@ -1767,11 +2216,20 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
1767
2216
|
_this.removeIndex++;
|
|
1768
2217
|
}
|
|
1769
2218
|
else {
|
|
2219
|
+
_this.virtualSelectAll = false;
|
|
1770
2220
|
var removeVal = _this.value.slice(0);
|
|
2221
|
+
if (_this.enableVirtualization && isClearAll) {
|
|
2222
|
+
removeVal = [];
|
|
2223
|
+
}
|
|
1771
2224
|
removeVal.splice(index, 1);
|
|
1772
2225
|
_this.setProperties({ value: [].concat([], removeVal) }, true);
|
|
2226
|
+
if (_this.enableVirtualization) {
|
|
2227
|
+
var currentText = index == 0 ? _this.text.replace(_this.text.split(_this.delimiterChar)[index] + _this.delimiterChar, '') : _this.text.replace(_this.delimiterChar + _this.text.split(_this.delimiterChar)[index], '');
|
|
2228
|
+
_this.setProperties({ text: currentText.toString() }, true);
|
|
2229
|
+
}
|
|
1773
2230
|
if (element_1 !== null) {
|
|
1774
|
-
var
|
|
2231
|
+
var currentValue_1 = _this.allowObjectBinding ? getValue(((_this.fields.value) ? _this.fields.value : ''), value) : value;
|
|
2232
|
+
var hideElement = _this.findListElement(_this.mainList, 'li', 'data-value', currentValue_1);
|
|
1775
2233
|
element_1.setAttribute('aria-selected', 'false');
|
|
1776
2234
|
removeClass([element_1], className);
|
|
1777
2235
|
if (hideElement) {
|
|
@@ -1785,15 +2243,16 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
1785
2243
|
});
|
|
1786
2244
|
_this.invokeCheckboxSelection(element_1, eve, isClearAll);
|
|
1787
2245
|
}
|
|
2246
|
+
var currentValue_2 = _this.allowObjectBinding ? getValue(((_this.fields.value) ? _this.fields.value : ''), value) : value;
|
|
1788
2247
|
if (_this.hideSelectedItem && _this.fields.groupBy && element_1) {
|
|
1789
|
-
_this.hideGroupItem(
|
|
2248
|
+
_this.hideGroupItem(currentValue_2);
|
|
1790
2249
|
}
|
|
1791
2250
|
if (_this.hideSelectedItem && _this.fixedHeaderElement && _this.fields.groupBy && _this.mode !== 'CheckBox' &&
|
|
1792
2251
|
_this.isPopupOpen()) {
|
|
1793
2252
|
_super.prototype.scrollStop.call(_this);
|
|
1794
2253
|
}
|
|
1795
|
-
_this.updateMainList(true,
|
|
1796
|
-
_this.removeChip(
|
|
2254
|
+
_this.updateMainList(true, currentValue_2);
|
|
2255
|
+
_this.removeChip(currentValue_2, isClearAll);
|
|
1797
2256
|
_this.updateChipStatus();
|
|
1798
2257
|
var limit = _this.value && _this.value.length ? _this.value.length : 0;
|
|
1799
2258
|
if (limit < _this.maximumSelectionLength) {
|
|
@@ -1829,6 +2288,14 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
1829
2288
|
if (isClearAll && (length === 1 || length === null)) {
|
|
1830
2289
|
_this.clearAllCallback(eve, isClearAll);
|
|
1831
2290
|
}
|
|
2291
|
+
if (_this.isPopupOpen() && element_1 && element_1.parentElement.classList.contains('e-reorder')) {
|
|
2292
|
+
if (_this.hideSelectedItem && _this.value && Array.isArray(_this.value) && _this.value.length > 0) {
|
|
2293
|
+
_this.totalItemsCount();
|
|
2294
|
+
}
|
|
2295
|
+
_this.notify("setCurrentViewDataAsync", {
|
|
2296
|
+
module: "VirtualScroll",
|
|
2297
|
+
});
|
|
2298
|
+
}
|
|
1832
2299
|
}
|
|
1833
2300
|
});
|
|
1834
2301
|
}
|
|
@@ -1859,11 +2326,16 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
1859
2326
|
}
|
|
1860
2327
|
}
|
|
1861
2328
|
};
|
|
1862
|
-
MultiSelect.prototype.removeChip = function (value) {
|
|
2329
|
+
MultiSelect.prototype.removeChip = function (value, isClearAll) {
|
|
1863
2330
|
if (this.chipCollectionWrapper) {
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
2331
|
+
if (this.enableVirtualization && isClearAll) {
|
|
2332
|
+
var childElements = this.chipCollectionWrapper.querySelectorAll('.e-chips');
|
|
2333
|
+
}
|
|
2334
|
+
else {
|
|
2335
|
+
var element = this.findListElement(this.chipCollectionWrapper, 'span', 'data-value', value);
|
|
2336
|
+
if (element) {
|
|
2337
|
+
remove(element);
|
|
2338
|
+
}
|
|
1867
2339
|
}
|
|
1868
2340
|
}
|
|
1869
2341
|
};
|
|
@@ -1897,12 +2369,45 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
1897
2369
|
this.hideOverAllClear();
|
|
1898
2370
|
}
|
|
1899
2371
|
};
|
|
2372
|
+
MultiSelect.prototype.indexOfObjectInArray = function (objectToFind, array) {
|
|
2373
|
+
var _loop_1 = function (i) {
|
|
2374
|
+
var item = array[i];
|
|
2375
|
+
if (Object.keys(objectToFind).every(function (key) { return item.hasOwnProperty(key) && item[key] === objectToFind[key]; })) {
|
|
2376
|
+
return { value: i };
|
|
2377
|
+
}
|
|
2378
|
+
};
|
|
2379
|
+
for (var i = 0; i < array.length; i++) {
|
|
2380
|
+
var state_1 = _loop_1(i);
|
|
2381
|
+
if (typeof state_1 === "object")
|
|
2382
|
+
return state_1.value;
|
|
2383
|
+
}
|
|
2384
|
+
return -1; // Return -1 if the object is not found
|
|
2385
|
+
};
|
|
1900
2386
|
MultiSelect.prototype.addValue = function (value, text, eve) {
|
|
1901
2387
|
if (!this.value) {
|
|
1902
2388
|
this.value = [];
|
|
1903
2389
|
}
|
|
1904
|
-
|
|
1905
|
-
|
|
2390
|
+
var currentValue = this.allowObjectBinding ? this.getDataByValue(value) : value;
|
|
2391
|
+
if ((this.allowObjectBinding && !this.isObjectInArray(value, this.value)) || (!this.allowObjectBinding && this.value.indexOf(currentValue) < 0)) {
|
|
2392
|
+
this.setProperties({ value: [].concat([], this.value, [currentValue]) }, true);
|
|
2393
|
+
if (this.enableVirtualization) {
|
|
2394
|
+
var data = this.viewWrapper.innerHTML;
|
|
2395
|
+
var temp = void 0;
|
|
2396
|
+
data += (this.value.length === 1) ? '' : this.delimiterChar + ' ';
|
|
2397
|
+
temp = this.getOverflowVal(this.value.length - 1);
|
|
2398
|
+
data += temp;
|
|
2399
|
+
temp = this.viewWrapper.innerHTML;
|
|
2400
|
+
this.updateWrapperText(this.viewWrapper, data);
|
|
2401
|
+
}
|
|
2402
|
+
if (this.enableVirtualization && this.mode === 'CheckBox') {
|
|
2403
|
+
var temp = void 0;
|
|
2404
|
+
var currentText = [];
|
|
2405
|
+
var value_1 = this.allowObjectBinding ? getValue(((this.fields.value) ? this.fields.value : ''), this.value[this.value.length - 1]) : this.value[this.value.length - 1];
|
|
2406
|
+
temp = this.getTextByValue(value_1);
|
|
2407
|
+
var textValues = this.text != null ? this.text + ',' + temp : temp;
|
|
2408
|
+
currentText.push(textValues);
|
|
2409
|
+
this.setProperties({ text: currentText.toString() }, true);
|
|
2410
|
+
}
|
|
1906
2411
|
}
|
|
1907
2412
|
var element = this.findListElement(this.list, 'li', 'data-value', value);
|
|
1908
2413
|
this.removeFocus();
|
|
@@ -1931,6 +2436,7 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
1931
2436
|
var _this = this;
|
|
1932
2437
|
var list = this.listData;
|
|
1933
2438
|
if (this.initStatus && !isNotTrigger) {
|
|
2439
|
+
value = this.allowObjectBinding ? getValue(((this.fields.value) ? this.fields.value : ''), value) : value;
|
|
1934
2440
|
var val_2 = this.getDataByValue(value);
|
|
1935
2441
|
var eventArgs = {
|
|
1936
2442
|
e: eve,
|
|
@@ -1959,7 +2465,10 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
1959
2465
|
if (_this.allowCustomValue && _this.isServerRendered && _this.listData !== list) {
|
|
1960
2466
|
_this.listData = list;
|
|
1961
2467
|
}
|
|
1962
|
-
_this.
|
|
2468
|
+
value = _this.allowObjectBinding ? _this.getDataByValue(value) : value;
|
|
2469
|
+
if ((_this.enableVirtualization && value) || !_this.enableVirtualization) {
|
|
2470
|
+
_this.updateListSelectEventCallback(value, element, eve);
|
|
2471
|
+
}
|
|
1963
2472
|
if (_this.hideSelectedItem && _this.fixedHeaderElement && _this.fields.groupBy && _this.mode !== 'CheckBox') {
|
|
1964
2473
|
_super.prototype.scrollStop.call(_this);
|
|
1965
2474
|
}
|
|
@@ -2044,7 +2553,7 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
2044
2553
|
chipContent.innerText = data;
|
|
2045
2554
|
}
|
|
2046
2555
|
else {
|
|
2047
|
-
chipContent.innerHTML = this.encodeHtmlEntities(data);
|
|
2556
|
+
chipContent.innerHTML = this.encodeHtmlEntities(data.toString());
|
|
2048
2557
|
}
|
|
2049
2558
|
chip.appendChild(chipContent);
|
|
2050
2559
|
var eventArgs = {
|
|
@@ -2130,6 +2639,37 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
2130
2639
|
overAllHeight -= this.header.offsetHeight;
|
|
2131
2640
|
}
|
|
2132
2641
|
append([this.list], this.popupWrapper);
|
|
2642
|
+
if (!this.list.classList.contains(dropDownBaseClasses.noData) && this.getItems()[1]) {
|
|
2643
|
+
this.listItemHeight = this.getItems()[1].offsetHeight;
|
|
2644
|
+
}
|
|
2645
|
+
if (this.enableVirtualization && !this.list.classList.contains(dropDownBaseClasses.noData)) {
|
|
2646
|
+
if (!this.list.querySelector('.e-virtual-ddl-content') && this.list.querySelector('.e-list-parent')) {
|
|
2647
|
+
this.list.appendChild(this.createElement('div', {
|
|
2648
|
+
className: 'e-virtual-ddl-content',
|
|
2649
|
+
styles: this.getTransformValues()
|
|
2650
|
+
})).appendChild(this.list.querySelector('.e-list-parent'));
|
|
2651
|
+
}
|
|
2652
|
+
else if (this.list.querySelector('.e-virtual-ddl-content')) {
|
|
2653
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2654
|
+
this.list.getElementsByClassName('e-virtual-ddl-content')[0].style = this.getTransformValues();
|
|
2655
|
+
}
|
|
2656
|
+
this.UpdateSkeleton();
|
|
2657
|
+
this.liCollections = this.list.querySelectorAll('.' + dropDownBaseClasses.li);
|
|
2658
|
+
this.virtualItemCount = this.itemCount;
|
|
2659
|
+
if (this.mode !== 'CheckBox') {
|
|
2660
|
+
this.totalItemCount = this.value && this.value.length ? this.totalItemCount - this.value.length : this.totalItemCount;
|
|
2661
|
+
}
|
|
2662
|
+
if (!this.list.querySelector('.e-virtual-ddl')) {
|
|
2663
|
+
var virualElement = this.createElement('div', {
|
|
2664
|
+
id: this.element.id + '_popup', className: 'e-virtual-ddl', styles: this.GetVirtualTrackHeight()
|
|
2665
|
+
});
|
|
2666
|
+
this.popupWrapper.querySelector('.e-dropdownbase').appendChild(virualElement);
|
|
2667
|
+
}
|
|
2668
|
+
else {
|
|
2669
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2670
|
+
this.list.getElementsByClassName('e-virtual-ddl')[0].style = this.GetVirtualTrackHeight();
|
|
2671
|
+
}
|
|
2672
|
+
}
|
|
2133
2673
|
if (this.footerTemplate) {
|
|
2134
2674
|
this.setFooterTemplate();
|
|
2135
2675
|
overAllHeight -= this.footer.offsetHeight;
|
|
@@ -2202,21 +2742,42 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
2202
2742
|
}
|
|
2203
2743
|
_this.popupObj.wireScrollEvents();
|
|
2204
2744
|
if (!(_this.mode !== 'CheckBox' && (_this.allowFiltering || _this.allowCustomValue) &&
|
|
2205
|
-
_this.targetElement().trim() !== '')) {
|
|
2745
|
+
_this.targetElement().trim() !== '') && !_this.enableVirtualization) {
|
|
2206
2746
|
_this.loadTemplate();
|
|
2747
|
+
if (_this.enableVirtualization && _this.mode === 'CheckBox') {
|
|
2748
|
+
_this.UpdateSkeleton();
|
|
2749
|
+
}
|
|
2207
2750
|
}
|
|
2751
|
+
_this.isPreventScrollAction = true;
|
|
2208
2752
|
_this.setScrollPosition();
|
|
2209
2753
|
if (_this.allowFiltering) {
|
|
2210
2754
|
_this.notify('inputFocus', {
|
|
2211
2755
|
module: 'CheckBoxSelection', enable: _this.mode === 'CheckBox', value: 'focus'
|
|
2212
2756
|
});
|
|
2213
2757
|
}
|
|
2758
|
+
if (_this.enableVirtualization) {
|
|
2759
|
+
_this.notify("bindScrollEvent", {
|
|
2760
|
+
module: "VirtualScroll",
|
|
2761
|
+
component: _this.getModuleName(),
|
|
2762
|
+
enable: _this.enableVirtualization,
|
|
2763
|
+
});
|
|
2764
|
+
setTimeout(function () {
|
|
2765
|
+
if (_this.value) {
|
|
2766
|
+
_this.updateSelectionList();
|
|
2767
|
+
}
|
|
2768
|
+
else if (_this.viewPortInfo && _this.viewPortInfo.offsets.top) {
|
|
2769
|
+
_this.list.scrollTop = _this.viewPortInfo.offsets.top;
|
|
2770
|
+
}
|
|
2771
|
+
}, 5);
|
|
2772
|
+
}
|
|
2214
2773
|
}, targetExitViewport: function () {
|
|
2215
2774
|
if (!Browser.isDevice) {
|
|
2216
2775
|
_this.hidePopup();
|
|
2217
2776
|
}
|
|
2218
2777
|
}
|
|
2219
2778
|
});
|
|
2779
|
+
this.checkCollision(this.popupWrapper);
|
|
2780
|
+
this.popupContentElement = this.popupObj.element.querySelector('.e-content');
|
|
2220
2781
|
if (this.mode === 'CheckBox' && Browser.isDevice && this.allowFiltering) {
|
|
2221
2782
|
this.notify('deviceSearchBox', { module: 'CheckBoxSelection', enable: this.mode === 'CheckBox' });
|
|
2222
2783
|
}
|
|
@@ -2225,6 +2786,15 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
2225
2786
|
}
|
|
2226
2787
|
}
|
|
2227
2788
|
};
|
|
2789
|
+
MultiSelect.prototype.checkCollision = function (popupEle) {
|
|
2790
|
+
if (!(this.mode === 'CheckBox' && Browser.isDevice && this.allowFiltering)) {
|
|
2791
|
+
var collision = isCollide(popupEle);
|
|
2792
|
+
if (collision.length > 0) {
|
|
2793
|
+
popupEle.style.marginTop = -parseInt(getComputedStyle(popupEle).marginTop, 10) + 'px';
|
|
2794
|
+
}
|
|
2795
|
+
this.popupObj.resolveCollision();
|
|
2796
|
+
}
|
|
2797
|
+
};
|
|
2228
2798
|
MultiSelect.prototype.setHeaderTemplate = function () {
|
|
2229
2799
|
var compiledString;
|
|
2230
2800
|
if (this.header) {
|
|
@@ -2274,6 +2844,53 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
2274
2844
|
append([this.footer], this.popupWrapper);
|
|
2275
2845
|
EventHandler.add(this.footer, 'mousedown', this.onListMouseDown, this);
|
|
2276
2846
|
};
|
|
2847
|
+
MultiSelect.prototype.updateInitialData = function () {
|
|
2848
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2849
|
+
var currentData = this.selectData;
|
|
2850
|
+
var ulElement = this.renderItems(currentData, this.fields);
|
|
2851
|
+
this.list.scrollTop = 0;
|
|
2852
|
+
this.virtualListInfo = {
|
|
2853
|
+
currentPageNumber: null,
|
|
2854
|
+
direction: null,
|
|
2855
|
+
sentinelInfo: {},
|
|
2856
|
+
offsets: {},
|
|
2857
|
+
startIndex: 0,
|
|
2858
|
+
endIndex: 0,
|
|
2859
|
+
};
|
|
2860
|
+
this.previousStartIndex = 0;
|
|
2861
|
+
this.previousEndIndex = 0;
|
|
2862
|
+
if (this.dataSource instanceof DataManager) {
|
|
2863
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2864
|
+
this.totalItemCount = this.dataCount = this.virtualGroupDataSource && this.virtualGroupDataSource.length ? this.virtualGroupDataSource.length : 0;
|
|
2865
|
+
}
|
|
2866
|
+
else {
|
|
2867
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2868
|
+
this.totalItemCount = this.dataCount = this.dataSource && this.dataSource.length ? this.dataSource.length : 0;
|
|
2869
|
+
}
|
|
2870
|
+
if (this.mode !== 'CheckBox') {
|
|
2871
|
+
this.totalItemCount = this.value && this.value.length ? this.totalItemCount - this.value.length : this.totalItemCount;
|
|
2872
|
+
}
|
|
2873
|
+
this.getSkeletonCount();
|
|
2874
|
+
this.UpdateSkeleton();
|
|
2875
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2876
|
+
if (this.list.getElementsByClassName('e-virtual-ddl')[0]) {
|
|
2877
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2878
|
+
this.list.getElementsByClassName('e-virtual-ddl')[0].style = this.GetVirtualTrackHeight();
|
|
2879
|
+
}
|
|
2880
|
+
else if (!this.list.querySelector('.e-virtual-ddl') && this.skeletonCount > 0) {
|
|
2881
|
+
var virualElement = this.createElement('div', {
|
|
2882
|
+
id: this.element.id + '_popup', className: 'e-virtual-ddl', styles: this.GetVirtualTrackHeight()
|
|
2883
|
+
});
|
|
2884
|
+
this.popupWrapper.querySelector('.e-dropdownbase').appendChild(virualElement);
|
|
2885
|
+
}
|
|
2886
|
+
this.listData = currentData;
|
|
2887
|
+
this.liCollections = this.list.querySelectorAll('.e-list-item');
|
|
2888
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2889
|
+
if (this.list.getElementsByClassName('e-virtual-ddl-content')[0]) {
|
|
2890
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2891
|
+
this.list.getElementsByClassName('e-virtual-ddl-content')[0].style = this.getTransformValues();
|
|
2892
|
+
}
|
|
2893
|
+
};
|
|
2277
2894
|
MultiSelect.prototype.clearAll = function (e) {
|
|
2278
2895
|
if (this.enabled && !this.readonly) {
|
|
2279
2896
|
var temp = void 0;
|
|
@@ -2294,6 +2911,24 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
2294
2911
|
else {
|
|
2295
2912
|
this.clearAllCallback(e);
|
|
2296
2913
|
}
|
|
2914
|
+
this.checkAndResetCache();
|
|
2915
|
+
if (this.enableVirtualization) {
|
|
2916
|
+
this.updateInitialData();
|
|
2917
|
+
if (this.chipCollectionWrapper) {
|
|
2918
|
+
this.chipCollectionWrapper.innerHTML = '';
|
|
2919
|
+
}
|
|
2920
|
+
if (!this.isCustomDataUpdated) {
|
|
2921
|
+
this.notify("setGeneratedData", {
|
|
2922
|
+
module: "VirtualScroll",
|
|
2923
|
+
});
|
|
2924
|
+
}
|
|
2925
|
+
}
|
|
2926
|
+
if (this.enableVirtualization) {
|
|
2927
|
+
this.list.scrollTop = 0;
|
|
2928
|
+
this.virtualListInfo = null;
|
|
2929
|
+
this.previousStartIndex = 0;
|
|
2930
|
+
this.previousEndIndex = 0;
|
|
2931
|
+
}
|
|
2297
2932
|
}
|
|
2298
2933
|
};
|
|
2299
2934
|
MultiSelect.prototype.clearAllCallback = function (e, isClearAll) {
|
|
@@ -2394,6 +3029,8 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
2394
3029
|
MultiSelect.prototype.search = function (e) {
|
|
2395
3030
|
var _this = this;
|
|
2396
3031
|
this.resetFilteredData = true;
|
|
3032
|
+
this.preventSetCurrentData = false;
|
|
3033
|
+
this.firstItem = this.dataSource && this.dataSource.length > 0 ? this.dataSource[0] : null;
|
|
2397
3034
|
if (!isNullOrUndefined(e)) {
|
|
2398
3035
|
this.keyCode = e.keyCode;
|
|
2399
3036
|
}
|
|
@@ -2410,6 +3047,9 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
2410
3047
|
if (this.allowCustomValue) {
|
|
2411
3048
|
this.isRemoteSelection = true;
|
|
2412
3049
|
}
|
|
3050
|
+
if (!this.backCommand) {
|
|
3051
|
+
this.checkAndResetCache();
|
|
3052
|
+
}
|
|
2413
3053
|
var eventArgs_1 = {
|
|
2414
3054
|
preventDefaultAction: false,
|
|
2415
3055
|
text: this.targetElement(),
|
|
@@ -2436,12 +3076,83 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
2436
3076
|
else if (this.allowCustomValue) {
|
|
2437
3077
|
var query = new Query();
|
|
2438
3078
|
query = this.allowFiltering && (text !== '') ? query.where(this.fields.text, 'startswith', text, this.ignoreCase, this.ignoreAccent) : query;
|
|
2439
|
-
|
|
3079
|
+
if (this.enableVirtualization) {
|
|
3080
|
+
if (this.dataSource instanceof DataManager) {
|
|
3081
|
+
this.dataUpdater(this.virtualGroupDataSource, query, this.fields);
|
|
3082
|
+
}
|
|
3083
|
+
else {
|
|
3084
|
+
this.dataUpdater(this.dataSource, query, this.fields);
|
|
3085
|
+
}
|
|
3086
|
+
}
|
|
3087
|
+
else {
|
|
3088
|
+
this.dataUpdater(this.mainData, query, this.fields);
|
|
3089
|
+
}
|
|
3090
|
+
this.UpdateSkeleton();
|
|
2440
3091
|
}
|
|
2441
3092
|
else {
|
|
2442
3093
|
var liCollections = this.list.querySelectorAll('li.' + dropDownBaseClasses.li + ':not(.e-hide-listitem)');
|
|
3094
|
+
var type = this.typeOfData(this.listData).typeof;
|
|
2443
3095
|
var activeElement = Search(this.targetElement(), liCollections, 'StartsWith', this.ignoreCase);
|
|
2444
|
-
if (
|
|
3096
|
+
if (this.enableVirtualization && this.targetElement().trim() !== '' && !this.allowFiltering) {
|
|
3097
|
+
var updatingincrementalindex = false;
|
|
3098
|
+
if ((this.viewPortInfo.endIndex >= this.incrementalEndIndex && this.incrementalEndIndex <= this.totalItemCount) || this.incrementalEndIndex == 0) {
|
|
3099
|
+
updatingincrementalindex = true;
|
|
3100
|
+
this.incrementalStartIndex = 0;
|
|
3101
|
+
this.incrementalEndIndex = 100 > this.totalItemCount ? this.totalItemCount : 100;
|
|
3102
|
+
this.updateIncrementalInfo(this.incrementalStartIndex, this.incrementalEndIndex);
|
|
3103
|
+
updatingincrementalindex = false;
|
|
3104
|
+
}
|
|
3105
|
+
if (this.viewPortInfo.startIndex !== 0 || updatingincrementalindex) {
|
|
3106
|
+
this.updateIncrementalView(0, this.itemCount);
|
|
3107
|
+
}
|
|
3108
|
+
activeElement = Search(this.targetElement(), this.incrementalLiCollections, this.filterType, true, this.listData, this.fields, type);
|
|
3109
|
+
while (isNullOrUndefined(activeElement) && this.incrementalEndIndex < this.totalItemCount) {
|
|
3110
|
+
this.incrementalStartIndex = this.incrementalEndIndex;
|
|
3111
|
+
this.incrementalEndIndex = this.incrementalEndIndex + 100 > this.totalItemCount ? this.totalItemCount : this.incrementalEndIndex + 100;
|
|
3112
|
+
this.updateIncrementalInfo(this.incrementalStartIndex, this.incrementalEndIndex);
|
|
3113
|
+
updatingincrementalindex = true;
|
|
3114
|
+
if (this.viewPortInfo.startIndex !== 0 || updatingincrementalindex) {
|
|
3115
|
+
this.updateIncrementalView(0, this.itemCount);
|
|
3116
|
+
}
|
|
3117
|
+
activeElement = Search(this.targetElement(), this.incrementalLiCollections, this.filterType, true, this.listData, this.fields, type);
|
|
3118
|
+
if (!isNullOrUndefined(activeElement)) {
|
|
3119
|
+
break;
|
|
3120
|
+
}
|
|
3121
|
+
if (isNullOrUndefined(activeElement) && this.incrementalEndIndex >= this.totalItemCount) {
|
|
3122
|
+
this.incrementalStartIndex = 0;
|
|
3123
|
+
this.incrementalEndIndex = 100 > this.totalItemCount ? this.totalItemCount : 100;
|
|
3124
|
+
break;
|
|
3125
|
+
}
|
|
3126
|
+
}
|
|
3127
|
+
if (activeElement.index) {
|
|
3128
|
+
if ((!(this.viewPortInfo.startIndex >= activeElement.index)) || (!(activeElement.index >= this.viewPortInfo.endIndex))) {
|
|
3129
|
+
var startIndex = activeElement.index - ((this.itemCount / 2) - 2) > 0 ? activeElement.index - ((this.itemCount / 2) - 2) : 0;
|
|
3130
|
+
var endIndex = startIndex + this.itemCount > this.totalItemCount ? this.totalItemCount : startIndex + this.itemCount;
|
|
3131
|
+
if (startIndex != this.viewPortInfo.startIndex) {
|
|
3132
|
+
this.updateIncrementalView(startIndex, endIndex);
|
|
3133
|
+
}
|
|
3134
|
+
}
|
|
3135
|
+
}
|
|
3136
|
+
if (!isNullOrUndefined(activeElement.item)) {
|
|
3137
|
+
var index_1 = this.getIndexByValue(activeElement.item.getAttribute('data-value')) - this.skeletonCount;
|
|
3138
|
+
if (index_1 > this.itemCount / 2) {
|
|
3139
|
+
var startIndex = this.viewPortInfo.startIndex + ((this.itemCount / 2) - 2) < this.totalItemCount ? this.viewPortInfo.startIndex + ((this.itemCount / 2) - 2) : this.totalItemCount;
|
|
3140
|
+
var endIndex = this.viewPortInfo.startIndex + this.itemCount > this.totalItemCount ? this.totalItemCount : this.viewPortInfo.startIndex + this.itemCount;
|
|
3141
|
+
this.updateIncrementalView(startIndex, endIndex);
|
|
3142
|
+
}
|
|
3143
|
+
activeElement.item = this.getElementByValue(activeElement.item.getAttribute('data-value'));
|
|
3144
|
+
}
|
|
3145
|
+
else {
|
|
3146
|
+
this.updateIncrementalView(0, this.itemCount);
|
|
3147
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3148
|
+
this.list.getElementsByClassName('e-virtual-ddl-content')[0].style = this.getTransformValues();
|
|
3149
|
+
this.list.scrollTop = 0;
|
|
3150
|
+
}
|
|
3151
|
+
if (activeElement && activeElement.item) {
|
|
3152
|
+
activeElement.item = this.getElementByValue(activeElement.item.getAttribute('data-value'));
|
|
3153
|
+
}
|
|
3154
|
+
}
|
|
3155
|
+
if (activeElement && activeElement.item) {
|
|
2445
3156
|
this.addListFocus(activeElement.item);
|
|
2446
3157
|
this.list.scrollTop =
|
|
2447
3158
|
activeElement.item.offsetHeight * activeElement.index;
|
|
@@ -2454,11 +3165,15 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
2454
3165
|
}
|
|
2455
3166
|
}
|
|
2456
3167
|
}
|
|
3168
|
+
if (this.enableVirtualization && this.allowFiltering) {
|
|
3169
|
+
this.getFilteringSkeletonCount();
|
|
3170
|
+
}
|
|
2457
3171
|
};
|
|
2458
3172
|
MultiSelect.prototype.preRender = function () {
|
|
2459
3173
|
if (this.allowFiltering === null) {
|
|
2460
3174
|
this.allowFiltering = (this.mode === 'CheckBox') ? true : false;
|
|
2461
3175
|
}
|
|
3176
|
+
this.preventSetCurrentData = false;
|
|
2462
3177
|
this.initializeData();
|
|
2463
3178
|
this.updateDataAttribute(this.htmlAttributes);
|
|
2464
3179
|
_super.prototype.preRender.call(this);
|
|
@@ -2480,6 +3195,14 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
2480
3195
|
this.isCustomRendered = false;
|
|
2481
3196
|
this.isRemoteSelection = false;
|
|
2482
3197
|
this.isSelectAllTarget = true;
|
|
3198
|
+
this.viewPortInfo = {
|
|
3199
|
+
currentPageNumber: null,
|
|
3200
|
+
direction: null,
|
|
3201
|
+
sentinelInfo: {},
|
|
3202
|
+
offsets: {},
|
|
3203
|
+
startIndex: 0,
|
|
3204
|
+
endIndex: this.itemCount,
|
|
3205
|
+
};
|
|
2483
3206
|
};
|
|
2484
3207
|
MultiSelect.prototype.updateData = function (delimiterChar, e) {
|
|
2485
3208
|
var data = '';
|
|
@@ -2487,7 +3210,9 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
2487
3210
|
var text = [];
|
|
2488
3211
|
var temp;
|
|
2489
3212
|
var tempData = this.listData;
|
|
2490
|
-
this.
|
|
3213
|
+
if (!this.enableVirtualization) {
|
|
3214
|
+
this.listData = this.mainData;
|
|
3215
|
+
}
|
|
2491
3216
|
if (!isNullOrUndefined(this.hiddenElement)) {
|
|
2492
3217
|
this.hiddenElement.innerHTML = '';
|
|
2493
3218
|
}
|
|
@@ -2495,16 +3220,32 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
2495
3220
|
var valueLength = this.value.length;
|
|
2496
3221
|
var hiddenElementContent = '';
|
|
2497
3222
|
for (var index = 0; index < valueLength; index++) {
|
|
2498
|
-
var valueItem = this.value[index];
|
|
3223
|
+
var valueItem = this.allowObjectBinding ? getValue((this.fields.value) ? this.fields.value : '', this.value[index]) : this.value[index];
|
|
2499
3224
|
var listValue = this.findListElement((!isNullOrUndefined(this.mainList) ? this.mainList : this.ulElement), 'li', 'data-value', valueItem);
|
|
2500
|
-
if (
|
|
3225
|
+
if (this.enableVirtualization) {
|
|
3226
|
+
listValue = this.findListElement((!isNullOrUndefined(this.list) ? this.list : this.ulElement), 'li', 'data-value', valueItem);
|
|
3227
|
+
}
|
|
3228
|
+
if (isNullOrUndefined(listValue) && !this.allowCustomValue && !this.enableVirtualization) {
|
|
2501
3229
|
this.value.splice(index, 1);
|
|
2502
3230
|
index -= 1;
|
|
2503
3231
|
valueLength -= 1;
|
|
2504
3232
|
}
|
|
2505
3233
|
else {
|
|
2506
3234
|
if (this.listData) {
|
|
2507
|
-
|
|
3235
|
+
if (this.enableVirtualization) {
|
|
3236
|
+
if (delim) {
|
|
3237
|
+
data = this.delimiterWrapper && this.delimiterWrapper.innerHTML == "" ? data : this.delimiterWrapper.innerHTML;
|
|
3238
|
+
}
|
|
3239
|
+
var value = this.allowObjectBinding ? getValue(((this.fields.value) ? this.fields.value : ''), this.value[this.value.length - 1]) : this.value[this.value.length - 1];
|
|
3240
|
+
temp = this.getTextByValue(value);
|
|
3241
|
+
var textValues = this.text != null && this.text != "" ? this.text + ',' + temp : temp;
|
|
3242
|
+
data += temp + delimiterChar + ' ';
|
|
3243
|
+
text.push(textValues);
|
|
3244
|
+
break;
|
|
3245
|
+
}
|
|
3246
|
+
else {
|
|
3247
|
+
temp = this.getTextByValue(valueItem);
|
|
3248
|
+
}
|
|
2508
3249
|
}
|
|
2509
3250
|
else {
|
|
2510
3251
|
temp = valueItem;
|
|
@@ -2518,7 +3259,10 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
2518
3259
|
this.hiddenElement.innerHTML = hiddenElementContent;
|
|
2519
3260
|
}
|
|
2520
3261
|
}
|
|
2521
|
-
|
|
3262
|
+
var isChipRemove = e && e.target && e.target.classList.contains('e-chips-close');
|
|
3263
|
+
if (!this.enableVirtualization || (this.enableVirtualization && this.mode !== 'CheckBox' && !isChipRemove)) {
|
|
3264
|
+
this.setProperties({ text: text.toString() }, true);
|
|
3265
|
+
}
|
|
2522
3266
|
if (delim) {
|
|
2523
3267
|
this.updateWrapperText(this.delimiterWrapper, data);
|
|
2524
3268
|
this.delimiterWrapper.setAttribute('id', getUniqueID('delim_val'));
|
|
@@ -2547,7 +3291,8 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
2547
3291
|
}
|
|
2548
3292
|
}
|
|
2549
3293
|
if (textVal && textVal.length) {
|
|
2550
|
-
this.
|
|
3294
|
+
var value = this.allowObjectBinding ? this.getDataByValue(textVal) : textVal;
|
|
3295
|
+
this.setProperties({ value: value }, true);
|
|
2551
3296
|
}
|
|
2552
3297
|
}
|
|
2553
3298
|
else {
|
|
@@ -2560,10 +3305,12 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
2560
3305
|
isEmptyData = true;
|
|
2561
3306
|
}
|
|
2562
3307
|
_super.prototype.render.call(this, null, isEmptyData);
|
|
3308
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3309
|
+
this.totalItemCount = this.dataSource && this.dataSource.length ? this.dataSource.length : 0;
|
|
2563
3310
|
this.unwireListEvents();
|
|
2564
3311
|
this.wireListEvents();
|
|
2565
3312
|
};
|
|
2566
|
-
MultiSelect.prototype.initialValueUpdate = function () {
|
|
3313
|
+
MultiSelect.prototype.initialValueUpdate = function (listItems) {
|
|
2567
3314
|
if (this.list) {
|
|
2568
3315
|
var text = void 0;
|
|
2569
3316
|
var element = void 0;
|
|
@@ -2574,12 +3321,34 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
2574
3321
|
this.removeListSelection();
|
|
2575
3322
|
if (!isNullOrUndefined(this.value)) {
|
|
2576
3323
|
for (var index = 0; !isNullOrUndefined(this.value[index]); index++) {
|
|
2577
|
-
value = this.value[index];
|
|
3324
|
+
value = this.allowObjectBinding ? getValue(((this.fields.value) ? this.fields.value : ''), this.value[index]) : this.value[index];
|
|
2578
3325
|
element = this.findListElement(this.hideSelectedItem ? this.ulElement : this.list, 'li', 'data-value', value);
|
|
2579
|
-
|
|
2580
|
-
if (
|
|
3326
|
+
var isCustomData = false;
|
|
3327
|
+
if (this.enableVirtualization) {
|
|
3328
|
+
text = null;
|
|
3329
|
+
if (listItems != null && listItems.length > 0) {
|
|
3330
|
+
for (var i = 0; i < listItems.length; i++) {
|
|
3331
|
+
if (getValue((this.fields.value ? this.fields.value : 'value'), listItems[i]) === value) {
|
|
3332
|
+
text = getValue(this.fields.text, listItems[i]);
|
|
3333
|
+
break;
|
|
3334
|
+
}
|
|
3335
|
+
}
|
|
3336
|
+
}
|
|
3337
|
+
if (isNullOrUndefined(text) && this.allowCustomValue) {
|
|
3338
|
+
text = this.getTextByValue(value);
|
|
3339
|
+
isCustomData = true;
|
|
3340
|
+
}
|
|
3341
|
+
}
|
|
3342
|
+
else {
|
|
3343
|
+
text = this.getTextByValue(value);
|
|
3344
|
+
}
|
|
3345
|
+
if (((element && (element.getAttribute('aria-selected') !== 'true')) ||
|
|
2581
3346
|
(element && (element.getAttribute('aria-selected') === 'true' && this.hideSelectedItem) &&
|
|
2582
|
-
(this.mode === 'Box' || this.mode === 'Default'))) {
|
|
3347
|
+
(this.mode === 'Box' || this.mode === 'Default'))) || (this.enableVirtualization && value != null && text != null && !isCustomData)) {
|
|
3348
|
+
var currentText = [];
|
|
3349
|
+
var textValues = this.text != null ? this.text + ',' + text : text;
|
|
3350
|
+
currentText.push(textValues);
|
|
3351
|
+
this.setProperties({ text: currentText.toString() }, true);
|
|
2583
3352
|
this.addChip(text, value);
|
|
2584
3353
|
this.addListSelection(element);
|
|
2585
3354
|
}
|
|
@@ -2590,12 +3359,24 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
2590
3359
|
setValue(this.fields.value, value, newValue);
|
|
2591
3360
|
var noDataEle = this.popupWrapper.querySelector('.' + dropDownBaseClasses.noData);
|
|
2592
3361
|
this.addItem(newValue, indexItem);
|
|
3362
|
+
if (this.enableVirtualization) {
|
|
3363
|
+
if (this.virtualCustomSelectData && this.virtualCustomSelectData.length >= 0) {
|
|
3364
|
+
this.virtualCustomSelectData.push(newValue);
|
|
3365
|
+
}
|
|
3366
|
+
else {
|
|
3367
|
+
this.virtualCustomSelectData = [newValue];
|
|
3368
|
+
}
|
|
3369
|
+
}
|
|
2593
3370
|
element = element ? element : this.findListElement(this.hideSelectedItem ? this.ulElement : this.list, 'li', 'data-value', value);
|
|
2594
3371
|
if (this.popupWrapper.contains(noDataEle)) {
|
|
2595
3372
|
this.list.setAttribute('style', noDataEle.getAttribute('style'));
|
|
2596
3373
|
this.popupWrapper.replaceChild(this.list, noDataEle);
|
|
2597
3374
|
this.wireListEvents();
|
|
2598
3375
|
}
|
|
3376
|
+
var currentText = [];
|
|
3377
|
+
var textValues = this.text != null ? this.text + ',' + text : text;
|
|
3378
|
+
currentText.push(textValues);
|
|
3379
|
+
this.setProperties({ text: currentText.toString() }, true);
|
|
2599
3380
|
this.addChip(text, value);
|
|
2600
3381
|
this.addListSelection(element);
|
|
2601
3382
|
}
|
|
@@ -2625,7 +3406,7 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
2625
3406
|
};
|
|
2626
3407
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2627
3408
|
MultiSelect.prototype.updateActionCompleteData = function (li, item) {
|
|
2628
|
-
if (this.value && this.value.indexOf(li.getAttribute('data-value')) > -1) {
|
|
3409
|
+
if (this.value && ((!this.allowObjectBinding && this.value.indexOf(li.getAttribute('data-value')) > -1) || (this.allowObjectBinding && this.isObjectInArray(this.getDataByValue(li.getAttribute('data-value')), this.value)))) {
|
|
2629
3410
|
this.mainList = this.ulElement;
|
|
2630
3411
|
if (this.hideSelectedItem) {
|
|
2631
3412
|
addClass([li], HIDE_LIST);
|
|
@@ -2663,13 +3444,13 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
2663
3444
|
};
|
|
2664
3445
|
MultiSelect.prototype.updateListSelection = function (li, e, length) {
|
|
2665
3446
|
var customVal = li.getAttribute('data-value');
|
|
2666
|
-
var value = this.getFormattedValue(customVal);
|
|
3447
|
+
var value = this.allowObjectBinding ? this.getDataByValue(customVal) : this.getFormattedValue(customVal);
|
|
2667
3448
|
if (this.allowCustomValue && ((customVal !== 'false' && value === false) ||
|
|
2668
3449
|
(!isNullOrUndefined(value) && value.toString() === 'NaN'))) {
|
|
2669
3450
|
value = customVal;
|
|
2670
3451
|
}
|
|
2671
3452
|
this.removeHover();
|
|
2672
|
-
if (!this.value || this.value.indexOf(value) === -1) {
|
|
3453
|
+
if (!this.value || ((!this.allowObjectBinding && this.value.indexOf(value) === -1) || (this.allowObjectBinding && this.indexOfObjectInArray(value, this.value) === -1))) {
|
|
2673
3454
|
this.dispatchSelect(value, e, li, (li.getAttribute('aria-selected') === 'true'), length);
|
|
2674
3455
|
}
|
|
2675
3456
|
else {
|
|
@@ -2678,9 +3459,10 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
2678
3459
|
};
|
|
2679
3460
|
MultiSelect.prototype.updateListSelectEventCallback = function (value, li, e) {
|
|
2680
3461
|
var _this = this;
|
|
3462
|
+
value = this.allowObjectBinding ? getValue(((this.fields.value) ? this.fields.value : ''), value) : value;
|
|
2681
3463
|
var text = this.getTextByValue(value);
|
|
2682
|
-
if ((this.allowCustomValue || this.allowFiltering) && !this.findListElement(this.mainList, 'li', 'data-value', value)) {
|
|
2683
|
-
var temp_1 = li.cloneNode(true);
|
|
3464
|
+
if ((this.allowCustomValue || this.allowFiltering) && !this.findListElement(this.mainList, 'li', 'data-value', value) && (!this.enableVirtualization || (this.enableVirtualization && this.virtualCustomData))) {
|
|
3465
|
+
var temp_1 = li ? li.cloneNode(true) : li;
|
|
2684
3466
|
var fieldValue = this.fields.value ? this.fields.value : 'value';
|
|
2685
3467
|
if (this.allowCustomValue && this.mainData.length && typeof getValue(fieldValue, this.mainData[0]) === 'number') {
|
|
2686
3468
|
value = !isNaN(parseFloat(value.toString())) ? parseFloat(value.toString()) : value;
|
|
@@ -2692,10 +3474,22 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
2692
3474
|
};
|
|
2693
3475
|
this.trigger('customValueSelection', eventArgs, function (eventArgs) {
|
|
2694
3476
|
if (!eventArgs.cancel) {
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
3477
|
+
if (_this.enableVirtualization && _this.virtualCustomData) {
|
|
3478
|
+
if (_this.virtualCustomSelectData && _this.virtualCustomSelectData.length >= 0) {
|
|
3479
|
+
_this.virtualCustomSelectData.push(data_1);
|
|
3480
|
+
}
|
|
3481
|
+
else {
|
|
3482
|
+
_this.virtualCustomSelectData = [data_1];
|
|
3483
|
+
}
|
|
3484
|
+
_this.remoteCustomValue = false;
|
|
3485
|
+
_this.addValue(value, text, e);
|
|
3486
|
+
}
|
|
3487
|
+
else {
|
|
3488
|
+
append([temp_1], _this.mainList);
|
|
3489
|
+
_this.mainData.push(data_1);
|
|
3490
|
+
_this.remoteCustomValue = false;
|
|
3491
|
+
_this.addValue(value, text, e);
|
|
3492
|
+
}
|
|
2699
3493
|
}
|
|
2700
3494
|
});
|
|
2701
3495
|
}
|
|
@@ -2805,8 +3599,12 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
2805
3599
|
var _this = this;
|
|
2806
3600
|
this.keyCode = null;
|
|
2807
3601
|
this.scrollFocusStatus = false;
|
|
3602
|
+
this.keyboardEvent = null;
|
|
2808
3603
|
var target = e.target;
|
|
2809
3604
|
var li = closest(target, '.' + dropDownBaseClasses.li);
|
|
3605
|
+
if (this.enableVirtualization && li && li.classList.contains('e-virtual-list')) {
|
|
3606
|
+
return;
|
|
3607
|
+
}
|
|
2810
3608
|
var headerLi = closest(target, '.' + dropDownBaseClasses.group);
|
|
2811
3609
|
if (headerLi && this.enableGroupCheckBox && this.mode === 'CheckBox' && this.fields.groupBy) {
|
|
2812
3610
|
target = target.classList.contains('e-list-group-item') ? target.firstElementChild.lastElementChild
|
|
@@ -2883,6 +3681,39 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
2883
3681
|
else {
|
|
2884
3682
|
e.preventDefault();
|
|
2885
3683
|
}
|
|
3684
|
+
if (this.enableVirtualization && this.hideSelectedItem) {
|
|
3685
|
+
var visibleListElements = this.list.querySelectorAll('li.'
|
|
3686
|
+
+ dropDownBaseClasses.li
|
|
3687
|
+
+ ':not(.' + HIDE_LIST + ')' + ':not(.e-reorder-hide)' + ':not(.e-virtual-list)');
|
|
3688
|
+
if (visibleListElements.length) {
|
|
3689
|
+
var actualCount = this.virtualListHeight > 0 ? Math.floor(this.virtualListHeight / this.listItemHeight) : 0;
|
|
3690
|
+
if (visibleListElements.length < (actualCount + 2)) {
|
|
3691
|
+
var query = this.getForQuery(this.value).clone();
|
|
3692
|
+
query = query.skip(this.virtualItemStartIndex);
|
|
3693
|
+
this.resetList(this.dataSource, this.fields, query);
|
|
3694
|
+
this.UpdateSkeleton();
|
|
3695
|
+
this.liCollections = this.list.querySelectorAll('.' + dropDownBaseClasses.li);
|
|
3696
|
+
this.virtualItemCount = this.itemCount;
|
|
3697
|
+
if (this.mode !== 'CheckBox') {
|
|
3698
|
+
this.totalItemCount = this.value && this.value.length ? this.totalItemCount - this.value.length : this.totalItemCount;
|
|
3699
|
+
}
|
|
3700
|
+
if (!this.list.querySelector('.e-virtual-ddl')) {
|
|
3701
|
+
var virualElement = this.createElement('div', {
|
|
3702
|
+
id: this.element.id + '_popup', className: 'e-virtual-ddl', styles: this.GetVirtualTrackHeight()
|
|
3703
|
+
});
|
|
3704
|
+
this.popupWrapper.querySelector('.e-dropdownbase').appendChild(virualElement);
|
|
3705
|
+
}
|
|
3706
|
+
else {
|
|
3707
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3708
|
+
this.list.getElementsByClassName('e-virtual-ddl')[0].style = this.GetVirtualTrackHeight();
|
|
3709
|
+
}
|
|
3710
|
+
if (this.list.querySelector('.e-virtual-ddl-content')) {
|
|
3711
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3712
|
+
this.list.getElementsByClassName('e-virtual-ddl-content')[0].style = this.getTransformValues();
|
|
3713
|
+
}
|
|
3714
|
+
}
|
|
3715
|
+
}
|
|
3716
|
+
}
|
|
2886
3717
|
this.refreshPlaceHolder();
|
|
2887
3718
|
this.deselectHeader();
|
|
2888
3719
|
}
|
|
@@ -3120,7 +3951,9 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
3120
3951
|
var remaining = void 0;
|
|
3121
3952
|
var downIconWidth = 0;
|
|
3122
3953
|
var overAllContainer = void 0;
|
|
3123
|
-
|
|
3954
|
+
if (!this.enableVirtualization) {
|
|
3955
|
+
this.updateWrapperText(this.viewWrapper, data);
|
|
3956
|
+
}
|
|
3124
3957
|
var l10nLocale = {
|
|
3125
3958
|
noRecordsTemplate: 'No records found',
|
|
3126
3959
|
actionFailureTemplate: 'Request failed',
|
|
@@ -3151,11 +3984,21 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
3151
3984
|
this.checkClearIconWidth();
|
|
3152
3985
|
if (!isNullOrUndefined(this.value)) {
|
|
3153
3986
|
for (var index = 0; !isNullOrUndefined(this.value[index]); index++) {
|
|
3154
|
-
|
|
3155
|
-
|
|
3156
|
-
|
|
3157
|
-
|
|
3158
|
-
|
|
3987
|
+
var items = this.text && this.text.split(this.delimiterChar);
|
|
3988
|
+
if (!this.enableVirtualization) {
|
|
3989
|
+
data += (index === 0) ? '' : this.delimiterChar + ' ';
|
|
3990
|
+
temp = this.getOverflowVal(index);
|
|
3991
|
+
data += temp;
|
|
3992
|
+
temp = this.viewWrapper.innerHTML;
|
|
3993
|
+
this.updateWrapperText(this.viewWrapper, data);
|
|
3994
|
+
}
|
|
3995
|
+
else if (items) {
|
|
3996
|
+
data += (index === 0) ? '' : this.delimiterChar + ' ';
|
|
3997
|
+
temp = items[index];
|
|
3998
|
+
data += temp;
|
|
3999
|
+
temp = this.viewWrapper.innerHTML;
|
|
4000
|
+
this.updateWrapperText(this.viewWrapper, data);
|
|
4001
|
+
}
|
|
3159
4002
|
wrapperleng = this.viewWrapper.offsetWidth +
|
|
3160
4003
|
parseInt(window.getComputedStyle(this.viewWrapper).paddingRight, 10);
|
|
3161
4004
|
overAllContainer = this.componentWrapper.offsetWidth -
|
|
@@ -3258,18 +4101,19 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
3258
4101
|
MultiSelect.prototype.getOverflowVal = function (index) {
|
|
3259
4102
|
var temp;
|
|
3260
4103
|
if (this.mainData && this.mainData.length) {
|
|
4104
|
+
var value = this.allowObjectBinding ? getValue(((this.fields.value) ? this.fields.value : ''), this.value[index]) : this.value[index];
|
|
3261
4105
|
if (this.mode === 'CheckBox') {
|
|
3262
4106
|
var newTemp = this.listData;
|
|
3263
4107
|
this.listData = this.mainData;
|
|
3264
|
-
temp = this.getTextByValue(
|
|
4108
|
+
temp = this.getTextByValue(value);
|
|
3265
4109
|
this.listData = newTemp;
|
|
3266
4110
|
}
|
|
3267
4111
|
else {
|
|
3268
|
-
temp = this.getTextByValue(
|
|
4112
|
+
temp = this.getTextByValue(value);
|
|
3269
4113
|
}
|
|
3270
4114
|
}
|
|
3271
4115
|
else {
|
|
3272
|
-
temp = this.value[index];
|
|
4116
|
+
temp = this.allowObjectBinding ? getValue(((this.fields.value) ? this.fields.value : ''), this.value[index]) : this.value[index];
|
|
3273
4117
|
}
|
|
3274
4118
|
return temp;
|
|
3275
4119
|
};
|
|
@@ -3387,8 +4231,8 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
3387
4231
|
preventSelectEvent: false
|
|
3388
4232
|
};
|
|
3389
4233
|
this.trigger('beforeSelectAll', beforeSelectArgs);
|
|
3390
|
-
if (li && li.length) {
|
|
3391
|
-
var
|
|
4234
|
+
if ((li && li.length) || (this.enableVirtualization && !state)) {
|
|
4235
|
+
var index_2 = 0;
|
|
3392
4236
|
var count_1 = 0;
|
|
3393
4237
|
if (this.enableGroupCheckBox) {
|
|
3394
4238
|
count_1 = state ? this.maximumSelectionLength - (this.value ? this.value.length : 0) : li.length;
|
|
@@ -3397,62 +4241,153 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
3397
4241
|
count_1 = state ? this.maximumSelectionLength - (this.value ? this.value.length : 0) : this.maximumSelectionLength;
|
|
3398
4242
|
}
|
|
3399
4243
|
if (!beforeSelectArgs.preventSelectEvent) {
|
|
3400
|
-
this.
|
|
3401
|
-
|
|
3402
|
-
|
|
3403
|
-
|
|
3404
|
-
this.
|
|
3405
|
-
|
|
3406
|
-
|
|
3407
|
-
|
|
3408
|
-
|
|
3409
|
-
|
|
3410
|
-
|
|
3411
|
-
|
|
3412
|
-
|
|
3413
|
-
|
|
3414
|
-
|
|
4244
|
+
if (this.enableVirtualization) {
|
|
4245
|
+
if (state) {
|
|
4246
|
+
this.virtualSelectAll = true;
|
|
4247
|
+
this.resetList(this.dataSource, this.fields, new Query().skip(this.viewPortInfo.startIndex));
|
|
4248
|
+
if (this.virtualSelectAllData instanceof Array) {
|
|
4249
|
+
for (var i = 0; i < this.virtualSelectAllData.length; i++) {
|
|
4250
|
+
if (li[this.skeletonCount + i]) {
|
|
4251
|
+
var value_2 = this.allowObjectBinding ? this.getDataByValue(li[this.skeletonCount + i].getAttribute('data-value')) : this.getFormattedValue(li[this.skeletonCount + i].getAttribute('data-value'));
|
|
4252
|
+
if (((!this.allowObjectBinding && this.value && this.value.indexOf(value_2) === 1) || (this.allowObjectBinding && this.indexOfObjectInArray(value_2, this.value) === 1))) {
|
|
4253
|
+
continue;
|
|
4254
|
+
}
|
|
4255
|
+
this.updateListSelection(li[this.skeletonCount + i], event, length - i);
|
|
4256
|
+
}
|
|
4257
|
+
else {
|
|
4258
|
+
if (this.fields) {
|
|
4259
|
+
var value_3 = getValue(this.fields.value, this.virtualSelectAllData[i]);
|
|
4260
|
+
value_3 = this.allowObjectBinding ? this.getDataByValue(value_3) : value_3;
|
|
4261
|
+
if (((!this.allowObjectBinding && this.value && this.value.indexOf(value_3) === 1) || (this.allowObjectBinding && this.indexOfObjectInArray(value_3, this.value) === 1))) {
|
|
4262
|
+
continue;
|
|
4263
|
+
}
|
|
4264
|
+
if (this.value && value_3 != null && Array.isArray(this.value) && ((!this.allowObjectBinding && this.value.indexOf(value_3) < 0) || (this.allowObjectBinding && !this.isObjectInArray(value_3, this.value)))) {
|
|
4265
|
+
this.dispatchSelect(value_3, event, null, false, length);
|
|
4266
|
+
}
|
|
4267
|
+
}
|
|
4268
|
+
}
|
|
4269
|
+
}
|
|
4270
|
+
if (this.virtualSelectAllData && this.value.length != this.virtualSelectAllData.length && this.virtualItemStartIndex != 0) {
|
|
4271
|
+
if (this.virtualItemStartIndex > this.itemCount) {
|
|
4272
|
+
for (var i = 0; i < this.itemCount; i++) {
|
|
4273
|
+
if (this.fields) {
|
|
4274
|
+
var value_4 = getValue(this.fields.value, this.virtualSelectAllData[i]);
|
|
4275
|
+
value_4 = this.allowObjectBinding ? this.getDataByValue(value_4) : value_4;
|
|
4276
|
+
if (this.value && value_4 != null && Array.isArray(this.value) && ((!this.allowObjectBinding && this.value.indexOf(value_4) < 0) || (this.allowObjectBinding && !this.isObjectInArray(value_4, this.value)))) {
|
|
4277
|
+
this.setProperties({ value: [].concat([], this.value, this.allowObjectBinding ? [this.virtualSelectAllData[i]] : [value_4]) }, true);
|
|
4278
|
+
}
|
|
4279
|
+
}
|
|
4280
|
+
}
|
|
4281
|
+
}
|
|
4282
|
+
}
|
|
4283
|
+
else {
|
|
4284
|
+
for (var i = 0; i < this.virtualItemStartIndex; i++) {
|
|
4285
|
+
if (this.fields) {
|
|
4286
|
+
var value = getValue(this.fields.value, this.virtualSelectAllData[i]);
|
|
4287
|
+
value = this.allowObjectBinding ? this.getDataByValue(value) : value;
|
|
4288
|
+
if (Array.isArray(this.value) && ((!this.allowObjectBinding && this.value.indexOf(value) < 0) || (this.allowObjectBinding && !this.isObjectInArray(value, this.value)))) {
|
|
4289
|
+
this.setProperties({ value: [].concat([], this.value, this.allowObjectBinding ? [this.virtualSelectAllData[i]] : [value]) }, true);
|
|
4290
|
+
}
|
|
4291
|
+
}
|
|
4292
|
+
}
|
|
3415
4293
|
}
|
|
3416
|
-
index_1++;
|
|
3417
4294
|
}
|
|
3418
|
-
|
|
3419
|
-
|
|
3420
|
-
|
|
3421
|
-
|
|
4295
|
+
}
|
|
4296
|
+
else {
|
|
4297
|
+
while (index_2 < this.value.length && index_2 <= 50 && index_2 < count_1 && this.value.length > 0) {
|
|
4298
|
+
this.removeValue(this.value[index_2], event, this.value.length - index_2);
|
|
4299
|
+
index_2++;
|
|
3422
4300
|
}
|
|
3423
|
-
|
|
3424
|
-
|
|
3425
|
-
|
|
3426
|
-
|
|
3427
|
-
|
|
3428
|
-
|
|
4301
|
+
if (length > 50) {
|
|
4302
|
+
setTimeout(function () {
|
|
4303
|
+
while (index_2 < _this.value.length && index_2 < count_1 && _this.value.length > 0) {
|
|
4304
|
+
_this.removeValue(value[index_2], event, _this.value.length - index_2);
|
|
4305
|
+
index_2++;
|
|
4306
|
+
}
|
|
4307
|
+
_this.updatedataValueItems(event);
|
|
4308
|
+
if (!_this.changeOnBlur) {
|
|
4309
|
+
_this.updateValueState(event, _this.value, _this.tempValues);
|
|
4310
|
+
_this.isSelectAll = _this.isSelectAll ? !_this.isSelectAll : _this.isSelectAll;
|
|
4311
|
+
}
|
|
4312
|
+
_this.updateHiddenElement();
|
|
4313
|
+
}, 0);
|
|
4314
|
+
}
|
|
4315
|
+
this.value = [];
|
|
4316
|
+
this.virtualSelectAll = false;
|
|
4317
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4318
|
+
var ulElement = this.renderItems(this.listData, this.fields);
|
|
4319
|
+
}
|
|
4320
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4321
|
+
var virtualTrackElement = this.list.getElementsByClassName('e-virtual-ddl')[0];
|
|
4322
|
+
if (virtualTrackElement) {
|
|
4323
|
+
(virtualTrackElement).style = this.GetVirtualTrackHeight();
|
|
4324
|
+
}
|
|
4325
|
+
this.UpdateSkeleton();
|
|
4326
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4327
|
+
var virtualContentElement = this.list.getElementsByClassName('e-virtual-ddl-content')[0];
|
|
4328
|
+
if (virtualContentElement) {
|
|
4329
|
+
(virtualContentElement).style = this.getTransformValues();
|
|
4330
|
+
}
|
|
4331
|
+
}
|
|
4332
|
+
else {
|
|
4333
|
+
while (index_2 < length && index_2 <= 50 && index_2 < count_1) {
|
|
4334
|
+
this.isSelectAllTarget = (length === index_2 + 1);
|
|
4335
|
+
this.updateListSelection(li[index_2], event, length - index_2);
|
|
4336
|
+
if (this.enableGroupCheckBox) {
|
|
4337
|
+
this.findGroupStart(li[index_2]);
|
|
3429
4338
|
}
|
|
3430
|
-
|
|
4339
|
+
index_2++;
|
|
4340
|
+
}
|
|
4341
|
+
if (length > 50) {
|
|
4342
|
+
setTimeout(function () {
|
|
4343
|
+
while (index_2 < length && index_2 < count_1) {
|
|
4344
|
+
_this.isSelectAllTarget = (length === index_2 + 1);
|
|
4345
|
+
_this.updateListSelection(li[index_2], event, length - index_2);
|
|
4346
|
+
if (_this.enableGroupCheckBox) {
|
|
4347
|
+
_this.findGroupStart(li[index_2]);
|
|
4348
|
+
}
|
|
4349
|
+
index_2++;
|
|
4350
|
+
}
|
|
4351
|
+
_this.updatedataValueItems(event);
|
|
4352
|
+
if (!_this.changeOnBlur) {
|
|
4353
|
+
_this.updateValueState(event, _this.value, _this.tempValues);
|
|
4354
|
+
_this.isSelectAll = _this.isSelectAll ? !_this.isSelectAll : _this.isSelectAll;
|
|
4355
|
+
}
|
|
4356
|
+
_this.updateHiddenElement();
|
|
4357
|
+
if (_this.popupWrapper && li[index_2 - 1].classList.contains('e-item-focus')) {
|
|
4358
|
+
var selectAllParent = document.getElementsByClassName('e-selectall-parent')[0];
|
|
4359
|
+
if (selectAllParent && selectAllParent.classList.contains('e-item-focus')) {
|
|
4360
|
+
li[index_2 - 1].classList.remove('e-item-focus');
|
|
4361
|
+
}
|
|
4362
|
+
}
|
|
4363
|
+
}, 0);
|
|
4364
|
+
}
|
|
3431
4365
|
}
|
|
3432
4366
|
}
|
|
3433
4367
|
else {
|
|
3434
|
-
for (var
|
|
4368
|
+
for (var i_1 = 0; i_1 < li.length && i_1 < count_1; i_1++) {
|
|
3435
4369
|
this.removeHover();
|
|
3436
|
-
var customVal = li[
|
|
3437
|
-
var
|
|
4370
|
+
var customVal = li[i_1].getAttribute('data-value');
|
|
4371
|
+
var value_5 = this.getFormattedValue(customVal);
|
|
4372
|
+
value_5 = this.allowObjectBinding ? this.getDataByValue(value_5) : value_5;
|
|
3438
4373
|
var mainElement = this.mainList ? this.mainList.querySelectorAll(state ?
|
|
3439
4374
|
'li.e-list-item:not([aria-selected="true"]):not(.e-reorder-hide)' :
|
|
3440
|
-
'li.e-list-item[aria-selected="true"]:not(.e-reorder-hide)')[
|
|
4375
|
+
'li.e-list-item[aria-selected="true"]:not(.e-reorder-hide)')[i_1] : null;
|
|
3441
4376
|
if (state) {
|
|
3442
4377
|
this.value = !this.value ? [] : this.value;
|
|
3443
|
-
if (this.value.indexOf(
|
|
3444
|
-
this.setProperties({ value: [].concat([], this.value, [
|
|
4378
|
+
if ((!this.allowObjectBinding && this.value.indexOf(value_5) < 0) || (this.allowObjectBinding && !this.isObjectInArray(value_5, this.value))) {
|
|
4379
|
+
this.setProperties({ value: [].concat([], this.value, [value_5]) }, true);
|
|
3445
4380
|
}
|
|
3446
4381
|
this.removeFocus();
|
|
3447
|
-
this.addListSelection(li[
|
|
4382
|
+
this.addListSelection(li[i_1], mainElement);
|
|
3448
4383
|
this.updateChipStatus();
|
|
3449
4384
|
this.checkMaxSelection();
|
|
3450
4385
|
}
|
|
3451
4386
|
else {
|
|
3452
|
-
this.removeAllItems(
|
|
4387
|
+
this.removeAllItems(value_5, event, false, li[i_1], mainElement);
|
|
3453
4388
|
}
|
|
3454
4389
|
if (this.enableGroupCheckBox) {
|
|
3455
|
-
this.findGroupStart(li[
|
|
4390
|
+
this.findGroupStart(li[i_1]);
|
|
3456
4391
|
}
|
|
3457
4392
|
}
|
|
3458
4393
|
if (!state) {
|
|
@@ -3586,6 +4521,7 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
3586
4521
|
}
|
|
3587
4522
|
this.selectAllItem(state, event);
|
|
3588
4523
|
}
|
|
4524
|
+
this.virtualSelectAll = false;
|
|
3589
4525
|
};
|
|
3590
4526
|
/**
|
|
3591
4527
|
* Get the properties to be maintained in the persisted state.
|
|
@@ -3753,12 +4689,31 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
3753
4689
|
}
|
|
3754
4690
|
this.renderPopup();
|
|
3755
4691
|
};
|
|
4692
|
+
MultiSelect.prototype.totalItemsCount = function () {
|
|
4693
|
+
var dataSourceCount;
|
|
4694
|
+
if (this.dataSource instanceof DataManager) {
|
|
4695
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4696
|
+
dataSourceCount = this.virtualGroupDataSource && this.virtualGroupDataSource.length ? this.virtualGroupDataSource.length : 0;
|
|
4697
|
+
}
|
|
4698
|
+
else {
|
|
4699
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4700
|
+
dataSourceCount = this.dataSource && this.dataSource.length ? this.dataSource.length : 0;
|
|
4701
|
+
}
|
|
4702
|
+
if (this.mode === 'CheckBox') {
|
|
4703
|
+
this.totalItemCount = dataSourceCount != 0 ? dataSourceCount : this.totalItemCount;
|
|
4704
|
+
}
|
|
4705
|
+
else {
|
|
4706
|
+
this.totalItemCount = dataSourceCount != 0 ? dataSourceCount - this.value.length : this.totalItemCount;
|
|
4707
|
+
}
|
|
4708
|
+
};
|
|
3756
4709
|
MultiSelect.prototype.presentItemValue = function (ulElement) {
|
|
3757
4710
|
var valuecheck = [];
|
|
3758
4711
|
for (var i = 0; i < this.value.length; i++) {
|
|
3759
|
-
var
|
|
4712
|
+
var value = this.allowObjectBinding ? getValue((this.fields.value) ? this.fields.value : '', this.value[i]) : this.value[i];
|
|
4713
|
+
var checkEle = this.findListElement(((this.allowFiltering && !isNullOrUndefined(this.mainList)) ? this.mainList : ulElement), 'li', 'data-value', value);
|
|
3760
4714
|
if (!checkEle) {
|
|
3761
|
-
|
|
4715
|
+
var checkvalue = this.allowObjectBinding ? this.getDataByValue(this.value[i]) : this.value[i];
|
|
4716
|
+
valuecheck.push(checkvalue);
|
|
3762
4717
|
}
|
|
3763
4718
|
}
|
|
3764
4719
|
return valuecheck;
|
|
@@ -3871,6 +4826,31 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
3871
4826
|
if (_this.mode === 'CheckBox' && _this.showSelectAll) {
|
|
3872
4827
|
EventHandler.remove(_this.popupObj.element, 'click', _this.clickHandler);
|
|
3873
4828
|
}
|
|
4829
|
+
if (_this.enableVirtualization && _this.mode === 'CheckBox') {
|
|
4830
|
+
_this.viewPortInfo.startIndex = _this.virtualItemStartIndex = 0;
|
|
4831
|
+
_this.viewPortInfo.endIndex = _this.virtualItemEndIndex = _this.viewPortInfo.startIndex > 0 ? _this.viewPortInfo.endIndex : _this.itemCount;
|
|
4832
|
+
_this.previousStartIndex = 0;
|
|
4833
|
+
_this.previousEndIndex = 0;
|
|
4834
|
+
}
|
|
4835
|
+
var dataSourceCount = void 0;
|
|
4836
|
+
if (_this.dataSource instanceof DataManager) {
|
|
4837
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4838
|
+
dataSourceCount = _this.virtualGroupDataSource && _this.virtualGroupDataSource.length ? _this.virtualGroupDataSource.length : 0;
|
|
4839
|
+
}
|
|
4840
|
+
else {
|
|
4841
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4842
|
+
dataSourceCount = _this.dataSource && _this.dataSource.length ? _this.dataSource.length : 0;
|
|
4843
|
+
}
|
|
4844
|
+
if (_this.enableVirtualization && (_this.allowFiltering || _this.allowCustomValue) && _this.value != null && _this.targetElement() && _this.totalItemCount !== dataSourceCount) {
|
|
4845
|
+
_this.updateInitialData();
|
|
4846
|
+
_this.checkAndResetCache();
|
|
4847
|
+
}
|
|
4848
|
+
if (_this.virtualCustomData && _this.viewPortInfo && _this.viewPortInfo.startIndex === 0 && _this.viewPortInfo.endIndex === _this.itemCount) {
|
|
4849
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4850
|
+
_this.renderItems(_this.mainData, _this.fields);
|
|
4851
|
+
}
|
|
4852
|
+
_this.virtualCustomData = null;
|
|
4853
|
+
_this.isVirtualTrackHeight = false;
|
|
3874
4854
|
}
|
|
3875
4855
|
});
|
|
3876
4856
|
}
|
|
@@ -3885,6 +4865,7 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
3885
4865
|
if (!this.enabled) {
|
|
3886
4866
|
return;
|
|
3887
4867
|
}
|
|
4868
|
+
this.firstItem = this.dataSource && this.dataSource.length > 0 ? this.dataSource[0] : null;
|
|
3888
4869
|
var args = { cancel: false };
|
|
3889
4870
|
this.trigger('beforeOpen', args, function (args) {
|
|
3890
4871
|
if (!args.cancel) {
|
|
@@ -3907,6 +4888,47 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
3907
4888
|
return;
|
|
3908
4889
|
}
|
|
3909
4890
|
_this.onPopupShown(e);
|
|
4891
|
+
if (_this.enableVirtualization && _this.listData && _this.listData.length) {
|
|
4892
|
+
if (!isNullOrUndefined(_this.value) && (_this.getModuleName() === 'dropdownlist' || _this.getModuleName() === 'combobox')) {
|
|
4893
|
+
_this.removeHover();
|
|
4894
|
+
}
|
|
4895
|
+
if (!_this.beforePopupOpen) {
|
|
4896
|
+
if (_this.hideSelectedItem && _this.value && Array.isArray(_this.value) && _this.value.length > 0) {
|
|
4897
|
+
_this.totalItemsCount();
|
|
4898
|
+
}
|
|
4899
|
+
if (!_this.preventSetCurrentData && !isNullOrUndefined(_this.viewPortInfo.startIndex) && !isNullOrUndefined(_this.viewPortInfo.endIndex)) {
|
|
4900
|
+
_this.notify("setCurrentViewDataAsync", {
|
|
4901
|
+
component: _this.getModuleName(),
|
|
4902
|
+
module: "VirtualScroll",
|
|
4903
|
+
});
|
|
4904
|
+
}
|
|
4905
|
+
}
|
|
4906
|
+
}
|
|
4907
|
+
if (_this.enableVirtualization && !_this.allowFiltering && _this.selectedValueInfo != null && _this.selectedValueInfo.startIndex > 0 && _this.value != null) {
|
|
4908
|
+
_this.notify("dataProcessAsync", {
|
|
4909
|
+
module: "VirtualScroll",
|
|
4910
|
+
isOpen: true,
|
|
4911
|
+
});
|
|
4912
|
+
}
|
|
4913
|
+
if (_this.enableVirtualization) {
|
|
4914
|
+
_this.updatevirtualizationList();
|
|
4915
|
+
}
|
|
4916
|
+
else {
|
|
4917
|
+
if (_this.value && _this.value.length) {
|
|
4918
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4919
|
+
var element = void 0;
|
|
4920
|
+
var listItems = _this.getItems();
|
|
4921
|
+
for (var _i = 0, _a = _this.value; _i < _a.length; _i++) {
|
|
4922
|
+
var value = _a[_i];
|
|
4923
|
+
var checkValue = _this.allowObjectBinding ? getValue((_this.fields.value) ? _this.fields.value : '', value) : value;
|
|
4924
|
+
element = _this.getElementByValue(checkValue);
|
|
4925
|
+
if (element) {
|
|
4926
|
+
_this.addListSelection(element);
|
|
4927
|
+
}
|
|
4928
|
+
}
|
|
4929
|
+
}
|
|
4930
|
+
}
|
|
4931
|
+
_this.preventSetCurrentData = true;
|
|
3910
4932
|
}
|
|
3911
4933
|
});
|
|
3912
4934
|
};
|
|
@@ -4059,6 +5081,13 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
4059
5081
|
this.wireEvent();
|
|
4060
5082
|
this.enable(this.enabled);
|
|
4061
5083
|
this.enableRTL(this.enableRtl);
|
|
5084
|
+
if (this.enableVirtualization) {
|
|
5085
|
+
this.updateVirtualizationProperties(this.itemCount, this.allowFiltering, this.mode === 'CheckBox');
|
|
5086
|
+
}
|
|
5087
|
+
this.listItemHeight = this.getListHeight();
|
|
5088
|
+
this.getSkeletonCount();
|
|
5089
|
+
this.viewPortInfo.startIndex = this.virtualItemStartIndex = 0;
|
|
5090
|
+
this.viewPortInfo.endIndex = this.virtualItemEndIndex = this.viewPortInfo.startIndex > 0 ? this.viewPortInfo.endIndex : this.itemCount;
|
|
4062
5091
|
this.checkInitialValue();
|
|
4063
5092
|
if (this.element.hasAttribute('data-val')) {
|
|
4064
5093
|
this.element.setAttribute('data-val', 'false');
|
|
@@ -4070,6 +5099,22 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
4070
5099
|
}
|
|
4071
5100
|
this.renderComplete();
|
|
4072
5101
|
};
|
|
5102
|
+
MultiSelect.prototype.getListHeight = function () {
|
|
5103
|
+
var listParent = this.createElement('div', {
|
|
5104
|
+
className: 'e-dropdownbase'
|
|
5105
|
+
});
|
|
5106
|
+
var item = this.createElement('li', {
|
|
5107
|
+
className: 'e-list-item'
|
|
5108
|
+
});
|
|
5109
|
+
var listParentHeight = formatUnit(this.popupHeight);
|
|
5110
|
+
listParent.style.height = (parseInt(listParentHeight, 10)).toString() + 'px';
|
|
5111
|
+
listParent.appendChild(item);
|
|
5112
|
+
document.body.appendChild(listParent);
|
|
5113
|
+
this.virtualListHeight = listParent.getBoundingClientRect().height;
|
|
5114
|
+
var listItemHeight = Math.ceil(item.getBoundingClientRect().height);
|
|
5115
|
+
listParent.remove();
|
|
5116
|
+
return listItemHeight;
|
|
5117
|
+
};
|
|
4073
5118
|
MultiSelect.prototype.checkInitialValue = function () {
|
|
4074
5119
|
var _this = this;
|
|
4075
5120
|
var isData = this.dataSource instanceof Array ? (this.dataSource.length > 0)
|
|
@@ -4086,7 +5131,8 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
4086
5131
|
var opt = optionsElement[index];
|
|
4087
5132
|
if (!isNullOrUndefined(opt.getAttribute('selected'))) {
|
|
4088
5133
|
if (opt.getAttribute('value')) {
|
|
4089
|
-
|
|
5134
|
+
var value = this.allowObjectBinding ? this.getDataByValue(opt.getAttribute('value')) : opt.getAttribute('value');
|
|
5135
|
+
valueCol.push(value);
|
|
4090
5136
|
}
|
|
4091
5137
|
else {
|
|
4092
5138
|
textCol += (opt.text + this.delimiterChar);
|
|
@@ -4113,14 +5159,40 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
4113
5159
|
this.initialTextUpdate();
|
|
4114
5160
|
}
|
|
4115
5161
|
if (this.value && this.value.length) {
|
|
5162
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5163
|
+
var listItems_2;
|
|
5164
|
+
if (this.enableVirtualization) {
|
|
5165
|
+
var fields = (this.fields.value) ? this.fields.value : '';
|
|
5166
|
+
var predicate = void 0;
|
|
5167
|
+
for (var i = 0; i < this.value.length; i++) {
|
|
5168
|
+
var value = this.allowObjectBinding ? getValue((this.fields.value) ? this.fields.value : '', this.value[i]) : this.value[i];
|
|
5169
|
+
if (i === 0) {
|
|
5170
|
+
predicate = new Predicate(fields, 'equal', value);
|
|
5171
|
+
}
|
|
5172
|
+
else {
|
|
5173
|
+
predicate = predicate.or(fields, 'equal', value);
|
|
5174
|
+
}
|
|
5175
|
+
}
|
|
5176
|
+
if (this.dataSource instanceof DataManager) {
|
|
5177
|
+
this.dataSource.executeQuery(new Query().where(predicate))
|
|
5178
|
+
.then(function (e) {
|
|
5179
|
+
if (e.result.result.length > 0) {
|
|
5180
|
+
listItems_2 = e.result.result;
|
|
5181
|
+
}
|
|
5182
|
+
});
|
|
5183
|
+
}
|
|
5184
|
+
else {
|
|
5185
|
+
listItems_2 = new DataManager(this.dataSource).executeLocal(new Query().where(predicate));
|
|
5186
|
+
}
|
|
5187
|
+
}
|
|
4116
5188
|
if (!(this.dataSource instanceof DataManager)) {
|
|
4117
|
-
this.initialValueUpdate();
|
|
5189
|
+
this.initialValueUpdate(listItems_2);
|
|
4118
5190
|
this.initialUpdate();
|
|
4119
5191
|
}
|
|
4120
5192
|
else {
|
|
4121
5193
|
this.setInitialValue = function () {
|
|
4122
5194
|
_this.initStatus = false;
|
|
4123
|
-
_this.initialValueUpdate();
|
|
5195
|
+
_this.initialValueUpdate(listItems_2);
|
|
4124
5196
|
_this.initialUpdate();
|
|
4125
5197
|
_this.setInitialValue = null;
|
|
4126
5198
|
_this.initStatus = true;
|
|
@@ -4142,6 +5214,34 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
4142
5214
|
this.inputElement.focus();
|
|
4143
5215
|
}
|
|
4144
5216
|
};
|
|
5217
|
+
MultiSelect.prototype.updatevirtualizationList = function () {
|
|
5218
|
+
if (this.value && this.value.length) {
|
|
5219
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5220
|
+
var element = void 0;
|
|
5221
|
+
var listItems = this.getItems();
|
|
5222
|
+
for (var _i = 0, _a = this.value; _i < _a.length; _i++) {
|
|
5223
|
+
var value = _a[_i];
|
|
5224
|
+
var checkValue = this.allowObjectBinding ? getValue((this.fields.value) ? this.fields.value : '', value) : value;
|
|
5225
|
+
element = this.getElementByValue(checkValue);
|
|
5226
|
+
if (element) {
|
|
5227
|
+
this.addListSelection(element);
|
|
5228
|
+
}
|
|
5229
|
+
}
|
|
5230
|
+
if (this.enableVirtualization && this.hideSelectedItem) {
|
|
5231
|
+
var visibleListElements = this.list.querySelectorAll('li.'
|
|
5232
|
+
+ dropDownBaseClasses.li
|
|
5233
|
+
+ ':not(.' + HIDE_LIST + ')' + ':not(.e-reorder-hide)' + ':not(.e-virtual-list)');
|
|
5234
|
+
if (visibleListElements.length) {
|
|
5235
|
+
var actualCount = this.virtualListHeight > 0 ? Math.floor(this.virtualListHeight / this.listItemHeight) : 0;
|
|
5236
|
+
if (visibleListElements.length < (actualCount + 2)) {
|
|
5237
|
+
var query = this.getForQuery(this.value).clone();
|
|
5238
|
+
query = query.skip(this.viewPortInfo.startIndex);
|
|
5239
|
+
this.resetList(this.dataSource, this.fields, query);
|
|
5240
|
+
}
|
|
5241
|
+
}
|
|
5242
|
+
}
|
|
5243
|
+
}
|
|
5244
|
+
};
|
|
4145
5245
|
MultiSelect.prototype.setFloatLabelType = function () {
|
|
4146
5246
|
removeFloating(this.overAllWrapper, this.componentWrapper, this.searchWrapper, this.inputElement, this.value, this.floatLabelType, this.placeholder);
|
|
4147
5247
|
if (this.floatLabelType !== 'Never') {
|
|
@@ -4175,6 +5275,8 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
4175
5275
|
if (this.mode !== 'Box' && !(this.setDynValue && this.mode === 'Default' && this.inputFocus)) {
|
|
4176
5276
|
this.updateDelimView();
|
|
4177
5277
|
}
|
|
5278
|
+
this.viewPortInfo.startIndex = this.virtualItemStartIndex = 0;
|
|
5279
|
+
this.viewPortInfo.endIndex = this.virtualItemEndIndex = this.itemCount;
|
|
4178
5280
|
this.updateCssClass();
|
|
4179
5281
|
this.updateHTMLAttribute();
|
|
4180
5282
|
this.updateReadonly(this.readonly);
|
|
@@ -4271,6 +5373,9 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
4271
5373
|
__decorate([
|
|
4272
5374
|
Property(true)
|
|
4273
5375
|
], MultiSelect.prototype, "enableHtmlSanitizer", void 0);
|
|
5376
|
+
__decorate([
|
|
5377
|
+
Property(false)
|
|
5378
|
+
], MultiSelect.prototype, "enableVirtualization", void 0);
|
|
4274
5379
|
__decorate([
|
|
4275
5380
|
Property([])
|
|
4276
5381
|
], MultiSelect.prototype, "dataSource", void 0);
|
|
@@ -4349,6 +5454,9 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
4349
5454
|
__decorate([
|
|
4350
5455
|
Property(null)
|
|
4351
5456
|
], MultiSelect.prototype, "value", void 0);
|
|
5457
|
+
__decorate([
|
|
5458
|
+
Property(false)
|
|
5459
|
+
], MultiSelect.prototype, "allowObjectBinding", void 0);
|
|
4352
5460
|
__decorate([
|
|
4353
5461
|
Property(true)
|
|
4354
5462
|
], MultiSelect.prototype, "hideSelectedItem", void 0);
|