@syncfusion/ej2-dropdowns 24.2.8 → 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 -150
- package/dist/ej2-dropdowns.min.js +2 -2
- package/dist/ej2-dropdowns.umd.min.js +2 -2
- package/dist/ej2-dropdowns.umd.min.js.map +1 -1
- package/dist/es6/ej2-dropdowns.es2015.js +2049 -528
- package/dist/es6/ej2-dropdowns.es2015.js.map +1 -1
- package/dist/es6/ej2-dropdowns.es5.js +2072 -533
- 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 +11 -2
- package/src/combo-box/combo-box.d.ts +10 -2
- package/src/combo-box/combo-box.js +75 -16
- 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 +65 -5
- package/src/drop-down-base/drop-down-base.js +242 -25
- package/src/drop-down-list/drop-down-list-model.d.ts +10 -1
- package/src/drop-down-list/drop-down-list.d.ts +16 -51
- package/src/drop-down-list/drop-down-list.js +180 -217
- 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 +21 -9
- 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 +8 -2
- package/styles/bootstrap.css +8 -2
- package/styles/bootstrap4.css +3 -2
- package/styles/bootstrap5-dark.css +3 -2
- package/styles/bootstrap5.css +3 -2
- 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/_layout.scss +1 -1
- package/styles/drop-down-list/bootstrap-dark.css +1 -1
- package/styles/drop-down-list/bootstrap.css +1 -1
- package/styles/drop-down-list/bootstrap4.css +1 -1
- package/styles/drop-down-list/bootstrap5-dark.css +1 -1
- package/styles/drop-down-list/bootstrap5.css +1 -1
- package/styles/drop-down-list/fabric-dark.css +1 -1
- package/styles/drop-down-list/fabric.css +1 -1
- package/styles/drop-down-list/fluent-dark.css +1 -1
- package/styles/drop-down-list/fluent.css +1 -1
- package/styles/drop-down-list/highcontrast-light.css +1 -1
- package/styles/drop-down-list/highcontrast.css +1 -1
- package/styles/drop-down-list/icons/_bds.scss +14 -0
- package/styles/drop-down-list/material-dark.css +1 -1
- package/styles/drop-down-list/material.css +1 -1
- package/styles/drop-down-list/material3-dark.css +1 -1
- package/styles/drop-down-list/material3.css +1 -1
- package/styles/drop-down-list/tailwind-dark.css +1 -1
- package/styles/drop-down-list/tailwind.css +1 -1
- 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 +4 -2
- package/styles/fabric.css +4 -2
- package/styles/fluent-dark.css +8 -2
- package/styles/fluent.css +8 -2
- package/styles/highcontrast-light.css +4 -2
- package/styles/highcontrast.css +4 -2
- package/styles/list-box/_bds-definition.scss +136 -0
- package/styles/list-box/icons/_bds.scss +25 -0
- package/styles/material-dark.css +3 -2
- package/styles/material.css +3 -2
- package/styles/material3-dark.css +3 -2
- package/styles/material3.css +3 -2
- 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 +3 -2
- package/styles/tailwind.css +3 -2
|
@@ -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
|
};
|
|
@@ -1152,7 +1451,7 @@ var DropDownBase = /** @__PURE__ @class */ (function (_super) {
|
|
|
1152
1451
|
_this.trigger('actionComplete', e, function (e) {
|
|
1153
1452
|
if (!_this.virtualGroupDataSource && _this.isVirtualizationEnabled) {
|
|
1154
1453
|
_this.isRemoteDataUpdated = true;
|
|
1155
|
-
if ((_this.getModuleName() === 'combobox' && _this.isAllowFiltering && _this.isVirtualizationEnabled && e.result)) {
|
|
1454
|
+
if ((_this.getModuleName() === 'combobox' && !_this.initialRemoteRender && _this.isAllowFiltering && _this.isVirtualizationEnabled && e.result)) {
|
|
1156
1455
|
e.result = e.result.result;
|
|
1157
1456
|
}
|
|
1158
1457
|
if (e.result.length > 0) {
|
|
@@ -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
|
}
|
|
@@ -2367,7 +2670,7 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
2367
2670
|
this.isFilterFocus = false;
|
|
2368
2671
|
this.beforePopupOpen = false;
|
|
2369
2672
|
this.initial = true;
|
|
2370
|
-
this.
|
|
2673
|
+
this.initialRemoteRender = false;
|
|
2371
2674
|
this.isNotSearchList = false;
|
|
2372
2675
|
this.isTyped = false;
|
|
2373
2676
|
this.isSelected = false;
|
|
@@ -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);
|
|
@@ -2658,7 +2966,7 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
2658
2966
|
this.viewPortInfo.endIndex = this.virtualItemEndIndex = this.itemCount;
|
|
2659
2967
|
this.renderList();
|
|
2660
2968
|
if (this.dataSource instanceof DataManager) {
|
|
2661
|
-
this.
|
|
2969
|
+
this.initialRemoteRender = true;
|
|
2662
2970
|
}
|
|
2663
2971
|
else {
|
|
2664
2972
|
this.updateValues();
|
|
@@ -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
|
}
|
|
@@ -3637,34 +3930,34 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
3637
3930
|
}
|
|
3638
3931
|
};
|
|
3639
3932
|
DropDownList.prototype.setSelection = function (li, e) {
|
|
3640
|
-
var _this = this;
|
|
3641
3933
|
if (this.isValidLI(li) && (!li.classList.contains(dropDownBaseClasses.selected) || (this.isPopupOpen && this.isSelected
|
|
3642
3934
|
&& li.classList.contains(dropDownBaseClasses.selected)))) {
|
|
3643
3935
|
this.updateSelectedItem(li, e, false, true);
|
|
3644
3936
|
}
|
|
3645
3937
|
else {
|
|
3646
3938
|
this.setSelectOptions(li, e);
|
|
3647
|
-
if (this.enableVirtualization) {
|
|
3939
|
+
if (this.enableVirtualization && this.value) {
|
|
3648
3940
|
var fields = (this.fields.value) ? this.fields.value : '';
|
|
3649
|
-
|
|
3650
|
-
|
|
3651
|
-
|
|
3652
|
-
|
|
3653
|
-
|
|
3654
|
-
|
|
3655
|
-
|
|
3656
|
-
|
|
3657
|
-
}
|
|
3941
|
+
var currentValue = this.allowObjectBinding && !isNullOrUndefined(this.value) ? getValue((this.fields.value) ? this.fields.value : '', this.value) : this.value;
|
|
3942
|
+
if (this.dataSource instanceof DataManager && this.virtualGroupDataSource) {
|
|
3943
|
+
var getItem = new DataManager(this.virtualGroupDataSource).executeLocal(new Query().where(new Predicate(fields, 'equal', currentValue)));
|
|
3944
|
+
if (getItem && getItem.length > 0) {
|
|
3945
|
+
this.itemData = getItem[0];
|
|
3946
|
+
var dataItem = this.getItemData();
|
|
3947
|
+
var value = this.allowObjectBinding ? this.getDataByValue(dataItem.value) : dataItem.value;
|
|
3948
|
+
if ((this.value === dataItem.value && this.text !== dataItem.text) || (this.value !== dataItem.value && this.text === dataItem.text)) {
|
|
3949
|
+
this.setProperties({ 'text': dataItem.text, 'value': value });
|
|
3658
3950
|
}
|
|
3659
|
-
}
|
|
3951
|
+
}
|
|
3660
3952
|
}
|
|
3661
3953
|
else {
|
|
3662
|
-
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)));
|
|
3663
3955
|
if (getItem && getItem.length > 0) {
|
|
3664
3956
|
this.itemData = getItem[0];
|
|
3665
3957
|
var dataItem = this.getItemData();
|
|
3958
|
+
var value = this.allowObjectBinding ? this.getDataByValue(dataItem.value) : dataItem.value;
|
|
3666
3959
|
if ((this.value === dataItem.value && this.text !== dataItem.text) || (this.value !== dataItem.value && this.text === dataItem.text)) {
|
|
3667
|
-
this.setProperties({ 'text': dataItem.text, 'value':
|
|
3960
|
+
this.setProperties({ 'text': dataItem.text, 'value': value });
|
|
3668
3961
|
}
|
|
3669
3962
|
}
|
|
3670
3963
|
}
|
|
@@ -3778,10 +4071,23 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
3778
4071
|
* @param {MouseEvent | KeyboardEvent | TouchEvent} eve - Specifies the event arguments.
|
|
3779
4072
|
* @returns {void}
|
|
3780
4073
|
*/
|
|
3781
|
-
DropDownList.prototype.onChangeEvent = function (eve) {
|
|
4074
|
+
DropDownList.prototype.onChangeEvent = function (eve, isCustomValue) {
|
|
4075
|
+
var _this = this;
|
|
3782
4076
|
var dataItem = this.getItemData();
|
|
3783
4077
|
var index = this.isSelectCustom ? null : this.activeIndex;
|
|
3784
|
-
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);
|
|
3785
4091
|
this.detachChangeEvent(eve);
|
|
3786
4092
|
};
|
|
3787
4093
|
DropDownList.prototype.detachChanges = function (value) {
|
|
@@ -3808,7 +4114,7 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
3808
4114
|
DropDownList.prototype.detachChangeEvent = function (eve) {
|
|
3809
4115
|
this.isSelected = false;
|
|
3810
4116
|
this.previousValue = this.value;
|
|
3811
|
-
this.activeIndex = this.index;
|
|
4117
|
+
this.activeIndex = this.enableVirtualization ? this.getIndexByValue(this.value) : this.index;
|
|
3812
4118
|
this.typedString = !isNullOrUndefined(this.text) ? this.text : '';
|
|
3813
4119
|
if (!this.initial) {
|
|
3814
4120
|
var items = this.detachChanges(this.itemData);
|
|
@@ -3855,16 +4161,17 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
3855
4161
|
};
|
|
3856
4162
|
DropDownList.prototype.setHiddenValue = function () {
|
|
3857
4163
|
if (!isNullOrUndefined(this.value)) {
|
|
4164
|
+
var value = this.allowObjectBinding && !isNullOrUndefined(this.value) ? getValue((this.fields.value) ? this.fields.value : '', this.value) : this.value;
|
|
3858
4165
|
if (this.hiddenElement.querySelector('option')) {
|
|
3859
4166
|
var selectedElement = this.hiddenElement.querySelector('option');
|
|
3860
4167
|
selectedElement.textContent = this.text;
|
|
3861
|
-
selectedElement.setAttribute('value',
|
|
4168
|
+
selectedElement.setAttribute('value', value.toString());
|
|
3862
4169
|
}
|
|
3863
4170
|
else {
|
|
3864
4171
|
if (!isNullOrUndefined(this.hiddenElement)) {
|
|
3865
4172
|
this.hiddenElement.innerHTML = '<option selected>' + this.text + '</option>';
|
|
3866
4173
|
var selectedElement = this.hiddenElement.querySelector('option');
|
|
3867
|
-
selectedElement.setAttribute('value',
|
|
4174
|
+
selectedElement.setAttribute('value', value.toString());
|
|
3868
4175
|
}
|
|
3869
4176
|
}
|
|
3870
4177
|
}
|
|
@@ -3881,6 +4188,7 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
3881
4188
|
DropDownList.prototype.onFilterUp = function (e) {
|
|
3882
4189
|
if (!(e.ctrlKey && e.keyCode === 86) && (this.isValidKey || e.keyCode === 40 || e.keyCode === 38)) {
|
|
3883
4190
|
this.isValidKey = false;
|
|
4191
|
+
this.firstItem = this.dataSource && this.dataSource.length > 0 ? this.dataSource[0] : null;
|
|
3884
4192
|
switch (e.keyCode) {
|
|
3885
4193
|
case 38: //up arrow
|
|
3886
4194
|
case 40: //down arrow
|
|
@@ -3937,42 +4245,6 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
3937
4245
|
this.isValidKey = false;
|
|
3938
4246
|
}
|
|
3939
4247
|
};
|
|
3940
|
-
DropDownList.prototype.getFilteringSkeletonCount = function () {
|
|
3941
|
-
var difference = this.dataCount - this.viewPortInfo.endIndex;
|
|
3942
|
-
var currentSkeletonCount = this.skeletonCount;
|
|
3943
|
-
this.getSkeletonCount(true);
|
|
3944
|
-
this.skeletonCount = this.dataCount > this.itemCount * 2 ? this.skeletonCount : difference > this.skeletonCount ? this.skeletonCount : difference > 0 ? difference : 0;
|
|
3945
|
-
var skeletonUpdated = true;
|
|
3946
|
-
if (this.getModuleName() === 'autocomplete' && (this.totalItemCount != 0 && this.totalItemCount < (this.itemCount * 2))) {
|
|
3947
|
-
this.skeletonCount = 0;
|
|
3948
|
-
skeletonUpdated = false;
|
|
3949
|
-
}
|
|
3950
|
-
if (!this.list.classList.contains(dropDownBaseClasses.noData)) {
|
|
3951
|
-
var isSkeletonCountChange = currentSkeletonCount !== this.skeletonCount;
|
|
3952
|
-
if (currentSkeletonCount !== this.skeletonCount && skeletonUpdated) {
|
|
3953
|
-
this.UpdateSkeleton(true, Math.abs(currentSkeletonCount - this.skeletonCount));
|
|
3954
|
-
}
|
|
3955
|
-
else {
|
|
3956
|
-
this.UpdateSkeleton();
|
|
3957
|
-
}
|
|
3958
|
-
this.liCollections = this.list.querySelectorAll('.e-list-item');
|
|
3959
|
-
if ((this.list.getElementsByClassName('e-virtual-ddl').length > 0)) {
|
|
3960
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3961
|
-
this.list.getElementsByClassName('e-virtual-ddl')[0].style = this.GetVirtualTrackHeight();
|
|
3962
|
-
}
|
|
3963
|
-
if (this.list.getElementsByClassName('e-virtual-ddl-content').length > 0) {
|
|
3964
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3965
|
-
this.list.getElementsByClassName('e-virtual-ddl-content')[0].style = this.getTransformValues();
|
|
3966
|
-
}
|
|
3967
|
-
}
|
|
3968
|
-
};
|
|
3969
|
-
DropDownList.prototype.getSkeletonCount = function (retainSkeleton) {
|
|
3970
|
-
this.virtualListHeight = this.listHeight != null ? parseInt(this.listHeight, 10) : this.virtualListHeight;
|
|
3971
|
-
var actualCount = this.virtualListHeight > 0 ? Math.floor(this.virtualListHeight / this.listItemHeight) : 0;
|
|
3972
|
-
this.skeletonCount = actualCount * 2 < this.itemCount ? this.itemCount : actualCount * 2;
|
|
3973
|
-
this.itemCount = retainSkeleton ? this.itemCount : this.skeletonCount;
|
|
3974
|
-
this.skeletonCount = Math.floor(this.skeletonCount / 2) + 2;
|
|
3975
|
-
};
|
|
3976
4248
|
DropDownList.prototype.onFilterDown = function (e) {
|
|
3977
4249
|
switch (e.keyCode) {
|
|
3978
4250
|
case 13: //enter
|
|
@@ -4027,14 +4299,51 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
4027
4299
|
}
|
|
4028
4300
|
}
|
|
4029
4301
|
}
|
|
4030
|
-
|
|
4031
|
-
|
|
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
|
+
}
|
|
4032
4334
|
}
|
|
4033
4335
|
if (this.isIncrementalRequest) {
|
|
4034
4336
|
filterQuery.take(this.incrementalEndIndex);
|
|
4035
4337
|
}
|
|
4036
4338
|
else {
|
|
4037
|
-
|
|
4339
|
+
if (!takeExists) {
|
|
4340
|
+
if (queryTakeValue > 0) {
|
|
4341
|
+
filterQuery.take(queryTakeValue);
|
|
4342
|
+
}
|
|
4343
|
+
else {
|
|
4344
|
+
filterQuery.take(takeValue);
|
|
4345
|
+
}
|
|
4346
|
+
}
|
|
4038
4347
|
}
|
|
4039
4348
|
filterQuery.requiresCount();
|
|
4040
4349
|
}
|
|
@@ -4255,29 +4564,6 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
4255
4564
|
this.renderPopup();
|
|
4256
4565
|
}
|
|
4257
4566
|
};
|
|
4258
|
-
DropDownList.prototype.UpdateSkeleton = function (isSkeletonCountChange, skeletonCount) {
|
|
4259
|
-
var isContainSkeleton = this.list.querySelector('.e-virtual-ddl-content');
|
|
4260
|
-
var isContainVirtualList = this.list.querySelector('.e-virtual-list');
|
|
4261
|
-
if (isContainSkeleton && (!isContainVirtualList || isSkeletonCountChange) && this.enableVirtualization) {
|
|
4262
|
-
var totalSkeletonCount = isSkeletonCountChange ? skeletonCount : this.skeletonCount;
|
|
4263
|
-
for (var i = 0; i < totalSkeletonCount; i++) {
|
|
4264
|
-
var liElement = this.createElement('li', { className: dropDownListClasses.virtualList, styles: 'overflow: inherit' });
|
|
4265
|
-
if (this.enableVirtualization && this.itemTemplate) {
|
|
4266
|
-
liElement.style.height = this.listItemHeight + 'px';
|
|
4267
|
-
}
|
|
4268
|
-
var skeleton = new Skeleton({
|
|
4269
|
-
shape: "Text",
|
|
4270
|
-
height: "10px",
|
|
4271
|
-
width: "95%",
|
|
4272
|
-
cssClass: "e-skeleton-text",
|
|
4273
|
-
});
|
|
4274
|
-
skeleton.appendTo(this.createElement('div'));
|
|
4275
|
-
liElement.appendChild(skeleton.element);
|
|
4276
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4277
|
-
isContainSkeleton.firstChild.insertBefore(liElement, isContainSkeleton.firstChild.children[0]);
|
|
4278
|
-
}
|
|
4279
|
-
}
|
|
4280
|
-
};
|
|
4281
4567
|
DropDownList.prototype.getTakeValue = function () {
|
|
4282
4568
|
return this.allowFiltering && this.getModuleName() === 'dropdownlist' && Browser.isDevice ? Math.round(window.outerHeight / this.listItemHeight) : this.itemCount;
|
|
4283
4569
|
};
|
|
@@ -4313,19 +4599,26 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
4313
4599
|
if (!isNullOrUndefined(ulElement)) {
|
|
4314
4600
|
attributes(ulElement, { 'id': this.element.id + '_options', 'role': 'listbox', 'aria-hidden': 'false', 'aria-label': 'listbox' });
|
|
4315
4601
|
}
|
|
4316
|
-
if (this.
|
|
4602
|
+
if (this.initialRemoteRender) {
|
|
4317
4603
|
this.initial = true;
|
|
4318
4604
|
this.activeIndex = this.index;
|
|
4319
|
-
this.
|
|
4605
|
+
this.initialRemoteRender = false;
|
|
4320
4606
|
if (this.value && this.dataSource instanceof DataManager) {
|
|
4321
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;
|
|
4322
4609
|
var fieldValue_1 = this.fields.value.split('.');
|
|
4323
4610
|
var checkVal = list.some(function (x) {
|
|
4324
4611
|
return isNullOrUndefined(x[checkField_1]) && fieldValue_1.length > 1 ?
|
|
4325
|
-
_this.checkFieldValue(x, fieldValue_1) ===
|
|
4612
|
+
_this.checkFieldValue(x, fieldValue_1) === value_5 : x[checkField_1] === value_5;
|
|
4326
4613
|
});
|
|
4614
|
+
if (this.enableVirtualization && this.virtualGroupDataSource) {
|
|
4615
|
+
checkVal = this.virtualGroupDataSource.some(function (x) {
|
|
4616
|
+
return isNullOrUndefined(x[checkField_1]) && fieldValue_1.length > 1 ?
|
|
4617
|
+
_this.checkFieldValue(x, fieldValue_1) === value_5 : x[checkField_1] === value_5;
|
|
4618
|
+
});
|
|
4619
|
+
}
|
|
4327
4620
|
if (!checkVal) {
|
|
4328
|
-
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)))
|
|
4329
4622
|
.then(function (e) {
|
|
4330
4623
|
if (e.result.length > 0) {
|
|
4331
4624
|
_this.addItem(e.result, list.length);
|
|
@@ -4437,10 +4730,10 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
4437
4730
|
DropDownList.prototype.addNewItem = function (listData, newElement) {
|
|
4438
4731
|
var _this = this;
|
|
4439
4732
|
if (!isNullOrUndefined(this.itemData) && !isNullOrUndefined(newElement)) {
|
|
4440
|
-
var
|
|
4733
|
+
var value_6 = this.getItemData().value;
|
|
4441
4734
|
var isExist = listData.some(function (data) {
|
|
4442
|
-
return (((typeof data === 'string' || typeof data === 'number') && data ===
|
|
4443
|
-
(getValue(_this.fields.value, data) ===
|
|
4735
|
+
return (((typeof data === 'string' || typeof data === 'number') && data === value_6) ||
|
|
4736
|
+
(getValue(_this.fields.value, data) === value_6));
|
|
4444
4737
|
});
|
|
4445
4738
|
if (!isExist) {
|
|
4446
4739
|
this.addItem(this.itemData);
|
|
@@ -4496,46 +4789,19 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
4496
4789
|
DropDownList.prototype.updateSelectionList = function () {
|
|
4497
4790
|
var selectedItem = this.list && this.list.querySelector('.' + 'e-active');
|
|
4498
4791
|
if (!selectedItem && !isNullOrUndefined(this.value)) {
|
|
4499
|
-
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);
|
|
4500
4794
|
if (findEle) {
|
|
4501
4795
|
findEle.classList.add('e-active');
|
|
4502
4796
|
}
|
|
4503
4797
|
}
|
|
4504
4798
|
};
|
|
4505
|
-
DropDownList.prototype.checkAndResetCache = function () {
|
|
4506
|
-
if (this.enableVirtualization) {
|
|
4507
|
-
this.generatedDataObject = {};
|
|
4508
|
-
this.virtualItemStartIndex = this.virtualItemEndIndex = 0;
|
|
4509
|
-
this.viewPortInfo = { currentPageNumber: null,
|
|
4510
|
-
direction: null,
|
|
4511
|
-
sentinelInfo: {},
|
|
4512
|
-
offsets: {},
|
|
4513
|
-
startIndex: 0,
|
|
4514
|
-
endIndex: this.itemCount, };
|
|
4515
|
-
this.selectedValueInfo = null;
|
|
4516
|
-
}
|
|
4517
|
-
};
|
|
4518
4799
|
DropDownList.prototype.removeFocus = function () {
|
|
4519
4800
|
var highlightedItem = this.list.querySelectorAll('.' + dropDownListClasses.focus);
|
|
4520
4801
|
if (highlightedItem && highlightedItem.length) {
|
|
4521
4802
|
removeClass(highlightedItem, dropDownListClasses.focus);
|
|
4522
4803
|
}
|
|
4523
4804
|
};
|
|
4524
|
-
DropDownList.prototype.getTransformValues = function () {
|
|
4525
|
-
var translateY = this.viewPortInfo.startIndex * this.listItemHeight;
|
|
4526
|
-
translateY = translateY - (this.skeletonCount * this.listItemHeight);
|
|
4527
|
-
translateY = this.viewPortInfo.startIndex === 0 && this.listData && this.listData.length === 0 ? 0 : translateY;
|
|
4528
|
-
var styleText = "transform: translate(0px, " + translateY + "px);";
|
|
4529
|
-
return styleText;
|
|
4530
|
-
};
|
|
4531
|
-
DropDownList.prototype.GetVirtualTrackHeight = function () {
|
|
4532
|
-
var height = this.totalItemCount === this.viewPortInfo.endIndex ? this.totalItemCount * this.listItemHeight - this.itemCount * this.listItemHeight : this.totalItemCount * this.listItemHeight;
|
|
4533
|
-
var heightDimension = "height: " + (height - this.itemCount * this.listItemHeight) + "px;";
|
|
4534
|
-
if (this.getModuleName() === 'autocomplete' && this.skeletonCount === 0) {
|
|
4535
|
-
return "height: 0px;";
|
|
4536
|
-
}
|
|
4537
|
-
return heightDimension;
|
|
4538
|
-
};
|
|
4539
4805
|
DropDownList.prototype.renderPopup = function (e) {
|
|
4540
4806
|
var _this = this;
|
|
4541
4807
|
if (this.popupObj && document.body.contains(this.popupObj.element)) {
|
|
@@ -4551,7 +4817,7 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
4551
4817
|
popupEle.setAttribute('aria-label', _this.element.id);
|
|
4552
4818
|
popupEle.setAttribute('role', 'dialog');
|
|
4553
4819
|
var searchBox = _this.setSearchBox(popupEle);
|
|
4554
|
-
_this.
|
|
4820
|
+
_this.listContainerHeight = formatUnit(_this.popupHeight);
|
|
4555
4821
|
if (_this.headerTemplate) {
|
|
4556
4822
|
_this.setHeaderTemplate(popupEle);
|
|
4557
4823
|
}
|
|
@@ -4595,19 +4861,19 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
4595
4861
|
_this.searchBoxHeight = 0;
|
|
4596
4862
|
if (!isNullOrUndefined(searchBox.container) && _this.getModuleName() !== 'combobox' && _this.getModuleName() !== 'autocomplete') {
|
|
4597
4863
|
_this.searchBoxHeight = (searchBox.container.parentElement).getBoundingClientRect().height;
|
|
4598
|
-
_this.
|
|
4864
|
+
_this.listContainerHeight = (parseInt(_this.listContainerHeight, 10) - (_this.searchBoxHeight)).toString() + 'px';
|
|
4599
4865
|
}
|
|
4600
4866
|
if (_this.headerTemplate) {
|
|
4601
4867
|
_this.header = _this.header ? _this.header : popupEle.querySelector('.e-ddl-header');
|
|
4602
4868
|
var height = Math.round(_this.header.getBoundingClientRect().height);
|
|
4603
|
-
_this.
|
|
4869
|
+
_this.listContainerHeight = (parseInt(_this.listContainerHeight, 10) - (height + _this.searchBoxHeight)).toString() + 'px';
|
|
4604
4870
|
}
|
|
4605
4871
|
if (_this.footerTemplate) {
|
|
4606
4872
|
_this.footer = _this.footer ? _this.footer : popupEle.querySelector('.e-ddl-footer');
|
|
4607
4873
|
var height = Math.round(_this.footer.getBoundingClientRect().height);
|
|
4608
|
-
_this.
|
|
4874
|
+
_this.listContainerHeight = (parseInt(_this.listContainerHeight, 10) - (height + _this.searchBoxHeight)).toString() + 'px';
|
|
4609
4875
|
}
|
|
4610
|
-
_this.list.style.maxHeight = (parseInt(_this.
|
|
4876
|
+
_this.list.style.maxHeight = (parseInt(_this.listContainerHeight, 10) - 2).toString() + 'px'; // due to box-sizing property
|
|
4611
4877
|
popupEle.style.maxHeight = formatUnit(_this.popupHeight);
|
|
4612
4878
|
}
|
|
4613
4879
|
else {
|
|
@@ -4640,6 +4906,9 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
4640
4906
|
_this.getFocusElement();
|
|
4641
4907
|
_this.checkCollision(popupEle);
|
|
4642
4908
|
if (Browser.isDevice) {
|
|
4909
|
+
if ((parseInt(_this.popupWidth.toString(), 10) > window.outerWidth) && !(_this.getModuleName() === 'dropdownlist' && _this.allowFiltering)) {
|
|
4910
|
+
_this.popupObj.element.classList.add('e-wide-popup');
|
|
4911
|
+
}
|
|
4643
4912
|
_this.popupObj.element.classList.add(dropDownListClasses.device);
|
|
4644
4913
|
if (_this.getModuleName() === 'dropdownlist' || (_this.getModuleName() === 'combobox'
|
|
4645
4914
|
&& !_this.allowFiltering && _this.isDropDownClick)) {
|
|
@@ -4915,6 +5184,9 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
4915
5184
|
this.list.scrollTop += nextOffset;
|
|
4916
5185
|
}
|
|
4917
5186
|
else {
|
|
5187
|
+
if (this.enableVirtualization) {
|
|
5188
|
+
liCount = keyAction == "pageDown" ? this.getPageCount() : liCount;
|
|
5189
|
+
}
|
|
4918
5190
|
this.list.scrollTop += this.selectedLI.offsetHeight * liCount;
|
|
4919
5191
|
}
|
|
4920
5192
|
this.isPreventKeyAction = this.IsScrollerAtEnd() ? false : this.isPreventKeyAction;
|
|
@@ -4968,6 +5240,9 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
4968
5240
|
else if (nextOffset < 0 || isPageUpKeyAction) {
|
|
4969
5241
|
var currentElementValue = this.selectedLI ? this.selectedLI.getAttribute('data-value') : null;
|
|
4970
5242
|
var liCount = keyAction == "pageUp" ? this.getPageCount() - 2 : 1;
|
|
5243
|
+
if (this.enableVirtualization) {
|
|
5244
|
+
liCount = keyAction == "pageUp" ? this.getPageCount() : liCount;
|
|
5245
|
+
}
|
|
4971
5246
|
if (this.enableVirtualization && this.isKeyBoardAction && firstElementValue && currentElementValue === firstElementValue && keyAction != "home" && !this.isVirtualScrolling) {
|
|
4972
5247
|
this.isUpwardScrolling = true;
|
|
4973
5248
|
this.isPreventKeyAction = true;
|
|
@@ -5065,6 +5340,7 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
5065
5340
|
var isFilterValue = !isNullOrUndefined(this.filterInput) && !isNullOrUndefined(this.filterInput.value) && this.filterInput.value !== '';
|
|
5066
5341
|
var typedString = this.getModuleName() === 'combobox' ? this.typedString : null;
|
|
5067
5342
|
this.isTyped = false;
|
|
5343
|
+
this.isVirtualTrackHeight = false;
|
|
5068
5344
|
if (!(this.popupObj && document.body.contains(this.popupObj.element) && this.beforePopupOpen)) {
|
|
5069
5345
|
return;
|
|
5070
5346
|
}
|
|
@@ -5154,8 +5430,8 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
5154
5430
|
}
|
|
5155
5431
|
}
|
|
5156
5432
|
});
|
|
5157
|
-
if (
|
|
5158
|
-
this.
|
|
5433
|
+
if (Browser.isDevice && !eventArgs.cancel && this.popupObj.element.classList.contains('e-wide-popup')) {
|
|
5434
|
+
this.popupObj.element.classList.remove('e-wide-popup');
|
|
5159
5435
|
}
|
|
5160
5436
|
var dataSourceCount;
|
|
5161
5437
|
if (this.dataSource instanceof DataManager) {
|
|
@@ -5320,6 +5596,9 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
5320
5596
|
this.listItemHeight = this.getListHeight();
|
|
5321
5597
|
this.getSkeletonCount();
|
|
5322
5598
|
this.updateVirtualizationProperties(this.itemCount, this.allowFiltering);
|
|
5599
|
+
if (this.index !== null) {
|
|
5600
|
+
this.activeIndex = this.index + this.skeletonCount;
|
|
5601
|
+
}
|
|
5323
5602
|
}
|
|
5324
5603
|
this.initValue();
|
|
5325
5604
|
this.selectedValueInfo = this.viewPortInfo;
|
|
@@ -5329,7 +5608,7 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
5329
5608
|
}
|
|
5330
5609
|
else if (this.element.tagName === 'SELECT' && this.element.options[0]) {
|
|
5331
5610
|
var selectElement = this.element;
|
|
5332
|
-
this.value = selectElement.options[selectElement.selectedIndex].value;
|
|
5611
|
+
this.value = this.allowObjectBinding ? this.getDataByValue(selectElement.options[selectElement.selectedIndex].value) : selectElement.options[selectElement.selectedIndex].value;
|
|
5333
5612
|
this.text = isNullOrUndefined(this.value) ? null : selectElement.options[selectElement.selectedIndex].textContent;
|
|
5334
5613
|
this.initValue();
|
|
5335
5614
|
}
|
|
@@ -5481,7 +5760,7 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
5481
5760
|
this.actionData = this.actionCompleteData;
|
|
5482
5761
|
}
|
|
5483
5762
|
};
|
|
5484
|
-
DropDownList.prototype.updateDataSource = function (props) {
|
|
5763
|
+
DropDownList.prototype.updateDataSource = function (props, oldProps) {
|
|
5485
5764
|
if (this.inputElement.value !== '' || (!isNullOrUndefined(props) && (isNullOrUndefined(props.dataSource)
|
|
5486
5765
|
|| (!(props.dataSource instanceof DataManager) && props.dataSource.length === 0)))) {
|
|
5487
5766
|
this.clearAll(null, props);
|
|
@@ -5491,7 +5770,7 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
5491
5770
|
EventHandler.add(this.list, 'scroll', this.setFloatingHeader, this);
|
|
5492
5771
|
}
|
|
5493
5772
|
if (!(!isNullOrUndefined(props) && (isNullOrUndefined(props.dataSource)
|
|
5494
|
-
|| (!(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))) {
|
|
5495
5774
|
this.typedString = '';
|
|
5496
5775
|
this.resetList(this.dataSource);
|
|
5497
5776
|
}
|
|
@@ -5500,9 +5779,11 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
5500
5779
|
}
|
|
5501
5780
|
};
|
|
5502
5781
|
DropDownList.prototype.checkCustomValue = function () {
|
|
5503
|
-
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);
|
|
5504
5784
|
var dataItem = this.getItemData();
|
|
5505
|
-
this.
|
|
5785
|
+
var value = this.allowObjectBinding ? this.itemData : dataItem.value;
|
|
5786
|
+
this.setProperties({ 'text': dataItem.text, 'value': value });
|
|
5506
5787
|
};
|
|
5507
5788
|
DropDownList.prototype.updateInputFields = function () {
|
|
5508
5789
|
if (this.getModuleName() === 'dropdownlist') {
|
|
@@ -5583,11 +5864,11 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
5583
5864
|
}
|
|
5584
5865
|
if (!this_1.list) {
|
|
5585
5866
|
if (this_1.dataSource instanceof DataManager) {
|
|
5586
|
-
this_1.
|
|
5867
|
+
this_1.initialRemoteRender = true;
|
|
5587
5868
|
}
|
|
5588
5869
|
this_1.renderList();
|
|
5589
5870
|
}
|
|
5590
|
-
if (!this_1.
|
|
5871
|
+
if (!this_1.initialRemoteRender) {
|
|
5591
5872
|
var li = this_1.getElementByText(newProp.text);
|
|
5592
5873
|
if (!this_1.checkValidLi(li)) {
|
|
5593
5874
|
if (this_1.liCollections && this_1.liCollections.length === 100 &&
|
|
@@ -5624,6 +5905,9 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
5624
5905
|
this_1.clearAll();
|
|
5625
5906
|
break;
|
|
5626
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
|
+
}
|
|
5627
5911
|
if (this_1.enableVirtualization) {
|
|
5628
5912
|
this_1.updateValues();
|
|
5629
5913
|
this_1.updateInputFields();
|
|
@@ -5636,12 +5920,13 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
5636
5920
|
this_1.notify('beforeValueChange', { newProp: newProp }); // gird component value type change
|
|
5637
5921
|
if (!this_1.list) {
|
|
5638
5922
|
if (this_1.dataSource instanceof DataManager) {
|
|
5639
|
-
this_1.
|
|
5923
|
+
this_1.initialRemoteRender = true;
|
|
5640
5924
|
}
|
|
5641
5925
|
this_1.renderList();
|
|
5642
5926
|
}
|
|
5643
|
-
if (!this_1.
|
|
5644
|
-
var
|
|
5927
|
+
if (!this_1.initialRemoteRender) {
|
|
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);
|
|
5645
5930
|
if (!this_1.checkValidLi(item)) {
|
|
5646
5931
|
if (this_1.liCollections && this_1.liCollections.length === 100 &&
|
|
5647
5932
|
this_1.getModuleName() === 'autocomplete' && this_1.listData.length > 100) {
|
|
@@ -5651,7 +5936,8 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
5651
5936
|
var listLength_2 = this_1.getItems().length;
|
|
5652
5937
|
var checkField = isNullOrUndefined(this_1.fields.value) ? this_1.fields.text : this_1.fields.value;
|
|
5653
5938
|
this_1.typedString = '';
|
|
5654
|
-
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)))
|
|
5655
5941
|
.then(function (e) {
|
|
5656
5942
|
if (e.result.length > 0) {
|
|
5657
5943
|
_this.addItem(e.result, listLength_2);
|
|
@@ -5680,11 +5966,11 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
5680
5966
|
}
|
|
5681
5967
|
if (!this_1.list) {
|
|
5682
5968
|
if (this_1.dataSource instanceof DataManager) {
|
|
5683
|
-
this_1.
|
|
5969
|
+
this_1.initialRemoteRender = true;
|
|
5684
5970
|
}
|
|
5685
5971
|
this_1.renderList();
|
|
5686
5972
|
}
|
|
5687
|
-
if (!this_1.
|
|
5973
|
+
if (!this_1.initialRemoteRender && this_1.liCollections) {
|
|
5688
5974
|
var element = this_1.liCollections[newProp.index];
|
|
5689
5975
|
if (!this_1.checkValidLi(element)) {
|
|
5690
5976
|
if (this_1.liCollections && this_1.liCollections.length === 100 &&
|
|
@@ -5748,7 +6034,9 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
5748
6034
|
var this_1 = this;
|
|
5749
6035
|
for (var _i = 0, _a = Object.keys(newProp); _i < _a.length; _i++) {
|
|
5750
6036
|
var prop = _a[_i];
|
|
5751
|
-
_loop_1(prop);
|
|
6037
|
+
var state_1 = _loop_1(prop);
|
|
6038
|
+
if (typeof state_1 === "object")
|
|
6039
|
+
return state_1.value;
|
|
5752
6040
|
}
|
|
5753
6041
|
};
|
|
5754
6042
|
DropDownList.prototype.checkValidLi = function (element) {
|
|
@@ -5769,6 +6057,8 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
5769
6057
|
}
|
|
5770
6058
|
}
|
|
5771
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;
|
|
5772
6062
|
li = _this.getElementByValue(newProp);
|
|
5773
6063
|
if (!_this.checkValidLi(li)) {
|
|
5774
6064
|
_this.setOldValue(oldProp);
|
|
@@ -5831,6 +6121,7 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
5831
6121
|
if (!this.enabled) {
|
|
5832
6122
|
return;
|
|
5833
6123
|
}
|
|
6124
|
+
this.firstItem = this.dataSource && this.dataSource.length > 0 ? this.dataSource[0] : null;
|
|
5834
6125
|
if (this.isReact && this.getModuleName() === 'combobox' && this.itemTemplate && this.isCustomFilter && this.isAddNewItemTemplate) {
|
|
5835
6126
|
this.renderList();
|
|
5836
6127
|
this.isAddNewItemTemplate = false;
|
|
@@ -5851,6 +6142,9 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
5851
6142
|
}
|
|
5852
6143
|
else if (isNullOrUndefined(this.list) || !isUndefined(this.list) && (this.list.classList.contains(dropDownBaseClasses.noData) ||
|
|
5853
6144
|
this.list.querySelectorAll('.' + dropDownBaseClasses.li).length <= 0)) {
|
|
6145
|
+
if (this.isReact && this.isFiltering() && this.itemTemplate != null) {
|
|
6146
|
+
this.isSecondClick = false;
|
|
6147
|
+
}
|
|
5854
6148
|
this.renderList(e);
|
|
5855
6149
|
}
|
|
5856
6150
|
if (this.enableVirtualization && this.listData && this.listData.length) {
|
|
@@ -5904,7 +6198,8 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
5904
6198
|
}
|
|
5905
6199
|
this.isEscapeKey = false;
|
|
5906
6200
|
if (!isNullOrUndefined(this.index)) {
|
|
5907
|
-
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);
|
|
5908
6203
|
this.selectedLI = this.liCollections[this.index] || element;
|
|
5909
6204
|
if (this.selectedLI) {
|
|
5910
6205
|
this.updateSelectedItem(this.selectedLI, null, true);
|
|
@@ -5917,6 +6212,7 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
5917
6212
|
this.resetSelection();
|
|
5918
6213
|
}
|
|
5919
6214
|
}
|
|
6215
|
+
this.isVirtualTrackHeight = false;
|
|
5920
6216
|
this.closePopup(0, e);
|
|
5921
6217
|
var dataItem = this.getItemData();
|
|
5922
6218
|
var isSelectVal = !isNullOrUndefined(this.selectedLI);
|
|
@@ -5988,6 +6284,9 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
5988
6284
|
*/
|
|
5989
6285
|
DropDownList.prototype.destroy = function () {
|
|
5990
6286
|
this.isActive = false;
|
|
6287
|
+
if (this.showClearButton) {
|
|
6288
|
+
this.clearButton = document.getElementsByClassName('e-clear-icon')[0];
|
|
6289
|
+
}
|
|
5991
6290
|
resetIncrementalSearchValues(this.element.id);
|
|
5992
6291
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5993
6292
|
if (this.isReact) {
|
|
@@ -6043,6 +6342,14 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
6043
6342
|
if (this.inputElement && !isNullOrUndefined(this.inputElement.onchange)) {
|
|
6044
6343
|
this.inputElement.onchange = null;
|
|
6045
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);
|
|
6046
6353
|
if (this.isAngular) {
|
|
6047
6354
|
this.inputElement = null;
|
|
6048
6355
|
}
|
|
@@ -6057,7 +6364,7 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
6057
6364
|
DropDownList.prototype.getItems = function () {
|
|
6058
6365
|
if (!this.list) {
|
|
6059
6366
|
if (this.dataSource instanceof DataManager) {
|
|
6060
|
-
this.
|
|
6367
|
+
this.initialRemoteRender = true;
|
|
6061
6368
|
}
|
|
6062
6369
|
this.renderList();
|
|
6063
6370
|
}
|
|
@@ -6135,6 +6442,9 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
6135
6442
|
__decorate$1([
|
|
6136
6443
|
Property(null)
|
|
6137
6444
|
], DropDownList.prototype, "value", void 0);
|
|
6445
|
+
__decorate$1([
|
|
6446
|
+
Property(false)
|
|
6447
|
+
], DropDownList.prototype, "allowObjectBinding", void 0);
|
|
6138
6448
|
__decorate$1([
|
|
6139
6449
|
Property(null)
|
|
6140
6450
|
], DropDownList.prototype, "index", void 0);
|
|
@@ -6330,7 +6640,6 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
6330
6640
|
_this.filterTimer = null;
|
|
6331
6641
|
_this.isFilteredData = false;
|
|
6332
6642
|
_this.isFilterRestore = false;
|
|
6333
|
-
// eslint-disable-next-line
|
|
6334
6643
|
_this.selectedData = [];
|
|
6335
6644
|
_this.filterDelayTime = 300;
|
|
6336
6645
|
_this.isClicked = false;
|
|
@@ -6428,7 +6737,7 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
6428
6737
|
this.inputEle.setAttribute('aria-expanded', 'false');
|
|
6429
6738
|
this.inputEle.setAttribute('role', 'combobox');
|
|
6430
6739
|
this.inputEle.setAttribute('aria-haspopup', 'tree');
|
|
6431
|
-
this.inputEle.setAttribute('aria-controls', this.element.id +
|
|
6740
|
+
this.inputEle.setAttribute('aria-controls', this.element.id + '_options');
|
|
6432
6741
|
}
|
|
6433
6742
|
if (isNullOrUndefined(this.inputEle.getAttribute('type'))) {
|
|
6434
6743
|
this.inputEle.setAttribute('type', 'text');
|
|
@@ -6471,7 +6780,9 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
6471
6780
|
this.popupDiv.classList.add(DROPDOWN);
|
|
6472
6781
|
this.tree = this.createElement('div', { id: this.element.id + '_tree' });
|
|
6473
6782
|
this.popupDiv.appendChild(this.tree);
|
|
6474
|
-
|
|
6783
|
+
if (!this.destroyPopupOnHide) {
|
|
6784
|
+
document.body.appendChild(this.popupDiv);
|
|
6785
|
+
}
|
|
6475
6786
|
this.wireTreeEvents();
|
|
6476
6787
|
addClass([this.popupDiv], DDTHIDEICON);
|
|
6477
6788
|
this.renderTree();
|
|
@@ -6578,6 +6889,7 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
6578
6889
|
if (value === '') {
|
|
6579
6890
|
_this.isFilteredData = false;
|
|
6580
6891
|
_this.isFilterRestore = true;
|
|
6892
|
+
_this.isFromFilterChange = false;
|
|
6581
6893
|
fields = _this.cloneFields(_this.fields);
|
|
6582
6894
|
}
|
|
6583
6895
|
else if (args.preventDefaultAction) {
|
|
@@ -6616,7 +6928,7 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
6616
6928
|
_this.treeObj.dataBind();
|
|
6617
6929
|
if (_this.hasTemplate && _this.portals && _this.treeObj.portals) {
|
|
6618
6930
|
for (var i = 0; i < _this.treeObj.portals.length; i++) {
|
|
6619
|
-
if (_this.portals.indexOf(_this.treeObj.portals[i])
|
|
6931
|
+
if (_this.portals.indexOf(_this.treeObj.portals[i]) === -1) {
|
|
6620
6932
|
_this.portals.push(_this.treeObj.portals[i]);
|
|
6621
6933
|
}
|
|
6622
6934
|
}
|
|
@@ -6660,7 +6972,6 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
6660
6972
|
return filteredItems;
|
|
6661
6973
|
};
|
|
6662
6974
|
DropDownTree.prototype.nestedFilter = function (value, filteredFields) {
|
|
6663
|
-
// eslint-disable-next-line
|
|
6664
6975
|
var matchedDataSource = [];
|
|
6665
6976
|
for (var i = 0; i < this.treeData.length; i++) {
|
|
6666
6977
|
// eslint-disable-next-line
|
|
@@ -6672,15 +6983,12 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
6672
6983
|
filteredFields.dataSource = matchedDataSource;
|
|
6673
6984
|
return filteredFields;
|
|
6674
6985
|
};
|
|
6675
|
-
// eslint-disable-next-line
|
|
6676
6986
|
DropDownTree.prototype.nestedChildFilter = function (value, node) {
|
|
6677
|
-
// eslint-disable-next-line
|
|
6678
6987
|
var children = node[this.fields.child];
|
|
6679
6988
|
if (isNullOrUndefined(children)) {
|
|
6680
6989
|
return (this.isMatchedNode(value, node)) ? node : null;
|
|
6681
6990
|
}
|
|
6682
6991
|
else {
|
|
6683
|
-
// eslint-disable-next-line
|
|
6684
6992
|
var matchedChildren = [];
|
|
6685
6993
|
for (var i = 0; i < children.length; i++) {
|
|
6686
6994
|
// eslint-disable-next-line
|
|
@@ -6701,9 +7009,7 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
6701
7009
|
}
|
|
6702
7010
|
};
|
|
6703
7011
|
DropDownTree.prototype.selfReferencefilter = function (value, filteredFields) {
|
|
6704
|
-
// eslint-disable-next-line
|
|
6705
7012
|
var matchedData = [];
|
|
6706
|
-
// eslint-disable-next-line
|
|
6707
7013
|
var matchedDataSource = [];
|
|
6708
7014
|
for (var i = 0; i < this.treeData.length; i++) {
|
|
6709
7015
|
if (this.isMatchedNode(value, this.treeData[i])) {
|
|
@@ -6716,7 +7022,6 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
6716
7022
|
// eslint-disable-next-line
|
|
6717
7023
|
var parentId = matchedData[i][this.fields.parentValue];
|
|
6718
7024
|
while (!isNullOrUndefined(parentId)) {
|
|
6719
|
-
// eslint-disable-next-line
|
|
6720
7025
|
var parent_1 = null;
|
|
6721
7026
|
for (var j = 0; j < this.treeData.length; j++) {
|
|
6722
7027
|
// eslint-disable-next-line
|
|
@@ -6739,7 +7044,6 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
6739
7044
|
filteredFields.dataSource = matchedDataSource;
|
|
6740
7045
|
return filteredFields;
|
|
6741
7046
|
};
|
|
6742
|
-
// eslint-disable-next-line
|
|
6743
7047
|
DropDownTree.prototype.isMatchedNode = function (value, node, isChild, isChildFiltering) {
|
|
6744
7048
|
var checkValue;
|
|
6745
7049
|
var isObjectValue = isChild && isChildFiltering && this.isChildObject();
|
|
@@ -7135,7 +7439,6 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
7135
7439
|
var remaining = void 0;
|
|
7136
7440
|
var downIconWidth = 0;
|
|
7137
7441
|
this.overFlowWrapper.innerHTML = '';
|
|
7138
|
-
// eslint-disable-next-line
|
|
7139
7442
|
var l10nLocale = { overflowCountTemplate: '+${count} more..', totalCountTemplate: '${count} selected' };
|
|
7140
7443
|
this.l10n = new L10n(this.getLocaleName(), l10nLocale, this.locale);
|
|
7141
7444
|
var remainContent = this.l10n.getConstant('overflowCountTemplate');
|
|
@@ -7418,7 +7721,6 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
7418
7721
|
if (this.selectAllText !== 'Select All' || this.unSelectAllText !== 'Unselect All') {
|
|
7419
7722
|
var template = unSelect ? this.unSelectAllText : this.selectAllText;
|
|
7420
7723
|
this.selectAllSpan.textContent = '';
|
|
7421
|
-
// eslint-disable-next-line
|
|
7422
7724
|
var compiledString = compile(template);
|
|
7423
7725
|
var templateName = unSelect ? 'unSelectAllText' : 'selectAllText';
|
|
7424
7726
|
for (var _i = 0, _a = compiledString({}, this, templateName, null, !this.isStringTemplate); _i < _a.length; _i++) {
|
|
@@ -7444,11 +7746,11 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
7444
7746
|
if (htmlAttr === 'class') {
|
|
7445
7747
|
this.inputWrapper.classList.add(this.htmlAttributes["" + htmlAttr]);
|
|
7446
7748
|
}
|
|
7447
|
-
else if (htmlAttr === 'disabled'
|
|
7749
|
+
else if (htmlAttr === 'disabled') {
|
|
7448
7750
|
this.setProperties({ enabled: false }, true);
|
|
7449
7751
|
this.setEnable();
|
|
7450
7752
|
}
|
|
7451
|
-
else if (htmlAttr === 'readonly'
|
|
7753
|
+
else if (htmlAttr === 'readonly') {
|
|
7452
7754
|
this.setProperties({ readonly: true }, true);
|
|
7453
7755
|
this.dataBind();
|
|
7454
7756
|
}
|
|
@@ -7508,7 +7810,6 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
7508
7810
|
};
|
|
7509
7811
|
DropDownTree.prototype.setTreeValue = function () {
|
|
7510
7812
|
if (this.value !== null && this.value.length !== 0) {
|
|
7511
|
-
// eslint-disable-next-line
|
|
7512
7813
|
var data = void 0;
|
|
7513
7814
|
if (this.showCheckBox || this.allowMultiSelection) {
|
|
7514
7815
|
for (var i = 0; i < this.value.length; i++) {
|
|
@@ -7538,7 +7839,6 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
7538
7839
|
return;
|
|
7539
7840
|
}
|
|
7540
7841
|
if (this.text !== null) {
|
|
7541
|
-
// eslint-disable-next-line
|
|
7542
7842
|
var data = void 0;
|
|
7543
7843
|
var valArr = [];
|
|
7544
7844
|
if (this.showCheckBox || this.allowMultiSelection) {
|
|
@@ -7629,9 +7929,7 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
7629
7929
|
this.triggerChangeEvent();
|
|
7630
7930
|
}
|
|
7631
7931
|
};
|
|
7632
|
-
// eslint-disable-next-line
|
|
7633
7932
|
DropDownTree.prototype.getItems = function (givenText) {
|
|
7634
|
-
// eslint-disable-next-line
|
|
7635
7933
|
var data;
|
|
7636
7934
|
if (this.treeDataType === 1) {
|
|
7637
7935
|
for (var i = 0; i < this.treeItems.length; i++) {
|
|
@@ -7648,9 +7946,7 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
7648
7946
|
}
|
|
7649
7947
|
return data;
|
|
7650
7948
|
};
|
|
7651
|
-
// eslint-disable-next-line
|
|
7652
7949
|
DropDownTree.prototype.getNestedItems = function (data, field, givenText) {
|
|
7653
|
-
// eslint-disable-next-line
|
|
7654
7950
|
var newData;
|
|
7655
7951
|
for (var i = 0, objlen = data.length; i < objlen; i++) {
|
|
7656
7952
|
// eslint-disable-next-line
|
|
@@ -7661,7 +7957,6 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
7661
7957
|
else if (typeof field.child === 'string' && !isNullOrUndefined(getValue(field.child, data[i]))) {
|
|
7662
7958
|
// eslint-disable-next-line
|
|
7663
7959
|
var childData = getValue(field.child, data[i]);
|
|
7664
|
-
// eslint-disable-next-line
|
|
7665
7960
|
newData = this.getNestedItems(childData, this.getChildType(field), givenText);
|
|
7666
7961
|
if (newData !== undefined) {
|
|
7667
7962
|
break;
|
|
@@ -7704,7 +7999,7 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
7704
7999
|
nodeTemplate: this.itemTemplate
|
|
7705
8000
|
});
|
|
7706
8001
|
this.treeObj.root = this.root ? this.root : this;
|
|
7707
|
-
this.treeObj.appendTo(
|
|
8002
|
+
this.treeObj.appendTo(this.tree);
|
|
7708
8003
|
};
|
|
7709
8004
|
/* To render the popup element */
|
|
7710
8005
|
DropDownTree.prototype.renderPopup = function () {
|
|
@@ -7762,9 +8057,13 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
7762
8057
|
_this.isFirstRender = false;
|
|
7763
8058
|
/* eslint-disable */
|
|
7764
8059
|
if (_this.hasTemplate && _this.portals) {
|
|
7765
|
-
|
|
8060
|
+
if (_this.treeObj.portals) {
|
|
8061
|
+
_this.portals = _this.portals.concat(_this.treeObj.portals.filter(function (item) { return !_this.portals.includes(item); }));
|
|
8062
|
+
}
|
|
7766
8063
|
/* eslint-enable */
|
|
7767
|
-
_this.
|
|
8064
|
+
if (_this.isReact) {
|
|
8065
|
+
_this.renderReactTemplates(_this.reactCallBack);
|
|
8066
|
+
}
|
|
7768
8067
|
}
|
|
7769
8068
|
}
|
|
7770
8069
|
if (!isCancelled) {
|
|
@@ -7775,7 +8074,15 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
7775
8074
|
_this.popupObj.refreshPosition();
|
|
7776
8075
|
if (!(_this.showCheckBox && _this.showSelectAll) && (!_this.popupDiv.classList.contains(NODATA)
|
|
7777
8076
|
&& _this.treeItems.length > 0)) {
|
|
7778
|
-
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
|
+
}
|
|
7779
8086
|
focusedElement.focus();
|
|
7780
8087
|
addClass([focusedElement], ['e-node-focus']);
|
|
7781
8088
|
}
|
|
@@ -7793,6 +8100,10 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
7793
8100
|
}
|
|
7794
8101
|
});
|
|
7795
8102
|
};
|
|
8103
|
+
DropDownTree.prototype.reactCallBack = function () {
|
|
8104
|
+
this.updatePopupHeight();
|
|
8105
|
+
this.popupObj.refreshPosition();
|
|
8106
|
+
};
|
|
7796
8107
|
DropDownTree.prototype.updatePopupHeight = function () {
|
|
7797
8108
|
if (this.isFirstRender) {
|
|
7798
8109
|
return;
|
|
@@ -8051,7 +8362,6 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
8051
8362
|
}
|
|
8052
8363
|
return null;
|
|
8053
8364
|
};
|
|
8054
|
-
// eslint-disable-next-line
|
|
8055
8365
|
DropDownTree.prototype.getTreeDataType = function (ds, field) {
|
|
8056
8366
|
if (this.fields.dataSource instanceof DataManager) {
|
|
8057
8367
|
for (var i = 0; i < ds.length; i++) {
|
|
@@ -8061,8 +8371,9 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
8061
8371
|
}
|
|
8062
8372
|
return 2;
|
|
8063
8373
|
}
|
|
8064
|
-
if (isNullOrUndefined(this.fields.dataSource))
|
|
8374
|
+
if (isNullOrUndefined(this.fields.dataSource)) {
|
|
8065
8375
|
this.fields.dataSource = [];
|
|
8376
|
+
}
|
|
8066
8377
|
for (var i = 0, len = this.fields.dataSource.length; i < len; i++) {
|
|
8067
8378
|
if ((typeof field.child === 'string') && !isNullOrUndefined(getValue(field.child, this.fields.dataSource[i]))) {
|
|
8068
8379
|
return 2;
|
|
@@ -8083,9 +8394,7 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
8083
8394
|
this.treeObj.dataBind();
|
|
8084
8395
|
};
|
|
8085
8396
|
DropDownTree.prototype.getEventArgs = function (args) {
|
|
8086
|
-
// eslint-disable-next-line
|
|
8087
8397
|
var checkData = args.data;
|
|
8088
|
-
// eslint-disable-next-line
|
|
8089
8398
|
var selectData = args.nodeData;
|
|
8090
8399
|
var state;
|
|
8091
8400
|
if (this.showCheckBox) {
|
|
@@ -8170,7 +8479,6 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
8170
8479
|
var target = args.event.target;
|
|
8171
8480
|
if ((target.classList.contains('e-fullrow') || target.classList.contains('e-list-text')) && this.showCheckBox) {
|
|
8172
8481
|
this.isClicked = true;
|
|
8173
|
-
// eslint-disable-next-line
|
|
8174
8482
|
var getNodeDetails = this.treeObj.getNode(args.node);
|
|
8175
8483
|
if (getNodeDetails.isChecked === 'true') {
|
|
8176
8484
|
this.treeObj.uncheckAll([args.node]);
|
|
@@ -8222,7 +8530,7 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
8222
8530
|
DropDownTree.prototype.onNodeExpanded = function (args) {
|
|
8223
8531
|
if (this.hasTemplate && this.portals && this.treeObj.portals) {
|
|
8224
8532
|
for (var i = 0; i < this.treeObj.portals.length; i++) {
|
|
8225
|
-
if (this.portals.indexOf(this.treeObj.portals[i])
|
|
8533
|
+
if (this.portals.indexOf(this.treeObj.portals[i]) === -1) {
|
|
8226
8534
|
this.portals.push(this.treeObj.portals[i]);
|
|
8227
8535
|
}
|
|
8228
8536
|
}
|
|
@@ -8320,7 +8628,7 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
8320
8628
|
};
|
|
8321
8629
|
DropDownTree.prototype.setMultiSelectValue = function (newValues) {
|
|
8322
8630
|
if (!this.isFilteredData) {
|
|
8323
|
-
this.setProperties({ value: this.isFromFilterChange && newValues && newValues.length
|
|
8631
|
+
this.setProperties({ value: this.isFromFilterChange && newValues && newValues.length === 0 ? this.value : newValues }, true);
|
|
8324
8632
|
this.isFromFilterChange = false;
|
|
8325
8633
|
if (newValues && newValues.length !== 0 && !this.showCheckBox) {
|
|
8326
8634
|
this.treeObj.selectedNodes = this.value.slice();
|
|
@@ -8370,9 +8678,7 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
8370
8678
|
}
|
|
8371
8679
|
this.updateSelectedValues();
|
|
8372
8680
|
};
|
|
8373
|
-
// eslint-disable-next-line
|
|
8374
8681
|
DropDownTree.prototype.getSelectedData = function (value) {
|
|
8375
|
-
// eslint-disable-next-line
|
|
8376
8682
|
var data = null;
|
|
8377
8683
|
if (this.isFilteredData) {
|
|
8378
8684
|
for (var i = 0; i < this.selectedData.length; i++) {
|
|
@@ -8459,7 +8765,6 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
8459
8765
|
var temp;
|
|
8460
8766
|
var text;
|
|
8461
8767
|
var textValue = '';
|
|
8462
|
-
// eslint-disable-next-line
|
|
8463
8768
|
var selectedData;
|
|
8464
8769
|
this.hiddenElement.innerHTML = '';
|
|
8465
8770
|
var hiddenInputValue = '';
|
|
@@ -8555,7 +8860,7 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
8555
8860
|
addClass([this.inputWrapper], SHOW_CHIP);
|
|
8556
8861
|
}
|
|
8557
8862
|
var chip = this.createElement('span', {
|
|
8558
|
-
className: CHIP
|
|
8863
|
+
className: CHIP
|
|
8559
8864
|
});
|
|
8560
8865
|
if (!this.inputEle.classList.contains(CHIP_INPUT)) {
|
|
8561
8866
|
addClass([this.inputEle], CHIP_INPUT);
|
|
@@ -8597,7 +8902,6 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
8597
8902
|
this.header = this.createElement('div');
|
|
8598
8903
|
addClass([this.header], HEADER);
|
|
8599
8904
|
}
|
|
8600
|
-
// eslint-disable-next-line
|
|
8601
8905
|
var compiledString = this.templateComplier(this.headerTemplate);
|
|
8602
8906
|
var tempArr = compiledString({}, this, 'headerTemplate', this.headerTemplateId, this.isStringTemplate, undefined, this.header);
|
|
8603
8907
|
if (tempArr) {
|
|
@@ -8606,7 +8910,6 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
8606
8910
|
}
|
|
8607
8911
|
this.popupEle.insertBefore(this.header, this.checkAllParent ? this.checkAllParent : this.popupDiv);
|
|
8608
8912
|
};
|
|
8609
|
-
// eslint-disable-next-line
|
|
8610
8913
|
DropDownTree.prototype.templateComplier = function (template) {
|
|
8611
8914
|
if (template) {
|
|
8612
8915
|
// eslint-disable-next-line
|
|
@@ -8632,7 +8935,6 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
8632
8935
|
this.footer = this.createElement('div');
|
|
8633
8936
|
addClass([this.footer], FOOTER);
|
|
8634
8937
|
}
|
|
8635
|
-
// eslint-disable-next-line
|
|
8636
8938
|
var compiledString = this.templateComplier(this.footerTemplate);
|
|
8637
8939
|
var tempArr = compiledString({}, this, 'footerTemplate', this.footerTemplateId, this.isStringTemplate, undefined, this.footer);
|
|
8638
8940
|
if (tempArr) {
|
|
@@ -8691,7 +8993,7 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
8691
8993
|
this.ensurePlaceHolder();
|
|
8692
8994
|
};
|
|
8693
8995
|
DropDownTree.prototype.resetValue = function (isDynamicChange) {
|
|
8694
|
-
if (this.value
|
|
8996
|
+
if (this.value === [] && this.text == null) {
|
|
8695
8997
|
return;
|
|
8696
8998
|
}
|
|
8697
8999
|
Input.setValue(null, this.inputEle, this.floatLabelType);
|
|
@@ -8830,7 +9132,6 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
8830
9132
|
var template = actionFailure ? this.actionFailureTemplate : this.noRecordsTemplate;
|
|
8831
9133
|
var templateId = actionFailure ? this.actionFailureTemplateId : this.noRecordsTemplateId;
|
|
8832
9134
|
var templatestring = actionFailure ? 'actionFailureTemplate' : 'noRecordsTemplate';
|
|
8833
|
-
// eslint-disable-next-line
|
|
8834
9135
|
var compiledString = this.templateComplier(template);
|
|
8835
9136
|
var tempArr = compiledString({}, this, templatestring, templateId, this.isStringTemplate, undefined, this.noRecord);
|
|
8836
9137
|
if (tempArr) {
|
|
@@ -8839,7 +9140,6 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
8839
9140
|
}
|
|
8840
9141
|
}
|
|
8841
9142
|
else {
|
|
8842
|
-
// eslint-disable-next-line
|
|
8843
9143
|
var l10nLocale = { noRecordsTemplate: 'No Records Found', actionFailureTemplate: 'The Request Failed' };
|
|
8844
9144
|
this.l10n = new L10n(this.getLocaleName(), l10nLocale, this.locale);
|
|
8845
9145
|
this.noRecord.innerHTML = actionFailure ?
|
|
@@ -9071,10 +9371,10 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
9071
9371
|
this.updateTreeSettings(newProp);
|
|
9072
9372
|
break;
|
|
9073
9373
|
case 'customTemplate':
|
|
9074
|
-
if (this.mode !==
|
|
9374
|
+
if (this.mode !== 'Custom') {
|
|
9075
9375
|
return;
|
|
9076
9376
|
}
|
|
9077
|
-
this.chipCollection.innerHTML =
|
|
9377
|
+
this.chipCollection.innerHTML = '';
|
|
9078
9378
|
this.setTagValues();
|
|
9079
9379
|
break;
|
|
9080
9380
|
case 'sortOrder':
|
|
@@ -9224,6 +9524,16 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
9224
9524
|
this.filterObj = null;
|
|
9225
9525
|
}
|
|
9226
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
|
+
};
|
|
9227
9537
|
/**
|
|
9228
9538
|
* Ensures visibility of the Dropdown Tree item by using item value or item element.
|
|
9229
9539
|
* If many Dropdown Tree items are present, and we are in need to find a particular item, then the `ensureVisible` property
|
|
@@ -9241,7 +9551,6 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
9241
9551
|
* @param {string | Element} item - Specifies the value of Dropdown Tree item/ Dropdown Tree item element
|
|
9242
9552
|
* @returns {'{[key: string]: Object }[]'} - returns the updated data source of the Dropdown Tree.
|
|
9243
9553
|
*/
|
|
9244
|
-
// eslint-disable-next-line
|
|
9245
9554
|
DropDownTree.prototype.getData = function (item) {
|
|
9246
9555
|
return this.treeObj.getTreeData(item);
|
|
9247
9556
|
};
|
|
@@ -9266,6 +9575,10 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
9266
9575
|
}
|
|
9267
9576
|
}
|
|
9268
9577
|
this.trigger('close', eventArgs);
|
|
9578
|
+
if (this.destroyPopupOnHide) {
|
|
9579
|
+
this.isFirstRender = true;
|
|
9580
|
+
this.destroyPopup();
|
|
9581
|
+
}
|
|
9269
9582
|
}
|
|
9270
9583
|
};
|
|
9271
9584
|
/**
|
|
@@ -9315,7 +9628,7 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
9315
9628
|
Property('')
|
|
9316
9629
|
], DropDownTree.prototype, "cssClass", void 0);
|
|
9317
9630
|
__decorate$2([
|
|
9318
|
-
Property(
|
|
9631
|
+
Property('${value.length} item(s) selected')
|
|
9319
9632
|
], DropDownTree.prototype, "customTemplate", void 0);
|
|
9320
9633
|
__decorate$2([
|
|
9321
9634
|
Property(',')
|
|
@@ -9381,7 +9694,10 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
9381
9694
|
Property(false)
|
|
9382
9695
|
], DropDownTree.prototype, "showCheckBox", void 0);
|
|
9383
9696
|
__decorate$2([
|
|
9384
|
-
Property(
|
|
9697
|
+
Property(true)
|
|
9698
|
+
], DropDownTree.prototype, "destroyPopupOnHide", void 0);
|
|
9699
|
+
__decorate$2([
|
|
9700
|
+
Property(true)
|
|
9385
9701
|
], DropDownTree.prototype, "enableHtmlSanitizer", void 0);
|
|
9386
9702
|
__decorate$2([
|
|
9387
9703
|
Property(true)
|
|
@@ -9582,8 +9898,12 @@ var ComboBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
9582
9898
|
this.setHiddenValue();
|
|
9583
9899
|
};
|
|
9584
9900
|
ComboBox.prototype.valueMuteChange = function (value) {
|
|
9901
|
+
value = this.allowObjectBinding && !isNullOrUndefined(value) ? getValue((this.fields.value) ? this.fields.value : '', value) : value;
|
|
9585
9902
|
var inputValue = isNullOrUndefined(value) ? null : value.toString();
|
|
9586
9903
|
Input.setValue(inputValue, this.inputElement, this.floatLabelType, this.showClearButton);
|
|
9904
|
+
if (this.allowObjectBinding) {
|
|
9905
|
+
value = this.getDataByValue(value);
|
|
9906
|
+
}
|
|
9587
9907
|
this.setProperties({ value: value, text: value, index: null }, true);
|
|
9588
9908
|
this.activeIndex = this.index;
|
|
9589
9909
|
var fields = this.fields;
|
|
@@ -9592,20 +9912,50 @@ var ComboBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
9592
9912
|
dataItem[fields.value] = isNullOrUndefined(value) ? null : value.toString();
|
|
9593
9913
|
this.itemData = dataItem;
|
|
9594
9914
|
this.item = null;
|
|
9595
|
-
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]))) {
|
|
9596
9916
|
this.detachChangeEvent(null);
|
|
9597
9917
|
}
|
|
9598
9918
|
};
|
|
9599
9919
|
ComboBox.prototype.updateValues = function () {
|
|
9600
9920
|
if (!isNullOrUndefined(this.value)) {
|
|
9601
|
-
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;
|
|
9924
|
+
if (this.enableVirtualization && this.value) {
|
|
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;
|
|
9927
|
+
if (this.dataSource instanceof DataManager && this.virtualGroupDataSource) {
|
|
9928
|
+
var getItem = new DataManager(this.virtualGroupDataSource).executeLocal(new Query().where(new Predicate(fields, 'equal', currentValue_1)));
|
|
9929
|
+
if (getItem && getItem.length > 0) {
|
|
9930
|
+
this.itemData = getItem[0];
|
|
9931
|
+
doesItemExist = true;
|
|
9932
|
+
var dataItem = this.getItemData();
|
|
9933
|
+
var value = this.allowObjectBinding ? this.getDataByValue(dataItem.value) : dataItem.value;
|
|
9934
|
+
if ((this.value === dataItem.value && this.text !== dataItem.text) || (this.value !== dataItem.value && this.text === dataItem.text)) {
|
|
9935
|
+
this.setProperties({ 'text': dataItem.text, 'value': value });
|
|
9936
|
+
}
|
|
9937
|
+
}
|
|
9938
|
+
}
|
|
9939
|
+
else {
|
|
9940
|
+
var getItem = new DataManager(this.dataSource).executeLocal(new Query().where(new Predicate(fields, 'equal', currentValue_1)));
|
|
9941
|
+
if (getItem && getItem.length > 0) {
|
|
9942
|
+
this.itemData = getItem[0];
|
|
9943
|
+
doesItemExist = true;
|
|
9944
|
+
var dataItem = this.getItemData();
|
|
9945
|
+
var value = this.allowObjectBinding ? this.getDataByValue(dataItem.value) : dataItem.value;
|
|
9946
|
+
if ((this.value === dataItem.value && this.text !== dataItem.text) || (this.value !== dataItem.value && this.text === dataItem.text)) {
|
|
9947
|
+
this.setProperties({ 'text': dataItem.text, 'value': value });
|
|
9948
|
+
}
|
|
9949
|
+
}
|
|
9950
|
+
}
|
|
9951
|
+
}
|
|
9602
9952
|
if (li) {
|
|
9603
9953
|
this.setSelection(li, null);
|
|
9604
9954
|
}
|
|
9605
|
-
else if (this.allowCustom) {
|
|
9955
|
+
else if ((!this.enableVirtualization && this.allowCustom) || (this.allowCustom && this.enableVirtualization && !doesItemExist)) {
|
|
9606
9956
|
this.valueMuteChange(this.value);
|
|
9607
9957
|
}
|
|
9608
|
-
else {
|
|
9958
|
+
else if (!this.enableVirtualization || (this.enableVirtualization && !doesItemExist)) {
|
|
9609
9959
|
this.valueMuteChange(null);
|
|
9610
9960
|
}
|
|
9611
9961
|
}
|
|
@@ -9715,7 +10065,7 @@ var ComboBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
9715
10065
|
this.updateIncrementalView(0, this.itemCount);
|
|
9716
10066
|
}
|
|
9717
10067
|
activeItem = Search(inputValue, this.incrementalLiCollections, this.filterType, true, dataSource, this.fields, type);
|
|
9718
|
-
while (isNullOrUndefined(activeItem) && this.incrementalEndIndex < this.totalItemCount) {
|
|
10068
|
+
while (isNullOrUndefined(activeItem.item) && this.incrementalEndIndex < this.totalItemCount) {
|
|
9719
10069
|
this.incrementalStartIndex = this.incrementalEndIndex;
|
|
9720
10070
|
this.incrementalEndIndex = this.incrementalEndIndex + 100 > this.totalItemCount ? this.totalItemCount : this.incrementalEndIndex + 100;
|
|
9721
10071
|
this.updateIncrementalInfo(this.incrementalStartIndex, this.incrementalEndIndex);
|
|
@@ -9725,6 +10075,7 @@ var ComboBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
9725
10075
|
}
|
|
9726
10076
|
activeItem = Search(inputValue, this.incrementalLiCollections, this.filterType, true, dataSource, this.fields, type);
|
|
9727
10077
|
if (!isNullOrUndefined(activeItem)) {
|
|
10078
|
+
activeItem.index = activeItem.index + this.incrementalStartIndex;
|
|
9728
10079
|
break;
|
|
9729
10080
|
}
|
|
9730
10081
|
if (isNullOrUndefined(activeItem) && this.incrementalEndIndex >= this.totalItemCount) {
|
|
@@ -9810,10 +10161,12 @@ var ComboBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
9810
10161
|
}
|
|
9811
10162
|
};
|
|
9812
10163
|
ComboBox.prototype.checkCustomValue = function () {
|
|
9813
|
-
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);
|
|
9814
10166
|
var dataItem = this.getItemData();
|
|
10167
|
+
var setValue$$1 = this.allowObjectBinding ? this.itemData : dataItem.value;
|
|
9815
10168
|
if (!(this.allowCustom && isNullOrUndefined(dataItem.value) && isNullOrUndefined(dataItem.text))) {
|
|
9816
|
-
this.setProperties({ 'value':
|
|
10169
|
+
this.setProperties({ 'value': setValue$$1 }, !this.allowCustom);
|
|
9817
10170
|
}
|
|
9818
10171
|
};
|
|
9819
10172
|
/**
|
|
@@ -9863,10 +10216,10 @@ var ComboBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
9863
10216
|
var currentValue = this.getTextByValue(activeElement.getAttribute('data-value')).toString();
|
|
9864
10217
|
var currentFillValue = this.getFormattedValue(activeElement.getAttribute('data-value'));
|
|
9865
10218
|
if (this.getModuleName() === 'combobox') {
|
|
9866
|
-
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)]))) {
|
|
9867
10220
|
this.updateSelectedItem(activeElement, null);
|
|
9868
10221
|
this.isSelected = true;
|
|
9869
|
-
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'));
|
|
9870
10223
|
}
|
|
9871
10224
|
else {
|
|
9872
10225
|
this.updateSelectedItem(activeElement, null, true);
|
|
@@ -10041,11 +10394,13 @@ var ComboBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
10041
10394
|
if (!this.allowCustom && this.inputElement.value !== '') {
|
|
10042
10395
|
var previousValue = this.previousValue;
|
|
10043
10396
|
var currentValue = this.value;
|
|
10397
|
+
value = this.allowObjectBinding ? this.getDataByValue(value) : value;
|
|
10044
10398
|
this.setProperties({ value: value });
|
|
10045
10399
|
if (isNullOrUndefined(this.value)) {
|
|
10046
10400
|
Input.setValue('', this.inputElement, this.floatLabelType, this.showClearButton);
|
|
10047
10401
|
}
|
|
10048
|
-
|
|
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])))) {
|
|
10049
10404
|
this.onChangeEvent(null);
|
|
10050
10405
|
}
|
|
10051
10406
|
}
|
|
@@ -10055,6 +10410,7 @@ var ComboBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
10055
10410
|
var value_1 = this.inputElement.value === '' ? null : this.inputElement.value;
|
|
10056
10411
|
// eslint-disable-next-line max-len
|
|
10057
10412
|
var eventArgs = { text: value_1, item: {} };
|
|
10413
|
+
this.isObjectCustomValue = true;
|
|
10058
10414
|
if (!this.initial) {
|
|
10059
10415
|
this.trigger('customValueSpecifier', eventArgs, function (eventArgs) {
|
|
10060
10416
|
_this.updateCustomValueCallback(value_1, eventArgs, previousValue_1, e);
|
|
@@ -10066,8 +10422,9 @@ var ComboBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
10066
10422
|
}
|
|
10067
10423
|
else {
|
|
10068
10424
|
this.isSelectCustom = false;
|
|
10425
|
+
value = this.allowObjectBinding ? this.getDataByValue(value) : value;
|
|
10069
10426
|
this.setProperties({ value: value });
|
|
10070
|
-
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]))) {
|
|
10071
10428
|
this.onChangeEvent(e);
|
|
10072
10429
|
}
|
|
10073
10430
|
}
|
|
@@ -10077,6 +10434,7 @@ var ComboBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
10077
10434
|
}
|
|
10078
10435
|
};
|
|
10079
10436
|
ComboBox.prototype.updateCustomValueCallback = function (value, eventArgs, previousValue, e) {
|
|
10437
|
+
var _this = this;
|
|
10080
10438
|
var fields = this.fields;
|
|
10081
10439
|
var item = eventArgs.item;
|
|
10082
10440
|
var dataItem = {};
|
|
@@ -10088,16 +10446,28 @@ var ComboBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
10088
10446
|
setValue(fields.value, value, dataItem);
|
|
10089
10447
|
}
|
|
10090
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
|
+
}
|
|
10091
10460
|
var changeData = {
|
|
10092
10461
|
text: getValue(fields.text, this.itemData),
|
|
10093
|
-
value: getValue(fields.value, this.itemData),
|
|
10462
|
+
value: this.allowObjectBinding ? emptyObject : getValue(fields.value, this.itemData),
|
|
10094
10463
|
index: null
|
|
10095
10464
|
};
|
|
10096
10465
|
this.setProperties(changeData, true);
|
|
10097
10466
|
this.setSelection(null, null);
|
|
10098
10467
|
this.isSelectCustom = true;
|
|
10099
|
-
|
|
10100
|
-
|
|
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);
|
|
10101
10471
|
}
|
|
10102
10472
|
};
|
|
10103
10473
|
/**
|
|
@@ -10111,7 +10481,7 @@ var ComboBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
10111
10481
|
ComboBox.prototype.onPropertyChanged = function (newProp, oldProp) {
|
|
10112
10482
|
if (this.getModuleName() === 'combobox') {
|
|
10113
10483
|
this.checkData(newProp);
|
|
10114
|
-
this.setUpdateInitial(['fields', 'query', 'dataSource'], newProp);
|
|
10484
|
+
this.setUpdateInitial(['fields', 'query', 'dataSource'], newProp, oldProp);
|
|
10115
10485
|
}
|
|
10116
10486
|
for (var _i = 0, _a = Object.keys(newProp); _i < _a.length; _i++) {
|
|
10117
10487
|
var prop = _a[_i];
|
|
@@ -10260,7 +10630,8 @@ var ComboBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
10260
10630
|
this.customValue(e);
|
|
10261
10631
|
}
|
|
10262
10632
|
}
|
|
10263
|
-
|
|
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) {
|
|
10264
10635
|
this.customValue();
|
|
10265
10636
|
}
|
|
10266
10637
|
_super.prototype.hidePopup.call(this, e);
|
|
@@ -10392,6 +10763,9 @@ var ComboBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
10392
10763
|
__decorate$3([
|
|
10393
10764
|
Property(null)
|
|
10394
10765
|
], ComboBox.prototype, "value", void 0);
|
|
10766
|
+
__decorate$3([
|
|
10767
|
+
Property(false)
|
|
10768
|
+
], ComboBox.prototype, "allowObjectBinding", void 0);
|
|
10395
10769
|
ComboBox = __decorate$3([
|
|
10396
10770
|
NotifyPropertyChanges
|
|
10397
10771
|
], ComboBox);
|
|
@@ -10468,8 +10842,9 @@ var AutoComplete = /** @__PURE__ @class */ (function (_super) {
|
|
|
10468
10842
|
};
|
|
10469
10843
|
AutoComplete.prototype.getQuery = function (query) {
|
|
10470
10844
|
var filterQuery = query ? query.clone() : this.query ? this.query.clone() : new Query();
|
|
10471
|
-
var
|
|
10472
|
-
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;
|
|
10473
10848
|
if (this.isFiltered) {
|
|
10474
10849
|
return filterQuery;
|
|
10475
10850
|
}
|
|
@@ -10495,17 +10870,57 @@ var AutoComplete = /** @__PURE__ @class */ (function (_super) {
|
|
|
10495
10870
|
filterQuery.take(this.suggestionCount);
|
|
10496
10871
|
}
|
|
10497
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
|
+
}
|
|
10498
10898
|
var takeValue = this.getTakeValue();
|
|
10499
|
-
|
|
10500
|
-
|
|
10501
|
-
|
|
10502
|
-
|
|
10503
|
-
|
|
10504
|
-
|
|
10505
|
-
|
|
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
|
+
}
|
|
10915
|
+
filterQuery.requiresCount();
|
|
10916
|
+
}
|
|
10917
|
+
return filterQuery;
|
|
10918
|
+
};
|
|
10919
|
+
AutoComplete.prototype.searchLists = function (e) {
|
|
10506
10920
|
var _this_1 = this;
|
|
10507
10921
|
this.isTyped = true;
|
|
10508
10922
|
this.isDataFetched = this.isSelectCustom = false;
|
|
10923
|
+
this.firstItem = this.dataSource && this.dataSource.length > 0 ? this.dataSource[0] : null;
|
|
10509
10924
|
this.checkAndResetCache();
|
|
10510
10925
|
if (isNullOrUndefined(this.list)) {
|
|
10511
10926
|
_super.prototype.renderList.call(this, e, true);
|
|
@@ -10699,6 +11114,10 @@ var AutoComplete = /** @__PURE__ @class */ (function (_super) {
|
|
|
10699
11114
|
AutoComplete.prototype.setInputValue = function (newProp, oldProp) {
|
|
10700
11115
|
var oldValue = oldProp && oldProp.text ? oldProp.text : oldProp ? oldProp.value : oldProp;
|
|
10701
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
|
+
}
|
|
10702
11121
|
if (value && this.typedString === '' && !this.allowCustom && !(this.dataSource instanceof DataManager)) {
|
|
10703
11122
|
var checkFields_1_1 = this.typeOfData(this.dataSource).typeof === 'string' ? '' : this.fields.value;
|
|
10704
11123
|
var listLength_1 = this.getItems().length;
|
|
@@ -10707,7 +11126,7 @@ var AutoComplete = /** @__PURE__ @class */ (function (_super) {
|
|
|
10707
11126
|
new DataManager(this.dataSource).executeQuery(query.where(new Predicate(checkFields_1_1, 'equal', value)))
|
|
10708
11127
|
.then(function (e) {
|
|
10709
11128
|
if (e.result.length > 0) {
|
|
10710
|
-
_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();
|
|
10711
11130
|
_this_2.addItem(e.result, listLength_1);
|
|
10712
11131
|
_this_2.updateValues();
|
|
10713
11132
|
}
|
|
@@ -11131,8 +11550,12 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
11131
11550
|
_this.selectAllEventEle = [];
|
|
11132
11551
|
_this.resetMainList = null;
|
|
11133
11552
|
_this.resetFilteredData = false;
|
|
11553
|
+
_this.preventSetCurrentData = false;
|
|
11134
11554
|
_this.scrollFocusStatus = false;
|
|
11135
11555
|
_this.keyDownStatus = false;
|
|
11556
|
+
_this.IsScrollerAtEnd = function () {
|
|
11557
|
+
return this.list && this.list.scrollTop + this.list.clientHeight >= this.list.scrollHeight;
|
|
11558
|
+
};
|
|
11136
11559
|
return _this;
|
|
11137
11560
|
}
|
|
11138
11561
|
MultiSelect.prototype.enableRTL = function (state) {
|
|
@@ -11149,6 +11572,9 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
11149
11572
|
};
|
|
11150
11573
|
MultiSelect.prototype.requiredModules = function () {
|
|
11151
11574
|
var modules = [];
|
|
11575
|
+
if (this.enableVirtualization) {
|
|
11576
|
+
modules.push({ args: [this], member: 'VirtualScroll' });
|
|
11577
|
+
}
|
|
11152
11578
|
if (this.mode === 'CheckBox') {
|
|
11153
11579
|
this.isGroupChecking = this.enableGroupCheckBox;
|
|
11154
11580
|
if (this.enableGroupCheckBox) {
|
|
@@ -11289,6 +11715,9 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
11289
11715
|
attributes(_this.inputElement, { 'aria-expanded': 'true', 'aria-owns': _this.element.id + '_popup', 'aria-controls': _this.element.id });
|
|
11290
11716
|
_this.updateAriaActiveDescendant();
|
|
11291
11717
|
if (_this.isFirstClick) {
|
|
11718
|
+
if (_this.enableVirtualization && _this.mode === 'CheckBox' && _this.value) {
|
|
11719
|
+
_this.updateVirtualReOrderList();
|
|
11720
|
+
}
|
|
11292
11721
|
_this.loadTemplate();
|
|
11293
11722
|
}
|
|
11294
11723
|
if (_this.mode === 'CheckBox' && _this.showSelectAll) {
|
|
@@ -11297,6 +11726,33 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
11297
11726
|
}
|
|
11298
11727
|
});
|
|
11299
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
|
+
};
|
|
11300
11756
|
MultiSelect.prototype.updateListItems = function (listItems, mainListItems) {
|
|
11301
11757
|
for (var i = 0; i < listItems.length; i++) {
|
|
11302
11758
|
this.findGroupStart(listItems[i]);
|
|
@@ -11306,19 +11762,33 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
11306
11762
|
};
|
|
11307
11763
|
MultiSelect.prototype.loadTemplate = function () {
|
|
11308
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
|
+
}
|
|
11309
11771
|
if (this.mode === 'CheckBox') {
|
|
11310
11772
|
this.removeFocus();
|
|
11311
11773
|
}
|
|
11312
11774
|
this.notify('reOrder', { module: 'CheckBoxSelection', enable: this.mode === 'CheckBox', e: this });
|
|
11775
|
+
this.isPreventScrollAction = true;
|
|
11313
11776
|
};
|
|
11314
11777
|
MultiSelect.prototype.setScrollPosition = function () {
|
|
11315
11778
|
if (((!this.hideSelectedItem && this.mode !== 'CheckBox') || (this.mode === 'CheckBox' && !this.enableSelectionOrder)) &&
|
|
11316
11779
|
(!isNullOrUndefined(this.value) && (this.value.length > 0))) {
|
|
11317
|
-
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);
|
|
11318
11782
|
if (!isNullOrUndefined(valueEle)) {
|
|
11319
11783
|
this.scrollBottom(valueEle);
|
|
11320
11784
|
}
|
|
11321
11785
|
}
|
|
11786
|
+
if (this.enableVirtualization) {
|
|
11787
|
+
var focusedItem = this.list.querySelector('.' + dropDownBaseClasses.focus);
|
|
11788
|
+
if (focusedItem) {
|
|
11789
|
+
this.scrollBottom(focusedItem);
|
|
11790
|
+
}
|
|
11791
|
+
}
|
|
11322
11792
|
};
|
|
11323
11793
|
MultiSelect.prototype.focusAtFirstListItem = function () {
|
|
11324
11794
|
if (this.ulElement && this.ulElement.querySelector('li.'
|
|
@@ -11329,9 +11799,15 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
11329
11799
|
return;
|
|
11330
11800
|
}
|
|
11331
11801
|
else {
|
|
11332
|
-
|
|
11333
|
-
|
|
11334
|
-
|
|
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
|
+
}
|
|
11335
11811
|
}
|
|
11336
11812
|
if (element !== null) {
|
|
11337
11813
|
this.removeFocus();
|
|
@@ -11346,7 +11822,8 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
11346
11822
|
}
|
|
11347
11823
|
else {
|
|
11348
11824
|
if (this.value && this.value.length) {
|
|
11349
|
-
|
|
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);
|
|
11350
11827
|
}
|
|
11351
11828
|
else {
|
|
11352
11829
|
activeElement = null;
|
|
@@ -11354,7 +11831,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
11354
11831
|
}
|
|
11355
11832
|
if (activeElement && activeElement.item !== null) {
|
|
11356
11833
|
this.addListFocus(activeElement.item);
|
|
11357
|
-
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) {
|
|
11358
11835
|
this.scrollBottom(activeElement.item, activeElement.index);
|
|
11359
11836
|
}
|
|
11360
11837
|
}
|
|
@@ -11396,9 +11873,9 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
11396
11873
|
var elements = this.chipCollectionWrapper.querySelectorAll('span.' + CHIP$1);
|
|
11397
11874
|
var value = elements[elements.length - 1].getAttribute('data-value');
|
|
11398
11875
|
if (!isNullOrUndefined(this.value)) {
|
|
11399
|
-
this.tempValues = this.value.slice();
|
|
11876
|
+
this.tempValues = this.allowObjectBinding ? this.value.slice() : this.value.slice();
|
|
11400
11877
|
}
|
|
11401
|
-
var customValue = this.getFormattedValue(value);
|
|
11878
|
+
var customValue = this.allowObjectBinding ? this.getDataByValue(value) : this.getFormattedValue(value);
|
|
11402
11879
|
if (this.allowCustomValue && (value !== 'false' && customValue === false || (!isNullOrUndefined(customValue) &&
|
|
11403
11880
|
customValue.toString() === 'NaN'))) {
|
|
11404
11881
|
customValue = value;
|
|
@@ -11424,15 +11901,43 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
11424
11901
|
}
|
|
11425
11902
|
return this.targetInputElement.value;
|
|
11426
11903
|
};
|
|
11427
|
-
MultiSelect.prototype.getForQuery = function (valuecheck) {
|
|
11904
|
+
MultiSelect.prototype.getForQuery = function (valuecheck, isCheckbox) {
|
|
11428
11905
|
var predicate;
|
|
11429
11906
|
var field = isNullOrUndefined(this.fields.value) ? this.fields.text : this.fields.value;
|
|
11430
|
-
|
|
11431
|
-
if (
|
|
11432
|
-
|
|
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);
|
|
11433
11919
|
}
|
|
11434
11920
|
else {
|
|
11435
|
-
|
|
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
|
+
}
|
|
11436
11941
|
}
|
|
11437
11942
|
}
|
|
11438
11943
|
if (this.dataSource instanceof DataManager && this.dataSource.adaptor instanceof JsonAdaptor) {
|
|
@@ -11444,14 +11949,20 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
11444
11949
|
};
|
|
11445
11950
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
11446
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
|
+
}
|
|
11447
11956
|
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
11448
11957
|
_super.prototype.onActionComplete.call(this, ulElement, list, e);
|
|
11958
|
+
this.skeletonCount = this.totalItemCount != 0 && this.totalItemCount < (this.itemCount * 2) ? 0 : this.skeletonCount;
|
|
11449
11959
|
this.updateSelectElementData(this.allowFiltering);
|
|
11450
11960
|
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
11451
11961
|
var proxy = this;
|
|
11452
|
-
if (!isNullOrUndefined(this.value) && !this.allowCustomValue) {
|
|
11962
|
+
if (!isNullOrUndefined(this.value) && !this.allowCustomValue && !this.enableVirtualization) {
|
|
11453
11963
|
for (var i = 0; i < this.value.length; i++) {
|
|
11454
|
-
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);
|
|
11455
11966
|
if (!checkEle && !(this.dataSource instanceof DataManager)) {
|
|
11456
11967
|
this.value.splice(i, 1);
|
|
11457
11968
|
i -= 1;
|
|
@@ -11539,7 +12050,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
11539
12050
|
dropDownBaseClasses.selected;
|
|
11540
12051
|
if (!isNullOrUndefined(this.value)) {
|
|
11541
12052
|
for (var index = 0; !isNullOrUndefined(this.value[index]); index++) {
|
|
11542
|
-
value = this.value[index];
|
|
12053
|
+
value = this.allowObjectBinding ? getValue((this.fields.value) ? this.fields.value : '', this.value[index]) : this.value[index];
|
|
11543
12054
|
element = this.findListElement(this.list, 'li', 'data-value', value);
|
|
11544
12055
|
if (element) {
|
|
11545
12056
|
addClass([element], className);
|
|
@@ -11638,13 +12149,13 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
11638
12149
|
MultiSelect.prototype.checkSelectAll = function () {
|
|
11639
12150
|
var groupItemLength = this.list.querySelectorAll('li.e-list-group-item.e-active').length;
|
|
11640
12151
|
var listItem = this.list.querySelectorAll('li.e-list-item');
|
|
11641
|
-
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;
|
|
11642
12153
|
var searchActiveCount = this.list.querySelectorAll('li.' + dropDownBaseClasses.selected).length;
|
|
11643
12154
|
if (this.enableGroupCheckBox && !isNullOrUndefined(this.fields.groupBy)) {
|
|
11644
12155
|
searchActiveCount = searchActiveCount - groupItemLength;
|
|
11645
12156
|
}
|
|
11646
|
-
if ((searchCount === searchActiveCount || searchActiveCount === this.maximumSelectionLength)
|
|
11647
|
-
&& (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)) {
|
|
11648
12159
|
this.notify('checkSelectAll', { module: 'CheckBoxSelection', enable: this.mode === 'CheckBox', value: 'check' });
|
|
11649
12160
|
}
|
|
11650
12161
|
else if ((searchCount !== searchActiveCount) && (this.mode === 'CheckBox' && this.showSelectAll)) {
|
|
@@ -11681,7 +12192,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
11681
12192
|
}
|
|
11682
12193
|
this.isValidKey = (this.isPopupOpen() && e.keyCode === 8) || this.isValidKey;
|
|
11683
12194
|
this.isValidKey = e.ctrlKey && e.keyCode === 86 ? false : this.isValidKey;
|
|
11684
|
-
if (this.isValidKey) {
|
|
12195
|
+
if (this.isValidKey && this.inputElement) {
|
|
11685
12196
|
this.isValidKey = false;
|
|
11686
12197
|
this.expandTextbox();
|
|
11687
12198
|
this.showOverAllClear();
|
|
@@ -11711,7 +12222,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
11711
12222
|
return filterQuery;
|
|
11712
12223
|
}
|
|
11713
12224
|
if (this.filterAction) {
|
|
11714
|
-
if (this.targetElement() !== null) {
|
|
12225
|
+
if ((this.targetElement() !== null && !this.enableVirtualization) || (this.enableVirtualization && this.targetElement() !== null && this.targetElement().trim() !== '')) {
|
|
11715
12226
|
var dataType = this.typeOfData(this.dataSource).typeof;
|
|
11716
12227
|
if (!(this.dataSource instanceof DataManager) && dataType === 'string' || dataType === 'number') {
|
|
11717
12228
|
filterQuery.where('', this.filterType, this.targetElement(), this.ignoreCase, this.ignoreAccent);
|
|
@@ -11721,21 +12232,89 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
11721
12232
|
filterQuery.where(!isNullOrUndefined(fields.text) ? fields.text : '', this.filterType, this.targetElement(), this.ignoreCase, this.ignoreAccent);
|
|
11722
12233
|
}
|
|
11723
12234
|
}
|
|
12235
|
+
if (this.enableVirtualization && (this.viewPortInfo.endIndex != 0) && !this.virtualSelectAll) {
|
|
12236
|
+
return this.virtualFilterQuery(filterQuery);
|
|
12237
|
+
}
|
|
11724
12238
|
return filterQuery;
|
|
11725
12239
|
}
|
|
11726
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
|
+
}
|
|
11727
12244
|
return query ? query : this.query ? this.query : new Query();
|
|
11728
12245
|
}
|
|
11729
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
|
+
};
|
|
11730
12285
|
MultiSelect.prototype.dataUpdater = function (dataSource, query, fields) {
|
|
11731
12286
|
this.isDataFetched = false;
|
|
12287
|
+
var isNoData = this.list.classList.contains(dropDownBaseClasses.noData);
|
|
11732
12288
|
if (this.targetElement().trim() === '') {
|
|
11733
|
-
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;
|
|
11734
12290
|
if (this.backCommand) {
|
|
11735
12291
|
this.remoteCustomValue = false;
|
|
11736
12292
|
if (this.allowCustomValue && list.querySelectorAll('li').length == 0 && this.mainData.length > 0) {
|
|
11737
12293
|
this.mainData = [];
|
|
11738
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
|
+
}
|
|
11739
12318
|
this.onActionComplete(list, this.mainData);
|
|
11740
12319
|
if (this.value && this.value.length) {
|
|
11741
12320
|
this.refreshSelection();
|
|
@@ -11747,7 +12326,30 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
11747
12326
|
}
|
|
11748
12327
|
}
|
|
11749
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
|
+
}
|
|
11750
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
|
+
}
|
|
11751
12353
|
if (this.allowCustomValue) {
|
|
11752
12354
|
if (!(dataSource instanceof DataManager)) {
|
|
11753
12355
|
this.checkForCustomValue(query, fields);
|
|
@@ -11758,6 +12360,9 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
11758
12360
|
}
|
|
11759
12361
|
}
|
|
11760
12362
|
}
|
|
12363
|
+
if (this.enableVirtualization && this.allowFiltering) {
|
|
12364
|
+
this.getFilteringSkeletonCount();
|
|
12365
|
+
}
|
|
11761
12366
|
this.refreshPopup();
|
|
11762
12367
|
if (this.mode === 'CheckBox') {
|
|
11763
12368
|
this.removeFocus();
|
|
@@ -11771,18 +12376,43 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
11771
12376
|
var customData = (!isNullOrUndefined(this.mainData) && this.mainData.length > 0) ?
|
|
11772
12377
|
this.mainData[0] : this.mainData;
|
|
11773
12378
|
if (customData && typeof (customData) !== 'string' && typeof (customData) !== 'number' && typeof (customData) !== 'boolean') {
|
|
11774
|
-
var
|
|
11775
|
-
setValue(field.text, value,
|
|
12379
|
+
var dataItem_1 = {};
|
|
12380
|
+
setValue(field.text, value, dataItem_1);
|
|
11776
12381
|
if (typeof getValue((this.fields.value ? this.fields.value : 'value'), customData)
|
|
11777
12382
|
=== 'number') {
|
|
11778
|
-
setValue(field.value, Math.random(),
|
|
12383
|
+
setValue(field.value, Math.random(), dataItem_1);
|
|
11779
12384
|
}
|
|
11780
12385
|
else {
|
|
11781
|
-
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);
|
|
11782
12415
|
}
|
|
11783
|
-
var tempData = JSON.parse(JSON.stringify(this.listData));
|
|
11784
|
-
tempData.splice(0, 0, dataItem);
|
|
11785
|
-
this.resetList(tempData, field, query);
|
|
11786
12416
|
}
|
|
11787
12417
|
else if (this.listData) {
|
|
11788
12418
|
var tempData = JSON.parse(JSON.stringify(this.listData));
|
|
@@ -11816,6 +12446,8 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
11816
12446
|
};
|
|
11817
12447
|
MultiSelect.prototype.wrapperClick = function (e) {
|
|
11818
12448
|
this.setDynValue = false;
|
|
12449
|
+
this.keyboardEvent = null;
|
|
12450
|
+
this.isKeyBoardAction = false;
|
|
11819
12451
|
if (!this.enabled) {
|
|
11820
12452
|
return;
|
|
11821
12453
|
}
|
|
@@ -12015,8 +12647,8 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
12015
12647
|
if (this.initStatus && this.validateValues(newValue, oldValue)) {
|
|
12016
12648
|
var eventArgs = {
|
|
12017
12649
|
e: event,
|
|
12018
|
-
oldValue: oldVal,
|
|
12019
|
-
value: newVal,
|
|
12650
|
+
oldValue: this.allowObjectBinding ? oldVal : oldVal,
|
|
12651
|
+
value: this.allowObjectBinding ? newVal : newVal,
|
|
12020
12652
|
isInteracted: event ? true : false,
|
|
12021
12653
|
element: this.element,
|
|
12022
12654
|
event: event
|
|
@@ -12032,13 +12664,14 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
12032
12664
|
this.dispatchEvent(this.hiddenElement, 'change');
|
|
12033
12665
|
}
|
|
12034
12666
|
}
|
|
12667
|
+
this.selectedValueInfo = this.viewPortInfo;
|
|
12035
12668
|
};
|
|
12036
12669
|
MultiSelect.prototype.updateTempValue = function () {
|
|
12037
12670
|
if (!this.value) {
|
|
12038
12671
|
this.tempValues = this.value;
|
|
12039
12672
|
}
|
|
12040
12673
|
else {
|
|
12041
|
-
this.tempValues = this.value.slice();
|
|
12674
|
+
this.tempValues = this.allowObjectBinding ? this.value.slice() : this.value.slice();
|
|
12042
12675
|
}
|
|
12043
12676
|
};
|
|
12044
12677
|
MultiSelect.prototype.updateAriaActiveDescendant = function () {
|
|
@@ -12046,26 +12679,44 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
12046
12679
|
attributes(this.inputElement, { 'aria-activedescendant': this.ulElement.getElementsByClassName('e-item-focus')[0].id });
|
|
12047
12680
|
}
|
|
12048
12681
|
};
|
|
12049
|
-
MultiSelect.prototype.
|
|
12050
|
-
var height = this.list.classList.contains(dropDownBaseClasses.noData) ? null :
|
|
12051
|
-
getComputedStyle(this.getItems()[0], null).getPropertyValue('height');
|
|
12052
|
-
return Math.round(this.list.offsetHeight / parseInt(height, 10));
|
|
12053
|
-
};
|
|
12054
|
-
MultiSelect.prototype.pageUpSelection = function (steps) {
|
|
12682
|
+
MultiSelect.prototype.pageUpSelection = function (steps, isVirtualKeyAction) {
|
|
12055
12683
|
var collection = this.list.querySelectorAll('li.'
|
|
12056
12684
|
+ dropDownBaseClasses.li + ':not(.' + HIDE_LIST + ')' + ':not(.e-reorder-hide)');
|
|
12057
12685
|
var previousItem = steps >= 0 ? collection[steps + 1] : collection[0];
|
|
12058
|
-
this.
|
|
12059
|
-
|
|
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
|
+
}
|
|
12060
12705
|
};
|
|
12061
|
-
MultiSelect.prototype.pageDownSelection = function (steps) {
|
|
12706
|
+
MultiSelect.prototype.pageDownSelection = function (steps, isVirtualKeyAction) {
|
|
12062
12707
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
12063
12708
|
var list = this.getItems();
|
|
12064
12709
|
var collection = this.list.querySelectorAll('li.'
|
|
12065
12710
|
+ dropDownBaseClasses.li + ':not(.' + HIDE_LIST + ')' + ':not(.e-reorder-hide)');
|
|
12066
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
|
+
}
|
|
12067
12718
|
this.addListFocus(previousItem);
|
|
12068
|
-
this.scrollBottom(previousItem, this.getIndexByValue(previousItem.getAttribute('data-value')));
|
|
12719
|
+
this.scrollBottom(previousItem, this.getIndexByValue(previousItem.getAttribute('data-value')), false, this.keyboardEvent.keyCode);
|
|
12069
12720
|
};
|
|
12070
12721
|
MultiSelect.prototype.getItems = function () {
|
|
12071
12722
|
if (!this.list) {
|
|
@@ -12184,21 +12835,110 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
12184
12835
|
}
|
|
12185
12836
|
}
|
|
12186
12837
|
};
|
|
12187
|
-
MultiSelect.prototype.homeNavigation = function (isHome) {
|
|
12838
|
+
MultiSelect.prototype.homeNavigation = function (isHome, isVirtualKeyAction) {
|
|
12188
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();
|
|
12189
12864
|
var scrollEle = this.ulElement.querySelectorAll('li.' + dropDownBaseClasses.li
|
|
12190
12865
|
+ ':not(.' + HIDE_LIST + ')' + ':not(.e-reorder-hide)');
|
|
12191
12866
|
if (scrollEle.length > 0) {
|
|
12192
12867
|
var element = scrollEle[(isHome) ? 0 : (scrollEle.length - 1)];
|
|
12868
|
+
if (this.enableVirtualization && isHome) {
|
|
12869
|
+
element = scrollEle[this.skeletonCount];
|
|
12870
|
+
}
|
|
12871
|
+
this.removeFocus();
|
|
12193
12872
|
element.classList.add(dropDownBaseClasses.focus);
|
|
12194
|
-
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
|
+
}
|
|
12195
12879
|
this.updateAriaActiveDescendant();
|
|
12196
12880
|
}
|
|
12197
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
|
+
};
|
|
12198
12933
|
MultiSelect.prototype.onKeyDown = function (e) {
|
|
12199
12934
|
if (this.readonly || !this.enabled && this.mode !== 'CheckBox') {
|
|
12200
12935
|
return;
|
|
12201
12936
|
}
|
|
12937
|
+
this.preventSetCurrentData = false;
|
|
12938
|
+
this.keyboardEvent = e;
|
|
12939
|
+
if (this.isPreventKeyAction && this.enableVirtualization) {
|
|
12940
|
+
e.preventDefault();
|
|
12941
|
+
}
|
|
12202
12942
|
this.keyCode = e.keyCode;
|
|
12203
12943
|
this.keyDownStatus = true;
|
|
12204
12944
|
if (e.keyCode > 111 && e.keyCode < 124) {
|
|
@@ -12211,16 +12951,18 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
12211
12951
|
else if (this.isPopupOpen()) {
|
|
12212
12952
|
var focusedItem = this.list.querySelector('.' + dropDownBaseClasses.focus);
|
|
12213
12953
|
var activeIndex = void 0;
|
|
12954
|
+
this.isKeyBoardAction = true;
|
|
12214
12955
|
switch (e.keyCode) {
|
|
12215
12956
|
case 36:
|
|
12216
12957
|
case 35:
|
|
12958
|
+
this.isMouseScrollAction = true;
|
|
12217
12959
|
this.homeNavigation((e.keyCode === 36) ? true : false);
|
|
12218
12960
|
break;
|
|
12219
12961
|
case 33:
|
|
12220
12962
|
e.preventDefault();
|
|
12221
12963
|
if (focusedItem) {
|
|
12222
|
-
this.getIndexByValue(focusedItem.getAttribute('data-value'));
|
|
12223
|
-
this.pageUpSelection(activeIndex - this.
|
|
12964
|
+
activeIndex = this.getIndexByValue(focusedItem.getAttribute('data-value'));
|
|
12965
|
+
this.pageUpSelection(activeIndex - this.getPageCount() - 1);
|
|
12224
12966
|
this.updateAriaAttribute();
|
|
12225
12967
|
}
|
|
12226
12968
|
return;
|
|
@@ -12228,7 +12970,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
12228
12970
|
e.preventDefault();
|
|
12229
12971
|
if (focusedItem) {
|
|
12230
12972
|
this.getIndexByValue(focusedItem.getAttribute('data-value'));
|
|
12231
|
-
this.pageDownSelection(activeIndex + this.
|
|
12973
|
+
this.pageDownSelection(activeIndex + this.getPageCount());
|
|
12232
12974
|
this.updateAriaAttribute();
|
|
12233
12975
|
}
|
|
12234
12976
|
return;
|
|
@@ -12294,10 +13036,11 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
12294
13036
|
if (!(this.mode === 'CheckBox' && this.showSelectAll)) {
|
|
12295
13037
|
this.refreshPopup();
|
|
12296
13038
|
}
|
|
13039
|
+
this.isKeyBoardAction = false;
|
|
12297
13040
|
};
|
|
12298
|
-
MultiSelect.prototype.arrowDown = function (e) {
|
|
13041
|
+
MultiSelect.prototype.arrowDown = function (e, isVirtualKeyAction) {
|
|
12299
13042
|
e.preventDefault();
|
|
12300
|
-
this.moveByList(1);
|
|
13043
|
+
this.moveByList(1, isVirtualKeyAction);
|
|
12301
13044
|
this.keyAction = true;
|
|
12302
13045
|
if (document.activeElement.classList.contains(FILTERINPUT)
|
|
12303
13046
|
|| (this.mode === 'CheckBox' && !this.allowFiltering && document.activeElement !== this.list)) {
|
|
@@ -12305,7 +13048,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
12305
13048
|
}
|
|
12306
13049
|
this.updateAriaAttribute();
|
|
12307
13050
|
};
|
|
12308
|
-
MultiSelect.prototype.arrowUp = function (e) {
|
|
13051
|
+
MultiSelect.prototype.arrowUp = function (e, isVirtualKeyAction) {
|
|
12309
13052
|
e.preventDefault();
|
|
12310
13053
|
this.keyAction = true;
|
|
12311
13054
|
var list = this.list.querySelectorAll('li.'
|
|
@@ -12323,7 +13066,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
12323
13066
|
this.keyAction = false;
|
|
12324
13067
|
this.notify('inputFocus', { module: 'CheckBoxSelection', enable: this.mode === 'CheckBox', value: 'focus' });
|
|
12325
13068
|
}
|
|
12326
|
-
this.moveByList(-1);
|
|
13069
|
+
this.moveByList(-1, isVirtualKeyAction);
|
|
12327
13070
|
this.updateAriaAttribute();
|
|
12328
13071
|
};
|
|
12329
13072
|
MultiSelect.prototype.spaceKeySelection = function (e) {
|
|
@@ -12374,8 +13117,8 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
12374
13117
|
else if (e.keyCode === 8 && this.mode === 'Delimiter') {
|
|
12375
13118
|
if (this.value && this.value.length) {
|
|
12376
13119
|
e.preventDefault();
|
|
12377
|
-
var temp = this.value[this.value.length - 1];
|
|
12378
|
-
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);
|
|
12379
13122
|
this.updateDelimeter(this.delimiterChar, e);
|
|
12380
13123
|
this.focusAtLastListItem(temp);
|
|
12381
13124
|
}
|
|
@@ -12390,6 +13133,9 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
12390
13133
|
};
|
|
12391
13134
|
MultiSelect.prototype.escapeAction = function () {
|
|
12392
13135
|
var temp = this.tempValues ? this.tempValues.slice() : [];
|
|
13136
|
+
if (this.allowObjectBinding) {
|
|
13137
|
+
temp = this.tempValues ? this.tempValues.slice() : [];
|
|
13138
|
+
}
|
|
12393
13139
|
if (this.value && this.validateValues(this.value, temp)) {
|
|
12394
13140
|
if (this.mode !== 'CheckBox') {
|
|
12395
13141
|
this.value = temp;
|
|
@@ -12411,36 +13157,103 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
12411
13157
|
}
|
|
12412
13158
|
this.makeTextBoxEmpty();
|
|
12413
13159
|
};
|
|
12414
|
-
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;
|
|
12415
13170
|
var currentOffset = this.list.offsetHeight;
|
|
12416
|
-
var nextBottom = selectedLI.
|
|
13171
|
+
var nextBottom = selectedLiOffsetTop - (virtualListCount * selectedLI.offsetHeight) + selectedLI.offsetHeight - this.list.scrollTop;
|
|
12417
13172
|
var nextOffset = this.list.scrollTop + nextBottom - currentOffset;
|
|
12418
|
-
var
|
|
13173
|
+
var isScrollerCHanged = false;
|
|
13174
|
+
var boxRange = selectedLiOffsetTop - (virtualListCount * selectedLI.offsetHeight) + selectedLI.offsetHeight - this.list.scrollTop;
|
|
12419
13175
|
boxRange = this.fields.groupBy && !isNullOrUndefined(this.fixedHeaderElement) ?
|
|
12420
13176
|
boxRange - this.fixedHeaderElement.offsetHeight : boxRange;
|
|
12421
|
-
if (activeIndex === 0) {
|
|
13177
|
+
if (activeIndex === 0 && !this.enableVirtualization) {
|
|
12422
13178
|
this.list.scrollTop = 0;
|
|
12423
13179
|
}
|
|
12424
|
-
else if (nextBottom > currentOffset) {
|
|
12425
|
-
|
|
12426
|
-
|
|
12427
|
-
|
|
12428
|
-
|
|
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
|
+
|
|
12429
13212
|
}
|
|
13213
|
+
this.isKeyBoardAction = isScrollerCHanged;
|
|
12430
13214
|
};
|
|
12431
|
-
MultiSelect.prototype.scrollTop = function (selectedLI, activeIndex) {
|
|
12432
|
-
|
|
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;
|
|
12433
13221
|
nextOffset = this.fields.groupBy && !isUndefined(this.fixedHeaderElement) ?
|
|
12434
13222
|
nextOffset - this.fixedHeaderElement.offsetHeight : nextOffset;
|
|
12435
|
-
var boxRange = (selectedLI.
|
|
12436
|
-
|
|
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) {
|
|
12437
13226
|
this.list.scrollTop = 0;
|
|
12438
13227
|
}
|
|
12439
|
-
else if (nextOffset < 0) {
|
|
12440
|
-
|
|
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
|
+
}
|
|
12441
13254
|
}
|
|
12442
13255
|
else if (!(boxRange > 0 && this.list.offsetHeight > boxRange)) {
|
|
12443
|
-
this.list.scrollTop = selectedLI.offsetTop - (this.fields.groupBy && !
|
|
13256
|
+
this.list.scrollTop = selectedLI.offsetTop - (this.fields.groupBy && !isNullOrUndefined(this.fixedHeaderElement) ?
|
|
12444
13257
|
this.fixedHeaderElement.offsetHeight : 0);
|
|
12445
13258
|
}
|
|
12446
13259
|
};
|
|
@@ -12527,7 +13340,19 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
12527
13340
|
if ((this.allowFiltering || (this.mode === 'CheckBox' && this.enableSelectionOrder === true)
|
|
12528
13341
|
|| this.allowCustomValue) && this.mainList && this.listData) {
|
|
12529
13342
|
var list = this.mainList.cloneNode ? this.mainList.cloneNode(true) : this.mainList;
|
|
12530
|
-
|
|
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
|
+
}
|
|
12531
13356
|
this.focusAtLastListItem(data);
|
|
12532
13357
|
if (this.value && this.value.length) {
|
|
12533
13358
|
this.refreshSelection();
|
|
@@ -12542,14 +13367,15 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
12542
13367
|
var temp;
|
|
12543
13368
|
if (selectedElem !== null) {
|
|
12544
13369
|
if (!isNullOrUndefined(this.value)) {
|
|
12545
|
-
this.tempValues = this.value.slice();
|
|
13370
|
+
this.tempValues = this.allowObjectBinding ? this.value.slice() : this.value.slice();
|
|
12546
13371
|
}
|
|
12547
13372
|
temp = selectedElem.nextElementSibling;
|
|
12548
13373
|
if (temp !== null) {
|
|
12549
13374
|
this.removeChipSelection();
|
|
12550
13375
|
this.addChipSelection(temp, e);
|
|
12551
13376
|
}
|
|
12552
|
-
this.
|
|
13377
|
+
var currentChip = this.allowObjectBinding ? this.getDataByValue(selectedElem.getAttribute('data-value')) : selectedElem.getAttribute('data-value');
|
|
13378
|
+
this.removeValue(currentChip, e);
|
|
12553
13379
|
this.makeTextBoxEmpty();
|
|
12554
13380
|
}
|
|
12555
13381
|
if (this.closePopupOnSelect) {
|
|
@@ -12576,7 +13402,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
12576
13402
|
selectAllParent.classList.remove('e-item-focus');
|
|
12577
13403
|
}
|
|
12578
13404
|
};
|
|
12579
|
-
MultiSelect.prototype.moveByList = function (position) {
|
|
13405
|
+
MultiSelect.prototype.moveByList = function (position, isVirtualKeyAction) {
|
|
12580
13406
|
if (this.list) {
|
|
12581
13407
|
var elements = this.list.querySelectorAll('li.'
|
|
12582
13408
|
+ dropDownBaseClasses.li
|
|
@@ -12587,6 +13413,9 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
12587
13413
|
+ ':not(.' + HIDE_LIST + ')' + ':not(.e-reorder-hide)');
|
|
12588
13414
|
}
|
|
12589
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
|
+
}
|
|
12590
13419
|
var temp = -1;
|
|
12591
13420
|
var selectAllParent = document.getElementsByClassName('e-selectall-parent')[0];
|
|
12592
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) {
|
|
@@ -12615,22 +13444,57 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
12615
13444
|
if (position > 0) {
|
|
12616
13445
|
if (temp < (elements.length - 1)) {
|
|
12617
13446
|
this.removeFocus();
|
|
12618
|
-
this.
|
|
12619
|
-
|
|
12620
|
-
|
|
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
|
+
}
|
|
12621
13458
|
}
|
|
12622
13459
|
}
|
|
12623
13460
|
else {
|
|
12624
13461
|
if (temp > 0) {
|
|
12625
|
-
this.
|
|
12626
|
-
|
|
12627
|
-
|
|
12628
|
-
|
|
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
|
+
}
|
|
12629
13481
|
}
|
|
12630
13482
|
}
|
|
12631
13483
|
}
|
|
12632
13484
|
}
|
|
12633
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
|
+
};
|
|
12634
13498
|
MultiSelect.prototype.updateCheck = function (element) {
|
|
12635
13499
|
if (this.mode === 'CheckBox' && this.enableGroupCheckBox &&
|
|
12636
13500
|
!isNullOrUndefined(this.fields.groupBy)) {
|
|
@@ -12692,7 +13556,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
12692
13556
|
if (this.enabled && !this.readonly) {
|
|
12693
13557
|
var element = e.target.parentElement;
|
|
12694
13558
|
var customVal = element.getAttribute('data-value');
|
|
12695
|
-
var value = this.getFormattedValue(customVal);
|
|
13559
|
+
var value = this.allowObjectBinding ? this.getDataByValue(customVal) : this.getFormattedValue(customVal);
|
|
12696
13560
|
if (this.allowCustomValue && ((customVal !== 'false' && value === false) ||
|
|
12697
13561
|
(!isNullOrUndefined(value) && value.toString() === 'NaN'))) {
|
|
12698
13562
|
value = customVal;
|
|
@@ -12704,6 +13568,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
12704
13568
|
this.inputElement.focus();
|
|
12705
13569
|
}
|
|
12706
13570
|
this.removeValue(value, e);
|
|
13571
|
+
value = this.allowObjectBinding ? getValue((this.fields.value) ? this.fields.value : '', value) : value;
|
|
12707
13572
|
if (isNullOrUndefined(this.findListElement(this.list, 'li', 'data-value', value)) && this.mainList && this.listData) {
|
|
12708
13573
|
var list = this.mainList.cloneNode ? this.mainList.cloneNode(true) : this.mainList;
|
|
12709
13574
|
this.onActionComplete(list, this.mainData);
|
|
@@ -12738,7 +13603,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
12738
13603
|
this.expandTextbox();
|
|
12739
13604
|
};
|
|
12740
13605
|
MultiSelect.prototype.removeAllItems = function (value, eve, isClearAll, element, mainElement) {
|
|
12741
|
-
var index = this.value.indexOf(value);
|
|
13606
|
+
var index = this.allowObjectBinding ? this.indexOfObjectInArray(value, this.value) : this.value.indexOf(value);
|
|
12742
13607
|
var removeVal = this.value.slice(0);
|
|
12743
13608
|
removeVal.splice(index, 1);
|
|
12744
13609
|
this.setProperties({ value: [].concat([], removeVal) }, true);
|
|
@@ -12753,7 +13618,8 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
12753
13618
|
e: this, index: index
|
|
12754
13619
|
});
|
|
12755
13620
|
this.invokeCheckboxSelection(element, eve, isClearAll);
|
|
12756
|
-
this.
|
|
13621
|
+
var currentValue = this.allowObjectBinding ? getValue(((this.fields.value) ? this.fields.value : ''), value) : value;
|
|
13622
|
+
this.updateMainList(true, currentValue, mainElement);
|
|
12757
13623
|
this.updateChipStatus();
|
|
12758
13624
|
};
|
|
12759
13625
|
MultiSelect.prototype.invokeCheckboxSelection = function (element, eve, isClearAll) {
|
|
@@ -12770,9 +13636,9 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
12770
13636
|
};
|
|
12771
13637
|
MultiSelect.prototype.removeValue = function (value, eve, length, isClearAll) {
|
|
12772
13638
|
var _this = this;
|
|
12773
|
-
var index = this.value.indexOf(this.getFormattedValue(value));
|
|
13639
|
+
var index = this.allowObjectBinding ? this.indexOfObjectInArray(value, this.value) : this.value.indexOf(this.getFormattedValue(value));
|
|
12774
13640
|
if (index === -1 && this.allowCustomValue && !isNullOrUndefined(value)) {
|
|
12775
|
-
index = this.value.indexOf(value.toString());
|
|
13641
|
+
index = this.allowObjectBinding ? this.indexOfObjectInArray(value, this.value) : this.value.indexOf(value.toString());
|
|
12776
13642
|
}
|
|
12777
13643
|
var targetEle = eve && eve.target;
|
|
12778
13644
|
isClearAll = (isClearAll || targetEle && targetEle.classList.contains('e-close-hooker')) ? true : null;
|
|
@@ -12780,7 +13646,8 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
12780
13646
|
HIDE_LIST :
|
|
12781
13647
|
dropDownBaseClasses.selected;
|
|
12782
13648
|
if (index !== -1) {
|
|
12783
|
-
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);
|
|
12784
13651
|
var val_1 = this.getDataByValue(value);
|
|
12785
13652
|
var eventArgs = {
|
|
12786
13653
|
e: eve,
|
|
@@ -12794,11 +13661,20 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
12794
13661
|
_this.removeIndex++;
|
|
12795
13662
|
}
|
|
12796
13663
|
else {
|
|
13664
|
+
_this.virtualSelectAll = false;
|
|
12797
13665
|
var removeVal = _this.value.slice(0);
|
|
13666
|
+
if (_this.enableVirtualization && isClearAll) {
|
|
13667
|
+
removeVal = [];
|
|
13668
|
+
}
|
|
12798
13669
|
removeVal.splice(index, 1);
|
|
12799
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
|
+
}
|
|
12800
13675
|
if (element_1 !== null) {
|
|
12801
|
-
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);
|
|
12802
13678
|
element_1.setAttribute('aria-selected', 'false');
|
|
12803
13679
|
removeClass([element_1], className);
|
|
12804
13680
|
if (hideElement) {
|
|
@@ -12812,15 +13688,16 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
12812
13688
|
});
|
|
12813
13689
|
_this.invokeCheckboxSelection(element_1, eve, isClearAll);
|
|
12814
13690
|
}
|
|
13691
|
+
var currentValue_2 = _this.allowObjectBinding ? getValue(((_this.fields.value) ? _this.fields.value : ''), value) : value;
|
|
12815
13692
|
if (_this.hideSelectedItem && _this.fields.groupBy && element_1) {
|
|
12816
|
-
_this.hideGroupItem(
|
|
13693
|
+
_this.hideGroupItem(currentValue_2);
|
|
12817
13694
|
}
|
|
12818
13695
|
if (_this.hideSelectedItem && _this.fixedHeaderElement && _this.fields.groupBy && _this.mode !== 'CheckBox' &&
|
|
12819
13696
|
_this.isPopupOpen()) {
|
|
12820
13697
|
_super.prototype.scrollStop.call(_this);
|
|
12821
13698
|
}
|
|
12822
|
-
_this.updateMainList(true,
|
|
12823
|
-
_this.removeChip(
|
|
13699
|
+
_this.updateMainList(true, currentValue_2);
|
|
13700
|
+
_this.removeChip(currentValue_2, isClearAll);
|
|
12824
13701
|
_this.updateChipStatus();
|
|
12825
13702
|
var limit = _this.value && _this.value.length ? _this.value.length : 0;
|
|
12826
13703
|
if (limit < _this.maximumSelectionLength) {
|
|
@@ -12856,6 +13733,14 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
12856
13733
|
if (isClearAll && (length === 1 || length === null)) {
|
|
12857
13734
|
_this.clearAllCallback(eve, isClearAll);
|
|
12858
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
|
+
}
|
|
12859
13744
|
}
|
|
12860
13745
|
});
|
|
12861
13746
|
}
|
|
@@ -12886,11 +13771,16 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
12886
13771
|
}
|
|
12887
13772
|
}
|
|
12888
13773
|
};
|
|
12889
|
-
MultiSelect.prototype.removeChip = function (value) {
|
|
13774
|
+
MultiSelect.prototype.removeChip = function (value, isClearAll) {
|
|
12890
13775
|
if (this.chipCollectionWrapper) {
|
|
12891
|
-
|
|
12892
|
-
|
|
12893
|
-
|
|
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
|
+
}
|
|
12894
13784
|
}
|
|
12895
13785
|
}
|
|
12896
13786
|
};
|
|
@@ -12924,12 +13814,45 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
12924
13814
|
this.hideOverAllClear();
|
|
12925
13815
|
}
|
|
12926
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
|
+
};
|
|
12927
13831
|
MultiSelect.prototype.addValue = function (value, text, eve) {
|
|
12928
13832
|
if (!this.value) {
|
|
12929
13833
|
this.value = [];
|
|
12930
13834
|
}
|
|
12931
|
-
|
|
12932
|
-
|
|
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
|
+
}
|
|
12933
13856
|
}
|
|
12934
13857
|
var element = this.findListElement(this.list, 'li', 'data-value', value);
|
|
12935
13858
|
this.removeFocus();
|
|
@@ -12958,6 +13881,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
12958
13881
|
var _this = this;
|
|
12959
13882
|
var list = this.listData;
|
|
12960
13883
|
if (this.initStatus && !isNotTrigger) {
|
|
13884
|
+
value = this.allowObjectBinding ? getValue(((this.fields.value) ? this.fields.value : ''), value) : value;
|
|
12961
13885
|
var val_2 = this.getDataByValue(value);
|
|
12962
13886
|
var eventArgs = {
|
|
12963
13887
|
e: eve,
|
|
@@ -12986,7 +13910,10 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
12986
13910
|
if (_this.allowCustomValue && _this.isServerRendered && _this.listData !== list) {
|
|
12987
13911
|
_this.listData = list;
|
|
12988
13912
|
}
|
|
12989
|
-
_this.
|
|
13913
|
+
value = _this.allowObjectBinding ? _this.getDataByValue(value) : value;
|
|
13914
|
+
if ((_this.enableVirtualization && value) || !_this.enableVirtualization) {
|
|
13915
|
+
_this.updateListSelectEventCallback(value, element, eve);
|
|
13916
|
+
}
|
|
12990
13917
|
if (_this.hideSelectedItem && _this.fixedHeaderElement && _this.fields.groupBy && _this.mode !== 'CheckBox') {
|
|
12991
13918
|
_super.prototype.scrollStop.call(_this);
|
|
12992
13919
|
}
|
|
@@ -13071,7 +13998,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
13071
13998
|
chipContent.innerText = data;
|
|
13072
13999
|
}
|
|
13073
14000
|
else {
|
|
13074
|
-
chipContent.innerHTML = this.encodeHtmlEntities(data);
|
|
14001
|
+
chipContent.innerHTML = this.encodeHtmlEntities(data.toString());
|
|
13075
14002
|
}
|
|
13076
14003
|
chip.appendChild(chipContent);
|
|
13077
14004
|
var eventArgs = {
|
|
@@ -13157,6 +14084,37 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
13157
14084
|
overAllHeight -= this.header.offsetHeight;
|
|
13158
14085
|
}
|
|
13159
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
|
+
}
|
|
13160
14118
|
if (this.footerTemplate) {
|
|
13161
14119
|
this.setFooterTemplate();
|
|
13162
14120
|
overAllHeight -= this.footer.offsetHeight;
|
|
@@ -13229,21 +14187,41 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
13229
14187
|
}
|
|
13230
14188
|
_this.popupObj.wireScrollEvents();
|
|
13231
14189
|
if (!(_this.mode !== 'CheckBox' && (_this.allowFiltering || _this.allowCustomValue) &&
|
|
13232
|
-
_this.targetElement().trim() !== '')) {
|
|
14190
|
+
_this.targetElement().trim() !== '') && !_this.enableVirtualization) {
|
|
13233
14191
|
_this.loadTemplate();
|
|
14192
|
+
if (_this.enableVirtualization && _this.mode === 'CheckBox') {
|
|
14193
|
+
_this.UpdateSkeleton();
|
|
14194
|
+
}
|
|
13234
14195
|
}
|
|
14196
|
+
_this.isPreventScrollAction = true;
|
|
13235
14197
|
_this.setScrollPosition();
|
|
13236
14198
|
if (_this.allowFiltering) {
|
|
13237
14199
|
_this.notify('inputFocus', {
|
|
13238
14200
|
module: 'CheckBoxSelection', enable: _this.mode === 'CheckBox', value: 'focus'
|
|
13239
14201
|
});
|
|
13240
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
|
+
}
|
|
13241
14218
|
}, targetExitViewport: function () {
|
|
13242
14219
|
if (!Browser.isDevice) {
|
|
13243
14220
|
_this.hidePopup();
|
|
13244
14221
|
}
|
|
13245
14222
|
}
|
|
13246
14223
|
});
|
|
14224
|
+
this.popupContentElement = this.popupObj.element.querySelector('.e-content');
|
|
13247
14225
|
if (this.mode === 'CheckBox' && Browser.isDevice && this.allowFiltering) {
|
|
13248
14226
|
this.notify('deviceSearchBox', { module: 'CheckBoxSelection', enable: this.mode === 'CheckBox' });
|
|
13249
14227
|
}
|
|
@@ -13301,6 +14279,53 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
13301
14279
|
append([this.footer], this.popupWrapper);
|
|
13302
14280
|
EventHandler.add(this.footer, 'mousedown', this.onListMouseDown, this);
|
|
13303
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
|
+
};
|
|
13304
14329
|
MultiSelect.prototype.clearAll = function (e) {
|
|
13305
14330
|
if (this.enabled && !this.readonly) {
|
|
13306
14331
|
var temp = void 0;
|
|
@@ -13321,6 +14346,24 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
13321
14346
|
else {
|
|
13322
14347
|
this.clearAllCallback(e);
|
|
13323
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
|
+
}
|
|
13324
14367
|
}
|
|
13325
14368
|
};
|
|
13326
14369
|
MultiSelect.prototype.clearAllCallback = function (e, isClearAll) {
|
|
@@ -13421,6 +14464,8 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
13421
14464
|
MultiSelect.prototype.search = function (e) {
|
|
13422
14465
|
var _this = this;
|
|
13423
14466
|
this.resetFilteredData = true;
|
|
14467
|
+
this.preventSetCurrentData = false;
|
|
14468
|
+
this.firstItem = this.dataSource && this.dataSource.length > 0 ? this.dataSource[0] : null;
|
|
13424
14469
|
if (!isNullOrUndefined(e)) {
|
|
13425
14470
|
this.keyCode = e.keyCode;
|
|
13426
14471
|
}
|
|
@@ -13437,6 +14482,9 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
13437
14482
|
if (this.allowCustomValue) {
|
|
13438
14483
|
this.isRemoteSelection = true;
|
|
13439
14484
|
}
|
|
14485
|
+
if (!this.backCommand) {
|
|
14486
|
+
this.checkAndResetCache();
|
|
14487
|
+
}
|
|
13440
14488
|
var eventArgs_1 = {
|
|
13441
14489
|
preventDefaultAction: false,
|
|
13442
14490
|
text: this.targetElement(),
|
|
@@ -13463,12 +14511,83 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
13463
14511
|
else if (this.allowCustomValue) {
|
|
13464
14512
|
var query = new Query();
|
|
13465
14513
|
query = this.allowFiltering && (text !== '') ? query.where(this.fields.text, 'startswith', text, this.ignoreCase, this.ignoreAccent) : query;
|
|
13466
|
-
|
|
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();
|
|
13467
14526
|
}
|
|
13468
14527
|
else {
|
|
13469
14528
|
var liCollections = this.list.querySelectorAll('li.' + dropDownBaseClasses.li + ':not(.e-hide-listitem)');
|
|
14529
|
+
var type = this.typeOfData(this.listData).typeof;
|
|
13470
14530
|
var activeElement = Search(this.targetElement(), liCollections, 'StartsWith', this.ignoreCase);
|
|
13471
|
-
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) {
|
|
13472
14591
|
this.addListFocus(activeElement.item);
|
|
13473
14592
|
this.list.scrollTop =
|
|
13474
14593
|
activeElement.item.offsetHeight * activeElement.index;
|
|
@@ -13481,11 +14600,15 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
13481
14600
|
}
|
|
13482
14601
|
}
|
|
13483
14602
|
}
|
|
14603
|
+
if (this.enableVirtualization && this.allowFiltering) {
|
|
14604
|
+
this.getFilteringSkeletonCount();
|
|
14605
|
+
}
|
|
13484
14606
|
};
|
|
13485
14607
|
MultiSelect.prototype.preRender = function () {
|
|
13486
14608
|
if (this.allowFiltering === null) {
|
|
13487
14609
|
this.allowFiltering = (this.mode === 'CheckBox') ? true : false;
|
|
13488
14610
|
}
|
|
14611
|
+
this.preventSetCurrentData = false;
|
|
13489
14612
|
this.initializeData();
|
|
13490
14613
|
this.updateDataAttribute(this.htmlAttributes);
|
|
13491
14614
|
_super.prototype.preRender.call(this);
|
|
@@ -13507,6 +14630,14 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
13507
14630
|
this.isCustomRendered = false;
|
|
13508
14631
|
this.isRemoteSelection = false;
|
|
13509
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
|
+
};
|
|
13510
14641
|
};
|
|
13511
14642
|
MultiSelect.prototype.updateData = function (delimiterChar, e) {
|
|
13512
14643
|
var data = '';
|
|
@@ -13514,7 +14645,9 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
13514
14645
|
var text = [];
|
|
13515
14646
|
var temp;
|
|
13516
14647
|
var tempData = this.listData;
|
|
13517
|
-
this.
|
|
14648
|
+
if (!this.enableVirtualization) {
|
|
14649
|
+
this.listData = this.mainData;
|
|
14650
|
+
}
|
|
13518
14651
|
if (!isNullOrUndefined(this.hiddenElement)) {
|
|
13519
14652
|
this.hiddenElement.innerHTML = '';
|
|
13520
14653
|
}
|
|
@@ -13522,16 +14655,32 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
13522
14655
|
var valueLength = this.value.length;
|
|
13523
14656
|
var hiddenElementContent = '';
|
|
13524
14657
|
for (var index = 0; index < valueLength; index++) {
|
|
13525
|
-
var valueItem = this.value[index];
|
|
14658
|
+
var valueItem = this.allowObjectBinding ? getValue((this.fields.value) ? this.fields.value : '', this.value[index]) : this.value[index];
|
|
13526
14659
|
var listValue = this.findListElement((!isNullOrUndefined(this.mainList) ? this.mainList : this.ulElement), 'li', 'data-value', valueItem);
|
|
13527
|
-
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) {
|
|
13528
14664
|
this.value.splice(index, 1);
|
|
13529
14665
|
index -= 1;
|
|
13530
14666
|
valueLength -= 1;
|
|
13531
14667
|
}
|
|
13532
14668
|
else {
|
|
13533
14669
|
if (this.listData) {
|
|
13534
|
-
|
|
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
|
+
}
|
|
13535
14684
|
}
|
|
13536
14685
|
else {
|
|
13537
14686
|
temp = valueItem;
|
|
@@ -13545,7 +14694,10 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
13545
14694
|
this.hiddenElement.innerHTML = hiddenElementContent;
|
|
13546
14695
|
}
|
|
13547
14696
|
}
|
|
13548
|
-
|
|
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
|
+
}
|
|
13549
14701
|
if (delim) {
|
|
13550
14702
|
this.updateWrapperText(this.delimiterWrapper, data);
|
|
13551
14703
|
this.delimiterWrapper.setAttribute('id', getUniqueID('delim_val'));
|
|
@@ -13574,7 +14726,8 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
13574
14726
|
}
|
|
13575
14727
|
}
|
|
13576
14728
|
if (textVal && textVal.length) {
|
|
13577
|
-
this.
|
|
14729
|
+
var value = this.allowObjectBinding ? this.getDataByValue(textVal) : textVal;
|
|
14730
|
+
this.setProperties({ value: value }, true);
|
|
13578
14731
|
}
|
|
13579
14732
|
}
|
|
13580
14733
|
else {
|
|
@@ -13587,10 +14740,12 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
13587
14740
|
isEmptyData = true;
|
|
13588
14741
|
}
|
|
13589
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;
|
|
13590
14745
|
this.unwireListEvents();
|
|
13591
14746
|
this.wireListEvents();
|
|
13592
14747
|
};
|
|
13593
|
-
MultiSelect.prototype.initialValueUpdate = function () {
|
|
14748
|
+
MultiSelect.prototype.initialValueUpdate = function (listItems) {
|
|
13594
14749
|
if (this.list) {
|
|
13595
14750
|
var text = void 0;
|
|
13596
14751
|
var element = void 0;
|
|
@@ -13601,12 +14756,34 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
13601
14756
|
this.removeListSelection();
|
|
13602
14757
|
if (!isNullOrUndefined(this.value)) {
|
|
13603
14758
|
for (var index = 0; !isNullOrUndefined(this.value[index]); index++) {
|
|
13604
|
-
value = this.value[index];
|
|
14759
|
+
value = this.allowObjectBinding ? getValue(((this.fields.value) ? this.fields.value : ''), this.value[index]) : this.value[index];
|
|
13605
14760
|
element = this.findListElement(this.hideSelectedItem ? this.ulElement : this.list, 'li', 'data-value', value);
|
|
13606
|
-
|
|
13607
|
-
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')) ||
|
|
13608
14781
|
(element && (element.getAttribute('aria-selected') === 'true' && this.hideSelectedItem) &&
|
|
13609
|
-
(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);
|
|
13610
14787
|
this.addChip(text, value);
|
|
13611
14788
|
this.addListSelection(element);
|
|
13612
14789
|
}
|
|
@@ -13617,12 +14794,24 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
13617
14794
|
setValue(this.fields.value, value, newValue);
|
|
13618
14795
|
var noDataEle = this.popupWrapper.querySelector('.' + dropDownBaseClasses.noData);
|
|
13619
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
|
+
}
|
|
13620
14805
|
element = element ? element : this.findListElement(this.hideSelectedItem ? this.ulElement : this.list, 'li', 'data-value', value);
|
|
13621
14806
|
if (this.popupWrapper.contains(noDataEle)) {
|
|
13622
14807
|
this.list.setAttribute('style', noDataEle.getAttribute('style'));
|
|
13623
14808
|
this.popupWrapper.replaceChild(this.list, noDataEle);
|
|
13624
14809
|
this.wireListEvents();
|
|
13625
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);
|
|
13626
14815
|
this.addChip(text, value);
|
|
13627
14816
|
this.addListSelection(element);
|
|
13628
14817
|
}
|
|
@@ -13652,7 +14841,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
13652
14841
|
};
|
|
13653
14842
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
13654
14843
|
MultiSelect.prototype.updateActionCompleteData = function (li, item) {
|
|
13655
|
-
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)))) {
|
|
13656
14845
|
this.mainList = this.ulElement;
|
|
13657
14846
|
if (this.hideSelectedItem) {
|
|
13658
14847
|
addClass([li], HIDE_LIST);
|
|
@@ -13690,13 +14879,13 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
13690
14879
|
};
|
|
13691
14880
|
MultiSelect.prototype.updateListSelection = function (li, e, length) {
|
|
13692
14881
|
var customVal = li.getAttribute('data-value');
|
|
13693
|
-
var value = this.getFormattedValue(customVal);
|
|
14882
|
+
var value = this.allowObjectBinding ? this.getDataByValue(customVal) : this.getFormattedValue(customVal);
|
|
13694
14883
|
if (this.allowCustomValue && ((customVal !== 'false' && value === false) ||
|
|
13695
14884
|
(!isNullOrUndefined(value) && value.toString() === 'NaN'))) {
|
|
13696
14885
|
value = customVal;
|
|
13697
14886
|
}
|
|
13698
14887
|
this.removeHover();
|
|
13699
|
-
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))) {
|
|
13700
14889
|
this.dispatchSelect(value, e, li, (li.getAttribute('aria-selected') === 'true'), length);
|
|
13701
14890
|
}
|
|
13702
14891
|
else {
|
|
@@ -13705,9 +14894,10 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
13705
14894
|
};
|
|
13706
14895
|
MultiSelect.prototype.updateListSelectEventCallback = function (value, li, e) {
|
|
13707
14896
|
var _this = this;
|
|
14897
|
+
value = this.allowObjectBinding ? getValue(((this.fields.value) ? this.fields.value : ''), value) : value;
|
|
13708
14898
|
var text = this.getTextByValue(value);
|
|
13709
|
-
if ((this.allowCustomValue || this.allowFiltering) && !this.findListElement(this.mainList, 'li', 'data-value', value)) {
|
|
13710
|
-
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;
|
|
13711
14901
|
var fieldValue = this.fields.value ? this.fields.value : 'value';
|
|
13712
14902
|
if (this.allowCustomValue && this.mainData.length && typeof getValue(fieldValue, this.mainData[0]) === 'number') {
|
|
13713
14903
|
value = !isNaN(parseFloat(value.toString())) ? parseFloat(value.toString()) : value;
|
|
@@ -13719,10 +14909,22 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
13719
14909
|
};
|
|
13720
14910
|
this.trigger('customValueSelection', eventArgs, function (eventArgs) {
|
|
13721
14911
|
if (!eventArgs.cancel) {
|
|
13722
|
-
|
|
13723
|
-
|
|
13724
|
-
|
|
13725
|
-
|
|
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
|
+
}
|
|
13726
14928
|
}
|
|
13727
14929
|
});
|
|
13728
14930
|
}
|
|
@@ -13832,8 +15034,12 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
13832
15034
|
var _this = this;
|
|
13833
15035
|
this.keyCode = null;
|
|
13834
15036
|
this.scrollFocusStatus = false;
|
|
15037
|
+
this.keyboardEvent = null;
|
|
13835
15038
|
var target = e.target;
|
|
13836
15039
|
var li = closest(target, '.' + dropDownBaseClasses.li);
|
|
15040
|
+
if (this.enableVirtualization && li && li.classList.contains('e-virtual-list')) {
|
|
15041
|
+
return;
|
|
15042
|
+
}
|
|
13837
15043
|
var headerLi = closest(target, '.' + dropDownBaseClasses.group);
|
|
13838
15044
|
if (headerLi && this.enableGroupCheckBox && this.mode === 'CheckBox' && this.fields.groupBy) {
|
|
13839
15045
|
target = target.classList.contains('e-list-group-item') ? target.firstElementChild.lastElementChild
|
|
@@ -13910,6 +15116,39 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
13910
15116
|
else {
|
|
13911
15117
|
e.preventDefault();
|
|
13912
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
|
+
}
|
|
13913
15152
|
this.refreshPlaceHolder();
|
|
13914
15153
|
this.deselectHeader();
|
|
13915
15154
|
}
|
|
@@ -14147,7 +15386,9 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
14147
15386
|
var remaining = void 0;
|
|
14148
15387
|
var downIconWidth = 0;
|
|
14149
15388
|
var overAllContainer = void 0;
|
|
14150
|
-
|
|
15389
|
+
if (!this.enableVirtualization) {
|
|
15390
|
+
this.updateWrapperText(this.viewWrapper, data);
|
|
15391
|
+
}
|
|
14151
15392
|
var l10nLocale = {
|
|
14152
15393
|
noRecordsTemplate: 'No records found',
|
|
14153
15394
|
actionFailureTemplate: 'Request failed',
|
|
@@ -14178,11 +15419,21 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
14178
15419
|
this.checkClearIconWidth();
|
|
14179
15420
|
if (!isNullOrUndefined(this.value)) {
|
|
14180
15421
|
for (var index = 0; !isNullOrUndefined(this.value[index]); index++) {
|
|
14181
|
-
|
|
14182
|
-
|
|
14183
|
-
|
|
14184
|
-
|
|
14185
|
-
|
|
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
|
+
}
|
|
14186
15437
|
wrapperleng = this.viewWrapper.offsetWidth +
|
|
14187
15438
|
parseInt(window.getComputedStyle(this.viewWrapper).paddingRight, 10);
|
|
14188
15439
|
overAllContainer = this.componentWrapper.offsetWidth -
|
|
@@ -14285,18 +15536,19 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
14285
15536
|
MultiSelect.prototype.getOverflowVal = function (index) {
|
|
14286
15537
|
var temp;
|
|
14287
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];
|
|
14288
15540
|
if (this.mode === 'CheckBox') {
|
|
14289
15541
|
var newTemp = this.listData;
|
|
14290
15542
|
this.listData = this.mainData;
|
|
14291
|
-
temp = this.getTextByValue(
|
|
15543
|
+
temp = this.getTextByValue(value);
|
|
14292
15544
|
this.listData = newTemp;
|
|
14293
15545
|
}
|
|
14294
15546
|
else {
|
|
14295
|
-
temp = this.getTextByValue(
|
|
15547
|
+
temp = this.getTextByValue(value);
|
|
14296
15548
|
}
|
|
14297
15549
|
}
|
|
14298
15550
|
else {
|
|
14299
|
-
temp = this.value[index];
|
|
15551
|
+
temp = this.allowObjectBinding ? getValue(((this.fields.value) ? this.fields.value : ''), this.value[index]) : this.value[index];
|
|
14300
15552
|
}
|
|
14301
15553
|
return temp;
|
|
14302
15554
|
};
|
|
@@ -14414,8 +15666,8 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
14414
15666
|
preventSelectEvent: false
|
|
14415
15667
|
};
|
|
14416
15668
|
this.trigger('beforeSelectAll', beforeSelectArgs);
|
|
14417
|
-
if (li && li.length) {
|
|
14418
|
-
var
|
|
15669
|
+
if ((li && li.length) || (this.enableVirtualization && !state)) {
|
|
15670
|
+
var index_2 = 0;
|
|
14419
15671
|
var count_1 = 0;
|
|
14420
15672
|
if (this.enableGroupCheckBox) {
|
|
14421
15673
|
count_1 = state ? this.maximumSelectionLength - (this.value ? this.value.length : 0) : li.length;
|
|
@@ -14424,62 +15676,153 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
14424
15676
|
count_1 = state ? this.maximumSelectionLength - (this.value ? this.value.length : 0) : this.maximumSelectionLength;
|
|
14425
15677
|
}
|
|
14426
15678
|
if (!beforeSelectArgs.preventSelectEvent) {
|
|
14427
|
-
this.
|
|
14428
|
-
|
|
14429
|
-
|
|
14430
|
-
|
|
14431
|
-
this.
|
|
14432
|
-
|
|
14433
|
-
|
|
14434
|
-
|
|
14435
|
-
|
|
14436
|
-
|
|
14437
|
-
|
|
14438
|
-
|
|
14439
|
-
|
|
14440
|
-
|
|
14441
|
-
|
|
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
|
+
}
|
|
14442
15728
|
}
|
|
14443
|
-
index_1++;
|
|
14444
15729
|
}
|
|
14445
|
-
|
|
14446
|
-
|
|
14447
|
-
|
|
14448
|
-
|
|
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++;
|
|
14449
15735
|
}
|
|
14450
|
-
|
|
14451
|
-
|
|
14452
|
-
|
|
14453
|
-
|
|
14454
|
-
|
|
14455
|
-
|
|
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]);
|
|
14456
15773
|
}
|
|
14457
|
-
|
|
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
|
+
}
|
|
14458
15800
|
}
|
|
14459
15801
|
}
|
|
14460
15802
|
else {
|
|
14461
|
-
for (var
|
|
15803
|
+
for (var i_1 = 0; i_1 < li.length && i_1 < count_1; i_1++) {
|
|
14462
15804
|
this.removeHover();
|
|
14463
|
-
var customVal = li[
|
|
14464
|
-
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;
|
|
14465
15808
|
var mainElement = this.mainList ? this.mainList.querySelectorAll(state ?
|
|
14466
15809
|
'li.e-list-item:not([aria-selected="true"]):not(.e-reorder-hide)' :
|
|
14467
|
-
'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;
|
|
14468
15811
|
if (state) {
|
|
14469
15812
|
this.value = !this.value ? [] : this.value;
|
|
14470
|
-
if (this.value.indexOf(
|
|
14471
|
-
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);
|
|
14472
15815
|
}
|
|
14473
15816
|
this.removeFocus();
|
|
14474
|
-
this.addListSelection(li[
|
|
15817
|
+
this.addListSelection(li[i_1], mainElement);
|
|
14475
15818
|
this.updateChipStatus();
|
|
14476
15819
|
this.checkMaxSelection();
|
|
14477
15820
|
}
|
|
14478
15821
|
else {
|
|
14479
|
-
this.removeAllItems(
|
|
15822
|
+
this.removeAllItems(value_5, event, false, li[i_1], mainElement);
|
|
14480
15823
|
}
|
|
14481
15824
|
if (this.enableGroupCheckBox) {
|
|
14482
|
-
this.findGroupStart(li[
|
|
15825
|
+
this.findGroupStart(li[i_1]);
|
|
14483
15826
|
}
|
|
14484
15827
|
}
|
|
14485
15828
|
if (!state) {
|
|
@@ -14613,6 +15956,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
14613
15956
|
}
|
|
14614
15957
|
this.selectAllItem(state, event);
|
|
14615
15958
|
}
|
|
15959
|
+
this.virtualSelectAll = false;
|
|
14616
15960
|
};
|
|
14617
15961
|
/**
|
|
14618
15962
|
* Get the properties to be maintained in the persisted state.
|
|
@@ -14780,12 +16124,31 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
14780
16124
|
}
|
|
14781
16125
|
this.renderPopup();
|
|
14782
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
|
+
};
|
|
14783
16144
|
MultiSelect.prototype.presentItemValue = function (ulElement) {
|
|
14784
16145
|
var valuecheck = [];
|
|
14785
16146
|
for (var i = 0; i < this.value.length; i++) {
|
|
14786
|
-
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);
|
|
14787
16149
|
if (!checkEle) {
|
|
14788
|
-
|
|
16150
|
+
var checkvalue = this.allowObjectBinding ? this.getDataByValue(this.value[i]) : this.value[i];
|
|
16151
|
+
valuecheck.push(checkvalue);
|
|
14789
16152
|
}
|
|
14790
16153
|
}
|
|
14791
16154
|
return valuecheck;
|
|
@@ -14898,6 +16261,31 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
14898
16261
|
if (_this.mode === 'CheckBox' && _this.showSelectAll) {
|
|
14899
16262
|
EventHandler.remove(_this.popupObj.element, 'click', _this.clickHandler);
|
|
14900
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;
|
|
14901
16289
|
}
|
|
14902
16290
|
});
|
|
14903
16291
|
}
|
|
@@ -14912,6 +16300,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
14912
16300
|
if (!this.enabled) {
|
|
14913
16301
|
return;
|
|
14914
16302
|
}
|
|
16303
|
+
this.firstItem = this.dataSource && this.dataSource.length > 0 ? this.dataSource[0] : null;
|
|
14915
16304
|
var args = { cancel: false };
|
|
14916
16305
|
this.trigger('beforeOpen', args, function (args) {
|
|
14917
16306
|
if (!args.cancel) {
|
|
@@ -14934,6 +16323,47 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
14934
16323
|
return;
|
|
14935
16324
|
}
|
|
14936
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;
|
|
14937
16367
|
}
|
|
14938
16368
|
});
|
|
14939
16369
|
};
|
|
@@ -15086,6 +16516,13 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
15086
16516
|
this.wireEvent();
|
|
15087
16517
|
this.enable(this.enabled);
|
|
15088
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;
|
|
15089
16526
|
this.checkInitialValue();
|
|
15090
16527
|
if (this.element.hasAttribute('data-val')) {
|
|
15091
16528
|
this.element.setAttribute('data-val', 'false');
|
|
@@ -15097,6 +16534,22 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
15097
16534
|
}
|
|
15098
16535
|
this.renderComplete();
|
|
15099
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
|
+
};
|
|
15100
16553
|
MultiSelect.prototype.checkInitialValue = function () {
|
|
15101
16554
|
var _this = this;
|
|
15102
16555
|
var isData = this.dataSource instanceof Array ? (this.dataSource.length > 0)
|
|
@@ -15113,7 +16566,8 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
15113
16566
|
var opt = optionsElement[index];
|
|
15114
16567
|
if (!isNullOrUndefined(opt.getAttribute('selected'))) {
|
|
15115
16568
|
if (opt.getAttribute('value')) {
|
|
15116
|
-
|
|
16569
|
+
var value = this.allowObjectBinding ? this.getDataByValue(opt.getAttribute('value')) : opt.getAttribute('value');
|
|
16570
|
+
valueCol.push(value);
|
|
15117
16571
|
}
|
|
15118
16572
|
else {
|
|
15119
16573
|
textCol += (opt.text + this.delimiterChar);
|
|
@@ -15140,14 +16594,40 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
15140
16594
|
this.initialTextUpdate();
|
|
15141
16595
|
}
|
|
15142
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
|
+
}
|
|
15143
16623
|
if (!(this.dataSource instanceof DataManager)) {
|
|
15144
|
-
this.initialValueUpdate();
|
|
16624
|
+
this.initialValueUpdate(listItems_2);
|
|
15145
16625
|
this.initialUpdate();
|
|
15146
16626
|
}
|
|
15147
16627
|
else {
|
|
15148
16628
|
this.setInitialValue = function () {
|
|
15149
16629
|
_this.initStatus = false;
|
|
15150
|
-
_this.initialValueUpdate();
|
|
16630
|
+
_this.initialValueUpdate(listItems_2);
|
|
15151
16631
|
_this.initialUpdate();
|
|
15152
16632
|
_this.setInitialValue = null;
|
|
15153
16633
|
_this.initStatus = true;
|
|
@@ -15169,6 +16649,34 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
15169
16649
|
this.inputElement.focus();
|
|
15170
16650
|
}
|
|
15171
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
|
+
};
|
|
15172
16680
|
MultiSelect.prototype.setFloatLabelType = function () {
|
|
15173
16681
|
removeFloating(this.overAllWrapper, this.componentWrapper, this.searchWrapper, this.inputElement, this.value, this.floatLabelType, this.placeholder);
|
|
15174
16682
|
if (this.floatLabelType !== 'Never') {
|
|
@@ -15202,6 +16710,8 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
15202
16710
|
if (this.mode !== 'Box' && !(this.setDynValue && this.mode === 'Default' && this.inputFocus)) {
|
|
15203
16711
|
this.updateDelimView();
|
|
15204
16712
|
}
|
|
16713
|
+
this.viewPortInfo.startIndex = this.virtualItemStartIndex = 0;
|
|
16714
|
+
this.viewPortInfo.endIndex = this.virtualItemEndIndex = this.itemCount;
|
|
15205
16715
|
this.updateCssClass();
|
|
15206
16716
|
this.updateHTMLAttribute();
|
|
15207
16717
|
this.updateReadonly(this.readonly);
|
|
@@ -15298,6 +16808,9 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
15298
16808
|
__decorate$5([
|
|
15299
16809
|
Property(true)
|
|
15300
16810
|
], MultiSelect.prototype, "enableHtmlSanitizer", void 0);
|
|
16811
|
+
__decorate$5([
|
|
16812
|
+
Property(false)
|
|
16813
|
+
], MultiSelect.prototype, "enableVirtualization", void 0);
|
|
15301
16814
|
__decorate$5([
|
|
15302
16815
|
Property([])
|
|
15303
16816
|
], MultiSelect.prototype, "dataSource", void 0);
|
|
@@ -15376,6 +16889,9 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
15376
16889
|
__decorate$5([
|
|
15377
16890
|
Property(null)
|
|
15378
16891
|
], MultiSelect.prototype, "value", void 0);
|
|
16892
|
+
__decorate$5([
|
|
16893
|
+
Property(false)
|
|
16894
|
+
], MultiSelect.prototype, "allowObjectBinding", void 0);
|
|
15379
16895
|
__decorate$5([
|
|
15380
16896
|
Property(true)
|
|
15381
16897
|
], MultiSelect.prototype, "hideSelectedItem", void 0);
|
|
@@ -15606,7 +17122,7 @@ var CheckBoxSelection = /** @__PURE__ @class */ (function () {
|
|
|
15606
17122
|
}
|
|
15607
17123
|
EventHandler.add(this.checkAllParent, 'mousedown', this.clickHandler, this);
|
|
15608
17124
|
}
|
|
15609
|
-
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 &&
|
|
15610
17126
|
!(this.parent.isDynamicDataChange)) || (this.parent.isDynamicDataChange &&
|
|
15611
17127
|
this.parent.listData && this.parent.listData.length <= 1)) {
|
|
15612
17128
|
this.checkAllParent.style.display = 'none';
|
|
@@ -15968,7 +17484,13 @@ var CheckBoxSelection = /** @__PURE__ @class */ (function () {
|
|
|
15968
17484
|
});
|
|
15969
17485
|
remLi = this.parent.ulElement.querySelectorAll('li.e-active');
|
|
15970
17486
|
addClass(remLi, 'e-reorder-hide');
|
|
15971
|
-
|
|
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
|
+
}
|
|
15972
17494
|
}
|
|
15973
17495
|
this.parent.focusAtFirstListItem();
|
|
15974
17496
|
}
|
|
@@ -16369,7 +17891,7 @@ var ListBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
16369
17891
|
}
|
|
16370
17892
|
}
|
|
16371
17893
|
this.initWrapper();
|
|
16372
|
-
this.setSelection();
|
|
17894
|
+
this.setSelection(this.value, true, false, !this.isRendered);
|
|
16373
17895
|
this.initDraggable();
|
|
16374
17896
|
this.mainList = this.ulElement;
|
|
16375
17897
|
if (this.initLoad) {
|
|
@@ -18032,11 +19554,12 @@ var ListBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
18032
19554
|
});
|
|
18033
19555
|
}
|
|
18034
19556
|
};
|
|
18035
|
-
ListBox.prototype.setSelection = function (values, isSelect, isText) {
|
|
19557
|
+
ListBox.prototype.setSelection = function (values, isSelect, isText, canFocus) {
|
|
18036
19558
|
var _this = this;
|
|
18037
19559
|
if (values === void 0) { values = this.value; }
|
|
18038
19560
|
if (isSelect === void 0) { isSelect = true; }
|
|
18039
19561
|
if (isText === void 0) { isText = false; }
|
|
19562
|
+
if (canFocus === void 0) { canFocus = true; }
|
|
18040
19563
|
var li;
|
|
18041
19564
|
var liselect;
|
|
18042
19565
|
if (values) {
|
|
@@ -18065,13 +19588,17 @@ var ListBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
18065
19588
|
if (!isSelect && liselect || isSelect && !liselect && li) {
|
|
18066
19589
|
if (_this.selectionSettings.showCheckbox) {
|
|
18067
19590
|
_this.notify('updatelist', { li: li, module: 'listbox' });
|
|
18068
|
-
|
|
19591
|
+
if (canFocus) {
|
|
19592
|
+
li.focus();
|
|
19593
|
+
}
|
|
18069
19594
|
}
|
|
18070
19595
|
else {
|
|
18071
19596
|
if (isSelect) {
|
|
18072
19597
|
li.classList.add(cssClass.selected);
|
|
18073
19598
|
li.setAttribute('aria-selected', 'true');
|
|
18074
|
-
|
|
19599
|
+
if (canFocus) {
|
|
19600
|
+
li.focus();
|
|
19601
|
+
}
|
|
18075
19602
|
}
|
|
18076
19603
|
else {
|
|
18077
19604
|
li.classList.remove(cssClass.selected);
|
|
@@ -18573,6 +20100,8 @@ var Mention = /** @__PURE__ @class */ (function (_super) {
|
|
|
18573
20100
|
this.isPopupOpen = false;
|
|
18574
20101
|
this.isCollided = false;
|
|
18575
20102
|
this.lineBreak = false;
|
|
20103
|
+
this.isRTE = false;
|
|
20104
|
+
this.keyEventName = 'mousedown';
|
|
18576
20105
|
};
|
|
18577
20106
|
/**
|
|
18578
20107
|
* Execute before render the list items
|
|
@@ -18618,7 +20147,7 @@ var Mention = /** @__PURE__ @class */ (function (_super) {
|
|
|
18618
20147
|
};
|
|
18619
20148
|
Mention.prototype.bindCommonEvent = function () {
|
|
18620
20149
|
if (!Browser.isDevice) {
|
|
18621
|
-
this.inputElement.addEventListener('keydown', this.keyDownHandler.bind(this),
|
|
20150
|
+
this.inputElement.addEventListener('keydown', this.keyDownHandler.bind(this), !this.isRTE);
|
|
18622
20151
|
}
|
|
18623
20152
|
};
|
|
18624
20153
|
/**
|
|
@@ -18648,6 +20177,10 @@ var Mention = /** @__PURE__ @class */ (function (_super) {
|
|
|
18648
20177
|
return parentElement.querySelector('.e-content');
|
|
18649
20178
|
}
|
|
18650
20179
|
}
|
|
20180
|
+
if (targetElement && targetElement.parentElement && targetElement.parentElement.classList.contains('e-rte-content')) {
|
|
20181
|
+
this.isRTE = true;
|
|
20182
|
+
this.keyEventName = 'click';
|
|
20183
|
+
}
|
|
18651
20184
|
return targetElement;
|
|
18652
20185
|
};
|
|
18653
20186
|
/**
|
|
@@ -18789,7 +20322,7 @@ var Mention = /** @__PURE__ @class */ (function (_super) {
|
|
|
18789
20322
|
};
|
|
18790
20323
|
Mention.prototype.unBindCommonEvent = function () {
|
|
18791
20324
|
if (!Browser.isDevice) {
|
|
18792
|
-
this.inputElement.removeEventListener('keydown', this.keyDownHandler.bind(this),
|
|
20325
|
+
this.inputElement.removeEventListener('keydown', this.keyDownHandler.bind(this), !this.isRTE);
|
|
18793
20326
|
}
|
|
18794
20327
|
};
|
|
18795
20328
|
Mention.prototype.onKeyUp = function (e) {
|
|
@@ -18800,7 +20333,7 @@ var Mention = /** @__PURE__ @class */ (function (_super) {
|
|
|
18800
20333
|
}
|
|
18801
20334
|
this.isTyped = e.code !== 'Enter' && e.code !== 'Space' && e.code !== 'ArrowDown' && e.code !== 'ArrowUp' ? true : false;
|
|
18802
20335
|
var isRteImage = document.activeElement.parentElement && document.activeElement.parentElement.querySelector('.e-rte-image') ? true : false;
|
|
18803
|
-
if (document.activeElement != this.inputElement &&
|
|
20336
|
+
if (document.activeElement != this.inputElement && isRteImage) {
|
|
18804
20337
|
this.inputElement.focus();
|
|
18805
20338
|
}
|
|
18806
20339
|
if (this.isContentEditable(this.inputElement)) {
|
|
@@ -18826,9 +20359,9 @@ var Mention = /** @__PURE__ @class */ (function (_super) {
|
|
|
18826
20359
|
this.range.startContainer.previousElementSibling && this.range.startContainer.previousElementSibling.tagName !== 'BR' && this.range.startContainer.textContent.split('').length > 0 &&
|
|
18827
20360
|
(rangetextContent.length === 1 || rangetextContent[rangetextContent.length - 2].indexOf('') === -1 ||
|
|
18828
20361
|
this.range.startContainer.nodeType === 1))) {
|
|
18829
|
-
if (this.allowSpaces && currentRange && currentRange.trim() !== '' && charRegex.test(currentRange) && currentRange.indexOf(this.mentionChar) !== -1
|
|
20362
|
+
if (this.isPopupOpen && this.allowSpaces && currentRange && currentRange.trim() !== '' && charRegex.test(currentRange) && currentRange.indexOf(this.mentionChar) !== -1
|
|
18830
20363
|
&& !this.isMatchedText() && (currentRange.length > 1 && currentRange.replace(/\u00A0/g, ' ').charAt(currentRange.length - 2) !== ' ') &&
|
|
18831
|
-
(this.list && this.list.querySelectorAll('ul').length > 0)) {
|
|
20364
|
+
(this.list && this.list.querySelectorAll('ul').length > 0) && e.code !== 'Enter') {
|
|
18832
20365
|
this.queryString = currentRange.substring(currentRange.lastIndexOf(this.mentionChar) + 1).replace('\u00a0', ' ');
|
|
18833
20366
|
this.searchLists(e);
|
|
18834
20367
|
}
|
|
@@ -19334,6 +20867,9 @@ var Mention = /** @__PURE__ @class */ (function (_super) {
|
|
|
19334
20867
|
this.popupObj.element.removeAttribute('style');
|
|
19335
20868
|
this.popupObj.element.removeAttribute('aria-disabled');
|
|
19336
20869
|
}
|
|
20870
|
+
if (this.list.classList.contains('e-nodata')) {
|
|
20871
|
+
this.list = null;
|
|
20872
|
+
}
|
|
19337
20873
|
};
|
|
19338
20874
|
Mention.prototype.onDocumentClick = function (e) {
|
|
19339
20875
|
var target = e.target;
|
|
@@ -19444,6 +20980,7 @@ var Mention = /** @__PURE__ @class */ (function (_super) {
|
|
|
19444
20980
|
return coordinates;
|
|
19445
20981
|
};
|
|
19446
20982
|
Mention.prototype.initValue = function () {
|
|
20983
|
+
this.isDataFetched = false;
|
|
19447
20984
|
this.renderList();
|
|
19448
20985
|
if (this.dataSource instanceof DataManager) {
|
|
19449
20986
|
this.initRemoteRender = true;
|
|
@@ -19469,7 +21006,7 @@ var Mention = /** @__PURE__ @class */ (function (_super) {
|
|
|
19469
21006
|
* @returns {void}
|
|
19470
21007
|
*/
|
|
19471
21008
|
Mention.prototype.wireListEvents = function () {
|
|
19472
|
-
EventHandler.add(this.list,
|
|
21009
|
+
EventHandler.add(this.list, this.keyEventName, this.onMouseClick, this);
|
|
19473
21010
|
EventHandler.add(this.list, 'mouseover', this.onMouseOver, this);
|
|
19474
21011
|
EventHandler.add(this.list, 'mouseout', this.onMouseLeave, this);
|
|
19475
21012
|
};
|
|
@@ -19479,7 +21016,7 @@ var Mention = /** @__PURE__ @class */ (function (_super) {
|
|
|
19479
21016
|
* @returns {void}
|
|
19480
21017
|
*/
|
|
19481
21018
|
Mention.prototype.unWireListEvents = function () {
|
|
19482
|
-
EventHandler.remove(this.list,
|
|
21019
|
+
EventHandler.remove(this.list, this.keyEventName, this.onMouseClick);
|
|
19483
21020
|
EventHandler.remove(this.list, 'mouseover', this.onMouseOver);
|
|
19484
21021
|
EventHandler.remove(this.list, 'mouseout', this.onMouseLeave);
|
|
19485
21022
|
};
|
|
@@ -19494,7 +21031,9 @@ var Mention = /** @__PURE__ @class */ (function (_super) {
|
|
|
19494
21031
|
var delay = 100;
|
|
19495
21032
|
this.closePopup(delay, e);
|
|
19496
21033
|
this.inputElement.focus();
|
|
19497
|
-
|
|
21034
|
+
if (!this.isRTE) {
|
|
21035
|
+
e.preventDefault();
|
|
21036
|
+
}
|
|
19498
21037
|
};
|
|
19499
21038
|
Mention.prototype.updateSelectedItem = function (li, e, preventSelect, isSelection) {
|
|
19500
21039
|
var _this = this;
|
|
@@ -19735,7 +21274,7 @@ var Mention = /** @__PURE__ @class */ (function (_super) {
|
|
|
19735
21274
|
if (this.isPopupOpen) {
|
|
19736
21275
|
this.hidePopup();
|
|
19737
21276
|
}
|
|
19738
|
-
//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.
|
|
19739
21278
|
if (!isNullOrUndefined(e.pointerType) && e.pointerType === 'mouse') {
|
|
19740
21279
|
var event_1 = new CustomEvent('content-changed', { detail: { click: true } });
|
|
19741
21280
|
this.inputElement.dispatchEvent(event_1);
|