@syncfusion/ej2-dropdowns 21.2.6 → 21.2.10

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.
Files changed (52) hide show
  1. package/CHANGELOG.md +47 -3
  2. package/dist/ej2-dropdowns.min.js +2 -2
  3. package/dist/ej2-dropdowns.umd.min.js +2 -2
  4. package/dist/ej2-dropdowns.umd.min.js.map +1 -1
  5. package/dist/es6/ej2-dropdowns.es2015.js +62 -29
  6. package/dist/es6/ej2-dropdowns.es2015.js.map +1 -1
  7. package/dist/es6/ej2-dropdowns.es5.js +62 -29
  8. package/dist/es6/ej2-dropdowns.es5.js.map +1 -1
  9. package/dist/global/ej2-dropdowns.min.js +2 -2
  10. package/dist/global/ej2-dropdowns.min.js.map +1 -1
  11. package/dist/global/index.d.ts +1 -1
  12. package/package.json +11 -11
  13. package/src/drop-down-base/drop-down-base.js +3 -0
  14. package/src/drop-down-list/drop-down-list.d.ts +0 -1
  15. package/src/drop-down-list/drop-down-list.js +9 -14
  16. package/src/list-box/list-box.d.ts +1 -0
  17. package/src/list-box/list-box.js +38 -2
  18. package/src/mention/mention.js +1 -1
  19. package/src/multi-select/multi-select-model.d.ts +1 -1
  20. package/src/multi-select/multi-select.js +11 -12
  21. package/styles/bootstrap-dark.css +207 -99
  22. package/styles/bootstrap.css +209 -100
  23. package/styles/bootstrap4.css +209 -100
  24. package/styles/bootstrap5-dark.css +207 -99
  25. package/styles/bootstrap5.css +207 -99
  26. package/styles/fabric-dark.css +207 -99
  27. package/styles/fabric.css +209 -100
  28. package/styles/fluent-dark.css +209 -100
  29. package/styles/fluent.css +209 -100
  30. package/styles/highcontrast-light.css +207 -99
  31. package/styles/highcontrast.css +209 -100
  32. package/styles/list-box/_layout.scss +8 -2
  33. package/styles/list-box/_theme.scss +2 -1
  34. package/styles/list-box/bootstrap-dark.css +207 -99
  35. package/styles/list-box/bootstrap.css +209 -100
  36. package/styles/list-box/bootstrap4.css +209 -100
  37. package/styles/list-box/bootstrap5-dark.css +207 -99
  38. package/styles/list-box/bootstrap5.css +207 -99
  39. package/styles/list-box/fabric-dark.css +207 -99
  40. package/styles/list-box/fabric.css +209 -100
  41. package/styles/list-box/fluent-dark.css +209 -100
  42. package/styles/list-box/fluent.css +209 -100
  43. package/styles/list-box/highcontrast-light.css +207 -99
  44. package/styles/list-box/highcontrast.css +209 -100
  45. package/styles/list-box/material-dark.css +207 -99
  46. package/styles/list-box/material.css +209 -100
  47. package/styles/list-box/tailwind-dark.css +209 -100
  48. package/styles/list-box/tailwind.css +209 -100
  49. package/styles/material-dark.css +207 -99
  50. package/styles/material.css +209 -100
  51. package/styles/tailwind-dark.css +209 -100
  52. package/styles/tailwind.css +209 -100
@@ -1,5 +1,5 @@
1
1
  import { Animation, Browser, ChildProperty, Complex, Component, Event, EventHandler, KeyboardEvents, L10n, NotifyPropertyChanges, Property, SanitizeHtmlHelper, addClass, append, attributes, classList, closest, compile, createElement, detach, extend, formatUnit, getComponent, getUniqueID, getValue, isNullOrUndefined, isUndefined, matches, prepend, remove, removeClass, rippleEffect, select, selectAll, setStyleAttribute, setValue } from '@syncfusion/ej2-base';
