@syncfusion/ej2-dropdowns 23.1.40 → 23.1.42

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 (61) hide show
  1. package/CHANGELOG.md +34 -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 +77 -12
  6. package/dist/es6/ej2-dropdowns.es2015.js.map +1 -1
  7. package/dist/es6/ej2-dropdowns.es5.js +77 -12
  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 +9 -9
  13. package/src/drop-down-base/drop-down-base.d.ts +1 -0
  14. package/src/drop-down-base/drop-down-base.js +5 -0
  15. package/src/drop-down-list/drop-down-list.d.ts +3 -0
  16. package/src/drop-down-list/drop-down-list.js +33 -2
  17. package/src/drop-down-tree/drop-down-tree.js +2 -2
  18. package/src/mention/mention.d.ts +1 -0
  19. package/src/mention/mention.js +32 -8
  20. package/src/multi-select/multi-select.js +5 -0
  21. package/styles/auto-complete/bootstrap4.css +13 -2
  22. package/styles/bootstrap-dark.css +1 -1
  23. package/styles/bootstrap.css +1 -1
  24. package/styles/bootstrap4.css +33 -3
  25. package/styles/bootstrap5-dark.css +1 -1
  26. package/styles/bootstrap5.css +1 -1
  27. package/styles/combo-box/bootstrap4.css +13 -2
  28. package/styles/drop-down-list/_bootstrap4-definition.scss +13 -2
  29. package/styles/drop-down-list/bootstrap4.css +13 -2
  30. package/styles/fabric-dark.css +1 -1
  31. package/styles/fabric.css +1 -1
  32. package/styles/fluent-dark.css +1 -1
  33. package/styles/fluent.css +1 -1
  34. package/styles/highcontrast-light.css +1 -1
  35. package/styles/highcontrast.css +1 -1
  36. package/styles/list-box/_theme.scss +1 -1
  37. package/styles/list-box/bootstrap-dark.css +1 -1
  38. package/styles/list-box/bootstrap.css +1 -1
  39. package/styles/list-box/bootstrap4.css +1 -1
  40. package/styles/list-box/bootstrap5-dark.css +1 -1
  41. package/styles/list-box/bootstrap5.css +1 -1
  42. package/styles/list-box/fabric-dark.css +1 -1
  43. package/styles/list-box/fabric.css +1 -1
  44. package/styles/list-box/fluent-dark.css +1 -1
  45. package/styles/list-box/fluent.css +1 -1
  46. package/styles/list-box/highcontrast-light.css +1 -1
  47. package/styles/list-box/highcontrast.css +1 -1
  48. package/styles/list-box/material-dark.css +1 -1
  49. package/styles/list-box/material.css +1 -1
  50. package/styles/list-box/material3-dark.css +1 -1
  51. package/styles/list-box/material3.css +1 -1
  52. package/styles/list-box/tailwind-dark.css +1 -1
  53. package/styles/list-box/tailwind.css +1 -1
  54. package/styles/material-dark.css +1 -1
  55. package/styles/material.css +1 -1
  56. package/styles/material3-dark.css +1 -1
  57. package/styles/material3.css +1 -1
  58. package/styles/multi-select/_bootstrap4-definition.scss +19 -0
  59. package/styles/multi-select/bootstrap4.css +19 -0
  60. package/styles/tailwind-dark.css +1 -1
  61. package/styles/tailwind.css +1 -1
@@ -1611,6 +1611,11 @@ let DropDownBase = class DropDownBase extends Component {
1611
1611
  this.initialize(e);
1612
1612
  }
1613
1613
  }
1614
+ removeScrollEvent() {
1615
+ if (this.list) {
1616
+ EventHandler.remove(this.list, 'scroll', this.setFloatingHeader);
1617
+ }
1618
+ }
1614
1619
  /**
1615
1620
  * Return the module name of this component.
1616
1621
  *
@@ -1991,6 +1996,7 @@ let DropDownList = class DropDownList extends DropDownBase {
1991
1996
  this.pageCount = 0;
1992
1997
  this.isPreventKeyAction = false;
1993
1998
  this.generatedDataObject = {};
1999
+ this.isTouched = false;
1994
2000
  this.virtualListInfo = {
1995
2001
  currentPageNumber: null,
1996
2002
  direction: null,
@@ -3751,7 +3757,12 @@ let DropDownList = class DropDownList extends DropDownBase {
3751
3757
  this.updateActionCompleteDataValues(ulElement, list);
3752
3758
  }
3753
3759
  }
3754
- if (!this.enableVirtualization) {
3760
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
3761
+ if ((this.allowCustom || (this.allowFiltering && !this.isValueInList(list, this.value) && this.dataSource instanceof DataManager)) && !this.enableVirtualization) {
3762
+ this.addNewItem(list, selectedItem);
3763
+ }
3764
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
3765
+ else if ((this.allowCustom || (this.allowFiltering && this.isValueInList(list, this.value))) && !this.enableVirtualization) {
3755
3766
  this.addNewItem(list, selectedItem);
3756
3767
  }
3757
3768
  if (!isNullOrUndefined(this.itemData) || (isNullOrUndefined(this.itemData) && this.enableVirtualization)) {
@@ -3785,6 +3796,24 @@ let DropDownList = class DropDownList extends DropDownBase {
3785
3796
  }
3786
3797
  }
3787
3798
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
3799
+ isValueInList(list, valueToFind) {
3800
+ if (Array.isArray(list)) {
3801
+ for (let i = 0; i < list.length; i++) {
3802
+ if (list[i] === valueToFind) {
3803
+ return true;
3804
+ }
3805
+ }
3806
+ }
3807
+ else if (typeof list === 'object' && list !== null) {
3808
+ for (const key in list) {
3809
+ if (Object.prototype.hasOwnProperty.call(list, key) && list[key] === valueToFind) {
3810
+ return true;
3811
+ }
3812
+ }
3813
+ }
3814
+ return false;
3815
+ }
3816
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
3788
3817
  checkFieldValue(list, fieldValue) {
3789
3818
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
3790
3819
  let checkField = list;
@@ -4539,6 +4568,7 @@ let DropDownList = class DropDownList extends DropDownBase {
4539
4568
  * @returns {void}
4540
4569
  */
