@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 { ChildProperty, Property, Component, getUniqueID, isNullOrUndefined, addClass, removeClass, formatUnit, attributes, prepend, Browser, append, L10n, select, compile, EventHandler, KeyboardEvents, closest, Animation, detach, Complex, Collection, Event, NotifyPropertyChanges } from '@syncfusion/ej2-base';
1
+ import { ChildProperty, Property, Event, Component, getUniqueID, isNullOrUndefined, addClass, removeClass, formatUnit, attributes, prepend, Browser, append, L10n, select, compile, EventHandler, KeyboardEvents, closest, Animation, detach, Complex, Collection, NotifyPropertyChanges } 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 __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
@@ -27,7 +27,7 @@ class MultiColumnGrid {
27
27
  * @private
28
28
  */
29
29
  InjectModules() {
30
- Grid.Inject(VirtualScroll, Group, Edit, Sort);
30
+ Grid.Inject(VirtualScroll, Group, Edit, Sort, Resize);
31
31
  }
32
32
  }
33
33
  /**
@@ -164,6 +164,18 @@ __decorate([
164
164
  __decorate([
165
165
  Property(WrapMode.Both)
166
166
  ], GridSettings.prototype, "textWrapMode", void 0);
167
+ __decorate([
168
+ Property(false)
169
+ ], GridSettings.prototype, "allowResizing", void 0);
170
+ __decorate([
171
+ Event()
172
+ ], GridSettings.prototype, "resizing", void 0);
173
+ __decorate([
174
+ Event()
175
+ ], GridSettings.prototype, "resizeStart", void 0);
176
+ __decorate([
177
+ Event()
178
+ ], GridSettings.prototype, "resizeStop", void 0);
167
179
  /**
168
180
  * The `MultiColumnComboBox` allows the user to search and select values from a list. It provides a list of options that can be selected using a filter input.
169
181
  * The selected value will be displayed in the input element.
@@ -270,24 +282,13 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
270
282
  allowTextWrap: this.gridSettings.allowTextWrap,
271
283
  textWrapSettings: { wrapMode: this.gridSettings.textWrapMode },
272
284
  height: this.popupHeight,
285
+ allowResizing: this.gridSettings.allowResizing,
273
286
  allowMultiSorting: this.sortType.toString().toLowerCase() === 'multiplecolumns' && this.allowSorting,
274
287
  rowTemplate: this.itemTemplate,
275
288
  dataBound: () => { this.onDataBound(); },
276
289
  actionFailure: (args) => { this.onActionFailure(args); },
277
290
  actionBegin: (args) => { this.trigger('actionBegin', args); },
278
- actionComplete: (args) => {
279
- this.trigger('actionComplete', args);
280
- if (args.requestType === 'sorting') {
281
- this.updateRowSelection(args);
282
- }
283
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
284
- const dataRows = args.rows;
285
- if (this.isDataFiltered && dataRows.length > 0 && this.inputEle.value !== '' && args.requestType !== 'sorting') {
286
- const firstRowEle = this.gridObj.getRows()[0];
287
- firstRowEle.classList.add('e-row-focus');
288
- }
289
- this.popupObj.refreshPosition();
290
- },
291
+ actionComplete: this.handleActionComplete.bind(this),
291
292
  keyPressed: (args) => {
292
293
  if (args.key === 'Enter') {
293
294
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -303,7 +304,10 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
303
304
  args.cancel = true;
304
305
  this.gridKeyActionHandler(args, true);
305
306
  }
306
- }
307
+ },
308
+ resizing: (args) => { this.gridSettings.resizing(args); },
309
+ resizeStart: (args) => { this.gridSettings.resizeStart(args); },
310
+ resizeStop: (args) => { this.gridSettings.resizeStop(args); }
307
311
  });
308
312
  this.gridEle = this.createElement('div', { id: getUniqueID('grid'), className: MULTICOLUMNGRID });
309
313
  this.updateGroupByField();
@@ -318,6 +322,14 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
318
322
  }
319
323
  this.gridObj.appendTo(this.gridEle);
320
324
  }
325
+ handleActionComplete(args) {
326
+ this.trigger('actionComplete', args);
327
+ if (args.requestType === 'sorting') {
328
+ this.updateRowSelection(args);
329
+ }
330
+ this.popupObj.refreshPosition();
331
+ this.gridObj.element.querySelector('.e-content').scrollTop = 0;
332
+ }
321
333
  /* eslint-disable @typescript-eslint/no-explicit-any */
322
334
  isRowMatching(data, selectedValue, selectedText) {
323
335
  const values = Object.values(data).map(String);
@@ -416,6 +428,11 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
416
428
  this.popupEle.style.visibility = 'unset';
417
429
  this.isInitialRender = false;
418
430
  }
