@syncfusion/ej2-multicolumn-combobox 26.1.38 → 26.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.
@@ -360,6 +360,10 @@ var MultiColumnComboBox = /** @__PURE__ @class */ (function (_super) {
360
360
  MultiColumnComboBox.prototype.getGridColumns = function () {
361
361
  var _this = this;
362
362
  return this.columns.map(function (column) {
363
+ var changeType;
364
+ if (column.displayAsCheckBox && !column.format) {
365
+ changeType = 'boolean';
366
+ }
363
367
  return {
364
368
  field: column.field,
365
369
  headerText: column.header,
@@ -370,7 +374,7 @@ var MultiColumnComboBox = /** @__PURE__ @class */ (function (_super) {
370
374
  template: column.template,
371
375
  headerTemplate: column.headerTemplate,
372
376
  customAttributes: column.customAttributes,
373
- type: column.displayAsCheckBox ? 'boolean' : 'string'
377
+ type: changeType
374
378
  };
375
379
  });
376
380
  };
@@ -409,6 +413,13 @@ var MultiColumnComboBox = /** @__PURE__ @class */ (function (_super) {
409
413
  this.popupDiv.removeChild(noRecordEle);
410
414
  }
411
415
  }
416
+ if (this.isInitialRender) {
417
+ var rowHeight = !this.popupDiv.classList.contains(NODATA) ? this.popupDiv.querySelector('.e-gridcontent tr').getBoundingClientRect().height : this.popupDiv.getBoundingClientRect().height;
418
+ this.popupRowHeight = rowHeight;
419
+ this.popupObj.hide();
420
+ this.popupEle.style.visibility = 'unset';
421
+ this.isInitialRender = false;
422
+ }
412
423
  };
413
424
  MultiColumnComboBox.prototype.onActionFailure = function (args) {
414
425
  this.trigger('actionFailure', args);
@@ -427,6 +438,9 @@ var MultiColumnComboBox = /** @__PURE__ @class */ (function (_super) {
427
438
  this.inputEle.setAttribute('aria-expanded', 'false');
428
439
  this.inputEle.setAttribute('aria-readOnly', this.readonly.toString());
429
440
  this.inputEle.setAttribute('aria-disabled', this.disabled.toString());
441
+ this.inputEle.setAttribute('autocomplete', 'off');
442
+ this.inputEle.setAttribute('autocapitalize', 'off');
443
+ this.inputEle.setAttribute('spellcheck', 'false');
430
444
  this.inputEle.setAttribute('tabindex', '0');
431
445
  }
432
446
  else {
@@ -636,9 +650,9 @@ var MultiColumnComboBox = /** @__PURE__ @class */ (function (_super) {
636
650
  popupHeight = formatUnit(parseInt(popupHeight, 10) - height + 'px');
637
651
  }
638
652
  this.popupDiv.style.maxHeight = popupHeight;
639
- this.popupRowHeight = this.popupDiv.querySelector('.e-gridcontent tr').getBoundingClientRect().height;
640
653
  this.updateGridHeight();
641
- this.popupObj.hide();
654
+ this.popupEle.style.visibility = 'hidden';
655
+ this.isInitialRender = true;
642
656
  };
643
657
  MultiColumnComboBox.prototype.updateGridHeight = function (isFilter, autoHeight, dataSourceCount) {
644
658
  var height;
@@ -673,6 +687,10 @@ var MultiColumnComboBox = /** @__PURE__ @class */ (function (_super) {
673
687
  if (!Browser.isDevice) {
674
688
  _this.hidePopup();
675
689
  }
690
+ },
691
+ open: function () {
692
+ _this.inputEle.focus();
693
+ _this.updateClearIconState();
676
694
  }
677
695
  });
678
696
  };
@@ -781,8 +799,8 @@ var MultiColumnComboBox = /** @__PURE__ @class */ (function (_super) {
781
799
  cancel: false
782
800
  };
783
801
  var selectedRecords = this.gridObj.getSelectedRecords()[0];
784
- var fieldText = selectedRecords ? selectedRecords[this.fields.text].toString() : "";
785
- var fieldValue = selectedRecords ? selectedRecords[this.fields.value].toString() : "";
802
+ var fieldText = selectedRecords ? selectedRecords[this.fields.text].toString() : '';
803
+ var fieldValue = selectedRecords ? selectedRecords[this.fields.value].toString() : '';
786
804
  var ChangeEventArgs = {
787
805
  isInteracted: e ? true : false,
788
806
  item: selectedRecords,
@@ -797,11 +815,13 @@ var MultiColumnComboBox = /** @__PURE__ @class */ (function (_super) {
797
815
  this.trigger('select', eventArgs, function (eventArgs) {
798
816
  if (!eventArgs.cancel && eventArgs.itemData) {
799
817
  var selectedRecord = eventArgs.itemData;
800
- if (!isKeyNav || (isKeyNav && e.key === 'Enter')) {
818
+ var event_1 = e;
819
+ var isUpdateVal = event_1.key === 'Enter' || event_1.key === 'Tab' || event_1.shiftKey && event_1.key === 'Tab' || event_1.altKey && event_1.key === 'ArrowUp';
820
+ if (!isKeyNav || (isKeyNav && isUpdateVal)) {
801
821
  _this.updateValues(selectedRecord[_this.fields.value], selectedRecord[_this.fields.text], _this.gridObj.selectedRowIndex, ChangeEventArgs);
802
822
  }
803
823
  Input.setValue(selectedRecord[_this.fields.text], _this.inputEle, _this.floatLabelType, _this.showClearButton);
804
- if (!isKeyNav || (isKeyNav && e.key === 'Enter')) {
824
+ if (!isKeyNav || (isKeyNav && isUpdateVal)) {
805
825
  _this.hidePopup(e);
806
826
  }
807
827
  }
@@ -829,6 +849,7 @@ var MultiColumnComboBox = /** @__PURE__ @class */ (function (_super) {
829
849
  MultiColumnComboBox.prototype.inputHandler = function (e) {
830
850
  var _this = this;
831
851
  this.showPopup(null, true);
852
+ this.updateClearIconState();
832
853
  if (this.allowFiltering) {
833
854
  var inputValue_1 = e.target.value.toLowerCase();
834
855
  var customFiltering_1 = false;
@@ -945,15 +966,16 @@ var MultiColumnComboBox = /** @__PURE__ @class */ (function (_super) {
945
966
  this.updateGridHeight(true, autoHeight, dataSource.length);
946
967
  };
947
968
  MultiColumnComboBox.prototype.wireEvents = function () {
948
- var ddbIcon = this.inputWrapper.querySelector('.e-input-group-icon');
949
- var clearIcon = this.inputWrapper.querySelector('.e-clear-icon');
950
- EventHandler.add(ddbIcon, 'mousedown', this.dropDownClick, this);
969
+ if (!isNullOrUndefined(this.inputObj.buttons[0])) {
970
+ EventHandler.add(this.inputObj.buttons[0], 'mousedown', this.preventBlur, this);
971
+ EventHandler.add(this.inputObj.buttons[0], 'mousedown', this.dropDownClick, this);
972
+ }
951
973
  EventHandler.add(document, 'mousedown', this.onDocumentClick, this);
952
974
  EventHandler.add(this.gridEle, 'click', this.onMouseClick, this);
953
975
  EventHandler.add(this.inputEle, 'input', this.inputHandler, this);
954
- EventHandler.add(this.inputWrapper, 'focus', this.focusIn, this);
955
- if (clearIcon) {
956
- EventHandler.add(clearIcon, 'click', this.clearText, this);
976
+ EventHandler.add(this.inputEle, 'focus', this.focusIn, this);
977
+ if (this.showClearButton) {
978
+ EventHandler.add(this.inputObj.clearButton, 'mousedown', this.clearText, this);
957
979
  }
958
980
  EventHandler.add(window, 'resize', this.windowResize, this);
959
981
  this.keyboardModule = new KeyboardEvents(this.inputWrapper, {
@@ -968,21 +990,25 @@ var MultiColumnComboBox = /** @__PURE__ @class */ (function (_super) {
968
990
  });
969
991
  };
970
992
  MultiColumnComboBox.prototype.unWireEvents = function () {
971
- var ddbIcon = this.inputWrapper.querySelector('.e-input-group-icon');
972
- var clearIcon = this.inputWrapper.querySelector('.e-clear-icon');
973
- EventHandler.remove(ddbIcon, 'mousedown', this.dropDownClick);
993
+ if (!isNullOrUndefined(this.inputObj.buttons[0])) {
994
+ EventHandler.remove(this.inputObj.buttons[0], 'mousedown', this.preventBlur);
995
+ EventHandler.remove(this.inputObj.buttons[0], 'mousedown', this.dropDownClick);
996
+ }
974
997
  EventHandler.remove(document, 'mousedown', this.onDocumentClick);
975
998
  EventHandler.remove(this.inputEle, 'input', this.inputHandler);
976
999
  EventHandler.remove(this.inputWrapper, 'focus', this.focusIn);
977
1000
  EventHandler.remove(window, 'resize', this.windowResize);
978
1001
  EventHandler.remove(this.gridEle, 'click', this.onMouseClick);
979
- if (clearIcon) {
980
- EventHandler.remove(clearIcon, 'click', this.clearText);
1002
+ if (this.showClearButton) {
1003
+ EventHandler.remove(this.inputObj.clearButton, 'mousedown', this.clearText);
981
1004
  }
982
1005
  if (this.keyboardModule) {
983
1006
  this.keyboardModule.destroy();
984
1007
  }
985
1008
  };
1009
+ MultiColumnComboBox.prototype.preventBlur = function (e) {
1010
+ e.preventDefault();
1011
+ };
986
1012
  MultiColumnComboBox.prototype.dropDownClick = function (e) {
987
1013
  if (this.disabled || this.readonly) {
988
1014
  return;
@@ -1029,9 +1055,6 @@ var MultiColumnComboBox = /** @__PURE__ @class */ (function (_super) {
1029
1055
  this.updateValuesOnInput(e);
1030
1056
  }
1031
1057
  }
1032
- if (!closest(target, '.e-multicolumn-list')) {
1033
- this.inputWrapper.tabIndex = -1;
1034
- }
1035
1058
  };
1036
1059
  MultiColumnComboBox.prototype.updateValuesOnInput = function (mouseEvent, keyEvent, isClearValues) {
1037
1060
  var _this = this;
@@ -1106,6 +1129,9 @@ var MultiColumnComboBox = /** @__PURE__ @class */ (function (_super) {
1106
1129
  if (this.isPopupOpen) {
1107
1130
  this.hidePopup(e);
1108
1131
  }
1132
+ else {
1133
+ this.focusOut();
1134
+ }
1109
1135
  break;
1110
1136
  case 'altDown':
1111
1137
  if (!this.isPopupOpen) {
@@ -1115,7 +1141,7 @@ var MultiColumnComboBox = /** @__PURE__ @class */ (function (_super) {
1115
1141
  break;
1116
1142
  case 'moveDown':
1117
1143
  case 'moveUp':
1118
- this.updateSelectedItem(e);
1144
+ this.updateSelectedItem(e, true, true);
1119
1145
  break;
1120
1146
  case 'enter':
1121
1147
  this.updateValuesOnInput(null, e);
@@ -1141,6 +1167,15 @@ var MultiColumnComboBox = /** @__PURE__ @class */ (function (_super) {
1141
1167
  else if (e.key === 'Home') {
1142
1168
  e.action = 'home';
1143
1169
  }
1170
+ else if (e.key === 'Tab') {
1171
+ e.action = 'tab';
1172
+ }
1173
+ else if (e.key === 'Escape') {
1174
+ e.action = 'escape';
1175
+ }
1176
+ if (e.shiftKey && e.key === 'Tab') {
1177
+ e.action = 'shiftTab';
1178
+ }
1144
1179
  if (e.altKey && e.key === 'ArrowUp') {
1145
1180
  e.action = 'altUp';
1146
1181
  }
@@ -1152,6 +1187,9 @@ var MultiColumnComboBox = /** @__PURE__ @class */ (function (_super) {
1152
1187
  case 'altUp':
1153
1188
  if (this.isPopupOpen) {
1154
1189
  e.preventDefault();
1190
+ if (e.action !== 'escape') {
1191
+ this.updateSelectedItem(e);
1192
+ }
1155
1193
  this.hidePopup(e);
1156
1194
  }
1157
1195
  break;
@@ -1163,7 +1201,7 @@ var MultiColumnComboBox = /** @__PURE__ @class */ (function (_super) {
1163
1201
  break;
1164
1202
  }
1165
1203
  };
1166
- MultiColumnComboBox.prototype.updateSelectedItem = function (e, isUpdateIndex) {
1204
+ MultiColumnComboBox.prototype.updateSelectedItem = function (e, isUpdateIndex, isInputTarget) {
1167
1205
  if (isUpdateIndex === void 0) { isUpdateIndex = true; }
1168
1206
  if (this.isPopupOpen) {
1169
1207
  var index = !this.fields.groupBy ? this.gridObj.selectedRowIndex : this.gridObj.selectedRowIndex ? this.gridObj.selectedRowIndex : 0;
@@ -1173,10 +1211,10 @@ var MultiColumnComboBox = /** @__PURE__ @class */ (function (_super) {
1173
1211
  else if ((index >= this.gridObj.getRows().length && e.action === 'moveDown') || (e.action === 'end')) {
1174
1212
  index = this.gridObj.getRows().length - 1;
1175
1213
  }
1176
- else if (e.action === 'moveDown' && (index >= 0 && index <= this.gridObj.getRows().length) && this.fields.groupBy) {
1214
+ else if (e.action === 'moveDown' && (index >= 0 && index <= this.gridObj.getRows().length) && (this.fields.groupBy || isInputTarget)) {
1177
1215
  index += 1;
1178
1216
  }
1179
- else if (e.action === 'moveUp' && index > 0 && this.fields.groupBy) {
1217
+ else if (e.action === 'moveUp' && index > 0 && (this.fields.groupBy) || isInputTarget) {
1180
1218
  index -= 1;
1181
1219
  }
1182
1220
  this.gridObj.selectRow(index);
@@ -1190,6 +1228,12 @@ var MultiColumnComboBox = /** @__PURE__ @class */ (function (_super) {
1190
1228
  }
1191
1229
  }
1192
1230
  };
1231
+ MultiColumnComboBox.prototype.updateClearIconState = function () {
1232
+ var clearIconEle = this.inputWrapper.querySelector('.e-clear-icon');
1233
+ if (clearIconEle) {
1234
+ clearIconEle.style.display = this.inputEle.value === '' ? 'none' : 'flex';
1235
+ }
1236
+ };
1193
1237
  /**
1194
1238
  * Sets the focus to the component for interaction.component for interaction.
1195
1239
  *
@@ -1201,12 +1245,8 @@ var MultiColumnComboBox = /** @__PURE__ @class */ (function (_super) {
1201
1245
  return;
1202
1246
  }
1203
1247
  addClass([this.inputWrapper], [INPUTFOCUS]);
1204
- this.inputWrapper.tabIndex = 0;
1205
- this.inputWrapper.focus();
1206
- var clearIconEle = this.inputWrapper.querySelector('.e-clear-icon');
1207
- if (clearIconEle && (this.value && this.value.toString() !== '' || this.text && this.text !== '')) {
1208
- clearIconEle.classList.remove('e-clear-icon-hide');
1209
- }
1248
+ this.inputEle.focus();
1249
+ this.updateClearIconState();
1210
1250
  this.trigger('focus', e);
1211
1251
  if (this.floatLabelType !== 'Never') {
1212
1252
  Input.calculateWidth(this.inputEle, this.inputWrapper);
@@ -1222,12 +1262,13 @@ var MultiColumnComboBox = /** @__PURE__ @class */ (function (_super) {
1222
1262
  if (this.disabled || this.readonly) {
1223
1263
  return;
1224
1264
  }
1225
- this.hidePopup(e);
1265
+ if (this.isPopupOpen) {
1266
+ this.hidePopup(e);
1267
+ }
1226
1268
  removeClass([this.inputWrapper], [INPUTFOCUS]);
1227
- this.inputWrapper.tabIndex = -1;
1228
1269
  var clearIconEle = this.inputWrapper.querySelector('.e-clear-icon');
1229
1270
  if (clearIconEle) {
1230
- clearIconEle.classList.add('e-clear-icon-hide');
1271
+ clearIconEle.style.display = 'none';
1231
1272
  }
1232
1273
  if (this.floatLabelType !== 'Never') {
1233
1274
  Input.calculateWidth(this.inputEle, this.inputWrapper);
@@ -1258,6 +1299,16 @@ var MultiColumnComboBox = /** @__PURE__ @class */ (function (_super) {
1258
1299
  }
1259
1300
  _this.focusIn(e);
1260
1301
  }
1302
+ var contentEle = _this.gridObj.getContent();
1303
+ if (contentEle) {
1304
+ var activeRow = contentEle.querySelector('.e-rowcell.e-active');
1305
+ if (activeRow) {
1306
+ _this.inputEle.setAttribute('aria-activedescendant', activeRow.parentElement.getAttribute('data-uid'));
1307
+ }
1308
+ else if (contentEle.querySelector('.e-row')) {
1309
+ _this.inputEle.setAttribute('aria-activedescendant', contentEle.querySelector('.e-row').getAttribute('data-uid'));
1310
+ }
1311
+ }
1261
1312
  _this.popupObj.show(new Animation(eventArgs.animation), _this.popupEle);
1262
1313
  }
1263
1314
  });
@@ -1281,16 +1332,18 @@ var MultiColumnComboBox = /** @__PURE__ @class */ (function (_super) {
1281
1332
  _this.inputEle.value = _this.text ? _this.text.toString() : '';
1282
1333
  if (e) {
1283
1334
  var target = e.target;
1284
- if (target.classList.contains('e-multicolumn-list-icon') || target.classList.contains('e-rowcell')) {
1335
+ if (target && (target.classList.contains('e-multicolumn-list-icon') || target.classList.contains('e-rowcell'))) {
1285
1336
  if (!_this.value) {
1286
1337
  _this.gridObj.refreshColumns();
1287
1338
  }
1288
- _this.focusIn(e);
1339
+ setTimeout(function () { _this.focusIn(e); });
1289
1340
  }
1290
1341
  else {
1291
1342
  _this.focusOut();
1292
1343
  }
1293
1344
  }
1345
+ _this.inputEle.removeAttribute('aria-owns');
1346
+ _this.inputEle.removeAttribute('aria-activedescendant');
1294
1347
  }
1295
1348
  });
1296
1349
  setTimeout(function () {
@@ -1355,18 +1408,23 @@ var MultiColumnComboBox = /** @__PURE__ @class */ (function (_super) {
1355
1408
  this.gridObj.destroy();
1356
1409
  detach(this.gridObj.element);
1357
1410
  }
1358
- if (this.popupObj) {
1359
- this.popupObj.destroy();
1360
- detach(this.popupObj.element);
1361
- }
1362
1411
  if (this.inputEle) {
1363
- var attrArray = ['placeholder', 'aria-expanded', 'spellcheck', 'aria-label', 'role', 'tabindex', 'type', 'id', 'aria-owns', 'aria-controls'];
1412
+ var attrArray = ['placeholder', 'aria-expanded', 'spellcheck', 'aria-label', 'role', 'type',
1413
+ 'aria-owns', 'aria-controls', 'aria-readonly', 'autocomplete', 'autocapitalize', 'spellcheck', 'aria-activedescendant'];
1364
1414
  for (var i = 0; i < attrArray.length; i++) {
1365
1415
  this.inputEle.removeAttribute(attrArray[i]);
1366
1416
  }
1367
1417
  this.inputEle.classList.remove('e-input');
1368
1418
  Input.setValue('', this.inputEle, this.floatLabelType, this.showClearButton);
1369
1419
  }
1420
+ if (this.popupEle) {
1421
+ this.popupEle.removeAttribute('aria-label');
1422
+ this.popupEle.removeAttribute('role');
1423
+ }
1424
+ if (this.popupObj) {
1425
+ this.popupObj.destroy();
1426
+ detach(this.popupObj.element);
1427
+ }
1370
1428
  if (this.element.tagName !== this.getDirective()) {
1371
1429
  this.inputWrapper.parentElement.insertBefore(this.element, this.inputWrapper);
1372
1430
  }