4541
4570
  render() {
4571
+ this.preselectedIndex = !isNullOrUndefined(this.index) ? this.index : null;
4542
4572
  if (this.element.tagName === 'INPUT') {
4543
4573
  this.inputElement = this.element;
4544
4574
  if (isNullOrUndefined(this.inputElement.getAttribute('role'))) {
@@ -4776,7 +4806,6 @@ let DropDownList = class DropDownList extends DropDownBase {
4776
4806
  if (this.allowFiltering && newProp.dataSource && !isNullOrUndefined(Object.keys(newProp.dataSource))) {
4777
4807
  this.actionCompleteData = { ulElement: null, list: null, isUpdated: false };
4778
4808
  this.actionData = this.actionCompleteData;
4779
- this.itemData = null;
4780
4809
  }
4781
4810
  else if (this.allowFiltering && newProp.query && !isNullOrUndefined(Object.keys(newProp.query))) {
4782
4811
  this.actionCompleteData = this.getModuleName() === 'combobox' ?
@@ -4821,6 +4850,13 @@ let DropDownList = class DropDownList extends DropDownBase {
4821
4850
  * @returns {void}
4822
4851
  */
4823
4852
  onPropertyChanged(newProp, oldProp) {
4853
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
4854
+ if (!isNullOrUndefined(newProp.dataSource) && !this.isTouched && (isNullOrUndefined(newProp.value) && isNullOrUndefined(newProp.index)) && !isNullOrUndefined(this.preselectedIndex)) {
4855
+ newProp.index = this.preselectedIndex;
4856
+ }
4857
+ if (!isNullOrUndefined(newProp.value) || !isNullOrUndefined(newProp.index)) {
4858
+ this.isTouched = true;
4859
+ }
4824
4860
  if (this.getModuleName() === 'dropdownlist') {
4825
4861
  this.checkData(newProp);
4826
4862
  this.setUpdateInitial(['fields', 'query', 'dataSource'], newProp);
@@ -7359,12 +7395,12 @@ let DropDownTree = class DropDownTree extends Component {
7359
7395
  const nodes = this.treeObj.element.querySelectorAll('li');
7360
7396
  const checkedNodes = this.treeObj.element.querySelectorAll('li .e-checkbox-wrapper[aria-checked=true]');
7361
7397
  const wrap = closest(this.checkBoxElement, '.' + CHECKBOXWRAP);
7362
- if (wrap && args.action === 'uncheck' && (args.isInteracted || checkedNodes.length === 0)) {
7398
+ if (wrap && args.action === 'uncheck' && (args.isInteracted || checkedNodes.length === 0 || args.data[0].isChecked == "false")) {
7363
7399
  this.isReverseUpdate = true;
7364
7400
  this.changeState(wrap, 'uncheck');
7365
7401
  this.isReverseUpdate = false;
7366
7402
  }
7367
- else if (wrap && args.action === 'check' && checkedNodes.length === nodes.length && (args.isInteracted || this.isCheckAllCalled)) {
7403
+ else if (wrap && args.action === 'check' && checkedNodes.length === nodes.length && (args.isInteracted || this.isCheckAllCalled || args.data[0].isChecked == "true")) {
7368
7404
  this.isReverseUpdate = true;
7369
7405
  this.isCheckAllCalled = false;
7370
7406
  this.changeState(wrap, 'check');
@@ -13721,6 +13757,11 @@ let MultiSelect = class MultiSelect extends DropDownBase {
13721
13757
  }
13722
13758
  this.updateSelectElementData(this.allowFiltering);
13723
13759
  break;
13760
+ case 'fields':
13761
+ if (isNullOrUndefined(this.fields.groupBy)) {
13762
+ this.removeScrollEvent();
13763
+ }
13764
+ break;
13724
13765
  default:
13725
13766
  {
13726
13767
  // eslint-disable-next-line max-len
@@ -17969,6 +18010,8 @@ let Mention = class Mention extends DropDownBase {
17969
18010
  this.initializePopup(popupEle, offsetValue, left);
17970
18011
  this.checkCollision(popupEle);
17971
18012
  popupEle.style.visibility = 'visible';
18013
+ let popupLeft = popupEle.parentElement.offsetWidth - popupEle.offsetWidth;
18014
+ let popupHeight = popupEle.offsetHeight;
17972
18015
  addClass([popupEle], ['e-mention', 'e-popup', 'e-popup-close']);
17973
18016
  if (!isNullOrUndefined(this.list)) {
17974
18017
  this.unWireListEvents();
@@ -17997,9 +18040,23 @@ let Mention = class Mention extends DropDownBase {
17997
18040
  popupEle.style.cssText = 'top: '.concat(coordinates.top.toString(), 'px;\n left: ').concat(coordinates.left.toString(), 'px;\nposition: absolute;\n display: block;');
17998
18041
  }
17999
18042
  else {
18000
- popupEle.style.left = formatUnit(coordinates.left);
18001
- popupEle.style.top = formatUnit(coordinates.top - parseInt(this.popupHeight.toString()));
18043
+ if (this.collision.length > 0 && this.collision.indexOf('right') > -1 && this.collision.indexOf('bottom') === -1) {
18044
+ popupEle.style.cssText = 'top: '.concat(coordinates.top.toString(), 'px;\n left: ').concat(popupLeft.toString(), 'px;\nposition: absolute;\n display: block;');
18045
+ }
18046
+ else if (this.collision && this.collision.length > 0 && this.collision.indexOf('bottom') > -1 && this.collision.indexOf('right') === -1) {
18047
+ popupEle.style.left = formatUnit(coordinates.left);
18048
+ popupEle.style.top = formatUnit(coordinates.top - parseInt(popupHeight.toString()));
18049
+ }
18050
+ else if (this.collision && this.collision.length > 0 && this.collision.indexOf('bottom') > -1 && this.collision.indexOf('right') > -1) {
18051
+ popupEle.style.left = formatUnit(popupLeft);
18052
+ popupEle.style.top = formatUnit(coordinates.top - parseInt(popupHeight.toString()));
18053
+ }
18054
+ else {
18055
+ popupEle.style.left = formatUnit(coordinates.left);
18056
+ popupEle.style.top = formatUnit(coordinates.top - parseInt(this.popupHeight.toString()));
18057
+ }
18002
18058
  this.isCollided = false;
18059
+ this.collision = [];
18003
18060
  }
18004
18061
  popupEle.style.width = this.popupWidth !== '100%' && !isNullOrUndefined(this.popupWidth) ? formatUnit(this.popupWidth) : 'auto';
18005
18062
  this.setHeight(popupEle);
@@ -18028,8 +18085,8 @@ let Mention = class Mention extends DropDownBase {
18028
18085
  checkCollision(popupEle) {
18029
18086
  if (!Browser.isDevice || (Browser.isDevice && !(this.getModuleName() === 'mention'))) {
18030
18087
  let coordinates = this.getCoordinates(this.inputElement, this.getTriggerCharPosition());
18031
- const collision = isCollide(popupEle, null, coordinates.left, coordinates.top);
18032
- if (collision.length > 0) {
18088
+ this.collision = isCollide(popupEle, null, coordinates.left, coordinates.top);
18089
+ if (this.collision.length > 0) {
18033
18090
  popupEle.style.marginTop = -parseInt(getComputedStyle(popupEle).marginTop, 10) + 'px';
18034
18091
  this.isCollided = true;
18035
18092
  }
@@ -18163,10 +18220,18 @@ let Mention = class Mention extends DropDownBase {
18163
18220
  document.body.removeChild(div);
18164
18221
  }
18165
18222
  else {
18166
- coordinates = {
18167
- top: rect.top + windowTop + parseInt(getComputedStyle(this.inputElement).fontSize, 10) - (this.isCollided ? 10 : 0),
18168
- left: rect.left + windowLeft + width
18169
- };
18223
+ if (this.collision && this.collision.length > 0 && this.collision.indexOf('right') > -1 && this.collision.indexOf('bottom') === -1) {
18224
+ coordinates = {
18225
+ top: rect.top + windowTop + parseInt(getComputedStyle(this.inputElement).fontSize, 10),
18226
+ left: rect.left + windowLeft + width
18227
+ };
18228
+ }
18229
+ else {
18230
+ coordinates = {
18231
+ top: rect.top + windowTop + parseInt(getComputedStyle(this.inputElement).fontSize, 10) - (this.isCollided ? 10 : 0),
18232
+ left: rect.left + windowLeft + width
18233
+ };
18234
+ }
18170
18235
  }
18171
18236
  return coordinates;
18172
18237
  }