@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';
@@ -1373,6 +1373,9 @@ var DropDownBase = /** @__PURE__ @class */ (function (_super) {
1373
1373
  }
1374
1374
  }
1375
1375
  }
1376
+ if (this.getModuleName() === 'listbox' && this.isReact) {
1377
+ this.renderReactTemplates();
1378
+ }
1376
1379
  if (selectedItemValue || itemIndex === 0) {
1377
1380
  this.updateSelection();
1378
1381
  }
@@ -2445,7 +2448,7 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
2445
2448
  this.removeSelection();
2446
2449
  li.classList.add(dropDownBaseClasses.selected);
2447
2450
  this.removeHover();
2448
- var value = this.getFormattedValue(li.getAttribute('data-value'));
2451
+ var value = li.getAttribute('data-value') !== "null" ? this.getFormattedValue(li.getAttribute('data-value')) : null;
2449
2452
  var selectedData = this.getDataByValue(value);
2450
2453
  if (!this.initial && !preventSelect && !isNullOrUndefined(e)) {
2451
2454
  var items = this.detachChanges(selectedData);
@@ -2561,7 +2564,9 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
2561
2564
  }
2562
2565
  if (Browser.info.name !== 'mozilla') {
2563
2566
  if (this.targetElement()) {
2564
- attributes(this.targetElement(), { 'aria-describedby': this.inputElement.id !== '' ? this.inputElement.id : this.element.id });
2567
+ if (this.getModuleName() !== 'combobox') {
2568
+ attributes(this.targetElement(), { 'aria-describedby': this.inputElement.id !== '' ? this.inputElement.id : this.element.id });
2569
+ }
2565
2570
  this.targetElement().removeAttribute('aria-live');
2566
2571
  }
2567
2572
  }
@@ -2614,9 +2619,7 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
2614
2619
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
2615
2620
  var valueCompTemp = compiledString(this.itemData, this, 'valueTemplate', this.valueTemplateId, this.isStringTemplate, null, this.valueTempElement);
2616
2621
  if (valueCompTemp && valueCompTemp.length > 0) {
2617
- for (var i = 0; i < valueCompTemp.length; i++) {
2618
- this.valueTempElement.appendChild(valueCompTemp[i]);
2619
- }
2622
+ append(valueCompTemp, this.valueTempElement);
2620
2623
  }
2621
2624
  this.renderReactTemplates();
2622
2625
  };
@@ -3343,7 +3346,6 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
3343
3346
  }
3344
3347
  },
