@syncfusion/ej2-multicolumn-combobox 27.2.2 → 27.2.4

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,8 +1,8 @@
1
- import { Property, ChildProperty, getUniqueID, isNullOrUndefined, addClass, removeClass, formatUnit, attributes, prepend, Browser, append, L10n, select, compile, EventHandler, KeyboardEvents, closest, Animation, detach, Complex, Collection, Event, NotifyPropertyChanges, Component } from '@syncfusion/ej2-base';
1
+ import { Property, ChildProperty, Event, getUniqueID, isNullOrUndefined, addClass, removeClass, formatUnit, attributes, prepend, Browser, append, L10n, select, compile, EventHandler, KeyboardEvents, closest, Animation, detach, Complex, Collection, NotifyPropertyChanges, Component } from '@syncfusion/ej2-base';
2
2
  import { Input } from '@syncfusion/ej2-inputs';
3
3
  import { DataManager, Query } from '@syncfusion/ej2-data';
4
4
  import { Popup } from '@syncfusion/ej2-popups';
5
- import { Grid, VirtualScroll, Group, Edit, Sort } from '@syncfusion/ej2-grids';
5
+ import { Grid, VirtualScroll, Group, Edit, Sort, Resize } from '@syncfusion/ej2-grids';
6
6
  export { Edit, Group, Sort, VirtualScroll } from '@syncfusion/ej2-grids';
7
7
 
