@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.
- package/dist/ej2-dropdowns.min.js +2 -2
- package/dist/ej2-dropdowns.umd.min.js +2 -2
- package/dist/ej2-dropdowns.umd.min.js.map +1 -1
- package/dist/es6/ej2-dropdowns.es2015.js +174 -1
- package/dist/es6/ej2-dropdowns.es2015.js.map +1 -1
- package/dist/es6/ej2-dropdowns.es5.js +182 -1
- package/dist/es6/ej2-dropdowns.es5.js.map +1 -1
- package/dist/global/ej2-dropdowns.min.js +2 -2
- package/dist/global/ej2-dropdowns.min.js.map +1 -1
- package/dist/global/index.d.ts +1 -1
- package/package.json +8 -8
- package/src/drop-down-tree/drop-down-tree.d.ts +5 -0
- package/src/drop-down-tree/drop-down-tree.js +142 -0
- package/src/multi-select/multi-select.d.ts +2 -0
- package/src/multi-select/multi-select.js +40 -1
|
@@ -8313,6 +8313,7 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
8313
8313
|
_this.windowResizeContext = _this.windowResize.bind(_this);
|
|
8314
8314
|
// Specifies if the checkAll method has been called
|
|
8315
8315
|
_this.isCheckAllCalled = false;
|
|
8316
|
+
_this.isNodeChecked = false;
|
|
8316
8317
|
_this.isFromFilterChange = false;
|
|
8317
8318
|
_this.fallbackValue = [];
|
|
8318
8319
|
return _this;
|
|
@@ -10350,6 +10351,7 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
10350
10351
|
DropDownTree.prototype.onNodeChecked = function (args) {
|
|
10351
10352
|
var eventArgs = this.getEventArgs(args);
|
|
10352
10353
|
this.trigger('select', eventArgs);
|
|
10354
|
+
this.isNodeChecked = args.action === 'check';
|
|
10353
10355
|
if (this.isFilteredData && args.action === 'uncheck') {
|
|
10354
10356
|
var id = getValue('id', args.data[0]).toString();
|
|
10355
10357
|
this.removeSelectedData(id, true);
|
|
@@ -10675,6 +10677,143 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
10675
10677
|
}
|
|
10676
10678
|
}
|
|
10677
10679
|
};
|
|
10680
|
+
DropDownTree.prototype.getFilteredTreeData = function () {
|
|
10681
|
+
return this.treeData;
|
|
10682
|
+
};
|
|
10683
|
+
DropDownTree.prototype.getChildren = function (parentId, result) {
|
|
10684
|
+
var _this = this;
|
|
10685
|
+
var treeData = this.getFilteredTreeData();
|
|
10686
|
+
treeData.forEach(function (item) {
|
|
10687
|
+
if (!isNullOrUndefined(item) && !isNullOrUndefined(item.pid) && !isNullOrUndefined(item.id) && item.pid.toString() === parentId.toString()) {
|
|
10688
|
+
var childId = item.id.toString();
|
|
10689
|
+
if (result.indexOf(childId) === -1) {
|
|
10690
|
+
result.push(childId);
|
|
10691
|
+
_this.getChildren(childId, result);
|
|
10692
|
+
}
|
|
10693
|
+
}
|
|
10694
|
+
});
|
|
10695
|
+
};
|
|
10696
|
+
DropDownTree.prototype.getDirectChildren = function (parentId) {
|
|
10697
|
+
return this.getFilteredTreeData()
|
|
10698
|
+
.filter(function (childNode) {
|
|
10699
|
+
return !isNullOrUndefined(childNode) && !isNullOrUndefined(childNode.pid) && !isNullOrUndefined(childNode.id) && childNode.pid.toString() === parentId;
|
|
10700
|
+
})
|
|
10701
|
+
.map(function (childNode) { return childNode.id.toString(); });
|
|
10702
|
+
};
|
|
10703
|
+
DropDownTree.prototype.updateFilteredAutoCheckValues = function () {
|
|
10704
|
+
var _this = this;
|
|
10705
|
+
var treeData = this.getFilteredTreeData();
|
|
10706
|
+
var currentValues = Array.isArray(this.value) ? this.value.map(function (item) { return item.toString(); }) : [];
|
|
10707
|
+
var removeParent = function (parentId) {
|
|
10708
|
+
_this.value = _this.value.filter(function (value) { return value.toString() !== parentId; });
|
|
10709
|
+
};
|
|
10710
|
+
if (this.isNodeChecked) {
|
|
10711
|
+
this.treeObj.checkedNodes.map(function (item) { return item.toString(); }).forEach(function (value) {
|
|
10712
|
+
if (_this.value.indexOf(value) === -1) {
|
|
10713
|
+
_this.value.push(value);
|
|
10714
|
+
}
|
|
10715
|
+
});
|
|
10716
|
+
treeData.forEach(function (node) {
|
|
10717
|
+
if (isNullOrUndefined(node) || isNullOrUndefined(node.id)) {
|
|
10718
|
+
return;
|
|
10719
|
+
}
|
|
10720
|
+
var parentId = node.id.toString();
|
|
10721
|
+
if (node.haschild && _this.value.indexOf(parentId) !== -1) {
|
|
10722
|
+
var childValues = [];
|
|
10723
|
+
_this.getChildren(parentId, childValues);
|
|
10724
|
+
if (_this.value.indexOf(parentId) === -1) {
|
|
10725
|
+
_this.value.push(parentId);
|
|
10726
|
+
}
|
|
10727
|
+
childValues.forEach(function (value) {
|
|
10728
|
+
if (_this.value.indexOf(value) === -1) {
|
|
10729
|
+
_this.value.push(value);
|
|
10730
|
+
}
|
|
10731
|
+
});
|
|
10732
|
+
}
|
|
10733
|
+
currentValues = _this.value.map(function (item) { return item.toString(); });
|
|
10734
|
+
});
|
|
10735
|
+
treeData.forEach(function (node) {
|
|
10736
|
+
if (isNullOrUndefined(node) || isNullOrUndefined(node.id)) {
|
|
10737
|
+
return;
|
|
10738
|
+
}
|
|
10739
|
+
if (!node.haschild) {
|
|
10740
|
+
return;
|
|
10741
|
+
}
|
|
10742
|
+
var parentId = node.id.toString();
|
|
10743
|
+
var directChildren = _this.getDirectChildren(parentId);
|
|
10744
|
+
if (!directChildren.length) {
|
|
10745
|
+
return;
|
|
10746
|
+
}
|
|
10747
|
+
var allChildrenSelected = directChildren.every(function (childId) { return _this.value.indexOf(childId) !== -1; });
|
|
10748
|
+
if (allChildrenSelected) {
|
|
10749
|
+
var childValues = [];
|
|
10750
|
+
_this.getChildren(parentId, childValues);
|
|
10751
|
+
if (_this.value.indexOf(parentId) === -1) {
|
|
10752
|
+
_this.value.push(parentId);
|
|
10753
|
+
}
|
|
10754
|
+
childValues.forEach(function (value) {
|
|
10755
|
+
if (_this.value.indexOf(value) === -1) {
|
|
10756
|
+
_this.value.push(value);
|
|
10757
|
+
}
|
|
10758
|
+
});
|
|
10759
|
+
}
|
|
10760
|
+
else {
|
|
10761
|
+
removeParent(parentId);
|
|
10762
|
+
}
|
|
10763
|
+
currentValues = _this.value.map(function (item) { return item.toString(); });
|
|
10764
|
+
});
|
|
10765
|
+
this.selectedData.forEach(function (item) {
|
|
10766
|
+
var value = getValue(_this.treeSettings.loadOnDemand ? _this.fields.value : 'id', item).toString();
|
|
10767
|
+
if (_this.value.indexOf(value) === -1) {
|
|
10768
|
+
_this.selectedData = _this.selectedData.filter(function (data) {
|
|
10769
|
+
return getValue(_this.treeSettings.loadOnDemand ? _this.fields.value : 'id', data).toString() !== value;
|
|
10770
|
+
});
|
|
10771
|
+
}
|
|
10772
|
+
});
|
|
10773
|
+
return;
|
|
10774
|
+
}
|
|
10775
|
+
var removeValues = [];
|
|
10776
|
+
treeData.forEach(function (node) {
|
|
10777
|
+
if (isNullOrUndefined(node.id)) {
|
|
10778
|
+
return;
|
|
10779
|
+
}
|
|
10780
|
+
if (!node.haschild) {
|
|
10781
|
+
return;
|
|
10782
|
+
}
|
|
10783
|
+
var parentId = node.id.toString();
|
|
10784
|
+
if (currentValues.indexOf(parentId) === -1) {
|
|
10785
|
+
var childValues = [];
|
|
10786
|
+
_this.getChildren(parentId, childValues);
|
|
10787
|
+
if (childValues.some(function (child) { return currentValues.indexOf(child) !== -1; })) {
|
|
10788
|
+
removeValues.push.apply(removeValues, childValues);
|
|
10789
|
+
}
|
|
10790
|
+
}
|
|
10791
|
+
});
|
|
10792
|
+
if (removeValues.length) {
|
|
10793
|
+
this.value = this.value.filter(function (value) { return removeValues.indexOf(value.toString()) === -1; });
|
|
10794
|
+
currentValues = this.value.map(function (item) { return item.toString(); });
|
|
10795
|
+
}
|
|
10796
|
+
treeData.forEach(function (node) {
|
|
10797
|
+
if (isNullOrUndefined(node) || isNullOrUndefined(node.id)) {
|
|
10798
|
+
return;
|
|
10799
|
+
}
|
|
10800
|
+
if (!node.haschild) {
|
|
10801
|
+
return;
|
|
10802
|
+
}
|
|
10803
|
+
var parentId = node.id.toString();
|
|
10804
|
+
if (currentValues.indexOf(parentId) === -1) {
|
|
10805
|
+
return;
|
|
10806
|
+
}
|
|
10807
|
+
var hasDirectChild = treeData.some(function (childNode) {
|
|
10808
|
+
return !isNullOrUndefined(childNode) && !isNullOrUndefined(childNode.pid) && !isNullOrUndefined(childNode.id) && childNode.pid.toString() === parentId &&
|
|
10809
|
+
currentValues.indexOf(childNode.id.toString()) !== -1;
|
|
10810
|
+
});
|
|
10811
|
+
if (!hasDirectChild) {
|
|
10812
|
+
removeParent(parentId);
|
|
10813
|
+
currentValues = _this.value.map(function (item) { return item.toString(); });
|
|
10814
|
+
}
|
|
10815
|
+
});
|
|
10816
|
+
};
|
|
10678
10817
|
DropDownTree.prototype.updateSelectedValues = function () {
|
|
10679
10818
|
var _this = this;
|
|
10680
10819
|
this.dataValue = '';
|
|
@@ -10690,6 +10829,9 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
10690
10829
|
if (!this.isFilteredData) {
|
|
10691
10830
|
this.selectedData = [];
|
|
10692
10831
|
}
|
|
10832
|
+
if (this.treeSettings.autoCheck && this.isFilteredData && !isNullOrUndefined(this.value)) {
|
|
10833
|
+
this.updateFilteredAutoCheckValues();
|
|
10834
|
+
}
|
|
10693
10835
|
if (!isNullOrUndefined(this.value)) {
|
|
10694
10836
|
var compiledString = this.initializeValueTemplate();
|
|
10695
10837
|
for (var i = 0, len = this.value.length; i < len; i++) {
|
|
@@ -13723,6 +13865,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
13723
13865
|
_this.isBlurDispatching = false;
|
|
13724
13866
|
_this.isFilterPrevented = false;
|
|
13725
13867
|
_this.isFilteringAction = false;
|
|
13868
|
+
_this.isPropertyChanged = false;
|
|
13726
13869
|
_this.isValidKey = false;
|
|
13727
13870
|
_this.selectAllEventData = [];
|
|
13728
13871
|
_this.selectAllEventEle = [];
|
|
@@ -14433,7 +14576,12 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
14433
14576
|
}
|
|
14434
14577
|
}
|
|
14435
14578
|
else if (!(this.dataSource instanceof DataManager)) {
|
|
14436
|
-
this.
|
|
14579
|
+
if (!this.isRemoveSelection) {
|
|
14580
|
+
this.initialValueUpdate(this.listData, true);
|
|
14581
|
+
}
|
|
14582
|
+
else {
|
|
14583
|
+
this.initialValueUpdate();
|
|
14584
|
+
}
|
|
14437
14585
|
}
|
|
14438
14586
|
this.initialUpdate();
|
|
14439
14587
|
this.refreshPlaceHolder();
|
|
@@ -17775,6 +17923,33 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
17775
17923
|
this.unwireListEvents();
|
|
17776
17924
|
this.wireListEvents();
|
|
17777
17925
|
};
|
|
17926
|
+
MultiSelect.prototype.getTextByValueFromDataSource = function (value) {
|
|
17927
|
+
var dataSource = this.dataSource;
|
|
17928
|
+
if (isNullOrUndefined(dataSource) || !dataSource.length) {
|
|
17929
|
+
return null;
|
|
17930
|
+
}
|
|
17931
|
+
if (this.isPrimitiveData) {
|
|
17932
|
+
for (var i = 0; i < dataSource.length; i++) {
|
|
17933
|
+
if (dataSource[i] === value) {
|
|
17934
|
+
return dataSource[i];
|
|
17935
|
+
}
|
|
17936
|
+
}
|
|
17937
|
+
return null;
|
|
17938
|
+
}
|
|
17939
|
+
var fields = this.fields;
|
|
17940
|
+
var valueField = fields.value ? fields.value : 'value';
|
|
17941
|
+
var textField = fields.text ? fields.text : 'text';
|
|
17942
|
+
for (var i = 0; i < dataSource.length; i++) {
|
|
17943
|
+
var item = dataSource[i];
|
|
17944
|
+
if (!isNullOrUndefined(item) && getValue(valueField, item) === value) {
|
|
17945
|
+
var resolvedText = getValue(textField, item);
|
|
17946
|
+
if (!isNullOrUndefined(resolvedText)) {
|
|
17947
|
+
return resolvedText;
|
|
17948
|
+
}
|
|
17949
|
+
}
|
|
17950
|
+
}
|
|
17951
|
+
return null;
|
|
17952
|
+
};
|
|
17778
17953
|
MultiSelect.prototype.initialValueUpdate = function (listItems, isInitialVirtualData, isInitialRender) {
|
|
17779
17954
|
var _this = this;
|
|
17780
17955
|
if (this.list) {
|
|
@@ -17825,6 +18000,10 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
17825
18000
|
}
|
|
17826
18001
|
}
|
|
17827
18002
|
}
|
|
18003
|
+
if (this.isPropertyChanged && isNullOrUndefined(text) && !this.allowCustomValue &&
|
|
18004
|
+
!(this.dataSource instanceof DataManager)) {
|
|
18005
|
+
text = this.getTextByValueFromDataSource(value_2);
|
|
18006
|
+
}
|
|
17828
18007
|
if ((isNullOrUndefined(text) && this.allowCustomValue) &&
|
|
17829
18008
|
((!(this.dataSource instanceof DataManager)) ||
|
|
17830
18009
|
(this.dataSource instanceof DataManager && isInitialVirtualData))) {
|
|
@@ -19459,6 +19638,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
19459
19638
|
* @returns {void}
|
|
19460
19639
|
*/
|
|
19461
19640
|
MultiSelect.prototype.onPropertyChanged = function (newProp, oldProp) {
|
|
19641
|
+
this.isPropertyChanged = true;
|
|
19462
19642
|
if (newProp.dataSource && !isNullOrUndefined(Object.keys(newProp.dataSource))
|
|
19463
19643
|
|| newProp.query && !isNullOrUndefined(Object.keys(newProp.query))) {
|
|
19464
19644
|
this.mainList = null;
|
|
@@ -19631,6 +19811,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
19631
19811
|
break;
|
|
19632
19812
|
}
|
|
19633
19813
|
}
|
|
19814
|
+
this.isPropertyChanged = false;
|
|
19634
19815
|
};
|
|
19635
19816
|
MultiSelect.prototype.reInitializePoup = function () {
|
|
19636
19817
|
if (this.popupObj) {
|