@syncfusion/ej2-dropdowns 24.2.9 → 25.1.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +23 -158
- 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 +1996 -513
- package/dist/es6/ej2-dropdowns.es2015.js.map +1 -1
- package/dist/es6/ej2-dropdowns.es5.js +2012 -512
- 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.js +8 -2
- 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 +34 -4
- package/src/multi-select/multi-select.js +1271 -173
- 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 +2 -1
- package/styles/material.css +2 -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/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 +2 -1
- package/styles/multi-select/material.css +2 -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
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Animation, Browser, ChildProperty, Complex, Component, Event, EventHandler, KeyboardEvents, L10n, NotifyPropertyChanges, Property, SanitizeHtmlHelper, Touch, addClass, append, attributes, classList, closest, compile, createElement, debounce, detach, extend, formatUnit, getComponent, getUniqueID, getValue, isNullOrUndefined, isUndefined, matches, prepend, remove, removeClass, rippleEffect, select, selectAll, setStyleAttribute, setValue } from '@syncfusion/ej2-base';
|
|
2
2
|
import { DataManager, DataUtil, JsonAdaptor, Predicate, Query } from '@syncfusion/ej2-data';
|
|
3
3
|
import { ListBase, Sortable, cssClass, moveTo } from '@syncfusion/ej2-lists';
|
|
4
|
+
import { Skeleton } from '@syncfusion/ej2-notifications';
|
|
4
5
|
import { Popup, createSpinner, getZindexPartial, hideSpinner, isCollide, showSpinner } from '@syncfusion/ej2-popups';
|
|
5
6
|
import { Input, TextBox } from '@syncfusion/ej2-inputs';
|
|
6
|
-
import { Skeleton } from '@syncfusion/ej2-notifications';
|
|
7
7
|
import { Button, createCheckBox } from '@syncfusion/ej2-buttons';
|
|
8
8
|
import { TreeView } from '@syncfusion/ej2-navigations';
|
|
9
9
|
|
|
@@ -379,7 +379,9 @@ var VirtualScroll = /** @__PURE__ @class */ (function () {
|
|
|
379
379
|
if (isQueryGenerated === void 0) { isQueryGenerated = false; }
|
|
380
380
|
var dataSource = this.parent.dataSource;
|
|
381
381
|
if (!isQueryGenerated) {
|
|
382
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
382
383
|
if (!isNullOrUndefined(this.parent.query)) {
|
|
384
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
383
385
|
var newQuery = this.removeSkipAndTakeEvents(this.parent.query.clone());
|
|
384
386
|
query = this.getPageQuery(newQuery, virtualItemStartIndex, virtualItemEndIndex);
|
|
385
387
|
}
|
|
@@ -394,6 +396,7 @@ var VirtualScroll = /** @__PURE__ @class */ (function () {
|
|
|
394
396
|
totalData = this.parent.dataSource.dataSource.json.length;
|
|
395
397
|
}
|
|
396
398
|
else if (this.parent.dataSource && this.parent.dataSource.length > 0) {
|
|
399
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
397
400
|
totalData = this.parent.dataSource.length;
|
|
398
401
|
}
|
|
399
402
|
if (totalData > 0) {
|
|
@@ -410,22 +413,151 @@ var VirtualScroll = /** @__PURE__ @class */ (function () {
|
|
|
410
413
|
});
|
|
411
414
|
return query;
|
|
412
415
|
};
|
|
413
|
-
VirtualScroll.prototype.setCurrentViewDataAsync = function () {
|
|
416
|
+
VirtualScroll.prototype.setCurrentViewDataAsync = function (component) {
|
|
414
417
|
// eslint-disable-next-line
|
|
415
418
|
var currentData = [];
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
419
|
+
var isResetListCalled = false;
|
|
420
|
+
var isListUpdated = true;
|
|
421
|
+
if (isNullOrUndefined(this.component)) {
|
|
422
|
+
this.component = component.component;
|
|
423
|
+
}
|
|
424
|
+
var endIndex = this.parent.viewPortInfo.endIndex;
|
|
425
|
+
if (this.component === 'multiselect' && this.parent.mode === 'CheckBox' && this.parent.value && Array.isArray(this.parent.value) && this.parent.value.length > 0 && this.parent.enableSelectionOrder) {
|
|
426
|
+
if (this.parent.viewPortInfo.startIndex < this.parent.value.length) {
|
|
427
|
+
endIndex = this.parent.viewPortInfo.endIndex - this.parent.value.length;
|
|
428
|
+
if (this.parent.viewPortInfo.startIndex === 0) {
|
|
429
|
+
this.parent.updateVirtualReOrderList(true);
|
|
430
|
+
if (this.parent.value.length < this.parent.itemCount) {
|
|
431
|
+
var oldUlElement = this.parent.list.querySelector('.e-list-parent' + ':not(.e-reorder)');
|
|
432
|
+
if (oldUlElement) {
|
|
433
|
+
this.parent.list.querySelector('.e-virtual-ddl-content').removeChild(oldUlElement);
|
|
434
|
+
}
|
|
435
|
+
var query = this.parent.getForQuery(this.parent.value).clone();
|
|
436
|
+
query = query.skip(0).take(this.parent.itemCount - (this.parent.value.length - this.parent.viewPortInfo.startIndex));
|
|
437
|
+
this.parent.appendUncheckList = true;
|
|
438
|
+
this.parent.resetList(this.parent.dataSource, this.parent.fields, query);
|
|
439
|
+
isListUpdated = false;
|
|
440
|
+
this.parent.appendUncheckList = false;
|
|
441
|
+
isListUpdated = false;
|
|
442
|
+
}
|
|
443
|
+
else {
|
|
444
|
+
var oldUlElement = this.parent.list.querySelector('.e-list-parent' + ':not(.e-reorder)');
|
|
445
|
+
if (oldUlElement) {
|
|
446
|
+
this.parent.list.querySelector('.e-virtual-ddl-content').removeChild(oldUlElement);
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
isListUpdated = false;
|
|
450
|
+
}
|
|
451
|
+
else if (this.parent.viewPortInfo.startIndex != 0) {
|
|
452
|
+
this.parent.updateVirtualReOrderList(true);
|
|
453
|
+
var oldUlElement = this.parent.list.querySelector('.e-list-parent' + ':not(.e-reorder)');
|
|
454
|
+
if (oldUlElement) {
|
|
455
|
+
this.parent.list.querySelector('.e-virtual-ddl-content').removeChild(oldUlElement);
|
|
456
|
+
}
|
|
457
|
+
isListUpdated = false;
|
|
458
|
+
}
|
|
459
|
+
if (this.parent.viewPortInfo.startIndex != 0 && this.parent.viewPortInfo.startIndex - this.parent.value.length != this.parent.itemCount && (this.parent.viewPortInfo.startIndex + this.parent.itemCount > this.parent.value.length)) {
|
|
460
|
+
var query = this.parent.getForQuery(this.parent.value).clone();
|
|
461
|
+
query = query.skip(0).take(this.parent.itemCount - (this.parent.value.length - this.parent.viewPortInfo.startIndex));
|
|
462
|
+
this.parent.appendUncheckList = true;
|
|
463
|
+
this.parent.resetList(this.parent.dataSource, this.parent.fields, query);
|
|
464
|
+
isListUpdated = false;
|
|
465
|
+
this.parent.appendUncheckList = false;
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
else {
|
|
469
|
+
var reOrderList = this.parent.list.querySelectorAll('.e-reorder')[0];
|
|
470
|
+
if (this.parent.list.querySelector('.e-virtual-ddl-content') && reOrderList) {
|
|
471
|
+
this.parent.list.querySelector('.e-virtual-ddl-content').removeChild(reOrderList);
|
|
472
|
+
}
|
|
473
|
+
var query = this.parent.getForQuery(this.parent.value).clone();
|
|
474
|
+
if (!this.parent.allowFiltering) { //need to check with allowFiltering false
|
|
475
|
+
var skipvalue = this.parent.viewPortInfo.startIndex - this.parent.value.length >= 0 ? this.parent.viewPortInfo.startIndex - this.parent.value.length : 0;
|
|
476
|
+
query = query.skip(skipvalue);
|
|
477
|
+
}
|
|
478
|
+
this.parent.resetList(this.parent.dataSource, this.parent.fields, query);
|
|
479
|
+
isListUpdated = false;
|
|
480
|
+
}
|
|
481
|
+
this.parent.totalItemsCount();
|
|
482
|
+
}
|
|
483
|
+
if (isListUpdated) {
|
|
484
|
+
for (var i = this.parent.viewPortInfo.startIndex; i < endIndex; i++) {
|
|
485
|
+
var index = i;
|
|
486
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
487
|
+
var alreadyAddedData = this.parent.generatedDataObject[index];
|
|
488
|
+
if (this.component === 'multiselect' && this.parent.hideSelectedItem) {
|
|
489
|
+
if (alreadyAddedData) {
|
|
490
|
+
var value = getValue(this.parent.fields.value, alreadyAddedData[0]);
|
|
491
|
+
if (this.parent.value && value != null && Array.isArray(this.parent.value) && this.parent.value.length > 0 && this.parent.value.indexOf(value) < 0) {
|
|
492
|
+
var query = this.parent.getForQuery(this.parent.value).clone();
|
|
493
|
+
if (this.parent.viewPortInfo.endIndex == this.parent.totalItemCount + this.parent.value.length && this.parent.hideSelectedItem) {
|
|
494
|
+
query = query.skip(this.parent.totalItemCount - this.parent.itemCount);
|
|
495
|
+
}
|
|
496
|
+
else {
|
|
497
|
+
query = query.skip(this.parent.viewPortInfo.startIndex);
|
|
498
|
+
}
|
|
499
|
+
this.parent.resetList(this.parent.dataSource, this.parent.fields, query);
|
|
500
|
+
isResetListCalled = true;
|
|
501
|
+
break;
|
|
502
|
+
}
|
|
503
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
504
|
+
else if ((this.parent.value === null || (this.parent.value && this.parent.value.length === 0))) {
|
|
505
|
+
currentData.push(alreadyAddedData[0]);
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
if (index === endIndex - 1) {
|
|
509
|
+
if (currentData.length != this.parent.itemCount) {
|
|
510
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
511
|
+
if (this.parent.hideSelectedItem) {
|
|
512
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
513
|
+
var query = this.parent.getForQuery(this.parent.value).clone();
|
|
514
|
+
if (this.parent.viewPortInfo.endIndex == this.parent.totalItemCount + this.parent.value.length && this.parent.hideSelectedItem) {
|
|
515
|
+
query = query.skip(this.parent.totalItemCount - this.parent.itemCount);
|
|
516
|
+
}
|
|
517
|
+
else {
|
|
518
|
+
query = query.skip(this.parent.viewPortInfo.startIndex);
|
|
519
|
+
}
|
|
520
|
+
this.parent.resetList(this.parent.dataSource, this.parent.fields, query);
|
|
521
|
+
isResetListCalled = true;
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
else {
|
|
527
|
+
if (alreadyAddedData) {
|
|
528
|
+
currentData.push(alreadyAddedData[0]);
|
|
529
|
+
}
|
|
530
|
+
}
|
|
421
531
|
}
|
|
422
532
|
}
|
|
423
|
-
|
|
533
|
+
if (!isResetListCalled && isListUpdated) {
|
|
534
|
+
if (this.component === 'multiselect' && this.parent.allowCustomValue && this.parent.viewPortInfo.startIndex == 0 && this.parent.virtualCustomData) {
|
|
535
|
+
currentData.splice(0, 0, this.parent.virtualCustomData);
|
|
536
|
+
}
|
|
537
|
+
var totalData = [];
|
|
538
|
+
if (this.component === 'multiselect' && this.parent.allowCustomValue && this.parent.viewPortInfo.endIndex == this.parent.totalItemCount) {
|
|
539
|
+
if (this.parent.virtualCustomSelectData && this.parent.virtualCustomSelectData.length > 0) {
|
|
540
|
+
totalData = currentData.concat(this.parent.virtualCustomSelectData);
|
|
541
|
+
currentData = totalData;
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
var ulElement = this.parent.renderItems(currentData, this.parent.fields, this.component === 'multiselect' && this.parent.mode === 'CheckBox');
|
|
545
|
+
}
|
|
546
|
+
if (this.component === 'multiselect') {
|
|
547
|
+
this.parent.updatevirtualizationList();
|
|
548
|
+
}
|
|
549
|
+
this.parent.getSkeletonCount();
|
|
424
550
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
425
551
|
var virtualTrackElement = this.parent.list.getElementsByClassName('e-virtual-ddl')[0];
|
|
426
552
|
if (virtualTrackElement) {
|
|
427
553
|
(virtualTrackElement).style = this.parent.GetVirtualTrackHeight();
|
|
428
554
|
}
|
|
555
|
+
else if (!virtualTrackElement && this.parent.skeletonCount > 0 && this.parent.popupWrapper) {
|
|
556
|
+
var virualElement = this.parent.createElement('div', {
|
|
557
|
+
id: this.parent.element.id + '_popup', className: 'e-virtual-ddl', styles: this.parent.GetVirtualTrackHeight()
|
|
558
|
+
});
|
|
559
|
+
this.parent.popupWrapper.querySelector('.e-dropdownbase').appendChild(virualElement);
|
|
560
|
+
}
|
|
429
561
|
this.parent.UpdateSkeleton();
|
|
430
562
|
this.parent.liCollections = this.parent.list.querySelectorAll('.e-list-item');
|
|
431
563
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -436,13 +568,17 @@ var VirtualScroll = /** @__PURE__ @class */ (function () {
|
|
|
436
568
|
if (this.parent.fields.groupBy) {
|
|
437
569
|
this.parent.scrollStop();
|
|
438
570
|
}
|
|
571
|
+
if (this.parent.keyCode == 40 && this.parent.isScrollChanged && this.parent.hideSelectedItem && !isNullOrUndefined(this.parent.currentFocuedListElement)) {
|
|
572
|
+
var currentSelectElem = this.parent.getElementByValue(this.parent.currentFocuedListElement.getAttribute('data-value'));
|
|
573
|
+
this.parent.addListFocus(currentSelectElem);
|
|
574
|
+
this.parent.isScrollChanged = false;
|
|
575
|
+
}
|
|
439
576
|
};
|
|
440
577
|
VirtualScroll.prototype.generateQueryAndSetQueryIndexAsync = function (query, isPopupOpen) {
|
|
441
578
|
var isStartIndexInitialised = false;
|
|
442
579
|
var queryStartIndex = 0;
|
|
443
580
|
var queryEndIndex = 0;
|
|
444
|
-
var
|
|
445
|
-
var vEndIndex = this.parent && this.parent.viewPortInfo.endIndex !== 0 ? this.parent.viewPortInfo.endIndex : sortedDataStartIndex + this.parent.getItems().length;
|
|
581
|
+
var vEndIndex = this.parent.viewPortInfo.endIndex;
|
|
446
582
|
if (!isPopupOpen && vEndIndex !== 0) {
|
|
447
583
|
for (var i = this.parent.viewPortInfo.startIndex; i <= vEndIndex; i++) {
|
|
448
584
|
if (!(i in this.parent.generatedDataObject)) {
|
|
@@ -460,6 +596,13 @@ var VirtualScroll = /** @__PURE__ @class */ (function () {
|
|
|
460
596
|
this.parent.virtualItemStartIndex = queryStartIndex;
|
|
461
597
|
this.parent.virtualItemEndIndex = queryEndIndex;
|
|
462
598
|
this.generateAndExecuteQueryAsync(query, queryStartIndex, queryEndIndex);
|
|
599
|
+
if (this.component === 'multiselect' && this.parent.hideSelectedItem && this.parent.value && Array.isArray(this.parent.value) && this.parent.value.length > 0) {
|
|
600
|
+
this.parent.totalItemsCount();
|
|
601
|
+
}
|
|
602
|
+
if (this.component === 'multiselect' && this.parent.virtualItemStartIndex === this.parent.virtualItemEndIndex) {
|
|
603
|
+
this.parent.virtualItemStartIndex = this.parent.viewPortInfo.startIndex;
|
|
604
|
+
this.parent.virtualItemEndIndex = this.parent.viewPortInfo.endIndex;
|
|
605
|
+
}
|
|
463
606
|
}
|
|
464
607
|
this.setCurrentViewDataAsync();
|
|
465
608
|
};
|
|
@@ -505,7 +648,8 @@ var VirtualScroll = /** @__PURE__ @class */ (function () {
|
|
|
505
648
|
};
|
|
506
649
|
VirtualScroll.prototype.scrollListener = function (scrollArgs) {
|
|
507
650
|
var _this = this;
|
|
508
|
-
if (!this.parent.isPreventScrollAction) {
|
|
651
|
+
if (!this.parent.isPreventScrollAction && !this.parent.isVirtualTrackHeight) {
|
|
652
|
+
this.parent.preventSetCurrentData = false;
|
|
509
653
|
var info = scrollArgs.sentinel;
|
|
510
654
|
var pStartIndex = this.parent.previousStartIndex;
|
|
511
655
|
this.parent.viewPortInfo = this.getInfoFromView(scrollArgs.direction, info, scrollArgs.offset, false);
|
|
@@ -541,20 +685,6 @@ var VirtualScroll = /** @__PURE__ @class */ (function () {
|
|
|
541
685
|
this.parent.previousInfo = this.parent.viewPortInfo;
|
|
542
686
|
}
|
|
543
687
|
};
|
|
544
|
-
VirtualScroll.prototype.getPageCount = function (popupElement, returnExactCount) {
|
|
545
|
-
if (returnExactCount === void 0) { returnExactCount = false; }
|
|
546
|
-
var list = popupElement && popupElement.querySelector('.e-content');
|
|
547
|
-
if (list) {
|
|
548
|
-
var liHeight = list.classList.contains('e-nodata') ? null : getComputedStyle(list.querySelectorAll('.e-list-item')[0], null).getPropertyValue('height');
|
|
549
|
-
var pageCount = list.getBoundingClientRect().height / parseInt(liHeight, 10);
|
|
550
|
-
return returnExactCount ? pageCount : Math.round(pageCount);
|
|
551
|
-
}
|
|
552
|
-
return 0;
|
|
553
|
-
};
|
|
554
|
-
|
|
555
|
-
VirtualScroll.prototype.getRowHeight = function () {
|
|
556
|
-
return (isNullOrUndefined(this.parent.liCollections) || this.parent.liCollections.length == 0) ? 0 : Math.ceil(this.parent.liCollections[0].getBoundingClientRect().height);
|
|
557
|
-
};
|
|
558
688
|
VirtualScroll.prototype.getInfoFromView = function (direction, info, e, isscrollAction) {
|
|
559
689
|
var infoType = {
|
|
560
690
|
direction: direction, sentinelInfo: info, offsets: e,
|
|
@@ -590,7 +720,7 @@ var VirtualScroll = /** @__PURE__ @class */ (function () {
|
|
|
590
720
|
var idxAddedToExactTop = (pageSizeBy4) > infoViewIndices ? pageSizeBy4 :
|
|
591
721
|
(infoViewIndices + infoViewIndices / 4);
|
|
592
722
|
var eIndex = Math.round(exactTopIndex + idxAddedToExactTop);
|
|
593
|
-
infoType.endIndex = eIndex < totalItemCount ? eIndex : totalItemCount;
|
|
723
|
+
infoType.endIndex = (eIndex < totalItemCount || this.component == "multiselect") ? eIndex : totalItemCount;
|
|
594
724
|
var sIndex = infoType.endIndex - this.parent.virtualItemCount;
|
|
595
725
|
infoType.startIndex = sIndex > 0 ? sIndex : 0;
|
|
596
726
|
infoType.endIndex = sIndex < 0 ? this.parent.virtualItemCount : infoType.endIndex;
|
|
@@ -625,7 +755,7 @@ var VirtualScroll = /** @__PURE__ @class */ (function () {
|
|
|
625
755
|
top: top,
|
|
626
756
|
left: left
|
|
627
757
|
};
|
|
628
|
-
if (_this.parent.list.querySelectorAll('.e-virtual-list').length > 0) {
|
|
758
|
+
if (_this.parent.list && _this.parent.list.querySelectorAll('.e-virtual-list').length > 0) {
|
|
629
759
|
var infoview = _this.getInfoFromView(direction, current, scrollOffsetargs, true);
|
|
630
760
|
if (_this.parent.scrollPreStartIndex != pstartIndex && !_this.parent.isPreventScrollAction) {
|
|
631
761
|
_this.parent.isScrollActionTriggered = true;
|
|
@@ -704,7 +834,8 @@ var dropDownBaseClasses = {
|
|
|
704
834
|
li: 'e-list-item',
|
|
705
835
|
group: 'e-list-group-item',
|
|
706
836
|
disabled: 'e-disabled',
|
|
707
|
-
grouping: 'e-dd-group'
|
|
837
|
+
grouping: 'e-dd-group',
|
|
838
|
+
virtualList: 'e-list-item e-virtual-list',
|
|
708
839
|
};
|
|
709
840
|
var ITEMTEMPLATE_PROPERTY = 'ItemTemplate';
|
|
710
841
|
var DISPLAYTEMPLATE_PROPERTY = 'DisplayTemplate';
|
|
@@ -738,13 +869,63 @@ var DropDownBase = /** @__PURE__ @class */ (function (_super) {
|
|
|
738
869
|
_this.isAddNewItemTemplate = false;
|
|
739
870
|
_this.isRequesting = false;
|
|
740
871
|
_this.isVirtualizationEnabled = false;
|
|
872
|
+
_this.isCustomDataUpdated = false;
|
|
741
873
|
_this.isAllowFiltering = false;
|
|
742
874
|
_this.virtualizedItemsCount = 0;
|
|
875
|
+
_this.isCheckBoxSelection = false;
|
|
743
876
|
_this.totalItemCount = 0;
|
|
744
877
|
_this.dataCount = 0;
|
|
745
878
|
_this.isRemoteDataUpdated = false;
|
|
746
879
|
_this.isIncrementalRequest = false;
|
|
747
880
|
_this.itemCount = 10;
|
|
881
|
+
_this.virtualListHeight = 0;
|
|
882
|
+
_this.isVirtualScrolling = false;
|
|
883
|
+
_this.isPreventScrollAction = false;
|
|
884
|
+
_this.scrollPreStartIndex = 0;
|
|
885
|
+
_this.isScrollActionTriggered = false;
|
|
886
|
+
_this.previousStartIndex = 0;
|
|
887
|
+
_this.isMouseScrollAction = false;
|
|
888
|
+
_this.isKeyBoardAction = false;
|
|
889
|
+
_this.isScrollChanged = false;
|
|
890
|
+
_this.isUpwardScrolling = false;
|
|
891
|
+
_this.startIndex = 0;
|
|
892
|
+
_this.currentPageNumber = 0;
|
|
893
|
+
_this.pageCount = 0;
|
|
894
|
+
_this.isPreventKeyAction = false;
|
|
895
|
+
_this.generatedDataObject = {};
|
|
896
|
+
_this.skeletonCount = 32;
|
|
897
|
+
_this.isVirtualTrackHeight = false;
|
|
898
|
+
_this.virtualSelectAll = false;
|
|
899
|
+
_this.incrementalQueryString = '';
|
|
900
|
+
_this.incrementalEndIndex = 0;
|
|
901
|
+
_this.incrementalStartIndex = 0;
|
|
902
|
+
_this.incrementalPreQueryString = '';
|
|
903
|
+
_this.isObjectCustomValue = false;
|
|
904
|
+
_this.appendUncheckList = false;
|
|
905
|
+
_this.virtualListInfo = {
|
|
906
|
+
currentPageNumber: null,
|
|
907
|
+
direction: null,
|
|
908
|
+
sentinelInfo: {},
|
|
909
|
+
offsets: {},
|
|
910
|
+
startIndex: 0,
|
|
911
|
+
endIndex: 0,
|
|
912
|
+
};
|
|
913
|
+
_this.viewPortInfo = {
|
|
914
|
+
currentPageNumber: null,
|
|
915
|
+
direction: null,
|
|
916
|
+
sentinelInfo: {},
|
|
917
|
+
offsets: {},
|
|
918
|
+
startIndex: 0,
|
|
919
|
+
endIndex: 0,
|
|
920
|
+
};
|
|
921
|
+
_this.selectedValueInfo = {
|
|
922
|
+
currentPageNumber: null,
|
|
923
|
+
direction: null,
|
|
924
|
+
sentinelInfo: {},
|
|
925
|
+
offsets: {},
|
|
926
|
+
startIndex: 0,
|
|
927
|
+
endIndex: 0,
|
|
928
|
+
};
|
|
748
929
|
return _this;
|
|
749
930
|
}
|
|
750
931
|
DropDownBase.prototype.getPropObject = function (prop, newProp, oldProp) {
|
|
@@ -958,6 +1139,124 @@ var DropDownBase = /** @__PURE__ @class */ (function (_super) {
|
|
|
958
1139
|
}
|
|
959
1140
|
}
|
|
960
1141
|
};
|
|
1142
|
+
DropDownBase.prototype.checkAndResetCache = function () {
|
|
1143
|
+
if (this.isVirtualizationEnabled) {
|
|
1144
|
+
this.generatedDataObject = {};
|
|
1145
|
+
this.virtualItemStartIndex = this.virtualItemEndIndex = 0;
|
|
1146
|
+
this.viewPortInfo = {
|
|
1147
|
+
currentPageNumber: null,
|
|
1148
|
+
direction: null,
|
|
1149
|
+
sentinelInfo: {},
|
|
1150
|
+
offsets: {},
|
|
1151
|
+
startIndex: 0,
|
|
1152
|
+
endIndex: this.itemCount,
|
|
1153
|
+
};
|
|
1154
|
+
this.selectedValueInfo = null;
|
|
1155
|
+
}
|
|
1156
|
+
};
|
|
1157
|
+
DropDownBase.prototype.updateIncrementalInfo = function (startIndex, endIndex) {
|
|
1158
|
+
this.viewPortInfo.startIndex = startIndex;
|
|
1159
|
+
this.viewPortInfo.endIndex = endIndex;
|
|
1160
|
+
this.updateVirtualItemIndex();
|
|
1161
|
+
this.isIncrementalRequest = true;
|
|
1162
|
+
this.resetList(this.dataSource, this.fields, this.query);
|
|
1163
|
+
this.isIncrementalRequest = false;
|
|
1164
|
+
};
|
|
1165
|
+
DropDownBase.prototype.updateIncrementalView = function (startIndex, endIndex) {
|
|
1166
|
+
this.viewPortInfo.startIndex = startIndex;
|
|
1167
|
+
this.viewPortInfo.endIndex = endIndex;
|
|
1168
|
+
this.updateVirtualItemIndex();
|
|
1169
|
+
this.resetList(this.dataSource, this.fields, this.query);
|
|
1170
|
+
this.UpdateSkeleton();
|
|
1171
|
+
this.liCollections = this.list.querySelectorAll('.' + dropDownBaseClasses.li);
|
|
1172
|
+
this.ulElement = this.list.querySelector('ul');
|
|
1173
|
+
};
|
|
1174
|
+
DropDownBase.prototype.updateVirtualItemIndex = function () {
|
|
1175
|
+
this.virtualItemStartIndex = this.viewPortInfo.startIndex;
|
|
1176
|
+
this.virtualItemEndIndex = this.viewPortInfo.endIndex;
|
|
1177
|
+
this.virtualListInfo = this.viewPortInfo;
|
|
1178
|
+
};
|
|
1179
|
+
DropDownBase.prototype.getFilteringSkeletonCount = function () {
|
|
1180
|
+
var difference = this.dataCount - this.viewPortInfo.endIndex;
|
|
1181
|
+
var currentSkeletonCount = this.skeletonCount;
|
|
1182
|
+
this.getSkeletonCount(true);
|
|
1183
|
+
this.skeletonCount = this.dataCount > this.itemCount * 2 ? this.skeletonCount : difference > this.skeletonCount ? this.skeletonCount : difference > 0 ? difference : 0;
|
|
1184
|
+
var skeletonUpdated = true;
|
|
1185
|
+
if ((this.getModuleName() === 'autocomplete' || this.getModuleName() === 'multiselect') && (this.totalItemCount < (this.itemCount * 2))) {
|
|
1186
|
+
this.skeletonCount = 0;
|
|
1187
|
+
skeletonUpdated = false;
|
|
1188
|
+
}
|
|
1189
|
+
if (!this.list.classList.contains(dropDownBaseClasses.noData)) {
|
|
1190
|
+
var isSkeletonCountChange = currentSkeletonCount !== this.skeletonCount;
|
|
1191
|
+
if (currentSkeletonCount !== this.skeletonCount && skeletonUpdated) {
|
|
1192
|
+
this.UpdateSkeleton(true, Math.abs(currentSkeletonCount - this.skeletonCount));
|
|
1193
|
+
}
|
|
1194
|
+
else {
|
|
1195
|
+
this.UpdateSkeleton();
|
|
1196
|
+
}
|
|
1197
|
+
this.liCollections = this.list.querySelectorAll('.e-list-item');
|
|
1198
|
+
if ((this.list.getElementsByClassName('e-virtual-ddl').length > 0)) {
|
|
1199
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1200
|
+
this.list.getElementsByClassName('e-virtual-ddl')[0].style = this.GetVirtualTrackHeight();
|
|
1201
|
+
}
|
|
1202
|
+
else if (!this.list.querySelector('.e-virtual-ddl') && this.skeletonCount > 0 && this.list.querySelector('.e-dropdownbase')) {
|
|
1203
|
+
var virualElement = this.createElement('div', {
|
|
1204
|
+
id: this.element.id + '_popup', className: 'e-virtual-ddl', styles: this.GetVirtualTrackHeight()
|
|
1205
|
+
});
|
|
1206
|
+
this.list.querySelector('.e-dropdownbase').appendChild(virualElement);
|
|
1207
|
+
}
|
|
1208
|
+
if (this.list.getElementsByClassName('e-virtual-ddl-content').length > 0) {
|
|
1209
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1210
|
+
this.list.getElementsByClassName('e-virtual-ddl-content')[0].style = this.getTransformValues();
|
|
1211
|
+
}
|
|
1212
|
+
}
|
|
1213
|
+
};
|
|
1214
|
+
DropDownBase.prototype.getSkeletonCount = function (retainSkeleton) {
|
|
1215
|
+
this.virtualListHeight = this.listContainerHeight != null ? parseInt(this.listContainerHeight, 10) : this.virtualListHeight;
|
|
1216
|
+
var actualCount = this.virtualListHeight > 0 ? Math.floor(this.virtualListHeight / this.listItemHeight) : 0;
|
|
1217
|
+
this.skeletonCount = actualCount * 2 < this.itemCount ? this.itemCount : actualCount * 2;
|
|
1218
|
+
this.itemCount = retainSkeleton ? this.itemCount : this.skeletonCount;
|
|
1219
|
+
this.skeletonCount = Math.floor(this.skeletonCount / 2) + 2;
|
|
1220
|
+
};
|
|
1221
|
+
DropDownBase.prototype.GetVirtualTrackHeight = function () {
|
|
1222
|
+
var height = this.totalItemCount === this.viewPortInfo.endIndex ? this.totalItemCount * this.listItemHeight - this.itemCount * this.listItemHeight : this.totalItemCount * this.listItemHeight;
|
|
1223
|
+
height = this.isVirtualTrackHeight ? 0 : height;
|
|
1224
|
+
var heightDimension = "height: " + (height - this.itemCount * this.listItemHeight) + "px;";
|
|
1225
|
+
if ((this.getModuleName() === 'autocomplete' || this.getModuleName() === 'multiselect') && this.skeletonCount === 0) {
|
|
1226
|
+
return "height: 0px;";
|
|
1227
|
+
}
|
|
1228
|
+
return heightDimension;
|
|
1229
|
+
};
|
|
1230
|
+
DropDownBase.prototype.getTransformValues = function () {
|
|
1231
|
+
var translateY = this.viewPortInfo.startIndex * this.listItemHeight;
|
|
1232
|
+
translateY = translateY - (this.skeletonCount * this.listItemHeight);
|
|
1233
|
+
translateY = this.viewPortInfo.startIndex === 0 && this.listData && this.listData.length === 0 ? 0 : translateY;
|
|
1234
|
+
var styleText = "transform: translate(0px, " + translateY + "px);";
|
|
1235
|
+
return styleText;
|
|
1236
|
+
};
|
|
1237
|
+
DropDownBase.prototype.UpdateSkeleton = function (isSkeletonCountChange, skeletonCount) {
|
|
1238
|
+
var isContainSkeleton = this.list.querySelector('.e-virtual-ddl-content');
|
|
1239
|
+
var isContainVirtualList = this.list.querySelector('.e-virtual-list');
|
|
1240
|
+
if (isContainSkeleton && (!isContainVirtualList || isSkeletonCountChange) && this.isVirtualizationEnabled) {
|
|
1241
|
+
var totalSkeletonCount = isSkeletonCountChange ? skeletonCount : this.skeletonCount;
|
|
1242
|
+
for (var i = 0; i < totalSkeletonCount; i++) {
|
|
1243
|
+
var liElement = this.createElement('li', { className: dropDownBaseClasses.virtualList, styles: 'overflow: inherit' });
|
|
1244
|
+
if (this.isVirtualizationEnabled && this.itemTemplate) {
|
|
1245
|
+
liElement.style.height = this.listItemHeight + 'px';
|
|
1246
|
+
}
|
|
1247
|
+
var skeleton = new Skeleton({
|
|
1248
|
+
shape: "Text",
|
|
1249
|
+
height: "10px",
|
|
1250
|
+
width: "95%",
|
|
1251
|
+
cssClass: "e-skeleton-text",
|
|
1252
|
+
});
|
|
1253
|
+
skeleton.appendTo(this.createElement('div'));
|
|
1254
|
+
liElement.appendChild(skeleton.element);
|
|
1255
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1256
|
+
isContainSkeleton.firstChild && isContainSkeleton.firstChild.insertBefore(liElement, isContainSkeleton.firstChild.children[0]);
|
|
1257
|
+
}
|
|
1258
|
+
}
|
|
1259
|
+
};
|
|
961
1260
|
DropDownBase.prototype.getLocaleName = function () {
|
|
962
1261
|
return 'drop-down-base';
|
|
963
1262
|
};
|
|
@@ -1206,31 +1505,52 @@ var DropDownBase = /** @__PURE__ @class */ (function (_super) {
|
|
|
1206
1505
|
}
|
|
1207
1506
|
else {
|
|
1208
1507
|
_this.isRequesting = false;
|
|
1508
|
+
var isReOrder = true;
|
|
1209
1509
|
var listItems = void 0;
|
|
1210
1510
|
if (_this.isVirtualizationEnabled && !_this.virtualGroupDataSource && _this.fields.groupBy) {
|
|
1211
1511
|
var data = new DataManager(_this.dataSource).executeLocal(new Query().group(_this.fields.groupBy));
|
|
1212
1512
|
_this.virtualGroupDataSource = data.records;
|
|
1213
1513
|
}
|
|
1214
|
-
var dataManager = _this.isVirtualizationEnabled && _this.virtualGroupDataSource ? new DataManager(_this.virtualGroupDataSource) : new DataManager(eventArgs.data);
|
|
1514
|
+
var dataManager = _this.isVirtualizationEnabled && _this.virtualGroupDataSource && !_this.isCustomDataUpdated ? new DataManager(_this.virtualGroupDataSource) : new DataManager(eventArgs.data);
|
|
1215
1515
|
listItems = (_this.getQuery(eventArgs.query)).executeLocal(dataManager);
|
|
1216
|
-
if (_this.
|
|
1516
|
+
if (!_this.virtualSelectAll) {
|
|
1217
1517
|
var newQuery = _this.getQuery(eventArgs.query);
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1518
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1519
|
+
if (_this.isVirtualizationEnabled && (listItems.count != 0 && listItems.count < (_this.itemCount * 2))) {
|
|
1520
|
+
if (newQuery) {
|
|
1521
|
+
for (var queryElements = 0; queryElements < newQuery.queries.length; queryElements++) {
|
|
1522
|
+
if (newQuery.queries[queryElements].fn === 'onTake') {
|
|
1523
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1524
|
+
newQuery.queries[queryElements].e.nos = listItems.count;
|
|
1525
|
+
listItems = (newQuery).executeLocal(dataManager);
|
|
1526
|
+
}
|
|
1527
|
+
if (_this.getModuleName() === 'multiselect' && (newQuery.queries[queryElements].e.condition == 'or' || newQuery.queries[queryElements].e.operator == 'equal')) {
|
|
1528
|
+
isReOrder = false;
|
|
1529
|
+
}
|
|
1530
|
+
}
|
|
1531
|
+
if (isReOrder) {
|
|
1222
1532
|
listItems = (newQuery).executeLocal(dataManager);
|
|
1223
|
-
|
|
1533
|
+
_this.isVirtualTrackHeight = true;
|
|
1534
|
+
}
|
|
1535
|
+
}
|
|
1536
|
+
}
|
|
1537
|
+
else {
|
|
1538
|
+
_this.isVirtualTrackHeight = false;
|
|
1539
|
+
if (newQuery) {
|
|
1540
|
+
for (var queryElements = 0; queryElements < newQuery.queries.length; queryElements++) {
|
|
1541
|
+
if (_this.getModuleName() === 'multiselect' && ((newQuery.queries[queryElements].e && newQuery.queries[queryElements].e.condition == 'or') || (newQuery.queries[queryElements].e && newQuery.queries[queryElements].e.operator == 'equal'))) {
|
|
1542
|
+
isReOrder = false;
|
|
1543
|
+
}
|
|
1224
1544
|
}
|
|
1225
1545
|
}
|
|
1226
1546
|
}
|
|
1227
1547
|
}
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1548
|
+
if (isReOrder) {
|
|
1549
|
+
// eslint-disable @typescript-eslint/no-explicit-any
|
|
1550
|
+
_this.dataCount = _this.totalItemCount = _this.virtualSelectAll ? listItems.length : listItems.count;
|
|
1551
|
+
}
|
|
1552
|
+
listItems = _this.isVirtualizationEnabled && !_this.virtualSelectAll ? listItems.result : listItems;
|
|
1553
|
+
// eslint-enable @typescript-eslint/no-explicit-any
|
|
1234
1554
|
var localDataArgs = { cancel: false, result: listItems };
|
|
1235
1555
|
_this.isPreventChange = _this.isAngular && _this.preventChange ? true : _this.isPreventChange;
|
|
1236
1556
|
_this.trigger('actionComplete', localDataArgs, function (localDataArgs) {
|
|
@@ -1278,6 +1598,13 @@ var DropDownBase = /** @__PURE__ @class */ (function (_super) {
|
|
|
1278
1598
|
this.raiseDataBound(listItems, e);
|
|
1279
1599
|
}
|
|
1280
1600
|
};
|
|
1601
|
+
DropDownBase.prototype.isObjectInArray = function (objectToFind, array) {
|
|
1602
|
+
return array.some(function (item) {
|
|
1603
|
+
return Object.keys(objectToFind).every(function (key) {
|
|
1604
|
+
return item.hasOwnProperty(key) && item[key] === objectToFind[key];
|
|
1605
|
+
});
|
|
1606
|
+
});
|
|
1607
|
+
};
|
|
1281
1608
|
DropDownBase.prototype.updateListValues = function () {
|
|
1282
1609
|
// Used this method in component side.
|
|
1283
1610
|
};
|
|
@@ -1318,6 +1645,7 @@ var DropDownBase = /** @__PURE__ @class */ (function (_super) {
|
|
|
1318
1645
|
var listItems = [];
|
|
1319
1646
|
this.onActionComplete(this.renderItems(listItems, fields), listItems);
|
|
1320
1647
|
this.isRequested = false;
|
|
1648
|
+
this.isRequesting = false;
|
|
1321
1649
|
this.hideSpinner();
|
|
1322
1650
|
};
|
|
1323
1651
|
DropDownBase.prototype.showSpinner = function () {
|
|
@@ -1338,7 +1666,7 @@ var DropDownBase = /** @__PURE__ @class */ (function (_super) {
|
|
|
1338
1666
|
DropDownBase.prototype.onActionComplete = function (ulElement, list, e) {
|
|
1339
1667
|
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
1340
1668
|
this.listData = list;
|
|
1341
|
-
if (this.isVirtualizationEnabled) {
|
|
1669
|
+
if (this.isVirtualizationEnabled && !this.isCustomDataUpdated) {
|
|
1342
1670
|
this.notify("setGeneratedData", {
|
|
1343
1671
|
module: "VirtualScroll",
|
|
1344
1672
|
});
|
|
@@ -1397,10 +1725,11 @@ var DropDownBase = /** @__PURE__ @class */ (function (_super) {
|
|
|
1397
1725
|
DropDownBase.prototype.getQuery = function (query) {
|
|
1398
1726
|
return query ? query : this.query ? this.query : new Query();
|
|
1399
1727
|
};
|
|
1400
|
-
DropDownBase.prototype.updateVirtualizationProperties = function (itemCount, filtering) {
|
|
1728
|
+
DropDownBase.prototype.updateVirtualizationProperties = function (itemCount, filtering, isCheckbox) {
|
|
1401
1729
|
this.isVirtualizationEnabled = true;
|
|
1402
1730
|
this.virtualizedItemsCount = itemCount;
|
|
1403
1731
|
this.isAllowFiltering = filtering;
|
|
1732
|
+
this.isCheckBoxSelection = isCheckbox;
|
|
1404
1733
|
};
|
|
1405
1734
|
/**
|
|
1406
1735
|
* To render the template content for group header element.
|
|
@@ -1512,7 +1841,7 @@ var DropDownBase = /** @__PURE__ @class */ (function (_super) {
|
|
|
1512
1841
|
if (isCount) {
|
|
1513
1842
|
count++;
|
|
1514
1843
|
}
|
|
1515
|
-
if (this.updateGroupHeader(index, liCollections, target)) {
|
|
1844
|
+
if (this.fixedHeaderElement && this.updateGroupHeader(index, liCollections, target)) {
|
|
1516
1845
|
loadedGroupList++;
|
|
1517
1846
|
if (count >= this.getPageCount()) {
|
|
1518
1847
|
break;
|
|
@@ -1568,7 +1897,7 @@ var DropDownBase = /** @__PURE__ @class */ (function (_super) {
|
|
|
1568
1897
|
* @param {FieldSettingsModel} fields - Maps the columns of the data table and binds the data to the component.
|
|
1569
1898
|
* @returns {HTMLElement} Return the list items.
|
|
1570
1899
|
*/
|
|
1571
|
-
DropDownBase.prototype.renderItems = function (listData, fields) {
|
|
1900
|
+
DropDownBase.prototype.renderItems = function (listData, fields, isCheckBoxUpdate) {
|
|
1572
1901
|
var ulElement;
|
|
1573
1902
|
if (this.itemTemplate && listData) {
|
|
1574
1903
|
var dataSource = listData;
|
|
@@ -1591,6 +1920,10 @@ var DropDownBase = /** @__PURE__ @class */ (function (_super) {
|
|
|
1591
1920
|
var virtualUlElement = this.list.querySelector('.e-virtual-ddl-content');
|
|
1592
1921
|
if ((listData.length >= this.virtualizedItemsCount && oldUlElement && virtualUlElement) || (oldUlElement && virtualUlElement && this.isAllowFiltering) || (oldUlElement && virtualUlElement && this.getModuleName() === 'autocomplete')) {
|
|
1593
1922
|
virtualUlElement.replaceChild(ulElement, oldUlElement);
|
|
1923
|
+
var reOrderList = this.list.querySelectorAll('.e-reorder');
|
|
1924
|
+
if (this.list.querySelector('.e-virtual-ddl-content') && reOrderList && reOrderList.length > 0 && !isCheckBoxUpdate) {
|
|
1925
|
+
this.list.querySelector('.e-virtual-ddl-content').removeChild(reOrderList[0]);
|
|
1926
|
+
}
|
|
1594
1927
|
this.updateListElements(listData);
|
|
1595
1928
|
}
|
|
1596
1929
|
else if ((!virtualUlElement)) {
|
|
@@ -1602,6 +1935,10 @@ var DropDownBase = /** @__PURE__ @class */ (function (_super) {
|
|
|
1602
1935
|
}
|
|
1603
1936
|
}
|
|
1604
1937
|
else {
|
|
1938
|
+
if (this.getModuleName() === 'multiselect' && this.virtualSelectAll) {
|
|
1939
|
+
this.virtualSelectAllData = listData;
|
|
1940
|
+
listData = listData.slice(this.virtualItemStartIndex, this.virtualItemEndIndex);
|
|
1941
|
+
}
|
|
1605
1942
|
ulElement = this.createListItems(listData, fields);
|
|
1606
1943
|
if (this.isIncrementalRequest) {
|
|
1607
1944
|
this.incrementalLiCollections = ulElement.querySelectorAll('.' + dropDownBaseClasses.li);
|
|
@@ -1610,10 +1947,19 @@ var DropDownBase = /** @__PURE__ @class */ (function (_super) {
|
|
|
1610
1947
|
return ulElement;
|
|
1611
1948
|
}
|
|
1612
1949
|
if (this.isVirtualizationEnabled) {
|
|
1613
|
-
var oldUlElement = this.list.querySelector('.e-list-parent');
|
|
1950
|
+
var oldUlElement = this.list.querySelector('.e-list-parent' + ':not(.e-reorder)');
|
|
1614
1951
|
var virtualUlElement = this.list.querySelector('.e-virtual-ddl-content');
|
|
1615
|
-
|
|
1616
|
-
|
|
1952
|
+
var isRemovedUlelement = false;
|
|
1953
|
+
if (!oldUlElement && this.list.querySelector('.e-list-parent' + '.e-reorder')) {
|
|
1954
|
+
oldUlElement = this.list.querySelector('.e-list-parent' + '.e-reorder');
|
|
1955
|
+
}
|
|
1956
|
+
if ((listData.length >= this.virtualizedItemsCount && oldUlElement && virtualUlElement) || (oldUlElement && virtualUlElement && this.isAllowFiltering) || (oldUlElement && virtualUlElement && (this.getModuleName() === 'autocomplete' || this.getModuleName() === 'multiselect')) || isRemovedUlelement) {
|
|
1957
|
+
if (!this.appendUncheckList) {
|
|
1958
|
+
virtualUlElement.replaceChild(ulElement, oldUlElement);
|
|
1959
|
+
}
|
|
1960
|
+
else {
|
|
1961
|
+
virtualUlElement.appendChild(ulElement);
|
|
1962
|
+
}
|
|
1617
1963
|
this.updateListElements(listData);
|
|
1618
1964
|
}
|
|
1619
1965
|
else if ((!virtualUlElement)) {
|
|
@@ -1806,11 +2152,11 @@ var DropDownBase = /** @__PURE__ @class */ (function (_super) {
|
|
|
1806
2152
|
this.render();
|
|
1807
2153
|
};
|
|
1808
2154
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
1809
|
-
DropDownBase.prototype.updateDataSource = function (props) {
|
|
2155
|
+
DropDownBase.prototype.updateDataSource = function (props, oldProps) {
|
|
1810
2156
|
this.resetList(this.dataSource);
|
|
1811
2157
|
this.totalItemCount = this.dataSource instanceof DataManager ? this.dataSource.dataSource.json.length : 0;
|
|
1812
2158
|
};
|
|
1813
|
-
DropDownBase.prototype.setUpdateInitial = function (props, newProp) {
|
|
2159
|
+
DropDownBase.prototype.setUpdateInitial = function (props, newProp, oldProp) {
|
|
1814
2160
|
this.isDataFetched = false;
|
|
1815
2161
|
var updateData = {};
|
|
1816
2162
|
for (var j = 0; props.length > j; j++) {
|
|
@@ -1826,7 +2172,7 @@ var DropDownBase = /** @__PURE__ @class */ (function (_super) {
|
|
|
1826
2172
|
if (Object.keys(updateData).indexOf('dataSource') === -1) {
|
|
1827
2173
|
updateData.dataSource = this.dataSource;
|
|
1828
2174
|
}
|
|
1829
|
-
this.updateDataSource(updateData);
|
|
2175
|
+
this.updateDataSource(updateData, oldProp);
|
|
1830
2176
|
}
|
|
1831
2177
|
};
|
|
1832
2178
|
/**
|
|
@@ -2294,55 +2640,12 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
2294
2640
|
*/
|
|
2295
2641
|
function DropDownList(options, element) {
|
|
2296
2642
|
var _this = _super.call(this, options, element) || this;
|
|
2297
|
-
_this.skeletonCount = 32;
|
|
2298
2643
|
_this.isListSearched = false;
|
|
2299
2644
|
_this.preventChange = false;
|
|
2300
2645
|
_this.isAngular = false;
|
|
2301
|
-
_this.virtualListHeight = 0;
|
|
2302
|
-
_this.isVirtualScrolling = false;
|
|
2303
|
-
_this.isPreventScrollAction = false;
|
|
2304
|
-
_this.scrollPreStartIndex = 0;
|
|
2305
|
-
_this.isScrollActionTriggered = false;
|
|
2306
|
-
_this.previousStartIndex = 0;
|
|
2307
|
-
_this.isMouseScrollAction = false;
|
|
2308
|
-
_this.isKeyBoardAction = false;
|
|
2309
|
-
_this.isUpwardScrolling = false;
|
|
2310
|
-
_this.startIndex = 0;
|
|
2311
|
-
_this.currentPageNumber = 0;
|
|
2312
|
-
_this.pageCount = 0;
|
|
2313
|
-
_this.isPreventKeyAction = false;
|
|
2314
|
-
_this.generatedDataObject = {};
|
|
2315
|
-
_this.incrementalQueryString = '';
|
|
2316
|
-
_this.incrementalEndIndex = 0;
|
|
2317
|
-
_this.incrementalStartIndex = 0;
|
|
2318
|
-
_this.incrementalPreQueryString = '';
|
|
2319
2646
|
_this.isTouched = false;
|
|
2320
|
-
_this.
|
|
2321
|
-
|
|
2322
|
-
direction: null,
|
|
2323
|
-
sentinelInfo: {},
|
|
2324
|
-
offsets: {},
|
|
2325
|
-
startIndex: 0,
|
|
2326
|
-
endIndex: 0,
|
|
2327
|
-
};
|
|
2328
|
-
_this.viewPortInfo = {
|
|
2329
|
-
currentPageNumber: null,
|
|
2330
|
-
direction: null,
|
|
2331
|
-
sentinelInfo: {},
|
|
2332
|
-
offsets: {},
|
|
2333
|
-
startIndex: 0,
|
|
2334
|
-
endIndex: 0,
|
|
2335
|
-
};
|
|
2336
|
-
_this.selectedValueInfo = {
|
|
2337
|
-
currentPageNumber: null,
|
|
2338
|
-
direction: null,
|
|
2339
|
-
sentinelInfo: {},
|
|
2340
|
-
offsets: {},
|
|
2341
|
-
startIndex: 0,
|
|
2342
|
-
endIndex: 0,
|
|
2343
|
-
};
|
|
2344
|
-
_this.IsScrollerAtEnd = function () {
|
|
2345
|
-
return this.list && this.list.scrollTop + this.list.clientHeight >= this.list.scrollHeight;
|
|
2647
|
+
_this.IsScrollerAtEnd = function () {
|
|
2648
|
+
return this.list && this.list.scrollTop + this.list.clientHeight >= this.list.scrollHeight;
|
|
2346
2649
|
};
|
|
2347
2650
|
return _this;
|
|
2348
2651
|
}
|
|
@@ -2429,6 +2732,11 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
2429
2732
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2430
2733
|
this.totalItemCount = this.dataSource && this.dataSource.length ? this.dataSource.length : 0;
|
|
2431
2734
|
}
|
|
2735
|
+
if (this.enableVirtualization && this.isFiltering() && this.getModuleName() === 'combobox') {
|
|
2736
|
+
this.UpdateSkeleton();
|
|
2737
|
+
this.liCollections = this.list.querySelectorAll('.' + dropDownBaseClasses.li);
|
|
2738
|
+
this.ulElement = this.list.querySelector('ul');
|
|
2739
|
+
}
|
|
2432
2740
|
this.unWireListEvents();
|
|
2433
2741
|
this.wireListEvents();
|
|
2434
2742
|
};
|
|
@@ -2477,7 +2785,7 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
2477
2785
|
this.resetSelection(properties);
|
|
2478
2786
|
}
|
|
2479
2787
|
var dataItem = this.getItemData();
|
|
2480
|
-
if (this.previousValue === dataItem.value) {
|
|
2788
|
+
if ((!this.allowObjectBinding && (this.previousValue === dataItem.value)) || (this.allowObjectBinding && this.previousValue && this.isObjectInArray(this.previousValue, [this.allowCustom ? this.value ? this.value : dataItem : dataItem.value ? this.getDataByValue(dataItem.value) : dataItem]))) {
|
|
2481
2789
|
return;
|
|
2482
2790
|
}
|
|
2483
2791
|
this.onChangeEvent(e);
|
|
@@ -2667,7 +2975,8 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
2667
2975
|
DropDownList.prototype.updateValues = function () {
|
|
2668
2976
|
this.selectedValueInfo = this.viewPortInfo;
|
|
2669
2977
|
if (!isNullOrUndefined(this.value)) {
|
|
2670
|
-
this.
|
|
2978
|
+
var value = this.allowObjectBinding && !isNullOrUndefined(this.value) ? getValue(((this.fields.value) ? this.fields.value : ''), this.value) : this.value;
|
|
2979
|
+
this.setSelection(this.getElementByValue(value), null);
|
|
2671
2980
|
}
|
|
2672
2981
|
else if (this.text && isNullOrUndefined(this.value)) {
|
|
2673
2982
|
var element = this.getElementByText(this.text);
|
|
@@ -2892,23 +3201,6 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
2892
3201
|
DropDownList.prototype.isValidLI = function (li) {
|
|
2893
3202
|
return (li && li.hasAttribute('role') && li.getAttribute('role') === 'option');
|
|
2894
3203
|
};
|
|
2895
|
-
DropDownList.prototype.updateIncrementalInfo = function (startIndex, endIndex) {
|
|
2896
|
-
this.viewPortInfo.startIndex = startIndex;
|
|
2897
|
-
this.viewPortInfo.endIndex = endIndex;
|
|
2898
|
-
this.updateVirtualItemIndex();
|
|
2899
|
-
this.isIncrementalRequest = true;
|
|
2900
|
-
this.resetList(this.dataSource, this.fields, this.query);
|
|
2901
|
-
this.isIncrementalRequest = false;
|
|
2902
|
-
};
|
|
2903
|
-
DropDownList.prototype.updateIncrementalView = function (startIndex, endIndex) {
|
|
2904
|
-
this.viewPortInfo.startIndex = startIndex;
|
|
2905
|
-
this.viewPortInfo.endIndex = endIndex;
|
|
2906
|
-
this.updateVirtualItemIndex();
|
|
2907
|
-
this.resetList(this.dataSource, this.fields, this.query);
|
|
2908
|
-
this.UpdateSkeleton();
|
|
2909
|
-
this.liCollections = this.list.querySelectorAll('.' + dropDownBaseClasses.li);
|
|
2910
|
-
this.ulElement = this.list.querySelector('ul');
|
|
2911
|
-
};
|
|
2912
3204
|
DropDownList.prototype.updateIncrementalItemIndex = function (startIndex, endIndex) {
|
|
2913
3205
|
this.incrementalStartIndex = startIndex;
|
|
2914
3206
|
this.incrementalEndIndex = endIndex;
|
|
@@ -3076,10 +3368,12 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
3076
3368
|
var isTabAction = e.action === 'tab' || e.action === 'close';
|
|
3077
3369
|
if (isNullOrUndefined(this.list) && !this.isRequested && !isTabAction && e.action !== 'escape') {
|
|
3078
3370
|
this.searchKeyEvent = e;
|
|
3079
|
-
this.
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
|
|
3371
|
+
if (!this.enableVirtualization || (this.enableVirtualization && this.getModuleName() !== 'autocomplete' && e.type !== 'mousedown' && (e.keyCode === 40 || e.keyCode === 38))) {
|
|
3372
|
+
this.renderList(e);
|
|
3373
|
+
this.UpdateSkeleton();
|
|
3374
|
+
this.liCollections = this.list.querySelectorAll('.' + dropDownBaseClasses.li);
|
|
3375
|
+
this.ulElement = this.list.querySelector('ul');
|
|
3376
|
+
}
|
|
3083
3377
|
}
|
|
3084
3378
|
if (isNullOrUndefined(this.list) || (!isNullOrUndefined(this.liCollections) &&
|
|
3085
3379
|
isNavigation && this.liCollections.length === 0) || this.isRequested) {
|
|
@@ -3238,7 +3532,7 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
3238
3532
|
this.activeIndex = filterIndex;
|
|
3239
3533
|
}
|
|
3240
3534
|
}
|
|
3241
|
-
if (this.allowFiltering && this.getModuleName() === 'dropdownlist') {
|
|
3535
|
+
if (this.allowFiltering && this.getModuleName() === 'dropdownlist' && this.filterInput) {
|
|
3242
3536
|
if (!isNullOrUndefined(this.ulElement) && !isNullOrUndefined(this.ulElement.getElementsByClassName('e-item-focus')[0])) {
|
|
3243
3537
|
attributes(this.filterInput, { 'aria-activedescendant': this.ulElement.getElementsByClassName('e-item-focus')[0].id });
|
|
3244
3538
|
}
|
|
@@ -3248,11 +3542,6 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
3248
3542
|
}
|
|
3249
3543
|
e.preventDefault();
|
|
3250
3544
|
};
|
|
3251
|
-
DropDownList.prototype.updateVirtualItemIndex = function () {
|
|
3252
|
-
this.virtualItemStartIndex = this.viewPortInfo.startIndex;
|
|
3253
|
-
this.virtualItemEndIndex = this.viewPortInfo.endIndex;
|
|
3254
|
-
this.virtualListInfo = this.viewPortInfo;
|
|
3255
|
-
};
|
|
3256
3545
|
DropDownList.prototype.updateHomeEndAction = function (e, isVirtualKeyAction) {
|
|
3257
3546
|
if (this.getModuleName() === 'dropdownlist') {
|
|
3258
3547
|
var findLi = 0;
|
|
@@ -3401,6 +3690,10 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
3401
3690
|
DropDownList.prototype.pageDownSelection = function (steps, event, isVirtualKeyAction) {
|
|
3402
3691
|
var list = this.getItems();
|
|
3403
3692
|
var previousItem = steps <= list.length ? this.liCollections[steps - 1] : this.liCollections[list.length - 1];
|
|
3693
|
+
if (this.enableVirtualization && this.skeletonCount > 0) {
|
|
3694
|
+
steps = this.getModuleName() === 'dropdownlist' && this.allowFiltering ? steps + 1 : steps;
|
|
3695
|
+
previousItem = steps < list.length ? this.liCollections[steps] : this.liCollections[list.length - 1];
|
|
3696
|
+
}
|
|
3404
3697
|
if ((this.enableVirtualization && this.activeIndex == null) || isVirtualKeyAction) {
|
|
3405
3698
|
previousItem = steps <= list.length ? this.liCollections[steps + this.skeletonCount - 1] : this.liCollections[list.length - 1];
|
|
3406
3699
|
}
|
|
@@ -3565,7 +3858,7 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
3565
3858
|
DropDownList.prototype.selectEventCallback = function (li, e, preventSelect, selectedData, value) {
|
|
3566
3859
|
this.previousItemData = (!isNullOrUndefined(this.itemData)) ? this.itemData : null;
|
|
3567
3860
|
if (this.itemData != selectedData) {
|
|
3568
|
-
this.previousValue = (!isNullOrUndefined(this.itemData)) ? typeof this.itemData == "object" ? this.checkFieldValue(this.itemData, this.fields.value.split('.')) : this.itemData : null;
|
|
3861
|
+
this.previousValue = (!isNullOrUndefined(this.itemData)) ? typeof this.itemData == "object" && !this.allowObjectBinding ? this.checkFieldValue(this.itemData, this.fields.value.split('.')) : this.itemData : null;
|
|
3569
3862
|
}
|
|
3570
3863
|
this.item = li;
|
|
3571
3864
|
this.itemData = selectedData;
|
|
@@ -3623,7 +3916,7 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
3623
3916
|
if (this.isFiltering() && clearElement) {
|
|
3624
3917
|
clearElement.style.removeProperty('visibility');
|
|
3625
3918
|
}
|
|
3626
|
-
if (this.previousValue === dataItem.value) {
|
|
3919
|
+
if ((!this.allowObjectBinding && (this.previousValue === dataItem.value)) || (this.allowObjectBinding && (this.previousValue != null && this.isObjectInArray(this.previousValue, [this.allowCustom && this.isObjectCustomValue ? this.value ? this.value : dataItem : dataItem.value ? this.getDataByValue(dataItem.value) : dataItem])))) {
|
|
3627
3920
|
this.isSelected = false;
|
|
3628
3921
|
return true;
|
|
3629
3922
|
}
|
|
@@ -3643,25 +3936,28 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
3643
3936
|
}
|
|
3644
3937
|
else {
|
|
3645
3938
|
this.setSelectOptions(li, e);
|
|
3646
|
-
if (this.enableVirtualization) {
|
|
3939
|
+
if (this.enableVirtualization && this.value) {
|
|
3647
3940
|
var fields = (this.fields.value) ? this.fields.value : '';
|
|
3941
|
+
var currentValue = this.allowObjectBinding && !isNullOrUndefined(this.value) ? getValue((this.fields.value) ? this.fields.value : '', this.value) : this.value;
|
|
3648
3942
|
if (this.dataSource instanceof DataManager && this.virtualGroupDataSource) {
|
|
3649
|
-
var getItem = new DataManager(this.virtualGroupDataSource).executeLocal(new Query().where(new Predicate(fields, 'equal',
|
|
3943
|
+
var getItem = new DataManager(this.virtualGroupDataSource).executeLocal(new Query().where(new Predicate(fields, 'equal', currentValue)));
|
|
3650
3944
|
if (getItem && getItem.length > 0) {
|
|
3651
3945
|
this.itemData = getItem[0];
|
|
3652
3946
|
var dataItem = this.getItemData();
|
|
3947
|
+
var value = this.allowObjectBinding ? this.getDataByValue(dataItem.value) : dataItem.value;
|
|
3653
3948
|
if ((this.value === dataItem.value && this.text !== dataItem.text) || (this.value !== dataItem.value && this.text === dataItem.text)) {
|
|
3654
|
-
this.setProperties({ 'text': dataItem.text, 'value':
|
|
3949
|
+
this.setProperties({ 'text': dataItem.text, 'value': value });
|
|
3655
3950
|
}
|
|
3656
3951
|
}
|
|
3657
3952
|
}
|
|
3658
3953
|
else {
|
|
3659
|
-
var getItem = new DataManager(this.dataSource).executeLocal(new Query().where(new Predicate(fields, 'equal',
|
|
3954
|
+
var getItem = new DataManager(this.dataSource).executeLocal(new Query().where(new Predicate(fields, 'equal', currentValue)));
|
|
3660
3955
|
if (getItem && getItem.length > 0) {
|
|
3661
3956
|
this.itemData = getItem[0];
|
|
3662
3957
|
var dataItem = this.getItemData();
|
|
3958
|
+
var value = this.allowObjectBinding ? this.getDataByValue(dataItem.value) : dataItem.value;
|
|
3663
3959
|
if ((this.value === dataItem.value && this.text !== dataItem.text) || (this.value !== dataItem.value && this.text === dataItem.text)) {
|
|
3664
|
-
this.setProperties({ 'text': dataItem.text, 'value':
|
|
3960
|
+
this.setProperties({ 'text': dataItem.text, 'value': value });
|
|
3665
3961
|
}
|
|
3666
3962
|
}
|
|
3667
3963
|
}
|
|
@@ -3775,10 +4071,23 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
3775
4071
|
* @param {MouseEvent | KeyboardEvent | TouchEvent} eve - Specifies the event arguments.
|
|
3776
4072
|
* @returns {void}
|
|
3777
4073
|
*/
|
|
3778
|
-
DropDownList.prototype.onChangeEvent = function (eve) {
|
|
4074
|
+
DropDownList.prototype.onChangeEvent = function (eve, isCustomValue) {
|
|
4075
|
+
var _this = this;
|
|
3779
4076
|
var dataItem = this.getItemData();
|
|
3780
4077
|
var index = this.isSelectCustom ? null : this.activeIndex;
|
|
3781
|
-
this.
|
|
4078
|
+
if (this.enableVirtualization) {
|
|
4079
|
+
var datas = this.dataSource instanceof DataManager ? this.virtualGroupDataSource : this.dataSource;
|
|
4080
|
+
if (dataItem.value && datas && datas.length > 0) {
|
|
4081
|
+
var foundIndex = datas.findIndex(function (data) {
|
|
4082
|
+
return !isNullOrUndefined(dataItem.value) && getValue(_this.fields.value, data) === dataItem.value;
|
|
4083
|
+
});
|
|
4084
|
+
if (foundIndex !== -1) {
|
|
4085
|
+
index = foundIndex;
|
|
4086
|
+
}
|
|
4087
|
+
}
|
|
4088
|
+
}
|
|
4089
|
+
var value = this.allowObjectBinding ? isCustomValue ? this.value : this.getDataByValue(dataItem.value) : dataItem.value;
|
|
4090
|
+
this.setProperties({ 'index': index, 'text': dataItem.text, 'value': value }, true);
|
|
3782
4091
|
this.detachChangeEvent(eve);
|
|
3783
4092
|
};
|
|
3784
4093
|
DropDownList.prototype.detachChanges = function (value) {
|
|
@@ -3805,7 +4114,7 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
3805
4114
|
DropDownList.prototype.detachChangeEvent = function (eve) {
|
|
3806
4115
|
this.isSelected = false;
|
|
3807
4116
|
this.previousValue = this.value;
|
|
3808
|
-
this.activeIndex = this.index;
|
|
4117
|
+
this.activeIndex = this.enableVirtualization ? this.getIndexByValue(this.value) : this.index;
|
|
3809
4118
|
this.typedString = !isNullOrUndefined(this.text) ? this.text : '';
|
|
3810
4119
|
if (!this.initial) {
|
|
3811
4120
|
var items = this.detachChanges(this.itemData);
|
|
@@ -3852,16 +4161,17 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
3852
4161
|
};
|
|
3853
4162
|
DropDownList.prototype.setHiddenValue = function () {
|
|
3854
4163
|
if (!isNullOrUndefined(this.value)) {
|
|
4164
|
+
var value = this.allowObjectBinding && !isNullOrUndefined(this.value) ? getValue((this.fields.value) ? this.fields.value : '', this.value) : this.value;
|
|
3855
4165
|
if (this.hiddenElement.querySelector('option')) {
|
|
3856
4166
|
var selectedElement = this.hiddenElement.querySelector('option');
|
|
3857
4167
|
selectedElement.textContent = this.text;
|
|
3858
|
-
selectedElement.setAttribute('value',
|
|
4168
|
+
selectedElement.setAttribute('value', value.toString());
|
|
3859
4169
|
}
|
|
3860
4170
|
else {
|
|
3861
4171
|
if (!isNullOrUndefined(this.hiddenElement)) {
|
|
3862
4172
|
this.hiddenElement.innerHTML = '<option selected>' + this.text + '</option>';
|
|
3863
4173
|
var selectedElement = this.hiddenElement.querySelector('option');
|
|
3864
|
-
selectedElement.setAttribute('value',
|
|
4174
|
+
selectedElement.setAttribute('value', value.toString());
|
|
3865
4175
|
}
|
|
3866
4176
|
}
|
|
3867
4177
|
}
|
|
@@ -3878,6 +4188,7 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
3878
4188
|
DropDownList.prototype.onFilterUp = function (e) {
|
|
3879
4189
|
if (!(e.ctrlKey && e.keyCode === 86) && (this.isValidKey || e.keyCode === 40 || e.keyCode === 38)) {
|
|
3880
4190
|
this.isValidKey = false;
|
|
4191
|
+
this.firstItem = this.dataSource && this.dataSource.length > 0 ? this.dataSource[0] : null;
|
|
3881
4192
|
switch (e.keyCode) {
|
|
3882
4193
|
case 38: //up arrow
|
|
3883
4194
|
case 40: //down arrow
|
|
@@ -3934,42 +4245,6 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
3934
4245
|
this.isValidKey = false;
|
|
3935
4246
|
}
|
|
3936
4247
|
};
|
|
3937
|
-
DropDownList.prototype.getFilteringSkeletonCount = function () {
|
|
3938
|
-
var difference = this.dataCount - this.viewPortInfo.endIndex;
|
|
3939
|
-
var currentSkeletonCount = this.skeletonCount;
|
|
3940
|
-
this.getSkeletonCount(true);
|
|
3941
|
-
this.skeletonCount = this.dataCount > this.itemCount * 2 ? this.skeletonCount : difference > this.skeletonCount ? this.skeletonCount : difference > 0 ? difference : 0;
|
|
3942
|
-
var skeletonUpdated = true;
|
|
3943
|
-
if (this.getModuleName() === 'autocomplete' && (this.totalItemCount != 0 && this.totalItemCount < (this.itemCount * 2))) {
|
|
3944
|
-
this.skeletonCount = 0;
|
|
3945
|
-
skeletonUpdated = false;
|
|
3946
|
-
}
|
|
3947
|
-
if (!this.list.classList.contains(dropDownBaseClasses.noData)) {
|
|
3948
|
-
var isSkeletonCountChange = currentSkeletonCount !== this.skeletonCount;
|
|
3949
|
-
if (currentSkeletonCount !== this.skeletonCount && skeletonUpdated) {
|
|
3950
|
-
this.UpdateSkeleton(true, Math.abs(currentSkeletonCount - this.skeletonCount));
|
|
3951
|
-
}
|
|
3952
|
-
else {
|
|
3953
|
-
this.UpdateSkeleton();
|
|
3954
|
-
}
|
|
3955
|
-
this.liCollections = this.list.querySelectorAll('.e-list-item');
|
|
3956
|
-
if ((this.list.getElementsByClassName('e-virtual-ddl').length > 0)) {
|
|
3957
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3958
|
-
this.list.getElementsByClassName('e-virtual-ddl')[0].style = this.GetVirtualTrackHeight();
|
|
3959
|
-
}
|
|
3960
|
-
if (this.list.getElementsByClassName('e-virtual-ddl-content').length > 0) {
|
|
3961
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3962
|
-
this.list.getElementsByClassName('e-virtual-ddl-content')[0].style = this.getTransformValues();
|
|
3963
|
-
}
|
|
3964
|
-
}
|
|
3965
|
-
};
|
|
3966
|
-
DropDownList.prototype.getSkeletonCount = function (retainSkeleton) {
|
|
3967
|
-
this.virtualListHeight = this.listHeight != null ? parseInt(this.listHeight, 10) : this.virtualListHeight;
|
|
3968
|
-
var actualCount = this.virtualListHeight > 0 ? Math.floor(this.virtualListHeight / this.listItemHeight) : 0;
|
|
3969
|
-
this.skeletonCount = actualCount * 2 < this.itemCount ? this.itemCount : actualCount * 2;
|
|
3970
|
-
this.itemCount = retainSkeleton ? this.itemCount : this.skeletonCount;
|
|
3971
|
-
this.skeletonCount = Math.floor(this.skeletonCount / 2) + 2;
|
|
3972
|
-
};
|
|
3973
4248
|
DropDownList.prototype.onFilterDown = function (e) {
|
|
3974
4249
|
switch (e.keyCode) {
|
|
3975
4250
|
case 13: //enter
|
|
@@ -4024,14 +4299,51 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
4024
4299
|
}
|
|
4025
4300
|
}
|
|
4026
4301
|
}
|
|
4027
|
-
|
|
4028
|
-
|
|
4302
|
+
var queryTakeValue = 0;
|
|
4303
|
+
var querySkipValue = 0;
|
|
4304
|
+
if (this.query && this.query.queries.length > 0) {
|
|
4305
|
+
for (var queryElements_1 = 0; queryElements_1 < this.query.queries.length; queryElements_1++) {
|
|
4306
|
+
if (this.query.queries[queryElements_1].fn === 'onSkip') {
|
|
4307
|
+
querySkipValue = this.query.queries[queryElements_1].e.nos;
|
|
4308
|
+
}
|
|
4309
|
+
if (this.query.queries[queryElements_1].fn === 'onTake') {
|
|
4310
|
+
queryTakeValue = takeValue <= this.query.queries[queryElements_1].e.nos ? this.query.queries[queryElements_1].e.nos : takeValue;
|
|
4311
|
+
}
|
|
4312
|
+
}
|
|
4313
|
+
}
|
|
4314
|
+
var skipExists = false;
|
|
4315
|
+
var takeExists = false;
|
|
4316
|
+
if (filterQuery && filterQuery.queries.length > 0) {
|
|
4317
|
+
for (var queryElements_2 = 0; queryElements_2 < filterQuery.queries.length; queryElements_2++) {
|
|
4318
|
+
if (filterQuery.queries[queryElements_2].fn === 'onSkip') {
|
|
4319
|
+
skipExists = true;
|
|
4320
|
+
}
|
|
4321
|
+
if (filterQuery.queries[queryElements_2].fn === 'onTake') {
|
|
4322
|
+
takeExists = true;
|
|
4323
|
+
filterQuery.queries[queryElements_2].e.nos = filterQuery.queries[queryElements_2].e.nos <= queryTakeValue ? queryTakeValue : filterQuery.queries[queryElements_2].e.nos;
|
|
4324
|
+
}
|
|
4325
|
+
}
|
|
4326
|
+
}
|
|
4327
|
+
if (!skipExists && (this.allowFiltering || !this.isPopupOpen || !alreadySkipAdded)) {
|
|
4328
|
+
if (querySkipValue > 0) {
|
|
4329
|
+
filterQuery.skip(querySkipValue);
|
|
4330
|
+
}
|
|
4331
|
+
else {
|
|
4332
|
+
filterQuery.skip(this.virtualItemStartIndex);
|
|
4333
|
+
}
|
|
4029
4334
|
}
|
|
4030
4335
|
if (this.isIncrementalRequest) {
|
|
4031
4336
|
filterQuery.take(this.incrementalEndIndex);
|
|
4032
4337
|
}
|
|
4033
4338
|
else {
|
|
4034
|
-
|
|
4339
|
+
if (!takeExists) {
|
|
4340
|
+
if (queryTakeValue > 0) {
|
|
4341
|
+
filterQuery.take(queryTakeValue);
|
|
4342
|
+
}
|
|
4343
|
+
else {
|
|
4344
|
+
filterQuery.take(takeValue);
|
|
4345
|
+
}
|
|
4346
|
+
}
|
|
4035
4347
|
}
|
|
4036
4348
|
filterQuery.requiresCount();
|
|
4037
4349
|
}
|
|
@@ -4252,29 +4564,6 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
4252
4564
|
this.renderPopup();
|
|
4253
4565
|
}
|
|
4254
4566
|
};
|
|
4255
|
-
DropDownList.prototype.UpdateSkeleton = function (isSkeletonCountChange, skeletonCount) {
|
|
4256
|
-
var isContainSkeleton = this.list.querySelector('.e-virtual-ddl-content');
|
|
4257
|
-
var isContainVirtualList = this.list.querySelector('.e-virtual-list');
|
|
4258
|
-
if (isContainSkeleton && (!isContainVirtualList || isSkeletonCountChange) && this.enableVirtualization) {
|
|
4259
|
-
var totalSkeletonCount = isSkeletonCountChange ? skeletonCount : this.skeletonCount;
|
|
4260
|
-
for (var i = 0; i < totalSkeletonCount; i++) {
|
|
4261
|
-
var liElement = this.createElement('li', { className: dropDownListClasses.virtualList, styles: 'overflow: inherit' });
|
|
4262
|
-
if (this.enableVirtualization && this.itemTemplate) {
|
|
4263
|
-
liElement.style.height = this.listItemHeight + 'px';
|
|
4264
|
-
}
|
|
4265
|
-
var skeleton = new Skeleton({
|
|
4266
|
-
shape: "Text",
|
|
4267
|
-
height: "10px",
|
|
4268
|
-
width: "95%",
|
|
4269
|
-
cssClass: "e-skeleton-text",
|
|
4270
|
-
});
|
|
4271
|
-
skeleton.appendTo(this.createElement('div'));
|
|
4272
|
-
liElement.appendChild(skeleton.element);
|
|
4273
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4274
|
-
isContainSkeleton.firstChild.insertBefore(liElement, isContainSkeleton.firstChild.children[0]);
|
|
4275
|
-
}
|
|
4276
|
-
}
|
|
4277
|
-
};
|
|
4278
4567
|
DropDownList.prototype.getTakeValue = function () {
|
|
4279
4568
|
return this.allowFiltering && this.getModuleName() === 'dropdownlist' && Browser.isDevice ? Math.round(window.outerHeight / this.listItemHeight) : this.itemCount;
|
|
4280
4569
|
};
|
|
@@ -4316,19 +4605,20 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
4316
4605
|
this.initialRemoteRender = false;
|
|
4317
4606
|
if (this.value && this.dataSource instanceof DataManager) {
|
|
4318
4607
|
var checkField_1 = isNullOrUndefined(this.fields.value) ? this.fields.text : this.fields.value;
|
|
4608
|
+
var value_5 = this.allowObjectBinding && !isNullOrUndefined(this.value) ? getValue(checkField_1, this.value) : this.value;
|
|
4319
4609
|
var fieldValue_1 = this.fields.value.split('.');
|
|
4320
4610
|
var checkVal = list.some(function (x) {
|
|
4321
4611
|
return isNullOrUndefined(x[checkField_1]) && fieldValue_1.length > 1 ?
|
|
4322
|
-
_this.checkFieldValue(x, fieldValue_1) ===
|
|
4612
|
+
_this.checkFieldValue(x, fieldValue_1) === value_5 : x[checkField_1] === value_5;
|
|
4323
4613
|
});
|
|
4324
4614
|
if (this.enableVirtualization && this.virtualGroupDataSource) {
|
|
4325
4615
|
checkVal = this.virtualGroupDataSource.some(function (x) {
|
|
4326
4616
|
return isNullOrUndefined(x[checkField_1]) && fieldValue_1.length > 1 ?
|
|
4327
|
-
_this.checkFieldValue(x, fieldValue_1) ===
|
|
4617
|
+
_this.checkFieldValue(x, fieldValue_1) === value_5 : x[checkField_1] === value_5;
|
|
4328
4618
|
});
|
|
4329
4619
|
}
|
|
4330
4620
|
if (!checkVal) {
|
|
4331
|
-
this.dataSource.executeQuery(this.getQuery(this.query).where(new Predicate(checkField_1, 'equal',
|
|
4621
|
+
this.dataSource.executeQuery(this.getQuery(this.query).where(new Predicate(checkField_1, 'equal', value_5)))
|
|
4332
4622
|
.then(function (e) {
|
|
4333
4623
|
if (e.result.length > 0) {
|
|
4334
4624
|
_this.addItem(e.result, list.length);
|
|
@@ -4440,10 +4730,10 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
4440
4730
|
DropDownList.prototype.addNewItem = function (listData, newElement) {
|
|
4441
4731
|
var _this = this;
|
|
4442
4732
|
if (!isNullOrUndefined(this.itemData) && !isNullOrUndefined(newElement)) {
|
|
4443
|
-
var
|
|
4733
|
+
var value_6 = this.getItemData().value;
|
|
4444
4734
|
var isExist = listData.some(function (data) {
|
|
4445
|
-
return (((typeof data === 'string' || typeof data === 'number') && data ===
|
|
4446
|
-
(getValue(_this.fields.value, data) ===
|
|
4735
|
+
return (((typeof data === 'string' || typeof data === 'number') && data === value_6) ||
|
|
4736
|
+
(getValue(_this.fields.value, data) === value_6));
|
|
4447
4737
|
});
|
|
4448
4738
|
if (!isExist) {
|
|
4449
4739
|
this.addItem(this.itemData);
|
|
@@ -4499,46 +4789,19 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
4499
4789
|
DropDownList.prototype.updateSelectionList = function () {
|
|
4500
4790
|
var selectedItem = this.list && this.list.querySelector('.' + 'e-active');
|
|
4501
4791
|
if (!selectedItem && !isNullOrUndefined(this.value)) {
|
|
4502
|
-
var
|
|
4792
|
+
var value = this.allowObjectBinding ? getValue((this.fields.value) ? this.fields.value : '', this.value) : this.value;
|
|
4793
|
+
var findEle = this.findListElement(this.list, 'li', 'data-value', value);
|
|
4503
4794
|
if (findEle) {
|
|
4504
4795
|
findEle.classList.add('e-active');
|
|
4505
4796
|
}
|
|
4506
4797
|
}
|
|
4507
4798
|
};
|
|
4508
|
-
DropDownList.prototype.checkAndResetCache = function () {
|
|
4509
|
-
if (this.enableVirtualization) {
|
|
4510
|
-
this.generatedDataObject = {};
|
|
4511
|
-
this.virtualItemStartIndex = this.virtualItemEndIndex = 0;
|
|
4512
|
-
this.viewPortInfo = { currentPageNumber: null,
|
|
4513
|
-
direction: null,
|
|
4514
|
-
sentinelInfo: {},
|
|
4515
|
-
offsets: {},
|
|
4516
|
-
startIndex: 0,
|
|
4517
|
-
endIndex: this.itemCount, };
|
|
4518
|
-
this.selectedValueInfo = null;
|
|
4519
|
-
}
|
|
4520
|
-
};
|
|
4521
4799
|
DropDownList.prototype.removeFocus = function () {
|
|
4522
4800
|
var highlightedItem = this.list.querySelectorAll('.' + dropDownListClasses.focus);
|
|
4523
4801
|
if (highlightedItem && highlightedItem.length) {
|
|
4524
4802
|
removeClass(highlightedItem, dropDownListClasses.focus);
|
|
4525
4803
|
}
|
|
4526
4804
|
};
|
|
4527
|
-
DropDownList.prototype.getTransformValues = function () {
|
|
4528
|
-
var translateY = this.viewPortInfo.startIndex * this.listItemHeight;
|
|
4529
|
-
translateY = translateY - (this.skeletonCount * this.listItemHeight);
|
|
4530
|
-
translateY = this.viewPortInfo.startIndex === 0 && this.listData && this.listData.length === 0 ? 0 : translateY;
|
|
4531
|
-
var styleText = "transform: translate(0px, " + translateY + "px);";
|
|
4532
|
-
return styleText;
|
|
4533
|
-
};
|
|
4534
|
-
DropDownList.prototype.GetVirtualTrackHeight = function () {
|
|
4535
|
-
var height = this.totalItemCount === this.viewPortInfo.endIndex ? this.totalItemCount * this.listItemHeight - this.itemCount * this.listItemHeight : this.totalItemCount * this.listItemHeight;
|
|
4536
|
-
var heightDimension = "height: " + (height - this.itemCount * this.listItemHeight) + "px;";
|
|
4537
|
-
if (this.getModuleName() === 'autocomplete' && this.skeletonCount === 0) {
|
|
4538
|
-
return "height: 0px;";
|
|
4539
|
-
}
|
|
4540
|
-
return heightDimension;
|
|
4541
|
-
};
|
|
4542
4805
|
DropDownList.prototype.renderPopup = function (e) {
|
|
4543
4806
|
var _this = this;
|
|
4544
4807
|
if (this.popupObj && document.body.contains(this.popupObj.element)) {
|
|
@@ -4554,7 +4817,7 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
4554
4817
|
popupEle.setAttribute('aria-label', _this.element.id);
|
|
4555
4818
|
popupEle.setAttribute('role', 'dialog');
|
|
4556
4819
|
var searchBox = _this.setSearchBox(popupEle);
|
|
4557
|
-
_this.
|
|
4820
|
+
_this.listContainerHeight = formatUnit(_this.popupHeight);
|
|
4558
4821
|
if (_this.headerTemplate) {
|
|
4559
4822
|
_this.setHeaderTemplate(popupEle);
|
|
4560
4823
|
}
|
|
@@ -4598,19 +4861,19 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
4598
4861
|
_this.searchBoxHeight = 0;
|
|
4599
4862
|
if (!isNullOrUndefined(searchBox.container) && _this.getModuleName() !== 'combobox' && _this.getModuleName() !== 'autocomplete') {
|
|
4600
4863
|
_this.searchBoxHeight = (searchBox.container.parentElement).getBoundingClientRect().height;
|
|
4601
|
-
_this.
|
|
4864
|
+
_this.listContainerHeight = (parseInt(_this.listContainerHeight, 10) - (_this.searchBoxHeight)).toString() + 'px';
|
|
4602
4865
|
}
|
|
4603
4866
|
if (_this.headerTemplate) {
|
|
4604
4867
|
_this.header = _this.header ? _this.header : popupEle.querySelector('.e-ddl-header');
|
|
4605
4868
|
var height = Math.round(_this.header.getBoundingClientRect().height);
|
|
4606
|
-
_this.
|
|
4869
|
+
_this.listContainerHeight = (parseInt(_this.listContainerHeight, 10) - (height + _this.searchBoxHeight)).toString() + 'px';
|
|
4607
4870
|
}
|
|
4608
4871
|
if (_this.footerTemplate) {
|
|
4609
4872
|
_this.footer = _this.footer ? _this.footer : popupEle.querySelector('.e-ddl-footer');
|
|
4610
4873
|
var height = Math.round(_this.footer.getBoundingClientRect().height);
|
|
4611
|
-
_this.
|
|
4874
|
+
_this.listContainerHeight = (parseInt(_this.listContainerHeight, 10) - (height + _this.searchBoxHeight)).toString() + 'px';
|
|
4612
4875
|
}
|
|
4613
|
-
_this.list.style.maxHeight = (parseInt(_this.
|
|
4876
|
+
_this.list.style.maxHeight = (parseInt(_this.listContainerHeight, 10) - 2).toString() + 'px'; // due to box-sizing property
|
|
4614
4877
|
popupEle.style.maxHeight = formatUnit(_this.popupHeight);
|
|
4615
4878
|
}
|
|
4616
4879
|
else {
|
|
@@ -4921,6 +5184,9 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
4921
5184
|
this.list.scrollTop += nextOffset;
|
|
4922
5185
|
}
|
|
4923
5186
|
else {
|
|
5187
|
+
if (this.enableVirtualization) {
|
|
5188
|
+
liCount = keyAction == "pageDown" ? this.getPageCount() : liCount;
|
|
5189
|
+
}
|
|
4924
5190
|
this.list.scrollTop += this.selectedLI.offsetHeight * liCount;
|
|
4925
5191
|
}
|
|
4926
5192
|
this.isPreventKeyAction = this.IsScrollerAtEnd() ? false : this.isPreventKeyAction;
|
|
@@ -4974,6 +5240,9 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
4974
5240
|
else if (nextOffset < 0 || isPageUpKeyAction) {
|
|
4975
5241
|
var currentElementValue = this.selectedLI ? this.selectedLI.getAttribute('data-value') : null;
|
|
4976
5242
|
var liCount = keyAction == "pageUp" ? this.getPageCount() - 2 : 1;
|
|
5243
|
+
if (this.enableVirtualization) {
|
|
5244
|
+
liCount = keyAction == "pageUp" ? this.getPageCount() : liCount;
|
|
5245
|
+
}
|
|
4977
5246
|
if (this.enableVirtualization && this.isKeyBoardAction && firstElementValue && currentElementValue === firstElementValue && keyAction != "home" && !this.isVirtualScrolling) {
|
|
4978
5247
|
this.isUpwardScrolling = true;
|
|
4979
5248
|
this.isPreventKeyAction = true;
|
|
@@ -5071,6 +5340,7 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
5071
5340
|
var isFilterValue = !isNullOrUndefined(this.filterInput) && !isNullOrUndefined(this.filterInput.value) && this.filterInput.value !== '';
|
|
5072
5341
|
var typedString = this.getModuleName() === 'combobox' ? this.typedString : null;
|
|
5073
5342
|
this.isTyped = false;
|
|
5343
|
+
this.isVirtualTrackHeight = false;
|
|
5074
5344
|
if (!(this.popupObj && document.body.contains(this.popupObj.element) && this.beforePopupOpen)) {
|
|
5075
5345
|
return;
|
|
5076
5346
|
}
|
|
@@ -5326,6 +5596,9 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
5326
5596
|
this.listItemHeight = this.getListHeight();
|
|
5327
5597
|
this.getSkeletonCount();
|
|
5328
5598
|
this.updateVirtualizationProperties(this.itemCount, this.allowFiltering);
|
|
5599
|
+
if (this.index !== null) {
|
|
5600
|
+
this.activeIndex = this.index + this.skeletonCount;
|
|
5601
|
+
}
|
|
5329
5602
|
}
|
|
5330
5603
|
this.initValue();
|
|
5331
5604
|
this.selectedValueInfo = this.viewPortInfo;
|
|
@@ -5335,7 +5608,7 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
5335
5608
|
}
|
|
5336
5609
|
else if (this.element.tagName === 'SELECT' && this.element.options[0]) {
|
|
5337
5610
|
var selectElement = this.element;
|
|
5338
|
-
this.value = selectElement.options[selectElement.selectedIndex].value;
|
|
5611
|
+
this.value = this.allowObjectBinding ? this.getDataByValue(selectElement.options[selectElement.selectedIndex].value) : selectElement.options[selectElement.selectedIndex].value;
|
|
5339
5612
|
this.text = isNullOrUndefined(this.value) ? null : selectElement.options[selectElement.selectedIndex].textContent;
|
|
5340
5613
|
this.initValue();
|
|
5341
5614
|
}
|
|
@@ -5487,7 +5760,7 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
5487
5760
|
this.actionData = this.actionCompleteData;
|
|
5488
5761
|
}
|
|
5489
5762
|
};
|
|
5490
|
-
DropDownList.prototype.updateDataSource = function (props) {
|
|
5763
|
+
DropDownList.prototype.updateDataSource = function (props, oldProps) {
|
|
5491
5764
|
if (this.inputElement.value !== '' || (!isNullOrUndefined(props) && (isNullOrUndefined(props.dataSource)
|
|
5492
5765
|
|| (!(props.dataSource instanceof DataManager) && props.dataSource.length === 0)))) {
|
|
5493
5766
|
this.clearAll(null, props);
|
|
@@ -5497,7 +5770,7 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
5497
5770
|
EventHandler.add(this.list, 'scroll', this.setFloatingHeader, this);
|
|
5498
5771
|
}
|
|
5499
5772
|
if (!(!isNullOrUndefined(props) && (isNullOrUndefined(props.dataSource)
|
|
5500
|
-
|| (!(props.dataSource instanceof DataManager) && props.dataSource.length === 0))) || !(Array.isArray(props.dataSource) && props.dataSource.length
|
|
5773
|
+
|| (!(props.dataSource instanceof DataManager) && props.dataSource.length === 0))) || ((props.dataSource instanceof DataManager) || (!isNullOrUndefined(props) && Array.isArray(props.dataSource) && !isNullOrUndefined(oldProps) && Array.isArray(oldProps.dataSource) && props.dataSource.length !== oldProps.dataSource.length))) {
|
|
5501
5774
|
this.typedString = '';
|
|
5502
5775
|
this.resetList(this.dataSource);
|
|
5503
5776
|
}
|
|
@@ -5506,9 +5779,11 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
5506
5779
|
}
|
|
5507
5780
|
};
|
|
5508
5781
|
DropDownList.prototype.checkCustomValue = function () {
|
|
5509
|
-
this.
|
|
5782
|
+
var currentValue = this.allowObjectBinding && !isNullOrUndefined(this.value) ? getValue((this.fields.value) ? this.fields.value : '', this.value) : this.value;
|
|
5783
|
+
this.itemData = this.getDataByValue(currentValue);
|
|
5510
5784
|
var dataItem = this.getItemData();
|
|
5511
|
-
this.
|
|
5785
|
+
var value = this.allowObjectBinding ? this.itemData : dataItem.value;
|
|
5786
|
+
this.setProperties({ 'text': dataItem.text, 'value': value });
|
|
5512
5787
|
};
|
|
5513
5788
|
DropDownList.prototype.updateInputFields = function () {
|
|
5514
5789
|
if (this.getModuleName() === 'dropdownlist') {
|
|
@@ -5630,6 +5905,9 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
5630
5905
|
this_1.clearAll();
|
|
5631
5906
|
break;
|
|
5632
5907
|
}
|
|
5908
|
+
if (this_1.allowObjectBinding && !isNullOrUndefined(newProp.value) && !isNullOrUndefined(oldProp.value) && this_1.isObjectInArray(newProp.value, [oldProp.value])) {
|
|
5909
|
+
return { value: void 0 };
|
|
5910
|
+
}
|
|
5633
5911
|
if (this_1.enableVirtualization) {
|
|
5634
5912
|
this_1.updateValues();
|
|
5635
5913
|
this_1.updateInputFields();
|
|
@@ -5647,7 +5925,8 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
5647
5925
|
this_1.renderList();
|
|
5648
5926
|
}
|
|
5649
5927
|
if (!this_1.initialRemoteRender) {
|
|
5650
|
-
var
|
|
5928
|
+
var value = this_1.allowObjectBinding && !isNullOrUndefined(newProp.value) ? getValue((this_1.fields.value) ? this_1.fields.value : '', newProp.value) : newProp.value;
|
|
5929
|
+
var item = this_1.getElementByValue(value);
|
|
5651
5930
|
if (!this_1.checkValidLi(item)) {
|
|
5652
5931
|
if (this_1.liCollections && this_1.liCollections.length === 100 &&
|
|
5653
5932
|
this_1.getModuleName() === 'autocomplete' && this_1.listData.length > 100) {
|
|
@@ -5657,7 +5936,8 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
5657
5936
|
var listLength_2 = this_1.getItems().length;
|
|
5658
5937
|
var checkField = isNullOrUndefined(this_1.fields.value) ? this_1.fields.text : this_1.fields.value;
|
|
5659
5938
|
this_1.typedString = '';
|
|
5660
|
-
this_1.
|
|
5939
|
+
var value_7 = this_1.allowObjectBinding && !isNullOrUndefined(newProp.value) ? getValue(checkField, newProp.value) : newProp.value;
|
|
5940
|
+
this_1.dataSource.executeQuery(this_1.getQuery(this_1.query).where(new Predicate(checkField, 'equal', value_7)))
|
|
5661
5941
|
.then(function (e) {
|
|
5662
5942
|
if (e.result.length > 0) {
|
|
5663
5943
|
_this.addItem(e.result, listLength_2);
|
|
@@ -5754,7 +6034,9 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
5754
6034
|
var this_1 = this;
|
|
5755
6035
|
for (var _i = 0, _a = Object.keys(newProp); _i < _a.length; _i++) {
|
|
5756
6036
|
var prop = _a[_i];
|
|
5757
|
-
_loop_1(prop);
|
|
6037
|
+
var state_1 = _loop_1(prop);
|
|
6038
|
+
if (typeof state_1 === "object")
|
|
6039
|
+
return state_1.value;
|
|
5758
6040
|
}
|
|
5759
6041
|
};
|
|
5760
6042
|
DropDownList.prototype.checkValidLi = function (element) {
|
|
@@ -5775,6 +6057,8 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
5775
6057
|
}
|
|
5776
6058
|
}
|
|
5777
6059
|
else if (prop === 'value') {
|
|
6060
|
+
var fields = (_this.fields.value) ? _this.fields.value : '';
|
|
6061
|
+
var value = _this.allowObjectBinding && !isNullOrUndefined(newProp) ? getValue(fields, newProp) : newProp;
|
|
5778
6062
|
li = _this.getElementByValue(newProp);
|
|
5779
6063
|
if (!_this.checkValidLi(li)) {
|
|
5780
6064
|
_this.setOldValue(oldProp);
|
|
@@ -5837,6 +6121,7 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
5837
6121
|
if (!this.enabled) {
|
|
5838
6122
|
return;
|
|
5839
6123
|
}
|
|
6124
|
+
this.firstItem = this.dataSource && this.dataSource.length > 0 ? this.dataSource[0] : null;
|
|
5840
6125
|
if (this.isReact && this.getModuleName() === 'combobox' && this.itemTemplate && this.isCustomFilter && this.isAddNewItemTemplate) {
|
|
5841
6126
|
this.renderList();
|
|
5842
6127
|
this.isAddNewItemTemplate = false;
|
|
@@ -5913,7 +6198,8 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
5913
6198
|
}
|
|
5914
6199
|
this.isEscapeKey = false;
|
|
5915
6200
|
if (!isNullOrUndefined(this.index)) {
|
|
5916
|
-
var
|
|
6201
|
+
var value = this.allowObjectBinding ? getValue((this.fields.value) ? this.fields.value : '', this.value) : this.value;
|
|
6202
|
+
var element = this.findListElement(this.ulElement, 'li', 'data-value', value);
|
|
5917
6203
|
this.selectedLI = this.liCollections[this.index] || element;
|
|
5918
6204
|
if (this.selectedLI) {
|
|
5919
6205
|
this.updateSelectedItem(this.selectedLI, null, true);
|
|
@@ -5926,6 +6212,7 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
5926
6212
|
this.resetSelection();
|
|
5927
6213
|
}
|
|
5928
6214
|
}
|
|
6215
|
+
this.isVirtualTrackHeight = false;
|
|
5929
6216
|
this.closePopup(0, e);
|
|
5930
6217
|
var dataItem = this.getItemData();
|
|
5931
6218
|
var isSelectVal = !isNullOrUndefined(this.selectedLI);
|
|
@@ -5997,6 +6284,9 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
5997
6284
|
*/
|
|
5998
6285
|
DropDownList.prototype.destroy = function () {
|
|
5999
6286
|
this.isActive = false;
|
|
6287
|
+
if (this.showClearButton) {
|
|
6288
|
+
this.clearButton = document.getElementsByClassName('e-clear-icon')[0];
|
|
6289
|
+
}
|
|
6000
6290
|
resetIncrementalSearchValues(this.element.id);
|
|
6001
6291
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
6002
6292
|
if (this.isReact) {
|
|
@@ -6052,6 +6342,14 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
6052
6342
|
if (this.inputElement && !isNullOrUndefined(this.inputElement.onchange)) {
|
|
6053
6343
|
this.inputElement.onchange = null;
|
|
6054
6344
|
}
|
|
6345
|
+
if (this.inputElement && !isNullOrUndefined(this.inputElement.onselect)) {
|
|
6346
|
+
this.inputElement.onselect = null;
|
|
6347
|
+
}
|
|
6348
|
+
Input.destroy({
|
|
6349
|
+
element: this.inputElement,
|
|
6350
|
+
floatLabelType: this.floatLabelType,
|
|
6351
|
+
properties: this.properties
|
|
6352
|
+
}, this.clearButton);
|
|
6055
6353
|
if (this.isAngular) {
|
|
6056
6354
|
this.inputElement = null;
|
|
6057
6355
|
}
|
|
@@ -6144,6 +6442,9 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
6144
6442
|
__decorate$1([
|
|
6145
6443
|
Property(null)
|
|
6146
6444
|
], DropDownList.prototype, "value", void 0);
|
|
6445
|
+
__decorate$1([
|
|
6446
|
+
Property(false)
|
|
6447
|
+
], DropDownList.prototype, "allowObjectBinding", void 0);
|
|
6147
6448
|
__decorate$1([
|
|
6148
6449
|
Property(null)
|
|
6149
6450
|
], DropDownList.prototype, "index", void 0);
|
|
@@ -6339,7 +6640,6 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
6339
6640
|
_this.filterTimer = null;
|
|
6340
6641
|
_this.isFilteredData = false;
|
|
6341
6642
|
_this.isFilterRestore = false;
|
|
6342
|
-
// eslint-disable-next-line
|
|
6343
6643
|
_this.selectedData = [];
|
|
6344
6644
|
_this.filterDelayTime = 300;
|
|
6345
6645
|
_this.isClicked = false;
|
|
@@ -6437,7 +6737,7 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
6437
6737
|
this.inputEle.setAttribute('aria-expanded', 'false');
|
|
6438
6738
|
this.inputEle.setAttribute('role', 'combobox');
|
|
6439
6739
|
this.inputEle.setAttribute('aria-haspopup', 'tree');
|
|
6440
|
-
this.inputEle.setAttribute('aria-controls', this.element.id +
|
|
6740
|
+
this.inputEle.setAttribute('aria-controls', this.element.id + '_options');
|
|
6441
6741
|
}
|
|
6442
6742
|
if (isNullOrUndefined(this.inputEle.getAttribute('type'))) {
|
|
6443
6743
|
this.inputEle.setAttribute('type', 'text');
|
|
@@ -6480,7 +6780,9 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
6480
6780
|
this.popupDiv.classList.add(DROPDOWN);
|
|
6481
6781
|
this.tree = this.createElement('div', { id: this.element.id + '_tree' });
|
|
6482
6782
|
this.popupDiv.appendChild(this.tree);
|
|
6483
|
-
|
|
6783
|
+
if (!this.destroyPopupOnHide) {
|
|
6784
|
+
document.body.appendChild(this.popupDiv);
|
|
6785
|
+
}
|
|
6484
6786
|
this.wireTreeEvents();
|
|
6485
6787
|
addClass([this.popupDiv], DDTHIDEICON);
|
|
6486
6788
|
this.renderTree();
|
|
@@ -6587,6 +6889,7 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
6587
6889
|
if (value === '') {
|
|
6588
6890
|
_this.isFilteredData = false;
|
|
6589
6891
|
_this.isFilterRestore = true;
|
|
6892
|
+
_this.isFromFilterChange = false;
|
|
6590
6893
|
fields = _this.cloneFields(_this.fields);
|
|
6591
6894
|
}
|
|
6592
6895
|
else if (args.preventDefaultAction) {
|
|
@@ -6625,7 +6928,7 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
6625
6928
|
_this.treeObj.dataBind();
|
|
6626
6929
|
if (_this.hasTemplate && _this.portals && _this.treeObj.portals) {
|
|
6627
6930
|
for (var i = 0; i < _this.treeObj.portals.length; i++) {
|
|
6628
|
-
if (_this.portals.indexOf(_this.treeObj.portals[i])
|
|
6931
|
+
if (_this.portals.indexOf(_this.treeObj.portals[i]) === -1) {
|
|
6629
6932
|
_this.portals.push(_this.treeObj.portals[i]);
|
|
6630
6933
|
}
|
|
6631
6934
|
}
|
|
@@ -6669,7 +6972,6 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
6669
6972
|
return filteredItems;
|
|
6670
6973
|
};
|
|
6671
6974
|
DropDownTree.prototype.nestedFilter = function (value, filteredFields) {
|
|
6672
|
-
// eslint-disable-next-line
|
|
6673
6975
|
var matchedDataSource = [];
|
|
6674
6976
|
for (var i = 0; i < this.treeData.length; i++) {
|
|
6675
6977
|
// eslint-disable-next-line
|
|
@@ -6681,15 +6983,12 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
6681
6983
|
filteredFields.dataSource = matchedDataSource;
|
|
6682
6984
|
return filteredFields;
|
|
6683
6985
|
};
|
|
6684
|
-
// eslint-disable-next-line
|
|
6685
6986
|
DropDownTree.prototype.nestedChildFilter = function (value, node) {
|
|
6686
|
-
// eslint-disable-next-line
|
|
6687
6987
|
var children = node[this.fields.child];
|
|
6688
6988
|
if (isNullOrUndefined(children)) {
|
|
6689
6989
|
return (this.isMatchedNode(value, node)) ? node : null;
|
|
6690
6990
|
}
|
|
6691
6991
|
else {
|
|
6692
|
-
// eslint-disable-next-line
|
|
6693
6992
|
var matchedChildren = [];
|
|
6694
6993
|
for (var i = 0; i < children.length; i++) {
|
|
6695
6994
|
// eslint-disable-next-line
|
|
@@ -6710,9 +7009,7 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
6710
7009
|
}
|
|
6711
7010
|
};
|
|
6712
7011
|
DropDownTree.prototype.selfReferencefilter = function (value, filteredFields) {
|
|
6713
|
-
// eslint-disable-next-line
|
|
6714
7012
|
var matchedData = [];
|
|
6715
|
-
// eslint-disable-next-line
|
|
6716
7013
|
var matchedDataSource = [];
|
|
6717
7014
|
for (var i = 0; i < this.treeData.length; i++) {
|
|
6718
7015
|
if (this.isMatchedNode(value, this.treeData[i])) {
|
|
@@ -6725,7 +7022,6 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
6725
7022
|
// eslint-disable-next-line
|
|
6726
7023
|
var parentId = matchedData[i][this.fields.parentValue];
|
|
6727
7024
|
while (!isNullOrUndefined(parentId)) {
|
|
6728
|
-
// eslint-disable-next-line
|
|
6729
7025
|
var parent_1 = null;
|
|
6730
7026
|
for (var j = 0; j < this.treeData.length; j++) {
|
|
6731
7027
|
// eslint-disable-next-line
|
|
@@ -6748,7 +7044,6 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
6748
7044
|
filteredFields.dataSource = matchedDataSource;
|
|
6749
7045
|
return filteredFields;
|
|
6750
7046
|
};
|
|
6751
|
-
// eslint-disable-next-line
|
|
6752
7047
|
DropDownTree.prototype.isMatchedNode = function (value, node, isChild, isChildFiltering) {
|
|
6753
7048
|
var checkValue;
|
|
6754
7049
|
var isObjectValue = isChild && isChildFiltering && this.isChildObject();
|
|
@@ -7144,7 +7439,6 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
7144
7439
|
var remaining = void 0;
|
|
7145
7440
|
var downIconWidth = 0;
|
|
7146
7441
|
this.overFlowWrapper.innerHTML = '';
|
|
7147
|
-
// eslint-disable-next-line
|
|
7148
7442
|
var l10nLocale = { overflowCountTemplate: '+${count} more..', totalCountTemplate: '${count} selected' };
|
|
7149
7443
|
this.l10n = new L10n(this.getLocaleName(), l10nLocale, this.locale);
|
|
7150
7444
|
var remainContent = this.l10n.getConstant('overflowCountTemplate');
|
|
@@ -7427,7 +7721,6 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
7427
7721
|
if (this.selectAllText !== 'Select All' || this.unSelectAllText !== 'Unselect All') {
|
|
7428
7722
|
var template = unSelect ? this.unSelectAllText : this.selectAllText;
|
|
7429
7723
|
this.selectAllSpan.textContent = '';
|
|
7430
|
-
// eslint-disable-next-line
|
|
7431
7724
|
var compiledString = compile(template);
|
|
7432
7725
|
var templateName = unSelect ? 'unSelectAllText' : 'selectAllText';
|
|
7433
7726
|
for (var _i = 0, _a = compiledString({}, this, templateName, null, !this.isStringTemplate); _i < _a.length; _i++) {
|
|
@@ -7453,11 +7746,11 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
7453
7746
|
if (htmlAttr === 'class') {
|
|
7454
7747
|
this.inputWrapper.classList.add(this.htmlAttributes["" + htmlAttr]);
|
|
7455
7748
|
}
|
|
7456
|
-
else if (htmlAttr === 'disabled'
|
|
7749
|
+
else if (htmlAttr === 'disabled') {
|
|
7457
7750
|
this.setProperties({ enabled: false }, true);
|
|
7458
7751
|
this.setEnable();
|
|
7459
7752
|
}
|
|
7460
|
-
else if (htmlAttr === 'readonly'
|
|
7753
|
+
else if (htmlAttr === 'readonly') {
|
|
7461
7754
|
this.setProperties({ readonly: true }, true);
|
|
7462
7755
|
this.dataBind();
|
|
7463
7756
|
}
|
|
@@ -7517,7 +7810,6 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
7517
7810
|
};
|
|
7518
7811
|
DropDownTree.prototype.setTreeValue = function () {
|
|
7519
7812
|
if (this.value !== null && this.value.length !== 0) {
|
|
7520
|
-
// eslint-disable-next-line
|
|
7521
7813
|
var data = void 0;
|
|
7522
7814
|
if (this.showCheckBox || this.allowMultiSelection) {
|
|
7523
7815
|
for (var i = 0; i < this.value.length; i++) {
|
|
@@ -7547,7 +7839,6 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
7547
7839
|
return;
|
|
7548
7840
|
}
|
|
7549
7841
|
if (this.text !== null) {
|
|
7550
|
-
// eslint-disable-next-line
|
|
7551
7842
|
var data = void 0;
|
|
7552
7843
|
var valArr = [];
|
|
7553
7844
|
if (this.showCheckBox || this.allowMultiSelection) {
|
|
@@ -7638,9 +7929,7 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
7638
7929
|
this.triggerChangeEvent();
|
|
7639
7930
|
}
|
|
7640
7931
|
};
|
|
7641
|
-
// eslint-disable-next-line
|
|
7642
7932
|
DropDownTree.prototype.getItems = function (givenText) {
|
|
7643
|
-
// eslint-disable-next-line
|
|
7644
7933
|
var data;
|
|
7645
7934
|
if (this.treeDataType === 1) {
|
|
7646
7935
|
for (var i = 0; i < this.treeItems.length; i++) {
|
|
@@ -7657,9 +7946,7 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
7657
7946
|
}
|
|
7658
7947
|
return data;
|
|
7659
7948
|
};
|
|
7660
|
-
// eslint-disable-next-line
|
|
7661
7949
|
DropDownTree.prototype.getNestedItems = function (data, field, givenText) {
|
|
7662
|
-
// eslint-disable-next-line
|
|
7663
7950
|
var newData;
|
|
7664
7951
|
for (var i = 0, objlen = data.length; i < objlen; i++) {
|
|
7665
7952
|
// eslint-disable-next-line
|
|
@@ -7670,7 +7957,6 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
7670
7957
|
else if (typeof field.child === 'string' && !isNullOrUndefined(getValue(field.child, data[i]))) {
|
|
7671
7958
|
// eslint-disable-next-line
|
|
7672
7959
|
var childData = getValue(field.child, data[i]);
|
|
7673
|
-
// eslint-disable-next-line
|
|
7674
7960
|
newData = this.getNestedItems(childData, this.getChildType(field), givenText);
|
|
7675
7961
|
if (newData !== undefined) {
|
|
7676
7962
|
break;
|
|
@@ -7713,7 +7999,7 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
7713
7999
|
nodeTemplate: this.itemTemplate
|
|
7714
8000
|
});
|
|
7715
8001
|
this.treeObj.root = this.root ? this.root : this;
|
|
7716
|
-
this.treeObj.appendTo(
|
|
8002
|
+
this.treeObj.appendTo(this.tree);
|
|
7717
8003
|
};
|
|
7718
8004
|
/* To render the popup element */
|
|
7719
8005
|
DropDownTree.prototype.renderPopup = function () {
|
|
@@ -7771,9 +8057,13 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
7771
8057
|
_this.isFirstRender = false;
|
|
7772
8058
|
/* eslint-disable */
|
|
7773
8059
|
if (_this.hasTemplate && _this.portals) {
|
|
7774
|
-
|
|
8060
|
+
if (_this.treeObj.portals) {
|
|
8061
|
+
_this.portals = _this.portals.concat(_this.treeObj.portals.filter(function (item) { return !_this.portals.includes(item); }));
|
|
8062
|
+
}
|
|
7775
8063
|
/* eslint-enable */
|
|
7776
|
-
_this.
|
|
8064
|
+
if (_this.isReact) {
|
|
8065
|
+
_this.renderReactTemplates(_this.reactCallBack);
|
|
8066
|
+
}
|
|
7777
8067
|
}
|
|
7778
8068
|
}
|
|
7779
8069
|
if (!isCancelled) {
|
|
@@ -7784,7 +8074,15 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
7784
8074
|
_this.popupObj.refreshPosition();
|
|
7785
8075
|
if (!(_this.showCheckBox && _this.showSelectAll) && (!_this.popupDiv.classList.contains(NODATA)
|
|
7786
8076
|
&& _this.treeItems.length > 0)) {
|
|
7787
|
-
var focusedElement =
|
|
8077
|
+
var focusedElement = void 0;
|
|
8078
|
+
if (_this.value != null && _this.text != null) {
|
|
8079
|
+
_this.treeObj.element.querySelector('li').setAttribute('tabindex', '-1');
|
|
8080
|
+
focusedElement = _this.treeObj.element.querySelector('[data-uid="' + _this.value[0] + '"]');
|
|
8081
|
+
focusedElement.setAttribute('tabindex', '0');
|
|
8082
|
+
}
|
|
8083
|
+
else {
|
|
8084
|
+
focusedElement = _this.treeObj.element.querySelector('li');
|
|
8085
|
+
}
|
|
7788
8086
|
focusedElement.focus();
|
|
7789
8087
|
addClass([focusedElement], ['e-node-focus']);
|
|
7790
8088
|
}
|
|
@@ -7802,6 +8100,10 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
7802
8100
|
}
|
|
7803
8101
|
});
|
|
7804
8102
|
};
|
|
8103
|
+
DropDownTree.prototype.reactCallBack = function () {
|
|
8104
|
+
this.updatePopupHeight();
|
|
8105
|
+
this.popupObj.refreshPosition();
|
|
8106
|
+
};
|
|
7805
8107
|
DropDownTree.prototype.updatePopupHeight = function () {
|
|
7806
8108
|
if (this.isFirstRender) {
|
|
7807
8109
|
return;
|
|
@@ -8060,7 +8362,6 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
8060
8362
|
}
|
|
8061
8363
|
return null;
|
|
8062
8364
|
};
|
|
8063
|
-
// eslint-disable-next-line
|
|
8064
8365
|
DropDownTree.prototype.getTreeDataType = function (ds, field) {
|
|
8065
8366
|
if (this.fields.dataSource instanceof DataManager) {
|
|
8066
8367
|
for (var i = 0; i < ds.length; i++) {
|
|
@@ -8070,8 +8371,9 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
8070
8371
|
}
|
|
8071
8372
|
return 2;
|
|
8072
8373
|
}
|
|
8073
|
-
if (isNullOrUndefined(this.fields.dataSource))
|
|
8374
|
+
if (isNullOrUndefined(this.fields.dataSource)) {
|
|
8074
8375
|
this.fields.dataSource = [];
|
|
8376
|
+
}
|
|
8075
8377
|
for (var i = 0, len = this.fields.dataSource.length; i < len; i++) {
|
|
8076
8378
|
if ((typeof field.child === 'string') && !isNullOrUndefined(getValue(field.child, this.fields.dataSource[i]))) {
|
|
8077
8379
|
return 2;
|
|
@@ -8092,9 +8394,7 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
8092
8394
|
this.treeObj.dataBind();
|
|
8093
8395
|
};
|
|
8094
8396
|
DropDownTree.prototype.getEventArgs = function (args) {
|
|
8095
|
-
// eslint-disable-next-line
|
|
8096
8397
|
var checkData = args.data;
|
|
8097
|
-
// eslint-disable-next-line
|
|
8098
8398
|
var selectData = args.nodeData;
|
|
8099
8399
|
var state;
|
|
8100
8400
|
if (this.showCheckBox) {
|
|
@@ -8179,7 +8479,6 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
8179
8479
|
var target = args.event.target;
|
|
8180
8480
|
if ((target.classList.contains('e-fullrow') || target.classList.contains('e-list-text')) && this.showCheckBox) {
|
|
8181
8481
|
this.isClicked = true;
|
|
8182
|
-
// eslint-disable-next-line
|
|
8183
8482
|
var getNodeDetails = this.treeObj.getNode(args.node);
|
|
8184
8483
|
if (getNodeDetails.isChecked === 'true') {
|
|
8185
8484
|
this.treeObj.uncheckAll([args.node]);
|
|
@@ -8231,7 +8530,7 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
8231
8530
|
DropDownTree.prototype.onNodeExpanded = function (args) {
|
|
8232
8531
|
if (this.hasTemplate && this.portals && this.treeObj.portals) {
|
|
8233
8532
|
for (var i = 0; i < this.treeObj.portals.length; i++) {
|
|
8234
|
-
if (this.portals.indexOf(this.treeObj.portals[i])
|
|
8533
|
+
if (this.portals.indexOf(this.treeObj.portals[i]) === -1) {
|
|
8235
8534
|
this.portals.push(this.treeObj.portals[i]);
|
|
8236
8535
|
}
|
|
8237
8536
|
}
|
|
@@ -8329,7 +8628,7 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
8329
8628
|
};
|
|
8330
8629
|
DropDownTree.prototype.setMultiSelectValue = function (newValues) {
|
|
8331
8630
|
if (!this.isFilteredData) {
|
|
8332
|
-
this.setProperties({ value: this.isFromFilterChange && newValues && newValues.length
|
|
8631
|
+
this.setProperties({ value: this.isFromFilterChange && newValues && newValues.length === 0 ? this.value : newValues }, true);
|
|
8333
8632
|
this.isFromFilterChange = false;
|
|
8334
8633
|
if (newValues && newValues.length !== 0 && !this.showCheckBox) {
|
|
8335
8634
|
this.treeObj.selectedNodes = this.value.slice();
|
|
@@ -8379,9 +8678,7 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
8379
8678
|
}
|
|
8380
8679
|
this.updateSelectedValues();
|
|
8381
8680
|
};
|
|
8382
|
-
// eslint-disable-next-line
|
|
8383
8681
|
DropDownTree.prototype.getSelectedData = function (value) {
|
|
8384
|
-
// eslint-disable-next-line
|
|
8385
8682
|
var data = null;
|
|
8386
8683
|
if (this.isFilteredData) {
|
|
8387
8684
|
for (var i = 0; i < this.selectedData.length; i++) {
|
|
@@ -8468,7 +8765,6 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
8468
8765
|
var temp;
|
|
8469
8766
|
var text;
|
|
8470
8767
|
var textValue = '';
|
|
8471
|
-
// eslint-disable-next-line
|
|
8472
8768
|
var selectedData;
|
|
8473
8769
|
this.hiddenElement.innerHTML = '';
|
|
8474
8770
|
var hiddenInputValue = '';
|
|
@@ -8564,7 +8860,7 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
8564
8860
|
addClass([this.inputWrapper], SHOW_CHIP);
|
|
8565
8861
|
}
|
|
8566
8862
|
var chip = this.createElement('span', {
|
|
8567
|
-
className: CHIP
|
|
8863
|
+
className: CHIP
|
|
8568
8864
|
});
|
|
8569
8865
|
if (!this.inputEle.classList.contains(CHIP_INPUT)) {
|
|
8570
8866
|
addClass([this.inputEle], CHIP_INPUT);
|
|
@@ -8606,7 +8902,6 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
8606
8902
|
this.header = this.createElement('div');
|
|
8607
8903
|
addClass([this.header], HEADER);
|
|
8608
8904
|
}
|
|
8609
|
-
// eslint-disable-next-line
|
|
8610
8905
|
var compiledString = this.templateComplier(this.headerTemplate);
|
|
8611
8906
|
var tempArr = compiledString({}, this, 'headerTemplate', this.headerTemplateId, this.isStringTemplate, undefined, this.header);
|
|
8612
8907
|
if (tempArr) {
|
|
@@ -8615,7 +8910,6 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
8615
8910
|
}
|
|
8616
8911
|
this.popupEle.insertBefore(this.header, this.checkAllParent ? this.checkAllParent : this.popupDiv);
|
|
8617
8912
|
};
|
|
8618
|
-
// eslint-disable-next-line
|
|
8619
8913
|
DropDownTree.prototype.templateComplier = function (template) {
|
|
8620
8914
|
if (template) {
|
|
8621
8915
|
// eslint-disable-next-line
|
|
@@ -8641,7 +8935,6 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
8641
8935
|
this.footer = this.createElement('div');
|
|
8642
8936
|
addClass([this.footer], FOOTER);
|
|
8643
8937
|
}
|
|
8644
|
-
// eslint-disable-next-line
|
|
8645
8938
|
var compiledString = this.templateComplier(this.footerTemplate);
|
|
8646
8939
|
var tempArr = compiledString({}, this, 'footerTemplate', this.footerTemplateId, this.isStringTemplate, undefined, this.footer);
|
|
8647
8940
|
if (tempArr) {
|
|
@@ -8700,7 +8993,7 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
8700
8993
|
this.ensurePlaceHolder();
|
|
8701
8994
|
};
|
|
8702
8995
|
DropDownTree.prototype.resetValue = function (isDynamicChange) {
|
|
8703
|
-
if (this.value
|
|
8996
|
+
if (this.value === [] && this.text == null) {
|
|
8704
8997
|
return;
|
|
8705
8998
|
}
|
|
8706
8999
|
Input.setValue(null, this.inputEle, this.floatLabelType);
|
|
@@ -8839,7 +9132,6 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
8839
9132
|
var template = actionFailure ? this.actionFailureTemplate : this.noRecordsTemplate;
|
|
8840
9133
|
var templateId = actionFailure ? this.actionFailureTemplateId : this.noRecordsTemplateId;
|
|
8841
9134
|
var templatestring = actionFailure ? 'actionFailureTemplate' : 'noRecordsTemplate';
|
|
8842
|
-
// eslint-disable-next-line
|
|
8843
9135
|
var compiledString = this.templateComplier(template);
|
|
8844
9136
|
var tempArr = compiledString({}, this, templatestring, templateId, this.isStringTemplate, undefined, this.noRecord);
|
|
8845
9137
|
if (tempArr) {
|
|
@@ -8848,7 +9140,6 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
8848
9140
|
}
|
|
8849
9141
|
}
|
|
8850
9142
|
else {
|
|
8851
|
-
// eslint-disable-next-line
|
|
8852
9143
|
var l10nLocale = { noRecordsTemplate: 'No Records Found', actionFailureTemplate: 'The Request Failed' };
|
|
8853
9144
|
this.l10n = new L10n(this.getLocaleName(), l10nLocale, this.locale);
|
|
8854
9145
|
this.noRecord.innerHTML = actionFailure ?
|
|
@@ -9080,10 +9371,10 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
9080
9371
|
this.updateTreeSettings(newProp);
|
|
9081
9372
|
break;
|
|
9082
9373
|
case 'customTemplate':
|
|
9083
|
-
if (this.mode !==
|
|
9374
|
+
if (this.mode !== 'Custom') {
|
|
9084
9375
|
return;
|
|
9085
9376
|
}
|
|
9086
|
-
this.chipCollection.innerHTML =
|
|
9377
|
+
this.chipCollection.innerHTML = '';
|
|
9087
9378
|
this.setTagValues();
|
|
9088
9379
|
break;
|
|
9089
9380
|
case 'sortOrder':
|
|
@@ -9233,6 +9524,16 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
9233
9524
|
this.filterObj = null;
|
|
9234
9525
|
}
|
|
9235
9526
|
};
|
|
9527
|
+
DropDownTree.prototype.destroyPopup = function () {
|
|
9528
|
+
this.isPopupOpen = false;
|
|
9529
|
+
if (this.isReact) {
|
|
9530
|
+
this.clearTemplate();
|
|
9531
|
+
}
|
|
9532
|
+
if (this.popupObj) {
|
|
9533
|
+
this.popupObj.destroy();
|
|
9534
|
+
detach(this.popupObj.element);
|
|
9535
|
+
}
|
|
9536
|
+
};
|
|
9236
9537
|
/**
|
|
9237
9538
|
* Ensures visibility of the Dropdown Tree item by using item value or item element.
|
|
9238
9539
|
* If many Dropdown Tree items are present, and we are in need to find a particular item, then the `ensureVisible` property
|
|
@@ -9250,7 +9551,6 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
9250
9551
|
* @param {string | Element} item - Specifies the value of Dropdown Tree item/ Dropdown Tree item element
|
|
9251
9552
|
* @returns {'{[key: string]: Object }[]'} - returns the updated data source of the Dropdown Tree.
|
|
9252
9553
|
*/
|
|
9253
|
-
// eslint-disable-next-line
|
|
9254
9554
|
DropDownTree.prototype.getData = function (item) {
|
|
9255
9555
|
return this.treeObj.getTreeData(item);
|
|
9256
9556
|
};
|
|
@@ -9275,6 +9575,10 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
9275
9575
|
}
|
|
9276
9576
|
}
|
|
9277
9577
|
this.trigger('close', eventArgs);
|
|
9578
|
+
if (this.destroyPopupOnHide) {
|
|
9579
|
+
this.isFirstRender = true;
|
|
9580
|
+
this.destroyPopup();
|
|
9581
|
+
}
|
|
9278
9582
|
}
|
|
9279
9583
|
};
|
|
9280
9584
|
/**
|
|
@@ -9324,7 +9628,7 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
9324
9628
|
Property('')
|
|
9325
9629
|
], DropDownTree.prototype, "cssClass", void 0);
|
|
9326
9630
|
__decorate$2([
|
|
9327
|
-
Property(
|
|
9631
|
+
Property('${value.length} item(s) selected')
|
|
9328
9632
|
], DropDownTree.prototype, "customTemplate", void 0);
|
|
9329
9633
|
__decorate$2([
|
|
9330
9634
|
Property(',')
|
|
@@ -9390,7 +9694,10 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
9390
9694
|
Property(false)
|
|
9391
9695
|
], DropDownTree.prototype, "showCheckBox", void 0);
|
|
9392
9696
|
__decorate$2([
|
|
9393
|
-
Property(
|
|
9697
|
+
Property(true)
|
|
9698
|
+
], DropDownTree.prototype, "destroyPopupOnHide", void 0);
|
|
9699
|
+
__decorate$2([
|
|
9700
|
+
Property(true)
|
|
9394
9701
|
], DropDownTree.prototype, "enableHtmlSanitizer", void 0);
|
|
9395
9702
|
__decorate$2([
|
|
9396
9703
|
Property(true)
|
|
@@ -9591,8 +9898,12 @@ var ComboBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
9591
9898
|
this.setHiddenValue();
|
|
9592
9899
|
};
|
|
9593
9900
|
ComboBox.prototype.valueMuteChange = function (value) {
|
|
9901
|
+
value = this.allowObjectBinding && !isNullOrUndefined(value) ? getValue((this.fields.value) ? this.fields.value : '', value) : value;
|
|
9594
9902
|
var inputValue = isNullOrUndefined(value) ? null : value.toString();
|
|
9595
9903
|
Input.setValue(inputValue, this.inputElement, this.floatLabelType, this.showClearButton);
|
|
9904
|
+
if (this.allowObjectBinding) {
|
|
9905
|
+
value = this.getDataByValue(value);
|
|
9906
|
+
}
|
|
9596
9907
|
this.setProperties({ value: value, text: value, index: null }, true);
|
|
9597
9908
|
this.activeIndex = this.index;
|
|
9598
9909
|
var fields = this.fields;
|
|
@@ -9601,35 +9912,39 @@ var ComboBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
9601
9912
|
dataItem[fields.value] = isNullOrUndefined(value) ? null : value.toString();
|
|
9602
9913
|
this.itemData = dataItem;
|
|
9603
9914
|
this.item = null;
|
|
9604
|
-
if (this.previousValue !== this.value) {
|
|
9915
|
+
if ((!this.allowObjectBinding && (this.previousValue !== this.value)) || (this.allowObjectBinding && this.previousValue && this.value && !this.isObjectInArray(this.previousValue, [this.value]))) {
|
|
9605
9916
|
this.detachChangeEvent(null);
|
|
9606
9917
|
}
|
|
9607
9918
|
};
|
|
9608
9919
|
ComboBox.prototype.updateValues = function () {
|
|
9609
9920
|
if (!isNullOrUndefined(this.value)) {
|
|
9610
|
-
var
|
|
9611
|
-
var
|
|
9921
|
+
var currentValue = this.allowObjectBinding && !isNullOrUndefined(this.value) ? getValue((this.fields.value) ? this.fields.value : '', this.value) : this.value;
|
|
9922
|
+
var li = this.getElementByValue(currentValue);
|
|
9923
|
+
var doesItemExist = !isNullOrUndefined(li) ? true : false;
|
|
9612
9924
|
if (this.enableVirtualization && this.value) {
|
|
9613
9925
|
var fields = (this.fields.value) ? this.fields.value : '';
|
|
9926
|
+
var currentValue_1 = this.allowObjectBinding && !isNullOrUndefined(this.value) ? getValue((this.fields.value) ? this.fields.value : '', this.value) : this.value;
|
|
9614
9927
|
if (this.dataSource instanceof DataManager && this.virtualGroupDataSource) {
|
|
9615
|
-
var getItem = new DataManager(this.virtualGroupDataSource).executeLocal(new Query().where(new Predicate(fields, 'equal',
|
|
9928
|
+
var getItem = new DataManager(this.virtualGroupDataSource).executeLocal(new Query().where(new Predicate(fields, 'equal', currentValue_1)));
|
|
9616
9929
|
if (getItem && getItem.length > 0) {
|
|
9617
9930
|
this.itemData = getItem[0];
|
|
9618
|
-
|
|
9931
|
+
doesItemExist = true;
|
|
9619
9932
|
var dataItem = this.getItemData();
|
|
9933
|
+
var value = this.allowObjectBinding ? this.getDataByValue(dataItem.value) : dataItem.value;
|
|
9620
9934
|
if ((this.value === dataItem.value && this.text !== dataItem.text) || (this.value !== dataItem.value && this.text === dataItem.text)) {
|
|
9621
|
-
this.setProperties({ 'text': dataItem.text, 'value':
|
|
9935
|
+
this.setProperties({ 'text': dataItem.text, 'value': value });
|
|
9622
9936
|
}
|
|
9623
9937
|
}
|
|
9624
9938
|
}
|
|
9625
9939
|
else {
|
|
9626
|
-
var getItem = new DataManager(this.dataSource).executeLocal(new Query().where(new Predicate(fields, 'equal',
|
|
9940
|
+
var getItem = new DataManager(this.dataSource).executeLocal(new Query().where(new Predicate(fields, 'equal', currentValue_1)));
|
|
9627
9941
|
if (getItem && getItem.length > 0) {
|
|
9628
9942
|
this.itemData = getItem[0];
|
|
9629
|
-
|
|
9943
|
+
doesItemExist = true;
|
|
9630
9944
|
var dataItem = this.getItemData();
|
|
9945
|
+
var value = this.allowObjectBinding ? this.getDataByValue(dataItem.value) : dataItem.value;
|
|
9631
9946
|
if ((this.value === dataItem.value && this.text !== dataItem.text) || (this.value !== dataItem.value && this.text === dataItem.text)) {
|
|
9632
|
-
this.setProperties({ 'text': dataItem.text, 'value':
|
|
9947
|
+
this.setProperties({ 'text': dataItem.text, 'value': value });
|
|
9633
9948
|
}
|
|
9634
9949
|
}
|
|
9635
9950
|
}
|
|
@@ -9637,10 +9952,10 @@ var ComboBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
9637
9952
|
if (li) {
|
|
9638
9953
|
this.setSelection(li, null);
|
|
9639
9954
|
}
|
|
9640
|
-
else if ((!this.enableVirtualization && this.allowCustom) || (this.allowCustom && this.enableVirtualization && !
|
|
9955
|
+
else if ((!this.enableVirtualization && this.allowCustom) || (this.allowCustom && this.enableVirtualization && !doesItemExist)) {
|
|
9641
9956
|
this.valueMuteChange(this.value);
|
|
9642
9957
|
}
|
|
9643
|
-
else if (!this.enableVirtualization || (this.enableVirtualization && !
|
|
9958
|
+
else if (!this.enableVirtualization || (this.enableVirtualization && !doesItemExist)) {
|
|
9644
9959
|
this.valueMuteChange(null);
|
|
9645
9960
|
}
|
|
9646
9961
|
}
|
|
@@ -9750,7 +10065,7 @@ var ComboBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
9750
10065
|
this.updateIncrementalView(0, this.itemCount);
|
|
9751
10066
|
}
|
|
9752
10067
|
activeItem = Search(inputValue, this.incrementalLiCollections, this.filterType, true, dataSource, this.fields, type);
|
|
9753
|
-
while (isNullOrUndefined(activeItem) && this.incrementalEndIndex < this.totalItemCount) {
|
|
10068
|
+
while (isNullOrUndefined(activeItem.item) && this.incrementalEndIndex < this.totalItemCount) {
|
|
9754
10069
|
this.incrementalStartIndex = this.incrementalEndIndex;
|
|
9755
10070
|
this.incrementalEndIndex = this.incrementalEndIndex + 100 > this.totalItemCount ? this.totalItemCount : this.incrementalEndIndex + 100;
|
|
9756
10071
|
this.updateIncrementalInfo(this.incrementalStartIndex, this.incrementalEndIndex);
|
|
@@ -9760,6 +10075,7 @@ var ComboBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
9760
10075
|
}
|
|
9761
10076
|
activeItem = Search(inputValue, this.incrementalLiCollections, this.filterType, true, dataSource, this.fields, type);
|
|
9762
10077
|
if (!isNullOrUndefined(activeItem)) {
|
|
10078
|
+
activeItem.index = activeItem.index + this.incrementalStartIndex;
|
|
9763
10079
|
break;
|
|
9764
10080
|
}
|
|
9765
10081
|
if (isNullOrUndefined(activeItem) && this.incrementalEndIndex >= this.totalItemCount) {
|
|
@@ -9845,10 +10161,12 @@ var ComboBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
9845
10161
|
}
|
|
9846
10162
|
};
|
|
9847
10163
|
ComboBox.prototype.checkCustomValue = function () {
|
|
9848
|
-
this.
|
|
10164
|
+
var value = this.allowObjectBinding && !isNullOrUndefined(this.value) ? getValue((this.fields.value) ? this.fields.value : '', this.value) : this.value;
|
|
10165
|
+
this.itemData = this.getDataByValue(value);
|
|
9849
10166
|
var dataItem = this.getItemData();
|
|
10167
|
+
var setValue$$1 = this.allowObjectBinding ? this.itemData : dataItem.value;
|
|
9850
10168
|
if (!(this.allowCustom && isNullOrUndefined(dataItem.value) && isNullOrUndefined(dataItem.text))) {
|
|
9851
|
-
this.setProperties({ 'value':
|
|
10169
|
+
this.setProperties({ 'value': setValue$$1 }, !this.allowCustom);
|
|
9852
10170
|
}
|
|
9853
10171
|
};
|
|
9854
10172
|
/**
|
|
@@ -9898,10 +10216,10 @@ var ComboBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
9898
10216
|
var currentValue = this.getTextByValue(activeElement.getAttribute('data-value')).toString();
|
|
9899
10217
|
var currentFillValue = this.getFormattedValue(activeElement.getAttribute('data-value'));
|
|
9900
10218
|
if (this.getModuleName() === 'combobox') {
|
|
9901
|
-
if (!this.isSelected && this.previousValue !== currentFillValue) {
|
|
10219
|
+
if (!this.isSelected && ((!this.allowObjectBinding && this.previousValue !== currentFillValue)) || (this.allowObjectBinding && this.previousValue && currentFillValue && !this.isObjectInArray(this.previousValue, [this.getDataByValue(currentFillValue)]))) {
|
|
9902
10220
|
this.updateSelectedItem(activeElement, null);
|
|
9903
10221
|
this.isSelected = true;
|
|
9904
|
-
this.previousValue = this.getFormattedValue(activeElement.getAttribute('data-value'));
|
|
10222
|
+
this.previousValue = this.allowObjectBinding ? this.getDataByValue(this.getFormattedValue(activeElement.getAttribute('data-value'))) : this.getFormattedValue(activeElement.getAttribute('data-value'));
|
|
9905
10223
|
}
|
|
9906
10224
|
else {
|
|
9907
10225
|
this.updateSelectedItem(activeElement, null, true);
|
|
@@ -10076,11 +10394,13 @@ var ComboBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
10076
10394
|
if (!this.allowCustom && this.inputElement.value !== '') {
|
|
10077
10395
|
var previousValue = this.previousValue;
|
|
10078
10396
|
var currentValue = this.value;
|
|
10397
|
+
value = this.allowObjectBinding ? this.getDataByValue(value) : value;
|
|
10079
10398
|
this.setProperties({ value: value });
|
|
10080
10399
|
if (isNullOrUndefined(this.value)) {
|
|
10081
10400
|
Input.setValue('', this.inputElement, this.floatLabelType, this.showClearButton);
|
|
10082
10401
|
}
|
|
10083
|
-
|
|
10402
|
+
var newValue = this.allowObjectBinding && !isNullOrUndefined(this.value) ? getValue((this.fields.value) ? this.fields.value : '', this.value) : this.value;
|
|
10403
|
+
if (this.autofill && ((!this.allowObjectBinding && previousValue === this.value) || (this.allowObjectBinding && previousValue && this.isObjectInArray(previousValue, [this.value]))) && ((!this.allowObjectBinding && currentValue !== this.value) || (this.allowObjectBinding && currentValue && !this.isObjectInArray(currentValue, [this.value])))) {
|
|
10084
10404
|
this.onChangeEvent(null);
|
|
10085
10405
|
}
|
|
10086
10406
|
}
|
|
@@ -10090,6 +10410,7 @@ var ComboBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
10090
10410
|
var value_1 = this.inputElement.value === '' ? null : this.inputElement.value;
|
|
10091
10411
|
// eslint-disable-next-line max-len
|
|
10092
10412
|
var eventArgs = { text: value_1, item: {} };
|
|
10413
|
+
this.isObjectCustomValue = true;
|
|
10093
10414
|
if (!this.initial) {
|
|
10094
10415
|
this.trigger('customValueSpecifier', eventArgs, function (eventArgs) {
|
|
10095
10416
|
_this.updateCustomValueCallback(value_1, eventArgs, previousValue_1, e);
|
|
@@ -10101,8 +10422,9 @@ var ComboBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
10101
10422
|
}
|
|
10102
10423
|
else {
|
|
10103
10424
|
this.isSelectCustom = false;
|
|
10425
|
+
value = this.allowObjectBinding ? this.getDataByValue(value) : value;
|
|
10104
10426
|
this.setProperties({ value: value });
|
|
10105
|
-
if (previousValue_1 !== this.value) {
|
|
10427
|
+
if ((!this.allowObjectBinding && previousValue_1 !== this.value) || (this.allowObjectBinding && previousValue_1 && this.value && !this.isObjectInArray(previousValue_1, [this.value]))) {
|
|
10106
10428
|
this.onChangeEvent(e);
|
|
10107
10429
|
}
|
|
10108
10430
|
}
|
|
@@ -10112,6 +10434,7 @@ var ComboBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
10112
10434
|
}
|
|
10113
10435
|
};
|
|
10114
10436
|
ComboBox.prototype.updateCustomValueCallback = function (value, eventArgs, previousValue, e) {
|
|
10437
|
+
var _this = this;
|
|
10115
10438
|
var fields = this.fields;
|
|
10116
10439
|
var item = eventArgs.item;
|
|
10117
10440
|
var dataItem = {};
|
|
@@ -10123,16 +10446,28 @@ var ComboBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
10123
10446
|
setValue(fields.value, value, dataItem);
|
|
10124
10447
|
}
|
|
10125
10448
|
this.itemData = dataItem;
|
|
10449
|
+
var emptyObject = {};
|
|
10450
|
+
if (this.allowObjectBinding) {
|
|
10451
|
+
var keys = this.listData && this.listData.length > 0 ? Object.keys(this.listData[0]) : Object.keys(this.itemData);
|
|
10452
|
+
if ((!(this.listData && this.listData.length > 0)) && (this.getModuleName() === 'autocomplete' || (this.getModuleName() === 'combobox' && this.allowFiltering))) {
|
|
10453
|
+
keys = this.firstItem ? Object.keys(this.firstItem) : Object.keys(this.itemData);
|
|
10454
|
+
}
|
|
10455
|
+
// Create an empty object with predefined keys
|
|
10456
|
+
keys.forEach(function (key) {
|
|
10457
|
+
emptyObject[key] = ((key === fields.value) || (key === fields.text)) ? getValue(fields.value, _this.itemData) : null;
|
|
10458
|
+
});
|
|
10459
|
+
}
|
|
10126
10460
|
var changeData = {
|
|
10127
10461
|
text: getValue(fields.text, this.itemData),
|
|
10128
|
-
value: getValue(fields.value, this.itemData),
|
|
10462
|
+
value: this.allowObjectBinding ? emptyObject : getValue(fields.value, this.itemData),
|
|
10129
10463
|
index: null
|
|
10130
10464
|
};
|
|
10131
10465
|
this.setProperties(changeData, true);
|
|
10132
10466
|
this.setSelection(null, null);
|
|
10133
10467
|
this.isSelectCustom = true;
|
|
10134
|
-
|
|
10135
|
-
|
|
10468
|
+
this.isObjectCustomValue = false;
|
|
10469
|
+
if ((!this.allowObjectBinding && (previousValue !== this.value)) || (this.allowObjectBinding && ((previousValue == null && this.value !== null) || (previousValue && !this.isObjectInArray(previousValue, [this.value]))))) {
|
|
10470
|
+
this.onChangeEvent(e, true);
|
|
10136
10471
|
}
|
|
10137
10472
|
};
|
|
10138
10473
|
/**
|
|
@@ -10146,7 +10481,7 @@ var ComboBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
10146
10481
|
ComboBox.prototype.onPropertyChanged = function (newProp, oldProp) {
|
|
10147
10482
|
if (this.getModuleName() === 'combobox') {
|
|
10148
10483
|
this.checkData(newProp);
|
|
10149
|
-
this.setUpdateInitial(['fields', 'query', 'dataSource'], newProp);
|
|
10484
|
+
this.setUpdateInitial(['fields', 'query', 'dataSource'], newProp, oldProp);
|
|
10150
10485
|
}
|
|
10151
10486
|
for (var _i = 0, _a = Object.keys(newProp); _i < _a.length; _i++) {
|
|
10152
10487
|
var prop = _a[_i];
|
|
@@ -10295,7 +10630,8 @@ var ComboBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
10295
10630
|
this.customValue(e);
|
|
10296
10631
|
}
|
|
10297
10632
|
}
|
|
10298
|
-
|
|
10633
|
+
var value = this.allowObjectBinding && !isNullOrUndefined(this.value) ? getValue((this.fields.value) ? this.fields.value : '', this.value) : this.value;
|
|
10634
|
+
if (isNullOrUndefined(this.listData) && this.allowCustom && !isNullOrUndefined(inputValue) && inputValue !== value) {
|
|
10299
10635
|
this.customValue();
|
|
10300
10636
|
}
|
|
10301
10637
|
_super.prototype.hidePopup.call(this, e);
|
|
@@ -10427,6 +10763,9 @@ var ComboBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
10427
10763
|
__decorate$3([
|
|
10428
10764
|
Property(null)
|
|
10429
10765
|
], ComboBox.prototype, "value", void 0);
|
|
10766
|
+
__decorate$3([
|
|
10767
|
+
Property(false)
|
|
10768
|
+
], ComboBox.prototype, "allowObjectBinding", void 0);
|
|
10430
10769
|
ComboBox = __decorate$3([
|
|
10431
10770
|
NotifyPropertyChanges
|
|
10432
10771
|
], ComboBox);
|
|
@@ -10503,8 +10842,9 @@ var AutoComplete = /** @__PURE__ @class */ (function (_super) {
|
|
|
10503
10842
|
};
|
|
10504
10843
|
AutoComplete.prototype.getQuery = function (query) {
|
|
10505
10844
|
var filterQuery = query ? query.clone() : this.query ? this.query.clone() : new Query();
|
|
10506
|
-
var
|
|
10507
|
-
var
|
|
10845
|
+
var value = this.allowObjectBinding && !isNullOrUndefined(this.value) ? getValue((this.fields.value) ? this.fields.value : '', this.value) : this.value;
|
|
10846
|
+
var filterType = (this.queryString === '' && !isNullOrUndefined(value)) ? 'equal' : this.filterType;
|
|
10847
|
+
var queryString = (this.queryString === '' && !isNullOrUndefined(value)) ? value : this.queryString;
|
|
10508
10848
|
if (this.isFiltered) {
|
|
10509
10849
|
return filterQuery;
|
|
10510
10850
|
}
|
|
@@ -10530,9 +10870,48 @@ var AutoComplete = /** @__PURE__ @class */ (function (_super) {
|
|
|
10530
10870
|
filterQuery.take(this.suggestionCount);
|
|
10531
10871
|
}
|
|
10532
10872
|
if (this.enableVirtualization && (!(this.dataSource instanceof DataManager) || (this.dataSource instanceof DataManager && this.virtualGroupDataSource))) {
|
|
10873
|
+
var queryTakeValue = 0;
|
|
10874
|
+
var querySkipValue = 0;
|
|
10875
|
+
if (this.query && this.query.queries.length > 0) {
|
|
10876
|
+
for (var queryElements = 0; queryElements < this.query.queries.length; queryElements++) {
|
|
10877
|
+
if (this.query.queries[queryElements].fn === 'onSkip') {
|
|
10878
|
+
querySkipValue = this.query.queries[queryElements].e.nos;
|
|
10879
|
+
}
|
|
10880
|
+
if (this.query.queries[queryElements].fn === 'onTake') {
|
|
10881
|
+
queryTakeValue = takeValue <= this.query.queries[queryElements].e.nos ? this.query.queries[queryElements].e.nos : takeValue;
|
|
10882
|
+
}
|
|
10883
|
+
}
|
|
10884
|
+
}
|
|
10885
|
+
var skipExists = false;
|
|
10886
|
+
var takeExists = false;
|
|
10887
|
+
if (filterQuery && filterQuery.queries.length > 0) {
|
|
10888
|
+
for (var queryElements = 0; queryElements < filterQuery.queries.length; queryElements++) {
|
|
10889
|
+
if (filterQuery.queries[queryElements].fn === 'onSkip') {
|
|
10890
|
+
skipExists = true;
|
|
10891
|
+
}
|
|
10892
|
+
if (filterQuery.queries[queryElements].fn === 'onTake') {
|
|
10893
|
+
takeExists = true;
|
|
10894
|
+
filterQuery.queries[queryElements].e.nos = filterQuery.queries[queryElements].e.nos <= queryTakeValue ? queryTakeValue : filterQuery.queries[queryElements].e.nos;
|
|
10895
|
+
}
|
|
10896
|
+
}
|
|
10897
|
+
}
|
|
10533
10898
|
var takeValue = this.getTakeValue();
|
|
10534
|
-
|
|
10535
|
-
|
|
10899
|
+
if (!skipExists) {
|
|
10900
|
+
if (querySkipValue > 0 && this.virtualItemStartIndex <= querySkipValue) {
|
|
10901
|
+
filterQuery.skip(querySkipValue);
|
|
10902
|
+
}
|
|
10903
|
+
else {
|
|
10904
|
+
filterQuery.skip(this.virtualItemStartIndex);
|
|
10905
|
+
}
|
|
10906
|
+
}
|
|
10907
|
+
if (!takeExists) {
|
|
10908
|
+
if (queryTakeValue > 0 && takeValue <= queryTakeValue) {
|
|
10909
|
+
filterQuery.take(queryTakeValue);
|
|
10910
|
+
}
|
|
10911
|
+
else {
|
|
10912
|
+
filterQuery.take(takeValue);
|
|
10913
|
+
}
|
|
10914
|
+
}
|
|
10536
10915
|
filterQuery.requiresCount();
|
|
10537
10916
|
}
|
|
10538
10917
|
return filterQuery;
|
|
@@ -10541,6 +10920,7 @@ var AutoComplete = /** @__PURE__ @class */ (function (_super) {
|
|
|
10541
10920
|
var _this_1 = this;
|
|
10542
10921
|
this.isTyped = true;
|
|
10543
10922
|
this.isDataFetched = this.isSelectCustom = false;
|
|
10923
|
+
this.firstItem = this.dataSource && this.dataSource.length > 0 ? this.dataSource[0] : null;
|
|
10544
10924
|
this.checkAndResetCache();
|
|
10545
10925
|
if (isNullOrUndefined(this.list)) {
|
|
10546
10926
|
_super.prototype.renderList.call(this, e, true);
|
|
@@ -10734,6 +11114,10 @@ var AutoComplete = /** @__PURE__ @class */ (function (_super) {
|
|
|
10734
11114
|
AutoComplete.prototype.setInputValue = function (newProp, oldProp) {
|
|
10735
11115
|
var oldValue = oldProp && oldProp.text ? oldProp.text : oldProp ? oldProp.value : oldProp;
|
|
10736
11116
|
var value = newProp && newProp.text ? newProp.text : newProp && newProp.value ? newProp.value : this.value;
|
|
11117
|
+
if (this.allowObjectBinding) {
|
|
11118
|
+
oldValue = !isNullOrUndefined(oldValue) ? getValue((this.fields.value) ? this.fields.value : '', oldValue) : oldValue;
|
|
11119
|
+
value = !isNullOrUndefined(value) ? getValue((this.fields.value) ? this.fields.value : '', value) : value;
|
|
11120
|
+
}
|
|
10737
11121
|
if (value && this.typedString === '' && !this.allowCustom && !(this.dataSource instanceof DataManager)) {
|
|
10738
11122
|
var checkFields_1_1 = this.typeOfData(this.dataSource).typeof === 'string' ? '' : this.fields.value;
|
|
10739
11123
|
var listLength_1 = this.getItems().length;
|
|
@@ -10742,7 +11126,7 @@ var AutoComplete = /** @__PURE__ @class */ (function (_super) {
|
|
|
10742
11126
|
new DataManager(this.dataSource).executeQuery(query.where(new Predicate(checkFields_1_1, 'equal', value)))
|
|
10743
11127
|
.then(function (e) {
|
|
10744
11128
|
if (e.result.length > 0) {
|
|
10745
|
-
_this_2.value = checkFields_1_1 !== '' ? e.result[0][_this_2.fields.value].toString() : e.result[0].toString();
|
|
11129
|
+
_this_2.value = checkFields_1_1 !== '' ? _this_2.allowObjectBinding ? e.result[0] : e.result[0][_this_2.fields.value].toString() : e.result[0].toString();
|
|
10746
11130
|
_this_2.addItem(e.result, listLength_1);
|
|
10747
11131
|
_this_2.updateValues();
|
|
10748
11132
|
}
|
|
@@ -11166,8 +11550,12 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
11166
11550
|
_this.selectAllEventEle = [];
|
|
11167
11551
|
_this.resetMainList = null;
|
|
11168
11552
|
_this.resetFilteredData = false;
|
|
11553
|
+
_this.preventSetCurrentData = false;
|
|
11169
11554
|
_this.scrollFocusStatus = false;
|
|
11170
11555
|
_this.keyDownStatus = false;
|
|
11556
|
+
_this.IsScrollerAtEnd = function () {
|
|
11557
|
+
return this.list && this.list.scrollTop + this.list.clientHeight >= this.list.scrollHeight;
|
|
11558
|
+
};
|
|
11171
11559
|
return _this;
|
|
11172
11560
|
}
|
|
11173
11561
|
MultiSelect.prototype.enableRTL = function (state) {
|
|
@@ -11184,6 +11572,9 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
11184
11572
|
};
|
|
11185
11573
|
MultiSelect.prototype.requiredModules = function () {
|
|
11186
11574
|
var modules = [];
|
|
11575
|
+
if (this.enableVirtualization) {
|
|
11576
|
+
modules.push({ args: [this], member: 'VirtualScroll' });
|
|
11577
|
+
}
|
|
11187
11578
|
if (this.mode === 'CheckBox') {
|
|
11188
11579
|
this.isGroupChecking = this.enableGroupCheckBox;
|
|
11189
11580
|
if (this.enableGroupCheckBox) {
|
|
@@ -11324,6 +11715,9 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
11324
11715
|
attributes(_this.inputElement, { 'aria-expanded': 'true', 'aria-owns': _this.element.id + '_popup', 'aria-controls': _this.element.id });
|
|
11325
11716
|
_this.updateAriaActiveDescendant();
|
|
11326
11717
|
if (_this.isFirstClick) {
|
|
11718
|
+
if (_this.enableVirtualization && _this.mode === 'CheckBox' && _this.value) {
|
|
11719
|
+
_this.updateVirtualReOrderList();
|
|
11720
|
+
}
|
|
11327
11721
|
_this.loadTemplate();
|
|
11328
11722
|
}
|
|
11329
11723
|
if (_this.mode === 'CheckBox' && _this.showSelectAll) {
|
|
@@ -11332,6 +11726,33 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
11332
11726
|
}
|
|
11333
11727
|
});
|
|
11334
11728
|
};
|
|
11729
|
+
MultiSelect.prototype.updateVirtualReOrderList = function (isCheckBoxUpdate) {
|
|
11730
|
+
var query = this.getForQuery(this.value, true).clone();
|
|
11731
|
+
this.resetList(this.dataSource, this.fields, query);
|
|
11732
|
+
this.UpdateSkeleton();
|
|
11733
|
+
this.liCollections = this.list.querySelectorAll('.' + dropDownBaseClasses.li);
|
|
11734
|
+
this.virtualItemCount = this.itemCount;
|
|
11735
|
+
if (this.mode !== 'CheckBox') {
|
|
11736
|
+
this.totalItemCount = this.value && this.value.length ? this.totalItemCount - this.value.length : this.totalItemCount;
|
|
11737
|
+
}
|
|
11738
|
+
if (!this.list.querySelector('.e-virtual-ddl')) {
|
|
11739
|
+
var virualElement = this.createElement('div', {
|
|
11740
|
+
id: this.element.id + '_popup', className: 'e-virtual-ddl', styles: this.GetVirtualTrackHeight()
|
|
11741
|
+
});
|
|
11742
|
+
this.popupWrapper.querySelector('.e-dropdownbase').appendChild(virualElement);
|
|
11743
|
+
}
|
|
11744
|
+
else {
|
|
11745
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
11746
|
+
this.list.getElementsByClassName('e-virtual-ddl')[0].style = this.GetVirtualTrackHeight();
|
|
11747
|
+
}
|
|
11748
|
+
if (this.list.querySelector('.e-virtual-ddl-content')) {
|
|
11749
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
11750
|
+
this.list.getElementsByClassName('e-virtual-ddl-content')[0].style = this.getTransformValues();
|
|
11751
|
+
}
|
|
11752
|
+
if (isCheckBoxUpdate) {
|
|
11753
|
+
this.loadTemplate();
|
|
11754
|
+
}
|
|
11755
|
+
};
|
|
11335
11756
|
MultiSelect.prototype.updateListItems = function (listItems, mainListItems) {
|
|
11336
11757
|
for (var i = 0; i < listItems.length; i++) {
|
|
11337
11758
|
this.findGroupStart(listItems[i]);
|
|
@@ -11341,19 +11762,33 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
11341
11762
|
};
|
|
11342
11763
|
MultiSelect.prototype.loadTemplate = function () {
|
|
11343
11764
|
this.refreshListItems(null);
|
|
11765
|
+
if (this.enableVirtualization && this.list && this.mode === 'CheckBox') {
|
|
11766
|
+
var reOrderList = this.list.querySelectorAll('.e-reorder')[0];
|
|
11767
|
+
if (this.list.querySelector('.e-virtual-ddl-content') && reOrderList) {
|
|
11768
|
+
this.list.querySelector('.e-virtual-ddl-content').removeChild(reOrderList);
|
|
11769
|
+
}
|
|
11770
|
+
}
|
|
11344
11771
|
if (this.mode === 'CheckBox') {
|
|
11345
11772
|
this.removeFocus();
|
|
11346
11773
|
}
|
|
11347
11774
|
this.notify('reOrder', { module: 'CheckBoxSelection', enable: this.mode === 'CheckBox', e: this });
|
|
11775
|
+
this.isPreventScrollAction = true;
|
|
11348
11776
|
};
|
|
11349
11777
|
MultiSelect.prototype.setScrollPosition = function () {
|
|
11350
11778
|
if (((!this.hideSelectedItem && this.mode !== 'CheckBox') || (this.mode === 'CheckBox' && !this.enableSelectionOrder)) &&
|
|
11351
11779
|
(!isNullOrUndefined(this.value) && (this.value.length > 0))) {
|
|
11352
|
-
var
|
|
11780
|
+
var value = this.allowObjectBinding ? getValue((this.fields.value) ? this.fields.value : '', this.value[this.value.length - 1]) : this.value[this.value.length - 1];
|
|
11781
|
+
var valueEle = this.findListElement((this.hideSelectedItem ? this.ulElement : this.list), 'li', 'data-value', value);
|
|
11353
11782
|
if (!isNullOrUndefined(valueEle)) {
|
|
11354
11783
|
this.scrollBottom(valueEle);
|
|
11355
11784
|
}
|
|
11356
11785
|
}
|
|
11786
|
+
if (this.enableVirtualization) {
|
|
11787
|
+
var focusedItem = this.list.querySelector('.' + dropDownBaseClasses.focus);
|
|
11788
|
+
if (focusedItem) {
|
|
11789
|
+
this.scrollBottom(focusedItem);
|
|
11790
|
+
}
|
|
11791
|
+
}
|
|
11357
11792
|
};
|
|
11358
11793
|
MultiSelect.prototype.focusAtFirstListItem = function () {
|
|
11359
11794
|
if (this.ulElement && this.ulElement.querySelector('li.'
|
|
@@ -11364,9 +11799,15 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
11364
11799
|
return;
|
|
11365
11800
|
}
|
|
11366
11801
|
else {
|
|
11367
|
-
|
|
11368
|
-
|
|
11369
|
-
|
|
11802
|
+
if (this.enableVirtualization) {
|
|
11803
|
+
element = this.ulElement.querySelector('li.'
|
|
11804
|
+
+ dropDownBaseClasses.li + ':not(.e-virtual-list)' + ':not(.e-hide-listitem)');
|
|
11805
|
+
}
|
|
11806
|
+
else {
|
|
11807
|
+
element = this.ulElement.querySelector('li.'
|
|
11808
|
+
+ dropDownBaseClasses.li + ':not(.'
|
|
11809
|
+
+ HIDE_LIST + ')');
|
|
11810
|
+
}
|
|
11370
11811
|
}
|
|
11371
11812
|
if (element !== null) {
|
|
11372
11813
|
this.removeFocus();
|
|
@@ -11381,7 +11822,8 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
11381
11822
|
}
|
|
11382
11823
|
else {
|
|
11383
11824
|
if (this.value && this.value.length) {
|
|
11384
|
-
|
|
11825
|
+
var value = this.allowObjectBinding ? getValue(((this.fields.value) ? this.fields.value : ''), this.value[this.value.length - 1]) : this.value[this.value.length - 1];
|
|
11826
|
+
Search(value, this.liCollections, 'StartsWith', this.ignoreCase);
|
|
11385
11827
|
}
|
|
11386
11828
|
else {
|
|
11387
11829
|
activeElement = null;
|
|
@@ -11389,7 +11831,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
11389
11831
|
}
|
|
11390
11832
|
if (activeElement && activeElement.item !== null) {
|
|
11391
11833
|
this.addListFocus(activeElement.item);
|
|
11392
|
-
if (((this.allowCustomValue || this.allowFiltering) && this.isPopupOpen() && this.closePopupOnSelect) || this.closePopupOnSelect) {
|
|
11834
|
+
if (((this.allowCustomValue || this.allowFiltering) && this.isPopupOpen() && this.closePopupOnSelect && !this.enableVirtualization) || this.closePopupOnSelect && !this.enableVirtualization) {
|
|
11393
11835
|
this.scrollBottom(activeElement.item, activeElement.index);
|
|
11394
11836
|
}
|
|
11395
11837
|
}
|
|
@@ -11431,9 +11873,9 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
11431
11873
|
var elements = this.chipCollectionWrapper.querySelectorAll('span.' + CHIP$1);
|
|
11432
11874
|
var value = elements[elements.length - 1].getAttribute('data-value');
|
|
11433
11875
|
if (!isNullOrUndefined(this.value)) {
|
|
11434
|
-
this.tempValues = this.value.slice();
|
|
11876
|
+
this.tempValues = this.allowObjectBinding ? this.value.slice() : this.value.slice();
|
|
11435
11877
|
}
|
|
11436
|
-
var customValue = this.getFormattedValue(value);
|
|
11878
|
+
var customValue = this.allowObjectBinding ? this.getDataByValue(value) : this.getFormattedValue(value);
|
|
11437
11879
|
if (this.allowCustomValue && (value !== 'false' && customValue === false || (!isNullOrUndefined(customValue) &&
|
|
11438
11880
|
customValue.toString() === 'NaN'))) {
|
|
11439
11881
|
customValue = value;
|
|
@@ -11459,15 +11901,43 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
11459
11901
|
}
|
|
11460
11902
|
return this.targetInputElement.value;
|
|
11461
11903
|
};
|
|
11462
|
-
MultiSelect.prototype.getForQuery = function (valuecheck) {
|
|
11904
|
+
MultiSelect.prototype.getForQuery = function (valuecheck, isCheckbox) {
|
|
11463
11905
|
var predicate;
|
|
11464
11906
|
var field = isNullOrUndefined(this.fields.value) ? this.fields.text : this.fields.value;
|
|
11465
|
-
|
|
11466
|
-
if (
|
|
11467
|
-
|
|
11907
|
+
if (this.enableVirtualization) {
|
|
11908
|
+
if (isCheckbox) {
|
|
11909
|
+
for (var i = 0; i < valuecheck.length; i++) {
|
|
11910
|
+
var value = this.allowObjectBinding ? getValue((this.fields.value) ? this.fields.value : '', valuecheck[i]) : valuecheck[i];
|
|
11911
|
+
if (i === 0) {
|
|
11912
|
+
predicate = new Predicate(field, 'equal', value);
|
|
11913
|
+
}
|
|
11914
|
+
else {
|
|
11915
|
+
predicate = predicate.or(field, 'equal', value);
|
|
11916
|
+
}
|
|
11917
|
+
}
|
|
11918
|
+
return new Query().where(predicate);
|
|
11468
11919
|
}
|
|
11469
11920
|
else {
|
|
11470
|
-
|
|
11921
|
+
for (var i = 0; i < valuecheck.length; i++) {
|
|
11922
|
+
var value = this.allowObjectBinding ? getValue((this.fields.value) ? this.fields.value : '', valuecheck[i]) : valuecheck[i];
|
|
11923
|
+
if (i === 0) {
|
|
11924
|
+
predicate = new Predicate(field, 'notequal', value);
|
|
11925
|
+
}
|
|
11926
|
+
else {
|
|
11927
|
+
predicate = predicate.and(field, 'notequal', value);
|
|
11928
|
+
}
|
|
11929
|
+
}
|
|
11930
|
+
return new Query().where(predicate);
|
|
11931
|
+
}
|
|
11932
|
+
}
|
|
11933
|
+
else {
|
|
11934
|
+
for (var i = 0; i < valuecheck.length; i++) {
|
|
11935
|
+
if (i === 0) {
|
|
11936
|
+
predicate = new Predicate(field, 'equal', valuecheck[i]);
|
|
11937
|
+
}
|
|
11938
|
+
else {
|
|
11939
|
+
predicate = predicate.or(field, 'equal', valuecheck[i]);
|
|
11940
|
+
}
|
|
11471
11941
|
}
|
|
11472
11942
|
}
|
|
11473
11943
|
if (this.dataSource instanceof DataManager && this.dataSource.adaptor instanceof JsonAdaptor) {
|
|
@@ -11479,14 +11949,20 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
11479
11949
|
};
|
|
11480
11950
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
11481
11951
|
MultiSelect.prototype.onActionComplete = function (ulElement, list, e, isUpdated) {
|
|
11952
|
+
if (this.dataSource instanceof DataManager && !isNullOrUndefined(e) && !this.virtualGroupDataSource) {
|
|
11953
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
11954
|
+
this.totalItemCount = e.count;
|
|
11955
|
+
}
|
|
11482
11956
|
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
11483
11957
|
_super.prototype.onActionComplete.call(this, ulElement, list, e);
|
|
11958
|
+
this.skeletonCount = this.totalItemCount != 0 && this.totalItemCount < (this.itemCount * 2) ? 0 : this.skeletonCount;
|
|
11484
11959
|
this.updateSelectElementData(this.allowFiltering);
|
|
11485
11960
|
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
11486
11961
|
var proxy = this;
|
|
11487
|
-
if (!isNullOrUndefined(this.value) && !this.allowCustomValue) {
|
|
11962
|
+
if (!isNullOrUndefined(this.value) && !this.allowCustomValue && !this.enableVirtualization) {
|
|
11488
11963
|
for (var i = 0; i < this.value.length; i++) {
|
|
11489
|
-
var
|
|
11964
|
+
var value = this.allowObjectBinding ? getValue((this.fields.value) ? this.fields.value : '', proxy.value[i]) : proxy.value[i];
|
|
11965
|
+
var checkEle = this.findListElement(((this.allowFiltering && !isNullOrUndefined(this.mainList)) ? this.mainList : ulElement), 'li', 'data-value', value);
|
|
11490
11966
|
if (!checkEle && !(this.dataSource instanceof DataManager)) {
|
|
11491
11967
|
this.value.splice(i, 1);
|
|
11492
11968
|
i -= 1;
|
|
@@ -11574,7 +12050,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
11574
12050
|
dropDownBaseClasses.selected;
|
|
11575
12051
|
if (!isNullOrUndefined(this.value)) {
|
|
11576
12052
|
for (var index = 0; !isNullOrUndefined(this.value[index]); index++) {
|
|
11577
|
-
value = this.value[index];
|
|
12053
|
+
value = this.allowObjectBinding ? getValue((this.fields.value) ? this.fields.value : '', this.value[index]) : this.value[index];
|
|
11578
12054
|
element = this.findListElement(this.list, 'li', 'data-value', value);
|
|
11579
12055
|
if (element) {
|
|
11580
12056
|
addClass([element], className);
|
|
@@ -11673,13 +12149,13 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
11673
12149
|
MultiSelect.prototype.checkSelectAll = function () {
|
|
11674
12150
|
var groupItemLength = this.list.querySelectorAll('li.e-list-group-item.e-active').length;
|
|
11675
12151
|
var listItem = this.list.querySelectorAll('li.e-list-item');
|
|
11676
|
-
var searchCount = this.list.querySelectorAll('li.' + dropDownBaseClasses.li).length;
|
|
12152
|
+
var searchCount = this.enableVirtualization ? this.list.querySelectorAll('li.' + dropDownBaseClasses.li + ':not(.e-virtual-list)').length : this.list.querySelectorAll('li.' + dropDownBaseClasses.li).length;
|
|
11677
12153
|
var searchActiveCount = this.list.querySelectorAll('li.' + dropDownBaseClasses.selected).length;
|
|
11678
12154
|
if (this.enableGroupCheckBox && !isNullOrUndefined(this.fields.groupBy)) {
|
|
11679
12155
|
searchActiveCount = searchActiveCount - groupItemLength;
|
|
11680
12156
|
}
|
|
11681
|
-
if ((searchCount === searchActiveCount || searchActiveCount === this.maximumSelectionLength)
|
|
11682
|
-
&& (this.mode === 'CheckBox' && this.showSelectAll)) {
|
|
12157
|
+
if ((!this.enableVirtualization && ((searchCount === searchActiveCount || searchActiveCount === this.maximumSelectionLength)
|
|
12158
|
+
&& (this.mode === 'CheckBox' && this.showSelectAll))) || (this.enableVirtualization && this.mode === 'CheckBox' && this.showSelectAll && this.virtualSelectAll && this.value && this.value.length === this.totalItemCount)) {
|
|
11683
12159
|
this.notify('checkSelectAll', { module: 'CheckBoxSelection', enable: this.mode === 'CheckBox', value: 'check' });
|
|
11684
12160
|
}
|
|
11685
12161
|
else if ((searchCount !== searchActiveCount) && (this.mode === 'CheckBox' && this.showSelectAll)) {
|
|
@@ -11716,7 +12192,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
11716
12192
|
}
|
|
11717
12193
|
this.isValidKey = (this.isPopupOpen() && e.keyCode === 8) || this.isValidKey;
|
|
11718
12194
|
this.isValidKey = e.ctrlKey && e.keyCode === 86 ? false : this.isValidKey;
|
|
11719
|
-
if (this.isValidKey) {
|
|
12195
|
+
if (this.isValidKey && this.inputElement) {
|
|
11720
12196
|
this.isValidKey = false;
|
|
11721
12197
|
this.expandTextbox();
|
|
11722
12198
|
this.showOverAllClear();
|
|
@@ -11746,7 +12222,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
11746
12222
|
return filterQuery;
|
|
11747
12223
|
}
|
|
11748
12224
|
if (this.filterAction) {
|
|
11749
|
-
if (this.targetElement() !== null) {
|
|
12225
|
+
if ((this.targetElement() !== null && !this.enableVirtualization) || (this.enableVirtualization && this.targetElement() !== null && this.targetElement().trim() !== '')) {
|
|
11750
12226
|
var dataType = this.typeOfData(this.dataSource).typeof;
|
|
11751
12227
|
if (!(this.dataSource instanceof DataManager) && dataType === 'string' || dataType === 'number') {
|
|
11752
12228
|
filterQuery.where('', this.filterType, this.targetElement(), this.ignoreCase, this.ignoreAccent);
|
|
@@ -11756,21 +12232,89 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
11756
12232
|
filterQuery.where(!isNullOrUndefined(fields.text) ? fields.text : '', this.filterType, this.targetElement(), this.ignoreCase, this.ignoreAccent);
|
|
11757
12233
|
}
|
|
11758
12234
|
}
|
|
12235
|
+
if (this.enableVirtualization && (this.viewPortInfo.endIndex != 0) && !this.virtualSelectAll) {
|
|
12236
|
+
return this.virtualFilterQuery(filterQuery);
|
|
12237
|
+
}
|
|
11759
12238
|
return filterQuery;
|
|
11760
12239
|
}
|
|
11761
12240
|
else {
|
|
12241
|
+
if (this.enableVirtualization && (this.viewPortInfo.endIndex != 0) && !this.virtualSelectAll && (!(this.dataSource instanceof DataManager) || (this.dataSource instanceof DataManager && this.virtualGroupDataSource))) {
|
|
12242
|
+
return this.virtualFilterQuery(filterQuery);
|
|
12243
|
+
}
|
|
11762
12244
|
return query ? query : this.query ? this.query : new Query();
|
|
11763
12245
|
}
|
|
11764
12246
|
};
|
|
12247
|
+
MultiSelect.prototype.virtualFilterQuery = function (filterQuery) {
|
|
12248
|
+
var takeValue = this.getTakeValue();
|
|
12249
|
+
var isReOrder = true;
|
|
12250
|
+
var isSkip = true;
|
|
12251
|
+
var isTake = true;
|
|
12252
|
+
for (var queryElements = 0; queryElements < filterQuery.queries.length; queryElements++) {
|
|
12253
|
+
if (this.getModuleName() === 'multiselect' && ((filterQuery.queries[queryElements].e && filterQuery.queries[queryElements].e.condition == 'or') || (filterQuery.queries[queryElements].e && filterQuery.queries[queryElements].e.operator == 'equal'))) {
|
|
12254
|
+
isReOrder = false;
|
|
12255
|
+
}
|
|
12256
|
+
if (filterQuery.queries[queryElements].fn === 'onSkip') {
|
|
12257
|
+
isSkip = false;
|
|
12258
|
+
}
|
|
12259
|
+
if (filterQuery.queries[queryElements].fn === 'onTake') {
|
|
12260
|
+
isTake = false;
|
|
12261
|
+
}
|
|
12262
|
+
}
|
|
12263
|
+
if ((this.allowFiltering && isSkip) || !isReOrder || (!this.allowFiltering && isSkip)) {
|
|
12264
|
+
if (!isReOrder) {
|
|
12265
|
+
filterQuery.skip(this.viewPortInfo.startIndex);
|
|
12266
|
+
}
|
|
12267
|
+
else {
|
|
12268
|
+
filterQuery.skip(this.virtualItemStartIndex);
|
|
12269
|
+
}
|
|
12270
|
+
}
|
|
12271
|
+
if (isTake) {
|
|
12272
|
+
if (this.isIncrementalRequest) {
|
|
12273
|
+
filterQuery.take(this.incrementalEndIndex);
|
|
12274
|
+
}
|
|
12275
|
+
else {
|
|
12276
|
+
filterQuery.take(takeValue);
|
|
12277
|
+
}
|
|
12278
|
+
}
|
|
12279
|
+
filterQuery.requiresCount();
|
|
12280
|
+
return filterQuery;
|
|
12281
|
+
};
|
|
12282
|
+
MultiSelect.prototype.getTakeValue = function () {
|
|
12283
|
+
return this.allowFiltering && Browser.isDevice ? Math.round(window.outerHeight / this.listItemHeight) : this.itemCount;
|
|
12284
|
+
};
|
|
11765
12285
|
MultiSelect.prototype.dataUpdater = function (dataSource, query, fields) {
|
|
11766
12286
|
this.isDataFetched = false;
|
|
12287
|
+
var isNoData = this.list.classList.contains(dropDownBaseClasses.noData);
|
|
11767
12288
|
if (this.targetElement().trim() === '') {
|
|
11768
|
-
var list = this.mainList.cloneNode ? this.mainList.cloneNode(true) : this.mainList;
|
|
12289
|
+
var list = this.enableVirtualization ? this.list.cloneNode(true) : this.mainList.cloneNode ? this.mainList.cloneNode(true) : this.mainList;
|
|
11769
12290
|
if (this.backCommand) {
|
|
11770
12291
|
this.remoteCustomValue = false;
|
|
11771
12292
|
if (this.allowCustomValue && list.querySelectorAll('li').length == 0 && this.mainData.length > 0) {
|
|
11772
12293
|
this.mainData = [];
|
|
11773
12294
|
}
|
|
12295
|
+
if (this.enableVirtualization) {
|
|
12296
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
12297
|
+
this.totalItemCount = this.dataSource && this.dataSource.length ? this.dataSource.length : 0;
|
|
12298
|
+
this.resetList(dataSource, fields, query);
|
|
12299
|
+
if (this.mode !== 'CheckBox') {
|
|
12300
|
+
this.totalItemCount = this.value && this.value.length ? this.totalItemCount - this.value.length : this.totalItemCount;
|
|
12301
|
+
}
|
|
12302
|
+
this.UpdateSkeleton();
|
|
12303
|
+
if ((isNoData || this.allowCustomValue) && !this.list.classList.contains(dropDownBaseClasses.noData)) {
|
|
12304
|
+
if (!this.list.querySelector('.e-virtual-ddl-content')) {
|
|
12305
|
+
this.list.appendChild(this.createElement('div', {
|
|
12306
|
+
className: 'e-virtual-ddl-content',
|
|
12307
|
+
styles: this.getTransformValues()
|
|
12308
|
+
})).appendChild(this.list.querySelector('.e-list-parent'));
|
|
12309
|
+
}
|
|
12310
|
+
if (!this.list.querySelector('.e-virtual-ddl')) {
|
|
12311
|
+
var virualElement = this.createElement('div', {
|
|
12312
|
+
id: this.element.id + '_popup', className: 'e-virtual-ddl', styles: this.GetVirtualTrackHeight()
|
|
12313
|
+
});
|
|
12314
|
+
document.getElementsByClassName('e-popup')[0].querySelector('.e-dropdownbase').appendChild(virualElement);
|
|
12315
|
+
}
|
|
12316
|
+
}
|
|
12317
|
+
}
|
|
11774
12318
|
this.onActionComplete(list, this.mainData);
|
|
11775
12319
|
if (this.value && this.value.length) {
|
|
11776
12320
|
this.refreshSelection();
|
|
@@ -11782,7 +12326,30 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
11782
12326
|
}
|
|
11783
12327
|
}
|
|
11784
12328
|
else {
|
|
12329
|
+
if (this.enableVirtualization && this.allowFiltering) {
|
|
12330
|
+
this.isPreventScrollAction = true;
|
|
12331
|
+
this.list.scrollTop = 0;
|
|
12332
|
+
this.previousStartIndex = 0;
|
|
12333
|
+
this.virtualListInfo = null;
|
|
12334
|
+
}
|
|
11785
12335
|
this.resetList(dataSource, fields, query);
|
|
12336
|
+
if (this.enableVirtualization && (isNoData || this.allowCustomValue) && !this.list.classList.contains(dropDownBaseClasses.noData)) {
|
|
12337
|
+
if (!this.list.querySelector('.e-virtual-ddl-content')) {
|
|
12338
|
+
this.list.appendChild(this.createElement('div', {
|
|
12339
|
+
className: 'e-virtual-ddl-content',
|
|
12340
|
+
styles: this.getTransformValues()
|
|
12341
|
+
})).appendChild(this.list.querySelector('.e-list-parent'));
|
|
12342
|
+
}
|
|
12343
|
+
if (this.mode !== 'CheckBox') {
|
|
12344
|
+
this.totalItemCount = this.value && this.value.length ? this.totalItemCount - this.value.length : this.totalItemCount;
|
|
12345
|
+
}
|
|
12346
|
+
if (!this.list.querySelector('.e-virtual-ddl')) {
|
|
12347
|
+
var virualElement = this.createElement('div', {
|
|
12348
|
+
id: this.element.id + '_popup', className: 'e-virtual-ddl', styles: this.GetVirtualTrackHeight()
|
|
12349
|
+
});
|
|
12350
|
+
document.getElementsByClassName('e-popup')[0].querySelector('.e-dropdownbase').appendChild(virualElement);
|
|
12351
|
+
}
|
|
12352
|
+
}
|
|
11786
12353
|
if (this.allowCustomValue) {
|
|
11787
12354
|
if (!(dataSource instanceof DataManager)) {
|
|
11788
12355
|
this.checkForCustomValue(query, fields);
|
|
@@ -11793,6 +12360,9 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
11793
12360
|
}
|
|
11794
12361
|
}
|
|
11795
12362
|
}
|
|
12363
|
+
if (this.enableVirtualization && this.allowFiltering) {
|
|
12364
|
+
this.getFilteringSkeletonCount();
|
|
12365
|
+
}
|
|
11796
12366
|
this.refreshPopup();
|
|
11797
12367
|
if (this.mode === 'CheckBox') {
|
|
11798
12368
|
this.removeFocus();
|
|
@@ -11806,18 +12376,43 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
11806
12376
|
var customData = (!isNullOrUndefined(this.mainData) && this.mainData.length > 0) ?
|
|
11807
12377
|
this.mainData[0] : this.mainData;
|
|
11808
12378
|
if (customData && typeof (customData) !== 'string' && typeof (customData) !== 'number' && typeof (customData) !== 'boolean') {
|
|
11809
|
-
var
|
|
11810
|
-
setValue(field.text, value,
|
|
12379
|
+
var dataItem_1 = {};
|
|
12380
|
+
setValue(field.text, value, dataItem_1);
|
|
11811
12381
|
if (typeof getValue((this.fields.value ? this.fields.value : 'value'), customData)
|
|
11812
12382
|
=== 'number') {
|
|
11813
|
-
setValue(field.value, Math.random(),
|
|
12383
|
+
setValue(field.value, Math.random(), dataItem_1);
|
|
11814
12384
|
}
|
|
11815
12385
|
else {
|
|
11816
|
-
setValue(field.value, value,
|
|
12386
|
+
setValue(field.value, value, dataItem_1);
|
|
12387
|
+
}
|
|
12388
|
+
var emptyObject_1 = {};
|
|
12389
|
+
if (this.allowObjectBinding) {
|
|
12390
|
+
var keys = this.listData && this.listData.length > 0 ? Object.keys(this.listData[0]) : this.firstItem ? Object.keys(this.firstItem) : Object.keys(dataItem_1);
|
|
12391
|
+
// Create an empty object with predefined keys
|
|
12392
|
+
keys.forEach(function (key) {
|
|
12393
|
+
emptyObject_1[key] = ((key === fields.value) || (key === fields.text)) ? getValue(fields.value, dataItem_1) : null;
|
|
12394
|
+
});
|
|
12395
|
+
}
|
|
12396
|
+
dataItem_1 = this.allowObjectBinding ? emptyObject_1 : dataItem_1;
|
|
12397
|
+
if (this.enableVirtualization) {
|
|
12398
|
+
this.virtualCustomData = dataItem_1;
|
|
12399
|
+
var tempData = this.virtualGroupDataSource ? JSON.parse(JSON.stringify(this.virtualGroupDataSource)) : JSON.parse(JSON.stringify(this.dataSource));
|
|
12400
|
+
var totalData = [];
|
|
12401
|
+
if (this.virtualCustomSelectData && this.virtualCustomSelectData.length > 0) {
|
|
12402
|
+
totalData = tempData.concat(this.virtualCustomSelectData);
|
|
12403
|
+
}
|
|
12404
|
+
tempData.splice(0, 0, dataItem_1);
|
|
12405
|
+
this.isCustomDataUpdated = true;
|
|
12406
|
+
this.viewPortInfo.startIndex = this.virtualItemStartIndex = 0;
|
|
12407
|
+
this.viewPortInfo.endIndex = this.virtualItemEndIndex = this.itemCount;
|
|
12408
|
+
this.resetList(tempData, field, query);
|
|
12409
|
+
this.isCustomDataUpdated = false;
|
|
12410
|
+
}
|
|
12411
|
+
else {
|
|
12412
|
+
var tempData = JSON.parse(JSON.stringify(this.listData));
|
|
12413
|
+
tempData.splice(0, 0, dataItem_1);
|
|
12414
|
+
this.resetList(tempData, field, query);
|
|
11817
12415
|
}
|
|
11818
|
-
var tempData = JSON.parse(JSON.stringify(this.listData));
|
|
11819
|
-
tempData.splice(0, 0, dataItem);
|
|
11820
|
-
this.resetList(tempData, field, query);
|
|
11821
12416
|
}
|
|
11822
12417
|
else if (this.listData) {
|
|
11823
12418
|
var tempData = JSON.parse(JSON.stringify(this.listData));
|
|
@@ -11851,6 +12446,8 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
11851
12446
|
};
|
|
11852
12447
|
MultiSelect.prototype.wrapperClick = function (e) {
|
|
11853
12448
|
this.setDynValue = false;
|
|
12449
|
+
this.keyboardEvent = null;
|
|
12450
|
+
this.isKeyBoardAction = false;
|
|
11854
12451
|
if (!this.enabled) {
|
|
11855
12452
|
return;
|
|
11856
12453
|
}
|
|
@@ -12050,8 +12647,8 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
12050
12647
|
if (this.initStatus && this.validateValues(newValue, oldValue)) {
|
|
12051
12648
|
var eventArgs = {
|
|
12052
12649
|
e: event,
|
|
12053
|
-
oldValue: oldVal,
|
|
12054
|
-
value: newVal,
|
|
12650
|
+
oldValue: this.allowObjectBinding ? oldVal : oldVal,
|
|
12651
|
+
value: this.allowObjectBinding ? newVal : newVal,
|
|
12055
12652
|
isInteracted: event ? true : false,
|
|
12056
12653
|
element: this.element,
|
|
12057
12654
|
event: event
|
|
@@ -12067,13 +12664,14 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
12067
12664
|
this.dispatchEvent(this.hiddenElement, 'change');
|
|
12068
12665
|
}
|
|
12069
12666
|
}
|
|
12667
|
+
this.selectedValueInfo = this.viewPortInfo;
|
|
12070
12668
|
};
|
|
12071
12669
|
MultiSelect.prototype.updateTempValue = function () {
|
|
12072
12670
|
if (!this.value) {
|
|
12073
12671
|
this.tempValues = this.value;
|
|
12074
12672
|
}
|
|
12075
12673
|
else {
|
|
12076
|
-
this.tempValues = this.value.slice();
|
|
12674
|
+
this.tempValues = this.allowObjectBinding ? this.value.slice() : this.value.slice();
|
|
12077
12675
|
}
|
|
12078
12676
|
};
|
|
12079
12677
|
MultiSelect.prototype.updateAriaActiveDescendant = function () {
|
|
@@ -12081,26 +12679,44 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
12081
12679
|
attributes(this.inputElement, { 'aria-activedescendant': this.ulElement.getElementsByClassName('e-item-focus')[0].id });
|
|
12082
12680
|
}
|
|
12083
12681
|
};
|
|
12084
|
-
MultiSelect.prototype.
|
|
12085
|
-
var height = this.list.classList.contains(dropDownBaseClasses.noData) ? null :
|
|
12086
|
-
getComputedStyle(this.getItems()[0], null).getPropertyValue('height');
|
|
12087
|
-
return Math.round(this.list.offsetHeight / parseInt(height, 10));
|
|
12088
|
-
};
|
|
12089
|
-
MultiSelect.prototype.pageUpSelection = function (steps) {
|
|
12682
|
+
MultiSelect.prototype.pageUpSelection = function (steps, isVirtualKeyAction) {
|
|
12090
12683
|
var collection = this.list.querySelectorAll('li.'
|
|
12091
12684
|
+ dropDownBaseClasses.li + ':not(.' + HIDE_LIST + ')' + ':not(.e-reorder-hide)');
|
|
12092
12685
|
var previousItem = steps >= 0 ? collection[steps + 1] : collection[0];
|
|
12093
|
-
this.
|
|
12094
|
-
|
|
12686
|
+
if (this.enableVirtualization && isVirtualKeyAction) {
|
|
12687
|
+
previousItem = steps >= 0 && this.viewPortInfo.startIndex != 0 ? this.liCollections[steps + this.skeletonCount + 1] : this.liCollections[this.skeletonCount];
|
|
12688
|
+
}
|
|
12689
|
+
if (!isNullOrUndefined(previousItem) && previousItem.classList.contains('e-virtual-list')) {
|
|
12690
|
+
previousItem = this.liCollections[this.skeletonCount];
|
|
12691
|
+
}
|
|
12692
|
+
if (this.enableVirtualization) {
|
|
12693
|
+
if (!isNullOrUndefined(previousItem) && !previousItem.classList.contains('e-item-focus')) {
|
|
12694
|
+
this.addListFocus(previousItem);
|
|
12695
|
+
this.scrollTop(previousItem, this.getIndexByValue(previousItem.getAttribute('data-value')), this.keyboardEvent.keyCode);
|
|
12696
|
+
}
|
|
12697
|
+
else if (this.viewPortInfo.startIndex == 0) {
|
|
12698
|
+
this.scrollTop(previousItem, this.getIndexByValue(previousItem.getAttribute('data-value')), this.keyboardEvent.keyCode);
|
|
12699
|
+
}
|
|
12700
|
+
}
|
|
12701
|
+
else {
|
|
12702
|
+
this.addListFocus(previousItem);
|
|
12703
|
+
this.scrollTop(previousItem, this.getIndexByValue(previousItem.getAttribute('data-value')), this.keyboardEvent.keyCode);
|
|
12704
|
+
}
|
|
12095
12705
|
};
|
|
12096
|
-
MultiSelect.prototype.pageDownSelection = function (steps) {
|
|
12706
|
+
MultiSelect.prototype.pageDownSelection = function (steps, isVirtualKeyAction) {
|
|
12097
12707
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
12098
12708
|
var list = this.getItems();
|
|
12099
12709
|
var collection = this.list.querySelectorAll('li.'
|
|
12100
12710
|
+ dropDownBaseClasses.li + ':not(.' + HIDE_LIST + ')' + ':not(.e-reorder-hide)');
|
|
12101
12711
|
var previousItem = steps <= collection.length ? collection[steps - 1] : collection[collection.length - 1];
|
|
12712
|
+
if (this.enableVirtualization && this.skeletonCount > 0) {
|
|
12713
|
+
previousItem = steps < list.length ? this.liCollections[steps] : this.liCollections[list.length - 1];
|
|
12714
|
+
}
|
|
12715
|
+
if (this.enableVirtualization && isVirtualKeyAction) {
|
|
12716
|
+
previousItem = steps <= list.length ? this.liCollections[steps] : this.liCollections[list.length - 1];
|
|
12717
|
+
}
|
|
12102
12718
|
this.addListFocus(previousItem);
|
|
12103
|
-
this.scrollBottom(previousItem, this.getIndexByValue(previousItem.getAttribute('data-value')));
|
|
12719
|
+
this.scrollBottom(previousItem, this.getIndexByValue(previousItem.getAttribute('data-value')), false, this.keyboardEvent.keyCode);
|
|
12104
12720
|
};
|
|
12105
12721
|
MultiSelect.prototype.getItems = function () {
|
|
12106
12722
|
if (!this.list) {
|
|
@@ -12219,21 +12835,110 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
12219
12835
|
}
|
|
12220
12836
|
}
|
|
12221
12837
|
};
|
|
12222
|
-
MultiSelect.prototype.homeNavigation = function (isHome) {
|
|
12838
|
+
MultiSelect.prototype.homeNavigation = function (isHome, isVirtualKeyAction) {
|
|
12223
12839
|
this.removeFocus();
|
|
12840
|
+
if (this.enableVirtualization) {
|
|
12841
|
+
if (isHome) {
|
|
12842
|
+
if (this.enableVirtualization && this.viewPortInfo.startIndex !== 0) {
|
|
12843
|
+
this.viewPortInfo.startIndex = 0;
|
|
12844
|
+
this.viewPortInfo.endIndex = this.itemCount;
|
|
12845
|
+
this.updateVirtualItemIndex();
|
|
12846
|
+
this.resetList(this.dataSource, this.fields, this.query);
|
|
12847
|
+
}
|
|
12848
|
+
}
|
|
12849
|
+
else {
|
|
12850
|
+
if (this.enableVirtualization && ((!this.value && this.viewPortInfo.endIndex !== this.totalItemCount) || (this.value && this.value.length > 0 && this.viewPortInfo.endIndex !== this.totalItemCount + this.value.length))) {
|
|
12851
|
+
this.viewPortInfo.startIndex = this.totalItemCount - this.itemCount;
|
|
12852
|
+
this.viewPortInfo.endIndex = this.totalItemCount;
|
|
12853
|
+
this.updateVirtualItemIndex();
|
|
12854
|
+
var query = new Query().clone();
|
|
12855
|
+
if (this.value && this.value.length > 0) {
|
|
12856
|
+
query = this.getForQuery(this.value).clone();
|
|
12857
|
+
query = query.skip(this.totalItemCount - this.itemCount);
|
|
12858
|
+
}
|
|
12859
|
+
this.resetList(this.dataSource, this.fields, query);
|
|
12860
|
+
}
|
|
12861
|
+
}
|
|
12862
|
+
}
|
|
12863
|
+
this.UpdateSkeleton();
|
|
12224
12864
|
var scrollEle = this.ulElement.querySelectorAll('li.' + dropDownBaseClasses.li
|
|
12225
12865
|
+ ':not(.' + HIDE_LIST + ')' + ':not(.e-reorder-hide)');
|
|
12226
12866
|
if (scrollEle.length > 0) {
|
|
12227
12867
|
var element = scrollEle[(isHome) ? 0 : (scrollEle.length - 1)];
|
|
12868
|
+
if (this.enableVirtualization && isHome) {
|
|
12869
|
+
element = scrollEle[this.skeletonCount];
|
|
12870
|
+
}
|
|
12871
|
+
this.removeFocus();
|
|
12228
12872
|
element.classList.add(dropDownBaseClasses.focus);
|
|
12229
|
-
this.
|
|
12873
|
+
if (this.enableVirtualization && isHome) {
|
|
12874
|
+
this.scrollTop(element, undefined, this.keyboardEvent.keyCode);
|
|
12875
|
+
}
|
|
12876
|
+
else if (!isVirtualKeyAction) {
|
|
12877
|
+
this.scrollBottom(element, undefined, false, this.keyboardEvent.keyCode);
|
|
12878
|
+
}
|
|
12230
12879
|
this.updateAriaActiveDescendant();
|
|
12231
12880
|
}
|
|
12232
12881
|
};
|
|
12882
|
+
MultiSelect.prototype.updateSelectionList = function () {
|
|
12883
|
+
if (!isNullOrUndefined(this.value) && this.value.length) {
|
|
12884
|
+
for (var index = 0; index < this.value.length; index++) {
|
|
12885
|
+
var value = this.allowObjectBinding ? getValue(((this.fields.value) ? this.fields.value : ''), this.value[index]) : this.value[index];
|
|
12886
|
+
var selectedItem = this.getElementByValue(value);
|
|
12887
|
+
if (selectedItem && !selectedItem.classList.contains(dropDownBaseClasses.selected)) {
|
|
12888
|
+
selectedItem.classList.add('e-active');
|
|
12889
|
+
}
|
|
12890
|
+
}
|
|
12891
|
+
}
|
|
12892
|
+
};
|
|
12893
|
+
MultiSelect.prototype.handleVirtualKeyboardActions = function (e, pageCount) {
|
|
12894
|
+
var focusedItem = this.list.querySelector('.' + dropDownBaseClasses.focus);
|
|
12895
|
+
var activeIndex;
|
|
12896
|
+
this.isKeyBoardAction = true;
|
|
12897
|
+
switch (e.keyCode) {
|
|
12898
|
+
case 40:
|
|
12899
|
+
this.arrowDown(e, true);
|
|
12900
|
+
break;
|
|
12901
|
+
case 38:
|
|
12902
|
+
this.arrowUp(e, true);
|
|
12903
|
+
break;
|
|
12904
|
+
case 33:
|
|
12905
|
+
e.preventDefault();
|
|
12906
|
+
if (focusedItem) {
|
|
12907
|
+
var count = (this.getPageCount() * 2) - 4;
|
|
12908
|
+
activeIndex = Math.round(count);
|
|
12909
|
+
activeIndex = this.getIndexByValue(focusedItem.getAttribute('data-value'));
|
|
12910
|
+
this.pageUpSelection(activeIndex - this.getPageCount(), true);
|
|
12911
|
+
this.updateAriaAttribute();
|
|
12912
|
+
}
|
|
12913
|
+
break;
|
|
12914
|
+
case 34:
|
|
12915
|
+
e.preventDefault();
|
|
12916
|
+
if (focusedItem) {
|
|
12917
|
+
activeIndex = this.getIndexByValue(focusedItem.getAttribute('data-value'));
|
|
12918
|
+
this.pageDownSelection(activeIndex + this.getPageCount() + 1, true);
|
|
12919
|
+
this.updateAriaAttribute();
|
|
12920
|
+
}
|
|
12921
|
+
break;
|
|
12922
|
+
case 35:
|
|
12923
|
+
case 36:
|
|
12924
|
+
this.isMouseScrollAction = true;
|
|
12925
|
+
this.homeNavigation((e.keyCode === 36) ? true : false, true);
|
|
12926
|
+
this.isPreventScrollAction = true;
|
|
12927
|
+
break;
|
|
12928
|
+
}
|
|
12929
|
+
this.keyboardEvent = null;
|
|
12930
|
+
this.isScrollChanged = true;
|
|
12931
|
+
this.isKeyBoardAction = false;
|
|
12932
|
+
};
|
|
12233
12933
|
MultiSelect.prototype.onKeyDown = function (e) {
|
|
12234
12934
|
if (this.readonly || !this.enabled && this.mode !== 'CheckBox') {
|
|
12235
12935
|
return;
|
|
12236
12936
|
}
|
|
12937
|
+
this.preventSetCurrentData = false;
|
|
12938
|
+
this.keyboardEvent = e;
|
|
12939
|
+
if (this.isPreventKeyAction && this.enableVirtualization) {
|
|
12940
|
+
e.preventDefault();
|
|
12941
|
+
}
|
|
12237
12942
|
this.keyCode = e.keyCode;
|
|
12238
12943
|
this.keyDownStatus = true;
|
|
12239
12944
|
if (e.keyCode > 111 && e.keyCode < 124) {
|
|
@@ -12246,16 +12951,18 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
12246
12951
|
else if (this.isPopupOpen()) {
|
|
12247
12952
|
var focusedItem = this.list.querySelector('.' + dropDownBaseClasses.focus);
|
|
12248
12953
|
var activeIndex = void 0;
|
|
12954
|
+
this.isKeyBoardAction = true;
|
|
12249
12955
|
switch (e.keyCode) {
|
|
12250
12956
|
case 36:
|
|
12251
12957
|
case 35:
|
|
12958
|
+
this.isMouseScrollAction = true;
|
|
12252
12959
|
this.homeNavigation((e.keyCode === 36) ? true : false);
|
|
12253
12960
|
break;
|
|
12254
12961
|
case 33:
|
|
12255
12962
|
e.preventDefault();
|
|
12256
12963
|
if (focusedItem) {
|
|
12257
|
-
this.getIndexByValue(focusedItem.getAttribute('data-value'));
|
|
12258
|
-
this.pageUpSelection(activeIndex - this.
|
|
12964
|
+
activeIndex = this.getIndexByValue(focusedItem.getAttribute('data-value'));
|
|
12965
|
+
this.pageUpSelection(activeIndex - this.getPageCount() - 1);
|
|
12259
12966
|
this.updateAriaAttribute();
|
|
12260
12967
|
}
|
|
12261
12968
|
return;
|
|
@@ -12263,7 +12970,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
12263
12970
|
e.preventDefault();
|
|
12264
12971
|
if (focusedItem) {
|
|
12265
12972
|
this.getIndexByValue(focusedItem.getAttribute('data-value'));
|
|
12266
|
-
this.pageDownSelection(activeIndex + this.
|
|
12973
|
+
this.pageDownSelection(activeIndex + this.getPageCount());
|
|
12267
12974
|
this.updateAriaAttribute();
|
|
12268
12975
|
}
|
|
12269
12976
|
return;
|
|
@@ -12329,10 +13036,11 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
12329
13036
|
if (!(this.mode === 'CheckBox' && this.showSelectAll)) {
|
|
12330
13037
|
this.refreshPopup();
|
|
12331
13038
|
}
|
|
13039
|
+
this.isKeyBoardAction = false;
|
|
12332
13040
|
};
|
|
12333
|
-
MultiSelect.prototype.arrowDown = function (e) {
|
|
13041
|
+
MultiSelect.prototype.arrowDown = function (e, isVirtualKeyAction) {
|
|
12334
13042
|
e.preventDefault();
|
|
12335
|
-
this.moveByList(1);
|
|
13043
|
+
this.moveByList(1, isVirtualKeyAction);
|
|
12336
13044
|
this.keyAction = true;
|
|
12337
13045
|
if (document.activeElement.classList.contains(FILTERINPUT)
|
|
12338
13046
|
|| (this.mode === 'CheckBox' && !this.allowFiltering && document.activeElement !== this.list)) {
|
|
@@ -12340,7 +13048,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
12340
13048
|
}
|
|
12341
13049
|
this.updateAriaAttribute();
|
|
12342
13050
|
};
|
|
12343
|
-
MultiSelect.prototype.arrowUp = function (e) {
|
|
13051
|
+
MultiSelect.prototype.arrowUp = function (e, isVirtualKeyAction) {
|
|
12344
13052
|
e.preventDefault();
|
|
12345
13053
|
this.keyAction = true;
|
|
12346
13054
|
var list = this.list.querySelectorAll('li.'
|
|
@@ -12358,7 +13066,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
12358
13066
|
this.keyAction = false;
|
|
12359
13067
|
this.notify('inputFocus', { module: 'CheckBoxSelection', enable: this.mode === 'CheckBox', value: 'focus' });
|
|
12360
13068
|
}
|
|
12361
|
-
this.moveByList(-1);
|
|
13069
|
+
this.moveByList(-1, isVirtualKeyAction);
|
|
12362
13070
|
this.updateAriaAttribute();
|
|
12363
13071
|
};
|
|
12364
13072
|
MultiSelect.prototype.spaceKeySelection = function (e) {
|
|
@@ -12409,8 +13117,8 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
12409
13117
|
else if (e.keyCode === 8 && this.mode === 'Delimiter') {
|
|
12410
13118
|
if (this.value && this.value.length) {
|
|
12411
13119
|
e.preventDefault();
|
|
12412
|
-
var temp = this.value[this.value.length - 1];
|
|
12413
|
-
this.removeValue(
|
|
13120
|
+
var temp = this.allowObjectBinding ? getValue(((this.fields.value) ? this.fields.value : ''), this.value[this.value.length - 1]) : this.value[this.value.length - 1];
|
|
13121
|
+
this.removeValue(this.value[this.value.length - 1], e);
|
|
12414
13122
|
this.updateDelimeter(this.delimiterChar, e);
|
|
12415
13123
|
this.focusAtLastListItem(temp);
|
|
12416
13124
|
}
|
|
@@ -12425,6 +13133,9 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
12425
13133
|
};
|
|
12426
13134
|
MultiSelect.prototype.escapeAction = function () {
|
|
12427
13135
|
var temp = this.tempValues ? this.tempValues.slice() : [];
|
|
13136
|
+
if (this.allowObjectBinding) {
|
|
13137
|
+
temp = this.tempValues ? this.tempValues.slice() : [];
|
|
13138
|
+
}
|
|
12428
13139
|
if (this.value && this.validateValues(this.value, temp)) {
|
|
12429
13140
|
if (this.mode !== 'CheckBox') {
|
|
12430
13141
|
this.value = temp;
|
|
@@ -12446,36 +13157,103 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
12446
13157
|
}
|
|
12447
13158
|
this.makeTextBoxEmpty();
|
|
12448
13159
|
};
|
|
12449
|
-
MultiSelect.prototype.scrollBottom = function (selectedLI, activeIndex) {
|
|
13160
|
+
MultiSelect.prototype.scrollBottom = function (selectedLI, activeIndex, isInitialSelection, keyCode) {
|
|
13161
|
+
if (isInitialSelection === void 0) { isInitialSelection = false; }
|
|
13162
|
+
if (keyCode === void 0) { keyCode = null; }
|
|
13163
|
+
if ((!isNullOrUndefined(selectedLI) && selectedLI.classList.contains('e-virtual-list')) || (this.enableVirtualization && isNullOrUndefined(selectedLI))) {
|
|
13164
|
+
selectedLI = this.liCollections[this.skeletonCount];
|
|
13165
|
+
}
|
|
13166
|
+
this.isUpwardScrolling = false;
|
|
13167
|
+
var virtualListCount = this.list.querySelectorAll('.e-virtual-list').length;
|
|
13168
|
+
var lastElementValue = this.list.querySelector('li:last-of-type') ? this.list.querySelector('li:last-of-type').getAttribute('data-value') : null;
|
|
13169
|
+
var selectedLiOffsetTop = this.virtualListInfo && this.virtualListInfo.startIndex ? selectedLI.offsetTop + (this.virtualListInfo.startIndex * selectedLI.offsetHeight) : selectedLI.offsetTop;
|
|
12450
13170
|
var currentOffset = this.list.offsetHeight;
|
|
12451
|
-
var nextBottom = selectedLI.
|
|
13171
|
+
var nextBottom = selectedLiOffsetTop - (virtualListCount * selectedLI.offsetHeight) + selectedLI.offsetHeight - this.list.scrollTop;
|
|
12452
13172
|
var nextOffset = this.list.scrollTop + nextBottom - currentOffset;
|
|
12453
|
-
var
|
|
13173
|
+
var isScrollerCHanged = false;
|
|
13174
|
+
var boxRange = selectedLiOffsetTop - (virtualListCount * selectedLI.offsetHeight) + selectedLI.offsetHeight - this.list.scrollTop;
|
|
12454
13175
|
boxRange = this.fields.groupBy && !isNullOrUndefined(this.fixedHeaderElement) ?
|
|
12455
13176
|
boxRange - this.fixedHeaderElement.offsetHeight : boxRange;
|
|
12456
|
-
if (activeIndex === 0) {
|
|
13177
|
+
if (activeIndex === 0 && !this.enableVirtualization) {
|
|
12457
13178
|
this.list.scrollTop = 0;
|
|
12458
13179
|
}
|
|
12459
|
-
else if (nextBottom > currentOffset) {
|
|
12460
|
-
|
|
12461
|
-
|
|
12462
|
-
|
|
12463
|
-
|
|
13180
|
+
else if (nextBottom > currentOffset || !(boxRange > 0 && this.list.offsetHeight > boxRange)) {
|
|
13181
|
+
var currentElementValue = selectedLI ? selectedLI.getAttribute('data-value') : null;
|
|
13182
|
+
var liCount = keyCode == 34 ? this.getPageCount() - 1 : 1;
|
|
13183
|
+
if (!this.enableVirtualization || this.isKeyBoardAction || isInitialSelection) {
|
|
13184
|
+
if (this.isKeyBoardAction && this.enableVirtualization && lastElementValue && currentElementValue === lastElementValue && keyCode != 35 && !this.isVirtualScrolling) {
|
|
13185
|
+
this.isPreventKeyAction = true;
|
|
13186
|
+
this.list.scrollTop += selectedLI.offsetHeight * liCount;
|
|
13187
|
+
this.isPreventKeyAction = this.IsScrollerAtEnd() ? false : this.isPreventKeyAction;
|
|
13188
|
+
this.isKeyBoardAction = false;
|
|
13189
|
+
this.isPreventScrollAction = false;
|
|
13190
|
+
}
|
|
13191
|
+
else if (this.enableVirtualization && keyCode == 35) {
|
|
13192
|
+
this.isPreventKeyAction = false;
|
|
13193
|
+
this.isKeyBoardAction = false;
|
|
13194
|
+
this.isPreventScrollAction = false;
|
|
13195
|
+
this.list.scrollTop = this.list.scrollHeight;
|
|
13196
|
+
}
|
|
13197
|
+
else {
|
|
13198
|
+
if (keyCode == 34 && this.enableVirtualization && !this.isVirtualScrolling) {
|
|
13199
|
+
this.isPreventKeyAction = false;
|
|
13200
|
+
this.isKeyBoardAction = false;
|
|
13201
|
+
this.isPreventScrollAction = false;
|
|
13202
|
+
nextOffset = nextOffset + (selectedLI.offsetHeight * liCount);
|
|
13203
|
+
}
|
|
13204
|
+
this.list.scrollTop = nextOffset;
|
|
13205
|
+
}
|
|
13206
|
+
}
|
|
13207
|
+
else {
|
|
13208
|
+
this.list.scrollTop = this.virtualListInfo && this.virtualListInfo.startIndex ? this.virtualListInfo.startIndex * this.listItemHeight : 0;
|
|
13209
|
+
}
|
|
13210
|
+
isScrollerCHanged = this.isKeyBoardAction;
|
|
13211
|
+
|
|
12464
13212
|
}
|
|
13213
|
+
this.isKeyBoardAction = isScrollerCHanged;
|
|
12465
13214
|
};
|
|
12466
|
-
MultiSelect.prototype.scrollTop = function (selectedLI, activeIndex) {
|
|
12467
|
-
|
|
13215
|
+
MultiSelect.prototype.scrollTop = function (selectedLI, activeIndex, keyCode) {
|
|
13216
|
+
if (keyCode === void 0) { keyCode = null; }
|
|
13217
|
+
var virtualListCount = this.list.querySelectorAll('.e-virtual-list').length;
|
|
13218
|
+
var selectedLiOffsetTop = (this.virtualListInfo && this.virtualListInfo.startIndex) ? selectedLI.offsetTop + (this.virtualListInfo.startIndex * selectedLI.offsetHeight) : selectedLI.offsetTop;
|
|
13219
|
+
var nextOffset = selectedLiOffsetTop - (virtualListCount * selectedLI.offsetHeight) - this.list.scrollTop;
|
|
13220
|
+
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;
|
|
12468
13221
|
nextOffset = this.fields.groupBy && !isUndefined(this.fixedHeaderElement) ?
|
|
12469
13222
|
nextOffset - this.fixedHeaderElement.offsetHeight : nextOffset;
|
|
12470
|
-
var boxRange = (selectedLI.
|
|
12471
|
-
|
|
13223
|
+
var boxRange = (selectedLiOffsetTop - (virtualListCount * selectedLI.offsetHeight) + selectedLI.offsetHeight - this.list.scrollTop);
|
|
13224
|
+
var isPageUpKeyAction = this.enableVirtualization && this.getModuleName() === 'autocomplete' && nextOffset <= 0;
|
|
13225
|
+
if (activeIndex === 0 && !this.enableVirtualization) {
|
|
12472
13226
|
this.list.scrollTop = 0;
|
|
12473
13227
|
}
|
|
12474
|
-
else if (nextOffset < 0) {
|
|
12475
|
-
|
|
13228
|
+
else if (nextOffset < 0 || isPageUpKeyAction) {
|
|
13229
|
+
var currentElementValue = selectedLI ? selectedLI.getAttribute('data-value') : null;
|
|
13230
|
+
var liCount = keyCode == 33 ? this.getPageCount() - 2 : 1;
|
|
13231
|
+
if (this.enableVirtualization && this.isKeyBoardAction && firstElementValue && currentElementValue === firstElementValue && keyCode != 36 && !this.isVirtualScrolling) {
|
|
13232
|
+
this.isUpwardScrolling = true;
|
|
13233
|
+
this.isPreventKeyAction = true;
|
|
13234
|
+
this.list.scrollTop -= selectedLI.offsetHeight * liCount;
|
|
13235
|
+
this.isPreventKeyAction = this.list.scrollTop != 0 ? this.isPreventKeyAction : false;
|
|
13236
|
+
this.isKeyBoardAction = false;
|
|
13237
|
+
this.isPreventScrollAction = false;
|
|
13238
|
+
}
|
|
13239
|
+
else if (this.enableVirtualization && keyCode == 36) {
|
|
13240
|
+
this.isPreventScrollAction = false;
|
|
13241
|
+
this.isPreventKeyAction = true;
|
|
13242
|
+
this.isKeyBoardAction = false;
|
|
13243
|
+
this.list.scrollTo(0, 0);
|
|
13244
|
+
}
|
|
13245
|
+
else {
|
|
13246
|
+
if (keyCode == 33 && this.enableVirtualization && !this.isVirtualScrolling) {
|
|
13247
|
+
this.isPreventKeyAction = false;
|
|
13248
|
+
this.isKeyBoardAction = false;
|
|
13249
|
+
this.isPreventScrollAction = false;
|
|
13250
|
+
nextOffset = nextOffset - (selectedLI.offsetHeight * liCount);
|
|
13251
|
+
}
|
|
13252
|
+
this.list.scrollTop = this.list.scrollTop + nextOffset;
|
|
13253
|
+
}
|
|
12476
13254
|
}
|
|
12477
13255
|
else if (!(boxRange > 0 && this.list.offsetHeight > boxRange)) {
|
|
12478
|
-
this.list.scrollTop = selectedLI.offsetTop - (this.fields.groupBy && !
|
|
13256
|
+
this.list.scrollTop = selectedLI.offsetTop - (this.fields.groupBy && !isNullOrUndefined(this.fixedHeaderElement) ?
|
|
12479
13257
|
this.fixedHeaderElement.offsetHeight : 0);
|
|
12480
13258
|
}
|
|
12481
13259
|
};
|
|
@@ -12562,7 +13340,19 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
12562
13340
|
if ((this.allowFiltering || (this.mode === 'CheckBox' && this.enableSelectionOrder === true)
|
|
12563
13341
|
|| this.allowCustomValue) && this.mainList && this.listData) {
|
|
12564
13342
|
var list = this.mainList.cloneNode ? this.mainList.cloneNode(true) : this.mainList;
|
|
12565
|
-
|
|
13343
|
+
if (this.enableVirtualization) {
|
|
13344
|
+
if (this.allowCustomValue && this.virtualCustomData && data == null && this.virtualCustomData && this.viewPortInfo && this.viewPortInfo.startIndex === 0 && this.viewPortInfo.endIndex === this.itemCount) {
|
|
13345
|
+
this.virtualCustomData = null;
|
|
13346
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
13347
|
+
this.renderItems(this.mainData, this.fields);
|
|
13348
|
+
}
|
|
13349
|
+
else {
|
|
13350
|
+
this.onActionComplete(this.list, this.listData);
|
|
13351
|
+
}
|
|
13352
|
+
}
|
|
13353
|
+
else {
|
|
13354
|
+
this.onActionComplete(list, this.mainData);
|
|
13355
|
+
}
|
|
12566
13356
|
this.focusAtLastListItem(data);
|
|
12567
13357
|
if (this.value && this.value.length) {
|
|
12568
13358
|
this.refreshSelection();
|
|
@@ -12577,14 +13367,15 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
12577
13367
|
var temp;
|
|
12578
13368
|
if (selectedElem !== null) {
|
|
12579
13369
|
if (!isNullOrUndefined(this.value)) {
|
|
12580
|
-
this.tempValues = this.value.slice();
|
|
13370
|
+
this.tempValues = this.allowObjectBinding ? this.value.slice() : this.value.slice();
|
|
12581
13371
|
}
|
|
12582
13372
|
temp = selectedElem.nextElementSibling;
|
|
12583
13373
|
if (temp !== null) {
|
|
12584
13374
|
this.removeChipSelection();
|
|
12585
13375
|
this.addChipSelection(temp, e);
|
|
12586
13376
|
}
|
|
12587
|
-
this.
|
|
13377
|
+
var currentChip = this.allowObjectBinding ? this.getDataByValue(selectedElem.getAttribute('data-value')) : selectedElem.getAttribute('data-value');
|
|
13378
|
+
this.removeValue(currentChip, e);
|
|
12588
13379
|
this.makeTextBoxEmpty();
|
|
12589
13380
|
}
|
|
12590
13381
|
if (this.closePopupOnSelect) {
|
|
@@ -12611,7 +13402,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
12611
13402
|
selectAllParent.classList.remove('e-item-focus');
|
|
12612
13403
|
}
|
|
12613
13404
|
};
|
|
12614
|
-
MultiSelect.prototype.moveByList = function (position) {
|
|
13405
|
+
MultiSelect.prototype.moveByList = function (position, isVirtualKeyAction) {
|
|
12615
13406
|
if (this.list) {
|
|
12616
13407
|
var elements = this.list.querySelectorAll('li.'
|
|
12617
13408
|
+ dropDownBaseClasses.li
|
|
@@ -12622,6 +13413,9 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
12622
13413
|
+ ':not(.' + HIDE_LIST + ')' + ':not(.e-reorder-hide)');
|
|
12623
13414
|
}
|
|
12624
13415
|
var selectedElem = this.list.querySelector('li.' + dropDownBaseClasses.focus);
|
|
13416
|
+
if (this.enableVirtualization && isVirtualKeyAction && !isNullOrUndefined(this.currentFocuedListElement)) {
|
|
13417
|
+
selectedElem = this.getElementByValue(this.getFormattedValue(this.currentFocuedListElement.getAttribute('data-value')));
|
|
13418
|
+
}
|
|
12625
13419
|
var temp = -1;
|
|
12626
13420
|
var selectAllParent = document.getElementsByClassName('e-selectall-parent')[0];
|
|
12627
13421
|
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) {
|
|
@@ -12650,22 +13444,57 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
12650
13444
|
if (position > 0) {
|
|
12651
13445
|
if (temp < (elements.length - 1)) {
|
|
12652
13446
|
this.removeFocus();
|
|
12653
|
-
this.
|
|
12654
|
-
|
|
12655
|
-
|
|
13447
|
+
if (this.enableVirtualization && isVirtualKeyAction) {
|
|
13448
|
+
this.addListFocus(elements[temp]);
|
|
13449
|
+
}
|
|
13450
|
+
else {
|
|
13451
|
+
this.addListFocus(elements[++temp]);
|
|
13452
|
+
}
|
|
13453
|
+
if (temp > -1) {
|
|
13454
|
+
this.updateCheck(elements[temp]);
|
|
13455
|
+
this.scrollBottom(elements[temp], temp);
|
|
13456
|
+
this.currentFocuedListElement = elements[temp];
|
|
13457
|
+
}
|
|
12656
13458
|
}
|
|
12657
13459
|
}
|
|
12658
13460
|
else {
|
|
12659
13461
|
if (temp > 0) {
|
|
12660
|
-
this.
|
|
12661
|
-
|
|
12662
|
-
|
|
12663
|
-
|
|
13462
|
+
if (this.enableVirtualization) {
|
|
13463
|
+
var isVirtualElement = elements[temp - 1].classList.contains('e-virtual-list');
|
|
13464
|
+
var elementIndex = isVirtualKeyAction ? temp : temp - 1;
|
|
13465
|
+
if (isVirtualKeyAction || !isVirtualElement) {
|
|
13466
|
+
this.removeFocus();
|
|
13467
|
+
}
|
|
13468
|
+
if (isVirtualKeyAction || !isVirtualElement) {
|
|
13469
|
+
this.addListFocus(elements[elementIndex]);
|
|
13470
|
+
this.updateCheck(elements[elementIndex]);
|
|
13471
|
+
this.scrollTop(elements[elementIndex], temp);
|
|
13472
|
+
this.currentFocuedListElement = elements[elementIndex];
|
|
13473
|
+
}
|
|
13474
|
+
}
|
|
13475
|
+
else {
|
|
13476
|
+
this.removeFocus();
|
|
13477
|
+
this.addListFocus(elements[--temp]);
|
|
13478
|
+
this.updateCheck(elements[temp]);
|
|
13479
|
+
this.scrollTop(elements[temp], temp);
|
|
13480
|
+
}
|
|
12664
13481
|
}
|
|
12665
13482
|
}
|
|
12666
13483
|
}
|
|
12667
13484
|
}
|
|
12668
13485
|
};
|
|
13486
|
+
MultiSelect.prototype.getElementByValue = function (value) {
|
|
13487
|
+
var item;
|
|
13488
|
+
var listItems = this.getItems();
|
|
13489
|
+
for (var _i = 0, listItems_1 = listItems; _i < listItems_1.length; _i++) {
|
|
13490
|
+
var liItem = listItems_1[_i];
|
|
13491
|
+
if (this.getFormattedValue(liItem.getAttribute('data-value')) === value) {
|
|
13492
|
+
item = liItem;
|
|
13493
|
+
break;
|
|
13494
|
+
}
|
|
13495
|
+
}
|
|
13496
|
+
return item;
|
|
13497
|
+
};
|
|
12669
13498
|
MultiSelect.prototype.updateCheck = function (element) {
|
|
12670
13499
|
if (this.mode === 'CheckBox' && this.enableGroupCheckBox &&
|
|
12671
13500
|
!isNullOrUndefined(this.fields.groupBy)) {
|
|
@@ -12727,7 +13556,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
12727
13556
|
if (this.enabled && !this.readonly) {
|
|
12728
13557
|
var element = e.target.parentElement;
|
|
12729
13558
|
var customVal = element.getAttribute('data-value');
|
|
12730
|
-
var value = this.getFormattedValue(customVal);
|
|
13559
|
+
var value = this.allowObjectBinding ? this.getDataByValue(customVal) : this.getFormattedValue(customVal);
|
|
12731
13560
|
if (this.allowCustomValue && ((customVal !== 'false' && value === false) ||
|
|
12732
13561
|
(!isNullOrUndefined(value) && value.toString() === 'NaN'))) {
|
|
12733
13562
|
value = customVal;
|
|
@@ -12739,6 +13568,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
12739
13568
|
this.inputElement.focus();
|
|
12740
13569
|
}
|
|
12741
13570
|
this.removeValue(value, e);
|
|
13571
|
+
value = this.allowObjectBinding ? getValue((this.fields.value) ? this.fields.value : '', value) : value;
|
|
12742
13572
|
if (isNullOrUndefined(this.findListElement(this.list, 'li', 'data-value', value)) && this.mainList && this.listData) {
|
|
12743
13573
|
var list = this.mainList.cloneNode ? this.mainList.cloneNode(true) : this.mainList;
|
|
12744
13574
|
this.onActionComplete(list, this.mainData);
|
|
@@ -12773,7 +13603,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
12773
13603
|
this.expandTextbox();
|
|
12774
13604
|
};
|
|
12775
13605
|
MultiSelect.prototype.removeAllItems = function (value, eve, isClearAll, element, mainElement) {
|
|
12776
|
-
var index = this.value.indexOf(value);
|
|
13606
|
+
var index = this.allowObjectBinding ? this.indexOfObjectInArray(value, this.value) : this.value.indexOf(value);
|
|
12777
13607
|
var removeVal = this.value.slice(0);
|
|
12778
13608
|
removeVal.splice(index, 1);
|
|
12779
13609
|
this.setProperties({ value: [].concat([], removeVal) }, true);
|
|
@@ -12788,7 +13618,8 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
12788
13618
|
e: this, index: index
|
|
12789
13619
|
});
|
|
12790
13620
|
this.invokeCheckboxSelection(element, eve, isClearAll);
|
|
12791
|
-
this.
|
|
13621
|
+
var currentValue = this.allowObjectBinding ? getValue(((this.fields.value) ? this.fields.value : ''), value) : value;
|
|
13622
|
+
this.updateMainList(true, currentValue, mainElement);
|
|
12792
13623
|
this.updateChipStatus();
|
|
12793
13624
|
};
|
|
12794
13625
|
MultiSelect.prototype.invokeCheckboxSelection = function (element, eve, isClearAll) {
|
|
@@ -12805,9 +13636,9 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
12805
13636
|
};
|
|
12806
13637
|
MultiSelect.prototype.removeValue = function (value, eve, length, isClearAll) {
|
|
12807
13638
|
var _this = this;
|
|
12808
|
-
var index = this.value.indexOf(this.getFormattedValue(value));
|
|
13639
|
+
var index = this.allowObjectBinding ? this.indexOfObjectInArray(value, this.value) : this.value.indexOf(this.getFormattedValue(value));
|
|
12809
13640
|
if (index === -1 && this.allowCustomValue && !isNullOrUndefined(value)) {
|
|
12810
|
-
index = this.value.indexOf(value.toString());
|
|
13641
|
+
index = this.allowObjectBinding ? this.indexOfObjectInArray(value, this.value) : this.value.indexOf(value.toString());
|
|
12811
13642
|
}
|
|
12812
13643
|
var targetEle = eve && eve.target;
|
|
12813
13644
|
isClearAll = (isClearAll || targetEle && targetEle.classList.contains('e-close-hooker')) ? true : null;
|
|
@@ -12815,7 +13646,8 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
12815
13646
|
HIDE_LIST :
|
|
12816
13647
|
dropDownBaseClasses.selected;
|
|
12817
13648
|
if (index !== -1) {
|
|
12818
|
-
var
|
|
13649
|
+
var currentValue = this.allowObjectBinding ? getValue(((this.fields.value) ? this.fields.value : ''), value) : value;
|
|
13650
|
+
var element_1 = this.findListElement(this.list, 'li', 'data-value', currentValue);
|
|
12819
13651
|
var val_1 = this.getDataByValue(value);
|
|
12820
13652
|
var eventArgs = {
|
|
12821
13653
|
e: eve,
|
|
@@ -12829,11 +13661,20 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
12829
13661
|
_this.removeIndex++;
|
|
12830
13662
|
}
|
|
12831
13663
|
else {
|
|
13664
|
+
_this.virtualSelectAll = false;
|
|
12832
13665
|
var removeVal = _this.value.slice(0);
|
|
13666
|
+
if (_this.enableVirtualization && isClearAll) {
|
|
13667
|
+
removeVal = [];
|
|
13668
|
+
}
|
|
12833
13669
|
removeVal.splice(index, 1);
|
|
12834
13670
|
_this.setProperties({ value: [].concat([], removeVal) }, true);
|
|
13671
|
+
if (_this.enableVirtualization) {
|
|
13672
|
+
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], '');
|
|
13673
|
+
_this.setProperties({ text: currentText.toString() }, true);
|
|
13674
|
+
}
|
|
12835
13675
|
if (element_1 !== null) {
|
|
12836
|
-
var
|
|
13676
|
+
var currentValue_1 = _this.allowObjectBinding ? getValue(((_this.fields.value) ? _this.fields.value : ''), value) : value;
|
|
13677
|
+
var hideElement = _this.findListElement(_this.mainList, 'li', 'data-value', currentValue_1);
|
|
12837
13678
|
element_1.setAttribute('aria-selected', 'false');
|
|
12838
13679
|
removeClass([element_1], className);
|
|
12839
13680
|
if (hideElement) {
|
|
@@ -12847,15 +13688,16 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
12847
13688
|
});
|
|
12848
13689
|
_this.invokeCheckboxSelection(element_1, eve, isClearAll);
|
|
12849
13690
|
}
|
|
13691
|
+
var currentValue_2 = _this.allowObjectBinding ? getValue(((_this.fields.value) ? _this.fields.value : ''), value) : value;
|
|
12850
13692
|
if (_this.hideSelectedItem && _this.fields.groupBy && element_1) {
|
|
12851
|
-
_this.hideGroupItem(
|
|
13693
|
+
_this.hideGroupItem(currentValue_2);
|
|
12852
13694
|
}
|
|
12853
13695
|
if (_this.hideSelectedItem && _this.fixedHeaderElement && _this.fields.groupBy && _this.mode !== 'CheckBox' &&
|
|
12854
13696
|
_this.isPopupOpen()) {
|
|
12855
13697
|
_super.prototype.scrollStop.call(_this);
|
|
12856
13698
|
}
|
|
12857
|
-
_this.updateMainList(true,
|
|
12858
|
-
_this.removeChip(
|
|
13699
|
+
_this.updateMainList(true, currentValue_2);
|
|
13700
|
+
_this.removeChip(currentValue_2, isClearAll);
|
|
12859
13701
|
_this.updateChipStatus();
|
|
12860
13702
|
var limit = _this.value && _this.value.length ? _this.value.length : 0;
|
|
12861
13703
|
if (limit < _this.maximumSelectionLength) {
|
|
@@ -12891,6 +13733,14 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
12891
13733
|
if (isClearAll && (length === 1 || length === null)) {
|
|
12892
13734
|
_this.clearAllCallback(eve, isClearAll);
|
|
12893
13735
|
}
|
|
13736
|
+
if (_this.isPopupOpen() && element_1 && element_1.parentElement.classList.contains('e-reorder')) {
|
|
13737
|
+
if (_this.hideSelectedItem && _this.value && Array.isArray(_this.value) && _this.value.length > 0) {
|
|
13738
|
+
_this.totalItemsCount();
|
|
13739
|
+
}
|
|
13740
|
+
_this.notify("setCurrentViewDataAsync", {
|
|
13741
|
+
module: "VirtualScroll",
|
|
13742
|
+
});
|
|
13743
|
+
}
|
|
12894
13744
|
}
|
|
12895
13745
|
});
|
|
12896
13746
|
}
|
|
@@ -12921,11 +13771,16 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
12921
13771
|
}
|
|
12922
13772
|
}
|
|
12923
13773
|
};
|
|
12924
|
-
MultiSelect.prototype.removeChip = function (value) {
|
|
13774
|
+
MultiSelect.prototype.removeChip = function (value, isClearAll) {
|
|
12925
13775
|
if (this.chipCollectionWrapper) {
|
|
12926
|
-
|
|
12927
|
-
|
|
12928
|
-
|
|
13776
|
+
if (this.enableVirtualization && isClearAll) {
|
|
13777
|
+
var childElements = this.chipCollectionWrapper.querySelectorAll('.e-chips');
|
|
13778
|
+
}
|
|
13779
|
+
else {
|
|
13780
|
+
var element = this.findListElement(this.chipCollectionWrapper, 'span', 'data-value', value);
|
|
13781
|
+
if (element) {
|
|
13782
|
+
remove(element);
|
|
13783
|
+
}
|
|
12929
13784
|
}
|
|
12930
13785
|
}
|
|
12931
13786
|
};
|
|
@@ -12959,12 +13814,45 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
12959
13814
|
this.hideOverAllClear();
|
|
12960
13815
|
}
|
|
12961
13816
|
};
|
|
13817
|
+
MultiSelect.prototype.indexOfObjectInArray = function (objectToFind, array) {
|
|
13818
|
+
var _loop_1 = function (i) {
|
|
13819
|
+
var item = array[i];
|
|
13820
|
+
if (Object.keys(objectToFind).every(function (key) { return item.hasOwnProperty(key) && item[key] === objectToFind[key]; })) {
|
|
13821
|
+
return { value: i };
|
|
13822
|
+
}
|
|
13823
|
+
};
|
|
13824
|
+
for (var i = 0; i < array.length; i++) {
|
|
13825
|
+
var state_1 = _loop_1(i);
|
|
13826
|
+
if (typeof state_1 === "object")
|
|
13827
|
+
return state_1.value;
|
|
13828
|
+
}
|
|
13829
|
+
return -1; // Return -1 if the object is not found
|
|
13830
|
+
};
|
|
12962
13831
|
MultiSelect.prototype.addValue = function (value, text, eve) {
|
|
12963
13832
|
if (!this.value) {
|
|
12964
13833
|
this.value = [];
|
|
12965
13834
|
}
|
|
12966
|
-
|
|
12967
|
-
|
|
13835
|
+
var currentValue = this.allowObjectBinding ? this.getDataByValue(value) : value;
|
|
13836
|
+
if ((this.allowObjectBinding && !this.isObjectInArray(value, this.value)) || (!this.allowObjectBinding && this.value.indexOf(currentValue) < 0)) {
|
|
13837
|
+
this.setProperties({ value: [].concat([], this.value, [currentValue]) }, true);
|
|
13838
|
+
if (this.enableVirtualization) {
|
|
13839
|
+
var data = this.viewWrapper.innerHTML;
|
|
13840
|
+
var temp = void 0;
|
|
13841
|
+
data += (this.value.length === 1) ? '' : this.delimiterChar + ' ';
|
|
13842
|
+
temp = this.getOverflowVal(this.value.length - 1);
|
|
13843
|
+
data += temp;
|
|
13844
|
+
temp = this.viewWrapper.innerHTML;
|
|
13845
|
+
this.updateWrapperText(this.viewWrapper, data);
|
|
13846
|
+
}
|
|
13847
|
+
if (this.enableVirtualization && this.mode === 'CheckBox') {
|
|
13848
|
+
var temp = void 0;
|
|
13849
|
+
var currentText = [];
|
|
13850
|
+
var value_1 = this.allowObjectBinding ? getValue(((this.fields.value) ? this.fields.value : ''), this.value[this.value.length - 1]) : this.value[this.value.length - 1];
|
|
13851
|
+
temp = this.getTextByValue(value_1);
|
|
13852
|
+
var textValues = this.text != null ? this.text + ',' + temp : temp;
|
|
13853
|
+
currentText.push(textValues);
|
|
13854
|
+
this.setProperties({ text: currentText.toString() }, true);
|
|
13855
|
+
}
|
|
12968
13856
|
}
|
|
12969
13857
|
var element = this.findListElement(this.list, 'li', 'data-value', value);
|
|
12970
13858
|
this.removeFocus();
|
|
@@ -12993,6 +13881,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
12993
13881
|
var _this = this;
|
|
12994
13882
|
var list = this.listData;
|
|
12995
13883
|
if (this.initStatus && !isNotTrigger) {
|
|
13884
|
+
value = this.allowObjectBinding ? getValue(((this.fields.value) ? this.fields.value : ''), value) : value;
|
|
12996
13885
|
var val_2 = this.getDataByValue(value);
|
|
12997
13886
|
var eventArgs = {
|
|
12998
13887
|
e: eve,
|
|
@@ -13021,7 +13910,10 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
13021
13910
|
if (_this.allowCustomValue && _this.isServerRendered && _this.listData !== list) {
|
|
13022
13911
|
_this.listData = list;
|
|
13023
13912
|
}
|
|
13024
|
-
_this.
|
|
13913
|
+
value = _this.allowObjectBinding ? _this.getDataByValue(value) : value;
|
|
13914
|
+
if ((_this.enableVirtualization && value) || !_this.enableVirtualization) {
|
|
13915
|
+
_this.updateListSelectEventCallback(value, element, eve);
|
|
13916
|
+
}
|
|
13025
13917
|
if (_this.hideSelectedItem && _this.fixedHeaderElement && _this.fields.groupBy && _this.mode !== 'CheckBox') {
|
|
13026
13918
|
_super.prototype.scrollStop.call(_this);
|
|
13027
13919
|
}
|
|
@@ -13106,7 +13998,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
13106
13998
|
chipContent.innerText = data;
|
|
13107
13999
|
}
|
|
13108
14000
|
else {
|
|
13109
|
-
chipContent.innerHTML = this.encodeHtmlEntities(data);
|
|
14001
|
+
chipContent.innerHTML = this.encodeHtmlEntities(data.toString());
|
|
13110
14002
|
}
|
|
13111
14003
|
chip.appendChild(chipContent);
|
|
13112
14004
|
var eventArgs = {
|
|
@@ -13192,6 +14084,37 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
13192
14084
|
overAllHeight -= this.header.offsetHeight;
|
|
13193
14085
|
}
|
|
13194
14086
|
append([this.list], this.popupWrapper);
|
|
14087
|
+
if (!this.list.classList.contains(dropDownBaseClasses.noData) && this.getItems()[1]) {
|
|
14088
|
+
this.listItemHeight = this.getItems()[1].offsetHeight;
|
|
14089
|
+
}
|
|
14090
|
+
if (this.enableVirtualization && !this.list.classList.contains(dropDownBaseClasses.noData)) {
|
|
14091
|
+
if (!this.list.querySelector('.e-virtual-ddl-content') && this.list.querySelector('.e-list-parent')) {
|
|
14092
|
+
this.list.appendChild(this.createElement('div', {
|
|
14093
|
+
className: 'e-virtual-ddl-content',
|
|
14094
|
+
styles: this.getTransformValues()
|
|
14095
|
+
})).appendChild(this.list.querySelector('.e-list-parent'));
|
|
14096
|
+
}
|
|
14097
|
+
else if (this.list.querySelector('.e-virtual-ddl-content')) {
|
|
14098
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14099
|
+
this.list.getElementsByClassName('e-virtual-ddl-content')[0].style = this.getTransformValues();
|
|
14100
|
+
}
|
|
14101
|
+
this.UpdateSkeleton();
|
|
14102
|
+
this.liCollections = this.list.querySelectorAll('.' + dropDownBaseClasses.li);
|
|
14103
|
+
this.virtualItemCount = this.itemCount;
|
|
14104
|
+
if (this.mode !== 'CheckBox') {
|
|
14105
|
+
this.totalItemCount = this.value && this.value.length ? this.totalItemCount - this.value.length : this.totalItemCount;
|
|
14106
|
+
}
|
|
14107
|
+
if (!this.list.querySelector('.e-virtual-ddl')) {
|
|
14108
|
+
var virualElement = this.createElement('div', {
|
|
14109
|
+
id: this.element.id + '_popup', className: 'e-virtual-ddl', styles: this.GetVirtualTrackHeight()
|
|
14110
|
+
});
|
|
14111
|
+
this.popupWrapper.querySelector('.e-dropdownbase').appendChild(virualElement);
|
|
14112
|
+
}
|
|
14113
|
+
else {
|
|
14114
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14115
|
+
this.list.getElementsByClassName('e-virtual-ddl')[0].style = this.GetVirtualTrackHeight();
|
|
14116
|
+
}
|
|
14117
|
+
}
|
|
13195
14118
|
if (this.footerTemplate) {
|
|
13196
14119
|
this.setFooterTemplate();
|
|
13197
14120
|
overAllHeight -= this.footer.offsetHeight;
|
|
@@ -13264,21 +14187,41 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
13264
14187
|
}
|
|
13265
14188
|
_this.popupObj.wireScrollEvents();
|
|
13266
14189
|
if (!(_this.mode !== 'CheckBox' && (_this.allowFiltering || _this.allowCustomValue) &&
|
|
13267
|
-
_this.targetElement().trim() !== '')) {
|
|
14190
|
+
_this.targetElement().trim() !== '') && !_this.enableVirtualization) {
|
|
13268
14191
|
_this.loadTemplate();
|
|
14192
|
+
if (_this.enableVirtualization && _this.mode === 'CheckBox') {
|
|
14193
|
+
_this.UpdateSkeleton();
|
|
14194
|
+
}
|
|
13269
14195
|
}
|
|
14196
|
+
_this.isPreventScrollAction = true;
|
|
13270
14197
|
_this.setScrollPosition();
|
|
13271
14198
|
if (_this.allowFiltering) {
|
|
13272
14199
|
_this.notify('inputFocus', {
|
|
13273
14200
|
module: 'CheckBoxSelection', enable: _this.mode === 'CheckBox', value: 'focus'
|
|
13274
14201
|
});
|
|
13275
14202
|
}
|
|
14203
|
+
if (_this.enableVirtualization) {
|
|
14204
|
+
_this.notify("bindScrollEvent", {
|
|
14205
|
+
module: "VirtualScroll",
|
|
14206
|
+
component: _this.getModuleName(),
|
|
14207
|
+
enable: _this.enableVirtualization,
|
|
14208
|
+
});
|
|
14209
|
+
setTimeout(function () {
|
|
14210
|
+
if (_this.value) {
|
|
14211
|
+
_this.updateSelectionList();
|
|
14212
|
+
}
|
|
14213
|
+
else if (_this.viewPortInfo && _this.viewPortInfo.offsets.top) {
|
|
14214
|
+
_this.list.scrollTop = _this.viewPortInfo.offsets.top;
|
|
14215
|
+
}
|
|
14216
|
+
}, 5);
|
|
14217
|
+
}
|
|
13276
14218
|
}, targetExitViewport: function () {
|
|
13277
14219
|
if (!Browser.isDevice) {
|
|
13278
14220
|
_this.hidePopup();
|
|
13279
14221
|
}
|
|
13280
14222
|
}
|
|
13281
14223
|
});
|
|
14224
|
+
this.popupContentElement = this.popupObj.element.querySelector('.e-content');
|
|
13282
14225
|
if (this.mode === 'CheckBox' && Browser.isDevice && this.allowFiltering) {
|
|
13283
14226
|
this.notify('deviceSearchBox', { module: 'CheckBoxSelection', enable: this.mode === 'CheckBox' });
|
|
13284
14227
|
}
|
|
@@ -13336,6 +14279,53 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
13336
14279
|
append([this.footer], this.popupWrapper);
|
|
13337
14280
|
EventHandler.add(this.footer, 'mousedown', this.onListMouseDown, this);
|
|
13338
14281
|
};
|
|
14282
|
+
MultiSelect.prototype.updateInitialData = function () {
|
|
14283
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14284
|
+
var currentData = this.selectData;
|
|
14285
|
+
var ulElement = this.renderItems(currentData, this.fields);
|
|
14286
|
+
this.list.scrollTop = 0;
|
|
14287
|
+
this.virtualListInfo = {
|
|
14288
|
+
currentPageNumber: null,
|
|
14289
|
+
direction: null,
|
|
14290
|
+
sentinelInfo: {},
|
|
14291
|
+
offsets: {},
|
|
14292
|
+
startIndex: 0,
|
|
14293
|
+
endIndex: 0,
|
|
14294
|
+
};
|
|
14295
|
+
this.previousStartIndex = 0;
|
|
14296
|
+
this.previousEndIndex = 0;
|
|
14297
|
+
if (this.dataSource instanceof DataManager) {
|
|
14298
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14299
|
+
this.totalItemCount = this.dataCount = this.virtualGroupDataSource && this.virtualGroupDataSource.length ? this.virtualGroupDataSource.length : 0;
|
|
14300
|
+
}
|
|
14301
|
+
else {
|
|
14302
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14303
|
+
this.totalItemCount = this.dataCount = this.dataSource && this.dataSource.length ? this.dataSource.length : 0;
|
|
14304
|
+
}
|
|
14305
|
+
if (this.mode !== 'CheckBox') {
|
|
14306
|
+
this.totalItemCount = this.value && this.value.length ? this.totalItemCount - this.value.length : this.totalItemCount;
|
|
14307
|
+
}
|
|
14308
|
+
this.getSkeletonCount();
|
|
14309
|
+
this.UpdateSkeleton();
|
|
14310
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14311
|
+
if (this.list.getElementsByClassName('e-virtual-ddl')[0]) {
|
|
14312
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14313
|
+
this.list.getElementsByClassName('e-virtual-ddl')[0].style = this.GetVirtualTrackHeight();
|
|
14314
|
+
}
|
|
14315
|
+
else if (!this.list.querySelector('.e-virtual-ddl') && this.skeletonCount > 0) {
|
|
14316
|
+
var virualElement = this.createElement('div', {
|
|
14317
|
+
id: this.element.id + '_popup', className: 'e-virtual-ddl', styles: this.GetVirtualTrackHeight()
|
|
14318
|
+
});
|
|
14319
|
+
this.popupWrapper.querySelector('.e-dropdownbase').appendChild(virualElement);
|
|
14320
|
+
}
|
|
14321
|
+
this.listData = currentData;
|
|
14322
|
+
this.liCollections = this.list.querySelectorAll('.e-list-item');
|
|
14323
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14324
|
+
if (this.list.getElementsByClassName('e-virtual-ddl-content')[0]) {
|
|
14325
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14326
|
+
this.list.getElementsByClassName('e-virtual-ddl-content')[0].style = this.getTransformValues();
|
|
14327
|
+
}
|
|
14328
|
+
};
|
|
13339
14329
|
MultiSelect.prototype.clearAll = function (e) {
|
|
13340
14330
|
if (this.enabled && !this.readonly) {
|
|
13341
14331
|
var temp = void 0;
|
|
@@ -13356,6 +14346,24 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
13356
14346
|
else {
|
|
13357
14347
|
this.clearAllCallback(e);
|
|
13358
14348
|
}
|
|
14349
|
+
this.checkAndResetCache();
|
|
14350
|
+
if (this.enableVirtualization) {
|
|
14351
|
+
this.updateInitialData();
|
|
14352
|
+
if (this.chipCollectionWrapper) {
|
|
14353
|
+
this.chipCollectionWrapper.innerHTML = '';
|
|
14354
|
+
}
|
|
14355
|
+
if (!this.isCustomDataUpdated) {
|
|
14356
|
+
this.notify("setGeneratedData", {
|
|
14357
|
+
module: "VirtualScroll",
|
|
14358
|
+
});
|
|
14359
|
+
}
|
|
14360
|
+
}
|
|
14361
|
+
if (this.enableVirtualization) {
|
|
14362
|
+
this.list.scrollTop = 0;
|
|
14363
|
+
this.virtualListInfo = null;
|
|
14364
|
+
this.previousStartIndex = 0;
|
|
14365
|
+
this.previousEndIndex = 0;
|
|
14366
|
+
}
|
|
13359
14367
|
}
|
|
13360
14368
|
};
|
|
13361
14369
|
MultiSelect.prototype.clearAllCallback = function (e, isClearAll) {
|
|
@@ -13456,6 +14464,8 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
13456
14464
|
MultiSelect.prototype.search = function (e) {
|
|
13457
14465
|
var _this = this;
|
|
13458
14466
|
this.resetFilteredData = true;
|
|
14467
|
+
this.preventSetCurrentData = false;
|
|
14468
|
+
this.firstItem = this.dataSource && this.dataSource.length > 0 ? this.dataSource[0] : null;
|
|
13459
14469
|
if (!isNullOrUndefined(e)) {
|
|
13460
14470
|
this.keyCode = e.keyCode;
|
|
13461
14471
|
}
|
|
@@ -13472,6 +14482,9 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
13472
14482
|
if (this.allowCustomValue) {
|
|
13473
14483
|
this.isRemoteSelection = true;
|
|
13474
14484
|
}
|
|
14485
|
+
if (!this.backCommand) {
|
|
14486
|
+
this.checkAndResetCache();
|
|
14487
|
+
}
|
|
13475
14488
|
var eventArgs_1 = {
|
|
13476
14489
|
preventDefaultAction: false,
|
|
13477
14490
|
text: this.targetElement(),
|
|
@@ -13498,12 +14511,83 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
13498
14511
|
else if (this.allowCustomValue) {
|
|
13499
14512
|
var query = new Query();
|
|
13500
14513
|
query = this.allowFiltering && (text !== '') ? query.where(this.fields.text, 'startswith', text, this.ignoreCase, this.ignoreAccent) : query;
|
|
13501
|
-
|
|
14514
|
+
if (this.enableVirtualization) {
|
|
14515
|
+
if (this.dataSource instanceof DataManager) {
|
|
14516
|
+
this.dataUpdater(this.virtualGroupDataSource, query, this.fields);
|
|
14517
|
+
}
|
|
14518
|
+
else {
|
|
14519
|
+
this.dataUpdater(this.dataSource, query, this.fields);
|
|
14520
|
+
}
|
|
14521
|
+
}
|
|
14522
|
+
else {
|
|
14523
|
+
this.dataUpdater(this.mainData, query, this.fields);
|
|
14524
|
+
}
|
|
14525
|
+
this.UpdateSkeleton();
|
|
13502
14526
|
}
|
|
13503
14527
|
else {
|
|
13504
14528
|
var liCollections = this.list.querySelectorAll('li.' + dropDownBaseClasses.li + ':not(.e-hide-listitem)');
|
|
14529
|
+
var type = this.typeOfData(this.listData).typeof;
|
|
13505
14530
|
var activeElement = Search(this.targetElement(), liCollections, 'StartsWith', this.ignoreCase);
|
|
13506
|
-
if (
|
|
14531
|
+
if (this.enableVirtualization && this.targetElement().trim() !== '' && !this.allowFiltering) {
|
|
14532
|
+
var updatingincrementalindex = false;
|
|
14533
|
+
if ((this.viewPortInfo.endIndex >= this.incrementalEndIndex && this.incrementalEndIndex <= this.totalItemCount) || this.incrementalEndIndex == 0) {
|
|
14534
|
+
updatingincrementalindex = true;
|
|
14535
|
+
this.incrementalStartIndex = 0;
|
|
14536
|
+
this.incrementalEndIndex = 100 > this.totalItemCount ? this.totalItemCount : 100;
|
|
14537
|
+
this.updateIncrementalInfo(this.incrementalStartIndex, this.incrementalEndIndex);
|
|
14538
|
+
updatingincrementalindex = false;
|
|
14539
|
+
}
|
|
14540
|
+
if (this.viewPortInfo.startIndex !== 0 || updatingincrementalindex) {
|
|
14541
|
+
this.updateIncrementalView(0, this.itemCount);
|
|
14542
|
+
}
|
|
14543
|
+
activeElement = Search(this.targetElement(), this.incrementalLiCollections, this.filterType, true, this.listData, this.fields, type);
|
|
14544
|
+
while (isNullOrUndefined(activeElement) && this.incrementalEndIndex < this.totalItemCount) {
|
|
14545
|
+
this.incrementalStartIndex = this.incrementalEndIndex;
|
|
14546
|
+
this.incrementalEndIndex = this.incrementalEndIndex + 100 > this.totalItemCount ? this.totalItemCount : this.incrementalEndIndex + 100;
|
|
14547
|
+
this.updateIncrementalInfo(this.incrementalStartIndex, this.incrementalEndIndex);
|
|
14548
|
+
updatingincrementalindex = true;
|
|
14549
|
+
if (this.viewPortInfo.startIndex !== 0 || updatingincrementalindex) {
|
|
14550
|
+
this.updateIncrementalView(0, this.itemCount);
|
|
14551
|
+
}
|
|
14552
|
+
activeElement = Search(this.targetElement(), this.incrementalLiCollections, this.filterType, true, this.listData, this.fields, type);
|
|
14553
|
+
if (!isNullOrUndefined(activeElement)) {
|
|
14554
|
+
break;
|
|
14555
|
+
}
|
|
14556
|
+
if (isNullOrUndefined(activeElement) && this.incrementalEndIndex >= this.totalItemCount) {
|
|
14557
|
+
this.incrementalStartIndex = 0;
|
|
14558
|
+
this.incrementalEndIndex = 100 > this.totalItemCount ? this.totalItemCount : 100;
|
|
14559
|
+
break;
|
|
14560
|
+
}
|
|
14561
|
+
}
|
|
14562
|
+
if (activeElement.index) {
|
|
14563
|
+
if ((!(this.viewPortInfo.startIndex >= activeElement.index)) || (!(activeElement.index >= this.viewPortInfo.endIndex))) {
|
|
14564
|
+
var startIndex = activeElement.index - ((this.itemCount / 2) - 2) > 0 ? activeElement.index - ((this.itemCount / 2) - 2) : 0;
|
|
14565
|
+
var endIndex = startIndex + this.itemCount > this.totalItemCount ? this.totalItemCount : startIndex + this.itemCount;
|
|
14566
|
+
if (startIndex != this.viewPortInfo.startIndex) {
|
|
14567
|
+
this.updateIncrementalView(startIndex, endIndex);
|
|
14568
|
+
}
|
|
14569
|
+
}
|
|
14570
|
+
}
|
|
14571
|
+
if (!isNullOrUndefined(activeElement.item)) {
|
|
14572
|
+
var index_1 = this.getIndexByValue(activeElement.item.getAttribute('data-value')) - this.skeletonCount;
|
|
14573
|
+
if (index_1 > this.itemCount / 2) {
|
|
14574
|
+
var startIndex = this.viewPortInfo.startIndex + ((this.itemCount / 2) - 2) < this.totalItemCount ? this.viewPortInfo.startIndex + ((this.itemCount / 2) - 2) : this.totalItemCount;
|
|
14575
|
+
var endIndex = this.viewPortInfo.startIndex + this.itemCount > this.totalItemCount ? this.totalItemCount : this.viewPortInfo.startIndex + this.itemCount;
|
|
14576
|
+
this.updateIncrementalView(startIndex, endIndex);
|
|
14577
|
+
}
|
|
14578
|
+
activeElement.item = this.getElementByValue(activeElement.item.getAttribute('data-value'));
|
|
14579
|
+
}
|
|
14580
|
+
else {
|
|
14581
|
+
this.updateIncrementalView(0, this.itemCount);
|
|
14582
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14583
|
+
this.list.getElementsByClassName('e-virtual-ddl-content')[0].style = this.getTransformValues();
|
|
14584
|
+
this.list.scrollTop = 0;
|
|
14585
|
+
}
|
|
14586
|
+
if (activeElement && activeElement.item) {
|
|
14587
|
+
activeElement.item = this.getElementByValue(activeElement.item.getAttribute('data-value'));
|
|
14588
|
+
}
|
|
14589
|
+
}
|
|
14590
|
+
if (activeElement && activeElement.item) {
|
|
13507
14591
|
this.addListFocus(activeElement.item);
|
|
13508
14592
|
this.list.scrollTop =
|
|
13509
14593
|
activeElement.item.offsetHeight * activeElement.index;
|
|
@@ -13516,11 +14600,15 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
13516
14600
|
}
|
|
13517
14601
|
}
|
|
13518
14602
|
}
|
|
14603
|
+
if (this.enableVirtualization && this.allowFiltering) {
|
|
14604
|
+
this.getFilteringSkeletonCount();
|
|
14605
|
+
}
|
|
13519
14606
|
};
|
|
13520
14607
|
MultiSelect.prototype.preRender = function () {
|
|
13521
14608
|
if (this.allowFiltering === null) {
|
|
13522
14609
|
this.allowFiltering = (this.mode === 'CheckBox') ? true : false;
|
|
13523
14610
|
}
|
|
14611
|
+
this.preventSetCurrentData = false;
|
|
13524
14612
|
this.initializeData();
|
|
13525
14613
|
this.updateDataAttribute(this.htmlAttributes);
|
|
13526
14614
|
_super.prototype.preRender.call(this);
|
|
@@ -13542,6 +14630,14 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
13542
14630
|
this.isCustomRendered = false;
|
|
13543
14631
|
this.isRemoteSelection = false;
|
|
13544
14632
|
this.isSelectAllTarget = true;
|
|
14633
|
+
this.viewPortInfo = {
|
|
14634
|
+
currentPageNumber: null,
|
|
14635
|
+
direction: null,
|
|
14636
|
+
sentinelInfo: {},
|
|
14637
|
+
offsets: {},
|
|
14638
|
+
startIndex: 0,
|
|
14639
|
+
endIndex: this.itemCount,
|
|
14640
|
+
};
|
|
13545
14641
|
};
|
|
13546
14642
|
MultiSelect.prototype.updateData = function (delimiterChar, e) {
|
|
13547
14643
|
var data = '';
|
|
@@ -13549,7 +14645,9 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
13549
14645
|
var text = [];
|
|
13550
14646
|
var temp;
|
|
13551
14647
|
var tempData = this.listData;
|
|
13552
|
-
this.
|
|
14648
|
+
if (!this.enableVirtualization) {
|
|
14649
|
+
this.listData = this.mainData;
|
|
14650
|
+
}
|
|
13553
14651
|
if (!isNullOrUndefined(this.hiddenElement)) {
|
|
13554
14652
|
this.hiddenElement.innerHTML = '';
|
|
13555
14653
|
}
|
|
@@ -13557,16 +14655,32 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
13557
14655
|
var valueLength = this.value.length;
|
|
13558
14656
|
var hiddenElementContent = '';
|
|
13559
14657
|
for (var index = 0; index < valueLength; index++) {
|
|
13560
|
-
var valueItem = this.value[index];
|
|
14658
|
+
var valueItem = this.allowObjectBinding ? getValue((this.fields.value) ? this.fields.value : '', this.value[index]) : this.value[index];
|
|
13561
14659
|
var listValue = this.findListElement((!isNullOrUndefined(this.mainList) ? this.mainList : this.ulElement), 'li', 'data-value', valueItem);
|
|
13562
|
-
if (
|
|
14660
|
+
if (this.enableVirtualization) {
|
|
14661
|
+
listValue = this.findListElement((!isNullOrUndefined(this.list) ? this.list : this.ulElement), 'li', 'data-value', valueItem);
|
|
14662
|
+
}
|
|
14663
|
+
if (isNullOrUndefined(listValue) && !this.allowCustomValue && !this.enableVirtualization) {
|
|
13563
14664
|
this.value.splice(index, 1);
|
|
13564
14665
|
index -= 1;
|
|
13565
14666
|
valueLength -= 1;
|
|
13566
14667
|
}
|
|
13567
14668
|
else {
|
|
13568
14669
|
if (this.listData) {
|
|
13569
|
-
|
|
14670
|
+
if (this.enableVirtualization) {
|
|
14671
|
+
if (delim) {
|
|
14672
|
+
data = this.delimiterWrapper && this.delimiterWrapper.innerHTML == "" ? data : this.delimiterWrapper.innerHTML;
|
|
14673
|
+
}
|
|
14674
|
+
var value = this.allowObjectBinding ? getValue(((this.fields.value) ? this.fields.value : ''), this.value[this.value.length - 1]) : this.value[this.value.length - 1];
|
|
14675
|
+
temp = this.getTextByValue(value);
|
|
14676
|
+
var textValues = this.text != null && this.text != "" ? this.text + ',' + temp : temp;
|
|
14677
|
+
data += temp + delimiterChar + ' ';
|
|
14678
|
+
text.push(textValues);
|
|
14679
|
+
break;
|
|
14680
|
+
}
|
|
14681
|
+
else {
|
|
14682
|
+
temp = this.getTextByValue(valueItem);
|
|
14683
|
+
}
|
|
13570
14684
|
}
|
|
13571
14685
|
else {
|
|
13572
14686
|
temp = valueItem;
|
|
@@ -13580,7 +14694,10 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
13580
14694
|
this.hiddenElement.innerHTML = hiddenElementContent;
|
|
13581
14695
|
}
|
|
13582
14696
|
}
|
|
13583
|
-
|
|
14697
|
+
var isChipRemove = e && e.target && e.target.classList.contains('e-chips-close');
|
|
14698
|
+
if (!this.enableVirtualization || (this.enableVirtualization && this.mode !== 'CheckBox' && !isChipRemove)) {
|
|
14699
|
+
this.setProperties({ text: text.toString() }, true);
|
|
14700
|
+
}
|
|
13584
14701
|
if (delim) {
|
|
13585
14702
|
this.updateWrapperText(this.delimiterWrapper, data);
|
|
13586
14703
|
this.delimiterWrapper.setAttribute('id', getUniqueID('delim_val'));
|
|
@@ -13609,7 +14726,8 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
13609
14726
|
}
|
|
13610
14727
|
}
|
|
13611
14728
|
if (textVal && textVal.length) {
|
|
13612
|
-
this.
|
|
14729
|
+
var value = this.allowObjectBinding ? this.getDataByValue(textVal) : textVal;
|
|
14730
|
+
this.setProperties({ value: value }, true);
|
|
13613
14731
|
}
|
|
13614
14732
|
}
|
|
13615
14733
|
else {
|
|
@@ -13622,10 +14740,12 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
13622
14740
|
isEmptyData = true;
|
|
13623
14741
|
}
|
|
13624
14742
|
_super.prototype.render.call(this, null, isEmptyData);
|
|
14743
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14744
|
+
this.totalItemCount = this.dataSource && this.dataSource.length ? this.dataSource.length : 0;
|
|
13625
14745
|
this.unwireListEvents();
|
|
13626
14746
|
this.wireListEvents();
|
|
13627
14747
|
};
|
|
13628
|
-
MultiSelect.prototype.initialValueUpdate = function () {
|
|
14748
|
+
MultiSelect.prototype.initialValueUpdate = function (listItems) {
|
|
13629
14749
|
if (this.list) {
|
|
13630
14750
|
var text = void 0;
|
|
13631
14751
|
var element = void 0;
|
|
@@ -13636,12 +14756,34 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
13636
14756
|
this.removeListSelection();
|
|
13637
14757
|
if (!isNullOrUndefined(this.value)) {
|
|
13638
14758
|
for (var index = 0; !isNullOrUndefined(this.value[index]); index++) {
|
|
13639
|
-
value = this.value[index];
|
|
14759
|
+
value = this.allowObjectBinding ? getValue(((this.fields.value) ? this.fields.value : ''), this.value[index]) : this.value[index];
|
|
13640
14760
|
element = this.findListElement(this.hideSelectedItem ? this.ulElement : this.list, 'li', 'data-value', value);
|
|
13641
|
-
|
|
13642
|
-
if (
|
|
14761
|
+
var isCustomData = false;
|
|
14762
|
+
if (this.enableVirtualization) {
|
|
14763
|
+
text = null;
|
|
14764
|
+
if (listItems != null && listItems.length > 0) {
|
|
14765
|
+
for (var i = 0; i < listItems.length; i++) {
|
|
14766
|
+
if (getValue((this.fields.value ? this.fields.value : 'value'), listItems[i]) === value) {
|
|
14767
|
+
text = getValue(this.fields.text, listItems[i]);
|
|
14768
|
+
break;
|
|
14769
|
+
}
|
|
14770
|
+
}
|
|
14771
|
+
}
|
|
14772
|
+
if (isNullOrUndefined(text) && this.allowCustomValue) {
|
|
14773
|
+
text = this.getTextByValue(value);
|
|
14774
|
+
isCustomData = true;
|
|
14775
|
+
}
|
|
14776
|
+
}
|
|
14777
|
+
else {
|
|
14778
|
+
text = this.getTextByValue(value);
|
|
14779
|
+
}
|
|
14780
|
+
if (((element && (element.getAttribute('aria-selected') !== 'true')) ||
|
|
13643
14781
|
(element && (element.getAttribute('aria-selected') === 'true' && this.hideSelectedItem) &&
|
|
13644
|
-
(this.mode === 'Box' || this.mode === 'Default'))) {
|
|
14782
|
+
(this.mode === 'Box' || this.mode === 'Default'))) || (this.enableVirtualization && value != null && text != null && !isCustomData)) {
|
|
14783
|
+
var currentText = [];
|
|
14784
|
+
var textValues = this.text != null ? this.text + ',' + text : text;
|
|
14785
|
+
currentText.push(textValues);
|
|
14786
|
+
this.setProperties({ text: currentText.toString() }, true);
|
|
13645
14787
|
this.addChip(text, value);
|
|
13646
14788
|
this.addListSelection(element);
|
|
13647
14789
|
}
|
|
@@ -13652,12 +14794,24 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
13652
14794
|
setValue(this.fields.value, value, newValue);
|
|
13653
14795
|
var noDataEle = this.popupWrapper.querySelector('.' + dropDownBaseClasses.noData);
|
|
13654
14796
|
this.addItem(newValue, indexItem);
|
|
14797
|
+
if (this.enableVirtualization) {
|
|
14798
|
+
if (this.virtualCustomSelectData && this.virtualCustomSelectData.length >= 0) {
|
|
14799
|
+
this.virtualCustomSelectData.push(newValue);
|
|
14800
|
+
}
|
|
14801
|
+
else {
|
|
14802
|
+
this.virtualCustomSelectData = [newValue];
|
|
14803
|
+
}
|
|
14804
|
+
}
|
|
13655
14805
|
element = element ? element : this.findListElement(this.hideSelectedItem ? this.ulElement : this.list, 'li', 'data-value', value);
|
|
13656
14806
|
if (this.popupWrapper.contains(noDataEle)) {
|
|
13657
14807
|
this.list.setAttribute('style', noDataEle.getAttribute('style'));
|
|
13658
14808
|
this.popupWrapper.replaceChild(this.list, noDataEle);
|
|
13659
14809
|
this.wireListEvents();
|
|
13660
14810
|
}
|
|
14811
|
+
var currentText = [];
|
|
14812
|
+
var textValues = this.text != null ? this.text + ',' + text : text;
|
|
14813
|
+
currentText.push(textValues);
|
|
14814
|
+
this.setProperties({ text: currentText.toString() }, true);
|
|
13661
14815
|
this.addChip(text, value);
|
|
13662
14816
|
this.addListSelection(element);
|
|
13663
14817
|
}
|
|
@@ -13687,7 +14841,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
13687
14841
|
};
|
|
13688
14842
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
13689
14843
|
MultiSelect.prototype.updateActionCompleteData = function (li, item) {
|
|
13690
|
-
if (this.value && this.value.indexOf(li.getAttribute('data-value')) > -1) {
|
|
14844
|
+
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)))) {
|
|
13691
14845
|
this.mainList = this.ulElement;
|
|
13692
14846
|
if (this.hideSelectedItem) {
|
|
13693
14847
|
addClass([li], HIDE_LIST);
|
|
@@ -13725,13 +14879,13 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
13725
14879
|
};
|
|
13726
14880
|
MultiSelect.prototype.updateListSelection = function (li, e, length) {
|
|
13727
14881
|
var customVal = li.getAttribute('data-value');
|
|
13728
|
-
var value = this.getFormattedValue(customVal);
|
|
14882
|
+
var value = this.allowObjectBinding ? this.getDataByValue(customVal) : this.getFormattedValue(customVal);
|
|
13729
14883
|
if (this.allowCustomValue && ((customVal !== 'false' && value === false) ||
|
|
13730
14884
|
(!isNullOrUndefined(value) && value.toString() === 'NaN'))) {
|
|
13731
14885
|
value = customVal;
|
|
13732
14886
|
}
|
|
13733
14887
|
this.removeHover();
|
|
13734
|
-
if (!this.value || this.value.indexOf(value) === -1) {
|
|
14888
|
+
if (!this.value || ((!this.allowObjectBinding && this.value.indexOf(value) === -1) || (this.allowObjectBinding && this.indexOfObjectInArray(value, this.value) === -1))) {
|
|
13735
14889
|
this.dispatchSelect(value, e, li, (li.getAttribute('aria-selected') === 'true'), length);
|
|
13736
14890
|
}
|
|
13737
14891
|
else {
|
|
@@ -13740,9 +14894,10 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
13740
14894
|
};
|
|
13741
14895
|
MultiSelect.prototype.updateListSelectEventCallback = function (value, li, e) {
|
|
13742
14896
|
var _this = this;
|
|
14897
|
+
value = this.allowObjectBinding ? getValue(((this.fields.value) ? this.fields.value : ''), value) : value;
|
|
13743
14898
|
var text = this.getTextByValue(value);
|
|
13744
|
-
if ((this.allowCustomValue || this.allowFiltering) && !this.findListElement(this.mainList, 'li', 'data-value', value)) {
|
|
13745
|
-
var temp_1 = li.cloneNode(true);
|
|
14899
|
+
if ((this.allowCustomValue || this.allowFiltering) && !this.findListElement(this.mainList, 'li', 'data-value', value) && (!this.enableVirtualization || (this.enableVirtualization && this.virtualCustomData))) {
|
|
14900
|
+
var temp_1 = li ? li.cloneNode(true) : li;
|
|
13746
14901
|
var fieldValue = this.fields.value ? this.fields.value : 'value';
|
|
13747
14902
|
if (this.allowCustomValue && this.mainData.length && typeof getValue(fieldValue, this.mainData[0]) === 'number') {
|
|
13748
14903
|
value = !isNaN(parseFloat(value.toString())) ? parseFloat(value.toString()) : value;
|
|
@@ -13754,10 +14909,22 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
13754
14909
|
};
|
|
13755
14910
|
this.trigger('customValueSelection', eventArgs, function (eventArgs) {
|
|
13756
14911
|
if (!eventArgs.cancel) {
|
|
13757
|
-
|
|
13758
|
-
|
|
13759
|
-
|
|
13760
|
-
|
|
14912
|
+
if (_this.enableVirtualization && _this.virtualCustomData) {
|
|
14913
|
+
if (_this.virtualCustomSelectData && _this.virtualCustomSelectData.length >= 0) {
|
|
14914
|
+
_this.virtualCustomSelectData.push(data_1);
|
|
14915
|
+
}
|
|
14916
|
+
else {
|
|
14917
|
+
_this.virtualCustomSelectData = [data_1];
|
|
14918
|
+
}
|
|
14919
|
+
_this.remoteCustomValue = false;
|
|
14920
|
+
_this.addValue(value, text, e);
|
|
14921
|
+
}
|
|
14922
|
+
else {
|
|
14923
|
+
append([temp_1], _this.mainList);
|
|
14924
|
+
_this.mainData.push(data_1);
|
|
14925
|
+
_this.remoteCustomValue = false;
|
|
14926
|
+
_this.addValue(value, text, e);
|
|
14927
|
+
}
|
|
13761
14928
|
}
|
|
13762
14929
|
});
|
|
13763
14930
|
}
|
|
@@ -13867,8 +15034,12 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
13867
15034
|
var _this = this;
|
|
13868
15035
|
this.keyCode = null;
|
|
13869
15036
|
this.scrollFocusStatus = false;
|
|
15037
|
+
this.keyboardEvent = null;
|
|
13870
15038
|
var target = e.target;
|
|
13871
15039
|
var li = closest(target, '.' + dropDownBaseClasses.li);
|
|
15040
|
+
if (this.enableVirtualization && li && li.classList.contains('e-virtual-list')) {
|
|
15041
|
+
return;
|
|
15042
|
+
}
|
|
13872
15043
|
var headerLi = closest(target, '.' + dropDownBaseClasses.group);
|
|
13873
15044
|
if (headerLi && this.enableGroupCheckBox && this.mode === 'CheckBox' && this.fields.groupBy) {
|
|
13874
15045
|
target = target.classList.contains('e-list-group-item') ? target.firstElementChild.lastElementChild
|
|
@@ -13945,6 +15116,39 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
13945
15116
|
else {
|
|
13946
15117
|
e.preventDefault();
|
|
13947
15118
|
}
|
|
15119
|
+
if (this.enableVirtualization && this.hideSelectedItem) {
|
|
15120
|
+
var visibleListElements = this.list.querySelectorAll('li.'
|
|
15121
|
+
+ dropDownBaseClasses.li
|
|
15122
|
+
+ ':not(.' + HIDE_LIST + ')' + ':not(.e-reorder-hide)' + ':not(.e-virtual-list)');
|
|
15123
|
+
if (visibleListElements.length) {
|
|
15124
|
+
var actualCount = this.virtualListHeight > 0 ? Math.floor(this.virtualListHeight / this.listItemHeight) : 0;
|
|
15125
|
+
if (visibleListElements.length < (actualCount + 2)) {
|
|
15126
|
+
var query = this.getForQuery(this.value).clone();
|
|
15127
|
+
query = query.skip(this.virtualItemStartIndex);
|
|
15128
|
+
this.resetList(this.dataSource, this.fields, query);
|
|
15129
|
+
this.UpdateSkeleton();
|
|
15130
|
+
this.liCollections = this.list.querySelectorAll('.' + dropDownBaseClasses.li);
|
|
15131
|
+
this.virtualItemCount = this.itemCount;
|
|
15132
|
+
if (this.mode !== 'CheckBox') {
|
|
15133
|
+
this.totalItemCount = this.value && this.value.length ? this.totalItemCount - this.value.length : this.totalItemCount;
|
|
15134
|
+
}
|
|
15135
|
+
if (!this.list.querySelector('.e-virtual-ddl')) {
|
|
15136
|
+
var virualElement = this.createElement('div', {
|
|
15137
|
+
id: this.element.id + '_popup', className: 'e-virtual-ddl', styles: this.GetVirtualTrackHeight()
|
|
15138
|
+
});
|
|
15139
|
+
this.popupWrapper.querySelector('.e-dropdownbase').appendChild(virualElement);
|
|
15140
|
+
}
|
|
15141
|
+
else {
|
|
15142
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
15143
|
+
this.list.getElementsByClassName('e-virtual-ddl')[0].style = this.GetVirtualTrackHeight();
|
|
15144
|
+
}
|
|
15145
|
+
if (this.list.querySelector('.e-virtual-ddl-content')) {
|
|
15146
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
15147
|
+
this.list.getElementsByClassName('e-virtual-ddl-content')[0].style = this.getTransformValues();
|
|
15148
|
+
}
|
|
15149
|
+
}
|
|
15150
|
+
}
|
|
15151
|
+
}
|
|
13948
15152
|
this.refreshPlaceHolder();
|
|
13949
15153
|
this.deselectHeader();
|
|
13950
15154
|
}
|
|
@@ -14182,7 +15386,9 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
14182
15386
|
var remaining = void 0;
|
|
14183
15387
|
var downIconWidth = 0;
|
|
14184
15388
|
var overAllContainer = void 0;
|
|
14185
|
-
|
|
15389
|
+
if (!this.enableVirtualization) {
|
|
15390
|
+
this.updateWrapperText(this.viewWrapper, data);
|
|
15391
|
+
}
|
|
14186
15392
|
var l10nLocale = {
|
|
14187
15393
|
noRecordsTemplate: 'No records found',
|
|
14188
15394
|
actionFailureTemplate: 'Request failed',
|
|
@@ -14213,11 +15419,21 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
14213
15419
|
this.checkClearIconWidth();
|
|
14214
15420
|
if (!isNullOrUndefined(this.value)) {
|
|
14215
15421
|
for (var index = 0; !isNullOrUndefined(this.value[index]); index++) {
|
|
14216
|
-
|
|
14217
|
-
|
|
14218
|
-
|
|
14219
|
-
|
|
14220
|
-
|
|
15422
|
+
var items = this.text && this.text.split(this.delimiterChar);
|
|
15423
|
+
if (!this.enableVirtualization) {
|
|
15424
|
+
data += (index === 0) ? '' : this.delimiterChar + ' ';
|
|
15425
|
+
temp = this.getOverflowVal(index);
|
|
15426
|
+
data += temp;
|
|
15427
|
+
temp = this.viewWrapper.innerHTML;
|
|
15428
|
+
this.updateWrapperText(this.viewWrapper, data);
|
|
15429
|
+
}
|
|
15430
|
+
else if (items) {
|
|
15431
|
+
data += (index === 0) ? '' : this.delimiterChar + ' ';
|
|
15432
|
+
temp = items[index];
|
|
15433
|
+
data += temp;
|
|
15434
|
+
temp = this.viewWrapper.innerHTML;
|
|
15435
|
+
this.updateWrapperText(this.viewWrapper, data);
|
|
15436
|
+
}
|
|
14221
15437
|
wrapperleng = this.viewWrapper.offsetWidth +
|
|
14222
15438
|
parseInt(window.getComputedStyle(this.viewWrapper).paddingRight, 10);
|
|
14223
15439
|
overAllContainer = this.componentWrapper.offsetWidth -
|
|
@@ -14320,18 +15536,19 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
14320
15536
|
MultiSelect.prototype.getOverflowVal = function (index) {
|
|
14321
15537
|
var temp;
|
|
14322
15538
|
if (this.mainData && this.mainData.length) {
|
|
15539
|
+
var value = this.allowObjectBinding ? getValue(((this.fields.value) ? this.fields.value : ''), this.value[index]) : this.value[index];
|
|
14323
15540
|
if (this.mode === 'CheckBox') {
|
|
14324
15541
|
var newTemp = this.listData;
|
|
14325
15542
|
this.listData = this.mainData;
|
|
14326
|
-
temp = this.getTextByValue(
|
|
15543
|
+
temp = this.getTextByValue(value);
|
|
14327
15544
|
this.listData = newTemp;
|
|
14328
15545
|
}
|
|
14329
15546
|
else {
|
|
14330
|
-
temp = this.getTextByValue(
|
|
15547
|
+
temp = this.getTextByValue(value);
|
|
14331
15548
|
}
|
|
14332
15549
|
}
|
|
14333
15550
|
else {
|
|
14334
|
-
temp = this.value[index];
|
|
15551
|
+
temp = this.allowObjectBinding ? getValue(((this.fields.value) ? this.fields.value : ''), this.value[index]) : this.value[index];
|
|
14335
15552
|
}
|
|
14336
15553
|
return temp;
|
|
14337
15554
|
};
|
|
@@ -14449,8 +15666,8 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
14449
15666
|
preventSelectEvent: false
|
|
14450
15667
|
};
|
|
14451
15668
|
this.trigger('beforeSelectAll', beforeSelectArgs);
|
|
14452
|
-
if (li && li.length) {
|
|
14453
|
-
var
|
|
15669
|
+
if ((li && li.length) || (this.enableVirtualization && !state)) {
|
|
15670
|
+
var index_2 = 0;
|
|
14454
15671
|
var count_1 = 0;
|
|
14455
15672
|
if (this.enableGroupCheckBox) {
|
|
14456
15673
|
count_1 = state ? this.maximumSelectionLength - (this.value ? this.value.length : 0) : li.length;
|
|
@@ -14459,62 +15676,153 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
14459
15676
|
count_1 = state ? this.maximumSelectionLength - (this.value ? this.value.length : 0) : this.maximumSelectionLength;
|
|
14460
15677
|
}
|
|
14461
15678
|
if (!beforeSelectArgs.preventSelectEvent) {
|
|
14462
|
-
this.
|
|
14463
|
-
|
|
14464
|
-
|
|
14465
|
-
|
|
14466
|
-
this.
|
|
14467
|
-
|
|
14468
|
-
|
|
14469
|
-
|
|
14470
|
-
|
|
14471
|
-
|
|
14472
|
-
|
|
14473
|
-
|
|
14474
|
-
|
|
14475
|
-
|
|
14476
|
-
|
|
15679
|
+
if (this.enableVirtualization) {
|
|
15680
|
+
if (state) {
|
|
15681
|
+
this.virtualSelectAll = true;
|
|
15682
|
+
this.resetList(this.dataSource, this.fields, new Query().skip(this.viewPortInfo.startIndex));
|
|
15683
|
+
if (this.virtualSelectAllData instanceof Array) {
|
|
15684
|
+
for (var i = 0; i < this.virtualSelectAllData.length; i++) {
|
|
15685
|
+
if (li[this.skeletonCount + i]) {
|
|
15686
|
+
var value_2 = this.allowObjectBinding ? this.getDataByValue(li[this.skeletonCount + i].getAttribute('data-value')) : this.getFormattedValue(li[this.skeletonCount + i].getAttribute('data-value'));
|
|
15687
|
+
if (((!this.allowObjectBinding && this.value && this.value.indexOf(value_2) === 1) || (this.allowObjectBinding && this.indexOfObjectInArray(value_2, this.value) === 1))) {
|
|
15688
|
+
continue;
|
|
15689
|
+
}
|
|
15690
|
+
this.updateListSelection(li[this.skeletonCount + i], event, length - i);
|
|
15691
|
+
}
|
|
15692
|
+
else {
|
|
15693
|
+
if (this.fields) {
|
|
15694
|
+
var value_3 = getValue(this.fields.value, this.virtualSelectAllData[i]);
|
|
15695
|
+
value_3 = this.allowObjectBinding ? this.getDataByValue(value_3) : value_3;
|
|
15696
|
+
if (((!this.allowObjectBinding && this.value && this.value.indexOf(value_3) === 1) || (this.allowObjectBinding && this.indexOfObjectInArray(value_3, this.value) === 1))) {
|
|
15697
|
+
continue;
|
|
15698
|
+
}
|
|
15699
|
+
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)))) {
|
|
15700
|
+
this.dispatchSelect(value_3, event, null, false, length);
|
|
15701
|
+
}
|
|
15702
|
+
}
|
|
15703
|
+
}
|
|
15704
|
+
}
|
|
15705
|
+
if (this.virtualSelectAllData && this.value.length != this.virtualSelectAllData.length && this.virtualItemStartIndex != 0) {
|
|
15706
|
+
if (this.virtualItemStartIndex > this.itemCount) {
|
|
15707
|
+
for (var i = 0; i < this.itemCount; i++) {
|
|
15708
|
+
if (this.fields) {
|
|
15709
|
+
var value_4 = getValue(this.fields.value, this.virtualSelectAllData[i]);
|
|
15710
|
+
value_4 = this.allowObjectBinding ? this.getDataByValue(value_4) : value_4;
|
|
15711
|
+
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)))) {
|
|
15712
|
+
this.setProperties({ value: [].concat([], this.value, this.allowObjectBinding ? [this.virtualSelectAllData[i]] : [value_4]) }, true);
|
|
15713
|
+
}
|
|
15714
|
+
}
|
|
15715
|
+
}
|
|
15716
|
+
}
|
|
15717
|
+
}
|
|
15718
|
+
else {
|
|
15719
|
+
for (var i = 0; i < this.virtualItemStartIndex; i++) {
|
|
15720
|
+
if (this.fields) {
|
|
15721
|
+
var value = getValue(this.fields.value, this.virtualSelectAllData[i]);
|
|
15722
|
+
value = this.allowObjectBinding ? this.getDataByValue(value) : value;
|
|
15723
|
+
if (Array.isArray(this.value) && ((!this.allowObjectBinding && this.value.indexOf(value) < 0) || (this.allowObjectBinding && !this.isObjectInArray(value, this.value)))) {
|
|
15724
|
+
this.setProperties({ value: [].concat([], this.value, this.allowObjectBinding ? [this.virtualSelectAllData[i]] : [value]) }, true);
|
|
15725
|
+
}
|
|
15726
|
+
}
|
|
15727
|
+
}
|
|
14477
15728
|
}
|
|
14478
|
-
index_1++;
|
|
14479
15729
|
}
|
|
14480
|
-
|
|
14481
|
-
|
|
14482
|
-
|
|
14483
|
-
|
|
15730
|
+
}
|
|
15731
|
+
else {
|
|
15732
|
+
while (index_2 < this.value.length && index_2 <= 50 && index_2 < count_1 && this.value.length > 0) {
|
|
15733
|
+
this.removeValue(this.value[index_2], event, this.value.length - index_2);
|
|
15734
|
+
index_2++;
|
|
14484
15735
|
}
|
|
14485
|
-
|
|
14486
|
-
|
|
14487
|
-
|
|
14488
|
-
|
|
14489
|
-
|
|
14490
|
-
|
|
15736
|
+
if (length > 50) {
|
|
15737
|
+
setTimeout(function () {
|
|
15738
|
+
while (index_2 < _this.value.length && index_2 < count_1 && _this.value.length > 0) {
|
|
15739
|
+
_this.removeValue(value[index_2], event, _this.value.length - index_2);
|
|
15740
|
+
index_2++;
|
|
15741
|
+
}
|
|
15742
|
+
_this.updatedataValueItems(event);
|
|
15743
|
+
if (!_this.changeOnBlur) {
|
|
15744
|
+
_this.updateValueState(event, _this.value, _this.tempValues);
|
|
15745
|
+
_this.isSelectAll = _this.isSelectAll ? !_this.isSelectAll : _this.isSelectAll;
|
|
15746
|
+
}
|
|
15747
|
+
_this.updateHiddenElement();
|
|
15748
|
+
}, 0);
|
|
15749
|
+
}
|
|
15750
|
+
this.value = [];
|
|
15751
|
+
this.virtualSelectAll = false;
|
|
15752
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
15753
|
+
var ulElement = this.renderItems(this.listData, this.fields);
|
|
15754
|
+
}
|
|
15755
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
15756
|
+
var virtualTrackElement = this.list.getElementsByClassName('e-virtual-ddl')[0];
|
|
15757
|
+
if (virtualTrackElement) {
|
|
15758
|
+
(virtualTrackElement).style = this.GetVirtualTrackHeight();
|
|
15759
|
+
}
|
|
15760
|
+
this.UpdateSkeleton();
|
|
15761
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
15762
|
+
var virtualContentElement = this.list.getElementsByClassName('e-virtual-ddl-content')[0];
|
|
15763
|
+
if (virtualContentElement) {
|
|
15764
|
+
(virtualContentElement).style = this.getTransformValues();
|
|
15765
|
+
}
|
|
15766
|
+
}
|
|
15767
|
+
else {
|
|
15768
|
+
while (index_2 < length && index_2 <= 50 && index_2 < count_1) {
|
|
15769
|
+
this.isSelectAllTarget = (length === index_2 + 1);
|
|
15770
|
+
this.updateListSelection(li[index_2], event, length - index_2);
|
|
15771
|
+
if (this.enableGroupCheckBox) {
|
|
15772
|
+
this.findGroupStart(li[index_2]);
|
|
14491
15773
|
}
|
|
14492
|
-
|
|
15774
|
+
index_2++;
|
|
15775
|
+
}
|
|
15776
|
+
if (length > 50) {
|
|
15777
|
+
setTimeout(function () {
|
|
15778
|
+
while (index_2 < length && index_2 < count_1) {
|
|
15779
|
+
_this.isSelectAllTarget = (length === index_2 + 1);
|
|
15780
|
+
_this.updateListSelection(li[index_2], event, length - index_2);
|
|
15781
|
+
if (_this.enableGroupCheckBox) {
|
|
15782
|
+
_this.findGroupStart(li[index_2]);
|
|
15783
|
+
}
|
|
15784
|
+
index_2++;
|
|
15785
|
+
}
|
|
15786
|
+
_this.updatedataValueItems(event);
|
|
15787
|
+
if (!_this.changeOnBlur) {
|
|
15788
|
+
_this.updateValueState(event, _this.value, _this.tempValues);
|
|
15789
|
+
_this.isSelectAll = _this.isSelectAll ? !_this.isSelectAll : _this.isSelectAll;
|
|
15790
|
+
}
|
|
15791
|
+
_this.updateHiddenElement();
|
|
15792
|
+
if (_this.popupWrapper && li[index_2 - 1].classList.contains('e-item-focus')) {
|
|
15793
|
+
var selectAllParent = document.getElementsByClassName('e-selectall-parent')[0];
|
|
15794
|
+
if (selectAllParent && selectAllParent.classList.contains('e-item-focus')) {
|
|
15795
|
+
li[index_2 - 1].classList.remove('e-item-focus');
|
|
15796
|
+
}
|
|
15797
|
+
}
|
|
15798
|
+
}, 0);
|
|
15799
|
+
}
|
|
14493
15800
|
}
|
|
14494
15801
|
}
|
|
14495
15802
|
else {
|
|
14496
|
-
for (var
|
|
15803
|
+
for (var i_1 = 0; i_1 < li.length && i_1 < count_1; i_1++) {
|
|
14497
15804
|
this.removeHover();
|
|
14498
|
-
var customVal = li[
|
|
14499
|
-
var
|
|
15805
|
+
var customVal = li[i_1].getAttribute('data-value');
|
|
15806
|
+
var value_5 = this.getFormattedValue(customVal);
|
|
15807
|
+
value_5 = this.allowObjectBinding ? this.getDataByValue(value_5) : value_5;
|
|
14500
15808
|
var mainElement = this.mainList ? this.mainList.querySelectorAll(state ?
|
|
14501
15809
|
'li.e-list-item:not([aria-selected="true"]):not(.e-reorder-hide)' :
|
|
14502
|
-
'li.e-list-item[aria-selected="true"]:not(.e-reorder-hide)')[
|
|
15810
|
+
'li.e-list-item[aria-selected="true"]:not(.e-reorder-hide)')[i_1] : null;
|
|
14503
15811
|
if (state) {
|
|
14504
15812
|
this.value = !this.value ? [] : this.value;
|
|
14505
|
-
if (this.value.indexOf(
|
|
14506
|
-
this.setProperties({ value: [].concat([], this.value, [
|
|
15813
|
+
if ((!this.allowObjectBinding && this.value.indexOf(value_5) < 0) || (this.allowObjectBinding && !this.isObjectInArray(value_5, this.value))) {
|
|
15814
|
+
this.setProperties({ value: [].concat([], this.value, [value_5]) }, true);
|
|
14507
15815
|
}
|
|
14508
15816
|
this.removeFocus();
|
|
14509
|
-
this.addListSelection(li[
|
|
15817
|
+
this.addListSelection(li[i_1], mainElement);
|
|
14510
15818
|
this.updateChipStatus();
|
|
14511
15819
|
this.checkMaxSelection();
|
|
14512
15820
|
}
|
|
14513
15821
|
else {
|
|
14514
|
-
this.removeAllItems(
|
|
15822
|
+
this.removeAllItems(value_5, event, false, li[i_1], mainElement);
|
|
14515
15823
|
}
|
|
14516
15824
|
if (this.enableGroupCheckBox) {
|
|
14517
|
-
this.findGroupStart(li[
|
|
15825
|
+
this.findGroupStart(li[i_1]);
|
|
14518
15826
|
}
|
|
14519
15827
|
}
|
|
14520
15828
|
if (!state) {
|
|
@@ -14648,6 +15956,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
14648
15956
|
}
|
|
14649
15957
|
this.selectAllItem(state, event);
|
|
14650
15958
|
}
|
|
15959
|
+
this.virtualSelectAll = false;
|
|
14651
15960
|
};
|
|
14652
15961
|
/**
|
|
14653
15962
|
* Get the properties to be maintained in the persisted state.
|
|
@@ -14815,12 +16124,31 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
14815
16124
|
}
|
|
14816
16125
|
this.renderPopup();
|
|
14817
16126
|
};
|
|
16127
|
+
MultiSelect.prototype.totalItemsCount = function () {
|
|
16128
|
+
var dataSourceCount;
|
|
16129
|
+
if (this.dataSource instanceof DataManager) {
|
|
16130
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
16131
|
+
dataSourceCount = this.virtualGroupDataSource && this.virtualGroupDataSource.length ? this.virtualGroupDataSource.length : 0;
|
|
16132
|
+
}
|
|
16133
|
+
else {
|
|
16134
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
16135
|
+
dataSourceCount = this.dataSource && this.dataSource.length ? this.dataSource.length : 0;
|
|
16136
|
+
}
|
|
16137
|
+
if (this.mode === 'CheckBox') {
|
|
16138
|
+
this.totalItemCount = dataSourceCount != 0 ? dataSourceCount : this.totalItemCount;
|
|
16139
|
+
}
|
|
16140
|
+
else {
|
|
16141
|
+
this.totalItemCount = dataSourceCount != 0 ? dataSourceCount - this.value.length : this.totalItemCount;
|
|
16142
|
+
}
|
|
16143
|
+
};
|
|
14818
16144
|
MultiSelect.prototype.presentItemValue = function (ulElement) {
|
|
14819
16145
|
var valuecheck = [];
|
|
14820
16146
|
for (var i = 0; i < this.value.length; i++) {
|
|
14821
|
-
var
|
|
16147
|
+
var value = this.allowObjectBinding ? getValue((this.fields.value) ? this.fields.value : '', this.value[i]) : this.value[i];
|
|
16148
|
+
var checkEle = this.findListElement(((this.allowFiltering && !isNullOrUndefined(this.mainList)) ? this.mainList : ulElement), 'li', 'data-value', value);
|
|
14822
16149
|
if (!checkEle) {
|
|
14823
|
-
|
|
16150
|
+
var checkvalue = this.allowObjectBinding ? this.getDataByValue(this.value[i]) : this.value[i];
|
|
16151
|
+
valuecheck.push(checkvalue);
|
|
14824
16152
|
}
|
|
14825
16153
|
}
|
|
14826
16154
|
return valuecheck;
|
|
@@ -14933,6 +16261,31 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
14933
16261
|
if (_this.mode === 'CheckBox' && _this.showSelectAll) {
|
|
14934
16262
|
EventHandler.remove(_this.popupObj.element, 'click', _this.clickHandler);
|
|
14935
16263
|
}
|
|
16264
|
+
if (_this.enableVirtualization && _this.mode === 'CheckBox') {
|
|
16265
|
+
_this.viewPortInfo.startIndex = _this.virtualItemStartIndex = 0;
|
|
16266
|
+
_this.viewPortInfo.endIndex = _this.virtualItemEndIndex = _this.viewPortInfo.startIndex > 0 ? _this.viewPortInfo.endIndex : _this.itemCount;
|
|
16267
|
+
_this.previousStartIndex = 0;
|
|
16268
|
+
_this.previousEndIndex = 0;
|
|
16269
|
+
}
|
|
16270
|
+
var dataSourceCount = void 0;
|
|
16271
|
+
if (_this.dataSource instanceof DataManager) {
|
|
16272
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
16273
|
+
dataSourceCount = _this.virtualGroupDataSource && _this.virtualGroupDataSource.length ? _this.virtualGroupDataSource.length : 0;
|
|
16274
|
+
}
|
|
16275
|
+
else {
|
|
16276
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
16277
|
+
dataSourceCount = _this.dataSource && _this.dataSource.length ? _this.dataSource.length : 0;
|
|
16278
|
+
}
|
|
16279
|
+
if (_this.enableVirtualization && (_this.allowFiltering || _this.allowCustomValue) && _this.value != null && _this.targetElement() && _this.totalItemCount !== dataSourceCount) {
|
|
16280
|
+
_this.updateInitialData();
|
|
16281
|
+
_this.checkAndResetCache();
|
|
16282
|
+
}
|
|
16283
|
+
if (_this.virtualCustomData && _this.viewPortInfo && _this.viewPortInfo.startIndex === 0 && _this.viewPortInfo.endIndex === _this.itemCount) {
|
|
16284
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
16285
|
+
_this.renderItems(_this.mainData, _this.fields);
|
|
16286
|
+
}
|
|
16287
|
+
_this.virtualCustomData = null;
|
|
16288
|
+
_this.isVirtualTrackHeight = false;
|
|
14936
16289
|
}
|
|
14937
16290
|
});
|
|
14938
16291
|
}
|
|
@@ -14947,6 +16300,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
14947
16300
|
if (!this.enabled) {
|
|
14948
16301
|
return;
|
|
14949
16302
|
}
|
|
16303
|
+
this.firstItem = this.dataSource && this.dataSource.length > 0 ? this.dataSource[0] : null;
|
|
14950
16304
|
var args = { cancel: false };
|
|
14951
16305
|
this.trigger('beforeOpen', args, function (args) {
|
|
14952
16306
|
if (!args.cancel) {
|
|
@@ -14969,6 +16323,47 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
14969
16323
|
return;
|
|
14970
16324
|
}
|
|
14971
16325
|
_this.onPopupShown(e);
|
|
16326
|
+
if (_this.enableVirtualization && _this.listData && _this.listData.length) {
|
|
16327
|
+
if (!isNullOrUndefined(_this.value) && (_this.getModuleName() === 'dropdownlist' || _this.getModuleName() === 'combobox')) {
|
|
16328
|
+
_this.removeHover();
|
|
16329
|
+
}
|
|
16330
|
+
if (!_this.beforePopupOpen) {
|
|
16331
|
+
if (_this.hideSelectedItem && _this.value && Array.isArray(_this.value) && _this.value.length > 0) {
|
|
16332
|
+
_this.totalItemsCount();
|
|
16333
|
+
}
|
|
16334
|
+
if (!_this.preventSetCurrentData && !isNullOrUndefined(_this.viewPortInfo.startIndex) && !isNullOrUndefined(_this.viewPortInfo.endIndex)) {
|
|
16335
|
+
_this.notify("setCurrentViewDataAsync", {
|
|
16336
|
+
component: _this.getModuleName(),
|
|
16337
|
+
module: "VirtualScroll",
|
|
16338
|
+
});
|
|
16339
|
+
}
|
|
16340
|
+
}
|
|
16341
|
+
}
|
|
16342
|
+
if (_this.enableVirtualization && !_this.allowFiltering && _this.selectedValueInfo != null && _this.selectedValueInfo.startIndex > 0 && _this.value != null) {
|
|
16343
|
+
_this.notify("dataProcessAsync", {
|
|
16344
|
+
module: "VirtualScroll",
|
|
16345
|
+
isOpen: true,
|
|
16346
|
+
});
|
|
16347
|
+
}
|
|
16348
|
+
if (_this.enableVirtualization) {
|
|
16349
|
+
_this.updatevirtualizationList();
|
|
16350
|
+
}
|
|
16351
|
+
else {
|
|
16352
|
+
if (_this.value && _this.value.length) {
|
|
16353
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
16354
|
+
var element = void 0;
|
|
16355
|
+
var listItems = _this.getItems();
|
|
16356
|
+
for (var _i = 0, _a = _this.value; _i < _a.length; _i++) {
|
|
16357
|
+
var value = _a[_i];
|
|
16358
|
+
var checkValue = _this.allowObjectBinding ? getValue((_this.fields.value) ? _this.fields.value : '', value) : value;
|
|
16359
|
+
element = _this.getElementByValue(checkValue);
|
|
16360
|
+
if (element) {
|
|
16361
|
+
_this.addListSelection(element);
|
|
16362
|
+
}
|
|
16363
|
+
}
|
|
16364
|
+
}
|
|
16365
|
+
}
|
|
16366
|
+
_this.preventSetCurrentData = true;
|
|
14972
16367
|
}
|
|
14973
16368
|
});
|
|
14974
16369
|
};
|
|
@@ -15121,6 +16516,13 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
15121
16516
|
this.wireEvent();
|
|
15122
16517
|
this.enable(this.enabled);
|
|
15123
16518
|
this.enableRTL(this.enableRtl);
|
|
16519
|
+
if (this.enableVirtualization) {
|
|
16520
|
+
this.updateVirtualizationProperties(this.itemCount, this.allowFiltering, this.mode === 'CheckBox');
|
|
16521
|
+
}
|
|
16522
|
+
this.listItemHeight = this.getListHeight();
|
|
16523
|
+
this.getSkeletonCount();
|
|
16524
|
+
this.viewPortInfo.startIndex = this.virtualItemStartIndex = 0;
|
|
16525
|
+
this.viewPortInfo.endIndex = this.virtualItemEndIndex = this.viewPortInfo.startIndex > 0 ? this.viewPortInfo.endIndex : this.itemCount;
|
|
15124
16526
|
this.checkInitialValue();
|
|
15125
16527
|
if (this.element.hasAttribute('data-val')) {
|
|
15126
16528
|
this.element.setAttribute('data-val', 'false');
|
|
@@ -15132,6 +16534,22 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
15132
16534
|
}
|
|
15133
16535
|
this.renderComplete();
|
|
15134
16536
|
};
|
|
16537
|
+
MultiSelect.prototype.getListHeight = function () {
|
|
16538
|
+
var listParent = this.createElement('div', {
|
|
16539
|
+
className: 'e-dropdownbase'
|
|
16540
|
+
});
|
|
16541
|
+
var item = this.createElement('li', {
|
|
16542
|
+
className: 'e-list-item'
|
|
16543
|
+
});
|
|
16544
|
+
var listParentHeight = formatUnit(this.popupHeight);
|
|
16545
|
+
listParent.style.height = (parseInt(listParentHeight, 10)).toString() + 'px';
|
|
16546
|
+
listParent.appendChild(item);
|
|
16547
|
+
document.body.appendChild(listParent);
|
|
16548
|
+
this.virtualListHeight = listParent.getBoundingClientRect().height;
|
|
16549
|
+
var listItemHeight = Math.ceil(item.getBoundingClientRect().height);
|
|
16550
|
+
listParent.remove();
|
|
16551
|
+
return listItemHeight;
|
|
16552
|
+
};
|
|
15135
16553
|
MultiSelect.prototype.checkInitialValue = function () {
|
|
15136
16554
|
var _this = this;
|
|
15137
16555
|
var isData = this.dataSource instanceof Array ? (this.dataSource.length > 0)
|
|
@@ -15148,7 +16566,8 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
15148
16566
|
var opt = optionsElement[index];
|
|
15149
16567
|
if (!isNullOrUndefined(opt.getAttribute('selected'))) {
|
|
15150
16568
|
if (opt.getAttribute('value')) {
|
|
15151
|
-
|
|
16569
|
+
var value = this.allowObjectBinding ? this.getDataByValue(opt.getAttribute('value')) : opt.getAttribute('value');
|
|
16570
|
+
valueCol.push(value);
|
|
15152
16571
|
}
|
|
15153
16572
|
else {
|
|
15154
16573
|
textCol += (opt.text + this.delimiterChar);
|
|
@@ -15175,14 +16594,40 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
15175
16594
|
this.initialTextUpdate();
|
|
15176
16595
|
}
|
|
15177
16596
|
if (this.value && this.value.length) {
|
|
16597
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
16598
|
+
var listItems_2;
|
|
16599
|
+
if (this.enableVirtualization) {
|
|
16600
|
+
var fields = (this.fields.value) ? this.fields.value : '';
|
|
16601
|
+
var predicate = void 0;
|
|
16602
|
+
for (var i = 0; i < this.value.length; i++) {
|
|
16603
|
+
var value = this.allowObjectBinding ? getValue((this.fields.value) ? this.fields.value : '', this.value[i]) : this.value[i];
|
|
16604
|
+
if (i === 0) {
|
|
16605
|
+
predicate = new Predicate(fields, 'equal', value);
|
|
16606
|
+
}
|
|
16607
|
+
else {
|
|
16608
|
+
predicate = predicate.or(fields, 'equal', value);
|
|
16609
|
+
}
|
|
16610
|
+
}
|
|
16611
|
+
if (this.dataSource instanceof DataManager) {
|
|
16612
|
+
this.dataSource.executeQuery(new Query().where(predicate))
|
|
16613
|
+
.then(function (e) {
|
|
16614
|
+
if (e.result.result.length > 0) {
|
|
16615
|
+
listItems_2 = e.result.result;
|
|
16616
|
+
}
|
|
16617
|
+
});
|
|
16618
|
+
}
|
|
16619
|
+
else {
|
|
16620
|
+
listItems_2 = new DataManager(this.dataSource).executeLocal(new Query().where(predicate));
|
|
16621
|
+
}
|
|
16622
|
+
}
|
|
15178
16623
|
if (!(this.dataSource instanceof DataManager)) {
|
|
15179
|
-
this.initialValueUpdate();
|
|
16624
|
+
this.initialValueUpdate(listItems_2);
|
|
15180
16625
|
this.initialUpdate();
|
|
15181
16626
|
}
|
|
15182
16627
|
else {
|
|
15183
16628
|
this.setInitialValue = function () {
|
|
15184
16629
|
_this.initStatus = false;
|
|
15185
|
-
_this.initialValueUpdate();
|
|
16630
|
+
_this.initialValueUpdate(listItems_2);
|
|
15186
16631
|
_this.initialUpdate();
|
|
15187
16632
|
_this.setInitialValue = null;
|
|
15188
16633
|
_this.initStatus = true;
|
|
@@ -15204,6 +16649,34 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
15204
16649
|
this.inputElement.focus();
|
|
15205
16650
|
}
|
|
15206
16651
|
};
|
|
16652
|
+
MultiSelect.prototype.updatevirtualizationList = function () {
|
|
16653
|
+
if (this.value && this.value.length) {
|
|
16654
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
16655
|
+
var element = void 0;
|
|
16656
|
+
var listItems = this.getItems();
|
|
16657
|
+
for (var _i = 0, _a = this.value; _i < _a.length; _i++) {
|
|
16658
|
+
var value = _a[_i];
|
|
16659
|
+
var checkValue = this.allowObjectBinding ? getValue((this.fields.value) ? this.fields.value : '', value) : value;
|
|
16660
|
+
element = this.getElementByValue(checkValue);
|
|
16661
|
+
if (element) {
|
|
16662
|
+
this.addListSelection(element);
|
|
16663
|
+
}
|
|
16664
|
+
}
|
|
16665
|
+
if (this.enableVirtualization && this.hideSelectedItem) {
|
|
16666
|
+
var visibleListElements = this.list.querySelectorAll('li.'
|
|
16667
|
+
+ dropDownBaseClasses.li
|
|
16668
|
+
+ ':not(.' + HIDE_LIST + ')' + ':not(.e-reorder-hide)' + ':not(.e-virtual-list)');
|
|
16669
|
+
if (visibleListElements.length) {
|
|
16670
|
+
var actualCount = this.virtualListHeight > 0 ? Math.floor(this.virtualListHeight / this.listItemHeight) : 0;
|
|
16671
|
+
if (visibleListElements.length < (actualCount + 2)) {
|
|
16672
|
+
var query = this.getForQuery(this.value).clone();
|
|
16673
|
+
query = query.skip(this.viewPortInfo.startIndex);
|
|
16674
|
+
this.resetList(this.dataSource, this.fields, query);
|
|
16675
|
+
}
|
|
16676
|
+
}
|
|
16677
|
+
}
|
|
16678
|
+
}
|
|
16679
|
+
};
|
|
15207
16680
|
MultiSelect.prototype.setFloatLabelType = function () {
|
|
15208
16681
|
removeFloating(this.overAllWrapper, this.componentWrapper, this.searchWrapper, this.inputElement, this.value, this.floatLabelType, this.placeholder);
|
|
15209
16682
|
if (this.floatLabelType !== 'Never') {
|
|
@@ -15237,6 +16710,8 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
15237
16710
|
if (this.mode !== 'Box' && !(this.setDynValue && this.mode === 'Default' && this.inputFocus)) {
|
|
15238
16711
|
this.updateDelimView();
|
|
15239
16712
|
}
|
|
16713
|
+
this.viewPortInfo.startIndex = this.virtualItemStartIndex = 0;
|
|
16714
|
+
this.viewPortInfo.endIndex = this.virtualItemEndIndex = this.itemCount;
|
|
15240
16715
|
this.updateCssClass();
|
|
15241
16716
|
this.updateHTMLAttribute();
|
|
15242
16717
|
this.updateReadonly(this.readonly);
|
|
@@ -15333,6 +16808,9 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
15333
16808
|
__decorate$5([
|
|
15334
16809
|
Property(true)
|
|
15335
16810
|
], MultiSelect.prototype, "enableHtmlSanitizer", void 0);
|
|
16811
|
+
__decorate$5([
|
|
16812
|
+
Property(false)
|
|
16813
|
+
], MultiSelect.prototype, "enableVirtualization", void 0);
|
|
15336
16814
|
__decorate$5([
|
|
15337
16815
|
Property([])
|
|
15338
16816
|
], MultiSelect.prototype, "dataSource", void 0);
|
|
@@ -15411,6 +16889,9 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
15411
16889
|
__decorate$5([
|
|
15412
16890
|
Property(null)
|
|
15413
16891
|
], MultiSelect.prototype, "value", void 0);
|
|
16892
|
+
__decorate$5([
|
|
16893
|
+
Property(false)
|
|
16894
|
+
], MultiSelect.prototype, "allowObjectBinding", void 0);
|
|
15414
16895
|
__decorate$5([
|
|
15415
16896
|
Property(true)
|
|
15416
16897
|
], MultiSelect.prototype, "hideSelectedItem", void 0);
|
|
@@ -15641,7 +17122,7 @@ var CheckBoxSelection = /** @__PURE__ @class */ (function () {
|
|
|
15641
17122
|
}
|
|
15642
17123
|
EventHandler.add(this.checkAllParent, 'mousedown', this.clickHandler, this);
|
|
15643
17124
|
}
|
|
15644
|
-
if (this.parent.list.classList.contains('e-nodata') || (this.parent.listData && this.parent.listData.length <= 1 &&
|
|
17125
|
+
if (this.parent.list.classList.contains('e-nodata') || (this.parent.listData && this.parent.listData.length <= 1 && !this.parent.enableVirtualization &&
|
|
15645
17126
|
!(this.parent.isDynamicDataChange)) || (this.parent.isDynamicDataChange &&
|
|
15646
17127
|
this.parent.listData && this.parent.listData.length <= 1)) {
|
|
15647
17128
|
this.checkAllParent.style.display = 'none';
|
|
@@ -16003,7 +17484,13 @@ var CheckBoxSelection = /** @__PURE__ @class */ (function () {
|
|
|
16003
17484
|
});
|
|
16004
17485
|
remLi = this.parent.ulElement.querySelectorAll('li.e-active');
|
|
16005
17486
|
addClass(remLi, 'e-reorder-hide');
|
|
16006
|
-
|
|
17487
|
+
if (this.parent.enableVirtualization) {
|
|
17488
|
+
var virtualUlElement = this.parent.list.querySelector('.e-virtual-ddl-content');
|
|
17489
|
+
prepend([ulEle_1], virtualUlElement);
|
|
17490
|
+
}
|
|
17491
|
+
else {
|
|
17492
|
+
prepend([ulEle_1], this.parent.list);
|
|
17493
|
+
}
|
|
16007
17494
|
}
|
|
16008
17495
|
this.parent.focusAtFirstListItem();
|
|
16009
17496
|
}
|
|
@@ -16404,7 +17891,7 @@ var ListBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
16404
17891
|
}
|
|
16405
17892
|
}
|
|
16406
17893
|
this.initWrapper();
|
|
16407
|
-
this.setSelection();
|
|
17894
|
+
this.setSelection(this.value, true, false, !this.isRendered);
|
|
16408
17895
|
this.initDraggable();
|
|
16409
17896
|
this.mainList = this.ulElement;
|
|
16410
17897
|
if (this.initLoad) {
|
|
@@ -18067,11 +19554,12 @@ var ListBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
18067
19554
|
});
|
|
18068
19555
|
}
|
|
18069
19556
|
};
|
|
18070
|
-
ListBox.prototype.setSelection = function (values, isSelect, isText) {
|
|
19557
|
+
ListBox.prototype.setSelection = function (values, isSelect, isText, canFocus) {
|
|
18071
19558
|
var _this = this;
|
|
18072
19559
|
if (values === void 0) { values = this.value; }
|
|
18073
19560
|
if (isSelect === void 0) { isSelect = true; }
|
|
18074
19561
|
if (isText === void 0) { isText = false; }
|
|
19562
|
+
if (canFocus === void 0) { canFocus = true; }
|
|
18075
19563
|
var li;
|
|
18076
19564
|
var liselect;
|
|
18077
19565
|
if (values) {
|
|
@@ -18100,13 +19588,17 @@ var ListBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
18100
19588
|
if (!isSelect && liselect || isSelect && !liselect && li) {
|
|
18101
19589
|
if (_this.selectionSettings.showCheckbox) {
|
|
18102
19590
|
_this.notify('updatelist', { li: li, module: 'listbox' });
|
|
18103
|
-
|
|
19591
|
+
if (canFocus) {
|
|
19592
|
+
li.focus();
|
|
19593
|
+
}
|
|
18104
19594
|
}
|
|
18105
19595
|
else {
|
|
18106
19596
|
if (isSelect) {
|
|
18107
19597
|
li.classList.add(cssClass.selected);
|
|
18108
19598
|
li.setAttribute('aria-selected', 'true');
|
|
18109
|
-
|
|
19599
|
+
if (canFocus) {
|
|
19600
|
+
li.focus();
|
|
19601
|
+
}
|
|
18110
19602
|
}
|
|
18111
19603
|
else {
|
|
18112
19604
|
li.classList.remove(cssClass.selected);
|
|
@@ -18608,6 +20100,8 @@ var Mention = /** @__PURE__ @class */ (function (_super) {
|
|
|
18608
20100
|
this.isPopupOpen = false;
|
|
18609
20101
|
this.isCollided = false;
|
|
18610
20102
|
this.lineBreak = false;
|
|
20103
|
+
this.isRTE = false;
|
|
20104
|
+
this.keyEventName = 'mousedown';
|
|
18611
20105
|
};
|
|
18612
20106
|
/**
|
|
18613
20107
|
* Execute before render the list items
|
|
@@ -18653,7 +20147,7 @@ var Mention = /** @__PURE__ @class */ (function (_super) {
|
|
|
18653
20147
|
};
|
|
18654
20148
|
Mention.prototype.bindCommonEvent = function () {
|
|
18655
20149
|
if (!Browser.isDevice) {
|
|
18656
|
-
this.inputElement.addEventListener('keydown', this.keyDownHandler.bind(this),
|
|
20150
|
+
this.inputElement.addEventListener('keydown', this.keyDownHandler.bind(this), !this.isRTE);
|
|
18657
20151
|
}
|
|
18658
20152
|
};
|
|
18659
20153
|
/**
|
|
@@ -18683,6 +20177,10 @@ var Mention = /** @__PURE__ @class */ (function (_super) {
|
|
|
18683
20177
|
return parentElement.querySelector('.e-content');
|
|
18684
20178
|
}
|
|
18685
20179
|
}
|
|
20180
|
+
if (targetElement && targetElement.parentElement && targetElement.parentElement.classList.contains('e-rte-content')) {
|
|
20181
|
+
this.isRTE = true;
|
|
20182
|
+
this.keyEventName = 'click';
|
|
20183
|
+
}
|
|
18686
20184
|
return targetElement;
|
|
18687
20185
|
};
|
|
18688
20186
|
/**
|
|
@@ -18824,7 +20322,7 @@ var Mention = /** @__PURE__ @class */ (function (_super) {
|
|
|
18824
20322
|
};
|
|
18825
20323
|
Mention.prototype.unBindCommonEvent = function () {
|
|
18826
20324
|
if (!Browser.isDevice) {
|
|
18827
|
-
this.inputElement.removeEventListener('keydown', this.keyDownHandler.bind(this),
|
|
20325
|
+
this.inputElement.removeEventListener('keydown', this.keyDownHandler.bind(this), !this.isRTE);
|
|
18828
20326
|
}
|
|
18829
20327
|
};
|
|
18830
20328
|
Mention.prototype.onKeyUp = function (e) {
|
|
@@ -18835,7 +20333,7 @@ var Mention = /** @__PURE__ @class */ (function (_super) {
|
|
|
18835
20333
|
}
|
|
18836
20334
|
this.isTyped = e.code !== 'Enter' && e.code !== 'Space' && e.code !== 'ArrowDown' && e.code !== 'ArrowUp' ? true : false;
|
|
18837
20335
|
var isRteImage = document.activeElement.parentElement && document.activeElement.parentElement.querySelector('.e-rte-image') ? true : false;
|
|
18838
|
-
if (document.activeElement != this.inputElement &&
|
|
20336
|
+
if (document.activeElement != this.inputElement && isRteImage) {
|
|
18839
20337
|
this.inputElement.focus();
|
|
18840
20338
|
}
|
|
18841
20339
|
if (this.isContentEditable(this.inputElement)) {
|
|
@@ -18863,7 +20361,7 @@ var Mention = /** @__PURE__ @class */ (function (_super) {
|
|
|
18863
20361
|
this.range.startContainer.nodeType === 1))) {
|
|
18864
20362
|
if (this.isPopupOpen && this.allowSpaces && currentRange && currentRange.trim() !== '' && charRegex.test(currentRange) && currentRange.indexOf(this.mentionChar) !== -1
|
|
18865
20363
|
&& !this.isMatchedText() && (currentRange.length > 1 && currentRange.replace(/\u00A0/g, ' ').charAt(currentRange.length - 2) !== ' ') &&
|
|
18866
|
-
(this.list && this.list.querySelectorAll('ul').length > 0)) {
|
|
20364
|
+
(this.list && this.list.querySelectorAll('ul').length > 0) && e.code !== 'Enter') {
|
|
18867
20365
|
this.queryString = currentRange.substring(currentRange.lastIndexOf(this.mentionChar) + 1).replace('\u00a0', ' ');
|
|
18868
20366
|
this.searchLists(e);
|
|
18869
20367
|
}
|
|
@@ -19508,7 +21006,7 @@ var Mention = /** @__PURE__ @class */ (function (_super) {
|
|
|
19508
21006
|
* @returns {void}
|
|
19509
21007
|
*/
|
|
19510
21008
|
Mention.prototype.wireListEvents = function () {
|
|
19511
|
-
EventHandler.add(this.list,
|
|
21009
|
+
EventHandler.add(this.list, this.keyEventName, this.onMouseClick, this);
|
|
19512
21010
|
EventHandler.add(this.list, 'mouseover', this.onMouseOver, this);
|
|
19513
21011
|
EventHandler.add(this.list, 'mouseout', this.onMouseLeave, this);
|
|
19514
21012
|
};
|
|
@@ -19518,7 +21016,7 @@ var Mention = /** @__PURE__ @class */ (function (_super) {
|
|
|
19518
21016
|
* @returns {void}
|
|
19519
21017
|
*/
|
|
19520
21018
|
Mention.prototype.unWireListEvents = function () {
|
|
19521
|
-
EventHandler.remove(this.list,
|
|
21019
|
+
EventHandler.remove(this.list, this.keyEventName, this.onMouseClick);
|
|
19522
21020
|
EventHandler.remove(this.list, 'mouseover', this.onMouseOver);
|
|
19523
21021
|
EventHandler.remove(this.list, 'mouseout', this.onMouseLeave);
|
|
19524
21022
|
};
|
|
@@ -19533,7 +21031,9 @@ var Mention = /** @__PURE__ @class */ (function (_super) {
|
|
|
19533
21031
|
var delay = 100;
|
|
19534
21032
|
this.closePopup(delay, e);
|
|
19535
21033
|
this.inputElement.focus();
|
|
19536
|
-
|
|
21034
|
+
if (!this.isRTE) {
|
|
21035
|
+
e.preventDefault();
|
|
21036
|
+
}
|
|
19537
21037
|
};
|
|
19538
21038
|
Mention.prototype.updateSelectedItem = function (li, e, preventSelect, isSelection) {
|
|
19539
21039
|
var _this = this;
|
|
@@ -19774,7 +21274,7 @@ var Mention = /** @__PURE__ @class */ (function (_super) {
|
|
|
19774
21274
|
if (this.isPopupOpen) {
|
|
19775
21275
|
this.hidePopup();
|
|
19776
21276
|
}
|
|
19777
|
-
//New event to update the RichTextEditor value, when a mention item is selected using mouse click action.
|
|
21277
|
+
//New event to update the RichTextEditor value, when a mention item is selected using mouse click action.
|
|
19778
21278
|
if (!isNullOrUndefined(e.pointerType) && e.pointerType === 'mouse') {
|
|
19779
21279
|
var event_1 = new CustomEvent('content-changed', { detail: { click: true } });
|
|
19780
21280
|
this.inputElement.dispatchEvent(event_1);
|