@syncfusion/ej2-multicolumn-combobox 27.1.50 → 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
@@ -308,14 +296,24 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
308
296
  this.gridEle = this.createElement('div', { id: getUniqueID('grid'), className: MULTICOLUMNGRID });
309
297
  this.updateGroupByField();
310
298
  const sortOrder = this.sortOrder.toString().toLowerCase();
311
- // Set first column as primary key to avoid PRIMARY KEY MISSING warning.
312
- this.gridObj.columns[0].isPrimaryKey = true;
299
+ if (gridColumns.length > 0) {
300
+ // Set first column as primary key to avoid PRIMARY KEY MISSING warning.
301
+ this.gridObj.columns[0].isPrimaryKey = true;
302
+ }
313
303
  if (sortOrder !== 'none') {
314
304
  this.gridObj.sortSettings = { columns: [{ field: this.fields.text, direction: sortOrder === 'ascending' ?
315
305
  SortOrder.Ascending : SortOrder.Descending }] };
316
306
  }
317
307
  this.gridObj.appendTo(this.gridEle);
318
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
+ }
319
317
  /* eslint-disable @typescript-eslint/no-explicit-any */
320
318
  isRowMatching(data, selectedValue, selectedText) {
321
319
  const values = Object.values(data).map(String);
@@ -414,6 +412,11 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
414
412
  this.popupEle.style.visibility = 'unset';
415
413
  this.isInitialRender = false;
416
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
+ }
417
420
  }
418
421
  onActionFailure(args) {
419
422
  this.trigger('actionFailure', args);
@@ -1230,31 +1233,40 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
1230
1233
  }
1231
1234
  updateSelectedItem(e, isUpdateIndex = true, isInputTarget) {
1232
1235
  if (this.isPopupOpen) {
1233
- let index = !this.fields.groupBy ? this.gridObj.selectedRowIndex
1234
- : 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;
1235
1239
  if ((index === -1 && (e.action === 'moveDown' || e.action === 'moveUp')) || (e.action === 'home')) {
1236
1240
  index = 0;
1237
1241
  }
1238
- else if ((index >= this.gridObj.getRows().length && e.action === 'moveDown') || (e.action === 'end')) {
1239
- index = this.gridObj.getRows().length - 1;
1242
+ else if ((index >= (dataLength - 1) && e.action === 'moveDown') || (e.action === 'end')) {
1243
+ index = dataLength - 1;
1240
1244
  }
1241
- 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)) {
1242
1246
  index += 1;
1243
1247
  }
1244
1248
  else if (e.action === 'moveUp' && index > 0 && (this.fields.groupBy) || isInputTarget) {
1245
1249
  index -= 1;
1246
1250
  }
1247
- this.gridObj.selectRow(index);
1248
- this.gridObj.selectedRowIndex = index;
1249
- const focusedEle = this.gridEle.querySelector('.e-row-focus');
1250
- if (focusedEle) {
1251
- focusedEle.classList.remove('e-row-focus');
1251
+ if (!this.enableVirtualization) {
1252
+ this.selectRow(e, isUpdateIndex, index);
1252
1253
  }
1253
- if (isUpdateIndex) {
1254
- this.selectedGridRow(this.gridObj.getRows()[parseInt(index.toString(), 10)], e, true);
1254
+ else {
1255
+ setTimeout(() => { this.selectRow(e, isUpdateIndex, index); });
1255
1256
  }
1256
1257
  }
1257
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
+ }
1258
1270
  updateClearIconState() {
1259
1271
  const clearIconEle = this.inputWrapper.querySelector('.e-clear-icon');
1260
1272
  if (clearIconEle) {
@@ -1348,6 +1360,12 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
1348
1360
  this.inputEle.setAttribute('aria-activedescendant', contentEle.querySelector('.e-row').getAttribute('data-uid'));
1349
1361
  }
1350
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
+ }
1351
1369
  this.popupObj.show(new Animation(eventArgs.animation), this.popupEle);
1352
1370
  }
1353
1371
  });