@syncfusion/ej2-dropdowns 20.2.39 → 20.2.43-1234
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 +123 -2
- package/GitLeaksReport.json +1 -0
- 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 +2260 -446
- package/dist/es6/ej2-dropdowns.es2015.js.map +1 -1
- package/dist/es6/ej2-dropdowns.es5.js +2303 -459
- 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/gitleaks-ci/gitleaks +0 -0
- package/gitleaks-ci.tar.gz +0 -0
- 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 +196 -90
- 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 +51 -15
- 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 +22 -0
- package/src/list-box/list-box.js +86 -31
- 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 +10 -5
- package/src/multi-select/multi-select.js +313 -189
- 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) {
|
|
@@ -2049,9 +2079,9 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
2049
2079
|
}
|
|
2050
2080
|
if (!this.readonly) {
|
|
2051
2081
|
const isTabAction = e.action === 'tab' || e.action === 'close';
|
|
2052
|
-
if (this.list
|
|
2082
|
+
if (isNullOrUndefined(this.list) && !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,6 +2977,9 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
2933
2977
|
}
|
|
2934
2978
|
this.initial = false;
|
|
2935
2979
|
}
|
|
2980
|
+
else if (this.getModuleName() === 'autocomplete' && this.value) {
|
|
2981
|
+
this.setInputValue();
|
|
2982
|
+
}
|
|
2936
2983
|
if (this.getModuleName() !== 'autocomplete' && this.isFiltering() && !this.isTyped) {
|
|
2937
2984
|
if (!this.actionCompleteData.isUpdated || ((!this.isCustomFilter
|
|
2938
2985
|
&& !this.isFilterFocus) || (isNullOrUndefined(this.itemData) && this.allowFiltering)
|
|
@@ -2954,10 +3001,17 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
2954
3001
|
}
|
|
2955
3002
|
}
|
|
2956
3003
|
if (this.beforePopupOpen) {
|
|
2957
|
-
this.renderPopup();
|
|
3004
|
+
this.renderPopup(e);
|
|
2958
3005
|
}
|
|
2959
3006
|
}
|
|
2960
3007
|
}
|
|
3008
|
+
checkFieldValue(list, fieldValue) {
|
|
3009
|
+
let checkField = list;
|
|
3010
|
+
fieldValue.forEach((value) => {
|
|
3011
|
+
checkField = checkField[value];
|
|
3012
|
+
});
|
|
3013
|
+
return checkField;
|
|
3014
|
+
}
|
|
2961
3015
|
updateActionCompleteDataValues(ulElement, list) {
|
|
2962
3016
|
this.actionCompleteData = { ulElement: ulElement.cloneNode(true), list: list, isUpdated: true };
|
|
2963
3017
|
if (this.actionData.list !== this.actionCompleteData.list && this.actionCompleteData.ulElement && this.actionCompleteData.list) {
|
|
@@ -3024,7 +3078,7 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
3024
3078
|
removeClass(highlightedItem, dropDownListClasses.focus);
|
|
3025
3079
|
}
|
|
3026
3080
|
}
|
|
3027
|
-
renderPopup() {
|
|
3081
|
+
renderPopup(e) {
|
|
3028
3082
|
if (this.popupObj && document.body.contains(this.popupObj.element)) {
|
|
3029
3083
|
this.refreshPopup();
|
|
3030
3084
|
return;
|
|
@@ -3080,9 +3134,11 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
3080
3134
|
(this.isDropDownClick && this.getModuleName() === 'combobox')))) {
|
|
3081
3135
|
offsetValue = this.getOffsetValue(popupEle);
|
|
3082
3136
|
const firstItem = this.isEmptyList() ? this.list : this.liCollections[0];
|
|
3083
|
-
|
|
3084
|
-
parseInt(getComputedStyle(
|
|
3085
|
-
|
|
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
|
+
}
|
|
3086
3142
|
}
|
|
3087
3143
|
this.getFocusElement();
|
|
3088
3144
|
this.createPopup(popupEle, offsetValue, left);
|
|
@@ -3112,25 +3168,28 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
3112
3168
|
for (const element of scrollParentElements) {
|
|
3113
3169
|
EventHandler.add(element, 'scroll', this.scrollHandler, this);
|
|
3114
3170
|
}
|
|
3115
|
-
if (Browser.isDevice && this.isFilterLayout()) {
|
|
3116
|
-
EventHandler.add(this.list, 'scroll', this.listScroll, this);
|
|
3117
|
-
}
|
|
3118
3171
|
if (!isNullOrUndefined(this.list)) {
|
|
3119
3172
|
this.unWireListEvents();
|
|
3120
3173
|
this.wireListEvents();
|
|
3121
3174
|
}
|
|
3122
|
-
|
|
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');
|
|
3123
3178
|
const inputParent = this.isFiltering() ? this.filterInput.parentElement : this.inputWrapper.container;
|
|
3124
3179
|
addClass([inputParent], [dropDownListClasses.inputFocus]);
|
|
3125
3180
|
const animModel = { name: 'FadeIn', duration: 100 };
|
|
3126
3181
|
this.beforePopupOpen = true;
|
|
3127
3182
|
const popupInstance = this.popupObj;
|
|
3128
|
-
const eventArgs = { popup: popupInstance, cancel: false, animation: animModel };
|
|
3183
|
+
const eventArgs = { popup: popupInstance, event: e, cancel: false, animation: animModel };
|
|
3129
3184
|
this.trigger('open', eventArgs, (eventArgs) => {
|
|
3130
3185
|
if (!eventArgs.cancel) {
|
|
3131
|
-
|
|
3186
|
+
if (!isNullOrUndefined(this.inputWrapper)) {
|
|
3187
|
+
addClass([this.inputWrapper.container], [dropDownListClasses.iconAnimation]);
|
|
3188
|
+
}
|
|
3132
3189
|
this.renderReactTemplates();
|
|
3133
|
-
|
|
3190
|
+
if (!isNullOrUndefined(this.popupObj)) {
|
|
3191
|
+
this.popupObj.show(new Animation(eventArgs.animation), (this.zIndex === 1000) ? this.element : null);
|
|
3192
|
+
}
|
|
3134
3193
|
}
|
|
3135
3194
|
else {
|
|
3136
3195
|
this.beforePopupOpen = false;
|
|
@@ -3187,6 +3246,12 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
3187
3246
|
const actionList = this.actionCompleteData && this.actionCompleteData.ulElement &&
|
|
3188
3247
|
this.actionCompleteData.ulElement.querySelector('li');
|
|
3189
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
|
+
}
|
|
3190
3255
|
if (this.isFiltering() && this.itemTemplate && (this.element.tagName === this.getNgDirective()) &&
|
|
3191
3256
|
(actionList && ulElement && actionList.textContent !== ulElement.textContent) &&
|
|
3192
3257
|
this.element.tagName !== 'EJS-COMBOBOX') {
|
|
@@ -3342,9 +3407,6 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
3342
3407
|
this.filterInput.value = this.typedString = '';
|
|
3343
3408
|
this.searchLists(null);
|
|
3344
3409
|
}
|
|
3345
|
-
listScroll() {
|
|
3346
|
-
this.filterInput.blur();
|
|
3347
|
-
}
|
|
3348
3410
|
setEleWidth(width) {
|
|
3349
3411
|
if (!isNullOrUndefined(width)) {
|
|
3350
3412
|
if (typeof width === 'number') {
|
|
@@ -3371,7 +3433,6 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
3371
3433
|
}
|
|
3372
3434
|
if (Browser.isDevice && this.isFilterLayout()) {
|
|
3373
3435
|
removeClass([document.body, this.popupObj.element], dropDownListClasses.popupFullScreen);
|
|
3374
|
-
EventHandler.remove(this.list, 'scroll', this.listScroll);
|
|
3375
3436
|
}
|
|
3376
3437
|
if (this.isFilterLayout()) {
|
|
3377
3438
|
if (!Browser.isDevice) {
|
|
@@ -3384,14 +3445,19 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
3384
3445
|
EventHandler.remove(this.backIconElement, 'click', this.clickOnBackIcon);
|
|
3385
3446
|
EventHandler.remove(this.clearIconElement, 'click', this.clearText);
|
|
3386
3447
|
}
|
|
3387
|
-
|
|
3388
|
-
|
|
3389
|
-
|
|
3390
|
-
|
|
3391
|
-
|
|
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
|
+
}
|
|
3392
3455
|
this.filterInput = null;
|
|
3393
3456
|
}
|
|
3394
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');
|
|
3395
3461
|
this.inputWrapper.container.classList.remove(dropDownListClasses.iconAnimation);
|
|
3396
3462
|
if (this.isFiltering()) {
|
|
3397
3463
|
this.actionCompleteData.isUpdated = false;
|
|
@@ -3444,14 +3510,15 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
3444
3510
|
if (this.element.tagName === 'INPUT') {
|
|
3445
3511
|
this.inputElement = this.element;
|
|
3446
3512
|
if (isNullOrUndefined(this.inputElement.getAttribute('role'))) {
|
|
3447
|
-
this.inputElement.setAttribute('role', '
|
|
3513
|
+
this.inputElement.setAttribute('role', 'combobox');
|
|
3448
3514
|
}
|
|
3449
3515
|
if (isNullOrUndefined(this.inputElement.getAttribute('type'))) {
|
|
3450
3516
|
this.inputElement.setAttribute('type', 'text');
|
|
3451
3517
|
}
|
|
3518
|
+
this.inputElement.setAttribute('aria-expanded', 'false');
|
|
3452
3519
|
}
|
|
3453
3520
|
else {
|
|
3454
|
-
this.inputElement = this.createElement('input', { attrs: { role: '
|
|
3521
|
+
this.inputElement = this.createElement('input', { attrs: { role: 'combobox', type: 'text' } });
|
|
3455
3522
|
if (this.element.tagName !== this.getNgDirective()) {
|
|
3456
3523
|
this.element.style.display = 'none';
|
|
3457
3524
|
}
|
|
@@ -3462,6 +3529,9 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
3462
3529
|
if (!isNullOrUndefined(this.cssClass) && this.cssClass !== '') {
|
|
3463
3530
|
updatedCssClassValues = (this.cssClass.replace(/\s+/g, ' ')).trim();
|
|
3464
3531
|
}
|
|
3532
|
+
if (!isNullOrUndefined(closest(this.element, "fieldset")) && closest(this.element, "fieldset").disabled) {
|
|
3533
|
+
this.enabled = false;
|
|
3534
|
+
}
|
|
3465
3535
|
this.inputWrapper = Input.createInput({
|
|
3466
3536
|
element: this.inputElement,
|
|
3467
3537
|
buttons: this.isPopupButton() ? [dropDownListClasses.icon] : null,
|
|
@@ -3490,6 +3560,10 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
3490
3560
|
this.setFields();
|
|
3491
3561
|
this.inputWrapper.container.style.width = formatUnit(this.width);
|
|
3492
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
|
+
}
|
|
3493
3567
|
this.wireEvent();
|
|
3494
3568
|
this.tabIndex = this.element.hasAttribute('tabindex') ? this.element.getAttribute('tabindex') : '0';
|
|
3495
3569
|
this.element.removeAttribute('tabindex');
|
|
@@ -3500,6 +3574,9 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
3500
3574
|
attributes(this.targetElement(), this.getAriaAttributes());
|
|
3501
3575
|
this.updateDataAttribute(this.htmlAttributes);
|
|
3502
3576
|
this.setHTMLAttributes();
|
|
3577
|
+
if (this.targetElement() === this.inputElement) {
|
|
3578
|
+
this.inputElement.removeAttribute('aria-labelledby');
|
|
3579
|
+
}
|
|
3503
3580
|
if (this.value !== null || this.activeIndex !== null || this.text !== null) {
|
|
3504
3581
|
this.initValue();
|
|
3505
3582
|
}
|
|
@@ -3509,6 +3586,7 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
3509
3586
|
this.text = isNullOrUndefined(this.value) ? null : selectElement.options[selectElement.selectedIndex].textContent;
|
|
3510
3587
|
this.initValue();
|
|
3511
3588
|
}
|
|
3589
|
+
this.setEnabled();
|
|
3512
3590
|
this.preventTabIndex(this.element);
|
|
3513
3591
|
if (!this.enabled) {
|
|
3514
3592
|
this.targetElement().tabIndex = -1;
|
|
@@ -3530,12 +3608,22 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
3530
3608
|
if (this.element.hasAttribute('data-val')) {
|
|
3531
3609
|
this.element.setAttribute('data-val', 'false');
|
|
3532
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
|
+
}
|
|
3533
3616
|
this.renderComplete();
|
|
3534
3617
|
}
|
|
3535
3618
|
setFooterTemplate(popupEle) {
|
|
3536
3619
|
let compiledString;
|
|
3537
3620
|
if (this.footer) {
|
|
3538
|
-
this.
|
|
3621
|
+
if (this.isReact) {
|
|
3622
|
+
this.clearTemplate(['footerTemplate']);
|
|
3623
|
+
}
|
|
3624
|
+
else {
|
|
3625
|
+
this.footer.innerHTML = '';
|
|
3626
|
+
}
|
|
3539
3627
|
}
|
|
3540
3628
|
else {
|
|
3541
3629
|
this.footer = this.createElement('div');
|
|
@@ -3583,6 +3671,14 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
3583
3671
|
const contentEle = popupEle.querySelector('div.e-content');
|
|
3584
3672
|
popupEle.insertBefore(this.header, contentEle);
|
|
3585
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
|
+
}
|
|
3586
3682
|
setOldText(text) {
|
|
3587
3683
|
this.text = text;
|
|
3588
3684
|
}
|
|
@@ -3669,6 +3765,7 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
3669
3765
|
break;
|
|
3670
3766
|
case 'width':
|
|
3671
3767
|
this.setEleWidth(newProp.width);
|
|
3768
|
+
Input.calculateWidth(this.inputElement, this.inputWrapper.container);
|
|
3672
3769
|
break;
|
|
3673
3770
|
case 'placeholder':
|
|
3674
3771
|
Input.setPlaceholder(newProp.placeholder, this.inputElement);
|
|
@@ -3686,6 +3783,7 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
3686
3783
|
break;
|
|
3687
3784
|
case 'cssClass':
|
|
3688
3785
|
this.setCssClass(newProp.cssClass, oldProp.cssClass);
|
|
3786
|
+
Input.calculateWidth(this.inputElement, this.inputWrapper.container);
|
|
3689
3787
|
break;
|
|
3690
3788
|
case 'enableRtl':
|
|
3691
3789
|
this.setEnableRtl();
|
|
@@ -3726,6 +3824,9 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
3726
3824
|
}
|
|
3727
3825
|
});
|
|
3728
3826
|
}
|
|
3827
|
+
else if (this.getModuleName() === 'autocomplete') {
|
|
3828
|
+
this.setInputValue(newProp, oldProp);
|
|
3829
|
+
}
|
|
3729
3830
|
else {
|
|
3730
3831
|
this.setOldText(oldProp.text);
|
|
3731
3832
|
}
|
|
@@ -3767,6 +3868,9 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
3767
3868
|
}
|
|
3768
3869
|
});
|
|
3769
3870
|
}
|
|
3871
|
+
else if (this.getModuleName() === 'autocomplete') {
|
|
3872
|
+
this.setInputValue(newProp, oldProp);
|
|
3873
|
+
}
|
|
3770
3874
|
else {
|
|
3771
3875
|
this.setOldValue(oldProp.value);
|
|
3772
3876
|
}
|
|
@@ -3826,6 +3930,9 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
3826
3930
|
case 'floatLabelType':
|
|
3827
3931
|
Input.removeFloating(this.inputWrapper);
|
|
3828
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
|
+
}
|
|
3829
3936
|
break;
|
|
3830
3937
|
case 'showClearButton':
|
|
3831
3938
|
Input.setClearButton(newProp.showClearButton, this.inputElement, this.inputWrapper, null, this.createElement);
|
|
@@ -3879,6 +3986,8 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
3879
3986
|
removeClass([this.inputWrapper.container], ['e-readonly']);
|
|
3880
3987
|
}
|
|
3881
3988
|
}
|
|
3989
|
+
setInputValue(newProp, oldProp) {
|
|
3990
|
+
}
|
|
3882
3991
|
setCssClass(newClass, oldClass) {
|
|
3883
3992
|
if (!isNullOrUndefined(oldClass)) {
|
|
3884
3993
|
oldClass = (oldClass.replace(/\s+/g, ' ')).trim();
|
|
@@ -3905,7 +4014,7 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
3905
4014
|
*
|
|
3906
4015
|
* @returns {void}
|
|
3907
4016
|
*/
|
|
3908
|
-
showPopup() {
|
|
4017
|
+
showPopup(e) {
|
|
3909
4018
|
if (!this.enabled) {
|
|
3910
4019
|
return;
|
|
3911
4020
|
}
|
|
@@ -3925,11 +4034,11 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
3925
4034
|
}
|
|
3926
4035
|
else if (isNullOrUndefined(this.list) || !isUndefined(this.list) && (this.list.classList.contains(dropDownBaseClasses.noData) ||
|
|
3927
4036
|
this.list.querySelectorAll('.' + dropDownBaseClasses.li).length <= 0)) {
|
|
3928
|
-
this.renderList();
|
|
4037
|
+
this.renderList(e);
|
|
3929
4038
|
}
|
|
3930
|
-
this.invokeRenderPopup();
|
|
4039
|
+
this.invokeRenderPopup(e);
|
|
3931
4040
|
}
|
|
3932
|
-
invokeRenderPopup() {
|
|
4041
|
+
invokeRenderPopup(e) {
|
|
3933
4042
|
if (Browser.isDevice && this.isFilterLayout()) {
|
|
3934
4043
|
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
3935
4044
|
const proxy = this;
|
|
@@ -3938,10 +4047,9 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
3938
4047
|
};
|
|
3939
4048
|
history.pushState({}, '');
|
|
3940
4049
|
}
|
|
3941
|
-
if (!isNullOrUndefined(this.list.children[0]) || this.list.classList.contains(dropDownBaseClasses.noData)) {
|
|
3942
|
-
this.renderPopup();
|
|
4050
|
+
if (!isNullOrUndefined(this.list) && (!isNullOrUndefined(this.list.children[0]) || this.list.classList.contains(dropDownBaseClasses.noData))) {
|
|
4051
|
+
this.renderPopup(e);
|
|
3943
4052
|
}
|
|
3944
|
-
attributes(this.targetElement(), { 'aria-activedescendant': this.selectedLI ? this.selectedLI.id : null });
|
|
3945
4053
|
}
|
|
3946
4054
|
renderHightSearch() {
|
|
3947
4055
|
// update high light search
|
|
@@ -3955,7 +4063,9 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
3955
4063
|
hidePopup(e) {
|
|
3956
4064
|
/* eslint-enable valid-jsdoc, jsdoc/require-param */
|
|
3957
4065
|
if (this.isEscapeKey && this.getModuleName() === 'dropdownlist') {
|
|
3958
|
-
|
|
4066
|
+
if (!isNullOrUndefined(this.inputElement)) {
|
|
4067
|
+
Input.setValue(this.text, this.inputElement, this.floatLabelType, this.showClearButton);
|
|
4068
|
+
}
|
|
3959
4069
|
this.isEscapeKey = false;
|
|
3960
4070
|
if (!isNullOrUndefined(this.index)) {
|
|
3961
4071
|
const element = this.findListElement(this.ulElement, 'li', 'data-value', this.value);
|
|
@@ -4005,6 +4115,7 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
4005
4115
|
}
|
|
4006
4116
|
addClass([this.inputWrapper.container], [dropDownListClasses.inputFocus]);
|
|
4007
4117
|
this.onFocus(e);
|
|
4118
|
+
Input.calculateWidth(this.inputElement, this.inputWrapper.container);
|
|
4008
4119
|
}
|
|
4009
4120
|
/**
|
|
4010
4121
|
* Moves the focus from the component if the component is already focused.
|
|
@@ -4022,6 +4133,7 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
4022
4133
|
this.targetElement().blur();
|
|
4023
4134
|
}
|
|
4024
4135
|
removeClass([this.inputWrapper.container], [dropDownListClasses.inputFocus]);
|
|
4136
|
+
Input.calculateWidth(this.inputElement, this.inputWrapper.container);
|
|
4025
4137
|
}
|
|
4026
4138
|
/**
|
|
4027
4139
|
* Removes the component from the DOM and detaches all its related event handlers. Also it removes the attributes and classes.
|
|
@@ -4045,10 +4157,9 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
4045
4157
|
return;
|
|
4046
4158
|
}
|
|
4047
4159
|
if (this.inputElement) {
|
|
4048
|
-
const attrArray = ['readonly', 'aria-disabled', 'aria-
|
|
4049
|
-
'
|
|
4050
|
-
'aria-
|
|
4051
|
-
'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'];
|
|
4052
4163
|
for (let i = 0; i < attrArray.length; i++) {
|
|
4053
4164
|
this.inputElement.removeAttribute(attrArray[i]);
|
|
4054
4165
|
}
|
|
@@ -4064,6 +4175,21 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
4064
4175
|
this.inputWrapper.container.parentElement.insertBefore(this.element, this.inputWrapper.container);
|
|
4065
4176
|
detach(this.inputWrapper.container);
|
|
4066
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;
|
|
4067
4193
|
super.destroy();
|
|
4068
4194
|
}
|
|
4069
4195
|
/* eslint-disable valid-jsdoc, jsdoc/require-returns-description */
|
|
@@ -4106,6 +4232,12 @@ __decorate$1([
|
|
|
4106
4232
|
__decorate$1([
|
|
4107
4233
|
Property('100%')
|
|
4108
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);
|
|
4109
4241
|
__decorate$1([
|
|
4110
4242
|
Property('300px')
|
|
4111
4243
|
], DropDownList.prototype, "popupHeight", void 0);
|
|
@@ -4267,6 +4399,9 @@ __decorate$2([
|
|
|
4267
4399
|
__decorate$2([
|
|
4268
4400
|
Property(null)
|
|
4269
4401
|
], Fields.prototype, "query", void 0);
|
|
4402
|
+
__decorate$2([
|
|
4403
|
+
Property('selectable')
|
|
4404
|
+
], Fields.prototype, "selectable", void 0);
|
|
4270
4405
|
__decorate$2([
|
|
4271
4406
|
Property('selected')
|
|
4272
4407
|
], Fields.prototype, "selected", void 0);
|
|
@@ -4315,6 +4450,8 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
4315
4450
|
this.selectedData = [];
|
|
4316
4451
|
this.filterDelayTime = 300;
|
|
4317
4452
|
this.isClicked = false;
|
|
4453
|
+
// Specifies if the checkAll method has been called
|
|
4454
|
+
this.isCheckAllCalled = false;
|
|
4318
4455
|
}
|
|
4319
4456
|
/**
|
|
4320
4457
|
* Get the properties to be maintained in the persisted state.
|
|
@@ -4442,7 +4579,7 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
4442
4579
|
this.updateDataAttribute();
|
|
4443
4580
|
this.setHTMLAttributes();
|
|
4444
4581
|
this.setAttributes();
|
|
4445
|
-
this.popupDiv = this.createElement('div', { className: CONTENT
|
|
4582
|
+
this.popupDiv = this.createElement('div', { className: CONTENT });
|
|
4446
4583
|
this.popupDiv.classList.add(DROPDOWN);
|
|
4447
4584
|
this.tree = this.createElement('div', { id: this.element.id + '_tree' });
|
|
4448
4585
|
this.popupDiv.appendChild(this.tree);
|
|
@@ -5062,7 +5199,12 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
5062
5199
|
temp = this.getOverflowVal(index);
|
|
5063
5200
|
data += temp;
|
|
5064
5201
|
temp = this.overFlowWrapper.innerHTML;
|
|
5065
|
-
this.
|
|
5202
|
+
if (this.enableHtmlSanitizer) {
|
|
5203
|
+
this.overFlowWrapper.innerText = data;
|
|
5204
|
+
}
|
|
5205
|
+
else {
|
|
5206
|
+
this.overFlowWrapper.innerHTML = data;
|
|
5207
|
+
}
|
|
5066
5208
|
wrapperleng = this.overFlowWrapper.offsetWidth;
|
|
5067
5209
|
overAllContainer = this.inputWrapper.offsetWidth;
|
|
5068
5210
|
if ((wrapperleng + downIconWidth + this.clearIconWidth) > overAllContainer) {
|
|
@@ -5232,7 +5374,7 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
5232
5374
|
if (isValid && this.value !== null && (this.value && this.value.length !== 0)) {
|
|
5233
5375
|
addClass([this.inputEle], CHIP_INPUT);
|
|
5234
5376
|
}
|
|
5235
|
-
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) {
|
|
5236
5378
|
addClass([this.chipWrapper], HIDEICON);
|
|
5237
5379
|
}
|
|
5238
5380
|
}
|
|
@@ -5287,6 +5429,7 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
5287
5429
|
frameSpan.classList.add(CHECK);
|
|
5288
5430
|
ariaState = 'true';
|
|
5289
5431
|
if (!this.isReverseUpdate) {
|
|
5432
|
+
this.isCheckAllCalled = true;
|
|
5290
5433
|
this.treeObj.checkAll();
|
|
5291
5434
|
if (!this.changeOnBlur) {
|
|
5292
5435
|
this.triggerChangeEvent(e);
|
|
@@ -5587,10 +5730,12 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
5587
5730
|
nodeSelected: this.onNodeSelected.bind(this),
|
|
5588
5731
|
nodeChecked: this.onNodeChecked.bind(this),
|
|
5589
5732
|
nodeChecking: this.beforeCheck.bind(this),
|
|
5733
|
+
nodeExpanded: this.onNodeExpanded.bind(this),
|
|
5590
5734
|
actionFailure: this.onActionFailure.bind(this),
|
|
5591
5735
|
nodeClicked: this.onNodeClicked.bind(this),
|
|
5592
5736
|
dataBound: this.OnDataBound.bind(this),
|
|
5593
5737
|
allowMultiSelection: this.allowMultiSelection,
|
|
5738
|
+
enableHtmlSanitizer: this.enableHtmlSanitizer,
|
|
5594
5739
|
showCheckBox: this.showCheckBox,
|
|
5595
5740
|
autoCheck: this.treeSettings.autoCheck,
|
|
5596
5741
|
sortOrder: this.sortOrder,
|
|
@@ -5692,7 +5837,7 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
5692
5837
|
const height = Math.round(this.header.getBoundingClientRect().height);
|
|
5693
5838
|
popupHeight = formatUnit(parseInt(popupHeight, 10) - height + 'px');
|
|
5694
5839
|
}
|
|
5695
|
-
if (this.showCheckBox && this.showSelectAll) {
|
|
5840
|
+
if (this.showCheckBox && this.showSelectAll && (!this.popupDiv.classList.contains(NODATA))) {
|
|
5696
5841
|
const height = Math.round(this.checkAllParent.getBoundingClientRect().height);
|
|
5697
5842
|
popupHeight = formatUnit(parseInt(popupHeight, 10) - height + 'px');
|
|
5698
5843
|
}
|
|
@@ -5774,14 +5919,14 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
5774
5919
|
const isFooter = closest(target, '.' + FOOTER);
|
|
5775
5920
|
const isScroller = target.classList.contains(DROPDOWN) ? true :
|
|
5776
5921
|
(matches(target, '.e-ddt .e-popup') || matches(target, '.e-ddt .e-treeview'));
|
|
5777
|
-
if ((this.isPopupOpen && (this.inputWrapper.contains(target) || isTree ||
|
|
5922
|
+
if ((this.isPopupOpen && (this.inputWrapper.contains(target) || isTree || isScroller || isHeader || isFooter)) ||
|
|
5778
5923
|
((this.allowMultiSelection || this.showCheckBox) && (this.isPopupOpen && target.classList.contains(CHIP_CLOSE) ||
|
|
5779
5924
|
(this.isPopupOpen && (target.classList.contains(CHECKALLPARENT) || target.classList.contains(ALLTEXT)
|
|
5780
5925
|
|| target.classList.contains(CHECKBOXFRAME)))))) {
|
|
5781
5926
|
this.isDocumentClick = false;
|
|
5782
5927
|
e.preventDefault();
|
|
5783
5928
|
}
|
|
5784
|
-
else if (!this.inputWrapper.contains(target) && this.inputFocus) {
|
|
5929
|
+
else if (!this.inputWrapper.contains(target) && this.inputFocus && !isFilter) {
|
|
5785
5930
|
this.focusOut(e);
|
|
5786
5931
|
}
|
|
5787
5932
|
}
|
|
@@ -5814,6 +5959,9 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
5814
5959
|
}
|
|
5815
5960
|
const eventArgs = { data: args.data };
|
|
5816
5961
|
this.trigger('dataBound', eventArgs);
|
|
5962
|
+
if (this.filterObj === null) {
|
|
5963
|
+
this.isFilteredData = false;
|
|
5964
|
+
}
|
|
5817
5965
|
if (this.isFilteredData) {
|
|
5818
5966
|
this.treeObj.expandAll();
|
|
5819
5967
|
}
|
|
@@ -5881,7 +6029,7 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
5881
6029
|
dataSource: fields.dataSource, value: fields.value, text: fields.text, parentValue: fields.parentValue,
|
|
5882
6030
|
child: this.cloneChildField(fields.child), hasChildren: fields.hasChildren, expanded: fields.expanded,
|
|
5883
6031
|
iconCss: fields.iconCss, imageUrl: fields.imageUrl, htmlAttributes: fields.htmlAttributes, query: fields.query,
|
|
5884
|
-
selected: fields.selected, tableName: fields.tableName, tooltip: fields.tooltip
|
|
6032
|
+
selected: fields.selected, selectable: fields.selectable, tableName: fields.tableName, tooltip: fields.tooltip
|
|
5885
6033
|
};
|
|
5886
6034
|
return clonedField;
|
|
5887
6035
|
}
|
|
@@ -5894,7 +6042,7 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
5894
6042
|
dataSource: fields.dataSource, value: fields.value, text: fields.text, parentValue: fields.parentValue,
|
|
5895
6043
|
child: (fields.child ? this.cloneChildField(fields.child) : null), hasChildren: fields.hasChildren,
|
|
5896
6044
|
expanded: fields.expanded, iconCss: fields.iconCss, imageUrl: fields.imageUrl, htmlAttributes: fields.htmlAttributes,
|
|
5897
|
-
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
|
|
5898
6046
|
};
|
|
5899
6047
|
return clonedField;
|
|
5900
6048
|
}
|
|
@@ -5904,7 +6052,7 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
5904
6052
|
dataSource: fields.dataSource, id: fields.value, text: fields.text, parentID: fields.parentValue,
|
|
5905
6053
|
child: this.getTreeChildren(fields.child), hasChildren: fields.hasChildren, expanded: fields.expanded,
|
|
5906
6054
|
iconCss: fields.iconCss, imageUrl: fields.imageUrl, isChecked: fields.selected,
|
|
5907
|
-
htmlAttributes: fields.htmlAttributes, query: fields.query, selected: fields.selected,
|
|
6055
|
+
htmlAttributes: fields.htmlAttributes, query: fields.query, selectable: fields.selectable, selected: fields.selected,
|
|
5908
6056
|
tableName: fields.tableName, tooltip: fields.tooltip
|
|
5909
6057
|
};
|
|
5910
6058
|
return treeFields;
|
|
@@ -5942,7 +6090,8 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
5942
6090
|
}
|
|
5943
6091
|
return 2;
|
|
5944
6092
|
}
|
|
5945
|
-
|
|
6093
|
+
if (isNullOrUndefined(this.fields.dataSource))
|
|
6094
|
+
this.fields.dataSource = [];
|
|
5946
6095
|
for (let i = 0, len = this.fields.dataSource.length; i < len; i++) {
|
|
5947
6096
|
if ((typeof field.child === 'string') && !isNullOrUndefined(getValue(field.child, this.fields.dataSource[i]))) {
|
|
5948
6097
|
return 2;
|
|
@@ -6081,13 +6230,14 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
6081
6230
|
const nodes = this.treeObj.element.querySelectorAll('li');
|
|
6082
6231
|
const checkedNodes = this.treeObj.element.querySelectorAll('li .e-checkbox-wrapper[aria-checked=true]');
|
|
6083
6232
|
const wrap = closest(this.checkBoxElement, '.' + CHECKBOXWRAP);
|
|
6084
|
-
if (wrap && args.action === 'uncheck') {
|
|
6233
|
+
if (wrap && args.action === 'uncheck' && (args.isInteracted || checkedNodes.length === 0)) {
|
|
6085
6234
|
this.isReverseUpdate = true;
|
|
6086
6235
|
this.changeState(wrap, 'uncheck');
|
|
6087
6236
|
this.isReverseUpdate = false;
|
|
6088
6237
|
}
|
|
6089
|
-
else if (wrap && args.action === 'check' && checkedNodes.length === nodes.length) {
|
|
6238
|
+
else if (wrap && args.action === 'check' && checkedNodes.length === nodes.length && this.isCheckAllCalled) {
|
|
6090
6239
|
this.isReverseUpdate = true;
|
|
6240
|
+
this.isCheckAllCalled = false;
|
|
6091
6241
|
this.changeState(wrap, 'check');
|
|
6092
6242
|
this.isReverseUpdate = false;
|
|
6093
6243
|
}
|
|
@@ -6098,6 +6248,13 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
6098
6248
|
this.oldValue = this.value ? this.value.slice() : this.value;
|
|
6099
6249
|
}
|
|
6100
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
|
+
}
|
|
6101
6258
|
updateClearButton(state) {
|
|
6102
6259
|
if (state) {
|
|
6103
6260
|
if (!this.inputWrapper.contains(this.overAllClear)) {
|
|
@@ -6398,7 +6555,12 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
6398
6555
|
});
|
|
6399
6556
|
const chipContent = this.createElement('span', { className: CHIP_CONTENT });
|
|
6400
6557
|
const chipClose = this.createElement('span', { className: CHIP_CLOSE + ' ' + ICONS });
|
|
6401
|
-
|
|
6558
|
+
if (this.enableHtmlSanitizer) {
|
|
6559
|
+
chipContent.innerText = text;
|
|
6560
|
+
}
|
|
6561
|
+
else {
|
|
6562
|
+
chipContent.innerHTML = text;
|
|
6563
|
+
}
|
|
6402
6564
|
chip.appendChild(chipContent);
|
|
6403
6565
|
this.chipCollection.appendChild(chip);
|
|
6404
6566
|
if (this.showClearButton) {
|
|
@@ -6594,6 +6756,7 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
6594
6756
|
selectAllItems(state) {
|
|
6595
6757
|
if (this.showCheckBox) {
|
|
6596
6758
|
if (state) {
|
|
6759
|
+
this.isCheckAllCalled = true;
|
|
6597
6760
|
this.treeObj.checkAll();
|
|
6598
6761
|
}
|
|
6599
6762
|
else {
|
|
@@ -6688,8 +6851,6 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
6688
6851
|
}
|
|
6689
6852
|
else {
|
|
6690
6853
|
this.noRecord = this.createElement('div');
|
|
6691
|
-
addClass([this.noRecord], NODATACONTAINER);
|
|
6692
|
-
prepend([this.noRecord], this.popupDiv);
|
|
6693
6854
|
}
|
|
6694
6855
|
if (this.noRecordsTemplate !== 'No Records Found' || this.actionFailureTemplate !== 'The Request Failed') {
|
|
6695
6856
|
const template = actionFailure ? this.actionFailureTemplate : this.noRecordsTemplate;
|
|
@@ -6701,6 +6862,8 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
6701
6862
|
if (tempArr) {
|
|
6702
6863
|
tempArr = Array.prototype.slice.call(tempArr);
|
|
6703
6864
|
append(tempArr, this.noRecord);
|
|
6865
|
+
addClass([this.noRecord], NODATACONTAINER);
|
|
6866
|
+
prepend([this.noRecord], this.popupDiv);
|
|
6704
6867
|
}
|
|
6705
6868
|
}
|
|
6706
6869
|
else {
|
|
@@ -6709,6 +6872,8 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
6709
6872
|
this.l10n = new L10n(this.getLocaleName(), l10nLocale, this.locale);
|
|
6710
6873
|
this.noRecord.innerHTML = actionFailure ?
|
|
6711
6874
|
this.l10n.getConstant('actionFailureTemplate') : this.l10n.getConstant('noRecordsTemplate');
|
|
6875
|
+
addClass([this.noRecord], NODATACONTAINER);
|
|
6876
|
+
prepend([this.noRecord], this.popupDiv);
|
|
6712
6877
|
}
|
|
6713
6878
|
}
|
|
6714
6879
|
updateRecordTemplate(action) {
|
|
@@ -7220,6 +7385,9 @@ __decorate$2([
|
|
|
7220
7385
|
__decorate$2([
|
|
7221
7386
|
Property(false)
|
|
7222
7387
|
], DropDownTree.prototype, "showCheckBox", void 0);
|
|
7388
|
+
__decorate$2([
|
|
7389
|
+
Property(false)
|
|
7390
|
+
], DropDownTree.prototype, "enableHtmlSanitizer", void 0);
|
|
7223
7391
|
__decorate$2([
|
|
7224
7392
|
Property(true)
|
|
7225
7393
|
], DropDownTree.prototype, "showClearButton", void 0);
|
|
@@ -7457,15 +7625,12 @@ let ComboBox = class ComboBox extends DropDownList {
|
|
|
7457
7625
|
}
|
|
7458
7626
|
getAriaAttributes() {
|
|
7459
7627
|
const ariaAttributes = {
|
|
7460
|
-
'aria-owns': this.element.id + '_options',
|
|
7461
7628
|
'role': 'combobox',
|
|
7462
7629
|
'aria-autocomplete': 'both',
|
|
7463
7630
|
'aria-labelledby': this.hiddenElement.id,
|
|
7464
|
-
'aria-hasPopup': 'true',
|
|
7465
7631
|
'aria-expanded': 'false',
|
|
7466
7632
|
'aria-readonly': this.readonly.toString(),
|
|
7467
7633
|
'autocomplete': 'off',
|
|
7468
|
-
'autocorrect': 'off',
|
|
7469
7634
|
'autocapitalize': 'off',
|
|
7470
7635
|
'spellcheck': 'false'
|
|
7471
7636
|
};
|
|
@@ -7507,7 +7672,7 @@ let ComboBox = class ComboBox extends DropDownList {
|
|
|
7507
7672
|
}
|
|
7508
7673
|
getFocusElement() {
|
|
7509
7674
|
const dataItem = this.isSelectCustom ? { text: '' } : this.getItemData();
|
|
7510
|
-
const selected = this.list.querySelector('.' + dropDownListClasses.selected);
|
|
7675
|
+
const selected = !isNullOrUndefined(this.list) ? this.list.querySelector('.' + dropDownListClasses.selected) : this.list;
|
|
7511
7676
|
const isSelected = dataItem.text === this.inputElement.value && !isNullOrUndefined(selected);
|
|
7512
7677
|
if (isSelected) {
|
|
7513
7678
|
return selected;
|
|
@@ -7515,8 +7680,10 @@ let ComboBox = class ComboBox extends DropDownList {
|
|
|
7515
7680
|
if ((Browser.isDevice && !this.isDropDownClick || !Browser.isDevice) &&
|
|
7516
7681
|
!isNullOrUndefined(this.liCollections) && this.liCollections.length > 0) {
|
|
7517
7682
|
const inputValue = this.inputElement.value;
|
|
7518
|
-
const
|
|
7519
|
-
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;
|
|
7520
7687
|
if (!isNullOrUndefined(activeElement)) {
|
|
7521
7688
|
const count = this.getIndexByValue(activeElement.getAttribute('data-value')) - 1;
|
|
7522
7689
|
const height = parseInt(getComputedStyle(this.liCollections[0], null).getPropertyValue('height'), 10);
|
|
@@ -7556,7 +7723,7 @@ let ComboBox = class ComboBox extends DropDownList {
|
|
|
7556
7723
|
this.itemData = this.getDataByValue(this.value);
|
|
7557
7724
|
const dataItem = this.getItemData();
|
|
7558
7725
|
if (!(this.allowCustom && isNullOrUndefined(dataItem.value) && isNullOrUndefined(dataItem.text))) {
|
|
7559
|
-
this.setProperties({ 'value': dataItem.value
|
|
7726
|
+
this.setProperties({ 'value': dataItem.value }, !this.allowCustom);
|
|
7560
7727
|
}
|
|
7561
7728
|
}
|
|
7562
7729
|
/**
|
|
@@ -7665,9 +7832,11 @@ let ComboBox = class ComboBox extends DropDownList {
|
|
|
7665
7832
|
}
|
|
7666
7833
|
else if (this.inputElement.value === '') {
|
|
7667
7834
|
this.activeIndex = null;
|
|
7668
|
-
this.list
|
|
7669
|
-
|
|
7670
|
-
|
|
7835
|
+
if (!isNullOrUndefined(this.list)) {
|
|
7836
|
+
this.list.scrollTop = 0;
|
|
7837
|
+
const focusItem = this.list.querySelector('.' + dropDownListClasses.li);
|
|
7838
|
+
this.setHoverList(focusItem);
|
|
7839
|
+
}
|
|
7671
7840
|
}
|
|
7672
7841
|
else {
|
|
7673
7842
|
this.activeIndex = null;
|
|
@@ -7678,7 +7847,7 @@ let ComboBox = class ComboBox extends DropDownList {
|
|
|
7678
7847
|
}
|
|
7679
7848
|
}
|
|
7680
7849
|
incrementalSearch(e) {
|
|
7681
|
-
this.showPopup();
|
|
7850
|
+
this.showPopup(e);
|
|
7682
7851
|
if (!isNullOrUndefined(this.listData)) {
|
|
7683
7852
|
this.inlineSearch(e);
|
|
7684
7853
|
e.preventDefault();
|
|
@@ -7763,6 +7932,7 @@ let ComboBox = class ComboBox extends DropDownList {
|
|
|
7763
7932
|
this.preventFocus = false;
|
|
7764
7933
|
}
|
|
7765
7934
|
this.onFocus(e);
|
|
7935
|
+
Input.calculateWidth(this.inputElement, this.inputWrapper.container);
|
|
7766
7936
|
}
|
|
7767
7937
|
dropDownClick(e) {
|
|
7768
7938
|
e.preventDefault();
|
|
@@ -7912,7 +8082,7 @@ let ComboBox = class ComboBox extends DropDownList {
|
|
|
7912
8082
|
* Adds a new item to the combobox popup list. By default, new item appends to the list as the last item,
|
|
7913
8083
|
* but you can insert based on the index parameter.
|
|
7914
8084
|
*
|
|
7915
|
-
* @param
|
|
8085
|
+
* @param { Object[] } items - Specifies an array of JSON data or a JSON data.
|
|
7916
8086
|
* @param { number } itemIndex - Specifies the index to place the newly added item in the popup list.
|
|
7917
8087
|
* @returns {void}
|
|
7918
8088
|
* @deprecated
|
|
@@ -7923,9 +8093,9 @@ let ComboBox = class ComboBox extends DropDownList {
|
|
|
7923
8093
|
/**
|
|
7924
8094
|
* To filter the data from given data source by using query
|
|
7925
8095
|
*
|
|
7926
|
-
* @param
|
|
7927
|
-
* @param
|
|
7928
|
-
* @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.
|
|
7929
8099
|
* @returns {void}
|
|
7930
8100
|
* @deprecated
|
|
7931
8101
|
*/
|
|
@@ -7938,8 +8108,8 @@ let ComboBox = class ComboBox extends DropDownList {
|
|
|
7938
8108
|
* @returns {void}
|
|
7939
8109
|
* @deprecated
|
|
7940
8110
|
*/
|
|
7941
|
-
showPopup() {
|
|
7942
|
-
super.showPopup();
|
|
8111
|
+
showPopup(e) {
|
|
8112
|
+
super.showPopup(e);
|
|
7943
8113
|
}
|
|
7944
8114
|
/* eslint-disable valid-jsdoc, jsdoc/require-param */
|
|
7945
8115
|
/**
|
|
@@ -7962,7 +8132,7 @@ let ComboBox = class ComboBox extends DropDownList {
|
|
|
7962
8132
|
this.removeFillSelection();
|
|
7963
8133
|
}
|
|
7964
8134
|
const dataItem = this.isSelectCustom ? { text: '' } : this.getItemData();
|
|
7965
|
-
const selected = this.list.querySelector('.' + dropDownListClasses.selected);
|
|
8135
|
+
const selected = !isNullOrUndefined(this.list) ? this.list.querySelector('.' + dropDownListClasses.selected) : null;
|
|
7966
8136
|
if (this.inputElement && dataItem.text === this.inputElement.value && !isNullOrUndefined(selected)) {
|
|
7967
8137
|
if (this.isSelected) {
|
|
7968
8138
|
this.onChangeEvent(e);
|
|
@@ -7972,10 +8142,12 @@ let ComboBox = class ComboBox extends DropDownList {
|
|
|
7972
8142
|
return;
|
|
7973
8143
|
}
|
|
7974
8144
|
if (this.getModuleName() === 'combobox' && this.inputElement.value.trim() !== '') {
|
|
7975
|
-
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);
|
|
7976
8148
|
this.selectedLI = searchItem.item;
|
|
7977
8149
|
if (isNullOrUndefined(searchItem.index)) {
|
|
7978
|
-
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;
|
|
7979
8151
|
}
|
|
7980
8152
|
this.activeIndex = searchItem.index;
|
|
7981
8153
|
if (!isNullOrUndefined(this.selectedLI)) {
|
|
@@ -8214,13 +8386,13 @@ let AutoComplete = class AutoComplete extends ComboBox {
|
|
|
8214
8386
|
this.isTyped = true;
|
|
8215
8387
|
this.isDataFetched = this.isSelectCustom = false;
|
|
8216
8388
|
if (isNullOrUndefined(this.list)) {
|
|
8217
|
-
super.renderList(true);
|
|
8389
|
+
super.renderList(e, true);
|
|
8218
8390
|
}
|
|
8219
8391
|
this.queryString = this.filterInput.value;
|
|
8220
8392
|
if (e.type !== 'mousedown' && (e.keyCode === 40 || e.keyCode === 38)) {
|
|
8221
8393
|
this.queryString = this.queryString === '' ? null : this.queryString;
|
|
8222
8394
|
this.beforePopupOpen = true;
|
|
8223
|
-
this.resetList(this.dataSource, this.fields);
|
|
8395
|
+
this.resetList(this.dataSource, this.fields, null, e);
|
|
8224
8396
|
return;
|
|
8225
8397
|
}
|
|
8226
8398
|
this.isSelected = false;
|
|
@@ -8240,16 +8412,16 @@ let AutoComplete = class AutoComplete extends ComboBox {
|
|
|
8240
8412
|
this.trigger('filtering', eventArgs, (eventArgs) => {
|
|
8241
8413
|
if (!eventArgs.cancel && !this.isFiltered && !eventArgs.preventDefaultAction) {
|
|
8242
8414
|
this.searchList = true;
|
|
8243
|
-
this.filterAction(this.dataSource, null, this.fields);
|
|
8415
|
+
this.filterAction(this.dataSource, null, this.fields, e);
|
|
8244
8416
|
}
|
|
8245
8417
|
});
|
|
8246
8418
|
}
|
|
8247
8419
|
/**
|
|
8248
8420
|
* To filter the data from given data source by using query
|
|
8249
8421
|
*
|
|
8250
|
-
* @param
|
|
8251
|
-
* @param
|
|
8252
|
-
* @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.
|
|
8253
8425
|
* @returns {void}
|
|
8254
8426
|
* @deprecated
|
|
8255
8427
|
*/
|
|
@@ -8257,13 +8429,13 @@ let AutoComplete = class AutoComplete extends ComboBox {
|
|
|
8257
8429
|
this.isFiltered = true;
|
|
8258
8430
|
this.filterAction(dataSource, query, fields);
|
|
8259
8431
|
}
|
|
8260
|
-
filterAction(dataSource, query, fields) {
|
|
8432
|
+
filterAction(dataSource, query, fields, e) {
|
|
8261
8433
|
this.beforePopupOpen = true;
|
|
8262
8434
|
if (this.queryString !== '' && (this.queryString.length >= this.minLength)) {
|
|
8263
|
-
this.resetList(dataSource, fields, query);
|
|
8435
|
+
this.resetList(dataSource, fields, query, e);
|
|
8264
8436
|
}
|
|
8265
8437
|
else {
|
|
8266
|
-
this.hidePopup();
|
|
8438
|
+
this.hidePopup(e);
|
|
8267
8439
|
this.beforePopupOpen = false;
|
|
8268
8440
|
}
|
|
8269
8441
|
this.renderReactTemplates();
|
|
@@ -8289,7 +8461,9 @@ let AutoComplete = class AutoComplete extends ComboBox {
|
|
|
8289
8461
|
postBackAction() {
|
|
8290
8462
|
if (this.autofill && !isNullOrUndefined(this.liCollections[0]) && this.searchList) {
|
|
8291
8463
|
const items = [this.liCollections[0]];
|
|
8292
|
-
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);
|
|
8293
8467
|
this.searchList = false;
|
|
8294
8468
|
if (!isNullOrUndefined(searchItem.item)) {
|
|
8295
8469
|
super.setAutoFill(this.liCollections[0], true);
|
|
@@ -8298,6 +8472,7 @@ let AutoComplete = class AutoComplete extends ComboBox {
|
|
|
8298
8472
|
}
|
|
8299
8473
|
setSelection(li, e) {
|
|
8300
8474
|
if (!this.isValidLI(li)) {
|
|
8475
|
+
this.selectedLI = li;
|
|
8301
8476
|
return;
|
|
8302
8477
|
}
|
|
8303
8478
|
if (!isNullOrUndefined(e) && e.type === 'keydown' && e.action !== 'enter'
|
|
@@ -8313,7 +8488,6 @@ let AutoComplete = class AutoComplete extends ComboBox {
|
|
|
8313
8488
|
e.action === 'home' || e.action === 'end' || e.action === 'pageUp' || e.action === 'pageDown');
|
|
8314
8489
|
super.setAutoFill(li, isKeyNavigate);
|
|
8315
8490
|
}
|
|
8316
|
-
attributes(this.inputElement, { 'aria-activedescendant': this.selectedLI ? this.selectedLI.id : null });
|
|
8317
8491
|
}
|
|
8318
8492
|
else {
|
|
8319
8493
|
super.setSelection(li, e);
|
|
@@ -8349,9 +8523,9 @@ let AutoComplete = class AutoComplete extends ComboBox {
|
|
|
8349
8523
|
isFiltering() {
|
|
8350
8524
|
return true;
|
|
8351
8525
|
}
|
|
8352
|
-
renderPopup() {
|
|
8526
|
+
renderPopup(e) {
|
|
8353
8527
|
this.list.scrollTop = 0;
|
|
8354
|
-
super.renderPopup();
|
|
8528
|
+
super.renderPopup(e);
|
|
8355
8529
|
}
|
|
8356
8530
|
isEditTextBox() {
|
|
8357
8531
|
return true && this.inputElement.value.trim() !== '';
|
|
@@ -8363,13 +8537,37 @@ let AutoComplete = class AutoComplete extends ComboBox {
|
|
|
8363
8537
|
isSelectFocusItem(element) {
|
|
8364
8538
|
return false;
|
|
8365
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
|
+
}
|
|
8366
8564
|
/**
|
|
8367
8565
|
* Search the entered text and show it in the suggestion list if available.
|
|
8368
8566
|
*
|
|
8369
8567
|
* @returns {void}
|
|
8370
8568
|
* @deprecated
|
|
8371
8569
|
*/
|
|
8372
|
-
showPopup() {
|
|
8570
|
+
showPopup(e) {
|
|
8373
8571
|
if (!this.enabled) {
|
|
8374
8572
|
return;
|
|
8375
8573
|
}
|
|
@@ -8380,10 +8578,10 @@ let AutoComplete = class AutoComplete extends ComboBox {
|
|
|
8380
8578
|
this.beforePopupOpen = true;
|
|
8381
8579
|
this.preventAutoFill = true;
|
|
8382
8580
|
if (isNullOrUndefined(this.list)) {
|
|
8383
|
-
this.renderList();
|
|
8581
|
+
this.renderList(e);
|
|
8384
8582
|
}
|
|
8385
8583
|
else {
|
|
8386
|
-
this.resetList(this.dataSource, this.fields);
|
|
8584
|
+
this.resetList(this.dataSource, this.fields, null, e);
|
|
8387
8585
|
}
|
|
8388
8586
|
}
|
|
8389
8587
|
/**
|
|
@@ -8413,6 +8611,10 @@ let AutoComplete = class AutoComplete extends ComboBox {
|
|
|
8413
8611
|
if (this.showPopupButton) {
|
|
8414
8612
|
const button = Input.appendSpan(dropDownListClasses.icon, this.inputWrapper.container, this.createElement);
|
|
8415
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
|
+
}
|
|
8416
8618
|
if (this.inputWrapper && this.inputWrapper.buttons && this.inputWrapper.buttons[0]) {
|
|
8417
8619
|
EventHandler.add(this.inputWrapper.buttons[0], 'click', this.dropDownClick, this);
|
|
8418
8620
|
}
|
|
@@ -8540,9 +8742,11 @@ const LABELBOTTOM = 'e-label-bottom';
|
|
|
8540
8742
|
function createFloatLabel(overAllWrapper, searchWrapper, element, inputElement, value, floatLabelType, placeholder) {
|
|
8541
8743
|
const floatLinelement = createElement('span', { className: FLOATLINE });
|
|
8542
8744
|
const floatLabelElement = createElement('label', { className: FLOATTEXT });
|
|
8745
|
+
const id = element.getAttribute('id') ? element.getAttribute('id') : getUniqueID('ej2_multiselect');
|
|
8746
|
+
element.id = id;
|
|
8543
8747
|
if (!isNullOrUndefined(element.id) && element.id !== '') {
|
|
8544
8748
|
floatLabelElement.id = 'label_' + element.id.replace(/ /g, '_');
|
|
8545
|
-
attributes(
|
|
8749
|
+
attributes(inputElement, { 'aria-labelledby': floatLabelElement.id });
|
|
8546
8750
|
}
|
|
8547
8751
|
if (!isNullOrUndefined(inputElement.placeholder) && inputElement.placeholder !== '') {
|
|
8548
8752
|
floatLabelElement.innerText = encodePlaceholder(inputElement.placeholder);
|
|
@@ -8746,6 +8950,8 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
8746
8950
|
this.isValidKey = false;
|
|
8747
8951
|
this.selectAllEventData = [];
|
|
8748
8952
|
this.selectAllEventEle = [];
|
|
8953
|
+
this.resetMainList = null;
|
|
8954
|
+
this.resetFilteredData = false;
|
|
8749
8955
|
this.scrollFocusStatus = false;
|
|
8750
8956
|
this.keyDownStatus = false;
|
|
8751
8957
|
}
|
|
@@ -8786,7 +8992,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
8786
8992
|
for (const htmlAttr of Object.keys(this.htmlAttributes)) {
|
|
8787
8993
|
switch (htmlAttr) {
|
|
8788
8994
|
case 'class': {
|
|
8789
|
-
const updatedClassValue = (this.htmlAttributes[htmlAttr].replace(/\s+/g, ' ')).trim();
|
|
8995
|
+
const updatedClassValue = (this.htmlAttributes[`${htmlAttr}`].replace(/\s+/g, ' ')).trim();
|
|
8790
8996
|
if (updatedClassValue !== '') {
|
|
8791
8997
|
addClass([this.overAllWrapper], updatedClassValue.split(' '));
|
|
8792
8998
|
addClass([this.popupWrapper], updatedClassValue.split(' '));
|
|
@@ -8798,7 +9004,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
8798
9004
|
break;
|
|
8799
9005
|
case 'placeholder':
|
|
8800
9006
|
if (!this.placeholder) {
|
|
8801
|
-
this.inputElement.setAttribute(htmlAttr, this.htmlAttributes[htmlAttr]);
|
|
9007
|
+
this.inputElement.setAttribute(htmlAttr, this.htmlAttributes[`${htmlAttr}`]);
|
|
8802
9008
|
this.setProperties({ placeholder: this.inputElement.placeholder }, true);
|
|
8803
9009
|
this.refreshPlaceHolder();
|
|
8804
9010
|
}
|
|
@@ -8808,16 +9014,16 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
8808
9014
|
const validateAttr = ['name', 'required', 'aria-required', 'form'];
|
|
8809
9015
|
const containerAttr = ['title', 'role', 'style', 'class'];
|
|
8810
9016
|
if (defaultAttr.indexOf(htmlAttr) > -1) {
|
|
8811
|
-
this.element.setAttribute(htmlAttr, this.htmlAttributes[htmlAttr]);
|
|
9017
|
+
this.element.setAttribute(htmlAttr, this.htmlAttributes[`${htmlAttr}`]);
|
|
8812
9018
|
}
|
|
8813
9019
|
else if (htmlAttr.indexOf('data') === 0 || validateAttr.indexOf(htmlAttr) > -1) {
|
|
8814
|
-
this.hiddenElement.setAttribute(htmlAttr, this.htmlAttributes[htmlAttr]);
|
|
9020
|
+
this.hiddenElement.setAttribute(htmlAttr, this.htmlAttributes[`${htmlAttr}`]);
|
|
8815
9021
|
}
|
|
8816
9022
|
else if (containerAttr.indexOf(htmlAttr) > -1) {
|
|
8817
|
-
this.overAllWrapper.setAttribute(htmlAttr, this.htmlAttributes[htmlAttr]);
|
|
9023
|
+
this.overAllWrapper.setAttribute(htmlAttr, this.htmlAttributes[`${htmlAttr}`]);
|
|
8818
9024
|
}
|
|
8819
|
-
else if (htmlAttr !== 'size') {
|
|
8820
|
-
this.inputElement.setAttribute(htmlAttr, this.htmlAttributes[htmlAttr]);
|
|
9025
|
+
else if (htmlAttr !== 'size' && !isNullOrUndefined(this.inputElement)) {
|
|
9026
|
+
this.inputElement.setAttribute(htmlAttr, this.htmlAttributes[`${htmlAttr}`]);
|
|
8821
9027
|
}
|
|
8822
9028
|
break;
|
|
8823
9029
|
}
|
|
@@ -8826,11 +9032,13 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
8826
9032
|
}
|
|
8827
9033
|
}
|
|
8828
9034
|
updateReadonly(state) {
|
|
8829
|
-
if (
|
|
8830
|
-
this.
|
|
8831
|
-
|
|
8832
|
-
|
|
8833
|
-
|
|
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
|
+
}
|
|
8834
9042
|
}
|
|
8835
9043
|
}
|
|
8836
9044
|
updateClearButton(state) {
|
|
@@ -8867,7 +9075,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
8867
9075
|
}
|
|
8868
9076
|
}
|
|
8869
9077
|
}
|
|
8870
|
-
onPopupShown() {
|
|
9078
|
+
onPopupShown(e) {
|
|
8871
9079
|
if (Browser.isDevice && (this.mode === 'CheckBox' && this.allowFiltering)) {
|
|
8872
9080
|
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
8873
9081
|
const proxy = this;
|
|
@@ -8878,7 +9086,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
8878
9086
|
history.pushState({}, '');
|
|
8879
9087
|
}
|
|
8880
9088
|
const animModel = { name: 'FadeIn', duration: 100 };
|
|
8881
|
-
const eventArgs = { popup: this.popupObj, cancel: false, animation: animModel };
|
|
9089
|
+
const eventArgs = { popup: this.popupObj, event: e, cancel: false, animation: animModel };
|
|
8882
9090
|
this.trigger('open', eventArgs, (eventArgs) => {
|
|
8883
9091
|
if (!eventArgs.cancel) {
|
|
8884
9092
|
this.focusAtFirstListItem();
|
|
@@ -8892,7 +9100,8 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
8892
9100
|
this.refreshPopup();
|
|
8893
9101
|
this.renderReactTemplates();
|
|
8894
9102
|
this.popupObj.show(eventArgs.animation, (this.zIndex === 1000) ? this.element : null);
|
|
8895
|
-
attributes(this.inputElement, { 'aria-expanded': 'true' });
|
|
9103
|
+
attributes(this.inputElement, { 'aria-expanded': 'true', 'aria-owns': this.inputElement.id + '_options' });
|
|
9104
|
+
this.updateAriaActiveDescendant();
|
|
8896
9105
|
if (this.isFirstClick) {
|
|
8897
9106
|
this.loadTemplate();
|
|
8898
9107
|
}
|
|
@@ -8962,11 +9171,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
8962
9171
|
getAriaAttributes() {
|
|
8963
9172
|
const ariaAttributes = {
|
|
8964
9173
|
'aria-disabled': 'false',
|
|
8965
|
-
'
|
|
8966
|
-
'role': 'listbox',
|
|
8967
|
-
'aria-multiselectable': 'true',
|
|
8968
|
-
'aria-activedescendant': 'null',
|
|
8969
|
-
'aria-haspopup': 'true',
|
|
9174
|
+
'role': 'combobox',
|
|
8970
9175
|
'aria-expanded': 'false'
|
|
8971
9176
|
};
|
|
8972
9177
|
return ariaAttributes;
|
|
@@ -8975,8 +9180,10 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
8975
9180
|
if (!isNullOrUndefined(this.ulElement)) {
|
|
8976
9181
|
attributes(this.ulElement, { 'id': this.element.id + '_options', 'role': 'listbox', 'aria-hidden': 'false' });
|
|
8977
9182
|
}
|
|
8978
|
-
const disableStatus = (this.inputElement.disabled) ? true : false;
|
|
8979
|
-
|
|
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
|
+
}
|
|
8980
9187
|
if (disableStatus) {
|
|
8981
9188
|
attributes(this.inputElement, { 'aria-disabled': 'true' });
|
|
8982
9189
|
}
|
|
@@ -9044,13 +9251,23 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
9044
9251
|
if (!isNullOrUndefined(this.value) && !this.allowCustomValue) {
|
|
9045
9252
|
for (let i = 0; i < this.value.length; i++) {
|
|
9046
9253
|
const checkEle = this.findListElement(((this.allowFiltering && !isNullOrUndefined(this.mainList)) ? this.mainList : ulElement), 'li', 'data-value', proxy.value[i]);
|
|
9047
|
-
if (!checkEle) {
|
|
9254
|
+
if (!checkEle && !(this.dataSource instanceof DataManager)) {
|
|
9048
9255
|
this.value.splice(i, 1);
|
|
9049
9256
|
i -= 1;
|
|
9050
9257
|
}
|
|
9051
9258
|
}
|
|
9052
9259
|
}
|
|
9053
|
-
|
|
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
|
+
}
|
|
9054
9271
|
if (this.dataSource instanceof DataManager && this.mode === 'CheckBox' && this.allowFiltering) {
|
|
9055
9272
|
this.removeFocus();
|
|
9056
9273
|
}
|
|
@@ -9074,7 +9291,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
9074
9291
|
this.checkForCustomValue(this.tempQuery, this.fields);
|
|
9075
9292
|
return;
|
|
9076
9293
|
}
|
|
9077
|
-
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() !== '') ||
|
|
9078
9295
|
this.mode === 'CheckBox' || ((this.keyCode === 8 || this.keyCode === 46) && this.allowFiltering &&
|
|
9079
9296
|
this.allowCustomValue && this.dataSource instanceof DataManager && this.inputElement.value === ''))) {
|
|
9080
9297
|
this.refreshSelection();
|
|
@@ -9102,7 +9319,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
9102
9319
|
this.renderPopup();
|
|
9103
9320
|
if (this.beforePopupOpen) {
|
|
9104
9321
|
this.beforePopupOpen = false;
|
|
9105
|
-
this.onPopupShown();
|
|
9322
|
+
this.onPopupShown(e);
|
|
9106
9323
|
}
|
|
9107
9324
|
}
|
|
9108
9325
|
refreshSelection() {
|
|
@@ -9132,6 +9349,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
9132
9349
|
dropDownBaseClasses.li + ':not(.' + HIDE_LIST + ')');
|
|
9133
9350
|
if (listEle.length > 0) {
|
|
9134
9351
|
addClass([listEle[0]], dropDownBaseClasses.focus);
|
|
9352
|
+
this.updateAriaActiveDescendant();
|
|
9135
9353
|
}
|
|
9136
9354
|
else {
|
|
9137
9355
|
//EJ2-57588 - for this task, we prevent the ul element cloning ( this.ulElement = this.ulElement.cloneNode ? <HTMLElement>this.ulElement.cloneNode(true) : this.ulElement;)
|
|
@@ -9143,8 +9361,8 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
9143
9361
|
}
|
|
9144
9362
|
element.setAttribute('aria-selected', 'true');
|
|
9145
9363
|
if (this.mode === 'CheckBox' && element.classList.contains('e-active')) {
|
|
9146
|
-
const ariaValue = element.
|
|
9147
|
-
if (
|
|
9364
|
+
const ariaValue = element.getElementsByClassName('e-check').length;
|
|
9365
|
+
if (ariaValue === 0) {
|
|
9148
9366
|
const args = {
|
|
9149
9367
|
module: 'CheckBoxSelection',
|
|
9150
9368
|
enable: this.mode === 'CheckBox',
|
|
@@ -9268,9 +9486,9 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
9268
9486
|
/**
|
|
9269
9487
|
* To filter the multiselect data from given data source by using query
|
|
9270
9488
|
*
|
|
9271
|
-
* @param
|
|
9272
|
-
* @param
|
|
9273
|
-
* @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.
|
|
9274
9492
|
* @returns {void}
|
|
9275
9493
|
*/
|
|
9276
9494
|
filter(dataSource, query, fields) {
|
|
@@ -9358,7 +9576,8 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
9358
9576
|
this.resetList(tempData, field, query);
|
|
9359
9577
|
}
|
|
9360
9578
|
else {
|
|
9361
|
-
const tempData =
|
|
9579
|
+
const tempData = JSON.parse(JSON.stringify(this.listData));
|
|
9580
|
+
tempData.splice(0, 0, this.inputElement.value);
|
|
9362
9581
|
tempData[0] = (typeof customData === 'number' && !isNaN(parseFloat(tempData[0]))) ?
|
|
9363
9582
|
parseFloat(tempData[0]) : tempData[0];
|
|
9364
9583
|
tempData[0] = (typeof customData === 'boolean') ?
|
|
@@ -9394,7 +9613,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
9394
9613
|
}
|
|
9395
9614
|
if (!this.isPopupOpen() &&
|
|
9396
9615
|
(this.openOnClick || (this.showDropDownIcon && e.target && e.target.className === dropdownIcon))) {
|
|
9397
|
-
this.showPopup();
|
|
9616
|
+
this.showPopup(e);
|
|
9398
9617
|
}
|
|
9399
9618
|
else {
|
|
9400
9619
|
this.hidePopup(e);
|
|
@@ -9476,6 +9695,10 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
9476
9695
|
}
|
|
9477
9696
|
}
|
|
9478
9697
|
this.updateDataList();
|
|
9698
|
+
if (this.resetMainList) {
|
|
9699
|
+
this.mainList = this.resetMainList;
|
|
9700
|
+
this.resetMainList = null;
|
|
9701
|
+
}
|
|
9479
9702
|
this.refreshListItems(null);
|
|
9480
9703
|
if (this.mode !== 'Box' && this.mode !== 'CheckBox') {
|
|
9481
9704
|
this.updateDelimView();
|
|
@@ -9503,6 +9726,25 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
9503
9726
|
this.ulElement = this.mainList;
|
|
9504
9727
|
}
|
|
9505
9728
|
this.checkPlaceholderSize();
|
|
9729
|
+
Input.createSpanElement(this.overAllWrapper, this.createElement);
|
|
9730
|
+
this.calculateWidth();
|
|
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
|
+
}
|
|
9734
|
+
}
|
|
9735
|
+
calculateWidth() {
|
|
9736
|
+
let elementWidth;
|
|
9737
|
+
if (this.overAllWrapper) {
|
|
9738
|
+
if (!this.showDropDownIcon || this.overAllWrapper.querySelector('.' + 'e-label-top')) {
|
|
9739
|
+
elementWidth = this.overAllWrapper.clientWidth - 2 * (parseInt(getComputedStyle(this.inputElement).paddingRight));
|
|
9740
|
+
}
|
|
9741
|
+
else {
|
|
9742
|
+
var downIconWidth = this.dropIcon.offsetWidth +
|
|
9743
|
+
parseInt(getComputedStyle(this.dropIcon).marginRight);
|
|
9744
|
+
elementWidth = this.overAllWrapper.clientWidth - (downIconWidth + 2 * (parseInt(getComputedStyle(this.inputElement).paddingRight)));
|
|
9745
|
+
}
|
|
9746
|
+
Input.calculateWidth(elementWidth, this.overAllWrapper, this.getModuleName());
|
|
9747
|
+
}
|
|
9506
9748
|
}
|
|
9507
9749
|
checkPlaceholderSize() {
|
|
9508
9750
|
if (this.showDropDownIcon) {
|
|
@@ -9531,11 +9773,13 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
9531
9773
|
}
|
|
9532
9774
|
}
|
|
9533
9775
|
refreshInputHight() {
|
|
9534
|
-
if (
|
|
9535
|
-
this.
|
|
9536
|
-
|
|
9537
|
-
|
|
9538
|
-
|
|
9776
|
+
if (!isNullOrUndefined(this.searchWrapper)) {
|
|
9777
|
+
if ((!this.value || !this.value.length) && (isNullOrUndefined(this.text) || this.text === '')) {
|
|
9778
|
+
this.searchWrapper.classList.remove(ZERO_SIZE);
|
|
9779
|
+
}
|
|
9780
|
+
else {
|
|
9781
|
+
this.searchWrapper.classList.add(ZERO_SIZE);
|
|
9782
|
+
}
|
|
9539
9783
|
}
|
|
9540
9784
|
}
|
|
9541
9785
|
validateValues(newValue, oldValue) {
|
|
@@ -9573,6 +9817,11 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
9573
9817
|
this.tempValues = this.value.slice();
|
|
9574
9818
|
}
|
|
9575
9819
|
}
|
|
9820
|
+
updateAriaActiveDescendant() {
|
|
9821
|
+
if (!isNullOrUndefined(this.ulElement) && !isNullOrUndefined(this.ulElement.getElementsByClassName('e-item-focus')[0])) {
|
|
9822
|
+
attributes(this.inputElement, { 'aria-activedescendant': this.ulElement.getElementsByClassName('e-item-focus')[0].id });
|
|
9823
|
+
}
|
|
9824
|
+
}
|
|
9576
9825
|
getPagingCount() {
|
|
9577
9826
|
const height = this.list.classList.contains(dropDownBaseClasses.noData) ? null :
|
|
9578
9827
|
getComputedStyle(this.getItems()[0], null).getPropertyValue('height');
|
|
@@ -9633,6 +9882,9 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
9633
9882
|
if (this.isPopupOpen()) {
|
|
9634
9883
|
this.refreshPopup();
|
|
9635
9884
|
}
|
|
9885
|
+
setTimeout(() => {
|
|
9886
|
+
this.calculateWidth();
|
|
9887
|
+
}, 150);
|
|
9636
9888
|
return true;
|
|
9637
9889
|
}
|
|
9638
9890
|
else {
|
|
@@ -9688,7 +9940,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
9688
9940
|
break;
|
|
9689
9941
|
case 40:
|
|
9690
9942
|
if (!this.isPopupOpen()) {
|
|
9691
|
-
this.showPopup();
|
|
9943
|
+
this.showPopup(e);
|
|
9692
9944
|
e.preventDefault();
|
|
9693
9945
|
}
|
|
9694
9946
|
break;
|
|
@@ -9715,6 +9967,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
9715
9967
|
const element = scrollEle[(isHome) ? 0 : (scrollEle.length - 1)];
|
|
9716
9968
|
element.classList.add(dropDownBaseClasses.focus);
|
|
9717
9969
|
this.scrollBottom(element);
|
|
9970
|
+
this.updateAriaActiveDescendant();
|
|
9718
9971
|
}
|
|
9719
9972
|
}
|
|
9720
9973
|
onKeyDown(e) {
|
|
@@ -10216,7 +10469,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
10216
10469
|
}
|
|
10217
10470
|
invokeCheckboxSelection(element, eve, isClearAll) {
|
|
10218
10471
|
this.notify('updatelist', { module: 'CheckBoxSelection', enable: this.mode === 'CheckBox', li: element, e: eve });
|
|
10219
|
-
|
|
10472
|
+
this.updateAriaActiveDescendant();
|
|
10220
10473
|
if ((this.value && this.value.length !== this.mainData.length)
|
|
10221
10474
|
&& (this.mode === 'CheckBox' && this.showSelectAll && !(this.isSelectAll || isClearAll))) {
|
|
10222
10475
|
this.notify('checkSelectAll', {
|
|
@@ -10328,7 +10581,6 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
10328
10581
|
HIDE_LIST :
|
|
10329
10582
|
dropDownBaseClasses.selected);
|
|
10330
10583
|
if (this.mode === 'CheckBox') {
|
|
10331
|
-
element2.firstElementChild.setAttribute('aria-checked', 'false');
|
|
10332
10584
|
removeClass([element2.firstElementChild.lastElementChild], 'e-check');
|
|
10333
10585
|
}
|
|
10334
10586
|
}
|
|
@@ -10338,7 +10590,6 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
10338
10590
|
HIDE_LIST :
|
|
10339
10591
|
dropDownBaseClasses.selected);
|
|
10340
10592
|
if (this.mode === 'CheckBox') {
|
|
10341
|
-
element2.firstElementChild.setAttribute('aria-checked', 'true');
|
|
10342
10593
|
addClass([element2.firstElementChild.lastElementChild], 'e-check');
|
|
10343
10594
|
}
|
|
10344
10595
|
}
|
|
@@ -10596,109 +10847,111 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
10596
10847
|
super.render();
|
|
10597
10848
|
}
|
|
10598
10849
|
if (!this.popupObj) {
|
|
10599
|
-
|
|
10600
|
-
|
|
10601
|
-
|
|
10602
|
-
checkboxFilter.
|
|
10603
|
-
|
|
10604
|
-
|
|
10605
|
-
|
|
10606
|
-
|
|
10607
|
-
|
|
10608
|
-
this.
|
|
10609
|
-
|
|
10610
|
-
}
|
|
10611
|
-
append([this.list], this.popupWrapper);
|
|
10612
|
-
if (this.footerTemplate) {
|
|
10613
|
-
this.setFooterTemplate();
|
|
10614
|
-
overAllHeight -= this.footer.offsetHeight;
|
|
10615
|
-
}
|
|
10616
|
-
if (this.mode === 'CheckBox' && this.showSelectAll) {
|
|
10617
|
-
this.notify('selectAll', { module: 'CheckBoxSelection', enable: this.mode === 'CheckBox' });
|
|
10618
|
-
overAllHeight -= this.selectAllHeight;
|
|
10619
|
-
}
|
|
10620
|
-
else if (this.mode === 'CheckBox' && !this.showSelectAll && (!this.headerTemplate && !this.footerTemplate)) {
|
|
10621
|
-
this.notify('selectAll', { module: 'CheckBoxSelection', enable: this.mode === 'CheckBox' });
|
|
10622
|
-
overAllHeight = parseInt(this.popupHeight, 10);
|
|
10623
|
-
}
|
|
10624
|
-
else if (this.mode === 'CheckBox' && !this.showSelectAll) {
|
|
10625
|
-
this.notify('selectAll', { module: 'CheckBoxSelection', enable: this.mode === 'CheckBox' });
|
|
10626
|
-
overAllHeight = parseInt(this.popupHeight, 10);
|
|
10627
|
-
if (this.headerTemplate && this.header) {
|
|
10850
|
+
if (!isNullOrUndefined(this.popupWrapper)) {
|
|
10851
|
+
document.body.appendChild(this.popupWrapper);
|
|
10852
|
+
const checkboxFilter = this.popupWrapper.querySelector('.' + FILTERPARENT);
|
|
10853
|
+
if (this.mode === 'CheckBox' && !this.allowFiltering && checkboxFilter && this.filterParent) {
|
|
10854
|
+
checkboxFilter.remove();
|
|
10855
|
+
this.filterParent = null;
|
|
10856
|
+
}
|
|
10857
|
+
let overAllHeight = parseInt(this.popupHeight, 10);
|
|
10858
|
+
this.popupWrapper.style.visibility = 'hidden';
|
|
10859
|
+
if (this.headerTemplate) {
|
|
10860
|
+
this.setHeaderTemplate();
|
|
10628
10861
|
overAllHeight -= this.header.offsetHeight;
|
|
10629
10862
|
}
|
|
10630
|
-
|
|
10863
|
+
append([this.list], this.popupWrapper);
|
|
10864
|
+
if (this.footerTemplate) {
|
|
10865
|
+
this.setFooterTemplate();
|
|
10631
10866
|
overAllHeight -= this.footer.offsetHeight;
|
|
10632
10867
|
}
|
|
10633
|
-
|
|
10634
|
-
|
|
10635
|
-
|
|
10636
|
-
|
|
10637
|
-
|
|
10638
|
-
|
|
10639
|
-
|
|
10640
|
-
|
|
10641
|
-
|
|
10642
|
-
|
|
10643
|
-
|
|
10644
|
-
|
|
10645
|
-
|
|
10646
|
-
if (this.popupHeight !== 'auto') {
|
|
10647
|
-
this.list.style.maxHeight = formatUnit(overAllHeight);
|
|
10648
|
-
this.popupWrapper.style.maxHeight = formatUnit(this.popupHeight);
|
|
10649
|
-
}
|
|
10650
|
-
else {
|
|
10651
|
-
this.list.style.maxHeight = formatUnit(this.popupHeight);
|
|
10652
|
-
}
|
|
10653
|
-
this.popupObj = new Popup(this.popupWrapper, {
|
|
10654
|
-
width: this.calcPopupWidth(), targetType: 'relative', position: { X: 'left', Y: 'bottom' },
|
|
10655
|
-
relateTo: this.overAllWrapper, collision: { X: 'flip', Y: 'flip' }, offsetY: 1,
|
|
10656
|
-
enableRtl: this.enableRtl, zIndex: this.zIndex,
|
|
10657
|
-
close: () => {
|
|
10658
|
-
if (this.popupObj.element.parentElement) {
|
|
10659
|
-
this.popupObj.unwireScrollEvents();
|
|
10660
|
-
// For restrict the page scrolling in safari browser
|
|
10661
|
-
const checkboxFilterInput = this.popupWrapper.querySelector('.' + FILTERINPUT);
|
|
10662
|
-
if (this.mode === 'CheckBox' && checkboxFilterInput && document.activeElement === checkboxFilterInput) {
|
|
10663
|
-
checkboxFilterInput.blur();
|
|
10664
|
-
}
|
|
10665
|
-
detach(this.popupObj.element);
|
|
10666
|
-
}
|
|
10667
|
-
},
|
|
10668
|
-
open: () => {
|
|
10669
|
-
this.popupObj.resolveCollision();
|
|
10670
|
-
if (!this.isFirstClick) {
|
|
10671
|
-
const ulElement = this.list.querySelector('ul');
|
|
10672
|
-
if (ulElement) {
|
|
10673
|
-
if (!(this.mode !== 'CheckBox' && (this.allowFiltering || this.allowCustomValue) &&
|
|
10674
|
-
this.targetElement().trim() !== '')) {
|
|
10675
|
-
this.mainList = ulElement.cloneNode ? ulElement.cloneNode(true) : ulElement;
|
|
10676
|
-
}
|
|
10677
|
-
}
|
|
10678
|
-
this.isFirstClick = true;
|
|
10868
|
+
if (this.mode === 'CheckBox' && this.showSelectAll) {
|
|
10869
|
+
this.notify('selectAll', { module: 'CheckBoxSelection', enable: this.mode === 'CheckBox' });
|
|
10870
|
+
overAllHeight -= this.selectAllHeight;
|
|
10871
|
+
}
|
|
10872
|
+
else if (this.mode === 'CheckBox' && !this.showSelectAll && (!this.headerTemplate && !this.footerTemplate)) {
|
|
10873
|
+
this.notify('selectAll', { module: 'CheckBoxSelection', enable: this.mode === 'CheckBox' });
|
|
10874
|
+
overAllHeight = parseInt(this.popupHeight, 10);
|
|
10875
|
+
}
|
|
10876
|
+
else if (this.mode === 'CheckBox' && !this.showSelectAll) {
|
|
10877
|
+
this.notify('selectAll', { module: 'CheckBoxSelection', enable: this.mode === 'CheckBox' });
|
|
10878
|
+
overAllHeight = parseInt(this.popupHeight, 10);
|
|
10879
|
+
if (this.headerTemplate && this.header) {
|
|
10880
|
+
overAllHeight -= this.header.offsetHeight;
|
|
10679
10881
|
}
|
|
10680
|
-
this.
|
|
10681
|
-
|
|
10682
|
-
this.targetElement().trim() !== '')) {
|
|
10683
|
-
this.loadTemplate();
|
|
10882
|
+
if (this.footerTemplate && this.footer) {
|
|
10883
|
+
overAllHeight -= this.footer.offsetHeight;
|
|
10684
10884
|
}
|
|
10685
|
-
|
|
10885
|
+
}
|
|
10886
|
+
if (this.mode === 'CheckBox') {
|
|
10887
|
+
const args = {
|
|
10888
|
+
module: 'CheckBoxSelection',
|
|
10889
|
+
enable: this.mode === 'CheckBox',
|
|
10890
|
+
popupElement: this.popupWrapper
|
|
10891
|
+
};
|
|
10686
10892
|
if (this.allowFiltering) {
|
|
10687
|
-
this.notify('
|
|
10688
|
-
|
|
10689
|
-
});
|
|
10893
|
+
this.notify('searchBox', args);
|
|
10894
|
+
overAllHeight -= this.searchBoxHeight;
|
|
10690
10895
|
}
|
|
10691
|
-
|
|
10692
|
-
|
|
10693
|
-
|
|
10896
|
+
addClass([this.popupWrapper], 'e-checkbox');
|
|
10897
|
+
}
|
|
10898
|
+
if (this.popupHeight !== 'auto') {
|
|
10899
|
+
this.list.style.maxHeight = formatUnit(overAllHeight);
|
|
10900
|
+
this.popupWrapper.style.maxHeight = formatUnit(this.popupHeight);
|
|
10901
|
+
}
|
|
10902
|
+
else {
|
|
10903
|
+
this.list.style.maxHeight = formatUnit(this.popupHeight);
|
|
10904
|
+
}
|
|
10905
|
+
this.popupObj = new Popup(this.popupWrapper, {
|
|
10906
|
+
width: this.calcPopupWidth(), targetType: 'relative', position: { X: 'left', Y: 'bottom' },
|
|
10907
|
+
relateTo: this.overAllWrapper, collision: { X: 'flip', Y: 'flip' }, offsetY: 1,
|
|
10908
|
+
enableRtl: this.enableRtl, zIndex: this.zIndex,
|
|
10909
|
+
close: () => {
|
|
10910
|
+
if (this.popupObj.element.parentElement) {
|
|
10911
|
+
this.popupObj.unwireScrollEvents();
|
|
10912
|
+
// For restrict the page scrolling in safari browser
|
|
10913
|
+
const checkboxFilterInput = this.popupWrapper.querySelector('.' + FILTERINPUT);
|
|
10914
|
+
if (this.mode === 'CheckBox' && checkboxFilterInput && document.activeElement === checkboxFilterInput) {
|
|
10915
|
+
checkboxFilterInput.blur();
|
|
10916
|
+
}
|
|
10917
|
+
detach(this.popupObj.element);
|
|
10918
|
+
}
|
|
10919
|
+
},
|
|
10920
|
+
open: () => {
|
|
10921
|
+
this.popupObj.resolveCollision();
|
|
10922
|
+
if (!this.isFirstClick) {
|
|
10923
|
+
const ulElement = this.list.querySelector('ul');
|
|
10924
|
+
if (ulElement) {
|
|
10925
|
+
if (!(this.mode !== 'CheckBox' && (this.allowFiltering || this.allowCustomValue) &&
|
|
10926
|
+
this.targetElement().trim() !== '')) {
|
|
10927
|
+
this.mainList = ulElement.cloneNode ? ulElement.cloneNode(true) : ulElement;
|
|
10928
|
+
}
|
|
10929
|
+
}
|
|
10930
|
+
this.isFirstClick = true;
|
|
10931
|
+
}
|
|
10932
|
+
this.popupObj.wireScrollEvents();
|
|
10933
|
+
if (!(this.mode !== 'CheckBox' && (this.allowFiltering || this.allowCustomValue) &&
|
|
10934
|
+
this.targetElement().trim() !== '')) {
|
|
10935
|
+
this.loadTemplate();
|
|
10936
|
+
}
|
|
10937
|
+
this.setScrollPosition();
|
|
10938
|
+
if (this.allowFiltering) {
|
|
10939
|
+
this.notify('inputFocus', {
|
|
10940
|
+
module: 'CheckBoxSelection', enable: this.mode === 'CheckBox', value: 'focus'
|
|
10941
|
+
});
|
|
10942
|
+
}
|
|
10943
|
+
}, targetExitViewport: () => {
|
|
10944
|
+
if (!Browser.isDevice) {
|
|
10945
|
+
this.hidePopup();
|
|
10946
|
+
}
|
|
10694
10947
|
}
|
|
10948
|
+
});
|
|
10949
|
+
if (this.mode === 'CheckBox' && Browser.isDevice && this.allowFiltering) {
|
|
10950
|
+
this.notify('deviceSearchBox', { module: 'CheckBoxSelection', enable: this.mode === 'CheckBox' });
|
|
10695
10951
|
}
|
|
10696
|
-
|
|
10697
|
-
|
|
10698
|
-
this.notify('deviceSearchBox', { module: 'CheckBoxSelection', enable: this.mode === 'CheckBox' });
|
|
10952
|
+
this.popupObj.close();
|
|
10953
|
+
this.popupWrapper.style.visibility = '';
|
|
10699
10954
|
}
|
|
10700
|
-
this.popupObj.close();
|
|
10701
|
-
this.popupWrapper.style.visibility = '';
|
|
10702
10955
|
}
|
|
10703
10956
|
}
|
|
10704
10957
|
setHeaderTemplate() {
|
|
@@ -10768,6 +11021,8 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
10768
11021
|
this.removeValue(temp, e, null, true);
|
|
10769
11022
|
}
|
|
10770
11023
|
}
|
|
11024
|
+
this.selectedElementID = null;
|
|
11025
|
+
this.inputElement.removeAttribute('aria-activedescendant');
|
|
10771
11026
|
}
|
|
10772
11027
|
else {
|
|
10773
11028
|
this.clearAllCallback(e);
|
|
@@ -10869,11 +11124,12 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
10869
11124
|
});
|
|
10870
11125
|
}
|
|
10871
11126
|
search(e) {
|
|
11127
|
+
this.resetFilteredData = true;
|
|
10872
11128
|
if (!isNullOrUndefined(e)) {
|
|
10873
11129
|
this.keyCode = e.keyCode;
|
|
10874
11130
|
}
|
|
10875
11131
|
if (!this.isPopupOpen() && this.openOnClick) {
|
|
10876
|
-
this.showPopup();
|
|
11132
|
+
this.showPopup(e);
|
|
10877
11133
|
}
|
|
10878
11134
|
this.openClick(e);
|
|
10879
11135
|
if (this.checkTextLength() && !this.allowFiltering && !isNullOrUndefined(e) && (e.keyCode !== 8)) {
|
|
@@ -10957,7 +11213,9 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
10957
11213
|
let temp;
|
|
10958
11214
|
const tempData = this.listData;
|
|
10959
11215
|
this.listData = this.mainData;
|
|
10960
|
-
this.hiddenElement
|
|
11216
|
+
if (!isNullOrUndefined(this.hiddenElement)) {
|
|
11217
|
+
this.hiddenElement.innerHTML = '';
|
|
11218
|
+
}
|
|
10961
11219
|
if (!isNullOrUndefined(this.value)) {
|
|
10962
11220
|
for (let index = 0; !isNullOrUndefined(this.value[index]); index++) {
|
|
10963
11221
|
const listValue = this.findListElement(((!isNullOrUndefined(this.mainList)) ? this.mainList : this.ulElement), 'li', 'data-value', this.value[index]);
|
|
@@ -10975,7 +11233,9 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
10975
11233
|
data += temp + delimiterChar + ' ';
|
|
10976
11234
|
text.push(temp);
|
|
10977
11235
|
}
|
|
10978
|
-
this.hiddenElement
|
|
11236
|
+
if (!isNullOrUndefined(this.hiddenElement)) {
|
|
11237
|
+
this.hiddenElement.innerHTML += '<option selected value ="' + this.value[index] + '">' + index + '</option>';
|
|
11238
|
+
}
|
|
10979
11239
|
}
|
|
10980
11240
|
}
|
|
10981
11241
|
this.setProperties({ text: text.toString() }, true);
|
|
@@ -11020,7 +11280,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
11020
11280
|
|| this.list.querySelector('.e-ul') && this.list.querySelector('.e-ul').childElementCount === 0)) {
|
|
11021
11281
|
isEmptyData = true;
|
|
11022
11282
|
}
|
|
11023
|
-
super.render(isEmptyData);
|
|
11283
|
+
super.render(null, isEmptyData);
|
|
11024
11284
|
this.unwireListEvents();
|
|
11025
11285
|
this.wireListEvents();
|
|
11026
11286
|
}
|
|
@@ -11108,7 +11368,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
11108
11368
|
}
|
|
11109
11369
|
}
|
|
11110
11370
|
updateDataList() {
|
|
11111
|
-
if (this.mainList && this.ulElement && !(this.isFiltered || this.filterAction)) {
|
|
11371
|
+
if (this.mainList && this.ulElement && !(this.isFiltered || this.filterAction || this.targetElement().trim())) {
|
|
11112
11372
|
let isDynamicGroupItemUpdate = this.mainList.childElementCount < this.ulElement.childElementCount;
|
|
11113
11373
|
let isReactTemplateUpdate = ((this.ulElement.childElementCount > 0 && this.ulElement.children[0].childElementCount > 0) && (this.mainList.children[0].childElementCount < this.ulElement.children[0].childElementCount));
|
|
11114
11374
|
let isAngularTemplateUpdate = this.itemTemplate && this.ulElement.childElementCount > 0 && !(this.ulElement.childElementCount < this.mainList.childElementCount) && (this.ulElement.children[0].childElementCount > 0 || (this.fields.groupBy && this.ulElement.children[1] && this.ulElement.children[1].childElementCount > 0));
|
|
@@ -11186,10 +11446,8 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
11186
11446
|
selectItems[temp1 - 1].setAttribute('aria-selected', 'false');
|
|
11187
11447
|
if (this.mode === 'CheckBox') {
|
|
11188
11448
|
if (selectedItems && (selectedItems.length > (temp1 - 1))) {
|
|
11189
|
-
selectedItems[temp1 - 1].firstElementChild.setAttribute('aria-checked', 'false');
|
|
11190
11449
|
removeClass([selectedItems[temp1 - 1].firstElementChild.lastElementChild], 'e-check');
|
|
11191
11450
|
}
|
|
11192
|
-
selectItems[temp1 - 1].firstElementChild.setAttribute('aria-checked', 'false');
|
|
11193
11451
|
removeClass([selectItems[temp1 - 1].firstElementChild.lastElementChild], 'e-check');
|
|
11194
11452
|
}
|
|
11195
11453
|
temp1--;
|
|
@@ -11230,10 +11488,12 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
11230
11488
|
if (this.enabled && this.isValidLI(element)) {
|
|
11231
11489
|
this.removeFocus();
|
|
11232
11490
|
addClass([element], dropDownBaseClasses.focus);
|
|
11491
|
+
this.updateAriaActiveDescendant();
|
|
11233
11492
|
}
|
|
11234
11493
|
else {
|
|
11235
11494
|
if (this.enableGroupCheckBox && this.mode === 'CheckBox' && !isNullOrUndefined(this.fields.groupBy)) {
|
|
11236
11495
|
addClass([element], dropDownBaseClasses.focus);
|
|
11496
|
+
this.updateAriaActiveDescendant();
|
|
11237
11497
|
}
|
|
11238
11498
|
}
|
|
11239
11499
|
}
|
|
@@ -11245,9 +11505,9 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
11245
11505
|
addClass([element], className);
|
|
11246
11506
|
this.updateMainList(false, element.getAttribute('data-value'), mainElement);
|
|
11247
11507
|
element.setAttribute('aria-selected', 'true');
|
|
11248
|
-
if (this.mode === 'CheckBox') {
|
|
11249
|
-
const ariaCheck = element.
|
|
11250
|
-
if (ariaCheck ===
|
|
11508
|
+
if (this.mode === 'CheckBox' && element.classList.contains('e-active')) {
|
|
11509
|
+
const ariaCheck = element.getElementsByClassName('e-check').length;
|
|
11510
|
+
if (ariaCheck === 0) {
|
|
11251
11511
|
this.notify('updatelist', { module: 'CheckBoxSelection', enable: this.mode === 'CheckBox', li: element, e: this });
|
|
11252
11512
|
}
|
|
11253
11513
|
}
|
|
@@ -11255,7 +11515,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
11255
11515
|
if (this.chipCollectionWrapper) {
|
|
11256
11516
|
this.removeChipSelection();
|
|
11257
11517
|
}
|
|
11258
|
-
|
|
11518
|
+
this.selectedElementID = element.id;
|
|
11259
11519
|
}
|
|
11260
11520
|
}
|
|
11261
11521
|
updateDelimeter(delimChar, e) {
|
|
@@ -11565,9 +11825,11 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
11565
11825
|
if (this.chipCollectionWrapper) {
|
|
11566
11826
|
this.chipCollectionWrapper.style.display = 'none';
|
|
11567
11827
|
}
|
|
11568
|
-
this.viewWrapper
|
|
11569
|
-
|
|
11570
|
-
|
|
11828
|
+
if (!isNullOrUndefined(this.viewWrapper)) {
|
|
11829
|
+
this.viewWrapper.style.display = '';
|
|
11830
|
+
this.viewWrapper.style.width = '';
|
|
11831
|
+
this.viewWrapper.classList.remove(TOTAL_COUNT_WRAPPER$1);
|
|
11832
|
+
}
|
|
11571
11833
|
if (this.value && this.value.length) {
|
|
11572
11834
|
let data = '';
|
|
11573
11835
|
let temp;
|
|
@@ -11618,7 +11880,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
11618
11880
|
overAllContainer = this.componentWrapper.offsetWidth -
|
|
11619
11881
|
parseInt(window.getComputedStyle(this.componentWrapper).paddingLeft, 10) -
|
|
11620
11882
|
parseInt(window.getComputedStyle(this.componentWrapper).paddingRight, 10);
|
|
11621
|
-
if ((wrapperleng + downIconWidth + this.clearIconWidth)
|
|
11883
|
+
if ((wrapperleng + downIconWidth + this.clearIconWidth) >= overAllContainer) {
|
|
11622
11884
|
if (tempData !== undefined && tempData !== '') {
|
|
11623
11885
|
temp = tempData;
|
|
11624
11886
|
index = tempIndex + 1;
|
|
@@ -11627,7 +11889,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
11627
11889
|
remaining = this.value.length - index;
|
|
11628
11890
|
wrapperleng = this.viewWrapper.offsetWidth +
|
|
11629
11891
|
parseInt(window.getComputedStyle(this.viewWrapper).paddingRight, 10);
|
|
11630
|
-
while (((wrapperleng + remainSize + downIconWidth + this.clearIconWidth)
|
|
11892
|
+
while (((wrapperleng + remainSize + downIconWidth + this.clearIconWidth) >= overAllContainer) && wrapperleng !== 0
|
|
11631
11893
|
&& this.viewWrapper.innerHTML !== '') {
|
|
11632
11894
|
const textArr = [];
|
|
11633
11895
|
this.viewWrapper.innerHTML = textArr.join(this.delimiterChar);
|
|
@@ -11637,7 +11899,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
11637
11899
|
}
|
|
11638
11900
|
break;
|
|
11639
11901
|
}
|
|
11640
|
-
else if ((wrapperleng + remainSize + downIconWidth + this.clearIconWidth)
|
|
11902
|
+
else if ((wrapperleng + remainSize + downIconWidth + this.clearIconWidth) < overAllContainer) {
|
|
11641
11903
|
tempData = data;
|
|
11642
11904
|
tempIndex = index;
|
|
11643
11905
|
}
|
|
@@ -11655,8 +11917,10 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
11655
11917
|
}
|
|
11656
11918
|
}
|
|
11657
11919
|
else {
|
|
11658
|
-
this.viewWrapper
|
|
11659
|
-
|
|
11920
|
+
if (!isNullOrUndefined(this.viewWrapper)) {
|
|
11921
|
+
this.viewWrapper.innerHTML = '';
|
|
11922
|
+
this.viewWrapper.style.display = 'none';
|
|
11923
|
+
}
|
|
11660
11924
|
}
|
|
11661
11925
|
}
|
|
11662
11926
|
checkClearIconWidth() {
|
|
@@ -11729,29 +11993,41 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
11729
11993
|
return temp;
|
|
11730
11994
|
}
|
|
11731
11995
|
unWireEvent() {
|
|
11732
|
-
|
|
11996
|
+
if (!isNullOrUndefined(this.componentWrapper)) {
|
|
11997
|
+
EventHandler.remove(this.componentWrapper, 'mousedown', this.wrapperClick);
|
|
11998
|
+
}
|
|
11733
11999
|
EventHandler.remove(window, 'resize', this.windowResize);
|
|
11734
|
-
|
|
11735
|
-
|
|
11736
|
-
|
|
11737
|
-
|
|
12000
|
+
if (!isNullOrUndefined(this.inputElement)) {
|
|
12001
|
+
EventHandler.remove(this.inputElement, 'focus', this.focusInHandler);
|
|
12002
|
+
EventHandler.remove(this.inputElement, 'keydown', this.onKeyDown);
|
|
12003
|
+
if (this.mode !== 'CheckBox') {
|
|
12004
|
+
EventHandler.remove(this.inputElement, 'input', this.onInput);
|
|
12005
|
+
}
|
|
12006
|
+
EventHandler.remove(this.inputElement, 'keyup', this.keyUp);
|
|
12007
|
+
const formElement = closest(this.inputElement, 'form');
|
|
12008
|
+
if (formElement) {
|
|
12009
|
+
EventHandler.remove(formElement, 'reset', this.resetValueHandler);
|
|
12010
|
+
}
|
|
12011
|
+
EventHandler.remove(this.inputElement, 'blur', this.onBlurHandler);
|
|
11738
12012
|
}
|
|
11739
|
-
|
|
11740
|
-
|
|
11741
|
-
|
|
11742
|
-
|
|
12013
|
+
if (!isNullOrUndefined(this.componentWrapper)) {
|
|
12014
|
+
EventHandler.remove(this.componentWrapper, 'mouseover', this.mouseIn);
|
|
12015
|
+
EventHandler.remove(this.componentWrapper, 'mouseout', this.mouseOut);
|
|
12016
|
+
}
|
|
12017
|
+
if (!isNullOrUndefined(this.overAllClear)) {
|
|
12018
|
+
EventHandler.remove(this.overAllClear, 'mousedown', this.clearAll);
|
|
12019
|
+
}
|
|
12020
|
+
if (!isNullOrUndefined(this.inputElement)) {
|
|
12021
|
+
EventHandler.remove(this.inputElement, 'paste', this.pasteHandler);
|
|
11743
12022
|
}
|
|
11744
|
-
EventHandler.remove(this.inputElement, 'blur', this.onBlurHandler);
|
|
11745
|
-
EventHandler.remove(this.componentWrapper, 'mouseover', this.mouseIn);
|
|
11746
|
-
EventHandler.remove(this.componentWrapper, 'mouseout', this.mouseOut);
|
|
11747
|
-
EventHandler.remove(this.overAllClear, 'mousedown', this.clearAll);
|
|
11748
|
-
EventHandler.remove(this.inputElement, 'paste', this.pasteHandler);
|
|
11749
12023
|
}
|
|
11750
12024
|
selectAllItem(state, event, list) {
|
|
11751
12025
|
let li;
|
|
11752
|
-
|
|
11753
|
-
|
|
11754
|
-
|
|
12026
|
+
if (!isNullOrUndefined(this.list)) {
|
|
12027
|
+
li = this.list.querySelectorAll(state ?
|
|
12028
|
+
'li.e-list-item:not([aria-selected="true"]):not(.e-reorder-hide)' :
|
|
12029
|
+
'li.e-list-item[aria-selected="true"]:not(.e-reorder-hide)');
|
|
12030
|
+
}
|
|
11755
12031
|
if (this.value && this.value.length && event && event.target
|
|
11756
12032
|
&& closest(event.target, '.e-close-hooker') && this.allowFiltering) {
|
|
11757
12033
|
li = this.mainList.querySelectorAll(state ?
|
|
@@ -11801,6 +12077,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
11801
12077
|
target.classList.remove('e-active');
|
|
11802
12078
|
}
|
|
11803
12079
|
target.classList.add('e-item-focus');
|
|
12080
|
+
this.updateAriaActiveDescendant();
|
|
11804
12081
|
}
|
|
11805
12082
|
this.textboxValueUpdate();
|
|
11806
12083
|
this.checkPlaceholderSize();
|
|
@@ -11815,6 +12092,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
11815
12092
|
else {
|
|
11816
12093
|
this.updateValue(event, li, state);
|
|
11817
12094
|
}
|
|
12095
|
+
this.addValidInputClass();
|
|
11818
12096
|
}
|
|
11819
12097
|
updateValue(event, li, state) {
|
|
11820
12098
|
const length = li.length;
|
|
@@ -12037,6 +12315,11 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
12037
12315
|
onPropertyChanged(newProp, oldProp) {
|
|
12038
12316
|
if (newProp.dataSource && !isNullOrUndefined(Object.keys(newProp.dataSource))
|
|
12039
12317
|
|| newProp.query && !isNullOrUndefined(Object.keys(newProp.query))) {
|
|
12318
|
+
if (this.resetFilteredData) {
|
|
12319
|
+
// The filtered data is not being reset in the component after the user focuses out.
|
|
12320
|
+
this.resetMainList = !this.resetMainList ? this.mainList : this.resetMainList;
|
|
12321
|
+
this.resetFilteredData = false;
|
|
12322
|
+
}
|
|
12040
12323
|
this.mainList = null;
|
|
12041
12324
|
this.mainData = null;
|
|
12042
12325
|
this.isFirstClick = false;
|
|
@@ -12096,6 +12379,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
12096
12379
|
case 'cssClass':
|
|
12097
12380
|
this.updateOldPropCssClass(oldProp.cssClass);
|
|
12098
12381
|
this.updateCssClass();
|
|
12382
|
+
this.calculateWidth();
|
|
12099
12383
|
break;
|
|
12100
12384
|
case 'enableRtl':
|
|
12101
12385
|
this.enableRTL(newProp.enableRtl);
|
|
@@ -12122,6 +12406,11 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
12122
12406
|
case 'floatLabelType':
|
|
12123
12407
|
this.setFloatLabelType();
|
|
12124
12408
|
this.addValidInputClass();
|
|
12409
|
+
Input.createSpanElement(this.overAllWrapper, this.createElement);
|
|
12410
|
+
this.calculateWidth();
|
|
12411
|
+
if (!isNullOrUndefined(this.overAllWrapper) && !isNullOrUndefined(this.overAllWrapper.getElementsByClassName('e-ddl-icon')[0] && this.overAllWrapper.getElementsByClassName('e-float-text-content')[0] && this.floatLabelType !== 'Never')) {
|
|
12412
|
+
this.overAllWrapper.getElementsByClassName('e-float-text-content')[0].classList.add('e-icon');
|
|
12413
|
+
}
|
|
12125
12414
|
break;
|
|
12126
12415
|
case 'enableSelectionOrder':
|
|
12127
12416
|
break;
|
|
@@ -12180,7 +12469,9 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
12180
12469
|
;
|
|
12181
12470
|
addNonPresentItems(valuecheck, ulElement, list, event) {
|
|
12182
12471
|
this.dataSource.executeQuery(this.getForQuery(valuecheck)).then((e) => {
|
|
12183
|
-
|
|
12472
|
+
if (e.result.length > 0) {
|
|
12473
|
+
this.addItem(e.result, list.length);
|
|
12474
|
+
}
|
|
12184
12475
|
this.updateActionList(ulElement, list, event);
|
|
12185
12476
|
});
|
|
12186
12477
|
}
|
|
@@ -12239,7 +12530,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
12239
12530
|
* Adds a new item to the multiselect popup list. By default, new item appends to the list as the last item,
|
|
12240
12531
|
* but you can insert based on the index parameter.
|
|
12241
12532
|
*
|
|
12242
|
-
* @param
|
|
12533
|
+
* @param { Object[] } items - Specifies an array of JSON data or a JSON data.
|
|
12243
12534
|
* @param { number } itemIndex - Specifies the index to place the newly added item in the popup list.
|
|
12244
12535
|
* @returns {void}
|
|
12245
12536
|
*/
|
|
@@ -12270,6 +12561,8 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
12270
12561
|
this.overAllWrapper.classList.remove(iconAnimation);
|
|
12271
12562
|
this.popupObj.hide(new Animation(eventArgs.animation));
|
|
12272
12563
|
attributes(this.inputElement, { 'aria-expanded': 'false' });
|
|
12564
|
+
this.inputElement.removeAttribute('aria-owns');
|
|
12565
|
+
this.inputElement.removeAttribute('aria-activedescendant');
|
|
12273
12566
|
if (this.allowFiltering) {
|
|
12274
12567
|
this.notify('inputFocus', { module: 'CheckBoxSelection', enable: this.mode === 'CheckBox', value: 'clear' });
|
|
12275
12568
|
}
|
|
@@ -12285,7 +12578,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
12285
12578
|
*
|
|
12286
12579
|
* @returns {void}
|
|
12287
12580
|
*/
|
|
12288
|
-
showPopup() {
|
|
12581
|
+
showPopup(e) {
|
|
12289
12582
|
if (!this.enabled) {
|
|
12290
12583
|
return;
|
|
12291
12584
|
}
|
|
@@ -12294,7 +12587,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
12294
12587
|
if (!args.cancel) {
|
|
12295
12588
|
if (!this.ulElement) {
|
|
12296
12589
|
this.beforePopupOpen = true;
|
|
12297
|
-
super.render();
|
|
12590
|
+
super.render(e);
|
|
12298
12591
|
if (this.mode === 'CheckBox' && Browser.isDevice && this.allowFiltering) {
|
|
12299
12592
|
this.notify('popupFullScreen', { module: 'CheckBoxSelection', enable: this.mode === 'CheckBox' });
|
|
12300
12593
|
}
|
|
@@ -12310,7 +12603,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
12310
12603
|
this.beforePopupOpen = false;
|
|
12311
12604
|
return;
|
|
12312
12605
|
}
|
|
12313
|
-
this.onPopupShown();
|
|
12606
|
+
this.onPopupShown(e);
|
|
12314
12607
|
}
|
|
12315
12608
|
});
|
|
12316
12609
|
}
|
|
@@ -12411,12 +12704,12 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
12411
12704
|
spellcheck: 'false',
|
|
12412
12705
|
type: 'text',
|
|
12413
12706
|
autocomplete: 'off',
|
|
12414
|
-
tabindex: '0'
|
|
12707
|
+
tabindex: '0',
|
|
12708
|
+
role: 'combobox'
|
|
12415
12709
|
}
|
|
12416
12710
|
});
|
|
12417
12711
|
if (this.mode === 'Default' || this.mode === 'Box') {
|
|
12418
12712
|
this.inputElement.setAttribute('aria-describedby', this.chipCollectionWrapper.id);
|
|
12419
|
-
this.inputElement.setAttribute('aria-labelledby', this.chipCollectionWrapper.id);
|
|
12420
12713
|
}
|
|
12421
12714
|
if (this.element.tagName !== this.getNgDirective()) {
|
|
12422
12715
|
this.element.style.display = 'none';
|
|
@@ -12449,6 +12742,9 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
12449
12742
|
if (this.mode !== 'CheckBox') {
|
|
12450
12743
|
this.hideOverAllClear();
|
|
12451
12744
|
}
|
|
12745
|
+
if (!isNullOrUndefined(closest(this.element, "fieldset")) && closest(this.element, "fieldset").disabled) {
|
|
12746
|
+
this.enabled = false;
|
|
12747
|
+
}
|
|
12452
12748
|
this.wireEvent();
|
|
12453
12749
|
this.enable(this.enabled);
|
|
12454
12750
|
this.enableRTL(this.enableRtl);
|
|
@@ -12456,6 +12752,11 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
12456
12752
|
if (this.element.hasAttribute('data-val')) {
|
|
12457
12753
|
this.element.setAttribute('data-val', 'false');
|
|
12458
12754
|
}
|
|
12755
|
+
Input.createSpanElement(this.overAllWrapper, this.createElement);
|
|
12756
|
+
this.calculateWidth();
|
|
12757
|
+
if (!isNullOrUndefined(this.overAllWrapper) && !isNullOrUndefined(this.overAllWrapper.getElementsByClassName('e-ddl-icon')[0] && this.overAllWrapper.getElementsByClassName('e-float-text-content')[0] && this.floatLabelType !== 'Never')) {
|
|
12758
|
+
this.overAllWrapper.getElementsByClassName('e-float-text-content')[0].classList.add('e-icon');
|
|
12759
|
+
}
|
|
12459
12760
|
this.renderComplete();
|
|
12460
12761
|
}
|
|
12461
12762
|
checkInitialValue() {
|
|
@@ -12536,11 +12837,13 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
12536
12837
|
}
|
|
12537
12838
|
}
|
|
12538
12839
|
addValidInputClass() {
|
|
12539
|
-
if (
|
|
12540
|
-
|
|
12541
|
-
|
|
12542
|
-
|
|
12543
|
-
|
|
12840
|
+
if (!isNullOrUndefined(this.overAllWrapper)) {
|
|
12841
|
+
if ((!isNullOrUndefined(this.value) && this.value.length) || this.floatLabelType === 'Always') {
|
|
12842
|
+
addClass([this.overAllWrapper], 'e-valid-input');
|
|
12843
|
+
}
|
|
12844
|
+
else {
|
|
12845
|
+
removeClass([this.overAllWrapper], 'e-valid-input');
|
|
12846
|
+
}
|
|
12544
12847
|
}
|
|
12545
12848
|
}
|
|
12546
12849
|
dropDownIcon() {
|
|
@@ -12591,15 +12894,19 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
12591
12894
|
this.ulElement = null;
|
|
12592
12895
|
this.mainListCollection = null;
|
|
12593
12896
|
super.destroy();
|
|
12594
|
-
const temp = ['readonly', 'aria-disabled', '
|
|
12897
|
+
const temp = ['readonly', 'aria-disabled', 'placeholder'];
|
|
12595
12898
|
let length = temp.length;
|
|
12596
|
-
|
|
12597
|
-
|
|
12598
|
-
|
|
12899
|
+
if (!isNullOrUndefined(this.inputElement)) {
|
|
12900
|
+
while (length > 0) {
|
|
12901
|
+
this.inputElement.removeAttribute(temp[length - 1]);
|
|
12902
|
+
length--;
|
|
12903
|
+
}
|
|
12599
12904
|
}
|
|
12600
|
-
this.element
|
|
12601
|
-
|
|
12602
|
-
|
|
12905
|
+
if (!isNullOrUndefined(this.element)) {
|
|
12906
|
+
this.element.removeAttribute('data-initial-value');
|
|
12907
|
+
this.element.style.display = 'block';
|
|
12908
|
+
}
|
|
12909
|
+
if (this.overAllWrapper && this.overAllWrapper.parentElement) {
|
|
12603
12910
|
if (this.overAllWrapper.parentElement.tagName === this.getNgDirective()) {
|
|
12604
12911
|
remove(this.overAllWrapper);
|
|
12605
12912
|
}
|
|
@@ -12608,6 +12915,25 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
12608
12915
|
remove(this.overAllWrapper);
|
|
12609
12916
|
}
|
|
12610
12917
|
}
|
|
12918
|
+
this.componentWrapper = null;
|
|
12919
|
+
this.overAllClear = null;
|
|
12920
|
+
this.overAllWrapper = null;
|
|
12921
|
+
this.hiddenElement = null;
|
|
12922
|
+
this.searchWrapper = null;
|
|
12923
|
+
this.viewWrapper = null;
|
|
12924
|
+
this.chipCollectionWrapper = null;
|
|
12925
|
+
this.targetInputElement = null;
|
|
12926
|
+
this.popupWrapper = null;
|
|
12927
|
+
this.inputElement = null;
|
|
12928
|
+
this.delimiterWrapper = null;
|
|
12929
|
+
this.popupObj = null;
|
|
12930
|
+
this.popupWrapper = null;
|
|
12931
|
+
this.liCollections = null;
|
|
12932
|
+
this.header = null;
|
|
12933
|
+
this.mainList = null;
|
|
12934
|
+
this.mainListCollection = null;
|
|
12935
|
+
this.footer = null;
|
|
12936
|
+
this.selectAllEventEle = null;
|
|
12611
12937
|
}
|
|
12612
12938
|
};
|
|
12613
12939
|
__decorate$5([
|
|
@@ -12957,6 +13283,12 @@ class CheckBoxSelection {
|
|
|
12957
13283
|
destroy() {
|
|
12958
13284
|
this.removeEventListener();
|
|
12959
13285
|
EventHandler.remove(document, 'mousedown', this.onDocumentClick);
|
|
13286
|
+
this.checkAllParent = null;
|
|
13287
|
+
this.clearIconElement = null;
|
|
13288
|
+
this.filterInput = null;
|
|
13289
|
+
this.filterInputObj = null;
|
|
13290
|
+
this.checkWrapper = null;
|
|
13291
|
+
this.selectAllSpan = null;
|
|
12960
13292
|
}
|
|
12961
13293
|
listSelection(args) {
|
|
12962
13294
|
let target;
|
|
@@ -13005,12 +13337,10 @@ class CheckBoxSelection {
|
|
|
13005
13337
|
e.preventDefault();
|
|
13006
13338
|
}
|
|
13007
13339
|
changeState(wrapper, state, e, isPrevent, selectAll$$1) {
|
|
13008
|
-
let ariaState;
|
|
13009
13340
|
const frameSpan = wrapper.getElementsByClassName(CHECKBOXFRAME$1)[0];
|
|
13010
13341
|
if (state === 'check' && !frameSpan.classList.contains(CHECK$1)) {
|
|
13011
13342
|
frameSpan.classList.remove(INDETERMINATE);
|
|
13012
13343
|
frameSpan.classList.add(CHECK$1);
|
|
13013
|
-
ariaState = 'true';
|
|
13014
13344
|
if (selectAll$$1) {
|
|
13015
13345
|
this.parent.selectAllItems(true, e);
|
|
13016
13346
|
this.setLocale(true);
|
|
@@ -13018,7 +13348,6 @@ class CheckBoxSelection {
|
|
|
13018
13348
|
}
|
|
13019
13349
|
else if (state === 'uncheck' && (frameSpan.classList.contains(CHECK$1) || frameSpan.classList.contains(INDETERMINATE))) {
|
|
13020
13350
|
removeClass([frameSpan], [CHECK$1, INDETERMINATE]);
|
|
13021
|
-
ariaState = 'false';
|
|
13022
13351
|
if (selectAll$$1) {
|
|
13023
13352
|
this.parent.selectAllItems(false, e);
|
|
13024
13353
|
this.setLocale();
|
|
@@ -13027,16 +13356,11 @@ class CheckBoxSelection {
|
|
|
13027
13356
|
else if (state === 'indeterminate' && !(frameSpan.classList.contains(INDETERMINATE))) {
|
|
13028
13357
|
removeClass([frameSpan], [CHECK$1]);
|
|
13029
13358
|
frameSpan.classList.add(INDETERMINATE);
|
|
13030
|
-
ariaState = 'false';
|
|
13031
13359
|
if (selectAll$$1) {
|
|
13032
13360
|
this.parent.selectAllItems(false, e);
|
|
13033
13361
|
this.setLocale();
|
|
13034
13362
|
}
|
|
13035
13363
|
}
|
|
13036
|
-
ariaState = state === 'check' ? 'true' : state === 'uncheck' ? 'false' : ariaState;
|
|
13037
|
-
if (!isNullOrUndefined(ariaState)) {
|
|
13038
|
-
wrapper.setAttribute('aria-checked', ariaState);
|
|
13039
|
-
}
|
|
13040
13364
|
}
|
|
13041
13365
|
setSearchBox(args) {
|
|
13042
13366
|
if (isNullOrUndefined(this.parent.filterParent)) {
|
|
@@ -13070,11 +13394,8 @@ class CheckBoxSelection {
|
|
|
13070
13394
|
prepend([this.parent.filterParent], args.popupElement);
|
|
13071
13395
|
attributes(this.filterInput, {
|
|
13072
13396
|
'aria-disabled': 'false',
|
|
13073
|
-
'
|
|
13074
|
-
'role': 'listbox',
|
|
13075
|
-
'aria-activedescendant': null,
|
|
13397
|
+
'role': 'combobox',
|
|
13076
13398
|
'autocomplete': 'off',
|
|
13077
|
-
'autocorrect': 'off',
|
|
13078
13399
|
'autocapitalize': 'off',
|
|
13079
13400
|
'spellcheck': 'false'
|
|
13080
13401
|
});
|
|
@@ -13200,8 +13521,8 @@ class CheckBoxSelection {
|
|
|
13200
13521
|
e.preventDefault();
|
|
13201
13522
|
}
|
|
13202
13523
|
}
|
|
13203
|
-
if (!(!isNullOrUndefined(this.parent.popupObj) && closest(target, '[id="' + this.parent.popupObj.element.id + '"]'))
|
|
13204
|
-
!this.parent.overAllWrapper.contains(e.target)) {
|
|
13524
|
+
if (!(!isNullOrUndefined(this.parent.popupObj) && closest(target, '[id="' + this.parent.popupObj.element.id + '"]'))
|
|
13525
|
+
&& !isNullOrUndefined(this.parent.overAllWrapper) && !this.parent.overAllWrapper.contains(e.target)) {
|
|
13205
13526
|
if (this.parent.overAllWrapper.classList.contains(dropDownBaseClasses.focus) || this.parent.isPopupOpen()) {
|
|
13206
13527
|
this.parent.inputFocus = false;
|
|
13207
13528
|
this.parent.scrollFocusStatus = false;
|
|
@@ -13214,7 +13535,7 @@ class CheckBoxSelection {
|
|
|
13214
13535
|
this.parent.scrollFocusStatus = (Browser.isIE || Browser.info.name === 'edge') &&
|
|
13215
13536
|
(document.activeElement === this.filterInput);
|
|
13216
13537
|
}
|
|
13217
|
-
if (!this.parent.overAllWrapper.contains(e.target) && this.parent.overAllWrapper.classList.contains('e-input-focus') &&
|
|
13538
|
+
if (!isNullOrUndefined(this.parent.overAllWrapper) && !this.parent.overAllWrapper.contains(e.target) && this.parent.overAllWrapper.classList.contains('e-input-focus') &&
|
|
13218
13539
|
!this.parent.isPopupOpen()) {
|
|
13219
13540
|
if (Browser.isIE) {
|
|
13220
13541
|
this.parent.onBlurHandler();
|
|
@@ -13245,7 +13566,7 @@ class CheckBoxSelection {
|
|
|
13245
13566
|
}
|
|
13246
13567
|
}
|
|
13247
13568
|
checkSelectAll(e) {
|
|
13248
|
-
if (e.value === 'check'
|
|
13569
|
+
if (e.value === 'check') {
|
|
13249
13570
|
this.changeState(this.checkAllParent, e.value, null, null, false);
|
|
13250
13571
|
this.setLocale(true);
|
|
13251
13572
|
}
|
|
@@ -13402,6 +13723,7 @@ let ListBox = ListBox_1 = class ListBox extends DropDownBase {
|
|
|
13402
13723
|
this.isCustomFiltering = false;
|
|
13403
13724
|
this.initialSelectedOptions = this.value;
|
|
13404
13725
|
super.render();
|
|
13726
|
+
this.setEnabled();
|
|
13405
13727
|
this.renderComplete();
|
|
13406
13728
|
}
|
|
13407
13729
|
initWrapper() {
|
|
@@ -13436,7 +13758,7 @@ let ListBox = ListBox_1 = class ListBox extends DropDownBase {
|
|
|
13436
13758
|
removeClass([this.list], [dropDownBaseClasses.content, dropDownBaseClasses.root]);
|
|
13437
13759
|
this.validationAttribute(this.element, hiddenSelect);
|
|
13438
13760
|
this.list.setAttribute('role', 'listbox');
|
|
13439
|
-
attributes(this.list, { 'role': 'listbox', 'aria-multiselectable': this.selectionSettings.mode === 'Multiple' ? 'true' : 'false' });
|
|
13761
|
+
attributes(this.list, { 'role': 'listbox', 'aria-label': 'listbox', 'aria-multiselectable': this.selectionSettings.mode === 'Multiple' ? 'true' : 'false' });
|
|
13440
13762
|
this.updateSelectionSettings();
|
|
13441
13763
|
}
|
|
13442
13764
|
updateSelectionSettings() {
|
|
@@ -13692,14 +14014,14 @@ let ListBox = ListBox_1 = class ListBox extends DropDownBase {
|
|
|
13692
14014
|
triggerDrag(args) {
|
|
13693
14015
|
let scrollParent;
|
|
13694
14016
|
let boundRect;
|
|
13695
|
-
|
|
14017
|
+
const scrollMoved = 36;
|
|
13696
14018
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
13697
|
-
|
|
14019
|
+
const event = args.event;
|
|
13698
14020
|
let wrapper;
|
|
13699
|
-
if (args.target && (args.target.classList.contains(
|
|
13700
|
-
|| args.target.classList.contains(
|
|
13701
|
-
if (args.target.classList.contains(
|
|
13702
|
-
|| args.target.classList.contains(
|
|
14021
|
+
if (args.target && (args.target.classList.contains('e-listbox-wrapper') || args.target.classList.contains('e-list-item')
|
|
14022
|
+
|| args.target.classList.contains('e-filter-parent') || args.target.classList.contains('e-input-group'))) {
|
|
14023
|
+
if (args.target.classList.contains('e-list-item') || args.target.classList.contains('e-filter-parent')
|
|
14024
|
+
|| args.target.classList.contains('e-input-group')) {
|
|
13703
14025
|
wrapper = args.target.closest('.e-listbox-wrapper');
|
|
13704
14026
|
}
|
|
13705
14027
|
else {
|
|
@@ -13753,7 +14075,8 @@ let ListBox = ListBox_1 = class ListBox extends DropDownBase {
|
|
|
13753
14075
|
const getArgs = this.getDragArgs({ target: args.droppedElement }, true);
|
|
13754
14076
|
const sourceArgs = { previousData: this.dataSource };
|
|
13755
14077
|
const destArgs = { previousData: listObj.dataSource };
|
|
13756
|
-
let dragArgs = extend({}, getArgs, { target: args.target, source: { previousData: this.dataSource },
|
|
14078
|
+
let dragArgs = extend({}, getArgs, { target: args.target, source: { previousData: this.dataSource },
|
|
14079
|
+
previousIndex: args.previousIndex, currentIndex: args.currentIndex });
|
|
13757
14080
|
if (listObj !== this) {
|
|
13758
14081
|
const sourceArgs1 = extend(sourceArgs, { currentData: this.listData });
|
|
13759
14082
|
dragArgs = extend(dragArgs, { source: sourceArgs1, destination: destArgs });
|
|
@@ -13847,14 +14170,14 @@ let ListBox = ListBox_1 = class ListBox extends DropDownBase {
|
|
|
13847
14170
|
currIdx++;
|
|
13848
14171
|
});
|
|
13849
14172
|
if (this.fields.groupBy) {
|
|
13850
|
-
|
|
14173
|
+
const sourceElem = this.renderItems(this.listData, this.fields);
|
|
13851
14174
|
this.updateListItems(sourceElem, this.ulElement);
|
|
13852
14175
|
this.setSelection();
|
|
13853
14176
|
}
|
|
13854
14177
|
if (listObj.sortOrder !== 'None' || this.selectionSettings.showCheckbox
|
|
13855
14178
|
!== listObj.selectionSettings.showCheckbox || listObj.fields.groupBy || listObj.itemTemplate || this.itemTemplate) {
|
|
13856
14179
|
const sortable = getComponent(ul, 'sortable');
|
|
13857
|
-
|
|
14180
|
+
const sourceElem = listObj.renderItems(listData, listObj.fields);
|
|
13858
14181
|
listObj.updateListItems(sourceElem, ul);
|
|
13859
14182
|
this.setSelection();
|
|
13860
14183
|
if (sortable.placeHolderElement) {
|
|
@@ -13881,10 +14204,17 @@ let ListBox = ListBox_1 = class ListBox extends DropDownBase {
|
|
|
13881
14204
|
dragArgs = extend(dragArgs, { destination: dragArgs1 });
|
|
13882
14205
|
}
|
|
13883
14206
|
this.trigger('drop', dragArgs);
|
|
14207
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14208
|
+
const liCollElem = dragArgs.elements;
|
|
14209
|
+
if (liCollElem.length) {
|
|
14210
|
+
for (let i = 0; i < liCollElem.length; i++) {
|
|
14211
|
+
liCollElem[i].classList.remove('e-grabbed');
|
|
14212
|
+
}
|
|
14213
|
+
}
|
|
13884
14214
|
}
|
|
13885
14215
|
updateListItems(sourceElem, destElem) {
|
|
13886
14216
|
const i = 0;
|
|
13887
|
-
destElem.innerHTML =
|
|
14217
|
+
destElem.innerHTML = '';
|
|
13888
14218
|
while (i < sourceElem.childNodes.length) {
|
|
13889
14219
|
destElem.appendChild(sourceElem.childNodes[i]);
|
|
13890
14220
|
}
|
|
@@ -13913,6 +14243,14 @@ let ListBox = ListBox_1 = class ListBox extends DropDownBase {
|
|
|
13913
14243
|
}
|
|
13914
14244
|
return listObj;
|
|
13915
14245
|
}
|
|
14246
|
+
/**
|
|
14247
|
+
* Sets the enabled state to DropDownBase.
|
|
14248
|
+
*
|
|
14249
|
+
* @returns {void}
|
|
14250
|
+
*/
|
|
14251
|
+
setEnabled() {
|
|
14252
|
+
this.element.setAttribute('aria-disabled', (this.enabled) ? 'false' : 'true');
|
|
14253
|
+
}
|
|
13916
14254
|
listOption(dataSource, fields) {
|
|
13917
14255
|
this.listCurrentOptions = super.listOption(dataSource, fields);
|
|
13918
14256
|
this.listCurrentOptions = extend({}, this.listCurrentOptions, { itemCreated: this.triggerBeforeItemRender.bind(this) }, true);
|
|
@@ -13944,7 +14282,7 @@ let ListBox = ListBox_1 = class ListBox extends DropDownBase {
|
|
|
13944
14282
|
enableItems(items, enable = true, isValue) {
|
|
13945
14283
|
let li;
|
|
13946
14284
|
items.forEach((item) => {
|
|
13947
|
-
|
|
14285
|
+
const text = item;
|
|
13948
14286
|
li = this.findListElement(this.list, 'li', 'data-value', isValue ? text : this.getValueByText(text));
|
|
13949
14287
|
if (!li) {
|
|
13950
14288
|
return;
|
|
@@ -14069,7 +14407,7 @@ let ListBox = ListBox_1 = class ListBox extends DropDownBase {
|
|
|
14069
14407
|
if (this.listData.length === 0) {
|
|
14070
14408
|
this.l10nUpdate();
|
|
14071
14409
|
}
|
|
14072
|
-
this.value =
|
|
14410
|
+
this.value = [];
|
|
14073
14411
|
this.updateToolBarState();
|
|
14074
14412
|
}
|
|
14075
14413
|
/**
|
|
@@ -14349,9 +14687,7 @@ let ListBox = ListBox_1 = class ListBox extends DropDownBase {
|
|
|
14349
14687
|
prepend([this.filterParent], this.list);
|
|
14350
14688
|
attributes(this.filterInput, {
|
|
14351
14689
|
'aria-disabled': 'false',
|
|
14352
|
-
'aria-
|
|
14353
|
-
'role': 'listbox',
|
|
14354
|
-
'aria-activedescendant': null,
|
|
14690
|
+
'aria-label': 'search list item',
|
|
14355
14691
|
'autocomplete': 'off',
|
|
14356
14692
|
'autocorrect': 'off',
|
|
14357
14693
|
'autocapitalize': 'off',
|
|
@@ -14388,12 +14724,12 @@ let ListBox = ListBox_1 = class ListBox extends DropDownBase {
|
|
|
14388
14724
|
if (li && li.parentElement) {
|
|
14389
14725
|
currSelIdx = [].slice.call(li.parentElement.children).indexOf(li);
|
|
14390
14726
|
if (!this.selectionSettings.showCheckbox) {
|
|
14391
|
-
if ((e.ctrlKey || Browser.isDevice) && this.isSelected(li)) {
|
|
14727
|
+
if ((e.ctrlKey || e.metaKey || Browser.isDevice) && this.isSelected(li)) {
|
|
14392
14728
|
li.classList.remove(cssClass.selected);
|
|
14393
14729
|
li.removeAttribute('aria-selected');
|
|
14394
14730
|
isSelect = false;
|
|
14395
14731
|
}
|
|
14396
|
-
else if (!(this.selectionSettings.mode === 'Multiple' && (e.ctrlKey || Browser.isDevice))) {
|
|
14732
|
+
else if (!(this.selectionSettings.mode === 'Multiple' && (e.ctrlKey || e.metaKey || Browser.isDevice))) {
|
|
14397
14733
|
this.getSelectedItems().forEach((ele) => {
|
|
14398
14734
|
ele.removeAttribute('aria-selected');
|
|
14399
14735
|
});
|
|
@@ -14675,7 +15011,7 @@ let ListBox = ListBox_1 = class ListBox extends DropDownBase {
|
|
|
14675
15011
|
});
|
|
14676
15012
|
if (isRefresh) {
|
|
14677
15013
|
if (fListBox.fields.groupBy) {
|
|
14678
|
-
|
|
15014
|
+
const sourceElem = fListBox.renderItems(listData, fListBox.fields);
|
|
14679
15015
|
fListBox.updateListItems(sourceElem, fListBox.ulElement);
|
|
14680
15016
|
}
|
|
14681
15017
|
else {
|
|
@@ -14708,7 +15044,7 @@ let ListBox = ListBox_1 = class ListBox extends DropDownBase {
|
|
|
14708
15044
|
tListBox.jsonData = tJsonData;
|
|
14709
15045
|
tListBox.sortedData = tSortData;
|
|
14710
15046
|
if (isRefresh) {
|
|
14711
|
-
|
|
15047
|
+
const sourceElem = tListBox.renderItems(tListData, tListBox.fields);
|
|
14712
15048
|
tListBox.updateListItems(sourceElem, tListBox.ulElement);
|
|
14713
15049
|
tListBox.setSelection();
|
|
14714
15050
|
fListBox.trigger('actionComplete', { items: tempItems, eventName: this.toolbarAction });
|
|
@@ -14748,7 +15084,7 @@ let ListBox = ListBox_1 = class ListBox extends DropDownBase {
|
|
|
14748
15084
|
const isRefresh = tListBox.sortOrder !== 'None' || (tListBox.selectionSettings.showCheckbox !==
|
|
14749
15085
|
fListBox.selectionSettings.showCheckbox) || tListBox.fields.groupBy || tListBox.itemTemplate || fListBox.itemTemplate;
|
|
14750
15086
|
this.removeSelected(fListBox, fListBox.getSelectedItems());
|
|
14751
|
-
const tempItems = [].slice.call(fListBox.
|
|
15087
|
+
const tempItems = [].slice.call(fListBox.listData);
|
|
14752
15088
|
const localDataArgs = { cancel: false, items: tempItems, eventName: this.toolbarAction };
|
|
14753
15089
|
fListBox.trigger('actionBegin', localDataArgs);
|
|
14754
15090
|
if (localDataArgs.cancel) {
|
|
@@ -14793,11 +15129,29 @@ let ListBox = ListBox_1 = class ListBox extends DropDownBase {
|
|
|
14793
15129
|
fListBox.value = [];
|
|
14794
15130
|
listData = listData
|
|
14795
15131
|
.filter((data) => data.isHeader !== true);
|
|
15132
|
+
const sortedData = listData.filter(function (val) {
|
|
15133
|
+
return tListBox.jsonData.indexOf(val) === -1;
|
|
15134
|
+
});
|
|
15135
|
+
for (let i = 0; i < sortedData.length; i++) {
|
|
15136
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
15137
|
+
tListBox.jsonData.splice(index + i, 0, sortedData[i]);
|
|
15138
|
+
}
|
|
14796
15139
|
tListBox.listData = listData;
|
|
14797
|
-
|
|
14798
|
-
|
|
15140
|
+
if (fListBox.listData.length === fListBox.jsonData.length) {
|
|
15141
|
+
fListBox.listData = fListBox.sortedData = fListBox.jsonData = [];
|
|
15142
|
+
}
|
|
15143
|
+
else if (fListBox.allowFiltering) {
|
|
15144
|
+
for (let i = 0; i < fListBox.listData.length; i++) {
|
|
15145
|
+
for (let j = 0; j < fListBox.jsonData.length; j++) {
|
|
15146
|
+
if (fListBox.listData[i] === fListBox.jsonData[j]) {
|
|
15147
|
+
fListBox.jsonData.splice(j, 1);
|
|
15148
|
+
}
|
|
15149
|
+
}
|
|
15150
|
+
}
|
|
15151
|
+
fListBox.listData = fListBox.sortedData = [];
|
|
15152
|
+
}
|
|
14799
15153
|
if (isRefresh) {
|
|
14800
|
-
|
|
15154
|
+
const sourceElem = tListBox.renderItems(listData, tListBox.fields);
|
|
14801
15155
|
tListBox.updateListItems(sourceElem, tListBox.ulElement);
|
|
14802
15156
|
this.trigger('actionComplete', { items: tempItems, eventName: this.toolbarAction });
|
|
14803
15157
|
}
|
|
@@ -14848,21 +15202,35 @@ let ListBox = ListBox_1 = class ListBox extends DropDownBase {
|
|
|
14848
15202
|
}
|
|
14849
15203
|
return listObj;
|
|
14850
15204
|
}
|
|
14851
|
-
getGrabbedItems() {
|
|
15205
|
+
getGrabbedItems(args) {
|
|
15206
|
+
let grabbItems = false;
|
|
14852
15207
|
for (let i = 0; i < this.value.length; i++) {
|
|
14853
|
-
if (this.value[i] === this.
|
|
15208
|
+
if (this.value[i] === this.getFormattedValue(args.target.getAttribute('data-value'))) {
|
|
15209
|
+
grabbItems = true;
|
|
15210
|
+
break;
|
|
15211
|
+
}
|
|
15212
|
+
}
|
|
15213
|
+
if (grabbItems) {
|
|
15214
|
+
for (let i = 0; i < this.value.length; i++) {
|
|
14854
15215
|
const liColl = this.list.querySelectorAll('[aria-selected="true"]');
|
|
14855
|
-
for (let
|
|
14856
|
-
|
|
15216
|
+
for (let j = 0; j < liColl.length; j++) {
|
|
15217
|
+
if (this.value[i] === this.getFormattedValue(liColl[j].getAttribute('data-value'))) {
|
|
15218
|
+
liColl[j].classList.add('e-grabbed');
|
|
15219
|
+
}
|
|
14857
15220
|
}
|
|
14858
|
-
break;
|
|
14859
15221
|
}
|
|
14860
15222
|
}
|
|
14861
|
-
|
|
15223
|
+
let elems;
|
|
15224
|
+
if (this.isAngular) {
|
|
15225
|
+
elems = Array.prototype.slice.call(this.element.getElementsByClassName('e-list-parent')[0].querySelectorAll('.e-grabbed'));
|
|
15226
|
+
}
|
|
15227
|
+
else {
|
|
15228
|
+
elems = Array.prototype.slice.call(this.element.nextElementSibling.querySelectorAll('.e-grabbed'));
|
|
15229
|
+
}
|
|
14862
15230
|
return elems;
|
|
14863
15231
|
}
|
|
14864
15232
|
getDragArgs(args, isDragEnd) {
|
|
14865
|
-
let elems = this.getGrabbedItems();
|
|
15233
|
+
let elems = this.getGrabbedItems(args);
|
|
14866
15234
|
if (elems.length) {
|
|
14867
15235
|
if (isDragEnd) {
|
|
14868
15236
|
elems.push(args.target);
|
|
@@ -14914,7 +15282,7 @@ let ListBox = ListBox_1 = class ListBox extends DropDownBase {
|
|
|
14914
15282
|
}
|
|
14915
15283
|
}
|
|
14916
15284
|
}
|
|
14917
|
-
else if (e.keyCode !== 37 && e.keyCode !== 39 && e.code !==
|
|
15285
|
+
else if (e.keyCode !== 37 && e.keyCode !== 39 && e.code !== 'KeyA') {
|
|
14918
15286
|
this.upDownKeyHandler(e);
|
|
14919
15287
|
}
|
|
14920
15288
|
}
|
|
@@ -14957,9 +15325,9 @@ let ListBox = ListBox_1 = class ListBox extends DropDownBase {
|
|
|
14957
15325
|
this.selectHandler({ target: ul.children[fliIdx], ctrlKey: e.ctrlKey, shiftKey: e.shiftKey }, true);
|
|
14958
15326
|
}
|
|
14959
15327
|
if (this.selectionSettings.showCheckbox && e.ctrlKey && e.shiftKey && (e.keyCode === 36 || e.keyCode === 35)) {
|
|
14960
|
-
|
|
14961
|
-
|
|
14962
|
-
|
|
15328
|
+
const selectedidx = Array.prototype.indexOf.call(ul.children, fli);
|
|
15329
|
+
const sidx = e.code === 'Home' ? 0 : selectedidx;
|
|
15330
|
+
const eidx = e.code === 'Home' ? selectedidx : ul.children.length - 1;
|
|
14963
15331
|
for (let i = sidx; i <= eidx; i++) {
|
|
14964
15332
|
const item = ul.children[i];
|
|
14965
15333
|
this.notify('updatelist', { li: item, e: {
|
|
@@ -15113,7 +15481,6 @@ let ListBox = ListBox_1 = class ListBox extends DropDownBase {
|
|
|
15113
15481
|
dvalue = this.getFormattedValue(li.getAttribute('data-value'));
|
|
15114
15482
|
if (values.indexOf(dvalue) < 0) {
|
|
15115
15483
|
li.getElementsByClassName('e-check')[0].classList.remove('e-check');
|
|
15116
|
-
li.getElementsByClassName('e-checkbox-wrapper')[0].removeAttribute('aria-checked');
|
|
15117
15484
|
li.removeAttribute('aria-selected');
|
|
15118
15485
|
}
|
|
15119
15486
|
});
|
|
@@ -15131,6 +15498,9 @@ let ListBox = ListBox_1 = class ListBox extends DropDownBase {
|
|
|
15131
15498
|
else {
|
|
15132
15499
|
text = value;
|
|
15133
15500
|
}
|
|
15501
|
+
if (typeof (text) === 'string') {
|
|
15502
|
+
text = text.split("\\").join("\\\\");
|
|
15503
|
+
}
|
|
15134
15504
|
li = this.list.querySelector('[data-value="' + text + '"]');
|
|
15135
15505
|
if (li) {
|
|
15136
15506
|
if (this.selectionSettings.showCheckbox) {
|
|
@@ -15459,6 +15829,12 @@ __decorate$6([
|
|
|
15459
15829
|
__decorate$6([
|
|
15460
15830
|
Property('')
|
|
15461
15831
|
], ListBox.prototype, "height", void 0);
|
|
15832
|
+
__decorate$6([
|
|
15833
|
+
Property(true)
|
|
15834
|
+
], ListBox.prototype, "enabled", void 0);
|
|
15835
|
+
__decorate$6([
|
|
15836
|
+
Property(false)
|
|
15837
|
+
], ListBox.prototype, "enablePersistence", void 0);
|
|
15462
15838
|
__decorate$6([
|
|
15463
15839
|
Property(false)
|
|
15464
15840
|
], ListBox.prototype, "allowDragAndDrop", void 0);
|
|
@@ -15533,6 +15909,1444 @@ const listBoxClasses = {
|
|
|
15533
15909
|
clearIcon: 'e-clear-icon'
|
|
15534
15910
|
};
|
|
15535
15911
|
|
|
15912
|
+
/**
|
|
15913
|
+
* export all modules from current location
|
|
15914
|
+
*/
|
|
15915
|
+
|
|
15916
|
+
var __decorate$7 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
15917
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
15918
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
15919
|
+
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;
|
|
15920
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
15921
|
+
};
|
|
15922
|
+
/**
|
|
15923
|
+
* The Mention component is used to list someone or something based on user input in textarea, input,
|
|
15924
|
+
* or any other editable element from which the user can select.
|
|
15925
|
+
*/
|
|
15926
|
+
let Mention = class Mention extends DropDownBase {
|
|
15927
|
+
/**
|
|
15928
|
+
* * Constructor for creating the widget
|
|
15929
|
+
*
|
|
15930
|
+
* @param {MentionModel} options - Specifies the MentionComponent model.
|
|
15931
|
+
* @param {string | HTMLElement} element - Specifies the element to render as component.
|
|
15932
|
+
* @private
|
|
15933
|
+
*/
|
|
15934
|
+
constructor(options, element) {
|
|
15935
|
+
super(options, element);
|
|
15936
|
+
}
|
|
15937
|
+
/**
|
|
15938
|
+
* When property value changes happened, then onPropertyChanged method will execute the respective changes in this component.
|
|
15939
|
+
*
|
|
15940
|
+
* @param {MentionModel} newProp - Returns the dynamic property value of the component.
|
|
15941
|
+
* @param {MentionModel} oldProp - Returns the previous property value of the component.
|
|
15942
|
+
* @private
|
|
15943
|
+
* @returns {void}
|
|
15944
|
+
*/
|
|
15945
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
15946
|
+
onPropertyChanged(newProp, oldProp) {
|
|
15947
|
+
for (const prop of Object.keys(newProp)) {
|
|
15948
|
+
switch (prop) {
|
|
15949
|
+
case 'minLength':
|
|
15950
|
+
this.minLength = newProp.minLength;
|
|
15951
|
+
break;
|
|
15952
|
+
case 'suffixText':
|
|
15953
|
+
this.suffixText = newProp.suffixText;
|
|
15954
|
+
break;
|
|
15955
|
+
case 'allowSpaces':
|
|
15956
|
+
this.allowSpaces = newProp.allowSpaces;
|
|
15957
|
+
break;
|
|
15958
|
+
case 'mentionChar':
|
|
15959
|
+
this.mentionChar = newProp.mentionChar;
|
|
15960
|
+
break;
|
|
15961
|
+
case 'showMentionChar':
|
|
15962
|
+
this.showMentionChar = newProp.showMentionChar;
|
|
15963
|
+
break;
|
|
15964
|
+
case 'cssClass':
|
|
15965
|
+
this.updateCssClass(newProp.cssClass, oldProp.cssClass);
|
|
15966
|
+
break;
|
|
15967
|
+
}
|
|
15968
|
+
}
|
|
15969
|
+
}
|
|
15970
|
+
updateCssClass(newClass, oldClass) {
|
|
15971
|
+
if (!isNullOrUndefined(oldClass)) {
|
|
15972
|
+
oldClass = (oldClass.replace(/\s+/g, ' ')).trim();
|
|
15973
|
+
}
|
|
15974
|
+
if (!isNullOrUndefined(newClass)) {
|
|
15975
|
+
newClass = (newClass.replace(/\s+/g, ' ')).trim();
|
|
15976
|
+
}
|
|
15977
|
+
this.setCssClass(newClass, [this.inputElement], oldClass);
|
|
15978
|
+
if (this.popupObj) {
|
|
15979
|
+
this.setCssClass(newClass, [this.popupObj.element], oldClass);
|
|
15980
|
+
}
|
|
15981
|
+
}
|
|
15982
|
+
setCssClass(cssClass$$1, elements, oldClass) {
|
|
15983
|
+
if (!isNullOrUndefined(oldClass) && oldClass !== '') {
|
|
15984
|
+
removeClass(elements, oldClass.split(' '));
|
|
15985
|
+
}
|
|
15986
|
+
if (!isNullOrUndefined(cssClass$$1) && cssClass$$1 !== '') {
|
|
15987
|
+
addClass(elements, cssClass$$1.split(' '));
|
|
15988
|
+
}
|
|
15989
|
+
}
|
|
15990
|
+
initializeData() {
|
|
15991
|
+
this.isSelected = false;
|
|
15992
|
+
this.isFiltered = false;
|
|
15993
|
+
this.beforePopupOpen = false;
|
|
15994
|
+
this.initRemoteRender = false;
|
|
15995
|
+
this.isListResetted = false;
|
|
15996
|
+
this.isPopupOpen = false;
|
|
15997
|
+
this.isCollided = false;
|
|
15998
|
+
this.lineBreak = false;
|
|
15999
|
+
this.keyConfigure = {
|
|
16000
|
+
tab: 'tab',
|
|
16001
|
+
enter: '13',
|
|
16002
|
+
escape: '27',
|
|
16003
|
+
end: '35',
|
|
16004
|
+
home: '36',
|
|
16005
|
+
down: '40',
|
|
16006
|
+
up: '38',
|
|
16007
|
+
pageUp: '33',
|
|
16008
|
+
pageDown: '34',
|
|
16009
|
+
open: 'alt+40',
|
|
16010
|
+
close: 'shift+tab',
|
|
16011
|
+
hide: 'alt+38',
|
|
16012
|
+
space: '32'
|
|
16013
|
+
};
|
|
16014
|
+
}
|
|
16015
|
+
/**
|
|
16016
|
+
* Execute before render the list items
|
|
16017
|
+
*
|
|
16018
|
+
* @private
|
|
16019
|
+
* @returns {void}
|
|
16020
|
+
*/
|
|
16021
|
+
preRender() {
|
|
16022
|
+
this.initializeData();
|
|
16023
|
+
super.preRender();
|
|
16024
|
+
}
|
|
16025
|
+
/**
|
|
16026
|
+
* To Initialize the control rendering
|
|
16027
|
+
*
|
|
16028
|
+
* @private
|
|
16029
|
+
* @returns {void}
|
|
16030
|
+
*/
|
|
16031
|
+
render() {
|
|
16032
|
+
this.inputElement = !isNullOrUndefined(this.target) ? ((typeof this.target) === 'string') ?
|
|
16033
|
+
document.querySelector(this.target) : this.target : this.element;
|
|
16034
|
+
if (this.isContentEditable(this.inputElement)) {
|
|
16035
|
+
this.inputElement.setAttribute('contenteditable', 'true');
|
|
16036
|
+
addClass([this.inputElement], ['e-mention']);
|
|
16037
|
+
if (isNullOrUndefined(this.target)) {
|
|
16038
|
+
addClass([this.inputElement], ['e-editable-element']);
|
|
16039
|
+
}
|
|
16040
|
+
}
|
|
16041
|
+
this.queryString = this.elementValue();
|
|
16042
|
+
this.wireEvent();
|
|
16043
|
+
}
|
|
16044
|
+
wireEvent() {
|
|
16045
|
+
EventHandler.add(this.inputElement, 'keyup', this.onKeyUp, this);
|
|
16046
|
+
this.bindCommonEvent();
|
|
16047
|
+
}
|
|
16048
|
+
unWireEvent() {
|
|
16049
|
+
EventHandler.remove(this.inputElement, 'keyup', this.onKeyUp);
|
|
16050
|
+
this.unBindCommonEvent();
|
|
16051
|
+
}
|
|
16052
|
+
bindCommonEvent() {
|
|
16053
|
+
if (!Browser.isDevice) {
|
|
16054
|
+
this.keyboardModule = new KeyboardEvents(this.inputElement, {
|
|
16055
|
+
keyAction: this.keyActionHandler.bind(this), keyConfigs: this.keyConfigure, eventName: 'keydown'
|
|
16056
|
+
});
|
|
16057
|
+
}
|
|
16058
|
+
}
|
|
16059
|
+
/**
|
|
16060
|
+
* Hides the spinner loader.
|
|
16061
|
+
*
|
|
16062
|
+
* @private
|
|
16063
|
+
* @returns {void}
|
|
16064
|
+
*/
|
|
16065
|
+
hideSpinner() {
|
|
16066
|
+
this.hideWaitingSpinner();
|
|
16067
|
+
}
|
|
16068
|
+
hideWaitingSpinner() {
|
|
16069
|
+
if (!isNullOrUndefined(this.spinnerElement)) {
|
|
16070
|
+
hideSpinner(this.spinnerElement);
|
|
16071
|
+
}
|
|
16072
|
+
if (!isNullOrUndefined(this.spinnerTemplate) && !isNullOrUndefined(this.spinnerTemplateElement)) {
|
|
16073
|
+
detach(this.spinnerTemplateElement);
|
|
16074
|
+
}
|
|
16075
|
+
}
|
|
16076
|
+
/**
|
|
16077
|
+
* Shows the spinner loader.
|
|
16078
|
+
*
|
|
16079
|
+
* @returns {void}
|
|
16080
|
+
*/
|
|
16081
|
+
showWaitingSpinner() {
|
|
16082
|
+
if (!isNullOrUndefined(this.popupObj)) {
|
|
16083
|
+
if (isNullOrUndefined(this.spinnerTemplate) && isNullOrUndefined(this.spinnerElement)) {
|
|
16084
|
+
this.spinnerElement = this.popupObj.element;
|
|
16085
|
+
createSpinner({
|
|
16086
|
+
target: this.spinnerElement,
|
|
16087
|
+
width: Browser.isDevice ? '16px' : '14px'
|
|
16088
|
+
}, this.createElement);
|
|
16089
|
+
showSpinner(this.spinnerElement);
|
|
16090
|
+
}
|
|
16091
|
+
if (!isNullOrUndefined(this.spinnerTemplate)) {
|
|
16092
|
+
this.setSpinnerTemplate();
|
|
16093
|
+
}
|
|
16094
|
+
}
|
|
16095
|
+
}
|
|
16096
|
+
keyActionHandler(e) {
|
|
16097
|
+
const isNavigation = (e.action === 'down' || e.action === 'up' || e.action === 'pageUp' || e.action === 'pageDown'
|
|
16098
|
+
|| e.action === 'home' || e.action === 'end');
|
|
16099
|
+
const isTabAction = e.action === 'tab' || e.action === 'close';
|
|
16100
|
+
if (this.list === undefined && !this.isRequested && !isTabAction && e.action !== 'escape' && e.action !== 'space') {
|
|
16101
|
+
this.renderList();
|
|
16102
|
+
}
|
|
16103
|
+
if (isNullOrUndefined(this.list) || (!isNullOrUndefined(this.liCollections) &&
|
|
16104
|
+
isNavigation && this.liCollections.length === 0) || this.isRequested) {
|
|
16105
|
+
return;
|
|
16106
|
+
}
|
|
16107
|
+
if (e.action === 'escape') {
|
|
16108
|
+
e.preventDefault();
|
|
16109
|
+
}
|
|
16110
|
+
this.isSelected = e.action === 'escape' ? false : this.isSelected;
|
|
16111
|
+
switch (e.action) {
|
|
16112
|
+
case 'down':
|
|
16113
|
+
case 'up':
|
|
16114
|
+
this.updateUpDownAction(e);
|
|
16115
|
+
break;
|
|
16116
|
+
case 'tab':
|
|
16117
|
+
if (this.isPopupOpen) {
|
|
16118
|
+
e.preventDefault();
|
|
16119
|
+
const li = this.list.querySelector('.' + dropDownBaseClasses.selected);
|
|
16120
|
+
if (li) {
|
|
16121
|
+
this.setSelection(li, e);
|
|
16122
|
+
}
|
|
16123
|
+
if (this.isPopupOpen) {
|
|
16124
|
+
this.hidePopup(e);
|
|
16125
|
+
}
|
|
16126
|
+
}
|
|
16127
|
+
break;
|
|
16128
|
+
case 'enter':
|
|
16129
|
+
if (this.isPopupOpen) {
|
|
16130
|
+
e.preventDefault();
|
|
16131
|
+
if (this.popupObj && this.popupObj.element.contains(this.selectedLI)) {
|
|
16132
|
+
this.setValue(e);
|
|
16133
|
+
}
|
|
16134
|
+
}
|
|
16135
|
+
break;
|
|
16136
|
+
case 'escape':
|
|
16137
|
+
if (this.isPopupOpen) {
|
|
16138
|
+
this.hidePopup(e);
|
|
16139
|
+
}
|
|
16140
|
+
break;
|
|
16141
|
+
}
|
|
16142
|
+
}
|
|
16143
|
+
updateUpDownAction(e) {
|
|
16144
|
+
const focusEle = this.list.querySelector('.' + dropDownBaseClasses.focus);
|
|
16145
|
+
if (this.isSelectFocusItem(focusEle)) {
|
|
16146
|
+
this.setSelection(focusEle, e);
|
|
16147
|
+
}
|
|
16148
|
+
else if (!isNullOrUndefined(this.liCollections)) {
|
|
16149
|
+
const li = this.list.querySelector('.' + dropDownBaseClasses.selected);
|
|
16150
|
+
if (!isNullOrUndefined(li)) {
|
|
16151
|
+
const value = this.getFormattedValue(li.getAttribute('data-value'));
|
|
16152
|
+
this.activeIndex = this.getIndexByValue(value);
|
|
16153
|
+
}
|
|
16154
|
+
let index = e.action === 'down' ? this.activeIndex + 1 : this.activeIndex - 1;
|
|
16155
|
+
let startIndex = 0;
|
|
16156
|
+
startIndex = e.action === 'down' && isNullOrUndefined(this.activeIndex) ? 0 : this.liCollections.length - 1;
|
|
16157
|
+
index = index < 0 ? this.liCollections.length - 1 : index === this.liCollections.length ? 0 : index;
|
|
16158
|
+
const nextItem = isNullOrUndefined(this.activeIndex) ?
|
|
16159
|
+
this.liCollections[startIndex] : this.liCollections[index];
|
|
16160
|
+
if (!isNullOrUndefined(nextItem)) {
|
|
16161
|
+
this.setSelection(nextItem, e);
|
|
16162
|
+
}
|
|
16163
|
+
}
|
|
16164
|
+
if (this.isPopupOpen) {
|
|
16165
|
+
e.preventDefault();
|
|
16166
|
+
}
|
|
16167
|
+
}
|
|
16168
|
+
isSelectFocusItem(element) {
|
|
16169
|
+
return !isNullOrUndefined(element);
|
|
16170
|
+
}
|
|
16171
|
+
unBindCommonEvent() {
|
|
16172
|
+
if (!Browser.isDevice) {
|
|
16173
|
+
this.keyboardModule.destroy();
|
|
16174
|
+
}
|
|
16175
|
+
}
|
|
16176
|
+
onKeyUp(e) {
|
|
16177
|
+
let rangetextContent;
|
|
16178
|
+
if (this.isContentEditable(this.inputElement)) {
|
|
16179
|
+
this.range = this.getCurrentRange();
|
|
16180
|
+
rangetextContent = this.range.startContainer.textContent.split('');
|
|
16181
|
+
}
|
|
16182
|
+
let currentRange = this.getTextRange();
|
|
16183
|
+
const lastWordRange = this.getLastLetter(currentRange);
|
|
16184
|
+
// eslint-disable-next-line security/detect-non-literal-regexp
|
|
16185
|
+
const Regex = new RegExp(this.mentionChar, 'g');
|
|
16186
|
+
const charRegex = new RegExp('[a-zA-Z]', 'g');
|
|
16187
|
+
if (e.key === 'Shift' || e.keyCode === 37 || e.keyCode === 39) {
|
|
16188
|
+
if ((e.keyCode === 37 || e.keyCode === 39) && !isNullOrUndefined(currentRange) &&
|
|
16189
|
+
currentRange.indexOf(this.mentionChar) === -1 && this.isPopupOpen) {
|
|
16190
|
+
this.hidePopup();
|
|
16191
|
+
}
|
|
16192
|
+
return;
|
|
16193
|
+
}
|
|
16194
|
+
if ((!currentRange || !lastWordRange) || e.code === 'Enter' || e.keyCode === 27 ||
|
|
16195
|
+
(lastWordRange.match(Regex) && lastWordRange.match(Regex).length > 1) ||
|
|
16196
|
+
(this.isContentEditable(this.inputElement) && this.range.startContainer &&
|
|
16197
|
+
this.range.startContainer.previousElementSibling && this.range.startContainer.textContent.split('').length > 0 &&
|
|
16198
|
+
(rangetextContent.length === 1 || rangetextContent[rangetextContent.length - 2].indexOf('') === -1 ||
|
|
16199
|
+
this.range.startContainer.nodeType === 1))) {
|
|
16200
|
+
if (this.allowSpaces && currentRange && currentRange.trim() !== '' && charRegex.test(currentRange) && currentRange.indexOf(this.mentionChar) !== -1
|
|
16201
|
+
&& !this.isMatchedText() && (currentRange.length > 1 && currentRange.replace(/\u00A0/g, ' ').charAt(currentRange.length - 2) !== ' ') &&
|
|
16202
|
+
(this.list && this.list.querySelectorAll('ul').length > 0)) {
|
|
16203
|
+
this.queryString = currentRange.substring(currentRange.lastIndexOf(this.mentionChar) + 1).replace('\u00a0', ' ');
|
|
16204
|
+
this.searchLists(e);
|
|
16205
|
+
}
|
|
16206
|
+
else if (this.isPopupOpen && (!this.allowSpaces || !lastWordRange)) {
|
|
16207
|
+
this.hidePopup();
|
|
16208
|
+
this.lineBreak = true;
|
|
16209
|
+
}
|
|
16210
|
+
return;
|
|
16211
|
+
}
|
|
16212
|
+
this.queryString = lastWordRange.replace(this.mentionChar, '');
|
|
16213
|
+
if (this.mentionChar.charCodeAt(0) === lastWordRange.charCodeAt(0) &&
|
|
16214
|
+
this.queryString !== '' && e.keyCode !== 38 && e.keyCode !== 40 && !this.lineBreak) {
|
|
16215
|
+
this.searchLists(e);
|
|
16216
|
+
if (!this.isPopupOpen && this.queryString.length >= this.minLength) {
|
|
16217
|
+
if (!this.isContentEditable(this.inputElement)) {
|
|
16218
|
+
this.showPopup();
|
|
16219
|
+
}
|
|
16220
|
+
else if (this.isContentEditable(this.inputElement) && this.range && this.range.startContainer !== this.inputElement && e.keyCode !== 9) {
|
|
16221
|
+
this.showPopup();
|
|
16222
|
+
}
|
|
16223
|
+
}
|
|
16224
|
+
}
|
|
16225
|
+
else if (lastWordRange.indexOf(this.mentionChar) === 0 && !this.isPopupOpen && e.keyCode !== 8 && (!this.popupObj ||
|
|
16226
|
+
(isNullOrUndefined(this.target) && !document.body.contains(this.popupObj.element) ||
|
|
16227
|
+
!isNullOrUndefined(this.target) && document.body.contains(this.popupObj.element)))) {
|
|
16228
|
+
if (this.initRemoteRender && this.list && this.list.classList.contains('e-nodata')) {
|
|
16229
|
+
this.searchLists(e);
|
|
16230
|
+
}
|
|
16231
|
+
this.resetList(this.dataSource, this.fields);
|
|
16232
|
+
if (isNullOrUndefined(this.list)) {
|
|
16233
|
+
this.initValue();
|
|
16234
|
+
}
|
|
16235
|
+
if (!this.isPopupOpen && e.keyCode !== 38 && e.keyCode !== 40) {
|
|
16236
|
+
this.showPopup();
|
|
16237
|
+
if (this.initRemoteRender && this.list.querySelectorAll('li').length === 0) {
|
|
16238
|
+
this.showWaitingSpinner();
|
|
16239
|
+
}
|
|
16240
|
+
this.lineBreak = false;
|
|
16241
|
+
}
|
|
16242
|
+
}
|
|
16243
|
+
else if (this.allowSpaces && this.queryString !== '' && currentRange && currentRange.trim() !== '' && currentRange.replace('\u00a0', ' ').lastIndexOf(' ') < currentRange.length - 1 &&
|
|
16244
|
+
e.keyCode !== 38 && e.keyCode !== 40 && e.keyCode !== 8 && this.mentionChar.charCodeAt(0) === lastWordRange.charCodeAt(0)) {
|
|
16245
|
+
this.queryString = currentRange.substring(currentRange.lastIndexOf(this.mentionChar) + 1).replace('\u00a0', ' ');
|
|
16246
|
+
this.searchLists(e);
|
|
16247
|
+
}
|
|
16248
|
+
else if (this.queryString === '' && this.isPopupOpen && e.keyCode !== 38 && e.keyCode !== 40 && this.mentionChar.charCodeAt(0) === lastWordRange.charCodeAt(0)) {
|
|
16249
|
+
this.searchLists(e);
|
|
16250
|
+
if (!this.isListResetted) {
|
|
16251
|
+
this.resetList(this.dataSource, this.fields);
|
|
16252
|
+
}
|
|
16253
|
+
}
|
|
16254
|
+
this.isListResetted = false;
|
|
16255
|
+
}
|
|
16256
|
+
isMatchedText() {
|
|
16257
|
+
let isMatched = false;
|
|
16258
|
+
for (let i = 0; i < (this.liCollections && this.liCollections.length); i++) {
|
|
16259
|
+
if (this.getTextRange() &&
|
|
16260
|
+
this.getTextRange().substring(this.getTextRange().lastIndexOf(this.mentionChar) + 1).replace('\u00a0', ' ').trim() === this.liCollections[i].getAttribute('data-value').toLowerCase()) {
|
|
16261
|
+
isMatched = true;
|
|
16262
|
+
}
|
|
16263
|
+
}
|
|
16264
|
+
return isMatched;
|
|
16265
|
+
}
|
|
16266
|
+
getCurrentRange() {
|
|
16267
|
+
this.range = this.inputElement.ownerDocument.getSelection().getRangeAt(0);
|
|
16268
|
+
return this.range;
|
|
16269
|
+
}
|
|
16270
|
+
searchLists(e) {
|
|
16271
|
+
this.isDataFetched = false;
|
|
16272
|
+
if (isNullOrUndefined(this.list)) {
|
|
16273
|
+
super.render();
|
|
16274
|
+
this.unWireListEvents();
|
|
16275
|
+
this.wireListEvents();
|
|
16276
|
+
}
|
|
16277
|
+
if (e.type !== 'mousedown' && (e.keyCode === 40 || e.keyCode === 38)) {
|
|
16278
|
+
this.queryString = this.queryString === '' ? null : this.queryString;
|
|
16279
|
+
this.beforePopupOpen = true;
|
|
16280
|
+
this.resetList(this.dataSource, this.fields);
|
|
16281
|
+
return;
|
|
16282
|
+
}
|
|
16283
|
+
this.isSelected = false;
|
|
16284
|
+
this.activeIndex = null;
|
|
16285
|
+
const eventArgs = {
|
|
16286
|
+
preventDefaultAction: false,
|
|
16287
|
+
text: this.queryString,
|
|
16288
|
+
updateData: (dataSource, query, fields) => {
|
|
16289
|
+
if (eventArgs.cancel) {
|
|
16290
|
+
return;
|
|
16291
|
+
}
|
|
16292
|
+
this.isFiltered = true;
|
|
16293
|
+
this.filterAction(dataSource, query, fields);
|
|
16294
|
+
},
|
|
16295
|
+
cancel: false
|
|
16296
|
+
};
|
|
16297
|
+
this.trigger('filtering', eventArgs, (eventArgs) => {
|
|
16298
|
+
if (!eventArgs.cancel && !this.isFiltered && !eventArgs.preventDefaultAction) {
|
|
16299
|
+
this.filterAction(this.dataSource, null, this.fields);
|
|
16300
|
+
}
|
|
16301
|
+
});
|
|
16302
|
+
}
|
|
16303
|
+
filterAction(dataSource, query, fields) {
|
|
16304
|
+
this.beforePopupOpen = true;
|
|
16305
|
+
if (this.queryString.length >= this.minLength) {
|
|
16306
|
+
this.resetList(dataSource, fields, query);
|
|
16307
|
+
this.isListResetted = true;
|
|
16308
|
+
}
|
|
16309
|
+
else {
|
|
16310
|
+
if (this.isPopupOpen) {
|
|
16311
|
+
this.hidePopup();
|
|
16312
|
+
}
|
|
16313
|
+
this.beforePopupOpen = false;
|
|
16314
|
+
}
|
|
16315
|
+
this.setDataIndex();
|
|
16316
|
+
this.renderReactTemplates();
|
|
16317
|
+
}
|
|
16318
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
16319
|
+
onActionComplete(ulElement, list, e, isUpdated) {
|
|
16320
|
+
super.onActionComplete(ulElement, list, e);
|
|
16321
|
+
if (this.isActive) {
|
|
16322
|
+
if (!isNullOrUndefined(ulElement)) {
|
|
16323
|
+
attributes(ulElement, { 'id': this.inputElement.id + '_options', 'role': 'listbox', 'aria-hidden': 'false' });
|
|
16324
|
+
}
|
|
16325
|
+
let focusItem = ulElement.querySelector('.' + dropDownBaseClasses.li);
|
|
16326
|
+
if (focusItem) {
|
|
16327
|
+
focusItem.classList.add(dropDownBaseClasses.selected);
|
|
16328
|
+
this.selectedLI = focusItem;
|
|
16329
|
+
const value = this.getFormattedValue(focusItem.getAttribute('data-value'));
|
|
16330
|
+
this.selectEventCallback(focusItem, this.getDataByValue(value), value, true);
|
|
16331
|
+
}
|
|
16332
|
+
}
|
|
16333
|
+
}
|
|
16334
|
+
setDataIndex() {
|
|
16335
|
+
for (let i = 0; this.liCollections && i < this.liCollections.length; i++) {
|
|
16336
|
+
this.liCollections[i].setAttribute('data-index', i.toString());
|
|
16337
|
+
}
|
|
16338
|
+
}
|
|
16339
|
+
listOption(dataSource, fieldsSettings) {
|
|
16340
|
+
const fields = super.listOption(dataSource, fieldsSettings);
|
|
16341
|
+
if (isNullOrUndefined(fields.itemCreated)) {
|
|
16342
|
+
fields.itemCreated = (e) => {
|
|
16343
|
+
if (this.highlight) {
|
|
16344
|
+
if (this.inputElement.tagName === this.getNgDirective() && this.itemTemplate) {
|
|
16345
|
+
setTimeout(() => {
|
|
16346
|
+
highlightSearch(e.item, this.queryString, this.ignoreCase, this.filterType);
|
|
16347
|
+
}, 0);
|
|
16348
|
+
}
|
|
16349
|
+
else {
|
|
16350
|
+
highlightSearch(e.item, this.queryString, this.ignoreCase, this.filterType);
|
|
16351
|
+
}
|
|
16352
|
+
}
|
|
16353
|
+
};
|
|
16354
|
+
}
|
|
16355
|
+
else {
|
|
16356
|
+
const itemCreated = fields.itemCreated;
|
|
16357
|
+
fields.itemCreated = (e) => {
|
|
16358
|
+
if (this.highlight) {
|
|
16359
|
+
highlightSearch(e.item, this.queryString, this.ignoreCase, this.filterType);
|
|
16360
|
+
}
|
|
16361
|
+
itemCreated.apply(this, [e]);
|
|
16362
|
+
};
|
|
16363
|
+
}
|
|
16364
|
+
return fields;
|
|
16365
|
+
}
|
|
16366
|
+
elementValue() {
|
|
16367
|
+
if (!this.isContentEditable(this.inputElement)) {
|
|
16368
|
+
return this.inputElement.value.replace(this.mentionChar, '');
|
|
16369
|
+
}
|
|
16370
|
+
else {
|
|
16371
|
+
return this.inputElement.textContent.replace(this.mentionChar, '');
|
|
16372
|
+
}
|
|
16373
|
+
}
|
|
16374
|
+
getQuery(query) {
|
|
16375
|
+
const filterQuery = query ? query.clone() : this.query ? this.query.clone() : new Query();
|
|
16376
|
+
const filterType = (this.queryString === '' && !isNullOrUndefined(this.elementValue())) ? 'equal' : this.filterType;
|
|
16377
|
+
const queryString = (this.queryString === '' && !isNullOrUndefined(this.elementValue())) ?
|
|
16378
|
+
this.elementValue() : this.queryString;
|
|
16379
|
+
if (this.isFiltered) {
|
|
16380
|
+
return filterQuery;
|
|
16381
|
+
}
|
|
16382
|
+
if (this.queryString !== null && this.queryString !== '') {
|
|
16383
|
+
const dataType = this.typeOfData(this.dataSource).typeof;
|
|
16384
|
+
if (!(this.dataSource instanceof DataManager) && dataType === 'string' || dataType === 'number') {
|
|
16385
|
+
filterQuery.where('', filterType, queryString, this.ignoreCase, this.ignoreAccent);
|
|
16386
|
+
}
|
|
16387
|
+
else {
|
|
16388
|
+
const mapping = !isNullOrUndefined(this.fields.text) ? this.fields.text : '';
|
|
16389
|
+
filterQuery.where(mapping, filterType, queryString, this.ignoreCase, this.ignoreAccent);
|
|
16390
|
+
}
|
|
16391
|
+
}
|
|
16392
|
+
if (!isNullOrUndefined(this.suggestionCount)) {
|
|
16393
|
+
// Since defualt value of suggestioncount is 25, checked the condition
|
|
16394
|
+
if (this.suggestionCount !== 25) {
|
|
16395
|
+
for (let queryElements = 0; queryElements < filterQuery.queries.length; queryElements++) {
|
|
16396
|
+
if (filterQuery.queries[queryElements].fn === 'onTake') {
|
|
16397
|
+
filterQuery.queries.splice(queryElements, 1);
|
|
16398
|
+
}
|
|
16399
|
+
}
|
|
16400
|
+
}
|
|
16401
|
+
filterQuery.take(this.suggestionCount);
|
|
16402
|
+
}
|
|
16403
|
+
return filterQuery;
|
|
16404
|
+
}
|
|
16405
|
+
renderHightSearch() {
|
|
16406
|
+
if (this.highlight) {
|
|
16407
|
+
for (let i = 0; i < this.liCollections.length; i++) {
|
|
16408
|
+
const isHighlight = this.ulElement.querySelector('.e-active');
|
|
16409
|
+
if (!isHighlight) {
|
|
16410
|
+
revertHighlightSearch(this.liCollections[i]);
|
|
16411
|
+
highlightSearch(this.liCollections[i], this.queryString, this.ignoreCase, this.filterType);
|
|
16412
|
+
}
|
|
16413
|
+
}
|
|
16414
|
+
}
|
|
16415
|
+
}
|
|
16416
|
+
getTextRange() {
|
|
16417
|
+
let text;
|
|
16418
|
+
if (!this.isContentEditable(this.inputElement)) {
|
|
16419
|
+
const component = this.inputElement;
|
|
16420
|
+
if (!isNullOrUndefined(component)) {
|
|
16421
|
+
const startPos = component.selectionStart;
|
|
16422
|
+
if (component.value && startPos >= 0) {
|
|
16423
|
+
text = component.value.substring(0, startPos);
|
|
16424
|
+
}
|
|
16425
|
+
}
|
|
16426
|
+
}
|
|
16427
|
+
else {
|
|
16428
|
+
if (this.range) {
|
|
16429
|
+
const selectedElem = this.range.startContainer;
|
|
16430
|
+
if (!isNullOrUndefined(selectedElem)) {
|
|
16431
|
+
const workingNodeContent = selectedElem.textContent;
|
|
16432
|
+
const selectStartOffset = this.range.startOffset;
|
|
16433
|
+
if (workingNodeContent && selectStartOffset >= 0) {
|
|
16434
|
+
text = workingNodeContent.substring(0, selectStartOffset);
|
|
16435
|
+
}
|
|
16436
|
+
}
|
|
16437
|
+
}
|
|
16438
|
+
}
|
|
16439
|
+
return text;
|
|
16440
|
+
}
|
|
16441
|
+
getLastLetter(text) {
|
|
16442
|
+
if (isNullOrUndefined(text)) {
|
|
16443
|
+
return '';
|
|
16444
|
+
}
|
|
16445
|
+
const textValue = text.replace(/\u00A0/g, ' ');
|
|
16446
|
+
const words = textValue.split(/\s+/);
|
|
16447
|
+
const wordCnt = words.length - 1;
|
|
16448
|
+
return words[wordCnt].trim();
|
|
16449
|
+
}
|
|
16450
|
+
isContentEditable(element) {
|
|
16451
|
+
return element && element.nodeName !== 'INPUT' && element.nodeName !== 'TEXTAREA';
|
|
16452
|
+
}
|
|
16453
|
+
/**
|
|
16454
|
+
* Opens the popup that displays the list of items.
|
|
16455
|
+
*
|
|
16456
|
+
* @returns {void}
|
|
16457
|
+
*/
|
|
16458
|
+
showPopup() {
|
|
16459
|
+
this.beforePopupOpen = true;
|
|
16460
|
+
if (isNullOrUndefined(this.list)) {
|
|
16461
|
+
this.initValue();
|
|
16462
|
+
}
|
|
16463
|
+
this.renderPopup();
|
|
16464
|
+
attributes(this.inputElement, { 'aria-activedescendant': this.selectedElementID });
|
|
16465
|
+
if (this.selectedElementID == null) {
|
|
16466
|
+
this.inputElement.removeAttribute('aria-activedescendant');
|
|
16467
|
+
}
|
|
16468
|
+
}
|
|
16469
|
+
/* eslint-disable valid-jsdoc, jsdoc/require-param */
|
|
16470
|
+
/**
|
|
16471
|
+
* Hides the popup if it is in an open state.
|
|
16472
|
+
*
|
|
16473
|
+
* @returns {void}
|
|
16474
|
+
*/
|
|
16475
|
+
hidePopup(e) {
|
|
16476
|
+
this.removeSelection();
|
|
16477
|
+
this.closePopup(0, e);
|
|
16478
|
+
}
|
|
16479
|
+
closePopup(delay, e) {
|
|
16480
|
+
if (!(this.popupObj && document.body.contains(this.popupObj.element) && this.beforePopupOpen)) {
|
|
16481
|
+
return;
|
|
16482
|
+
}
|
|
16483
|
+
EventHandler.remove(document, 'mousedown', this.onDocumentClick);
|
|
16484
|
+
this.inputElement.removeAttribute('aria-owns');
|
|
16485
|
+
this.inputElement.removeAttribute('aria-activedescendant');
|
|
16486
|
+
this.beforePopupOpen = false;
|
|
16487
|
+
const animModel = {
|
|
16488
|
+
name: 'FadeOut',
|
|
16489
|
+
duration: 100,
|
|
16490
|
+
delay: delay ? delay : 0
|
|
16491
|
+
};
|
|
16492
|
+
const popupInstance = this.popupObj;
|
|
16493
|
+
const eventArgs = { popup: popupInstance, cancel: false, animation: animModel, event: e || null };
|
|
16494
|
+
this.trigger('closed', eventArgs, (eventArgs) => {
|
|
16495
|
+
if (!eventArgs.cancel && this.popupObj) {
|
|
16496
|
+
if (this.isPopupOpen) {
|
|
16497
|
+
this.popupObj.hide(new Animation(eventArgs.animation));
|
|
16498
|
+
}
|
|
16499
|
+
else {
|
|
16500
|
+
this.destroyPopup();
|
|
16501
|
+
}
|
|
16502
|
+
}
|
|
16503
|
+
});
|
|
16504
|
+
}
|
|
16505
|
+
renderPopup() {
|
|
16506
|
+
const args = { cancel: false };
|
|
16507
|
+
this.trigger('beforeOpen', args, (args) => {
|
|
16508
|
+
if (!args.cancel) {
|
|
16509
|
+
let popupEle;
|
|
16510
|
+
if (isNullOrUndefined(this.target)) {
|
|
16511
|
+
popupEle = this.createElement('div', {
|
|
16512
|
+
id: this.inputElement.id + '_popup', className: 'e-mention e-popup ' + (this.cssClass != null ? this.cssClass : '')
|
|
16513
|
+
});
|
|
16514
|
+
}
|
|
16515
|
+
else {
|
|
16516
|
+
popupEle = this.element;
|
|
16517
|
+
if (this.cssClass != null) {
|
|
16518
|
+
addClass([popupEle], this.cssClass.split(' '));
|
|
16519
|
+
}
|
|
16520
|
+
}
|
|
16521
|
+
if (!isNullOrUndefined(this.target)) {
|
|
16522
|
+
popupEle.id = this.inputElement.id + '_popup';
|
|
16523
|
+
}
|
|
16524
|
+
this.listHeight = formatUnit(this.popupHeight);
|
|
16525
|
+
if (!isNullOrUndefined(this.list.querySelector('li')) && !this.initRemoteRender) {
|
|
16526
|
+
const li = this.list.querySelector('.' + dropDownBaseClasses.focus);
|
|
16527
|
+
if (!isNullOrUndefined(li)) {
|
|
16528
|
+
this.selectedLI = li;
|
|
16529
|
+
const value = this.getFormattedValue(li.getAttribute('data-value'));
|
|
16530
|
+
this.selectEventCallback(li, this.getDataByValue(value), value, true);
|
|
16531
|
+
}
|
|
16532
|
+
}
|
|
16533
|
+
append([this.list], popupEle);
|
|
16534
|
+
if ((!this.popupObj || !document.body.contains(this.popupObj.element)) ||
|
|
16535
|
+
!document.contains(popupEle) && isNullOrUndefined(this.target)) {
|
|
16536
|
+
document.body.appendChild(popupEle);
|
|
16537
|
+
}
|
|
16538
|
+
let coordinates;
|
|
16539
|
+
popupEle.style.visibility = 'hidden';
|
|
16540
|
+
this.setHeight(popupEle);
|
|
16541
|
+
const offsetValue = 0;
|
|
16542
|
+
const left = 0;
|
|
16543
|
+
this.initializePopup(popupEle, offsetValue, left);
|
|
16544
|
+
this.checkCollision(popupEle);
|
|
16545
|
+
popupEle.style.visibility = 'visible';
|
|
16546
|
+
addClass([popupEle], ['e-mention', 'e-popup', 'e-popup-close']);
|
|
16547
|
+
if (!isNullOrUndefined(this.list)) {
|
|
16548
|
+
this.unWireListEvents();
|
|
16549
|
+
this.wireListEvents();
|
|
16550
|
+
}
|
|
16551
|
+
this.selectedElementID = this.selectedLI ? this.selectedLI.id : null;
|
|
16552
|
+
attributes(this.inputElement, { 'aria-owns': this.inputElement.id + '_options', 'aria-activedescendant': this.selectedElementID });
|
|
16553
|
+
if (this.selectedElementID == null) {
|
|
16554
|
+
this.inputElement.removeAttribute('aria-activedescendant');
|
|
16555
|
+
}
|
|
16556
|
+
const animModel = { name: 'FadeIn', duration: 100 };
|
|
16557
|
+
this.beforePopupOpen = true;
|
|
16558
|
+
const popupInstance = this.popupObj;
|
|
16559
|
+
const eventArgs = { popup: popupInstance, cancel: false, animation: animModel };
|
|
16560
|
+
this.trigger('opened', eventArgs, (eventArgs) => {
|
|
16561
|
+
if (!eventArgs.cancel) {
|
|
16562
|
+
this.renderReactTemplates();
|
|
16563
|
+
this.popupObj.show(new Animation(eventArgs.animation), (this.zIndex === 1000) ? this.inputElement : null);
|
|
16564
|
+
if (isNullOrUndefined(this.getTriggerCharPosition())) {
|
|
16565
|
+
return;
|
|
16566
|
+
}
|
|
16567
|
+
coordinates = this.getCoordinates(this.inputElement, this.getTriggerCharPosition());
|
|
16568
|
+
if (!this.isCollided) {
|
|
16569
|
+
popupEle.style.cssText = 'top: '.concat(coordinates.top.toString(), 'px;\n left: ').concat(coordinates.left.toString(), 'px;\nposition: absolute;\n display: block;');
|
|
16570
|
+
}
|
|
16571
|
+
else {
|
|
16572
|
+
popupEle.style.left = formatUnit(coordinates.left);
|
|
16573
|
+
this.isCollided = false;
|
|
16574
|
+
}
|
|
16575
|
+
popupEle.style.width = this.popupWidth !== '100%' && !isNullOrUndefined(this.popupWidth) ? formatUnit(this.popupWidth) : 'auto';
|
|
16576
|
+
this.setHeight(popupEle);
|
|
16577
|
+
popupEle.style.zIndex = this.zIndex === 1000 ? getZindexPartial(popupEle).toString() : this.zIndex.toString();
|
|
16578
|
+
}
|
|
16579
|
+
else {
|
|
16580
|
+
this.beforePopupOpen = false;
|
|
16581
|
+
this.destroyPopup();
|
|
16582
|
+
}
|
|
16583
|
+
});
|
|
16584
|
+
}
|
|
16585
|
+
else {
|
|
16586
|
+
this.beforePopupOpen = false;
|
|
16587
|
+
}
|
|
16588
|
+
});
|
|
16589
|
+
}
|
|
16590
|
+
setHeight(popupEle) {
|
|
16591
|
+
if (this.popupHeight !== 'auto') {
|
|
16592
|
+
this.list.style.maxHeight = (parseInt(this.listHeight, 10) - 2).toString() + 'px'; // due to box-sizing property
|
|
16593
|
+
popupEle.style.maxHeight = formatUnit(this.popupHeight);
|
|
16594
|
+
}
|
|
16595
|
+
else {
|
|
16596
|
+
popupEle.style.height = 'auto';
|
|
16597
|
+
}
|
|
16598
|
+
}
|
|
16599
|
+
checkCollision(popupEle) {
|
|
16600
|
+
if (!Browser.isDevice || (Browser.isDevice && !(this.getModuleName() === 'mention'))) {
|
|
16601
|
+
const collision = isCollide(popupEle);
|
|
16602
|
+
if (collision.length > 0) {
|
|
16603
|
+
popupEle.style.marginTop = -parseInt(getComputedStyle(popupEle).marginTop, 10) + 'px';
|
|
16604
|
+
this.isCollided = true;
|
|
16605
|
+
}
|
|
16606
|
+
this.popupObj.resolveCollision();
|
|
16607
|
+
}
|
|
16608
|
+
}
|
|
16609
|
+
getTriggerCharPosition() {
|
|
16610
|
+
let mostRecentTriggerCharPos;
|
|
16611
|
+
const currentRange = this.getTextRange();
|
|
16612
|
+
if (currentRange !== undefined && currentRange !== null) {
|
|
16613
|
+
mostRecentTriggerCharPos = 0;
|
|
16614
|
+
const idx = currentRange.lastIndexOf(this.mentionChar);
|
|
16615
|
+
if (idx >= mostRecentTriggerCharPos) {
|
|
16616
|
+
mostRecentTriggerCharPos = idx;
|
|
16617
|
+
}
|
|
16618
|
+
}
|
|
16619
|
+
return mostRecentTriggerCharPos;
|
|
16620
|
+
}
|
|
16621
|
+
initializePopup(element, offsetValue, left) {
|
|
16622
|
+
this.popupObj = new Popup(element, {
|
|
16623
|
+
width: this.setWidth(), targetType: 'relative',
|
|
16624
|
+
relateTo: this.inputElement, collision: { X: 'flip', Y: 'flip' }, offsetY: offsetValue,
|
|
16625
|
+
enableRtl: this.enableRtl, offsetX: left, position: { X: 'top', Y: 'left' }, actionOnScroll: 'hide',
|
|
16626
|
+
zIndex: this.zIndex,
|
|
16627
|
+
close: () => {
|
|
16628
|
+
this.destroyPopup();
|
|
16629
|
+
},
|
|
16630
|
+
open: () => {
|
|
16631
|
+
EventHandler.add(document, 'mousedown', this.onDocumentClick, this);
|
|
16632
|
+
this.isPopupOpen = true;
|
|
16633
|
+
this.setDataIndex();
|
|
16634
|
+
}
|
|
16635
|
+
});
|
|
16636
|
+
}
|
|
16637
|
+
setWidth() {
|
|
16638
|
+
let width = formatUnit(this.popupWidth);
|
|
16639
|
+
if (width.indexOf('%') > -1) {
|
|
16640
|
+
const inputWidth = this.inputElement.offsetWidth * parseFloat(width) / 100;
|
|
16641
|
+
width = inputWidth.toString() + 'px';
|
|
16642
|
+
}
|
|
16643
|
+
return width;
|
|
16644
|
+
}
|
|
16645
|
+
destroyPopup() {
|
|
16646
|
+
this.isPopupOpen = false;
|
|
16647
|
+
this.popupObj.destroy();
|
|
16648
|
+
if (isNullOrUndefined(this.target)) {
|
|
16649
|
+
detach(this.popupObj.element);
|
|
16650
|
+
}
|
|
16651
|
+
else {
|
|
16652
|
+
this.popupObj.element.innerHTML = '';
|
|
16653
|
+
this.popupObj.element.removeAttribute('style');
|
|
16654
|
+
this.popupObj.element.removeAttribute('aria-disabled');
|
|
16655
|
+
}
|
|
16656
|
+
}
|
|
16657
|
+
onDocumentClick(e) {
|
|
16658
|
+
const target = e.target;
|
|
16659
|
+
if (!(!isNullOrUndefined(this.popupObj) && closest(target, '#' + this.popupObj.element.id))) {
|
|
16660
|
+
this.hidePopup(e);
|
|
16661
|
+
}
|
|
16662
|
+
}
|
|
16663
|
+
getCoordinates(element, position) {
|
|
16664
|
+
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'];
|
|
16665
|
+
let div;
|
|
16666
|
+
let span;
|
|
16667
|
+
let range;
|
|
16668
|
+
let globalRange;
|
|
16669
|
+
let coordinates;
|
|
16670
|
+
let computed;
|
|
16671
|
+
let rect;
|
|
16672
|
+
if (!this.isContentEditable(this.inputElement)) {
|
|
16673
|
+
div = this.createElement('div', { className: 'e-form-mirror-div' });
|
|
16674
|
+
document.body.appendChild(div);
|
|
16675
|
+
computed = getComputedStyle(element);
|
|
16676
|
+
div.style.position = 'absolute';
|
|
16677
|
+
div.style.visibility = 'hidden';
|
|
16678
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
16679
|
+
properties.forEach((prop) => {
|
|
16680
|
+
// eslint-disable-next-line security/detect-object-injection
|
|
16681
|
+
div.style[prop] = computed[prop];
|
|
16682
|
+
});
|
|
16683
|
+
div.textContent = element.value.substring(0, position);
|
|
16684
|
+
if (this.inputElement.nodeName === 'INPUT') {
|
|
16685
|
+
div.textContent = div.textContent.replace(/\s/g, '\u00a0');
|
|
16686
|
+
}
|
|
16687
|
+
span = this.createElement('span');
|
|
16688
|
+
span.textContent = element.value.substring(position) || '.';
|
|
16689
|
+
div.appendChild(span);
|
|
16690
|
+
rect = element.getBoundingClientRect();
|
|
16691
|
+
}
|
|
16692
|
+
else {
|
|
16693
|
+
const selectedNodePosition = this.getTriggerCharPosition();
|
|
16694
|
+
globalRange = this.range;
|
|
16695
|
+
range = document.createRange();
|
|
16696
|
+
range.setStart(globalRange.startContainer, selectedNodePosition);
|
|
16697
|
+
range.setEnd(globalRange.startContainer, selectedNodePosition);
|
|
16698
|
+
range.collapse(false);
|
|
16699
|
+
rect = range.getBoundingClientRect();
|
|
16700
|
+
}
|
|
16701
|
+
const doc = document.documentElement;
|
|
16702
|
+
const windowLeft = (window.pageXOffset || doc.scrollLeft) - (doc.clientLeft || 0);
|
|
16703
|
+
const windowTop = (window.pageYOffset || doc.scrollTop) - (doc.clientTop || 0);
|
|
16704
|
+
if (!this.isContentEditable(this.inputElement)) {
|
|
16705
|
+
coordinates = {
|
|
16706
|
+
top: rect.top + windowTop + span.offsetTop + parseInt(computed.borderTopWidth, 10) +
|
|
16707
|
+
parseInt(computed.fontSize, 10) + 3 - element.scrollTop,
|
|
16708
|
+
left: rect.left + windowLeft + span.offsetLeft + parseInt(computed.borderLeftWidth, 10)
|
|
16709
|
+
};
|
|
16710
|
+
document.body.removeChild(div);
|
|
16711
|
+
}
|
|
16712
|
+
else {
|
|
16713
|
+
coordinates = {
|
|
16714
|
+
top: rect.top + windowTop + parseInt(getComputedStyle(this.inputElement).fontSize, 10),
|
|
16715
|
+
left: rect.left + windowLeft
|
|
16716
|
+
};
|
|
16717
|
+
}
|
|
16718
|
+
return coordinates;
|
|
16719
|
+
}
|
|
16720
|
+
initValue() {
|
|
16721
|
+
this.renderList();
|
|
16722
|
+
if (this.dataSource instanceof DataManager) {
|
|
16723
|
+
this.initRemoteRender = true;
|
|
16724
|
+
}
|
|
16725
|
+
else {
|
|
16726
|
+
this.updateValues();
|
|
16727
|
+
}
|
|
16728
|
+
}
|
|
16729
|
+
updateValues() {
|
|
16730
|
+
const li = this.list.querySelector('.' + dropDownBaseClasses.focus);
|
|
16731
|
+
if (!isNullOrUndefined(li)) {
|
|
16732
|
+
this.setSelection(li, null);
|
|
16733
|
+
}
|
|
16734
|
+
}
|
|
16735
|
+
renderList() {
|
|
16736
|
+
super.render();
|
|
16737
|
+
this.unWireListEvents();
|
|
16738
|
+
this.wireListEvents();
|
|
16739
|
+
}
|
|
16740
|
+
/**
|
|
16741
|
+
* Event binding for list
|
|
16742
|
+
*
|
|
16743
|
+
* @returns {void}
|
|
16744
|
+
*/
|
|
16745
|
+
wireListEvents() {
|
|
16746
|
+
EventHandler.add(this.list, 'click', this.onMouseClick, this);
|
|
16747
|
+
EventHandler.add(this.list, 'mouseover', this.onMouseOver, this);
|
|
16748
|
+
EventHandler.add(this.list, 'mouseout', this.onMouseLeave, this);
|
|
16749
|
+
}
|
|
16750
|
+
/**
|
|
16751
|
+
* Event un binding for list items.
|
|
16752
|
+
*
|
|
16753
|
+
* @returns {void}
|
|
16754
|
+
*/
|
|
16755
|
+
unWireListEvents() {
|
|
16756
|
+
EventHandler.remove(this.list, 'click', this.onMouseClick);
|
|
16757
|
+
EventHandler.remove(this.list, 'mouseover', this.onMouseOver);
|
|
16758
|
+
EventHandler.remove(this.list, 'mouseout', this.onMouseLeave);
|
|
16759
|
+
}
|
|
16760
|
+
onMouseClick(e) {
|
|
16761
|
+
const target = e.target;
|
|
16762
|
+
const li = closest(target, '.' + dropDownBaseClasses.li);
|
|
16763
|
+
if (!this.isValidLI(li)) {
|
|
16764
|
+
return;
|
|
16765
|
+
}
|
|
16766
|
+
this.setSelection(li, e);
|
|
16767
|
+
const delay = 100;
|
|
16768
|
+
this.closePopup(delay, e);
|
|
16769
|
+
this.inputElement.focus();
|
|
16770
|
+
}
|
|
16771
|
+
updateSelectedItem(li, e, preventSelect, isSelection) {
|
|
16772
|
+
this.removeSelection();
|
|
16773
|
+
li.classList.add(dropDownBaseClasses.selected);
|
|
16774
|
+
this.removeHover();
|
|
16775
|
+
const value = this.getFormattedValue(li.getAttribute('data-value'));
|
|
16776
|
+
const selectedData = this.getDataByValue(value);
|
|
16777
|
+
if (!preventSelect && !isNullOrUndefined(e)) {
|
|
16778
|
+
const items = this.detachChanges(selectedData);
|
|
16779
|
+
this.isSelected = true;
|
|
16780
|
+
const eventArgs = {
|
|
16781
|
+
e: e,
|
|
16782
|
+
item: li,
|
|
16783
|
+
itemData: items,
|
|
16784
|
+
isInteracted: e ? true : false,
|
|
16785
|
+
cancel: false
|
|
16786
|
+
};
|
|
16787
|
+
this.trigger('select', eventArgs, (eventArgs) => {
|
|
16788
|
+
if (eventArgs.cancel) {
|
|
16789
|
+
li.classList.remove(dropDownBaseClasses.selected);
|
|
16790
|
+
}
|
|
16791
|
+
else {
|
|
16792
|
+
this.selectEventCallback(li, selectedData, value);
|
|
16793
|
+
if (isSelection) {
|
|
16794
|
+
this.setSelectOptions(li, e);
|
|
16795
|
+
}
|
|
16796
|
+
}
|
|
16797
|
+
});
|
|
16798
|
+
}
|
|
16799
|
+
else {
|
|
16800
|
+
this.selectEventCallback(li, selectedData, value);
|
|
16801
|
+
if (isSelection) {
|
|
16802
|
+
this.setSelectOptions(li, e);
|
|
16803
|
+
}
|
|
16804
|
+
}
|
|
16805
|
+
}
|
|
16806
|
+
setSelection(li, e) {
|
|
16807
|
+
if (this.isValidLI(li) && (!li.classList.contains(dropDownBaseClasses.selected) || (this.isPopupOpen && this.isSelected
|
|
16808
|
+
&& li.classList.contains(dropDownBaseClasses.selected)))) {
|
|
16809
|
+
this.updateSelectedItem(li, e, false, true);
|
|
16810
|
+
}
|
|
16811
|
+
else {
|
|
16812
|
+
this.setSelectOptions(li, e);
|
|
16813
|
+
}
|
|
16814
|
+
}
|
|
16815
|
+
setSelectOptions(li, e) {
|
|
16816
|
+
if (this.list) {
|
|
16817
|
+
this.removeHover();
|
|
16818
|
+
}
|
|
16819
|
+
this.previousSelectedLI = (!isNullOrUndefined(this.selectedLI)) ? this.selectedLI : null;
|
|
16820
|
+
this.selectedLI = li;
|
|
16821
|
+
if (this.isPopupOpen && !isNullOrUndefined(this.selectedLI)) {
|
|
16822
|
+
this.setScrollPosition(e);
|
|
16823
|
+
}
|
|
16824
|
+
if (e && (e.keyCode === 38 || e.keyCode === 40)) {
|
|
16825
|
+
return;
|
|
16826
|
+
}
|
|
16827
|
+
if (isNullOrUndefined(e) || this.setValue(e)) {
|
|
16828
|
+
return;
|
|
16829
|
+
}
|
|
16830
|
+
}
|
|
16831
|
+
setScrollPosition(e) {
|
|
16832
|
+
if (!isNullOrUndefined(e)) {
|
|
16833
|
+
switch (e.action) {
|
|
16834
|
+
case 'pageDown':
|
|
16835
|
+
case 'down':
|
|
16836
|
+
case 'end':
|
|
16837
|
+
this.scrollBottom();
|
|
16838
|
+
break;
|
|
16839
|
+
default:
|
|
16840
|
+
this.scrollTop();
|
|
16841
|
+
break;
|
|
16842
|
+
}
|
|
16843
|
+
}
|
|
16844
|
+
else {
|
|
16845
|
+
this.scrollBottom(true);
|
|
16846
|
+
}
|
|
16847
|
+
}
|
|
16848
|
+
scrollBottom(isInitial) {
|
|
16849
|
+
if (!isNullOrUndefined(this.selectedLI)) {
|
|
16850
|
+
const currentOffset = this.list.offsetHeight;
|
|
16851
|
+
const nextBottom = this.selectedLI.offsetTop + this.selectedLI.offsetHeight - this.list.scrollTop;
|
|
16852
|
+
let nextOffset = this.list.scrollTop + nextBottom - currentOffset;
|
|
16853
|
+
nextOffset = isInitial ? nextOffset + parseInt(getComputedStyle(this.list).paddingTop, 10) * 2 : nextOffset;
|
|
16854
|
+
const boxRange = this.selectedLI.offsetTop + this.selectedLI.offsetHeight - this.list.scrollTop;
|
|
16855
|
+
if (this.activeIndex === 0) {
|
|
16856
|
+
this.list.scrollTop = 0;
|
|
16857
|
+
}
|
|
16858
|
+
else if (nextBottom > currentOffset || !(boxRange > 0 && this.list.offsetHeight > boxRange)) {
|
|
16859
|
+
this.list.scrollTop = nextOffset;
|
|
16860
|
+
}
|
|
16861
|
+
}
|
|
16862
|
+
}
|
|
16863
|
+
scrollTop() {
|
|
16864
|
+
if (!isNullOrUndefined(this.selectedLI)) {
|
|
16865
|
+
let nextOffset = this.selectedLI.offsetTop - this.list.scrollTop;
|
|
16866
|
+
nextOffset = this.fields.groupBy && nextOffset;
|
|
16867
|
+
const boxRange = (this.selectedLI.offsetTop + this.selectedLI.offsetHeight - this.list.scrollTop);
|
|
16868
|
+
if (this.activeIndex === 0) {
|
|
16869
|
+
this.list.scrollTop = 0;
|
|
16870
|
+
}
|
|
16871
|
+
else if (nextOffset < 0) {
|
|
16872
|
+
this.list.scrollTop = this.list.scrollTop + nextOffset;
|
|
16873
|
+
}
|
|
16874
|
+
else if (!(boxRange > 0 && this.list.offsetHeight > boxRange)) {
|
|
16875
|
+
this.list.scrollTop = this.selectedLI.offsetTop;
|
|
16876
|
+
}
|
|
16877
|
+
}
|
|
16878
|
+
}
|
|
16879
|
+
selectEventCallback(li, selectedData, value, selectLi) {
|
|
16880
|
+
this.previousItemData = (!isNullOrUndefined(this.itemData)) ? this.itemData : null;
|
|
16881
|
+
this.item = li;
|
|
16882
|
+
this.itemData = selectedData;
|
|
16883
|
+
const focusedItem = this.list.querySelector('.' + dropDownBaseClasses.focus);
|
|
16884
|
+
if (focusedItem) {
|
|
16885
|
+
removeClass([focusedItem], dropDownBaseClasses.focus);
|
|
16886
|
+
}
|
|
16887
|
+
if (selectLi) {
|
|
16888
|
+
addClass([li], dropDownBaseClasses.selected);
|
|
16889
|
+
}
|
|
16890
|
+
li.setAttribute('aria-selected', 'true');
|
|
16891
|
+
this.activeIndex = this.getIndexByValue(value);
|
|
16892
|
+
}
|
|
16893
|
+
detachChanges(value) {
|
|
16894
|
+
let items;
|
|
16895
|
+
if (typeof value === 'string' ||
|
|
16896
|
+
typeof value === 'boolean' ||
|
|
16897
|
+
typeof value === 'number') {
|
|
16898
|
+
items = Object.defineProperties({}, {
|
|
16899
|
+
value: {
|
|
16900
|
+
value: value,
|
|
16901
|
+
enumerable: true
|
|
16902
|
+
},
|
|
16903
|
+
text: {
|
|
16904
|
+
value: value,
|
|
16905
|
+
enumerable: true
|
|
16906
|
+
}
|
|
16907
|
+
});
|
|
16908
|
+
}
|
|
16909
|
+
else {
|
|
16910
|
+
items = value;
|
|
16911
|
+
}
|
|
16912
|
+
return items;
|
|
16913
|
+
}
|
|
16914
|
+
setValue(e) {
|
|
16915
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
16916
|
+
if (!this.isReact) {
|
|
16917
|
+
if (!isNullOrUndefined(this.displayTemplate)) {
|
|
16918
|
+
this.setDisplayTemplate();
|
|
16919
|
+
}
|
|
16920
|
+
this.updateMentionValue(e);
|
|
16921
|
+
return true;
|
|
16922
|
+
}
|
|
16923
|
+
else {
|
|
16924
|
+
if (!isNullOrUndefined(this.displayTemplate)) {
|
|
16925
|
+
this.setDisplayTemplate(e);
|
|
16926
|
+
}
|
|
16927
|
+
else {
|
|
16928
|
+
this.updateMentionValue(e);
|
|
16929
|
+
}
|
|
16930
|
+
return true;
|
|
16931
|
+
}
|
|
16932
|
+
}
|
|
16933
|
+
updateMentionValue(e) {
|
|
16934
|
+
const dataItem = this.getItemData();
|
|
16935
|
+
let textSuffix;
|
|
16936
|
+
let value;
|
|
16937
|
+
let endPos;
|
|
16938
|
+
let range;
|
|
16939
|
+
let globalRange;
|
|
16940
|
+
const selection = this.inputElement.ownerDocument.getSelection();
|
|
16941
|
+
const startPos = this.getTriggerCharPosition();
|
|
16942
|
+
textSuffix = typeof this.suffixText === 'string' ? this.suffixText : '';
|
|
16943
|
+
if (dataItem.text !== null) {
|
|
16944
|
+
value = this.mentionVal(dataItem.text);
|
|
16945
|
+
}
|
|
16946
|
+
if (!this.isContentEditable(this.inputElement)) {
|
|
16947
|
+
const myField = this.inputElement;
|
|
16948
|
+
const currentTriggerSnippet = this.getTextRange().substring(startPos + this.mentionChar.length, this.getTextRange().length);
|
|
16949
|
+
value += textSuffix;
|
|
16950
|
+
endPos = startPos + this.mentionChar.length;
|
|
16951
|
+
endPos += currentTriggerSnippet.length;
|
|
16952
|
+
myField.value = myField.value.substring(0, startPos) + value + myField.value.substring(endPos, myField.value.length);
|
|
16953
|
+
myField.selectionStart = startPos + value.length;
|
|
16954
|
+
myField.selectionEnd = startPos + value.length;
|
|
16955
|
+
if (this.isPopupOpen) {
|
|
16956
|
+
this.hidePopup();
|
|
16957
|
+
}
|
|
16958
|
+
this.onChangeEvent(e);
|
|
16959
|
+
}
|
|
16960
|
+
else {
|
|
16961
|
+
endPos = this.getTriggerCharPosition() + this.mentionChar.length;
|
|
16962
|
+
if (this.range && (this.range.startContainer.textContent.trim() !== this.mentionChar)) {
|
|
16963
|
+
endPos = this.range.endOffset;
|
|
16964
|
+
}
|
|
16965
|
+
globalRange = this.range;
|
|
16966
|
+
range = document.createRange();
|
|
16967
|
+
range.setStart(globalRange.startContainer, startPos);
|
|
16968
|
+
range.setEnd(globalRange.startContainer, endPos);
|
|
16969
|
+
range.deleteContents();
|
|
16970
|
+
const element = this.createElement('div');
|
|
16971
|
+
element.innerHTML = value;
|
|
16972
|
+
const frag = document.createDocumentFragment();
|
|
16973
|
+
let node;
|
|
16974
|
+
let lastNode;
|
|
16975
|
+
// eslint-disable-next-line no-cond-assign
|
|
16976
|
+
while (node = element.firstChild) {
|
|
16977
|
+
lastNode = frag.appendChild(node);
|
|
16978
|
+
}
|
|
16979
|
+
range.insertNode(frag);
|
|
16980
|
+
if (lastNode) {
|
|
16981
|
+
range = range.cloneRange();
|
|
16982
|
+
range.setStartAfter(lastNode);
|
|
16983
|
+
range.collapse(true);
|
|
16984
|
+
selection.removeAllRanges();
|
|
16985
|
+
selection.addRange(range);
|
|
16986
|
+
}
|
|
16987
|
+
if (this.isPopupOpen) {
|
|
16988
|
+
this.hidePopup();
|
|
16989
|
+
}
|
|
16990
|
+
this.onChangeEvent(e);
|
|
16991
|
+
}
|
|
16992
|
+
}
|
|
16993
|
+
mentionVal(value) {
|
|
16994
|
+
const showChar = this.showMentionChar ? this.mentionChar : '';
|
|
16995
|
+
if (!isNullOrUndefined(this.displayTemplate) && !isNullOrUndefined(this.displayTempElement)) {
|
|
16996
|
+
value = this.displayTempElement.innerHTML;
|
|
16997
|
+
}
|
|
16998
|
+
if (this.isContentEditable(this.inputElement)) {
|
|
16999
|
+
return '<span contenteditable="false" class="e-mention-chip">' + showChar + value + '</span>'.concat(typeof this.suffixText === 'string' ? this.suffixText : ' ');
|
|
17000
|
+
}
|
|
17001
|
+
else {
|
|
17002
|
+
return showChar + value;
|
|
17003
|
+
}
|
|
17004
|
+
}
|
|
17005
|
+
setDisplayTemplate(e) {
|
|
17006
|
+
let compiledString;
|
|
17007
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
17008
|
+
if (this.isReact) {
|
|
17009
|
+
this.clearTemplate(['displayTemplate']);
|
|
17010
|
+
if (this.displayTempElement) {
|
|
17011
|
+
detach(this.displayTempElement);
|
|
17012
|
+
this.displayTempElement = null;
|
|
17013
|
+
}
|
|
17014
|
+
}
|
|
17015
|
+
if (!this.displayTempElement) {
|
|
17016
|
+
this.displayTempElement = this.createElement('div');
|
|
17017
|
+
}
|
|
17018
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
17019
|
+
if (!this.isReact) {
|
|
17020
|
+
this.displayTempElement.innerHTML = '';
|
|
17021
|
+
}
|
|
17022
|
+
compiledString = compile(this.displayTemplate);
|
|
17023
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
17024
|
+
const displayCompTemp = compiledString(this.itemData, this, 'displayTemplate', this.displayTemplateId, this.isStringTemplate, null, this.displayTempElement);
|
|
17025
|
+
if (displayCompTemp && displayCompTemp.length > 0) {
|
|
17026
|
+
for (let i = 0; i < displayCompTemp.length; i++) {
|
|
17027
|
+
this.displayTempElement.appendChild(displayCompTemp[i]);
|
|
17028
|
+
}
|
|
17029
|
+
}
|
|
17030
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
17031
|
+
if (!this.isReact) {
|
|
17032
|
+
this.renderTemplates();
|
|
17033
|
+
}
|
|
17034
|
+
else {
|
|
17035
|
+
this.renderTemplates(() => {
|
|
17036
|
+
this.updateMentionValue(e);
|
|
17037
|
+
});
|
|
17038
|
+
}
|
|
17039
|
+
}
|
|
17040
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
17041
|
+
renderTemplates(callBack) {
|
|
17042
|
+
this.renderReactTemplates(callBack);
|
|
17043
|
+
}
|
|
17044
|
+
setSpinnerTemplate() {
|
|
17045
|
+
let compiledString;
|
|
17046
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
17047
|
+
if (this.isReact) {
|
|
17048
|
+
this.clearTemplate(['spinnerTemplate']);
|
|
17049
|
+
if (this.spinnerTemplateElement) {
|
|
17050
|
+
detach(this.spinnerTemplateElement);
|
|
17051
|
+
this.spinnerTemplateElement = null;
|
|
17052
|
+
}
|
|
17053
|
+
}
|
|
17054
|
+
if (!this.spinnerTemplateElement) {
|
|
17055
|
+
this.spinnerTemplateElement = this.createElement('div');
|
|
17056
|
+
}
|
|
17057
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
17058
|
+
if (!this.isReact) {
|
|
17059
|
+
this.spinnerTemplateElement.innerHTML = '';
|
|
17060
|
+
}
|
|
17061
|
+
compiledString = compile(this.spinnerTemplate);
|
|
17062
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
17063
|
+
const spinnerCompTemp = compiledString(null, this, 'spinnerTemplate', this.spinnerTemplateId, this.isStringTemplate, null, this.spinnerTemplateElement);
|
|
17064
|
+
if (spinnerCompTemp && spinnerCompTemp.length > 0) {
|
|
17065
|
+
for (let i = 0; i < spinnerCompTemp.length; i++) {
|
|
17066
|
+
this.spinnerTemplateElement.appendChild(spinnerCompTemp[i]);
|
|
17067
|
+
}
|
|
17068
|
+
}
|
|
17069
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
17070
|
+
if (!this.isReact) {
|
|
17071
|
+
this.renderTemplates();
|
|
17072
|
+
this.popupObj.element.appendChild(this.spinnerTemplateElement);
|
|
17073
|
+
}
|
|
17074
|
+
else {
|
|
17075
|
+
this.renderTemplates(() => {
|
|
17076
|
+
this.popupObj.element.appendChild(this.spinnerTemplateElement);
|
|
17077
|
+
});
|
|
17078
|
+
}
|
|
17079
|
+
}
|
|
17080
|
+
onChangeEvent(eve) {
|
|
17081
|
+
this.isSelected = false;
|
|
17082
|
+
const items = this.detachMentionChanges(this.itemData);
|
|
17083
|
+
let preItems;
|
|
17084
|
+
if (typeof this.previousItemData === 'string' ||
|
|
17085
|
+
typeof this.previousItemData === 'boolean' ||
|
|
17086
|
+
typeof this.previousItemData === 'number') {
|
|
17087
|
+
preItems = Object.defineProperties({}, {
|
|
17088
|
+
value: {
|
|
17089
|
+
value: this.previousItemData,
|
|
17090
|
+
enumerable: true
|
|
17091
|
+
},
|
|
17092
|
+
text: {
|
|
17093
|
+
value: this.previousItemData,
|
|
17094
|
+
enumerable: true
|
|
17095
|
+
}
|
|
17096
|
+
});
|
|
17097
|
+
}
|
|
17098
|
+
else {
|
|
17099
|
+
preItems = this.previousItemData;
|
|
17100
|
+
}
|
|
17101
|
+
const eventArgs = {
|
|
17102
|
+
e: eve,
|
|
17103
|
+
item: this.item,
|
|
17104
|
+
itemData: items,
|
|
17105
|
+
previousItem: this.previousSelectedLI,
|
|
17106
|
+
previousItemData: preItems,
|
|
17107
|
+
isInteracted: eve ? true : false,
|
|
17108
|
+
value: this.item.innerHTML,
|
|
17109
|
+
element: this.inputElement
|
|
17110
|
+
};
|
|
17111
|
+
this.trigger('change', eventArgs);
|
|
17112
|
+
}
|
|
17113
|
+
detachMentionChanges(value) {
|
|
17114
|
+
let items;
|
|
17115
|
+
if (typeof value === 'string' ||
|
|
17116
|
+
typeof value === 'boolean' ||
|
|
17117
|
+
typeof value === 'number') {
|
|
17118
|
+
items = Object.defineProperties({}, {
|
|
17119
|
+
value: {
|
|
17120
|
+
value: value,
|
|
17121
|
+
enumerable: true
|
|
17122
|
+
},
|
|
17123
|
+
text: {
|
|
17124
|
+
value: value,
|
|
17125
|
+
enumerable: true
|
|
17126
|
+
}
|
|
17127
|
+
});
|
|
17128
|
+
}
|
|
17129
|
+
else {
|
|
17130
|
+
items = value;
|
|
17131
|
+
}
|
|
17132
|
+
return items;
|
|
17133
|
+
}
|
|
17134
|
+
getItemData() {
|
|
17135
|
+
const fields = this.fields;
|
|
17136
|
+
let dataItem = null;
|
|
17137
|
+
dataItem = this.itemData;
|
|
17138
|
+
let dataValue;
|
|
17139
|
+
let dataText;
|
|
17140
|
+
if (!isNullOrUndefined(dataItem)) {
|
|
17141
|
+
dataValue = getValue(fields.value, dataItem);
|
|
17142
|
+
dataText = getValue(fields.text, dataItem);
|
|
17143
|
+
}
|
|
17144
|
+
const value = (!isNullOrUndefined(dataItem) &&
|
|
17145
|
+
!isUndefined(dataValue) ? dataValue : dataItem);
|
|
17146
|
+
const text = (!isNullOrUndefined(dataItem) &&
|
|
17147
|
+
!isUndefined(dataValue) ? dataText : dataItem);
|
|
17148
|
+
return { value: value, text: text };
|
|
17149
|
+
}
|
|
17150
|
+
removeSelection() {
|
|
17151
|
+
if (this.list) {
|
|
17152
|
+
const selectedItems = this.list.querySelectorAll('.' + dropDownBaseClasses.selected);
|
|
17153
|
+
if (selectedItems.length) {
|
|
17154
|
+
removeClass(selectedItems, dropDownBaseClasses.selected);
|
|
17155
|
+
selectedItems[0].removeAttribute('aria-selected');
|
|
17156
|
+
}
|
|
17157
|
+
}
|
|
17158
|
+
}
|
|
17159
|
+
onMouseOver(e) {
|
|
17160
|
+
const currentLi = closest(e.target, '.' + dropDownBaseClasses.li);
|
|
17161
|
+
this.setHover(currentLi);
|
|
17162
|
+
}
|
|
17163
|
+
setHover(li) {
|
|
17164
|
+
if (this.isValidLI(li) && !li.classList.contains(dropDownBaseClasses.hover)) {
|
|
17165
|
+
this.removeHover();
|
|
17166
|
+
addClass([li], dropDownBaseClasses.hover);
|
|
17167
|
+
}
|
|
17168
|
+
}
|
|
17169
|
+
removeHover() {
|
|
17170
|
+
if (this.list) {
|
|
17171
|
+
const hoveredItem = this.list.querySelectorAll('.' + dropDownBaseClasses.hover);
|
|
17172
|
+
if (hoveredItem && hoveredItem.length) {
|
|
17173
|
+
removeClass(hoveredItem, dropDownBaseClasses.hover);
|
|
17174
|
+
}
|
|
17175
|
+
}
|
|
17176
|
+
}
|
|
17177
|
+
isValidLI(li) {
|
|
17178
|
+
return (li && li.hasAttribute('role') && li.getAttribute('role') === 'option');
|
|
17179
|
+
}
|
|
17180
|
+
onMouseLeave() {
|
|
17181
|
+
this.removeHover();
|
|
17182
|
+
}
|
|
17183
|
+
/**
|
|
17184
|
+
* Search the entered text and show it in the suggestion list if available.
|
|
17185
|
+
*
|
|
17186
|
+
* @returns {void}
|
|
17187
|
+
*/
|
|
17188
|
+
search(text, positionX, positionY) {
|
|
17189
|
+
if (this.isContentEditable(this.inputElement)) {
|
|
17190
|
+
this.range = this.getCurrentRange();
|
|
17191
|
+
}
|
|
17192
|
+
const currentRange = this.getTextRange();
|
|
17193
|
+
const lastWordRange = this.getLastLetter(currentRange);
|
|
17194
|
+
if ((this.ignoreCase && (text === lastWordRange || text === lastWordRange.toLowerCase()))
|
|
17195
|
+
|| !this.ignoreCase && text === lastWordRange) {
|
|
17196
|
+
this.resetList(this.dataSource, this.fields);
|
|
17197
|
+
}
|
|
17198
|
+
else {
|
|
17199
|
+
if (this.isPopupOpen) {
|
|
17200
|
+
this.hidePopup();
|
|
17201
|
+
}
|
|
17202
|
+
return;
|
|
17203
|
+
}
|
|
17204
|
+
if (isNullOrUndefined(this.list)) {
|
|
17205
|
+
this.renderList();
|
|
17206
|
+
this.renderPopup();
|
|
17207
|
+
}
|
|
17208
|
+
else {
|
|
17209
|
+
this.showPopup();
|
|
17210
|
+
}
|
|
17211
|
+
this.popupObj.element.style.left = formatUnit(positionX);
|
|
17212
|
+
this.popupObj.element.style.top = formatUnit(positionY);
|
|
17213
|
+
}
|
|
17214
|
+
/**
|
|
17215
|
+
* Removes the component from the DOM and detaches all its related event handlers. Also it removes the attributes and classes.
|
|
17216
|
+
*
|
|
17217
|
+
* @method destroy
|
|
17218
|
+
* @returns {void}
|
|
17219
|
+
*/
|
|
17220
|
+
destroy() {
|
|
17221
|
+
this.hidePopup();
|
|
17222
|
+
this.unWireEvent();
|
|
17223
|
+
if (this.list) {
|
|
17224
|
+
this.unWireListEvents();
|
|
17225
|
+
}
|
|
17226
|
+
if (this.inputElement && !this.inputElement.classList.contains('e-' + this.getModuleName())) {
|
|
17227
|
+
return;
|
|
17228
|
+
}
|
|
17229
|
+
super.destroy();
|
|
17230
|
+
}
|
|
17231
|
+
getLocaleName() {
|
|
17232
|
+
return 'mention';
|
|
17233
|
+
}
|
|
17234
|
+
getNgDirective() {
|
|
17235
|
+
return 'EJS-MENTION';
|
|
17236
|
+
}
|
|
17237
|
+
/**
|
|
17238
|
+
* Return the module name of this component.
|
|
17239
|
+
*
|
|
17240
|
+
* @private
|
|
17241
|
+
* @returns {string} Return the module name of this component.
|
|
17242
|
+
*/
|
|
17243
|
+
getModuleName() {
|
|
17244
|
+
return 'mention';
|
|
17245
|
+
}
|
|
17246
|
+
};
|
|
17247
|
+
__decorate$7([
|
|
17248
|
+
Property(null)
|
|
17249
|
+
], Mention.prototype, "cssClass", void 0);
|
|
17250
|
+
__decorate$7([
|
|
17251
|
+
Property('@')
|
|
17252
|
+
], Mention.prototype, "mentionChar", void 0);
|
|
17253
|
+
__decorate$7([
|
|
17254
|
+
Property(false)
|
|
17255
|
+
], Mention.prototype, "showMentionChar", void 0);
|
|
17256
|
+
__decorate$7([
|
|
17257
|
+
Property(false)
|
|
17258
|
+
], Mention.prototype, "allowSpaces", void 0);
|
|
17259
|
+
__decorate$7([
|
|
17260
|
+
Property(null)
|
|
17261
|
+
], Mention.prototype, "suffixText", void 0);
|
|
17262
|
+
__decorate$7([
|
|
17263
|
+
Property(25)
|
|
17264
|
+
], Mention.prototype, "suggestionCount", void 0);
|
|
17265
|
+
__decorate$7([
|
|
17266
|
+
Property(0)
|
|
17267
|
+
], Mention.prototype, "minLength", void 0);
|
|
17268
|
+
__decorate$7([
|
|
17269
|
+
Property('None')
|
|
17270
|
+
], Mention.prototype, "sortOrder", void 0);
|
|
17271
|
+
__decorate$7([
|
|
17272
|
+
Property(true)
|
|
17273
|
+
], Mention.prototype, "ignoreCase", void 0);
|
|
17274
|
+
__decorate$7([
|
|
17275
|
+
Property(false)
|
|
17276
|
+
], Mention.prototype, "highlight", void 0);
|
|
17277
|
+
__decorate$7([
|
|
17278
|
+
Property()
|
|
17279
|
+
], Mention.prototype, "locale", void 0);
|
|
17280
|
+
__decorate$7([
|
|
17281
|
+
Property('auto')
|
|
17282
|
+
], Mention.prototype, "popupWidth", void 0);
|
|
17283
|
+
__decorate$7([
|
|
17284
|
+
Property('300px')
|
|
17285
|
+
], Mention.prototype, "popupHeight", void 0);
|
|
17286
|
+
__decorate$7([
|
|
17287
|
+
Property(null)
|
|
17288
|
+
], Mention.prototype, "displayTemplate", void 0);
|
|
17289
|
+
__decorate$7([
|
|
17290
|
+
Property(null)
|
|
17291
|
+
], Mention.prototype, "itemTemplate", void 0);
|
|
17292
|
+
__decorate$7([
|
|
17293
|
+
Property('No records found')
|
|
17294
|
+
], Mention.prototype, "noRecordsTemplate", void 0);
|
|
17295
|
+
__decorate$7([
|
|
17296
|
+
Property(null)
|
|
17297
|
+
], Mention.prototype, "spinnerTemplate", void 0);
|
|
17298
|
+
__decorate$7([
|
|
17299
|
+
Property()
|
|
17300
|
+
], Mention.prototype, "target", void 0);
|
|
17301
|
+
__decorate$7([
|
|
17302
|
+
Property([])
|
|
17303
|
+
], Mention.prototype, "dataSource", void 0);
|
|
17304
|
+
__decorate$7([
|
|
17305
|
+
Property(null)
|
|
17306
|
+
], Mention.prototype, "query", void 0);
|
|
17307
|
+
__decorate$7([
|
|
17308
|
+
Property('Contains')
|
|
17309
|
+
], Mention.prototype, "filterType", void 0);
|
|
17310
|
+
__decorate$7([
|
|
17311
|
+
Complex({ text: null, value: null, iconCss: null, groupBy: null }, FieldSettings)
|
|
17312
|
+
], Mention.prototype, "fields", void 0);
|
|
17313
|
+
__decorate$7([
|
|
17314
|
+
Event()
|
|
17315
|
+
], Mention.prototype, "actionBegin", void 0);
|
|
17316
|
+
__decorate$7([
|
|
17317
|
+
Event()
|
|
17318
|
+
], Mention.prototype, "actionComplete", void 0);
|
|
17319
|
+
__decorate$7([
|
|
17320
|
+
Event()
|
|
17321
|
+
], Mention.prototype, "actionFailure", void 0);
|
|
17322
|
+
__decorate$7([
|
|
17323
|
+
Event()
|
|
17324
|
+
], Mention.prototype, "change", void 0);
|
|
17325
|
+
__decorate$7([
|
|
17326
|
+
Event()
|
|
17327
|
+
], Mention.prototype, "beforeOpen", void 0);
|
|
17328
|
+
__decorate$7([
|
|
17329
|
+
Event()
|
|
17330
|
+
], Mention.prototype, "opened", void 0);
|
|
17331
|
+
__decorate$7([
|
|
17332
|
+
Event()
|
|
17333
|
+
], Mention.prototype, "closed", void 0);
|
|
17334
|
+
__decorate$7([
|
|
17335
|
+
Event()
|
|
17336
|
+
], Mention.prototype, "select", void 0);
|
|
17337
|
+
__decorate$7([
|
|
17338
|
+
Event()
|
|
17339
|
+
], Mention.prototype, "filtering", void 0);
|
|
17340
|
+
__decorate$7([
|
|
17341
|
+
Event()
|
|
17342
|
+
], Mention.prototype, "created", void 0);
|
|
17343
|
+
__decorate$7([
|
|
17344
|
+
Event()
|
|
17345
|
+
], Mention.prototype, "destroyed", void 0);
|
|
17346
|
+
Mention = __decorate$7([
|
|
17347
|
+
NotifyPropertyChanges
|
|
17348
|
+
], Mention);
|
|
17349
|
+
|
|
15536
17350
|
/**
|
|
15537
17351
|
* export all modules from current location
|
|
15538
17352
|
*/
|
|
@@ -15541,5 +17355,5 @@ const listBoxClasses = {
|
|
|
15541
17355
|
* export all modules from current location
|
|
15542
17356
|
*/
|
|
15543
17357
|
|
|
15544
|
-
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 };
|
|
17358
|
+
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 };
|
|
15545
17359
|
//# sourceMappingURL=ej2-dropdowns.es2015.js.map
|