@syncfusion/ej2-multicolumn-combobox 27.2.4 → 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.
- 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 +222 -177
- package/dist/es6/ej2-multicolumn-combobox.es2015.js.map +1 -1
- package/dist/es6/ej2-multicolumn-combobox.es5.js +263 -178
- 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 -8
- package/src/global.js +0 -2
- package/src/multicolumn-combobox/index.d.ts +1 -2
- package/src/multicolumn-combobox/index.js +1 -2
- package/src/multicolumn-combobox/multi-column-combo-box-model.d.ts +1 -1
- package/src/multicolumn-combobox/multi-column-combo-box.d.ts +5 -0
- package/src/multicolumn-combobox/multi-column-combo-box.js +265 -179
- 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 } 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,29 +363,25 @@ 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
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
if (_this.isPopupOpen) {
|
|
335
|
-
_this.selectedGridRow(_this.gridObj.getRows()[_this.gridObj.selectedRowIndex], args, true);
|
|
336
|
-
_this.hidePopup(args);
|
|
337
|
-
_this.focusIn(args);
|
|
338
|
-
}
|
|
366
|
+
keyPressed: this.handleKeyPressed.bind(this),
|
|
367
|
+
resizing: function (args) {
|
|
368
|
+
if (_this.gridSettings.resizing) {
|
|
369
|
+
_this.gridSettings.resizing.call(_this, args);
|
|
339
370
|
}
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
_this.
|
|
371
|
+
},
|
|
372
|
+
resizeStart: function (args) {
|
|
373
|
+
if (_this.gridSettings.resizeStart) {
|
|
374
|
+
_this.gridSettings.resizeStart.call(_this, args);
|
|
344
375
|
}
|
|
345
376
|
},
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
377
|
+
resizeStop: function (args) {
|
|
378
|
+
if (_this.gridSettings.resizeStop) {
|
|
379
|
+
_this.gridSettings.resizeStop.call(_this, args);
|
|
380
|
+
}
|
|
381
|
+
}
|
|
349
382
|
});
|
|
350
383
|
this.gridEle = this.createElement('div', { id: getUniqueID('grid'), className: MULTICOLUMNGRID });
|
|
351
384
|
this.updateGroupByField();
|
|
352
|
-
var sortOrder = this.sortOrder.toString().toLowerCase();
|
|
353
385
|
if (gridColumns.length > 0) {
|
|
354
386
|
// Set first column as primary key to avoid PRIMARY KEY MISSING warning.
|
|
355
387
|
this.gridObj.columns[0].isPrimaryKey = true;
|
|
@@ -368,25 +400,39 @@ var MultiColumnComboBox = /** @class */ (function (_super) {
|
|
|
368
400
|
this.popupObj.refreshPosition();
|
|
369
401
|
this.gridObj.element.querySelector('.e-content').scrollTop = 0;
|
|
370
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
|
+
};
|
|
371
419
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
372
420
|
MultiColumnComboBox.prototype.isRowMatching = function (data, selectedValue, selectedText) {
|
|
373
421
|
var values = Object.values(data).map(String);
|
|
374
|
-
|
|
375
|
-
return isRowPresent;
|
|
422
|
+
return values.includes(selectedValue) && values.includes(selectedText);
|
|
376
423
|
};
|
|
377
424
|
MultiColumnComboBox.prototype.updateRowSelection = function (args) {
|
|
378
425
|
var _this = this;
|
|
379
426
|
if (args) {
|
|
380
427
|
var dataRows = args.rows;
|
|
381
428
|
dataRows.forEach(function (row) {
|
|
382
|
-
|
|
383
|
-
var index = row.index;
|
|
384
|
-
_this.selectDataRow(data, index);
|
|
429
|
+
_this.selectDataRow(row.data, row.index);
|
|
385
430
|
});
|
|
386
431
|
}
|
|
387
432
|
};
|
|
388
433
|
MultiColumnComboBox.prototype.selectDataRow = function (data, index) {
|
|
389
|
-
var isPresent = this.isRowMatching(data, this.value ?
|
|
434
|
+
var isPresent = this.isRowMatching(data, this.value ?
|
|
435
|
+
this.value.toString() : '', this.text ? this.text.toString() : '');
|
|
390
436
|
if (isPresent) {
|
|
391
437
|
this.gridObj.selectRow(index);
|
|
392
438
|
var prevOnChange = this.isProtectedOnChange;
|
|
@@ -402,30 +448,28 @@ var MultiColumnComboBox = /** @class */ (function (_super) {
|
|
|
402
448
|
return Object.keys(obj).every(function (key) { return item[key] === obj[key]; });
|
|
403
449
|
});
|
|
404
450
|
};
|
|
405
|
-
/* eslint-enable @typescript-eslint/no-explicit-any */
|
|
406
451
|
MultiColumnComboBox.prototype.getGridColumns = function () {
|
|
407
452
|
var _this = this;
|
|
408
|
-
return this.columns.map(function (
|
|
409
|
-
var
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
customAttributes: column.customAttributes,
|
|
423
|
-
type: changeType
|
|
424
|
-
};
|
|
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
|
+
});
|
|
425
467
|
});
|
|
426
468
|
};
|
|
427
469
|
MultiColumnComboBox.prototype.updateGroupByField = function () {
|
|
428
|
-
|
|
470
|
+
var groupByField = this.fields.groupBy;
|
|
471
|
+
var isGroupByValid = groupByField !== '' && !isNOU(groupByField);
|
|
472
|
+
if (isGroupByValid) {
|
|
429
473
|
if (this.sortType.toString().toLowerCase() !== 'multiplecolumns') {
|
|
430
474
|
this.gridEle.classList.add('e-multicolumn-group');
|
|
431
475
|
}
|
|
@@ -434,10 +478,11 @@ var MultiColumnComboBox = /** @class */ (function (_super) {
|
|
|
434
478
|
this.gridObj.allowGrouping = true;
|
|
435
479
|
this.gridObj.groupSettings = {
|
|
436
480
|
showDropArea: false,
|
|
437
|
-
columns: [
|
|
438
|
-
captionTemplate: (this.groupTemplate && this.fields.groupBy !== '' && !isNOU(this.fields.groupBy))
|
|
439
|
-
? this.groupTemplate : '${key}'
|
|
481
|
+
columns: [groupByField]
|
|
440
482
|
};
|
|
483
|
+
if (this.groupTemplate && isGroupByValid) {
|
|
484
|
+
this.gridObj.groupSettings.captionTemplate = this.groupTemplate;
|
|
485
|
+
}
|
|
441
486
|
if (this.isVue) {
|
|
442
487
|
this.gridObj.isVue = this.isVue;
|
|
443
488
|
}
|
|
@@ -447,12 +492,13 @@ var MultiColumnComboBox = /** @class */ (function (_super) {
|
|
|
447
492
|
MultiColumnComboBox.prototype.onDataBound = function () {
|
|
448
493
|
var dataCount = this.dataSource.length;
|
|
449
494
|
var popupChild = this.popupDiv.querySelector('.' + MULTICOLUMNGRID);
|
|
495
|
+
var hasNoDataClass = this.popupDiv.classList.contains(NODATA);
|
|
450
496
|
if (dataCount <= 0 && popupChild) {
|
|
451
497
|
this.l10nUpdate();
|
|
452
498
|
this.popupDiv.removeChild(this.gridEle);
|
|
453
499
|
addClass([this.popupDiv], [NODATA]);
|
|
454
500
|
}
|
|
455
|
-
else if (
|
|
501
|
+
else if (hasNoDataClass && dataCount >= 1) {
|
|
456
502
|
removeClass([this.popupDiv], [NODATA]);
|
|
457
503
|
var noRecordEle = this.popupDiv.querySelector('.e-no-records');
|
|
458
504
|
if (noRecordEle) {
|
|
@@ -460,8 +506,9 @@ var MultiColumnComboBox = /** @class */ (function (_super) {
|
|
|
460
506
|
}
|
|
461
507
|
}
|
|
462
508
|
if (this.isInitialRender) {
|
|
463
|
-
var
|
|
464
|
-
|
|
509
|
+
var gridContentRow = this.popupDiv.querySelector('.e-gridcontent tr');
|
|
510
|
+
var rowHeight = !hasNoDataClass ? gridContentRow ?
|
|
511
|
+
gridContentRow.getBoundingClientRect().height : 0 :
|
|
465
512
|
this.popupDiv.getBoundingClientRect().height;
|
|
466
513
|
this.popupRowHeight = rowHeight;
|
|
467
514
|
this.popupObj.hide();
|
|
@@ -480,6 +527,16 @@ var MultiColumnComboBox = /** @class */ (function (_super) {
|
|
|
480
527
|
addClass([this.popupDiv], [NODATA]);
|
|
481
528
|
};
|
|
482
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
|
+
};
|
|
483
540
|
if (this.element.tagName === 'INPUT') {
|
|
484
541
|
this.inputEle = this.element;
|
|
485
542
|
if (isNOU(this.inputEle.getAttribute('role'))) {
|
|
@@ -488,13 +545,15 @@ var MultiColumnComboBox = /** @class */ (function (_super) {
|
|
|
488
545
|
if (isNOU(this.inputEle.getAttribute('type'))) {
|
|
489
546
|
this.inputEle.setAttribute('type', 'text');
|
|
490
547
|
}
|
|
491
|
-
this.inputEle
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
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
|
+
});
|
|
498
557
|
}
|
|
499
558
|
else {
|
|
500
559
|
this.inputEle = this.createElement('input', { attrs: { role: 'textbox', type: 'text' } });
|
|
@@ -524,49 +583,53 @@ var MultiColumnComboBox = /** @class */ (function (_super) {
|
|
|
524
583
|
this.initValue(null, null, true);
|
|
525
584
|
}
|
|
526
585
|
};
|
|
527
|
-
/* To calculate the width when change via set model */
|
|
528
586
|
MultiColumnComboBox.prototype.setElementWidth = function (inputWidth) {
|
|
587
|
+
if (isNOU(inputWidth)) {
|
|
588
|
+
return;
|
|
589
|
+
}
|
|
529
590
|
var ddElement = this.inputWrapper;
|
|
530
|
-
if (
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
ddElement.style.width = (inputWidth.match(/px|%|em/)) ? (inputWidth) : (formatUnit(inputWidth));
|
|
536
|
-
}
|
|
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);
|
|
537
596
|
}
|
|
538
597
|
};
|
|
539
598
|
MultiColumnComboBox.prototype.setHTMLAttributes = function () {
|
|
540
|
-
|
|
541
|
-
|
|
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++) {
|
|
542
603
|
var htmlAttr = _a[_i];
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
'role', 'autocomplete', 'autocapitalize', 'spellcheck', 'minlength', 'maxlength'];
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
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
|
+
}
|
|
563
628
|
}
|
|
564
629
|
else {
|
|
565
|
-
|
|
630
|
+
inputEle.setAttribute(htmlAttr, htmlAttributes[htmlAttr]);
|
|
566
631
|
}
|
|
567
|
-
|
|
568
|
-
else {
|
|
569
|
-
this.inputEle.setAttribute(htmlAttr, this.htmlAttributes["" + htmlAttr]);
|
|
632
|
+
break;
|
|
570
633
|
}
|
|
571
634
|
}
|
|
572
635
|
}
|
|
@@ -577,8 +640,7 @@ var MultiColumnComboBox = /** @class */ (function (_super) {
|
|
|
577
640
|
Input.setEnabled(!this.disabled, this.inputEle);
|
|
578
641
|
if (!this.disabled) {
|
|
579
642
|
removeClass([this.inputWrapper], DISABLED);
|
|
580
|
-
this.
|
|
581
|
-
this.inputWrapper.setAttribute('aria-disabled', 'false');
|
|
643
|
+
this.setAriaDisabled('false');
|
|
582
644
|
}
|
|
583
645
|
else {
|
|
584
646
|
if (this.isPopupOpen) {
|
|
@@ -588,10 +650,13 @@ var MultiColumnComboBox = /** @class */ (function (_super) {
|
|
|
588
650
|
if (this.inputWrapper && this.inputWrapper.classList.contains(INPUTFOCUS)) {
|
|
589
651
|
removeClass([this.inputWrapper], [INPUTFOCUS]);
|
|
590
652
|
}
|
|
591
|
-
this.
|
|
592
|
-
this.inputWrapper.setAttribute('aria-disabled', 'true');
|
|
653
|
+
this.setAriaDisabled('true');
|
|
593
654
|
}
|
|
594
655
|
};
|
|
656
|
+
MultiColumnComboBox.prototype.setAriaDisabled = function (value) {
|
|
657
|
+
this.inputEle.setAttribute('aria-disabled', value);
|
|
658
|
+
this.inputWrapper.setAttribute('aria-disabled', value);
|
|
659
|
+
};
|
|
595
660
|
MultiColumnComboBox.prototype.initValue = function (isRerender, isValue, isInitial) {
|
|
596
661
|
var _this = this;
|
|
597
662
|
var prevItemData = this.gridObj.getSelectedRecords()[0];
|
|
@@ -853,7 +918,7 @@ var MultiColumnComboBox = /** @class */ (function (_super) {
|
|
|
853
918
|
MultiColumnComboBox.prototype.getSize = function (ispopupWidth) {
|
|
854
919
|
var currentDimension = ispopupWidth ? this.popupWidth : this.popupHeight;
|
|
855
920
|
var size = formatUnit(currentDimension);
|
|
856
|
-
if (size.
|
|
921
|
+
if (size.includes('%')) {
|
|
857
922
|
var dimensionValue = ispopupWidth ? this.inputWrapper.offsetWidth : document.documentElement.clientHeight;
|
|
858
923
|
size = (dimensionValue * parseFloat(size) / 100).toString() + 'px';
|
|
859
924
|
}
|
|
@@ -905,8 +970,8 @@ var MultiColumnComboBox = /** @class */ (function (_super) {
|
|
|
905
970
|
this.previousItemElement = eventArgs.itemElement;
|
|
906
971
|
var prevOnChange = this.isProtectedOnChange;
|
|
907
972
|
this.isProtectedOnChange = true;
|
|
908
|
-
this.text = text
|
|
909
|
-
this.value = value
|
|
973
|
+
this.text = text || this.text;
|
|
974
|
+
this.value = value || this.value;
|
|
910
975
|
this.index = !isNOU(index) ? index : this.index;
|
|
911
976
|
this.isProtectedOnChange = prevOnChange;
|
|
912
977
|
if (!isInitial) {
|
|
@@ -949,45 +1014,57 @@ var MultiColumnComboBox = /** @class */ (function (_super) {
|
|
|
949
1014
|
this.updateInputValue(e.target.value);
|
|
950
1015
|
};
|
|
951
1016
|
MultiColumnComboBox.prototype.updateInputValue = function (inputValue) {
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
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
|
+
}
|
|
968
1039
|
});
|
|
969
|
-
|
|
970
|
-
}
|
|
1040
|
+
});
|
|
971
1041
|
};
|
|
972
|
-
MultiColumnComboBox.prototype.
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
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;
|
|
985
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);
|
|
986
1061
|
};
|
|
987
1062
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
988
1063
|
MultiColumnComboBox.prototype.filterAction = function (dataSource, inputValue, query, fields) {
|
|
989
1064
|
var _this = this;
|
|
990
|
-
|
|
1065
|
+
var isQuery = query || new Query();
|
|
1066
|
+
var filterType = this.filterType.toString().toLowerCase();
|
|
1067
|
+
if (isNOU(query) && isNOU(fields)) {
|
|
991
1068
|
this.updateGridDataSource(dataSource);
|
|
992
1069
|
}
|
|
993
1070
|
else if (query) {
|
|
@@ -1003,14 +1080,12 @@ var MultiColumnComboBox = /** @class */ (function (_super) {
|
|
|
1003
1080
|
}
|
|
1004
1081
|
}
|
|
1005
1082
|
else {
|
|
1006
|
-
var isQuery = query || new Query();
|
|
1007
1083
|
if (dataSource instanceof DataManager) {
|
|
1008
1084
|
this.filteringHandler(dataSource, inputValue, isQuery, fields);
|
|
1009
1085
|
}
|
|
1010
1086
|
else if (Array.isArray(dataSource)) {
|
|
1011
|
-
var filterType_1 = this.filterType.toString().toLowerCase();
|
|
1012
1087
|
var filteredData = dataSource.filter(function (item) {
|
|
1013
|
-
return _this.filterData(item,
|
|
1088
|
+
return _this.filterData(item, filterType, inputValue, fields);
|
|
1014
1089
|
});
|
|
1015
1090
|
this.updateGridDataSource(filteredData);
|
|
1016
1091
|
}
|
|
@@ -1137,28 +1212,36 @@ var MultiColumnComboBox = /** @class */ (function (_super) {
|
|
|
1137
1212
|
}
|
|
1138
1213
|
};
|
|
1139
1214
|
MultiColumnComboBox.prototype.onDocumentClick = function (e) {
|
|
1215
|
+
var target = e.target;
|
|
1140
1216
|
if (this.disabled || this.readonly || !this.isPopupOpen) {
|
|
1141
|
-
if (!
|
|
1217
|
+
if (!target.closest('.e-multicolumn-list')) {
|
|
1142
1218
|
this.focusOut();
|
|
1143
1219
|
}
|
|
1144
1220
|
return;
|
|
1145
1221
|
}
|
|
1146
|
-
var target = e.target;
|
|
1147
1222
|
if ((target.classList.contains('e-multicolumn-list-icon') || closest(target, '.e-popup'))) {
|
|
1148
1223
|
e.preventDefault();
|
|
1149
1224
|
}
|
|
1150
1225
|
else {
|
|
1151
1226
|
if (!target.classList.contains('e-multicolumncombobox') && !target.classList.contains('e-clear-icon')) {
|
|
1227
|
+
if (!isNOU(this.text)) {
|
|
1228
|
+
this.updateInputValue(this.text);
|
|
1229
|
+
}
|
|
1152
1230
|
this.updateValuesOnInput(e);
|
|
1153
1231
|
}
|
|
1154
1232
|
}
|
|
1155
1233
|
};
|
|
1156
|
-
MultiColumnComboBox.prototype.updateValuesOnInput = function (mouseEvent, keyEvent, isClearValues) {
|
|
1234
|
+
MultiColumnComboBox.prototype.updateValuesOnInput = function (mouseEvent, keyEvent, isClearValues, isKeyDown) {
|
|
1157
1235
|
var _this = this;
|
|
1158
1236
|
if (isClearValues === void 0) { isClearValues = false; }
|
|
1237
|
+
if (isKeyDown === void 0) { isKeyDown = false; }
|
|
1159
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
|
+
}
|
|
1160
1243
|
this.hidePopup(e);
|
|
1161
|
-
if (this.matchedRowEle && !isClearValues) {
|
|
1244
|
+
if (this.matchedRowEle && !isClearValues && val) {
|
|
1162
1245
|
var prevOnChange = this.isProtectedOnChange;
|
|
1163
1246
|
this.isProtectedOnChange = true;
|
|
1164
1247
|
setTimeout(function () {
|
|
@@ -1242,7 +1325,7 @@ var MultiColumnComboBox = /** @class */ (function (_super) {
|
|
|
1242
1325
|
this.updateSelectedItem(e, true, true);
|
|
1243
1326
|
break;
|
|
1244
1327
|
case 'enter':
|
|
1245
|
-
this.updateValuesOnInput(null, e);
|
|
1328
|
+
this.updateValuesOnInput(null, e, false, true);
|
|
1246
1329
|
this.focusIn(e);
|
|
1247
1330
|
break;
|
|
1248
1331
|
case 'home':
|
|
@@ -1252,31 +1335,19 @@ var MultiColumnComboBox = /** @class */ (function (_super) {
|
|
|
1252
1335
|
}
|
|
1253
1336
|
};
|
|
1254
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
|
+
};
|
|
1255
1348
|
if (isGroup) {
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
}
|
|
1259
|
-
else if (e.key === 'ArrowUp') {
|
|
1260
|
-
e.action = 'moveUp';
|
|
1261
|
-
}
|
|
1262
|
-
else if (e.key === 'End') {
|
|
1263
|
-
e.action = 'end';
|
|
1264
|
-
}
|
|
1265
|
-
else if (e.key === 'Home') {
|
|
1266
|
-
e.action = 'home';
|
|
1267
|
-
}
|
|
1268
|
-
else if (e.key === 'Tab') {
|
|
1269
|
-
e.action = 'tab';
|
|
1270
|
-
}
|
|
1271
|
-
else if (e.key === 'Escape') {
|
|
1272
|
-
e.action = 'escape';
|
|
1273
|
-
}
|
|
1274
|
-
if (e.shiftKey && e.key === 'Tab') {
|
|
1275
|
-
e.action = 'shiftTab';
|
|
1276
|
-
}
|
|
1277
|
-
if (e.altKey && e.key === 'ArrowUp') {
|
|
1278
|
-
e.action = 'altUp';
|
|
1279
|
-
}
|
|
1349
|
+
var key = "" + (e.altKey ? 'Alt+' : '') + (e.shiftKey ? 'Shift+' : '') + e.key;
|
|
1350
|
+
e.action = keyActionMap[key] || e.action;
|
|
1280
1351
|
}
|
|
1281
1352
|
switch (e.action) {
|
|
1282
1353
|
case 'escape':
|
|
@@ -1344,6 +1415,25 @@ var MultiColumnComboBox = /** @class */ (function (_super) {
|
|
|
1344
1415
|
clearIconEle.style.display = this.inputEle.value === '' ? 'none' : 'flex';
|
|
1345
1416
|
}
|
|
1346
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
|
+
};
|
|
1347
1437
|
/**
|
|
1348
1438
|
* Sets the focus to the component for interaction.component for interaction.
|
|
1349
1439
|
*
|
|
@@ -1425,11 +1515,12 @@ var MultiColumnComboBox = /** @class */ (function (_super) {
|
|
|
1425
1515
|
var contentEle = _this.gridObj.getContent();
|
|
1426
1516
|
if (contentEle) {
|
|
1427
1517
|
var activeRow = contentEle.querySelector('.e-rowcell.e-active');
|
|
1518
|
+
var firstRow = contentEle.querySelector('.e-row');
|
|
1428
1519
|
if (activeRow) {
|
|
1429
1520
|
_this.inputEle.setAttribute('aria-activedescendant', activeRow.parentElement.getAttribute('data-uid'));
|
|
1430
1521
|
}
|
|
1431
|
-
else if (
|
|
1432
|
-
_this.inputEle.setAttribute('aria-activedescendant',
|
|
1522
|
+
else if (firstRow) {
|
|
1523
|
+
_this.inputEle.setAttribute('aria-activedescendant', firstRow.getAttribute('data-uid'));
|
|
1433
1524
|
}
|
|
1434
1525
|
}
|
|
1435
1526
|
if (!isNOU(_this.dataSource) && _this.dataSource instanceof DataManager) {
|
|
@@ -1452,24 +1543,21 @@ var MultiColumnComboBox = /** @class */ (function (_super) {
|
|
|
1452
1543
|
var _this = this;
|
|
1453
1544
|
var animModel = { name: 'FadeOut', duration: 100 };
|
|
1454
1545
|
var eventArgs = { popup: this.popupObj, event: e || null, cancel: false, animation: animModel };
|
|
1546
|
+
var target = e ? e.target : null;
|
|
1455
1547
|
this.trigger('close', eventArgs, function (eventArgs) {
|
|
1456
1548
|
if (!eventArgs.cancel) {
|
|
1457
1549
|
_this.isPopupOpen = false;
|
|
1458
1550
|
removeClass([_this.inputWrapper], [ICONANIMATION]);
|
|
1459
1551
|
attributes(_this.inputEle, { 'aria-expanded': 'false' });
|
|
1460
1552
|
_this.popupObj.hide(new Animation(eventArgs.animation));
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
if (target && (target.classList.contains('e-multicolumn-list-icon') || target.classList.contains('e-rowcell'))) {
|
|
1465
|
-
if (!_this.value) {
|
|
1466
|
-
_this.gridObj.refreshColumns();
|
|
1467
|
-
}
|
|
1468
|
-
setTimeout(function () { _this.focusIn(e); });
|
|
1469
|
-
}
|
|
1470
|
-
else {
|
|
1471
|
-
_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();
|
|
1472
1556
|
}
|
|
1557
|
+
setTimeout(function () { _this.focusIn(e); });
|
|
1558
|
+
}
|
|
1559
|
+
else {
|
|
1560
|
+
_this.focusOut();
|
|
1473
1561
|
}
|
|
1474
1562
|
_this.inputEle.removeAttribute('aria-owns');
|
|
1475
1563
|
_this.inputEle.removeAttribute('aria-activedescendant');
|
|
@@ -1677,9 +1765,7 @@ var MultiColumnComboBox = /** @class */ (function (_super) {
|
|
|
1677
1765
|
}
|
|
1678
1766
|
break;
|
|
1679
1767
|
case 'dataSource':
|
|
1680
|
-
|
|
1681
|
-
this.gridObj.dataSource = newProp.dataSource;
|
|
1682
|
-
}
|
|
1768
|
+
this.updateDynamicDataSource(newProp.dataSource, oldProp.dataSource);
|
|
1683
1769
|
break;
|
|
1684
1770
|
case 'query':
|
|
1685
1771
|
if (this.gridObj) {
|