@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.
@@ -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
  /**
@@ -6267,6 +6273,7 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
6267
6273
  if (!isNullOrUndefined(_this.popupObj)) {
6268
6274
  _this.popupObj.show(new Animation(eventArgs.animation), (_this.zIndex === 1000) ? _this.element : null);
6269
6275
  _this.isPopupRender = true;
6276
+ _this.setupPopupPositionObserver();
6270
6277
  }
6271
6278
  if (_this.isReact) {
6272
6279
  setTimeout(function () {
@@ -6841,6 +6848,7 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
6841
6848
  _this.fixedHeaderElement = null;
6842
6849
  }
6843
6850
  if (!eventArgs.cancel) {
6851
+ _this.destroyPopupPositionObserver();
6844
6852
  if (_this.isPopupOpen && _this.allowFiltering && _this.isDeviceFullScreen && Browser.isDevice && Browser.isIos) {
6845
6853
  document.documentElement.scrollTo({
6846
6854
  top: _this.iOSscrollPosition.y,
@@ -6935,10 +6943,65 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
6935
6943
  }
6936
6944
  ulElement = null;
6937
6945
  };
6946
+ DropDownList.prototype.setupPopupPositionObserver = function () {
6947
+ var _this = this;
6948
+ if (!this.isAngular) {
6949
+ return;
6950
+ }
6951
+ if (!isNullOrUndefined(this.popupPositionObserver)) {
6952
+ this.popupPositionObserver.disconnect();
6953
+ }
6954
+ var observerTarget = this.inputWrapper && this.inputWrapper.container
6955
+ ? this.inputWrapper.container.parentElement
6956
+ : this.element.parentElement;
6957
+ if (isNullOrUndefined(observerTarget)) {
6958
+ return;
6959
+ }
6960
+ this.popupPositionObserver = new MutationObserver(function (mutations) {
6961
+ // Ignore the component's own changes (focus / icon-animation classes) to avoid needless refresh cycles.
6962
+ var external = mutations.some(function (m) {
6963
+ return isNullOrUndefined(_this.inputWrapper) || !_this.inputWrapper.container.contains(m.target);
6964
+ });
6965
+ if (!external) {
6966
+ return;
6967
+ }
6968
+ clearTimeout(_this.popupPositionRefreshTimer);
6969
+ _this.popupPositionRefreshTimer = setTimeout(function () {
6970
+ if (!isNullOrUndefined(_this.popupObj) &&
6971
+ !isNullOrUndefined(_this.inputWrapper)) {
6972
+ _this.popupObj.refreshPosition(_this.inputWrapper.container);
6973
+ }
6974
+ }, 0);
6975
+ });
6976
+ this.popupPositionObserver.observe(observerTarget, {
6977
+ childList: true,
6978
+ subtree: true,
6979
+ attributes: true,
6980
+ attributeFilter: ['style', 'class']
6981
+ });
6982
+ // Content added or removed before the input (for example a delayed validation message) is a direct child change
6983
+ // of one of its ancestors, so watch only those child lists (not their subtrees) up to, but excluding, the body.
6984
+ var ancestor = observerTarget.parentElement;
6985
+ while (ancestor && ancestor !== document.body && ancestor !== document.documentElement) {
6986
+ this.popupPositionObserver.observe(ancestor, { childList: true });
6987
+ ancestor = ancestor.parentElement;
6988
+ }
6989
+ };
6990
+ DropDownList.prototype.destroyPopupPositionObserver = function () {
6991
+ if (this.popupPositionRefreshTimer) {
6992
+ clearTimeout(this.popupPositionRefreshTimer);
6993
+ this.popupPositionRefreshTimer = null;
6994
+ }
6995
+ if (this.popupPositionObserver) {
6996
+ this.popupPositionObserver.disconnect();
6997
+ this.popupPositionObserver = null;
6998
+ }
6999
+ };
6938
7000
  DropDownList.prototype.destroyPopup = function () {
6939
7001
  this.isPopupOpen = false;
6940
7002
  this.isFilterFocus = false;
6941
7003
  this.inputElement.removeAttribute('aria-controls');
7004
+ this.destroyPopupPositionObserver();
6942
7005
  if (this.popupObj) {
6943
7006
  if (this.resizer) {
6944
7007
  EventHandler.remove(this.resizer, 'mousedown', this.startResizing);
@@ -7998,6 +8061,7 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
7998
8061
  * @returns {void}
7999
8062
  */