8
8
  var __extends = (undefined && undefined.__extends) || (function () {
@@ -42,7 +42,7 @@ var MultiColumnGrid = /** @__PURE__ @class */ (function () {
42
42
  * @private
43
43
  */
44
44
  MultiColumnGrid.prototype.InjectModules = function () {
45
- Grid.Inject(VirtualScroll, Group, Edit, Sort);
45
+ Grid.Inject(VirtualScroll, Group, Edit, Sort, Resize);
46
46
  };
47
47
  return MultiColumnGrid;
48
48
  }());
@@ -193,6 +193,18 @@ var GridSettings = /** @__PURE__ @class */ (function (_super) {
193
193
  __decorate([
194
194
  Property(WrapMode.Both)
195
195
  ], GridSettings.prototype, "textWrapMode", void 0);
196
+ __decorate([
197
+ Property(false)
198
+ ], GridSettings.prototype, "allowResizing", void 0);
199
+ __decorate([
200
+ Event()
201
+ ], GridSettings.prototype, "resizing", void 0);
202
+ __decorate([
203
+ Event()
204
+ ], GridSettings.prototype, "resizeStart", void 0);
205
+ __decorate([
206
+ Event()
207
+ ], GridSettings.prototype, "resizeStop", void 0);
196
208
  return GridSettings;
197
209
  }(ChildProperty));
198
210
  /**
@@ -304,24 +316,13 @@ var MultiColumnComboBox = /** @__PURE__ @class */ (function (_super) {
304
316
  allowTextWrap: this.gridSettings.allowTextWrap,
305
317
  textWrapSettings: { wrapMode: this.gridSettings.textWrapMode },
306
318
  height: this.popupHeight,
319
+ allowResizing: this.gridSettings.allowResizing,
307
320
  allowMultiSorting: this.sortType.toString().toLowerCase() === 'multiplecolumns' && this.allowSorting,
308
321
  rowTemplate: this.itemTemplate,
309
322
  dataBound: function () { _this.onDataBound(); },
310
323
  actionFailure: function (args) { _this.onActionFailure(args); },
311
324
  actionBegin: function (args) { _this.trigger('actionBegin', args); },
312
- actionComplete: function (args) {
313
- _this.trigger('actionComplete', args);
314
- if (args.requestType === 'sorting') {
315
- _this.updateRowSelection(args);
316
- }
317
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
318
- var dataRows = args.rows;
319
- if (_this.isDataFiltered && dataRows.length > 0 && _this.inputEle.value !== '' && args.requestType !== 'sorting') {
320
- var firstRowEle = _this.gridObj.getRows()[0];
321
- firstRowEle.classList.add('e-row-focus');
322
- }
323
- _this.popupObj.refreshPosition();
324
- },
325
+ actionComplete: this.handleActionComplete.bind(this),
325
326
  keyPressed: function (args) {
326
327
  if (args.key === 'Enter') {
327
328
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -337,7 +338,10 @@ var MultiColumnComboBox = /** @__PURE__ @class */ (function (_super) {
337
338
  args.cancel = true;
338
339
  _this.gridKeyActionHandler(args, true);
339
340
  }
340
- }
341
+ },
342
+ resizing: function (args) { _this.gridSettings.resizing(args); },
343
+ resizeStart: function (args) { _this.gridSettings.resizeStart(args); },
344
+ resizeStop: function (args) { _this.gridSettings.resizeStop(args); }
341
345
  });
342
346
  this.gridEle = this.createElement('div', { id: getUniqueID('grid'), className: MULTICOLUMNGRID });
343
347
  this.updateGroupByField();
@@ -352,6 +356,14 @@ var MultiColumnComboBox = /** @__PURE__ @class */ (function (_super) {
352
356
  }
353
357
  this.gridObj.appendTo(this.gridEle);
354
358
  };
359
+ MultiColumnComboBox.prototype.handleActionComplete = function (args) {
360
+ this.trigger('actionComplete', args);
361
+ if (args.requestType === 'sorting') {
362
+ this.updateRowSelection(args);
363
+ }
364
+ this.popupObj.refreshPosition();
365
+ this.gridObj.element.querySelector('.e-content').scrollTop = 0;
366
+ };
355
367
  /* eslint-disable @typescript-eslint/no-explicit-any */
356
368
  MultiColumnComboBox.prototype.isRowMatching = function (data, selectedValue, selectedText) {
357
369
  var values = Object.values(data).map(String);
@@ -452,6 +464,11 @@ var MultiColumnComboBox = /** @__PURE__ @class */ (function (_super) {
452
464
  this.popupEle.style.visibility = 'unset';
453
465
  this.isInitialRender = false;
454
466
  }
467
+ var rowElements = this.gridObj.element.querySelectorAll('.e-row');
468
+ if (this.isDataFiltered && rowElements.length > 0 && this.inputEle.value !== '') {
469
+ var firstRowEle = rowElements[0];
470
+ firstRowEle.classList.add('e-row-focus');
471
+ }
455
472
  };
456
473
  MultiColumnComboBox.prototype.onActionFailure = function (args) {
457
474
  this.trigger('actionFailure', args);
@@ -1279,33 +1296,44 @@ var MultiColumnComboBox = /** @__PURE__ @class */ (function (_super) {
1279
1296
  }
1280
1297
  };
1281
1298
  MultiColumnComboBox.prototype.updateSelectedItem = function (e, isUpdateIndex, isInputTarget) {
1299
+ var _this = this;
1282
1300
  if (isUpdateIndex === void 0) { isUpdateIndex = true; }
1283
1301
  if (this.isPopupOpen) {
1284
- var index = !this.fields.groupBy ? this.gridObj.selectedRowIndex
1285
- : this.gridObj.selectedRowIndex ? this.gridObj.selectedRowIndex : 0;
1286
- if ((index === -1 && (e.action === 'moveDown' || e.action === 'moveUp')) || (e.action === 'home')) {
1287
- index = 0;
1302
+ var index_1 = this.fields.groupBy ? (this.gridObj.selectedRowIndex || 0) : this.gridObj.selectedRowIndex;
1303
+ var dataLength = this.dataSource instanceof DataManager ? this.remoteDataLength :
1304
+ this.dataSource.length;
1305
+ if ((index_1 === -1 && (e.action === 'moveDown' || e.action === 'moveUp')) || (e.action === 'home')) {
1306
+ index_1 = 0;
1288
1307
  }
1289
- else if ((index >= this.gridObj.getRows().length && e.action === 'moveDown') || (e.action === 'end')) {
1290
- index = this.gridObj.getRows().length - 1;
1308
+ else if ((index_1 >= (dataLength - 1) && e.action === 'moveDown') || (e.action === 'end')) {
1309
+ index_1 = dataLength - 1;
1291
1310
  }
1292
- else if (e.action === 'moveDown' && (index >= 0 && index <= this.gridObj.getRows().length) && (this.fields.groupBy || isInputTarget)) {
1293
- index += 1;
1311
+ else if (e.action === 'moveDown' && (index_1 >= 0 && index_1 <= (dataLength - 1)) && (this.fields.groupBy || isInputTarget)) {
1312
+ index_1 += 1;
1294
1313
  }
1295
- else if (e.action === 'moveUp' && index > 0 && (this.fields.groupBy) || isInputTarget) {
1296
- index -= 1;
1314
+ else if (e.action === 'moveUp' && index_1 > 0 && (this.fields.groupBy) || isInputTarget) {
1315
+ index_1 -= 1;
1297
1316
  }
1298
- this.gridObj.selectRow(index);
1299
- this.gridObj.selectedRowIndex = index;
1300
- var focusedEle = this.gridEle.querySelector('.e-row-focus');
1301
- if (focusedEle) {
1302
- focusedEle.classList.remove('e-row-focus');
1317
+ if (!this.enableVirtualization) {
1318
+ this.selectRow(e, isUpdateIndex, index_1);
1303
1319
  }
1304
- if (isUpdateIndex) {
1305
- this.selectedGridRow(this.gridObj.getRows()[parseInt(index.toString(), 10)], e, true);
1320
+ else {
1321
+ setTimeout(function () { _this.selectRow(e, isUpdateIndex, index_1); });
1306
1322
  }
1307
1323
  }
1308
1324
  };
1325
+ MultiColumnComboBox.prototype.selectRow = function (e, isUpdateIndex, index) {
1326
+ if (isUpdateIndex === void 0) { isUpdateIndex = true; }
1327
+ this.gridObj.selectRow(index);
1328
+ this.gridObj.selectedRowIndex = index;
1329
+ var focusedEle = this.gridEle.querySelector('.e-row-focus');
1330
+ if (focusedEle) {
1331
+ focusedEle.classList.remove('e-row-focus');
1332
+ }
1333
+ if (isUpdateIndex) {
1334
+ this.selectedGridRow(this.gridObj.getRows()[parseInt(index.toString(), 10)], e, true);
1335
+ }
1336
+ };
1309
1337
  MultiColumnComboBox.prototype.updateClearIconState = function () {
1310
1338
  var clearIconEle = this.inputWrapper.querySelector('.e-clear-icon');
1311
1339
  if (clearIconEle) {
@@ -1400,6 +1428,12 @@ var MultiColumnComboBox = /** @__PURE__ @class */ (function (_super) {
1400
1428
  _this.inputEle.setAttribute('aria-activedescendant', contentEle.querySelector('.e-row').getAttribute('data-uid'));
1401
1429
  }
1402
1430
  }
1431
+ if (!isNullOrUndefined(_this.dataSource) && _this.dataSource instanceof DataManager) {
1432
+ _this.dataSource.executeQuery(new Query).then(function (e) {
1433
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1434
+ _this.remoteDataLength = e.result.length;
1435
+ });
1436
+ }
1403
1437
  _this.popupObj.show(new Animation(eventArgs.animation), _this.popupEle);
1404
1438
  }
1405
1439
  });
@@ -1653,6 +1687,7 @@ var MultiColumnComboBox = /** @__PURE__ @class */ (function (_super) {
1653
1687
  this.gridObj.gridLines = newProp.gridSettings.gridLines;
1654
1688
  this.gridObj.rowHeight = newProp.gridSettings.rowHeight;
1655
1689
  this.gridObj.enableAltRow = newProp.gridSettings.enableAltRow;
1690
+ this.gridObj.allowResizing = newProp.gridSettings.allowResizing;
1656
1691
  if (!(isNullOrUndefined(newProp.gridSettings.allowTextWrap))) {
1657
1692
  this.gridObj.allowTextWrap = newProp.gridSettings.allowTextWrap;
1658
1693
  }