@syncfusion/ej2-dropdowns 24.1.45 → 24.1.47

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 (55) hide show
  1. package/CHANGELOG.md +38 -0
  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 +131 -38
  6. package/dist/es6/ej2-dropdowns.es2015.js.map +1 -1
  7. package/dist/es6/ej2-dropdowns.es5.js +136 -38
  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 +10 -10
  13. package/src/drop-down-base/drop-down-base.js +26 -20
  14. package/src/drop-down-list/drop-down-list.d.ts +1 -0
  15. package/src/drop-down-list/drop-down-list.js +9 -2
  16. package/src/drop-down-tree/drop-down-tree.d.ts +3 -1
  17. package/src/drop-down-tree/drop-down-tree.js +76 -13
  18. package/src/list-box/list-box.js +13 -0
  19. package/src/mention/mention.js +8 -1
  20. package/src/multi-select/multi-select.js +4 -2
  21. package/styles/bootstrap-dark.css +5 -0
  22. package/styles/bootstrap.css +5 -0
  23. package/styles/bootstrap4.css +5 -0
  24. package/styles/bootstrap5-dark.css +5 -0
  25. package/styles/bootstrap5.css +5 -0
  26. package/styles/drop-down-list/_layout.scss +5 -0
  27. package/styles/drop-down-list/bootstrap-dark.css +5 -0
  28. package/styles/drop-down-list/bootstrap.css +5 -0
  29. package/styles/drop-down-list/bootstrap4.css +5 -0
  30. package/styles/drop-down-list/bootstrap5-dark.css +5 -0
  31. package/styles/drop-down-list/bootstrap5.css +5 -0
  32. package/styles/drop-down-list/fabric-dark.css +5 -0
  33. package/styles/drop-down-list/fabric.css +5 -0
  34. package/styles/drop-down-list/fluent-dark.css +5 -0
  35. package/styles/drop-down-list/fluent.css +5 -0
  36. package/styles/drop-down-list/highcontrast-light.css +5 -0
  37. package/styles/drop-down-list/highcontrast.css +5 -0
  38. package/styles/drop-down-list/material-dark.css +5 -0
  39. package/styles/drop-down-list/material.css +5 -0
  40. package/styles/drop-down-list/material3-dark.css +5 -0
  41. package/styles/drop-down-list/material3.css +5 -0
  42. package/styles/drop-down-list/tailwind-dark.css +5 -0
  43. package/styles/drop-down-list/tailwind.css +5 -0
  44. package/styles/fabric-dark.css +5 -0
  45. package/styles/fabric.css +5 -0
  46. package/styles/fluent-dark.css +5 -0
  47. package/styles/fluent.css +5 -0
  48. package/styles/highcontrast-light.css +5 -0
  49. package/styles/highcontrast.css +5 -0
  50. package/styles/material-dark.css +5 -0
  51. package/styles/material.css +5 -0
  52. package/styles/material3-dark.css +5 -0
  53. package/styles/material3.css +5 -0
  54. package/styles/tailwind-dark.css +5 -0
  55. package/styles/tailwind.css +5 -0
