@syncfusion/ej2-dropdowns 24.2.8 → 25.1.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +23 -150
- package/dist/ej2-dropdowns.min.js +2 -2
- package/dist/ej2-dropdowns.umd.min.js +2 -2
- package/dist/ej2-dropdowns.umd.min.js.map +1 -1
- package/dist/es6/ej2-dropdowns.es2015.js +2049 -528
- package/dist/es6/ej2-dropdowns.es2015.js.map +1 -1
- package/dist/es6/ej2-dropdowns.es5.js +2072 -533
- package/dist/es6/ej2-dropdowns.es5.js.map +1 -1
- package/dist/global/ej2-dropdowns.min.js +2 -2
- package/dist/global/ej2-dropdowns.min.js.map +1 -1
- package/dist/global/index.d.ts +1 -1
- package/package.json +13 -13
- package/src/auto-complete/auto-complete-model.d.ts +3 -1
- package/src/auto-complete/auto-complete.d.ts +2 -0
- package/src/auto-complete/auto-complete.js +51 -6
- package/src/combo-box/combo-box-model.d.ts +11 -2
- package/src/combo-box/combo-box.d.ts +10 -2
- package/src/combo-box/combo-box.js +75 -16
- package/src/common/interface.d.ts +32 -0
- package/src/common/virtual-scroll.d.ts +1 -3
- package/src/common/virtual-scroll.js +157 -27
- package/src/drop-down-base/drop-down-base-model.d.ts +1 -1
- package/src/drop-down-base/drop-down-base.d.ts +65 -5
- package/src/drop-down-base/drop-down-base.js +242 -25
- package/src/drop-down-list/drop-down-list-model.d.ts +10 -1
- package/src/drop-down-list/drop-down-list.d.ts +16 -51
- package/src/drop-down-list/drop-down-list.js +180 -217
- package/src/drop-down-tree/drop-down-tree-model.d.ts +16 -12
- package/src/drop-down-tree/drop-down-tree.d.ts +13 -3
- package/src/drop-down-tree/drop-down-tree.js +55 -49
- package/src/global.js +1 -1
- package/src/list-box/list-box.js +9 -4
- package/src/mention/mention.d.ts +2 -0
- package/src/mention/mention.js +21 -9
- package/src/multi-select/checkbox-selection.js +8 -2
- package/src/multi-select/float-label.d.ts +5 -5
- package/src/multi-select/index.d.ts +1 -0
- package/src/multi-select/index.js +1 -0
- package/src/multi-select/interface.d.ts +1 -0
- package/src/multi-select/multi-select-model.d.ts +17 -2
- package/src/multi-select/multi-select.d.ts +34 -4
- package/src/multi-select/multi-select.js +1271 -173
- package/styles/auto-complete/_bds-definition.scss +2 -0
- package/styles/bootstrap-dark.css +8 -2
- package/styles/bootstrap.css +8 -2
- package/styles/bootstrap4.css +3 -2
- package/styles/bootstrap5-dark.css +3 -2
- package/styles/bootstrap5.css +3 -2
- package/styles/combo-box/_bds-definition.scss +2 -0
- package/styles/drop-down-base/_bds-definition.scss +134 -0
- package/styles/drop-down-list/_bds-definition.scss +134 -0
- package/styles/drop-down-list/_layout.scss +1 -1
- package/styles/drop-down-list/bootstrap-dark.css +1 -1
- package/styles/drop-down-list/bootstrap.css +1 -1
- package/styles/drop-down-list/bootstrap4.css +1 -1
- package/styles/drop-down-list/bootstrap5-dark.css +1 -1
- package/styles/drop-down-list/bootstrap5.css +1 -1
- package/styles/drop-down-list/fabric-dark.css +1 -1
- package/styles/drop-down-list/fabric.css +1 -1
- package/styles/drop-down-list/fluent-dark.css +1 -1
- package/styles/drop-down-list/fluent.css +1 -1
- package/styles/drop-down-list/highcontrast-light.css +1 -1
- package/styles/drop-down-list/highcontrast.css +1 -1
- package/styles/drop-down-list/icons/_bds.scss +14 -0
- package/styles/drop-down-list/material-dark.css +1 -1
- package/styles/drop-down-list/material.css +1 -1
- package/styles/drop-down-list/material3-dark.css +1 -1
- package/styles/drop-down-list/material3.css +1 -1
- package/styles/drop-down-list/tailwind-dark.css +1 -1
- package/styles/drop-down-list/tailwind.css +1 -1
- package/styles/drop-down-tree/_bds-definition.scss +61 -0
- package/styles/drop-down-tree/icons/_bds.scss +11 -0
- package/styles/fabric-dark.css +4 -2
- package/styles/fabric.css +4 -2
- package/styles/fluent-dark.css +8 -2
- package/styles/fluent.css +8 -2
- package/styles/highcontrast-light.css +4 -2
- package/styles/highcontrast.css +4 -2
- package/styles/list-box/_bds-definition.scss +136 -0
- package/styles/list-box/icons/_bds.scss +25 -0
- package/styles/material-dark.css +3 -2
- package/styles/material.css +3 -2
- package/styles/material3-dark.css +3 -2
- package/styles/material3.css +3 -2
- package/styles/mention/_bds-definition.scss +1 -0
- package/styles/multi-select/_bds-definition.scss +235 -0
- package/styles/multi-select/_bootstrap-dark-definition.scss +4 -0
- package/styles/multi-select/_bootstrap-definition.scss +4 -0
- package/styles/multi-select/_fluent-definition.scss +5 -0
- package/styles/multi-select/_layout.scss +8 -1
- package/styles/multi-select/bootstrap-dark.css +7 -1
- package/styles/multi-select/bootstrap.css +7 -1
- package/styles/multi-select/bootstrap4.css +2 -1
- package/styles/multi-select/bootstrap5-dark.css +2 -1
- package/styles/multi-select/bootstrap5.css +2 -1
- package/styles/multi-select/fabric-dark.css +3 -1
- package/styles/multi-select/fabric.css +3 -1
- package/styles/multi-select/fluent-dark.css +7 -1
- package/styles/multi-select/fluent.css +7 -1
- package/styles/multi-select/highcontrast-light.css +3 -1
- package/styles/multi-select/highcontrast.css +3 -1
- package/styles/multi-select/icons/_bds.scss +26 -0
- package/styles/multi-select/material-dark.css +2 -1
- package/styles/multi-select/material.css +2 -1
- package/styles/multi-select/material3-dark.css +2 -1
- package/styles/multi-select/material3.css +2 -1
- package/styles/multi-select/tailwind-dark.css +2 -1
- package/styles/multi-select/tailwind.css +2 -1
- package/styles/tailwind-dark.css +3 -2
- package/styles/tailwind.css +3 -2
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Animation, Browser, ChildProperty, Complex, Component, Event, EventHandler, KeyboardEvents, L10n, NotifyPropertyChanges, Property, SanitizeHtmlHelper, Touch, addClass, append, attributes, classList, closest, compile, createElement, debounce, detach, extend, formatUnit, getComponent, getUniqueID, getValue, isNullOrUndefined, isUndefined, matches, prepend, remove, removeClass, rippleEffect, select, selectAll, setStyleAttribute, setValue } from '@syncfusion/ej2-base';
|
|
2
2
|
import { DataManager, DataUtil, JsonAdaptor, Predicate, Query } from '@syncfusion/ej2-data';
|
|
3
3
|
import { ListBase, Sortable, cssClass, moveTo } from '@syncfusion/ej2-lists';
|
|
4
|
+
import { Skeleton } from '@syncfusion/ej2-notifications';
|
|
4
5
|
import { Popup, createSpinner, getZindexPartial, hideSpinner, isCollide, showSpinner } from '@syncfusion/ej2-popups';
|
|
5
6
|
import { Input, TextBox } from '@syncfusion/ej2-inputs';
|
|
6
|
-
import { Skeleton } from '@syncfusion/ej2-notifications';
|
|
7
7
|
import { Button, createCheckBox } from '@syncfusion/ej2-buttons';
|
|
8
8
|
import { TreeView } from '@syncfusion/ej2-navigations';
|
|
9
9
|
|
|
@@ -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
|
}
|
|
@@ -1068,7 +1368,7 @@ let DropDownBase = class DropDownBase extends Component {
|
|
|
1068
1368
|
this.trigger('actionComplete', e, (e) => {
|
|
1069
1369
|
if (!this.virtualGroupDataSource && this.isVirtualizationEnabled) {
|
|
1070
1370
|
this.isRemoteDataUpdated = true;
|
|
1071
|
-
if ((this.getModuleName() === 'combobox' && this.isAllowFiltering && this.isVirtualizationEnabled && e.result)) {
|
|
1371
|
+
if ((this.getModuleName() === 'combobox' && !this.initialRemoteRender && this.isAllowFiltering && this.isVirtualizationEnabled && e.result)) {
|
|
1072
1372
|
e.result = e.result.result;
|
|
1073
1373
|
}
|
|
1074
1374
|
if (e.result.length > 0) {
|
|
@@ -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
|
/**
|
|
@@ -2263,7 +2567,7 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
2263
2567
|
this.isFilterFocus = false;
|
|
2264
2568
|
this.beforePopupOpen = false;
|
|
2265
2569
|
this.initial = true;
|
|
2266
|
-
this.
|
|
2570
|
+
this.initialRemoteRender = false;
|
|
2267
2571
|
this.isNotSearchList = false;
|
|
2268
2572
|
this.isTyped = false;
|
|
2269
2573
|
this.isSelected = false;
|
|
@@ -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);
|
|
@@ -2552,7 +2861,7 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
2552
2861
|
this.viewPortInfo.endIndex = this.virtualItemEndIndex = this.itemCount;
|
|
2553
2862
|
this.renderList();
|
|
2554
2863
|
if (this.dataSource instanceof DataManager) {
|
|
2555
|
-
this.
|
|
2864
|
+
this.initialRemoteRender = true;
|
|
2556
2865
|
}
|
|
2557
2866
|
else {
|
|
2558
2867
|
this.updateValues();
|
|
@@ -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,27 +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 : '';
|
|
3541
|
-
|
|
3542
|
-
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
|
|
3546
|
-
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
}
|
|
3835
|
+
let currentValue = this.allowObjectBinding && !isNullOrUndefined(this.value) ? getValue((this.fields.value) ? this.fields.value : '', this.value) : this.value;
|
|
3836
|
+
if (this.dataSource instanceof DataManager && this.virtualGroupDataSource) {
|
|
3837
|
+
const getItem = new DataManager(this.virtualGroupDataSource).executeLocal(new Query().where(new Predicate(fields, 'equal', currentValue)));
|
|
3838
|
+
if (getItem && getItem.length > 0) {
|
|
3839
|
+
this.itemData = getItem[0];
|
|
3840
|
+
const dataItem = this.getItemData();
|
|
3841
|
+
let value = this.allowObjectBinding ? this.getDataByValue(dataItem.value) : dataItem.value;
|
|
3842
|
+
if ((this.value === dataItem.value && this.text !== dataItem.text) || (this.value !== dataItem.value && this.text === dataItem.text)) {
|
|
3843
|
+
this.setProperties({ 'text': dataItem.text, 'value': value });
|
|
3550
3844
|
}
|
|
3551
|
-
}
|
|
3845
|
+
}
|
|
3552
3846
|
}
|
|
3553
3847
|
else {
|
|
3554
|
-
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)));
|
|
3555
3849
|
if (getItem && getItem.length > 0) {
|
|
3556
3850
|
this.itemData = getItem[0];
|
|
3557
3851
|
const dataItem = this.getItemData();
|
|
3852
|
+
let value = this.allowObjectBinding ? this.getDataByValue(dataItem.value) : dataItem.value;
|
|
3558
3853
|
if ((this.value === dataItem.value && this.text !== dataItem.text) || (this.value !== dataItem.value && this.text === dataItem.text)) {
|
|
3559
|
-
this.setProperties({ 'text': dataItem.text, 'value':
|
|
3854
|
+
this.setProperties({ 'text': dataItem.text, 'value': value });
|
|
3560
3855
|
}
|
|
3561
3856
|
}
|
|
3562
3857
|
}
|
|
@@ -3670,10 +3965,20 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
3670
3965
|
* @param {MouseEvent | KeyboardEvent | TouchEvent} eve - Specifies the event arguments.
|
|
3671
3966
|
* @returns {void}
|
|
3672
3967
|
*/
|
|
3673
|
-
onChangeEvent(eve) {
|
|
3968
|
+
onChangeEvent(eve, isCustomValue) {
|
|
3674
3969
|
const dataItem = this.getItemData();
|
|
3675
|
-
|
|
3676
|
-
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);
|
|
3677
3982
|
this.detachChangeEvent(eve);
|
|
3678
3983
|
}
|
|
3679
3984
|
detachChanges(value) {
|
|
@@ -3700,7 +4005,7 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
3700
4005
|
detachChangeEvent(eve) {
|
|
3701
4006
|
this.isSelected = false;
|
|
3702
4007
|
this.previousValue = this.value;
|
|
3703
|
-
this.activeIndex = this.index;
|
|
4008
|
+
this.activeIndex = this.enableVirtualization ? this.getIndexByValue(this.value) : this.index;
|
|
3704
4009
|
this.typedString = !isNullOrUndefined(this.text) ? this.text : '';
|
|
3705
4010
|
if (!this.initial) {
|
|
3706
4011
|
const items = this.detachChanges(this.itemData);
|
|
@@ -3747,16 +4052,17 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
3747
4052
|
}
|
|
3748
4053
|
setHiddenValue() {
|
|
3749
4054
|
if (!isNullOrUndefined(this.value)) {
|
|
4055
|
+
let value = this.allowObjectBinding && !isNullOrUndefined(this.value) ? getValue((this.fields.value) ? this.fields.value : '', this.value) : this.value;
|
|
3750
4056
|
if (this.hiddenElement.querySelector('option')) {
|
|
3751
4057
|
const selectedElement = this.hiddenElement.querySelector('option');
|
|
3752
4058
|
selectedElement.textContent = this.text;
|
|
3753
|
-
selectedElement.setAttribute('value',
|
|
4059
|
+
selectedElement.setAttribute('value', value.toString());
|
|
3754
4060
|
}
|
|
3755
4061
|
else {
|
|
3756
4062
|
if (!isNullOrUndefined(this.hiddenElement)) {
|
|
3757
4063
|
this.hiddenElement.innerHTML = '<option selected>' + this.text + '</option>';
|
|
3758
4064
|
const selectedElement = this.hiddenElement.querySelector('option');
|
|
3759
|
-
selectedElement.setAttribute('value',
|
|
4065
|
+
selectedElement.setAttribute('value', value.toString());
|
|
3760
4066
|
}
|
|
3761
4067
|
}
|
|
3762
4068
|
}
|
|
@@ -3773,6 +4079,7 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
3773
4079
|
onFilterUp(e) {
|
|
3774
4080
|
if (!(e.ctrlKey && e.keyCode === 86) && (this.isValidKey || e.keyCode === 40 || e.keyCode === 38)) {
|
|
3775
4081
|
this.isValidKey = false;
|
|
4082
|
+
this.firstItem = this.dataSource && this.dataSource.length > 0 ? this.dataSource[0] : null;
|
|
3776
4083
|
switch (e.keyCode) {
|
|
3777
4084
|
case 38: //up arrow
|
|
3778
4085
|
case 40: //down arrow
|
|
@@ -3829,42 +4136,6 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
3829
4136
|
this.isValidKey = false;
|
|
3830
4137
|
}
|
|
3831
4138
|
}
|
|
3832
|
-
getFilteringSkeletonCount() {
|
|
3833
|
-
const difference = this.dataCount - this.viewPortInfo.endIndex;
|
|
3834
|
-
const currentSkeletonCount = this.skeletonCount;
|
|
3835
|
-
this.getSkeletonCount(true);
|
|
3836
|
-
this.skeletonCount = this.dataCount > this.itemCount * 2 ? this.skeletonCount : difference > this.skeletonCount ? this.skeletonCount : difference > 0 ? difference : 0;
|
|
3837
|
-
let skeletonUpdated = true;
|
|
3838
|
-
if (this.getModuleName() === 'autocomplete' && (this.totalItemCount != 0 && this.totalItemCount < (this.itemCount * 2))) {
|
|
3839
|
-
this.skeletonCount = 0;
|
|
3840
|
-
skeletonUpdated = false;
|
|
3841
|
-
}
|
|
3842
|
-
if (!this.list.classList.contains(dropDownBaseClasses.noData)) {
|
|
3843
|
-
const isSkeletonCountChange = currentSkeletonCount !== this.skeletonCount;
|
|
3844
|
-
if (currentSkeletonCount !== this.skeletonCount && skeletonUpdated) {
|
|
3845
|
-
this.UpdateSkeleton(true, Math.abs(currentSkeletonCount - this.skeletonCount));
|
|
3846
|
-
}
|
|
3847
|
-
else {
|
|
3848
|
-
this.UpdateSkeleton();
|
|
3849
|
-
}
|
|
3850
|
-
this.liCollections = this.list.querySelectorAll('.e-list-item');
|
|
3851
|
-
if ((this.list.getElementsByClassName('e-virtual-ddl').length > 0)) {
|
|
3852
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3853
|
-
this.list.getElementsByClassName('e-virtual-ddl')[0].style = this.GetVirtualTrackHeight();
|
|
3854
|
-
}
|
|
3855
|
-
if (this.list.getElementsByClassName('e-virtual-ddl-content').length > 0) {
|
|
3856
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3857
|
-
this.list.getElementsByClassName('e-virtual-ddl-content')[0].style = this.getTransformValues();
|
|
3858
|
-
}
|
|
3859
|
-
}
|
|
3860
|
-
}
|
|
3861
|
-
getSkeletonCount(retainSkeleton) {
|
|
3862
|
-
this.virtualListHeight = this.listHeight != null ? parseInt(this.listHeight, 10) : this.virtualListHeight;
|
|
3863
|
-
const actualCount = this.virtualListHeight > 0 ? Math.floor(this.virtualListHeight / this.listItemHeight) : 0;
|
|
3864
|
-
this.skeletonCount = actualCount * 2 < this.itemCount ? this.itemCount : actualCount * 2;
|
|
3865
|
-
this.itemCount = retainSkeleton ? this.itemCount : this.skeletonCount;
|
|
3866
|
-
this.skeletonCount = Math.floor(this.skeletonCount / 2) + 2;
|
|
3867
|
-
}
|
|
3868
4139
|
onFilterDown(e) {
|
|
3869
4140
|
switch (e.keyCode) {
|
|
3870
4141
|
case 13: //enter
|
|
@@ -3919,14 +4190,51 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
3919
4190
|
}
|
|
3920
4191
|
}
|
|
3921
4192
|
}
|
|
3922
|
-
|
|
3923
|
-
|
|
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
|
+
}
|
|
3924
4225
|
}
|
|
3925
4226
|
if (this.isIncrementalRequest) {
|
|
3926
4227
|
filterQuery.take(this.incrementalEndIndex);
|
|
3927
4228
|
}
|
|
3928
4229
|
else {
|
|
3929
|
-
|
|
4230
|
+
if (!takeExists) {
|
|
4231
|
+
if (queryTakeValue > 0) {
|
|
4232
|
+
filterQuery.take(queryTakeValue);
|
|
4233
|
+
}
|
|
4234
|
+
else {
|
|
4235
|
+
filterQuery.take(takeValue);
|
|
4236
|
+
}
|
|
4237
|
+
}
|
|
3930
4238
|
}
|
|
3931
4239
|
filterQuery.requiresCount();
|
|
3932
4240
|
}
|
|
@@ -4145,29 +4453,6 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
4145
4453
|
this.renderPopup();
|
|
4146
4454
|
}
|
|
4147
4455
|
}
|
|
4148
|
-
UpdateSkeleton(isSkeletonCountChange, skeletonCount) {
|
|
4149
|
-
let isContainSkeleton = this.list.querySelector('.e-virtual-ddl-content');
|
|
4150
|
-
let isContainVirtualList = this.list.querySelector('.e-virtual-list');
|
|
4151
|
-
if (isContainSkeleton && (!isContainVirtualList || isSkeletonCountChange) && this.enableVirtualization) {
|
|
4152
|
-
const totalSkeletonCount = isSkeletonCountChange ? skeletonCount : this.skeletonCount;
|
|
4153
|
-
for (let i = 0; i < totalSkeletonCount; i++) {
|
|
4154
|
-
const liElement = this.createElement('li', { className: dropDownListClasses.virtualList, styles: 'overflow: inherit' });
|
|
4155
|
-
if (this.enableVirtualization && this.itemTemplate) {
|
|
4156
|
-
liElement.style.height = this.listItemHeight + 'px';
|
|
4157
|
-
}
|
|
4158
|
-
let skeleton = new Skeleton({
|
|
4159
|
-
shape: "Text",
|
|
4160
|
-
height: "10px",
|
|
4161
|
-
width: "95%",
|
|
4162
|
-
cssClass: "e-skeleton-text",
|
|
4163
|
-
});
|
|
4164
|
-
skeleton.appendTo(this.createElement('div'));
|
|
4165
|
-
liElement.appendChild(skeleton.element);
|
|
4166
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4167
|
-
isContainSkeleton.firstChild.insertBefore(liElement, isContainSkeleton.firstChild.children[0]);
|
|
4168
|
-
}
|
|
4169
|
-
}
|
|
4170
|
-
}
|
|
4171
4456
|
getTakeValue() {
|
|
4172
4457
|
return this.allowFiltering && this.getModuleName() === 'dropdownlist' && Browser.isDevice ? Math.round(window.outerHeight / this.listItemHeight) : this.itemCount;
|
|
4173
4458
|
}
|
|
@@ -4202,17 +4487,22 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
4202
4487
|
if (!isNullOrUndefined(ulElement)) {
|
|
4203
4488
|
attributes(ulElement, { 'id': this.element.id + '_options', 'role': 'listbox', 'aria-hidden': 'false', 'aria-label': 'listbox' });
|
|
4204
4489
|
}
|
|
4205
|
-
if (this.
|
|
4490
|
+
if (this.initialRemoteRender) {
|
|
4206
4491
|
this.initial = true;
|
|
4207
4492
|
this.activeIndex = this.index;
|
|
4208
|
-
this.
|
|
4493
|
+
this.initialRemoteRender = false;
|
|
4209
4494
|
if (this.value && this.dataSource instanceof DataManager) {
|
|
4210
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;
|
|
4211
4497
|
const fieldValue = this.fields.value.split('.');
|
|
4212
|
-
|
|
4213
|
-
this.checkFieldValue(x, fieldValue) ===
|
|
4498
|
+
let checkVal = list.some((x) => isNullOrUndefined(x[checkField]) && fieldValue.length > 1 ?
|
|
4499
|
+
this.checkFieldValue(x, fieldValue) === value : x[checkField] === value);
|
|
4500
|
+
if (this.enableVirtualization && this.virtualGroupDataSource) {
|
|
4501
|
+
checkVal = this.virtualGroupDataSource.some((x) => isNullOrUndefined(x[checkField]) && fieldValue.length > 1 ?
|
|
4502
|
+
this.checkFieldValue(x, fieldValue) === value : x[checkField] === value);
|
|
4503
|
+
}
|
|
4214
4504
|
if (!checkVal) {
|
|
4215
|
-
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)))
|
|
4216
4506
|
.then((e) => {
|
|
4217
4507
|
if (e.result.length > 0) {
|
|
4218
4508
|
this.addItem(e.result, list.length);
|
|
@@ -4381,46 +4671,19 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
4381
4671
|
updateSelectionList() {
|
|
4382
4672
|
let selectedItem = this.list && this.list.querySelector('.' + 'e-active');
|
|
4383
4673
|
if (!selectedItem && !isNullOrUndefined(this.value)) {
|
|
4384
|
-
|
|
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);
|
|
4385
4676
|
if (findEle) {
|
|
4386
4677
|
findEle.classList.add('e-active');
|
|
4387
4678
|
}
|
|
4388
4679
|
}
|
|
4389
4680
|
}
|
|
4390
|
-
checkAndResetCache() {
|
|
4391
|
-
if (this.enableVirtualization) {
|
|
4392
|
-
this.generatedDataObject = {};
|
|
4393
|
-
this.virtualItemStartIndex = this.virtualItemEndIndex = 0;
|
|
4394
|
-
this.viewPortInfo = { currentPageNumber: null,
|
|
4395
|
-
direction: null,
|
|
4396
|
-
sentinelInfo: {},
|
|
4397
|
-
offsets: {},
|
|
4398
|
-
startIndex: 0,
|
|
4399
|
-
endIndex: this.itemCount, };
|
|
4400
|
-
this.selectedValueInfo = null;
|
|
4401
|
-
}
|
|
4402
|
-
}
|
|
4403
4681
|
removeFocus() {
|
|
4404
4682
|
const highlightedItem = this.list.querySelectorAll('.' + dropDownListClasses.focus);
|
|
4405
4683
|
if (highlightedItem && highlightedItem.length) {
|
|
4406
4684
|
removeClass(highlightedItem, dropDownListClasses.focus);
|
|
4407
4685
|
}
|
|
4408
4686
|
}
|
|
4409
|
-
getTransformValues() {
|
|
4410
|
-
let translateY = this.viewPortInfo.startIndex * this.listItemHeight;
|
|
4411
|
-
translateY = translateY - (this.skeletonCount * this.listItemHeight);
|
|
4412
|
-
translateY = this.viewPortInfo.startIndex === 0 && this.listData && this.listData.length === 0 ? 0 : translateY;
|
|
4413
|
-
const styleText = `transform: translate(0px, ${translateY}px);`;
|
|
4414
|
-
return styleText;
|
|
4415
|
-
}
|
|
4416
|
-
GetVirtualTrackHeight() {
|
|
4417
|
-
const height = this.totalItemCount === this.viewPortInfo.endIndex ? this.totalItemCount * this.listItemHeight - this.itemCount * this.listItemHeight : this.totalItemCount * this.listItemHeight;
|
|
4418
|
-
const heightDimension = `height: ${height - this.itemCount * this.listItemHeight}px;`;
|
|
4419
|
-
if (this.getModuleName() === 'autocomplete' && this.skeletonCount === 0) {
|
|
4420
|
-
return "height: 0px;";
|
|
4421
|
-
}
|
|
4422
|
-
return heightDimension;
|
|
4423
|
-
}
|
|
4424
4687
|
renderPopup(e) {
|
|
4425
4688
|
if (this.popupObj && document.body.contains(this.popupObj.element)) {
|
|
4426
4689
|
this.refreshPopup();
|
|
@@ -4435,7 +4698,7 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
4435
4698
|
popupEle.setAttribute('aria-label', this.element.id);
|
|
4436
4699
|
popupEle.setAttribute('role', 'dialog');
|
|
4437
4700
|
const searchBox = this.setSearchBox(popupEle);
|
|
4438
|
-
this.
|
|
4701
|
+
this.listContainerHeight = formatUnit(this.popupHeight);
|
|
4439
4702
|
if (this.headerTemplate) {
|
|
4440
4703
|
this.setHeaderTemplate(popupEle);
|
|
4441
4704
|
}
|
|
@@ -4479,19 +4742,19 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
4479
4742
|
this.searchBoxHeight = 0;
|
|
4480
4743
|
if (!isNullOrUndefined(searchBox.container) && this.getModuleName() !== 'combobox' && this.getModuleName() !== 'autocomplete') {
|
|
4481
4744
|
this.searchBoxHeight = (searchBox.container.parentElement).getBoundingClientRect().height;
|
|
4482
|
-
this.
|
|
4745
|
+
this.listContainerHeight = (parseInt(this.listContainerHeight, 10) - (this.searchBoxHeight)).toString() + 'px';
|
|
4483
4746
|
}
|
|
4484
4747
|
if (this.headerTemplate) {
|
|
4485
4748
|
this.header = this.header ? this.header : popupEle.querySelector('.e-ddl-header');
|
|
4486
4749
|
const height = Math.round(this.header.getBoundingClientRect().height);
|
|
4487
|
-
this.
|
|
4750
|
+
this.listContainerHeight = (parseInt(this.listContainerHeight, 10) - (height + this.searchBoxHeight)).toString() + 'px';
|
|
4488
4751
|
}
|
|
4489
4752
|
if (this.footerTemplate) {
|
|
4490
4753
|
this.footer = this.footer ? this.footer : popupEle.querySelector('.e-ddl-footer');
|
|
4491
4754
|
const height = Math.round(this.footer.getBoundingClientRect().height);
|
|
4492
|
-
this.
|
|
4755
|
+
this.listContainerHeight = (parseInt(this.listContainerHeight, 10) - (height + this.searchBoxHeight)).toString() + 'px';
|
|
4493
4756
|
}
|
|
4494
|
-
this.list.style.maxHeight = (parseInt(this.
|
|
4757
|
+
this.list.style.maxHeight = (parseInt(this.listContainerHeight, 10) - 2).toString() + 'px'; // due to box-sizing property
|
|
4495
4758
|
popupEle.style.maxHeight = formatUnit(this.popupHeight);
|
|
4496
4759
|
}
|
|
4497
4760
|
else {
|
|
@@ -4524,6 +4787,9 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
4524
4787
|
this.getFocusElement();
|
|
4525
4788
|
this.checkCollision(popupEle);
|
|
4526
4789
|
if (Browser.isDevice) {
|
|
4790
|
+
if ((parseInt(this.popupWidth.toString(), 10) > window.outerWidth) && !(this.getModuleName() === 'dropdownlist' && this.allowFiltering)) {
|
|
4791
|
+
this.popupObj.element.classList.add('e-wide-popup');
|
|
4792
|
+
}
|
|
4527
4793
|
this.popupObj.element.classList.add(dropDownListClasses.device);
|
|
4528
4794
|
if (this.getModuleName() === 'dropdownlist' || (this.getModuleName() === 'combobox'
|
|
4529
4795
|
&& !this.allowFiltering && this.isDropDownClick)) {
|
|
@@ -4794,6 +5060,9 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
4794
5060
|
this.list.scrollTop += nextOffset;
|
|
4795
5061
|
}
|
|
4796
5062
|
else {
|
|
5063
|
+
if (this.enableVirtualization) {
|
|
5064
|
+
liCount = keyAction == "pageDown" ? this.getPageCount() : liCount;
|
|
5065
|
+
}
|
|
4797
5066
|
this.list.scrollTop += this.selectedLI.offsetHeight * liCount;
|
|
4798
5067
|
}
|
|
4799
5068
|
this.isPreventKeyAction = this.IsScrollerAtEnd() ? false : this.isPreventKeyAction;
|
|
@@ -4846,6 +5115,9 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
4846
5115
|
else if (nextOffset < 0 || isPageUpKeyAction) {
|
|
4847
5116
|
var currentElementValue = this.selectedLI ? this.selectedLI.getAttribute('data-value') : null;
|
|
4848
5117
|
var liCount = keyAction == "pageUp" ? this.getPageCount() - 2 : 1;
|
|
5118
|
+
if (this.enableVirtualization) {
|
|
5119
|
+
liCount = keyAction == "pageUp" ? this.getPageCount() : liCount;
|
|
5120
|
+
}
|
|
4849
5121
|
if (this.enableVirtualization && this.isKeyBoardAction && firstElementValue && currentElementValue === firstElementValue && keyAction != "home" && !this.isVirtualScrolling) {
|
|
4850
5122
|
this.isUpwardScrolling = true;
|
|
4851
5123
|
this.isPreventKeyAction = true;
|
|
@@ -4942,6 +5214,7 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
4942
5214
|
let isFilterValue = !isNullOrUndefined(this.filterInput) && !isNullOrUndefined(this.filterInput.value) && this.filterInput.value !== '';
|
|
4943
5215
|
const typedString = this.getModuleName() === 'combobox' ? this.typedString : null;
|
|
4944
5216
|
this.isTyped = false;
|
|
5217
|
+
this.isVirtualTrackHeight = false;
|
|
4945
5218
|
if (!(this.popupObj && document.body.contains(this.popupObj.element) && this.beforePopupOpen)) {
|
|
4946
5219
|
return;
|
|
4947
5220
|
}
|
|
@@ -5030,8 +5303,8 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
5030
5303
|
}
|
|
5031
5304
|
}
|
|
5032
5305
|
});
|
|
5033
|
-
if (
|
|
5034
|
-
this.
|
|
5306
|
+
if (Browser.isDevice && !eventArgs.cancel && this.popupObj.element.classList.contains('e-wide-popup')) {
|
|
5307
|
+
this.popupObj.element.classList.remove('e-wide-popup');
|
|
5035
5308
|
}
|
|
5036
5309
|
let dataSourceCount;
|
|
5037
5310
|
if (this.dataSource instanceof DataManager) {
|
|
@@ -5196,6 +5469,9 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
5196
5469
|
this.listItemHeight = this.getListHeight();
|
|
5197
5470
|
this.getSkeletonCount();
|
|
5198
5471
|
this.updateVirtualizationProperties(this.itemCount, this.allowFiltering);
|
|
5472
|
+
if (this.index !== null) {
|
|
5473
|
+
this.activeIndex = this.index + this.skeletonCount;
|
|
5474
|
+
}
|
|
5199
5475
|
}
|
|
5200
5476
|
this.initValue();
|
|
5201
5477
|
this.selectedValueInfo = this.viewPortInfo;
|
|
@@ -5205,7 +5481,7 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
5205
5481
|
}
|
|
5206
5482
|
else if (this.element.tagName === 'SELECT' && this.element.options[0]) {
|
|
5207
5483
|
const selectElement = this.element;
|
|
5208
|
-
this.value = selectElement.options[selectElement.selectedIndex].value;
|
|
5484
|
+
this.value = this.allowObjectBinding ? this.getDataByValue(selectElement.options[selectElement.selectedIndex].value) : selectElement.options[selectElement.selectedIndex].value;
|
|
5209
5485
|
this.text = isNullOrUndefined(this.value) ? null : selectElement.options[selectElement.selectedIndex].textContent;
|
|
5210
5486
|
this.initValue();
|
|
5211
5487
|
}
|
|
@@ -5357,7 +5633,7 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
5357
5633
|
this.actionData = this.actionCompleteData;
|
|
5358
5634
|
}
|
|
5359
5635
|
}
|
|
5360
|
-
updateDataSource(props) {
|
|
5636
|
+
updateDataSource(props, oldProps) {
|
|
5361
5637
|
if (this.inputElement.value !== '' || (!isNullOrUndefined(props) && (isNullOrUndefined(props.dataSource)
|
|
5362
5638
|
|| (!(props.dataSource instanceof DataManager) && props.dataSource.length === 0)))) {
|
|
5363
5639
|
this.clearAll(null, props);
|
|
@@ -5367,7 +5643,7 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
5367
5643
|
EventHandler.add(this.list, 'scroll', this.setFloatingHeader, this);
|
|
5368
5644
|
}
|
|
5369
5645
|
if (!(!isNullOrUndefined(props) && (isNullOrUndefined(props.dataSource)
|
|
5370
|
-
|| (!(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))) {
|
|
5371
5647
|
this.typedString = '';
|
|
5372
5648
|
this.resetList(this.dataSource);
|
|
5373
5649
|
}
|
|
@@ -5376,9 +5652,11 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
5376
5652
|
}
|
|
5377
5653
|
}
|
|
5378
5654
|
checkCustomValue() {
|
|
5379
|
-
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);
|
|
5380
5657
|
const dataItem = this.getItemData();
|
|
5381
|
-
this.
|
|
5658
|
+
let value = this.allowObjectBinding ? this.itemData : dataItem.value;
|
|
5659
|
+
this.setProperties({ 'text': dataItem.text, 'value': value });
|
|
5382
5660
|
}
|
|
5383
5661
|
updateInputFields() {
|
|
5384
5662
|
if (this.getModuleName() === 'dropdownlist') {
|
|
@@ -5458,11 +5736,11 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
5458
5736
|
}
|
|
5459
5737
|
if (!this.list) {
|
|
5460
5738
|
if (this.dataSource instanceof DataManager) {
|
|
5461
|
-
this.
|
|
5739
|
+
this.initialRemoteRender = true;
|
|
5462
5740
|
}
|
|
5463
5741
|
this.renderList();
|
|
5464
5742
|
}
|
|
5465
|
-
if (!this.
|
|
5743
|
+
if (!this.initialRemoteRender) {
|
|
5466
5744
|
const li = this.getElementByText(newProp.text);
|
|
5467
5745
|
if (!this.checkValidLi(li)) {
|
|
5468
5746
|
if (this.liCollections && this.liCollections.length === 100 &&
|
|
@@ -5499,6 +5777,9 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
5499
5777
|
this.clearAll();
|
|
5500
5778
|
break;
|
|
5501
5779
|
}
|
|
5780
|
+
if (this.allowObjectBinding && !isNullOrUndefined(newProp.value) && !isNullOrUndefined(oldProp.value) && this.isObjectInArray(newProp.value, [oldProp.value])) {
|
|
5781
|
+
return;
|
|
5782
|
+
}
|
|
5502
5783
|
if (this.enableVirtualization) {
|
|
5503
5784
|
this.updateValues();
|
|
5504
5785
|
this.updateInputFields();
|
|
@@ -5511,12 +5792,13 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
5511
5792
|
this.notify('beforeValueChange', { newProp: newProp }); // gird component value type change
|
|
5512
5793
|
if (!this.list) {
|
|
5513
5794
|
if (this.dataSource instanceof DataManager) {
|
|
5514
|
-
this.
|
|
5795
|
+
this.initialRemoteRender = true;
|
|
5515
5796
|
}
|
|
5516
5797
|
this.renderList();
|
|
5517
5798
|
}
|
|
5518
|
-
if (!this.
|
|
5519
|
-
const
|
|
5799
|
+
if (!this.initialRemoteRender) {
|
|
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);
|
|
5520
5802
|
if (!this.checkValidLi(item)) {
|
|
5521
5803
|
if (this.liCollections && this.liCollections.length === 100 &&
|
|
5522
5804
|
this.getModuleName() === 'autocomplete' && this.listData.length > 100) {
|
|
@@ -5526,7 +5808,8 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
5526
5808
|
const listLength = this.getItems().length;
|
|
5527
5809
|
const checkField = isNullOrUndefined(this.fields.value) ? this.fields.text : this.fields.value;
|
|
5528
5810
|
this.typedString = '';
|
|
5529
|
-
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)))
|
|
5530
5813
|
.then((e) => {
|
|
5531
5814
|
if (e.result.length > 0) {
|
|
5532
5815
|
this.addItem(e.result, listLength);
|
|
@@ -5555,11 +5838,11 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
5555
5838
|
}
|
|
5556
5839
|
if (!this.list) {
|
|
5557
5840
|
if (this.dataSource instanceof DataManager) {
|
|
5558
|
-
this.
|
|
5841
|
+
this.initialRemoteRender = true;
|
|
5559
5842
|
}
|
|
5560
5843
|
this.renderList();
|
|
5561
5844
|
}
|
|
5562
|
-
if (!this.
|
|
5845
|
+
if (!this.initialRemoteRender && this.liCollections) {
|
|
5563
5846
|
const element = this.liCollections[newProp.index];
|
|
5564
5847
|
if (!this.checkValidLi(element)) {
|
|
5565
5848
|
if (this.liCollections && this.liCollections.length === 100 &&
|
|
@@ -5638,6 +5921,8 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
5638
5921
|
}
|
|
5639
5922
|
}
|
|
5640
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;
|
|
5641
5926
|
li = this.getElementByValue(newProp);
|
|
5642
5927
|
if (!this.checkValidLi(li)) {
|
|
5643
5928
|
this.setOldValue(oldProp);
|
|
@@ -5700,6 +5985,7 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
5700
5985
|
if (!this.enabled) {
|
|
5701
5986
|
return;
|
|
5702
5987
|
}
|
|
5988
|
+
this.firstItem = this.dataSource && this.dataSource.length > 0 ? this.dataSource[0] : null;
|
|
5703
5989
|
if (this.isReact && this.getModuleName() === 'combobox' && this.itemTemplate && this.isCustomFilter && this.isAddNewItemTemplate) {
|
|
5704
5990
|
this.renderList();
|
|
5705
5991
|
this.isAddNewItemTemplate = false;
|
|
@@ -5720,6 +6006,9 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
5720
6006
|
}
|
|
5721
6007
|
else if (isNullOrUndefined(this.list) || !isUndefined(this.list) && (this.list.classList.contains(dropDownBaseClasses.noData) ||
|
|
5722
6008
|
this.list.querySelectorAll('.' + dropDownBaseClasses.li).length <= 0)) {
|
|
6009
|
+
if (this.isReact && this.isFiltering() && this.itemTemplate != null) {
|
|
6010
|
+
this.isSecondClick = false;
|
|
6011
|
+
}
|
|
5723
6012
|
this.renderList(e);
|
|
5724
6013
|
}
|
|
5725
6014
|
if (this.enableVirtualization && this.listData && this.listData.length) {
|
|
@@ -5773,7 +6062,8 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
5773
6062
|
}
|
|
5774
6063
|
this.isEscapeKey = false;
|
|
5775
6064
|
if (!isNullOrUndefined(this.index)) {
|
|
5776
|
-
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);
|
|
5777
6067
|
this.selectedLI = this.liCollections[this.index] || element;
|
|
5778
6068
|
if (this.selectedLI) {
|
|
5779
6069
|
this.updateSelectedItem(this.selectedLI, null, true);
|
|
@@ -5786,6 +6076,7 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
5786
6076
|
this.resetSelection();
|
|
5787
6077
|
}
|
|
5788
6078
|
}
|
|
6079
|
+
this.isVirtualTrackHeight = false;
|
|
5789
6080
|
this.closePopup(0, e);
|
|
5790
6081
|
const dataItem = this.getItemData();
|
|
5791
6082
|
let isSelectVal = !isNullOrUndefined(this.selectedLI);
|
|
@@ -5857,6 +6148,9 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
5857
6148
|
*/
|
|
5858
6149
|
destroy() {
|
|
5859
6150
|
this.isActive = false;
|
|
6151
|
+
if (this.showClearButton) {
|
|
6152
|
+
this.clearButton = document.getElementsByClassName('e-clear-icon')[0];
|
|
6153
|
+
}
|
|
5860
6154
|
resetIncrementalSearchValues(this.element.id);
|
|
5861
6155
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5862
6156
|
if (this.isReact) {
|
|
@@ -5912,6 +6206,14 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
5912
6206
|
if (this.inputElement && !isNullOrUndefined(this.inputElement.onchange)) {
|
|
5913
6207
|
this.inputElement.onchange = null;
|
|
5914
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);
|
|
5915
6217
|
if (this.isAngular) {
|
|
5916
6218
|
this.inputElement = null;
|
|
5917
6219
|
}
|
|
@@ -5926,7 +6228,7 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
5926
6228
|
getItems() {
|
|
5927
6229
|
if (!this.list) {
|
|
5928
6230
|
if (this.dataSource instanceof DataManager) {
|
|
5929
|
-
this.
|
|
6231
|
+
this.initialRemoteRender = true;
|
|
5930
6232
|
}
|
|
5931
6233
|
this.renderList();
|
|
5932
6234
|
}
|
|
@@ -6005,6 +6307,9 @@ __decorate$1([
|
|
|
6005
6307
|
__decorate$1([
|
|
6006
6308
|
Property(null)
|
|
6007
6309
|
], DropDownList.prototype, "value", void 0);
|
|
6310
|
+
__decorate$1([
|
|
6311
|
+
Property(false)
|
|
6312
|
+
], DropDownList.prototype, "allowObjectBinding", void 0);
|
|
6008
6313
|
__decorate$1([
|
|
6009
6314
|
Property(null)
|
|
6010
6315
|
], DropDownList.prototype, "index", void 0);
|
|
@@ -6174,7 +6479,6 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
6174
6479
|
this.filterTimer = null;
|
|
6175
6480
|
this.isFilteredData = false;
|
|
6176
6481
|
this.isFilterRestore = false;
|
|
6177
|
-
// eslint-disable-next-line
|
|
6178
6482
|
this.selectedData = [];
|
|
6179
6483
|
this.filterDelayTime = 300;
|
|
6180
6484
|
this.isClicked = false;
|
|
@@ -6271,7 +6575,7 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
6271
6575
|
this.inputEle.setAttribute('aria-expanded', 'false');
|
|
6272
6576
|
this.inputEle.setAttribute('role', 'combobox');
|
|
6273
6577
|
this.inputEle.setAttribute('aria-haspopup', 'tree');
|
|
6274
|
-
this.inputEle.setAttribute('aria-controls', this.element.id +
|
|
6578
|
+
this.inputEle.setAttribute('aria-controls', this.element.id + '_options');
|
|
6275
6579
|
}
|
|
6276
6580
|
if (isNullOrUndefined(this.inputEle.getAttribute('type'))) {
|
|
6277
6581
|
this.inputEle.setAttribute('type', 'text');
|
|
@@ -6314,7 +6618,9 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
6314
6618
|
this.popupDiv.classList.add(DROPDOWN);
|
|
6315
6619
|
this.tree = this.createElement('div', { id: this.element.id + '_tree' });
|
|
6316
6620
|
this.popupDiv.appendChild(this.tree);
|
|
6317
|
-
|
|
6621
|
+
if (!this.destroyPopupOnHide) {
|
|
6622
|
+
document.body.appendChild(this.popupDiv);
|
|
6623
|
+
}
|
|
6318
6624
|
this.wireTreeEvents();
|
|
6319
6625
|
addClass([this.popupDiv], DDTHIDEICON);
|
|
6320
6626
|
this.renderTree();
|
|
@@ -6419,6 +6725,7 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
6419
6725
|
if (value === '') {
|
|
6420
6726
|
this.isFilteredData = false;
|
|
6421
6727
|
this.isFilterRestore = true;
|
|
6728
|
+
this.isFromFilterChange = false;
|
|
6422
6729
|
fields = this.cloneFields(this.fields);
|
|
6423
6730
|
}
|
|
6424
6731
|
else if (args.preventDefaultAction) {
|
|
@@ -6457,7 +6764,7 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
6457
6764
|
this.treeObj.dataBind();
|
|
6458
6765
|
if (this.hasTemplate && this.portals && this.treeObj.portals) {
|
|
6459
6766
|
for (let i = 0; i < this.treeObj.portals.length; i++) {
|
|
6460
|
-
if (this.portals.indexOf(this.treeObj.portals[i])
|
|
6767
|
+
if (this.portals.indexOf(this.treeObj.portals[i]) === -1) {
|
|
6461
6768
|
this.portals.push(this.treeObj.portals[i]);
|
|
6462
6769
|
}
|
|
6463
6770
|
}
|
|
@@ -6496,7 +6803,6 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
6496
6803
|
return filteredItems;
|
|
6497
6804
|
}
|
|
6498
6805
|
nestedFilter(value, filteredFields) {
|
|
6499
|
-
// eslint-disable-next-line
|
|
6500
6806
|
const matchedDataSource = [];
|
|
6501
6807
|
for (let i = 0; i < this.treeData.length; i++) {
|
|
6502
6808
|
// eslint-disable-next-line
|
|
@@ -6508,15 +6814,12 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
6508
6814
|
filteredFields.dataSource = matchedDataSource;
|
|
6509
6815
|
return filteredFields;
|
|
6510
6816
|
}
|
|
6511
|
-
// eslint-disable-next-line
|
|
6512
6817
|
nestedChildFilter(value, node) {
|
|
6513
|
-
// eslint-disable-next-line
|
|
6514
6818
|
const children = node[this.fields.child];
|
|
6515
6819
|
if (isNullOrUndefined(children)) {
|
|
6516
6820
|
return (this.isMatchedNode(value, node)) ? node : null;
|
|
6517
6821
|
}
|
|
6518
6822
|
else {
|
|
6519
|
-
// eslint-disable-next-line
|
|
6520
6823
|
const matchedChildren = [];
|
|
6521
6824
|
for (let i = 0; i < children.length; i++) {
|
|
6522
6825
|
// eslint-disable-next-line
|
|
@@ -6537,9 +6840,7 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
6537
6840
|
}
|
|
6538
6841
|
}
|
|
6539
6842
|
selfReferencefilter(value, filteredFields) {
|
|
6540
|
-
// eslint-disable-next-line
|
|
6541
6843
|
const matchedData = [];
|
|
6542
|
-
// eslint-disable-next-line
|
|
6543
6844
|
const matchedDataSource = [];
|
|
6544
6845
|
for (let i = 0; i < this.treeData.length; i++) {
|
|
6545
6846
|
if (this.isMatchedNode(value, this.treeData[i])) {
|
|
@@ -6552,7 +6853,6 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
6552
6853
|
// eslint-disable-next-line
|
|
6553
6854
|
let parentId = matchedData[i][this.fields.parentValue];
|
|
6554
6855
|
while (!isNullOrUndefined(parentId)) {
|
|
6555
|
-
// eslint-disable-next-line
|
|
6556
6856
|
let parent = null;
|
|
6557
6857
|
for (let j = 0; j < this.treeData.length; j++) {
|
|
6558
6858
|
// eslint-disable-next-line
|
|
@@ -6575,7 +6875,6 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
6575
6875
|
filteredFields.dataSource = matchedDataSource;
|
|
6576
6876
|
return filteredFields;
|
|
6577
6877
|
}
|
|
6578
|
-
// eslint-disable-next-line
|
|
6579
6878
|
isMatchedNode(value, node, isChild, isChildFiltering) {
|
|
6580
6879
|
let checkValue;
|
|
6581
6880
|
let isObjectValue = isChild && isChildFiltering && this.isChildObject();
|
|
@@ -6930,7 +7229,7 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
6930
7229
|
this.clickHandler(e);
|
|
6931
7230
|
break;
|
|
6932
7231
|
case 'moveDown':
|
|
6933
|
-
|
|
7232
|
+
const focusedElement = this.treeObj.element.querySelector('li');
|
|
6934
7233
|
focusedElement.focus();
|
|
6935
7234
|
addClass([focusedElement], ['e-node-focus']);
|
|
6936
7235
|
}
|
|
@@ -6968,7 +7267,6 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
6968
7267
|
let remaining;
|
|
6969
7268
|
let downIconWidth = 0;
|
|
6970
7269
|
this.overFlowWrapper.innerHTML = '';
|
|
6971
|
-
// eslint-disable-next-line
|
|
6972
7270
|
const l10nLocale = { overflowCountTemplate: '+${count} more..', totalCountTemplate: '${count} selected' };
|
|
6973
7271
|
this.l10n = new L10n(this.getLocaleName(), l10nLocale, this.locale);
|
|
6974
7272
|
const remainContent = this.l10n.getConstant('overflowCountTemplate');
|
|
@@ -7251,7 +7549,6 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
7251
7549
|
if (this.selectAllText !== 'Select All' || this.unSelectAllText !== 'Unselect All') {
|
|
7252
7550
|
const template = unSelect ? this.unSelectAllText : this.selectAllText;
|
|
7253
7551
|
this.selectAllSpan.textContent = '';
|
|
7254
|
-
// eslint-disable-next-line
|
|
7255
7552
|
const compiledString = compile(template);
|
|
7256
7553
|
const templateName = unSelect ? 'unSelectAllText' : 'selectAllText';
|
|
7257
7554
|
for (const item of compiledString({}, this, templateName, null, !this.isStringTemplate)) {
|
|
@@ -7275,11 +7572,11 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
7275
7572
|
if (htmlAttr === 'class') {
|
|
7276
7573
|
this.inputWrapper.classList.add(this.htmlAttributes[`${htmlAttr}`]);
|
|
7277
7574
|
}
|
|
7278
|
-
else if (htmlAttr === 'disabled'
|
|
7575
|
+
else if (htmlAttr === 'disabled') {
|
|
7279
7576
|
this.setProperties({ enabled: false }, true);
|
|
7280
7577
|
this.setEnable();
|
|
7281
7578
|
}
|
|
7282
|
-
else if (htmlAttr === 'readonly'
|
|
7579
|
+
else if (htmlAttr === 'readonly') {
|
|
7283
7580
|
this.setProperties({ readonly: true }, true);
|
|
7284
7581
|
this.dataBind();
|
|
7285
7582
|
}
|
|
@@ -7339,7 +7636,6 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
7339
7636
|
}
|
|
7340
7637
|
setTreeValue() {
|
|
7341
7638
|
if (this.value !== null && this.value.length !== 0) {
|
|
7342
|
-
// eslint-disable-next-line
|
|
7343
7639
|
let data;
|
|
7344
7640
|
if (this.showCheckBox || this.allowMultiSelection) {
|
|
7345
7641
|
for (let i = 0; i < this.value.length; i++) {
|
|
@@ -7369,7 +7665,6 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
7369
7665
|
return;
|
|
7370
7666
|
}
|
|
7371
7667
|
if (this.text !== null) {
|
|
7372
|
-
// eslint-disable-next-line
|
|
7373
7668
|
let data;
|
|
7374
7669
|
const valArr = [];
|
|
7375
7670
|
if (this.showCheckBox || this.allowMultiSelection) {
|
|
@@ -7437,7 +7732,7 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
7437
7732
|
}
|
|
7438
7733
|
else {
|
|
7439
7734
|
if (this.showCheckBox) {
|
|
7440
|
-
|
|
7735
|
+
const difference = this.value.filter((e) => {
|
|
7441
7736
|
return this.treeObj.checkedNodes.indexOf(e) === -1;
|
|
7442
7737
|
});
|
|
7443
7738
|
if (difference.length > 0 || this.treeSettings.autoCheck) {
|
|
@@ -7459,9 +7754,7 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
7459
7754
|
this.triggerChangeEvent();
|
|
7460
7755
|
}
|
|
7461
7756
|
}
|
|
7462
|
-
// eslint-disable-next-line
|
|
7463
7757
|
getItems(givenText) {
|
|
7464
|
-
// eslint-disable-next-line
|
|
7465
7758
|
let data;
|
|
7466
7759
|
if (this.treeDataType === 1) {
|
|
7467
7760
|
for (let i = 0; i < this.treeItems.length; i++) {
|
|
@@ -7478,9 +7771,7 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
7478
7771
|
}
|
|
7479
7772
|
return data;
|
|
7480
7773
|
}
|
|
7481
|
-
// eslint-disable-next-line
|
|
7482
7774
|
getNestedItems(data, field, givenText) {
|
|
7483
|
-
// eslint-disable-next-line
|
|
7484
7775
|
let newData;
|
|
7485
7776
|
for (let i = 0, objlen = data.length; i < objlen; i++) {
|
|
7486
7777
|
// eslint-disable-next-line
|
|
@@ -7491,7 +7782,6 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
7491
7782
|
else if (typeof field.child === 'string' && !isNullOrUndefined(getValue(field.child, data[i]))) {
|
|
7492
7783
|
// eslint-disable-next-line
|
|
7493
7784
|
const childData = getValue(field.child, data[i]);
|
|
7494
|
-
// eslint-disable-next-line
|
|
7495
7785
|
newData = this.getNestedItems(childData, this.getChildType(field), givenText);
|
|
7496
7786
|
if (newData !== undefined) {
|
|
7497
7787
|
break;
|
|
@@ -7534,7 +7824,7 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
7534
7824
|
nodeTemplate: this.itemTemplate
|
|
7535
7825
|
});
|
|
7536
7826
|
this.treeObj.root = this.root ? this.root : this;
|
|
7537
|
-
this.treeObj.appendTo(
|
|
7827
|
+
this.treeObj.appendTo(this.tree);
|
|
7538
7828
|
}
|
|
7539
7829
|
/* To render the popup element */
|
|
7540
7830
|
renderPopup() {
|
|
@@ -7591,9 +7881,13 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
7591
7881
|
this.isFirstRender = false;
|
|
7592
7882
|
/* eslint-disable */
|
|
7593
7883
|
if (this.hasTemplate && this.portals) {
|
|
7594
|
-
|
|
7884
|
+
if (this.treeObj.portals) {
|
|
7885
|
+
this.portals = this.portals.concat(this.treeObj.portals.filter((item) => !this.portals.includes(item)));
|
|
7886
|
+
}
|
|
7595
7887
|
/* eslint-enable */
|
|
7596
|
-
this.
|
|
7888
|
+
if (this.isReact) {
|
|
7889
|
+
this.renderReactTemplates(this.reactCallBack);
|
|
7890
|
+
}
|
|
7597
7891
|
}
|
|
7598
7892
|
}
|
|
7599
7893
|
if (!isCancelled) {
|
|
@@ -7604,7 +7898,15 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
7604
7898
|
this.popupObj.refreshPosition();
|
|
7605
7899
|
if (!(this.showCheckBox && this.showSelectAll) && (!this.popupDiv.classList.contains(NODATA)
|
|
7606
7900
|
&& this.treeItems.length > 0)) {
|
|
7607
|
-
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
|
+
}
|
|
7608
7910
|
focusedElement.focus();
|
|
7609
7911
|
addClass([focusedElement], ['e-node-focus']);
|
|
7610
7912
|
}
|
|
@@ -7622,6 +7924,10 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
7622
7924
|
}
|
|
7623
7925
|
});
|
|
7624
7926
|
}
|
|
7927
|
+
reactCallBack() {
|
|
7928
|
+
this.updatePopupHeight();
|
|
7929
|
+
this.popupObj.refreshPosition();
|
|
7930
|
+
}
|
|
7625
7931
|
updatePopupHeight() {
|
|
7626
7932
|
if (this.isFirstRender) {
|
|
7627
7933
|
return;
|
|
@@ -7879,7 +8185,6 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
7879
8185
|
}
|
|
7880
8186
|
return null;
|
|
7881
8187
|
}
|
|
7882
|
-
// eslint-disable-next-line
|
|
7883
8188
|
getTreeDataType(ds, field) {
|
|
7884
8189
|
if (this.fields.dataSource instanceof DataManager) {
|
|
7885
8190
|
for (let i = 0; i < ds.length; i++) {
|
|
@@ -7889,8 +8194,9 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
7889
8194
|
}
|
|
7890
8195
|
return 2;
|
|
7891
8196
|
}
|
|
7892
|
-
if (isNullOrUndefined(this.fields.dataSource))
|
|
8197
|
+
if (isNullOrUndefined(this.fields.dataSource)) {
|
|
7893
8198
|
this.fields.dataSource = [];
|
|
8199
|
+
}
|
|
7894
8200
|
for (let i = 0, len = this.fields.dataSource.length; i < len; i++) {
|
|
7895
8201
|
if ((typeof field.child === 'string') && !isNullOrUndefined(getValue(field.child, this.fields.dataSource[i]))) {
|
|
7896
8202
|
return 2;
|
|
@@ -7911,9 +8217,7 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
7911
8217
|
this.treeObj.dataBind();
|
|
7912
8218
|
}
|
|
7913
8219
|
getEventArgs(args) {
|
|
7914
|
-
// eslint-disable-next-line
|
|
7915
8220
|
const checkData = args.data;
|
|
7916
|
-
// eslint-disable-next-line
|
|
7917
8221
|
const selectData = args.nodeData;
|
|
7918
8222
|
let state;
|
|
7919
8223
|
if (this.showCheckBox) {
|
|
@@ -7998,7 +8302,6 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
7998
8302
|
const target = args.event.target;
|
|
7999
8303
|
if ((target.classList.contains('e-fullrow') || target.classList.contains('e-list-text')) && this.showCheckBox) {
|
|
8000
8304
|
this.isClicked = true;
|
|
8001
|
-
// eslint-disable-next-line
|
|
8002
8305
|
const getNodeDetails = this.treeObj.getNode(args.node);
|
|
8003
8306
|
if (getNodeDetails.isChecked === 'true') {
|
|
8004
8307
|
this.treeObj.uncheckAll([args.node]);
|
|
@@ -8050,7 +8353,7 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
8050
8353
|
onNodeExpanded(args) {
|
|
8051
8354
|
if (this.hasTemplate && this.portals && this.treeObj.portals) {
|
|
8052
8355
|
for (let i = 0; i < this.treeObj.portals.length; i++) {
|
|
8053
|
-
if (this.portals.indexOf(this.treeObj.portals[i])
|
|
8356
|
+
if (this.portals.indexOf(this.treeObj.portals[i]) === -1) {
|
|
8054
8357
|
this.portals.push(this.treeObj.portals[i]);
|
|
8055
8358
|
}
|
|
8056
8359
|
}
|
|
@@ -8148,7 +8451,7 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
8148
8451
|
}
|
|
8149
8452
|
setMultiSelectValue(newValues) {
|
|
8150
8453
|
if (!this.isFilteredData) {
|
|
8151
|
-
this.setProperties({ value: this.isFromFilterChange && newValues && newValues.length
|
|
8454
|
+
this.setProperties({ value: this.isFromFilterChange && newValues && newValues.length === 0 ? this.value : newValues }, true);
|
|
8152
8455
|
this.isFromFilterChange = false;
|
|
8153
8456
|
if (newValues && newValues.length !== 0 && !this.showCheckBox) {
|
|
8154
8457
|
this.treeObj.selectedNodes = this.value.slice();
|
|
@@ -8198,9 +8501,7 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
8198
8501
|
}
|
|
8199
8502
|
this.updateSelectedValues();
|
|
8200
8503
|
}
|
|
8201
|
-
// eslint-disable-next-line
|
|
8202
8504
|
getSelectedData(value) {
|
|
8203
|
-
// eslint-disable-next-line
|
|
8204
8505
|
let data = null;
|
|
8205
8506
|
if (this.isFilteredData) {
|
|
8206
8507
|
for (let i = 0; i < this.selectedData.length; i++) {
|
|
@@ -8230,7 +8531,7 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
8230
8531
|
}
|
|
8231
8532
|
else if (this.treeDataType === 1) {
|
|
8232
8533
|
for (let i = 0, objlen = this.treeItems.length; i < objlen; i++) {
|
|
8233
|
-
|
|
8534
|
+
const dataId = getValue(this.fields.value, this.treeItems[i]);
|
|
8234
8535
|
if (!isNullOrUndefined(this.treeItems[i]) && !isNullOrUndefined(dataId) && dataId.toString() === id) {
|
|
8235
8536
|
return this.treeItems[i];
|
|
8236
8537
|
}
|
|
@@ -8247,19 +8548,19 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
8247
8548
|
return newChildItems;
|
|
8248
8549
|
}
|
|
8249
8550
|
for (let i = 0, objlen = obj.length; i < objlen; i++) {
|
|
8250
|
-
|
|
8551
|
+
const dataValue = getValue(mapper.value, obj[i]);
|
|
8251
8552
|
if (obj[i] && dataValue && dataValue.toString() === id) {
|
|
8252
8553
|
return obj[i];
|
|
8253
8554
|
}
|
|
8254
8555
|
else if (typeof mapper.child === 'string' && !isNullOrUndefined(getValue(mapper.child, obj[i]))) {
|
|
8255
|
-
|
|
8556
|
+
const childNodeData = getValue(mapper.child, obj[i]);
|
|
8256
8557
|
newChildItems = this.getChildNodeData(childNodeData, this.getChildMapperFields(mapper), id);
|
|
8257
8558
|
if (newChildItems !== undefined) {
|
|
8258
8559
|
break;
|
|
8259
8560
|
}
|
|
8260
8561
|
}
|
|
8261
8562
|
else if (this.fields.dataSource instanceof DataManager && !isNullOrUndefined(getValue('child', obj[i]))) {
|
|
8262
|
-
|
|
8563
|
+
const child = 'child';
|
|
8263
8564
|
newChildItems = this.getChildNodeData(getValue(child, obj[i]), this.getChildMapperFields(mapper), id);
|
|
8264
8565
|
if (newChildItems !== undefined) {
|
|
8265
8566
|
break;
|
|
@@ -8287,7 +8588,6 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
8287
8588
|
let temp;
|
|
8288
8589
|
let text;
|
|
8289
8590
|
let textValue = '';
|
|
8290
|
-
// eslint-disable-next-line
|
|
8291
8591
|
let selectedData;
|
|
8292
8592
|
this.hiddenElement.innerHTML = '';
|
|
8293
8593
|
let hiddenInputValue = '';
|
|
@@ -8383,7 +8683,7 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
8383
8683
|
addClass([this.inputWrapper], SHOW_CHIP);
|
|
8384
8684
|
}
|
|
8385
8685
|
const chip = this.createElement('span', {
|
|
8386
|
-
className: CHIP
|
|
8686
|
+
className: CHIP
|
|
8387
8687
|
});
|
|
8388
8688
|
if (!this.inputEle.classList.contains(CHIP_INPUT)) {
|
|
8389
8689
|
addClass([this.inputEle], CHIP_INPUT);
|
|
@@ -8425,7 +8725,6 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
8425
8725
|
this.header = this.createElement('div');
|
|
8426
8726
|
addClass([this.header], HEADER);
|
|
8427
8727
|
}
|
|
8428
|
-
// eslint-disable-next-line
|
|
8429
8728
|
const compiledString = this.templateComplier(this.headerTemplate);
|
|
8430
8729
|
let tempArr = compiledString({}, this, 'headerTemplate', this.headerTemplateId, this.isStringTemplate, undefined, this.header);
|
|
8431
8730
|
if (tempArr) {
|
|
@@ -8434,7 +8733,6 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
8434
8733
|
}
|
|
8435
8734
|
this.popupEle.insertBefore(this.header, this.checkAllParent ? this.checkAllParent : this.popupDiv);
|
|
8436
8735
|
}
|
|
8437
|
-
// eslint-disable-next-line
|
|
8438
8736
|
templateComplier(template) {
|
|
8439
8737
|
if (template) {
|
|
8440
8738
|
// eslint-disable-next-line
|
|
@@ -8460,7 +8758,6 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
8460
8758
|
this.footer = this.createElement('div');
|
|
8461
8759
|
addClass([this.footer], FOOTER);
|
|
8462
8760
|
}
|
|
8463
|
-
// eslint-disable-next-line
|
|
8464
8761
|
const compiledString = this.templateComplier(this.footerTemplate);
|
|
8465
8762
|
let tempArr = compiledString({}, this, 'footerTemplate', this.footerTemplateId, this.isStringTemplate, undefined, this.footer);
|
|
8466
8763
|
if (tempArr) {
|
|
@@ -8519,7 +8816,7 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
8519
8816
|
this.ensurePlaceHolder();
|
|
8520
8817
|
}
|
|
8521
8818
|
resetValue(isDynamicChange) {
|
|
8522
|
-
if (this.value
|
|
8819
|
+
if (this.value === [] && this.text == null) {
|
|
8523
8820
|
return;
|
|
8524
8821
|
}
|
|
8525
8822
|
Input.setValue(null, this.inputEle, this.floatLabelType);
|
|
@@ -8658,7 +8955,6 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
8658
8955
|
const template = actionFailure ? this.actionFailureTemplate : this.noRecordsTemplate;
|
|
8659
8956
|
const templateId = actionFailure ? this.actionFailureTemplateId : this.noRecordsTemplateId;
|
|
8660
8957
|
const templatestring = actionFailure ? 'actionFailureTemplate' : 'noRecordsTemplate';
|
|
8661
|
-
// eslint-disable-next-line
|
|
8662
8958
|
const compiledString = this.templateComplier(template);
|
|
8663
8959
|
let tempArr = compiledString({}, this, templatestring, templateId, this.isStringTemplate, undefined, this.noRecord);
|
|
8664
8960
|
if (tempArr) {
|
|
@@ -8667,7 +8963,6 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
8667
8963
|
}
|
|
8668
8964
|
}
|
|
8669
8965
|
else {
|
|
8670
|
-
// eslint-disable-next-line
|
|
8671
8966
|
const l10nLocale = { noRecordsTemplate: 'No Records Found', actionFailureTemplate: 'The Request Failed' };
|
|
8672
8967
|
this.l10n = new L10n(this.getLocaleName(), l10nLocale, this.locale);
|
|
8673
8968
|
this.noRecord.innerHTML = actionFailure ?
|
|
@@ -8898,10 +9193,10 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
8898
9193
|
this.updateTreeSettings(newProp);
|
|
8899
9194
|
break;
|
|
8900
9195
|
case 'customTemplate':
|
|
8901
|
-
if (this.mode !==
|
|
9196
|
+
if (this.mode !== 'Custom') {
|
|
8902
9197
|
return;
|
|
8903
9198
|
}
|
|
8904
|
-
this.chipCollection.innerHTML =
|
|
9199
|
+
this.chipCollection.innerHTML = '';
|
|
8905
9200
|
this.setTagValues();
|
|
8906
9201
|
break;
|
|
8907
9202
|
case 'sortOrder':
|
|
@@ -9051,6 +9346,16 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
9051
9346
|
this.filterObj = null;
|
|
9052
9347
|
}
|
|
9053
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
|
+
}
|
|
9054
9359
|
/**
|
|
9055
9360
|
* Ensures visibility of the Dropdown Tree item by using item value or item element.
|
|
9056
9361
|
* If many Dropdown Tree items are present, and we are in need to find a particular item, then the `ensureVisible` property
|
|
@@ -9068,7 +9373,6 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
9068
9373
|
* @param {string | Element} item - Specifies the value of Dropdown Tree item/ Dropdown Tree item element
|
|
9069
9374
|
* @returns {'{[key: string]: Object }[]'} - returns the updated data source of the Dropdown Tree.
|
|
9070
9375
|
*/
|
|
9071
|
-
// eslint-disable-next-line
|
|
9072
9376
|
getData(item) {
|
|
9073
9377
|
return this.treeObj.getTreeData(item);
|
|
9074
9378
|
}
|
|
@@ -9093,6 +9397,10 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
9093
9397
|
}
|
|
9094
9398
|
}
|
|
9095
9399
|
this.trigger('close', eventArgs);
|
|
9400
|
+
if (this.destroyPopupOnHide) {
|
|
9401
|
+
this.isFirstRender = true;
|
|
9402
|
+
this.destroyPopup();
|
|
9403
|
+
}
|
|
9096
9404
|
}
|
|
9097
9405
|
}
|
|
9098
9406
|
/**
|
|
@@ -9143,7 +9451,7 @@ __decorate$2([
|
|
|
9143
9451
|
Property('')
|
|
9144
9452
|
], DropDownTree.prototype, "cssClass", void 0);
|
|
9145
9453
|
__decorate$2([
|
|
9146
|
-
Property(
|
|
9454
|
+
Property('${value.length} item(s) selected')
|
|
9147
9455
|
], DropDownTree.prototype, "customTemplate", void 0);
|
|
9148
9456
|
__decorate$2([
|
|
9149
9457
|
Property(',')
|
|
@@ -9209,7 +9517,10 @@ __decorate$2([
|
|
|
9209
9517
|
Property(false)
|
|
9210
9518
|
], DropDownTree.prototype, "showCheckBox", void 0);
|
|
9211
9519
|
__decorate$2([
|
|
9212
|
-
Property(
|
|
9520
|
+
Property(true)
|
|
9521
|
+
], DropDownTree.prototype, "destroyPopupOnHide", void 0);
|
|
9522
|
+
__decorate$2([
|
|
9523
|
+
Property(true)
|
|
9213
9524
|
], DropDownTree.prototype, "enableHtmlSanitizer", void 0);
|
|
9214
9525
|
__decorate$2([
|
|
9215
9526
|
Property(true)
|
|
@@ -9394,8 +9705,12 @@ let ComboBox = class ComboBox extends DropDownList {
|
|
|
9394
9705
|
this.setHiddenValue();
|
|
9395
9706
|
}
|
|
9396
9707
|
valueMuteChange(value) {
|
|
9708
|
+
value = this.allowObjectBinding && !isNullOrUndefined(value) ? getValue((this.fields.value) ? this.fields.value : '', value) : value;
|
|
9397
9709
|
const inputValue = isNullOrUndefined(value) ? null : value.toString();
|
|
9398
9710
|
Input.setValue(inputValue, this.inputElement, this.floatLabelType, this.showClearButton);
|
|
9711
|
+
if (this.allowObjectBinding) {
|
|
9712
|
+
value = this.getDataByValue(value);
|
|
9713
|
+
}
|
|
9399
9714
|
this.setProperties({ value: value, text: value, index: null }, true);
|
|
9400
9715
|
this.activeIndex = this.index;
|
|
9401
9716
|
const fields = this.fields;
|
|
@@ -9404,20 +9719,50 @@ let ComboBox = class ComboBox extends DropDownList {
|
|
|
9404
9719
|
dataItem[fields.value] = isNullOrUndefined(value) ? null : value.toString();
|
|
9405
9720
|
this.itemData = dataItem;
|
|
9406
9721
|
this.item = null;
|
|
9407
|
-
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]))) {
|
|
9408
9723
|
this.detachChangeEvent(null);
|
|
9409
9724
|
}
|
|
9410
9725
|
}
|
|
9411
9726
|
updateValues() {
|
|
9412
9727
|
if (!isNullOrUndefined(this.value)) {
|
|
9413
|
-
|
|
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;
|
|
9731
|
+
if (this.enableVirtualization && this.value) {
|
|
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;
|
|
9734
|
+
if (this.dataSource instanceof DataManager && this.virtualGroupDataSource) {
|
|
9735
|
+
const getItem = new DataManager(this.virtualGroupDataSource).executeLocal(new Query().where(new Predicate(fields, 'equal', currentValue)));
|
|
9736
|
+
if (getItem && getItem.length > 0) {
|
|
9737
|
+
this.itemData = getItem[0];
|
|
9738
|
+
doesItemExist = true;
|
|
9739
|
+
const dataItem = this.getItemData();
|
|
9740
|
+
let value = this.allowObjectBinding ? this.getDataByValue(dataItem.value) : dataItem.value;
|
|
9741
|
+
if ((this.value === dataItem.value && this.text !== dataItem.text) || (this.value !== dataItem.value && this.text === dataItem.text)) {
|
|
9742
|
+
this.setProperties({ 'text': dataItem.text, 'value': value });
|
|
9743
|
+
}
|
|
9744
|
+
}
|
|
9745
|
+
}
|
|
9746
|
+
else {
|
|
9747
|
+
const getItem = new DataManager(this.dataSource).executeLocal(new Query().where(new Predicate(fields, 'equal', currentValue)));
|
|
9748
|
+
if (getItem && getItem.length > 0) {
|
|
9749
|
+
this.itemData = getItem[0];
|
|
9750
|
+
doesItemExist = true;
|
|
9751
|
+
const dataItem = this.getItemData();
|
|
9752
|
+
let value = this.allowObjectBinding ? this.getDataByValue(dataItem.value) : dataItem.value;
|
|
9753
|
+
if ((this.value === dataItem.value && this.text !== dataItem.text) || (this.value !== dataItem.value && this.text === dataItem.text)) {
|
|
9754
|
+
this.setProperties({ 'text': dataItem.text, 'value': value });
|
|
9755
|
+
}
|
|
9756
|
+
}
|
|
9757
|
+
}
|
|
9758
|
+
}
|
|
9414
9759
|
if (li) {
|
|
9415
9760
|
this.setSelection(li, null);
|
|
9416
9761
|
}
|
|
9417
|
-
else if (this.allowCustom) {
|
|
9762
|
+
else if ((!this.enableVirtualization && this.allowCustom) || (this.allowCustom && this.enableVirtualization && !doesItemExist)) {
|
|
9418
9763
|
this.valueMuteChange(this.value);
|
|
9419
9764
|
}
|
|
9420
|
-
else {
|
|
9765
|
+
else if (!this.enableVirtualization || (this.enableVirtualization && !doesItemExist)) {
|
|
9421
9766
|
this.valueMuteChange(null);
|
|
9422
9767
|
}
|
|
9423
9768
|
}
|
|
@@ -9526,7 +9871,7 @@ let ComboBox = class ComboBox extends DropDownList {
|
|
|
9526
9871
|
this.updateIncrementalView(0, this.itemCount);
|
|
9527
9872
|
}
|
|
9528
9873
|
activeItem = Search(inputValue, this.incrementalLiCollections, this.filterType, true, dataSource, this.fields, type);
|
|
9529
|
-
while (isNullOrUndefined(activeItem) && this.incrementalEndIndex < this.totalItemCount) {
|
|
9874
|
+
while (isNullOrUndefined(activeItem.item) && this.incrementalEndIndex < this.totalItemCount) {
|
|
9530
9875
|
this.incrementalStartIndex = this.incrementalEndIndex;
|
|
9531
9876
|
this.incrementalEndIndex = this.incrementalEndIndex + 100 > this.totalItemCount ? this.totalItemCount : this.incrementalEndIndex + 100;
|
|
9532
9877
|
this.updateIncrementalInfo(this.incrementalStartIndex, this.incrementalEndIndex);
|
|
@@ -9536,6 +9881,7 @@ let ComboBox = class ComboBox extends DropDownList {
|
|
|
9536
9881
|
}
|
|
9537
9882
|
activeItem = Search(inputValue, this.incrementalLiCollections, this.filterType, true, dataSource, this.fields, type);
|
|
9538
9883
|
if (!isNullOrUndefined(activeItem)) {
|
|
9884
|
+
activeItem.index = activeItem.index + this.incrementalStartIndex;
|
|
9539
9885
|
break;
|
|
9540
9886
|
}
|
|
9541
9887
|
if (isNullOrUndefined(activeItem) && this.incrementalEndIndex >= this.totalItemCount) {
|
|
@@ -9621,10 +9967,12 @@ let ComboBox = class ComboBox extends DropDownList {
|
|
|
9621
9967
|
}
|
|
9622
9968
|
}
|
|
9623
9969
|
checkCustomValue() {
|
|
9624
|
-
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);
|
|
9625
9972
|
const dataItem = this.getItemData();
|
|
9973
|
+
const setValue$$1 = this.allowObjectBinding ? this.itemData : dataItem.value;
|
|
9626
9974
|
if (!(this.allowCustom && isNullOrUndefined(dataItem.value) && isNullOrUndefined(dataItem.text))) {
|
|
9627
|
-
this.setProperties({ 'value':
|
|
9975
|
+
this.setProperties({ 'value': setValue$$1 }, !this.allowCustom);
|
|
9628
9976
|
}
|
|
9629
9977
|
}
|
|
9630
9978
|
/**
|
|
@@ -9674,10 +10022,10 @@ let ComboBox = class ComboBox extends DropDownList {
|
|
|
9674
10022
|
const currentValue = this.getTextByValue(activeElement.getAttribute('data-value')).toString();
|
|
9675
10023
|
const currentFillValue = this.getFormattedValue(activeElement.getAttribute('data-value'));
|
|
9676
10024
|
if (this.getModuleName() === 'combobox') {
|
|
9677
|
-
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)]))) {
|
|
9678
10026
|
this.updateSelectedItem(activeElement, null);
|
|
9679
10027
|
this.isSelected = true;
|
|
9680
|
-
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'));
|
|
9681
10029
|
}
|
|
9682
10030
|
else {
|
|
9683
10031
|
this.updateSelectedItem(activeElement, null, true);
|
|
@@ -9846,15 +10194,17 @@ let ComboBox = class ComboBox extends DropDownList {
|
|
|
9846
10194
|
super.dropDownClick(e);
|
|
9847
10195
|
}
|
|
9848
10196
|
customValue(e) {
|
|
9849
|
-
|
|
10197
|
+
let value = this.getValueByText(this.inputElement.value);
|
|
9850
10198
|
if (!this.allowCustom && this.inputElement.value !== '') {
|
|
9851
10199
|
const previousValue = this.previousValue;
|
|
9852
10200
|
const currentValue = this.value;
|
|
10201
|
+
value = this.allowObjectBinding ? this.getDataByValue(value) : value;
|
|
9853
10202
|
this.setProperties({ value: value });
|
|
9854
10203
|
if (isNullOrUndefined(this.value)) {
|
|
9855
10204
|
Input.setValue('', this.inputElement, this.floatLabelType, this.showClearButton);
|
|
9856
10205
|
}
|
|
9857
|
-
|
|
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])))) {
|
|
9858
10208
|
this.onChangeEvent(null);
|
|
9859
10209
|
}
|
|
9860
10210
|
}
|
|
@@ -9864,6 +10214,7 @@ let ComboBox = class ComboBox extends DropDownList {
|
|
|
9864
10214
|
const value = this.inputElement.value === '' ? null : this.inputElement.value;
|
|
9865
10215
|
// eslint-disable-next-line max-len
|
|
9866
10216
|
const eventArgs = { text: value, item: {} };
|
|
10217
|
+
this.isObjectCustomValue = true;
|
|
9867
10218
|
if (!this.initial) {
|
|
9868
10219
|
this.trigger('customValueSpecifier', eventArgs, (eventArgs) => {
|
|
9869
10220
|
this.updateCustomValueCallback(value, eventArgs, previousValue, e);
|
|
@@ -9875,8 +10226,9 @@ let ComboBox = class ComboBox extends DropDownList {
|
|
|
9875
10226
|
}
|
|
9876
10227
|
else {
|
|
9877
10228
|
this.isSelectCustom = false;
|
|
10229
|
+
value = this.allowObjectBinding ? this.getDataByValue(value) : value;
|
|
9878
10230
|
this.setProperties({ value: value });
|
|
9879
|
-
if (previousValue !== this.value) {
|
|
10231
|
+
if ((!this.allowObjectBinding && previousValue !== this.value) || (this.allowObjectBinding && previousValue && this.value && !this.isObjectInArray(previousValue, [this.value]))) {
|
|
9880
10232
|
this.onChangeEvent(e);
|
|
9881
10233
|
}
|
|
9882
10234
|
}
|
|
@@ -9897,16 +10249,28 @@ let ComboBox = class ComboBox extends DropDownList {
|
|
|
9897
10249
|
setValue(fields.value, value, dataItem);
|
|
9898
10250
|
}
|
|
9899
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
|
+
}
|
|
9900
10263
|
const changeData = {
|
|
9901
10264
|
text: getValue(fields.text, this.itemData),
|
|
9902
|
-
value: getValue(fields.value, this.itemData),
|
|
10265
|
+
value: this.allowObjectBinding ? emptyObject : getValue(fields.value, this.itemData),
|
|
9903
10266
|
index: null
|
|
9904
10267
|
};
|
|
9905
10268
|
this.setProperties(changeData, true);
|
|
9906
10269
|
this.setSelection(null, null);
|
|
9907
10270
|
this.isSelectCustom = true;
|
|
9908
|
-
|
|
9909
|
-
|
|
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);
|
|
9910
10274
|
}
|
|
9911
10275
|
}
|
|
9912
10276
|
/**
|
|
@@ -9920,7 +10284,7 @@ let ComboBox = class ComboBox extends DropDownList {
|
|
|
9920
10284
|
onPropertyChanged(newProp, oldProp) {
|
|
9921
10285
|
if (this.getModuleName() === 'combobox') {
|
|
9922
10286
|
this.checkData(newProp);
|
|
9923
|
-
this.setUpdateInitial(['fields', 'query', 'dataSource'], newProp);
|
|
10287
|
+
this.setUpdateInitial(['fields', 'query', 'dataSource'], newProp, oldProp);
|
|
9924
10288
|
}
|
|
9925
10289
|
for (const prop of Object.keys(newProp)) {
|
|
9926
10290
|
switch (prop) {
|
|
@@ -10068,7 +10432,8 @@ let ComboBox = class ComboBox extends DropDownList {
|
|
|
10068
10432
|
this.customValue(e);
|
|
10069
10433
|
}
|
|
10070
10434
|
}
|
|
10071
|
-
|
|
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) {
|
|
10072
10437
|
this.customValue();
|
|
10073
10438
|
}
|
|
10074
10439
|
super.hidePopup(e);
|
|
@@ -10201,6 +10566,9 @@ __decorate$3([
|
|
|
10201
10566
|
__decorate$3([
|
|
10202
10567
|
Property(null)
|
|
10203
10568
|
], ComboBox.prototype, "value", void 0);
|
|
10569
|
+
__decorate$3([
|
|
10570
|
+
Property(false)
|
|
10571
|
+
], ComboBox.prototype, "allowObjectBinding", void 0);
|
|
10204
10572
|
ComboBox = __decorate$3([
|
|
10205
10573
|
NotifyPropertyChanges
|
|
10206
10574
|
], ComboBox);
|
|
@@ -10260,8 +10628,9 @@ let AutoComplete = class AutoComplete extends ComboBox {
|
|
|
10260
10628
|
}
|
|
10261
10629
|
getQuery(query) {
|
|
10262
10630
|
const filterQuery = query ? query.clone() : this.query ? this.query.clone() : new Query();
|
|
10263
|
-
|
|
10264
|
-
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;
|
|
10265
10634
|
if (this.isFiltered) {
|
|
10266
10635
|
return filterQuery;
|
|
10267
10636
|
}
|
|
@@ -10287,9 +10656,48 @@ let AutoComplete = class AutoComplete extends ComboBox {
|
|
|
10287
10656
|
filterQuery.take(this.suggestionCount);
|
|
10288
10657
|
}
|
|
10289
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
|
+
}
|
|
10290
10684
|
var takeValue = this.getTakeValue();
|
|
10291
|
-
|
|
10292
|
-
|
|
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
|
+
}
|
|
10293
10701
|
filterQuery.requiresCount();
|
|
10294
10702
|
}
|
|
10295
10703
|
return filterQuery;
|
|
@@ -10297,6 +10705,7 @@ let AutoComplete = class AutoComplete extends ComboBox {
|
|
|
10297
10705
|
searchLists(e) {
|
|
10298
10706
|
this.isTyped = true;
|
|
10299
10707
|
this.isDataFetched = this.isSelectCustom = false;
|
|
10708
|
+
this.firstItem = this.dataSource && this.dataSource.length > 0 ? this.dataSource[0] : null;
|
|
10300
10709
|
this.checkAndResetCache();
|
|
10301
10710
|
if (isNullOrUndefined(this.list)) {
|
|
10302
10711
|
super.renderList(e, true);
|
|
@@ -10489,6 +10898,10 @@ let AutoComplete = class AutoComplete extends ComboBox {
|
|
|
10489
10898
|
setInputValue(newProp, oldProp) {
|
|
10490
10899
|
let oldValue = oldProp && oldProp.text ? oldProp.text : oldProp ? oldProp.value : oldProp;
|
|
10491
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
|
+
}
|
|
10492
10905
|
if (value && this.typedString === '' && !this.allowCustom && !(this.dataSource instanceof DataManager)) {
|
|
10493
10906
|
let checkFields_1 = this.typeOfData(this.dataSource).typeof === 'string' ? '' : this.fields.value;
|
|
10494
10907
|
const listLength = this.getItems().length;
|
|
@@ -10497,7 +10910,7 @@ let AutoComplete = class AutoComplete extends ComboBox {
|
|
|
10497
10910
|
new DataManager(this.dataSource).executeQuery(query.where(new Predicate(checkFields_1, 'equal', value)))
|
|
10498
10911
|
.then(function (e) {
|
|
10499
10912
|
if (e.result.length > 0) {
|
|
10500
|
-
_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();
|
|
10501
10914
|
_this.addItem(e.result, listLength);
|
|
10502
10915
|
_this.updateValues();
|
|
10503
10916
|
}
|
|
@@ -10905,8 +11318,12 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
10905
11318
|
this.selectAllEventEle = [];
|
|
10906
11319
|
this.resetMainList = null;
|
|
10907
11320
|
this.resetFilteredData = false;
|
|
11321
|
+
this.preventSetCurrentData = false;
|
|
10908
11322
|
this.scrollFocusStatus = false;
|
|
10909
11323
|
this.keyDownStatus = false;
|
|
11324
|
+
this.IsScrollerAtEnd = function () {
|
|
11325
|
+
return this.list && this.list.scrollTop + this.list.clientHeight >= this.list.scrollHeight;
|
|
11326
|
+
};
|
|
10910
11327
|
}
|
|
10911
11328
|
enableRTL(state) {
|
|
10912
11329
|
if (state) {
|
|
@@ -10922,6 +11339,9 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
10922
11339
|
}
|
|
10923
11340
|
requiredModules() {
|
|
10924
11341
|
const modules = [];
|
|
11342
|
+
if (this.enableVirtualization) {
|
|
11343
|
+
modules.push({ args: [this], member: 'VirtualScroll' });
|
|
11344
|
+
}
|
|
10925
11345
|
if (this.mode === 'CheckBox') {
|
|
10926
11346
|
this.isGroupChecking = this.enableGroupCheckBox;
|
|
10927
11347
|
if (this.enableGroupCheckBox) {
|
|
@@ -11060,6 +11480,9 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
11060
11480
|
attributes(this.inputElement, { 'aria-expanded': 'true', 'aria-owns': this.element.id + '_popup', 'aria-controls': this.element.id });
|
|
11061
11481
|
this.updateAriaActiveDescendant();
|
|
11062
11482
|
if (this.isFirstClick) {
|
|
11483
|
+
if (this.enableVirtualization && this.mode === 'CheckBox' && this.value) {
|
|
11484
|
+
this.updateVirtualReOrderList();
|
|
11485
|
+
}
|
|
11063
11486
|
this.loadTemplate();
|
|
11064
11487
|
}
|
|
11065
11488
|
if (this.mode === 'CheckBox' && this.showSelectAll) {
|
|
@@ -11068,6 +11491,33 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
11068
11491
|
}
|
|
11069
11492
|
});
|
|
11070
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
|
+
}
|
|
11071
11521
|
updateListItems(listItems, mainListItems) {
|
|
11072
11522
|
for (let i = 0; i < listItems.length; i++) {
|
|
11073
11523
|
this.findGroupStart(listItems[i]);
|
|
@@ -11077,19 +11527,33 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
11077
11527
|
}
|
|
11078
11528
|
loadTemplate() {
|
|
11079
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
|
+
}
|
|
11080
11536
|
if (this.mode === 'CheckBox') {
|
|
11081
11537
|
this.removeFocus();
|
|
11082
11538
|
}
|
|
11083
11539
|
this.notify('reOrder', { module: 'CheckBoxSelection', enable: this.mode === 'CheckBox', e: this });
|
|
11540
|
+
this.isPreventScrollAction = true;
|
|
11084
11541
|
}
|
|
11085
11542
|
setScrollPosition() {
|
|
11086
11543
|
if (((!this.hideSelectedItem && this.mode !== 'CheckBox') || (this.mode === 'CheckBox' && !this.enableSelectionOrder)) &&
|
|
11087
11544
|
(!isNullOrUndefined(this.value) && (this.value.length > 0))) {
|
|
11088
|
-
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);
|
|
11089
11547
|
if (!isNullOrUndefined(valueEle)) {
|
|
11090
11548
|
this.scrollBottom(valueEle);
|
|
11091
11549
|
}
|
|
11092
11550
|
}
|
|
11551
|
+
if (this.enableVirtualization) {
|
|
11552
|
+
const focusedItem = this.list.querySelector('.' + dropDownBaseClasses.focus);
|
|
11553
|
+
if (focusedItem) {
|
|
11554
|
+
this.scrollBottom(focusedItem);
|
|
11555
|
+
}
|
|
11556
|
+
}
|
|
11093
11557
|
}
|
|
11094
11558
|
focusAtFirstListItem() {
|
|
11095
11559
|
if (this.ulElement && this.ulElement.querySelector('li.'
|
|
@@ -11100,9 +11564,15 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
11100
11564
|
return;
|
|
11101
11565
|
}
|
|
11102
11566
|
else {
|
|
11103
|
-
|
|
11104
|
-
|
|
11105
|
-
|
|
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
|
+
}
|
|
11106
11576
|
}
|
|
11107
11577
|
if (element !== null) {
|
|
11108
11578
|
this.removeFocus();
|
|
@@ -11117,7 +11587,8 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
11117
11587
|
}
|
|
11118
11588
|
else {
|
|
11119
11589
|
if (this.value && this.value.length) {
|
|
11120
|
-
|
|
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);
|
|
11121
11592
|
}
|
|
11122
11593
|
else {
|
|
11123
11594
|
activeElement = null;
|
|
@@ -11125,7 +11596,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
11125
11596
|
}
|
|
11126
11597
|
if (activeElement && activeElement.item !== null) {
|
|
11127
11598
|
this.addListFocus(activeElement.item);
|
|
11128
|
-
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) {
|
|
11129
11600
|
this.scrollBottom(activeElement.item, activeElement.index);
|
|
11130
11601
|
}
|
|
11131
11602
|
}
|
|
@@ -11167,9 +11638,9 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
11167
11638
|
const elements = this.chipCollectionWrapper.querySelectorAll('span.' + CHIP$1);
|
|
11168
11639
|
const value = elements[elements.length - 1].getAttribute('data-value');
|
|
11169
11640
|
if (!isNullOrUndefined(this.value)) {
|
|
11170
|
-
this.tempValues = this.value.slice();
|
|
11641
|
+
this.tempValues = this.allowObjectBinding ? this.value.slice() : this.value.slice();
|
|
11171
11642
|
}
|
|
11172
|
-
let customValue = this.getFormattedValue(value);
|
|
11643
|
+
let customValue = this.allowObjectBinding ? this.getDataByValue(value) : this.getFormattedValue(value);
|
|
11173
11644
|
if (this.allowCustomValue && (value !== 'false' && customValue === false || (!isNullOrUndefined(customValue) &&
|
|
11174
11645
|
customValue.toString() === 'NaN'))) {
|
|
11175
11646
|
customValue = value;
|
|
@@ -11195,15 +11666,43 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
11195
11666
|
}
|
|
11196
11667
|
return this.targetInputElement.value;
|
|
11197
11668
|
}
|
|
11198
|
-
getForQuery(valuecheck) {
|
|
11669
|
+
getForQuery(valuecheck, isCheckbox) {
|
|
11199
11670
|
let predicate;
|
|
11200
11671
|
const field = isNullOrUndefined(this.fields.value) ? this.fields.text : this.fields.value;
|
|
11201
|
-
|
|
11202
|
-
if (
|
|
11203
|
-
|
|
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);
|
|
11204
11684
|
}
|
|
11205
11685
|
else {
|
|
11206
|
-
|
|
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
|
+
}
|
|
11207
11706
|
}
|
|
11208
11707
|
}
|
|
11209
11708
|
if (this.dataSource instanceof DataManager && this.dataSource.adaptor instanceof JsonAdaptor) {
|
|
@@ -11215,14 +11714,20 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
11215
11714
|
}
|
|
11216
11715
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
11217
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
|
+
}
|
|
11218
11721
|
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
11219
11722
|
super.onActionComplete(ulElement, list, e);
|
|
11723
|
+
this.skeletonCount = this.totalItemCount != 0 && this.totalItemCount < (this.itemCount * 2) ? 0 : this.skeletonCount;
|
|
11220
11724
|
this.updateSelectElementData(this.allowFiltering);
|
|
11221
11725
|
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
11222
11726
|
const proxy = this;
|
|
11223
|
-
if (!isNullOrUndefined(this.value) && !this.allowCustomValue) {
|
|
11727
|
+
if (!isNullOrUndefined(this.value) && !this.allowCustomValue && !this.enableVirtualization) {
|
|
11224
11728
|
for (let i = 0; i < this.value.length; i++) {
|
|
11225
|
-
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);
|
|
11226
11731
|
if (!checkEle && !(this.dataSource instanceof DataManager)) {
|
|
11227
11732
|
this.value.splice(i, 1);
|
|
11228
11733
|
i -= 1;
|
|
@@ -11310,7 +11815,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
11310
11815
|
dropDownBaseClasses.selected;
|
|
11311
11816
|
if (!isNullOrUndefined(this.value)) {
|
|
11312
11817
|
for (let index = 0; !isNullOrUndefined(this.value[index]); index++) {
|
|
11313
|
-
value = this.value[index];
|
|
11818
|
+
value = this.allowObjectBinding ? getValue((this.fields.value) ? this.fields.value : '', this.value[index]) : this.value[index];
|
|
11314
11819
|
element = this.findListElement(this.list, 'li', 'data-value', value);
|
|
11315
11820
|
if (element) {
|
|
11316
11821
|
addClass([element], className);
|
|
@@ -11409,13 +11914,13 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
11409
11914
|
checkSelectAll() {
|
|
11410
11915
|
const groupItemLength = this.list.querySelectorAll('li.e-list-group-item.e-active').length;
|
|
11411
11916
|
const listItem = this.list.querySelectorAll('li.e-list-item');
|
|
11412
|
-
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;
|
|
11413
11918
|
let searchActiveCount = this.list.querySelectorAll('li.' + dropDownBaseClasses.selected).length;
|
|
11414
11919
|
if (this.enableGroupCheckBox && !isNullOrUndefined(this.fields.groupBy)) {
|
|
11415
11920
|
searchActiveCount = searchActiveCount - groupItemLength;
|
|
11416
11921
|
}
|
|
11417
|
-
if ((searchCount === searchActiveCount || searchActiveCount === this.maximumSelectionLength)
|
|
11418
|
-
&& (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)) {
|
|
11419
11924
|
this.notify('checkSelectAll', { module: 'CheckBoxSelection', enable: this.mode === 'CheckBox', value: 'check' });
|
|
11420
11925
|
}
|
|
11421
11926
|
else if ((searchCount !== searchActiveCount) && (this.mode === 'CheckBox' && this.showSelectAll)) {
|
|
@@ -11452,7 +11957,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
11452
11957
|
}
|
|
11453
11958
|
this.isValidKey = (this.isPopupOpen() && e.keyCode === 8) || this.isValidKey;
|
|
11454
11959
|
this.isValidKey = e.ctrlKey && e.keyCode === 86 ? false : this.isValidKey;
|
|
11455
|
-
if (this.isValidKey) {
|
|
11960
|
+
if (this.isValidKey && this.inputElement) {
|
|
11456
11961
|
this.isValidKey = false;
|
|
11457
11962
|
this.expandTextbox();
|
|
11458
11963
|
this.showOverAllClear();
|
|
@@ -11482,7 +11987,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
11482
11987
|
return filterQuery;
|
|
11483
11988
|
}
|
|
11484
11989
|
if (this.filterAction) {
|
|
11485
|
-
if (this.targetElement() !== null) {
|
|
11990
|
+
if ((this.targetElement() !== null && !this.enableVirtualization) || (this.enableVirtualization && this.targetElement() !== null && this.targetElement().trim() !== '')) {
|
|
11486
11991
|
const dataType = this.typeOfData(this.dataSource).typeof;
|
|
11487
11992
|
if (!(this.dataSource instanceof DataManager) && dataType === 'string' || dataType === 'number') {
|
|
11488
11993
|
filterQuery.where('', this.filterType, this.targetElement(), this.ignoreCase, this.ignoreAccent);
|
|
@@ -11492,21 +11997,89 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
11492
11997
|
filterQuery.where(!isNullOrUndefined(fields.text) ? fields.text : '', this.filterType, this.targetElement(), this.ignoreCase, this.ignoreAccent);
|
|
11493
11998
|
}
|
|
11494
11999
|
}
|
|
12000
|
+
if (this.enableVirtualization && (this.viewPortInfo.endIndex != 0) && !this.virtualSelectAll) {
|
|
12001
|
+
return this.virtualFilterQuery(filterQuery);
|
|
12002
|
+
}
|
|
11495
12003
|
return filterQuery;
|
|
11496
12004
|
}
|
|
11497
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
|
+
}
|
|
11498
12009
|
return query ? query : this.query ? this.query : new Query();
|
|
11499
12010
|
}
|
|
11500
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
|
+
}
|
|
11501
12050
|
dataUpdater(dataSource, query, fields) {
|
|
11502
12051
|
this.isDataFetched = false;
|
|
12052
|
+
let isNoData = this.list.classList.contains(dropDownBaseClasses.noData);
|
|
11503
12053
|
if (this.targetElement().trim() === '') {
|
|
11504
|
-
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;
|
|
11505
12055
|
if (this.backCommand) {
|
|
11506
12056
|
this.remoteCustomValue = false;
|
|
11507
12057
|
if (this.allowCustomValue && list.querySelectorAll('li').length == 0 && this.mainData.length > 0) {
|
|
11508
12058
|
this.mainData = [];
|
|
11509
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
|
+
}
|
|
11510
12083
|
this.onActionComplete(list, this.mainData);
|
|
11511
12084
|
if (this.value && this.value.length) {
|
|
11512
12085
|
this.refreshSelection();
|
|
@@ -11518,7 +12091,30 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
11518
12091
|
}
|
|
11519
12092
|
}
|
|
11520
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
|
+
}
|
|
11521
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
|
+
}
|
|
11522
12118
|
if (this.allowCustomValue) {
|
|
11523
12119
|
if (!(dataSource instanceof DataManager)) {
|
|
11524
12120
|
this.checkForCustomValue(query, fields);
|
|
@@ -11529,6 +12125,9 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
11529
12125
|
}
|
|
11530
12126
|
}
|
|
11531
12127
|
}
|
|
12128
|
+
if (this.enableVirtualization && this.allowFiltering) {
|
|
12129
|
+
this.getFilteringSkeletonCount();
|
|
12130
|
+
}
|
|
11532
12131
|
this.refreshPopup();
|
|
11533
12132
|
if (this.mode === 'CheckBox') {
|
|
11534
12133
|
this.removeFocus();
|
|
@@ -11542,7 +12141,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
11542
12141
|
const customData = (!isNullOrUndefined(this.mainData) && this.mainData.length > 0) ?
|
|
11543
12142
|
this.mainData[0] : this.mainData;
|
|
11544
12143
|
if (customData && typeof (customData) !== 'string' && typeof (customData) !== 'number' && typeof (customData) !== 'boolean') {
|
|
11545
|
-
|
|
12144
|
+
let dataItem = {};
|
|
11546
12145
|
setValue(field.text, value, dataItem);
|
|
11547
12146
|
if (typeof getValue((this.fields.value ? this.fields.value : 'value'), customData)
|
|
11548
12147
|
=== 'number') {
|
|
@@ -11551,9 +12150,34 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
11551
12150
|
else {
|
|
11552
12151
|
setValue(field.value, value, dataItem);
|
|
11553
12152
|
}
|
|
11554
|
-
const
|
|
11555
|
-
|
|
11556
|
-
|
|
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
|
+
}
|
|
11557
12181
|
}
|
|
11558
12182
|
else if (this.listData) {
|
|
11559
12183
|
const tempData = JSON.parse(JSON.stringify(this.listData));
|
|
@@ -11587,6 +12211,8 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
11587
12211
|
}
|
|
11588
12212
|
wrapperClick(e) {
|
|
11589
12213
|
this.setDynValue = false;
|
|
12214
|
+
this.keyboardEvent = null;
|
|
12215
|
+
this.isKeyBoardAction = false;
|
|
11590
12216
|
if (!this.enabled) {
|
|
11591
12217
|
return;
|
|
11592
12218
|
}
|
|
@@ -11786,8 +12412,8 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
11786
12412
|
if (this.initStatus && this.validateValues(newValue, oldValue)) {
|
|
11787
12413
|
const eventArgs = {
|
|
11788
12414
|
e: event,
|
|
11789
|
-
oldValue: oldVal,
|
|
11790
|
-
value: newVal,
|
|
12415
|
+
oldValue: this.allowObjectBinding ? oldVal : oldVal,
|
|
12416
|
+
value: this.allowObjectBinding ? newVal : newVal,
|
|
11791
12417
|
isInteracted: event ? true : false,
|
|
11792
12418
|
element: this.element,
|
|
11793
12419
|
event: event
|
|
@@ -11803,13 +12429,14 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
11803
12429
|
this.dispatchEvent(this.hiddenElement, 'change');
|
|
11804
12430
|
}
|
|
11805
12431
|
}
|
|
12432
|
+
this.selectedValueInfo = this.viewPortInfo;
|
|
11806
12433
|
}
|
|
11807
12434
|
updateTempValue() {
|
|
11808
12435
|
if (!this.value) {
|
|
11809
12436
|
this.tempValues = this.value;
|
|
11810
12437
|
}
|
|
11811
12438
|
else {
|
|
11812
|
-
this.tempValues = this.value.slice();
|
|
12439
|
+
this.tempValues = this.allowObjectBinding ? this.value.slice() : this.value.slice();
|
|
11813
12440
|
}
|
|
11814
12441
|
}
|
|
11815
12442
|
updateAriaActiveDescendant() {
|
|
@@ -11817,26 +12444,44 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
11817
12444
|
attributes(this.inputElement, { 'aria-activedescendant': this.ulElement.getElementsByClassName('e-item-focus')[0].id });
|
|
11818
12445
|
}
|
|
11819
12446
|
}
|
|
11820
|
-
|
|
11821
|
-
const height = this.list.classList.contains(dropDownBaseClasses.noData) ? null :
|
|
11822
|
-
getComputedStyle(this.getItems()[0], null).getPropertyValue('height');
|
|
11823
|
-
return Math.round(this.list.offsetHeight / parseInt(height, 10));
|
|
11824
|
-
}
|
|
11825
|
-
pageUpSelection(steps) {
|
|
12447
|
+
pageUpSelection(steps, isVirtualKeyAction) {
|
|
11826
12448
|
const collection = this.list.querySelectorAll('li.'
|
|
11827
12449
|
+ dropDownBaseClasses.li + ':not(.' + HIDE_LIST + ')' + ':not(.e-reorder-hide)');
|
|
11828
|
-
|
|
11829
|
-
this.
|
|
11830
|
-
|
|
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
|
+
}
|
|
11831
12470
|
}
|
|
11832
|
-
pageDownSelection(steps) {
|
|
12471
|
+
pageDownSelection(steps, isVirtualKeyAction) {
|
|
11833
12472
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
11834
12473
|
const list = this.getItems();
|
|
11835
12474
|
const collection = this.list.querySelectorAll('li.'
|
|
11836
12475
|
+ dropDownBaseClasses.li + ':not(.' + HIDE_LIST + ')' + ':not(.e-reorder-hide)');
|
|
11837
|
-
|
|
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
|
+
}
|
|
11838
12483
|
this.addListFocus(previousItem);
|
|
11839
|
-
this.scrollBottom(previousItem, this.getIndexByValue(previousItem.getAttribute('data-value')));
|
|
12484
|
+
this.scrollBottom(previousItem, this.getIndexByValue(previousItem.getAttribute('data-value')), false, this.keyboardEvent.keyCode);
|
|
11840
12485
|
}
|
|
11841
12486
|
getItems() {
|
|
11842
12487
|
if (!this.list) {
|
|
@@ -11954,21 +12599,110 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
11954
12599
|
}
|
|
11955
12600
|
}
|
|
11956
12601
|
}
|
|
11957
|
-
homeNavigation(isHome) {
|
|
12602
|
+
homeNavigation(isHome, isVirtualKeyAction) {
|
|
11958
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();
|
|
11959
12628
|
const scrollEle = this.ulElement.querySelectorAll('li.' + dropDownBaseClasses.li
|
|
11960
12629
|
+ ':not(.' + HIDE_LIST + ')' + ':not(.e-reorder-hide)');
|
|
11961
12630
|
if (scrollEle.length > 0) {
|
|
11962
|
-
|
|
12631
|
+
let element = scrollEle[(isHome) ? 0 : (scrollEle.length - 1)];
|
|
12632
|
+
if (this.enableVirtualization && isHome) {
|
|
12633
|
+
element = scrollEle[this.skeletonCount];
|
|
12634
|
+
}
|
|
12635
|
+
this.removeFocus();
|
|
11963
12636
|
element.classList.add(dropDownBaseClasses.focus);
|
|
11964
|
-
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
|
+
}
|
|
11965
12643
|
this.updateAriaActiveDescendant();
|
|
11966
12644
|
}
|
|
11967
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
|
+
}
|
|
11968
12697
|
onKeyDown(e) {
|
|
11969
12698
|
if (this.readonly || !this.enabled && this.mode !== 'CheckBox') {
|
|
11970
12699
|
return;
|
|
11971
12700
|
}
|
|
12701
|
+
this.preventSetCurrentData = false;
|
|
12702
|
+
this.keyboardEvent = e;
|
|
12703
|
+
if (this.isPreventKeyAction && this.enableVirtualization) {
|
|
12704
|
+
e.preventDefault();
|
|
12705
|
+
}
|
|
11972
12706
|
this.keyCode = e.keyCode;
|
|
11973
12707
|
this.keyDownStatus = true;
|
|
11974
12708
|
if (e.keyCode > 111 && e.keyCode < 124) {
|
|
@@ -11981,16 +12715,18 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
11981
12715
|
else if (this.isPopupOpen()) {
|
|
11982
12716
|
const focusedItem = this.list.querySelector('.' + dropDownBaseClasses.focus);
|
|
11983
12717
|
let activeIndex;
|
|
12718
|
+
this.isKeyBoardAction = true;
|
|
11984
12719
|
switch (e.keyCode) {
|
|
11985
12720
|
case 36:
|
|
11986
12721
|
case 35:
|
|
12722
|
+
this.isMouseScrollAction = true;
|
|
11987
12723
|
this.homeNavigation((e.keyCode === 36) ? true : false);
|
|
11988
12724
|
break;
|
|
11989
12725
|
case 33:
|
|
11990
12726
|
e.preventDefault();
|
|
11991
12727
|
if (focusedItem) {
|
|
11992
|
-
this.getIndexByValue(focusedItem.getAttribute('data-value'));
|
|
11993
|
-
this.pageUpSelection(activeIndex - this.
|
|
12728
|
+
activeIndex = this.getIndexByValue(focusedItem.getAttribute('data-value'));
|
|
12729
|
+
this.pageUpSelection(activeIndex - this.getPageCount() - 1);
|
|
11994
12730
|
this.updateAriaAttribute();
|
|
11995
12731
|
}
|
|
11996
12732
|
return;
|
|
@@ -11998,7 +12734,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
11998
12734
|
e.preventDefault();
|
|
11999
12735
|
if (focusedItem) {
|
|
12000
12736
|
this.getIndexByValue(focusedItem.getAttribute('data-value'));
|
|
12001
|
-
this.pageDownSelection(activeIndex + this.
|
|
12737
|
+
this.pageDownSelection(activeIndex + this.getPageCount());
|
|
12002
12738
|
this.updateAriaAttribute();
|
|
12003
12739
|
}
|
|
12004
12740
|
return;
|
|
@@ -12064,10 +12800,11 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
12064
12800
|
if (!(this.mode === 'CheckBox' && this.showSelectAll)) {
|
|
12065
12801
|
this.refreshPopup();
|
|
12066
12802
|
}
|
|
12803
|
+
this.isKeyBoardAction = false;
|
|
12067
12804
|
}
|
|
12068
|
-
arrowDown(e) {
|
|
12805
|
+
arrowDown(e, isVirtualKeyAction) {
|
|
12069
12806
|
e.preventDefault();
|
|
12070
|
-
this.moveByList(1);
|
|
12807
|
+
this.moveByList(1, isVirtualKeyAction);
|
|
12071
12808
|
this.keyAction = true;
|
|
12072
12809
|
if (document.activeElement.classList.contains(FILTERINPUT)
|
|
12073
12810
|
|| (this.mode === 'CheckBox' && !this.allowFiltering && document.activeElement !== this.list)) {
|
|
@@ -12075,7 +12812,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
12075
12812
|
}
|
|
12076
12813
|
this.updateAriaAttribute();
|
|
12077
12814
|
}
|
|
12078
|
-
arrowUp(e) {
|
|
12815
|
+
arrowUp(e, isVirtualKeyAction) {
|
|
12079
12816
|
e.preventDefault();
|
|
12080
12817
|
this.keyAction = true;
|
|
12081
12818
|
let list = this.list.querySelectorAll('li.'
|
|
@@ -12093,7 +12830,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
12093
12830
|
this.keyAction = false;
|
|
12094
12831
|
this.notify('inputFocus', { module: 'CheckBoxSelection', enable: this.mode === 'CheckBox', value: 'focus' });
|
|
12095
12832
|
}
|
|
12096
|
-
this.moveByList(-1);
|
|
12833
|
+
this.moveByList(-1, isVirtualKeyAction);
|
|
12097
12834
|
this.updateAriaAttribute();
|
|
12098
12835
|
}
|
|
12099
12836
|
spaceKeySelection(e) {
|
|
@@ -12144,8 +12881,8 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
12144
12881
|
else if (e.keyCode === 8 && this.mode === 'Delimiter') {
|
|
12145
12882
|
if (this.value && this.value.length) {
|
|
12146
12883
|
e.preventDefault();
|
|
12147
|
-
const temp = this.value[this.value.length - 1];
|
|
12148
|
-
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);
|
|
12149
12886
|
this.updateDelimeter(this.delimiterChar, e);
|
|
12150
12887
|
this.focusAtLastListItem(temp);
|
|
12151
12888
|
}
|
|
@@ -12159,7 +12896,10 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
12159
12896
|
}
|
|
12160
12897
|
}
|
|
12161
12898
|
escapeAction() {
|
|
12162
|
-
|
|
12899
|
+
let temp = this.tempValues ? this.tempValues.slice() : [];
|
|
12900
|
+
if (this.allowObjectBinding) {
|
|
12901
|
+
temp = this.tempValues ? this.tempValues.slice() : [];
|
|
12902
|
+
}
|
|
12163
12903
|
if (this.value && this.validateValues(this.value, temp)) {
|
|
12164
12904
|
if (this.mode !== 'CheckBox') {
|
|
12165
12905
|
this.value = temp;
|
|
@@ -12181,36 +12921,100 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
12181
12921
|
}
|
|
12182
12922
|
this.makeTextBoxEmpty();
|
|
12183
12923
|
}
|
|
12184
|
-
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;
|
|
12185
12932
|
const currentOffset = this.list.offsetHeight;
|
|
12186
|
-
|
|
12187
|
-
|
|
12188
|
-
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;
|
|
12189
12937
|
boxRange = this.fields.groupBy && !isNullOrUndefined(this.fixedHeaderElement) ?
|
|
12190
12938
|
boxRange - this.fixedHeaderElement.offsetHeight : boxRange;
|
|
12191
|
-
if (activeIndex === 0) {
|
|
12939
|
+
if (activeIndex === 0 && !this.enableVirtualization) {
|
|
12192
12940
|
this.list.scrollTop = 0;
|
|
12193
12941
|
}
|
|
12194
|
-
else if (nextBottom > currentOffset) {
|
|
12195
|
-
|
|
12196
|
-
|
|
12197
|
-
|
|
12198
|
-
|
|
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
|
+
|
|
12199
12974
|
}
|
|
12975
|
+
this.isKeyBoardAction = isScrollerCHanged;
|
|
12200
12976
|
}
|
|
12201
|
-
scrollTop(selectedLI, activeIndex) {
|
|
12202
|
-
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;
|
|
12203
12982
|
nextOffset = this.fields.groupBy && !isUndefined(this.fixedHeaderElement) ?
|
|
12204
12983
|
nextOffset - this.fixedHeaderElement.offsetHeight : nextOffset;
|
|
12205
|
-
|
|
12206
|
-
|
|
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) {
|
|
12207
12987
|
this.list.scrollTop = 0;
|
|
12208
12988
|
}
|
|
12209
|
-
else if (nextOffset < 0) {
|
|
12210
|
-
|
|
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
|
+
}
|
|
12211
13015
|
}
|
|
12212
13016
|
else if (!(boxRange > 0 && this.list.offsetHeight > boxRange)) {
|
|
12213
|
-
this.list.scrollTop = selectedLI.offsetTop - (this.fields.groupBy && !
|
|
13017
|
+
this.list.scrollTop = selectedLI.offsetTop - (this.fields.groupBy && !isNullOrUndefined(this.fixedHeaderElement) ?
|
|
12214
13018
|
this.fixedHeaderElement.offsetHeight : 0);
|
|
12215
13019
|
}
|
|
12216
13020
|
}
|
|
@@ -12297,7 +13101,19 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
12297
13101
|
if ((this.allowFiltering || (this.mode === 'CheckBox' && this.enableSelectionOrder === true)
|
|
12298
13102
|
|| this.allowCustomValue) && this.mainList && this.listData) {
|
|
12299
13103
|
const list = this.mainList.cloneNode ? this.mainList.cloneNode(true) : this.mainList;
|
|
12300
|
-
|
|
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
|
+
}
|
|
12301
13117
|
this.focusAtLastListItem(data);
|
|
12302
13118
|
if (this.value && this.value.length) {
|
|
12303
13119
|
this.refreshSelection();
|
|
@@ -12312,14 +13128,15 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
12312
13128
|
let temp;
|
|
12313
13129
|
if (selectedElem !== null) {
|
|
12314
13130
|
if (!isNullOrUndefined(this.value)) {
|
|
12315
|
-
this.tempValues = this.value.slice();
|
|
13131
|
+
this.tempValues = this.allowObjectBinding ? this.value.slice() : this.value.slice();
|
|
12316
13132
|
}
|
|
12317
13133
|
temp = selectedElem.nextElementSibling;
|
|
12318
13134
|
if (temp !== null) {
|
|
12319
13135
|
this.removeChipSelection();
|
|
12320
13136
|
this.addChipSelection(temp, e);
|
|
12321
13137
|
}
|
|
12322
|
-
this.
|
|
13138
|
+
const currentChip = this.allowObjectBinding ? this.getDataByValue(selectedElem.getAttribute('data-value')) : selectedElem.getAttribute('data-value');
|
|
13139
|
+
this.removeValue(currentChip, e);
|
|
12323
13140
|
this.makeTextBoxEmpty();
|
|
12324
13141
|
}
|
|
12325
13142
|
if (this.closePopupOnSelect) {
|
|
@@ -12346,7 +13163,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
12346
13163
|
selectAllParent.classList.remove('e-item-focus');
|
|
12347
13164
|
}
|
|
12348
13165
|
}
|
|
12349
|
-
moveByList(position) {
|
|
13166
|
+
moveByList(position, isVirtualKeyAction) {
|
|
12350
13167
|
if (this.list) {
|
|
12351
13168
|
let elements = this.list.querySelectorAll('li.'
|
|
12352
13169
|
+ dropDownBaseClasses.li
|
|
@@ -12356,7 +13173,10 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
12356
13173
|
+ dropDownBaseClasses.li + ',li.' + dropDownBaseClasses.group
|
|
12357
13174
|
+ ':not(.' + HIDE_LIST + ')' + ':not(.e-reorder-hide)');
|
|
12358
13175
|
}
|
|
12359
|
-
|
|
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
|
+
}
|
|
12360
13180
|
let temp = -1;
|
|
12361
13181
|
const selectAllParent = document.getElementsByClassName('e-selectall-parent')[0];
|
|
12362
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) {
|
|
@@ -12385,22 +13205,56 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
12385
13205
|
if (position > 0) {
|
|
12386
13206
|
if (temp < (elements.length - 1)) {
|
|
12387
13207
|
this.removeFocus();
|
|
12388
|
-
this.
|
|
12389
|
-
|
|
12390
|
-
|
|
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
|
+
}
|
|
12391
13219
|
}
|
|
12392
13220
|
}
|
|
12393
13221
|
else {
|
|
12394
13222
|
if (temp > 0) {
|
|
12395
|
-
this.
|
|
12396
|
-
|
|
12397
|
-
|
|
12398
|
-
|
|
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
|
+
}
|
|
12399
13242
|
}
|
|
12400
13243
|
}
|
|
12401
13244
|
}
|
|
12402
13245
|
}
|
|
12403
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
|
+
}
|
|
12404
13258
|
updateCheck(element) {
|
|
12405
13259
|
if (this.mode === 'CheckBox' && this.enableGroupCheckBox &&
|
|
12406
13260
|
!isNullOrUndefined(this.fields.groupBy)) {
|
|
@@ -12462,7 +13316,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
12462
13316
|
if (this.enabled && !this.readonly) {
|
|
12463
13317
|
const element = e.target.parentElement;
|
|
12464
13318
|
const customVal = element.getAttribute('data-value');
|
|
12465
|
-
let value = this.getFormattedValue(customVal);
|
|
13319
|
+
let value = this.allowObjectBinding ? this.getDataByValue(customVal) : this.getFormattedValue(customVal);
|
|
12466
13320
|
if (this.allowCustomValue && ((customVal !== 'false' && value === false) ||
|
|
12467
13321
|
(!isNullOrUndefined(value) && value.toString() === 'NaN'))) {
|
|
12468
13322
|
value = customVal;
|
|
@@ -12474,6 +13328,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
12474
13328
|
this.inputElement.focus();
|
|
12475
13329
|
}
|
|
12476
13330
|
this.removeValue(value, e);
|
|
13331
|
+
value = this.allowObjectBinding ? getValue((this.fields.value) ? this.fields.value : '', value) : value;
|
|
12477
13332
|
if (isNullOrUndefined(this.findListElement(this.list, 'li', 'data-value', value)) && this.mainList && this.listData) {
|
|
12478
13333
|
const list = this.mainList.cloneNode ? this.mainList.cloneNode(true) : this.mainList;
|
|
12479
13334
|
this.onActionComplete(list, this.mainData);
|
|
@@ -12508,7 +13363,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
12508
13363
|
this.expandTextbox();
|
|
12509
13364
|
}
|
|
12510
13365
|
removeAllItems(value, eve, isClearAll, element, mainElement) {
|
|
12511
|
-
let index = this.value.indexOf(value);
|
|
13366
|
+
let index = this.allowObjectBinding ? this.indexOfObjectInArray(value, this.value) : this.value.indexOf(value);
|
|
12512
13367
|
const removeVal = this.value.slice(0);
|
|
12513
13368
|
removeVal.splice(index, 1);
|
|
12514
13369
|
this.setProperties({ value: [].concat([], removeVal) }, true);
|
|
@@ -12523,7 +13378,8 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
12523
13378
|
e: this, index: index
|
|
12524
13379
|
});
|
|
12525
13380
|
this.invokeCheckboxSelection(element, eve, isClearAll);
|
|
12526
|
-
this.
|
|
13381
|
+
const currentValue = this.allowObjectBinding ? getValue(((this.fields.value) ? this.fields.value : ''), value) : value;
|
|
13382
|
+
this.updateMainList(true, currentValue, mainElement);
|
|
12527
13383
|
this.updateChipStatus();
|
|
12528
13384
|
}
|
|
12529
13385
|
invokeCheckboxSelection(element, eve, isClearAll) {
|
|
@@ -12539,9 +13395,9 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
12539
13395
|
}
|
|
12540
13396
|
}
|
|
12541
13397
|
removeValue(value, eve, length, isClearAll) {
|
|
12542
|
-
let index = this.value.indexOf(this.getFormattedValue(value));
|
|
13398
|
+
let index = this.allowObjectBinding ? this.indexOfObjectInArray(value, this.value) : this.value.indexOf(this.getFormattedValue(value));
|
|
12543
13399
|
if (index === -1 && this.allowCustomValue && !isNullOrUndefined(value)) {
|
|
12544
|
-
index = this.value.indexOf(value.toString());
|
|
13400
|
+
index = this.allowObjectBinding ? this.indexOfObjectInArray(value, this.value) : this.value.indexOf(value.toString());
|
|
12545
13401
|
}
|
|
12546
13402
|
const targetEle = eve && eve.target;
|
|
12547
13403
|
isClearAll = (isClearAll || targetEle && targetEle.classList.contains('e-close-hooker')) ? true : null;
|
|
@@ -12549,7 +13405,8 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
12549
13405
|
HIDE_LIST :
|
|
12550
13406
|
dropDownBaseClasses.selected;
|
|
12551
13407
|
if (index !== -1) {
|
|
12552
|
-
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);
|
|
12553
13410
|
const val = this.getDataByValue(value);
|
|
12554
13411
|
const eventArgs = {
|
|
12555
13412
|
e: eve,
|
|
@@ -12563,11 +13420,20 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
12563
13420
|
this.removeIndex++;
|
|
12564
13421
|
}
|
|
12565
13422
|
else {
|
|
12566
|
-
|
|
13423
|
+
this.virtualSelectAll = false;
|
|
13424
|
+
let removeVal = this.value.slice(0);
|
|
13425
|
+
if (this.enableVirtualization && isClearAll) {
|
|
13426
|
+
removeVal = [];
|
|
13427
|
+
}
|
|
12567
13428
|
removeVal.splice(index, 1);
|
|
12568
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
|
+
}
|
|
12569
13434
|
if (element !== null) {
|
|
12570
|
-
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);
|
|
12571
13437
|
element.setAttribute('aria-selected', 'false');
|
|
12572
13438
|
removeClass([element], className);
|
|
12573
13439
|
if (hideElement) {
|
|
@@ -12581,15 +13447,16 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
12581
13447
|
});
|
|
12582
13448
|
this.invokeCheckboxSelection(element, eve, isClearAll);
|
|
12583
13449
|
}
|
|
13450
|
+
const currentValue = this.allowObjectBinding ? getValue(((this.fields.value) ? this.fields.value : ''), value) : value;
|
|
12584
13451
|
if (this.hideSelectedItem && this.fields.groupBy && element) {
|
|
12585
|
-
this.hideGroupItem(
|
|
13452
|
+
this.hideGroupItem(currentValue);
|
|
12586
13453
|
}
|
|
12587
13454
|
if (this.hideSelectedItem && this.fixedHeaderElement && this.fields.groupBy && this.mode !== 'CheckBox' &&
|
|
12588
13455
|
this.isPopupOpen()) {
|
|
12589
13456
|
super.scrollStop();
|
|
12590
13457
|
}
|
|
12591
|
-
this.updateMainList(true,
|
|
12592
|
-
this.removeChip(
|
|
13458
|
+
this.updateMainList(true, currentValue);
|
|
13459
|
+
this.removeChip(currentValue, isClearAll);
|
|
12593
13460
|
this.updateChipStatus();
|
|
12594
13461
|
const limit = this.value && this.value.length ? this.value.length : 0;
|
|
12595
13462
|
if (limit < this.maximumSelectionLength) {
|
|
@@ -12625,6 +13492,14 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
12625
13492
|
if (isClearAll && (length === 1 || length === null)) {
|
|
12626
13493
|
this.clearAllCallback(eve, isClearAll);
|
|
12627
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
|
+
}
|
|
12628
13503
|
}
|
|
12629
13504
|
});
|
|
12630
13505
|
}
|
|
@@ -12655,11 +13530,16 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
12655
13530
|
}
|
|
12656
13531
|
}
|
|
12657
13532
|
}
|
|
12658
|
-
removeChip(value) {
|
|
13533
|
+
removeChip(value, isClearAll) {
|
|
12659
13534
|
if (this.chipCollectionWrapper) {
|
|
12660
|
-
|
|
12661
|
-
|
|
12662
|
-
|
|
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
|
+
}
|
|
12663
13543
|
}
|
|
12664
13544
|
}
|
|
12665
13545
|
}
|
|
@@ -12693,12 +13573,40 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
12693
13573
|
this.hideOverAllClear();
|
|
12694
13574
|
}
|
|
12695
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
|
+
}
|
|
12696
13585
|
addValue(value, text, eve) {
|
|
12697
13586
|
if (!this.value) {
|
|
12698
13587
|
this.value = [];
|
|
12699
13588
|
}
|
|
12700
|
-
|
|
12701
|
-
|
|
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
|
+
}
|
|
12702
13610
|
}
|
|
12703
13611
|
const element = this.findListElement(this.list, 'li', 'data-value', value);
|
|
12704
13612
|
this.removeFocus();
|
|
@@ -12726,6 +13634,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
12726
13634
|
dispatchSelect(value, eve, element, isNotTrigger, length) {
|
|
12727
13635
|
const list = this.listData;
|
|
12728
13636
|
if (this.initStatus && !isNotTrigger) {
|
|
13637
|
+
value = this.allowObjectBinding ? getValue(((this.fields.value) ? this.fields.value : ''), value) : value;
|
|
12729
13638
|
const val = this.getDataByValue(value);
|
|
12730
13639
|
const eventArgs = {
|
|
12731
13640
|
e: eve,
|
|
@@ -12754,7 +13663,10 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
12754
13663
|
if (this.allowCustomValue && this.isServerRendered && this.listData !== list) {
|
|
12755
13664
|
this.listData = list;
|
|
12756
13665
|
}
|
|
12757
|
-
this.
|
|
13666
|
+
value = this.allowObjectBinding ? this.getDataByValue(value) : value;
|
|
13667
|
+
if ((this.enableVirtualization && value) || !this.enableVirtualization) {
|
|
13668
|
+
this.updateListSelectEventCallback(value, element, eve);
|
|
13669
|
+
}
|
|
12758
13670
|
if (this.hideSelectedItem && this.fixedHeaderElement && this.fields.groupBy && this.mode !== 'CheckBox') {
|
|
12759
13671
|
super.scrollStop();
|
|
12760
13672
|
}
|
|
@@ -12838,7 +13750,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
12838
13750
|
chipContent.innerText = data;
|
|
12839
13751
|
}
|
|
12840
13752
|
else {
|
|
12841
|
-
chipContent.innerHTML = this.encodeHtmlEntities(data);
|
|
13753
|
+
chipContent.innerHTML = this.encodeHtmlEntities(data.toString());
|
|
12842
13754
|
}
|
|
12843
13755
|
chip.appendChild(chipContent);
|
|
12844
13756
|
const eventArgs = {
|
|
@@ -12923,6 +13835,37 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
12923
13835
|
overAllHeight -= this.header.offsetHeight;
|
|
12924
13836
|
}
|
|
12925
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
|
+
}
|
|
12926
13869
|
if (this.footerTemplate) {
|
|
12927
13870
|
this.setFooterTemplate();
|
|
12928
13871
|
overAllHeight -= this.footer.offsetHeight;
|
|
@@ -12995,21 +13938,41 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
12995
13938
|
}
|
|
12996
13939
|
this.popupObj.wireScrollEvents();
|
|
12997
13940
|
if (!(this.mode !== 'CheckBox' && (this.allowFiltering || this.allowCustomValue) &&
|
|
12998
|
-
this.targetElement().trim() !== '')) {
|
|
13941
|
+
this.targetElement().trim() !== '') && !this.enableVirtualization) {
|
|
12999
13942
|
this.loadTemplate();
|
|
13943
|
+
if (this.enableVirtualization && this.mode === 'CheckBox') {
|
|
13944
|
+
this.UpdateSkeleton();
|
|
13945
|
+
}
|
|
13000
13946
|
}
|
|
13947
|
+
this.isPreventScrollAction = true;
|
|
13001
13948
|
this.setScrollPosition();
|
|
13002
13949
|
if (this.allowFiltering) {
|
|
13003
13950
|
this.notify('inputFocus', {
|
|
13004
13951
|
module: 'CheckBoxSelection', enable: this.mode === 'CheckBox', value: 'focus'
|
|
13005
13952
|
});
|
|
13006
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
|
+
}
|
|
13007
13969
|
}, targetExitViewport: () => {
|
|
13008
13970
|
if (!Browser.isDevice) {
|
|
13009
13971
|
this.hidePopup();
|
|
13010
13972
|
}
|
|
13011
13973
|
}
|
|
13012
13974
|
});
|
|
13975
|
+
this.popupContentElement = this.popupObj.element.querySelector('.e-content');
|
|
13013
13976
|
if (this.mode === 'CheckBox' && Browser.isDevice && this.allowFiltering) {
|
|
13014
13977
|
this.notify('deviceSearchBox', { module: 'CheckBoxSelection', enable: this.mode === 'CheckBox' });
|
|
13015
13978
|
}
|
|
@@ -13067,6 +14030,53 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
13067
14030
|
append([this.footer], this.popupWrapper);
|
|
13068
14031
|
EventHandler.add(this.footer, 'mousedown', this.onListMouseDown, this);
|
|
13069
14032
|
}
|
|
14033
|
+
updateInitialData() {
|
|
14034
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14035
|
+
let currentData = this.selectData;
|
|
14036
|
+
let ulElement = this.renderItems(currentData, this.fields);
|
|
14037
|
+
this.list.scrollTop = 0;
|
|
14038
|
+
this.virtualListInfo = {
|
|
14039
|
+
currentPageNumber: null,
|
|
14040
|
+
direction: null,
|
|
14041
|
+
sentinelInfo: {},
|
|
14042
|
+
offsets: {},
|
|
14043
|
+
startIndex: 0,
|
|
14044
|
+
endIndex: 0,
|
|
14045
|
+
};
|
|
14046
|
+
this.previousStartIndex = 0;
|
|
14047
|
+
this.previousEndIndex = 0;
|
|
14048
|
+
if (this.dataSource instanceof DataManager) {
|
|
14049
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14050
|
+
this.totalItemCount = this.dataCount = this.virtualGroupDataSource && this.virtualGroupDataSource.length ? this.virtualGroupDataSource.length : 0;
|
|
14051
|
+
}
|
|
14052
|
+
else {
|
|
14053
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14054
|
+
this.totalItemCount = this.dataCount = this.dataSource && this.dataSource.length ? this.dataSource.length : 0;
|
|
14055
|
+
}
|
|
14056
|
+
if (this.mode !== 'CheckBox') {
|
|
14057
|
+
this.totalItemCount = this.value && this.value.length ? this.totalItemCount - this.value.length : this.totalItemCount;
|
|
14058
|
+
}
|
|
14059
|
+
this.getSkeletonCount();
|
|
14060
|
+
this.UpdateSkeleton();
|
|
14061
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14062
|
+
if (this.list.getElementsByClassName('e-virtual-ddl')[0]) {
|
|
14063
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14064
|
+
this.list.getElementsByClassName('e-virtual-ddl')[0].style = this.GetVirtualTrackHeight();
|
|
14065
|
+
}
|
|
14066
|
+
else if (!this.list.querySelector('.e-virtual-ddl') && this.skeletonCount > 0) {
|
|
14067
|
+
var virualElement = this.createElement('div', {
|
|
14068
|
+
id: this.element.id + '_popup', className: 'e-virtual-ddl', styles: this.GetVirtualTrackHeight()
|
|
14069
|
+
});
|
|
14070
|
+
this.popupWrapper.querySelector('.e-dropdownbase').appendChild(virualElement);
|
|
14071
|
+
}
|
|
14072
|
+
this.listData = currentData;
|
|
14073
|
+
this.liCollections = this.list.querySelectorAll('.e-list-item');
|
|
14074
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14075
|
+
if (this.list.getElementsByClassName('e-virtual-ddl-content')[0]) {
|
|
14076
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14077
|
+
this.list.getElementsByClassName('e-virtual-ddl-content')[0].style = this.getTransformValues();
|
|
14078
|
+
}
|
|
14079
|
+
}
|
|
13070
14080
|
clearAll(e) {
|
|
13071
14081
|
if (this.enabled && !this.readonly) {
|
|
13072
14082
|
let temp;
|
|
@@ -13087,6 +14097,24 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
13087
14097
|
else {
|
|
13088
14098
|
this.clearAllCallback(e);
|
|
13089
14099
|
}
|
|
14100
|
+
this.checkAndResetCache();
|
|
14101
|
+
if (this.enableVirtualization) {
|
|
14102
|
+
this.updateInitialData();
|
|
14103
|
+
if (this.chipCollectionWrapper) {
|
|
14104
|
+
this.chipCollectionWrapper.innerHTML = '';
|
|
14105
|
+
}
|
|
14106
|
+
if (!this.isCustomDataUpdated) {
|
|
14107
|
+
this.notify("setGeneratedData", {
|
|
14108
|
+
module: "VirtualScroll",
|
|
14109
|
+
});
|
|
14110
|
+
}
|
|
14111
|
+
}
|
|
14112
|
+
if (this.enableVirtualization) {
|
|
14113
|
+
this.list.scrollTop = 0;
|
|
14114
|
+
this.virtualListInfo = null;
|
|
14115
|
+
this.previousStartIndex = 0;
|
|
14116
|
+
this.previousEndIndex = 0;
|
|
14117
|
+
}
|
|
13090
14118
|
}
|
|
13091
14119
|
}
|
|
13092
14120
|
clearAllCallback(e, isClearAll) {
|
|
@@ -13185,6 +14213,8 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
13185
14213
|
}
|
|
13186
14214
|
search(e) {
|
|
13187
14215
|
this.resetFilteredData = true;
|
|
14216
|
+
this.preventSetCurrentData = false;
|
|
14217
|
+
this.firstItem = this.dataSource && this.dataSource.length > 0 ? this.dataSource[0] : null;
|
|
13188
14218
|
if (!isNullOrUndefined(e)) {
|
|
13189
14219
|
this.keyCode = e.keyCode;
|
|
13190
14220
|
}
|
|
@@ -13201,6 +14231,9 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
13201
14231
|
if (this.allowCustomValue) {
|
|
13202
14232
|
this.isRemoteSelection = true;
|
|
13203
14233
|
}
|
|
14234
|
+
if (!this.backCommand) {
|
|
14235
|
+
this.checkAndResetCache();
|
|
14236
|
+
}
|
|
13204
14237
|
const eventArgs = {
|
|
13205
14238
|
preventDefaultAction: false,
|
|
13206
14239
|
text: this.targetElement(),
|
|
@@ -13227,12 +14260,83 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
13227
14260
|
else if (this.allowCustomValue) {
|
|
13228
14261
|
let query = new Query();
|
|
13229
14262
|
query = this.allowFiltering && (text !== '') ? query.where(this.fields.text, 'startswith', text, this.ignoreCase, this.ignoreAccent) : query;
|
|
13230
|
-
|
|
14263
|
+
if (this.enableVirtualization) {
|
|
14264
|
+
if (this.dataSource instanceof DataManager) {
|
|
14265
|
+
this.dataUpdater(this.virtualGroupDataSource, query, this.fields);
|
|
14266
|
+
}
|
|
14267
|
+
else {
|
|
14268
|
+
this.dataUpdater(this.dataSource, query, this.fields);
|
|
14269
|
+
}
|
|
14270
|
+
}
|
|
14271
|
+
else {
|
|
14272
|
+
this.dataUpdater(this.mainData, query, this.fields);
|
|
14273
|
+
}
|
|
14274
|
+
this.UpdateSkeleton();
|
|
13231
14275
|
}
|
|
13232
14276
|
else {
|
|
13233
14277
|
const liCollections = this.list.querySelectorAll('li.' + dropDownBaseClasses.li + ':not(.e-hide-listitem)');
|
|
13234
|
-
const
|
|
13235
|
-
|
|
14278
|
+
const type = this.typeOfData(this.listData).typeof;
|
|
14279
|
+
let activeElement = Search(this.targetElement(), liCollections, 'StartsWith', this.ignoreCase);
|
|
14280
|
+
if (this.enableVirtualization && this.targetElement().trim() !== '' && !this.allowFiltering) {
|
|
14281
|
+
var updatingincrementalindex = false;
|
|
14282
|
+
if ((this.viewPortInfo.endIndex >= this.incrementalEndIndex && this.incrementalEndIndex <= this.totalItemCount) || this.incrementalEndIndex == 0) {
|
|
14283
|
+
updatingincrementalindex = true;
|
|
14284
|
+
this.incrementalStartIndex = 0;
|
|
14285
|
+
this.incrementalEndIndex = 100 > this.totalItemCount ? this.totalItemCount : 100;
|
|
14286
|
+
this.updateIncrementalInfo(this.incrementalStartIndex, this.incrementalEndIndex);
|
|
14287
|
+
updatingincrementalindex = false;
|
|
14288
|
+
}
|
|
14289
|
+
if (this.viewPortInfo.startIndex !== 0 || updatingincrementalindex) {
|
|
14290
|
+
this.updateIncrementalView(0, this.itemCount);
|
|
14291
|
+
}
|
|
14292
|
+
activeElement = Search(this.targetElement(), this.incrementalLiCollections, this.filterType, true, this.listData, this.fields, type);
|
|
14293
|
+
while (isNullOrUndefined(activeElement) && this.incrementalEndIndex < this.totalItemCount) {
|
|
14294
|
+
this.incrementalStartIndex = this.incrementalEndIndex;
|
|
14295
|
+
this.incrementalEndIndex = this.incrementalEndIndex + 100 > this.totalItemCount ? this.totalItemCount : this.incrementalEndIndex + 100;
|
|
14296
|
+
this.updateIncrementalInfo(this.incrementalStartIndex, this.incrementalEndIndex);
|
|
14297
|
+
updatingincrementalindex = true;
|
|
14298
|
+
if (this.viewPortInfo.startIndex !== 0 || updatingincrementalindex) {
|
|
14299
|
+
this.updateIncrementalView(0, this.itemCount);
|
|
14300
|
+
}
|
|
14301
|
+
activeElement = Search(this.targetElement(), this.incrementalLiCollections, this.filterType, true, this.listData, this.fields, type);
|
|
14302
|
+
if (!isNullOrUndefined(activeElement)) {
|
|
14303
|
+
break;
|
|
14304
|
+
}
|
|
14305
|
+
if (isNullOrUndefined(activeElement) && this.incrementalEndIndex >= this.totalItemCount) {
|
|
14306
|
+
this.incrementalStartIndex = 0;
|
|
14307
|
+
this.incrementalEndIndex = 100 > this.totalItemCount ? this.totalItemCount : 100;
|
|
14308
|
+
break;
|
|
14309
|
+
}
|
|
14310
|
+
}
|
|
14311
|
+
if (activeElement.index) {
|
|
14312
|
+
if ((!(this.viewPortInfo.startIndex >= activeElement.index)) || (!(activeElement.index >= this.viewPortInfo.endIndex))) {
|
|
14313
|
+
var startIndex = activeElement.index - ((this.itemCount / 2) - 2) > 0 ? activeElement.index - ((this.itemCount / 2) - 2) : 0;
|
|
14314
|
+
var endIndex = startIndex + this.itemCount > this.totalItemCount ? this.totalItemCount : startIndex + this.itemCount;
|
|
14315
|
+
if (startIndex != this.viewPortInfo.startIndex) {
|
|
14316
|
+
this.updateIncrementalView(startIndex, endIndex);
|
|
14317
|
+
}
|
|
14318
|
+
}
|
|
14319
|
+
}
|
|
14320
|
+
if (!isNullOrUndefined(activeElement.item)) {
|
|
14321
|
+
var index_1 = this.getIndexByValue(activeElement.item.getAttribute('data-value')) - this.skeletonCount;
|
|
14322
|
+
if (index_1 > this.itemCount / 2) {
|
|
14323
|
+
var startIndex = this.viewPortInfo.startIndex + ((this.itemCount / 2) - 2) < this.totalItemCount ? this.viewPortInfo.startIndex + ((this.itemCount / 2) - 2) : this.totalItemCount;
|
|
14324
|
+
var endIndex = this.viewPortInfo.startIndex + this.itemCount > this.totalItemCount ? this.totalItemCount : this.viewPortInfo.startIndex + this.itemCount;
|
|
14325
|
+
this.updateIncrementalView(startIndex, endIndex);
|
|
14326
|
+
}
|
|
14327
|
+
activeElement.item = this.getElementByValue(activeElement.item.getAttribute('data-value'));
|
|
14328
|
+
}
|
|
14329
|
+
else {
|
|
14330
|
+
this.updateIncrementalView(0, this.itemCount);
|
|
14331
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14332
|
+
this.list.getElementsByClassName('e-virtual-ddl-content')[0].style = this.getTransformValues();
|
|
14333
|
+
this.list.scrollTop = 0;
|
|
14334
|
+
}
|
|
14335
|
+
if (activeElement && activeElement.item) {
|
|
14336
|
+
activeElement.item = this.getElementByValue(activeElement.item.getAttribute('data-value'));
|
|
14337
|
+
}
|
|
14338
|
+
}
|
|
14339
|
+
if (activeElement && activeElement.item) {
|
|
13236
14340
|
this.addListFocus(activeElement.item);
|
|
13237
14341
|
this.list.scrollTop =
|
|
13238
14342
|
activeElement.item.offsetHeight * activeElement.index;
|
|
@@ -13245,11 +14349,15 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
13245
14349
|
}
|
|
13246
14350
|
}
|
|
13247
14351
|
}
|
|
14352
|
+
if (this.enableVirtualization && this.allowFiltering) {
|
|
14353
|
+
this.getFilteringSkeletonCount();
|
|
14354
|
+
}
|
|
13248
14355
|
}
|
|
13249
14356
|
preRender() {
|
|
13250
14357
|
if (this.allowFiltering === null) {
|
|
13251
14358
|
this.allowFiltering = (this.mode === 'CheckBox') ? true : false;
|
|
13252
14359
|
}
|
|
14360
|
+
this.preventSetCurrentData = false;
|
|
13253
14361
|
this.initializeData();
|
|
13254
14362
|
this.updateDataAttribute(this.htmlAttributes);
|
|
13255
14363
|
super.preRender();
|
|
@@ -13271,6 +14379,14 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
13271
14379
|
this.isCustomRendered = false;
|
|
13272
14380
|
this.isRemoteSelection = false;
|
|
13273
14381
|
this.isSelectAllTarget = true;
|
|
14382
|
+
this.viewPortInfo = {
|
|
14383
|
+
currentPageNumber: null,
|
|
14384
|
+
direction: null,
|
|
14385
|
+
sentinelInfo: {},
|
|
14386
|
+
offsets: {},
|
|
14387
|
+
startIndex: 0,
|
|
14388
|
+
endIndex: this.itemCount,
|
|
14389
|
+
};
|
|
13274
14390
|
}
|
|
13275
14391
|
updateData(delimiterChar, e) {
|
|
13276
14392
|
let data = '';
|
|
@@ -13278,7 +14394,9 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
13278
14394
|
const text = [];
|
|
13279
14395
|
let temp;
|
|
13280
14396
|
const tempData = this.listData;
|
|
13281
|
-
this.
|
|
14397
|
+
if (!this.enableVirtualization) {
|
|
14398
|
+
this.listData = this.mainData;
|
|
14399
|
+
}
|
|
13282
14400
|
if (!isNullOrUndefined(this.hiddenElement)) {
|
|
13283
14401
|
this.hiddenElement.innerHTML = '';
|
|
13284
14402
|
}
|
|
@@ -13286,16 +14404,32 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
13286
14404
|
let valueLength = this.value.length;
|
|
13287
14405
|
let hiddenElementContent = '';
|
|
13288
14406
|
for (let index = 0; index < valueLength; index++) {
|
|
13289
|
-
const valueItem = this.value[index];
|
|
13290
|
-
|
|
13291
|
-
if (
|
|
14407
|
+
const valueItem = this.allowObjectBinding ? getValue((this.fields.value) ? this.fields.value : '', this.value[index]) : this.value[index];
|
|
14408
|
+
let listValue = this.findListElement((!isNullOrUndefined(this.mainList) ? this.mainList : this.ulElement), 'li', 'data-value', valueItem);
|
|
14409
|
+
if (this.enableVirtualization) {
|
|
14410
|
+
listValue = this.findListElement((!isNullOrUndefined(this.list) ? this.list : this.ulElement), 'li', 'data-value', valueItem);
|
|
14411
|
+
}
|
|
14412
|
+
if (isNullOrUndefined(listValue) && !this.allowCustomValue && !this.enableVirtualization) {
|
|
13292
14413
|
this.value.splice(index, 1);
|
|
13293
14414
|
index -= 1;
|
|
13294
14415
|
valueLength -= 1;
|
|
13295
14416
|
}
|
|
13296
14417
|
else {
|
|
13297
14418
|
if (this.listData) {
|
|
13298
|
-
|
|
14419
|
+
if (this.enableVirtualization) {
|
|
14420
|
+
if (delim) {
|
|
14421
|
+
data = this.delimiterWrapper && this.delimiterWrapper.innerHTML == "" ? data : this.delimiterWrapper.innerHTML;
|
|
14422
|
+
}
|
|
14423
|
+
const value = this.allowObjectBinding ? getValue(((this.fields.value) ? this.fields.value : ''), this.value[this.value.length - 1]) : this.value[this.value.length - 1];
|
|
14424
|
+
temp = this.getTextByValue(value);
|
|
14425
|
+
let textValues = this.text != null && this.text != "" ? this.text + ',' + temp : temp;
|
|
14426
|
+
data += temp + delimiterChar + ' ';
|
|
14427
|
+
text.push(textValues);
|
|
14428
|
+
break;
|
|
14429
|
+
}
|
|
14430
|
+
else {
|
|
14431
|
+
temp = this.getTextByValue(valueItem);
|
|
14432
|
+
}
|
|
13299
14433
|
}
|
|
13300
14434
|
else {
|
|
13301
14435
|
temp = valueItem;
|
|
@@ -13309,7 +14443,10 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
13309
14443
|
this.hiddenElement.innerHTML = hiddenElementContent;
|
|
13310
14444
|
}
|
|
13311
14445
|
}
|
|
13312
|
-
|
|
14446
|
+
let isChipRemove = e && e.target && e.target.classList.contains('e-chips-close');
|
|
14447
|
+
if (!this.enableVirtualization || (this.enableVirtualization && this.mode !== 'CheckBox' && !isChipRemove)) {
|
|
14448
|
+
this.setProperties({ text: text.toString() }, true);
|
|
14449
|
+
}
|
|
13313
14450
|
if (delim) {
|
|
13314
14451
|
this.updateWrapperText(this.delimiterWrapper, data);
|
|
13315
14452
|
this.delimiterWrapper.setAttribute('id', getUniqueID('delim_val'));
|
|
@@ -13338,7 +14475,8 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
13338
14475
|
}
|
|
13339
14476
|
}
|
|
13340
14477
|
if (textVal && textVal.length) {
|
|
13341
|
-
this.
|
|
14478
|
+
const value = this.allowObjectBinding ? this.getDataByValue(textVal) : textVal;
|
|
14479
|
+
this.setProperties({ value: value }, true);
|
|
13342
14480
|
}
|
|
13343
14481
|
}
|
|
13344
14482
|
else {
|
|
@@ -13351,10 +14489,12 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
13351
14489
|
isEmptyData = true;
|
|
13352
14490
|
}
|
|
13353
14491
|
super.render(null, isEmptyData);
|
|
14492
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14493
|
+
this.totalItemCount = this.dataSource && this.dataSource.length ? this.dataSource.length : 0;
|
|
13354
14494
|
this.unwireListEvents();
|
|
13355
14495
|
this.wireListEvents();
|
|
13356
14496
|
}
|
|
13357
|
-
initialValueUpdate() {
|
|
14497
|
+
initialValueUpdate(listItems) {
|
|
13358
14498
|
if (this.list) {
|
|
13359
14499
|
let text;
|
|
13360
14500
|
let element;
|
|
@@ -13365,12 +14505,34 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
13365
14505
|
this.removeListSelection();
|
|
13366
14506
|
if (!isNullOrUndefined(this.value)) {
|
|
13367
14507
|
for (let index = 0; !isNullOrUndefined(this.value[index]); index++) {
|
|
13368
|
-
value = this.value[index];
|
|
14508
|
+
value = this.allowObjectBinding ? getValue(((this.fields.value) ? this.fields.value : ''), this.value[index]) : this.value[index];
|
|
13369
14509
|
element = this.findListElement(this.hideSelectedItem ? this.ulElement : this.list, 'li', 'data-value', value);
|
|
13370
|
-
|
|
13371
|
-
if (
|
|
14510
|
+
let isCustomData = false;
|
|
14511
|
+
if (this.enableVirtualization) {
|
|
14512
|
+
text = null;
|
|
14513
|
+
if (listItems != null && listItems.length > 0) {
|
|
14514
|
+
for (let i = 0; i < listItems.length; i++) {
|
|
14515
|
+
if (getValue((this.fields.value ? this.fields.value : 'value'), listItems[i]) === value) {
|
|
14516
|
+
text = getValue(this.fields.text, listItems[i]);
|
|
14517
|
+
break;
|
|
14518
|
+
}
|
|
14519
|
+
}
|
|
14520
|
+
}
|
|
14521
|
+
if (isNullOrUndefined(text) && this.allowCustomValue) {
|
|
14522
|
+
text = this.getTextByValue(value);
|
|
14523
|
+
isCustomData = true;
|
|
14524
|
+
}
|
|
14525
|
+
}
|
|
14526
|
+
else {
|
|
14527
|
+
text = this.getTextByValue(value);
|
|
14528
|
+
}
|
|
14529
|
+
if (((element && (element.getAttribute('aria-selected') !== 'true')) ||
|
|
13372
14530
|
(element && (element.getAttribute('aria-selected') === 'true' && this.hideSelectedItem) &&
|
|
13373
|
-
(this.mode === 'Box' || this.mode === 'Default'))) {
|
|
14531
|
+
(this.mode === 'Box' || this.mode === 'Default'))) || (this.enableVirtualization && value != null && text != null && !isCustomData)) {
|
|
14532
|
+
let currentText = [];
|
|
14533
|
+
var textValues = this.text != null ? this.text + ',' + text : text;
|
|
14534
|
+
currentText.push(textValues);
|
|
14535
|
+
this.setProperties({ text: currentText.toString() }, true);
|
|
13374
14536
|
this.addChip(text, value);
|
|
13375
14537
|
this.addListSelection(element);
|
|
13376
14538
|
}
|
|
@@ -13381,12 +14543,24 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
13381
14543
|
setValue(this.fields.value, value, newValue);
|
|
13382
14544
|
const noDataEle = this.popupWrapper.querySelector('.' + dropDownBaseClasses.noData);
|
|
13383
14545
|
this.addItem(newValue, indexItem);
|
|
14546
|
+
if (this.enableVirtualization) {
|
|
14547
|
+
if (this.virtualCustomSelectData && this.virtualCustomSelectData.length >= 0) {
|
|
14548
|
+
this.virtualCustomSelectData.push(newValue);
|
|
14549
|
+
}
|
|
14550
|
+
else {
|
|
14551
|
+
this.virtualCustomSelectData = [newValue];
|
|
14552
|
+
}
|
|
14553
|
+
}
|
|
13384
14554
|
element = element ? element : this.findListElement(this.hideSelectedItem ? this.ulElement : this.list, 'li', 'data-value', value);
|
|
13385
14555
|
if (this.popupWrapper.contains(noDataEle)) {
|
|
13386
14556
|
this.list.setAttribute('style', noDataEle.getAttribute('style'));
|
|
13387
14557
|
this.popupWrapper.replaceChild(this.list, noDataEle);
|
|
13388
14558
|
this.wireListEvents();
|
|
13389
14559
|
}
|
|
14560
|
+
let currentText = [];
|
|
14561
|
+
var textValues = this.text != null ? this.text + ',' + text : text;
|
|
14562
|
+
currentText.push(textValues);
|
|
14563
|
+
this.setProperties({ text: currentText.toString() }, true);
|
|
13390
14564
|
this.addChip(text, value);
|
|
13391
14565
|
this.addListSelection(element);
|
|
13392
14566
|
}
|
|
@@ -13416,7 +14590,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
13416
14590
|
}
|
|
13417
14591
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
13418
14592
|
updateActionCompleteData(li, item) {
|
|
13419
|
-
if (this.value && this.value.indexOf(li.getAttribute('data-value')) > -1) {
|
|
14593
|
+
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)))) {
|
|
13420
14594
|
this.mainList = this.ulElement;
|
|
13421
14595
|
if (this.hideSelectedItem) {
|
|
13422
14596
|
addClass([li], HIDE_LIST);
|
|
@@ -13454,13 +14628,13 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
13454
14628
|
}
|
|
13455
14629
|
updateListSelection(li, e, length) {
|
|
13456
14630
|
const customVal = li.getAttribute('data-value');
|
|
13457
|
-
let value = this.getFormattedValue(customVal);
|
|
14631
|
+
let value = this.allowObjectBinding ? this.getDataByValue(customVal) : this.getFormattedValue(customVal);
|
|
13458
14632
|
if (this.allowCustomValue && ((customVal !== 'false' && value === false) ||
|
|
13459
14633
|
(!isNullOrUndefined(value) && value.toString() === 'NaN'))) {
|
|
13460
14634
|
value = customVal;
|
|
13461
14635
|
}
|
|
13462
14636
|
this.removeHover();
|
|
13463
|
-
if (!this.value || this.value.indexOf(value) === -1) {
|
|
14637
|
+
if (!this.value || ((!this.allowObjectBinding && this.value.indexOf(value) === -1) || (this.allowObjectBinding && this.indexOfObjectInArray(value, this.value) === -1))) {
|
|
13464
14638
|
this.dispatchSelect(value, e, li, (li.getAttribute('aria-selected') === 'true'), length);
|
|
13465
14639
|
}
|
|
13466
14640
|
else {
|
|
@@ -13468,9 +14642,10 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
13468
14642
|
}
|
|
13469
14643
|
}
|
|
13470
14644
|
updateListSelectEventCallback(value, li, e) {
|
|
14645
|
+
value = this.allowObjectBinding ? getValue(((this.fields.value) ? this.fields.value : ''), value) : value;
|
|
13471
14646
|
const text = this.getTextByValue(value);
|
|
13472
|
-
if ((this.allowCustomValue || this.allowFiltering) && !this.findListElement(this.mainList, 'li', 'data-value', value)) {
|
|
13473
|
-
const temp = li.cloneNode(true);
|
|
14647
|
+
if ((this.allowCustomValue || this.allowFiltering) && !this.findListElement(this.mainList, 'li', 'data-value', value) && (!this.enableVirtualization || (this.enableVirtualization && this.virtualCustomData))) {
|
|
14648
|
+
const temp = li ? li.cloneNode(true) : li;
|
|
13474
14649
|
const fieldValue = this.fields.value ? this.fields.value : 'value';
|
|
13475
14650
|
if (this.allowCustomValue && this.mainData.length && typeof getValue(fieldValue, this.mainData[0]) === 'number') {
|
|
13476
14651
|
value = !isNaN(parseFloat(value.toString())) ? parseFloat(value.toString()) : value;
|
|
@@ -13482,10 +14657,22 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
13482
14657
|
};
|
|
13483
14658
|
this.trigger('customValueSelection', eventArgs, (eventArgs) => {
|
|
13484
14659
|
if (!eventArgs.cancel) {
|
|
13485
|
-
|
|
13486
|
-
|
|
13487
|
-
|
|
13488
|
-
|
|
14660
|
+
if (this.enableVirtualization && this.virtualCustomData) {
|
|
14661
|
+
if (this.virtualCustomSelectData && this.virtualCustomSelectData.length >= 0) {
|
|
14662
|
+
this.virtualCustomSelectData.push(data);
|
|
14663
|
+
}
|
|
14664
|
+
else {
|
|
14665
|
+
this.virtualCustomSelectData = [data];
|
|
14666
|
+
}
|
|
14667
|
+
this.remoteCustomValue = false;
|
|
14668
|
+
this.addValue(value, text, e);
|
|
14669
|
+
}
|
|
14670
|
+
else {
|
|
14671
|
+
append([temp], this.mainList);
|
|
14672
|
+
this.mainData.push(data);
|
|
14673
|
+
this.remoteCustomValue = false;
|
|
14674
|
+
this.addValue(value, text, e);
|
|
14675
|
+
}
|
|
13489
14676
|
}
|
|
13490
14677
|
});
|
|
13491
14678
|
}
|
|
@@ -13594,8 +14781,12 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
13594
14781
|
onMouseClick(e) {
|
|
13595
14782
|
this.keyCode = null;
|
|
13596
14783
|
this.scrollFocusStatus = false;
|
|
14784
|
+
this.keyboardEvent = null;
|
|
13597
14785
|
let target = e.target;
|
|
13598
14786
|
const li = closest(target, '.' + dropDownBaseClasses.li);
|
|
14787
|
+
if (this.enableVirtualization && li && li.classList.contains('e-virtual-list')) {
|
|
14788
|
+
return;
|
|
14789
|
+
}
|
|
13599
14790
|
const headerLi = closest(target, '.' + dropDownBaseClasses.group);
|
|
13600
14791
|
if (headerLi && this.enableGroupCheckBox && this.mode === 'CheckBox' && this.fields.groupBy) {
|
|
13601
14792
|
target = target.classList.contains('e-list-group-item') ? target.firstElementChild.lastElementChild
|
|
@@ -13672,6 +14863,39 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
13672
14863
|
else {
|
|
13673
14864
|
e.preventDefault();
|
|
13674
14865
|
}
|
|
14866
|
+
if (this.enableVirtualization && this.hideSelectedItem) {
|
|
14867
|
+
let visibleListElements = this.list.querySelectorAll('li.'
|
|
14868
|
+
+ dropDownBaseClasses.li
|
|
14869
|
+
+ ':not(.' + HIDE_LIST + ')' + ':not(.e-reorder-hide)' + ':not(.e-virtual-list)');
|
|
14870
|
+
if (visibleListElements.length) {
|
|
14871
|
+
const actualCount = this.virtualListHeight > 0 ? Math.floor(this.virtualListHeight / this.listItemHeight) : 0;
|
|
14872
|
+
if (visibleListElements.length < (actualCount + 2)) {
|
|
14873
|
+
let query = this.getForQuery(this.value).clone();
|
|
14874
|
+
query = query.skip(this.virtualItemStartIndex);
|
|
14875
|
+
this.resetList(this.dataSource, this.fields, query);
|
|
14876
|
+
this.UpdateSkeleton();
|
|
14877
|
+
this.liCollections = this.list.querySelectorAll('.' + dropDownBaseClasses.li);
|
|
14878
|
+
this.virtualItemCount = this.itemCount;
|
|
14879
|
+
if (this.mode !== 'CheckBox') {
|
|
14880
|
+
this.totalItemCount = this.value && this.value.length ? this.totalItemCount - this.value.length : this.totalItemCount;
|
|
14881
|
+
}
|
|
14882
|
+
if (!this.list.querySelector('.e-virtual-ddl')) {
|
|
14883
|
+
var virualElement = this.createElement('div', {
|
|
14884
|
+
id: this.element.id + '_popup', className: 'e-virtual-ddl', styles: this.GetVirtualTrackHeight()
|
|
14885
|
+
});
|
|
14886
|
+
this.popupWrapper.querySelector('.e-dropdownbase').appendChild(virualElement);
|
|
14887
|
+
}
|
|
14888
|
+
else {
|
|
14889
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14890
|
+
this.list.getElementsByClassName('e-virtual-ddl')[0].style = this.GetVirtualTrackHeight();
|
|
14891
|
+
}
|
|
14892
|
+
if (this.list.querySelector('.e-virtual-ddl-content')) {
|
|
14893
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14894
|
+
this.list.getElementsByClassName('e-virtual-ddl-content')[0].style = this.getTransformValues();
|
|
14895
|
+
}
|
|
14896
|
+
}
|
|
14897
|
+
}
|
|
14898
|
+
}
|
|
13675
14899
|
this.refreshPlaceHolder();
|
|
13676
14900
|
this.deselectHeader();
|
|
13677
14901
|
}
|
|
@@ -13909,7 +15133,9 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
13909
15133
|
let remaining;
|
|
13910
15134
|
let downIconWidth = 0;
|
|
13911
15135
|
let overAllContainer;
|
|
13912
|
-
|
|
15136
|
+
if (!this.enableVirtualization) {
|
|
15137
|
+
this.updateWrapperText(this.viewWrapper, data);
|
|
15138
|
+
}
|
|
13913
15139
|
const l10nLocale = {
|
|
13914
15140
|
noRecordsTemplate: 'No records found',
|
|
13915
15141
|
actionFailureTemplate: 'Request failed',
|
|
@@ -13940,11 +15166,21 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
13940
15166
|
this.checkClearIconWidth();
|
|
13941
15167
|
if (!isNullOrUndefined(this.value)) {
|
|
13942
15168
|
for (let index = 0; !isNullOrUndefined(this.value[index]); index++) {
|
|
13943
|
-
|
|
13944
|
-
|
|
13945
|
-
|
|
13946
|
-
|
|
13947
|
-
|
|
15169
|
+
let items = this.text && this.text.split(this.delimiterChar);
|
|
15170
|
+
if (!this.enableVirtualization) {
|
|
15171
|
+
data += (index === 0) ? '' : this.delimiterChar + ' ';
|
|
15172
|
+
temp = this.getOverflowVal(index);
|
|
15173
|
+
data += temp;
|
|
15174
|
+
temp = this.viewWrapper.innerHTML;
|
|
15175
|
+
this.updateWrapperText(this.viewWrapper, data);
|
|
15176
|
+
}
|
|
15177
|
+
else if (items) {
|
|
15178
|
+
data += (index === 0) ? '' : this.delimiterChar + ' ';
|
|
15179
|
+
temp = items[index];
|
|
15180
|
+
data += temp;
|
|
15181
|
+
temp = this.viewWrapper.innerHTML;
|
|
15182
|
+
this.updateWrapperText(this.viewWrapper, data);
|
|
15183
|
+
}
|
|
13948
15184
|
wrapperleng = this.viewWrapper.offsetWidth +
|
|
13949
15185
|
parseInt(window.getComputedStyle(this.viewWrapper).paddingRight, 10);
|
|
13950
15186
|
overAllContainer = this.componentWrapper.offsetWidth -
|
|
@@ -14047,18 +15283,19 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
14047
15283
|
getOverflowVal(index) {
|
|
14048
15284
|
let temp;
|
|
14049
15285
|
if (this.mainData && this.mainData.length) {
|
|
15286
|
+
const value = this.allowObjectBinding ? getValue(((this.fields.value) ? this.fields.value : ''), this.value[index]) : this.value[index];
|
|
14050
15287
|
if (this.mode === 'CheckBox') {
|
|
14051
15288
|
const newTemp = this.listData;
|
|
14052
15289
|
this.listData = this.mainData;
|
|
14053
|
-
temp = this.getTextByValue(
|
|
15290
|
+
temp = this.getTextByValue(value);
|
|
14054
15291
|
this.listData = newTemp;
|
|
14055
15292
|
}
|
|
14056
15293
|
else {
|
|
14057
|
-
temp = this.getTextByValue(
|
|
15294
|
+
temp = this.getTextByValue(value);
|
|
14058
15295
|
}
|
|
14059
15296
|
}
|
|
14060
15297
|
else {
|
|
14061
|
-
temp = this.value[index];
|
|
15298
|
+
temp = this.allowObjectBinding ? getValue(((this.fields.value) ? this.fields.value : ''), this.value[index]) : this.value[index];
|
|
14062
15299
|
}
|
|
14063
15300
|
return temp;
|
|
14064
15301
|
}
|
|
@@ -14175,7 +15412,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
14175
15412
|
preventSelectEvent: false
|
|
14176
15413
|
};
|
|
14177
15414
|
this.trigger('beforeSelectAll', beforeSelectArgs);
|
|
14178
|
-
if (li && li.length) {
|
|
15415
|
+
if ((li && li.length) || (this.enableVirtualization && !state)) {
|
|
14179
15416
|
let index = 0;
|
|
14180
15417
|
let count = 0;
|
|
14181
15418
|
if (this.enableGroupCheckBox) {
|
|
@@ -14185,37 +15422,127 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
14185
15422
|
count = state ? this.maximumSelectionLength - (this.value ? this.value.length : 0) : this.maximumSelectionLength;
|
|
14186
15423
|
}
|
|
14187
15424
|
if (!beforeSelectArgs.preventSelectEvent) {
|
|
14188
|
-
this.
|
|
14189
|
-
|
|
14190
|
-
|
|
14191
|
-
|
|
14192
|
-
this.
|
|
14193
|
-
|
|
14194
|
-
|
|
14195
|
-
|
|
14196
|
-
|
|
14197
|
-
|
|
14198
|
-
|
|
14199
|
-
|
|
14200
|
-
|
|
14201
|
-
|
|
14202
|
-
|
|
15425
|
+
if (this.enableVirtualization) {
|
|
15426
|
+
if (state) {
|
|
15427
|
+
this.virtualSelectAll = true;
|
|
15428
|
+
this.resetList(this.dataSource, this.fields, new Query().skip(this.viewPortInfo.startIndex));
|
|
15429
|
+
if (this.virtualSelectAllData instanceof Array) {
|
|
15430
|
+
for (var i = 0; i < this.virtualSelectAllData.length; i++) {
|
|
15431
|
+
if (li[this.skeletonCount + i]) {
|
|
15432
|
+
let value = this.allowObjectBinding ? this.getDataByValue(li[this.skeletonCount + i].getAttribute('data-value')) : this.getFormattedValue(li[this.skeletonCount + i].getAttribute('data-value'));
|
|
15433
|
+
if (((!this.allowObjectBinding && this.value && this.value.indexOf(value) === 1) || (this.allowObjectBinding && this.indexOfObjectInArray(value, this.value) === 1))) {
|
|
15434
|
+
continue;
|
|
15435
|
+
}
|
|
15436
|
+
this.updateListSelection(li[this.skeletonCount + i], event, length - i);
|
|
15437
|
+
}
|
|
15438
|
+
else {
|
|
15439
|
+
if (this.fields) {
|
|
15440
|
+
let value = getValue(this.fields.value, this.virtualSelectAllData[i]);
|
|
15441
|
+
value = this.allowObjectBinding ? this.getDataByValue(value) : value;
|
|
15442
|
+
if (((!this.allowObjectBinding && this.value && this.value.indexOf(value) === 1) || (this.allowObjectBinding && this.indexOfObjectInArray(value, this.value) === 1))) {
|
|
15443
|
+
continue;
|
|
15444
|
+
}
|
|
15445
|
+
if (this.value && value != null && Array.isArray(this.value) && ((!this.allowObjectBinding && this.value.indexOf(value) < 0) || (this.allowObjectBinding && !this.isObjectInArray(value, this.value)))) {
|
|
15446
|
+
this.dispatchSelect(value, event, null, false, length);
|
|
15447
|
+
}
|
|
15448
|
+
}
|
|
15449
|
+
}
|
|
14203
15450
|
}
|
|
15451
|
+
if (this.virtualSelectAllData && this.value.length != this.virtualSelectAllData.length && this.virtualItemStartIndex != 0) {
|
|
15452
|
+
if (this.virtualItemStartIndex > this.itemCount) {
|
|
15453
|
+
for (var i = 0; i < this.itemCount; i++) {
|
|
15454
|
+
if (this.fields) {
|
|
15455
|
+
let value = getValue(this.fields.value, this.virtualSelectAllData[i]);
|
|
15456
|
+
value = this.allowObjectBinding ? this.getDataByValue(value) : value;
|
|
15457
|
+
if (this.value && value != null && Array.isArray(this.value) && ((!this.allowObjectBinding && this.value.indexOf(value) < 0) || (this.allowObjectBinding && !this.isObjectInArray(value, this.value)))) {
|
|
15458
|
+
this.setProperties({ value: [].concat([], this.value, this.allowObjectBinding ? [this.virtualSelectAllData[i]] : [value]) }, true);
|
|
15459
|
+
}
|
|
15460
|
+
}
|
|
15461
|
+
}
|
|
15462
|
+
}
|
|
15463
|
+
}
|
|
15464
|
+
else {
|
|
15465
|
+
for (var i = 0; i < this.virtualItemStartIndex; i++) {
|
|
15466
|
+
if (this.fields) {
|
|
15467
|
+
var value = getValue(this.fields.value, this.virtualSelectAllData[i]);
|
|
15468
|
+
value = this.allowObjectBinding ? this.getDataByValue(value) : value;
|
|
15469
|
+
if (Array.isArray(this.value) && ((!this.allowObjectBinding && this.value.indexOf(value) < 0) || (this.allowObjectBinding && !this.isObjectInArray(value, this.value)))) {
|
|
15470
|
+
this.setProperties({ value: [].concat([], this.value, this.allowObjectBinding ? [this.virtualSelectAllData[i]] : [value]) }, true);
|
|
15471
|
+
}
|
|
15472
|
+
}
|
|
15473
|
+
}
|
|
15474
|
+
}
|
|
15475
|
+
}
|
|
15476
|
+
}
|
|
15477
|
+
else {
|
|
15478
|
+
while (index < this.value.length && index <= 50 && index < count && this.value.length > 0) {
|
|
15479
|
+
this.removeValue(this.value[index], event, this.value.length - index);
|
|
14204
15480
|
index++;
|
|
14205
15481
|
}
|
|
14206
|
-
|
|
14207
|
-
|
|
14208
|
-
|
|
14209
|
-
|
|
15482
|
+
if (length > 50) {
|
|
15483
|
+
setTimeout(() => {
|
|
15484
|
+
while (index < this.value.length && index < count && this.value.length > 0) {
|
|
15485
|
+
this.removeValue(value[index], event, this.value.length - index);
|
|
15486
|
+
index++;
|
|
15487
|
+
}
|
|
15488
|
+
this.updatedataValueItems(event);
|
|
15489
|
+
if (!this.changeOnBlur) {
|
|
15490
|
+
this.updateValueState(event, this.value, this.tempValues);
|
|
15491
|
+
this.isSelectAll = this.isSelectAll ? !this.isSelectAll : this.isSelectAll;
|
|
15492
|
+
}
|
|
15493
|
+
this.updateHiddenElement();
|
|
15494
|
+
}, 0);
|
|
14210
15495
|
}
|
|
14211
|
-
this.
|
|
14212
|
-
|
|
14213
|
-
|
|
14214
|
-
|
|
14215
|
-
|
|
14216
|
-
|
|
15496
|
+
this.value = [];
|
|
15497
|
+
this.virtualSelectAll = false;
|
|
15498
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
15499
|
+
let ulElement = this.renderItems(this.listData, this.fields);
|
|
15500
|
+
}
|
|
15501
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
15502
|
+
const virtualTrackElement = this.list.getElementsByClassName('e-virtual-ddl')[0];
|
|
15503
|
+
if (virtualTrackElement) {
|
|
15504
|
+
(virtualTrackElement).style = this.GetVirtualTrackHeight();
|
|
15505
|
+
}
|
|
15506
|
+
this.UpdateSkeleton();
|
|
15507
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
15508
|
+
const virtualContentElement = this.list.getElementsByClassName('e-virtual-ddl-content')[0];
|
|
15509
|
+
if (virtualContentElement) {
|
|
15510
|
+
(virtualContentElement).style = this.getTransformValues();
|
|
15511
|
+
}
|
|
15512
|
+
}
|
|
15513
|
+
else {
|
|
15514
|
+
while (index < length && index <= 50 && index < count) {
|
|
15515
|
+
this.isSelectAllTarget = (length === index + 1);
|
|
15516
|
+
this.updateListSelection(li[index], event, length - index);
|
|
15517
|
+
if (this.enableGroupCheckBox) {
|
|
15518
|
+
this.findGroupStart(li[index]);
|
|
14217
15519
|
}
|
|
14218
|
-
|
|
15520
|
+
index++;
|
|
15521
|
+
}
|
|
15522
|
+
if (length > 50) {
|
|
15523
|
+
setTimeout(() => {
|
|
15524
|
+
while (index < length && 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]);
|
|
15529
|
+
}
|
|
15530
|
+
index++;
|
|
15531
|
+
}
|
|
15532
|
+
this.updatedataValueItems(event);
|
|
15533
|
+
if (!this.changeOnBlur) {
|
|
15534
|
+
this.updateValueState(event, this.value, this.tempValues);
|
|
15535
|
+
this.isSelectAll = this.isSelectAll ? !this.isSelectAll : this.isSelectAll;
|
|
15536
|
+
}
|
|
15537
|
+
this.updateHiddenElement();
|
|
15538
|
+
if (this.popupWrapper && li[index - 1].classList.contains('e-item-focus')) {
|
|
15539
|
+
const selectAllParent = document.getElementsByClassName('e-selectall-parent')[0];
|
|
15540
|
+
if (selectAllParent && selectAllParent.classList.contains('e-item-focus')) {
|
|
15541
|
+
li[index - 1].classList.remove('e-item-focus');
|
|
15542
|
+
}
|
|
15543
|
+
}
|
|
15544
|
+
}, 0);
|
|
15545
|
+
}
|
|
14219
15546
|
}
|
|
14220
15547
|
}
|
|
14221
15548
|
else {
|
|
@@ -14223,12 +15550,13 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
14223
15550
|
this.removeHover();
|
|
14224
15551
|
let customVal = li[i].getAttribute('data-value');
|
|
14225
15552
|
let value = this.getFormattedValue(customVal);
|
|
15553
|
+
value = this.allowObjectBinding ? this.getDataByValue(value) : value;
|
|
14226
15554
|
let mainElement = this.mainList ? this.mainList.querySelectorAll(state ?
|
|
14227
15555
|
'li.e-list-item:not([aria-selected="true"]):not(.e-reorder-hide)' :
|
|
14228
15556
|
'li.e-list-item[aria-selected="true"]:not(.e-reorder-hide)')[i] : null;
|
|
14229
15557
|
if (state) {
|
|
14230
15558
|
this.value = !this.value ? [] : this.value;
|
|
14231
|
-
if (this.value.indexOf(value) < 0) {
|
|
15559
|
+
if ((!this.allowObjectBinding && this.value.indexOf(value) < 0) || (this.allowObjectBinding && !this.isObjectInArray(value, this.value))) {
|
|
14232
15560
|
this.setProperties({ value: [].concat([], this.value, [value]) }, true);
|
|
14233
15561
|
}
|
|
14234
15562
|
this.removeFocus();
|
|
@@ -14372,6 +15700,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
14372
15700
|
}
|
|
14373
15701
|
this.selectAllItem(state, event);
|
|
14374
15702
|
}
|
|
15703
|
+
this.virtualSelectAll = false;
|
|
14375
15704
|
}
|
|
14376
15705
|
/**
|
|
14377
15706
|
* Get the properties to be maintained in the persisted state.
|
|
@@ -14538,12 +15867,31 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
14538
15867
|
}
|
|
14539
15868
|
this.renderPopup();
|
|
14540
15869
|
}
|
|
15870
|
+
totalItemsCount() {
|
|
15871
|
+
let dataSourceCount;
|
|
15872
|
+
if (this.dataSource instanceof DataManager) {
|
|
15873
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
15874
|
+
dataSourceCount = this.virtualGroupDataSource && this.virtualGroupDataSource.length ? this.virtualGroupDataSource.length : 0;
|
|
15875
|
+
}
|
|
15876
|
+
else {
|
|
15877
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
15878
|
+
dataSourceCount = this.dataSource && this.dataSource.length ? this.dataSource.length : 0;
|
|
15879
|
+
}
|
|
15880
|
+
if (this.mode === 'CheckBox') {
|
|
15881
|
+
this.totalItemCount = dataSourceCount != 0 ? dataSourceCount : this.totalItemCount;
|
|
15882
|
+
}
|
|
15883
|
+
else {
|
|
15884
|
+
this.totalItemCount = dataSourceCount != 0 ? dataSourceCount - this.value.length : this.totalItemCount;
|
|
15885
|
+
}
|
|
15886
|
+
}
|
|
14541
15887
|
presentItemValue(ulElement) {
|
|
14542
15888
|
let valuecheck = [];
|
|
14543
15889
|
for (let i = 0; i < this.value.length; i++) {
|
|
14544
|
-
|
|
15890
|
+
const value = this.allowObjectBinding ? getValue((this.fields.value) ? this.fields.value : '', this.value[i]) : this.value[i];
|
|
15891
|
+
let checkEle = this.findListElement(((this.allowFiltering && !isNullOrUndefined(this.mainList)) ? this.mainList : ulElement), 'li', 'data-value', value);
|
|
14545
15892
|
if (!checkEle) {
|
|
14546
|
-
|
|
15893
|
+
const checkvalue = this.allowObjectBinding ? this.getDataByValue(this.value[i]) : this.value[i];
|
|
15894
|
+
valuecheck.push(checkvalue);
|
|
14547
15895
|
}
|
|
14548
15896
|
}
|
|
14549
15897
|
return valuecheck;
|
|
@@ -14654,6 +16002,31 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
14654
16002
|
if (this.mode === 'CheckBox' && this.showSelectAll) {
|
|
14655
16003
|
EventHandler.remove(this.popupObj.element, 'click', this.clickHandler);
|
|
14656
16004
|
}
|
|
16005
|
+
if (this.enableVirtualization && this.mode === 'CheckBox') {
|
|
16006
|
+
this.viewPortInfo.startIndex = this.virtualItemStartIndex = 0;
|
|
16007
|
+
this.viewPortInfo.endIndex = this.virtualItemEndIndex = this.viewPortInfo.startIndex > 0 ? this.viewPortInfo.endIndex : this.itemCount;
|
|
16008
|
+
this.previousStartIndex = 0;
|
|
16009
|
+
this.previousEndIndex = 0;
|
|
16010
|
+
}
|
|
16011
|
+
let dataSourceCount;
|
|
16012
|
+
if (this.dataSource instanceof DataManager) {
|
|
16013
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
16014
|
+
dataSourceCount = this.virtualGroupDataSource && this.virtualGroupDataSource.length ? this.virtualGroupDataSource.length : 0;
|
|
16015
|
+
}
|
|
16016
|
+
else {
|
|
16017
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
16018
|
+
dataSourceCount = this.dataSource && this.dataSource.length ? this.dataSource.length : 0;
|
|
16019
|
+
}
|
|
16020
|
+
if (this.enableVirtualization && (this.allowFiltering || this.allowCustomValue) && this.value != null && this.targetElement() && this.totalItemCount !== dataSourceCount) {
|
|
16021
|
+
this.updateInitialData();
|
|
16022
|
+
this.checkAndResetCache();
|
|
16023
|
+
}
|
|
16024
|
+
if (this.virtualCustomData && this.viewPortInfo && this.viewPortInfo.startIndex === 0 && this.viewPortInfo.endIndex === this.itemCount) {
|
|
16025
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
16026
|
+
this.renderItems(this.mainData, this.fields);
|
|
16027
|
+
}
|
|
16028
|
+
this.virtualCustomData = null;
|
|
16029
|
+
this.isVirtualTrackHeight = false;
|
|
14657
16030
|
}
|
|
14658
16031
|
});
|
|
14659
16032
|
}
|
|
@@ -14667,6 +16040,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
14667
16040
|
if (!this.enabled) {
|
|
14668
16041
|
return;
|
|
14669
16042
|
}
|
|
16043
|
+
this.firstItem = this.dataSource && this.dataSource.length > 0 ? this.dataSource[0] : null;
|
|
14670
16044
|
const args = { cancel: false };
|
|
14671
16045
|
this.trigger('beforeOpen', args, (args) => {
|
|
14672
16046
|
if (!args.cancel) {
|
|
@@ -14689,6 +16063,46 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
14689
16063
|
return;
|
|
14690
16064
|
}
|
|
14691
16065
|
this.onPopupShown(e);
|
|
16066
|
+
if (this.enableVirtualization && this.listData && this.listData.length) {
|
|
16067
|
+
if (!isNullOrUndefined(this.value) && (this.getModuleName() === 'dropdownlist' || this.getModuleName() === 'combobox')) {
|
|
16068
|
+
this.removeHover();
|
|
16069
|
+
}
|
|
16070
|
+
if (!this.beforePopupOpen) {
|
|
16071
|
+
if (this.hideSelectedItem && this.value && Array.isArray(this.value) && this.value.length > 0) {
|
|
16072
|
+
this.totalItemsCount();
|
|
16073
|
+
}
|
|
16074
|
+
if (!this.preventSetCurrentData && !isNullOrUndefined(this.viewPortInfo.startIndex) && !isNullOrUndefined(this.viewPortInfo.endIndex)) {
|
|
16075
|
+
this.notify("setCurrentViewDataAsync", {
|
|
16076
|
+
component: this.getModuleName(),
|
|
16077
|
+
module: "VirtualScroll",
|
|
16078
|
+
});
|
|
16079
|
+
}
|
|
16080
|
+
}
|
|
16081
|
+
}
|
|
16082
|
+
if (this.enableVirtualization && !this.allowFiltering && this.selectedValueInfo != null && this.selectedValueInfo.startIndex > 0 && this.value != null) {
|
|
16083
|
+
this.notify("dataProcessAsync", {
|
|
16084
|
+
module: "VirtualScroll",
|
|
16085
|
+
isOpen: true,
|
|
16086
|
+
});
|
|
16087
|
+
}
|
|
16088
|
+
if (this.enableVirtualization) {
|
|
16089
|
+
this.updatevirtualizationList();
|
|
16090
|
+
}
|
|
16091
|
+
else {
|
|
16092
|
+
if (this.value && this.value.length) {
|
|
16093
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
16094
|
+
let element;
|
|
16095
|
+
const listItems = this.getItems();
|
|
16096
|
+
for (const value of this.value) {
|
|
16097
|
+
const checkValue = this.allowObjectBinding ? getValue((this.fields.value) ? this.fields.value : '', value) : value;
|
|
16098
|
+
element = this.getElementByValue(checkValue);
|
|
16099
|
+
if (element) {
|
|
16100
|
+
this.addListSelection(element);
|
|
16101
|
+
}
|
|
16102
|
+
}
|
|
16103
|
+
}
|
|
16104
|
+
}
|
|
16105
|
+
this.preventSetCurrentData = true;
|
|
14692
16106
|
}
|
|
14693
16107
|
});
|
|
14694
16108
|
}
|
|
@@ -14840,6 +16254,13 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
14840
16254
|
this.wireEvent();
|
|
14841
16255
|
this.enable(this.enabled);
|
|
14842
16256
|
this.enableRTL(this.enableRtl);
|
|
16257
|
+
if (this.enableVirtualization) {
|
|
16258
|
+
this.updateVirtualizationProperties(this.itemCount, this.allowFiltering, this.mode === 'CheckBox');
|
|
16259
|
+
}
|
|
16260
|
+
this.listItemHeight = this.getListHeight();
|
|
16261
|
+
this.getSkeletonCount();
|
|
16262
|
+
this.viewPortInfo.startIndex = this.virtualItemStartIndex = 0;
|
|
16263
|
+
this.viewPortInfo.endIndex = this.virtualItemEndIndex = this.viewPortInfo.startIndex > 0 ? this.viewPortInfo.endIndex : this.itemCount;
|
|
14843
16264
|
this.checkInitialValue();
|
|
14844
16265
|
if (this.element.hasAttribute('data-val')) {
|
|
14845
16266
|
this.element.setAttribute('data-val', 'false');
|
|
@@ -14851,6 +16272,22 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
14851
16272
|
}
|
|
14852
16273
|
this.renderComplete();
|
|
14853
16274
|
}
|
|
16275
|
+
getListHeight() {
|
|
16276
|
+
let listParent = this.createElement('div', {
|
|
16277
|
+
className: 'e-dropdownbase'
|
|
16278
|
+
});
|
|
16279
|
+
let item = this.createElement('li', {
|
|
16280
|
+
className: 'e-list-item'
|
|
16281
|
+
});
|
|
16282
|
+
let listParentHeight = formatUnit(this.popupHeight);
|
|
16283
|
+
listParent.style.height = (parseInt(listParentHeight, 10)).toString() + 'px';
|
|
16284
|
+
listParent.appendChild(item);
|
|
16285
|
+
document.body.appendChild(listParent);
|
|
16286
|
+
this.virtualListHeight = listParent.getBoundingClientRect().height;
|
|
16287
|
+
let listItemHeight = Math.ceil(item.getBoundingClientRect().height);
|
|
16288
|
+
listParent.remove();
|
|
16289
|
+
return listItemHeight;
|
|
16290
|
+
}
|
|
14854
16291
|
checkInitialValue() {
|
|
14855
16292
|
const isData = this.dataSource instanceof Array ? (this.dataSource.length > 0)
|
|
14856
16293
|
: !isNullOrUndefined(this.dataSource);
|
|
@@ -14866,7 +16303,8 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
14866
16303
|
const opt = optionsElement[index];
|
|
14867
16304
|
if (!isNullOrUndefined(opt.getAttribute('selected'))) {
|
|
14868
16305
|
if (opt.getAttribute('value')) {
|
|
14869
|
-
|
|
16306
|
+
let value = this.allowObjectBinding ? this.getDataByValue(opt.getAttribute('value')) : opt.getAttribute('value');
|
|
16307
|
+
valueCol.push(value);
|
|
14870
16308
|
}
|
|
14871
16309
|
else {
|
|
14872
16310
|
textCol += (opt.text + this.delimiterChar);
|
|
@@ -14893,14 +16331,40 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
14893
16331
|
this.initialTextUpdate();
|
|
14894
16332
|
}
|
|
14895
16333
|
if (this.value && this.value.length) {
|
|
16334
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
16335
|
+
let listItems;
|
|
16336
|
+
if (this.enableVirtualization) {
|
|
16337
|
+
const fields = (this.fields.value) ? this.fields.value : '';
|
|
16338
|
+
let predicate;
|
|
16339
|
+
for (let i = 0; i < this.value.length; i++) {
|
|
16340
|
+
const value = this.allowObjectBinding ? getValue((this.fields.value) ? this.fields.value : '', this.value[i]) : this.value[i];
|
|
16341
|
+
if (i === 0) {
|
|
16342
|
+
predicate = new Predicate(fields, 'equal', value);
|
|
16343
|
+
}
|
|
16344
|
+
else {
|
|
16345
|
+
predicate = predicate.or(fields, 'equal', value);
|
|
16346
|
+
}
|
|
16347
|
+
}
|
|
16348
|
+
if (this.dataSource instanceof DataManager) {
|
|
16349
|
+
this.dataSource.executeQuery(new Query().where(predicate))
|
|
16350
|
+
.then((e) => {
|
|
16351
|
+
if (e.result.result.length > 0) {
|
|
16352
|
+
listItems = e.result.result;
|
|
16353
|
+
}
|
|
16354
|
+
});
|
|
16355
|
+
}
|
|
16356
|
+
else {
|
|
16357
|
+
listItems = new DataManager(this.dataSource).executeLocal(new Query().where(predicate));
|
|
16358
|
+
}
|
|
16359
|
+
}
|
|
14896
16360
|
if (!(this.dataSource instanceof DataManager)) {
|
|
14897
|
-
this.initialValueUpdate();
|
|
16361
|
+
this.initialValueUpdate(listItems);
|
|
14898
16362
|
this.initialUpdate();
|
|
14899
16363
|
}
|
|
14900
16364
|
else {
|
|
14901
16365
|
this.setInitialValue = () => {
|
|
14902
16366
|
this.initStatus = false;
|
|
14903
|
-
this.initialValueUpdate();
|
|
16367
|
+
this.initialValueUpdate(listItems);
|
|
14904
16368
|
this.initialUpdate();
|
|
14905
16369
|
this.setInitialValue = null;
|
|
14906
16370
|
this.initStatus = true;
|
|
@@ -14922,6 +16386,33 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
14922
16386
|
this.inputElement.focus();
|
|
14923
16387
|
}
|
|
14924
16388
|
}
|
|
16389
|
+
updatevirtualizationList() {
|
|
16390
|
+
if (this.value && this.value.length) {
|
|
16391
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
16392
|
+
let element;
|
|
16393
|
+
const listItems = this.getItems();
|
|
16394
|
+
for (const value of this.value) {
|
|
16395
|
+
const checkValue = this.allowObjectBinding ? getValue((this.fields.value) ? this.fields.value : '', value) : value;
|
|
16396
|
+
element = this.getElementByValue(checkValue);
|
|
16397
|
+
if (element) {
|
|
16398
|
+
this.addListSelection(element);
|
|
16399
|
+
}
|
|
16400
|
+
}
|
|
16401
|
+
if (this.enableVirtualization && this.hideSelectedItem) {
|
|
16402
|
+
let visibleListElements = this.list.querySelectorAll('li.'
|
|
16403
|
+
+ dropDownBaseClasses.li
|
|
16404
|
+
+ ':not(.' + HIDE_LIST + ')' + ':not(.e-reorder-hide)' + ':not(.e-virtual-list)');
|
|
16405
|
+
if (visibleListElements.length) {
|
|
16406
|
+
var actualCount = this.virtualListHeight > 0 ? Math.floor(this.virtualListHeight / this.listItemHeight) : 0;
|
|
16407
|
+
if (visibleListElements.length < (actualCount + 2)) {
|
|
16408
|
+
var query = this.getForQuery(this.value).clone();
|
|
16409
|
+
query = query.skip(this.viewPortInfo.startIndex);
|
|
16410
|
+
this.resetList(this.dataSource, this.fields, query);
|
|
16411
|
+
}
|
|
16412
|
+
}
|
|
16413
|
+
}
|
|
16414
|
+
}
|
|
16415
|
+
}
|
|
14925
16416
|
setFloatLabelType() {
|
|
14926
16417
|
removeFloating(this.overAllWrapper, this.componentWrapper, this.searchWrapper, this.inputElement, this.value, this.floatLabelType, this.placeholder);
|
|
14927
16418
|
if (this.floatLabelType !== 'Never') {
|
|
@@ -14955,6 +16446,8 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
14955
16446
|
if (this.mode !== 'Box' && !(this.setDynValue && this.mode === 'Default' && this.inputFocus)) {
|
|
14956
16447
|
this.updateDelimView();
|
|
14957
16448
|
}
|
|
16449
|
+
this.viewPortInfo.startIndex = this.virtualItemStartIndex = 0;
|
|
16450
|
+
this.viewPortInfo.endIndex = this.virtualItemEndIndex = this.itemCount;
|
|
14958
16451
|
this.updateCssClass();
|
|
14959
16452
|
this.updateHTMLAttribute();
|
|
14960
16453
|
this.updateReadonly(this.readonly);
|
|
@@ -15052,6 +16545,9 @@ __decorate$5([
|
|
|
15052
16545
|
__decorate$5([
|
|
15053
16546
|
Property(true)
|
|
15054
16547
|
], MultiSelect.prototype, "enableHtmlSanitizer", void 0);
|
|
16548
|
+
__decorate$5([
|
|
16549
|
+
Property(false)
|
|
16550
|
+
], MultiSelect.prototype, "enableVirtualization", void 0);
|
|
15055
16551
|
__decorate$5([
|
|
15056
16552
|
Property([])
|
|
15057
16553
|
], MultiSelect.prototype, "dataSource", void 0);
|
|
@@ -15130,6 +16626,9 @@ __decorate$5([
|
|
|
15130
16626
|
__decorate$5([
|
|
15131
16627
|
Property(null)
|
|
15132
16628
|
], MultiSelect.prototype, "value", void 0);
|
|
16629
|
+
__decorate$5([
|
|
16630
|
+
Property(false)
|
|
16631
|
+
], MultiSelect.prototype, "allowObjectBinding", void 0);
|
|
15133
16632
|
__decorate$5([
|
|
15134
16633
|
Property(true)
|
|
15135
16634
|
], MultiSelect.prototype, "hideSelectedItem", void 0);
|
|
@@ -15357,7 +16856,7 @@ class CheckBoxSelection {
|
|
|
15357
16856
|
}
|
|
15358
16857
|
EventHandler.add(this.checkAllParent, 'mousedown', this.clickHandler, this);
|
|
15359
16858
|
}
|
|
15360
|
-
if (this.parent.list.classList.contains('e-nodata') || (this.parent.listData && this.parent.listData.length <= 1 &&
|
|
16859
|
+
if (this.parent.list.classList.contains('e-nodata') || (this.parent.listData && this.parent.listData.length <= 1 && !this.parent.enableVirtualization &&
|
|
15361
16860
|
!(this.parent.isDynamicDataChange)) || (this.parent.isDynamicDataChange &&
|
|
15362
16861
|
this.parent.listData && this.parent.listData.length <= 1)) {
|
|
15363
16862
|
this.checkAllParent.style.display = 'none';
|
|
@@ -15718,7 +17217,13 @@ class CheckBoxSelection {
|
|
|
15718
17217
|
});
|
|
15719
17218
|
remLi = this.parent.ulElement.querySelectorAll('li.e-active');
|
|
15720
17219
|
addClass(remLi, 'e-reorder-hide');
|
|
15721
|
-
|
|
17220
|
+
if (this.parent.enableVirtualization) {
|
|
17221
|
+
var virtualUlElement = this.parent.list.querySelector('.e-virtual-ddl-content');
|
|
17222
|
+
prepend([ulEle], virtualUlElement);
|
|
17223
|
+
}
|
|
17224
|
+
else {
|
|
17225
|
+
prepend([ulEle], this.parent.list);
|
|
17226
|
+
}
|
|
15722
17227
|
}
|
|
15723
17228
|
this.parent.focusAtFirstListItem();
|
|
15724
17229
|
}
|
|
@@ -16091,7 +17596,7 @@ let ListBox = ListBox_1 = class ListBox extends DropDownBase {
|
|
|
16091
17596
|
}
|
|
16092
17597
|
}
|
|
16093
17598
|
this.initWrapper();
|
|
16094
|
-
this.setSelection();
|
|
17599
|
+
this.setSelection(this.value, true, false, !this.isRendered);
|
|
16095
17600
|
this.initDraggable();
|
|
16096
17601
|
this.mainList = this.ulElement;
|
|
16097
17602
|
if (this.initLoad) {
|
|
@@ -17728,7 +19233,7 @@ let ListBox = ListBox_1 = class ListBox extends DropDownBase {
|
|
|
17728
19233
|
});
|
|
17729
19234
|
}
|
|
17730
19235
|
}
|
|
17731
|
-
setSelection(values = this.value, isSelect = true, isText = false) {
|
|
19236
|
+
setSelection(values = this.value, isSelect = true, isText = false, canFocus = true) {
|
|
17732
19237
|
let li;
|
|
17733
19238
|
let liselect;
|
|
17734
19239
|
if (values) {
|
|
@@ -17757,13 +19262,17 @@ let ListBox = ListBox_1 = class ListBox extends DropDownBase {
|
|
|
17757
19262
|
if (!isSelect && liselect || isSelect && !liselect && li) {
|
|
17758
19263
|
if (this.selectionSettings.showCheckbox) {
|
|
17759
19264
|
this.notify('updatelist', { li: li, module: 'listbox' });
|
|
17760
|
-
|
|
19265
|
+
if (canFocus) {
|
|
19266
|
+
li.focus();
|
|
19267
|
+
}
|
|
17761
19268
|
}
|
|
17762
19269
|
else {
|
|
17763
19270
|
if (isSelect) {
|
|
17764
19271
|
li.classList.add(cssClass.selected);
|
|
17765
19272
|
li.setAttribute('aria-selected', 'true');
|
|
17766
|
-
|
|
19273
|
+
if (canFocus) {
|
|
19274
|
+
li.focus();
|
|
19275
|
+
}
|
|
17767
19276
|
}
|
|
17768
19277
|
else {
|
|
17769
19278
|
li.classList.remove(cssClass.selected);
|
|
@@ -18246,6 +19755,8 @@ let Mention = class Mention extends DropDownBase {
|
|
|
18246
19755
|
this.isPopupOpen = false;
|
|
18247
19756
|
this.isCollided = false;
|
|
18248
19757
|
this.lineBreak = false;
|
|
19758
|
+
this.isRTE = false;
|
|
19759
|
+
this.keyEventName = 'mousedown';
|
|
18249
19760
|
}
|
|
18250
19761
|
/**
|
|
18251
19762
|
* Execute before render the list items
|
|
@@ -18291,7 +19802,7 @@ let Mention = class Mention extends DropDownBase {
|
|
|
18291
19802
|
}
|
|
18292
19803
|
bindCommonEvent() {
|
|
18293
19804
|
if (!Browser.isDevice) {
|
|
18294
|
-
this.inputElement.addEventListener('keydown', this.keyDownHandler.bind(this),
|
|
19805
|
+
this.inputElement.addEventListener('keydown', this.keyDownHandler.bind(this), !this.isRTE);
|
|
18295
19806
|
}
|
|
18296
19807
|
}
|
|
18297
19808
|
/**
|
|
@@ -18321,6 +19832,10 @@ let Mention = class Mention extends DropDownBase {
|
|
|
18321
19832
|
return parentElement.querySelector('.e-content');
|
|
18322
19833
|
}
|
|
18323
19834
|
}
|
|
19835
|
+
if (targetElement && targetElement.parentElement && targetElement.parentElement.classList.contains('e-rte-content')) {
|
|
19836
|
+
this.isRTE = true;
|
|
19837
|
+
this.keyEventName = 'click';
|
|
19838
|
+
}
|
|
18324
19839
|
return targetElement;
|
|
18325
19840
|
}
|
|
18326
19841
|
/**
|
|
@@ -18462,7 +19977,7 @@ let Mention = class Mention extends DropDownBase {
|
|
|
18462
19977
|
}
|
|
18463
19978
|
unBindCommonEvent() {
|
|
18464
19979
|
if (!Browser.isDevice) {
|
|
18465
|
-
this.inputElement.removeEventListener('keydown', this.keyDownHandler.bind(this),
|
|
19980
|
+
this.inputElement.removeEventListener('keydown', this.keyDownHandler.bind(this), !this.isRTE);
|
|
18466
19981
|
}
|
|
18467
19982
|
}
|
|
18468
19983
|
onKeyUp(e) {
|
|
@@ -18473,7 +19988,7 @@ let Mention = class Mention extends DropDownBase {
|
|
|
18473
19988
|
}
|
|
18474
19989
|
this.isTyped = e.code !== 'Enter' && e.code !== 'Space' && e.code !== 'ArrowDown' && e.code !== 'ArrowUp' ? true : false;
|
|
18475
19990
|
const isRteImage = document.activeElement.parentElement && document.activeElement.parentElement.querySelector('.e-rte-image') ? true : false;
|
|
18476
|
-
if (document.activeElement != this.inputElement &&
|
|
19991
|
+
if (document.activeElement != this.inputElement && isRteImage) {
|
|
18477
19992
|
this.inputElement.focus();
|
|
18478
19993
|
}
|
|
18479
19994
|
if (this.isContentEditable(this.inputElement)) {
|
|
@@ -18499,9 +20014,9 @@ let Mention = class Mention extends DropDownBase {
|
|
|
18499
20014
|
this.range.startContainer.previousElementSibling && this.range.startContainer.previousElementSibling.tagName !== 'BR' && this.range.startContainer.textContent.split('').length > 0 &&
|
|
18500
20015
|
(rangetextContent.length === 1 || rangetextContent[rangetextContent.length - 2].indexOf('') === -1 ||
|
|
18501
20016
|
this.range.startContainer.nodeType === 1))) {
|
|
18502
|
-
if (this.allowSpaces && currentRange && currentRange.trim() !== '' && charRegex.test(currentRange) && currentRange.indexOf(this.mentionChar) !== -1
|
|
20017
|
+
if (this.isPopupOpen && this.allowSpaces && currentRange && currentRange.trim() !== '' && charRegex.test(currentRange) && currentRange.indexOf(this.mentionChar) !== -1
|
|
18503
20018
|
&& !this.isMatchedText() && (currentRange.length > 1 && currentRange.replace(/\u00A0/g, ' ').charAt(currentRange.length - 2) !== ' ') &&
|
|
18504
|
-
(this.list && this.list.querySelectorAll('ul').length > 0)) {
|
|
20019
|
+
(this.list && this.list.querySelectorAll('ul').length > 0) && e.code !== 'Enter') {
|
|
18505
20020
|
this.queryString = currentRange.substring(currentRange.lastIndexOf(this.mentionChar) + 1).replace('\u00a0', ' ');
|
|
18506
20021
|
this.searchLists(e);
|
|
18507
20022
|
}
|
|
@@ -19002,6 +20517,9 @@ let Mention = class Mention extends DropDownBase {
|
|
|
19002
20517
|
this.popupObj.element.removeAttribute('style');
|
|
19003
20518
|
this.popupObj.element.removeAttribute('aria-disabled');
|
|
19004
20519
|
}
|
|
20520
|
+
if (this.list.classList.contains('e-nodata')) {
|
|
20521
|
+
this.list = null;
|
|
20522
|
+
}
|
|
19005
20523
|
}
|
|
19006
20524
|
onDocumentClick(e) {
|
|
19007
20525
|
const target = e.target;
|
|
@@ -19112,6 +20630,7 @@ let Mention = class Mention extends DropDownBase {
|
|
|
19112
20630
|
return coordinates;
|
|
19113
20631
|
}
|
|
19114
20632
|
initValue() {
|
|
20633
|
+
this.isDataFetched = false;
|
|
19115
20634
|
this.renderList();
|
|
19116
20635
|
if (this.dataSource instanceof DataManager) {
|
|
19117
20636
|
this.initRemoteRender = true;
|
|
@@ -19137,7 +20656,7 @@ let Mention = class Mention extends DropDownBase {
|
|
|
19137
20656
|
* @returns {void}
|
|
19138
20657
|
*/
|
|
19139
20658
|
wireListEvents() {
|
|
19140
|
-
EventHandler.add(this.list,
|
|
20659
|
+
EventHandler.add(this.list, this.keyEventName, this.onMouseClick, this);
|
|
19141
20660
|
EventHandler.add(this.list, 'mouseover', this.onMouseOver, this);
|
|
19142
20661
|
EventHandler.add(this.list, 'mouseout', this.onMouseLeave, this);
|
|
19143
20662
|
}
|
|
@@ -19147,7 +20666,7 @@ let Mention = class Mention extends DropDownBase {
|
|
|
19147
20666
|
* @returns {void}
|
|
19148
20667
|
*/
|
|
19149
20668
|
unWireListEvents() {
|
|
19150
|
-
EventHandler.remove(this.list,
|
|
20669
|
+
EventHandler.remove(this.list, this.keyEventName, this.onMouseClick);
|
|
19151
20670
|
EventHandler.remove(this.list, 'mouseover', this.onMouseOver);
|
|
19152
20671
|
EventHandler.remove(this.list, 'mouseout', this.onMouseLeave);
|
|
19153
20672
|
}
|
|
@@ -19162,7 +20681,9 @@ let Mention = class Mention extends DropDownBase {
|
|
|
19162
20681
|
const delay = 100;
|
|
19163
20682
|
this.closePopup(delay, e);
|
|
19164
20683
|
this.inputElement.focus();
|
|
19165
|
-
|
|
20684
|
+
if (!this.isRTE) {
|
|
20685
|
+
e.preventDefault();
|
|
20686
|
+
}
|
|
19166
20687
|
}
|
|
19167
20688
|
updateSelectedItem(li, e, preventSelect, isSelection) {
|
|
19168
20689
|
this.removeSelection();
|
|
@@ -19402,7 +20923,7 @@ let Mention = class Mention extends DropDownBase {
|
|
|
19402
20923
|
if (this.isPopupOpen) {
|
|
19403
20924
|
this.hidePopup();
|
|
19404
20925
|
}
|
|
19405
|
-
//New event to update the RichTextEditor value, when a mention item is selected using mouse click action.
|
|
20926
|
+
//New event to update the RichTextEditor value, when a mention item is selected using mouse click action.
|
|
19406
20927
|
if (!isNullOrUndefined(e.pointerType) && e.pointerType === 'mouse') {
|
|
19407
20928
|
const event = new CustomEvent('content-changed', { detail: { click: true } });
|
|
19408
20929
|
this.inputElement.dispatchEvent(event);
|