@syncfusion/ej2-dropdowns 34.1.33 → 34.2.3

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.
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * filename: index.d.ts
3
- * version : 34.1.33
3
+ * version : 34.2.3
4
4
  * Copyright Syncfusion Inc. 2001 - 2025. All rights reserved.
5
5
  * Use of this code is subject to the terms of our license.
6
6
  * A copy of the current license can be obtained at any time by e-mailing
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@syncfusion/ej2-dropdowns",
3
- "version": "34.1.33",
3
+ "version": "34.2.3",
4
4
  "description": "Essential JS 2 DropDown Components",
5
5
  "author": "Syncfusion Inc.",
6
6
  "license": "SEE LICENSE IN license",
@@ -8,13 +8,13 @@
8
8
  "module": "./index.js",
9
9
  "es2015": "./dist/es6/ej2-dropdowns.es5.js",
10
10
  "dependencies": {
11
- "@syncfusion/ej2-base": "~34.1.30",
12
- "@syncfusion/ej2-data": "~34.1.32",
13
- "@syncfusion/ej2-inputs": "~34.1.32",
14
- "@syncfusion/ej2-lists": "~34.1.30",
15
- "@syncfusion/ej2-navigations": "~34.1.31",
16
- "@syncfusion/ej2-notifications": "~34.1.29",
17
- "@syncfusion/ej2-popups": "~34.1.29"
11
+ "@syncfusion/ej2-base": "~34.2.2",
12
+ "@syncfusion/ej2-data": "~34.2.2",
13
+ "@syncfusion/ej2-inputs": "~34.2.2",
14
+ "@syncfusion/ej2-lists": "~34.2.2",
15
+ "@syncfusion/ej2-navigations": "~34.2.3",
16
+ "@syncfusion/ej2-notifications": "~34.2.2",
17
+ "@syncfusion/ej2-popups": "~34.2.3"
18
18
  },
19
19
  "devDependencies": {},
