@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
@@ -1361,24 +1361,27 @@ let DropDownBase = class DropDownBase extends Component {
1361
1361
  * @returns {HTMLElement} Return the ul li list items.
1362
1362
  */
1363
1363
  createListItems(dataSource, fields) {
1364
- if (dataSource && fields.groupBy || this.element.querySelector('optgroup')) {
1365
- if (fields.groupBy) {
1366
- if (this.sortOrder !== 'None') {
1367
- dataSource = this.getSortedDataSource(dataSource);
1364
+ if (dataSource) {
1365
+ if (fields.groupBy || this.element.querySelector('optgroup')) {
1366
+ if (fields.groupBy) {
1367
+ if (this.sortOrder !== 'None') {
1368
+ dataSource = this.getSortedDataSource(dataSource);
1369
+ }
1370
+ dataSource = ListBase.groupDataSource(dataSource, fields.properties, this.sortOrder);
1368
1371
  }
1369
- dataSource = ListBase.groupDataSource(dataSource, fields.properties, this.sortOrder);
1372
+ addClass([this.list], dropDownBaseClasses.grouping);
1370
1373
  }
1371
- addClass([this.list], dropDownBaseClasses.grouping);
1372
- }
1373
- else {
1374
- dataSource = this.getSortedDataSource(dataSource);
1374
+ else {
1375
+ dataSource = this.getSortedDataSource(dataSource);
1376
+ }
1377
+ const options = this.listOption(dataSource, fields);
1378
+ const spliceData = (dataSource.length > 100) ?
1379
+ new DataManager(dataSource).executeLocal(new Query().take(100))
1380
+ : dataSource;
1381
+ this.sortedData = dataSource;
1382
+ return ListBase.createList(this.createElement, (this.getModuleName() === 'autocomplete') ? spliceData : dataSource, options, true, this);
1375
1383
  }
1376
- const options = this.listOption(dataSource, fields);
1377
- const spliceData = (dataSource.length > 100) ?
1378
- new DataManager(dataSource).executeLocal(new Query().take(100))
1379
- : dataSource;
1380
- this.sortedData = dataSource;
1381
- return ListBase.createList(this.createElement, (this.getModuleName() === 'autocomplete') ? spliceData : dataSource, options, true, this);
1384
+ return null;
1382
1385
  }
1383
1386
  listOption(dataSource, fields) {
1384
1387
  const iconCss = isNullOrUndefined(fields.iconCss) ? false : true;
@@ -1466,7 +1469,8 @@ let DropDownBase = class DropDownBase extends Component {
1466
1469
  }
1467
1470
  updateGroupFixedHeader(element, target) {
1468
1471
  this.fixedHeaderElement.innerHTML = element.innerHTML;
1469
- this.fixedHeaderElement.style.top = target.scrollTop + 'px';
1472
+ this.fixedHeaderElement.style.position = 'fixed';
1473
+ this.fixedHeaderElement.style.top = this.list.parentElement.offsetTop + this.list.offsetTop + 'px';
1470
1474
  this.fixedHeaderElement.style.display = 'block';
1471
1475
  }
1472
1476
  getValidLi() {
@@ -1641,10 +1645,12 @@ let DropDownBase = class DropDownBase extends Component {
1641
1645
  getIndexByValueFilter(value) {
1642
1646
  let index;
1643
1647
  const listItems = this.renderItems(this.selectData, this.fields);
1644
- for (let i = 0; i < listItems.children.length; i++) {
1645
- if (!isNullOrUndefined(value) && listItems.children[i].getAttribute('data-value') === value.toString()) {
1646
- index = i;
1647
- break;
1648
+ if (listItems && listItems.children) {
1649
+ for (let i = 0; i < listItems.children.length; i++) {
1650
+ if (!isNullOrUndefined(value) && listItems.children[i].getAttribute('data-value') === value.toString()) {
1651
+ index = i;
1652
+ break;
1653
+ }
1648
1654
  }
1649
1655
  }
1650
1656
  return index;
@@ -4677,9 +4683,16 @@ let DropDownList = class DropDownList extends DropDownBase {
4677
4683
  scrollHandler() {
4678
4684
  if (Browser.isDevice && ((this.getModuleName() === 'dropdownlist' &&
4679
4685
  !this.isFilterLayout()) || (this.getModuleName() === 'combobox' && !this.allowFiltering && this.isDropDownClick))) {
4680
- this.hidePopup();
4686
+ if (this.element && !(this.isElementInViewport(this.element))) {
4687
+ this.hidePopup();
4688
+ }
4681
4689
  }
4682
4690
  }
4691
+ isElementInViewport(element) {
4692
+ var elementRect = element.getBoundingClientRect();
4693
+ return (elementRect.top >= 0 && elementRect.left >= 0 && elementRect.bottom <= window.innerHeight && elementRect.right <= window.innerWidth);
4694
+ }
4695
+ ;
4683
4696
  setSearchBoxPosition() {
4684
4697
  const searchBoxHeight = this.filterInput.parentElement.getBoundingClientRect().height;
4685
4698
  this.popupObj.element.style.maxHeight = '100%';
@@ -5811,7 +5824,7 @@ let DropDownList = class DropDownList extends DropDownBase {
5811
5824
  if (!this.enabled) {
5812
5825
  return;
5813
5826
  }
5814
- if (!this.enableVirtualization && this.getModuleName() === 'combobox') {
5827
+ if (!this.enableVirtualization && (this.getModuleName() === 'combobox' || this.getModuleName() === 'autocomplete')) {
5815
5828
  this.isTyped = true;
5816
5829
  }
5817
5830
  this.hidePopup(e);
@@ -6236,7 +6249,6 @@ let DropDownTree = class DropDownTree extends Component {
6236
6249
  const popupDiv = select('#' + this.element.id + '_options', document);
6237
6250
  detach(popupDiv ? popupDiv : isTree.parentElement);
6238
6251
  }
6239
- this.ensureAutoCheck();
6240
6252
  if (this.element.tagName === 'INPUT') {
6241
6253
  this.inputEle = this.element;
6242
6254
  if (isNullOrUndefined(this.inputEle.getAttribute('role'))) {
@@ -6323,11 +6335,6 @@ let DropDownTree = class DropDownTree extends Component {
6323
6335
  || this.noRecordsTemplate || this.customTemplate;
6324
6336
  this.renderComplete();
6325
6337
  }
6326
- ensureAutoCheck() {
6327
- if (this.allowFiltering && this.treeSettings.autoCheck) {
6328
- this.setProperties({ treeSettings: { autoCheck: false } }, true);
6329
- }
6330
- }
6331
6338
  hideCheckAll(flag) {
6332
6339
  const checkAllEle = !isNullOrUndefined(this.popupEle) ? this.popupEle.querySelector('.' + CHECKALLPARENT) : null;
6333
6340
  if (!isNullOrUndefined(checkAllEle)) {
@@ -6364,9 +6371,20 @@ let DropDownTree = class DropDownTree extends Component {
6364
6371
  this.filterTimer = window.setTimeout(() => { this.filterHandler(args.value, args.event); }, this.filterDelayTime);
6365
6372
  }
6366
6373
  }
6374
+ isChildObject() {
6375
+ if (typeof this.treeObj.fields.child === 'object') {
6376
+ return true;
6377
+ }
6378
+ else {
6379
+ return false;
6380
+ }
6381
+ }
6367
6382
  filterHandler(value, event) {
6368
6383
  this.isFromFilterChange = true;
6369
6384
  if (!this.isFilteredData) {
6385
+ if (this.isRemoteData) {
6386
+ this.treeObj.expandedNodes = [];
6387
+ }
6370
6388
  this.treeData = this.treeObj.getTreeData();
6371
6389
  }
6372
6390
  const filterFields = this.cloneFields(this.fields);
@@ -6396,6 +6414,10 @@ let DropDownTree = class DropDownTree extends Component {
6396
6414
  }
6397
6415
  else {
6398
6416
  if (this.fields.dataSource instanceof DataManager) {
6417
+ fields = this.remoteDataFilter(value, args.fields);
6418
+ fields.child = this.fields.child;
6419
+ this.treeObj.fields = this.getTreeFields(args.fields);
6420
+ this.treeObj.dataBind();
6399
6421
  flag = true;
6400
6422
  }
6401
6423
  else {
@@ -6407,6 +6429,14 @@ let DropDownTree = class DropDownTree extends Component {
6407
6429
  if (flag) {
6408
6430
  return;
6409
6431
  }
6432
+ if (this.isRemoteData) {
6433
+ if (this.isChildObject()) {
6434
+ fields.child = this.fields.child;
6435
+ }
6436
+ else {
6437
+ fields = args.fields;
6438
+ }
6439
+ }
6410
6440
  this.treeObj.fields = this.getTreeFields(fields);
6411
6441
  this.treeObj.dataBind();
6412
6442
  if (this.hasTemplate && this.portals && this.treeObj.portals) {
@@ -6422,6 +6452,33 @@ let DropDownTree = class DropDownTree extends Component {
6422
6452
  }
6423
6453
  });
6424
6454
  }
6455
+ remoteDataFilter(value, filteredFields) {
6456
+ filteredFields.dataSource = this.treeData.map(item => this.remoteChildFilter(value, item)).filter(filteredChild => !isNullOrUndefined(filteredChild));
6457
+ return filteredFields;
6458
+ }
6459
+ remoteChildFilter(value, node, isChild, isChildFiltering) {
6460
+ let children = this.isChildObject() ? node['child'] : node[this.fields.child];
6461
+ if (isNullOrUndefined(children)) {
6462
+ return (this.isMatchedNode(value, node, isChild, isChildFiltering)) ? node : null;
6463
+ }
6464
+ let matchedChildren = [];
6465
+ for (let i = 0; i < children.length; i++) {
6466
+ let filteredChild = this.remoteChildFilter(value, children[i], true, true);
6467
+ if (!isNullOrUndefined(filteredChild)) {
6468
+ matchedChildren.push(filteredChild);
6469
+ }
6470
+ }
6471
+ let filteredItems = Object.assign({}, node);
6472
+ isChildFiltering = false;
6473
+ if (matchedChildren.length !== 0) {
6474
+ filteredItems.child = matchedChildren;
6475
+ }
6476
+ else {
6477
+ filteredItems.child = null;
6478
+ filteredItems = (this.isMatchedNode(value, filteredItems)) ? filteredItems : null;
6479
+ }
6480
+ return filteredItems;
6481
+ }
6425
6482
  nestedFilter(value, filteredFields) {
6426
6483
  // eslint-disable-next-line
6427
6484
  const matchedDataSource = [];
@@ -6503,8 +6560,17 @@ let DropDownTree = class DropDownTree extends Component {
6503
6560
  return filteredFields;
6504
6561
  }
6505
6562
  // eslint-disable-next-line
6506
- isMatchedNode(value, node) {
6507
- let checkValue = node[this.fields.text];
6563
+ isMatchedNode(value, node, isChild, isChildFiltering) {
6564
+ let checkValue;
6565
+ let isObjectValue = isChild && isChildFiltering && this.isChildObject();
6566
+ checkValue = isObjectValue ? node[this.fields.child.text] : node[this.fields.text];
6567
+ if (!checkValue) {
6568
+ let tempChild = this.fields.child;
6569
+ while (!node[tempChild.text]) {
6570
+ tempChild = tempChild.child;
6571
+ }
6572
+ checkValue = node[tempChild.text];
6573
+ }
6508
6574
  if (this.ignoreCase) {
6509
6575
  checkValue = checkValue.toLowerCase();
6510
6576
  value = value.toLowerCase();
@@ -7459,8 +7525,6 @@ let DropDownTree = class DropDownTree extends Component {
7459
7525
  if (this.isFilteredData) {
7460
7526
  this.filterObj.value = '';
7461
7527
  this.treeObj.fields = this.getTreeFields(this.fields);
7462
- if (this.isReact)
7463
- this.refresh();
7464
7528
  this.isFilterRestore = true;
7465
7529
  this.isFilteredData = false;
7466
7530
  this.hideCheckAll(false);
@@ -7481,12 +7545,18 @@ let DropDownTree = class DropDownTree extends Component {
7481
7545
  }
7482
7546
  else {
7483
7547
  this.popupEle = this.popupObj.element;
7548
+ if (this.isReact && this.isFilterRestore) {
7549
+ this.treeObj.refresh();
7550
+ this.isFilteredData = true;
7551
+ this.popupEle.removeChild(this.filterContainer);
7552
+ }
7484
7553
  }
7485
7554
  }
7486
7555
  else {
7487
7556
  isCancelled = true;
7488
7557
  }
7489
- if (this.isFirstRender && !isCancelled) {
7558
+ if (this.isFirstRender && !isCancelled || this.isFilteredData) {
7559
+ this.isFilteredData = false;
7490
7560
  prepend([this.popupDiv], this.popupEle);
7491
7561
  removeClass([this.popupDiv], DDTHIDEICON);
7492
7562
  if (this.allowFiltering) {
@@ -7852,6 +7922,9 @@ let DropDownTree = class DropDownTree extends Component {
7852
7922
  if (this.value === null) {
7853
7923
  this.setProperties({ value: [] }, true);
7854
7924
  }
7925
+ if (args.node.classList.contains("e-active")) {
7926
+ this.hidePopup();
7927
+ }
7855
7928
  }
7856
7929
  }
7857
7930
  updateHiddenValue() {
@@ -8510,7 +8583,6 @@ let DropDownTree = class DropDownTree extends Component {
8510
8583
  updateTreeSettings(prop) {
8511
8584
  const value = Object.keys(prop.treeSettings)[0];
8512
8585
  if (value === 'autoCheck') {
8513
- this.ensureAutoCheck();
8514
8586
  this.treeObj.autoCheck = this.treeSettings.autoCheck;
8515
8587
  }
8516
8588
  else if (value === 'loadOnDemand') {
@@ -8631,7 +8703,6 @@ let DropDownTree = class DropDownTree extends Component {
8631
8703
  this.destroyFilter();
8632
8704
  }
8633
8705
  }
8634
- this.ensureAutoCheck();
8635
8706
  }
8636
8707
  updateFilterPlaceHolder() {
8637
8708
  if (this.filterObj) {
@@ -11041,7 +11112,9 @@ let MultiSelect = class MultiSelect extends DropDownBase {
11041
11112
  }
11042
11113
  if (activeElement && activeElement.item !== null) {
11043
11114
  this.addListFocus(activeElement.item);
11044
- this.scrollBottom(activeElement.item, activeElement.index);
11115
+ if (((this.allowCustomValue || this.allowFiltering) && this.isPopupOpen() && this.closePopupOnSelect) || this.closePopupOnSelect) {
11116
+ this.scrollBottom(activeElement.item, activeElement.index);
11117
+ }
11045
11118
  }
11046
11119
  }
11047
11120
  getAriaAttributes() {
@@ -14546,10 +14619,10 @@ let MultiSelect = class MultiSelect extends DropDownBase {
14546
14619
  if (!args.cancel) {
14547
14620
  if (!this.ulElement) {
14548
14621
  this.beforePopupOpen = true;
14549
- super.render(e);
14550
14622
  if (this.mode === 'CheckBox' && Browser.isDevice && this.allowFiltering) {
14551
14623
  this.notify('popupFullScreen', { module: 'CheckBoxSelection', enable: this.mode === 'CheckBox' });
14552
14624
  }
14625
+ super.render(e);
14553
14626
  return;
14554
14627
  }
14555
14628
  if (this.mode === 'CheckBox' && Browser.isDevice && this.allowFiltering) {
@@ -15943,6 +16016,19 @@ let ListBox = ListBox_1 = class ListBox extends DropDownBase {
15943
16016
  this.list.insertBefore(searchEle, this.list.firstElementChild);
15944
16017
  this.filterParent = this.list.getElementsByClassName('e-filter-parent')[0];
15945
16018
  this.filterWireEvents(searchEle);
16019
+ let inputSearch = searchEle.querySelector('.e-input-filter');
16020
+ if (inputSearch) {
16021
+ inputSearch.addEventListener('focus', function () {
16022
+ if (!searchEle.childNodes[0].classList.contains('e-input-focus')) {
16023
+ searchEle.childNodes[0].classList.add('e-input-focus');
16024
+ }
16025
+ });
16026
+ inputSearch.addEventListener('blur', function () {
16027
+ if (searchEle.childNodes[0].classList.contains('e-input-focus')) {
16028
+ searchEle.childNodes[0].classList.remove('e-input-focus');
16029
+ }
16030
+ });
16031
+ }
15946
16032
  }
15947
16033
  this.initWrapper();
15948
16034
  this.setSelection();
@@ -18303,7 +18389,8 @@ let Mention = class Mention extends DropDownBase {
18303
18389
  return;
18304
18390
  }
18305
18391
  this.isTyped = e.code !== 'Enter' && e.code !== 'Space' && e.code !== 'ArrowDown' && e.code !== 'ArrowUp' ? true : false;
18306
- if (document.activeElement != this.inputElement) {
18392
+ const isRteImage = document.activeElement.parentElement && document.activeElement.parentElement.querySelector('.e-rte-image') ? true : false;
18393
+ if (document.activeElement != this.inputElement && !isRteImage) {
18307
18394
  this.inputElement.focus();
18308
18395
  }
18309
18396
  if (this.isContentEditable(this.inputElement)) {
@@ -19214,6 +19301,12 @@ let Mention = class Mention extends DropDownBase {
19214
19301
  if (this.isPopupOpen) {
19215
19302
  this.hidePopup();
19216
19303
  }
19304
+ //New event to update the RichTextEditor value, when a mention item is selected using mouse click action.
19305
+ if (!isNullOrUndefined(e.pointerType) && e.pointerType === 'mouse') {
19306
+ const event = new CustomEvent('content-changed', { detail: { click: true } });
19307
+ this.inputElement.dispatchEvent(event);
19308
+ }
19309
+
19217
19310
  this.onChangeEvent(e);
19218
19311
  }
19219
19312
  }