@syncfusion/ej2-dropdowns 22.2.5 → 22.2.9
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/CHANGELOG.md +30 -0
- 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 +66 -64
- package/dist/es6/ej2-dropdowns.es2015.js.map +1 -1
- package/dist/es6/ej2-dropdowns.es5.js +82 -80
- 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 +10 -10
- package/src/combo-box/combo-box.js +2 -1
- package/src/drop-down-base/drop-down-base.d.ts +1 -0
- package/src/drop-down-base/drop-down-base.js +54 -47
- package/src/drop-down-list/drop-down-list.js +24 -23
- package/src/multi-select/multi-select.js +2 -9
- package/.eslintrc.json +0 -260
- package/tslint.json +0 -111
|
@@ -283,6 +283,7 @@ var DropDownBase = /** @__PURE__ @class */ (function (_super) {
|
|
|
283
283
|
_this.isDynamicDataChange = false;
|
|
284
284
|
_this.addedNewItem = false;
|
|
285
285
|
_this.isAddNewItemTemplate = false;
|
|
286
|
+
_this.isRequesting = false;
|
|
286
287
|
return _this;
|
|
287
288
|
}
|
|
288
289
|
DropDownBase.prototype.getPropObject = function (prop, newProp, oldProp) {
|
|
@@ -666,61 +667,67 @@ var DropDownBase = /** @__PURE__ @class */ (function (_super) {
|
|
|
666
667
|
this.isActive = true;
|
|
667
668
|
var eventArgs = { cancel: false, data: dataSource, query: query };
|
|
668
669
|
this.isPreventChange = this.isAngular && this.preventChange ? true : this.isPreventChange;
|
|
669
|
-
this.
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
_this.
|
|
674
|
-
if (
|
|
675
|
-
_this.
|
|
676
|
-
|
|
670
|
+
if (!this.isRequesting) {
|
|
671
|
+
this.trigger('actionBegin', eventArgs, function (eventArgs) {
|
|
672
|
+
if (!eventArgs.cancel) {
|
|
673
|
+
_this.isRequesting = true;
|
|
674
|
+
_this.showSpinner();
|
|
675
|
+
if (dataSource instanceof DataManager) {
|
|
676
|
+
_this.isRequested = true;
|
|
677
|
+
if (_this.isDataFetched) {
|
|
678
|
+
_this.emptyDataRequest(fields);
|
|
679
|
+
return;
|
|
680
|
+
}
|
|
681
|
+
eventArgs.data.executeQuery(_this.getQuery(eventArgs.query)).then(function (e) {
|
|
682
|
+
_this.isPreventChange = _this.isAngular && _this.preventChange ? true : _this.isPreventChange;
|
|
683
|
+
_this.trigger('actionComplete', e, function (e) {
|
|
684
|
+
if (!e.cancel) {
|
|
685
|
+
_this.isRequesting = false;
|
|
686
|
+
var listItems = e.result;
|
|
687
|
+
if (listItems.length === 0) {
|
|
688
|
+
_this.isDataFetched = true;
|
|
689
|
+
}
|
|
690
|
+
ulElement = _this.renderItems(listItems, fields);
|
|
691
|
+
_this.onActionComplete(ulElement, listItems, e);
|
|
692
|
+
if (_this.groupTemplate) {
|
|
693
|
+
_this.renderGroupTemplate(ulElement);
|
|
694
|
+
}
|
|
695
|
+
_this.isRequested = false;
|
|
696
|
+
_this.bindChildItems(listItems, ulElement, fields, e);
|
|
697
|
+
}
|
|
698
|
+
});
|
|
699
|
+
}).catch(function (e) {
|
|
700
|
+
_this.isRequested = false;
|
|
701
|
+
_this.isRequesting = false;
|
|
702
|
+
_this.onActionFailure(e);
|
|
703
|
+
_this.hideSpinner();
|
|
704
|
+
});
|
|
677
705
|
}
|
|
678
|
-
|
|
706
|
+
else {
|
|
707
|
+
var dataManager = new DataManager(eventArgs.data);
|
|
708
|
+
var listItems = (_this.getQuery(eventArgs.query)).executeLocal(dataManager);
|
|
709
|
+
var localDataArgs = { cancel: false, result: listItems };
|
|
679
710
|
_this.isPreventChange = _this.isAngular && _this.preventChange ? true : _this.isPreventChange;
|
|
680
|
-
_this.trigger('actionComplete',
|
|
681
|
-
if (!
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
}
|
|
686
|
-
ulElement = _this.renderItems(listItems, fields);
|
|
687
|
-
_this.onActionComplete(ulElement, listItems, e);
|
|
711
|
+
_this.trigger('actionComplete', localDataArgs, function (localDataArgs) {
|
|
712
|
+
if (!localDataArgs.cancel) {
|
|
713
|
+
_this.isRequesting = false;
|
|
714
|
+
ulElement = _this.renderItems(localDataArgs.result, fields);
|
|
715
|
+
_this.onActionComplete(ulElement, localDataArgs.result, event);
|
|
688
716
|
if (_this.groupTemplate) {
|
|
689
717
|
_this.renderGroupTemplate(ulElement);
|
|
690
718
|
}
|
|
691
|
-
_this.
|
|
692
|
-
|
|
719
|
+
_this.bindChildItems(localDataArgs.result, ulElement, fields);
|
|
720
|
+
setTimeout(function () {
|
|
721
|
+
if (_this.getModuleName() === 'multiselect' && _this.itemTemplate != null && (ulElement.childElementCount > 0 && (ulElement.children[0].childElementCount > 0 || (_this.fields.groupBy && ulElement.children[1] && ulElement.children[1].childElementCount > 0)))) {
|
|
722
|
+
_this.updateDataList();
|
|
723
|
+
}
|
|
724
|
+
});
|
|
693
725
|
}
|
|
694
726
|
});
|
|
695
|
-
}
|
|
696
|
-
_this.isRequested = false;
|
|
697
|
-
_this.onActionFailure(e);
|
|
698
|
-
_this.hideSpinner();
|
|
699
|
-
});
|
|
700
|
-
}
|
|
701
|
-
else {
|
|
702
|
-
var dataManager = new DataManager(eventArgs.data);
|
|
703
|
-
var listItems = (_this.getQuery(eventArgs.query)).executeLocal(dataManager);
|
|
704
|
-
var localDataArgs = { cancel: false, result: listItems };
|
|
705
|
-
_this.isPreventChange = _this.isAngular && _this.preventChange ? true : _this.isPreventChange;
|
|
706
|
-
_this.trigger('actionComplete', localDataArgs, function (localDataArgs) {
|
|
707
|
-
if (!localDataArgs.cancel) {
|
|
708
|
-
ulElement = _this.renderItems(localDataArgs.result, fields);
|
|
709
|
-
_this.onActionComplete(ulElement, localDataArgs.result, event);
|
|
710
|
-
if (_this.groupTemplate) {
|
|
711
|
-
_this.renderGroupTemplate(ulElement);
|
|
712
|
-
}
|
|
713
|
-
_this.bindChildItems(localDataArgs.result, ulElement, fields);
|
|
714
|
-
setTimeout(function () {
|
|
715
|
-
if (_this.getModuleName() === 'multiselect' && _this.itemTemplate != null && (ulElement.childElementCount > 0 && (ulElement.children[0].childElementCount > 0 || (_this.fields.groupBy && ulElement.children[1] && ulElement.children[1].childElementCount > 0)))) {
|
|
716
|
-
_this.updateDataList();
|
|
717
|
-
}
|
|
718
|
-
});
|
|
719
|
-
}
|
|
720
|
-
});
|
|
727
|
+
}
|
|
721
728
|
}
|
|
722
|
-
}
|
|
723
|
-
}
|
|
729
|
+
});
|
|
730
|
+
}
|
|
724
731
|
};
|
|
725
732
|
DropDownBase.prototype.bindChildItems = function (listItems, ulElement, fields, e) {
|
|
726
733
|
var _this = this;
|
|
@@ -3049,7 +3056,7 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
3049
3056
|
this.isNotSearchList = false;
|
|
3050
3057
|
return;
|
|
3051
3058
|
}
|
|
3052
|
-
if (this.isActive) {
|
|
3059
|
+
if (this.isActive || !isNullOrUndefined(ulElement)) {
|
|
3053
3060
|
var selectedItem = this.selectedLI ? this.selectedLI.cloneNode(true) : null;
|
|
3054
3061
|
_super.prototype.onActionComplete.call(this, ulElement, list, e);
|
|
3055
3062
|
this.updateSelectElementData(this.allowFiltering);
|
|
@@ -3213,20 +3220,20 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
3213
3220
|
var args = { cancel: false };
|
|
3214
3221
|
this.trigger('beforeOpen', args, function (args) {
|
|
3215
3222
|
if (!args.cancel) {
|
|
3216
|
-
var
|
|
3223
|
+
var popupEle = _this.createElement('div', {
|
|
3217
3224
|
id: _this.element.id + '_popup', className: 'e-ddl e-popup ' + (_this.cssClass !== null ? _this.cssClass : '')
|
|
3218
3225
|
});
|
|
3219
|
-
var searchBox = _this.setSearchBox(
|
|
3226
|
+
var searchBox = _this.setSearchBox(popupEle);
|
|
3220
3227
|
_this.listHeight = formatUnit(_this.popupHeight);
|
|
3221
3228
|
if (_this.headerTemplate) {
|
|
3222
|
-
_this.setHeaderTemplate(
|
|
3229
|
+
_this.setHeaderTemplate(popupEle);
|
|
3223
3230
|
}
|
|
3224
|
-
append([_this.list],
|
|
3231
|
+
append([_this.list], popupEle);
|
|
3225
3232
|
if (_this.footerTemplate) {
|
|
3226
|
-
_this.setFooterTemplate(
|
|
3233
|
+
_this.setFooterTemplate(popupEle);
|
|
3227
3234
|
}
|
|
3228
|
-
document.body.appendChild(
|
|
3229
|
-
|
|
3235
|
+
document.body.appendChild(popupEle);
|
|
3236
|
+
popupEle.style.visibility = 'hidden';
|
|
3230
3237
|
if (_this.popupHeight !== 'auto') {
|
|
3231
3238
|
_this.searchBoxHeight = 0;
|
|
3232
3239
|
if (!isNullOrUndefined(searchBox.container)) {
|
|
@@ -3234,20 +3241,20 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
3234
3241
|
_this.listHeight = (parseInt(_this.listHeight, 10) - (_this.searchBoxHeight)).toString() + 'px';
|
|
3235
3242
|
}
|
|
3236
3243
|
if (_this.headerTemplate) {
|
|
3237
|
-
_this.header = _this.header ? _this.header :
|
|
3244
|
+
_this.header = _this.header ? _this.header : popupEle.querySelector('.e-ddl-header');
|
|
3238
3245
|
var height = Math.round(_this.header.getBoundingClientRect().height);
|
|
3239
3246
|
_this.listHeight = (parseInt(_this.listHeight, 10) - (height + _this.searchBoxHeight)).toString() + 'px';
|
|
3240
3247
|
}
|
|
3241
3248
|
if (_this.footerTemplate) {
|
|
3242
|
-
_this.footer = _this.footer ? _this.footer :
|
|
3249
|
+
_this.footer = _this.footer ? _this.footer : popupEle.querySelector('.e-ddl-footer');
|
|
3243
3250
|
var height = Math.round(_this.footer.getBoundingClientRect().height);
|
|
3244
3251
|
_this.listHeight = (parseInt(_this.listHeight, 10) - (height + _this.searchBoxHeight)).toString() + 'px';
|
|
3245
3252
|
}
|
|
3246
3253
|
_this.list.style.maxHeight = (parseInt(_this.listHeight, 10) - 2).toString() + 'px'; // due to box-sizing property
|
|
3247
|
-
|
|
3254
|
+
popupEle.style.maxHeight = formatUnit(_this.popupHeight);
|
|
3248
3255
|
}
|
|
3249
3256
|
else {
|
|
3250
|
-
|
|
3257
|
+
popupEle.style.height = 'auto';
|
|
3251
3258
|
}
|
|
3252
3259
|
var offsetValue = 0;
|
|
3253
3260
|
var left = void 0;
|
|
@@ -3259,7 +3266,7 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
3259
3266
|
}
|
|
3260
3267
|
if (Browser.isDevice && (!_this.allowFiltering && (_this.getModuleName() === 'dropdownlist' ||
|
|
3261
3268
|
(_this.isDropDownClick && _this.getModuleName() === 'combobox')))) {
|
|
3262
|
-
offsetValue = _this.getOffsetValue(
|
|
3269
|
+
offsetValue = _this.getOffsetValue(popupEle);
|
|
3263
3270
|
var firstItem = _this.isEmptyList() ? _this.list : _this.liCollections[0];
|
|
3264
3271
|
if (!isNullOrUndefined(_this.inputElement)) {
|
|
3265
3272
|
left = -(parseInt(getComputedStyle(firstItem).textIndent, 10) -
|
|
@@ -3268,9 +3275,8 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
3268
3275
|
}
|
|
3269
3276
|
}
|
|
3270
3277
|
_this.getFocusElement();
|
|
3271
|
-
_this.createPopup(
|
|
3272
|
-
_this.checkCollision(
|
|
3273
|
-
var popupLeft_1 = _this.enableRtl ? parseFloat(popupEle_1.style.left) - (_this.ulElement.parentElement.offsetWidth - _this.inputWrapper.container.offsetWidth) : 0;
|
|
3278
|
+
_this.createPopup(popupEle, offsetValue, left);
|
|
3279
|
+
_this.checkCollision(popupEle);
|
|
3274
3280
|
if (Browser.isDevice) {
|
|
3275
3281
|
_this.popupObj.element.classList.add(dropDownListClasses.device);
|
|
3276
3282
|
if (_this.getModuleName() === 'dropdownlist' || (_this.getModuleName() === 'combobox'
|
|
@@ -3290,8 +3296,8 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
3290
3296
|
EventHandler.add(_this.clearIconElement, 'click', _this.clearText, _this);
|
|
3291
3297
|
}
|
|
3292
3298
|
}
|
|
3293
|
-
|
|
3294
|
-
addClass([
|
|
3299
|
+
popupEle.style.visibility = 'visible';
|
|
3300
|
+
addClass([popupEle], 'e-popup-close');
|
|
3295
3301
|
var scrollParentElements = _this.popupObj.getScrollableParent(_this.inputWrapper.container);
|
|
3296
3302
|
for (var _i = 0, scrollParentElements_1 = scrollParentElements; _i < scrollParentElements_1.length; _i++) {
|
|
3297
3303
|
var element = scrollParentElements_1[_i];
|
|
@@ -3324,9 +3330,6 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
3324
3330
|
_this.beforePopupOpen = false;
|
|
3325
3331
|
_this.destroyPopup();
|
|
3326
3332
|
}
|
|
3327
|
-
if (_this.enableRtl && popupLeft_1 > 0) {
|
|
3328
|
-
popupEle_1.style.left = popupLeft_1 + "px";
|
|
3329
|
-
}
|
|
3330
3333
|
});
|
|
3331
3334
|
}
|
|
3332
3335
|
else {
|
|
@@ -3354,7 +3357,8 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
3354
3357
|
this.popupObj = new Popup(element, {
|
|
3355
3358
|
width: this.setWidth(), targetType: 'relative',
|
|
3356
3359
|
relateTo: this.inputWrapper.container, collision: { X: 'flip', Y: 'flip' }, offsetY: offsetValue,
|
|
3357
|
-
enableRtl: this.enableRtl, offsetX: left,
|
|
3360
|
+
enableRtl: this.enableRtl, offsetX: left,
|
|
3361
|
+
position: this.enableRtl ? { X: 'right', Y: 'bottom' } : { X: 'left', Y: 'bottom' },
|
|
3358
3362
|
zIndex: this.zIndex,
|
|
3359
3363
|
close: function () {
|
|
3360
3364
|
if (!_this.isDocumentClick) {
|
|
@@ -3765,7 +3769,7 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
3765
3769
|
DropDownList.prototype.setFooterTemplate = function (popupEle) {
|
|
3766
3770
|
var compiledString;
|
|
3767
3771
|
if (this.footer) {
|
|
3768
|
-
if (this.isReact) {
|
|
3772
|
+
if (this.isReact && typeof this.footerTemplate === 'function') {
|
|
3769
3773
|
this.clearTemplate(['footerTemplate']);
|
|
3770
3774
|
}
|
|
3771
3775
|
else {
|
|
@@ -3851,6 +3855,7 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
3851
3855
|
if (this.allowFiltering && newProp.dataSource && !isNullOrUndefined(Object.keys(newProp.dataSource))) {
|
|
3852
3856
|
this.actionCompleteData = { ulElement: null, list: null, isUpdated: false };
|
|
3853
3857
|
this.actionData = this.actionCompleteData;
|
|
3858
|
+
this.itemData = null;
|
|
3854
3859
|
}
|
|
3855
3860
|
else if (this.allowFiltering && newProp.query && !isNullOrUndefined(Object.keys(newProp.query))) {
|
|
3856
3861
|
this.actionCompleteData = this.getModuleName() === 'combobox' ?
|
|
@@ -4358,6 +4363,9 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
4358
4363
|
if (this.inputElement && !isNullOrUndefined(this.inputElement.onchange)) {
|
|
4359
4364
|
this.inputElement.onchange = null;
|
|
4360
4365
|
}
|
|
4366
|
+
if (this.isAngular) {
|
|
4367
|
+
this.inputElement = null;
|
|
4368
|
+
}
|
|
4361
4369
|
_super.prototype.destroy.call(this);
|
|
4362
4370
|
};
|
|
4363
4371
|
/* eslint-disable valid-jsdoc, jsdoc/require-returns-description */
|
|
@@ -7913,7 +7921,8 @@ var ComboBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
7913
7921
|
};
|
|
7914
7922
|
ComboBox.prototype.setSearchBox = function () {
|
|
7915
7923
|
this.filterInput = this.inputElement;
|
|
7916
|
-
|
|
7924
|
+
var searchBoxContainer = (this.isFiltering() || (this.isReact && this.getModuleName() === 'combobox')) ? this.inputWrapper : inputObject$1;
|
|
7925
|
+
return searchBoxContainer;
|
|
7917
7926
|
};
|
|
7918
7927
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
7919
7928
|
ComboBox.prototype.onActionComplete = function (ulElement, list, e, isUpdated) {
|
|
@@ -9410,9 +9419,6 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
9410
9419
|
if (_this.isFirstClick) {
|
|
9411
9420
|
_this.loadTemplate();
|
|
9412
9421
|
}
|
|
9413
|
-
if (_this.enableRtl) {
|
|
9414
|
-
_this.popupWrapper.style.visibility = 'hidden';
|
|
9415
|
-
}
|
|
9416
9422
|
}
|
|
9417
9423
|
});
|
|
9418
9424
|
};
|
|
@@ -11265,7 +11271,8 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
11265
11271
|
this.list.style.maxHeight = formatUnit(this.popupHeight);
|
|
11266
11272
|
}
|
|
11267
11273
|
this.popupObj = new Popup(this.popupWrapper, {
|
|
11268
|
-
width: this.calcPopupWidth(), targetType: 'relative',
|
|
11274
|
+
width: this.calcPopupWidth(), targetType: 'relative',
|
|
11275
|
+
position: this.enableRtl ? { X: 'right', Y: 'bottom' } : { X: 'left', Y: 'bottom' },
|
|
11269
11276
|
relateTo: this.overAllWrapper, collision: { X: 'flip', Y: 'flip' }, offsetY: 1,
|
|
11270
11277
|
enableRtl: this.enableRtl, zIndex: this.zIndex,
|
|
11271
11278
|
close: function () {
|
|
@@ -11281,11 +11288,6 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
11281
11288
|
},
|
|
11282
11289
|
open: function () {
|
|
11283
11290
|
_this.popupObj.resolveCollision();
|
|
11284
|
-
if (_this.enableRtl) {
|
|
11285
|
-
var popupLeft = parseFloat(_this.popupWrapper.style.left) - (_this.popupWrapper.offsetWidth - _this.overAllWrapper.offsetWidth);
|
|
11286
|
-
_this.popupWrapper.style.left = popupLeft > 0 ? popupLeft + "px" : _this.popupWrapper.style.left;
|
|
11287
|
-
_this.popupWrapper.style.visibility = 'hidden';
|
|
11288
|
-
}
|
|
11289
11291
|
if (!_this.isFirstClick) {
|
|
11290
11292
|
var ulElement = _this.list.querySelector('ul');
|
|
11291
11293
|
if (ulElement) {
|