@syncfusion/ej2-multicolumn-combobox 27.2.5 → 28.1.37
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.
- package/README.md +2 -2
- package/dist/ej2-multicolumn-combobox.umd.min.js +3 -3
- package/dist/ej2-multicolumn-combobox.umd.min.js.map +1 -1
- package/dist/es6/ej2-multicolumn-combobox.es2015.js +268 -203
- package/dist/es6/ej2-multicolumn-combobox.es2015.js.map +1 -1
- package/dist/es6/ej2-multicolumn-combobox.es5.js +309 -205
- package/dist/es6/ej2-multicolumn-combobox.es5.js.map +1 -1
- package/dist/global/ej2-multicolumn-combobox.min.js +3 -3
- package/dist/global/ej2-multicolumn-combobox.min.js.map +1 -1
- package/dist/global/index.d.ts +2 -2
- package/package.json +8 -9
- package/src/global.js +0 -2
- package/src/multicolumn-combobox/index.d.ts +0 -1
- package/src/multicolumn-combobox/index.js +0 -1
- package/src/multicolumn-combobox/multi-column-combo-box-model.d.ts +1 -1
- package/src/multicolumn-combobox/multi-column-combo-box.d.ts +6 -0
- package/src/multicolumn-combobox/multi-column-combo-box.js +310 -205
- package/styles/bds-lite.css +416 -0
- package/styles/bds-lite.scss +10 -0
- package/styles/bds.css +467 -0
- package/styles/bds.scss +11 -0
- package/styles/bootstrap-dark-lite.css +3 -0
- package/styles/bootstrap-dark.css +3 -0
- package/styles/bootstrap-lite.css +3 -0
- package/styles/bootstrap.css +3 -0
- package/styles/bootstrap4-lite.css +3 -0
- package/styles/bootstrap4.css +3 -0
- package/styles/bootstrap5-dark-lite.css +3 -0
- package/styles/bootstrap5-dark.css +3 -0
- package/styles/bootstrap5-lite.css +3 -0
- package/styles/bootstrap5.3-lite.css +3 -0
- package/styles/bootstrap5.3.css +3 -0
- package/styles/bootstrap5.css +3 -0
- package/styles/fabric-dark-lite.css +3 -0
- package/styles/fabric-dark.css +3 -0
- package/styles/fabric-lite.css +3 -0
- package/styles/fabric.css +3 -0
- package/styles/fluent-dark-lite.css +3 -0
- package/styles/fluent-dark.css +3 -0
- package/styles/fluent-lite.css +3 -0
- package/styles/fluent.css +3 -0
- package/styles/fluent2-lite.css +3 -0
- package/styles/fluent2.css +3 -0
- package/styles/highcontrast-light-lite.css +3 -0
- package/styles/highcontrast-light.css +3 -0
- package/styles/highcontrast-lite.css +4 -1
- package/styles/highcontrast.css +4 -1
- package/styles/material-dark-lite.css +3 -0
- package/styles/material-dark.css +3 -0
- package/styles/material-lite.css +3 -0
- package/styles/material.css +3 -0
- package/styles/material3-dark-lite.css +3 -0
- package/styles/material3-dark.css +3 -0
- package/styles/material3-lite.css +3 -0
- package/styles/material3.css +3 -0
- package/styles/multicolumn-combobox/_layout.scss +3 -0
- package/styles/multicolumn-combobox/_tailwind3-definition.scss +32 -0
- package/styles/multicolumn-combobox/bds.css +467 -0
- package/styles/multicolumn-combobox/bds.scss +11 -0
- package/styles/multicolumn-combobox/bootstrap-dark.css +3 -0
- package/styles/multicolumn-combobox/bootstrap.css +3 -0
- package/styles/multicolumn-combobox/bootstrap4.css +3 -0
- package/styles/multicolumn-combobox/bootstrap5-dark.css +3 -0
- package/styles/multicolumn-combobox/bootstrap5.3.css +3 -0
- package/styles/multicolumn-combobox/bootstrap5.css +3 -0
- package/styles/multicolumn-combobox/fabric-dark.css +3 -0
- package/styles/multicolumn-combobox/fabric.css +3 -0
- package/styles/multicolumn-combobox/fluent-dark.css +3 -0
- package/styles/multicolumn-combobox/fluent.css +3 -0
- package/styles/multicolumn-combobox/fluent2.css +3 -0
- package/styles/multicolumn-combobox/highcontrast-light.css +3 -0
- package/styles/multicolumn-combobox/highcontrast.css +4 -1
- package/styles/multicolumn-combobox/icons/_tailwind3.scss +6 -0
- package/styles/multicolumn-combobox/material-dark.css +3 -0
- package/styles/multicolumn-combobox/material.css +3 -0
- package/styles/multicolumn-combobox/material3-dark.css +3 -0
- package/styles/multicolumn-combobox/material3.css +3 -0
- package/styles/multicolumn-combobox/tailwind-dark.css +3 -0
- package/styles/multicolumn-combobox/tailwind.css +3 -0
- package/styles/multicolumn-combobox/tailwind3.css +375 -0
- package/styles/multicolumn-combobox/tailwind3.scss +11 -0
- package/styles/tailwind-dark-lite.css +3 -0
- package/styles/tailwind-dark.css +3 -0
- package/styles/tailwind-lite.css +3 -0
- package/styles/tailwind.css +3 -0
- package/styles/tailwind3-lite.css +324 -0
- package/styles/tailwind3-lite.scss +10 -0
- package/styles/tailwind3.css +375 -0
- 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
|
-
|
|
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, getValue } 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
|
|
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:
|
|
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,54 @@ 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
|
-
var
|
|
386
|
-
|
|
387
|
-
|
|
421
|
+
var flattenData = function (data) {
|
|
422
|
+
var result = [];
|
|
423
|
+
if (data && typeof data === 'object') {
|
|
424
|
+
if (Array.isArray(data)) {
|
|
425
|
+
data.forEach(function (item) { return result.push.apply(result, flattenData(item)); });
|
|
426
|
+
}
|
|
427
|
+
else {
|
|
428
|
+
Object.keys(data).forEach(function (key) { return result.push.apply(result, flattenData(data["" + key])); });
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
else if (data != null) {
|
|
432
|
+
result.push(String(data));
|
|
433
|
+
}
|
|
434
|
+
return result;
|
|
435
|
+
};
|
|
436
|
+
var flattenedValues = flattenData(data);
|
|
437
|
+
return (flattenedValues.indexOf(selectedValue) !== -1 && flattenedValues.indexOf(selectedText) !== -1);
|
|
388
438
|
};
|
|
389
439
|
MultiColumnComboBox.prototype.updateRowSelection = function (args) {
|
|
390
440
|
var _this = this;
|
|
391
441
|
if (args) {
|
|
392
442
|
var dataRows = args.rows;
|
|
393
443
|
dataRows.forEach(function (row) {
|
|
394
|
-
|
|
395
|
-
var index = row.index;
|
|
396
|
-
_this.selectDataRow(data, index);
|
|
444
|
+
_this.selectDataRow(row.data, row.index);
|
|
397
445
|
});
|
|
398
446
|
}
|
|
399
447
|
};
|
|
400
448
|
MultiColumnComboBox.prototype.selectDataRow = function (data, index) {
|
|
401
|
-
var isPresent = this.isRowMatching(data, this.value ?
|
|
449
|
+
var isPresent = this.isRowMatching(data, this.value ?
|
|
450
|
+
this.value.toString() : '', this.text ? this.text.toString() : '');
|
|
402
451
|
if (isPresent) {
|
|
403
452
|
this.gridObj.selectRow(index);
|
|
404
453
|
var prevOnChange = this.isProtectedOnChange;
|
|
@@ -414,30 +463,28 @@ var MultiColumnComboBox = /** @class */ (function (_super) {
|
|
|
414
463
|
return Object.keys(obj).every(function (key) { return item[key] === obj[key]; });
|
|
415
464
|
});
|
|
416
465
|
};
|
|
417
|
-
/* eslint-enable @typescript-eslint/no-explicit-any */
|
|
418
466
|
MultiColumnComboBox.prototype.getGridColumns = function () {
|
|
419
467
|
var _this = this;
|
|
420
|
-
return this.columns.map(function (
|
|
421
|
-
var
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
customAttributes: column.customAttributes,
|
|
435
|
-
type: changeType
|
|
436
|
-
};
|
|
468
|
+
return this.columns.map(function (_a) {
|
|
469
|
+
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;
|
|
470
|
+
return ({
|
|
471
|
+
field: field,
|
|
472
|
+
headerText: header,
|
|
473
|
+
width: width,
|
|
474
|
+
textAlign: textAlign.toString() === '' && _this.enableRtl ? 'Right' : textAlign,
|
|
475
|
+
format: format,
|
|
476
|
+
displayAsCheckBox: displayAsCheckBox,
|
|
477
|
+
template: template,
|
|
478
|
+
headerTemplate: headerTemplate,
|
|
479
|
+
customAttributes: customAttributes,
|
|
480
|
+
type: displayAsCheckBox && !format ? 'boolean' : undefined
|
|
481
|
+
});
|
|
437
482
|
});
|
|
438
483
|
};
|
|
439
484
|
MultiColumnComboBox.prototype.updateGroupByField = function () {
|
|
440
|
-
|
|
485
|
+
var groupByField = this.fields.groupBy;
|
|
486
|
+
var isGroupByValid = groupByField !== '' && !isNOU(groupByField);
|
|
487
|
+
if (isGroupByValid) {
|
|
441
488
|
if (this.sortType.toString().toLowerCase() !== 'multiplecolumns') {
|
|
442
489
|
this.gridEle.classList.add('e-multicolumn-group');
|
|
443
490
|
}
|
|
@@ -446,10 +493,11 @@ var MultiColumnComboBox = /** @class */ (function (_super) {
|
|
|
446
493
|
this.gridObj.allowGrouping = true;
|
|
447
494
|
this.gridObj.groupSettings = {
|
|
448
495
|
showDropArea: false,
|
|
449
|
-
columns: [
|
|
450
|
-
captionTemplate: (this.groupTemplate && this.fields.groupBy !== '' && !isNOU(this.fields.groupBy))
|
|
451
|
-
? this.groupTemplate : '${key}'
|
|
496
|
+
columns: [groupByField]
|
|
452
497
|
};
|
|
498
|
+
if (this.groupTemplate && isGroupByValid) {
|
|
499
|
+
this.gridObj.groupSettings.captionTemplate = this.groupTemplate;
|
|
500
|
+
}
|
|
453
501
|
if (this.isVue) {
|
|
454
502
|
this.gridObj.isVue = this.isVue;
|
|
455
503
|
}
|
|
@@ -459,12 +507,13 @@ var MultiColumnComboBox = /** @class */ (function (_super) {
|
|
|
459
507
|
MultiColumnComboBox.prototype.onDataBound = function () {
|
|
460
508
|
var dataCount = this.dataSource.length;
|
|
461
509
|
var popupChild = this.popupDiv.querySelector('.' + MULTICOLUMNGRID);
|
|
510
|
+
var hasNoDataClass = this.popupDiv.classList.contains(NODATA);
|
|
462
511
|
if (dataCount <= 0 && popupChild) {
|
|
463
512
|
this.l10nUpdate();
|
|
464
513
|
this.popupDiv.removeChild(this.gridEle);
|
|
465
514
|
addClass([this.popupDiv], [NODATA]);
|
|
466
515
|
}
|
|
467
|
-
else if (
|
|
516
|
+
else if (hasNoDataClass && dataCount >= 1) {
|
|
468
517
|
removeClass([this.popupDiv], [NODATA]);
|
|
469
518
|
var noRecordEle = this.popupDiv.querySelector('.e-no-records');
|
|
470
519
|
if (noRecordEle) {
|
|
@@ -472,8 +521,9 @@ var MultiColumnComboBox = /** @class */ (function (_super) {
|
|
|
472
521
|
}
|
|
473
522
|
}
|
|
474
523
|
if (this.isInitialRender) {
|
|
475
|
-
var
|
|
476
|
-
|
|
524
|
+
var gridContentRow = this.popupDiv.querySelector('.e-gridcontent tr');
|
|
525
|
+
var rowHeight = !hasNoDataClass ? gridContentRow ?
|
|
526
|
+
gridContentRow.getBoundingClientRect().height : 0 :
|
|
477
527
|
this.popupDiv.getBoundingClientRect().height;
|
|
478
528
|
this.popupRowHeight = rowHeight;
|
|
479
529
|
this.popupObj.hide();
|
|
@@ -492,6 +542,16 @@ var MultiColumnComboBox = /** @class */ (function (_super) {
|
|
|
492
542
|
addClass([this.popupDiv], [NODATA]);
|
|
493
543
|
};
|
|
494
544
|
MultiColumnComboBox.prototype.renderInput = function () {
|
|
545
|
+
var allowedAttributes = ['aria-expanded', 'aria-readOnly', 'aria-disabled', 'autocomplete',
|
|
546
|
+
'autocapitalize', 'spellcheck', 'tabindex'];
|
|
547
|
+
var setAttributes = function (element, attributes) {
|
|
548
|
+
for (var key in attributes) {
|
|
549
|
+
// eslint-disable-next-line no-prototype-builtins
|
|
550
|
+
if (attributes.hasOwnProperty(key) && allowedAttributes.indexOf(key) !== -1 && isNOU(element.getAttribute(key))) {
|
|
551
|
+
element.setAttribute(key, attributes[key]);
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
};
|
|
495
555
|
if (this.element.tagName === 'INPUT') {
|
|
496
556
|
this.inputEle = this.element;
|
|
497
557
|
if (isNOU(this.inputEle.getAttribute('role'))) {
|
|
@@ -500,13 +560,15 @@ var MultiColumnComboBox = /** @class */ (function (_super) {
|
|
|
500
560
|
if (isNOU(this.inputEle.getAttribute('type'))) {
|
|
501
561
|
this.inputEle.setAttribute('type', 'text');
|
|
502
562
|
}
|
|
503
|
-
this.inputEle
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
563
|
+
setAttributes(this.inputEle, {
|
|
564
|
+
'aria-expanded': 'false',
|
|
565
|
+
'aria-readOnly': this.readonly.toString(),
|
|
566
|
+
'aria-disabled': this.disabled.toString(),
|
|
567
|
+
autocomplete: 'off',
|
|
568
|
+
autocapitalize: 'off',
|
|
569
|
+
spellcheck: 'false',
|
|
570
|
+
tabindex: '0'
|
|
571
|
+
});
|
|
510
572
|
}
|
|
511
573
|
else {
|
|
512
574
|
this.inputEle = this.createElement('input', { attrs: { role: 'textbox', type: 'text' } });
|
|
@@ -536,49 +598,53 @@ var MultiColumnComboBox = /** @class */ (function (_super) {
|
|
|
536
598
|
this.initValue(null, null, true);
|
|
537
599
|
}
|
|
538
600
|
};
|
|
539
|
-
/* To calculate the width when change via set model */
|
|
540
601
|
MultiColumnComboBox.prototype.setElementWidth = function (inputWidth) {
|
|
602
|
+
if (isNOU(inputWidth)) {
|
|
603
|
+
return;
|
|
604
|
+
}
|
|
541
605
|
var ddElement = this.inputWrapper;
|
|
542
|
-
if (
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
ddElement.style.width = (inputWidth.match(/px|%|em/)) ? (inputWidth) : (formatUnit(inputWidth));
|
|
548
|
-
}
|
|
606
|
+
if (typeof inputWidth === 'number') {
|
|
607
|
+
ddElement.style.width = formatUnit(inputWidth);
|
|
608
|
+
}
|
|
609
|
+
else if (typeof inputWidth === 'string') {
|
|
610
|
+
ddElement.style.width = inputWidth.match(/px|%|em/) ? inputWidth : formatUnit(inputWidth);
|
|
549
611
|
}
|
|
550
612
|
};
|
|
551
613
|
MultiColumnComboBox.prototype.setHTMLAttributes = function () {
|
|
552
|
-
|
|
553
|
-
|
|
614
|
+
var htmlAttributes = this.htmlAttributes;
|
|
615
|
+
var inputEle = this.inputEle;
|
|
616
|
+
if (Object.keys(htmlAttributes).length) {
|
|
617
|
+
for (var _i = 0, _a = Object.keys(htmlAttributes); _i < _a.length; _i++) {
|
|
554
618
|
var htmlAttr = _a[_i];
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
'role', 'autocomplete', 'autocapitalize', 'spellcheck', 'minlength', 'maxlength'];
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
619
|
+
switch (htmlAttr) {
|
|
620
|
+
case 'class':
|
|
621
|
+
this.inputWrapper.classList.add(htmlAttributes[htmlAttr]);
|
|
622
|
+
break;
|
|
623
|
+
case 'disabled':
|
|
624
|
+
this.setProperties({ enabled: false }, true);
|
|
625
|
+
this.setEnable();
|
|
626
|
+
break;
|
|
627
|
+
case 'readonly':
|
|
628
|
+
this.setProperties({ readonly: true }, true);
|
|
629
|
+
this.dataBind();
|
|
630
|
+
break;
|
|
631
|
+
case 'style':
|
|
632
|
+
this.inputWrapper.setAttribute('style', htmlAttributes[htmlAttr]);
|
|
633
|
+
break;
|
|
634
|
+
default: {
|
|
635
|
+
var defaultAttr = ['title', 'id', 'placeholder', 'role', 'autocomplete', 'autocapitalize', 'spellcheck', 'minlength', 'maxlength'];
|
|
636
|
+
if (defaultAttr.indexOf(htmlAttr) > -1) {
|
|
637
|
+
if (htmlAttr === 'placeholder') {
|
|
638
|
+
Input.setPlaceholder(htmlAttributes[htmlAttr], inputEle);
|
|
639
|
+
}
|
|
640
|
+
else {
|
|
641
|
+
inputEle.setAttribute(htmlAttr, htmlAttributes[htmlAttr]);
|
|
642
|
+
}
|
|
575
643
|
}
|
|
576
644
|
else {
|
|
577
|
-
|
|
645
|
+
inputEle.setAttribute(htmlAttr, htmlAttributes[htmlAttr]);
|
|
578
646
|
}
|
|
579
|
-
|
|
580
|
-
else {
|
|
581
|
-
this.inputEle.setAttribute(htmlAttr, this.htmlAttributes["" + htmlAttr]);
|
|
647
|
+
break;
|
|
582
648
|
}
|
|
583
649
|
}
|
|
584
650
|
}
|
|
@@ -589,8 +655,7 @@ var MultiColumnComboBox = /** @class */ (function (_super) {
|
|
|
589
655
|
Input.setEnabled(!this.disabled, this.inputEle);
|
|
590
656
|
if (!this.disabled) {
|
|
591
657
|
removeClass([this.inputWrapper], DISABLED);
|
|
592
|
-
this.
|
|
593
|
-
this.inputWrapper.setAttribute('aria-disabled', 'false');
|
|
658
|
+
this.setAriaDisabled('false');
|
|
594
659
|
}
|
|
595
660
|
else {
|
|
596
661
|
if (this.isPopupOpen) {
|
|
@@ -600,10 +665,17 @@ var MultiColumnComboBox = /** @class */ (function (_super) {
|
|
|
600
665
|
if (this.inputWrapper && this.inputWrapper.classList.contains(INPUTFOCUS)) {
|
|
601
666
|
removeClass([this.inputWrapper], [INPUTFOCUS]);
|
|
602
667
|
}
|
|
603
|
-
this.
|
|
604
|
-
this.inputWrapper.setAttribute('aria-disabled', 'true');
|
|
668
|
+
this.setAriaDisabled('true');
|
|
605
669
|
}
|
|
606
670
|
};
|
|
671
|
+
MultiColumnComboBox.prototype.setAriaDisabled = function (value) {
|
|
672
|
+
this.inputEle.setAttribute('aria-disabled', value);
|
|
673
|
+
this.inputWrapper.setAttribute('aria-disabled', value);
|
|
674
|
+
};
|
|
675
|
+
MultiColumnComboBox.prototype.updateFieldValue = function (fieldValue, dataObj) {
|
|
676
|
+
var fieldVal = getValue(fieldValue, dataObj).toString();
|
|
677
|
+
return fieldVal;
|
|
678
|
+
};
|
|
607
679
|
MultiColumnComboBox.prototype.initValue = function (isRerender, isValue, isInitial) {
|
|
608
680
|
var _this = this;
|
|
609
681
|
var prevItemData = this.gridObj.getSelectedRecords()[0];
|
|
@@ -629,8 +701,9 @@ var MultiColumnComboBox = /** @class */ (function (_super) {
|
|
|
629
701
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
630
702
|
var dataLists = e.result;
|
|
631
703
|
var filteredData = dataLists.filter(function (item) {
|
|
632
|
-
|
|
633
|
-
!isNOU(_this.value) ? _this.fields.value : _this.fields.text
|
|
704
|
+
var fieldVal = _this.updateFieldValue(isRerender ? (isValue ? _this.fields.value : _this.fields.text) :
|
|
705
|
+
!isNOU(_this.value) ? _this.fields.value : _this.fields.text, item);
|
|
706
|
+
return fieldVal === value_1;
|
|
634
707
|
});
|
|
635
708
|
if (filteredData.length > 0) {
|
|
636
709
|
item = filteredData[0];
|
|
@@ -642,8 +715,9 @@ var MultiColumnComboBox = /** @class */ (function (_super) {
|
|
|
642
715
|
}
|
|
643
716
|
else if (!isNOU(this.dataSource) && this.dataSource instanceof Array) {
|
|
644
717
|
item = this.dataSource.filter(function (data) {
|
|
645
|
-
|
|
646
|
-
!isNOU(_this.value) ? _this.fields.value : _this.fields.text
|
|
718
|
+
var fieldVal = _this.updateFieldValue(isRerender ? (isValue ? _this.fields.value : _this.fields.text) :
|
|
719
|
+
!isNOU(_this.value) ? _this.fields.value : _this.fields.text, data);
|
|
720
|
+
return fieldVal === value_1;
|
|
647
721
|
})[0];
|
|
648
722
|
updateValues(this.dataSource);
|
|
649
723
|
}
|
|
@@ -690,8 +764,9 @@ var MultiColumnComboBox = /** @class */ (function (_super) {
|
|
|
690
764
|
}
|
|
691
765
|
};
|
|
692
766
|
MultiColumnComboBox.prototype.updateChangeEvent = function (item, prevItemData, prevItemEle, currentValue, currentText, currentIndex, isRerender, isInitial) {
|
|
767
|
+
var fieldValue = item ? this.updateFieldValue(this.fields.value, item) : null;
|
|
693
768
|
var ChangeEventArgs = {
|
|
694
|
-
value: item ?
|
|
769
|
+
value: item ? fieldValue : null,
|
|
695
770
|
itemData: { text: currentText, value: currentValue },
|
|
696
771
|
item: this.getDataByValue(this.value),
|
|
697
772
|
previousItemData: prevItemData,
|
|
@@ -704,10 +779,12 @@ var MultiColumnComboBox = /** @class */ (function (_super) {
|
|
|
704
779
|
};
|
|
705
780
|
MultiColumnComboBox.prototype.updateCurrentValues = function (item, dataList) {
|
|
706
781
|
if (!isNOU(item)) {
|
|
707
|
-
|
|
782
|
+
var fieldText = this.updateFieldValue(this.fields.text, item);
|
|
783
|
+
var fieldValue = this.updateFieldValue(this.fields.value, item);
|
|
784
|
+
Input.setValue(fieldText, this.inputEle, this.floatLabelType, this.showClearButton);
|
|
708
785
|
return {
|
|
709
|
-
currentValue:
|
|
710
|
-
currentText:
|
|
786
|
+
currentValue: fieldValue,
|
|
787
|
+
currentText: fieldText,
|
|
711
788
|
currentIndex: dataList.indexOf(item)
|
|
712
789
|
};
|
|
713
790
|
}
|
|
@@ -865,7 +942,7 @@ var MultiColumnComboBox = /** @class */ (function (_super) {
|
|
|
865
942
|
MultiColumnComboBox.prototype.getSize = function (ispopupWidth) {
|
|
866
943
|
var currentDimension = ispopupWidth ? this.popupWidth : this.popupHeight;
|
|
867
944
|
var size = formatUnit(currentDimension);
|
|
868
|
-
if (size.
|
|
945
|
+
if (size.includes('%')) {
|
|
869
946
|
var dimensionValue = ispopupWidth ? this.inputWrapper.offsetWidth : document.documentElement.clientHeight;
|
|
870
947
|
size = (dimensionValue * parseFloat(size) / 100).toString() + 'px';
|
|
871
948
|
}
|
|
@@ -885,16 +962,16 @@ var MultiColumnComboBox = /** @class */ (function (_super) {
|
|
|
885
962
|
cancel: false
|
|
886
963
|
};
|
|
887
964
|
var selectedRecords = this.gridObj.getSelectedRecords()[0];
|
|
888
|
-
var
|
|
889
|
-
var
|
|
965
|
+
var dataText = selectedRecords ? this.updateFieldValue(this.fields.text, selectedRecords) : '';
|
|
966
|
+
var dataValue = selectedRecords ? this.updateFieldValue(this.fields.value, selectedRecords) : '';
|
|
890
967
|
var ChangeEventArgs = {
|
|
891
968
|
isInteracted: e ? true : false,
|
|
892
969
|
item: selectedRecords,
|
|
893
970
|
itemElement: row,
|
|
894
|
-
itemData: { text:
|
|
971
|
+
itemData: { text: selectedRecords ? dataText : '', value: selectedRecords ? dataValue : '' },
|
|
895
972
|
event: e,
|
|
896
973
|
cancel: false,
|
|
897
|
-
value:
|
|
974
|
+
value: selectedRecords ? dataValue : '',
|
|
898
975
|
previousItemData: { text: this.text, value: this.value },
|
|
899
976
|
previousItemElement: this.previousItemElement
|
|
900
977
|
};
|
|
@@ -904,9 +981,9 @@ var MultiColumnComboBox = /** @class */ (function (_super) {
|
|
|
904
981
|
var event_1 = e;
|
|
905
982
|
var isUpdateVal = event_1.key === 'Enter' || event_1.key === 'Tab' || event_1.shiftKey && event_1.key === 'Tab' || event_1.altKey && event_1.key === 'ArrowUp';
|
|
906
983
|
if (!isKeyNav || (isKeyNav && isUpdateVal)) {
|
|
907
|
-
_this.updateValues(
|
|
984
|
+
_this.updateValues(selectedRecords ? dataValue : '', selectedRecords ? dataText : '', _this.gridObj.selectedRowIndex, ChangeEventArgs);
|
|
908
985
|
}
|
|
909
|
-
Input.setValue(
|
|
986
|
+
Input.setValue(selectedRecords ? dataText : '', _this.inputEle, _this.floatLabelType, _this.showClearButton);
|
|
910
987
|
if (!isKeyNav || (isKeyNav && isUpdateVal)) {
|
|
911
988
|
_this.hidePopup(e);
|
|
912
989
|
}
|
|
@@ -917,8 +994,8 @@ var MultiColumnComboBox = /** @class */ (function (_super) {
|
|
|
917
994
|
this.previousItemElement = eventArgs.itemElement;
|
|
918
995
|
var prevOnChange = this.isProtectedOnChange;
|
|
919
996
|
this.isProtectedOnChange = true;
|
|
920
|
-
this.text = text
|
|
921
|
-
this.value = value
|
|
997
|
+
this.text = text || this.text;
|
|
998
|
+
this.value = value || this.value;
|
|
922
999
|
this.index = !isNOU(index) ? index : this.index;
|
|
923
1000
|
this.isProtectedOnChange = prevOnChange;
|
|
924
1001
|
if (!isInitial) {
|
|
@@ -961,45 +1038,59 @@ var MultiColumnComboBox = /** @class */ (function (_super) {
|
|
|
961
1038
|
this.updateInputValue(e.target.value);
|
|
962
1039
|
};
|
|
963
1040
|
MultiColumnComboBox.prototype.updateInputValue = function (inputValue) {
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
1041
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1042
|
+
var _a, _b, data, exactData, query, result, totaldata;
|
|
1043
|
+
return __generator(this, function (_c) {
|
|
1044
|
+
switch (_c.label) {
|
|
1045
|
+
case 0:
|
|
1046
|
+
if (!(this.dataSource instanceof DataManager)) return [3 /*break*/, 2];
|
|
1047
|
+
query = new Query();
|
|
1048
|
+
return [4 /*yield*/, this.dataSource.executeQuery(query)];
|
|
1049
|
+
case 1:
|
|
1050
|
+
result = _c.sent();
|
|
1051
|
+
totaldata = result.result;
|
|
1052
|
+
(_a = this.filterDatas(totaldata, inputValue), data = _a.data, exactData = _a.exactData);
|
|
1053
|
+
return [3 /*break*/, 3];
|
|
1054
|
+
case 2:
|
|
1055
|
+
if (Array.isArray(this.dataSource)) {
|
|
1056
|
+
(_b = this.filterDatas(this.dataSource, inputValue), data = _b.data, exactData = _b.exactData);
|
|
1057
|
+
}
|
|
1058
|
+
_c.label = 3;
|
|
1059
|
+
case 3:
|
|
1060
|
+
this.selectFilteredRows(data, exactData);
|
|
1061
|
+
return [2 /*return*/];
|
|
1062
|
+
}
|
|
980
1063
|
});
|
|
981
|
-
|
|
982
|
-
}
|
|
1064
|
+
});
|
|
983
1065
|
};
|
|
984
|
-
MultiColumnComboBox.prototype.
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
}
|
|
995
|
-
|
|
996
|
-
|
|
1066
|
+
MultiColumnComboBox.prototype.filterDatas = function (dataSource, inputValue) {
|
|
1067
|
+
var _this = this;
|
|
1068
|
+
var data = dataSource.filter(function (item) {
|
|
1069
|
+
var fieldText = _this.updateFieldValue(_this.fields.text, item);
|
|
1070
|
+
return fieldText.toLowerCase().startsWith(inputValue.toLowerCase());
|
|
1071
|
+
});
|
|
1072
|
+
var exactData = dataSource.filter(function (item) {
|
|
1073
|
+
var fieldText = _this.updateFieldValue(_this.fields.text, item);
|
|
1074
|
+
return fieldText === inputValue;
|
|
1075
|
+
});
|
|
1076
|
+
return { data: data, exactData: exactData };
|
|
1077
|
+
};
|
|
1078
|
+
MultiColumnComboBox.prototype.selectFilteredRows = function (data, exactData) {
|
|
1079
|
+
if (data.length <= 0) {
|
|
1080
|
+
this.matchedRowEle = this.matchedContent = this.exactMatchedContent = null;
|
|
1081
|
+
return;
|
|
997
1082
|
}
|
|
1083
|
+
this.matchedContent = data[0];
|
|
1084
|
+
this.exactMatchedContent = exactData[0];
|
|
1085
|
+
var selectedIndex = this.findIndex(this.gridObj.currentViewData, this.matchedContent);
|
|
1086
|
+
this.matchedRowEle = this.gridObj.getRowByIndex(selectedIndex);
|
|
998
1087
|
};
|
|
999
1088
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1000
1089
|
MultiColumnComboBox.prototype.filterAction = function (dataSource, inputValue, query, fields) {
|
|
1001
1090
|
var _this = this;
|
|
1002
|
-
|
|
1091
|
+
var isQuery = query || new Query();
|
|
1092
|
+
var filterType = this.filterType.toString().toLowerCase();
|
|
1093
|
+
if (isNOU(query) && isNOU(fields)) {
|
|
1003
1094
|
this.updateGridDataSource(dataSource);
|
|
1004
1095
|
}
|
|
1005
1096
|
else if (query) {
|
|
@@ -1015,14 +1106,12 @@ var MultiColumnComboBox = /** @class */ (function (_super) {
|
|
|
1015
1106
|
}
|
|
1016
1107
|
}
|
|
1017
1108
|
else {
|
|
1018
|
-
var isQuery = query || new Query();
|
|
1019
1109
|
if (dataSource instanceof DataManager) {
|
|
1020
1110
|
this.filteringHandler(dataSource, inputValue, isQuery, fields);
|
|
1021
1111
|
}
|
|
1022
1112
|
else if (Array.isArray(dataSource)) {
|
|
1023
|
-
var filterType_1 = this.filterType.toString().toLowerCase();
|
|
1024
1113
|
var filteredData = dataSource.filter(function (item) {
|
|
1025
|
-
return _this.filterData(item,
|
|
1114
|
+
return _this.filterData(item, filterType, inputValue, fields);
|
|
1026
1115
|
});
|
|
1027
1116
|
this.updateGridDataSource(filteredData);
|
|
1028
1117
|
}
|
|
@@ -1042,7 +1131,8 @@ var MultiColumnComboBox = /** @class */ (function (_super) {
|
|
|
1042
1131
|
});
|
|
1043
1132
|
};
|
|
1044
1133
|
MultiColumnComboBox.prototype.filterData = function (item, filterType, inputValue, fields) {
|
|
1045
|
-
var
|
|
1134
|
+
var dataValue = this.updateFieldValue(fields ? fields.text : this.fields.text, item);
|
|
1135
|
+
var itemValue = dataValue.toLowerCase();
|
|
1046
1136
|
switch (filterType) {
|
|
1047
1137
|
case 'startswith':
|
|
1048
1138
|
return itemValue.startsWith(inputValue);
|
|
@@ -1149,41 +1239,51 @@ var MultiColumnComboBox = /** @class */ (function (_super) {
|
|
|
1149
1239
|
}
|
|
1150
1240
|
};
|
|
1151
1241
|
MultiColumnComboBox.prototype.onDocumentClick = function (e) {
|
|
1242
|
+
var target = e.target;
|
|
1152
1243
|
if (this.disabled || this.readonly || !this.isPopupOpen) {
|
|
1153
|
-
if (!
|
|
1244
|
+
if (!target.closest('.e-multicolumn-list')) {
|
|
1154
1245
|
this.focusOut();
|
|
1155
1246
|
}
|
|
1156
1247
|
return;
|
|
1157
1248
|
}
|
|
1158
|
-
var target = e.target;
|
|
1159
1249
|
if ((target.classList.contains('e-multicolumn-list-icon') || closest(target, '.e-popup'))) {
|
|
1160
1250
|
e.preventDefault();
|
|
1161
1251
|
}
|
|
1162
1252
|
else {
|
|
1163
1253
|
if (!target.classList.contains('e-multicolumncombobox') && !target.classList.contains('e-clear-icon')) {
|
|
1164
|
-
this.
|
|
1254
|
+
if (!isNOU(this.text)) {
|
|
1255
|
+
this.updateInputValue(this.text);
|
|
1256
|
+
}
|
|
1257
|
+
var isClearVal = this.inputEle.value === '' ? true : false;
|
|
1258
|
+
this.updateValuesOnInput(e, null, isClearVal);
|
|
1165
1259
|
}
|
|
1166
1260
|
}
|
|
1167
1261
|
};
|
|
1168
|
-
MultiColumnComboBox.prototype.updateValuesOnInput = function (mouseEvent, keyEvent, isClearValues) {
|
|
1262
|
+
MultiColumnComboBox.prototype.updateValuesOnInput = function (mouseEvent, keyEvent, isClearValues, isKeyDown) {
|
|
1169
1263
|
var _this = this;
|
|
1170
|
-
if (
|
|
1264
|
+
if (isKeyDown === void 0) { isKeyDown = false; }
|
|
1171
1265
|
var e = mouseEvent ? mouseEvent : keyEvent;
|
|
1266
|
+
var val = isKeyDown ? this.matchedContent : this.exactMatchedContent;
|
|
1267
|
+
if (!val) {
|
|
1268
|
+
this.inputEle.value = this.value = this.index = this.text = null;
|
|
1269
|
+
}
|
|
1172
1270
|
this.hidePopup(e);
|
|
1173
|
-
if (this.matchedRowEle && !isClearValues) {
|
|
1174
|
-
var prevOnChange = this.isProtectedOnChange;
|
|
1175
|
-
this.isProtectedOnChange = true;
|
|
1271
|
+
if (this.matchedRowEle && !isClearValues && val) {
|
|
1176
1272
|
setTimeout(function () {
|
|
1177
|
-
|
|
1178
|
-
_this.
|
|
1273
|
+
var prevOnChange = _this.isProtectedOnChange;
|
|
1274
|
+
_this.isProtectedOnChange = true;
|
|
1275
|
+
var fieldText = _this.updateFieldValue(_this.fields.text, _this.matchedContent);
|
|
1276
|
+
var fieldValue = _this.updateFieldValue(_this.fields.value, _this.matchedContent);
|
|
1277
|
+
_this.inputEle.value = fieldText;
|
|
1278
|
+
_this.value = fieldValue;
|
|
1179
1279
|
var selectIndex = _this.findIndex(_this.gridObj.currentViewData, _this.matchedContent);
|
|
1180
1280
|
_this.index = selectIndex;
|
|
1181
|
-
_this.text =
|
|
1281
|
+
_this.text = fieldText;
|
|
1182
1282
|
_this.gridObj.selectRow(selectIndex);
|
|
1183
1283
|
_this.selectedGridRow(_this.gridObj.getRowByIndex(selectIndex), e);
|
|
1184
1284
|
_this.previousItemElement = _this.gridObj.getSelectedRows()[0];
|
|
1285
|
+
_this.isProtectedOnChange = prevOnChange;
|
|
1185
1286
|
}, 100);
|
|
1186
|
-
this.isProtectedOnChange = prevOnChange;
|
|
1187
1287
|
}
|
|
1188
1288
|
else {
|
|
1189
1289
|
if (this.isDataFiltered) {
|
|
@@ -1254,7 +1354,7 @@ var MultiColumnComboBox = /** @class */ (function (_super) {
|
|
|
1254
1354
|
this.updateSelectedItem(e, true, true);
|
|
1255
1355
|
break;
|
|
1256
1356
|
case 'enter':
|
|
1257
|
-
this.updateValuesOnInput(null, e);
|
|
1357
|
+
this.updateValuesOnInput(null, e, false, true);
|
|
1258
1358
|
this.focusIn(e);
|
|
1259
1359
|
break;
|
|
1260
1360
|
case 'home':
|
|
@@ -1264,31 +1364,19 @@ var MultiColumnComboBox = /** @class */ (function (_super) {
|
|
|
1264
1364
|
}
|
|
1265
1365
|
};
|
|
1266
1366
|
MultiColumnComboBox.prototype.gridKeyActionHandler = function (e, isGroup) {
|
|
1367
|
+
var keyActionMap = {
|
|
1368
|
+
'ArrowDown': 'moveDown',
|
|
1369
|
+
'ArrowUp': 'moveUp',
|
|
1370
|
+
'End': 'end',
|
|
1371
|
+
'Home': 'home',
|
|
1372
|
+
'Tab': 'tab',
|
|
1373
|
+
'Escape': 'escape',
|
|
1374
|
+
'Shift+Tab': 'shiftTab',
|
|
1375
|
+
'Alt+ArrowUp': 'altUp'
|
|
1376
|
+
};
|
|
1267
1377
|
if (isGroup) {
|
|
1268
|
-
|
|
1269
|
-
|
|
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
|
-
}
|
|
1378
|
+
var key = "" + (e.altKey ? 'Alt+' : '') + (e.shiftKey ? 'Shift+' : '') + e.key;
|
|
1379
|
+
e.action = keyActionMap[key] || e.action;
|
|
1292
1380
|
}
|
|
1293
1381
|
switch (e.action) {
|
|
1294
1382
|
case 'escape':
|
|
@@ -1356,6 +1444,25 @@ var MultiColumnComboBox = /** @class */ (function (_super) {
|
|
|
1356
1444
|
clearIconEle.style.display = this.inputEle.value === '' ? 'none' : 'flex';
|
|
1357
1445
|
}
|
|
1358
1446
|
};
|
|
1447
|
+
MultiColumnComboBox.prototype.updateDynamicDataSource = function (newDataSource, oldDataSource) {
|
|
1448
|
+
if (this.gridObj) {
|
|
1449
|
+
var dataLength_1;
|
|
1450
|
+
this.gridObj.dataSource = newDataSource;
|
|
1451
|
+
var isRemoteData = oldDataSource instanceof DataManager;
|
|
1452
|
+
if (isRemoteData) {
|
|
1453
|
+
oldDataSource.executeQuery(new Query()).then(function (e) {
|
|
1454
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1455
|
+
dataLength_1 = e.result.length;
|
|
1456
|
+
});
|
|
1457
|
+
}
|
|
1458
|
+
else {
|
|
1459
|
+
dataLength_1 = oldDataSource.length;
|
|
1460
|
+
}
|
|
1461
|
+
if (dataLength_1 === 0) {
|
|
1462
|
+
this.popupDiv.appendChild(this.gridEle);
|
|
1463
|
+
}
|
|
1464
|
+
}
|
|
1465
|
+
};
|
|
1359
1466
|
/**
|
|
1360
1467
|
* Sets the focus to the component for interaction.component for interaction.
|
|
1361
1468
|
*
|
|
@@ -1437,11 +1544,12 @@ var MultiColumnComboBox = /** @class */ (function (_super) {
|
|
|
1437
1544
|
var contentEle = _this.gridObj.getContent();
|
|
1438
1545
|
if (contentEle) {
|
|
1439
1546
|
var activeRow = contentEle.querySelector('.e-rowcell.e-active');
|
|
1547
|
+
var firstRow = contentEle.querySelector('.e-row');
|
|
1440
1548
|
if (activeRow) {
|
|
1441
1549
|
_this.inputEle.setAttribute('aria-activedescendant', activeRow.parentElement.getAttribute('data-uid'));
|
|
1442
1550
|
}
|
|
1443
|
-
else if (
|
|
1444
|
-
_this.inputEle.setAttribute('aria-activedescendant',
|
|
1551
|
+
else if (firstRow) {
|
|
1552
|
+
_this.inputEle.setAttribute('aria-activedescendant', firstRow.getAttribute('data-uid'));
|
|
1445
1553
|
}
|
|
1446
1554
|
}
|
|
1447
1555
|
if (!isNOU(_this.dataSource) && _this.dataSource instanceof DataManager) {
|
|
@@ -1464,24 +1572,21 @@ var MultiColumnComboBox = /** @class */ (function (_super) {
|
|
|
1464
1572
|
var _this = this;
|
|
1465
1573
|
var animModel = { name: 'FadeOut', duration: 100 };
|
|
1466
1574
|
var eventArgs = { popup: this.popupObj, event: e || null, cancel: false, animation: animModel };
|
|
1575
|
+
var target = e ? e.target : null;
|
|
1467
1576
|
this.trigger('close', eventArgs, function (eventArgs) {
|
|
1468
1577
|
if (!eventArgs.cancel) {
|
|
1469
1578
|
_this.isPopupOpen = false;
|
|
1470
1579
|
removeClass([_this.inputWrapper], [ICONANIMATION]);
|
|
1471
1580
|
attributes(_this.inputEle, { 'aria-expanded': 'false' });
|
|
1472
1581
|
_this.popupObj.hide(new Animation(eventArgs.animation));
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
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();
|
|
1582
|
+
if (target && (target.classList.contains('e-multicolumn-list-icon') || target.classList.contains('e-rowcell'))) {
|
|
1583
|
+
if (!_this.value) {
|
|
1584
|
+
_this.gridObj.refreshColumns();
|
|
1484
1585
|
}
|
|
1586
|
+
setTimeout(function () { _this.focusIn(e); });
|
|
1587
|
+
}
|
|
1588
|
+
else {
|
|
1589
|
+
_this.focusOut();
|
|
1485
1590
|
}
|
|
1486
1591
|
_this.inputEle.removeAttribute('aria-owns');
|
|
1487
1592
|
_this.inputEle.removeAttribute('aria-activedescendant');
|
|
@@ -1529,7 +1634,8 @@ var MultiColumnComboBox = /** @class */ (function (_super) {
|
|
|
1529
1634
|
var _this = this;
|
|
1530
1635
|
if (!isNOU(this.dataSource) && this.dataSource instanceof Array) {
|
|
1531
1636
|
return this.dataSource.filter(function (item) {
|
|
1532
|
-
|
|
1637
|
+
var fieldValue = _this.updateFieldValue(_this.fields.value, item);
|
|
1638
|
+
return fieldValue === value;
|
|
1533
1639
|
})[0];
|
|
1534
1640
|
}
|
|
1535
1641
|
else if (!isNOU(this.dataSource) && this.dataSource instanceof DataManager) {
|
|
@@ -1537,7 +1643,8 @@ var MultiColumnComboBox = /** @class */ (function (_super) {
|
|
|
1537
1643
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1538
1644
|
var dataLists = e.result;
|
|
1539
1645
|
return dataLists.filter(function (item) {
|
|
1540
|
-
|
|
1646
|
+
var fieldValue = _this.updateFieldValue(_this.fields.value, item);
|
|
1647
|
+
return fieldValue === value;
|
|
1541
1648
|
})[0];
|
|
1542
1649
|
});
|
|
1543
1650
|
}
|
|
@@ -1689,9 +1796,7 @@ var MultiColumnComboBox = /** @class */ (function (_super) {
|
|
|
1689
1796
|
}
|
|
1690
1797
|
break;
|
|
1691
1798
|
case 'dataSource':
|
|
1692
|
-
|
|
1693
|
-
this.gridObj.dataSource = newProp.dataSource;
|
|
1694
|
-
}
|
|
1799
|
+
this.updateDynamicDataSource(newProp.dataSource, oldProp.dataSource);
|
|
1695
1800
|
break;
|
|
1696
1801
|
case 'query':
|
|
1697
1802
|
if (this.gridObj) {
|