@syncfusion/ej2-dropdowns 24.2.3 → 24.2.5

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.
@@ -842,7 +842,7 @@ let DropDownBase = class DropDownBase extends Component {
842
842
  }
843
843
  }
844
844
  else {
845
- if (noDataElement[i] instanceof HTMLElement) {
845
+ if (noDataElement[i] instanceof HTMLElement || noDataElement[i] instanceof Text) {
846
846
  ele.appendChild(noDataElement[i]);
847
847
  }
848
848
  }
@@ -3339,6 +3339,9 @@ let DropDownList = class DropDownList extends DropDownBase {
3339
3339
  if (this.inputWrapper.container.classList.contains(dropDownListClasses.inputFocus) || this.isPopupOpen) {
3340
3340
  this.isDocumentClick = true;
3341
3341
  const isActive = this.isRequested;
3342
+ if (this.getModuleName() === 'combobox' && this.isTyped) {
3343
+ this.isInteracted = false;
3344
+ }
3342
3345
  this.hidePopup(e);
3343
3346
  this.isInteracted = false;
3344
3347
  if (!isActive) {
@@ -4024,6 +4027,11 @@ let DropDownList = class DropDownList extends DropDownBase {
4024
4027
  this.virtualListInfo = null;
4025
4028
  }
4026
4029
  this.resetList(dataSource, fields, query);
4030
+ if (this.getModuleName() === 'dropdownlist' && this.list.classList.contains(dropDownBaseClasses.noData)) {
4031
+ this.popupContentElement.setAttribute('role', 'status');
4032
+ this.popupContentElement.setAttribute('id', 'no-record');
4033
+ attributes(this.filterInputObj.container, { 'aria-activedescendant': 'no-record' });
4034
+ }
4027
4035
  if (this.enableVirtualization && isNoData && !this.list.classList.contains(dropDownBaseClasses.noData)) {
4028
4036
  if (!this.list.querySelector('.e-virtual-ddl-content')) {
4029
4037
  this.list.appendChild(this.createElement('div', {
@@ -4564,6 +4572,11 @@ let DropDownList = class DropDownList extends DropDownBase {
4564
4572
  }, 5);
4565
4573
  }
4566
4574
  attributes(this.targetElement(), { 'aria-expanded': 'true', 'aria-owns': this.element.id + '_popup', 'aria-controls': this.element.id });
4575
+ if (this.getModuleName() !== 'dropdownlist' && this.list.classList.contains('e-nodata')) {
4576
+ attributes(this.targetElement(), { 'aria-activedescendant': 'no-record' });
4577
+ this.popupContentElement.setAttribute('role', 'status');
4578
+ this.popupContentElement.setAttribute('id', 'no-record');
4579
+ }
4567
4580
  this.inputElement.setAttribute('aria-expanded', 'true');
4568
4581
  this.inputElement.setAttribute('aria-controls', this.element.id);
4569
4582
  const inputParent = this.isFiltering() ? this.filterInput.parentElement : this.inputWrapper.container;
@@ -5850,6 +5863,9 @@ let DropDownList = class DropDownList extends DropDownBase {
5850
5863
  this.clearTemplate();
5851
5864
  }
5852
5865
  this.hidePopup();
5866
+ if (this.popupObj) {
5867
+ this.popupObj.hide();
5868
+ }
5853
5869
  this.unWireEvent();
5854
5870
  if (this.list) {
5855
5871
  this.unWireListEvents();
@@ -7922,9 +7938,6 @@ let DropDownTree = class DropDownTree extends Component {
7922
7938
  if (this.value === null) {
7923
7939
  this.setProperties({ value: [] }, true);
7924
7940
  }
7925
- if (args.node.classList.contains("e-active")) {
7926
- this.hidePopup();
7927
- }
7928
7941
  }
7929
7942
  }
7930
7943
  updateHiddenValue() {
@@ -11146,6 +11159,11 @@ let MultiSelect = class MultiSelect extends DropDownBase {
11146
11159
  }
11147
11160
  }
11148
11161
  removelastSelection(e) {
11162
+ const selectedElem = this.chipCollectionWrapper.querySelector('span.' + CHIP_SELECTED);
11163
+ if (selectedElem !== null) {
11164
+ this.removeSelectedChip(e);
11165
+ return;
11166
+ }
11149
11167
  const elements = this.chipCollectionWrapper.querySelectorAll('span.' + CHIP$1);
11150
11168
  const value = elements[elements.length - 1].getAttribute('data-value');
11151
11169
  if (!isNullOrUndefined(this.value)) {
@@ -11222,6 +11240,12 @@ let MultiSelect = class MultiSelect extends DropDownBase {
11222
11240
  else {
11223
11241
  this.updateActionList(ulElement, list, e);
11224
11242
  }
11243
+ if (this.dataSource instanceof DataManager && this.allowCustomValue && !this.isCustomRendered && this.inputElement.value && this.inputElement.value !== '') {
11244
+ let query = new Query();
11245
+ query = this.allowFiltering ? query.where(this.fields.text, 'startswith', this.inputElement.value, this.ignoreCase, this.ignoreAccent) : query;
11246
+ this.checkForCustomValue(query, this.fields);
11247
+ this.isCustomRendered = true;
11248
+ }
11225
11249
  if (this.dataSource instanceof DataManager && this.mode === 'CheckBox' && this.allowFiltering) {
11226
11250
  this.removeFocus();
11227
11251
  }
@@ -11243,7 +11267,9 @@ let MultiSelect = class MultiSelect extends DropDownBase {
11243
11267
  if ((this.remoteCustomValue || list.length <= 0) && this.allowCustomValue && this.inputFocus && this.allowFiltering &&
11244
11268
  this.inputElement.value && this.inputElement.value !== '') {
11245
11269
  this.checkForCustomValue(this.tempQuery, this.fields);
11246
- return;
11270
+ if (this.isCustomRendered) {
11271
+ return;
11272
+ }
11247
11273
  }
11248
11274
  if (this.value && this.value.length && ((this.mode !== 'CheckBox' && !isNullOrUndefined(this.inputElement) && this.inputElement.value.trim() !== '') ||
11249
11275
  this.mode === 'CheckBox' || ((this.keyCode === 8 || this.keyCode === 46) && this.allowFiltering &&
@@ -11510,12 +11536,12 @@ let MultiSelect = class MultiSelect extends DropDownBase {
11510
11536
  }
11511
11537
  checkForCustomValue(query, fields) {
11512
11538
  const dataChecks = !this.getValueByText(this.inputElement.value, this.ignoreCase);
11539
+ const field = fields ? fields : this.fields;
11513
11540
  if (this.allowCustomValue && dataChecks) {
11514
11541
  const value = this.inputElement.value;
11515
- const field = fields ? fields : this.fields;
11516
11542
  const customData = (!isNullOrUndefined(this.mainData) && this.mainData.length > 0) ?
11517
11543
  this.mainData[0] : this.mainData;
11518
- if (typeof (customData) !== 'string' && typeof (customData) !== 'number' && typeof (customData) !== 'boolean') {
11544
+ if (customData && typeof (customData) !== 'string' && typeof (customData) !== 'number' && typeof (customData) !== 'boolean') {
11519
11545
  const dataItem = {};
11520
11546
  setValue(field.text, value, dataItem);
11521
11547
  if (typeof getValue((this.fields.value ? this.fields.value : 'value'), customData)
@@ -11529,7 +11555,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
11529
11555
  tempData.splice(0, 0, dataItem);
11530
11556
  this.resetList(tempData, field, query);
11531
11557
  }
11532
- else {
11558
+ else if (this.listData) {
11533
11559
  const tempData = JSON.parse(JSON.stringify(this.listData));
11534
11560
  tempData.splice(0, 0, this.inputElement.value);
11535
11561
  tempData[0] = (typeof customData === 'number' && !isNaN(parseFloat(tempData[0]))) ?
@@ -11539,6 +11565,19 @@ let MultiSelect = class MultiSelect extends DropDownBase {
11539
11565
  this.resetList(tempData, field);
11540
11566
  }
11541
11567
  }
11568
+ else if (this.listData && this.mainData && !dataChecks && this.allowCustomValue) {
11569
+ if (this.allowFiltering && this.isRemoteSelection && this.remoteCustomValue) {
11570
+ this.isRemoteSelection = false;
11571
+ this.resetList(this.listData, field, query);
11572
+ }
11573
+ else if (!this.allowFiltering && this.list) {
11574
+ const liCollections = this.list.querySelectorAll('li.' + dropDownBaseClasses.li + ':not(.e-hide-listitem)');
11575
+ const activeElement = Search(this.targetElement(), liCollections, 'StartsWith', this.ignoreCase);
11576
+ if (activeElement && activeElement.item !== null) {
11577
+ this.addListFocus(activeElement.item);
11578
+ }
11579
+ }
11580
+ }
11542
11581
  if (this.value && this.value.length) {
11543
11582
  this.refreshSelection();
11544
11583
  }
@@ -13159,6 +13198,9 @@ let MultiSelect = class MultiSelect extends DropDownBase {
13159
13198
  else {
13160
13199
  const text = this.targetElement();
13161
13200
  if (this.allowFiltering) {
13201
+ if (this.allowCustomValue) {
13202
+ this.isRemoteSelection = true;
13203
+ }
13162
13204
  const eventArgs = {
13163
13205
  preventDefaultAction: false,
13164
13206
  text: this.targetElement(),
@@ -13184,7 +13226,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
13184
13226
  }
13185
13227
  else if (this.allowCustomValue) {
13186
13228
  let query = new Query();
13187
- query = (text !== '') ? query.where(this.fields.text, 'startswith', text, this.ignoreCase, this.ignoreAccent) : query;
13229
+ query = this.allowFiltering && (text !== '') ? query.where(this.fields.text, 'startswith', text, this.ignoreCase, this.ignoreAccent) : query;
13188
13230
  this.dataUpdater(this.mainData, query, this.fields);
13189
13231
  }
13190
13232
  else {
@@ -13226,6 +13268,8 @@ let MultiSelect = class MultiSelect extends DropDownBase {
13226
13268
  this.focused = true;
13227
13269
  this.initial = true;
13228
13270
  this.backCommand = true;
13271
+ this.isCustomRendered = false;
13272
+ this.isRemoteSelection = false;
13229
13273
  }
13230
13274
  updateData(delimiterChar, e) {
13231
13275
  let data = '';
@@ -13268,7 +13312,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
13268
13312
  if (delim) {
13269
13313
  this.updateWrapperText(this.delimiterWrapper, data);
13270
13314
  this.delimiterWrapper.setAttribute('id', getUniqueID('delim_val'));
13271
- this.inputElement.setAttribute('aria-labelledby', this.delimiterWrapper.id);
13315
+ this.inputElement.setAttribute('aria-describedby', this.delimiterWrapper.id);
13272
13316
  }
13273
13317
  const targetEle = e && e.target;
13274
13318
  const isClearAll = (targetEle && targetEle.classList.contains('e-close-hooker')) ? true : null;
@@ -14238,7 +14282,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
14238
14282
  this.hiddenElement.innerHTML = hiddenValue;
14239
14283
  this.updateWrapperText(this.delimiterWrapper, wrapperText);
14240
14284
  this.delimiterWrapper.setAttribute('id', getUniqueID('delim_val'));
14241
- this.inputElement.setAttribute('aria-labelledby', this.delimiterWrapper.id);
14285
+ this.inputElement.setAttribute('aria-describedby', this.delimiterWrapper.id);
14242
14286
  this.setProperties({ text: text.toString() }, true);
14243
14287
  this.refreshInputHight();
14244
14288
  this.refreshPlaceHolder();
@@ -14748,7 +14792,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
14748
14792
  }
14749
14793
  });
14750
14794
  if (this.mode === 'Default' || this.mode === 'Box') {
14751
- this.inputElement.setAttribute('aria-labelledby', this.chipCollectionWrapper.id);
14795
+ this.inputElement.setAttribute('aria-describedby', this.chipCollectionWrapper.id);
14752
14796
  }
14753
14797
  if (this.element.tagName !== this.getNgDirective()) {
14754
14798
  this.element.style.display = 'none';
@@ -14997,7 +15041,7 @@ __decorate$5([
14997
15041
  Property(true)
14998
15042
  ], MultiSelect.prototype, "enabled", void 0);
14999
15043
  __decorate$5([
15000
- Property(false)
15044
+ Property(true)
15001
15045
  ], MultiSelect.prototype, "enableHtmlSanitizer", void 0);
15002
15046
  __decorate$5([
15003
15047
  Property([])
@@ -15765,6 +15809,13 @@ let ListBox = ListBox_1 = class ListBox extends DropDownBase {
15765
15809
  * @returns {void}
15766
15810
  */
15767
15811
  render() {
15812
+ if (this.isAngular && this.allowFiltering) {
15813
+ const originalElement = this.element;
15814
+ const clonedElement = originalElement.cloneNode(true);
15815
+ originalElement.parentNode.replaceChild(clonedElement, originalElement);
15816
+ this.element = clonedElement;
15817
+ setValue('ej2_instances', [this], this.element);
15818
+ }
15768
15819
  this.inputString = '';
15769
15820
  this.initLoad = true;
15770
15821
  this.isCustomFiltering = false;
@@ -18398,7 +18449,7 @@ let Mention = class Mention extends DropDownBase {
18398
18449
  rangetextContent = this.range.startContainer.textContent.split('');
18399
18450
  }
18400
18451
  let currentRange = this.getTextRange();
18401
- const lastWordRange = this.getLastLetter(currentRange);
18452
+ let lastWordRange = this.getLastLetter(currentRange);
18402
18453
  const lastTwoLetters = this.mentionChar.toString() + this.mentionChar.toString();
18403
18454
  // eslint-disable-next-line security/detect-non-literal-regexp
18404
18455
  const Regex = new RegExp(this.mentionChar.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&'), 'g');
@@ -18428,7 +18479,9 @@ let Mention = class Mention extends DropDownBase {
18428
18479
  }
18429
18480
  return;
18430
18481
  }
18431
- this.queryString = lastWordRange.replace(this.mentionChar, '');
18482
+ if (lastWordRange.includes(this.mentionChar)) {
18483
+ this.queryString = lastWordRange.replace(this.mentionChar, '');
18484
+ }
18432
18485
  if (this.mentionChar.charCodeAt(0) === lastWordRange.charCodeAt(0) &&
18433
18486
  this.queryString !== '' && e.keyCode !== 38 && e.keyCode !== 40 && !this.lineBreak) {
18434
18487
  this.searchLists(e);
@@ -18772,6 +18825,7 @@ let Mention = class Mention extends DropDownBase {
18772
18825
  this.inputElement.parentElement.parentElement.classList.contains('e-richtexteditor')) {
18773
18826
  if (popupEle.firstElementChild && popupEle.firstElementChild.childElementCount > 0) {
18774
18827
  popupEle.firstElementChild.setAttribute('aria-owns', this.inputElement.parentElement.parentElement.id);
18828
+ addClass([popupEle], 'e-rte-elements');
18775
18829
  }
18776
18830
  }
18777
18831
  if ((!this.popupObj || !document.body.contains(this.popupObj.element)) ||