@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
|
@@ -1386,6 +1386,9 @@ let DropDownBase = class DropDownBase extends Component {
|
|
|
1386
1386
|
return 'drop-down-base';
|
|
1387
1387
|
}
|
|
1388
1388
|
getTextByValue(value) {
|
|
1389
|
+
if (this.getModuleName() === 'multiselect' && (value === null || value === undefined)) {
|
|
1390
|
+
return 'null';
|
|
1391
|
+
}
|
|
1389
1392
|
const text = this.checkValueCase(value, false, false, true);
|
|
1390
1393
|
return text;
|
|
1391
1394
|
}
|
|
@@ -3068,7 +3071,8 @@ let DropDownBase = class DropDownBase extends Component {
|
|
|
3068
3071
|
const type = this.typeOfData(this.listData).typeof;
|
|
3069
3072
|
if (type === 'string' || type === 'number' || type === 'boolean') {
|
|
3070
3073
|
for (const item of this.listData) {
|
|
3071
|
-
if (
|
|
3074
|
+
if (((this.getModuleName() === 'multiselect') && item === value) ||
|
|
3075
|
+
((this.getModuleName() !== 'multiselect') && !isNullOrUndefined(item) && item === value)) {
|
|
3072
3076
|
return item;
|
|
3073
3077
|
}
|
|
3074
3078
|
}
|
|
@@ -3275,6 +3279,8 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
3275
3279
|
this.isUpdateHeaderHeight = false;
|
|
3276
3280
|
this.isUpdateFooterHeight = false;
|
|
3277
3281
|
this.isReactTemplateUpdate = false;
|
|
3282
|
+
this.popupPositionObserver = null;
|
|
3283
|
+
this.popupPositionRefreshTimer = null;
|
|
3278
3284
|
}
|
|
3279
3285
|
/**
|
|
3280
3286
|
* Initialize the event handler.
|
|
@@ -6139,6 +6145,7 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
6139
6145
|
if (!isNullOrUndefined(this.popupObj)) {
|
|
6140
6146
|
this.popupObj.show(new Animation(eventArgs.animation), (this.zIndex === 1000) ? this.element : null);
|
|
6141
6147
|
this.isPopupRender = true;
|
|
6148
|
+
this.setupPopupPositionObserver();
|
|
6142
6149
|
}
|
|
6143
6150
|
if (this.isReact) {
|
|
6144
6151
|
setTimeout(() => {
|
|
@@ -6800,10 +6807,50 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
6800
6807
|
}
|
|
6801
6808
|
ulElement = null;
|
|
6802
6809
|
}
|
|
6810
|
+
setupPopupPositionObserver() {
|
|
6811
|
+
if (!this.isAngular) {
|
|
6812
|
+
return;
|
|
6813
|
+
}
|
|
6814
|
+
if (!isNullOrUndefined(this.popupPositionObserver)) {
|
|
6815
|
+
this.popupPositionObserver.disconnect();
|
|
6816
|
+
}
|
|
6817
|
+
const observerTarget = this.inputWrapper && this.inputWrapper.container
|
|
6818
|
+
? this.inputWrapper.container.parentElement
|
|
6819
|
+
: this.element.parentElement;
|
|
6820
|
+
if (isNullOrUndefined(observerTarget)) {
|
|
6821
|
+
return;
|
|
6822
|
+
}
|
|
6823
|
+
this.popupPositionObserver = new MutationObserver(() => {
|
|
6824
|
+
clearTimeout(this.popupPositionRefreshTimer);
|
|
6825
|
+
this.popupPositionRefreshTimer = setTimeout(() => {
|
|
6826
|
+
if (!isNullOrUndefined(this.popupObj) &&
|
|
6827
|
+
!isNullOrUndefined(this.inputWrapper)) {
|
|
6828
|
+
this.popupObj.refreshPosition(this.inputWrapper.container);
|
|
6829
|
+
}
|
|
6830
|
+
}, 0);
|
|
6831
|
+
});
|
|
6832
|
+
this.popupPositionObserver.observe(observerTarget, {
|
|
6833
|
+
childList: true,
|
|
6834
|
+
subtree: true,
|
|
6835
|
+
attributes: true,
|
|
6836
|
+
attributeFilter: ['style', 'class']
|
|
6837
|
+
});
|
|
6838
|
+
}
|
|
6839
|
+
destroyPopupPositionObserver() {
|
|
6840
|
+
if (this.popupPositionRefreshTimer) {
|
|
6841
|
+
clearTimeout(this.popupPositionRefreshTimer);
|
|
6842
|
+
this.popupPositionRefreshTimer = null;
|
|
6843
|
+
}
|
|
6844
|
+
if (this.popupPositionObserver) {
|
|
6845
|
+
this.popupPositionObserver.disconnect();
|
|
6846
|
+
this.popupPositionObserver = null;
|
|
6847
|
+
}
|
|
6848
|
+
}
|
|
6803
6849
|
destroyPopup() {
|
|
6804
6850
|
this.isPopupOpen = false;
|
|
6805
6851
|
this.isFilterFocus = false;
|
|
6806
6852
|
this.inputElement.removeAttribute('aria-controls');
|
|
6853
|
+
this.destroyPopupPositionObserver();
|
|
6807
6854
|
if (this.popupObj) {
|
|
6808
6855
|
if (this.resizer) {
|
|
6809
6856
|
EventHandler.remove(this.resizer, 'mousedown', this.startResizing);
|
|
@@ -7701,6 +7748,7 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
7701
7748
|
*/
|
|
7702
7749
|
hidePopup(e) {
|
|
7703
7750
|
/* eslint-enable valid-jsdoc, jsdoc/require-param */
|
|
7751
|
+
this.destroyPopupPositionObserver();
|
|
7704
7752
|
if (this.isEscapeKey && this.getModuleName() === 'dropdownlist') {
|
|
7705
7753
|
if (!isNullOrUndefined(this.inputElement)) {
|
|
7706
7754
|
Input.setValue(this.text, this.inputElement, this.floatLabelType, this.showClearButton);
|
|
@@ -7854,6 +7902,7 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
7854
7902
|
* @returns {void}
|
|
7855
7903
|
*/
|
|
7856
7904
|
destroy() {
|
|
7905
|
+
this.destroyPopupPositionObserver();
|
|
7857
7906
|
this.isActive = false;
|
|
7858
7907
|
this.isStaleFilter = false;
|
|
7859
7908
|
this.filterGeneration = null;
|
|
@@ -13907,6 +13956,7 @@ const CHIP_CLOSE$1 = 'e-chips-close';
|
|
|
13907
13956
|
const CHIP_SELECTED = 'e-chip-selected';
|
|
13908
13957
|
const SEARCHBOX_WRAPPER = 'e-searcher';
|
|
13909
13958
|
const DELIMITER_VIEW_WRAPPER = 'e-delimiter';
|
|
13959
|
+
const NULL_CHIP = 'e-chip-null';
|
|
13910
13960
|
const ZERO_SIZE = 'e-zero-size';
|
|
13911
13961
|
const REMAIN_WRAPPER$1 = 'e-remain';
|
|
13912
13962
|
const CLOSEICON_CLASS$1 = 'e-chips-close e-close-hooker';
|
|
@@ -14367,16 +14417,24 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
14367
14417
|
return;
|
|
14368
14418
|
}
|
|
14369
14419
|
const elements = this.chipCollectionWrapper.querySelectorAll('span.' + CHIP$1);
|
|
14370
|
-
const
|
|
14420
|
+
const lastElement = elements[elements.length - 1];
|
|
14421
|
+
const isNullChip = lastElement.classList.contains(NULL_CHIP);
|
|
14422
|
+
let customValue = null;
|
|
14371
14423
|
if (!isNullOrUndefined(this.value)) {
|
|
14372
14424
|
this.tempValues = this.allowObjectBinding ? this.value.slice() : this.value.slice();
|
|
14373
14425
|
}
|
|
14374
|
-
|
|
14375
|
-
|
|
14376
|
-
|
|
14377
|
-
|
|
14378
|
-
|
|
14379
|
-
customValue =
|
|
14426
|
+
if (isNullChip) {
|
|
14427
|
+
customValue = null;
|
|
14428
|
+
}
|
|
14429
|
+
else {
|
|
14430
|
+
const value = lastElement.getAttribute('data-value');
|
|
14431
|
+
customValue = this.allowObjectBinding ? this.enableVirtualization ?
|
|
14432
|
+
this.getVirtualDataByValue(this.getFormattedValue(value)) :
|
|
14433
|
+
this.getDataByValue(this.getFormattedValue(value)) : this.getFormattedValue(value);
|
|
14434
|
+
if (this.allowCustomValue && (value !== 'false' && customValue === false || (!isNullOrUndefined(customValue) &&
|
|
14435
|
+
customValue.toString() === 'NaN'))) {
|
|
14436
|
+
customValue = value;
|
|
14437
|
+
}
|
|
14380
14438
|
}
|
|
14381
14439
|
this.removeValue(customValue, e);
|
|
14382
14440
|
this.removeChipSelection();
|
|
@@ -14716,48 +14774,54 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
14716
14774
|
HIDE_LIST :
|
|
14717
14775
|
dropDownBaseClasses.selected;
|
|
14718
14776
|
if (!isNullOrUndefined(this.value)) {
|
|
14719
|
-
|
|
14720
|
-
|
|
14721
|
-
|
|
14722
|
-
|
|
14723
|
-
|
|
14724
|
-
|
|
14725
|
-
|
|
14726
|
-
|
|
14727
|
-
|
|
14728
|
-
|
|
14729
|
-
addClass([element
|
|
14730
|
-
|
|
14731
|
-
|
|
14732
|
-
|
|
14733
|
-
|
|
14734
|
-
|
|
14735
|
-
removeClass([element], dropDownBaseClasses.focus);
|
|
14736
|
-
const listEle = element.parentElement.querySelectorAll('.' +
|
|
14737
|
-
dropDownBaseClasses.li + ':not(.' + HIDE_LIST + ')' + ':not(.' + DISABLED$1 + ')');
|
|
14738
|
-
if (listEle.length > 0) {
|
|
14739
|
-
addClass([listEle[0]], dropDownBaseClasses.focus);
|
|
14740
|
-
this.updateAriaActiveDescendant();
|
|
14777
|
+
const isOnlyNull = this.isValueOnlyNull();
|
|
14778
|
+
if (!isOnlyNull) {
|
|
14779
|
+
for (let index = 0; index < this.value.length; index++) {
|
|
14780
|
+
value = this.allowObjectBinding ? getValue((this.fields.value) ? this.fields.value : '', this.value[index]) :
|
|
14781
|
+
this.value[index];
|
|
14782
|
+
if (isNullOrUndefined(value)) {
|
|
14783
|
+
continue;
|
|
14784
|
+
}
|
|
14785
|
+
element = this.findListElement(this.list, 'li', 'data-value', value);
|
|
14786
|
+
if (element) {
|
|
14787
|
+
addClass([element], className);
|
|
14788
|
+
if (this.hideSelectedItem && element.previousSibling
|
|
14789
|
+
&& element.previousElementSibling.classList.contains(dropDownBaseClasses.group)
|
|
14790
|
+
&& (!element.nextElementSibling ||
|
|
14791
|
+
element.nextElementSibling.classList.contains(dropDownBaseClasses.group))) {
|
|
14792
|
+
addClass([element.previousElementSibling], className);
|
|
14741
14793
|
}
|
|
14742
|
-
|
|
14743
|
-
|
|
14744
|
-
|
|
14745
|
-
|
|
14746
|
-
|
|
14794
|
+
if (this.hideSelectedItem && this.fields.groupBy && !element.previousElementSibling.classList.contains(HIDE_LIST)) {
|
|
14795
|
+
this.hideGroupItem(value);
|
|
14796
|
+
}
|
|
14797
|
+
if (this.hideSelectedItem && element.classList.contains(dropDownBaseClasses.focus)) {
|
|
14798
|
+
removeClass([element], dropDownBaseClasses.focus);
|
|
14799
|
+
const listEle = element.parentElement.querySelectorAll('.' +
|
|
14800
|
+
dropDownBaseClasses.li + ':not(.' + HIDE_LIST + ')' + ':not(.' + DISABLED$1 + ')');
|
|
14801
|
+
if (listEle.length > 0) {
|
|
14802
|
+
addClass([listEle[0]], dropDownBaseClasses.focus);
|
|
14803
|
+
this.updateAriaActiveDescendant();
|
|
14804
|
+
}
|
|
14805
|
+
else {
|
|
14806
|
+
//EJ2-57588 - for this task, we prevent the ul element cloning ( this.ulElement = this.ulElement.cloneNode ? <HTMLElement>this.ulElement.cloneNode(true) : this.ulElement;)
|
|
14807
|
+
if (!(this.list && this.list.querySelectorAll('.' + dropDownBaseClasses.li).length > 0)) {
|
|
14808
|
+
this.l10nUpdate();
|
|
14809
|
+
addClass([this.list], dropDownBaseClasses.noData);
|
|
14810
|
+
}
|
|
14747
14811
|
}
|
|
14748
14812
|
}
|
|
14749
|
-
|
|
14750
|
-
|
|
14751
|
-
|
|
14752
|
-
|
|
14753
|
-
|
|
14754
|
-
|
|
14755
|
-
|
|
14756
|
-
|
|
14757
|
-
|
|
14758
|
-
|
|
14759
|
-
|
|
14760
|
-
|
|
14813
|
+
element.setAttribute('aria-selected', 'true');
|
|
14814
|
+
if (this.mode === 'CheckBox' && element.classList.contains('e-active')) {
|
|
14815
|
+
const ariaValue = element.getElementsByClassName('e-check').length;
|
|
14816
|
+
if (ariaValue === 0) {
|
|
14817
|
+
const args = {
|
|
14818
|
+
module: 'CheckBoxSelection',
|
|
14819
|
+
enable: this.mode === 'CheckBox',
|
|
14820
|
+
li: element,
|
|
14821
|
+
e: null
|
|
14822
|
+
};
|
|
14823
|
+
this.notify('updatelist', args);
|
|
14824
|
+
}
|
|
14761
14825
|
}
|
|
14762
14826
|
}
|
|
14763
14827
|
}
|
|
@@ -15545,13 +15609,26 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
15545
15609
|
const activeItem = !isNullOrUndefined(this.ulElement)
|
|
15546
15610
|
? this.ulElement.getElementsByClassName('e-item-focus')[0]
|
|
15547
15611
|
: null;
|
|
15612
|
+
const filterInput = this.allowFiltering && !isNullOrUndefined(this.popupWrapper)
|
|
15613
|
+
? this.popupWrapper.querySelector('.' + FILTERINPUT)
|
|
15614
|
+
: null;
|
|
15548
15615
|
if (!isNullOrUndefined(activeItem) && this.isPopupOpen()) {
|
|
15549
15616
|
attributes(this.inputElement, {
|
|
15550
15617
|
'aria-activedescendant': activeItem.id
|
|
15551
15618
|
});
|
|
15619
|
+
if (filterInput) {
|
|
15620
|
+
attributes(filterInput, {
|
|
15621
|
+
'aria-activedescendant': activeItem.id
|
|
15622
|
+
});
|
|
15623
|
+
}
|
|
15552
15624
|
}
|
|
15553
|
-
else
|
|
15554
|
-
this.inputElement
|
|
15625
|
+
else {
|
|
15626
|
+
if (!isNullOrUndefined(this.inputElement)) {
|
|
15627
|
+
this.inputElement.removeAttribute('aria-activedescendant');
|
|
15628
|
+
}
|
|
15629
|
+
if (filterInput) {
|
|
15630
|
+
filterInput.removeAttribute('aria-activedescendant');
|
|
15631
|
+
}
|
|
15555
15632
|
}
|
|
15556
15633
|
}
|
|
15557
15634
|
pageUpSelection(steps, isVirtualKeyAction) {
|
|
@@ -16375,9 +16452,16 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
16375
16452
|
this.removeChipSelection();
|
|
16376
16453
|
this.addChipSelection(temp, e);
|
|
16377
16454
|
}
|
|
16378
|
-
const
|
|
16379
|
-
|
|
16380
|
-
|
|
16455
|
+
const isNullChip = selectedElem.classList.contains(NULL_CHIP);
|
|
16456
|
+
let currentChip;
|
|
16457
|
+
if (isNullChip) {
|
|
16458
|
+
currentChip = null;
|
|
16459
|
+
}
|
|
16460
|
+
else {
|
|
16461
|
+
currentChip = this.allowObjectBinding ?
|
|
16462
|
+
this.getDataByValue(this.getFormattedValue(selectedElem.getAttribute('data-value'))) :
|
|
16463
|
+
selectedElem.getAttribute('data-value');
|
|
16464
|
+
}
|
|
16381
16465
|
this.removeValue(currentChip, e);
|
|
16382
16466
|
this.updateDelimeter(this.delimiterChar, e);
|
|
16383
16467
|
this.makeTextBoxEmpty();
|
|
@@ -16632,15 +16716,18 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
16632
16716
|
const type = this.typeOfData(this.selectedListData).typeof;
|
|
16633
16717
|
if (type === 'string' || type === 'number' || type === 'boolean') {
|
|
16634
16718
|
for (const item of this.selectedListData) {
|
|
16635
|
-
if (
|
|
16719
|
+
if (item === value || (isNullOrUndefined(item) && value === null)) {
|
|
16636
16720
|
return item;
|
|
16637
16721
|
}
|
|
16638
16722
|
}
|
|
16639
16723
|
}
|
|
16640
16724
|
else {
|
|
16641
16725
|
for (const item of this.selectedListData) {
|
|
16642
|
-
if (
|
|
16643
|
-
|
|
16726
|
+
if (item !== undefined) {
|
|
16727
|
+
const itemValue = getValue((this.fields.value ? this.fields.value : 'value'), item);
|
|
16728
|
+
if (itemValue === value || (isNullOrUndefined(itemValue) && value === null)) {
|
|
16729
|
+
return item;
|
|
16730
|
+
}
|
|
16644
16731
|
}
|
|
16645
16732
|
}
|
|
16646
16733
|
}
|
|
@@ -16653,13 +16740,21 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
16653
16740
|
}
|
|
16654
16741
|
if (this.enabled && !this.readonly) {
|
|
16655
16742
|
const element = e.target.parentElement;
|
|
16656
|
-
const
|
|
16657
|
-
let value
|
|
16658
|
-
|
|
16659
|
-
|
|
16660
|
-
|
|
16661
|
-
|
|
16662
|
-
|
|
16743
|
+
const isNullChip = element.classList.contains(NULL_CHIP);
|
|
16744
|
+
let value;
|
|
16745
|
+
if (isNullChip) {
|
|
16746
|
+
value = null;
|
|
16747
|
+
}
|
|
16748
|
+
else {
|
|
16749
|
+
const customVal = element.getAttribute('data-value');
|
|
16750
|
+
const formattedVal = this.getFormattedValue(customVal);
|
|
16751
|
+
value = this.allowObjectBinding ? this.enableVirtualization ?
|
|
16752
|
+
this.getVirtualDataByValue(formattedVal) :
|
|
16753
|
+
this.getDataByValue(formattedVal) : formattedVal;
|
|
16754
|
+
if (this.allowCustomValue && ((customVal !== 'false' && value === false) ||
|
|
16755
|
+
(!isNullOrUndefined(value) && value.toString() === 'NaN'))) {
|
|
16756
|
+
value = customVal;
|
|
16757
|
+
}
|
|
16663
16758
|
}
|
|
16664
16759
|
if (this.isPopupOpen() && this.mode !== 'CheckBox') {
|
|
16665
16760
|
this.hidePopup(e);
|
|
@@ -16668,6 +16763,14 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
16668
16763
|
this.inputElement.focus();
|
|
16669
16764
|
}
|
|
16670
16765
|
this.removeValue(value, e);
|
|
16766
|
+
if (!isNullChip) {
|
|
16767
|
+
const findValue = this.allowObjectBinding ? getValue((this.fields.value) ? this.fields.value : '', value) : value;
|
|
16768
|
+
if (isNullOrUndefined(this.findListElement(this.list, 'li', 'data-value', findValue)) &&
|
|
16769
|
+
this.mainList && this.listData) {
|
|
16770
|
+
const list = this.mainList.cloneNode ? this.mainList.cloneNode(true) : this.mainList;
|
|
16771
|
+
this.onActionComplete(list, this.mainData);
|
|
16772
|
+
}
|
|
16773
|
+
}
|
|
16671
16774
|
value = this.allowObjectBinding ? getValue((this.fields.value) ? this.fields.value : '', value) : value;
|
|
16672
16775
|
if (isNullOrUndefined(this.findListElement(this.list, 'li', 'data-value', value)) &&
|
|
16673
16776
|
this.mainList && this.listData) {
|
|
@@ -16745,8 +16848,17 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
16745
16848
|
this.overAllWrapper.classList.contains('e-dbrd-cstyle');
|
|
16746
16849
|
}
|
|
16747
16850
|
removeValue(value, eve, length, isClearAll) {
|
|
16748
|
-
let index =
|
|
16749
|
-
|
|
16851
|
+
let index = -1;
|
|
16852
|
+
if (value === null) {
|
|
16853
|
+
index = this.value.indexOf(null);
|
|
16854
|
+
}
|
|
16855
|
+
else if (this.allowObjectBinding) {
|
|
16856
|
+
index = this.indexOfObjectInArray(value, this.value);
|
|
16857
|
+
}
|
|
16858
|
+
else {
|
|
16859
|
+
const formattedValue = this.getFormattedValue(value);
|
|
16860
|
+
index = this.value.indexOf(formattedValue);
|
|
16861
|
+
}
|
|
16750
16862
|
if (index === -1 && this.allowCustomValue && !isNullOrUndefined(value)) {
|
|
16751
16863
|
index = this.allowObjectBinding ? this.indexOfObjectInArray(value, this.value) :
|
|
16752
16864
|
this.value.indexOf(value.toString());
|
|
@@ -16932,7 +17044,13 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
16932
17044
|
removeChip(value, isClearAll) {
|
|
16933
17045
|
if (this.chipCollectionWrapper) {
|
|
16934
17046
|
if (!(this.enableVirtualization && isClearAll)) {
|
|
16935
|
-
|
|
17047
|
+
let element;
|
|
17048
|
+
if (value === null) {
|
|
17049
|
+
element = this.chipCollectionWrapper.querySelector('span.' + NULL_CHIP);
|
|
17050
|
+
}
|
|
17051
|
+
else {
|
|
17052
|
+
element = this.findListElement(this.chipCollectionWrapper, 'span', 'data-value', value);
|
|
17053
|
+
}
|
|
16936
17054
|
if (element) {
|
|
16937
17055
|
remove(element);
|
|
16938
17056
|
}
|
|
@@ -16950,7 +17068,8 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
16950
17068
|
}
|
|
16951
17069
|
}
|
|
16952
17070
|
updateChipStatus() {
|
|
16953
|
-
|
|
17071
|
+
const showChips = this.value && this.value.length && !this.isValueOnlyNull();
|
|
17072
|
+
if (showChips) {
|
|
16954
17073
|
if (!isNullOrUndefined(this.chipCollectionWrapper)) {
|
|
16955
17074
|
(this.chipCollectionWrapper.style.display = '');
|
|
16956
17075
|
}
|
|
@@ -17177,10 +17296,21 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
17177
17296
|
}
|
|
17178
17297
|
getChip(data, value, e) {
|
|
17179
17298
|
let itemData = { text: value, value: value };
|
|
17299
|
+
const isNullValue = value === null;
|
|
17300
|
+
const chipAttrs = { 'title': data, 'role': 'option', 'aria-selected': 'true' };
|
|
17301
|
+
if (isNullValue) {
|
|
17302
|
+
chipAttrs['data-value'] = 'null';
|
|
17303
|
+
}
|
|
17304
|
+
else {
|
|
17305
|
+
chipAttrs['data-value'] = value;
|
|
17306
|
+
}
|
|
17180
17307
|
const chip = this.createElement('span', {
|
|
17181
|
-
className: CHIP$1,
|
|
17182
|
-
attrs:
|
|
17308
|
+
className: CHIP$1 + (isNullValue ? ' ' + NULL_CHIP : ''),
|
|
17309
|
+
attrs: chipAttrs
|
|
17183
17310
|
});
|
|
17311
|
+
if (isNullValue) {
|
|
17312
|
+
addClass([chip], NULL_CHIP);
|
|
17313
|
+
}
|
|
17184
17314
|
let compiledString;
|
|
17185
17315
|
const chipContent = this.createElement('span', { className: CHIP_CONTENT$1 });
|
|
17186
17316
|
const chipClose = this.createElement('span', { className: CHIP_CLOSE$1, attrs: { 'aria-hidden': 'true' } });
|
|
@@ -17202,7 +17332,8 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
17202
17332
|
this.renderReactTemplates();
|
|
17203
17333
|
}
|
|
17204
17334
|
else if (this.enableHtmlSanitizer) {
|
|
17205
|
-
|
|
17335
|
+
const displayText = (data === 'null' || data === 'undefined') ? 'null' : data;
|
|
17336
|
+
chipContent.innerText = displayText;
|
|
17206
17337
|
}
|
|
17207
17338
|
else {
|
|
17208
17339
|
chipContent.innerHTML = this.encodeHtmlEntities(data.toString());
|
|
@@ -18004,6 +18135,9 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
18004
18135
|
const value = this.allowObjectBinding ?
|
|
18005
18136
|
getValue(((this.fields.value) ? this.fields.value : ''), this.value[this.value.length - 1]) :
|
|
18006
18137
|
this.value[this.value.length - 1];
|
|
18138
|
+
if (value === null && this.value.length === 1) {
|
|
18139
|
+
break;
|
|
18140
|
+
}
|
|
18007
18141
|
if (this.isRemoveSelection && this.text) {
|
|
18008
18142
|
data = this.text.replace(/,/g, delimiterChar + ' ') + delimiterChar + ' ';
|
|
18009
18143
|
text = this.text.split(delimiterChar);
|
|
@@ -18141,6 +18275,18 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
18141
18275
|
}
|
|
18142
18276
|
return null;
|
|
18143
18277
|
}
|
|
18278
|
+
isValueOnlyNull() {
|
|
18279
|
+
if (!this.value || this.value.length === 0) {
|
|
18280
|
+
return false;
|
|
18281
|
+
}
|
|
18282
|
+
return this.value.every((v) => v === null || v === undefined);
|
|
18283
|
+
}
|
|
18284
|
+
getTextByValue(value) {
|
|
18285
|
+
if (value === null || value === undefined) {
|
|
18286
|
+
return 'null';
|
|
18287
|
+
}
|
|
18288
|
+
return super.getTextByValue(value);
|
|
18289
|
+
}
|
|
18144
18290
|
initialValueUpdate(listItems, isInitialVirtualData, isInitialRender) {
|
|
18145
18291
|
if (this.list) {
|
|
18146
18292
|
let text;
|
|
@@ -18152,7 +18298,10 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
18152
18298
|
this.removeListSelection();
|
|
18153
18299
|
const formElement = closest(this.inputElement, 'form');
|
|
18154
18300
|
if (!isNullOrUndefined(this.value)) {
|
|
18155
|
-
for (let index = 0;
|
|
18301
|
+
for (let index = 0; index < this.value.length; index++) {
|
|
18302
|
+
if (this.isValueOnlyNull()) {
|
|
18303
|
+
continue;
|
|
18304
|
+
}
|
|
18156
18305
|
value = this.allowObjectBinding ?
|
|
18157
18306
|
getValue(((this.fields.value) ? this.fields.value : ''), this.value[index]) :
|
|
18158
18307
|
this.value[index];
|
|
@@ -18204,10 +18353,15 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
18204
18353
|
((!(this.dataSource instanceof DataManager)) ||
|
|
18205
18354
|
(this.dataSource instanceof DataManager && isInitialVirtualData)) && (!this.isAngular || !isInitialRender ||
|
|
18206
18355
|
(isNullOrUndefined(formElement) && listItems && listItems.length > 0))
|
|
18207
|
-
&& !(this.mode === 'CheckBox' && this.enableVirtualization && this.value.length > this.getSummaryTagThreshold())
|
|
18356
|
+
&& !(this.mode === 'CheckBox' && this.enableVirtualization && this.value.length > this.getSummaryTagThreshold())
|
|
18357
|
+
&& value !== null) {
|
|
18208
18358
|
this.value.splice(index, 1);
|
|
18209
18359
|
index -= 1;
|
|
18210
18360
|
}
|
|
18361
|
+
if (value === null && isNullOrUndefined(text)) {
|
|
18362
|
+
text = this.getTextByValue(value);
|
|
18363
|
+
isCustomData = true;
|
|
18364
|
+
}
|
|
18211
18365
|
}
|
|
18212
18366
|
else {
|
|
18213
18367
|
text = this.getTextByValue(value);
|
|
@@ -18218,20 +18372,23 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
18218
18372
|
this.listData = savedListData;
|
|
18219
18373
|
}
|
|
18220
18374
|
}
|
|
18221
|
-
|
|
18375
|
+
const shouldDisplayNull = (value === null && this.value.length > 1);
|
|
18376
|
+
const shouldProcessElement = ((element && (element.getAttribute('aria-selected') !== 'true')) ||
|
|
18222
18377
|
(element && (element.getAttribute('aria-selected') === 'true' && this.hideSelectedItem) &&
|
|
18223
|
-
(this.mode === 'Box' || this.mode === 'Default'))) ||
|
|
18224
|
-
|
|
18378
|
+
(this.mode === 'Box' || this.mode === 'Default'))) || (this.enableVirtualization && (text != null ||
|
|
18379
|
+
shouldDisplayNull) && !isCustomData && (value != null || this.value.length > 1));
|
|
18380
|
+
if (shouldProcessElement) {
|
|
18225
18381
|
const currentText = [];
|
|
18226
|
-
const
|
|
18382
|
+
const displayText = value === null && (text === null || text === undefined) ? 'null' : text;
|
|
18383
|
+
const textValues = this.isDynamicRemoteVirtualData && displayText != null && displayText !== '' && index === 0 ? displayText : this.text != null && this.text !== '' && !this.text.includes(displayText) ? this.text + this.delimiterChar + displayText : displayText;
|
|
18227
18384
|
currentText.push(textValues);
|
|
18228
18385
|
this.setProperties({ text: currentText.toString() }, true);
|
|
18229
|
-
this.addChip(
|
|
18386
|
+
this.addChip(displayText, value);
|
|
18230
18387
|
this.addListSelection(element);
|
|
18231
18388
|
}
|
|
18232
|
-
else if ((!this.enableVirtualization && value && this.allowCustomValue) ||
|
|
18389
|
+
else if ((!this.enableVirtualization && (value || this.value.length > 1) && this.allowCustomValue) ||
|
|
18233
18390
|
(this.enableVirtualization &&
|
|
18234
|
-
value &&
|
|
18391
|
+
(value || this.value.length > 1) &&
|
|
18235
18392
|
this.allowCustomValue &&
|
|
18236
18393
|
((!(this.dataSource instanceof DataManager)) ||
|
|
18237
18394
|
(this.dataSource instanceof DataManager && isInitialVirtualData)))) {
|
|
@@ -18268,10 +18425,11 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
18268
18425
|
this.wireListEvents();
|
|
18269
18426
|
}
|
|
18270
18427
|
const currentText = [];
|
|
18271
|
-
const
|
|
18428
|
+
const displayText = value === null && (text === null || text === undefined) ? 'null' : text;
|
|
18429
|
+
const textValues = this.text != null && this.text !== '' ? this.text + this.delimiterChar + displayText : displayText;
|
|
18272
18430
|
currentText.push(textValues);
|
|
18273
18431
|
this.setProperties({ text: currentText.toString() }, true);
|
|
18274
|
-
this.addChip(
|
|
18432
|
+
this.addChip(displayText, value);
|
|
18275
18433
|
this.addListSelection(element);
|
|
18276
18434
|
}
|
|
18277
18435
|
}
|
|
@@ -18345,11 +18503,13 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
18345
18503
|
}
|
|
18346
18504
|
updateListSelection(li, e, length) {
|
|
18347
18505
|
const customVal = li.getAttribute('data-value');
|
|
18506
|
+
const actualVal = customVal === 'null' ? null : customVal;
|
|
18348
18507
|
let value = this.allowObjectBinding ?
|
|
18349
|
-
this.getDataByValue(this.getFormattedValue(
|
|
18508
|
+
this.getDataByValue(this.getFormattedValue(actualVal))
|
|
18509
|
+
: this.getFormattedValue(actualVal);
|
|
18350
18510
|
if (this.allowCustomValue && ((customVal !== 'false' && value === false) ||
|
|
18351
18511
|
(!isNullOrUndefined(value) && value.toString() === 'NaN'))) {
|
|
18352
|
-
value =
|
|
18512
|
+
value = actualVal;
|
|
18353
18513
|
}
|
|
18354
18514
|
this.removeHover();
|
|
18355
18515
|
if (!this.value || ((!this.allowObjectBinding && this.value.indexOf(value) === -1) ||
|
|
@@ -18992,7 +19152,10 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
18992
19152
|
}
|
|
18993
19153
|
this.checkClearIconWidth();
|
|
18994
19154
|
if (!isNullOrUndefined(this.value) && (this.allowCustomValue || (this.listData && this.listData.length > 0))) {
|
|
18995
|
-
for (let index = 0;
|
|
19155
|
+
for (let index = 0; index < this.value.length; index++) {
|
|
19156
|
+
if (this.isValueOnlyNull()) {
|
|
19157
|
+
continue;
|
|
19158
|
+
}
|
|
18996
19159
|
const items = this.text && this.text.split(this.delimiterChar);
|
|
18997
19160
|
if (!this.enableVirtualization) {
|
|
18998
19161
|
data += (index === 0) ? '' : this.delimiterChar + ' ';
|