@syncfusion/ej2-dropdowns 35.1.43 → 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.
@@ -1467,6 +1467,9 @@ var DropDownBase = /** @__PURE__ @class */ (function (_super) {
1467
1467
  return 'drop-down-base';
1468
1468
  };
1469
1469
  DropDownBase.prototype.getTextByValue = function (value) {
1470
+ if (this.getModuleName() === 'multiselect' && (value === null || value === undefined)) {
1471
+ return 'null';
1472
+ }
1470
1473
  var text = this.checkValueCase(value, false, false, true);
1471
1474
  return text;
1472
1475
  };
@@ -3158,7 +3161,8 @@ var DropDownBase = /** @__PURE__ @class */ (function (_super) {
3158
3161
  if (type === 'string' || type === 'number' || type === 'boolean') {
3159
3162
  for (var _i = 0, _a = this.listData; _i < _a.length; _i++) {
3160
3163
  var item = _a[_i];
3161
- if (!isNullOrUndefined(item) && item === value) {
3164
+ if (((this.getModuleName() === 'multiselect') && item === value) ||
3165
+ ((this.getModuleName() !== 'multiselect') && !isNullOrUndefined(item) && item === value)) {
3162
3166
  return item;
3163
3167
  }
3164
3168
  }
@@ -3381,6 +3385,8 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
3381
3385
  _this.isUpdateHeaderHeight = false;
3382
3386
  _this.isUpdateFooterHeight = false;
3383
3387
  _this.isReactTemplateUpdate = false;
3388
+ _this.popupPositionObserver = null;
3389
+ _this.popupPositionRefreshTimer = null;
3384
3390
  return _this;
3385
3391
  }
3386
3392
  /**
@@ -3646,8 +3652,7 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
3646
3652
  'aria-disabled': 'false',
3647
3653
  'role': 'combobox',
3648
3654
  'aria-expanded': 'false',
3649
- 'aria-live': 'polite',
3650
- 'aria-labelledby': this.hiddenElement.id
3655
+ 'aria-live': 'polite'
3651
3656
  };
3652
3657
  };
3653
3658
  DropDownList.prototype.setEnableRtl = function () {
@@ -6268,6 +6273,7 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
6268
6273
  if (!isNullOrUndefined(_this.popupObj)) {
6269
6274
  _this.popupObj.show(new Animation(eventArgs.animation), (_this.zIndex === 1000) ? _this.element : null);
6270
6275
  _this.isPopupRender = true;
6276
+ _this.setupPopupPositionObserver();
6271
6277
  }
6272
6278
  if (_this.isReact) {
6273
6279
  setTimeout(function () {
@@ -6936,10 +6942,51 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
6936
6942
  }
6937
6943
  ulElement = null;
6938
6944
  };
6945
+ DropDownList.prototype.setupPopupPositionObserver = function () {
6946
+ var _this = this;
6947
+ if (!this.isAngular) {
6948
+ return;
6949
+ }
6950
+ if (!isNullOrUndefined(this.popupPositionObserver)) {
6951
+ this.popupPositionObserver.disconnect();
6952
+ }
6953
+ var observerTarget = this.inputWrapper && this.inputWrapper.container
6954
+ ? this.inputWrapper.container.parentElement
6955
+ : this.element.parentElement;
6956
+ if (isNullOrUndefined(observerTarget)) {
6957
+ return;
6958
+ }
6959
+ this.popupPositionObserver = new MutationObserver(function () {
6960
+ clearTimeout(_this.popupPositionRefreshTimer);
6961
+ _this.popupPositionRefreshTimer = setTimeout(function () {
6962
+ if (!isNullOrUndefined(_this.popupObj) &&
6963
+ !isNullOrUndefined(_this.inputWrapper)) {
6964
+ _this.popupObj.refreshPosition(_this.inputWrapper.container);
6965
+ }
6966
+ }, 0);
6967
+ });
6968
+ this.popupPositionObserver.observe(observerTarget, {
6969
+ childList: true,
6970
+ subtree: true,
6971
+ attributes: true,
6972
+ attributeFilter: ['style', 'class']
6973
+ });
6974
+ };
6975
+ DropDownList.prototype.destroyPopupPositionObserver = function () {
6976
+ if (this.popupPositionRefreshTimer) {
6977
+ clearTimeout(this.popupPositionRefreshTimer);
6978
+ this.popupPositionRefreshTimer = null;
6979
+ }
6980
+ if (this.popupPositionObserver) {
6981
+ this.popupPositionObserver.disconnect();
6982
+ this.popupPositionObserver = null;
6983
+ }
6984
+ };
6939
6985
  DropDownList.prototype.destroyPopup = function () {
6940
6986
  this.isPopupOpen = false;
6941
6987
  this.isFilterFocus = false;
6942
6988
  this.inputElement.removeAttribute('aria-controls');
6989
+ this.destroyPopupPositionObserver();
6943
6990
  if (this.popupObj) {
6944
6991
  if (this.resizer) {
6945
6992
  EventHandler.remove(this.resizer, 'mousedown', this.startResizing);
@@ -6969,6 +7016,9 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
6969
7016
  if (isNullOrUndefined(this.inputElement.getAttribute('type'))) {
6970
7017
  this.inputElement.setAttribute('type', 'text');
6971
7018
  }
7019
+ if (this.getModuleName() === 'dropdownlist') {
7020
+ this.inputElement.setAttribute('aria-label', this.getModuleName());
7021
+ }
6972
7022
  this.inputElement.setAttribute('aria-expanded', 'false');
6973
7023
  }
6974
7024
  else {
@@ -7055,7 +7105,7 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
7055
7105
  if (!this.targetElement().hasAttribute('aria-label')) {
7056
7106
  attributes(this.targetElement(), { 'aria-label': this.getModuleName() });
7057
7107
  }
7058
- if (!this.inputElement.hasAttribute('aria-labelledby')) {
7108
+ if (this.getModuleName() !== 'dropdownlist' && !this.inputElement.hasAttribute('aria-labelledby')) {
7059
7109
  this.inputElement.setAttribute('aria-labelledby', this.hiddenElement.id);
7060
7110
  }
7061
7111
  this.inputElement.setAttribute('aria-expanded', 'false');
@@ -7063,9 +7113,19 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
7063
7113
  attributes(this.targetElement(), this.getAriaAttributes());
7064
7114
  this.updateDataAttribute(this.htmlAttributes);
7065
7115
  this.setHTMLAttributes();
7066
- if (this.targetElement() === this.inputElement) {
7116
+ if (this.getModuleName() !== 'dropdownlist' && this.targetElement() === this.inputElement) {
7067
7117
  this.inputElement.removeAttribute('aria-labelledby');
7068
7118
  }
7119
+ if (this.getModuleName() === 'dropdownlist' && this.targetElement() === this.inputWrapper.container) {
7120
+ var floatLabel = this.inputWrapper.container.getElementsByClassName('e-float-text')[0];
7121
+ if (!isNullOrUndefined(this.element.id) && this.element.id !== '' && !isNullOrUndefined(floatLabel)) {
7122
+ floatLabel.id = 'label_' + this.element.id.replace(/ /g, '_');
7123
+ attributes(this.inputWrapper.container, { 'aria-labelledby': floatLabel.id });
7124
+ }
7125
+ else {
7126
+ this.inputWrapper.container.removeAttribute('aria-labelledby');
7127
+ }
7128
+ }
7069
7129
  if (this.value !== null || this.activeIndex !== null || this.text !== null) {
7070
7130
  if (this.enableVirtualization) {
7071
7131
  this.listItemHeight = this.getListHeight();
@@ -7124,7 +7184,12 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
7124
7184
  var floatLabelElement = this.inputWrapper.container.getElementsByClassName('e-float-text')[0];
7125
7185
  if (!isNullOrUndefined(this.element.id) && this.element.id !== '' && !isNullOrUndefined(floatLabelElement)) {
7126
7186
  floatLabelElement.id = 'label_' + this.element.id.replace(/ /g, '_');
7127
- attributes(this.inputElement, { 'aria-labelledby': floatLabelElement.id });
7187
+ attributes(this.getModuleName() === 'dropdownlist'
7188
+ ? this.inputWrapper.container
7189
+ : this.inputElement, { 'aria-labelledby': floatLabelElement.id });
7190
+ if (this.getModuleName() === 'dropdownlist' && this.inputElement) {
7191
+ this.inputElement.removeAttribute('aria-labelledby');
7192
+ }
7128
7193
  }
7129
7194
  this.renderComplete();
7130
7195
  this.listItemHeight = this.getListHeight();
@@ -7341,7 +7406,7 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
7341
7406
  if (label) {
7342
7407
  label.remove();
7343
7408
  }
7344
- this_1.inputElement.removeAttribute('aria-labelledby');
7409
+ this_1.inputWrapper.container.removeAttribute('aria-labelledby');
7345
7410
  }
7346
7411
  else if (this_1.floatLabelType !== 'Never' && !this_1.value) {
7347
7412
  var floatLabel = this_1.inputWrapper.container
@@ -7373,7 +7438,7 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
7373
7438
  }
7374
7439
  floatLabel.style.width = this_1.inputElement.offsetWidth + 'px';
7375
7440
  floatLabel.textContent = newProp.placeholder;
7376
- this_1.inputElement.setAttribute('aria-labelledby', floatLabel.id);
7441
+ this_1.inputWrapper.container.setAttribute('aria-labelledby', floatLabel.id);
7377
7442
  }
7378
7443
  }
7379
7444
  break;
@@ -7586,14 +7651,28 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
7586
7651
  this_1.updateSelectElementData(this_1.allowFiltering);
7587
7652
  }
7588
7653
  break;
7589
- case 'floatLabelType':
7654
+ case 'floatLabelType': {
7590
7655
  Input.removeFloating(this_1.inputWrapper);
7591
7656
  Input.addFloating(this_1.inputElement, newProp.floatLabelType, this_1.placeholder, this_1.createElement);
7592
7657
  if (!isNullOrUndefined(this_1.inputWrapper.buttons[0]) &&
7593
7658
  this_1.inputWrapper.container.getElementsByClassName('e-float-text-overflow')[0] && this_1.floatLabelType !== 'Never') {
7594
7659
  this_1.inputWrapper.container.getElementsByClassName('e-float-text-overflow')[0].classList.add('e-icon');
7595
7660
  }
7661
+ if (this_1.getModuleName() === 'dropdownlist') {
7662
+ var floatLabelElement = this_1.inputWrapper.container.getElementsByClassName('e-float-text')[0];
7663
+ if (!isNullOrUndefined(this_1.element.id) &&
7664
+ this_1.element.id !== '' && !isNullOrUndefined(floatLabelElement)) {
7665
+ floatLabelElement.id = 'label_' + this_1.element.id.replace(/ /g, '_');
7666
+ attributes(this_1.inputWrapper.container, {
7667
+ 'aria-labelledby': floatLabelElement.id
7668
+ });
7669
+ }
7670
+ else {
7671
+ this_1.inputWrapper.container.removeAttribute('aria-labelledby');
7672
+ }
7673
+ }
7596
7674
  break;
7675
+ }
7597
7676
  case 'showClearButton':
7598
7677
  if (!this_1.inputWrapper.clearButton) {
7599
7678
  Input.setClearButton(newProp.showClearButton, this_1.inputElement, this_1.inputWrapper, null, this_1.createElement);
@@ -7702,7 +7781,7 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
7702
7781
  }
7703
7782
  if (label && this.getModuleName() === 'dropdownlist' && (!this.placeholder || this.placeholder.trim() === '')) {
7704
7783
  label.remove();
7705
- this.inputElement.removeAttribute('aria-labelledby');
7784
+ this.inputWrapper.container.removeAttribute('aria-labelledby');
7706
7785
  }
7707
7786
  };
7708
7787
  /**
@@ -7814,6 +7893,7 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
7814
7893
  */
7815
7894
  DropDownList.prototype.hidePopup = function (e) {
7816
7895
  /* eslint-enable valid-jsdoc, jsdoc/require-param */
7896
+ this.destroyPopupPositionObserver();
7817
7897
  if (this.isEscapeKey && this.getModuleName() === 'dropdownlist') {
7818
7898
  if (!isNullOrUndefined(this.inputElement)) {
7819
7899
  Input.setValue(this.text, this.inputElement, this.floatLabelType, this.showClearButton);
@@ -7967,6 +8047,7 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
7967
8047
  * @returns {void}
7968
8048
  */
7969
8049
  DropDownList.prototype.destroy = function () {
8050
+ this.destroyPopupPositionObserver();
7970
8051
  this.isActive = false;
7971
8052
  this.isStaleFilter = false;
7972
8053
  this.filterGeneration = null;
@@ -14136,6 +14217,7 @@ var CHIP_CLOSE$1 = 'e-chips-close';
14136
14217
  var CHIP_SELECTED = 'e-chip-selected';
14137
14218
  var SEARCHBOX_WRAPPER = 'e-searcher';
14138
14219
  var DELIMITER_VIEW_WRAPPER = 'e-delimiter';
14220
+ var NULL_CHIP = 'e-chip-null';
14139
14221
  var ZERO_SIZE = 'e-zero-size';
14140
14222
  var REMAIN_WRAPPER$1 = 'e-remain';
14141
14223
  var CLOSEICON_CLASS$1 = 'e-chips-close e-close-hooker';
@@ -14600,16 +14682,24 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
14600
14682
  return;
14601
14683
  }
14602
14684
  var elements = this.chipCollectionWrapper.querySelectorAll('span.' + CHIP$1);
14603
- var value = elements[elements.length - 1].getAttribute('data-value');
14685
+ var lastElement = elements[elements.length - 1];
14686
+ var isNullChip = lastElement.classList.contains(NULL_CHIP);
14687
+ var customValue = null;
14604
14688
  if (!isNullOrUndefined(this.value)) {
14605
14689
  this.tempValues = this.allowObjectBinding ? this.value.slice() : this.value.slice();
14606
14690
  }
14607
- var customValue = this.allowObjectBinding ? this.enableVirtualization ?
14608
- this.getVirtualDataByValue(this.getFormattedValue(value)) :
14609
- this.getDataByValue(this.getFormattedValue(value)) : this.getFormattedValue(value);
14610
- if (this.allowCustomValue && (value !== 'false' && customValue === false || (!isNullOrUndefined(customValue) &&
14611
- customValue.toString() === 'NaN'))) {
14612
- customValue = value;
14691
+ if (isNullChip) {
14692
+ customValue = null;
14693
+ }
14694
+ else {
14695
+ var value = lastElement.getAttribute('data-value');
14696
+ customValue = this.allowObjectBinding ? this.enableVirtualization ?
14697
+ this.getVirtualDataByValue(this.getFormattedValue(value)) :
14698
+ this.getDataByValue(this.getFormattedValue(value)) : this.getFormattedValue(value);
14699
+ if (this.allowCustomValue && (value !== 'false' && customValue === false || (!isNullOrUndefined(customValue) &&
14700
+ customValue.toString() === 'NaN'))) {
14701
+ customValue = value;
14702
+ }
14613
14703
  }
14614
14704
  this.removeValue(customValue, e);
14615
14705
  this.removeChipSelection();
@@ -14950,48 +15040,54 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
14950
15040
  HIDE_LIST :
14951
15041
  dropDownBaseClasses.selected;
14952
15042
  if (!isNullOrUndefined(this.value)) {
14953
- for (var index = 0; !isNullOrUndefined(this.value[index]); index++) {
14954
- value = this.allowObjectBinding ? getValue((this.fields.value) ? this.fields.value : '', this.value[index]) :
14955
- this.value[index];
14956
- element = this.findListElement(this.list, 'li', 'data-value', value);
14957
- if (element) {
14958
- addClass([element], className);
14959
- if (this.hideSelectedItem && element.previousSibling
14960
- && element.previousElementSibling.classList.contains(dropDownBaseClasses.group)
14961
- && (!element.nextElementSibling ||
14962
- element.nextElementSibling.classList.contains(dropDownBaseClasses.group))) {
14963
- addClass([element.previousElementSibling], className);
14964
- }
14965
- if (this.hideSelectedItem && this.fields.groupBy && !element.previousElementSibling.classList.contains(HIDE_LIST)) {
14966
- this.hideGroupItem(value);
14967
- }
14968
- if (this.hideSelectedItem && element.classList.contains(dropDownBaseClasses.focus)) {
14969
- removeClass([element], dropDownBaseClasses.focus);
14970
- var listEle = element.parentElement.querySelectorAll('.' +
14971
- dropDownBaseClasses.li + ':not(.' + HIDE_LIST + ')' + ':not(.' + DISABLED$1 + ')');
14972
- if (listEle.length > 0) {
14973
- addClass([listEle[0]], dropDownBaseClasses.focus);
14974
- this.updateAriaActiveDescendant();
15043
+ var isOnlyNull = this.isValueOnlyNull();
15044
+ if (!isOnlyNull) {
15045
+ for (var index = 0; index < this.value.length; index++) {
15046
+ value = this.allowObjectBinding ? getValue((this.fields.value) ? this.fields.value : '', this.value[index]) :
15047
+ this.value[index];
15048
+ if (isNullOrUndefined(value)) {
15049
+ continue;
15050
+ }
15051
+ element = this.findListElement(this.list, 'li', 'data-value', value);
15052
+ if (element) {
15053
+ addClass([element], className);
15054
+ if (this.hideSelectedItem && element.previousSibling
15055
+ && element.previousElementSibling.classList.contains(dropDownBaseClasses.group)
15056
+ && (!element.nextElementSibling ||
15057
+ element.nextElementSibling.classList.contains(dropDownBaseClasses.group))) {
15058
+ addClass([element.previousElementSibling], className);
14975
15059
  }
14976
- else {
14977
- //EJ2-57588 - for this task, we prevent the ul element cloning ( this.ulElement = this.ulElement.cloneNode ? <HTMLElement>this.ulElement.cloneNode(true) : this.ulElement;)
14978
- if (!(this.list && this.list.querySelectorAll('.' + dropDownBaseClasses.li).length > 0)) {
14979
- this.l10nUpdate();
14980
- addClass([this.list], dropDownBaseClasses.noData);
15060
+ if (this.hideSelectedItem && this.fields.groupBy && !element.previousElementSibling.classList.contains(HIDE_LIST)) {
15061
+ this.hideGroupItem(value);
15062
+ }
15063
+ if (this.hideSelectedItem && element.classList.contains(dropDownBaseClasses.focus)) {
15064
+ removeClass([element], dropDownBaseClasses.focus);
15065
+ var listEle = element.parentElement.querySelectorAll('.' +
15066
+ dropDownBaseClasses.li + ':not(.' + HIDE_LIST + ')' + ':not(.' + DISABLED$1 + ')');
15067
+ if (listEle.length > 0) {
15068
+ addClass([listEle[0]], dropDownBaseClasses.focus);
15069
+ this.updateAriaActiveDescendant();
15070
+ }
15071
+ else {
15072
+ //EJ2-57588 - for this task, we prevent the ul element cloning ( this.ulElement = this.ulElement.cloneNode ? <HTMLElement>this.ulElement.cloneNode(true) : this.ulElement;)
15073
+ if (!(this.list && this.list.querySelectorAll('.' + dropDownBaseClasses.li).length > 0)) {
15074
+ this.l10nUpdate();
15075
+ addClass([this.list], dropDownBaseClasses.noData);
15076
+ }
14981
15077
  }
14982
15078
  }
14983
- }
14984
- element.setAttribute('aria-selected', 'true');
14985
- if (this.mode === 'CheckBox' && element.classList.contains('e-active')) {
14986
- var ariaValue = element.getElementsByClassName('e-check').length;
14987
- if (ariaValue === 0) {
14988
- var args = {
14989
- module: 'CheckBoxSelection',
14990
- enable: this.mode === 'CheckBox',
14991
- li: element,
14992
- e: null
14993
- };
14994
- this.notify('updatelist', args);
15079
+ element.setAttribute('aria-selected', 'true');
15080
+ if (this.mode === 'CheckBox' && element.classList.contains('e-active')) {
15081
+ var ariaValue = element.getElementsByClassName('e-check').length;
15082
+ if (ariaValue === 0) {
15083
+ var args = {
15084
+ module: 'CheckBoxSelection',
15085
+ enable: this.mode === 'CheckBox',
15086
+ li: element,
15087
+ e: null
15088
+ };
15089
+ this.notify('updatelist', args);
15090
+ }
14995
15091
  }
14996
15092
  }
14997
15093
  }
@@ -15779,13 +15875,26 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
15779
15875
  var activeItem = !isNullOrUndefined(this.ulElement)
15780
15876
  ? this.ulElement.getElementsByClassName('e-item-focus')[0]
15781
15877
  : null;
15878
+ var filterInput = this.allowFiltering && !isNullOrUndefined(this.popupWrapper)
15879
+ ? this.popupWrapper.querySelector('.' + FILTERINPUT)
15880
+ : null;
15782
15881
  if (!isNullOrUndefined(activeItem) && this.isPopupOpen()) {
15783
15882
  attributes(this.inputElement, {
15784
15883
  'aria-activedescendant': activeItem.id
15785
15884
  });
15885
+ if (filterInput) {
15886
+ attributes(filterInput, {
15887
+ 'aria-activedescendant': activeItem.id
15888
+ });
15889
+ }
15786
15890
  }
15787
- else if (!isNullOrUndefined(this.inputElement)) {
15788
- this.inputElement.removeAttribute('aria-activedescendant');
15891
+ else {
15892
+ if (!isNullOrUndefined(this.inputElement)) {
15893
+ this.inputElement.removeAttribute('aria-activedescendant');
15894
+ }
15895
+ if (filterInput) {
15896
+ filterInput.removeAttribute('aria-activedescendant');
15897
+ }
15789
15898
  }
15790
15899
  };
15791
15900
  MultiSelect.prototype.pageUpSelection = function (steps, isVirtualKeyAction) {
@@ -16614,9 +16723,16 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
16614
16723
  this.removeChipSelection();
16615
16724
  this.addChipSelection(temp, e);
16616
16725
  }
16617
- var currentChip = this.allowObjectBinding ?
16618
- this.getDataByValue(this.getFormattedValue(selectedElem.getAttribute('data-value'))) :
16619
- selectedElem.getAttribute('data-value');
16726
+ var isNullChip = selectedElem.classList.contains(NULL_CHIP);
16727
+ var currentChip = void 0;
16728
+ if (isNullChip) {
16729
+ currentChip = null;
16730
+ }
16731
+ else {
16732
+ currentChip = this.allowObjectBinding ?
16733
+ this.getDataByValue(this.getFormattedValue(selectedElem.getAttribute('data-value'))) :
16734
+ selectedElem.getAttribute('data-value');
16735
+ }
16620
16736
  this.removeValue(currentChip, e);
16621
16737
  this.updateDelimeter(this.delimiterChar, e);
16622
16738
  this.makeTextBoxEmpty();
@@ -16874,7 +16990,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
16874
16990
  if (type === 'string' || type === 'number' || type === 'boolean') {
16875
16991
  for (var _i = 0, _a = this.selectedListData; _i < _a.length; _i++) {
16876
16992
  var item = _a[_i];
16877
- if (!isNullOrUndefined(item) && item === value) {
16993
+ if (item === value || (isNullOrUndefined(item) && value === null)) {
16878
16994
  return item;
16879
16995
  }
16880
16996
  }
@@ -16882,8 +16998,11 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
16882
16998
  else {
16883
16999
  for (var _b = 0, _c = this.selectedListData; _b < _c.length; _b++) {
16884
17000
  var item = _c[_b];
16885
- if (!isNullOrUndefined(item) && getValue((this.fields.value ? this.fields.value : 'value'), item) === value) {
16886
- return item;
17001
+ if (item !== undefined) {
17002
+ var itemValue = getValue((this.fields.value ? this.fields.value : 'value'), item);
17003
+ if (itemValue === value || (isNullOrUndefined(itemValue) && value === null)) {
17004
+ return item;
17005
+ }
16887
17006
  }
16888
17007
  }
16889
17008
  }
@@ -16896,13 +17015,21 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
16896
17015
  }
16897
17016
  if (this.enabled && !this.readonly) {
16898
17017
  var element = e.target.parentElement;
16899
- var customVal = element.getAttribute('data-value');
16900
- var value = this.allowObjectBinding ? this.enableVirtualization ?
16901
- this.getVirtualDataByValue(this.getFormattedValue(customVal)) :
16902
- this.getDataByValue(this.getFormattedValue(customVal)) : this.getFormattedValue(customVal);
16903
- if (this.allowCustomValue && ((customVal !== 'false' && value === false) ||
16904
- (!isNullOrUndefined(value) && value.toString() === 'NaN'))) {
16905
- value = customVal;
17018
+ var isNullChip = element.classList.contains(NULL_CHIP);
17019
+ var value = void 0;
17020
+ if (isNullChip) {
17021
+ value = null;
17022
+ }
17023
+ else {
17024
+ var customVal = element.getAttribute('data-value');
17025
+ var formattedVal = this.getFormattedValue(customVal);
17026
+ value = this.allowObjectBinding ? this.enableVirtualization ?
17027
+ this.getVirtualDataByValue(formattedVal) :
17028
+ this.getDataByValue(formattedVal) : formattedVal;
17029
+ if (this.allowCustomValue && ((customVal !== 'false' && value === false) ||
17030
+ (!isNullOrUndefined(value) && value.toString() === 'NaN'))) {
17031
+ value = customVal;
17032
+ }
16906
17033
  }
16907
17034
  if (this.isPopupOpen() && this.mode !== 'CheckBox') {
16908
17035
  this.hidePopup(e);
@@ -16911,6 +17038,14 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
16911
17038
  this.inputElement.focus();
16912
17039
  }
16913
17040
  this.removeValue(value, e);
17041
+ if (!isNullChip) {
17042
+ var findValue = this.allowObjectBinding ? getValue((this.fields.value) ? this.fields.value : '', value) : value;
17043
+ if (isNullOrUndefined(this.findListElement(this.list, 'li', 'data-value', findValue)) &&
17044
+ this.mainList && this.listData) {
17045
+ var list = this.mainList.cloneNode ? this.mainList.cloneNode(true) : this.mainList;
17046
+ this.onActionComplete(list, this.mainData);
17047
+ }
17048
+ }
16914
17049
  value = this.allowObjectBinding ? getValue((this.fields.value) ? this.fields.value : '', value) : value;
16915
17050
  if (isNullOrUndefined(this.findListElement(this.list, 'li', 'data-value', value)) &&
16916
17051
  this.mainList && this.listData) {
@@ -16989,8 +17124,17 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
16989
17124
  };
16990
17125
  MultiSelect.prototype.removeValue = function (value, eve, length, isClearAll) {
16991
17126
  var _this = this;
16992
- var index = this.allowObjectBinding ? this.indexOfObjectInArray(value, this.value) :
16993
- this.value.indexOf(this.getFormattedValue(value));
17127
+ var index = -1;
17128
+ if (value === null) {
17129
+ index = this.value.indexOf(null);
17130
+ }
17131
+ else if (this.allowObjectBinding) {
17132
+ index = this.indexOfObjectInArray(value, this.value);
17133
+ }
17134
+ else {
17135
+ var formattedValue = this.getFormattedValue(value);
17136
+ index = this.value.indexOf(formattedValue);
17137
+ }
16994
17138
  if (index === -1 && this.allowCustomValue && !isNullOrUndefined(value)) {
16995
17139
  index = this.allowObjectBinding ? this.indexOfObjectInArray(value, this.value) :
16996
17140
  this.value.indexOf(value.toString());
@@ -17176,7 +17320,13 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
17176
17320
  MultiSelect.prototype.removeChip = function (value, isClearAll) {
17177
17321
  if (this.chipCollectionWrapper) {
17178
17322
  if (!(this.enableVirtualization && isClearAll)) {
17179
- var element = this.findListElement(this.chipCollectionWrapper, 'span', 'data-value', value);
17323
+ var element = void 0;
17324
+ if (value === null) {
17325
+ element = this.chipCollectionWrapper.querySelector('span.' + NULL_CHIP);
17326
+ }
17327
+ else {
17328
+ element = this.findListElement(this.chipCollectionWrapper, 'span', 'data-value', value);
17329
+ }
17180
17330
  if (element) {
17181
17331
  remove(element);
17182
17332
  }
@@ -17194,7 +17344,8 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
17194
17344
  }
17195
17345
  };
17196
17346
  MultiSelect.prototype.updateChipStatus = function () {
17197
- if (this.value && this.value.length) {
17347
+ var showChips = this.value && this.value.length && !this.isValueOnlyNull();
17348
+ if (showChips) {
17198
17349
  if (!isNullOrUndefined(this.chipCollectionWrapper)) {
17199
17350
  (this.chipCollectionWrapper.style.display = '');
17200
17351
  }
@@ -17428,10 +17579,21 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
17428
17579
  MultiSelect.prototype.getChip = function (data, value, e) {
17429
17580
  var _this = this;
17430
17581
  var itemData = { text: value, value: value };
17582
+ var isNullValue = value === null;
17583
+ var chipAttrs = { 'title': data, 'role': 'option', 'aria-selected': 'true' };
17584
+ if (isNullValue) {
17585
+ chipAttrs['data-value'] = 'null';
17586
+ }
17587
+ else {
17588
+ chipAttrs['data-value'] = value;
17589
+ }
17431
17590
  var chip = this.createElement('span', {
17432
- className: CHIP$1,
17433
- attrs: { 'data-value': value, 'title': data, 'role': 'option', 'aria-selected': 'true' }
17591
+ className: CHIP$1 + (isNullValue ? ' ' + NULL_CHIP : ''),
17592
+ attrs: chipAttrs
17434
17593
  });
17594
+ if (isNullValue) {
17595
+ addClass([chip], NULL_CHIP);
17596
+ }
17435
17597
  var compiledString;
17436
17598
  var chipContent = this.createElement('span', { className: CHIP_CONTENT$1 });
17437
17599
  var chipClose = this.createElement('span', { className: CHIP_CLOSE$1, attrs: { 'aria-hidden': 'true' } });
@@ -17453,7 +17615,8 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
17453
17615
  this.renderReactTemplates();
17454
17616
  }
17455
17617
  else if (this.enableHtmlSanitizer) {
17456
- chipContent.innerText = data;
17618
+ var displayText = (data === 'null' || data === 'undefined') ? 'null' : data;
17619
+ chipContent.innerText = displayText;
17457
17620
  }
17458
17621
  else {
17459
17622
  chipContent.innerHTML = this.encodeHtmlEntities(data.toString());
@@ -18258,6 +18421,9 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
18258
18421
  var value = this_1.allowObjectBinding ?
18259
18422
  getValue(((this_1.fields.value) ? this_1.fields.value : ''), this_1.value[this_1.value.length - 1]) :
18260
18423
  this_1.value[this_1.value.length - 1];
18424
+ if (value === null && this_1.value.length === 1) {
18425
+ return out_index_1 = index, "break";
18426
+ }
18261
18427
  if (this_1.isRemoveSelection && this_1.text) {
18262
18428
  data = this_1.text.replace(/,/g, delimiterChar + ' ') + delimiterChar + ' ';
18263
18429
  text = this_1.text.split(delimiterChar);
@@ -18403,6 +18569,18 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
18403
18569
  }
18404
18570
  return null;
18405
18571
  };
18572
+ MultiSelect.prototype.isValueOnlyNull = function () {
18573
+ if (!this.value || this.value.length === 0) {
18574
+ return false;
18575
+ }
18576
+ return this.value.every(function (v) { return v === null || v === undefined; });
18577
+ };
18578
+ MultiSelect.prototype.getTextByValue = function (value) {
18579
+ if (value === null || value === undefined) {
18580
+ return 'null';
18581
+ }
18582
+ return _super.prototype.getTextByValue.call(this, value);
18583
+ };
18406
18584
  MultiSelect.prototype.initialValueUpdate = function (listItems, isInitialVirtualData, isInitialRender) {
18407
18585
  var _this = this;
18408
18586
  if (this.list) {
@@ -18415,7 +18593,10 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
18415
18593
  this.removeListSelection();
18416
18594
  var formElement = closest(this.inputElement, 'form');
18417
18595
  if (!isNullOrUndefined(this.value)) {
18418
- for (var index = 0; !isNullOrUndefined(this.value[index]); index++) {
18596
+ for (var index = 0; index < this.value.length; index++) {
18597
+ if (this.isValueOnlyNull()) {
18598
+ continue;
18599
+ }
18419
18600
  value_2 = this.allowObjectBinding ?
18420
18601
  getValue(((this.fields.value) ? this.fields.value : ''), this.value[index]) :
18421
18602
  this.value[index];
@@ -18467,10 +18648,15 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
18467
18648
  ((!(this.dataSource instanceof DataManager)) ||
18468
18649
  (this.dataSource instanceof DataManager && isInitialVirtualData)) && (!this.isAngular || !isInitialRender ||
18469
18650
  (isNullOrUndefined(formElement) && listItems && listItems.length > 0))
18470
- && !(this.mode === 'CheckBox' && this.enableVirtualization && this.value.length > this.getSummaryTagThreshold())) {
18651
+ && !(this.mode === 'CheckBox' && this.enableVirtualization && this.value.length > this.getSummaryTagThreshold())
18652
+ && value_2 !== null) {
18471
18653
  this.value.splice(index, 1);
18472
18654
  index -= 1;
18473
18655
  }
18656
+ if (value_2 === null && isNullOrUndefined(text)) {
18657
+ text = this.getTextByValue(value_2);
18658
+ isCustomData = true;
18659
+ }
18474
18660
  }
18475
18661
  else {
18476
18662
  text = this.getTextByValue(value_2);
@@ -18481,20 +18667,23 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
18481
18667
  this.listData = savedListData;
18482
18668
  }
18483
18669
  }
18484
- if (((element && (element.getAttribute('aria-selected') !== 'true')) ||
18670
+ var shouldDisplayNull = (value_2 === null && this.value.length > 1);
18671
+ var shouldProcessElement = ((element && (element.getAttribute('aria-selected') !== 'true')) ||
18485
18672
  (element && (element.getAttribute('aria-selected') === 'true' && this.hideSelectedItem) &&
18486
- (this.mode === 'Box' || this.mode === 'Default'))) ||
18487
- (this.enableVirtualization && value_2 != null && text != null && !isCustomData)) {
18673
+ (this.mode === 'Box' || this.mode === 'Default'))) || (this.enableVirtualization && (text != null ||
18674
+ shouldDisplayNull) && !isCustomData && (value_2 != null || this.value.length > 1));
18675
+ if (shouldProcessElement) {
18488
18676
  var currentText = [];
18489
- var textValues = this.isDynamicRemoteVirtualData && text != null && text !== '' && index === 0 ? text : this.text != null && this.text !== '' && !this.text.includes(text) ? this.text + this.delimiterChar + text : text;
18677
+ var displayText = value_2 === null && (text === null || text === undefined) ? 'null' : text;
18678
+ 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;
18490
18679
  currentText.push(textValues);
18491
18680
  this.setProperties({ text: currentText.toString() }, true);
18492
- this.addChip(text, value_2);
18681
+ this.addChip(displayText, value_2);
18493
18682
  this.addListSelection(element);
18494
18683
  }
18495
- else if ((!this.enableVirtualization && value_2 && this.allowCustomValue) ||
18684
+ else if ((!this.enableVirtualization && (value_2 || this.value.length > 1) && this.allowCustomValue) ||
18496
18685
  (this.enableVirtualization &&
18497
- value_2 &&
18686
+ (value_2 || this.value.length > 1) &&
18498
18687
  this.allowCustomValue &&
18499
18688
  ((!(this.dataSource instanceof DataManager)) ||
18500
18689
  (this.dataSource instanceof DataManager && isInitialVirtualData)))) {
@@ -18531,10 +18720,11 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
18531
18720
  this.wireListEvents();
18532
18721
  }
18533
18722
  var currentText = [];
18534
- var textValues = this.text != null && this.text !== '' ? this.text + this.delimiterChar + text : text;
18723
+ var displayText = value_2 === null && (text === null || text === undefined) ? 'null' : text;
18724
+ var textValues = this.text != null && this.text !== '' ? this.text + this.delimiterChar + displayText : displayText;
18535
18725
  currentText.push(textValues);
18536
18726
  this.setProperties({ text: currentText.toString() }, true);
18537
- this.addChip(text, value_2);
18727
+ this.addChip(displayText, value_2);
18538
18728
  this.addListSelection(element);
18539
18729
  }
18540
18730
  }
@@ -18608,11 +18798,13 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
18608
18798
  };
18609
18799
  MultiSelect.prototype.updateListSelection = function (li, e, length) {
18610
18800
  var customVal = li.getAttribute('data-value');
18801
+ var actualVal = customVal === 'null' ? null : customVal;
18611
18802
  var value = this.allowObjectBinding ?
18612
- this.getDataByValue(this.getFormattedValue(customVal)) : this.getFormattedValue(customVal);
18803
+ this.getDataByValue(this.getFormattedValue(actualVal))
18804
+ : this.getFormattedValue(actualVal);
18613
18805
  if (this.allowCustomValue && ((customVal !== 'false' && value === false) ||
18614
18806
  (!isNullOrUndefined(value) && value.toString() === 'NaN'))) {
18615
- value = customVal;
18807
+ value = actualVal;
18616
18808
  }
18617
18809
  this.removeHover();
18618
18810
  if (!this.value || ((!this.allowObjectBinding && this.value.indexOf(value) === -1) ||
@@ -19257,7 +19449,10 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
19257
19449
  }
19258
19450
  this.checkClearIconWidth();
19259
19451
  if (!isNullOrUndefined(this.value) && (this.allowCustomValue || (this.listData && this.listData.length > 0))) {
19260
- for (var index = 0; !isNullOrUndefined(this.value[index]); index++) {
19452
+ for (var index = 0; index < this.value.length; index++) {
19453
+ if (this.isValueOnlyNull()) {
19454
+ continue;
19455
+ }
19261
19456
  var items = this.text && this.text.split(this.delimiterChar);
19262
19457
  if (!this.enableVirtualization) {
19263
19458
  data += (index === 0) ? '' : this.delimiterChar + ' ';