@@ -1446,24 +1446,27 @@ var DropDownBase = /** @__PURE__ @class */ (function (_super) {
1446
1446
  * @returns {HTMLElement} Return the ul li list items.
1447
1447
  */
1448
1448
  DropDownBase.prototype.createListItems = function (dataSource, fields) {
1449
- if (dataSource && fields.groupBy || this.element.querySelector('optgroup')) {
1450
- if (fields.groupBy) {
1451
- if (this.sortOrder !== 'None') {
1452
- dataSource = this.getSortedDataSource(dataSource);
1449
+ if (dataSource) {
1450
+ if (fields.groupBy || this.element.querySelector('optgroup')) {
1451
+ if (fields.groupBy) {
1452
+ if (this.sortOrder !== 'None') {
1453
+ dataSource = this.getSortedDataSource(dataSource);
1454
+ }
1455
+ dataSource = ListBase.groupDataSource(dataSource, fields.properties, this.sortOrder);
1453
1456
  }
1454
- dataSource = ListBase.groupDataSource(dataSource, fields.properties, this.sortOrder);
1457
+ addClass([this.list], dropDownBaseClasses.grouping);
1455
1458
  }
1456
- addClass([this.list], dropDownBaseClasses.grouping);
1457
- }
1458
- else {
1459
- dataSource = this.getSortedDataSource(dataSource);
1459
+ else {
1460
+ dataSource = this.getSortedDataSource(dataSource);
1461
+ }
1462
+ var options = this.listOption(dataSource, fields);
1463
+ var spliceData = (dataSource.length > 100) ?
1464
+ new DataManager(dataSource).executeLocal(new Query().take(100))
1465
+ : dataSource;
1466
+ this.sortedData = dataSource;
1467
+ return ListBase.createList(this.createElement, (this.getModuleName() === 'autocomplete') ? spliceData : dataSource, options, true, this);
1460
1468
  }
1461
- var options = this.listOption(dataSource, fields);
1462
- var spliceData = (dataSource.length > 100) ?
1463
- new DataManager(dataSource).executeLocal(new Query().take(100))
1464
- : dataSource;
1465
- this.sortedData = dataSource;
1466
- return ListBase.createList(this.createElement, (this.getModuleName() === 'autocomplete') ? spliceData : dataSource, options, true, this);
1469
+ return null;
1467
1470
  };
1468
1471
  DropDownBase.prototype.listOption = function (dataSource, fields) {
1469
1472
  var iconCss = isNullOrUndefined(fields.iconCss) ? false : true;
@@ -1551,7 +1554,8 @@ var DropDownBase = /** @__PURE__ @class */ (function (_super) {
1551
1554
  };
1552
1555
  DropDownBase.prototype.updateGroupFixedHeader = function (element, target) {
1553
1556
  this.fixedHeaderElement.innerHTML = element.innerHTML;
1554
- this.fixedHeaderElement.style.top = target.scrollTop + 'px';
1557
+ this.fixedHeaderElement.style.position = 'fixed';
1558
+ this.fixedHeaderElement.style.top = this.list.parentElement.offsetTop + this.list.offsetTop + 'px';
1555
1559
  this.fixedHeaderElement.style.display = 'block';
1556
1560
  };
1557
1561
  DropDownBase.prototype.getValidLi = function () {
@@ -1726,10 +1730,12 @@ var DropDownBase = /** @__PURE__ @class */ (function (_super) {
1726
1730
  DropDownBase.prototype.getIndexByValueFilter = function (value) {
1727
1731
  var index;
1728
1732
  var listItems = this.renderItems(this.selectData, this.fields);
1729
- for (var i = 0; i < listItems.children.length; i++) {
1730
- if (!isNullOrUndefined(value) && listItems.children[i].getAttribute('data-value') === value.toString()) {
1731
- index = i;
1732
- break;
1733
+ if (listItems && listItems.children) {
1734
+ for (var i = 0; i < listItems.children.length; i++) {
1735
+ if (!isNullOrUndefined(value) && listItems.children[i].getAttribute('data-value') === value.toString()) {
1736
+ index = i;
1737
+ break;
1738
+ }
1733
1739
  }
1734
1740
  }
1735
1741
  return index;
@@ -4795,9 +4801,16 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
4795
4801
  DropDownList.prototype.scrollHandler = function () {
4796
4802
  if (Browser.isDevice && ((this.getModuleName() === 'dropdownlist' &&
4797
4803
  !this.isFilterLayout()) || (this.getModuleName() === 'combobox' && !this.allowFiltering && this.isDropDownClick))) {
4798
- this.hidePopup();
4804
+ if (this.element && !(this.isElementInViewport(this.element))) {
4805
+ this.hidePopup();
4806
+ }
4799
4807
  }
4800
4808
  };
4809
+ DropDownList.prototype.isElementInViewport = function (element) {
4810
+ var elementRect = element.getBoundingClientRect();
4811
+ return (elementRect.top >= 0 && elementRect.left >= 0 && elementRect.bottom <= window.innerHeight && elementRect.right <= window.innerWidth);
4812
+ };
4813
+
4801
4814
  DropDownList.prototype.setSearchBoxPosition = function () {
4802
4815
  var searchBoxHeight = this.filterInput.parentElement.getBoundingClientRect().height;
4803
4816
  this.popupObj.element.style.maxHeight = '100%';
@@ -5942,7 +5955,7 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
5942
5955
  if (!this.enabled) {
5943
5956
  return;
5944
5957
  }
5945
- if (!this.enableVirtualization && this.getModuleName() === 'combobox') {
5958
+ if (!this.enableVirtualization && (this.getModuleName() === 'combobox' || this.getModuleName() === 'autocomplete')) {
5946
5959
  this.isTyped = true;
5947
5960
  }
5948
5961
  this.hidePopup(e);
@@ -6393,7 +6406,6 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
6393
6406
  var popupDiv = select('#' + this.element.id + '_options', document);
6394
6407
  detach(popupDiv ? popupDiv : isTree.parentElement);
6395
6408
  }
6396
- this.ensureAutoCheck();
6397
6409
  if (this.element.tagName === 'INPUT') {
6398
6410
  this.inputEle = this.element;
6399
6411
  if (isNullOrUndefined(this.inputEle.getAttribute('role'))) {
@@ -6480,11 +6492,6 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
6480
6492
  || this.noRecordsTemplate || this.customTemplate;
6481
6493
  this.renderComplete();
6482
6494
  };
6483
- DropDownTree.prototype.ensureAutoCheck = function () {
6484
- if (this.allowFiltering && this.treeSettings.autoCheck) {
6485
- this.setProperties({ treeSettings: { autoCheck: false } }, true);
6486
- }
6487
- };
6488
6495
  DropDownTree.prototype.hideCheckAll = function (flag) {
6489
6496
  var checkAllEle = !isNullOrUndefined(this.popupEle) ? this.popupEle.querySelector('.' + CHECKALLPARENT) : null;
6490
6497
  if (!isNullOrUndefined(checkAllEle)) {
@@ -6522,10 +6529,21 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
6522
6529
  this.filterTimer = window.setTimeout(function () { _this.filterHandler(args.value, args.event); }, this.filterDelayTime);
6523
6530
  }
6524
6531
  };
6532
+ DropDownTree.prototype.isChildObject = function () {
6533
+ if (typeof this.treeObj.fields.child === 'object') {
6534
+ return true;
6535
+ }
6536
+ else {
6537
+ return false;
6538
+ }
6539
+ };
6525
6540
  DropDownTree.prototype.filterHandler = function (value, event) {
6526
6541
  var _this = this;
6527
6542
  this.isFromFilterChange = true;
6528
6543
  if (!this.isFilteredData) {
6544
+ if (this.isRemoteData) {
6545
+ this.treeObj.expandedNodes = [];
6546
+ }
6529
6547
  this.treeData = this.treeObj.getTreeData();
6530
6548
  }
6531
6549
  var filterFields = this.cloneFields(this.fields);
@@ -6555,6 +6573,10 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
6555
6573
  }
6556
6574
  else {
6557
6575
  if (_this.fields.dataSource instanceof DataManager) {
6576
+ fields = _this.remoteDataFilter(value, args.fields);
6577
+ fields.child = _this.fields.child;
6578
+ _this.treeObj.fields = _this.getTreeFields(args.fields);
6579
+ _this.treeObj.dataBind();
6558
6580
  flag = true;
6559
6581
  }
6560
6582
  else {
@@ -6566,6 +6588,14 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
6566
6588
  if (flag) {
6567
6589
  return;
6568
6590
  }
6591
+ if (_this.isRemoteData) {
6592
+ if (_this.isChildObject()) {
6593
+ fields.child = _this.fields.child;
6594
+ }
6595
+ else {
6596
+ fields = args.fields;
6597
+ }
6598
+ }
6569
6599
  _this.treeObj.fields = _this.getTreeFields(fields);
6570
6600
  _this.treeObj.dataBind();
6571
6601
  if (_this.hasTemplate && _this.portals && _this.treeObj.portals) {
@@ -6581,6 +6611,38 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
6581
6611
  }
6582
6612
  });
6583
6613
  };
6614
+ DropDownTree.prototype.remoteDataFilter = function (value, filteredFields) {
6615
+ var _this = this;
6616
+ filteredFields.dataSource = this.treeData.map(function (item) {
6617
+ return _this.remoteChildFilter(value, item);
6618
+ }).filter(function (filteredChild) {
6619
+ return !isNullOrUndefined(filteredChild);
6620
+ });
6621
+ return filteredFields;
6622
+ };
6623
+ DropDownTree.prototype.remoteChildFilter = function (value, node, isChild, isChildFiltering) {
6624
+ var children = this.isChildObject() ? node['child'] : node[this.fields.child];
6625
+ if (isNullOrUndefined(children)) {
6626
+ return (this.isMatchedNode(value, node, isChild, isChildFiltering)) ? node : null;
6627
+ }
6628
+ var matchedChildren = [];
6629
+ for (var i = 0; i < children.length; i++) {
6630
+ var filteredChild = this.remoteChildFilter(value, children[i], true, true);
6631
+ if (!isNullOrUndefined(filteredChild)) {
6632
+ matchedChildren.push(filteredChild);
6633
+ }
6634
+ }
6635
+ var filteredItems = Object.assign({}, node);
6636
+ isChildFiltering = false;
6637
+ if (matchedChildren.length !== 0) {
6638
+ filteredItems.child = matchedChildren;
6639
+ }
6640
+ else {
6641
+ filteredItems.child = null;
6642
+ filteredItems = (this.isMatchedNode(value, filteredItems)) ? filteredItems : null;
6643
+ }
6644
+ return filteredItems;
6645
+ };
6584
6646
  DropDownTree.prototype.nestedFilter = function (value, filteredFields) {
6585
6647
  // eslint-disable-next-line
6586
6648
  var matchedDataSource = [];
@@ -6662,8 +6724,17 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
6662
6724
  return filteredFields;
6663
6725
  };
6664
6726
  // eslint-disable-next-line
6665
- DropDownTree.prototype.isMatchedNode = function (value, node) {
6666
- var checkValue = node[this.fields.text];
6727
+ DropDownTree.prototype.isMatchedNode = function (value, node, isChild, isChildFiltering) {
6728
+ var checkValue;
6729
+ var isObjectValue = isChild && isChildFiltering && this.isChildObject();
6730
+ checkValue = isObjectValue ? node[this.fields.child.text] : node[this.fields.text];
6731
+ if (!checkValue) {
6732
+ var tempChild = this.fields.child;
6733
+ while (!node[tempChild.text]) {
6734
+ tempChild = tempChild.child;
6735
+ }
6736
+ checkValue = node[tempChild.text];
6737
+ }
6667
6738
  if (this.ignoreCase) {
6668
6739
  checkValue = checkValue.toLowerCase();
6669
6740
  value = value.toLowerCase();
@@ -7625,8 +7696,6 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
7625
7696
  if (this.isFilteredData) {
7626
7697
  this.filterObj.value = '';
7627
7698
  this.treeObj.fields = this.getTreeFields(this.fields);
7628
- if (this.isReact)
7629
- this.refresh();
7630
7699
  this.isFilterRestore = true;
7631
7700
  this.isFilteredData = false;
7632
7701
  this.hideCheckAll(false);
@@ -7647,12 +7716,18 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
7647
7716
  }
7648
7717
  else {
7649
7718
  _this.popupEle = _this.popupObj.element;
7719
+ if (_this.isReact && _this.isFilterRestore) {
7720
+ _this.treeObj.refresh();
7721
+ _this.isFilteredData = true;
7722
+ _this.popupEle.removeChild(_this.filterContainer);
7723
+ }
7650
7724
  }
7651
7725
  }
7652
7726
  else {
7653
7727
  isCancelled = true;
7654
7728
  }
7655
- if (_this.isFirstRender && !isCancelled) {
7729
+ if (_this.isFirstRender && !isCancelled || _this.isFilteredData) {
7730
+ _this.isFilteredData = false;
7656
7731
  prepend([_this.popupDiv], _this.popupEle);
7657
7732
  removeClass([_this.popupDiv], DDTHIDEICON);
7658
7733
  if (_this.allowFiltering) {
@@ -8019,6 +8094,9 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
8019
8094
  if (this.value === null) {
8020
8095
  this.setProperties({ value: [] }, true);
8021
8096
  }
8097
+ if (args.node.classList.contains("e-active")) {
8098
+ this.hidePopup();
8099
+ }
8022
8100
  }
8023
8101
  };
8024
8102
  DropDownTree.prototype.updateHiddenValue = function () {
@@ -8677,7 +8755,6 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
8677
8755
  DropDownTree.prototype.updateTreeSettings = function (prop) {
8678
8756
  var value = Object.keys(prop.treeSettings)[0];
8679
8757
  if (value === 'autoCheck') {
8680
- this.ensureAutoCheck();
8681
8758
  this.treeObj.autoCheck = this.treeSettings.autoCheck;
8682
8759
  }
8683
8760
  else if (value === 'loadOnDemand') {
@@ -8798,7 +8875,6 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
8798
8875
  this.destroyFilter();
8799
8876
  }
8800
8877
  }
8801
- this.ensureAutoCheck();
8802
8878
  };
8803
8879
  DropDownTree.prototype.updateFilterPlaceHolder = function () {
8804
8880
  if (this.filterObj) {
@@ -11265,7 +11341,9 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
11265
11341
  }
11266
11342
  if (activeElement && activeElement.item !== null) {
11267
11343
  this.addListFocus(activeElement.item);
11268
- this.scrollBottom(activeElement.item, activeElement.index);
11344
+ if (((this.allowCustomValue || this.allowFiltering) && this.isPopupOpen() && this.closePopupOnSelect) || this.closePopupOnSelect) {
11345
+ this.scrollBottom(activeElement.item, activeElement.index);
11346
+ }
11269
11347
  }
11270
11348
  };
11271
11349
  MultiSelect.prototype.getAriaAttributes = function () {
@@ -14786,10 +14864,10 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
14786
14864
  if (!args.cancel) {
14787
14865
  if (!_this.ulElement) {
14788
14866
  _this.beforePopupOpen = true;
14789
- _super.prototype.render.call(_this, e);
14790
14867
  if (_this.mode === 'CheckBox' && Browser.isDevice && _this.allowFiltering) {
14791
14868
  _this.notify('popupFullScreen', { module: 'CheckBoxSelection', enable: _this.mode === 'CheckBox' });
14792
14869
  }
14870
+ _super.prototype.render.call(_this, e);
14793
14871
  return;
14794
14872
  }
14795
14873
  if (_this.mode === 'CheckBox' && Browser.isDevice && _this.allowFiltering) {
@@ -16216,6 +16294,19 @@ var ListBox = /** @__PURE__ @class */ (function (_super) {
16216
16294
  this.list.insertBefore(searchEle, this.list.firstElementChild);
16217
16295
  this.filterParent = this.list.getElementsByClassName('e-filter-parent')[0];
16218
16296
  this.filterWireEvents(searchEle);
16297
+ var inputSearch = searchEle.querySelector('.e-input-filter');
16298
+ if (inputSearch) {
16299
+ inputSearch.addEventListener('focus', function () {
16300
+ if (!searchEle.childNodes[0].classList.contains('e-input-focus')) {
16301
+ searchEle.childNodes[0].classList.add('e-input-focus');
16302
+ }
16303
+ });
16304
+ inputSearch.addEventListener('blur', function () {
16305
+ if (searchEle.childNodes[0].classList.contains('e-input-focus')) {
16306
+ searchEle.childNodes[0].classList.remove('e-input-focus');
16307
+ }
16308
+ });
16309
+ }
16219
16310
  }
16220
16311
  this.initWrapper();
16221
16312
  this.setSelection();
@@ -18625,7 +18716,8 @@ var Mention = /** @__PURE__ @class */ (function (_super) {
18625
18716
  return;
18626
18717
  }
18627
18718
  this.isTyped = e.code !== 'Enter' && e.code !== 'Space' && e.code !== 'ArrowDown' && e.code !== 'ArrowUp' ? true : false;
18628
- if (document.activeElement != this.inputElement) {
18719
+ var isRteImage = document.activeElement.parentElement && document.activeElement.parentElement.querySelector('.e-rte-image') ? true : false;
18720
+ if (document.activeElement != this.inputElement && !isRteImage) {
18629
18721
  this.inputElement.focus();
18630
18722
  }
18631
18723
  if (this.isContentEditable(this.inputElement)) {
@@ -19542,6 +19634,12 @@ var Mention = /** @__PURE__ @class */ (function (_super) {
19542
19634
  if (this.isPopupOpen) {
19543
19635
  this.hidePopup();
19544
19636
  }
19637
+ //New event to update the RichTextEditor value, when a mention item is selected using mouse click action.
19638
+ if (!isNullOrUndefined(e.pointerType) && e.pointerType === 'mouse') {
19639
+ var event_1 = new CustomEvent('content-changed', { detail: { click: true } });
19640
+ this.inputElement.dispatchEvent(event_1);
19641
+ }
19642
+
19545
19643
  this.onChangeEvent(e);
19546
19644
  }
19547
19645
  };