@syncfusion/ej2-dropdowns 20.3.60 → 20.4.40
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/.eslintrc.json +16 -1
- package/CHANGELOG.md +12 -31
- package/dist/ej2-dropdowns.min.js +2 -2
- package/dist/ej2-dropdowns.umd.min.js +2 -2
- package/dist/ej2-dropdowns.umd.min.js.map +1 -1
- package/dist/es6/ej2-dropdowns.es2015.js +500 -314
- package/dist/es6/ej2-dropdowns.es2015.js.map +1 -1
- package/dist/es6/ej2-dropdowns.es5.js +485 -299
- package/dist/es6/ej2-dropdowns.es5.js.map +1 -1
- package/dist/global/ej2-dropdowns.min.js +2 -2
- package/dist/global/ej2-dropdowns.min.js.map +1 -1
- package/dist/global/index.d.ts +1 -1
- package/package.json +13 -12
- package/src/auto-complete/auto-complete-model.d.ts +1 -1
- package/src/combo-box/combo-box.js +7 -5
- package/src/drop-down-base/drop-down-base-model.d.ts +0 -18
- package/src/drop-down-base/drop-down-base.d.ts +0 -22
- package/src/drop-down-base/drop-down-base.js +42 -37
- package/src/drop-down-list/drop-down-list-model.d.ts +18 -0
- package/src/drop-down-list/drop-down-list.d.ts +22 -0
- package/src/drop-down-list/drop-down-list.js +95 -41
- package/src/drop-down-tree/drop-down-tree-model.d.ts +15 -1
- package/src/drop-down-tree/drop-down-tree.d.ts +13 -1
- package/src/drop-down-tree/drop-down-tree.js +25 -5
- package/src/list-box/list-box-model.d.ts +18 -0
- package/src/list-box/list-box.d.ts +22 -0
- package/src/list-box/list-box.js +38 -17
- package/src/mention/mention-model.d.ts +2 -2
- package/src/mention/mention.d.ts +4 -1
- package/src/mention/mention.js +66 -27
- package/src/multi-select/checkbox-selection.js +10 -8
- package/src/multi-select/multi-select.js +203 -156
- package/styles/bootstrap5-dark.css +2 -2
- package/styles/bootstrap5.css +2 -2
- package/styles/drop-down-base/_bootstrap-dark-definition.scss +1 -0
- package/styles/drop-down-base/_bootstrap-definition.scss +1 -0
- package/styles/drop-down-base/_bootstrap4-definition.scss +1 -0
- package/styles/drop-down-base/_bootstrap5-definition.scss +1 -0
- package/styles/drop-down-base/_fabric-dark-definition.scss +1 -0
- package/styles/drop-down-base/_fabric-definition.scss +1 -0
- package/styles/drop-down-base/_fluent-definition.scss +1 -0
- package/styles/drop-down-base/_fusionnew-definition.scss +1 -0
- package/styles/drop-down-base/_highcontrast-definition.scss +1 -0
- package/styles/drop-down-base/_highcontrast-light-definition.scss +1 -0
- package/styles/drop-down-base/_layout.scss +1 -1
- package/styles/drop-down-base/_material-dark-definition.scss +1 -0
- package/styles/drop-down-base/_material-definition.scss +1 -0
- package/styles/drop-down-base/_material3-definition.scss +1 -0
- package/styles/drop-down-base/_tailwind-definition.scss +1 -0
- package/styles/drop-down-base/material-dark.css +1 -1
- package/styles/drop-down-tree/_layout.scss +3 -3
- package/styles/drop-down-tree/bootstrap5-dark.css +2 -2
- package/styles/drop-down-tree/bootstrap5.css +2 -2
- package/styles/material-dark.css +1 -1
package/src/list-box/list-box.js
CHANGED
|
@@ -130,6 +130,7 @@ var ListBox = /** @class */ (function (_super) {
|
|
|
130
130
|
this.isCustomFiltering = false;
|
|
131
131
|
this.initialSelectedOptions = this.value;
|
|
132
132
|
_super.prototype.render.call(this);
|
|
133
|
+
this.setEnabled();
|
|
133
134
|
this.renderComplete();
|
|
134
135
|
};
|
|
135
136
|
ListBox.prototype.initWrapper = function () {
|
|
@@ -427,10 +428,10 @@ var ListBox = /** @class */ (function (_super) {
|
|
|
427
428
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
428
429
|
var event = args.event;
|
|
429
430
|
var wrapper;
|
|
430
|
-
if (args.target && (args.target.classList.contains(
|
|
431
|
-
|| args.target.classList.contains(
|
|
432
|
-
if (args.target.classList.contains(
|
|
433
|
-
|| args.target.classList.contains(
|
|
431
|
+
if (args.target && (args.target.classList.contains('e-listbox-wrapper') || args.target.classList.contains('e-list-item')
|
|
432
|
+
|| args.target.classList.contains('e-filter-parent') || args.target.classList.contains('e-input-group'))) {
|
|
433
|
+
if (args.target.classList.contains('e-list-item') || args.target.classList.contains('e-filter-parent')
|
|
434
|
+
|| args.target.classList.contains('e-input-group')) {
|
|
434
435
|
wrapper = args.target.closest('.e-listbox-wrapper');
|
|
435
436
|
}
|
|
436
437
|
else {
|
|
@@ -485,7 +486,8 @@ var ListBox = /** @class */ (function (_super) {
|
|
|
485
486
|
var getArgs = this.getDragArgs({ target: args.droppedElement }, true);
|
|
486
487
|
var sourceArgs = { previousData: this.dataSource };
|
|
487
488
|
var destArgs = { previousData: listObj.dataSource };
|
|
488
|
-
var dragArgs = extend({}, getArgs, { target: args.target, source: { previousData: this.dataSource },
|
|
489
|
+
var dragArgs = extend({}, getArgs, { target: args.target, source: { previousData: this.dataSource },
|
|
490
|
+
previousIndex: args.previousIndex, currentIndex: args.currentIndex });
|
|
489
491
|
if (listObj !== this) {
|
|
490
492
|
var sourceArgs1 = extend(sourceArgs, { currentData: this.listData });
|
|
491
493
|
dragArgs = extend(dragArgs, { source: sourceArgs1, destination: destArgs });
|
|
@@ -613,6 +615,7 @@ var ListBox = /** @class */ (function (_super) {
|
|
|
613
615
|
dragArgs = extend(dragArgs, { destination: dragArgs1 });
|
|
614
616
|
}
|
|
615
617
|
this.trigger('drop', dragArgs);
|
|
618
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
616
619
|
var liCollElem = dragArgs.elements;
|
|
617
620
|
if (liCollElem.length) {
|
|
618
621
|
for (var i = 0; i < liCollElem.length; i++) {
|
|
@@ -622,7 +625,7 @@ var ListBox = /** @class */ (function (_super) {
|
|
|
622
625
|
};
|
|
623
626
|
ListBox.prototype.updateListItems = function (sourceElem, destElem) {
|
|
624
627
|
var i = 0;
|
|
625
|
-
destElem.innerHTML =
|
|
628
|
+
destElem.innerHTML = '';
|
|
626
629
|
while (i < sourceElem.childNodes.length) {
|
|
627
630
|
destElem.appendChild(sourceElem.childNodes[i]);
|
|
628
631
|
}
|
|
@@ -651,6 +654,14 @@ var ListBox = /** @class */ (function (_super) {
|
|
|
651
654
|
}
|
|
652
655
|
return listObj;
|
|
653
656
|
};
|
|
657
|
+
/**
|
|
658
|
+
* Sets the enabled state to DropDownBase.
|
|
659
|
+
*
|
|
660
|
+
* @returns {void}
|
|
661
|
+
*/
|
|
662
|
+
ListBox.prototype.setEnabled = function () {
|
|
663
|
+
this.element.setAttribute('aria-disabled', (this.enabled) ? 'false' : 'true');
|
|
664
|
+
};
|
|
654
665
|
ListBox.prototype.listOption = function (dataSource, fields) {
|
|
655
666
|
this.listCurrentOptions = _super.prototype.listOption.call(this, dataSource, fields);
|
|
656
667
|
this.listCurrentOptions = extend({}, this.listCurrentOptions, { itemCreated: this.triggerBeforeItemRender.bind(this) }, true);
|
|
@@ -1100,9 +1111,7 @@ var ListBox = /** @class */ (function (_super) {
|
|
|
1100
1111
|
prepend([this.filterParent], this.list);
|
|
1101
1112
|
attributes(this.filterInput, {
|
|
1102
1113
|
'aria-disabled': 'false',
|
|
1103
|
-
'aria-
|
|
1104
|
-
'role': 'listbox',
|
|
1105
|
-
'aria-activedescendant': null,
|
|
1114
|
+
'aria-label': 'search list item',
|
|
1106
1115
|
'autocomplete': 'off',
|
|
1107
1116
|
'autocorrect': 'off',
|
|
1108
1117
|
'autocapitalize': 'off',
|
|
@@ -1504,7 +1513,7 @@ var ListBox = /** @class */ (function (_super) {
|
|
|
1504
1513
|
var isRefresh = tListBox.sortOrder !== 'None' || (tListBox.selectionSettings.showCheckbox !==
|
|
1505
1514
|
fListBox.selectionSettings.showCheckbox) || tListBox.fields.groupBy || tListBox.itemTemplate || fListBox.itemTemplate;
|
|
1506
1515
|
this.removeSelected(fListBox, fListBox.getSelectedItems());
|
|
1507
|
-
var tempItems = [].slice.call(fListBox.
|
|
1516
|
+
var tempItems = [].slice.call(fListBox.listData);
|
|
1508
1517
|
var localDataArgs = { cancel: false, items: tempItems, eventName: this.toolbarAction };
|
|
1509
1518
|
fListBox.trigger('actionBegin', localDataArgs);
|
|
1510
1519
|
if (localDataArgs.cancel) {
|
|
@@ -1549,11 +1558,18 @@ var ListBox = /** @class */ (function (_super) {
|
|
|
1549
1558
|
fListBox.value = [];
|
|
1550
1559
|
listData = listData
|
|
1551
1560
|
.filter(function (data) { return data.isHeader !== true; });
|
|
1552
|
-
|
|
1553
|
-
|
|
1561
|
+
var sortedData = listData.filter(function (val) {
|
|
1562
|
+
return tListBox.jsonData.indexOf(val) === -1;
|
|
1563
|
+
});
|
|
1564
|
+
for (var i = 0; i < sortedData.length; i++) {
|
|
1565
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1566
|
+
tListBox.jsonData.splice(index + i, 0, sortedData[i]);
|
|
1567
|
+
}
|
|
1568
|
+
tListBox.listData = listData;
|
|
1569
|
+
if (fListBox.listData.length === fListBox.jsonData.length) {
|
|
1554
1570
|
fListBox.listData = fListBox.sortedData = fListBox.jsonData = [];
|
|
1555
1571
|
}
|
|
1556
|
-
else if (
|
|
1572
|
+
else if (fListBox.allowFiltering) {
|
|
1557
1573
|
for (var i = 0; i < fListBox.listData.length; i++) {
|
|
1558
1574
|
for (var j = 0; j < fListBox.jsonData.length; j++) {
|
|
1559
1575
|
if (fListBox.listData[i] === fListBox.jsonData[j]) {
|
|
@@ -1696,7 +1712,7 @@ var ListBox = /** @class */ (function (_super) {
|
|
|
1696
1712
|
}
|
|
1697
1713
|
}
|
|
1698
1714
|
}
|
|
1699
|
-
else if (e.keyCode !== 37 && e.keyCode !== 39 && e.code !==
|
|
1715
|
+
else if (e.keyCode !== 37 && e.keyCode !== 39 && e.code !== 'KeyA') {
|
|
1700
1716
|
this.upDownKeyHandler(e);
|
|
1701
1717
|
}
|
|
1702
1718
|
}
|
|
@@ -1740,8 +1756,8 @@ var ListBox = /** @class */ (function (_super) {
|
|
|
1740
1756
|
}
|
|
1741
1757
|
if (this.selectionSettings.showCheckbox && e.ctrlKey && e.shiftKey && (e.keyCode === 36 || e.keyCode === 35)) {
|
|
1742
1758
|
var selectedidx = Array.prototype.indexOf.call(ul.children, fli);
|
|
1743
|
-
var sidx = e.code ===
|
|
1744
|
-
var eidx = e.code ===
|
|
1759
|
+
var sidx = e.code === 'Home' ? 0 : selectedidx;
|
|
1760
|
+
var eidx = e.code === 'Home' ? selectedidx : ul.children.length - 1;
|
|
1745
1761
|
for (var i = sidx; i <= eidx; i++) {
|
|
1746
1762
|
var item = ul.children[i];
|
|
1747
1763
|
this.notify('updatelist', { li: item, e: {
|
|
@@ -1899,7 +1915,6 @@ var ListBox = /** @class */ (function (_super) {
|
|
|
1899
1915
|
dvalue_1 = _this.getFormattedValue(li.getAttribute('data-value'));
|
|
1900
1916
|
if (values.indexOf(dvalue_1) < 0) {
|
|
1901
1917
|
li.getElementsByClassName('e-check')[0].classList.remove('e-check');
|
|
1902
|
-
li.getElementsByClassName('e-checkbox-wrapper')[0].removeAttribute('aria-checked');
|
|
1903
1918
|
li.removeAttribute('aria-selected');
|
|
1904
1919
|
}
|
|
1905
1920
|
});
|
|
@@ -2251,6 +2266,12 @@ var ListBox = /** @class */ (function (_super) {
|
|
|
2251
2266
|
__decorate([
|
|
2252
2267
|
Property('')
|
|
2253
2268
|
], ListBox.prototype, "height", void 0);
|
|
2269
|
+
__decorate([
|
|
2270
|
+
Property(true)
|
|
2271
|
+
], ListBox.prototype, "enabled", void 0);
|
|
2272
|
+
__decorate([
|
|
2273
|
+
Property(false)
|
|
2274
|
+
], ListBox.prototype, "enablePersistence", void 0);
|
|
2254
2275
|
__decorate([
|
|
2255
2276
|
Property(false)
|
|
2256
2277
|
], ListBox.prototype, "allowDragAndDrop", void 0);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { KeyboardEvents, compile, Property, EventHandler, Animation, AnimationModel, KeyboardEventArgs, formatUnit, append, attributes } from '@syncfusion/ej2-base';import { isNullOrUndefined, detach, Event, EmitType, Complex, addClass, removeClass, closest, isUndefined, getValue, NotifyPropertyChanges, Browser } from '@syncfusion/ej2-base';import { FieldSettingsModel } from '../drop-down-base/drop-down-base-model';import { FieldSettings, FilteringEventArgs, FilterType } from '../drop-down-base/drop-down-base';import { DropDownBase, PopupEventArgs, SelectEventArgs, BeforeOpenEventArgs, dropDownBaseClasses } from '../drop-down-base/drop-down-base';import { DataManager, Query } from '@syncfusion/ej2-data';import { SortOrder } from '@syncfusion/ej2-lists';import { Popup, isCollide, createSpinner, showSpinner, hideSpinner } from '@syncfusion/ej2-popups';import { highlightSearch, revertHighlightSearch } from '../common/highlight-search';
|
|
1
|
+
import { KeyboardEvents, compile, Property, EventHandler, Animation, AnimationModel, KeyboardEventArgs, formatUnit, append, attributes } from '@syncfusion/ej2-base';import { isNullOrUndefined, detach, Event, EmitType, Complex, addClass, removeClass, closest, isUndefined, getValue, NotifyPropertyChanges, Browser } from '@syncfusion/ej2-base';import { FieldSettingsModel } from '../drop-down-base/drop-down-base-model';import { FieldSettings, FilteringEventArgs, FilterType } from '../drop-down-base/drop-down-base';import { DropDownBase, PopupEventArgs, SelectEventArgs, BeforeOpenEventArgs, dropDownBaseClasses } from '../drop-down-base/drop-down-base';import { DataManager, Query } from '@syncfusion/ej2-data';import { SortOrder } from '@syncfusion/ej2-lists';import { Popup, isCollide, createSpinner, showSpinner, hideSpinner, getZindexPartial } from '@syncfusion/ej2-popups';import { highlightSearch, revertHighlightSearch } from '../common/highlight-search';
|
|
2
2
|
import {MentionChangeEventArgs} from "./mention";
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -62,7 +62,7 @@ export interface MentionModel {
|
|
|
62
62
|
minLength?: number;
|
|
63
63
|
|
|
64
64
|
/**
|
|
65
|
-
* Specifies the order to sort the data source. The possible sort orders are,
|
|
65
|
+
* Specifies the order to sort the data source. The possible sort orders are,
|
|
66
66
|
* * `None` - The data source is not sorted.
|
|
67
67
|
* * `Ascending` - The data source is sorted in ascending order.
|
|
68
68
|
* * `Descending` - The data source is sorted in descending order.
|
package/src/mention/mention.d.ts
CHANGED
|
@@ -45,6 +45,7 @@ export declare class Mention extends DropDownBase {
|
|
|
45
45
|
private isFiltered;
|
|
46
46
|
private beforePopupOpen;
|
|
47
47
|
private listHeight;
|
|
48
|
+
private isListResetted;
|
|
48
49
|
private range;
|
|
49
50
|
private displayTempElement;
|
|
50
51
|
private isCollided;
|
|
@@ -337,6 +338,7 @@ export declare class Mention extends DropDownBase {
|
|
|
337
338
|
/**
|
|
338
339
|
* Hides the spinner loader.
|
|
339
340
|
*
|
|
341
|
+
* @private
|
|
340
342
|
* @returns {void}
|
|
341
343
|
*/
|
|
342
344
|
hideSpinner(): void;
|
|
@@ -383,6 +385,7 @@ export declare class Mention extends DropDownBase {
|
|
|
383
385
|
hidePopup(e?: MouseEvent | KeyboardEventArgs): void;
|
|
384
386
|
private closePopup;
|
|
385
387
|
private renderPopup;
|
|
388
|
+
private setHeight;
|
|
386
389
|
private checkCollision;
|
|
387
390
|
private getTriggerCharPosition;
|
|
388
391
|
private initializePopup;
|
|
@@ -418,7 +421,7 @@ export declare class Mention extends DropDownBase {
|
|
|
418
421
|
private updateMentionValue;
|
|
419
422
|
private mentionVal;
|
|
420
423
|
private setDisplayTemplate;
|
|
421
|
-
renderTemplates
|
|
424
|
+
private renderTemplates;
|
|
422
425
|
private setSpinnerTemplate;
|
|
423
426
|
private onChangeEvent;
|
|
424
427
|
private detachMentionChanges;
|
package/src/mention/mention.js
CHANGED
|
@@ -22,7 +22,7 @@ import { isNullOrUndefined, detach, Event, Complex, addClass, removeClass, close
|
|
|
22
22
|
import { FieldSettings } from '../drop-down-base/drop-down-base';
|
|
23
23
|
import { DropDownBase, dropDownBaseClasses } from '../drop-down-base/drop-down-base';
|
|
24
24
|
import { DataManager, Query } from '@syncfusion/ej2-data';
|
|
25
|
-
import { Popup, isCollide, createSpinner, showSpinner, hideSpinner } from '@syncfusion/ej2-popups';
|
|
25
|
+
import { Popup, isCollide, createSpinner, showSpinner, hideSpinner, getZindexPartial } from '@syncfusion/ej2-popups';
|
|
26
26
|
import { highlightSearch, revertHighlightSearch } from '../common/highlight-search';
|
|
27
27
|
/**
|
|
28
28
|
* The Mention component is used to list someone or something based on user input in textarea, input,
|
|
@@ -99,6 +99,7 @@ var Mention = /** @class */ (function (_super) {
|
|
|
99
99
|
this.isFiltered = false;
|
|
100
100
|
this.beforePopupOpen = false;
|
|
101
101
|
this.initRemoteRender = false;
|
|
102
|
+
this.isListResetted = false;
|
|
102
103
|
this.isPopupOpen = false;
|
|
103
104
|
this.isCollided = false;
|
|
104
105
|
this.lineBreak = false;
|
|
@@ -165,6 +166,7 @@ var Mention = /** @class */ (function (_super) {
|
|
|
165
166
|
/**
|
|
166
167
|
* Hides the spinner loader.
|
|
167
168
|
*
|
|
169
|
+
* @private
|
|
168
170
|
* @returns {void}
|
|
169
171
|
*/
|
|
170
172
|
Mention.prototype.hideSpinner = function () {
|
|
@@ -220,6 +222,7 @@ var Mention = /** @class */ (function (_super) {
|
|
|
220
222
|
break;
|
|
221
223
|
case 'tab':
|
|
222
224
|
if (this.isPopupOpen) {
|
|
225
|
+
e.preventDefault();
|
|
223
226
|
var li = this.list.querySelector('.' + dropDownBaseClasses.selected);
|
|
224
227
|
if (li) {
|
|
225
228
|
this.setSelection(li, e);
|
|
@@ -259,7 +262,8 @@ var Mention = /** @class */ (function (_super) {
|
|
|
259
262
|
var startIndex = 0;
|
|
260
263
|
startIndex = e.action === 'down' && isNullOrUndefined(this.activeIndex) ? 0 : this.liCollections.length - 1;
|
|
261
264
|
index = index < 0 ? this.liCollections.length - 1 : index === this.liCollections.length ? 0 : index;
|
|
262
|
-
var nextItem = isNullOrUndefined(this.activeIndex) ?
|
|
265
|
+
var nextItem = isNullOrUndefined(this.activeIndex) ?
|
|
266
|
+
this.liCollections[startIndex] : this.liCollections[index];
|
|
263
267
|
if (!isNullOrUndefined(nextItem)) {
|
|
264
268
|
this.setSelection(nextItem, e);
|
|
265
269
|
}
|
|
@@ -284,9 +288,14 @@ var Mention = /** @class */ (function (_super) {
|
|
|
284
288
|
}
|
|
285
289
|
var currentRange = this.getTextRange();
|
|
286
290
|
var lastWordRange = this.getLastLetter(currentRange);
|
|
291
|
+
// eslint-disable-next-line security/detect-non-literal-regexp
|
|
287
292
|
var Regex = new RegExp(this.mentionChar, 'g');
|
|
288
293
|
var charRegex = new RegExp('[a-zA-Z]', 'g');
|
|
289
294
|
if (e.key === 'Shift' || e.keyCode === 37 || e.keyCode === 39) {
|
|
295
|
+
if ((e.keyCode === 37 || e.keyCode === 39) && !isNullOrUndefined(currentRange) &&
|
|
296
|
+
currentRange.indexOf(this.mentionChar) === -1 && this.isPopupOpen) {
|
|
297
|
+
this.hidePopup();
|
|
298
|
+
}
|
|
290
299
|
return;
|
|
291
300
|
}
|
|
292
301
|
if ((!currentRange || !lastWordRange) || e.code === 'Enter' || e.keyCode === 27 ||
|
|
@@ -315,7 +324,7 @@ var Mention = /** @class */ (function (_super) {
|
|
|
315
324
|
if (!this.isContentEditable(this.inputElement)) {
|
|
316
325
|
this.showPopup();
|
|
317
326
|
}
|
|
318
|
-
else if (this.isContentEditable(this.inputElement) && this.range && this.range.startContainer !== this.inputElement) {
|
|
327
|
+
else if (this.isContentEditable(this.inputElement) && this.range && this.range.startContainer !== this.inputElement && e.keyCode !== 9) {
|
|
319
328
|
this.showPopup();
|
|
320
329
|
}
|
|
321
330
|
}
|
|
@@ -344,8 +353,12 @@ var Mention = /** @class */ (function (_super) {
|
|
|
344
353
|
this.searchLists(e);
|
|
345
354
|
}
|
|
346
355
|
else if (this.queryString === '' && this.isPopupOpen && e.keyCode !== 38 && e.keyCode !== 40) {
|
|
347
|
-
this.
|
|
356
|
+
this.searchLists(e);
|
|
357
|
+
if (!this.isListResetted) {
|
|
358
|
+
this.resetList(this.dataSource, this.fields);
|
|
359
|
+
}
|
|
348
360
|
}
|
|
361
|
+
this.isListResetted = false;
|
|
349
362
|
};
|
|
350
363
|
Mention.prototype.isMatchedText = function () {
|
|
351
364
|
var isMatched = false;
|
|
@@ -379,7 +392,7 @@ var Mention = /** @class */ (function (_super) {
|
|
|
379
392
|
this.activeIndex = null;
|
|
380
393
|
var eventArgs = {
|
|
381
394
|
preventDefaultAction: false,
|
|
382
|
-
text: this.
|
|
395
|
+
text: this.queryString,
|
|
383
396
|
updateData: function (dataSource, query, fields) {
|
|
384
397
|
if (eventArgs.cancel) {
|
|
385
398
|
return;
|
|
@@ -397,8 +410,9 @@ var Mention = /** @class */ (function (_super) {
|
|
|
397
410
|
};
|
|
398
411
|
Mention.prototype.filterAction = function (dataSource, query, fields) {
|
|
399
412
|
this.beforePopupOpen = true;
|
|
400
|
-
if (this.queryString
|
|
413
|
+
if (this.queryString.length >= this.minLength) {
|
|
401
414
|
this.resetList(dataSource, fields, query);
|
|
415
|
+
this.isListResetted = true;
|
|
402
416
|
}
|
|
403
417
|
else {
|
|
404
418
|
if (this.isPopupOpen) {
|
|
@@ -520,12 +534,14 @@ var Mention = /** @class */ (function (_super) {
|
|
|
520
534
|
}
|
|
521
535
|
}
|
|
522
536
|
else {
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
537
|
+
if (this.range) {
|
|
538
|
+
var selectedElem = this.range.startContainer;
|
|
539
|
+
if (!isNullOrUndefined(selectedElem)) {
|
|
540
|
+
var workingNodeContent = selectedElem.textContent;
|
|
541
|
+
var selectStartOffset = this.range.startOffset;
|
|
542
|
+
if (workingNodeContent && selectStartOffset >= 0) {
|
|
543
|
+
text = workingNodeContent.substring(0, selectStartOffset);
|
|
544
|
+
}
|
|
529
545
|
}
|
|
530
546
|
}
|
|
531
547
|
}
|
|
@@ -549,6 +565,10 @@ var Mention = /** @class */ (function (_super) {
|
|
|
549
565
|
* @returns {void}
|
|
550
566
|
*/
|
|
551
567
|
Mention.prototype.showPopup = function () {
|
|
568
|
+
this.beforePopupOpen = true;
|
|
569
|
+
if (isNullOrUndefined(this.list)) {
|
|
570
|
+
this.initValue();
|
|
571
|
+
}
|
|
552
572
|
this.renderPopup();
|
|
553
573
|
attributes(this.inputElement, { 'aria-activedescendant': this.selectedElementID });
|
|
554
574
|
if (this.selectedElementID == null) {
|
|
@@ -614,18 +634,13 @@ var Mention = /** @class */ (function (_super) {
|
|
|
614
634
|
}
|
|
615
635
|
}
|
|
616
636
|
append([_this.list], popupEle_1);
|
|
617
|
-
if ((!_this.popupObj || !document.body.contains(_this.popupObj.element)) ||
|
|
637
|
+
if ((!_this.popupObj || !document.body.contains(_this.popupObj.element)) ||
|
|
638
|
+
!document.contains(popupEle_1) && isNullOrUndefined(_this.target)) {
|
|
618
639
|
document.body.appendChild(popupEle_1);
|
|
619
640
|
}
|
|
620
641
|
var coordinates_1;
|
|
621
642
|
popupEle_1.style.visibility = 'hidden';
|
|
622
|
-
|
|
623
|
-
_this.list.style.maxHeight = (parseInt(_this.listHeight, 10) - 2).toString() + 'px'; // due to box-sizing property
|
|
624
|
-
popupEle_1.style.maxHeight = formatUnit(_this.popupHeight);
|
|
625
|
-
}
|
|
626
|
-
else {
|
|
627
|
-
popupEle_1.style.height = 'auto';
|
|
628
|
-
}
|
|
643
|
+
_this.setHeight(popupEle_1);
|
|
629
644
|
var offsetValue = 0;
|
|
630
645
|
var left = 0;
|
|
631
646
|
_this.initializePopup(popupEle_1, offsetValue, left);
|
|
@@ -648,6 +663,9 @@ var Mention = /** @class */ (function (_super) {
|
|
|
648
663
|
if (!eventArgs.cancel) {
|
|
649
664
|
_this.renderReactTemplates();
|
|
650
665
|
_this.popupObj.show(new Animation(eventArgs.animation), (_this.zIndex === 1000) ? _this.inputElement : null);
|
|
666
|
+
if (isNullOrUndefined(_this.getTriggerCharPosition())) {
|
|
667
|
+
return;
|
|
668
|
+
}
|
|
651
669
|
coordinates_1 = _this.getCoordinates(_this.inputElement, _this.getTriggerCharPosition());
|
|
652
670
|
if (!_this.isCollided) {
|
|
653
671
|
popupEle_1.style.cssText = 'top: '.concat(coordinates_1.top.toString(), 'px;\n left: ').concat(coordinates_1.left.toString(), 'px;\nposition: absolute;\n display: block;');
|
|
@@ -657,6 +675,8 @@ var Mention = /** @class */ (function (_super) {
|
|
|
657
675
|
_this.isCollided = false;
|
|
658
676
|
}
|
|
659
677
|
popupEle_1.style.width = _this.popupWidth !== '100%' && !isNullOrUndefined(_this.popupWidth) ? formatUnit(_this.popupWidth) : 'auto';
|
|
678
|
+
_this.setHeight(popupEle_1);
|
|
679
|
+
popupEle_1.style.zIndex = _this.zIndex === 1000 ? getZindexPartial(popupEle_1).toString() : _this.zIndex.toString();
|
|
660
680
|
}
|
|
661
681
|
else {
|
|
662
682
|
_this.beforePopupOpen = false;
|
|
@@ -669,6 +689,15 @@ var Mention = /** @class */ (function (_super) {
|
|
|
669
689
|
}
|
|
670
690
|
});
|
|
671
691
|
};
|
|
692
|
+
Mention.prototype.setHeight = function (popupEle) {
|
|
693
|
+
if (this.popupHeight !== 'auto') {
|
|
694
|
+
this.list.style.maxHeight = (parseInt(this.listHeight, 10) - 2).toString() + 'px'; // due to box-sizing property
|
|
695
|
+
popupEle.style.maxHeight = formatUnit(this.popupHeight);
|
|
696
|
+
}
|
|
697
|
+
else {
|
|
698
|
+
popupEle.style.height = 'auto';
|
|
699
|
+
}
|
|
700
|
+
};
|
|
672
701
|
Mention.prototype.checkCollision = function (popupEle) {
|
|
673
702
|
if (!Browser.isDevice || (Browser.isDevice && !(this.getModuleName() === 'mention'))) {
|
|
674
703
|
var collision = isCollide(popupEle);
|
|
@@ -749,7 +778,9 @@ var Mention = /** @class */ (function (_super) {
|
|
|
749
778
|
computed = getComputedStyle(element);
|
|
750
779
|
div.style.position = 'absolute';
|
|
751
780
|
div.style.visibility = 'hidden';
|
|
781
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
752
782
|
properties.forEach(function (prop) {
|
|
783
|
+
// eslint-disable-next-line security/detect-object-injection
|
|
753
784
|
div.style[prop] = computed[prop];
|
|
754
785
|
});
|
|
755
786
|
div.textContent = element.value.substring(0, position);
|
|
@@ -783,13 +814,12 @@ var Mention = /** @class */ (function (_super) {
|
|
|
783
814
|
}
|
|
784
815
|
else {
|
|
785
816
|
coordinates = {
|
|
786
|
-
top: rect.top + windowTop + parseInt(getComputedStyle(this.inputElement).fontSize),
|
|
817
|
+
top: rect.top + windowTop + parseInt(getComputedStyle(this.inputElement).fontSize, 10),
|
|
787
818
|
left: rect.left + windowLeft
|
|
788
819
|
};
|
|
789
820
|
}
|
|
790
821
|
return coordinates;
|
|
791
822
|
};
|
|
792
|
-
;
|
|
793
823
|
Mention.prototype.initValue = function () {
|
|
794
824
|
this.renderList();
|
|
795
825
|
if (this.dataSource instanceof DataManager) {
|
|
@@ -985,8 +1015,8 @@ var Mention = /** @class */ (function (_super) {
|
|
|
985
1015
|
}
|
|
986
1016
|
return items;
|
|
987
1017
|
};
|
|
988
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
989
1018
|
Mention.prototype.setValue = function (e) {
|
|
1019
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
990
1020
|
if (!this.isReact) {
|
|
991
1021
|
if (!isNullOrUndefined(this.displayTemplate)) {
|
|
992
1022
|
this.setDisplayTemplate();
|
|
@@ -1014,7 +1044,7 @@ var Mention = /** @class */ (function (_super) {
|
|
|
1014
1044
|
var selection = this.inputElement.ownerDocument.getSelection();
|
|
1015
1045
|
var startPos = this.getTriggerCharPosition();
|
|
1016
1046
|
textSuffix = typeof this.suffixText === 'string' ? this.suffixText : '';
|
|
1017
|
-
if (dataItem.
|
|
1047
|
+
if (dataItem.text !== null) {
|
|
1018
1048
|
value = this.mentionVal(dataItem.text);
|
|
1019
1049
|
}
|
|
1020
1050
|
if (!this.isContentEditable(this.inputElement)) {
|
|
@@ -1046,6 +1076,7 @@ var Mention = /** @class */ (function (_super) {
|
|
|
1046
1076
|
var frag = document.createDocumentFragment();
|
|
1047
1077
|
var node = void 0;
|
|
1048
1078
|
var lastNode = void 0;
|
|
1079
|
+
// eslint-disable-next-line no-cond-assign
|
|
1049
1080
|
while (node = element.firstChild) {
|
|
1050
1081
|
lastNode = frag.appendChild(node);
|
|
1051
1082
|
}
|
|
@@ -1101,6 +1132,7 @@ var Mention = /** @class */ (function (_super) {
|
|
|
1101
1132
|
this.displayTempElement.appendChild(displayCompTemp[i]);
|
|
1102
1133
|
}
|
|
1103
1134
|
}
|
|
1135
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1104
1136
|
if (!this.isReact) {
|
|
1105
1137
|
this.renderTemplates();
|
|
1106
1138
|
}
|
|
@@ -1110,6 +1142,7 @@ var Mention = /** @class */ (function (_super) {
|
|
|
1110
1142
|
});
|
|
1111
1143
|
}
|
|
1112
1144
|
};
|
|
1145
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1113
1146
|
Mention.prototype.renderTemplates = function (callBack) {
|
|
1114
1147
|
this.renderReactTemplates(callBack);
|
|
1115
1148
|
};
|
|
@@ -1139,6 +1172,7 @@ var Mention = /** @class */ (function (_super) {
|
|
|
1139
1172
|
this.spinnerTemplateElement.appendChild(spinnerCompTemp[i]);
|
|
1140
1173
|
}
|
|
1141
1174
|
}
|
|
1175
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1142
1176
|
if (!this.isReact) {
|
|
1143
1177
|
this.renderTemplates();
|
|
1144
1178
|
this.popupObj.element.appendChild(this.spinnerTemplateElement);
|
|
@@ -1233,7 +1267,7 @@ var Mention = /** @class */ (function (_super) {
|
|
|
1233
1267
|
this.setHover(currentLi);
|
|
1234
1268
|
};
|
|
1235
1269
|
Mention.prototype.setHover = function (li) {
|
|
1236
|
-
if (this.
|
|
1270
|
+
if (this.isValidLI(li) && !li.classList.contains(dropDownBaseClasses.hover)) {
|
|
1237
1271
|
this.removeHover();
|
|
1238
1272
|
addClass([li], dropDownBaseClasses.hover);
|
|
1239
1273
|
}
|
|
@@ -1258,8 +1292,13 @@ var Mention = /** @class */ (function (_super) {
|
|
|
1258
1292
|
* @returns {void}
|
|
1259
1293
|
*/
|
|
1260
1294
|
Mention.prototype.search = function (text, positionX, positionY) {
|
|
1261
|
-
if (
|
|
1262
|
-
|
|
1295
|
+
if (this.isContentEditable(this.inputElement)) {
|
|
1296
|
+
this.range = this.getCurrentRange();
|
|
1297
|
+
}
|
|
1298
|
+
var currentRange = this.getTextRange();
|
|
1299
|
+
var lastWordRange = this.getLastLetter(currentRange);
|
|
1300
|
+
if ((this.ignoreCase && (text === lastWordRange || text === lastWordRange.toLowerCase()))
|
|
1301
|
+
|| !this.ignoreCase && text === lastWordRange) {
|
|
1263
1302
|
this.resetList(this.dataSource, this.fields);
|
|
1264
1303
|
}
|
|
1265
1304
|
else {
|
|
@@ -164,6 +164,12 @@ var CheckBoxSelection = /** @class */ (function () {
|
|
|
164
164
|
CheckBoxSelection.prototype.destroy = function () {
|
|
165
165
|
this.removeEventListener();
|
|
166
166
|
EventHandler.remove(document, 'mousedown', this.onDocumentClick);
|
|
167
|
+
this.checkAllParent = null;
|
|
168
|
+
this.clearIconElement = null;
|
|
169
|
+
this.filterInput = null;
|
|
170
|
+
this.filterInputObj = null;
|
|
171
|
+
this.checkWrapper = null;
|
|
172
|
+
this.selectAllSpan = null;
|
|
167
173
|
};
|
|
168
174
|
CheckBoxSelection.prototype.listSelection = function (args) {
|
|
169
175
|
var target;
|
|
@@ -240,10 +246,6 @@ var CheckBoxSelection = /** @class */ (function () {
|
|
|
240
246
|
this.setLocale();
|
|
241
247
|
}
|
|
242
248
|
}
|
|
243
|
-
ariaState = state === 'check' ? 'true' : state === 'uncheck' ? 'false' : ariaState;
|
|
244
|
-
if (!isNullOrUndefined(ariaState)) {
|
|
245
|
-
wrapper.setAttribute('aria-checked', ariaState);
|
|
246
|
-
}
|
|
247
249
|
};
|
|
248
250
|
CheckBoxSelection.prototype.setSearchBox = function (args) {
|
|
249
251
|
if (isNullOrUndefined(this.parent.filterParent)) {
|
|
@@ -404,8 +406,8 @@ var CheckBoxSelection = /** @class */ (function () {
|
|
|
404
406
|
e.preventDefault();
|
|
405
407
|
}
|
|
406
408
|
}
|
|
407
|
-
if (!(!isNullOrUndefined(this.parent.popupObj) && closest(target, '[id="' + this.parent.popupObj.element.id + '"]'))
|
|
408
|
-
!this.parent.overAllWrapper.contains(e.target)) {
|
|
409
|
+
if (!(!isNullOrUndefined(this.parent.popupObj) && closest(target, '[id="' + this.parent.popupObj.element.id + '"]'))
|
|
410
|
+
&& !isNullOrUndefined(this.parent.overAllWrapper) && !this.parent.overAllWrapper.contains(e.target)) {
|
|
409
411
|
if (this.parent.overAllWrapper.classList.contains(dropDownBaseClasses.focus) || this.parent.isPopupOpen()) {
|
|
410
412
|
this.parent.inputFocus = false;
|
|
411
413
|
this.parent.scrollFocusStatus = false;
|
|
@@ -418,7 +420,7 @@ var CheckBoxSelection = /** @class */ (function () {
|
|
|
418
420
|
this.parent.scrollFocusStatus = (Browser.isIE || Browser.info.name === 'edge') &&
|
|
419
421
|
(document.activeElement === this.filterInput);
|
|
420
422
|
}
|
|
421
|
-
if (!this.parent.overAllWrapper.contains(e.target) && this.parent.overAllWrapper.classList.contains('e-input-focus') &&
|
|
423
|
+
if (!isNullOrUndefined(this.parent.overAllWrapper) && !this.parent.overAllWrapper.contains(e.target) && this.parent.overAllWrapper.classList.contains('e-input-focus') &&
|
|
422
424
|
!this.parent.isPopupOpen()) {
|
|
423
425
|
if (Browser.isIE) {
|
|
424
426
|
this.parent.onBlurHandler();
|
|
@@ -449,7 +451,7 @@ var CheckBoxSelection = /** @class */ (function () {
|
|
|
449
451
|
}
|
|
450
452
|
};
|
|
451
453
|
CheckBoxSelection.prototype.checkSelectAll = function (e) {
|
|
452
|
-
if (e.value === 'check'
|
|
454
|
+
if (e.value === 'check') {
|
|
453
455
|
this.changeState(this.checkAllParent, e.value, null, null, false);
|
|
454
456
|
this.setLocale(true);
|
|
455
457
|
}
|