@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
|
var queryString = '';
|
|
13
10
|
var prevString = '';
|
|
14
11
|
var 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
|
var listItems = items;
|
|
86
83
|
ignoreCase = ignoreCase !== undefined && ignoreCase !== null ? ignoreCase : true;
|
|
87
84
|
var itemData = { item: null, index: null };
|
|
@@ -89,14 +86,32 @@ function Search(inputVal, items, searchType, ignoreCase) {
|
|
|
89
86
|
var strLength = inputVal.length;
|
|
90
87
|
var queryStr = ignoreCase ? inputVal.toLocaleLowerCase() : inputVal;
|
|
91
88
|
queryStr = escapeCharRegExp(queryStr);
|
|
92
|
-
|
|
89
|
+
var _loop_1 = function (i, itemsData) {
|
|
93
90
|
var item = itemsData[i];
|
|
94
|
-
var text =
|
|
91
|
+
var text = void 0;
|
|
92
|
+
var filterValue;
|
|
93
|
+
if (items && dataSource) {
|
|
94
|
+
var checkField_1 = item;
|
|
95
|
+
var fieldValue_1 = fields.text.split('.');
|
|
96
|
+
dataSource.filter(function (data) {
|
|
97
|
+
Array.prototype.slice.call(fieldValue_1).forEach(function (value) {
|
|
98
|
+
if (type === 'object' && checkField_1.textContent.toString().indexOf(data[value]) !== -1 && checkField_1.getAttribute('data-value') === data[fields.value] || type === 'string' && checkField_1.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;
|
|
98
|
-
return { item: item, index: i };
|
|
108
|
+
return { value: { item: item, index: i } };
|
|
99
109
|
}
|
|
110
|
+
};
|
|
111
|
+
for (var i = 0, itemsData = listItems; i < itemsData.length; i++) {
|
|
112
|
+
var state_1 = _loop_1(i, itemsData);
|
|
113
|
+
if (typeof state_1 === "object")
|
|
114
|
+
return state_1.value;
|
|
100
115
|
}
|
|
101
116
|
return itemData;
|
|
102
117
|
}
|
|
@@ -232,6 +247,8 @@ var dropDownBaseClasses = {
|
|
|
232
247
|
grouping: 'e-dd-group'
|
|
233
248
|
};
|
|
234
249
|
var ITEMTEMPLATE_PROPERTY = 'ItemTemplate';
|
|
250
|
+
var DISPLAYTEMPLATE_PROPERTY = 'DisplayTemplate';
|
|
251
|
+
var SPINNERTEMPLATE_PROPERTY = 'SpinnerTemplate';
|
|
235
252
|
var VALUETEMPLATE_PROPERTY = 'ValueTemplate';
|
|
236
253
|
var GROUPTEMPLATE_PROPERTY = 'GroupTemplate';
|
|
237
254
|
var HEADERTEMPLATE_PROPERTY = 'HeaderTemplate';
|
|
@@ -257,6 +274,7 @@ var DropDownBase = /** @__PURE__ @class */ (function (_super) {
|
|
|
257
274
|
_this.isAngular = false;
|
|
258
275
|
_this.isPreventChange = false;
|
|
259
276
|
_this.isDynamicDataChange = false;
|
|
277
|
+
_this.addedNewItem = false;
|
|
260
278
|
return _this;
|
|
261
279
|
}
|
|
262
280
|
DropDownBase.prototype.getPropObject = function (prop, newProp, oldProp) {
|
|
@@ -428,7 +446,8 @@ var DropDownBase = /** @__PURE__ @class */ (function (_super) {
|
|
|
428
446
|
this.l10n = componentLocale;
|
|
429
447
|
}
|
|
430
448
|
else {
|
|
431
|
-
this.l10n = new L10n(this.getModuleName() === 'listbox' ? 'listbox' :
|
|
449
|
+
this.l10n = new L10n(this.getModuleName() === 'listbox' ? 'listbox' :
|
|
450
|
+
this.getModuleName() === 'mention' ? 'mention' : 'dropdowns', l10nLocale, this.locale);
|
|
432
451
|
}
|
|
433
452
|
var content = actionFailure ?
|
|
434
453
|
this.l10n.getConstant('actionFailureTemplate') : this.l10n.getConstant('noRecordsTemplate');
|
|
@@ -437,9 +456,12 @@ var DropDownBase = /** @__PURE__ @class */ (function (_super) {
|
|
|
437
456
|
liElem.textContent = content;
|
|
438
457
|
ele.appendChild(liElem);
|
|
439
458
|
liElem.classList.add('e-list-nrt');
|
|
459
|
+
liElem.setAttribute('role', 'option');
|
|
440
460
|
}
|
|
441
461
|
else {
|
|
442
|
-
ele
|
|
462
|
+
if (!isNullOrUndefined(ele)) {
|
|
463
|
+
ele.innerHTML = content;
|
|
464
|
+
}
|
|
443
465
|
}
|
|
444
466
|
}
|
|
445
467
|
};
|
|
@@ -470,14 +492,16 @@ var DropDownBase = /** @__PURE__ @class */ (function (_super) {
|
|
|
470
492
|
* @returns {void}
|
|
471
493
|
*/
|
|
472
494
|
DropDownBase.prototype.setEnableRtl = function () {
|
|
473
|
-
if (this.
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
495
|
+
if (!isNullOrUndefined(this.enableRtlElements)) {
|
|
496
|
+
if (this.list) {
|
|
497
|
+
this.enableRtlElements.push(this.list);
|
|
498
|
+
}
|
|
499
|
+
if (this.enableRtl) {
|
|
500
|
+
addClass(this.enableRtlElements, dropDownBaseClasses.rtl);
|
|
501
|
+
}
|
|
502
|
+
else {
|
|
503
|
+
removeClass(this.enableRtlElements, dropDownBaseClasses.rtl);
|
|
504
|
+
}
|
|
481
505
|
}
|
|
482
506
|
};
|
|
483
507
|
/**
|
|
@@ -485,7 +509,7 @@ var DropDownBase = /** @__PURE__ @class */ (function (_super) {
|
|
|
485
509
|
*
|
|
486
510
|
* @returns {void}
|
|
487
511
|
*/
|
|
488
|
-
DropDownBase.prototype.initialize = function () {
|
|
512
|
+
DropDownBase.prototype.initialize = function (e) {
|
|
489
513
|
this.bindEvent = true;
|
|
490
514
|
this.actionFailureTemplateId = "" + this.element.id + ACTIONFAILURETEMPLATE_PROPERTY;
|
|
491
515
|
if (this.element.tagName === 'UL') {
|
|
@@ -504,7 +528,7 @@ var DropDownBase = /** @__PURE__ @class */ (function (_super) {
|
|
|
504
528
|
}
|
|
505
529
|
}
|
|
506
530
|
else {
|
|
507
|
-
this.setListData(this.dataSource, this.fields, this.query);
|
|
531
|
+
this.setListData(this.dataSource, this.fields, this.query, e);
|
|
508
532
|
}
|
|
509
533
|
};
|
|
510
534
|
/**
|
|
@@ -515,14 +539,6 @@ var DropDownBase = /** @__PURE__ @class */ (function (_super) {
|
|
|
515
539
|
DropDownBase.prototype.getPersistData = function () {
|
|
516
540
|
return this.addOnPersist([]);
|
|
517
541
|
};
|
|
518
|
-
/**
|
|
519
|
-
* Sets the enabled state to DropDownBase.
|
|
520
|
-
*
|
|
521
|
-
* @returns {void}
|
|
522
|
-
*/
|
|
523
|
-
DropDownBase.prototype.setEnabled = function () {
|
|
524
|
-
this.element.setAttribute('aria-disabled', (this.enabled) ? 'false' : 'true');
|
|
525
|
-
};
|
|
526
542
|
/**
|
|
527
543
|
* Sets the enabled state to DropDownBase.
|
|
528
544
|
*
|
|
@@ -530,7 +546,7 @@ var DropDownBase = /** @__PURE__ @class */ (function (_super) {
|
|
|
530
546
|
* @returns {void}
|
|
531
547
|
*/
|
|
532
548
|
DropDownBase.prototype.updateDataAttribute = function (value) {
|
|
533
|
-
var invalidAttr = ['class', 'style', 'id', 'type'];
|
|
549
|
+
var invalidAttr = ['class', 'style', 'id', 'type', 'aria-expanded', 'aria-autocomplete', 'aria-readonly'];
|
|
534
550
|
var attr = {};
|
|
535
551
|
for (var a = 0; a < this.element.attributes.length; a++) {
|
|
536
552
|
if (invalidAttr.indexOf(this.element.attributes[a].name) === -1 &&
|
|
@@ -598,6 +614,8 @@ var DropDownBase = /** @__PURE__ @class */ (function (_super) {
|
|
|
598
614
|
this.isRequested = false;
|
|
599
615
|
this.isDataFetched = false;
|
|
600
616
|
this.itemTemplateId = "" + this.element.id + ITEMTEMPLATE_PROPERTY;
|
|
617
|
+
this.displayTemplateId = "" + this.element.id + DISPLAYTEMPLATE_PROPERTY;
|
|
618
|
+
this.spinnerTemplateId = "" + this.element.id + SPINNERTEMPLATE_PROPERTY;
|
|
601
619
|
this.valueTemplateId = "" + this.element.id + VALUETEMPLATE_PROPERTY;
|
|
602
620
|
this.groupTemplateId = "" + this.element.id + GROUPTEMPLATE_PROPERTY;
|
|
603
621
|
this.headerTemplateId = "" + this.element.id + HEADERTEMPLATE_PROPERTY;
|
|
@@ -612,7 +630,7 @@ var DropDownBase = /** @__PURE__ @class */ (function (_super) {
|
|
|
612
630
|
* @param {Query} query - Accepts the external Query that execute along with data processing.
|
|
613
631
|
* @returns {void}
|
|
614
632
|
*/
|
|
615
|
-
DropDownBase.prototype.setListData = function (dataSource, fields, query) {
|
|
633
|
+
DropDownBase.prototype.setListData = function (dataSource, fields, query, event) {
|
|
616
634
|
var _this = this;
|
|
617
635
|
fields = fields ? fields : this.fields;
|
|
618
636
|
var ulElement;
|
|
@@ -637,10 +655,10 @@ var DropDownBase = /** @__PURE__ @class */ (function (_super) {
|
|
|
637
655
|
_this.isDataFetched = true;
|
|
638
656
|
}
|
|
639
657
|
ulElement = _this.renderItems(listItems, fields);
|
|
658
|
+
_this.onActionComplete(ulElement, listItems, e);
|
|
640
659
|
if (_this.groupTemplate) {
|
|
641
660
|
_this.renderGroupTemplate(ulElement);
|
|
642
661
|
}
|
|
643
|
-
_this.onActionComplete(ulElement, listItems, e);
|
|
644
662
|
_this.isRequested = false;
|
|
645
663
|
_this.bindChildItems(listItems, ulElement, fields, e);
|
|
646
664
|
}
|
|
@@ -659,7 +677,7 @@ var DropDownBase = /** @__PURE__ @class */ (function (_super) {
|
|
|
659
677
|
_this.trigger('actionComplete', localDataArgs, function (localDataArgs) {
|
|
660
678
|
if (!localDataArgs.cancel) {
|
|
661
679
|
ulElement = _this.renderItems(localDataArgs.result, fields);
|
|
662
|
-
_this.onActionComplete(ulElement, localDataArgs.result);
|
|
680
|
+
_this.onActionComplete(ulElement, localDataArgs.result, event);
|
|
663
681
|
if (_this.groupTemplate) {
|
|
664
682
|
_this.renderGroupTemplate(ulElement);
|
|
665
683
|
}
|
|
@@ -742,7 +760,9 @@ var DropDownBase = /** @__PURE__ @class */ (function (_super) {
|
|
|
742
760
|
this.liCollections = [];
|
|
743
761
|
this.trigger('actionFailure', e);
|
|
744
762
|
this.l10nUpdate(true);
|
|
745
|
-
|
|
763
|
+
if (!isNullOrUndefined(this.list)) {
|
|
764
|
+
addClass([this.list], dropDownBaseClasses.noData);
|
|
765
|
+
}
|
|
746
766
|
};
|
|
747
767
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
748
768
|
DropDownBase.prototype.onActionComplete = function (ulElement, list, e) {
|
|
@@ -869,18 +889,22 @@ var DropDownBase = /** @__PURE__ @class */ (function (_super) {
|
|
|
869
889
|
return extend({}, options, fields, true);
|
|
870
890
|
};
|
|
871
891
|
DropDownBase.prototype.setFloatingHeader = function (e) {
|
|
872
|
-
if (isNullOrUndefined(this.
|
|
873
|
-
this.fixedHeaderElement
|
|
874
|
-
|
|
875
|
-
this.
|
|
892
|
+
if (!isNullOrUndefined(this.list) && !this.list.classList.contains(dropDownBaseClasses.noData)) {
|
|
893
|
+
if (isNullOrUndefined(this.fixedHeaderElement)) {
|
|
894
|
+
this.fixedHeaderElement = this.createElement('div', { className: dropDownBaseClasses.fixedHead });
|
|
895
|
+
if (!isNullOrUndefined(this.list) && !this.list.querySelector('li').classList.contains(dropDownBaseClasses.group)) {
|
|
896
|
+
this.fixedHeaderElement.style.display = 'none';
|
|
897
|
+
}
|
|
898
|
+
if (!isNullOrUndefined(this.fixedHeaderElement) && !isNullOrUndefined(this.list)) {
|
|
899
|
+
prepend([this.fixedHeaderElement], this.list);
|
|
900
|
+
}
|
|
901
|
+
this.setFixedHeader();
|
|
876
902
|
}
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
this.setFixedHeader();
|
|
903
|
+
if (!isNullOrUndefined(this.fixedHeaderElement) && this.fixedHeaderElement.style.zIndex === '0') {
|
|
904
|
+
this.setFixedHeader();
|
|
905
|
+
}
|
|
906
|
+
this.scrollStop(e);
|
|
882
907
|
}
|
|
883
|
-
this.scrollStop(e);
|
|
884
908
|
};
|
|
885
909
|
DropDownBase.prototype.scrollStop = function (e) {
|
|
886
910
|
var target = !isNullOrUndefined(e) ? e.target : this.list;
|
|
@@ -964,7 +988,9 @@ var DropDownBase = /** @__PURE__ @class */ (function (_super) {
|
|
|
964
988
|
return item;
|
|
965
989
|
};
|
|
966
990
|
DropDownBase.prototype.setFixedHeader = function () {
|
|
967
|
-
this.list
|
|
991
|
+
if (!isNullOrUndefined(this.list)) {
|
|
992
|
+
this.list.parentElement.style.display = 'block';
|
|
993
|
+
}
|
|
968
994
|
var borderWidth = 0;
|
|
969
995
|
if (this.list && this.list.parentElement) {
|
|
970
996
|
borderWidth = parseInt(document.defaultView.getComputedStyle(this.list.parentElement, null).getPropertyValue('border-width'), 10);
|
|
@@ -979,8 +1005,10 @@ var DropDownBase = /** @__PURE__ @class */ (function (_super) {
|
|
|
979
1005
|
borderWidth = (borderTopWidth + borderBottomWidth + borderLeftWidth + borderRightWidth);
|
|
980
1006
|
}
|
|
981
1007
|
}
|
|
982
|
-
|
|
983
|
-
|
|
1008
|
+
if (!isNullOrUndefined(this.liCollections)) {
|
|
1009
|
+
var liWidth = this.getValidLi().offsetWidth - borderWidth;
|
|
1010
|
+
this.fixedHeaderElement.style.width = liWidth.toString() + 'px';
|
|
1011
|
+
}
|
|
984
1012
|
setStyleAttribute(this.fixedHeaderElement, { zIndex: 10 });
|
|
985
1013
|
var firstLi = this.ulElement.querySelector('.' + dropDownBaseClasses.group + ':not(.e-hide-listitem)');
|
|
986
1014
|
this.fixedHeaderElement.innerHTML = firstLi.innerHTML;
|
|
@@ -1049,7 +1077,7 @@ var DropDownBase = /** @__PURE__ @class */ (function (_super) {
|
|
|
1049
1077
|
* @param {Query} query - Accepts the external Query that execute along with data processing.
|
|
1050
1078
|
* @returns {void}
|
|
1051
1079
|
*/
|
|
1052
|
-
DropDownBase.prototype.resetList = function (dataSource, fields, query) {
|
|
1080
|
+
DropDownBase.prototype.resetList = function (dataSource, fields, query, e) {
|
|
1053
1081
|
if (this.list) {
|
|
1054
1082
|
if ((this.element.tagName === 'SELECT' && this.element.options.length > 0)
|
|
1055
1083
|
|| (this.element.tagName === 'UL' && this.element.childNodes.length > 0)) {
|
|
@@ -1059,8 +1087,9 @@ var DropDownBase = /** @__PURE__ @class */ (function (_super) {
|
|
|
1059
1087
|
dataSource = this.selectData;
|
|
1060
1088
|
}
|
|
1061
1089
|
}
|
|
1062
|
-
dataSource = this.getModuleName() === 'combobox' && this.selectData && dataSource instanceof Array && dataSource.length < this.selectData.length ? this.selectData : dataSource;
|
|
1063
|
-
this.
|
|
1090
|
+
dataSource = this.getModuleName() === 'combobox' && this.selectData && dataSource instanceof Array && dataSource.length < this.selectData.length && this.addedNewItem ? this.selectData : dataSource;
|
|
1091
|
+
this.addedNewItem = false;
|
|
1092
|
+
this.setListData(dataSource, fields, query, e);
|
|
1064
1093
|
}
|
|
1065
1094
|
};
|
|
1066
1095
|
DropDownBase.prototype.updateSelectElementData = function (isFiltering) {
|
|
@@ -1123,9 +1152,6 @@ var DropDownBase = /** @__PURE__ @class */ (function (_super) {
|
|
|
1123
1152
|
case 'enableRtl':
|
|
1124
1153
|
this.setEnableRtl();
|
|
1125
1154
|
break;
|
|
1126
|
-
case 'enabled':
|
|
1127
|
-
this.setEnabled();
|
|
1128
|
-
break;
|
|
1129
1155
|
case 'groupTemplate':
|
|
1130
1156
|
this.renderGroupTemplate(this.list);
|
|
1131
1157
|
if (this.ulElement && this.fixedHeaderElement) {
|
|
@@ -1152,7 +1178,7 @@ var DropDownBase = /** @__PURE__ @class */ (function (_super) {
|
|
|
1152
1178
|
* @private
|
|
1153
1179
|
* @returns {void}
|
|
1154
1180
|
*/
|
|
1155
|
-
DropDownBase.prototype.render = function (isEmptyData) {
|
|
1181
|
+
DropDownBase.prototype.render = function (e, isEmptyData) {
|
|
1156
1182
|
this.list = this.createElement('div', { className: dropDownBaseClasses.content, attrs: { 'tabindex': '0' } });
|
|
1157
1183
|
this.list.classList.add(dropDownBaseClasses.root);
|
|
1158
1184
|
this.setFields();
|
|
@@ -1174,9 +1200,8 @@ var DropDownBase = /** @__PURE__ @class */ (function (_super) {
|
|
|
1174
1200
|
wrapperElement.appendChild(this.list);
|
|
1175
1201
|
}
|
|
1176
1202
|
this.setEnableRtl();
|
|
1177
|
-
this.setEnabled();
|
|
1178
1203
|
if (!isEmptyData) {
|
|
1179
|
-
this.initialize();
|
|
1204
|
+
this.initialize(e);
|
|
1180
1205
|
}
|
|
1181
1206
|
};
|
|
1182
1207
|
/**
|
|
@@ -1202,7 +1227,7 @@ var DropDownBase = /** @__PURE__ @class */ (function (_super) {
|
|
|
1202
1227
|
* Adds a new item to the popup list. By default, new item appends to the list as the last item,
|
|
1203
1228
|
* but you can insert based on the index parameter.
|
|
1204
1229
|
*
|
|
1205
|
-
* @param
|
|
1230
|
+
* @param { Object[] } items - Specifies an array of JSON data or a JSON data.
|
|
1206
1231
|
* @param { number } itemIndex - Specifies the index to place the newly added item in the popup list.
|
|
1207
1232
|
* @returns {void}
|
|
1208
1233
|
* @deprecated
|
|
@@ -1266,11 +1291,17 @@ var DropDownBase = /** @__PURE__ @class */ (function (_super) {
|
|
|
1266
1291
|
this.trigger('beforeItemRender', { element: li, item: item });
|
|
1267
1292
|
}
|
|
1268
1293
|
if (itemsCount === 0 && isNullOrUndefined(this.list.querySelector('ul'))) {
|
|
1269
|
-
this.list
|
|
1270
|
-
|
|
1271
|
-
|
|
1294
|
+
if (!isNullOrUndefined(this.list)) {
|
|
1295
|
+
this.list.innerHTML = '';
|
|
1296
|
+
this.list.classList.remove(dropDownBaseClasses.noData);
|
|
1297
|
+
if (!isNullOrUndefined(this.ulElement)) {
|
|
1298
|
+
this.list.appendChild(this.ulElement);
|
|
1299
|
+
}
|
|
1300
|
+
}
|
|
1272
1301
|
this.liCollections = liCollections;
|
|
1273
|
-
|
|
1302
|
+
if (!isNullOrUndefined(liCollections) && !isNullOrUndefined(this.ulElement)) {
|
|
1303
|
+
append(liCollections, this.ulElement);
|
|
1304
|
+
}
|
|
1274
1305
|
this.updateAddItemList(this.list, itemsCount);
|
|
1275
1306
|
}
|
|
1276
1307
|
else {
|
|
@@ -1317,6 +1348,7 @@ var DropDownBase = /** @__PURE__ @class */ (function (_super) {
|
|
|
1317
1348
|
if (selectedItemValue || itemIndex === 0) {
|
|
1318
1349
|
this.updateSelection();
|
|
1319
1350
|
}
|
|
1351
|
+
this.addedNewItem = true;
|
|
1320
1352
|
};
|
|
1321
1353
|
DropDownBase.prototype.validationAttribute = function (target, hidden) {
|
|
1322
1354
|
var name = target.getAttribute('name') ? target.getAttribute('name') : target.getAttribute('id');
|
|
@@ -1390,14 +1422,16 @@ var DropDownBase = /** @__PURE__ @class */ (function (_super) {
|
|
|
1390
1422
|
}
|
|
1391
1423
|
detach(this.list);
|
|
1392
1424
|
}
|
|
1425
|
+
this.liCollections = null;
|
|
1426
|
+
this.ulElement = null;
|
|
1427
|
+
this.list = null;
|
|
1428
|
+
this.enableRtlElements = null;
|
|
1429
|
+
this.rippleFun = null;
|
|
1393
1430
|
_super.prototype.destroy.call(this);
|
|
1394
1431
|
};
|
|
1395
1432
|
__decorate([
|
|
1396
1433
|
Complex({ text: null, value: null, iconCss: null, groupBy: null }, FieldSettings)
|
|
1397
1434
|
], DropDownBase.prototype, "fields", void 0);
|
|
1398
|
-
__decorate([
|
|
1399
|
-
Property(false)
|
|
1400
|
-
], DropDownBase.prototype, "enablePersistence", void 0);
|
|
1401
1435
|
__decorate([
|
|
1402
1436
|
Property(null)
|
|
1403
1437
|
], DropDownBase.prototype, "itemTemplate", void 0);
|
|
@@ -1413,9 +1447,6 @@ var DropDownBase = /** @__PURE__ @class */ (function (_super) {
|
|
|
1413
1447
|
__decorate([
|
|
1414
1448
|
Property('None')
|
|
1415
1449
|
], DropDownBase.prototype, "sortOrder", void 0);
|
|
1416
|
-
__decorate([
|
|
1417
|
-
Property(true)
|
|
1418
|
-
], DropDownBase.prototype, "enabled", void 0);
|
|
1419
1450
|
__decorate([
|
|
1420
1451
|
Property([])
|
|
1421
1452
|
], DropDownBase.prototype, "dataSource", void 0);
|
|
@@ -1611,8 +1642,8 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
1611
1642
|
this.popupObj.setProperties({ 'zIndex': this.zIndex });
|
|
1612
1643
|
}
|
|
1613
1644
|
};
|
|
1614
|
-
DropDownList.prototype.renderList = function (isEmptyData) {
|
|
1615
|
-
_super.prototype.render.call(this, isEmptyData);
|
|
1645
|
+
DropDownList.prototype.renderList = function (e, isEmptyData) {
|
|
1646
|
+
_super.prototype.render.call(this, e, isEmptyData);
|
|
1616
1647
|
this.unWireListEvents();
|
|
1617
1648
|
this.wireListEvents();
|
|
1618
1649
|
};
|
|
@@ -1644,6 +1675,7 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
1644
1675
|
}
|
|
1645
1676
|
};
|
|
1646
1677
|
DropDownList.prototype.clearAll = function (e, properties) {
|
|
1678
|
+
this.previousItemData = (!isNullOrUndefined(this.itemData)) ? this.itemData : null;
|
|
1647
1679
|
if (isNullOrUndefined(properties) || (!isNullOrUndefined(properties) &&
|
|
1648
1680
|
(isNullOrUndefined(properties.dataSource) ||
|
|
1649
1681
|
(!(properties.dataSource instanceof DataManager) && properties.dataSource.length === 0)))) {
|
|
@@ -1669,14 +1701,18 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
1669
1701
|
}
|
|
1670
1702
|
else {
|
|
1671
1703
|
if (this.allowFiltering && this.getModuleName() !== 'autocomplete'
|
|
1672
|
-
&& !isNullOrUndefined(this.actionCompleteData.ulElement) && !isNullOrUndefined(this.actionCompleteData.list)) {
|
|
1704
|
+
&& !isNullOrUndefined(this.actionCompleteData.ulElement) && !isNullOrUndefined(this.actionCompleteData.list) && this.actionCompleteData.list.length > 0) {
|
|
1673
1705
|
this.onActionComplete(this.actionCompleteData.ulElement.cloneNode(true), this.actionCompleteData.list);
|
|
1674
1706
|
}
|
|
1675
1707
|
this.resetFocusElement();
|
|
1676
1708
|
}
|
|
1677
1709
|
}
|
|
1678
|
-
this.hiddenElement
|
|
1679
|
-
|
|
1710
|
+
if (!isNullOrUndefined(this.hiddenElement)) {
|
|
1711
|
+
this.hiddenElement.innerHTML = '';
|
|
1712
|
+
}
|
|
1713
|
+
if (!isNullOrUndefined(this.inputElement)) {
|
|
1714
|
+
this.inputElement.value = '';
|
|
1715
|
+
}
|
|
1680
1716
|
this.value = null;
|
|
1681
1717
|
this.itemData = null;
|
|
1682
1718
|
this.text = null;
|
|
@@ -1699,42 +1735,42 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
1699
1735
|
for (var _i = 0, _a = Object.keys(this.htmlAttributes); _i < _a.length; _i++) {
|
|
1700
1736
|
var htmlAttr = _a[_i];
|
|
1701
1737
|
if (htmlAttr === 'class') {
|
|
1702
|
-
var updatedClassValue = (this.htmlAttributes[htmlAttr].replace(/\s+/g, ' ')).trim();
|
|
1738
|
+
var updatedClassValue = (this.htmlAttributes["" + htmlAttr].replace(/\s+/g, ' ')).trim();
|
|
1703
1739
|
if (updatedClassValue !== '') {
|
|
1704
1740
|
addClass([this.inputWrapper.container], updatedClassValue.split(' '));
|
|
1705
1741
|
}
|
|
1706
1742
|
}
|
|
1707
|
-
else if (htmlAttr === 'disabled' && this.htmlAttributes[htmlAttr] === 'disabled') {
|
|
1743
|
+
else if (htmlAttr === 'disabled' && this.htmlAttributes["" + htmlAttr] === 'disabled') {
|
|
1708
1744
|
this.enabled = false;
|
|
1709
1745
|
this.setEnable();
|
|
1710
1746
|
}
|
|
1711
|
-
else if (htmlAttr === 'readonly' && !isNullOrUndefined(this.htmlAttributes[htmlAttr])) {
|
|
1747
|
+
else if (htmlAttr === 'readonly' && !isNullOrUndefined(this.htmlAttributes["" + htmlAttr])) {
|
|
1712
1748
|
this.readonly = true;
|
|
1713
1749
|
this.dataBind();
|
|
1714
1750
|
}
|
|
1715
1751
|
else if (htmlAttr === 'style') {
|
|
1716
|
-
this.inputWrapper.container.setAttribute('style', this.htmlAttributes[htmlAttr]);
|
|
1752
|
+
this.inputWrapper.container.setAttribute('style', this.htmlAttributes["" + htmlAttr]);
|
|
1717
1753
|
}
|
|
1718
1754
|
else {
|
|
1719
|
-
var defaultAttr = ['title', 'id', 'placeholder',
|
|
1720
|
-
'role', '
|
|
1755
|
+
var defaultAttr = ['title', 'id', 'placeholder',
|
|
1756
|
+
'role', 'autocomplete', 'autocapitalize', 'spellcheck', 'minlength', 'maxlength'];
|
|
1721
1757
|
var validateAttr = ['name', 'required'];
|
|
1722
1758
|
if (this.getModuleName() === 'autocomplete' || this.getModuleName() === 'combobox') {
|
|
1723
1759
|
defaultAttr.push('tabindex');
|
|
1724
1760
|
}
|
|
1725
1761
|
if (validateAttr.indexOf(htmlAttr) > -1 || htmlAttr.indexOf('data') === 0) {
|
|
1726
|
-
this.hiddenElement.setAttribute(htmlAttr, this.htmlAttributes[htmlAttr]);
|
|
1762
|
+
this.hiddenElement.setAttribute(htmlAttr, this.htmlAttributes["" + htmlAttr]);
|
|
1727
1763
|
}
|
|
1728
1764
|
else if (defaultAttr.indexOf(htmlAttr) > -1) {
|
|
1729
1765
|
if (htmlAttr === 'placeholder') {
|
|
1730
|
-
Input.setPlaceholder(this.htmlAttributes[htmlAttr], this.inputElement);
|
|
1766
|
+
Input.setPlaceholder(this.htmlAttributes["" + htmlAttr], this.inputElement);
|
|
1731
1767
|
}
|
|
1732
1768
|
else {
|
|
1733
|
-
this.inputElement.setAttribute(htmlAttr, this.htmlAttributes[htmlAttr]);
|
|
1769
|
+
this.inputElement.setAttribute(htmlAttr, this.htmlAttributes["" + htmlAttr]);
|
|
1734
1770
|
}
|
|
1735
1771
|
}
|
|
1736
1772
|
else {
|
|
1737
|
-
this.inputWrapper.container.setAttribute(htmlAttr, this.htmlAttributes[htmlAttr]);
|
|
1773
|
+
this.inputWrapper.container.setAttribute(htmlAttr, this.htmlAttributes["" + htmlAttr]);
|
|
1738
1774
|
}
|
|
1739
1775
|
}
|
|
1740
1776
|
}
|
|
@@ -1746,11 +1782,8 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
1746
1782
|
DropDownList.prototype.getAriaAttributes = function () {
|
|
1747
1783
|
return {
|
|
1748
1784
|
'aria-disabled': 'false',
|
|
1749
|
-
'aria-owns': this.element.id + '_options',
|
|
1750
1785
|
'role': 'combobox',
|
|
1751
|
-
'aria-haspopup': 'true',
|
|
1752
1786
|
'aria-expanded': 'false',
|
|
1753
|
-
'aria-activedescendant': 'null',
|
|
1754
1787
|
'aria-live': 'polite',
|
|
1755
1788
|
'aria-labelledby': this.hiddenElement.id
|
|
1756
1789
|
};
|
|
@@ -1793,7 +1826,7 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
1793
1826
|
}
|
|
1794
1827
|
};
|
|
1795
1828
|
DropDownList.prototype.targetElement = function () {
|
|
1796
|
-
return this.inputWrapper.container;
|
|
1829
|
+
return !isNullOrUndefined(this.inputWrapper) ? this.inputWrapper.container : null;
|
|
1797
1830
|
};
|
|
1798
1831
|
DropDownList.prototype.getNgDirective = function () {
|
|
1799
1832
|
return 'EJS-DROPDOWNLIST';
|
|
@@ -1952,7 +1985,7 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
1952
1985
|
}
|
|
1953
1986
|
};
|
|
1954
1987
|
DropDownList.prototype.unBindCommonEvent = function () {
|
|
1955
|
-
if (this.targetElement()) {
|
|
1988
|
+
if (!isNullOrUndefined(this.inputWrapper) && this.targetElement()) {
|
|
1956
1989
|
EventHandler.remove(this.targetElement(), 'blur', this.onBlurHandler);
|
|
1957
1990
|
}
|
|
1958
1991
|
var formElement = this.inputElement && closest(this.inputElement, 'form');
|
|
@@ -1982,9 +2015,11 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
1982
2015
|
* @returns {void}
|
|
1983
2016
|
*/
|
|
1984
2017
|
DropDownList.prototype.wireListEvents = function () {
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
2018
|
+
if (!isNullOrUndefined(this.list)) {
|
|
2019
|
+
EventHandler.add(this.list, 'click', this.onMouseClick, this);
|
|
2020
|
+
EventHandler.add(this.list, 'mouseover', this.onMouseOver, this);
|
|
2021
|
+
EventHandler.add(this.list, 'mouseout', this.onMouseLeave, this);
|
|
2022
|
+
}
|
|
1988
2023
|
};
|
|
1989
2024
|
DropDownList.prototype.onSearch = function (e) {
|
|
1990
2025
|
if (e.charCode !== 32 && e.charCode !== 13) {
|
|
@@ -2095,9 +2130,9 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
2095
2130
|
}
|
|
2096
2131
|
if (!this.readonly) {
|
|
2097
2132
|
var isTabAction = e.action === 'tab' || e.action === 'close';
|
|
2098
|
-
if (this.list
|
|
2133
|
+
if (isNullOrUndefined(this.list) && !this.isRequested && !isTabAction && e.action !== 'escape') {
|
|
2099
2134
|
this.searchKeyEvent = e;
|
|
2100
|
-
this.renderList();
|
|
2135
|
+
this.renderList(e);
|
|
2101
2136
|
}
|
|
2102
2137
|
if (isNullOrUndefined(this.list) || (!isNullOrUndefined(this.liCollections) &&
|
|
2103
2138
|
isNavigation && this.liCollections.length === 0) || this.isRequested) {
|
|
@@ -2136,7 +2171,7 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
2136
2171
|
}
|
|
2137
2172
|
break;
|
|
2138
2173
|
case 'open':
|
|
2139
|
-
this.showPopup();
|
|
2174
|
+
this.showPopup(e);
|
|
2140
2175
|
break;
|
|
2141
2176
|
case 'hide':
|
|
2142
2177
|
this.preventAltUp = this.isPopupOpen;
|
|
@@ -2262,9 +2297,11 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
2262
2297
|
this.setSelection(previousItem, event);
|
|
2263
2298
|
};
|
|
2264
2299
|
DropDownList.prototype.unWireEvent = function () {
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2300
|
+
if (!isNullOrUndefined(this.inputWrapper)) {
|
|
2301
|
+
EventHandler.remove(this.inputWrapper.container, 'mousedown', this.dropDownClick);
|
|
2302
|
+
EventHandler.remove(this.inputWrapper.container, 'keypress', this.onSearch);
|
|
2303
|
+
EventHandler.remove(this.inputWrapper.container, 'focus', this.focusIn);
|
|
2304
|
+
}
|
|
2268
2305
|
this.unBindCommonEvent();
|
|
2269
2306
|
};
|
|
2270
2307
|
/**
|
|
@@ -2273,9 +2310,11 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
2273
2310
|
* @returns {void}
|
|
2274
2311
|
*/
|
|
2275
2312
|
DropDownList.prototype.unWireListEvents = function () {
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2313
|
+
if (this.list) {
|
|
2314
|
+
EventHandler.remove(this.list, 'click', this.onMouseClick);
|
|
2315
|
+
EventHandler.remove(this.list, 'mouseover', this.onMouseOver);
|
|
2316
|
+
EventHandler.remove(this.list, 'mouseout', this.onMouseLeave);
|
|
2317
|
+
}
|
|
2279
2318
|
};
|
|
2280
2319
|
DropDownList.prototype.checkSelector = function (id) {
|
|
2281
2320
|
return '[id="' + id.replace(/(:|\.|\[|\]|,|=|@|\\|\/|#)/g, '\\$1') + '"]';
|
|
@@ -2283,7 +2322,7 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
2283
2322
|
DropDownList.prototype.onDocumentClick = function (e) {
|
|
2284
2323
|
var target = e.target;
|
|
2285
2324
|
if (!(!isNullOrUndefined(this.popupObj) && closest(target, this.checkSelector(this.popupObj.element.id))) &&
|
|
2286
|
-
!this.inputWrapper.container.contains(e.target)) {
|
|
2325
|
+
!isNullOrUndefined(this.inputWrapper) && !this.inputWrapper.container.contains(e.target)) {
|
|
2287
2326
|
if (this.inputWrapper.container.classList.contains(dropDownListClasses.inputFocus) || this.isPopupOpen) {
|
|
2288
2327
|
this.isDocumentClick = true;
|
|
2289
2328
|
var isActive = this.isRequested;
|
|
@@ -2328,7 +2367,7 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
2328
2367
|
}
|
|
2329
2368
|
if (!this.readonly) {
|
|
2330
2369
|
if (this.isPopupOpen) {
|
|
2331
|
-
this.hidePopup();
|
|
2370
|
+
this.hidePopup(e);
|
|
2332
2371
|
if (this.isFilterLayout()) {
|
|
2333
2372
|
this.focusDropDown(e);
|
|
2334
2373
|
}
|
|
@@ -2338,7 +2377,7 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
2338
2377
|
this.floatLabelChange();
|
|
2339
2378
|
this.queryString = this.inputElement.value.trim() === '' ? null : this.inputElement.value;
|
|
2340
2379
|
this.isDropDownClick = true;
|
|
2341
|
-
this.showPopup();
|
|
2380
|
+
this.showPopup(e);
|
|
2342
2381
|
}
|
|
2343
2382
|
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
2344
2383
|
var proxy_1 = this;
|
|
@@ -2402,6 +2441,9 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
2402
2441
|
};
|
|
2403
2442
|
DropDownList.prototype.selectEventCallback = function (li, e, preventSelect, selectedData, value) {
|
|
2404
2443
|
this.previousItemData = (!isNullOrUndefined(this.itemData)) ? this.itemData : null;
|
|
2444
|
+
if (this.itemData != selectedData) {
|
|
2445
|
+
this.previousValue = (!isNullOrUndefined(this.itemData)) ? typeof this.itemData == "object" ? this.checkFieldValue(this.itemData, this.fields.value.split('.')) : this.itemData : null;
|
|
2446
|
+
}
|
|
2405
2447
|
this.item = li;
|
|
2406
2448
|
this.itemData = selectedData;
|
|
2407
2449
|
var focusedItem = this.list.querySelector('.' + dropDownBaseClasses.focus);
|
|
@@ -2472,10 +2514,6 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
2472
2514
|
if (this.setValue(e)) {
|
|
2473
2515
|
return;
|
|
2474
2516
|
}
|
|
2475
|
-
attributes(this.targetElement(), { 'aria-activedescendant': this.selectedLI ? this.selectedLI.id : null });
|
|
2476
|
-
if (this.isFilterLayout() && this.filterInput) {
|
|
2477
|
-
attributes(this.filterInput, { 'aria-activedescendant': this.selectedLI ? this.selectedLI.id : null });
|
|
2478
|
-
}
|
|
2479
2517
|
if ((!this.isPopupOpen && !isNullOrUndefined(li)) || (this.isPopupOpen && !isNullOrUndefined(e) &&
|
|
2480
2518
|
(e.type !== 'keydown' || e.type === 'keydown' && e.action === 'enter'))) {
|
|
2481
2519
|
this.isSelectCustom = false;
|
|
@@ -2485,9 +2523,17 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
2485
2523
|
this.setScrollPosition(e);
|
|
2486
2524
|
}
|
|
2487
2525
|
if (Browser.info.name !== 'mozilla') {
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2526
|
+
if (this.targetElement()) {
|
|
2527
|
+
attributes(this.targetElement(), { 'aria-label': this.inputElement.value });
|
|
2528
|
+
attributes(this.targetElement(), { 'aria-describedby': this.inputElement.id != '' ? this.inputElement.id : this.element.id });
|
|
2529
|
+
this.targetElement().removeAttribute('aria-live');
|
|
2530
|
+
}
|
|
2531
|
+
}
|
|
2532
|
+
if (this.isPopupOpen && !isNullOrUndefined(this.ulElement) && !isNullOrUndefined(this.ulElement.getElementsByClassName('e-item-focus')[0])) {
|
|
2533
|
+
attributes(this.targetElement(), { 'aria-activedescendant': this.ulElement.getElementsByClassName('e-item-focus')[0].id });
|
|
2534
|
+
}
|
|
2535
|
+
else if (this.isPopupOpen && !isNullOrUndefined(this.ulElement) && !isNullOrUndefined(this.ulElement.getElementsByClassName('e-active')[0])) {
|
|
2536
|
+
attributes(this.targetElement(), { 'aria-activedescendant': this.ulElement.getElementsByClassName('e-active')[0].id });
|
|
2491
2537
|
}
|
|
2492
2538
|
};
|
|
2493
2539
|
DropDownList.prototype.dropdownCompiler = function (dropdownTemplate) {
|
|
@@ -2652,9 +2698,11 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
2652
2698
|
selectedElement.setAttribute('value', this.value.toString());
|
|
2653
2699
|
}
|
|
2654
2700
|
else {
|
|
2655
|
-
this.hiddenElement
|
|
2656
|
-
|
|
2657
|
-
|
|
2701
|
+
if (!isNullOrUndefined(this.hiddenElement)) {
|
|
2702
|
+
this.hiddenElement.innerHTML = '<option selected>' + this.text + '</option>';
|
|
2703
|
+
var selectedElement = this.hiddenElement.querySelector('option');
|
|
2704
|
+
selectedElement.setAttribute('value', this.value.toString());
|
|
2705
|
+
}
|
|
2658
2706
|
}
|
|
2659
2707
|
}
|
|
2660
2708
|
else {
|
|
@@ -2681,6 +2729,9 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
2681
2729
|
this.preventAutoFill = false;
|
|
2682
2730
|
}
|
|
2683
2731
|
this.preventAltUp = false;
|
|
2732
|
+
if (this.getModuleName() === 'autocomplete' && !isNullOrUndefined(this.ulElement) && !isNullOrUndefined(this.ulElement.getElementsByClassName('e-item-focus')[0])) {
|
|
2733
|
+
attributes(this.targetElement(), { 'aria-activedescendant': this.ulElement.getElementsByClassName('e-item-focus')[0].id });
|
|
2734
|
+
}
|
|
2684
2735
|
e.preventDefault();
|
|
2685
2736
|
break;
|
|
2686
2737
|
case 46: //delete
|
|
@@ -2803,9 +2854,9 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
2803
2854
|
/**
|
|
2804
2855
|
* To filter the data from given data source by using query
|
|
2805
2856
|
*
|
|
2806
|
-
* @param
|
|
2807
|
-
* @param
|
|
2808
|
-
* @param
|
|
2857
|
+
* @param {Object[] | DataManager } dataSource - Set the data source to filter.
|
|
2858
|
+
* @param {Query} query - Specify the query to filter the data.
|
|
2859
|
+
* @param {FieldSettingsModel} fields - Specify the fields to map the column in the data table.
|
|
2809
2860
|
* @returns {void}
|
|
2810
2861
|
* @deprecated
|
|
2811
2862
|
*/
|
|
@@ -2871,11 +2922,8 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
2871
2922
|
prepend([parentElement], popupElement);
|
|
2872
2923
|
attributes(this.filterInput, {
|
|
2873
2924
|
'aria-disabled': 'false',
|
|
2874
|
-
'
|
|
2875
|
-
'role': 'listbox',
|
|
2876
|
-
'aria-activedescendant': this.selectedLI ? this.selectedLI.id : null,
|
|
2925
|
+
'role': 'combobox',
|
|
2877
2926
|
'autocomplete': 'off',
|
|
2878
|
-
'autocorrect': 'off',
|
|
2879
2927
|
'autocapitalize': 'off',
|
|
2880
2928
|
'spellcheck': 'false'
|
|
2881
2929
|
});
|
|
@@ -2961,7 +3009,8 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
2961
3009
|
this.initRemoteRender = false;
|
|
2962
3010
|
if (this.value && this.dataSource instanceof DataManager) {
|
|
2963
3011
|
var checkField_1 = isNullOrUndefined(this.fields.value) ? this.fields.text : this.fields.value;
|
|
2964
|
-
var
|
|
3012
|
+
var fieldValue_1 = this.fields.value.split('.');
|
|
3013
|
+
var checkVal = list.some(function (x) { return isNullOrUndefined(x[checkField_1]) && fieldValue_1.length > 1 ? _this.checkFieldValue(x, fieldValue_1) === _this.value : x[checkField_1] === _this.value; });
|
|
2965
3014
|
if (!checkVal) {
|
|
2966
3015
|
this.dataSource.executeQuery(this.getQuery(this.query).where(new Predicate(checkField_1, 'equal', this.value)))
|
|
2967
3016
|
.then(function (e) {
|
|
@@ -2983,26 +3032,8 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
2983
3032
|
}
|
|
2984
3033
|
this.initial = false;
|
|
2985
3034
|
}
|
|
2986
|
-
else if (this.getModuleName() === 'autocomplete' && this.value
|
|
2987
|
-
|
|
2988
|
-
var checkValue = list.some(function (x) { return x[checkFields_1] === _this.value; });
|
|
2989
|
-
var query = new Query();
|
|
2990
|
-
if (!checkValue) {
|
|
2991
|
-
new DataManager(this.dataSource).executeQuery(query.where(new Predicate(checkFields_1, 'equal', this.value)))
|
|
2992
|
-
.then(function (e) {
|
|
2993
|
-
if (e.result.length > 0) {
|
|
2994
|
-
_this.value = checkFields_1 !== '' ? e.result[0][_this.fields.value].toString() : e.result[0].toString();
|
|
2995
|
-
_this.addItem(e.result, list.length);
|
|
2996
|
-
_this.updateValues();
|
|
2997
|
-
}
|
|
2998
|
-
else {
|
|
2999
|
-
_this.updateValues();
|
|
3000
|
-
}
|
|
3001
|
-
});
|
|
3002
|
-
}
|
|
3003
|
-
else {
|
|
3004
|
-
this.updateValues();
|
|
3005
|
-
}
|
|
3035
|
+
else if (this.getModuleName() === 'autocomplete' && this.value) {
|
|
3036
|
+
this.setInputValue();
|
|
3006
3037
|
}
|
|
3007
3038
|
if (this.getModuleName() !== 'autocomplete' && this.isFiltering() && !this.isTyped) {
|
|
3008
3039
|
if (!this.actionCompleteData.isUpdated || ((!this.isCustomFilter
|
|
@@ -3025,10 +3056,17 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
3025
3056
|
}
|
|
3026
3057
|
}
|
|
3027
3058
|
if (this.beforePopupOpen) {
|
|
3028
|
-
this.renderPopup();
|
|
3059
|
+
this.renderPopup(e);
|
|
3029
3060
|
}
|
|
3030
3061
|
}
|
|
3031
3062
|
};
|
|
3063
|
+
DropDownList.prototype.checkFieldValue = function (list, fieldValue) {
|
|
3064
|
+
var checkField = list;
|
|
3065
|
+
fieldValue.forEach(function (value) {
|
|
3066
|
+
checkField = checkField[value];
|
|
3067
|
+
});
|
|
3068
|
+
return checkField;
|
|
3069
|
+
};
|
|
3032
3070
|
DropDownList.prototype.updateActionCompleteDataValues = function (ulElement, list) {
|
|
3033
3071
|
this.actionCompleteData = { ulElement: ulElement.cloneNode(true), list: list, isUpdated: true };
|
|
3034
3072
|
if (this.actionData.list !== this.actionCompleteData.list && this.actionCompleteData.ulElement && this.actionCompleteData.list) {
|
|
@@ -3097,7 +3135,7 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
3097
3135
|
removeClass(highlightedItem, dropDownListClasses.focus);
|
|
3098
3136
|
}
|
|
3099
3137
|
};
|
|
3100
|
-
DropDownList.prototype.renderPopup = function () {
|
|
3138
|
+
DropDownList.prototype.renderPopup = function (e) {
|
|
3101
3139
|
var _this = this;
|
|
3102
3140
|
if (this.popupObj && document.body.contains(this.popupObj.element)) {
|
|
3103
3141
|
this.refreshPopup();
|
|
@@ -3154,9 +3192,11 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
3154
3192
|
(_this.isDropDownClick && _this.getModuleName() === 'combobox')))) {
|
|
3155
3193
|
offsetValue = _this.getOffsetValue(popupEle);
|
|
3156
3194
|
var firstItem = _this.isEmptyList() ? _this.list : _this.liCollections[0];
|
|
3157
|
-
|
|
3158
|
-
parseInt(getComputedStyle(
|
|
3159
|
-
|
|
3195
|
+
if (!isNullOrUndefined(_this.inputElement)) {
|
|
3196
|
+
left = -(parseInt(getComputedStyle(firstItem).textIndent, 10) -
|
|
3197
|
+
parseInt(getComputedStyle(_this.inputElement).paddingLeft, 10) +
|
|
3198
|
+
parseInt(getComputedStyle(_this.inputElement.parentElement).borderLeftWidth, 10));
|
|
3199
|
+
}
|
|
3160
3200
|
}
|
|
3161
3201
|
_this.getFocusElement();
|
|
3162
3202
|
_this.createPopup(popupEle, offsetValue, left);
|
|
@@ -3187,25 +3227,28 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
3187
3227
|
var element = scrollParentElements_1[_i];
|
|
3188
3228
|
EventHandler.add(element, 'scroll', _this.scrollHandler, _this);
|
|
3189
3229
|
}
|
|
3190
|
-
if (Browser.isDevice && _this.isFilterLayout()) {
|
|
3191
|
-
EventHandler.add(_this.list, 'scroll', _this.listScroll, _this);
|
|
3192
|
-
}
|
|
3193
3230
|
if (!isNullOrUndefined(_this.list)) {
|
|
3194
3231
|
_this.unWireListEvents();
|
|
3195
3232
|
_this.wireListEvents();
|
|
3196
3233
|
}
|
|
3197
|
-
|
|
3234
|
+
_this.selectedElementID = _this.selectedLI ? _this.selectedLI.id : null;
|
|
3235
|
+
attributes(_this.targetElement(), { 'aria-expanded': 'true', 'aria-owns': _this.inputElement.id + '_options' });
|
|
3236
|
+
_this.inputElement.setAttribute('aria-expanded', 'true');
|
|
3198
3237
|
var inputParent = _this.isFiltering() ? _this.filterInput.parentElement : _this.inputWrapper.container;
|
|
3199
3238
|
addClass([inputParent], [dropDownListClasses.inputFocus]);
|
|
3200
3239
|
var animModel = { name: 'FadeIn', duration: 100 };
|
|
3201
3240
|
_this.beforePopupOpen = true;
|
|
3202
3241
|
var popupInstance = _this.popupObj;
|
|
3203
|
-
var eventArgs = { popup: popupInstance, cancel: false, animation: animModel };
|
|
3242
|
+
var eventArgs = { popup: popupInstance, event: e, cancel: false, animation: animModel };
|
|
3204
3243
|
_this.trigger('open', eventArgs, function (eventArgs) {
|
|
3205
3244
|
if (!eventArgs.cancel) {
|
|
3206
|
-
|
|
3245
|
+
if (!isNullOrUndefined(_this.inputWrapper)) {
|
|
3246
|
+
addClass([_this.inputWrapper.container], [dropDownListClasses.iconAnimation]);
|
|
3247
|
+
}
|
|
3207
3248
|
_this.renderReactTemplates();
|
|
3208
|
-
|
|
3249
|
+
if (!isNullOrUndefined(_this.popupObj)) {
|
|
3250
|
+
_this.popupObj.show(new Animation(eventArgs.animation), (_this.zIndex === 1000) ? _this.element : null);
|
|
3251
|
+
}
|
|
3209
3252
|
}
|
|
3210
3253
|
else {
|
|
3211
3254
|
_this.beforePopupOpen = false;
|
|
@@ -3263,6 +3306,12 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
3263
3306
|
var actionList = _this.actionCompleteData && _this.actionCompleteData.ulElement &&
|
|
3264
3307
|
_this.actionCompleteData.ulElement.querySelector('li');
|
|
3265
3308
|
var ulElement = _this.list.querySelector('ul li');
|
|
3309
|
+
if (!isNullOrUndefined(_this.ulElement) && !isNullOrUndefined(_this.ulElement.getElementsByClassName('e-item-focus')[0])) {
|
|
3310
|
+
attributes(_this.targetElement(), { 'aria-activedescendant': _this.ulElement.getElementsByClassName('e-item-focus')[0].id });
|
|
3311
|
+
}
|
|
3312
|
+
else if (!isNullOrUndefined(_this.ulElement) && !isNullOrUndefined(_this.ulElement.getElementsByClassName('e-active')[0])) {
|
|
3313
|
+
attributes(_this.targetElement(), { 'aria-activedescendant': _this.ulElement.getElementsByClassName('e-active')[0].id });
|
|
3314
|
+
}
|
|
3266
3315
|
if (_this.isFiltering() && _this.itemTemplate && (_this.element.tagName === _this.getNgDirective()) &&
|
|
3267
3316
|
(actionList && ulElement && actionList.textContent !== ulElement.textContent) &&
|
|
3268
3317
|
_this.element.tagName !== 'EJS-COMBOBOX') {
|
|
@@ -3418,9 +3467,6 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
3418
3467
|
this.filterInput.value = this.typedString = '';
|
|
3419
3468
|
this.searchLists(null);
|
|
3420
3469
|
};
|
|
3421
|
-
DropDownList.prototype.listScroll = function () {
|
|
3422
|
-
this.filterInput.blur();
|
|
3423
|
-
};
|
|
3424
3470
|
DropDownList.prototype.setEleWidth = function (width) {
|
|
3425
3471
|
if (!isNullOrUndefined(width)) {
|
|
3426
3472
|
if (typeof width === 'number') {
|
|
@@ -3449,7 +3495,6 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
3449
3495
|
}
|
|
3450
3496
|
if (Browser.isDevice && this.isFilterLayout()) {
|
|
3451
3497
|
removeClass([document.body, this.popupObj.element], dropDownListClasses.popupFullScreen);
|
|
3452
|
-
EventHandler.remove(this.list, 'scroll', this.listScroll);
|
|
3453
3498
|
}
|
|
3454
3499
|
if (this.isFilterLayout()) {
|
|
3455
3500
|
if (!Browser.isDevice) {
|
|
@@ -3462,14 +3507,19 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
3462
3507
|
EventHandler.remove(this.backIconElement, 'click', this.clickOnBackIcon);
|
|
3463
3508
|
EventHandler.remove(this.clearIconElement, 'click', this.clearText);
|
|
3464
3509
|
}
|
|
3465
|
-
|
|
3466
|
-
|
|
3467
|
-
|
|
3468
|
-
|
|
3469
|
-
|
|
3510
|
+
if (!isNullOrUndefined(this.filterInput)) {
|
|
3511
|
+
EventHandler.remove(this.filterInput, 'input', this.onInput);
|
|
3512
|
+
EventHandler.remove(this.filterInput, 'keyup', this.onFilterUp);
|
|
3513
|
+
EventHandler.remove(this.filterInput, 'keydown', this.onFilterDown);
|
|
3514
|
+
EventHandler.remove(this.filterInput, 'blur', this.onBlurHandler);
|
|
3515
|
+
EventHandler.remove(this.filterInput, 'paste', this.pasteHandler);
|
|
3516
|
+
}
|
|
3470
3517
|
this.filterInput = null;
|
|
3471
3518
|
}
|
|
3472
3519
|
attributes(this.targetElement(), { 'aria-expanded': 'false' });
|
|
3520
|
+
this.inputElement.setAttribute('aria-expanded', 'false');
|
|
3521
|
+
this.targetElement().removeAttribute('aria-owns');
|
|
3522
|
+
this.targetElement().removeAttribute('aria-activedescendant');
|
|
3473
3523
|
this.inputWrapper.container.classList.remove(dropDownListClasses.iconAnimation);
|
|
3474
3524
|
if (this.isFiltering()) {
|
|
3475
3525
|
this.actionCompleteData.isUpdated = false;
|
|
@@ -3522,14 +3572,15 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
3522
3572
|
if (this.element.tagName === 'INPUT') {
|
|
3523
3573
|
this.inputElement = this.element;
|
|
3524
3574
|
if (isNullOrUndefined(this.inputElement.getAttribute('role'))) {
|
|
3525
|
-
this.inputElement.setAttribute('role', '
|
|
3575
|
+
this.inputElement.setAttribute('role', 'combobox');
|
|
3526
3576
|
}
|
|
3527
3577
|
if (isNullOrUndefined(this.inputElement.getAttribute('type'))) {
|
|
3528
3578
|
this.inputElement.setAttribute('type', 'text');
|
|
3529
3579
|
}
|
|
3580
|
+
this.inputElement.setAttribute('aria-expanded', 'false');
|
|
3530
3581
|
}
|
|
3531
3582
|
else {
|
|
3532
|
-
this.inputElement = this.createElement('input', { attrs: { role: '
|
|
3583
|
+
this.inputElement = this.createElement('input', { attrs: { role: 'combobox', type: 'text' } });
|
|
3533
3584
|
if (this.element.tagName !== this.getNgDirective()) {
|
|
3534
3585
|
this.element.style.display = 'none';
|
|
3535
3586
|
}
|
|
@@ -3540,6 +3591,9 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
3540
3591
|
if (!isNullOrUndefined(this.cssClass) && this.cssClass !== '') {
|
|
3541
3592
|
updatedCssClassValues = (this.cssClass.replace(/\s+/g, ' ')).trim();
|
|
3542
3593
|
}
|
|
3594
|
+
if (!isNullOrUndefined(closest(this.element, "fieldset")) && closest(this.element, "fieldset").disabled) {
|
|
3595
|
+
this.enabled = false;
|
|
3596
|
+
}
|
|
3543
3597
|
this.inputWrapper = Input.createInput({
|
|
3544
3598
|
element: this.inputElement,
|
|
3545
3599
|
buttons: this.isPopupButton() ? [dropDownListClasses.icon] : null,
|
|
@@ -3568,6 +3622,10 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
3568
3622
|
this.setFields();
|
|
3569
3623
|
this.inputWrapper.container.style.width = formatUnit(this.width);
|
|
3570
3624
|
this.inputWrapper.container.classList.add('e-ddl');
|
|
3625
|
+
Input.calculateWidth(this.inputElement, this.inputWrapper.container);
|
|
3626
|
+
if (!isNullOrUndefined(this.inputWrapper.buttons[0]) && this.inputWrapper.container.getElementsByClassName('e-float-text-content')[0] && this.floatLabelType !== 'Never') {
|
|
3627
|
+
this.inputWrapper.container.getElementsByClassName('e-float-text-content')[0].classList.add('e-icon');
|
|
3628
|
+
}
|
|
3571
3629
|
this.wireEvent();
|
|
3572
3630
|
this.tabIndex = this.element.hasAttribute('tabindex') ? this.element.getAttribute('tabindex') : '0';
|
|
3573
3631
|
this.element.removeAttribute('tabindex');
|
|
@@ -3578,6 +3636,9 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
3578
3636
|
attributes(this.targetElement(), this.getAriaAttributes());
|
|
3579
3637
|
this.updateDataAttribute(this.htmlAttributes);
|
|
3580
3638
|
this.setHTMLAttributes();
|
|
3639
|
+
if (this.targetElement() === this.inputElement) {
|
|
3640
|
+
this.inputElement.removeAttribute('aria-labelledby');
|
|
3641
|
+
}
|
|
3581
3642
|
if (this.value !== null || this.activeIndex !== null || this.text !== null) {
|
|
3582
3643
|
this.initValue();
|
|
3583
3644
|
}
|
|
@@ -3587,6 +3648,7 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
3587
3648
|
this.text = isNullOrUndefined(this.value) ? null : selectElement.options[selectElement.selectedIndex].textContent;
|
|
3588
3649
|
this.initValue();
|
|
3589
3650
|
}
|
|
3651
|
+
this.setEnabled();
|
|
3590
3652
|
this.preventTabIndex(this.element);
|
|
3591
3653
|
if (!this.enabled) {
|
|
3592
3654
|
this.targetElement().tabIndex = -1;
|
|
@@ -3608,12 +3670,22 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
3608
3670
|
if (this.element.hasAttribute('data-val')) {
|
|
3609
3671
|
this.element.setAttribute('data-val', 'false');
|
|
3610
3672
|
}
|
|
3673
|
+
var floatLabelElement = this.inputWrapper.container.getElementsByClassName('e-float-text')[0];
|
|
3674
|
+
if (!isNullOrUndefined(this.element.id) && this.element.id !== '' && !isNullOrUndefined(floatLabelElement)) {
|
|
3675
|
+
floatLabelElement.id = 'label_' + this.element.id.replace(/ /g, '_');
|
|
3676
|
+
attributes(this.inputElement, { 'aria-labelledby': floatLabelElement.id });
|
|
3677
|
+
}
|
|
3611
3678
|
this.renderComplete();
|
|
3612
3679
|
};
|
|
3613
3680
|
DropDownList.prototype.setFooterTemplate = function (popupEle) {
|
|
3614
3681
|
var compiledString;
|
|
3615
3682
|
if (this.footer) {
|
|
3616
|
-
this.
|
|
3683
|
+
if (this.isReact) {
|
|
3684
|
+
this.clearTemplate(['footerTemplate']);
|
|
3685
|
+
}
|
|
3686
|
+
else {
|
|
3687
|
+
this.footer.innerHTML = '';
|
|
3688
|
+
}
|
|
3617
3689
|
}
|
|
3618
3690
|
else {
|
|
3619
3691
|
this.footer = this.createElement('div');
|
|
@@ -3661,6 +3733,14 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
3661
3733
|
var contentEle = popupEle.querySelector('div.e-content');
|
|
3662
3734
|
popupEle.insertBefore(this.header, contentEle);
|
|
3663
3735
|
};
|
|
3736
|
+
/**
|
|
3737
|
+
* Sets the enabled state to DropDownBase.
|
|
3738
|
+
*
|
|
3739
|
+
* @returns {void}
|
|
3740
|
+
*/
|
|
3741
|
+
DropDownList.prototype.setEnabled = function () {
|
|
3742
|
+
this.element.setAttribute('aria-disabled', (this.enabled) ? 'false' : 'true');
|
|
3743
|
+
};
|
|
3664
3744
|
DropDownList.prototype.setOldText = function (text) {
|
|
3665
3745
|
this.text = text;
|
|
3666
3746
|
};
|
|
@@ -3748,6 +3828,7 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
3748
3828
|
break;
|
|
3749
3829
|
case 'width':
|
|
3750
3830
|
this_1.setEleWidth(newProp.width);
|
|
3831
|
+
Input.calculateWidth(this_1.inputElement, this_1.inputWrapper.container);
|
|
3751
3832
|
break;
|
|
3752
3833
|
case 'placeholder':
|
|
3753
3834
|
Input.setPlaceholder(newProp.placeholder, this_1.inputElement);
|
|
@@ -3765,6 +3846,7 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
3765
3846
|
break;
|
|
3766
3847
|
case 'cssClass':
|
|
3767
3848
|
this_1.setCssClass(newProp.cssClass, oldProp.cssClass);
|
|
3849
|
+
Input.calculateWidth(this_1.inputElement, this_1.inputWrapper.container);
|
|
3768
3850
|
break;
|
|
3769
3851
|
case 'enableRtl':
|
|
3770
3852
|
this_1.setEnableRtl();
|
|
@@ -3805,6 +3887,9 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
3805
3887
|
}
|
|
3806
3888
|
});
|
|
3807
3889
|
}
|
|
3890
|
+
else if (this_1.getModuleName() === 'autocomplete') {
|
|
3891
|
+
this_1.setInputValue(newProp, oldProp);
|
|
3892
|
+
}
|
|
3808
3893
|
else {
|
|
3809
3894
|
this_1.setOldText(oldProp.text);
|
|
3810
3895
|
}
|
|
@@ -3846,6 +3931,9 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
3846
3931
|
}
|
|
3847
3932
|
});
|
|
3848
3933
|
}
|
|
3934
|
+
else if (this_1.getModuleName() === 'autocomplete') {
|
|
3935
|
+
this_1.setInputValue(newProp, oldProp);
|
|
3936
|
+
}
|
|
3849
3937
|
else {
|
|
3850
3938
|
this_1.setOldValue(oldProp.value);
|
|
3851
3939
|
}
|
|
@@ -3905,6 +3993,9 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
3905
3993
|
case 'floatLabelType':
|
|
3906
3994
|
Input.removeFloating(this_1.inputWrapper);
|
|
3907
3995
|
Input.addFloating(this_1.inputElement, newProp.floatLabelType, this_1.placeholder, this_1.createElement);
|
|
3996
|
+
if (!isNullOrUndefined(this_1.inputWrapper.buttons[0]) && this_1.inputWrapper.container.getElementsByClassName('e-float-text-overflow')[0] && this_1.floatLabelType !== 'Never') {
|
|
3997
|
+
this_1.inputWrapper.container.getElementsByClassName('e-float-text-overflow')[0].classList.add('e-icon');
|
|
3998
|
+
}
|
|
3908
3999
|
break;
|
|
3909
4000
|
case 'showClearButton':
|
|
3910
4001
|
Input.setClearButton(newProp.showClearButton, this_1.inputElement, this_1.inputWrapper, null, this_1.createElement);
|
|
@@ -3964,6 +4055,8 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
3964
4055
|
removeClass([this.inputWrapper.container], ['e-readonly']);
|
|
3965
4056
|
}
|
|
3966
4057
|
};
|
|
4058
|
+
DropDownList.prototype.setInputValue = function (newProp, oldProp) {
|
|
4059
|
+
};
|
|
3967
4060
|
DropDownList.prototype.setCssClass = function (newClass, oldClass) {
|
|
3968
4061
|
if (!isNullOrUndefined(oldClass)) {
|
|
3969
4062
|
oldClass = (oldClass.replace(/\s+/g, ' ')).trim();
|
|
@@ -3990,7 +4083,7 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
3990
4083
|
*
|
|
3991
4084
|
* @returns {void}
|
|
3992
4085
|
*/
|
|
3993
|
-
DropDownList.prototype.showPopup = function () {
|
|
4086
|
+
DropDownList.prototype.showPopup = function (e) {
|
|
3994
4087
|
if (!this.enabled) {
|
|
3995
4088
|
return;
|
|
3996
4089
|
}
|
|
@@ -4010,11 +4103,11 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
4010
4103
|
}
|
|
4011
4104
|
else if (isNullOrUndefined(this.list) || !isUndefined(this.list) && (this.list.classList.contains(dropDownBaseClasses.noData) ||
|
|
4012
4105
|
this.list.querySelectorAll('.' + dropDownBaseClasses.li).length <= 0)) {
|
|
4013
|
-
this.renderList();
|
|
4106
|
+
this.renderList(e);
|
|
4014
4107
|
}
|
|
4015
|
-
this.invokeRenderPopup();
|
|
4108
|
+
this.invokeRenderPopup(e);
|
|
4016
4109
|
};
|
|
4017
|
-
DropDownList.prototype.invokeRenderPopup = function () {
|
|
4110
|
+
DropDownList.prototype.invokeRenderPopup = function (e) {
|
|
4018
4111
|
if (Browser.isDevice && this.isFilterLayout()) {
|
|
4019
4112
|
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
4020
4113
|
var proxy_2 = this;
|
|
@@ -4023,10 +4116,9 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
4023
4116
|
};
|
|
4024
4117
|
history.pushState({}, '');
|
|
4025
4118
|
}
|
|
4026
|
-
if (!isNullOrUndefined(this.list.children[0]) || this.list.classList.contains(dropDownBaseClasses.noData)) {
|
|
4027
|
-
this.renderPopup();
|
|
4119
|
+
if (!isNullOrUndefined(this.list) && (!isNullOrUndefined(this.list.children[0]) || this.list.classList.contains(dropDownBaseClasses.noData))) {
|
|
4120
|
+
this.renderPopup(e);
|
|
4028
4121
|
}
|
|
4029
|
-
attributes(this.targetElement(), { 'aria-activedescendant': this.selectedLI ? this.selectedLI.id : null });
|
|
4030
4122
|
};
|
|
4031
4123
|
DropDownList.prototype.renderHightSearch = function () {
|
|
4032
4124
|
// update high light search
|
|
@@ -4040,7 +4132,9 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
4040
4132
|
DropDownList.prototype.hidePopup = function (e) {
|
|
4041
4133
|
/* eslint-enable valid-jsdoc, jsdoc/require-param */
|
|
4042
4134
|
if (this.isEscapeKey && this.getModuleName() === 'dropdownlist') {
|
|
4043
|
-
|
|
4135
|
+
if (!isNullOrUndefined(this.inputElement)) {
|
|
4136
|
+
Input.setValue(this.text, this.inputElement, this.floatLabelType, this.showClearButton);
|
|
4137
|
+
}
|
|
4044
4138
|
this.isEscapeKey = false;
|
|
4045
4139
|
if (!isNullOrUndefined(this.index)) {
|
|
4046
4140
|
var element = this.findListElement(this.ulElement, 'li', 'data-value', this.value);
|
|
@@ -4090,6 +4184,7 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
4090
4184
|
}
|
|
4091
4185
|
addClass([this.inputWrapper.container], [dropDownListClasses.inputFocus]);
|
|
4092
4186
|
this.onFocus(e);
|
|
4187
|
+
Input.calculateWidth(this.inputElement, this.inputWrapper.container);
|
|
4093
4188
|
};
|
|
4094
4189
|
/**
|
|
4095
4190
|
* Moves the focus from the component if the component is already focused.
|
|
@@ -4107,6 +4202,7 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
4107
4202
|
this.targetElement().blur();
|
|
4108
4203
|
}
|
|
4109
4204
|
removeClass([this.inputWrapper.container], [dropDownListClasses.inputFocus]);
|
|
4205
|
+
Input.calculateWidth(this.inputElement, this.inputWrapper.container);
|
|
4110
4206
|
};
|
|
4111
4207
|
/**
|
|
4112
4208
|
* Removes the component from the DOM and detaches all its related event handlers. Also it removes the attributes and classes.
|
|
@@ -4130,10 +4226,9 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
4130
4226
|
return;
|
|
4131
4227
|
}
|
|
4132
4228
|
if (this.inputElement) {
|
|
4133
|
-
var attrArray = ['readonly', 'aria-disabled', 'aria-
|
|
4134
|
-
'
|
|
4135
|
-
'aria-
|
|
4136
|
-
'autocapitalize', 'spellcheck', 'aria-autocomplete', 'aria-live', 'aria-describedby', 'aria-label'];
|
|
4229
|
+
var attrArray = ['readonly', 'aria-disabled', 'placeholder', 'aria-labelledby',
|
|
4230
|
+
'aria-expanded', 'autocomplete', 'aria-readonly', 'autocapitalize',
|
|
4231
|
+
'spellcheck', 'aria-autocomplete', 'aria-live', 'aria-describedby', 'aria-label'];
|
|
4137
4232
|
for (var i = 0; i < attrArray.length; i++) {
|
|
4138
4233
|
this.inputElement.removeAttribute(attrArray[i]);
|
|
4139
4234
|
}
|
|
@@ -4149,6 +4244,21 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
4149
4244
|
this.inputWrapper.container.parentElement.insertBefore(this.element, this.inputWrapper.container);
|
|
4150
4245
|
detach(this.inputWrapper.container);
|
|
4151
4246
|
}
|
|
4247
|
+
this.hiddenElement = null;
|
|
4248
|
+
this.inputWrapper = null;
|
|
4249
|
+
this.keyboardModule = null;
|
|
4250
|
+
this.ulElement = null;
|
|
4251
|
+
this.list = null;
|
|
4252
|
+
this.popupObj = null;
|
|
4253
|
+
this.rippleFun = null;
|
|
4254
|
+
this.selectedLI = null;
|
|
4255
|
+
this.liCollections = null;
|
|
4256
|
+
this.item = null;
|
|
4257
|
+
this.inputWrapper = null;
|
|
4258
|
+
this.footer = null;
|
|
4259
|
+
this.header = null;
|
|
4260
|
+
this.previousSelectedLI = null;
|
|
4261
|
+
this.valueTempElement = null;
|
|
4152
4262
|
_super.prototype.destroy.call(this);
|
|
4153
4263
|
};
|
|
4154
4264
|
/* eslint-disable valid-jsdoc, jsdoc/require-returns-description */
|
|
@@ -4190,6 +4300,12 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
4190
4300
|
__decorate$1([
|
|
4191
4301
|
Property('100%')
|
|
4192
4302
|
], DropDownList.prototype, "width", void 0);
|
|
4303
|
+
__decorate$1([
|
|
4304
|
+
Property(true)
|
|
4305
|
+
], DropDownList.prototype, "enabled", void 0);
|
|
4306
|
+
__decorate$1([
|
|
4307
|
+
Property(false)
|
|
4308
|
+
], DropDownList.prototype, "enablePersistence", void 0);
|
|
4193
4309
|
__decorate$1([
|
|
4194
4310
|
Property('300px')
|
|
4195
4311
|
], DropDownList.prototype, "popupHeight", void 0);
|
|
@@ -4369,6 +4485,9 @@ var Fields = /** @__PURE__ @class */ (function (_super) {
|
|
|
4369
4485
|
__decorate$2([
|
|
4370
4486
|
Property(null)
|
|
4371
4487
|
], Fields.prototype, "query", void 0);
|
|
4488
|
+
__decorate$2([
|
|
4489
|
+
Property('selectable')
|
|
4490
|
+
], Fields.prototype, "selectable", void 0);
|
|
4372
4491
|
__decorate$2([
|
|
4373
4492
|
Property('selected')
|
|
4374
4493
|
], Fields.prototype, "selected", void 0);
|
|
@@ -4425,6 +4544,8 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
4425
4544
|
_this.selectedData = [];
|
|
4426
4545
|
_this.filterDelayTime = 300;
|
|
4427
4546
|
_this.isClicked = false;
|
|
4547
|
+
// Specifies if the checkAll method has been called
|
|
4548
|
+
_this.isCheckAllCalled = false;
|
|
4428
4549
|
return _this;
|
|
4429
4550
|
}
|
|
4430
4551
|
/**
|
|
@@ -4553,7 +4674,7 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
4553
4674
|
this.updateDataAttribute();
|
|
4554
4675
|
this.setHTMLAttributes();
|
|
4555
4676
|
this.setAttributes();
|
|
4556
|
-
this.popupDiv = this.createElement('div', { className: CONTENT
|
|
4677
|
+
this.popupDiv = this.createElement('div', { className: CONTENT });
|
|
4557
4678
|
this.popupDiv.classList.add(DROPDOWN);
|
|
4558
4679
|
this.tree = this.createElement('div', { id: this.element.id + '_tree' });
|
|
4559
4680
|
this.popupDiv.appendChild(this.tree);
|
|
@@ -5178,7 +5299,12 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
5178
5299
|
temp = this.getOverflowVal(index);
|
|
5179
5300
|
data += temp;
|
|
5180
5301
|
temp = this.overFlowWrapper.innerHTML;
|
|
5181
|
-
this.
|
|
5302
|
+
if (this.enableHtmlSanitizer) {
|
|
5303
|
+
this.overFlowWrapper.innerText = data;
|
|
5304
|
+
}
|
|
5305
|
+
else {
|
|
5306
|
+
this.overFlowWrapper.innerHTML = data;
|
|
5307
|
+
}
|
|
5182
5308
|
wrapperleng = this.overFlowWrapper.offsetWidth;
|
|
5183
5309
|
overAllContainer = this.inputWrapper.offsetWidth;
|
|
5184
5310
|
if ((wrapperleng + downIconWidth + this.clearIconWidth) > overAllContainer) {
|
|
@@ -5348,7 +5474,7 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
5348
5474
|
if (isValid && this.value !== null && (this.value && this.value.length !== 0)) {
|
|
5349
5475
|
addClass([this.inputEle], CHIP_INPUT);
|
|
5350
5476
|
}
|
|
5351
|
-
else if (this.value === null || (this.value && this.value.length === 0)) {
|
|
5477
|
+
else if (this.value === null || (this.value && this.value.length === 0) || this.chipWrapper) {
|
|
5352
5478
|
addClass([this.chipWrapper], HIDEICON);
|
|
5353
5479
|
}
|
|
5354
5480
|
}
|
|
@@ -5403,6 +5529,7 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
5403
5529
|
frameSpan.classList.add(CHECK);
|
|
5404
5530
|
ariaState = 'true';
|
|
5405
5531
|
if (!this.isReverseUpdate) {
|
|
5532
|
+
this.isCheckAllCalled = true;
|
|
5406
5533
|
this.treeObj.checkAll();
|
|
5407
5534
|
if (!this.changeOnBlur) {
|
|
5408
5535
|
this.triggerChangeEvent(e);
|
|
@@ -5706,10 +5833,12 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
5706
5833
|
nodeSelected: this.onNodeSelected.bind(this),
|
|
5707
5834
|
nodeChecked: this.onNodeChecked.bind(this),
|
|
5708
5835
|
nodeChecking: this.beforeCheck.bind(this),
|
|
5836
|
+
nodeExpanded: this.onNodeExpanded.bind(this),
|
|
5709
5837
|
actionFailure: this.onActionFailure.bind(this),
|
|
5710
5838
|
nodeClicked: this.onNodeClicked.bind(this),
|
|
5711
5839
|
dataBound: this.OnDataBound.bind(this),
|
|
5712
5840
|
allowMultiSelection: this.allowMultiSelection,
|
|
5841
|
+
enableHtmlSanitizer: this.enableHtmlSanitizer,
|
|
5713
5842
|
showCheckBox: this.showCheckBox,
|
|
5714
5843
|
autoCheck: this.treeSettings.autoCheck,
|
|
5715
5844
|
sortOrder: this.sortOrder,
|
|
@@ -5812,7 +5941,7 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
5812
5941
|
var height = Math.round(this.header.getBoundingClientRect().height);
|
|
5813
5942
|
popupHeight = formatUnit(parseInt(popupHeight, 10) - height + 'px');
|
|
5814
5943
|
}
|
|
5815
|
-
if (this.showCheckBox && this.showSelectAll) {
|
|
5944
|
+
if (this.showCheckBox && this.showSelectAll && (!this.popupDiv.classList.contains(NODATA))) {
|
|
5816
5945
|
var height = Math.round(this.checkAllParent.getBoundingClientRect().height);
|
|
5817
5946
|
popupHeight = formatUnit(parseInt(popupHeight, 10) - height + 'px');
|
|
5818
5947
|
}
|
|
@@ -5895,14 +6024,14 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
5895
6024
|
var isFooter = closest(target, '.' + FOOTER);
|
|
5896
6025
|
var isScroller = target.classList.contains(DROPDOWN) ? true :
|
|
5897
6026
|
(matches(target, '.e-ddt .e-popup') || matches(target, '.e-ddt .e-treeview'));
|
|
5898
|
-
if ((this.isPopupOpen && (this.inputWrapper.contains(target) || isTree ||
|
|
6027
|
+
if ((this.isPopupOpen && (this.inputWrapper.contains(target) || isTree || isScroller || isHeader || isFooter)) ||
|
|
5899
6028
|
((this.allowMultiSelection || this.showCheckBox) && (this.isPopupOpen && target.classList.contains(CHIP_CLOSE) ||
|
|
5900
6029
|
(this.isPopupOpen && (target.classList.contains(CHECKALLPARENT) || target.classList.contains(ALLTEXT)
|
|
5901
6030
|
|| target.classList.contains(CHECKBOXFRAME)))))) {
|
|
5902
6031
|
this.isDocumentClick = false;
|
|
5903
6032
|
e.preventDefault();
|
|
5904
6033
|
}
|
|
5905
|
-
else if (!this.inputWrapper.contains(target) && this.inputFocus) {
|
|
6034
|
+
else if (!this.inputWrapper.contains(target) && this.inputFocus && !isFilter) {
|
|
5906
6035
|
this.focusOut(e);
|
|
5907
6036
|
}
|
|
5908
6037
|
};
|
|
@@ -5935,6 +6064,9 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
5935
6064
|
}
|
|
5936
6065
|
var eventArgs = { data: args.data };
|
|
5937
6066
|
this.trigger('dataBound', eventArgs);
|
|
6067
|
+
if (this.filterObj === null) {
|
|
6068
|
+
this.isFilteredData = false;
|
|
6069
|
+
}
|
|
5938
6070
|
if (this.isFilteredData) {
|
|
5939
6071
|
this.treeObj.expandAll();
|
|
5940
6072
|
}
|
|
@@ -6002,7 +6134,7 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
6002
6134
|
dataSource: fields.dataSource, value: fields.value, text: fields.text, parentValue: fields.parentValue,
|
|
6003
6135
|
child: this.cloneChildField(fields.child), hasChildren: fields.hasChildren, expanded: fields.expanded,
|
|
6004
6136
|
iconCss: fields.iconCss, imageUrl: fields.imageUrl, htmlAttributes: fields.htmlAttributes, query: fields.query,
|
|
6005
|
-
selected: fields.selected, tableName: fields.tableName, tooltip: fields.tooltip
|
|
6137
|
+
selected: fields.selected, selectable: fields.selectable, tableName: fields.tableName, tooltip: fields.tooltip
|
|
6006
6138
|
};
|
|
6007
6139
|
return clonedField;
|
|
6008
6140
|
};
|
|
@@ -6015,7 +6147,7 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
6015
6147
|
dataSource: fields.dataSource, value: fields.value, text: fields.text, parentValue: fields.parentValue,
|
|
6016
6148
|
child: (fields.child ? this.cloneChildField(fields.child) : null), hasChildren: fields.hasChildren,
|
|
6017
6149
|
expanded: fields.expanded, iconCss: fields.iconCss, imageUrl: fields.imageUrl, htmlAttributes: fields.htmlAttributes,
|
|
6018
|
-
query: fields.query, selected: fields.selected, tableName: fields.tableName, tooltip: fields.tooltip
|
|
6150
|
+
query: fields.query, selected: fields.selected, selectable: fields.selectable, tableName: fields.tableName, tooltip: fields.tooltip
|
|
6019
6151
|
};
|
|
6020
6152
|
return clonedField;
|
|
6021
6153
|
}
|
|
@@ -6025,7 +6157,7 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
6025
6157
|
dataSource: fields.dataSource, id: fields.value, text: fields.text, parentID: fields.parentValue,
|
|
6026
6158
|
child: this.getTreeChildren(fields.child), hasChildren: fields.hasChildren, expanded: fields.expanded,
|
|
6027
6159
|
iconCss: fields.iconCss, imageUrl: fields.imageUrl, isChecked: fields.selected,
|
|
6028
|
-
htmlAttributes: fields.htmlAttributes, query: fields.query, selected: fields.selected,
|
|
6160
|
+
htmlAttributes: fields.htmlAttributes, query: fields.query, selectable: fields.selectable, selected: fields.selected,
|
|
6029
6161
|
tableName: fields.tableName, tooltip: fields.tooltip
|
|
6030
6162
|
};
|
|
6031
6163
|
return treeFields;
|
|
@@ -6203,13 +6335,14 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
6203
6335
|
var nodes = this.treeObj.element.querySelectorAll('li');
|
|
6204
6336
|
var checkedNodes = this.treeObj.element.querySelectorAll('li .e-checkbox-wrapper[aria-checked=true]');
|
|
6205
6337
|
var wrap = closest(this.checkBoxElement, '.' + CHECKBOXWRAP);
|
|
6206
|
-
if (wrap && args.action === 'uncheck') {
|
|
6338
|
+
if (wrap && args.action === 'uncheck' && (args.isInteracted || checkedNodes.length === 0)) {
|
|
6207
6339
|
this.isReverseUpdate = true;
|
|
6208
6340
|
this.changeState(wrap, 'uncheck');
|
|
6209
6341
|
this.isReverseUpdate = false;
|
|
6210
6342
|
}
|
|
6211
|
-
else if (wrap && args.action === 'check' && checkedNodes.length === nodes.length) {
|
|
6343
|
+
else if (wrap && args.action === 'check' && checkedNodes.length === nodes.length && this.isCheckAllCalled) {
|
|
6212
6344
|
this.isReverseUpdate = true;
|
|
6345
|
+
this.isCheckAllCalled = false;
|
|
6213
6346
|
this.changeState(wrap, 'check');
|
|
6214
6347
|
this.isReverseUpdate = false;
|
|
6215
6348
|
}
|
|
@@ -6220,6 +6353,13 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
6220
6353
|
this.oldValue = this.value ? this.value.slice() : this.value;
|
|
6221
6354
|
}
|
|
6222
6355
|
};
|
|
6356
|
+
DropDownTree.prototype.onNodeExpanded = function (args) {
|
|
6357
|
+
if (this.hasTemplate && this.portals) {
|
|
6358
|
+
this.portals = [].concat(this.treeObj.portals);
|
|
6359
|
+
/* eslint-enable */
|
|
6360
|
+
this.renderReactTemplates();
|
|
6361
|
+
}
|
|
6362
|
+
};
|
|
6223
6363
|
DropDownTree.prototype.updateClearButton = function (state) {
|
|
6224
6364
|
if (state) {
|
|
6225
6365
|
if (!this.inputWrapper.contains(this.overAllClear)) {
|
|
@@ -6520,7 +6660,12 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
6520
6660
|
});
|
|
6521
6661
|
var chipContent = this.createElement('span', { className: CHIP_CONTENT });
|
|
6522
6662
|
var chipClose = this.createElement('span', { className: CHIP_CLOSE + ' ' + ICONS });
|
|
6523
|
-
|
|
6663
|
+
if (this.enableHtmlSanitizer) {
|
|
6664
|
+
chipContent.innerText = text;
|
|
6665
|
+
}
|
|
6666
|
+
else {
|
|
6667
|
+
chipContent.innerHTML = text;
|
|
6668
|
+
}
|
|
6524
6669
|
chip.appendChild(chipContent);
|
|
6525
6670
|
this.chipCollection.appendChild(chip);
|
|
6526
6671
|
if (this.showClearButton) {
|
|
@@ -6716,6 +6861,7 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
6716
6861
|
DropDownTree.prototype.selectAllItems = function (state) {
|
|
6717
6862
|
if (this.showCheckBox) {
|
|
6718
6863
|
if (state) {
|
|
6864
|
+
this.isCheckAllCalled = true;
|
|
6719
6865
|
this.treeObj.checkAll();
|
|
6720
6866
|
}
|
|
6721
6867
|
else {
|
|
@@ -6810,8 +6956,6 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
6810
6956
|
}
|
|
6811
6957
|
else {
|
|
6812
6958
|
this.noRecord = this.createElement('div');
|
|
6813
|
-
addClass([this.noRecord], NODATACONTAINER);
|
|
6814
|
-
prepend([this.noRecord], this.popupDiv);
|
|
6815
6959
|
}
|
|
6816
6960
|
if (this.noRecordsTemplate !== 'No Records Found' || this.actionFailureTemplate !== 'The Request Failed') {
|
|
6817
6961
|
var template = actionFailure ? this.actionFailureTemplate : this.noRecordsTemplate;
|
|
@@ -6823,6 +6967,8 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
6823
6967
|
if (tempArr) {
|
|
6824
6968
|
tempArr = Array.prototype.slice.call(tempArr);
|
|
6825
6969
|
append(tempArr, this.noRecord);
|
|
6970
|
+
addClass([this.noRecord], NODATACONTAINER);
|
|
6971
|
+
prepend([this.noRecord], this.popupDiv);
|
|
6826
6972
|
}
|
|
6827
6973
|
}
|
|
6828
6974
|
else {
|
|
@@ -6831,6 +6977,8 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
6831
6977
|
this.l10n = new L10n(this.getLocaleName(), l10nLocale, this.locale);
|
|
6832
6978
|
this.noRecord.innerHTML = actionFailure ?
|
|
6833
6979
|
this.l10n.getConstant('actionFailureTemplate') : this.l10n.getConstant('noRecordsTemplate');
|
|
6980
|
+
addClass([this.noRecord], NODATACONTAINER);
|
|
6981
|
+
prepend([this.noRecord], this.popupDiv);
|
|
6834
6982
|
}
|
|
6835
6983
|
};
|
|
6836
6984
|
DropDownTree.prototype.updateRecordTemplate = function (action) {
|
|
@@ -7342,6 +7490,9 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
7342
7490
|
__decorate$2([
|
|
7343
7491
|
Property(false)
|
|
7344
7492
|
], DropDownTree.prototype, "showCheckBox", void 0);
|
|
7493
|
+
__decorate$2([
|
|
7494
|
+
Property(false)
|
|
7495
|
+
], DropDownTree.prototype, "enableHtmlSanitizer", void 0);
|
|
7345
7496
|
__decorate$2([
|
|
7346
7497
|
Property(true)
|
|
7347
7498
|
], DropDownTree.prototype, "showClearButton", void 0);
|
|
@@ -7595,15 +7746,12 @@ var ComboBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
7595
7746
|
};
|
|
7596
7747
|
ComboBox.prototype.getAriaAttributes = function () {
|
|
7597
7748
|
var ariaAttributes = {
|
|
7598
|
-
'aria-owns': this.element.id + '_options',
|
|
7599
7749
|
'role': 'combobox',
|
|
7600
7750
|
'aria-autocomplete': 'both',
|
|
7601
7751
|
'aria-labelledby': this.hiddenElement.id,
|
|
7602
|
-
'aria-hasPopup': 'true',
|
|
7603
7752
|
'aria-expanded': 'false',
|
|
7604
7753
|
'aria-readonly': this.readonly.toString(),
|
|
7605
7754
|
'autocomplete': 'off',
|
|
7606
|
-
'autocorrect': 'off',
|
|
7607
7755
|
'autocapitalize': 'off',
|
|
7608
7756
|
'spellcheck': 'false'
|
|
7609
7757
|
};
|
|
@@ -7646,7 +7794,7 @@ var ComboBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
7646
7794
|
};
|
|
7647
7795
|
ComboBox.prototype.getFocusElement = function () {
|
|
7648
7796
|
var dataItem = this.isSelectCustom ? { text: '' } : this.getItemData();
|
|
7649
|
-
var selected = this.list.querySelector('.' + dropDownListClasses.selected);
|
|
7797
|
+
var selected = !isNullOrUndefined(this.list) ? this.list.querySelector('.' + dropDownListClasses.selected) : this.list;
|
|
7650
7798
|
var isSelected = dataItem.text === this.inputElement.value && !isNullOrUndefined(selected);
|
|
7651
7799
|
if (isSelected) {
|
|
7652
7800
|
return selected;
|
|
@@ -7654,7 +7802,9 @@ var ComboBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
7654
7802
|
if ((Browser.isDevice && !this.isDropDownClick || !Browser.isDevice) &&
|
|
7655
7803
|
!isNullOrUndefined(this.liCollections) && this.liCollections.length > 0) {
|
|
7656
7804
|
var inputValue = this.inputElement.value;
|
|
7657
|
-
var
|
|
7805
|
+
var dataSource = this.sortedData;
|
|
7806
|
+
var type = this.typeOfData(dataSource).typeof;
|
|
7807
|
+
var activeItem = Search(inputValue, this.liCollections, this.filterType, true, dataSource, this.fields, type);
|
|
7658
7808
|
var activeElement = activeItem.item;
|
|
7659
7809
|
if (!isNullOrUndefined(activeElement)) {
|
|
7660
7810
|
var count = this.getIndexByValue(activeElement.getAttribute('data-value')) - 1;
|
|
@@ -7695,7 +7845,7 @@ var ComboBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
7695
7845
|
this.itemData = this.getDataByValue(this.value);
|
|
7696
7846
|
var dataItem = this.getItemData();
|
|
7697
7847
|
if (!(this.allowCustom && isNullOrUndefined(dataItem.value) && isNullOrUndefined(dataItem.text))) {
|
|
7698
|
-
this.setProperties({ 'value': dataItem.value
|
|
7848
|
+
this.setProperties({ 'value': dataItem.value }, !this.allowCustom);
|
|
7699
7849
|
}
|
|
7700
7850
|
};
|
|
7701
7851
|
/**
|
|
@@ -7804,9 +7954,11 @@ var ComboBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
7804
7954
|
}
|
|
7805
7955
|
else if (this.inputElement.value === '') {
|
|
7806
7956
|
this.activeIndex = null;
|
|
7807
|
-
this.list
|
|
7808
|
-
|
|
7809
|
-
|
|
7957
|
+
if (!isNullOrUndefined(this.list)) {
|
|
7958
|
+
this.list.scrollTop = 0;
|
|
7959
|
+
var focusItem = this.list.querySelector('.' + dropDownListClasses.li);
|
|
7960
|
+
this.setHoverList(focusItem);
|
|
7961
|
+
}
|
|
7810
7962
|
}
|
|
7811
7963
|
else {
|
|
7812
7964
|
this.activeIndex = null;
|
|
@@ -7817,7 +7969,7 @@ var ComboBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
7817
7969
|
}
|
|
7818
7970
|
};
|
|
7819
7971
|
ComboBox.prototype.incrementalSearch = function (e) {
|
|
7820
|
-
this.showPopup();
|
|
7972
|
+
this.showPopup(e);
|
|
7821
7973
|
if (!isNullOrUndefined(this.listData)) {
|
|
7822
7974
|
this.inlineSearch(e);
|
|
7823
7975
|
e.preventDefault();
|
|
@@ -7903,6 +8055,7 @@ var ComboBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
7903
8055
|
this.preventFocus = false;
|
|
7904
8056
|
}
|
|
7905
8057
|
this.onFocus(e);
|
|
8058
|
+
Input.calculateWidth(this.inputElement, this.inputWrapper.container);
|
|
7906
8059
|
};
|
|
7907
8060
|
ComboBox.prototype.dropDownClick = function (e) {
|
|
7908
8061
|
e.preventDefault();
|
|
@@ -8054,7 +8207,7 @@ var ComboBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
8054
8207
|
* Adds a new item to the combobox popup list. By default, new item appends to the list as the last item,
|
|
8055
8208
|
* but you can insert based on the index parameter.
|
|
8056
8209
|
*
|
|
8057
|
-
* @param
|
|
8210
|
+
* @param { Object[] } items - Specifies an array of JSON data or a JSON data.
|
|
8058
8211
|
* @param { number } itemIndex - Specifies the index to place the newly added item in the popup list.
|
|
8059
8212
|
* @returns {void}
|
|
8060
8213
|
* @deprecated
|
|
@@ -8065,9 +8218,9 @@ var ComboBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
8065
8218
|
/**
|
|
8066
8219
|
* To filter the data from given data source by using query
|
|
8067
8220
|
*
|
|
8068
|
-
* @param
|
|
8069
|
-
* @param
|
|
8070
|
-
* @param
|
|
8221
|
+
* @param {Object[] | DataManager } dataSource - Set the data source to filter.
|
|
8222
|
+
* @param {Query} query - Specify the query to filter the data.
|
|
8223
|
+
* @param {FieldSettingsModel} fields - Specify the fields to map the column in the data table.
|
|
8071
8224
|
* @returns {void}
|
|
8072
8225
|
* @deprecated
|
|
8073
8226
|
*/
|
|
@@ -8080,8 +8233,8 @@ var ComboBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
8080
8233
|
* @returns {void}
|
|
8081
8234
|
* @deprecated
|
|
8082
8235
|
*/
|
|
8083
|
-
ComboBox.prototype.showPopup = function () {
|
|
8084
|
-
_super.prototype.showPopup.call(this);
|
|
8236
|
+
ComboBox.prototype.showPopup = function (e) {
|
|
8237
|
+
_super.prototype.showPopup.call(this, e);
|
|
8085
8238
|
};
|
|
8086
8239
|
/* eslint-disable valid-jsdoc, jsdoc/require-param */
|
|
8087
8240
|
/**
|
|
@@ -8104,7 +8257,7 @@ var ComboBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
8104
8257
|
this.removeFillSelection();
|
|
8105
8258
|
}
|
|
8106
8259
|
var dataItem = this.isSelectCustom ? { text: '' } : this.getItemData();
|
|
8107
|
-
var selected = this.list.querySelector('.' + dropDownListClasses.selected);
|
|
8260
|
+
var selected = !isNullOrUndefined(this.list) ? this.list.querySelector('.' + dropDownListClasses.selected) : null;
|
|
8108
8261
|
if (this.inputElement && dataItem.text === this.inputElement.value && !isNullOrUndefined(selected)) {
|
|
8109
8262
|
if (this.isSelected) {
|
|
8110
8263
|
this.onChangeEvent(e);
|
|
@@ -8114,10 +8267,12 @@ var ComboBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
8114
8267
|
return;
|
|
8115
8268
|
}
|
|
8116
8269
|
if (this.getModuleName() === 'combobox' && this.inputElement.value.trim() !== '') {
|
|
8117
|
-
var
|
|
8270
|
+
var dataSource = this.sortedData;
|
|
8271
|
+
var type = this.typeOfData(dataSource).typeof;
|
|
8272
|
+
var searchItem = Search(this.inputElement.value, this.liCollections, 'Equal', true, dataSource, this.fields, type);
|
|
8118
8273
|
this.selectedLI = searchItem.item;
|
|
8119
8274
|
if (isNullOrUndefined(searchItem.index)) {
|
|
8120
|
-
searchItem.index = Search(this.inputElement.value, this.liCollections, 'StartsWith', true).index;
|
|
8275
|
+
searchItem.index = Search(this.inputElement.value, this.liCollections, 'StartsWith', true, dataSource, this.fields, type).index;
|
|
8121
8276
|
}
|
|
8122
8277
|
this.activeIndex = searchItem.index;
|
|
8123
8278
|
if (!isNullOrUndefined(this.selectedLI)) {
|
|
@@ -8318,10 +8473,10 @@ var AutoComplete = /** @__PURE__ @class */ (function (_super) {
|
|
|
8318
8473
|
* @private
|
|
8319
8474
|
*/
|
|
8320
8475
|
function AutoComplete(options, element) {
|
|
8321
|
-
var
|
|
8322
|
-
|
|
8323
|
-
|
|
8324
|
-
return
|
|
8476
|
+
var _this_1 = _super.call(this, options, element) || this;
|
|
8477
|
+
_this_1.isFiltered = false;
|
|
8478
|
+
_this_1.searchList = false;
|
|
8479
|
+
return _this_1;
|
|
8325
8480
|
}
|
|
8326
8481
|
/**
|
|
8327
8482
|
* Initialize the event handler
|
|
@@ -8369,17 +8524,17 @@ var AutoComplete = /** @__PURE__ @class */ (function (_super) {
|
|
|
8369
8524
|
return filterQuery;
|
|
8370
8525
|
};
|
|
8371
8526
|
AutoComplete.prototype.searchLists = function (e) {
|
|
8372
|
-
var
|
|
8527
|
+
var _this_1 = this;
|
|
8373
8528
|
this.isTyped = true;
|
|
8374
8529
|
this.isDataFetched = this.isSelectCustom = false;
|
|
8375
8530
|
if (isNullOrUndefined(this.list)) {
|
|
8376
|
-
_super.prototype.renderList.call(this, true);
|
|
8531
|
+
_super.prototype.renderList.call(this, e, true);
|
|
8377
8532
|
}
|
|
8378
8533
|
this.queryString = this.filterInput.value;
|
|
8379
8534
|
if (e.type !== 'mousedown' && (e.keyCode === 40 || e.keyCode === 38)) {
|
|
8380
8535
|
this.queryString = this.queryString === '' ? null : this.queryString;
|
|
8381
8536
|
this.beforePopupOpen = true;
|
|
8382
|
-
this.resetList(this.dataSource, this.fields);
|
|
8537
|
+
this.resetList(this.dataSource, this.fields, null, e);
|
|
8383
8538
|
return;
|
|
8384
8539
|
}
|
|
8385
8540
|
this.isSelected = false;
|
|
@@ -8391,24 +8546,24 @@ var AutoComplete = /** @__PURE__ @class */ (function (_super) {
|
|
|
8391
8546
|
if (eventArgs.cancel) {
|
|
8392
8547
|
return;
|
|
8393
8548
|
}
|
|
8394
|
-
|
|
8395
|
-
|
|
8549
|
+
_this_1.isFiltered = true;
|
|
8550
|
+
_this_1.filterAction(dataSource, query, fields);
|
|
8396
8551
|
},
|
|
8397
8552
|
cancel: false
|
|
8398
8553
|
};
|
|
8399
8554
|
this.trigger('filtering', eventArgs, function (eventArgs) {
|
|
8400
|
-
if (!eventArgs.cancel && !
|
|
8401
|
-
|
|
8402
|
-
|
|
8555
|
+
if (!eventArgs.cancel && !_this_1.isFiltered && !eventArgs.preventDefaultAction) {
|
|
8556
|
+
_this_1.searchList = true;
|
|
8557
|
+
_this_1.filterAction(_this_1.dataSource, null, _this_1.fields, e);
|
|
8403
8558
|
}
|
|
8404
8559
|
});
|
|
8405
8560
|
};
|
|
8406
8561
|
/**
|
|
8407
8562
|
* To filter the data from given data source by using query
|
|
8408
8563
|
*
|
|
8409
|
-
* @param
|
|
8410
|
-
* @param
|
|
8411
|
-
* @param
|
|
8564
|
+
* @param {Object[] | DataManager } dataSource - Set the data source to filter.
|
|
8565
|
+
* @param {Query} query - Specify the query to filter the data.
|
|
8566
|
+
* @param {FieldSettingsModel} fields - Specify the fields to map the column in the data table.
|
|
8412
8567
|
* @returns {void}
|
|
8413
8568
|
* @deprecated
|
|
8414
8569
|
*/
|
|
@@ -8416,13 +8571,13 @@ var AutoComplete = /** @__PURE__ @class */ (function (_super) {
|
|
|
8416
8571
|
this.isFiltered = true;
|
|
8417
8572
|
this.filterAction(dataSource, query, fields);
|
|
8418
8573
|
};
|
|
8419
|
-
AutoComplete.prototype.filterAction = function (dataSource, query, fields) {
|
|
8574
|
+
AutoComplete.prototype.filterAction = function (dataSource, query, fields, e) {
|
|
8420
8575
|
this.beforePopupOpen = true;
|
|
8421
8576
|
if (this.queryString !== '' && (this.queryString.length >= this.minLength)) {
|
|
8422
|
-
this.resetList(dataSource, fields, query);
|
|
8577
|
+
this.resetList(dataSource, fields, query, e);
|
|
8423
8578
|
}
|
|
8424
8579
|
else {
|
|
8425
|
-
this.hidePopup();
|
|
8580
|
+
this.hidePopup(e);
|
|
8426
8581
|
this.beforePopupOpen = false;
|
|
8427
8582
|
}
|
|
8428
8583
|
this.renderReactTemplates();
|
|
@@ -8448,7 +8603,9 @@ var AutoComplete = /** @__PURE__ @class */ (function (_super) {
|
|
|
8448
8603
|
AutoComplete.prototype.postBackAction = function () {
|
|
8449
8604
|
if (this.autofill && !isNullOrUndefined(this.liCollections[0]) && this.searchList) {
|
|
8450
8605
|
var items = [this.liCollections[0]];
|
|
8451
|
-
var
|
|
8606
|
+
var dataSource = this.listData;
|
|
8607
|
+
var type = this.typeOfData(dataSource).typeof;
|
|
8608
|
+
var searchItem = Search(this.inputElement.value, items, 'StartsWith', this.ignoreCase, dataSource, this.fields, type);
|
|
8452
8609
|
this.searchList = false;
|
|
8453
8610
|
if (!isNullOrUndefined(searchItem.item)) {
|
|
8454
8611
|
_super.prototype.setAutoFill.call(this, this.liCollections[0], true);
|
|
@@ -8457,6 +8614,7 @@ var AutoComplete = /** @__PURE__ @class */ (function (_super) {
|
|
|
8457
8614
|
};
|
|
8458
8615
|
AutoComplete.prototype.setSelection = function (li, e) {
|
|
8459
8616
|
if (!this.isValidLI(li)) {
|
|
8617
|
+
this.selectedLI = li;
|
|
8460
8618
|
return;
|
|
8461
8619
|
}
|
|
8462
8620
|
if (!isNullOrUndefined(e) && e.type === 'keydown' && e.action !== 'enter'
|
|
@@ -8472,25 +8630,24 @@ var AutoComplete = /** @__PURE__ @class */ (function (_super) {
|
|
|
8472
8630
|
e.action === 'home' || e.action === 'end' || e.action === 'pageUp' || e.action === 'pageDown');
|
|
8473
8631
|
_super.prototype.setAutoFill.call(this, li, isKeyNavigate);
|
|
8474
8632
|
}
|
|
8475
|
-
attributes(this.inputElement, { 'aria-activedescendant': this.selectedLI ? this.selectedLI.id : null });
|
|
8476
8633
|
}
|
|
8477
8634
|
else {
|
|
8478
8635
|
_super.prototype.setSelection.call(this, li, e);
|
|
8479
8636
|
}
|
|
8480
8637
|
};
|
|
8481
8638
|
AutoComplete.prototype.listOption = function (dataSource, fieldsSettings) {
|
|
8482
|
-
var
|
|
8639
|
+
var _this_1 = this;
|
|
8483
8640
|
var fields = _super.prototype.listOption.call(this, dataSource, fieldsSettings);
|
|
8484
8641
|
if (isNullOrUndefined(fields.itemCreated)) {
|
|
8485
8642
|
fields.itemCreated = function (e) {
|
|
8486
|
-
if (
|
|
8487
|
-
if (
|
|
8643
|
+
if (_this_1.highlight) {
|
|
8644
|
+
if (_this_1.element.tagName === _this_1.getNgDirective() && _this_1.itemTemplate) {
|
|
8488
8645
|
setTimeout(function () {
|
|
8489
|
-
highlightSearch(e.item,
|
|
8646
|
+
highlightSearch(e.item, _this_1.queryString, _this_1.ignoreCase, _this_1.filterType);
|
|
8490
8647
|
}, 0);
|
|
8491
8648
|
}
|
|
8492
8649
|
else {
|
|
8493
|
-
highlightSearch(e.item,
|
|
8650
|
+
highlightSearch(e.item, _this_1.queryString, _this_1.ignoreCase, _this_1.filterType);
|
|
8494
8651
|
}
|
|
8495
8652
|
}
|
|
8496
8653
|
};
|
|
@@ -8498,10 +8655,10 @@ var AutoComplete = /** @__PURE__ @class */ (function (_super) {
|
|
|
8498
8655
|
else {
|
|
8499
8656
|
var itemCreated_1 = fields.itemCreated;
|
|
8500
8657
|
fields.itemCreated = function (e) {
|
|
8501
|
-
if (
|
|
8502
|
-
highlightSearch(e.item,
|
|
8658
|
+
if (_this_1.highlight) {
|
|
8659
|
+
highlightSearch(e.item, _this_1.queryString, _this_1.ignoreCase, _this_1.filterType);
|
|
8503
8660
|
}
|
|
8504
|
-
itemCreated_1.apply(
|
|
8661
|
+
itemCreated_1.apply(_this_1, [e]);
|
|
8505
8662
|
};
|
|
8506
8663
|
}
|
|
8507
8664
|
return fields;
|
|
@@ -8509,9 +8666,9 @@ var AutoComplete = /** @__PURE__ @class */ (function (_super) {
|
|
|
8509
8666
|
AutoComplete.prototype.isFiltering = function () {
|
|
8510
8667
|
return true;
|
|
8511
8668
|
};
|
|
8512
|
-
AutoComplete.prototype.renderPopup = function () {
|
|
8669
|
+
AutoComplete.prototype.renderPopup = function (e) {
|
|
8513
8670
|
this.list.scrollTop = 0;
|
|
8514
|
-
_super.prototype.renderPopup.call(this);
|
|
8671
|
+
_super.prototype.renderPopup.call(this, e);
|
|
8515
8672
|
};
|
|
8516
8673
|
AutoComplete.prototype.isEditTextBox = function () {
|
|
8517
8674
|
return true && this.inputElement.value.trim() !== '';
|
|
@@ -8523,13 +8680,37 @@ var AutoComplete = /** @__PURE__ @class */ (function (_super) {
|
|
|
8523
8680
|
AutoComplete.prototype.isSelectFocusItem = function (element) {
|
|
8524
8681
|
return false;
|
|
8525
8682
|
};
|
|
8683
|
+
AutoComplete.prototype.setInputValue = function (newProp, oldProp) {
|
|
8684
|
+
var oldValue = oldProp && oldProp.text ? oldProp.text : oldProp ? oldProp.value : oldProp;
|
|
8685
|
+
var value = newProp && newProp.text ? newProp.text : newProp && newProp.value ? newProp.value : this.value;
|
|
8686
|
+
if (value && this.typedString === '' && !this.allowCustom && !(this.dataSource instanceof DataManager)) {
|
|
8687
|
+
var checkFields_1_1 = this.typeOfData(this.dataSource).typeof === 'string' ? '' : this.fields.value;
|
|
8688
|
+
var listLength_1 = this.getItems().length;
|
|
8689
|
+
var query = new Query();
|
|
8690
|
+
var _this_2 = this;
|
|
8691
|
+
new DataManager(this.dataSource).executeQuery(query.where(new Predicate(checkFields_1_1, 'equal', value)))
|
|
8692
|
+
.then(function (e) {
|
|
8693
|
+
if (e.result.length > 0) {
|
|
8694
|
+
_this_2.value = checkFields_1_1 !== '' ? e.result[0][_this_2.fields.value].toString() : e.result[0].toString();
|
|
8695
|
+
_this_2.addItem(e.result, listLength_1);
|
|
8696
|
+
_this_2.updateValues();
|
|
8697
|
+
}
|
|
8698
|
+
else {
|
|
8699
|
+
newProp && newProp.text ? _this_2.setOldText(oldValue) : newProp && newProp.value ? _this_2.setOldValue(oldValue) : _this_2.updateValues();
|
|
8700
|
+
}
|
|
8701
|
+
});
|
|
8702
|
+
}
|
|
8703
|
+
else if (newProp) {
|
|
8704
|
+
newProp.text ? this.setOldText(oldValue) : this.setOldValue(oldValue);
|
|
8705
|
+
}
|
|
8706
|
+
};
|
|
8526
8707
|
/**
|
|
8527
8708
|
* Search the entered text and show it in the suggestion list if available.
|
|
8528
8709
|
*
|
|
8529
8710
|
* @returns {void}
|
|
8530
8711
|
* @deprecated
|
|
8531
8712
|
*/
|
|
8532
|
-
AutoComplete.prototype.showPopup = function () {
|
|
8713
|
+
AutoComplete.prototype.showPopup = function (e) {
|
|
8533
8714
|
if (!this.enabled) {
|
|
8534
8715
|
return;
|
|
8535
8716
|
}
|
|
@@ -8540,10 +8721,10 @@ var AutoComplete = /** @__PURE__ @class */ (function (_super) {
|
|
|
8540
8721
|
this.beforePopupOpen = true;
|
|
8541
8722
|
this.preventAutoFill = true;
|
|
8542
8723
|
if (isNullOrUndefined(this.list)) {
|
|
8543
|
-
this.renderList();
|
|
8724
|
+
this.renderList(e);
|
|
8544
8725
|
}
|
|
8545
8726
|
else {
|
|
8546
|
-
this.resetList(this.dataSource, this.fields);
|
|
8727
|
+
this.resetList(this.dataSource, this.fields, null, e);
|
|
8547
8728
|
}
|
|
8548
8729
|
};
|
|
8549
8730
|
/**
|
|
@@ -8574,6 +8755,10 @@ var AutoComplete = /** @__PURE__ @class */ (function (_super) {
|
|
|
8574
8755
|
if (this.showPopupButton) {
|
|
8575
8756
|
var button = Input.appendSpan(dropDownListClasses.icon, this.inputWrapper.container, this.createElement);
|
|
8576
8757
|
this.inputWrapper.buttons[0] = button;
|
|
8758
|
+
Input.calculateWidth(this.inputElement, this.inputWrapper.container);
|
|
8759
|
+
if (!isNullOrUndefined(this.inputWrapper.buttons[0]) && !isNullOrUndefined(this.inputWrapper.container.getElementsByClassName('e-float-text-overflow')[0]) && this.floatLabelType !== 'Never') {
|
|
8760
|
+
this.inputWrapper.container.getElementsByClassName('e-float-text-overflow')[0].classList.add('e-icon');
|
|
8761
|
+
}
|
|
8577
8762
|
if (this.inputWrapper && this.inputWrapper.buttons && this.inputWrapper.buttons[0]) {
|
|
8578
8763
|
EventHandler.add(this.inputWrapper.buttons[0], 'click', this.dropDownClick, this);
|
|
8579
8764
|
}
|
|
@@ -8702,9 +8887,11 @@ var LABELBOTTOM = 'e-label-bottom';
|
|
|
8702
8887
|
function createFloatLabel(overAllWrapper, searchWrapper, element, inputElement, value, floatLabelType, placeholder) {
|
|
8703
8888
|
var floatLinelement = createElement('span', { className: FLOATLINE });
|
|
8704
8889
|
var floatLabelElement = createElement('label', { className: FLOATTEXT });
|
|
8890
|
+
var id = element.getAttribute('id') ? element.getAttribute('id') : getUniqueID('ej2_multiselect');
|
|
8891
|
+
element.id = id;
|
|
8705
8892
|
if (!isNullOrUndefined(element.id) && element.id !== '') {
|
|
8706
8893
|
floatLabelElement.id = 'label_' + element.id.replace(/ /g, '_');
|
|
8707
|
-
attributes(
|
|
8894
|
+
attributes(inputElement, { 'aria-labelledby': floatLabelElement.id });
|
|
8708
8895
|
}
|
|
8709
8896
|
if (!isNullOrUndefined(inputElement.placeholder) && inputElement.placeholder !== '') {
|
|
8710
8897
|
floatLabelElement.innerText = encodePlaceholder(inputElement.placeholder);
|
|
@@ -8922,6 +9109,8 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
8922
9109
|
_this.isValidKey = false;
|
|
8923
9110
|
_this.selectAllEventData = [];
|
|
8924
9111
|
_this.selectAllEventEle = [];
|
|
9112
|
+
_this.resetMainList = null;
|
|
9113
|
+
_this.resetFilteredData = false;
|
|
8925
9114
|
_this.scrollFocusStatus = false;
|
|
8926
9115
|
_this.keyDownStatus = false;
|
|
8927
9116
|
return _this;
|
|
@@ -8964,7 +9153,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
8964
9153
|
var htmlAttr = _a[_i];
|
|
8965
9154
|
switch (htmlAttr) {
|
|
8966
9155
|
case 'class': {
|
|
8967
|
-
var updatedClassValue = (this.htmlAttributes[htmlAttr].replace(/\s+/g, ' ')).trim();
|
|
9156
|
+
var updatedClassValue = (this.htmlAttributes["" + htmlAttr].replace(/\s+/g, ' ')).trim();
|
|
8968
9157
|
if (updatedClassValue !== '') {
|
|
8969
9158
|
addClass([this.overAllWrapper], updatedClassValue.split(' '));
|
|
8970
9159
|
addClass([this.popupWrapper], updatedClassValue.split(' '));
|
|
@@ -8976,7 +9165,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
8976
9165
|
break;
|
|
8977
9166
|
case 'placeholder':
|
|
8978
9167
|
if (!this.placeholder) {
|
|
8979
|
-
this.inputElement.setAttribute(htmlAttr, this.htmlAttributes[htmlAttr]);
|
|
9168
|
+
this.inputElement.setAttribute(htmlAttr, this.htmlAttributes["" + htmlAttr]);
|
|
8980
9169
|
this.setProperties({ placeholder: this.inputElement.placeholder }, true);
|
|
8981
9170
|
this.refreshPlaceHolder();
|
|
8982
9171
|
}
|
|
@@ -8986,16 +9175,16 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
8986
9175
|
var validateAttr = ['name', 'required', 'aria-required', 'form'];
|
|
8987
9176
|
var containerAttr = ['title', 'role', 'style', 'class'];
|
|
8988
9177
|
if (defaultAttr.indexOf(htmlAttr) > -1) {
|
|
8989
|
-
this.element.setAttribute(htmlAttr, this.htmlAttributes[htmlAttr]);
|
|
9178
|
+
this.element.setAttribute(htmlAttr, this.htmlAttributes["" + htmlAttr]);
|
|
8990
9179
|
}
|
|
8991
9180
|
else if (htmlAttr.indexOf('data') === 0 || validateAttr.indexOf(htmlAttr) > -1) {
|
|
8992
|
-
this.hiddenElement.setAttribute(htmlAttr, this.htmlAttributes[htmlAttr]);
|
|
9181
|
+
this.hiddenElement.setAttribute(htmlAttr, this.htmlAttributes["" + htmlAttr]);
|
|
8993
9182
|
}
|
|
8994
9183
|
else if (containerAttr.indexOf(htmlAttr) > -1) {
|
|
8995
|
-
this.overAllWrapper.setAttribute(htmlAttr, this.htmlAttributes[htmlAttr]);
|
|
9184
|
+
this.overAllWrapper.setAttribute(htmlAttr, this.htmlAttributes["" + htmlAttr]);
|
|
8996
9185
|
}
|
|
8997
|
-
else if (htmlAttr !== 'size') {
|
|
8998
|
-
this.inputElement.setAttribute(htmlAttr, this.htmlAttributes[htmlAttr]);
|
|
9186
|
+
else if (htmlAttr !== 'size' && !isNullOrUndefined(this.inputElement)) {
|
|
9187
|
+
this.inputElement.setAttribute(htmlAttr, this.htmlAttributes["" + htmlAttr]);
|
|
8999
9188
|
}
|
|
9000
9189
|
break;
|
|
9001
9190
|
}
|
|
@@ -9004,11 +9193,13 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
9004
9193
|
}
|
|
9005
9194
|
};
|
|
9006
9195
|
MultiSelect.prototype.updateReadonly = function (state) {
|
|
9007
|
-
if (
|
|
9008
|
-
this.
|
|
9009
|
-
|
|
9010
|
-
|
|
9011
|
-
|
|
9196
|
+
if (!isNullOrUndefined(this.inputElement)) {
|
|
9197
|
+
if (state || this.mode === 'CheckBox') {
|
|
9198
|
+
this.inputElement.setAttribute('readonly', 'true');
|
|
9199
|
+
}
|
|
9200
|
+
else {
|
|
9201
|
+
this.inputElement.removeAttribute('readonly');
|
|
9202
|
+
}
|
|
9012
9203
|
}
|
|
9013
9204
|
};
|
|
9014
9205
|
MultiSelect.prototype.updateClearButton = function (state) {
|
|
@@ -9045,7 +9236,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
9045
9236
|
}
|
|
9046
9237
|
}
|
|
9047
9238
|
};
|
|
9048
|
-
MultiSelect.prototype.onPopupShown = function () {
|
|
9239
|
+
MultiSelect.prototype.onPopupShown = function (e) {
|
|
9049
9240
|
var _this = this;
|
|
9050
9241
|
if (Browser.isDevice && (this.mode === 'CheckBox' && this.allowFiltering)) {
|
|
9051
9242
|
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
@@ -9057,7 +9248,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
9057
9248
|
history.pushState({}, '');
|
|
9058
9249
|
}
|
|
9059
9250
|
var animModel = { name: 'FadeIn', duration: 100 };
|
|
9060
|
-
var eventArgs = { popup: this.popupObj, cancel: false, animation: animModel };
|
|
9251
|
+
var eventArgs = { popup: this.popupObj, event: e, cancel: false, animation: animModel };
|
|
9061
9252
|
this.trigger('open', eventArgs, function (eventArgs) {
|
|
9062
9253
|
if (!eventArgs.cancel) {
|
|
9063
9254
|
_this.focusAtFirstListItem();
|
|
@@ -9071,7 +9262,8 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
9071
9262
|
_this.refreshPopup();
|
|
9072
9263
|
_this.renderReactTemplates();
|
|
9073
9264
|
_this.popupObj.show(eventArgs.animation, (_this.zIndex === 1000) ? _this.element : null);
|
|
9074
|
-
attributes(_this.inputElement, { 'aria-expanded': 'true' });
|
|
9265
|
+
attributes(_this.inputElement, { 'aria-expanded': 'true', 'aria-owns': _this.inputElement.id + '_options' });
|
|
9266
|
+
_this.updateAriaActiveDescendant();
|
|
9075
9267
|
if (_this.isFirstClick) {
|
|
9076
9268
|
_this.loadTemplate();
|
|
9077
9269
|
}
|
|
@@ -9141,11 +9333,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
9141
9333
|
MultiSelect.prototype.getAriaAttributes = function () {
|
|
9142
9334
|
var ariaAttributes = {
|
|
9143
9335
|
'aria-disabled': 'false',
|
|
9144
|
-
'
|
|
9145
|
-
'role': 'listbox',
|
|
9146
|
-
'aria-multiselectable': 'true',
|
|
9147
|
-
'aria-activedescendant': 'null',
|
|
9148
|
-
'aria-haspopup': 'true',
|
|
9336
|
+
'role': 'combobox',
|
|
9149
9337
|
'aria-expanded': 'false'
|
|
9150
9338
|
};
|
|
9151
9339
|
return ariaAttributes;
|
|
@@ -9154,8 +9342,10 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
9154
9342
|
if (!isNullOrUndefined(this.ulElement)) {
|
|
9155
9343
|
attributes(this.ulElement, { 'id': this.element.id + '_options', 'role': 'listbox', 'aria-hidden': 'false' });
|
|
9156
9344
|
}
|
|
9157
|
-
var disableStatus = (this.inputElement.disabled) ? true : false;
|
|
9158
|
-
|
|
9345
|
+
var disableStatus = !isNullOrUndefined(this.inputElement) && (this.inputElement.disabled) ? true : false;
|
|
9346
|
+
if (!this.isPopupOpen() && !isNullOrUndefined(this.inputElement)) {
|
|
9347
|
+
attributes(this.inputElement, this.getAriaAttributes());
|
|
9348
|
+
}
|
|
9159
9349
|
if (disableStatus) {
|
|
9160
9350
|
attributes(this.inputElement, { 'aria-disabled': 'true' });
|
|
9161
9351
|
}
|
|
@@ -9223,13 +9413,23 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
9223
9413
|
if (!isNullOrUndefined(this.value) && !this.allowCustomValue) {
|
|
9224
9414
|
for (var i = 0; i < this.value.length; i++) {
|
|
9225
9415
|
var checkEle = this.findListElement(((this.allowFiltering && !isNullOrUndefined(this.mainList)) ? this.mainList : ulElement), 'li', 'data-value', proxy.value[i]);
|
|
9226
|
-
if (!checkEle) {
|
|
9416
|
+
if (!checkEle && !(this.dataSource instanceof DataManager)) {
|
|
9227
9417
|
this.value.splice(i, 1);
|
|
9228
9418
|
i -= 1;
|
|
9229
9419
|
}
|
|
9230
9420
|
}
|
|
9231
9421
|
}
|
|
9232
|
-
|
|
9422
|
+
var valuecheck = [];
|
|
9423
|
+
if (!isNullOrUndefined(this.value) && !this.allowCustomValue) {
|
|
9424
|
+
valuecheck = this.presentItemValue(this.ulElement);
|
|
9425
|
+
}
|
|
9426
|
+
if (valuecheck.length > 0 && this.dataSource instanceof DataManager && !isNullOrUndefined(this.value)
|
|
9427
|
+
&& this.listData != null) {
|
|
9428
|
+
this.addNonPresentItems(valuecheck, this.ulElement, this.listData);
|
|
9429
|
+
}
|
|
9430
|
+
else {
|
|
9431
|
+
this.updateActionList(ulElement, list, e);
|
|
9432
|
+
}
|
|
9233
9433
|
if (this.dataSource instanceof DataManager && this.mode === 'CheckBox' && this.allowFiltering) {
|
|
9234
9434
|
this.removeFocus();
|
|
9235
9435
|
}
|
|
@@ -9253,7 +9453,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
9253
9453
|
this.checkForCustomValue(this.tempQuery, this.fields);
|
|
9254
9454
|
return;
|
|
9255
9455
|
}
|
|
9256
|
-
if (this.value && this.value.length && ((this.mode !== 'CheckBox' && this.inputElement.value.trim() !== '') ||
|
|
9456
|
+
if (this.value && this.value.length && ((this.mode !== 'CheckBox' && !isNullOrUndefined(this.inputElement) && this.inputElement.value.trim() !== '') ||
|
|
9257
9457
|
this.mode === 'CheckBox' || ((this.keyCode === 8 || this.keyCode === 46) && this.allowFiltering &&
|
|
9258
9458
|
this.allowCustomValue && this.dataSource instanceof DataManager && this.inputElement.value === ''))) {
|
|
9259
9459
|
this.refreshSelection();
|
|
@@ -9281,7 +9481,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
9281
9481
|
this.renderPopup();
|
|
9282
9482
|
if (this.beforePopupOpen) {
|
|
9283
9483
|
this.beforePopupOpen = false;
|
|
9284
|
-
this.onPopupShown();
|
|
9484
|
+
this.onPopupShown(e);
|
|
9285
9485
|
}
|
|
9286
9486
|
};
|
|
9287
9487
|
MultiSelect.prototype.refreshSelection = function () {
|
|
@@ -9311,6 +9511,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
9311
9511
|
dropDownBaseClasses.li + ':not(.' + HIDE_LIST + ')');
|
|
9312
9512
|
if (listEle.length > 0) {
|
|
9313
9513
|
addClass([listEle[0]], dropDownBaseClasses.focus);
|
|
9514
|
+
this.updateAriaActiveDescendant();
|
|
9314
9515
|
}
|
|
9315
9516
|
else {
|
|
9316
9517
|
//EJ2-57588 - for this task, we prevent the ul element cloning ( this.ulElement = this.ulElement.cloneNode ? <HTMLElement>this.ulElement.cloneNode(true) : this.ulElement;)
|
|
@@ -9322,8 +9523,8 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
9322
9523
|
}
|
|
9323
9524
|
element.setAttribute('aria-selected', 'true');
|
|
9324
9525
|
if (this.mode === 'CheckBox' && element.classList.contains('e-active')) {
|
|
9325
|
-
var ariaValue = element.
|
|
9326
|
-
if (
|
|
9526
|
+
var ariaValue = element.getElementsByClassName('e-check').length;
|
|
9527
|
+
if (ariaValue === 0) {
|
|
9327
9528
|
var args = {
|
|
9328
9529
|
module: 'CheckBoxSelection',
|
|
9329
9530
|
enable: this.mode === 'CheckBox',
|
|
@@ -9447,9 +9648,9 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
9447
9648
|
/**
|
|
9448
9649
|
* To filter the multiselect data from given data source by using query
|
|
9449
9650
|
*
|
|
9450
|
-
* @param
|
|
9451
|
-
* @param
|
|
9452
|
-
* @param
|
|
9651
|
+
* @param {Object[] | DataManager } dataSource - Set the data source to filter.
|
|
9652
|
+
* @param {Query} query - Specify the query to filter the data.
|
|
9653
|
+
* @param {FieldSettingsModel} fields - Specify the fields to map the column in the data table.
|
|
9453
9654
|
* @returns {void}
|
|
9454
9655
|
*/
|
|
9455
9656
|
MultiSelect.prototype.filter = function (dataSource, query, fields) {
|
|
@@ -9537,7 +9738,8 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
9537
9738
|
this.resetList(tempData, field, query);
|
|
9538
9739
|
}
|
|
9539
9740
|
else {
|
|
9540
|
-
var tempData =
|
|
9741
|
+
var tempData = JSON.parse(JSON.stringify(this.listData));
|
|
9742
|
+
tempData.splice(0, 0, this.inputElement.value);
|
|
9541
9743
|
tempData[0] = (typeof customData === 'number' && !isNaN(parseFloat(tempData[0]))) ?
|
|
9542
9744
|
parseFloat(tempData[0]) : tempData[0];
|
|
9543
9745
|
tempData[0] = (typeof customData === 'boolean') ?
|
|
@@ -9573,7 +9775,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
9573
9775
|
}
|
|
9574
9776
|
if (!this.isPopupOpen() &&
|
|
9575
9777
|
(this.openOnClick || (this.showDropDownIcon && e.target && e.target.className === dropdownIcon))) {
|
|
9576
|
-
this.showPopup();
|
|
9778
|
+
this.showPopup(e);
|
|
9577
9779
|
}
|
|
9578
9780
|
else {
|
|
9579
9781
|
this.hidePopup(e);
|
|
@@ -9655,6 +9857,10 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
9655
9857
|
}
|
|
9656
9858
|
}
|
|
9657
9859
|
this.updateDataList();
|
|
9860
|
+
if (this.resetMainList) {
|
|
9861
|
+
this.mainList = this.resetMainList;
|
|
9862
|
+
this.resetMainList = null;
|
|
9863
|
+
}
|
|
9658
9864
|
this.refreshListItems(null);
|
|
9659
9865
|
if (this.mode !== 'Box' && this.mode !== 'CheckBox') {
|
|
9660
9866
|
this.updateDelimView();
|
|
@@ -9682,6 +9888,25 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
9682
9888
|
this.ulElement = this.mainList;
|
|
9683
9889
|
}
|
|
9684
9890
|
this.checkPlaceholderSize();
|
|
9891
|
+
Input.createSpanElement(this.overAllWrapper, this.createElement);
|
|
9892
|
+
this.calculateWidth();
|
|
9893
|
+
if (!isNullOrUndefined(this.overAllWrapper) && !isNullOrUndefined(this.overAllWrapper.getElementsByClassName('e-ddl-icon')[0] && this.overAllWrapper.getElementsByClassName('e-float-text-content')[0] && this.floatLabelType !== 'Never')) {
|
|
9894
|
+
this.overAllWrapper.getElementsByClassName('e-float-text-content')[0].classList.add('e-icon');
|
|
9895
|
+
}
|
|
9896
|
+
};
|
|
9897
|
+
MultiSelect.prototype.calculateWidth = function () {
|
|
9898
|
+
var elementWidth;
|
|
9899
|
+
if (this.overAllWrapper) {
|
|
9900
|
+
if (!this.showDropDownIcon || this.overAllWrapper.querySelector('.' + 'e-label-top')) {
|
|
9901
|
+
elementWidth = this.overAllWrapper.clientWidth - 2 * (parseInt(getComputedStyle(this.inputElement).paddingRight));
|
|
9902
|
+
}
|
|
9903
|
+
else {
|
|
9904
|
+
var downIconWidth = this.dropIcon.offsetWidth +
|
|
9905
|
+
parseInt(getComputedStyle(this.dropIcon).marginRight);
|
|
9906
|
+
elementWidth = this.overAllWrapper.clientWidth - (downIconWidth + 2 * (parseInt(getComputedStyle(this.inputElement).paddingRight)));
|
|
9907
|
+
}
|
|
9908
|
+
Input.calculateWidth(elementWidth, this.overAllWrapper, this.getModuleName());
|
|
9909
|
+
}
|
|
9685
9910
|
};
|
|
9686
9911
|
MultiSelect.prototype.checkPlaceholderSize = function () {
|
|
9687
9912
|
if (this.showDropDownIcon) {
|
|
@@ -9710,11 +9935,13 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
9710
9935
|
}
|
|
9711
9936
|
};
|
|
9712
9937
|
MultiSelect.prototype.refreshInputHight = function () {
|
|
9713
|
-
if (
|
|
9714
|
-
this.
|
|
9715
|
-
|
|
9716
|
-
|
|
9717
|
-
|
|
9938
|
+
if (!isNullOrUndefined(this.searchWrapper)) {
|
|
9939
|
+
if ((!this.value || !this.value.length) && (isNullOrUndefined(this.text) || this.text === '')) {
|
|
9940
|
+
this.searchWrapper.classList.remove(ZERO_SIZE);
|
|
9941
|
+
}
|
|
9942
|
+
else {
|
|
9943
|
+
this.searchWrapper.classList.add(ZERO_SIZE);
|
|
9944
|
+
}
|
|
9718
9945
|
}
|
|
9719
9946
|
};
|
|
9720
9947
|
MultiSelect.prototype.validateValues = function (newValue, oldValue) {
|
|
@@ -9752,6 +9979,11 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
9752
9979
|
this.tempValues = this.value.slice();
|
|
9753
9980
|
}
|
|
9754
9981
|
};
|
|
9982
|
+
MultiSelect.prototype.updateAriaActiveDescendant = function () {
|
|
9983
|
+
if (!isNullOrUndefined(this.ulElement) && !isNullOrUndefined(this.ulElement.getElementsByClassName('e-item-focus')[0])) {
|
|
9984
|
+
attributes(this.inputElement, { 'aria-activedescendant': this.ulElement.getElementsByClassName('e-item-focus')[0].id });
|
|
9985
|
+
}
|
|
9986
|
+
};
|
|
9755
9987
|
MultiSelect.prototype.getPagingCount = function () {
|
|
9756
9988
|
var height = this.list.classList.contains(dropDownBaseClasses.noData) ? null :
|
|
9757
9989
|
getComputedStyle(this.getItems()[0], null).getPropertyValue('height');
|
|
@@ -9782,6 +10014,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
9782
10014
|
+ ':not(.' + HIDE_LIST + ')') : [];
|
|
9783
10015
|
};
|
|
9784
10016
|
MultiSelect.prototype.focusInHandler = function (e) {
|
|
10017
|
+
var _this = this;
|
|
9785
10018
|
if (this.enabled) {
|
|
9786
10019
|
this.showOverAllClear();
|
|
9787
10020
|
this.inputFocus = true;
|
|
@@ -9812,6 +10045,9 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
9812
10045
|
if (this.isPopupOpen()) {
|
|
9813
10046
|
this.refreshPopup();
|
|
9814
10047
|
}
|
|
10048
|
+
setTimeout(function () {
|
|
10049
|
+
_this.calculateWidth();
|
|
10050
|
+
}, 150);
|
|
9815
10051
|
return true;
|
|
9816
10052
|
}
|
|
9817
10053
|
else {
|
|
@@ -9867,7 +10103,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
9867
10103
|
break;
|
|
9868
10104
|
case 40:
|
|
9869
10105
|
if (!this.isPopupOpen()) {
|
|
9870
|
-
this.showPopup();
|
|
10106
|
+
this.showPopup(e);
|
|
9871
10107
|
e.preventDefault();
|
|
9872
10108
|
}
|
|
9873
10109
|
break;
|
|
@@ -9894,6 +10130,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
9894
10130
|
var element = scrollEle[(isHome) ? 0 : (scrollEle.length - 1)];
|
|
9895
10131
|
element.classList.add(dropDownBaseClasses.focus);
|
|
9896
10132
|
this.scrollBottom(element);
|
|
10133
|
+
this.updateAriaActiveDescendant();
|
|
9897
10134
|
}
|
|
9898
10135
|
};
|
|
9899
10136
|
MultiSelect.prototype.onKeyDown = function (e) {
|
|
@@ -10395,7 +10632,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
10395
10632
|
};
|
|
10396
10633
|
MultiSelect.prototype.invokeCheckboxSelection = function (element, eve, isClearAll) {
|
|
10397
10634
|
this.notify('updatelist', { module: 'CheckBoxSelection', enable: this.mode === 'CheckBox', li: element, e: eve });
|
|
10398
|
-
|
|
10635
|
+
this.updateAriaActiveDescendant();
|
|
10399
10636
|
if ((this.value && this.value.length !== this.mainData.length)
|
|
10400
10637
|
&& (this.mode === 'CheckBox' && this.showSelectAll && !(this.isSelectAll || isClearAll))) {
|
|
10401
10638
|
this.notify('checkSelectAll', {
|
|
@@ -10508,7 +10745,6 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
10508
10745
|
HIDE_LIST :
|
|
10509
10746
|
dropDownBaseClasses.selected);
|
|
10510
10747
|
if (this.mode === 'CheckBox') {
|
|
10511
|
-
element2.firstElementChild.setAttribute('aria-checked', 'false');
|
|
10512
10748
|
removeClass([element2.firstElementChild.lastElementChild], 'e-check');
|
|
10513
10749
|
}
|
|
10514
10750
|
}
|
|
@@ -10518,7 +10754,6 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
10518
10754
|
HIDE_LIST :
|
|
10519
10755
|
dropDownBaseClasses.selected);
|
|
10520
10756
|
if (this.mode === 'CheckBox') {
|
|
10521
|
-
element2.firstElementChild.setAttribute('aria-checked', 'true');
|
|
10522
10757
|
addClass([element2.firstElementChild.lastElementChild], 'e-check');
|
|
10523
10758
|
}
|
|
10524
10759
|
}
|
|
@@ -10779,109 +11014,111 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
10779
11014
|
_super.prototype.render.call(this);
|
|
10780
11015
|
}
|
|
10781
11016
|
if (!this.popupObj) {
|
|
10782
|
-
|
|
10783
|
-
|
|
10784
|
-
|
|
10785
|
-
checkboxFilter.
|
|
10786
|
-
|
|
10787
|
-
|
|
10788
|
-
|
|
10789
|
-
|
|
10790
|
-
|
|
10791
|
-
this.
|
|
10792
|
-
|
|
10793
|
-
}
|
|
10794
|
-
append([this.list], this.popupWrapper);
|
|
10795
|
-
if (this.footerTemplate) {
|
|
10796
|
-
this.setFooterTemplate();
|
|
10797
|
-
overAllHeight -= this.footer.offsetHeight;
|
|
10798
|
-
}
|
|
10799
|
-
if (this.mode === 'CheckBox' && this.showSelectAll) {
|
|
10800
|
-
this.notify('selectAll', { module: 'CheckBoxSelection', enable: this.mode === 'CheckBox' });
|
|
10801
|
-
overAllHeight -= this.selectAllHeight;
|
|
10802
|
-
}
|
|
10803
|
-
else if (this.mode === 'CheckBox' && !this.showSelectAll && (!this.headerTemplate && !this.footerTemplate)) {
|
|
10804
|
-
this.notify('selectAll', { module: 'CheckBoxSelection', enable: this.mode === 'CheckBox' });
|
|
10805
|
-
overAllHeight = parseInt(this.popupHeight, 10);
|
|
10806
|
-
}
|
|
10807
|
-
else if (this.mode === 'CheckBox' && !this.showSelectAll) {
|
|
10808
|
-
this.notify('selectAll', { module: 'CheckBoxSelection', enable: this.mode === 'CheckBox' });
|
|
10809
|
-
overAllHeight = parseInt(this.popupHeight, 10);
|
|
10810
|
-
if (this.headerTemplate && this.header) {
|
|
11017
|
+
if (!isNullOrUndefined(this.popupWrapper)) {
|
|
11018
|
+
document.body.appendChild(this.popupWrapper);
|
|
11019
|
+
var checkboxFilter = this.popupWrapper.querySelector('.' + FILTERPARENT);
|
|
11020
|
+
if (this.mode === 'CheckBox' && !this.allowFiltering && checkboxFilter && this.filterParent) {
|
|
11021
|
+
checkboxFilter.remove();
|
|
11022
|
+
this.filterParent = null;
|
|
11023
|
+
}
|
|
11024
|
+
var overAllHeight = parseInt(this.popupHeight, 10);
|
|
11025
|
+
this.popupWrapper.style.visibility = 'hidden';
|
|
11026
|
+
if (this.headerTemplate) {
|
|
11027
|
+
this.setHeaderTemplate();
|
|
10811
11028
|
overAllHeight -= this.header.offsetHeight;
|
|
10812
11029
|
}
|
|
10813
|
-
|
|
11030
|
+
append([this.list], this.popupWrapper);
|
|
11031
|
+
if (this.footerTemplate) {
|
|
11032
|
+
this.setFooterTemplate();
|
|
10814
11033
|
overAllHeight -= this.footer.offsetHeight;
|
|
10815
11034
|
}
|
|
10816
|
-
|
|
10817
|
-
|
|
10818
|
-
|
|
10819
|
-
module: 'CheckBoxSelection',
|
|
10820
|
-
enable: this.mode === 'CheckBox',
|
|
10821
|
-
popupElement: this.popupWrapper
|
|
10822
|
-
};
|
|
10823
|
-
if (this.allowFiltering) {
|
|
10824
|
-
this.notify('searchBox', args);
|
|
10825
|
-
overAllHeight -= this.searchBoxHeight;
|
|
11035
|
+
if (this.mode === 'CheckBox' && this.showSelectAll) {
|
|
11036
|
+
this.notify('selectAll', { module: 'CheckBoxSelection', enable: this.mode === 'CheckBox' });
|
|
11037
|
+
overAllHeight -= this.selectAllHeight;
|
|
10826
11038
|
}
|
|
10827
|
-
|
|
10828
|
-
|
|
10829
|
-
|
|
10830
|
-
|
|
10831
|
-
this.
|
|
10832
|
-
|
|
10833
|
-
|
|
10834
|
-
|
|
10835
|
-
|
|
10836
|
-
this.popupObj = new Popup(this.popupWrapper, {
|
|
10837
|
-
width: this.calcPopupWidth(), targetType: 'relative', position: { X: 'left', Y: 'bottom' },
|
|
10838
|
-
relateTo: this.overAllWrapper, collision: { X: 'flip', Y: 'flip' }, offsetY: 1,
|
|
10839
|
-
enableRtl: this.enableRtl, zIndex: this.zIndex,
|
|
10840
|
-
close: function () {
|
|
10841
|
-
if (_this.popupObj.element.parentElement) {
|
|
10842
|
-
_this.popupObj.unwireScrollEvents();
|
|
10843
|
-
// For restrict the page scrolling in safari browser
|
|
10844
|
-
var checkboxFilterInput = _this.popupWrapper.querySelector('.' + FILTERINPUT);
|
|
10845
|
-
if (_this.mode === 'CheckBox' && checkboxFilterInput && document.activeElement === checkboxFilterInput) {
|
|
10846
|
-
checkboxFilterInput.blur();
|
|
10847
|
-
}
|
|
10848
|
-
detach(_this.popupObj.element);
|
|
10849
|
-
}
|
|
10850
|
-
},
|
|
10851
|
-
open: function () {
|
|
10852
|
-
_this.popupObj.resolveCollision();
|
|
10853
|
-
if (!_this.isFirstClick) {
|
|
10854
|
-
var ulElement = _this.list.querySelector('ul');
|
|
10855
|
-
if (ulElement) {
|
|
10856
|
-
if (!(_this.mode !== 'CheckBox' && (_this.allowFiltering || _this.allowCustomValue) &&
|
|
10857
|
-
_this.targetElement().trim() !== '')) {
|
|
10858
|
-
_this.mainList = ulElement.cloneNode ? ulElement.cloneNode(true) : ulElement;
|
|
10859
|
-
}
|
|
10860
|
-
}
|
|
10861
|
-
_this.isFirstClick = true;
|
|
11039
|
+
else if (this.mode === 'CheckBox' && !this.showSelectAll && (!this.headerTemplate && !this.footerTemplate)) {
|
|
11040
|
+
this.notify('selectAll', { module: 'CheckBoxSelection', enable: this.mode === 'CheckBox' });
|
|
11041
|
+
overAllHeight = parseInt(this.popupHeight, 10);
|
|
11042
|
+
}
|
|
11043
|
+
else if (this.mode === 'CheckBox' && !this.showSelectAll) {
|
|
11044
|
+
this.notify('selectAll', { module: 'CheckBoxSelection', enable: this.mode === 'CheckBox' });
|
|
11045
|
+
overAllHeight = parseInt(this.popupHeight, 10);
|
|
11046
|
+
if (this.headerTemplate && this.header) {
|
|
11047
|
+
overAllHeight -= this.header.offsetHeight;
|
|
10862
11048
|
}
|
|
10863
|
-
|
|
10864
|
-
|
|
10865
|
-
_this.targetElement().trim() !== '')) {
|
|
10866
|
-
_this.loadTemplate();
|
|
11049
|
+
if (this.footerTemplate && this.footer) {
|
|
11050
|
+
overAllHeight -= this.footer.offsetHeight;
|
|
10867
11051
|
}
|
|
10868
|
-
|
|
10869
|
-
|
|
10870
|
-
|
|
10871
|
-
|
|
10872
|
-
|
|
11052
|
+
}
|
|
11053
|
+
if (this.mode === 'CheckBox') {
|
|
11054
|
+
var args = {
|
|
11055
|
+
module: 'CheckBoxSelection',
|
|
11056
|
+
enable: this.mode === 'CheckBox',
|
|
11057
|
+
popupElement: this.popupWrapper
|
|
11058
|
+
};
|
|
11059
|
+
if (this.allowFiltering) {
|
|
11060
|
+
this.notify('searchBox', args);
|
|
11061
|
+
overAllHeight -= this.searchBoxHeight;
|
|
10873
11062
|
}
|
|
10874
|
-
|
|
10875
|
-
|
|
10876
|
-
|
|
11063
|
+
addClass([this.popupWrapper], 'e-checkbox');
|
|
11064
|
+
}
|
|
11065
|
+
if (this.popupHeight !== 'auto') {
|
|
11066
|
+
this.list.style.maxHeight = formatUnit(overAllHeight);
|
|
11067
|
+
this.popupWrapper.style.maxHeight = formatUnit(this.popupHeight);
|
|
11068
|
+
}
|
|
11069
|
+
else {
|
|
11070
|
+
this.list.style.maxHeight = formatUnit(this.popupHeight);
|
|
11071
|
+
}
|
|
11072
|
+
this.popupObj = new Popup(this.popupWrapper, {
|
|
11073
|
+
width: this.calcPopupWidth(), targetType: 'relative', position: { X: 'left', Y: 'bottom' },
|
|
11074
|
+
relateTo: this.overAllWrapper, collision: { X: 'flip', Y: 'flip' }, offsetY: 1,
|
|
11075
|
+
enableRtl: this.enableRtl, zIndex: this.zIndex,
|
|
11076
|
+
close: function () {
|
|
11077
|
+
if (_this.popupObj.element.parentElement) {
|
|
11078
|
+
_this.popupObj.unwireScrollEvents();
|
|
11079
|
+
// For restrict the page scrolling in safari browser
|
|
11080
|
+
var checkboxFilterInput = _this.popupWrapper.querySelector('.' + FILTERINPUT);
|
|
11081
|
+
if (_this.mode === 'CheckBox' && checkboxFilterInput && document.activeElement === checkboxFilterInput) {
|
|
11082
|
+
checkboxFilterInput.blur();
|
|
11083
|
+
}
|
|
11084
|
+
detach(_this.popupObj.element);
|
|
11085
|
+
}
|
|
11086
|
+
},
|
|
11087
|
+
open: function () {
|
|
11088
|
+
_this.popupObj.resolveCollision();
|
|
11089
|
+
if (!_this.isFirstClick) {
|
|
11090
|
+
var ulElement = _this.list.querySelector('ul');
|
|
11091
|
+
if (ulElement) {
|
|
11092
|
+
if (!(_this.mode !== 'CheckBox' && (_this.allowFiltering || _this.allowCustomValue) &&
|
|
11093
|
+
_this.targetElement().trim() !== '')) {
|
|
11094
|
+
_this.mainList = ulElement.cloneNode ? ulElement.cloneNode(true) : ulElement;
|
|
11095
|
+
}
|
|
11096
|
+
}
|
|
11097
|
+
_this.isFirstClick = true;
|
|
11098
|
+
}
|
|
11099
|
+
_this.popupObj.wireScrollEvents();
|
|
11100
|
+
if (!(_this.mode !== 'CheckBox' && (_this.allowFiltering || _this.allowCustomValue) &&
|
|
11101
|
+
_this.targetElement().trim() !== '')) {
|
|
11102
|
+
_this.loadTemplate();
|
|
11103
|
+
}
|
|
11104
|
+
_this.setScrollPosition();
|
|
11105
|
+
if (_this.allowFiltering) {
|
|
11106
|
+
_this.notify('inputFocus', {
|
|
11107
|
+
module: 'CheckBoxSelection', enable: _this.mode === 'CheckBox', value: 'focus'
|
|
11108
|
+
});
|
|
11109
|
+
}
|
|
11110
|
+
}, targetExitViewport: function () {
|
|
11111
|
+
if (!Browser.isDevice) {
|
|
11112
|
+
_this.hidePopup();
|
|
11113
|
+
}
|
|
10877
11114
|
}
|
|
11115
|
+
});
|
|
11116
|
+
if (this.mode === 'CheckBox' && Browser.isDevice && this.allowFiltering) {
|
|
11117
|
+
this.notify('deviceSearchBox', { module: 'CheckBoxSelection', enable: this.mode === 'CheckBox' });
|
|
10878
11118
|
}
|
|
10879
|
-
|
|
10880
|
-
|
|
10881
|
-
this.notify('deviceSearchBox', { module: 'CheckBoxSelection', enable: this.mode === 'CheckBox' });
|
|
11119
|
+
this.popupObj.close();
|
|
11120
|
+
this.popupWrapper.style.visibility = '';
|
|
10882
11121
|
}
|
|
10883
|
-
this.popupObj.close();
|
|
10884
|
-
this.popupWrapper.style.visibility = '';
|
|
10885
11122
|
}
|
|
10886
11123
|
};
|
|
10887
11124
|
MultiSelect.prototype.setHeaderTemplate = function () {
|
|
@@ -10951,6 +11188,8 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
10951
11188
|
this.removeValue(temp, e, null, true);
|
|
10952
11189
|
}
|
|
10953
11190
|
}
|
|
11191
|
+
this.selectedElementID = null;
|
|
11192
|
+
this.inputElement.removeAttribute('aria-activedescendant');
|
|
10954
11193
|
}
|
|
10955
11194
|
else {
|
|
10956
11195
|
this.clearAllCallback(e);
|
|
@@ -11054,11 +11293,12 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
11054
11293
|
};
|
|
11055
11294
|
MultiSelect.prototype.search = function (e) {
|
|
11056
11295
|
var _this = this;
|
|
11296
|
+
this.resetFilteredData = true;
|
|
11057
11297
|
if (!isNullOrUndefined(e)) {
|
|
11058
11298
|
this.keyCode = e.keyCode;
|
|
11059
11299
|
}
|
|
11060
11300
|
if (!this.isPopupOpen() && this.openOnClick) {
|
|
11061
|
-
this.showPopup();
|
|
11301
|
+
this.showPopup(e);
|
|
11062
11302
|
}
|
|
11063
11303
|
this.openClick(e);
|
|
11064
11304
|
if (this.checkTextLength() && !this.allowFiltering && !isNullOrUndefined(e) && (e.keyCode !== 8)) {
|
|
@@ -11142,7 +11382,9 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
11142
11382
|
var temp;
|
|
11143
11383
|
var tempData = this.listData;
|
|
11144
11384
|
this.listData = this.mainData;
|
|
11145
|
-
this.hiddenElement
|
|
11385
|
+
if (!isNullOrUndefined(this.hiddenElement)) {
|
|
11386
|
+
this.hiddenElement.innerHTML = '';
|
|
11387
|
+
}
|
|
11146
11388
|
if (!isNullOrUndefined(this.value)) {
|
|
11147
11389
|
for (var index = 0; !isNullOrUndefined(this.value[index]); index++) {
|
|
11148
11390
|
var listValue = this.findListElement(((!isNullOrUndefined(this.mainList)) ? this.mainList : this.ulElement), 'li', 'data-value', this.value[index]);
|
|
@@ -11160,7 +11402,9 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
11160
11402
|
data += temp + delimiterChar + ' ';
|
|
11161
11403
|
text.push(temp);
|
|
11162
11404
|
}
|
|
11163
|
-
this.hiddenElement
|
|
11405
|
+
if (!isNullOrUndefined(this.hiddenElement)) {
|
|
11406
|
+
this.hiddenElement.innerHTML += '<option selected value ="' + this.value[index] + '">' + index + '</option>';
|
|
11407
|
+
}
|
|
11164
11408
|
}
|
|
11165
11409
|
}
|
|
11166
11410
|
this.setProperties({ text: text.toString() }, true);
|
|
@@ -11205,7 +11449,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
11205
11449
|
|| this.list.querySelector('.e-ul') && this.list.querySelector('.e-ul').childElementCount === 0)) {
|
|
11206
11450
|
isEmptyData = true;
|
|
11207
11451
|
}
|
|
11208
|
-
_super.prototype.render.call(this, isEmptyData);
|
|
11452
|
+
_super.prototype.render.call(this, null, isEmptyData);
|
|
11209
11453
|
this.unwireListEvents();
|
|
11210
11454
|
this.wireListEvents();
|
|
11211
11455
|
};
|
|
@@ -11372,10 +11616,8 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
11372
11616
|
selectItems[temp1 - 1].setAttribute('aria-selected', 'false');
|
|
11373
11617
|
if (this.mode === 'CheckBox') {
|
|
11374
11618
|
if (selectedItems && (selectedItems.length > (temp1 - 1))) {
|
|
11375
|
-
selectedItems[temp1 - 1].firstElementChild.setAttribute('aria-checked', 'false');
|
|
11376
11619
|
removeClass([selectedItems[temp1 - 1].firstElementChild.lastElementChild], 'e-check');
|
|
11377
11620
|
}
|
|
11378
|
-
selectItems[temp1 - 1].firstElementChild.setAttribute('aria-checked', 'false');
|
|
11379
11621
|
removeClass([selectItems[temp1 - 1].firstElementChild.lastElementChild], 'e-check');
|
|
11380
11622
|
}
|
|
11381
11623
|
temp1--;
|
|
@@ -11416,10 +11658,12 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
11416
11658
|
if (this.enabled && this.isValidLI(element)) {
|
|
11417
11659
|
this.removeFocus();
|
|
11418
11660
|
addClass([element], dropDownBaseClasses.focus);
|
|
11661
|
+
this.updateAriaActiveDescendant();
|
|
11419
11662
|
}
|
|
11420
11663
|
else {
|
|
11421
11664
|
if (this.enableGroupCheckBox && this.mode === 'CheckBox' && !isNullOrUndefined(this.fields.groupBy)) {
|
|
11422
11665
|
addClass([element], dropDownBaseClasses.focus);
|
|
11666
|
+
this.updateAriaActiveDescendant();
|
|
11423
11667
|
}
|
|
11424
11668
|
}
|
|
11425
11669
|
};
|
|
@@ -11431,9 +11675,9 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
11431
11675
|
addClass([element], className);
|
|
11432
11676
|
this.updateMainList(false, element.getAttribute('data-value'), mainElement);
|
|
11433
11677
|
element.setAttribute('aria-selected', 'true');
|
|
11434
|
-
if (this.mode === 'CheckBox') {
|
|
11435
|
-
var ariaCheck = element.
|
|
11436
|
-
if (ariaCheck ===
|
|
11678
|
+
if (this.mode === 'CheckBox' && element.classList.contains('e-active')) {
|
|
11679
|
+
var ariaCheck = element.getElementsByClassName('e-check').length;
|
|
11680
|
+
if (ariaCheck === 0) {
|
|
11437
11681
|
this.notify('updatelist', { module: 'CheckBoxSelection', enable: this.mode === 'CheckBox', li: element, e: this });
|
|
11438
11682
|
}
|
|
11439
11683
|
}
|
|
@@ -11441,7 +11685,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
11441
11685
|
if (this.chipCollectionWrapper) {
|
|
11442
11686
|
this.removeChipSelection();
|
|
11443
11687
|
}
|
|
11444
|
-
|
|
11688
|
+
this.selectedElementID = element.id;
|
|
11445
11689
|
}
|
|
11446
11690
|
};
|
|
11447
11691
|
MultiSelect.prototype.updateDelimeter = function (delimChar, e) {
|
|
@@ -11752,9 +11996,11 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
11752
11996
|
if (this.chipCollectionWrapper) {
|
|
11753
11997
|
this.chipCollectionWrapper.style.display = 'none';
|
|
11754
11998
|
}
|
|
11755
|
-
this.viewWrapper
|
|
11756
|
-
|
|
11757
|
-
|
|
11999
|
+
if (!isNullOrUndefined(this.viewWrapper)) {
|
|
12000
|
+
this.viewWrapper.style.display = '';
|
|
12001
|
+
this.viewWrapper.style.width = '';
|
|
12002
|
+
this.viewWrapper.classList.remove(TOTAL_COUNT_WRAPPER$1);
|
|
12003
|
+
}
|
|
11758
12004
|
if (this.value && this.value.length) {
|
|
11759
12005
|
var data = '';
|
|
11760
12006
|
var temp = void 0;
|
|
@@ -11805,7 +12051,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
11805
12051
|
overAllContainer = this.componentWrapper.offsetWidth -
|
|
11806
12052
|
parseInt(window.getComputedStyle(this.componentWrapper).paddingLeft, 10) -
|
|
11807
12053
|
parseInt(window.getComputedStyle(this.componentWrapper).paddingRight, 10);
|
|
11808
|
-
if ((wrapperleng + downIconWidth + this.clearIconWidth)
|
|
12054
|
+
if ((wrapperleng + downIconWidth + this.clearIconWidth) >= overAllContainer) {
|
|
11809
12055
|
if (tempData !== undefined && tempData !== '') {
|
|
11810
12056
|
temp = tempData;
|
|
11811
12057
|
index = tempIndex + 1;
|
|
@@ -11814,7 +12060,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
11814
12060
|
remaining = this.value.length - index;
|
|
11815
12061
|
wrapperleng = this.viewWrapper.offsetWidth +
|
|
11816
12062
|
parseInt(window.getComputedStyle(this.viewWrapper).paddingRight, 10);
|
|
11817
|
-
while (((wrapperleng + remainSize + downIconWidth + this.clearIconWidth)
|
|
12063
|
+
while (((wrapperleng + remainSize + downIconWidth + this.clearIconWidth) >= overAllContainer) && wrapperleng !== 0
|
|
11818
12064
|
&& this.viewWrapper.innerHTML !== '') {
|
|
11819
12065
|
var textArr = [];
|
|
11820
12066
|
this.viewWrapper.innerHTML = textArr.join(this.delimiterChar);
|
|
@@ -11824,7 +12070,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
11824
12070
|
}
|
|
11825
12071
|
break;
|
|
11826
12072
|
}
|
|
11827
|
-
else if ((wrapperleng + remainSize + downIconWidth + this.clearIconWidth)
|
|
12073
|
+
else if ((wrapperleng + remainSize + downIconWidth + this.clearIconWidth) < overAllContainer) {
|
|
11828
12074
|
tempData = data;
|
|
11829
12075
|
tempIndex = index;
|
|
11830
12076
|
}
|
|
@@ -11842,8 +12088,10 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
11842
12088
|
}
|
|
11843
12089
|
}
|
|
11844
12090
|
else {
|
|
11845
|
-
this.viewWrapper
|
|
11846
|
-
|
|
12091
|
+
if (!isNullOrUndefined(this.viewWrapper)) {
|
|
12092
|
+
this.viewWrapper.innerHTML = '';
|
|
12093
|
+
this.viewWrapper.style.display = 'none';
|
|
12094
|
+
}
|
|
11847
12095
|
}
|
|
11848
12096
|
};
|
|
11849
12097
|
MultiSelect.prototype.checkClearIconWidth = function () {
|
|
@@ -11916,29 +12164,41 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
11916
12164
|
return temp;
|
|
11917
12165
|
};
|
|
11918
12166
|
MultiSelect.prototype.unWireEvent = function () {
|
|
11919
|
-
|
|
12167
|
+
if (!isNullOrUndefined(this.componentWrapper)) {
|
|
12168
|
+
EventHandler.remove(this.componentWrapper, 'mousedown', this.wrapperClick);
|
|
12169
|
+
}
|
|
11920
12170
|
EventHandler.remove(window, 'resize', this.windowResize);
|
|
11921
|
-
|
|
11922
|
-
|
|
11923
|
-
|
|
11924
|
-
|
|
12171
|
+
if (!isNullOrUndefined(this.inputElement)) {
|
|
12172
|
+
EventHandler.remove(this.inputElement, 'focus', this.focusInHandler);
|
|
12173
|
+
EventHandler.remove(this.inputElement, 'keydown', this.onKeyDown);
|
|
12174
|
+
if (this.mode !== 'CheckBox') {
|
|
12175
|
+
EventHandler.remove(this.inputElement, 'input', this.onInput);
|
|
12176
|
+
}
|
|
12177
|
+
EventHandler.remove(this.inputElement, 'keyup', this.keyUp);
|
|
12178
|
+
var formElement = closest(this.inputElement, 'form');
|
|
12179
|
+
if (formElement) {
|
|
12180
|
+
EventHandler.remove(formElement, 'reset', this.resetValueHandler);
|
|
12181
|
+
}
|
|
12182
|
+
EventHandler.remove(this.inputElement, 'blur', this.onBlurHandler);
|
|
11925
12183
|
}
|
|
11926
|
-
|
|
11927
|
-
|
|
11928
|
-
|
|
11929
|
-
|
|
12184
|
+
if (!isNullOrUndefined(this.componentWrapper)) {
|
|
12185
|
+
EventHandler.remove(this.componentWrapper, 'mouseover', this.mouseIn);
|
|
12186
|
+
EventHandler.remove(this.componentWrapper, 'mouseout', this.mouseOut);
|
|
12187
|
+
}
|
|
12188
|
+
if (!isNullOrUndefined(this.overAllClear)) {
|
|
12189
|
+
EventHandler.remove(this.overAllClear, 'mousedown', this.clearAll);
|
|
12190
|
+
}
|
|
12191
|
+
if (!isNullOrUndefined(this.inputElement)) {
|
|
12192
|
+
EventHandler.remove(this.inputElement, 'paste', this.pasteHandler);
|
|
11930
12193
|
}
|
|
11931
|
-
EventHandler.remove(this.inputElement, 'blur', this.onBlurHandler);
|
|
11932
|
-
EventHandler.remove(this.componentWrapper, 'mouseover', this.mouseIn);
|
|
11933
|
-
EventHandler.remove(this.componentWrapper, 'mouseout', this.mouseOut);
|
|
11934
|
-
EventHandler.remove(this.overAllClear, 'mousedown', this.clearAll);
|
|
11935
|
-
EventHandler.remove(this.inputElement, 'paste', this.pasteHandler);
|
|
11936
12194
|
};
|
|
11937
12195
|
MultiSelect.prototype.selectAllItem = function (state, event, list) {
|
|
11938
12196
|
var li;
|
|
11939
|
-
|
|
11940
|
-
|
|
11941
|
-
|
|
12197
|
+
if (!isNullOrUndefined(this.list)) {
|
|
12198
|
+
li = this.list.querySelectorAll(state ?
|
|
12199
|
+
'li.e-list-item:not([aria-selected="true"]):not(.e-reorder-hide)' :
|
|
12200
|
+
'li.e-list-item[aria-selected="true"]:not(.e-reorder-hide)');
|
|
12201
|
+
}
|
|
11942
12202
|
if (this.value && this.value.length && event && event.target
|
|
11943
12203
|
&& closest(event.target, '.e-close-hooker') && this.allowFiltering) {
|
|
11944
12204
|
li = this.mainList.querySelectorAll(state ?
|
|
@@ -11988,6 +12248,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
11988
12248
|
target.classList.remove('e-active');
|
|
11989
12249
|
}
|
|
11990
12250
|
target.classList.add('e-item-focus');
|
|
12251
|
+
this.updateAriaActiveDescendant();
|
|
11991
12252
|
}
|
|
11992
12253
|
this.textboxValueUpdate();
|
|
11993
12254
|
this.checkPlaceholderSize();
|
|
@@ -12002,6 +12263,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
12002
12263
|
else {
|
|
12003
12264
|
this.updateValue(event, li, state);
|
|
12004
12265
|
}
|
|
12266
|
+
this.addValidInputClass();
|
|
12005
12267
|
};
|
|
12006
12268
|
MultiSelect.prototype.updateValue = function (event, li, state) {
|
|
12007
12269
|
var _this = this;
|
|
@@ -12227,6 +12489,11 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
12227
12489
|
MultiSelect.prototype.onPropertyChanged = function (newProp, oldProp) {
|
|
12228
12490
|
if (newProp.dataSource && !isNullOrUndefined(Object.keys(newProp.dataSource))
|
|
12229
12491
|
|| newProp.query && !isNullOrUndefined(Object.keys(newProp.query))) {
|
|
12492
|
+
if (this.resetFilteredData) {
|
|
12493
|
+
// The filtered data is not being reset in the component after the user focuses out.
|
|
12494
|
+
this.resetMainList = !this.resetMainList ? this.mainList : this.resetMainList;
|
|
12495
|
+
this.resetFilteredData = false;
|
|
12496
|
+
}
|
|
12230
12497
|
this.mainList = null;
|
|
12231
12498
|
this.mainData = null;
|
|
12232
12499
|
this.isFirstClick = false;
|
|
@@ -12287,6 +12554,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
12287
12554
|
case 'cssClass':
|
|
12288
12555
|
this.updateOldPropCssClass(oldProp.cssClass);
|
|
12289
12556
|
this.updateCssClass();
|
|
12557
|
+
this.calculateWidth();
|
|
12290
12558
|
break;
|
|
12291
12559
|
case 'enableRtl':
|
|
12292
12560
|
this.enableRTL(newProp.enableRtl);
|
|
@@ -12313,6 +12581,11 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
12313
12581
|
case 'floatLabelType':
|
|
12314
12582
|
this.setFloatLabelType();
|
|
12315
12583
|
this.addValidInputClass();
|
|
12584
|
+
Input.createSpanElement(this.overAllWrapper, this.createElement);
|
|
12585
|
+
this.calculateWidth();
|
|
12586
|
+
if (!isNullOrUndefined(this.overAllWrapper) && !isNullOrUndefined(this.overAllWrapper.getElementsByClassName('e-ddl-icon')[0] && this.overAllWrapper.getElementsByClassName('e-float-text-content')[0] && this.floatLabelType !== 'Never')) {
|
|
12587
|
+
this.overAllWrapper.getElementsByClassName('e-float-text-content')[0].classList.add('e-icon');
|
|
12588
|
+
}
|
|
12316
12589
|
break;
|
|
12317
12590
|
case 'enableSelectionOrder':
|
|
12318
12591
|
break;
|
|
@@ -12372,7 +12645,9 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
12372
12645
|
MultiSelect.prototype.addNonPresentItems = function (valuecheck, ulElement, list, event) {
|
|
12373
12646
|
var _this = this;
|
|
12374
12647
|
this.dataSource.executeQuery(this.getForQuery(valuecheck)).then(function (e) {
|
|
12375
|
-
|
|
12648
|
+
if (e.result.length > 0) {
|
|
12649
|
+
_this.addItem(e.result, list.length);
|
|
12650
|
+
}
|
|
12376
12651
|
_this.updateActionList(ulElement, list, event);
|
|
12377
12652
|
});
|
|
12378
12653
|
};
|
|
@@ -12431,7 +12706,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
12431
12706
|
* Adds a new item to the multiselect popup list. By default, new item appends to the list as the last item,
|
|
12432
12707
|
* but you can insert based on the index parameter.
|
|
12433
12708
|
*
|
|
12434
|
-
* @param
|
|
12709
|
+
* @param { Object[] } items - Specifies an array of JSON data or a JSON data.
|
|
12435
12710
|
* @param { number } itemIndex - Specifies the index to place the newly added item in the popup list.
|
|
12436
12711
|
* @returns {void}
|
|
12437
12712
|
*/
|
|
@@ -12463,6 +12738,8 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
12463
12738
|
_this.overAllWrapper.classList.remove(iconAnimation);
|
|
12464
12739
|
_this.popupObj.hide(new Animation(eventArgs.animation));
|
|
12465
12740
|
attributes(_this.inputElement, { 'aria-expanded': 'false' });
|
|
12741
|
+
_this.inputElement.removeAttribute('aria-owns');
|
|
12742
|
+
_this.inputElement.removeAttribute('aria-activedescendant');
|
|
12466
12743
|
if (_this.allowFiltering) {
|
|
12467
12744
|
_this.notify('inputFocus', { module: 'CheckBoxSelection', enable: _this.mode === 'CheckBox', value: 'clear' });
|
|
12468
12745
|
}
|
|
@@ -12478,7 +12755,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
12478
12755
|
*
|
|
12479
12756
|
* @returns {void}
|
|
12480
12757
|
*/
|
|
12481
|
-
MultiSelect.prototype.showPopup = function () {
|
|
12758
|
+
MultiSelect.prototype.showPopup = function (e) {
|
|
12482
12759
|
var _this = this;
|
|
12483
12760
|
if (!this.enabled) {
|
|
12484
12761
|
return;
|
|
@@ -12488,7 +12765,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
12488
12765
|
if (!args.cancel) {
|
|
12489
12766
|
if (!_this.ulElement) {
|
|
12490
12767
|
_this.beforePopupOpen = true;
|
|
12491
|
-
_super.prototype.render.call(_this);
|
|
12768
|
+
_super.prototype.render.call(_this, e);
|
|
12492
12769
|
if (_this.mode === 'CheckBox' && Browser.isDevice && _this.allowFiltering) {
|
|
12493
12770
|
_this.notify('popupFullScreen', { module: 'CheckBoxSelection', enable: _this.mode === 'CheckBox' });
|
|
12494
12771
|
}
|
|
@@ -12504,7 +12781,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
12504
12781
|
_this.beforePopupOpen = false;
|
|
12505
12782
|
return;
|
|
12506
12783
|
}
|
|
12507
|
-
_this.onPopupShown();
|
|
12784
|
+
_this.onPopupShown(e);
|
|
12508
12785
|
}
|
|
12509
12786
|
});
|
|
12510
12787
|
};
|
|
@@ -12606,12 +12883,12 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
12606
12883
|
spellcheck: 'false',
|
|
12607
12884
|
type: 'text',
|
|
12608
12885
|
autocomplete: 'off',
|
|
12609
|
-
tabindex: '0'
|
|
12886
|
+
tabindex: '0',
|
|
12887
|
+
role: 'combobox'
|
|
12610
12888
|
}
|
|
12611
12889
|
});
|
|
12612
12890
|
if (this.mode === 'Default' || this.mode === 'Box') {
|
|
12613
12891
|
this.inputElement.setAttribute('aria-describedby', this.chipCollectionWrapper.id);
|
|
12614
|
-
this.inputElement.setAttribute('aria-labelledby', this.chipCollectionWrapper.id);
|
|
12615
12892
|
}
|
|
12616
12893
|
if (this.element.tagName !== this.getNgDirective()) {
|
|
12617
12894
|
this.element.style.display = 'none';
|
|
@@ -12644,6 +12921,9 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
12644
12921
|
if (this.mode !== 'CheckBox') {
|
|
12645
12922
|
this.hideOverAllClear();
|
|
12646
12923
|
}
|
|
12924
|
+
if (!isNullOrUndefined(closest(this.element, "fieldset")) && closest(this.element, "fieldset").disabled) {
|
|
12925
|
+
this.enabled = false;
|
|
12926
|
+
}
|
|
12647
12927
|
this.wireEvent();
|
|
12648
12928
|
this.enable(this.enabled);
|
|
12649
12929
|
this.enableRTL(this.enableRtl);
|
|
@@ -12651,6 +12931,11 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
12651
12931
|
if (this.element.hasAttribute('data-val')) {
|
|
12652
12932
|
this.element.setAttribute('data-val', 'false');
|
|
12653
12933
|
}
|
|
12934
|
+
Input.createSpanElement(this.overAllWrapper, this.createElement);
|
|
12935
|
+
this.calculateWidth();
|
|
12936
|
+
if (!isNullOrUndefined(this.overAllWrapper) && !isNullOrUndefined(this.overAllWrapper.getElementsByClassName('e-ddl-icon')[0] && this.overAllWrapper.getElementsByClassName('e-float-text-content')[0] && this.floatLabelType !== 'Never')) {
|
|
12937
|
+
this.overAllWrapper.getElementsByClassName('e-float-text-content')[0].classList.add('e-icon');
|
|
12938
|
+
}
|
|
12654
12939
|
this.renderComplete();
|
|
12655
12940
|
};
|
|
12656
12941
|
MultiSelect.prototype.checkInitialValue = function () {
|
|
@@ -12732,11 +13017,13 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
12732
13017
|
}
|
|
12733
13018
|
};
|
|
12734
13019
|
MultiSelect.prototype.addValidInputClass = function () {
|
|
12735
|
-
if (
|
|
12736
|
-
|
|
12737
|
-
|
|
12738
|
-
|
|
12739
|
-
|
|
13020
|
+
if (!isNullOrUndefined(this.overAllWrapper)) {
|
|
13021
|
+
if ((!isNullOrUndefined(this.value) && this.value.length) || this.floatLabelType === 'Always') {
|
|
13022
|
+
addClass([this.overAllWrapper], 'e-valid-input');
|
|
13023
|
+
}
|
|
13024
|
+
else {
|
|
13025
|
+
removeClass([this.overAllWrapper], 'e-valid-input');
|
|
13026
|
+
}
|
|
12740
13027
|
}
|
|
12741
13028
|
};
|
|
12742
13029
|
MultiSelect.prototype.dropDownIcon = function () {
|
|
@@ -12787,15 +13074,19 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
12787
13074
|
this.ulElement = null;
|
|
12788
13075
|
this.mainListCollection = null;
|
|
12789
13076
|
_super.prototype.destroy.call(this);
|
|
12790
|
-
var temp = ['readonly', 'aria-disabled', '
|
|
13077
|
+
var temp = ['readonly', 'aria-disabled', 'placeholder'];
|
|
12791
13078
|
var length = temp.length;
|
|
12792
|
-
|
|
12793
|
-
|
|
12794
|
-
|
|
13079
|
+
if (!isNullOrUndefined(this.inputElement)) {
|
|
13080
|
+
while (length > 0) {
|
|
13081
|
+
this.inputElement.removeAttribute(temp[length - 1]);
|
|
13082
|
+
length--;
|
|
13083
|
+
}
|
|
12795
13084
|
}
|
|
12796
|
-
this.element
|
|
12797
|
-
|
|
12798
|
-
|
|
13085
|
+
if (!isNullOrUndefined(this.element)) {
|
|
13086
|
+
this.element.removeAttribute('data-initial-value');
|
|
13087
|
+
this.element.style.display = 'block';
|
|
13088
|
+
}
|
|
13089
|
+
if (this.overAllWrapper && this.overAllWrapper.parentElement) {
|
|
12799
13090
|
if (this.overAllWrapper.parentElement.tagName === this.getNgDirective()) {
|
|
12800
13091
|
remove(this.overAllWrapper);
|
|
12801
13092
|
}
|
|
@@ -12804,6 +13095,25 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
12804
13095
|
remove(this.overAllWrapper);
|
|
12805
13096
|
}
|
|
12806
13097
|
}
|
|
13098
|
+
this.componentWrapper = null;
|
|
13099
|
+
this.overAllClear = null;
|
|
13100
|
+
this.overAllWrapper = null;
|
|
13101
|
+
this.hiddenElement = null;
|
|
13102
|
+
this.searchWrapper = null;
|
|
13103
|
+
this.viewWrapper = null;
|
|
13104
|
+
this.chipCollectionWrapper = null;
|
|
13105
|
+
this.targetInputElement = null;
|
|
13106
|
+
this.popupWrapper = null;
|
|
13107
|
+
this.inputElement = null;
|
|
13108
|
+
this.delimiterWrapper = null;
|
|
13109
|
+
this.popupObj = null;
|
|
13110
|
+
this.popupWrapper = null;
|
|
13111
|
+
this.liCollections = null;
|
|
13112
|
+
this.header = null;
|
|
13113
|
+
this.mainList = null;
|
|
13114
|
+
this.mainListCollection = null;
|
|
13115
|
+
this.footer = null;
|
|
13116
|
+
this.selectAllEventEle = null;
|
|
12807
13117
|
};
|
|
12808
13118
|
__decorate$5([
|
|
12809
13119
|
Complex({ text: null, value: null, iconCss: null, groupBy: null }, FieldSettings)
|
|
@@ -13155,6 +13465,12 @@ var CheckBoxSelection = /** @__PURE__ @class */ (function () {
|
|
|
13155
13465
|
CheckBoxSelection.prototype.destroy = function () {
|
|
13156
13466
|
this.removeEventListener();
|
|
13157
13467
|
EventHandler.remove(document, 'mousedown', this.onDocumentClick);
|
|
13468
|
+
this.checkAllParent = null;
|
|
13469
|
+
this.clearIconElement = null;
|
|
13470
|
+
this.filterInput = null;
|
|
13471
|
+
this.filterInputObj = null;
|
|
13472
|
+
this.checkWrapper = null;
|
|
13473
|
+
this.selectAllSpan = null;
|
|
13158
13474
|
};
|
|
13159
13475
|
CheckBoxSelection.prototype.listSelection = function (args) {
|
|
13160
13476
|
var target;
|
|
@@ -13203,12 +13519,10 @@ var CheckBoxSelection = /** @__PURE__ @class */ (function () {
|
|
|
13203
13519
|
e.preventDefault();
|
|
13204
13520
|
};
|
|
13205
13521
|
CheckBoxSelection.prototype.changeState = function (wrapper, state, e, isPrevent, selectAll$$1) {
|
|
13206
|
-
var ariaState;
|
|
13207
13522
|
var frameSpan = wrapper.getElementsByClassName(CHECKBOXFRAME$1)[0];
|
|
13208
13523
|
if (state === 'check' && !frameSpan.classList.contains(CHECK$1)) {
|
|
13209
13524
|
frameSpan.classList.remove(INDETERMINATE);
|
|
13210
13525
|
frameSpan.classList.add(CHECK$1);
|
|
13211
|
-
ariaState = 'true';
|
|
13212
13526
|
if (selectAll$$1) {
|
|
13213
13527
|
this.parent.selectAllItems(true, e);
|
|
13214
13528
|
this.setLocale(true);
|
|
@@ -13216,7 +13530,6 @@ var CheckBoxSelection = /** @__PURE__ @class */ (function () {
|
|
|
13216
13530
|
}
|
|
13217
13531
|
else if (state === 'uncheck' && (frameSpan.classList.contains(CHECK$1) || frameSpan.classList.contains(INDETERMINATE))) {
|
|
13218
13532
|
removeClass([frameSpan], [CHECK$1, INDETERMINATE]);
|
|
13219
|
-
ariaState = 'false';
|
|
13220
13533
|
if (selectAll$$1) {
|
|
13221
13534
|
this.parent.selectAllItems(false, e);
|
|
13222
13535
|
this.setLocale();
|
|
@@ -13225,16 +13538,11 @@ var CheckBoxSelection = /** @__PURE__ @class */ (function () {
|
|
|
13225
13538
|
else if (state === 'indeterminate' && !(frameSpan.classList.contains(INDETERMINATE))) {
|
|
13226
13539
|
removeClass([frameSpan], [CHECK$1]);
|
|
13227
13540
|
frameSpan.classList.add(INDETERMINATE);
|
|
13228
|
-
ariaState = 'false';
|
|
13229
13541
|
if (selectAll$$1) {
|
|
13230
13542
|
this.parent.selectAllItems(false, e);
|
|
13231
13543
|
this.setLocale();
|
|
13232
13544
|
}
|
|
13233
13545
|
}
|
|
13234
|
-
ariaState = state === 'check' ? 'true' : state === 'uncheck' ? 'false' : ariaState;
|
|
13235
|
-
if (!isNullOrUndefined(ariaState)) {
|
|
13236
|
-
wrapper.setAttribute('aria-checked', ariaState);
|
|
13237
|
-
}
|
|
13238
13546
|
};
|
|
13239
13547
|
CheckBoxSelection.prototype.setSearchBox = function (args) {
|
|
13240
13548
|
if (isNullOrUndefined(this.parent.filterParent)) {
|
|
@@ -13268,11 +13576,8 @@ var CheckBoxSelection = /** @__PURE__ @class */ (function () {
|
|
|
13268
13576
|
prepend([this.parent.filterParent], args.popupElement);
|
|
13269
13577
|
attributes(this.filterInput, {
|
|
13270
13578
|
'aria-disabled': 'false',
|
|
13271
|
-
'
|
|
13272
|
-
'role': 'listbox',
|
|
13273
|
-
'aria-activedescendant': null,
|
|
13579
|
+
'role': 'combobox',
|
|
13274
13580
|
'autocomplete': 'off',
|
|
13275
|
-
'autocorrect': 'off',
|
|
13276
13581
|
'autocapitalize': 'off',
|
|
13277
13582
|
'spellcheck': 'false'
|
|
13278
13583
|
});
|
|
@@ -13398,8 +13703,8 @@ var CheckBoxSelection = /** @__PURE__ @class */ (function () {
|
|
|
13398
13703
|
e.preventDefault();
|
|
13399
13704
|
}
|
|
13400
13705
|
}
|
|
13401
|
-
if (!(!isNullOrUndefined(this.parent.popupObj) && closest(target, '[id="' + this.parent.popupObj.element.id + '"]'))
|
|
13402
|
-
!this.parent.overAllWrapper.contains(e.target)) {
|
|
13706
|
+
if (!(!isNullOrUndefined(this.parent.popupObj) && closest(target, '[id="' + this.parent.popupObj.element.id + '"]'))
|
|
13707
|
+
&& !isNullOrUndefined(this.parent.overAllWrapper) && !this.parent.overAllWrapper.contains(e.target)) {
|
|
13403
13708
|
if (this.parent.overAllWrapper.classList.contains(dropDownBaseClasses.focus) || this.parent.isPopupOpen()) {
|
|
13404
13709
|
this.parent.inputFocus = false;
|
|
13405
13710
|
this.parent.scrollFocusStatus = false;
|
|
@@ -13412,7 +13717,7 @@ var CheckBoxSelection = /** @__PURE__ @class */ (function () {
|
|
|
13412
13717
|
this.parent.scrollFocusStatus = (Browser.isIE || Browser.info.name === 'edge') &&
|
|
13413
13718
|
(document.activeElement === this.filterInput);
|
|
13414
13719
|
}
|
|
13415
|
-
if (!this.parent.overAllWrapper.contains(e.target) && this.parent.overAllWrapper.classList.contains('e-input-focus') &&
|
|
13720
|
+
if (!isNullOrUndefined(this.parent.overAllWrapper) && !this.parent.overAllWrapper.contains(e.target) && this.parent.overAllWrapper.classList.contains('e-input-focus') &&
|
|
13416
13721
|
!this.parent.isPopupOpen()) {
|
|
13417
13722
|
if (Browser.isIE) {
|
|
13418
13723
|
this.parent.onBlurHandler();
|
|
@@ -13443,7 +13748,7 @@ var CheckBoxSelection = /** @__PURE__ @class */ (function () {
|
|
|
13443
13748
|
}
|
|
13444
13749
|
};
|
|
13445
13750
|
CheckBoxSelection.prototype.checkSelectAll = function (e) {
|
|
13446
|
-
if (e.value === 'check'
|
|
13751
|
+
if (e.value === 'check') {
|
|
13447
13752
|
this.changeState(this.checkAllParent, e.value, null, null, false);
|
|
13448
13753
|
this.setLocale(true);
|
|
13449
13754
|
}
|
|
@@ -13627,6 +13932,7 @@ var ListBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
13627
13932
|
this.isCustomFiltering = false;
|
|
13628
13933
|
this.initialSelectedOptions = this.value;
|
|
13629
13934
|
_super.prototype.render.call(this);
|
|
13935
|
+
this.setEnabled();
|
|
13630
13936
|
this.renderComplete();
|
|
13631
13937
|
};
|
|
13632
13938
|
ListBox.prototype.initWrapper = function () {
|
|
@@ -13661,7 +13967,7 @@ var ListBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
13661
13967
|
removeClass([this.list], [dropDownBaseClasses.content, dropDownBaseClasses.root]);
|
|
13662
13968
|
this.validationAttribute(this.element, hiddenSelect);
|
|
13663
13969
|
this.list.setAttribute('role', 'listbox');
|
|
13664
|
-
attributes(this.list, { 'role': 'listbox', 'aria-multiselectable': this.selectionSettings.mode === 'Multiple' ? 'true' : 'false' });
|
|
13970
|
+
attributes(this.list, { 'role': 'listbox', 'aria-label': 'listbox', 'aria-multiselectable': this.selectionSettings.mode === 'Multiple' ? 'true' : 'false' });
|
|
13665
13971
|
this.updateSelectionSettings();
|
|
13666
13972
|
};
|
|
13667
13973
|
ListBox.prototype.updateSelectionSettings = function () {
|
|
@@ -13707,8 +14013,8 @@ var ListBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
13707
14013
|
});
|
|
13708
14014
|
}
|
|
13709
14015
|
};
|
|
13710
|
-
ListBox.prototype.updateActionCompleteData = function (li, item) {
|
|
13711
|
-
this.jsonData.
|
|
14016
|
+
ListBox.prototype.updateActionCompleteData = function (li, item, index) {
|
|
14017
|
+
this.jsonData.splice(index, 0, item);
|
|
13712
14018
|
};
|
|
13713
14019
|
ListBox.prototype.initToolbar = function () {
|
|
13714
14020
|
var pos = this.toolbarSettings.position;
|
|
@@ -13924,10 +14230,10 @@ var ListBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
13924
14230
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
13925
14231
|
var event = args.event;
|
|
13926
14232
|
var wrapper;
|
|
13927
|
-
if (args.target && (args.target.classList.contains(
|
|
13928
|
-
|| args.target.classList.contains(
|
|
13929
|
-
if (args.target.classList.contains(
|
|
13930
|
-
|| args.target.classList.contains(
|
|
14233
|
+
if (args.target && (args.target.classList.contains('e-listbox-wrapper') || args.target.classList.contains('e-list-item')
|
|
14234
|
+
|| args.target.classList.contains('e-filter-parent') || args.target.classList.contains('e-input-group'))) {
|
|
14235
|
+
if (args.target.classList.contains('e-list-item') || args.target.classList.contains('e-filter-parent')
|
|
14236
|
+
|| args.target.classList.contains('e-input-group')) {
|
|
13931
14237
|
wrapper = args.target.closest('.e-listbox-wrapper');
|
|
13932
14238
|
}
|
|
13933
14239
|
else {
|
|
@@ -13982,7 +14288,8 @@ var ListBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
13982
14288
|
var getArgs = this.getDragArgs({ target: args.droppedElement }, true);
|
|
13983
14289
|
var sourceArgs = { previousData: this.dataSource };
|
|
13984
14290
|
var destArgs = { previousData: listObj.dataSource };
|
|
13985
|
-
var dragArgs = extend({}, getArgs, { target: args.target, source: { previousData: this.dataSource },
|
|
14291
|
+
var dragArgs = extend({}, getArgs, { target: args.target, source: { previousData: this.dataSource },
|
|
14292
|
+
previousIndex: args.previousIndex, currentIndex: args.currentIndex });
|
|
13986
14293
|
if (listObj !== this) {
|
|
13987
14294
|
var sourceArgs1 = extend(sourceArgs, { currentData: this.listData });
|
|
13988
14295
|
dragArgs = extend(dragArgs, { source: sourceArgs1, destination: destArgs });
|
|
@@ -14057,10 +14364,10 @@ var ListBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
14057
14364
|
sortedData.splice(destIdx, 0, droppedData);
|
|
14058
14365
|
liColl.splice(destIdx, 0, fLiColl_1.splice(srcIdx, 1)[0]);
|
|
14059
14366
|
if (!value) {
|
|
14060
|
-
var
|
|
14061
|
-
for (var i = 0; i <
|
|
14062
|
-
if (
|
|
14063
|
-
li_1 =
|
|
14367
|
+
var liCollElem_1 = _this.getItems();
|
|
14368
|
+
for (var i = 0; i < liCollElem_1.length; i++) {
|
|
14369
|
+
if (liCollElem_1[i].getAttribute('data-value') === null && liCollElem_1[i].classList.contains('e-list-item')) {
|
|
14370
|
+
li_1 = liCollElem_1[i];
|
|
14064
14371
|
break;
|
|
14065
14372
|
}
|
|
14066
14373
|
}
|
|
@@ -14110,10 +14417,17 @@ var ListBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
14110
14417
|
dragArgs = extend(dragArgs, { destination: dragArgs1 });
|
|
14111
14418
|
}
|
|
14112
14419
|
this.trigger('drop', dragArgs);
|
|
14420
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14421
|
+
var liCollElem = dragArgs.elements;
|
|
14422
|
+
if (liCollElem.length) {
|
|
14423
|
+
for (var i = 0; i < liCollElem.length; i++) {
|
|
14424
|
+
liCollElem[i].classList.remove('e-grabbed');
|
|
14425
|
+
}
|
|
14426
|
+
}
|
|
14113
14427
|
};
|
|
14114
14428
|
ListBox.prototype.updateListItems = function (sourceElem, destElem) {
|
|
14115
14429
|
var i = 0;
|
|
14116
|
-
destElem.innerHTML =
|
|
14430
|
+
destElem.innerHTML = '';
|
|
14117
14431
|
while (i < sourceElem.childNodes.length) {
|
|
14118
14432
|
destElem.appendChild(sourceElem.childNodes[i]);
|
|
14119
14433
|
}
|
|
@@ -14142,6 +14456,14 @@ var ListBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
14142
14456
|
}
|
|
14143
14457
|
return listObj;
|
|
14144
14458
|
};
|
|
14459
|
+
/**
|
|
14460
|
+
* Sets the enabled state to DropDownBase.
|
|
14461
|
+
*
|
|
14462
|
+
* @returns {void}
|
|
14463
|
+
*/
|
|
14464
|
+
ListBox.prototype.setEnabled = function () {
|
|
14465
|
+
this.element.setAttribute('aria-disabled', (this.enabled) ? 'false' : 'true');
|
|
14466
|
+
};
|
|
14145
14467
|
ListBox.prototype.listOption = function (dataSource, fields) {
|
|
14146
14468
|
this.listCurrentOptions = _super.prototype.listOption.call(this, dataSource, fields);
|
|
14147
14469
|
this.listCurrentOptions = extend({}, this.listCurrentOptions, { itemCreated: this.triggerBeforeItemRender.bind(this) }, true);
|
|
@@ -14253,7 +14575,7 @@ var ListBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
14253
14575
|
var objValue = void 0;
|
|
14254
14576
|
var dupData = [];
|
|
14255
14577
|
var itemIdx = void 0;
|
|
14256
|
-
extend(dupData, [], this.
|
|
14578
|
+
extend(dupData, [], this.jsonData);
|
|
14257
14579
|
var removeIdxes = [];
|
|
14258
14580
|
var removeLiIdxes = [];
|
|
14259
14581
|
for (var j = 0; j < items.length; j++) {
|
|
@@ -14302,7 +14624,7 @@ var ListBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
14302
14624
|
if (this.listData.length === 0) {
|
|
14303
14625
|
this.l10nUpdate();
|
|
14304
14626
|
}
|
|
14305
|
-
this.value =
|
|
14627
|
+
this.value = [];
|
|
14306
14628
|
this.updateToolBarState();
|
|
14307
14629
|
};
|
|
14308
14630
|
/**
|
|
@@ -14591,9 +14913,7 @@ var ListBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
14591
14913
|
prepend([this.filterParent], this.list);
|
|
14592
14914
|
attributes(this.filterInput, {
|
|
14593
14915
|
'aria-disabled': 'false',
|
|
14594
|
-
'aria-
|
|
14595
|
-
'role': 'listbox',
|
|
14596
|
-
'aria-activedescendant': null,
|
|
14916
|
+
'aria-label': 'search list item',
|
|
14597
14917
|
'autocomplete': 'off',
|
|
14598
14918
|
'autocorrect': 'off',
|
|
14599
14919
|
'autocapitalize': 'off',
|
|
@@ -14630,12 +14950,12 @@ var ListBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
14630
14950
|
if (li && li.parentElement) {
|
|
14631
14951
|
currSelIdx = [].slice.call(li.parentElement.children).indexOf(li);
|
|
14632
14952
|
if (!this.selectionSettings.showCheckbox) {
|
|
14633
|
-
if ((e.ctrlKey || Browser.isDevice) && this.isSelected(li)) {
|
|
14953
|
+
if ((e.ctrlKey || e.metaKey || Browser.isDevice) && this.isSelected(li)) {
|
|
14634
14954
|
li.classList.remove(cssClass.selected);
|
|
14635
14955
|
li.removeAttribute('aria-selected');
|
|
14636
14956
|
isSelect = false;
|
|
14637
14957
|
}
|
|
14638
|
-
else if (!(this.selectionSettings.mode === 'Multiple' && (e.ctrlKey || Browser.isDevice))) {
|
|
14958
|
+
else if (!(this.selectionSettings.mode === 'Multiple' && (e.ctrlKey || e.metaKey || Browser.isDevice))) {
|
|
14639
14959
|
this.getSelectedItems().forEach(function (ele) {
|
|
14640
14960
|
ele.removeAttribute('aria-selected');
|
|
14641
14961
|
});
|
|
@@ -14995,7 +15315,7 @@ var ListBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
14995
15315
|
var isRefresh = tListBox.sortOrder !== 'None' || (tListBox.selectionSettings.showCheckbox !==
|
|
14996
15316
|
fListBox.selectionSettings.showCheckbox) || tListBox.fields.groupBy || tListBox.itemTemplate || fListBox.itemTemplate;
|
|
14997
15317
|
this.removeSelected(fListBox, fListBox.getSelectedItems());
|
|
14998
|
-
var tempItems = [].slice.call(fListBox.
|
|
15318
|
+
var tempItems = [].slice.call(fListBox.listData);
|
|
14999
15319
|
var localDataArgs = { cancel: false, items: tempItems, eventName: this.toolbarAction };
|
|
15000
15320
|
fListBox.trigger('actionBegin', localDataArgs);
|
|
15001
15321
|
if (localDataArgs.cancel) {
|
|
@@ -15040,12 +15360,18 @@ var ListBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
15040
15360
|
fListBox.value = [];
|
|
15041
15361
|
listData = listData
|
|
15042
15362
|
.filter(function (data) { return data.isHeader !== true; });
|
|
15363
|
+
var sortedData = listData.filter(function (val) {
|
|
15364
|
+
return tListBox.jsonData.indexOf(val) === -1;
|
|
15365
|
+
});
|
|
15366
|
+
for (var i = 0; i < sortedData.length; i++) {
|
|
15367
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
15368
|
+
tListBox.jsonData.splice(index + i, 0, sortedData[i]);
|
|
15369
|
+
}
|
|
15043
15370
|
tListBox.listData = listData;
|
|
15044
|
-
|
|
15045
|
-
if (this.listData.length == this.jsonData.length) {
|
|
15371
|
+
if (fListBox.listData.length === fListBox.jsonData.length) {
|
|
15046
15372
|
fListBox.listData = fListBox.sortedData = fListBox.jsonData = [];
|
|
15047
15373
|
}
|
|
15048
|
-
else if (
|
|
15374
|
+
else if (fListBox.allowFiltering) {
|
|
15049
15375
|
for (var i = 0; i < fListBox.listData.length; i++) {
|
|
15050
15376
|
for (var j = 0; j < fListBox.jsonData.length; j++) {
|
|
15051
15377
|
if (fListBox.listData[i] === fListBox.jsonData[j]) {
|
|
@@ -15108,21 +15434,35 @@ var ListBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
15108
15434
|
}
|
|
15109
15435
|
return listObj;
|
|
15110
15436
|
};
|
|
15111
|
-
ListBox.prototype.getGrabbedItems = function () {
|
|
15437
|
+
ListBox.prototype.getGrabbedItems = function (args) {
|
|
15438
|
+
var grabbItems = false;
|
|
15112
15439
|
for (var i = 0; i < this.value.length; i++) {
|
|
15113
|
-
if (this.value[i] === this.
|
|
15440
|
+
if (this.value[i] === this.getFormattedValue(args.target.getAttribute('data-value'))) {
|
|
15441
|
+
grabbItems = true;
|
|
15442
|
+
break;
|
|
15443
|
+
}
|
|
15444
|
+
}
|
|
15445
|
+
if (grabbItems) {
|
|
15446
|
+
for (var i = 0; i < this.value.length; i++) {
|
|
15114
15447
|
var liColl = this.list.querySelectorAll('[aria-selected="true"]');
|
|
15115
|
-
for (var
|
|
15116
|
-
liColl[
|
|
15448
|
+
for (var j = 0; j < liColl.length; j++) {
|
|
15449
|
+
if (this.value[i] === this.getFormattedValue(liColl[j].getAttribute('data-value'))) {
|
|
15450
|
+
liColl[j].classList.add('e-grabbed');
|
|
15451
|
+
}
|
|
15117
15452
|
}
|
|
15118
|
-
break;
|
|
15119
15453
|
}
|
|
15120
15454
|
}
|
|
15121
|
-
var elems
|
|
15455
|
+
var elems;
|
|
15456
|
+
if (this.isAngular) {
|
|
15457
|
+
elems = Array.prototype.slice.call(this.element.getElementsByClassName('e-list-parent')[0].querySelectorAll('.e-grabbed'));
|
|
15458
|
+
}
|
|
15459
|
+
else {
|
|
15460
|
+
elems = Array.prototype.slice.call(this.element.nextElementSibling.querySelectorAll('.e-grabbed'));
|
|
15461
|
+
}
|
|
15122
15462
|
return elems;
|
|
15123
15463
|
};
|
|
15124
15464
|
ListBox.prototype.getDragArgs = function (args, isDragEnd) {
|
|
15125
|
-
var elems = this.getGrabbedItems();
|
|
15465
|
+
var elems = this.getGrabbedItems(args);
|
|
15126
15466
|
if (elems.length) {
|
|
15127
15467
|
if (isDragEnd) {
|
|
15128
15468
|
elems.push(args.target);
|
|
@@ -15174,7 +15514,7 @@ var ListBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
15174
15514
|
}
|
|
15175
15515
|
}
|
|
15176
15516
|
}
|
|
15177
|
-
else if (e.keyCode !== 37 && e.keyCode !== 39 && e.code !==
|
|
15517
|
+
else if (e.keyCode !== 37 && e.keyCode !== 39 && e.code !== 'KeyA') {
|
|
15178
15518
|
this.upDownKeyHandler(e);
|
|
15179
15519
|
}
|
|
15180
15520
|
}
|
|
@@ -15218,8 +15558,8 @@ var ListBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
15218
15558
|
}
|
|
15219
15559
|
if (this.selectionSettings.showCheckbox && e.ctrlKey && e.shiftKey && (e.keyCode === 36 || e.keyCode === 35)) {
|
|
15220
15560
|
var selectedidx = Array.prototype.indexOf.call(ul.children, fli);
|
|
15221
|
-
var sidx = e.code ===
|
|
15222
|
-
var eidx = e.code ===
|
|
15561
|
+
var sidx = e.code === 'Home' ? 0 : selectedidx;
|
|
15562
|
+
var eidx = e.code === 'Home' ? selectedidx : ul.children.length - 1;
|
|
15223
15563
|
for (var i = sidx; i <= eidx; i++) {
|
|
15224
15564
|
var item = ul.children[i];
|
|
15225
15565
|
this.notify('updatelist', { li: item, e: {
|
|
@@ -15377,7 +15717,6 @@ var ListBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
15377
15717
|
dvalue_1 = _this.getFormattedValue(li.getAttribute('data-value'));
|
|
15378
15718
|
if (values.indexOf(dvalue_1) < 0) {
|
|
15379
15719
|
li.getElementsByClassName('e-check')[0].classList.remove('e-check');
|
|
15380
|
-
li.getElementsByClassName('e-checkbox-wrapper')[0].removeAttribute('aria-checked');
|
|
15381
15720
|
li.removeAttribute('aria-selected');
|
|
15382
15721
|
}
|
|
15383
15722
|
});
|
|
@@ -15399,6 +15738,9 @@ var ListBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
15399
15738
|
else {
|
|
15400
15739
|
text = value;
|
|
15401
15740
|
}
|
|
15741
|
+
if (typeof (text) === 'string') {
|
|
15742
|
+
text = text.split("\\").join("\\\\");
|
|
15743
|
+
}
|
|
15402
15744
|
li = _this.list.querySelector('[data-value="' + text + '"]');
|
|
15403
15745
|
if (li) {
|
|
15404
15746
|
if (_this.selectionSettings.showCheckbox) {
|
|
@@ -15729,6 +16071,12 @@ var ListBox = /** @__PURE__ @class */ (function (_super) {
|
|
|
15729
16071
|
__decorate$6([
|
|
15730
16072
|
Property('')
|
|
15731
16073
|
], ListBox.prototype, "height", void 0);
|
|
16074
|
+
__decorate$6([
|
|
16075
|
+
Property(true)
|
|
16076
|
+
], ListBox.prototype, "enabled", void 0);
|
|
16077
|
+
__decorate$6([
|
|
16078
|
+
Property(false)
|
|
16079
|
+
], ListBox.prototype, "enablePersistence", void 0);
|
|
15732
16080
|
__decorate$6([
|
|
15733
16081
|
Property(false)
|
|
15734
16082
|
], ListBox.prototype, "allowDragAndDrop", void 0);
|
|
@@ -15805,6 +16153,1468 @@ var listBoxClasses = {
|
|
|
15805
16153
|
clearIcon: 'e-clear-icon'
|
|
15806
16154
|
};
|
|
15807
16155
|
|
|
16156
|
+
/**
|
|
16157
|
+
* export all modules from current location
|
|
16158
|
+
*/
|
|
16159
|
+
|
|
16160
|
+
var __extends$7 = (undefined && undefined.__extends) || (function () {
|
|
16161
|
+
var extendStatics = function (d, b) {
|
|
16162
|
+
extendStatics = Object.setPrototypeOf ||
|
|
16163
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
16164
|
+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
16165
|
+
return extendStatics(d, b);
|
|
16166
|
+
};
|
|
16167
|
+
return function (d, b) {
|
|
16168
|
+
extendStatics(d, b);
|
|
16169
|
+
function __() { this.constructor = d; }
|
|
16170
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
16171
|
+
};
|
|
16172
|
+
})();
|
|
16173
|
+
var __decorate$7 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
16174
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
16175
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
16176
|
+
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;
|
|
16177
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
16178
|
+
};
|
|
16179
|
+
/**
|
|
16180
|
+
* The Mention component is used to list someone or something based on user input in textarea, input,
|
|
16181
|
+
* or any other editable element from which the user can select.
|
|
16182
|
+
*/
|
|
16183
|
+
var Mention = /** @__PURE__ @class */ (function (_super) {
|
|
16184
|
+
__extends$7(Mention, _super);
|
|
16185
|
+
/**
|
|
16186
|
+
* * Constructor for creating the widget
|
|
16187
|
+
*
|
|
16188
|
+
* @param {MentionModel} options - Specifies the MentionComponent model.
|
|
16189
|
+
* @param {string | HTMLElement} element - Specifies the element to render as component.
|
|
16190
|
+
* @private
|
|
16191
|
+
*/
|
|
16192
|
+
function Mention(options, element) {
|
|
16193
|
+
return _super.call(this, options, element) || this;
|
|
16194
|
+
}
|
|
16195
|
+
/**
|
|
16196
|
+
* When property value changes happened, then onPropertyChanged method will execute the respective changes in this component.
|
|
16197
|
+
*
|
|
16198
|
+
* @param {MentionModel} newProp - Returns the dynamic property value of the component.
|
|
16199
|
+
* @param {MentionModel} oldProp - Returns the previous property value of the component.
|
|
16200
|
+
* @private
|
|
16201
|
+
* @returns {void}
|
|
16202
|
+
*/
|
|
16203
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
16204
|
+
Mention.prototype.onPropertyChanged = function (newProp, oldProp) {
|
|
16205
|
+
for (var _i = 0, _a = Object.keys(newProp); _i < _a.length; _i++) {
|
|
16206
|
+
var prop = _a[_i];
|
|
16207
|
+
switch (prop) {
|
|
16208
|
+
case 'minLength':
|
|
16209
|
+
this.minLength = newProp.minLength;
|
|
16210
|
+
break;
|
|
16211
|
+
case 'suffixText':
|
|
16212
|
+
this.suffixText = newProp.suffixText;
|
|
16213
|
+
break;
|
|
16214
|
+
case 'allowSpaces':
|
|
16215
|
+
this.allowSpaces = newProp.allowSpaces;
|
|
16216
|
+
break;
|
|
16217
|
+
case 'mentionChar':
|
|
16218
|
+
this.mentionChar = newProp.mentionChar;
|
|
16219
|
+
break;
|
|
16220
|
+
case 'showMentionChar':
|
|
16221
|
+
this.showMentionChar = newProp.showMentionChar;
|
|
16222
|
+
break;
|
|
16223
|
+
case 'cssClass':
|
|
16224
|
+
this.updateCssClass(newProp.cssClass, oldProp.cssClass);
|
|
16225
|
+
break;
|
|
16226
|
+
}
|
|
16227
|
+
}
|
|
16228
|
+
};
|
|
16229
|
+
Mention.prototype.updateCssClass = function (newClass, oldClass) {
|
|
16230
|
+
if (!isNullOrUndefined(oldClass)) {
|
|
16231
|
+
oldClass = (oldClass.replace(/\s+/g, ' ')).trim();
|
|
16232
|
+
}
|
|
16233
|
+
if (!isNullOrUndefined(newClass)) {
|
|
16234
|
+
newClass = (newClass.replace(/\s+/g, ' ')).trim();
|
|
16235
|
+
}
|
|
16236
|
+
this.setCssClass(newClass, [this.inputElement], oldClass);
|
|
16237
|
+
if (this.popupObj) {
|
|
16238
|
+
this.setCssClass(newClass, [this.popupObj.element], oldClass);
|
|
16239
|
+
}
|
|
16240
|
+
};
|
|
16241
|
+
Mention.prototype.setCssClass = function (cssClass$$1, elements, oldClass) {
|
|
16242
|
+
if (!isNullOrUndefined(oldClass) && oldClass !== '') {
|
|
16243
|
+
removeClass(elements, oldClass.split(' '));
|
|
16244
|
+
}
|
|
16245
|
+
if (!isNullOrUndefined(cssClass$$1) && cssClass$$1 !== '') {
|
|
16246
|
+
addClass(elements, cssClass$$1.split(' '));
|
|
16247
|
+
}
|
|
16248
|
+
};
|
|
16249
|
+
Mention.prototype.initializeData = function () {
|
|
16250
|
+
this.isSelected = false;
|
|
16251
|
+
this.isFiltered = false;
|
|
16252
|
+
this.beforePopupOpen = false;
|
|
16253
|
+
this.initRemoteRender = false;
|
|
16254
|
+
this.isListResetted = false;
|
|
16255
|
+
this.isPopupOpen = false;
|
|
16256
|
+
this.isCollided = false;
|
|
16257
|
+
this.lineBreak = false;
|
|
16258
|
+
this.keyConfigure = {
|
|
16259
|
+
tab: 'tab',
|
|
16260
|
+
enter: '13',
|
|
16261
|
+
escape: '27',
|
|
16262
|
+
end: '35',
|
|
16263
|
+
home: '36',
|
|
16264
|
+
down: '40',
|
|
16265
|
+
up: '38',
|
|
16266
|
+
pageUp: '33',
|
|
16267
|
+
pageDown: '34',
|
|
16268
|
+
open: 'alt+40',
|
|
16269
|
+
close: 'shift+tab',
|
|
16270
|
+
hide: 'alt+38',
|
|
16271
|
+
space: '32'
|
|
16272
|
+
};
|
|
16273
|
+
};
|
|
16274
|
+
/**
|
|
16275
|
+
* Execute before render the list items
|
|
16276
|
+
*
|
|
16277
|
+
* @private
|
|
16278
|
+
* @returns {void}
|
|
16279
|
+
*/
|
|
16280
|
+
Mention.prototype.preRender = function () {
|
|
16281
|
+
this.initializeData();
|
|
16282
|
+
_super.prototype.preRender.call(this);
|
|
16283
|
+
};
|
|
16284
|
+
/**
|
|
16285
|
+
* To Initialize the control rendering
|
|
16286
|
+
*
|
|
16287
|
+
* @private
|
|
16288
|
+
* @returns {void}
|
|
16289
|
+
*/
|
|
16290
|
+
Mention.prototype.render = function () {
|
|
16291
|
+
this.inputElement = !isNullOrUndefined(this.target) ? ((typeof this.target) === 'string') ?
|
|
16292
|
+
document.querySelector(this.target) : this.target : this.element;
|
|
16293
|
+
if (this.isContentEditable(this.inputElement)) {
|
|
16294
|
+
this.inputElement.setAttribute('contenteditable', 'true');
|
|
16295
|
+
addClass([this.inputElement], ['e-mention']);
|
|
16296
|
+
if (isNullOrUndefined(this.target)) {
|
|
16297
|
+
addClass([this.inputElement], ['e-editable-element']);
|
|
16298
|
+
}
|
|
16299
|
+
}
|
|
16300
|
+
this.queryString = this.elementValue();
|
|
16301
|
+
this.wireEvent();
|
|
16302
|
+
};
|
|
16303
|
+
Mention.prototype.wireEvent = function () {
|
|
16304
|
+
EventHandler.add(this.inputElement, 'keyup', this.onKeyUp, this);
|
|
16305
|
+
this.bindCommonEvent();
|
|
16306
|
+
};
|
|
16307
|
+
Mention.prototype.unWireEvent = function () {
|
|
16308
|
+
EventHandler.remove(this.inputElement, 'keyup', this.onKeyUp);
|
|
16309
|
+
this.unBindCommonEvent();
|
|
16310
|
+
};
|
|
16311
|
+
Mention.prototype.bindCommonEvent = function () {
|
|
16312
|
+
if (!Browser.isDevice) {
|
|
16313
|
+
this.keyboardModule = new KeyboardEvents(this.inputElement, {
|
|
16314
|
+
keyAction: this.keyActionHandler.bind(this), keyConfigs: this.keyConfigure, eventName: 'keydown'
|
|
16315
|
+
});
|
|
16316
|
+
}
|
|
16317
|
+
};
|
|
16318
|
+
/**
|
|
16319
|
+
* Hides the spinner loader.
|
|
16320
|
+
*
|
|
16321
|
+
* @private
|
|
16322
|
+
* @returns {void}
|
|
16323
|
+
*/
|
|
16324
|
+
Mention.prototype.hideSpinner = function () {
|
|
16325
|
+
this.hideWaitingSpinner();
|
|
16326
|
+
};
|
|
16327
|
+
Mention.prototype.hideWaitingSpinner = function () {
|
|
16328
|
+
if (!isNullOrUndefined(this.spinnerElement)) {
|
|
16329
|
+
hideSpinner(this.spinnerElement);
|
|
16330
|
+
}
|
|
16331
|
+
if (!isNullOrUndefined(this.spinnerTemplate) && !isNullOrUndefined(this.spinnerTemplateElement)) {
|
|
16332
|
+
detach(this.spinnerTemplateElement);
|
|
16333
|
+
}
|
|
16334
|
+
};
|
|
16335
|
+
/**
|
|
16336
|
+
* Shows the spinner loader.
|
|
16337
|
+
*
|
|
16338
|
+
* @returns {void}
|
|
16339
|
+
*/
|
|
16340
|
+
Mention.prototype.showWaitingSpinner = function () {
|
|
16341
|
+
if (!isNullOrUndefined(this.popupObj)) {
|
|
16342
|
+
if (isNullOrUndefined(this.spinnerTemplate) && isNullOrUndefined(this.spinnerElement)) {
|
|
16343
|
+
this.spinnerElement = this.popupObj.element;
|
|
16344
|
+
createSpinner({
|
|
16345
|
+
target: this.spinnerElement,
|
|
16346
|
+
width: Browser.isDevice ? '16px' : '14px'
|
|
16347
|
+
}, this.createElement);
|
|
16348
|
+
showSpinner(this.spinnerElement);
|
|
16349
|
+
}
|
|
16350
|
+
if (!isNullOrUndefined(this.spinnerTemplate)) {
|
|
16351
|
+
this.setSpinnerTemplate();
|
|
16352
|
+
}
|
|
16353
|
+
}
|
|
16354
|
+
};
|
|
16355
|
+
Mention.prototype.keyActionHandler = function (e) {
|
|
16356
|
+
var isNavigation = (e.action === 'down' || e.action === 'up' || e.action === 'pageUp' || e.action === 'pageDown'
|
|
16357
|
+
|| e.action === 'home' || e.action === 'end');
|
|
16358
|
+
var isTabAction = e.action === 'tab' || e.action === 'close';
|
|
16359
|
+
if (this.list === undefined && !this.isRequested && !isTabAction && e.action !== 'escape' && e.action !== 'space') {
|
|
16360
|
+
this.renderList();
|
|
16361
|
+
}
|
|
16362
|
+
if (isNullOrUndefined(this.list) || (!isNullOrUndefined(this.liCollections) &&
|
|
16363
|
+
isNavigation && this.liCollections.length === 0) || this.isRequested) {
|
|
16364
|
+
return;
|
|
16365
|
+
}
|
|
16366
|
+
if (e.action === 'escape') {
|
|
16367
|
+
e.preventDefault();
|
|
16368
|
+
}
|
|
16369
|
+
this.isSelected = e.action === 'escape' ? false : this.isSelected;
|
|
16370
|
+
switch (e.action) {
|
|
16371
|
+
case 'down':
|
|
16372
|
+
case 'up':
|
|
16373
|
+
this.updateUpDownAction(e);
|
|
16374
|
+
break;
|
|
16375
|
+
case 'tab':
|
|
16376
|
+
if (this.isPopupOpen) {
|
|
16377
|
+
e.preventDefault();
|
|
16378
|
+
var li = this.list.querySelector('.' + dropDownBaseClasses.selected);
|
|
16379
|
+
if (li) {
|
|
16380
|
+
this.setSelection(li, e);
|
|
16381
|
+
}
|
|
16382
|
+
if (this.isPopupOpen) {
|
|
16383
|
+
this.hidePopup(e);
|
|
16384
|
+
}
|
|
16385
|
+
}
|
|
16386
|
+
break;
|
|
16387
|
+
case 'enter':
|
|
16388
|
+
if (this.isPopupOpen) {
|
|
16389
|
+
e.preventDefault();
|
|
16390
|
+
if (this.popupObj && this.popupObj.element.contains(this.selectedLI)) {
|
|
16391
|
+
this.setValue(e);
|
|
16392
|
+
}
|
|
16393
|
+
}
|
|
16394
|
+
break;
|
|
16395
|
+
case 'escape':
|
|
16396
|
+
if (this.isPopupOpen) {
|
|
16397
|
+
this.hidePopup(e);
|
|
16398
|
+
}
|
|
16399
|
+
break;
|
|
16400
|
+
}
|
|
16401
|
+
};
|
|
16402
|
+
Mention.prototype.updateUpDownAction = function (e) {
|
|
16403
|
+
var focusEle = this.list.querySelector('.' + dropDownBaseClasses.focus);
|
|
16404
|
+
if (this.isSelectFocusItem(focusEle)) {
|
|
16405
|
+
this.setSelection(focusEle, e);
|
|
16406
|
+
}
|
|
16407
|
+
else if (!isNullOrUndefined(this.liCollections)) {
|
|
16408
|
+
var li = this.list.querySelector('.' + dropDownBaseClasses.selected);
|
|
16409
|
+
if (!isNullOrUndefined(li)) {
|
|
16410
|
+
var value = this.getFormattedValue(li.getAttribute('data-value'));
|
|
16411
|
+
this.activeIndex = this.getIndexByValue(value);
|
|
16412
|
+
}
|
|
16413
|
+
var index = e.action === 'down' ? this.activeIndex + 1 : this.activeIndex - 1;
|
|
16414
|
+
var startIndex = 0;
|
|
16415
|
+
startIndex = e.action === 'down' && isNullOrUndefined(this.activeIndex) ? 0 : this.liCollections.length - 1;
|
|
16416
|
+
index = index < 0 ? this.liCollections.length - 1 : index === this.liCollections.length ? 0 : index;
|
|
16417
|
+
var nextItem = isNullOrUndefined(this.activeIndex) ?
|
|
16418
|
+
this.liCollections[startIndex] : this.liCollections[index];
|
|
16419
|
+
if (!isNullOrUndefined(nextItem)) {
|
|
16420
|
+
this.setSelection(nextItem, e);
|
|
16421
|
+
}
|
|
16422
|
+
}
|
|
16423
|
+
if (this.isPopupOpen) {
|
|
16424
|
+
e.preventDefault();
|
|
16425
|
+
}
|
|
16426
|
+
};
|
|
16427
|
+
Mention.prototype.isSelectFocusItem = function (element) {
|
|
16428
|
+
return !isNullOrUndefined(element);
|
|
16429
|
+
};
|
|
16430
|
+
Mention.prototype.unBindCommonEvent = function () {
|
|
16431
|
+
if (!Browser.isDevice) {
|
|
16432
|
+
this.keyboardModule.destroy();
|
|
16433
|
+
}
|
|
16434
|
+
};
|
|
16435
|
+
Mention.prototype.onKeyUp = function (e) {
|
|
16436
|
+
var rangetextContent;
|
|
16437
|
+
if (this.isContentEditable(this.inputElement)) {
|
|
16438
|
+
this.range = this.getCurrentRange();
|
|
16439
|
+
rangetextContent = this.range.startContainer.textContent.split('');
|
|
16440
|
+
}
|
|
16441
|
+
var currentRange = this.getTextRange();
|
|
16442
|
+
var lastWordRange = this.getLastLetter(currentRange);
|
|
16443
|
+
// eslint-disable-next-line security/detect-non-literal-regexp
|
|
16444
|
+
var Regex = new RegExp(this.mentionChar, 'g');
|
|
16445
|
+
var charRegex = new RegExp('[a-zA-Z]', 'g');
|
|
16446
|
+
if (e.key === 'Shift' || e.keyCode === 37 || e.keyCode === 39) {
|
|
16447
|
+
if ((e.keyCode === 37 || e.keyCode === 39) && !isNullOrUndefined(currentRange) &&
|
|
16448
|
+
currentRange.indexOf(this.mentionChar) === -1 && this.isPopupOpen) {
|
|
16449
|
+
this.hidePopup();
|
|
16450
|
+
}
|
|
16451
|
+
return;
|
|
16452
|
+
}
|
|
16453
|
+
if ((!currentRange || !lastWordRange) || e.code === 'Enter' || e.keyCode === 27 ||
|
|
16454
|
+
(lastWordRange.match(Regex) && lastWordRange.match(Regex).length > 1) ||
|
|
16455
|
+
(this.isContentEditable(this.inputElement) && this.range.startContainer &&
|
|
16456
|
+
this.range.startContainer.previousElementSibling && this.range.startContainer.textContent.split('').length > 0 &&
|
|
16457
|
+
(rangetextContent.length === 1 || rangetextContent[rangetextContent.length - 2].indexOf('') === -1 ||
|
|
16458
|
+
this.range.startContainer.nodeType === 1))) {
|
|
16459
|
+
if (this.allowSpaces && currentRange && currentRange.trim() !== '' && charRegex.test(currentRange) && currentRange.indexOf(this.mentionChar) !== -1
|
|
16460
|
+
&& !this.isMatchedText() && (currentRange.length > 1 && currentRange.replace(/\u00A0/g, ' ').charAt(currentRange.length - 2) !== ' ') &&
|
|
16461
|
+
(this.list && this.list.querySelectorAll('ul').length > 0)) {
|
|
16462
|
+
this.queryString = currentRange.substring(currentRange.lastIndexOf(this.mentionChar) + 1).replace('\u00a0', ' ');
|
|
16463
|
+
this.searchLists(e);
|
|
16464
|
+
}
|
|
16465
|
+
else if (this.isPopupOpen && (!this.allowSpaces || !lastWordRange)) {
|
|
16466
|
+
this.hidePopup();
|
|
16467
|
+
this.lineBreak = true;
|
|
16468
|
+
}
|
|
16469
|
+
return;
|
|
16470
|
+
}
|
|
16471
|
+
this.queryString = lastWordRange.replace(this.mentionChar, '');
|
|
16472
|
+
if (this.mentionChar.charCodeAt(0) === lastWordRange.charCodeAt(0) &&
|
|
16473
|
+
this.queryString !== '' && e.keyCode !== 38 && e.keyCode !== 40 && !this.lineBreak) {
|
|
16474
|
+
this.searchLists(e);
|
|
16475
|
+
if (!this.isPopupOpen && this.queryString.length >= this.minLength) {
|
|
16476
|
+
if (!this.isContentEditable(this.inputElement)) {
|
|
16477
|
+
this.showPopup();
|
|
16478
|
+
}
|
|
16479
|
+
else if (this.isContentEditable(this.inputElement) && this.range && this.range.startContainer !== this.inputElement && e.keyCode !== 9) {
|
|
16480
|
+
this.showPopup();
|
|
16481
|
+
}
|
|
16482
|
+
}
|
|
16483
|
+
}
|
|
16484
|
+
else if (lastWordRange.indexOf(this.mentionChar) === 0 && !this.isPopupOpen && e.keyCode !== 8 && (!this.popupObj ||
|
|
16485
|
+
(isNullOrUndefined(this.target) && !document.body.contains(this.popupObj.element) ||
|
|
16486
|
+
!isNullOrUndefined(this.target) && document.body.contains(this.popupObj.element)))) {
|
|
16487
|
+
if (this.initRemoteRender && this.list && this.list.classList.contains('e-nodata')) {
|
|
16488
|
+
this.searchLists(e);
|
|
16489
|
+
}
|
|
16490
|
+
this.resetList(this.dataSource, this.fields);
|
|
16491
|
+
if (isNullOrUndefined(this.list)) {
|
|
16492
|
+
this.initValue();
|
|
16493
|
+
}
|
|
16494
|
+
if (!this.isPopupOpen && e.keyCode !== 38 && e.keyCode !== 40) {
|
|
16495
|
+
this.showPopup();
|
|
16496
|
+
if (this.initRemoteRender && this.list.querySelectorAll('li').length === 0) {
|
|
16497
|
+
this.showWaitingSpinner();
|
|
16498
|
+
}
|
|
16499
|
+
this.lineBreak = false;
|
|
16500
|
+
}
|
|
16501
|
+
}
|
|
16502
|
+
else if (this.allowSpaces && this.queryString !== '' && currentRange && currentRange.trim() !== '' && currentRange.replace('\u00a0', ' ').lastIndexOf(' ') < currentRange.length - 1 &&
|
|
16503
|
+
e.keyCode !== 38 && e.keyCode !== 40 && e.keyCode !== 8 && this.mentionChar.charCodeAt(0) === lastWordRange.charCodeAt(0)) {
|
|
16504
|
+
this.queryString = currentRange.substring(currentRange.lastIndexOf(this.mentionChar) + 1).replace('\u00a0', ' ');
|
|
16505
|
+
this.searchLists(e);
|
|
16506
|
+
}
|
|
16507
|
+
else if (this.queryString === '' && this.isPopupOpen && e.keyCode !== 38 && e.keyCode !== 40 && this.mentionChar.charCodeAt(0) === lastWordRange.charCodeAt(0)) {
|
|
16508
|
+
this.searchLists(e);
|
|
16509
|
+
if (!this.isListResetted) {
|
|
16510
|
+
this.resetList(this.dataSource, this.fields);
|
|
16511
|
+
}
|
|
16512
|
+
}
|
|
16513
|
+
this.isListResetted = false;
|
|
16514
|
+
};
|
|
16515
|
+
Mention.prototype.isMatchedText = function () {
|
|
16516
|
+
var isMatched = false;
|
|
16517
|
+
for (var i = 0; i < (this.liCollections && this.liCollections.length); i++) {
|
|
16518
|
+
if (this.getTextRange() &&
|
|
16519
|
+
this.getTextRange().substring(this.getTextRange().lastIndexOf(this.mentionChar) + 1).replace('\u00a0', ' ').trim() === this.liCollections[i].getAttribute('data-value').toLowerCase()) {
|
|
16520
|
+
isMatched = true;
|
|
16521
|
+
}
|
|
16522
|
+
}
|
|
16523
|
+
return isMatched;
|
|
16524
|
+
};
|
|
16525
|
+
Mention.prototype.getCurrentRange = function () {
|
|
16526
|
+
this.range = this.inputElement.ownerDocument.getSelection().getRangeAt(0);
|
|
16527
|
+
return this.range;
|
|
16528
|
+
};
|
|
16529
|
+
Mention.prototype.searchLists = function (e) {
|
|
16530
|
+
var _this = this;
|
|
16531
|
+
this.isDataFetched = false;
|
|
16532
|
+
if (isNullOrUndefined(this.list)) {
|
|
16533
|
+
_super.prototype.render.call(this);
|
|
16534
|
+
this.unWireListEvents();
|
|
16535
|
+
this.wireListEvents();
|
|
16536
|
+
}
|
|
16537
|
+
if (e.type !== 'mousedown' && (e.keyCode === 40 || e.keyCode === 38)) {
|
|
16538
|
+
this.queryString = this.queryString === '' ? null : this.queryString;
|
|
16539
|
+
this.beforePopupOpen = true;
|
|
16540
|
+
this.resetList(this.dataSource, this.fields);
|
|
16541
|
+
return;
|
|
16542
|
+
}
|
|
16543
|
+
this.isSelected = false;
|
|
16544
|
+
this.activeIndex = null;
|
|
16545
|
+
var eventArgs = {
|
|
16546
|
+
preventDefaultAction: false,
|
|
16547
|
+
text: this.queryString,
|
|
16548
|
+
updateData: function (dataSource, query, fields) {
|
|
16549
|
+
if (eventArgs.cancel) {
|
|
16550
|
+
return;
|
|
16551
|
+
}
|
|
16552
|
+
_this.isFiltered = true;
|
|
16553
|
+
_this.filterAction(dataSource, query, fields);
|
|
16554
|
+
},
|
|
16555
|
+
cancel: false
|
|
16556
|
+
};
|
|
16557
|
+
this.trigger('filtering', eventArgs, function (eventArgs) {
|
|
16558
|
+
if (!eventArgs.cancel && !_this.isFiltered && !eventArgs.preventDefaultAction) {
|
|
16559
|
+
_this.filterAction(_this.dataSource, null, _this.fields);
|
|
16560
|
+
}
|
|
16561
|
+
});
|
|
16562
|
+
};
|
|
16563
|
+
Mention.prototype.filterAction = function (dataSource, query, fields) {
|
|
16564
|
+
this.beforePopupOpen = true;
|
|
16565
|
+
if (this.queryString.length >= this.minLength) {
|
|
16566
|
+
this.resetList(dataSource, fields, query);
|
|
16567
|
+
this.isListResetted = true;
|
|
16568
|
+
}
|
|
16569
|
+
else {
|
|
16570
|
+
if (this.isPopupOpen) {
|
|
16571
|
+
this.hidePopup();
|
|
16572
|
+
}
|
|
16573
|
+
this.beforePopupOpen = false;
|
|
16574
|
+
}
|
|
16575
|
+
this.setDataIndex();
|
|
16576
|
+
this.renderReactTemplates();
|
|
16577
|
+
};
|
|
16578
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
16579
|
+
Mention.prototype.onActionComplete = function (ulElement, list, e, isUpdated) {
|
|
16580
|
+
_super.prototype.onActionComplete.call(this, ulElement, list, e);
|
|
16581
|
+
if (this.isActive) {
|
|
16582
|
+
if (!isNullOrUndefined(ulElement)) {
|
|
16583
|
+
attributes(ulElement, { 'id': this.inputElement.id + '_options', 'role': 'listbox', 'aria-hidden': 'false' });
|
|
16584
|
+
}
|
|
16585
|
+
var focusItem = ulElement.querySelector('.' + dropDownBaseClasses.li);
|
|
16586
|
+
if (focusItem) {
|
|
16587
|
+
focusItem.classList.add(dropDownBaseClasses.selected);
|
|
16588
|
+
this.selectedLI = focusItem;
|
|
16589
|
+
var value = this.getFormattedValue(focusItem.getAttribute('data-value'));
|
|
16590
|
+
this.selectEventCallback(focusItem, this.getDataByValue(value), value, true);
|
|
16591
|
+
}
|
|
16592
|
+
}
|
|
16593
|
+
};
|
|
16594
|
+
Mention.prototype.setDataIndex = function () {
|
|
16595
|
+
for (var i = 0; this.liCollections && i < this.liCollections.length; i++) {
|
|
16596
|
+
this.liCollections[i].setAttribute('data-index', i.toString());
|
|
16597
|
+
}
|
|
16598
|
+
};
|
|
16599
|
+
Mention.prototype.listOption = function (dataSource, fieldsSettings) {
|
|
16600
|
+
var _this = this;
|
|
16601
|
+
var fields = _super.prototype.listOption.call(this, dataSource, fieldsSettings);
|
|
16602
|
+
if (isNullOrUndefined(fields.itemCreated)) {
|
|
16603
|
+
fields.itemCreated = function (e) {
|
|
16604
|
+
if (_this.highlight) {
|
|
16605
|
+
if (_this.inputElement.tagName === _this.getNgDirective() && _this.itemTemplate) {
|
|
16606
|
+
setTimeout(function () {
|
|
16607
|
+
highlightSearch(e.item, _this.queryString, _this.ignoreCase, _this.filterType);
|
|
16608
|
+
}, 0);
|
|
16609
|
+
}
|
|
16610
|
+
else {
|
|
16611
|
+
highlightSearch(e.item, _this.queryString, _this.ignoreCase, _this.filterType);
|
|
16612
|
+
}
|
|
16613
|
+
}
|
|
16614
|
+
};
|
|
16615
|
+
}
|
|
16616
|
+
else {
|
|
16617
|
+
var itemCreated_1 = fields.itemCreated;
|
|
16618
|
+
fields.itemCreated = function (e) {
|
|
16619
|
+
if (_this.highlight) {
|
|
16620
|
+
highlightSearch(e.item, _this.queryString, _this.ignoreCase, _this.filterType);
|
|
16621
|
+
}
|
|
16622
|
+
itemCreated_1.apply(_this, [e]);
|
|
16623
|
+
};
|
|
16624
|
+
}
|
|
16625
|
+
return fields;
|
|
16626
|
+
};
|
|
16627
|
+
Mention.prototype.elementValue = function () {
|
|
16628
|
+
if (!this.isContentEditable(this.inputElement)) {
|
|
16629
|
+
return this.inputElement.value.replace(this.mentionChar, '');
|
|
16630
|
+
}
|
|
16631
|
+
else {
|
|
16632
|
+
return this.inputElement.textContent.replace(this.mentionChar, '');
|
|
16633
|
+
}
|
|
16634
|
+
};
|
|
16635
|
+
Mention.prototype.getQuery = function (query) {
|
|
16636
|
+
var filterQuery = query ? query.clone() : this.query ? this.query.clone() : new Query();
|
|
16637
|
+
var filterType = (this.queryString === '' && !isNullOrUndefined(this.elementValue())) ? 'equal' : this.filterType;
|
|
16638
|
+
var queryString = (this.queryString === '' && !isNullOrUndefined(this.elementValue())) ?
|
|
16639
|
+
this.elementValue() : this.queryString;
|
|
16640
|
+
if (this.isFiltered) {
|
|
16641
|
+
return filterQuery;
|
|
16642
|
+
}
|
|
16643
|
+
if (this.queryString !== null && this.queryString !== '') {
|
|
16644
|
+
var dataType = this.typeOfData(this.dataSource).typeof;
|
|
16645
|
+
if (!(this.dataSource instanceof DataManager) && dataType === 'string' || dataType === 'number') {
|
|
16646
|
+
filterQuery.where('', filterType, queryString, this.ignoreCase, this.ignoreAccent);
|
|
16647
|
+
}
|
|
16648
|
+
else {
|
|
16649
|
+
var mapping = !isNullOrUndefined(this.fields.text) ? this.fields.text : '';
|
|
16650
|
+
filterQuery.where(mapping, filterType, queryString, this.ignoreCase, this.ignoreAccent);
|
|
16651
|
+
}
|
|
16652
|
+
}
|
|
16653
|
+
if (!isNullOrUndefined(this.suggestionCount)) {
|
|
16654
|
+
// Since defualt value of suggestioncount is 25, checked the condition
|
|
16655
|
+
if (this.suggestionCount !== 25) {
|
|
16656
|
+
for (var queryElements = 0; queryElements < filterQuery.queries.length; queryElements++) {
|
|
16657
|
+
if (filterQuery.queries[queryElements].fn === 'onTake') {
|
|
16658
|
+
filterQuery.queries.splice(queryElements, 1);
|
|
16659
|
+
}
|
|
16660
|
+
}
|
|
16661
|
+
}
|
|
16662
|
+
filterQuery.take(this.suggestionCount);
|
|
16663
|
+
}
|
|
16664
|
+
return filterQuery;
|
|
16665
|
+
};
|
|
16666
|
+
Mention.prototype.renderHightSearch = function () {
|
|
16667
|
+
if (this.highlight) {
|
|
16668
|
+
for (var i = 0; i < this.liCollections.length; i++) {
|
|
16669
|
+
var isHighlight = this.ulElement.querySelector('.e-active');
|
|
16670
|
+
if (!isHighlight) {
|
|
16671
|
+
revertHighlightSearch(this.liCollections[i]);
|
|
16672
|
+
highlightSearch(this.liCollections[i], this.queryString, this.ignoreCase, this.filterType);
|
|
16673
|
+
}
|
|
16674
|
+
}
|
|
16675
|
+
}
|
|
16676
|
+
};
|
|
16677
|
+
Mention.prototype.getTextRange = function () {
|
|
16678
|
+
var text;
|
|
16679
|
+
if (!this.isContentEditable(this.inputElement)) {
|
|
16680
|
+
var component = this.inputElement;
|
|
16681
|
+
if (!isNullOrUndefined(component)) {
|
|
16682
|
+
var startPos = component.selectionStart;
|
|
16683
|
+
if (component.value && startPos >= 0) {
|
|
16684
|
+
text = component.value.substring(0, startPos);
|
|
16685
|
+
}
|
|
16686
|
+
}
|
|
16687
|
+
}
|
|
16688
|
+
else {
|
|
16689
|
+
if (this.range) {
|
|
16690
|
+
var selectedElem = this.range.startContainer;
|
|
16691
|
+
if (!isNullOrUndefined(selectedElem)) {
|
|
16692
|
+
var workingNodeContent = selectedElem.textContent;
|
|
16693
|
+
var selectStartOffset = this.range.startOffset;
|
|
16694
|
+
if (workingNodeContent && selectStartOffset >= 0) {
|
|
16695
|
+
text = workingNodeContent.substring(0, selectStartOffset);
|
|
16696
|
+
}
|
|
16697
|
+
}
|
|
16698
|
+
}
|
|
16699
|
+
}
|
|
16700
|
+
return text;
|
|
16701
|
+
};
|
|
16702
|
+
Mention.prototype.getLastLetter = function (text) {
|
|
16703
|
+
if (isNullOrUndefined(text)) {
|
|
16704
|
+
return '';
|
|
16705
|
+
}
|
|
16706
|
+
var textValue = text.replace(/\u00A0/g, ' ');
|
|
16707
|
+
var words = textValue.split(/\s+/);
|
|
16708
|
+
var wordCnt = words.length - 1;
|
|
16709
|
+
return words[wordCnt].trim();
|
|
16710
|
+
};
|
|
16711
|
+
Mention.prototype.isContentEditable = function (element) {
|
|
16712
|
+
return element && element.nodeName !== 'INPUT' && element.nodeName !== 'TEXTAREA';
|
|
16713
|
+
};
|
|
16714
|
+
/**
|
|
16715
|
+
* Opens the popup that displays the list of items.
|
|
16716
|
+
*
|
|
16717
|
+
* @returns {void}
|
|
16718
|
+
*/
|
|
16719
|
+
Mention.prototype.showPopup = function () {
|
|
16720
|
+
this.beforePopupOpen = true;
|
|
16721
|
+
if (isNullOrUndefined(this.list)) {
|
|
16722
|
+
this.initValue();
|
|
16723
|
+
}
|
|
16724
|
+
this.renderPopup();
|
|
16725
|
+
attributes(this.inputElement, { 'aria-activedescendant': this.selectedElementID });
|
|
16726
|
+
if (this.selectedElementID == null) {
|
|
16727
|
+
this.inputElement.removeAttribute('aria-activedescendant');
|
|
16728
|
+
}
|
|
16729
|
+
};
|
|
16730
|
+
/* eslint-disable valid-jsdoc, jsdoc/require-param */
|
|
16731
|
+
/**
|
|
16732
|
+
* Hides the popup if it is in an open state.
|
|
16733
|
+
*
|
|
16734
|
+
* @returns {void}
|
|
16735
|
+
*/
|
|
16736
|
+
Mention.prototype.hidePopup = function (e) {
|
|
16737
|
+
this.removeSelection();
|
|
16738
|
+
this.closePopup(0, e);
|
|
16739
|
+
};
|
|
16740
|
+
Mention.prototype.closePopup = function (delay, e) {
|
|
16741
|
+
var _this = this;
|
|
16742
|
+
if (!(this.popupObj && document.body.contains(this.popupObj.element) && this.beforePopupOpen)) {
|
|
16743
|
+
return;
|
|
16744
|
+
}
|
|
16745
|
+
EventHandler.remove(document, 'mousedown', this.onDocumentClick);
|
|
16746
|
+
this.inputElement.removeAttribute('aria-owns');
|
|
16747
|
+
this.inputElement.removeAttribute('aria-activedescendant');
|
|
16748
|
+
this.beforePopupOpen = false;
|
|
16749
|
+
var animModel = {
|
|
16750
|
+
name: 'FadeOut',
|
|
16751
|
+
duration: 100,
|
|
16752
|
+
delay: delay ? delay : 0
|
|
16753
|
+
};
|
|
16754
|
+
var popupInstance = this.popupObj;
|
|
16755
|
+
var eventArgs = { popup: popupInstance, cancel: false, animation: animModel, event: e || null };
|
|
16756
|
+
this.trigger('closed', eventArgs, function (eventArgs) {
|
|
16757
|
+
if (!eventArgs.cancel && _this.popupObj) {
|
|
16758
|
+
if (_this.isPopupOpen) {
|
|
16759
|
+
_this.popupObj.hide(new Animation(eventArgs.animation));
|
|
16760
|
+
}
|
|
16761
|
+
else {
|
|
16762
|
+
_this.destroyPopup();
|
|
16763
|
+
}
|
|
16764
|
+
}
|
|
16765
|
+
});
|
|
16766
|
+
};
|
|
16767
|
+
Mention.prototype.renderPopup = function () {
|
|
16768
|
+
var _this = this;
|
|
16769
|
+
var args = { cancel: false };
|
|
16770
|
+
this.trigger('beforeOpen', args, function (args) {
|
|
16771
|
+
if (!args.cancel) {
|
|
16772
|
+
var popupEle_1;
|
|
16773
|
+
if (isNullOrUndefined(_this.target)) {
|
|
16774
|
+
popupEle_1 = _this.createElement('div', {
|
|
16775
|
+
id: _this.inputElement.id + '_popup', className: 'e-mention e-popup ' + (_this.cssClass != null ? _this.cssClass : '')
|
|
16776
|
+
});
|
|
16777
|
+
}
|
|
16778
|
+
else {
|
|
16779
|
+
popupEle_1 = _this.element;
|
|
16780
|
+
if (_this.cssClass != null) {
|
|
16781
|
+
addClass([popupEle_1], _this.cssClass.split(' '));
|
|
16782
|
+
}
|
|
16783
|
+
}
|
|
16784
|
+
if (!isNullOrUndefined(_this.target)) {
|
|
16785
|
+
popupEle_1.id = _this.inputElement.id + '_popup';
|
|
16786
|
+
}
|
|
16787
|
+
_this.listHeight = formatUnit(_this.popupHeight);
|
|
16788
|
+
if (!isNullOrUndefined(_this.list.querySelector('li')) && !_this.initRemoteRender) {
|
|
16789
|
+
var li = _this.list.querySelector('.' + dropDownBaseClasses.focus);
|
|
16790
|
+
if (!isNullOrUndefined(li)) {
|
|
16791
|
+
_this.selectedLI = li;
|
|
16792
|
+
var value = _this.getFormattedValue(li.getAttribute('data-value'));
|
|
16793
|
+
_this.selectEventCallback(li, _this.getDataByValue(value), value, true);
|
|
16794
|
+
}
|
|
16795
|
+
}
|
|
16796
|
+
append([_this.list], popupEle_1);
|
|
16797
|
+
if ((!_this.popupObj || !document.body.contains(_this.popupObj.element)) ||
|
|
16798
|
+
!document.contains(popupEle_1) && isNullOrUndefined(_this.target)) {
|
|
16799
|
+
document.body.appendChild(popupEle_1);
|
|
16800
|
+
}
|
|
16801
|
+
var coordinates_1;
|
|
16802
|
+
popupEle_1.style.visibility = 'hidden';
|
|
16803
|
+
_this.setHeight(popupEle_1);
|
|
16804
|
+
var offsetValue = 0;
|
|
16805
|
+
var left = 0;
|
|
16806
|
+
_this.initializePopup(popupEle_1, offsetValue, left);
|
|
16807
|
+
_this.checkCollision(popupEle_1);
|
|
16808
|
+
popupEle_1.style.visibility = 'visible';
|
|
16809
|
+
addClass([popupEle_1], ['e-mention', 'e-popup', 'e-popup-close']);
|
|
16810
|
+
if (!isNullOrUndefined(_this.list)) {
|
|
16811
|
+
_this.unWireListEvents();
|
|
16812
|
+
_this.wireListEvents();
|
|
16813
|
+
}
|
|
16814
|
+
_this.selectedElementID = _this.selectedLI ? _this.selectedLI.id : null;
|
|
16815
|
+
attributes(_this.inputElement, { 'aria-owns': _this.inputElement.id + '_options', 'aria-activedescendant': _this.selectedElementID });
|
|
16816
|
+
if (_this.selectedElementID == null) {
|
|
16817
|
+
_this.inputElement.removeAttribute('aria-activedescendant');
|
|
16818
|
+
}
|
|
16819
|
+
var animModel = { name: 'FadeIn', duration: 100 };
|
|
16820
|
+
_this.beforePopupOpen = true;
|
|
16821
|
+
var popupInstance = _this.popupObj;
|
|
16822
|
+
var eventArgs = { popup: popupInstance, cancel: false, animation: animModel };
|
|
16823
|
+
_this.trigger('opened', eventArgs, function (eventArgs) {
|
|
16824
|
+
if (!eventArgs.cancel) {
|
|
16825
|
+
_this.renderReactTemplates();
|
|
16826
|
+
_this.popupObj.show(new Animation(eventArgs.animation), (_this.zIndex === 1000) ? _this.inputElement : null);
|
|
16827
|
+
if (isNullOrUndefined(_this.getTriggerCharPosition())) {
|
|
16828
|
+
return;
|
|
16829
|
+
}
|
|
16830
|
+
coordinates_1 = _this.getCoordinates(_this.inputElement, _this.getTriggerCharPosition());
|
|
16831
|
+
if (!_this.isCollided) {
|
|
16832
|
+
popupEle_1.style.cssText = 'top: '.concat(coordinates_1.top.toString(), 'px;\n left: ').concat(coordinates_1.left.toString(), 'px;\nposition: absolute;\n display: block;');
|
|
16833
|
+
}
|
|
16834
|
+
else {
|
|
16835
|
+
popupEle_1.style.left = formatUnit(coordinates_1.left);
|
|
16836
|
+
_this.isCollided = false;
|
|
16837
|
+
}
|
|
16838
|
+
popupEle_1.style.width = _this.popupWidth !== '100%' && !isNullOrUndefined(_this.popupWidth) ? formatUnit(_this.popupWidth) : 'auto';
|
|
16839
|
+
_this.setHeight(popupEle_1);
|
|
16840
|
+
popupEle_1.style.zIndex = _this.zIndex === 1000 ? getZindexPartial(popupEle_1).toString() : _this.zIndex.toString();
|
|
16841
|
+
}
|
|
16842
|
+
else {
|
|
16843
|
+
_this.beforePopupOpen = false;
|
|
16844
|
+
_this.destroyPopup();
|
|
16845
|
+
}
|
|
16846
|
+
});
|
|
16847
|
+
}
|
|
16848
|
+
else {
|
|
16849
|
+
_this.beforePopupOpen = false;
|
|
16850
|
+
}
|
|
16851
|
+
});
|
|
16852
|
+
};
|
|
16853
|
+
Mention.prototype.setHeight = function (popupEle) {
|
|
16854
|
+
if (this.popupHeight !== 'auto') {
|
|
16855
|
+
this.list.style.maxHeight = (parseInt(this.listHeight, 10) - 2).toString() + 'px'; // due to box-sizing property
|
|
16856
|
+
popupEle.style.maxHeight = formatUnit(this.popupHeight);
|
|
16857
|
+
}
|
|
16858
|
+
else {
|
|
16859
|
+
popupEle.style.height = 'auto';
|
|
16860
|
+
}
|
|
16861
|
+
};
|
|
16862
|
+
Mention.prototype.checkCollision = function (popupEle) {
|
|
16863
|
+
if (!Browser.isDevice || (Browser.isDevice && !(this.getModuleName() === 'mention'))) {
|
|
16864
|
+
var collision = isCollide(popupEle);
|
|
16865
|
+
if (collision.length > 0) {
|
|
16866
|
+
popupEle.style.marginTop = -parseInt(getComputedStyle(popupEle).marginTop, 10) + 'px';
|
|
16867
|
+
this.isCollided = true;
|
|
16868
|
+
}
|
|
16869
|
+
this.popupObj.resolveCollision();
|
|
16870
|
+
}
|
|
16871
|
+
};
|
|
16872
|
+
Mention.prototype.getTriggerCharPosition = function () {
|
|
16873
|
+
var mostRecentTriggerCharPos;
|
|
16874
|
+
var currentRange = this.getTextRange();
|
|
16875
|
+
if (currentRange !== undefined && currentRange !== null) {
|
|
16876
|
+
mostRecentTriggerCharPos = 0;
|
|
16877
|
+
var idx = currentRange.lastIndexOf(this.mentionChar);
|
|
16878
|
+
if (idx >= mostRecentTriggerCharPos) {
|
|
16879
|
+
mostRecentTriggerCharPos = idx;
|
|
16880
|
+
}
|
|
16881
|
+
}
|
|
16882
|
+
return mostRecentTriggerCharPos;
|
|
16883
|
+
};
|
|
16884
|
+
Mention.prototype.initializePopup = function (element, offsetValue, left) {
|
|
16885
|
+
var _this = this;
|
|
16886
|
+
this.popupObj = new Popup(element, {
|
|
16887
|
+
width: this.setWidth(), targetType: 'relative',
|
|
16888
|
+
relateTo: this.inputElement, collision: { X: 'flip', Y: 'flip' }, offsetY: offsetValue,
|
|
16889
|
+
enableRtl: this.enableRtl, offsetX: left, position: { X: 'top', Y: 'left' }, actionOnScroll: 'hide',
|
|
16890
|
+
zIndex: this.zIndex,
|
|
16891
|
+
close: function () {
|
|
16892
|
+
_this.destroyPopup();
|
|
16893
|
+
},
|
|
16894
|
+
open: function () {
|
|
16895
|
+
EventHandler.add(document, 'mousedown', _this.onDocumentClick, _this);
|
|
16896
|
+
_this.isPopupOpen = true;
|
|
16897
|
+
_this.setDataIndex();
|
|
16898
|
+
}
|
|
16899
|
+
});
|
|
16900
|
+
};
|
|
16901
|
+
Mention.prototype.setWidth = function () {
|
|
16902
|
+
var width = formatUnit(this.popupWidth);
|
|
16903
|
+
if (width.indexOf('%') > -1) {
|
|
16904
|
+
var inputWidth = this.inputElement.offsetWidth * parseFloat(width) / 100;
|
|
16905
|
+
width = inputWidth.toString() + 'px';
|
|
16906
|
+
}
|
|
16907
|
+
return width;
|
|
16908
|
+
};
|
|
16909
|
+
Mention.prototype.destroyPopup = function () {
|
|
16910
|
+
this.isPopupOpen = false;
|
|
16911
|
+
this.popupObj.destroy();
|
|
16912
|
+
if (isNullOrUndefined(this.target)) {
|
|
16913
|
+
detach(this.popupObj.element);
|
|
16914
|
+
}
|
|
16915
|
+
else {
|
|
16916
|
+
this.popupObj.element.innerHTML = '';
|
|
16917
|
+
this.popupObj.element.removeAttribute('style');
|
|
16918
|
+
this.popupObj.element.removeAttribute('aria-disabled');
|
|
16919
|
+
}
|
|
16920
|
+
};
|
|
16921
|
+
Mention.prototype.onDocumentClick = function (e) {
|
|
16922
|
+
var target = e.target;
|
|
16923
|
+
if (!(!isNullOrUndefined(this.popupObj) && closest(target, '#' + this.popupObj.element.id))) {
|
|
16924
|
+
this.hidePopup(e);
|
|
16925
|
+
}
|
|
16926
|
+
};
|
|
16927
|
+
Mention.prototype.getCoordinates = function (element, position) {
|
|
16928
|
+
var 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'];
|
|
16929
|
+
var div;
|
|
16930
|
+
var span;
|
|
16931
|
+
var range;
|
|
16932
|
+
var globalRange;
|
|
16933
|
+
var coordinates;
|
|
16934
|
+
var computed;
|
|
16935
|
+
var rect;
|
|
16936
|
+
if (!this.isContentEditable(this.inputElement)) {
|
|
16937
|
+
div = this.createElement('div', { className: 'e-form-mirror-div' });
|
|
16938
|
+
document.body.appendChild(div);
|
|
16939
|
+
computed = getComputedStyle(element);
|
|
16940
|
+
div.style.position = 'absolute';
|
|
16941
|
+
div.style.visibility = 'hidden';
|
|
16942
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
16943
|
+
properties.forEach(function (prop) {
|
|
16944
|
+
// eslint-disable-next-line security/detect-object-injection
|
|
16945
|
+
div.style[prop] = computed[prop];
|
|
16946
|
+
});
|
|
16947
|
+
div.textContent = element.value.substring(0, position);
|
|
16948
|
+
if (this.inputElement.nodeName === 'INPUT') {
|
|
16949
|
+
div.textContent = div.textContent.replace(/\s/g, '\u00a0');
|
|
16950
|
+
}
|
|
16951
|
+
span = this.createElement('span');
|
|
16952
|
+
span.textContent = element.value.substring(position) || '.';
|
|
16953
|
+
div.appendChild(span);
|
|
16954
|
+
rect = element.getBoundingClientRect();
|
|
16955
|
+
}
|
|
16956
|
+
else {
|
|
16957
|
+
var selectedNodePosition = this.getTriggerCharPosition();
|
|
16958
|
+
globalRange = this.range;
|
|
16959
|
+
range = document.createRange();
|
|
16960
|
+
range.setStart(globalRange.startContainer, selectedNodePosition);
|
|
16961
|
+
range.setEnd(globalRange.startContainer, selectedNodePosition);
|
|
16962
|
+
range.collapse(false);
|
|
16963
|
+
rect = range.getBoundingClientRect();
|
|
16964
|
+
}
|
|
16965
|
+
var doc = document.documentElement;
|
|
16966
|
+
var windowLeft = (window.pageXOffset || doc.scrollLeft) - (doc.clientLeft || 0);
|
|
16967
|
+
var windowTop = (window.pageYOffset || doc.scrollTop) - (doc.clientTop || 0);
|
|
16968
|
+
if (!this.isContentEditable(this.inputElement)) {
|
|
16969
|
+
coordinates = {
|
|
16970
|
+
top: rect.top + windowTop + span.offsetTop + parseInt(computed.borderTopWidth, 10) +
|
|
16971
|
+
parseInt(computed.fontSize, 10) + 3 - element.scrollTop,
|
|
16972
|
+
left: rect.left + windowLeft + span.offsetLeft + parseInt(computed.borderLeftWidth, 10)
|
|
16973
|
+
};
|
|
16974
|
+
document.body.removeChild(div);
|
|
16975
|
+
}
|
|
16976
|
+
else {
|
|
16977
|
+
coordinates = {
|
|
16978
|
+
top: rect.top + windowTop + parseInt(getComputedStyle(this.inputElement).fontSize, 10),
|
|
16979
|
+
left: rect.left + windowLeft
|
|
16980
|
+
};
|
|
16981
|
+
}
|
|
16982
|
+
return coordinates;
|
|
16983
|
+
};
|
|
16984
|
+
Mention.prototype.initValue = function () {
|
|
16985
|
+
this.renderList();
|
|
16986
|
+
if (this.dataSource instanceof DataManager) {
|
|
16987
|
+
this.initRemoteRender = true;
|
|
16988
|
+
}
|
|
16989
|
+
else {
|
|
16990
|
+
this.updateValues();
|
|
16991
|
+
}
|
|
16992
|
+
};
|
|
16993
|
+
Mention.prototype.updateValues = function () {
|
|
16994
|
+
var li = this.list.querySelector('.' + dropDownBaseClasses.focus);
|
|
16995
|
+
if (!isNullOrUndefined(li)) {
|
|
16996
|
+
this.setSelection(li, null);
|
|
16997
|
+
}
|
|
16998
|
+
};
|
|
16999
|
+
Mention.prototype.renderList = function () {
|
|
17000
|
+
_super.prototype.render.call(this);
|
|
17001
|
+
this.unWireListEvents();
|
|
17002
|
+
this.wireListEvents();
|
|
17003
|
+
};
|
|
17004
|
+
/**
|
|
17005
|
+
* Event binding for list
|
|
17006
|
+
*
|
|
17007
|
+
* @returns {void}
|
|
17008
|
+
*/
|
|
17009
|
+
Mention.prototype.wireListEvents = function () {
|
|
17010
|
+
EventHandler.add(this.list, 'click', this.onMouseClick, this);
|
|
17011
|
+
EventHandler.add(this.list, 'mouseover', this.onMouseOver, this);
|
|
17012
|
+
EventHandler.add(this.list, 'mouseout', this.onMouseLeave, this);
|
|
17013
|
+
};
|
|
17014
|
+
/**
|
|
17015
|
+
* Event un binding for list items.
|
|
17016
|
+
*
|
|
17017
|
+
* @returns {void}
|
|
17018
|
+
*/
|
|
17019
|
+
Mention.prototype.unWireListEvents = function () {
|
|
17020
|
+
EventHandler.remove(this.list, 'click', this.onMouseClick);
|
|
17021
|
+
EventHandler.remove(this.list, 'mouseover', this.onMouseOver);
|
|
17022
|
+
EventHandler.remove(this.list, 'mouseout', this.onMouseLeave);
|
|
17023
|
+
};
|
|
17024
|
+
Mention.prototype.onMouseClick = function (e) {
|
|
17025
|
+
var target = e.target;
|
|
17026
|
+
var li = closest(target, '.' + dropDownBaseClasses.li);
|
|
17027
|
+
if (!this.isValidLI(li)) {
|
|
17028
|
+
return;
|
|
17029
|
+
}
|
|
17030
|
+
this.setSelection(li, e);
|
|
17031
|
+
var delay = 100;
|
|
17032
|
+
this.closePopup(delay, e);
|
|
17033
|
+
this.inputElement.focus();
|
|
17034
|
+
};
|
|
17035
|
+
Mention.prototype.updateSelectedItem = function (li, e, preventSelect, isSelection) {
|
|
17036
|
+
var _this = this;
|
|
17037
|
+
this.removeSelection();
|
|
17038
|
+
li.classList.add(dropDownBaseClasses.selected);
|
|
17039
|
+
this.removeHover();
|
|
17040
|
+
var value = this.getFormattedValue(li.getAttribute('data-value'));
|
|
17041
|
+
var selectedData = this.getDataByValue(value);
|
|
17042
|
+
if (!preventSelect && !isNullOrUndefined(e)) {
|
|
17043
|
+
var items = this.detachChanges(selectedData);
|
|
17044
|
+
this.isSelected = true;
|
|
17045
|
+
var eventArgs = {
|
|
17046
|
+
e: e,
|
|
17047
|
+
item: li,
|
|
17048
|
+
itemData: items,
|
|
17049
|
+
isInteracted: e ? true : false,
|
|
17050
|
+
cancel: false
|
|
17051
|
+
};
|
|
17052
|
+
this.trigger('select', eventArgs, function (eventArgs) {
|
|
17053
|
+
if (eventArgs.cancel) {
|
|
17054
|
+
li.classList.remove(dropDownBaseClasses.selected);
|
|
17055
|
+
}
|
|
17056
|
+
else {
|
|
17057
|
+
_this.selectEventCallback(li, selectedData, value);
|
|
17058
|
+
if (isSelection) {
|
|
17059
|
+
_this.setSelectOptions(li, e);
|
|
17060
|
+
}
|
|
17061
|
+
}
|
|
17062
|
+
});
|
|
17063
|
+
}
|
|
17064
|
+
else {
|
|
17065
|
+
this.selectEventCallback(li, selectedData, value);
|
|
17066
|
+
if (isSelection) {
|
|
17067
|
+
this.setSelectOptions(li, e);
|
|
17068
|
+
}
|
|
17069
|
+
}
|
|
17070
|
+
};
|
|
17071
|
+
Mention.prototype.setSelection = function (li, e) {
|
|
17072
|
+
if (this.isValidLI(li) && (!li.classList.contains(dropDownBaseClasses.selected) || (this.isPopupOpen && this.isSelected
|
|
17073
|
+
&& li.classList.contains(dropDownBaseClasses.selected)))) {
|
|
17074
|
+
this.updateSelectedItem(li, e, false, true);
|
|
17075
|
+
}
|
|
17076
|
+
else {
|
|
17077
|
+
this.setSelectOptions(li, e);
|
|
17078
|
+
}
|
|
17079
|
+
};
|
|
17080
|
+
Mention.prototype.setSelectOptions = function (li, e) {
|
|
17081
|
+
if (this.list) {
|
|
17082
|
+
this.removeHover();
|
|
17083
|
+
}
|
|
17084
|
+
this.previousSelectedLI = (!isNullOrUndefined(this.selectedLI)) ? this.selectedLI : null;
|
|
17085
|
+
this.selectedLI = li;
|
|
17086
|
+
if (this.isPopupOpen && !isNullOrUndefined(this.selectedLI)) {
|
|
17087
|
+
this.setScrollPosition(e);
|
|
17088
|
+
}
|
|
17089
|
+
if (e && (e.keyCode === 38 || e.keyCode === 40)) {
|
|
17090
|
+
return;
|
|
17091
|
+
}
|
|
17092
|
+
if (isNullOrUndefined(e) || this.setValue(e)) {
|
|
17093
|
+
return;
|
|
17094
|
+
}
|
|
17095
|
+
};
|
|
17096
|
+
Mention.prototype.setScrollPosition = function (e) {
|
|
17097
|
+
if (!isNullOrUndefined(e)) {
|
|
17098
|
+
switch (e.action) {
|
|
17099
|
+
case 'pageDown':
|
|
17100
|
+
case 'down':
|
|
17101
|
+
case 'end':
|
|
17102
|
+
this.scrollBottom();
|
|
17103
|
+
break;
|
|
17104
|
+
default:
|
|
17105
|
+
this.scrollTop();
|
|
17106
|
+
break;
|
|
17107
|
+
}
|
|
17108
|
+
}
|
|
17109
|
+
else {
|
|
17110
|
+
this.scrollBottom(true);
|
|
17111
|
+
}
|
|
17112
|
+
};
|
|
17113
|
+
Mention.prototype.scrollBottom = function (isInitial) {
|
|
17114
|
+
if (!isNullOrUndefined(this.selectedLI)) {
|
|
17115
|
+
var currentOffset = this.list.offsetHeight;
|
|
17116
|
+
var nextBottom = this.selectedLI.offsetTop + this.selectedLI.offsetHeight - this.list.scrollTop;
|
|
17117
|
+
var nextOffset = this.list.scrollTop + nextBottom - currentOffset;
|
|
17118
|
+
nextOffset = isInitial ? nextOffset + parseInt(getComputedStyle(this.list).paddingTop, 10) * 2 : nextOffset;
|
|
17119
|
+
var boxRange = this.selectedLI.offsetTop + this.selectedLI.offsetHeight - this.list.scrollTop;
|
|
17120
|
+
if (this.activeIndex === 0) {
|
|
17121
|
+
this.list.scrollTop = 0;
|
|
17122
|
+
}
|
|
17123
|
+
else if (nextBottom > currentOffset || !(boxRange > 0 && this.list.offsetHeight > boxRange)) {
|
|
17124
|
+
this.list.scrollTop = nextOffset;
|
|
17125
|
+
}
|
|
17126
|
+
}
|
|
17127
|
+
};
|
|
17128
|
+
Mention.prototype.scrollTop = function () {
|
|
17129
|
+
if (!isNullOrUndefined(this.selectedLI)) {
|
|
17130
|
+
var nextOffset = this.selectedLI.offsetTop - this.list.scrollTop;
|
|
17131
|
+
nextOffset = this.fields.groupBy && nextOffset;
|
|
17132
|
+
var boxRange = (this.selectedLI.offsetTop + this.selectedLI.offsetHeight - this.list.scrollTop);
|
|
17133
|
+
if (this.activeIndex === 0) {
|
|
17134
|
+
this.list.scrollTop = 0;
|
|
17135
|
+
}
|
|
17136
|
+
else if (nextOffset < 0) {
|
|
17137
|
+
this.list.scrollTop = this.list.scrollTop + nextOffset;
|
|
17138
|
+
}
|
|
17139
|
+
else if (!(boxRange > 0 && this.list.offsetHeight > boxRange)) {
|
|
17140
|
+
this.list.scrollTop = this.selectedLI.offsetTop;
|
|
17141
|
+
}
|
|
17142
|
+
}
|
|
17143
|
+
};
|
|
17144
|
+
Mention.prototype.selectEventCallback = function (li, selectedData, value, selectLi) {
|
|
17145
|
+
this.previousItemData = (!isNullOrUndefined(this.itemData)) ? this.itemData : null;
|
|
17146
|
+
this.item = li;
|
|
17147
|
+
this.itemData = selectedData;
|
|
17148
|
+
var focusedItem = this.list.querySelector('.' + dropDownBaseClasses.focus);
|
|
17149
|
+
if (focusedItem) {
|
|
17150
|
+
removeClass([focusedItem], dropDownBaseClasses.focus);
|
|
17151
|
+
}
|
|
17152
|
+
if (selectLi) {
|
|
17153
|
+
addClass([li], dropDownBaseClasses.selected);
|
|
17154
|
+
}
|
|
17155
|
+
li.setAttribute('aria-selected', 'true');
|
|
17156
|
+
this.activeIndex = this.getIndexByValue(value);
|
|
17157
|
+
};
|
|
17158
|
+
Mention.prototype.detachChanges = function (value) {
|
|
17159
|
+
var items;
|
|
17160
|
+
if (typeof value === 'string' ||
|
|
17161
|
+
typeof value === 'boolean' ||
|
|
17162
|
+
typeof value === 'number') {
|
|
17163
|
+
items = Object.defineProperties({}, {
|
|
17164
|
+
value: {
|
|
17165
|
+
value: value,
|
|
17166
|
+
enumerable: true
|
|
17167
|
+
},
|
|
17168
|
+
text: {
|
|
17169
|
+
value: value,
|
|
17170
|
+
enumerable: true
|
|
17171
|
+
}
|
|
17172
|
+
});
|
|
17173
|
+
}
|
|
17174
|
+
else {
|
|
17175
|
+
items = value;
|
|
17176
|
+
}
|
|
17177
|
+
return items;
|
|
17178
|
+
};
|
|
17179
|
+
Mention.prototype.setValue = function (e) {
|
|
17180
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
17181
|
+
if (!this.isReact) {
|
|
17182
|
+
if (!isNullOrUndefined(this.displayTemplate)) {
|
|
17183
|
+
this.setDisplayTemplate();
|
|
17184
|
+
}
|
|
17185
|
+
this.updateMentionValue(e);
|
|
17186
|
+
return true;
|
|
17187
|
+
}
|
|
17188
|
+
else {
|
|
17189
|
+
if (!isNullOrUndefined(this.displayTemplate)) {
|
|
17190
|
+
this.setDisplayTemplate(e);
|
|
17191
|
+
}
|
|
17192
|
+
else {
|
|
17193
|
+
this.updateMentionValue(e);
|
|
17194
|
+
}
|
|
17195
|
+
return true;
|
|
17196
|
+
}
|
|
17197
|
+
};
|
|
17198
|
+
Mention.prototype.updateMentionValue = function (e) {
|
|
17199
|
+
var dataItem = this.getItemData();
|
|
17200
|
+
var textSuffix;
|
|
17201
|
+
var value;
|
|
17202
|
+
var endPos;
|
|
17203
|
+
var range;
|
|
17204
|
+
var globalRange;
|
|
17205
|
+
var selection = this.inputElement.ownerDocument.getSelection();
|
|
17206
|
+
var startPos = this.getTriggerCharPosition();
|
|
17207
|
+
textSuffix = typeof this.suffixText === 'string' ? this.suffixText : '';
|
|
17208
|
+
if (dataItem.text !== null) {
|
|
17209
|
+
value = this.mentionVal(dataItem.text);
|
|
17210
|
+
}
|
|
17211
|
+
if (!this.isContentEditable(this.inputElement)) {
|
|
17212
|
+
var myField = this.inputElement;
|
|
17213
|
+
var currentTriggerSnippet = this.getTextRange().substring(startPos + this.mentionChar.length, this.getTextRange().length);
|
|
17214
|
+
value += textSuffix;
|
|
17215
|
+
endPos = startPos + this.mentionChar.length;
|
|
17216
|
+
endPos += currentTriggerSnippet.length;
|
|
17217
|
+
myField.value = myField.value.substring(0, startPos) + value + myField.value.substring(endPos, myField.value.length);
|
|
17218
|
+
myField.selectionStart = startPos + value.length;
|
|
17219
|
+
myField.selectionEnd = startPos + value.length;
|
|
17220
|
+
if (this.isPopupOpen) {
|
|
17221
|
+
this.hidePopup();
|
|
17222
|
+
}
|
|
17223
|
+
this.onChangeEvent(e);
|
|
17224
|
+
}
|
|
17225
|
+
else {
|
|
17226
|
+
endPos = this.getTriggerCharPosition() + this.mentionChar.length;
|
|
17227
|
+
if (this.range && (this.range.startContainer.textContent.trim() !== this.mentionChar)) {
|
|
17228
|
+
endPos = this.range.endOffset;
|
|
17229
|
+
}
|
|
17230
|
+
globalRange = this.range;
|
|
17231
|
+
range = document.createRange();
|
|
17232
|
+
range.setStart(globalRange.startContainer, startPos);
|
|
17233
|
+
range.setEnd(globalRange.startContainer, endPos);
|
|
17234
|
+
range.deleteContents();
|
|
17235
|
+
var element = this.createElement('div');
|
|
17236
|
+
element.innerHTML = value;
|
|
17237
|
+
var frag = document.createDocumentFragment();
|
|
17238
|
+
var node = void 0;
|
|
17239
|
+
var lastNode = void 0;
|
|
17240
|
+
// eslint-disable-next-line no-cond-assign
|
|
17241
|
+
while (node = element.firstChild) {
|
|
17242
|
+
lastNode = frag.appendChild(node);
|
|
17243
|
+
}
|
|
17244
|
+
range.insertNode(frag);
|
|
17245
|
+
if (lastNode) {
|
|
17246
|
+
range = range.cloneRange();
|
|
17247
|
+
range.setStartAfter(lastNode);
|
|
17248
|
+
range.collapse(true);
|
|
17249
|
+
selection.removeAllRanges();
|
|
17250
|
+
selection.addRange(range);
|
|
17251
|
+
}
|
|
17252
|
+
if (this.isPopupOpen) {
|
|
17253
|
+
this.hidePopup();
|
|
17254
|
+
}
|
|
17255
|
+
this.onChangeEvent(e);
|
|
17256
|
+
}
|
|
17257
|
+
};
|
|
17258
|
+
Mention.prototype.mentionVal = function (value) {
|
|
17259
|
+
var showChar = this.showMentionChar ? this.mentionChar : '';
|
|
17260
|
+
if (!isNullOrUndefined(this.displayTemplate) && !isNullOrUndefined(this.displayTempElement)) {
|
|
17261
|
+
value = this.displayTempElement.innerHTML;
|
|
17262
|
+
}
|
|
17263
|
+
if (this.isContentEditable(this.inputElement)) {
|
|
17264
|
+
return '<span contenteditable="false" class="e-mention-chip">' + showChar + value + '</span>'.concat(typeof this.suffixText === 'string' ? this.suffixText : ' ');
|
|
17265
|
+
}
|
|
17266
|
+
else {
|
|
17267
|
+
return showChar + value;
|
|
17268
|
+
}
|
|
17269
|
+
};
|
|
17270
|
+
Mention.prototype.setDisplayTemplate = function (e) {
|
|
17271
|
+
var _this = this;
|
|
17272
|
+
var compiledString;
|
|
17273
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
17274
|
+
if (this.isReact) {
|
|
17275
|
+
this.clearTemplate(['displayTemplate']);
|
|
17276
|
+
if (this.displayTempElement) {
|
|
17277
|
+
detach(this.displayTempElement);
|
|
17278
|
+
this.displayTempElement = null;
|
|
17279
|
+
}
|
|
17280
|
+
}
|
|
17281
|
+
if (!this.displayTempElement) {
|
|
17282
|
+
this.displayTempElement = this.createElement('div');
|
|
17283
|
+
}
|
|
17284
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
17285
|
+
if (!this.isReact) {
|
|
17286
|
+
this.displayTempElement.innerHTML = '';
|
|
17287
|
+
}
|
|
17288
|
+
compiledString = compile(this.displayTemplate);
|
|
17289
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
17290
|
+
var displayCompTemp = compiledString(this.itemData, this, 'displayTemplate', this.displayTemplateId, this.isStringTemplate, null, this.displayTempElement);
|
|
17291
|
+
if (displayCompTemp && displayCompTemp.length > 0) {
|
|
17292
|
+
for (var i = 0; i < displayCompTemp.length; i++) {
|
|
17293
|
+
this.displayTempElement.appendChild(displayCompTemp[i]);
|
|
17294
|
+
}
|
|
17295
|
+
}
|
|
17296
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
17297
|
+
if (!this.isReact) {
|
|
17298
|
+
this.renderTemplates();
|
|
17299
|
+
}
|
|
17300
|
+
else {
|
|
17301
|
+
this.renderTemplates(function () {
|
|
17302
|
+
_this.updateMentionValue(e);
|
|
17303
|
+
});
|
|
17304
|
+
}
|
|
17305
|
+
};
|
|
17306
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
17307
|
+
Mention.prototype.renderTemplates = function (callBack) {
|
|
17308
|
+
this.renderReactTemplates(callBack);
|
|
17309
|
+
};
|
|
17310
|
+
Mention.prototype.setSpinnerTemplate = function () {
|
|
17311
|
+
var _this = this;
|
|
17312
|
+
var compiledString;
|
|
17313
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
17314
|
+
if (this.isReact) {
|
|
17315
|
+
this.clearTemplate(['spinnerTemplate']);
|
|
17316
|
+
if (this.spinnerTemplateElement) {
|
|
17317
|
+
detach(this.spinnerTemplateElement);
|
|
17318
|
+
this.spinnerTemplateElement = null;
|
|
17319
|
+
}
|
|
17320
|
+
}
|
|
17321
|
+
if (!this.spinnerTemplateElement) {
|
|
17322
|
+
this.spinnerTemplateElement = this.createElement('div');
|
|
17323
|
+
}
|
|
17324
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
17325
|
+
if (!this.isReact) {
|
|
17326
|
+
this.spinnerTemplateElement.innerHTML = '';
|
|
17327
|
+
}
|
|
17328
|
+
compiledString = compile(this.spinnerTemplate);
|
|
17329
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
17330
|
+
var spinnerCompTemp = compiledString(null, this, 'spinnerTemplate', this.spinnerTemplateId, this.isStringTemplate, null, this.spinnerTemplateElement);
|
|
17331
|
+
if (spinnerCompTemp && spinnerCompTemp.length > 0) {
|
|
17332
|
+
for (var i = 0; i < spinnerCompTemp.length; i++) {
|
|
17333
|
+
this.spinnerTemplateElement.appendChild(spinnerCompTemp[i]);
|
|
17334
|
+
}
|
|
17335
|
+
}
|
|
17336
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
17337
|
+
if (!this.isReact) {
|
|
17338
|
+
this.renderTemplates();
|
|
17339
|
+
this.popupObj.element.appendChild(this.spinnerTemplateElement);
|
|
17340
|
+
}
|
|
17341
|
+
else {
|
|
17342
|
+
this.renderTemplates(function () {
|
|
17343
|
+
_this.popupObj.element.appendChild(_this.spinnerTemplateElement);
|
|
17344
|
+
});
|
|
17345
|
+
}
|
|
17346
|
+
};
|
|
17347
|
+
Mention.prototype.onChangeEvent = function (eve) {
|
|
17348
|
+
this.isSelected = false;
|
|
17349
|
+
var items = this.detachMentionChanges(this.itemData);
|
|
17350
|
+
var preItems;
|
|
17351
|
+
if (typeof this.previousItemData === 'string' ||
|
|
17352
|
+
typeof this.previousItemData === 'boolean' ||
|
|
17353
|
+
typeof this.previousItemData === 'number') {
|
|
17354
|
+
preItems = Object.defineProperties({}, {
|
|
17355
|
+
value: {
|
|
17356
|
+
value: this.previousItemData,
|
|
17357
|
+
enumerable: true
|
|
17358
|
+
},
|
|
17359
|
+
text: {
|
|
17360
|
+
value: this.previousItemData,
|
|
17361
|
+
enumerable: true
|
|
17362
|
+
}
|
|
17363
|
+
});
|
|
17364
|
+
}
|
|
17365
|
+
else {
|
|
17366
|
+
preItems = this.previousItemData;
|
|
17367
|
+
}
|
|
17368
|
+
var eventArgs = {
|
|
17369
|
+
e: eve,
|
|
17370
|
+
item: this.item,
|
|
17371
|
+
itemData: items,
|
|
17372
|
+
previousItem: this.previousSelectedLI,
|
|
17373
|
+
previousItemData: preItems,
|
|
17374
|
+
isInteracted: eve ? true : false,
|
|
17375
|
+
value: this.item.innerHTML,
|
|
17376
|
+
element: this.inputElement
|
|
17377
|
+
};
|
|
17378
|
+
this.trigger('change', eventArgs);
|
|
17379
|
+
};
|
|
17380
|
+
Mention.prototype.detachMentionChanges = function (value) {
|
|
17381
|
+
var items;
|
|
17382
|
+
if (typeof value === 'string' ||
|
|
17383
|
+
typeof value === 'boolean' ||
|
|
17384
|
+
typeof value === 'number') {
|
|
17385
|
+
items = Object.defineProperties({}, {
|
|
17386
|
+
value: {
|
|
17387
|
+
value: value,
|
|
17388
|
+
enumerable: true
|
|
17389
|
+
},
|
|
17390
|
+
text: {
|
|
17391
|
+
value: value,
|
|
17392
|
+
enumerable: true
|
|
17393
|
+
}
|
|
17394
|
+
});
|
|
17395
|
+
}
|
|
17396
|
+
else {
|
|
17397
|
+
items = value;
|
|
17398
|
+
}
|
|
17399
|
+
return items;
|
|
17400
|
+
};
|
|
17401
|
+
Mention.prototype.getItemData = function () {
|
|
17402
|
+
var fields = this.fields;
|
|
17403
|
+
var dataItem = null;
|
|
17404
|
+
dataItem = this.itemData;
|
|
17405
|
+
var dataValue;
|
|
17406
|
+
var dataText;
|
|
17407
|
+
if (!isNullOrUndefined(dataItem)) {
|
|
17408
|
+
dataValue = getValue(fields.value, dataItem);
|
|
17409
|
+
dataText = getValue(fields.text, dataItem);
|
|
17410
|
+
}
|
|
17411
|
+
var value = (!isNullOrUndefined(dataItem) &&
|
|
17412
|
+
!isUndefined(dataValue) ? dataValue : dataItem);
|
|
17413
|
+
var text = (!isNullOrUndefined(dataItem) &&
|
|
17414
|
+
!isUndefined(dataValue) ? dataText : dataItem);
|
|
17415
|
+
return { value: value, text: text };
|
|
17416
|
+
};
|
|
17417
|
+
Mention.prototype.removeSelection = function () {
|
|
17418
|
+
if (this.list) {
|
|
17419
|
+
var selectedItems = this.list.querySelectorAll('.' + dropDownBaseClasses.selected);
|
|
17420
|
+
if (selectedItems.length) {
|
|
17421
|
+
removeClass(selectedItems, dropDownBaseClasses.selected);
|
|
17422
|
+
selectedItems[0].removeAttribute('aria-selected');
|
|
17423
|
+
}
|
|
17424
|
+
}
|
|
17425
|
+
};
|
|
17426
|
+
Mention.prototype.onMouseOver = function (e) {
|
|
17427
|
+
var currentLi = closest(e.target, '.' + dropDownBaseClasses.li);
|
|
17428
|
+
this.setHover(currentLi);
|
|
17429
|
+
};
|
|
17430
|
+
Mention.prototype.setHover = function (li) {
|
|
17431
|
+
if (this.isValidLI(li) && !li.classList.contains(dropDownBaseClasses.hover)) {
|
|
17432
|
+
this.removeHover();
|
|
17433
|
+
addClass([li], dropDownBaseClasses.hover);
|
|
17434
|
+
}
|
|
17435
|
+
};
|
|
17436
|
+
Mention.prototype.removeHover = function () {
|
|
17437
|
+
if (this.list) {
|
|
17438
|
+
var hoveredItem = this.list.querySelectorAll('.' + dropDownBaseClasses.hover);
|
|
17439
|
+
if (hoveredItem && hoveredItem.length) {
|
|
17440
|
+
removeClass(hoveredItem, dropDownBaseClasses.hover);
|
|
17441
|
+
}
|
|
17442
|
+
}
|
|
17443
|
+
};
|
|
17444
|
+
Mention.prototype.isValidLI = function (li) {
|
|
17445
|
+
return (li && li.hasAttribute('role') && li.getAttribute('role') === 'option');
|
|
17446
|
+
};
|
|
17447
|
+
Mention.prototype.onMouseLeave = function () {
|
|
17448
|
+
this.removeHover();
|
|
17449
|
+
};
|
|
17450
|
+
/**
|
|
17451
|
+
* Search the entered text and show it in the suggestion list if available.
|
|
17452
|
+
*
|
|
17453
|
+
* @returns {void}
|
|
17454
|
+
*/
|
|
17455
|
+
Mention.prototype.search = function (text, positionX, positionY) {
|
|
17456
|
+
if (this.isContentEditable(this.inputElement)) {
|
|
17457
|
+
this.range = this.getCurrentRange();
|
|
17458
|
+
}
|
|
17459
|
+
var currentRange = this.getTextRange();
|
|
17460
|
+
var lastWordRange = this.getLastLetter(currentRange);
|
|
17461
|
+
if ((this.ignoreCase && (text === lastWordRange || text === lastWordRange.toLowerCase()))
|
|
17462
|
+
|| !this.ignoreCase && text === lastWordRange) {
|
|
17463
|
+
this.resetList(this.dataSource, this.fields);
|
|
17464
|
+
}
|
|
17465
|
+
else {
|
|
17466
|
+
if (this.isPopupOpen) {
|
|
17467
|
+
this.hidePopup();
|
|
17468
|
+
}
|
|
17469
|
+
return;
|
|
17470
|
+
}
|
|
17471
|
+
if (isNullOrUndefined(this.list)) {
|
|
17472
|
+
this.renderList();
|
|
17473
|
+
this.renderPopup();
|
|
17474
|
+
}
|
|
17475
|
+
else {
|
|
17476
|
+
this.showPopup();
|
|
17477
|
+
}
|
|
17478
|
+
this.popupObj.element.style.left = formatUnit(positionX);
|
|
17479
|
+
this.popupObj.element.style.top = formatUnit(positionY);
|
|
17480
|
+
};
|
|
17481
|
+
/**
|
|
17482
|
+
* Removes the component from the DOM and detaches all its related event handlers. Also it removes the attributes and classes.
|
|
17483
|
+
*
|
|
17484
|
+
* @method destroy
|
|
17485
|
+
* @returns {void}
|
|
17486
|
+
*/
|
|
17487
|
+
Mention.prototype.destroy = function () {
|
|
17488
|
+
this.hidePopup();
|
|
17489
|
+
this.unWireEvent();
|
|
17490
|
+
if (this.list) {
|
|
17491
|
+
this.unWireListEvents();
|
|
17492
|
+
}
|
|
17493
|
+
if (this.inputElement && !this.inputElement.classList.contains('e-' + this.getModuleName())) {
|
|
17494
|
+
return;
|
|
17495
|
+
}
|
|
17496
|
+
_super.prototype.destroy.call(this);
|
|
17497
|
+
};
|
|
17498
|
+
Mention.prototype.getLocaleName = function () {
|
|
17499
|
+
return 'mention';
|
|
17500
|
+
};
|
|
17501
|
+
Mention.prototype.getNgDirective = function () {
|
|
17502
|
+
return 'EJS-MENTION';
|
|
17503
|
+
};
|
|
17504
|
+
/**
|
|
17505
|
+
* Return the module name of this component.
|
|
17506
|
+
*
|
|
17507
|
+
* @private
|
|
17508
|
+
* @returns {string} Return the module name of this component.
|
|
17509
|
+
*/
|
|
17510
|
+
Mention.prototype.getModuleName = function () {
|
|
17511
|
+
return 'mention';
|
|
17512
|
+
};
|
|
17513
|
+
__decorate$7([
|
|
17514
|
+
Property(null)
|
|
17515
|
+
], Mention.prototype, "cssClass", void 0);
|
|
17516
|
+
__decorate$7([
|
|
17517
|
+
Property('@')
|
|
17518
|
+
], Mention.prototype, "mentionChar", void 0);
|
|
17519
|
+
__decorate$7([
|
|
17520
|
+
Property(false)
|
|
17521
|
+
], Mention.prototype, "showMentionChar", void 0);
|
|
17522
|
+
__decorate$7([
|
|
17523
|
+
Property(false)
|
|
17524
|
+
], Mention.prototype, "allowSpaces", void 0);
|
|
17525
|
+
__decorate$7([
|
|
17526
|
+
Property(null)
|
|
17527
|
+
], Mention.prototype, "suffixText", void 0);
|
|
17528
|
+
__decorate$7([
|
|
17529
|
+
Property(25)
|
|
17530
|
+
], Mention.prototype, "suggestionCount", void 0);
|
|
17531
|
+
__decorate$7([
|
|
17532
|
+
Property(0)
|
|
17533
|
+
], Mention.prototype, "minLength", void 0);
|
|
17534
|
+
__decorate$7([
|
|
17535
|
+
Property('None')
|
|
17536
|
+
], Mention.prototype, "sortOrder", void 0);
|
|
17537
|
+
__decorate$7([
|
|
17538
|
+
Property(true)
|
|
17539
|
+
], Mention.prototype, "ignoreCase", void 0);
|
|
17540
|
+
__decorate$7([
|
|
17541
|
+
Property(false)
|
|
17542
|
+
], Mention.prototype, "highlight", void 0);
|
|
17543
|
+
__decorate$7([
|
|
17544
|
+
Property()
|
|
17545
|
+
], Mention.prototype, "locale", void 0);
|
|
17546
|
+
__decorate$7([
|
|
17547
|
+
Property('auto')
|
|
17548
|
+
], Mention.prototype, "popupWidth", void 0);
|
|
17549
|
+
__decorate$7([
|
|
17550
|
+
Property('300px')
|
|
17551
|
+
], Mention.prototype, "popupHeight", void 0);
|
|
17552
|
+
__decorate$7([
|
|
17553
|
+
Property(null)
|
|
17554
|
+
], Mention.prototype, "displayTemplate", void 0);
|
|
17555
|
+
__decorate$7([
|
|
17556
|
+
Property(null)
|
|
17557
|
+
], Mention.prototype, "itemTemplate", void 0);
|
|
17558
|
+
__decorate$7([
|
|
17559
|
+
Property('No records found')
|
|
17560
|
+
], Mention.prototype, "noRecordsTemplate", void 0);
|
|
17561
|
+
__decorate$7([
|
|
17562
|
+
Property(null)
|
|
17563
|
+
], Mention.prototype, "spinnerTemplate", void 0);
|
|
17564
|
+
__decorate$7([
|
|
17565
|
+
Property()
|
|
17566
|
+
], Mention.prototype, "target", void 0);
|
|
17567
|
+
__decorate$7([
|
|
17568
|
+
Property([])
|
|
17569
|
+
], Mention.prototype, "dataSource", void 0);
|
|
17570
|
+
__decorate$7([
|
|
17571
|
+
Property(null)
|
|
17572
|
+
], Mention.prototype, "query", void 0);
|
|
17573
|
+
__decorate$7([
|
|
17574
|
+
Property('Contains')
|
|
17575
|
+
], Mention.prototype, "filterType", void 0);
|
|
17576
|
+
__decorate$7([
|
|
17577
|
+
Complex({ text: null, value: null, iconCss: null, groupBy: null }, FieldSettings)
|
|
17578
|
+
], Mention.prototype, "fields", void 0);
|
|
17579
|
+
__decorate$7([
|
|
17580
|
+
Event()
|
|
17581
|
+
], Mention.prototype, "actionBegin", void 0);
|
|
17582
|
+
__decorate$7([
|
|
17583
|
+
Event()
|
|
17584
|
+
], Mention.prototype, "actionComplete", void 0);
|
|
17585
|
+
__decorate$7([
|
|
17586
|
+
Event()
|
|
17587
|
+
], Mention.prototype, "actionFailure", void 0);
|
|
17588
|
+
__decorate$7([
|
|
17589
|
+
Event()
|
|
17590
|
+
], Mention.prototype, "change", void 0);
|
|
17591
|
+
__decorate$7([
|
|
17592
|
+
Event()
|
|
17593
|
+
], Mention.prototype, "beforeOpen", void 0);
|
|
17594
|
+
__decorate$7([
|
|
17595
|
+
Event()
|
|
17596
|
+
], Mention.prototype, "opened", void 0);
|
|
17597
|
+
__decorate$7([
|
|
17598
|
+
Event()
|
|
17599
|
+
], Mention.prototype, "closed", void 0);
|
|
17600
|
+
__decorate$7([
|
|
17601
|
+
Event()
|
|
17602
|
+
], Mention.prototype, "select", void 0);
|
|
17603
|
+
__decorate$7([
|
|
17604
|
+
Event()
|
|
17605
|
+
], Mention.prototype, "filtering", void 0);
|
|
17606
|
+
__decorate$7([
|
|
17607
|
+
Event()
|
|
17608
|
+
], Mention.prototype, "created", void 0);
|
|
17609
|
+
__decorate$7([
|
|
17610
|
+
Event()
|
|
17611
|
+
], Mention.prototype, "destroyed", void 0);
|
|
17612
|
+
Mention = __decorate$7([
|
|
17613
|
+
NotifyPropertyChanges
|
|
17614
|
+
], Mention);
|
|
17615
|
+
return Mention;
|
|
17616
|
+
}(DropDownBase));
|
|
17617
|
+
|
|
15808
17618
|
/**
|
|
15809
17619
|
* export all modules from current location
|
|
15810
17620
|
*/
|
|
@@ -15813,5 +17623,5 @@ var listBoxClasses = {
|
|
|
15813
17623
|
* export all modules from current location
|
|
15814
17624
|
*/
|
|
15815
17625
|
|
|
15816
|
-
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 };
|
|
17626
|
+
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 };
|
|
15817
17627
|
//# sourceMappingURL=ej2-dropdowns.es5.js.map
|