@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.
@@ -325,6 +325,10 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
325
325
  // eslint-enable @typescript-eslint/no-explicit-any
326
326
  getGridColumns() {
327
327
  return this.columns.map((column) => {
328
+ let changeType;
329
+ if (column.displayAsCheckBox && !column.format) {
330
+ changeType = 'boolean';
331
+ }
328
332
  return {
329
333
  field: column.field,
330
334
  headerText: column.header,
@@ -335,7 +339,7 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
335
339
  template: column.template,
336
340
  headerTemplate: column.headerTemplate,
337
341
  customAttributes: column.customAttributes,
338
- type: column.displayAsCheckBox ? 'boolean' : 'string'
342
+ type: changeType
339
343
  };
340
344
  });
341
345
  }
@@ -374,6 +378,13 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
374
378
  this.popupDiv.removeChild(noRecordEle);
375
379
  }
376
380
  }
381
+ if (this.isInitialRender) {
382
+ const rowHeight = !this.popupDiv.classList.contains(NODATA) ? this.popupDiv.querySelector('.e-gridcontent tr').getBoundingClientRect().height : this.popupDiv.getBoundingClientRect().height;
383
+ this.popupRowHeight = rowHeight;
384
+ this.popupObj.hide();
385
+ this.popupEle.style.visibility = 'unset';
386
+ this.isInitialRender = false;
387
+ }
377
388
  }
378
389
  onActionFailure(args) {
379
390
  this.trigger('actionFailure', args);
@@ -392,6 +403,9 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
392
403
  this.inputEle.setAttribute('aria-expanded', 'false');
393
404
  this.inputEle.setAttribute('aria-readOnly', this.readonly.toString());
394
405
  this.inputEle.setAttribute('aria-disabled', this.disabled.toString());
406
+ this.inputEle.setAttribute('autocomplete', 'off');
407
+ this.inputEle.setAttribute('autocapitalize', 'off');
408
+ this.inputEle.setAttribute('spellcheck', 'false');
395
409
  this.inputEle.setAttribute('tabindex', '0');
396
410
  }
397
411
  else {
@@ -599,9 +613,9 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
599
613
  popupHeight = formatUnit(parseInt(popupHeight, 10) - height + 'px');
600
614
  }
601
615
  this.popupDiv.style.maxHeight = popupHeight;
602
- this.popupRowHeight = this.popupDiv.querySelector('.e-gridcontent tr').getBoundingClientRect().height;
603
616
  this.updateGridHeight();
604
- this.popupObj.hide();
617
+ this.popupEle.style.visibility = 'hidden';
618
+ this.isInitialRender = true;
605
619
  }
606
620
  updateGridHeight(isFilter, autoHeight, dataSourceCount) {
607
621
  let height;
@@ -635,6 +649,10 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
635
649
  if (!Browser.isDevice) {
636
650
  this.hidePopup();
637
651
  }
652
+ },
653
+ open: () => {
654
+ this.inputEle.focus();
655
+ this.updateClearIconState();
638
656
  }
639
657
  });
640
658
  }
@@ -742,8 +760,8 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
742
760
  cancel: false
743
761
  };
744
762
  const selectedRecords = this.gridObj.getSelectedRecords()[0];
