@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.
@@ -309,19 +309,7 @@ var MultiColumnComboBox = /** @__PURE__ @class */ (function (_super) {
309
309
  dataBound: function () { _this.onDataBound(); },
310
310
  actionFailure: function (args) { _this.onActionFailure(args); },
311
311
  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
- },
312
+ actionComplete: this.handleActionComplete.bind(this),
325
313
  keyPressed: function (args) {
326
314
  if (args.key === 'Enter') {
327
315
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -342,14 +330,24 @@ var MultiColumnComboBox = /** @__PURE__ @class */ (function (_super) {
342
330
  this.gridEle = this.createElement('div', { id: getUniqueID('grid'), className: MULTICOLUMNGRID });
343
331
  this.updateGroupByField();
344
332
  var sortOrder = this.sortOrder.toString().toLowerCase();
345
- // Set first column as primary key to avoid PRIMARY KEY MISSING warning.
346
- this.gridObj.columns[0].isPrimaryKey = true;
333
+ if (gridColumns.length > 0) {
334
+ // Set first column as primary key to avoid PRIMARY KEY MISSING warning.
335
+ this.gridObj.columns[0].isPrimaryKey = true;
336
+ }
347
337
  if (sortOrder !== 'none') {
348
338
  this.gridObj.sortSettings = { columns: [{ field: this.fields.text, direction: sortOrder === 'ascending' ?
349
339
  SortOrder.Ascending : SortOrder.Descending }] };
350
340
  }
351
341
  this.gridObj.appendTo(this.gridEle);
352
342
  };
343
+ MultiColumnComboBox.prototype.handleActionComplete = function (args) {
344
+ this.trigger('actionComplete', args);
345
+ if (args.requestType === 'sorting') {
346
+ this.updateRowSelection(args);
347
+ }
348
+ this.popupObj.refreshPosition();
349
+ this.gridObj.element.querySelector('.e-content').scrollTop = 0;
350
+ };
353
351
  /* eslint-disable @typescript-eslint/no-explicit-any */
354
352
  MultiColumnComboBox.prototype.isRowMatching = function (data, selectedValue, selectedText) {
355
353
  var values = Object.values(data).map(String);
@@ -450,6 +448,11 @@ var MultiColumnComboBox = /** @__PURE__ @class */ (function (_super) {
450
448
  this.popupEle.style.visibility = 'unset';
451
449
  this.isInitialRender = false;
452
450
  }
451
+ var rowElements = this.gridObj.element.querySelectorAll('.e-row');
452
+ if (this.isDataFiltered && rowElements.length > 0 && this.inputEle.value !== '') {
453
+ var firstRowEle = rowElements[0];
454
+ firstRowEle.classList.add('e-row-focus');
455
+ }
453
456
  };
454
457
  MultiColumnComboBox.prototype.onActionFailure = function (args) {
455
458
  this.trigger('actionFailure', args);
@@ -1277,33 +1280,44 @@ var MultiColumnComboBox = /** @__PURE__ @class */ (function (_super) {
1277
1280
  }
1278
1281
  };
1279
1282
  MultiColumnComboBox.prototype.updateSelectedItem = function (e, isUpdateIndex, isInputTarget) {
1283
+ var _this = this;
1280
1284
  if (isUpdateIndex === void 0) { isUpdateIndex = true; }
1281
1285
  if (this.isPopupOpen) {
1282
- var index = !this.fields.groupBy ? this.gridObj.selectedRowIndex
1283
- : this.gridObj.selectedRowIndex ? this.gridObj.selectedRowIndex : 0;
1284
- if ((index === -1 && (e.action === 'moveDown' || e.action === 'moveUp')) || (e.action === 'home')) {
1285
- index = 0;
1286
+ var index_1 = this.fields.groupBy ? (this.gridObj.selectedRowIndex || 0) : this.gridObj.selectedRowIndex;
1287
+ var dataLength = this.dataSource instanceof DataManager ? this.remoteDataLength :
1288
+ this.dataSource.length;
1289
+ if ((index_1 === -1 && (e.action === 'moveDown' || e.action === 'moveUp')) || (e.action === 'home')) {
1290
+ index_1 = 0;
1286
1291
  }
1287
- else if ((index >= this.gridObj.getRows().length && e.action === 'moveDown') || (e.action === 'end')) {
1288
- index = this.gridObj.getRows().length - 1;
1292
+ else if ((index_1 >= (dataLength - 1) && e.action === 'moveDown') || (e.action === 'end')) {
1293
+ index_1 = dataLength - 1;
1289
1294
  }
1290
- else if (e.action === 'moveDown' && (index >= 0 && index <= this.gridObj.getRows().length) && (this.fields.groupBy || isInputTarget)) {
1291
- index += 1;
1295
+ else if (e.action === 'moveDown' && (index_1 >= 0 && index_1 <= (dataLength - 1)) && (this.fields.groupBy || isInputTarget)) {
1296
+ index_1 += 1;
1292
1297
  }
1293
- else if (e.action === 'moveUp' && index > 0 && (this.fields.groupBy) || isInputTarget) {
1294
- index -= 1;
1298
+ else if (e.action === 'moveUp' && index_1 > 0 && (this.fields.groupBy) || isInputTarget) {
1299
+ index_1 -= 1;
1295
1300
  }
1296
- this.gridObj.selectRow(index);
1297
- this.gridObj.selectedRowIndex = index;
1298
- var focusedEle = this.gridEle.querySelector('.e-row-focus');
1299
- if (focusedEle) {
1300
- focusedEle.classList.remove('e-row-focus');
1301
+ if (!this.enableVirtualization) {
1302
+ this.selectRow(e, isUpdateIndex, index_1);
1301
1303
  }
1302
- if (isUpdateIndex) {
1303
- this.selectedGridRow(this.gridObj.getRows()[parseInt(index.toString(), 10)], e, true);
1304
+ else {
1305
+ setTimeout(function () { _this.selectRow(e, isUpdateIndex, index_1); });
1304
1306
  }
1305
1307
  }
1306
1308
  };
1309
+ MultiColumnComboBox.prototype.selectRow = function (e, isUpdateIndex, index) {
1310
+ if (isUpdateIndex === void 0) { isUpdateIndex = true; }
1311
+ this.gridObj.selectRow(index);
1312
+ this.gridObj.selectedRowIndex = index;
1313
+ var focusedEle = this.gridEle.querySelector('.e-row-focus');
1314
+ if (focusedEle) {
1315
+ focusedEle.classList.remove('e-row-focus');
1316
+ }
1317
+ if (isUpdateIndex) {
1318
+ this.selectedGridRow(this.gridObj.getRows()[parseInt(index.toString(), 10)], e, true);
1319
+ }
1320
+ };
1307
1321
  MultiColumnComboBox.prototype.updateClearIconState = function () {
1308
1322
  var clearIconEle = this.inputWrapper.querySelector('.e-clear-icon');
1309
1323
  if (clearIconEle) {
@@ -1398,6 +1412,12 @@ var MultiColumnComboBox = /** @__PURE__ @class */ (function (_super) {
1398
1412
  _this.inputEle.setAttribute('aria-activedescendant', contentEle.querySelector('.e-row').getAttribute('data-uid'));
1399
1413
  }
1400
1414
  }
1415
+ if (!isNullOrUndefined(_this.dataSource) && _this.dataSource instanceof DataManager) {
1416
+ _this.dataSource.executeQuery(new Query).then(function (e) {
1417
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1418
+ _this.remoteDataLength = e.result.length;
1419
+ });
1420
+ }
1401
1421
  _this.popupObj.show(new Animation(eventArgs.animation), _this.popupEle);
1402
1422
  }
1403
1423
  });