8000
8063
  DropDownList.prototype.destroy = function () {
8064
+ this.destroyPopupPositionObserver();
8001
8065
  this.isActive = false;
8002
8066
  this.isStaleFilter = false;
8003
8067
  this.filterGeneration = null;
@@ -14167,6 +14231,7 @@ var CHIP_CLOSE$1 = 'e-chips-close';
14167
14231
  var CHIP_SELECTED = 'e-chip-selected';
14168
14232
  var SEARCHBOX_WRAPPER = 'e-searcher';
14169
14233
  var DELIMITER_VIEW_WRAPPER = 'e-delimiter';
14234
+ var NULL_CHIP = 'e-chip-null';
14170
14235
  var ZERO_SIZE = 'e-zero-size';
14171
14236
  var REMAIN_WRAPPER$1 = 'e-remain';
14172
14237
  var CLOSEICON_CLASS$1 = 'e-chips-close e-close-hooker';
@@ -14631,16 +14696,24 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
14631
14696
  return;
14632
14697
  }
14633
14698
  var elements = this.chipCollectionWrapper.querySelectorAll('span.' + CHIP$1);
14634
- var value = elements[elements.length - 1].getAttribute('data-value');
14699
+ var lastElement = elements[elements.length - 1];
14700
+ var isNullChip = lastElement.classList.contains(NULL_CHIP);
14701
+ var customValue = null;
14635
14702
  if (!isNullOrUndefined(this.value)) {
14636
14703
  this.tempValues = this.allowObjectBinding ? this.value.slice() : this.value.slice();
14637
14704
  }
