@syncfusion/ej2-dropdowns 33.2.3 → 33.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.
@@ -928,6 +928,7 @@ let DropDownBase = class DropDownBase extends Component {
928
928
  this.isVirtualTrackHeight = false;
929
929
  this.virtualSelectAll = false;
930
930
  this.isVirtualReorder = false;
931
+ this.isVirtualOrder = false;
931
932
  this.incrementalQueryString = '';
932
933
  this.incrementalEndIndex = 0;
933
934
  this.incrementalStartIndex = 0;
@@ -2376,6 +2377,9 @@ let DropDownBase = class DropDownBase extends Component {
2376
2377
  if (this.getModuleName() === 'multiselect' && (this.virtualSelectAll && !isClearAll)) {
2377
2378
  this.virtualSelectAllData = listData;
2378
2379
  listData = listData.slice(this.virtualItemStartIndex, this.virtualItemEndIndex);
2380
+ if (this.virtualSelectAllData.length < (this.itemCount * 2) && this.isCheckBoxSelection && this.isVirtualOrder) {
2381
+ listData = this.virtualSelectAllData;
2382
+ }
2379
2383
  }
2380
2384
  ulElement = this.createListItems(listData, fields);
2381
2385
  if (this.isIncrementalRequest) {
@@ -2399,6 +2403,12 @@ let DropDownBase = class DropDownBase extends Component {
2399
2403
  else {
2400
2404
  virtualUlElement.appendChild(ulElement);
2401
2405
  }
2406
+ if (this.getModuleName() === 'multiselect' && this.isCheckBoxSelection && !this.appendUncheckList && this.isVirtualOrder) {
2407
+ const selectedUlElement = this.list.querySelector('.e-list-parent' + '.e-reorder');
2408
+ if (!isNullOrUndefined(selectedUlElement)) {
2409
+ virtualUlElement.removeChild(selectedUlElement);
2410
+ }
2411
+ }
2402
2412
  }
2403
2413
  this.updateListElements(listData);
2404
2414
  }
@@ -9814,6 +9824,9 @@ let DropDownTree = class DropDownTree extends Component {
9814
9824
  removeClass([this.popupDiv], NODATA);
9815
9825
  this.hideCheckAll(false);
9816
9826
  }
9827
+ else {
9828
+ this.hideCheckAll(this.treeItems.length <= 1);
9829
+ }
9817
9830
  if (!this.isFilteredData) {
9818
9831
  this.treeDataType = this.getTreeDataType(this.treeItems, this.fields);
9819
9832
  }
@@ -11220,6 +11233,9 @@ let DropDownTree = class DropDownTree extends Component {
11220
11233
  EventHandler.remove(element, 'mouseup', this.removeChip);
11221
11234
  }
11222
11235
  }
11236
+ if (this.keyboardModule) {
11237
+ this.keyboardModule.destroy();
11238
+ }
11223
11239
  this.chipWrapper = null;
11224
11240
  this.chipCollection = null;
11225
11241
  this.checkAllParent = null;
@@ -13811,7 +13827,9 @@ let MultiSelect = class MultiSelect extends DropDownBase {
13811
13827
  if (isCheckbox) {
13812
13828
  const startindex = this.viewPortInfo.startIndex;
13813
13829
  const endindex = (((startindex + this.viewPortInfo.endIndex) <= (valuecheck.length)) &&
13814
- valuecheck[(startindex + this.viewPortInfo.endIndex)]) ? (startindex + this.viewPortInfo.endIndex)
13830
+ valuecheck[(startindex + this.viewPortInfo.endIndex)]) &&
13831
+ (this.dataSource instanceof DataManager && this.totalItemCount !== 0 && this.totalItemCount > (this.itemCount * 2))
13832
+ ? (startindex + this.viewPortInfo.endIndex)
13815
13833
  : (valuecheck.length);
13816
13834
  for (let i = startindex; i < endindex; i++) {
13817
13835
  const value = this.allowObjectBinding ? getValue((this.fields.value) ?
@@ -15575,6 +15593,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
15575
15593
  if (!isNullOrUndefined(this.value)) {
15576
15594
  this.tempValues = this.allowObjectBinding ? this.value.slice() : this.value.slice();
15577
15595
  }
15596
+ const removedChipTitle = selectedElem.getAttribute('title');
15578
15597
  temp = selectedElem.nextElementSibling;
15579
15598
  if (temp !== null) {
15580
15599
  this.removeChipSelection();
@@ -15586,6 +15605,11 @@ let MultiSelect = class MultiSelect extends DropDownBase {
15586
15605
  this.removeValue(currentChip, e);
15587
15606
  this.updateDelimeter(this.delimiterChar, e);
15588
15607
  this.makeTextBoxEmpty();
15608
+ if (removedChipTitle && this.chipAnnouncerLiveRegion) {
15609
+ const remainingCount = this.value ? this.value.length : 0;
15610
+ const announcement = `${removedChipTitle} removed from selection ${remainingCount} items selected`;
15611
+ this.chipAnnouncerLiveRegion.textContent = announcement;
15612
+ }
15589
15613
  }
15590
15614
  if (this.closePopupOnSelect) {
15591
15615
  this.hidePopup(e);
@@ -15777,6 +15801,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
15777
15801
  const selectedChips = this.chipCollectionWrapper.querySelectorAll('span.' + CHIP$1 + '.' + CHIP_SELECTED);
15778
15802
  if (selectedChips && selectedChips.length === 1) {
15779
15803
  selectedChips[0].removeAttribute('id');
15804
+ selectedChips[0].removeAttribute('aria-hidden');
15780
15805
  if (!isNullOrUndefined(this.inputElement) && this.inputElement.hasAttribute('aria-activedescendant')) {
15781
15806
  this.inputElement.removeAttribute('aria-activedescendant');
15782
15807
  if (!this.inputElement.hasAttribute('aria-describedby') && this.chipCollectionWrapper.id) {
@@ -15791,16 +15816,18 @@ let MultiSelect = class MultiSelect extends DropDownBase {
15791
15816
  addClass([element], CHIP_SELECTED);
15792
15817
  if (element) {
15793
15818
  element.setAttribute('id', this.element.id + '_chip_item');
15819
+ element.setAttribute('aria-hidden', 'true');
15820
+ const chipTitle = element.getAttribute('title');
15821
+ if (chipTitle && this.chipAnnouncerLiveRegion) {
15822
+ const announcement = `${chipTitle} focused. Press Backspace to remove`;
15823
+ this.chipAnnouncerLiveRegion.textContent = announcement;
15824
+ }
15794
15825
  if (!isNullOrUndefined(this.inputElement) && element.id) {
15795
15826
  this.inputElement.setAttribute('aria-activedescendant', element.id);
15796
15827
  if (this.inputElement.hasAttribute('aria-describedby')) {
15797
15828
  this.inputElement.removeAttribute('aria-describedby');
15798
15829
  }
15799
15830
  }
15800
- const chipClose = element.querySelector('span.' + CHIP_CLOSE$1.split(' ')[0]);
15801
- if (chipClose) {
15802
- chipClose.removeAttribute('aria-hidden');
15803
- }
15804
15831
  }
15805
15832
  this.trigger('chipSelection', e);
15806
15833
  }
@@ -16278,15 +16305,9 @@ let MultiSelect = class MultiSelect extends DropDownBase {
16278
16305
  const closeElements = this.chipCollectionWrapper.querySelectorAll('span.' + CHIP_CLOSE$1.split(' ')[0]);
16279
16306
  if (Browser.isDevice) {
16280
16307
  for (let index = 0; index < closeElements.length; index++) {
16281
- closeElements[index].setAttribute('aria-hidden', 'true');
16282
16308
  closeElements[index].style.display = 'none';
16283
16309
  }
16284
16310
  }
16285
- else {
16286
- for (let index = 0; index < closeElements.length; index++) {
16287
- closeElements[index].setAttribute('aria-hidden', 'true');
16288
- }
16289
- }
16290
16311
  }
16291
16312
  onMobileChipInteraction(e) {
16292
16313
  const chipElem = closest(e.target, '.' + CHIP$1);
@@ -16326,7 +16347,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
16326
16347
  });
16327
16348
  let compiledString;
16328
16349
  const chipContent = this.createElement('span', { className: CHIP_CONTENT$1 });
16329
- const chipClose = this.createElement('span', { className: CHIP_CLOSE$1, attrs: { 'aria-label': 'delete', 'aria-hidden': 'true', 'tabindex': '-1' } });
16350
+ const chipClose = this.createElement('span', { className: CHIP_CLOSE$1, attrs: { 'aria-hidden': 'true' } });
16330
16351
  if (this.mainData) {
16331
16352
  itemData = this.getDataByValue(value);
16332
16353
  }
@@ -16593,6 +16614,11 @@ let MultiSelect = class MultiSelect extends DropDownBase {
16593
16614
  }, targetExitViewport: () => {
16594
16615
  if (!Browser.isDevice) {
16595
16616
  this.hidePopup();
16617
+ let previousValue = this.tempValues;
16618
+ if (isNullOrUndefined(previousValue)) {
16619
+ previousValue = [];
16620
+ }
16621
+ this.updateValueState(this.scrollEvent, this.value, previousValue);
16596
16622
  }
16597
16623
  }
16598
16624
  });
@@ -16873,6 +16899,8 @@ let MultiSelect = class MultiSelect extends DropDownBase {
16873
16899
  EventHandler.add(this.componentWrapper, 'mouseout', this.mouseOut, this);
16874
16900
  EventHandler.add(this.overAllClear, 'mousedown', this.clearAll, this);
16875
16901
  EventHandler.add(this.inputElement, 'paste', this.pasteHandler, this);
16902
+ EventHandler.add(document, 'wheel', this.onWheelScroll, this);
16903
+ EventHandler.add(document, 'scroll', this.onWheelScroll, this);
16876
16904
  }
16877
16905
  onInput(e) {
16878
16906
  if (this.keyDownStatus) {
@@ -16887,6 +16915,9 @@ let MultiSelect = class MultiSelect extends DropDownBase {
16887
16915
  this.search(e);
16888
16916
  }
16889
16917
  }
16918
+ onWheelScroll(e) {
16919
+ this.scrollEvent = e;
16920
+ }
16890
16921
  pasteHandler(event) {
16891
16922
  setTimeout(() => {
16892
16923
  this.expandTextbox();
@@ -17372,7 +17403,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
17372
17403
  else {
17373
17404
  this.updateDelimeter(this.delimiterChar, null, isInitialVirtualData);
17374
17405
  }
17375
- if (this.mode === 'CheckBox' && this.showSelectAll && (isNullOrUndefined(this.value) || !this.value.length)) {
17406
+ if (this.mode === 'CheckBox' && this.showSelectAll && (isNullOrUndefined(this.value) || !this.value.length || (this.value.length !== this.listData.length))) {
17376
17407
  this.notify('checkSelectAll', { module: 'CheckBoxSelection', enable: this.mode === 'CheckBox', value: 'uncheck' });
17377
17408
  }
17378
17409
  if (this.mode === 'Box' || (this.mode === 'Default' && this.inputFocus)) {
@@ -18189,6 +18220,8 @@ let MultiSelect = class MultiSelect extends DropDownBase {
18189
18220
  if (!isNullOrUndefined(this.inputElement)) {
18190
18221
  EventHandler.remove(this.inputElement, 'paste', this.pasteHandler);
18191
18222
  }
18223
+ EventHandler.remove(document, 'wheel', this.onWheelScroll);
18224
+ EventHandler.remove(document, 'scroll', this.onWheelScroll);
18192
18225
  }
18193
18226
  resizingWireEvent() {
18194
18227
  // Mouse events
@@ -18500,12 +18533,18 @@ let MultiSelect = class MultiSelect extends DropDownBase {
18500
18533
  this.virtualSelectAllState = state;
18501
18534
  this.virtualSelectAll = true;
18502
18535
  this.CurrentEvent = event;
18536
+ if (this.mode === 'CheckBox' && this.value && Array.isArray(this.value) && this.value.length > 0 && this.enableSelectionOrder && this.targetElement().trim() === '' && this.viewPortInfo.startIndex < this.value.length) {
18537
+ this.isVirtualOrder = true;
18538
+ }
18503
18539
  if (!this.virtualSelectAllData) {
18504
18540
  this.resetList(this.dataSource, this.fields, new Query());
18505
18541
  }
18506
18542
  if (this.virtualSelectAllData) {
18507
18543
  this.virtualSelectionAll(state, li, event);
18508
18544
  }
18545
+ if (this.mode === 'CheckBox' && this.value && Array.isArray(this.value) && this.value.length > 0 && this.enableSelectionOrder && this.targetElement().trim() === '' && this.viewPortInfo.startIndex < this.value.length) {
18546
+ this.isVirtualOrder = false;
18547
+ }
18509
18548
  }
18510
18549
  else {
18511
18550
  while (index < length && index <= 50 && index < count) {
@@ -18801,7 +18840,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
18801
18840
  if (this.fields.disabled) {
18802
18841
  this.removeDisabledItemsValue(this.value);
18803
18842
  }
18804
- this.updateVal(this.value, oldProp.value, 'value');
18843
+ this.updateVal(this.value, oldProp.value, 'value', this.enableVirtualization);
18805
18844
  this.addValidInputClass();
18806
18845
  if (!this.closePopupOnSelect && this.isPopupOpen()) {
18807
18846
  this.refreshPopup();
@@ -18996,8 +19035,8 @@ let MultiSelect = class MultiSelect extends DropDownBase {
18996
19035
  this.updateActionList(ulElement, list, event);
18997
19036
  });
18998
19037
  }
18999
- updateVal(newProp, oldProp, prop) {
19000
- if (!this.list) {
19038
+ updateVal(newProp, oldProp, prop, isVirtual = false) {
19039
+ if (!this.list || (isVirtual && prop === 'value' && ((isNullOrUndefined(oldProp) && !isNullOrUndefined(newProp)) || (!isNullOrUndefined(oldProp) && isNullOrUndefined(newProp)) || (this.validateValues(newProp, oldProp) && newProp.length > 0)))) {
19001
19040
  this.onLoadSelect();
19002
19041
  if (this.enableVirtualization) {
19003
19042
  this.setProperties({ text: '' }, true);
@@ -19517,6 +19556,14 @@ let MultiSelect = class MultiSelect extends DropDownBase {
19517
19556
  this.overAllWrapper.getElementsByClassName('e-float-text-content')[0] && this.floatLabelType !== 'Never')) {
19518
19557
  this.overAllWrapper.getElementsByClassName('e-float-text-content')[0].classList.add('e-icon');
19519
19558
  }
19559
+ if (!this.chipAnnouncerLiveRegion) {
19560
+ this.chipAnnouncerLiveRegion = this.createElement('div', {
19561
+ attrs: { 'aria-live': 'polite', 'aria-atomic': 'true', 'class': 'e-chip-announcer' }
19562
+ });
19563
+ this.chipAnnouncerLiveRegion.style.position = 'absolute';
19564
+ this.chipAnnouncerLiveRegion.style.left = '-10000px';
19565
+ this.componentWrapper.appendChild(this.chipAnnouncerLiveRegion);
19566
+ }
19520
19567
  this.renderComplete();
19521
19568
  }
19522
19569
  setResize() {
@@ -19766,7 +19813,11 @@ let MultiSelect = class MultiSelect extends DropDownBase {
19766
19813
  });
19767
19814
  }
19768
19815
  else {
19769
- listItems = new DataManager(this.dataSource).executeLocal(new Query().where(predicate));
19816
+ listItems = this.executeLocalForLargeSelection(this.dataSource, this.value, {
19817
+ fields: this.fields,
19818
+ allowObjectBinding: this.allowObjectBinding,
19819
+ isPrimitiveData: this.isPrimitiveData
19820
+ });
19770
19821
  }
19771
19822
  }
19772
19823
  if (!(this.dataSource instanceof DataManager)) {
@@ -19795,6 +19846,55 @@ let MultiSelect = class MultiSelect extends DropDownBase {
19795
19846
  this.element.setAttribute('data-initial-value', this.text);
19796
19847
  }
19797
19848
  }
19849
+ executeLocalForLargeSelection(dataSource, values, options) {
19850
+ if (!dataSource || !dataSource.length || !values || !values.length) {
19851
+ return [];
19852
+ }
19853
+ const { fields, allowObjectBinding, isPrimitiveData, predicateChunkSize = 100 } = options;
19854
+ if (values.length === dataSource.length) {
19855
+ return dataSource.slice();
19856
+ }
19857
+ const field = isPrimitiveData ? '' : fields.value;
19858
+ const allResults = [];
19859
+ let predicate = null;
19860
+ let count = 0;
19861
+ const flushPredicate = () => {
19862
+ if (!predicate) {
19863
+ return;
19864
+ }
19865
+ const query = new Query().where(predicate);
19866
+ const result = new DataManager(dataSource).executeLocal(query);
19867
+ allResults.push(...result);
19868
+ predicate = null;
19869
+ count = 0;
19870
+ };
19871
+ for (let i = 0; i < values.length; i++) {
19872
+ const value = allowObjectBinding
19873
+ ? getValue(fields.value || '', values[i])
19874
+ : values[i];
19875
+ predicate = predicate
19876
+ ? predicate.or(field, 'equal', value)
19877
+ : new Predicate(field, 'equal', value);
19878
+ count++;
19879
+ if (count === predicateChunkSize) {
19880
+ flushPredicate();
19881
+ }
19882
+ }
19883
+ flushPredicate();
19884
+ const uniqueMap = {};
19885
+ const resultArray = [];
19886
+ for (let i = 0; i < allResults.length; i++) {
19887
+ const item = allResults[i];
19888
+ const key = isPrimitiveData
19889
+ ? item.toString()
19890
+ : getValue(fields.value, item);
19891
+ if (!uniqueMap.hasOwnProperty(key)) {
19892
+ uniqueMap[key] = item;
19893
+ resultArray.push(item);
19894
+ }
19895
+ }
19896
+ return resultArray;
19897
+ }
19798
19898
  checkAutoFocus() {
19799
19899
  if (this.element.hasAttribute('autofocus')) {
19800
19900
  this.inputElement.focus();
@@ -20082,6 +20182,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
20082
20182
  this.mainListCollection = null;
20083
20183
  this.footer = null;
20084
20184
  this.selectAllEventEle = null;
20185
+ this.chipAnnouncerLiveRegion = null;
20085
20186
  super.destroy();
20086
20187
  }
20087
20188
  };
@@ -23968,7 +24069,7 @@ let Mention = class Mention extends DropDownBase {
23968
24069
  }
23969
24070
  else if (this.allowSpaces && this.queryString !== '' && currentRange && currentRange.trim() !== '' && currentRange.replace('\u00a0', ' ').lastIndexOf(' ') < currentRange.length - 1 &&
23970
24071
  e.keyCode !== 38 && e.keyCode !== 40 && e.keyCode !== 8 && (this.mentionChar.charCodeAt(0) === lastWordRange.charCodeAt(0) ||
23971
- (this.liCollections && this.liCollections.length > 0))) {
24072
+ ((this.liCollections && this.liCollections.length > 0) || (this.isPopupOpen && this.list && this.list.classList.contains('e-nodata'))))) {
23972
24073
  this.queryString = currentRange.substring(currentRange.lastIndexOf(this.mentionChar) + 1).replace('\u00a0', ' ');
23973
24074
  this.searchLists(e);
23974
24075
  }