2
- import { DataManager, DataUtil, Predicate, Query } from '@syncfusion/ej2-data';
2
+ import { DataManager, DataUtil, JsonAdaptor, Predicate, Query } from '@syncfusion/ej2-data';
3
3
  import { ListBase, Sortable, cssClass, moveTo } from '@syncfusion/ej2-lists';
4
4
  import { Popup, createSpinner, getZindexPartial, hideSpinner, isCollide, showSpinner } from '@syncfusion/ej2-popups';
5
5
  import { Input, TextBox } from '@syncfusion/ej2-inputs';
@@ -1342,6 +1342,9 @@ let DropDownBase = class DropDownBase extends Component {
1342
1342
  }
1343
1343
  }
1344
1344
  }
1345
+ if (this.getModuleName() === 'listbox' && this.isReact) {
1346
+ this.renderReactTemplates();
1347
+ }
1345
1348
  if (selectedItemValue || itemIndex === 0) {
1346
1349
  this.updateSelection();
1347
1350
  }
@@ -2393,7 +2396,7 @@ let DropDownList = class DropDownList extends DropDownBase {
2393
2396
  this.removeSelection();
2394
2397
  li.classList.add(dropDownBaseClasses.selected);
2395
2398
  this.removeHover();
2396
- const value = this.getFormattedValue(li.getAttribute('data-value'));
2399
+ const value = li.getAttribute('data-value') !== "null" ? this.getFormattedValue(li.getAttribute('data-value')) : null;
2397
2400
  const selectedData = this.getDataByValue(value);
2398
2401
  if (!this.initial && !preventSelect && !isNullOrUndefined(e)) {
2399
2402
  const items = this.detachChanges(selectedData);
@@ -2509,7 +2512,9 @@ let DropDownList = class DropDownList extends DropDownBase {
2509
2512
  }
2510
2513
  if (Browser.info.name !== 'mozilla') {
2511
2514
  if (this.targetElement()) {
2512
- attributes(this.targetElement(), { 'aria-describedby': this.inputElement.id !== '' ? this.inputElement.id : this.element.id });
2515
+ if (this.getModuleName() !== 'combobox') {
2516
+ attributes(this.targetElement(), { 'aria-describedby': this.inputElement.id !== '' ? this.inputElement.id : this.element.id });
2517
+ }
2513
2518
  this.targetElement().removeAttribute('aria-live');
2514
2519
  }
2515
2520
  }
@@ -2562,9 +2567,7 @@ let DropDownList = class DropDownList extends DropDownBase {
2562
2567
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
2563
2568
  const valueCompTemp = compiledString(this.itemData, this, 'valueTemplate', this.valueTemplateId, this.isStringTemplate, null, this.valueTempElement);
2564
2569
  if (valueCompTemp && valueCompTemp.length > 0) {
2565
- for (let i = 0; i < valueCompTemp.length; i++) {
2566
- this.valueTempElement.appendChild(valueCompTemp[i]);
2567
- }
2570
+ append(valueCompTemp, this.valueTempElement);
2568
2571
  }
2569
2572
  this.renderReactTemplates();
2570
2573
  }
@@ -3281,7 +3284,6 @@ let DropDownList = class DropDownList extends DropDownBase {
3281
3284
  }
3282
3285
  },
3283
3286
  open: () => {
3284
- EventHandler.remove(document, 'mousedown', this.onDocumentClick);
3285
3287
  EventHandler.add(document, 'mousedown', this.onDocumentClick, this);
3286
3288
  this.isPopupOpen = true;
3287
3289
  const actionList = this.actionCompleteData && this.actionCompleteData.ulElement &&
@@ -3460,9 +3462,10 @@ let DropDownList = class DropDownList extends DropDownBase {
3460
3462
  }
3461
3463
  closePopup(delay, e) {
3462
3464
  this.isTyped = false;
3463
- if (!(this.popupObj && document.body.contains(this.popupObj.element) && (this.beforePopupOpen || this.isEventCancel))) {
3465
+ if (!(this.popupObj && document.body.contains(this.popupObj.element) && this.beforePopupOpen)) {
3464
3466
  return;
3465
3467
  }
3468
+ EventHandler.remove(document, 'mousedown', this.onDocumentClick);
3466
3469
  this.isActive = false;
3467
3470
  this.filterInputObj = null;
3468
3471
  this.isDropDownClick = false;
@@ -3511,7 +3514,6 @@ let DropDownList = class DropDownList extends DropDownBase {
3511
3514
  const popupInstance = this.popupObj;
3512
3515
  const eventArgs = { popup: popupInstance, cancel: false, animation: animModel, event: e || null };
3513
3516
  this.trigger('close', eventArgs, (eventArgs) => {
3514
- this.isEventCancel = eventArgs.cancel;
3515
3517
  if (!isNullOrUndefined(this.popupObj) &&
3516
3518
  !isNullOrUndefined(this.popupObj.element.querySelector('.e-fixed-head'))) {
3517
3519
  const fixedHeader = this.popupObj.element.querySelector('.e-fixed-head');
@@ -3688,9 +3690,7 @@ let DropDownList = class DropDownList extends DropDownBase {
3688
3690
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
3689
3691
  const footerCompTemp = compiledString({}, this, 'footerTemplate', this.footerTemplateId, this.isStringTemplate, null, this.footer);
3690
3692
  if (footerCompTemp && footerCompTemp.length > 0) {
3691
- for (let i = 0; i < footerCompTemp.length; i++) {
3692
- this.footer.appendChild(footerCompTemp[i]);
3693
- }
3693
+ append(footerCompTemp, this.footer);
3694
3694
  }
3695
3695
  append([this.footer], popupEle);
3696
3696
  }
@@ -3713,9 +3713,7 @@ let DropDownList = class DropDownList extends DropDownBase {
3713
3713
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
3714
3714
  const headerCompTemp = compiledString({}, this, 'headerTemplate', this.headerTemplateId, this.isStringTemplate, null, this.header);
3715
3715
  if (headerCompTemp && headerCompTemp.length) {
3716
- for (let i = 0; i < headerCompTemp.length; i++) {
3717
- this.header.appendChild(headerCompTemp[i]);
3718
- }
3716
+ append(headerCompTemp, this.header);
3719
3717
  }
3720
3718
  const contentEle = popupEle.querySelector('div.e-content');
3721
3719
  popupEle.insertBefore(this.header, contentEle);
@@ -9307,7 +9305,12 @@ let MultiSelect = class MultiSelect extends DropDownBase {
9307
9305
  predicate = predicate.or(field, 'equal', valuecheck[i]);
9308
9306
  }
9309
9307
  }
9310
- return this.getQuery(this.query).where(predicate);
9308
+ if (this.dataSource instanceof DataManager && this.dataSource.adaptor instanceof JsonAdaptor) {
9309
+ return new Query().where(predicate);
9310
+ }
9311
+ else {
9312
+ return this.getQuery(this.query).clone().where(predicate);
9313
+ }
9311
9314
  }
9312
9315
  /* eslint-disable @typescript-eslint/no-unused-vars */
9313
9316
  onActionComplete(ulElement, list, e, isUpdated) {
@@ -9326,7 +9329,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
9326
9329
  }
9327
9330
  }
9328
9331
  let valuecheck = [];
9329
- if (!isNullOrUndefined(this.value) && !this.allowCustomValue) {
9332
+ if (!isNullOrUndefined(this.value)) {
9330
9333
  valuecheck = this.presentItemValue(this.ulElement);
9331
9334
  }
9332
9335
  if (valuecheck.length > 0 && this.dataSource instanceof DataManager && !isNullOrUndefined(this.value)
@@ -10837,9 +10840,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
10837
10840
  // eslint-disable-next-line
10838
10841
  let valueCompTemp = compiledString(itemData, this, 'valueTemplate', this.valueTemplateId, this.isStringTemplate, null, chipContent);
10839
10842
  if (valueCompTemp && valueCompTemp.length > 0) {
10840
- for (let i = 0; i < valueCompTemp.length; i++) {
10841
- chipContent.appendChild(valueCompTemp[i]);
10842
- }
10843
+ append(valueCompTemp, chipContent);
10843
10844
  }
10844
10845
  this.renderReactTemplates();
10845
10846
  }
@@ -11042,9 +11043,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
11042
11043
  // eslint-disable-next-line
11043
11044
  let elements = compiledString({}, this, 'headerTemplate', this.headerTemplateId, this.isStringTemplate, null, this.header);
11044
11045
  if (elements && elements.length > 0) {
11045
- for (let temp = 0; temp < elements.length; temp++) {
11046
- this.header.appendChild(elements[temp]);
11047
- }
11046
+ append(elements, this.header);
11048
11047
  }
11049
11048
  if (this.mode === 'CheckBox' && this.showSelectAll) {
11050
11049
  prepend([this.header], this.popupWrapper);
@@ -11071,9 +11070,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
11071
11070
  // eslint-disable-next-line
11072
11071
  let elements = compiledString({}, this, 'footerTemplate', this.footerTemplateId, this.isStringTemplate, null, this.footer);
11073
11072
  if (elements && elements.length > 0) {
11074
- for (let temp = 0; temp < elements.length; temp++) {
11075
- this.footer.appendChild(elements[temp]);
11076
- }
11073
+ append(elements, this.footer);
11077
11074
  }
11078
11075
  append([this.footer], this.popupWrapper);
11079
11076
  EventHandler.add(this.footer, 'mousedown', this.onListMouseDown, this);
@@ -14142,6 +14139,7 @@ let ListBox = ListBox_1 = class ListBox extends DropDownBase {
14142
14139
  this.trigger('drag', this.getDragArgs(args));
14143
14140
  }
14144
14141
  beforeDragEnd(args) {
14142
+ let items = [];
14145
14143
  this.dragValue = this.getFormattedValue(args.droppedElement.getAttribute('data-value'));
14146
14144
  if (this.value.indexOf(this.dragValue) > -1) {
14147
14145
  args.items = this.getDataByValues(this.value);
@@ -14149,7 +14147,11 @@ let ListBox = ListBox_1 = class ListBox extends DropDownBase {
14149
14147
  else {
14150
14148
  args.items = this.getDataByValues([this.dragValue]);
14151
14149
  }
14150
+ extend(items, args.items);
14152
14151
  this.trigger('beforeDrop', args);
14152
+ if (args.items !== items) {
14153
+ this.customDraggedItem = args.items;
14154
+ }
14153
14155
  }
14154
14156
  dragEnd(args) {
14155
14157
  let listData;
@@ -14196,6 +14198,12 @@ let ListBox = ListBox_1 = class ListBox extends DropDownBase {
14196
14198
  liColl.splice(toIdx, 0, liColl.splice(rIdx, 1)[0]);
14197
14199
  if (this.allowDragAll) {
14198
14200
  selectedOptions = this.value && Array.prototype.indexOf.call(this.value, dropValue) > -1 ? this.value : [dropValue];
14201
+ if (!isNullOrUndefined(this.customDraggedItem)) {
14202
+ selectedOptions = [];
14203
+ this.customDraggedItem.forEach((item) => {
14204
+ selectedOptions.push(getValue(this.fields.value, item));
14205
+ });
14206
+ }
14199
14207
  selectedOptions.forEach((value) => {
14200
14208
  if (value !== dropValue) {
14201
14209
  const idx = listData.indexOf(this.getDataByValue(value));
@@ -14228,6 +14236,12 @@ let ListBox = ListBox_1 = class ListBox extends DropDownBase {
14228
14236
  sortedData = [].slice.call(listObj.sortedData);
14229
14237
  selectedOptions = (this.value && Array.prototype.indexOf.call(this.value, dropValue) > -1 && this.allowDragAll)
14230
14238
  ? this.value : [dropValue];
14239
+ if (!isNullOrUndefined(this.customDraggedItem)) {
14240
+ selectedOptions = [];
14241
+ this.customDraggedItem.forEach((item) => {
14242
+ selectedOptions.push(getValue(this.fields.value, item));
14243
+ });
14244
+ }
14231
14245
  const fListData = [].slice.call(this.listData);
14232
14246
  const fSortData = [].slice.call(this.sortedData);
14233
14247
  selectedOptions.forEach((value, index) => {
@@ -14298,6 +14312,9 @@ let ListBox = ListBox_1 = class ListBox extends DropDownBase {
14298
14312
  const dragArgs1 = extend(destArgs, { currentData: listData });
14299
14313
  dragArgs = extend(dragArgs, { destination: dragArgs1 });
14300
14314
  }
14315
+ if (!isNullOrUndefined(this.customDraggedItem)) {
14316
+ dragArgs.items = this.customDraggedItem;
14317
+ }
14301
14318
  this.trigger('drop', dragArgs);
14302
14319
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
14303
14320
  const liCollElem = dragArgs.elements;
@@ -14410,6 +14427,16 @@ let ListBox = ListBox_1 = class ListBox extends DropDownBase {
14410
14427
  }
14411
14428
  this.setSelection(items, state, !isValue);
14412
14429
  this.updateSelectedOptions();
14430
+ let selElems = [];
14431
+ for (let i = 0; i < items.length; i++) {
14432
+ const liColl = this.list.querySelectorAll('[aria-selected="true"]');
14433
+ for (let j = 0; j < liColl.length; j++) {
14434
+ if (items[i] === this.getFormattedValue(liColl[j].getAttribute('data-value'))) {
14435
+ selElems.push(liColl[j]);
14436
+ }
14437
+ }
14438
+ }
14439
+ this.triggerChange(selElems, null);
14413
14440
  }
14414
14441
  /**
14415
14442
  * Based on the state parameter, entire list item will be selected/deselected.
@@ -15604,8 +15631,11 @@ let ListBox = ListBox_1 = class ListBox extends DropDownBase {
15604
15631
  }
15605
15632
  if (typeof (text) === 'string') {
15606
15633
  text = text.split('\\').join('\\\\');
15634
+ li = this.list.querySelector('[data-value="' + text.replace(/"/g, '\\"') + '"]');
15635
+ }
15636
+ else {
15637
+ li = this.list.querySelector('[data-value="' + text + '"]');
15607
15638
  }
15608
- li = this.list.querySelector('[data-value="' + text + '"]');
15609
15639
  if (li) {
15610
15640
  if (this.selectionSettings.showCheckbox) {
15611
15641
  liselect = li.getElementsByClassName('e-frame')[0].classList.contains('e-check');
@@ -15641,9 +15671,12 @@ let ListBox = ListBox_1 = class ListBox extends DropDownBase {
15641
15671
  ele.innerHTML = '';
15642
15672
  if (this.value) {
15643
15673
  for (let i = 0, len = this.value.length; i < len; i++) {
15644
- innerHTML += '<option selected value="' + this.value[i] + '"></option>';
15674
+ innerHTML += '<option selected>' + this.value[i] + '</option>';
15645
15675
  }
15646
15676
  ele.innerHTML += innerHTML;
15677
+ for (let i = 0, len = ele.childNodes.length; i < len; i++) {
15678
+ ele.childNodes[i].setAttribute('value', this.value[i].toString());
15679
+ }
15647
15680
  }
15648
15681
  this.checkSelectAll();
15649
15682
  }
@@ -16835,7 +16868,7 @@ let Mention = class Mention extends DropDownBase {
16835
16868
  const selectedNodePosition = this.getTriggerCharPosition();
16836
16869
  globalRange = this.range;
16837
16870
  range = document.createRange();
16838
- if (this.getTextRange() && this.getTextRange().lastIndexOf(this.mentionChar) !== -1 && this.isTyped) {
16871
+ if (this.getTextRange() && this.getTextRange().lastIndexOf(this.mentionChar) !== -1) {
16839
16872
  range.setStart(globalRange.startContainer, selectedNodePosition);
16840
16873
  range.setEnd(globalRange.startContainer, selectedNodePosition);
16841
16874
  }