@syncfusion/ej2-dropdowns 35.1.46 → 35.2.15
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 +258 -83
- package/dist/es6/ej2-dropdowns.es2015.js.map +1 -1
- package/dist/es6/ej2-dropdowns.es5.js +261 -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 +60 -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(() => {
|
|
@@ -6706,6 +6713,7 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
6706
6713
|
this.fixedHeaderElement = null;
|
|
6707
6714
|
}
|
|
6708
6715
|
if (!eventArgs.cancel) {
|
|
6716
|
+
this.destroyPopupPositionObserver();
|
|
6709
6717
|
if (this.isPopupOpen && this.allowFiltering && this.isDeviceFullScreen && Browser.isDevice && Browser.isIos) {
|
|
6710
6718
|
document.documentElement.scrollTo({
|
|
6711
6719
|
top: this.iOSscrollPosition.y,
|
|
@@ -6800,10 +6808,62 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
6800
6808
|
}
|
|
6801
6809
|
ulElement = null;
|
|
6802
6810
|
}
|
|
6811
|
+
setupPopupPositionObserver() {
|
|
6812
|
+
if (!this.isAngular) {
|
|
6813
|
+
return;
|
|
6814
|
+
}
|
|
6815
|
+
if (!isNullOrUndefined(this.popupPositionObserver)) {
|
|
6816
|
+
this.popupPositionObserver.disconnect();
|
|
6817
|
+
}
|
|
6818
|
+
const observerTarget = this.inputWrapper && this.inputWrapper.container
|
|
6819
|
+
? this.inputWrapper.container.parentElement
|
|
6820
|
+
: this.element.parentElement;
|
|
6821
|
+
if (isNullOrUndefined(observerTarget)) {
|
|
6822
|
+
return;
|
|
6823
|
+
}
|
|
6824
|
+
this.popupPositionObserver = new MutationObserver((mutations) => {
|
|
6825
|
+
// Ignore the component's own changes (focus / icon-animation classes) to avoid needless refresh cycles.
|
|
6826
|
+
const external = mutations.some((m) => isNullOrUndefined(this.inputWrapper) || !this.inputWrapper.container.contains(m.target));
|
|
6827
|
+
if (!external) {
|
|
6828
|
+
return;
|
|
6829
|
+
}
|
|
6830
|
+
clearTimeout(this.popupPositionRefreshTimer);
|
|
6831
|
+
this.popupPositionRefreshTimer = setTimeout(() => {
|
|
6832
|
+
if (!isNullOrUndefined(this.popupObj) &&
|
|
6833
|
+
!isNullOrUndefined(this.inputWrapper)) {
|
|
6834
|
+
this.popupObj.refreshPosition(this.inputWrapper.container);
|
|
6835
|
+
}
|
|
6836
|
+
}, 0);
|
|
6837
|
+
});
|
|
6838
|
+
this.popupPositionObserver.observe(observerTarget, {
|
|
6839
|
+
childList: true,
|
|
6840
|
+
subtree: true,
|
|
6841
|
+
attributes: true,
|
|
6842
|
+
attributeFilter: ['style', 'class']
|
|
6843
|
+
});
|
|
6844
|
+
// Content added or removed before the input (for example a delayed validation message) is a direct child change
|
|
6845
|
+
// of one of its ancestors, so watch only those child lists (not their subtrees) up to, but excluding, the body.
|
|
6846
|
+
let ancestor = observerTarget.parentElement;
|
|
6847
|
+
while (ancestor && ancestor !== document.body && ancestor !== document.documentElement) {
|
|
6848
|
+
this.popupPositionObserver.observe(ancestor, { childList: true });
|
|
6849
|
+
ancestor = ancestor.parentElement;
|
|
6850
|
+
}
|
|
6851
|
+
}
|
|
6852
|
+
destroyPopupPositionObserver() {
|
|
6853
|
+
if (this.popupPositionRefreshTimer) {
|
|
6854
|
+
clearTimeout(this.popupPositionRefreshTimer);
|
|
6855
|
+
this.popupPositionRefreshTimer = null;
|
|
6856
|
+
}
|
|
6857
|
+
if (this.popupPositionObserver) {
|
|
6858
|
+
this.popupPositionObserver.disconnect();
|
|
6859
|
+
this.popupPositionObserver = null;
|
|
6860
|
+
}
|
|
6861
|
+
}
|
|
6803
6862
|
destroyPopup() {
|
|
6804
6863
|
this.isPopupOpen = false;
|
|
6805
6864
|
this.isFilterFocus = false;
|
|
6806
6865
|
this.inputElement.removeAttribute('aria-controls');
|
|
6866
|
+
this.destroyPopupPositionObserver();
|
|
6807
6867
|
if (this.popupObj) {
|
|
6808
6868
|
if (this.resizer) {
|
|
6809
6869
|
EventHandler.remove(this.resizer, 'mousedown', this.startResizing);
|
|
@@ -7854,6 +7914,7 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
7854
7914
|
* @returns {void}
|
|
7855
7915
|
*/
|
|
7856
7916
|
destroy() {
|
|
7917
|
+
this.destroyPopupPositionObserver();
|
|
7857
7918
|
this.isActive = false;
|
|
7858
7919
|
this.isStaleFilter = false;
|
|
7859
7920
|
this.filterGeneration = null;
|
|
@@ -13907,6 +13968,7 @@ const CHIP_CLOSE$1 = 'e-chips-close';
|
|
|
13907
13968
|
const CHIP_SELECTED = 'e-chip-selected';
|
|
13908
13969
|
const SEARCHBOX_WRAPPER = 'e-searcher';
|
|
13909
13970
|
const DELIMITER_VIEW_WRAPPER = 'e-delimiter';
|
|
13971
|
+
const NULL_CHIP = 'e-chip-null';
|
|
13910
13972
|
const ZERO_SIZE = 'e-zero-size';
|
|
13911
13973
|
const REMAIN_WRAPPER$1 = 'e-remain';
|
|
13912
13974
|
const CLOSEICON_CLASS$1 = 'e-chips-close e-close-hooker';
|
|
@@ -14367,16 +14429,24 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
14367
14429
|
return;
|
|
14368
14430
|
}
|
|
14369
14431
|
const elements = this.chipCollectionWrapper.querySelectorAll('span.' + CHIP$1);
|
|
14370
|
-
const
|
|
14432
|
+
const lastElement = elements[elements.length - 1];
|
|
14433
|
+
const isNullChip = lastElement.classList.contains(NULL_CHIP);
|
|
14434
|
+
let customValue = null;
|
|
14371
14435
|
if (!isNullOrUndefined(this.value)) {
|
|
14372
14436
|
this.tempValues = this.allowObjectBinding ? this.value.slice() : this.value.slice();
|
|
14373
14437
|
}
|
|
14374
|
-
|
|
14375
|
-
|
|
14376
|
-
|
|
14377
|
-
|
|
14378
|
-
|
|
14379
|
-
customValue =
|
|
14438
|
+
if (isNullChip) {
|
|
14439
|
+
customValue = null;
|
|
14440
|
+
}
|
|
14441
|
+
else {
|
|
14442
|
+
const value = lastElement.getAttribute('data-value');
|
|
14443
|
+
customValue = this.allowObjectBinding ? this.enableVirtualization ?
|
|
14444
|
+
this.getVirtualDataByValue(this.getFormattedValue(value)) :
|
|
14445
|
+
this.getDataByValue(this.getFormattedValue(value)) : this.getFormattedValue(value);
|
|
14446
|
+
if (this.allowCustomValue && (value !== 'false' && customValue === false || (!isNullOrUndefined(customValue) &&
|
|
14447
|
+
customValue.toString() === 'NaN'))) {
|
|
14448
|
+
customValue = value;
|
|
14449
|
+
}
|
|
14380
14450
|
}
|
|
14381
14451
|
this.removeValue(customValue, e);
|
|
14382
14452
|
this.removeChipSelection();
|
|
@@ -14716,48 +14786,54 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
14716
14786
|
HIDE_LIST :
|
|
14717
14787
|
dropDownBaseClasses.selected;
|
|
14718
14788
|
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();
|
|
14789
|
+
const isOnlyNull = this.isValueOnlyNull();
|
|
14790
|
+
if (!isOnlyNull) {
|
|
14791
|
+
for (let index = 0; index < this.value.length; index++) {
|
|
14792
|
+
value = this.allowObjectBinding ? getValue((this.fields.value) ? this.fields.value : '', this.value[index]) :
|
|
14793
|
+
this.value[index];
|
|
14794
|
+
if (isNullOrUndefined(value)) {
|
|
14795
|
+
continue;
|
|
14796
|
+
}
|
|
14797
|
+
element = this.findListElement(this.list, 'li', 'data-value', value);
|
|
14798
|
+
if (element) {
|
|
14799
|
+
addClass([element], className);
|
|
14800
|
+
if (this.hideSelectedItem && element.previousSibling
|
|
14801
|
+
&& element.previousElementSibling.classList.contains(dropDownBaseClasses.group)
|
|
14802
|
+
&& (!element.nextElementSibling ||
|
|
14803
|
+
element.nextElementSibling.classList.contains(dropDownBaseClasses.group))) {
|
|
14804
|
+
addClass([element.previousElementSibling], className);
|
|
14741
14805
|
}
|
|
14742
|
-
|
|
14743
|
-
|
|
14744
|
-
|
|
14745
|
-
|
|
14746
|
-
|
|
14806
|
+
if (this.hideSelectedItem && this.fields.groupBy && !element.previousElementSibling.classList.contains(HIDE_LIST)) {
|
|
14807
|
+
this.hideGroupItem(value);
|
|
14808
|
+
}
|
|
14809
|
+
if (this.hideSelectedItem && element.classList.contains(dropDownBaseClasses.focus)) {
|
|
14810
|
+
removeClass([element], dropDownBaseClasses.focus);
|
|
14811
|
+
const listEle = element.parentElement.querySelectorAll('.' +
|
|
14812
|
+
dropDownBaseClasses.li + ':not(.' + HIDE_LIST + ')' + ':not(.' + DISABLED$1 + ')');
|
|
14813
|
+
if (listEle.length > 0) {
|
|
14814
|
+
addClass([listEle[0]], dropDownBaseClasses.focus);
|
|
14815
|
+
this.updateAriaActiveDescendant();
|
|
14816
|
+
}
|
|
14817
|
+
else {
|
|
14818
|
+
//EJ2-57588 - for this task, we prevent the ul element cloning ( this.ulElement = this.ulElement.cloneNode ? <HTMLElement>this.ulElement.cloneNode(true) : this.ulElement;)
|
|
14819
|
+
if (!(this.list && this.list.querySelectorAll('.' + dropDownBaseClasses.li).length > 0)) {
|
|
14820
|
+
this.l10nUpdate();
|
|
14821
|
+
addClass([this.list], dropDownBaseClasses.noData);
|
|
14822
|
+
}
|
|
14747
14823
|
}
|
|
14748
14824
|
}
|
|
14749
|
-
|
|
14750
|
-
|
|
14751
|
-
|
|
14752
|
-
|
|
14753
|
-
|
|
14754
|
-
|
|
14755
|
-
|
|
14756
|
-
|
|
14757
|
-
|
|
14758
|
-
|
|
14759
|
-
|
|
14760
|
-
|
|
14825
|
+
element.setAttribute('aria-selected', 'true');
|
|
14826
|
+
if (this.mode === 'CheckBox' && element.classList.contains('e-active')) {
|
|
14827
|
+
const ariaValue = element.getElementsByClassName('e-check').length;
|
|
14828
|
+
if (ariaValue === 0) {
|
|
14829
|
+
const args = {
|
|
14830
|
+
module: 'CheckBoxSelection',
|
|
14831
|
+
enable: this.mode === 'CheckBox',
|
|
14832
|
+
li: element,
|
|
14833
|
+
e: null
|
|
14834
|
+
};
|
|
14835
|
+
this.notify('updatelist', args);
|
|
14836
|
+
}
|
|
14761
14837
|
}
|
|
14762
14838
|
}
|
|
14763
14839
|
}
|
|
@@ -15545,13 +15621,26 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
15545
15621
|
const activeItem = !isNullOrUndefined(this.ulElement)
|
|
15546
15622
|
? this.ulElement.getElementsByClassName('e-item-focus')[0]
|
|
15547
15623
|
: null;
|
|
15624
|
+
const filterInput = this.allowFiltering && !isNullOrUndefined(this.popupWrapper)
|
|
15625
|
+
? this.popupWrapper.querySelector('.' + FILTERINPUT)
|
|
15626
|
+
: null;
|
|
15548
15627
|
if (!isNullOrUndefined(activeItem) && this.isPopupOpen()) {
|
|
15549
15628
|
attributes(this.inputElement, {
|
|
15550
15629
|
'aria-activedescendant': activeItem.id
|
|
15551
15630
|
});
|
|
15631
|
+
if (filterInput) {
|
|
15632
|
+
attributes(filterInput, {
|
|
15633
|
+
'aria-activedescendant': activeItem.id
|
|
15634
|
+
});
|
|
15635
|
+
}
|
|
15552
15636
|
}
|
|
15553
|
-
else
|
|
15554
|
-
this.inputElement
|
|
15637
|
+
else {
|
|
15638
|
+
if (!isNullOrUndefined(this.inputElement)) {
|
|
15639
|
+
this.inputElement.removeAttribute('aria-activedescendant');
|
|
15640
|
+
}
|
|
15641
|
+
if (filterInput) {
|
|
15642
|
+
filterInput.removeAttribute('aria-activedescendant');
|
|
15643
|
+
}
|
|
15555
15644
|
}
|
|
15556
15645
|
}
|
|
15557
15646
|
pageUpSelection(steps, isVirtualKeyAction) {
|
|
@@ -16375,9 +16464,16 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
16375
16464
|
this.removeChipSelection();
|
|
16376
16465
|
this.addChipSelection(temp, e);
|
|
16377
16466
|
}
|
|
16378
|
-
const
|
|
16379
|
-
|
|
16380
|
-
|
|
16467
|
+
const isNullChip = selectedElem.classList.contains(NULL_CHIP);
|
|
16468
|
+
let currentChip;
|
|
16469
|
+
if (isNullChip) {
|
|
16470
|
+
currentChip = null;
|
|
16471
|
+
}
|
|
16472
|
+
else {
|
|
16473
|
+
currentChip = this.allowObjectBinding ?
|
|
16474
|
+
this.getDataByValue(this.getFormattedValue(selectedElem.getAttribute('data-value'))) :
|
|
16475
|
+
selectedElem.getAttribute('data-value');
|
|
16476
|
+
}
|
|
16381
16477
|
this.removeValue(currentChip, e);
|
|
16382
16478
|
this.updateDelimeter(this.delimiterChar, e);
|
|
16383
16479
|
this.makeTextBoxEmpty();
|
|
@@ -16632,15 +16728,18 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
16632
16728
|
const type = this.typeOfData(this.selectedListData).typeof;
|
|
16633
16729
|
if (type === 'string' || type === 'number' || type === 'boolean') {
|
|
16634
16730
|
for (const item of this.selectedListData) {
|
|
16635
|
-
if (
|
|
16731
|
+
if (item === value || (isNullOrUndefined(item) && value === null)) {
|
|
16636
16732
|
return item;
|
|
16637
16733
|
}
|
|
16638
16734
|
}
|
|
16639
16735
|
}
|
|
16640
16736
|
else {
|
|
16641
16737
|
for (const item of this.selectedListData) {
|
|
16642
|
-
if (
|
|
16643
|
-
|
|
16738
|
+
if (item !== undefined) {
|
|
16739
|
+
const itemValue = getValue((this.fields.value ? this.fields.value : 'value'), item);
|
|
16740
|
+
if (itemValue === value || (isNullOrUndefined(itemValue) && value === null)) {
|
|
16741
|
+
return item;
|
|
16742
|
+
}
|
|
16644
16743
|
}
|
|
16645
16744
|
}
|
|
16646
16745
|
}
|
|
@@ -16653,13 +16752,21 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
16653
16752
|
}
|
|
16654
16753
|
if (this.enabled && !this.readonly) {
|
|
16655
16754
|
const element = e.target.parentElement;
|
|
16656
|
-
const
|
|
16657
|
-
let value
|
|
16658
|
-
|
|
16659
|
-
|
|
16660
|
-
|
|
16661
|
-
|
|
16662
|
-
|
|
16755
|
+
const isNullChip = element.classList.contains(NULL_CHIP);
|
|
16756
|
+
let value;
|
|
16757
|
+
if (isNullChip) {
|
|
16758
|
+
value = null;
|
|
16759
|
+
}
|
|
16760
|
+
else {
|
|
16761
|
+
const customVal = element.getAttribute('data-value');
|
|
16762
|
+
const formattedVal = this.getFormattedValue(customVal);
|
|
16763
|
+
value = this.allowObjectBinding ? this.enableVirtualization ?
|
|
16764
|
+
this.getVirtualDataByValue(formattedVal) :
|
|
16765
|
+
this.getDataByValue(formattedVal) : formattedVal;
|
|
16766
|
+
if (this.allowCustomValue && ((customVal !== 'false' && value === false) ||
|
|
16767
|
+
(!isNullOrUndefined(value) && value.toString() === 'NaN'))) {
|
|
16768
|
+
value = customVal;
|
|
16769
|
+
}
|
|
16663
16770
|
}
|
|
16664
16771
|
if (this.isPopupOpen() && this.mode !== 'CheckBox') {
|
|
16665
16772
|
this.hidePopup(e);
|
|
@@ -16668,6 +16775,14 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
16668
16775
|
this.inputElement.focus();
|
|
16669
16776
|
}
|
|
16670
16777
|
this.removeValue(value, e);
|
|
16778
|
+
if (!isNullChip) {
|
|
16779
|
+
const findValue = this.allowObjectBinding ? getValue((this.fields.value) ? this.fields.value : '', value) : value;
|
|
16780
|
+
if (isNullOrUndefined(this.findListElement(this.list, 'li', 'data-value', findValue)) &&
|
|
16781
|
+
this.mainList && this.listData) {
|
|
16782
|
+
const list = this.mainList.cloneNode ? this.mainList.cloneNode(true) : this.mainList;
|
|
16783
|
+
this.onActionComplete(list, this.mainData);
|
|
16784
|
+
}
|
|
16785
|
+
}
|
|
16671
16786
|
value = this.allowObjectBinding ? getValue((this.fields.value) ? this.fields.value : '', value) : value;
|
|
16672
16787
|
if (isNullOrUndefined(this.findListElement(this.list, 'li', 'data-value', value)) &&
|
|
16673
16788
|
this.mainList && this.listData) {
|
|
@@ -16745,8 +16860,17 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
16745
16860
|
this.overAllWrapper.classList.contains('e-dbrd-cstyle');
|
|
16746
16861
|
}
|
|
16747
16862
|
removeValue(value, eve, length, isClearAll) {
|
|
16748
|
-
let index =
|
|
16749
|
-
|
|
16863
|
+
let index = -1;
|
|
16864
|
+
if (value === null) {
|
|
16865
|
+
index = this.value.indexOf(null);
|
|
16866
|
+
}
|
|
16867
|
+
else if (this.allowObjectBinding) {
|
|
16868
|
+
index = this.indexOfObjectInArray(value, this.value);
|
|
16869
|
+
}
|
|
16870
|
+
else {
|
|
16871
|
+
const formattedValue = this.getFormattedValue(value);
|
|
16872
|
+
index = this.value.indexOf(formattedValue);
|
|
16873
|
+
}
|
|
16750
16874
|
if (index === -1 && this.allowCustomValue && !isNullOrUndefined(value)) {
|
|
16751
16875
|
index = this.allowObjectBinding ? this.indexOfObjectInArray(value, this.value) :
|
|
16752
16876
|
this.value.indexOf(value.toString());
|
|
@@ -16932,7 +17056,13 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
16932
17056
|
removeChip(value, isClearAll) {
|
|
16933
17057
|
if (this.chipCollectionWrapper) {
|
|
16934
17058
|
if (!(this.enableVirtualization && isClearAll)) {
|
|
16935
|
-
|
|
17059
|
+
let element;
|
|
17060
|
+
if (value === null) {
|
|
17061
|
+
element = this.chipCollectionWrapper.querySelector('span.' + NULL_CHIP);
|
|
17062
|
+
}
|
|
17063
|
+
else {
|
|
17064
|
+
element = this.findListElement(this.chipCollectionWrapper, 'span', 'data-value', value);
|
|
17065
|
+
}
|
|
16936
17066
|
if (element) {
|
|
16937
17067
|
remove(element);
|
|
16938
17068
|
}
|
|
@@ -16950,7 +17080,8 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
16950
17080
|
}
|
|
16951
17081
|
}
|
|
16952
17082
|
updateChipStatus() {
|
|
16953
|
-
|
|
17083
|
+
const showChips = this.value && this.value.length && !this.isValueOnlyNull();
|
|
17084
|
+
if (showChips) {
|
|
16954
17085
|
if (!isNullOrUndefined(this.chipCollectionWrapper)) {
|
|
16955
17086
|
(this.chipCollectionWrapper.style.display = '');
|
|
16956
17087
|
}
|
|
@@ -17177,10 +17308,21 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
17177
17308
|
}
|
|
17178
17309
|
getChip(data, value, e) {
|
|
17179
17310
|
let itemData = { text: value, value: value };
|
|
17311
|
+
const isNullValue = value === null;
|
|
17312
|
+
const chipAttrs = { 'title': data, 'role': 'option', 'aria-selected': 'true' };
|
|
17313
|
+
if (isNullValue) {
|
|
17314
|
+
chipAttrs['data-value'] = 'null';
|
|
17315
|
+
}
|
|
17316
|
+
else {
|
|
17317
|
+
chipAttrs['data-value'] = value;
|
|
17318
|
+
}
|
|
17180
17319
|
const chip = this.createElement('span', {
|
|
17181
|
-
className: CHIP$1,
|
|
17182
|
-
attrs:
|
|
17320
|
+
className: CHIP$1 + (isNullValue ? ' ' + NULL_CHIP : ''),
|
|
17321
|
+
attrs: chipAttrs
|
|
17183
17322
|
});
|
|
17323
|
+
if (isNullValue) {
|
|
17324
|
+
addClass([chip], NULL_CHIP);
|
|
17325
|
+
}
|
|
17184
17326
|
let compiledString;
|
|
17185
17327
|
const chipContent = this.createElement('span', { className: CHIP_CONTENT$1 });
|
|
17186
17328
|
const chipClose = this.createElement('span', { className: CHIP_CLOSE$1, attrs: { 'aria-hidden': 'true' } });
|
|
@@ -17202,7 +17344,8 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
17202
17344
|
this.renderReactTemplates();
|
|
17203
17345
|
}
|
|
17204
17346
|
else if (this.enableHtmlSanitizer) {
|
|
17205
|
-
|
|
17347
|
+
const displayText = (data === 'null' || data === 'undefined') ? 'null' : data;
|
|
17348
|
+
chipContent.innerText = displayText;
|
|
17206
17349
|
}
|
|
17207
17350
|
else {
|
|
17208
17351
|
chipContent.innerHTML = this.encodeHtmlEntities(data.toString());
|
|
@@ -18004,6 +18147,9 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
18004
18147
|
const value = this.allowObjectBinding ?
|
|
18005
18148
|
getValue(((this.fields.value) ? this.fields.value : ''), this.value[this.value.length - 1]) :
|
|
18006
18149
|
this.value[this.value.length - 1];
|
|
18150
|
+
if (value === null && this.value.length === 1) {
|
|
18151
|
+
break;
|
|
18152
|
+
}
|
|
18007
18153
|
if (this.isRemoveSelection && this.text) {
|
|
18008
18154
|
data = this.text.replace(/,/g, delimiterChar + ' ') + delimiterChar + ' ';
|
|
18009
18155
|
text = this.text.split(delimiterChar);
|
|
@@ -18141,6 +18287,18 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
18141
18287
|
}
|
|
18142
18288
|
return null;
|
|
18143
18289
|
}
|
|
18290
|
+
isValueOnlyNull() {
|
|
18291
|
+
if (!this.value || this.value.length === 0) {
|
|
18292
|
+
return false;
|
|
18293
|
+
}
|
|
18294
|
+
return this.value.every((v) => v === null || v === undefined);
|
|
18295
|
+
}
|
|
18296
|
+
getTextByValue(value) {
|
|
18297
|
+
if (value === null || value === undefined) {
|
|
18298
|
+
return 'null';
|
|
18299
|
+
}
|
|
18300
|
+
return super.getTextByValue(value);
|
|
18301
|
+
}
|
|
18144
18302
|
initialValueUpdate(listItems, isInitialVirtualData, isInitialRender) {
|
|
18145
18303
|
if (this.list) {
|
|
18146
18304
|
let text;
|
|
@@ -18152,7 +18310,10 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
18152
18310
|
this.removeListSelection();
|
|
18153
18311
|
const formElement = closest(this.inputElement, 'form');
|
|
18154
18312
|
if (!isNullOrUndefined(this.value)) {
|
|
18155
|
-
for (let index = 0;
|
|
18313
|
+
for (let index = 0; index < this.value.length; index++) {
|
|
18314
|
+
if (this.isValueOnlyNull()) {
|
|
18315
|
+
continue;
|
|
18316
|
+
}
|
|
18156
18317
|
value = this.allowObjectBinding ?
|
|
18157
18318
|
getValue(((this.fields.value) ? this.fields.value : ''), this.value[index]) :
|
|
18158
18319
|
this.value[index];
|
|
@@ -18204,10 +18365,15 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
18204
18365
|
((!(this.dataSource instanceof DataManager)) ||
|
|
18205
18366
|
(this.dataSource instanceof DataManager && isInitialVirtualData)) && (!this.isAngular || !isInitialRender ||
|
|
18206
18367
|
(isNullOrUndefined(formElement) && listItems && listItems.length > 0))
|
|
18207
|
-
&& !(this.mode === 'CheckBox' && this.enableVirtualization && this.value.length > this.getSummaryTagThreshold())
|
|
18368
|
+
&& !(this.mode === 'CheckBox' && this.enableVirtualization && this.value.length > this.getSummaryTagThreshold())
|
|
18369
|
+
&& value !== null) {
|
|
18208
18370
|
this.value.splice(index, 1);
|
|
18209
18371
|
index -= 1;
|
|
18210
18372
|
}
|
|
18373
|
+
if (value === null && isNullOrUndefined(text)) {
|
|
18374
|
+
text = this.getTextByValue(value);
|
|
18375
|
+
isCustomData = true;
|
|
18376
|
+
}
|
|
18211
18377
|
}
|
|
18212
18378
|
else {
|
|
18213
18379
|
text = this.getTextByValue(value);
|
|
@@ -18218,20 +18384,23 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
18218
18384
|
this.listData = savedListData;
|
|
18219
18385
|
}
|
|
18220
18386
|
}
|
|
18221
|
-
|
|
18387
|
+
const shouldDisplayNull = (value === null && this.value.length > 1);
|
|
18388
|
+
const shouldProcessElement = ((element && (element.getAttribute('aria-selected') !== 'true')) ||
|
|
18222
18389
|
(element && (element.getAttribute('aria-selected') === 'true' && this.hideSelectedItem) &&
|
|
18223
|
-
(this.mode === 'Box' || this.mode === 'Default'))) ||
|
|
18224
|
-
|
|
18390
|
+
(this.mode === 'Box' || this.mode === 'Default'))) || (this.enableVirtualization && (text != null ||
|
|
18391
|
+
shouldDisplayNull) && !isCustomData && (value != null || this.value.length > 1));
|
|
18392
|
+
if (shouldProcessElement) {
|
|
18225
18393
|
const currentText = [];
|
|
18226
|
-
const
|
|
18394
|
+
const displayText = value === null && (text === null || text === undefined) ? 'null' : text;
|
|
18395
|
+
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
18396
|
currentText.push(textValues);
|
|
18228
18397
|
this.setProperties({ text: currentText.toString() }, true);
|
|
18229
|
-
this.addChip(
|
|
18398
|
+
this.addChip(displayText, value);
|
|
18230
18399
|
this.addListSelection(element);
|
|
18231
18400
|
}
|
|
18232
|
-
else if ((!this.enableVirtualization && value && this.allowCustomValue) ||
|
|
18401
|
+
else if ((!this.enableVirtualization && (value || this.value.length > 1) && this.allowCustomValue) ||
|
|
18233
18402
|
(this.enableVirtualization &&
|
|
18234
|
-
value &&
|
|
18403
|
+
(value || this.value.length > 1) &&
|
|
18235
18404
|
this.allowCustomValue &&
|
|
18236
18405
|
((!(this.dataSource instanceof DataManager)) ||
|
|
18237
18406
|
(this.dataSource instanceof DataManager && isInitialVirtualData)))) {
|
|
@@ -18268,10 +18437,11 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
18268
18437
|
this.wireListEvents();
|
|
18269
18438
|
}
|
|
18270
18439
|
const currentText = [];
|
|
18271
|
-
const
|
|
18440
|
+
const displayText = value === null && (text === null || text === undefined) ? 'null' : text;
|
|
18441
|
+
const textValues = this.text != null && this.text !== '' ? this.text + this.delimiterChar + displayText : displayText;
|
|
18272
18442
|
currentText.push(textValues);
|
|
18273
18443
|
this.setProperties({ text: currentText.toString() }, true);
|
|
18274
|
-
this.addChip(
|
|
18444
|
+
this.addChip(displayText, value);
|
|
18275
18445
|
this.addListSelection(element);
|
|
18276
18446
|
}
|
|
18277
18447
|
}
|
|
@@ -18345,11 +18515,13 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
18345
18515
|
}
|
|
18346
18516
|
updateListSelection(li, e, length) {
|
|
18347
18517
|
const customVal = li.getAttribute('data-value');
|
|
18518
|
+
const actualVal = customVal === 'null' ? null : customVal;
|
|
18348
18519
|
let value = this.allowObjectBinding ?
|
|
18349
|
-
this.getDataByValue(this.getFormattedValue(
|
|
18520
|
+
this.getDataByValue(this.getFormattedValue(actualVal))
|
|
18521
|
+
: this.getFormattedValue(actualVal);
|
|
18350
18522
|
if (this.allowCustomValue && ((customVal !== 'false' && value === false) ||
|
|
18351
18523
|
(!isNullOrUndefined(value) && value.toString() === 'NaN'))) {
|
|
18352
|
-
value =
|
|
18524
|
+
value = actualVal;
|
|
18353
18525
|
}
|
|
18354
18526
|
this.removeHover();
|
|
18355
18527
|
if (!this.value || ((!this.allowObjectBinding && this.value.indexOf(value) === -1) ||
|
|
@@ -18992,7 +19164,10 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
18992
19164
|
}
|
|
18993
19165
|
this.checkClearIconWidth();
|
|
18994
19166
|
if (!isNullOrUndefined(this.value) && (this.allowCustomValue || (this.listData && this.listData.length > 0))) {
|
|
18995
|
-
for (let index = 0;
|
|
19167
|
+
for (let index = 0; index < this.value.length; index++) {
|
|
19168
|
+
if (this.isValueOnlyNull()) {
|
|
19169
|
+
continue;
|
|
19170
|
+
}
|
|
18996
19171
|
const items = this.text && this.text.split(this.delimiterChar);
|
|
18997
19172
|
if (!this.enableVirtualization) {
|
|
18998
19173
|
data += (index === 0) ? '' : this.delimiterChar + ' ';
|