@syncfusion/ej2-multicolumn-combobox 27.2.5 → 28.1.33

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.
Files changed (89) hide show
  1. package/README.md +2 -2
  2. package/dist/ej2-multicolumn-combobox.umd.min.js +3 -3
  3. package/dist/ej2-multicolumn-combobox.umd.min.js.map +1 -1
  4. package/dist/es6/ej2-multicolumn-combobox.es2015.js +210 -177
  5. package/dist/es6/ej2-multicolumn-combobox.es2015.js.map +1 -1
  6. package/dist/es6/ej2-multicolumn-combobox.es5.js +251 -178
  7. package/dist/es6/ej2-multicolumn-combobox.es5.js.map +1 -1
  8. package/dist/global/ej2-multicolumn-combobox.min.js +3 -3
  9. package/dist/global/ej2-multicolumn-combobox.min.js.map +1 -1
  10. package/dist/global/index.d.ts +2 -2
  11. package/package.json +8 -8
  12. package/src/global.js +0 -2
  13. package/src/multicolumn-combobox/index.d.ts +0 -1
  14. package/src/multicolumn-combobox/index.js +0 -1
  15. package/src/multicolumn-combobox/multi-column-combo-box-model.d.ts +1 -1
  16. package/src/multicolumn-combobox/multi-column-combo-box.d.ts +5 -0
  17. package/src/multicolumn-combobox/multi-column-combo-box.js +253 -179
  18. package/styles/bds-lite.css +416 -0
  19. package/styles/bds-lite.scss +10 -0
  20. package/styles/bds.css +467 -0
  21. package/styles/bds.scss +11 -0
  22. package/styles/bootstrap-dark-lite.css +3 -0
  23. package/styles/bootstrap-dark.css +3 -0
  24. package/styles/bootstrap-lite.css +3 -0
  25. package/styles/bootstrap.css +3 -0
  26. package/styles/bootstrap4-lite.css +3 -0
  27. package/styles/bootstrap4.css +3 -0
  28. package/styles/bootstrap5-dark-lite.css +3 -0
  29. package/styles/bootstrap5-dark.css +3 -0
  30. package/styles/bootstrap5-lite.css +3 -0
  31. package/styles/bootstrap5.3-lite.css +3 -0
  32. package/styles/bootstrap5.3.css +3 -0
  33. package/styles/bootstrap5.css +3 -0
  34. package/styles/fabric-dark-lite.css +3 -0
  35. package/styles/fabric-dark.css +3 -0
  36. package/styles/fabric-lite.css +3 -0
  37. package/styles/fabric.css +3 -0
  38. package/styles/fluent-dark-lite.css +3 -0
  39. package/styles/fluent-dark.css +3 -0
  40. package/styles/fluent-lite.css +3 -0
  41. package/styles/fluent.css +3 -0
  42. package/styles/fluent2-lite.css +3 -0
  43. package/styles/fluent2.css +3 -0
  44. package/styles/highcontrast-light-lite.css +3 -0
  45. package/styles/highcontrast-light.css +3 -0
  46. package/styles/highcontrast-lite.css +4 -1
  47. package/styles/highcontrast.css +4 -1
  48. package/styles/material-dark-lite.css +3 -0
  49. package/styles/material-dark.css +3 -0
  50. package/styles/material-lite.css +3 -0
  51. package/styles/material.css +3 -0
  52. package/styles/material3-dark-lite.css +3 -0
  53. package/styles/material3-dark.css +3 -0
  54. package/styles/material3-lite.css +3 -0
  55. package/styles/material3.css +3 -0
  56. package/styles/multicolumn-combobox/_layout.scss +3 -0
  57. package/styles/multicolumn-combobox/_tailwind3-definition.scss +32 -0
  58. package/styles/multicolumn-combobox/bds.css +467 -0
  59. package/styles/multicolumn-combobox/bds.scss +11 -0
  60. package/styles/multicolumn-combobox/bootstrap-dark.css +3 -0
  61. package/styles/multicolumn-combobox/bootstrap.css +3 -0
  62. package/styles/multicolumn-combobox/bootstrap4.css +3 -0
  63. package/styles/multicolumn-combobox/bootstrap5-dark.css +3 -0
  64. package/styles/multicolumn-combobox/bootstrap5.3.css +3 -0
  65. package/styles/multicolumn-combobox/bootstrap5.css +3 -0
  66. package/styles/multicolumn-combobox/fabric-dark.css +3 -0
  67. package/styles/multicolumn-combobox/fabric.css +3 -0
  68. package/styles/multicolumn-combobox/fluent-dark.css +3 -0
  69. package/styles/multicolumn-combobox/fluent.css +3 -0
  70. package/styles/multicolumn-combobox/fluent2.css +3 -0
  71. package/styles/multicolumn-combobox/highcontrast-light.css +3 -0
  72. package/styles/multicolumn-combobox/highcontrast.css +4 -1
  73. package/styles/multicolumn-combobox/icons/_tailwind3.scss +6 -0
  74. package/styles/multicolumn-combobox/material-dark.css +3 -0
  75. package/styles/multicolumn-combobox/material.css +3 -0
  76. package/styles/multicolumn-combobox/material3-dark.css +3 -0
  77. package/styles/multicolumn-combobox/material3.css +3 -0
  78. package/styles/multicolumn-combobox/tailwind-dark.css +3 -0
  79. package/styles/multicolumn-combobox/tailwind.css +3 -0
  80. package/styles/multicolumn-combobox/tailwind3.css +375 -0
  81. package/styles/multicolumn-combobox/tailwind3.scss +11 -0
  82. package/styles/tailwind-dark-lite.css +3 -0
  83. package/styles/tailwind-dark.css +3 -0
  84. package/styles/tailwind-lite.css +3 -0
  85. package/styles/tailwind.css +3 -0
  86. package/styles/tailwind3-lite.css +324 -0
  87. package/styles/tailwind3-lite.scss +10 -0
  88. package/styles/tailwind3.css +375 -0
  89. package/styles/tailwind3.scss +11 -0
