@syncfusion/ej2-dropdowns 20.2.40 → 20.2.43-3197
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 +116 -3
- package/{README.md → ReadMe.md} +1 -1
- package/dist/ej2-dropdowns.min.js +1 -0
- package/dist/ej2-dropdowns.umd.min.js +1 -10
- package/dist/ej2-dropdowns.umd.min.js.map +1 -1
- package/dist/es6/ej2-dropdowns.es2015.js +2232 -468
- package/dist/es6/ej2-dropdowns.es2015.js.map +1 -1
- package/dist/es6/ej2-dropdowns.es5.js +2273 -480
- package/dist/es6/ej2-dropdowns.es5.js.map +1 -1
- package/dist/global/ej2-dropdowns.min.js +1 -10
- package/dist/global/ej2-dropdowns.min.js.map +1 -1
- package/dist/global/index.d.ts +0 -9
- package/mention.d.ts +4 -0
- package/mention.js +4 -0
- package/package.json +76 -76
- package/src/auto-complete/auto-complete-model.d.ts +12 -11
- package/src/auto-complete/auto-complete.d.ts +20 -18
- package/src/auto-complete/auto-complete.js +67 -37
- package/src/combo-box/combo-box-model.d.ts +17 -17
- package/src/combo-box/combo-box.d.ts +33 -33
- package/src/combo-box/combo-box.js +33 -29
- package/src/common/incremental-search.d.ts +3 -4
- package/src/common/incremental-search.js +22 -7
- package/src/drop-down-base/drop-down-base-model.d.ts +13 -31
- package/src/drop-down-base/drop-down-base.d.ts +22 -41
- package/src/drop-down-base/drop-down-base.js +75 -59
- package/src/drop-down-list/drop-down-list-model.d.ts +19 -1
- package/src/drop-down-list/drop-down-list.d.ts +35 -11
- package/src/drop-down-list/drop-down-list.js +194 -109
- package/src/drop-down-tree/drop-down-tree-model.d.ts +16 -2
- package/src/drop-down-tree/drop-down-tree.d.ts +15 -1
- package/src/drop-down-tree/drop-down-tree.js +49 -14
- package/src/index.d.ts +1 -0
- package/src/index.js +1 -0
- package/src/list-box/list-box-model.d.ts +18 -0
- package/src/list-box/list-box.d.ts +23 -1
- package/src/list-box/list-box.js +78 -35
- package/src/mention/index.d.ts +5 -0
- package/src/mention/index.js +4 -0
- package/src/mention/mention-model.d.ts +285 -0
- package/src/mention/mention.d.ts +457 -0
- package/src/mention/mention.js +1465 -0
- package/src/multi-select/checkbox-selection.js +11 -12
- package/src/multi-select/float-label.js +4 -2
- package/src/multi-select/multi-select-model.d.ts +1 -1
- package/src/multi-select/multi-select.d.ts +9 -5
- package/src/multi-select/multi-select.js +295 -188
- package/styles/auto-complete/_all.scss +1 -1
- package/styles/auto-complete/_bootstrap-dark-definition.scss +1 -1
- package/styles/auto-complete/_bootstrap-definition.scss +1 -1
- package/styles/auto-complete/_bootstrap4-definition.scss +2 -2
- package/styles/auto-complete/_bootstrap5-definition.scss +1 -1
- package/styles/auto-complete/_fabric-dark-definition.scss +1 -1
- package/styles/auto-complete/_fabric-definition.scss +1 -1
- package/styles/auto-complete/_fluent-definition.scss +1 -1
- package/styles/auto-complete/_fusionnew-definition.scss +1 -1
- package/styles/auto-complete/_highcontrast-definition.scss +1 -1
- package/styles/auto-complete/_highcontrast-light-definition.scss +1 -1
- package/styles/auto-complete/_material-dark-definition.scss +1 -1
- package/styles/auto-complete/_material-definition.scss +1 -1
- package/styles/auto-complete/_material3-definition.scss +1 -1
- package/styles/auto-complete/_tailwind-definition.scss +1 -1
- package/styles/auto-complete/bootstrap-dark.css +3 -1
- package/styles/auto-complete/bootstrap.css +3 -1
- package/styles/auto-complete/bootstrap4.css +3 -1
- package/styles/auto-complete/bootstrap5-dark.css +3 -1
- package/styles/auto-complete/bootstrap5.css +3 -1
- package/styles/auto-complete/fabric-dark.css +3 -1
- package/styles/auto-complete/fabric.css +3 -1
- package/styles/auto-complete/fluent-dark.css +3 -1
- package/styles/auto-complete/fluent.css +3 -1
- package/styles/auto-complete/highcontrast-light.css +3 -1
- package/styles/auto-complete/highcontrast.css +3 -1
- package/styles/auto-complete/material-dark.css +3 -1
- package/styles/auto-complete/material.css +3 -1
- package/styles/auto-complete/tailwind-dark.css +3 -1
- package/styles/auto-complete/tailwind.css +3 -1
- package/styles/bootstrap-dark.css +121 -44
- package/styles/bootstrap-dark.scss +1 -0
- package/styles/bootstrap.css +121 -44
- package/styles/bootstrap.scss +1 -0
- package/styles/bootstrap4.css +134 -55
- package/styles/bootstrap4.scss +1 -0
- package/styles/bootstrap5-dark.css +135 -50
- package/styles/bootstrap5-dark.scss +1 -0
- package/styles/bootstrap5.css +135 -50
- package/styles/bootstrap5.scss +1 -0
- package/styles/combo-box/_all.scss +1 -1
- package/styles/combo-box/_bootstrap-dark-definition.scss +1 -1
- package/styles/combo-box/_bootstrap-definition.scss +1 -1
- package/styles/combo-box/_bootstrap4-definition.scss +2 -2
- package/styles/combo-box/_bootstrap5-definition.scss +1 -1
- package/styles/combo-box/_fabric-dark-definition.scss +1 -1
- package/styles/combo-box/_fabric-definition.scss +1 -1
- package/styles/combo-box/_fluent-definition.scss +1 -1
- package/styles/combo-box/_fusionnew-definition.scss +1 -1
- package/styles/combo-box/_highcontrast-definition.scss +1 -1
- package/styles/combo-box/_highcontrast-light-definition.scss +1 -1
- package/styles/combo-box/_material-dark-definition.scss +1 -1
- package/styles/combo-box/_material-definition.scss +1 -1
- package/styles/combo-box/_material3-definition.scss +1 -1
- package/styles/combo-box/_tailwind-definition.scss +1 -1
- package/styles/combo-box/bootstrap-dark.css +3 -1
- package/styles/combo-box/bootstrap.css +3 -1
- package/styles/combo-box/bootstrap4.css +3 -1
- package/styles/combo-box/bootstrap5-dark.css +3 -1
- package/styles/combo-box/bootstrap5.css +3 -1
- package/styles/combo-box/fabric-dark.css +3 -1
- package/styles/combo-box/fabric.css +3 -1
- package/styles/combo-box/fluent-dark.css +3 -1
- package/styles/combo-box/fluent.css +3 -1
- package/styles/combo-box/highcontrast-light.css +3 -1
- package/styles/combo-box/highcontrast.css +3 -1
- package/styles/combo-box/material-dark.css +3 -1
- package/styles/combo-box/material.css +3 -1
- package/styles/combo-box/tailwind-dark.css +3 -1
- package/styles/combo-box/tailwind.css +3 -1
- package/styles/drop-down-base/_all.scss +1 -1
- package/styles/drop-down-base/_bootstrap-dark-definition.scss +9 -2
- package/styles/drop-down-base/_bootstrap-definition.scss +7 -1
- package/styles/drop-down-base/_bootstrap4-definition.scss +7 -1
- package/styles/drop-down-base/_bootstrap5-definition.scss +9 -3
- package/styles/drop-down-base/_fabric-dark-definition.scss +7 -1
- package/styles/drop-down-base/_fabric-definition.scss +7 -1
- package/styles/drop-down-base/_fluent-definition.scss +9 -2
- package/styles/drop-down-base/_fusionnew-definition.scss +9 -3
- package/styles/drop-down-base/_highcontrast-definition.scss +17 -6
- package/styles/drop-down-base/_highcontrast-light-definition.scss +19 -7
- package/styles/drop-down-base/_layout.scss +44 -3
- package/styles/drop-down-base/_material-dark-definition.scss +8 -1
- package/styles/drop-down-base/_material-definition.scss +7 -0
- package/styles/drop-down-base/_material3-definition.scss +9 -3
- package/styles/drop-down-base/_tailwind-definition.scss +9 -3
- package/styles/drop-down-base/_theme.scss +4 -4
- package/styles/drop-down-base/bootstrap-dark.css +42 -1
- package/styles/drop-down-base/bootstrap.css +42 -1
- package/styles/drop-down-base/bootstrap4.css +42 -1
- package/styles/drop-down-base/bootstrap5-dark.css +42 -1
- package/styles/drop-down-base/bootstrap5.css +42 -1
- package/styles/drop-down-base/fabric-dark.css +42 -1
- package/styles/drop-down-base/fabric.css +42 -1
- package/styles/drop-down-base/fluent-dark.css +42 -1
- package/styles/drop-down-base/fluent.css +42 -1
- package/styles/drop-down-base/highcontrast-light.css +42 -1
- package/styles/drop-down-base/highcontrast.css +42 -1
- package/styles/drop-down-base/material-dark.css +42 -1
- package/styles/drop-down-base/material.css +42 -1
- package/styles/drop-down-base/tailwind-dark.css +42 -1
- package/styles/drop-down-base/tailwind.css +42 -1
- package/styles/drop-down-list/_all.scss +2 -1
- package/styles/drop-down-list/_bootstrap-dark-definition.scss +2 -1
- package/styles/drop-down-list/_bootstrap-definition.scss +2 -1
- package/styles/drop-down-list/_bootstrap4-definition.scss +3 -1
- package/styles/drop-down-list/_bootstrap5-definition.scss +3 -3
- package/styles/drop-down-list/_fabric-dark-definition.scss +2 -1
- package/styles/drop-down-list/_fabric-definition.scss +2 -0
- package/styles/drop-down-list/_fluent-definition.scss +2 -1
- package/styles/drop-down-list/_fusionnew-definition.scss +3 -3
- package/styles/drop-down-list/_highcontrast-definition.scss +21 -10
- package/styles/drop-down-list/_highcontrast-light-definition.scss +22 -11
- package/styles/drop-down-list/_layout.scss +11 -9
- package/styles/drop-down-list/_material-dark-definition.scss +2 -2
- package/styles/drop-down-list/_material-definition.scss +1 -0
- package/styles/drop-down-list/_material3-definition.scss +3 -3
- package/styles/drop-down-list/_tailwind-definition.scss +1 -0
- package/styles/drop-down-list/_theme.scss +3 -3
- package/styles/drop-down-list/bootstrap-dark.css +8 -0
- package/styles/drop-down-list/bootstrap.css +8 -0
- package/styles/drop-down-list/bootstrap4.css +8 -0
- package/styles/drop-down-list/bootstrap5-dark.css +9 -0
- package/styles/drop-down-list/bootstrap5.css +9 -0
- package/styles/drop-down-list/fabric-dark.css +8 -0
- package/styles/drop-down-list/fabric.css +8 -0
- package/styles/drop-down-list/fluent-dark.css +9 -0
- package/styles/drop-down-list/fluent.css +9 -0
- package/styles/drop-down-list/highcontrast-light.css +8 -0
- package/styles/drop-down-list/highcontrast.css +8 -0
- package/styles/drop-down-list/icons/_bootstrap.scss +0 -1
- package/styles/drop-down-list/icons/_fabric.scss +0 -1
- package/styles/drop-down-list/icons/_material.scss +0 -1
- package/styles/drop-down-list/material-dark.css +8 -0
- package/styles/drop-down-list/material.css +8 -0
- package/styles/drop-down-list/tailwind-dark.css +9 -0
- package/styles/drop-down-list/tailwind.css +9 -0
- package/styles/drop-down-tree/_all.scss +1 -1
- package/styles/drop-down-tree/_bootstrap-dark-definition.scss +1 -1
- package/styles/drop-down-tree/_bootstrap-definition.scss +1 -1
- package/styles/drop-down-tree/_bootstrap4-definition.scss +1 -1
- package/styles/drop-down-tree/_bootstrap5-definition.scss +2 -2
- package/styles/drop-down-tree/_fabric-dark-definition.scss +1 -1
- package/styles/drop-down-tree/_fabric-definition.scss +2 -2
- package/styles/drop-down-tree/_fluent-definition.scss +2 -2
- package/styles/drop-down-tree/_fusionnew-definition.scss +2 -2
- package/styles/drop-down-tree/_highcontrast-definition.scss +1 -1
- package/styles/drop-down-tree/_highcontrast-light-definition.scss +1 -1
- package/styles/drop-down-tree/_layout.scss +10 -3
- package/styles/drop-down-tree/_material-dark-definition.scss +2 -2
- package/styles/drop-down-tree/_material-definition.scss +2 -2
- package/styles/drop-down-tree/_material3-definition.scss +2 -2
- package/styles/drop-down-tree/_tailwind-definition.scss +2 -2
- package/styles/drop-down-tree/bootstrap-dark.css +4 -0
- package/styles/drop-down-tree/bootstrap.css +4 -0
- package/styles/drop-down-tree/bootstrap4.css +4 -0
- package/styles/drop-down-tree/bootstrap5-dark.css +9 -1
- package/styles/drop-down-tree/bootstrap5.css +9 -1
- package/styles/drop-down-tree/fabric-dark.css +4 -0
- package/styles/drop-down-tree/fabric.css +4 -0
- package/styles/drop-down-tree/fluent-dark.css +5 -0
- package/styles/drop-down-tree/fluent.css +5 -0
- package/styles/drop-down-tree/highcontrast-light.css +4 -0
- package/styles/drop-down-tree/highcontrast.css +4 -0
- package/styles/drop-down-tree/icons/_bootstrap.scss +0 -1
- package/styles/drop-down-tree/icons/_bootstrap4.scss +0 -1
- package/styles/drop-down-tree/icons/_fabric.scss +0 -1
- package/styles/drop-down-tree/icons/_highcontrast-light.scss +0 -1
- package/styles/drop-down-tree/icons/_highcontrast.scss +0 -1
- package/styles/drop-down-tree/icons/_material-dark.scss +0 -1
- package/styles/drop-down-tree/icons/_material.scss +0 -1
- package/styles/drop-down-tree/material-dark.css +4 -0
- package/styles/drop-down-tree/material.css +4 -0
- package/styles/drop-down-tree/tailwind-dark.css +5 -0
- package/styles/drop-down-tree/tailwind.css +5 -0
- package/styles/fabric-dark.css +129 -52
- package/styles/fabric-dark.scss +1 -0
- package/styles/fabric.css +129 -52
- package/styles/fabric.scss +1 -0
- package/styles/fluent-dark.css +129 -47
- package/styles/fluent-dark.scss +1 -0
- package/styles/fluent.css +129 -47
- package/styles/fluent.scss +1 -0
- package/styles/highcontrast-light.css +124 -44
- package/styles/highcontrast-light.scss +1 -0
- package/styles/highcontrast.css +133 -53
- package/styles/highcontrast.scss +1 -0
- package/styles/list-box/_all.scss +1 -1
- package/styles/list-box/_bootstrap-dark-definition.scss +2 -0
- package/styles/list-box/_bootstrap-definition.scss +1 -0
- package/styles/list-box/_bootstrap4-definition.scss +1 -0
- package/styles/list-box/_bootstrap5-definition.scss +3 -0
- package/styles/list-box/_fabric-dark-definition.scss +3 -1
- package/styles/list-box/_fabric-definition.scss +1 -0
- package/styles/list-box/_fluent-definition.scss +3 -0
- package/styles/list-box/_fusionnew-definition.scss +1 -0
- package/styles/list-box/_highcontrast-definition.scss +1 -0
- package/styles/list-box/_highcontrast-light-definition.scss +3 -1
- package/styles/list-box/_layout.scss +8 -17
- package/styles/list-box/_material-dark-definition.scss +2 -0
- package/styles/list-box/_material-definition.scss +1 -0
- package/styles/list-box/_material3-definition.scss +1 -0
- package/styles/list-box/_tailwind-definition.scss +3 -0
- package/styles/list-box/_theme.scss +11 -25
- package/styles/list-box/bootstrap-dark.css +12 -33
- package/styles/list-box/bootstrap.css +14 -35
- package/styles/list-box/bootstrap4.css +14 -35
- package/styles/list-box/bootstrap5-dark.css +15 -36
- package/styles/list-box/bootstrap5.css +15 -36
- package/styles/list-box/fabric-dark.css +12 -33
- package/styles/list-box/fabric.css +14 -35
- package/styles/list-box/fluent-dark.css +15 -36
- package/styles/list-box/fluent.css +15 -36
- package/styles/list-box/highcontrast-light.css +12 -33
- package/styles/list-box/highcontrast.css +14 -35
- package/styles/list-box/icons/_bootstrap-dark.scss +2 -2
- package/styles/list-box/icons/_bootstrap.scss +1 -1
- package/styles/list-box/icons/_bootstrap4.scss +1 -1
- package/styles/list-box/icons/_bootstrap5.scss +1 -1
- package/styles/list-box/icons/_fabric-dark.scss +1 -1
- package/styles/list-box/icons/_fabric.scss +1 -1
- package/styles/list-box/icons/_fluent.scss +1 -1
- package/styles/list-box/icons/_fusionnew.scss +1 -1
- package/styles/list-box/icons/_highcontrast-light.scss +1 -1
- package/styles/list-box/icons/_highcontrast.scss +1 -1
- package/styles/list-box/icons/_material-dark.scss +1 -1
- package/styles/list-box/icons/_material.scss +2 -2
- package/styles/list-box/icons/_material3.scss +1 -1
- package/styles/list-box/icons/_tailwind-dark.scss +1 -1
- package/styles/list-box/icons/_tailwind.scss +1 -1
- package/styles/list-box/material-dark.css +12 -33
- package/styles/list-box/material.css +14 -35
- package/styles/list-box/tailwind-dark.css +15 -36
- package/styles/list-box/tailwind.css +15 -36
- package/styles/material-dark.css +120 -43
- package/styles/material-dark.scss +1 -0
- package/styles/material.css +120 -43
- package/styles/material.scss +1 -0
- package/styles/mention/_all.scss +1 -0
- package/styles/mention/_bootstrap-dark-definition.scss +3 -0
- package/styles/mention/_bootstrap-definition.scss +3 -0
- package/styles/mention/_bootstrap4-definition.scss +3 -0
- package/styles/mention/_bootstrap5-dark-definition.scss +1 -0
- package/styles/mention/_bootstrap5-definition.scss +1 -0
- package/styles/mention/_fabric-dark-definition.scss +2 -0
- package/styles/mention/_fabric-definition.scss +3 -0
- package/styles/mention/_fluent-dark-definition.scss +1 -0
- package/styles/mention/_fluent-definition.scss +1 -0
- package/styles/mention/_fusionnew-definition.scss +1 -0
- package/styles/mention/_highcontrast-definition.scss +3 -0
- package/styles/mention/_highcontrast-light-definition.scss +3 -0
- package/styles/mention/_layout.scss +6 -0
- package/styles/mention/_material-dark-definition.scss +3 -0
- package/styles/mention/_material-definition.scss +3 -0
- package/styles/mention/_material3-definition.scss +1 -0
- package/styles/mention/_tailwind-dark-definition.scss +1 -0
- package/styles/mention/_tailwind-definition.scss +1 -0
- package/styles/mention/bootstrap-dark.css +29 -0
- package/styles/mention/bootstrap-dark.scss +6 -0
- package/styles/mention/bootstrap.css +29 -0
- package/styles/mention/bootstrap.scss +6 -0
- package/styles/mention/bootstrap4.css +47 -0
- package/styles/mention/bootstrap4.scss +6 -0
- package/styles/mention/bootstrap5-dark.css +58 -0
- package/styles/mention/bootstrap5-dark.scss +6 -0
- package/styles/mention/bootstrap5.css +58 -0
- package/styles/mention/bootstrap5.scss +6 -0
- package/styles/mention/fabric-dark.css +29 -0
- package/styles/mention/fabric-dark.scss +6 -0
- package/styles/mention/fabric.css +29 -0
- package/styles/mention/fabric.scss +6 -0
- package/styles/mention/fluent-dark.css +58 -0
- package/styles/mention/fluent-dark.scss +6 -0
- package/styles/mention/fluent.css +58 -0
- package/styles/mention/fluent.scss +6 -0
- package/styles/mention/highcontrast-light.css +43 -0
- package/styles/mention/highcontrast-light.scss +6 -0
- package/styles/mention/highcontrast.css +43 -0
- package/styles/mention/highcontrast.scss +6 -0
- package/styles/mention/material-dark.css +29 -0
- package/styles/mention/material-dark.scss +6 -0
- package/styles/mention/material.css +29 -0
- package/styles/mention/material.scss +6 -0
- package/styles/mention/tailwind-dark.css +68 -0
- package/styles/mention/tailwind-dark.scss +6 -0
- package/styles/mention/tailwind.css +68 -0
- package/styles/mention/tailwind.scss +6 -0
- package/styles/multi-select/_all.scss +1 -1
- package/styles/multi-select/_bootstrap-dark-definition.scss +11 -1
- package/styles/multi-select/_bootstrap-definition.scss +9 -0
- package/styles/multi-select/_bootstrap4-definition.scss +20 -9
- package/styles/multi-select/_bootstrap5-definition.scss +11 -3
- package/styles/multi-select/_fabric-dark-definition.scss +16 -7
- package/styles/multi-select/_fabric-definition.scss +15 -6
- package/styles/multi-select/_fluent-definition.scss +11 -2
- package/styles/multi-select/_fusionnew-definition.scss +10 -2
- package/styles/multi-select/_highcontrast-definition.scss +59 -29
- package/styles/multi-select/_highcontrast-light-definition.scss +55 -25
- package/styles/multi-select/_layout.scss +91 -78
- package/styles/multi-select/_material-dark-definition.scss +10 -1
- package/styles/multi-select/_material-definition.scss +8 -0
- package/styles/multi-select/_material3-definition.scss +9 -2
- package/styles/multi-select/_tailwind-definition.scss +11 -4
- package/styles/multi-select/_theme.scss +20 -21
- package/styles/multi-select/bootstrap-dark.css +34 -8
- package/styles/multi-select/bootstrap.css +34 -8
- package/styles/multi-select/bootstrap4.css +46 -19
- package/styles/multi-select/bootstrap5-dark.css +38 -11
- package/styles/multi-select/bootstrap5.css +38 -11
- package/styles/multi-select/fabric-dark.css +42 -16
- package/styles/multi-select/fabric.css +42 -16
- package/styles/multi-select/fluent-dark.css +36 -9
- package/styles/multi-select/fluent.css +36 -9
- package/styles/multi-select/highcontrast-light.css +37 -8
- package/styles/multi-select/highcontrast.css +46 -17
- package/styles/multi-select/icons/_bootstrap5.scss +0 -1
- package/styles/multi-select/icons/_fluent.scss +0 -1
- package/styles/multi-select/icons/_fusionnew.scss +0 -1
- package/styles/multi-select/icons/_material-dark.scss +53 -54
- package/styles/multi-select/icons/_material.scss +53 -54
- package/styles/multi-select/icons/_material3.scss +0 -1
- package/styles/multi-select/icons/_tailwind.scss +0 -1
- package/styles/multi-select/material-dark.css +33 -7
- package/styles/multi-select/material.css +33 -7
- package/styles/multi-select/tailwind-dark.css +38 -9
- package/styles/multi-select/tailwind.css +38 -9
- package/styles/tailwind-dark.css +132 -47
- package/styles/tailwind-dark.scss +1 -0
- package/styles/tailwind.css +132 -47
- package/styles/tailwind.scss +1 -0
|
@@ -6,9 +6,6 @@ import { Input, TextBox } from '@syncfusion/ej2-inputs';
|
|
|
6
6
|
import { Button, createCheckBox } from '@syncfusion/ej2-buttons';
|
|
7
7
|
import { TreeView } from '@syncfusion/ej2-navigations';
|
|
8
8
|
|
|
9
|
-
/**
|
|
10
|
-
* IncrementalSearch module file
|
|
11
|
-
*/
|
|
12
9
|
let queryString = '';
|
|
13
10
|
let prevString = '';
|
|
14
11
|
let matches$1 = [];
|
|
@@ -81,7 +78,7 @@ function incrementalSearch(keyCode, items, selectedIndex, ignoreCase, elementId)
|
|
|
81
78
|
* @param {boolean} ignoreCase - Specifies the case sensitive option for search operation.
|
|
82
79
|
* @returns {Element | number} Returns the search matched items.
|
|
83
80
|
*/
|
|
84
|
-
function Search(inputVal, items, searchType, ignoreCase) {
|
|
81
|
+
function Search(inputVal, items, searchType, ignoreCase, dataSource, fields, type) {
|
|
85
82
|
const listItems = items;
|
|
86
83
|
ignoreCase = ignoreCase !== undefined && ignoreCase !== null ? ignoreCase : true;
|
|
87
84
|
const itemData = { item: null, index: null };
|
|
@@ -91,7 +88,20 @@ function Search(inputVal, items, searchType, ignoreCase) {
|
|
|
91
88
|
queryStr = escapeCharRegExp(queryStr);
|
|
92
89
|
for (let i = 0, itemsData = listItems; i < itemsData.length; i++) {
|
|
93
90
|
const item = itemsData[i];
|
|
94
|
-
|
|
91
|
+
let text;
|
|
92
|
+
let filterValue;
|
|
93
|
+
if (items && dataSource) {
|
|
94
|
+
let checkField = item;
|
|
95
|
+
let fieldValue = fields.text.split('.');
|
|
96
|
+
dataSource.filter(function (data) {
|
|
97
|
+
Array.prototype.slice.call(fieldValue).forEach(function (value) {
|
|
98
|
+
if (type === 'object' && checkField.textContent.toString().indexOf(data[value]) !== -1 && checkField.getAttribute('data-value') === data[fields.value] || type === 'string' && checkField.textContent.toString().indexOf(data) !== -1) {
|
|
99
|
+
filterValue = type === 'object' ? data[value] : data;
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
text = dataSource && filterValue ? (ignoreCase ? filterValue.toLocaleLowerCase() : filterValue).replace(/^\s+|\s+$/g, '') : (ignoreCase ? item.textContent.toLocaleLowerCase() : item.textContent).replace(/^\s+|\s+$/g, '');
|
|
95
105
|
if ((searchType === 'Equal' && text === queryStr) || (searchType === 'StartsWith' && text.substr(0, strLength) === queryStr) || (searchType === 'EndsWith' && text.substr(text.length - queryStr.length) === queryStr) || (searchType === 'Contains' && new RegExp(queryStr, "g").test(text))) {
|
|
96
106
|
itemData.item = item;
|
|
97
107
|
itemData.index = i;
|
|
@@ -214,6 +224,8 @@ const dropDownBaseClasses = {
|
|
|
214
224
|
grouping: 'e-dd-group'
|
|
215
225
|
};
|
|
216
226
|
const ITEMTEMPLATE_PROPERTY = 'ItemTemplate';
|
|
227
|
+
const DISPLAYTEMPLATE_PROPERTY = 'DisplayTemplate';
|
|
228
|
+
const SPINNERTEMPLATE_PROPERTY = 'SpinnerTemplate';
|
|
217
229
|
const VALUETEMPLATE_PROPERTY = 'ValueTemplate';
|
|
218
230
|
const GROUPTEMPLATE_PROPERTY = 'GroupTemplate';
|
|
219
231
|
const HEADERTEMPLATE_PROPERTY = 'HeaderTemplate';
|
|
@@ -238,6 +250,7 @@ let DropDownBase = class DropDownBase extends Component {
|
|
|
238
250
|
this.isAngular = false;
|
|
239
251
|
this.isPreventChange = false;
|
|
240
252
|
this.isDynamicDataChange = false;
|
|
253
|
+
this.addedNewItem = false;
|
|
241
254
|
}
|
|
242
255
|
getPropObject(prop, newProp, oldProp) {
|
|
243
256
|
const newProperty = new Object();
|
|
@@ -406,7 +419,8 @@ let DropDownBase = class DropDownBase extends Component {
|
|
|
406
419
|
this.l10n = componentLocale;
|
|
407
420
|
}
|
|
408
421
|
else {
|
|
409
|
-
this.l10n = new L10n(this.getModuleName() === 'listbox' ? 'listbox' :
|
|
422
|
+
this.l10n = new L10n(this.getModuleName() === 'listbox' ? 'listbox' :
|
|
423
|
+
this.getModuleName() === 'mention' ? 'mention' : 'dropdowns', l10nLocale, this.locale);
|
|
410
424
|
}
|
|
411
425
|
const content = actionFailure ?
|
|
412
426
|
this.l10n.getConstant('actionFailureTemplate') : this.l10n.getConstant('noRecordsTemplate');
|
|
@@ -415,9 +429,12 @@ let DropDownBase = class DropDownBase extends Component {
|
|
|
415
429
|
liElem.textContent = content;
|
|
416
430
|
ele.appendChild(liElem);
|
|
417
431
|
liElem.classList.add('e-list-nrt');
|
|
432
|
+
liElem.setAttribute('role', 'option');
|
|
418
433
|
}
|
|
419
434
|
else {
|
|
420
|
-
ele
|
|
435
|
+
if (!isNullOrUndefined(ele)) {
|
|
436
|
+
ele.innerHTML = content;
|
|
437
|
+
}
|
|
421
438
|
}
|
|
422
439
|
}
|
|
423
440
|
}
|
|
@@ -448,14 +465,16 @@ let DropDownBase = class DropDownBase extends Component {
|
|
|
448
465
|
* @returns {void}
|
|
449
466
|
*/
|
|
450
467
|
setEnableRtl() {
|
|
451
|
-
if (this.
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
468
|
+
if (!isNullOrUndefined(this.enableRtlElements)) {
|
|
469
|
+
if (this.list) {
|
|
470
|
+
this.enableRtlElements.push(this.list);
|
|
471
|
+
}
|
|
472
|
+
if (this.enableRtl) {
|
|
473
|
+
addClass(this.enableRtlElements, dropDownBaseClasses.rtl);
|
|
474
|
+
}
|
|
475
|
+
else {
|
|
476
|
+
removeClass(this.enableRtlElements, dropDownBaseClasses.rtl);
|
|
477
|
+
}
|
|
459
478
|
}
|
|
460
479
|
}
|
|
461
480
|
/**
|
|
@@ -463,7 +482,7 @@ let DropDownBase = class DropDownBase extends Component {
|
|
|
463
482
|
*
|
|
464
483
|
* @returns {void}
|
|
465
484
|
*/
|
|
466
|
-
initialize() {
|
|
485
|
+
initialize(e) {
|
|
467
486
|
this.bindEvent = true;
|
|
468
487
|
this.actionFailureTemplateId = `${this.element.id}${ACTIONFAILURETEMPLATE_PROPERTY}`;
|
|
469
488
|
if (this.element.tagName === 'UL') {
|
|
@@ -482,7 +501,7 @@ let DropDownBase = class DropDownBase extends Component {
|
|
|
482
501
|
}
|
|
483
502
|
}
|
|
484
503
|
else {
|
|
485
|
-
this.setListData(this.dataSource, this.fields, this.query);
|
|
504
|
+
this.setListData(this.dataSource, this.fields, this.query, e);
|
|
486
505
|
}
|
|
487
506
|
}
|
|
488
507
|
/**
|
|
@@ -493,14 +512,6 @@ let DropDownBase = class DropDownBase extends Component {
|
|
|
493
512
|
getPersistData() {
|
|
494
513
|
return this.addOnPersist([]);
|
|
495
514
|
}
|
|
496
|
-
/**
|
|
497
|
-
* Sets the enabled state to DropDownBase.
|
|
498
|
-
*
|
|
499
|
-
* @returns {void}
|
|
500
|
-
*/
|
|
501
|
-
setEnabled() {
|
|
502
|
-
this.element.setAttribute('aria-disabled', (this.enabled) ? 'false' : 'true');
|
|
503
|
-
}
|
|
504
515
|
/**
|
|
505
516
|
* Sets the enabled state to DropDownBase.
|
|
506
517
|
*
|
|
@@ -508,7 +519,7 @@ let DropDownBase = class DropDownBase extends Component {
|
|
|
508
519
|
* @returns {void}
|
|
509
520
|
*/
|
|
510
521
|
updateDataAttribute(value) {
|
|
511
|
-
const invalidAttr = ['class', 'style', 'id', 'type'];
|
|
522
|
+
const invalidAttr = ['class', 'style', 'id', 'type', 'aria-expanded', 'aria-autocomplete', 'aria-readonly'];
|
|
512
523
|
const attr = {};
|
|
513
524
|
for (let a = 0; a < this.element.attributes.length; a++) {
|
|
514
525
|
if (invalidAttr.indexOf(this.element.attributes[a].name) === -1 &&
|
|
@@ -575,6 +586,8 @@ let DropDownBase = class DropDownBase extends Component {
|
|
|
575
586
|
this.isRequested = false;
|
|
576
587
|
this.isDataFetched = false;
|
|
577
588
|
this.itemTemplateId = `${this.element.id}${ITEMTEMPLATE_PROPERTY}`;
|
|
589
|
+
this.displayTemplateId = `${this.element.id}${DISPLAYTEMPLATE_PROPERTY}`;
|
|
590
|
+
this.spinnerTemplateId = `${this.element.id}${SPINNERTEMPLATE_PROPERTY}`;
|
|
578
591
|
this.valueTemplateId = `${this.element.id}${VALUETEMPLATE_PROPERTY}`;
|
|
579
592
|
this.groupTemplateId = `${this.element.id}${GROUPTEMPLATE_PROPERTY}`;
|
|
580
593
|
this.headerTemplateId = `${this.element.id}${HEADERTEMPLATE_PROPERTY}`;
|
|
@@ -589,7 +602,7 @@ let DropDownBase = class DropDownBase extends Component {
|
|
|
589
602
|
* @param {Query} query - Accepts the external Query that execute along with data processing.
|
|
590
603
|
* @returns {void}
|
|
591
604
|
*/
|
|
592
|
-
setListData(dataSource, fields, query) {
|
|
605
|
+
setListData(dataSource, fields, query, event) {
|
|
593
606
|
fields = fields ? fields : this.fields;
|
|
594
607
|
let ulElement;
|
|
595
608
|
this.isActive = true;
|
|
@@ -613,10 +626,10 @@ let DropDownBase = class DropDownBase extends Component {
|
|
|
613
626
|
this.isDataFetched = true;
|
|
614
627
|
}
|
|
615
628
|
ulElement = this.renderItems(listItems, fields);
|
|
629
|
+
this.onActionComplete(ulElement, listItems, e);
|
|
616
630
|
if (this.groupTemplate) {
|
|
617
631
|
this.renderGroupTemplate(ulElement);
|
|
618
632
|
}
|
|
619
|
-
this.onActionComplete(ulElement, listItems, e);
|
|
620
633
|
this.isRequested = false;
|
|
621
634
|
this.bindChildItems(listItems, ulElement, fields, e);
|
|
622
635
|
}
|
|
@@ -635,7 +648,7 @@ let DropDownBase = class DropDownBase extends Component {
|
|
|
635
648
|
this.trigger('actionComplete', localDataArgs, (localDataArgs) => {
|
|
636
649
|
if (!localDataArgs.cancel) {
|
|
637
650
|
ulElement = this.renderItems(localDataArgs.result, fields);
|
|
638
|
-
this.onActionComplete(ulElement, localDataArgs.result);
|
|
651
|
+
this.onActionComplete(ulElement, localDataArgs.result, event);
|
|
639
652
|
if (this.groupTemplate) {
|
|
640
653
|
this.renderGroupTemplate(ulElement);
|
|
641
654
|
}
|
|
@@ -717,7 +730,9 @@ let DropDownBase = class DropDownBase extends Component {
|
|
|
717
730
|
this.liCollections = [];
|
|
718
731
|
this.trigger('actionFailure', e);
|
|
719
732
|
this.l10nUpdate(true);
|
|
720
|
-
|
|
733
|
+
if (!isNullOrUndefined(this.list)) {
|
|
734
|
+
addClass([this.list], dropDownBaseClasses.noData);
|
|
735
|
+
}
|
|
721
736
|
}
|
|
722
737
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
723
738
|
onActionComplete(ulElement, list, e) {
|
|
@@ -844,18 +859,22 @@ let DropDownBase = class DropDownBase extends Component {
|
|
|
844
859
|
return extend({}, options, fields, true);
|
|
845
860
|
}
|
|
846
861
|
setFloatingHeader(e) {
|
|
847
|
-
if (isNullOrUndefined(this.
|
|
848
|
-
this.fixedHeaderElement
|
|
849
|
-
|
|
850
|
-
this.
|
|
862
|
+
if (!isNullOrUndefined(this.list) && !this.list.classList.contains(dropDownBaseClasses.noData)) {
|
|
863
|
+
if (isNullOrUndefined(this.fixedHeaderElement)) {
|
|
864
|
+
this.fixedHeaderElement = this.createElement('div', { className: dropDownBaseClasses.fixedHead });
|
|
865
|
+
if (!isNullOrUndefined(this.list) && !this.list.querySelector('li').classList.contains(dropDownBaseClasses.group)) {
|
|
866
|
+
this.fixedHeaderElement.style.display = 'none';
|
|
867
|
+
}
|
|
868
|
+
if (!isNullOrUndefined(this.fixedHeaderElement) && !isNullOrUndefined(this.list)) {
|
|
869
|
+
prepend([this.fixedHeaderElement], this.list);
|
|
870
|
+
}
|
|
871
|
+
this.setFixedHeader();
|
|
851
872
|
}
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
this.setFixedHeader();
|
|
873
|
+
if (!isNullOrUndefined(this.fixedHeaderElement) && this.fixedHeaderElement.style.zIndex === '0') {
|
|
874
|
+
this.setFixedHeader();
|
|
875
|
+
}
|
|
876
|
+
this.scrollStop(e);
|
|
857
877
|
}
|
|
858
|
-
this.scrollStop(e);
|
|
859
878
|
}
|
|
860
879
|
scrollStop(e) {
|
|
861
880
|
let target = !isNullOrUndefined(e) ? e.target : this.list;
|
|
@@ -939,7 +958,9 @@ let DropDownBase = class DropDownBase extends Component {
|
|
|
939
958
|
return item;
|
|
940
959
|
}
|
|
941
960
|
setFixedHeader() {
|
|
942
|
-
this.list
|
|
961
|
+
if (!isNullOrUndefined(this.list)) {
|
|
962
|
+
this.list.parentElement.style.display = 'block';
|
|
963
|
+
}
|
|
943
964
|
let borderWidth = 0;
|
|
944
965
|
if (this.list && this.list.parentElement) {
|
|
945
966
|
borderWidth = parseInt(document.defaultView.getComputedStyle(this.list.parentElement, null).getPropertyValue('border-width'), 10);
|
|
@@ -954,8 +975,10 @@ let DropDownBase = class DropDownBase extends Component {
|
|
|
954
975
|
borderWidth = (borderTopWidth + borderBottomWidth + borderLeftWidth + borderRightWidth);
|
|
955
976
|
}
|
|
956
977
|
}
|
|
957
|
-
|
|
958
|
-
|
|
978
|
+
if (!isNullOrUndefined(this.liCollections)) {
|
|
979
|
+
const liWidth = this.getValidLi().offsetWidth - borderWidth;
|
|
980
|
+
this.fixedHeaderElement.style.width = liWidth.toString() + 'px';
|
|
981
|
+
}
|
|
959
982
|
setStyleAttribute(this.fixedHeaderElement, { zIndex: 10 });
|
|
960
983
|
const firstLi = this.ulElement.querySelector('.' + dropDownBaseClasses.group + ':not(.e-hide-listitem)');
|
|
961
984
|
this.fixedHeaderElement.innerHTML = firstLi.innerHTML;
|
|
@@ -1024,7 +1047,7 @@ let DropDownBase = class DropDownBase extends Component {
|
|
|
1024
1047
|
* @param {Query} query - Accepts the external Query that execute along with data processing.
|
|
1025
1048
|
* @returns {void}
|
|
1026
1049
|
*/
|
|
1027
|
-
resetList(dataSource, fields, query) {
|
|
1050
|
+
resetList(dataSource, fields, query, e) {
|
|
1028
1051
|
if (this.list) {
|
|
1029
1052
|
if ((this.element.tagName === 'SELECT' && this.element.options.length > 0)
|
|
1030
1053
|
|| (this.element.tagName === 'UL' && this.element.childNodes.length > 0)) {
|
|
@@ -1034,8 +1057,9 @@ let DropDownBase = class DropDownBase extends Component {
|
|
|
1034
1057
|
dataSource = this.selectData;
|
|
1035
1058
|
}
|
|
1036
1059
|
}
|
|
1037
|
-
dataSource = this.getModuleName() === 'combobox' && this.selectData && dataSource instanceof Array && dataSource.length < this.selectData.length ? this.selectData : dataSource;
|
|
1038
|
-
this.
|
|
1060
|
+
dataSource = this.getModuleName() === 'combobox' && this.selectData && dataSource instanceof Array && dataSource.length < this.selectData.length && this.addedNewItem ? this.selectData : dataSource;
|
|
1061
|
+
this.addedNewItem = false;
|
|
1062
|
+
this.setListData(dataSource, fields, query, e);
|
|
1039
1063
|
}
|
|
1040
1064
|
}
|
|
1041
1065
|
updateSelectElementData(isFiltering) {
|
|
@@ -1097,9 +1121,6 @@ let DropDownBase = class DropDownBase extends Component {
|
|
|
1097
1121
|
case 'enableRtl':
|
|
1098
1122
|
this.setEnableRtl();
|
|
1099
1123
|
break;
|
|
1100
|
-
case 'enabled':
|
|
1101
|
-
this.setEnabled();
|
|
1102
|
-
break;
|
|
1103
1124
|
case 'groupTemplate':
|
|
1104
1125
|
this.renderGroupTemplate(this.list);
|
|
1105
1126
|
if (this.ulElement && this.fixedHeaderElement) {
|
|
@@ -1126,7 +1147,7 @@ let DropDownBase = class DropDownBase extends Component {
|
|
|
1126
1147
|
* @private
|
|
1127
1148
|
* @returns {void}
|
|
1128
1149
|
*/
|
|
1129
|
-
render(isEmptyData) {
|
|
1150
|
+
render(e, isEmptyData) {
|
|
1130
1151
|
this.list = this.createElement('div', { className: dropDownBaseClasses.content, attrs: { 'tabindex': '0' } });
|
|
1131
1152
|
this.list.classList.add(dropDownBaseClasses.root);
|
|
1132
1153
|
this.setFields();
|
|
@@ -1148,9 +1169,8 @@ let DropDownBase = class DropDownBase extends Component {
|
|
|
1148
1169
|
wrapperElement.appendChild(this.list);
|
|
1149
1170
|
}
|
|
1150
1171
|
this.setEnableRtl();
|
|
1151
|
-
this.setEnabled();
|
|
1152
1172
|
if (!isEmptyData) {
|
|
1153
|
-
this.initialize();
|
|
1173
|
+
this.initialize(e);
|
|
1154
1174
|
}
|
|
1155
1175
|
}
|
|
1156
1176
|
/**
|
|
@@ -1176,7 +1196,7 @@ let DropDownBase = class DropDownBase extends Component {
|
|
|
1176
1196
|
* Adds a new item to the popup list. By default, new item appends to the list as the last item,
|
|
1177
1197
|
* but you can insert based on the index parameter.
|
|
1178
1198
|
*
|
|
1179
|
-
* @param
|
|
1199
|
+
* @param { Object[] } items - Specifies an array of JSON data or a JSON data.
|
|
1180
1200
|
* @param { number } itemIndex - Specifies the index to place the newly added item in the popup list.
|
|
1181
1201
|
* @returns {void}
|
|
1182
1202
|
* @deprecated
|
|
@@ -1240,11 +1260,17 @@ let DropDownBase = class DropDownBase extends Component {
|
|
|
1240
1260
|
this.trigger('beforeItemRender', { element: li, item: item });
|
|
1241
1261
|
}
|
|
1242
1262
|
if (itemsCount === 0 && isNullOrUndefined(this.list.querySelector('ul'))) {
|
|
1243
|
-
this.list
|
|
1244
|
-
|
|
1245
|
-
|
|
1263
|
+
if (!isNullOrUndefined(this.list)) {
|
|
1264
|
+
this.list.innerHTML = '';
|
|
1265
|
+
this.list.classList.remove(dropDownBaseClasses.noData);
|
|
1266
|
+
if (!isNullOrUndefined(this.ulElement)) {
|
|
1267
|
+
this.list.appendChild(this.ulElement);
|
|
1268
|
+
}
|
|
1269
|
+
}
|
|
1246
1270
|
this.liCollections = liCollections;
|
|
1247
|
-
|
|
1271
|
+
if (!isNullOrUndefined(liCollections) && !isNullOrUndefined(this.ulElement)) {
|
|
1272
|
+
append(liCollections, this.ulElement);
|
|
1273
|
+
}
|
|
1248
1274
|
this.updateAddItemList(this.list, itemsCount);
|
|
1249
1275
|
}
|
|
1250
1276
|
else {
|
|
@@ -1291,6 +1317,7 @@ let DropDownBase = class DropDownBase extends Component {
|
|
|
1291
1317
|
if (selectedItemValue || itemIndex === 0) {
|
|
1292
1318
|
this.updateSelection();
|
|
1293
1319
|
}
|
|
1320
|
+
this.addedNewItem = true;
|
|
1294
1321
|
}
|
|
1295
1322
|
validationAttribute(target, hidden) {
|
|
1296
1323
|
const name = target.getAttribute('name') ? target.getAttribute('name') : target.getAttribute('id');
|
|
@@ -1362,15 +1389,17 @@ let DropDownBase = class DropDownBase extends Component {
|
|
|
1362
1389
|
}
|
|
1363
1390
|
detach(this.list);
|
|
1364
1391
|
}
|
|
1392
|
+
this.liCollections = null;
|
|
1393
|
+
this.ulElement = null;
|
|
1394
|
+
this.list = null;
|
|
1395
|
+
this.enableRtlElements = null;
|
|
1396
|
+
this.rippleFun = null;
|
|
1365
1397
|
super.destroy();
|
|
1366
1398
|
}
|
|
1367
1399
|
};
|
|
1368
1400
|
__decorate([
|
|
1369
1401
|
Complex({ text: null, value: null, iconCss: null, groupBy: null }, FieldSettings)
|
|
1370
1402
|
], DropDownBase.prototype, "fields", void 0);
|
|
1371
|
-
__decorate([
|
|
1372
|
-
Property(false)
|
|
1373
|
-
], DropDownBase.prototype, "enablePersistence", void 0);
|
|
1374
1403
|
__decorate([
|
|
1375
1404
|
Property(null)
|
|
1376
1405
|
], DropDownBase.prototype, "itemTemplate", void 0);
|
|
@@ -1386,9 +1415,6 @@ __decorate([
|
|
|
1386
1415
|
__decorate([
|
|
1387
1416
|
Property('None')
|
|
1388
1417
|
], DropDownBase.prototype, "sortOrder", void 0);
|
|
1389
|
-
__decorate([
|
|
1390
|
-
Property(true)
|
|
1391
|
-
], DropDownBase.prototype, "enabled", void 0);
|
|
1392
1418
|
__decorate([
|
|
1393
1419
|
Property([])
|
|
1394
1420
|
], DropDownBase.prototype, "dataSource", void 0);
|
|
@@ -1567,8 +1593,8 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
1567
1593
|
this.popupObj.setProperties({ 'zIndex': this.zIndex });
|
|
1568
1594
|
}
|
|
1569
1595
|
}
|
|
1570
|
-
renderList(isEmptyData) {
|
|
1571
|
-
super.render(isEmptyData);
|
|
1596
|
+
renderList(e, isEmptyData) {
|
|
1597
|
+
super.render(e, isEmptyData);
|
|
1572
1598
|
this.unWireListEvents();
|
|
1573
1599
|
this.wireListEvents();
|
|
1574
1600
|
}
|
|
@@ -1600,6 +1626,7 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
1600
1626
|
}
|
|
1601
1627
|
}
|
|
1602
1628
|
clearAll(e, properties) {
|
|
1629
|
+
this.previousItemData = (!isNullOrUndefined(this.itemData)) ? this.itemData : null;
|
|
1603
1630
|
if (isNullOrUndefined(properties) || (!isNullOrUndefined(properties) &&
|
|
1604
1631
|
(isNullOrUndefined(properties.dataSource) ||
|
|
1605
1632
|
(!(properties.dataSource instanceof DataManager) && properties.dataSource.length === 0)))) {
|
|
@@ -1625,14 +1652,18 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
1625
1652
|
}
|
|
1626
1653
|
else {
|
|
1627
1654
|
if (this.allowFiltering && this.getModuleName() !== 'autocomplete'
|
|
1628
|
-
&& !isNullOrUndefined(this.actionCompleteData.ulElement) && !isNullOrUndefined(this.actionCompleteData.list)) {
|
|
1655
|
+
&& !isNullOrUndefined(this.actionCompleteData.ulElement) && !isNullOrUndefined(this.actionCompleteData.list) && this.actionCompleteData.list.length > 0) {
|
|
1629
1656
|
this.onActionComplete(this.actionCompleteData.ulElement.cloneNode(true), this.actionCompleteData.list);
|
|
1630
1657
|
}
|
|
1631
1658
|
this.resetFocusElement();
|
|
1632
1659
|
}
|
|
1633
1660
|
}
|
|
1634
|
-
this.hiddenElement
|
|
1635
|
-
|
|
1661
|
+
if (!isNullOrUndefined(this.hiddenElement)) {
|
|
1662
|
+
this.hiddenElement.innerHTML = '';
|
|
1663
|
+
}
|
|
1664
|
+
if (!isNullOrUndefined(this.inputElement)) {
|
|
1665
|
+
this.inputElement.value = '';
|
|
1666
|
+
}
|
|
1636
1667
|
this.value = null;
|
|
1637
1668
|
this.itemData = null;
|
|
1638
1669
|
this.text = null;
|
|
@@ -1654,42 +1685,42 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
1654
1685
|
if (Object.keys(this.htmlAttributes).length) {
|
|
1655
1686
|
for (const htmlAttr of Object.keys(this.htmlAttributes)) {
|
|
1656
1687
|
if (htmlAttr === 'class') {
|
|
1657
|
-
const updatedClassValue = (this.htmlAttributes[htmlAttr].replace(/\s+/g, ' ')).trim();
|
|
1688
|
+
const updatedClassValue = (this.htmlAttributes[`${htmlAttr}`].replace(/\s+/g, ' ')).trim();
|
|
1658
1689
|
if (updatedClassValue !== '') {
|
|
1659
1690
|
addClass([this.inputWrapper.container], updatedClassValue.split(' '));
|
|
1660
1691
|
}
|
|
1661
1692
|
}
|
|
1662
|
-
else if (htmlAttr === 'disabled' && this.htmlAttributes[htmlAttr] === 'disabled') {
|
|
1693
|
+
else if (htmlAttr === 'disabled' && this.htmlAttributes[`${htmlAttr}`] === 'disabled') {
|
|
1663
1694
|
this.enabled = false;
|
|
1664
1695
|
this.setEnable();
|
|
1665
1696
|
}
|
|
1666
|
-
else if (htmlAttr === 'readonly' && !isNullOrUndefined(this.htmlAttributes[htmlAttr])) {
|
|
1697
|
+
else if (htmlAttr === 'readonly' && !isNullOrUndefined(this.htmlAttributes[`${htmlAttr}`])) {
|
|
1667
1698
|
this.readonly = true;
|
|
1668
1699
|
this.dataBind();
|
|
1669
1700
|
}
|
|
1670
1701
|
else if (htmlAttr === 'style') {
|
|
1671
|
-
this.inputWrapper.container.setAttribute('style', this.htmlAttributes[htmlAttr]);
|
|
1702
|
+
this.inputWrapper.container.setAttribute('style', this.htmlAttributes[`${htmlAttr}`]);
|
|
1672
1703
|
}
|
|
1673
1704
|
else {
|
|
1674
|
-
const defaultAttr = ['title', 'id', 'placeholder',
|
|
1675
|
-
'role', '
|
|
1705
|
+
const defaultAttr = ['title', 'id', 'placeholder',
|
|
1706
|
+
'role', 'autocomplete', 'autocapitalize', 'spellcheck', 'minlength', 'maxlength'];
|
|
1676
1707
|
const validateAttr = ['name', 'required'];
|
|
1677
1708
|
if (this.getModuleName() === 'autocomplete' || this.getModuleName() === 'combobox') {
|
|
1678
1709
|
defaultAttr.push('tabindex');
|
|
1679
1710
|
}
|
|
1680
1711
|
if (validateAttr.indexOf(htmlAttr) > -1 || htmlAttr.indexOf('data') === 0) {
|
|
1681
|
-
this.hiddenElement.setAttribute(htmlAttr, this.htmlAttributes[htmlAttr]);
|
|
1712
|
+
this.hiddenElement.setAttribute(htmlAttr, this.htmlAttributes[`${htmlAttr}`]);
|
|
1682
1713
|
}
|
|
1683
1714
|
else if (defaultAttr.indexOf(htmlAttr) > -1) {
|
|
1684
1715
|
if (htmlAttr === 'placeholder') {
|
|
1685
|
-
Input.setPlaceholder(this.htmlAttributes[htmlAttr], this.inputElement);
|
|
1716
|
+
Input.setPlaceholder(this.htmlAttributes[`${htmlAttr}`], this.inputElement);
|
|
1686
1717
|
}
|
|
1687
1718
|
else {
|
|
1688
|
-
this.inputElement.setAttribute(htmlAttr, this.htmlAttributes[htmlAttr]);
|
|
1719
|
+
this.inputElement.setAttribute(htmlAttr, this.htmlAttributes[`${htmlAttr}`]);
|
|
1689
1720
|
}
|
|
1690
1721
|
}
|
|
1691
1722
|
else {
|
|
1692
|
-
this.inputWrapper.container.setAttribute(htmlAttr, this.htmlAttributes[htmlAttr]);
|
|
1723
|
+
this.inputWrapper.container.setAttribute(htmlAttr, this.htmlAttributes[`${htmlAttr}`]);
|
|
1693
1724
|
}
|
|
1694
1725
|
}
|
|
1695
1726
|
}
|
|
@@ -1701,11 +1732,8 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
1701
1732
|
getAriaAttributes() {
|
|
1702
1733
|
return {
|
|
1703
1734
|
'aria-disabled': 'false',
|
|
1704
|
-
'aria-owns': this.element.id + '_options',
|
|
1705
1735
|
'role': 'combobox',
|
|
1706
|
-
'aria-haspopup': 'true',
|
|
1707
1736
|
'aria-expanded': 'false',
|
|
1708
|
-
'aria-activedescendant': 'null',
|
|
1709
1737
|
'aria-live': 'polite',
|
|
1710
1738
|
'aria-labelledby': this.hiddenElement.id
|
|
1711
1739
|
};
|
|
@@ -1748,7 +1776,7 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
1748
1776
|
}
|
|
1749
1777
|
}
|
|
1750
1778
|
targetElement() {
|
|
1751
|
-
return this.inputWrapper.container;
|
|
1779
|
+
return !isNullOrUndefined(this.inputWrapper) ? this.inputWrapper.container : null;
|
|
1752
1780
|
}
|
|
1753
1781
|
getNgDirective() {
|
|
1754
1782
|
return 'EJS-DROPDOWNLIST';
|
|
@@ -1906,7 +1934,7 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
1906
1934
|
}
|
|
1907
1935
|
}
|
|
1908
1936
|
unBindCommonEvent() {
|
|
1909
|
-
if (this.targetElement()) {
|
|
1937
|
+
if (!isNullOrUndefined(this.inputWrapper) && this.targetElement()) {
|
|
1910
1938
|
EventHandler.remove(this.targetElement(), 'blur', this.onBlurHandler);
|
|
1911
1939
|
}
|
|
1912
1940
|
const formElement = this.inputElement && closest(this.inputElement, 'form');
|
|
@@ -1936,9 +1964,11 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
1936
1964
|
* @returns {void}
|
|
1937
1965
|
*/
|
|
1938
1966
|
wireListEvents() {
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1967
|
+
if (!isNullOrUndefined(this.list)) {
|
|
1968
|
+
EventHandler.add(this.list, 'click', this.onMouseClick, this);
|
|
1969
|
+
EventHandler.add(this.list, 'mouseover', this.onMouseOver, this);
|
|
1970
|
+
EventHandler.add(this.list, 'mouseout', this.onMouseLeave, this);
|
|
1971
|
+
}
|
|
1942
1972
|
}
|
|
1943
1973
|
onSearch(e) {
|
|
1944
1974
|
if (e.charCode !== 32 && e.charCode !== 13) {
|
|
@@ -2051,7 +2081,7 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
2051
2081
|
const isTabAction = e.action === 'tab' || e.action === 'close';
|
|
2052
2082
|
if (this.list === undefined && !this.isRequested && !isTabAction && e.action !== 'escape') {
|
|
2053
2083
|
this.searchKeyEvent = e;
|
|
2054
|
-
this.renderList();
|
|
2084
|
+
this.renderList(e);
|
|
2055
2085
|
}
|
|
2056
2086
|
if (isNullOrUndefined(this.list) || (!isNullOrUndefined(this.liCollections) &&
|
|
2057
2087
|
isNavigation && this.liCollections.length === 0) || this.isRequested) {
|
|
@@ -2090,7 +2120,7 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
2090
2120
|
}
|
|
2091
2121
|
break;
|
|
2092
2122
|
case 'open':
|
|
2093
|
-
this.showPopup();
|
|
2123
|
+
this.showPopup(e);
|
|
2094
2124
|
break;
|
|
2095
2125
|
case 'hide':
|
|
2096
2126
|
this.preventAltUp = this.isPopupOpen;
|
|
@@ -2216,9 +2246,11 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
2216
2246
|
this.setSelection(previousItem, event);
|
|
2217
2247
|
}
|
|
2218
2248
|
unWireEvent() {
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2249
|
+
if (!isNullOrUndefined(this.inputWrapper)) {
|
|
2250
|
+
EventHandler.remove(this.inputWrapper.container, 'mousedown', this.dropDownClick);
|
|
2251
|
+
EventHandler.remove(this.inputWrapper.container, 'keypress', this.onSearch);
|
|
2252
|
+
EventHandler.remove(this.inputWrapper.container, 'focus', this.focusIn);
|
|
2253
|
+
}
|
|
2222
2254
|
this.unBindCommonEvent();
|
|
2223
2255
|
}
|
|
2224
2256
|
/**
|
|
@@ -2227,9 +2259,11 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
2227
2259
|
* @returns {void}
|
|
2228
2260
|
*/
|
|
2229
2261
|
unWireListEvents() {
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2262
|
+
if (this.list) {
|
|
2263
|
+
EventHandler.remove(this.list, 'click', this.onMouseClick);
|
|
2264
|
+
EventHandler.remove(this.list, 'mouseover', this.onMouseOver);
|
|
2265
|
+
EventHandler.remove(this.list, 'mouseout', this.onMouseLeave);
|
|
2266
|
+
}
|
|
2233
2267
|
}
|
|
2234
2268
|
checkSelector(id) {
|
|
2235
2269
|
return '[id="' + id.replace(/(:|\.|\[|\]|,|=|@|\\|\/|#)/g, '\\$1') + '"]';
|
|
@@ -2237,7 +2271,7 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
2237
2271
|
onDocumentClick(e) {
|
|
2238
2272
|
const target = e.target;
|
|
2239
2273
|
if (!(!isNullOrUndefined(this.popupObj) && closest(target, this.checkSelector(this.popupObj.element.id))) &&
|
|
2240
|
-
!this.inputWrapper.container.contains(e.target)) {
|
|
2274
|
+
!isNullOrUndefined(this.inputWrapper) && !this.inputWrapper.container.contains(e.target)) {
|
|
2241
2275
|
if (this.inputWrapper.container.classList.contains(dropDownListClasses.inputFocus) || this.isPopupOpen) {
|
|
2242
2276
|
this.isDocumentClick = true;
|
|
2243
2277
|
const isActive = this.isRequested;
|
|
@@ -2282,7 +2316,7 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
2282
2316
|
}
|
|
2283
2317
|
if (!this.readonly) {
|
|
2284
2318
|
if (this.isPopupOpen) {
|
|
2285
|
-
this.hidePopup();
|
|
2319
|
+
this.hidePopup(e);
|
|
2286
2320
|
if (this.isFilterLayout()) {
|
|
2287
2321
|
this.focusDropDown(e);
|
|
2288
2322
|
}
|
|
@@ -2292,7 +2326,7 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
2292
2326
|
this.floatLabelChange();
|
|
2293
2327
|
this.queryString = this.inputElement.value.trim() === '' ? null : this.inputElement.value;
|
|
2294
2328
|
this.isDropDownClick = true;
|
|
2295
|
-
this.showPopup();
|
|
2329
|
+
this.showPopup(e);
|
|
2296
2330
|
}
|
|
2297
2331
|
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
2298
2332
|
const proxy = this;
|
|
@@ -2355,6 +2389,9 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
2355
2389
|
}
|
|
2356
2390
|
selectEventCallback(li, e, preventSelect, selectedData, value) {
|
|
2357
2391
|
this.previousItemData = (!isNullOrUndefined(this.itemData)) ? this.itemData : null;
|
|
2392
|
+
if (this.itemData != selectedData) {
|
|
2393
|
+
this.previousValue = (!isNullOrUndefined(this.itemData)) ? typeof this.itemData == "object" ? this.checkFieldValue(this.itemData, this.fields.value.split('.')) : this.itemData : null;
|
|
2394
|
+
}
|
|
2358
2395
|
this.item = li;
|
|
2359
2396
|
this.itemData = selectedData;
|
|
2360
2397
|
const focusedItem = this.list.querySelector('.' + dropDownBaseClasses.focus);
|
|
@@ -2425,10 +2462,6 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
2425
2462
|
if (this.setValue(e)) {
|
|
2426
2463
|
return;
|
|
2427
2464
|
}
|
|
2428
|
-
attributes(this.targetElement(), { 'aria-activedescendant': this.selectedLI ? this.selectedLI.id : null });
|
|
2429
|
-
if (this.isFilterLayout() && this.filterInput) {
|
|
2430
|
-
attributes(this.filterInput, { 'aria-activedescendant': this.selectedLI ? this.selectedLI.id : null });
|
|
2431
|
-
}
|
|
2432
2465
|
if ((!this.isPopupOpen && !isNullOrUndefined(li)) || (this.isPopupOpen && !isNullOrUndefined(e) &&
|
|
2433
2466
|
(e.type !== 'keydown' || e.type === 'keydown' && e.action === 'enter'))) {
|
|
2434
2467
|
this.isSelectCustom = false;
|
|
@@ -2438,9 +2471,17 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
2438
2471
|
this.setScrollPosition(e);
|
|
2439
2472
|
}
|
|
2440
2473
|
if (Browser.info.name !== 'mozilla') {
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2474
|
+
if (this.targetElement()) {
|
|
2475
|
+
attributes(this.targetElement(), { 'aria-label': this.inputElement.value });
|
|
2476
|
+
attributes(this.targetElement(), { 'aria-describedby': this.inputElement.id != '' ? this.inputElement.id : this.element.id });
|
|
2477
|
+
this.targetElement().removeAttribute('aria-live');
|
|
2478
|
+
}
|
|
2479
|
+
}
|
|
2480
|
+
if (this.isPopupOpen && !isNullOrUndefined(this.ulElement) && !isNullOrUndefined(this.ulElement.getElementsByClassName('e-item-focus')[0])) {
|
|
2481
|
+
attributes(this.targetElement(), { 'aria-activedescendant': this.ulElement.getElementsByClassName('e-item-focus')[0].id });
|
|
2482
|
+
}
|
|
2483
|
+
else if (this.isPopupOpen && !isNullOrUndefined(this.ulElement) && !isNullOrUndefined(this.ulElement.getElementsByClassName('e-active')[0])) {
|
|
2484
|
+
attributes(this.targetElement(), { 'aria-activedescendant': this.ulElement.getElementsByClassName('e-active')[0].id });
|
|
2444
2485
|
}
|
|
2445
2486
|
}
|
|
2446
2487
|
dropdownCompiler(dropdownTemplate) {
|
|
@@ -2605,9 +2646,11 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
2605
2646
|
selectedElement.setAttribute('value', this.value.toString());
|
|
2606
2647
|
}
|
|
2607
2648
|
else {
|
|
2608
|
-
this.hiddenElement
|
|
2609
|
-
|
|
2610
|
-
|
|
2649
|
+
if (!isNullOrUndefined(this.hiddenElement)) {
|
|
2650
|
+
this.hiddenElement.innerHTML = '<option selected>' + this.text + '</option>';
|
|
2651
|
+
const selectedElement = this.hiddenElement.querySelector('option');
|
|
2652
|
+
selectedElement.setAttribute('value', this.value.toString());
|
|
2653
|
+
}
|
|
2611
2654
|
}
|
|
2612
2655
|
}
|
|
2613
2656
|
else {
|
|
@@ -2634,6 +2677,9 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
2634
2677
|
this.preventAutoFill = false;
|
|
2635
2678
|
}
|
|
2636
2679
|
this.preventAltUp = false;
|
|
2680
|
+
if (this.getModuleName() === 'autocomplete' && !isNullOrUndefined(this.ulElement) && !isNullOrUndefined(this.ulElement.getElementsByClassName('e-item-focus')[0])) {
|
|
2681
|
+
attributes(this.targetElement(), { 'aria-activedescendant': this.ulElement.getElementsByClassName('e-item-focus')[0].id });
|
|
2682
|
+
}
|
|
2637
2683
|
e.preventDefault();
|
|
2638
2684
|
break;
|
|
2639
2685
|
case 46: //delete
|
|
@@ -2755,9 +2801,9 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
2755
2801
|
/**
|
|
2756
2802
|
* To filter the data from given data source by using query
|
|
2757
2803
|
*
|
|
2758
|
-
* @param
|
|
2759
|
-
* @param
|
|
2760
|
-
* @param
|
|
2804
|
+
* @param {Object[] | DataManager } dataSource - Set the data source to filter.
|
|
2805
|
+
* @param {Query} query - Specify the query to filter the data.
|
|
2806
|
+
* @param {FieldSettingsModel} fields - Specify the fields to map the column in the data table.
|
|
2761
2807
|
* @returns {void}
|
|
2762
2808
|
* @deprecated
|
|
2763
2809
|
*/
|
|
@@ -2823,11 +2869,8 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
2823
2869
|
prepend([parentElement], popupElement);
|
|
2824
2870
|
attributes(this.filterInput, {
|
|
2825
2871
|
'aria-disabled': 'false',
|
|
2826
|
-
'
|
|
2827
|
-
'role': 'listbox',
|
|
2828
|
-
'aria-activedescendant': this.selectedLI ? this.selectedLI.id : null,
|
|
2872
|
+
'role': 'combobox',
|
|
2829
2873
|
'autocomplete': 'off',
|
|
2830
|
-
'autocorrect': 'off',
|
|
2831
2874
|
'autocapitalize': 'off',
|
|
2832
2875
|
'spellcheck': 'false'
|
|
2833
2876
|
});
|
|
@@ -2911,7 +2954,8 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
2911
2954
|
this.initRemoteRender = false;
|
|
2912
2955
|
if (this.value && this.dataSource instanceof DataManager) {
|
|
2913
2956
|
const checkField = isNullOrUndefined(this.fields.value) ? this.fields.text : this.fields.value;
|
|
2914
|
-
const
|
|
2957
|
+
const fieldValue = this.fields.value.split('.');
|
|
2958
|
+
const checkVal = list.some((x) => isNullOrUndefined(x[checkField]) && fieldValue.length > 1 ? this.checkFieldValue(x, fieldValue) === this.value : x[checkField] === this.value);
|
|
2915
2959
|
if (!checkVal) {
|
|
2916
2960
|
this.dataSource.executeQuery(this.getQuery(this.query).where(new Predicate(checkField, 'equal', this.value)))
|
|
2917
2961
|
.then((e) => {
|
|
@@ -2933,26 +2977,8 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
2933
2977
|
}
|
|
2934
2978
|
this.initial = false;
|
|
2935
2979
|
}
|
|
2936
|
-
else if (this.getModuleName() === 'autocomplete' && this.value
|
|
2937
|
-
|
|
2938
|
-
const checkValue = list.some((x) => x[checkFields] === this.value);
|
|
2939
|
-
let query = new Query();
|
|
2940
|
-
if (!checkValue) {
|
|
2941
|
-
new DataManager(this.dataSource).executeQuery(query.where(new Predicate(checkFields, 'equal', this.value)))
|
|
2942
|
-
.then((e) => {
|
|
2943
|
-
if (e.result.length > 0) {
|
|
2944
|
-
this.value = checkFields !== '' ? e.result[0][this.fields.value].toString() : e.result[0].toString();
|
|
2945
|
-
this.addItem(e.result, list.length);
|
|
2946
|
-
this.updateValues();
|
|
2947
|
-
}
|
|
2948
|
-
else {
|
|
2949
|
-
this.updateValues();
|
|
2950
|
-
}
|
|
2951
|
-
});
|
|
2952
|
-
}
|
|
2953
|
-
else {
|
|
2954
|
-
this.updateValues();
|
|
2955
|
-
}
|
|
2980
|
+
else if (this.getModuleName() === 'autocomplete' && this.value) {
|
|
2981
|
+
this.setInputValue();
|
|
2956
2982
|
}
|
|
2957
2983
|
if (this.getModuleName() !== 'autocomplete' && this.isFiltering() && !this.isTyped) {
|
|
2958
2984
|
if (!this.actionCompleteData.isUpdated || ((!this.isCustomFilter
|
|
@@ -2975,10 +3001,17 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
2975
3001
|
}
|
|
2976
3002
|
}
|
|
2977
3003
|
if (this.beforePopupOpen) {
|
|
2978
|
-
this.renderPopup();
|
|
3004
|
+
this.renderPopup(e);
|
|
2979
3005
|
}
|
|
2980
3006
|
}
|
|
2981
3007
|
}
|
|
3008
|
+
checkFieldValue(list, fieldValue) {
|
|
3009
|
+
let checkField = list;
|
|
3010
|
+
fieldValue.forEach((value) => {
|
|
3011
|
+
checkField = checkField[value];
|
|
3012
|
+
});
|
|
3013
|
+
return checkField;
|
|
3014
|
+
}
|
|
2982
3015
|
updateActionCompleteDataValues(ulElement, list) {
|
|
2983
3016
|
this.actionCompleteData = { ulElement: ulElement.cloneNode(true), list: list, isUpdated: true };
|
|
2984
3017
|
if (this.actionData.list !== this.actionCompleteData.list && this.actionCompleteData.ulElement && this.actionCompleteData.list) {
|
|
@@ -3045,7 +3078,7 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
3045
3078
|
removeClass(highlightedItem, dropDownListClasses.focus);
|
|
3046
3079
|
}
|
|
3047
3080
|
}
|
|
3048
|
-
renderPopup() {
|
|
3081
|
+
renderPopup(e) {
|
|
3049
3082
|
if (this.popupObj && document.body.contains(this.popupObj.element)) {
|
|
3050
3083
|
this.refreshPopup();
|
|
3051
3084
|
return;
|
|
@@ -3101,9 +3134,11 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
3101
3134
|
(this.isDropDownClick && this.getModuleName() === 'combobox')))) {
|
|
3102
3135
|
offsetValue = this.getOffsetValue(popupEle);
|
|
3103
3136
|
const firstItem = this.isEmptyList() ? this.list : this.liCollections[0];
|
|
3104
|
-
|
|
3105
|
-
parseInt(getComputedStyle(
|
|
3106
|
-
|
|
3137
|
+
if (!isNullOrUndefined(this.inputElement)) {
|
|
3138
|
+
left = -(parseInt(getComputedStyle(firstItem).textIndent, 10) -
|
|
3139
|
+
parseInt(getComputedStyle(this.inputElement).paddingLeft, 10) +
|
|
3140
|
+
parseInt(getComputedStyle(this.inputElement.parentElement).borderLeftWidth, 10));
|
|
3141
|
+
}
|
|
3107
3142
|
}
|
|
3108
3143
|
this.getFocusElement();
|
|
3109
3144
|
this.createPopup(popupEle, offsetValue, left);
|
|
@@ -3133,25 +3168,28 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
3133
3168
|
for (const element of scrollParentElements) {
|
|
3134
3169
|
EventHandler.add(element, 'scroll', this.scrollHandler, this);
|
|
3135
3170
|
}
|
|
3136
|
-
if (Browser.isDevice && this.isFilterLayout()) {
|
|
3137
|
-
EventHandler.add(this.list, 'scroll', this.listScroll, this);
|
|
3138
|
-
}
|
|
3139
3171
|
if (!isNullOrUndefined(this.list)) {
|
|
3140
3172
|
this.unWireListEvents();
|
|
3141
3173
|
this.wireListEvents();
|
|
3142
3174
|
}
|
|
3143
|
-
|
|
3175
|
+
this.selectedElementID = this.selectedLI ? this.selectedLI.id : null;
|
|
3176
|
+
attributes(this.targetElement(), { 'aria-expanded': 'true', 'aria-owns': this.inputElement.id + '_options' });
|
|
3177
|
+
this.inputElement.setAttribute('aria-expanded', 'true');
|
|
3144
3178
|
const inputParent = this.isFiltering() ? this.filterInput.parentElement : this.inputWrapper.container;
|
|
3145
3179
|
addClass([inputParent], [dropDownListClasses.inputFocus]);
|
|
3146
3180
|
const animModel = { name: 'FadeIn', duration: 100 };
|
|
3147
3181
|
this.beforePopupOpen = true;
|
|
3148
3182
|
const popupInstance = this.popupObj;
|
|
3149
|
-
const eventArgs = { popup: popupInstance, cancel: false, animation: animModel };
|
|
3183
|
+
const eventArgs = { popup: popupInstance, event: e, cancel: false, animation: animModel };
|
|
3150
3184
|
this.trigger('open', eventArgs, (eventArgs) => {
|
|
3151
3185
|
if (!eventArgs.cancel) {
|
|
3152
|
-
|
|
3186
|
+
if (!isNullOrUndefined(this.inputWrapper)) {
|
|
3187
|
+
addClass([this.inputWrapper.container], [dropDownListClasses.iconAnimation]);
|
|
3188
|
+
}
|
|
3153
3189
|
this.renderReactTemplates();
|
|
3154
|
-
|
|
3190
|
+
if (!isNullOrUndefined(this.popupObj)) {
|
|
3191
|
+
this.popupObj.show(new Animation(eventArgs.animation), (this.zIndex === 1000) ? this.element : null);
|
|
3192
|
+
}
|
|
3155
3193
|
}
|
|
3156
3194
|
else {
|
|
3157
3195
|
this.beforePopupOpen = false;
|
|
@@ -3208,6 +3246,12 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
3208
3246
|
const actionList = this.actionCompleteData && this.actionCompleteData.ulElement &&
|
|
3209
3247
|
this.actionCompleteData.ulElement.querySelector('li');
|
|
3210
3248
|
const ulElement = this.list.querySelector('ul li');
|
|
3249
|
+
if (!isNullOrUndefined(this.ulElement) && !isNullOrUndefined(this.ulElement.getElementsByClassName('e-item-focus')[0])) {
|
|
3250
|
+
attributes(this.targetElement(), { 'aria-activedescendant': this.ulElement.getElementsByClassName('e-item-focus')[0].id });
|
|
3251
|
+
}
|
|
3252
|
+
else if (!isNullOrUndefined(this.ulElement) && !isNullOrUndefined(this.ulElement.getElementsByClassName('e-active')[0])) {
|
|
3253
|
+
attributes(this.targetElement(), { 'aria-activedescendant': this.ulElement.getElementsByClassName('e-active')[0].id });
|
|
3254
|
+
}
|
|
3211
3255
|
if (this.isFiltering() && this.itemTemplate && (this.element.tagName === this.getNgDirective()) &&
|
|
3212
3256
|
(actionList && ulElement && actionList.textContent !== ulElement.textContent) &&
|
|
3213
3257
|
this.element.tagName !== 'EJS-COMBOBOX') {
|
|
@@ -3363,9 +3407,6 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
3363
3407
|
this.filterInput.value = this.typedString = '';
|
|
3364
3408
|
this.searchLists(null);
|
|
3365
3409
|
}
|
|
3366
|
-
listScroll() {
|
|
3367
|
-
this.filterInput.blur();
|
|
3368
|
-
}
|
|
3369
3410
|
setEleWidth(width) {
|
|
3370
3411
|
if (!isNullOrUndefined(width)) {
|
|
3371
3412
|
if (typeof width === 'number') {
|
|
@@ -3392,7 +3433,6 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
3392
3433
|
}
|
|
3393
3434
|
if (Browser.isDevice && this.isFilterLayout()) {
|
|
3394
3435
|
removeClass([document.body, this.popupObj.element], dropDownListClasses.popupFullScreen);
|
|
3395
|
-
EventHandler.remove(this.list, 'scroll', this.listScroll);
|
|
3396
3436
|
}
|
|
3397
3437
|
if (this.isFilterLayout()) {
|
|
3398
3438
|
if (!Browser.isDevice) {
|
|
@@ -3405,14 +3445,19 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
3405
3445
|
EventHandler.remove(this.backIconElement, 'click', this.clickOnBackIcon);
|
|
3406
3446
|
EventHandler.remove(this.clearIconElement, 'click', this.clearText);
|
|
3407
3447
|
}
|
|
3408
|
-
|
|
3409
|
-
|
|
3410
|
-
|
|
3411
|
-
|
|
3412
|
-
|
|
3448
|
+
if (!isNullOrUndefined(this.filterInput)) {
|
|
3449
|
+
EventHandler.remove(this.filterInput, 'input', this.onInput);
|
|
3450
|
+
EventHandler.remove(this.filterInput, 'keyup', this.onFilterUp);
|
|
3451
|
+
EventHandler.remove(this.filterInput, 'keydown', this.onFilterDown);
|
|
3452
|
+
EventHandler.remove(this.filterInput, 'blur', this.onBlurHandler);
|
|
3453
|
+
EventHandler.remove(this.filterInput, 'paste', this.pasteHandler);
|
|
3454
|
+
}
|
|
3413
3455
|
this.filterInput = null;
|
|
3414
3456
|
}
|
|
3415
3457
|
attributes(this.targetElement(), { 'aria-expanded': 'false' });
|
|
3458
|
+
this.inputElement.setAttribute('aria-expanded', 'false');
|
|
3459
|
+
this.targetElement().removeAttribute('aria-owns');
|
|
3460
|
+
this.targetElement().removeAttribute('aria-activedescendant');
|
|
3416
3461
|
this.inputWrapper.container.classList.remove(dropDownListClasses.iconAnimation);
|
|
3417
3462
|
if (this.isFiltering()) {
|
|
3418
3463
|
this.actionCompleteData.isUpdated = false;
|
|
@@ -3465,14 +3510,15 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
3465
3510
|
if (this.element.tagName === 'INPUT') {
|
|
3466
3511
|
this.inputElement = this.element;
|
|
3467
3512
|
if (isNullOrUndefined(this.inputElement.getAttribute('role'))) {
|
|
3468
|
-
this.inputElement.setAttribute('role', '
|
|
3513
|
+
this.inputElement.setAttribute('role', 'combobox');
|
|
3469
3514
|
}
|
|
3470
3515
|
if (isNullOrUndefined(this.inputElement.getAttribute('type'))) {
|
|
3471
3516
|
this.inputElement.setAttribute('type', 'text');
|
|
3472
3517
|
}
|
|
3518
|
+
this.inputElement.setAttribute('aria-expanded', 'false');
|
|
3473
3519
|
}
|
|
3474
3520
|
else {
|
|
3475
|
-
this.inputElement = this.createElement('input', { attrs: { role: '
|
|
3521
|
+
this.inputElement = this.createElement('input', { attrs: { role: 'combobox', type: 'text' } });
|
|
3476
3522
|
if (this.element.tagName !== this.getNgDirective()) {
|
|
3477
3523
|
this.element.style.display = 'none';
|
|
3478
3524
|
}
|
|
@@ -3483,6 +3529,9 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
3483
3529
|
if (!isNullOrUndefined(this.cssClass) && this.cssClass !== '') {
|
|
3484
3530
|
updatedCssClassValues = (this.cssClass.replace(/\s+/g, ' ')).trim();
|
|
3485
3531
|
}
|
|
3532
|
+
if (!isNullOrUndefined(closest(this.element, "fieldset")) && closest(this.element, "fieldset").disabled) {
|
|
3533
|
+
this.enabled = false;
|
|
3534
|
+
}
|
|
3486
3535
|
this.inputWrapper = Input.createInput({
|
|
3487
3536
|
element: this.inputElement,
|
|
3488
3537
|
buttons: this.isPopupButton() ? [dropDownListClasses.icon] : null,
|
|
@@ -3511,6 +3560,10 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
3511
3560
|
this.setFields();
|
|
3512
3561
|
this.inputWrapper.container.style.width = formatUnit(this.width);
|
|
3513
3562
|
this.inputWrapper.container.classList.add('e-ddl');
|
|
3563
|
+
Input.calculateWidth(this.inputElement, this.inputWrapper.container);
|
|
3564
|
+
if (!isNullOrUndefined(this.inputWrapper.buttons[0]) && this.inputWrapper.container.getElementsByClassName('e-float-text-content')[0] && this.floatLabelType !== 'Never') {
|
|
3565
|
+
this.inputWrapper.container.getElementsByClassName('e-float-text-content')[0].classList.add('e-icon');
|
|
3566
|
+
}
|
|
3514
3567
|
this.wireEvent();
|
|
3515
3568
|
this.tabIndex = this.element.hasAttribute('tabindex') ? this.element.getAttribute('tabindex') : '0';
|
|
3516
3569
|
this.element.removeAttribute('tabindex');
|
|
@@ -3521,6 +3574,9 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
3521
3574
|
attributes(this.targetElement(), this.getAriaAttributes());
|
|
3522
3575
|
this.updateDataAttribute(this.htmlAttributes);
|
|
3523
3576
|
this.setHTMLAttributes();
|
|
3577
|
+
if (this.targetElement() === this.inputElement) {
|
|
3578
|
+
this.inputElement.removeAttribute('aria-labelledby');
|
|
3579
|
+
}
|
|
3524
3580
|
if (this.value !== null || this.activeIndex !== null || this.text !== null) {
|
|
3525
3581
|
this.initValue();
|
|
3526
3582
|
}
|
|
@@ -3530,6 +3586,7 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
3530
3586
|
this.text = isNullOrUndefined(this.value) ? null : selectElement.options[selectElement.selectedIndex].textContent;
|
|
3531
3587
|
this.initValue();
|
|
3532
3588
|
}
|
|
3589
|
+
this.setEnabled();
|
|
3533
3590
|
this.preventTabIndex(this.element);
|
|
3534
3591
|
if (!this.enabled) {
|
|
3535
3592
|
this.targetElement().tabIndex = -1;
|
|
@@ -3551,12 +3608,22 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
3551
3608
|
if (this.element.hasAttribute('data-val')) {
|
|
3552
3609
|
this.element.setAttribute('data-val', 'false');
|
|
3553
3610
|
}
|
|
3611
|
+
const floatLabelElement = this.inputWrapper.container.getElementsByClassName('e-float-text')[0];
|
|
3612
|
+
if (!isNullOrUndefined(this.element.id) && this.element.id !== '' && !isNullOrUndefined(floatLabelElement)) {
|
|
3613
|
+
floatLabelElement.id = 'label_' + this.element.id.replace(/ /g, '_');
|
|
3614
|
+
attributes(this.inputElement, { 'aria-labelledby': floatLabelElement.id });
|
|
3615
|
+
}
|
|
3554
3616
|
this.renderComplete();
|
|
3555
3617
|
}
|
|
3556
3618
|
setFooterTemplate(popupEle) {
|
|
3557
3619
|
let compiledString;
|
|
3558
3620
|
if (this.footer) {
|
|
3559
|
-
this.
|
|
3621
|
+
if (this.isReact) {
|
|
3622
|
+
this.clearTemplate(['footerTemplate']);
|
|
3623
|
+
}
|
|
3624
|
+
else {
|
|
3625
|
+
this.footer.innerHTML = '';
|
|
3626
|
+
}
|
|
3560
3627
|
}
|
|
3561
3628
|
else {
|
|
3562
3629
|
this.footer = this.createElement('div');
|
|
@@ -3604,6 +3671,14 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
3604
3671
|
const contentEle = popupEle.querySelector('div.e-content');
|
|
3605
3672
|
popupEle.insertBefore(this.header, contentEle);
|
|
3606
3673
|
}
|
|
3674
|
+
/**
|
|
3675
|
+
* Sets the enabled state to DropDownBase.
|
|
3676
|
+
*
|
|
3677
|
+
* @returns {void}
|
|
3678
|
+
*/
|
|
3679
|
+
setEnabled() {
|
|
3680
|
+
this.element.setAttribute('aria-disabled', (this.enabled) ? 'false' : 'true');
|
|
3681
|
+
}
|
|
3607
3682
|
setOldText(text) {
|
|
3608
3683
|
this.text = text;
|
|
3609
3684
|
}
|
|
@@ -3690,6 +3765,7 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
3690
3765
|
break;
|
|
3691
3766
|
case 'width':
|
|
3692
3767
|
this.setEleWidth(newProp.width);
|
|
3768
|
+
Input.calculateWidth(this.inputElement, this.inputWrapper.container);
|
|
3693
3769
|
break;
|
|
3694
3770
|
case 'placeholder':
|
|
3695
3771
|
Input.setPlaceholder(newProp.placeholder, this.inputElement);
|
|
@@ -3707,6 +3783,7 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
3707
3783
|
break;
|
|
3708
3784
|
case 'cssClass':
|
|
3709
3785
|
this.setCssClass(newProp.cssClass, oldProp.cssClass);
|
|
3786
|
+
Input.calculateWidth(this.inputElement, this.inputWrapper.container);
|
|
3710
3787
|
break;
|
|
3711
3788
|
case 'enableRtl':
|
|
3712
3789
|
this.setEnableRtl();
|
|
@@ -3747,6 +3824,9 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
3747
3824
|
}
|
|
3748
3825
|
});
|
|
3749
3826
|
}
|
|
3827
|
+
else if (this.getModuleName() === 'autocomplete') {
|
|
3828
|
+
this.setInputValue(newProp, oldProp);
|
|
3829
|
+
}
|
|
3750
3830
|
else {
|
|
3751
3831
|
this.setOldText(oldProp.text);
|
|
3752
3832
|
}
|
|
@@ -3788,6 +3868,9 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
3788
3868
|
}
|
|
3789
3869
|
});
|
|
3790
3870
|
}
|
|
3871
|
+
else if (this.getModuleName() === 'autocomplete') {
|
|
3872
|
+
this.setInputValue(newProp, oldProp);
|
|
3873
|
+
}
|
|
3791
3874
|
else {
|
|
3792
3875
|
this.setOldValue(oldProp.value);
|
|
3793
3876
|
}
|
|
@@ -3847,6 +3930,9 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
3847
3930
|
case 'floatLabelType':
|
|
3848
3931
|
Input.removeFloating(this.inputWrapper);
|
|
3849
3932
|
Input.addFloating(this.inputElement, newProp.floatLabelType, this.placeholder, this.createElement);
|
|
3933
|
+
if (!isNullOrUndefined(this.inputWrapper.buttons[0]) && this.inputWrapper.container.getElementsByClassName('e-float-text-overflow')[0] && this.floatLabelType !== 'Never') {
|
|
3934
|
+
this.inputWrapper.container.getElementsByClassName('e-float-text-overflow')[0].classList.add('e-icon');
|
|
3935
|
+
}
|
|
3850
3936
|
break;
|
|
3851
3937
|
case 'showClearButton':
|
|
3852
3938
|
Input.setClearButton(newProp.showClearButton, this.inputElement, this.inputWrapper, null, this.createElement);
|
|
@@ -3900,6 +3986,8 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
3900
3986
|
removeClass([this.inputWrapper.container], ['e-readonly']);
|
|
3901
3987
|
}
|
|
3902
3988
|
}
|
|
3989
|
+
setInputValue(newProp, oldProp) {
|
|
3990
|
+
}
|
|
3903
3991
|
setCssClass(newClass, oldClass) {
|
|
3904
3992
|
if (!isNullOrUndefined(oldClass)) {
|
|
3905
3993
|
oldClass = (oldClass.replace(/\s+/g, ' ')).trim();
|
|
@@ -3926,7 +4014,7 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
3926
4014
|
*
|
|
3927
4015
|
* @returns {void}
|
|
3928
4016
|
*/
|
|
3929
|
-
showPopup() {
|
|
4017
|
+
showPopup(e) {
|
|
3930
4018
|
if (!this.enabled) {
|
|
3931
4019
|
return;
|
|
3932
4020
|
}
|
|
@@ -3946,11 +4034,11 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
3946
4034
|
}
|
|
3947
4035
|
else if (isNullOrUndefined(this.list) || !isUndefined(this.list) && (this.list.classList.contains(dropDownBaseClasses.noData) ||
|
|
3948
4036
|
this.list.querySelectorAll('.' + dropDownBaseClasses.li).length <= 0)) {
|
|
3949
|
-
this.renderList();
|
|
4037
|
+
this.renderList(e);
|
|
3950
4038
|
}
|
|
3951
|
-
this.invokeRenderPopup();
|
|
4039
|
+
this.invokeRenderPopup(e);
|
|
3952
4040
|
}
|
|
3953
|
-
invokeRenderPopup() {
|
|
4041
|
+
invokeRenderPopup(e) {
|
|
3954
4042
|
if (Browser.isDevice && this.isFilterLayout()) {
|
|
3955
4043
|
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
3956
4044
|
const proxy = this;
|
|
@@ -3959,10 +4047,9 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
3959
4047
|
};
|
|
3960
4048
|
history.pushState({}, '');
|
|
3961
4049
|
}
|
|
3962
|
-
if (!isNullOrUndefined(this.list.children[0]) || this.list.classList.contains(dropDownBaseClasses.noData)) {
|
|
3963
|
-
this.renderPopup();
|
|
4050
|
+
if (!isNullOrUndefined(this.list) && (!isNullOrUndefined(this.list.children[0]) || this.list.classList.contains(dropDownBaseClasses.noData))) {
|
|
4051
|
+
this.renderPopup(e);
|
|
3964
4052
|
}
|
|
3965
|
-
attributes(this.targetElement(), { 'aria-activedescendant': this.selectedLI ? this.selectedLI.id : null });
|
|
3966
4053
|
}
|
|
3967
4054
|
renderHightSearch() {
|
|
3968
4055
|
// update high light search
|
|
@@ -3976,7 +4063,9 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
3976
4063
|
hidePopup(e) {
|
|
3977
4064
|
/* eslint-enable valid-jsdoc, jsdoc/require-param */
|
|
3978
4065
|
if (this.isEscapeKey && this.getModuleName() === 'dropdownlist') {
|
|
3979
|
-
|
|
4066
|
+
if (!isNullOrUndefined(this.inputElement)) {
|
|
4067
|
+
Input.setValue(this.text, this.inputElement, this.floatLabelType, this.showClearButton);
|
|
4068
|
+
}
|
|
3980
4069
|
this.isEscapeKey = false;
|
|
3981
4070
|
if (!isNullOrUndefined(this.index)) {
|
|
3982
4071
|
const element = this.findListElement(this.ulElement, 'li', 'data-value', this.value);
|
|
@@ -4026,6 +4115,7 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
4026
4115
|
}
|
|
4027
4116
|
addClass([this.inputWrapper.container], [dropDownListClasses.inputFocus]);
|
|
4028
4117
|
this.onFocus(e);
|
|
4118
|
+
Input.calculateWidth(this.inputElement, this.inputWrapper.container);
|
|
4029
4119
|
}
|
|
4030
4120
|
/**
|
|
4031
4121
|
* Moves the focus from the component if the component is already focused.
|
|
@@ -4043,6 +4133,7 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
4043
4133
|
this.targetElement().blur();
|
|
4044
4134
|
}
|
|
4045
4135
|
removeClass([this.inputWrapper.container], [dropDownListClasses.inputFocus]);
|
|
4136
|
+
Input.calculateWidth(this.inputElement, this.inputWrapper.container);
|
|
4046
4137
|
}
|
|
4047
4138
|
/**
|
|
4048
4139
|
* Removes the component from the DOM and detaches all its related event handlers. Also it removes the attributes and classes.
|
|
@@ -4066,10 +4157,9 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
4066
4157
|
return;
|
|
4067
4158
|
}
|
|
4068
4159
|
if (this.inputElement) {
|
|
4069
|
-
const attrArray = ['readonly', 'aria-disabled', 'aria-
|
|
4070
|
-
'
|
|
4071
|
-
'aria-
|
|
4072
|
-
'autocapitalize', 'spellcheck', 'aria-autocomplete', 'aria-live', 'aria-describedby', 'aria-label'];
|
|
4160
|
+
const attrArray = ['readonly', 'aria-disabled', 'placeholder', 'aria-labelledby',
|
|
4161
|
+
'aria-expanded', 'autocomplete', 'aria-readonly', 'autocapitalize',
|
|
4162
|
+
'spellcheck', 'aria-autocomplete', 'aria-live', 'aria-describedby', 'aria-label'];
|
|
4073
4163
|
for (let i = 0; i < attrArray.length; i++) {
|
|
4074
4164
|
this.inputElement.removeAttribute(attrArray[i]);
|
|
4075
4165
|
}
|
|
@@ -4085,6 +4175,21 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
4085
4175
|
this.inputWrapper.container.parentElement.insertBefore(this.element, this.inputWrapper.container);
|
|
4086
4176
|
detach(this.inputWrapper.container);
|
|
4087
4177
|
}
|
|
4178
|
+
this.hiddenElement = null;
|
|
4179
|
+
this.inputWrapper = null;
|
|
4180
|
+
this.keyboardModule = null;
|
|
4181
|
+
this.ulElement = null;
|
|
4182
|
+
this.list = null;
|
|
4183
|
+
this.popupObj = null;
|
|
4184
|
+
this.rippleFun = null;
|
|
4185
|
+
this.selectedLI = null;
|
|
4186
|
+
this.liCollections = null;
|
|
4187
|
+
this.item = null;
|
|
4188
|
+
this.inputWrapper = null;
|
|
4189
|
+
this.footer = null;
|
|
4190
|
+
this.header = null;
|
|
4191
|
+
this.previousSelectedLI = null;
|
|
4192
|
+
this.valueTempElement = null;
|
|
4088
4193
|
super.destroy();
|
|
4089
4194
|
}
|
|
4090
4195
|
/* eslint-disable valid-jsdoc, jsdoc/require-returns-description */
|
|
@@ -4127,6 +4232,12 @@ __decorate$1([
|
|
|
4127
4232
|
__decorate$1([
|
|
4128
4233
|
Property('100%')
|
|
4129
4234
|
], DropDownList.prototype, "width", void 0);
|
|
4235
|
+
__decorate$1([
|
|
4236
|
+
Property(true)
|
|
4237
|
+
], DropDownList.prototype, "enabled", void 0);
|
|
4238
|
+
__decorate$1([
|
|
4239
|
+
Property(false)
|
|
4240
|
+
], DropDownList.prototype, "enablePersistence", void 0);
|
|
4130
4241
|
__decorate$1([
|
|
4131
4242
|
Property('300px')
|
|
4132
4243
|
], DropDownList.prototype, "popupHeight", void 0);
|
|
@@ -4288,6 +4399,9 @@ __decorate$2([
|
|
|
4288
4399
|
__decorate$2([
|
|
4289
4400
|
Property(null)
|
|
4290
4401
|
], Fields.prototype, "query", void 0);
|
|
4402
|
+
__decorate$2([
|
|
4403
|
+
Property('selectable')
|
|
4404
|
+
], Fields.prototype, "selectable", void 0);
|
|
4291
4405
|
__decorate$2([
|
|
4292
4406
|
Property('selected')
|
|
4293
4407
|
], Fields.prototype, "selected", void 0);
|
|
@@ -4336,6 +4450,8 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
4336
4450
|
this.selectedData = [];
|
|
4337
4451
|
this.filterDelayTime = 300;
|
|
4338
4452
|
this.isClicked = false;
|
|
4453
|
+
// Specifies if the checkAll method has been called
|
|
4454
|
+
this.isCheckAllCalled = false;
|
|
4339
4455
|
}
|
|
4340
4456
|
/**
|
|
4341
4457
|
* Get the properties to be maintained in the persisted state.
|
|
@@ -4463,7 +4579,7 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
4463
4579
|
this.updateDataAttribute();
|
|
4464
4580
|
this.setHTMLAttributes();
|
|
4465
4581
|
this.setAttributes();
|
|
4466
|
-
this.popupDiv = this.createElement('div', { className: CONTENT
|
|
4582
|
+
this.popupDiv = this.createElement('div', { className: CONTENT });
|
|
4467
4583
|
this.popupDiv.classList.add(DROPDOWN);
|
|
4468
4584
|
this.tree = this.createElement('div', { id: this.element.id + '_tree' });
|
|
4469
4585
|
this.popupDiv.appendChild(this.tree);
|
|
@@ -5083,7 +5199,12 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
5083
5199
|
temp = this.getOverflowVal(index);
|
|
5084
5200
|
data += temp;
|
|
5085
5201
|
temp = this.overFlowWrapper.innerHTML;
|
|
5086
|
-
this.
|
|
5202
|
+
if (this.enableHtmlSanitizer) {
|
|
5203
|
+
this.overFlowWrapper.innerText = data;
|
|
5204
|
+
}
|
|
5205
|
+
else {
|
|
5206
|
+
this.overFlowWrapper.innerHTML = data;
|
|
5207
|
+
}
|
|
5087
5208
|
wrapperleng = this.overFlowWrapper.offsetWidth;
|
|
5088
5209
|
overAllContainer = this.inputWrapper.offsetWidth;
|
|
5089
5210
|
if ((wrapperleng + downIconWidth + this.clearIconWidth) > overAllContainer) {
|
|
@@ -5253,7 +5374,7 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
5253
5374
|
if (isValid && this.value !== null && (this.value && this.value.length !== 0)) {
|
|
5254
5375
|
addClass([this.inputEle], CHIP_INPUT);
|
|
5255
5376
|
}
|
|
5256
|
-
else if (this.value === null || (this.value && this.value.length === 0)) {
|
|
5377
|
+
else if (this.value === null || (this.value && this.value.length === 0) || this.chipWrapper) {
|
|
5257
5378
|
addClass([this.chipWrapper], HIDEICON);
|
|
5258
5379
|
}
|
|
5259
5380
|
}
|
|
@@ -5308,6 +5429,7 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
5308
5429
|
frameSpan.classList.add(CHECK);
|
|
5309
5430
|
ariaState = 'true';
|
|
5310
5431
|
if (!this.isReverseUpdate) {
|
|
5432
|
+
this.isCheckAllCalled = true;
|
|
5311
5433
|
this.treeObj.checkAll();
|
|
5312
5434
|
if (!this.changeOnBlur) {
|
|
5313
5435
|
this.triggerChangeEvent(e);
|
|
@@ -5608,10 +5730,12 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
5608
5730
|
nodeSelected: this.onNodeSelected.bind(this),
|
|
5609
5731
|
nodeChecked: this.onNodeChecked.bind(this),
|
|
5610
5732
|
nodeChecking: this.beforeCheck.bind(this),
|
|
5733
|
+
nodeExpanded: this.onNodeExpanded.bind(this),
|
|
5611
5734
|
actionFailure: this.onActionFailure.bind(this),
|
|
5612
5735
|
nodeClicked: this.onNodeClicked.bind(this),
|
|
5613
5736
|
dataBound: this.OnDataBound.bind(this),
|
|
5614
5737
|
allowMultiSelection: this.allowMultiSelection,
|
|
5738
|
+
enableHtmlSanitizer: this.enableHtmlSanitizer,
|
|
5615
5739
|
showCheckBox: this.showCheckBox,
|
|
5616
5740
|
autoCheck: this.treeSettings.autoCheck,
|
|
5617
5741
|
sortOrder: this.sortOrder,
|
|
@@ -5713,7 +5837,7 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
5713
5837
|
const height = Math.round(this.header.getBoundingClientRect().height);
|
|
5714
5838
|
popupHeight = formatUnit(parseInt(popupHeight, 10) - height + 'px');
|
|
5715
5839
|
}
|
|
5716
|
-
if (this.showCheckBox && this.showSelectAll) {
|
|
5840
|
+
if (this.showCheckBox && this.showSelectAll && (!this.popupDiv.classList.contains(NODATA))) {
|
|
5717
5841
|
const height = Math.round(this.checkAllParent.getBoundingClientRect().height);
|
|
5718
5842
|
popupHeight = formatUnit(parseInt(popupHeight, 10) - height + 'px');
|
|
5719
5843
|
}
|
|
@@ -5795,14 +5919,14 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
5795
5919
|
const isFooter = closest(target, '.' + FOOTER);
|
|
5796
5920
|
const isScroller = target.classList.contains(DROPDOWN) ? true :
|
|
5797
5921
|
(matches(target, '.e-ddt .e-popup') || matches(target, '.e-ddt .e-treeview'));
|
|
5798
|
-
if ((this.isPopupOpen && (this.inputWrapper.contains(target) || isTree ||
|
|
5922
|
+
if ((this.isPopupOpen && (this.inputWrapper.contains(target) || isTree || isScroller || isHeader || isFooter)) ||
|
|
5799
5923
|
((this.allowMultiSelection || this.showCheckBox) && (this.isPopupOpen && target.classList.contains(CHIP_CLOSE) ||
|
|
5800
5924
|
(this.isPopupOpen && (target.classList.contains(CHECKALLPARENT) || target.classList.contains(ALLTEXT)
|
|
5801
5925
|
|| target.classList.contains(CHECKBOXFRAME)))))) {
|
|
5802
5926
|
this.isDocumentClick = false;
|
|
5803
5927
|
e.preventDefault();
|
|
5804
5928
|
}
|
|
5805
|
-
else if (!this.inputWrapper.contains(target) && this.inputFocus) {
|
|
5929
|
+
else if (!this.inputWrapper.contains(target) && this.inputFocus && !isFilter) {
|
|
5806
5930
|
this.focusOut(e);
|
|
5807
5931
|
}
|
|
5808
5932
|
}
|
|
@@ -5835,6 +5959,9 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
5835
5959
|
}
|
|
5836
5960
|
const eventArgs = { data: args.data };
|
|
5837
5961
|
this.trigger('dataBound', eventArgs);
|
|
5962
|
+
if (this.filterObj === null) {
|
|
5963
|
+
this.isFilteredData = false;
|
|
5964
|
+
}
|
|
5838
5965
|
if (this.isFilteredData) {
|
|
5839
5966
|
this.treeObj.expandAll();
|
|
5840
5967
|
}
|
|
@@ -5902,7 +6029,7 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
5902
6029
|
dataSource: fields.dataSource, value: fields.value, text: fields.text, parentValue: fields.parentValue,
|
|
5903
6030
|
child: this.cloneChildField(fields.child), hasChildren: fields.hasChildren, expanded: fields.expanded,
|
|
5904
6031
|
iconCss: fields.iconCss, imageUrl: fields.imageUrl, htmlAttributes: fields.htmlAttributes, query: fields.query,
|
|
5905
|
-
selected: fields.selected, tableName: fields.tableName, tooltip: fields.tooltip
|
|
6032
|
+
selected: fields.selected, selectable: fields.selectable, tableName: fields.tableName, tooltip: fields.tooltip
|
|
5906
6033
|
};
|
|
5907
6034
|
return clonedField;
|
|
5908
6035
|
}
|
|
@@ -5915,7 +6042,7 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
5915
6042
|
dataSource: fields.dataSource, value: fields.value, text: fields.text, parentValue: fields.parentValue,
|
|
5916
6043
|
child: (fields.child ? this.cloneChildField(fields.child) : null), hasChildren: fields.hasChildren,
|
|
5917
6044
|
expanded: fields.expanded, iconCss: fields.iconCss, imageUrl: fields.imageUrl, htmlAttributes: fields.htmlAttributes,
|
|
5918
|
-
query: fields.query, selected: fields.selected, tableName: fields.tableName, tooltip: fields.tooltip
|
|
6045
|
+
query: fields.query, selected: fields.selected, selectable: fields.selectable, tableName: fields.tableName, tooltip: fields.tooltip
|
|
5919
6046
|
};
|
|
5920
6047
|
return clonedField;
|
|
5921
6048
|
}
|
|
@@ -5925,7 +6052,7 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
5925
6052
|
dataSource: fields.dataSource, id: fields.value, text: fields.text, parentID: fields.parentValue,
|
|
5926
6053
|
child: this.getTreeChildren(fields.child), hasChildren: fields.hasChildren, expanded: fields.expanded,
|
|
5927
6054
|
iconCss: fields.iconCss, imageUrl: fields.imageUrl, isChecked: fields.selected,
|
|
5928
|
-
htmlAttributes: fields.htmlAttributes, query: fields.query, selected: fields.selected,
|
|
6055
|
+
htmlAttributes: fields.htmlAttributes, query: fields.query, selectable: fields.selectable, selected: fields.selected,
|
|
5929
6056
|
tableName: fields.tableName, tooltip: fields.tooltip
|
|
5930
6057
|
};
|
|
5931
6058
|
return treeFields;
|
|
@@ -6103,13 +6230,14 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
6103
6230
|
const nodes = this.treeObj.element.querySelectorAll('li');
|
|
6104
6231
|
const checkedNodes = this.treeObj.element.querySelectorAll('li .e-checkbox-wrapper[aria-checked=true]');
|
|
6105
6232
|
const wrap = closest(this.checkBoxElement, '.' + CHECKBOXWRAP);
|
|
6106
|
-
if (wrap && args.action === 'uncheck') {
|
|
6233
|
+
if (wrap && args.action === 'uncheck' && (args.isInteracted || checkedNodes.length === 0)) {
|
|
6107
6234
|
this.isReverseUpdate = true;
|
|
6108
6235
|
this.changeState(wrap, 'uncheck');
|
|
6109
6236
|
this.isReverseUpdate = false;
|
|
6110
6237
|
}
|
|
6111
|
-
else if (wrap && args.action === 'check' && checkedNodes.length === nodes.length) {
|
|
6238
|
+
else if (wrap && args.action === 'check' && checkedNodes.length === nodes.length && this.isCheckAllCalled) {
|
|
6112
6239
|
this.isReverseUpdate = true;
|
|
6240
|
+
this.isCheckAllCalled = false;
|
|
6113
6241
|
this.changeState(wrap, 'check');
|
|
6114
6242
|
this.isReverseUpdate = false;
|
|
6115
6243
|
}
|
|
@@ -6120,6 +6248,13 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
6120
6248
|
this.oldValue = this.value ? this.value.slice() : this.value;
|
|
6121
6249
|
}
|
|
6122
6250
|
}
|
|
6251
|
+
onNodeExpanded(args) {
|
|
6252
|
+
if (this.hasTemplate && this.portals) {
|
|
6253
|
+
this.portals = [].concat(this.treeObj.portals);
|
|
6254
|
+
/* eslint-enable */
|
|
6255
|
+
this.renderReactTemplates();
|
|
6256
|
+
}
|
|
6257
|
+
}
|
|
6123
6258
|
updateClearButton(state) {
|
|
6124
6259
|
if (state) {
|
|
6125
6260
|
if (!this.inputWrapper.contains(this.overAllClear)) {
|
|
@@ -6420,7 +6555,12 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
6420
6555
|
});
|
|
6421
6556
|
const chipContent = this.createElement('span', { className: CHIP_CONTENT });
|
|
6422
6557
|
const chipClose = this.createElement('span', { className: CHIP_CLOSE + ' ' + ICONS });
|
|
6423
|
-
|
|
6558
|
+
if (this.enableHtmlSanitizer) {
|
|
6559
|
+
chipContent.innerText = text;
|
|
6560
|
+
}
|
|
6561
|
+
else {
|
|
6562
|
+
chipContent.innerHTML = text;
|
|
6563
|
+
}
|
|
6424
6564
|
chip.appendChild(chipContent);
|
|
6425
6565
|
this.chipCollection.appendChild(chip);
|
|
6426
6566
|
if (this.showClearButton) {
|
|
@@ -6616,6 +6756,7 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
6616
6756
|
selectAllItems(state) {
|
|
6617
6757
|
if (this.showCheckBox) {
|
|
6618
6758
|
if (state) {
|
|
6759
|
+
this.isCheckAllCalled = true;
|
|
6619
6760
|
this.treeObj.checkAll();
|
|
6620
6761
|
}
|
|
6621
6762
|
else {
|
|
@@ -6710,8 +6851,6 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
6710
6851
|
}
|
|
6711
6852
|
else {
|
|
6712
6853
|
this.noRecord = this.createElement('div');
|
|
6713
|
-
addClass([this.noRecord], NODATACONTAINER);
|
|
6714
|
-
prepend([this.noRecord], this.popupDiv);
|
|
6715
6854
|
}
|
|
6716
6855
|
if (this.noRecordsTemplate !== 'No Records Found' || this.actionFailureTemplate !== 'The Request Failed') {
|
|
6717
6856
|
const template = actionFailure ? this.actionFailureTemplate : this.noRecordsTemplate;
|
|
@@ -6723,6 +6862,8 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
6723
6862
|
if (tempArr) {
|
|
6724
6863
|
tempArr = Array.prototype.slice.call(tempArr);
|
|
6725
6864
|
append(tempArr, this.noRecord);
|
|
6865
|
+
addClass([this.noRecord], NODATACONTAINER);
|
|
6866
|
+
prepend([this.noRecord], this.popupDiv);
|
|
6726
6867
|
}
|
|
6727
6868
|
}
|
|
6728
6869
|
else {
|
|
@@ -6731,6 +6872,8 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
6731
6872
|
this.l10n = new L10n(this.getLocaleName(), l10nLocale, this.locale);
|
|
6732
6873
|
this.noRecord.innerHTML = actionFailure ?
|
|
6733
6874
|
this.l10n.getConstant('actionFailureTemplate') : this.l10n.getConstant('noRecordsTemplate');
|
|
6875
|
+
addClass([this.noRecord], NODATACONTAINER);
|
|
6876
|
+
prepend([this.noRecord], this.popupDiv);
|
|
6734
6877
|
}
|
|
6735
6878
|
}
|
|
6736
6879
|
updateRecordTemplate(action) {
|
|
@@ -7242,6 +7385,9 @@ __decorate$2([
|
|
|
7242
7385
|
__decorate$2([
|
|
7243
7386
|
Property(false)
|
|
7244
7387
|
], DropDownTree.prototype, "showCheckBox", void 0);
|
|
7388
|
+
__decorate$2([
|
|
7389
|
+
Property(false)
|
|
7390
|
+
], DropDownTree.prototype, "enableHtmlSanitizer", void 0);
|
|
7245
7391
|
__decorate$2([
|
|
7246
7392
|
Property(true)
|
|
7247
7393
|
], DropDownTree.prototype, "showClearButton", void 0);
|
|
@@ -7479,15 +7625,12 @@ let ComboBox = class ComboBox extends DropDownList {
|
|
|
7479
7625
|
}
|
|
7480
7626
|
getAriaAttributes() {
|
|
7481
7627
|
const ariaAttributes = {
|
|
7482
|
-
'aria-owns': this.element.id + '_options',
|
|
7483
7628
|
'role': 'combobox',
|
|
7484
7629
|
'aria-autocomplete': 'both',
|
|
7485
7630
|
'aria-labelledby': this.hiddenElement.id,
|
|
7486
|
-
'aria-hasPopup': 'true',
|
|
7487
7631
|
'aria-expanded': 'false',
|
|
7488
7632
|
'aria-readonly': this.readonly.toString(),
|
|
7489
7633
|
'autocomplete': 'off',
|
|
7490
|
-
'autocorrect': 'off',
|
|
7491
7634
|
'autocapitalize': 'off',
|
|
7492
7635
|
'spellcheck': 'false'
|
|
7493
7636
|
};
|
|
@@ -7529,7 +7672,7 @@ let ComboBox = class ComboBox extends DropDownList {
|
|
|
7529
7672
|
}
|
|
7530
7673
|
getFocusElement() {
|
|
7531
7674
|
const dataItem = this.isSelectCustom ? { text: '' } : this.getItemData();
|
|
7532
|
-
const selected = this.list.querySelector('.' + dropDownListClasses.selected);
|
|
7675
|
+
const selected = !isNullOrUndefined(this.list) ? this.list.querySelector('.' + dropDownListClasses.selected) : this.list;
|
|
7533
7676
|
const isSelected = dataItem.text === this.inputElement.value && !isNullOrUndefined(selected);
|
|
7534
7677
|
if (isSelected) {
|
|
7535
7678
|
return selected;
|
|
@@ -7537,8 +7680,10 @@ let ComboBox = class ComboBox extends DropDownList {
|
|
|
7537
7680
|
if ((Browser.isDevice && !this.isDropDownClick || !Browser.isDevice) &&
|
|
7538
7681
|
!isNullOrUndefined(this.liCollections) && this.liCollections.length > 0) {
|
|
7539
7682
|
const inputValue = this.inputElement.value;
|
|
7540
|
-
const
|
|
7541
|
-
const
|
|
7683
|
+
const dataSource = this.sortedData;
|
|
7684
|
+
const type = this.typeOfData(dataSource).typeof;
|
|
7685
|
+
const activeItem = Search(inputValue, this.liCollections, this.filterType, true, dataSource, this.fields, type);
|
|
7686
|
+
var activeElement = activeItem.item;
|
|
7542
7687
|
if (!isNullOrUndefined(activeElement)) {
|
|
7543
7688
|
const count = this.getIndexByValue(activeElement.getAttribute('data-value')) - 1;
|
|
7544
7689
|
const height = parseInt(getComputedStyle(this.liCollections[0], null).getPropertyValue('height'), 10);
|
|
@@ -7578,7 +7723,7 @@ let ComboBox = class ComboBox extends DropDownList {
|
|
|
7578
7723
|
this.itemData = this.getDataByValue(this.value);
|
|
7579
7724
|
const dataItem = this.getItemData();
|
|
7580
7725
|
if (!(this.allowCustom && isNullOrUndefined(dataItem.value) && isNullOrUndefined(dataItem.text))) {
|
|
7581
|
-
this.setProperties({ 'value': dataItem.value
|
|
7726
|
+
this.setProperties({ 'value': dataItem.value }, !this.allowCustom);
|
|
7582
7727
|
}
|
|
7583
7728
|
}
|
|
7584
7729
|
/**
|
|
@@ -7687,9 +7832,11 @@ let ComboBox = class ComboBox extends DropDownList {
|
|
|
7687
7832
|
}
|
|
7688
7833
|
else if (this.inputElement.value === '') {
|
|
7689
7834
|
this.activeIndex = null;
|
|
7690
|
-
this.list
|
|
7691
|
-
|
|
7692
|
-
|
|
7835
|
+
if (!isNullOrUndefined(this.list)) {
|
|
7836
|
+
this.list.scrollTop = 0;
|
|
7837
|
+
const focusItem = this.list.querySelector('.' + dropDownListClasses.li);
|
|
7838
|
+
this.setHoverList(focusItem);
|
|
7839
|
+
}
|
|
7693
7840
|
}
|
|
7694
7841
|
else {
|
|
7695
7842
|
this.activeIndex = null;
|
|
@@ -7700,7 +7847,7 @@ let ComboBox = class ComboBox extends DropDownList {
|
|
|
7700
7847
|
}
|
|
7701
7848
|
}
|
|
7702
7849
|
incrementalSearch(e) {
|
|
7703
|
-
this.showPopup();
|
|
7850
|
+
this.showPopup(e);
|
|
7704
7851
|
if (!isNullOrUndefined(this.listData)) {
|
|
7705
7852
|
this.inlineSearch(e);
|
|
7706
7853
|
e.preventDefault();
|
|
@@ -7785,6 +7932,7 @@ let ComboBox = class ComboBox extends DropDownList {
|
|
|
7785
7932
|
this.preventFocus = false;
|
|
7786
7933
|
}
|
|
7787
7934
|
this.onFocus(e);
|
|
7935
|
+
Input.calculateWidth(this.inputElement, this.inputWrapper.container);
|
|
7788
7936
|
}
|
|
7789
7937
|
dropDownClick(e) {
|
|
7790
7938
|
e.preventDefault();
|
|
@@ -7934,7 +8082,7 @@ let ComboBox = class ComboBox extends DropDownList {
|
|
|
7934
8082
|
* Adds a new item to the combobox popup list. By default, new item appends to the list as the last item,
|
|
7935
8083
|
* but you can insert based on the index parameter.
|
|
7936
8084
|
*
|
|
7937
|
-
* @param
|
|
8085
|
+
* @param { Object[] } items - Specifies an array of JSON data or a JSON data.
|
|
7938
8086
|
* @param { number } itemIndex - Specifies the index to place the newly added item in the popup list.
|
|
7939
8087
|
* @returns {void}
|
|
7940
8088
|
* @deprecated
|
|
@@ -7945,9 +8093,9 @@ let ComboBox = class ComboBox extends DropDownList {
|
|
|
7945
8093
|
/**
|
|
7946
8094
|
* To filter the data from given data source by using query
|
|
7947
8095
|
*
|
|
7948
|
-
* @param
|
|
7949
|
-
* @param
|
|
7950
|
-
* @param
|
|
8096
|
+
* @param {Object[] | DataManager } dataSource - Set the data source to filter.
|
|
8097
|
+
* @param {Query} query - Specify the query to filter the data.
|
|
8098
|
+
* @param {FieldSettingsModel} fields - Specify the fields to map the column in the data table.
|
|
7951
8099
|
* @returns {void}
|
|
7952
8100
|
* @deprecated
|
|
7953
8101
|
*/
|
|
@@ -7960,8 +8108,8 @@ let ComboBox = class ComboBox extends DropDownList {
|
|
|
7960
8108
|
* @returns {void}
|
|
7961
8109
|
* @deprecated
|
|
7962
8110
|
*/
|
|
7963
|
-
showPopup() {
|
|
7964
|
-
super.showPopup();
|
|
8111
|
+
showPopup(e) {
|
|
8112
|
+
super.showPopup(e);
|
|
7965
8113
|
}
|
|
7966
8114
|
/* eslint-disable valid-jsdoc, jsdoc/require-param */
|
|
7967
8115
|
/**
|
|
@@ -7984,7 +8132,7 @@ let ComboBox = class ComboBox extends DropDownList {
|
|
|
7984
8132
|
this.removeFillSelection();
|
|
7985
8133
|
}
|
|
7986
8134
|
const dataItem = this.isSelectCustom ? { text: '' } : this.getItemData();
|
|
7987
|
-
const selected = this.list.querySelector('.' + dropDownListClasses.selected);
|
|
8135
|
+
const selected = !isNullOrUndefined(this.list) ? this.list.querySelector('.' + dropDownListClasses.selected) : null;
|
|
7988
8136
|
if (this.inputElement && dataItem.text === this.inputElement.value && !isNullOrUndefined(selected)) {
|
|
7989
8137
|
if (this.isSelected) {
|
|
7990
8138
|
this.onChangeEvent(e);
|
|
@@ -7994,10 +8142,12 @@ let ComboBox = class ComboBox extends DropDownList {
|
|
|
7994
8142
|
return;
|
|
7995
8143
|
}
|
|
7996
8144
|
if (this.getModuleName() === 'combobox' && this.inputElement.value.trim() !== '') {
|
|
7997
|
-
const
|
|
8145
|
+
const dataSource = this.sortedData;
|
|
8146
|
+
const type = this.typeOfData(dataSource).typeof;
|
|
8147
|
+
const searchItem = Search(this.inputElement.value, this.liCollections, 'Equal', true, dataSource, this.fields, type);
|
|
7998
8148
|
this.selectedLI = searchItem.item;
|
|
7999
8149
|
if (isNullOrUndefined(searchItem.index)) {
|
|
8000
|
-
searchItem.index = Search(this.inputElement.value, this.liCollections, 'StartsWith', true).index;
|
|
8150
|
+
searchItem.index = Search(this.inputElement.value, this.liCollections, 'StartsWith', true, dataSource, this.fields, type).index;
|
|
8001
8151
|
}
|
|
8002
8152
|
this.activeIndex = searchItem.index;
|
|
8003
8153
|
if (!isNullOrUndefined(this.selectedLI)) {
|
|
@@ -8236,13 +8386,13 @@ let AutoComplete = class AutoComplete extends ComboBox {
|
|
|
8236
8386
|
this.isTyped = true;
|
|
8237
8387
|
this.isDataFetched = this.isSelectCustom = false;
|
|
8238
8388
|
if (isNullOrUndefined(this.list)) {
|
|
8239
|
-
super.renderList(true);
|
|
8389
|
+
super.renderList(e, true);
|
|
8240
8390
|
}
|
|
8241
8391
|
this.queryString = this.filterInput.value;
|
|
8242
8392
|
if (e.type !== 'mousedown' && (e.keyCode === 40 || e.keyCode === 38)) {
|
|
8243
8393
|
this.queryString = this.queryString === '' ? null : this.queryString;
|
|
8244
8394
|
this.beforePopupOpen = true;
|
|
8245
|
-
this.resetList(this.dataSource, this.fields);
|
|
8395
|
+
this.resetList(this.dataSource, this.fields, null, e);
|
|
8246
8396
|
return;
|
|
8247
8397
|
}
|
|
8248
8398
|
this.isSelected = false;
|
|
@@ -8262,16 +8412,16 @@ let AutoComplete = class AutoComplete extends ComboBox {
|
|
|
8262
8412
|
this.trigger('filtering', eventArgs, (eventArgs) => {
|
|
8263
8413
|
if (!eventArgs.cancel && !this.isFiltered && !eventArgs.preventDefaultAction) {
|
|
8264
8414
|
this.searchList = true;
|
|
8265
|
-
this.filterAction(this.dataSource, null, this.fields);
|
|
8415
|
+
this.filterAction(this.dataSource, null, this.fields, e);
|
|
8266
8416
|
}
|
|
8267
8417
|
});
|
|
8268
8418
|
}
|
|
8269
8419
|
/**
|
|
8270
8420
|
* To filter the data from given data source by using query
|
|
8271
8421
|
*
|
|
8272
|
-
* @param
|
|
8273
|
-
* @param
|
|
8274
|
-
* @param
|
|
8422
|
+
* @param {Object[] | DataManager } dataSource - Set the data source to filter.
|
|
8423
|
+
* @param {Query} query - Specify the query to filter the data.
|
|
8424
|
+
* @param {FieldSettingsModel} fields - Specify the fields to map the column in the data table.
|
|
8275
8425
|
* @returns {void}
|
|
8276
8426
|
* @deprecated
|
|
8277
8427
|
*/
|
|
@@ -8279,13 +8429,13 @@ let AutoComplete = class AutoComplete extends ComboBox {
|
|
|
8279
8429
|
this.isFiltered = true;
|
|
8280
8430
|
this.filterAction(dataSource, query, fields);
|
|
8281
8431
|
}
|
|
8282
|
-
filterAction(dataSource, query, fields) {
|
|
8432
|
+
filterAction(dataSource, query, fields, e) {
|
|
8283
8433
|
this.beforePopupOpen = true;
|
|
8284
8434
|
if (this.queryString !== '' && (this.queryString.length >= this.minLength)) {
|
|
8285
|
-
this.resetList(dataSource, fields, query);
|
|
8435
|
+
this.resetList(dataSource, fields, query, e);
|
|
8286
8436
|
}
|
|
8287
8437
|
else {
|
|
8288
|
-
this.hidePopup();
|
|
8438
|
+
this.hidePopup(e);
|
|
8289
8439
|
this.beforePopupOpen = false;
|
|
8290
8440
|
}
|
|
8291
8441
|
this.renderReactTemplates();
|
|
@@ -8311,7 +8461,9 @@ let AutoComplete = class AutoComplete extends ComboBox {
|
|
|
8311
8461
|
postBackAction() {
|
|
8312
8462
|
if (this.autofill && !isNullOrUndefined(this.liCollections[0]) && this.searchList) {
|
|
8313
8463
|
const items = [this.liCollections[0]];
|
|
8314
|
-
const
|
|
8464
|
+
const dataSource = this.listData;
|
|
8465
|
+
const type = this.typeOfData(dataSource).typeof;
|
|
8466
|
+
const searchItem = Search(this.inputElement.value, items, 'StartsWith', this.ignoreCase, dataSource, this.fields, type);
|
|
8315
8467
|
this.searchList = false;
|
|
8316
8468
|
if (!isNullOrUndefined(searchItem.item)) {
|
|
8317
8469
|
super.setAutoFill(this.liCollections[0], true);
|
|
@@ -8320,6 +8472,7 @@ let AutoComplete = class AutoComplete extends ComboBox {
|
|
|
8320
8472
|
}
|
|
8321
8473
|
setSelection(li, e) {
|
|
8322
8474
|
if (!this.isValidLI(li)) {
|
|
8475
|
+
this.selectedLI = li;
|
|
8323
8476
|
return;
|
|
8324
8477
|
}
|
|
8325
8478
|
if (!isNullOrUndefined(e) && e.type === 'keydown' && e.action !== 'enter'
|
|
@@ -8335,7 +8488,6 @@ let AutoComplete = class AutoComplete extends ComboBox {
|
|
|
8335
8488
|
e.action === 'home' || e.action === 'end' || e.action === 'pageUp' || e.action === 'pageDown');
|
|
8336
8489
|
super.setAutoFill(li, isKeyNavigate);
|
|
8337
8490
|
}
|
|
8338
|
-
attributes(this.inputElement, { 'aria-activedescendant': this.selectedLI ? this.selectedLI.id : null });
|
|
8339
8491
|
}
|
|
8340
8492
|
else {
|
|
8341
8493
|
super.setSelection(li, e);
|
|
@@ -8371,9 +8523,9 @@ let AutoComplete = class AutoComplete extends ComboBox {
|
|
|
8371
8523
|
isFiltering() {
|
|
8372
8524
|
return true;
|
|
8373
8525
|
}
|
|
8374
|
-
renderPopup() {
|
|
8526
|
+
renderPopup(e) {
|
|
8375
8527
|
this.list.scrollTop = 0;
|
|
8376
|
-
super.renderPopup();
|
|
8528
|
+
super.renderPopup(e);
|
|
8377
8529
|
}
|
|
8378
8530
|
isEditTextBox() {
|
|
8379
8531
|
return true && this.inputElement.value.trim() !== '';
|
|
@@ -8385,13 +8537,37 @@ let AutoComplete = class AutoComplete extends ComboBox {
|
|
|
8385
8537
|
isSelectFocusItem(element) {
|
|
8386
8538
|
return false;
|
|
8387
8539
|
}
|
|
8540
|
+
setInputValue(newProp, oldProp) {
|
|
8541
|
+
let oldValue = oldProp && oldProp.text ? oldProp.text : oldProp ? oldProp.value : oldProp;
|
|
8542
|
+
let value = newProp && newProp.text ? newProp.text : newProp && newProp.value ? newProp.value : this.value;
|
|
8543
|
+
if (value && this.typedString === '' && !this.allowCustom && !(this.dataSource instanceof DataManager)) {
|
|
8544
|
+
let checkFields_1 = this.typeOfData(this.dataSource).typeof === 'string' ? '' : this.fields.value;
|
|
8545
|
+
const listLength = this.getItems().length;
|
|
8546
|
+
let query = new Query();
|
|
8547
|
+
let _this = this;
|
|
8548
|
+
new DataManager(this.dataSource).executeQuery(query.where(new Predicate(checkFields_1, 'equal', value)))
|
|
8549
|
+
.then(function (e) {
|
|
8550
|
+
if (e.result.length > 0) {
|
|
8551
|
+
_this.value = checkFields_1 !== '' ? e.result[0][_this.fields.value].toString() : e.result[0].toString();
|
|
8552
|
+
_this.addItem(e.result, listLength);
|
|
8553
|
+
_this.updateValues();
|
|
8554
|
+
}
|
|
8555
|
+
else {
|
|
8556
|
+
newProp && newProp.text ? _this.setOldText(oldValue) : newProp && newProp.value ? _this.setOldValue(oldValue) : _this.updateValues();
|
|
8557
|
+
}
|
|
8558
|
+
});
|
|
8559
|
+
}
|
|
8560
|
+
else if (newProp) {
|
|
8561
|
+
newProp.text ? this.setOldText(oldValue) : this.setOldValue(oldValue);
|
|
8562
|
+
}
|
|
8563
|
+
}
|
|
8388
8564
|
/**
|
|
8389
8565
|
* Search the entered text and show it in the suggestion list if available.
|
|
8390
8566
|
*
|
|
8391
8567
|
* @returns {void}
|
|
8392
8568
|
* @deprecated
|
|
8393
8569
|
*/
|
|
8394
|
-
showPopup() {
|
|
8570
|
+
showPopup(e) {
|
|
8395
8571
|
if (!this.enabled) {
|
|
8396
8572
|
return;
|
|
8397
8573
|
}
|
|
@@ -8402,10 +8578,10 @@ let AutoComplete = class AutoComplete extends ComboBox {
|
|
|
8402
8578
|
this.beforePopupOpen = true;
|
|
8403
8579
|
this.preventAutoFill = true;
|
|
8404
8580
|
if (isNullOrUndefined(this.list)) {
|
|
8405
|
-
this.renderList();
|
|
8581
|
+
this.renderList(e);
|
|
8406
8582
|
}
|
|
8407
8583
|
else {
|
|
8408
|
-
this.resetList(this.dataSource, this.fields);
|
|
8584
|
+
this.resetList(this.dataSource, this.fields, null, e);
|
|
8409
8585
|
}
|
|
8410
8586
|
}
|
|
8411
8587
|
/**
|
|
@@ -8435,6 +8611,10 @@ let AutoComplete = class AutoComplete extends ComboBox {
|
|
|
8435
8611
|
if (this.showPopupButton) {
|
|
8436
8612
|
const button = Input.appendSpan(dropDownListClasses.icon, this.inputWrapper.container, this.createElement);
|
|
8437
8613
|
this.inputWrapper.buttons[0] = button;
|
|
8614
|
+
Input.calculateWidth(this.inputElement, this.inputWrapper.container);
|
|
8615
|
+
if (!isNullOrUndefined(this.inputWrapper.buttons[0]) && !isNullOrUndefined(this.inputWrapper.container.getElementsByClassName('e-float-text-overflow')[0]) && this.floatLabelType !== 'Never') {
|
|
8616
|
+
this.inputWrapper.container.getElementsByClassName('e-float-text-overflow')[0].classList.add('e-icon');
|
|
8617
|
+
}
|
|
8438
8618
|
if (this.inputWrapper && this.inputWrapper.buttons && this.inputWrapper.buttons[0]) {
|
|
8439
8619
|
EventHandler.add(this.inputWrapper.buttons[0], 'click', this.dropDownClick, this);
|
|
8440
8620
|
}
|
|
@@ -8562,9 +8742,11 @@ const LABELBOTTOM = 'e-label-bottom';
|
|
|
8562
8742
|
function createFloatLabel(overAllWrapper, searchWrapper, element, inputElement, value, floatLabelType, placeholder) {
|
|
8563
8743
|
const floatLinelement = createElement('span', { className: FLOATLINE });
|
|
8564
8744
|
const floatLabelElement = createElement('label', { className: FLOATTEXT });
|
|
8745
|
+
const id = element.getAttribute('id') ? element.getAttribute('id') : getUniqueID('ej2_multiselect');
|
|
8746
|
+
element.id = id;
|
|
8565
8747
|
if (!isNullOrUndefined(element.id) && element.id !== '') {
|
|
8566
8748
|
floatLabelElement.id = 'label_' + element.id.replace(/ /g, '_');
|
|
8567
|
-
attributes(
|
|
8749
|
+
attributes(inputElement, { 'aria-labelledby': floatLabelElement.id });
|
|
8568
8750
|
}
|
|
8569
8751
|
if (!isNullOrUndefined(inputElement.placeholder) && inputElement.placeholder !== '') {
|
|
8570
8752
|
floatLabelElement.innerText = encodePlaceholder(inputElement.placeholder);
|
|
@@ -8768,6 +8950,8 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
8768
8950
|
this.isValidKey = false;
|
|
8769
8951
|
this.selectAllEventData = [];
|
|
8770
8952
|
this.selectAllEventEle = [];
|
|
8953
|
+
this.resetMainList = null;
|
|
8954
|
+
this.resetFilteredData = false;
|
|
8771
8955
|
this.scrollFocusStatus = false;
|
|
8772
8956
|
this.keyDownStatus = false;
|
|
8773
8957
|
}
|
|
@@ -8808,7 +8992,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
8808
8992
|
for (const htmlAttr of Object.keys(this.htmlAttributes)) {
|
|
8809
8993
|
switch (htmlAttr) {
|
|
8810
8994
|
case 'class': {
|
|
8811
|
-
const updatedClassValue = (this.htmlAttributes[htmlAttr].replace(/\s+/g, ' ')).trim();
|
|
8995
|
+
const updatedClassValue = (this.htmlAttributes[`${htmlAttr}`].replace(/\s+/g, ' ')).trim();
|
|
8812
8996
|
if (updatedClassValue !== '') {
|
|
8813
8997
|
addClass([this.overAllWrapper], updatedClassValue.split(' '));
|
|
8814
8998
|
addClass([this.popupWrapper], updatedClassValue.split(' '));
|
|
@@ -8820,7 +9004,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
8820
9004
|
break;
|
|
8821
9005
|
case 'placeholder':
|
|
8822
9006
|
if (!this.placeholder) {
|
|
8823
|
-
this.inputElement.setAttribute(htmlAttr, this.htmlAttributes[htmlAttr]);
|
|
9007
|
+
this.inputElement.setAttribute(htmlAttr, this.htmlAttributes[`${htmlAttr}`]);
|
|
8824
9008
|
this.setProperties({ placeholder: this.inputElement.placeholder }, true);
|
|
8825
9009
|
this.refreshPlaceHolder();
|
|
8826
9010
|
}
|
|
@@ -8830,16 +9014,16 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
8830
9014
|
const validateAttr = ['name', 'required', 'aria-required', 'form'];
|
|
8831
9015
|
const containerAttr = ['title', 'role', 'style', 'class'];
|
|
8832
9016
|
if (defaultAttr.indexOf(htmlAttr) > -1) {
|
|
8833
|
-
this.element.setAttribute(htmlAttr, this.htmlAttributes[htmlAttr]);
|
|
9017
|
+
this.element.setAttribute(htmlAttr, this.htmlAttributes[`${htmlAttr}`]);
|
|
8834
9018
|
}
|
|
8835
9019
|
else if (htmlAttr.indexOf('data') === 0 || validateAttr.indexOf(htmlAttr) > -1) {
|
|
8836
|
-
this.hiddenElement.setAttribute(htmlAttr, this.htmlAttributes[htmlAttr]);
|
|
9020
|
+
this.hiddenElement.setAttribute(htmlAttr, this.htmlAttributes[`${htmlAttr}`]);
|
|
8837
9021
|
}
|
|
8838
9022
|
else if (containerAttr.indexOf(htmlAttr) > -1) {
|
|
8839
|
-
this.overAllWrapper.setAttribute(htmlAttr, this.htmlAttributes[htmlAttr]);
|
|
9023
|
+
this.overAllWrapper.setAttribute(htmlAttr, this.htmlAttributes[`${htmlAttr}`]);
|
|
8840
9024
|
}
|
|
8841
|
-
else if (htmlAttr !== 'size') {
|
|
8842
|
-
this.inputElement.setAttribute(htmlAttr, this.htmlAttributes[htmlAttr]);
|
|
9025
|
+
else if (htmlAttr !== 'size' && !isNullOrUndefined(this.inputElement)) {
|
|
9026
|
+
this.inputElement.setAttribute(htmlAttr, this.htmlAttributes[`${htmlAttr}`]);
|
|
8843
9027
|
}
|
|
8844
9028
|
break;
|
|
8845
9029
|
}
|
|
@@ -8848,11 +9032,13 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
8848
9032
|
}
|
|
8849
9033
|
}
|
|
8850
9034
|
updateReadonly(state) {
|
|
8851
|
-
if (
|
|
8852
|
-
this.
|
|
8853
|
-
|
|
8854
|
-
|
|
8855
|
-
|
|
9035
|
+
if (!isNullOrUndefined(this.inputElement)) {
|
|
9036
|
+
if (state || this.mode === 'CheckBox') {
|
|
9037
|
+
this.inputElement.setAttribute('readonly', 'true');
|
|
9038
|
+
}
|
|
9039
|
+
else {
|
|
9040
|
+
this.inputElement.removeAttribute('readonly');
|
|
9041
|
+
}
|
|
8856
9042
|
}
|
|
8857
9043
|
}
|
|
8858
9044
|
updateClearButton(state) {
|
|
@@ -8889,7 +9075,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
8889
9075
|
}
|
|
8890
9076
|
}
|
|
8891
9077
|
}
|
|
8892
|
-
onPopupShown() {
|
|
9078
|
+
onPopupShown(e) {
|
|
8893
9079
|
if (Browser.isDevice && (this.mode === 'CheckBox' && this.allowFiltering)) {
|
|
8894
9080
|
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
8895
9081
|
const proxy = this;
|
|
@@ -8900,7 +9086,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
8900
9086
|
history.pushState({}, '');
|
|
8901
9087
|
}
|
|
8902
9088
|
const animModel = { name: 'FadeIn', duration: 100 };
|
|
8903
|
-
const eventArgs = { popup: this.popupObj, cancel: false, animation: animModel };
|
|
9089
|
+
const eventArgs = { popup: this.popupObj, event: e, cancel: false, animation: animModel };
|
|
8904
9090
|
this.trigger('open', eventArgs, (eventArgs) => {
|
|
8905
9091
|
if (!eventArgs.cancel) {
|
|
8906
9092
|
this.focusAtFirstListItem();
|
|
@@ -8914,7 +9100,8 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
8914
9100
|
this.refreshPopup();
|
|
8915
9101
|
this.renderReactTemplates();
|
|
8916
9102
|
this.popupObj.show(eventArgs.animation, (this.zIndex === 1000) ? this.element : null);
|
|
8917
|
-
attributes(this.inputElement, { 'aria-expanded': 'true' });
|
|
9103
|
+
attributes(this.inputElement, { 'aria-expanded': 'true', 'aria-owns': this.inputElement.id + '_options' });
|
|
9104
|
+
this.updateAriaActiveDescendant();
|
|
8918
9105
|
if (this.isFirstClick) {
|
|
8919
9106
|
this.loadTemplate();
|
|
8920
9107
|
}
|
|
@@ -8984,11 +9171,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
8984
9171
|
getAriaAttributes() {
|
|
8985
9172
|
const ariaAttributes = {
|
|
8986
9173
|
'aria-disabled': 'false',
|
|
8987
|
-
'
|
|
8988
|
-
'role': 'listbox',
|
|
8989
|
-
'aria-multiselectable': 'true',
|
|
8990
|
-
'aria-activedescendant': 'null',
|
|
8991
|
-
'aria-haspopup': 'true',
|
|
9174
|
+
'role': 'combobox',
|
|
8992
9175
|
'aria-expanded': 'false'
|
|
8993
9176
|
};
|
|
8994
9177
|
return ariaAttributes;
|
|
@@ -8997,8 +9180,10 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
8997
9180
|
if (!isNullOrUndefined(this.ulElement)) {
|
|
8998
9181
|
attributes(this.ulElement, { 'id': this.element.id + '_options', 'role': 'listbox', 'aria-hidden': 'false' });
|
|
8999
9182
|
}
|
|
9000
|
-
const disableStatus = (this.inputElement.disabled) ? true : false;
|
|
9001
|
-
|
|
9183
|
+
const disableStatus = !isNullOrUndefined(this.inputElement) && (this.inputElement.disabled) ? true : false;
|
|
9184
|
+
if (!this.isPopupOpen() && !isNullOrUndefined(this.inputElement)) {
|
|
9185
|
+
attributes(this.inputElement, this.getAriaAttributes());
|
|
9186
|
+
}
|
|
9002
9187
|
if (disableStatus) {
|
|
9003
9188
|
attributes(this.inputElement, { 'aria-disabled': 'true' });
|
|
9004
9189
|
}
|
|
@@ -9066,13 +9251,23 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
9066
9251
|
if (!isNullOrUndefined(this.value) && !this.allowCustomValue) {
|
|
9067
9252
|
for (let i = 0; i < this.value.length; i++) {
|
|
9068
9253
|
const checkEle = this.findListElement(((this.allowFiltering && !isNullOrUndefined(this.mainList)) ? this.mainList : ulElement), 'li', 'data-value', proxy.value[i]);
|
|
9069
|
-
if (!checkEle) {
|
|
9254
|
+
if (!checkEle && !(this.dataSource instanceof DataManager)) {
|
|
9070
9255
|
this.value.splice(i, 1);
|
|
9071
9256
|
i -= 1;
|
|
9072
9257
|
}
|
|
9073
9258
|
}
|
|
9074
9259
|
}
|
|
9075
|
-
|
|
9260
|
+
let valuecheck = [];
|
|
9261
|
+
if (!isNullOrUndefined(this.value) && !this.allowCustomValue) {
|
|
9262
|
+
valuecheck = this.presentItemValue(this.ulElement);
|
|
9263
|
+
}
|
|
9264
|
+
if (valuecheck.length > 0 && this.dataSource instanceof DataManager && !isNullOrUndefined(this.value)
|
|
9265
|
+
&& this.listData != null) {
|
|
9266
|
+
this.addNonPresentItems(valuecheck, this.ulElement, this.listData);
|
|
9267
|
+
}
|
|
9268
|
+
else {
|
|
9269
|
+
this.updateActionList(ulElement, list, e);
|
|
9270
|
+
}
|
|
9076
9271
|
if (this.dataSource instanceof DataManager && this.mode === 'CheckBox' && this.allowFiltering) {
|
|
9077
9272
|
this.removeFocus();
|
|
9078
9273
|
}
|
|
@@ -9096,7 +9291,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
9096
9291
|
this.checkForCustomValue(this.tempQuery, this.fields);
|
|
9097
9292
|
return;
|
|
9098
9293
|
}
|
|
9099
|
-
if (this.value && this.value.length && ((this.mode !== 'CheckBox' && this.inputElement.value.trim() !== '') ||
|
|
9294
|
+
if (this.value && this.value.length && ((this.mode !== 'CheckBox' && !isNullOrUndefined(this.inputElement) && this.inputElement.value.trim() !== '') ||
|
|
9100
9295
|
this.mode === 'CheckBox' || ((this.keyCode === 8 || this.keyCode === 46) && this.allowFiltering &&
|
|
9101
9296
|
this.allowCustomValue && this.dataSource instanceof DataManager && this.inputElement.value === ''))) {
|
|
9102
9297
|
this.refreshSelection();
|
|
@@ -9124,7 +9319,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
9124
9319
|
this.renderPopup();
|
|
9125
9320
|
if (this.beforePopupOpen) {
|
|
9126
9321
|
this.beforePopupOpen = false;
|
|
9127
|
-
this.onPopupShown();
|
|
9322
|
+
this.onPopupShown(e);
|
|
9128
9323
|
}
|
|
9129
9324
|
}
|
|
9130
9325
|
refreshSelection() {
|
|
@@ -9154,6 +9349,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
9154
9349
|
dropDownBaseClasses.li + ':not(.' + HIDE_LIST + ')');
|
|
9155
9350
|
if (listEle.length > 0) {
|
|
9156
9351
|
addClass([listEle[0]], dropDownBaseClasses.focus);
|
|
9352
|
+
this.updateAriaActiveDescendant();
|
|
9157
9353
|
}
|
|
9158
9354
|
else {
|
|
9159
9355
|
//EJ2-57588 - for this task, we prevent the ul element cloning ( this.ulElement = this.ulElement.cloneNode ? <HTMLElement>this.ulElement.cloneNode(true) : this.ulElement;)
|
|
@@ -9165,8 +9361,8 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
9165
9361
|
}
|
|
9166
9362
|
element.setAttribute('aria-selected', 'true');
|
|
9167
9363
|
if (this.mode === 'CheckBox' && element.classList.contains('e-active')) {
|
|
9168
|
-
const ariaValue = element.
|
|
9169
|
-
if (
|
|
9364
|
+
const ariaValue = element.getElementsByClassName('e-check').length;
|
|
9365
|
+
if (ariaValue === 0) {
|
|
9170
9366
|
const args = {
|
|
9171
9367
|
module: 'CheckBoxSelection',
|
|
9172
9368
|
enable: this.mode === 'CheckBox',
|
|
@@ -9290,9 +9486,9 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
9290
9486
|
/**
|
|
9291
9487
|
* To filter the multiselect data from given data source by using query
|
|
9292
9488
|
*
|
|
9293
|
-
* @param
|
|
9294
|
-
* @param
|
|
9295
|
-
* @param
|
|
9489
|
+
* @param {Object[] | DataManager } dataSource - Set the data source to filter.
|
|
9490
|
+
* @param {Query} query - Specify the query to filter the data.
|
|
9491
|
+
* @param {FieldSettingsModel} fields - Specify the fields to map the column in the data table.
|
|
9296
9492
|
* @returns {void}
|
|
9297
9493
|
*/
|
|
9298
9494
|
filter(dataSource, query, fields) {
|
|
@@ -9380,7 +9576,8 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
9380
9576
|
this.resetList(tempData, field, query);
|
|
9381
9577
|
}
|
|
9382
9578
|
else {
|
|
9383
|
-
const tempData =
|
|
9579
|
+
const tempData = JSON.parse(JSON.stringify(this.listData));
|
|
9580
|
+
tempData.splice(0, 0, this.inputElement.value);
|
|
9384
9581
|
tempData[0] = (typeof customData === 'number' && !isNaN(parseFloat(tempData[0]))) ?
|
|
9385
9582
|
parseFloat(tempData[0]) : tempData[0];
|
|
9386
9583
|
tempData[0] = (typeof customData === 'boolean') ?
|
|
@@ -9416,7 +9613,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
9416
9613
|
}
|
|
9417
9614
|
if (!this.isPopupOpen() &&
|
|
9418
9615
|
(this.openOnClick || (this.showDropDownIcon && e.target && e.target.className === dropdownIcon))) {
|
|
9419
|
-
this.showPopup();
|
|
9616
|
+
this.showPopup(e);
|
|
9420
9617
|
}
|
|
9421
9618
|
else {
|
|
9422
9619
|
this.hidePopup(e);
|
|
@@ -9498,6 +9695,10 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
9498
9695
|
}
|
|
9499
9696
|
}
|
|
9500
9697
|
this.updateDataList();
|
|
9698
|
+
if (this.resetMainList) {
|
|
9699
|
+
this.mainList = this.resetMainList;
|
|
9700
|
+
this.resetMainList = null;
|
|
9701
|
+
}
|
|
9501
9702
|
this.refreshListItems(null);
|
|
9502
9703
|
if (this.mode !== 'Box' && this.mode !== 'CheckBox') {
|
|
9503
9704
|
this.updateDelimView();
|
|
@@ -9525,6 +9726,11 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
9525
9726
|
this.ulElement = this.mainList;
|
|
9526
9727
|
}
|
|
9527
9728
|
this.checkPlaceholderSize();
|
|
9729
|
+
Input.createSpanElement(this.overAllWrapper, this.createElement);
|
|
9730
|
+
Input.calculateWidth(this.inputElement, this.overAllWrapper);
|
|
9731
|
+
if (!isNullOrUndefined(this.overAllWrapper) && !isNullOrUndefined(this.overAllWrapper.getElementsByClassName('e-ddl-icon')[0] && this.overAllWrapper.getElementsByClassName('e-float-text-content')[0] && this.floatLabelType !== 'Never')) {
|
|
9732
|
+
this.overAllWrapper.getElementsByClassName('e-float-text-content')[0].classList.add('e-icon');
|
|
9733
|
+
}
|
|
9528
9734
|
}
|
|
9529
9735
|
checkPlaceholderSize() {
|
|
9530
9736
|
if (this.showDropDownIcon) {
|
|
@@ -9553,11 +9759,13 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
9553
9759
|
}
|
|
9554
9760
|
}
|
|
9555
9761
|
refreshInputHight() {
|
|
9556
|
-
if (
|
|
9557
|
-
this.
|
|
9558
|
-
|
|
9559
|
-
|
|
9560
|
-
|
|
9762
|
+
if (!isNullOrUndefined(this.searchWrapper)) {
|
|
9763
|
+
if ((!this.value || !this.value.length) && (isNullOrUndefined(this.text) || this.text === '')) {
|
|
9764
|
+
this.searchWrapper.classList.remove(ZERO_SIZE);
|
|
9765
|
+
}
|
|
9766
|
+
else {
|
|
9767
|
+
this.searchWrapper.classList.add(ZERO_SIZE);
|
|
9768
|
+
}
|
|
9561
9769
|
}
|
|
9562
9770
|
}
|
|
9563
9771
|
validateValues(newValue, oldValue) {
|
|
@@ -9595,6 +9803,11 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
9595
9803
|
this.tempValues = this.value.slice();
|
|
9596
9804
|
}
|
|
9597
9805
|
}
|
|
9806
|
+
updateAriaActiveDescendant() {
|
|
9807
|
+
if (!isNullOrUndefined(this.ulElement) && !isNullOrUndefined(this.ulElement.getElementsByClassName('e-item-focus')[0])) {
|
|
9808
|
+
attributes(this.inputElement, { 'aria-activedescendant': this.ulElement.getElementsByClassName('e-item-focus')[0].id });
|
|
9809
|
+
}
|
|
9810
|
+
}
|
|
9598
9811
|
getPagingCount() {
|
|
9599
9812
|
const height = this.list.classList.contains(dropDownBaseClasses.noData) ? null :
|
|
9600
9813
|
getComputedStyle(this.getItems()[0], null).getPropertyValue('height');
|
|
@@ -9655,6 +9868,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
9655
9868
|
if (this.isPopupOpen()) {
|
|
9656
9869
|
this.refreshPopup();
|
|
9657
9870
|
}
|
|
9871
|
+
Input.calculateWidth(this.inputElement, this.overAllWrapper);
|
|
9658
9872
|
return true;
|
|
9659
9873
|
}
|
|
9660
9874
|
else {
|
|
@@ -9710,7 +9924,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
9710
9924
|
break;
|
|
9711
9925
|
case 40:
|
|
9712
9926
|
if (!this.isPopupOpen()) {
|
|
9713
|
-
this.showPopup();
|
|
9927
|
+
this.showPopup(e);
|
|
9714
9928
|
e.preventDefault();
|
|
9715
9929
|
}
|
|
9716
9930
|
break;
|
|
@@ -9737,6 +9951,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
9737
9951
|
const element = scrollEle[(isHome) ? 0 : (scrollEle.length - 1)];
|
|
9738
9952
|
element.classList.add(dropDownBaseClasses.focus);
|
|
9739
9953
|
this.scrollBottom(element);
|
|
9954
|
+
this.updateAriaActiveDescendant();
|
|
9740
9955
|
}
|
|
9741
9956
|
}
|
|
9742
9957
|
onKeyDown(e) {
|
|
@@ -10238,7 +10453,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
10238
10453
|
}
|
|
10239
10454
|
invokeCheckboxSelection(element, eve, isClearAll) {
|
|
10240
10455
|
this.notify('updatelist', { module: 'CheckBoxSelection', enable: this.mode === 'CheckBox', li: element, e: eve });
|
|
10241
|
-
|
|
10456
|
+
this.updateAriaActiveDescendant();
|
|
10242
10457
|
if ((this.value && this.value.length !== this.mainData.length)
|
|
10243
10458
|
&& (this.mode === 'CheckBox' && this.showSelectAll && !(this.isSelectAll || isClearAll))) {
|
|
10244
10459
|
this.notify('checkSelectAll', {
|
|
@@ -10350,7 +10565,6 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
10350
10565
|
HIDE_LIST :
|
|
10351
10566
|
dropDownBaseClasses.selected);
|
|
10352
10567
|
if (this.mode === 'CheckBox') {
|
|
10353
|
-
element2.firstElementChild.setAttribute('aria-checked', 'false');
|
|
10354
10568
|
removeClass([element2.firstElementChild.lastElementChild], 'e-check');
|
|
10355
10569
|
}
|
|
10356
10570
|
}
|
|
@@ -10360,7 +10574,6 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
10360
10574
|
HIDE_LIST :
|
|
10361
10575
|
dropDownBaseClasses.selected);
|
|
10362
10576
|
if (this.mode === 'CheckBox') {
|
|
10363
|
-
element2.firstElementChild.setAttribute('aria-checked', 'true');
|
|
10364
10577
|
addClass([element2.firstElementChild.lastElementChild], 'e-check');
|
|
10365
10578
|
}
|
|
10366
10579
|
}
|
|
@@ -10618,109 +10831,111 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
10618
10831
|
super.render();
|
|
10619
10832
|
}
|
|
10620
10833
|
if (!this.popupObj) {
|
|
10621
|
-
|
|
10622
|
-
|
|
10623
|
-
|
|
10624
|
-
checkboxFilter.
|
|
10625
|
-
|
|
10626
|
-
|
|
10627
|
-
|
|
10628
|
-
|
|
10629
|
-
|
|
10630
|
-
this.
|
|
10631
|
-
|
|
10632
|
-
}
|
|
10633
|
-
append([this.list], this.popupWrapper);
|
|
10634
|
-
if (this.footerTemplate) {
|
|
10635
|
-
this.setFooterTemplate();
|
|
10636
|
-
overAllHeight -= this.footer.offsetHeight;
|
|
10637
|
-
}
|
|
10638
|
-
if (this.mode === 'CheckBox' && this.showSelectAll) {
|
|
10639
|
-
this.notify('selectAll', { module: 'CheckBoxSelection', enable: this.mode === 'CheckBox' });
|
|
10640
|
-
overAllHeight -= this.selectAllHeight;
|
|
10641
|
-
}
|
|
10642
|
-
else if (this.mode === 'CheckBox' && !this.showSelectAll && (!this.headerTemplate && !this.footerTemplate)) {
|
|
10643
|
-
this.notify('selectAll', { module: 'CheckBoxSelection', enable: this.mode === 'CheckBox' });
|
|
10644
|
-
overAllHeight = parseInt(this.popupHeight, 10);
|
|
10645
|
-
}
|
|
10646
|
-
else if (this.mode === 'CheckBox' && !this.showSelectAll) {
|
|
10647
|
-
this.notify('selectAll', { module: 'CheckBoxSelection', enable: this.mode === 'CheckBox' });
|
|
10648
|
-
overAllHeight = parseInt(this.popupHeight, 10);
|
|
10649
|
-
if (this.headerTemplate && this.header) {
|
|
10834
|
+
if (!isNullOrUndefined(this.popupWrapper)) {
|
|
10835
|
+
document.body.appendChild(this.popupWrapper);
|
|
10836
|
+
const checkboxFilter = this.popupWrapper.querySelector('.' + FILTERPARENT);
|
|
10837
|
+
if (this.mode === 'CheckBox' && !this.allowFiltering && checkboxFilter && this.filterParent) {
|
|
10838
|
+
checkboxFilter.remove();
|
|
10839
|
+
this.filterParent = null;
|
|
10840
|
+
}
|
|
10841
|
+
let overAllHeight = parseInt(this.popupHeight, 10);
|
|
10842
|
+
this.popupWrapper.style.visibility = 'hidden';
|
|
10843
|
+
if (this.headerTemplate) {
|
|
10844
|
+
this.setHeaderTemplate();
|
|
10650
10845
|
overAllHeight -= this.header.offsetHeight;
|
|
10651
10846
|
}
|
|
10652
|
-
|
|
10653
|
-
|
|
10654
|
-
|
|
10655
|
-
|
|
10656
|
-
if (this.mode === 'CheckBox') {
|
|
10657
|
-
const args = {
|
|
10658
|
-
module: 'CheckBoxSelection',
|
|
10659
|
-
enable: this.mode === 'CheckBox',
|
|
10660
|
-
popupElement: this.popupWrapper
|
|
10661
|
-
};
|
|
10662
|
-
if (this.allowFiltering) {
|
|
10663
|
-
this.notify('searchBox', args);
|
|
10664
|
-
overAllHeight -= this.searchBoxHeight;
|
|
10847
|
+
append([this.list], this.popupWrapper);
|
|
10848
|
+
if (this.footerTemplate) {
|
|
10849
|
+
this.setFooterTemplate();
|
|
10850
|
+
overAllHeight -= this.footer.offsetHeight;
|
|
10665
10851
|
}
|
|
10666
|
-
|
|
10667
|
-
|
|
10668
|
-
|
|
10669
|
-
|
|
10670
|
-
this.
|
|
10671
|
-
|
|
10672
|
-
|
|
10673
|
-
|
|
10674
|
-
|
|
10675
|
-
|
|
10676
|
-
|
|
10677
|
-
|
|
10678
|
-
|
|
10679
|
-
close: () => {
|
|
10680
|
-
if (this.popupObj.element.parentElement) {
|
|
10681
|
-
this.popupObj.unwireScrollEvents();
|
|
10682
|
-
// For restrict the page scrolling in safari browser
|
|
10683
|
-
const checkboxFilterInput = this.popupWrapper.querySelector('.' + FILTERINPUT);
|
|
10684
|
-
if (this.mode === 'CheckBox' && checkboxFilterInput && document.activeElement === checkboxFilterInput) {
|
|
10685
|
-
checkboxFilterInput.blur();
|
|
10686
|
-
}
|
|
10687
|
-
detach(this.popupObj.element);
|
|
10688
|
-
}
|
|
10689
|
-
},
|
|
10690
|
-
open: () => {
|
|
10691
|
-
this.popupObj.resolveCollision();
|
|
10692
|
-
if (!this.isFirstClick) {
|
|
10693
|
-
const ulElement = this.list.querySelector('ul');
|
|
10694
|
-
if (ulElement) {
|
|
10695
|
-
if (!(this.mode !== 'CheckBox' && (this.allowFiltering || this.allowCustomValue) &&
|
|
10696
|
-
this.targetElement().trim() !== '')) {
|
|
10697
|
-
this.mainList = ulElement.cloneNode ? ulElement.cloneNode(true) : ulElement;
|
|
10698
|
-
}
|
|
10699
|
-
}
|
|
10700
|
-
this.isFirstClick = true;
|
|
10852
|
+
if (this.mode === 'CheckBox' && this.showSelectAll) {
|
|
10853
|
+
this.notify('selectAll', { module: 'CheckBoxSelection', enable: this.mode === 'CheckBox' });
|
|
10854
|
+
overAllHeight -= this.selectAllHeight;
|
|
10855
|
+
}
|
|
10856
|
+
else if (this.mode === 'CheckBox' && !this.showSelectAll && (!this.headerTemplate && !this.footerTemplate)) {
|
|
10857
|
+
this.notify('selectAll', { module: 'CheckBoxSelection', enable: this.mode === 'CheckBox' });
|
|
10858
|
+
overAllHeight = parseInt(this.popupHeight, 10);
|
|
10859
|
+
}
|
|
10860
|
+
else if (this.mode === 'CheckBox' && !this.showSelectAll) {
|
|
10861
|
+
this.notify('selectAll', { module: 'CheckBoxSelection', enable: this.mode === 'CheckBox' });
|
|
10862
|
+
overAllHeight = parseInt(this.popupHeight, 10);
|
|
10863
|
+
if (this.headerTemplate && this.header) {
|
|
10864
|
+
overAllHeight -= this.header.offsetHeight;
|
|
10701
10865
|
}
|
|
10702
|
-
this.
|
|
10703
|
-
|
|
10704
|
-
this.targetElement().trim() !== '')) {
|
|
10705
|
-
this.loadTemplate();
|
|
10866
|
+
if (this.footerTemplate && this.footer) {
|
|
10867
|
+
overAllHeight -= this.footer.offsetHeight;
|
|
10706
10868
|
}
|
|
10707
|
-
|
|
10869
|
+
}
|
|
10870
|
+
if (this.mode === 'CheckBox') {
|
|
10871
|
+
const args = {
|
|
10872
|
+
module: 'CheckBoxSelection',
|
|
10873
|
+
enable: this.mode === 'CheckBox',
|
|
10874
|
+
popupElement: this.popupWrapper
|
|
10875
|
+
};
|
|
10708
10876
|
if (this.allowFiltering) {
|
|
10709
|
-
this.notify('
|
|
10710
|
-
|
|
10711
|
-
});
|
|
10877
|
+
this.notify('searchBox', args);
|
|
10878
|
+
overAllHeight -= this.searchBoxHeight;
|
|
10712
10879
|
}
|
|
10713
|
-
|
|
10714
|
-
|
|
10715
|
-
|
|
10880
|
+
addClass([this.popupWrapper], 'e-checkbox');
|
|
10881
|
+
}
|
|
10882
|
+
if (this.popupHeight !== 'auto') {
|
|
10883
|
+
this.list.style.maxHeight = formatUnit(overAllHeight);
|
|
10884
|
+
this.popupWrapper.style.maxHeight = formatUnit(this.popupHeight);
|
|
10885
|
+
}
|
|
10886
|
+
else {
|
|
10887
|
+
this.list.style.maxHeight = formatUnit(this.popupHeight);
|
|
10888
|
+
}
|
|
10889
|
+
this.popupObj = new Popup(this.popupWrapper, {
|
|
10890
|
+
width: this.calcPopupWidth(), targetType: 'relative', position: { X: 'left', Y: 'bottom' },
|
|
10891
|
+
relateTo: this.overAllWrapper, collision: { X: 'flip', Y: 'flip' }, offsetY: 1,
|
|
10892
|
+
enableRtl: this.enableRtl, zIndex: this.zIndex,
|
|
10893
|
+
close: () => {
|
|
10894
|
+
if (this.popupObj.element.parentElement) {
|
|
10895
|
+
this.popupObj.unwireScrollEvents();
|
|
10896
|
+
// For restrict the page scrolling in safari browser
|
|
10897
|
+
const checkboxFilterInput = this.popupWrapper.querySelector('.' + FILTERINPUT);
|
|
10898
|
+
if (this.mode === 'CheckBox' && checkboxFilterInput && document.activeElement === checkboxFilterInput) {
|
|
10899
|
+
checkboxFilterInput.blur();
|
|
10900
|
+
}
|
|
10901
|
+
detach(this.popupObj.element);
|
|
10902
|
+
}
|
|
10903
|
+
},
|
|
10904
|
+
open: () => {
|
|
10905
|
+
this.popupObj.resolveCollision();
|
|
10906
|
+
if (!this.isFirstClick) {
|
|
10907
|
+
const ulElement = this.list.querySelector('ul');
|
|
10908
|
+
if (ulElement) {
|
|
10909
|
+
if (!(this.mode !== 'CheckBox' && (this.allowFiltering || this.allowCustomValue) &&
|
|
10910
|
+
this.targetElement().trim() !== '')) {
|
|
10911
|
+
this.mainList = ulElement.cloneNode ? ulElement.cloneNode(true) : ulElement;
|
|
10912
|
+
}
|
|
10913
|
+
}
|
|
10914
|
+
this.isFirstClick = true;
|
|
10915
|
+
}
|
|
10916
|
+
this.popupObj.wireScrollEvents();
|
|
10917
|
+
if (!(this.mode !== 'CheckBox' && (this.allowFiltering || this.allowCustomValue) &&
|
|
10918
|
+
this.targetElement().trim() !== '')) {
|
|
10919
|
+
this.loadTemplate();
|
|
10920
|
+
}
|
|
10921
|
+
this.setScrollPosition();
|
|
10922
|
+
if (this.allowFiltering) {
|
|
10923
|
+
this.notify('inputFocus', {
|
|
10924
|
+
module: 'CheckBoxSelection', enable: this.mode === 'CheckBox', value: 'focus'
|
|
10925
|
+
});
|
|
10926
|
+
}
|
|
10927
|
+
}, targetExitViewport: () => {
|
|
10928
|
+
if (!Browser.isDevice) {
|
|
10929
|
+
this.hidePopup();
|
|
10930
|
+
}
|
|
10716
10931
|
}
|
|
10932
|
+
});
|
|
10933
|
+
if (this.mode === 'CheckBox' && Browser.isDevice && this.allowFiltering) {
|
|
10934
|
+
this.notify('deviceSearchBox', { module: 'CheckBoxSelection', enable: this.mode === 'CheckBox' });
|
|
10717
10935
|
}
|
|
10718
|
-
|
|
10719
|
-
|
|
10720
|
-
this.notify('deviceSearchBox', { module: 'CheckBoxSelection', enable: this.mode === 'CheckBox' });
|
|
10936
|
+
this.popupObj.close();
|
|
10937
|
+
this.popupWrapper.style.visibility = '';
|
|
10721
10938
|
}
|
|
10722
|
-
this.popupObj.close();
|
|
10723
|
-
this.popupWrapper.style.visibility = '';
|
|
10724
10939
|
}
|
|
10725
10940
|
}
|
|
10726
10941
|
setHeaderTemplate() {
|
|
@@ -10790,6 +11005,8 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
10790
11005
|
this.removeValue(temp, e, null, true);
|
|
10791
11006
|
}
|
|
10792
11007
|
}
|
|
11008
|
+
this.selectedElementID = null;
|
|
11009
|
+
this.inputElement.removeAttribute('aria-activedescendant');
|
|
10793
11010
|
}
|
|
10794
11011
|
else {
|
|
10795
11012
|
this.clearAllCallback(e);
|
|
@@ -10891,11 +11108,12 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
10891
11108
|
});
|
|
10892
11109
|
}
|
|
10893
11110
|
search(e) {
|
|
11111
|
+
this.resetFilteredData = true;
|
|
10894
11112
|
if (!isNullOrUndefined(e)) {
|
|
10895
11113
|
this.keyCode = e.keyCode;
|
|
10896
11114
|
}
|
|
10897
11115
|
if (!this.isPopupOpen() && this.openOnClick) {
|
|
10898
|
-
this.showPopup();
|
|
11116
|
+
this.showPopup(e);
|
|
10899
11117
|
}
|
|
10900
11118
|
this.openClick(e);
|
|
10901
11119
|
if (this.checkTextLength() && !this.allowFiltering && !isNullOrUndefined(e) && (e.keyCode !== 8)) {
|
|
@@ -10979,7 +11197,9 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
10979
11197
|
let temp;
|
|
10980
11198
|
const tempData = this.listData;
|
|
10981
11199
|
this.listData = this.mainData;
|
|
10982
|
-
this.hiddenElement
|
|
11200
|
+
if (!isNullOrUndefined(this.hiddenElement)) {
|
|
11201
|
+
this.hiddenElement.innerHTML = '';
|
|
11202
|
+
}
|
|
10983
11203
|
if (!isNullOrUndefined(this.value)) {
|
|
10984
11204
|
for (let index = 0; !isNullOrUndefined(this.value[index]); index++) {
|
|
10985
11205
|
const listValue = this.findListElement(((!isNullOrUndefined(this.mainList)) ? this.mainList : this.ulElement), 'li', 'data-value', this.value[index]);
|
|
@@ -10997,7 +11217,9 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
10997
11217
|
data += temp + delimiterChar + ' ';
|
|
10998
11218
|
text.push(temp);
|
|
10999
11219
|
}
|
|
11000
|
-
this.hiddenElement
|
|
11220
|
+
if (!isNullOrUndefined(this.hiddenElement)) {
|
|
11221
|
+
this.hiddenElement.innerHTML += '<option selected value ="' + this.value[index] + '">' + index + '</option>';
|
|
11222
|
+
}
|
|
11001
11223
|
}
|
|
11002
11224
|
}
|
|
11003
11225
|
this.setProperties({ text: text.toString() }, true);
|
|
@@ -11042,7 +11264,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
11042
11264
|
|| this.list.querySelector('.e-ul') && this.list.querySelector('.e-ul').childElementCount === 0)) {
|
|
11043
11265
|
isEmptyData = true;
|
|
11044
11266
|
}
|
|
11045
|
-
super.render(isEmptyData);
|
|
11267
|
+
super.render(null, isEmptyData);
|
|
11046
11268
|
this.unwireListEvents();
|
|
11047
11269
|
this.wireListEvents();
|
|
11048
11270
|
}
|
|
@@ -11208,10 +11430,8 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
11208
11430
|
selectItems[temp1 - 1].setAttribute('aria-selected', 'false');
|
|
11209
11431
|
if (this.mode === 'CheckBox') {
|
|
11210
11432
|
if (selectedItems && (selectedItems.length > (temp1 - 1))) {
|
|
11211
|
-
selectedItems[temp1 - 1].firstElementChild.setAttribute('aria-checked', 'false');
|
|
11212
11433
|
removeClass([selectedItems[temp1 - 1].firstElementChild.lastElementChild], 'e-check');
|
|
11213
11434
|
}
|
|
11214
|
-
selectItems[temp1 - 1].firstElementChild.setAttribute('aria-checked', 'false');
|
|
11215
11435
|
removeClass([selectItems[temp1 - 1].firstElementChild.lastElementChild], 'e-check');
|
|
11216
11436
|
}
|
|
11217
11437
|
temp1--;
|
|
@@ -11252,10 +11472,12 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
11252
11472
|
if (this.enabled && this.isValidLI(element)) {
|
|
11253
11473
|
this.removeFocus();
|
|
11254
11474
|
addClass([element], dropDownBaseClasses.focus);
|
|
11475
|
+
this.updateAriaActiveDescendant();
|
|
11255
11476
|
}
|
|
11256
11477
|
else {
|
|
11257
11478
|
if (this.enableGroupCheckBox && this.mode === 'CheckBox' && !isNullOrUndefined(this.fields.groupBy)) {
|
|
11258
11479
|
addClass([element], dropDownBaseClasses.focus);
|
|
11480
|
+
this.updateAriaActiveDescendant();
|
|
11259
11481
|
}
|
|
11260
11482
|
}
|
|
11261
11483
|
}
|
|
@@ -11267,9 +11489,9 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
11267
11489
|
addClass([element], className);
|
|
11268
11490
|
this.updateMainList(false, element.getAttribute('data-value'), mainElement);
|
|
11269
11491
|
element.setAttribute('aria-selected', 'true');
|
|
11270
|
-
if (this.mode === 'CheckBox') {
|
|
11271
|
-
const ariaCheck = element.
|
|
11272
|
-
if (ariaCheck ===
|
|
11492
|
+
if (this.mode === 'CheckBox' && element.classList.contains('e-active')) {
|
|
11493
|
+
const ariaCheck = element.getElementsByClassName('e-check').length;
|
|
11494
|
+
if (ariaCheck === 0) {
|
|
11273
11495
|
this.notify('updatelist', { module: 'CheckBoxSelection', enable: this.mode === 'CheckBox', li: element, e: this });
|
|
11274
11496
|
}
|
|
11275
11497
|
}
|
|
@@ -11277,7 +11499,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
11277
11499
|
if (this.chipCollectionWrapper) {
|
|
11278
11500
|
this.removeChipSelection();
|
|
11279
11501
|
}
|
|
11280
|
-
|
|
11502
|
+
this.selectedElementID = element.id;
|
|
11281
11503
|
}
|
|
11282
11504
|
}
|
|
11283
11505
|
updateDelimeter(delimChar, e) {
|
|
@@ -11587,9 +11809,11 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
11587
11809
|
if (this.chipCollectionWrapper) {
|
|
11588
11810
|
this.chipCollectionWrapper.style.display = 'none';
|
|
11589
11811
|
}
|
|
11590
|
-
this.viewWrapper
|
|
11591
|
-
|
|
11592
|
-
|
|
11812
|
+
if (!isNullOrUndefined(this.viewWrapper)) {
|
|
11813
|
+
this.viewWrapper.style.display = '';
|
|
11814
|
+
this.viewWrapper.style.width = '';
|
|
11815
|
+
this.viewWrapper.classList.remove(TOTAL_COUNT_WRAPPER$1);
|
|
11816
|
+
}
|
|
11593
11817
|
if (this.value && this.value.length) {
|
|
11594
11818
|
let data = '';
|
|
11595
11819
|
let temp;
|
|
@@ -11640,7 +11864,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
11640
11864
|
overAllContainer = this.componentWrapper.offsetWidth -
|
|
11641
11865
|
parseInt(window.getComputedStyle(this.componentWrapper).paddingLeft, 10) -
|
|
11642
11866
|
parseInt(window.getComputedStyle(this.componentWrapper).paddingRight, 10);
|
|
11643
|
-
if ((wrapperleng + downIconWidth + this.clearIconWidth)
|
|
11867
|
+
if ((wrapperleng + downIconWidth + this.clearIconWidth) >= overAllContainer) {
|
|
11644
11868
|
if (tempData !== undefined && tempData !== '') {
|
|
11645
11869
|
temp = tempData;
|
|
11646
11870
|
index = tempIndex + 1;
|
|
@@ -11649,7 +11873,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
11649
11873
|
remaining = this.value.length - index;
|
|
11650
11874
|
wrapperleng = this.viewWrapper.offsetWidth +
|
|
11651
11875
|
parseInt(window.getComputedStyle(this.viewWrapper).paddingRight, 10);
|
|
11652
|
-
while (((wrapperleng + remainSize + downIconWidth + this.clearIconWidth)
|
|
11876
|
+
while (((wrapperleng + remainSize + downIconWidth + this.clearIconWidth) >= overAllContainer) && wrapperleng !== 0
|
|
11653
11877
|
&& this.viewWrapper.innerHTML !== '') {
|
|
11654
11878
|
const textArr = [];
|
|
11655
11879
|
this.viewWrapper.innerHTML = textArr.join(this.delimiterChar);
|
|
@@ -11659,7 +11883,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
11659
11883
|
}
|
|
11660
11884
|
break;
|
|
11661
11885
|
}
|
|
11662
|
-
else if ((wrapperleng + remainSize + downIconWidth + this.clearIconWidth)
|
|
11886
|
+
else if ((wrapperleng + remainSize + downIconWidth + this.clearIconWidth) < overAllContainer) {
|
|
11663
11887
|
tempData = data;
|
|
11664
11888
|
tempIndex = index;
|
|
11665
11889
|
}
|
|
@@ -11677,8 +11901,10 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
11677
11901
|
}
|
|
11678
11902
|
}
|
|
11679
11903
|
else {
|
|
11680
|
-
this.viewWrapper
|
|
11681
|
-
|
|
11904
|
+
if (!isNullOrUndefined(this.viewWrapper)) {
|
|
11905
|
+
this.viewWrapper.innerHTML = '';
|
|
11906
|
+
this.viewWrapper.style.display = 'none';
|
|
11907
|
+
}
|
|
11682
11908
|
}
|
|
11683
11909
|
}
|
|
11684
11910
|
checkClearIconWidth() {
|
|
@@ -11751,29 +11977,41 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
11751
11977
|
return temp;
|
|
11752
11978
|
}
|
|
11753
11979
|
unWireEvent() {
|
|
11754
|
-
|
|
11980
|
+
if (!isNullOrUndefined(this.componentWrapper)) {
|
|
11981
|
+
EventHandler.remove(this.componentWrapper, 'mousedown', this.wrapperClick);
|
|
11982
|
+
}
|
|
11755
11983
|
EventHandler.remove(window, 'resize', this.windowResize);
|
|
11756
|
-
|
|
11757
|
-
|
|
11758
|
-
|
|
11759
|
-
|
|
11984
|
+
if (!isNullOrUndefined(this.inputElement)) {
|
|
11985
|
+
EventHandler.remove(this.inputElement, 'focus', this.focusInHandler);
|
|
11986
|
+
EventHandler.remove(this.inputElement, 'keydown', this.onKeyDown);
|
|
11987
|
+
if (this.mode !== 'CheckBox') {
|
|
11988
|
+
EventHandler.remove(this.inputElement, 'input', this.onInput);
|
|
11989
|
+
}
|
|
11990
|
+
EventHandler.remove(this.inputElement, 'keyup', this.keyUp);
|
|
11991
|
+
const formElement = closest(this.inputElement, 'form');
|
|
11992
|
+
if (formElement) {
|
|
11993
|
+
EventHandler.remove(formElement, 'reset', this.resetValueHandler);
|
|
11994
|
+
}
|
|
11995
|
+
EventHandler.remove(this.inputElement, 'blur', this.onBlurHandler);
|
|
11760
11996
|
}
|
|
11761
|
-
|
|
11762
|
-
|
|
11763
|
-
|
|
11764
|
-
|
|
11997
|
+
if (!isNullOrUndefined(this.componentWrapper)) {
|
|
11998
|
+
EventHandler.remove(this.componentWrapper, 'mouseover', this.mouseIn);
|
|
11999
|
+
EventHandler.remove(this.componentWrapper, 'mouseout', this.mouseOut);
|
|
12000
|
+
}
|
|
12001
|
+
if (!isNullOrUndefined(this.overAllClear)) {
|
|
12002
|
+
EventHandler.remove(this.overAllClear, 'mousedown', this.clearAll);
|
|
12003
|
+
}
|
|
12004
|
+
if (!isNullOrUndefined(this.inputElement)) {
|
|
12005
|
+
EventHandler.remove(this.inputElement, 'paste', this.pasteHandler);
|
|
11765
12006
|
}
|
|
11766
|
-
EventHandler.remove(this.inputElement, 'blur', this.onBlurHandler);
|
|
11767
|
-
EventHandler.remove(this.componentWrapper, 'mouseover', this.mouseIn);
|
|
11768
|
-
EventHandler.remove(this.componentWrapper, 'mouseout', this.mouseOut);
|
|
11769
|
-
EventHandler.remove(this.overAllClear, 'mousedown', this.clearAll);
|
|
11770
|
-
EventHandler.remove(this.inputElement, 'paste', this.pasteHandler);
|
|
11771
12007
|
}
|
|
11772
12008
|
selectAllItem(state, event, list) {
|
|
11773
12009
|
let li;
|
|
11774
|
-
|
|
11775
|
-
|
|
11776
|
-
|
|
12010
|
+
if (!isNullOrUndefined(this.list)) {
|
|
12011
|
+
li = this.list.querySelectorAll(state ?
|
|
12012
|
+
'li.e-list-item:not([aria-selected="true"]):not(.e-reorder-hide)' :
|
|
12013
|
+
'li.e-list-item[aria-selected="true"]:not(.e-reorder-hide)');
|
|
12014
|
+
}
|
|
11777
12015
|
if (this.value && this.value.length && event && event.target
|
|
11778
12016
|
&& closest(event.target, '.e-close-hooker') && this.allowFiltering) {
|
|
11779
12017
|
li = this.mainList.querySelectorAll(state ?
|
|
@@ -11823,6 +12061,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
11823
12061
|
target.classList.remove('e-active');
|
|
11824
12062
|
}
|
|
11825
12063
|
target.classList.add('e-item-focus');
|
|
12064
|
+
this.updateAriaActiveDescendant();
|
|
11826
12065
|
}
|
|
11827
12066
|
this.textboxValueUpdate();
|
|
11828
12067
|
this.checkPlaceholderSize();
|
|
@@ -11837,6 +12076,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
11837
12076
|
else {
|
|
11838
12077
|
this.updateValue(event, li, state);
|
|
11839
12078
|
}
|
|
12079
|
+
this.addValidInputClass();
|
|
11840
12080
|
}
|
|
11841
12081
|
updateValue(event, li, state) {
|
|
11842
12082
|
const length = li.length;
|
|
@@ -12059,6 +12299,11 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
12059
12299
|
onPropertyChanged(newProp, oldProp) {
|
|
12060
12300
|
if (newProp.dataSource && !isNullOrUndefined(Object.keys(newProp.dataSource))
|
|
12061
12301
|
|| newProp.query && !isNullOrUndefined(Object.keys(newProp.query))) {
|
|
12302
|
+
if (this.resetFilteredData) {
|
|
12303
|
+
// The filtered data is not being reset in the component after the user focuses out.
|
|
12304
|
+
this.resetMainList = !this.resetMainList ? this.mainList : this.resetMainList;
|
|
12305
|
+
this.resetFilteredData = false;
|
|
12306
|
+
}
|
|
12062
12307
|
this.mainList = null;
|
|
12063
12308
|
this.mainData = null;
|
|
12064
12309
|
this.isFirstClick = false;
|
|
@@ -12118,6 +12363,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
12118
12363
|
case 'cssClass':
|
|
12119
12364
|
this.updateOldPropCssClass(oldProp.cssClass);
|
|
12120
12365
|
this.updateCssClass();
|
|
12366
|
+
Input.calculateWidth(this.inputElement.parentElement.parentElement, this.overAllWrapper);
|
|
12121
12367
|
break;
|
|
12122
12368
|
case 'enableRtl':
|
|
12123
12369
|
this.enableRTL(newProp.enableRtl);
|
|
@@ -12144,6 +12390,11 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
12144
12390
|
case 'floatLabelType':
|
|
12145
12391
|
this.setFloatLabelType();
|
|
12146
12392
|
this.addValidInputClass();
|
|
12393
|
+
Input.createSpanElement(this.overAllWrapper, this.createElement);
|
|
12394
|
+
Input.calculateWidth(this.inputElement.parentElement.parentElement, this.overAllWrapper);
|
|
12395
|
+
if (!isNullOrUndefined(this.overAllWrapper) && !isNullOrUndefined(this.overAllWrapper.getElementsByClassName('e-ddl-icon')[0] && this.overAllWrapper.getElementsByClassName('e-float-text-content')[0] && this.floatLabelType !== 'Never')) {
|
|
12396
|
+
this.overAllWrapper.getElementsByClassName('e-float-text-content')[0].classList.add('e-icon');
|
|
12397
|
+
}
|
|
12147
12398
|
break;
|
|
12148
12399
|
case 'enableSelectionOrder':
|
|
12149
12400
|
break;
|
|
@@ -12202,7 +12453,9 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
12202
12453
|
;
|
|
12203
12454
|
addNonPresentItems(valuecheck, ulElement, list, event) {
|
|
12204
12455
|
this.dataSource.executeQuery(this.getForQuery(valuecheck)).then((e) => {
|
|
12205
|
-
|
|
12456
|
+
if (e.result.length > 0) {
|
|
12457
|
+
this.addItem(e.result, list.length);
|
|
12458
|
+
}
|
|
12206
12459
|
this.updateActionList(ulElement, list, event);
|
|
12207
12460
|
});
|
|
12208
12461
|
}
|
|
@@ -12261,7 +12514,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
12261
12514
|
* Adds a new item to the multiselect popup list. By default, new item appends to the list as the last item,
|
|
12262
12515
|
* but you can insert based on the index parameter.
|
|
12263
12516
|
*
|
|
12264
|
-
* @param
|
|
12517
|
+
* @param { Object[] } items - Specifies an array of JSON data or a JSON data.
|
|
12265
12518
|
* @param { number } itemIndex - Specifies the index to place the newly added item in the popup list.
|
|
12266
12519
|
* @returns {void}
|
|
12267
12520
|
*/
|
|
@@ -12292,6 +12545,8 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
12292
12545
|
this.overAllWrapper.classList.remove(iconAnimation);
|
|
12293
12546
|
this.popupObj.hide(new Animation(eventArgs.animation));
|
|
12294
12547
|
attributes(this.inputElement, { 'aria-expanded': 'false' });
|
|
12548
|
+
this.inputElement.removeAttribute('aria-owns');
|
|
12549
|
+
this.inputElement.removeAttribute('aria-activedescendant');
|
|
12295
12550
|
if (this.allowFiltering) {
|
|
12296
12551
|
this.notify('inputFocus', { module: 'CheckBoxSelection', enable: this.mode === 'CheckBox', value: 'clear' });
|
|
12297
12552
|
}
|
|
@@ -12307,7 +12562,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
12307
12562
|
*
|
|
12308
12563
|
* @returns {void}
|
|
12309
12564
|
*/
|
|
12310
|
-
showPopup() {
|
|
12565
|
+
showPopup(e) {
|
|
12311
12566
|
if (!this.enabled) {
|
|
12312
12567
|
return;
|
|
12313
12568
|
}
|
|
@@ -12316,7 +12571,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
12316
12571
|
if (!args.cancel) {
|
|
12317
12572
|
if (!this.ulElement) {
|
|
12318
12573
|
this.beforePopupOpen = true;
|
|
12319
|
-
super.render();
|
|
12574
|
+
super.render(e);
|
|
12320
12575
|
if (this.mode === 'CheckBox' && Browser.isDevice && this.allowFiltering) {
|
|
12321
12576
|
this.notify('popupFullScreen', { module: 'CheckBoxSelection', enable: this.mode === 'CheckBox' });
|
|
12322
12577
|
}
|
|
@@ -12332,7 +12587,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
12332
12587
|
this.beforePopupOpen = false;
|
|
12333
12588
|
return;
|
|
12334
12589
|
}
|
|
12335
|
-
this.onPopupShown();
|
|
12590
|
+
this.onPopupShown(e);
|
|
12336
12591
|
}
|
|
12337
12592
|
});
|
|
12338
12593
|
}
|
|
@@ -12433,12 +12688,12 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
12433
12688
|
spellcheck: 'false',
|
|
12434
12689
|
type: 'text',
|
|
12435
12690
|
autocomplete: 'off',
|
|
12436
|
-
tabindex: '0'
|
|
12691
|
+
tabindex: '0',
|
|
12692
|
+
role: 'combobox'
|
|
12437
12693
|
}
|
|
12438
12694
|
});
|
|
12439
12695
|
if (this.mode === 'Default' || this.mode === 'Box') {
|
|
12440
12696
|
this.inputElement.setAttribute('aria-describedby', this.chipCollectionWrapper.id);
|
|
12441
|
-
this.inputElement.setAttribute('aria-labelledby', this.chipCollectionWrapper.id);
|
|
12442
12697
|
}
|
|
12443
12698
|
if (this.element.tagName !== this.getNgDirective()) {
|
|
12444
12699
|
this.element.style.display = 'none';
|
|
@@ -12471,6 +12726,9 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
12471
12726
|
if (this.mode !== 'CheckBox') {
|
|
12472
12727
|
this.hideOverAllClear();
|
|
12473
12728
|
}
|
|
12729
|
+
if (!isNullOrUndefined(closest(this.element, "fieldset")) && closest(this.element, "fieldset").disabled) {
|
|
12730
|
+
this.enabled = false;
|
|
12731
|
+
}
|
|
12474
12732
|
this.wireEvent();
|
|
12475
12733
|
this.enable(this.enabled);
|
|
12476
12734
|
this.enableRTL(this.enableRtl);
|
|
@@ -12478,6 +12736,11 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
12478
12736
|
if (this.element.hasAttribute('data-val')) {
|
|
12479
12737
|
this.element.setAttribute('data-val', 'false');
|
|
12480
12738
|
}
|
|
12739
|
+
Input.createSpanElement(this.overAllWrapper, this.createElement);
|
|
12740
|
+
Input.calculateWidth(this.inputElement.parentElement.parentElement, this.overAllWrapper);
|
|
12741
|
+
if (!isNullOrUndefined(this.overAllWrapper) && !isNullOrUndefined(this.overAllWrapper.getElementsByClassName('e-ddl-icon')[0] && this.overAllWrapper.getElementsByClassName('e-float-text-content')[0] && this.floatLabelType !== 'Never')) {
|
|
12742
|
+
this.overAllWrapper.getElementsByClassName('e-float-text-content')[0].classList.add('e-icon');
|
|
12743
|
+
}
|
|
12481
12744
|
this.renderComplete();
|
|
12482
12745
|
}
|
|
12483
12746
|
checkInitialValue() {
|
|
@@ -12558,11 +12821,13 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
12558
12821
|
}
|
|
12559
12822
|
}
|
|
12560
12823
|
addValidInputClass() {
|
|
12561
|
-
if (
|
|
12562
|
-
|
|
12563
|
-
|
|
12564
|
-
|
|
12565
|
-
|
|
12824
|
+
if (!isNullOrUndefined(this.overAllWrapper)) {
|
|
12825
|
+
if ((!isNullOrUndefined(this.value) && this.value.length) || this.floatLabelType === 'Always') {
|
|
12826
|
+
addClass([this.overAllWrapper], 'e-valid-input');
|
|
12827
|
+
}
|
|
12828
|
+
else {
|
|
12829
|
+
removeClass([this.overAllWrapper], 'e-valid-input');
|
|
12830
|
+
}
|
|
12566
12831
|
}
|
|
12567
12832
|
}
|
|
12568
12833
|
dropDownIcon() {
|
|
@@ -12613,15 +12878,19 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
12613
12878
|
this.ulElement = null;
|
|
12614
12879
|
this.mainListCollection = null;
|
|
12615
12880
|
super.destroy();
|
|
12616
|
-
const temp = ['readonly', 'aria-disabled', '
|
|
12881
|
+
const temp = ['readonly', 'aria-disabled', 'placeholder'];
|
|
12617
12882
|
let length = temp.length;
|
|
12618
|
-
|
|
12619
|
-
|
|
12620
|
-
|
|
12883
|
+
if (!isNullOrUndefined(this.inputElement)) {
|
|
12884
|
+
while (length > 0) {
|
|
12885
|
+
this.inputElement.removeAttribute(temp[length - 1]);
|
|
12886
|
+
length--;
|
|
12887
|
+
}
|
|
12621
12888
|
}
|
|
12622
|
-
this.element
|
|
12623
|
-
|
|
12624
|
-
|
|
12889
|
+
if (!isNullOrUndefined(this.element)) {
|
|
12890
|
+
this.element.removeAttribute('data-initial-value');
|
|
12891
|
+
this.element.style.display = 'block';
|
|
12892
|
+
}
|
|
12893
|
+
if (this.overAllWrapper && this.overAllWrapper.parentElement) {
|
|
12625
12894
|
if (this.overAllWrapper.parentElement.tagName === this.getNgDirective()) {
|
|
12626
12895
|
remove(this.overAllWrapper);
|
|
12627
12896
|
}
|
|
@@ -12630,6 +12899,25 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
12630
12899
|
remove(this.overAllWrapper);
|
|
12631
12900
|
}
|
|
12632
12901
|
}
|
|
12902
|
+
this.componentWrapper = null;
|
|
12903
|
+
this.overAllClear = null;
|
|
12904
|
+
this.overAllWrapper = null;
|
|
12905
|
+
this.hiddenElement = null;
|
|
12906
|
+
this.searchWrapper = null;
|
|
12907
|
+
this.viewWrapper = null;
|
|
12908
|
+
this.chipCollectionWrapper = null;
|
|
12909
|
+
this.targetInputElement = null;
|
|
12910
|
+
this.popupWrapper = null;
|
|
12911
|
+
this.inputElement = null;
|
|
12912
|
+
this.delimiterWrapper = null;
|
|
12913
|
+
this.popupObj = null;
|
|
12914
|
+
this.popupWrapper = null;
|
|
12915
|
+
this.liCollections = null;
|
|
12916
|
+
this.header = null;
|
|
12917
|
+
this.mainList = null;
|
|
12918
|
+
this.mainListCollection = null;
|
|
12919
|
+
this.footer = null;
|
|
12920
|
+
this.selectAllEventEle = null;
|
|
12633
12921
|
}
|
|
12634
12922
|
};
|
|
12635
12923
|
__decorate$5([
|
|
@@ -12979,6 +13267,12 @@ class CheckBoxSelection {
|
|
|
12979
13267
|
destroy() {
|
|
12980
13268
|
this.removeEventListener();
|
|
12981
13269
|
EventHandler.remove(document, 'mousedown', this.onDocumentClick);
|
|
13270
|
+
this.checkAllParent = null;
|
|
13271
|
+
this.clearIconElement = null;
|
|
13272
|
+
this.filterInput = null;
|
|
13273
|
+
this.filterInputObj = null;
|
|
13274
|
+
this.checkWrapper = null;
|
|
13275
|
+
this.selectAllSpan = null;
|
|
12982
13276
|
}
|
|
12983
13277
|
listSelection(args) {
|
|
12984
13278
|
let target;
|
|
@@ -13027,12 +13321,10 @@ class CheckBoxSelection {
|
|
|
13027
13321
|
e.preventDefault();
|
|
13028
13322
|
}
|
|
13029
13323
|
changeState(wrapper, state, e, isPrevent, selectAll$$1) {
|
|
13030
|
-
let ariaState;
|
|
13031
13324
|
const frameSpan = wrapper.getElementsByClassName(CHECKBOXFRAME$1)[0];
|
|
13032
13325
|
if (state === 'check' && !frameSpan.classList.contains(CHECK$1)) {
|
|
13033
13326
|
frameSpan.classList.remove(INDETERMINATE);
|
|
13034
13327
|
frameSpan.classList.add(CHECK$1);
|
|
13035
|
-
ariaState = 'true';
|
|
13036
13328
|
if (selectAll$$1) {
|
|
13037
13329
|
this.parent.selectAllItems(true, e);
|
|
13038
13330
|
this.setLocale(true);
|
|
@@ -13040,7 +13332,6 @@ class CheckBoxSelection {
|
|
|
13040
13332
|
}
|
|
13041
13333
|
else if (state === 'uncheck' && (frameSpan.classList.contains(CHECK$1) || frameSpan.classList.contains(INDETERMINATE))) {
|
|
13042
13334
|
removeClass([frameSpan], [CHECK$1, INDETERMINATE]);
|
|
13043
|
-
ariaState = 'false';
|
|
13044
13335
|
if (selectAll$$1) {
|
|
13045
13336
|
this.parent.selectAllItems(false, e);
|
|
13046
13337
|
this.setLocale();
|
|
@@ -13049,16 +13340,11 @@ class CheckBoxSelection {
|
|
|
13049
13340
|
else if (state === 'indeterminate' && !(frameSpan.classList.contains(INDETERMINATE))) {
|
|
13050
13341
|
removeClass([frameSpan], [CHECK$1]);
|
|
13051
13342
|
frameSpan.classList.add(INDETERMINATE);
|
|
13052
|
-
ariaState = 'false';
|
|
13053
13343
|
if (selectAll$$1) {
|
|
13054
13344
|
this.parent.selectAllItems(false, e);
|
|
13055
13345
|
this.setLocale();
|
|
13056
13346
|
}
|
|
13057
13347
|
}
|
|
13058
|
-
ariaState = state === 'check' ? 'true' : state === 'uncheck' ? 'false' : ariaState;
|
|
13059
|
-
if (!isNullOrUndefined(ariaState)) {
|
|
13060
|
-
wrapper.setAttribute('aria-checked', ariaState);
|
|
13061
|
-
}
|
|
13062
13348
|
}
|
|
13063
13349
|
setSearchBox(args) {
|
|
13064
13350
|
if (isNullOrUndefined(this.parent.filterParent)) {
|
|
@@ -13092,11 +13378,8 @@ class CheckBoxSelection {
|
|
|
13092
13378
|
prepend([this.parent.filterParent], args.popupElement);
|
|
13093
13379
|
attributes(this.filterInput, {
|
|
13094
13380
|
'aria-disabled': 'false',
|
|
13095
|
-
'
|
|
13096
|
-
'role': 'listbox',
|
|
13097
|
-
'aria-activedescendant': null,
|
|
13381
|
+
'role': 'combobox',
|
|
13098
13382
|
'autocomplete': 'off',
|
|
13099
|
-
'autocorrect': 'off',
|
|
13100
13383
|
'autocapitalize': 'off',
|
|
13101
13384
|
'spellcheck': 'false'
|
|
13102
13385
|
});
|
|
@@ -13222,8 +13505,8 @@ class CheckBoxSelection {
|
|
|
13222
13505
|
e.preventDefault();
|
|
13223
13506
|
}
|
|
13224
13507
|
}
|
|
13225
|
-
if (!(!isNullOrUndefined(this.parent.popupObj) && closest(target, '[id="' + this.parent.popupObj.element.id + '"]'))
|
|
13226
|
-
!this.parent.overAllWrapper.contains(e.target)) {
|
|
13508
|
+
if (!(!isNullOrUndefined(this.parent.popupObj) && closest(target, '[id="' + this.parent.popupObj.element.id + '"]'))
|
|
13509
|
+
&& !isNullOrUndefined(this.parent.overAllWrapper) && !this.parent.overAllWrapper.contains(e.target)) {
|
|
13227
13510
|
if (this.parent.overAllWrapper.classList.contains(dropDownBaseClasses.focus) || this.parent.isPopupOpen()) {
|
|
13228
13511
|
this.parent.inputFocus = false;
|
|
13229
13512
|
this.parent.scrollFocusStatus = false;
|
|
@@ -13236,7 +13519,7 @@ class CheckBoxSelection {
|
|
|
13236
13519
|
this.parent.scrollFocusStatus = (Browser.isIE || Browser.info.name === 'edge') &&
|
|
13237
13520
|
(document.activeElement === this.filterInput);
|
|
13238
13521
|
}
|
|
13239
|
-
if (!this.parent.overAllWrapper.contains(e.target) && this.parent.overAllWrapper.classList.contains('e-input-focus') &&
|
|
13522
|
+
if (!isNullOrUndefined(this.parent.overAllWrapper) && !this.parent.overAllWrapper.contains(e.target) && this.parent.overAllWrapper.classList.contains('e-input-focus') &&
|
|
13240
13523
|
!this.parent.isPopupOpen()) {
|
|
13241
13524
|
if (Browser.isIE) {
|
|
13242
13525
|
this.parent.onBlurHandler();
|
|
@@ -13267,7 +13550,7 @@ class CheckBoxSelection {
|
|
|
13267
13550
|
}
|
|
13268
13551
|
}
|
|
13269
13552
|
checkSelectAll(e) {
|
|
13270
|
-
if (e.value === 'check'
|
|
13553
|
+
if (e.value === 'check') {
|
|
13271
13554
|
this.changeState(this.checkAllParent, e.value, null, null, false);
|
|
13272
13555
|
this.setLocale(true);
|
|
13273
13556
|
}
|
|
@@ -13424,6 +13707,7 @@ let ListBox = ListBox_1 = class ListBox extends DropDownBase {
|
|
|
13424
13707
|
this.isCustomFiltering = false;
|
|
13425
13708
|
this.initialSelectedOptions = this.value;
|
|
13426
13709
|
super.render();
|
|
13710
|
+
this.setEnabled();
|
|
13427
13711
|
this.renderComplete();
|
|
13428
13712
|
}
|
|
13429
13713
|
initWrapper() {
|
|
@@ -13458,7 +13742,7 @@ let ListBox = ListBox_1 = class ListBox extends DropDownBase {
|
|
|
13458
13742
|
removeClass([this.list], [dropDownBaseClasses.content, dropDownBaseClasses.root]);
|
|
13459
13743
|
this.validationAttribute(this.element, hiddenSelect);
|
|
13460
13744
|
this.list.setAttribute('role', 'listbox');
|
|
13461
|
-
attributes(this.list, { 'role': 'listbox', 'aria-multiselectable': this.selectionSettings.mode === 'Multiple' ? 'true' : 'false' });
|
|
13745
|
+
attributes(this.list, { 'role': 'listbox', 'aria-label': 'listbox', 'aria-multiselectable': this.selectionSettings.mode === 'Multiple' ? 'true' : 'false' });
|
|
13462
13746
|
this.updateSelectionSettings();
|
|
13463
13747
|
}
|
|
13464
13748
|
updateSelectionSettings() {
|
|
@@ -13503,8 +13787,8 @@ let ListBox = ListBox_1 = class ListBox extends DropDownBase {
|
|
|
13503
13787
|
});
|
|
13504
13788
|
}
|
|
13505
13789
|
}
|
|
13506
|
-
updateActionCompleteData(li, item) {
|
|
13507
|
-
this.jsonData.
|
|
13790
|
+
updateActionCompleteData(li, item, index) {
|
|
13791
|
+
this.jsonData.splice(index, 0, item);
|
|
13508
13792
|
}
|
|
13509
13793
|
initToolbar() {
|
|
13510
13794
|
const pos = this.toolbarSettings.position;
|
|
@@ -13714,14 +13998,14 @@ let ListBox = ListBox_1 = class ListBox extends DropDownBase {
|
|
|
13714
13998
|
triggerDrag(args) {
|
|
13715
13999
|
let scrollParent;
|
|
13716
14000
|
let boundRect;
|
|
13717
|
-
|
|
14001
|
+
const scrollMoved = 36;
|
|
13718
14002
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
13719
|
-
|
|
14003
|
+
const event = args.event;
|
|
13720
14004
|
let wrapper;
|
|
13721
|
-
if (args.target && (args.target.classList.contains(
|
|
13722
|
-
|| args.target.classList.contains(
|
|
13723
|
-
if (args.target.classList.contains(
|
|
13724
|
-
|| args.target.classList.contains(
|
|
14005
|
+
if (args.target && (args.target.classList.contains('e-listbox-wrapper') || args.target.classList.contains('e-list-item')
|
|
14006
|
+
|| args.target.classList.contains('e-filter-parent') || args.target.classList.contains('e-input-group'))) {
|
|
14007
|
+
if (args.target.classList.contains('e-list-item') || args.target.classList.contains('e-filter-parent')
|
|
14008
|
+
|| args.target.classList.contains('e-input-group')) {
|
|
13725
14009
|
wrapper = args.target.closest('.e-listbox-wrapper');
|
|
13726
14010
|
}
|
|
13727
14011
|
else {
|
|
@@ -13775,7 +14059,8 @@ let ListBox = ListBox_1 = class ListBox extends DropDownBase {
|
|
|
13775
14059
|
const getArgs = this.getDragArgs({ target: args.droppedElement }, true);
|
|
13776
14060
|
const sourceArgs = { previousData: this.dataSource };
|
|
13777
14061
|
const destArgs = { previousData: listObj.dataSource };
|
|
13778
|
-
let dragArgs = extend({}, getArgs, { target: args.target, source: { previousData: this.dataSource },
|
|
14062
|
+
let dragArgs = extend({}, getArgs, { target: args.target, source: { previousData: this.dataSource },
|
|
14063
|
+
previousIndex: args.previousIndex, currentIndex: args.currentIndex });
|
|
13779
14064
|
if (listObj !== this) {
|
|
13780
14065
|
const sourceArgs1 = extend(sourceArgs, { currentData: this.listData });
|
|
13781
14066
|
dragArgs = extend(dragArgs, { source: sourceArgs1, destination: destArgs });
|
|
@@ -13869,14 +14154,14 @@ let ListBox = ListBox_1 = class ListBox extends DropDownBase {
|
|
|
13869
14154
|
currIdx++;
|
|
13870
14155
|
});
|
|
13871
14156
|
if (this.fields.groupBy) {
|
|
13872
|
-
|
|
14157
|
+
const sourceElem = this.renderItems(this.listData, this.fields);
|
|
13873
14158
|
this.updateListItems(sourceElem, this.ulElement);
|
|
13874
14159
|
this.setSelection();
|
|
13875
14160
|
}
|
|
13876
14161
|
if (listObj.sortOrder !== 'None' || this.selectionSettings.showCheckbox
|
|
13877
14162
|
!== listObj.selectionSettings.showCheckbox || listObj.fields.groupBy || listObj.itemTemplate || this.itemTemplate) {
|
|
13878
14163
|
const sortable = getComponent(ul, 'sortable');
|
|
13879
|
-
|
|
14164
|
+
const sourceElem = listObj.renderItems(listData, listObj.fields);
|
|
13880
14165
|
listObj.updateListItems(sourceElem, ul);
|
|
13881
14166
|
this.setSelection();
|
|
13882
14167
|
if (sortable.placeHolderElement) {
|
|
@@ -13903,10 +14188,17 @@ let ListBox = ListBox_1 = class ListBox extends DropDownBase {
|
|
|
13903
14188
|
dragArgs = extend(dragArgs, { destination: dragArgs1 });
|
|
13904
14189
|
}
|
|
13905
14190
|
this.trigger('drop', dragArgs);
|
|
14191
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14192
|
+
const liCollElem = dragArgs.elements;
|
|
14193
|
+
if (liCollElem.length) {
|
|
14194
|
+
for (let i = 0; i < liCollElem.length; i++) {
|
|
14195
|
+
liCollElem[i].classList.remove('e-grabbed');
|
|
14196
|
+
}
|
|
14197
|
+
}
|
|
13906
14198
|
}
|
|
13907
14199
|
updateListItems(sourceElem, destElem) {
|
|
13908
14200
|
const i = 0;
|
|
13909
|
-
destElem.innerHTML =
|
|
14201
|
+
destElem.innerHTML = '';
|
|
13910
14202
|
while (i < sourceElem.childNodes.length) {
|
|
13911
14203
|
destElem.appendChild(sourceElem.childNodes[i]);
|
|
13912
14204
|
}
|
|
@@ -13935,6 +14227,14 @@ let ListBox = ListBox_1 = class ListBox extends DropDownBase {
|
|
|
13935
14227
|
}
|
|
13936
14228
|
return listObj;
|
|
13937
14229
|
}
|
|
14230
|
+
/**
|
|
14231
|
+
* Sets the enabled state to DropDownBase.
|
|
14232
|
+
*
|
|
14233
|
+
* @returns {void}
|
|
14234
|
+
*/
|
|
14235
|
+
setEnabled() {
|
|
14236
|
+
this.element.setAttribute('aria-disabled', (this.enabled) ? 'false' : 'true');
|
|
14237
|
+
}
|
|
13938
14238
|
listOption(dataSource, fields) {
|
|
13939
14239
|
this.listCurrentOptions = super.listOption(dataSource, fields);
|
|
13940
14240
|
this.listCurrentOptions = extend({}, this.listCurrentOptions, { itemCreated: this.triggerBeforeItemRender.bind(this) }, true);
|
|
@@ -13966,7 +14266,7 @@ let ListBox = ListBox_1 = class ListBox extends DropDownBase {
|
|
|
13966
14266
|
enableItems(items, enable = true, isValue) {
|
|
13967
14267
|
let li;
|
|
13968
14268
|
items.forEach((item) => {
|
|
13969
|
-
|
|
14269
|
+
const text = item;
|
|
13970
14270
|
li = this.findListElement(this.list, 'li', 'data-value', isValue ? text : this.getValueByText(text));
|
|
13971
14271
|
if (!li) {
|
|
13972
14272
|
return;
|
|
@@ -14042,7 +14342,7 @@ let ListBox = ListBox_1 = class ListBox extends DropDownBase {
|
|
|
14042
14342
|
let objValue;
|
|
14043
14343
|
const dupData = [];
|
|
14044
14344
|
let itemIdx;
|
|
14045
|
-
extend(dupData, [], this.
|
|
14345
|
+
extend(dupData, [], this.jsonData);
|
|
14046
14346
|
const removeIdxes = [];
|
|
14047
14347
|
const removeLiIdxes = [];
|
|
14048
14348
|
for (let j = 0; j < items.length; j++) {
|
|
@@ -14091,7 +14391,7 @@ let ListBox = ListBox_1 = class ListBox extends DropDownBase {
|
|
|
14091
14391
|
if (this.listData.length === 0) {
|
|
14092
14392
|
this.l10nUpdate();
|
|
14093
14393
|
}
|
|
14094
|
-
this.value =
|
|
14394
|
+
this.value = [];
|
|
14095
14395
|
this.updateToolBarState();
|
|
14096
14396
|
}
|
|
14097
14397
|
/**
|
|
@@ -14371,9 +14671,7 @@ let ListBox = ListBox_1 = class ListBox extends DropDownBase {
|
|
|
14371
14671
|
prepend([this.filterParent], this.list);
|
|
14372
14672
|
attributes(this.filterInput, {
|
|
14373
14673
|
'aria-disabled': 'false',
|
|
14374
|
-
'aria-
|
|
14375
|
-
'role': 'listbox',
|
|
14376
|
-
'aria-activedescendant': null,
|
|
14674
|
+
'aria-label': 'search list item',
|
|
14377
14675
|
'autocomplete': 'off',
|
|
14378
14676
|
'autocorrect': 'off',
|
|
14379
14677
|
'autocapitalize': 'off',
|
|
@@ -14410,12 +14708,12 @@ let ListBox = ListBox_1 = class ListBox extends DropDownBase {
|
|
|
14410
14708
|
if (li && li.parentElement) {
|
|
14411
14709
|
currSelIdx = [].slice.call(li.parentElement.children).indexOf(li);
|
|
14412
14710
|
if (!this.selectionSettings.showCheckbox) {
|
|
14413
|
-
if ((e.ctrlKey || Browser.isDevice) && this.isSelected(li)) {
|
|
14711
|
+
if ((e.ctrlKey || e.metaKey || Browser.isDevice) && this.isSelected(li)) {
|
|
14414
14712
|
li.classList.remove(cssClass.selected);
|
|
14415
14713
|
li.removeAttribute('aria-selected');
|
|
14416
14714
|
isSelect = false;
|
|
14417
14715
|
}
|
|
14418
|
-
else if (!(this.selectionSettings.mode === 'Multiple' && (e.ctrlKey || Browser.isDevice))) {
|
|
14716
|
+
else if (!(this.selectionSettings.mode === 'Multiple' && (e.ctrlKey || e.metaKey || Browser.isDevice))) {
|
|
14419
14717
|
this.getSelectedItems().forEach((ele) => {
|
|
14420
14718
|
ele.removeAttribute('aria-selected');
|
|
14421
14719
|
});
|
|
@@ -14697,7 +14995,7 @@ let ListBox = ListBox_1 = class ListBox extends DropDownBase {
|
|
|
14697
14995
|
});
|
|
14698
14996
|
if (isRefresh) {
|
|
14699
14997
|
if (fListBox.fields.groupBy) {
|
|
14700
|
-
|
|
14998
|
+
const sourceElem = fListBox.renderItems(listData, fListBox.fields);
|
|
14701
14999
|
fListBox.updateListItems(sourceElem, fListBox.ulElement);
|
|
14702
15000
|
}
|
|
14703
15001
|
else {
|
|
@@ -14730,7 +15028,7 @@ let ListBox = ListBox_1 = class ListBox extends DropDownBase {
|
|
|
14730
15028
|
tListBox.jsonData = tJsonData;
|
|
14731
15029
|
tListBox.sortedData = tSortData;
|
|
14732
15030
|
if (isRefresh) {
|
|
14733
|
-
|
|
15031
|
+
const sourceElem = tListBox.renderItems(tListData, tListBox.fields);
|
|
14734
15032
|
tListBox.updateListItems(sourceElem, tListBox.ulElement);
|
|
14735
15033
|
tListBox.setSelection();
|
|
14736
15034
|
fListBox.trigger('actionComplete', { items: tempItems, eventName: this.toolbarAction });
|
|
@@ -14770,7 +15068,7 @@ let ListBox = ListBox_1 = class ListBox extends DropDownBase {
|
|
|
14770
15068
|
const isRefresh = tListBox.sortOrder !== 'None' || (tListBox.selectionSettings.showCheckbox !==
|
|
14771
15069
|
fListBox.selectionSettings.showCheckbox) || tListBox.fields.groupBy || tListBox.itemTemplate || fListBox.itemTemplate;
|
|
14772
15070
|
this.removeSelected(fListBox, fListBox.getSelectedItems());
|
|
14773
|
-
const tempItems = [].slice.call(fListBox.
|
|
15071
|
+
const tempItems = [].slice.call(fListBox.listData);
|
|
14774
15072
|
const localDataArgs = { cancel: false, items: tempItems, eventName: this.toolbarAction };
|
|
14775
15073
|
fListBox.trigger('actionBegin', localDataArgs);
|
|
14776
15074
|
if (localDataArgs.cancel) {
|
|
@@ -14815,12 +15113,18 @@ let ListBox = ListBox_1 = class ListBox extends DropDownBase {
|
|
|
14815
15113
|
fListBox.value = [];
|
|
14816
15114
|
listData = listData
|
|
14817
15115
|
.filter((data) => data.isHeader !== true);
|
|
15116
|
+
const sortedData = listData.filter(function (val) {
|
|
15117
|
+
return tListBox.jsonData.indexOf(val) === -1;
|
|
15118
|
+
});
|
|
15119
|
+
for (let i = 0; i < sortedData.length; i++) {
|
|
15120
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
15121
|
+
tListBox.jsonData.splice(index + i, 0, sortedData[i]);
|
|
15122
|
+
}
|
|
14818
15123
|
tListBox.listData = listData;
|
|
14819
|
-
|
|
14820
|
-
if (this.listData.length == this.jsonData.length) {
|
|
15124
|
+
if (fListBox.listData.length === fListBox.jsonData.length) {
|
|
14821
15125
|
fListBox.listData = fListBox.sortedData = fListBox.jsonData = [];
|
|
14822
15126
|
}
|
|
14823
|
-
else if (
|
|
15127
|
+
else if (fListBox.allowFiltering) {
|
|
14824
15128
|
for (let i = 0; i < fListBox.listData.length; i++) {
|
|
14825
15129
|
for (let j = 0; j < fListBox.jsonData.length; j++) {
|
|
14826
15130
|
if (fListBox.listData[i] === fListBox.jsonData[j]) {
|
|
@@ -14831,7 +15135,7 @@ let ListBox = ListBox_1 = class ListBox extends DropDownBase {
|
|
|
14831
15135
|
fListBox.listData = fListBox.sortedData = [];
|
|
14832
15136
|
}
|
|
14833
15137
|
if (isRefresh) {
|
|
14834
|
-
|
|
15138
|
+
const sourceElem = tListBox.renderItems(listData, tListBox.fields);
|
|
14835
15139
|
tListBox.updateListItems(sourceElem, tListBox.ulElement);
|
|
14836
15140
|
this.trigger('actionComplete', { items: tempItems, eventName: this.toolbarAction });
|
|
14837
15141
|
}
|
|
@@ -14882,21 +15186,35 @@ let ListBox = ListBox_1 = class ListBox extends DropDownBase {
|
|
|
14882
15186
|
}
|
|
14883
15187
|
return listObj;
|
|
14884
15188
|
}
|
|
14885
|
-
getGrabbedItems() {
|
|
15189
|
+
getGrabbedItems(args) {
|
|
15190
|
+
let grabbItems = false;
|
|
14886
15191
|
for (let i = 0; i < this.value.length; i++) {
|
|
14887
|
-
if (this.value[i] === this.
|
|
15192
|
+
if (this.value[i] === this.getFormattedValue(args.target.getAttribute('data-value'))) {
|
|
15193
|
+
grabbItems = true;
|
|
15194
|
+
break;
|
|
15195
|
+
}
|
|
15196
|
+
}
|
|
15197
|
+
if (grabbItems) {
|
|
15198
|
+
for (let i = 0; i < this.value.length; i++) {
|
|
14888
15199
|
const liColl = this.list.querySelectorAll('[aria-selected="true"]');
|
|
14889
|
-
for (let
|
|
14890
|
-
|
|
15200
|
+
for (let j = 0; j < liColl.length; j++) {
|
|
15201
|
+
if (this.value[i] === this.getFormattedValue(liColl[j].getAttribute('data-value'))) {
|
|
15202
|
+
liColl[j].classList.add('e-grabbed');
|
|
15203
|
+
}
|
|
14891
15204
|
}
|
|
14892
|
-
break;
|
|
14893
15205
|
}
|
|
14894
15206
|
}
|
|
14895
|
-
|
|
15207
|
+
let elems;
|
|
15208
|
+
if (this.isAngular) {
|
|
15209
|
+
elems = Array.prototype.slice.call(this.element.getElementsByClassName('e-list-parent')[0].querySelectorAll('.e-grabbed'));
|
|
15210
|
+
}
|
|
15211
|
+
else {
|
|
15212
|
+
elems = Array.prototype.slice.call(this.element.nextElementSibling.querySelectorAll('.e-grabbed'));
|
|
15213
|
+
}
|
|
14896
15214
|
return elems;
|
|
14897
15215
|
}
|
|
14898
15216
|
getDragArgs(args, isDragEnd) {
|
|
14899
|
-
let elems = this.getGrabbedItems();
|
|
15217
|
+
let elems = this.getGrabbedItems(args);
|
|
14900
15218
|
if (elems.length) {
|
|
14901
15219
|
if (isDragEnd) {
|
|
14902
15220
|
elems.push(args.target);
|
|
@@ -14948,7 +15266,7 @@ let ListBox = ListBox_1 = class ListBox extends DropDownBase {
|
|
|
14948
15266
|
}
|
|
14949
15267
|
}
|
|
14950
15268
|
}
|
|
14951
|
-
else if (e.keyCode !== 37 && e.keyCode !== 39 && e.code !==
|
|
15269
|
+
else if (e.keyCode !== 37 && e.keyCode !== 39 && e.code !== 'KeyA') {
|
|
14952
15270
|
this.upDownKeyHandler(e);
|
|
14953
15271
|
}
|
|
14954
15272
|
}
|
|
@@ -14991,9 +15309,9 @@ let ListBox = ListBox_1 = class ListBox extends DropDownBase {
|
|
|
14991
15309
|
this.selectHandler({ target: ul.children[fliIdx], ctrlKey: e.ctrlKey, shiftKey: e.shiftKey }, true);
|
|
14992
15310
|
}
|
|
14993
15311
|
if (this.selectionSettings.showCheckbox && e.ctrlKey && e.shiftKey && (e.keyCode === 36 || e.keyCode === 35)) {
|
|
14994
|
-
|
|
14995
|
-
|
|
14996
|
-
|
|
15312
|
+
const selectedidx = Array.prototype.indexOf.call(ul.children, fli);
|
|
15313
|
+
const sidx = e.code === 'Home' ? 0 : selectedidx;
|
|
15314
|
+
const eidx = e.code === 'Home' ? selectedidx : ul.children.length - 1;
|
|
14997
15315
|
for (let i = sidx; i <= eidx; i++) {
|
|
14998
15316
|
const item = ul.children[i];
|
|
14999
15317
|
this.notify('updatelist', { li: item, e: {
|
|
@@ -15147,7 +15465,6 @@ let ListBox = ListBox_1 = class ListBox extends DropDownBase {
|
|
|
15147
15465
|
dvalue = this.getFormattedValue(li.getAttribute('data-value'));
|
|
15148
15466
|
if (values.indexOf(dvalue) < 0) {
|
|
15149
15467
|
li.getElementsByClassName('e-check')[0].classList.remove('e-check');
|
|
15150
|
-
li.getElementsByClassName('e-checkbox-wrapper')[0].removeAttribute('aria-checked');
|
|
15151
15468
|
li.removeAttribute('aria-selected');
|
|
15152
15469
|
}
|
|
15153
15470
|
});
|
|
@@ -15165,6 +15482,9 @@ let ListBox = ListBox_1 = class ListBox extends DropDownBase {
|
|
|
15165
15482
|
else {
|
|
15166
15483
|
text = value;
|
|
15167
15484
|
}
|
|
15485
|
+
if (typeof (text) === 'string') {
|
|
15486
|
+
text = text.split("\\").join("\\\\");
|
|
15487
|
+
}
|
|
15168
15488
|
li = this.list.querySelector('[data-value="' + text + '"]');
|
|
15169
15489
|
if (li) {
|
|
15170
15490
|
if (this.selectionSettings.showCheckbox) {
|
|
@@ -15493,6 +15813,12 @@ __decorate$6([
|
|
|
15493
15813
|
__decorate$6([
|
|
15494
15814
|
Property('')
|
|
15495
15815
|
], ListBox.prototype, "height", void 0);
|
|
15816
|
+
__decorate$6([
|
|
15817
|
+
Property(true)
|
|
15818
|
+
], ListBox.prototype, "enabled", void 0);
|
|
15819
|
+
__decorate$6([
|
|
15820
|
+
Property(false)
|
|
15821
|
+
], ListBox.prototype, "enablePersistence", void 0);
|
|
15496
15822
|
__decorate$6([
|
|
15497
15823
|
Property(false)
|
|
15498
15824
|
], ListBox.prototype, "allowDragAndDrop", void 0);
|
|
@@ -15567,6 +15893,1444 @@ const listBoxClasses = {
|
|
|
15567
15893
|
clearIcon: 'e-clear-icon'
|
|
15568
15894
|
};
|
|
15569
15895
|
|
|
15896
|
+
/**
|
|
15897
|
+
* export all modules from current location
|
|
15898
|
+
*/
|
|
15899
|
+
|
|
15900
|
+
var __decorate$7 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
15901
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
15902
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
15903
|
+
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;
|
|
15904
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
15905
|
+
};
|
|
15906
|
+
/**
|
|
15907
|
+
* The Mention component is used to list someone or something based on user input in textarea, input,
|
|
15908
|
+
* or any other editable element from which the user can select.
|
|
15909
|
+
*/
|
|
15910
|
+
let Mention = class Mention extends DropDownBase {
|
|
15911
|
+
/**
|
|
15912
|
+
* * Constructor for creating the widget
|
|
15913
|
+
*
|
|
15914
|
+
* @param {MentionModel} options - Specifies the MentionComponent model.
|
|
15915
|
+
* @param {string | HTMLElement} element - Specifies the element to render as component.
|
|
15916
|
+
* @private
|
|
15917
|
+
*/
|
|
15918
|
+
constructor(options, element) {
|
|
15919
|
+
super(options, element);
|
|
15920
|
+
}
|
|
15921
|
+
/**
|
|
15922
|
+
* When property value changes happened, then onPropertyChanged method will execute the respective changes in this component.
|
|
15923
|
+
*
|
|
15924
|
+
* @param {MentionModel} newProp - Returns the dynamic property value of the component.
|
|
15925
|
+
* @param {MentionModel} oldProp - Returns the previous property value of the component.
|
|
15926
|
+
* @private
|
|
15927
|
+
* @returns {void}
|
|
15928
|
+
*/
|
|
15929
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
15930
|
+
onPropertyChanged(newProp, oldProp) {
|
|
15931
|
+
for (const prop of Object.keys(newProp)) {
|
|
15932
|
+
switch (prop) {
|
|
15933
|
+
case 'minLength':
|
|
15934
|
+
this.minLength = newProp.minLength;
|
|
15935
|
+
break;
|
|
15936
|
+
case 'suffixText':
|
|
15937
|
+
this.suffixText = newProp.suffixText;
|
|
15938
|
+
break;
|
|
15939
|
+
case 'allowSpaces':
|
|
15940
|
+
this.allowSpaces = newProp.allowSpaces;
|
|
15941
|
+
break;
|
|
15942
|
+
case 'mentionChar':
|
|
15943
|
+
this.mentionChar = newProp.mentionChar;
|
|
15944
|
+
break;
|
|
15945
|
+
case 'showMentionChar':
|
|
15946
|
+
this.showMentionChar = newProp.showMentionChar;
|
|
15947
|
+
break;
|
|
15948
|
+
case 'cssClass':
|
|
15949
|
+
this.updateCssClass(newProp.cssClass, oldProp.cssClass);
|
|
15950
|
+
break;
|
|
15951
|
+
}
|
|
15952
|
+
}
|
|
15953
|
+
}
|
|
15954
|
+
updateCssClass(newClass, oldClass) {
|
|
15955
|
+
if (!isNullOrUndefined(oldClass)) {
|
|
15956
|
+
oldClass = (oldClass.replace(/\s+/g, ' ')).trim();
|
|
15957
|
+
}
|
|
15958
|
+
if (!isNullOrUndefined(newClass)) {
|
|
15959
|
+
newClass = (newClass.replace(/\s+/g, ' ')).trim();
|
|
15960
|
+
}
|
|
15961
|
+
this.setCssClass(newClass, [this.inputElement], oldClass);
|
|
15962
|
+
if (this.popupObj) {
|
|
15963
|
+
this.setCssClass(newClass, [this.popupObj.element], oldClass);
|
|
15964
|
+
}
|
|
15965
|
+
}
|
|
15966
|
+
setCssClass(cssClass$$1, elements, oldClass) {
|
|
15967
|
+
if (!isNullOrUndefined(oldClass) && oldClass !== '') {
|
|
15968
|
+
removeClass(elements, oldClass.split(' '));
|
|
15969
|
+
}
|
|
15970
|
+
if (!isNullOrUndefined(cssClass$$1) && cssClass$$1 !== '') {
|
|
15971
|
+
addClass(elements, cssClass$$1.split(' '));
|
|
15972
|
+
}
|
|
15973
|
+
}
|
|
15974
|
+
initializeData() {
|
|
15975
|
+
this.isSelected = false;
|
|
15976
|
+
this.isFiltered = false;
|
|
15977
|
+
this.beforePopupOpen = false;
|
|
15978
|
+
this.initRemoteRender = false;
|
|
15979
|
+
this.isListResetted = false;
|
|
15980
|
+
this.isPopupOpen = false;
|
|
15981
|
+
this.isCollided = false;
|
|
15982
|
+
this.lineBreak = false;
|
|
15983
|
+
this.keyConfigure = {
|
|
15984
|
+
tab: 'tab',
|
|
15985
|
+
enter: '13',
|
|
15986
|
+
escape: '27',
|
|
15987
|
+
end: '35',
|
|
15988
|
+
home: '36',
|
|
15989
|
+
down: '40',
|
|
15990
|
+
up: '38',
|
|
15991
|
+
pageUp: '33',
|
|
15992
|
+
pageDown: '34',
|
|
15993
|
+
open: 'alt+40',
|
|
15994
|
+
close: 'shift+tab',
|
|
15995
|
+
hide: 'alt+38',
|
|
15996
|
+
space: '32'
|
|
15997
|
+
};
|
|
15998
|
+
}
|
|
15999
|
+
/**
|
|
16000
|
+
* Execute before render the list items
|
|
16001
|
+
*
|
|
16002
|
+
* @private
|
|
16003
|
+
* @returns {void}
|
|
16004
|
+
*/
|
|
16005
|
+
preRender() {
|
|
16006
|
+
this.initializeData();
|
|
16007
|
+
super.preRender();
|
|
16008
|
+
}
|
|
16009
|
+
/**
|
|
16010
|
+
* To Initialize the control rendering
|
|
16011
|
+
*
|
|
16012
|
+
* @private
|
|
16013
|
+
* @returns {void}
|
|
16014
|
+
*/
|
|
16015
|
+
render() {
|
|
16016
|
+
this.inputElement = !isNullOrUndefined(this.target) ? ((typeof this.target) === 'string') ?
|
|
16017
|
+
document.querySelector(this.target) : this.target : this.element;
|
|
16018
|
+
if (this.isContentEditable(this.inputElement)) {
|
|
16019
|
+
this.inputElement.setAttribute('contenteditable', 'true');
|
|
16020
|
+
addClass([this.inputElement], ['e-mention']);
|
|
16021
|
+
if (isNullOrUndefined(this.target)) {
|
|
16022
|
+
addClass([this.inputElement], ['e-editable-element']);
|
|
16023
|
+
}
|
|
16024
|
+
}
|
|
16025
|
+
this.queryString = this.elementValue();
|
|
16026
|
+
this.wireEvent();
|
|
16027
|
+
}
|
|
16028
|
+
wireEvent() {
|
|
16029
|
+
EventHandler.add(this.inputElement, 'keyup', this.onKeyUp, this);
|
|
16030
|
+
this.bindCommonEvent();
|
|
16031
|
+
}
|
|
16032
|
+
unWireEvent() {
|
|
16033
|
+
EventHandler.remove(this.inputElement, 'keyup', this.onKeyUp);
|
|
16034
|
+
this.unBindCommonEvent();
|
|
16035
|
+
}
|
|
16036
|
+
bindCommonEvent() {
|
|
16037
|
+
if (!Browser.isDevice) {
|
|
16038
|
+
this.keyboardModule = new KeyboardEvents(this.inputElement, {
|
|
16039
|
+
keyAction: this.keyActionHandler.bind(this), keyConfigs: this.keyConfigure, eventName: 'keydown'
|
|
16040
|
+
});
|
|
16041
|
+
}
|
|
16042
|
+
}
|
|
16043
|
+
/**
|
|
16044
|
+
* Hides the spinner loader.
|
|
16045
|
+
*
|
|
16046
|
+
* @private
|
|
16047
|
+
* @returns {void}
|
|
16048
|
+
*/
|
|
16049
|
+
hideSpinner() {
|
|
16050
|
+
this.hideWaitingSpinner();
|
|
16051
|
+
}
|
|
16052
|
+
hideWaitingSpinner() {
|
|
16053
|
+
if (!isNullOrUndefined(this.spinnerElement)) {
|
|
16054
|
+
hideSpinner(this.spinnerElement);
|
|
16055
|
+
}
|
|
16056
|
+
if (!isNullOrUndefined(this.spinnerTemplate) && !isNullOrUndefined(this.spinnerTemplateElement)) {
|
|
16057
|
+
detach(this.spinnerTemplateElement);
|
|
16058
|
+
}
|
|
16059
|
+
}
|
|
16060
|
+
/**
|
|
16061
|
+
* Shows the spinner loader.
|
|
16062
|
+
*
|
|
16063
|
+
* @returns {void}
|
|
16064
|
+
*/
|
|
16065
|
+
showWaitingSpinner() {
|
|
16066
|
+
if (!isNullOrUndefined(this.popupObj)) {
|
|
16067
|
+
if (isNullOrUndefined(this.spinnerTemplate) && isNullOrUndefined(this.spinnerElement)) {
|
|
16068
|
+
this.spinnerElement = this.popupObj.element;
|
|
16069
|
+
createSpinner({
|
|
16070
|
+
target: this.spinnerElement,
|
|
16071
|
+
width: Browser.isDevice ? '16px' : '14px'
|
|
16072
|
+
}, this.createElement);
|
|
16073
|
+
showSpinner(this.spinnerElement);
|
|
16074
|
+
}
|
|
16075
|
+
if (!isNullOrUndefined(this.spinnerTemplate)) {
|
|
16076
|
+
this.setSpinnerTemplate();
|
|
16077
|
+
}
|
|
16078
|
+
}
|
|
16079
|
+
}
|
|
16080
|
+
keyActionHandler(e) {
|
|
16081
|
+
const isNavigation = (e.action === 'down' || e.action === 'up' || e.action === 'pageUp' || e.action === 'pageDown'
|
|
16082
|
+
|| e.action === 'home' || e.action === 'end');
|
|
16083
|
+
const isTabAction = e.action === 'tab' || e.action === 'close';
|
|
16084
|
+
if (this.list === undefined && !this.isRequested && !isTabAction && e.action !== 'escape' && e.action !== 'space') {
|
|
16085
|
+
this.renderList();
|
|
16086
|
+
}
|
|
16087
|
+
if (isNullOrUndefined(this.list) || (!isNullOrUndefined(this.liCollections) &&
|
|
16088
|
+
isNavigation && this.liCollections.length === 0) || this.isRequested) {
|
|
16089
|
+
return;
|
|
16090
|
+
}
|
|
16091
|
+
if (e.action === 'escape') {
|
|
16092
|
+
e.preventDefault();
|
|
16093
|
+
}
|
|
16094
|
+
this.isSelected = e.action === 'escape' ? false : this.isSelected;
|
|
16095
|
+
switch (e.action) {
|
|
16096
|
+
case 'down':
|
|
16097
|
+
case 'up':
|
|
16098
|
+
this.updateUpDownAction(e);
|
|
16099
|
+
break;
|
|
16100
|
+
case 'tab':
|
|
16101
|
+
if (this.isPopupOpen) {
|
|
16102
|
+
e.preventDefault();
|
|
16103
|
+
const li = this.list.querySelector('.' + dropDownBaseClasses.selected);
|
|
16104
|
+
if (li) {
|
|
16105
|
+
this.setSelection(li, e);
|
|
16106
|
+
}
|
|
16107
|
+
if (this.isPopupOpen) {
|
|
16108
|
+
this.hidePopup(e);
|
|
16109
|
+
}
|
|
16110
|
+
}
|
|
16111
|
+
break;
|
|
16112
|
+
case 'enter':
|
|
16113
|
+
if (this.isPopupOpen) {
|
|
16114
|
+
e.preventDefault();
|
|
16115
|
+
if (this.popupObj && this.popupObj.element.contains(this.selectedLI)) {
|
|
16116
|
+
this.setValue(e);
|
|
16117
|
+
}
|
|
16118
|
+
}
|
|
16119
|
+
break;
|
|
16120
|
+
case 'escape':
|
|
16121
|
+
if (this.isPopupOpen) {
|
|
16122
|
+
this.hidePopup(e);
|
|
16123
|
+
}
|
|
16124
|
+
break;
|
|
16125
|
+
}
|
|
16126
|
+
}
|
|
16127
|
+
updateUpDownAction(e) {
|
|
16128
|
+
const focusEle = this.list.querySelector('.' + dropDownBaseClasses.focus);
|
|
16129
|
+
if (this.isSelectFocusItem(focusEle)) {
|
|
16130
|
+
this.setSelection(focusEle, e);
|
|
16131
|
+
}
|
|
16132
|
+
else if (!isNullOrUndefined(this.liCollections)) {
|
|
16133
|
+
const li = this.list.querySelector('.' + dropDownBaseClasses.selected);
|
|
16134
|
+
if (!isNullOrUndefined(li)) {
|
|
16135
|
+
const value = this.getFormattedValue(li.getAttribute('data-value'));
|
|
16136
|
+
this.activeIndex = this.getIndexByValue(value);
|
|
16137
|
+
}
|
|
16138
|
+
let index = e.action === 'down' ? this.activeIndex + 1 : this.activeIndex - 1;
|
|
16139
|
+
let startIndex = 0;
|
|
16140
|
+
startIndex = e.action === 'down' && isNullOrUndefined(this.activeIndex) ? 0 : this.liCollections.length - 1;
|
|
16141
|
+
index = index < 0 ? this.liCollections.length - 1 : index === this.liCollections.length ? 0 : index;
|
|
16142
|
+
const nextItem = isNullOrUndefined(this.activeIndex) ?
|
|
16143
|
+
this.liCollections[startIndex] : this.liCollections[index];
|
|
16144
|
+
if (!isNullOrUndefined(nextItem)) {
|
|
16145
|
+
this.setSelection(nextItem, e);
|
|
16146
|
+
}
|
|
16147
|
+
}
|
|
16148
|
+
if (this.isPopupOpen) {
|
|
16149
|
+
e.preventDefault();
|
|
16150
|
+
}
|
|
16151
|
+
}
|
|
16152
|
+
isSelectFocusItem(element) {
|
|
16153
|
+
return !isNullOrUndefined(element);
|
|
16154
|
+
}
|
|
16155
|
+
unBindCommonEvent() {
|
|
16156
|
+
if (!Browser.isDevice) {
|
|
16157
|
+
this.keyboardModule.destroy();
|
|
16158
|
+
}
|
|
16159
|
+
}
|
|
16160
|
+
onKeyUp(e) {
|
|
16161
|
+
let rangetextContent;
|
|
16162
|
+
if (this.isContentEditable(this.inputElement)) {
|
|
16163
|
+
this.range = this.getCurrentRange();
|
|
16164
|
+
rangetextContent = this.range.startContainer.textContent.split('');
|
|
16165
|
+
}
|
|
16166
|
+
let currentRange = this.getTextRange();
|
|
16167
|
+
const lastWordRange = this.getLastLetter(currentRange);
|
|
16168
|
+
// eslint-disable-next-line security/detect-non-literal-regexp
|
|
16169
|
+
const Regex = new RegExp(this.mentionChar, 'g');
|
|
16170
|
+
const charRegex = new RegExp('[a-zA-Z]', 'g');
|
|
16171
|
+
if (e.key === 'Shift' || e.keyCode === 37 || e.keyCode === 39) {
|
|
16172
|
+
if ((e.keyCode === 37 || e.keyCode === 39) && !isNullOrUndefined(currentRange) &&
|
|
16173
|
+
currentRange.indexOf(this.mentionChar) === -1 && this.isPopupOpen) {
|
|
16174
|
+
this.hidePopup();
|
|
16175
|
+
}
|
|
16176
|
+
return;
|
|
16177
|
+
}
|
|
16178
|
+
if ((!currentRange || !lastWordRange) || e.code === 'Enter' || e.keyCode === 27 ||
|
|
16179
|
+
(lastWordRange.match(Regex) && lastWordRange.match(Regex).length > 1) ||
|
|
16180
|
+
(this.isContentEditable(this.inputElement) && this.range.startContainer &&
|
|
16181
|
+
this.range.startContainer.previousElementSibling && this.range.startContainer.textContent.split('').length > 0 &&
|
|
16182
|
+
(rangetextContent.length === 1 || rangetextContent[rangetextContent.length - 2].indexOf('') === -1 ||
|
|
16183
|
+
this.range.startContainer.nodeType === 1))) {
|
|
16184
|
+
if (this.allowSpaces && currentRange && currentRange.trim() !== '' && charRegex.test(currentRange) && currentRange.indexOf(this.mentionChar) !== -1
|
|
16185
|
+
&& !this.isMatchedText() && (currentRange.length > 1 && currentRange.replace(/\u00A0/g, ' ').charAt(currentRange.length - 2) !== ' ') &&
|
|
16186
|
+
(this.list && this.list.querySelectorAll('ul').length > 0)) {
|
|
16187
|
+
this.queryString = currentRange.substring(currentRange.lastIndexOf(this.mentionChar) + 1).replace('\u00a0', ' ');
|
|
16188
|
+
this.searchLists(e);
|
|
16189
|
+
}
|
|
16190
|
+
else if (this.isPopupOpen && (!this.allowSpaces || !lastWordRange)) {
|
|
16191
|
+
this.hidePopup();
|
|
16192
|
+
this.lineBreak = true;
|
|
16193
|
+
}
|
|
16194
|
+
return;
|
|
16195
|
+
}
|
|
16196
|
+
this.queryString = lastWordRange.replace(this.mentionChar, '');
|
|
16197
|
+
if (this.mentionChar.charCodeAt(0) === lastWordRange.charCodeAt(0) &&
|
|
16198
|
+
this.queryString !== '' && e.keyCode !== 38 && e.keyCode !== 40 && !this.lineBreak) {
|
|
16199
|
+
this.searchLists(e);
|
|
16200
|
+
if (!this.isPopupOpen && this.queryString.length >= this.minLength) {
|
|
16201
|
+
if (!this.isContentEditable(this.inputElement)) {
|
|
16202
|
+
this.showPopup();
|
|
16203
|
+
}
|
|
16204
|
+
else if (this.isContentEditable(this.inputElement) && this.range && this.range.startContainer !== this.inputElement && e.keyCode !== 9) {
|
|
16205
|
+
this.showPopup();
|
|
16206
|
+
}
|
|
16207
|
+
}
|
|
16208
|
+
}
|
|
16209
|
+
else if (lastWordRange.indexOf(this.mentionChar) === 0 && !this.isPopupOpen && e.keyCode !== 8 && (!this.popupObj ||
|
|
16210
|
+
(isNullOrUndefined(this.target) && !document.body.contains(this.popupObj.element) ||
|
|
16211
|
+
!isNullOrUndefined(this.target) && document.body.contains(this.popupObj.element)))) {
|
|
16212
|
+
if (this.initRemoteRender && this.list && this.list.classList.contains('e-nodata')) {
|
|
16213
|
+
this.searchLists(e);
|
|
16214
|
+
}
|
|
16215
|
+
this.resetList(this.dataSource, this.fields);
|
|
16216
|
+
if (isNullOrUndefined(this.list)) {
|
|
16217
|
+
this.initValue();
|
|
16218
|
+
}
|
|
16219
|
+
if (!this.isPopupOpen && e.keyCode !== 38 && e.keyCode !== 40) {
|
|
16220
|
+
this.showPopup();
|
|
16221
|
+
if (this.initRemoteRender && this.list.querySelectorAll('li').length === 0) {
|
|
16222
|
+
this.showWaitingSpinner();
|
|
16223
|
+
}
|
|
16224
|
+
this.lineBreak = false;
|
|
16225
|
+
}
|
|
16226
|
+
}
|
|
16227
|
+
else if (this.allowSpaces && this.queryString !== '' && currentRange && currentRange.trim() !== '' && currentRange.replace('\u00a0', ' ').lastIndexOf(' ') < currentRange.length - 1 &&
|
|
16228
|
+
e.keyCode !== 38 && e.keyCode !== 40 && e.keyCode !== 8 && this.mentionChar.charCodeAt(0) === lastWordRange.charCodeAt(0)) {
|
|
16229
|
+
this.queryString = currentRange.substring(currentRange.lastIndexOf(this.mentionChar) + 1).replace('\u00a0', ' ');
|
|
16230
|
+
this.searchLists(e);
|
|
16231
|
+
}
|
|
16232
|
+
else if (this.queryString === '' && this.isPopupOpen && e.keyCode !== 38 && e.keyCode !== 40 && this.mentionChar.charCodeAt(0) === lastWordRange.charCodeAt(0)) {
|
|
16233
|
+
this.searchLists(e);
|
|
16234
|
+
if (!this.isListResetted) {
|
|
16235
|
+
this.resetList(this.dataSource, this.fields);
|
|
16236
|
+
}
|
|
16237
|
+
}
|
|
16238
|
+
this.isListResetted = false;
|
|
16239
|
+
}
|
|
16240
|
+
isMatchedText() {
|
|
16241
|
+
let isMatched = false;
|
|
16242
|
+
for (let i = 0; i < (this.liCollections && this.liCollections.length); i++) {
|
|
16243
|
+
if (this.getTextRange() &&
|
|
16244
|
+
this.getTextRange().substring(this.getTextRange().lastIndexOf(this.mentionChar) + 1).replace('\u00a0', ' ').trim() === this.liCollections[i].getAttribute('data-value').toLowerCase()) {
|
|
16245
|
+
isMatched = true;
|
|
16246
|
+
}
|
|
16247
|
+
}
|
|
16248
|
+
return isMatched;
|
|
16249
|
+
}
|
|
16250
|
+
getCurrentRange() {
|
|
16251
|
+
this.range = this.inputElement.ownerDocument.getSelection().getRangeAt(0);
|
|
16252
|
+
return this.range;
|
|
16253
|
+
}
|
|
16254
|
+
searchLists(e) {
|
|
16255
|
+
this.isDataFetched = false;
|
|
16256
|
+
if (isNullOrUndefined(this.list)) {
|
|
16257
|
+
super.render();
|
|
16258
|
+
this.unWireListEvents();
|
|
16259
|
+
this.wireListEvents();
|
|
16260
|
+
}
|
|
16261
|
+
if (e.type !== 'mousedown' && (e.keyCode === 40 || e.keyCode === 38)) {
|
|
16262
|
+
this.queryString = this.queryString === '' ? null : this.queryString;
|
|
16263
|
+
this.beforePopupOpen = true;
|
|
16264
|
+
this.resetList(this.dataSource, this.fields);
|
|
16265
|
+
return;
|
|
16266
|
+
}
|
|
16267
|
+
this.isSelected = false;
|
|
16268
|
+
this.activeIndex = null;
|
|
16269
|
+
const eventArgs = {
|
|
16270
|
+
preventDefaultAction: false,
|
|
16271
|
+
text: this.queryString,
|
|
16272
|
+
updateData: (dataSource, query, fields) => {
|
|
16273
|
+
if (eventArgs.cancel) {
|
|
16274
|
+
return;
|
|
16275
|
+
}
|
|
16276
|
+
this.isFiltered = true;
|
|
16277
|
+
this.filterAction(dataSource, query, fields);
|
|
16278
|
+
},
|
|
16279
|
+
cancel: false
|
|
16280
|
+
};
|
|
16281
|
+
this.trigger('filtering', eventArgs, (eventArgs) => {
|
|
16282
|
+
if (!eventArgs.cancel && !this.isFiltered && !eventArgs.preventDefaultAction) {
|
|
16283
|
+
this.filterAction(this.dataSource, null, this.fields);
|
|
16284
|
+
}
|
|
16285
|
+
});
|
|
16286
|
+
}
|
|
16287
|
+
filterAction(dataSource, query, fields) {
|
|
16288
|
+
this.beforePopupOpen = true;
|
|
16289
|
+
if (this.queryString.length >= this.minLength) {
|
|
16290
|
+
this.resetList(dataSource, fields, query);
|
|
16291
|
+
this.isListResetted = true;
|
|
16292
|
+
}
|
|
16293
|
+
else {
|
|
16294
|
+
if (this.isPopupOpen) {
|
|
16295
|
+
this.hidePopup();
|
|
16296
|
+
}
|
|
16297
|
+
this.beforePopupOpen = false;
|
|
16298
|
+
}
|
|
16299
|
+
this.setDataIndex();
|
|
16300
|
+
this.renderReactTemplates();
|
|
16301
|
+
}
|
|
16302
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
16303
|
+
onActionComplete(ulElement, list, e, isUpdated) {
|
|
16304
|
+
super.onActionComplete(ulElement, list, e);
|
|
16305
|
+
if (this.isActive) {
|
|
16306
|
+
if (!isNullOrUndefined(ulElement)) {
|
|
16307
|
+
attributes(ulElement, { 'id': this.inputElement.id + '_options', 'role': 'listbox', 'aria-hidden': 'false' });
|
|
16308
|
+
}
|
|
16309
|
+
let focusItem = ulElement.querySelector('.' + dropDownBaseClasses.li);
|
|
16310
|
+
if (focusItem) {
|
|
16311
|
+
focusItem.classList.add(dropDownBaseClasses.selected);
|
|
16312
|
+
this.selectedLI = focusItem;
|
|
16313
|
+
const value = this.getFormattedValue(focusItem.getAttribute('data-value'));
|
|
16314
|
+
this.selectEventCallback(focusItem, this.getDataByValue(value), value, true);
|
|
16315
|
+
}
|
|
16316
|
+
}
|
|
16317
|
+
}
|
|
16318
|
+
setDataIndex() {
|
|
16319
|
+
for (let i = 0; this.liCollections && i < this.liCollections.length; i++) {
|
|
16320
|
+
this.liCollections[i].setAttribute('data-index', i.toString());
|
|
16321
|
+
}
|
|
16322
|
+
}
|
|
16323
|
+
listOption(dataSource, fieldsSettings) {
|
|
16324
|
+
const fields = super.listOption(dataSource, fieldsSettings);
|
|
16325
|
+
if (isNullOrUndefined(fields.itemCreated)) {
|
|
16326
|
+
fields.itemCreated = (e) => {
|
|
16327
|
+
if (this.highlight) {
|
|
16328
|
+
if (this.inputElement.tagName === this.getNgDirective() && this.itemTemplate) {
|
|
16329
|
+
setTimeout(() => {
|
|
16330
|
+
highlightSearch(e.item, this.queryString, this.ignoreCase, this.filterType);
|
|
16331
|
+
}, 0);
|
|
16332
|
+
}
|
|
16333
|
+
else {
|
|
16334
|
+
highlightSearch(e.item, this.queryString, this.ignoreCase, this.filterType);
|
|
16335
|
+
}
|
|
16336
|
+
}
|
|
16337
|
+
};
|
|
16338
|
+
}
|
|
16339
|
+
else {
|
|
16340
|
+
const itemCreated = fields.itemCreated;
|
|
16341
|
+
fields.itemCreated = (e) => {
|
|
16342
|
+
if (this.highlight) {
|
|
16343
|
+
highlightSearch(e.item, this.queryString, this.ignoreCase, this.filterType);
|
|
16344
|
+
}
|
|
16345
|
+
itemCreated.apply(this, [e]);
|
|
16346
|
+
};
|
|
16347
|
+
}
|
|
16348
|
+
return fields;
|
|
16349
|
+
}
|
|
16350
|
+
elementValue() {
|
|
16351
|
+
if (!this.isContentEditable(this.inputElement)) {
|
|
16352
|
+
return this.inputElement.value.replace(this.mentionChar, '');
|
|
16353
|
+
}
|
|
16354
|
+
else {
|
|
16355
|
+
return this.inputElement.textContent.replace(this.mentionChar, '');
|
|
16356
|
+
}
|
|
16357
|
+
}
|
|
16358
|
+
getQuery(query) {
|
|
16359
|
+
const filterQuery = query ? query.clone() : this.query ? this.query.clone() : new Query();
|
|
16360
|
+
const filterType = (this.queryString === '' && !isNullOrUndefined(this.elementValue())) ? 'equal' : this.filterType;
|
|
16361
|
+
const queryString = (this.queryString === '' && !isNullOrUndefined(this.elementValue())) ?
|
|
16362
|
+
this.elementValue() : this.queryString;
|
|
16363
|
+
if (this.isFiltered) {
|
|
16364
|
+
return filterQuery;
|
|
16365
|
+
}
|
|
16366
|
+
if (this.queryString !== null && this.queryString !== '') {
|
|
16367
|
+
const dataType = this.typeOfData(this.dataSource).typeof;
|
|
16368
|
+
if (!(this.dataSource instanceof DataManager) && dataType === 'string' || dataType === 'number') {
|
|
16369
|
+
filterQuery.where('', filterType, queryString, this.ignoreCase, this.ignoreAccent);
|
|
16370
|
+
}
|
|
16371
|
+
else {
|
|
16372
|
+
const mapping = !isNullOrUndefined(this.fields.text) ? this.fields.text : '';
|
|
16373
|
+
filterQuery.where(mapping, filterType, queryString, this.ignoreCase, this.ignoreAccent);
|
|
16374
|
+
}
|
|
16375
|
+
}
|
|
16376
|
+
if (!isNullOrUndefined(this.suggestionCount)) {
|
|
16377
|
+
// Since defualt value of suggestioncount is 25, checked the condition
|
|
16378
|
+
if (this.suggestionCount !== 25) {
|
|
16379
|
+
for (let queryElements = 0; queryElements < filterQuery.queries.length; queryElements++) {
|
|
16380
|
+
if (filterQuery.queries[queryElements].fn === 'onTake') {
|
|
16381
|
+
filterQuery.queries.splice(queryElements, 1);
|
|
16382
|
+
}
|
|
16383
|
+
}
|
|
16384
|
+
}
|
|
16385
|
+
filterQuery.take(this.suggestionCount);
|
|
16386
|
+
}
|
|
16387
|
+
return filterQuery;
|
|
16388
|
+
}
|
|
16389
|
+
renderHightSearch() {
|
|
16390
|
+
if (this.highlight) {
|
|
16391
|
+
for (let i = 0; i < this.liCollections.length; i++) {
|
|
16392
|
+
const isHighlight = this.ulElement.querySelector('.e-active');
|
|
16393
|
+
if (!isHighlight) {
|
|
16394
|
+
revertHighlightSearch(this.liCollections[i]);
|
|
16395
|
+
highlightSearch(this.liCollections[i], this.queryString, this.ignoreCase, this.filterType);
|
|
16396
|
+
}
|
|
16397
|
+
}
|
|
16398
|
+
}
|
|
16399
|
+
}
|
|
16400
|
+
getTextRange() {
|
|
16401
|
+
let text;
|
|
16402
|
+
if (!this.isContentEditable(this.inputElement)) {
|
|
16403
|
+
const component = this.inputElement;
|
|
16404
|
+
if (!isNullOrUndefined(component)) {
|
|
16405
|
+
const startPos = component.selectionStart;
|
|
16406
|
+
if (component.value && startPos >= 0) {
|
|
16407
|
+
text = component.value.substring(0, startPos);
|
|
16408
|
+
}
|
|
16409
|
+
}
|
|
16410
|
+
}
|
|
16411
|
+
else {
|
|
16412
|
+
if (this.range) {
|
|
16413
|
+
const selectedElem = this.range.startContainer;
|
|
16414
|
+
if (!isNullOrUndefined(selectedElem)) {
|
|
16415
|
+
const workingNodeContent = selectedElem.textContent;
|
|
16416
|
+
const selectStartOffset = this.range.startOffset;
|
|
16417
|
+
if (workingNodeContent && selectStartOffset >= 0) {
|
|
16418
|
+
text = workingNodeContent.substring(0, selectStartOffset);
|
|
16419
|
+
}
|
|
16420
|
+
}
|
|
16421
|
+
}
|
|
16422
|
+
}
|
|
16423
|
+
return text;
|
|
16424
|
+
}
|
|
16425
|
+
getLastLetter(text) {
|
|
16426
|
+
if (isNullOrUndefined(text)) {
|
|
16427
|
+
return '';
|
|
16428
|
+
}
|
|
16429
|
+
const textValue = text.replace(/\u00A0/g, ' ');
|
|
16430
|
+
const words = textValue.split(/\s+/);
|
|
16431
|
+
const wordCnt = words.length - 1;
|
|
16432
|
+
return words[wordCnt].trim();
|
|
16433
|
+
}
|
|
16434
|
+
isContentEditable(element) {
|
|
16435
|
+
return element && element.nodeName !== 'INPUT' && element.nodeName !== 'TEXTAREA';
|
|
16436
|
+
}
|
|
16437
|
+
/**
|
|
16438
|
+
* Opens the popup that displays the list of items.
|
|
16439
|
+
*
|
|
16440
|
+
* @returns {void}
|
|
16441
|
+
*/
|
|
16442
|
+
showPopup() {
|
|
16443
|
+
this.beforePopupOpen = true;
|
|
16444
|
+
if (isNullOrUndefined(this.list)) {
|
|
16445
|
+
this.initValue();
|
|
16446
|
+
}
|
|
16447
|
+
this.renderPopup();
|
|
16448
|
+
attributes(this.inputElement, { 'aria-activedescendant': this.selectedElementID });
|
|
16449
|
+
if (this.selectedElementID == null) {
|
|
16450
|
+
this.inputElement.removeAttribute('aria-activedescendant');
|
|
16451
|
+
}
|
|
16452
|
+
}
|
|
16453
|
+
/* eslint-disable valid-jsdoc, jsdoc/require-param */
|
|
16454
|
+
/**
|
|
16455
|
+
* Hides the popup if it is in an open state.
|
|
16456
|
+
*
|
|
16457
|
+
* @returns {void}
|
|
16458
|
+
*/
|
|
16459
|
+
hidePopup(e) {
|
|
16460
|
+
this.removeSelection();
|
|
16461
|
+
this.closePopup(0, e);
|
|
16462
|
+
}
|
|
16463
|
+
closePopup(delay, e) {
|
|
16464
|
+
if (!(this.popupObj && document.body.contains(this.popupObj.element) && this.beforePopupOpen)) {
|
|
16465
|
+
return;
|
|
16466
|
+
}
|
|
16467
|
+
EventHandler.remove(document, 'mousedown', this.onDocumentClick);
|
|
16468
|
+
this.inputElement.removeAttribute('aria-owns');
|
|
16469
|
+
this.inputElement.removeAttribute('aria-activedescendant');
|
|
16470
|
+
this.beforePopupOpen = false;
|
|
16471
|
+
const animModel = {
|
|
16472
|
+
name: 'FadeOut',
|
|
16473
|
+
duration: 100,
|
|
16474
|
+
delay: delay ? delay : 0
|
|
16475
|
+
};
|
|
16476
|
+
const popupInstance = this.popupObj;
|
|
16477
|
+
const eventArgs = { popup: popupInstance, cancel: false, animation: animModel, event: e || null };
|
|
16478
|
+
this.trigger('closed', eventArgs, (eventArgs) => {
|
|
16479
|
+
if (!eventArgs.cancel && this.popupObj) {
|
|
16480
|
+
if (this.isPopupOpen) {
|
|
16481
|
+
this.popupObj.hide(new Animation(eventArgs.animation));
|
|
16482
|
+
}
|
|
16483
|
+
else {
|
|
16484
|
+
this.destroyPopup();
|
|
16485
|
+
}
|
|
16486
|
+
}
|
|
16487
|
+
});
|
|
16488
|
+
}
|
|
16489
|
+
renderPopup() {
|
|
16490
|
+
const args = { cancel: false };
|
|
16491
|
+
this.trigger('beforeOpen', args, (args) => {
|
|
16492
|
+
if (!args.cancel) {
|
|
16493
|
+
let popupEle;
|
|
16494
|
+
if (isNullOrUndefined(this.target)) {
|
|
16495
|
+
popupEle = this.createElement('div', {
|
|
16496
|
+
id: this.inputElement.id + '_popup', className: 'e-mention e-popup ' + (this.cssClass != null ? this.cssClass : '')
|
|
16497
|
+
});
|
|
16498
|
+
}
|
|
16499
|
+
else {
|
|
16500
|
+
popupEle = this.element;
|
|
16501
|
+
if (this.cssClass != null) {
|
|
16502
|
+
addClass([popupEle], this.cssClass.split(' '));
|
|
16503
|
+
}
|
|
16504
|
+
}
|
|
16505
|
+
if (!isNullOrUndefined(this.target)) {
|
|
16506
|
+
popupEle.id = this.inputElement.id + '_popup';
|
|
16507
|
+
addClass([popupEle], ['e-mention', 'e-popup', 'e-popup-close']);
|
|
16508
|
+
}
|
|
16509
|
+
this.listHeight = formatUnit(this.popupHeight);
|
|
16510
|
+
if (!isNullOrUndefined(this.list.querySelector('li')) && !this.initRemoteRender) {
|
|
16511
|
+
const li = this.list.querySelector('.' + dropDownBaseClasses.focus);
|
|
16512
|
+
if (!isNullOrUndefined(li)) {
|
|
16513
|
+
this.selectedLI = li;
|
|
16514
|
+
const value = this.getFormattedValue(li.getAttribute('data-value'));
|
|
16515
|
+
this.selectEventCallback(li, this.getDataByValue(value), value, true);
|
|
16516
|
+
}
|
|
16517
|
+
}
|
|
16518
|
+
append([this.list], popupEle);
|
|
16519
|
+
if ((!this.popupObj || !document.body.contains(this.popupObj.element)) ||
|
|
16520
|
+
!document.contains(popupEle) && isNullOrUndefined(this.target)) {
|
|
16521
|
+
document.body.appendChild(popupEle);
|
|
16522
|
+
}
|
|
16523
|
+
let coordinates;
|
|
16524
|
+
popupEle.style.visibility = 'hidden';
|
|
16525
|
+
this.setHeight(popupEle);
|
|
16526
|
+
const offsetValue = 0;
|
|
16527
|
+
const left = 0;
|
|
16528
|
+
this.initializePopup(popupEle, offsetValue, left);
|
|
16529
|
+
this.checkCollision(popupEle);
|
|
16530
|
+
popupEle.style.visibility = 'visible';
|
|
16531
|
+
if (!isNullOrUndefined(this.list)) {
|
|
16532
|
+
this.unWireListEvents();
|
|
16533
|
+
this.wireListEvents();
|
|
16534
|
+
}
|
|
16535
|
+
this.selectedElementID = this.selectedLI ? this.selectedLI.id : null;
|
|
16536
|
+
attributes(this.inputElement, { 'aria-owns': this.inputElement.id + '_options', 'aria-activedescendant': this.selectedElementID });
|
|
16537
|
+
if (this.selectedElementID == null) {
|
|
16538
|
+
this.inputElement.removeAttribute('aria-activedescendant');
|
|
16539
|
+
}
|
|
16540
|
+
const animModel = { name: 'FadeIn', duration: 100 };
|
|
16541
|
+
this.beforePopupOpen = true;
|
|
16542
|
+
const popupInstance = this.popupObj;
|
|
16543
|
+
const eventArgs = { popup: popupInstance, cancel: false, animation: animModel };
|
|
16544
|
+
this.trigger('opened', eventArgs, (eventArgs) => {
|
|
16545
|
+
if (!eventArgs.cancel) {
|
|
16546
|
+
this.renderReactTemplates();
|
|
16547
|
+
this.popupObj.show(new Animation(eventArgs.animation), (this.zIndex === 1000) ? this.inputElement : null);
|
|
16548
|
+
if (isNullOrUndefined(this.getTriggerCharPosition())) {
|
|
16549
|
+
return;
|
|
16550
|
+
}
|
|
16551
|
+
coordinates = this.getCoordinates(this.inputElement, this.getTriggerCharPosition());
|
|
16552
|
+
if (!this.isCollided) {
|
|
16553
|
+
popupEle.style.cssText = 'top: '.concat(coordinates.top.toString(), 'px;\n left: ').concat(coordinates.left.toString(), 'px;\nposition: absolute;\n display: block;');
|
|
16554
|
+
}
|
|
16555
|
+
else {
|
|
16556
|
+
popupEle.style.left = formatUnit(coordinates.left);
|
|
16557
|
+
this.isCollided = false;
|
|
16558
|
+
}
|
|
16559
|
+
popupEle.style.width = this.popupWidth !== '100%' && !isNullOrUndefined(this.popupWidth) ? formatUnit(this.popupWidth) : 'auto';
|
|
16560
|
+
this.setHeight(popupEle);
|
|
16561
|
+
popupEle.style.zIndex = this.zIndex === 1000 ? getZindexPartial(popupEle).toString() : this.zIndex.toString();
|
|
16562
|
+
}
|
|
16563
|
+
else {
|
|
16564
|
+
this.beforePopupOpen = false;
|
|
16565
|
+
this.destroyPopup();
|
|
16566
|
+
}
|
|
16567
|
+
});
|
|
16568
|
+
}
|
|
16569
|
+
else {
|
|
16570
|
+
this.beforePopupOpen = false;
|
|
16571
|
+
}
|
|
16572
|
+
});
|
|
16573
|
+
}
|
|
16574
|
+
setHeight(popupEle) {
|
|
16575
|
+
if (this.popupHeight !== 'auto') {
|
|
16576
|
+
this.list.style.maxHeight = (parseInt(this.listHeight, 10) - 2).toString() + 'px'; // due to box-sizing property
|
|
16577
|
+
popupEle.style.maxHeight = formatUnit(this.popupHeight);
|
|
16578
|
+
}
|
|
16579
|
+
else {
|
|
16580
|
+
popupEle.style.height = 'auto';
|
|
16581
|
+
}
|
|
16582
|
+
}
|
|
16583
|
+
checkCollision(popupEle) {
|
|
16584
|
+
if (!Browser.isDevice || (Browser.isDevice && !(this.getModuleName() === 'mention'))) {
|
|
16585
|
+
const collision = isCollide(popupEle);
|
|
16586
|
+
if (collision.length > 0) {
|
|
16587
|
+
popupEle.style.marginTop = -parseInt(getComputedStyle(popupEle).marginTop, 10) + 'px';
|
|
16588
|
+
this.isCollided = true;
|
|
16589
|
+
}
|
|
16590
|
+
this.popupObj.resolveCollision();
|
|
16591
|
+
}
|
|
16592
|
+
}
|
|
16593
|
+
getTriggerCharPosition() {
|
|
16594
|
+
let mostRecentTriggerCharPos;
|
|
16595
|
+
const currentRange = this.getTextRange();
|
|
16596
|
+
if (currentRange !== undefined && currentRange !== null) {
|
|
16597
|
+
mostRecentTriggerCharPos = 0;
|
|
16598
|
+
const idx = currentRange.lastIndexOf(this.mentionChar);
|
|
16599
|
+
if (idx >= mostRecentTriggerCharPos) {
|
|
16600
|
+
mostRecentTriggerCharPos = idx;
|
|
16601
|
+
}
|
|
16602
|
+
}
|
|
16603
|
+
return mostRecentTriggerCharPos;
|
|
16604
|
+
}
|
|
16605
|
+
initializePopup(element, offsetValue, left) {
|
|
16606
|
+
this.popupObj = new Popup(element, {
|
|
16607
|
+
width: this.setWidth(), targetType: 'relative',
|
|
16608
|
+
relateTo: this.inputElement, collision: { X: 'flip', Y: 'flip' }, offsetY: offsetValue,
|
|
16609
|
+
enableRtl: this.enableRtl, offsetX: left, position: { X: 'top', Y: 'left' }, actionOnScroll: 'hide',
|
|
16610
|
+
zIndex: this.zIndex,
|
|
16611
|
+
close: () => {
|
|
16612
|
+
this.destroyPopup();
|
|
16613
|
+
},
|
|
16614
|
+
open: () => {
|
|
16615
|
+
EventHandler.add(document, 'mousedown', this.onDocumentClick, this);
|
|
16616
|
+
this.isPopupOpen = true;
|
|
16617
|
+
this.setDataIndex();
|
|
16618
|
+
}
|
|
16619
|
+
});
|
|
16620
|
+
}
|
|
16621
|
+
setWidth() {
|
|
16622
|
+
let width = formatUnit(this.popupWidth);
|
|
16623
|
+
if (width.indexOf('%') > -1) {
|
|
16624
|
+
const inputWidth = this.inputElement.offsetWidth * parseFloat(width) / 100;
|
|
16625
|
+
width = inputWidth.toString() + 'px';
|
|
16626
|
+
}
|
|
16627
|
+
return width;
|
|
16628
|
+
}
|
|
16629
|
+
destroyPopup() {
|
|
16630
|
+
this.isPopupOpen = false;
|
|
16631
|
+
this.popupObj.destroy();
|
|
16632
|
+
if (isNullOrUndefined(this.target)) {
|
|
16633
|
+
detach(this.popupObj.element);
|
|
16634
|
+
}
|
|
16635
|
+
else {
|
|
16636
|
+
this.popupObj.element.innerHTML = '';
|
|
16637
|
+
this.popupObj.element.removeAttribute('style');
|
|
16638
|
+
this.popupObj.element.removeAttribute('aria-disabled');
|
|
16639
|
+
}
|
|
16640
|
+
}
|
|
16641
|
+
onDocumentClick(e) {
|
|
16642
|
+
const target = e.target;
|
|
16643
|
+
if (!(!isNullOrUndefined(this.popupObj) && closest(target, '#' + this.popupObj.element.id))) {
|
|
16644
|
+
this.hidePopup(e);
|
|
16645
|
+
}
|
|
16646
|
+
}
|
|
16647
|
+
getCoordinates(element, position) {
|
|
16648
|
+
const properties = ['direction', 'boxSizing', 'width', 'height', 'overflowX', 'overflowY', 'borderTopWidth', 'borderRightWidth', 'borderBottomWidth', 'borderLeftWidth', 'paddingTop', 'paddingRight', 'paddingBottom', 'paddingLeft', 'fontStyle', 'fontVariant', 'fontWeight', 'fontStretch', 'fontSize', 'fontSizeAdjust', 'lineHeight', 'fontFamily', 'textAlign', 'textTransform', 'textIndent', 'textDecoration', 'letterSpacing', 'wordSpacing'];
|
|
16649
|
+
let div;
|
|
16650
|
+
let span;
|
|
16651
|
+
let range;
|
|
16652
|
+
let globalRange;
|
|
16653
|
+
let coordinates;
|
|
16654
|
+
let computed;
|
|
16655
|
+
let rect;
|
|
16656
|
+
if (!this.isContentEditable(this.inputElement)) {
|
|
16657
|
+
div = this.createElement('div', { className: 'e-form-mirror-div' });
|
|
16658
|
+
document.body.appendChild(div);
|
|
16659
|
+
computed = getComputedStyle(element);
|
|
16660
|
+
div.style.position = 'absolute';
|
|
16661
|
+
div.style.visibility = 'hidden';
|
|
16662
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
16663
|
+
properties.forEach((prop) => {
|
|
16664
|
+
// eslint-disable-next-line security/detect-object-injection
|
|
16665
|
+
div.style[prop] = computed[prop];
|
|
16666
|
+
});
|
|
16667
|
+
div.textContent = element.value.substring(0, position);
|
|
16668
|
+
if (this.inputElement.nodeName === 'INPUT') {
|
|
16669
|
+
div.textContent = div.textContent.replace(/\s/g, '\u00a0');
|
|
16670
|
+
}
|
|
16671
|
+
span = this.createElement('span');
|
|
16672
|
+
span.textContent = element.value.substring(position) || '.';
|
|
16673
|
+
div.appendChild(span);
|
|
16674
|
+
rect = element.getBoundingClientRect();
|
|
16675
|
+
}
|
|
16676
|
+
else {
|
|
16677
|
+
const selectedNodePosition = this.getTriggerCharPosition();
|
|
16678
|
+
globalRange = this.range;
|
|
16679
|
+
range = document.createRange();
|
|
16680
|
+
range.setStart(globalRange.startContainer, selectedNodePosition);
|
|
16681
|
+
range.setEnd(globalRange.startContainer, selectedNodePosition);
|
|
16682
|
+
range.collapse(false);
|
|
16683
|
+
rect = range.getBoundingClientRect();
|
|
16684
|
+
}
|
|
16685
|
+
const doc = document.documentElement;
|
|
16686
|
+
const windowLeft = (window.pageXOffset || doc.scrollLeft) - (doc.clientLeft || 0);
|
|
16687
|
+
const windowTop = (window.pageYOffset || doc.scrollTop) - (doc.clientTop || 0);
|
|
16688
|
+
if (!this.isContentEditable(this.inputElement)) {
|
|
16689
|
+
coordinates = {
|
|
16690
|
+
top: rect.top + windowTop + span.offsetTop + parseInt(computed.borderTopWidth, 10) +
|
|
16691
|
+
parseInt(computed.fontSize, 10) + 3 - element.scrollTop,
|
|
16692
|
+
left: rect.left + windowLeft + span.offsetLeft + parseInt(computed.borderLeftWidth, 10)
|
|
16693
|
+
};
|
|
16694
|
+
document.body.removeChild(div);
|
|
16695
|
+
}
|
|
16696
|
+
else {
|
|
16697
|
+
coordinates = {
|
|
16698
|
+
top: rect.top + windowTop + parseInt(getComputedStyle(this.inputElement).fontSize, 10),
|
|
16699
|
+
left: rect.left + windowLeft
|
|
16700
|
+
};
|
|
16701
|
+
}
|
|
16702
|
+
return coordinates;
|
|
16703
|
+
}
|
|
16704
|
+
initValue() {
|
|
16705
|
+
this.renderList();
|
|
16706
|
+
if (this.dataSource instanceof DataManager) {
|
|
16707
|
+
this.initRemoteRender = true;
|
|
16708
|
+
}
|
|
16709
|
+
else {
|
|
16710
|
+
this.updateValues();
|
|
16711
|
+
}
|
|
16712
|
+
}
|
|
16713
|
+
updateValues() {
|
|
16714
|
+
const li = this.list.querySelector('.' + dropDownBaseClasses.focus);
|
|
16715
|
+
if (!isNullOrUndefined(li)) {
|
|
16716
|
+
this.setSelection(li, null);
|
|
16717
|
+
}
|
|
16718
|
+
}
|
|
16719
|
+
renderList() {
|
|
16720
|
+
super.render();
|
|
16721
|
+
this.unWireListEvents();
|
|
16722
|
+
this.wireListEvents();
|
|
16723
|
+
}
|
|
16724
|
+
/**
|
|
16725
|
+
* Event binding for list
|
|
16726
|
+
*
|
|
16727
|
+
* @returns {void}
|
|
16728
|
+
*/
|
|
16729
|
+
wireListEvents() {
|
|
16730
|
+
EventHandler.add(this.list, 'click', this.onMouseClick, this);
|
|
16731
|
+
EventHandler.add(this.list, 'mouseover', this.onMouseOver, this);
|
|
16732
|
+
EventHandler.add(this.list, 'mouseout', this.onMouseLeave, this);
|
|
16733
|
+
}
|
|
16734
|
+
/**
|
|
16735
|
+
* Event un binding for list items.
|
|
16736
|
+
*
|
|
16737
|
+
* @returns {void}
|
|
16738
|
+
*/
|
|
16739
|
+
unWireListEvents() {
|
|
16740
|
+
EventHandler.remove(this.list, 'click', this.onMouseClick);
|
|
16741
|
+
EventHandler.remove(this.list, 'mouseover', this.onMouseOver);
|
|
16742
|
+
EventHandler.remove(this.list, 'mouseout', this.onMouseLeave);
|
|
16743
|
+
}
|
|
16744
|
+
onMouseClick(e) {
|
|
16745
|
+
const target = e.target;
|
|
16746
|
+
const li = closest(target, '.' + dropDownBaseClasses.li);
|
|
16747
|
+
if (!this.isValidLI(li)) {
|
|
16748
|
+
return;
|
|
16749
|
+
}
|
|
16750
|
+
this.setSelection(li, e);
|
|
16751
|
+
const delay = 100;
|
|
16752
|
+
this.closePopup(delay, e);
|
|
16753
|
+
this.inputElement.focus();
|
|
16754
|
+
}
|
|
16755
|
+
updateSelectedItem(li, e, preventSelect, isSelection) {
|
|
16756
|
+
this.removeSelection();
|
|
16757
|
+
li.classList.add(dropDownBaseClasses.selected);
|
|
16758
|
+
this.removeHover();
|
|
16759
|
+
const value = this.getFormattedValue(li.getAttribute('data-value'));
|
|
16760
|
+
const selectedData = this.getDataByValue(value);
|
|
16761
|
+
if (!preventSelect && !isNullOrUndefined(e)) {
|
|
16762
|
+
const items = this.detachChanges(selectedData);
|
|
16763
|
+
this.isSelected = true;
|
|
16764
|
+
const eventArgs = {
|
|
16765
|
+
e: e,
|
|
16766
|
+
item: li,
|
|
16767
|
+
itemData: items,
|
|
16768
|
+
isInteracted: e ? true : false,
|
|
16769
|
+
cancel: false
|
|
16770
|
+
};
|
|
16771
|
+
this.trigger('select', eventArgs, (eventArgs) => {
|
|
16772
|
+
if (eventArgs.cancel) {
|
|
16773
|
+
li.classList.remove(dropDownBaseClasses.selected);
|
|
16774
|
+
}
|
|
16775
|
+
else {
|
|
16776
|
+
this.selectEventCallback(li, selectedData, value);
|
|
16777
|
+
if (isSelection) {
|
|
16778
|
+
this.setSelectOptions(li, e);
|
|
16779
|
+
}
|
|
16780
|
+
}
|
|
16781
|
+
});
|
|
16782
|
+
}
|
|
16783
|
+
else {
|
|
16784
|
+
this.selectEventCallback(li, selectedData, value);
|
|
16785
|
+
if (isSelection) {
|
|
16786
|
+
this.setSelectOptions(li, e);
|
|
16787
|
+
}
|
|
16788
|
+
}
|
|
16789
|
+
}
|
|
16790
|
+
setSelection(li, e) {
|
|
16791
|
+
if (this.isValidLI(li) && (!li.classList.contains(dropDownBaseClasses.selected) || (this.isPopupOpen && this.isSelected
|
|
16792
|
+
&& li.classList.contains(dropDownBaseClasses.selected)))) {
|
|
16793
|
+
this.updateSelectedItem(li, e, false, true);
|
|
16794
|
+
}
|
|
16795
|
+
else {
|
|
16796
|
+
this.setSelectOptions(li, e);
|
|
16797
|
+
}
|
|
16798
|
+
}
|
|
16799
|
+
setSelectOptions(li, e) {
|
|
16800
|
+
if (this.list) {
|
|
16801
|
+
this.removeHover();
|
|
16802
|
+
}
|
|
16803
|
+
this.previousSelectedLI = (!isNullOrUndefined(this.selectedLI)) ? this.selectedLI : null;
|
|
16804
|
+
this.selectedLI = li;
|
|
16805
|
+
if (this.isPopupOpen && !isNullOrUndefined(this.selectedLI)) {
|
|
16806
|
+
this.setScrollPosition(e);
|
|
16807
|
+
}
|
|
16808
|
+
if (e && (e.keyCode === 38 || e.keyCode === 40)) {
|
|
16809
|
+
return;
|
|
16810
|
+
}
|
|
16811
|
+
if (isNullOrUndefined(e) || this.setValue(e)) {
|
|
16812
|
+
return;
|
|
16813
|
+
}
|
|
16814
|
+
}
|
|
16815
|
+
setScrollPosition(e) {
|
|
16816
|
+
if (!isNullOrUndefined(e)) {
|
|
16817
|
+
switch (e.action) {
|
|
16818
|
+
case 'pageDown':
|
|
16819
|
+
case 'down':
|
|
16820
|
+
case 'end':
|
|
16821
|
+
this.scrollBottom();
|
|
16822
|
+
break;
|
|
16823
|
+
default:
|
|
16824
|
+
this.scrollTop();
|
|
16825
|
+
break;
|
|
16826
|
+
}
|
|
16827
|
+
}
|
|
16828
|
+
else {
|
|
16829
|
+
this.scrollBottom(true);
|
|
16830
|
+
}
|
|
16831
|
+
}
|
|
16832
|
+
scrollBottom(isInitial) {
|
|
16833
|
+
if (!isNullOrUndefined(this.selectedLI)) {
|
|
16834
|
+
const currentOffset = this.list.offsetHeight;
|
|
16835
|
+
const nextBottom = this.selectedLI.offsetTop + this.selectedLI.offsetHeight - this.list.scrollTop;
|
|
16836
|
+
let nextOffset = this.list.scrollTop + nextBottom - currentOffset;
|
|
16837
|
+
nextOffset = isInitial ? nextOffset + parseInt(getComputedStyle(this.list).paddingTop, 10) * 2 : nextOffset;
|
|
16838
|
+
const boxRange = this.selectedLI.offsetTop + this.selectedLI.offsetHeight - this.list.scrollTop;
|
|
16839
|
+
if (this.activeIndex === 0) {
|
|
16840
|
+
this.list.scrollTop = 0;
|
|
16841
|
+
}
|
|
16842
|
+
else if (nextBottom > currentOffset || !(boxRange > 0 && this.list.offsetHeight > boxRange)) {
|
|
16843
|
+
this.list.scrollTop = nextOffset;
|
|
16844
|
+
}
|
|
16845
|
+
}
|
|
16846
|
+
}
|
|
16847
|
+
scrollTop() {
|
|
16848
|
+
if (!isNullOrUndefined(this.selectedLI)) {
|
|
16849
|
+
let nextOffset = this.selectedLI.offsetTop - this.list.scrollTop;
|
|
16850
|
+
nextOffset = this.fields.groupBy && nextOffset;
|
|
16851
|
+
const boxRange = (this.selectedLI.offsetTop + this.selectedLI.offsetHeight - this.list.scrollTop);
|
|
16852
|
+
if (this.activeIndex === 0) {
|
|
16853
|
+
this.list.scrollTop = 0;
|
|
16854
|
+
}
|
|
16855
|
+
else if (nextOffset < 0) {
|
|
16856
|
+
this.list.scrollTop = this.list.scrollTop + nextOffset;
|
|
16857
|
+
}
|
|
16858
|
+
else if (!(boxRange > 0 && this.list.offsetHeight > boxRange)) {
|
|
16859
|
+
this.list.scrollTop = this.selectedLI.offsetTop;
|
|
16860
|
+
}
|
|
16861
|
+
}
|
|
16862
|
+
}
|
|
16863
|
+
selectEventCallback(li, selectedData, value, selectLi) {
|
|
16864
|
+
this.previousItemData = (!isNullOrUndefined(this.itemData)) ? this.itemData : null;
|
|
16865
|
+
this.item = li;
|
|
16866
|
+
this.itemData = selectedData;
|
|
16867
|
+
const focusedItem = this.list.querySelector('.' + dropDownBaseClasses.focus);
|
|
16868
|
+
if (focusedItem) {
|
|
16869
|
+
removeClass([focusedItem], dropDownBaseClasses.focus);
|
|
16870
|
+
}
|
|
16871
|
+
if (selectLi) {
|
|
16872
|
+
addClass([li], dropDownBaseClasses.selected);
|
|
16873
|
+
}
|
|
16874
|
+
li.setAttribute('aria-selected', 'true');
|
|
16875
|
+
this.activeIndex = this.getIndexByValue(value);
|
|
16876
|
+
}
|
|
16877
|
+
detachChanges(value) {
|
|
16878
|
+
let items;
|
|
16879
|
+
if (typeof value === 'string' ||
|
|
16880
|
+
typeof value === 'boolean' ||
|
|
16881
|
+
typeof value === 'number') {
|
|
16882
|
+
items = Object.defineProperties({}, {
|
|
16883
|
+
value: {
|
|
16884
|
+
value: value,
|
|
16885
|
+
enumerable: true
|
|
16886
|
+
},
|
|
16887
|
+
text: {
|
|
16888
|
+
value: value,
|
|
16889
|
+
enumerable: true
|
|
16890
|
+
}
|
|
16891
|
+
});
|
|
16892
|
+
}
|
|
16893
|
+
else {
|
|
16894
|
+
items = value;
|
|
16895
|
+
}
|
|
16896
|
+
return items;
|
|
16897
|
+
}
|
|
16898
|
+
setValue(e) {
|
|
16899
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
16900
|
+
if (!this.isReact) {
|
|
16901
|
+
if (!isNullOrUndefined(this.displayTemplate)) {
|
|
16902
|
+
this.setDisplayTemplate();
|
|
16903
|
+
}
|
|
16904
|
+
this.updateMentionValue(e);
|
|
16905
|
+
return true;
|
|
16906
|
+
}
|
|
16907
|
+
else {
|
|
16908
|
+
if (!isNullOrUndefined(this.displayTemplate)) {
|
|
16909
|
+
this.setDisplayTemplate(e);
|
|
16910
|
+
}
|
|
16911
|
+
else {
|
|
16912
|
+
this.updateMentionValue(e);
|
|
16913
|
+
}
|
|
16914
|
+
return true;
|
|
16915
|
+
}
|
|
16916
|
+
}
|
|
16917
|
+
updateMentionValue(e) {
|
|
16918
|
+
const dataItem = this.getItemData();
|
|
16919
|
+
let textSuffix;
|
|
16920
|
+
let value;
|
|
16921
|
+
let endPos;
|
|
16922
|
+
let range;
|
|
16923
|
+
let globalRange;
|
|
16924
|
+
const selection = this.inputElement.ownerDocument.getSelection();
|
|
16925
|
+
const startPos = this.getTriggerCharPosition();
|
|
16926
|
+
textSuffix = typeof this.suffixText === 'string' ? this.suffixText : '';
|
|
16927
|
+
if (dataItem.text !== null) {
|
|
16928
|
+
value = this.mentionVal(dataItem.text);
|
|
16929
|
+
}
|
|
16930
|
+
if (!this.isContentEditable(this.inputElement)) {
|
|
16931
|
+
const myField = this.inputElement;
|
|
16932
|
+
const currentTriggerSnippet = this.getTextRange().substring(startPos + this.mentionChar.length, this.getTextRange().length);
|
|
16933
|
+
value += textSuffix;
|
|
16934
|
+
endPos = startPos + this.mentionChar.length;
|
|
16935
|
+
endPos += currentTriggerSnippet.length;
|
|
16936
|
+
myField.value = myField.value.substring(0, startPos) + value + myField.value.substring(endPos, myField.value.length);
|
|
16937
|
+
myField.selectionStart = startPos + value.length;
|
|
16938
|
+
myField.selectionEnd = startPos + value.length;
|
|
16939
|
+
if (this.isPopupOpen) {
|
|
16940
|
+
this.hidePopup();
|
|
16941
|
+
}
|
|
16942
|
+
this.onChangeEvent(e);
|
|
16943
|
+
}
|
|
16944
|
+
else {
|
|
16945
|
+
endPos = this.getTriggerCharPosition() + this.mentionChar.length;
|
|
16946
|
+
if (this.range && (this.range.startContainer.textContent.trim() !== this.mentionChar)) {
|
|
16947
|
+
endPos = this.range.endOffset;
|
|
16948
|
+
}
|
|
16949
|
+
globalRange = this.range;
|
|
16950
|
+
range = document.createRange();
|
|
16951
|
+
range.setStart(globalRange.startContainer, startPos);
|
|
16952
|
+
range.setEnd(globalRange.startContainer, endPos);
|
|
16953
|
+
range.deleteContents();
|
|
16954
|
+
const element = this.createElement('div');
|
|
16955
|
+
element.innerHTML = value;
|
|
16956
|
+
const frag = document.createDocumentFragment();
|
|
16957
|
+
let node;
|
|
16958
|
+
let lastNode;
|
|
16959
|
+
// eslint-disable-next-line no-cond-assign
|
|
16960
|
+
while (node = element.firstChild) {
|
|
16961
|
+
lastNode = frag.appendChild(node);
|
|
16962
|
+
}
|
|
16963
|
+
range.insertNode(frag);
|
|
16964
|
+
if (lastNode) {
|
|
16965
|
+
range = range.cloneRange();
|
|
16966
|
+
range.setStartAfter(lastNode);
|
|
16967
|
+
range.collapse(true);
|
|
16968
|
+
selection.removeAllRanges();
|
|
16969
|
+
selection.addRange(range);
|
|
16970
|
+
}
|
|
16971
|
+
if (this.isPopupOpen) {
|
|
16972
|
+
this.hidePopup();
|
|
16973
|
+
}
|
|
16974
|
+
this.onChangeEvent(e);
|
|
16975
|
+
}
|
|
16976
|
+
}
|
|
16977
|
+
mentionVal(value) {
|
|
16978
|
+
const showChar = this.showMentionChar ? this.mentionChar : '';
|
|
16979
|
+
if (!isNullOrUndefined(this.displayTemplate) && !isNullOrUndefined(this.displayTempElement)) {
|
|
16980
|
+
value = this.displayTempElement.innerHTML;
|
|
16981
|
+
}
|
|
16982
|
+
if (this.isContentEditable(this.inputElement)) {
|
|
16983
|
+
return '<span contenteditable="false" class="e-mention-chip">' + showChar + value + '</span>'.concat(typeof this.suffixText === 'string' ? this.suffixText : ' ');
|
|
16984
|
+
}
|
|
16985
|
+
else {
|
|
16986
|
+
return showChar + value;
|
|
16987
|
+
}
|
|
16988
|
+
}
|
|
16989
|
+
setDisplayTemplate(e) {
|
|
16990
|
+
let compiledString;
|
|
16991
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
16992
|
+
if (this.isReact) {
|
|
16993
|
+
this.clearTemplate(['displayTemplate']);
|
|
16994
|
+
if (this.displayTempElement) {
|
|
16995
|
+
detach(this.displayTempElement);
|
|
16996
|
+
this.displayTempElement = null;
|
|
16997
|
+
}
|
|
16998
|
+
}
|
|
16999
|
+
if (!this.displayTempElement) {
|
|
17000
|
+
this.displayTempElement = this.createElement('div');
|
|
17001
|
+
}
|
|
17002
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
17003
|
+
if (!this.isReact) {
|
|
17004
|
+
this.displayTempElement.innerHTML = '';
|
|
17005
|
+
}
|
|
17006
|
+
compiledString = compile(this.displayTemplate);
|
|
17007
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
17008
|
+
const displayCompTemp = compiledString(this.itemData, this, 'displayTemplate', this.displayTemplateId, this.isStringTemplate, null, this.displayTempElement);
|
|
17009
|
+
if (displayCompTemp && displayCompTemp.length > 0) {
|
|
17010
|
+
for (let i = 0; i < displayCompTemp.length; i++) {
|
|
17011
|
+
this.displayTempElement.appendChild(displayCompTemp[i]);
|
|
17012
|
+
}
|
|
17013
|
+
}
|
|
17014
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
17015
|
+
if (!this.isReact) {
|
|
17016
|
+
this.renderTemplates();
|
|
17017
|
+
}
|
|
17018
|
+
else {
|
|
17019
|
+
this.renderTemplates(() => {
|
|
17020
|
+
this.updateMentionValue(e);
|
|
17021
|
+
});
|
|
17022
|
+
}
|
|
17023
|
+
}
|
|
17024
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
17025
|
+
renderTemplates(callBack) {
|
|
17026
|
+
this.renderReactTemplates(callBack);
|
|
17027
|
+
}
|
|
17028
|
+
setSpinnerTemplate() {
|
|
17029
|
+
let compiledString;
|
|
17030
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
17031
|
+
if (this.isReact) {
|
|
17032
|
+
this.clearTemplate(['spinnerTemplate']);
|
|
17033
|
+
if (this.spinnerTemplateElement) {
|
|
17034
|
+
detach(this.spinnerTemplateElement);
|
|
17035
|
+
this.spinnerTemplateElement = null;
|
|
17036
|
+
}
|
|
17037
|
+
}
|
|
17038
|
+
if (!this.spinnerTemplateElement) {
|
|
17039
|
+
this.spinnerTemplateElement = this.createElement('div');
|
|
17040
|
+
}
|
|
17041
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
17042
|
+
if (!this.isReact) {
|
|
17043
|
+
this.spinnerTemplateElement.innerHTML = '';
|
|
17044
|
+
}
|
|
17045
|
+
compiledString = compile(this.spinnerTemplate);
|
|
17046
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
17047
|
+
const spinnerCompTemp = compiledString(null, this, 'spinnerTemplate', this.spinnerTemplateId, this.isStringTemplate, null, this.spinnerTemplateElement);
|
|
17048
|
+
if (spinnerCompTemp && spinnerCompTemp.length > 0) {
|
|
17049
|
+
for (let i = 0; i < spinnerCompTemp.length; i++) {
|
|
17050
|
+
this.spinnerTemplateElement.appendChild(spinnerCompTemp[i]);
|
|
17051
|
+
}
|
|
17052
|
+
}
|
|
17053
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
17054
|
+
if (!this.isReact) {
|
|
17055
|
+
this.renderTemplates();
|
|
17056
|
+
this.popupObj.element.appendChild(this.spinnerTemplateElement);
|
|
17057
|
+
}
|
|
17058
|
+
else {
|
|
17059
|
+
this.renderTemplates(() => {
|
|
17060
|
+
this.popupObj.element.appendChild(this.spinnerTemplateElement);
|
|
17061
|
+
});
|
|
17062
|
+
}
|
|
17063
|
+
}
|
|
17064
|
+
onChangeEvent(eve) {
|
|
17065
|
+
this.isSelected = false;
|
|
17066
|
+
const items = this.detachMentionChanges(this.itemData);
|
|
17067
|
+
let preItems;
|
|
17068
|
+
if (typeof this.previousItemData === 'string' ||
|
|
17069
|
+
typeof this.previousItemData === 'boolean' ||
|
|
17070
|
+
typeof this.previousItemData === 'number') {
|
|
17071
|
+
preItems = Object.defineProperties({}, {
|
|
17072
|
+
value: {
|
|
17073
|
+
value: this.previousItemData,
|
|
17074
|
+
enumerable: true
|
|
17075
|
+
},
|
|
17076
|
+
text: {
|
|
17077
|
+
value: this.previousItemData,
|
|
17078
|
+
enumerable: true
|
|
17079
|
+
}
|
|
17080
|
+
});
|
|
17081
|
+
}
|
|
17082
|
+
else {
|
|
17083
|
+
preItems = this.previousItemData;
|
|
17084
|
+
}
|
|
17085
|
+
const eventArgs = {
|
|
17086
|
+
e: eve,
|
|
17087
|
+
item: this.item,
|
|
17088
|
+
itemData: items,
|
|
17089
|
+
previousItem: this.previousSelectedLI,
|
|
17090
|
+
previousItemData: preItems,
|
|
17091
|
+
isInteracted: eve ? true : false,
|
|
17092
|
+
value: this.item.innerHTML,
|
|
17093
|
+
element: this.inputElement
|
|
17094
|
+
};
|
|
17095
|
+
this.trigger('change', eventArgs);
|
|
17096
|
+
}
|
|
17097
|
+
detachMentionChanges(value) {
|
|
17098
|
+
let items;
|
|
17099
|
+
if (typeof value === 'string' ||
|
|
17100
|
+
typeof value === 'boolean' ||
|
|
17101
|
+
typeof value === 'number') {
|
|
17102
|
+
items = Object.defineProperties({}, {
|
|
17103
|
+
value: {
|
|
17104
|
+
value: value,
|
|
17105
|
+
enumerable: true
|
|
17106
|
+
},
|
|
17107
|
+
text: {
|
|
17108
|
+
value: value,
|
|
17109
|
+
enumerable: true
|
|
17110
|
+
}
|
|
17111
|
+
});
|
|
17112
|
+
}
|
|
17113
|
+
else {
|
|
17114
|
+
items = value;
|
|
17115
|
+
}
|
|
17116
|
+
return items;
|
|
17117
|
+
}
|
|
17118
|
+
getItemData() {
|
|
17119
|
+
const fields = this.fields;
|
|
17120
|
+
let dataItem = null;
|
|
17121
|
+
dataItem = this.itemData;
|
|
17122
|
+
let dataValue;
|
|
17123
|
+
let dataText;
|
|
17124
|
+
if (!isNullOrUndefined(dataItem)) {
|
|
17125
|
+
dataValue = getValue(fields.value, dataItem);
|
|
17126
|
+
dataText = getValue(fields.text, dataItem);
|
|
17127
|
+
}
|
|
17128
|
+
const value = (!isNullOrUndefined(dataItem) &&
|
|
17129
|
+
!isUndefined(dataValue) ? dataValue : dataItem);
|
|
17130
|
+
const text = (!isNullOrUndefined(dataItem) &&
|
|
17131
|
+
!isUndefined(dataValue) ? dataText : dataItem);
|
|
17132
|
+
return { value: value, text: text };
|
|
17133
|
+
}
|
|
17134
|
+
removeSelection() {
|
|
17135
|
+
if (this.list) {
|
|
17136
|
+
const selectedItems = this.list.querySelectorAll('.' + dropDownBaseClasses.selected);
|
|
17137
|
+
if (selectedItems.length) {
|
|
17138
|
+
removeClass(selectedItems, dropDownBaseClasses.selected);
|
|
17139
|
+
selectedItems[0].removeAttribute('aria-selected');
|
|
17140
|
+
}
|
|
17141
|
+
}
|
|
17142
|
+
}
|
|
17143
|
+
onMouseOver(e) {
|
|
17144
|
+
const currentLi = closest(e.target, '.' + dropDownBaseClasses.li);
|
|
17145
|
+
this.setHover(currentLi);
|
|
17146
|
+
}
|
|
17147
|
+
setHover(li) {
|
|
17148
|
+
if (this.isValidLI(li) && !li.classList.contains(dropDownBaseClasses.hover)) {
|
|
17149
|
+
this.removeHover();
|
|
17150
|
+
addClass([li], dropDownBaseClasses.hover);
|
|
17151
|
+
}
|
|
17152
|
+
}
|
|
17153
|
+
removeHover() {
|
|
17154
|
+
if (this.list) {
|
|
17155
|
+
const hoveredItem = this.list.querySelectorAll('.' + dropDownBaseClasses.hover);
|
|
17156
|
+
if (hoveredItem && hoveredItem.length) {
|
|
17157
|
+
removeClass(hoveredItem, dropDownBaseClasses.hover);
|
|
17158
|
+
}
|
|
17159
|
+
}
|
|
17160
|
+
}
|
|
17161
|
+
isValidLI(li) {
|
|
17162
|
+
return (li && li.hasAttribute('role') && li.getAttribute('role') === 'option');
|
|
17163
|
+
}
|
|
17164
|
+
onMouseLeave() {
|
|
17165
|
+
this.removeHover();
|
|
17166
|
+
}
|
|
17167
|
+
/**
|
|
17168
|
+
* Search the entered text and show it in the suggestion list if available.
|
|
17169
|
+
*
|
|
17170
|
+
* @returns {void}
|
|
17171
|
+
*/
|
|
17172
|
+
search(text, positionX, positionY) {
|
|
17173
|
+
if (this.isContentEditable(this.inputElement)) {
|
|
17174
|
+
this.range = this.getCurrentRange();
|
|
17175
|
+
}
|
|
17176
|
+
const currentRange = this.getTextRange();
|
|
17177
|
+
const lastWordRange = this.getLastLetter(currentRange);
|
|
17178
|
+
if ((this.ignoreCase && (text === lastWordRange || text === lastWordRange.toLowerCase()))
|
|
17179
|
+
|| !this.ignoreCase && text === lastWordRange) {
|
|
17180
|
+
this.resetList(this.dataSource, this.fields);
|
|
17181
|
+
}
|
|
17182
|
+
else {
|
|
17183
|
+
if (this.isPopupOpen) {
|
|
17184
|
+
this.hidePopup();
|
|
17185
|
+
}
|
|
17186
|
+
return;
|
|
17187
|
+
}
|
|
17188
|
+
if (isNullOrUndefined(this.list)) {
|
|
17189
|
+
this.renderList();
|
|
17190
|
+
this.renderPopup();
|
|
17191
|
+
}
|
|
17192
|
+
else {
|
|
17193
|
+
this.showPopup();
|
|
17194
|
+
}
|
|
17195
|
+
this.popupObj.element.style.left = formatUnit(positionX);
|
|
17196
|
+
this.popupObj.element.style.top = formatUnit(positionY);
|
|
17197
|
+
}
|
|
17198
|
+
/**
|
|
17199
|
+
* Removes the component from the DOM and detaches all its related event handlers. Also it removes the attributes and classes.
|
|
17200
|
+
*
|
|
17201
|
+
* @method destroy
|
|
17202
|
+
* @returns {void}
|
|
17203
|
+
*/
|
|
17204
|
+
destroy() {
|
|
17205
|
+
this.hidePopup();
|
|
17206
|
+
this.unWireEvent();
|
|
17207
|
+
if (this.list) {
|
|
17208
|
+
this.unWireListEvents();
|
|
17209
|
+
}
|
|
17210
|
+
if (this.inputElement && !this.inputElement.classList.contains('e-' + this.getModuleName())) {
|
|
17211
|
+
return;
|
|
17212
|
+
}
|
|
17213
|
+
super.destroy();
|
|
17214
|
+
}
|
|
17215
|
+
getLocaleName() {
|
|
17216
|
+
return 'mention';
|
|
17217
|
+
}
|
|
17218
|
+
getNgDirective() {
|
|
17219
|
+
return 'EJS-MENTION';
|
|
17220
|
+
}
|
|
17221
|
+
/**
|
|
17222
|
+
* Return the module name of this component.
|
|
17223
|
+
*
|
|
17224
|
+
* @private
|
|
17225
|
+
* @returns {string} Return the module name of this component.
|
|
17226
|
+
*/
|
|
17227
|
+
getModuleName() {
|
|
17228
|
+
return 'mention';
|
|
17229
|
+
}
|
|
17230
|
+
};
|
|
17231
|
+
__decorate$7([
|
|
17232
|
+
Property(null)
|
|
17233
|
+
], Mention.prototype, "cssClass", void 0);
|
|
17234
|
+
__decorate$7([
|
|
17235
|
+
Property('@')
|
|
17236
|
+
], Mention.prototype, "mentionChar", void 0);
|
|
17237
|
+
__decorate$7([
|
|
17238
|
+
Property(false)
|
|
17239
|
+
], Mention.prototype, "showMentionChar", void 0);
|
|
17240
|
+
__decorate$7([
|
|
17241
|
+
Property(false)
|
|
17242
|
+
], Mention.prototype, "allowSpaces", void 0);
|
|
17243
|
+
__decorate$7([
|
|
17244
|
+
Property(null)
|
|
17245
|
+
], Mention.prototype, "suffixText", void 0);
|
|
17246
|
+
__decorate$7([
|
|
17247
|
+
Property(25)
|
|
17248
|
+
], Mention.prototype, "suggestionCount", void 0);
|
|
17249
|
+
__decorate$7([
|
|
17250
|
+
Property(0)
|
|
17251
|
+
], Mention.prototype, "minLength", void 0);
|
|
17252
|
+
__decorate$7([
|
|
17253
|
+
Property('None')
|
|
17254
|
+
], Mention.prototype, "sortOrder", void 0);
|
|
17255
|
+
__decorate$7([
|
|
17256
|
+
Property(true)
|
|
17257
|
+
], Mention.prototype, "ignoreCase", void 0);
|
|
17258
|
+
__decorate$7([
|
|
17259
|
+
Property(false)
|
|
17260
|
+
], Mention.prototype, "highlight", void 0);
|
|
17261
|
+
__decorate$7([
|
|
17262
|
+
Property()
|
|
17263
|
+
], Mention.prototype, "locale", void 0);
|
|
17264
|
+
__decorate$7([
|
|
17265
|
+
Property('auto')
|
|
17266
|
+
], Mention.prototype, "popupWidth", void 0);
|
|
17267
|
+
__decorate$7([
|
|
17268
|
+
Property('300px')
|
|
17269
|
+
], Mention.prototype, "popupHeight", void 0);
|
|
17270
|
+
__decorate$7([
|
|
17271
|
+
Property(null)
|
|
17272
|
+
], Mention.prototype, "displayTemplate", void 0);
|
|
17273
|
+
__decorate$7([
|
|
17274
|
+
Property(null)
|
|
17275
|
+
], Mention.prototype, "itemTemplate", void 0);
|
|
17276
|
+
__decorate$7([
|
|
17277
|
+
Property('No records found')
|
|
17278
|
+
], Mention.prototype, "noRecordsTemplate", void 0);
|
|
17279
|
+
__decorate$7([
|
|
17280
|
+
Property(null)
|
|
17281
|
+
], Mention.prototype, "spinnerTemplate", void 0);
|
|
17282
|
+
__decorate$7([
|
|
17283
|
+
Property()
|
|
17284
|
+
], Mention.prototype, "target", void 0);
|
|
17285
|
+
__decorate$7([
|
|
17286
|
+
Property([])
|
|
17287
|
+
], Mention.prototype, "dataSource", void 0);
|
|
17288
|
+
__decorate$7([
|
|
17289
|
+
Property(null)
|
|
17290
|
+
], Mention.prototype, "query", void 0);
|
|
17291
|
+
__decorate$7([
|
|
17292
|
+
Property('Contains')
|
|
17293
|
+
], Mention.prototype, "filterType", void 0);
|
|
17294
|
+
__decorate$7([
|
|
17295
|
+
Complex({ text: null, value: null, iconCss: null, groupBy: null }, FieldSettings)
|
|
17296
|
+
], Mention.prototype, "fields", void 0);
|
|
17297
|
+
__decorate$7([
|
|
17298
|
+
Event()
|
|
17299
|
+
], Mention.prototype, "actionBegin", void 0);
|
|
17300
|
+
__decorate$7([
|
|
17301
|
+
Event()
|
|
17302
|
+
], Mention.prototype, "actionComplete", void 0);
|
|
17303
|
+
__decorate$7([
|
|
17304
|
+
Event()
|
|
17305
|
+
], Mention.prototype, "actionFailure", void 0);
|
|
17306
|
+
__decorate$7([
|
|
17307
|
+
Event()
|
|
17308
|
+
], Mention.prototype, "change", void 0);
|
|
17309
|
+
__decorate$7([
|
|
17310
|
+
Event()
|
|
17311
|
+
], Mention.prototype, "beforeOpen", void 0);
|
|
17312
|
+
__decorate$7([
|
|
17313
|
+
Event()
|
|
17314
|
+
], Mention.prototype, "opened", void 0);
|
|
17315
|
+
__decorate$7([
|
|
17316
|
+
Event()
|
|
17317
|
+
], Mention.prototype, "closed", void 0);
|
|
17318
|
+
__decorate$7([
|
|
17319
|
+
Event()
|
|
17320
|
+
], Mention.prototype, "select", void 0);
|
|
17321
|
+
__decorate$7([
|
|
17322
|
+
Event()
|
|
17323
|
+
], Mention.prototype, "filtering", void 0);
|
|
17324
|
+
__decorate$7([
|
|
17325
|
+
Event()
|
|
17326
|
+
], Mention.prototype, "created", void 0);
|
|
17327
|
+
__decorate$7([
|
|
17328
|
+
Event()
|
|
17329
|
+
], Mention.prototype, "destroyed", void 0);
|
|
17330
|
+
Mention = __decorate$7([
|
|
17331
|
+
NotifyPropertyChanges
|
|
17332
|
+
], Mention);
|
|
17333
|
+
|
|
15570
17334
|
/**
|
|
15571
17335
|
* export all modules from current location
|
|
15572
17336
|
*/
|
|
@@ -15575,5 +17339,5 @@ const listBoxClasses = {
|
|
|
15575
17339
|
* export all modules from current location
|
|
15576
17340
|
*/
|
|
15577
17341
|
|
|
15578
|
-
export { incrementalSearch, Search, escapeCharRegExp, resetIncrementalSearchValues, highlightSearch, revertHighlightSearch, FieldSettings, dropDownBaseClasses, DropDownBase, dropDownListClasses, DropDownList, Fields, TreeSettings, DropDownTree, ComboBox, AutoComplete, MultiSelect, CheckBoxSelection, createFloatLabel, updateFloatLabelState, removeFloating, setPlaceHolder, floatLabelFocus, floatLabelBlur, encodePlaceholder, SelectionSettings, ToolbarSettings, ListBox };
|
|
17342
|
+
export { incrementalSearch, Search, escapeCharRegExp, resetIncrementalSearchValues, highlightSearch, revertHighlightSearch, FieldSettings, dropDownBaseClasses, DropDownBase, dropDownListClasses, DropDownList, Fields, TreeSettings, DropDownTree, ComboBox, AutoComplete, MultiSelect, CheckBoxSelection, createFloatLabel, updateFloatLabelState, removeFloating, setPlaceHolder, floatLabelFocus, floatLabelBlur, encodePlaceholder, SelectionSettings, ToolbarSettings, ListBox, Mention };
|
|
15579
17343
|
//# sourceMappingURL=ej2-dropdowns.es2015.js.map
|