3345
3348
  open: function () {
3346
- EventHandler.remove(document, 'mousedown', _this.onDocumentClick);
3347
3349
  EventHandler.add(document, 'mousedown', _this.onDocumentClick, _this);
3348
3350
  _this.isPopupOpen = true;
3349
3351
  var actionList = _this.actionCompleteData && _this.actionCompleteData.ulElement &&
@@ -3523,9 +3525,10 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
3523
3525
  DropDownList.prototype.closePopup = function (delay, e) {
3524
3526
  var _this = this;
3525
3527
  this.isTyped = false;
3526
- if (!(this.popupObj && document.body.contains(this.popupObj.element) && (this.beforePopupOpen || this.isEventCancel))) {
3528
+ if (!(this.popupObj && document.body.contains(this.popupObj.element) && this.beforePopupOpen)) {
3527
3529
  return;
3528
3530
  }
3531
+ EventHandler.remove(document, 'mousedown', this.onDocumentClick);
3529
3532
  this.isActive = false;
3530
3533
  this.filterInputObj = null;
3531
3534
  this.isDropDownClick = false;
@@ -3575,7 +3578,6 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
3575
3578
  var popupInstance = this.popupObj;
3576
3579
  var eventArgs = { popup: popupInstance, cancel: false, animation: animModel, event: e || null };
3577
3580
  this.trigger('close', eventArgs, function (eventArgs) {
3578
- _this.isEventCancel = eventArgs.cancel;
3579
3581
  if (!isNullOrUndefined(_this.popupObj) &&
3580
3582
  !isNullOrUndefined(_this.popupObj.element.querySelector('.e-fixed-head'))) {
3581
3583
  var fixedHeader = _this.popupObj.element.querySelector('.e-fixed-head');
@@ -3752,9 +3754,7 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
3752
3754
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
3753
3755
  var footerCompTemp = compiledString({}, this, 'footerTemplate', this.footerTemplateId, this.isStringTemplate, null, this.footer);
3754
3756
  if (footerCompTemp && footerCompTemp.length > 0) {
3755
- for (var i = 0; i < footerCompTemp.length; i++) {
3756
- this.footer.appendChild(footerCompTemp[i]);
3757
- }
3757
+ append(footerCompTemp, this.footer);
3758
3758
  }
3759
3759
  append([this.footer], popupEle);
3760
3760
  };
@@ -3777,9 +3777,7 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
3777
3777
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
3778
3778
  var headerCompTemp = compiledString({}, this, 'headerTemplate', this.headerTemplateId, this.isStringTemplate, null, this.header);
3779
3779
  if (headerCompTemp && headerCompTemp.length) {
3780
- for (var i = 0; i < headerCompTemp.length; i++) {
3781
- this.header.appendChild(headerCompTemp[i]);
3782
- }
3780
+ append(headerCompTemp, this.header);
3783
3781
  }
3784
3782
  var contentEle = popupEle.querySelector('div.e-content');
3785
3783
  popupEle.insertBefore(this.header, contentEle);
@@ -9471,7 +9469,12 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
9471
9469
  predicate = predicate.or(field, 'equal', valuecheck[i]);
9472
9470
  }
9473
9471
  }
9474
- return this.getQuery(this.query).where(predicate);
9472
+ if (this.dataSource instanceof DataManager && this.dataSource.adaptor instanceof JsonAdaptor) {
9473
+ return new Query().where(predicate);
9474
+ }
9475
+ else {
9476
+ return this.getQuery(this.query).clone().where(predicate);
9477
+ }
9475
9478
  };
9476
9479
  /* eslint-disable @typescript-eslint/no-unused-vars */
9477
9480
  MultiSelect.prototype.onActionComplete = function (ulElement, list, e, isUpdated) {
@@ -9490,7 +9493,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
9490
9493
  }
9491
9494
  }
9492
9495
  var valuecheck = [];
9493
- if (!isNullOrUndefined(this.value) && !this.allowCustomValue) {
9496
+ if (!isNullOrUndefined(this.value)) {
9494
9497
  valuecheck = this.presentItemValue(this.ulElement);
9495
9498
  }
9496
9499
  if (valuecheck.length > 0 && this.dataSource instanceof DataManager && !isNullOrUndefined(this.value)
@@ -11005,9 +11008,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
11005
11008
  // eslint-disable-next-line
11006
11009
  var valueCompTemp = compiledString(itemData, this, 'valueTemplate', this.valueTemplateId, this.isStringTemplate, null, chipContent);
11007
11010
  if (valueCompTemp && valueCompTemp.length > 0) {
11008
- for (var i = 0; i < valueCompTemp.length; i++) {
11009
- chipContent.appendChild(valueCompTemp[i]);
11010
- }
11011
+ append(valueCompTemp, chipContent);
11011
11012
  }
11012
11013
  this.renderReactTemplates();
11013
11014
  }
@@ -11211,9 +11212,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
11211
11212
  // eslint-disable-next-line
11212
11213
  var elements = compiledString({}, this, 'headerTemplate', this.headerTemplateId, this.isStringTemplate, null, this.header);
11213
11214
  if (elements && elements.length > 0) {
11214
- for (var temp = 0; temp < elements.length; temp++) {
11215
- this.header.appendChild(elements[temp]);
11216
- }
11215
+ append(elements, this.header);
11217
11216
  }
11218
11217
  if (this.mode === 'CheckBox' && this.showSelectAll) {
11219
11218
  prepend([this.header], this.popupWrapper);
@@ -11240,9 +11239,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
11240
11239
  // eslint-disable-next-line
11241
11240
  var elements = compiledString({}, this, 'footerTemplate', this.footerTemplateId, this.isStringTemplate, null, this.footer);
11242
11241
  if (elements && elements.length > 0) {
11243
- for (var temp = 0; temp < elements.length; temp++) {
11244
- this.footer.appendChild(elements[temp]);
11245
- }
11242
+ append(elements, this.footer);
11246
11243
  }
11247
11244
  append([this.footer], this.popupWrapper);
11248
11245
  EventHandler.add(this.footer, 'mousedown', this.onListMouseDown, this);
@@ -14356,6 +14353,7 @@ var ListBox = /** @__PURE__ @class */ (function (_super) {
14356
14353
  this.trigger('drag', this.getDragArgs(args));
14357
14354
  };
14358
14355
  ListBox.prototype.beforeDragEnd = function (args) {
14356
+ var items = [];
14359
14357
  this.dragValue = this.getFormattedValue(args.droppedElement.getAttribute('data-value'));
14360
14358
  if (this.value.indexOf(this.dragValue) > -1) {
14361
14359
  args.items = this.getDataByValues(this.value);
@@ -14363,7 +14361,11 @@ var ListBox = /** @__PURE__ @class */ (function (_super) {
14363
14361
  else {
14364
14362
  args.items = this.getDataByValues([this.dragValue]);
14365
14363
  }
14364
+ extend(items, args.items);
14366
14365
  this.trigger('beforeDrop', args);
14366
+ if (args.items !== items) {
14367
+ this.customDraggedItem = args.items;
14368
+ }
14367
14369
  };
14368
14370
  ListBox.prototype.dragEnd = function (args) {
14369
14371
  var _this = this;
@@ -14411,6 +14413,12 @@ var ListBox = /** @__PURE__ @class */ (function (_super) {
14411
14413
  liColl.splice(toIdx_1, 0, liColl.splice(rIdx, 1)[0]);
14412
14414
  if (this.allowDragAll) {
14413
14415
  selectedOptions = this.value && Array.prototype.indexOf.call(this.value, dropValue) > -1 ? this.value : [dropValue];
14416
+ if (!isNullOrUndefined(this.customDraggedItem)) {
14417
+ selectedOptions = [];
14418
+ this.customDraggedItem.forEach(function (item) {
14419
+ selectedOptions.push(getValue(_this.fields.value, item));
14420
+ });
14421
+ }
14414
14422
  selectedOptions.forEach(function (value) {
14415
14423
  if (value !== dropValue) {
14416
14424
  var idx = listData.indexOf(_this.getDataByValue(value));
@@ -14443,6 +14451,12 @@ var ListBox = /** @__PURE__ @class */ (function (_super) {
14443
14451
  sortedData = [].slice.call(listObj.sortedData);
14444
14452
  selectedOptions = (this.value && Array.prototype.indexOf.call(this.value, dropValue) > -1 && this.allowDragAll)
14445
14453
  ? this.value : [dropValue];
14454
+ if (!isNullOrUndefined(this.customDraggedItem)) {
14455
+ selectedOptions = [];
14456
+ this.customDraggedItem.forEach(function (item) {
14457
+ selectedOptions.push(getValue(_this.fields.value, item));
14458
+ });
14459
+ }
14446
14460
  var fListData_1 = [].slice.call(this.listData);
14447
14461
  var fSortData_1 = [].slice.call(this.sortedData);
14448
14462
  selectedOptions.forEach(function (value, index) {
@@ -14513,6 +14527,9 @@ var ListBox = /** @__PURE__ @class */ (function (_super) {
14513
14527
  var dragArgs1 = extend(destArgs, { currentData: listData });
14514
14528
  dragArgs = extend(dragArgs, { destination: dragArgs1 });
14515
14529
  }
14530
+ if (!isNullOrUndefined(this.customDraggedItem)) {
14531
+ dragArgs.items = this.customDraggedItem;
14532
+ }
14516
14533
  this.trigger('drop', dragArgs);
14517
14534
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
14518
14535
  var liCollElem = dragArgs.elements;
@@ -14628,6 +14645,16 @@ var ListBox = /** @__PURE__ @class */ (function (_super) {
14628
14645
  }
14629
14646
  this.setSelection(items, state, !isValue);
14630
14647
  this.updateSelectedOptions();
14648
+ var selElems = [];
14649
+ for (var i = 0; i < items.length; i++) {
14650
+ var liColl = this.list.querySelectorAll('[aria-selected="true"]');
14651
+ for (var j = 0; j < liColl.length; j++) {
14652
+ if (items[i] === this.getFormattedValue(liColl[j].getAttribute('data-value'))) {
14653
+ selElems.push(liColl[j]);
14654
+ }
14655
+ }
14656
+ }
14657
+ this.triggerChange(selElems, null);
14631
14658
  };
14632
14659
  /**
14633
14660
  * Based on the state parameter, entire list item will be selected/deselected.
@@ -15846,8 +15873,11 @@ var ListBox = /** @__PURE__ @class */ (function (_super) {
15846
15873
  }
15847
15874
  if (typeof (text) === 'string') {
15848
15875
  text = text.split('\\').join('\\\\');
15876
+ li = _this.list.querySelector('[data-value="' + text.replace(/"/g, '\\"') + '"]');
15877
+ }
15878
+ else {
15879
+ li = _this.list.querySelector('[data-value="' + text + '"]');
15849
15880
  }
15850
- li = _this.list.querySelector('[data-value="' + text + '"]');
15851
15881
  if (li) {
15852
15882
  if (_this.selectionSettings.showCheckbox) {
15853
15883
  liselect = li.getElementsByClassName('e-frame')[0].classList.contains('e-check');
@@ -15883,9 +15913,12 @@ var ListBox = /** @__PURE__ @class */ (function (_super) {
15883
15913
  ele.innerHTML = '';
15884
15914
  if (this.value) {
15885
15915
  for (var i = 0, len = this.value.length; i < len; i++) {
15886
- innerHTML += '<option selected value="' + this.value[i] + '"></option>';
15916
+ innerHTML += '<option selected>' + this.value[i] + '</option>';
15887
15917
  }
15888
15918
  ele.innerHTML += innerHTML;
15919
+ for (var i = 0, len = ele.childNodes.length; i < len; i++) {
15920
+ ele.childNodes[i].setAttribute('value', this.value[i].toString());
15921
+ }
15889
15922
  }
15890
15923
  this.checkSelectAll();
15891
15924
  };
@@ -17101,7 +17134,7 @@ var Mention = /** @__PURE__ @class */ (function (_super) {
17101
17134
  var selectedNodePosition = this.getTriggerCharPosition();
17102
17135
  globalRange = this.range;
17103
17136
  range = document.createRange();
17104
- if (this.getTextRange() && this.getTextRange().lastIndexOf(this.mentionChar) !== -1 && this.isTyped) {
17137
+ if (this.getTextRange() && this.getTextRange().lastIndexOf(this.mentionChar) !== -1) {
17105
17138
  range.setStart(globalRange.startContainer, selectedNodePosition);
17106
17139
  range.setEnd(globalRange.startContainer, selectedNodePosition);
17107
17140
  }