@syncfusion/ej2-dropdowns 24.2.9 → 25.1.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +27 -150
- package/dist/ej2-dropdowns.min.js +2 -2
- package/dist/ej2-dropdowns.umd.min.js +2 -2
- package/dist/ej2-dropdowns.umd.min.js.map +1 -1
- package/dist/es6/ej2-dropdowns.es2015.js +2014 -514
- package/dist/es6/ej2-dropdowns.es2015.js.map +1 -1
- package/dist/es6/ej2-dropdowns.es5.js +2030 -513
- package/dist/es6/ej2-dropdowns.es5.js.map +1 -1
- package/dist/global/ej2-dropdowns.min.js +2 -2
- package/dist/global/ej2-dropdowns.min.js.map +1 -1
- package/dist/global/index.d.ts +1 -1
- package/package.json +13 -13
- package/src/auto-complete/auto-complete-model.d.ts +3 -1
- package/src/auto-complete/auto-complete.d.ts +2 -0
- package/src/auto-complete/auto-complete.js +51 -6
- package/src/combo-box/combo-box-model.d.ts +10 -1
- package/src/combo-box/combo-box.d.ts +10 -2
- package/src/combo-box/combo-box.js +55 -23
- package/src/common/interface.d.ts +32 -0
- package/src/common/virtual-scroll.d.ts +1 -3
- package/src/common/virtual-scroll.js +157 -27
- package/src/drop-down-base/drop-down-base-model.d.ts +1 -1
- package/src/drop-down-base/drop-down-base.d.ts +64 -5
- package/src/drop-down-base/drop-down-base.js +241 -24
- package/src/drop-down-list/drop-down-list-model.d.ts +10 -1
- package/src/drop-down-list/drop-down-list.d.ts +16 -50
- package/src/drop-down-list/drop-down-list.js +150 -196
- package/src/drop-down-tree/drop-down-tree-model.d.ts +16 -12
- package/src/drop-down-tree/drop-down-tree.d.ts +13 -3
- package/src/drop-down-tree/drop-down-tree.js +55 -49
- package/src/global.js +1 -1
- package/src/list-box/list-box.js +9 -4
- package/src/mention/mention.d.ts +2 -0
- package/src/mention/mention.js +16 -8
- package/src/multi-select/checkbox-selection.d.ts +2 -0
- package/src/multi-select/checkbox-selection.js +16 -3
- package/src/multi-select/float-label.d.ts +5 -5
- package/src/multi-select/index.d.ts +1 -0
- package/src/multi-select/index.js +1 -0
- package/src/multi-select/interface.d.ts +1 -0
- package/src/multi-select/multi-select-model.d.ts +17 -2
- package/src/multi-select/multi-select.d.ts +35 -4
- package/src/multi-select/multi-select.js +1282 -174
- package/styles/auto-complete/_bds-definition.scss +2 -0
- package/styles/bootstrap-dark.css +7 -1
- package/styles/bootstrap.css +7 -1
- package/styles/bootstrap4.css +2 -1
- package/styles/bootstrap5-dark.css +2 -1
- package/styles/bootstrap5.css +2 -1
- package/styles/combo-box/_bds-definition.scss +2 -0
- package/styles/drop-down-base/_bds-definition.scss +134 -0
- package/styles/drop-down-list/_bds-definition.scss +134 -0
- package/styles/drop-down-list/icons/_bds.scss +14 -0
- package/styles/drop-down-tree/_bds-definition.scss +61 -0
- package/styles/drop-down-tree/icons/_bds.scss +11 -0
- package/styles/fabric-dark.css +3 -1
- package/styles/fabric.css +3 -1
- package/styles/fluent-dark.css +7 -1
- package/styles/fluent.css +7 -1
- package/styles/highcontrast-light.css +3 -1
- package/styles/highcontrast.css +3 -1
- package/styles/list-box/_bds-definition.scss +136 -0
- package/styles/list-box/icons/_bds.scss +25 -0
- package/styles/material-dark.css +11 -1
- package/styles/material.css +11 -1
- package/styles/material3-dark.css +2 -1
- package/styles/material3.css +2 -1
- package/styles/mention/_bds-definition.scss +1 -0
- package/styles/multi-select/_bds-definition.scss +235 -0
- package/styles/multi-select/_bootstrap-dark-definition.scss +4 -0
- package/styles/multi-select/_bootstrap-definition.scss +4 -0
- package/styles/multi-select/_fluent-definition.scss +5 -0
- package/styles/multi-select/_layout.scss +8 -1
- package/styles/multi-select/_material-dark-definition.scss +11 -0
- package/styles/multi-select/_material-definition.scss +11 -0
- package/styles/multi-select/bootstrap-dark.css +7 -1
- package/styles/multi-select/bootstrap.css +7 -1
- package/styles/multi-select/bootstrap4.css +2 -1
- package/styles/multi-select/bootstrap5-dark.css +2 -1
- package/styles/multi-select/bootstrap5.css +2 -1
- package/styles/multi-select/fabric-dark.css +3 -1
- package/styles/multi-select/fabric.css +3 -1
- package/styles/multi-select/fluent-dark.css +7 -1
- package/styles/multi-select/fluent.css +7 -1
- package/styles/multi-select/highcontrast-light.css +3 -1
- package/styles/multi-select/highcontrast.css +3 -1
- package/styles/multi-select/icons/_bds.scss +26 -0
- package/styles/multi-select/material-dark.css +11 -1
- package/styles/multi-select/material.css +11 -1
- package/styles/multi-select/material3-dark.css +2 -1
- package/styles/multi-select/material3.css +2 -1
- package/styles/multi-select/tailwind-dark.css +2 -1
- package/styles/multi-select/tailwind.css +2 -1
- package/styles/tailwind-dark.css +2 -1
- package/styles/tailwind.css +2 -1
|
@@ -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
|
|
|
@@ -331,7 +331,9 @@ class VirtualScroll {
|
|
|
331
331
|
generateAndExecuteQueryAsync(query, virtualItemStartIndex = 0, virtualItemEndIndex = 0, isQueryGenerated = false) {
|
|
332
332
|
let dataSource = this.parent.dataSource;
|
|
333
333
|
if (!isQueryGenerated) {
|
|
334
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
334
335
|
if (!isNullOrUndefined(this.parent.query)) {
|
|
336
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
335
337
|
var newQuery = this.removeSkipAndTakeEvents(this.parent.query.clone());
|
|
336
338
|
query = this.getPageQuery(newQuery, virtualItemStartIndex, virtualItemEndIndex);
|
|
337
339
|
}
|
|
@@ -346,6 +348,7 @@ class VirtualScroll {
|
|
|
346
348
|
totalData = this.parent.dataSource.dataSource.json.length;
|
|
347
349
|
}
|
|
348
350
|
else if (this.parent.dataSource && this.parent.dataSource.length > 0) {
|
|
351
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
349
352
|
totalData = this.parent.dataSource.length;
|
|
350
353
|
}
|
|
351
354
|
if (totalData > 0) {
|
|
@@ -362,22 +365,151 @@ class VirtualScroll {
|
|
|
362
365
|
});
|
|
363
366
|
return query;
|
|
364
367
|
}
|
|
365
|
-
setCurrentViewDataAsync() {
|
|
368
|
+
setCurrentViewDataAsync(component) {
|
|
366
369
|
// eslint-disable-next-line
|
|
367
370
|
let currentData = [];
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
371
|
+
let isResetListCalled = false;
|
|
372
|
+
let isListUpdated = true;
|
|
373
|
+
if (isNullOrUndefined(this.component)) {
|
|
374
|
+
this.component = component.component;
|
|
375
|
+
}
|
|
376
|
+
let endIndex = this.parent.viewPortInfo.endIndex;
|
|
377
|
+
if (this.component === 'multiselect' && this.parent.mode === 'CheckBox' && this.parent.value && Array.isArray(this.parent.value) && this.parent.value.length > 0 && this.parent.enableSelectionOrder) {
|
|
378
|
+
if (this.parent.viewPortInfo.startIndex < this.parent.value.length) {
|
|
379
|
+
endIndex = this.parent.viewPortInfo.endIndex - this.parent.value.length;
|
|
380
|
+
if (this.parent.viewPortInfo.startIndex === 0) {
|
|
381
|
+
this.parent.updateVirtualReOrderList(true);
|
|
382
|
+
if (this.parent.value.length < this.parent.itemCount) {
|
|
383
|
+
var oldUlElement = this.parent.list.querySelector('.e-list-parent' + ':not(.e-reorder)');
|
|
384
|
+
if (oldUlElement) {
|
|
385
|
+
this.parent.list.querySelector('.e-virtual-ddl-content').removeChild(oldUlElement);
|
|
386
|
+
}
|
|
387
|
+
var query = this.parent.getForQuery(this.parent.value).clone();
|
|
388
|
+
query = query.skip(0).take(this.parent.itemCount - (this.parent.value.length - this.parent.viewPortInfo.startIndex));
|
|
389
|
+
this.parent.appendUncheckList = true;
|
|
390
|
+
this.parent.resetList(this.parent.dataSource, this.parent.fields, query);
|
|
391
|
+
isListUpdated = false;
|
|
392
|
+
this.parent.appendUncheckList = false;
|
|
393
|
+
isListUpdated = false;
|
|
394
|
+
}
|
|
395
|
+
else {
|
|
396
|
+
var oldUlElement = this.parent.list.querySelector('.e-list-parent' + ':not(.e-reorder)');
|
|
397
|
+
if (oldUlElement) {
|
|
398
|
+
this.parent.list.querySelector('.e-virtual-ddl-content').removeChild(oldUlElement);
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
isListUpdated = false;
|
|
402
|
+
}
|
|
403
|
+
else if (this.parent.viewPortInfo.startIndex != 0) {
|
|
404
|
+
this.parent.updateVirtualReOrderList(true);
|
|
405
|
+
var oldUlElement = this.parent.list.querySelector('.e-list-parent' + ':not(.e-reorder)');
|
|
406
|
+
if (oldUlElement) {
|
|
407
|
+
this.parent.list.querySelector('.e-virtual-ddl-content').removeChild(oldUlElement);
|
|
408
|
+
}
|
|
409
|
+
isListUpdated = false;
|
|
410
|
+
}
|
|
411
|
+
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)) {
|
|
412
|
+
var query = this.parent.getForQuery(this.parent.value).clone();
|
|
413
|
+
query = query.skip(0).take(this.parent.itemCount - (this.parent.value.length - this.parent.viewPortInfo.startIndex));
|
|
414
|
+
this.parent.appendUncheckList = true;
|
|
415
|
+
this.parent.resetList(this.parent.dataSource, this.parent.fields, query);
|
|
416
|
+
isListUpdated = false;
|
|
417
|
+
this.parent.appendUncheckList = false;
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
else {
|
|
421
|
+
var reOrderList = this.parent.list.querySelectorAll('.e-reorder')[0];
|
|
422
|
+
if (this.parent.list.querySelector('.e-virtual-ddl-content') && reOrderList) {
|
|
423
|
+
this.parent.list.querySelector('.e-virtual-ddl-content').removeChild(reOrderList);
|
|
424
|
+
}
|
|
425
|
+
var query = this.parent.getForQuery(this.parent.value).clone();
|
|
426
|
+
if (!this.parent.allowFiltering) { //need to check with allowFiltering false
|
|
427
|
+
var skipvalue = this.parent.viewPortInfo.startIndex - this.parent.value.length >= 0 ? this.parent.viewPortInfo.startIndex - this.parent.value.length : 0;
|
|
428
|
+
query = query.skip(skipvalue);
|
|
429
|
+
}
|
|
430
|
+
this.parent.resetList(this.parent.dataSource, this.parent.fields, query);
|
|
431
|
+
isListUpdated = false;
|
|
432
|
+
}
|
|
433
|
+
this.parent.totalItemsCount();
|
|
434
|
+
}
|
|
435
|
+
if (isListUpdated) {
|
|
436
|
+
for (let i = this.parent.viewPortInfo.startIndex; i < endIndex; i++) {
|
|
437
|
+
var index = i;
|
|
438
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
439
|
+
const alreadyAddedData = this.parent.generatedDataObject[index];
|
|
440
|
+
if (this.component === 'multiselect' && this.parent.hideSelectedItem) {
|
|
441
|
+
if (alreadyAddedData) {
|
|
442
|
+
let value = getValue(this.parent.fields.value, alreadyAddedData[0]);
|
|
443
|
+
if (this.parent.value && value != null && Array.isArray(this.parent.value) && this.parent.value.length > 0 && this.parent.value.indexOf(value) < 0) {
|
|
444
|
+
var query = this.parent.getForQuery(this.parent.value).clone();
|
|
445
|
+
if (this.parent.viewPortInfo.endIndex == this.parent.totalItemCount + this.parent.value.length && this.parent.hideSelectedItem) {
|
|
446
|
+
query = query.skip(this.parent.totalItemCount - this.parent.itemCount);
|
|
447
|
+
}
|
|
448
|
+
else {
|
|
449
|
+
query = query.skip(this.parent.viewPortInfo.startIndex);
|
|
450
|
+
}
|
|
451
|
+
this.parent.resetList(this.parent.dataSource, this.parent.fields, query);
|
|
452
|
+
isResetListCalled = true;
|
|
453
|
+
break;
|
|
454
|
+
}
|
|
455
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
456
|
+
else if ((this.parent.value === null || (this.parent.value && this.parent.value.length === 0))) {
|
|
457
|
+
currentData.push(alreadyAddedData[0]);
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
if (index === endIndex - 1) {
|
|
461
|
+
if (currentData.length != this.parent.itemCount) {
|
|
462
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
463
|
+
if (this.parent.hideSelectedItem) {
|
|
464
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
465
|
+
var query = this.parent.getForQuery(this.parent.value).clone();
|
|
466
|
+
if (this.parent.viewPortInfo.endIndex == this.parent.totalItemCount + this.parent.value.length && this.parent.hideSelectedItem) {
|
|
467
|
+
query = query.skip(this.parent.totalItemCount - this.parent.itemCount);
|
|
468
|
+
}
|
|
469
|
+
else {
|
|
470
|
+
query = query.skip(this.parent.viewPortInfo.startIndex);
|
|
471
|
+
}
|
|
472
|
+
this.parent.resetList(this.parent.dataSource, this.parent.fields, query);
|
|
473
|
+
isResetListCalled = true;
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
else {
|
|
479
|
+
if (alreadyAddedData) {
|
|
480
|
+
currentData.push(alreadyAddedData[0]);
|
|
481
|
+
}
|
|
482
|
+
}
|
|
373
483
|
}
|
|
374
484
|
}
|
|
375
|
-
|
|
485
|
+
if (!isResetListCalled && isListUpdated) {
|
|
486
|
+
if (this.component === 'multiselect' && this.parent.allowCustomValue && this.parent.viewPortInfo.startIndex == 0 && this.parent.virtualCustomData) {
|
|
487
|
+
currentData.splice(0, 0, this.parent.virtualCustomData);
|
|
488
|
+
}
|
|
489
|
+
let totalData = [];
|
|
490
|
+
if (this.component === 'multiselect' && this.parent.allowCustomValue && this.parent.viewPortInfo.endIndex == this.parent.totalItemCount) {
|
|
491
|
+
if (this.parent.virtualCustomSelectData && this.parent.virtualCustomSelectData.length > 0) {
|
|
492
|
+
totalData = currentData.concat(this.parent.virtualCustomSelectData);
|
|
493
|
+
currentData = totalData;
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
let ulElement = this.parent.renderItems(currentData, this.parent.fields, this.component === 'multiselect' && this.parent.mode === 'CheckBox');
|
|
497
|
+
}
|
|
498
|
+
if (this.component === 'multiselect') {
|
|
499
|
+
this.parent.updatevirtualizationList();
|
|
500
|
+
}
|
|
501
|
+
this.parent.getSkeletonCount();
|
|
376
502
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
377
503
|
const virtualTrackElement = this.parent.list.getElementsByClassName('e-virtual-ddl')[0];
|
|
378
504
|
if (virtualTrackElement) {
|
|
379
505
|
(virtualTrackElement).style = this.parent.GetVirtualTrackHeight();
|
|
380
506
|
}
|
|
507
|
+
else if (!virtualTrackElement && this.parent.skeletonCount > 0 && this.parent.popupWrapper) {
|
|
508
|
+
var virualElement = this.parent.createElement('div', {
|
|
509
|
+
id: this.parent.element.id + '_popup', className: 'e-virtual-ddl', styles: this.parent.GetVirtualTrackHeight()
|
|
510
|
+
});
|
|
511
|
+
this.parent.popupWrapper.querySelector('.e-dropdownbase').appendChild(virualElement);
|
|
512
|
+
}
|
|
381
513
|
this.parent.UpdateSkeleton();
|
|
382
514
|
this.parent.liCollections = this.parent.list.querySelectorAll('.e-list-item');
|
|
383
515
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -388,13 +520,17 @@ class VirtualScroll {
|
|
|
388
520
|
if (this.parent.fields.groupBy) {
|
|
389
521
|
this.parent.scrollStop();
|
|
390
522
|
}
|
|
523
|
+
if (this.parent.keyCode == 40 && this.parent.isScrollChanged && this.parent.hideSelectedItem && !isNullOrUndefined(this.parent.currentFocuedListElement)) {
|
|
524
|
+
let currentSelectElem = this.parent.getElementByValue(this.parent.currentFocuedListElement.getAttribute('data-value'));
|
|
525
|
+
this.parent.addListFocus(currentSelectElem);
|
|
526
|
+
this.parent.isScrollChanged = false;
|
|
527
|
+
}
|
|
391
528
|
}
|
|
392
529
|
generateQueryAndSetQueryIndexAsync(query, isPopupOpen) {
|
|
393
530
|
let isStartIndexInitialised = false;
|
|
394
531
|
let queryStartIndex = 0;
|
|
395
532
|
let queryEndIndex = 0;
|
|
396
|
-
let
|
|
397
|
-
let vEndIndex = this.parent && this.parent.viewPortInfo.endIndex !== 0 ? this.parent.viewPortInfo.endIndex : sortedDataStartIndex + this.parent.getItems().length;
|
|
533
|
+
let vEndIndex = this.parent.viewPortInfo.endIndex;
|
|
398
534
|
if (!isPopupOpen && vEndIndex !== 0) {
|
|
399
535
|
for (let i = this.parent.viewPortInfo.startIndex; i <= vEndIndex; i++) {
|
|
400
536
|
if (!(i in this.parent.generatedDataObject)) {
|
|
@@ -412,6 +548,13 @@ class VirtualScroll {
|
|
|
412
548
|
this.parent.virtualItemStartIndex = queryStartIndex;
|
|
413
549
|
this.parent.virtualItemEndIndex = queryEndIndex;
|
|
414
550
|
this.generateAndExecuteQueryAsync(query, queryStartIndex, queryEndIndex);
|
|
551
|
+
if (this.component === 'multiselect' && this.parent.hideSelectedItem && this.parent.value && Array.isArray(this.parent.value) && this.parent.value.length > 0) {
|
|
552
|
+
this.parent.totalItemsCount();
|
|
553
|
+
}
|
|
554
|
+
if (this.component === 'multiselect' && this.parent.virtualItemStartIndex === this.parent.virtualItemEndIndex) {
|
|
555
|
+
this.parent.virtualItemStartIndex = this.parent.viewPortInfo.startIndex;
|
|
556
|
+
this.parent.virtualItemEndIndex = this.parent.viewPortInfo.endIndex;
|
|
557
|
+
}
|
|
415
558
|
}
|
|
416
559
|
this.setCurrentViewDataAsync();
|
|
417
560
|
}
|
|
@@ -448,7 +591,8 @@ class VirtualScroll {
|
|
|
448
591
|
});
|
|
449
592
|
}
|
|
450
593
|
scrollListener(scrollArgs) {
|
|
451
|
-
if (!this.parent.isPreventScrollAction) {
|
|
594
|
+
if (!this.parent.isPreventScrollAction && !this.parent.isVirtualTrackHeight) {
|
|
595
|
+
this.parent.preventSetCurrentData = false;
|
|
452
596
|
let info = scrollArgs.sentinel;
|
|
453
597
|
let pStartIndex = this.parent.previousStartIndex;
|
|
454
598
|
this.parent.viewPortInfo = this.getInfoFromView(scrollArgs.direction, info, scrollArgs.offset, false);
|
|
@@ -484,19 +628,6 @@ class VirtualScroll {
|
|
|
484
628
|
this.parent.previousInfo = this.parent.viewPortInfo;
|
|
485
629
|
}
|
|
486
630
|
}
|
|
487
|
-
getPageCount(popupElement, returnExactCount = false) {
|
|
488
|
-
var list = popupElement && popupElement.querySelector('.e-content');
|
|
489
|
-
if (list) {
|
|
490
|
-
var liHeight = list.classList.contains('e-nodata') ? null : getComputedStyle(list.querySelectorAll('.e-list-item')[0], null).getPropertyValue('height');
|
|
491
|
-
var pageCount = list.getBoundingClientRect().height / parseInt(liHeight, 10);
|
|
492
|
-
return returnExactCount ? pageCount : Math.round(pageCount);
|
|
493
|
-
}
|
|
494
|
-
return 0;
|
|
495
|
-
}
|
|
496
|
-
;
|
|
497
|
-
getRowHeight() {
|
|
498
|
-
return (isNullOrUndefined(this.parent.liCollections) || this.parent.liCollections.length == 0) ? 0 : Math.ceil(this.parent.liCollections[0].getBoundingClientRect().height);
|
|
499
|
-
}
|
|
500
631
|
getInfoFromView(direction, info, e, isscrollAction) {
|
|
501
632
|
let infoType = {
|
|
502
633
|
direction: direction, sentinelInfo: info, offsets: e,
|
|
@@ -532,7 +663,7 @@ class VirtualScroll {
|
|
|
532
663
|
let idxAddedToExactTop = (pageSizeBy4) > infoViewIndices ? pageSizeBy4 :
|
|
533
664
|
(infoViewIndices + infoViewIndices / 4);
|
|
534
665
|
let eIndex = Math.round(exactTopIndex + idxAddedToExactTop);
|
|
535
|
-
infoType.endIndex = eIndex < totalItemCount ? eIndex : totalItemCount;
|
|
666
|
+
infoType.endIndex = (eIndex < totalItemCount || this.component == "multiselect") ? eIndex : totalItemCount;
|
|
536
667
|
let sIndex = infoType.endIndex - this.parent.virtualItemCount;
|
|
537
668
|
infoType.startIndex = sIndex > 0 ? sIndex : 0;
|
|
538
669
|
infoType.endIndex = sIndex < 0 ? this.parent.virtualItemCount : infoType.endIndex;
|
|
@@ -566,7 +697,7 @@ class VirtualScroll {
|
|
|
566
697
|
top: top,
|
|
567
698
|
left: left
|
|
568
699
|
};
|
|
569
|
-
if (this.parent.list.querySelectorAll('.e-virtual-list').length > 0) {
|
|
700
|
+
if (this.parent.list && this.parent.list.querySelectorAll('.e-virtual-list').length > 0) {
|
|
570
701
|
var infoview = this.getInfoFromView(direction, current, scrollOffsetargs, true);
|
|
571
702
|
if (this.parent.scrollPreStartIndex != pstartIndex && !this.parent.isPreventScrollAction) {
|
|
572
703
|
this.parent.isScrollActionTriggered = true;
|
|
@@ -626,7 +757,8 @@ const dropDownBaseClasses = {
|
|
|
626
757
|
li: 'e-list-item',
|
|
627
758
|
group: 'e-list-group-item',
|
|
628
759
|
disabled: 'e-disabled',
|
|
629
|
-
grouping: 'e-dd-group'
|
|
760
|
+
grouping: 'e-dd-group',
|
|
761
|
+
virtualList: 'e-list-item e-virtual-list',
|
|
630
762
|
};
|
|
631
763
|
const ITEMTEMPLATE_PROPERTY = 'ItemTemplate';
|
|
632
764
|
const DISPLAYTEMPLATE_PROPERTY = 'DisplayTemplate';
|
|
@@ -659,13 +791,63 @@ let DropDownBase = class DropDownBase extends Component {
|
|
|
659
791
|
this.isAddNewItemTemplate = false;
|
|
660
792
|
this.isRequesting = false;
|
|
661
793
|
this.isVirtualizationEnabled = false;
|
|
794
|
+
this.isCustomDataUpdated = false;
|
|
662
795
|
this.isAllowFiltering = false;
|
|
663
796
|
this.virtualizedItemsCount = 0;
|
|
797
|
+
this.isCheckBoxSelection = false;
|
|
664
798
|
this.totalItemCount = 0;
|
|
665
799
|
this.dataCount = 0;
|
|
666
800
|
this.isRemoteDataUpdated = false;
|
|
667
801
|
this.isIncrementalRequest = false;
|
|
668
802
|
this.itemCount = 10;
|
|
803
|
+
this.virtualListHeight = 0;
|
|
804
|
+
this.isVirtualScrolling = false;
|
|
805
|
+
this.isPreventScrollAction = false;
|
|
806
|
+
this.scrollPreStartIndex = 0;
|
|
807
|
+
this.isScrollActionTriggered = false;
|
|
808
|
+
this.previousStartIndex = 0;
|
|
809
|
+
this.isMouseScrollAction = false;
|
|
810
|
+
this.isKeyBoardAction = false;
|
|
811
|
+
this.isScrollChanged = false;
|
|
812
|
+
this.isUpwardScrolling = false;
|
|
813
|
+
this.startIndex = 0;
|
|
814
|
+
this.currentPageNumber = 0;
|
|
815
|
+
this.pageCount = 0;
|
|
816
|
+
this.isPreventKeyAction = false;
|
|
817
|
+
this.generatedDataObject = {};
|
|
818
|
+
this.skeletonCount = 32;
|
|
819
|
+
this.isVirtualTrackHeight = false;
|
|
820
|
+
this.virtualSelectAll = false;
|
|
821
|
+
this.incrementalQueryString = '';
|
|
822
|
+
this.incrementalEndIndex = 0;
|
|
823
|
+
this.incrementalStartIndex = 0;
|
|
824
|
+
this.incrementalPreQueryString = '';
|
|
825
|
+
this.isObjectCustomValue = false;
|
|
826
|
+
this.appendUncheckList = false;
|
|
827
|
+
this.virtualListInfo = {
|
|
828
|
+
currentPageNumber: null,
|
|
829
|
+
direction: null,
|
|
830
|
+
sentinelInfo: {},
|
|
831
|
+
offsets: {},
|
|
832
|
+
startIndex: 0,
|
|
833
|
+
endIndex: 0,
|
|
834
|
+
};
|
|
835
|
+
this.viewPortInfo = {
|
|
836
|
+
currentPageNumber: null,
|
|
837
|
+
direction: null,
|
|
838
|
+
sentinelInfo: {},
|
|
839
|
+
offsets: {},
|
|
840
|
+
startIndex: 0,
|
|
841
|
+
endIndex: 0,
|
|
842
|
+
};
|
|
843
|
+
this.selectedValueInfo = {
|
|
844
|
+
currentPageNumber: null,
|
|
845
|
+
direction: null,
|
|
846
|
+
sentinelInfo: {},
|
|
847
|
+
offsets: {},
|
|
848
|
+
startIndex: 0,
|
|
849
|
+
endIndex: 0,
|
|
850
|
+
};
|
|
669
851
|
}
|
|
670
852
|
getPropObject(prop, newProp, oldProp) {
|
|
671
853
|
const newProperty = new Object();
|
|
@@ -876,6 +1058,124 @@ let DropDownBase = class DropDownBase extends Component {
|
|
|
876
1058
|
}
|
|
877
1059
|
}
|
|
878
1060
|
}
|
|
1061
|
+
checkAndResetCache() {
|
|
1062
|
+
if (this.isVirtualizationEnabled) {
|
|
1063
|
+
this.generatedDataObject = {};
|
|
1064
|
+
this.virtualItemStartIndex = this.virtualItemEndIndex = 0;
|
|
1065
|
+
this.viewPortInfo = {
|
|
1066
|
+
currentPageNumber: null,
|
|
1067
|
+
direction: null,
|
|
1068
|
+
sentinelInfo: {},
|
|
1069
|
+
offsets: {},
|
|
1070
|
+
startIndex: 0,
|
|
1071
|
+
endIndex: this.itemCount,
|
|
1072
|
+
};
|
|
1073
|
+
this.selectedValueInfo = null;
|
|
1074
|
+
}
|
|
1075
|
+
}
|
|
1076
|
+
updateIncrementalInfo(startIndex, endIndex) {
|
|
1077
|
+
this.viewPortInfo.startIndex = startIndex;
|
|
1078
|
+
this.viewPortInfo.endIndex = endIndex;
|
|
1079
|
+
this.updateVirtualItemIndex();
|
|
1080
|
+
this.isIncrementalRequest = true;
|
|
1081
|
+
this.resetList(this.dataSource, this.fields, this.query);
|
|
1082
|
+
this.isIncrementalRequest = false;
|
|
1083
|
+
}
|
|
1084
|
+
updateIncrementalView(startIndex, endIndex) {
|
|
1085
|
+
this.viewPortInfo.startIndex = startIndex;
|
|
1086
|
+
this.viewPortInfo.endIndex = endIndex;
|
|
1087
|
+
this.updateVirtualItemIndex();
|
|
1088
|
+
this.resetList(this.dataSource, this.fields, this.query);
|
|
1089
|
+
this.UpdateSkeleton();
|
|
1090
|
+
this.liCollections = this.list.querySelectorAll('.' + dropDownBaseClasses.li);
|
|
1091
|
+
this.ulElement = this.list.querySelector('ul');
|
|
1092
|
+
}
|
|
1093
|
+
updateVirtualItemIndex() {
|
|
1094
|
+
this.virtualItemStartIndex = this.viewPortInfo.startIndex;
|
|
1095
|
+
this.virtualItemEndIndex = this.viewPortInfo.endIndex;
|
|
1096
|
+
this.virtualListInfo = this.viewPortInfo;
|
|
1097
|
+
}
|
|
1098
|
+
getFilteringSkeletonCount() {
|
|
1099
|
+
const difference = this.dataCount - this.viewPortInfo.endIndex;
|
|
1100
|
+
const currentSkeletonCount = this.skeletonCount;
|
|
1101
|
+
this.getSkeletonCount(true);
|
|
1102
|
+
this.skeletonCount = this.dataCount > this.itemCount * 2 ? this.skeletonCount : difference > this.skeletonCount ? this.skeletonCount : difference > 0 ? difference : 0;
|
|
1103
|
+
let skeletonUpdated = true;
|
|
1104
|
+
if ((this.getModuleName() === 'autocomplete' || this.getModuleName() === 'multiselect') && (this.totalItemCount < (this.itemCount * 2))) {
|
|
1105
|
+
this.skeletonCount = 0;
|
|
1106
|
+
skeletonUpdated = false;
|
|
1107
|
+
}
|
|
1108
|
+
if (!this.list.classList.contains(dropDownBaseClasses.noData)) {
|
|
1109
|
+
const isSkeletonCountChange = currentSkeletonCount !== this.skeletonCount;
|
|
1110
|
+
if (currentSkeletonCount !== this.skeletonCount && skeletonUpdated) {
|
|
1111
|
+
this.UpdateSkeleton(true, Math.abs(currentSkeletonCount - this.skeletonCount));
|
|
1112
|
+
}
|
|
1113
|
+
else {
|
|
1114
|
+
this.UpdateSkeleton();
|
|
1115
|
+
}
|
|
1116
|
+
this.liCollections = this.list.querySelectorAll('.e-list-item');
|
|
1117
|
+
if ((this.list.getElementsByClassName('e-virtual-ddl').length > 0)) {
|
|
1118
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1119
|
+
this.list.getElementsByClassName('e-virtual-ddl')[0].style = this.GetVirtualTrackHeight();
|
|
1120
|
+
}
|
|
1121
|
+
else if (!this.list.querySelector('.e-virtual-ddl') && this.skeletonCount > 0 && this.list.querySelector('.e-dropdownbase')) {
|
|
1122
|
+
var virualElement = this.createElement('div', {
|
|
1123
|
+
id: this.element.id + '_popup', className: 'e-virtual-ddl', styles: this.GetVirtualTrackHeight()
|
|
1124
|
+
});
|
|
1125
|
+
this.list.querySelector('.e-dropdownbase').appendChild(virualElement);
|
|
1126
|
+
}
|
|
1127
|
+
if (this.list.getElementsByClassName('e-virtual-ddl-content').length > 0) {
|
|
1128
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1129
|
+
this.list.getElementsByClassName('e-virtual-ddl-content')[0].style = this.getTransformValues();
|
|
1130
|
+
}
|
|
1131
|
+
}
|
|
1132
|
+
}
|
|
1133
|
+
getSkeletonCount(retainSkeleton) {
|
|
1134
|
+
this.virtualListHeight = this.listContainerHeight != null ? parseInt(this.listContainerHeight, 10) : this.virtualListHeight;
|
|
1135
|
+
const actualCount = this.virtualListHeight > 0 ? Math.floor(this.virtualListHeight / this.listItemHeight) : 0;
|
|
1136
|
+
this.skeletonCount = actualCount * 2 < this.itemCount ? this.itemCount : actualCount * 2;
|
|
1137
|
+
this.itemCount = retainSkeleton ? this.itemCount : this.skeletonCount;
|
|
1138
|
+
this.skeletonCount = Math.floor(this.skeletonCount / 2) + 2;
|
|
1139
|
+
}
|
|
1140
|
+
GetVirtualTrackHeight() {
|
|
1141
|
+
let height = this.totalItemCount === this.viewPortInfo.endIndex ? this.totalItemCount * this.listItemHeight - this.itemCount * this.listItemHeight : this.totalItemCount * this.listItemHeight;
|
|
1142
|
+
height = this.isVirtualTrackHeight ? 0 : height;
|
|
1143
|
+
const heightDimension = `height: ${height - this.itemCount * this.listItemHeight}px;`;
|
|
1144
|
+
if ((this.getModuleName() === 'autocomplete' || this.getModuleName() === 'multiselect') && this.skeletonCount === 0) {
|
|
1145
|
+
return "height: 0px;";
|
|
1146
|
+
}
|
|
1147
|
+
return heightDimension;
|
|
1148
|
+
}
|
|
1149
|
+
getTransformValues() {
|
|
1150
|
+
let translateY = this.viewPortInfo.startIndex * this.listItemHeight;
|
|
1151
|
+
translateY = translateY - (this.skeletonCount * this.listItemHeight);
|
|
1152
|
+
translateY = this.viewPortInfo.startIndex === 0 && this.listData && this.listData.length === 0 ? 0 : translateY;
|
|
1153
|
+
const styleText = `transform: translate(0px, ${translateY}px);`;
|
|
1154
|
+
return styleText;
|
|
1155
|
+
}
|
|
1156
|
+
UpdateSkeleton(isSkeletonCountChange, skeletonCount) {
|
|
1157
|
+
let isContainSkeleton = this.list.querySelector('.e-virtual-ddl-content');
|
|
1158
|
+
let isContainVirtualList = this.list.querySelector('.e-virtual-list');
|
|
1159
|
+
if (isContainSkeleton && (!isContainVirtualList || isSkeletonCountChange) && this.isVirtualizationEnabled) {
|
|
1160
|
+
const totalSkeletonCount = isSkeletonCountChange ? skeletonCount : this.skeletonCount;
|
|
1161
|
+
for (let i = 0; i < totalSkeletonCount; i++) {
|
|
1162
|
+
const liElement = this.createElement('li', { className: dropDownBaseClasses.virtualList, styles: 'overflow: inherit' });
|
|
1163
|
+
if (this.isVirtualizationEnabled && this.itemTemplate) {
|
|
1164
|
+
liElement.style.height = this.listItemHeight + 'px';
|
|
1165
|
+
}
|
|
1166
|
+
let skeleton = new Skeleton({
|
|
1167
|
+
shape: "Text",
|
|
1168
|
+
height: "10px",
|
|
1169
|
+
width: "95%",
|
|
1170
|
+
cssClass: "e-skeleton-text",
|
|
1171
|
+
});
|
|
1172
|
+
skeleton.appendTo(this.createElement('div'));
|
|
1173
|
+
liElement.appendChild(skeleton.element);
|
|
1174
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1175
|
+
isContainSkeleton.firstChild && isContainSkeleton.firstChild.insertBefore(liElement, isContainSkeleton.firstChild.children[0]);
|
|
1176
|
+
}
|
|
1177
|
+
}
|
|
1178
|
+
}
|
|
879
1179
|
getLocaleName() {
|
|
880
1180
|
return 'drop-down-base';
|
|
881
1181
|
}
|
|
@@ -1122,31 +1422,52 @@ let DropDownBase = class DropDownBase extends Component {
|
|
|
1122
1422
|
}
|
|
1123
1423
|
else {
|
|
1124
1424
|
this.isRequesting = false;
|
|
1425
|
+
let isReOrder = true;
|
|
1125
1426
|
let listItems;
|
|
1126
1427
|
if (this.isVirtualizationEnabled && !this.virtualGroupDataSource && this.fields.groupBy) {
|
|
1127
1428
|
let data = new DataManager(this.dataSource).executeLocal(new Query().group(this.fields.groupBy));
|
|
1128
1429
|
this.virtualGroupDataSource = data.records;
|
|
1129
1430
|
}
|
|
1130
|
-
let dataManager = this.isVirtualizationEnabled && this.virtualGroupDataSource ? new DataManager(this.virtualGroupDataSource) : new DataManager(eventArgs.data);
|
|
1431
|
+
let dataManager = this.isVirtualizationEnabled && this.virtualGroupDataSource && !this.isCustomDataUpdated ? new DataManager(this.virtualGroupDataSource) : new DataManager(eventArgs.data);
|
|
1131
1432
|
listItems = (this.getQuery(eventArgs.query)).executeLocal(dataManager);
|
|
1132
|
-
if (this.
|
|
1433
|
+
if (!this.virtualSelectAll) {
|
|
1133
1434
|
let newQuery = this.getQuery(eventArgs.query);
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1435
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1436
|
+
if (this.isVirtualizationEnabled && (listItems.count != 0 && listItems.count < (this.itemCount * 2))) {
|
|
1437
|
+
if (newQuery) {
|
|
1438
|
+
for (let queryElements = 0; queryElements < newQuery.queries.length; queryElements++) {
|
|
1439
|
+
if (newQuery.queries[queryElements].fn === 'onTake') {
|
|
1440
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1441
|
+
newQuery.queries[queryElements].e.nos = listItems.count;
|
|
1442
|
+
listItems = (newQuery).executeLocal(dataManager);
|
|
1443
|
+
}
|
|
1444
|
+
if (this.getModuleName() === 'multiselect' && (newQuery.queries[queryElements].e.condition == 'or' || newQuery.queries[queryElements].e.operator == 'equal')) {
|
|
1445
|
+
isReOrder = false;
|
|
1446
|
+
}
|
|
1447
|
+
}
|
|
1448
|
+
if (isReOrder) {
|
|
1138
1449
|
listItems = (newQuery).executeLocal(dataManager);
|
|
1139
|
-
|
|
1450
|
+
this.isVirtualTrackHeight = true;
|
|
1451
|
+
}
|
|
1452
|
+
}
|
|
1453
|
+
}
|
|
1454
|
+
else {
|
|
1455
|
+
this.isVirtualTrackHeight = false;
|
|
1456
|
+
if (newQuery) {
|
|
1457
|
+
for (let queryElements = 0; queryElements < newQuery.queries.length; queryElements++) {
|
|
1458
|
+
if (this.getModuleName() === 'multiselect' && ((newQuery.queries[queryElements].e && newQuery.queries[queryElements].e.condition == 'or') || (newQuery.queries[queryElements].e && newQuery.queries[queryElements].e.operator == 'equal'))) {
|
|
1459
|
+
isReOrder = false;
|
|
1460
|
+
}
|
|
1140
1461
|
}
|
|
1141
1462
|
}
|
|
1142
1463
|
}
|
|
1143
1464
|
}
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1465
|
+
if (isReOrder) {
|
|
1466
|
+
// eslint-disable @typescript-eslint/no-explicit-any
|
|
1467
|
+
this.dataCount = this.totalItemCount = this.virtualSelectAll ? listItems.length : listItems.count;
|
|
1468
|
+
}
|
|
1469
|
+
listItems = this.isVirtualizationEnabled && !this.virtualSelectAll ? listItems.result : listItems;
|
|
1470
|
+
// eslint-enable @typescript-eslint/no-explicit-any
|
|
1150
1471
|
const localDataArgs = { cancel: false, result: listItems };
|
|
1151
1472
|
this.isPreventChange = this.isAngular && this.preventChange ? true : this.isPreventChange;
|
|
1152
1473
|
this.trigger('actionComplete', localDataArgs, (localDataArgs) => {
|
|
@@ -1193,6 +1514,13 @@ let DropDownBase = class DropDownBase extends Component {
|
|
|
1193
1514
|
this.raiseDataBound(listItems, e);
|
|
1194
1515
|
}
|
|
1195
1516
|
}
|
|
1517
|
+
isObjectInArray(objectToFind, array) {
|
|
1518
|
+
return array.some(item => {
|
|
1519
|
+
return Object.keys(objectToFind).every(key => {
|
|
1520
|
+
return item.hasOwnProperty(key) && item[key] === objectToFind[key];
|
|
1521
|
+
});
|
|
1522
|
+
});
|
|
1523
|
+
}
|
|
1196
1524
|
updateListValues() {
|
|
1197
1525
|
// Used this method in component side.
|
|
1198
1526
|
}
|
|
@@ -1233,6 +1561,7 @@ let DropDownBase = class DropDownBase extends Component {
|
|
|
1233
1561
|
const listItems = [];
|
|
1234
1562
|
this.onActionComplete(this.renderItems(listItems, fields), listItems);
|
|
1235
1563
|
this.isRequested = false;
|
|
1564
|
+
this.isRequesting = false;
|
|
1236
1565
|
this.hideSpinner();
|
|
1237
1566
|
}
|
|
1238
1567
|
showSpinner() {
|
|
@@ -1253,7 +1582,7 @@ let DropDownBase = class DropDownBase extends Component {
|
|
|
1253
1582
|
onActionComplete(ulElement, list, e) {
|
|
1254
1583
|
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
1255
1584
|
this.listData = list;
|
|
1256
|
-
if (this.isVirtualizationEnabled) {
|
|
1585
|
+
if (this.isVirtualizationEnabled && !this.isCustomDataUpdated) {
|
|
1257
1586
|
this.notify("setGeneratedData", {
|
|
1258
1587
|
module: "VirtualScroll",
|
|
1259
1588
|
});
|
|
@@ -1312,10 +1641,11 @@ let DropDownBase = class DropDownBase extends Component {
|
|
|
1312
1641
|
getQuery(query) {
|
|
1313
1642
|
return query ? query : this.query ? this.query : new Query();
|
|
1314
1643
|
}
|
|
1315
|
-
updateVirtualizationProperties(itemCount, filtering) {
|
|
1644
|
+
updateVirtualizationProperties(itemCount, filtering, isCheckbox) {
|
|
1316
1645
|
this.isVirtualizationEnabled = true;
|
|
1317
1646
|
this.virtualizedItemsCount = itemCount;
|
|
1318
1647
|
this.isAllowFiltering = filtering;
|
|
1648
|
+
this.isCheckBoxSelection = isCheckbox;
|
|
1319
1649
|
}
|
|
1320
1650
|
/**
|
|
1321
1651
|
* To render the template content for group header element.
|
|
@@ -1427,7 +1757,7 @@ let DropDownBase = class DropDownBase extends Component {
|
|
|
1427
1757
|
if (isCount) {
|
|
1428
1758
|
count++;
|
|
1429
1759
|
}
|
|
1430
|
-
if (this.updateGroupHeader(index, liCollections, target)) {
|
|
1760
|
+
if (this.fixedHeaderElement && this.updateGroupHeader(index, liCollections, target)) {
|
|
1431
1761
|
loadedGroupList++;
|
|
1432
1762
|
if (count >= this.getPageCount()) {
|
|
1433
1763
|
break;
|
|
@@ -1483,7 +1813,7 @@ let DropDownBase = class DropDownBase extends Component {
|
|
|
1483
1813
|
* @param {FieldSettingsModel} fields - Maps the columns of the data table and binds the data to the component.
|
|
1484
1814
|
* @returns {HTMLElement} Return the list items.
|
|
1485
1815
|
*/
|
|
1486
|
-
renderItems(listData, fields) {
|
|
1816
|
+
renderItems(listData, fields, isCheckBoxUpdate) {
|
|
1487
1817
|
let ulElement;
|
|
1488
1818
|
if (this.itemTemplate && listData) {
|
|
1489
1819
|
let dataSource = listData;
|
|
@@ -1506,6 +1836,10 @@ let DropDownBase = class DropDownBase extends Component {
|
|
|
1506
1836
|
var virtualUlElement = this.list.querySelector('.e-virtual-ddl-content');
|
|
1507
1837
|
if ((listData.length >= this.virtualizedItemsCount && oldUlElement && virtualUlElement) || (oldUlElement && virtualUlElement && this.isAllowFiltering) || (oldUlElement && virtualUlElement && this.getModuleName() === 'autocomplete')) {
|
|
1508
1838
|
virtualUlElement.replaceChild(ulElement, oldUlElement);
|
|
1839
|
+
let reOrderList = this.list.querySelectorAll('.e-reorder');
|
|
1840
|
+
if (this.list.querySelector('.e-virtual-ddl-content') && reOrderList && reOrderList.length > 0 && !isCheckBoxUpdate) {
|
|
1841
|
+
this.list.querySelector('.e-virtual-ddl-content').removeChild(reOrderList[0]);
|
|
1842
|
+
}
|
|
1509
1843
|
this.updateListElements(listData);
|
|
1510
1844
|
}
|
|
1511
1845
|
else if ((!virtualUlElement)) {
|
|
@@ -1517,6 +1851,10 @@ let DropDownBase = class DropDownBase extends Component {
|
|
|
1517
1851
|
}
|
|
1518
1852
|
}
|
|
1519
1853
|
else {
|
|
1854
|
+
if (this.getModuleName() === 'multiselect' && this.virtualSelectAll) {
|
|
1855
|
+
this.virtualSelectAllData = listData;
|
|
1856
|
+
listData = listData.slice(this.virtualItemStartIndex, this.virtualItemEndIndex);
|
|
1857
|
+
}
|
|
1520
1858
|
ulElement = this.createListItems(listData, fields);
|
|
1521
1859
|
if (this.isIncrementalRequest) {
|
|
1522
1860
|
this.incrementalLiCollections = ulElement.querySelectorAll('.' + dropDownBaseClasses.li);
|
|
@@ -1525,10 +1863,19 @@ let DropDownBase = class DropDownBase extends Component {
|
|
|
1525
1863
|
return ulElement;
|
|
1526
1864
|
}
|
|
1527
1865
|
if (this.isVirtualizationEnabled) {
|
|
1528
|
-
var oldUlElement = this.list.querySelector('.e-list-parent');
|
|
1866
|
+
var oldUlElement = this.list.querySelector('.e-list-parent' + ':not(.e-reorder)');
|
|
1529
1867
|
var virtualUlElement = this.list.querySelector('.e-virtual-ddl-content');
|
|
1530
|
-
|
|
1531
|
-
|
|
1868
|
+
var isRemovedUlelement = false;
|
|
1869
|
+
if (!oldUlElement && this.list.querySelector('.e-list-parent' + '.e-reorder')) {
|
|
1870
|
+
oldUlElement = this.list.querySelector('.e-list-parent' + '.e-reorder');
|
|
1871
|
+
}
|
|
1872
|
+
if ((listData.length >= this.virtualizedItemsCount && oldUlElement && virtualUlElement) || (oldUlElement && virtualUlElement && this.isAllowFiltering) || (oldUlElement && virtualUlElement && (this.getModuleName() === 'autocomplete' || this.getModuleName() === 'multiselect')) || isRemovedUlelement) {
|
|
1873
|
+
if (!this.appendUncheckList) {
|
|
1874
|
+
virtualUlElement.replaceChild(ulElement, oldUlElement);
|
|
1875
|
+
}
|
|
1876
|
+
else {
|
|
1877
|
+
virtualUlElement.appendChild(ulElement);
|
|
1878
|
+
}
|
|
1532
1879
|
this.updateListElements(listData);
|
|
1533
1880
|
}
|
|
1534
1881
|
else if ((!virtualUlElement)) {
|
|
@@ -1721,11 +2068,11 @@ let DropDownBase = class DropDownBase extends Component {
|
|
|
1721
2068
|
this.render();
|
|
1722
2069
|
}
|
|
1723
2070
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
1724
|
-
updateDataSource(props) {
|
|
2071
|
+
updateDataSource(props, oldProps) {
|
|
1725
2072
|
this.resetList(this.dataSource);
|
|
1726
2073
|
this.totalItemCount = this.dataSource instanceof DataManager ? this.dataSource.dataSource.json.length : 0;
|
|
1727
2074
|
}
|
|
1728
|
-
setUpdateInitial(props, newProp) {
|
|
2075
|
+
setUpdateInitial(props, newProp, oldProp) {
|
|
1729
2076
|
this.isDataFetched = false;
|
|
1730
2077
|
const updateData = {};
|
|
1731
2078
|
for (let j = 0; props.length > j; j++) {
|
|
@@ -1741,7 +2088,7 @@ let DropDownBase = class DropDownBase extends Component {
|
|
|
1741
2088
|
if (Object.keys(updateData).indexOf('dataSource') === -1) {
|
|
1742
2089
|
updateData.dataSource = this.dataSource;
|
|
1743
2090
|
}
|
|
1744
|
-
this.updateDataSource(updateData);
|
|
2091
|
+
this.updateDataSource(updateData, oldProp);
|
|
1745
2092
|
}
|
|
1746
2093
|
}
|
|
1747
2094
|
/**
|
|
@@ -2191,55 +2538,12 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
2191
2538
|
*/
|
|
2192
2539
|
constructor(options, element) {
|
|
2193
2540
|
super(options, element);
|
|
2194
|
-
this.skeletonCount = 32;
|
|
2195
2541
|
this.isListSearched = false;
|
|
2196
2542
|
this.preventChange = false;
|
|
2197
2543
|
this.isAngular = false;
|
|
2198
|
-
this.virtualListHeight = 0;
|
|
2199
|
-
this.isVirtualScrolling = false;
|
|
2200
|
-
this.isPreventScrollAction = false;
|
|
2201
|
-
this.scrollPreStartIndex = 0;
|
|
2202
|
-
this.isScrollActionTriggered = false;
|
|
2203
|
-
this.previousStartIndex = 0;
|
|
2204
|
-
this.isMouseScrollAction = false;
|
|
2205
|
-
this.isKeyBoardAction = false;
|
|
2206
|
-
this.isUpwardScrolling = false;
|
|
2207
|
-
this.startIndex = 0;
|
|
2208
|
-
this.currentPageNumber = 0;
|
|
2209
|
-
this.pageCount = 0;
|
|
2210
|
-
this.isPreventKeyAction = false;
|
|
2211
|
-
this.generatedDataObject = {};
|
|
2212
|
-
this.incrementalQueryString = '';
|
|
2213
|
-
this.incrementalEndIndex = 0;
|
|
2214
|
-
this.incrementalStartIndex = 0;
|
|
2215
|
-
this.incrementalPreQueryString = '';
|
|
2216
2544
|
this.isTouched = false;
|
|
2217
|
-
this.
|
|
2218
|
-
|
|
2219
|
-
direction: null,
|
|
2220
|
-
sentinelInfo: {},
|
|
2221
|
-
offsets: {},
|
|
2222
|
-
startIndex: 0,
|
|
2223
|
-
endIndex: 0,
|
|
2224
|
-
};
|
|
2225
|
-
this.viewPortInfo = {
|
|
2226
|
-
currentPageNumber: null,
|
|
2227
|
-
direction: null,
|
|
2228
|
-
sentinelInfo: {},
|
|
2229
|
-
offsets: {},
|
|
2230
|
-
startIndex: 0,
|
|
2231
|
-
endIndex: 0,
|
|
2232
|
-
};
|
|
2233
|
-
this.selectedValueInfo = {
|
|
2234
|
-
currentPageNumber: null,
|
|
2235
|
-
direction: null,
|
|
2236
|
-
sentinelInfo: {},
|
|
2237
|
-
offsets: {},
|
|
2238
|
-
startIndex: 0,
|
|
2239
|
-
endIndex: 0,
|
|
2240
|
-
};
|
|
2241
|
-
this.IsScrollerAtEnd = function () {
|
|
2242
|
-
return this.list && this.list.scrollTop + this.list.clientHeight >= this.list.scrollHeight;
|
|
2545
|
+
this.IsScrollerAtEnd = function () {
|
|
2546
|
+
return this.list && this.list.scrollTop + this.list.clientHeight >= this.list.scrollHeight;
|
|
2243
2547
|
};
|
|
2244
2548
|
}
|
|
2245
2549
|
/**
|
|
@@ -2325,6 +2629,11 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
2325
2629
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2326
2630
|
this.totalItemCount = this.dataSource && this.dataSource.length ? this.dataSource.length : 0;
|
|
2327
2631
|
}
|
|
2632
|
+
if (this.enableVirtualization && this.isFiltering() && this.getModuleName() === 'combobox') {
|
|
2633
|
+
this.UpdateSkeleton();
|
|
2634
|
+
this.liCollections = this.list.querySelectorAll('.' + dropDownBaseClasses.li);
|
|
2635
|
+
this.ulElement = this.list.querySelector('ul');
|
|
2636
|
+
}
|
|
2328
2637
|
this.unWireListEvents();
|
|
2329
2638
|
this.wireListEvents();
|
|
2330
2639
|
}
|
|
@@ -2372,8 +2681,8 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
2372
2681
|
this.isActive = true;
|
|
2373
2682
|
this.resetSelection(properties);
|
|
2374
2683
|
}
|
|
2375
|
-
|
|
2376
|
-
if (this.previousValue === dataItem.value) {
|
|
2684
|
+
let dataItem = this.getItemData();
|
|
2685
|
+
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]))) {
|
|
2377
2686
|
return;
|
|
2378
2687
|
}
|
|
2379
2688
|
this.onChangeEvent(e);
|
|
@@ -2561,7 +2870,8 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
2561
2870
|
updateValues() {
|
|
2562
2871
|
this.selectedValueInfo = this.viewPortInfo;
|
|
2563
2872
|
if (!isNullOrUndefined(this.value)) {
|
|
2564
|
-
this.
|
|
2873
|
+
const value = this.allowObjectBinding && !isNullOrUndefined(this.value) ? getValue(((this.fields.value) ? this.fields.value : ''), this.value) : this.value;
|
|
2874
|
+
this.setSelection(this.getElementByValue(value), null);
|
|
2565
2875
|
}
|
|
2566
2876
|
else if (this.text && isNullOrUndefined(this.value)) {
|
|
2567
2877
|
const element = this.getElementByText(this.text);
|
|
@@ -2786,23 +3096,6 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
2786
3096
|
isValidLI(li) {
|
|
2787
3097
|
return (li && li.hasAttribute('role') && li.getAttribute('role') === 'option');
|
|
2788
3098
|
}
|
|
2789
|
-
updateIncrementalInfo(startIndex, endIndex) {
|
|
2790
|
-
this.viewPortInfo.startIndex = startIndex;
|
|
2791
|
-
this.viewPortInfo.endIndex = endIndex;
|
|
2792
|
-
this.updateVirtualItemIndex();
|
|
2793
|
-
this.isIncrementalRequest = true;
|
|
2794
|
-
this.resetList(this.dataSource, this.fields, this.query);
|
|
2795
|
-
this.isIncrementalRequest = false;
|
|
2796
|
-
}
|
|
2797
|
-
updateIncrementalView(startIndex, endIndex) {
|
|
2798
|
-
this.viewPortInfo.startIndex = startIndex;
|
|
2799
|
-
this.viewPortInfo.endIndex = endIndex;
|
|
2800
|
-
this.updateVirtualItemIndex();
|
|
2801
|
-
this.resetList(this.dataSource, this.fields, this.query);
|
|
2802
|
-
this.UpdateSkeleton();
|
|
2803
|
-
this.liCollections = this.list.querySelectorAll('.' + dropDownBaseClasses.li);
|
|
2804
|
-
this.ulElement = this.list.querySelector('ul');
|
|
2805
|
-
}
|
|
2806
3099
|
updateIncrementalItemIndex(startIndex, endIndex) {
|
|
2807
3100
|
this.incrementalStartIndex = startIndex;
|
|
2808
3101
|
this.incrementalEndIndex = endIndex;
|
|
@@ -2970,10 +3263,12 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
2970
3263
|
const isTabAction = e.action === 'tab' || e.action === 'close';
|
|
2971
3264
|
if (isNullOrUndefined(this.list) && !this.isRequested && !isTabAction && e.action !== 'escape') {
|
|
2972
3265
|
this.searchKeyEvent = e;
|
|
2973
|
-
this.
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
3266
|
+
if (!this.enableVirtualization || (this.enableVirtualization && this.getModuleName() !== 'autocomplete' && e.type !== 'mousedown' && (e.keyCode === 40 || e.keyCode === 38))) {
|
|
3267
|
+
this.renderList(e);
|
|
3268
|
+
this.UpdateSkeleton();
|
|
3269
|
+
this.liCollections = this.list.querySelectorAll('.' + dropDownBaseClasses.li);
|
|
3270
|
+
this.ulElement = this.list.querySelector('ul');
|
|
3271
|
+
}
|
|
2977
3272
|
}
|
|
2978
3273
|
if (isNullOrUndefined(this.list) || (!isNullOrUndefined(this.liCollections) &&
|
|
2979
3274
|
isNavigation && this.liCollections.length === 0) || this.isRequested) {
|
|
@@ -3132,7 +3427,7 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
3132
3427
|
this.activeIndex = filterIndex;
|
|
3133
3428
|
}
|
|
3134
3429
|
}
|
|
3135
|
-
if (this.allowFiltering && this.getModuleName() === 'dropdownlist') {
|
|
3430
|
+
if (this.allowFiltering && this.getModuleName() === 'dropdownlist' && this.filterInput) {
|
|
3136
3431
|
if (!isNullOrUndefined(this.ulElement) && !isNullOrUndefined(this.ulElement.getElementsByClassName('e-item-focus')[0])) {
|
|
3137
3432
|
attributes(this.filterInput, { 'aria-activedescendant': this.ulElement.getElementsByClassName('e-item-focus')[0].id });
|
|
3138
3433
|
}
|
|
@@ -3142,11 +3437,6 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
3142
3437
|
}
|
|
3143
3438
|
e.preventDefault();
|
|
3144
3439
|
}
|
|
3145
|
-
updateVirtualItemIndex() {
|
|
3146
|
-
this.virtualItemStartIndex = this.viewPortInfo.startIndex;
|
|
3147
|
-
this.virtualItemEndIndex = this.viewPortInfo.endIndex;
|
|
3148
|
-
this.virtualListInfo = this.viewPortInfo;
|
|
3149
|
-
}
|
|
3150
3440
|
updateHomeEndAction(e, isVirtualKeyAction) {
|
|
3151
3441
|
if (this.getModuleName() === 'dropdownlist') {
|
|
3152
3442
|
let findLi = 0;
|
|
@@ -3295,6 +3585,10 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
3295
3585
|
pageDownSelection(steps, event, isVirtualKeyAction) {
|
|
3296
3586
|
const list = this.getItems();
|
|
3297
3587
|
let previousItem = steps <= list.length ? this.liCollections[steps - 1] : this.liCollections[list.length - 1];
|
|
3588
|
+
if (this.enableVirtualization && this.skeletonCount > 0) {
|
|
3589
|
+
steps = this.getModuleName() === 'dropdownlist' && this.allowFiltering ? steps + 1 : steps;
|
|
3590
|
+
previousItem = steps < list.length ? this.liCollections[steps] : this.liCollections[list.length - 1];
|
|
3591
|
+
}
|
|
3298
3592
|
if ((this.enableVirtualization && this.activeIndex == null) || isVirtualKeyAction) {
|
|
3299
3593
|
previousItem = steps <= list.length ? this.liCollections[steps + this.skeletonCount - 1] : this.liCollections[list.length - 1];
|
|
3300
3594
|
}
|
|
@@ -3458,7 +3752,7 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
3458
3752
|
selectEventCallback(li, e, preventSelect, selectedData, value) {
|
|
3459
3753
|
this.previousItemData = (!isNullOrUndefined(this.itemData)) ? this.itemData : null;
|
|
3460
3754
|
if (this.itemData != selectedData) {
|
|
3461
|
-
this.previousValue = (!isNullOrUndefined(this.itemData)) ? typeof this.itemData == "object" ? this.checkFieldValue(this.itemData, this.fields.value.split('.')) : this.itemData : null;
|
|
3755
|
+
this.previousValue = (!isNullOrUndefined(this.itemData)) ? typeof this.itemData == "object" && !this.allowObjectBinding ? this.checkFieldValue(this.itemData, this.fields.value.split('.')) : this.itemData : null;
|
|
3462
3756
|
}
|
|
3463
3757
|
this.item = li;
|
|
3464
3758
|
this.itemData = selectedData;
|
|
@@ -3516,7 +3810,7 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
3516
3810
|
if (this.isFiltering() && clearElement) {
|
|
3517
3811
|
clearElement.style.removeProperty('visibility');
|
|
3518
3812
|
}
|
|
3519
|
-
if (this.previousValue === dataItem.value) {
|
|
3813
|
+
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])))) {
|
|
3520
3814
|
this.isSelected = false;
|
|
3521
3815
|
return true;
|
|
3522
3816
|
}
|
|
@@ -3536,25 +3830,28 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
3536
3830
|
}
|
|
3537
3831
|
else {
|
|
3538
3832
|
this.setSelectOptions(li, e);
|
|
3539
|
-
if (this.enableVirtualization) {
|
|
3833
|
+
if (this.enableVirtualization && this.value) {
|
|
3540
3834
|
const fields = (this.fields.value) ? this.fields.value : '';
|
|
3835
|
+
let currentValue = this.allowObjectBinding && !isNullOrUndefined(this.value) ? getValue((this.fields.value) ? this.fields.value : '', this.value) : this.value;
|
|
3541
3836
|
if (this.dataSource instanceof DataManager && this.virtualGroupDataSource) {
|
|
3542
|
-
const getItem = new DataManager(this.virtualGroupDataSource).executeLocal(new Query().where(new Predicate(fields, 'equal',
|
|
3837
|
+
const getItem = new DataManager(this.virtualGroupDataSource).executeLocal(new Query().where(new Predicate(fields, 'equal', currentValue)));
|
|
3543
3838
|
if (getItem && getItem.length > 0) {
|
|
3544
3839
|
this.itemData = getItem[0];
|
|
3545
3840
|
const dataItem = this.getItemData();
|
|
3841
|
+
let value = this.allowObjectBinding ? this.getDataByValue(dataItem.value) : dataItem.value;
|
|
3546
3842
|
if ((this.value === dataItem.value && this.text !== dataItem.text) || (this.value !== dataItem.value && this.text === dataItem.text)) {
|
|
3547
|
-
this.setProperties({ 'text': dataItem.text, 'value':
|
|
3843
|
+
this.setProperties({ 'text': dataItem.text, 'value': value });
|
|
3548
3844
|
}
|
|
3549
3845
|
}
|
|
3550
3846
|
}
|
|
3551
3847
|
else {
|
|
3552
|
-
const getItem = new DataManager(this.dataSource).executeLocal(new Query().where(new Predicate(fields, 'equal',
|
|
3848
|
+
const getItem = new DataManager(this.dataSource).executeLocal(new Query().where(new Predicate(fields, 'equal', currentValue)));
|
|
3553
3849
|
if (getItem && getItem.length > 0) {
|
|
3554
3850
|
this.itemData = getItem[0];
|
|
3555
3851
|
const dataItem = this.getItemData();
|
|
3852
|
+
let value = this.allowObjectBinding ? this.getDataByValue(dataItem.value) : dataItem.value;
|
|
3556
3853
|
if ((this.value === dataItem.value && this.text !== dataItem.text) || (this.value !== dataItem.value && this.text === dataItem.text)) {
|
|
3557
|
-
this.setProperties({ 'text': dataItem.text, 'value':
|
|
3854
|
+
this.setProperties({ 'text': dataItem.text, 'value': value });
|
|
3558
3855
|
}
|
|
3559
3856
|
}
|
|
3560
3857
|
}
|
|
@@ -3668,10 +3965,20 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
3668
3965
|
* @param {MouseEvent | KeyboardEvent | TouchEvent} eve - Specifies the event arguments.
|
|
3669
3966
|
* @returns {void}
|
|
3670
3967
|
*/
|
|
3671
|
-
onChangeEvent(eve) {
|
|
3968
|
+
onChangeEvent(eve, isCustomValue) {
|
|
3672
3969
|
const dataItem = this.getItemData();
|
|
3673
|
-
|
|
3674
|
-
this.
|
|
3970
|
+
let index = this.isSelectCustom ? null : this.activeIndex;
|
|
3971
|
+
if (this.enableVirtualization) {
|
|
3972
|
+
let datas = this.dataSource instanceof DataManager ? this.virtualGroupDataSource : this.dataSource;
|
|
3973
|
+
if (dataItem.value && datas && datas.length > 0) {
|
|
3974
|
+
const foundIndex = datas.findIndex((data) => !isNullOrUndefined(dataItem.value) && getValue(this.fields.value, data) === dataItem.value);
|
|
3975
|
+
if (foundIndex !== -1) {
|
|
3976
|
+
index = foundIndex;
|
|
3977
|
+
}
|
|
3978
|
+
}
|
|
3979
|
+
}
|
|
3980
|
+
let value = this.allowObjectBinding ? isCustomValue ? this.value : this.getDataByValue(dataItem.value) : dataItem.value;
|
|
3981
|
+
this.setProperties({ 'index': index, 'text': dataItem.text, 'value': value }, true);
|
|
3675
3982
|
this.detachChangeEvent(eve);
|
|
3676
3983
|
}
|
|
3677
3984
|
detachChanges(value) {
|
|
@@ -3698,7 +4005,7 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
3698
4005
|
detachChangeEvent(eve) {
|
|
3699
4006
|
this.isSelected = false;
|
|
3700
4007
|
this.previousValue = this.value;
|
|
3701
|
-
this.activeIndex = this.index;
|
|
4008
|
+
this.activeIndex = this.enableVirtualization ? this.getIndexByValue(this.value) : this.index;
|
|
3702
4009
|
this.typedString = !isNullOrUndefined(this.text) ? this.text : '';
|
|
3703
4010
|
if (!this.initial) {
|
|
3704
4011
|
const items = this.detachChanges(this.itemData);
|
|
@@ -3745,16 +4052,17 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
3745
4052
|
}
|
|
3746
4053
|
setHiddenValue() {
|
|
3747
4054
|
if (!isNullOrUndefined(this.value)) {
|
|
4055
|
+
let value = this.allowObjectBinding && !isNullOrUndefined(this.value) ? getValue((this.fields.value) ? this.fields.value : '', this.value) : this.value;
|
|
3748
4056
|
if (this.hiddenElement.querySelector('option')) {
|
|
3749
4057
|
const selectedElement = this.hiddenElement.querySelector('option');
|
|
3750
4058
|
selectedElement.textContent = this.text;
|
|
3751
|
-
selectedElement.setAttribute('value',
|
|
4059
|
+
selectedElement.setAttribute('value', value.toString());
|
|
3752
4060
|
}
|
|
3753
4061
|
else {
|
|
3754
4062
|
if (!isNullOrUndefined(this.hiddenElement)) {
|
|
3755
4063
|
this.hiddenElement.innerHTML = '<option selected>' + this.text + '</option>';
|
|
3756
4064
|
const selectedElement = this.hiddenElement.querySelector('option');
|
|
3757
|
-
selectedElement.setAttribute('value',
|
|
4065
|
+
selectedElement.setAttribute('value', value.toString());
|
|
3758
4066
|
}
|
|
3759
4067
|
}
|
|
3760
4068
|
}
|
|
@@ -3771,6 +4079,7 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
3771
4079
|
onFilterUp(e) {
|
|
3772
4080
|
if (!(e.ctrlKey && e.keyCode === 86) && (this.isValidKey || e.keyCode === 40 || e.keyCode === 38)) {
|
|
3773
4081
|
this.isValidKey = false;
|
|
4082
|
+
this.firstItem = this.dataSource && this.dataSource.length > 0 ? this.dataSource[0] : null;
|
|
3774
4083
|
switch (e.keyCode) {
|
|
3775
4084
|
case 38: //up arrow
|
|
3776
4085
|
case 40: //down arrow
|
|
@@ -3827,42 +4136,6 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
3827
4136
|
this.isValidKey = false;
|
|
3828
4137
|
}
|
|
3829
4138
|
}
|
|
3830
|
-
getFilteringSkeletonCount() {
|
|
3831
|
-
const difference = this.dataCount - this.viewPortInfo.endIndex;
|
|
3832
|
-
const currentSkeletonCount = this.skeletonCount;
|
|
3833
|
-
this.getSkeletonCount(true);
|
|
3834
|
-
this.skeletonCount = this.dataCount > this.itemCount * 2 ? this.skeletonCount : difference > this.skeletonCount ? this.skeletonCount : difference > 0 ? difference : 0;
|
|
3835
|
-
let skeletonUpdated = true;
|
|
3836
|
-
if (this.getModuleName() === 'autocomplete' && (this.totalItemCount != 0 && this.totalItemCount < (this.itemCount * 2))) {
|
|
3837
|
-
this.skeletonCount = 0;
|
|
3838
|
-
skeletonUpdated = false;
|
|
3839
|
-
}
|
|
3840
|
-
if (!this.list.classList.contains(dropDownBaseClasses.noData)) {
|
|
3841
|
-
const isSkeletonCountChange = currentSkeletonCount !== this.skeletonCount;
|
|
3842
|
-
if (currentSkeletonCount !== this.skeletonCount && skeletonUpdated) {
|
|
3843
|
-
this.UpdateSkeleton(true, Math.abs(currentSkeletonCount - this.skeletonCount));
|
|
3844
|
-
}
|
|
3845
|
-
else {
|
|
3846
|
-
this.UpdateSkeleton();
|
|
3847
|
-
}
|
|
3848
|
-
this.liCollections = this.list.querySelectorAll('.e-list-item');
|
|
3849
|
-
if ((this.list.getElementsByClassName('e-virtual-ddl').length > 0)) {
|
|
3850
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3851
|
-
this.list.getElementsByClassName('e-virtual-ddl')[0].style = this.GetVirtualTrackHeight();
|
|
3852
|
-
}
|
|
3853
|
-
if (this.list.getElementsByClassName('e-virtual-ddl-content').length > 0) {
|
|
3854
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3855
|
-
this.list.getElementsByClassName('e-virtual-ddl-content')[0].style = this.getTransformValues();
|
|
3856
|
-
}
|
|
3857
|
-
}
|
|
3858
|
-
}
|
|
3859
|
-
getSkeletonCount(retainSkeleton) {
|
|
3860
|
-
this.virtualListHeight = this.listHeight != null ? parseInt(this.listHeight, 10) : this.virtualListHeight;
|
|
3861
|
-
const actualCount = this.virtualListHeight > 0 ? Math.floor(this.virtualListHeight / this.listItemHeight) : 0;
|
|
3862
|
-
this.skeletonCount = actualCount * 2 < this.itemCount ? this.itemCount : actualCount * 2;
|
|
3863
|
-
this.itemCount = retainSkeleton ? this.itemCount : this.skeletonCount;
|
|
3864
|
-
this.skeletonCount = Math.floor(this.skeletonCount / 2) + 2;
|
|
3865
|
-
}
|
|
3866
4139
|
onFilterDown(e) {
|
|
3867
4140
|
switch (e.keyCode) {
|
|
3868
4141
|
case 13: //enter
|
|
@@ -3917,14 +4190,51 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
3917
4190
|
}
|
|
3918
4191
|
}
|
|
3919
4192
|
}
|
|
3920
|
-
|
|
3921
|
-
|
|
4193
|
+
let queryTakeValue = 0;
|
|
4194
|
+
let querySkipValue = 0;
|
|
4195
|
+
if (this.query && this.query.queries.length > 0) {
|
|
4196
|
+
for (let queryElements = 0; queryElements < this.query.queries.length; queryElements++) {
|
|
4197
|
+
if (this.query.queries[queryElements].fn === 'onSkip') {
|
|
4198
|
+
querySkipValue = this.query.queries[queryElements].e.nos;
|
|
4199
|
+
}
|
|
4200
|
+
if (this.query.queries[queryElements].fn === 'onTake') {
|
|
4201
|
+
queryTakeValue = takeValue <= this.query.queries[queryElements].e.nos ? this.query.queries[queryElements].e.nos : takeValue;
|
|
4202
|
+
}
|
|
4203
|
+
}
|
|
4204
|
+
}
|
|
4205
|
+
let skipExists = false;
|
|
4206
|
+
let takeExists = false;
|
|
4207
|
+
if (filterQuery && filterQuery.queries.length > 0) {
|
|
4208
|
+
for (let queryElements = 0; queryElements < filterQuery.queries.length; queryElements++) {
|
|
4209
|
+
if (filterQuery.queries[queryElements].fn === 'onSkip') {
|
|
4210
|
+
skipExists = true;
|
|
4211
|
+
}
|
|
4212
|
+
if (filterQuery.queries[queryElements].fn === 'onTake') {
|
|
4213
|
+
takeExists = true;
|
|
4214
|
+
filterQuery.queries[queryElements].e.nos = filterQuery.queries[queryElements].e.nos <= queryTakeValue ? queryTakeValue : filterQuery.queries[queryElements].e.nos;
|
|
4215
|
+
}
|
|
4216
|
+
}
|
|
4217
|
+
}
|
|
4218
|
+
if (!skipExists && (this.allowFiltering || !this.isPopupOpen || !alreadySkipAdded)) {
|
|
4219
|
+
if (querySkipValue > 0) {
|
|
4220
|
+
filterQuery.skip(querySkipValue);
|
|
4221
|
+
}
|
|
4222
|
+
else {
|
|
4223
|
+
filterQuery.skip(this.virtualItemStartIndex);
|
|
4224
|
+
}
|
|
3922
4225
|
}
|
|
3923
4226
|
if (this.isIncrementalRequest) {
|
|
3924
4227
|
filterQuery.take(this.incrementalEndIndex);
|
|
3925
4228
|
}
|
|
3926
4229
|
else {
|
|
3927
|
-
|
|
4230
|
+
if (!takeExists) {
|
|
4231
|
+
if (queryTakeValue > 0) {
|
|
4232
|
+
filterQuery.take(queryTakeValue);
|
|
4233
|
+
}
|
|
4234
|
+
else {
|
|
4235
|
+
filterQuery.take(takeValue);
|
|
4236
|
+
}
|
|
4237
|
+
}
|
|
3928
4238
|
}
|
|
3929
4239
|
filterQuery.requiresCount();
|
|
3930
4240
|
}
|
|
@@ -4143,29 +4453,6 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
4143
4453
|
this.renderPopup();
|
|
4144
4454
|
}
|
|
4145
4455
|
}
|
|
4146
|
-
UpdateSkeleton(isSkeletonCountChange, skeletonCount) {
|
|
4147
|
-
let isContainSkeleton = this.list.querySelector('.e-virtual-ddl-content');
|
|
4148
|
-
let isContainVirtualList = this.list.querySelector('.e-virtual-list');
|
|
4149
|
-
if (isContainSkeleton && (!isContainVirtualList || isSkeletonCountChange) && this.enableVirtualization) {
|
|
4150
|
-
const totalSkeletonCount = isSkeletonCountChange ? skeletonCount : this.skeletonCount;
|
|
4151
|
-
for (let i = 0; i < totalSkeletonCount; i++) {
|
|
4152
|
-
const liElement = this.createElement('li', { className: dropDownListClasses.virtualList, styles: 'overflow: inherit' });
|
|
4153
|
-
if (this.enableVirtualization && this.itemTemplate) {
|
|
4154
|
-
liElement.style.height = this.listItemHeight + 'px';
|
|
4155
|
-
}
|
|
4156
|
-
let skeleton = new Skeleton({
|
|
4157
|
-
shape: "Text",
|
|
4158
|
-
height: "10px",
|
|
4159
|
-
width: "95%",
|
|
4160
|
-
cssClass: "e-skeleton-text",
|
|
4161
|
-
});
|
|
4162
|
-
skeleton.appendTo(this.createElement('div'));
|
|
4163
|
-
liElement.appendChild(skeleton.element);
|
|
4164
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4165
|
-
isContainSkeleton.firstChild.insertBefore(liElement, isContainSkeleton.firstChild.children[0]);
|
|
4166
|
-
}
|
|
4167
|
-
}
|
|
4168
|
-
}
|
|
4169
4456
|
getTakeValue() {
|
|
4170
4457
|
return this.allowFiltering && this.getModuleName() === 'dropdownlist' && Browser.isDevice ? Math.round(window.outerHeight / this.listItemHeight) : this.itemCount;
|
|
4171
4458
|
}
|
|
@@ -4206,15 +4493,16 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
4206
4493
|
this.initialRemoteRender = false;
|
|
4207
4494
|
if (this.value && this.dataSource instanceof DataManager) {
|
|
4208
4495
|
const checkField = isNullOrUndefined(this.fields.value) ? this.fields.text : this.fields.value;
|
|
4496
|
+
let value = this.allowObjectBinding && !isNullOrUndefined(this.value) ? getValue(checkField, this.value) : this.value;
|
|
4209
4497
|
const fieldValue = this.fields.value.split('.');
|
|
4210
4498
|
let checkVal = list.some((x) => isNullOrUndefined(x[checkField]) && fieldValue.length > 1 ?
|
|
4211
|
-
this.checkFieldValue(x, fieldValue) ===
|
|
4499
|
+
this.checkFieldValue(x, fieldValue) === value : x[checkField] === value);
|
|
4212
4500
|
if (this.enableVirtualization && this.virtualGroupDataSource) {
|
|
4213
4501
|
checkVal = this.virtualGroupDataSource.some((x) => isNullOrUndefined(x[checkField]) && fieldValue.length > 1 ?
|
|
4214
|
-
this.checkFieldValue(x, fieldValue) ===
|
|
4502
|
+
this.checkFieldValue(x, fieldValue) === value : x[checkField] === value);
|
|
4215
4503
|
}
|
|
4216
4504
|
if (!checkVal) {
|
|
4217
|
-
this.dataSource.executeQuery(this.getQuery(this.query).where(new Predicate(checkField, 'equal',
|
|
4505
|
+
this.dataSource.executeQuery(this.getQuery(this.query).where(new Predicate(checkField, 'equal', value)))
|
|
4218
4506
|
.then((e) => {
|
|
4219
4507
|
if (e.result.length > 0) {
|
|
4220
4508
|
this.addItem(e.result, list.length);
|
|
@@ -4383,46 +4671,19 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
4383
4671
|
updateSelectionList() {
|
|
4384
4672
|
let selectedItem = this.list && this.list.querySelector('.' + 'e-active');
|
|
4385
4673
|
if (!selectedItem && !isNullOrUndefined(this.value)) {
|
|
4386
|
-
|
|
4674
|
+
let value = this.allowObjectBinding ? getValue((this.fields.value) ? this.fields.value : '', this.value) : this.value;
|
|
4675
|
+
var findEle = this.findListElement(this.list, 'li', 'data-value', value);
|
|
4387
4676
|
if (findEle) {
|
|
4388
4677
|
findEle.classList.add('e-active');
|
|
4389
4678
|
}
|
|
4390
4679
|
}
|
|
4391
4680
|
}
|
|
4392
|
-
checkAndResetCache() {
|
|
4393
|
-
if (this.enableVirtualization) {
|
|
4394
|
-
this.generatedDataObject = {};
|
|
4395
|
-
this.virtualItemStartIndex = this.virtualItemEndIndex = 0;
|
|
4396
|
-
this.viewPortInfo = { currentPageNumber: null,
|
|
4397
|
-
direction: null,
|
|
4398
|
-
sentinelInfo: {},
|
|
4399
|
-
offsets: {},
|
|
4400
|
-
startIndex: 0,
|
|
4401
|
-
endIndex: this.itemCount, };
|
|
4402
|
-
this.selectedValueInfo = null;
|
|
4403
|
-
}
|
|
4404
|
-
}
|
|
4405
4681
|
removeFocus() {
|
|
4406
4682
|
const highlightedItem = this.list.querySelectorAll('.' + dropDownListClasses.focus);
|
|
4407
4683
|
if (highlightedItem && highlightedItem.length) {
|
|
4408
4684
|
removeClass(highlightedItem, dropDownListClasses.focus);
|
|
4409
4685
|
}
|
|
4410
4686
|
}
|
|
4411
|
-
getTransformValues() {
|
|
4412
|
-
let translateY = this.viewPortInfo.startIndex * this.listItemHeight;
|
|
4413
|
-
translateY = translateY - (this.skeletonCount * this.listItemHeight);
|
|
4414
|
-
translateY = this.viewPortInfo.startIndex === 0 && this.listData && this.listData.length === 0 ? 0 : translateY;
|
|
4415
|
-
const styleText = `transform: translate(0px, ${translateY}px);`;
|
|
4416
|
-
return styleText;
|
|
4417
|
-
}
|
|
4418
|
-
GetVirtualTrackHeight() {
|
|
4419
|
-
const height = this.totalItemCount === this.viewPortInfo.endIndex ? this.totalItemCount * this.listItemHeight - this.itemCount * this.listItemHeight : this.totalItemCount * this.listItemHeight;
|
|
4420
|
-
const heightDimension = `height: ${height - this.itemCount * this.listItemHeight}px;`;
|
|
4421
|
-
if (this.getModuleName() === 'autocomplete' && this.skeletonCount === 0) {
|
|
4422
|
-
return "height: 0px;";
|
|
4423
|
-
}
|
|
4424
|
-
return heightDimension;
|
|
4425
|
-
}
|
|
4426
4687
|
renderPopup(e) {
|
|
4427
4688
|
if (this.popupObj && document.body.contains(this.popupObj.element)) {
|
|
4428
4689
|
this.refreshPopup();
|
|
@@ -4437,7 +4698,7 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
4437
4698
|
popupEle.setAttribute('aria-label', this.element.id);
|
|
4438
4699
|
popupEle.setAttribute('role', 'dialog');
|
|
4439
4700
|
const searchBox = this.setSearchBox(popupEle);
|
|
4440
|
-
this.
|
|
4701
|
+
this.listContainerHeight = formatUnit(this.popupHeight);
|
|
4441
4702
|
if (this.headerTemplate) {
|
|
4442
4703
|
this.setHeaderTemplate(popupEle);
|
|
4443
4704
|
}
|
|
@@ -4481,19 +4742,19 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
4481
4742
|
this.searchBoxHeight = 0;
|
|
4482
4743
|
if (!isNullOrUndefined(searchBox.container) && this.getModuleName() !== 'combobox' && this.getModuleName() !== 'autocomplete') {
|
|
4483
4744
|
this.searchBoxHeight = (searchBox.container.parentElement).getBoundingClientRect().height;
|
|
4484
|
-
this.
|
|
4745
|
+
this.listContainerHeight = (parseInt(this.listContainerHeight, 10) - (this.searchBoxHeight)).toString() + 'px';
|
|
4485
4746
|
}
|
|
4486
4747
|
if (this.headerTemplate) {
|
|
4487
4748
|
this.header = this.header ? this.header : popupEle.querySelector('.e-ddl-header');
|
|
4488
4749
|
const height = Math.round(this.header.getBoundingClientRect().height);
|
|
4489
|
-
this.
|
|
4750
|
+
this.listContainerHeight = (parseInt(this.listContainerHeight, 10) - (height + this.searchBoxHeight)).toString() + 'px';
|
|
4490
4751
|
}
|
|
4491
4752
|
if (this.footerTemplate) {
|
|
4492
4753
|
this.footer = this.footer ? this.footer : popupEle.querySelector('.e-ddl-footer');
|
|
4493
4754
|
const height = Math.round(this.footer.getBoundingClientRect().height);
|
|
4494
|
-
this.
|
|
4755
|
+
this.listContainerHeight = (parseInt(this.listContainerHeight, 10) - (height + this.searchBoxHeight)).toString() + 'px';
|
|
4495
4756
|
}
|
|
4496
|
-
this.list.style.maxHeight = (parseInt(this.
|
|
4757
|
+
this.list.style.maxHeight = (parseInt(this.listContainerHeight, 10) - 2).toString() + 'px'; // due to box-sizing property
|
|
4497
4758
|
popupEle.style.maxHeight = formatUnit(this.popupHeight);
|
|
4498
4759
|
}
|
|
4499
4760
|
else {
|
|
@@ -4799,6 +5060,9 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
4799
5060
|
this.list.scrollTop += nextOffset;
|
|
4800
5061
|
}
|
|
4801
5062
|
else {
|
|
5063
|
+
if (this.enableVirtualization) {
|
|
5064
|
+
liCount = keyAction == "pageDown" ? this.getPageCount() : liCount;
|
|
5065
|
+
}
|
|
4802
5066
|
this.list.scrollTop += this.selectedLI.offsetHeight * liCount;
|
|
4803
5067
|
}
|
|
4804
5068
|
this.isPreventKeyAction = this.IsScrollerAtEnd() ? false : this.isPreventKeyAction;
|
|
@@ -4851,6 +5115,9 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
4851
5115
|
else if (nextOffset < 0 || isPageUpKeyAction) {
|
|
4852
5116
|
var currentElementValue = this.selectedLI ? this.selectedLI.getAttribute('data-value') : null;
|
|
4853
5117
|
var liCount = keyAction == "pageUp" ? this.getPageCount() - 2 : 1;
|
|
5118
|
+
if (this.enableVirtualization) {
|
|
5119
|
+
liCount = keyAction == "pageUp" ? this.getPageCount() : liCount;
|
|
5120
|
+
}
|
|
4854
5121
|
if (this.enableVirtualization && this.isKeyBoardAction && firstElementValue && currentElementValue === firstElementValue && keyAction != "home" && !this.isVirtualScrolling) {
|
|
4855
5122
|
this.isUpwardScrolling = true;
|
|
4856
5123
|
this.isPreventKeyAction = true;
|
|
@@ -4947,6 +5214,7 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
4947
5214
|
let isFilterValue = !isNullOrUndefined(this.filterInput) && !isNullOrUndefined(this.filterInput.value) && this.filterInput.value !== '';
|
|
4948
5215
|
const typedString = this.getModuleName() === 'combobox' ? this.typedString : null;
|
|
4949
5216
|
this.isTyped = false;
|
|
5217
|
+
this.isVirtualTrackHeight = false;
|
|
4950
5218
|
if (!(this.popupObj && document.body.contains(this.popupObj.element) && this.beforePopupOpen)) {
|
|
4951
5219
|
return;
|
|
4952
5220
|
}
|
|
@@ -5201,6 +5469,9 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
5201
5469
|
this.listItemHeight = this.getListHeight();
|
|
5202
5470
|
this.getSkeletonCount();
|
|
5203
5471
|
this.updateVirtualizationProperties(this.itemCount, this.allowFiltering);
|
|
5472
|
+
if (this.index !== null) {
|
|
5473
|
+
this.activeIndex = this.index + this.skeletonCount;
|
|
5474
|
+
}
|
|
5204
5475
|
}
|
|
5205
5476
|
this.initValue();
|
|
5206
5477
|
this.selectedValueInfo = this.viewPortInfo;
|
|
@@ -5210,7 +5481,7 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
5210
5481
|
}
|
|
5211
5482
|
else if (this.element.tagName === 'SELECT' && this.element.options[0]) {
|
|
5212
5483
|
const selectElement = this.element;
|
|
5213
|
-
this.value = selectElement.options[selectElement.selectedIndex].value;
|
|
5484
|
+
this.value = this.allowObjectBinding ? this.getDataByValue(selectElement.options[selectElement.selectedIndex].value) : selectElement.options[selectElement.selectedIndex].value;
|
|
5214
5485
|
this.text = isNullOrUndefined(this.value) ? null : selectElement.options[selectElement.selectedIndex].textContent;
|
|
5215
5486
|
this.initValue();
|
|
5216
5487
|
}
|
|
@@ -5362,7 +5633,7 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
5362
5633
|
this.actionData = this.actionCompleteData;
|
|
5363
5634
|
}
|
|
5364
5635
|
}
|
|
5365
|
-
updateDataSource(props) {
|
|
5636
|
+
updateDataSource(props, oldProps) {
|
|
5366
5637
|
if (this.inputElement.value !== '' || (!isNullOrUndefined(props) && (isNullOrUndefined(props.dataSource)
|
|
5367
5638
|
|| (!(props.dataSource instanceof DataManager) && props.dataSource.length === 0)))) {
|
|
5368
5639
|
this.clearAll(null, props);
|
|
@@ -5372,7 +5643,7 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
5372
5643
|
EventHandler.add(this.list, 'scroll', this.setFloatingHeader, this);
|
|
5373
5644
|
}
|
|
5374
5645
|
if (!(!isNullOrUndefined(props) && (isNullOrUndefined(props.dataSource)
|
|
5375
|
-
|| (!(props.dataSource instanceof DataManager) && props.dataSource.length === 0))) || !(Array.isArray(props.dataSource) && props.dataSource.length
|
|
5646
|
+
|| (!(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))) {
|
|
5376
5647
|
this.typedString = '';
|
|
5377
5648
|
this.resetList(this.dataSource);
|
|
5378
5649
|
}
|
|
@@ -5381,9 +5652,11 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
5381
5652
|
}
|
|
5382
5653
|
}
|
|
5383
5654
|
checkCustomValue() {
|
|
5384
|
-
this.
|
|
5655
|
+
const currentValue = this.allowObjectBinding && !isNullOrUndefined(this.value) ? getValue((this.fields.value) ? this.fields.value : '', this.value) : this.value;
|
|
5656
|
+
this.itemData = this.getDataByValue(currentValue);
|
|
5385
5657
|
const dataItem = this.getItemData();
|
|
5386
|
-
this.
|
|
5658
|
+
let value = this.allowObjectBinding ? this.itemData : dataItem.value;
|
|
5659
|
+
this.setProperties({ 'text': dataItem.text, 'value': value });
|
|
5387
5660
|
}
|
|
5388
5661
|
updateInputFields() {
|
|
5389
5662
|
if (this.getModuleName() === 'dropdownlist') {
|
|
@@ -5504,6 +5777,9 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
5504
5777
|
this.clearAll();
|
|
5505
5778
|
break;
|
|
5506
5779
|
}
|
|
5780
|
+
if (this.allowObjectBinding && !isNullOrUndefined(newProp.value) && !isNullOrUndefined(oldProp.value) && this.isObjectInArray(newProp.value, [oldProp.value])) {
|
|
5781
|
+
return;
|
|
5782
|
+
}
|
|
5507
5783
|
if (this.enableVirtualization) {
|
|
5508
5784
|
this.updateValues();
|
|
5509
5785
|
this.updateInputFields();
|
|
@@ -5521,7 +5797,8 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
5521
5797
|
this.renderList();
|
|
5522
5798
|
}
|
|
5523
5799
|
if (!this.initialRemoteRender) {
|
|
5524
|
-
const
|
|
5800
|
+
const value = this.allowObjectBinding && !isNullOrUndefined(newProp.value) ? getValue((this.fields.value) ? this.fields.value : '', newProp.value) : newProp.value;
|
|
5801
|
+
const item = this.getElementByValue(value);
|
|
5525
5802
|
if (!this.checkValidLi(item)) {
|
|
5526
5803
|
if (this.liCollections && this.liCollections.length === 100 &&
|
|
5527
5804
|
this.getModuleName() === 'autocomplete' && this.listData.length > 100) {
|
|
@@ -5531,7 +5808,8 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
5531
5808
|
const listLength = this.getItems().length;
|
|
5532
5809
|
const checkField = isNullOrUndefined(this.fields.value) ? this.fields.text : this.fields.value;
|
|
5533
5810
|
this.typedString = '';
|
|
5534
|
-
this.
|
|
5811
|
+
let value = this.allowObjectBinding && !isNullOrUndefined(newProp.value) ? getValue(checkField, newProp.value) : newProp.value;
|
|
5812
|
+
this.dataSource.executeQuery(this.getQuery(this.query).where(new Predicate(checkField, 'equal', value)))
|
|
5535
5813
|
.then((e) => {
|
|
5536
5814
|
if (e.result.length > 0) {
|
|
5537
5815
|
this.addItem(e.result, listLength);
|
|
@@ -5643,6 +5921,8 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
5643
5921
|
}
|
|
5644
5922
|
}
|
|
5645
5923
|
else if (prop === 'value') {
|
|
5924
|
+
const fields = (this.fields.value) ? this.fields.value : '';
|
|
5925
|
+
const value = this.allowObjectBinding && !isNullOrUndefined(newProp) ? getValue(fields, newProp) : newProp;
|
|
5646
5926
|
li = this.getElementByValue(newProp);
|
|
5647
5927
|
if (!this.checkValidLi(li)) {
|
|
5648
5928
|
this.setOldValue(oldProp);
|
|
@@ -5705,6 +5985,7 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
5705
5985
|
if (!this.enabled) {
|
|
5706
5986
|
return;
|
|
5707
5987
|
}
|
|
5988
|
+
this.firstItem = this.dataSource && this.dataSource.length > 0 ? this.dataSource[0] : null;
|
|
5708
5989
|
if (this.isReact && this.getModuleName() === 'combobox' && this.itemTemplate && this.isCustomFilter && this.isAddNewItemTemplate) {
|
|
5709
5990
|
this.renderList();
|
|
5710
5991
|
this.isAddNewItemTemplate = false;
|
|
@@ -5781,7 +6062,8 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
5781
6062
|
}
|
|
5782
6063
|
this.isEscapeKey = false;
|
|
5783
6064
|
if (!isNullOrUndefined(this.index)) {
|
|
5784
|
-
const
|
|
6065
|
+
const value = this.allowObjectBinding ? getValue((this.fields.value) ? this.fields.value : '', this.value) : this.value;
|
|
6066
|
+
const element = this.findListElement(this.ulElement, 'li', 'data-value', value);
|
|
5785
6067
|
this.selectedLI = this.liCollections[this.index] || element;
|
|
5786
6068
|
if (this.selectedLI) {
|
|
5787
6069
|
this.updateSelectedItem(this.selectedLI, null, true);
|
|
@@ -5794,6 +6076,7 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
5794
6076
|
this.resetSelection();
|
|
5795
6077
|
}
|
|
5796
6078
|
}
|
|
6079
|
+
this.isVirtualTrackHeight = false;
|
|
5797
6080
|
this.closePopup(0, e);
|
|
5798
6081
|
const dataItem = this.getItemData();
|
|
5799
6082
|
let isSelectVal = !isNullOrUndefined(this.selectedLI);
|
|
@@ -5865,6 +6148,9 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
5865
6148
|
*/
|
|
5866
6149
|
destroy() {
|
|
5867
6150
|
this.isActive = false;
|
|
6151
|
+
if (this.showClearButton) {
|
|
6152
|
+
this.clearButton = document.getElementsByClassName('e-clear-icon')[0];
|
|
6153
|
+
}
|
|
5868
6154
|
resetIncrementalSearchValues(this.element.id);
|
|
5869
6155
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5870
6156
|
if (this.isReact) {
|
|
@@ -5920,6 +6206,14 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
5920
6206
|
if (this.inputElement && !isNullOrUndefined(this.inputElement.onchange)) {
|
|
5921
6207
|
this.inputElement.onchange = null;
|
|
5922
6208
|
}
|
|
6209
|
+
if (this.inputElement && !isNullOrUndefined(this.inputElement.onselect)) {
|
|
6210
|
+
this.inputElement.onselect = null;
|
|
6211
|
+
}
|
|
6212
|
+
Input.destroy({
|
|
6213
|
+
element: this.inputElement,
|
|
6214
|
+
floatLabelType: this.floatLabelType,
|
|
6215
|
+
properties: this.properties
|
|
6216
|
+
}, this.clearButton);
|
|
5923
6217
|
if (this.isAngular) {
|
|
5924
6218
|
this.inputElement = null;
|
|
5925
6219
|
}
|
|
@@ -6013,6 +6307,9 @@ __decorate$1([
|
|
|
6013
6307
|
__decorate$1([
|
|
6014
6308
|
Property(null)
|
|
6015
6309
|
], DropDownList.prototype, "value", void 0);
|
|
6310
|
+
__decorate$1([
|
|
6311
|
+
Property(false)
|
|
6312
|
+
], DropDownList.prototype, "allowObjectBinding", void 0);
|
|
6016
6313
|
__decorate$1([
|
|
6017
6314
|
Property(null)
|
|
6018
6315
|
], DropDownList.prototype, "index", void 0);
|
|
@@ -6182,7 +6479,6 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
6182
6479
|
this.filterTimer = null;
|
|
6183
6480
|
this.isFilteredData = false;
|
|
6184
6481
|
this.isFilterRestore = false;
|
|
6185
|
-
// eslint-disable-next-line
|
|
6186
6482
|
this.selectedData = [];
|
|
6187
6483
|
this.filterDelayTime = 300;
|
|
6188
6484
|
this.isClicked = false;
|
|
@@ -6279,7 +6575,7 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
6279
6575
|
this.inputEle.setAttribute('aria-expanded', 'false');
|
|
6280
6576
|
this.inputEle.setAttribute('role', 'combobox');
|
|
6281
6577
|
this.inputEle.setAttribute('aria-haspopup', 'tree');
|
|
6282
|
-
this.inputEle.setAttribute('aria-controls', this.element.id +
|
|
6578
|
+
this.inputEle.setAttribute('aria-controls', this.element.id + '_options');
|
|
6283
6579
|
}
|
|
6284
6580
|
if (isNullOrUndefined(this.inputEle.getAttribute('type'))) {
|
|
6285
6581
|
this.inputEle.setAttribute('type', 'text');
|
|
@@ -6322,7 +6618,9 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
6322
6618
|
this.popupDiv.classList.add(DROPDOWN);
|
|
6323
6619
|
this.tree = this.createElement('div', { id: this.element.id + '_tree' });
|
|
6324
6620
|
this.popupDiv.appendChild(this.tree);
|
|
6325
|
-
|
|
6621
|
+
if (!this.destroyPopupOnHide) {
|
|
6622
|
+
document.body.appendChild(this.popupDiv);
|
|
6623
|
+
}
|
|
6326
6624
|
this.wireTreeEvents();
|
|
6327
6625
|
addClass([this.popupDiv], DDTHIDEICON);
|
|
6328
6626
|
this.renderTree();
|
|
@@ -6427,6 +6725,7 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
6427
6725
|
if (value === '') {
|
|
6428
6726
|
this.isFilteredData = false;
|
|
6429
6727
|
this.isFilterRestore = true;
|
|
6728
|
+
this.isFromFilterChange = false;
|
|
6430
6729
|
fields = this.cloneFields(this.fields);
|
|
6431
6730
|
}
|
|
6432
6731
|
else if (args.preventDefaultAction) {
|
|
@@ -6465,7 +6764,7 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
6465
6764
|
this.treeObj.dataBind();
|
|
6466
6765
|
if (this.hasTemplate && this.portals && this.treeObj.portals) {
|
|
6467
6766
|
for (let i = 0; i < this.treeObj.portals.length; i++) {
|
|
6468
|
-
if (this.portals.indexOf(this.treeObj.portals[i])
|
|
6767
|
+
if (this.portals.indexOf(this.treeObj.portals[i]) === -1) {
|
|
6469
6768
|
this.portals.push(this.treeObj.portals[i]);
|
|
6470
6769
|
}
|
|
6471
6770
|
}
|
|
@@ -6504,7 +6803,6 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
6504
6803
|
return filteredItems;
|
|
6505
6804
|
}
|
|
6506
6805
|
nestedFilter(value, filteredFields) {
|
|
6507
|
-
// eslint-disable-next-line
|
|
6508
6806
|
const matchedDataSource = [];
|
|
6509
6807
|
for (let i = 0; i < this.treeData.length; i++) {
|
|
6510
6808
|
// eslint-disable-next-line
|
|
@@ -6516,15 +6814,12 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
6516
6814
|
filteredFields.dataSource = matchedDataSource;
|
|
6517
6815
|
return filteredFields;
|
|
6518
6816
|
}
|
|
6519
|
-
// eslint-disable-next-line
|
|
6520
6817
|
nestedChildFilter(value, node) {
|
|
6521
|
-
// eslint-disable-next-line
|
|
6522
6818
|
const children = node[this.fields.child];
|
|
6523
6819
|
if (isNullOrUndefined(children)) {
|
|
6524
6820
|
return (this.isMatchedNode(value, node)) ? node : null;
|
|
6525
6821
|
}
|
|
6526
6822
|
else {
|
|
6527
|
-
// eslint-disable-next-line
|
|
6528
6823
|
const matchedChildren = [];
|
|
6529
6824
|
for (let i = 0; i < children.length; i++) {
|
|
6530
6825
|
// eslint-disable-next-line
|
|
@@ -6545,9 +6840,7 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
6545
6840
|
}
|
|
6546
6841
|
}
|
|
6547
6842
|
selfReferencefilter(value, filteredFields) {
|
|
6548
|
-
// eslint-disable-next-line
|
|
6549
6843
|
const matchedData = [];
|
|
6550
|
-
// eslint-disable-next-line
|
|
6551
6844
|
const matchedDataSource = [];
|
|
6552
6845
|
for (let i = 0; i < this.treeData.length; i++) {
|
|
6553
6846
|
if (this.isMatchedNode(value, this.treeData[i])) {
|
|
@@ -6560,7 +6853,6 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
6560
6853
|
// eslint-disable-next-line
|
|
6561
6854
|
let parentId = matchedData[i][this.fields.parentValue];
|
|
6562
6855
|
while (!isNullOrUndefined(parentId)) {
|
|
6563
|
-
// eslint-disable-next-line
|
|
6564
6856
|
let parent = null;
|
|
6565
6857
|
for (let j = 0; j < this.treeData.length; j++) {
|
|
6566
6858
|
// eslint-disable-next-line
|
|
@@ -6583,7 +6875,6 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
6583
6875
|
filteredFields.dataSource = matchedDataSource;
|
|
6584
6876
|
return filteredFields;
|
|
6585
6877
|
}
|
|
6586
|
-
// eslint-disable-next-line
|
|
6587
6878
|
isMatchedNode(value, node, isChild, isChildFiltering) {
|
|
6588
6879
|
let checkValue;
|
|
6589
6880
|
let isObjectValue = isChild && isChildFiltering && this.isChildObject();
|
|
@@ -6938,7 +7229,7 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
6938
7229
|
this.clickHandler(e);
|
|
6939
7230
|
break;
|
|
6940
7231
|
case 'moveDown':
|
|
6941
|
-
|
|
7232
|
+
const focusedElement = this.treeObj.element.querySelector('li');
|
|
6942
7233
|
focusedElement.focus();
|
|
6943
7234
|
addClass([focusedElement], ['e-node-focus']);
|
|
6944
7235
|
}
|
|
@@ -6976,7 +7267,6 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
6976
7267
|
let remaining;
|
|
6977
7268
|
let downIconWidth = 0;
|
|
6978
7269
|
this.overFlowWrapper.innerHTML = '';
|
|
6979
|
-
// eslint-disable-next-line
|
|
6980
7270
|
const l10nLocale = { overflowCountTemplate: '+${count} more..', totalCountTemplate: '${count} selected' };
|
|
6981
7271
|
this.l10n = new L10n(this.getLocaleName(), l10nLocale, this.locale);
|
|
6982
7272
|
const remainContent = this.l10n.getConstant('overflowCountTemplate');
|
|
@@ -7259,7 +7549,6 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
7259
7549
|
if (this.selectAllText !== 'Select All' || this.unSelectAllText !== 'Unselect All') {
|
|
7260
7550
|
const template = unSelect ? this.unSelectAllText : this.selectAllText;
|
|
7261
7551
|
this.selectAllSpan.textContent = '';
|
|
7262
|
-
// eslint-disable-next-line
|
|
7263
7552
|
const compiledString = compile(template);
|
|
7264
7553
|
const templateName = unSelect ? 'unSelectAllText' : 'selectAllText';
|
|
7265
7554
|
for (const item of compiledString({}, this, templateName, null, !this.isStringTemplate)) {
|
|
@@ -7283,11 +7572,11 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
7283
7572
|
if (htmlAttr === 'class') {
|
|
7284
7573
|
this.inputWrapper.classList.add(this.htmlAttributes[`${htmlAttr}`]);
|
|
7285
7574
|
}
|
|
7286
|
-
else if (htmlAttr === 'disabled'
|
|
7575
|
+
else if (htmlAttr === 'disabled') {
|
|
7287
7576
|
this.setProperties({ enabled: false }, true);
|
|
7288
7577
|
this.setEnable();
|
|
7289
7578
|
}
|
|
7290
|
-
else if (htmlAttr === 'readonly'
|
|
7579
|
+
else if (htmlAttr === 'readonly') {
|
|
7291
7580
|
this.setProperties({ readonly: true }, true);
|
|
7292
7581
|
this.dataBind();
|
|
7293
7582
|
}
|
|
@@ -7347,7 +7636,6 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
7347
7636
|
}
|
|
7348
7637
|
setTreeValue() {
|
|
7349
7638
|
if (this.value !== null && this.value.length !== 0) {
|
|
7350
|
-
// eslint-disable-next-line
|
|
7351
7639
|
let data;
|
|
7352
7640
|
if (this.showCheckBox || this.allowMultiSelection) {
|
|
7353
7641
|
for (let i = 0; i < this.value.length; i++) {
|
|
@@ -7377,7 +7665,6 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
7377
7665
|
return;
|
|
7378
7666
|
}
|
|
7379
7667
|
if (this.text !== null) {
|
|
7380
|
-
// eslint-disable-next-line
|
|
7381
7668
|
let data;
|
|
7382
7669
|
const valArr = [];
|
|
7383
7670
|
if (this.showCheckBox || this.allowMultiSelection) {
|
|
@@ -7445,7 +7732,7 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
7445
7732
|
}
|
|
7446
7733
|
else {
|
|
7447
7734
|
if (this.showCheckBox) {
|
|
7448
|
-
|
|
7735
|
+
const difference = this.value.filter((e) => {
|
|
7449
7736
|
return this.treeObj.checkedNodes.indexOf(e) === -1;
|
|
7450
7737
|
});
|
|
7451
7738
|
if (difference.length > 0 || this.treeSettings.autoCheck) {
|
|
@@ -7467,9 +7754,7 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
7467
7754
|
this.triggerChangeEvent();
|
|
7468
7755
|
}
|
|
7469
7756
|
}
|
|
7470
|
-
// eslint-disable-next-line
|
|
7471
7757
|
getItems(givenText) {
|
|
7472
|
-
// eslint-disable-next-line
|
|
7473
7758
|
let data;
|
|
7474
7759
|
if (this.treeDataType === 1) {
|
|
7475
7760
|
for (let i = 0; i < this.treeItems.length; i++) {
|
|
@@ -7486,9 +7771,7 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
7486
7771
|
}
|
|
7487
7772
|
return data;
|
|
7488
7773
|
}
|
|
7489
|
-
// eslint-disable-next-line
|
|
7490
7774
|
getNestedItems(data, field, givenText) {
|
|
7491
|
-
// eslint-disable-next-line
|
|
7492
7775
|
let newData;
|
|
7493
7776
|
for (let i = 0, objlen = data.length; i < objlen; i++) {
|
|
7494
7777
|
// eslint-disable-next-line
|
|
@@ -7499,7 +7782,6 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
7499
7782
|
else if (typeof field.child === 'string' && !isNullOrUndefined(getValue(field.child, data[i]))) {
|
|
7500
7783
|
// eslint-disable-next-line
|
|
7501
7784
|
const childData = getValue(field.child, data[i]);
|
|
7502
|
-
// eslint-disable-next-line
|
|
7503
7785
|
newData = this.getNestedItems(childData, this.getChildType(field), givenText);
|
|
7504
7786
|
if (newData !== undefined) {
|
|
7505
7787
|
break;
|
|
@@ -7542,7 +7824,7 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
7542
7824
|
nodeTemplate: this.itemTemplate
|
|
7543
7825
|
});
|
|
7544
7826
|
this.treeObj.root = this.root ? this.root : this;
|
|
7545
|
-
this.treeObj.appendTo(
|
|
7827
|
+
this.treeObj.appendTo(this.tree);
|
|
7546
7828
|
}
|
|
7547
7829
|
/* To render the popup element */
|
|
7548
7830
|
renderPopup() {
|
|
@@ -7599,9 +7881,13 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
7599
7881
|
this.isFirstRender = false;
|
|
7600
7882
|
/* eslint-disable */
|
|
7601
7883
|
if (this.hasTemplate && this.portals) {
|
|
7602
|
-
|
|
7884
|
+
if (this.treeObj.portals) {
|
|
7885
|
+
this.portals = this.portals.concat(this.treeObj.portals.filter((item) => !this.portals.includes(item)));
|
|
7886
|
+
}
|
|
7603
7887
|
/* eslint-enable */
|
|
7604
|
-
this.
|
|
7888
|
+
if (this.isReact) {
|
|
7889
|
+
this.renderReactTemplates(this.reactCallBack);
|
|
7890
|
+
}
|
|
7605
7891
|
}
|
|
7606
7892
|
}
|
|
7607
7893
|
if (!isCancelled) {
|
|
@@ -7612,7 +7898,15 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
7612
7898
|
this.popupObj.refreshPosition();
|
|
7613
7899
|
if (!(this.showCheckBox && this.showSelectAll) && (!this.popupDiv.classList.contains(NODATA)
|
|
7614
7900
|
&& this.treeItems.length > 0)) {
|
|
7615
|
-
let focusedElement
|
|
7901
|
+
let focusedElement;
|
|
7902
|
+
if (this.value != null && this.text != null) {
|
|
7903
|
+
this.treeObj.element.querySelector('li').setAttribute('tabindex', '-1');
|
|
7904
|
+
focusedElement = this.treeObj.element.querySelector('[data-uid="' + this.value[0] + '"]');
|
|
7905
|
+
focusedElement.setAttribute('tabindex', '0');
|
|
7906
|
+
}
|
|
7907
|
+
else {
|
|
7908
|
+
focusedElement = this.treeObj.element.querySelector('li');
|
|
7909
|
+
}
|
|
7616
7910
|
focusedElement.focus();
|
|
7617
7911
|
addClass([focusedElement], ['e-node-focus']);
|
|
7618
7912
|
}
|
|
@@ -7630,6 +7924,10 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
7630
7924
|
}
|
|
7631
7925
|
});
|
|
7632
7926
|
}
|
|
7927
|
+
reactCallBack() {
|
|
7928
|
+
this.updatePopupHeight();
|
|
7929
|
+
this.popupObj.refreshPosition();
|
|
7930
|
+
}
|
|
7633
7931
|
updatePopupHeight() {
|
|
7634
7932
|
if (this.isFirstRender) {
|
|
7635
7933
|
return;
|
|
@@ -7887,7 +8185,6 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
7887
8185
|
}
|
|
7888
8186
|
return null;
|
|
7889
8187
|
}
|
|
7890
|
-
// eslint-disable-next-line
|
|
7891
8188
|
getTreeDataType(ds, field) {
|
|
7892
8189
|
if (this.fields.dataSource instanceof DataManager) {
|
|
7893
8190
|
for (let i = 0; i < ds.length; i++) {
|
|
@@ -7897,8 +8194,9 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
7897
8194
|
}
|
|
7898
8195
|
return 2;
|
|
7899
8196
|
}
|
|
7900
|
-
if (isNullOrUndefined(this.fields.dataSource))
|
|
8197
|
+
if (isNullOrUndefined(this.fields.dataSource)) {
|
|
7901
8198
|
this.fields.dataSource = [];
|
|
8199
|
+
}
|
|
7902
8200
|
for (let i = 0, len = this.fields.dataSource.length; i < len; i++) {
|
|
7903
8201
|
if ((typeof field.child === 'string') && !isNullOrUndefined(getValue(field.child, this.fields.dataSource[i]))) {
|
|
7904
8202
|
return 2;
|
|
@@ -7919,9 +8217,7 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
7919
8217
|
this.treeObj.dataBind();
|
|
7920
8218
|
}
|
|
7921
8219
|
getEventArgs(args) {
|
|
7922
|
-
// eslint-disable-next-line
|
|
7923
8220
|
const checkData = args.data;
|
|
7924
|
-
// eslint-disable-next-line
|
|
7925
8221
|
const selectData = args.nodeData;
|
|
7926
8222
|
let state;
|
|
7927
8223
|
if (this.showCheckBox) {
|
|
@@ -8006,7 +8302,6 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
8006
8302
|
const target = args.event.target;
|
|
8007
8303
|
if ((target.classList.contains('e-fullrow') || target.classList.contains('e-list-text')) && this.showCheckBox) {
|
|
8008
8304
|
this.isClicked = true;
|
|
8009
|
-
// eslint-disable-next-line
|
|
8010
8305
|
const getNodeDetails = this.treeObj.getNode(args.node);
|
|
8011
8306
|
if (getNodeDetails.isChecked === 'true') {
|
|
8012
8307
|
this.treeObj.uncheckAll([args.node]);
|
|
@@ -8058,7 +8353,7 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
8058
8353
|
onNodeExpanded(args) {
|
|
8059
8354
|
if (this.hasTemplate && this.portals && this.treeObj.portals) {
|
|
8060
8355
|
for (let i = 0; i < this.treeObj.portals.length; i++) {
|
|
8061
|
-
if (this.portals.indexOf(this.treeObj.portals[i])
|
|
8356
|
+
if (this.portals.indexOf(this.treeObj.portals[i]) === -1) {
|
|
8062
8357
|
this.portals.push(this.treeObj.portals[i]);
|
|
8063
8358
|
}
|
|
8064
8359
|
}
|
|
@@ -8156,7 +8451,7 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
8156
8451
|
}
|
|
8157
8452
|
setMultiSelectValue(newValues) {
|
|
8158
8453
|
if (!this.isFilteredData) {
|
|
8159
|
-
this.setProperties({ value: this.isFromFilterChange && newValues && newValues.length
|
|
8454
|
+
this.setProperties({ value: this.isFromFilterChange && newValues && newValues.length === 0 ? this.value : newValues }, true);
|
|
8160
8455
|
this.isFromFilterChange = false;
|
|
8161
8456
|
if (newValues && newValues.length !== 0 && !this.showCheckBox) {
|
|
8162
8457
|
this.treeObj.selectedNodes = this.value.slice();
|
|
@@ -8206,9 +8501,7 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
8206
8501
|
}
|
|
8207
8502
|
this.updateSelectedValues();
|
|
8208
8503
|
}
|
|
8209
|
-
// eslint-disable-next-line
|
|
8210
8504
|
getSelectedData(value) {
|
|
8211
|
-
// eslint-disable-next-line
|
|
8212
8505
|
let data = null;
|
|
8213
8506
|
if (this.isFilteredData) {
|
|
8214
8507
|
for (let i = 0; i < this.selectedData.length; i++) {
|
|
@@ -8238,7 +8531,7 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
8238
8531
|
}
|
|
8239
8532
|
else if (this.treeDataType === 1) {
|
|
8240
8533
|
for (let i = 0, objlen = this.treeItems.length; i < objlen; i++) {
|
|
8241
|
-
|
|
8534
|
+
const dataId = getValue(this.fields.value, this.treeItems[i]);
|
|
8242
8535
|
if (!isNullOrUndefined(this.treeItems[i]) && !isNullOrUndefined(dataId) && dataId.toString() === id) {
|
|
8243
8536
|
return this.treeItems[i];
|
|
8244
8537
|
}
|
|
@@ -8255,19 +8548,19 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
8255
8548
|
return newChildItems;
|
|
8256
8549
|
}
|
|
8257
8550
|
for (let i = 0, objlen = obj.length; i < objlen; i++) {
|
|
8258
|
-
|
|
8551
|
+
const dataValue = getValue(mapper.value, obj[i]);
|
|
8259
8552
|
if (obj[i] && dataValue && dataValue.toString() === id) {
|
|
8260
8553
|
return obj[i];
|
|
8261
8554
|
}
|
|
8262
8555
|
else if (typeof mapper.child === 'string' && !isNullOrUndefined(getValue(mapper.child, obj[i]))) {
|
|
8263
|
-
|
|
8556
|
+
const childNodeData = getValue(mapper.child, obj[i]);
|
|
8264
8557
|
newChildItems = this.getChildNodeData(childNodeData, this.getChildMapperFields(mapper), id);
|
|
8265
8558
|
if (newChildItems !== undefined) {
|
|
8266
8559
|
break;
|
|
8267
8560
|
}
|
|
8268
8561
|
}
|
|
8269
8562
|
else if (this.fields.dataSource instanceof DataManager && !isNullOrUndefined(getValue('child', obj[i]))) {
|
|
8270
|
-
|
|
8563
|
+
const child = 'child';
|
|
8271
8564
|
newChildItems = this.getChildNodeData(getValue(child, obj[i]), this.getChildMapperFields(mapper), id);
|
|
8272
8565
|
if (newChildItems !== undefined) {
|
|
8273
8566
|
break;
|
|
@@ -8295,7 +8588,6 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
8295
8588
|
let temp;
|
|
8296
8589
|
let text;
|
|
8297
8590
|
let textValue = '';
|
|
8298
|
-
// eslint-disable-next-line
|
|
8299
8591
|
let selectedData;
|
|
8300
8592
|
this.hiddenElement.innerHTML = '';
|
|
8301
8593
|
let hiddenInputValue = '';
|
|
@@ -8391,7 +8683,7 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
8391
8683
|
addClass([this.inputWrapper], SHOW_CHIP);
|
|
8392
8684
|
}
|
|
8393
8685
|
const chip = this.createElement('span', {
|
|
8394
|
-
className: CHIP
|
|
8686
|
+
className: CHIP
|
|
8395
8687
|
});
|
|
8396
8688
|
if (!this.inputEle.classList.contains(CHIP_INPUT)) {
|
|
8397
8689
|
addClass([this.inputEle], CHIP_INPUT);
|
|
@@ -8433,7 +8725,6 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
8433
8725
|
this.header = this.createElement('div');
|
|
8434
8726
|
addClass([this.header], HEADER);
|
|
8435
8727
|
}
|
|
8436
|
-
// eslint-disable-next-line
|
|
8437
8728
|
const compiledString = this.templateComplier(this.headerTemplate);
|
|
8438
8729
|
let tempArr = compiledString({}, this, 'headerTemplate', this.headerTemplateId, this.isStringTemplate, undefined, this.header);
|
|
8439
8730
|
if (tempArr) {
|
|
@@ -8442,7 +8733,6 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
8442
8733
|
}
|
|
8443
8734
|
this.popupEle.insertBefore(this.header, this.checkAllParent ? this.checkAllParent : this.popupDiv);
|
|
8444
8735
|
}
|
|
8445
|
-
// eslint-disable-next-line
|
|
8446
8736
|
templateComplier(template) {
|
|
8447
8737
|
if (template) {
|
|
8448
8738
|
// eslint-disable-next-line
|
|
@@ -8468,7 +8758,6 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
8468
8758
|
this.footer = this.createElement('div');
|
|
8469
8759
|
addClass([this.footer], FOOTER);
|
|
8470
8760
|
}
|
|
8471
|
-
// eslint-disable-next-line
|
|
8472
8761
|
const compiledString = this.templateComplier(this.footerTemplate);
|
|
8473
8762
|
let tempArr = compiledString({}, this, 'footerTemplate', this.footerTemplateId, this.isStringTemplate, undefined, this.footer);
|
|
8474
8763
|
if (tempArr) {
|
|
@@ -8527,7 +8816,7 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
8527
8816
|
this.ensurePlaceHolder();
|
|
8528
8817
|
}
|
|
8529
8818
|
resetValue(isDynamicChange) {
|
|
8530
|
-
if (this.value
|
|
8819
|
+
if (this.value === [] && this.text == null) {
|
|
8531
8820
|
return;
|
|
8532
8821
|
}
|
|
8533
8822
|
Input.setValue(null, this.inputEle, this.floatLabelType);
|
|
@@ -8666,7 +8955,6 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
8666
8955
|
const template = actionFailure ? this.actionFailureTemplate : this.noRecordsTemplate;
|
|
8667
8956
|
const templateId = actionFailure ? this.actionFailureTemplateId : this.noRecordsTemplateId;
|
|
8668
8957
|
const templatestring = actionFailure ? 'actionFailureTemplate' : 'noRecordsTemplate';
|
|
8669
|
-
// eslint-disable-next-line
|
|
8670
8958
|
const compiledString = this.templateComplier(template);
|
|
8671
8959
|
let tempArr = compiledString({}, this, templatestring, templateId, this.isStringTemplate, undefined, this.noRecord);
|
|
8672
8960
|
if (tempArr) {
|
|
@@ -8675,7 +8963,6 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
8675
8963
|
}
|
|
8676
8964
|
}
|
|
8677
8965
|
else {
|
|
8678
|
-
// eslint-disable-next-line
|
|
8679
8966
|
const l10nLocale = { noRecordsTemplate: 'No Records Found', actionFailureTemplate: 'The Request Failed' };
|
|
8680
8967
|
this.l10n = new L10n(this.getLocaleName(), l10nLocale, this.locale);
|
|
8681
8968
|
this.noRecord.innerHTML = actionFailure ?
|
|
@@ -8906,10 +9193,10 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
8906
9193
|
this.updateTreeSettings(newProp);
|
|
8907
9194
|
break;
|
|
8908
9195
|
case 'customTemplate':
|
|
8909
|
-
if (this.mode !==
|
|
9196
|
+
if (this.mode !== 'Custom') {
|
|
8910
9197
|
return;
|
|
8911
9198
|
}
|
|
8912
|
-
this.chipCollection.innerHTML =
|
|
9199
|
+
this.chipCollection.innerHTML = '';
|
|
8913
9200
|
this.setTagValues();
|
|
8914
9201
|
break;
|
|
8915
9202
|
case 'sortOrder':
|
|
@@ -9059,6 +9346,16 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
9059
9346
|
this.filterObj = null;
|
|
9060
9347
|
}
|
|
9061
9348
|
}
|
|
9349
|
+
destroyPopup() {
|
|
9350
|
+
this.isPopupOpen = false;
|
|
9351
|
+
if (this.isReact) {
|
|
9352
|
+
this.clearTemplate();
|
|
9353
|
+
}
|
|
9354
|
+
if (this.popupObj) {
|
|
9355
|
+
this.popupObj.destroy();
|
|
9356
|
+
detach(this.popupObj.element);
|
|
9357
|
+
}
|
|
9358
|
+
}
|
|
9062
9359
|
/**
|
|
9063
9360
|
* Ensures visibility of the Dropdown Tree item by using item value or item element.
|
|
9064
9361
|
* If many Dropdown Tree items are present, and we are in need to find a particular item, then the `ensureVisible` property
|
|
@@ -9076,7 +9373,6 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
9076
9373
|
* @param {string | Element} item - Specifies the value of Dropdown Tree item/ Dropdown Tree item element
|
|
9077
9374
|
* @returns {'{[key: string]: Object }[]'} - returns the updated data source of the Dropdown Tree.
|
|
9078
9375
|
*/
|
|
9079
|
-
// eslint-disable-next-line
|
|
9080
9376
|
getData(item) {
|
|
9081
9377
|
return this.treeObj.getTreeData(item);
|
|
9082
9378
|
}
|
|
@@ -9101,6 +9397,10 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
9101
9397
|
}
|
|
9102
9398
|
}
|
|
9103
9399
|
this.trigger('close', eventArgs);
|
|
9400
|
+
if (this.destroyPopupOnHide) {
|
|
9401
|
+
this.isFirstRender = true;
|
|
9402
|
+
this.destroyPopup();
|
|
9403
|
+
}
|
|
9104
9404
|
}
|
|
9105
9405
|
}
|
|
9106
9406
|
/**
|
|
@@ -9151,7 +9451,7 @@ __decorate$2([
|
|
|
9151
9451
|
Property('')
|
|
9152
9452
|
], DropDownTree.prototype, "cssClass", void 0);
|
|
9153
9453
|
__decorate$2([
|
|
9154
|
-
Property(
|
|
9454
|
+
Property('${value.length} item(s) selected')
|
|
9155
9455
|
], DropDownTree.prototype, "customTemplate", void 0);
|
|
9156
9456
|
__decorate$2([
|
|
9157
9457
|
Property(',')
|
|
@@ -9217,7 +9517,10 @@ __decorate$2([
|
|
|
9217
9517
|
Property(false)
|
|
9218
9518
|
], DropDownTree.prototype, "showCheckBox", void 0);
|
|
9219
9519
|
__decorate$2([
|
|
9220
|
-
Property(
|
|
9520
|
+
Property(true)
|
|
9521
|
+
], DropDownTree.prototype, "destroyPopupOnHide", void 0);
|
|
9522
|
+
__decorate$2([
|
|
9523
|
+
Property(true)
|
|
9221
9524
|
], DropDownTree.prototype, "enableHtmlSanitizer", void 0);
|
|
9222
9525
|
__decorate$2([
|
|
9223
9526
|
Property(true)
|
|
@@ -9402,8 +9705,12 @@ let ComboBox = class ComboBox extends DropDownList {
|
|
|
9402
9705
|
this.setHiddenValue();
|
|
9403
9706
|
}
|
|
9404
9707
|
valueMuteChange(value) {
|
|
9708
|
+
value = this.allowObjectBinding && !isNullOrUndefined(value) ? getValue((this.fields.value) ? this.fields.value : '', value) : value;
|
|
9405
9709
|
const inputValue = isNullOrUndefined(value) ? null : value.toString();
|
|
9406
9710
|
Input.setValue(inputValue, this.inputElement, this.floatLabelType, this.showClearButton);
|
|
9711
|
+
if (this.allowObjectBinding) {
|
|
9712
|
+
value = this.getDataByValue(value);
|
|
9713
|
+
}
|
|
9407
9714
|
this.setProperties({ value: value, text: value, index: null }, true);
|
|
9408
9715
|
this.activeIndex = this.index;
|
|
9409
9716
|
const fields = this.fields;
|
|
@@ -9412,35 +9719,39 @@ let ComboBox = class ComboBox extends DropDownList {
|
|
|
9412
9719
|
dataItem[fields.value] = isNullOrUndefined(value) ? null : value.toString();
|
|
9413
9720
|
this.itemData = dataItem;
|
|
9414
9721
|
this.item = null;
|
|
9415
|
-
if (this.previousValue !== this.value) {
|
|
9722
|
+
if ((!this.allowObjectBinding && (this.previousValue !== this.value)) || (this.allowObjectBinding && this.previousValue && this.value && !this.isObjectInArray(this.previousValue, [this.value]))) {
|
|
9416
9723
|
this.detachChangeEvent(null);
|
|
9417
9724
|
}
|
|
9418
9725
|
}
|
|
9419
9726
|
updateValues() {
|
|
9420
9727
|
if (!isNullOrUndefined(this.value)) {
|
|
9421
|
-
|
|
9422
|
-
|
|
9728
|
+
let currentValue = this.allowObjectBinding && !isNullOrUndefined(this.value) ? getValue((this.fields.value) ? this.fields.value : '', this.value) : this.value;
|
|
9729
|
+
const li = this.getElementByValue(currentValue);
|
|
9730
|
+
let doesItemExist = !isNullOrUndefined(li) ? true : false;
|
|
9423
9731
|
if (this.enableVirtualization && this.value) {
|
|
9424
9732
|
const fields = (this.fields.value) ? this.fields.value : '';
|
|
9733
|
+
let currentValue = this.allowObjectBinding && !isNullOrUndefined(this.value) ? getValue((this.fields.value) ? this.fields.value : '', this.value) : this.value;
|
|
9425
9734
|
if (this.dataSource instanceof DataManager && this.virtualGroupDataSource) {
|
|
9426
|
-
const getItem = new DataManager(this.virtualGroupDataSource).executeLocal(new Query().where(new Predicate(fields, 'equal',
|
|
9735
|
+
const getItem = new DataManager(this.virtualGroupDataSource).executeLocal(new Query().where(new Predicate(fields, 'equal', currentValue)));
|
|
9427
9736
|
if (getItem && getItem.length > 0) {
|
|
9428
9737
|
this.itemData = getItem[0];
|
|
9429
|
-
|
|
9738
|
+
doesItemExist = true;
|
|
9430
9739
|
const dataItem = this.getItemData();
|
|
9740
|
+
let value = this.allowObjectBinding ? this.getDataByValue(dataItem.value) : dataItem.value;
|
|
9431
9741
|
if ((this.value === dataItem.value && this.text !== dataItem.text) || (this.value !== dataItem.value && this.text === dataItem.text)) {
|
|
9432
|
-
this.setProperties({ 'text': dataItem.text, 'value':
|
|
9742
|
+
this.setProperties({ 'text': dataItem.text, 'value': value });
|
|
9433
9743
|
}
|
|
9434
9744
|
}
|
|
9435
9745
|
}
|
|
9436
9746
|
else {
|
|
9437
|
-
const getItem = new DataManager(this.dataSource).executeLocal(new Query().where(new Predicate(fields, 'equal',
|
|
9747
|
+
const getItem = new DataManager(this.dataSource).executeLocal(new Query().where(new Predicate(fields, 'equal', currentValue)));
|
|
9438
9748
|
if (getItem && getItem.length > 0) {
|
|
9439
9749
|
this.itemData = getItem[0];
|
|
9440
|
-
|
|
9750
|
+
doesItemExist = true;
|
|
9441
9751
|
const dataItem = this.getItemData();
|
|
9752
|
+
let value = this.allowObjectBinding ? this.getDataByValue(dataItem.value) : dataItem.value;
|
|
9442
9753
|
if ((this.value === dataItem.value && this.text !== dataItem.text) || (this.value !== dataItem.value && this.text === dataItem.text)) {
|
|
9443
|
-
this.setProperties({ 'text': dataItem.text, 'value':
|
|
9754
|
+
this.setProperties({ 'text': dataItem.text, 'value': value });
|
|
9444
9755
|
}
|
|
9445
9756
|
}
|
|
9446
9757
|
}
|
|
@@ -9448,10 +9759,10 @@ let ComboBox = class ComboBox extends DropDownList {
|
|
|
9448
9759
|
if (li) {
|
|
9449
9760
|
this.setSelection(li, null);
|
|
9450
9761
|
}
|
|
9451
|
-
else if ((!this.enableVirtualization && this.allowCustom) || (this.allowCustom && this.enableVirtualization && !
|
|
9762
|
+
else if ((!this.enableVirtualization && this.allowCustom) || (this.allowCustom && this.enableVirtualization && !doesItemExist)) {
|
|
9452
9763
|
this.valueMuteChange(this.value);
|
|
9453
9764
|
}
|
|
9454
|
-
else if (!this.enableVirtualization || (this.enableVirtualization && !
|
|
9765
|
+
else if (!this.enableVirtualization || (this.enableVirtualization && !doesItemExist)) {
|
|
9455
9766
|
this.valueMuteChange(null);
|
|
9456
9767
|
}
|
|
9457
9768
|
}
|
|
@@ -9560,7 +9871,7 @@ let ComboBox = class ComboBox extends DropDownList {
|
|
|
9560
9871
|
this.updateIncrementalView(0, this.itemCount);
|
|
9561
9872
|
}
|
|
9562
9873
|
activeItem = Search(inputValue, this.incrementalLiCollections, this.filterType, true, dataSource, this.fields, type);
|
|
9563
|
-
while (isNullOrUndefined(activeItem) && this.incrementalEndIndex < this.totalItemCount) {
|
|
9874
|
+
while (isNullOrUndefined(activeItem.item) && this.incrementalEndIndex < this.totalItemCount) {
|
|
9564
9875
|
this.incrementalStartIndex = this.incrementalEndIndex;
|
|
9565
9876
|
this.incrementalEndIndex = this.incrementalEndIndex + 100 > this.totalItemCount ? this.totalItemCount : this.incrementalEndIndex + 100;
|
|
9566
9877
|
this.updateIncrementalInfo(this.incrementalStartIndex, this.incrementalEndIndex);
|
|
@@ -9570,6 +9881,7 @@ let ComboBox = class ComboBox extends DropDownList {
|
|
|
9570
9881
|
}
|
|
9571
9882
|
activeItem = Search(inputValue, this.incrementalLiCollections, this.filterType, true, dataSource, this.fields, type);
|
|
9572
9883
|
if (!isNullOrUndefined(activeItem)) {
|
|
9884
|
+
activeItem.index = activeItem.index + this.incrementalStartIndex;
|
|
9573
9885
|
break;
|
|
9574
9886
|
}
|
|
9575
9887
|
if (isNullOrUndefined(activeItem) && this.incrementalEndIndex >= this.totalItemCount) {
|
|
@@ -9655,10 +9967,12 @@ let ComboBox = class ComboBox extends DropDownList {
|
|
|
9655
9967
|
}
|
|
9656
9968
|
}
|
|
9657
9969
|
checkCustomValue() {
|
|
9658
|
-
this.
|
|
9970
|
+
const value = this.allowObjectBinding && !isNullOrUndefined(this.value) ? getValue((this.fields.value) ? this.fields.value : '', this.value) : this.value;
|
|
9971
|
+
this.itemData = this.getDataByValue(value);
|
|
9659
9972
|
const dataItem = this.getItemData();
|
|
9973
|
+
const setValue$$1 = this.allowObjectBinding ? this.itemData : dataItem.value;
|
|
9660
9974
|
if (!(this.allowCustom && isNullOrUndefined(dataItem.value) && isNullOrUndefined(dataItem.text))) {
|
|
9661
|
-
this.setProperties({ 'value':
|
|
9975
|
+
this.setProperties({ 'value': setValue$$1 }, !this.allowCustom);
|
|
9662
9976
|
}
|
|
9663
9977
|
}
|
|
9664
9978
|
/**
|
|
@@ -9708,10 +10022,10 @@ let ComboBox = class ComboBox extends DropDownList {
|
|
|
9708
10022
|
const currentValue = this.getTextByValue(activeElement.getAttribute('data-value')).toString();
|
|
9709
10023
|
const currentFillValue = this.getFormattedValue(activeElement.getAttribute('data-value'));
|
|
9710
10024
|
if (this.getModuleName() === 'combobox') {
|
|
9711
|
-
if (!this.isSelected && this.previousValue !== currentFillValue) {
|
|
10025
|
+
if (!this.isSelected && ((!this.allowObjectBinding && this.previousValue !== currentFillValue)) || (this.allowObjectBinding && this.previousValue && currentFillValue && !this.isObjectInArray(this.previousValue, [this.getDataByValue(currentFillValue)]))) {
|
|
9712
10026
|
this.updateSelectedItem(activeElement, null);
|
|
9713
10027
|
this.isSelected = true;
|
|
9714
|
-
this.previousValue = this.getFormattedValue(activeElement.getAttribute('data-value'));
|
|
10028
|
+
this.previousValue = this.allowObjectBinding ? this.getDataByValue(this.getFormattedValue(activeElement.getAttribute('data-value'))) : this.getFormattedValue(activeElement.getAttribute('data-value'));
|
|
9715
10029
|
}
|
|
9716
10030
|
else {
|
|
9717
10031
|
this.updateSelectedItem(activeElement, null, true);
|
|
@@ -9880,15 +10194,17 @@ let ComboBox = class ComboBox extends DropDownList {
|
|
|
9880
10194
|
super.dropDownClick(e);
|
|
9881
10195
|
}
|
|
9882
10196
|
customValue(e) {
|
|
9883
|
-
|
|
10197
|
+
let value = this.getValueByText(this.inputElement.value);
|
|
9884
10198
|
if (!this.allowCustom && this.inputElement.value !== '') {
|
|
9885
10199
|
const previousValue = this.previousValue;
|
|
9886
10200
|
const currentValue = this.value;
|
|
10201
|
+
value = this.allowObjectBinding ? this.getDataByValue(value) : value;
|
|
9887
10202
|
this.setProperties({ value: value });
|
|
9888
10203
|
if (isNullOrUndefined(this.value)) {
|
|
9889
10204
|
Input.setValue('', this.inputElement, this.floatLabelType, this.showClearButton);
|
|
9890
10205
|
}
|
|
9891
|
-
|
|
10206
|
+
const newValue = this.allowObjectBinding && !isNullOrUndefined(this.value) ? getValue((this.fields.value) ? this.fields.value : '', this.value) : this.value;
|
|
10207
|
+
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])))) {
|
|
9892
10208
|
this.onChangeEvent(null);
|
|
9893
10209
|
}
|
|
9894
10210
|
}
|
|
@@ -9898,6 +10214,7 @@ let ComboBox = class ComboBox extends DropDownList {
|
|
|
9898
10214
|
const value = this.inputElement.value === '' ? null : this.inputElement.value;
|
|
9899
10215
|
// eslint-disable-next-line max-len
|
|
9900
10216
|
const eventArgs = { text: value, item: {} };
|
|
10217
|
+
this.isObjectCustomValue = true;
|
|
9901
10218
|
if (!this.initial) {
|
|
9902
10219
|
this.trigger('customValueSpecifier', eventArgs, (eventArgs) => {
|
|
9903
10220
|
this.updateCustomValueCallback(value, eventArgs, previousValue, e);
|
|
@@ -9909,8 +10226,9 @@ let ComboBox = class ComboBox extends DropDownList {
|
|
|
9909
10226
|
}
|
|
9910
10227
|
else {
|
|
9911
10228
|
this.isSelectCustom = false;
|
|
10229
|
+
value = this.allowObjectBinding ? this.getDataByValue(value) : value;
|
|
9912
10230
|
this.setProperties({ value: value });
|
|
9913
|
-
if (previousValue !== this.value) {
|
|
10231
|
+
if ((!this.allowObjectBinding && previousValue !== this.value) || (this.allowObjectBinding && previousValue && this.value && !this.isObjectInArray(previousValue, [this.value]))) {
|
|
9914
10232
|
this.onChangeEvent(e);
|
|
9915
10233
|
}
|
|
9916
10234
|
}
|
|
@@ -9931,16 +10249,28 @@ let ComboBox = class ComboBox extends DropDownList {
|
|
|
9931
10249
|
setValue(fields.value, value, dataItem);
|
|
9932
10250
|
}
|
|
9933
10251
|
this.itemData = dataItem;
|
|
10252
|
+
const emptyObject = {};
|
|
10253
|
+
if (this.allowObjectBinding) {
|
|
10254
|
+
let keys = this.listData && this.listData.length > 0 ? Object.keys(this.listData[0]) : Object.keys(this.itemData);
|
|
10255
|
+
if ((!(this.listData && this.listData.length > 0)) && (this.getModuleName() === 'autocomplete' || (this.getModuleName() === 'combobox' && this.allowFiltering))) {
|
|
10256
|
+
keys = this.firstItem ? Object.keys(this.firstItem) : Object.keys(this.itemData);
|
|
10257
|
+
}
|
|
10258
|
+
// Create an empty object with predefined keys
|
|
10259
|
+
keys.forEach(key => {
|
|
10260
|
+
emptyObject[key] = ((key === fields.value) || (key === fields.text)) ? getValue(fields.value, this.itemData) : null;
|
|
10261
|
+
});
|
|
10262
|
+
}
|
|
9934
10263
|
const changeData = {
|
|
9935
10264
|
text: getValue(fields.text, this.itemData),
|
|
9936
|
-
value: getValue(fields.value, this.itemData),
|
|
10265
|
+
value: this.allowObjectBinding ? emptyObject : getValue(fields.value, this.itemData),
|
|
9937
10266
|
index: null
|
|
9938
10267
|
};
|
|
9939
10268
|
this.setProperties(changeData, true);
|
|
9940
10269
|
this.setSelection(null, null);
|
|
9941
10270
|
this.isSelectCustom = true;
|
|
9942
|
-
|
|
9943
|
-
|
|
10271
|
+
this.isObjectCustomValue = false;
|
|
10272
|
+
if ((!this.allowObjectBinding && (previousValue !== this.value)) || (this.allowObjectBinding && ((previousValue == null && this.value !== null) || (previousValue && !this.isObjectInArray(previousValue, [this.value]))))) {
|
|
10273
|
+
this.onChangeEvent(e, true);
|
|
9944
10274
|
}
|
|
9945
10275
|
}
|
|
9946
10276
|
/**
|
|
@@ -9954,7 +10284,7 @@ let ComboBox = class ComboBox extends DropDownList {
|
|
|
9954
10284
|
onPropertyChanged(newProp, oldProp) {
|
|
9955
10285
|
if (this.getModuleName() === 'combobox') {
|
|
9956
10286
|
this.checkData(newProp);
|
|
9957
|
-
this.setUpdateInitial(['fields', 'query', 'dataSource'], newProp);
|
|
10287
|
+
this.setUpdateInitial(['fields', 'query', 'dataSource'], newProp, oldProp);
|
|
9958
10288
|
}
|
|
9959
10289
|
for (const prop of Object.keys(newProp)) {
|
|
9960
10290
|
switch (prop) {
|
|
@@ -10102,7 +10432,8 @@ let ComboBox = class ComboBox extends DropDownList {
|
|
|
10102
10432
|
this.customValue(e);
|
|
10103
10433
|
}
|
|
10104
10434
|
}
|
|
10105
|
-
|
|
10435
|
+
let value = this.allowObjectBinding && !isNullOrUndefined(this.value) ? getValue((this.fields.value) ? this.fields.value : '', this.value) : this.value;
|
|
10436
|
+
if (isNullOrUndefined(this.listData) && this.allowCustom && !isNullOrUndefined(inputValue) && inputValue !== value) {
|
|
10106
10437
|
this.customValue();
|
|
10107
10438
|
}
|
|
10108
10439
|
super.hidePopup(e);
|
|
@@ -10235,6 +10566,9 @@ __decorate$3([
|
|
|
10235
10566
|
__decorate$3([
|
|
10236
10567
|
Property(null)
|
|
10237
10568
|
], ComboBox.prototype, "value", void 0);
|
|
10569
|
+
__decorate$3([
|
|
10570
|
+
Property(false)
|
|
10571
|
+
], ComboBox.prototype, "allowObjectBinding", void 0);
|
|
10238
10572
|
ComboBox = __decorate$3([
|
|
10239
10573
|
NotifyPropertyChanges
|
|
10240
10574
|
], ComboBox);
|
|
@@ -10294,8 +10628,9 @@ let AutoComplete = class AutoComplete extends ComboBox {
|
|
|
10294
10628
|
}
|
|
10295
10629
|
getQuery(query) {
|
|
10296
10630
|
const filterQuery = query ? query.clone() : this.query ? this.query.clone() : new Query();
|
|
10297
|
-
|
|
10298
|
-
const
|
|
10631
|
+
let value = this.allowObjectBinding && !isNullOrUndefined(this.value) ? getValue((this.fields.value) ? this.fields.value : '', this.value) : this.value;
|
|
10632
|
+
const filterType = (this.queryString === '' && !isNullOrUndefined(value)) ? 'equal' : this.filterType;
|
|
10633
|
+
const queryString = (this.queryString === '' && !isNullOrUndefined(value)) ? value : this.queryString;
|
|
10299
10634
|
if (this.isFiltered) {
|
|
10300
10635
|
return filterQuery;
|
|
10301
10636
|
}
|
|
@@ -10321,9 +10656,48 @@ let AutoComplete = class AutoComplete extends ComboBox {
|
|
|
10321
10656
|
filterQuery.take(this.suggestionCount);
|
|
10322
10657
|
}
|
|
10323
10658
|
if (this.enableVirtualization && (!(this.dataSource instanceof DataManager) || (this.dataSource instanceof DataManager && this.virtualGroupDataSource))) {
|
|
10659
|
+
let queryTakeValue = 0;
|
|
10660
|
+
let querySkipValue = 0;
|
|
10661
|
+
if (this.query && this.query.queries.length > 0) {
|
|
10662
|
+
for (let queryElements = 0; queryElements < this.query.queries.length; queryElements++) {
|
|
10663
|
+
if (this.query.queries[queryElements].fn === 'onSkip') {
|
|
10664
|
+
querySkipValue = this.query.queries[queryElements].e.nos;
|
|
10665
|
+
}
|
|
10666
|
+
if (this.query.queries[queryElements].fn === 'onTake') {
|
|
10667
|
+
queryTakeValue = takeValue <= this.query.queries[queryElements].e.nos ? this.query.queries[queryElements].e.nos : takeValue;
|
|
10668
|
+
}
|
|
10669
|
+
}
|
|
10670
|
+
}
|
|
10671
|
+
let skipExists = false;
|
|
10672
|
+
let takeExists = false;
|
|
10673
|
+
if (filterQuery && filterQuery.queries.length > 0) {
|
|
10674
|
+
for (let queryElements = 0; queryElements < filterQuery.queries.length; queryElements++) {
|
|
10675
|
+
if (filterQuery.queries[queryElements].fn === 'onSkip') {
|
|
10676
|
+
skipExists = true;
|
|
10677
|
+
}
|
|
10678
|
+
if (filterQuery.queries[queryElements].fn === 'onTake') {
|
|
10679
|
+
takeExists = true;
|
|
10680
|
+
filterQuery.queries[queryElements].e.nos = filterQuery.queries[queryElements].e.nos <= queryTakeValue ? queryTakeValue : filterQuery.queries[queryElements].e.nos;
|
|
10681
|
+
}
|
|
10682
|
+
}
|
|
10683
|
+
}
|
|
10324
10684
|
var takeValue = this.getTakeValue();
|
|
10325
|
-
|
|
10326
|
-
|
|
10685
|
+
if (!skipExists) {
|
|
10686
|
+
if (querySkipValue > 0 && this.virtualItemStartIndex <= querySkipValue) {
|
|
10687
|
+
filterQuery.skip(querySkipValue);
|
|
10688
|
+
}
|
|
10689
|
+
else {
|
|
10690
|
+
filterQuery.skip(this.virtualItemStartIndex);
|
|
10691
|
+
}
|
|
10692
|
+
}
|
|
10693
|
+
if (!takeExists) {
|
|
10694
|
+
if (queryTakeValue > 0 && takeValue <= queryTakeValue) {
|
|
10695
|
+
filterQuery.take(queryTakeValue);
|
|
10696
|
+
}
|
|
10697
|
+
else {
|
|
10698
|
+
filterQuery.take(takeValue);
|
|
10699
|
+
}
|
|
10700
|
+
}
|
|
10327
10701
|
filterQuery.requiresCount();
|
|
10328
10702
|
}
|
|
10329
10703
|
return filterQuery;
|
|
@@ -10331,6 +10705,7 @@ let AutoComplete = class AutoComplete extends ComboBox {
|
|
|
10331
10705
|
searchLists(e) {
|
|
10332
10706
|
this.isTyped = true;
|
|
10333
10707
|
this.isDataFetched = this.isSelectCustom = false;
|
|
10708
|
+
this.firstItem = this.dataSource && this.dataSource.length > 0 ? this.dataSource[0] : null;
|
|
10334
10709
|
this.checkAndResetCache();
|
|
10335
10710
|
if (isNullOrUndefined(this.list)) {
|
|
10336
10711
|
super.renderList(e, true);
|
|
@@ -10523,6 +10898,10 @@ let AutoComplete = class AutoComplete extends ComboBox {
|
|
|
10523
10898
|
setInputValue(newProp, oldProp) {
|
|
10524
10899
|
let oldValue = oldProp && oldProp.text ? oldProp.text : oldProp ? oldProp.value : oldProp;
|
|
10525
10900
|
let value = newProp && newProp.text ? newProp.text : newProp && newProp.value ? newProp.value : this.value;
|
|
10901
|
+
if (this.allowObjectBinding) {
|
|
10902
|
+
oldValue = !isNullOrUndefined(oldValue) ? getValue((this.fields.value) ? this.fields.value : '', oldValue) : oldValue;
|
|
10903
|
+
value = !isNullOrUndefined(value) ? getValue((this.fields.value) ? this.fields.value : '', value) : value;
|
|
10904
|
+
}
|
|
10526
10905
|
if (value && this.typedString === '' && !this.allowCustom && !(this.dataSource instanceof DataManager)) {
|
|
10527
10906
|
let checkFields_1 = this.typeOfData(this.dataSource).typeof === 'string' ? '' : this.fields.value;
|
|
10528
10907
|
const listLength = this.getItems().length;
|
|
@@ -10531,7 +10910,7 @@ let AutoComplete = class AutoComplete extends ComboBox {
|
|
|
10531
10910
|
new DataManager(this.dataSource).executeQuery(query.where(new Predicate(checkFields_1, 'equal', value)))
|
|
10532
10911
|
.then(function (e) {
|
|
10533
10912
|
if (e.result.length > 0) {
|
|
10534
|
-
_this.value = checkFields_1 !== '' ? e.result[0][_this.fields.value].toString() : e.result[0].toString();
|
|
10913
|
+
_this.value = checkFields_1 !== '' ? _this.allowObjectBinding ? e.result[0] : e.result[0][_this.fields.value].toString() : e.result[0].toString();
|
|
10535
10914
|
_this.addItem(e.result, listLength);
|
|
10536
10915
|
_this.updateValues();
|
|
10537
10916
|
}
|
|
@@ -10939,8 +11318,12 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
10939
11318
|
this.selectAllEventEle = [];
|
|
10940
11319
|
this.resetMainList = null;
|
|
10941
11320
|
this.resetFilteredData = false;
|
|
11321
|
+
this.preventSetCurrentData = false;
|
|
10942
11322
|
this.scrollFocusStatus = false;
|
|
10943
11323
|
this.keyDownStatus = false;
|
|
11324
|
+
this.IsScrollerAtEnd = function () {
|
|
11325
|
+
return this.list && this.list.scrollTop + this.list.clientHeight >= this.list.scrollHeight;
|
|
11326
|
+
};
|
|
10944
11327
|
}
|
|
10945
11328
|
enableRTL(state) {
|
|
10946
11329
|
if (state) {
|
|
@@ -10956,7 +11339,10 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
10956
11339
|
}
|
|
10957
11340
|
requiredModules() {
|
|
10958
11341
|
const modules = [];
|
|
10959
|
-
if (this.
|
|
11342
|
+
if (this.enableVirtualization) {
|
|
11343
|
+
modules.push({ args: [this], member: 'VirtualScroll' });
|
|
11344
|
+
}
|
|
11345
|
+
if (this.mode === 'CheckBox') {
|
|
10960
11346
|
this.isGroupChecking = this.enableGroupCheckBox;
|
|
10961
11347
|
if (this.enableGroupCheckBox) {
|
|
10962
11348
|
const prevOnChange = this.isProtectedOnChange;
|
|
@@ -11094,6 +11480,9 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
11094
11480
|
attributes(this.inputElement, { 'aria-expanded': 'true', 'aria-owns': this.element.id + '_popup', 'aria-controls': this.element.id });
|
|
11095
11481
|
this.updateAriaActiveDescendant();
|
|
11096
11482
|
if (this.isFirstClick) {
|
|
11483
|
+
if (this.enableVirtualization && this.mode === 'CheckBox' && this.value) {
|
|
11484
|
+
this.updateVirtualReOrderList();
|
|
11485
|
+
}
|
|
11097
11486
|
this.loadTemplate();
|
|
11098
11487
|
}
|
|
11099
11488
|
if (this.mode === 'CheckBox' && this.showSelectAll) {
|
|
@@ -11102,6 +11491,33 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
11102
11491
|
}
|
|
11103
11492
|
});
|
|
11104
11493
|
}
|
|
11494
|
+
updateVirtualReOrderList(isCheckBoxUpdate) {
|
|
11495
|
+
let query = this.getForQuery(this.value, true).clone();
|
|
11496
|
+
this.resetList(this.dataSource, this.fields, query);
|
|
11497
|
+
this.UpdateSkeleton();
|
|
11498
|
+
this.liCollections = this.list.querySelectorAll('.' + dropDownBaseClasses.li);
|
|
11499
|
+
this.virtualItemCount = this.itemCount;
|
|
11500
|
+
if (this.mode !== 'CheckBox') {
|
|
11501
|
+
this.totalItemCount = this.value && this.value.length ? this.totalItemCount - this.value.length : this.totalItemCount;
|
|
11502
|
+
}
|
|
11503
|
+
if (!this.list.querySelector('.e-virtual-ddl')) {
|
|
11504
|
+
var virualElement = this.createElement('div', {
|
|
11505
|
+
id: this.element.id + '_popup', className: 'e-virtual-ddl', styles: this.GetVirtualTrackHeight()
|
|
11506
|
+
});
|
|
11507
|
+
this.popupWrapper.querySelector('.e-dropdownbase').appendChild(virualElement);
|
|
11508
|
+
}
|
|
11509
|
+
else {
|
|
11510
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
11511
|
+
this.list.getElementsByClassName('e-virtual-ddl')[0].style = this.GetVirtualTrackHeight();
|
|
11512
|
+
}
|
|
11513
|
+
if (this.list.querySelector('.e-virtual-ddl-content')) {
|
|
11514
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
11515
|
+
this.list.getElementsByClassName('e-virtual-ddl-content')[0].style = this.getTransformValues();
|
|
11516
|
+
}
|
|
11517
|
+
if (isCheckBoxUpdate) {
|
|
11518
|
+
this.loadTemplate();
|
|
11519
|
+
}
|
|
11520
|
+
}
|
|
11105
11521
|
updateListItems(listItems, mainListItems) {
|
|
11106
11522
|
for (let i = 0; i < listItems.length; i++) {
|
|
11107
11523
|
this.findGroupStart(listItems[i]);
|
|
@@ -11111,19 +11527,33 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
11111
11527
|
}
|
|
11112
11528
|
loadTemplate() {
|
|
11113
11529
|
this.refreshListItems(null);
|
|
11530
|
+
if (this.enableVirtualization && this.list && this.mode === 'CheckBox') {
|
|
11531
|
+
var reOrderList = this.list.querySelectorAll('.e-reorder')[0];
|
|
11532
|
+
if (this.list.querySelector('.e-virtual-ddl-content') && reOrderList) {
|
|
11533
|
+
this.list.querySelector('.e-virtual-ddl-content').removeChild(reOrderList);
|
|
11534
|
+
}
|
|
11535
|
+
}
|
|
11114
11536
|
if (this.mode === 'CheckBox') {
|
|
11115
11537
|
this.removeFocus();
|
|
11116
11538
|
}
|
|
11117
11539
|
this.notify('reOrder', { module: 'CheckBoxSelection', enable: this.mode === 'CheckBox', e: this });
|
|
11540
|
+
this.isPreventScrollAction = true;
|
|
11118
11541
|
}
|
|
11119
11542
|
setScrollPosition() {
|
|
11120
11543
|
if (((!this.hideSelectedItem && this.mode !== 'CheckBox') || (this.mode === 'CheckBox' && !this.enableSelectionOrder)) &&
|
|
11121
11544
|
(!isNullOrUndefined(this.value) && (this.value.length > 0))) {
|
|
11122
|
-
const
|
|
11545
|
+
const value = this.allowObjectBinding ? getValue((this.fields.value) ? this.fields.value : '', this.value[this.value.length - 1]) : this.value[this.value.length - 1];
|
|
11546
|
+
const valueEle = this.findListElement((this.hideSelectedItem ? this.ulElement : this.list), 'li', 'data-value', value);
|
|
11123
11547
|
if (!isNullOrUndefined(valueEle)) {
|
|
11124
11548
|
this.scrollBottom(valueEle);
|
|
11125
11549
|
}
|
|
11126
11550
|
}
|
|
11551
|
+
if (this.enableVirtualization) {
|
|
11552
|
+
const focusedItem = this.list.querySelector('.' + dropDownBaseClasses.focus);
|
|
11553
|
+
if (focusedItem) {
|
|
11554
|
+
this.scrollBottom(focusedItem);
|
|
11555
|
+
}
|
|
11556
|
+
}
|
|
11127
11557
|
}
|
|
11128
11558
|
focusAtFirstListItem() {
|
|
11129
11559
|
if (this.ulElement && this.ulElement.querySelector('li.'
|
|
@@ -11134,9 +11564,15 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
11134
11564
|
return;
|
|
11135
11565
|
}
|
|
11136
11566
|
else {
|
|
11137
|
-
|
|
11138
|
-
|
|
11139
|
-
|
|
11567
|
+
if (this.enableVirtualization) {
|
|
11568
|
+
element = this.ulElement.querySelector('li.'
|
|
11569
|
+
+ dropDownBaseClasses.li + ':not(.e-virtual-list)' + ':not(.e-hide-listitem)');
|
|
11570
|
+
}
|
|
11571
|
+
else {
|
|
11572
|
+
element = this.ulElement.querySelector('li.'
|
|
11573
|
+
+ dropDownBaseClasses.li + ':not(.'
|
|
11574
|
+
+ HIDE_LIST + ')');
|
|
11575
|
+
}
|
|
11140
11576
|
}
|
|
11141
11577
|
if (element !== null) {
|
|
11142
11578
|
this.removeFocus();
|
|
@@ -11151,7 +11587,8 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
11151
11587
|
}
|
|
11152
11588
|
else {
|
|
11153
11589
|
if (this.value && this.value.length) {
|
|
11154
|
-
|
|
11590
|
+
const value = this.allowObjectBinding ? getValue(((this.fields.value) ? this.fields.value : ''), this.value[this.value.length - 1]) : this.value[this.value.length - 1];
|
|
11591
|
+
Search(value, this.liCollections, 'StartsWith', this.ignoreCase);
|
|
11155
11592
|
}
|
|
11156
11593
|
else {
|
|
11157
11594
|
activeElement = null;
|
|
@@ -11159,7 +11596,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
11159
11596
|
}
|
|
11160
11597
|
if (activeElement && activeElement.item !== null) {
|
|
11161
11598
|
this.addListFocus(activeElement.item);
|
|
11162
|
-
if (((this.allowCustomValue || this.allowFiltering) && this.isPopupOpen() && this.closePopupOnSelect) || this.closePopupOnSelect) {
|
|
11599
|
+
if (((this.allowCustomValue || this.allowFiltering) && this.isPopupOpen() && this.closePopupOnSelect && !this.enableVirtualization) || this.closePopupOnSelect && !this.enableVirtualization) {
|
|
11163
11600
|
this.scrollBottom(activeElement.item, activeElement.index);
|
|
11164
11601
|
}
|
|
11165
11602
|
}
|
|
@@ -11201,9 +11638,9 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
11201
11638
|
const elements = this.chipCollectionWrapper.querySelectorAll('span.' + CHIP$1);
|
|
11202
11639
|
const value = elements[elements.length - 1].getAttribute('data-value');
|
|
11203
11640
|
if (!isNullOrUndefined(this.value)) {
|
|
11204
|
-
this.tempValues = this.value.slice();
|
|
11641
|
+
this.tempValues = this.allowObjectBinding ? this.value.slice() : this.value.slice();
|
|
11205
11642
|
}
|
|
11206
|
-
let customValue = this.getFormattedValue(value);
|
|
11643
|
+
let customValue = this.allowObjectBinding ? this.getDataByValue(value) : this.getFormattedValue(value);
|
|
11207
11644
|
if (this.allowCustomValue && (value !== 'false' && customValue === false || (!isNullOrUndefined(customValue) &&
|
|
11208
11645
|
customValue.toString() === 'NaN'))) {
|
|
11209
11646
|
customValue = value;
|
|
@@ -11229,15 +11666,43 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
11229
11666
|
}
|
|
11230
11667
|
return this.targetInputElement.value;
|
|
11231
11668
|
}
|
|
11232
|
-
getForQuery(valuecheck) {
|
|
11669
|
+
getForQuery(valuecheck, isCheckbox) {
|
|
11233
11670
|
let predicate;
|
|
11234
11671
|
const field = isNullOrUndefined(this.fields.value) ? this.fields.text : this.fields.value;
|
|
11235
|
-
|
|
11236
|
-
if (
|
|
11237
|
-
|
|
11672
|
+
if (this.enableVirtualization) {
|
|
11673
|
+
if (isCheckbox) {
|
|
11674
|
+
for (let i = 0; i < valuecheck.length; i++) {
|
|
11675
|
+
const value = this.allowObjectBinding ? getValue((this.fields.value) ? this.fields.value : '', valuecheck[i]) : valuecheck[i];
|
|
11676
|
+
if (i === 0) {
|
|
11677
|
+
predicate = new Predicate(field, 'equal', value);
|
|
11678
|
+
}
|
|
11679
|
+
else {
|
|
11680
|
+
predicate = predicate.or(field, 'equal', value);
|
|
11681
|
+
}
|
|
11682
|
+
}
|
|
11683
|
+
return new Query().where(predicate);
|
|
11238
11684
|
}
|
|
11239
11685
|
else {
|
|
11240
|
-
|
|
11686
|
+
for (let i = 0; i < valuecheck.length; i++) {
|
|
11687
|
+
const value = this.allowObjectBinding ? getValue((this.fields.value) ? this.fields.value : '', valuecheck[i]) : valuecheck[i];
|
|
11688
|
+
if (i === 0) {
|
|
11689
|
+
predicate = new Predicate(field, 'notequal', value);
|
|
11690
|
+
}
|
|
11691
|
+
else {
|
|
11692
|
+
predicate = predicate.and(field, 'notequal', value);
|
|
11693
|
+
}
|
|
11694
|
+
}
|
|
11695
|
+
return new Query().where(predicate);
|
|
11696
|
+
}
|
|
11697
|
+
}
|
|
11698
|
+
else {
|
|
11699
|
+
for (let i = 0; i < valuecheck.length; i++) {
|
|
11700
|
+
if (i === 0) {
|
|
11701
|
+
predicate = new Predicate(field, 'equal', valuecheck[i]);
|
|
11702
|
+
}
|
|
11703
|
+
else {
|
|
11704
|
+
predicate = predicate.or(field, 'equal', valuecheck[i]);
|
|
11705
|
+
}
|
|
11241
11706
|
}
|
|
11242
11707
|
}
|
|
11243
11708
|
if (this.dataSource instanceof DataManager && this.dataSource.adaptor instanceof JsonAdaptor) {
|
|
@@ -11249,14 +11714,20 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
11249
11714
|
}
|
|
11250
11715
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
11251
11716
|
onActionComplete(ulElement, list, e, isUpdated) {
|
|
11717
|
+
if (this.dataSource instanceof DataManager && !isNullOrUndefined(e) && !this.virtualGroupDataSource) {
|
|
11718
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
11719
|
+
this.totalItemCount = e.count;
|
|
11720
|
+
}
|
|
11252
11721
|
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
11253
11722
|
super.onActionComplete(ulElement, list, e);
|
|
11723
|
+
this.skeletonCount = this.totalItemCount != 0 && this.totalItemCount < (this.itemCount * 2) ? 0 : this.skeletonCount;
|
|
11254
11724
|
this.updateSelectElementData(this.allowFiltering);
|
|
11255
11725
|
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
11256
11726
|
const proxy = this;
|
|
11257
|
-
if (!isNullOrUndefined(this.value) && !this.allowCustomValue) {
|
|
11727
|
+
if (!isNullOrUndefined(this.value) && !this.allowCustomValue && !this.enableVirtualization) {
|
|
11258
11728
|
for (let i = 0; i < this.value.length; i++) {
|
|
11259
|
-
const
|
|
11729
|
+
const value = this.allowObjectBinding ? getValue((this.fields.value) ? this.fields.value : '', proxy.value[i]) : proxy.value[i];
|
|
11730
|
+
const checkEle = this.findListElement(((this.allowFiltering && !isNullOrUndefined(this.mainList)) ? this.mainList : ulElement), 'li', 'data-value', value);
|
|
11260
11731
|
if (!checkEle && !(this.dataSource instanceof DataManager)) {
|
|
11261
11732
|
this.value.splice(i, 1);
|
|
11262
11733
|
i -= 1;
|
|
@@ -11344,7 +11815,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
11344
11815
|
dropDownBaseClasses.selected;
|
|
11345
11816
|
if (!isNullOrUndefined(this.value)) {
|
|
11346
11817
|
for (let index = 0; !isNullOrUndefined(this.value[index]); index++) {
|
|
11347
|
-
value = this.value[index];
|
|
11818
|
+
value = this.allowObjectBinding ? getValue((this.fields.value) ? this.fields.value : '', this.value[index]) : this.value[index];
|
|
11348
11819
|
element = this.findListElement(this.list, 'li', 'data-value', value);
|
|
11349
11820
|
if (element) {
|
|
11350
11821
|
addClass([element], className);
|
|
@@ -11443,13 +11914,13 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
11443
11914
|
checkSelectAll() {
|
|
11444
11915
|
const groupItemLength = this.list.querySelectorAll('li.e-list-group-item.e-active').length;
|
|
11445
11916
|
const listItem = this.list.querySelectorAll('li.e-list-item');
|
|
11446
|
-
const searchCount = this.list.querySelectorAll('li.' + dropDownBaseClasses.li).length;
|
|
11917
|
+
const searchCount = this.enableVirtualization ? this.list.querySelectorAll('li.' + dropDownBaseClasses.li + ':not(.e-virtual-list)').length : this.list.querySelectorAll('li.' + dropDownBaseClasses.li).length;
|
|
11447
11918
|
let searchActiveCount = this.list.querySelectorAll('li.' + dropDownBaseClasses.selected).length;
|
|
11448
11919
|
if (this.enableGroupCheckBox && !isNullOrUndefined(this.fields.groupBy)) {
|
|
11449
11920
|
searchActiveCount = searchActiveCount - groupItemLength;
|
|
11450
11921
|
}
|
|
11451
|
-
if ((searchCount === searchActiveCount || searchActiveCount === this.maximumSelectionLength)
|
|
11452
|
-
&& (this.mode === 'CheckBox' && this.showSelectAll)) {
|
|
11922
|
+
if ((!this.enableVirtualization && ((searchCount === searchActiveCount || searchActiveCount === this.maximumSelectionLength)
|
|
11923
|
+
&& (this.mode === 'CheckBox' && this.showSelectAll))) || (this.enableVirtualization && this.mode === 'CheckBox' && this.showSelectAll && this.virtualSelectAll && this.value && this.value.length === this.totalItemCount)) {
|
|
11453
11924
|
this.notify('checkSelectAll', { module: 'CheckBoxSelection', enable: this.mode === 'CheckBox', value: 'check' });
|
|
11454
11925
|
}
|
|
11455
11926
|
else if ((searchCount !== searchActiveCount) && (this.mode === 'CheckBox' && this.showSelectAll)) {
|
|
@@ -11486,7 +11957,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
11486
11957
|
}
|
|
11487
11958
|
this.isValidKey = (this.isPopupOpen() && e.keyCode === 8) || this.isValidKey;
|
|
11488
11959
|
this.isValidKey = e.ctrlKey && e.keyCode === 86 ? false : this.isValidKey;
|
|
11489
|
-
if (this.isValidKey) {
|
|
11960
|
+
if (this.isValidKey && this.inputElement) {
|
|
11490
11961
|
this.isValidKey = false;
|
|
11491
11962
|
this.expandTextbox();
|
|
11492
11963
|
this.showOverAllClear();
|
|
@@ -11516,7 +11987,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
11516
11987
|
return filterQuery;
|
|
11517
11988
|
}
|
|
11518
11989
|
if (this.filterAction) {
|
|
11519
|
-
if (this.targetElement() !== null) {
|
|
11990
|
+
if ((this.targetElement() !== null && !this.enableVirtualization) || (this.enableVirtualization && this.targetElement() !== null && this.targetElement().trim() !== '')) {
|
|
11520
11991
|
const dataType = this.typeOfData(this.dataSource).typeof;
|
|
11521
11992
|
if (!(this.dataSource instanceof DataManager) && dataType === 'string' || dataType === 'number') {
|
|
11522
11993
|
filterQuery.where('', this.filterType, this.targetElement(), this.ignoreCase, this.ignoreAccent);
|
|
@@ -11526,21 +11997,89 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
11526
11997
|
filterQuery.where(!isNullOrUndefined(fields.text) ? fields.text : '', this.filterType, this.targetElement(), this.ignoreCase, this.ignoreAccent);
|
|
11527
11998
|
}
|
|
11528
11999
|
}
|
|
12000
|
+
if (this.enableVirtualization && (this.viewPortInfo.endIndex != 0) && !this.virtualSelectAll) {
|
|
12001
|
+
return this.virtualFilterQuery(filterQuery);
|
|
12002
|
+
}
|
|
11529
12003
|
return filterQuery;
|
|
11530
12004
|
}
|
|
11531
12005
|
else {
|
|
12006
|
+
if (this.enableVirtualization && (this.viewPortInfo.endIndex != 0) && !this.virtualSelectAll && (!(this.dataSource instanceof DataManager) || (this.dataSource instanceof DataManager && this.virtualGroupDataSource))) {
|
|
12007
|
+
return this.virtualFilterQuery(filterQuery);
|
|
12008
|
+
}
|
|
11532
12009
|
return query ? query : this.query ? this.query : new Query();
|
|
11533
12010
|
}
|
|
11534
12011
|
}
|
|
12012
|
+
virtualFilterQuery(filterQuery) {
|
|
12013
|
+
var takeValue = this.getTakeValue();
|
|
12014
|
+
var isReOrder = true;
|
|
12015
|
+
var isSkip = true;
|
|
12016
|
+
var isTake = true;
|
|
12017
|
+
for (let queryElements = 0; queryElements < filterQuery.queries.length; queryElements++) {
|
|
12018
|
+
if (this.getModuleName() === 'multiselect' && ((filterQuery.queries[queryElements].e && filterQuery.queries[queryElements].e.condition == 'or') || (filterQuery.queries[queryElements].e && filterQuery.queries[queryElements].e.operator == 'equal'))) {
|
|
12019
|
+
isReOrder = false;
|
|
12020
|
+
}
|
|
12021
|
+
if (filterQuery.queries[queryElements].fn === 'onSkip') {
|
|
12022
|
+
isSkip = false;
|
|
12023
|
+
}
|
|
12024
|
+
if (filterQuery.queries[queryElements].fn === 'onTake') {
|
|
12025
|
+
isTake = false;
|
|
12026
|
+
}
|
|
12027
|
+
}
|
|
12028
|
+
if ((this.allowFiltering && isSkip) || !isReOrder || (!this.allowFiltering && isSkip)) {
|
|
12029
|
+
if (!isReOrder) {
|
|
12030
|
+
filterQuery.skip(this.viewPortInfo.startIndex);
|
|
12031
|
+
}
|
|
12032
|
+
else {
|
|
12033
|
+
filterQuery.skip(this.virtualItemStartIndex);
|
|
12034
|
+
}
|
|
12035
|
+
}
|
|
12036
|
+
if (isTake) {
|
|
12037
|
+
if (this.isIncrementalRequest) {
|
|
12038
|
+
filterQuery.take(this.incrementalEndIndex);
|
|
12039
|
+
}
|
|
12040
|
+
else {
|
|
12041
|
+
filterQuery.take(takeValue);
|
|
12042
|
+
}
|
|
12043
|
+
}
|
|
12044
|
+
filterQuery.requiresCount();
|
|
12045
|
+
return filterQuery;
|
|
12046
|
+
}
|
|
12047
|
+
getTakeValue() {
|
|
12048
|
+
return this.allowFiltering && Browser.isDevice ? Math.round(window.outerHeight / this.listItemHeight) : this.itemCount;
|
|
12049
|
+
}
|
|
11535
12050
|
dataUpdater(dataSource, query, fields) {
|
|
11536
12051
|
this.isDataFetched = false;
|
|
12052
|
+
let isNoData = this.list.classList.contains(dropDownBaseClasses.noData);
|
|
11537
12053
|
if (this.targetElement().trim() === '') {
|
|
11538
|
-
const list = this.mainList.cloneNode ? this.mainList.cloneNode(true) : this.mainList;
|
|
12054
|
+
const list = this.enableVirtualization ? this.list.cloneNode(true) : this.mainList.cloneNode ? this.mainList.cloneNode(true) : this.mainList;
|
|
11539
12055
|
if (this.backCommand) {
|
|
11540
12056
|
this.remoteCustomValue = false;
|
|
11541
12057
|
if (this.allowCustomValue && list.querySelectorAll('li').length == 0 && this.mainData.length > 0) {
|
|
11542
12058
|
this.mainData = [];
|
|
11543
12059
|
}
|
|
12060
|
+
if (this.enableVirtualization) {
|
|
12061
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
12062
|
+
this.totalItemCount = this.dataSource && this.dataSource.length ? this.dataSource.length : 0;
|
|
12063
|
+
this.resetList(dataSource, fields, query);
|
|
12064
|
+
if (this.mode !== 'CheckBox') {
|
|
12065
|
+
this.totalItemCount = this.value && this.value.length ? this.totalItemCount - this.value.length : this.totalItemCount;
|
|
12066
|
+
}
|
|
12067
|
+
this.UpdateSkeleton();
|
|
12068
|
+
if ((isNoData || this.allowCustomValue) && !this.list.classList.contains(dropDownBaseClasses.noData)) {
|
|
12069
|
+
if (!this.list.querySelector('.e-virtual-ddl-content')) {
|
|
12070
|
+
this.list.appendChild(this.createElement('div', {
|
|
12071
|
+
className: 'e-virtual-ddl-content',
|
|
12072
|
+
styles: this.getTransformValues()
|
|
12073
|
+
})).appendChild(this.list.querySelector('.e-list-parent'));
|
|
12074
|
+
}
|
|
12075
|
+
if (!this.list.querySelector('.e-virtual-ddl')) {
|
|
12076
|
+
var virualElement = this.createElement('div', {
|
|
12077
|
+
id: this.element.id + '_popup', className: 'e-virtual-ddl', styles: this.GetVirtualTrackHeight()
|
|
12078
|
+
});
|
|
12079
|
+
document.getElementsByClassName('e-popup')[0].querySelector('.e-dropdownbase').appendChild(virualElement);
|
|
12080
|
+
}
|
|
12081
|
+
}
|
|
12082
|
+
}
|
|
11544
12083
|
this.onActionComplete(list, this.mainData);
|
|
11545
12084
|
if (this.value && this.value.length) {
|
|
11546
12085
|
this.refreshSelection();
|
|
@@ -11552,7 +12091,30 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
11552
12091
|
}
|
|
11553
12092
|
}
|
|
11554
12093
|
else {
|
|
12094
|
+
if (this.enableVirtualization && this.allowFiltering) {
|
|
12095
|
+
this.isPreventScrollAction = true;
|
|
12096
|
+
this.list.scrollTop = 0;
|
|
12097
|
+
this.previousStartIndex = 0;
|
|
12098
|
+
this.virtualListInfo = null;
|
|
12099
|
+
}
|
|
11555
12100
|
this.resetList(dataSource, fields, query);
|
|
12101
|
+
if (this.enableVirtualization && (isNoData || this.allowCustomValue) && !this.list.classList.contains(dropDownBaseClasses.noData)) {
|
|
12102
|
+
if (!this.list.querySelector('.e-virtual-ddl-content')) {
|
|
12103
|
+
this.list.appendChild(this.createElement('div', {
|
|
12104
|
+
className: 'e-virtual-ddl-content',
|
|
12105
|
+
styles: this.getTransformValues()
|
|
12106
|
+
})).appendChild(this.list.querySelector('.e-list-parent'));
|
|
12107
|
+
}
|
|
12108
|
+
if (this.mode !== 'CheckBox') {
|
|
12109
|
+
this.totalItemCount = this.value && this.value.length ? this.totalItemCount - this.value.length : this.totalItemCount;
|
|
12110
|
+
}
|
|
12111
|
+
if (!this.list.querySelector('.e-virtual-ddl')) {
|
|
12112
|
+
var virualElement = this.createElement('div', {
|
|
12113
|
+
id: this.element.id + '_popup', className: 'e-virtual-ddl', styles: this.GetVirtualTrackHeight()
|
|
12114
|
+
});
|
|
12115
|
+
document.getElementsByClassName('e-popup')[0].querySelector('.e-dropdownbase').appendChild(virualElement);
|
|
12116
|
+
}
|
|
12117
|
+
}
|
|
11556
12118
|
if (this.allowCustomValue) {
|
|
11557
12119
|
if (!(dataSource instanceof DataManager)) {
|
|
11558
12120
|
this.checkForCustomValue(query, fields);
|
|
@@ -11563,6 +12125,9 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
11563
12125
|
}
|
|
11564
12126
|
}
|
|
11565
12127
|
}
|
|
12128
|
+
if (this.enableVirtualization && this.allowFiltering) {
|
|
12129
|
+
this.getFilteringSkeletonCount();
|
|
12130
|
+
}
|
|
11566
12131
|
this.refreshPopup();
|
|
11567
12132
|
if (this.mode === 'CheckBox') {
|
|
11568
12133
|
this.removeFocus();
|
|
@@ -11576,7 +12141,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
11576
12141
|
const customData = (!isNullOrUndefined(this.mainData) && this.mainData.length > 0) ?
|
|
11577
12142
|
this.mainData[0] : this.mainData;
|
|
11578
12143
|
if (customData && typeof (customData) !== 'string' && typeof (customData) !== 'number' && typeof (customData) !== 'boolean') {
|
|
11579
|
-
|
|
12144
|
+
let dataItem = {};
|
|
11580
12145
|
setValue(field.text, value, dataItem);
|
|
11581
12146
|
if (typeof getValue((this.fields.value ? this.fields.value : 'value'), customData)
|
|
11582
12147
|
=== 'number') {
|
|
@@ -11585,9 +12150,34 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
11585
12150
|
else {
|
|
11586
12151
|
setValue(field.value, value, dataItem);
|
|
11587
12152
|
}
|
|
11588
|
-
const
|
|
11589
|
-
|
|
11590
|
-
|
|
12153
|
+
const emptyObject = {};
|
|
12154
|
+
if (this.allowObjectBinding) {
|
|
12155
|
+
let keys = this.listData && this.listData.length > 0 ? Object.keys(this.listData[0]) : this.firstItem ? Object.keys(this.firstItem) : Object.keys(dataItem);
|
|
12156
|
+
// Create an empty object with predefined keys
|
|
12157
|
+
keys.forEach(key => {
|
|
12158
|
+
emptyObject[key] = ((key === fields.value) || (key === fields.text)) ? getValue(fields.value, dataItem) : null;
|
|
12159
|
+
});
|
|
12160
|
+
}
|
|
12161
|
+
dataItem = this.allowObjectBinding ? emptyObject : dataItem;
|
|
12162
|
+
if (this.enableVirtualization) {
|
|
12163
|
+
this.virtualCustomData = dataItem;
|
|
12164
|
+
let tempData = this.virtualGroupDataSource ? JSON.parse(JSON.stringify(this.virtualGroupDataSource)) : JSON.parse(JSON.stringify(this.dataSource));
|
|
12165
|
+
let totalData = [];
|
|
12166
|
+
if (this.virtualCustomSelectData && this.virtualCustomSelectData.length > 0) {
|
|
12167
|
+
totalData = tempData.concat(this.virtualCustomSelectData);
|
|
12168
|
+
}
|
|
12169
|
+
tempData.splice(0, 0, dataItem);
|
|
12170
|
+
this.isCustomDataUpdated = true;
|
|
12171
|
+
this.viewPortInfo.startIndex = this.virtualItemStartIndex = 0;
|
|
12172
|
+
this.viewPortInfo.endIndex = this.virtualItemEndIndex = this.itemCount;
|
|
12173
|
+
this.resetList(tempData, field, query);
|
|
12174
|
+
this.isCustomDataUpdated = false;
|
|
12175
|
+
}
|
|
12176
|
+
else {
|
|
12177
|
+
const tempData = JSON.parse(JSON.stringify(this.listData));
|
|
12178
|
+
tempData.splice(0, 0, dataItem);
|
|
12179
|
+
this.resetList(tempData, field, query);
|
|
12180
|
+
}
|
|
11591
12181
|
}
|
|
11592
12182
|
else if (this.listData) {
|
|
11593
12183
|
const tempData = JSON.parse(JSON.stringify(this.listData));
|
|
@@ -11621,6 +12211,8 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
11621
12211
|
}
|
|
11622
12212
|
wrapperClick(e) {
|
|
11623
12213
|
this.setDynValue = false;
|
|
12214
|
+
this.keyboardEvent = null;
|
|
12215
|
+
this.isKeyBoardAction = false;
|
|
11624
12216
|
if (!this.enabled) {
|
|
11625
12217
|
return;
|
|
11626
12218
|
}
|
|
@@ -11820,8 +12412,8 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
11820
12412
|
if (this.initStatus && this.validateValues(newValue, oldValue)) {
|
|
11821
12413
|
const eventArgs = {
|
|
11822
12414
|
e: event,
|
|
11823
|
-
oldValue: oldVal,
|
|
11824
|
-
value: newVal,
|
|
12415
|
+
oldValue: this.allowObjectBinding ? oldVal : oldVal,
|
|
12416
|
+
value: this.allowObjectBinding ? newVal : newVal,
|
|
11825
12417
|
isInteracted: event ? true : false,
|
|
11826
12418
|
element: this.element,
|
|
11827
12419
|
event: event
|
|
@@ -11837,13 +12429,14 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
11837
12429
|
this.dispatchEvent(this.hiddenElement, 'change');
|
|
11838
12430
|
}
|
|
11839
12431
|
}
|
|
12432
|
+
this.selectedValueInfo = this.viewPortInfo;
|
|
11840
12433
|
}
|
|
11841
12434
|
updateTempValue() {
|
|
11842
12435
|
if (!this.value) {
|
|
11843
12436
|
this.tempValues = this.value;
|
|
11844
12437
|
}
|
|
11845
12438
|
else {
|
|
11846
|
-
this.tempValues = this.value.slice();
|
|
12439
|
+
this.tempValues = this.allowObjectBinding ? this.value.slice() : this.value.slice();
|
|
11847
12440
|
}
|
|
11848
12441
|
}
|
|
11849
12442
|
updateAriaActiveDescendant() {
|
|
@@ -11851,26 +12444,44 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
11851
12444
|
attributes(this.inputElement, { 'aria-activedescendant': this.ulElement.getElementsByClassName('e-item-focus')[0].id });
|
|
11852
12445
|
}
|
|
11853
12446
|
}
|
|
11854
|
-
|
|
11855
|
-
const height = this.list.classList.contains(dropDownBaseClasses.noData) ? null :
|
|
11856
|
-
getComputedStyle(this.getItems()[0], null).getPropertyValue('height');
|
|
11857
|
-
return Math.round(this.list.offsetHeight / parseInt(height, 10));
|
|
11858
|
-
}
|
|
11859
|
-
pageUpSelection(steps) {
|
|
12447
|
+
pageUpSelection(steps, isVirtualKeyAction) {
|
|
11860
12448
|
const collection = this.list.querySelectorAll('li.'
|
|
11861
12449
|
+ dropDownBaseClasses.li + ':not(.' + HIDE_LIST + ')' + ':not(.e-reorder-hide)');
|
|
11862
|
-
|
|
11863
|
-
this.
|
|
11864
|
-
|
|
12450
|
+
let previousItem = steps >= 0 ? collection[steps + 1] : collection[0];
|
|
12451
|
+
if (this.enableVirtualization && isVirtualKeyAction) {
|
|
12452
|
+
previousItem = steps >= 0 && this.viewPortInfo.startIndex != 0 ? this.liCollections[steps + this.skeletonCount + 1] : this.liCollections[this.skeletonCount];
|
|
12453
|
+
}
|
|
12454
|
+
if (!isNullOrUndefined(previousItem) && previousItem.classList.contains('e-virtual-list')) {
|
|
12455
|
+
previousItem = this.liCollections[this.skeletonCount];
|
|
12456
|
+
}
|
|
12457
|
+
if (this.enableVirtualization) {
|
|
12458
|
+
if (!isNullOrUndefined(previousItem) && !previousItem.classList.contains('e-item-focus')) {
|
|
12459
|
+
this.addListFocus(previousItem);
|
|
12460
|
+
this.scrollTop(previousItem, this.getIndexByValue(previousItem.getAttribute('data-value')), this.keyboardEvent.keyCode);
|
|
12461
|
+
}
|
|
12462
|
+
else if (this.viewPortInfo.startIndex == 0) {
|
|
12463
|
+
this.scrollTop(previousItem, this.getIndexByValue(previousItem.getAttribute('data-value')), this.keyboardEvent.keyCode);
|
|
12464
|
+
}
|
|
12465
|
+
}
|
|
12466
|
+
else {
|
|
12467
|
+
this.addListFocus(previousItem);
|
|
12468
|
+
this.scrollTop(previousItem, this.getIndexByValue(previousItem.getAttribute('data-value')), this.keyboardEvent.keyCode);
|
|
12469
|
+
}
|
|
11865
12470
|
}
|
|
11866
|
-
pageDownSelection(steps) {
|
|
12471
|
+
pageDownSelection(steps, isVirtualKeyAction) {
|
|
11867
12472
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
11868
12473
|
const list = this.getItems();
|
|
11869
12474
|
const collection = this.list.querySelectorAll('li.'
|
|
11870
12475
|
+ dropDownBaseClasses.li + ':not(.' + HIDE_LIST + ')' + ':not(.e-reorder-hide)');
|
|
11871
|
-
|
|
12476
|
+
let previousItem = steps <= collection.length ? collection[steps - 1] : collection[collection.length - 1];
|
|
12477
|
+
if (this.enableVirtualization && this.skeletonCount > 0) {
|
|
12478
|
+
previousItem = steps < list.length ? this.liCollections[steps] : this.liCollections[list.length - 1];
|
|
12479
|
+
}
|
|
12480
|
+
if (this.enableVirtualization && isVirtualKeyAction) {
|
|
12481
|
+
previousItem = steps <= list.length ? this.liCollections[steps] : this.liCollections[list.length - 1];
|
|
12482
|
+
}
|
|
11872
12483
|
this.addListFocus(previousItem);
|
|
11873
|
-
this.scrollBottom(previousItem, this.getIndexByValue(previousItem.getAttribute('data-value')));
|
|
12484
|
+
this.scrollBottom(previousItem, this.getIndexByValue(previousItem.getAttribute('data-value')), false, this.keyboardEvent.keyCode);
|
|
11874
12485
|
}
|
|
11875
12486
|
getItems() {
|
|
11876
12487
|
if (!this.list) {
|
|
@@ -11988,21 +12599,110 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
11988
12599
|
}
|
|
11989
12600
|
}
|
|
11990
12601
|
}
|
|
11991
|
-
homeNavigation(isHome) {
|
|
12602
|
+
homeNavigation(isHome, isVirtualKeyAction) {
|
|
11992
12603
|
this.removeFocus();
|
|
12604
|
+
if (this.enableVirtualization) {
|
|
12605
|
+
if (isHome) {
|
|
12606
|
+
if (this.enableVirtualization && this.viewPortInfo.startIndex !== 0) {
|
|
12607
|
+
this.viewPortInfo.startIndex = 0;
|
|
12608
|
+
this.viewPortInfo.endIndex = this.itemCount;
|
|
12609
|
+
this.updateVirtualItemIndex();
|
|
12610
|
+
this.resetList(this.dataSource, this.fields, this.query);
|
|
12611
|
+
}
|
|
12612
|
+
}
|
|
12613
|
+
else {
|
|
12614
|
+
if (this.enableVirtualization && ((!this.value && this.viewPortInfo.endIndex !== this.totalItemCount) || (this.value && this.value.length > 0 && this.viewPortInfo.endIndex !== this.totalItemCount + this.value.length))) {
|
|
12615
|
+
this.viewPortInfo.startIndex = this.totalItemCount - this.itemCount;
|
|
12616
|
+
this.viewPortInfo.endIndex = this.totalItemCount;
|
|
12617
|
+
this.updateVirtualItemIndex();
|
|
12618
|
+
let query = new Query().clone();
|
|
12619
|
+
if (this.value && this.value.length > 0) {
|
|
12620
|
+
query = this.getForQuery(this.value).clone();
|
|
12621
|
+
query = query.skip(this.totalItemCount - this.itemCount);
|
|
12622
|
+
}
|
|
12623
|
+
this.resetList(this.dataSource, this.fields, query);
|
|
12624
|
+
}
|
|
12625
|
+
}
|
|
12626
|
+
}
|
|
12627
|
+
this.UpdateSkeleton();
|
|
11993
12628
|
const scrollEle = this.ulElement.querySelectorAll('li.' + dropDownBaseClasses.li
|
|
11994
12629
|
+ ':not(.' + HIDE_LIST + ')' + ':not(.e-reorder-hide)');
|
|
11995
12630
|
if (scrollEle.length > 0) {
|
|
11996
|
-
|
|
12631
|
+
let element = scrollEle[(isHome) ? 0 : (scrollEle.length - 1)];
|
|
12632
|
+
if (this.enableVirtualization && isHome) {
|
|
12633
|
+
element = scrollEle[this.skeletonCount];
|
|
12634
|
+
}
|
|
12635
|
+
this.removeFocus();
|
|
11997
12636
|
element.classList.add(dropDownBaseClasses.focus);
|
|
11998
|
-
this.
|
|
12637
|
+
if (this.enableVirtualization && isHome) {
|
|
12638
|
+
this.scrollTop(element, undefined, this.keyboardEvent.keyCode);
|
|
12639
|
+
}
|
|
12640
|
+
else if (!isVirtualKeyAction) {
|
|
12641
|
+
this.scrollBottom(element, undefined, false, this.keyboardEvent.keyCode);
|
|
12642
|
+
}
|
|
11999
12643
|
this.updateAriaActiveDescendant();
|
|
12000
12644
|
}
|
|
12001
12645
|
}
|
|
12646
|
+
updateSelectionList() {
|
|
12647
|
+
if (!isNullOrUndefined(this.value) && this.value.length) {
|
|
12648
|
+
for (let index = 0; index < this.value.length; index++) {
|
|
12649
|
+
const value = this.allowObjectBinding ? getValue(((this.fields.value) ? this.fields.value : ''), this.value[index]) : this.value[index];
|
|
12650
|
+
let selectedItem = this.getElementByValue(value);
|
|
12651
|
+
if (selectedItem && !selectedItem.classList.contains(dropDownBaseClasses.selected)) {
|
|
12652
|
+
selectedItem.classList.add('e-active');
|
|
12653
|
+
}
|
|
12654
|
+
}
|
|
12655
|
+
}
|
|
12656
|
+
}
|
|
12657
|
+
handleVirtualKeyboardActions(e, pageCount) {
|
|
12658
|
+
const focusedItem = this.list.querySelector('.' + dropDownBaseClasses.focus);
|
|
12659
|
+
let activeIndex;
|
|
12660
|
+
this.isKeyBoardAction = true;
|
|
12661
|
+
switch (e.keyCode) {
|
|
12662
|
+
case 40:
|
|
12663
|
+
this.arrowDown(e, true);
|
|
12664
|
+
break;
|
|
12665
|
+
case 38:
|
|
12666
|
+
this.arrowUp(e, true);
|
|
12667
|
+
break;
|
|
12668
|
+
case 33:
|
|
12669
|
+
e.preventDefault();
|
|
12670
|
+
if (focusedItem) {
|
|
12671
|
+
var count = (this.getPageCount() * 2) - 4;
|
|
12672
|
+
activeIndex = Math.round(count);
|
|
12673
|
+
activeIndex = this.getIndexByValue(focusedItem.getAttribute('data-value'));
|
|
12674
|
+
this.pageUpSelection(activeIndex - this.getPageCount(), true);
|
|
12675
|
+
this.updateAriaAttribute();
|
|
12676
|
+
}
|
|
12677
|
+
break;
|
|
12678
|
+
case 34:
|
|
12679
|
+
e.preventDefault();
|
|
12680
|
+
if (focusedItem) {
|
|
12681
|
+
activeIndex = this.getIndexByValue(focusedItem.getAttribute('data-value'));
|
|
12682
|
+
this.pageDownSelection(activeIndex + this.getPageCount() + 1, true);
|
|
12683
|
+
this.updateAriaAttribute();
|
|
12684
|
+
}
|
|
12685
|
+
break;
|
|
12686
|
+
case 35:
|
|
12687
|
+
case 36:
|
|
12688
|
+
this.isMouseScrollAction = true;
|
|
12689
|
+
this.homeNavigation((e.keyCode === 36) ? true : false, true);
|
|
12690
|
+
this.isPreventScrollAction = true;
|
|
12691
|
+
break;
|
|
12692
|
+
}
|
|
12693
|
+
this.keyboardEvent = null;
|
|
12694
|
+
this.isScrollChanged = true;
|
|
12695
|
+
this.isKeyBoardAction = false;
|
|
12696
|
+
}
|
|
12002
12697
|
onKeyDown(e) {
|
|
12003
12698
|
if (this.readonly || !this.enabled && this.mode !== 'CheckBox') {
|
|
12004
12699
|
return;
|
|
12005
12700
|
}
|
|
12701
|
+
this.preventSetCurrentData = false;
|
|
12702
|
+
this.keyboardEvent = e;
|
|
12703
|
+
if (this.isPreventKeyAction && this.enableVirtualization) {
|
|
12704
|
+
e.preventDefault();
|
|
12705
|
+
}
|
|
12006
12706
|
this.keyCode = e.keyCode;
|
|
12007
12707
|
this.keyDownStatus = true;
|
|
12008
12708
|
if (e.keyCode > 111 && e.keyCode < 124) {
|
|
@@ -12015,16 +12715,18 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
12015
12715
|
else if (this.isPopupOpen()) {
|
|
12016
12716
|
const focusedItem = this.list.querySelector('.' + dropDownBaseClasses.focus);
|
|
12017
12717
|
let activeIndex;
|
|
12718
|
+
this.isKeyBoardAction = true;
|
|
12018
12719
|
switch (e.keyCode) {
|
|
12019
12720
|
case 36:
|
|
12020
12721
|
case 35:
|
|
12722
|
+
this.isMouseScrollAction = true;
|
|
12021
12723
|
this.homeNavigation((e.keyCode === 36) ? true : false);
|
|
12022
12724
|
break;
|
|
12023
12725
|
case 33:
|
|
12024
12726
|
e.preventDefault();
|
|
12025
12727
|
if (focusedItem) {
|
|
12026
|
-
this.getIndexByValue(focusedItem.getAttribute('data-value'));
|
|
12027
|
-
this.pageUpSelection(activeIndex - this.
|
|
12728
|
+
activeIndex = this.getIndexByValue(focusedItem.getAttribute('data-value'));
|
|
12729
|
+
this.pageUpSelection(activeIndex - this.getPageCount() - 1);
|
|
12028
12730
|
this.updateAriaAttribute();
|
|
12029
12731
|
}
|
|
12030
12732
|
return;
|
|
@@ -12032,7 +12734,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
12032
12734
|
e.preventDefault();
|
|
12033
12735
|
if (focusedItem) {
|
|
12034
12736
|
this.getIndexByValue(focusedItem.getAttribute('data-value'));
|
|
12035
|
-
this.pageDownSelection(activeIndex + this.
|
|
12737
|
+
this.pageDownSelection(activeIndex + this.getPageCount());
|
|
12036
12738
|
this.updateAriaAttribute();
|
|
12037
12739
|
}
|
|
12038
12740
|
return;
|
|
@@ -12098,10 +12800,11 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
12098
12800
|
if (!(this.mode === 'CheckBox' && this.showSelectAll)) {
|
|
12099
12801
|
this.refreshPopup();
|
|
12100
12802
|
}
|
|
12803
|
+
this.isKeyBoardAction = false;
|
|
12101
12804
|
}
|
|
12102
|
-
arrowDown(e) {
|
|
12805
|
+
arrowDown(e, isVirtualKeyAction) {
|
|
12103
12806
|
e.preventDefault();
|
|
12104
|
-
this.moveByList(1);
|
|
12807
|
+
this.moveByList(1, isVirtualKeyAction);
|
|
12105
12808
|
this.keyAction = true;
|
|
12106
12809
|
if (document.activeElement.classList.contains(FILTERINPUT)
|
|
12107
12810
|
|| (this.mode === 'CheckBox' && !this.allowFiltering && document.activeElement !== this.list)) {
|
|
@@ -12109,7 +12812,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
12109
12812
|
}
|
|
12110
12813
|
this.updateAriaAttribute();
|
|
12111
12814
|
}
|
|
12112
|
-
arrowUp(e) {
|
|
12815
|
+
arrowUp(e, isVirtualKeyAction) {
|
|
12113
12816
|
e.preventDefault();
|
|
12114
12817
|
this.keyAction = true;
|
|
12115
12818
|
let list = this.list.querySelectorAll('li.'
|
|
@@ -12127,7 +12830,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
12127
12830
|
this.keyAction = false;
|
|
12128
12831
|
this.notify('inputFocus', { module: 'CheckBoxSelection', enable: this.mode === 'CheckBox', value: 'focus' });
|
|
12129
12832
|
}
|
|
12130
|
-
this.moveByList(-1);
|
|
12833
|
+
this.moveByList(-1, isVirtualKeyAction);
|
|
12131
12834
|
this.updateAriaAttribute();
|
|
12132
12835
|
}
|
|
12133
12836
|
spaceKeySelection(e) {
|
|
@@ -12178,8 +12881,8 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
12178
12881
|
else if (e.keyCode === 8 && this.mode === 'Delimiter') {
|
|
12179
12882
|
if (this.value && this.value.length) {
|
|
12180
12883
|
e.preventDefault();
|
|
12181
|
-
const temp = this.value[this.value.length - 1];
|
|
12182
|
-
this.removeValue(
|
|
12884
|
+
const temp = this.allowObjectBinding ? getValue(((this.fields.value) ? this.fields.value : ''), this.value[this.value.length - 1]) : this.value[this.value.length - 1];
|
|
12885
|
+
this.removeValue(this.value[this.value.length - 1], e);
|
|
12183
12886
|
this.updateDelimeter(this.delimiterChar, e);
|
|
12184
12887
|
this.focusAtLastListItem(temp);
|
|
12185
12888
|
}
|
|
@@ -12193,7 +12896,10 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
12193
12896
|
}
|
|
12194
12897
|
}
|
|
12195
12898
|
escapeAction() {
|
|
12196
|
-
|
|
12899
|
+
let temp = this.tempValues ? this.tempValues.slice() : [];
|
|
12900
|
+
if (this.allowObjectBinding) {
|
|
12901
|
+
temp = this.tempValues ? this.tempValues.slice() : [];
|
|
12902
|
+
}
|
|
12197
12903
|
if (this.value && this.validateValues(this.value, temp)) {
|
|
12198
12904
|
if (this.mode !== 'CheckBox') {
|
|
12199
12905
|
this.value = temp;
|
|
@@ -12215,36 +12921,100 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
12215
12921
|
}
|
|
12216
12922
|
this.makeTextBoxEmpty();
|
|
12217
12923
|
}
|
|
12218
|
-
scrollBottom(selectedLI, activeIndex) {
|
|
12924
|
+
scrollBottom(selectedLI, activeIndex, isInitialSelection = false, keyCode = null) {
|
|
12925
|
+
if ((!isNullOrUndefined(selectedLI) && selectedLI.classList.contains('e-virtual-list')) || (this.enableVirtualization && isNullOrUndefined(selectedLI))) {
|
|
12926
|
+
selectedLI = this.liCollections[this.skeletonCount];
|
|
12927
|
+
}
|
|
12928
|
+
this.isUpwardScrolling = false;
|
|
12929
|
+
let virtualListCount = this.list.querySelectorAll('.e-virtual-list').length;
|
|
12930
|
+
let lastElementValue = this.list.querySelector('li:last-of-type') ? this.list.querySelector('li:last-of-type').getAttribute('data-value') : null;
|
|
12931
|
+
let selectedLiOffsetTop = this.virtualListInfo && this.virtualListInfo.startIndex ? selectedLI.offsetTop + (this.virtualListInfo.startIndex * selectedLI.offsetHeight) : selectedLI.offsetTop;
|
|
12219
12932
|
const currentOffset = this.list.offsetHeight;
|
|
12220
|
-
|
|
12221
|
-
|
|
12222
|
-
let
|
|
12933
|
+
let nextBottom = selectedLiOffsetTop - (virtualListCount * selectedLI.offsetHeight) + selectedLI.offsetHeight - this.list.scrollTop;
|
|
12934
|
+
let nextOffset = this.list.scrollTop + nextBottom - currentOffset;
|
|
12935
|
+
let isScrollerCHanged = false;
|
|
12936
|
+
let boxRange = selectedLiOffsetTop - (virtualListCount * selectedLI.offsetHeight) + selectedLI.offsetHeight - this.list.scrollTop;
|
|
12223
12937
|
boxRange = this.fields.groupBy && !isNullOrUndefined(this.fixedHeaderElement) ?
|
|
12224
12938
|
boxRange - this.fixedHeaderElement.offsetHeight : boxRange;
|
|
12225
|
-
if (activeIndex === 0) {
|
|
12939
|
+
if (activeIndex === 0 && !this.enableVirtualization) {
|
|
12226
12940
|
this.list.scrollTop = 0;
|
|
12227
12941
|
}
|
|
12228
|
-
else if (nextBottom > currentOffset) {
|
|
12229
|
-
|
|
12230
|
-
|
|
12231
|
-
|
|
12232
|
-
|
|
12942
|
+
else if (nextBottom > currentOffset || !(boxRange > 0 && this.list.offsetHeight > boxRange)) {
|
|
12943
|
+
let currentElementValue = selectedLI ? selectedLI.getAttribute('data-value') : null;
|
|
12944
|
+
var liCount = keyCode == 34 ? this.getPageCount() - 1 : 1;
|
|
12945
|
+
if (!this.enableVirtualization || this.isKeyBoardAction || isInitialSelection) {
|
|
12946
|
+
if (this.isKeyBoardAction && this.enableVirtualization && lastElementValue && currentElementValue === lastElementValue && keyCode != 35 && !this.isVirtualScrolling) {
|
|
12947
|
+
this.isPreventKeyAction = true;
|
|
12948
|
+
this.list.scrollTop += selectedLI.offsetHeight * liCount;
|
|
12949
|
+
this.isPreventKeyAction = this.IsScrollerAtEnd() ? false : this.isPreventKeyAction;
|
|
12950
|
+
this.isKeyBoardAction = false;
|
|
12951
|
+
this.isPreventScrollAction = false;
|
|
12952
|
+
}
|
|
12953
|
+
else if (this.enableVirtualization && keyCode == 35) {
|
|
12954
|
+
this.isPreventKeyAction = false;
|
|
12955
|
+
this.isKeyBoardAction = false;
|
|
12956
|
+
this.isPreventScrollAction = false;
|
|
12957
|
+
this.list.scrollTop = this.list.scrollHeight;
|
|
12958
|
+
}
|
|
12959
|
+
else {
|
|
12960
|
+
if (keyCode == 34 && this.enableVirtualization && !this.isVirtualScrolling) {
|
|
12961
|
+
this.isPreventKeyAction = false;
|
|
12962
|
+
this.isKeyBoardAction = false;
|
|
12963
|
+
this.isPreventScrollAction = false;
|
|
12964
|
+
nextOffset = nextOffset + (selectedLI.offsetHeight * liCount);
|
|
12965
|
+
}
|
|
12966
|
+
this.list.scrollTop = nextOffset;
|
|
12967
|
+
}
|
|
12968
|
+
}
|
|
12969
|
+
else {
|
|
12970
|
+
this.list.scrollTop = this.virtualListInfo && this.virtualListInfo.startIndex ? this.virtualListInfo.startIndex * this.listItemHeight : 0;
|
|
12971
|
+
}
|
|
12972
|
+
isScrollerCHanged = this.isKeyBoardAction;
|
|
12973
|
+
|
|
12233
12974
|
}
|
|
12975
|
+
this.isKeyBoardAction = isScrollerCHanged;
|
|
12234
12976
|
}
|
|
12235
|
-
scrollTop(selectedLI, activeIndex) {
|
|
12236
|
-
let
|
|
12977
|
+
scrollTop(selectedLI, activeIndex, keyCode = null) {
|
|
12978
|
+
let virtualListCount = this.list.querySelectorAll('.e-virtual-list').length;
|
|
12979
|
+
let selectedLiOffsetTop = (this.virtualListInfo && this.virtualListInfo.startIndex) ? selectedLI.offsetTop + (this.virtualListInfo.startIndex * selectedLI.offsetHeight) : selectedLI.offsetTop;
|
|
12980
|
+
let nextOffset = selectedLiOffsetTop - (virtualListCount * selectedLI.offsetHeight) - this.list.scrollTop;
|
|
12981
|
+
let 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;
|
|
12237
12982
|
nextOffset = this.fields.groupBy && !isUndefined(this.fixedHeaderElement) ?
|
|
12238
12983
|
nextOffset - this.fixedHeaderElement.offsetHeight : nextOffset;
|
|
12239
|
-
|
|
12240
|
-
|
|
12984
|
+
let boxRange = (selectedLiOffsetTop - (virtualListCount * selectedLI.offsetHeight) + selectedLI.offsetHeight - this.list.scrollTop);
|
|
12985
|
+
let isPageUpKeyAction = this.enableVirtualization && this.getModuleName() === 'autocomplete' && nextOffset <= 0;
|
|
12986
|
+
if (activeIndex === 0 && !this.enableVirtualization) {
|
|
12241
12987
|
this.list.scrollTop = 0;
|
|
12242
12988
|
}
|
|
12243
|
-
else if (nextOffset < 0) {
|
|
12244
|
-
|
|
12989
|
+
else if (nextOffset < 0 || isPageUpKeyAction) {
|
|
12990
|
+
var currentElementValue = selectedLI ? selectedLI.getAttribute('data-value') : null;
|
|
12991
|
+
var liCount = keyCode == 33 ? this.getPageCount() - 2 : 1;
|
|
12992
|
+
if (this.enableVirtualization && this.isKeyBoardAction && firstElementValue && currentElementValue === firstElementValue && keyCode != 36 && !this.isVirtualScrolling) {
|
|
12993
|
+
this.isUpwardScrolling = true;
|
|
12994
|
+
this.isPreventKeyAction = true;
|
|
12995
|
+
this.list.scrollTop -= selectedLI.offsetHeight * liCount;
|
|
12996
|
+
this.isPreventKeyAction = this.list.scrollTop != 0 ? this.isPreventKeyAction : false;
|
|
12997
|
+
this.isKeyBoardAction = false;
|
|
12998
|
+
this.isPreventScrollAction = false;
|
|
12999
|
+
}
|
|
13000
|
+
else if (this.enableVirtualization && keyCode == 36) {
|
|
13001
|
+
this.isPreventScrollAction = false;
|
|
13002
|
+
this.isPreventKeyAction = true;
|
|
13003
|
+
this.isKeyBoardAction = false;
|
|
13004
|
+
this.list.scrollTo(0, 0);
|
|
13005
|
+
}
|
|
13006
|
+
else {
|
|
13007
|
+
if (keyCode == 33 && this.enableVirtualization && !this.isVirtualScrolling) {
|
|
13008
|
+
this.isPreventKeyAction = false;
|
|
13009
|
+
this.isKeyBoardAction = false;
|
|
13010
|
+
this.isPreventScrollAction = false;
|
|
13011
|
+
nextOffset = nextOffset - (selectedLI.offsetHeight * liCount);
|
|
13012
|
+
}
|
|
13013
|
+
this.list.scrollTop = this.list.scrollTop + nextOffset;
|
|
13014
|
+
}
|
|
12245
13015
|
}
|
|
12246
13016
|
else if (!(boxRange > 0 && this.list.offsetHeight > boxRange)) {
|
|
12247
|
-
this.list.scrollTop = selectedLI.offsetTop - (this.fields.groupBy && !
|
|
13017
|
+
this.list.scrollTop = selectedLI.offsetTop - (this.fields.groupBy && !isNullOrUndefined(this.fixedHeaderElement) ?
|
|
12248
13018
|
this.fixedHeaderElement.offsetHeight : 0);
|
|
12249
13019
|
}
|
|
12250
13020
|
}
|
|
@@ -12331,7 +13101,19 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
12331
13101
|
if ((this.allowFiltering || (this.mode === 'CheckBox' && this.enableSelectionOrder === true)
|
|
12332
13102
|
|| this.allowCustomValue) && this.mainList && this.listData) {
|
|
12333
13103
|
const list = this.mainList.cloneNode ? this.mainList.cloneNode(true) : this.mainList;
|
|
12334
|
-
|
|
13104
|
+
if (this.enableVirtualization) {
|
|
13105
|
+
if (this.allowCustomValue && this.virtualCustomData && data == null && this.virtualCustomData && this.viewPortInfo && this.viewPortInfo.startIndex === 0 && this.viewPortInfo.endIndex === this.itemCount) {
|
|
13106
|
+
this.virtualCustomData = null;
|
|
13107
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
13108
|
+
this.renderItems(this.mainData, this.fields);
|
|
13109
|
+
}
|
|
13110
|
+
else {
|
|
13111
|
+
this.onActionComplete(this.list, this.listData);
|
|
13112
|
+
}
|
|
13113
|
+
}
|
|
13114
|
+
else {
|
|
13115
|
+
this.onActionComplete(list, this.mainData);
|
|
13116
|
+
}
|
|
12335
13117
|
this.focusAtLastListItem(data);
|
|
12336
13118
|
if (this.value && this.value.length) {
|
|
12337
13119
|
this.refreshSelection();
|
|
@@ -12346,14 +13128,15 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
12346
13128
|
let temp;
|
|
12347
13129
|
if (selectedElem !== null) {
|
|
12348
13130
|
if (!isNullOrUndefined(this.value)) {
|
|
12349
|
-
this.tempValues = this.value.slice();
|
|
13131
|
+
this.tempValues = this.allowObjectBinding ? this.value.slice() : this.value.slice();
|
|
12350
13132
|
}
|
|
12351
13133
|
temp = selectedElem.nextElementSibling;
|
|
12352
13134
|
if (temp !== null) {
|
|
12353
13135
|
this.removeChipSelection();
|
|
12354
13136
|
this.addChipSelection(temp, e);
|
|
12355
13137
|
}
|
|
12356
|
-
this.
|
|
13138
|
+
const currentChip = this.allowObjectBinding ? this.getDataByValue(selectedElem.getAttribute('data-value')) : selectedElem.getAttribute('data-value');
|
|
13139
|
+
this.removeValue(currentChip, e);
|
|
12357
13140
|
this.makeTextBoxEmpty();
|
|
12358
13141
|
}
|
|
12359
13142
|
if (this.closePopupOnSelect) {
|
|
@@ -12380,7 +13163,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
12380
13163
|
selectAllParent.classList.remove('e-item-focus');
|
|
12381
13164
|
}
|
|
12382
13165
|
}
|
|
12383
|
-
moveByList(position) {
|
|
13166
|
+
moveByList(position, isVirtualKeyAction) {
|
|
12384
13167
|
if (this.list) {
|
|
12385
13168
|
let elements = this.list.querySelectorAll('li.'
|
|
12386
13169
|
+ dropDownBaseClasses.li
|
|
@@ -12390,7 +13173,10 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
12390
13173
|
+ dropDownBaseClasses.li + ',li.' + dropDownBaseClasses.group
|
|
12391
13174
|
+ ':not(.' + HIDE_LIST + ')' + ':not(.e-reorder-hide)');
|
|
12392
13175
|
}
|
|
12393
|
-
|
|
13176
|
+
let selectedElem = this.list.querySelector('li.' + dropDownBaseClasses.focus);
|
|
13177
|
+
if (this.enableVirtualization && isVirtualKeyAction && !isNullOrUndefined(this.currentFocuedListElement)) {
|
|
13178
|
+
selectedElem = this.getElementByValue(this.getFormattedValue(this.currentFocuedListElement.getAttribute('data-value')));
|
|
13179
|
+
}
|
|
12394
13180
|
let temp = -1;
|
|
12395
13181
|
const selectAllParent = document.getElementsByClassName('e-selectall-parent')[0];
|
|
12396
13182
|
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) {
|
|
@@ -12419,22 +13205,56 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
12419
13205
|
if (position > 0) {
|
|
12420
13206
|
if (temp < (elements.length - 1)) {
|
|
12421
13207
|
this.removeFocus();
|
|
12422
|
-
this.
|
|
12423
|
-
|
|
12424
|
-
|
|
13208
|
+
if (this.enableVirtualization && isVirtualKeyAction) {
|
|
13209
|
+
this.addListFocus(elements[temp]);
|
|
13210
|
+
}
|
|
13211
|
+
else {
|
|
13212
|
+
this.addListFocus(elements[++temp]);
|
|
13213
|
+
}
|
|
13214
|
+
if (temp > -1) {
|
|
13215
|
+
this.updateCheck(elements[temp]);
|
|
13216
|
+
this.scrollBottom(elements[temp], temp);
|
|
13217
|
+
this.currentFocuedListElement = elements[temp];
|
|
13218
|
+
}
|
|
12425
13219
|
}
|
|
12426
13220
|
}
|
|
12427
13221
|
else {
|
|
12428
13222
|
if (temp > 0) {
|
|
12429
|
-
this.
|
|
12430
|
-
|
|
12431
|
-
|
|
12432
|
-
|
|
13223
|
+
if (this.enableVirtualization) {
|
|
13224
|
+
let isVirtualElement = elements[temp - 1].classList.contains('e-virtual-list');
|
|
13225
|
+
const elementIndex = isVirtualKeyAction ? temp : temp - 1;
|
|
13226
|
+
if (isVirtualKeyAction || !isVirtualElement) {
|
|
13227
|
+
this.removeFocus();
|
|
13228
|
+
}
|
|
13229
|
+
if (isVirtualKeyAction || !isVirtualElement) {
|
|
13230
|
+
this.addListFocus(elements[elementIndex]);
|
|
13231
|
+
this.updateCheck(elements[elementIndex]);
|
|
13232
|
+
this.scrollTop(elements[elementIndex], temp);
|
|
13233
|
+
this.currentFocuedListElement = elements[elementIndex];
|
|
13234
|
+
}
|
|
13235
|
+
}
|
|
13236
|
+
else {
|
|
13237
|
+
this.removeFocus();
|
|
13238
|
+
this.addListFocus(elements[--temp]);
|
|
13239
|
+
this.updateCheck(elements[temp]);
|
|
13240
|
+
this.scrollTop(elements[temp], temp);
|
|
13241
|
+
}
|
|
12433
13242
|
}
|
|
12434
13243
|
}
|
|
12435
13244
|
}
|
|
12436
13245
|
}
|
|
12437
13246
|
}
|
|
13247
|
+
getElementByValue(value) {
|
|
13248
|
+
let item;
|
|
13249
|
+
const listItems = this.getItems();
|
|
13250
|
+
for (const liItem of listItems) {
|
|
13251
|
+
if (this.getFormattedValue(liItem.getAttribute('data-value')) === value) {
|
|
13252
|
+
item = liItem;
|
|
13253
|
+
break;
|
|
13254
|
+
}
|
|
13255
|
+
}
|
|
13256
|
+
return item;
|
|
13257
|
+
}
|
|
12438
13258
|
updateCheck(element) {
|
|
12439
13259
|
if (this.mode === 'CheckBox' && this.enableGroupCheckBox &&
|
|
12440
13260
|
!isNullOrUndefined(this.fields.groupBy)) {
|
|
@@ -12496,7 +13316,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
12496
13316
|
if (this.enabled && !this.readonly) {
|
|
12497
13317
|
const element = e.target.parentElement;
|
|
12498
13318
|
const customVal = element.getAttribute('data-value');
|
|
12499
|
-
let value = this.getFormattedValue(customVal);
|
|
13319
|
+
let value = this.allowObjectBinding ? this.getDataByValue(customVal) : this.getFormattedValue(customVal);
|
|
12500
13320
|
if (this.allowCustomValue && ((customVal !== 'false' && value === false) ||
|
|
12501
13321
|
(!isNullOrUndefined(value) && value.toString() === 'NaN'))) {
|
|
12502
13322
|
value = customVal;
|
|
@@ -12508,6 +13328,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
12508
13328
|
this.inputElement.focus();
|
|
12509
13329
|
}
|
|
12510
13330
|
this.removeValue(value, e);
|
|
13331
|
+
value = this.allowObjectBinding ? getValue((this.fields.value) ? this.fields.value : '', value) : value;
|
|
12511
13332
|
if (isNullOrUndefined(this.findListElement(this.list, 'li', 'data-value', value)) && this.mainList && this.listData) {
|
|
12512
13333
|
const list = this.mainList.cloneNode ? this.mainList.cloneNode(true) : this.mainList;
|
|
12513
13334
|
this.onActionComplete(list, this.mainData);
|
|
@@ -12542,7 +13363,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
12542
13363
|
this.expandTextbox();
|
|
12543
13364
|
}
|
|
12544
13365
|
removeAllItems(value, eve, isClearAll, element, mainElement) {
|
|
12545
|
-
let index = this.value.indexOf(value);
|
|
13366
|
+
let index = this.allowObjectBinding ? this.indexOfObjectInArray(value, this.value) : this.value.indexOf(value);
|
|
12546
13367
|
const removeVal = this.value.slice(0);
|
|
12547
13368
|
removeVal.splice(index, 1);
|
|
12548
13369
|
this.setProperties({ value: [].concat([], removeVal) }, true);
|
|
@@ -12557,7 +13378,8 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
12557
13378
|
e: this, index: index
|
|
12558
13379
|
});
|
|
12559
13380
|
this.invokeCheckboxSelection(element, eve, isClearAll);
|
|
12560
|
-
this.
|
|
13381
|
+
const currentValue = this.allowObjectBinding ? getValue(((this.fields.value) ? this.fields.value : ''), value) : value;
|
|
13382
|
+
this.updateMainList(true, currentValue, mainElement);
|
|
12561
13383
|
this.updateChipStatus();
|
|
12562
13384
|
}
|
|
12563
13385
|
invokeCheckboxSelection(element, eve, isClearAll) {
|
|
@@ -12573,9 +13395,9 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
12573
13395
|
}
|
|
12574
13396
|
}
|
|
12575
13397
|
removeValue(value, eve, length, isClearAll) {
|
|
12576
|
-
let index = this.value.indexOf(this.getFormattedValue(value));
|
|
13398
|
+
let index = this.allowObjectBinding ? this.indexOfObjectInArray(value, this.value) : this.value.indexOf(this.getFormattedValue(value));
|
|
12577
13399
|
if (index === -1 && this.allowCustomValue && !isNullOrUndefined(value)) {
|
|
12578
|
-
index = this.value.indexOf(value.toString());
|
|
13400
|
+
index = this.allowObjectBinding ? this.indexOfObjectInArray(value, this.value) : this.value.indexOf(value.toString());
|
|
12579
13401
|
}
|
|
12580
13402
|
const targetEle = eve && eve.target;
|
|
12581
13403
|
isClearAll = (isClearAll || targetEle && targetEle.classList.contains('e-close-hooker')) ? true : null;
|
|
@@ -12583,7 +13405,8 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
12583
13405
|
HIDE_LIST :
|
|
12584
13406
|
dropDownBaseClasses.selected;
|
|
12585
13407
|
if (index !== -1) {
|
|
12586
|
-
const
|
|
13408
|
+
const currentValue = this.allowObjectBinding ? getValue(((this.fields.value) ? this.fields.value : ''), value) : value;
|
|
13409
|
+
const element = this.findListElement(this.list, 'li', 'data-value', currentValue);
|
|
12587
13410
|
const val = this.getDataByValue(value);
|
|
12588
13411
|
const eventArgs = {
|
|
12589
13412
|
e: eve,
|
|
@@ -12597,11 +13420,20 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
12597
13420
|
this.removeIndex++;
|
|
12598
13421
|
}
|
|
12599
13422
|
else {
|
|
12600
|
-
|
|
13423
|
+
this.virtualSelectAll = false;
|
|
13424
|
+
let removeVal = this.value.slice(0);
|
|
13425
|
+
if (this.enableVirtualization && isClearAll) {
|
|
13426
|
+
removeVal = [];
|
|
13427
|
+
}
|
|
12601
13428
|
removeVal.splice(index, 1);
|
|
12602
13429
|
this.setProperties({ value: [].concat([], removeVal) }, true);
|
|
13430
|
+
if (this.enableVirtualization) {
|
|
13431
|
+
let 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], '');
|
|
13432
|
+
this.setProperties({ text: currentText.toString() }, true);
|
|
13433
|
+
}
|
|
12603
13434
|
if (element !== null) {
|
|
12604
|
-
const
|
|
13435
|
+
const currentValue = this.allowObjectBinding ? getValue(((this.fields.value) ? this.fields.value : ''), value) : value;
|
|
13436
|
+
const hideElement = this.findListElement(this.mainList, 'li', 'data-value', currentValue);
|
|
12605
13437
|
element.setAttribute('aria-selected', 'false');
|
|
12606
13438
|
removeClass([element], className);
|
|
12607
13439
|
if (hideElement) {
|
|
@@ -12615,15 +13447,16 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
12615
13447
|
});
|
|
12616
13448
|
this.invokeCheckboxSelection(element, eve, isClearAll);
|
|
12617
13449
|
}
|
|
13450
|
+
const currentValue = this.allowObjectBinding ? getValue(((this.fields.value) ? this.fields.value : ''), value) : value;
|
|
12618
13451
|
if (this.hideSelectedItem && this.fields.groupBy && element) {
|
|
12619
|
-
this.hideGroupItem(
|
|
13452
|
+
this.hideGroupItem(currentValue);
|
|
12620
13453
|
}
|
|
12621
13454
|
if (this.hideSelectedItem && this.fixedHeaderElement && this.fields.groupBy && this.mode !== 'CheckBox' &&
|
|
12622
13455
|
this.isPopupOpen()) {
|
|
12623
13456
|
super.scrollStop();
|
|
12624
13457
|
}
|
|
12625
|
-
this.updateMainList(true,
|
|
12626
|
-
this.removeChip(
|
|
13458
|
+
this.updateMainList(true, currentValue);
|
|
13459
|
+
this.removeChip(currentValue, isClearAll);
|
|
12627
13460
|
this.updateChipStatus();
|
|
12628
13461
|
const limit = this.value && this.value.length ? this.value.length : 0;
|
|
12629
13462
|
if (limit < this.maximumSelectionLength) {
|
|
@@ -12659,6 +13492,14 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
12659
13492
|
if (isClearAll && (length === 1 || length === null)) {
|
|
12660
13493
|
this.clearAllCallback(eve, isClearAll);
|
|
12661
13494
|
}
|
|
13495
|
+
if (this.isPopupOpen() && element && element.parentElement.classList.contains('e-reorder')) {
|
|
13496
|
+
if (this.hideSelectedItem && this.value && Array.isArray(this.value) && this.value.length > 0) {
|
|
13497
|
+
this.totalItemsCount();
|
|
13498
|
+
}
|
|
13499
|
+
this.notify("setCurrentViewDataAsync", {
|
|
13500
|
+
module: "VirtualScroll",
|
|
13501
|
+
});
|
|
13502
|
+
}
|
|
12662
13503
|
}
|
|
12663
13504
|
});
|
|
12664
13505
|
}
|
|
@@ -12689,11 +13530,16 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
12689
13530
|
}
|
|
12690
13531
|
}
|
|
12691
13532
|
}
|
|
12692
|
-
removeChip(value) {
|
|
13533
|
+
removeChip(value, isClearAll) {
|
|
12693
13534
|
if (this.chipCollectionWrapper) {
|
|
12694
|
-
|
|
12695
|
-
|
|
12696
|
-
|
|
13535
|
+
if (this.enableVirtualization && isClearAll) {
|
|
13536
|
+
let childElements = this.chipCollectionWrapper.querySelectorAll('.e-chips');
|
|
13537
|
+
}
|
|
13538
|
+
else {
|
|
13539
|
+
const element = this.findListElement(this.chipCollectionWrapper, 'span', 'data-value', value);
|
|
13540
|
+
if (element) {
|
|
13541
|
+
remove(element);
|
|
13542
|
+
}
|
|
12697
13543
|
}
|
|
12698
13544
|
}
|
|
12699
13545
|
}
|
|
@@ -12727,12 +13573,40 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
12727
13573
|
this.hideOverAllClear();
|
|
12728
13574
|
}
|
|
12729
13575
|
}
|
|
13576
|
+
indexOfObjectInArray(objectToFind, array) {
|
|
13577
|
+
for (let i = 0; i < array.length; i++) {
|
|
13578
|
+
const item = array[i];
|
|
13579
|
+
if (Object.keys(objectToFind).every(key => item.hasOwnProperty(key) && item[key] === objectToFind[key])) {
|
|
13580
|
+
return i; // Return the index if the object is found
|
|
13581
|
+
}
|
|
13582
|
+
}
|
|
13583
|
+
return -1; // Return -1 if the object is not found
|
|
13584
|
+
}
|
|
12730
13585
|
addValue(value, text, eve) {
|
|
12731
13586
|
if (!this.value) {
|
|
12732
13587
|
this.value = [];
|
|
12733
13588
|
}
|
|
12734
|
-
|
|
12735
|
-
|
|
13589
|
+
let currentValue = this.allowObjectBinding ? this.getDataByValue(value) : value;
|
|
13590
|
+
if ((this.allowObjectBinding && !this.isObjectInArray(value, this.value)) || (!this.allowObjectBinding && this.value.indexOf(currentValue) < 0)) {
|
|
13591
|
+
this.setProperties({ value: [].concat([], this.value, [currentValue]) }, true);
|
|
13592
|
+
if (this.enableVirtualization) {
|
|
13593
|
+
let data = this.viewWrapper.innerHTML;
|
|
13594
|
+
let temp;
|
|
13595
|
+
data += (this.value.length === 1) ? '' : this.delimiterChar + ' ';
|
|
13596
|
+
temp = this.getOverflowVal(this.value.length - 1);
|
|
13597
|
+
data += temp;
|
|
13598
|
+
temp = this.viewWrapper.innerHTML;
|
|
13599
|
+
this.updateWrapperText(this.viewWrapper, data);
|
|
13600
|
+
}
|
|
13601
|
+
if (this.enableVirtualization && this.mode === 'CheckBox') {
|
|
13602
|
+
let temp;
|
|
13603
|
+
let currentText = [];
|
|
13604
|
+
const value = this.allowObjectBinding ? getValue(((this.fields.value) ? this.fields.value : ''), this.value[this.value.length - 1]) : this.value[this.value.length - 1];
|
|
13605
|
+
temp = this.getTextByValue(value);
|
|
13606
|
+
var textValues = this.text != null ? this.text + ',' + temp : temp;
|
|
13607
|
+
currentText.push(textValues);
|
|
13608
|
+
this.setProperties({ text: currentText.toString() }, true);
|
|
13609
|
+
}
|
|
12736
13610
|
}
|
|
12737
13611
|
const element = this.findListElement(this.list, 'li', 'data-value', value);
|
|
12738
13612
|
this.removeFocus();
|
|
@@ -12760,6 +13634,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
12760
13634
|
dispatchSelect(value, eve, element, isNotTrigger, length) {
|
|
12761
13635
|
const list = this.listData;
|
|
12762
13636
|
if (this.initStatus && !isNotTrigger) {
|
|
13637
|
+
value = this.allowObjectBinding ? getValue(((this.fields.value) ? this.fields.value : ''), value) : value;
|
|
12763
13638
|
const val = this.getDataByValue(value);
|
|
12764
13639
|
const eventArgs = {
|
|
12765
13640
|
e: eve,
|
|
@@ -12788,7 +13663,10 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
12788
13663
|
if (this.allowCustomValue && this.isServerRendered && this.listData !== list) {
|
|
12789
13664
|
this.listData = list;
|
|
12790
13665
|
}
|
|
12791
|
-
this.
|
|
13666
|
+
value = this.allowObjectBinding ? this.getDataByValue(value) : value;
|
|
13667
|
+
if ((this.enableVirtualization && value) || !this.enableVirtualization) {
|
|
13668
|
+
this.updateListSelectEventCallback(value, element, eve);
|
|
13669
|
+
}
|
|
12792
13670
|
if (this.hideSelectedItem && this.fixedHeaderElement && this.fields.groupBy && this.mode !== 'CheckBox') {
|
|
12793
13671
|
super.scrollStop();
|
|
12794
13672
|
}
|
|
@@ -12872,7 +13750,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
12872
13750
|
chipContent.innerText = data;
|
|
12873
13751
|
}
|
|
12874
13752
|
else {
|
|
12875
|
-
chipContent.innerHTML = this.encodeHtmlEntities(data);
|
|
13753
|
+
chipContent.innerHTML = this.encodeHtmlEntities(data.toString());
|
|
12876
13754
|
}
|
|
12877
13755
|
chip.appendChild(chipContent);
|
|
12878
13756
|
const eventArgs = {
|
|
@@ -12957,6 +13835,37 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
12957
13835
|
overAllHeight -= this.header.offsetHeight;
|
|
12958
13836
|
}
|
|
12959
13837
|
append([this.list], this.popupWrapper);
|
|
13838
|
+
if (!this.list.classList.contains(dropDownBaseClasses.noData) && this.getItems()[1]) {
|
|
13839
|
+
this.listItemHeight = this.getItems()[1].offsetHeight;
|
|
13840
|
+
}
|
|
13841
|
+
if (this.enableVirtualization && !this.list.classList.contains(dropDownBaseClasses.noData)) {
|
|
13842
|
+
if (!this.list.querySelector('.e-virtual-ddl-content') && this.list.querySelector('.e-list-parent')) {
|
|
13843
|
+
this.list.appendChild(this.createElement('div', {
|
|
13844
|
+
className: 'e-virtual-ddl-content',
|
|
13845
|
+
styles: this.getTransformValues()
|
|
13846
|
+
})).appendChild(this.list.querySelector('.e-list-parent'));
|
|
13847
|
+
}
|
|
13848
|
+
else if (this.list.querySelector('.e-virtual-ddl-content')) {
|
|
13849
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
13850
|
+
this.list.getElementsByClassName('e-virtual-ddl-content')[0].style = this.getTransformValues();
|
|
13851
|
+
}
|
|
13852
|
+
this.UpdateSkeleton();
|
|
13853
|
+
this.liCollections = this.list.querySelectorAll('.' + dropDownBaseClasses.li);
|
|
13854
|
+
this.virtualItemCount = this.itemCount;
|
|
13855
|
+
if (this.mode !== 'CheckBox') {
|
|
13856
|
+
this.totalItemCount = this.value && this.value.length ? this.totalItemCount - this.value.length : this.totalItemCount;
|
|
13857
|
+
}
|
|
13858
|
+
if (!this.list.querySelector('.e-virtual-ddl')) {
|
|
13859
|
+
var virualElement = this.createElement('div', {
|
|
13860
|
+
id: this.element.id + '_popup', className: 'e-virtual-ddl', styles: this.GetVirtualTrackHeight()
|
|
13861
|
+
});
|
|
13862
|
+
this.popupWrapper.querySelector('.e-dropdownbase').appendChild(virualElement);
|
|
13863
|
+
}
|
|
13864
|
+
else {
|
|
13865
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
13866
|
+
this.list.getElementsByClassName('e-virtual-ddl')[0].style = this.GetVirtualTrackHeight();
|
|
13867
|
+
}
|
|
13868
|
+
}
|
|
12960
13869
|
if (this.footerTemplate) {
|
|
12961
13870
|
this.setFooterTemplate();
|
|
12962
13871
|
overAllHeight -= this.footer.offsetHeight;
|
|
@@ -13029,21 +13938,42 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
13029
13938
|
}
|
|
13030
13939
|
this.popupObj.wireScrollEvents();
|
|
13031
13940
|
if (!(this.mode !== 'CheckBox' && (this.allowFiltering || this.allowCustomValue) &&
|
|
13032
|
-
this.targetElement().trim() !== '')) {
|
|
13941
|
+
this.targetElement().trim() !== '') && !this.enableVirtualization) {
|
|
13033
13942
|
this.loadTemplate();
|
|
13943
|
+
if (this.enableVirtualization && this.mode === 'CheckBox') {
|
|
13944
|
+
this.UpdateSkeleton();
|
|
13945
|
+
}
|
|
13034
13946
|
}
|
|
13947
|
+
this.isPreventScrollAction = true;
|
|
13035
13948
|
this.setScrollPosition();
|
|
13036
13949
|
if (this.allowFiltering) {
|
|
13037
13950
|
this.notify('inputFocus', {
|
|
13038
13951
|
module: 'CheckBoxSelection', enable: this.mode === 'CheckBox', value: 'focus'
|
|
13039
13952
|
});
|
|
13040
13953
|
}
|
|
13954
|
+
if (this.enableVirtualization) {
|
|
13955
|
+
this.notify("bindScrollEvent", {
|
|
13956
|
+
module: "VirtualScroll",
|
|
13957
|
+
component: this.getModuleName(),
|
|
13958
|
+
enable: this.enableVirtualization,
|
|
13959
|
+
});
|
|
13960
|
+
setTimeout(() => {
|
|
13961
|
+
if (this.value) {
|
|
13962
|
+
this.updateSelectionList();
|
|
13963
|
+
}
|
|
13964
|
+
else if (this.viewPortInfo && this.viewPortInfo.offsets.top) {
|
|
13965
|
+
this.list.scrollTop = this.viewPortInfo.offsets.top;
|
|
13966
|
+
}
|
|
13967
|
+
}, 5);
|
|
13968
|
+
}
|
|
13041
13969
|
}, targetExitViewport: () => {
|
|
13042
13970
|
if (!Browser.isDevice) {
|
|
13043
13971
|
this.hidePopup();
|
|
13044
13972
|
}
|
|
13045
13973
|
}
|
|
13046
13974
|
});
|
|
13975
|
+
this.checkCollision(this.popupWrapper);
|
|
13976
|
+
this.popupContentElement = this.popupObj.element.querySelector('.e-content');
|
|
13047
13977
|
if (this.mode === 'CheckBox' && Browser.isDevice && this.allowFiltering) {
|
|
13048
13978
|
this.notify('deviceSearchBox', { module: 'CheckBoxSelection', enable: this.mode === 'CheckBox' });
|
|
13049
13979
|
}
|
|
@@ -13052,6 +13982,15 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
13052
13982
|
}
|
|
13053
13983
|
}
|
|
13054
13984
|
}
|
|
13985
|
+
checkCollision(popupEle) {
|
|
13986
|
+
if (!(this.mode === 'CheckBox' && Browser.isDevice && this.allowFiltering)) {
|
|
13987
|
+
const collision = isCollide(popupEle);
|
|
13988
|
+
if (collision.length > 0) {
|
|
13989
|
+
popupEle.style.marginTop = -parseInt(getComputedStyle(popupEle).marginTop, 10) + 'px';
|
|
13990
|
+
}
|
|
13991
|
+
this.popupObj.resolveCollision();
|
|
13992
|
+
}
|
|
13993
|
+
}
|
|
13055
13994
|
setHeaderTemplate() {
|
|
13056
13995
|
let compiledString;
|
|
13057
13996
|
if (this.header) {
|
|
@@ -13101,6 +14040,53 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
13101
14040
|
append([this.footer], this.popupWrapper);
|
|
13102
14041
|
EventHandler.add(this.footer, 'mousedown', this.onListMouseDown, this);
|
|
13103
14042
|
}
|
|
14043
|
+
updateInitialData() {
|
|
14044
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14045
|
+
let currentData = this.selectData;
|
|
14046
|
+
let ulElement = this.renderItems(currentData, this.fields);
|
|
14047
|
+
this.list.scrollTop = 0;
|
|
14048
|
+
this.virtualListInfo = {
|
|
14049
|
+
currentPageNumber: null,
|
|
14050
|
+
direction: null,
|
|
14051
|
+
sentinelInfo: {},
|
|
14052
|
+
offsets: {},
|
|
14053
|
+
startIndex: 0,
|
|
14054
|
+
endIndex: 0,
|
|
14055
|
+
};
|
|
14056
|
+
this.previousStartIndex = 0;
|
|
14057
|
+
this.previousEndIndex = 0;
|
|
14058
|
+
if (this.dataSource instanceof DataManager) {
|
|
14059
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14060
|
+
this.totalItemCount = this.dataCount = this.virtualGroupDataSource && this.virtualGroupDataSource.length ? this.virtualGroupDataSource.length : 0;
|
|
14061
|
+
}
|
|
14062
|
+
else {
|
|
14063
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14064
|
+
this.totalItemCount = this.dataCount = this.dataSource && this.dataSource.length ? this.dataSource.length : 0;
|
|
14065
|
+
}
|
|
14066
|
+
if (this.mode !== 'CheckBox') {
|
|
14067
|
+
this.totalItemCount = this.value && this.value.length ? this.totalItemCount - this.value.length : this.totalItemCount;
|
|
14068
|
+
}
|
|
14069
|
+
this.getSkeletonCount();
|
|
14070
|
+
this.UpdateSkeleton();
|
|
14071
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14072
|
+
if (this.list.getElementsByClassName('e-virtual-ddl')[0]) {
|
|
14073
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14074
|
+
this.list.getElementsByClassName('e-virtual-ddl')[0].style = this.GetVirtualTrackHeight();
|
|
14075
|
+
}
|
|
14076
|
+
else if (!this.list.querySelector('.e-virtual-ddl') && this.skeletonCount > 0) {
|
|
14077
|
+
var virualElement = this.createElement('div', {
|
|
14078
|
+
id: this.element.id + '_popup', className: 'e-virtual-ddl', styles: this.GetVirtualTrackHeight()
|
|
14079
|
+
});
|
|
14080
|
+
this.popupWrapper.querySelector('.e-dropdownbase').appendChild(virualElement);
|
|
14081
|
+
}
|
|
14082
|
+
this.listData = currentData;
|
|
14083
|
+
this.liCollections = this.list.querySelectorAll('.e-list-item');
|
|
14084
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14085
|
+
if (this.list.getElementsByClassName('e-virtual-ddl-content')[0]) {
|
|
14086
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14087
|
+
this.list.getElementsByClassName('e-virtual-ddl-content')[0].style = this.getTransformValues();
|
|
14088
|
+
}
|
|
14089
|
+
}
|
|
13104
14090
|
clearAll(e) {
|
|
13105
14091
|
if (this.enabled && !this.readonly) {
|
|
13106
14092
|
let temp;
|
|
@@ -13121,6 +14107,24 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
13121
14107
|
else {
|
|
13122
14108
|
this.clearAllCallback(e);
|
|
13123
14109
|
}
|
|
14110
|
+
this.checkAndResetCache();
|
|
14111
|
+
if (this.enableVirtualization) {
|
|
14112
|
+
this.updateInitialData();
|
|
14113
|
+
if (this.chipCollectionWrapper) {
|
|
14114
|
+
this.chipCollectionWrapper.innerHTML = '';
|
|
14115
|
+
}
|
|
14116
|
+
if (!this.isCustomDataUpdated) {
|
|
14117
|
+
this.notify("setGeneratedData", {
|
|
14118
|
+
module: "VirtualScroll",
|
|
14119
|
+
});
|
|
14120
|
+
}
|
|
14121
|
+
}
|
|
14122
|
+
if (this.enableVirtualization) {
|
|
14123
|
+
this.list.scrollTop = 0;
|
|
14124
|
+
this.virtualListInfo = null;
|
|
14125
|
+
this.previousStartIndex = 0;
|
|
14126
|
+
this.previousEndIndex = 0;
|
|
14127
|
+
}
|
|
13124
14128
|
}
|
|
13125
14129
|
}
|
|
13126
14130
|
clearAllCallback(e, isClearAll) {
|
|
@@ -13219,6 +14223,8 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
13219
14223
|
}
|
|
13220
14224
|
search(e) {
|
|
13221
14225
|
this.resetFilteredData = true;
|
|
14226
|
+
this.preventSetCurrentData = false;
|
|
14227
|
+
this.firstItem = this.dataSource && this.dataSource.length > 0 ? this.dataSource[0] : null;
|
|
13222
14228
|
if (!isNullOrUndefined(e)) {
|
|
13223
14229
|
this.keyCode = e.keyCode;
|
|
13224
14230
|
}
|
|
@@ -13235,6 +14241,9 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
13235
14241
|
if (this.allowCustomValue) {
|
|
13236
14242
|
this.isRemoteSelection = true;
|
|
13237
14243
|
}
|
|
14244
|
+
if (!this.backCommand) {
|
|
14245
|
+
this.checkAndResetCache();
|
|
14246
|
+
}
|
|
13238
14247
|
const eventArgs = {
|
|
13239
14248
|
preventDefaultAction: false,
|
|
13240
14249
|
text: this.targetElement(),
|
|
@@ -13261,12 +14270,83 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
13261
14270
|
else if (this.allowCustomValue) {
|
|
13262
14271
|
let query = new Query();
|
|
13263
14272
|
query = this.allowFiltering && (text !== '') ? query.where(this.fields.text, 'startswith', text, this.ignoreCase, this.ignoreAccent) : query;
|
|
13264
|
-
|
|
14273
|
+
if (this.enableVirtualization) {
|
|
14274
|
+
if (this.dataSource instanceof DataManager) {
|
|
14275
|
+
this.dataUpdater(this.virtualGroupDataSource, query, this.fields);
|
|
14276
|
+
}
|
|
14277
|
+
else {
|
|
14278
|
+
this.dataUpdater(this.dataSource, query, this.fields);
|
|
14279
|
+
}
|
|
14280
|
+
}
|
|
14281
|
+
else {
|
|
14282
|
+
this.dataUpdater(this.mainData, query, this.fields);
|
|
14283
|
+
}
|
|
14284
|
+
this.UpdateSkeleton();
|
|
13265
14285
|
}
|
|
13266
14286
|
else {
|
|
13267
14287
|
const liCollections = this.list.querySelectorAll('li.' + dropDownBaseClasses.li + ':not(.e-hide-listitem)');
|
|
13268
|
-
const
|
|
13269
|
-
|
|
14288
|
+
const type = this.typeOfData(this.listData).typeof;
|
|
14289
|
+
let activeElement = Search(this.targetElement(), liCollections, 'StartsWith', this.ignoreCase);
|
|
14290
|
+
if (this.enableVirtualization && this.targetElement().trim() !== '' && !this.allowFiltering) {
|
|
14291
|
+
var updatingincrementalindex = false;
|
|
14292
|
+
if ((this.viewPortInfo.endIndex >= this.incrementalEndIndex && this.incrementalEndIndex <= this.totalItemCount) || this.incrementalEndIndex == 0) {
|
|
14293
|
+
updatingincrementalindex = true;
|
|
14294
|
+
this.incrementalStartIndex = 0;
|
|
14295
|
+
this.incrementalEndIndex = 100 > this.totalItemCount ? this.totalItemCount : 100;
|
|
14296
|
+
this.updateIncrementalInfo(this.incrementalStartIndex, this.incrementalEndIndex);
|
|
14297
|
+
updatingincrementalindex = false;
|
|
14298
|
+
}
|
|
14299
|
+
if (this.viewPortInfo.startIndex !== 0 || updatingincrementalindex) {
|
|
14300
|
+
this.updateIncrementalView(0, this.itemCount);
|
|
14301
|
+
}
|
|
14302
|
+
activeElement = Search(this.targetElement(), this.incrementalLiCollections, this.filterType, true, this.listData, this.fields, type);
|
|
14303
|
+
while (isNullOrUndefined(activeElement) && this.incrementalEndIndex < this.totalItemCount) {
|
|
14304
|
+
this.incrementalStartIndex = this.incrementalEndIndex;
|
|
14305
|
+
this.incrementalEndIndex = this.incrementalEndIndex + 100 > this.totalItemCount ? this.totalItemCount : this.incrementalEndIndex + 100;
|
|
14306
|
+
this.updateIncrementalInfo(this.incrementalStartIndex, this.incrementalEndIndex);
|
|
14307
|
+
updatingincrementalindex = true;
|
|
14308
|
+
if (this.viewPortInfo.startIndex !== 0 || updatingincrementalindex) {
|
|
14309
|
+
this.updateIncrementalView(0, this.itemCount);
|
|
14310
|
+
}
|
|
14311
|
+
activeElement = Search(this.targetElement(), this.incrementalLiCollections, this.filterType, true, this.listData, this.fields, type);
|
|
14312
|
+
if (!isNullOrUndefined(activeElement)) {
|
|
14313
|
+
break;
|
|
14314
|
+
}
|
|
14315
|
+
if (isNullOrUndefined(activeElement) && this.incrementalEndIndex >= this.totalItemCount) {
|
|
14316
|
+
this.incrementalStartIndex = 0;
|
|
14317
|
+
this.incrementalEndIndex = 100 > this.totalItemCount ? this.totalItemCount : 100;
|
|
14318
|
+
break;
|
|
14319
|
+
}
|
|
14320
|
+
}
|
|
14321
|
+
if (activeElement.index) {
|
|
14322
|
+
if ((!(this.viewPortInfo.startIndex >= activeElement.index)) || (!(activeElement.index >= this.viewPortInfo.endIndex))) {
|
|
14323
|
+
var startIndex = activeElement.index - ((this.itemCount / 2) - 2) > 0 ? activeElement.index - ((this.itemCount / 2) - 2) : 0;
|
|
14324
|
+
var endIndex = startIndex + this.itemCount > this.totalItemCount ? this.totalItemCount : startIndex + this.itemCount;
|
|
14325
|
+
if (startIndex != this.viewPortInfo.startIndex) {
|
|
14326
|
+
this.updateIncrementalView(startIndex, endIndex);
|
|
14327
|
+
}
|
|
14328
|
+
}
|
|
14329
|
+
}
|
|
14330
|
+
if (!isNullOrUndefined(activeElement.item)) {
|
|
14331
|
+
var index_1 = this.getIndexByValue(activeElement.item.getAttribute('data-value')) - this.skeletonCount;
|
|
14332
|
+
if (index_1 > this.itemCount / 2) {
|
|
14333
|
+
var startIndex = this.viewPortInfo.startIndex + ((this.itemCount / 2) - 2) < this.totalItemCount ? this.viewPortInfo.startIndex + ((this.itemCount / 2) - 2) : this.totalItemCount;
|
|
14334
|
+
var endIndex = this.viewPortInfo.startIndex + this.itemCount > this.totalItemCount ? this.totalItemCount : this.viewPortInfo.startIndex + this.itemCount;
|
|
14335
|
+
this.updateIncrementalView(startIndex, endIndex);
|
|
14336
|
+
}
|
|
14337
|
+
activeElement.item = this.getElementByValue(activeElement.item.getAttribute('data-value'));
|
|
14338
|
+
}
|
|
14339
|
+
else {
|
|
14340
|
+
this.updateIncrementalView(0, this.itemCount);
|
|
14341
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14342
|
+
this.list.getElementsByClassName('e-virtual-ddl-content')[0].style = this.getTransformValues();
|
|
14343
|
+
this.list.scrollTop = 0;
|
|
14344
|
+
}
|
|
14345
|
+
if (activeElement && activeElement.item) {
|
|
14346
|
+
activeElement.item = this.getElementByValue(activeElement.item.getAttribute('data-value'));
|
|
14347
|
+
}
|
|
14348
|
+
}
|
|
14349
|
+
if (activeElement && activeElement.item) {
|
|
13270
14350
|
this.addListFocus(activeElement.item);
|
|
13271
14351
|
this.list.scrollTop =
|
|
13272
14352
|
activeElement.item.offsetHeight * activeElement.index;
|
|
@@ -13279,11 +14359,15 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
13279
14359
|
}
|
|
13280
14360
|
}
|
|
13281
14361
|
}
|
|
14362
|
+
if (this.enableVirtualization && this.allowFiltering) {
|
|
14363
|
+
this.getFilteringSkeletonCount();
|
|
14364
|
+
}
|
|
13282
14365
|
}
|
|
13283
14366
|
preRender() {
|
|
13284
14367
|
if (this.allowFiltering === null) {
|
|
13285
14368
|
this.allowFiltering = (this.mode === 'CheckBox') ? true : false;
|
|
13286
14369
|
}
|
|
14370
|
+
this.preventSetCurrentData = false;
|
|
13287
14371
|
this.initializeData();
|
|
13288
14372
|
this.updateDataAttribute(this.htmlAttributes);
|
|
13289
14373
|
super.preRender();
|
|
@@ -13305,6 +14389,14 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
13305
14389
|
this.isCustomRendered = false;
|
|
13306
14390
|
this.isRemoteSelection = false;
|
|
13307
14391
|
this.isSelectAllTarget = true;
|
|
14392
|
+
this.viewPortInfo = {
|
|
14393
|
+
currentPageNumber: null,
|
|
14394
|
+
direction: null,
|
|
14395
|
+
sentinelInfo: {},
|
|
14396
|
+
offsets: {},
|
|
14397
|
+
startIndex: 0,
|
|
14398
|
+
endIndex: this.itemCount,
|
|
14399
|
+
};
|
|
13308
14400
|
}
|
|
13309
14401
|
updateData(delimiterChar, e) {
|
|
13310
14402
|
let data = '';
|
|
@@ -13312,7 +14404,9 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
13312
14404
|
const text = [];
|
|
13313
14405
|
let temp;
|
|
13314
14406
|
const tempData = this.listData;
|
|
13315
|
-
this.
|
|
14407
|
+
if (!this.enableVirtualization) {
|
|
14408
|
+
this.listData = this.mainData;
|
|
14409
|
+
}
|
|
13316
14410
|
if (!isNullOrUndefined(this.hiddenElement)) {
|
|
13317
14411
|
this.hiddenElement.innerHTML = '';
|
|
13318
14412
|
}
|
|
@@ -13320,16 +14414,32 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
13320
14414
|
let valueLength = this.value.length;
|
|
13321
14415
|
let hiddenElementContent = '';
|
|
13322
14416
|
for (let index = 0; index < valueLength; index++) {
|
|
13323
|
-
const valueItem = this.value[index];
|
|
13324
|
-
|
|
13325
|
-
if (
|
|
14417
|
+
const valueItem = this.allowObjectBinding ? getValue((this.fields.value) ? this.fields.value : '', this.value[index]) : this.value[index];
|
|
14418
|
+
let listValue = this.findListElement((!isNullOrUndefined(this.mainList) ? this.mainList : this.ulElement), 'li', 'data-value', valueItem);
|
|
14419
|
+
if (this.enableVirtualization) {
|
|
14420
|
+
listValue = this.findListElement((!isNullOrUndefined(this.list) ? this.list : this.ulElement), 'li', 'data-value', valueItem);
|
|
14421
|
+
}
|
|
14422
|
+
if (isNullOrUndefined(listValue) && !this.allowCustomValue && !this.enableVirtualization) {
|
|
13326
14423
|
this.value.splice(index, 1);
|
|
13327
14424
|
index -= 1;
|
|
13328
14425
|
valueLength -= 1;
|
|
13329
14426
|
}
|
|
13330
14427
|
else {
|
|
13331
14428
|
if (this.listData) {
|
|
13332
|
-
|
|
14429
|
+
if (this.enableVirtualization) {
|
|
14430
|
+
if (delim) {
|
|
14431
|
+
data = this.delimiterWrapper && this.delimiterWrapper.innerHTML == "" ? data : this.delimiterWrapper.innerHTML;
|
|
14432
|
+
}
|
|
14433
|
+
const value = this.allowObjectBinding ? getValue(((this.fields.value) ? this.fields.value : ''), this.value[this.value.length - 1]) : this.value[this.value.length - 1];
|
|
14434
|
+
temp = this.getTextByValue(value);
|
|
14435
|
+
let textValues = this.text != null && this.text != "" ? this.text + ',' + temp : temp;
|
|
14436
|
+
data += temp + delimiterChar + ' ';
|
|
14437
|
+
text.push(textValues);
|
|
14438
|
+
break;
|
|
14439
|
+
}
|
|
14440
|
+
else {
|
|
14441
|
+
temp = this.getTextByValue(valueItem);
|
|
14442
|
+
}
|
|
13333
14443
|
}
|
|
13334
14444
|
else {
|
|
13335
14445
|
temp = valueItem;
|
|
@@ -13343,7 +14453,10 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
13343
14453
|
this.hiddenElement.innerHTML = hiddenElementContent;
|
|
13344
14454
|
}
|
|
13345
14455
|
}
|
|
13346
|
-
|
|
14456
|
+
let isChipRemove = e && e.target && e.target.classList.contains('e-chips-close');
|
|
14457
|
+
if (!this.enableVirtualization || (this.enableVirtualization && this.mode !== 'CheckBox' && !isChipRemove)) {
|
|
14458
|
+
this.setProperties({ text: text.toString() }, true);
|
|
14459
|
+
}
|
|
13347
14460
|
if (delim) {
|
|
13348
14461
|
this.updateWrapperText(this.delimiterWrapper, data);
|
|
13349
14462
|
this.delimiterWrapper.setAttribute('id', getUniqueID('delim_val'));
|
|
@@ -13372,7 +14485,8 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
13372
14485
|
}
|
|
13373
14486
|
}
|
|
13374
14487
|
if (textVal && textVal.length) {
|
|
13375
|
-
this.
|
|
14488
|
+
const value = this.allowObjectBinding ? this.getDataByValue(textVal) : textVal;
|
|
14489
|
+
this.setProperties({ value: value }, true);
|
|
13376
14490
|
}
|
|
13377
14491
|
}
|
|
13378
14492
|
else {
|
|
@@ -13385,10 +14499,12 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
13385
14499
|
isEmptyData = true;
|
|
13386
14500
|
}
|
|
13387
14501
|
super.render(null, isEmptyData);
|
|
14502
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14503
|
+
this.totalItemCount = this.dataSource && this.dataSource.length ? this.dataSource.length : 0;
|
|
13388
14504
|
this.unwireListEvents();
|
|
13389
14505
|
this.wireListEvents();
|
|
13390
14506
|
}
|
|
13391
|
-
initialValueUpdate() {
|
|
14507
|
+
initialValueUpdate(listItems) {
|
|
13392
14508
|
if (this.list) {
|
|
13393
14509
|
let text;
|
|
13394
14510
|
let element;
|
|
@@ -13399,12 +14515,34 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
13399
14515
|
this.removeListSelection();
|
|
13400
14516
|
if (!isNullOrUndefined(this.value)) {
|
|
13401
14517
|
for (let index = 0; !isNullOrUndefined(this.value[index]); index++) {
|
|
13402
|
-
value = this.value[index];
|
|
14518
|
+
value = this.allowObjectBinding ? getValue(((this.fields.value) ? this.fields.value : ''), this.value[index]) : this.value[index];
|
|
13403
14519
|
element = this.findListElement(this.hideSelectedItem ? this.ulElement : this.list, 'li', 'data-value', value);
|
|
13404
|
-
|
|
13405
|
-
if (
|
|
14520
|
+
let isCustomData = false;
|
|
14521
|
+
if (this.enableVirtualization) {
|
|
14522
|
+
text = null;
|
|
14523
|
+
if (listItems != null && listItems.length > 0) {
|
|
14524
|
+
for (let i = 0; i < listItems.length; i++) {
|
|
14525
|
+
if (getValue((this.fields.value ? this.fields.value : 'value'), listItems[i]) === value) {
|
|
14526
|
+
text = getValue(this.fields.text, listItems[i]);
|
|
14527
|
+
break;
|
|
14528
|
+
}
|
|
14529
|
+
}
|
|
14530
|
+
}
|
|
14531
|
+
if (isNullOrUndefined(text) && this.allowCustomValue) {
|
|
14532
|
+
text = this.getTextByValue(value);
|
|
14533
|
+
isCustomData = true;
|
|
14534
|
+
}
|
|
14535
|
+
}
|
|
14536
|
+
else {
|
|
14537
|
+
text = this.getTextByValue(value);
|
|
14538
|
+
}
|
|
14539
|
+
if (((element && (element.getAttribute('aria-selected') !== 'true')) ||
|
|
13406
14540
|
(element && (element.getAttribute('aria-selected') === 'true' && this.hideSelectedItem) &&
|
|
13407
|
-
(this.mode === 'Box' || this.mode === 'Default'))) {
|
|
14541
|
+
(this.mode === 'Box' || this.mode === 'Default'))) || (this.enableVirtualization && value != null && text != null && !isCustomData)) {
|
|
14542
|
+
let currentText = [];
|
|
14543
|
+
var textValues = this.text != null ? this.text + ',' + text : text;
|
|
14544
|
+
currentText.push(textValues);
|
|
14545
|
+
this.setProperties({ text: currentText.toString() }, true);
|
|
13408
14546
|
this.addChip(text, value);
|
|
13409
14547
|
this.addListSelection(element);
|
|
13410
14548
|
}
|
|
@@ -13415,12 +14553,24 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
13415
14553
|
setValue(this.fields.value, value, newValue);
|
|
13416
14554
|
const noDataEle = this.popupWrapper.querySelector('.' + dropDownBaseClasses.noData);
|
|
13417
14555
|
this.addItem(newValue, indexItem);
|
|
14556
|
+
if (this.enableVirtualization) {
|
|
14557
|
+
if (this.virtualCustomSelectData && this.virtualCustomSelectData.length >= 0) {
|
|
14558
|
+
this.virtualCustomSelectData.push(newValue);
|
|
14559
|
+
}
|
|
14560
|
+
else {
|
|
14561
|
+
this.virtualCustomSelectData = [newValue];
|
|
14562
|
+
}
|
|
14563
|
+
}
|
|
13418
14564
|
element = element ? element : this.findListElement(this.hideSelectedItem ? this.ulElement : this.list, 'li', 'data-value', value);
|
|
13419
14565
|
if (this.popupWrapper.contains(noDataEle)) {
|
|
13420
14566
|
this.list.setAttribute('style', noDataEle.getAttribute('style'));
|
|
13421
14567
|
this.popupWrapper.replaceChild(this.list, noDataEle);
|
|
13422
14568
|
this.wireListEvents();
|
|
13423
14569
|
}
|
|
14570
|
+
let currentText = [];
|
|
14571
|
+
var textValues = this.text != null ? this.text + ',' + text : text;
|
|
14572
|
+
currentText.push(textValues);
|
|
14573
|
+
this.setProperties({ text: currentText.toString() }, true);
|
|
13424
14574
|
this.addChip(text, value);
|
|
13425
14575
|
this.addListSelection(element);
|
|
13426
14576
|
}
|
|
@@ -13450,7 +14600,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
13450
14600
|
}
|
|
13451
14601
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
13452
14602
|
updateActionCompleteData(li, item) {
|
|
13453
|
-
if (this.value && this.value.indexOf(li.getAttribute('data-value')) > -1) {
|
|
14603
|
+
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)))) {
|
|
13454
14604
|
this.mainList = this.ulElement;
|
|
13455
14605
|
if (this.hideSelectedItem) {
|
|
13456
14606
|
addClass([li], HIDE_LIST);
|
|
@@ -13488,13 +14638,13 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
13488
14638
|
}
|
|
13489
14639
|
updateListSelection(li, e, length) {
|
|
13490
14640
|
const customVal = li.getAttribute('data-value');
|
|
13491
|
-
let value = this.getFormattedValue(customVal);
|
|
14641
|
+
let value = this.allowObjectBinding ? this.getDataByValue(customVal) : this.getFormattedValue(customVal);
|
|
13492
14642
|
if (this.allowCustomValue && ((customVal !== 'false' && value === false) ||
|
|
13493
14643
|
(!isNullOrUndefined(value) && value.toString() === 'NaN'))) {
|
|
13494
14644
|
value = customVal;
|
|
13495
14645
|
}
|
|
13496
14646
|
this.removeHover();
|
|
13497
|
-
if (!this.value || this.value.indexOf(value) === -1) {
|
|
14647
|
+
if (!this.value || ((!this.allowObjectBinding && this.value.indexOf(value) === -1) || (this.allowObjectBinding && this.indexOfObjectInArray(value, this.value) === -1))) {
|
|
13498
14648
|
this.dispatchSelect(value, e, li, (li.getAttribute('aria-selected') === 'true'), length);
|
|
13499
14649
|
}
|
|
13500
14650
|
else {
|
|
@@ -13502,9 +14652,10 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
13502
14652
|
}
|
|
13503
14653
|
}
|
|
13504
14654
|
updateListSelectEventCallback(value, li, e) {
|
|
14655
|
+
value = this.allowObjectBinding ? getValue(((this.fields.value) ? this.fields.value : ''), value) : value;
|
|
13505
14656
|
const text = this.getTextByValue(value);
|
|
13506
|
-
if ((this.allowCustomValue || this.allowFiltering) && !this.findListElement(this.mainList, 'li', 'data-value', value)) {
|
|
13507
|
-
const temp = li.cloneNode(true);
|
|
14657
|
+
if ((this.allowCustomValue || this.allowFiltering) && !this.findListElement(this.mainList, 'li', 'data-value', value) && (!this.enableVirtualization || (this.enableVirtualization && this.virtualCustomData))) {
|
|
14658
|
+
const temp = li ? li.cloneNode(true) : li;
|
|
13508
14659
|
const fieldValue = this.fields.value ? this.fields.value : 'value';
|
|
13509
14660
|
if (this.allowCustomValue && this.mainData.length && typeof getValue(fieldValue, this.mainData[0]) === 'number') {
|
|
13510
14661
|
value = !isNaN(parseFloat(value.toString())) ? parseFloat(value.toString()) : value;
|
|
@@ -13516,10 +14667,22 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
13516
14667
|
};
|
|
13517
14668
|
this.trigger('customValueSelection', eventArgs, (eventArgs) => {
|
|
13518
14669
|
if (!eventArgs.cancel) {
|
|
13519
|
-
|
|
13520
|
-
|
|
13521
|
-
|
|
13522
|
-
|
|
14670
|
+
if (this.enableVirtualization && this.virtualCustomData) {
|
|
14671
|
+
if (this.virtualCustomSelectData && this.virtualCustomSelectData.length >= 0) {
|
|
14672
|
+
this.virtualCustomSelectData.push(data);
|
|
14673
|
+
}
|
|
14674
|
+
else {
|
|
14675
|
+
this.virtualCustomSelectData = [data];
|
|
14676
|
+
}
|
|
14677
|
+
this.remoteCustomValue = false;
|
|
14678
|
+
this.addValue(value, text, e);
|
|
14679
|
+
}
|
|
14680
|
+
else {
|
|
14681
|
+
append([temp], this.mainList);
|
|
14682
|
+
this.mainData.push(data);
|
|
14683
|
+
this.remoteCustomValue = false;
|
|
14684
|
+
this.addValue(value, text, e);
|
|
14685
|
+
}
|
|
13523
14686
|
}
|
|
13524
14687
|
});
|
|
13525
14688
|
}
|
|
@@ -13628,8 +14791,12 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
13628
14791
|
onMouseClick(e) {
|
|
13629
14792
|
this.keyCode = null;
|
|
13630
14793
|
this.scrollFocusStatus = false;
|
|
14794
|
+
this.keyboardEvent = null;
|
|
13631
14795
|
let target = e.target;
|
|
13632
14796
|
const li = closest(target, '.' + dropDownBaseClasses.li);
|
|
14797
|
+
if (this.enableVirtualization && li && li.classList.contains('e-virtual-list')) {
|
|
14798
|
+
return;
|
|
14799
|
+
}
|
|
13633
14800
|
const headerLi = closest(target, '.' + dropDownBaseClasses.group);
|
|
13634
14801
|
if (headerLi && this.enableGroupCheckBox && this.mode === 'CheckBox' && this.fields.groupBy) {
|
|
13635
14802
|
target = target.classList.contains('e-list-group-item') ? target.firstElementChild.lastElementChild
|
|
@@ -13706,6 +14873,39 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
13706
14873
|
else {
|
|
13707
14874
|
e.preventDefault();
|
|
13708
14875
|
}
|
|
14876
|
+
if (this.enableVirtualization && this.hideSelectedItem) {
|
|
14877
|
+
let visibleListElements = this.list.querySelectorAll('li.'
|
|
14878
|
+
+ dropDownBaseClasses.li
|
|
14879
|
+
+ ':not(.' + HIDE_LIST + ')' + ':not(.e-reorder-hide)' + ':not(.e-virtual-list)');
|
|
14880
|
+
if (visibleListElements.length) {
|
|
14881
|
+
const actualCount = this.virtualListHeight > 0 ? Math.floor(this.virtualListHeight / this.listItemHeight) : 0;
|
|
14882
|
+
if (visibleListElements.length < (actualCount + 2)) {
|
|
14883
|
+
let query = this.getForQuery(this.value).clone();
|
|
14884
|
+
query = query.skip(this.virtualItemStartIndex);
|
|
14885
|
+
this.resetList(this.dataSource, this.fields, query);
|
|
14886
|
+
this.UpdateSkeleton();
|
|
14887
|
+
this.liCollections = this.list.querySelectorAll('.' + dropDownBaseClasses.li);
|
|
14888
|
+
this.virtualItemCount = this.itemCount;
|
|
14889
|
+
if (this.mode !== 'CheckBox') {
|
|
14890
|
+
this.totalItemCount = this.value && this.value.length ? this.totalItemCount - this.value.length : this.totalItemCount;
|
|
14891
|
+
}
|
|
14892
|
+
if (!this.list.querySelector('.e-virtual-ddl')) {
|
|
14893
|
+
var virualElement = this.createElement('div', {
|
|
14894
|
+
id: this.element.id + '_popup', className: 'e-virtual-ddl', styles: this.GetVirtualTrackHeight()
|
|
14895
|
+
});
|
|
14896
|
+
this.popupWrapper.querySelector('.e-dropdownbase').appendChild(virualElement);
|
|
14897
|
+
}
|
|
14898
|
+
else {
|
|
14899
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14900
|
+
this.list.getElementsByClassName('e-virtual-ddl')[0].style = this.GetVirtualTrackHeight();
|
|
14901
|
+
}
|
|
14902
|
+
if (this.list.querySelector('.e-virtual-ddl-content')) {
|
|
14903
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14904
|
+
this.list.getElementsByClassName('e-virtual-ddl-content')[0].style = this.getTransformValues();
|
|
14905
|
+
}
|
|
14906
|
+
}
|
|
14907
|
+
}
|
|
14908
|
+
}
|
|
13709
14909
|
this.refreshPlaceHolder();
|
|
13710
14910
|
this.deselectHeader();
|
|
13711
14911
|
}
|
|
@@ -13943,7 +15143,9 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
13943
15143
|
let remaining;
|
|
13944
15144
|
let downIconWidth = 0;
|
|
13945
15145
|
let overAllContainer;
|
|
13946
|
-
|
|
15146
|
+
if (!this.enableVirtualization) {
|
|
15147
|
+
this.updateWrapperText(this.viewWrapper, data);
|
|
15148
|
+
}
|
|
13947
15149
|
const l10nLocale = {
|
|
13948
15150
|
noRecordsTemplate: 'No records found',
|
|
13949
15151
|
actionFailureTemplate: 'Request failed',
|
|
@@ -13974,11 +15176,21 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
13974
15176
|
this.checkClearIconWidth();
|
|
13975
15177
|
if (!isNullOrUndefined(this.value)) {
|
|
13976
15178
|
for (let index = 0; !isNullOrUndefined(this.value[index]); index++) {
|
|
13977
|
-
|
|
13978
|
-
|
|
13979
|
-
|
|
13980
|
-
|
|
13981
|
-
|
|
15179
|
+
let items = this.text && this.text.split(this.delimiterChar);
|
|
15180
|
+
if (!this.enableVirtualization) {
|
|
15181
|
+
data += (index === 0) ? '' : this.delimiterChar + ' ';
|
|
15182
|
+
temp = this.getOverflowVal(index);
|
|
15183
|
+
data += temp;
|
|
15184
|
+
temp = this.viewWrapper.innerHTML;
|
|
15185
|
+
this.updateWrapperText(this.viewWrapper, data);
|
|
15186
|
+
}
|
|
15187
|
+
else if (items) {
|
|
15188
|
+
data += (index === 0) ? '' : this.delimiterChar + ' ';
|
|
15189
|
+
temp = items[index];
|
|
15190
|
+
data += temp;
|
|
15191
|
+
temp = this.viewWrapper.innerHTML;
|
|
15192
|
+
this.updateWrapperText(this.viewWrapper, data);
|
|
15193
|
+
}
|
|
13982
15194
|
wrapperleng = this.viewWrapper.offsetWidth +
|
|
13983
15195
|
parseInt(window.getComputedStyle(this.viewWrapper).paddingRight, 10);
|
|
13984
15196
|
overAllContainer = this.componentWrapper.offsetWidth -
|
|
@@ -14081,18 +15293,19 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
14081
15293
|
getOverflowVal(index) {
|
|
14082
15294
|
let temp;
|
|
14083
15295
|
if (this.mainData && this.mainData.length) {
|
|
15296
|
+
const value = this.allowObjectBinding ? getValue(((this.fields.value) ? this.fields.value : ''), this.value[index]) : this.value[index];
|
|
14084
15297
|
if (this.mode === 'CheckBox') {
|
|
14085
15298
|
const newTemp = this.listData;
|
|
14086
15299
|
this.listData = this.mainData;
|
|
14087
|
-
temp = this.getTextByValue(
|
|
15300
|
+
temp = this.getTextByValue(value);
|
|
14088
15301
|
this.listData = newTemp;
|
|
14089
15302
|
}
|
|
14090
15303
|
else {
|
|
14091
|
-
temp = this.getTextByValue(
|
|
15304
|
+
temp = this.getTextByValue(value);
|
|
14092
15305
|
}
|
|
14093
15306
|
}
|
|
14094
15307
|
else {
|
|
14095
|
-
temp = this.value[index];
|
|
15308
|
+
temp = this.allowObjectBinding ? getValue(((this.fields.value) ? this.fields.value : ''), this.value[index]) : this.value[index];
|
|
14096
15309
|
}
|
|
14097
15310
|
return temp;
|
|
14098
15311
|
}
|
|
@@ -14209,7 +15422,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
14209
15422
|
preventSelectEvent: false
|
|
14210
15423
|
};
|
|
14211
15424
|
this.trigger('beforeSelectAll', beforeSelectArgs);
|
|
14212
|
-
if (li && li.length) {
|
|
15425
|
+
if ((li && li.length) || (this.enableVirtualization && !state)) {
|
|
14213
15426
|
let index = 0;
|
|
14214
15427
|
let count = 0;
|
|
14215
15428
|
if (this.enableGroupCheckBox) {
|
|
@@ -14219,37 +15432,127 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
14219
15432
|
count = state ? this.maximumSelectionLength - (this.value ? this.value.length : 0) : this.maximumSelectionLength;
|
|
14220
15433
|
}
|
|
14221
15434
|
if (!beforeSelectArgs.preventSelectEvent) {
|
|
14222
|
-
this.
|
|
14223
|
-
|
|
14224
|
-
|
|
14225
|
-
|
|
14226
|
-
this.
|
|
14227
|
-
|
|
14228
|
-
|
|
14229
|
-
|
|
14230
|
-
|
|
14231
|
-
|
|
14232
|
-
|
|
14233
|
-
|
|
14234
|
-
|
|
14235
|
-
|
|
14236
|
-
|
|
15435
|
+
if (this.enableVirtualization) {
|
|
15436
|
+
if (state) {
|
|
15437
|
+
this.virtualSelectAll = true;
|
|
15438
|
+
this.resetList(this.dataSource, this.fields, new Query().skip(this.viewPortInfo.startIndex));
|
|
15439
|
+
if (this.virtualSelectAllData instanceof Array) {
|
|
15440
|
+
for (var i = 0; i < this.virtualSelectAllData.length; i++) {
|
|
15441
|
+
if (li[this.skeletonCount + i]) {
|
|
15442
|
+
let value = this.allowObjectBinding ? this.getDataByValue(li[this.skeletonCount + i].getAttribute('data-value')) : this.getFormattedValue(li[this.skeletonCount + i].getAttribute('data-value'));
|
|
15443
|
+
if (((!this.allowObjectBinding && this.value && this.value.indexOf(value) === 1) || (this.allowObjectBinding && this.indexOfObjectInArray(value, this.value) === 1))) {
|
|
15444
|
+
continue;
|
|
15445
|
+
}
|
|
15446
|
+
this.updateListSelection(li[this.skeletonCount + i], event, length - i);
|
|
15447
|
+
}
|
|
15448
|
+
else {
|
|
15449
|
+
if (this.fields) {
|
|
15450
|
+
let value = getValue(this.fields.value, this.virtualSelectAllData[i]);
|
|
15451
|
+
value = this.allowObjectBinding ? this.getDataByValue(value) : value;
|
|
15452
|
+
if (((!this.allowObjectBinding && this.value && this.value.indexOf(value) === 1) || (this.allowObjectBinding && this.indexOfObjectInArray(value, this.value) === 1))) {
|
|
15453
|
+
continue;
|
|
15454
|
+
}
|
|
15455
|
+
if (this.value && value != null && Array.isArray(this.value) && ((!this.allowObjectBinding && this.value.indexOf(value) < 0) || (this.allowObjectBinding && !this.isObjectInArray(value, this.value)))) {
|
|
15456
|
+
this.dispatchSelect(value, event, null, false, length);
|
|
15457
|
+
}
|
|
15458
|
+
}
|
|
15459
|
+
}
|
|
15460
|
+
}
|
|
15461
|
+
if (this.virtualSelectAllData && this.value.length != this.virtualSelectAllData.length && this.virtualItemStartIndex != 0) {
|
|
15462
|
+
if (this.virtualItemStartIndex > this.itemCount) {
|
|
15463
|
+
for (var i = 0; i < this.itemCount; i++) {
|
|
15464
|
+
if (this.fields) {
|
|
15465
|
+
let value = getValue(this.fields.value, this.virtualSelectAllData[i]);
|
|
15466
|
+
value = this.allowObjectBinding ? this.getDataByValue(value) : value;
|
|
15467
|
+
if (this.value && value != null && Array.isArray(this.value) && ((!this.allowObjectBinding && this.value.indexOf(value) < 0) || (this.allowObjectBinding && !this.isObjectInArray(value, this.value)))) {
|
|
15468
|
+
this.setProperties({ value: [].concat([], this.value, this.allowObjectBinding ? [this.virtualSelectAllData[i]] : [value]) }, true);
|
|
15469
|
+
}
|
|
15470
|
+
}
|
|
15471
|
+
}
|
|
15472
|
+
}
|
|
15473
|
+
}
|
|
15474
|
+
else {
|
|
15475
|
+
for (var i = 0; i < this.virtualItemStartIndex; i++) {
|
|
15476
|
+
if (this.fields) {
|
|
15477
|
+
var value = getValue(this.fields.value, this.virtualSelectAllData[i]);
|
|
15478
|
+
value = this.allowObjectBinding ? this.getDataByValue(value) : value;
|
|
15479
|
+
if (Array.isArray(this.value) && ((!this.allowObjectBinding && this.value.indexOf(value) < 0) || (this.allowObjectBinding && !this.isObjectInArray(value, this.value)))) {
|
|
15480
|
+
this.setProperties({ value: [].concat([], this.value, this.allowObjectBinding ? [this.virtualSelectAllData[i]] : [value]) }, true);
|
|
15481
|
+
}
|
|
15482
|
+
}
|
|
15483
|
+
}
|
|
14237
15484
|
}
|
|
15485
|
+
}
|
|
15486
|
+
}
|
|
15487
|
+
else {
|
|
15488
|
+
while (index < this.value.length && index <= 50 && index < count && this.value.length > 0) {
|
|
15489
|
+
this.removeValue(this.value[index], event, this.value.length - index);
|
|
14238
15490
|
index++;
|
|
14239
15491
|
}
|
|
14240
|
-
|
|
14241
|
-
|
|
14242
|
-
|
|
14243
|
-
|
|
15492
|
+
if (length > 50) {
|
|
15493
|
+
setTimeout(() => {
|
|
15494
|
+
while (index < this.value.length && index < count && this.value.length > 0) {
|
|
15495
|
+
this.removeValue(value[index], event, this.value.length - index);
|
|
15496
|
+
index++;
|
|
15497
|
+
}
|
|
15498
|
+
this.updatedataValueItems(event);
|
|
15499
|
+
if (!this.changeOnBlur) {
|
|
15500
|
+
this.updateValueState(event, this.value, this.tempValues);
|
|
15501
|
+
this.isSelectAll = this.isSelectAll ? !this.isSelectAll : this.isSelectAll;
|
|
15502
|
+
}
|
|
15503
|
+
this.updateHiddenElement();
|
|
15504
|
+
}, 0);
|
|
14244
15505
|
}
|
|
14245
|
-
this.
|
|
14246
|
-
|
|
14247
|
-
|
|
14248
|
-
|
|
14249
|
-
|
|
14250
|
-
|
|
15506
|
+
this.value = [];
|
|
15507
|
+
this.virtualSelectAll = false;
|
|
15508
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
15509
|
+
let ulElement = this.renderItems(this.listData, this.fields);
|
|
15510
|
+
}
|
|
15511
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
15512
|
+
const virtualTrackElement = this.list.getElementsByClassName('e-virtual-ddl')[0];
|
|
15513
|
+
if (virtualTrackElement) {
|
|
15514
|
+
(virtualTrackElement).style = this.GetVirtualTrackHeight();
|
|
15515
|
+
}
|
|
15516
|
+
this.UpdateSkeleton();
|
|
15517
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
15518
|
+
const virtualContentElement = this.list.getElementsByClassName('e-virtual-ddl-content')[0];
|
|
15519
|
+
if (virtualContentElement) {
|
|
15520
|
+
(virtualContentElement).style = this.getTransformValues();
|
|
15521
|
+
}
|
|
15522
|
+
}
|
|
15523
|
+
else {
|
|
15524
|
+
while (index < length && index <= 50 && index < count) {
|
|
15525
|
+
this.isSelectAllTarget = (length === index + 1);
|
|
15526
|
+
this.updateListSelection(li[index], event, length - index);
|
|
15527
|
+
if (this.enableGroupCheckBox) {
|
|
15528
|
+
this.findGroupStart(li[index]);
|
|
14251
15529
|
}
|
|
14252
|
-
|
|
15530
|
+
index++;
|
|
15531
|
+
}
|
|
15532
|
+
if (length > 50) {
|
|
15533
|
+
setTimeout(() => {
|
|
15534
|
+
while (index < length && index < count) {
|
|
15535
|
+
this.isSelectAllTarget = (length === index + 1);
|
|
15536
|
+
this.updateListSelection(li[index], event, length - index);
|
|
15537
|
+
if (this.enableGroupCheckBox) {
|
|
15538
|
+
this.findGroupStart(li[index]);
|
|
15539
|
+
}
|
|
15540
|
+
index++;
|
|
15541
|
+
}
|
|
15542
|
+
this.updatedataValueItems(event);
|
|
15543
|
+
if (!this.changeOnBlur) {
|
|
15544
|
+
this.updateValueState(event, this.value, this.tempValues);
|
|
15545
|
+
this.isSelectAll = this.isSelectAll ? !this.isSelectAll : this.isSelectAll;
|
|
15546
|
+
}
|
|
15547
|
+
this.updateHiddenElement();
|
|
15548
|
+
if (this.popupWrapper && li[index - 1].classList.contains('e-item-focus')) {
|
|
15549
|
+
const selectAllParent = document.getElementsByClassName('e-selectall-parent')[0];
|
|
15550
|
+
if (selectAllParent && selectAllParent.classList.contains('e-item-focus')) {
|
|
15551
|
+
li[index - 1].classList.remove('e-item-focus');
|
|
15552
|
+
}
|
|
15553
|
+
}
|
|
15554
|
+
}, 0);
|
|
15555
|
+
}
|
|
14253
15556
|
}
|
|
14254
15557
|
}
|
|
14255
15558
|
else {
|
|
@@ -14257,12 +15560,13 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
14257
15560
|
this.removeHover();
|
|
14258
15561
|
let customVal = li[i].getAttribute('data-value');
|
|
14259
15562
|
let value = this.getFormattedValue(customVal);
|
|
15563
|
+
value = this.allowObjectBinding ? this.getDataByValue(value) : value;
|
|
14260
15564
|
let mainElement = this.mainList ? this.mainList.querySelectorAll(state ?
|
|
14261
15565
|
'li.e-list-item:not([aria-selected="true"]):not(.e-reorder-hide)' :
|
|
14262
15566
|
'li.e-list-item[aria-selected="true"]:not(.e-reorder-hide)')[i] : null;
|
|
14263
15567
|
if (state) {
|
|
14264
15568
|
this.value = !this.value ? [] : this.value;
|
|
14265
|
-
if (this.value.indexOf(value) < 0) {
|
|
15569
|
+
if ((!this.allowObjectBinding && this.value.indexOf(value) < 0) || (this.allowObjectBinding && !this.isObjectInArray(value, this.value))) {
|
|
14266
15570
|
this.setProperties({ value: [].concat([], this.value, [value]) }, true);
|
|
14267
15571
|
}
|
|
14268
15572
|
this.removeFocus();
|
|
@@ -14406,6 +15710,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
14406
15710
|
}
|
|
14407
15711
|
this.selectAllItem(state, event);
|
|
14408
15712
|
}
|
|
15713
|
+
this.virtualSelectAll = false;
|
|
14409
15714
|
}
|
|
14410
15715
|
/**
|
|
14411
15716
|
* Get the properties to be maintained in the persisted state.
|
|
@@ -14572,12 +15877,31 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
14572
15877
|
}
|
|
14573
15878
|
this.renderPopup();
|
|
14574
15879
|
}
|
|
15880
|
+
totalItemsCount() {
|
|
15881
|
+
let dataSourceCount;
|
|
15882
|
+
if (this.dataSource instanceof DataManager) {
|
|
15883
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
15884
|
+
dataSourceCount = this.virtualGroupDataSource && this.virtualGroupDataSource.length ? this.virtualGroupDataSource.length : 0;
|
|
15885
|
+
}
|
|
15886
|
+
else {
|
|
15887
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
15888
|
+
dataSourceCount = this.dataSource && this.dataSource.length ? this.dataSource.length : 0;
|
|
15889
|
+
}
|
|
15890
|
+
if (this.mode === 'CheckBox') {
|
|
15891
|
+
this.totalItemCount = dataSourceCount != 0 ? dataSourceCount : this.totalItemCount;
|
|
15892
|
+
}
|
|
15893
|
+
else {
|
|
15894
|
+
this.totalItemCount = dataSourceCount != 0 ? dataSourceCount - this.value.length : this.totalItemCount;
|
|
15895
|
+
}
|
|
15896
|
+
}
|
|
14575
15897
|
presentItemValue(ulElement) {
|
|
14576
15898
|
let valuecheck = [];
|
|
14577
15899
|
for (let i = 0; i < this.value.length; i++) {
|
|
14578
|
-
|
|
15900
|
+
const value = this.allowObjectBinding ? getValue((this.fields.value) ? this.fields.value : '', this.value[i]) : this.value[i];
|
|
15901
|
+
let checkEle = this.findListElement(((this.allowFiltering && !isNullOrUndefined(this.mainList)) ? this.mainList : ulElement), 'li', 'data-value', value);
|
|
14579
15902
|
if (!checkEle) {
|
|
14580
|
-
|
|
15903
|
+
const checkvalue = this.allowObjectBinding ? this.getDataByValue(this.value[i]) : this.value[i];
|
|
15904
|
+
valuecheck.push(checkvalue);
|
|
14581
15905
|
}
|
|
14582
15906
|
}
|
|
14583
15907
|
return valuecheck;
|
|
@@ -14688,6 +16012,31 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
14688
16012
|
if (this.mode === 'CheckBox' && this.showSelectAll) {
|
|
14689
16013
|
EventHandler.remove(this.popupObj.element, 'click', this.clickHandler);
|
|
14690
16014
|
}
|
|
16015
|
+
if (this.enableVirtualization && this.mode === 'CheckBox') {
|
|
16016
|
+
this.viewPortInfo.startIndex = this.virtualItemStartIndex = 0;
|
|
16017
|
+
this.viewPortInfo.endIndex = this.virtualItemEndIndex = this.viewPortInfo.startIndex > 0 ? this.viewPortInfo.endIndex : this.itemCount;
|
|
16018
|
+
this.previousStartIndex = 0;
|
|
16019
|
+
this.previousEndIndex = 0;
|
|
16020
|
+
}
|
|
16021
|
+
let dataSourceCount;
|
|
16022
|
+
if (this.dataSource instanceof DataManager) {
|
|
16023
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
16024
|
+
dataSourceCount = this.virtualGroupDataSource && this.virtualGroupDataSource.length ? this.virtualGroupDataSource.length : 0;
|
|
16025
|
+
}
|
|
16026
|
+
else {
|
|
16027
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
16028
|
+
dataSourceCount = this.dataSource && this.dataSource.length ? this.dataSource.length : 0;
|
|
16029
|
+
}
|
|
16030
|
+
if (this.enableVirtualization && (this.allowFiltering || this.allowCustomValue) && this.value != null && this.targetElement() && this.totalItemCount !== dataSourceCount) {
|
|
16031
|
+
this.updateInitialData();
|
|
16032
|
+
this.checkAndResetCache();
|
|
16033
|
+
}
|
|
16034
|
+
if (this.virtualCustomData && this.viewPortInfo && this.viewPortInfo.startIndex === 0 && this.viewPortInfo.endIndex === this.itemCount) {
|
|
16035
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
16036
|
+
this.renderItems(this.mainData, this.fields);
|
|
16037
|
+
}
|
|
16038
|
+
this.virtualCustomData = null;
|
|
16039
|
+
this.isVirtualTrackHeight = false;
|
|
14691
16040
|
}
|
|
14692
16041
|
});
|
|
14693
16042
|
}
|
|
@@ -14701,6 +16050,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
14701
16050
|
if (!this.enabled) {
|
|
14702
16051
|
return;
|
|
14703
16052
|
}
|
|
16053
|
+
this.firstItem = this.dataSource && this.dataSource.length > 0 ? this.dataSource[0] : null;
|
|
14704
16054
|
const args = { cancel: false };
|
|
14705
16055
|
this.trigger('beforeOpen', args, (args) => {
|
|
14706
16056
|
if (!args.cancel) {
|
|
@@ -14723,6 +16073,46 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
14723
16073
|
return;
|
|
14724
16074
|
}
|
|
14725
16075
|
this.onPopupShown(e);
|
|
16076
|
+
if (this.enableVirtualization && this.listData && this.listData.length) {
|
|
16077
|
+
if (!isNullOrUndefined(this.value) && (this.getModuleName() === 'dropdownlist' || this.getModuleName() === 'combobox')) {
|
|
16078
|
+
this.removeHover();
|
|
16079
|
+
}
|
|
16080
|
+
if (!this.beforePopupOpen) {
|
|
16081
|
+
if (this.hideSelectedItem && this.value && Array.isArray(this.value) && this.value.length > 0) {
|
|
16082
|
+
this.totalItemsCount();
|
|
16083
|
+
}
|
|
16084
|
+
if (!this.preventSetCurrentData && !isNullOrUndefined(this.viewPortInfo.startIndex) && !isNullOrUndefined(this.viewPortInfo.endIndex)) {
|
|
16085
|
+
this.notify("setCurrentViewDataAsync", {
|
|
16086
|
+
component: this.getModuleName(),
|
|
16087
|
+
module: "VirtualScroll",
|
|
16088
|
+
});
|
|
16089
|
+
}
|
|
16090
|
+
}
|
|
16091
|
+
}
|
|
16092
|
+
if (this.enableVirtualization && !this.allowFiltering && this.selectedValueInfo != null && this.selectedValueInfo.startIndex > 0 && this.value != null) {
|
|
16093
|
+
this.notify("dataProcessAsync", {
|
|
16094
|
+
module: "VirtualScroll",
|
|
16095
|
+
isOpen: true,
|
|
16096
|
+
});
|
|
16097
|
+
}
|
|
16098
|
+
if (this.enableVirtualization) {
|
|
16099
|
+
this.updatevirtualizationList();
|
|
16100
|
+
}
|
|
16101
|
+
else {
|
|
16102
|
+
if (this.value && this.value.length) {
|
|
16103
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
16104
|
+
let element;
|
|
16105
|
+
const listItems = this.getItems();
|
|
16106
|
+
for (const value of this.value) {
|
|
16107
|
+
const checkValue = this.allowObjectBinding ? getValue((this.fields.value) ? this.fields.value : '', value) : value;
|
|
16108
|
+
element = this.getElementByValue(checkValue);
|
|
16109
|
+
if (element) {
|
|
16110
|
+
this.addListSelection(element);
|
|
16111
|
+
}
|
|
16112
|
+
}
|
|
16113
|
+
}
|
|
16114
|
+
}
|
|
16115
|
+
this.preventSetCurrentData = true;
|
|
14726
16116
|
}
|
|
14727
16117
|
});
|
|
14728
16118
|
}
|
|
@@ -14874,6 +16264,13 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
14874
16264
|
this.wireEvent();
|
|
14875
16265
|
this.enable(this.enabled);
|
|
14876
16266
|
this.enableRTL(this.enableRtl);
|
|
16267
|
+
if (this.enableVirtualization) {
|
|
16268
|
+
this.updateVirtualizationProperties(this.itemCount, this.allowFiltering, this.mode === 'CheckBox');
|
|
16269
|
+
}
|
|
16270
|
+
this.listItemHeight = this.getListHeight();
|
|
16271
|
+
this.getSkeletonCount();
|
|
16272
|
+
this.viewPortInfo.startIndex = this.virtualItemStartIndex = 0;
|
|
16273
|
+
this.viewPortInfo.endIndex = this.virtualItemEndIndex = this.viewPortInfo.startIndex > 0 ? this.viewPortInfo.endIndex : this.itemCount;
|
|
14877
16274
|
this.checkInitialValue();
|
|
14878
16275
|
if (this.element.hasAttribute('data-val')) {
|
|
14879
16276
|
this.element.setAttribute('data-val', 'false');
|
|
@@ -14885,6 +16282,22 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
14885
16282
|
}
|
|
14886
16283
|
this.renderComplete();
|
|
14887
16284
|
}
|
|
16285
|
+
getListHeight() {
|
|
16286
|
+
let listParent = this.createElement('div', {
|
|
16287
|
+
className: 'e-dropdownbase'
|
|
16288
|
+
});
|
|
16289
|
+
let item = this.createElement('li', {
|
|
16290
|
+
className: 'e-list-item'
|
|
16291
|
+
});
|
|
16292
|
+
let listParentHeight = formatUnit(this.popupHeight);
|
|
16293
|
+
listParent.style.height = (parseInt(listParentHeight, 10)).toString() + 'px';
|
|
16294
|
+
listParent.appendChild(item);
|
|
16295
|
+
document.body.appendChild(listParent);
|
|
16296
|
+
this.virtualListHeight = listParent.getBoundingClientRect().height;
|
|
16297
|
+
let listItemHeight = Math.ceil(item.getBoundingClientRect().height);
|
|
16298
|
+
listParent.remove();
|
|
16299
|
+
return listItemHeight;
|
|
16300
|
+
}
|
|
14888
16301
|
checkInitialValue() {
|
|
14889
16302
|
const isData = this.dataSource instanceof Array ? (this.dataSource.length > 0)
|
|
14890
16303
|
: !isNullOrUndefined(this.dataSource);
|
|
@@ -14900,7 +16313,8 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
14900
16313
|
const opt = optionsElement[index];
|
|
14901
16314
|
if (!isNullOrUndefined(opt.getAttribute('selected'))) {
|
|
14902
16315
|
if (opt.getAttribute('value')) {
|
|
14903
|
-
|
|
16316
|
+
let value = this.allowObjectBinding ? this.getDataByValue(opt.getAttribute('value')) : opt.getAttribute('value');
|
|
16317
|
+
valueCol.push(value);
|
|
14904
16318
|
}
|
|
14905
16319
|
else {
|
|
14906
16320
|
textCol += (opt.text + this.delimiterChar);
|
|
@@ -14927,14 +16341,40 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
14927
16341
|
this.initialTextUpdate();
|
|
14928
16342
|
}
|
|
14929
16343
|
if (this.value && this.value.length) {
|
|
16344
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
16345
|
+
let listItems;
|
|
16346
|
+
if (this.enableVirtualization) {
|
|
16347
|
+
const fields = (this.fields.value) ? this.fields.value : '';
|
|
16348
|
+
let predicate;
|
|
16349
|
+
for (let i = 0; i < this.value.length; i++) {
|
|
16350
|
+
const value = this.allowObjectBinding ? getValue((this.fields.value) ? this.fields.value : '', this.value[i]) : this.value[i];
|
|
16351
|
+
if (i === 0) {
|
|
16352
|
+
predicate = new Predicate(fields, 'equal', value);
|
|
16353
|
+
}
|
|
16354
|
+
else {
|
|
16355
|
+
predicate = predicate.or(fields, 'equal', value);
|
|
16356
|
+
}
|
|
16357
|
+
}
|
|
16358
|
+
if (this.dataSource instanceof DataManager) {
|
|
16359
|
+
this.dataSource.executeQuery(new Query().where(predicate))
|
|
16360
|
+
.then((e) => {
|
|
16361
|
+
if (e.result.result.length > 0) {
|
|
16362
|
+
listItems = e.result.result;
|
|
16363
|
+
}
|
|
16364
|
+
});
|
|
16365
|
+
}
|
|
16366
|
+
else {
|
|
16367
|
+
listItems = new DataManager(this.dataSource).executeLocal(new Query().where(predicate));
|
|
16368
|
+
}
|
|
16369
|
+
}
|
|
14930
16370
|
if (!(this.dataSource instanceof DataManager)) {
|
|
14931
|
-
this.initialValueUpdate();
|
|
16371
|
+
this.initialValueUpdate(listItems);
|
|
14932
16372
|
this.initialUpdate();
|
|
14933
16373
|
}
|
|
14934
16374
|
else {
|
|
14935
16375
|
this.setInitialValue = () => {
|
|
14936
16376
|
this.initStatus = false;
|
|
14937
|
-
this.initialValueUpdate();
|
|
16377
|
+
this.initialValueUpdate(listItems);
|
|
14938
16378
|
this.initialUpdate();
|
|
14939
16379
|
this.setInitialValue = null;
|
|
14940
16380
|
this.initStatus = true;
|
|
@@ -14956,6 +16396,33 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
14956
16396
|
this.inputElement.focus();
|
|
14957
16397
|
}
|
|
14958
16398
|
}
|
|
16399
|
+
updatevirtualizationList() {
|
|
16400
|
+
if (this.value && this.value.length) {
|
|
16401
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
16402
|
+
let element;
|
|
16403
|
+
const listItems = this.getItems();
|
|
16404
|
+
for (const value of this.value) {
|
|
16405
|
+
const checkValue = this.allowObjectBinding ? getValue((this.fields.value) ? this.fields.value : '', value) : value;
|
|
16406
|
+
element = this.getElementByValue(checkValue);
|
|
16407
|
+
if (element) {
|
|
16408
|
+
this.addListSelection(element);
|
|
16409
|
+
}
|
|
16410
|
+
}
|
|
16411
|
+
if (this.enableVirtualization && this.hideSelectedItem) {
|
|
16412
|
+
let visibleListElements = this.list.querySelectorAll('li.'
|
|
16413
|
+
+ dropDownBaseClasses.li
|
|
16414
|
+
+ ':not(.' + HIDE_LIST + ')' + ':not(.e-reorder-hide)' + ':not(.e-virtual-list)');
|
|
16415
|
+
if (visibleListElements.length) {
|
|
16416
|
+
var actualCount = this.virtualListHeight > 0 ? Math.floor(this.virtualListHeight / this.listItemHeight) : 0;
|
|
16417
|
+
if (visibleListElements.length < (actualCount + 2)) {
|
|
16418
|
+
var query = this.getForQuery(this.value).clone();
|
|
16419
|
+
query = query.skip(this.viewPortInfo.startIndex);
|
|
16420
|
+
this.resetList(this.dataSource, this.fields, query);
|
|
16421
|
+
}
|
|
16422
|
+
}
|
|
16423
|
+
}
|
|
16424
|
+
}
|
|
16425
|
+
}
|
|
14959
16426
|
setFloatLabelType() {
|
|
14960
16427
|
removeFloating(this.overAllWrapper, this.componentWrapper, this.searchWrapper, this.inputElement, this.value, this.floatLabelType, this.placeholder);
|
|
14961
16428
|
if (this.floatLabelType !== 'Never') {
|
|
@@ -14989,6 +16456,8 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
14989
16456
|
if (this.mode !== 'Box' && !(this.setDynValue && this.mode === 'Default' && this.inputFocus)) {
|
|
14990
16457
|
this.updateDelimView();
|
|
14991
16458
|
}
|
|
16459
|
+
this.viewPortInfo.startIndex = this.virtualItemStartIndex = 0;
|
|
16460
|
+
this.viewPortInfo.endIndex = this.virtualItemEndIndex = this.itemCount;
|
|
14992
16461
|
this.updateCssClass();
|
|
14993
16462
|
this.updateHTMLAttribute();
|
|
14994
16463
|
this.updateReadonly(this.readonly);
|
|
@@ -15086,6 +16555,9 @@ __decorate$5([
|
|
|
15086
16555
|
__decorate$5([
|
|
15087
16556
|
Property(true)
|
|
15088
16557
|
], MultiSelect.prototype, "enableHtmlSanitizer", void 0);
|
|
16558
|
+
__decorate$5([
|
|
16559
|
+
Property(false)
|
|
16560
|
+
], MultiSelect.prototype, "enableVirtualization", void 0);
|
|
15089
16561
|
__decorate$5([
|
|
15090
16562
|
Property([])
|
|
15091
16563
|
], MultiSelect.prototype, "dataSource", void 0);
|
|
@@ -15164,6 +16636,9 @@ __decorate$5([
|
|
|
15164
16636
|
__decorate$5([
|
|
15165
16637
|
Property(null)
|
|
15166
16638
|
], MultiSelect.prototype, "value", void 0);
|
|
16639
|
+
__decorate$5([
|
|
16640
|
+
Property(false)
|
|
16641
|
+
], MultiSelect.prototype, "allowObjectBinding", void 0);
|
|
15167
16642
|
__decorate$5([
|
|
15168
16643
|
Property(true)
|
|
15169
16644
|
], MultiSelect.prototype, "hideSelectedItem", void 0);
|
|
@@ -15391,7 +16866,7 @@ class CheckBoxSelection {
|
|
|
15391
16866
|
}
|
|
15392
16867
|
EventHandler.add(this.checkAllParent, 'mousedown', this.clickHandler, this);
|
|
15393
16868
|
}
|
|
15394
|
-
if (this.parent.list.classList.contains('e-nodata') || (this.parent.listData && this.parent.listData.length <= 1 &&
|
|
16869
|
+
if (this.parent.list.classList.contains('e-nodata') || (this.parent.listData && this.parent.listData.length <= 1 && !this.parent.enableVirtualization &&
|
|
15395
16870
|
!(this.parent.isDynamicDataChange)) || (this.parent.isDynamicDataChange &&
|
|
15396
16871
|
this.parent.listData && this.parent.listData.length <= 1)) {
|
|
15397
16872
|
this.checkAllParent.style.display = 'none';
|
|
@@ -15553,13 +17028,20 @@ class CheckBoxSelection {
|
|
|
15553
17028
|
if (this.parent.allowFiltering && this.parent.targetInputElement.value === '') {
|
|
15554
17029
|
this.parent.search(null);
|
|
15555
17030
|
}
|
|
15556
|
-
this.parent.refreshPopup();
|
|
15557
17031
|
this.parent.refreshListItems(null);
|
|
17032
|
+
this.parent.refreshPopup();
|
|
15558
17033
|
this.clearIconElement.style.visibility = 'hidden';
|
|
15559
17034
|
this.filterInput.focus();
|
|
15560
17035
|
this.setReorder(e);
|
|
17036
|
+
this.boundPreventListSelection = this.preventListSelection.bind(this);
|
|
17037
|
+
this.parent.popupWrapper.addEventListener('mouseup', this.boundPreventListSelection, true);
|
|
15561
17038
|
e.preventDefault();
|
|
15562
17039
|
}
|
|
17040
|
+
preventListSelection(e) {
|
|
17041
|
+
e.stopPropagation();
|
|
17042
|
+
this.parent.popupWrapper.removeEventListener('mouseup', this.boundPreventListSelection, true);
|
|
17043
|
+
this.boundPreventListSelection = null;
|
|
17044
|
+
}
|
|
15563
17045
|
setDeviceSearchBox() {
|
|
15564
17046
|
this.parent.popupObj.element.classList.add(device);
|
|
15565
17047
|
this.parent.popupObj.element.classList.add(mobileFilter);
|
|
@@ -15752,7 +17234,13 @@ class CheckBoxSelection {
|
|
|
15752
17234
|
});
|
|
15753
17235
|
remLi = this.parent.ulElement.querySelectorAll('li.e-active');
|
|
15754
17236
|
addClass(remLi, 'e-reorder-hide');
|
|
15755
|
-
|
|
17237
|
+
if (this.parent.enableVirtualization) {
|
|
17238
|
+
var virtualUlElement = this.parent.list.querySelector('.e-virtual-ddl-content');
|
|
17239
|
+
prepend([ulEle], virtualUlElement);
|
|
17240
|
+
}
|
|
17241
|
+
else {
|
|
17242
|
+
prepend([ulEle], this.parent.list);
|
|
17243
|
+
}
|
|
15756
17244
|
}
|
|
15757
17245
|
this.parent.focusAtFirstListItem();
|
|
15758
17246
|
}
|
|
@@ -16125,7 +17613,7 @@ let ListBox = ListBox_1 = class ListBox extends DropDownBase {
|
|
|
16125
17613
|
}
|
|
16126
17614
|
}
|
|
16127
17615
|
this.initWrapper();
|
|
16128
|
-
this.setSelection();
|
|
17616
|
+
this.setSelection(this.value, true, false, !this.isRendered);
|
|
16129
17617
|
this.initDraggable();
|
|
16130
17618
|
this.mainList = this.ulElement;
|
|
16131
17619
|
if (this.initLoad) {
|
|
@@ -17762,7 +19250,7 @@ let ListBox = ListBox_1 = class ListBox extends DropDownBase {
|
|
|
17762
19250
|
});
|
|
17763
19251
|
}
|
|
17764
19252
|
}
|
|
17765
|
-
setSelection(values = this.value, isSelect = true, isText = false) {
|
|
19253
|
+
setSelection(values = this.value, isSelect = true, isText = false, canFocus = true) {
|
|
17766
19254
|
let li;
|
|
17767
19255
|
let liselect;
|
|
17768
19256
|
if (values) {
|
|
@@ -17791,13 +19279,17 @@ let ListBox = ListBox_1 = class ListBox extends DropDownBase {
|
|
|
17791
19279
|
if (!isSelect && liselect || isSelect && !liselect && li) {
|
|
17792
19280
|
if (this.selectionSettings.showCheckbox) {
|
|
17793
19281
|
this.notify('updatelist', { li: li, module: 'listbox' });
|
|
17794
|
-
|
|
19282
|
+
if (canFocus) {
|
|
19283
|
+
li.focus();
|
|
19284
|
+
}
|
|
17795
19285
|
}
|
|
17796
19286
|
else {
|
|
17797
19287
|
if (isSelect) {
|
|
17798
19288
|
li.classList.add(cssClass.selected);
|
|
17799
19289
|
li.setAttribute('aria-selected', 'true');
|
|
17800
|
-
|
|
19290
|
+
if (canFocus) {
|
|
19291
|
+
li.focus();
|
|
19292
|
+
}
|
|
17801
19293
|
}
|
|
17802
19294
|
else {
|
|
17803
19295
|
li.classList.remove(cssClass.selected);
|
|
@@ -18280,6 +19772,8 @@ let Mention = class Mention extends DropDownBase {
|
|
|
18280
19772
|
this.isPopupOpen = false;
|
|
18281
19773
|
this.isCollided = false;
|
|
18282
19774
|
this.lineBreak = false;
|
|
19775
|
+
this.isRTE = false;
|
|
19776
|
+
this.keyEventName = 'mousedown';
|
|
18283
19777
|
}
|
|
18284
19778
|
/**
|
|
18285
19779
|
* Execute before render the list items
|
|
@@ -18325,7 +19819,7 @@ let Mention = class Mention extends DropDownBase {
|
|
|
18325
19819
|
}
|
|
18326
19820
|
bindCommonEvent() {
|
|
18327
19821
|
if (!Browser.isDevice) {
|
|
18328
|
-
this.inputElement.addEventListener('keydown', this.keyDownHandler.bind(this),
|
|
19822
|
+
this.inputElement.addEventListener('keydown', this.keyDownHandler.bind(this), !this.isRTE);
|
|
18329
19823
|
}
|
|
18330
19824
|
}
|
|
18331
19825
|
/**
|
|
@@ -18355,6 +19849,10 @@ let Mention = class Mention extends DropDownBase {
|
|
|
18355
19849
|
return parentElement.querySelector('.e-content');
|
|
18356
19850
|
}
|
|
18357
19851
|
}
|
|
19852
|
+
if (targetElement && targetElement.parentElement && targetElement.parentElement.classList.contains('e-rte-content')) {
|
|
19853
|
+
this.isRTE = true;
|
|
19854
|
+
this.keyEventName = 'click';
|
|
19855
|
+
}
|
|
18358
19856
|
return targetElement;
|
|
18359
19857
|
}
|
|
18360
19858
|
/**
|
|
@@ -18496,7 +19994,7 @@ let Mention = class Mention extends DropDownBase {
|
|
|
18496
19994
|
}
|
|
18497
19995
|
unBindCommonEvent() {
|
|
18498
19996
|
if (!Browser.isDevice) {
|
|
18499
|
-
this.inputElement.removeEventListener('keydown', this.keyDownHandler.bind(this),
|
|
19997
|
+
this.inputElement.removeEventListener('keydown', this.keyDownHandler.bind(this), !this.isRTE);
|
|
18500
19998
|
}
|
|
18501
19999
|
}
|
|
18502
20000
|
onKeyUp(e) {
|
|
@@ -18507,7 +20005,7 @@ let Mention = class Mention extends DropDownBase {
|
|
|
18507
20005
|
}
|
|
18508
20006
|
this.isTyped = e.code !== 'Enter' && e.code !== 'Space' && e.code !== 'ArrowDown' && e.code !== 'ArrowUp' ? true : false;
|
|
18509
20007
|
const isRteImage = document.activeElement.parentElement && document.activeElement.parentElement.querySelector('.e-rte-image') ? true : false;
|
|
18510
|
-
if (document.activeElement != this.inputElement &&
|
|
20008
|
+
if (document.activeElement != this.inputElement && isRteImage) {
|
|
18511
20009
|
this.inputElement.focus();
|
|
18512
20010
|
}
|
|
18513
20011
|
if (this.isContentEditable(this.inputElement)) {
|
|
@@ -18535,7 +20033,7 @@ let Mention = class Mention extends DropDownBase {
|
|
|
18535
20033
|
this.range.startContainer.nodeType === 1))) {
|
|
18536
20034
|
if (this.isPopupOpen && this.allowSpaces && currentRange && currentRange.trim() !== '' && charRegex.test(currentRange) && currentRange.indexOf(this.mentionChar) !== -1
|
|
18537
20035
|
&& !this.isMatchedText() && (currentRange.length > 1 && currentRange.replace(/\u00A0/g, ' ').charAt(currentRange.length - 2) !== ' ') &&
|
|
18538
|
-
(this.list && this.list.querySelectorAll('ul').length > 0)) {
|
|
20036
|
+
(this.list && this.list.querySelectorAll('ul').length > 0) && e.code !== 'Enter') {
|
|
18539
20037
|
this.queryString = currentRange.substring(currentRange.lastIndexOf(this.mentionChar) + 1).replace('\u00a0', ' ');
|
|
18540
20038
|
this.searchLists(e);
|
|
18541
20039
|
}
|
|
@@ -19175,7 +20673,7 @@ let Mention = class Mention extends DropDownBase {
|
|
|
19175
20673
|
* @returns {void}
|
|
19176
20674
|
*/
|
|
19177
20675
|
wireListEvents() {
|
|
19178
|
-
EventHandler.add(this.list,
|
|
20676
|
+
EventHandler.add(this.list, this.keyEventName, this.onMouseClick, this);
|
|
19179
20677
|
EventHandler.add(this.list, 'mouseover', this.onMouseOver, this);
|
|
19180
20678
|
EventHandler.add(this.list, 'mouseout', this.onMouseLeave, this);
|
|
19181
20679
|
}
|
|
@@ -19185,7 +20683,7 @@ let Mention = class Mention extends DropDownBase {
|
|
|
19185
20683
|
* @returns {void}
|
|
19186
20684
|
*/
|
|
19187
20685
|
unWireListEvents() {
|
|
19188
|
-
EventHandler.remove(this.list,
|
|
20686
|
+
EventHandler.remove(this.list, this.keyEventName, this.onMouseClick);
|
|
19189
20687
|
EventHandler.remove(this.list, 'mouseover', this.onMouseOver);
|
|
19190
20688
|
EventHandler.remove(this.list, 'mouseout', this.onMouseLeave);
|
|
19191
20689
|
}
|
|
@@ -19200,7 +20698,9 @@ let Mention = class Mention extends DropDownBase {
|
|
|
19200
20698
|
const delay = 100;
|
|
19201
20699
|
this.closePopup(delay, e);
|
|
19202
20700
|
this.inputElement.focus();
|
|
19203
|
-
|
|
20701
|
+
if (!this.isRTE) {
|
|
20702
|
+
e.preventDefault();
|
|
20703
|
+
}
|
|
19204
20704
|
}
|
|
19205
20705
|
updateSelectedItem(li, e, preventSelect, isSelection) {
|
|
19206
20706
|
this.removeSelection();
|
|
@@ -19440,7 +20940,7 @@ let Mention = class Mention extends DropDownBase {
|
|
|
19440
20940
|
if (this.isPopupOpen) {
|
|
19441
20941
|
this.hidePopup();
|
|
19442
20942
|
}
|
|
19443
|
-
//New event to update the RichTextEditor value, when a mention item is selected using mouse click action.
|
|
20943
|
+
//New event to update the RichTextEditor value, when a mention item is selected using mouse click action.
|
|
19444
20944
|
if (!isNullOrUndefined(e.pointerType) && e.pointerType === 'mouse') {
|
|
19445
20945
|
const event = new CustomEvent('content-changed', { detail: { click: true } });
|
|
19446
20946
|
this.inputElement.dispatchEvent(event);
|