@syncfusion/ej2-dropdowns 35.1.46 → 35.2.12
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/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 +246 -83
- package/dist/es6/ej2-dropdowns.es2015.js.map +1 -1
- package/dist/es6/ej2-dropdowns.es5.js +247 -83
- 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 +8 -8
- package/src/drop-down-base/drop-down-base.js +5 -1
- package/src/drop-down-list/drop-down-list.d.ts +4 -0
- package/src/drop-down-list/drop-down-list.js +46 -0
- package/src/multi-select/multi-select.d.ts +2 -0
- package/src/multi-select/multi-select.js +196 -82
package/dist/global/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* filename: index.d.ts
|
|
3
|
-
* version : 35.
|
|
3
|
+
* version : 35.2.12
|
|
4
4
|
* Copyright Syncfusion Inc. 2001 - 2025. All rights reserved.
|
|
5
5
|
* Use of this code is subject to the terms of our license.
|
|
6
6
|
* A copy of the current license can be obtained at any time by e-mailing
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@syncfusion/ej2-dropdowns",
|
|
3
|
-
"version": "35.
|
|
3
|
+
"version": "35.2.12",
|
|
4
4
|
"description": "Essential JS 2 DropDown Components",
|
|
5
5
|
"author": "Syncfusion Inc.",
|
|
6
6
|
"license": "SEE LICENSE IN license",
|
|
@@ -8,13 +8,13 @@
|
|
|
8
8
|
"module": "./index.js",
|
|
9
9
|
"es2015": "./dist/es6/ej2-dropdowns.es5.js",
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@syncfusion/ej2-base": "~35.
|
|
12
|
-
"@syncfusion/ej2-data": "~35.
|
|
13
|
-
"@syncfusion/ej2-inputs": "~35.
|
|
14
|
-
"@syncfusion/ej2-lists": "~35.
|
|
15
|
-
"@syncfusion/ej2-navigations": "~35.
|
|
16
|
-
"@syncfusion/ej2-notifications": "~35.
|
|
17
|
-
"@syncfusion/ej2-popups": "~35.
|
|
11
|
+
"@syncfusion/ej2-base": "~35.2.12",
|
|
12
|
+
"@syncfusion/ej2-data": "~35.2.12",
|
|
13
|
+
"@syncfusion/ej2-inputs": "~35.2.12",
|
|
14
|
+
"@syncfusion/ej2-lists": "~35.2.12",
|
|
15
|
+
"@syncfusion/ej2-navigations": "~35.2.12",
|
|
16
|
+
"@syncfusion/ej2-notifications": "~35.2.12",
|
|
17
|
+
"@syncfusion/ej2-popups": "~35.2.12"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {},
|
|
20
20
|
"keywords": [
|
|
@@ -558,6 +558,9 @@ var DropDownBase = /** @class */ (function (_super) {
|
|
|
558
558
|
return 'drop-down-base';
|
|
559
559
|
};
|
|
560
560
|
DropDownBase.prototype.getTextByValue = function (value) {
|
|
561
|
+
if (this.getModuleName() === 'multiselect' && (value === null || value === undefined)) {
|
|
562
|
+
return 'null';
|
|
563
|
+
}
|
|
561
564
|
var text = this.checkValueCase(value, false, false, true);
|
|
562
565
|
return text;
|
|
563
566
|
};
|
|
@@ -2257,7 +2260,8 @@ var DropDownBase = /** @class */ (function (_super) {
|
|
|
2257
2260
|
if (type === 'string' || type === 'number' || type === 'boolean') {
|
|
2258
2261
|
for (var _i = 0, _a = this.listData; _i < _a.length; _i++) {
|
|
2259
2262
|
var item = _a[_i];
|
|
2260
|
-
if (
|
|
2263
|
+
if (((this.getModuleName() === 'multiselect') && item === value) ||
|
|
2264
|
+
((this.getModuleName() !== 'multiselect') && !isNullOrUndefined(item) && item === value)) {
|
|
2261
2265
|
return item;
|
|
2262
2266
|
}
|
|
2263
2267
|
}
|
|
@@ -136,6 +136,8 @@ export declare class DropDownList extends DropDownBase implements IInput {
|
|
|
136
136
|
private isUpdateFooterHeight;
|
|
137
137
|
private filterArgs;
|
|
138
138
|
private isReactTemplateUpdate;
|
|
139
|
+
private popupPositionObserver;
|
|
140
|
+
private popupPositionRefreshTimer;
|
|
139
141
|
private iOSscrollPosition;
|
|
140
142
|
private resizeHandler;
|
|
141
143
|
/**
|
|
@@ -632,6 +634,8 @@ export declare class DropDownList extends DropDownBase implements IInput {
|
|
|
632
634
|
private setEleWidth;
|
|
633
635
|
private closePopup;
|
|
634
636
|
private updateInitialData;
|
|
637
|
+
private setupPopupPositionObserver;
|
|
638
|
+
private destroyPopupPositionObserver;
|
|
635
639
|
private destroyPopup;
|
|
636
640
|
private clickOnBackIcon;
|
|
637
641
|
/**
|
|
@@ -97,6 +97,8 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
97
97
|
_this.isUpdateHeaderHeight = false;
|
|
98
98
|
_this.isUpdateFooterHeight = false;
|
|
99
99
|
_this.isReactTemplateUpdate = false;
|
|
100
|
+
_this.popupPositionObserver = null;
|
|
101
|
+
_this.popupPositionRefreshTimer = null;
|
|
100
102
|
return _this;
|
|
101
103
|
}
|
|
102
104
|
/**
|
|
@@ -2983,6 +2985,7 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
2983
2985
|
if (!isNullOrUndefined(_this.popupObj)) {
|
|
2984
2986
|
_this.popupObj.show(new Animation(eventArgs.animation), (_this.zIndex === 1000) ? _this.element : null);
|
|
2985
2987
|
_this.isPopupRender = true;
|
|
2988
|
+
_this.setupPopupPositionObserver();
|
|
2986
2989
|
}
|
|
2987
2990
|
if (_this.isReact) {
|
|
2988
2991
|
setTimeout(function () {
|
|
@@ -3653,10 +3656,51 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
3653
3656
|
}
|
|
3654
3657
|
ulElement = null;
|
|
3655
3658
|
};
|
|
3659
|
+
DropDownList.prototype.setupPopupPositionObserver = function () {
|
|
3660
|
+
var _this = this;
|
|
3661
|
+
if (!this.isAngular) {
|
|
3662
|
+
return;
|
|
3663
|
+
}
|
|
3664
|
+
if (!isNullOrUndefined(this.popupPositionObserver)) {
|
|
3665
|
+
this.popupPositionObserver.disconnect();
|
|
3666
|
+
}
|
|
3667
|
+
var observerTarget = this.inputWrapper && this.inputWrapper.container
|
|
3668
|
+
? this.inputWrapper.container.parentElement
|
|
3669
|
+
: this.element.parentElement;
|
|
3670
|
+
if (isNullOrUndefined(observerTarget)) {
|
|
3671
|
+
return;
|
|
3672
|
+
}
|
|
3673
|
+
this.popupPositionObserver = new MutationObserver(function () {
|
|
3674
|
+
clearTimeout(_this.popupPositionRefreshTimer);
|
|
3675
|
+
_this.popupPositionRefreshTimer = setTimeout(function () {
|
|
3676
|
+
if (!isNullOrUndefined(_this.popupObj) &&
|
|
3677
|
+
!isNullOrUndefined(_this.inputWrapper)) {
|
|
3678
|
+
_this.popupObj.refreshPosition(_this.inputWrapper.container);
|
|
3679
|
+
}
|
|
3680
|
+
}, 0);
|
|
3681
|
+
});
|
|
3682
|
+
this.popupPositionObserver.observe(observerTarget, {
|
|
3683
|
+
childList: true,
|
|
3684
|
+
subtree: true,
|
|
3685
|
+
attributes: true,
|
|
3686
|
+
attributeFilter: ['style', 'class']
|
|
3687
|
+
});
|
|
3688
|
+
};
|
|
3689
|
+
DropDownList.prototype.destroyPopupPositionObserver = function () {
|
|
3690
|
+
if (this.popupPositionRefreshTimer) {
|
|
3691
|
+
clearTimeout(this.popupPositionRefreshTimer);
|
|
3692
|
+
this.popupPositionRefreshTimer = null;
|
|
3693
|
+
}
|
|
3694
|
+
if (this.popupPositionObserver) {
|
|
3695
|
+
this.popupPositionObserver.disconnect();
|
|
3696
|
+
this.popupPositionObserver = null;
|
|
3697
|
+
}
|
|
3698
|
+
};
|
|
3656
3699
|
DropDownList.prototype.destroyPopup = function () {
|
|
3657
3700
|
this.isPopupOpen = false;
|
|
3658
3701
|
this.isFilterFocus = false;
|
|
3659
3702
|
this.inputElement.removeAttribute('aria-controls');
|
|
3703
|
+
this.destroyPopupPositionObserver();
|
|
3660
3704
|
if (this.popupObj) {
|
|
3661
3705
|
if (this.resizer) {
|
|
3662
3706
|
EventHandler.remove(this.resizer, 'mousedown', this.startResizing);
|
|
@@ -4563,6 +4607,7 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
4563
4607
|
*/
|
|
4564
4608
|
DropDownList.prototype.hidePopup = function (e) {
|
|
4565
4609
|
/* eslint-enable valid-jsdoc, jsdoc/require-param */
|
|
4610
|
+
this.destroyPopupPositionObserver();
|
|
4566
4611
|
if (this.isEscapeKey && this.getModuleName() === 'dropdownlist') {
|
|
4567
4612
|
if (!isNullOrUndefined(this.inputElement)) {
|
|
4568
4613
|
Input.setValue(this.text, this.inputElement, this.floatLabelType, this.showClearButton);
|
|
@@ -4716,6 +4761,7 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
4716
4761
|
* @returns {void}
|
|
4717
4762
|
*/
|
|
4718
4763
|
DropDownList.prototype.destroy = function () {
|
|
4764
|
+
this.destroyPopupPositionObserver();
|
|
4719
4765
|
this.isActive = false;
|
|
4720
4766
|
this.isStaleFilter = false;
|
|
4721
4767
|
this.filterGeneration = null;
|
|
@@ -855,6 +855,8 @@ export declare class MultiSelect extends DropDownBase implements IInput {
|
|
|
855
855
|
private initialTextUpdate;
|
|
856
856
|
protected renderList(isEmptyData?: boolean): void;
|
|
857
857
|
private getTextByValueFromDataSource;
|
|
858
|
+
private isValueOnlyNull;
|
|
859
|
+
protected getTextByValue(value: string | number | boolean): string;
|
|
858
860
|
private initialValueUpdate;
|
|
859
861
|
protected updateActionCompleteData(li: HTMLElement, item: {
|
|
860
862
|
[key: string]: Object;
|
|
@@ -46,6 +46,7 @@ var CHIP_CLOSE = 'e-chips-close';
|
|
|
46
46
|
var CHIP_SELECTED = 'e-chip-selected';
|
|
47
47
|
var SEARCHBOX_WRAPPER = 'e-searcher';
|
|
48
48
|
var DELIMITER_VIEW_WRAPPER = 'e-delimiter';
|
|
49
|
+
var NULL_CHIP = 'e-chip-null';
|
|
49
50
|
var ZERO_SIZE = 'e-zero-size';
|
|
50
51
|
var REMAIN_WRAPPER = 'e-remain';
|
|
51
52
|
var CLOSEICON_CLASS = 'e-chips-close e-close-hooker';
|
|
@@ -510,16 +511,24 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
510
511
|
return;
|
|
511
512
|
}
|
|
512
513
|
var elements = this.chipCollectionWrapper.querySelectorAll('span.' + CHIP);
|
|
513
|
-
var
|
|
514
|
+
var lastElement = elements[elements.length - 1];
|
|
515
|
+
var isNullChip = lastElement.classList.contains(NULL_CHIP);
|
|
516
|
+
var customValue = null;
|
|
514
517
|
if (!isNullOrUndefined(this.value)) {
|
|
515
518
|
this.tempValues = this.allowObjectBinding ? this.value.slice() : this.value.slice();
|
|
516
519
|
}
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
customValue =
|
|
520
|
+
if (isNullChip) {
|
|
521
|
+
customValue = null;
|
|
522
|
+
}
|
|
523
|
+
else {
|
|
524
|
+
var value = lastElement.getAttribute('data-value');
|
|
525
|
+
customValue = this.allowObjectBinding ? this.enableVirtualization ?
|
|
526
|
+
this.getVirtualDataByValue(this.getFormattedValue(value)) :
|
|
527
|
+
this.getDataByValue(this.getFormattedValue(value)) : this.getFormattedValue(value);
|
|
528
|
+
if (this.allowCustomValue && (value !== 'false' && customValue === false || (!isNullOrUndefined(customValue) &&
|
|
529
|
+
customValue.toString() === 'NaN'))) {
|
|
530
|
+
customValue = value;
|
|
531
|
+
}
|
|
523
532
|
}
|
|
524
533
|
this.removeValue(customValue, e);
|
|
525
534
|
this.removeChipSelection();
|
|
@@ -860,48 +869,54 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
860
869
|
HIDE_LIST :
|
|
861
870
|
dropDownBaseClasses.selected;
|
|
862
871
|
if (!isNullOrUndefined(this.value)) {
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
addClass([element
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
removeClass([element], dropDownBaseClasses.focus);
|
|
880
|
-
var listEle = element.parentElement.querySelectorAll('.' +
|
|
881
|
-
dropDownBaseClasses.li + ':not(.' + HIDE_LIST + ')' + ':not(.' + DISABLED + ')');
|
|
882
|
-
if (listEle.length > 0) {
|
|
883
|
-
addClass([listEle[0]], dropDownBaseClasses.focus);
|
|
884
|
-
this.updateAriaActiveDescendant();
|
|
872
|
+
var isOnlyNull = this.isValueOnlyNull();
|
|
873
|
+
if (!isOnlyNull) {
|
|
874
|
+
for (var index = 0; index < this.value.length; index++) {
|
|
875
|
+
value = this.allowObjectBinding ? getValue((this.fields.value) ? this.fields.value : '', this.value[index]) :
|
|
876
|
+
this.value[index];
|
|
877
|
+
if (isNullOrUndefined(value)) {
|
|
878
|
+
continue;
|
|
879
|
+
}
|
|
880
|
+
element = this.findListElement(this.list, 'li', 'data-value', value);
|
|
881
|
+
if (element) {
|
|
882
|
+
addClass([element], className);
|
|
883
|
+
if (this.hideSelectedItem && element.previousSibling
|
|
884
|
+
&& element.previousElementSibling.classList.contains(dropDownBaseClasses.group)
|
|
885
|
+
&& (!element.nextElementSibling ||
|
|
886
|
+
element.nextElementSibling.classList.contains(dropDownBaseClasses.group))) {
|
|
887
|
+
addClass([element.previousElementSibling], className);
|
|
885
888
|
}
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
889
|
+
if (this.hideSelectedItem && this.fields.groupBy && !element.previousElementSibling.classList.contains(HIDE_LIST)) {
|
|
890
|
+
this.hideGroupItem(value);
|
|
891
|
+
}
|
|
892
|
+
if (this.hideSelectedItem && element.classList.contains(dropDownBaseClasses.focus)) {
|
|
893
|
+
removeClass([element], dropDownBaseClasses.focus);
|
|
894
|
+
var listEle = element.parentElement.querySelectorAll('.' +
|
|
895
|
+
dropDownBaseClasses.li + ':not(.' + HIDE_LIST + ')' + ':not(.' + DISABLED + ')');
|
|
896
|
+
if (listEle.length > 0) {
|
|
897
|
+
addClass([listEle[0]], dropDownBaseClasses.focus);
|
|
898
|
+
this.updateAriaActiveDescendant();
|
|
899
|
+
}
|
|
900
|
+
else {
|
|
901
|
+
//EJ2-57588 - for this task, we prevent the ul element cloning ( this.ulElement = this.ulElement.cloneNode ? <HTMLElement>this.ulElement.cloneNode(true) : this.ulElement;)
|
|
902
|
+
if (!(this.list && this.list.querySelectorAll('.' + dropDownBaseClasses.li).length > 0)) {
|
|
903
|
+
this.l10nUpdate();
|
|
904
|
+
addClass([this.list], dropDownBaseClasses.noData);
|
|
905
|
+
}
|
|
891
906
|
}
|
|
892
907
|
}
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
908
|
+
element.setAttribute('aria-selected', 'true');
|
|
909
|
+
if (this.mode === 'CheckBox' && element.classList.contains('e-active')) {
|
|
910
|
+
var ariaValue = element.getElementsByClassName('e-check').length;
|
|
911
|
+
if (ariaValue === 0) {
|
|
912
|
+
var args = {
|
|
913
|
+
module: 'CheckBoxSelection',
|
|
914
|
+
enable: this.mode === 'CheckBox',
|
|
915
|
+
li: element,
|
|
916
|
+
e: null
|
|
917
|
+
};
|
|
918
|
+
this.notify('updatelist', args);
|
|
919
|
+
}
|
|
905
920
|
}
|
|
906
921
|
}
|
|
907
922
|
}
|
|
@@ -1692,13 +1707,26 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
1692
1707
|
var activeItem = !isNullOrUndefined(this.ulElement)
|
|
1693
1708
|
? this.ulElement.getElementsByClassName('e-item-focus')[0]
|
|
1694
1709
|
: null;
|
|
1710
|
+
var filterInput = this.allowFiltering && !isNullOrUndefined(this.popupWrapper)
|
|
1711
|
+
? this.popupWrapper.querySelector('.' + FILTERINPUT)
|
|
1712
|
+
: null;
|
|
1695
1713
|
if (!isNullOrUndefined(activeItem) && this.isPopupOpen()) {
|
|
1696
1714
|
attributes(this.inputElement, {
|
|
1697
1715
|
'aria-activedescendant': activeItem.id
|
|
1698
1716
|
});
|
|
1717
|
+
if (filterInput) {
|
|
1718
|
+
attributes(filterInput, {
|
|
1719
|
+
'aria-activedescendant': activeItem.id
|
|
1720
|
+
});
|
|
1721
|
+
}
|
|
1699
1722
|
}
|
|
1700
|
-
else
|
|
1701
|
-
this.inputElement
|
|
1723
|
+
else {
|
|
1724
|
+
if (!isNullOrUndefined(this.inputElement)) {
|
|
1725
|
+
this.inputElement.removeAttribute('aria-activedescendant');
|
|
1726
|
+
}
|
|
1727
|
+
if (filterInput) {
|
|
1728
|
+
filterInput.removeAttribute('aria-activedescendant');
|
|
1729
|
+
}
|
|
1702
1730
|
}
|
|
1703
1731
|
};
|
|
1704
1732
|
MultiSelect.prototype.pageUpSelection = function (steps, isVirtualKeyAction) {
|
|
@@ -2529,9 +2557,16 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
2529
2557
|
this.removeChipSelection();
|
|
2530
2558
|
this.addChipSelection(temp, e);
|
|
2531
2559
|
}
|
|
2532
|
-
var
|
|
2533
|
-
|
|
2534
|
-
|
|
2560
|
+
var isNullChip = selectedElem.classList.contains(NULL_CHIP);
|
|
2561
|
+
var currentChip = void 0;
|
|
2562
|
+
if (isNullChip) {
|
|
2563
|
+
currentChip = null;
|
|
2564
|
+
}
|
|
2565
|
+
else {
|
|
2566
|
+
currentChip = this.allowObjectBinding ?
|
|
2567
|
+
this.getDataByValue(this.getFormattedValue(selectedElem.getAttribute('data-value'))) :
|
|
2568
|
+
selectedElem.getAttribute('data-value');
|
|
2569
|
+
}
|
|
2535
2570
|
this.removeValue(currentChip, e);
|
|
2536
2571
|
this.updateDelimeter(this.delimiterChar, e);
|
|
2537
2572
|
this.makeTextBoxEmpty();
|
|
@@ -2789,7 +2824,7 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
2789
2824
|
if (type === 'string' || type === 'number' || type === 'boolean') {
|
|
2790
2825
|
for (var _i = 0, _a = this.selectedListData; _i < _a.length; _i++) {
|
|
2791
2826
|
var item = _a[_i];
|
|
2792
|
-
if (
|
|
2827
|
+
if (item === value || (isNullOrUndefined(item) && value === null)) {
|
|
2793
2828
|
return item;
|
|
2794
2829
|
}
|
|
2795
2830
|
}
|
|
@@ -2797,8 +2832,11 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
2797
2832
|
else {
|
|
2798
2833
|
for (var _b = 0, _c = this.selectedListData; _b < _c.length; _b++) {
|
|
2799
2834
|
var item = _c[_b];
|
|
2800
|
-
if (
|
|
2801
|
-
|
|
2835
|
+
if (item !== undefined) {
|
|
2836
|
+
var itemValue = getValue((this.fields.value ? this.fields.value : 'value'), item);
|
|
2837
|
+
if (itemValue === value || (isNullOrUndefined(itemValue) && value === null)) {
|
|
2838
|
+
return item;
|
|
2839
|
+
}
|
|
2802
2840
|
}
|
|
2803
2841
|
}
|
|
2804
2842
|
}
|
|
@@ -2811,13 +2849,21 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
2811
2849
|
}
|
|
2812
2850
|
if (this.enabled && !this.readonly) {
|
|
2813
2851
|
var element = e.target.parentElement;
|
|
2814
|
-
var
|
|
2815
|
-
var value =
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2852
|
+
var isNullChip = element.classList.contains(NULL_CHIP);
|
|
2853
|
+
var value = void 0;
|
|
2854
|
+
if (isNullChip) {
|
|
2855
|
+
value = null;
|
|
2856
|
+
}
|
|
2857
|
+
else {
|
|
2858
|
+
var customVal = element.getAttribute('data-value');
|
|
2859
|
+
var formattedVal = this.getFormattedValue(customVal);
|
|
2860
|
+
value = this.allowObjectBinding ? this.enableVirtualization ?
|
|
2861
|
+
this.getVirtualDataByValue(formattedVal) :
|
|
2862
|
+
this.getDataByValue(formattedVal) : formattedVal;
|
|
2863
|
+
if (this.allowCustomValue && ((customVal !== 'false' && value === false) ||
|
|
2864
|
+
(!isNullOrUndefined(value) && value.toString() === 'NaN'))) {
|
|
2865
|
+
value = customVal;
|
|
2866
|
+
}
|
|
2821
2867
|
}
|
|
2822
2868
|
if (this.isPopupOpen() && this.mode !== 'CheckBox') {
|
|
2823
2869
|
this.hidePopup(e);
|
|
@@ -2826,6 +2872,14 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
2826
2872
|
this.inputElement.focus();
|
|
2827
2873
|
}
|
|
2828
2874
|
this.removeValue(value, e);
|
|
2875
|
+
if (!isNullChip) {
|
|
2876
|
+
var findValue = this.allowObjectBinding ? getValue((this.fields.value) ? this.fields.value : '', value) : value;
|
|
2877
|
+
if (isNullOrUndefined(this.findListElement(this.list, 'li', 'data-value', findValue)) &&
|
|
2878
|
+
this.mainList && this.listData) {
|
|
2879
|
+
var list = this.mainList.cloneNode ? this.mainList.cloneNode(true) : this.mainList;
|
|
2880
|
+
this.onActionComplete(list, this.mainData);
|
|
2881
|
+
}
|
|
2882
|
+
}
|
|
2829
2883
|
value = this.allowObjectBinding ? getValue((this.fields.value) ? this.fields.value : '', value) : value;
|
|
2830
2884
|
if (isNullOrUndefined(this.findListElement(this.list, 'li', 'data-value', value)) &&
|
|
2831
2885
|
this.mainList && this.listData) {
|
|
@@ -2904,8 +2958,17 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
2904
2958
|
};
|
|
2905
2959
|
MultiSelect.prototype.removeValue = function (value, eve, length, isClearAll) {
|
|
2906
2960
|
var _this = this;
|
|
2907
|
-
var index =
|
|
2908
|
-
|
|
2961
|
+
var index = -1;
|
|
2962
|
+
if (value === null) {
|
|
2963
|
+
index = this.value.indexOf(null);
|
|
2964
|
+
}
|
|
2965
|
+
else if (this.allowObjectBinding) {
|
|
2966
|
+
index = this.indexOfObjectInArray(value, this.value);
|
|
2967
|
+
}
|
|
2968
|
+
else {
|
|
2969
|
+
var formattedValue = this.getFormattedValue(value);
|
|
2970
|
+
index = this.value.indexOf(formattedValue);
|
|
2971
|
+
}
|
|
2909
2972
|
if (index === -1 && this.allowCustomValue && !isNullOrUndefined(value)) {
|
|
2910
2973
|
index = this.allowObjectBinding ? this.indexOfObjectInArray(value, this.value) :
|
|
2911
2974
|
this.value.indexOf(value.toString());
|
|
@@ -3091,7 +3154,13 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
3091
3154
|
MultiSelect.prototype.removeChip = function (value, isClearAll) {
|
|
3092
3155
|
if (this.chipCollectionWrapper) {
|
|
3093
3156
|
if (!(this.enableVirtualization && isClearAll)) {
|
|
3094
|
-
var element =
|
|
3157
|
+
var element = void 0;
|
|
3158
|
+
if (value === null) {
|
|
3159
|
+
element = this.chipCollectionWrapper.querySelector('span.' + NULL_CHIP);
|
|
3160
|
+
}
|
|
3161
|
+
else {
|
|
3162
|
+
element = this.findListElement(this.chipCollectionWrapper, 'span', 'data-value', value);
|
|
3163
|
+
}
|
|
3095
3164
|
if (element) {
|
|
3096
3165
|
remove(element);
|
|
3097
3166
|
}
|
|
@@ -3109,7 +3178,8 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
3109
3178
|
}
|
|
3110
3179
|
};
|
|
3111
3180
|
MultiSelect.prototype.updateChipStatus = function () {
|
|
3112
|
-
|
|
3181
|
+
var showChips = this.value && this.value.length && !this.isValueOnlyNull();
|
|
3182
|
+
if (showChips) {
|
|
3113
3183
|
if (!isNullOrUndefined(this.chipCollectionWrapper)) {
|
|
3114
3184
|
(this.chipCollectionWrapper.style.display = '');
|
|
3115
3185
|
}
|
|
@@ -3343,10 +3413,21 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
3343
3413
|
MultiSelect.prototype.getChip = function (data, value, e) {
|
|
3344
3414
|
var _this = this;
|
|
3345
3415
|
var itemData = { text: value, value: value };
|
|
3416
|
+
var isNullValue = value === null;
|
|
3417
|
+
var chipAttrs = { 'title': data, 'role': 'option', 'aria-selected': 'true' };
|
|
3418
|
+
if (isNullValue) {
|
|
3419
|
+
chipAttrs['data-value'] = 'null';
|
|
3420
|
+
}
|
|
3421
|
+
else {
|
|
3422
|
+
chipAttrs['data-value'] = value;
|
|
3423
|
+
}
|
|
3346
3424
|
var chip = this.createElement('span', {
|
|
3347
|
-
className: CHIP,
|
|
3348
|
-
attrs:
|
|
3425
|
+
className: CHIP + (isNullValue ? ' ' + NULL_CHIP : ''),
|
|
3426
|
+
attrs: chipAttrs
|
|
3349
3427
|
});
|
|
3428
|
+
if (isNullValue) {
|
|
3429
|
+
addClass([chip], NULL_CHIP);
|
|
3430
|
+
}
|
|
3350
3431
|
var compiledString;
|
|
3351
3432
|
var chipContent = this.createElement('span', { className: CHIP_CONTENT });
|
|
3352
3433
|
var chipClose = this.createElement('span', { className: CHIP_CLOSE, attrs: { 'aria-hidden': 'true' } });
|
|
@@ -3368,7 +3449,8 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
3368
3449
|
this.renderReactTemplates();
|
|
3369
3450
|
}
|
|
3370
3451
|
else if (this.enableHtmlSanitizer) {
|
|
3371
|
-
|
|
3452
|
+
var displayText = (data === 'null' || data === 'undefined') ? 'null' : data;
|
|
3453
|
+
chipContent.innerText = displayText;
|
|
3372
3454
|
}
|
|
3373
3455
|
else {
|
|
3374
3456
|
chipContent.innerHTML = this.encodeHtmlEntities(data.toString());
|
|
@@ -4173,6 +4255,9 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
4173
4255
|
var value = this_1.allowObjectBinding ?
|
|
4174
4256
|
getValue(((this_1.fields.value) ? this_1.fields.value : ''), this_1.value[this_1.value.length - 1]) :
|
|
4175
4257
|
this_1.value[this_1.value.length - 1];
|
|
4258
|
+
if (value === null && this_1.value.length === 1) {
|
|
4259
|
+
return out_index_1 = index, "break";
|
|
4260
|
+
}
|
|
4176
4261
|
if (this_1.isRemoveSelection && this_1.text) {
|
|
4177
4262
|
data = this_1.text.replace(/,/g, delimiterChar + ' ') + delimiterChar + ' ';
|
|
4178
4263
|
text = this_1.text.split(delimiterChar);
|
|
@@ -4318,6 +4403,18 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
4318
4403
|
}
|
|
4319
4404
|
return null;
|
|
4320
4405
|
};
|
|
4406
|
+
MultiSelect.prototype.isValueOnlyNull = function () {
|
|
4407
|
+
if (!this.value || this.value.length === 0) {
|
|
4408
|
+
return false;
|
|
4409
|
+
}
|
|
4410
|
+
return this.value.every(function (v) { return v === null || v === undefined; });
|
|
4411
|
+
};
|
|
4412
|
+
MultiSelect.prototype.getTextByValue = function (value) {
|
|
4413
|
+
if (value === null || value === undefined) {
|
|
4414
|
+
return 'null';
|
|
4415
|
+
}
|
|
4416
|
+
return _super.prototype.getTextByValue.call(this, value);
|
|
4417
|
+
};
|
|
4321
4418
|
MultiSelect.prototype.initialValueUpdate = function (listItems, isInitialVirtualData, isInitialRender) {
|
|
4322
4419
|
var _this = this;
|
|
4323
4420
|
if (this.list) {
|
|
@@ -4330,7 +4427,10 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
4330
4427
|
this.removeListSelection();
|
|
4331
4428
|
var formElement = closest(this.inputElement, 'form');
|
|
4332
4429
|
if (!isNullOrUndefined(this.value)) {
|
|
4333
|
-
for (var index = 0;
|
|
4430
|
+
for (var index = 0; index < this.value.length; index++) {
|
|
4431
|
+
if (this.isValueOnlyNull()) {
|
|
4432
|
+
continue;
|
|
4433
|
+
}
|
|
4334
4434
|
value_2 = this.allowObjectBinding ?
|
|
4335
4435
|
getValue(((this.fields.value) ? this.fields.value : ''), this.value[index]) :
|
|
4336
4436
|
this.value[index];
|
|
@@ -4382,10 +4482,15 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
4382
4482
|
((!(this.dataSource instanceof DataManager)) ||
|
|
4383
4483
|
(this.dataSource instanceof DataManager && isInitialVirtualData)) && (!this.isAngular || !isInitialRender ||
|
|
4384
4484
|
(isNullOrUndefined(formElement) && listItems && listItems.length > 0))
|
|
4385
|
-
&& !(this.mode === 'CheckBox' && this.enableVirtualization && this.value.length > this.getSummaryTagThreshold())
|
|
4485
|
+
&& !(this.mode === 'CheckBox' && this.enableVirtualization && this.value.length > this.getSummaryTagThreshold())
|
|
4486
|
+
&& value_2 !== null) {
|
|
4386
4487
|
this.value.splice(index, 1);
|
|
4387
4488
|
index -= 1;
|
|
4388
4489
|
}
|
|
4490
|
+
if (value_2 === null && isNullOrUndefined(text)) {
|
|
4491
|
+
text = this.getTextByValue(value_2);
|
|
4492
|
+
isCustomData = true;
|
|
4493
|
+
}
|
|
4389
4494
|
}
|
|
4390
4495
|
else {
|
|
4391
4496
|
text = this.getTextByValue(value_2);
|
|
@@ -4396,20 +4501,23 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
4396
4501
|
this.listData = savedListData;
|
|
4397
4502
|
}
|
|
4398
4503
|
}
|
|
4399
|
-
|
|
4504
|
+
var shouldDisplayNull = (value_2 === null && this.value.length > 1);
|
|
4505
|
+
var shouldProcessElement = ((element && (element.getAttribute('aria-selected') !== 'true')) ||
|
|
4400
4506
|
(element && (element.getAttribute('aria-selected') === 'true' && this.hideSelectedItem) &&
|
|
4401
|
-
(this.mode === 'Box' || this.mode === 'Default'))) ||
|
|
4402
|
-
|
|
4507
|
+
(this.mode === 'Box' || this.mode === 'Default'))) || (this.enableVirtualization && (text != null ||
|
|
4508
|
+
shouldDisplayNull) && !isCustomData && (value_2 != null || this.value.length > 1));
|
|
4509
|
+
if (shouldProcessElement) {
|
|
4403
4510
|
var currentText = [];
|
|
4404
|
-
var
|
|
4511
|
+
var displayText = value_2 === null && (text === null || text === undefined) ? 'null' : text;
|
|
4512
|
+
var textValues = this.isDynamicRemoteVirtualData && displayText != null && displayText !== '' && index === 0 ? displayText : this.text != null && this.text !== '' && !this.text.includes(displayText) ? this.text + this.delimiterChar + displayText : displayText;
|
|
4405
4513
|
currentText.push(textValues);
|
|
4406
4514
|
this.setProperties({ text: currentText.toString() }, true);
|
|
4407
|
-
this.addChip(
|
|
4515
|
+
this.addChip(displayText, value_2);
|
|
4408
4516
|
this.addListSelection(element);
|
|
4409
4517
|
}
|
|
4410
|
-
else if ((!this.enableVirtualization && value_2 && this.allowCustomValue) ||
|
|
4518
|
+
else if ((!this.enableVirtualization && (value_2 || this.value.length > 1) && this.allowCustomValue) ||
|
|
4411
4519
|
(this.enableVirtualization &&
|
|
4412
|
-
value_2 &&
|
|
4520
|
+
(value_2 || this.value.length > 1) &&
|
|
4413
4521
|
this.allowCustomValue &&
|
|
4414
4522
|
((!(this.dataSource instanceof DataManager)) ||
|
|
4415
4523
|
(this.dataSource instanceof DataManager && isInitialVirtualData)))) {
|
|
@@ -4446,10 +4554,11 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
4446
4554
|
this.wireListEvents();
|
|
4447
4555
|
}
|
|
4448
4556
|
var currentText = [];
|
|
4449
|
-
var
|
|
4557
|
+
var displayText = value_2 === null && (text === null || text === undefined) ? 'null' : text;
|
|
4558
|
+
var textValues = this.text != null && this.text !== '' ? this.text + this.delimiterChar + displayText : displayText;
|
|
4450
4559
|
currentText.push(textValues);
|
|
4451
4560
|
this.setProperties({ text: currentText.toString() }, true);
|
|
4452
|
-
this.addChip(
|
|
4561
|
+
this.addChip(displayText, value_2);
|
|
4453
4562
|
this.addListSelection(element);
|
|
4454
4563
|
}
|
|
4455
4564
|
}
|
|
@@ -4523,11 +4632,13 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
4523
4632
|
};
|
|
4524
4633
|
MultiSelect.prototype.updateListSelection = function (li, e, length) {
|
|
4525
4634
|
var customVal = li.getAttribute('data-value');
|
|
4635
|
+
var actualVal = customVal === 'null' ? null : customVal;
|
|
4526
4636
|
var value = this.allowObjectBinding ?
|
|
4527
|
-
this.getDataByValue(this.getFormattedValue(
|
|
4637
|
+
this.getDataByValue(this.getFormattedValue(actualVal))
|
|
4638
|
+
: this.getFormattedValue(actualVal);
|
|
4528
4639
|
if (this.allowCustomValue && ((customVal !== 'false' && value === false) ||
|
|
4529
4640
|
(!isNullOrUndefined(value) && value.toString() === 'NaN'))) {
|
|
4530
|
-
value =
|
|
4641
|
+
value = actualVal;
|
|
4531
4642
|
}
|
|
4532
4643
|
this.removeHover();
|
|
4533
4644
|
if (!this.value || ((!this.allowObjectBinding && this.value.indexOf(value) === -1) ||
|
|
@@ -5172,7 +5283,10 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
5172
5283
|
}
|
|
5173
5284
|
this.checkClearIconWidth();
|
|
5174
5285
|
if (!isNullOrUndefined(this.value) && (this.allowCustomValue || (this.listData && this.listData.length > 0))) {
|
|
5175
|
-
for (var index = 0;
|
|
5286
|
+
for (var index = 0; index < this.value.length; index++) {
|
|
5287
|
+
if (this.isValueOnlyNull()) {
|
|
5288
|
+
continue;
|
|
5289
|
+
}
|
|
5176
5290
|
var items = this.text && this.text.split(this.delimiterChar);
|
|
5177
5291
|
if (!this.enableVirtualization) {
|
|
5178
5292
|
data += (index === 0) ? '' : this.delimiterChar + ' ';
|