@syncfusion/ej2-multicolumn-combobox 27.2.2 → 27.2.3

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.
@@ -275,19 +275,7 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
275
275
  dataBound: () => { this.onDataBound(); },
276
276
  actionFailure: (args) => { this.onActionFailure(args); },
277
277
  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
- },
278
+ actionComplete: this.handleActionComplete.bind(this),
291
279
  keyPressed: (args) => {
292
280
  if (args.key === 'Enter') {
293
281
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -318,6 +306,14 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
318
306
  }
319
307
  this.gridObj.appendTo(this.gridEle);
320
308
  }
309
+ handleActionComplete(args) {
310
+ this.trigger('actionComplete', args);
311
+ if (args.requestType === 'sorting') {
312
+ this.updateRowSelection(args);
313
+ }
314
+ this.popupObj.refreshPosition();
315
+ this.gridObj.element.querySelector('.e-content').scrollTop = 0;
316
+ }
321
317
  /* eslint-disable @typescript-eslint/no-explicit-any */
322
318
  isRowMatching(data, selectedValue, selectedText) {
323
319
  const values = Object.values(data).map(String);
@@ -416,6 +412,11 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
416
412
  this.popupEle.style.visibility = 'unset';
417
413
  this.isInitialRender = false;
418
414
  }
415
+ const rowElements = this.gridObj.element.querySelectorAll('.e-row');
416
+ if (this.isDataFiltered && rowElements.length > 0 && this.inputEle.value !== '') {
417
+ const firstRowEle = rowElements[0];
418
+ firstRowEle.classList.add('e-row-focus');
419
+ }
419
420
  }
420
421
  onActionFailure(args) {
421
422
  this.trigger('actionFailure', args);
@@ -1232,31 +1233,40 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
1232
1233
  }
1233
1234
  updateSelectedItem(e, isUpdateIndex = true, isInputTarget) {
1234
1235
  if (this.isPopupOpen) {
1235
- let index = !this.fields.groupBy ? this.gridObj.selectedRowIndex
1236
- : this.gridObj.selectedRowIndex ? this.gridObj.selectedRowIndex : 0;
1236
+ let index = this.fields.groupBy ? (this.gridObj.selectedRowIndex || 0) : this.gridObj.selectedRowIndex;
1237
+ const dataLength = this.dataSource instanceof DataManager ? this.remoteDataLength :
1238
+ this.dataSource.length;
1237
1239
  if ((index === -1 && (e.action === 'moveDown' || e.action === 'moveUp')) || (e.action === 'home')) {
1238
1240
  index = 0;
1239
1241
  }
1240
- else if ((index >= this.gridObj.getRows().length && e.action === 'moveDown') || (e.action === 'end')) {
1241
- index = this.gridObj.getRows().length - 1;
1242
+ else if ((index >= (dataLength - 1) && e.action === 'moveDown') || (e.action === 'end')) {
1243
+ index = dataLength - 1;
1242
1244
  }
1243
- else if (e.action === 'moveDown' && (index >= 0 && index <= this.gridObj.getRows().length) && (this.fields.groupBy || isInputTarget)) {
1245
+ else if (e.action === 'moveDown' && (index >= 0 && index <= (dataLength - 1)) && (this.fields.groupBy || isInputTarget)) {
1244
1246
  index += 1;
1245
1247
  }
1246
1248
  else if (e.action === 'moveUp' && index > 0 && (this.fields.groupBy) || isInputTarget) {
1247
1249
  index -= 1;
1248
1250
  }
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');
1251
+ if (!this.enableVirtualization) {
1252
+ this.selectRow(e, isUpdateIndex, index);
1254
1253
  }
1255
- if (isUpdateIndex) {
1256
- this.selectedGridRow(this.gridObj.getRows()[parseInt(index.toString(), 10)], e, true);
1254
+ else {
1255
+ setTimeout(() => { this.selectRow(e, isUpdateIndex, index); });
1257
1256
  }
1258
1257
  }
1259
1258
  }
1259
+ selectRow(e, isUpdateIndex = true, index) {
1260
+ this.gridObj.selectRow(index);
1261
+ this.gridObj.selectedRowIndex = index;
1262
+ const focusedEle = this.gridEle.querySelector('.e-row-focus');
1263
+ if (focusedEle) {
1264
+ focusedEle.classList.remove('e-row-focus');
1265
+ }
1266
+ if (isUpdateIndex) {
1267
+ this.selectedGridRow(this.gridObj.getRows()[parseInt(index.toString(), 10)], e, true);
1268
+ }
1269
+ }
1260
1270
  updateClearIconState() {
1261
1271
  const clearIconEle = this.inputWrapper.querySelector('.e-clear-icon');
1262
1272
  if (clearIconEle) {
@@ -1350,6 +1360,12 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
1350
1360
  this.inputEle.setAttribute('aria-activedescendant', contentEle.querySelector('.e-row').getAttribute('data-uid'));
1351
1361
  }
1352
1362
  }
1363
+ if (!isNullOrUndefined(this.dataSource) && this.dataSource instanceof DataManager) {
1364
+ this.dataSource.executeQuery(new Query).then((e) => {
1365
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1366
+ this.remoteDataLength = e.result.length;
1367
+ });
1368
+ }
1353
1369
  this.popupObj.show(new Animation(eventArgs.animation), this.popupEle);
1354
1370
  }
1355
1371
  });