745
- const fieldText = selectedRecords ? selectedRecords[this.fields.text].toString() : "";
746
- const fieldValue = selectedRecords ? selectedRecords[this.fields.value].toString() : "";
763
+ const fieldText = selectedRecords ? selectedRecords[this.fields.text].toString() : '';
764
+ const fieldValue = selectedRecords ? selectedRecords[this.fields.value].toString() : '';
747
765
  const ChangeEventArgs = {
748
766
  isInteracted: e ? true : false,
749
767
  item: selectedRecords,
@@ -758,11 +776,13 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
758
776
  this.trigger('select', eventArgs, (eventArgs) => {
759
777
  if (!eventArgs.cancel && eventArgs.itemData) {
760
778
  const selectedRecord = eventArgs.itemData;
761
- if (!isKeyNav || (isKeyNav && e.key === 'Enter')) {
779
+ const event = e;
780
+ const isUpdateVal = event.key === 'Enter' || event.key === 'Tab' || event.shiftKey && event.key === 'Tab' || event.altKey && event.key === 'ArrowUp';
781
+ if (!isKeyNav || (isKeyNav && isUpdateVal)) {
762
782
  this.updateValues(selectedRecord[this.fields.value], selectedRecord[this.fields.text], this.gridObj.selectedRowIndex, ChangeEventArgs);
763
783
  }
764
784
  Input.setValue(selectedRecord[this.fields.text], this.inputEle, this.floatLabelType, this.showClearButton);
765
- if (!isKeyNav || (isKeyNav && e.key === 'Enter')) {
785
+ if (!isKeyNav || (isKeyNav && isUpdateVal)) {
766
786
  this.hidePopup(e);
767
787
  }
768
788
  }
@@ -789,6 +809,7 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
789
809
  }
790
810
  inputHandler(e) {
791
811
  this.showPopup(null, true);
812
+ this.updateClearIconState();
792
813
  if (this.allowFiltering) {
793
814
  const inputValue = e.target.value.toLowerCase();
794
815
  let customFiltering = false;
@@ -901,15 +922,16 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
901
922
  this.updateGridHeight(true, autoHeight, dataSource.length);
902
923
  }
903
924
  wireEvents() {
904
- const ddbIcon = this.inputWrapper.querySelector('.e-input-group-icon');
905
- const clearIcon = this.inputWrapper.querySelector('.e-clear-icon');
906
- EventHandler.add(ddbIcon, 'mousedown', this.dropDownClick, this);
925
+ if (!isNullOrUndefined(this.inputObj.buttons[0])) {
926
+ EventHandler.add(this.inputObj.buttons[0], 'mousedown', this.preventBlur, this);
927
+ EventHandler.add(this.inputObj.buttons[0], 'mousedown', this.dropDownClick, this);
928
+ }
907
929
  EventHandler.add(document, 'mousedown', this.onDocumentClick, this);
908
930
  EventHandler.add(this.gridEle, 'click', this.onMouseClick, this);
909
931
  EventHandler.add(this.inputEle, 'input', this.inputHandler, this);
910
- EventHandler.add(this.inputWrapper, 'focus', this.focusIn, this);
911
- if (clearIcon) {
912
- EventHandler.add(clearIcon, 'click', this.clearText, this);
932
+ EventHandler.add(this.inputEle, 'focus', this.focusIn, this);
933
+ if (this.showClearButton) {
934
+ EventHandler.add(this.inputObj.clearButton, 'mousedown', this.clearText, this);
913
935
  }
914
936
  EventHandler.add(window, 'resize', this.windowResize, this);
915
937
  this.keyboardModule = new KeyboardEvents(this.inputWrapper, {
@@ -924,21 +946,25 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
924
946
  });
925
947
  }
926
948
  unWireEvents() {
927
- const ddbIcon = this.inputWrapper.querySelector('.e-input-group-icon');
928
- const clearIcon = this.inputWrapper.querySelector('.e-clear-icon');
929
- EventHandler.remove(ddbIcon, 'mousedown', this.dropDownClick);
949
+ if (!isNullOrUndefined(this.inputObj.buttons[0])) {
950
+ EventHandler.remove(this.inputObj.buttons[0], 'mousedown', this.preventBlur);
951
+ EventHandler.remove(this.inputObj.buttons[0], 'mousedown', this.dropDownClick);
952
+ }
930
953
  EventHandler.remove(document, 'mousedown', this.onDocumentClick);
931
954
  EventHandler.remove(this.inputEle, 'input', this.inputHandler);
932
955
  EventHandler.remove(this.inputWrapper, 'focus', this.focusIn);
933
956
  EventHandler.remove(window, 'resize', this.windowResize);
934
957
  EventHandler.remove(this.gridEle, 'click', this.onMouseClick);
935
- if (clearIcon) {
936
- EventHandler.remove(clearIcon, 'click', this.clearText);
958
+ if (this.showClearButton) {
959
+ EventHandler.remove(this.inputObj.clearButton, 'mousedown', this.clearText);
937
960
  }
938
961
  if (this.keyboardModule) {
939
962
  this.keyboardModule.destroy();
940
963
  }
941
964
  }
965
+ preventBlur(e) {
966
+ e.preventDefault();
967
+ }
942
968
  dropDownClick(e) {
943
969
  if (this.disabled || this.readonly) {
944
970
  return;
@@ -985,9 +1011,6 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
985
1011
  this.updateValuesOnInput(e);
986
1012
  }
987
1013
  }
988
- if (!closest(target, '.e-multicolumn-list')) {
989
- this.inputWrapper.tabIndex = -1;
990
- }
991
1014
  }
992
1015
  updateValuesOnInput(mouseEvent, keyEvent, isClearValues) {
993
1016
  const e = mouseEvent ? mouseEvent : keyEvent;
@@ -1061,6 +1084,9 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
1061
1084
  if (this.isPopupOpen) {
1062
1085
  this.hidePopup(e);
1063
1086
  }
1087
+ else {
1088
+ this.focusOut();
1089
+ }
1064
1090
  break;
1065
1091
  case 'altDown':
1066
1092
  if (!this.isPopupOpen) {
@@ -1070,7 +1096,7 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
1070
1096
  break;
1071
1097
  case 'moveDown':
1072
1098
  case 'moveUp':
1073
- this.updateSelectedItem(e);
1099
+ this.updateSelectedItem(e, true, true);
1074
1100
  break;
1075
1101
  case 'enter':
1076
1102
  this.updateValuesOnInput(null, e);
@@ -1096,6 +1122,15 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
1096
1122
  else if (e.key === 'Home') {
1097
1123
  e.action = 'home';
1098
1124
  }
1125
+ else if (e.key === 'Tab') {
1126
+ e.action = 'tab';
1127
+ }
1128
+ else if (e.key === 'Escape') {
1129
+ e.action = 'escape';
1130
+ }
1131
+ if (e.shiftKey && e.key === 'Tab') {
1132
+ e.action = 'shiftTab';
1133
+ }
1099
1134
  if (e.altKey && e.key === 'ArrowUp') {
1100
1135
  e.action = 'altUp';
1101
1136
  }
@@ -1107,6 +1142,9 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
1107
1142
  case 'altUp':
1108
1143
  if (this.isPopupOpen) {
1109
1144
  e.preventDefault();
1145
+ if (e.action !== 'escape') {
1146
+ this.updateSelectedItem(e);
1147
+ }
1110
1148
  this.hidePopup(e);
1111
1149
  }
1112
1150
  break;
@@ -1118,7 +1156,7 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
1118
1156
  break;
1119
1157
  }
1120
1158
  }
1121
- updateSelectedItem(e, isUpdateIndex = true) {
1159
+ updateSelectedItem(e, isUpdateIndex = true, isInputTarget) {
1122
1160
  if (this.isPopupOpen) {
1123
1161
  let index = !this.fields.groupBy ? this.gridObj.selectedRowIndex : this.gridObj.selectedRowIndex ? this.gridObj.selectedRowIndex : 0;
1124
1162
  if ((index === -1 && (e.action === 'moveDown' || e.action === 'moveUp')) || (e.action === 'home')) {
@@ -1127,10 +1165,10 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
1127
1165
  else if ((index >= this.gridObj.getRows().length && e.action === 'moveDown') || (e.action === 'end')) {
1128
1166
  index = this.gridObj.getRows().length - 1;
1129
1167
  }
1130
- else if (e.action === 'moveDown' && (index >= 0 && index <= this.gridObj.getRows().length) && this.fields.groupBy) {
1168
+ else if (e.action === 'moveDown' && (index >= 0 && index <= this.gridObj.getRows().length) && (this.fields.groupBy || isInputTarget)) {
1131
1169
  index += 1;
1132
1170
  }
1133
- else if (e.action === 'moveUp' && index > 0 && this.fields.groupBy) {
1171
+ else if (e.action === 'moveUp' && index > 0 && (this.fields.groupBy) || isInputTarget) {
1134
1172
  index -= 1;
1135
1173
  }
1136
1174
  this.gridObj.selectRow(index);
@@ -1144,6 +1182,12 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
1144
1182
  }
1145
1183
  }
1146
1184
  }
1185
+ updateClearIconState() {
1186
+ const clearIconEle = this.inputWrapper.querySelector('.e-clear-icon');
1187
+ if (clearIconEle) {
1188
+ clearIconEle.style.display = this.inputEle.value === '' ? 'none' : 'flex';
1189
+ }
1190
+ }
1147
1191
  /**
1148
1192
  * Sets the focus to the component for interaction.component for interaction.
1149
1193
  *
@@ -1155,12 +1199,8 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
1155
1199
  return;
1156
1200
  }
1157
1201
  addClass([this.inputWrapper], [INPUTFOCUS]);
1158
- this.inputWrapper.tabIndex = 0;
1159
- this.inputWrapper.focus();
1160
- const clearIconEle = this.inputWrapper.querySelector('.e-clear-icon');
1161
- if (clearIconEle && (this.value && this.value.toString() !== '' || this.text && this.text !== '')) {
1162
- clearIconEle.classList.remove('e-clear-icon-hide');
1163
- }
1202
+ this.inputEle.focus();
1203
+ this.updateClearIconState();
1164
1204
  this.trigger('focus', e);
1165
1205
  if (this.floatLabelType !== 'Never') {
1166
1206
  Input.calculateWidth(this.inputEle, this.inputWrapper);
@@ -1176,12 +1216,13 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
1176
1216
  if (this.disabled || this.readonly) {
1177
1217
  return;
1178
1218
  }
1179
- this.hidePopup(e);
1219
+ if (this.isPopupOpen) {
1220
+ this.hidePopup(e);
1221
+ }
1180
1222
  removeClass([this.inputWrapper], [INPUTFOCUS]);
1181
- this.inputWrapper.tabIndex = -1;
1182
1223
  const clearIconEle = this.inputWrapper.querySelector('.e-clear-icon');
1183
1224
  if (clearIconEle) {
1184
- clearIconEle.classList.add('e-clear-icon-hide');
1225
+ clearIconEle.style.display = 'none';
1185
1226
  }
1186
1227
  if (this.floatLabelType !== 'Never') {
1187
1228
  Input.calculateWidth(this.inputEle, this.inputWrapper);
@@ -1211,6 +1252,16 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
1211
1252
  }
1212
1253
  this.focusIn(e);
1213
1254
  }
1255
+ const contentEle = this.gridObj.getContent();
1256
+ if (contentEle) {
1257
+ const activeRow = contentEle.querySelector('.e-rowcell.e-active');
1258
+ if (activeRow) {
1259
+ this.inputEle.setAttribute('aria-activedescendant', activeRow.parentElement.getAttribute('data-uid'));
1260
+ }
1261
+ else if (contentEle.querySelector('.e-row')) {
1262
+ this.inputEle.setAttribute('aria-activedescendant', contentEle.querySelector('.e-row').getAttribute('data-uid'));
1263
+ }
1264
+ }
1214
1265
  this.popupObj.show(new Animation(eventArgs.animation), this.popupEle);
1215
1266
  }
1216
1267
  });
@@ -1233,16 +1284,18 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
1233
1284
  this.inputEle.value = this.text ? this.text.toString() : '';
1234
1285
  if (e) {
1235
1286
  const target = e.target;
1236
- if (target.classList.contains('e-multicolumn-list-icon') || target.classList.contains('e-rowcell')) {
1287
+ if (target && (target.classList.contains('e-multicolumn-list-icon') || target.classList.contains('e-rowcell'))) {
1237
1288
  if (!this.value) {
1238
1289
  this.gridObj.refreshColumns();
1239
1290
  }
1240
- this.focusIn(e);
1291
+ setTimeout(() => { this.focusIn(e); });
1241
1292
  }
1242
1293
  else {
1243
1294
  this.focusOut();
1244
1295
  }
1245
1296
  }
1297
+ this.inputEle.removeAttribute('aria-owns');
1298
+ this.inputEle.removeAttribute('aria-activedescendant');
1246
1299
  }
1247
1300
  });
1248
1301
  setTimeout(() => {
@@ -1306,18 +1359,23 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
1306
1359
  this.gridObj.destroy();
1307
1360
  detach(this.gridObj.element);
1308
1361
  }
1309
- if (this.popupObj) {
1310
- this.popupObj.destroy();
1311
- detach(this.popupObj.element);
1312
- }
1313
1362
  if (this.inputEle) {
1314
- const attrArray = ['placeholder', 'aria-expanded', 'spellcheck', 'aria-label', 'role', 'tabindex', 'type', 'id', 'aria-owns', 'aria-controls'];
1363
+ const attrArray = ['placeholder', 'aria-expanded', 'spellcheck', 'aria-label', 'role', 'type',
1364
+ 'aria-owns', 'aria-controls', 'aria-readonly', 'autocomplete', 'autocapitalize', 'spellcheck', 'aria-activedescendant'];
1315
1365
  for (let i = 0; i < attrArray.length; i++) {
1316
1366
  this.inputEle.removeAttribute(attrArray[i]);
1317
1367
  }
1318
1368
  this.inputEle.classList.remove('e-input');
1319
1369
  Input.setValue('', this.inputEle, this.floatLabelType, this.showClearButton);
1320
1370
  }
1371
+ if (this.popupEle) {
1372
+ this.popupEle.removeAttribute('aria-label');
1373
+ this.popupEle.removeAttribute('role');
1374
+ }
1375
+ if (this.popupObj) {
1376
+ this.popupObj.destroy();
1377
+ detach(this.popupObj.element);
1378
+ }
1321
1379
  if (this.element.tagName !== this.getDirective()) {
1322
1380
  this.inputWrapper.parentElement.insertBefore(this.element, this.inputWrapper);
1323
1381
  }