@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
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { Property, ChildProperty, Event, getUniqueID, isNullOrUndefined, addClass, removeClass, formatUnit, attributes, prepend, Browser, append, L10n, select, compile, EventHandler, KeyboardEvents, closest, Animation, detach, Complex, Collection, NotifyPropertyChanges, Component } from '@syncfusion/ej2-base';
|
|
1
|
+
import { Property, ChildProperty, Event, getUniqueID, isNullOrUndefined, addClass, removeClass, formatUnit, getValue, attributes, prepend, Browser, append, L10n, select, compile, EventHandler, KeyboardEvents, closest, Animation, detach, Complex, Collection, NotifyPropertyChanges, Component } from '@syncfusion/ej2-base';
|
|
2
2
|
import { Input } from '@syncfusion/ej2-inputs';
|
|
3
3
|
import { DataManager, Query } from '@syncfusion/ej2-data';
|
|
4
4
|
import { Popup } from '@syncfusion/ej2-popups';
|
|
5
5
|
import { Grid, VirtualScroll, Group, Edit, Sort, Resize } from '@syncfusion/ej2-grids';
|
|
6
|
-
export { Edit, Group, Sort, VirtualScroll } from '@syncfusion/ej2-grids';
|
|
7
6
|
|
|
8
7
|
var __extends = (undefined && undefined.__extends) || (function () {
|
|
9
8
|
var extendStatics = function (d, b) {
|
|
@@ -24,6 +23,41 @@ var __decorate = (undefined && undefined.__decorate) || function (decorators, ta
|
|
|
24
23
|
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;
|
|
25
24
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
26
25
|
};
|
|
26
|
+
var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
27
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
+
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
|
31
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
var __generator = (undefined && undefined.__generator) || function (thisArg, body) {
|
|
35
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
36
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
37
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
38
|
+
function step(op) {
|
|
39
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
40
|
+
while (_) try {
|
|
41
|
+
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;
|
|
42
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
43
|
+
switch (op[0]) {
|
|
44
|
+
case 0: case 1: t = op; break;
|
|
45
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
46
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
47
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
48
|
+
default:
|
|
49
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
50
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
51
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
52
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
53
|
+
if (t[2]) _.ops.pop();
|
|
54
|
+
_.trys.pop(); continue;
|
|
55
|
+
}
|
|
56
|
+
op = body.call(thisArg, _);
|
|
57
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
58
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
59
|
+
}
|
|
60
|
+
};
|
|
27
61
|
var DROPDOWNICON = 'e-input-group-icon e-multicolumn-list-icon e-icons';
|
|
28
62
|
var CONTENT = 'e-popup-content';
|
|
29
63
|
var ICONANIMATION = 'e-icon-anim';
|
|
@@ -256,7 +290,7 @@ var MultiColumnComboBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
256
290
|
moveDown: 'downarrow',
|
|
257
291
|
moveUp: 'uparrow'
|
|
258
292
|
};
|
|
259
|
-
this.matchedRowEle = this.matchedContent = null;
|
|
293
|
+
this.matchedRowEle = this.matchedContent = this.exactMatchedContent = null;
|
|
260
294
|
this.persistData();
|
|
261
295
|
};
|
|
262
296
|
MultiColumnComboBox.prototype.getDirective = function () {
|
|
@@ -282,7 +316,7 @@ var MultiColumnComboBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
282
316
|
};
|
|
283
317
|
MultiColumnComboBox.prototype.persistData = function () {
|
|
284
318
|
if (this.enablePersistence) {
|
|
285
|
-
this.element.id
|
|
319
|
+
this.element.id += '_wrapper';
|
|
286
320
|
var data = window.localStorage.getItem(this.getModuleName() + this.element.id);
|
|
287
321
|
if (!(isNullOrUndefined(data) || (data === ''))) {
|
|
288
322
|
this.setProperties(JSON.parse(data), true);
|
|
@@ -301,6 +335,7 @@ var MultiColumnComboBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
301
335
|
MultiColumnComboBox.prototype.renderGrid = function () {
|
|
302
336
|
var _this = this;
|
|
303
337
|
var gridColumns = this.getGridColumns();
|
|
338
|
+
var sortOrder = this.sortOrder.toString().toLowerCase();
|
|
304
339
|
this.gridObj = new Grid({
|
|
305
340
|
dataSource: this.dataSource,
|
|
306
341
|
columns: gridColumns,
|
|
@@ -323,22 +358,7 @@ var MultiColumnComboBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
323
358
|
actionFailure: function (args) { _this.onActionFailure(args); },
|
|
324
359
|
actionBegin: function (args) { _this.trigger('actionBegin', args); },
|
|
325
360
|
actionComplete: this.handleActionComplete.bind(this),
|
|
326
|
-
keyPressed:
|
|
327
|
-
if (args.key === 'Enter') {
|
|
328
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
329
|
-
args.cancel = true;
|
|
330
|
-
if (_this.isPopupOpen) {
|
|
331
|
-
_this.selectedGridRow(_this.gridObj.getRows()[_this.gridObj.selectedRowIndex], args, true);
|
|
332
|
-
_this.hidePopup(args);
|
|
333
|
-
_this.focusIn(args);
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
if (_this.fields.groupBy) {
|
|
337
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
338
|
-
args.cancel = true;
|
|
339
|
-
_this.gridKeyActionHandler(args, true);
|
|
340
|
-
}
|
|
341
|
-
},
|
|
361
|
+
keyPressed: this.handleKeyPressed.bind(this),
|
|
342
362
|
resizing: function (args) {
|
|
343
363
|
if (_this.gridSettings.resizing) {
|
|
344
364
|
_this.gridSettings.resizing.call(_this, args);
|
|
@@ -357,7 +377,6 @@ var MultiColumnComboBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
357
377
|
});
|
|
358
378
|
this.gridEle = this.createElement('div', { id: getUniqueID('grid'), className: MULTICOLUMNGRID });
|
|
359
379
|
this.updateGroupByField();
|
|
360
|
-
var sortOrder = this.sortOrder.toString().toLowerCase();
|
|
361
380
|
if (gridColumns.length > 0) {
|
|
362
381
|
// Set first column as primary key to avoid PRIMARY KEY MISSING warning.
|
|
363
382
|
this.gridObj.columns[0].isPrimaryKey = true;
|
|
@@ -376,25 +395,54 @@ var MultiColumnComboBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
376
395
|
this.popupObj.refreshPosition();
|
|
377
396
|
this.gridObj.element.querySelector('.e-content').scrollTop = 0;
|
|
378
397
|
};
|
|
398
|
+
MultiColumnComboBox.prototype.handleKeyPressed = function (args) {
|
|
399
|
+
if (args.key === 'Enter') {
|
|
400
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
401
|
+
args.cancel = true;
|
|
402
|
+
if (this.isPopupOpen) {
|
|
403
|
+
this.selectedGridRow(this.gridObj.getRows()[this.gridObj.selectedRowIndex], args, true);
|
|
404
|
+
this.hidePopup(args);
|
|
405
|
+
this.focusIn(args);
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
if (this.fields.groupBy) {
|
|
409
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
410
|
+
args.cancel = true;
|
|
411
|
+
this.gridKeyActionHandler(args, true);
|
|
412
|
+
}
|
|
413
|
+
};
|
|
379
414
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
380
415
|
MultiColumnComboBox.prototype.isRowMatching = function (data, selectedValue, selectedText) {
|
|
381
|
-
var
|
|
382
|
-
|
|
383
|
-
|
|
416
|
+
var flattenData = function (data) {
|
|
417
|
+
var result = [];
|
|
418
|
+
if (data && typeof data === 'object') {
|
|
419
|
+
if (Array.isArray(data)) {
|
|
420
|
+
data.forEach(function (item) { return result.push.apply(result, flattenData(item)); });
|
|
421
|
+
}
|
|
422
|
+
else {
|
|
423
|
+
Object.keys(data).forEach(function (key) { return result.push.apply(result, flattenData(data["" + key])); });
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
else if (data != null) {
|
|
427
|
+
result.push(String(data));
|
|
428
|
+
}
|
|
429
|
+
return result;
|
|
430
|
+
};
|
|
431
|
+
var flattenedValues = flattenData(data);
|
|
432
|
+
return (flattenedValues.indexOf(selectedValue) !== -1 && flattenedValues.indexOf(selectedText) !== -1);
|
|
384
433
|
};
|
|
385
434
|
MultiColumnComboBox.prototype.updateRowSelection = function (args) {
|
|
386
435
|
var _this = this;
|
|
387
436
|
if (args) {
|
|
388
437
|
var dataRows = args.rows;
|
|
389
438
|
dataRows.forEach(function (row) {
|
|
390
|
-
|
|
391
|
-
var index = row.index;
|
|
392
|
-
_this.selectDataRow(data, index);
|
|
439
|
+
_this.selectDataRow(row.data, row.index);
|
|
393
440
|
});
|
|
394
441
|
}
|
|
395
442
|
};
|
|
396
443
|
MultiColumnComboBox.prototype.selectDataRow = function (data, index) {
|
|
397
|
-
var isPresent = this.isRowMatching(data, this.value ?
|
|
444
|
+
var isPresent = this.isRowMatching(data, this.value ?
|
|
445
|
+
this.value.toString() : '', this.text ? this.text.toString() : '');
|
|
398
446
|
if (isPresent) {
|
|
399
447
|
this.gridObj.selectRow(index);
|
|
400
448
|
var prevOnChange = this.isProtectedOnChange;
|
|
@@ -410,30 +458,28 @@ var MultiColumnComboBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
410
458
|
return Object.keys(obj).every(function (key) { return item[key] === obj[key]; });
|
|
411
459
|
});
|
|
412
460
|
};
|
|
413
|
-
/* eslint-enable @typescript-eslint/no-explicit-any */
|
|
414
461
|
MultiColumnComboBox.prototype.getGridColumns = function () {
|
|
415
462
|
var _this = this;
|
|
416
|
-
return this.columns.map(function (
|
|
417
|
-
var
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
customAttributes: column.customAttributes,
|
|
431
|
-
type: changeType
|
|
432
|
-
};
|
|
463
|
+
return this.columns.map(function (_a) {
|
|
464
|
+
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;
|
|
465
|
+
return ({
|
|
466
|
+
field: field,
|
|
467
|
+
headerText: header,
|
|
468
|
+
width: width,
|
|
469
|
+
textAlign: textAlign.toString() === '' && _this.enableRtl ? 'Right' : textAlign,
|
|
470
|
+
format: format,
|
|
471
|
+
displayAsCheckBox: displayAsCheckBox,
|
|
472
|
+
template: template,
|
|
473
|
+
headerTemplate: headerTemplate,
|
|
474
|
+
customAttributes: customAttributes,
|
|
475
|
+
type: displayAsCheckBox && !format ? 'boolean' : undefined
|
|
476
|
+
});
|
|
433
477
|
});
|
|
434
478
|
};
|
|
435
479
|
MultiColumnComboBox.prototype.updateGroupByField = function () {
|
|
436
|
-
|
|
480
|
+
var groupByField = this.fields.groupBy;
|
|
481
|
+
var isGroupByValid = groupByField !== '' && !isNullOrUndefined(groupByField);
|
|
482
|
+
if (isGroupByValid) {
|
|
437
483
|
if (this.sortType.toString().toLowerCase() !== 'multiplecolumns') {
|
|
438
484
|
this.gridEle.classList.add('e-multicolumn-group');
|
|
439
485
|
}
|
|
@@ -442,10 +488,11 @@ var MultiColumnComboBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
442
488
|
this.gridObj.allowGrouping = true;
|
|
443
489
|
this.gridObj.groupSettings = {
|
|
444
490
|
showDropArea: false,
|
|
445
|
-
columns: [
|
|
446
|
-
captionTemplate: (this.groupTemplate && this.fields.groupBy !== '' && !isNullOrUndefined(this.fields.groupBy))
|
|
447
|
-
? this.groupTemplate : '${key}'
|
|
491
|
+
columns: [groupByField]
|
|
448
492
|
};
|
|
493
|
+
if (this.groupTemplate && isGroupByValid) {
|
|
494
|
+
this.gridObj.groupSettings.captionTemplate = this.groupTemplate;
|
|
495
|
+
}
|
|
449
496
|
if (this.isVue) {
|
|
450
497
|
this.gridObj.isVue = this.isVue;
|
|
451
498
|
}
|
|
@@ -455,12 +502,13 @@ var MultiColumnComboBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
455
502
|
MultiColumnComboBox.prototype.onDataBound = function () {
|
|
456
503
|
var dataCount = this.dataSource.length;
|
|
457
504
|
var popupChild = this.popupDiv.querySelector('.' + MULTICOLUMNGRID);
|
|
505
|
+
var hasNoDataClass = this.popupDiv.classList.contains(NODATA);
|
|
458
506
|
if (dataCount <= 0 && popupChild) {
|
|
459
507
|
this.l10nUpdate();
|
|
460
508
|
this.popupDiv.removeChild(this.gridEle);
|
|
461
509
|
addClass([this.popupDiv], [NODATA]);
|
|
462
510
|
}
|
|
463
|
-
else if (
|
|
511
|
+
else if (hasNoDataClass && dataCount >= 1) {
|
|
464
512
|
removeClass([this.popupDiv], [NODATA]);
|
|
465
513
|
var noRecordEle = this.popupDiv.querySelector('.e-no-records');
|
|
466
514
|
if (noRecordEle) {
|
|
@@ -468,8 +516,9 @@ var MultiColumnComboBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
468
516
|
}
|
|
469
517
|
}
|
|
470
518
|
if (this.isInitialRender) {
|
|
471
|
-
var
|
|
472
|
-
|
|
519
|
+
var gridContentRow = this.popupDiv.querySelector('.e-gridcontent tr');
|
|
520
|
+
var rowHeight = !hasNoDataClass ? gridContentRow ?
|
|
521
|
+
gridContentRow.getBoundingClientRect().height : 0 :
|
|
473
522
|
this.popupDiv.getBoundingClientRect().height;
|
|
474
523
|
this.popupRowHeight = rowHeight;
|
|
475
524
|
this.popupObj.hide();
|
|
@@ -488,6 +537,16 @@ var MultiColumnComboBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
488
537
|
addClass([this.popupDiv], [NODATA]);
|
|
489
538
|
};
|
|
490
539
|
MultiColumnComboBox.prototype.renderInput = function () {
|
|
540
|
+
var allowedAttributes = ['aria-expanded', 'aria-readOnly', 'aria-disabled', 'autocomplete',
|
|
541
|
+
'autocapitalize', 'spellcheck', 'tabindex'];
|
|
542
|
+
var setAttributes = function (element, attributes) {
|
|
543
|
+
for (var key in attributes) {
|
|
544
|
+
// eslint-disable-next-line no-prototype-builtins
|
|
545
|
+
if (attributes.hasOwnProperty(key) && allowedAttributes.indexOf(key) !== -1 && isNullOrUndefined(element.getAttribute(key))) {
|
|
546
|
+
element.setAttribute(key, attributes[key]);
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
};
|
|
491
550
|
if (this.element.tagName === 'INPUT') {
|
|
492
551
|
this.inputEle = this.element;
|
|
493
552
|
if (isNullOrUndefined(this.inputEle.getAttribute('role'))) {
|
|
@@ -496,13 +555,15 @@ var MultiColumnComboBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
496
555
|
if (isNullOrUndefined(this.inputEle.getAttribute('type'))) {
|
|
497
556
|
this.inputEle.setAttribute('type', 'text');
|
|
498
557
|
}
|
|
499
|
-
this.inputEle
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
558
|
+
setAttributes(this.inputEle, {
|
|
559
|
+
'aria-expanded': 'false',
|
|
560
|
+
'aria-readOnly': this.readonly.toString(),
|
|
561
|
+
'aria-disabled': this.disabled.toString(),
|
|
562
|
+
autocomplete: 'off',
|
|
563
|
+
autocapitalize: 'off',
|
|
564
|
+
spellcheck: 'false',
|
|
565
|
+
tabindex: '0'
|
|
566
|
+
});
|
|
506
567
|
}
|
|
507
568
|
else {
|
|
508
569
|
this.inputEle = this.createElement('input', { attrs: { role: 'textbox', type: 'text' } });
|
|
@@ -532,49 +593,53 @@ var MultiColumnComboBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
532
593
|
this.initValue(null, null, true);
|
|
533
594
|
}
|
|
534
595
|
};
|
|
535
|
-
/* To calculate the width when change via set model */
|
|
536
596
|
MultiColumnComboBox.prototype.setElementWidth = function (inputWidth) {
|
|
597
|
+
if (isNullOrUndefined(inputWidth)) {
|
|
598
|
+
return;
|
|
599
|
+
}
|
|
537
600
|
var ddElement = this.inputWrapper;
|
|
538
|
-
if (
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
ddElement.style.width = (inputWidth.match(/px|%|em/)) ? (inputWidth) : (formatUnit(inputWidth));
|
|
544
|
-
}
|
|
601
|
+
if (typeof inputWidth === 'number') {
|
|
602
|
+
ddElement.style.width = formatUnit(inputWidth);
|
|
603
|
+
}
|
|
604
|
+
else if (typeof inputWidth === 'string') {
|
|
605
|
+
ddElement.style.width = inputWidth.match(/px|%|em/) ? inputWidth : formatUnit(inputWidth);
|
|
545
606
|
}
|
|
546
607
|
};
|
|
547
608
|
MultiColumnComboBox.prototype.setHTMLAttributes = function () {
|
|
548
|
-
|
|
549
|
-
|
|
609
|
+
var htmlAttributes = this.htmlAttributes;
|
|
610
|
+
var inputEle = this.inputEle;
|
|
611
|
+
if (Object.keys(htmlAttributes).length) {
|
|
612
|
+
for (var _i = 0, _a = Object.keys(htmlAttributes); _i < _a.length; _i++) {
|
|
550
613
|
var htmlAttr = _a[_i];
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
'role', 'autocomplete', 'autocapitalize', 'spellcheck', 'minlength', 'maxlength'];
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
614
|
+
switch (htmlAttr) {
|
|
615
|
+
case 'class':
|
|
616
|
+
this.inputWrapper.classList.add(htmlAttributes[htmlAttr]);
|
|
617
|
+
break;
|
|
618
|
+
case 'disabled':
|
|
619
|
+
this.setProperties({ enabled: false }, true);
|
|
620
|
+
this.setEnable();
|
|
621
|
+
break;
|
|
622
|
+
case 'readonly':
|
|
623
|
+
this.setProperties({ readonly: true }, true);
|
|
624
|
+
this.dataBind();
|
|
625
|
+
break;
|
|
626
|
+
case 'style':
|
|
627
|
+
this.inputWrapper.setAttribute('style', htmlAttributes[htmlAttr]);
|
|
628
|
+
break;
|
|
629
|
+
default: {
|
|
630
|
+
var defaultAttr = ['title', 'id', 'placeholder', 'role', 'autocomplete', 'autocapitalize', 'spellcheck', 'minlength', 'maxlength'];
|
|
631
|
+
if (defaultAttr.indexOf(htmlAttr) > -1) {
|
|
632
|
+
if (htmlAttr === 'placeholder') {
|
|
633
|
+
Input.setPlaceholder(htmlAttributes[htmlAttr], inputEle);
|
|
634
|
+
}
|
|
635
|
+
else {
|
|
636
|
+
inputEle.setAttribute(htmlAttr, htmlAttributes[htmlAttr]);
|
|
637
|
+
}
|
|
571
638
|
}
|
|
572
639
|
else {
|
|
573
|
-
|
|
640
|
+
inputEle.setAttribute(htmlAttr, htmlAttributes[htmlAttr]);
|
|
574
641
|
}
|
|
575
|
-
|
|
576
|
-
else {
|
|
577
|
-
this.inputEle.setAttribute(htmlAttr, this.htmlAttributes["" + htmlAttr]);
|
|
642
|
+
break;
|
|
578
643
|
}
|
|
579
644
|
}
|
|
580
645
|
}
|
|
@@ -585,8 +650,7 @@ var MultiColumnComboBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
585
650
|
Input.setEnabled(!this.disabled, this.inputEle);
|
|
586
651
|
if (!this.disabled) {
|
|
587
652
|
removeClass([this.inputWrapper], DISABLED);
|
|
588
|
-
this.
|
|
589
|
-
this.inputWrapper.setAttribute('aria-disabled', 'false');
|
|
653
|
+
this.setAriaDisabled('false');
|
|
590
654
|
}
|
|
591
655
|
else {
|
|
592
656
|
if (this.isPopupOpen) {
|
|
@@ -596,10 +660,17 @@ var MultiColumnComboBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
596
660
|
if (this.inputWrapper && this.inputWrapper.classList.contains(INPUTFOCUS)) {
|
|
597
661
|
removeClass([this.inputWrapper], [INPUTFOCUS]);
|
|
598
662
|
}
|
|
599
|
-
this.
|
|
600
|
-
this.inputWrapper.setAttribute('aria-disabled', 'true');
|
|
663
|
+
this.setAriaDisabled('true');
|
|
601
664
|
}
|
|
602
665
|
};
|
|
666
|
+
MultiColumnComboBox.prototype.setAriaDisabled = function (value) {
|
|
667
|
+
this.inputEle.setAttribute('aria-disabled', value);
|
|
668
|
+
this.inputWrapper.setAttribute('aria-disabled', value);
|
|
669
|
+
};
|
|
670
|
+
MultiColumnComboBox.prototype.updateFieldValue = function (fieldValue, dataObj) {
|
|
671
|
+
var fieldVal = getValue(fieldValue, dataObj).toString();
|
|
672
|
+
return fieldVal;
|
|
673
|
+
};
|
|
603
674
|
MultiColumnComboBox.prototype.initValue = function (isRerender, isValue, isInitial) {
|
|
604
675
|
var _this = this;
|
|
605
676
|
var prevItemData = this.gridObj.getSelectedRecords()[0];
|
|
@@ -625,8 +696,9 @@ var MultiColumnComboBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
625
696
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
626
697
|
var dataLists = e.result;
|
|
627
698
|
var filteredData = dataLists.filter(function (item) {
|
|
628
|
-
|
|
629
|
-
!isNullOrUndefined(_this.value) ? _this.fields.value : _this.fields.text
|
|
699
|
+
var fieldVal = _this.updateFieldValue(isRerender ? (isValue ? _this.fields.value : _this.fields.text) :
|
|
700
|
+
!isNullOrUndefined(_this.value) ? _this.fields.value : _this.fields.text, item);
|
|
701
|
+
return fieldVal === value_1;
|
|
630
702
|
});
|
|
631
703
|
if (filteredData.length > 0) {
|
|
632
704
|
item = filteredData[0];
|
|
@@ -638,8 +710,9 @@ var MultiColumnComboBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
638
710
|
}
|
|
639
711
|
else if (!isNullOrUndefined(this.dataSource) && this.dataSource instanceof Array) {
|
|
640
712
|
item = this.dataSource.filter(function (data) {
|
|
641
|
-
|
|
642
|
-
!isNullOrUndefined(_this.value) ? _this.fields.value : _this.fields.text
|
|
713
|
+
var fieldVal = _this.updateFieldValue(isRerender ? (isValue ? _this.fields.value : _this.fields.text) :
|
|
714
|
+
!isNullOrUndefined(_this.value) ? _this.fields.value : _this.fields.text, data);
|
|
715
|
+
return fieldVal === value_1;
|
|
643
716
|
})[0];
|
|
644
717
|
updateValues(this.dataSource);
|
|
645
718
|
}
|
|
@@ -686,8 +759,9 @@ var MultiColumnComboBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
686
759
|
}
|
|
687
760
|
};
|
|
688
761
|
MultiColumnComboBox.prototype.updateChangeEvent = function (item, prevItemData, prevItemEle, currentValue, currentText, currentIndex, isRerender, isInitial) {
|
|
762
|
+
var fieldValue = item ? this.updateFieldValue(this.fields.value, item) : null;
|
|
689
763
|
var ChangeEventArgs = {
|
|
690
|
-
value: item ?
|
|
764
|
+
value: item ? fieldValue : null,
|
|
691
765
|
itemData: { text: currentText, value: currentValue },
|
|
692
766
|
item: this.getDataByValue(this.value),
|
|
693
767
|
previousItemData: prevItemData,
|
|
@@ -700,10 +774,12 @@ var MultiColumnComboBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
700
774
|
};
|
|
701
775
|
MultiColumnComboBox.prototype.updateCurrentValues = function (item, dataList) {
|
|
702
776
|
if (!isNullOrUndefined(item)) {
|
|
703
|
-
|
|
777
|
+
var fieldText = this.updateFieldValue(this.fields.text, item);
|
|
778
|
+
var fieldValue = this.updateFieldValue(this.fields.value, item);
|
|
779
|
+
Input.setValue(fieldText, this.inputEle, this.floatLabelType, this.showClearButton);
|
|
704
780
|
return {
|
|
705
|
-
currentValue:
|
|
706
|
-
currentText:
|
|
781
|
+
currentValue: fieldValue,
|
|
782
|
+
currentText: fieldText,
|
|
707
783
|
currentIndex: dataList.indexOf(item)
|
|
708
784
|
};
|
|
709
785
|
}
|
|
@@ -861,7 +937,7 @@ var MultiColumnComboBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
861
937
|
MultiColumnComboBox.prototype.getSize = function (ispopupWidth) {
|
|
862
938
|
var currentDimension = ispopupWidth ? this.popupWidth : this.popupHeight;
|
|
863
939
|
var size = formatUnit(currentDimension);
|
|
864
|
-
if (size.
|
|
940
|
+
if (size.includes('%')) {
|
|
865
941
|
var dimensionValue = ispopupWidth ? this.inputWrapper.offsetWidth : document.documentElement.clientHeight;
|
|
866
942
|
size = (dimensionValue * parseFloat(size) / 100).toString() + 'px';
|
|
867
943
|
}
|
|
@@ -881,16 +957,16 @@ var MultiColumnComboBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
881
957
|
cancel: false
|
|
882
958
|
};
|
|
883
959
|
var selectedRecords = this.gridObj.getSelectedRecords()[0];
|
|
884
|
-
var
|
|
885
|
-
var
|
|
960
|
+
var dataText = selectedRecords ? this.updateFieldValue(this.fields.text, selectedRecords) : '';
|
|
961
|
+
var dataValue = selectedRecords ? this.updateFieldValue(this.fields.value, selectedRecords) : '';
|
|
886
962
|
var ChangeEventArgs = {
|
|
887
963
|
isInteracted: e ? true : false,
|
|
888
964
|
item: selectedRecords,
|
|
889
965
|
itemElement: row,
|
|
890
|
-
itemData: { text:
|
|
966
|
+
itemData: { text: selectedRecords ? dataText : '', value: selectedRecords ? dataValue : '' },
|
|
891
967
|
event: e,
|
|
892
968
|
cancel: false,
|
|
893
|
-
value:
|
|
969
|
+
value: selectedRecords ? dataValue : '',
|
|
894
970
|
previousItemData: { text: this.text, value: this.value },
|
|
895
971
|
previousItemElement: this.previousItemElement
|
|
896
972
|
};
|
|
@@ -900,9 +976,9 @@ var MultiColumnComboBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
900
976
|
var event_1 = e;
|
|
901
977
|
var isUpdateVal = event_1.key === 'Enter' || event_1.key === 'Tab' || event_1.shiftKey && event_1.key === 'Tab' || event_1.altKey && event_1.key === 'ArrowUp';
|
|
902
978
|
if (!isKeyNav || (isKeyNav && isUpdateVal)) {
|
|
903
|
-
_this.updateValues(
|
|
979
|
+
_this.updateValues(selectedRecords ? dataValue : '', selectedRecords ? dataText : '', _this.gridObj.selectedRowIndex, ChangeEventArgs);
|
|
904
980
|
}
|
|
905
|
-
Input.setValue(
|
|
981
|
+
Input.setValue(selectedRecords ? dataText : '', _this.inputEle, _this.floatLabelType, _this.showClearButton);
|
|
906
982
|
if (!isKeyNav || (isKeyNav && isUpdateVal)) {
|
|
907
983
|
_this.hidePopup(e);
|
|
908
984
|
}
|
|
@@ -913,8 +989,8 @@ var MultiColumnComboBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
913
989
|
this.previousItemElement = eventArgs.itemElement;
|
|
914
990
|
var prevOnChange = this.isProtectedOnChange;
|
|
915
991
|
this.isProtectedOnChange = true;
|
|
916
|
-
this.text = text
|
|
917
|
-
this.value = value
|
|
992
|
+
this.text = text || this.text;
|
|
993
|
+
this.value = value || this.value;
|
|
918
994
|
this.index = !isNullOrUndefined(index) ? index : this.index;
|
|
919
995
|
this.isProtectedOnChange = prevOnChange;
|
|
920
996
|
if (!isInitial) {
|
|
@@ -957,44 +1033,58 @@ var MultiColumnComboBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
957
1033
|
this.updateInputValue(e.target.value);
|
|
958
1034
|
};
|
|
959
1035
|
MultiColumnComboBox.prototype.updateInputValue = function (inputValue) {
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
1036
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1037
|
+
var _a, _b, data, exactData, query, result, totaldata;
|
|
1038
|
+
return __generator(this, function (_c) {
|
|
1039
|
+
switch (_c.label) {
|
|
1040
|
+
case 0:
|
|
1041
|
+
if (!(this.dataSource instanceof DataManager)) return [3 /*break*/, 2];
|
|
1042
|
+
query = new Query();
|
|
1043
|
+
return [4 /*yield*/, this.dataSource.executeQuery(query)];
|
|
1044
|
+
case 1:
|
|
1045
|
+
result = _c.sent();
|
|
1046
|
+
totaldata = result.result;
|
|
1047
|
+
(_a = this.filterDatas(totaldata, inputValue), data = _a.data, exactData = _a.exactData);
|
|
1048
|
+
return [3 /*break*/, 3];
|
|
1049
|
+
case 2:
|
|
1050
|
+
if (Array.isArray(this.dataSource)) {
|
|
1051
|
+
(_b = this.filterDatas(this.dataSource, inputValue), data = _b.data, exactData = _b.exactData);
|
|
1052
|
+
}
|
|
1053
|
+
_c.label = 3;
|
|
1054
|
+
case 3:
|
|
1055
|
+
this.selectFilteredRows(data, exactData);
|
|
1056
|
+
return [2 /*return*/];
|
|
1057
|
+
}
|
|
976
1058
|
});
|
|
977
|
-
|
|
978
|
-
}
|
|
1059
|
+
});
|
|
979
1060
|
};
|
|
980
|
-
MultiColumnComboBox.prototype.
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
}
|
|
991
|
-
|
|
992
|
-
|
|
1061
|
+
MultiColumnComboBox.prototype.filterDatas = function (dataSource, inputValue) {
|
|
1062
|
+
var _this = this;
|
|
1063
|
+
var data = dataSource.filter(function (item) {
|
|
1064
|
+
var fieldText = _this.updateFieldValue(_this.fields.text, item);
|
|
1065
|
+
return fieldText.toLowerCase().startsWith(inputValue.toLowerCase());
|
|
1066
|
+
});
|
|
1067
|
+
var exactData = dataSource.filter(function (item) {
|
|
1068
|
+
var fieldText = _this.updateFieldValue(_this.fields.text, item);
|
|
1069
|
+
return fieldText === inputValue;
|
|
1070
|
+
});
|
|
1071
|
+
return { data: data, exactData: exactData };
|
|
1072
|
+
};
|
|
1073
|
+
MultiColumnComboBox.prototype.selectFilteredRows = function (data, exactData) {
|
|
1074
|
+
if (data.length <= 0) {
|
|
1075
|
+
this.matchedRowEle = this.matchedContent = this.exactMatchedContent = null;
|
|
1076
|
+
return;
|
|
993
1077
|
}
|
|
1078
|
+
this.matchedContent = data[0];
|
|
1079
|
+
this.exactMatchedContent = exactData[0];
|
|
1080
|
+
var selectedIndex = this.findIndex(this.gridObj.currentViewData, this.matchedContent);
|
|
1081
|
+
this.matchedRowEle = this.gridObj.getRowByIndex(selectedIndex);
|
|
994
1082
|
};
|
|
995
1083
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
996
1084
|
MultiColumnComboBox.prototype.filterAction = function (dataSource, inputValue, query, fields) {
|
|
997
1085
|
var _this = this;
|
|
1086
|
+
var isQuery = query || new Query();
|
|
1087
|
+
var filterType = this.filterType.toString().toLowerCase();
|
|
998
1088
|
if (isNullOrUndefined(query) && isNullOrUndefined(fields)) {
|
|
999
1089
|
this.updateGridDataSource(dataSource);
|
|
1000
1090
|
}
|
|
@@ -1011,14 +1101,12 @@ var MultiColumnComboBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
1011
1101
|
}
|
|
1012
1102
|
}
|
|
1013
1103
|
else {
|
|
1014
|
-
var isQuery = query || new Query();
|
|
1015
1104
|
if (dataSource instanceof DataManager) {
|
|
1016
1105
|
this.filteringHandler(dataSource, inputValue, isQuery, fields);
|
|
1017
1106
|
}
|
|
1018
1107
|
else if (Array.isArray(dataSource)) {
|
|
1019
|
-
var filterType_1 = this.filterType.toString().toLowerCase();
|
|
1020
1108
|
var filteredData = dataSource.filter(function (item) {
|
|
1021
|
-
return _this.filterData(item,
|
|
1109
|
+
return _this.filterData(item, filterType, inputValue, fields);
|
|
1022
1110
|
});
|
|
1023
1111
|
this.updateGridDataSource(filteredData);
|
|
1024
1112
|
}
|
|
@@ -1038,7 +1126,8 @@ var MultiColumnComboBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
1038
1126
|
});
|
|
1039
1127
|
};
|
|
1040
1128
|
MultiColumnComboBox.prototype.filterData = function (item, filterType, inputValue, fields) {
|
|
1041
|
-
var
|
|
1129
|
+
var dataValue = this.updateFieldValue(fields ? fields.text : this.fields.text, item);
|
|
1130
|
+
var itemValue = dataValue.toLowerCase();
|
|
1042
1131
|
switch (filterType) {
|
|
1043
1132
|
case 'startswith':
|
|
1044
1133
|
return itemValue.startsWith(inputValue);
|
|
@@ -1145,41 +1234,51 @@ var MultiColumnComboBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
1145
1234
|
}
|
|
1146
1235
|
};
|
|
1147
1236
|
MultiColumnComboBox.prototype.onDocumentClick = function (e) {
|
|
1237
|
+
var target = e.target;
|
|
1148
1238
|
if (this.disabled || this.readonly || !this.isPopupOpen) {
|
|
1149
|
-
if (!
|
|
1239
|
+
if (!target.closest('.e-multicolumn-list')) {
|
|
1150
1240
|
this.focusOut();
|
|
1151
1241
|
}
|
|
1152
1242
|
return;
|
|
1153
1243
|
}
|
|
1154
|
-
var target = e.target;
|
|
1155
1244
|
if ((target.classList.contains('e-multicolumn-list-icon') || closest(target, '.e-popup'))) {
|
|
1156
1245
|
e.preventDefault();
|
|
1157
1246
|
}
|
|
1158
1247
|
else {
|
|
1159
1248
|
if (!target.classList.contains('e-multicolumncombobox') && !target.classList.contains('e-clear-icon')) {
|
|
1160
|
-
this.
|
|
1249
|
+
if (!isNullOrUndefined(this.text)) {
|
|
1250
|
+
this.updateInputValue(this.text);
|
|
1251
|
+
}
|
|
1252
|
+
var isClearVal = this.inputEle.value === '' ? true : false;
|
|
1253
|
+
this.updateValuesOnInput(e, null, isClearVal);
|
|
1161
1254
|
}
|
|
1162
1255
|
}
|
|
1163
1256
|
};
|
|
1164
|
-
MultiColumnComboBox.prototype.updateValuesOnInput = function (mouseEvent, keyEvent, isClearValues) {
|
|
1257
|
+
MultiColumnComboBox.prototype.updateValuesOnInput = function (mouseEvent, keyEvent, isClearValues, isKeyDown) {
|
|
1165
1258
|
var _this = this;
|
|
1166
|
-
if (
|
|
1259
|
+
if (isKeyDown === void 0) { isKeyDown = false; }
|
|
1167
1260
|
var e = mouseEvent ? mouseEvent : keyEvent;
|
|
1261
|
+
var val = isKeyDown ? this.matchedContent : this.exactMatchedContent;
|
|
1262
|
+
if (!val) {
|
|
1263
|
+
this.inputEle.value = this.value = this.index = this.text = null;
|
|
1264
|
+
}
|
|
1168
1265
|
this.hidePopup(e);
|
|
1169
|
-
if (this.matchedRowEle && !isClearValues) {
|
|
1170
|
-
var prevOnChange = this.isProtectedOnChange;
|
|
1171
|
-
this.isProtectedOnChange = true;
|
|
1266
|
+
if (this.matchedRowEle && !isClearValues && val) {
|
|
1172
1267
|
setTimeout(function () {
|
|
1173
|
-
|
|
1174
|
-
_this.
|
|
1268
|
+
var prevOnChange = _this.isProtectedOnChange;
|
|
1269
|
+
_this.isProtectedOnChange = true;
|
|
1270
|
+
var fieldText = _this.updateFieldValue(_this.fields.text, _this.matchedContent);
|
|
1271
|
+
var fieldValue = _this.updateFieldValue(_this.fields.value, _this.matchedContent);
|
|
1272
|
+
_this.inputEle.value = fieldText;
|
|
1273
|
+
_this.value = fieldValue;
|
|
1175
1274
|
var selectIndex = _this.findIndex(_this.gridObj.currentViewData, _this.matchedContent);
|
|
1176
1275
|
_this.index = selectIndex;
|
|
1177
|
-
_this.text =
|
|
1276
|
+
_this.text = fieldText;
|
|
1178
1277
|
_this.gridObj.selectRow(selectIndex);
|
|
1179
1278
|
_this.selectedGridRow(_this.gridObj.getRowByIndex(selectIndex), e);
|
|
1180
1279
|
_this.previousItemElement = _this.gridObj.getSelectedRows()[0];
|
|
1280
|
+
_this.isProtectedOnChange = prevOnChange;
|
|
1181
1281
|
}, 100);
|
|
1182
|
-
this.isProtectedOnChange = prevOnChange;
|
|
1183
1282
|
}
|
|
1184
1283
|
else {
|
|
1185
1284
|
if (this.isDataFiltered) {
|
|
@@ -1250,7 +1349,7 @@ var MultiColumnComboBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
1250
1349
|
this.updateSelectedItem(e, true, true);
|
|
1251
1350
|
break;
|
|
1252
1351
|
case 'enter':
|
|
1253
|
-
this.updateValuesOnInput(null, e);
|
|
1352
|
+
this.updateValuesOnInput(null, e, false, true);
|
|
1254
1353
|
this.focusIn(e);
|
|
1255
1354
|
break;
|
|
1256
1355
|
case 'home':
|
|
@@ -1260,31 +1359,19 @@ var MultiColumnComboBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
1260
1359
|
}
|
|
1261
1360
|
};
|
|
1262
1361
|
MultiColumnComboBox.prototype.gridKeyActionHandler = function (e, isGroup) {
|
|
1362
|
+
var keyActionMap = {
|
|
1363
|
+
'ArrowDown': 'moveDown',
|
|
1364
|
+
'ArrowUp': 'moveUp',
|
|
1365
|
+
'End': 'end',
|
|
1366
|
+
'Home': 'home',
|
|
1367
|
+
'Tab': 'tab',
|
|
1368
|
+
'Escape': 'escape',
|
|
1369
|
+
'Shift+Tab': 'shiftTab',
|
|
1370
|
+
'Alt+ArrowUp': 'altUp'
|
|
1371
|
+
};
|
|
1263
1372
|
if (isGroup) {
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
}
|
|
1267
|
-
else if (e.key === 'ArrowUp') {
|
|
1268
|
-
e.action = 'moveUp';
|
|
1269
|
-
}
|
|
1270
|
-
else if (e.key === 'End') {
|
|
1271
|
-
e.action = 'end';
|
|
1272
|
-
}
|
|
1273
|
-
else if (e.key === 'Home') {
|
|
1274
|
-
e.action = 'home';
|
|
1275
|
-
}
|
|
1276
|
-
else if (e.key === 'Tab') {
|
|
1277
|
-
e.action = 'tab';
|
|
1278
|
-
}
|
|
1279
|
-
else if (e.key === 'Escape') {
|
|
1280
|
-
e.action = 'escape';
|
|
1281
|
-
}
|
|
1282
|
-
if (e.shiftKey && e.key === 'Tab') {
|
|
1283
|
-
e.action = 'shiftTab';
|
|
1284
|
-
}
|
|
1285
|
-
if (e.altKey && e.key === 'ArrowUp') {
|
|
1286
|
-
e.action = 'altUp';
|
|
1287
|
-
}
|
|
1373
|
+
var key = "" + (e.altKey ? 'Alt+' : '') + (e.shiftKey ? 'Shift+' : '') + e.key;
|
|
1374
|
+
e.action = keyActionMap[key] || e.action;
|
|
1288
1375
|
}
|
|
1289
1376
|
switch (e.action) {
|
|
1290
1377
|
case 'escape':
|
|
@@ -1352,6 +1439,25 @@ var MultiColumnComboBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
1352
1439
|
clearIconEle.style.display = this.inputEle.value === '' ? 'none' : 'flex';
|
|
1353
1440
|
}
|
|
1354
1441
|
};
|
|
1442
|
+
MultiColumnComboBox.prototype.updateDynamicDataSource = function (newDataSource, oldDataSource) {
|
|
1443
|
+
if (this.gridObj) {
|
|
1444
|
+
var dataLength_1;
|
|
1445
|
+
this.gridObj.dataSource = newDataSource;
|
|
1446
|
+
var isRemoteData = oldDataSource instanceof DataManager;
|
|
1447
|
+
if (isRemoteData) {
|
|
1448
|
+
oldDataSource.executeQuery(new Query()).then(function (e) {
|
|
1449
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1450
|
+
dataLength_1 = e.result.length;
|
|
1451
|
+
});
|
|
1452
|
+
}
|
|
1453
|
+
else {
|
|
1454
|
+
dataLength_1 = oldDataSource.length;
|
|
1455
|
+
}
|
|
1456
|
+
if (dataLength_1 === 0) {
|
|
1457
|
+
this.popupDiv.appendChild(this.gridEle);
|
|
1458
|
+
}
|
|
1459
|
+
}
|
|
1460
|
+
};
|
|
1355
1461
|
/**
|
|
1356
1462
|
* Sets the focus to the component for interaction.component for interaction.
|
|
1357
1463
|
*
|
|
@@ -1433,11 +1539,12 @@ var MultiColumnComboBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
1433
1539
|
var contentEle = _this.gridObj.getContent();
|
|
1434
1540
|
if (contentEle) {
|
|
1435
1541
|
var activeRow = contentEle.querySelector('.e-rowcell.e-active');
|
|
1542
|
+
var firstRow = contentEle.querySelector('.e-row');
|
|
1436
1543
|
if (activeRow) {
|
|
1437
1544
|
_this.inputEle.setAttribute('aria-activedescendant', activeRow.parentElement.getAttribute('data-uid'));
|
|
1438
1545
|
}
|
|
1439
|
-
else if (
|
|
1440
|
-
_this.inputEle.setAttribute('aria-activedescendant',
|
|
1546
|
+
else if (firstRow) {
|
|
1547
|
+
_this.inputEle.setAttribute('aria-activedescendant', firstRow.getAttribute('data-uid'));
|
|
1441
1548
|
}
|
|
1442
1549
|
}
|
|
1443
1550
|
if (!isNullOrUndefined(_this.dataSource) && _this.dataSource instanceof DataManager) {
|
|
@@ -1460,24 +1567,21 @@ var MultiColumnComboBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
1460
1567
|
var _this = this;
|
|
1461
1568
|
var animModel = { name: 'FadeOut', duration: 100 };
|
|
1462
1569
|
var eventArgs = { popup: this.popupObj, event: e || null, cancel: false, animation: animModel };
|
|
1570
|
+
var target = e ? e.target : null;
|
|
1463
1571
|
this.trigger('close', eventArgs, function (eventArgs) {
|
|
1464
1572
|
if (!eventArgs.cancel) {
|
|
1465
1573
|
_this.isPopupOpen = false;
|
|
1466
1574
|
removeClass([_this.inputWrapper], [ICONANIMATION]);
|
|
1467
1575
|
attributes(_this.inputEle, { 'aria-expanded': 'false' });
|
|
1468
1576
|
_this.popupObj.hide(new Animation(eventArgs.animation));
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
if (target && (target.classList.contains('e-multicolumn-list-icon') || target.classList.contains('e-rowcell'))) {
|
|
1473
|
-
if (!_this.value) {
|
|
1474
|
-
_this.gridObj.refreshColumns();
|
|
1475
|
-
}
|
|
1476
|
-
setTimeout(function () { _this.focusIn(e); });
|
|
1477
|
-
}
|
|
1478
|
-
else {
|
|
1479
|
-
_this.focusOut();
|
|
1577
|
+
if (target && (target.classList.contains('e-multicolumn-list-icon') || target.classList.contains('e-rowcell'))) {
|
|
1578
|
+
if (!_this.value) {
|
|
1579
|
+
_this.gridObj.refreshColumns();
|
|
1480
1580
|
}
|
|
1581
|
+
setTimeout(function () { _this.focusIn(e); });
|
|
1582
|
+
}
|
|
1583
|
+
else {
|
|
1584
|
+
_this.focusOut();
|
|
1481
1585
|
}
|
|
1482
1586
|
_this.inputEle.removeAttribute('aria-owns');
|
|
1483
1587
|
_this.inputEle.removeAttribute('aria-activedescendant');
|
|
@@ -1525,7 +1629,8 @@ var MultiColumnComboBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
1525
1629
|
var _this = this;
|
|
1526
1630
|
if (!isNullOrUndefined(this.dataSource) && this.dataSource instanceof Array) {
|
|
1527
1631
|
return this.dataSource.filter(function (item) {
|
|
1528
|
-
|
|
1632
|
+
var fieldValue = _this.updateFieldValue(_this.fields.value, item);
|
|
1633
|
+
return fieldValue === value;
|
|
1529
1634
|
})[0];
|
|
1530
1635
|
}
|
|
1531
1636
|
else if (!isNullOrUndefined(this.dataSource) && this.dataSource instanceof DataManager) {
|
|
@@ -1533,7 +1638,8 @@ var MultiColumnComboBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
1533
1638
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1534
1639
|
var dataLists = e.result;
|
|
1535
1640
|
return dataLists.filter(function (item) {
|
|
1536
|
-
|
|
1641
|
+
var fieldValue = _this.updateFieldValue(_this.fields.value, item);
|
|
1642
|
+
return fieldValue === value;
|
|
1537
1643
|
})[0];
|
|
1538
1644
|
});
|
|
1539
1645
|
}
|
|
@@ -1685,9 +1791,7 @@ var MultiColumnComboBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
1685
1791
|
}
|
|
1686
1792
|
break;
|
|
1687
1793
|
case 'dataSource':
|
|
1688
|
-
|
|
1689
|
-
this.gridObj.dataSource = newProp.dataSource;
|
|
1690
|
-
}
|
|
1794
|
+
this.updateDynamicDataSource(newProp.dataSource, oldProp.dataSource);
|
|
1691
1795
|
break;
|
|
1692
1796
|
case 'query':
|
|
1693
1797
|
if (this.gridObj) {
|