20
20
  "keywords": [
@@ -339,6 +339,7 @@ export declare class DropDownTree extends Component<HTMLElement> implements INot
339
339
  private documentClickHandler;
340
340
  private windowResizeContext;
341
341
  private isCheckAllCalled;
342
+ private isNodeChecked;
342
343
  private isFromFilterChange;
343
344
  private valueTemplateContainer;
344
345
  private previousFilterText;
@@ -890,6 +891,10 @@ export declare class DropDownTree extends Component<HTMLElement> implements INot
890
891
  private removeSelectedData;
891
892
  private initializeValueTemplate;
892
893
  private showOrHideValueTemplate;
894
+ private getFilteredTreeData;
895
+ private getChildren;
896
+ private getDirectChildren;
897
+ private updateFilteredAutoCheckValues;
893
898
  private updateSelectedValues;
894
899
  private setChipValues;
895
900
  private setTagValues;
@@ -175,6 +175,7 @@ var DropDownTree = /** @class */ (function (_super) {
175
175
  _this.windowResizeContext = _this.windowResize.bind(_this);
176
176
  // Specifies if the checkAll method has been called
177
177
  _this.isCheckAllCalled = false;
178
+ _this.isNodeChecked = false;
178
179
  _this.isFromFilterChange = false;
179
180
  _this.fallbackValue = [];
180
181
  return _this;
@@ -2230,6 +2231,7 @@ var DropDownTree = /** @class */ (function (_super) {
2230
2231
  DropDownTree.prototype.onNodeChecked = function (args) {
2231
2232
  var eventArgs = this.getEventArgs(args);
2232
2233
  this.trigger('select', eventArgs);
2234
+ this.isNodeChecked = args.action === 'check';
2233
2235
  if (this.isFilteredData && args.action === 'uncheck') {
2234
2236
  var id = getValue('id', args.data[0]).toString();
2235
2237
  this.removeSelectedData(id, true);
@@ -2555,6 +2557,143 @@ var DropDownTree = /** @class */ (function (_super) {
2555
2557
  }
2556
2558
  }
2557
2559
  };
2560
+ DropDownTree.prototype.getFilteredTreeData = function () {
2561
+ return this.treeData;
2562
+ };
2563
+ DropDownTree.prototype.getChildren = function (parentId, result) {
2564
+ var _this = this;
2565
+ var treeData = this.getFilteredTreeData();
2566
+ treeData.forEach(function (item) {
2567
+ if (!isNOU(item) && !isNOU(item.pid) && !isNOU(item.id) && item.pid.toString() === parentId.toString()) {
2568
+ var childId = item.id.toString();
2569
+ if (result.indexOf(childId) === -1) {
2570
+ result.push(childId);
2571
+ _this.getChildren(childId, result);
2572
+ }
2573
+ }
2574
+ });
2575
+ };
2576
+ DropDownTree.prototype.getDirectChildren = function (parentId) {
2577
+ return this.getFilteredTreeData()
2578
+ .filter(function (childNode) {
2579
+ return !isNOU(childNode) && !isNOU(childNode.pid) && !isNOU(childNode.id) && childNode.pid.toString() === parentId;
2580
+ })
2581
+ .map(function (childNode) { return childNode.id.toString(); });
2582
+ };
2583
+ DropDownTree.prototype.updateFilteredAutoCheckValues = function () {
2584
+ var _this = this;
2585
+ var treeData = this.getFilteredTreeData();
2586
+ var currentValues = Array.isArray(this.value) ? this.value.map(function (item) { return item.toString(); }) : [];
2587
+ var removeParent = function (parentId) {
2588
+ _this.value = _this.value.filter(function (value) { return value.toString() !== parentId; });
2589
+ };
2590
+ if (this.isNodeChecked) {
2591
+ this.treeObj.checkedNodes.map(function (item) { return item.toString(); }).forEach(function (value) {
2592
+ if (_this.value.indexOf(value) === -1) {
2593
+ _this.value.push(value);
2594
+ }
2595
+ });
2596
+ treeData.forEach(function (node) {
2597
+ if (isNOU(node) || isNOU(node.id)) {
2598
+ return;
2599
+ }
2600
+ var parentId = node.id.toString();
2601
+ if (node.haschild && _this.value.indexOf(parentId) !== -1) {
2602
+ var childValues = [];
2603
+ _this.getChildren(parentId, childValues);
2604
+ if (_this.value.indexOf(parentId) === -1) {
2605
+ _this.value.push(parentId);
2606
+ }
2607
+ childValues.forEach(function (value) {
2608
+ if (_this.value.indexOf(value) === -1) {
2609
+ _this.value.push(value);
2610
+ }
2611
+ });
2612
+ }
2613
+ currentValues = _this.value.map(function (item) { return item.toString(); });
2614
+ });
2615
+ treeData.forEach(function (node) {
2616
+ if (isNOU(node) || isNOU(node.id)) {
2617
+ return;
2618
+ }
2619
+ if (!node.haschild) {
2620
+ return;
2621
+ }
2622
+ var parentId = node.id.toString();
2623
+ var directChildren = _this.getDirectChildren(parentId);
2624
+ if (!directChildren.length) {
2625
+ return;
2626
+ }
2627
+ var allChildrenSelected = directChildren.every(function (childId) { return _this.value.indexOf(childId) !== -1; });
2628
+ if (allChildrenSelected) {
2629
+ var childValues = [];
2630
+ _this.getChildren(parentId, childValues);
2631
+ if (_this.value.indexOf(parentId) === -1) {
2632
+ _this.value.push(parentId);
2633
+ }
2634
+ childValues.forEach(function (value) {
2635
+ if (_this.value.indexOf(value) === -1) {
2636
+ _this.value.push(value);
2637
+ }
2638
+ });
2639
+ }
2640
+ else {
2641
+ removeParent(parentId);
2642
+ }
2643
+ currentValues = _this.value.map(function (item) { return item.toString(); });
2644
+ });
2645
+ this.selectedData.forEach(function (item) {
2646
+ var value = getValue(_this.treeSettings.loadOnDemand ? _this.fields.value : 'id', item).toString();
2647
+ if (_this.value.indexOf(value) === -1) {
2648
+ _this.selectedData = _this.selectedData.filter(function (data) {
2649
+ return getValue(_this.treeSettings.loadOnDemand ? _this.fields.value : 'id', data).toString() !== value;
2650
+ });
2651
+ }
2652
+ });
2653
+ return;
2654
+ }
2655
+ var removeValues = [];
2656
+ treeData.forEach(function (node) {
2657
+ if (isNOU(node.id)) {
2658
+ return;
2659
+ }
2660
+ if (!node.haschild) {
2661
+ return;
2662
+ }
2663
+ var parentId = node.id.toString();
2664
+ if (currentValues.indexOf(parentId) === -1) {
2665
+ var childValues = [];
2666
+ _this.getChildren(parentId, childValues);
2667
+ if (childValues.some(function (child) { return currentValues.indexOf(child) !== -1; })) {
2668
+ removeValues.push.apply(removeValues, childValues);
2669
+ }
2670
+ }
2671
+ });
2672
+ if (removeValues.length) {
2673
+ this.value = this.value.filter(function (value) { return removeValues.indexOf(value.toString()) === -1; });
2674
+ currentValues = this.value.map(function (item) { return item.toString(); });
2675
+ }
2676
+ treeData.forEach(function (node) {
2677
+ if (isNOU(node) || isNOU(node.id)) {
2678
+ return;
2679
+ }
2680
+ if (!node.haschild) {
2681
+ return;
2682
+ }
2683
+ var parentId = node.id.toString();
2684
+ if (currentValues.indexOf(parentId) === -1) {
2685
+ return;
2686
+ }
2687
+ var hasDirectChild = treeData.some(function (childNode) {
2688
+ return !isNOU(childNode) && !isNOU(childNode.pid) && !isNOU(childNode.id) && childNode.pid.toString() === parentId &&
2689
+ currentValues.indexOf(childNode.id.toString()) !== -1;
2690
+ });
2691
+ if (!hasDirectChild) {
2692
+ removeParent(parentId);
2693
+ currentValues = _this.value.map(function (item) { return item.toString(); });
2694
+ }
2695
+ });
2696
+ };
2558
2697
  DropDownTree.prototype.updateSelectedValues = function () {
2559
2698
  var _this = this;
2560
2699
  this.dataValue = '';
@@ -2570,6 +2709,9 @@ var DropDownTree = /** @class */ (function (_super) {
2570
2709
  if (!this.isFilteredData) {
2571
2710
  this.selectedData = [];
2572
2711
  }
2712
+ if (this.treeSettings.autoCheck && this.isFilteredData && !isNOU(this.value)) {
2713
+ this.updateFilteredAutoCheckValues();
2714
+ }
2573
2715
  if (!isNOU(this.value)) {
2574
2716
  var compiledString = this.initializeValueTemplate();
2575
2717
  for (var i = 0, len = this.value.length; i < len; i++) {
@@ -2099,10 +2099,12 @@ var ListBox = /** @class */ (function (_super) {
2099
2099
  return;
2100
2100
  }
2101
2101
  var isSpecialKey = e.keyCode >= 186 && e.keyCode <= 192;
2102
+ var isBracketKey = e.keyCode === 219 || e.keyCode === 220 || e.keyCode === 221 || e.keyCode === 222;
2102
2103
  var isNumericKeyPadSpecialKey = e.keyCode === 107 || e.keyCode === 109 || e.keyCode === 111;
2103
2104
  var isWordCharacter = e.key && e.key.match(/\w/);
2104
- var isWordAccentCharacter = e.key && e.key.match(/[A-Za-z0-9\u00C0-\u024F ,>/:;\-+=]/);
2105
- if (!isNullOrUndefined(isWordCharacter) || !isNullOrUndefined(isWordAccentCharacter) || isSpecialKey || isNumericKeyPadSpecialKey) {
2105
+ var isWordAccentCharacter = e.key && e.key.match(/[A-Za-z0-9\u00C0-\u024F ,>/:;\-+=[\]\\ ']/);
2106
+ if (!isNullOrUndefined(isWordCharacter) || !isNullOrUndefined(isWordAccentCharacter)
2107
+ || isSpecialKey || isBracketKey || isNumericKeyPadSpecialKey) {
2106
2108
  this.isValidKey = true;
2107
2109
  }
2108
2110
  this.isBackSpace = e.keyCode === 8;
@@ -1432,11 +1432,12 @@ var Mention = /** @class */ (function (_super) {
1432
1432
  value = this.displayTempElement.innerHTML;
1433
1433
  }
1434
1434
  if (this.isContentEditable(this.inputElement)) {
1435
- var defaultSuffix = this.isRTE ? '&#8203;' : '';
1435
+ var isMozilla = Browser.info.name === 'mozilla';
1436
+ var defaultSuffix = this.isRTE || isMozilla ? '&#8203;' : '';
1436
1437
  if (Browser.isAndroid) {
1437
1438
  return '<span contenteditable="true" class="e-mention-chip">' + showChar + value + '</span>'.concat(typeof this.suffixText === 'string' ? this.suffixText : defaultSuffix);
1438
1439
  }
1439
- else if (Browser.info.name === 'mozilla') {
1440
+ else if (isMozilla) {
1440
1441
  return '<span>&#65279;<span contenteditable="false" class="e-mention-chip">' + showChar + value + '</span>&#65279;</span>'.concat(typeof this.suffixText === 'string' ? this.suffixText : defaultSuffix);
1441
1442
  }
1442
1443
  else {
@@ -80,6 +80,7 @@ export declare class MultiSelect extends DropDownBase implements IInput {
80
80
  private resizeHandler;
81
81
  private preventKeyboardInteraction;
82
82
  private scrollEvent;
83
+ private isPropertyChanged;
83
84
  /**
84
85
  * The `fields` property maps the columns of the data table and binds the data to the component.
85
86
  * * text - Maps the text column from data table for each list item.
@@ -705,6 +706,7 @@ export declare class MultiSelect extends DropDownBase implements IInput {
705
706
  [key: string]: Object;
706
707
  }[] | number[] | boolean[] | string[], e?: Object, isUpdated?: boolean): void;
707
708
  private updateActionList;
709
+ protected getAppendToElement(): HTMLElement;
708
710
  private refreshSelection;
709
711
  private hideGroupItem;
710
712
  protected getValidLi(): HTMLElement;
@@ -838,6 +840,7 @@ export declare class MultiSelect extends DropDownBase implements IInput {
838
840
  private updateData;
839
841
  private initialTextUpdate;
840
842
  protected renderList(isEmptyData?: boolean): void;
843
+ private getTextByValueFromDataSource;
841
844
  private initialValueUpdate;
842
845
  protected updateActionCompleteData(li: HTMLElement, item: {
843
846
  [key: string]: Object;
@@ -106,6 +106,7 @@ var MultiSelect = /** @class */ (function (_super) {
106
106
  _this.isBlurDispatching = false;
107
107
  _this.isFilterPrevented = false;
108
108
  _this.isFilteringAction = false;
109
+ _this.isPropertyChanged = false;
109
110
  _this.isValidKey = false;
110
111
  _this.selectAllEventData = [];
111
112
  _this.selectAllEventEle = [];
@@ -257,7 +258,8 @@ var MultiSelect = /** @class */ (function (_super) {
257
258
  if (!eventArgs.cancel) {
258
259
  _this.focusAtFirstListItem(true);
259
260
  if (_this.popupObj) {
260
- document.body.appendChild(_this.popupObj.element);
261
+ var appendToElement = _this.getAppendToElement();
262
+ appendToElement.appendChild(_this.popupObj.element);
261
263
  }
262
264
  if (_this.mode === 'CheckBox' && _this.enableGroupCheckBox && !isNullOrUndefined(_this.fields.groupBy)) {
263
265
  _this.updateListItems(_this.list.querySelectorAll('li.e-list-item'), _this.mainList.querySelectorAll('li.e-list-item'));
@@ -816,7 +818,12 @@ var MultiSelect = /** @class */ (function (_super) {
816
818
  }
817
819
  }
818
820
  else if (!(this.dataSource instanceof DataManager)) {
819
- this.initialValueUpdate();
821
+ if (!this.isRemoveSelection) {
822
+ this.initialValueUpdate(this.listData, true);
823
+ }
824
+ else {
825
+ this.initialValueUpdate();
826
+ }
820
827
  }
821
828
  this.initialUpdate();
822
829
  this.refreshPlaceHolder();
@@ -830,6 +837,16 @@ var MultiSelect = /** @class */ (function (_super) {
830
837
  this.onPopupShown(e);
831
838
  }
832
839
  };
840
+ MultiSelect.prototype.getAppendToElement = function () {
841
+ if (this.isAngular) {
842
+ var cdkPane = this.element && this.element.closest ? this.element.closest('.cdk-overlay-pane') : null;
843
+ var popoverEl = this.element && this.element.closest ? this.element.closest('[popover]') : null;
844
+ if (cdkPane && popoverEl) {
845
+ return cdkPane;
846
+ }
847
+ }
848
+ return document.body;
849
+ };
833
850
  MultiSelect.prototype.refreshSelection = function () {
834
851
  var value;
835
852
  var element;
@@ -2416,7 +2433,7 @@ var MultiSelect = /** @class */ (function (_super) {
2416
2433
  else {
2417
2434
  var listUl = this.list && this.list.querySelector('ul');
2418
2435
  var isFullList = this.isReact && this.itemTemplate && listUl != null &&
2419
- listUl.querySelectorAll('.e-list-item').length === this.mainData.length && !this.groupTemplate;
2436
+ listUl.querySelectorAll('.e-list-item').length === this.mainData.length && !this.groupTemplate && this.mode !== 'CheckBox';
2420
2437
  this.onActionComplete(isFullList ? listUl : list, this.mainData);
2421
2438
  }
2422
2439
  this.focusAtLastListItem(data);
@@ -3327,7 +3344,8 @@ var MultiSelect = /** @class */ (function (_super) {
3327
3344
  }
3328
3345
  if (!this.popupObj) {
3329
3346
  if (!isNullOrUndefined(this.popupWrapper)) {
3330
- document.body.appendChild(this.popupWrapper);
3347
+ var appendToElement = this.getAppendToElement();
3348
+ appendToElement.appendChild(this.popupWrapper);
3331
3349
  var checkboxFilter = this.popupWrapper.querySelector('.' + FILTERPARENT);
3332
3350
  if (this.mode === 'CheckBox' && !this.allowFiltering && checkboxFilter && this.filterParent) {
3333
3351
  checkboxFilter.remove();
@@ -4163,6 +4181,33 @@ var MultiSelect = /** @class */ (function (_super) {
4163
4181
  this.unwireListEvents();
4164
4182
  this.wireListEvents();
4165
4183
  };
4184
+ MultiSelect.prototype.getTextByValueFromDataSource = function (value) {
4185
+ var dataSource = this.dataSource;
4186
+ if (isNullOrUndefined(dataSource) || !dataSource.length) {
4187
+ return null;
4188
+ }
4189
+ if (this.isPrimitiveData) {
4190
+ for (var i = 0; i < dataSource.length; i++) {
4191
+ if (dataSource[i] === value) {
4192
+ return dataSource[i];
4193
+ }
4194
+ }
4195
+ return null;
4196
+ }
4197
+ var fields = this.fields;
4198
+ var valueField = fields.value ? fields.value : 'value';
4199
+ var textField = fields.text ? fields.text : 'text';
4200
+ for (var i = 0; i < dataSource.length; i++) {
4201
+ var item = dataSource[i];
4202
+ if (!isNullOrUndefined(item) && getValue(valueField, item) === value) {
4203
+ var resolvedText = getValue(textField, item);
4204
+ if (!isNullOrUndefined(resolvedText)) {
4205
+ return resolvedText;
4206
+ }
4207
+ }
4208
+ }
4209
+ return null;
4210
+ };
4166
4211
  MultiSelect.prototype.initialValueUpdate = function (listItems, isInitialVirtualData, isInitialRender) {
4167
4212
  var _this = this;
4168
4213
  if (this.list) {
@@ -4213,6 +4258,10 @@ var MultiSelect = /** @class */ (function (_super) {
4213
4258
  }
4214
4259
  }
4215
4260
  }
4261
+ if (this.isPropertyChanged && isNullOrUndefined(text) && !this.allowCustomValue &&
4262
+ !(this.dataSource instanceof DataManager)) {
4263
+ text = this.getTextByValueFromDataSource(value_2);
4264
+ }
4216
4265
  if ((isNullOrUndefined(text) && this.allowCustomValue) &&
4217
4266
  ((!(this.dataSource instanceof DataManager)) ||
4218
4267
  (this.dataSource instanceof DataManager && isInitialVirtualData))) {
@@ -5847,6 +5896,7 @@ var MultiSelect = /** @class */ (function (_super) {
5847
5896
  * @returns {void}
5848
5897
  */
5849
5898
  MultiSelect.prototype.onPropertyChanged = function (newProp, oldProp) {
5899
+ this.isPropertyChanged = true;
5850
5900
  if (newProp.dataSource && !isNullOrUndefined(Object.keys(newProp.dataSource))
5851
5901
  || newProp.query && !isNullOrUndefined(Object.keys(newProp.query))) {
5852
5902
  this.mainList = null;
@@ -6019,6 +6069,7 @@ var MultiSelect = /** @class */ (function (_super) {
6019
6069
  break;
6020
6070
  }
6021
6071
  }
6072
+ this.isPropertyChanged = false;
6022
6073
  };
6023
6074
  MultiSelect.prototype.reInitializePoup = function () {
6024
6075
  if (this.popupObj) {
@@ -6339,8 +6390,11 @@ var MultiSelect = /** @class */ (function (_super) {
6339
6390
  var mainLiLength = _this.ulElement.querySelectorAll('li.' + 'e-list-item').length;
6340
6391
  var liLength = _this.ulElement.querySelectorAll('li.'
6341
6392
  + dropDownBaseClasses.li + '.' + HIDE_LIST).length;
6393
+ var isFilterText = _this.allowFiltering && !isNullOrUndefined(_this.inputElement) &&
6394
+ _this.inputElement.value.trim() !== '';
6395
+ var isRemoteData = _this.dataSource instanceof DataManager;
6342
6396
  if (mainLiLength > 0 && (mainLiLength === liLength) && (liLength === _this.mainData.length) &&
6343
- !(_this.targetElement() !== '' && _this.allowCustomValue)) {
6397
+ !(_this.targetElement() !== '' && _this.allowCustomValue) && (!isRemoteData || !isFilterText)) {
6344
6398
  _this.beforePopupOpen = false;
6345
6399
  return;
6346
6400
  }
@@ -6768,7 +6822,8 @@ var MultiSelect = /** @class */ (function (_super) {
6768
6822
  var listParentHeight = formatUnit(this.popupHeight);
6769
6823
  listParent.style.height = (parseInt(listParentHeight, 10)).toString() + 'px';
6770
6824
  listParent.appendChild(item);
6771
- document.body.appendChild(listParent);
6825
+ var appendToElement = this.getAppendToElement();
6826
+ appendToElement.appendChild(listParent);
6772
6827
  this.virtualListHeight = listParent.getBoundingClientRect().height;
6773
6828
  var listItemHeight = Math.ceil(item.getBoundingClientRect().height) +
6774
6829
  parseInt(window.getComputedStyle(item).marginBottom, 10);