@syncfusion/ej2-multicolumn-combobox 30.1.37 → 30.1.40
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-multicolumn-combobox.umd.min.js +2 -2
- package/dist/ej2-multicolumn-combobox.umd.min.js.map +1 -1
- package/dist/es6/ej2-multicolumn-combobox.es2015.js +87 -87
- package/dist/es6/ej2-multicolumn-combobox.es2015.js.map +1 -1
- package/dist/es6/ej2-multicolumn-combobox.es5.js +95 -105
- package/dist/es6/ej2-multicolumn-combobox.es5.js.map +1 -1
- package/dist/global/ej2-multicolumn-combobox.min.js +2 -2
- package/dist/global/ej2-multicolumn-combobox.min.js.map +1 -1
- package/dist/global/index.d.ts +1 -1
- package/package.json +3 -3
- package/src/multicolumn-combobox/multi-column-combo-box-model.d.ts +1 -1
- package/src/multicolumn-combobox/multi-column-combo-box.d.ts +8 -3
- package/src/multicolumn-combobox/multi-column-combo-box.js +95 -105
|
@@ -327,6 +327,9 @@ var MultiColumnComboBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
327
327
|
};
|
|
328
328
|
MultiColumnComboBox.prototype.render = function () {
|
|
329
329
|
this.renderInput();
|
|
330
|
+
if (this.gridData == null) {
|
|
331
|
+
this.setGridData(this.dataSource);
|
|
332
|
+
}
|
|
330
333
|
this.renderGrid();
|
|
331
334
|
this.popupDiv = this.createElement('div', { className: CONTENT });
|
|
332
335
|
this.popupDiv.appendChild(this.gridEle);
|
|
@@ -334,6 +337,65 @@ var MultiColumnComboBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
334
337
|
this.renderPopup();
|
|
335
338
|
this.wireEvents();
|
|
336
339
|
};
|
|
340
|
+
MultiColumnComboBox.prototype.setGridData = function (dataSource, query) {
|
|
341
|
+
var _this = this;
|
|
342
|
+
this.trigger('actionBegin', { cancel: false, query: query }, function (args) {
|
|
343
|
+
if (!args.cancel) {
|
|
344
|
+
if (dataSource instanceof DataManager) {
|
|
345
|
+
if (_this.isShowSpinner) {
|
|
346
|
+
_this.showHideSpinner(true);
|
|
347
|
+
}
|
|
348
|
+
dataSource.executeQuery(_this.getQuery(query)).then(function (e) {
|
|
349
|
+
_this.gridData = e.result;
|
|
350
|
+
_this.trigger('actionComplete', e, function (e) {
|
|
351
|
+
_this.showHideSpinner(false);
|
|
352
|
+
if (!_this.isMainDataUpdated) {
|
|
353
|
+
_this.mainData = _this.gridData;
|
|
354
|
+
_this.remoteDataLength = _this.gridData.length;
|
|
355
|
+
_this.isMainDataUpdated = true;
|
|
356
|
+
}
|
|
357
|
+
if (_this.popupDiv) {
|
|
358
|
+
_this.updateGridDataSource();
|
|
359
|
+
}
|
|
360
|
+
});
|
|
361
|
+
}).catch(function (e) {
|
|
362
|
+
_this.trigger('actionFailure', e, null);
|
|
363
|
+
});
|
|
364
|
+
}
|
|
365
|
+
else {
|
|
366
|
+
var dataManager = new DataManager(dataSource);
|
|
367
|
+
var listItems = (_this.getQuery(query)).executeLocal(dataManager);
|
|
368
|
+
_this.gridData = listItems;
|
|
369
|
+
_this.trigger('actionComplete', { result: listItems }, function (e) {
|
|
370
|
+
if (!_this.isMainDataUpdated) {
|
|
371
|
+
_this.mainData = _this.gridData;
|
|
372
|
+
_this.remoteDataLength = _this.gridData.length;
|
|
373
|
+
_this.isMainDataUpdated = true;
|
|
374
|
+
}
|
|
375
|
+
if (_this.popupDiv) {
|
|
376
|
+
_this.updateGridDataSource();
|
|
377
|
+
}
|
|
378
|
+
});
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
});
|
|
382
|
+
};
|
|
383
|
+
MultiColumnComboBox.prototype.getQuery = function (query) {
|
|
384
|
+
var filterQuery;
|
|
385
|
+
if (!this.isCustomFilter && this.allowFiltering) {
|
|
386
|
+
filterQuery = query ? query.clone() : this.query ? this.query.clone() : new Query();
|
|
387
|
+
var filterType = this.typedString === '' ? 'contains' : this.filterType;
|
|
388
|
+
if ((this.allowFiltering && this.typedString && this.typedString !== '')) {
|
|
389
|
+
var fields = (this.fields.text) ? this.fields.text : '';
|
|
390
|
+
filterQuery.where(fields, filterType, this.typedString, true, false);
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
else {
|
|
394
|
+
filterQuery = (this.customFilterQuery != null) ?
|
|
395
|
+
this.customFilterQuery.clone() : query ? query.clone() : this.query ? this.query.clone() : new Query();
|
|
396
|
+
}
|
|
397
|
+
return filterQuery;
|
|
398
|
+
};
|
|
337
399
|
MultiColumnComboBox.prototype.setHiddenValue = function () {
|
|
338
400
|
if (isNullOrUndefined(this.value)) {
|
|
339
401
|
this.hiddenElement.innerHTML = '';
|
|
@@ -357,7 +419,7 @@ var MultiColumnComboBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
357
419
|
var gridColumns = this.getGridColumns();
|
|
358
420
|
var sortOrder = this.sortOrder.toString().toLowerCase();
|
|
359
421
|
this.gridObj = new Grid({
|
|
360
|
-
dataSource: this.
|
|
422
|
+
dataSource: this.gridData,
|
|
361
423
|
columns: gridColumns,
|
|
362
424
|
allowSorting: this.allowSorting,
|
|
363
425
|
enableStickyHeader: true,
|
|
@@ -367,7 +429,6 @@ var MultiColumnComboBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
367
429
|
enableVirtualization: this.enableVirtualization,
|
|
368
430
|
enableRtl: this.enableRtl,
|
|
369
431
|
editSettings: { allowAdding: false },
|
|
370
|
-
query: this.query,
|
|
371
432
|
allowTextWrap: this.gridSettings.allowTextWrap,
|
|
372
433
|
textWrapSettings: { wrapMode: this.gridSettings.textWrapMode },
|
|
373
434
|
height: this.popupHeight,
|
|
@@ -382,7 +443,6 @@ var MultiColumnComboBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
382
443
|
},
|
|
383
444
|
dataBound: function () { _this.onDataBound(); },
|
|
384
445
|
actionFailure: function (args) { _this.onActionFailure(args); },
|
|
385
|
-
actionBegin: function (args) { _this.trigger('actionBegin', args); },
|
|
386
446
|
actionComplete: this.handleActionComplete.bind(this),
|
|
387
447
|
keyPressed: this.handleKeyPressed.bind(this),
|
|
388
448
|
resizing: function (args) {
|
|
@@ -418,7 +478,6 @@ var MultiColumnComboBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
418
478
|
};
|
|
419
479
|
MultiColumnComboBox.prototype.handleActionComplete = function (args) {
|
|
420
480
|
var _this = this;
|
|
421
|
-
this.trigger('actionComplete', args);
|
|
422
481
|
if (args.requestType === 'sorting') {
|
|
423
482
|
this.updateRowSelection(args);
|
|
424
483
|
}
|
|
@@ -787,8 +846,8 @@ var MultiColumnComboBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
787
846
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
788
847
|
var dataLists = e.result;
|
|
789
848
|
var filteredData = dataLists.filter(function (item) {
|
|
790
|
-
var fieldVal = _this.updateFieldValue(isRerender ? (isValue ? _this.fields.value :
|
|
791
|
-
!isNullOrUndefined(_this.value) ? _this.fields.value : _this.fields.text, item);
|
|
849
|
+
var fieldVal = item ? (_this.updateFieldValue(isRerender ? (isValue ? _this.fields.value :
|
|
850
|
+
_this.fields.text) : !isNullOrUndefined(_this.value) ? _this.fields.value : _this.fields.text, item)) : null;
|
|
792
851
|
return fieldVal === value_1;
|
|
793
852
|
});
|
|
794
853
|
if (filteredData.length > 0) {
|
|
@@ -1099,24 +1158,24 @@ var MultiColumnComboBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
1099
1158
|
this.showPopup(null, true);
|
|
1100
1159
|
this.updateClearIconState();
|
|
1101
1160
|
if (this.allowFiltering) {
|
|
1102
|
-
|
|
1103
|
-
var customFiltering_1 = false;
|
|
1161
|
+
this.typedString = e.target.value.toLowerCase();
|
|
1104
1162
|
var eventArgs_1 = {
|
|
1105
1163
|
preventDefaultAction: false,
|
|
1106
|
-
text:
|
|
1164
|
+
text: this.typedString,
|
|
1107
1165
|
updateData: function (dataSource, query, fields) {
|
|
1108
1166
|
if (eventArgs_1.cancel) {
|
|
1109
1167
|
return;
|
|
1110
1168
|
}
|
|
1111
|
-
|
|
1112
|
-
_this.
|
|
1169
|
+
_this.isCustomFilter = true;
|
|
1170
|
+
_this.customFilterQuery = query ? query.clone() : query;
|
|
1171
|
+
_this.setGridData(dataSource, query);
|
|
1113
1172
|
},
|
|
1114
1173
|
event: e,
|
|
1115
1174
|
cancel: false
|
|
1116
1175
|
};
|
|
1117
1176
|
this.trigger('filtering', eventArgs_1, function (eventArgs) {
|
|
1118
|
-
if (!eventArgs.cancel && !eventArgs.preventDefaultAction && !
|
|
1119
|
-
_this.
|
|
1177
|
+
if (!eventArgs.cancel && !eventArgs.preventDefaultAction && !_this.isCustomFilter) {
|
|
1178
|
+
_this.setGridData(_this.dataSource, _this.query ? _this.query.clone() : null);
|
|
1120
1179
|
}
|
|
1121
1180
|
});
|
|
1122
1181
|
}
|
|
@@ -1124,27 +1183,16 @@ var MultiColumnComboBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
1124
1183
|
};
|
|
1125
1184
|
MultiColumnComboBox.prototype.updateInputValue = function (inputValue) {
|
|
1126
1185
|
return __awaiter(this, void 0, void 0, function () {
|
|
1127
|
-
var _a, _b, data, exactData
|
|
1186
|
+
var _a, _b, data, exactData;
|
|
1128
1187
|
return __generator(this, function (_c) {
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
if (!(this.dataSource instanceof DataManager)) return [3 /*break*/, 2];
|
|
1132
|
-
query = new Query();
|
|
1133
|
-
return [4 /*yield*/, this.dataSource.executeQuery(query)];
|
|
1134
|
-
case 1:
|
|
1135
|
-
result = _c.sent();
|
|
1136
|
-
totaldata = result.result;
|
|
1137
|
-
(_a = this.filterDatas(totaldata, inputValue), data = _a.data, exactData = _a.exactData);
|
|
1138
|
-
return [3 /*break*/, 3];
|
|
1139
|
-
case 2:
|
|
1140
|
-
if (Array.isArray(this.dataSource)) {
|
|
1141
|
-
(_b = this.filterDatas(this.dataSource, inputValue), data = _b.data, exactData = _b.exactData);
|
|
1142
|
-
}
|
|
1143
|
-
_c.label = 3;
|
|
1144
|
-
case 3:
|
|
1145
|
-
this.selectFilteredRows(data, exactData);
|
|
1146
|
-
return [2 /*return*/];
|
|
1188
|
+
if (this.dataSource instanceof DataManager) {
|
|
1189
|
+
(_a = this.filterDatas(this.mainData, inputValue), data = _a.data, exactData = _a.exactData);
|
|
1147
1190
|
}
|
|
1191
|
+
else if (Array.isArray(this.dataSource)) {
|
|
1192
|
+
(_b = this.filterDatas(this.dataSource, inputValue), data = _b.data, exactData = _b.exactData);
|
|
1193
|
+
}
|
|
1194
|
+
this.selectFilteredRows(data, exactData);
|
|
1195
|
+
return [2 /*return*/];
|
|
1148
1196
|
});
|
|
1149
1197
|
});
|
|
1150
1198
|
};
|
|
@@ -1170,72 +1218,14 @@ var MultiColumnComboBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
1170
1218
|
var selectedIndex = this.findIndex(this.gridObj.currentViewData, this.matchedContent);
|
|
1171
1219
|
this.matchedRowEle = this.gridObj.getRowByIndex(selectedIndex);
|
|
1172
1220
|
};
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
var _this = this;
|
|
1176
|
-
var isQuery = query || new Query();
|
|
1177
|
-
var filterType = this.filterType.toString().toLowerCase();
|
|
1178
|
-
if (isNullOrUndefined(query) && isNullOrUndefined(fields)) {
|
|
1179
|
-
this.updateGridDataSource(dataSource);
|
|
1180
|
-
}
|
|
1181
|
-
else if (query) {
|
|
1182
|
-
if (dataSource instanceof DataManager) {
|
|
1183
|
-
this.filteringHandler(dataSource, inputValue, query, fields);
|
|
1184
|
-
}
|
|
1185
|
-
else {
|
|
1186
|
-
new DataManager(dataSource).executeQuery(query).then(function (e) {
|
|
1187
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1188
|
-
var dataLists = e.result;
|
|
1189
|
-
_this.updateGridDataSource(dataLists);
|
|
1190
|
-
});
|
|
1191
|
-
}
|
|
1192
|
-
}
|
|
1193
|
-
else {
|
|
1194
|
-
if (dataSource instanceof DataManager) {
|
|
1195
|
-
this.filteringHandler(dataSource, inputValue, isQuery, fields);
|
|
1196
|
-
}
|
|
1197
|
-
else if (Array.isArray(dataSource)) {
|
|
1198
|
-
var filteredData = dataSource.filter(function (item) {
|
|
1199
|
-
return _this.filterData(item, filterType, inputValue, fields);
|
|
1200
|
-
});
|
|
1201
|
-
this.updateGridDataSource(filteredData);
|
|
1202
|
-
}
|
|
1203
|
-
}
|
|
1204
|
-
};
|
|
1205
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1206
|
-
MultiColumnComboBox.prototype.filteringHandler = function (dataSource, inputValue, query, fields) {
|
|
1207
|
-
var _this = this;
|
|
1208
|
-
var filterType = this.filterType.toString().toLowerCase();
|
|
1209
|
-
var filteredData;
|
|
1210
|
-
dataSource.executeQuery(query).then(function (e) {
|
|
1211
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1212
|
-
var dataLists = e.result;
|
|
1213
|
-
filteredData = dataLists.filter(function (item) { return _this.filterData(item, filterType, inputValue, fields); });
|
|
1214
|
-
_this.updateGridDataSource(filteredData);
|
|
1215
|
-
});
|
|
1216
|
-
};
|
|
1217
|
-
MultiColumnComboBox.prototype.filterData = function (item, filterType, inputValue, fields) {
|
|
1218
|
-
var dataValue = this.updateFieldValue(fields ? fields.text : this.fields.text, item);
|
|
1219
|
-
var itemValue = dataValue.toLowerCase();
|
|
1220
|
-
switch (filterType) {
|
|
1221
|
-
case 'startswith':
|
|
1222
|
-
return itemValue.startsWith(inputValue);
|
|
1223
|
-
case 'endswith':
|
|
1224
|
-
return itemValue.endsWith(inputValue);
|
|
1225
|
-
case 'contains':
|
|
1226
|
-
return itemValue.includes(inputValue);
|
|
1227
|
-
default:
|
|
1228
|
-
return false;
|
|
1229
|
-
}
|
|
1230
|
-
};
|
|
1231
|
-
MultiColumnComboBox.prototype.updateGridDataSource = function (dataSource) {
|
|
1232
|
-
if (dataSource.length > 0) {
|
|
1221
|
+
MultiColumnComboBox.prototype.updateGridDataSource = function () {
|
|
1222
|
+
if (this.gridData && this.gridData.length > 0) {
|
|
1233
1223
|
removeClass([this.popupDiv], [NODATA]);
|
|
1234
1224
|
var noRecordEle = this.popupDiv.querySelector('.e-no-records');
|
|
1235
1225
|
if (noRecordEle) {
|
|
1236
1226
|
this.popupDiv.removeChild(noRecordEle);
|
|
1237
1227
|
}
|
|
1238
|
-
this.gridObj.dataSource =
|
|
1228
|
+
this.gridObj.dataSource = this.gridData;
|
|
1239
1229
|
this.isDataFiltered = true;
|
|
1240
1230
|
}
|
|
1241
1231
|
else {
|
|
@@ -1343,7 +1333,8 @@ var MultiColumnComboBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
1343
1333
|
var e = mouseEvent ? mouseEvent : keyEvent;
|
|
1344
1334
|
var val = isKeyDown ? this.matchedContent : this.exactMatchedContent;
|
|
1345
1335
|
if (!val && e.code !== 'Enter') {
|
|
1346
|
-
this.inputEle.value =
|
|
1336
|
+
this.inputEle.value = null;
|
|
1337
|
+
this.setProperties({ value: null, index: null, text: null }, true);
|
|
1347
1338
|
}
|
|
1348
1339
|
this.hidePopup(e);
|
|
1349
1340
|
if (this.matchedRowEle && !isClearValues && val) {
|
|
@@ -1524,7 +1515,7 @@ var MultiColumnComboBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
1524
1515
|
if (this.gridObj) {
|
|
1525
1516
|
var dataLength_1;
|
|
1526
1517
|
this.isShowSpinner = true;
|
|
1527
|
-
this.
|
|
1518
|
+
this.setGridData(newDataSource);
|
|
1528
1519
|
var isRemoteData = oldDataSource instanceof DataManager;
|
|
1529
1520
|
if (isRemoteData) {
|
|
1530
1521
|
oldDataSource.executeQuery(new Query()).then(function (e) {
|
|
@@ -1615,12 +1606,6 @@ var MultiColumnComboBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
1615
1606
|
_this.inputEle.setAttribute('aria-activedescendant', firstRow.getAttribute('data-uid'));
|
|
1616
1607
|
}
|
|
1617
1608
|
}
|
|
1618
|
-
if (!isNullOrUndefined(_this.dataSource) && _this.dataSource instanceof DataManager) {
|
|
1619
|
-
_this.dataSource.executeQuery(new Query).then(function (e) {
|
|
1620
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1621
|
-
_this.remoteDataLength = e.result.length;
|
|
1622
|
-
});
|
|
1623
|
-
}
|
|
1624
1609
|
_this.popupObj.show(new Animation(eventArgs.animation), _this.popupEle.firstElementChild);
|
|
1625
1610
|
}
|
|
1626
1611
|
});
|
|
@@ -1653,11 +1638,17 @@ var MultiColumnComboBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
1653
1638
|
}
|
|
1654
1639
|
_this.inputEle.removeAttribute('aria-owns');
|
|
1655
1640
|
_this.inputEle.removeAttribute('aria-activedescendant');
|
|
1641
|
+
_this.customFilterQuery = null;
|
|
1656
1642
|
}
|
|
1657
1643
|
});
|
|
1658
1644
|
setTimeout(function () {
|
|
1659
1645
|
if (_this.gridObj) {
|
|
1660
|
-
_this.gridObj.dataSource = _this.
|
|
1646
|
+
_this.gridObj.dataSource = _this.allowFiltering ? _this.mainData : _this.gridData;
|
|
1647
|
+
var noRecordEle = _this.popupDiv.querySelector('.e-no-records');
|
|
1648
|
+
if (noRecordEle) {
|
|
1649
|
+
_this.popupDiv.removeChild(noRecordEle);
|
|
1650
|
+
removeClass([_this.popupDiv], [NODATA]);
|
|
1651
|
+
}
|
|
1661
1652
|
_this.updateGridHeight(true, false);
|
|
1662
1653
|
}
|
|
1663
1654
|
}, 100);
|
|
@@ -1864,9 +1855,8 @@ var MultiColumnComboBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
1864
1855
|
this.updateDynamicDataSource(newProp.dataSource, oldProp.dataSource);
|
|
1865
1856
|
break;
|
|
1866
1857
|
case 'query':
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
}
|
|
1858
|
+
this.isMainDataUpdated = false;
|
|
1859
|
+
this.setGridData(this.dataSource);
|
|
1870
1860
|
break;
|
|
1871
1861
|
case 'gridSettings':
|
|
1872
1862
|
if (this.gridObj) {
|