@syncfusion/ej2-dropdowns 34.2.5 → 34.2.7
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/README.md +14 -0
- package/dist/ej2-dropdowns.min.js +10 -1
- package/dist/ej2-dropdowns.umd.min.js +10 -1
- package/dist/ej2-dropdowns.umd.min.js.map +1 -1
- package/dist/es6/ej2-dropdowns.es2015.js +159 -69
- package/dist/es6/ej2-dropdowns.es2015.js.map +1 -1
- package/dist/es6/ej2-dropdowns.es5.js +158 -72
- package/dist/es6/ej2-dropdowns.es5.js.map +1 -1
- package/dist/global/ej2-dropdowns.min.js +10 -1
- package/dist/global/ej2-dropdowns.min.js.map +1 -1
- package/dist/global/index.d.ts +9 -0
- package/package.json +8 -8
- package/src/auto-complete/auto-complete-model.d.ts +2 -2
- package/src/auto-complete/auto-complete.d.ts +2 -2
- package/src/drop-down-list/drop-down-list-model.d.ts +1 -1
- package/src/drop-down-list/drop-down-list.d.ts +1 -1
- package/src/drop-down-list/drop-down-list.js +6 -2
- package/src/drop-down-tree/drop-down-tree-model.d.ts +3 -3
- package/src/drop-down-tree/drop-down-tree.d.ts +4 -5
- package/src/drop-down-tree/drop-down-tree.js +43 -68
- package/src/mention/mention.js +1 -1
- package/src/multi-select/multi-select-model.d.ts +1 -5
- package/src/multi-select/multi-select.d.ts +2 -5
- package/src/multi-select/multi-select.js +108 -1
|
@@ -243,6 +243,7 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
243
243
|
};
|
|
244
244
|
MultiSelect.prototype.onPopupShown = function (e) {
|
|
245
245
|
var _this = this;
|
|
246
|
+
this.sanitizeData();
|
|
246
247
|
if (Browser.isDevice && (this.mode === 'CheckBox' && this.allowFiltering)) {
|
|
247
248
|
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
248
249
|
var proxy_1 = this;
|
|
@@ -1870,7 +1871,10 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
1870
1871
|
}
|
|
1871
1872
|
}
|
|
1872
1873
|
this.UpdateSkeleton();
|
|
1873
|
-
var
|
|
1874
|
+
var hasOnlyVirtualItems = this.ulElement && this.ulElement.querySelector('li.e-virtual-list') &&
|
|
1875
|
+
this.ulElement.querySelectorAll('li:not(.e-virtual-list)').length === 0;
|
|
1876
|
+
var targetElement = hasOnlyVirtualItems ? this.list : this.ulElement;
|
|
1877
|
+
var scrollEle = targetElement.querySelectorAll('li.' + dropDownBaseClasses.li
|
|
1874
1878
|
+ ':not(.' + HIDE_LIST + ')' + ':not(.e-reorder-hide)');
|
|
1875
1879
|
if (scrollEle.length > 0) {
|
|
1876
1880
|
var element = scrollEle[(isHome) ? 0 : (scrollEle.length - 1)];
|
|
@@ -3766,6 +3770,8 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
3766
3770
|
};
|
|
3767
3771
|
MultiSelect.prototype.windowResize = function () {
|
|
3768
3772
|
this.refreshPopup();
|
|
3773
|
+
this.calculateWidth();
|
|
3774
|
+
this.updateFloatLabelOverflowWidth();
|
|
3769
3775
|
if ((!this.inputFocus || this.mode === 'CheckBox') && this.viewWrapper && this.viewWrapper.parentElement) {
|
|
3770
3776
|
this.updateDelimView();
|
|
3771
3777
|
}
|
|
@@ -3995,6 +4001,7 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
3995
4001
|
}
|
|
3996
4002
|
this.preventSetCurrentData = false;
|
|
3997
4003
|
this.initializeData();
|
|
4004
|
+
this.sanitizeData();
|
|
3998
4005
|
this.updateDataAttribute(this.htmlAttributes);
|
|
3999
4006
|
_super.prototype.preRender.call(this);
|
|
4000
4007
|
};
|
|
@@ -4025,6 +4032,56 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
4025
4032
|
endIndex: this.itemCount
|
|
4026
4033
|
};
|
|
4027
4034
|
};
|
|
4035
|
+
MultiSelect.prototype.sanitizeData = function () {
|
|
4036
|
+
if (this.enableVirtualization && this.mode === 'CheckBox') {
|
|
4037
|
+
if (this.dataSource && Array.isArray(this.dataSource) && !(this.dataSource instanceof DataManager)) {
|
|
4038
|
+
var cleanedDataSource = [];
|
|
4039
|
+
for (var i = 0; i < this.dataSource.length; i++) {
|
|
4040
|
+
var item = this.dataSource[i];
|
|
4041
|
+
if (item !== null && item !== undefined && item !== '') {
|
|
4042
|
+
if (typeof item === 'object') {
|
|
4043
|
+
var itemValue = getValue((this.fields.value ? this.fields.value : 'value'), item);
|
|
4044
|
+
if (this.fields.value !== null) {
|
|
4045
|
+
if (itemValue !== null && itemValue !== undefined && itemValue !== '') {
|
|
4046
|
+
cleanedDataSource.push(item);
|
|
4047
|
+
}
|
|
4048
|
+
}
|
|
4049
|
+
else {
|
|
4050
|
+
cleanedDataSource.push(item);
|
|
4051
|
+
}
|
|
4052
|
+
}
|
|
4053
|
+
else if (typeof item === 'string') {
|
|
4054
|
+
if (item !== null && item !== undefined && item.trim() !== '') {
|
|
4055
|
+
cleanedDataSource.push(item);
|
|
4056
|
+
}
|
|
4057
|
+
}
|
|
4058
|
+
else {
|
|
4059
|
+
cleanedDataSource.push(item);
|
|
4060
|
+
}
|
|
4061
|
+
}
|
|
4062
|
+
}
|
|
4063
|
+
if (cleanedDataSource.length !== this.dataSource.length) {
|
|
4064
|
+
this.setProperties({ dataSource: cleanedDataSource }, true);
|
|
4065
|
+
}
|
|
4066
|
+
}
|
|
4067
|
+
if (this.value && Array.isArray(this.value) && this.value.length > 0) {
|
|
4068
|
+
var cleanedValue = [];
|
|
4069
|
+
for (var i = 0; i < this.value.length; i++) {
|
|
4070
|
+
var val = this.value[i];
|
|
4071
|
+
if (val !== null && val !== undefined && val !== '') {
|
|
4072
|
+
cleanedValue.push(val);
|
|
4073
|
+
}
|
|
4074
|
+
}
|
|
4075
|
+
if (cleanedValue.length !== this.value.length) {
|
|
4076
|
+
this.setProperties({ value: cleanedValue }, true);
|
|
4077
|
+
}
|
|
4078
|
+
}
|
|
4079
|
+
return true;
|
|
4080
|
+
}
|
|
4081
|
+
else {
|
|
4082
|
+
return false;
|
|
4083
|
+
}
|
|
4084
|
+
};
|
|
4028
4085
|
MultiSelect.prototype.updateData = function (delimiterChar, e, isInitialVirtualData) {
|
|
4029
4086
|
var data = '';
|
|
4030
4087
|
var delim = this.mode === 'Delimiter' || this.mode === 'CheckBox';
|
|
@@ -4175,6 +4232,7 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
4175
4232
|
|| this.list.querySelector('.e-ul') && this.list.querySelector('.e-ul').childElementCount === 0)) {
|
|
4176
4233
|
isEmptyData = true;
|
|
4177
4234
|
}
|
|
4235
|
+
this.sanitizeData();
|
|
4178
4236
|
_super.prototype.render.call(this, null, isEmptyData);
|
|
4179
4237
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4180
4238
|
this.totalItemCount = this.dataSource && this.dataSource.length ? this.dataSource.length : 0;
|
|
@@ -5913,6 +5971,7 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
5913
5971
|
switch (prop) {
|
|
5914
5972
|
case 'query':
|
|
5915
5973
|
case 'dataSource':
|
|
5974
|
+
this.sanitizeData();
|
|
5916
5975
|
if (this.mode === 'CheckBox' && this.showSelectAll) {
|
|
5917
5976
|
if (!isNullOrUndefined(this.popupObj)) {
|
|
5918
5977
|
this.popupObj.destroy();
|
|
@@ -5935,6 +5994,7 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
5935
5994
|
this.updateVal(this.value, this.value, 'text');
|
|
5936
5995
|
break;
|
|
5937
5996
|
case 'value':
|
|
5997
|
+
this.sanitizeData();
|
|
5938
5998
|
if (this.fields.disabled) {
|
|
5939
5999
|
this.removeDisabledItemsValue(this.value);
|
|
5940
6000
|
}
|
|
@@ -6371,6 +6431,8 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
6371
6431
|
}
|
|
6372
6432
|
this.firstItem = this.dataSource && this.dataSource.length > 0 ? this.dataSource[0] : null;
|
|
6373
6433
|
var args = { cancel: false };
|
|
6434
|
+
var oldValue = extend([], this.value, [], true);
|
|
6435
|
+
var oldData = extend([], this.dataSource, [], true);
|
|
6374
6436
|
this.trigger('beforeOpen', args, function (args) {
|
|
6375
6437
|
if (!args.cancel) {
|
|
6376
6438
|
if (!_this.ulElement) {
|
|
@@ -6382,6 +6444,50 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
6382
6444
|
if (_this.inputElement && _this.mode !== 'CheckBox') {
|
|
6383
6445
|
_this.focusIn();
|
|
6384
6446
|
}
|
|
6447
|
+
if (_this.enableVirtualization && _this.mode === 'CheckBox') {
|
|
6448
|
+
if (JSON.stringify(oldData) !== JSON.stringify(_this.dataSource) && _this.sanitizeData() && _this.showSelectAll) {
|
|
6449
|
+
_this.renderPopup();
|
|
6450
|
+
}
|
|
6451
|
+
if (!isNullOrUndefined(oldValue) && !isNullOrUndefined(_this.value) &&
|
|
6452
|
+
JSON.stringify(oldValue) !== JSON.stringify(_this.value) && _this.sanitizeData()) {
|
|
6453
|
+
if (_this.fields.disabled) {
|
|
6454
|
+
_this.removeDisabledItemsValue(_this.value);
|
|
6455
|
+
}
|
|
6456
|
+
if (!_this.validateValues(_this.value, oldValue)) {
|
|
6457
|
+
return;
|
|
6458
|
+
}
|
|
6459
|
+
if (_this.isVue && !_this.changeOnBlur && !_this.validateValues(_this.value, oldValue)) {
|
|
6460
|
+
return;
|
|
6461
|
+
}
|
|
6462
|
+
_this.updateVal(_this.value, oldValue, 'value', _this.enableVirtualization);
|
|
6463
|
+
_this.addValidInputClass();
|
|
6464
|
+
if (_this.showSelectAll) {
|
|
6465
|
+
_this.renderPopup();
|
|
6466
|
+
var totalCount = _this.dataSource instanceof DataManager ? 0 :
|
|
6467
|
+
_this.dataSource.length;
|
|
6468
|
+
var selectedCount = _this.value ? _this.value.length : 0;
|
|
6469
|
+
if (selectedCount === totalCount) {
|
|
6470
|
+
var frame = null;
|
|
6471
|
+
if (_this.popupObj) {
|
|
6472
|
+
frame = _this.popupObj.element.querySelector('.e-selectall-parent .e-frame');
|
|
6473
|
+
}
|
|
6474
|
+
if (frame) {
|
|
6475
|
+
frame.classList.add('e-check');
|
|
6476
|
+
frame.classList.remove('e-uncheck');
|
|
6477
|
+
frame.classList.remove('e-stop');
|
|
6478
|
+
}
|
|
6479
|
+
}
|
|
6480
|
+
}
|
|
6481
|
+
if (!_this.closePopupOnSelect && _this.isPopupOpen()) {
|
|
6482
|
+
_this.refreshPopup();
|
|
6483
|
+
}
|
|
6484
|
+
if (_this.isPopupOpen() && _this.list && _this.list.querySelector('.e-active.e-disable')) {
|
|
6485
|
+
var activeItems = _this.list.querySelectorAll('li.' + dropDownBaseClasses.li + '.e-active' + '.e-disable');
|
|
6486
|
+
removeClass(activeItems, 'e-disable');
|
|
6487
|
+
}
|
|
6488
|
+
_this.preventChange = _this.isAngular && _this.preventChange ? !_this.preventChange : _this.preventChange;
|
|
6489
|
+
}
|
|
6490
|
+
}
|
|
6385
6491
|
return;
|
|
6386
6492
|
}
|
|
6387
6493
|
if (_this.mode === 'CheckBox' && Browser.isDevice && _this.allowFiltering && _this.isDeviceFullScreen) {
|
|
@@ -6538,6 +6644,7 @@ var MultiSelect = /** @class */ (function (_super) {
|
|
|
6538
6644
|
// eslint-disable-next-line
|
|
6539
6645
|
this.value = this.value.slice();
|
|
6540
6646
|
}
|
|
6647
|
+
this.sanitizeData();
|
|
6541
6648
|
this.setDynValue = this.initStatus = false;
|
|
6542
6649
|
this.isSelectAll = false;
|
|
6543
6650
|
this.selectAllEventEle = [];
|