@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
|
@@ -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,29 +297,25 @@ 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
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
if (this.isPopupOpen) {
|
|
297
|
-
this.selectedGridRow(this.gridObj.getRows()[this.gridObj.selectedRowIndex], args, true);
|
|
298
|
-
this.hidePopup(args);
|
|
299
|
-
this.focusIn(args);
|
|
300
|
-
}
|
|
300
|
+
keyPressed: this.handleKeyPressed.bind(this),
|
|
301
|
+
resizing: (args) => {
|
|
302
|
+
if (this.gridSettings.resizing) {
|
|
303
|
+
this.gridSettings.resizing.call(this, args);
|
|
301
304
|
}
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
this.
|
|
305
|
+
},
|
|
306
|
+
resizeStart: (args) => {
|
|
307
|
+
if (this.gridSettings.resizeStart) {
|
|
308
|
+
this.gridSettings.resizeStart.call(this, args);
|
|
306
309
|
}
|
|
307
310
|
},
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
+
resizeStop: (args) => {
|
|
312
|
+
if (this.gridSettings.resizeStop) {
|
|
313
|
+
this.gridSettings.resizeStop.call(this, args);
|
|
314
|
+
}
|
|
315
|
+
}
|
|
311
316
|
});
|
|
312
317
|
this.gridEle = this.createElement('div', { id: getUniqueID('grid'), className: MULTICOLUMNGRID });
|
|
313
318
|
this.updateGroupByField();
|
|
314
|
-
const sortOrder = this.sortOrder.toString().toLowerCase();
|
|
315
319
|
if (gridColumns.length > 0) {
|
|
316
320
|
// Set first column as primary key to avoid PRIMARY KEY MISSING warning.
|
|
317
321
|
this.gridObj.columns[0].isPrimaryKey = true;
|
|
@@ -330,24 +334,38 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
|
|
|
330
334
|
this.popupObj.refreshPosition();
|
|
331
335
|
this.gridObj.element.querySelector('.e-content').scrollTop = 0;
|
|
332
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
|
+
}
|
|
333
353
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
334
354
|
isRowMatching(data, selectedValue, selectedText) {
|
|
335
355
|
const values = Object.values(data).map(String);
|
|
336
|
-
|
|
337
|
-
return isRowPresent;
|
|
356
|
+
return values.includes(selectedValue) && values.includes(selectedText);
|
|
338
357
|
}
|
|
339
358
|
updateRowSelection(args) {
|
|
340
359
|
if (args) {
|
|
341
360
|
const dataRows = args.rows;
|
|
342
361
|
dataRows.forEach((row) => {
|
|
343
|
-
|
|
344
|
-
const index = row.index;
|
|
345
|
-
this.selectDataRow(data, index);
|
|
362
|
+
this.selectDataRow(row.data, row.index);
|
|
346
363
|
});
|
|
347
364
|
}
|
|
348
365
|
}
|
|
349
366
|
selectDataRow(data, index) {
|
|
350
|
-
const isPresent = this.isRowMatching(data, this.value ?
|
|
367
|
+
const isPresent = this.isRowMatching(data, this.value ?
|
|
368
|
+
this.value.toString() : '', this.text ? this.text.toString() : '');
|
|
351
369
|
if (isPresent) {
|
|
352
370
|
this.gridObj.selectRow(index);
|
|
353
371
|
const prevOnChange = this.isProtectedOnChange;
|
|
@@ -363,29 +381,24 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
|
|
|
363
381
|
return Object.keys(obj).every((key) => item[key] === obj[key]);
|
|
364
382
|
});
|
|
365
383
|
}
|
|
366
|
-
/* eslint-enable @typescript-eslint/no-explicit-any */
|
|
367
384
|
getGridColumns() {
|
|
368
|
-
return this.columns.map((
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
template: column.template,
|
|
381
|
-
headerTemplate: column.headerTemplate,
|
|
382
|
-
customAttributes: column.customAttributes,
|
|
383
|
-
type: changeType
|
|
384
|
-
};
|
|
385
|
-
});
|
|
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
|
+
}));
|
|
386
397
|
}
|
|
387
398
|
updateGroupByField() {
|
|
388
|
-
|
|
399
|
+
const groupByField = this.fields.groupBy;
|
|
400
|
+
const isGroupByValid = groupByField !== '' && !isNullOrUndefined(groupByField);
|
|
401
|
+
if (isGroupByValid) {
|
|
389
402
|
if (this.sortType.toString().toLowerCase() !== 'multiplecolumns') {
|
|
390
403
|
this.gridEle.classList.add('e-multicolumn-group');
|
|
391
404
|
}
|
|
@@ -394,10 +407,11 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
|
|
|
394
407
|
this.gridObj.allowGrouping = true;
|
|
395
408
|
this.gridObj.groupSettings = {
|
|
396
409
|
showDropArea: false,
|
|
397
|
-
columns: [
|
|
398
|
-
captionTemplate: (this.groupTemplate && this.fields.groupBy !== '' && !isNullOrUndefined(this.fields.groupBy))
|
|
399
|
-
? this.groupTemplate : '${key}'
|
|
410
|
+
columns: [groupByField]
|
|
400
411
|
};
|
|
412
|
+
if (this.groupTemplate && isGroupByValid) {
|
|
413
|
+
this.gridObj.groupSettings.captionTemplate = this.groupTemplate;
|
|
414
|
+
}
|
|
401
415
|
if (this.isVue) {
|
|
402
416
|
this.gridObj.isVue = this.isVue;
|
|
403
417
|
}
|
|
@@ -407,12 +421,13 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
|
|
|
407
421
|
onDataBound() {
|
|
408
422
|
const dataCount = this.dataSource.length;
|
|
409
423
|
const popupChild = this.popupDiv.querySelector('.' + MULTICOLUMNGRID);
|
|
424
|
+
const hasNoDataClass = this.popupDiv.classList.contains(NODATA);
|
|
410
425
|
if (dataCount <= 0 && popupChild) {
|
|
411
426
|
this.l10nUpdate();
|
|
412
427
|
this.popupDiv.removeChild(this.gridEle);
|
|
413
428
|
addClass([this.popupDiv], [NODATA]);
|
|
414
429
|
}
|
|
415
|
-
else if (
|
|
430
|
+
else if (hasNoDataClass && dataCount >= 1) {
|
|
416
431
|
removeClass([this.popupDiv], [NODATA]);
|
|
417
432
|
const noRecordEle = this.popupDiv.querySelector('.e-no-records');
|
|
418
433
|
if (noRecordEle) {
|
|
@@ -420,8 +435,9 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
|
|
|
420
435
|
}
|
|
421
436
|
}
|
|
422
437
|
if (this.isInitialRender) {
|
|
423
|
-
const
|
|
424
|
-
|
|
438
|
+
const gridContentRow = this.popupDiv.querySelector('.e-gridcontent tr');
|
|
439
|
+
const rowHeight = !hasNoDataClass ? gridContentRow ?
|
|
440
|
+
gridContentRow.getBoundingClientRect().height : 0 :
|
|
425
441
|
this.popupDiv.getBoundingClientRect().height;
|
|
426
442
|
this.popupRowHeight = rowHeight;
|
|
427
443
|
this.popupObj.hide();
|
|
@@ -440,6 +456,16 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
|
|
|
440
456
|
addClass([this.popupDiv], [NODATA]);
|
|
441
457
|
}
|
|
442
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
|
+
};
|
|
443
469
|
if (this.element.tagName === 'INPUT') {
|
|
444
470
|
this.inputEle = this.element;
|
|
445
471
|
if (isNullOrUndefined(this.inputEle.getAttribute('role'))) {
|
|
@@ -448,13 +474,15 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
|
|
|
448
474
|
if (isNullOrUndefined(this.inputEle.getAttribute('type'))) {
|
|
449
475
|
this.inputEle.setAttribute('type', 'text');
|
|
450
476
|
}
|
|
451
|
-
this.inputEle
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
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
|
+
});
|
|
458
486
|
}
|
|
459
487
|
else {
|
|
460
488
|
this.inputEle = this.createElement('input', { attrs: { role: 'textbox', type: 'text' } });
|
|
@@ -484,48 +512,52 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
|
|
|
484
512
|
this.initValue(null, null, true);
|
|
485
513
|
}
|
|
486
514
|
}
|
|
487
|
-
/* To calculate the width when change via set model */
|
|
488
515
|
setElementWidth(inputWidth) {
|
|
516
|
+
if (isNullOrUndefined(inputWidth)) {
|
|
517
|
+
return;
|
|
518
|
+
}
|
|
489
519
|
const ddElement = this.inputWrapper;
|
|
490
|
-
if (
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
ddElement.style.width = (inputWidth.match(/px|%|em/)) ? (inputWidth) : (formatUnit(inputWidth));
|
|
496
|
-
}
|
|
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);
|
|
497
525
|
}
|
|
498
526
|
}
|
|
499
527
|
setHTMLAttributes() {
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
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
|
+
}
|
|
522
556
|
}
|
|
523
557
|
else {
|
|
524
|
-
|
|
558
|
+
inputEle.setAttribute(htmlAttr, htmlAttributes[htmlAttr]);
|
|
525
559
|
}
|
|
526
|
-
|
|
527
|
-
else {
|
|
528
|
-
this.inputEle.setAttribute(htmlAttr, this.htmlAttributes[`${htmlAttr}`]);
|
|
560
|
+
break;
|
|
529
561
|
}
|
|
530
562
|
}
|
|
531
563
|
}
|
|
@@ -536,8 +568,7 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
|
|
|
536
568
|
Input.setEnabled(!this.disabled, this.inputEle);
|
|
537
569
|
if (!this.disabled) {
|
|
538
570
|
removeClass([this.inputWrapper], DISABLED);
|
|
539
|
-
this.
|
|
540
|
-
this.inputWrapper.setAttribute('aria-disabled', 'false');
|
|
571
|
+
this.setAriaDisabled('false');
|
|
541
572
|
}
|
|
542
573
|
else {
|
|
543
574
|
if (this.isPopupOpen) {
|
|
@@ -547,10 +578,13 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
|
|
|
547
578
|
if (this.inputWrapper && this.inputWrapper.classList.contains(INPUTFOCUS)) {
|
|
548
579
|
removeClass([this.inputWrapper], [INPUTFOCUS]);
|
|
549
580
|
}
|
|
550
|
-
this.
|
|
551
|
-
this.inputWrapper.setAttribute('aria-disabled', 'true');
|
|
581
|
+
this.setAriaDisabled('true');
|
|
552
582
|
}
|
|
553
583
|
}
|
|
584
|
+
setAriaDisabled(value) {
|
|
585
|
+
this.inputEle.setAttribute('aria-disabled', value);
|
|
586
|
+
this.inputWrapper.setAttribute('aria-disabled', value);
|
|
587
|
+
}
|
|
554
588
|
initValue(isRerender, isValue, isInitial) {
|
|
555
589
|
const prevItemData = this.gridObj.getSelectedRecords()[0];
|
|
556
590
|
const prevItemEle = this.gridObj.getSelectedRows()[0];
|
|
@@ -810,7 +844,7 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
|
|
|
810
844
|
getSize(ispopupWidth) {
|
|
811
845
|
const currentDimension = ispopupWidth ? this.popupWidth : this.popupHeight;
|
|
812
846
|
let size = formatUnit(currentDimension);
|
|
813
|
-
if (size.
|
|
847
|
+
if (size.includes('%')) {
|
|
814
848
|
const dimensionValue = ispopupWidth ? this.inputWrapper.offsetWidth : document.documentElement.clientHeight;
|
|
815
849
|
size = (dimensionValue * parseFloat(size) / 100).toString() + 'px';
|
|
816
850
|
}
|
|
@@ -861,8 +895,8 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
|
|
|
861
895
|
this.previousItemElement = eventArgs.itemElement;
|
|
862
896
|
const prevOnChange = this.isProtectedOnChange;
|
|
863
897
|
this.isProtectedOnChange = true;
|
|
864
|
-
this.text = text
|
|
865
|
-
this.value = value
|
|
898
|
+
this.text = text || this.text;
|
|
899
|
+
this.value = value || this.value;
|
|
866
900
|
this.index = !isNullOrUndefined(index) ? index : this.index;
|
|
867
901
|
this.isProtectedOnChange = prevOnChange;
|
|
868
902
|
if (!isInitial) {
|
|
@@ -904,42 +938,45 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
|
|
|
904
938
|
this.updateInputValue(e.target.value);
|
|
905
939
|
}
|
|
906
940
|
updateInputValue(inputValue) {
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
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);
|
|
912
948
|
const totaldata = result.result;
|
|
913
|
-
data =
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
this.
|
|
917
|
-
}
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
data = this.dataSource.filter((item) => {
|
|
921
|
-
return item[this.fields.text].toString().toLowerCase().startsWith(inputValue.toLowerCase());
|
|
922
|
-
});
|
|
923
|
-
this.selectFilteredRows(data);
|
|
924
|
-
}
|
|
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
|
+
});
|
|
925
956
|
}
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
this.
|
|
929
|
-
}
|
|
930
|
-
|
|
931
|
-
this.
|
|
932
|
-
}
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
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;
|
|
939
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);
|
|
940
975
|
}
|
|
941
976
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
942
977
|
filterAction(dataSource, inputValue, query, fields) {
|
|
978
|
+
const isQuery = query || new Query();
|
|
979
|
+
const filterType = this.filterType.toString().toLowerCase();
|
|
943
980
|
if (isNullOrUndefined(query) && isNullOrUndefined(fields)) {
|
|
944
981
|
this.updateGridDataSource(dataSource);
|
|
945
982
|
}
|
|
@@ -956,12 +993,10 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
|
|
|
956
993
|
}
|
|
957
994
|
}
|
|
958
995
|
else {
|
|
959
|
-
const isQuery = query || new Query();
|
|
960
996
|
if (dataSource instanceof DataManager) {
|
|
961
997
|
this.filteringHandler(dataSource, inputValue, isQuery, fields);
|
|
962
998
|
}
|
|
963
999
|
else if (Array.isArray(dataSource)) {
|
|
964
|
-
const filterType = this.filterType.toString().toLowerCase();
|
|
965
1000
|
const filteredData = dataSource.filter((item) => this.filterData(item, filterType, inputValue, fields));
|
|
966
1001
|
this.updateGridDataSource(filteredData);
|
|
967
1002
|
}
|
|
@@ -1087,26 +1122,33 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
|
|
|
1087
1122
|
}
|
|
1088
1123
|
}
|
|
1089
1124
|
onDocumentClick(e) {
|
|
1125
|
+
const target = e.target;
|
|
1090
1126
|
if (this.disabled || this.readonly || !this.isPopupOpen) {
|
|
1091
|
-
if (!
|
|
1127
|
+
if (!target.closest('.e-multicolumn-list')) {
|
|
1092
1128
|
this.focusOut();
|
|
1093
1129
|
}
|
|
1094
1130
|
return;
|
|
1095
1131
|
}
|
|
1096
|
-
const target = e.target;
|
|
1097
1132
|
if ((target.classList.contains('e-multicolumn-list-icon') || closest(target, '.e-popup'))) {
|
|
1098
1133
|
e.preventDefault();
|
|
1099
1134
|
}
|
|
1100
1135
|
else {
|
|
1101
1136
|
if (!target.classList.contains('e-multicolumncombobox') && !target.classList.contains('e-clear-icon')) {
|
|
1137
|
+
if (!isNullOrUndefined(this.text)) {
|
|
1138
|
+
this.updateInputValue(this.text);
|
|
1139
|
+
}
|
|
1102
1140
|
this.updateValuesOnInput(e);
|
|
1103
1141
|
}
|
|
1104
1142
|
}
|
|
1105
1143
|
}
|
|
1106
|
-
updateValuesOnInput(mouseEvent, keyEvent, isClearValues = false) {
|
|
1144
|
+
updateValuesOnInput(mouseEvent, keyEvent, isClearValues = false, isKeyDown = false) {
|
|
1107
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
|
+
}
|
|
1108
1150
|
this.hidePopup(e);
|
|
1109
|
-
if (this.matchedRowEle && !isClearValues) {
|
|
1151
|
+
if (this.matchedRowEle && !isClearValues && val) {
|
|
1110
1152
|
const prevOnChange = this.isProtectedOnChange;
|
|
1111
1153
|
this.isProtectedOnChange = true;
|
|
1112
1154
|
setTimeout(() => {
|
|
@@ -1190,7 +1232,7 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
|
|
|
1190
1232
|
this.updateSelectedItem(e, true, true);
|
|
1191
1233
|
break;
|
|
1192
1234
|
case 'enter':
|
|
1193
|
-
this.updateValuesOnInput(null, e);
|
|
1235
|
+
this.updateValuesOnInput(null, e, false, true);
|
|
1194
1236
|
this.focusIn(e);
|
|
1195
1237
|
break;
|
|
1196
1238
|
case 'home':
|
|
@@ -1200,31 +1242,19 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
|
|
|
1200
1242
|
}
|
|
1201
1243
|
}
|
|
1202
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
|
+
};
|
|
1203
1255
|
if (isGroup) {
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
}
|
|
1207
|
-
else if (e.key === 'ArrowUp') {
|
|
1208
|
-
e.action = 'moveUp';
|
|
1209
|
-
}
|
|
1210
|
-
else if (e.key === 'End') {
|
|
1211
|
-
e.action = 'end';
|
|
1212
|
-
}
|
|
1213
|
-
else if (e.key === 'Home') {
|
|
1214
|
-
e.action = 'home';
|
|
1215
|
-
}
|
|
1216
|
-
else if (e.key === 'Tab') {
|
|
1217
|
-
e.action = 'tab';
|
|
1218
|
-
}
|
|
1219
|
-
else if (e.key === 'Escape') {
|
|
1220
|
-
e.action = 'escape';
|
|
1221
|
-
}
|
|
1222
|
-
if (e.shiftKey && e.key === 'Tab') {
|
|
1223
|
-
e.action = 'shiftTab';
|
|
1224
|
-
}
|
|
1225
|
-
if (e.altKey && e.key === 'ArrowUp') {
|
|
1226
|
-
e.action = 'altUp';
|
|
1227
|
-
}
|
|
1256
|
+
const key = `${e.altKey ? 'Alt+' : ''}${e.shiftKey ? 'Shift+' : ''}${e.key}`;
|
|
1257
|
+
e.action = keyActionMap[key] || e.action;
|
|
1228
1258
|
}
|
|
1229
1259
|
switch (e.action) {
|
|
1230
1260
|
case 'escape':
|
|
@@ -1289,6 +1319,25 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
|
|
|
1289
1319
|
clearIconEle.style.display = this.inputEle.value === '' ? 'none' : 'flex';
|
|
1290
1320
|
}
|
|
1291
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
|
+
}
|
|
1292
1341
|
/**
|
|
1293
1342
|
* Sets the focus to the component for interaction.component for interaction.
|
|
1294
1343
|
*
|
|
@@ -1369,11 +1418,12 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
|
|
|
1369
1418
|
const contentEle = this.gridObj.getContent();
|
|
1370
1419
|
if (contentEle) {
|
|
1371
1420
|
const activeRow = contentEle.querySelector('.e-rowcell.e-active');
|
|
1421
|
+
const firstRow = contentEle.querySelector('.e-row');
|
|
1372
1422
|
if (activeRow) {
|
|
1373
1423
|
this.inputEle.setAttribute('aria-activedescendant', activeRow.parentElement.getAttribute('data-uid'));
|
|
1374
1424
|
}
|
|
1375
|
-
else if (
|
|
1376
|
-
this.inputEle.setAttribute('aria-activedescendant',
|
|
1425
|
+
else if (firstRow) {
|
|
1426
|
+
this.inputEle.setAttribute('aria-activedescendant', firstRow.getAttribute('data-uid'));
|
|
1377
1427
|
}
|
|
1378
1428
|
}
|
|
1379
1429
|
if (!isNullOrUndefined(this.dataSource) && this.dataSource instanceof DataManager) {
|
|
@@ -1395,24 +1445,21 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
|
|
|
1395
1445
|
hidePopup(e) {
|
|
1396
1446
|
const animModel = { name: 'FadeOut', duration: 100 };
|
|
1397
1447
|
const eventArgs = { popup: this.popupObj, event: e || null, cancel: false, animation: animModel };
|
|
1448
|
+
const target = e ? e.target : null;
|
|
1398
1449
|
this.trigger('close', eventArgs, (eventArgs) => {
|
|
1399
1450
|
if (!eventArgs.cancel) {
|
|
1400
1451
|
this.isPopupOpen = false;
|
|
1401
1452
|
removeClass([this.inputWrapper], [ICONANIMATION]);
|
|
1402
1453
|
attributes(this.inputEle, { 'aria-expanded': 'false' });
|
|
1403
1454
|
this.popupObj.hide(new Animation(eventArgs.animation));
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
if (target && (target.classList.contains('e-multicolumn-list-icon') || target.classList.contains('e-rowcell'))) {
|
|
1408
|
-
if (!this.value) {
|
|
1409
|
-
this.gridObj.refreshColumns();
|
|
1410
|
-
}
|
|
1411
|
-
setTimeout(() => { this.focusIn(e); });
|
|
1412
|
-
}
|
|
1413
|
-
else {
|
|
1414
|
-
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();
|
|
1415
1458
|
}
|
|
1459
|
+
setTimeout(() => { this.focusIn(e); });
|
|
1460
|
+
}
|
|
1461
|
+
else {
|
|
1462
|
+
this.focusOut();
|
|
1416
1463
|
}
|
|
1417
1464
|
this.inputEle.removeAttribute('aria-owns');
|
|
1418
1465
|
this.inputEle.removeAttribute('aria-activedescendant');
|
|
@@ -1618,9 +1665,7 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
|
|
|
1618
1665
|
}
|
|
1619
1666
|
break;
|
|
1620
1667
|
case 'dataSource':
|
|
1621
|
-
|
|
1622
|
-
this.gridObj.dataSource = newProp.dataSource;
|
|
1623
|
-
}
|
|
1668
|
+
this.updateDynamicDataSource(newProp.dataSource, oldProp.dataSource);
|
|
1624
1669
|
break;
|
|
1625
1670
|
case 'query':
|
|
1626
1671
|
if (this.gridObj) {
|