@syncfusion/ej2-dropdowns 34.1.33 → 34.2.2

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.2
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.2",
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.2",
16
+ "@syncfusion/ej2-notifications": "~34.2.2",
17
+ "@syncfusion/ej2-popups": "~34.2.2"
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++) {
@@ -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.
@@ -838,6 +839,7 @@ export declare class MultiSelect extends DropDownBase implements IInput {
838
839
  private updateData;
839
840
  private initialTextUpdate;
840
841
  protected renderList(isEmptyData?: boolean): void;
842
+ private getTextByValueFromDataSource;
841
843
  private initialValueUpdate;
842
844
  protected updateActionCompleteData(li: HTMLElement, item: {
843
845
  [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 = [];
@@ -816,7 +817,12 @@ var MultiSelect = /** @class */ (function (_super) {
816
817
  }
817
818
  }
818
819
  else if (!(this.dataSource instanceof DataManager)) {
819
- this.initialValueUpdate();
820
+ if (!this.isRemoveSelection) {
821
+ this.initialValueUpdate(this.listData, true);
822
+ }
823
+ else {
824
+ this.initialValueUpdate();
825
+ }
820
826
  }
821
827
  this.initialUpdate();
822
828
  this.refreshPlaceHolder();
@@ -4163,6 +4169,33 @@ var MultiSelect = /** @class */ (function (_super) {
4163
4169
  this.unwireListEvents();
4164
4170
  this.wireListEvents();
4165
4171
  };
4172
+ MultiSelect.prototype.getTextByValueFromDataSource = function (value) {
4173
+ var dataSource = this.dataSource;
4174
+ if (isNullOrUndefined(dataSource) || !dataSource.length) {
4175
+ return null;
4176
+ }
4177
+ if (this.isPrimitiveData) {
4178
+ for (var i = 0; i < dataSource.length; i++) {
4179
+ if (dataSource[i] === value) {
4180
+ return dataSource[i];
4181
+ }
4182
+ }
4183
+ return null;
4184
+ }
4185
+ var fields = this.fields;
4186
+ var valueField = fields.value ? fields.value : 'value';
4187
+ var textField = fields.text ? fields.text : 'text';
4188
+ for (var i = 0; i < dataSource.length; i++) {
4189
+ var item = dataSource[i];
4190
+ if (!isNullOrUndefined(item) && getValue(valueField, item) === value) {
4191
+ var resolvedText = getValue(textField, item);
4192
+ if (!isNullOrUndefined(resolvedText)) {
4193
+ return resolvedText;
4194
+ }
4195
+ }
4196
+ }
4197
+ return null;
4198
+ };
4166
4199
  MultiSelect.prototype.initialValueUpdate = function (listItems, isInitialVirtualData, isInitialRender) {
4167
4200
  var _this = this;
4168
4201
  if (this.list) {
@@ -4213,6 +4246,10 @@ var MultiSelect = /** @class */ (function (_super) {
4213
4246
  }
4214
4247
  }
4215
4248
  }
4249
+ if (this.isPropertyChanged && isNullOrUndefined(text) && !this.allowCustomValue &&
4250
+ !(this.dataSource instanceof DataManager)) {
4251
+ text = this.getTextByValueFromDataSource(value_2);
4252
+ }
4216
4253
  if ((isNullOrUndefined(text) && this.allowCustomValue) &&
4217
4254
  ((!(this.dataSource instanceof DataManager)) ||
4218
4255
  (this.dataSource instanceof DataManager && isInitialVirtualData))) {
@@ -5847,6 +5884,7 @@ var MultiSelect = /** @class */ (function (_super) {
5847
5884
  * @returns {void}
5848
5885
  */
5849
5886
  MultiSelect.prototype.onPropertyChanged = function (newProp, oldProp) {
5887
+ this.isPropertyChanged = true;
5850
5888
  if (newProp.dataSource && !isNullOrUndefined(Object.keys(newProp.dataSource))
5851
5889
  || newProp.query && !isNullOrUndefined(Object.keys(newProp.query))) {
5852
5890
  this.mainList = null;
@@ -6019,6 +6057,7 @@ var MultiSelect = /** @class */ (function (_super) {
6019
6057
  break;
6020
6058
  }
6021
6059
  }
6060
+ this.isPropertyChanged = false;
6022
6061
  };
6023
6062
  MultiSelect.prototype.reInitializePoup = function () {
6024
6063
  if (this.popupObj) {