@syncfusion/ej2-multicolumn-combobox 27.2.5 → 28.1.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/ej2-multicolumn-combobox.umd.min.js +3 -3
- package/dist/ej2-multicolumn-combobox.umd.min.js.map +1 -1
- package/dist/es6/ej2-multicolumn-combobox.es2015.js +268 -203
- package/dist/es6/ej2-multicolumn-combobox.es2015.js.map +1 -1
- package/dist/es6/ej2-multicolumn-combobox.es5.js +309 -205
- package/dist/es6/ej2-multicolumn-combobox.es5.js.map +1 -1
- package/dist/global/ej2-multicolumn-combobox.min.js +3 -3
- package/dist/global/ej2-multicolumn-combobox.min.js.map +1 -1
- package/dist/global/index.d.ts +2 -2
- package/package.json +8 -9
- package/src/global.js +0 -2
- package/src/multicolumn-combobox/index.d.ts +0 -1
- package/src/multicolumn-combobox/index.js +0 -1
- package/src/multicolumn-combobox/multi-column-combo-box-model.d.ts +1 -1
- package/src/multicolumn-combobox/multi-column-combo-box.d.ts +6 -0
- package/src/multicolumn-combobox/multi-column-combo-box.js +310 -205
- package/styles/bds-lite.css +416 -0
- package/styles/bds-lite.scss +10 -0
- package/styles/bds.css +467 -0
- package/styles/bds.scss +11 -0
- package/styles/bootstrap-dark-lite.css +3 -0
- package/styles/bootstrap-dark.css +3 -0
- package/styles/bootstrap-lite.css +3 -0
- package/styles/bootstrap.css +3 -0
- package/styles/bootstrap4-lite.css +3 -0
- package/styles/bootstrap4.css +3 -0
- package/styles/bootstrap5-dark-lite.css +3 -0
- package/styles/bootstrap5-dark.css +3 -0
- package/styles/bootstrap5-lite.css +3 -0
- package/styles/bootstrap5.3-lite.css +3 -0
- package/styles/bootstrap5.3.css +3 -0
- package/styles/bootstrap5.css +3 -0
- package/styles/fabric-dark-lite.css +3 -0
- package/styles/fabric-dark.css +3 -0
- package/styles/fabric-lite.css +3 -0
- package/styles/fabric.css +3 -0
- package/styles/fluent-dark-lite.css +3 -0
- package/styles/fluent-dark.css +3 -0
- package/styles/fluent-lite.css +3 -0
- package/styles/fluent.css +3 -0
- package/styles/fluent2-lite.css +3 -0
- package/styles/fluent2.css +3 -0
- package/styles/highcontrast-light-lite.css +3 -0
- package/styles/highcontrast-light.css +3 -0
- package/styles/highcontrast-lite.css +4 -1
- package/styles/highcontrast.css +4 -1
- package/styles/material-dark-lite.css +3 -0
- package/styles/material-dark.css +3 -0
- package/styles/material-lite.css +3 -0
- package/styles/material.css +3 -0
- package/styles/material3-dark-lite.css +3 -0
- package/styles/material3-dark.css +3 -0
- package/styles/material3-lite.css +3 -0
- package/styles/material3.css +3 -0
- package/styles/multicolumn-combobox/_layout.scss +3 -0
- package/styles/multicolumn-combobox/_tailwind3-definition.scss +32 -0
- package/styles/multicolumn-combobox/bds.css +467 -0
- package/styles/multicolumn-combobox/bds.scss +11 -0
- package/styles/multicolumn-combobox/bootstrap-dark.css +3 -0
- package/styles/multicolumn-combobox/bootstrap.css +3 -0
- package/styles/multicolumn-combobox/bootstrap4.css +3 -0
- package/styles/multicolumn-combobox/bootstrap5-dark.css +3 -0
- package/styles/multicolumn-combobox/bootstrap5.3.css +3 -0
- package/styles/multicolumn-combobox/bootstrap5.css +3 -0
- package/styles/multicolumn-combobox/fabric-dark.css +3 -0
- package/styles/multicolumn-combobox/fabric.css +3 -0
- package/styles/multicolumn-combobox/fluent-dark.css +3 -0
- package/styles/multicolumn-combobox/fluent.css +3 -0
- package/styles/multicolumn-combobox/fluent2.css +3 -0
- package/styles/multicolumn-combobox/highcontrast-light.css +3 -0
- package/styles/multicolumn-combobox/highcontrast.css +4 -1
- package/styles/multicolumn-combobox/icons/_tailwind3.scss +6 -0
- package/styles/multicolumn-combobox/material-dark.css +3 -0
- package/styles/multicolumn-combobox/material.css +3 -0
- package/styles/multicolumn-combobox/material3-dark.css +3 -0
- package/styles/multicolumn-combobox/material3.css +3 -0
- package/styles/multicolumn-combobox/tailwind-dark.css +3 -0
- package/styles/multicolumn-combobox/tailwind.css +3 -0
- package/styles/multicolumn-combobox/tailwind3.css +375 -0
- package/styles/multicolumn-combobox/tailwind3.scss +11 -0
- package/styles/tailwind-dark-lite.css +3 -0
- package/styles/tailwind-dark.css +3 -0
- package/styles/tailwind-lite.css +3 -0
- package/styles/tailwind.css +3 -0
- package/styles/tailwind3-lite.css +324 -0
- package/styles/tailwind3-lite.scss +10 -0
- package/styles/tailwind3.css +375 -0
- package/styles/tailwind3.scss +11 -0
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { ChildProperty, Property, Event, Component, getUniqueID, isNullOrUndefined, addClass, removeClass, formatUnit, attributes, prepend, Browser, append, L10n, select, compile, EventHandler, KeyboardEvents, closest, Animation, detach, Complex, Collection, NotifyPropertyChanges } from '@syncfusion/ej2-base';
|
|
1
|
+
import { ChildProperty, Property, Event, Component, getUniqueID, isNullOrUndefined, addClass, removeClass, formatUnit, getValue, attributes, prepend, Browser, append, L10n, select, compile, EventHandler, KeyboardEvents, closest, Animation, detach, Complex, Collection, NotifyPropertyChanges } from '@syncfusion/ej2-base';
|
|
2
2
|
import { Input } from '@syncfusion/ej2-inputs';
|
|
3
3
|
import { DataManager, Query } from '@syncfusion/ej2-data';
|
|
4
4
|
import { Popup } from '@syncfusion/ej2-popups';
|
|
5
5
|
import { Grid, VirtualScroll, Group, Edit, Sort, Resize } from '@syncfusion/ej2-grids';
|
|
6
|
-
export { Edit, Group, Sort, VirtualScroll } from '@syncfusion/ej2-grids';
|
|
7
6
|
|
|
8
7
|
var __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,53 @@ 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
|
-
const
|
|
348
|
-
|
|
349
|
-
|
|
355
|
+
const flattenData = (data) => {
|
|
356
|
+
const result = [];
|
|
357
|
+
if (data && typeof data === 'object') {
|
|
358
|
+
if (Array.isArray(data)) {
|
|
359
|
+
data.forEach((item) => result.push(...flattenData(item)));
|
|
360
|
+
}
|
|
361
|
+
else {
|
|
362
|
+
Object.keys(data).forEach((key) => result.push(...flattenData(data[`${key}`])));
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
else if (data != null) {
|
|
366
|
+
result.push(String(data));
|
|
367
|
+
}
|
|
368
|
+
return result;
|
|
369
|
+
};
|
|
370
|
+
const flattenedValues = flattenData(data);
|
|
371
|
+
return (flattenedValues.indexOf(selectedValue) !== -1 && flattenedValues.indexOf(selectedText) !== -1);
|
|
350
372
|
}
|
|
351
373
|
updateRowSelection(args) {
|
|
352
374
|
if (args) {
|
|
353
375
|
const dataRows = args.rows;
|
|
354
376
|
dataRows.forEach((row) => {
|
|
355
|
-
|
|
356
|
-
const index = row.index;
|
|
357
|
-
this.selectDataRow(data, index);
|
|
377
|
+
this.selectDataRow(row.data, row.index);
|
|
358
378
|
});
|
|
359
379
|
}
|
|
360
380
|
}
|
|
361
381
|
selectDataRow(data, index) {
|
|
362
|
-
const isPresent = this.isRowMatching(data, this.value ?
|
|
382
|
+
const isPresent = this.isRowMatching(data, this.value ?
|
|
383
|
+
this.value.toString() : '', this.text ? this.text.toString() : '');
|
|
363
384
|
if (isPresent) {
|
|
364
385
|
this.gridObj.selectRow(index);
|
|
365
386
|
const prevOnChange = this.isProtectedOnChange;
|
|
@@ -375,29 +396,24 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
|
|
|
375
396
|
return Object.keys(obj).every((key) => item[key] === obj[key]);
|
|
376
397
|
});
|
|
377
398
|
}
|
|
378
|
-
/* eslint-enable @typescript-eslint/no-explicit-any */
|
|
379
399
|
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
|
-
});
|
|
400
|
+
return this.columns.map(({ field, header, width, textAlign, format, displayAsCheckBox, template, headerTemplate, customAttributes }) => ({
|
|
401
|
+
field,
|
|
402
|
+
headerText: header,
|
|
403
|
+
width,
|
|
404
|
+
textAlign: textAlign.toString() === '' && this.enableRtl ? 'Right' : textAlign,
|
|
405
|
+
format,
|
|
406
|
+
displayAsCheckBox,
|
|
407
|
+
template,
|
|
408
|
+
headerTemplate,
|
|
409
|
+
customAttributes,
|
|
410
|
+
type: displayAsCheckBox && !format ? 'boolean' : undefined
|
|
411
|
+
}));
|
|
398
412
|
}
|
|
399
413
|
updateGroupByField() {
|
|
400
|
-
|
|
414
|
+
const groupByField = this.fields.groupBy;
|
|
415
|
+
const isGroupByValid = groupByField !== '' && !isNullOrUndefined(groupByField);
|
|
416
|
+
if (isGroupByValid) {
|
|
401
417
|
if (this.sortType.toString().toLowerCase() !== 'multiplecolumns') {
|
|
402
418
|
this.gridEle.classList.add('e-multicolumn-group');
|
|
403
419
|
}
|
|
@@ -406,10 +422,11 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
|
|
|
406
422
|
this.gridObj.allowGrouping = true;
|
|
407
423
|
this.gridObj.groupSettings = {
|
|
408
424
|
showDropArea: false,
|
|
409
|
-
columns: [
|
|
410
|
-
captionTemplate: (this.groupTemplate && this.fields.groupBy !== '' && !isNullOrUndefined(this.fields.groupBy))
|
|
411
|
-
? this.groupTemplate : '${key}'
|
|
425
|
+
columns: [groupByField]
|
|
412
426
|
};
|
|
427
|
+
if (this.groupTemplate && isGroupByValid) {
|
|
428
|
+
this.gridObj.groupSettings.captionTemplate = this.groupTemplate;
|
|
429
|
+
}
|
|
413
430
|
if (this.isVue) {
|
|
414
431
|
this.gridObj.isVue = this.isVue;
|
|
415
432
|
}
|
|
@@ -419,12 +436,13 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
|
|
|
419
436
|
onDataBound() {
|
|
420
437
|
const dataCount = this.dataSource.length;
|
|
421
438
|
const popupChild = this.popupDiv.querySelector('.' + MULTICOLUMNGRID);
|
|
439
|
+
const hasNoDataClass = this.popupDiv.classList.contains(NODATA);
|
|
422
440
|
if (dataCount <= 0 && popupChild) {
|
|
423
441
|
this.l10nUpdate();
|
|
424
442
|
this.popupDiv.removeChild(this.gridEle);
|
|
425
443
|
addClass([this.popupDiv], [NODATA]);
|
|
426
444
|
}
|
|
427
|
-
else if (
|
|
445
|
+
else if (hasNoDataClass && dataCount >= 1) {
|
|
428
446
|
removeClass([this.popupDiv], [NODATA]);
|
|
429
447
|
const noRecordEle = this.popupDiv.querySelector('.e-no-records');
|
|
430
448
|
if (noRecordEle) {
|
|
@@ -432,8 +450,9 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
|
|
|
432
450
|
}
|
|
433
451
|
}
|
|
434
452
|
if (this.isInitialRender) {
|
|
435
|
-
const
|
|
436
|
-
|
|
453
|
+
const gridContentRow = this.popupDiv.querySelector('.e-gridcontent tr');
|
|
454
|
+
const rowHeight = !hasNoDataClass ? gridContentRow ?
|
|
455
|
+
gridContentRow.getBoundingClientRect().height : 0 :
|
|
437
456
|
this.popupDiv.getBoundingClientRect().height;
|
|
438
457
|
this.popupRowHeight = rowHeight;
|
|
439
458
|
this.popupObj.hide();
|
|
@@ -452,6 +471,16 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
|
|
|
452
471
|
addClass([this.popupDiv], [NODATA]);
|
|
453
472
|
}
|
|
454
473
|
renderInput() {
|
|
474
|
+
const allowedAttributes = ['aria-expanded', 'aria-readOnly', 'aria-disabled', 'autocomplete',
|
|
475
|
+
'autocapitalize', 'spellcheck', 'tabindex'];
|
|
476
|
+
const setAttributes = (element, attributes) => {
|
|
477
|
+
for (const key in attributes) {
|
|
478
|
+
// eslint-disable-next-line no-prototype-builtins
|
|
479
|
+
if (attributes.hasOwnProperty(key) && allowedAttributes.indexOf(key) !== -1 && isNullOrUndefined(element.getAttribute(key))) {
|
|
480
|
+
element.setAttribute(key, attributes[key]);
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
};
|
|
455
484
|
if (this.element.tagName === 'INPUT') {
|
|
456
485
|
this.inputEle = this.element;
|
|
457
486
|
if (isNullOrUndefined(this.inputEle.getAttribute('role'))) {
|
|
@@ -460,13 +489,15 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
|
|
|
460
489
|
if (isNullOrUndefined(this.inputEle.getAttribute('type'))) {
|
|
461
490
|
this.inputEle.setAttribute('type', 'text');
|
|
462
491
|
}
|
|
463
|
-
this.inputEle
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
492
|
+
setAttributes(this.inputEle, {
|
|
493
|
+
'aria-expanded': 'false',
|
|
494
|
+
'aria-readOnly': this.readonly.toString(),
|
|
495
|
+
'aria-disabled': this.disabled.toString(),
|
|
496
|
+
autocomplete: 'off',
|
|
497
|
+
autocapitalize: 'off',
|
|
498
|
+
spellcheck: 'false',
|
|
499
|
+
tabindex: '0'
|
|
500
|
+
});
|
|
470
501
|
}
|
|
471
502
|
else {
|
|
472
503
|
this.inputEle = this.createElement('input', { attrs: { role: 'textbox', type: 'text' } });
|
|
@@ -496,48 +527,52 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
|
|
|
496
527
|
this.initValue(null, null, true);
|
|
497
528
|
}
|
|
498
529
|
}
|
|
499
|
-
/* To calculate the width when change via set model */
|
|
500
530
|
setElementWidth(inputWidth) {
|
|
531
|
+
if (isNullOrUndefined(inputWidth)) {
|
|
532
|
+
return;
|
|
533
|
+
}
|
|
501
534
|
const ddElement = this.inputWrapper;
|
|
502
|
-
if (
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
ddElement.style.width = (inputWidth.match(/px|%|em/)) ? (inputWidth) : (formatUnit(inputWidth));
|
|
508
|
-
}
|
|
535
|
+
if (typeof inputWidth === 'number') {
|
|
536
|
+
ddElement.style.width = formatUnit(inputWidth);
|
|
537
|
+
}
|
|
538
|
+
else if (typeof inputWidth === 'string') {
|
|
539
|
+
ddElement.style.width = inputWidth.match(/px|%|em/) ? inputWidth : formatUnit(inputWidth);
|
|
509
540
|
}
|
|
510
541
|
}
|
|
511
542
|
setHTMLAttributes() {
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
543
|
+
const htmlAttributes = this.htmlAttributes;
|
|
544
|
+
const inputEle = this.inputEle;
|
|
545
|
+
if (Object.keys(htmlAttributes).length) {
|
|
546
|
+
for (const htmlAttr of Object.keys(htmlAttributes)) {
|
|
547
|
+
switch (htmlAttr) {
|
|
548
|
+
case 'class':
|
|
549
|
+
this.inputWrapper.classList.add(htmlAttributes[htmlAttr]);
|
|
550
|
+
break;
|
|
551
|
+
case 'disabled':
|
|
552
|
+
this.setProperties({ enabled: false }, true);
|
|
553
|
+
this.setEnable();
|
|
554
|
+
break;
|
|
555
|
+
case 'readonly':
|
|
556
|
+
this.setProperties({ readonly: true }, true);
|
|
557
|
+
this.dataBind();
|
|
558
|
+
break;
|
|
559
|
+
case 'style':
|
|
560
|
+
this.inputWrapper.setAttribute('style', htmlAttributes[htmlAttr]);
|
|
561
|
+
break;
|
|
562
|
+
default: {
|
|
563
|
+
const defaultAttr = ['title', 'id', 'placeholder', 'role', 'autocomplete', 'autocapitalize', 'spellcheck', 'minlength', 'maxlength'];
|
|
564
|
+
if (defaultAttr.indexOf(htmlAttr) > -1) {
|
|
565
|
+
if (htmlAttr === 'placeholder') {
|
|
566
|
+
Input.setPlaceholder(htmlAttributes[htmlAttr], inputEle);
|
|
567
|
+
}
|
|
568
|
+
else {
|
|
569
|
+
inputEle.setAttribute(htmlAttr, htmlAttributes[htmlAttr]);
|
|
570
|
+
}
|
|
534
571
|
}
|
|
535
572
|
else {
|
|
536
|
-
|
|
573
|
+
inputEle.setAttribute(htmlAttr, htmlAttributes[htmlAttr]);
|
|
537
574
|
}
|
|
538
|
-
|
|
539
|
-
else {
|
|
540
|
-
this.inputEle.setAttribute(htmlAttr, this.htmlAttributes[`${htmlAttr}`]);
|
|
575
|
+
break;
|
|
541
576
|
}
|
|
542
577
|
}
|
|
543
578
|
}
|
|
@@ -548,8 +583,7 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
|
|
|
548
583
|
Input.setEnabled(!this.disabled, this.inputEle);
|
|
549
584
|
if (!this.disabled) {
|
|
550
585
|
removeClass([this.inputWrapper], DISABLED);
|
|
551
|
-
this.
|
|
552
|
-
this.inputWrapper.setAttribute('aria-disabled', 'false');
|
|
586
|
+
this.setAriaDisabled('false');
|
|
553
587
|
}
|
|
554
588
|
else {
|
|
555
589
|
if (this.isPopupOpen) {
|
|
@@ -559,10 +593,17 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
|
|
|
559
593
|
if (this.inputWrapper && this.inputWrapper.classList.contains(INPUTFOCUS)) {
|
|
560
594
|
removeClass([this.inputWrapper], [INPUTFOCUS]);
|
|
561
595
|
}
|
|
562
|
-
this.
|
|
563
|
-
this.inputWrapper.setAttribute('aria-disabled', 'true');
|
|
596
|
+
this.setAriaDisabled('true');
|
|
564
597
|
}
|
|
565
598
|
}
|
|
599
|
+
setAriaDisabled(value) {
|
|
600
|
+
this.inputEle.setAttribute('aria-disabled', value);
|
|
601
|
+
this.inputWrapper.setAttribute('aria-disabled', value);
|
|
602
|
+
}
|
|
603
|
+
updateFieldValue(fieldValue, dataObj) {
|
|
604
|
+
const fieldVal = getValue(fieldValue, dataObj).toString();
|
|
605
|
+
return fieldVal;
|
|
606
|
+
}
|
|
566
607
|
initValue(isRerender, isValue, isInitial) {
|
|
567
608
|
const prevItemData = this.gridObj.getSelectedRecords()[0];
|
|
568
609
|
const prevItemEle = this.gridObj.getSelectedRows()[0];
|
|
@@ -587,8 +628,9 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
|
|
|
587
628
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
588
629
|
const dataLists = e.result;
|
|
589
630
|
const filteredData = dataLists.filter((item) => {
|
|
590
|
-
|
|
591
|
-
!isNullOrUndefined(this.value) ? this.fields.value : this.fields.text
|
|
631
|
+
const fieldVal = this.updateFieldValue(isRerender ? (isValue ? this.fields.value : this.fields.text) :
|
|
632
|
+
!isNullOrUndefined(this.value) ? this.fields.value : this.fields.text, item);
|
|
633
|
+
return fieldVal === value;
|
|
592
634
|
});
|
|
593
635
|
if (filteredData.length > 0) {
|
|
594
636
|
item = filteredData[0];
|
|
@@ -600,8 +642,9 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
|
|
|
600
642
|
}
|
|
601
643
|
else if (!isNullOrUndefined(this.dataSource) && this.dataSource instanceof Array) {
|
|
602
644
|
item = this.dataSource.filter((data) => {
|
|
603
|
-
|
|
604
|
-
!isNullOrUndefined(this.value) ? this.fields.value : this.fields.text
|
|
645
|
+
const fieldVal = this.updateFieldValue(isRerender ? (isValue ? this.fields.value : this.fields.text) :
|
|
646
|
+
!isNullOrUndefined(this.value) ? this.fields.value : this.fields.text, data);
|
|
647
|
+
return fieldVal === value;
|
|
605
648
|
})[0];
|
|
606
649
|
updateValues(this.dataSource);
|
|
607
650
|
}
|
|
@@ -648,8 +691,9 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
|
|
|
648
691
|
}
|
|
649
692
|
}
|
|
650
693
|
updateChangeEvent(item, prevItemData, prevItemEle, currentValue, currentText, currentIndex, isRerender, isInitial) {
|
|
694
|
+
const fieldValue = item ? this.updateFieldValue(this.fields.value, item) : null;
|
|
651
695
|
const ChangeEventArgs = {
|
|
652
|
-
value: item ?
|
|
696
|
+
value: item ? fieldValue : null,
|
|
653
697
|
itemData: { text: currentText, value: currentValue },
|
|
654
698
|
item: this.getDataByValue(this.value),
|
|
655
699
|
previousItemData: prevItemData,
|
|
@@ -662,10 +706,12 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
|
|
|
662
706
|
}
|
|
663
707
|
updateCurrentValues(item, dataList) {
|
|
664
708
|
if (!isNullOrUndefined(item)) {
|
|
665
|
-
|
|
709
|
+
const fieldText = this.updateFieldValue(this.fields.text, item);
|
|
710
|
+
const fieldValue = this.updateFieldValue(this.fields.value, item);
|
|
711
|
+
Input.setValue(fieldText, this.inputEle, this.floatLabelType, this.showClearButton);
|
|
666
712
|
return {
|
|
667
|
-
currentValue:
|
|
668
|
-
currentText:
|
|
713
|
+
currentValue: fieldValue,
|
|
714
|
+
currentText: fieldText,
|
|
669
715
|
currentIndex: dataList.indexOf(item)
|
|
670
716
|
};
|
|
671
717
|
}
|
|
@@ -822,7 +868,7 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
|
|
|
822
868
|
getSize(ispopupWidth) {
|
|
823
869
|
const currentDimension = ispopupWidth ? this.popupWidth : this.popupHeight;
|
|
824
870
|
let size = formatUnit(currentDimension);
|
|
825
|
-
if (size.
|
|
871
|
+
if (size.includes('%')) {
|
|
826
872
|
const dimensionValue = ispopupWidth ? this.inputWrapper.offsetWidth : document.documentElement.clientHeight;
|
|
827
873
|
size = (dimensionValue * parseFloat(size) / 100).toString() + 'px';
|
|
828
874
|
}
|
|
@@ -841,16 +887,16 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
|
|
|
841
887
|
cancel: false
|
|
842
888
|
};
|
|
843
889
|
const selectedRecords = this.gridObj.getSelectedRecords()[0];
|
|
844
|
-
const
|
|
845
|
-
const
|
|
890
|
+
const dataText = selectedRecords ? this.updateFieldValue(this.fields.text, selectedRecords) : '';
|
|
891
|
+
const dataValue = selectedRecords ? this.updateFieldValue(this.fields.value, selectedRecords) : '';
|
|
846
892
|
const ChangeEventArgs = {
|
|
847
893
|
isInteracted: e ? true : false,
|
|
848
894
|
item: selectedRecords,
|
|
849
895
|
itemElement: row,
|
|
850
|
-
itemData: { text:
|
|
896
|
+
itemData: { text: selectedRecords ? dataText : '', value: selectedRecords ? dataValue : '' },
|
|
851
897
|
event: e,
|
|
852
898
|
cancel: false,
|
|
853
|
-
value:
|
|
899
|
+
value: selectedRecords ? dataValue : '',
|
|
854
900
|
previousItemData: { text: this.text, value: this.value },
|
|
855
901
|
previousItemElement: this.previousItemElement
|
|
856
902
|
};
|
|
@@ -860,9 +906,9 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
|
|
|
860
906
|
const event = e;
|
|
861
907
|
const isUpdateVal = event.key === 'Enter' || event.key === 'Tab' || event.shiftKey && event.key === 'Tab' || event.altKey && event.key === 'ArrowUp';
|
|
862
908
|
if (!isKeyNav || (isKeyNav && isUpdateVal)) {
|
|
863
|
-
this.updateValues(
|
|
909
|
+
this.updateValues(selectedRecords ? dataValue : '', selectedRecords ? dataText : '', this.gridObj.selectedRowIndex, ChangeEventArgs);
|
|
864
910
|
}
|
|
865
|
-
Input.setValue(
|
|
911
|
+
Input.setValue(selectedRecords ? dataText : '', this.inputEle, this.floatLabelType, this.showClearButton);
|
|
866
912
|
if (!isKeyNav || (isKeyNav && isUpdateVal)) {
|
|
867
913
|
this.hidePopup(e);
|
|
868
914
|
}
|
|
@@ -873,8 +919,8 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
|
|
|
873
919
|
this.previousItemElement = eventArgs.itemElement;
|
|
874
920
|
const prevOnChange = this.isProtectedOnChange;
|
|
875
921
|
this.isProtectedOnChange = true;
|
|
876
|
-
this.text = text
|
|
877
|
-
this.value = value
|
|
922
|
+
this.text = text || this.text;
|
|
923
|
+
this.value = value || this.value;
|
|
878
924
|
this.index = !isNullOrUndefined(index) ? index : this.index;
|
|
879
925
|
this.isProtectedOnChange = prevOnChange;
|
|
880
926
|
if (!isInitial) {
|
|
@@ -916,42 +962,47 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
|
|
|
916
962
|
this.updateInputValue(e.target.value);
|
|
917
963
|
}
|
|
918
964
|
updateInputValue(inputValue) {
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
965
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
966
|
+
let data;
|
|
967
|
+
let exactData;
|
|
968
|
+
if (this.dataSource instanceof DataManager) {
|
|
969
|
+
const query = new Query();
|
|
970
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
971
|
+
const result = yield this.dataSource.executeQuery(query);
|
|
924
972
|
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
|
-
}
|
|
973
|
+
({ data, exactData } = this.filterDatas(totaldata, inputValue));
|
|
974
|
+
}
|
|
975
|
+
else if (Array.isArray(this.dataSource)) {
|
|
976
|
+
({ data, exactData } = this.filterDatas(this.dataSource, inputValue));
|
|
977
|
+
}
|
|
978
|
+
this.selectFilteredRows(data, exactData);
|
|
979
|
+
});
|
|
937
980
|
}
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
this.
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
981
|
+
filterDatas(dataSource, inputValue) {
|
|
982
|
+
const data = dataSource.filter((item) => {
|
|
983
|
+
const fieldText = this.updateFieldValue(this.fields.text, item);
|
|
984
|
+
return fieldText.toLowerCase().startsWith(inputValue.toLowerCase());
|
|
985
|
+
});
|
|
986
|
+
const exactData = dataSource.filter((item) => {
|
|
987
|
+
const fieldText = this.updateFieldValue(this.fields.text, item);
|
|
988
|
+
return fieldText === inputValue;
|
|
989
|
+
});
|
|
990
|
+
return { data, exactData };
|
|
991
|
+
}
|
|
992
|
+
selectFilteredRows(data, exactData) {
|
|
993
|
+
if (data.length <= 0) {
|
|
994
|
+
this.matchedRowEle = this.matchedContent = this.exactMatchedContent = null;
|
|
995
|
+
return;
|
|
951
996
|
}
|
|
997
|
+
this.matchedContent = data[0];
|
|
998
|
+
this.exactMatchedContent = exactData[0];
|
|
999
|
+
const selectedIndex = this.findIndex(this.gridObj.currentViewData, this.matchedContent);
|
|
1000
|
+
this.matchedRowEle = this.gridObj.getRowByIndex(selectedIndex);
|
|
952
1001
|
}
|
|
953
1002
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
954
1003
|
filterAction(dataSource, inputValue, query, fields) {
|
|
1004
|
+
const isQuery = query || new Query();
|
|
1005
|
+
const filterType = this.filterType.toString().toLowerCase();
|
|
955
1006
|
if (isNullOrUndefined(query) && isNullOrUndefined(fields)) {
|
|
956
1007
|
this.updateGridDataSource(dataSource);
|
|
957
1008
|
}
|
|
@@ -968,12 +1019,10 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
|
|
|
968
1019
|
}
|
|
969
1020
|
}
|
|
970
1021
|
else {
|
|
971
|
-
const isQuery = query || new Query();
|
|
972
1022
|
if (dataSource instanceof DataManager) {
|
|
973
1023
|
this.filteringHandler(dataSource, inputValue, isQuery, fields);
|
|
974
1024
|
}
|
|
975
1025
|
else if (Array.isArray(dataSource)) {
|
|
976
|
-
const filterType = this.filterType.toString().toLowerCase();
|
|
977
1026
|
const filteredData = dataSource.filter((item) => this.filterData(item, filterType, inputValue, fields));
|
|
978
1027
|
this.updateGridDataSource(filteredData);
|
|
979
1028
|
}
|
|
@@ -992,7 +1041,8 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
|
|
|
992
1041
|
});
|
|
993
1042
|
}
|
|
994
1043
|
filterData(item, filterType, inputValue, fields) {
|
|
995
|
-
const
|
|
1044
|
+
const dataValue = this.updateFieldValue(fields ? fields.text : this.fields.text, item);
|
|
1045
|
+
const itemValue = dataValue.toLowerCase();
|
|
996
1046
|
switch (filterType) {
|
|
997
1047
|
case 'startswith':
|
|
998
1048
|
return itemValue.startsWith(inputValue);
|
|
@@ -1099,39 +1149,49 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
|
|
|
1099
1149
|
}
|
|
1100
1150
|
}
|
|
1101
1151
|
onDocumentClick(e) {
|
|
1152
|
+
const target = e.target;
|
|
1102
1153
|
if (this.disabled || this.readonly || !this.isPopupOpen) {
|
|
1103
|
-
if (!
|
|
1154
|
+
if (!target.closest('.e-multicolumn-list')) {
|
|
1104
1155
|
this.focusOut();
|
|
1105
1156
|
}
|
|
1106
1157
|
return;
|
|
1107
1158
|
}
|
|
1108
|
-
const target = e.target;
|
|
1109
1159
|
if ((target.classList.contains('e-multicolumn-list-icon') || closest(target, '.e-popup'))) {
|
|
1110
1160
|
e.preventDefault();
|
|
1111
1161
|
}
|
|
1112
1162
|
else {
|
|
1113
1163
|
if (!target.classList.contains('e-multicolumncombobox') && !target.classList.contains('e-clear-icon')) {
|
|
1114
|
-
this.
|
|
1164
|
+
if (!isNullOrUndefined(this.text)) {
|
|
1165
|
+
this.updateInputValue(this.text);
|
|
1166
|
+
}
|
|
1167
|
+
const isClearVal = this.inputEle.value === '' ? true : false;
|
|
1168
|
+
this.updateValuesOnInput(e, null, isClearVal);
|
|
1115
1169
|
}
|
|
1116
1170
|
}
|
|
1117
1171
|
}
|
|
1118
|
-
updateValuesOnInput(mouseEvent, keyEvent, isClearValues = false) {
|
|
1172
|
+
updateValuesOnInput(mouseEvent, keyEvent, isClearValues, isKeyDown = false) {
|
|
1119
1173
|
const e = mouseEvent ? mouseEvent : keyEvent;
|
|
1174
|
+
const val = isKeyDown ? this.matchedContent : this.exactMatchedContent;
|
|
1175
|
+
if (!val) {
|
|
1176
|
+
this.inputEle.value = this.value = this.index = this.text = null;
|
|
1177
|
+
}
|
|
1120
1178
|
this.hidePopup(e);
|
|
1121
|
-
if (this.matchedRowEle && !isClearValues) {
|
|
1122
|
-
const prevOnChange = this.isProtectedOnChange;
|
|
1123
|
-
this.isProtectedOnChange = true;
|
|
1179
|
+
if (this.matchedRowEle && !isClearValues && val) {
|
|
1124
1180
|
setTimeout(() => {
|
|
1125
|
-
|
|
1126
|
-
this.
|
|
1181
|
+
const prevOnChange = this.isProtectedOnChange;
|
|
1182
|
+
this.isProtectedOnChange = true;
|
|
1183
|
+
const fieldText = this.updateFieldValue(this.fields.text, this.matchedContent);
|
|
1184
|
+
const fieldValue = this.updateFieldValue(this.fields.value, this.matchedContent);
|
|
1185
|
+
this.inputEle.value = fieldText;
|
|
1186
|
+
this.value = fieldValue;
|
|
1127
1187
|
const selectIndex = this.findIndex(this.gridObj.currentViewData, this.matchedContent);
|
|
1128
1188
|
this.index = selectIndex;
|
|
1129
|
-
this.text =
|
|
1189
|
+
this.text = fieldText;
|
|
1130
1190
|
this.gridObj.selectRow(selectIndex);
|
|
1131
1191
|
this.selectedGridRow(this.gridObj.getRowByIndex(selectIndex), e);
|
|
1132
1192
|
this.previousItemElement = this.gridObj.getSelectedRows()[0];
|
|
1193
|
+
this.isProtectedOnChange = prevOnChange;
|
|
1133
1194
|
}, 100);
|
|
1134
|
-
this.isProtectedOnChange = prevOnChange;
|
|
1135
1195
|
}
|
|
1136
1196
|
else {
|
|
1137
1197
|
if (this.isDataFiltered) {
|
|
@@ -1202,7 +1262,7 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
|
|
|
1202
1262
|
this.updateSelectedItem(e, true, true);
|
|
1203
1263
|
break;
|
|
1204
1264
|
case 'enter':
|
|
1205
|
-
this.updateValuesOnInput(null, e);
|
|
1265
|
+
this.updateValuesOnInput(null, e, false, true);
|
|
1206
1266
|
this.focusIn(e);
|
|
1207
1267
|
break;
|
|
1208
1268
|
case 'home':
|
|
@@ -1212,31 +1272,19 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
|
|
|
1212
1272
|
}
|
|
1213
1273
|
}
|
|
1214
1274
|
gridKeyActionHandler(e, isGroup) {
|
|
1275
|
+
const keyActionMap = {
|
|
1276
|
+
'ArrowDown': 'moveDown',
|
|
1277
|
+
'ArrowUp': 'moveUp',
|
|
1278
|
+
'End': 'end',
|
|
1279
|
+
'Home': 'home',
|
|
1280
|
+
'Tab': 'tab',
|
|
1281
|
+
'Escape': 'escape',
|
|
1282
|
+
'Shift+Tab': 'shiftTab',
|
|
1283
|
+
'Alt+ArrowUp': 'altUp'
|
|
1284
|
+
};
|
|
1215
1285
|
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
|
-
}
|
|
1286
|
+
const key = `${e.altKey ? 'Alt+' : ''}${e.shiftKey ? 'Shift+' : ''}${e.key}`;
|
|
1287
|
+
e.action = keyActionMap[key] || e.action;
|
|
1240
1288
|
}
|
|
1241
1289
|
switch (e.action) {
|
|
1242
1290
|
case 'escape':
|
|
@@ -1301,6 +1349,25 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
|
|
|
1301
1349
|
clearIconEle.style.display = this.inputEle.value === '' ? 'none' : 'flex';
|
|
1302
1350
|
}
|
|
1303
1351
|
}
|
|
1352
|
+
updateDynamicDataSource(newDataSource, oldDataSource) {
|
|
1353
|
+
if (this.gridObj) {
|
|
1354
|
+
let dataLength;
|
|
1355
|
+
this.gridObj.dataSource = newDataSource;
|
|
1356
|
+
const isRemoteData = oldDataSource instanceof DataManager;
|
|
1357
|
+
if (isRemoteData) {
|
|
1358
|
+
oldDataSource.executeQuery(new Query()).then((e) => {
|
|
1359
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1360
|
+
dataLength = e.result.length;
|
|
1361
|
+
});
|
|
1362
|
+
}
|
|
1363
|
+
else {
|
|
1364
|
+
dataLength = oldDataSource.length;
|
|
1365
|
+
}
|
|
1366
|
+
if (dataLength === 0) {
|
|
1367
|
+
this.popupDiv.appendChild(this.gridEle);
|
|
1368
|
+
}
|
|
1369
|
+
}
|
|
1370
|
+
}
|
|
1304
1371
|
/**
|
|
1305
1372
|
* Sets the focus to the component for interaction.component for interaction.
|
|
1306
1373
|
*
|
|
@@ -1381,11 +1448,12 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
|
|
|
1381
1448
|
const contentEle = this.gridObj.getContent();
|
|
1382
1449
|
if (contentEle) {
|
|
1383
1450
|
const activeRow = contentEle.querySelector('.e-rowcell.e-active');
|
|
1451
|
+
const firstRow = contentEle.querySelector('.e-row');
|
|
1384
1452
|
if (activeRow) {
|
|
1385
1453
|
this.inputEle.setAttribute('aria-activedescendant', activeRow.parentElement.getAttribute('data-uid'));
|
|
1386
1454
|
}
|
|
1387
|
-
else if (
|
|
1388
|
-
this.inputEle.setAttribute('aria-activedescendant',
|
|
1455
|
+
else if (firstRow) {
|
|
1456
|
+
this.inputEle.setAttribute('aria-activedescendant', firstRow.getAttribute('data-uid'));
|
|
1389
1457
|
}
|
|
1390
1458
|
}
|
|
1391
1459
|
if (!isNullOrUndefined(this.dataSource) && this.dataSource instanceof DataManager) {
|
|
@@ -1407,24 +1475,21 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
|
|
|
1407
1475
|
hidePopup(e) {
|
|
1408
1476
|
const animModel = { name: 'FadeOut', duration: 100 };
|
|
1409
1477
|
const eventArgs = { popup: this.popupObj, event: e || null, cancel: false, animation: animModel };
|
|
1478
|
+
const target = e ? e.target : null;
|
|
1410
1479
|
this.trigger('close', eventArgs, (eventArgs) => {
|
|
1411
1480
|
if (!eventArgs.cancel) {
|
|
1412
1481
|
this.isPopupOpen = false;
|
|
1413
1482
|
removeClass([this.inputWrapper], [ICONANIMATION]);
|
|
1414
1483
|
attributes(this.inputEle, { 'aria-expanded': 'false' });
|
|
1415
1484
|
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();
|
|
1485
|
+
if (target && (target.classList.contains('e-multicolumn-list-icon') || target.classList.contains('e-rowcell'))) {
|
|
1486
|
+
if (!this.value) {
|
|
1487
|
+
this.gridObj.refreshColumns();
|
|
1427
1488
|
}
|
|
1489
|
+
setTimeout(() => { this.focusIn(e); });
|
|
1490
|
+
}
|
|
1491
|
+
else {
|
|
1492
|
+
this.focusOut();
|
|
1428
1493
|
}
|
|
1429
1494
|
this.inputEle.removeAttribute('aria-owns');
|
|
1430
1495
|
this.inputEle.removeAttribute('aria-activedescendant');
|
|
@@ -1471,7 +1536,8 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
|
|
|
1471
1536
|
getDataByValue(value) {
|
|
1472
1537
|
if (!isNullOrUndefined(this.dataSource) && this.dataSource instanceof Array) {
|
|
1473
1538
|
return this.dataSource.filter((item) => {
|
|
1474
|
-
|
|
1539
|
+
const fieldValue = this.updateFieldValue(this.fields.value, item);
|
|
1540
|
+
return fieldValue === value;
|
|
1475
1541
|
})[0];
|
|
1476
1542
|
}
|
|
1477
1543
|
else if (!isNullOrUndefined(this.dataSource) && this.dataSource instanceof DataManager) {
|
|
@@ -1479,7 +1545,8 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
|
|
|
1479
1545
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1480
1546
|
const dataLists = e.result;
|
|
1481
1547
|
return dataLists.filter((item) => {
|
|
1482
|
-
|
|
1548
|
+
const fieldValue = this.updateFieldValue(this.fields.value, item);
|
|
1549
|
+
return fieldValue === value;
|
|
1483
1550
|
})[0];
|
|
1484
1551
|
});
|
|
1485
1552
|
}
|
|
@@ -1630,9 +1697,7 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
|
|
|
1630
1697
|
}
|
|
1631
1698
|
break;
|
|
1632
1699
|
case 'dataSource':
|
|
1633
|
-
|
|
1634
|
-
this.gridObj.dataSource = newProp.dataSource;
|
|
1635
|
-
}
|
|
1700
|
+
this.updateDynamicDataSource(newProp.dataSource, oldProp.dataSource);
|
|
1636
1701
|
break;
|
|
1637
1702
|
case 'query':
|
|
1638
1703
|
if (this.gridObj) {
|