@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.
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * filename: index.d.ts
3
- * version : 30.1.37
3
+ * version : 30.1.40
4
4
  * Copyright Syncfusion Inc. 2001 - 2024. 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-multicolumn-combobox",
3
- "version": "30.1.37",
3
+ "version": "30.1.40",
4
4
  "description": "Essential JS 2 Component",
5
5
  "author": "Syncfusion Inc.",
6
6
  "license": "SEE LICENSE IN license",
@@ -9,8 +9,8 @@
9
9
  "es2015": "./dist/es6/ej2-multicolumn-combobox.es5.js",
10
10
  "typings": "index.d.ts",
11
11
  "dependencies": {
12
- "@syncfusion/ej2-base": "~30.1.37",
13
- "@syncfusion/ej2-grids": "~30.1.37"
12
+ "@syncfusion/ej2-base": "~30.1.38",
13
+ "@syncfusion/ej2-grids": "~30.1.40"
14
14
  },
15
15
  "devDependencies": {},
16
16
  "keywords": [
@@ -1,4 +1,4 @@
1
- import { Component, EventHandler, INotifyPropertyChanged, Property, NotifyPropertyChanges, closest, attributes, append, compile, detach, KeyboardEvents, getValue } from '@syncfusion/ej2-base';import { ChildProperty, prepend, Collection, getUniqueID, Complex, isNullOrUndefined as isNOU, select, L10n, Browser } from '@syncfusion/ej2-base';import { formatUnit, addClass, removeClass, NumberFormatOptions, DateFormatOptions, Event, EmitType, AnimationModel, Animation, KeyboardEventArgs } from '@syncfusion/ej2-base';import { Input, InputObject } from '@syncfusion/ej2-inputs';import { DataManager, Query, Group } from '@syncfusion/ej2-data';import { Popup, createSpinner, showSpinner, hideSpinner } from '@syncfusion/ej2-popups';import { Grid, Resize, FailureEventArgs, VirtualScroll, Group as GridGroup, Edit, Sort, GridColumnModel } from '@syncfusion/ej2-grids';
1
+ import { Component, EventHandler, INotifyPropertyChanged, Property, NotifyPropertyChanges, closest, attributes, append, compile, detach, KeyboardEvents, getValue } from '@syncfusion/ej2-base';import { ChildProperty, prepend, Collection, getUniqueID, Complex, isNullOrUndefined as isNOU, select, L10n, Browser } from '@syncfusion/ej2-base';import { formatUnit, addClass, removeClass, NumberFormatOptions, DateFormatOptions, Event, EmitType, AnimationModel, Animation, KeyboardEventArgs } from '@syncfusion/ej2-base';import { Input, InputObject } from '@syncfusion/ej2-inputs';import { DataManager, Query, Group, DataOptions } from '@syncfusion/ej2-data';import { Popup, createSpinner, showSpinner, hideSpinner } from '@syncfusion/ej2-popups';import { Grid, Resize, FailureEventArgs, VirtualScroll, Group as GridGroup, Edit, Sort, GridColumnModel } from '@syncfusion/ej2-grids';
2
2
  import {TextAlign,GridLine,WrapMode,ResizeArgs,DataResult,FilterType,FloatLabelType,SortOrder,SortType,PopupEventArgs,FilteringEventArgs,SelectEventArgs,ChangeEventArgs} from "./multi-column-combo-box";
3
3
  import {ComponentModel} from '@syncfusion/ej2-base';
4
4
 
@@ -784,6 +784,12 @@ export declare class MultiColumnComboBox extends Component<HTMLElement> implemen
784
784
  private isShowSpinner;
785
785
  private hiddenElement;
786
786
  private isLocaleChanged;
787
+ private gridData;
788
+ private mainData;
789
+ private isMainDataUpdated;
790
+ private isCustomFilter;
791
+ private customFilterQuery;
792
+ private typedString;
787
793
  /**
788
794
  * *Constructor for creating the component
789
795
  *
@@ -816,6 +822,8 @@ export declare class MultiColumnComboBox extends Component<HTMLElement> implemen
816
822
  protected getPersistData(): string;
817
823
  private persistData;
818
824
  protected render(): void;
825
+ private setGridData;
826
+ protected getQuery(query: Query): Query;
819
827
  private setHiddenValue;
820
828
  private renderGrid;
821
829
  private handleActionComplete;
@@ -859,9 +867,6 @@ export declare class MultiColumnComboBox extends Component<HTMLElement> implemen
859
867
  private updateInputValue;
860
868
  private filterDatas;
861
869
  private selectFilteredRows;
862
- private filterAction;
863
- private filteringHandler;
864
- private filterData;
865
870
  private updateGridDataSource;
866
871
  private wireEvents;
867
872
  private unWireEvents;
@@ -332,6 +332,9 @@ var MultiColumnComboBox = /** @class */ (function (_super) {
332
332
  };
333
333
  MultiColumnComboBox.prototype.render = function () {
334
334
  this.renderInput();
335
+ if (this.gridData == null) {
336
+ this.setGridData(this.dataSource);
337
+ }
335
338
  this.renderGrid();
336
339
  this.popupDiv = this.createElement('div', { className: CONTENT });
337
340
  this.popupDiv.appendChild(this.gridEle);
@@ -339,6 +342,65 @@ var MultiColumnComboBox = /** @class */ (function (_super) {
339
342
  this.renderPopup();
340
343
  this.wireEvents();
341
344
  };
345
+ MultiColumnComboBox.prototype.setGridData = function (dataSource, query) {
346
+ var _this = this;
347
+ this.trigger('actionBegin', { cancel: false, query: query }, function (args) {
348
+ if (!args.cancel) {
349
+ if (dataSource instanceof DataManager) {
350
+ if (_this.isShowSpinner) {
351
+ _this.showHideSpinner(true);
352
+ }
353
+ dataSource.executeQuery(_this.getQuery(query)).then(function (e) {
354
+ _this.gridData = e.result;
355
+ _this.trigger('actionComplete', e, function (e) {
356
+ _this.showHideSpinner(false);
357
+ if (!_this.isMainDataUpdated) {
358
+ _this.mainData = _this.gridData;
359
+ _this.remoteDataLength = _this.gridData.length;
360
+ _this.isMainDataUpdated = true;
361
+ }
362
+ if (_this.popupDiv) {
363
+ _this.updateGridDataSource();
364
+ }
365
+ });
366
+ }).catch(function (e) {
367
+ _this.trigger('actionFailure', e, null);
368
+ });
369
+ }
370
+ else {
371
+ var dataManager = new DataManager(dataSource);
372
+ var listItems = (_this.getQuery(query)).executeLocal(dataManager);
373
+ _this.gridData = listItems;
374
+ _this.trigger('actionComplete', { result: listItems }, function (e) {
375
+ if (!_this.isMainDataUpdated) {
376
+ _this.mainData = _this.gridData;
377
+ _this.remoteDataLength = _this.gridData.length;
378
+ _this.isMainDataUpdated = true;
379
+ }
380
+ if (_this.popupDiv) {
381
+ _this.updateGridDataSource();
382
+ }
383
+ });
384
+ }
385
+ }
386
+ });
387
+ };
388
+ MultiColumnComboBox.prototype.getQuery = function (query) {
389
+ var filterQuery;
390
+ if (!this.isCustomFilter && this.allowFiltering) {
391
+ filterQuery = query ? query.clone() : this.query ? this.query.clone() : new Query();
392
+ var filterType = this.typedString === '' ? 'contains' : this.filterType;
393
+ if ((this.allowFiltering && this.typedString && this.typedString !== '')) {
394
+ var fields = (this.fields.text) ? this.fields.text : '';
395
+ filterQuery.where(fields, filterType, this.typedString, true, false);
396
+ }
397
+ }
398
+ else {
399
+ filterQuery = (this.customFilterQuery != null) ?
400
+ this.customFilterQuery.clone() : query ? query.clone() : this.query ? this.query.clone() : new Query();
401
+ }
402
+ return filterQuery;
403
+ };
342
404
  MultiColumnComboBox.prototype.setHiddenValue = function () {
343
405
  if (isNOU(this.value)) {
344
406
  this.hiddenElement.innerHTML = '';
@@ -362,7 +424,7 @@ var MultiColumnComboBox = /** @class */ (function (_super) {
362
424
  var gridColumns = this.getGridColumns();
363
425
  var sortOrder = this.sortOrder.toString().toLowerCase();
364
426
  this.gridObj = new Grid({
365
- dataSource: this.dataSource,
427
+ dataSource: this.gridData,
366
428
  columns: gridColumns,
367
429
  allowSorting: this.allowSorting,
368
430
  enableStickyHeader: true,
@@ -372,7 +434,6 @@ var MultiColumnComboBox = /** @class */ (function (_super) {
372
434
  enableVirtualization: this.enableVirtualization,
373
435
  enableRtl: this.enableRtl,
374
436
  editSettings: { allowAdding: false },
375
- query: this.query,
376
437
  allowTextWrap: this.gridSettings.allowTextWrap,
377
438
  textWrapSettings: { wrapMode: this.gridSettings.textWrapMode },
378
439
  height: this.popupHeight,
@@ -387,7 +448,6 @@ var MultiColumnComboBox = /** @class */ (function (_super) {
387
448
  },
388
449
  dataBound: function () { _this.onDataBound(); },
389
450
  actionFailure: function (args) { _this.onActionFailure(args); },
390
- actionBegin: function (args) { _this.trigger('actionBegin', args); },
391
451
  actionComplete: this.handleActionComplete.bind(this),
392
452
  keyPressed: this.handleKeyPressed.bind(this),
393
453
  resizing: function (args) {
@@ -423,7 +483,6 @@ var MultiColumnComboBox = /** @class */ (function (_super) {
423
483
  };
424
484
  MultiColumnComboBox.prototype.handleActionComplete = function (args) {
425
485
  var _this = this;
426
- this.trigger('actionComplete', args);
427
486
  if (args.requestType === 'sorting') {
428
487
  this.updateRowSelection(args);
429
488
  }
@@ -792,8 +851,8 @@ var MultiColumnComboBox = /** @class */ (function (_super) {
792
851
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
793
852
  var dataLists = e.result;
794
853
  var filteredData = dataLists.filter(function (item) {
795
- var fieldVal = _this.updateFieldValue(isRerender ? (isValue ? _this.fields.value : _this.fields.text) :
796
- !isNOU(_this.value) ? _this.fields.value : _this.fields.text, item);
854
+ var fieldVal = item ? (_this.updateFieldValue(isRerender ? (isValue ? _this.fields.value :
855
+ _this.fields.text) : !isNOU(_this.value) ? _this.fields.value : _this.fields.text, item)) : null;
797
856
  return fieldVal === value_1;
798
857
  });
799
858
  if (filteredData.length > 0) {
@@ -1104,24 +1163,24 @@ var MultiColumnComboBox = /** @class */ (function (_super) {
1104
1163
  this.showPopup(null, true);
1105
1164
  this.updateClearIconState();
1106
1165
  if (this.allowFiltering) {
1107
- var inputValue_1 = e.target.value.toLowerCase();
1108
- var customFiltering_1 = false;
1166
+ this.typedString = e.target.value.toLowerCase();
1109
1167
  var eventArgs_1 = {
1110
1168
  preventDefaultAction: false,
1111
- text: inputValue_1,
1169
+ text: this.typedString,
1112
1170
  updateData: function (dataSource, query, fields) {
1113
1171
  if (eventArgs_1.cancel) {
1114
1172
  return;
1115
1173
  }
1116
- customFiltering_1 = true;
1117
- _this.filterAction(dataSource, inputValue_1, query, fields);
1174
+ _this.isCustomFilter = true;
1175
+ _this.customFilterQuery = query ? query.clone() : query;
1176
+ _this.setGridData(dataSource, query);
1118
1177
  },
1119
1178
  event: e,
1120
1179
  cancel: false
1121
1180
  };
1122
1181
  this.trigger('filtering', eventArgs_1, function (eventArgs) {
1123
- if (!eventArgs.cancel && !eventArgs.preventDefaultAction && !customFiltering_1) {
1124
- _this.filterAction(_this.dataSource, inputValue_1, _this.query, _this.fields);
1182
+ if (!eventArgs.cancel && !eventArgs.preventDefaultAction && !_this.isCustomFilter) {
1183
+ _this.setGridData(_this.dataSource, _this.query ? _this.query.clone() : null);
1125
1184
  }
1126
1185
  });
1127
1186
  }
@@ -1129,27 +1188,16 @@ var MultiColumnComboBox = /** @class */ (function (_super) {
1129
1188
  };
1130
1189
  MultiColumnComboBox.prototype.updateInputValue = function (inputValue) {
1131
1190
  return __awaiter(this, void 0, void 0, function () {
1132
- var _a, _b, data, exactData, query, result, totaldata;
1191
+ var _a, _b, data, exactData;
1133
1192
  return __generator(this, function (_c) {
1134
- switch (_c.label) {
1135
- case 0:
1136
- if (!(this.dataSource instanceof DataManager)) return [3 /*break*/, 2];
1137
- query = new Query();
1138
- return [4 /*yield*/, this.dataSource.executeQuery(query)];
1139
- case 1:
1140
- result = _c.sent();
1141
- totaldata = result.result;
1142
- (_a = this.filterDatas(totaldata, inputValue), data = _a.data, exactData = _a.exactData);
1143
- return [3 /*break*/, 3];
1144
- case 2:
1145
- if (Array.isArray(this.dataSource)) {
1146
- (_b = this.filterDatas(this.dataSource, inputValue), data = _b.data, exactData = _b.exactData);
1147
- }
1148
- _c.label = 3;
1149
- case 3:
1150
- this.selectFilteredRows(data, exactData);
1151
- return [2 /*return*/];
1193
+ if (this.dataSource instanceof DataManager) {
1194
+ (_a = this.filterDatas(this.mainData, inputValue), data = _a.data, exactData = _a.exactData);
1152
1195
  }
1196
+ else if (Array.isArray(this.dataSource)) {
1197
+ (_b = this.filterDatas(this.dataSource, inputValue), data = _b.data, exactData = _b.exactData);
1198
+ }
1199
+ this.selectFilteredRows(data, exactData);
1200
+ return [2 /*return*/];
1153
1201
  });
1154
1202
  });
1155
1203
  };
@@ -1175,72 +1223,14 @@ var MultiColumnComboBox = /** @class */ (function (_super) {
1175
1223
  var selectedIndex = this.findIndex(this.gridObj.currentViewData, this.matchedContent);
1176
1224
  this.matchedRowEle = this.gridObj.getRowByIndex(selectedIndex);
1177
1225
  };
1178
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1179
- MultiColumnComboBox.prototype.filterAction = function (dataSource, inputValue, query, fields) {
1180
- var _this = this;
1181
- var isQuery = query || new Query();
1182
- var filterType = this.filterType.toString().toLowerCase();
1183
- if (isNOU(query) && isNOU(fields)) {
1184
- this.updateGridDataSource(dataSource);
1185
- }
1186
- else if (query) {
1187
- if (dataSource instanceof DataManager) {
1188
- this.filteringHandler(dataSource, inputValue, query, fields);
1189
- }
1190
- else {
1191
- new DataManager(dataSource).executeQuery(query).then(function (e) {
1192
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1193
- var dataLists = e.result;
1194
- _this.updateGridDataSource(dataLists);
1195
- });
1196
- }
1197
- }
1198
- else {
1199
- if (dataSource instanceof DataManager) {
1200
- this.filteringHandler(dataSource, inputValue, isQuery, fields);
1201
- }
1202
- else if (Array.isArray(dataSource)) {
1203
- var filteredData = dataSource.filter(function (item) {
1204
- return _this.filterData(item, filterType, inputValue, fields);
1205
- });
1206
- this.updateGridDataSource(filteredData);
1207
- }
1208
- }
1209
- };
1210
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1211
- MultiColumnComboBox.prototype.filteringHandler = function (dataSource, inputValue, query, fields) {
1212
- var _this = this;
1213
- var filterType = this.filterType.toString().toLowerCase();
1214
- var filteredData;
1215
- dataSource.executeQuery(query).then(function (e) {
1216
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1217
- var dataLists = e.result;
1218
- filteredData = dataLists.filter(function (item) { return _this.filterData(item, filterType, inputValue, fields); });
1219
- _this.updateGridDataSource(filteredData);
1220
- });
1221
- };
1222
- MultiColumnComboBox.prototype.filterData = function (item, filterType, inputValue, fields) {
1223
- var dataValue = this.updateFieldValue(fields ? fields.text : this.fields.text, item);
1224
- var itemValue = dataValue.toLowerCase();
1225
- switch (filterType) {
1226
- case 'startswith':
1227
- return itemValue.startsWith(inputValue);
1228
- case 'endswith':
1229
- return itemValue.endsWith(inputValue);
1230
- case 'contains':
1231
- return itemValue.includes(inputValue);
1232
- default:
1233
- return false;
1234
- }
1235
- };
1236
- MultiColumnComboBox.prototype.updateGridDataSource = function (dataSource) {
1237
- if (dataSource.length > 0) {
1226
+ MultiColumnComboBox.prototype.updateGridDataSource = function () {
1227
+ if (this.gridData && this.gridData.length > 0) {
1238
1228
  removeClass([this.popupDiv], [NODATA]);
1239
1229
  var noRecordEle = this.popupDiv.querySelector('.e-no-records');
1240
1230
  if (noRecordEle) {
1241
1231
  this.popupDiv.removeChild(noRecordEle);
1242
1232
  }
1243
- this.gridObj.dataSource = dataSource;
1233
+ this.gridObj.dataSource = this.gridData;
1244
1234
  this.isDataFiltered = true;
1245
1235
  }
1246
1236
  else {
@@ -1348,7 +1338,8 @@ var MultiColumnComboBox = /** @class */ (function (_super) {
1348
1338
  var e = mouseEvent ? mouseEvent : keyEvent;
1349
1339
  var val = isKeyDown ? this.matchedContent : this.exactMatchedContent;
1350
1340
  if (!val && e.code !== 'Enter') {
1351
- this.inputEle.value = this.value = this.index = this.text = null;
1341
+ this.inputEle.value = null;
1342
+ this.setProperties({ value: null, index: null, text: null }, true);
1352
1343
  }
1353
1344
  this.hidePopup(e);
1354
1345
  if (this.matchedRowEle && !isClearValues && val) {
@@ -1529,7 +1520,7 @@ var MultiColumnComboBox = /** @class */ (function (_super) {
1529
1520
  if (this.gridObj) {
1530
1521
  var dataLength_1;
1531
1522
  this.isShowSpinner = true;
1532
- this.gridObj.dataSource = newDataSource;
1523
+ this.setGridData(newDataSource);
1533
1524
  var isRemoteData = oldDataSource instanceof DataManager;
1534
1525
  if (isRemoteData) {
1535
1526
  oldDataSource.executeQuery(new Query()).then(function (e) {
@@ -1620,12 +1611,6 @@ var MultiColumnComboBox = /** @class */ (function (_super) {
1620
1611
  _this.inputEle.setAttribute('aria-activedescendant', firstRow.getAttribute('data-uid'));
1621
1612
  }
1622
1613
  }
1623
- if (!isNOU(_this.dataSource) && _this.dataSource instanceof DataManager) {
1624
- _this.dataSource.executeQuery(new Query).then(function (e) {
1625
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1626
- _this.remoteDataLength = e.result.length;
1627
- });
1628
- }
1629
1614
  _this.popupObj.show(new Animation(eventArgs.animation), _this.popupEle.firstElementChild);
1630
1615
  }
1631
1616
  });
@@ -1658,11 +1643,17 @@ var MultiColumnComboBox = /** @class */ (function (_super) {
1658
1643
  }
1659
1644
  _this.inputEle.removeAttribute('aria-owns');
1660
1645
  _this.inputEle.removeAttribute('aria-activedescendant');
1646
+ _this.customFilterQuery = null;
1661
1647
  }
1662
1648
  });
1663
1649
  setTimeout(function () {
1664
1650
  if (_this.gridObj) {
1665
- _this.gridObj.dataSource = _this.dataSource;
1651
+ _this.gridObj.dataSource = _this.allowFiltering ? _this.mainData : _this.gridData;
1652
+ var noRecordEle = _this.popupDiv.querySelector('.e-no-records');
1653
+ if (noRecordEle) {
1654
+ _this.popupDiv.removeChild(noRecordEle);
1655
+ removeClass([_this.popupDiv], [NODATA]);
1656
+ }
1666
1657
  _this.updateGridHeight(true, false);
1667
1658
  }
1668
1659
  }, 100);
@@ -1869,9 +1860,8 @@ var MultiColumnComboBox = /** @class */ (function (_super) {
1869
1860
  this.updateDynamicDataSource(newProp.dataSource, oldProp.dataSource);
1870
1861
  break;
1871
1862
  case 'query':
1872
- if (this.gridObj) {
1873
- this.gridObj.query = newProp.query;
1874
- }
1863
+ this.isMainDataUpdated = false;
1864
+ this.setGridData(this.dataSource);
1875
1865
  break;
1876
1866
  case 'gridSettings':
1877
1867
  if (this.gridObj) {