@syncfusion/ej2-dropdowns 20.2.40 → 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 +116 -3
- 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 +2248 -468
- package/dist/es6/ej2-dropdowns.es2015.js.map +1 -1
- package/dist/es6/ej2-dropdowns.es5.js +2291 -481
- 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 +195 -110
- package/src/drop-down-tree/drop-down-tree-model.d.ts +16 -2
- package/src/drop-down-tree/drop-down-tree.d.ts +15 -1
- package/src/drop-down-tree/drop-down-tree.js +49 -14
- package/src/index.d.ts +1 -0
- package/src/index.js +1 -0
- package/src/list-box/list-box-model.d.ts +18 -0
- package/src/list-box/list-box.d.ts +23 -1
- package/src/list-box/list-box.js +78 -35
- package/src/mention/index.d.ts +5 -0
- package/src/mention/index.js +4 -0
- package/src/mention/mention-model.d.ts +285 -0
- package/src/mention/mention.d.ts +457 -0
- package/src/mention/mention.js +1465 -0
- package/src/multi-select/checkbox-selection.js +11 -12
- package/src/multi-select/float-label.js +4 -2
- package/src/multi-select/multi-select-model.d.ts +1 -1
- package/src/multi-select/multi-select.d.ts +10 -5
- package/src/multi-select/multi-select.js +312 -188
- package/styles/auto-complete/_all.scss +1 -1
- package/styles/auto-complete/_bootstrap-dark-definition.scss +1 -1
- package/styles/auto-complete/_bootstrap-definition.scss +1 -1
- package/styles/auto-complete/_bootstrap4-definition.scss +2 -2
- package/styles/auto-complete/_bootstrap5-definition.scss +1 -1
- package/styles/auto-complete/_fabric-dark-definition.scss +1 -1
- package/styles/auto-complete/_fabric-definition.scss +1 -1
- package/styles/auto-complete/_fluent-definition.scss +1 -1
- package/styles/auto-complete/_fusionnew-definition.scss +1 -1
- package/styles/auto-complete/_highcontrast-definition.scss +1 -1
- package/styles/auto-complete/_highcontrast-light-definition.scss +1 -1
- package/styles/auto-complete/_material-dark-definition.scss +1 -1
- package/styles/auto-complete/_material-definition.scss +1 -1
- package/styles/auto-complete/_material3-definition.scss +1 -1
- package/styles/auto-complete/_tailwind-definition.scss +1 -1
- package/styles/auto-complete/bootstrap-dark.css +3 -1
- package/styles/auto-complete/bootstrap.css +3 -1
- package/styles/auto-complete/bootstrap4.css +3 -1
- package/styles/auto-complete/bootstrap5-dark.css +3 -1
- package/styles/auto-complete/bootstrap5.css +3 -1
- package/styles/auto-complete/fabric-dark.css +3 -1
- package/styles/auto-complete/fabric.css +3 -1
- package/styles/auto-complete/fluent-dark.css +3 -1
- package/styles/auto-complete/fluent.css +3 -1
- package/styles/auto-complete/highcontrast-light.css +3 -1
- package/styles/auto-complete/highcontrast.css +3 -1
- package/styles/auto-complete/material-dark.css +3 -1
- package/styles/auto-complete/material.css +3 -1
- package/styles/auto-complete/tailwind-dark.css +3 -1
- package/styles/auto-complete/tailwind.css +3 -1
- package/styles/bootstrap-dark.css +121 -44
- package/styles/bootstrap-dark.scss +1 -0
- package/styles/bootstrap.css +121 -44
- package/styles/bootstrap.scss +1 -0
- package/styles/bootstrap4.css +134 -55
- package/styles/bootstrap4.scss +1 -0
- package/styles/bootstrap5-dark.css +135 -50
- package/styles/bootstrap5-dark.scss +1 -0
- package/styles/bootstrap5.css +135 -50
- package/styles/bootstrap5.scss +1 -0
- package/styles/combo-box/_all.scss +1 -1
- package/styles/combo-box/_bootstrap-dark-definition.scss +1 -1
- package/styles/combo-box/_bootstrap-definition.scss +1 -1
- package/styles/combo-box/_bootstrap4-definition.scss +2 -2
- package/styles/combo-box/_bootstrap5-definition.scss +1 -1
- package/styles/combo-box/_fabric-dark-definition.scss +1 -1
- package/styles/combo-box/_fabric-definition.scss +1 -1
- package/styles/combo-box/_fluent-definition.scss +1 -1
- package/styles/combo-box/_fusionnew-definition.scss +1 -1
- package/styles/combo-box/_highcontrast-definition.scss +1 -1
- package/styles/combo-box/_highcontrast-light-definition.scss +1 -1
- package/styles/combo-box/_material-dark-definition.scss +1 -1
- package/styles/combo-box/_material-definition.scss +1 -1
- package/styles/combo-box/_material3-definition.scss +1 -1
- package/styles/combo-box/_tailwind-definition.scss +1 -1
- package/styles/combo-box/bootstrap-dark.css +3 -1
- package/styles/combo-box/bootstrap.css +3 -1
- package/styles/combo-box/bootstrap4.css +3 -1
- package/styles/combo-box/bootstrap5-dark.css +3 -1
- package/styles/combo-box/bootstrap5.css +3 -1
- package/styles/combo-box/fabric-dark.css +3 -1
- package/styles/combo-box/fabric.css +3 -1
- package/styles/combo-box/fluent-dark.css +3 -1
- package/styles/combo-box/fluent.css +3 -1
- package/styles/combo-box/highcontrast-light.css +3 -1
- package/styles/combo-box/highcontrast.css +3 -1
- package/styles/combo-box/material-dark.css +3 -1
- package/styles/combo-box/material.css +3 -1
- package/styles/combo-box/tailwind-dark.css +3 -1
- package/styles/combo-box/tailwind.css +3 -1
- package/styles/drop-down-base/_all.scss +1 -1
- package/styles/drop-down-base/_bootstrap-dark-definition.scss +9 -2
- package/styles/drop-down-base/_bootstrap-definition.scss +7 -1
- package/styles/drop-down-base/_bootstrap4-definition.scss +7 -1
- package/styles/drop-down-base/_bootstrap5-definition.scss +9 -3
- package/styles/drop-down-base/_fabric-dark-definition.scss +7 -1
- package/styles/drop-down-base/_fabric-definition.scss +7 -1
- package/styles/drop-down-base/_fluent-definition.scss +9 -2
- package/styles/drop-down-base/_fusionnew-definition.scss +9 -3
- package/styles/drop-down-base/_highcontrast-definition.scss +17 -6
- package/styles/drop-down-base/_highcontrast-light-definition.scss +19 -7
- package/styles/drop-down-base/_layout.scss +44 -3
- package/styles/drop-down-base/_material-dark-definition.scss +8 -1
- package/styles/drop-down-base/_material-definition.scss +7 -0
- package/styles/drop-down-base/_material3-definition.scss +9 -3
- package/styles/drop-down-base/_tailwind-definition.scss +9 -3
- package/styles/drop-down-base/_theme.scss +4 -4
- package/styles/drop-down-base/bootstrap-dark.css +42 -1
- package/styles/drop-down-base/bootstrap.css +42 -1
- package/styles/drop-down-base/bootstrap4.css +42 -1
- package/styles/drop-down-base/bootstrap5-dark.css +42 -1
- package/styles/drop-down-base/bootstrap5.css +42 -1
- package/styles/drop-down-base/fabric-dark.css +42 -1
- package/styles/drop-down-base/fabric.css +42 -1
- package/styles/drop-down-base/fluent-dark.css +42 -1
- package/styles/drop-down-base/fluent.css +42 -1
- package/styles/drop-down-base/highcontrast-light.css +42 -1
- package/styles/drop-down-base/highcontrast.css +42 -1
- package/styles/drop-down-base/material-dark.css +42 -1
- package/styles/drop-down-base/material.css +42 -1
- package/styles/drop-down-base/tailwind-dark.css +42 -1
- package/styles/drop-down-base/tailwind.css +42 -1
- package/styles/drop-down-list/_all.scss +2 -1
- package/styles/drop-down-list/_bootstrap-dark-definition.scss +2 -1
- package/styles/drop-down-list/_bootstrap-definition.scss +2 -1
- package/styles/drop-down-list/_bootstrap4-definition.scss +3 -1
- package/styles/drop-down-list/_bootstrap5-definition.scss +3 -3
- package/styles/drop-down-list/_fabric-dark-definition.scss +2 -1
- package/styles/drop-down-list/_fabric-definition.scss +2 -0
- package/styles/drop-down-list/_fluent-definition.scss +2 -1
- package/styles/drop-down-list/_fusionnew-definition.scss +3 -3
- package/styles/drop-down-list/_highcontrast-definition.scss +21 -10
- package/styles/drop-down-list/_highcontrast-light-definition.scss +22 -11
- package/styles/drop-down-list/_layout.scss +11 -9
- package/styles/drop-down-list/_material-dark-definition.scss +2 -2
- package/styles/drop-down-list/_material-definition.scss +1 -0
- package/styles/drop-down-list/_material3-definition.scss +3 -3
- package/styles/drop-down-list/_tailwind-definition.scss +1 -0
- package/styles/drop-down-list/_theme.scss +3 -3
- package/styles/drop-down-list/bootstrap-dark.css +8 -0
- package/styles/drop-down-list/bootstrap.css +8 -0
- package/styles/drop-down-list/bootstrap4.css +8 -0
- package/styles/drop-down-list/bootstrap5-dark.css +9 -0
- package/styles/drop-down-list/bootstrap5.css +9 -0
- package/styles/drop-down-list/fabric-dark.css +8 -0
- package/styles/drop-down-list/fabric.css +8 -0
- package/styles/drop-down-list/fluent-dark.css +9 -0
- package/styles/drop-down-list/fluent.css +9 -0
- package/styles/drop-down-list/highcontrast-light.css +8 -0
- package/styles/drop-down-list/highcontrast.css +8 -0
- package/styles/drop-down-list/icons/_bootstrap.scss +0 -1
- package/styles/drop-down-list/icons/_fabric.scss +0 -1
- package/styles/drop-down-list/icons/_material.scss +0 -1
- package/styles/drop-down-list/material-dark.css +8 -0
- package/styles/drop-down-list/material.css +8 -0
- package/styles/drop-down-list/tailwind-dark.css +9 -0
- package/styles/drop-down-list/tailwind.css +9 -0
- package/styles/drop-down-tree/_all.scss +1 -1
- package/styles/drop-down-tree/_bootstrap-dark-definition.scss +1 -1
- package/styles/drop-down-tree/_bootstrap-definition.scss +1 -1
- package/styles/drop-down-tree/_bootstrap4-definition.scss +1 -1
- package/styles/drop-down-tree/_bootstrap5-definition.scss +2 -2
- package/styles/drop-down-tree/_fabric-dark-definition.scss +1 -1
- package/styles/drop-down-tree/_fabric-definition.scss +2 -2
- package/styles/drop-down-tree/_fluent-definition.scss +2 -2
- package/styles/drop-down-tree/_fusionnew-definition.scss +2 -2
- package/styles/drop-down-tree/_highcontrast-definition.scss +1 -1
- package/styles/drop-down-tree/_highcontrast-light-definition.scss +1 -1
- package/styles/drop-down-tree/_layout.scss +10 -3
- package/styles/drop-down-tree/_material-dark-definition.scss +2 -2
- package/styles/drop-down-tree/_material-definition.scss +2 -2
- package/styles/drop-down-tree/_material3-definition.scss +2 -2
- package/styles/drop-down-tree/_tailwind-definition.scss +2 -2
- package/styles/drop-down-tree/bootstrap-dark.css +4 -0
- package/styles/drop-down-tree/bootstrap.css +4 -0
- package/styles/drop-down-tree/bootstrap4.css +4 -0
- package/styles/drop-down-tree/bootstrap5-dark.css +9 -1
- package/styles/drop-down-tree/bootstrap5.css +9 -1
- package/styles/drop-down-tree/fabric-dark.css +4 -0
- package/styles/drop-down-tree/fabric.css +4 -0
- package/styles/drop-down-tree/fluent-dark.css +5 -0
- package/styles/drop-down-tree/fluent.css +5 -0
- package/styles/drop-down-tree/highcontrast-light.css +4 -0
- package/styles/drop-down-tree/highcontrast.css +4 -0
- package/styles/drop-down-tree/icons/_bootstrap.scss +0 -1
- package/styles/drop-down-tree/icons/_bootstrap4.scss +0 -1
- package/styles/drop-down-tree/icons/_fabric.scss +0 -1
- package/styles/drop-down-tree/icons/_highcontrast-light.scss +0 -1
- package/styles/drop-down-tree/icons/_highcontrast.scss +0 -1
- package/styles/drop-down-tree/icons/_material-dark.scss +0 -1
- package/styles/drop-down-tree/icons/_material.scss +0 -1
- package/styles/drop-down-tree/material-dark.css +4 -0
- package/styles/drop-down-tree/material.css +4 -0
- package/styles/drop-down-tree/tailwind-dark.css +5 -0
- package/styles/drop-down-tree/tailwind.css +5 -0
- package/styles/fabric-dark.css +129 -52
- package/styles/fabric-dark.scss +1 -0
- package/styles/fabric.css +129 -52
- package/styles/fabric.scss +1 -0
- package/styles/fluent-dark.css +129 -47
- package/styles/fluent-dark.scss +1 -0
- package/styles/fluent.css +129 -47
- package/styles/fluent.scss +1 -0
- package/styles/highcontrast-light.css +124 -44
- package/styles/highcontrast-light.scss +1 -0
- package/styles/highcontrast.css +133 -53
- package/styles/highcontrast.scss +1 -0
- package/styles/list-box/_all.scss +1 -1
- package/styles/list-box/_bootstrap-dark-definition.scss +2 -0
- package/styles/list-box/_bootstrap-definition.scss +1 -0
- package/styles/list-box/_bootstrap4-definition.scss +1 -0
- package/styles/list-box/_bootstrap5-definition.scss +3 -0
- package/styles/list-box/_fabric-dark-definition.scss +3 -1
- package/styles/list-box/_fabric-definition.scss +1 -0
- package/styles/list-box/_fluent-definition.scss +3 -0
- package/styles/list-box/_fusionnew-definition.scss +1 -0
- package/styles/list-box/_highcontrast-definition.scss +1 -0
- package/styles/list-box/_highcontrast-light-definition.scss +3 -1
- package/styles/list-box/_layout.scss +8 -17
- package/styles/list-box/_material-dark-definition.scss +2 -0
- package/styles/list-box/_material-definition.scss +1 -0
- package/styles/list-box/_material3-definition.scss +1 -0
- package/styles/list-box/_tailwind-definition.scss +3 -0
- package/styles/list-box/_theme.scss +11 -25
- package/styles/list-box/bootstrap-dark.css +12 -33
- package/styles/list-box/bootstrap.css +14 -35
- package/styles/list-box/bootstrap4.css +14 -35
- package/styles/list-box/bootstrap5-dark.css +15 -36
- package/styles/list-box/bootstrap5.css +15 -36
- package/styles/list-box/fabric-dark.css +12 -33
- package/styles/list-box/fabric.css +14 -35
- package/styles/list-box/fluent-dark.css +15 -36
- package/styles/list-box/fluent.css +15 -36
- package/styles/list-box/highcontrast-light.css +12 -33
- package/styles/list-box/highcontrast.css +14 -35
- package/styles/list-box/icons/_bootstrap-dark.scss +2 -2
- package/styles/list-box/icons/_bootstrap.scss +1 -1
- package/styles/list-box/icons/_bootstrap4.scss +1 -1
- package/styles/list-box/icons/_bootstrap5.scss +1 -1
- package/styles/list-box/icons/_fabric-dark.scss +1 -1
- package/styles/list-box/icons/_fabric.scss +1 -1
- package/styles/list-box/icons/_fluent.scss +1 -1
- package/styles/list-box/icons/_fusionnew.scss +1 -1
- package/styles/list-box/icons/_highcontrast-light.scss +1 -1
- package/styles/list-box/icons/_highcontrast.scss +1 -1
- package/styles/list-box/icons/_material-dark.scss +1 -1
- package/styles/list-box/icons/_material.scss +2 -2
- package/styles/list-box/icons/_material3.scss +1 -1
- package/styles/list-box/icons/_tailwind-dark.scss +1 -1
- package/styles/list-box/icons/_tailwind.scss +1 -1
- package/styles/list-box/material-dark.css +12 -33
- package/styles/list-box/material.css +14 -35
- package/styles/list-box/tailwind-dark.css +15 -36
- package/styles/list-box/tailwind.css +15 -36
- package/styles/material-dark.css +120 -43
- package/styles/material-dark.scss +1 -0
- package/styles/material.css +120 -43
- package/styles/material.scss +1 -0
- package/styles/mention/_all.scss +1 -0
- package/styles/mention/_bootstrap-dark-definition.scss +3 -0
- package/styles/mention/_bootstrap-definition.scss +3 -0
- package/styles/mention/_bootstrap4-definition.scss +3 -0
- package/styles/mention/_bootstrap5-dark-definition.scss +1 -0
- package/styles/mention/_bootstrap5-definition.scss +1 -0
- package/styles/mention/_fabric-dark-definition.scss +2 -0
- package/styles/mention/_fabric-definition.scss +3 -0
- package/styles/mention/_fluent-dark-definition.scss +1 -0
- package/styles/mention/_fluent-definition.scss +1 -0
- package/styles/mention/_fusionnew-definition.scss +1 -0
- package/styles/mention/_highcontrast-definition.scss +3 -0
- package/styles/mention/_highcontrast-light-definition.scss +3 -0
- package/styles/mention/_layout.scss +6 -0
- package/styles/mention/_material-dark-definition.scss +3 -0
- package/styles/mention/_material-definition.scss +3 -0
- package/styles/mention/_material3-definition.scss +1 -0
- package/styles/mention/_tailwind-dark-definition.scss +1 -0
- package/styles/mention/_tailwind-definition.scss +1 -0
- package/styles/mention/bootstrap-dark.css +29 -0
- package/styles/mention/bootstrap-dark.scss +6 -0
- package/styles/mention/bootstrap.css +29 -0
- package/styles/mention/bootstrap.scss +6 -0
- package/styles/mention/bootstrap4.css +47 -0
- package/styles/mention/bootstrap4.scss +6 -0
- package/styles/mention/bootstrap5-dark.css +58 -0
- package/styles/mention/bootstrap5-dark.scss +6 -0
- package/styles/mention/bootstrap5.css +58 -0
- package/styles/mention/bootstrap5.scss +6 -0
- package/styles/mention/fabric-dark.css +29 -0
- package/styles/mention/fabric-dark.scss +6 -0
- package/styles/mention/fabric.css +29 -0
- package/styles/mention/fabric.scss +6 -0
- package/styles/mention/fluent-dark.css +58 -0
- package/styles/mention/fluent-dark.scss +6 -0
- package/styles/mention/fluent.css +58 -0
- package/styles/mention/fluent.scss +6 -0
- package/styles/mention/highcontrast-light.css +43 -0
- package/styles/mention/highcontrast-light.scss +6 -0
- package/styles/mention/highcontrast.css +43 -0
- package/styles/mention/highcontrast.scss +6 -0
- package/styles/mention/material-dark.css +29 -0
- package/styles/mention/material-dark.scss +6 -0
- package/styles/mention/material.css +29 -0
- package/styles/mention/material.scss +6 -0
- package/styles/mention/tailwind-dark.css +68 -0
- package/styles/mention/tailwind-dark.scss +6 -0
- package/styles/mention/tailwind.css +68 -0
- package/styles/mention/tailwind.scss +6 -0
- package/styles/multi-select/_all.scss +1 -1
- package/styles/multi-select/_bootstrap-dark-definition.scss +11 -1
- package/styles/multi-select/_bootstrap-definition.scss +9 -0
- package/styles/multi-select/_bootstrap4-definition.scss +20 -9
- package/styles/multi-select/_bootstrap5-definition.scss +11 -3
- package/styles/multi-select/_fabric-dark-definition.scss +16 -7
- package/styles/multi-select/_fabric-definition.scss +15 -6
- package/styles/multi-select/_fluent-definition.scss +11 -2
- package/styles/multi-select/_fusionnew-definition.scss +10 -2
- package/styles/multi-select/_highcontrast-definition.scss +59 -29
- package/styles/multi-select/_highcontrast-light-definition.scss +55 -25
- package/styles/multi-select/_layout.scss +91 -78
- package/styles/multi-select/_material-dark-definition.scss +10 -1
- package/styles/multi-select/_material-definition.scss +8 -0
- package/styles/multi-select/_material3-definition.scss +9 -2
- package/styles/multi-select/_tailwind-definition.scss +11 -4
- package/styles/multi-select/_theme.scss +20 -21
- package/styles/multi-select/bootstrap-dark.css +34 -8
- package/styles/multi-select/bootstrap.css +34 -8
- package/styles/multi-select/bootstrap4.css +46 -19
- package/styles/multi-select/bootstrap5-dark.css +38 -11
- package/styles/multi-select/bootstrap5.css +38 -11
- package/styles/multi-select/fabric-dark.css +42 -16
- package/styles/multi-select/fabric.css +42 -16
- package/styles/multi-select/fluent-dark.css +36 -9
- package/styles/multi-select/fluent.css +36 -9
- package/styles/multi-select/highcontrast-light.css +37 -8
- package/styles/multi-select/highcontrast.css +46 -17
- package/styles/multi-select/icons/_bootstrap5.scss +0 -1
- package/styles/multi-select/icons/_fluent.scss +0 -1
- package/styles/multi-select/icons/_fusionnew.scss +0 -1
- package/styles/multi-select/icons/_material-dark.scss +53 -54
- package/styles/multi-select/icons/_material.scss +53 -54
- package/styles/multi-select/icons/_material3.scss +0 -1
- package/styles/multi-select/icons/_tailwind.scss +0 -1
- package/styles/multi-select/material-dark.css +33 -7
- package/styles/multi-select/material.css +33 -7
- package/styles/multi-select/tailwind-dark.css +38 -9
- package/styles/multi-select/tailwind.css +38 -9
- package/styles/tailwind-dark.css +132 -47
- package/styles/tailwind-dark.scss +1 -0
- package/styles/tailwind.css +132 -47
- package/styles/tailwind.scss +1 -0
|
@@ -6,9 +6,6 @@ import { Input, TextBox } from '@syncfusion/ej2-inputs';
|
|
|
6
6
|
import { Button, createCheckBox } from '@syncfusion/ej2-buttons';
|
|
7
7
|
import { TreeView } from '@syncfusion/ej2-navigations';
|
|
8
8
|
|
|
9
|
-
/**
|
|
10
|
-
* IncrementalSearch module file
|
|
11
|
-
*/
|
|
12
9
|
let queryString = '';
|
|
13
10
|
let prevString = '';
|
|
14
11
|
let matches$1 = [];
|
|
@@ -81,7 +78,7 @@ function incrementalSearch(keyCode, items, selectedIndex, ignoreCase, elementId)
|
|
|
81
78
|
* @param {boolean} ignoreCase - Specifies the case sensitive option for search operation.
|
|
82
79
|
* @returns {Element | number} Returns the search matched items.
|
|
83
80
|
*/
|
|
84
|
-
function Search(inputVal, items, searchType, ignoreCase) {
|
|
81
|
+
function Search(inputVal, items, searchType, ignoreCase, dataSource, fields, type) {
|
|
85
82
|
const listItems = items;
|
|
86
83
|
ignoreCase = ignoreCase !== undefined && ignoreCase !== null ? ignoreCase : true;
|
|
87
84
|
const itemData = { item: null, index: null };
|
|
@@ -91,7 +88,20 @@ function Search(inputVal, items, searchType, ignoreCase) {
|
|
|
91
88
|
queryStr = escapeCharRegExp(queryStr);
|
|
92
89
|
for (let i = 0, itemsData = listItems; i < itemsData.length; i++) {
|
|
93
90
|
const item = itemsData[i];
|
|
94
|
-
|
|
91
|
+
let text;
|
|
92
|
+
let filterValue;
|
|
93
|
+
if (items && dataSource) {
|
|
94
|
+
let checkField = item;
|
|
95
|
+
let fieldValue = fields.text.split('.');
|
|
96
|
+
dataSource.filter(function (data) {
|
|
97
|
+
Array.prototype.slice.call(fieldValue).forEach(function (value) {
|
|
98
|
+
if (type === 'object' && checkField.textContent.toString().indexOf(data[value]) !== -1 && checkField.getAttribute('data-value') === data[fields.value] || type === 'string' && checkField.textContent.toString().indexOf(data) !== -1) {
|
|
99
|
+
filterValue = type === 'object' ? data[value] : data;
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
text = dataSource && filterValue ? (ignoreCase ? filterValue.toLocaleLowerCase() : filterValue).replace(/^\s+|\s+$/g, '') : (ignoreCase ? item.textContent.toLocaleLowerCase() : item.textContent).replace(/^\s+|\s+$/g, '');
|
|
95
105
|
if ((searchType === 'Equal' && text === queryStr) || (searchType === 'StartsWith' && text.substr(0, strLength) === queryStr) || (searchType === 'EndsWith' && text.substr(text.length - queryStr.length) === queryStr) || (searchType === 'Contains' && new RegExp(queryStr, "g").test(text))) {
|
|
96
106
|
itemData.item = item;
|
|
97
107
|
itemData.index = i;
|
|
@@ -214,6 +224,8 @@ const dropDownBaseClasses = {
|
|
|
214
224
|
grouping: 'e-dd-group'
|
|
215
225
|
};
|
|
216
226
|
const ITEMTEMPLATE_PROPERTY = 'ItemTemplate';
|
|
227
|
+
const DISPLAYTEMPLATE_PROPERTY = 'DisplayTemplate';
|
|
228
|
+
const SPINNERTEMPLATE_PROPERTY = 'SpinnerTemplate';
|
|
217
229
|
const VALUETEMPLATE_PROPERTY = 'ValueTemplate';
|
|
218
230
|
const GROUPTEMPLATE_PROPERTY = 'GroupTemplate';
|
|
219
231
|
const HEADERTEMPLATE_PROPERTY = 'HeaderTemplate';
|
|
@@ -238,6 +250,7 @@ let DropDownBase = class DropDownBase extends Component {
|
|
|
238
250
|
this.isAngular = false;
|
|
239
251
|
this.isPreventChange = false;
|
|
240
252
|
this.isDynamicDataChange = false;
|
|
253
|
+
this.addedNewItem = false;
|
|
241
254
|
}
|
|
242
255
|
getPropObject(prop, newProp, oldProp) {
|
|
243
256
|
const newProperty = new Object();
|
|
@@ -406,7 +419,8 @@ let DropDownBase = class DropDownBase extends Component {
|
|
|
406
419
|
this.l10n = componentLocale;
|
|
407
420
|
}
|
|
408
421
|
else {
|
|
409
|
-
this.l10n = new L10n(this.getModuleName() === 'listbox' ? 'listbox' :
|
|
422
|
+
this.l10n = new L10n(this.getModuleName() === 'listbox' ? 'listbox' :
|
|
423
|
+
this.getModuleName() === 'mention' ? 'mention' : 'dropdowns', l10nLocale, this.locale);
|
|
410
424
|
}
|
|
411
425
|
const content = actionFailure ?
|
|
412
426
|
this.l10n.getConstant('actionFailureTemplate') : this.l10n.getConstant('noRecordsTemplate');
|
|
@@ -415,9 +429,12 @@ let DropDownBase = class DropDownBase extends Component {
|
|
|
415
429
|
liElem.textContent = content;
|
|
416
430
|
ele.appendChild(liElem);
|
|
417
431
|
liElem.classList.add('e-list-nrt');
|
|
432
|
+
liElem.setAttribute('role', 'option');
|
|
418
433
|
}
|
|
419
434
|
else {
|
|
420
|
-
ele
|
|
435
|
+
if (!isNullOrUndefined(ele)) {
|
|
436
|
+
ele.innerHTML = content;
|
|
437
|
+
}
|
|
421
438
|
}
|
|
422
439
|
}
|
|
423
440
|
}
|
|
@@ -448,14 +465,16 @@ let DropDownBase = class DropDownBase extends Component {
|
|
|
448
465
|
* @returns {void}
|
|
449
466
|
*/
|
|
450
467
|
setEnableRtl() {
|
|
451
|
-
if (this.
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
468
|
+
if (!isNullOrUndefined(this.enableRtlElements)) {
|
|
469
|
+
if (this.list) {
|
|
470
|
+
this.enableRtlElements.push(this.list);
|
|
471
|
+
}
|
|
472
|
+
if (this.enableRtl) {
|
|
473
|
+
addClass(this.enableRtlElements, dropDownBaseClasses.rtl);
|
|
474
|
+
}
|
|
475
|
+
else {
|
|
476
|
+
removeClass(this.enableRtlElements, dropDownBaseClasses.rtl);
|
|
477
|
+
}
|
|
459
478
|
}
|
|
460
479
|
}
|
|
461
480
|
/**
|
|
@@ -463,7 +482,7 @@ let DropDownBase = class DropDownBase extends Component {
|
|
|
463
482
|
*
|
|
464
483
|
* @returns {void}
|
|
465
484
|
*/
|
|
466
|
-
initialize() {
|
|
485
|
+
initialize(e) {
|
|
467
486
|
this.bindEvent = true;
|
|
468
487
|
this.actionFailureTemplateId = `${this.element.id}${ACTIONFAILURETEMPLATE_PROPERTY}`;
|
|
469
488
|
if (this.element.tagName === 'UL') {
|
|
@@ -482,7 +501,7 @@ let DropDownBase = class DropDownBase extends Component {
|
|
|
482
501
|
}
|
|
483
502
|
}
|
|
484
503
|
else {
|
|
485
|
-
this.setListData(this.dataSource, this.fields, this.query);
|
|
504
|
+
this.setListData(this.dataSource, this.fields, this.query, e);
|
|
486
505
|
}
|
|
487
506
|
}
|
|
488
507
|
/**
|
|
@@ -493,14 +512,6 @@ let DropDownBase = class DropDownBase extends Component {
|
|
|
493
512
|
getPersistData() {
|
|
494
513
|
return this.addOnPersist([]);
|
|
495
514
|
}
|
|
496
|
-
/**
|
|
497
|
-
* Sets the enabled state to DropDownBase.
|
|
498
|
-
*
|
|
499
|
-
* @returns {void}
|
|
500
|
-
*/
|
|
501
|
-
setEnabled() {
|
|
502
|
-
this.element.setAttribute('aria-disabled', (this.enabled) ? 'false' : 'true');
|
|
503
|
-
}
|
|
504
515
|
/**
|
|
505
516
|
* Sets the enabled state to DropDownBase.
|
|
506
517
|
*
|
|
@@ -508,7 +519,7 @@ let DropDownBase = class DropDownBase extends Component {
|
|
|
508
519
|
* @returns {void}
|
|
509
520
|
*/
|
|
510
521
|
updateDataAttribute(value) {
|
|
511
|
-
const invalidAttr = ['class', 'style', 'id', 'type'];
|
|
522
|
+
const invalidAttr = ['class', 'style', 'id', 'type', 'aria-expanded', 'aria-autocomplete', 'aria-readonly'];
|
|
512
523
|
const attr = {};
|
|
513
524
|
for (let a = 0; a < this.element.attributes.length; a++) {
|
|
514
525
|
if (invalidAttr.indexOf(this.element.attributes[a].name) === -1 &&
|
|
@@ -575,6 +586,8 @@ let DropDownBase = class DropDownBase extends Component {
|
|
|
575
586
|
this.isRequested = false;
|
|
576
587
|
this.isDataFetched = false;
|
|
577
588
|
this.itemTemplateId = `${this.element.id}${ITEMTEMPLATE_PROPERTY}`;
|
|
589
|
+
this.displayTemplateId = `${this.element.id}${DISPLAYTEMPLATE_PROPERTY}`;
|
|
590
|
+
this.spinnerTemplateId = `${this.element.id}${SPINNERTEMPLATE_PROPERTY}`;
|
|
578
591
|
this.valueTemplateId = `${this.element.id}${VALUETEMPLATE_PROPERTY}`;
|
|
579
592
|
this.groupTemplateId = `${this.element.id}${GROUPTEMPLATE_PROPERTY}`;
|
|
580
593
|
this.headerTemplateId = `${this.element.id}${HEADERTEMPLATE_PROPERTY}`;
|
|
@@ -589,7 +602,7 @@ let DropDownBase = class DropDownBase extends Component {
|
|
|
589
602
|
* @param {Query} query - Accepts the external Query that execute along with data processing.
|
|
590
603
|
* @returns {void}
|
|
591
604
|
*/
|
|
592
|
-
setListData(dataSource, fields, query) {
|
|
605
|
+
setListData(dataSource, fields, query, event) {
|
|
593
606
|
fields = fields ? fields : this.fields;
|
|
594
607
|
let ulElement;
|
|
595
608
|
this.isActive = true;
|
|
@@ -613,10 +626,10 @@ let DropDownBase = class DropDownBase extends Component {
|
|
|
613
626
|
this.isDataFetched = true;
|
|
614
627
|
}
|
|
615
628
|
ulElement = this.renderItems(listItems, fields);
|
|
629
|
+
this.onActionComplete(ulElement, listItems, e);
|
|
616
630
|
if (this.groupTemplate) {
|
|
617
631
|
this.renderGroupTemplate(ulElement);
|
|
618
632
|
}
|
|
619
|
-
this.onActionComplete(ulElement, listItems, e);
|
|
620
633
|
this.isRequested = false;
|
|
621
634
|
this.bindChildItems(listItems, ulElement, fields, e);
|
|
622
635
|
}
|
|
@@ -635,7 +648,7 @@ let DropDownBase = class DropDownBase extends Component {
|
|
|
635
648
|
this.trigger('actionComplete', localDataArgs, (localDataArgs) => {
|
|
636
649
|
if (!localDataArgs.cancel) {
|
|
637
650
|
ulElement = this.renderItems(localDataArgs.result, fields);
|
|
638
|
-
this.onActionComplete(ulElement, localDataArgs.result);
|
|
651
|
+
this.onActionComplete(ulElement, localDataArgs.result, event);
|
|
639
652
|
if (this.groupTemplate) {
|
|
640
653
|
this.renderGroupTemplate(ulElement);
|
|
641
654
|
}
|
|
@@ -717,7 +730,9 @@ let DropDownBase = class DropDownBase extends Component {
|
|
|
717
730
|
this.liCollections = [];
|
|
718
731
|
this.trigger('actionFailure', e);
|
|
719
732
|
this.l10nUpdate(true);
|
|
720
|
-
|
|
733
|
+
if (!isNullOrUndefined(this.list)) {
|
|
734
|
+
addClass([this.list], dropDownBaseClasses.noData);
|
|
735
|
+
}
|
|
721
736
|
}
|
|
722
737
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
723
738
|
onActionComplete(ulElement, list, e) {
|
|
@@ -844,18 +859,22 @@ let DropDownBase = class DropDownBase extends Component {
|
|
|
844
859
|
return extend({}, options, fields, true);
|
|
845
860
|
}
|
|
846
861
|
setFloatingHeader(e) {
|
|
847
|
-
if (isNullOrUndefined(this.
|
|
848
|
-
this.fixedHeaderElement
|
|
849
|
-
|
|
850
|
-
this.
|
|
862
|
+
if (!isNullOrUndefined(this.list) && !this.list.classList.contains(dropDownBaseClasses.noData)) {
|
|
863
|
+
if (isNullOrUndefined(this.fixedHeaderElement)) {
|
|
864
|
+
this.fixedHeaderElement = this.createElement('div', { className: dropDownBaseClasses.fixedHead });
|
|
865
|
+
if (!isNullOrUndefined(this.list) && !this.list.querySelector('li').classList.contains(dropDownBaseClasses.group)) {
|
|
866
|
+
this.fixedHeaderElement.style.display = 'none';
|
|
867
|
+
}
|
|
868
|
+
if (!isNullOrUndefined(this.fixedHeaderElement) && !isNullOrUndefined(this.list)) {
|
|
869
|
+
prepend([this.fixedHeaderElement], this.list);
|
|
870
|
+
}
|
|
871
|
+
this.setFixedHeader();
|
|
851
872
|
}
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
this.setFixedHeader();
|
|
873
|
+
if (!isNullOrUndefined(this.fixedHeaderElement) && this.fixedHeaderElement.style.zIndex === '0') {
|
|
874
|
+
this.setFixedHeader();
|
|
875
|
+
}
|
|
876
|
+
this.scrollStop(e);
|
|
857
877
|
}
|
|
858
|
-
this.scrollStop(e);
|
|
859
878
|
}
|
|
860
879
|
scrollStop(e) {
|
|
861
880
|
let target = !isNullOrUndefined(e) ? e.target : this.list;
|
|
@@ -939,7 +958,9 @@ let DropDownBase = class DropDownBase extends Component {
|
|
|
939
958
|
return item;
|
|
940
959
|
}
|
|
941
960
|
setFixedHeader() {
|
|
942
|
-
this.list
|
|
961
|
+
if (!isNullOrUndefined(this.list)) {
|
|
962
|
+
this.list.parentElement.style.display = 'block';
|
|
963
|
+
}
|
|
943
964
|
let borderWidth = 0;
|
|
944
965
|
if (this.list && this.list.parentElement) {
|
|
945
966
|
borderWidth = parseInt(document.defaultView.getComputedStyle(this.list.parentElement, null).getPropertyValue('border-width'), 10);
|
|
@@ -954,8 +975,10 @@ let DropDownBase = class DropDownBase extends Component {
|
|
|
954
975
|
borderWidth = (borderTopWidth + borderBottomWidth + borderLeftWidth + borderRightWidth);
|
|
955
976
|
}
|
|
956
977
|
}
|
|
957
|
-
|
|
958
|
-
|
|
978
|
+
if (!isNullOrUndefined(this.liCollections)) {
|
|
979
|
+
const liWidth = this.getValidLi().offsetWidth - borderWidth;
|
|
980
|
+
this.fixedHeaderElement.style.width = liWidth.toString() + 'px';
|
|
981
|
+
}
|
|
959
982
|
setStyleAttribute(this.fixedHeaderElement, { zIndex: 10 });
|
|
960
983
|
const firstLi = this.ulElement.querySelector('.' + dropDownBaseClasses.group + ':not(.e-hide-listitem)');
|
|
961
984
|
this.fixedHeaderElement.innerHTML = firstLi.innerHTML;
|
|
@@ -1024,7 +1047,7 @@ let DropDownBase = class DropDownBase extends Component {
|
|
|
1024
1047
|
* @param {Query} query - Accepts the external Query that execute along with data processing.
|
|
1025
1048
|
* @returns {void}
|
|
1026
1049
|
*/
|
|
1027
|
-
resetList(dataSource, fields, query) {
|
|
1050
|
+
resetList(dataSource, fields, query, e) {
|
|
1028
1051
|
if (this.list) {
|
|
1029
1052
|
if ((this.element.tagName === 'SELECT' && this.element.options.length > 0)
|
|
1030
1053
|
|| (this.element.tagName === 'UL' && this.element.childNodes.length > 0)) {
|
|
@@ -1034,8 +1057,9 @@ let DropDownBase = class DropDownBase extends Component {
|
|
|
1034
1057
|
dataSource = this.selectData;
|
|
1035
1058
|
}
|
|
1036
1059
|
}
|
|
1037
|
-
dataSource = this.getModuleName() === 'combobox' && this.selectData && dataSource instanceof Array && dataSource.length < this.selectData.length ? this.selectData : dataSource;
|
|
1038
|
-
this.
|
|
1060
|
+
dataSource = this.getModuleName() === 'combobox' && this.selectData && dataSource instanceof Array && dataSource.length < this.selectData.length && this.addedNewItem ? this.selectData : dataSource;
|
|
1061
|
+
this.addedNewItem = false;
|
|
1062
|
+
this.setListData(dataSource, fields, query, e);
|
|
1039
1063
|
}
|
|
1040
1064
|
}
|
|
1041
1065
|
updateSelectElementData(isFiltering) {
|
|
@@ -1097,9 +1121,6 @@ let DropDownBase = class DropDownBase extends Component {
|
|
|
1097
1121
|
case 'enableRtl':
|
|
1098
1122
|
this.setEnableRtl();
|
|
1099
1123
|
break;
|
|
1100
|
-
case 'enabled':
|
|
1101
|
-
this.setEnabled();
|
|
1102
|
-
break;
|
|
1103
1124
|
case 'groupTemplate':
|
|
1104
1125
|
this.renderGroupTemplate(this.list);
|
|
1105
1126
|
if (this.ulElement && this.fixedHeaderElement) {
|
|
@@ -1126,7 +1147,7 @@ let DropDownBase = class DropDownBase extends Component {
|
|
|
1126
1147
|
* @private
|
|
1127
1148
|
* @returns {void}
|
|
1128
1149
|
*/
|
|
1129
|
-
render(isEmptyData) {
|
|
1150
|
+
render(e, isEmptyData) {
|
|
1130
1151
|
this.list = this.createElement('div', { className: dropDownBaseClasses.content, attrs: { 'tabindex': '0' } });
|
|
1131
1152
|
this.list.classList.add(dropDownBaseClasses.root);
|
|
1132
1153
|
this.setFields();
|
|
@@ -1148,9 +1169,8 @@ let DropDownBase = class DropDownBase extends Component {
|
|
|
1148
1169
|
wrapperElement.appendChild(this.list);
|
|
1149
1170
|
}
|
|
1150
1171
|
this.setEnableRtl();
|
|
1151
|
-
this.setEnabled();
|
|
1152
1172
|
if (!isEmptyData) {
|
|
1153
|
-
this.initialize();
|
|
1173
|
+
this.initialize(e);
|
|
1154
1174
|
}
|
|
1155
1175
|
}
|
|
1156
1176
|
/**
|
|
@@ -1176,7 +1196,7 @@ let DropDownBase = class DropDownBase extends Component {
|
|
|
1176
1196
|
* Adds a new item to the popup list. By default, new item appends to the list as the last item,
|
|
1177
1197
|
* but you can insert based on the index parameter.
|
|
1178
1198
|
*
|
|
1179
|
-
* @param
|
|
1199
|
+
* @param { Object[] } items - Specifies an array of JSON data or a JSON data.
|
|
1180
1200
|
* @param { number } itemIndex - Specifies the index to place the newly added item in the popup list.
|
|
1181
1201
|
* @returns {void}
|
|
1182
1202
|
* @deprecated
|
|
@@ -1240,11 +1260,17 @@ let DropDownBase = class DropDownBase extends Component {
|
|
|
1240
1260
|
this.trigger('beforeItemRender', { element: li, item: item });
|
|
1241
1261
|
}
|
|
1242
1262
|
if (itemsCount === 0 && isNullOrUndefined(this.list.querySelector('ul'))) {
|
|
1243
|
-
this.list
|
|
1244
|
-
|
|
1245
|
-
|
|
1263
|
+
if (!isNullOrUndefined(this.list)) {
|
|
1264
|
+
this.list.innerHTML = '';
|
|
1265
|
+
this.list.classList.remove(dropDownBaseClasses.noData);
|
|
1266
|
+
if (!isNullOrUndefined(this.ulElement)) {
|
|
1267
|
+
this.list.appendChild(this.ulElement);
|
|
1268
|
+
}
|
|
1269
|
+
}
|
|
1246
1270
|
this.liCollections = liCollections;
|
|
1247
|
-
|
|
1271
|
+
if (!isNullOrUndefined(liCollections) && !isNullOrUndefined(this.ulElement)) {
|
|
1272
|
+
append(liCollections, this.ulElement);
|
|
1273
|
+
}
|
|
1248
1274
|
this.updateAddItemList(this.list, itemsCount);
|
|
1249
1275
|
}
|
|
1250
1276
|
else {
|
|
@@ -1291,6 +1317,7 @@ let DropDownBase = class DropDownBase extends Component {
|
|
|
1291
1317
|
if (selectedItemValue || itemIndex === 0) {
|
|
1292
1318
|
this.updateSelection();
|
|
1293
1319
|
}
|
|
1320
|
+
this.addedNewItem = true;
|
|
1294
1321
|
}
|
|
1295
1322
|
validationAttribute(target, hidden) {
|
|
1296
1323
|
const name = target.getAttribute('name') ? target.getAttribute('name') : target.getAttribute('id');
|
|
@@ -1362,15 +1389,17 @@ let DropDownBase = class DropDownBase extends Component {
|
|
|
1362
1389
|
}
|
|
1363
1390
|
detach(this.list);
|
|
1364
1391
|
}
|
|
1392
|
+
this.liCollections = null;
|
|
1393
|
+
this.ulElement = null;
|
|
1394
|
+
this.list = null;
|
|
1395
|
+
this.enableRtlElements = null;
|
|
1396
|
+
this.rippleFun = null;
|
|
1365
1397
|
super.destroy();
|
|
1366
1398
|
}
|
|
1367
1399
|
};
|
|
1368
1400
|
__decorate([
|
|
1369
1401
|
Complex({ text: null, value: null, iconCss: null, groupBy: null }, FieldSettings)
|
|
1370
1402
|
], DropDownBase.prototype, "fields", void 0);
|
|
1371
|
-
__decorate([
|
|
1372
|
-
Property(false)
|
|
1373
|
-
], DropDownBase.prototype, "enablePersistence", void 0);
|
|
1374
1403
|
__decorate([
|
|
1375
1404
|
Property(null)
|
|
1376
1405
|
], DropDownBase.prototype, "itemTemplate", void 0);
|
|
@@ -1386,9 +1415,6 @@ __decorate([
|
|
|
1386
1415
|
__decorate([
|
|
1387
1416
|
Property('None')
|
|
1388
1417
|
], DropDownBase.prototype, "sortOrder", void 0);
|
|
1389
|
-
__decorate([
|
|
1390
|
-
Property(true)
|
|
1391
|
-
], DropDownBase.prototype, "enabled", void 0);
|
|
1392
1418
|
__decorate([
|
|
1393
1419
|
Property([])
|
|
1394
1420
|
], DropDownBase.prototype, "dataSource", void 0);
|
|
@@ -1567,8 +1593,8 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
1567
1593
|
this.popupObj.setProperties({ 'zIndex': this.zIndex });
|
|
1568
1594
|
}
|
|
1569
1595
|
}
|
|
1570
|
-
renderList(isEmptyData) {
|
|
1571
|
-
super.render(isEmptyData);
|
|
1596
|
+
renderList(e, isEmptyData) {
|
|
1597
|
+
super.render(e, isEmptyData);
|
|
1572
1598
|
this.unWireListEvents();
|
|
1573
1599
|
this.wireListEvents();
|
|
1574
1600
|
}
|
|
@@ -1600,6 +1626,7 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
1600
1626
|
}
|
|
1601
1627
|
}
|
|
1602
1628
|
clearAll(e, properties) {
|
|
1629
|
+
this.previousItemData = (!isNullOrUndefined(this.itemData)) ? this.itemData : null;
|
|
1603
1630
|
if (isNullOrUndefined(properties) || (!isNullOrUndefined(properties) &&
|
|
1604
1631
|
(isNullOrUndefined(properties.dataSource) ||
|
|
1605
1632
|
(!(properties.dataSource instanceof DataManager) && properties.dataSource.length === 0)))) {
|
|
@@ -1625,14 +1652,18 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
1625
1652
|
}
|
|
1626
1653
|
else {
|
|
1627
1654
|
if (this.allowFiltering && this.getModuleName() !== 'autocomplete'
|
|
1628
|
-
&& !isNullOrUndefined(this.actionCompleteData.ulElement) && !isNullOrUndefined(this.actionCompleteData.list)) {
|
|
1655
|
+
&& !isNullOrUndefined(this.actionCompleteData.ulElement) && !isNullOrUndefined(this.actionCompleteData.list) && this.actionCompleteData.list.length > 0) {
|
|
1629
1656
|
this.onActionComplete(this.actionCompleteData.ulElement.cloneNode(true), this.actionCompleteData.list);
|
|
1630
1657
|
}
|
|
1631
1658
|
this.resetFocusElement();
|
|
1632
1659
|
}
|
|
1633
1660
|
}
|
|
1634
|
-
this.hiddenElement
|
|
1635
|
-
|
|
1661
|
+
if (!isNullOrUndefined(this.hiddenElement)) {
|
|
1662
|
+
this.hiddenElement.innerHTML = '';
|
|
1663
|
+
}
|
|
1664
|
+
if (!isNullOrUndefined(this.inputElement)) {
|
|
1665
|
+
this.inputElement.value = '';
|
|
1666
|
+
}
|
|
1636
1667
|
this.value = null;
|
|
1637
1668
|
this.itemData = null;
|
|
1638
1669
|
this.text = null;
|
|
@@ -1654,42 +1685,42 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
1654
1685
|
if (Object.keys(this.htmlAttributes).length) {
|
|
1655
1686
|
for (const htmlAttr of Object.keys(this.htmlAttributes)) {
|
|
1656
1687
|
if (htmlAttr === 'class') {
|
|
1657
|
-
const updatedClassValue = (this.htmlAttributes[htmlAttr].replace(/\s+/g, ' ')).trim();
|
|
1688
|
+
const updatedClassValue = (this.htmlAttributes[`${htmlAttr}`].replace(/\s+/g, ' ')).trim();
|
|
1658
1689
|
if (updatedClassValue !== '') {
|
|
1659
1690
|
addClass([this.inputWrapper.container], updatedClassValue.split(' '));
|
|
1660
1691
|
}
|
|
1661
1692
|
}
|
|
1662
|
-
else if (htmlAttr === 'disabled' && this.htmlAttributes[htmlAttr] === 'disabled') {
|
|
1693
|
+
else if (htmlAttr === 'disabled' && this.htmlAttributes[`${htmlAttr}`] === 'disabled') {
|
|
1663
1694
|
this.enabled = false;
|
|
1664
1695
|
this.setEnable();
|
|
1665
1696
|
}
|
|
1666
|
-
else if (htmlAttr === 'readonly' && !isNullOrUndefined(this.htmlAttributes[htmlAttr])) {
|
|
1697
|
+
else if (htmlAttr === 'readonly' && !isNullOrUndefined(this.htmlAttributes[`${htmlAttr}`])) {
|
|
1667
1698
|
this.readonly = true;
|
|
1668
1699
|
this.dataBind();
|
|
1669
1700
|
}
|
|
1670
1701
|
else if (htmlAttr === 'style') {
|
|
1671
|
-
this.inputWrapper.container.setAttribute('style', this.htmlAttributes[htmlAttr]);
|
|
1702
|
+
this.inputWrapper.container.setAttribute('style', this.htmlAttributes[`${htmlAttr}`]);
|
|
1672
1703
|
}
|
|
1673
1704
|
else {
|
|
1674
|
-
const defaultAttr = ['title', 'id', 'placeholder',
|
|
1675
|
-
'role', '
|
|
1705
|
+
const defaultAttr = ['title', 'id', 'placeholder',
|
|
1706
|
+
'role', 'autocomplete', 'autocapitalize', 'spellcheck', 'minlength', 'maxlength'];
|
|
1676
1707
|
const validateAttr = ['name', 'required'];
|
|
1677
1708
|
if (this.getModuleName() === 'autocomplete' || this.getModuleName() === 'combobox') {
|
|
1678
1709
|
defaultAttr.push('tabindex');
|
|
1679
1710
|
}
|
|
1680
1711
|
if (validateAttr.indexOf(htmlAttr) > -1 || htmlAttr.indexOf('data') === 0) {
|
|
1681
|
-
this.hiddenElement.setAttribute(htmlAttr, this.htmlAttributes[htmlAttr]);
|
|
1712
|
+
this.hiddenElement.setAttribute(htmlAttr, this.htmlAttributes[`${htmlAttr}`]);
|
|
1682
1713
|
}
|
|
1683
1714
|
else if (defaultAttr.indexOf(htmlAttr) > -1) {
|
|
1684
1715
|
if (htmlAttr === 'placeholder') {
|
|
1685
|
-
Input.setPlaceholder(this.htmlAttributes[htmlAttr], this.inputElement);
|
|
1716
|
+
Input.setPlaceholder(this.htmlAttributes[`${htmlAttr}`], this.inputElement);
|
|
1686
1717
|
}
|
|
1687
1718
|
else {
|
|
1688
|
-
this.inputElement.setAttribute(htmlAttr, this.htmlAttributes[htmlAttr]);
|
|
1719
|
+
this.inputElement.setAttribute(htmlAttr, this.htmlAttributes[`${htmlAttr}`]);
|
|
1689
1720
|
}
|
|
1690
1721
|
}
|
|
1691
1722
|
else {
|
|
1692
|
-
this.inputWrapper.container.setAttribute(htmlAttr, this.htmlAttributes[htmlAttr]);
|
|
1723
|
+
this.inputWrapper.container.setAttribute(htmlAttr, this.htmlAttributes[`${htmlAttr}`]);
|
|
1693
1724
|
}
|
|
1694
1725
|
}
|
|
1695
1726
|
}
|
|
@@ -1701,11 +1732,8 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
1701
1732
|
getAriaAttributes() {
|
|
1702
1733
|
return {
|
|
1703
1734
|
'aria-disabled': 'false',
|
|
1704
|
-
'aria-owns': this.element.id + '_options',
|
|
1705
1735
|
'role': 'combobox',
|
|
1706
|
-
'aria-haspopup': 'true',
|
|
1707
1736
|
'aria-expanded': 'false',
|
|
1708
|
-
'aria-activedescendant': 'null',
|
|
1709
1737
|
'aria-live': 'polite',
|
|
1710
1738
|
'aria-labelledby': this.hiddenElement.id
|
|
1711
1739
|
};
|
|
@@ -1748,7 +1776,7 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
1748
1776
|
}
|
|
1749
1777
|
}
|
|
1750
1778
|
targetElement() {
|
|
1751
|
-
return this.inputWrapper.container;
|
|
1779
|
+
return !isNullOrUndefined(this.inputWrapper) ? this.inputWrapper.container : null;
|
|
1752
1780
|
}
|
|
1753
1781
|
getNgDirective() {
|
|
1754
1782
|
return 'EJS-DROPDOWNLIST';
|
|
@@ -1906,7 +1934,7 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
1906
1934
|
}
|
|
1907
1935
|
}
|
|
1908
1936
|
unBindCommonEvent() {
|
|
1909
|
-
if (this.targetElement()) {
|
|
1937
|
+
if (!isNullOrUndefined(this.inputWrapper) && this.targetElement()) {
|
|
1910
1938
|
EventHandler.remove(this.targetElement(), 'blur', this.onBlurHandler);
|
|
1911
1939
|
}
|
|
1912
1940
|
const formElement = this.inputElement && closest(this.inputElement, 'form');
|
|
@@ -1936,9 +1964,11 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
1936
1964
|
* @returns {void}
|
|
1937
1965
|
*/
|
|
1938
1966
|
wireListEvents() {
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1967
|
+
if (!isNullOrUndefined(this.list)) {
|
|
1968
|
+
EventHandler.add(this.list, 'click', this.onMouseClick, this);
|
|
1969
|
+
EventHandler.add(this.list, 'mouseover', this.onMouseOver, this);
|
|
1970
|
+
EventHandler.add(this.list, 'mouseout', this.onMouseLeave, this);
|
|
1971
|
+
}
|
|
1942
1972
|
}
|
|
1943
1973
|
onSearch(e) {
|
|
1944
1974
|
if (e.charCode !== 32 && e.charCode !== 13) {
|
|
@@ -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,26 +2977,8 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
2933
2977
|
}
|
|
2934
2978
|
this.initial = false;
|
|
2935
2979
|
}
|
|
2936
|
-
else if (this.getModuleName() === 'autocomplete' && this.value
|
|
2937
|
-
|
|
2938
|
-
const checkValue = list.some((x) => x[checkFields] === this.value);
|
|
2939
|
-
let query = new Query();
|
|
2940
|
-
if (!checkValue) {
|
|
2941
|
-
new DataManager(this.dataSource).executeQuery(query.where(new Predicate(checkFields, 'equal', this.value)))
|
|
2942
|
-
.then((e) => {
|
|
2943
|
-
if (e.result.length > 0) {
|
|
2944
|
-
this.value = checkFields !== '' ? e.result[0][this.fields.value].toString() : e.result[0].toString();
|
|
2945
|
-
this.addItem(e.result, list.length);
|
|
2946
|
-
this.updateValues();
|
|
2947
|
-
}
|
|
2948
|
-
else {
|
|
2949
|
-
this.updateValues();
|
|
2950
|
-
}
|
|
2951
|
-
});
|
|
2952
|
-
}
|
|
2953
|
-
else {
|
|
2954
|
-
this.updateValues();
|
|
2955
|
-
}
|
|
2980
|
+
else if (this.getModuleName() === 'autocomplete' && this.value) {
|
|
2981
|
+
this.setInputValue();
|
|
2956
2982
|
}
|
|
2957
2983
|
if (this.getModuleName() !== 'autocomplete' && this.isFiltering() && !this.isTyped) {
|
|
2958
2984
|
if (!this.actionCompleteData.isUpdated || ((!this.isCustomFilter
|
|
@@ -2975,10 +3001,17 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
2975
3001
|
}
|
|
2976
3002
|
}
|
|
2977
3003
|
if (this.beforePopupOpen) {
|
|
2978
|
-
this.renderPopup();
|
|
3004
|
+
this.renderPopup(e);
|
|
2979
3005
|
}
|
|
2980
3006
|
}
|
|
2981
3007
|
}
|
|
3008
|
+
checkFieldValue(list, fieldValue) {
|
|
3009
|
+
let checkField = list;
|
|
3010
|
+
fieldValue.forEach((value) => {
|
|
3011
|
+
checkField = checkField[value];
|
|
3012
|
+
});
|
|
3013
|
+
return checkField;
|
|
3014
|
+
}
|
|
2982
3015
|
updateActionCompleteDataValues(ulElement, list) {
|
|
2983
3016
|
this.actionCompleteData = { ulElement: ulElement.cloneNode(true), list: list, isUpdated: true };
|
|
2984
3017
|
if (this.actionData.list !== this.actionCompleteData.list && this.actionCompleteData.ulElement && this.actionCompleteData.list) {
|
|
@@ -3045,7 +3078,7 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
3045
3078
|
removeClass(highlightedItem, dropDownListClasses.focus);
|
|
3046
3079
|
}
|
|
3047
3080
|
}
|
|
3048
|
-
renderPopup() {
|
|
3081
|
+
renderPopup(e) {
|
|
3049
3082
|
if (this.popupObj && document.body.contains(this.popupObj.element)) {
|
|
3050
3083
|
this.refreshPopup();
|
|
3051
3084
|
return;
|
|
@@ -3101,9 +3134,11 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
3101
3134
|
(this.isDropDownClick && this.getModuleName() === 'combobox')))) {
|
|
3102
3135
|
offsetValue = this.getOffsetValue(popupEle);
|
|
3103
3136
|
const firstItem = this.isEmptyList() ? this.list : this.liCollections[0];
|
|
3104
|
-
|
|
3105
|
-
parseInt(getComputedStyle(
|
|
3106
|
-
|
|
3137
|
+
if (!isNullOrUndefined(this.inputElement)) {
|
|
3138
|
+
left = -(parseInt(getComputedStyle(firstItem).textIndent, 10) -
|
|
3139
|
+
parseInt(getComputedStyle(this.inputElement).paddingLeft, 10) +
|
|
3140
|
+
parseInt(getComputedStyle(this.inputElement.parentElement).borderLeftWidth, 10));
|
|
3141
|
+
}
|
|
3107
3142
|
}
|
|
3108
3143
|
this.getFocusElement();
|
|
3109
3144
|
this.createPopup(popupEle, offsetValue, left);
|
|
@@ -3133,25 +3168,28 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
3133
3168
|
for (const element of scrollParentElements) {
|
|
3134
3169
|
EventHandler.add(element, 'scroll', this.scrollHandler, this);
|
|
3135
3170
|
}
|
|
3136
|
-
if (Browser.isDevice && this.isFilterLayout()) {
|
|
3137
|
-
EventHandler.add(this.list, 'scroll', this.listScroll, this);
|
|
3138
|
-
}
|
|
3139
3171
|
if (!isNullOrUndefined(this.list)) {
|
|
3140
3172
|
this.unWireListEvents();
|
|
3141
3173
|
this.wireListEvents();
|
|
3142
3174
|
}
|
|
3143
|
-
|
|
3175
|
+
this.selectedElementID = this.selectedLI ? this.selectedLI.id : null;
|
|
3176
|
+
attributes(this.targetElement(), { 'aria-expanded': 'true', 'aria-owns': this.inputElement.id + '_options' });
|
|
3177
|
+
this.inputElement.setAttribute('aria-expanded', 'true');
|
|
3144
3178
|
const inputParent = this.isFiltering() ? this.filterInput.parentElement : this.inputWrapper.container;
|
|
3145
3179
|
addClass([inputParent], [dropDownListClasses.inputFocus]);
|
|
3146
3180
|
const animModel = { name: 'FadeIn', duration: 100 };
|
|
3147
3181
|
this.beforePopupOpen = true;
|
|
3148
3182
|
const popupInstance = this.popupObj;
|
|
3149
|
-
const eventArgs = { popup: popupInstance, cancel: false, animation: animModel };
|
|
3183
|
+
const eventArgs = { popup: popupInstance, event: e, cancel: false, animation: animModel };
|
|
3150
3184
|
this.trigger('open', eventArgs, (eventArgs) => {
|
|
3151
3185
|
if (!eventArgs.cancel) {
|
|
3152
|
-
|
|
3186
|
+
if (!isNullOrUndefined(this.inputWrapper)) {
|
|
3187
|
+
addClass([this.inputWrapper.container], [dropDownListClasses.iconAnimation]);
|
|
3188
|
+
}
|
|
3153
3189
|
this.renderReactTemplates();
|
|
3154
|
-
|
|
3190
|
+
if (!isNullOrUndefined(this.popupObj)) {
|
|
3191
|
+
this.popupObj.show(new Animation(eventArgs.animation), (this.zIndex === 1000) ? this.element : null);
|
|
3192
|
+
}
|
|
3155
3193
|
}
|
|
3156
3194
|
else {
|
|
3157
3195
|
this.beforePopupOpen = false;
|
|
@@ -3208,6 +3246,12 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
3208
3246
|
const actionList = this.actionCompleteData && this.actionCompleteData.ulElement &&
|
|
3209
3247
|
this.actionCompleteData.ulElement.querySelector('li');
|
|
3210
3248
|
const ulElement = this.list.querySelector('ul li');
|
|
3249
|
+
if (!isNullOrUndefined(this.ulElement) && !isNullOrUndefined(this.ulElement.getElementsByClassName('e-item-focus')[0])) {
|
|
3250
|
+
attributes(this.targetElement(), { 'aria-activedescendant': this.ulElement.getElementsByClassName('e-item-focus')[0].id });
|
|
3251
|
+
}
|
|
3252
|
+
else if (!isNullOrUndefined(this.ulElement) && !isNullOrUndefined(this.ulElement.getElementsByClassName('e-active')[0])) {
|
|
3253
|
+
attributes(this.targetElement(), { 'aria-activedescendant': this.ulElement.getElementsByClassName('e-active')[0].id });
|
|
3254
|
+
}
|
|
3211
3255
|
if (this.isFiltering() && this.itemTemplate && (this.element.tagName === this.getNgDirective()) &&
|
|
3212
3256
|
(actionList && ulElement && actionList.textContent !== ulElement.textContent) &&
|
|
3213
3257
|
this.element.tagName !== 'EJS-COMBOBOX') {
|
|
@@ -3363,9 +3407,6 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
3363
3407
|
this.filterInput.value = this.typedString = '';
|
|
3364
3408
|
this.searchLists(null);
|
|
3365
3409
|
}
|
|
3366
|
-
listScroll() {
|
|
3367
|
-
this.filterInput.blur();
|
|
3368
|
-
}
|
|
3369
3410
|
setEleWidth(width) {
|
|
3370
3411
|
if (!isNullOrUndefined(width)) {
|
|
3371
3412
|
if (typeof width === 'number') {
|
|
@@ -3392,7 +3433,6 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
3392
3433
|
}
|
|
3393
3434
|
if (Browser.isDevice && this.isFilterLayout()) {
|
|
3394
3435
|
removeClass([document.body, this.popupObj.element], dropDownListClasses.popupFullScreen);
|
|
3395
|
-
EventHandler.remove(this.list, 'scroll', this.listScroll);
|
|
3396
3436
|
}
|
|
3397
3437
|
if (this.isFilterLayout()) {
|
|
3398
3438
|
if (!Browser.isDevice) {
|
|
@@ -3405,14 +3445,19 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
3405
3445
|
EventHandler.remove(this.backIconElement, 'click', this.clickOnBackIcon);
|
|
3406
3446
|
EventHandler.remove(this.clearIconElement, 'click', this.clearText);
|
|
3407
3447
|
}
|
|
3408
|
-
|
|
3409
|
-
|
|
3410
|
-
|
|
3411
|
-
|
|
3412
|
-
|
|
3448
|
+
if (!isNullOrUndefined(this.filterInput)) {
|
|
3449
|
+
EventHandler.remove(this.filterInput, 'input', this.onInput);
|
|
3450
|
+
EventHandler.remove(this.filterInput, 'keyup', this.onFilterUp);
|
|
3451
|
+
EventHandler.remove(this.filterInput, 'keydown', this.onFilterDown);
|
|
3452
|
+
EventHandler.remove(this.filterInput, 'blur', this.onBlurHandler);
|
|
3453
|
+
EventHandler.remove(this.filterInput, 'paste', this.pasteHandler);
|
|
3454
|
+
}
|
|
3413
3455
|
this.filterInput = null;
|
|
3414
3456
|
}
|
|
3415
3457
|
attributes(this.targetElement(), { 'aria-expanded': 'false' });
|
|
3458
|
+
this.inputElement.setAttribute('aria-expanded', 'false');
|
|
3459
|
+
this.targetElement().removeAttribute('aria-owns');
|
|
3460
|
+
this.targetElement().removeAttribute('aria-activedescendant');
|
|
3416
3461
|
this.inputWrapper.container.classList.remove(dropDownListClasses.iconAnimation);
|
|
3417
3462
|
if (this.isFiltering()) {
|
|
3418
3463
|
this.actionCompleteData.isUpdated = false;
|
|
@@ -3465,14 +3510,15 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
3465
3510
|
if (this.element.tagName === 'INPUT') {
|
|
3466
3511
|
this.inputElement = this.element;
|
|
3467
3512
|
if (isNullOrUndefined(this.inputElement.getAttribute('role'))) {
|
|
3468
|
-
this.inputElement.setAttribute('role', '
|
|
3513
|
+
this.inputElement.setAttribute('role', 'combobox');
|
|
3469
3514
|
}
|
|
3470
3515
|
if (isNullOrUndefined(this.inputElement.getAttribute('type'))) {
|
|
3471
3516
|
this.inputElement.setAttribute('type', 'text');
|
|
3472
3517
|
}
|
|
3518
|
+
this.inputElement.setAttribute('aria-expanded', 'false');
|
|
3473
3519
|
}
|
|
3474
3520
|
else {
|
|
3475
|
-
this.inputElement = this.createElement('input', { attrs: { role: '
|
|
3521
|
+
this.inputElement = this.createElement('input', { attrs: { role: 'combobox', type: 'text' } });
|
|
3476
3522
|
if (this.element.tagName !== this.getNgDirective()) {
|
|
3477
3523
|
this.element.style.display = 'none';
|
|
3478
3524
|
}
|
|
@@ -3483,6 +3529,9 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
3483
3529
|
if (!isNullOrUndefined(this.cssClass) && this.cssClass !== '') {
|
|
3484
3530
|
updatedCssClassValues = (this.cssClass.replace(/\s+/g, ' ')).trim();
|
|
3485
3531
|
}
|
|
3532
|
+
if (!isNullOrUndefined(closest(this.element, "fieldset")) && closest(this.element, "fieldset").disabled) {
|
|
3533
|
+
this.enabled = false;
|
|
3534
|
+
}
|
|
3486
3535
|
this.inputWrapper = Input.createInput({
|
|
3487
3536
|
element: this.inputElement,
|
|
3488
3537
|
buttons: this.isPopupButton() ? [dropDownListClasses.icon] : null,
|
|
@@ -3511,6 +3560,10 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
3511
3560
|
this.setFields();
|
|
3512
3561
|
this.inputWrapper.container.style.width = formatUnit(this.width);
|
|
3513
3562
|
this.inputWrapper.container.classList.add('e-ddl');
|
|
3563
|
+
Input.calculateWidth(this.inputElement, this.inputWrapper.container);
|
|
3564
|
+
if (!isNullOrUndefined(this.inputWrapper.buttons[0]) && this.inputWrapper.container.getElementsByClassName('e-float-text-content')[0] && this.floatLabelType !== 'Never') {
|
|
3565
|
+
this.inputWrapper.container.getElementsByClassName('e-float-text-content')[0].classList.add('e-icon');
|
|
3566
|
+
}
|
|
3514
3567
|
this.wireEvent();
|
|
3515
3568
|
this.tabIndex = this.element.hasAttribute('tabindex') ? this.element.getAttribute('tabindex') : '0';
|
|
3516
3569
|
this.element.removeAttribute('tabindex');
|
|
@@ -3521,6 +3574,9 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
3521
3574
|
attributes(this.targetElement(), this.getAriaAttributes());
|
|
3522
3575
|
this.updateDataAttribute(this.htmlAttributes);
|
|
3523
3576
|
this.setHTMLAttributes();
|
|
3577
|
+
if (this.targetElement() === this.inputElement) {
|
|
3578
|
+
this.inputElement.removeAttribute('aria-labelledby');
|
|
3579
|
+
}
|
|
3524
3580
|
if (this.value !== null || this.activeIndex !== null || this.text !== null) {
|
|
3525
3581
|
this.initValue();
|
|
3526
3582
|
}
|
|
@@ -3530,6 +3586,7 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
3530
3586
|
this.text = isNullOrUndefined(this.value) ? null : selectElement.options[selectElement.selectedIndex].textContent;
|
|
3531
3587
|
this.initValue();
|
|
3532
3588
|
}
|
|
3589
|
+
this.setEnabled();
|
|
3533
3590
|
this.preventTabIndex(this.element);
|
|
3534
3591
|
if (!this.enabled) {
|
|
3535
3592
|
this.targetElement().tabIndex = -1;
|
|
@@ -3551,12 +3608,22 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
3551
3608
|
if (this.element.hasAttribute('data-val')) {
|
|
3552
3609
|
this.element.setAttribute('data-val', 'false');
|
|
3553
3610
|
}
|
|
3611
|
+
const floatLabelElement = this.inputWrapper.container.getElementsByClassName('e-float-text')[0];
|
|
3612
|
+
if (!isNullOrUndefined(this.element.id) && this.element.id !== '' && !isNullOrUndefined(floatLabelElement)) {
|
|
3613
|
+
floatLabelElement.id = 'label_' + this.element.id.replace(/ /g, '_');
|
|
3614
|
+
attributes(this.inputElement, { 'aria-labelledby': floatLabelElement.id });
|
|
3615
|
+
}
|
|
3554
3616
|
this.renderComplete();
|
|
3555
3617
|
}
|
|
3556
3618
|
setFooterTemplate(popupEle) {
|
|
3557
3619
|
let compiledString;
|
|
3558
3620
|
if (this.footer) {
|
|
3559
|
-
this.
|
|
3621
|
+
if (this.isReact) {
|
|
3622
|
+
this.clearTemplate(['footerTemplate']);
|
|
3623
|
+
}
|
|
3624
|
+
else {
|
|
3625
|
+
this.footer.innerHTML = '';
|
|
3626
|
+
}
|
|
3560
3627
|
}
|
|
3561
3628
|
else {
|
|
3562
3629
|
this.footer = this.createElement('div');
|
|
@@ -3604,6 +3671,14 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
3604
3671
|
const contentEle = popupEle.querySelector('div.e-content');
|
|
3605
3672
|
popupEle.insertBefore(this.header, contentEle);
|
|
3606
3673
|
}
|
|
3674
|
+
/**
|
|
3675
|
+
* Sets the enabled state to DropDownBase.
|
|
3676
|
+
*
|
|
3677
|
+
* @returns {void}
|
|
3678
|
+
*/
|
|
3679
|
+
setEnabled() {
|
|
3680
|
+
this.element.setAttribute('aria-disabled', (this.enabled) ? 'false' : 'true');
|
|
3681
|
+
}
|
|
3607
3682
|
setOldText(text) {
|
|
3608
3683
|
this.text = text;
|
|
3609
3684
|
}
|
|
@@ -3690,6 +3765,7 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
3690
3765
|
break;
|
|
3691
3766
|
case 'width':
|
|
3692
3767
|
this.setEleWidth(newProp.width);
|
|
3768
|
+
Input.calculateWidth(this.inputElement, this.inputWrapper.container);
|
|
3693
3769
|
break;
|
|
3694
3770
|
case 'placeholder':
|
|
3695
3771
|
Input.setPlaceholder(newProp.placeholder, this.inputElement);
|
|
@@ -3707,6 +3783,7 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
3707
3783
|
break;
|
|
3708
3784
|
case 'cssClass':
|
|
3709
3785
|
this.setCssClass(newProp.cssClass, oldProp.cssClass);
|
|
3786
|
+
Input.calculateWidth(this.inputElement, this.inputWrapper.container);
|
|
3710
3787
|
break;
|
|
3711
3788
|
case 'enableRtl':
|
|
3712
3789
|
this.setEnableRtl();
|
|
@@ -3747,6 +3824,9 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
3747
3824
|
}
|
|
3748
3825
|
});
|
|
3749
3826
|
}
|
|
3827
|
+
else if (this.getModuleName() === 'autocomplete') {
|
|
3828
|
+
this.setInputValue(newProp, oldProp);
|
|
3829
|
+
}
|
|
3750
3830
|
else {
|
|
3751
3831
|
this.setOldText(oldProp.text);
|
|
3752
3832
|
}
|
|
@@ -3788,6 +3868,9 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
3788
3868
|
}
|
|
3789
3869
|
});
|
|
3790
3870
|
}
|
|
3871
|
+
else if (this.getModuleName() === 'autocomplete') {
|
|
3872
|
+
this.setInputValue(newProp, oldProp);
|
|
3873
|
+
}
|
|
3791
3874
|
else {
|
|
3792
3875
|
this.setOldValue(oldProp.value);
|
|
3793
3876
|
}
|
|
@@ -3847,6 +3930,9 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
3847
3930
|
case 'floatLabelType':
|
|
3848
3931
|
Input.removeFloating(this.inputWrapper);
|
|
3849
3932
|
Input.addFloating(this.inputElement, newProp.floatLabelType, this.placeholder, this.createElement);
|
|
3933
|
+
if (!isNullOrUndefined(this.inputWrapper.buttons[0]) && this.inputWrapper.container.getElementsByClassName('e-float-text-overflow')[0] && this.floatLabelType !== 'Never') {
|
|
3934
|
+
this.inputWrapper.container.getElementsByClassName('e-float-text-overflow')[0].classList.add('e-icon');
|
|
3935
|
+
}
|
|
3850
3936
|
break;
|
|
3851
3937
|
case 'showClearButton':
|
|
3852
3938
|
Input.setClearButton(newProp.showClearButton, this.inputElement, this.inputWrapper, null, this.createElement);
|
|
@@ -3900,6 +3986,8 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
3900
3986
|
removeClass([this.inputWrapper.container], ['e-readonly']);
|
|
3901
3987
|
}
|
|
3902
3988
|
}
|
|
3989
|
+
setInputValue(newProp, oldProp) {
|
|
3990
|
+
}
|
|
3903
3991
|
setCssClass(newClass, oldClass) {
|
|
3904
3992
|
if (!isNullOrUndefined(oldClass)) {
|
|
3905
3993
|
oldClass = (oldClass.replace(/\s+/g, ' ')).trim();
|
|
@@ -3926,7 +4014,7 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
3926
4014
|
*
|
|
3927
4015
|
* @returns {void}
|
|
3928
4016
|
*/
|
|
3929
|
-
showPopup() {
|
|
4017
|
+
showPopup(e) {
|
|
3930
4018
|
if (!this.enabled) {
|
|
3931
4019
|
return;
|
|
3932
4020
|
}
|
|
@@ -3946,11 +4034,11 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
3946
4034
|
}
|
|
3947
4035
|
else if (isNullOrUndefined(this.list) || !isUndefined(this.list) && (this.list.classList.contains(dropDownBaseClasses.noData) ||
|
|
3948
4036
|
this.list.querySelectorAll('.' + dropDownBaseClasses.li).length <= 0)) {
|
|
3949
|
-
this.renderList();
|
|
4037
|
+
this.renderList(e);
|
|
3950
4038
|
}
|
|
3951
|
-
this.invokeRenderPopup();
|
|
4039
|
+
this.invokeRenderPopup(e);
|
|
3952
4040
|
}
|
|
3953
|
-
invokeRenderPopup() {
|
|
4041
|
+
invokeRenderPopup(e) {
|
|
3954
4042
|
if (Browser.isDevice && this.isFilterLayout()) {
|
|
3955
4043
|
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
3956
4044
|
const proxy = this;
|
|
@@ -3959,10 +4047,9 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
3959
4047
|
};
|
|
3960
4048
|
history.pushState({}, '');
|
|
3961
4049
|
}
|
|
3962
|
-
if (!isNullOrUndefined(this.list.children[0]) || this.list.classList.contains(dropDownBaseClasses.noData)) {
|
|
3963
|
-
this.renderPopup();
|
|
4050
|
+
if (!isNullOrUndefined(this.list) && (!isNullOrUndefined(this.list.children[0]) || this.list.classList.contains(dropDownBaseClasses.noData))) {
|
|
4051
|
+
this.renderPopup(e);
|
|
3964
4052
|
}
|
|
3965
|
-
attributes(this.targetElement(), { 'aria-activedescendant': this.selectedLI ? this.selectedLI.id : null });
|
|
3966
4053
|
}
|
|
3967
4054
|
renderHightSearch() {
|
|
3968
4055
|
// update high light search
|
|
@@ -3976,7 +4063,9 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
3976
4063
|
hidePopup(e) {
|
|
3977
4064
|
/* eslint-enable valid-jsdoc, jsdoc/require-param */
|
|
3978
4065
|
if (this.isEscapeKey && this.getModuleName() === 'dropdownlist') {
|
|
3979
|
-
|
|
4066
|
+
if (!isNullOrUndefined(this.inputElement)) {
|
|
4067
|
+
Input.setValue(this.text, this.inputElement, this.floatLabelType, this.showClearButton);
|
|
4068
|
+
}
|
|
3980
4069
|
this.isEscapeKey = false;
|
|
3981
4070
|
if (!isNullOrUndefined(this.index)) {
|
|
3982
4071
|
const element = this.findListElement(this.ulElement, 'li', 'data-value', this.value);
|
|
@@ -4026,6 +4115,7 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
4026
4115
|
}
|
|
4027
4116
|
addClass([this.inputWrapper.container], [dropDownListClasses.inputFocus]);
|
|
4028
4117
|
this.onFocus(e);
|
|
4118
|
+
Input.calculateWidth(this.inputElement, this.inputWrapper.container);
|
|
4029
4119
|
}
|
|
4030
4120
|
/**
|
|
4031
4121
|
* Moves the focus from the component if the component is already focused.
|
|
@@ -4043,6 +4133,7 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
4043
4133
|
this.targetElement().blur();
|
|
4044
4134
|
}
|
|
4045
4135
|
removeClass([this.inputWrapper.container], [dropDownListClasses.inputFocus]);
|
|
4136
|
+
Input.calculateWidth(this.inputElement, this.inputWrapper.container);
|
|
4046
4137
|
}
|
|
4047
4138
|
/**
|
|
4048
4139
|
* Removes the component from the DOM and detaches all its related event handlers. Also it removes the attributes and classes.
|
|
@@ -4066,10 +4157,9 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
4066
4157
|
return;
|
|
4067
4158
|
}
|
|
4068
4159
|
if (this.inputElement) {
|
|
4069
|
-
const attrArray = ['readonly', 'aria-disabled', 'aria-
|
|
4070
|
-
'
|
|
4071
|
-
'aria-
|
|
4072
|
-
'autocapitalize', 'spellcheck', 'aria-autocomplete', 'aria-live', 'aria-describedby', 'aria-label'];
|
|
4160
|
+
const attrArray = ['readonly', 'aria-disabled', 'placeholder', 'aria-labelledby',
|
|
4161
|
+
'aria-expanded', 'autocomplete', 'aria-readonly', 'autocapitalize',
|
|
4162
|
+
'spellcheck', 'aria-autocomplete', 'aria-live', 'aria-describedby', 'aria-label'];
|
|
4073
4163
|
for (let i = 0; i < attrArray.length; i++) {
|
|
4074
4164
|
this.inputElement.removeAttribute(attrArray[i]);
|
|
4075
4165
|
}
|
|
@@ -4085,6 +4175,21 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
4085
4175
|
this.inputWrapper.container.parentElement.insertBefore(this.element, this.inputWrapper.container);
|
|
4086
4176
|
detach(this.inputWrapper.container);
|
|
4087
4177
|
}
|
|
4178
|
+
this.hiddenElement = null;
|
|
4179
|
+
this.inputWrapper = null;
|
|
4180
|
+
this.keyboardModule = null;
|
|
4181
|
+
this.ulElement = null;
|
|
4182
|
+
this.list = null;
|
|
4183
|
+
this.popupObj = null;
|
|
4184
|
+
this.rippleFun = null;
|
|
4185
|
+
this.selectedLI = null;
|
|
4186
|
+
this.liCollections = null;
|
|
4187
|
+
this.item = null;
|
|
4188
|
+
this.inputWrapper = null;
|
|
4189
|
+
this.footer = null;
|
|
4190
|
+
this.header = null;
|
|
4191
|
+
this.previousSelectedLI = null;
|
|
4192
|
+
this.valueTempElement = null;
|
|
4088
4193
|
super.destroy();
|
|
4089
4194
|
}
|
|
4090
4195
|
/* eslint-disable valid-jsdoc, jsdoc/require-returns-description */
|
|
@@ -4127,6 +4232,12 @@ __decorate$1([
|
|
|
4127
4232
|
__decorate$1([
|
|
4128
4233
|
Property('100%')
|
|
4129
4234
|
], DropDownList.prototype, "width", void 0);
|
|
4235
|
+
__decorate$1([
|
|
4236
|
+
Property(true)
|
|
4237
|
+
], DropDownList.prototype, "enabled", void 0);
|
|
4238
|
+
__decorate$1([
|
|
4239
|
+
Property(false)
|
|
4240
|
+
], DropDownList.prototype, "enablePersistence", void 0);
|
|
4130
4241
|
__decorate$1([
|
|
4131
4242
|
Property('300px')
|
|
4132
4243
|
], DropDownList.prototype, "popupHeight", void 0);
|
|
@@ -4288,6 +4399,9 @@ __decorate$2([
|
|
|
4288
4399
|
__decorate$2([
|
|
4289
4400
|
Property(null)
|
|
4290
4401
|
], Fields.prototype, "query", void 0);
|
|
4402
|
+
__decorate$2([
|
|
4403
|
+
Property('selectable')
|
|
4404
|
+
], Fields.prototype, "selectable", void 0);
|
|
4291
4405
|
__decorate$2([
|
|
4292
4406
|
Property('selected')
|
|
4293
4407
|
], Fields.prototype, "selected", void 0);
|
|
@@ -4336,6 +4450,8 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
4336
4450
|
this.selectedData = [];
|
|
4337
4451
|
this.filterDelayTime = 300;
|
|
4338
4452
|
this.isClicked = false;
|
|
4453
|
+
// Specifies if the checkAll method has been called
|
|
4454
|
+
this.isCheckAllCalled = false;
|
|
4339
4455
|
}
|
|
4340
4456
|
/**
|
|
4341
4457
|
* Get the properties to be maintained in the persisted state.
|
|
@@ -4463,7 +4579,7 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
4463
4579
|
this.updateDataAttribute();
|
|
4464
4580
|
this.setHTMLAttributes();
|
|
4465
4581
|
this.setAttributes();
|
|
4466
|
-
this.popupDiv = this.createElement('div', { className: CONTENT
|
|
4582
|
+
this.popupDiv = this.createElement('div', { className: CONTENT });
|
|
4467
4583
|
this.popupDiv.classList.add(DROPDOWN);
|
|
4468
4584
|
this.tree = this.createElement('div', { id: this.element.id + '_tree' });
|
|
4469
4585
|
this.popupDiv.appendChild(this.tree);
|
|
@@ -5083,7 +5199,12 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
5083
5199
|
temp = this.getOverflowVal(index);
|
|
5084
5200
|
data += temp;
|
|
5085
5201
|
temp = this.overFlowWrapper.innerHTML;
|
|
5086
|
-
this.
|
|
5202
|
+
if (this.enableHtmlSanitizer) {
|
|
5203
|
+
this.overFlowWrapper.innerText = data;
|
|
5204
|
+
}
|
|
5205
|
+
else {
|
|
5206
|
+
this.overFlowWrapper.innerHTML = data;
|
|
5207
|
+
}
|
|
5087
5208
|
wrapperleng = this.overFlowWrapper.offsetWidth;
|
|
5088
5209
|
overAllContainer = this.inputWrapper.offsetWidth;
|
|
5089
5210
|
if ((wrapperleng + downIconWidth + this.clearIconWidth) > overAllContainer) {
|
|
@@ -5253,7 +5374,7 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
5253
5374
|
if (isValid && this.value !== null && (this.value && this.value.length !== 0)) {
|
|
5254
5375
|
addClass([this.inputEle], CHIP_INPUT);
|
|
5255
5376
|
}
|
|
5256
|
-
else if (this.value === null || (this.value && this.value.length === 0)) {
|
|
5377
|
+
else if (this.value === null || (this.value && this.value.length === 0) || this.chipWrapper) {
|
|
5257
5378
|
addClass([this.chipWrapper], HIDEICON);
|
|
5258
5379
|
}
|
|
5259
5380
|
}
|
|
@@ -5308,6 +5429,7 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
5308
5429
|
frameSpan.classList.add(CHECK);
|
|
5309
5430
|
ariaState = 'true';
|
|
5310
5431
|
if (!this.isReverseUpdate) {
|
|
5432
|
+
this.isCheckAllCalled = true;
|
|
5311
5433
|
this.treeObj.checkAll();
|
|
5312
5434
|
if (!this.changeOnBlur) {
|
|
5313
5435
|
this.triggerChangeEvent(e);
|
|
@@ -5608,10 +5730,12 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
5608
5730
|
nodeSelected: this.onNodeSelected.bind(this),
|
|
5609
5731
|
nodeChecked: this.onNodeChecked.bind(this),
|
|
5610
5732
|
nodeChecking: this.beforeCheck.bind(this),
|
|
5733
|
+
nodeExpanded: this.onNodeExpanded.bind(this),
|
|
5611
5734
|
actionFailure: this.onActionFailure.bind(this),
|
|
5612
5735
|
nodeClicked: this.onNodeClicked.bind(this),
|
|
5613
5736
|
dataBound: this.OnDataBound.bind(this),
|
|
5614
5737
|
allowMultiSelection: this.allowMultiSelection,
|
|
5738
|
+
enableHtmlSanitizer: this.enableHtmlSanitizer,
|
|
5615
5739
|
showCheckBox: this.showCheckBox,
|
|
5616
5740
|
autoCheck: this.treeSettings.autoCheck,
|
|
5617
5741
|
sortOrder: this.sortOrder,
|
|
@@ -5713,7 +5837,7 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
5713
5837
|
const height = Math.round(this.header.getBoundingClientRect().height);
|
|
5714
5838
|
popupHeight = formatUnit(parseInt(popupHeight, 10) - height + 'px');
|
|
5715
5839
|
}
|
|
5716
|
-
if (this.showCheckBox && this.showSelectAll) {
|
|
5840
|
+
if (this.showCheckBox && this.showSelectAll && (!this.popupDiv.classList.contains(NODATA))) {
|
|
5717
5841
|
const height = Math.round(this.checkAllParent.getBoundingClientRect().height);
|
|
5718
5842
|
popupHeight = formatUnit(parseInt(popupHeight, 10) - height + 'px');
|
|
5719
5843
|
}
|
|
@@ -5795,14 +5919,14 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
5795
5919
|
const isFooter = closest(target, '.' + FOOTER);
|
|
5796
5920
|
const isScroller = target.classList.contains(DROPDOWN) ? true :
|
|
5797
5921
|
(matches(target, '.e-ddt .e-popup') || matches(target, '.e-ddt .e-treeview'));
|
|
5798
|
-
if ((this.isPopupOpen && (this.inputWrapper.contains(target) || isTree ||
|
|
5922
|
+
if ((this.isPopupOpen && (this.inputWrapper.contains(target) || isTree || isScroller || isHeader || isFooter)) ||
|
|
5799
5923
|
((this.allowMultiSelection || this.showCheckBox) && (this.isPopupOpen && target.classList.contains(CHIP_CLOSE) ||
|
|
5800
5924
|
(this.isPopupOpen && (target.classList.contains(CHECKALLPARENT) || target.classList.contains(ALLTEXT)
|
|
5801
5925
|
|| target.classList.contains(CHECKBOXFRAME)))))) {
|
|
5802
5926
|
this.isDocumentClick = false;
|
|
5803
5927
|
e.preventDefault();
|
|
5804
5928
|
}
|
|
5805
|
-
else if (!this.inputWrapper.contains(target) && this.inputFocus) {
|
|
5929
|
+
else if (!this.inputWrapper.contains(target) && this.inputFocus && !isFilter) {
|
|
5806
5930
|
this.focusOut(e);
|
|
5807
5931
|
}
|
|
5808
5932
|
}
|
|
@@ -5835,6 +5959,9 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
5835
5959
|
}
|
|
5836
5960
|
const eventArgs = { data: args.data };
|
|
5837
5961
|
this.trigger('dataBound', eventArgs);
|
|
5962
|
+
if (this.filterObj === null) {
|
|
5963
|
+
this.isFilteredData = false;
|
|
5964
|
+
}
|
|
5838
5965
|
if (this.isFilteredData) {
|
|
5839
5966
|
this.treeObj.expandAll();
|
|
5840
5967
|
}
|
|
@@ -5902,7 +6029,7 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
5902
6029
|
dataSource: fields.dataSource, value: fields.value, text: fields.text, parentValue: fields.parentValue,
|
|
5903
6030
|
child: this.cloneChildField(fields.child), hasChildren: fields.hasChildren, expanded: fields.expanded,
|
|
5904
6031
|
iconCss: fields.iconCss, imageUrl: fields.imageUrl, htmlAttributes: fields.htmlAttributes, query: fields.query,
|
|
5905
|
-
selected: fields.selected, tableName: fields.tableName, tooltip: fields.tooltip
|
|
6032
|
+
selected: fields.selected, selectable: fields.selectable, tableName: fields.tableName, tooltip: fields.tooltip
|
|
5906
6033
|
};
|
|
5907
6034
|
return clonedField;
|
|
5908
6035
|
}
|
|
@@ -5915,7 +6042,7 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
5915
6042
|
dataSource: fields.dataSource, value: fields.value, text: fields.text, parentValue: fields.parentValue,
|
|
5916
6043
|
child: (fields.child ? this.cloneChildField(fields.child) : null), hasChildren: fields.hasChildren,
|
|
5917
6044
|
expanded: fields.expanded, iconCss: fields.iconCss, imageUrl: fields.imageUrl, htmlAttributes: fields.htmlAttributes,
|
|
5918
|
-
query: fields.query, selected: fields.selected, tableName: fields.tableName, tooltip: fields.tooltip
|
|
6045
|
+
query: fields.query, selected: fields.selected, selectable: fields.selectable, tableName: fields.tableName, tooltip: fields.tooltip
|
|
5919
6046
|
};
|
|
5920
6047
|
return clonedField;
|
|
5921
6048
|
}
|
|
@@ -5925,7 +6052,7 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
5925
6052
|
dataSource: fields.dataSource, id: fields.value, text: fields.text, parentID: fields.parentValue,
|
|
5926
6053
|
child: this.getTreeChildren(fields.child), hasChildren: fields.hasChildren, expanded: fields.expanded,
|
|
5927
6054
|
iconCss: fields.iconCss, imageUrl: fields.imageUrl, isChecked: fields.selected,
|
|
5928
|
-
htmlAttributes: fields.htmlAttributes, query: fields.query, selected: fields.selected,
|
|
6055
|
+
htmlAttributes: fields.htmlAttributes, query: fields.query, selectable: fields.selectable, selected: fields.selected,
|
|
5929
6056
|
tableName: fields.tableName, tooltip: fields.tooltip
|
|
5930
6057
|
};
|
|
5931
6058
|
return treeFields;
|
|
@@ -6103,13 +6230,14 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
6103
6230
|
const nodes = this.treeObj.element.querySelectorAll('li');
|
|
6104
6231
|
const checkedNodes = this.treeObj.element.querySelectorAll('li .e-checkbox-wrapper[aria-checked=true]');
|
|
6105
6232
|
const wrap = closest(this.checkBoxElement, '.' + CHECKBOXWRAP);
|
|
6106
|
-
if (wrap && args.action === 'uncheck') {
|
|
6233
|
+
if (wrap && args.action === 'uncheck' && (args.isInteracted || checkedNodes.length === 0)) {
|
|
6107
6234
|
this.isReverseUpdate = true;
|
|
6108
6235
|
this.changeState(wrap, 'uncheck');
|
|
6109
6236
|
this.isReverseUpdate = false;
|
|
6110
6237
|
}
|
|
6111
|
-
else if (wrap && args.action === 'check' && checkedNodes.length === nodes.length) {
|
|
6238
|
+
else if (wrap && args.action === 'check' && checkedNodes.length === nodes.length && this.isCheckAllCalled) {
|
|
6112
6239
|
this.isReverseUpdate = true;
|
|
6240
|
+
this.isCheckAllCalled = false;
|
|
6113
6241
|
this.changeState(wrap, 'check');
|
|
6114
6242
|
this.isReverseUpdate = false;
|
|
6115
6243
|
}
|
|
@@ -6120,6 +6248,13 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
6120
6248
|
this.oldValue = this.value ? this.value.slice() : this.value;
|
|
6121
6249
|
}
|
|
6122
6250
|
}
|
|
6251
|
+
onNodeExpanded(args) {
|
|
6252
|
+
if (this.hasTemplate && this.portals) {
|
|
6253
|
+
this.portals = [].concat(this.treeObj.portals);
|
|
6254
|
+
/* eslint-enable */
|
|
6255
|
+
this.renderReactTemplates();
|
|
6256
|
+
}
|
|
6257
|
+
}
|
|
6123
6258
|
updateClearButton(state) {
|
|
6124
6259
|
if (state) {
|
|
6125
6260
|
if (!this.inputWrapper.contains(this.overAllClear)) {
|
|
@@ -6420,7 +6555,12 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
6420
6555
|
});
|
|
6421
6556
|
const chipContent = this.createElement('span', { className: CHIP_CONTENT });
|
|
6422
6557
|
const chipClose = this.createElement('span', { className: CHIP_CLOSE + ' ' + ICONS });
|
|
6423
|
-
|
|
6558
|
+
if (this.enableHtmlSanitizer) {
|
|
6559
|
+
chipContent.innerText = text;
|
|
6560
|
+
}
|
|
6561
|
+
else {
|
|
6562
|
+
chipContent.innerHTML = text;
|
|
6563
|
+
}
|
|
6424
6564
|
chip.appendChild(chipContent);
|
|
6425
6565
|
this.chipCollection.appendChild(chip);
|
|
6426
6566
|
if (this.showClearButton) {
|
|
@@ -6616,6 +6756,7 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
6616
6756
|
selectAllItems(state) {
|
|
6617
6757
|
if (this.showCheckBox) {
|
|
6618
6758
|
if (state) {
|
|
6759
|
+
this.isCheckAllCalled = true;
|
|
6619
6760
|
this.treeObj.checkAll();
|
|
6620
6761
|
}
|
|
6621
6762
|
else {
|
|
@@ -6710,8 +6851,6 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
6710
6851
|
}
|
|
6711
6852
|
else {
|
|
6712
6853
|
this.noRecord = this.createElement('div');
|
|
6713
|
-
addClass([this.noRecord], NODATACONTAINER);
|
|
6714
|
-
prepend([this.noRecord], this.popupDiv);
|
|
6715
6854
|
}
|
|
6716
6855
|
if (this.noRecordsTemplate !== 'No Records Found' || this.actionFailureTemplate !== 'The Request Failed') {
|
|
6717
6856
|
const template = actionFailure ? this.actionFailureTemplate : this.noRecordsTemplate;
|
|
@@ -6723,6 +6862,8 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
6723
6862
|
if (tempArr) {
|
|
6724
6863
|
tempArr = Array.prototype.slice.call(tempArr);
|
|
6725
6864
|
append(tempArr, this.noRecord);
|
|
6865
|
+
addClass([this.noRecord], NODATACONTAINER);
|
|
6866
|
+
prepend([this.noRecord], this.popupDiv);
|
|
6726
6867
|
}
|
|
6727
6868
|
}
|
|
6728
6869
|
else {
|
|
@@ -6731,6 +6872,8 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
6731
6872
|
this.l10n = new L10n(this.getLocaleName(), l10nLocale, this.locale);
|
|
6732
6873
|
this.noRecord.innerHTML = actionFailure ?
|
|
6733
6874
|
this.l10n.getConstant('actionFailureTemplate') : this.l10n.getConstant('noRecordsTemplate');
|
|
6875
|
+
addClass([this.noRecord], NODATACONTAINER);
|
|
6876
|
+
prepend([this.noRecord], this.popupDiv);
|
|
6734
6877
|
}
|
|
6735
6878
|
}
|
|
6736
6879
|
updateRecordTemplate(action) {
|
|
@@ -7242,6 +7385,9 @@ __decorate$2([
|
|
|
7242
7385
|
__decorate$2([
|
|
7243
7386
|
Property(false)
|
|
7244
7387
|
], DropDownTree.prototype, "showCheckBox", void 0);
|
|
7388
|
+
__decorate$2([
|
|
7389
|
+
Property(false)
|
|
7390
|
+
], DropDownTree.prototype, "enableHtmlSanitizer", void 0);
|
|
7245
7391
|
__decorate$2([
|
|
7246
7392
|
Property(true)
|
|
7247
7393
|
], DropDownTree.prototype, "showClearButton", void 0);
|
|
@@ -7479,15 +7625,12 @@ let ComboBox = class ComboBox extends DropDownList {
|
|
|
7479
7625
|
}
|
|
7480
7626
|
getAriaAttributes() {
|
|
7481
7627
|
const ariaAttributes = {
|
|
7482
|
-
'aria-owns': this.element.id + '_options',
|
|
7483
7628
|
'role': 'combobox',
|
|
7484
7629
|
'aria-autocomplete': 'both',
|
|
7485
7630
|
'aria-labelledby': this.hiddenElement.id,
|
|
7486
|
-
'aria-hasPopup': 'true',
|
|
7487
7631
|
'aria-expanded': 'false',
|
|
7488
7632
|
'aria-readonly': this.readonly.toString(),
|
|
7489
7633
|
'autocomplete': 'off',
|
|
7490
|
-
'autocorrect': 'off',
|
|
7491
7634
|
'autocapitalize': 'off',
|
|
7492
7635
|
'spellcheck': 'false'
|
|
7493
7636
|
};
|
|
@@ -7529,7 +7672,7 @@ let ComboBox = class ComboBox extends DropDownList {
|
|
|
7529
7672
|
}
|
|
7530
7673
|
getFocusElement() {
|
|
7531
7674
|
const dataItem = this.isSelectCustom ? { text: '' } : this.getItemData();
|
|
7532
|
-
const selected = this.list.querySelector('.' + dropDownListClasses.selected);
|
|
7675
|
+
const selected = !isNullOrUndefined(this.list) ? this.list.querySelector('.' + dropDownListClasses.selected) : this.list;
|
|
7533
7676
|
const isSelected = dataItem.text === this.inputElement.value && !isNullOrUndefined(selected);
|
|
7534
7677
|
if (isSelected) {
|
|
7535
7678
|
return selected;
|
|
@@ -7537,8 +7680,10 @@ let ComboBox = class ComboBox extends DropDownList {
|
|
|
7537
7680
|
if ((Browser.isDevice && !this.isDropDownClick || !Browser.isDevice) &&
|
|
7538
7681
|
!isNullOrUndefined(this.liCollections) && this.liCollections.length > 0) {
|
|
7539
7682
|
const inputValue = this.inputElement.value;
|
|
7540
|
-
const
|
|
7541
|
-
const
|
|
7683
|
+
const dataSource = this.sortedData;
|
|
7684
|
+
const type = this.typeOfData(dataSource).typeof;
|
|
7685
|
+
const activeItem = Search(inputValue, this.liCollections, this.filterType, true, dataSource, this.fields, type);
|
|
7686
|
+
var activeElement = activeItem.item;
|
|
7542
7687
|
if (!isNullOrUndefined(activeElement)) {
|
|
7543
7688
|
const count = this.getIndexByValue(activeElement.getAttribute('data-value')) - 1;
|
|
7544
7689
|
const height = parseInt(getComputedStyle(this.liCollections[0], null).getPropertyValue('height'), 10);
|
|
@@ -7578,7 +7723,7 @@ let ComboBox = class ComboBox extends DropDownList {
|
|
|
7578
7723
|
this.itemData = this.getDataByValue(this.value);
|
|
7579
7724
|
const dataItem = this.getItemData();
|
|
7580
7725
|
if (!(this.allowCustom && isNullOrUndefined(dataItem.value) && isNullOrUndefined(dataItem.text))) {
|
|
7581
|
-
this.setProperties({ 'value': dataItem.value
|
|
7726
|
+
this.setProperties({ 'value': dataItem.value }, !this.allowCustom);
|
|
7582
7727
|
}
|
|
7583
7728
|
}
|
|
7584
7729
|
/**
|
|
@@ -7687,9 +7832,11 @@ let ComboBox = class ComboBox extends DropDownList {
|
|
|
7687
7832
|
}
|
|
7688
7833
|
else if (this.inputElement.value === '') {
|
|
7689
7834
|
this.activeIndex = null;
|
|
7690
|
-
this.list
|
|
7691
|
-
|
|
7692
|
-
|
|
7835
|
+
if (!isNullOrUndefined(this.list)) {
|
|
7836
|
+
this.list.scrollTop = 0;
|
|
7837
|
+
const focusItem = this.list.querySelector('.' + dropDownListClasses.li);
|
|
7838
|
+
this.setHoverList(focusItem);
|
|
7839
|
+
}
|
|
7693
7840
|
}
|
|
7694
7841
|
else {
|
|
7695
7842
|
this.activeIndex = null;
|
|
@@ -7700,7 +7847,7 @@ let ComboBox = class ComboBox extends DropDownList {
|
|
|
7700
7847
|
}
|
|
7701
7848
|
}
|
|
7702
7849
|
incrementalSearch(e) {
|
|
7703
|
-
this.showPopup();
|
|
7850
|
+
this.showPopup(e);
|
|
7704
7851
|
if (!isNullOrUndefined(this.listData)) {
|
|
7705
7852
|
this.inlineSearch(e);
|
|
7706
7853
|
e.preventDefault();
|
|
@@ -7785,6 +7932,7 @@ let ComboBox = class ComboBox extends DropDownList {
|
|
|
7785
7932
|
this.preventFocus = false;
|
|
7786
7933
|
}
|
|
7787
7934
|
this.onFocus(e);
|
|
7935
|
+
Input.calculateWidth(this.inputElement, this.inputWrapper.container);
|
|
7788
7936
|
}
|
|
7789
7937
|
dropDownClick(e) {
|
|
7790
7938
|
e.preventDefault();
|
|
@@ -7934,7 +8082,7 @@ let ComboBox = class ComboBox extends DropDownList {
|
|
|
7934
8082
|
* Adds a new item to the combobox popup list. By default, new item appends to the list as the last item,
|
|
7935
8083
|
* but you can insert based on the index parameter.
|
|
7936
8084
|
*
|
|
7937
|
-
* @param
|
|
8085
|
+
* @param { Object[] } items - Specifies an array of JSON data or a JSON data.
|
|
7938
8086
|
* @param { number } itemIndex - Specifies the index to place the newly added item in the popup list.
|
|
7939
8087
|
* @returns {void}
|
|
7940
8088
|
* @deprecated
|
|
@@ -7945,9 +8093,9 @@ let ComboBox = class ComboBox extends DropDownList {
|
|
|
7945
8093
|
/**
|
|
7946
8094
|
* To filter the data from given data source by using query
|
|
7947
8095
|
*
|
|
7948
|
-
* @param
|
|
7949
|
-
* @param
|
|
7950
|
-
* @param
|
|
8096
|
+
* @param {Object[] | DataManager } dataSource - Set the data source to filter.
|
|
8097
|
+
* @param {Query} query - Specify the query to filter the data.
|
|
8098
|
+
* @param {FieldSettingsModel} fields - Specify the fields to map the column in the data table.
|
|
7951
8099
|
* @returns {void}
|
|
7952
8100
|
* @deprecated
|
|
7953
8101
|
*/
|
|
@@ -7960,8 +8108,8 @@ let ComboBox = class ComboBox extends DropDownList {
|
|
|
7960
8108
|
* @returns {void}
|
|
7961
8109
|
* @deprecated
|
|
7962
8110
|
*/
|
|
7963
|
-
showPopup() {
|
|
7964
|
-
super.showPopup();
|
|
8111
|
+
showPopup(e) {
|
|
8112
|
+
super.showPopup(e);
|
|
7965
8113
|
}
|
|
7966
8114
|
/* eslint-disable valid-jsdoc, jsdoc/require-param */
|
|
7967
8115
|
/**
|
|
@@ -7984,7 +8132,7 @@ let ComboBox = class ComboBox extends DropDownList {
|
|
|
7984
8132
|
this.removeFillSelection();
|
|
7985
8133
|
}
|
|
7986
8134
|
const dataItem = this.isSelectCustom ? { text: '' } : this.getItemData();
|
|
7987
|
-
const selected = this.list.querySelector('.' + dropDownListClasses.selected);
|
|
8135
|
+
const selected = !isNullOrUndefined(this.list) ? this.list.querySelector('.' + dropDownListClasses.selected) : null;
|
|
7988
8136
|
if (this.inputElement && dataItem.text === this.inputElement.value && !isNullOrUndefined(selected)) {
|
|
7989
8137
|
if (this.isSelected) {
|
|
7990
8138
|
this.onChangeEvent(e);
|
|
@@ -7994,10 +8142,12 @@ let ComboBox = class ComboBox extends DropDownList {
|
|
|
7994
8142
|
return;
|
|
7995
8143
|
}
|
|
7996
8144
|
if (this.getModuleName() === 'combobox' && this.inputElement.value.trim() !== '') {
|
|
7997
|
-
const
|
|
8145
|
+
const dataSource = this.sortedData;
|
|
8146
|
+
const type = this.typeOfData(dataSource).typeof;
|
|
8147
|
+
const searchItem = Search(this.inputElement.value, this.liCollections, 'Equal', true, dataSource, this.fields, type);
|
|
7998
8148
|
this.selectedLI = searchItem.item;
|
|
7999
8149
|
if (isNullOrUndefined(searchItem.index)) {
|
|
8000
|
-
searchItem.index = Search(this.inputElement.value, this.liCollections, 'StartsWith', true).index;
|
|
8150
|
+
searchItem.index = Search(this.inputElement.value, this.liCollections, 'StartsWith', true, dataSource, this.fields, type).index;
|
|
8001
8151
|
}
|
|
8002
8152
|
this.activeIndex = searchItem.index;
|
|
8003
8153
|
if (!isNullOrUndefined(this.selectedLI)) {
|
|
@@ -8236,13 +8386,13 @@ let AutoComplete = class AutoComplete extends ComboBox {
|
|
|
8236
8386
|
this.isTyped = true;
|
|
8237
8387
|
this.isDataFetched = this.isSelectCustom = false;
|
|
8238
8388
|
if (isNullOrUndefined(this.list)) {
|
|
8239
|
-
super.renderList(true);
|
|
8389
|
+
super.renderList(e, true);
|
|
8240
8390
|
}
|
|
8241
8391
|
this.queryString = this.filterInput.value;
|
|
8242
8392
|
if (e.type !== 'mousedown' && (e.keyCode === 40 || e.keyCode === 38)) {
|
|
8243
8393
|
this.queryString = this.queryString === '' ? null : this.queryString;
|
|
8244
8394
|
this.beforePopupOpen = true;
|
|
8245
|
-
this.resetList(this.dataSource, this.fields);
|
|
8395
|
+
this.resetList(this.dataSource, this.fields, null, e);
|
|
8246
8396
|
return;
|
|
8247
8397
|
}
|
|
8248
8398
|
this.isSelected = false;
|
|
@@ -8262,16 +8412,16 @@ let AutoComplete = class AutoComplete extends ComboBox {
|
|
|
8262
8412
|
this.trigger('filtering', eventArgs, (eventArgs) => {
|
|
8263
8413
|
if (!eventArgs.cancel && !this.isFiltered && !eventArgs.preventDefaultAction) {
|
|
8264
8414
|
this.searchList = true;
|
|
8265
|
-
this.filterAction(this.dataSource, null, this.fields);
|
|
8415
|
+
this.filterAction(this.dataSource, null, this.fields, e);
|
|
8266
8416
|
}
|
|
8267
8417
|
});
|
|
8268
8418
|
}
|
|
8269
8419
|
/**
|
|
8270
8420
|
* To filter the data from given data source by using query
|
|
8271
8421
|
*
|
|
8272
|
-
* @param
|
|
8273
|
-
* @param
|
|
8274
|
-
* @param
|
|
8422
|
+
* @param {Object[] | DataManager } dataSource - Set the data source to filter.
|
|
8423
|
+
* @param {Query} query - Specify the query to filter the data.
|
|
8424
|
+
* @param {FieldSettingsModel} fields - Specify the fields to map the column in the data table.
|
|
8275
8425
|
* @returns {void}
|
|
8276
8426
|
* @deprecated
|
|
8277
8427
|
*/
|
|
@@ -8279,13 +8429,13 @@ let AutoComplete = class AutoComplete extends ComboBox {
|
|
|
8279
8429
|
this.isFiltered = true;
|
|
8280
8430
|
this.filterAction(dataSource, query, fields);
|
|
8281
8431
|
}
|
|
8282
|
-
filterAction(dataSource, query, fields) {
|
|
8432
|
+
filterAction(dataSource, query, fields, e) {
|
|
8283
8433
|
this.beforePopupOpen = true;
|
|
8284
8434
|
if (this.queryString !== '' && (this.queryString.length >= this.minLength)) {
|
|
8285
|
-
this.resetList(dataSource, fields, query);
|
|
8435
|
+
this.resetList(dataSource, fields, query, e);
|
|
8286
8436
|
}
|
|
8287
8437
|
else {
|
|
8288
|
-
this.hidePopup();
|
|
8438
|
+
this.hidePopup(e);
|
|
8289
8439
|
this.beforePopupOpen = false;
|
|
8290
8440
|
}
|
|
8291
8441
|
this.renderReactTemplates();
|
|
@@ -8311,7 +8461,9 @@ let AutoComplete = class AutoComplete extends ComboBox {
|
|
|
8311
8461
|
postBackAction() {
|
|
8312
8462
|
if (this.autofill && !isNullOrUndefined(this.liCollections[0]) && this.searchList) {
|
|
8313
8463
|
const items = [this.liCollections[0]];
|
|
8314
|
-
const
|
|
8464
|
+
const dataSource = this.listData;
|
|
8465
|
+
const type = this.typeOfData(dataSource).typeof;
|
|
8466
|
+
const searchItem = Search(this.inputElement.value, items, 'StartsWith', this.ignoreCase, dataSource, this.fields, type);
|
|
8315
8467
|
this.searchList = false;
|
|
8316
8468
|
if (!isNullOrUndefined(searchItem.item)) {
|
|
8317
8469
|
super.setAutoFill(this.liCollections[0], true);
|
|
@@ -8320,6 +8472,7 @@ let AutoComplete = class AutoComplete extends ComboBox {
|
|
|
8320
8472
|
}
|
|
8321
8473
|
setSelection(li, e) {
|
|
8322
8474
|
if (!this.isValidLI(li)) {
|
|
8475
|
+
this.selectedLI = li;
|
|
8323
8476
|
return;
|
|
8324
8477
|
}
|
|
8325
8478
|
if (!isNullOrUndefined(e) && e.type === 'keydown' && e.action !== 'enter'
|
|
@@ -8335,7 +8488,6 @@ let AutoComplete = class AutoComplete extends ComboBox {
|
|
|
8335
8488
|
e.action === 'home' || e.action === 'end' || e.action === 'pageUp' || e.action === 'pageDown');
|
|
8336
8489
|
super.setAutoFill(li, isKeyNavigate);
|
|
8337
8490
|
}
|
|
8338
|
-
attributes(this.inputElement, { 'aria-activedescendant': this.selectedLI ? this.selectedLI.id : null });
|
|
8339
8491
|
}
|
|
8340
8492
|
else {
|
|
8341
8493
|
super.setSelection(li, e);
|
|
@@ -8371,9 +8523,9 @@ let AutoComplete = class AutoComplete extends ComboBox {
|
|
|
8371
8523
|
isFiltering() {
|
|
8372
8524
|
return true;
|
|
8373
8525
|
}
|
|
8374
|
-
renderPopup() {
|
|
8526
|
+
renderPopup(e) {
|
|
8375
8527
|
this.list.scrollTop = 0;
|
|
8376
|
-
super.renderPopup();
|
|
8528
|
+
super.renderPopup(e);
|
|
8377
8529
|
}
|
|
8378
8530
|
isEditTextBox() {
|
|
8379
8531
|
return true && this.inputElement.value.trim() !== '';
|
|
@@ -8385,13 +8537,37 @@ let AutoComplete = class AutoComplete extends ComboBox {
|
|
|
8385
8537
|
isSelectFocusItem(element) {
|
|
8386
8538
|
return false;
|
|
8387
8539
|
}
|
|
8540
|
+
setInputValue(newProp, oldProp) {
|
|
8541
|
+
let oldValue = oldProp && oldProp.text ? oldProp.text : oldProp ? oldProp.value : oldProp;
|
|
8542
|
+
let value = newProp && newProp.text ? newProp.text : newProp && newProp.value ? newProp.value : this.value;
|
|
8543
|
+
if (value && this.typedString === '' && !this.allowCustom && !(this.dataSource instanceof DataManager)) {
|
|
8544
|
+
let checkFields_1 = this.typeOfData(this.dataSource).typeof === 'string' ? '' : this.fields.value;
|
|
8545
|
+
const listLength = this.getItems().length;
|
|
8546
|
+
let query = new Query();
|
|
8547
|
+
let _this = this;
|
|
8548
|
+
new DataManager(this.dataSource).executeQuery(query.where(new Predicate(checkFields_1, 'equal', value)))
|
|
8549
|
+
.then(function (e) {
|
|
8550
|
+
if (e.result.length > 0) {
|
|
8551
|
+
_this.value = checkFields_1 !== '' ? e.result[0][_this.fields.value].toString() : e.result[0].toString();
|
|
8552
|
+
_this.addItem(e.result, listLength);
|
|
8553
|
+
_this.updateValues();
|
|
8554
|
+
}
|
|
8555
|
+
else {
|
|
8556
|
+
newProp && newProp.text ? _this.setOldText(oldValue) : newProp && newProp.value ? _this.setOldValue(oldValue) : _this.updateValues();
|
|
8557
|
+
}
|
|
8558
|
+
});
|
|
8559
|
+
}
|
|
8560
|
+
else if (newProp) {
|
|
8561
|
+
newProp.text ? this.setOldText(oldValue) : this.setOldValue(oldValue);
|
|
8562
|
+
}
|
|
8563
|
+
}
|
|
8388
8564
|
/**
|
|
8389
8565
|
* Search the entered text and show it in the suggestion list if available.
|
|
8390
8566
|
*
|
|
8391
8567
|
* @returns {void}
|
|
8392
8568
|
* @deprecated
|
|
8393
8569
|
*/
|
|
8394
|
-
showPopup() {
|
|
8570
|
+
showPopup(e) {
|
|
8395
8571
|
if (!this.enabled) {
|
|
8396
8572
|
return;
|
|
8397
8573
|
}
|
|
@@ -8402,10 +8578,10 @@ let AutoComplete = class AutoComplete extends ComboBox {
|
|
|
8402
8578
|
this.beforePopupOpen = true;
|
|
8403
8579
|
this.preventAutoFill = true;
|
|
8404
8580
|
if (isNullOrUndefined(this.list)) {
|
|
8405
|
-
this.renderList();
|
|
8581
|
+
this.renderList(e);
|
|
8406
8582
|
}
|
|
8407
8583
|
else {
|
|
8408
|
-
this.resetList(this.dataSource, this.fields);
|
|
8584
|
+
this.resetList(this.dataSource, this.fields, null, e);
|
|
8409
8585
|
}
|
|
8410
8586
|
}
|
|
8411
8587
|
/**
|
|
@@ -8435,6 +8611,10 @@ let AutoComplete = class AutoComplete extends ComboBox {
|
|
|
8435
8611
|
if (this.showPopupButton) {
|
|
8436
8612
|
const button = Input.appendSpan(dropDownListClasses.icon, this.inputWrapper.container, this.createElement);
|
|
8437
8613
|
this.inputWrapper.buttons[0] = button;
|
|
8614
|
+
Input.calculateWidth(this.inputElement, this.inputWrapper.container);
|
|
8615
|
+
if (!isNullOrUndefined(this.inputWrapper.buttons[0]) && !isNullOrUndefined(this.inputWrapper.container.getElementsByClassName('e-float-text-overflow')[0]) && this.floatLabelType !== 'Never') {
|
|
8616
|
+
this.inputWrapper.container.getElementsByClassName('e-float-text-overflow')[0].classList.add('e-icon');
|
|
8617
|
+
}
|
|
8438
8618
|
if (this.inputWrapper && this.inputWrapper.buttons && this.inputWrapper.buttons[0]) {
|
|
8439
8619
|
EventHandler.add(this.inputWrapper.buttons[0], 'click', this.dropDownClick, this);
|
|
8440
8620
|
}
|
|
@@ -8562,9 +8742,11 @@ const LABELBOTTOM = 'e-label-bottom';
|
|
|
8562
8742
|
function createFloatLabel(overAllWrapper, searchWrapper, element, inputElement, value, floatLabelType, placeholder) {
|
|
8563
8743
|
const floatLinelement = createElement('span', { className: FLOATLINE });
|
|
8564
8744
|
const floatLabelElement = createElement('label', { className: FLOATTEXT });
|
|
8745
|
+
const id = element.getAttribute('id') ? element.getAttribute('id') : getUniqueID('ej2_multiselect');
|
|
8746
|
+
element.id = id;
|
|
8565
8747
|
if (!isNullOrUndefined(element.id) && element.id !== '') {
|
|
8566
8748
|
floatLabelElement.id = 'label_' + element.id.replace(/ /g, '_');
|
|
8567
|
-
attributes(
|
|
8749
|
+
attributes(inputElement, { 'aria-labelledby': floatLabelElement.id });
|
|
8568
8750
|
}
|
|
8569
8751
|
if (!isNullOrUndefined(inputElement.placeholder) && inputElement.placeholder !== '') {
|
|
8570
8752
|
floatLabelElement.innerText = encodePlaceholder(inputElement.placeholder);
|
|
@@ -8768,6 +8950,8 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
8768
8950
|
this.isValidKey = false;
|
|
8769
8951
|
this.selectAllEventData = [];
|
|
8770
8952
|
this.selectAllEventEle = [];
|
|
8953
|
+
this.resetMainList = null;
|
|
8954
|
+
this.resetFilteredData = false;
|
|
8771
8955
|
this.scrollFocusStatus = false;
|
|
8772
8956
|
this.keyDownStatus = false;
|
|
8773
8957
|
}
|
|
@@ -8808,7 +8992,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
8808
8992
|
for (const htmlAttr of Object.keys(this.htmlAttributes)) {
|
|
8809
8993
|
switch (htmlAttr) {
|
|
8810
8994
|
case 'class': {
|
|
8811
|
-
const updatedClassValue = (this.htmlAttributes[htmlAttr].replace(/\s+/g, ' ')).trim();
|
|
8995
|
+
const updatedClassValue = (this.htmlAttributes[`${htmlAttr}`].replace(/\s+/g, ' ')).trim();
|
|
8812
8996
|
if (updatedClassValue !== '') {
|
|
8813
8997
|
addClass([this.overAllWrapper], updatedClassValue.split(' '));
|
|
8814
8998
|
addClass([this.popupWrapper], updatedClassValue.split(' '));
|
|
@@ -8820,7 +9004,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
8820
9004
|
break;
|
|
8821
9005
|
case 'placeholder':
|
|
8822
9006
|
if (!this.placeholder) {
|
|
8823
|
-
this.inputElement.setAttribute(htmlAttr, this.htmlAttributes[htmlAttr]);
|
|
9007
|
+
this.inputElement.setAttribute(htmlAttr, this.htmlAttributes[`${htmlAttr}`]);
|
|
8824
9008
|
this.setProperties({ placeholder: this.inputElement.placeholder }, true);
|
|
8825
9009
|
this.refreshPlaceHolder();
|
|
8826
9010
|
}
|
|
@@ -8830,16 +9014,16 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
8830
9014
|
const validateAttr = ['name', 'required', 'aria-required', 'form'];
|
|
8831
9015
|
const containerAttr = ['title', 'role', 'style', 'class'];
|
|
8832
9016
|
if (defaultAttr.indexOf(htmlAttr) > -1) {
|
|
8833
|
-
this.element.setAttribute(htmlAttr, this.htmlAttributes[htmlAttr]);
|
|
9017
|
+
this.element.setAttribute(htmlAttr, this.htmlAttributes[`${htmlAttr}`]);
|
|
8834
9018
|
}
|
|
8835
9019
|
else if (htmlAttr.indexOf('data') === 0 || validateAttr.indexOf(htmlAttr) > -1) {
|
|
8836
|
-
this.hiddenElement.setAttribute(htmlAttr, this.htmlAttributes[htmlAttr]);
|
|
9020
|
+
this.hiddenElement.setAttribute(htmlAttr, this.htmlAttributes[`${htmlAttr}`]);
|
|
8837
9021
|
}
|
|
8838
9022
|
else if (containerAttr.indexOf(htmlAttr) > -1) {
|
|
8839
|
-
this.overAllWrapper.setAttribute(htmlAttr, this.htmlAttributes[htmlAttr]);
|
|
9023
|
+
this.overAllWrapper.setAttribute(htmlAttr, this.htmlAttributes[`${htmlAttr}`]);
|
|
8840
9024
|
}
|
|
8841
|
-
else if (htmlAttr !== 'size') {
|
|
8842
|
-
this.inputElement.setAttribute(htmlAttr, this.htmlAttributes[htmlAttr]);
|
|
9025
|
+
else if (htmlAttr !== 'size' && !isNullOrUndefined(this.inputElement)) {
|
|
9026
|
+
this.inputElement.setAttribute(htmlAttr, this.htmlAttributes[`${htmlAttr}`]);
|
|
8843
9027
|
}
|
|
8844
9028
|
break;
|
|
8845
9029
|
}
|
|
@@ -8848,11 +9032,13 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
8848
9032
|
}
|
|
8849
9033
|
}
|
|
8850
9034
|
updateReadonly(state) {
|
|
8851
|
-
if (
|
|
8852
|
-
this.
|
|
8853
|
-
|
|
8854
|
-
|
|
8855
|
-
|
|
9035
|
+
if (!isNullOrUndefined(this.inputElement)) {
|
|
9036
|
+
if (state || this.mode === 'CheckBox') {
|
|
9037
|
+
this.inputElement.setAttribute('readonly', 'true');
|
|
9038
|
+
}
|
|
9039
|
+
else {
|
|
9040
|
+
this.inputElement.removeAttribute('readonly');
|
|
9041
|
+
}
|
|
8856
9042
|
}
|
|
8857
9043
|
}
|
|
8858
9044
|
updateClearButton(state) {
|
|
@@ -8889,7 +9075,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
8889
9075
|
}
|
|
8890
9076
|
}
|
|
8891
9077
|
}
|
|
8892
|
-
onPopupShown() {
|
|
9078
|
+
onPopupShown(e) {
|
|
8893
9079
|
if (Browser.isDevice && (this.mode === 'CheckBox' && this.allowFiltering)) {
|
|
8894
9080
|
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
8895
9081
|
const proxy = this;
|
|
@@ -8900,7 +9086,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
8900
9086
|
history.pushState({}, '');
|
|
8901
9087
|
}
|
|
8902
9088
|
const animModel = { name: 'FadeIn', duration: 100 };
|
|
8903
|
-
const eventArgs = { popup: this.popupObj, cancel: false, animation: animModel };
|
|
9089
|
+
const eventArgs = { popup: this.popupObj, event: e, cancel: false, animation: animModel };
|
|
8904
9090
|
this.trigger('open', eventArgs, (eventArgs) => {
|
|
8905
9091
|
if (!eventArgs.cancel) {
|
|
8906
9092
|
this.focusAtFirstListItem();
|
|
@@ -8914,7 +9100,8 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
8914
9100
|
this.refreshPopup();
|
|
8915
9101
|
this.renderReactTemplates();
|
|
8916
9102
|
this.popupObj.show(eventArgs.animation, (this.zIndex === 1000) ? this.element : null);
|
|
8917
|
-
attributes(this.inputElement, { 'aria-expanded': 'true' });
|
|
9103
|
+
attributes(this.inputElement, { 'aria-expanded': 'true', 'aria-owns': this.inputElement.id + '_options' });
|
|
9104
|
+
this.updateAriaActiveDescendant();
|
|
8918
9105
|
if (this.isFirstClick) {
|
|
8919
9106
|
this.loadTemplate();
|
|
8920
9107
|
}
|
|
@@ -8984,11 +9171,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
8984
9171
|
getAriaAttributes() {
|
|
8985
9172
|
const ariaAttributes = {
|
|
8986
9173
|
'aria-disabled': 'false',
|
|
8987
|
-
'
|
|
8988
|
-
'role': 'listbox',
|
|
8989
|
-
'aria-multiselectable': 'true',
|
|
8990
|
-
'aria-activedescendant': 'null',
|
|
8991
|
-
'aria-haspopup': 'true',
|
|
9174
|
+
'role': 'combobox',
|
|
8992
9175
|
'aria-expanded': 'false'
|
|
8993
9176
|
};
|
|
8994
9177
|
return ariaAttributes;
|
|
@@ -8997,8 +9180,10 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
8997
9180
|
if (!isNullOrUndefined(this.ulElement)) {
|
|
8998
9181
|
attributes(this.ulElement, { 'id': this.element.id + '_options', 'role': 'listbox', 'aria-hidden': 'false' });
|
|
8999
9182
|
}
|
|
9000
|
-
const disableStatus = (this.inputElement.disabled) ? true : false;
|
|
9001
|
-
|
|
9183
|
+
const disableStatus = !isNullOrUndefined(this.inputElement) && (this.inputElement.disabled) ? true : false;
|
|
9184
|
+
if (!this.isPopupOpen() && !isNullOrUndefined(this.inputElement)) {
|
|
9185
|
+
attributes(this.inputElement, this.getAriaAttributes());
|
|
9186
|
+
}
|
|
9002
9187
|
if (disableStatus) {
|
|
9003
9188
|
attributes(this.inputElement, { 'aria-disabled': 'true' });
|
|
9004
9189
|
}
|
|
@@ -9066,13 +9251,23 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
9066
9251
|
if (!isNullOrUndefined(this.value) && !this.allowCustomValue) {
|
|
9067
9252
|
for (let i = 0; i < this.value.length; i++) {
|
|
9068
9253
|
const checkEle = this.findListElement(((this.allowFiltering && !isNullOrUndefined(this.mainList)) ? this.mainList : ulElement), 'li', 'data-value', proxy.value[i]);
|
|
9069
|
-
if (!checkEle) {
|
|
9254
|
+
if (!checkEle && !(this.dataSource instanceof DataManager)) {
|
|
9070
9255
|
this.value.splice(i, 1);
|
|
9071
9256
|
i -= 1;
|
|
9072
9257
|
}
|
|
9073
9258
|
}
|
|
9074
9259
|
}
|
|
9075
|
-
|
|
9260
|
+
let valuecheck = [];
|
|
9261
|
+
if (!isNullOrUndefined(this.value) && !this.allowCustomValue) {
|
|
9262
|
+
valuecheck = this.presentItemValue(this.ulElement);
|
|
9263
|
+
}
|
|
9264
|
+
if (valuecheck.length > 0 && this.dataSource instanceof DataManager && !isNullOrUndefined(this.value)
|
|
9265
|
+
&& this.listData != null) {
|
|
9266
|
+
this.addNonPresentItems(valuecheck, this.ulElement, this.listData);
|
|
9267
|
+
}
|
|
9268
|
+
else {
|
|
9269
|
+
this.updateActionList(ulElement, list, e);
|
|
9270
|
+
}
|
|
9076
9271
|
if (this.dataSource instanceof DataManager && this.mode === 'CheckBox' && this.allowFiltering) {
|
|
9077
9272
|
this.removeFocus();
|
|
9078
9273
|
}
|
|
@@ -9096,7 +9291,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
9096
9291
|
this.checkForCustomValue(this.tempQuery, this.fields);
|
|
9097
9292
|
return;
|
|
9098
9293
|
}
|
|
9099
|
-
if (this.value && this.value.length && ((this.mode !== 'CheckBox' && this.inputElement.value.trim() !== '') ||
|
|
9294
|
+
if (this.value && this.value.length && ((this.mode !== 'CheckBox' && !isNullOrUndefined(this.inputElement) && this.inputElement.value.trim() !== '') ||
|
|
9100
9295
|
this.mode === 'CheckBox' || ((this.keyCode === 8 || this.keyCode === 46) && this.allowFiltering &&
|
|
9101
9296
|
this.allowCustomValue && this.dataSource instanceof DataManager && this.inputElement.value === ''))) {
|
|
9102
9297
|
this.refreshSelection();
|
|
@@ -9124,7 +9319,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
9124
9319
|
this.renderPopup();
|
|
9125
9320
|
if (this.beforePopupOpen) {
|
|
9126
9321
|
this.beforePopupOpen = false;
|
|
9127
|
-
this.onPopupShown();
|
|
9322
|
+
this.onPopupShown(e);
|
|
9128
9323
|
}
|
|
9129
9324
|
}
|
|
9130
9325
|
refreshSelection() {
|
|
@@ -9154,6 +9349,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
9154
9349
|
dropDownBaseClasses.li + ':not(.' + HIDE_LIST + ')');
|
|
9155
9350
|
if (listEle.length > 0) {
|
|
9156
9351
|
addClass([listEle[0]], dropDownBaseClasses.focus);
|
|
9352
|
+
this.updateAriaActiveDescendant();
|
|
9157
9353
|
}
|
|
9158
9354
|
else {
|
|
9159
9355
|
//EJ2-57588 - for this task, we prevent the ul element cloning ( this.ulElement = this.ulElement.cloneNode ? <HTMLElement>this.ulElement.cloneNode(true) : this.ulElement;)
|
|
@@ -9165,8 +9361,8 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
9165
9361
|
}
|
|
9166
9362
|
element.setAttribute('aria-selected', 'true');
|
|
9167
9363
|
if (this.mode === 'CheckBox' && element.classList.contains('e-active')) {
|
|
9168
|
-
const ariaValue = element.
|
|
9169
|
-
if (
|
|
9364
|
+
const ariaValue = element.getElementsByClassName('e-check').length;
|
|
9365
|
+
if (ariaValue === 0) {
|
|
9170
9366
|
const args = {
|
|
9171
9367
|
module: 'CheckBoxSelection',
|
|
9172
9368
|
enable: this.mode === 'CheckBox',
|
|
@@ -9290,9 +9486,9 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
9290
9486
|
/**
|
|
9291
9487
|
* To filter the multiselect data from given data source by using query
|
|
9292
9488
|
*
|
|
9293
|
-
* @param
|
|
9294
|
-
* @param
|
|
9295
|
-
* @param
|
|
9489
|
+
* @param {Object[] | DataManager } dataSource - Set the data source to filter.
|
|
9490
|
+
* @param {Query} query - Specify the query to filter the data.
|
|
9491
|
+
* @param {FieldSettingsModel} fields - Specify the fields to map the column in the data table.
|
|
9296
9492
|
* @returns {void}
|
|
9297
9493
|
*/
|
|
9298
9494
|
filter(dataSource, query, fields) {
|
|
@@ -9380,7 +9576,8 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
9380
9576
|
this.resetList(tempData, field, query);
|
|
9381
9577
|
}
|
|
9382
9578
|
else {
|
|
9383
|
-
const tempData =
|
|
9579
|
+
const tempData = JSON.parse(JSON.stringify(this.listData));
|
|
9580
|
+
tempData.splice(0, 0, this.inputElement.value);
|
|
9384
9581
|
tempData[0] = (typeof customData === 'number' && !isNaN(parseFloat(tempData[0]))) ?
|
|
9385
9582
|
parseFloat(tempData[0]) : tempData[0];
|
|
9386
9583
|
tempData[0] = (typeof customData === 'boolean') ?
|
|
@@ -9416,7 +9613,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
9416
9613
|
}
|
|
9417
9614
|
if (!this.isPopupOpen() &&
|
|
9418
9615
|
(this.openOnClick || (this.showDropDownIcon && e.target && e.target.className === dropdownIcon))) {
|
|
9419
|
-
this.showPopup();
|
|
9616
|
+
this.showPopup(e);
|
|
9420
9617
|
}
|
|
9421
9618
|
else {
|
|
9422
9619
|
this.hidePopup(e);
|
|
@@ -9498,6 +9695,10 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
9498
9695
|
}
|
|
9499
9696
|
}
|
|
9500
9697
|
this.updateDataList();
|
|
9698
|
+
if (this.resetMainList) {
|
|
9699
|
+
this.mainList = this.resetMainList;
|
|
9700
|
+
this.resetMainList = null;
|
|
9701
|
+
}
|
|
9501
9702
|
this.refreshListItems(null);
|
|
9502
9703
|
if (this.mode !== 'Box' && this.mode !== 'CheckBox') {
|
|
9503
9704
|
this.updateDelimView();
|
|
@@ -9525,6 +9726,25 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
9525
9726
|
this.ulElement = this.mainList;
|
|
9526
9727
|
}
|
|
9527
9728
|
this.checkPlaceholderSize();
|
|
9729
|
+
Input.createSpanElement(this.overAllWrapper, this.createElement);
|
|
9730
|
+
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
|
+
}
|
|
9528
9748
|
}
|
|
9529
9749
|
checkPlaceholderSize() {
|
|
9530
9750
|
if (this.showDropDownIcon) {
|
|
@@ -9553,11 +9773,13 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
9553
9773
|
}
|
|
9554
9774
|
}
|
|
9555
9775
|
refreshInputHight() {
|
|
9556
|
-
if (
|
|
9557
|
-
this.
|
|
9558
|
-
|
|
9559
|
-
|
|
9560
|
-
|
|
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
|
+
}
|
|
9561
9783
|
}
|
|
9562
9784
|
}
|
|
9563
9785
|
validateValues(newValue, oldValue) {
|
|
@@ -9595,6 +9817,11 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
9595
9817
|
this.tempValues = this.value.slice();
|
|
9596
9818
|
}
|
|
9597
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
|
+
}
|
|
9598
9825
|
getPagingCount() {
|
|
9599
9826
|
const height = this.list.classList.contains(dropDownBaseClasses.noData) ? null :
|
|
9600
9827
|
getComputedStyle(this.getItems()[0], null).getPropertyValue('height');
|
|
@@ -9655,6 +9882,9 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
9655
9882
|
if (this.isPopupOpen()) {
|
|
9656
9883
|
this.refreshPopup();
|
|
9657
9884
|
}
|
|
9885
|
+
setTimeout(() => {
|
|
9886
|
+
this.calculateWidth();
|
|
9887
|
+
}, 150);
|
|
9658
9888
|
return true;
|
|
9659
9889
|
}
|
|
9660
9890
|
else {
|
|
@@ -9710,7 +9940,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
9710
9940
|
break;
|
|
9711
9941
|
case 40:
|
|
9712
9942
|
if (!this.isPopupOpen()) {
|
|
9713
|
-
this.showPopup();
|
|
9943
|
+
this.showPopup(e);
|
|
9714
9944
|
e.preventDefault();
|
|
9715
9945
|
}
|
|
9716
9946
|
break;
|
|
@@ -9737,6 +9967,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
9737
9967
|
const element = scrollEle[(isHome) ? 0 : (scrollEle.length - 1)];
|
|
9738
9968
|
element.classList.add(dropDownBaseClasses.focus);
|
|
9739
9969
|
this.scrollBottom(element);
|
|
9970
|
+
this.updateAriaActiveDescendant();
|
|
9740
9971
|
}
|
|
9741
9972
|
}
|
|
9742
9973
|
onKeyDown(e) {
|
|
@@ -10238,7 +10469,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
10238
10469
|
}
|
|
10239
10470
|
invokeCheckboxSelection(element, eve, isClearAll) {
|
|
10240
10471
|
this.notify('updatelist', { module: 'CheckBoxSelection', enable: this.mode === 'CheckBox', li: element, e: eve });
|
|
10241
|
-
|
|
10472
|
+
this.updateAriaActiveDescendant();
|
|
10242
10473
|
if ((this.value && this.value.length !== this.mainData.length)
|
|
10243
10474
|
&& (this.mode === 'CheckBox' && this.showSelectAll && !(this.isSelectAll || isClearAll))) {
|
|
10244
10475
|
this.notify('checkSelectAll', {
|
|
@@ -10350,7 +10581,6 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
10350
10581
|
HIDE_LIST :
|
|
10351
10582
|
dropDownBaseClasses.selected);
|
|
10352
10583
|
if (this.mode === 'CheckBox') {
|
|
10353
|
-
element2.firstElementChild.setAttribute('aria-checked', 'false');
|
|
10354
10584
|
removeClass([element2.firstElementChild.lastElementChild], 'e-check');
|
|
10355
10585
|
}
|
|
10356
10586
|
}
|
|
@@ -10360,7 +10590,6 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
10360
10590
|
HIDE_LIST :
|
|
10361
10591
|
dropDownBaseClasses.selected);
|
|
10362
10592
|
if (this.mode === 'CheckBox') {
|
|
10363
|
-
element2.firstElementChild.setAttribute('aria-checked', 'true');
|
|
10364
10593
|
addClass([element2.firstElementChild.lastElementChild], 'e-check');
|
|
10365
10594
|
}
|
|
10366
10595
|
}
|
|
@@ -10618,109 +10847,111 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
10618
10847
|
super.render();
|
|
10619
10848
|
}
|
|
10620
10849
|
if (!this.popupObj) {
|
|
10621
|
-
|
|
10622
|
-
|
|
10623
|
-
|
|
10624
|
-
checkboxFilter.
|
|
10625
|
-
|
|
10626
|
-
|
|
10627
|
-
|
|
10628
|
-
|
|
10629
|
-
|
|
10630
|
-
this.
|
|
10631
|
-
|
|
10632
|
-
}
|
|
10633
|
-
append([this.list], this.popupWrapper);
|
|
10634
|
-
if (this.footerTemplate) {
|
|
10635
|
-
this.setFooterTemplate();
|
|
10636
|
-
overAllHeight -= this.footer.offsetHeight;
|
|
10637
|
-
}
|
|
10638
|
-
if (this.mode === 'CheckBox' && this.showSelectAll) {
|
|
10639
|
-
this.notify('selectAll', { module: 'CheckBoxSelection', enable: this.mode === 'CheckBox' });
|
|
10640
|
-
overAllHeight -= this.selectAllHeight;
|
|
10641
|
-
}
|
|
10642
|
-
else if (this.mode === 'CheckBox' && !this.showSelectAll && (!this.headerTemplate && !this.footerTemplate)) {
|
|
10643
|
-
this.notify('selectAll', { module: 'CheckBoxSelection', enable: this.mode === 'CheckBox' });
|
|
10644
|
-
overAllHeight = parseInt(this.popupHeight, 10);
|
|
10645
|
-
}
|
|
10646
|
-
else if (this.mode === 'CheckBox' && !this.showSelectAll) {
|
|
10647
|
-
this.notify('selectAll', { module: 'CheckBoxSelection', enable: this.mode === 'CheckBox' });
|
|
10648
|
-
overAllHeight = parseInt(this.popupHeight, 10);
|
|
10649
|
-
if (this.headerTemplate && this.header) {
|
|
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();
|
|
10650
10861
|
overAllHeight -= this.header.offsetHeight;
|
|
10651
10862
|
}
|
|
10652
|
-
|
|
10863
|
+
append([this.list], this.popupWrapper);
|
|
10864
|
+
if (this.footerTemplate) {
|
|
10865
|
+
this.setFooterTemplate();
|
|
10653
10866
|
overAllHeight -= this.footer.offsetHeight;
|
|
10654
10867
|
}
|
|
10655
|
-
|
|
10656
|
-
|
|
10657
|
-
|
|
10658
|
-
|
|
10659
|
-
|
|
10660
|
-
|
|
10661
|
-
|
|
10662
|
-
|
|
10663
|
-
|
|
10664
|
-
|
|
10665
|
-
|
|
10666
|
-
|
|
10667
|
-
|
|
10668
|
-
if (this.popupHeight !== 'auto') {
|
|
10669
|
-
this.list.style.maxHeight = formatUnit(overAllHeight);
|
|
10670
|
-
this.popupWrapper.style.maxHeight = formatUnit(this.popupHeight);
|
|
10671
|
-
}
|
|
10672
|
-
else {
|
|
10673
|
-
this.list.style.maxHeight = formatUnit(this.popupHeight);
|
|
10674
|
-
}
|
|
10675
|
-
this.popupObj = new Popup(this.popupWrapper, {
|
|
10676
|
-
width: this.calcPopupWidth(), targetType: 'relative', position: { X: 'left', Y: 'bottom' },
|
|
10677
|
-
relateTo: this.overAllWrapper, collision: { X: 'flip', Y: 'flip' }, offsetY: 1,
|
|
10678
|
-
enableRtl: this.enableRtl, zIndex: this.zIndex,
|
|
10679
|
-
close: () => {
|
|
10680
|
-
if (this.popupObj.element.parentElement) {
|
|
10681
|
-
this.popupObj.unwireScrollEvents();
|
|
10682
|
-
// For restrict the page scrolling in safari browser
|
|
10683
|
-
const checkboxFilterInput = this.popupWrapper.querySelector('.' + FILTERINPUT);
|
|
10684
|
-
if (this.mode === 'CheckBox' && checkboxFilterInput && document.activeElement === checkboxFilterInput) {
|
|
10685
|
-
checkboxFilterInput.blur();
|
|
10686
|
-
}
|
|
10687
|
-
detach(this.popupObj.element);
|
|
10688
|
-
}
|
|
10689
|
-
},
|
|
10690
|
-
open: () => {
|
|
10691
|
-
this.popupObj.resolveCollision();
|
|
10692
|
-
if (!this.isFirstClick) {
|
|
10693
|
-
const ulElement = this.list.querySelector('ul');
|
|
10694
|
-
if (ulElement) {
|
|
10695
|
-
if (!(this.mode !== 'CheckBox' && (this.allowFiltering || this.allowCustomValue) &&
|
|
10696
|
-
this.targetElement().trim() !== '')) {
|
|
10697
|
-
this.mainList = ulElement.cloneNode ? ulElement.cloneNode(true) : ulElement;
|
|
10698
|
-
}
|
|
10699
|
-
}
|
|
10700
|
-
this.isFirstClick = true;
|
|
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;
|
|
10701
10881
|
}
|
|
10702
|
-
this.
|
|
10703
|
-
|
|
10704
|
-
this.targetElement().trim() !== '')) {
|
|
10705
|
-
this.loadTemplate();
|
|
10882
|
+
if (this.footerTemplate && this.footer) {
|
|
10883
|
+
overAllHeight -= this.footer.offsetHeight;
|
|
10706
10884
|
}
|
|
10707
|
-
|
|
10885
|
+
}
|
|
10886
|
+
if (this.mode === 'CheckBox') {
|
|
10887
|
+
const args = {
|
|
10888
|
+
module: 'CheckBoxSelection',
|
|
10889
|
+
enable: this.mode === 'CheckBox',
|
|
10890
|
+
popupElement: this.popupWrapper
|
|
10891
|
+
};
|
|
10708
10892
|
if (this.allowFiltering) {
|
|
10709
|
-
this.notify('
|
|
10710
|
-
|
|
10711
|
-
});
|
|
10893
|
+
this.notify('searchBox', args);
|
|
10894
|
+
overAllHeight -= this.searchBoxHeight;
|
|
10712
10895
|
}
|
|
10713
|
-
|
|
10714
|
-
|
|
10715
|
-
|
|
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
|
+
}
|
|
10716
10947
|
}
|
|
10948
|
+
});
|
|
10949
|
+
if (this.mode === 'CheckBox' && Browser.isDevice && this.allowFiltering) {
|
|
10950
|
+
this.notify('deviceSearchBox', { module: 'CheckBoxSelection', enable: this.mode === 'CheckBox' });
|
|
10717
10951
|
}
|
|
10718
|
-
|
|
10719
|
-
|
|
10720
|
-
this.notify('deviceSearchBox', { module: 'CheckBoxSelection', enable: this.mode === 'CheckBox' });
|
|
10952
|
+
this.popupObj.close();
|
|
10953
|
+
this.popupWrapper.style.visibility = '';
|
|
10721
10954
|
}
|
|
10722
|
-
this.popupObj.close();
|
|
10723
|
-
this.popupWrapper.style.visibility = '';
|
|
10724
10955
|
}
|
|
10725
10956
|
}
|
|
10726
10957
|
setHeaderTemplate() {
|
|
@@ -10790,6 +11021,8 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
10790
11021
|
this.removeValue(temp, e, null, true);
|
|
10791
11022
|
}
|
|
10792
11023
|
}
|
|
11024
|
+
this.selectedElementID = null;
|
|
11025
|
+
this.inputElement.removeAttribute('aria-activedescendant');
|
|
10793
11026
|
}
|
|
10794
11027
|
else {
|
|
10795
11028
|
this.clearAllCallback(e);
|
|
@@ -10891,11 +11124,12 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
10891
11124
|
});
|
|
10892
11125
|
}
|
|
10893
11126
|
search(e) {
|
|
11127
|
+
this.resetFilteredData = true;
|
|
10894
11128
|
if (!isNullOrUndefined(e)) {
|
|
10895
11129
|
this.keyCode = e.keyCode;
|
|
10896
11130
|
}
|
|
10897
11131
|
if (!this.isPopupOpen() && this.openOnClick) {
|
|
10898
|
-
this.showPopup();
|
|
11132
|
+
this.showPopup(e);
|
|
10899
11133
|
}
|
|
10900
11134
|
this.openClick(e);
|
|
10901
11135
|
if (this.checkTextLength() && !this.allowFiltering && !isNullOrUndefined(e) && (e.keyCode !== 8)) {
|
|
@@ -10979,7 +11213,9 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
10979
11213
|
let temp;
|
|
10980
11214
|
const tempData = this.listData;
|
|
10981
11215
|
this.listData = this.mainData;
|
|
10982
|
-
this.hiddenElement
|
|
11216
|
+
if (!isNullOrUndefined(this.hiddenElement)) {
|
|
11217
|
+
this.hiddenElement.innerHTML = '';
|
|
11218
|
+
}
|
|
10983
11219
|
if (!isNullOrUndefined(this.value)) {
|
|
10984
11220
|
for (let index = 0; !isNullOrUndefined(this.value[index]); index++) {
|
|
10985
11221
|
const listValue = this.findListElement(((!isNullOrUndefined(this.mainList)) ? this.mainList : this.ulElement), 'li', 'data-value', this.value[index]);
|
|
@@ -10997,7 +11233,9 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
10997
11233
|
data += temp + delimiterChar + ' ';
|
|
10998
11234
|
text.push(temp);
|
|
10999
11235
|
}
|
|
11000
|
-
this.hiddenElement
|
|
11236
|
+
if (!isNullOrUndefined(this.hiddenElement)) {
|
|
11237
|
+
this.hiddenElement.innerHTML += '<option selected value ="' + this.value[index] + '">' + index + '</option>';
|
|
11238
|
+
}
|
|
11001
11239
|
}
|
|
11002
11240
|
}
|
|
11003
11241
|
this.setProperties({ text: text.toString() }, true);
|
|
@@ -11042,7 +11280,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
11042
11280
|
|| this.list.querySelector('.e-ul') && this.list.querySelector('.e-ul').childElementCount === 0)) {
|
|
11043
11281
|
isEmptyData = true;
|
|
11044
11282
|
}
|
|
11045
|
-
super.render(isEmptyData);
|
|
11283
|
+
super.render(null, isEmptyData);
|
|
11046
11284
|
this.unwireListEvents();
|
|
11047
11285
|
this.wireListEvents();
|
|
11048
11286
|
}
|
|
@@ -11208,10 +11446,8 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
11208
11446
|
selectItems[temp1 - 1].setAttribute('aria-selected', 'false');
|
|
11209
11447
|
if (this.mode === 'CheckBox') {
|
|
11210
11448
|
if (selectedItems && (selectedItems.length > (temp1 - 1))) {
|
|
11211
|
-
selectedItems[temp1 - 1].firstElementChild.setAttribute('aria-checked', 'false');
|
|
11212
11449
|
removeClass([selectedItems[temp1 - 1].firstElementChild.lastElementChild], 'e-check');
|
|
11213
11450
|
}
|
|
11214
|
-
selectItems[temp1 - 1].firstElementChild.setAttribute('aria-checked', 'false');
|
|
11215
11451
|
removeClass([selectItems[temp1 - 1].firstElementChild.lastElementChild], 'e-check');
|
|
11216
11452
|
}
|
|
11217
11453
|
temp1--;
|
|
@@ -11252,10 +11488,12 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
11252
11488
|
if (this.enabled && this.isValidLI(element)) {
|
|
11253
11489
|
this.removeFocus();
|
|
11254
11490
|
addClass([element], dropDownBaseClasses.focus);
|
|
11491
|
+
this.updateAriaActiveDescendant();
|
|
11255
11492
|
}
|
|
11256
11493
|
else {
|
|
11257
11494
|
if (this.enableGroupCheckBox && this.mode === 'CheckBox' && !isNullOrUndefined(this.fields.groupBy)) {
|
|
11258
11495
|
addClass([element], dropDownBaseClasses.focus);
|
|
11496
|
+
this.updateAriaActiveDescendant();
|
|
11259
11497
|
}
|
|
11260
11498
|
}
|
|
11261
11499
|
}
|
|
@@ -11267,9 +11505,9 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
11267
11505
|
addClass([element], className);
|
|
11268
11506
|
this.updateMainList(false, element.getAttribute('data-value'), mainElement);
|
|
11269
11507
|
element.setAttribute('aria-selected', 'true');
|
|
11270
|
-
if (this.mode === 'CheckBox') {
|
|
11271
|
-
const ariaCheck = element.
|
|
11272
|
-
if (ariaCheck ===
|
|
11508
|
+
if (this.mode === 'CheckBox' && element.classList.contains('e-active')) {
|
|
11509
|
+
const ariaCheck = element.getElementsByClassName('e-check').length;
|
|
11510
|
+
if (ariaCheck === 0) {
|
|
11273
11511
|
this.notify('updatelist', { module: 'CheckBoxSelection', enable: this.mode === 'CheckBox', li: element, e: this });
|
|
11274
11512
|
}
|
|
11275
11513
|
}
|
|
@@ -11277,7 +11515,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
11277
11515
|
if (this.chipCollectionWrapper) {
|
|
11278
11516
|
this.removeChipSelection();
|
|
11279
11517
|
}
|
|
11280
|
-
|
|
11518
|
+
this.selectedElementID = element.id;
|
|
11281
11519
|
}
|
|
11282
11520
|
}
|
|
11283
11521
|
updateDelimeter(delimChar, e) {
|
|
@@ -11587,9 +11825,11 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
11587
11825
|
if (this.chipCollectionWrapper) {
|
|
11588
11826
|
this.chipCollectionWrapper.style.display = 'none';
|
|
11589
11827
|
}
|
|
11590
|
-
this.viewWrapper
|
|
11591
|
-
|
|
11592
|
-
|
|
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
|
+
}
|
|
11593
11833
|
if (this.value && this.value.length) {
|
|
11594
11834
|
let data = '';
|
|
11595
11835
|
let temp;
|
|
@@ -11640,7 +11880,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
11640
11880
|
overAllContainer = this.componentWrapper.offsetWidth -
|
|
11641
11881
|
parseInt(window.getComputedStyle(this.componentWrapper).paddingLeft, 10) -
|
|
11642
11882
|
parseInt(window.getComputedStyle(this.componentWrapper).paddingRight, 10);
|
|
11643
|
-
if ((wrapperleng + downIconWidth + this.clearIconWidth)
|
|
11883
|
+
if ((wrapperleng + downIconWidth + this.clearIconWidth) >= overAllContainer) {
|
|
11644
11884
|
if (tempData !== undefined && tempData !== '') {
|
|
11645
11885
|
temp = tempData;
|
|
11646
11886
|
index = tempIndex + 1;
|
|
@@ -11649,7 +11889,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
11649
11889
|
remaining = this.value.length - index;
|
|
11650
11890
|
wrapperleng = this.viewWrapper.offsetWidth +
|
|
11651
11891
|
parseInt(window.getComputedStyle(this.viewWrapper).paddingRight, 10);
|
|
11652
|
-
while (((wrapperleng + remainSize + downIconWidth + this.clearIconWidth)
|
|
11892
|
+
while (((wrapperleng + remainSize + downIconWidth + this.clearIconWidth) >= overAllContainer) && wrapperleng !== 0
|
|
11653
11893
|
&& this.viewWrapper.innerHTML !== '') {
|
|
11654
11894
|
const textArr = [];
|
|
11655
11895
|
this.viewWrapper.innerHTML = textArr.join(this.delimiterChar);
|
|
@@ -11659,7 +11899,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
11659
11899
|
}
|
|
11660
11900
|
break;
|
|
11661
11901
|
}
|
|
11662
|
-
else if ((wrapperleng + remainSize + downIconWidth + this.clearIconWidth)
|
|
11902
|
+
else if ((wrapperleng + remainSize + downIconWidth + this.clearIconWidth) < overAllContainer) {
|
|
11663
11903
|
tempData = data;
|
|
11664
11904
|
tempIndex = index;
|
|
11665
11905
|
}
|
|
@@ -11677,8 +11917,10 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
11677
11917
|
}
|
|
11678
11918
|
}
|
|
11679
11919
|
else {
|
|
11680
|
-
this.viewWrapper
|
|
11681
|
-
|
|
11920
|
+
if (!isNullOrUndefined(this.viewWrapper)) {
|
|
11921
|
+
this.viewWrapper.innerHTML = '';
|
|
11922
|
+
this.viewWrapper.style.display = 'none';
|
|
11923
|
+
}
|
|
11682
11924
|
}
|
|
11683
11925
|
}
|
|
11684
11926
|
checkClearIconWidth() {
|
|
@@ -11751,29 +11993,41 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
11751
11993
|
return temp;
|
|
11752
11994
|
}
|
|
11753
11995
|
unWireEvent() {
|
|
11754
|
-
|
|
11996
|
+
if (!isNullOrUndefined(this.componentWrapper)) {
|
|
11997
|
+
EventHandler.remove(this.componentWrapper, 'mousedown', this.wrapperClick);
|
|
11998
|
+
}
|
|
11755
11999
|
EventHandler.remove(window, 'resize', this.windowResize);
|
|
11756
|
-
|
|
11757
|
-
|
|
11758
|
-
|
|
11759
|
-
|
|
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);
|
|
11760
12012
|
}
|
|
11761
|
-
|
|
11762
|
-
|
|
11763
|
-
|
|
11764
|
-
|
|
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);
|
|
11765
12022
|
}
|
|
11766
|
-
EventHandler.remove(this.inputElement, 'blur', this.onBlurHandler);
|
|
11767
|
-
EventHandler.remove(this.componentWrapper, 'mouseover', this.mouseIn);
|
|
11768
|
-
EventHandler.remove(this.componentWrapper, 'mouseout', this.mouseOut);
|
|
11769
|
-
EventHandler.remove(this.overAllClear, 'mousedown', this.clearAll);
|
|
11770
|
-
EventHandler.remove(this.inputElement, 'paste', this.pasteHandler);
|
|
11771
12023
|
}
|
|
11772
12024
|
selectAllItem(state, event, list) {
|
|
11773
12025
|
let li;
|
|
11774
|
-
|
|
11775
|
-
|
|
11776
|
-
|
|
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
|
+
}
|
|
11777
12031
|
if (this.value && this.value.length && event && event.target
|
|
11778
12032
|
&& closest(event.target, '.e-close-hooker') && this.allowFiltering) {
|
|
11779
12033
|
li = this.mainList.querySelectorAll(state ?
|
|
@@ -11823,6 +12077,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
11823
12077
|
target.classList.remove('e-active');
|
|
11824
12078
|
}
|
|
11825
12079
|
target.classList.add('e-item-focus');
|
|
12080
|
+
this.updateAriaActiveDescendant();
|
|
11826
12081
|
}
|
|
11827
12082
|
this.textboxValueUpdate();
|
|
11828
12083
|
this.checkPlaceholderSize();
|
|
@@ -11837,6 +12092,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
11837
12092
|
else {
|
|
11838
12093
|
this.updateValue(event, li, state);
|
|
11839
12094
|
}
|
|
12095
|
+
this.addValidInputClass();
|
|
11840
12096
|
}
|
|
11841
12097
|
updateValue(event, li, state) {
|
|
11842
12098
|
const length = li.length;
|
|
@@ -12059,6 +12315,11 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
12059
12315
|
onPropertyChanged(newProp, oldProp) {
|
|
12060
12316
|
if (newProp.dataSource && !isNullOrUndefined(Object.keys(newProp.dataSource))
|
|
12061
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
|
+
}
|
|
12062
12323
|
this.mainList = null;
|
|
12063
12324
|
this.mainData = null;
|
|
12064
12325
|
this.isFirstClick = false;
|
|
@@ -12118,6 +12379,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
12118
12379
|
case 'cssClass':
|
|
12119
12380
|
this.updateOldPropCssClass(oldProp.cssClass);
|
|
12120
12381
|
this.updateCssClass();
|
|
12382
|
+
this.calculateWidth();
|
|
12121
12383
|
break;
|
|
12122
12384
|
case 'enableRtl':
|
|
12123
12385
|
this.enableRTL(newProp.enableRtl);
|
|
@@ -12144,6 +12406,11 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
12144
12406
|
case 'floatLabelType':
|
|
12145
12407
|
this.setFloatLabelType();
|
|
12146
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
|
+
}
|
|
12147
12414
|
break;
|
|
12148
12415
|
case 'enableSelectionOrder':
|
|
12149
12416
|
break;
|
|
@@ -12202,7 +12469,9 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
12202
12469
|
;
|
|
12203
12470
|
addNonPresentItems(valuecheck, ulElement, list, event) {
|
|
12204
12471
|
this.dataSource.executeQuery(this.getForQuery(valuecheck)).then((e) => {
|
|
12205
|
-
|
|
12472
|
+
if (e.result.length > 0) {
|
|
12473
|
+
this.addItem(e.result, list.length);
|
|
12474
|
+
}
|
|
12206
12475
|
this.updateActionList(ulElement, list, event);
|
|
12207
12476
|
});
|
|
12208
12477
|
}
|
|
@@ -12261,7 +12530,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
12261
12530
|
* Adds a new item to the multiselect popup list. By default, new item appends to the list as the last item,
|
|
12262
12531
|
* but you can insert based on the index parameter.
|
|
12263
12532
|
*
|
|
12264
|
-
* @param
|
|
12533
|
+
* @param { Object[] } items - Specifies an array of JSON data or a JSON data.
|
|
12265
12534
|
* @param { number } itemIndex - Specifies the index to place the newly added item in the popup list.
|
|
12266
12535
|
* @returns {void}
|
|
12267
12536
|
*/
|
|
@@ -12292,6 +12561,8 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
12292
12561
|
this.overAllWrapper.classList.remove(iconAnimation);
|
|
12293
12562
|
this.popupObj.hide(new Animation(eventArgs.animation));
|
|
12294
12563
|
attributes(this.inputElement, { 'aria-expanded': 'false' });
|
|
12564
|
+
this.inputElement.removeAttribute('aria-owns');
|
|
12565
|
+
this.inputElement.removeAttribute('aria-activedescendant');
|
|
12295
12566
|
if (this.allowFiltering) {
|
|
12296
12567
|
this.notify('inputFocus', { module: 'CheckBoxSelection', enable: this.mode === 'CheckBox', value: 'clear' });
|
|
12297
12568
|
}
|
|
@@ -12307,7 +12578,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
12307
12578
|
*
|
|
12308
12579
|
* @returns {void}
|
|
12309
12580
|
*/
|
|
12310
|
-
showPopup() {
|
|
12581
|
+
showPopup(e) {
|
|
12311
12582
|
if (!this.enabled) {
|
|
12312
12583
|
return;
|
|
12313
12584
|
}
|
|
@@ -12316,7 +12587,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
12316
12587
|
if (!args.cancel) {
|
|
12317
12588
|
if (!this.ulElement) {
|
|
12318
12589
|
this.beforePopupOpen = true;
|
|
12319
|
-
super.render();
|
|
12590
|
+
super.render(e);
|
|
12320
12591
|
if (this.mode === 'CheckBox' && Browser.isDevice && this.allowFiltering) {
|
|
12321
12592
|
this.notify('popupFullScreen', { module: 'CheckBoxSelection', enable: this.mode === 'CheckBox' });
|
|
12322
12593
|
}
|
|
@@ -12332,7 +12603,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
12332
12603
|
this.beforePopupOpen = false;
|
|
12333
12604
|
return;
|
|
12334
12605
|
}
|
|
12335
|
-
this.onPopupShown();
|
|
12606
|
+
this.onPopupShown(e);
|
|
12336
12607
|
}
|
|
12337
12608
|
});
|
|
12338
12609
|
}
|
|
@@ -12433,12 +12704,12 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
12433
12704
|
spellcheck: 'false',
|
|
12434
12705
|
type: 'text',
|
|
12435
12706
|
autocomplete: 'off',
|
|
12436
|
-
tabindex: '0'
|
|
12707
|
+
tabindex: '0',
|
|
12708
|
+
role: 'combobox'
|
|
12437
12709
|
}
|
|
12438
12710
|
});
|
|
12439
12711
|
if (this.mode === 'Default' || this.mode === 'Box') {
|
|
12440
12712
|
this.inputElement.setAttribute('aria-describedby', this.chipCollectionWrapper.id);
|
|
12441
|
-
this.inputElement.setAttribute('aria-labelledby', this.chipCollectionWrapper.id);
|
|
12442
12713
|
}
|
|
12443
12714
|
if (this.element.tagName !== this.getNgDirective()) {
|
|
12444
12715
|
this.element.style.display = 'none';
|
|
@@ -12471,6 +12742,9 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
12471
12742
|
if (this.mode !== 'CheckBox') {
|
|
12472
12743
|
this.hideOverAllClear();
|
|
12473
12744
|
}
|
|
12745
|
+
if (!isNullOrUndefined(closest(this.element, "fieldset")) && closest(this.element, "fieldset").disabled) {
|
|
12746
|
+
this.enabled = false;
|
|
12747
|
+
}
|
|
12474
12748
|
this.wireEvent();
|
|
12475
12749
|
this.enable(this.enabled);
|
|
12476
12750
|
this.enableRTL(this.enableRtl);
|
|
@@ -12478,6 +12752,11 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
12478
12752
|
if (this.element.hasAttribute('data-val')) {
|
|
12479
12753
|
this.element.setAttribute('data-val', 'false');
|
|
12480
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
|
+
}
|
|
12481
12760
|
this.renderComplete();
|
|
12482
12761
|
}
|
|
12483
12762
|
checkInitialValue() {
|
|
@@ -12558,11 +12837,13 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
12558
12837
|
}
|
|
12559
12838
|
}
|
|
12560
12839
|
addValidInputClass() {
|
|
12561
|
-
if (
|
|
12562
|
-
|
|
12563
|
-
|
|
12564
|
-
|
|
12565
|
-
|
|
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
|
+
}
|
|
12566
12847
|
}
|
|
12567
12848
|
}
|
|
12568
12849
|
dropDownIcon() {
|
|
@@ -12613,15 +12894,19 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
12613
12894
|
this.ulElement = null;
|
|
12614
12895
|
this.mainListCollection = null;
|
|
12615
12896
|
super.destroy();
|
|
12616
|
-
const temp = ['readonly', 'aria-disabled', '
|
|
12897
|
+
const temp = ['readonly', 'aria-disabled', 'placeholder'];
|
|
12617
12898
|
let length = temp.length;
|
|
12618
|
-
|
|
12619
|
-
|
|
12620
|
-
|
|
12899
|
+
if (!isNullOrUndefined(this.inputElement)) {
|
|
12900
|
+
while (length > 0) {
|
|
12901
|
+
this.inputElement.removeAttribute(temp[length - 1]);
|
|
12902
|
+
length--;
|
|
12903
|
+
}
|
|
12621
12904
|
}
|
|
12622
|
-
this.element
|
|
12623
|
-
|
|
12624
|
-
|
|
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) {
|
|
12625
12910
|
if (this.overAllWrapper.parentElement.tagName === this.getNgDirective()) {
|
|
12626
12911
|
remove(this.overAllWrapper);
|
|
12627
12912
|
}
|
|
@@ -12630,6 +12915,25 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
12630
12915
|
remove(this.overAllWrapper);
|
|
12631
12916
|
}
|
|
12632
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;
|
|
12633
12937
|
}
|
|
12634
12938
|
};
|
|
12635
12939
|
__decorate$5([
|
|
@@ -12979,6 +13283,12 @@ class CheckBoxSelection {
|
|
|
12979
13283
|
destroy() {
|
|
12980
13284
|
this.removeEventListener();
|
|
12981
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;
|
|
12982
13292
|
}
|
|
12983
13293
|
listSelection(args) {
|
|
12984
13294
|
let target;
|
|
@@ -13027,12 +13337,10 @@ class CheckBoxSelection {
|
|
|
13027
13337
|
e.preventDefault();
|
|
13028
13338
|
}
|
|
13029
13339
|
changeState(wrapper, state, e, isPrevent, selectAll$$1) {
|
|
13030
|
-
let ariaState;
|
|
13031
13340
|
const frameSpan = wrapper.getElementsByClassName(CHECKBOXFRAME$1)[0];
|
|
13032
13341
|
if (state === 'check' && !frameSpan.classList.contains(CHECK$1)) {
|
|
13033
13342
|
frameSpan.classList.remove(INDETERMINATE);
|
|
13034
13343
|
frameSpan.classList.add(CHECK$1);
|
|
13035
|
-
ariaState = 'true';
|
|
13036
13344
|
if (selectAll$$1) {
|
|
13037
13345
|
this.parent.selectAllItems(true, e);
|
|
13038
13346
|
this.setLocale(true);
|
|
@@ -13040,7 +13348,6 @@ class CheckBoxSelection {
|
|
|
13040
13348
|
}
|
|
13041
13349
|
else if (state === 'uncheck' && (frameSpan.classList.contains(CHECK$1) || frameSpan.classList.contains(INDETERMINATE))) {
|
|
13042
13350
|
removeClass([frameSpan], [CHECK$1, INDETERMINATE]);
|
|
13043
|
-
ariaState = 'false';
|
|
13044
13351
|
if (selectAll$$1) {
|
|
13045
13352
|
this.parent.selectAllItems(false, e);
|
|
13046
13353
|
this.setLocale();
|
|
@@ -13049,16 +13356,11 @@ class CheckBoxSelection {
|
|
|
13049
13356
|
else if (state === 'indeterminate' && !(frameSpan.classList.contains(INDETERMINATE))) {
|
|
13050
13357
|
removeClass([frameSpan], [CHECK$1]);
|
|
13051
13358
|
frameSpan.classList.add(INDETERMINATE);
|
|
13052
|
-
ariaState = 'false';
|
|
13053
13359
|
if (selectAll$$1) {
|
|
13054
13360
|
this.parent.selectAllItems(false, e);
|
|
13055
13361
|
this.setLocale();
|
|
13056
13362
|
}
|
|
13057
13363
|
}
|
|
13058
|
-
ariaState = state === 'check' ? 'true' : state === 'uncheck' ? 'false' : ariaState;
|
|
13059
|
-
if (!isNullOrUndefined(ariaState)) {
|
|
13060
|
-
wrapper.setAttribute('aria-checked', ariaState);
|
|
13061
|
-
}
|
|
13062
13364
|
}
|
|
13063
13365
|
setSearchBox(args) {
|
|
13064
13366
|
if (isNullOrUndefined(this.parent.filterParent)) {
|
|
@@ -13092,11 +13394,8 @@ class CheckBoxSelection {
|
|
|
13092
13394
|
prepend([this.parent.filterParent], args.popupElement);
|
|
13093
13395
|
attributes(this.filterInput, {
|
|
13094
13396
|
'aria-disabled': 'false',
|
|
13095
|
-
'
|
|
13096
|
-
'role': 'listbox',
|
|
13097
|
-
'aria-activedescendant': null,
|
|
13397
|
+
'role': 'combobox',
|
|
13098
13398
|
'autocomplete': 'off',
|
|
13099
|
-
'autocorrect': 'off',
|
|
13100
13399
|
'autocapitalize': 'off',
|
|
13101
13400
|
'spellcheck': 'false'
|
|
13102
13401
|
});
|
|
@@ -13222,8 +13521,8 @@ class CheckBoxSelection {
|
|
|
13222
13521
|
e.preventDefault();
|
|
13223
13522
|
}
|
|
13224
13523
|
}
|
|
13225
|
-
if (!(!isNullOrUndefined(this.parent.popupObj) && closest(target, '[id="' + this.parent.popupObj.element.id + '"]'))
|
|
13226
|
-
!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)) {
|
|
13227
13526
|
if (this.parent.overAllWrapper.classList.contains(dropDownBaseClasses.focus) || this.parent.isPopupOpen()) {
|
|
13228
13527
|
this.parent.inputFocus = false;
|
|
13229
13528
|
this.parent.scrollFocusStatus = false;
|
|
@@ -13236,7 +13535,7 @@ class CheckBoxSelection {
|
|
|
13236
13535
|
this.parent.scrollFocusStatus = (Browser.isIE || Browser.info.name === 'edge') &&
|
|
13237
13536
|
(document.activeElement === this.filterInput);
|
|
13238
13537
|
}
|
|
13239
|
-
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') &&
|
|
13240
13539
|
!this.parent.isPopupOpen()) {
|
|
13241
13540
|
if (Browser.isIE) {
|
|
13242
13541
|
this.parent.onBlurHandler();
|
|
@@ -13267,7 +13566,7 @@ class CheckBoxSelection {
|
|
|
13267
13566
|
}
|
|
13268
13567
|
}
|
|
13269
13568
|
checkSelectAll(e) {
|
|
13270
|
-
if (e.value === 'check'
|
|
13569
|
+
if (e.value === 'check') {
|
|
13271
13570
|
this.changeState(this.checkAllParent, e.value, null, null, false);
|
|
13272
13571
|
this.setLocale(true);
|
|
13273
13572
|
}
|
|
@@ -13424,6 +13723,7 @@ let ListBox = ListBox_1 = class ListBox extends DropDownBase {
|
|
|
13424
13723
|
this.isCustomFiltering = false;
|
|
13425
13724
|
this.initialSelectedOptions = this.value;
|
|
13426
13725
|
super.render();
|
|
13726
|
+
this.setEnabled();
|
|
13427
13727
|
this.renderComplete();
|
|
13428
13728
|
}
|
|
13429
13729
|
initWrapper() {
|
|
@@ -13458,7 +13758,7 @@ let ListBox = ListBox_1 = class ListBox extends DropDownBase {
|
|
|
13458
13758
|
removeClass([this.list], [dropDownBaseClasses.content, dropDownBaseClasses.root]);
|
|
13459
13759
|
this.validationAttribute(this.element, hiddenSelect);
|
|
13460
13760
|
this.list.setAttribute('role', 'listbox');
|
|
13461
|
-
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' });
|
|
13462
13762
|
this.updateSelectionSettings();
|
|
13463
13763
|
}
|
|
13464
13764
|
updateSelectionSettings() {
|
|
@@ -13503,8 +13803,8 @@ let ListBox = ListBox_1 = class ListBox extends DropDownBase {
|
|
|
13503
13803
|
});
|
|
13504
13804
|
}
|
|
13505
13805
|
}
|
|
13506
|
-
updateActionCompleteData(li, item) {
|
|
13507
|
-
this.jsonData.
|
|
13806
|
+
updateActionCompleteData(li, item, index) {
|
|
13807
|
+
this.jsonData.splice(index, 0, item);
|
|
13508
13808
|
}
|
|
13509
13809
|
initToolbar() {
|
|
13510
13810
|
const pos = this.toolbarSettings.position;
|
|
@@ -13714,14 +14014,14 @@ let ListBox = ListBox_1 = class ListBox extends DropDownBase {
|
|
|
13714
14014
|
triggerDrag(args) {
|
|
13715
14015
|
let scrollParent;
|
|
13716
14016
|
let boundRect;
|
|
13717
|
-
|
|
14017
|
+
const scrollMoved = 36;
|
|
13718
14018
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
13719
|
-
|
|
14019
|
+
const event = args.event;
|
|
13720
14020
|
let wrapper;
|
|
13721
|
-
if (args.target && (args.target.classList.contains(
|
|
13722
|
-
|| args.target.classList.contains(
|
|
13723
|
-
if (args.target.classList.contains(
|
|
13724
|
-
|| args.target.classList.contains(
|
|
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')) {
|
|
13725
14025
|
wrapper = args.target.closest('.e-listbox-wrapper');
|
|
13726
14026
|
}
|
|
13727
14027
|
else {
|
|
@@ -13775,7 +14075,8 @@ let ListBox = ListBox_1 = class ListBox extends DropDownBase {
|
|
|
13775
14075
|
const getArgs = this.getDragArgs({ target: args.droppedElement }, true);
|
|
13776
14076
|
const sourceArgs = { previousData: this.dataSource };
|
|
13777
14077
|
const destArgs = { previousData: listObj.dataSource };
|
|
13778
|
-
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 });
|
|
13779
14080
|
if (listObj !== this) {
|
|
13780
14081
|
const sourceArgs1 = extend(sourceArgs, { currentData: this.listData });
|
|
13781
14082
|
dragArgs = extend(dragArgs, { source: sourceArgs1, destination: destArgs });
|
|
@@ -13869,14 +14170,14 @@ let ListBox = ListBox_1 = class ListBox extends DropDownBase {
|
|
|
13869
14170
|
currIdx++;
|
|
13870
14171
|
});
|
|
13871
14172
|
if (this.fields.groupBy) {
|
|
13872
|
-
|
|
14173
|
+
const sourceElem = this.renderItems(this.listData, this.fields);
|
|
13873
14174
|
this.updateListItems(sourceElem, this.ulElement);
|
|
13874
14175
|
this.setSelection();
|
|
13875
14176
|
}
|
|
13876
14177
|
if (listObj.sortOrder !== 'None' || this.selectionSettings.showCheckbox
|
|
13877
14178
|
!== listObj.selectionSettings.showCheckbox || listObj.fields.groupBy || listObj.itemTemplate || this.itemTemplate) {
|
|
13878
14179
|
const sortable = getComponent(ul, 'sortable');
|
|
13879
|
-
|
|
14180
|
+
const sourceElem = listObj.renderItems(listData, listObj.fields);
|
|
13880
14181
|
listObj.updateListItems(sourceElem, ul);
|
|
13881
14182
|
this.setSelection();
|
|
13882
14183
|
if (sortable.placeHolderElement) {
|
|
@@ -13903,10 +14204,17 @@ let ListBox = ListBox_1 = class ListBox extends DropDownBase {
|
|
|
13903
14204
|
dragArgs = extend(dragArgs, { destination: dragArgs1 });
|
|
13904
14205
|
}
|
|
13905
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
|
+
}
|
|
13906
14214
|
}
|
|
13907
14215
|
updateListItems(sourceElem, destElem) {
|
|
13908
14216
|
const i = 0;
|
|
13909
|
-
destElem.innerHTML =
|
|
14217
|
+
destElem.innerHTML = '';
|
|
13910
14218
|
while (i < sourceElem.childNodes.length) {
|
|
13911
14219
|
destElem.appendChild(sourceElem.childNodes[i]);
|
|
13912
14220
|
}
|
|
@@ -13935,6 +14243,14 @@ let ListBox = ListBox_1 = class ListBox extends DropDownBase {
|
|
|
13935
14243
|
}
|
|
13936
14244
|
return listObj;
|
|
13937
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
|
+
}
|
|
13938
14254
|
listOption(dataSource, fields) {
|
|
13939
14255
|
this.listCurrentOptions = super.listOption(dataSource, fields);
|
|
13940
14256
|
this.listCurrentOptions = extend({}, this.listCurrentOptions, { itemCreated: this.triggerBeforeItemRender.bind(this) }, true);
|
|
@@ -13966,7 +14282,7 @@ let ListBox = ListBox_1 = class ListBox extends DropDownBase {
|
|
|
13966
14282
|
enableItems(items, enable = true, isValue) {
|
|
13967
14283
|
let li;
|
|
13968
14284
|
items.forEach((item) => {
|
|
13969
|
-
|
|
14285
|
+
const text = item;
|
|
13970
14286
|
li = this.findListElement(this.list, 'li', 'data-value', isValue ? text : this.getValueByText(text));
|
|
13971
14287
|
if (!li) {
|
|
13972
14288
|
return;
|
|
@@ -14042,7 +14358,7 @@ let ListBox = ListBox_1 = class ListBox extends DropDownBase {
|
|
|
14042
14358
|
let objValue;
|
|
14043
14359
|
const dupData = [];
|
|
14044
14360
|
let itemIdx;
|
|
14045
|
-
extend(dupData, [], this.
|
|
14361
|
+
extend(dupData, [], this.jsonData);
|
|
14046
14362
|
const removeIdxes = [];
|
|
14047
14363
|
const removeLiIdxes = [];
|
|
14048
14364
|
for (let j = 0; j < items.length; j++) {
|
|
@@ -14091,7 +14407,7 @@ let ListBox = ListBox_1 = class ListBox extends DropDownBase {
|
|
|
14091
14407
|
if (this.listData.length === 0) {
|
|
14092
14408
|
this.l10nUpdate();
|
|
14093
14409
|
}
|
|
14094
|
-
this.value =
|
|
14410
|
+
this.value = [];
|
|
14095
14411
|
this.updateToolBarState();
|
|
14096
14412
|
}
|
|
14097
14413
|
/**
|
|
@@ -14371,9 +14687,7 @@ let ListBox = ListBox_1 = class ListBox extends DropDownBase {
|
|
|
14371
14687
|
prepend([this.filterParent], this.list);
|
|
14372
14688
|
attributes(this.filterInput, {
|
|
14373
14689
|
'aria-disabled': 'false',
|
|
14374
|
-
'aria-
|
|
14375
|
-
'role': 'listbox',
|
|
14376
|
-
'aria-activedescendant': null,
|
|
14690
|
+
'aria-label': 'search list item',
|
|
14377
14691
|
'autocomplete': 'off',
|
|
14378
14692
|
'autocorrect': 'off',
|
|
14379
14693
|
'autocapitalize': 'off',
|
|
@@ -14410,12 +14724,12 @@ let ListBox = ListBox_1 = class ListBox extends DropDownBase {
|
|
|
14410
14724
|
if (li && li.parentElement) {
|
|
14411
14725
|
currSelIdx = [].slice.call(li.parentElement.children).indexOf(li);
|
|
14412
14726
|
if (!this.selectionSettings.showCheckbox) {
|
|
14413
|
-
if ((e.ctrlKey || Browser.isDevice) && this.isSelected(li)) {
|
|
14727
|
+
if ((e.ctrlKey || e.metaKey || Browser.isDevice) && this.isSelected(li)) {
|
|
14414
14728
|
li.classList.remove(cssClass.selected);
|
|
14415
14729
|
li.removeAttribute('aria-selected');
|
|
14416
14730
|
isSelect = false;
|
|
14417
14731
|
}
|
|
14418
|
-
else if (!(this.selectionSettings.mode === 'Multiple' && (e.ctrlKey || Browser.isDevice))) {
|
|
14732
|
+
else if (!(this.selectionSettings.mode === 'Multiple' && (e.ctrlKey || e.metaKey || Browser.isDevice))) {
|
|
14419
14733
|
this.getSelectedItems().forEach((ele) => {
|
|
14420
14734
|
ele.removeAttribute('aria-selected');
|
|
14421
14735
|
});
|
|
@@ -14697,7 +15011,7 @@ let ListBox = ListBox_1 = class ListBox extends DropDownBase {
|
|
|
14697
15011
|
});
|
|
14698
15012
|
if (isRefresh) {
|
|
14699
15013
|
if (fListBox.fields.groupBy) {
|
|
14700
|
-
|
|
15014
|
+
const sourceElem = fListBox.renderItems(listData, fListBox.fields);
|
|
14701
15015
|
fListBox.updateListItems(sourceElem, fListBox.ulElement);
|
|
14702
15016
|
}
|
|
14703
15017
|
else {
|
|
@@ -14730,7 +15044,7 @@ let ListBox = ListBox_1 = class ListBox extends DropDownBase {
|
|
|
14730
15044
|
tListBox.jsonData = tJsonData;
|
|
14731
15045
|
tListBox.sortedData = tSortData;
|
|
14732
15046
|
if (isRefresh) {
|
|
14733
|
-
|
|
15047
|
+
const sourceElem = tListBox.renderItems(tListData, tListBox.fields);
|
|
14734
15048
|
tListBox.updateListItems(sourceElem, tListBox.ulElement);
|
|
14735
15049
|
tListBox.setSelection();
|
|
14736
15050
|
fListBox.trigger('actionComplete', { items: tempItems, eventName: this.toolbarAction });
|
|
@@ -14770,7 +15084,7 @@ let ListBox = ListBox_1 = class ListBox extends DropDownBase {
|
|
|
14770
15084
|
const isRefresh = tListBox.sortOrder !== 'None' || (tListBox.selectionSettings.showCheckbox !==
|
|
14771
15085
|
fListBox.selectionSettings.showCheckbox) || tListBox.fields.groupBy || tListBox.itemTemplate || fListBox.itemTemplate;
|
|
14772
15086
|
this.removeSelected(fListBox, fListBox.getSelectedItems());
|
|
14773
|
-
const tempItems = [].slice.call(fListBox.
|
|
15087
|
+
const tempItems = [].slice.call(fListBox.listData);
|
|
14774
15088
|
const localDataArgs = { cancel: false, items: tempItems, eventName: this.toolbarAction };
|
|
14775
15089
|
fListBox.trigger('actionBegin', localDataArgs);
|
|
14776
15090
|
if (localDataArgs.cancel) {
|
|
@@ -14815,12 +15129,18 @@ let ListBox = ListBox_1 = class ListBox extends DropDownBase {
|
|
|
14815
15129
|
fListBox.value = [];
|
|
14816
15130
|
listData = listData
|
|
14817
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
|
+
}
|
|
14818
15139
|
tListBox.listData = listData;
|
|
14819
|
-
|
|
14820
|
-
if (this.listData.length == this.jsonData.length) {
|
|
15140
|
+
if (fListBox.listData.length === fListBox.jsonData.length) {
|
|
14821
15141
|
fListBox.listData = fListBox.sortedData = fListBox.jsonData = [];
|
|
14822
15142
|
}
|
|
14823
|
-
else if (
|
|
15143
|
+
else if (fListBox.allowFiltering) {
|
|
14824
15144
|
for (let i = 0; i < fListBox.listData.length; i++) {
|
|
14825
15145
|
for (let j = 0; j < fListBox.jsonData.length; j++) {
|
|
14826
15146
|
if (fListBox.listData[i] === fListBox.jsonData[j]) {
|
|
@@ -14831,7 +15151,7 @@ let ListBox = ListBox_1 = class ListBox extends DropDownBase {
|
|
|
14831
15151
|
fListBox.listData = fListBox.sortedData = [];
|
|
14832
15152
|
}
|
|
14833
15153
|
if (isRefresh) {
|
|
14834
|
-
|
|
15154
|
+
const sourceElem = tListBox.renderItems(listData, tListBox.fields);
|
|
14835
15155
|
tListBox.updateListItems(sourceElem, tListBox.ulElement);
|
|
14836
15156
|
this.trigger('actionComplete', { items: tempItems, eventName: this.toolbarAction });
|
|
14837
15157
|
}
|
|
@@ -14882,21 +15202,35 @@ let ListBox = ListBox_1 = class ListBox extends DropDownBase {
|
|
|
14882
15202
|
}
|
|
14883
15203
|
return listObj;
|
|
14884
15204
|
}
|
|
14885
|
-
getGrabbedItems() {
|
|
15205
|
+
getGrabbedItems(args) {
|
|
15206
|
+
let grabbItems = false;
|
|
14886
15207
|
for (let i = 0; i < this.value.length; i++) {
|
|
14887
|
-
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++) {
|
|
14888
15215
|
const liColl = this.list.querySelectorAll('[aria-selected="true"]');
|
|
14889
|
-
for (let
|
|
14890
|
-
|
|
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
|
+
}
|
|
14891
15220
|
}
|
|
14892
|
-
break;
|
|
14893
15221
|
}
|
|
14894
15222
|
}
|
|
14895
|
-
|
|
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
|
+
}
|
|
14896
15230
|
return elems;
|
|
14897
15231
|
}
|
|
14898
15232
|
getDragArgs(args, isDragEnd) {
|
|
14899
|
-
let elems = this.getGrabbedItems();
|
|
15233
|
+
let elems = this.getGrabbedItems(args);
|
|
14900
15234
|
if (elems.length) {
|
|
14901
15235
|
if (isDragEnd) {
|
|
14902
15236
|
elems.push(args.target);
|
|
@@ -14948,7 +15282,7 @@ let ListBox = ListBox_1 = class ListBox extends DropDownBase {
|
|
|
14948
15282
|
}
|
|
14949
15283
|
}
|
|
14950
15284
|
}
|
|
14951
|
-
else if (e.keyCode !== 37 && e.keyCode !== 39 && e.code !==
|
|
15285
|
+
else if (e.keyCode !== 37 && e.keyCode !== 39 && e.code !== 'KeyA') {
|
|
14952
15286
|
this.upDownKeyHandler(e);
|
|
14953
15287
|
}
|
|
14954
15288
|
}
|
|
@@ -14991,9 +15325,9 @@ let ListBox = ListBox_1 = class ListBox extends DropDownBase {
|
|
|
14991
15325
|
this.selectHandler({ target: ul.children[fliIdx], ctrlKey: e.ctrlKey, shiftKey: e.shiftKey }, true);
|
|
14992
15326
|
}
|
|
14993
15327
|
if (this.selectionSettings.showCheckbox && e.ctrlKey && e.shiftKey && (e.keyCode === 36 || e.keyCode === 35)) {
|
|
14994
|
-
|
|
14995
|
-
|
|
14996
|
-
|
|
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;
|
|
14997
15331
|
for (let i = sidx; i <= eidx; i++) {
|
|
14998
15332
|
const item = ul.children[i];
|
|
14999
15333
|
this.notify('updatelist', { li: item, e: {
|
|
@@ -15147,7 +15481,6 @@ let ListBox = ListBox_1 = class ListBox extends DropDownBase {
|
|
|
15147
15481
|
dvalue = this.getFormattedValue(li.getAttribute('data-value'));
|
|
15148
15482
|
if (values.indexOf(dvalue) < 0) {
|
|
15149
15483
|
li.getElementsByClassName('e-check')[0].classList.remove('e-check');
|
|
15150
|
-
li.getElementsByClassName('e-checkbox-wrapper')[0].removeAttribute('aria-checked');
|
|
15151
15484
|
li.removeAttribute('aria-selected');
|
|
15152
15485
|
}
|
|
15153
15486
|
});
|
|
@@ -15165,6 +15498,9 @@ let ListBox = ListBox_1 = class ListBox extends DropDownBase {
|
|
|
15165
15498
|
else {
|
|
15166
15499
|
text = value;
|
|
15167
15500
|
}
|
|
15501
|
+
if (typeof (text) === 'string') {
|
|
15502
|
+
text = text.split("\\").join("\\\\");
|
|
15503
|
+
}
|
|
15168
15504
|
li = this.list.querySelector('[data-value="' + text + '"]');
|
|
15169
15505
|
if (li) {
|
|
15170
15506
|
if (this.selectionSettings.showCheckbox) {
|
|
@@ -15493,6 +15829,12 @@ __decorate$6([
|
|
|
15493
15829
|
__decorate$6([
|
|
15494
15830
|
Property('')
|
|
15495
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);
|
|
15496
15838
|
__decorate$6([
|
|
15497
15839
|
Property(false)
|
|
15498
15840
|
], ListBox.prototype, "allowDragAndDrop", void 0);
|
|
@@ -15567,6 +15909,1444 @@ const listBoxClasses = {
|
|
|
15567
15909
|
clearIcon: 'e-clear-icon'
|
|
15568
15910
|
};
|
|
15569
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
|
+
|
|
15570
17350
|
/**
|
|
15571
17351
|
* export all modules from current location
|
|
15572
17352
|
*/
|
|
@@ -15575,5 +17355,5 @@ const listBoxClasses = {
|
|
|
15575
17355
|
* export all modules from current location
|
|
15576
17356
|
*/
|
|
15577
17357
|
|
|
15578
|
-
export { incrementalSearch, Search, escapeCharRegExp, resetIncrementalSearchValues, highlightSearch, revertHighlightSearch, FieldSettings, dropDownBaseClasses, DropDownBase, dropDownListClasses, DropDownList, Fields, TreeSettings, DropDownTree, ComboBox, AutoComplete, MultiSelect, CheckBoxSelection, createFloatLabel, updateFloatLabelState, removeFloating, setPlaceHolder, floatLabelFocus, floatLabelBlur, encodePlaceholder, SelectionSettings, ToolbarSettings, ListBox };
|
|
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 };
|
|
15579
17359
|
//# sourceMappingURL=ej2-dropdowns.es2015.js.map
|