@syncfusion/ej2-multicolumn-combobox 30.1.37 → 30.1.39

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.39
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.39",
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.39"
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,63 @@ 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.isMainDataUpdated = true;
360
+ }
361
+ if (_this.popupDiv) {
362
+ _this.updateGridDataSource();
363
+ }
364
+ });
365
+ }).catch(function (e) {
366
+ _this.trigger('actionFailure', e, null);
367
+ });
368
+ }
369
+ else {
370
+ var dataManager = new DataManager(dataSource);
371
+ var listItems = (_this.getQuery(query)).executeLocal(dataManager);
372
+ _this.gridData = listItems;
373
+ _this.trigger('actionComplete', { result: listItems }, function (e) {
374
+ if (!_this.isMainDataUpdated) {
375
+ _this.mainData = _this.gridData;
376
+ _this.isMainDataUpdated = true;
377
+ }
378
+ if (_this.popupDiv) {
379
+ _this.updateGridDataSource();
380
+ }
381
+ });
382
+ }
383
+ }
384
+ });
385
+ };
386
+ MultiColumnComboBox.prototype.getQuery = function (query) {
387
+ var filterQuery;
388
+ if (!this.isCustomFilter && this.allowFiltering) {
389
+ filterQuery = query ? query.clone() : this.query ? this.query.clone() : new Query();
390
+ var filterType = this.typedString === '' ? 'contains' : this.filterType;
391
+ if ((this.allowFiltering && this.typedString && this.typedString !== '')) {
392
+ var fields = (this.fields.text) ? this.fields.text : '';
393
+ filterQuery.where(fields, filterType, this.typedString, true, false);
394
+ }
395
+ }
396
+ else {
397
+ filterQuery = (this.customFilterQuery != null) ?
398
+ this.customFilterQuery.clone() : query ? query.clone() : this.query ? this.query.clone() : new Query();
399
+ }
400
+ return filterQuery;
401
+ };
342
402
  MultiColumnComboBox.prototype.setHiddenValue = function () {
343
403
  if (isNOU(this.value)) {
344
404
  this.hiddenElement.innerHTML = '';
@@ -362,7 +422,7 @@ var MultiColumnComboBox = /** @class */ (function (_super) {
362
422
  var gridColumns = this.getGridColumns();
363
423
  var sortOrder = this.sortOrder.toString().toLowerCase();
364
424
  this.gridObj = new Grid({
365
- dataSource: this.dataSource,
425
+ dataSource: this.gridData,
366
426
  columns: gridColumns,
367
427
  allowSorting: this.allowSorting,
368
428
  enableStickyHeader: true,
@@ -372,7 +432,6 @@ var MultiColumnComboBox = /** @class */ (function (_super) {
372
432
  enableVirtualization: this.enableVirtualization,
373
433
  enableRtl: this.enableRtl,
374
434
  editSettings: { allowAdding: false },
375
- query: this.query,
376
435
  allowTextWrap: this.gridSettings.allowTextWrap,
377
436
  textWrapSettings: { wrapMode: this.gridSettings.textWrapMode },
378
437
  height: this.popupHeight,
@@ -387,7 +446,6 @@ var MultiColumnComboBox = /** @class */ (function (_super) {
387
446
  },
388
447
  dataBound: function () { _this.onDataBound(); },
389
448
  actionFailure: function (args) { _this.onActionFailure(args); },
390
- actionBegin: function (args) { _this.trigger('actionBegin', args); },
391
449
  actionComplete: this.handleActionComplete.bind(this),
392
450
  keyPressed: this.handleKeyPressed.bind(this),
393
451
  resizing: function (args) {
@@ -423,7 +481,6 @@ var MultiColumnComboBox = /** @class */ (function (_super) {
423
481
  };
424
482
  MultiColumnComboBox.prototype.handleActionComplete = function (args) {
425
483
  var _this = this;
426
- this.trigger('actionComplete', args);
427
484
  if (args.requestType === 'sorting') {
428
485
  this.updateRowSelection(args);
429
486
  }
@@ -792,8 +849,8 @@ var MultiColumnComboBox = /** @class */ (function (_super) {
792
849
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
793
850
  var dataLists = e.result;
794
851
  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);
852
+ var fieldVal = item ? (_this.updateFieldValue(isRerender ? (isValue ? _this.fields.value :
853
+ _this.fields.text) : !isNOU(_this.value) ? _this.fields.value : _this.fields.text, item)) : null;
797
854
  return fieldVal === value_1;
798
855
  });
799
856
  if (filteredData.length > 0) {
@@ -1104,24 +1161,24 @@ var MultiColumnComboBox = /** @class */ (function (_super) {
1104
1161
  this.showPopup(null, true);
1105
1162
  this.updateClearIconState();
1106
1163
  if (this.allowFiltering) {
1107
- var inputValue_1 = e.target.value.toLowerCase();
1108
- var customFiltering_1 = false;
1164
+ this.typedString = e.target.value.toLowerCase();
1109
1165
  var eventArgs_1 = {
1110
1166
  preventDefaultAction: false,
1111
- text: inputValue_1,
1167
+ text: this.typedString,
1112
1168
  updateData: function (dataSource, query, fields) {
1113
1169
  if (eventArgs_1.cancel) {
1114
1170
  return;
1115
1171
  }
1116
- customFiltering_1 = true;
1117
- _this.filterAction(dataSource, inputValue_1, query, fields);
1172
+ _this.isCustomFilter = true;
1173
+ _this.customFilterQuery = query ? query.clone() : query;
1174
+ _this.setGridData(dataSource, query);
1118
1175
  },
1119
1176
  event: e,
1120
1177
  cancel: false
1121
1178
  };
1122
1179
  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);
1180
+ if (!eventArgs.cancel && !eventArgs.preventDefaultAction && !_this.isCustomFilter) {
1181
+ _this.setGridData(_this.dataSource, _this.query ? _this.query.clone() : null);
1125
1182
  }
1126
1183
  });
1127
1184
  }
@@ -1129,27 +1186,16 @@ var MultiColumnComboBox = /** @class */ (function (_super) {
1129
1186
  };
1130
1187
  MultiColumnComboBox.prototype.updateInputValue = function (inputValue) {
1131
1188
  return __awaiter(this, void 0, void 0, function () {
1132
- var _a, _b, data, exactData, query, result, totaldata;
1189
+ var _a, _b, data, exactData;
1133
1190
  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*/];
1191
+ if (this.dataSource instanceof DataManager) {
1192
+ (_a = this.filterDatas(this.mainData, inputValue), data = _a.data, exactData = _a.exactData);
1193
+ }
1194
+ else if (Array.isArray(this.dataSource)) {
1195
+ (_b = this.filterDatas(this.dataSource, inputValue), data = _b.data, exactData = _b.exactData);
1152
1196
  }
1197
+ this.selectFilteredRows(data, exactData);
1198
+ return [2 /*return*/];
1153
1199
  });
1154
1200
  });
1155
1201
  };
@@ -1175,72 +1221,14 @@ var MultiColumnComboBox = /** @class */ (function (_super) {
1175
1221
  var selectedIndex = this.findIndex(this.gridObj.currentViewData, this.matchedContent);
1176
1222
  this.matchedRowEle = this.gridObj.getRowByIndex(selectedIndex);
1177
1223
  };
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) {
1224
+ MultiColumnComboBox.prototype.updateGridDataSource = function () {
1225
+ if (this.gridData && this.gridData.length > 0) {
1238
1226
  removeClass([this.popupDiv], [NODATA]);
1239
1227
  var noRecordEle = this.popupDiv.querySelector('.e-no-records');
1240
1228
  if (noRecordEle) {
1241
1229
  this.popupDiv.removeChild(noRecordEle);
1242
1230
  }
1243
- this.gridObj.dataSource = dataSource;
1231
+ this.gridObj.dataSource = this.gridData;
1244
1232
  this.isDataFiltered = true;
1245
1233
  }
1246
1234
  else {
@@ -1529,7 +1517,7 @@ var MultiColumnComboBox = /** @class */ (function (_super) {
1529
1517
  if (this.gridObj) {
1530
1518
  var dataLength_1;
1531
1519
  this.isShowSpinner = true;
1532
- this.gridObj.dataSource = newDataSource;
1520
+ this.setGridData(newDataSource);
1533
1521
  var isRemoteData = oldDataSource instanceof DataManager;
1534
1522
  if (isRemoteData) {
1535
1523
  oldDataSource.executeQuery(new Query()).then(function (e) {
@@ -1658,11 +1646,17 @@ var MultiColumnComboBox = /** @class */ (function (_super) {
1658
1646
  }
1659
1647
  _this.inputEle.removeAttribute('aria-owns');
1660
1648
  _this.inputEle.removeAttribute('aria-activedescendant');
1649
+ _this.customFilterQuery = null;
1661
1650
  }
1662
1651
  });
1663
1652
  setTimeout(function () {
1664
1653
  if (_this.gridObj) {
1665
- _this.gridObj.dataSource = _this.dataSource;
1654
+ _this.gridObj.dataSource = _this.allowFiltering ? _this.mainData : _this.gridData;
1655
+ var noRecordEle = _this.popupDiv.querySelector('.e-no-records');
1656
+ if (noRecordEle) {
1657
+ _this.popupDiv.removeChild(noRecordEle);
1658
+ removeClass([_this.popupDiv], [NODATA]);
1659
+ }
1666
1660
  _this.updateGridHeight(true, false);
1667
1661
  }
1668
1662
  }, 100);
@@ -1869,9 +1863,8 @@ var MultiColumnComboBox = /** @class */ (function (_super) {
1869
1863
  this.updateDynamicDataSource(newProp.dataSource, oldProp.dataSource);
1870
1864
  break;
1871
1865
  case 'query':
1872
- if (this.gridObj) {
1873
- this.gridObj.query = newProp.query;
1874
- }
1866
+ this.isMainDataUpdated = false;
1867
+ this.setGridData(this.dataSource);
1875
1868
  break;
1876
1869
  case 'gridSettings':
1877
1870
  if (this.gridObj) {