14638
- var customValue = this.allowObjectBinding ? this.enableVirtualization ?
14639
- this.getVirtualDataByValue(this.getFormattedValue(value)) :
14640
- this.getDataByValue(this.getFormattedValue(value)) : this.getFormattedValue(value);
14641
- if (this.allowCustomValue && (value !== 'false' && customValue === false || (!isNullOrUndefined(customValue) &&
14642
- customValue.toString() === 'NaN'))) {
14643
- customValue = value;
14705
+ if (isNullChip) {
14706
+ customValue = null;
14707
+ }
14708
+ else {
14709
+ var value = lastElement.getAttribute('data-value');
14710
+ customValue = this.allowObjectBinding ? this.enableVirtualization ?
14711
+ this.getVirtualDataByValue(this.getFormattedValue(value)) :
14712
+ this.getDataByValue(this.getFormattedValue(value)) : this.getFormattedValue(value);
14713
+ if (this.allowCustomValue && (value !== 'false' && customValue === false || (!isNullOrUndefined(customValue) &&
14714
+ customValue.toString() === 'NaN'))) {
14715
+ customValue = value;
14716
+ }
14644
14717
  }
14645
14718
  this.removeValue(customValue, e);
14646
14719
  this.removeChipSelection();
@@ -14981,48 +15054,54 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
14981
15054
  HIDE_LIST :
14982
15055
  dropDownBaseClasses.selected;
14983
15056
  if (!isNullOrUndefined(this.value)) {
14984
- for (var index = 0; !isNullOrUndefined(this.value[index]); index++) {
14985
- value = this.allowObjectBinding ? getValue((this.fields.value) ? this.fields.value : '', this.value[index]) :
14986
- this.value[index];
14987
- element = this.findListElement(this.list, 'li', 'data-value', value);
14988
- if (element) {
14989
- addClass([element], className);
14990
- if (this.hideSelectedItem && element.previousSibling
14991
- && element.previousElementSibling.classList.contains(dropDownBaseClasses.group)
14992
- && (!element.nextElementSibling ||
14993
- element.nextElementSibling.classList.contains(dropDownBaseClasses.group))) {
14994
- addClass([element.previousElementSibling], className);
14995
- }
14996
- if (this.hideSelectedItem && this.fields.groupBy && !element.previousElementSibling.classList.contains(HIDE_LIST)) {
14997
- this.hideGroupItem(value);
14998
- }
14999
- if (this.hideSelectedItem && element.classList.contains(dropDownBaseClasses.focus)) {
15000
- removeClass([element], dropDownBaseClasses.focus);
15001
- var listEle = element.parentElement.querySelectorAll('.' +
15002
- dropDownBaseClasses.li + ':not(.' + HIDE_LIST + ')' + ':not(.' + DISABLED$1 + ')');
15003
- if (listEle.length > 0) {
15004
- addClass([listEle[0]], dropDownBaseClasses.focus);
15005
- this.updateAriaActiveDescendant();
15057
+ var isOnlyNull = this.isValueOnlyNull();
15058
+ if (!isOnlyNull) {
15059
+ for (var index = 0; index < this.value.length; index++) {
15060
+ value = this.allowObjectBinding ? getValue((this.fields.value) ? this.fields.value : '', this.value[index]) :
15061
+ this.value[index];
15062
+ if (isNullOrUndefined(value)) {
15063
+ continue;
15064
+ }
15065
+ element = this.findListElement(this.list, 'li', 'data-value', value);
15066
+ if (element) {
15067
+ addClass([element], className);
15068
+ if (this.hideSelectedItem && element.previousSibling
15069
+ && element.previousElementSibling.classList.contains(dropDownBaseClasses.group)
15070
+ && (!element.nextElementSibling ||
15071
+ element.nextElementSibling.classList.contains(dropDownBaseClasses.group))) {
15072
+ addClass([element.previousElementSibling], className);
15006
15073
  }
15007
- else {
15008
- //EJ2-57588 - for this task, we prevent the ul element cloning ( this.ulElement = this.ulElement.cloneNode ? <HTMLElement>this.ulElement.cloneNode(true) : this.ulElement;)
15009
- if (!(this.list && this.list.querySelectorAll('.' + dropDownBaseClasses.li).length > 0)) {
15010
- this.l10nUpdate();
15011
- addClass([this.list], dropDownBaseClasses.noData);
15074
+ if (this.hideSelectedItem && this.fields.groupBy && !element.previousElementSibling.classList.contains(HIDE_LIST)) {
15075
+ this.hideGroupItem(value);
15076
+ }
15077
+ if (this.hideSelectedItem && element.classList.contains(dropDownBaseClasses.focus)) {
15078
+ removeClass([element], dropDownBaseClasses.focus);
15079
+ var listEle = element.parentElement.querySelectorAll('.' +
15080
+ dropDownBaseClasses.li + ':not(.' + HIDE_LIST + ')' + ':not(.' + DISABLED$1 + ')');
15081
+ if (listEle.length > 0) {
15082
+ addClass([listEle[0]], dropDownBaseClasses.focus);
15083
+ this.updateAriaActiveDescendant();
15084
+ }
15085
+ else {
15086
+ //EJ2-57588 - for this task, we prevent the ul element cloning ( this.ulElement = this.ulElement.cloneNode ? <HTMLElement>this.ulElement.cloneNode(true) : this.ulElement;)
15087
+ if (!(this.list && this.list.querySelectorAll('.' + dropDownBaseClasses.li).length > 0)) {
15088
+ this.l10nUpdate();
15089
+ addClass([this.list], dropDownBaseClasses.noData);
15090
+ }
15012
15091
  }
15013
15092
  }
15014
- }
15015
- element.setAttribute('aria-selected', 'true');
15016
- if (this.mode === 'CheckBox' && element.classList.contains('e-active')) {
15017
- var ariaValue = element.getElementsByClassName('e-check').length;
15018
- if (ariaValue === 0) {
15019
- var args = {
15020
- module: 'CheckBoxSelection',
15021
- enable: this.mode === 'CheckBox',
15022
- li: element,
15023
- e: null
15024
- };
15025
- this.notify('updatelist', args);
15093
+ element.setAttribute('aria-selected', 'true');
15094
+ if (this.mode === 'CheckBox' && element.classList.contains('e-active')) {
15095
+ var ariaValue = element.getElementsByClassName('e-check').length;
15096
+ if (ariaValue === 0) {
15097
+ var args = {
15098
+ module: 'CheckBoxSelection',
15099
+ enable: this.mode === 'CheckBox',
15100
+ li: element,
15101
+ e: null
15102
+ };
15103
+ this.notify('updatelist', args);
15104
+ }
15026
15105
  }
15027
15106
  }
15028
15107
  }
@@ -15810,13 +15889,26 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
15810
15889
  var activeItem = !isNullOrUndefined(this.ulElement)
15811
15890
  ? this.ulElement.getElementsByClassName('e-item-focus')[0]
15812
15891
  : null;
15892
+ var filterInput = this.allowFiltering && !isNullOrUndefined(this.popupWrapper)
15893
+ ? this.popupWrapper.querySelector('.' + FILTERINPUT)
15894
+ : null;
15813
15895
  if (!isNullOrUndefined(activeItem) && this.isPopupOpen()) {
15814
15896
  attributes(this.inputElement, {
15815
15897
  'aria-activedescendant': activeItem.id
15816
15898
  });
15899
+ if (filterInput) {
15900
+ attributes(filterInput, {
15901
+ 'aria-activedescendant': activeItem.id
15902
+ });
15903
+ }
15817
15904
  }
15818
- else if (!isNullOrUndefined(this.inputElement)) {
15819
- this.inputElement.removeAttribute('aria-activedescendant');
15905
+ else {
15906
+ if (!isNullOrUndefined(this.inputElement)) {
15907
+ this.inputElement.removeAttribute('aria-activedescendant');
15908
+ }
15909
+ if (filterInput) {
15910
+ filterInput.removeAttribute('aria-activedescendant');
15911
+ }
15820
15912
  }
15821
15913
  };
15822
15914
  MultiSelect.prototype.pageUpSelection = function (steps, isVirtualKeyAction) {
@@ -16645,9 +16737,16 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
16645
16737
  this.removeChipSelection();
16646
16738
  this.addChipSelection(temp, e);
16647
16739
  }
16648
- var currentChip = this.allowObjectBinding ?
16649
- this.getDataByValue(this.getFormattedValue(selectedElem.getAttribute('data-value'))) :
16650
- selectedElem.getAttribute('data-value');
16740
+ var isNullChip = selectedElem.classList.contains(NULL_CHIP);
16741
+ var currentChip = void 0;
16742
+ if (isNullChip) {
16743
+ currentChip = null;
16744
+ }
16745
+ else {
16746
+ currentChip = this.allowObjectBinding ?
16747
+ this.getDataByValue(this.getFormattedValue(selectedElem.getAttribute('data-value'))) :
16748
+ selectedElem.getAttribute('data-value');
16749
+ }
16651
16750
  this.removeValue(currentChip, e);
16652
16751
  this.updateDelimeter(this.delimiterChar, e);
16653
16752
  this.makeTextBoxEmpty();
@@ -16905,7 +17004,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
16905
17004
  if (type === 'string' || type === 'number' || type === 'boolean') {
16906
17005
  for (var _i = 0, _a = this.selectedListData; _i < _a.length; _i++) {
16907
17006
  var item = _a[_i];
16908
- if (!isNullOrUndefined(item) && item === value) {
17007
+ if (item === value || (isNullOrUndefined(item) && value === null)) {
16909
17008
  return item;
16910
17009
  }
16911
17010
  }
@@ -16913,8 +17012,11 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
16913
17012
  else {
16914
17013
  for (var _b = 0, _c = this.selectedListData; _b < _c.length; _b++) {
16915
17014
  var item = _c[_b];
16916
- if (!isNullOrUndefined(item) && getValue((this.fields.value ? this.fields.value : 'value'), item) === value) {
16917
- return item;
17015
+ if (item !== undefined) {
17016
+ var itemValue = getValue((this.fields.value ? this.fields.value : 'value'), item);
17017
+ if (itemValue === value || (isNullOrUndefined(itemValue) && value === null)) {
17018
+ return item;
17019
+ }
16918
17020
  }
16919
17021
  }
16920
17022
  }
@@ -16927,13 +17029,21 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
16927
17029
  }
16928
17030
  if (this.enabled && !this.readonly) {
16929
17031
  var element = e.target.parentElement;
16930
- var customVal = element.getAttribute('data-value');
16931
- var value = this.allowObjectBinding ? this.enableVirtualization ?
16932
- this.getVirtualDataByValue(this.getFormattedValue(customVal)) :
16933
- this.getDataByValue(this.getFormattedValue(customVal)) : this.getFormattedValue(customVal);
16934
- if (this.allowCustomValue && ((customVal !== 'false' && value === false) ||
16935
- (!isNullOrUndefined(value) && value.toString() === 'NaN'))) {
16936
- value = customVal;
17032
+ var isNullChip = element.classList.contains(NULL_CHIP);
17033
+ var value = void 0;
17034
+ if (isNullChip) {
17035
+ value = null;
17036
+ }
17037
+ else {
17038
+ var customVal = element.getAttribute('data-value');
17039
+ var formattedVal = this.getFormattedValue(customVal);
17040
+ value = this.allowObjectBinding ? this.enableVirtualization ?
17041
+ this.getVirtualDataByValue(formattedVal) :
17042
+ this.getDataByValue(formattedVal) : formattedVal;
17043
+ if (this.allowCustomValue && ((customVal !== 'false' && value === false) ||
17044
+ (!isNullOrUndefined(value) && value.toString() === 'NaN'))) {
17045
+ value = customVal;
17046
+ }
16937
17047
  }
16938
17048
  if (this.isPopupOpen() && this.mode !== 'CheckBox') {
16939
17049
  this.hidePopup(e);
@@ -16942,6 +17052,14 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
16942
17052
  this.inputElement.focus();
16943
17053
  }
16944
17054
  this.removeValue(value, e);
17055
+ if (!isNullChip) {
17056
+ var findValue = this.allowObjectBinding ? getValue((this.fields.value) ? this.fields.value : '', value) : value;
17057
+ if (isNullOrUndefined(this.findListElement(this.list, 'li', 'data-value', findValue)) &&
17058
+ this.mainList && this.listData) {
17059
+ var list = this.mainList.cloneNode ? this.mainList.cloneNode(true) : this.mainList;
17060
+ this.onActionComplete(list, this.mainData);
17061
+ }
17062
+ }
16945
17063
  value = this.allowObjectBinding ? getValue((this.fields.value) ? this.fields.value : '', value) : value;
16946
17064
  if (isNullOrUndefined(this.findListElement(this.list, 'li', 'data-value', value)) &&
16947
17065
  this.mainList && this.listData) {
@@ -17020,8 +17138,17 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
17020
17138
  };
17021
17139
  MultiSelect.prototype.removeValue = function (value, eve, length, isClearAll) {
17022
17140
  var _this = this;
17023
- var index = this.allowObjectBinding ? this.indexOfObjectInArray(value, this.value) :
17024
- this.value.indexOf(this.getFormattedValue(value));
17141
+ var index = -1;
17142
+ if (value === null) {
17143
+ index = this.value.indexOf(null);
17144
+ }
17145
+ else if (this.allowObjectBinding) {
17146
+ index = this.indexOfObjectInArray(value, this.value);
17147
+ }
17148
+ else {
17149
+ var formattedValue = this.getFormattedValue(value);
17150
+ index = this.value.indexOf(formattedValue);
17151
+ }
17025
17152
  if (index === -1 && this.allowCustomValue && !isNullOrUndefined(value)) {
17026
17153
  index = this.allowObjectBinding ? this.indexOfObjectInArray(value, this.value) :
17027
17154
  this.value.indexOf(value.toString());
@@ -17207,7 +17334,13 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
17207
17334
  MultiSelect.prototype.removeChip = function (value, isClearAll) {
17208
17335
  if (this.chipCollectionWrapper) {
17209
17336
  if (!(this.enableVirtualization && isClearAll)) {
17210
- var element = this.findListElement(this.chipCollectionWrapper, 'span', 'data-value', value);
17337
+ var element = void 0;
17338
+ if (value === null) {
17339
+ element = this.chipCollectionWrapper.querySelector('span.' + NULL_CHIP);
17340
+ }
17341
+ else {
17342
+ element = this.findListElement(this.chipCollectionWrapper, 'span', 'data-value', value);
17343
+ }
17211
17344
  if (element) {
17212
17345
  remove(element);
17213
17346
  }
@@ -17225,7 +17358,8 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
17225
17358
  }
17226
17359
  };
17227
17360
  MultiSelect.prototype.updateChipStatus = function () {
17228
- if (this.value && this.value.length) {
17361
+ var showChips = this.value && this.value.length && !this.isValueOnlyNull();
17362
+ if (showChips) {
17229
17363
  if (!isNullOrUndefined(this.chipCollectionWrapper)) {
17230
17364
  (this.chipCollectionWrapper.style.display = '');
17231
17365
  }
@@ -17459,10 +17593,21 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
17459
17593
  MultiSelect.prototype.getChip = function (data, value, e) {
17460
17594
  var _this = this;
17461
17595
  var itemData = { text: value, value: value };
17596
+ var isNullValue = value === null;
17597
+ var chipAttrs = { 'title': data, 'role': 'option', 'aria-selected': 'true' };
17598
+ if (isNullValue) {
17599
+ chipAttrs['data-value'] = 'null';
17600
+ }
17601
+ else {
17602
+ chipAttrs['data-value'] = value;
17603
+ }
17462
17604
  var chip = this.createElement('span', {
17463
- className: CHIP$1,
17464
- attrs: { 'data-value': value, 'title': data, 'role': 'option', 'aria-selected': 'true' }
17605
+ className: CHIP$1 + (isNullValue ? ' ' + NULL_CHIP : ''),
17606
+ attrs: chipAttrs
17465
17607
  });
17608
+ if (isNullValue) {
17609
+ addClass([chip], NULL_CHIP);
17610
+ }
17466
17611
  var compiledString;
17467
17612
  var chipContent = this.createElement('span', { className: CHIP_CONTENT$1 });
17468
17613
  var chipClose = this.createElement('span', { className: CHIP_CLOSE$1, attrs: { 'aria-hidden': 'true' } });
@@ -17484,7 +17629,8 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
17484
17629
  this.renderReactTemplates();
17485
17630
  }
17486
17631
  else if (this.enableHtmlSanitizer) {
17487
- chipContent.innerText = data;
17632
+ var displayText = (data === 'null' || data === 'undefined') ? 'null' : data;
17633
+ chipContent.innerText = displayText;
17488
17634
  }
17489
17635
  else {
17490
17636
  chipContent.innerHTML = this.encodeHtmlEntities(data.toString());
@@ -18289,6 +18435,9 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
18289
18435
  var value = this_1.allowObjectBinding ?
18290
18436
  getValue(((this_1.fields.value) ? this_1.fields.value : ''), this_1.value[this_1.value.length - 1]) :
18291
18437
  this_1.value[this_1.value.length - 1];
18438
+ if (value === null && this_1.value.length === 1) {
18439
+ return out_index_1 = index, "break";
18440
+ }
18292
18441
  if (this_1.isRemoveSelection && this_1.text) {
18293
18442
  data = this_1.text.replace(/,/g, delimiterChar + ' ') + delimiterChar + ' ';
18294
18443
  text = this_1.text.split(delimiterChar);
@@ -18434,6 +18583,18 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
18434
18583
  }
18435
18584
  return null;
18436
18585
  };
18586
+ MultiSelect.prototype.isValueOnlyNull = function () {
18587
+ if (!this.value || this.value.length === 0) {
18588
+ return false;
18589
+ }
18590
+ return this.value.every(function (v) { return v === null || v === undefined; });
18591
+ };
18592
+ MultiSelect.prototype.getTextByValue = function (value) {
18593
+ if (value === null || value === undefined) {
18594
+ return 'null';
18595
+ }
18596
+ return _super.prototype.getTextByValue.call(this, value);
18597
+ };
18437
18598
  MultiSelect.prototype.initialValueUpdate = function (listItems, isInitialVirtualData, isInitialRender) {
18438
18599
  var _this = this;
18439
18600
  if (this.list) {
@@ -18446,7 +18607,10 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
18446
18607
  this.removeListSelection();
18447
18608
  var formElement = closest(this.inputElement, 'form');
18448
18609
  if (!isNullOrUndefined(this.value)) {
18449
- for (var index = 0; !isNullOrUndefined(this.value[index]); index++) {
18610
+ for (var index = 0; index < this.value.length; index++) {
18611
+ if (this.isValueOnlyNull()) {
18612
+ continue;
18613
+ }
18450
18614
  value_2 = this.allowObjectBinding ?
18451
18615
  getValue(((this.fields.value) ? this.fields.value : ''), this.value[index]) :
18452
18616
  this.value[index];
@@ -18498,10 +18662,15 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
18498
18662
  ((!(this.dataSource instanceof DataManager)) ||
18499
18663
  (this.dataSource instanceof DataManager && isInitialVirtualData)) && (!this.isAngular || !isInitialRender ||
18500
18664
  (isNullOrUndefined(formElement) && listItems && listItems.length > 0))
18501
- && !(this.mode === 'CheckBox' && this.enableVirtualization && this.value.length > this.getSummaryTagThreshold())) {
18665
+ && !(this.mode === 'CheckBox' && this.enableVirtualization && this.value.length > this.getSummaryTagThreshold())
18666
+ && value_2 !== null) {
18502
18667
  this.value.splice(index, 1);
18503
18668
  index -= 1;
18504
18669
  }
18670
+ if (value_2 === null && isNullOrUndefined(text)) {
18671
+ text = this.getTextByValue(value_2);
18672
+ isCustomData = true;
18673
+ }
18505
18674
  }
18506
18675
  else {
18507
18676
  text = this.getTextByValue(value_2);
@@ -18512,20 +18681,23 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
18512
18681
  this.listData = savedListData;
18513
18682
  }
18514
18683
  }
18515
- if (((element && (element.getAttribute('aria-selected') !== 'true')) ||
18684
+ var shouldDisplayNull = (value_2 === null && this.value.length > 1);
18685
+ var shouldProcessElement = ((element && (element.getAttribute('aria-selected') !== 'true')) ||
18516
18686
  (element && (element.getAttribute('aria-selected') === 'true' && this.hideSelectedItem) &&
18517
- (this.mode === 'Box' || this.mode === 'Default'))) ||
18518
- (this.enableVirtualization && value_2 != null && text != null && !isCustomData)) {
18687
+ (this.mode === 'Box' || this.mode === 'Default'))) || (this.enableVirtualization && (text != null ||
18688
+ shouldDisplayNull) && !isCustomData && (value_2 != null || this.value.length > 1));
18689
+ if (shouldProcessElement) {
18519
18690
  var currentText = [];
18520
- 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;
18691
+ var displayText = value_2 === null && (text === null || text === undefined) ? 'null' : text;
18692
+ 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;
18521
18693
  currentText.push(textValues);
18522
18694
  this.setProperties({ text: currentText.toString() }, true);
18523
- this.addChip(text, value_2);
18695
+ this.addChip(displayText, value_2);
18524
18696
  this.addListSelection(element);
18525
18697
  }
18526
- else if ((!this.enableVirtualization && value_2 && this.allowCustomValue) ||
18698
+ else if ((!this.enableVirtualization && (value_2 || this.value.length > 1) && this.allowCustomValue) ||
18527
18699
  (this.enableVirtualization &&
18528
- value_2 &&
18700
+ (value_2 || this.value.length > 1) &&
18529
18701
  this.allowCustomValue &&
18530
18702
  ((!(this.dataSource instanceof DataManager)) ||
18531
18703
  (this.dataSource instanceof DataManager && isInitialVirtualData)))) {
@@ -18562,10 +18734,11 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
18562
18734
  this.wireListEvents();
18563
18735
  }
18564
18736
  var currentText = [];
18565
- var textValues = this.text != null && this.text !== '' ? this.text + this.delimiterChar + text : text;
18737
+ var displayText = value_2 === null && (text === null || text === undefined) ? 'null' : text;
18738
+ var textValues = this.text != null && this.text !== '' ? this.text + this.delimiterChar + displayText : displayText;
18566
18739
  currentText.push(textValues);
18567
18740
  this.setProperties({ text: currentText.toString() }, true);
18568
- this.addChip(text, value_2);
18741
+ this.addChip(displayText, value_2);
18569
18742
  this.addListSelection(element);
18570
18743
  }
18571
18744
  }
@@ -18639,11 +18812,13 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
18639
18812
  };
18640
18813
  MultiSelect.prototype.updateListSelection = function (li, e, length) {
18641
18814
  var customVal = li.getAttribute('data-value');
18815
+ var actualVal = customVal === 'null' ? null : customVal;
18642
18816
  var value = this.allowObjectBinding ?
18643
- this.getDataByValue(this.getFormattedValue(customVal)) : this.getFormattedValue(customVal);
18817
+ this.getDataByValue(this.getFormattedValue(actualVal))
18818
+ : this.getFormattedValue(actualVal);
18644
18819
  if (this.allowCustomValue && ((customVal !== 'false' && value === false) ||
18645
18820
  (!isNullOrUndefined(value) && value.toString() === 'NaN'))) {
18646
- value = customVal;
18821
+ value = actualVal;
18647
18822
  }
18648
18823
  this.removeHover();
18649
18824
  if (!this.value || ((!this.allowObjectBinding && this.value.indexOf(value) === -1) ||
@@ -19288,7 +19463,10 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
19288
19463
  }
19289
19464
  this.checkClearIconWidth();
19290
19465
  if (!isNullOrUndefined(this.value) && (this.allowCustomValue || (this.listData && this.listData.length > 0))) {
19291
- for (var index = 0; !isNullOrUndefined(this.value[index]); index++) {
19466
+ for (var index = 0; index < this.value.length; index++) {
19467
+ if (this.isValueOnlyNull()) {
19468
+ continue;
19469
+ }
19292
19470
  var items = this.text && this.text.split(this.delimiterChar);
19293
19471
  if (!this.enableVirtualization) {
19294
19472
  data += (index === 0) ? '' : this.delimiterChar + ' ';