@@ -17,7 +17,42 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
17
17
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
18
18
  return c > 3 && r && Object.defineProperty(target, key, r), r;
19
19
  };
20
- import { Component, EventHandler, Property, NotifyPropertyChanges, closest, attributes, append, compile, detach, KeyboardEvents, isNullOrUndefined } from '@syncfusion/ej2-base';
20
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
21
+ return new (P || (P = Promise))(function (resolve, reject) {
22
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
23
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
24
+ function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
25
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
26
+ });
27
+ };
28
+ var __generator = (this && this.__generator) || function (thisArg, body) {
29
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
30
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
31
+ function verb(n) { return function (v) { return step([n, v]); }; }
32
+ function step(op) {
33
+ if (f) throw new TypeError("Generator is already executing.");
34
+ while (_) try {
35
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
36
+ if (y = 0, t) op = [op[0] & 2, t.value];
37
+ switch (op[0]) {
38
+ case 0: case 1: t = op; break;
39
+ case 4: _.label++; return { value: op[1], done: false };
40
+ case 5: _.label++; y = op[1]; op = [0]; continue;
41
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
42
+ default:
43
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
44
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
45
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
46
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
47
+ if (t[2]) _.ops.pop();
48
+ _.trys.pop(); continue;
49
+ }
50
+ op = body.call(thisArg, _);
51
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
52
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
53
+ }
54
+ };
55
+ import { Component, EventHandler, Property, NotifyPropertyChanges, closest, attributes, append, compile, detach, KeyboardEvents } from '@syncfusion/ej2-base';
21
56
  import { ChildProperty, prepend, Collection, getUniqueID, Complex, isNullOrUndefined as isNOU, select, L10n, Browser } from '@syncfusion/ej2-base';
22
57
  import { formatUnit, addClass, removeClass, Event, Animation } from '@syncfusion/ej2-base';
23
58
  import { Input } from '@syncfusion/ej2-inputs';
@@ -260,7 +295,7 @@ var MultiColumnComboBox = /** @class */ (function (_super) {
260
295
  moveDown: 'downarrow',
261
296
  moveUp: 'uparrow'
262
297
  };
263
- this.matchedRowEle = this.matchedContent = null;
298
+ this.matchedRowEle = this.matchedContent = this.exactMatchedContent = null;
264
299
  this.persistData();
265
300
  };
266
301
  MultiColumnComboBox.prototype.getDirective = function () {
@@ -286,7 +321,7 @@ var MultiColumnComboBox = /** @class */ (function (_super) {
286
321
  };
287
322
  MultiColumnComboBox.prototype.persistData = function () {
288
323
  if (this.enablePersistence) {
289
- this.element.id = this.element.id + '_wrapper';
324
+ this.element.id += '_wrapper';
290
325
  var data = window.localStorage.getItem(this.getModuleName() + this.element.id);
291
326
  if (!(isNOU(data) || (data === ''))) {
292
327
  this.setProperties(JSON.parse(data), true);
@@ -305,6 +340,7 @@ var MultiColumnComboBox = /** @class */ (function (_super) {
305
340
  MultiColumnComboBox.prototype.renderGrid = function () {
306
341
  var _this = this;
307
342
  var gridColumns = this.getGridColumns();
343
+ var sortOrder = this.sortOrder.toString().toLowerCase();
308
344
  this.gridObj = new Grid({
309
345
  dataSource: this.dataSource,
310
346
  columns: gridColumns,
@@ -327,22 +363,7 @@ var MultiColumnComboBox = /** @class */ (function (_super) {
327
363
  actionFailure: function (args) { _this.onActionFailure(args); },
328
364
  actionBegin: function (args) { _this.trigger('actionBegin', args); },
329
365
  actionComplete: this.handleActionComplete.bind(this),
330
- keyPressed: function (args) {
331
- if (args.key === 'Enter') {
332
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
333
- args.cancel = true;
334
- if (_this.isPopupOpen) {
335
- _this.selectedGridRow(_this.gridObj.getRows()[_this.gridObj.selectedRowIndex], args, true);
336
- _this.hidePopup(args);
337
- _this.focusIn(args);
338
- }
339
- }
340
- if (_this.fields.groupBy) {
341
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
342
- args.cancel = true;
343
- _this.gridKeyActionHandler(args, true);
344
- }
345
- },
366
+ keyPressed: this.handleKeyPressed.bind(this),
346
367
  resizing: function (args) {
347
368
  if (_this.gridSettings.resizing) {
348
369
  _this.gridSettings.resizing.call(_this, args);
@@ -361,7 +382,6 @@ var MultiColumnComboBox = /** @class */ (function (_super) {
361
382
  });
362
383
  this.gridEle = this.createElement('div', { id: getUniqueID('grid'), className: MULTICOLUMNGRID });
363
384
  this.updateGroupByField();
364
- var sortOrder = this.sortOrder.toString().toLowerCase();
365
385
  if (gridColumns.length > 0) {
366
386
  // Set first column as primary key to avoid PRIMARY KEY MISSING warning.
367
387
  this.gridObj.columns[0].isPrimaryKey = true;
@@ -380,25 +400,39 @@ var MultiColumnComboBox = /** @class */ (function (_super) {
380
400
  this.popupObj.refreshPosition();
381
401
  this.gridObj.element.querySelector('.e-content').scrollTop = 0;
382
402
  };
403
+ MultiColumnComboBox.prototype.handleKeyPressed = function (args) {
404
+ if (args.key === 'Enter') {
405
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
406
+ args.cancel = true;
407
+ if (this.isPopupOpen) {
408
+ this.selectedGridRow(this.gridObj.getRows()[this.gridObj.selectedRowIndex], args, true);
409
+ this.hidePopup(args);
410
+ this.focusIn(args);
411
+ }
412
+ }
413
+ if (this.fields.groupBy) {
414
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
415
+ args.cancel = true;
416
+ this.gridKeyActionHandler(args, true);
417
+ }
418
+ };
383
419
  /* eslint-disable @typescript-eslint/no-explicit-any */
384
420
  MultiColumnComboBox.prototype.isRowMatching = function (data, selectedValue, selectedText) {
385
421
  var values = Object.values(data).map(String);
386
- var isRowPresent = values.includes(selectedValue) && values.includes(selectedText);
387
- return isRowPresent;
422
+ return values.includes(selectedValue) && values.includes(selectedText);
388
423
  };
389
424
  MultiColumnComboBox.prototype.updateRowSelection = function (args) {
390
425
  var _this = this;
391
426
  if (args) {
392
427
  var dataRows = args.rows;
393
428
  dataRows.forEach(function (row) {
394
- var data = row.data;
395
- var index = row.index;
396
- _this.selectDataRow(data, index);
429
+ _this.selectDataRow(row.data, row.index);
397
430
  });
398
431
  }
399
432
  };
400
433
  MultiColumnComboBox.prototype.selectDataRow = function (data, index) {
401
- var isPresent = this.isRowMatching(data, this.value ? this.value.toString() : '', this.text ? this.text.toString() : '');
434
+ var isPresent = this.isRowMatching(data, this.value ?
435
+ this.value.toString() : '', this.text ? this.text.toString() : '');
402
436
  if (isPresent) {
403
437
  this.gridObj.selectRow(index);
404
438
  var prevOnChange = this.isProtectedOnChange;
@@ -414,30 +448,28 @@ var MultiColumnComboBox = /** @class */ (function (_super) {
414
448
  return Object.keys(obj).every(function (key) { return item[key] === obj[key]; });
415
449
  });
416
450
  };
417
- /* eslint-enable @typescript-eslint/no-explicit-any */
418
451
  MultiColumnComboBox.prototype.getGridColumns = function () {
419
452
  var _this = this;
420
- return this.columns.map(function (column) {
421
- var changeType;
422
- if (column.displayAsCheckBox && !column.format) {
423
- changeType = 'boolean';
424
- }
425
- return {
426
- field: column.field,
427
- headerText: column.header,
428
- width: column.width,
429
- textAlign: column.textAlign === '' && _this.enableRtl ? 'Right' : column.textAlign,
430
- format: column.format,
431
- displayAsCheckBox: column.displayAsCheckBox,
432
- template: column.template,
433
- headerTemplate: column.headerTemplate,
434
- customAttributes: column.customAttributes,
435
- type: changeType
436
- };
453
+ return this.columns.map(function (_a) {
454
+ var field = _a.field, header = _a.header, width = _a.width, textAlign = _a.textAlign, format = _a.format, displayAsCheckBox = _a.displayAsCheckBox, template = _a.template, headerTemplate = _a.headerTemplate, customAttributes = _a.customAttributes;
455
+ return ({
456
+ field: field,
457
+ headerText: header,
458
+ width: width,
459
+ textAlign: textAlign.toString() === '' && _this.enableRtl ? 'Right' : textAlign,
460
+ format: format,
461
+ displayAsCheckBox: displayAsCheckBox,
462
+ template: template,
463
+ headerTemplate: headerTemplate,
464
+ customAttributes: customAttributes,
465
+ type: displayAsCheckBox && !format ? 'boolean' : undefined
466
+ });
437
467
  });
438
468
  };
439
469
  MultiColumnComboBox.prototype.updateGroupByField = function () {
440
- if (this.fields.groupBy !== '' && !isNOU(this.fields.groupBy)) {
470
+ var groupByField = this.fields.groupBy;
471
+ var isGroupByValid = groupByField !== '' && !isNOU(groupByField);
472
+ if (isGroupByValid) {
441
473
  if (this.sortType.toString().toLowerCase() !== 'multiplecolumns') {
442
474
  this.gridEle.classList.add('e-multicolumn-group');
443
475
  }
@@ -446,10 +478,11 @@ var MultiColumnComboBox = /** @class */ (function (_super) {
446
478
  this.gridObj.allowGrouping = true;
447
479
  this.gridObj.groupSettings = {
448
480
  showDropArea: false,
449
- columns: [this.fields.groupBy],
450
- captionTemplate: (this.groupTemplate && this.fields.groupBy !== '' && !isNOU(this.fields.groupBy))
451
- ? this.groupTemplate : '${key}'
481
+ columns: [groupByField]
452
482
  };
483
+ if (this.groupTemplate && isGroupByValid) {
484
+ this.gridObj.groupSettings.captionTemplate = this.groupTemplate;
485
+ }
453
486
  if (this.isVue) {
454
487
  this.gridObj.isVue = this.isVue;
455
488
  }
@@ -459,12 +492,13 @@ var MultiColumnComboBox = /** @class */ (function (_super) {
459
492
  MultiColumnComboBox.prototype.onDataBound = function () {
460
493
  var dataCount = this.dataSource.length;
461
494
  var popupChild = this.popupDiv.querySelector('.' + MULTICOLUMNGRID);
495
+ var hasNoDataClass = this.popupDiv.classList.contains(NODATA);
462
496
  if (dataCount <= 0 && popupChild) {
463
497
  this.l10nUpdate();
464
498
  this.popupDiv.removeChild(this.gridEle);
465
499
  addClass([this.popupDiv], [NODATA]);
466
500
  }
467
- else if (this.popupDiv.classList.contains(NODATA) && dataCount >= 1) {
501
+ else if (hasNoDataClass && dataCount >= 1) {
468
502
  removeClass([this.popupDiv], [NODATA]);
469
503
  var noRecordEle = this.popupDiv.querySelector('.e-no-records');
470
504
  if (noRecordEle) {
@@ -472,8 +506,9 @@ var MultiColumnComboBox = /** @class */ (function (_super) {
472
506
  }
473
507
  }
474
508
  if (this.isInitialRender) {
475
- var rowHeight = !this.popupDiv.classList.contains(NODATA) ? this.popupDiv.querySelector('.e-gridcontent tr') ?
476
- this.popupDiv.querySelector('.e-gridcontent tr').getBoundingClientRect().height : 0 :
509
+ var gridContentRow = this.popupDiv.querySelector('.e-gridcontent tr');
510
+ var rowHeight = !hasNoDataClass ? gridContentRow ?
511
+ gridContentRow.getBoundingClientRect().height : 0 :
477
512
  this.popupDiv.getBoundingClientRect().height;
478
513
  this.popupRowHeight = rowHeight;
479
514
  this.popupObj.hide();
@@ -492,6 +527,16 @@ var MultiColumnComboBox = /** @class */ (function (_super) {
492
527
  addClass([this.popupDiv], [NODATA]);
493
528
  };
494
529
  MultiColumnComboBox.prototype.renderInput = function () {
530
+ var allowedAttributes = ['aria-expanded', 'aria-readOnly', 'aria-disabled', 'autocomplete',
531
+ 'autocapitalize', 'spellcheck', 'tabindex'];
532
+ var setAttributes = function (element, attributes) {
533
+ for (var key in attributes) {
534
+ // eslint-disable-next-line no-prototype-builtins
535
+ if (attributes.hasOwnProperty(key) && allowedAttributes.indexOf(key) !== -1 && isNOU(element.getAttribute(key))) {
536
+ element.setAttribute(key, attributes[key]);
537
+ }
538
+ }
539
+ };
495
540
  if (this.element.tagName === 'INPUT') {
496
541
  this.inputEle = this.element;
497
542
  if (isNOU(this.inputEle.getAttribute('role'))) {
@@ -500,13 +545,15 @@ var MultiColumnComboBox = /** @class */ (function (_super) {
500
545
  if (isNOU(this.inputEle.getAttribute('type'))) {
501
546
  this.inputEle.setAttribute('type', 'text');
502
547
  }
503
- this.inputEle.setAttribute('aria-expanded', 'false');
504
- this.inputEle.setAttribute('aria-readOnly', this.readonly.toString());
505
- this.inputEle.setAttribute('aria-disabled', this.disabled.toString());
506
- this.inputEle.setAttribute('autocomplete', 'off');
507
- this.inputEle.setAttribute('autocapitalize', 'off');
508
- this.inputEle.setAttribute('spellcheck', 'false');
509
- this.inputEle.setAttribute('tabindex', '0');
548
+ setAttributes(this.inputEle, {
549
+ 'aria-expanded': 'false',
550
+ 'aria-readOnly': this.readonly.toString(),
551
+ 'aria-disabled': this.disabled.toString(),
552
+ autocomplete: 'off',
553
+ autocapitalize: 'off',
554
+ spellcheck: 'false',
555
+ tabindex: '0'
556
+ });
510
557
  }
511
558
  else {
512
559
  this.inputEle = this.createElement('input', { attrs: { role: 'textbox', type: 'text' } });
@@ -536,49 +583,53 @@ var MultiColumnComboBox = /** @class */ (function (_super) {
536
583
  this.initValue(null, null, true);
537
584
  }
538
585
  };
539
- /* To calculate the width when change via set model */
540
586
  MultiColumnComboBox.prototype.setElementWidth = function (inputWidth) {
587
+ if (isNOU(inputWidth)) {
588
+ return;
589
+ }
541
590
  var ddElement = this.inputWrapper;
542
- if (!isNOU(inputWidth)) {
543
- if (typeof inputWidth === 'number') {
544
- ddElement.style.width = formatUnit(inputWidth);
545
- }
546
- else if (typeof inputWidth === 'string') {
547
- ddElement.style.width = (inputWidth.match(/px|%|em/)) ? (inputWidth) : (formatUnit(inputWidth));
548
- }
591
+ if (typeof inputWidth === 'number') {
592
+ ddElement.style.width = formatUnit(inputWidth);
593
+ }
594
+ else if (typeof inputWidth === 'string') {
595
+ ddElement.style.width = inputWidth.match(/px|%|em/) ? inputWidth : formatUnit(inputWidth);
549
596
  }
550
597
  };
551
598
  MultiColumnComboBox.prototype.setHTMLAttributes = function () {
552
- if (Object.keys(this.htmlAttributes).length) {
553
- for (var _i = 0, _a = Object.keys(this.htmlAttributes); _i < _a.length; _i++) {
599
+ var htmlAttributes = this.htmlAttributes;
600
+ var inputEle = this.inputEle;
601
+ if (Object.keys(htmlAttributes).length) {
602
+ for (var _i = 0, _a = Object.keys(htmlAttributes); _i < _a.length; _i++) {
554
603
  var htmlAttr = _a[_i];
555
- if (htmlAttr === 'class') {
556
- this.inputWrapper.classList.add(this.htmlAttributes["" + htmlAttr]);
557
- }
558
- else if (htmlAttr === 'disabled') {
559
- this.setProperties({ enabled: false }, true);
560
- this.setEnable();
561
- }
562
- else if (htmlAttr === 'readonly') {
563
- this.setProperties({ readonly: true }, true);
564
- this.dataBind();
565
- }
566
- else if (htmlAttr === 'style') {
567
- this.inputWrapper.setAttribute('style', this.htmlAttributes["" + htmlAttr]);
568
- }
569
- else {
570
- var defaultAttr = ['title', 'id', 'placeholder',
571
- 'role', 'autocomplete', 'autocapitalize', 'spellcheck', 'minlength', 'maxlength'];
572
- if (defaultAttr.indexOf(htmlAttr) > -1) {
573
- if (htmlAttr === 'placeholder') {
574
- Input.setPlaceholder(this.htmlAttributes["" + htmlAttr], this.inputEle);
604
+ switch (htmlAttr) {
605
+ case 'class':
606
+ this.inputWrapper.classList.add(htmlAttributes[htmlAttr]);
607
+ break;
608
+ case 'disabled':
609
+ this.setProperties({ enabled: false }, true);
610
+ this.setEnable();
611
+ break;
612
+ case 'readonly':
613
+ this.setProperties({ readonly: true }, true);
614
+ this.dataBind();
615
+ break;
616
+ case 'style':
617
+ this.inputWrapper.setAttribute('style', htmlAttributes[htmlAttr]);
618
+ break;
619
+ default: {
620
+ var defaultAttr = ['title', 'id', 'placeholder', 'role', 'autocomplete', 'autocapitalize', 'spellcheck', 'minlength', 'maxlength'];
621
+ if (defaultAttr.indexOf(htmlAttr) > -1) {
622
+ if (htmlAttr === 'placeholder') {
623
+ Input.setPlaceholder(htmlAttributes[htmlAttr], inputEle);
624
+ }
625
+ else {
626
+ inputEle.setAttribute(htmlAttr, htmlAttributes[htmlAttr]);
627
+ }
575
628
  }
576
629
  else {
577
- this.inputEle.setAttribute(htmlAttr, this.htmlAttributes["" + htmlAttr]);
630
+ inputEle.setAttribute(htmlAttr, htmlAttributes[htmlAttr]);
578
631
  }
579
- }
580
- else {
581
- this.inputEle.setAttribute(htmlAttr, this.htmlAttributes["" + htmlAttr]);
632
+ break;
582
633
  }
583
634
  }
584
635
  }
@@ -589,8 +640,7 @@ var MultiColumnComboBox = /** @class */ (function (_super) {
589
640
  Input.setEnabled(!this.disabled, this.inputEle);
590
641
  if (!this.disabled) {
591
642
  removeClass([this.inputWrapper], DISABLED);
592
- this.inputEle.setAttribute('aria-disabled', 'false');
593
- this.inputWrapper.setAttribute('aria-disabled', 'false');
643
+ this.setAriaDisabled('false');
594
644
  }
595
645
  else {
596
646
  if (this.isPopupOpen) {
@@ -600,10 +650,13 @@ var MultiColumnComboBox = /** @class */ (function (_super) {
600
650
  if (this.inputWrapper && this.inputWrapper.classList.contains(INPUTFOCUS)) {
601
651
  removeClass([this.inputWrapper], [INPUTFOCUS]);
602
652
  }
603
- this.inputEle.setAttribute('aria-disabled', 'true');
604
- this.inputWrapper.setAttribute('aria-disabled', 'true');
653
+ this.setAriaDisabled('true');
605
654
  }
606
655
  };
656
+ MultiColumnComboBox.prototype.setAriaDisabled = function (value) {
657
+ this.inputEle.setAttribute('aria-disabled', value);
658
+ this.inputWrapper.setAttribute('aria-disabled', value);
659
+ };
607
660
  MultiColumnComboBox.prototype.initValue = function (isRerender, isValue, isInitial) {
608
661
  var _this = this;
609
662
  var prevItemData = this.gridObj.getSelectedRecords()[0];
@@ -865,7 +918,7 @@ var MultiColumnComboBox = /** @class */ (function (_super) {
865
918
  MultiColumnComboBox.prototype.getSize = function (ispopupWidth) {
866
919
  var currentDimension = ispopupWidth ? this.popupWidth : this.popupHeight;
867
920
  var size = formatUnit(currentDimension);
868
- if (size.indexOf('%') > -1) {
921
+ if (size.includes('%')) {
869
922
  var dimensionValue = ispopupWidth ? this.inputWrapper.offsetWidth : document.documentElement.clientHeight;
870
923
  size = (dimensionValue * parseFloat(size) / 100).toString() + 'px';
871
924
  }
@@ -917,8 +970,8 @@ var MultiColumnComboBox = /** @class */ (function (_super) {
917
970
  this.previousItemElement = eventArgs.itemElement;
918
971
  var prevOnChange = this.isProtectedOnChange;
919
972
  this.isProtectedOnChange = true;
920
- this.text = text ? text : this.text;
921
- this.value = value ? value : this.value;
973
+ this.text = text || this.text;
974
+ this.value = value || this.value;
922
975
  this.index = !isNOU(index) ? index : this.index;
923
976
  this.isProtectedOnChange = prevOnChange;
924
977
  if (!isInitial) {
@@ -961,45 +1014,57 @@ var MultiColumnComboBox = /** @class */ (function (_super) {
961
1014
  this.updateInputValue(e.target.value);
962
1015
  };
963
1016
  MultiColumnComboBox.prototype.updateInputValue = function (inputValue) {
964
- var _this = this;
965
- var data;
966
- if (this.dataSource instanceof DataManager) {
967
- var query = new Query();
968
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
969
- this.dataSource.executeQuery(query).then(function (result) {
970
- var totaldata = result.result;
971
- data = totaldata.filter(function (item) {
972
- return item[_this.fields.text].toString().toLowerCase().startsWith(inputValue.toLowerCase());
973
- });
974
- _this.selectFilteredRows(data);
975
- });
976
- }
977
- else if (Array.isArray(this.dataSource)) {
978
- data = this.dataSource.filter(function (item) {
979
- return item[_this.fields.text].toString().toLowerCase().startsWith(inputValue.toLowerCase());
1017
+ return __awaiter(this, void 0, void 0, function () {
1018
+ var _a, _b, data, exactData, query, result, totaldata;
1019
+ return __generator(this, function (_c) {
1020
+ switch (_c.label) {
1021
+ case 0:
1022
+ if (!(this.dataSource instanceof DataManager)) return [3 /*break*/, 2];
1023
+ query = new Query();
1024
+ return [4 /*yield*/, this.dataSource.executeQuery(query)];
1025
+ case 1:
1026
+ result = _c.sent();
1027
+ totaldata = result.result;
1028
+ (_a = this.filterDatas(totaldata, inputValue), data = _a.data, exactData = _a.exactData);
1029
+ return [3 /*break*/, 3];
1030
+ case 2:
1031
+ if (Array.isArray(this.dataSource)) {
1032
+ (_b = this.filterDatas(this.dataSource, inputValue), data = _b.data, exactData = _b.exactData);
1033
+ }
1034
+ _c.label = 3;
1035
+ case 3:
1036
+ this.selectFilteredRows(data, exactData);
1037
+ return [2 /*return*/];
1038
+ }
980
1039
  });
981
- this.selectFilteredRows(data);
982
- }
1040
+ });
983
1041
  };
984
- MultiColumnComboBox.prototype.selectFilteredRows = function (data) {
985
- if (data.length > 0) {
986
- this.matchedContent = data[0];
987
- }
988
- else {
989
- this.matchedContent = null;
990
- }
991
- if (this.matchedContent) {
992
- var selectedIndex = this.findIndex(this.gridObj.currentViewData, this.matchedContent);
993
- this.matchedRowEle = this.gridObj.getRowByIndex(selectedIndex);
994
- }
995
- else {
996
- this.matchedRowEle = null;
1042
+ MultiColumnComboBox.prototype.filterDatas = function (dataSource, inputValue) {
1043
+ var _this = this;
1044
+ var data = dataSource.filter(function (item) {
1045
+ return item[_this.fields.text].toString().toLowerCase().startsWith(inputValue.toLowerCase());
1046
+ });
1047
+ var exactData = dataSource.filter(function (item) {
1048
+ return item[_this.fields.text].toString() === inputValue;
1049
+ });
1050
+ return { data: data, exactData: exactData };
1051
+ };
1052
+ MultiColumnComboBox.prototype.selectFilteredRows = function (data, exactData) {
1053
+ if (data.length <= 0) {
1054
+ this.matchedRowEle = this.matchedContent = this.exactMatchedContent = null;
1055
+ return;
997
1056
  }
1057
+ this.matchedContent = data[0];
1058
+ this.exactMatchedContent = exactData[0];
1059
+ var selectedIndex = this.findIndex(this.gridObj.currentViewData, this.matchedContent);
1060
+ this.matchedRowEle = this.gridObj.getRowByIndex(selectedIndex);
998
1061
  };
999
1062
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
1000
1063
  MultiColumnComboBox.prototype.filterAction = function (dataSource, inputValue, query, fields) {
1001
1064
  var _this = this;
1002
- if (isNullOrUndefined(query) && isNullOrUndefined(fields)) {
1065
+ var isQuery = query || new Query();
1066
+ var filterType = this.filterType.toString().toLowerCase();
1067
+ if (isNOU(query) && isNOU(fields)) {
1003
1068
  this.updateGridDataSource(dataSource);
1004
1069
  }
1005
1070
  else if (query) {
@@ -1015,14 +1080,12 @@ var MultiColumnComboBox = /** @class */ (function (_super) {
1015
1080
  }
1016
1081
  }
1017
1082
  else {
1018
- var isQuery = query || new Query();
1019
1083
  if (dataSource instanceof DataManager) {
1020
1084
  this.filteringHandler(dataSource, inputValue, isQuery, fields);
1021
1085
  }
1022
1086
  else if (Array.isArray(dataSource)) {
1023
- var filterType_1 = this.filterType.toString().toLowerCase();
1024
1087
  var filteredData = dataSource.filter(function (item) {
1025
- return _this.filterData(item, filterType_1, inputValue, fields);
1088
+ return _this.filterData(item, filterType, inputValue, fields);
1026
1089
  });
1027
1090
  this.updateGridDataSource(filteredData);
1028
1091
  }
@@ -1149,28 +1212,36 @@ var MultiColumnComboBox = /** @class */ (function (_super) {
1149
1212
  }
1150
1213
  };
1151
1214
  MultiColumnComboBox.prototype.onDocumentClick = function (e) {
1215
+ var target = e.target;
1152
1216
  if (this.disabled || this.readonly || !this.isPopupOpen) {
1153
- if (!(e.target.closest('.e-multicolumn-list'))) {
1217
+ if (!target.closest('.e-multicolumn-list')) {
1154
1218
  this.focusOut();
1155
1219
  }
1156
1220
  return;
1157
1221
  }
1158
- var target = e.target;
1159
1222
  if ((target.classList.contains('e-multicolumn-list-icon') || closest(target, '.e-popup'))) {
1160
1223
  e.preventDefault();
1161
1224
  }
1162
1225
  else {
1163
1226
  if (!target.classList.contains('e-multicolumncombobox') && !target.classList.contains('e-clear-icon')) {
1227
+ if (!isNOU(this.text)) {
1228
+ this.updateInputValue(this.text);
1229
+ }
1164
1230
  this.updateValuesOnInput(e);
1165
1231
  }
1166
1232
  }
1167
1233
  };
1168
- MultiColumnComboBox.prototype.updateValuesOnInput = function (mouseEvent, keyEvent, isClearValues) {
1234
+ MultiColumnComboBox.prototype.updateValuesOnInput = function (mouseEvent, keyEvent, isClearValues, isKeyDown) {
1169
1235
  var _this = this;
1170
1236
  if (isClearValues === void 0) { isClearValues = false; }
1237
+ if (isKeyDown === void 0) { isKeyDown = false; }
1171
1238
  var e = mouseEvent ? mouseEvent : keyEvent;
1239
+ var val = isKeyDown ? this.matchedContent : this.exactMatchedContent;
1240
+ if (!val) {
1241
+ this.inputEle.value = this.value = this.index = this.text = null;
1242
+ }
1172
1243
  this.hidePopup(e);
1173
- if (this.matchedRowEle && !isClearValues) {
1244
+ if (this.matchedRowEle && !isClearValues && val) {
1174
1245
  var prevOnChange = this.isProtectedOnChange;
1175
1246
  this.isProtectedOnChange = true;
1176
1247
  setTimeout(function () {
@@ -1254,7 +1325,7 @@ var MultiColumnComboBox = /** @class */ (function (_super) {
1254
1325
  this.updateSelectedItem(e, true, true);
1255
1326
  break;
1256
1327
  case 'enter':
1257
- this.updateValuesOnInput(null, e);
1328
+ this.updateValuesOnInput(null, e, false, true);
1258
1329
  this.focusIn(e);
1259
1330
  break;
1260
1331
  case 'home':
@@ -1264,31 +1335,19 @@ var MultiColumnComboBox = /** @class */ (function (_super) {
1264
1335
  }
1265
1336
  };
1266
1337
  MultiColumnComboBox.prototype.gridKeyActionHandler = function (e, isGroup) {
1338
+ var keyActionMap = {
1339
+ 'ArrowDown': 'moveDown',
1340
+ 'ArrowUp': 'moveUp',
1341
+ 'End': 'end',
1342
+ 'Home': 'home',
1343
+ 'Tab': 'tab',
1344
+ 'Escape': 'escape',
1345
+ 'Shift+Tab': 'shiftTab',
1346
+ 'Alt+ArrowUp': 'altUp'
1347
+ };
1267
1348
  if (isGroup) {
1268
- if (e.key === 'ArrowDown') {
1269
- e.action = 'moveDown';
1270
- }
1271
- else if (e.key === 'ArrowUp') {
1272
- e.action = 'moveUp';
1273
- }
1274
- else if (e.key === 'End') {
1275
- e.action = 'end';
1276
- }
1277
- else if (e.key === 'Home') {
1278
- e.action = 'home';
1279
- }
1280
- else if (e.key === 'Tab') {
1281
- e.action = 'tab';
1282
- }
1283
- else if (e.key === 'Escape') {
1284
- e.action = 'escape';
1285
- }
1286
- if (e.shiftKey && e.key === 'Tab') {
1287
- e.action = 'shiftTab';
1288
- }
1289
- if (e.altKey && e.key === 'ArrowUp') {
1290
- e.action = 'altUp';
1291
- }
1349
+ var key = "" + (e.altKey ? 'Alt+' : '') + (e.shiftKey ? 'Shift+' : '') + e.key;
1350
+ e.action = keyActionMap[key] || e.action;
1292
1351
  }
1293
1352
  switch (e.action) {
1294
1353
  case 'escape':
@@ -1356,6 +1415,25 @@ var MultiColumnComboBox = /** @class */ (function (_super) {
1356
1415
  clearIconEle.style.display = this.inputEle.value === '' ? 'none' : 'flex';
1357
1416
  }
1358
1417
  };
1418
+ MultiColumnComboBox.prototype.updateDynamicDataSource = function (newDataSource, oldDataSource) {
1419
+ if (this.gridObj) {
1420
+ var dataLength_1;
1421
+ this.gridObj.dataSource = newDataSource;
1422
+ var isRemoteData = oldDataSource instanceof DataManager;
1423
+ if (isRemoteData) {
1424
+ oldDataSource.executeQuery(new Query()).then(function (e) {
1425
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1426
+ dataLength_1 = e.result.length;
1427
+ });
1428
+ }
1429
+ else {
1430
+ dataLength_1 = oldDataSource.length;
1431
+ }
1432
+ if (dataLength_1 === 0) {
1433
+ this.popupDiv.appendChild(this.gridEle);
1434
+ }
1435
+ }
1436
+ };
1359
1437
  /**
1360
1438
  * Sets the focus to the component for interaction.component for interaction.
1361
1439
  *
@@ -1437,11 +1515,12 @@ var MultiColumnComboBox = /** @class */ (function (_super) {
1437
1515
  var contentEle = _this.gridObj.getContent();
1438
1516
  if (contentEle) {
1439
1517
  var activeRow = contentEle.querySelector('.e-rowcell.e-active');
1518
+ var firstRow = contentEle.querySelector('.e-row');
1440
1519
  if (activeRow) {
1441
1520
  _this.inputEle.setAttribute('aria-activedescendant', activeRow.parentElement.getAttribute('data-uid'));
1442
1521
  }
1443
- else if (contentEle.querySelector('.e-row')) {
1444
- _this.inputEle.setAttribute('aria-activedescendant', contentEle.querySelector('.e-row').getAttribute('data-uid'));
1522
+ else if (firstRow) {
1523
+ _this.inputEle.setAttribute('aria-activedescendant', firstRow.getAttribute('data-uid'));
1445
1524
  }
1446
1525
  }
1447
1526
  if (!isNOU(_this.dataSource) && _this.dataSource instanceof DataManager) {
@@ -1464,24 +1543,21 @@ var MultiColumnComboBox = /** @class */ (function (_super) {
1464
1543
  var _this = this;
1465
1544
  var animModel = { name: 'FadeOut', duration: 100 };
1466
1545
  var eventArgs = { popup: this.popupObj, event: e || null, cancel: false, animation: animModel };
1546
+ var target = e ? e.target : null;
1467
1547
  this.trigger('close', eventArgs, function (eventArgs) {
1468
1548
  if (!eventArgs.cancel) {
1469
1549
  _this.isPopupOpen = false;
1470
1550
  removeClass([_this.inputWrapper], [ICONANIMATION]);
1471
1551
  attributes(_this.inputEle, { 'aria-expanded': 'false' });
1472
1552
  _this.popupObj.hide(new Animation(eventArgs.animation));
1473
- _this.inputEle.value = _this.text ? _this.text.toString() : '';
1474
- if (e) {
1475
- var target = e.target;
1476
- if (target && (target.classList.contains('e-multicolumn-list-icon') || target.classList.contains('e-rowcell'))) {
1477
- if (!_this.value) {
1478
- _this.gridObj.refreshColumns();
1479
- }
1480
- setTimeout(function () { _this.focusIn(e); });
1481
- }
1482
- else {
1483
- _this.focusOut();
1553
+ if (target && (target.classList.contains('e-multicolumn-list-icon') || target.classList.contains('e-rowcell'))) {
1554
+ if (!_this.value) {
1555
+ _this.gridObj.refreshColumns();
1484
1556
  }
1557
+ setTimeout(function () { _this.focusIn(e); });
1558
+ }
1559
+ else {
1560
+ _this.focusOut();
1485
1561
  }
1486
1562
  _this.inputEle.removeAttribute('aria-owns');
1487
1563
  _this.inputEle.removeAttribute('aria-activedescendant');
@@ -1689,9 +1765,7 @@ var MultiColumnComboBox = /** @class */ (function (_super) {
1689
1765
  }
1690
1766
  break;
1691
1767
  case 'dataSource':
1692
- if (this.gridObj) {
1693
- this.gridObj.dataSource = newProp.dataSource;
1694
- }
1768
+ this.updateDynamicDataSource(newProp.dataSource, oldProp.dataSource);
1695
1769
  break;
1696
1770
  case 'query':
1697
1771
  if (this.gridObj) {