431
+ const rowElements = this.gridObj.element.querySelectorAll('.e-row');
432
+ if (this.isDataFiltered && rowElements.length > 0 && this.inputEle.value !== '') {
433
+ const firstRowEle = rowElements[0];
434
+ firstRowEle.classList.add('e-row-focus');
435
+ }
419
436
  }
420
437
  onActionFailure(args) {
421
438
  this.trigger('actionFailure', args);
@@ -1232,31 +1249,40 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
1232
1249
  }
1233
1250
  updateSelectedItem(e, isUpdateIndex = true, isInputTarget) {
1234
1251
  if (this.isPopupOpen) {
1235
- let index = !this.fields.groupBy ? this.gridObj.selectedRowIndex
1236
- : this.gridObj.selectedRowIndex ? this.gridObj.selectedRowIndex : 0;
1252
+ let index = this.fields.groupBy ? (this.gridObj.selectedRowIndex || 0) : this.gridObj.selectedRowIndex;
1253
+ const dataLength = this.dataSource instanceof DataManager ? this.remoteDataLength :
1254
+ this.dataSource.length;
1237
1255
  if ((index === -1 && (e.action === 'moveDown' || e.action === 'moveUp')) || (e.action === 'home')) {
1238
1256
  index = 0;
1239
1257
  }
1240
- else if ((index >= this.gridObj.getRows().length && e.action === 'moveDown') || (e.action === 'end')) {
1241
- index = this.gridObj.getRows().length - 1;
1258
+ else if ((index >= (dataLength - 1) && e.action === 'moveDown') || (e.action === 'end')) {
1259
+ index = dataLength - 1;
1242
1260
  }
1243
- else if (e.action === 'moveDown' && (index >= 0 && index <= this.gridObj.getRows().length) && (this.fields.groupBy || isInputTarget)) {
1261
+ else if (e.action === 'moveDown' && (index >= 0 && index <= (dataLength - 1)) && (this.fields.groupBy || isInputTarget)) {
1244
1262
  index += 1;
1245
1263
  }
1246
1264
  else if (e.action === 'moveUp' && index > 0 && (this.fields.groupBy) || isInputTarget) {
1247
1265
  index -= 1;
1248
1266
  }
1249
- this.gridObj.selectRow(index);
1250
- this.gridObj.selectedRowIndex = index;
1251
- const focusedEle = this.gridEle.querySelector('.e-row-focus');
1252
- if (focusedEle) {
1253
- focusedEle.classList.remove('e-row-focus');
1267
+ if (!this.enableVirtualization) {
1268
+ this.selectRow(e, isUpdateIndex, index);
1254
1269
  }
1255
- if (isUpdateIndex) {
1256
- this.selectedGridRow(this.gridObj.getRows()[parseInt(index.toString(), 10)], e, true);
1270
+ else {
1271
+ setTimeout(() => { this.selectRow(e, isUpdateIndex, index); });
1257
1272
  }
1258
1273
  }
1259
1274
  }
1275
+ selectRow(e, isUpdateIndex = true, index) {
1276
+ this.gridObj.selectRow(index);
1277
+ this.gridObj.selectedRowIndex = index;
1278
+ const focusedEle = this.gridEle.querySelector('.e-row-focus');
1279
+ if (focusedEle) {
1280
+ focusedEle.classList.remove('e-row-focus');
1281
+ }
1282
+ if (isUpdateIndex) {
1283
+ this.selectedGridRow(this.gridObj.getRows()[parseInt(index.toString(), 10)], e, true);
1284
+ }
1285
+ }
1260
1286
  updateClearIconState() {
1261
1287
  const clearIconEle = this.inputWrapper.querySelector('.e-clear-icon');
1262
1288
  if (clearIconEle) {
@@ -1350,6 +1376,12 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
1350
1376
  this.inputEle.setAttribute('aria-activedescendant', contentEle.querySelector('.e-row').getAttribute('data-uid'));
1351
1377
  }
1352
1378
  }
1379
+ if (!isNullOrUndefined(this.dataSource) && this.dataSource instanceof DataManager) {
1380
+ this.dataSource.executeQuery(new Query).then((e) => {
1381
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1382
+ this.remoteDataLength = e.result.length;
1383
+ });
1384
+ }
1353
1385
  this.popupObj.show(new Animation(eventArgs.animation), this.popupEle);
1354
1386
  }
1355
1387
  });
@@ -1600,6 +1632,7 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
1600
1632
  this.gridObj.gridLines = newProp.gridSettings.gridLines;
1601
1633
  this.gridObj.rowHeight = newProp.gridSettings.rowHeight;
1602
1634
  this.gridObj.enableAltRow = newProp.gridSettings.enableAltRow;
1635
+ this.gridObj.allowResizing = newProp.gridSettings.allowResizing;
1603
1636
  if (!(isNullOrUndefined(newProp.gridSettings.allowTextWrap))) {
1604
1637
  this.gridObj.allowTextWrap = newProp.gridSettings.allowTextWrap;
1605
1638
  }