@syncfusion/ej2-multicolumn-combobox 27.2.5 → 28.1.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +210 -177
- package/dist/es6/ej2-multicolumn-combobox.es2015.js.map +1 -1
- package/dist/es6/ej2-multicolumn-combobox.es5.js +251 -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 +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 +5 -0
- package/src/multicolumn-combobox/multi-column-combo-box.js +253 -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
|
@@ -3,7 +3,6 @@ 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 __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
9
8
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -11,6 +10,14 @@ var __decorate = (undefined && undefined.__decorate) || function (decorators, ta
|
|
|
11
10
|
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;
|
|
12
11
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
13
12
|
};
|
|
13
|
+
var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
15
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
16
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
17
|
+
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
|
18
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
19
|
+
});
|
|
20
|
+
};
|
|
14
21
|
const DROPDOWNICON = 'e-input-group-icon e-multicolumn-list-icon e-icons';
|
|
15
22
|
const CONTENT = 'e-popup-content';
|
|
16
23
|
const ICONANIMATION = 'e-icon-anim';
|
|
@@ -223,7 +230,7 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
|
|
|
223
230
|
moveDown: 'downarrow',
|
|
224
231
|
moveUp: 'uparrow'
|
|
225
232
|
};
|
|
226
|
-
this.matchedRowEle = this.matchedContent = null;
|
|
233
|
+
this.matchedRowEle = this.matchedContent = this.exactMatchedContent = null;
|
|
227
234
|
this.persistData();
|
|
228
235
|
}
|
|
229
236
|
getDirective() {
|
|
@@ -249,7 +256,7 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
|
|
|
249
256
|
}
|
|
250
257
|
persistData() {
|
|
251
258
|
if (this.enablePersistence) {
|
|
252
|
-
this.element.id
|
|
259
|
+
this.element.id += '_wrapper';
|
|
253
260
|
const data = window.localStorage.getItem(this.getModuleName() + this.element.id);
|
|
254
261
|
if (!(isNullOrUndefined(data) || (data === ''))) {
|
|
255
262
|
this.setProperties(JSON.parse(data), true);
|
|
@@ -267,6 +274,7 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
|
|
|
267
274
|
}
|
|
268
275
|
renderGrid() {
|
|
269
276
|
const gridColumns = this.getGridColumns();
|
|
277
|
+
const sortOrder = this.sortOrder.toString().toLowerCase();
|
|
270
278
|
this.gridObj = new Grid({
|
|
271
279
|
dataSource: this.dataSource,
|
|
272
280
|
columns: gridColumns,
|
|
@@ -289,22 +297,7 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
|
|
|
289
297
|
actionFailure: (args) => { this.onActionFailure(args); },
|
|
290
298
|
actionBegin: (args) => { this.trigger('actionBegin', args); },
|
|
291
299
|
actionComplete: this.handleActionComplete.bind(this),
|
|
292
|
-
keyPressed: (
|
|
293
|
-
if (args.key === 'Enter') {
|
|
294
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
295
|
-
args.cancel = true;
|
|
296
|
-
if (this.isPopupOpen) {
|
|
297
|
-
this.selectedGridRow(this.gridObj.getRows()[this.gridObj.selectedRowIndex], args, true);
|
|
298
|
-
this.hidePopup(args);
|
|
299
|
-
this.focusIn(args);
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
if (this.fields.groupBy) {
|
|
303
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
304
|
-
args.cancel = true;
|
|
305
|
-
this.gridKeyActionHandler(args, true);
|
|
306
|
-
}
|
|
307
|
-
},
|
|
300
|
+
keyPressed: this.handleKeyPressed.bind(this),
|
|
308
301
|
resizing: (args) => {
|
|
309
302
|
if (this.gridSettings.resizing) {
|
|
310
303
|
this.gridSettings.resizing.call(this, args);
|
|
@@ -323,7 +316,6 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
|
|
|
323
316
|
});
|
|
324
317
|
this.gridEle = this.createElement('div', { id: getUniqueID('grid'), className: MULTICOLUMNGRID });
|
|
325
318
|
this.updateGroupByField();
|
|
326
|
-
const sortOrder = this.sortOrder.toString().toLowerCase();
|
|
327
319
|
if (gridColumns.length > 0) {
|
|
328
320
|
// Set first column as primary key to avoid PRIMARY KEY MISSING warning.
|
|
329
321
|
this.gridObj.columns[0].isPrimaryKey = true;
|
|
@@ -342,24 +334,38 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
|
|
|
342
334
|
this.popupObj.refreshPosition();
|
|
343
335
|
this.gridObj.element.querySelector('.e-content').scrollTop = 0;
|
|
344
336
|
}
|
|
337
|
+
handleKeyPressed(args) {
|
|
338
|
+
if (args.key === 'Enter') {
|
|
339
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
340
|
+
args.cancel = true;
|
|
341
|
+
if (this.isPopupOpen) {
|
|
342
|
+
this.selectedGridRow(this.gridObj.getRows()[this.gridObj.selectedRowIndex], args, true);
|
|
343
|
+
this.hidePopup(args);
|
|
344
|
+
this.focusIn(args);
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
if (this.fields.groupBy) {
|
|
348
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
349
|
+
args.cancel = true;
|
|
350
|
+
this.gridKeyActionHandler(args, true);
|
|
351
|
+
}
|
|
352
|
+
}
|
|
345
353
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
346
354
|
isRowMatching(data, selectedValue, selectedText) {
|
|
347
355
|
const values = Object.values(data).map(String);
|
|
348
|
-
|
|
349
|
-
return isRowPresent;
|
|
356
|
+
return values.includes(selectedValue) && values.includes(selectedText);
|
|
350
357
|
}
|
|
351
358
|
updateRowSelection(args) {
|
|
352
359
|
if (args) {
|
|
353
360
|
const dataRows = args.rows;
|
|
354
361
|
dataRows.forEach((row) => {
|
|
355
|
-
|
|
356
|
-
const index = row.index;
|
|
357
|
-
this.selectDataRow(data, index);
|
|
362
|
+
this.selectDataRow(row.data, row.index);
|
|
358
363
|
});
|
|
359
364
|
}
|
|
360
365
|
}
|
|
361
366
|
selectDataRow(data, index) {
|
|
362
|
-
const isPresent = this.isRowMatching(data, this.value ?
|
|
367
|
+
const isPresent = this.isRowMatching(data, this.value ?
|
|
368
|
+
this.value.toString() : '', this.text ? this.text.toString() : '');
|
|
363
369
|
if (isPresent) {
|
|
364
370
|
this.gridObj.selectRow(index);
|
|
365
371
|
const prevOnChange = this.isProtectedOnChange;
|
|
@@ -375,29 +381,24 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
|
|
|
375
381
|
return Object.keys(obj).every((key) => item[key] === obj[key]);
|
|
376
382
|
});
|
|
377
383
|
}
|
|
378
|
-
/* eslint-enable @typescript-eslint/no-explicit-any */
|
|
379
384
|
getGridColumns() {
|
|
380
|
-
return this.columns.map((
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
template: column.template,
|
|
393
|
-
headerTemplate: column.headerTemplate,
|
|
394
|
-
customAttributes: column.customAttributes,
|
|
395
|
-
type: changeType
|
|
396
|
-
};
|
|
397
|
-
});
|
|
385
|
+
return this.columns.map(({ field, header, width, textAlign, format, displayAsCheckBox, template, headerTemplate, customAttributes }) => ({
|
|
386
|
+
field,
|
|
387
|
+
headerText: header,
|
|
388
|
+
width,
|
|
389
|
+
textAlign: textAlign.toString() === '' && this.enableRtl ? 'Right' : textAlign,
|
|
390
|
+
format,
|
|
391
|
+
displayAsCheckBox,
|
|
392
|
+
template,
|
|
393
|
+
headerTemplate,
|
|
394
|
+
customAttributes,
|
|
395
|
+
type: displayAsCheckBox && !format ? 'boolean' : undefined
|
|
396
|
+
}));
|
|
398
397
|
}
|
|
399
398
|
updateGroupByField() {
|
|
400
|
-
|
|
399
|
+
const groupByField = this.fields.groupBy;
|
|
400
|
+
const isGroupByValid = groupByField !== '' && !isNullOrUndefined(groupByField);
|
|
401
|
+
if (isGroupByValid) {
|
|
401
402
|
if (this.sortType.toString().toLowerCase() !== 'multiplecolumns') {
|
|
402
403
|
this.gridEle.classList.add('e-multicolumn-group');
|
|
403
404
|
}
|
|
@@ -406,10 +407,11 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
|
|
|
406
407
|
this.gridObj.allowGrouping = true;
|
|
407
408
|
this.gridObj.groupSettings = {
|
|
408
409
|
showDropArea: false,
|
|
409
|
-
columns: [
|
|
410
|
-
captionTemplate: (this.groupTemplate && this.fields.groupBy !== '' && !isNullOrUndefined(this.fields.groupBy))
|
|
411
|
-
? this.groupTemplate : '${key}'
|
|
410
|
+
columns: [groupByField]
|
|
412
411
|
};
|
|
412
|
+
if (this.groupTemplate && isGroupByValid) {
|
|
413
|
+
this.gridObj.groupSettings.captionTemplate = this.groupTemplate;
|
|
414
|
+
}
|
|
413
415
|
if (this.isVue) {
|
|
414
416
|
this.gridObj.isVue = this.isVue;
|
|
415
417
|
}
|
|
@@ -419,12 +421,13 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
|
|
|
419
421
|
onDataBound() {
|
|
420
422
|
const dataCount = this.dataSource.length;
|
|
421
423
|
const popupChild = this.popupDiv.querySelector('.' + MULTICOLUMNGRID);
|
|
424
|
+
const hasNoDataClass = this.popupDiv.classList.contains(NODATA);
|
|
422
425
|
if (dataCount <= 0 && popupChild) {
|
|
423
426
|
this.l10nUpdate();
|
|
424
427
|
this.popupDiv.removeChild(this.gridEle);
|
|
425
428
|
addClass([this.popupDiv], [NODATA]);
|
|
426
429
|
}
|
|
427
|
-
else if (
|
|
430
|
+
else if (hasNoDataClass && dataCount >= 1) {
|
|
428
431
|
removeClass([this.popupDiv], [NODATA]);
|
|
429
432
|
const noRecordEle = this.popupDiv.querySelector('.e-no-records');
|
|
430
433
|
if (noRecordEle) {
|
|
@@ -432,8 +435,9 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
|
|
|
432
435
|
}
|
|
433
436
|
}
|
|
434
437
|
if (this.isInitialRender) {
|
|
435
|
-
const
|
|
436
|
-
|
|
438
|
+
const gridContentRow = this.popupDiv.querySelector('.e-gridcontent tr');
|
|
439
|
+
const rowHeight = !hasNoDataClass ? gridContentRow ?
|
|
440
|
+
gridContentRow.getBoundingClientRect().height : 0 :
|
|
437
441
|
this.popupDiv.getBoundingClientRect().height;
|
|
438
442
|
this.popupRowHeight = rowHeight;
|
|
439
443
|
this.popupObj.hide();
|
|
@@ -452,6 +456,16 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
|
|
|
452
456
|
addClass([this.popupDiv], [NODATA]);
|
|
453
457
|
}
|
|
454
458
|
renderInput() {
|
|
459
|
+
const allowedAttributes = ['aria-expanded', 'aria-readOnly', 'aria-disabled', 'autocomplete',
|
|
460
|
+
'autocapitalize', 'spellcheck', 'tabindex'];
|
|
461
|
+
const setAttributes = (element, attributes) => {
|
|
462
|
+
for (const key in attributes) {
|
|
463
|
+
// eslint-disable-next-line no-prototype-builtins
|
|
464
|
+
if (attributes.hasOwnProperty(key) && allowedAttributes.indexOf(key) !== -1 && isNullOrUndefined(element.getAttribute(key))) {
|
|
465
|
+
element.setAttribute(key, attributes[key]);
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
};
|
|
455
469
|
if (this.element.tagName === 'INPUT') {
|
|
456
470
|
this.inputEle = this.element;
|
|
457
471
|
if (isNullOrUndefined(this.inputEle.getAttribute('role'))) {
|
|
@@ -460,13 +474,15 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
|
|
|
460
474
|
if (isNullOrUndefined(this.inputEle.getAttribute('type'))) {
|
|
461
475
|
this.inputEle.setAttribute('type', 'text');
|
|
462
476
|
}
|
|
463
|
-
this.inputEle
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
477
|
+
setAttributes(this.inputEle, {
|
|
478
|
+
'aria-expanded': 'false',
|
|
479
|
+
'aria-readOnly': this.readonly.toString(),
|
|
480
|
+
'aria-disabled': this.disabled.toString(),
|
|
481
|
+
autocomplete: 'off',
|
|
482
|
+
autocapitalize: 'off',
|
|
483
|
+
spellcheck: 'false',
|
|
484
|
+
tabindex: '0'
|
|
485
|
+
});
|
|
470
486
|
}
|
|
471
487
|
else {
|
|
472
488
|
this.inputEle = this.createElement('input', { attrs: { role: 'textbox', type: 'text' } });
|
|
@@ -496,48 +512,52 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
|
|
|
496
512
|
this.initValue(null, null, true);
|
|
497
513
|
}
|
|
498
514
|
}
|
|
499
|
-
/* To calculate the width when change via set model */
|
|
500
515
|
setElementWidth(inputWidth) {
|
|
516
|
+
if (isNullOrUndefined(inputWidth)) {
|
|
517
|
+
return;
|
|
518
|
+
}
|
|
501
519
|
const ddElement = this.inputWrapper;
|
|
502
|
-
if (
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
ddElement.style.width = (inputWidth.match(/px|%|em/)) ? (inputWidth) : (formatUnit(inputWidth));
|
|
508
|
-
}
|
|
520
|
+
if (typeof inputWidth === 'number') {
|
|
521
|
+
ddElement.style.width = formatUnit(inputWidth);
|
|
522
|
+
}
|
|
523
|
+
else if (typeof inputWidth === 'string') {
|
|
524
|
+
ddElement.style.width = inputWidth.match(/px|%|em/) ? inputWidth : formatUnit(inputWidth);
|
|
509
525
|
}
|
|
510
526
|
}
|
|
511
527
|
setHTMLAttributes() {
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
528
|
+
const htmlAttributes = this.htmlAttributes;
|
|
529
|
+
const inputEle = this.inputEle;
|
|
530
|
+
if (Object.keys(htmlAttributes).length) {
|
|
531
|
+
for (const htmlAttr of Object.keys(htmlAttributes)) {
|
|
532
|
+
switch (htmlAttr) {
|
|
533
|
+
case 'class':
|
|
534
|
+
this.inputWrapper.classList.add(htmlAttributes[htmlAttr]);
|
|
535
|
+
break;
|
|
536
|
+
case 'disabled':
|
|
537
|
+
this.setProperties({ enabled: false }, true);
|
|
538
|
+
this.setEnable();
|
|
539
|
+
break;
|
|
540
|
+
case 'readonly':
|
|
541
|
+
this.setProperties({ readonly: true }, true);
|
|
542
|
+
this.dataBind();
|
|
543
|
+
break;
|
|
544
|
+
case 'style':
|
|
545
|
+
this.inputWrapper.setAttribute('style', htmlAttributes[htmlAttr]);
|
|
546
|
+
break;
|
|
547
|
+
default: {
|
|
548
|
+
const defaultAttr = ['title', 'id', 'placeholder', 'role', 'autocomplete', 'autocapitalize', 'spellcheck', 'minlength', 'maxlength'];
|
|
549
|
+
if (defaultAttr.indexOf(htmlAttr) > -1) {
|
|
550
|
+
if (htmlAttr === 'placeholder') {
|
|
551
|
+
Input.setPlaceholder(htmlAttributes[htmlAttr], inputEle);
|
|
552
|
+
}
|
|
553
|
+
else {
|
|
554
|
+
inputEle.setAttribute(htmlAttr, htmlAttributes[htmlAttr]);
|
|
555
|
+
}
|
|
534
556
|
}
|
|
535
557
|
else {
|
|
536
|
-
|
|
558
|
+
inputEle.setAttribute(htmlAttr, htmlAttributes[htmlAttr]);
|
|
537
559
|
}
|
|
538
|
-
|
|
539
|
-
else {
|
|
540
|
-
this.inputEle.setAttribute(htmlAttr, this.htmlAttributes[`${htmlAttr}`]);
|
|
560
|
+
break;
|
|
541
561
|
}
|
|
542
562
|
}
|
|
543
563
|
}
|
|
@@ -548,8 +568,7 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
|
|
|
548
568
|
Input.setEnabled(!this.disabled, this.inputEle);
|
|
549
569
|
if (!this.disabled) {
|
|
550
570
|
removeClass([this.inputWrapper], DISABLED);
|
|
551
|
-
this.
|
|
552
|
-
this.inputWrapper.setAttribute('aria-disabled', 'false');
|
|
571
|
+
this.setAriaDisabled('false');
|
|
553
572
|
}
|
|
554
573
|
else {
|
|
555
574
|
if (this.isPopupOpen) {
|
|
@@ -559,10 +578,13 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
|
|
|
559
578
|
if (this.inputWrapper && this.inputWrapper.classList.contains(INPUTFOCUS)) {
|
|
560
579
|
removeClass([this.inputWrapper], [INPUTFOCUS]);
|
|
561
580
|
}
|
|
562
|
-
this.
|
|
563
|
-
this.inputWrapper.setAttribute('aria-disabled', 'true');
|
|
581
|
+
this.setAriaDisabled('true');
|
|
564
582
|
}
|
|
565
583
|
}
|
|
584
|
+
setAriaDisabled(value) {
|
|
585
|
+
this.inputEle.setAttribute('aria-disabled', value);
|
|
586
|
+
this.inputWrapper.setAttribute('aria-disabled', value);
|
|
587
|
+
}
|
|
566
588
|
initValue(isRerender, isValue, isInitial) {
|
|
567
589
|
const prevItemData = this.gridObj.getSelectedRecords()[0];
|
|
568
590
|
const prevItemEle = this.gridObj.getSelectedRows()[0];
|
|
@@ -822,7 +844,7 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
|
|
|
822
844
|
getSize(ispopupWidth) {
|
|
823
845
|
const currentDimension = ispopupWidth ? this.popupWidth : this.popupHeight;
|
|
824
846
|
let size = formatUnit(currentDimension);
|
|
825
|
-
if (size.
|
|
847
|
+
if (size.includes('%')) {
|
|
826
848
|
const dimensionValue = ispopupWidth ? this.inputWrapper.offsetWidth : document.documentElement.clientHeight;
|
|
827
849
|
size = (dimensionValue * parseFloat(size) / 100).toString() + 'px';
|
|
828
850
|
}
|
|
@@ -873,8 +895,8 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
|
|
|
873
895
|
this.previousItemElement = eventArgs.itemElement;
|
|
874
896
|
const prevOnChange = this.isProtectedOnChange;
|
|
875
897
|
this.isProtectedOnChange = true;
|
|
876
|
-
this.text = text
|
|
877
|
-
this.value = value
|
|
898
|
+
this.text = text || this.text;
|
|
899
|
+
this.value = value || this.value;
|
|
878
900
|
this.index = !isNullOrUndefined(index) ? index : this.index;
|
|
879
901
|
this.isProtectedOnChange = prevOnChange;
|
|
880
902
|
if (!isInitial) {
|
|
@@ -916,42 +938,45 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
|
|
|
916
938
|
this.updateInputValue(e.target.value);
|
|
917
939
|
}
|
|
918
940
|
updateInputValue(inputValue) {
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
941
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
942
|
+
let data;
|
|
943
|
+
let exactData;
|
|
944
|
+
if (this.dataSource instanceof DataManager) {
|
|
945
|
+
const query = new Query();
|
|
946
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
947
|
+
const result = yield this.dataSource.executeQuery(query);
|
|
924
948
|
const totaldata = result.result;
|
|
925
|
-
data =
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
this.
|
|
929
|
-
}
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
data = this.dataSource.filter((item) => {
|
|
933
|
-
return item[this.fields.text].toString().toLowerCase().startsWith(inputValue.toLowerCase());
|
|
934
|
-
});
|
|
935
|
-
this.selectFilteredRows(data);
|
|
936
|
-
}
|
|
949
|
+
({ data, exactData } = this.filterDatas(totaldata, inputValue));
|
|
950
|
+
}
|
|
951
|
+
else if (Array.isArray(this.dataSource)) {
|
|
952
|
+
({ data, exactData } = this.filterDatas(this.dataSource, inputValue));
|
|
953
|
+
}
|
|
954
|
+
this.selectFilteredRows(data, exactData);
|
|
955
|
+
});
|
|
937
956
|
}
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
this.
|
|
941
|
-
}
|
|
942
|
-
|
|
943
|
-
this.
|
|
944
|
-
}
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
957
|
+
filterDatas(dataSource, inputValue) {
|
|
958
|
+
const data = dataSource.filter((item) => {
|
|
959
|
+
return item[this.fields.text].toString().toLowerCase().startsWith(inputValue.toLowerCase());
|
|
960
|
+
});
|
|
961
|
+
const exactData = dataSource.filter((item) => {
|
|
962
|
+
return item[this.fields.text].toString() === inputValue;
|
|
963
|
+
});
|
|
964
|
+
return { data, exactData };
|
|
965
|
+
}
|
|
966
|
+
selectFilteredRows(data, exactData) {
|
|
967
|
+
if (data.length <= 0) {
|
|
968
|
+
this.matchedRowEle = this.matchedContent = this.exactMatchedContent = null;
|
|
969
|
+
return;
|
|
951
970
|
}
|
|
971
|
+
this.matchedContent = data[0];
|
|
972
|
+
this.exactMatchedContent = exactData[0];
|
|
973
|
+
const selectedIndex = this.findIndex(this.gridObj.currentViewData, this.matchedContent);
|
|
974
|
+
this.matchedRowEle = this.gridObj.getRowByIndex(selectedIndex);
|
|
952
975
|
}
|
|
953
976
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
954
977
|
filterAction(dataSource, inputValue, query, fields) {
|
|
978
|
+
const isQuery = query || new Query();
|
|
979
|
+
const filterType = this.filterType.toString().toLowerCase();
|
|
955
980
|
if (isNullOrUndefined(query) && isNullOrUndefined(fields)) {
|
|
956
981
|
this.updateGridDataSource(dataSource);
|
|
957
982
|
}
|
|
@@ -968,12 +993,10 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
|
|
|
968
993
|
}
|
|
969
994
|
}
|
|
970
995
|
else {
|
|
971
|
-
const isQuery = query || new Query();
|
|
972
996
|
if (dataSource instanceof DataManager) {
|
|
973
997
|
this.filteringHandler(dataSource, inputValue, isQuery, fields);
|
|
974
998
|
}
|
|
975
999
|
else if (Array.isArray(dataSource)) {
|
|
976
|
-
const filterType = this.filterType.toString().toLowerCase();
|
|
977
1000
|
const filteredData = dataSource.filter((item) => this.filterData(item, filterType, inputValue, fields));
|
|
978
1001
|
this.updateGridDataSource(filteredData);
|
|
979
1002
|
}
|
|
@@ -1099,26 +1122,33 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
|
|
|
1099
1122
|
}
|
|
1100
1123
|
}
|
|
1101
1124
|
onDocumentClick(e) {
|
|
1125
|
+
const target = e.target;
|
|
1102
1126
|
if (this.disabled || this.readonly || !this.isPopupOpen) {
|
|
1103
|
-
if (!
|
|
1127
|
+
if (!target.closest('.e-multicolumn-list')) {
|
|
1104
1128
|
this.focusOut();
|
|
1105
1129
|
}
|
|
1106
1130
|
return;
|
|
1107
1131
|
}
|
|
1108
|
-
const target = e.target;
|
|
1109
1132
|
if ((target.classList.contains('e-multicolumn-list-icon') || closest(target, '.e-popup'))) {
|
|
1110
1133
|
e.preventDefault();
|
|
1111
1134
|
}
|
|
1112
1135
|
else {
|
|
1113
1136
|
if (!target.classList.contains('e-multicolumncombobox') && !target.classList.contains('e-clear-icon')) {
|
|
1137
|
+
if (!isNullOrUndefined(this.text)) {
|
|
1138
|
+
this.updateInputValue(this.text);
|
|
1139
|
+
}
|
|
1114
1140
|
this.updateValuesOnInput(e);
|
|
1115
1141
|
}
|
|
1116
1142
|
}
|
|
1117
1143
|
}
|
|
1118
|
-
updateValuesOnInput(mouseEvent, keyEvent, isClearValues = false) {
|
|
1144
|
+
updateValuesOnInput(mouseEvent, keyEvent, isClearValues = false, isKeyDown = false) {
|
|
1119
1145
|
const e = mouseEvent ? mouseEvent : keyEvent;
|
|
1146
|
+
const val = isKeyDown ? this.matchedContent : this.exactMatchedContent;
|
|
1147
|
+
if (!val) {
|
|
1148
|
+
this.inputEle.value = this.value = this.index = this.text = null;
|
|
1149
|
+
}
|
|
1120
1150
|
this.hidePopup(e);
|
|
1121
|
-
if (this.matchedRowEle && !isClearValues) {
|
|
1151
|
+
if (this.matchedRowEle && !isClearValues && val) {
|
|
1122
1152
|
const prevOnChange = this.isProtectedOnChange;
|
|
1123
1153
|
this.isProtectedOnChange = true;
|
|
1124
1154
|
setTimeout(() => {
|
|
@@ -1202,7 +1232,7 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
|
|
|
1202
1232
|
this.updateSelectedItem(e, true, true);
|
|
1203
1233
|
break;
|
|
1204
1234
|
case 'enter':
|
|
1205
|
-
this.updateValuesOnInput(null, e);
|
|
1235
|
+
this.updateValuesOnInput(null, e, false, true);
|
|
1206
1236
|
this.focusIn(e);
|
|
1207
1237
|
break;
|
|
1208
1238
|
case 'home':
|
|
@@ -1212,31 +1242,19 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
|
|
|
1212
1242
|
}
|
|
1213
1243
|
}
|
|
1214
1244
|
gridKeyActionHandler(e, isGroup) {
|
|
1245
|
+
const keyActionMap = {
|
|
1246
|
+
'ArrowDown': 'moveDown',
|
|
1247
|
+
'ArrowUp': 'moveUp',
|
|
1248
|
+
'End': 'end',
|
|
1249
|
+
'Home': 'home',
|
|
1250
|
+
'Tab': 'tab',
|
|
1251
|
+
'Escape': 'escape',
|
|
1252
|
+
'Shift+Tab': 'shiftTab',
|
|
1253
|
+
'Alt+ArrowUp': 'altUp'
|
|
1254
|
+
};
|
|
1215
1255
|
if (isGroup) {
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
}
|
|
1219
|
-
else if (e.key === 'ArrowUp') {
|
|
1220
|
-
e.action = 'moveUp';
|
|
1221
|
-
}
|
|
1222
|
-
else if (e.key === 'End') {
|
|
1223
|
-
e.action = 'end';
|
|
1224
|
-
}
|
|
1225
|
-
else if (e.key === 'Home') {
|
|
1226
|
-
e.action = 'home';
|
|
1227
|
-
}
|
|
1228
|
-
else if (e.key === 'Tab') {
|
|
1229
|
-
e.action = 'tab';
|
|
1230
|
-
}
|
|
1231
|
-
else if (e.key === 'Escape') {
|
|
1232
|
-
e.action = 'escape';
|
|
1233
|
-
}
|
|
1234
|
-
if (e.shiftKey && e.key === 'Tab') {
|
|
1235
|
-
e.action = 'shiftTab';
|
|
1236
|
-
}
|
|
1237
|
-
if (e.altKey && e.key === 'ArrowUp') {
|
|
1238
|
-
e.action = 'altUp';
|
|
1239
|
-
}
|
|
1256
|
+
const key = `${e.altKey ? 'Alt+' : ''}${e.shiftKey ? 'Shift+' : ''}${e.key}`;
|
|
1257
|
+
e.action = keyActionMap[key] || e.action;
|
|
1240
1258
|
}
|
|
1241
1259
|
switch (e.action) {
|
|
1242
1260
|
case 'escape':
|
|
@@ -1301,6 +1319,25 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
|
|
|
1301
1319
|
clearIconEle.style.display = this.inputEle.value === '' ? 'none' : 'flex';
|
|
1302
1320
|
}
|
|
1303
1321
|
}
|
|
1322
|
+
updateDynamicDataSource(newDataSource, oldDataSource) {
|
|
1323
|
+
if (this.gridObj) {
|
|
1324
|
+
let dataLength;
|
|
1325
|
+
this.gridObj.dataSource = newDataSource;
|
|
1326
|
+
const isRemoteData = oldDataSource instanceof DataManager;
|
|
1327
|
+
if (isRemoteData) {
|
|
1328
|
+
oldDataSource.executeQuery(new Query()).then((e) => {
|
|
1329
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1330
|
+
dataLength = e.result.length;
|
|
1331
|
+
});
|
|
1332
|
+
}
|
|
1333
|
+
else {
|
|
1334
|
+
dataLength = oldDataSource.length;
|
|
1335
|
+
}
|
|
1336
|
+
if (dataLength === 0) {
|
|
1337
|
+
this.popupDiv.appendChild(this.gridEle);
|
|
1338
|
+
}
|
|
1339
|
+
}
|
|
1340
|
+
}
|
|
1304
1341
|
/**
|
|
1305
1342
|
* Sets the focus to the component for interaction.component for interaction.
|
|
1306
1343
|
*
|
|
@@ -1381,11 +1418,12 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
|
|
|
1381
1418
|
const contentEle = this.gridObj.getContent();
|
|
1382
1419
|
if (contentEle) {
|
|
1383
1420
|
const activeRow = contentEle.querySelector('.e-rowcell.e-active');
|
|
1421
|
+
const firstRow = contentEle.querySelector('.e-row');
|
|
1384
1422
|
if (activeRow) {
|
|
1385
1423
|
this.inputEle.setAttribute('aria-activedescendant', activeRow.parentElement.getAttribute('data-uid'));
|
|
1386
1424
|
}
|
|
1387
|
-
else if (
|
|
1388
|
-
this.inputEle.setAttribute('aria-activedescendant',
|
|
1425
|
+
else if (firstRow) {
|
|
1426
|
+
this.inputEle.setAttribute('aria-activedescendant', firstRow.getAttribute('data-uid'));
|
|
1389
1427
|
}
|
|
1390
1428
|
}
|
|
1391
1429
|
if (!isNullOrUndefined(this.dataSource) && this.dataSource instanceof DataManager) {
|
|
@@ -1407,24 +1445,21 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
|
|
|
1407
1445
|
hidePopup(e) {
|
|
1408
1446
|
const animModel = { name: 'FadeOut', duration: 100 };
|
|
1409
1447
|
const eventArgs = { popup: this.popupObj, event: e || null, cancel: false, animation: animModel };
|
|
1448
|
+
const target = e ? e.target : null;
|
|
1410
1449
|
this.trigger('close', eventArgs, (eventArgs) => {
|
|
1411
1450
|
if (!eventArgs.cancel) {
|
|
1412
1451
|
this.isPopupOpen = false;
|
|
1413
1452
|
removeClass([this.inputWrapper], [ICONANIMATION]);
|
|
1414
1453
|
attributes(this.inputEle, { 'aria-expanded': 'false' });
|
|
1415
1454
|
this.popupObj.hide(new Animation(eventArgs.animation));
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
if (target && (target.classList.contains('e-multicolumn-list-icon') || target.classList.contains('e-rowcell'))) {
|
|
1420
|
-
if (!this.value) {
|
|
1421
|
-
this.gridObj.refreshColumns();
|
|
1422
|
-
}
|
|
1423
|
-
setTimeout(() => { this.focusIn(e); });
|
|
1424
|
-
}
|
|
1425
|
-
else {
|
|
1426
|
-
this.focusOut();
|
|
1455
|
+
if (target && (target.classList.contains('e-multicolumn-list-icon') || target.classList.contains('e-rowcell'))) {
|
|
1456
|
+
if (!this.value) {
|
|
1457
|
+
this.gridObj.refreshColumns();
|
|
1427
1458
|
}
|
|
1459
|
+
setTimeout(() => { this.focusIn(e); });
|
|
1460
|
+
}
|
|
1461
|
+
else {
|
|
1462
|
+
this.focusOut();
|
|
1428
1463
|
}
|
|
1429
1464
|
this.inputEle.removeAttribute('aria-owns');
|
|
1430
1465
|
this.inputEle.removeAttribute('aria-activedescendant');
|
|
@@ -1630,9 +1665,7 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
|
|
|
1630
1665
|
}
|
|
1631
1666
|
break;
|
|
1632
1667
|
case 'dataSource':
|
|
1633
|
-
|
|
1634
|
-
this.gridObj.dataSource = newProp.dataSource;
|
|
1635
|
-
}
|
|
1668
|
+
this.updateDynamicDataSource(newProp.dataSource, oldProp.dataSource);
|
|
1636
1669
|
break;
|
|
1637
1670
|
case 'query':
|
|
1638
1671
|
if (this.gridObj) {
|