@syncfusion/ej2-dropdowns 24.1.44 → 24.1.45-12082
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/CHANGELOG.md +2101 -2083
- package/{README.md → ReadMe.md} +217 -217
- package/dist/ej2-dropdowns.min.js +1 -10
- 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 +74 -68
- package/dist/es6/ej2-dropdowns.es2015.js.map +1 -1
- package/dist/es6/ej2-dropdowns.es5.js +216 -210
- 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/dist/ts/auto-complete/auto-complete.ts +623 -0
- package/dist/ts/combo-box/combo-box.ts +1099 -0
- package/dist/ts/common/highlight-search.ts +57 -0
- package/dist/ts/common/incremental-search.ts +172 -0
- package/dist/ts/common/interface.ts +74 -0
- package/dist/ts/common/virtual-scroll.ts +388 -0
- package/dist/ts/drop-down-base/drop-down-base.ts +1986 -0
- package/dist/ts/drop-down-list/drop-down-list.ts +4261 -0
- package/dist/ts/drop-down-tree/drop-down-tree.ts +3747 -0
- package/dist/ts/list-box/list-box.ts +2772 -0
- package/dist/ts/mention/mention.ts +1875 -0
- package/dist/ts/multi-select/checkbox-selection.ts +550 -0
- package/dist/ts/multi-select/float-label.ts +176 -0
- package/dist/ts/multi-select/interface.ts +70 -0
- package/dist/ts/multi-select/multi-select.ts +4882 -0
- package/helpers/e2e/autocomplete.js +13 -13
- package/helpers/e2e/combobox.js +13 -13
- package/helpers/e2e/dropdownlist.js +13 -13
- package/helpers/e2e/index.js +3 -3
- package/helpers/e2e/listboxHelper.js +13 -13
- package/helpers/e2e/multiselect.js +13 -13
- package/license +2 -2
- package/package.json +80 -80
- package/src/auto-complete/auto-complete-model.d.ts +188 -188
- package/src/auto-complete/auto-complete.d.ts +12 -12
- package/src/auto-complete/auto-complete.js +21 -21
- package/src/combo-box/combo-box-model.d.ts +224 -224
- package/src/combo-box/combo-box.d.ts +27 -27
- package/src/combo-box/combo-box.js +29 -29
- package/src/common/virtual-scroll.js +46 -46
- package/src/drop-down-base/drop-down-base-model.d.ts +200 -200
- package/src/drop-down-base/drop-down-base.d.ts +16 -16
- package/src/drop-down-base/drop-down-base.js +20 -20
- package/src/drop-down-list/drop-down-list-model.d.ts +202 -202
- package/src/drop-down-list/drop-down-list.d.ts +5 -4
- package/src/drop-down-list/drop-down-list.js +29 -22
- package/src/drop-down-tree/drop-down-tree-model.d.ts +468 -468
- package/src/drop-down-tree/drop-down-tree.d.ts +0 -1
- package/src/drop-down-tree/drop-down-tree.js +19 -27
- package/src/list-box/list-box-model.d.ts +193 -193
- package/src/list-box/list-box.d.ts +2 -2
- package/src/list-box/list-box.js +19 -19
- package/src/mention/mention-model.d.ts +261 -261
- package/src/mention/mention.js +27 -20
- package/src/multi-select/multi-select-model.d.ts +512 -512
- package/src/multi-select/multi-select.js +20 -20
- package/styles/auto-complete/_all.scss +1 -1
- package/styles/auto-complete/_bds-definition.scss +2 -0
- package/styles/auto-complete/_bootstrap-dark-definition.scss +3 -3
- package/styles/auto-complete/_bootstrap-definition.scss +2 -2
- package/styles/auto-complete/_bootstrap4-definition.scss +11 -11
- package/styles/auto-complete/_bootstrap5-definition.scss +2 -2
- package/styles/auto-complete/_fabric-dark-definition.scss +2 -2
- package/styles/auto-complete/_fabric-definition.scss +2 -2
- package/styles/auto-complete/_fluent-definition.scss +2 -2
- package/styles/auto-complete/_fusionnew-definition.scss +2 -2
- package/styles/auto-complete/_highcontrast-definition.scss +2 -2
- package/styles/auto-complete/_highcontrast-light-definition.scss +2 -2
- package/styles/auto-complete/_material-dark-definition.scss +2 -2
- package/styles/auto-complete/_material-definition.scss +2 -2
- package/styles/auto-complete/_material3-definition.scss +2 -2
- package/styles/auto-complete/_tailwind-definition.scss +2 -2
- package/styles/auto-complete/material3-dark.scss +1 -1
- package/styles/auto-complete/material3.scss +1 -1
- package/styles/bootstrap-dark.css +5 -0
- package/styles/bootstrap.css +5 -0
- package/styles/bootstrap4.css +5 -0
- package/styles/bootstrap5-dark.css +5 -0
- package/styles/bootstrap5.css +5 -0
- package/styles/combo-box/_all.scss +1 -1
- package/styles/combo-box/_bds-definition.scss +2 -0
- package/styles/combo-box/_bootstrap-dark-definition.scss +2 -2
- package/styles/combo-box/_bootstrap-definition.scss +2 -2
- package/styles/combo-box/_bootstrap4-definition.scss +11 -11
- package/styles/combo-box/_bootstrap5-definition.scss +2 -2
- package/styles/combo-box/_fabric-dark-definition.scss +2 -2
- package/styles/combo-box/_fabric-definition.scss +2 -2
- package/styles/combo-box/_fluent-definition.scss +2 -2
- package/styles/combo-box/_fusionnew-definition.scss +2 -2
- package/styles/combo-box/_highcontrast-definition.scss +2 -2
- package/styles/combo-box/_highcontrast-light-definition.scss +3 -3
- package/styles/combo-box/_material-dark-definition.scss +2 -2
- package/styles/combo-box/_material-definition.scss +2 -2
- package/styles/combo-box/_material3-definition.scss +2 -2
- package/styles/combo-box/_tailwind-definition.scss +2 -2
- package/styles/combo-box/material3-dark.scss +1 -1
- package/styles/combo-box/material3.scss +1 -1
- package/styles/drop-down-base/_all.scss +2 -2
- package/styles/drop-down-base/_bds-definition.scss +129 -0
- package/styles/drop-down-base/_bootstrap-dark-definition.scss +83 -83
- package/styles/drop-down-base/_bootstrap-definition.scss +83 -83
- package/styles/drop-down-base/_bootstrap4-definition.scss +90 -90
- package/styles/drop-down-base/_bootstrap5-definition.scss +117 -117
- package/styles/drop-down-base/_definition.scss +23 -23
- package/styles/drop-down-base/_fabric-dark-definition.scss +86 -86
- package/styles/drop-down-base/_fabric-definition.scss +84 -84
- package/styles/drop-down-base/_fluent-definition.scss +121 -121
- package/styles/drop-down-base/_fusionnew-definition.scss +117 -117
- package/styles/drop-down-base/_highcontrast-definition.scss +105 -105
- package/styles/drop-down-base/_highcontrast-light-definition.scss +105 -105
- package/styles/drop-down-base/_layout.scss +192 -192
- package/styles/drop-down-base/_material-dark-definition.scss +86 -86
- package/styles/drop-down-base/_material-definition.scss +85 -85
- package/styles/drop-down-base/_material3-definition.scss +87 -87
- package/styles/drop-down-base/_tailwind-definition.scss +129 -129
- package/styles/drop-down-base/_theme.scss +391 -391
- package/styles/drop-down-base/material3-dark.scss +1 -1
- package/styles/drop-down-base/material3.scss +1 -1
- package/styles/drop-down-list/_all.scss +3 -3
- package/styles/drop-down-list/_bds-definition.scss +134 -0
- package/styles/drop-down-list/_bootstrap-dark-definition.scss +157 -157
- package/styles/drop-down-list/_bootstrap-definition.scss +156 -156
- package/styles/drop-down-list/_bootstrap4-definition.scss +202 -202
- package/styles/drop-down-list/_bootstrap5-definition.scss +201 -201
- package/styles/drop-down-list/_fabric-dark-definition.scss +128 -128
- package/styles/drop-down-list/_fabric-definition.scss +124 -124
- package/styles/drop-down-list/_fluent-definition.scss +185 -185
- package/styles/drop-down-list/_fusionnew-definition.scss +201 -201
- package/styles/drop-down-list/_highcontrast-definition.scss +142 -142
- package/styles/drop-down-list/_highcontrast-light-definition.scss +144 -144
- package/styles/drop-down-list/_layout.scss +315 -310
- package/styles/drop-down-list/_material-dark-definition.scss +143 -143
- package/styles/drop-down-list/_material-definition.scss +167 -167
- package/styles/drop-down-list/_material3-definition.scss +180 -180
- package/styles/drop-down-list/_tailwind-definition.scss +134 -134
- package/styles/drop-down-list/_theme.scss +10 -10
- package/styles/drop-down-list/bootstrap-dark.css +5 -0
- package/styles/drop-down-list/bootstrap.css +5 -0
- package/styles/drop-down-list/bootstrap4.css +5 -0
- package/styles/drop-down-list/bootstrap5-dark.css +5 -0
- package/styles/drop-down-list/bootstrap5.css +5 -0
- package/styles/drop-down-list/fabric-dark.css +5 -0
- package/styles/drop-down-list/fabric.css +5 -0
- package/styles/drop-down-list/fluent-dark.css +5 -0
- package/styles/drop-down-list/fluent.css +5 -0
- package/styles/drop-down-list/highcontrast-light.css +5 -0
- package/styles/drop-down-list/highcontrast.css +5 -0
- package/styles/drop-down-list/icons/_bootstrap-dark.scss +14 -14
- package/styles/drop-down-list/icons/_bootstrap.scss +14 -14
- package/styles/drop-down-list/icons/_bootstrap4.scss +14 -14
- package/styles/drop-down-list/icons/_bootstrap5.scss +14 -14
- package/styles/drop-down-list/icons/_fabric-dark.scss +14 -14
- package/styles/drop-down-list/icons/_fabric.scss +14 -14
- package/styles/drop-down-list/icons/_fluent.scss +14 -14
- package/styles/drop-down-list/icons/_fusionnew.scss +14 -14
- package/styles/drop-down-list/icons/_highcontrast-light.scss +14 -14
- package/styles/drop-down-list/icons/_highcontrast.scss +14 -14
- package/styles/drop-down-list/icons/_material-dark.scss +14 -14
- package/styles/drop-down-list/icons/_material.scss +14 -14
- package/styles/drop-down-list/icons/_material3.scss +14 -14
- package/styles/drop-down-list/icons/_tailwind.scss +14 -14
- package/styles/drop-down-list/material-dark.css +5 -0
- package/styles/drop-down-list/material.css +5 -0
- package/styles/drop-down-list/material3-dark.css +5 -0
- package/styles/drop-down-list/material3-dark.scss +1 -1
- package/styles/drop-down-list/material3.css +5 -0
- package/styles/drop-down-list/material3.scss +1 -1
- package/styles/drop-down-list/tailwind-dark.css +5 -0
- package/styles/drop-down-list/tailwind.css +5 -0
- package/styles/drop-down-tree/_all.scss +2 -2
- package/styles/drop-down-tree/_bds-definition.scss +61 -0
- package/styles/drop-down-tree/_bootstrap-dark-definition.scss +71 -71
- package/styles/drop-down-tree/_bootstrap-definition.scss +70 -70
- package/styles/drop-down-tree/_bootstrap4-definition.scss +71 -71
- package/styles/drop-down-tree/_bootstrap5-definition.scss +59 -59
- package/styles/drop-down-tree/_fabric-dark-definition.scss +71 -71
- package/styles/drop-down-tree/_fabric-definition.scss +71 -71
- package/styles/drop-down-tree/_fluent-definition.scss +65 -65
- package/styles/drop-down-tree/_fusionnew-definition.scss +59 -59
- package/styles/drop-down-tree/_highcontrast-definition.scss +71 -71
- package/styles/drop-down-tree/_highcontrast-light-definition.scss +71 -71
- package/styles/drop-down-tree/_layout.scss +1423 -1423
- package/styles/drop-down-tree/_material-dark-definition.scss +72 -72
- package/styles/drop-down-tree/_material-definition.scss +72 -72
- package/styles/drop-down-tree/_material3-definition.scss +76 -76
- package/styles/drop-down-tree/_tailwind-definition.scss +61 -61
- package/styles/drop-down-tree/_theme.scss +132 -132
- package/styles/drop-down-tree/icons/_bootstrap-dark.scss +11 -11
- package/styles/drop-down-tree/icons/_bootstrap.scss +11 -11
- package/styles/drop-down-tree/icons/_bootstrap4.scss +11 -11
- package/styles/drop-down-tree/icons/_bootstrap5.scss +11 -11
- package/styles/drop-down-tree/icons/_fabric-dark.scss +11 -11
- package/styles/drop-down-tree/icons/_fabric.scss +11 -11
- package/styles/drop-down-tree/icons/_fluent.scss +11 -11
- package/styles/drop-down-tree/icons/_fusionnew.scss +11 -11
- package/styles/drop-down-tree/icons/_highcontrast-light.scss +11 -11
- package/styles/drop-down-tree/icons/_highcontrast.scss +11 -11
- package/styles/drop-down-tree/icons/_material-dark.scss +11 -11
- package/styles/drop-down-tree/icons/_material.scss +11 -11
- package/styles/drop-down-tree/icons/_material3.scss +11 -11
- package/styles/drop-down-tree/icons/_tailwind-dark.scss +11 -11
- package/styles/drop-down-tree/icons/_tailwind.scss +11 -11
- package/styles/drop-down-tree/material3-dark.scss +1 -1
- package/styles/drop-down-tree/material3.scss +1 -1
- package/styles/fabric-dark.css +5 -0
- package/styles/fabric.css +5 -0
- package/styles/fluent-dark.css +5 -0
- package/styles/fluent.css +5 -0
- package/styles/highcontrast-light.css +5 -0
- package/styles/highcontrast.css +5 -0
- package/styles/list-box/_all.scss +2 -2
- package/styles/list-box/_bds-definition.scss +119 -0
- package/styles/list-box/_bootstrap-dark-definition.scss +126 -126
- package/styles/list-box/_bootstrap-definition.scss +119 -119
- package/styles/list-box/_bootstrap4-definition.scss +124 -124
- package/styles/list-box/_bootstrap5-definition.scss +120 -120
- package/styles/list-box/_fabric-dark-definition.scss +126 -126
- package/styles/list-box/_fabric-definition.scss +119 -119
- package/styles/list-box/_fluent-definition.scss +120 -120
- package/styles/list-box/_fusionnew-definition.scss +111 -111
- package/styles/list-box/_highcontrast-definition.scss +119 -119
- package/styles/list-box/_highcontrast-light-definition.scss +126 -126
- package/styles/list-box/_layout.scss +542 -542
- package/styles/list-box/_material-dark-definition.scss +126 -126
- package/styles/list-box/_material-definition.scss +119 -119
- package/styles/list-box/_material3-definition.scss +119 -119
- package/styles/list-box/_tailwind-definition.scss +119 -119
- package/styles/list-box/_theme.scss +382 -382
- package/styles/list-box/icons/_bootstrap-dark.scss +25 -25
- package/styles/list-box/icons/_bootstrap.scss +25 -25
- package/styles/list-box/icons/_bootstrap4.scss +25 -25
- package/styles/list-box/icons/_bootstrap5.scss +25 -25
- package/styles/list-box/icons/_fabric-dark.scss +25 -25
- package/styles/list-box/icons/_fabric.scss +25 -25
- package/styles/list-box/icons/_fluent.scss +25 -25
- package/styles/list-box/icons/_fusionnew.scss +25 -25
- package/styles/list-box/icons/_highcontrast-light.scss +25 -25
- package/styles/list-box/icons/_highcontrast.scss +25 -25
- package/styles/list-box/icons/_material-dark.scss +25 -25
- package/styles/list-box/icons/_material.scss +25 -25
- package/styles/list-box/icons/_material3.scss +25 -25
- package/styles/list-box/icons/_tailwind-dark.scss +25 -25
- package/styles/list-box/icons/_tailwind.scss +25 -25
- package/styles/list-box/material3-dark.scss +1 -1
- package/styles/list-box/material3.scss +1 -1
- package/styles/material-dark.css +5 -0
- package/styles/material.css +5 -0
- package/styles/material3-dark.css +5 -0
- package/styles/material3-dark.scss +1 -1
- package/styles/material3.css +5 -0
- package/styles/material3.scss +1 -1
- package/styles/mention/_all.scss +1 -1
- package/styles/mention/_bds-definition.scss +1 -0
- package/styles/mention/_bootstrap-dark-definition.scss +3 -3
- package/styles/mention/_bootstrap-definition.scss +3 -3
- package/styles/mention/_bootstrap4-definition.scss +3 -3
- package/styles/mention/_bootstrap5-definition.scss +1 -1
- package/styles/mention/_fabric-dark-definition.scss +2 -2
- package/styles/mention/_fabric-definition.scss +3 -3
- package/styles/mention/_fluent-definition.scss +1 -1
- package/styles/mention/_fusionnew-definition.scss +1 -1
- package/styles/mention/_highcontrast-definition.scss +3 -3
- package/styles/mention/_highcontrast-light-definition.scss +3 -3
- package/styles/mention/_layout.scss +6 -6
- package/styles/mention/_material-dark-definition.scss +3 -3
- package/styles/mention/_material-definition.scss +3 -3
- package/styles/mention/_material3-definition.scss +1 -1
- package/styles/mention/_tailwind-definition.scss +1 -1
- package/styles/mention/material3-dark.scss +1 -1
- package/styles/mention/material3.scss +1 -1
- package/styles/multi-select/_all.scss +2 -2
- package/styles/multi-select/_bds-definition.scss +235 -0
- package/styles/multi-select/_bootstrap-dark-definition.scss +203 -203
- package/styles/multi-select/_bootstrap-definition.scss +192 -192
- package/styles/multi-select/_bootstrap4-definition.scss +278 -278
- package/styles/multi-select/_bootstrap5-definition.scss +230 -230
- package/styles/multi-select/_fabric-dark-definition.scss +192 -192
- package/styles/multi-select/_fabric-definition.scss +183 -183
- package/styles/multi-select/_fluent-definition.scss +241 -241
- package/styles/multi-select/_fusionnew-definition.scss +227 -227
- package/styles/multi-select/_highcontrast-definition.scss +303 -303
- package/styles/multi-select/_highcontrast-light-definition.scss +297 -297
- package/styles/multi-select/_layout.scss +2199 -2199
- package/styles/multi-select/_material-dark-definition.scss +230 -230
- package/styles/multi-select/_material-definition.scss +223 -223
- package/styles/multi-select/_material3-definition.scss +246 -246
- package/styles/multi-select/_tailwind-definition.scss +235 -235
- package/styles/multi-select/_theme.scss +586 -586
- package/styles/multi-select/icons/_bootstrap-dark.scss +26 -26
- package/styles/multi-select/icons/_bootstrap.scss +26 -26
- package/styles/multi-select/icons/_bootstrap4.scss +37 -37
- package/styles/multi-select/icons/_bootstrap5.scss +26 -26
- package/styles/multi-select/icons/_fabric-dark.scss +26 -26
- package/styles/multi-select/icons/_fabric.scss +26 -26
- package/styles/multi-select/icons/_fluent.scss +55 -55
- package/styles/multi-select/icons/_fusionnew.scss +26 -26
- package/styles/multi-select/icons/_highcontrast-light.scss +26 -26
- package/styles/multi-select/icons/_highcontrast.scss +26 -26
- package/styles/multi-select/icons/_material-dark.scss +693 -693
- package/styles/multi-select/icons/_material.scss +693 -693
- package/styles/multi-select/icons/_material3.scss +692 -692
- package/styles/multi-select/icons/_tailwind.scss +26 -26
- package/styles/multi-select/material3-dark.scss +1 -1
- package/styles/multi-select/material3.scss +1 -1
- package/styles/tailwind-dark.css +5 -0
- package/styles/tailwind.css +5 -0
- package/.eslintrc.json +0 -260
- package/tslint.json +0 -111
package/dist/global/index.d.ts
CHANGED
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* filename: index.d.ts
|
|
3
|
-
* version : 24.1.44
|
|
4
|
-
* Copyright Syncfusion Inc. 2001 - 2023. All rights reserved.
|
|
5
|
-
* Use of this code is subject to the terms of our license.
|
|
6
|
-
* A copy of the current license can be obtained at any time by e-mailing
|
|
7
|
-
* licensing@syncfusion.com. Any infringement will be prosecuted under
|
|
8
|
-
* applicable laws.
|
|
9
|
-
*/
|
|
10
1
|
import * as _dropdowns from '@syncfusion/ej2-dropdowns';
|
|
11
2
|
|
|
12
3
|
export declare namespace ej {
|
|
@@ -0,0 +1,623 @@
|
|
|
1
|
+
// eslint-disable-next-line @typescript-eslint/triple-slash-reference
|
|
2
|
+
/// <reference path='../combo-box/combo-box-model.d.ts'/>
|
|
3
|
+
import { Property, EventHandler, KeyboardEventArgs, isNullOrUndefined, detach } from '@syncfusion/ej2-base';
|
|
4
|
+
import { Event, EmitType, Complex } from '@syncfusion/ej2-base';
|
|
5
|
+
import { removeClass, attributes, NotifyPropertyChanges } from '@syncfusion/ej2-base';
|
|
6
|
+
import { dropDownListClasses } from '../drop-down-list/drop-down-list';
|
|
7
|
+
import { ComboBox } from '../combo-box/combo-box';
|
|
8
|
+
import { AutoCompleteModel } from '../auto-complete/auto-complete-model';
|
|
9
|
+
import { highlightSearch, revertHighlightSearch } from '../common/highlight-search';
|
|
10
|
+
import { Search } from '../common/incremental-search';
|
|
11
|
+
import { FieldSettingsModel } from '../drop-down-base/drop-down-base-model';
|
|
12
|
+
import { FieldSettings, FilteringEventArgs, FilterType, ResultData } from '../drop-down-base/drop-down-base';
|
|
13
|
+
import { FloatLabelType, Input } from '@syncfusion/ej2-inputs';
|
|
14
|
+
import { DataManager, Predicate, Query } from '@syncfusion/ej2-data';
|
|
15
|
+
|
|
16
|
+
dropDownListClasses.root = 'e-autocomplete';
|
|
17
|
+
dropDownListClasses.icon = 'e-input-group-icon e-ddl-icon e-search-icon';
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* The AutoComplete component provides the matched suggestion list when type into the input,
|
|
21
|
+
* from which the user can select one.
|
|
22
|
+
* ```html
|
|
23
|
+
* <input id="list" type="text"/>
|
|
24
|
+
* ```
|
|
25
|
+
* ```typescript
|
|
26
|
+
* let atcObj:AutoComplete = new AutoComplete();
|
|
27
|
+
* atcObj.appendTo("#list");
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
@NotifyPropertyChanges
|
|
31
|
+
export class AutoComplete extends ComboBox {
|
|
32
|
+
private isFiltered: boolean = false;
|
|
33
|
+
private searchList: boolean = false;
|
|
34
|
+
/**
|
|
35
|
+
* The `fields` property maps the columns of the data table and binds the data to the component.
|
|
36
|
+
* * text - Maps the text column from data table for each list item
|
|
37
|
+
* * value - Maps the value column from data table for each list item
|
|
38
|
+
* * iconCss - Maps the icon class column from data table for each list item
|
|
39
|
+
* * groupBy - Group the list items with it's related items by mapping groupBy field
|
|
40
|
+
*
|
|
41
|
+
* {% codeBlock src='autocomplete/fields/index.md' %}{% endcodeBlock %}
|
|
42
|
+
*
|
|
43
|
+
* > For more details about the field mapping refer to [`Data binding`](../../auto-complete/data-binding) documentation.
|
|
44
|
+
*
|
|
45
|
+
* @default { value: null, iconCss: null, groupBy: null}
|
|
46
|
+
* @deprecated
|
|
47
|
+
*/
|
|
48
|
+
@Complex<FieldSettingsModel>({ value: null, iconCss: null, groupBy: null }, FieldSettings)
|
|
49
|
+
public fields: FieldSettingsModel;
|
|
50
|
+
/**
|
|
51
|
+
* When set to ‘false’, consider the [`case-sensitive`](../../auto-complete/filtering/#case-sensitive-filtering)
|
|
52
|
+
* on performing the search to find suggestions.
|
|
53
|
+
* By default consider the casing.
|
|
54
|
+
*
|
|
55
|
+
* @default true
|
|
56
|
+
* @deprecated
|
|
57
|
+
*/
|
|
58
|
+
@Property(true)
|
|
59
|
+
public ignoreCase: boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Allows you to either show or hide the popup button on the component.
|
|
62
|
+
*
|
|
63
|
+
* @default false
|
|
64
|
+
*/
|
|
65
|
+
@Property(false)
|
|
66
|
+
public showPopupButton: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* When set to ‘true’, highlight the searched characters on suggested list items.
|
|
69
|
+
* > For more details about the highlight refer to [`Custom highlight search`](../../auto-complete/how-to/custom-search) documentation.
|
|
70
|
+
*
|
|
71
|
+
* @default false
|
|
72
|
+
*/
|
|
73
|
+
@Property(false)
|
|
74
|
+
public highlight: boolean;
|
|
75
|
+
/**
|
|
76
|
+
* Supports the [`specified number`](../../auto-complete/filtering#filter-item-count)
|
|
77
|
+
* of list items on the suggestion popup.
|
|
78
|
+
*
|
|
79
|
+
* @default 20
|
|
80
|
+
*/
|
|
81
|
+
@Property(20)
|
|
82
|
+
public suggestionCount: number;
|
|
83
|
+
/**
|
|
84
|
+
* Allows additional HTML attributes such as title, name, etc., and
|
|
85
|
+
* accepts n number of attributes in a key-value pair format.
|
|
86
|
+
*
|
|
87
|
+
* {% codeBlock src='autocomplete/htmlAttributes/index.md' %}{% endcodeBlock %}
|
|
88
|
+
*
|
|
89
|
+
* @default {}
|
|
90
|
+
* @deprecated
|
|
91
|
+
*/
|
|
92
|
+
@Property({})
|
|
93
|
+
public htmlAttributes: { [key: string]: string };
|
|
94
|
+
/**
|
|
95
|
+
* Accepts the external `query`
|
|
96
|
+
* that execute along with data processing.
|
|
97
|
+
*
|
|
98
|
+
* {% codeBlock src='autocomplete/query/index.md' %}{% endcodeBlock %}
|
|
99
|
+
*
|
|
100
|
+
* @default null
|
|
101
|
+
* @deprecated
|
|
102
|
+
*/
|
|
103
|
+
@Property(null)
|
|
104
|
+
public query: Query;
|
|
105
|
+
/**
|
|
106
|
+
* Allows you to set [`the minimum search character length']
|
|
107
|
+
* (../../auto-complete/filtering#limit-the-minimum-filter-character),
|
|
108
|
+
* the search action will perform after typed minimum characters.
|
|
109
|
+
*
|
|
110
|
+
* @default 1
|
|
111
|
+
*/
|
|
112
|
+
@Property(1)
|
|
113
|
+
public minLength: number;
|
|
114
|
+
/**
|
|
115
|
+
* Determines on which filter type, the component needs to be considered on search action.
|
|
116
|
+
* The available [`FilterType`](../../auto-complete/filtering/#change-the-filter-type)
|
|
117
|
+
* and its supported data types are
|
|
118
|
+
*
|
|
119
|
+
* <table>
|
|
120
|
+
* <tr>
|
|
121
|
+
* <td colSpan=1 rowSpan=1>
|
|
122
|
+
* FilterType<br/></td><td colSpan=1 rowSpan=1>
|
|
123
|
+
* Description<br/></td><td colSpan=1 rowSpan=1>
|
|
124
|
+
* Supported Types<br/></td></tr>
|
|
125
|
+
* <tr>
|
|
126
|
+
* <td colSpan=1 rowSpan=1>
|
|
127
|
+
* StartsWith<br/></td><td colSpan=1 rowSpan=1>
|
|
128
|
+
* Checks whether a value begins with the specified value.<br/></td><td colSpan=1 rowSpan=1>
|
|
129
|
+
* String<br/></td></tr>
|
|
130
|
+
* <tr>
|
|
131
|
+
* <td colSpan=1 rowSpan=1>
|
|
132
|
+
* EndsWith<br/></td><td colSpan=1 rowSpan=1>
|
|
133
|
+
* Checks whether a value ends with specified value.<br/><br/></td><td colSpan=1 rowSpan=1>
|
|
134
|
+
* <br/>String<br/></td></tr>
|
|
135
|
+
* <tr>
|
|
136
|
+
* <td colSpan=1 rowSpan=1>
|
|
137
|
+
* Contains<br/></td><td colSpan=1 rowSpan=1>
|
|
138
|
+
* Checks whether a value contains with specified value.<br/><br/></td><td colSpan=1 rowSpan=1>
|
|
139
|
+
* <br/>String<br/></td></tr>
|
|
140
|
+
* </table>
|
|
141
|
+
*
|
|
142
|
+
* {% codeBlock src="autocomplete/filter-type-api/index.ts" %}{% endcodeBlock %}
|
|
143
|
+
*
|
|
144
|
+
* {% codeBlock src="autocomplete/filter-type-api/index.html" %}{% endcodeBlock %}
|
|
145
|
+
*
|
|
146
|
+
* The default value set to `Contains`, all the suggestion items which contain typed characters to listed in the suggestion popup.
|
|
147
|
+
*
|
|
148
|
+
* @default 'Contains'
|
|
149
|
+
*/
|
|
150
|
+
@Property('Contains')
|
|
151
|
+
public filterType: FilterType;
|
|
152
|
+
/**
|
|
153
|
+
* Triggers on typing a character in the component.
|
|
154
|
+
*
|
|
155
|
+
* @event filtering
|
|
156
|
+
*/
|
|
157
|
+
@Event()
|
|
158
|
+
public filtering: EmitType<FilteringEventArgs>;
|
|
159
|
+
/**
|
|
160
|
+
* Not applicable to this component.
|
|
161
|
+
*
|
|
162
|
+
* @default null
|
|
163
|
+
* @private
|
|
164
|
+
* @deprecated
|
|
165
|
+
*/
|
|
166
|
+
@Property(null)
|
|
167
|
+
public index: number;
|
|
168
|
+
/**
|
|
169
|
+
* Specifies whether to display the floating label above the input element.
|
|
170
|
+
* Possible values are:
|
|
171
|
+
* * Never: The label will never float in the input when the placeholder is available.
|
|
172
|
+
* * Always: The floating label will always float above the input.
|
|
173
|
+
* * Auto: The floating label will float above the input after focusing or entering a value in the input.
|
|
174
|
+
*
|
|
175
|
+
* {% codeBlock src="autocomplete/float-label-type-api/index.ts" %}{% endcodeBlock %}
|
|
176
|
+
*
|
|
177
|
+
* {% codeBlock src="autocomplete/float-label-type-api/index.html" %}{% endcodeBlock %}
|
|
178
|
+
*
|
|
179
|
+
* @default Syncfusion.EJ2.Inputs.FloatLabelType.Never
|
|
180
|
+
* @aspType Syncfusion.EJ2.Inputs.FloatLabelType
|
|
181
|
+
* @isEnumeration true
|
|
182
|
+
* @deprecated
|
|
183
|
+
*/
|
|
184
|
+
@Property('Never')
|
|
185
|
+
public floatLabelType: FloatLabelType;
|
|
186
|
+
/**
|
|
187
|
+
* Not applicable to this component.
|
|
188
|
+
*
|
|
189
|
+
* @default null
|
|
190
|
+
* @aspType string
|
|
191
|
+
* @private
|
|
192
|
+
* @deprecated
|
|
193
|
+
*/
|
|
194
|
+
@Property(null)
|
|
195
|
+
public valueTemplate: string | Function;
|
|
196
|
+
/**
|
|
197
|
+
* Not applicable to this component.
|
|
198
|
+
*
|
|
199
|
+
* @default null
|
|
200
|
+
* @private
|
|
201
|
+
* @deprecated
|
|
202
|
+
*/
|
|
203
|
+
@Property(null)
|
|
204
|
+
public filterBarPlaceholder: string;
|
|
205
|
+
/**
|
|
206
|
+
* Not applicable to this component.
|
|
207
|
+
*
|
|
208
|
+
* @default false
|
|
209
|
+
* @private
|
|
210
|
+
* @deprecated
|
|
211
|
+
*/
|
|
212
|
+
@Property(false)
|
|
213
|
+
public allowFiltering: boolean;
|
|
214
|
+
/**
|
|
215
|
+
* Not applicable to this component.
|
|
216
|
+
*
|
|
217
|
+
* @default null
|
|
218
|
+
* @private
|
|
219
|
+
* @deprecated
|
|
220
|
+
*/
|
|
221
|
+
@Property(null)
|
|
222
|
+
public text: string;
|
|
223
|
+
/**
|
|
224
|
+
* * Constructor for creating the widget
|
|
225
|
+
*
|
|
226
|
+
* @param {AutoCompleteModel} options - Specifies the AutoComplete model.
|
|
227
|
+
* @param {string | HTMLElement} element - Specifies the element to render as component.
|
|
228
|
+
* @private
|
|
229
|
+
*/
|
|
230
|
+
public constructor(options?: AutoCompleteModel, element?: string | HTMLElement) {
|
|
231
|
+
super(options, element);
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Initialize the event handler
|
|
235
|
+
*
|
|
236
|
+
* @private
|
|
237
|
+
* @returns {void}
|
|
238
|
+
*/
|
|
239
|
+
protected preRender(): void {
|
|
240
|
+
super.preRender();
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
protected getLocaleName(): string {
|
|
244
|
+
return 'auto-complete';
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
protected getNgDirective(): string {
|
|
248
|
+
return 'EJS-AUTOCOMPLETE';
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
protected getQuery(query: Query): Query {
|
|
252
|
+
const filterQuery: Query = query ? query.clone() : this.query ? this.query.clone() : new Query();
|
|
253
|
+
const filterType: string = (this.queryString === '' && !isNullOrUndefined(this.value)) ? 'equal' : this.filterType;
|
|
254
|
+
const queryString: string = (this.queryString === '' && !isNullOrUndefined(this.value)) ? this.value as string : this.queryString;
|
|
255
|
+
if (this.isFiltered) {
|
|
256
|
+
return filterQuery;
|
|
257
|
+
}
|
|
258
|
+
if (this.queryString !== null && this.queryString !== '') {
|
|
259
|
+
const dataType: string = <string>this.typeOfData(this.dataSource as { [key: string]: Object }[]).typeof;
|
|
260
|
+
if (!(this.dataSource instanceof DataManager) && dataType === 'string' || dataType === 'number') {
|
|
261
|
+
filterQuery.where('', filterType, queryString, this.ignoreCase, this.ignoreAccent);
|
|
262
|
+
} else if ((!this.enableVirtualization) || (this.enableVirtualization && (!(this.dataSource instanceof DataManager) || (this.dataSource instanceof DataManager && this.virtualGroupDataSource)))) {
|
|
263
|
+
const mapping: string = !isNullOrUndefined(this.fields.value) ? this.fields.value : '';
|
|
264
|
+
filterQuery.where(mapping, filterType, queryString, this.ignoreCase, this.ignoreAccent);
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
if (!isNullOrUndefined(this.suggestionCount) && !this.enableVirtualization) {
|
|
268
|
+
// Since defualt value of suggestioncount is 20, checked the condition
|
|
269
|
+
if (this.suggestionCount !== 20) {
|
|
270
|
+
for (let queryElements: number = 0; queryElements < filterQuery.queries.length; queryElements++) {
|
|
271
|
+
if (filterQuery.queries[queryElements as number].fn === 'onTake') {
|
|
272
|
+
filterQuery.queries.splice(queryElements, 1);
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
filterQuery.take(this.suggestionCount);
|
|
277
|
+
}
|
|
278
|
+
if (this.enableVirtualization && (!(this.dataSource instanceof DataManager) || (this.dataSource instanceof DataManager && this.virtualGroupDataSource))) {
|
|
279
|
+
var takeValue = this.getTakeValue();
|
|
280
|
+
filterQuery.skip(this.virtualItemStartIndex);
|
|
281
|
+
filterQuery.take(takeValue);
|
|
282
|
+
filterQuery.requiresCount();
|
|
283
|
+
}
|
|
284
|
+
return filterQuery;
|
|
285
|
+
}
|
|
286
|
+
protected searchLists(e: KeyboardEventArgs | MouseEvent): void {
|
|
287
|
+
this.isTyped = true;
|
|
288
|
+
this.isDataFetched = this.isSelectCustom = false;
|
|
289
|
+
this.checkAndResetCache();
|
|
290
|
+
if (isNullOrUndefined(this.list)) {
|
|
291
|
+
super.renderList(e, true);
|
|
292
|
+
}
|
|
293
|
+
this.queryString = this.filterInput.value;
|
|
294
|
+
if (e.type !== 'mousedown' && ((<KeyboardEventArgs>e).keyCode === 40 || (<KeyboardEventArgs>e).keyCode === 38)) {
|
|
295
|
+
this.queryString = this.queryString === '' ? null : this.queryString;
|
|
296
|
+
this.beforePopupOpen = true;
|
|
297
|
+
this.resetList(this.dataSource, this.fields, null, e);
|
|
298
|
+
return;
|
|
299
|
+
}
|
|
300
|
+
this.isSelected = false;
|
|
301
|
+
this.activeIndex = null;
|
|
302
|
+
const eventArgs: { [key: string]: Object } = {
|
|
303
|
+
preventDefaultAction: false,
|
|
304
|
+
text: this.filterInput.value,
|
|
305
|
+
updateData: (
|
|
306
|
+
dataSource: { [key: string]: Object }[] | DataManager | string[] | number[], query?: Query,
|
|
307
|
+
fields?: FieldSettingsModel) => {
|
|
308
|
+
if (eventArgs.cancel) {
|
|
309
|
+
return;
|
|
310
|
+
}
|
|
311
|
+
this.isFiltered = true;
|
|
312
|
+
this.filterAction(dataSource, query, fields);
|
|
313
|
+
},
|
|
314
|
+
cancel: false
|
|
315
|
+
};
|
|
316
|
+
this.trigger('filtering', eventArgs, (eventArgs: FilteringEventArgs) => {
|
|
317
|
+
if (!eventArgs.cancel && !this.isFiltered && !eventArgs.preventDefaultAction) {
|
|
318
|
+
this.searchList = true;
|
|
319
|
+
this.filterAction(this.dataSource, null, this.fields, e);
|
|
320
|
+
}
|
|
321
|
+
});
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
/**
|
|
325
|
+
* To filter the data from given data source by using query
|
|
326
|
+
*
|
|
327
|
+
* @param {Object[] | DataManager } dataSource - Set the data source to filter.
|
|
328
|
+
* @param {Query} query - Specify the query to filter the data.
|
|
329
|
+
* @param {FieldSettingsModel} fields - Specify the fields to map the column in the data table.
|
|
330
|
+
* @returns {void}
|
|
331
|
+
* @deprecated
|
|
332
|
+
*/
|
|
333
|
+
public filter(
|
|
334
|
+
dataSource: { [key: string]: Object }[] | DataManager | string[] | number[] | boolean[],
|
|
335
|
+
query?: Query, fields?: FieldSettingsModel): void {
|
|
336
|
+
this.isFiltered = true;
|
|
337
|
+
this.filterAction(dataSource, query, fields);
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
private filterAction(
|
|
341
|
+
dataSource: { [key: string]: Object }[] | DataManager | string[] | number[] | boolean[],
|
|
342
|
+
query?: Query, fields?: FieldSettingsModel, e?: MouseEvent | KeyboardEventArgs | TouchEvent): void {
|
|
343
|
+
this.beforePopupOpen = true;
|
|
344
|
+
let isNoDataElement = this.list.classList.contains('e-nodata');
|
|
345
|
+
if (this.queryString !== '' && (this.queryString.length >= this.minLength)) {
|
|
346
|
+
if(this.enableVirtualization && this.isFiltering() && this.isTyped) {
|
|
347
|
+
this.isPreventScrollAction = true;
|
|
348
|
+
this.list.scrollTop = 0;
|
|
349
|
+
this.previousStartIndex = 0;
|
|
350
|
+
this.virtualListInfo = null;
|
|
351
|
+
}
|
|
352
|
+
this.resetList(dataSource, fields, query, e);
|
|
353
|
+
if(this.enableVirtualization && isNoDataElement && !this.list.classList.contains('e-nodata')) {
|
|
354
|
+
if (!this.list.querySelector('.e-virtual-ddl-content')) {
|
|
355
|
+
this.list.appendChild(this.createElement('div', {
|
|
356
|
+
className: 'e-virtual-ddl-content',
|
|
357
|
+
styles: this.getTransformValues()
|
|
358
|
+
})).appendChild(this.list.querySelector('.e-list-parent'));
|
|
359
|
+
}
|
|
360
|
+
if(!this.list.querySelector('.e-virtual-ddl')){
|
|
361
|
+
var virualElement = this.createElement('div', {
|
|
362
|
+
id: this.element.id + '_popup', className: 'e-virtual-ddl', styles: this.GetVirtualTrackHeight()});
|
|
363
|
+
document.getElementsByClassName('e-popup')[0].querySelector('.e-dropdownbase').appendChild(virualElement);
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
if ((this.getModuleName() === 'autocomplete' && !(this.dataSource instanceof DataManager)) || (this.getModuleName() === 'autocomplete' && (this.dataSource instanceof DataManager) && this.totalItemCount !=0 )) {
|
|
367
|
+
this.getFilteringSkeletonCount();
|
|
368
|
+
}
|
|
369
|
+
} else {
|
|
370
|
+
this.hidePopup(e);
|
|
371
|
+
this.beforePopupOpen = false;
|
|
372
|
+
}
|
|
373
|
+
this.renderReactTemplates();
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
protected clearAll(e?: MouseEvent, property?: AutoCompleteModel): void {
|
|
377
|
+
if (isNullOrUndefined(property) || (!isNullOrUndefined(property) && isNullOrUndefined(property.dataSource))) {
|
|
378
|
+
super.clearAll(e);
|
|
379
|
+
this.checkAndResetCache();
|
|
380
|
+
}
|
|
381
|
+
if (this.beforePopupOpen) {
|
|
382
|
+
this.hidePopup();
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
387
|
+
protected onActionComplete(ulElement: HTMLElement, list: { [key: string]: Object }[], e?: Object, isUpdated?: boolean): void {
|
|
388
|
+
if(!this.enableVirtualization){
|
|
389
|
+
this.fixedHeaderElement = null;
|
|
390
|
+
}
|
|
391
|
+
if ((this.getModuleName() === 'autocomplete' && !(this.dataSource instanceof DataManager)) || (this.getModuleName() === 'autocomplete' && (this.dataSource instanceof DataManager) && this.totalItemCount != 0)) {
|
|
392
|
+
this.getFilteringSkeletonCount();
|
|
393
|
+
}
|
|
394
|
+
super.onActionComplete(ulElement, list, e);
|
|
395
|
+
const item: Element = this.list.querySelector('.' + dropDownListClasses.li);
|
|
396
|
+
if (!isNullOrUndefined(item)) {
|
|
397
|
+
removeClass([item], dropDownListClasses.focus);
|
|
398
|
+
}
|
|
399
|
+
this.postBackAction();
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
private postBackAction(): void {
|
|
403
|
+
if (this.autofill && !isNullOrUndefined(this.liCollections[0]) && this.searchList) {
|
|
404
|
+
const items: HTMLElement[] = [this.liCollections[0]];
|
|
405
|
+
const dataSource: { [key: string]: Object }[] = this.listData as { [key: string]: Object }[];
|
|
406
|
+
const type: string = this.typeOfData(dataSource).typeof as string;
|
|
407
|
+
const searchItem: { [key: string]: number | Element } = Search(this.inputElement.value, items, 'StartsWith', this.ignoreCase, dataSource, this.fields, type);
|
|
408
|
+
this.searchList = false;
|
|
409
|
+
if (!isNullOrUndefined(searchItem.item)) {
|
|
410
|
+
super.setAutoFill(this.liCollections[0], true);
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
protected setSelection(li: Element, e: MouseEvent | KeyboardEventArgs | TouchEvent): void {
|
|
416
|
+
if (!this.isValidLI(li)) {
|
|
417
|
+
this.selectedLI = <HTMLElement>li;
|
|
418
|
+
return;
|
|
419
|
+
}
|
|
420
|
+
if (!isNullOrUndefined(e) && e.type === 'keydown' && (e as KeyboardEventArgs).action !== 'enter'
|
|
421
|
+
&& (e as KeyboardEventArgs).action !== 'tab' && this.isValidLI(li)) {
|
|
422
|
+
const value: string | number | boolean = this.getFormattedValue(li.getAttribute('data-value'));
|
|
423
|
+
this.activeIndex = this.getIndexByValue(value);
|
|
424
|
+
this.setHoverList(li);
|
|
425
|
+
this.selectedLI = <HTMLElement>li;
|
|
426
|
+
this.setScrollPosition(e as KeyboardEventArgs);
|
|
427
|
+
if (this.autofill && this.isPopupOpen) {
|
|
428
|
+
this.preventAutoFill = false;
|
|
429
|
+
const isKeyNavigate: boolean = (e && (e as KeyboardEventArgs).action === 'down' || (e as KeyboardEventArgs).action === 'up' ||
|
|
430
|
+
(e as KeyboardEventArgs).action === 'home' || (e as KeyboardEventArgs).action === 'end' || (e as KeyboardEventArgs).action === 'pageUp' || (e as KeyboardEventArgs).action === 'pageDown');
|
|
431
|
+
super.setAutoFill(li, isKeyNavigate);
|
|
432
|
+
}
|
|
433
|
+
} else {
|
|
434
|
+
super.setSelection(li, e);
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
protected listOption(dataSource: { [key: string]: Object }[], fieldsSettings: FieldSettingsModel): FieldSettingsModel {
|
|
439
|
+
const fields: { [key: string]: Object } = <{ [key: string]: Object }>super.listOption(dataSource, fieldsSettings);
|
|
440
|
+
if (isNullOrUndefined(fields.itemCreated)) {
|
|
441
|
+
fields.itemCreated = (e: { [key: string]: HTMLElement }) => {
|
|
442
|
+
if (this.highlight) {
|
|
443
|
+
if (this.element.tagName === this.getNgDirective() && this.itemTemplate) {
|
|
444
|
+
setTimeout((): void => {
|
|
445
|
+
highlightSearch(e.item, this.queryString, this.ignoreCase, this.filterType);
|
|
446
|
+
}, 0);
|
|
447
|
+
} else {
|
|
448
|
+
const isHtmlElement: boolean = /<[^>]*>/g.test(e.item.innerText);
|
|
449
|
+
if (isHtmlElement) {
|
|
450
|
+
e.item.innerText = e.item.innerText.replace(/[\u00A0-\u9999<>&]/g, (match: string) => `&#${match.charCodeAt(0)};`);
|
|
451
|
+
}
|
|
452
|
+
highlightSearch(e.item, this.queryString, this.ignoreCase, this.filterType);
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
};
|
|
456
|
+
} else {
|
|
457
|
+
const itemCreated: Function = <Function>fields.itemCreated;
|
|
458
|
+
fields.itemCreated = (e: { [key: string]: HTMLElement }) => {
|
|
459
|
+
if (this.highlight) {
|
|
460
|
+
highlightSearch(e.item, this.queryString, this.ignoreCase, this.filterType);
|
|
461
|
+
}
|
|
462
|
+
itemCreated.apply(this, [e]);
|
|
463
|
+
};
|
|
464
|
+
}
|
|
465
|
+
return fields;
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
protected isFiltering(): boolean {
|
|
469
|
+
return true;
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
protected renderPopup(e?: MouseEvent | KeyboardEventArgs | TouchEvent): void {
|
|
473
|
+
if(!this.enableVirtualization){
|
|
474
|
+
this.list.scrollTop = 0;
|
|
475
|
+
}
|
|
476
|
+
super.renderPopup(e);
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
protected isEditTextBox(): boolean {
|
|
480
|
+
return false;
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
protected isPopupButton(): boolean {
|
|
484
|
+
return this.showPopupButton;
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
488
|
+
protected isSelectFocusItem(element: Element): boolean {
|
|
489
|
+
return false;
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
protected setInputValue(newProp?: any, oldProp?: any): void {
|
|
493
|
+
let oldValue = oldProp && oldProp.text ? oldProp.text : oldProp ? oldProp.value : oldProp;
|
|
494
|
+
let value = newProp && newProp.text ? newProp.text : newProp && newProp.value ? newProp.value : this.value;
|
|
495
|
+
if (value && this.typedString === '' && !this.allowCustom && !(this.dataSource instanceof DataManager)) {
|
|
496
|
+
let checkFields_1: string = this.typeOfData(this.dataSource).typeof === 'string' ? '' : this.fields.value;
|
|
497
|
+
const listLength: number = this.getItems().length;
|
|
498
|
+
let query: Query = new Query();
|
|
499
|
+
let _this = this;
|
|
500
|
+
new DataManager(this.dataSource).executeQuery(query.where(new Predicate(checkFields_1, 'equal', value)))
|
|
501
|
+
.then(function (e: Object) {
|
|
502
|
+
if ((e as ResultData).result.length > 0) {
|
|
503
|
+
_this.value = checkFields_1 !== '' ? (e as ResultData).result[0][_this.fields.value].toString() : (e as ResultData).result[0].toString();
|
|
504
|
+
_this.addItem((e as ResultData).result, listLength);
|
|
505
|
+
_this.updateValues();
|
|
506
|
+
}
|
|
507
|
+
else {
|
|
508
|
+
newProp && newProp.text ? _this.setOldText(oldValue) : newProp && newProp.value ? _this.setOldValue(oldValue) : _this.updateValues();
|
|
509
|
+
}
|
|
510
|
+
});
|
|
511
|
+
}
|
|
512
|
+
else if (newProp) {
|
|
513
|
+
newProp.text ? this.setOldText(oldValue) : this.setOldValue(oldValue);
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
/**
|
|
518
|
+
* Search the entered text and show it in the suggestion list if available.
|
|
519
|
+
*
|
|
520
|
+
* @returns {void}
|
|
521
|
+
* @deprecated
|
|
522
|
+
*/
|
|
523
|
+
public showPopup(e?: MouseEvent | KeyboardEventArgs | TouchEvent): void {
|
|
524
|
+
if (!this.enabled) {
|
|
525
|
+
return;
|
|
526
|
+
}
|
|
527
|
+
if (this.beforePopupOpen) {
|
|
528
|
+
this.refreshPopup();
|
|
529
|
+
return;
|
|
530
|
+
}
|
|
531
|
+
this.beforePopupOpen = true;
|
|
532
|
+
this.preventAutoFill = true;
|
|
533
|
+
if (isNullOrUndefined(this.list)) {
|
|
534
|
+
this.renderList(e);
|
|
535
|
+
} else {
|
|
536
|
+
this.resetList(this.dataSource, this.fields, null, e);
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
/**
|
|
540
|
+
* Hides the popup if it is in open state.
|
|
541
|
+
*
|
|
542
|
+
* @returns {void}
|
|
543
|
+
*/
|
|
544
|
+
public hidePopup(e?: MouseEvent | KeyboardEventArgs | TouchEvent): void {
|
|
545
|
+
super.hidePopup(e);
|
|
546
|
+
this.activeIndex = null;
|
|
547
|
+
this.virtualListInfo = this.viewPortInfo;
|
|
548
|
+
this.previousStartIndex = this.viewPortInfo.startIndex;
|
|
549
|
+
this.startIndex = this.viewPortInfo.startIndex;
|
|
550
|
+
this.previousEndIndex = this.viewPortInfo.endIndex;
|
|
551
|
+
}
|
|
552
|
+
/**
|
|
553
|
+
* Dynamically change the value of properties.
|
|
554
|
+
*
|
|
555
|
+
* @param {AutoCompleteModel} newProp - Returns the dynamic property value of the component.
|
|
556
|
+
* @param {AutoCompleteModel} oldProp - Returns the previous property value of the component.
|
|
557
|
+
* @private
|
|
558
|
+
* @returns {void}
|
|
559
|
+
*/
|
|
560
|
+
public onPropertyChanged(newProp: AutoCompleteModel, oldProp: AutoCompleteModel): void {
|
|
561
|
+
if (this.getModuleName() === 'autocomplete') {
|
|
562
|
+
this.setUpdateInitial(['fields', 'query', 'dataSource'], newProp as { [key: string]: string });
|
|
563
|
+
}
|
|
564
|
+
for (const prop of Object.keys(newProp)) {
|
|
565
|
+
switch (prop) {
|
|
566
|
+
case 'showPopupButton':
|
|
567
|
+
if (this.showPopupButton) {
|
|
568
|
+
const button: HTMLElement = Input.appendSpan(
|
|
569
|
+
dropDownListClasses.icon,
|
|
570
|
+
this.inputWrapper.container,
|
|
571
|
+
this.createElement);
|
|
572
|
+
this.inputWrapper.buttons[0] = button;
|
|
573
|
+
Input.calculateWidth(this.inputElement, this.inputWrapper.container);
|
|
574
|
+
if (!isNullOrUndefined(this.inputWrapper.buttons[0]) && !isNullOrUndefined(this.inputWrapper.container.getElementsByClassName('e-float-text-overflow')[0]) && this.floatLabelType !== 'Never') {
|
|
575
|
+
this.inputWrapper.container.getElementsByClassName('e-float-text-overflow')[0].classList.add('e-icon');
|
|
576
|
+
}
|
|
577
|
+
if (this.inputWrapper && this.inputWrapper.buttons && this.inputWrapper.buttons[0]) {
|
|
578
|
+
EventHandler.add(this.inputWrapper.buttons[0], 'click', this.dropDownClick, this);
|
|
579
|
+
}
|
|
580
|
+
} else {
|
|
581
|
+
detach(this.inputWrapper.buttons[0]);
|
|
582
|
+
this.inputWrapper.buttons[0] = null;
|
|
583
|
+
}
|
|
584
|
+
break;
|
|
585
|
+
default: {
|
|
586
|
+
// eslint-disable-next-line max-len
|
|
587
|
+
const atcProps: { [key: string]: Object } = this.getPropObject(prop, <{ [key: string]: string }>newProp, <{ [key: string]: string }>oldProp);
|
|
588
|
+
super.onPropertyChanged(atcProps.newProperty, atcProps.oldProperty);
|
|
589
|
+
break;
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
protected renderHightSearch(): void {
|
|
595
|
+
if (this.highlight) {
|
|
596
|
+
for (let i: number = 0; i < this.liCollections.length; i++) {
|
|
597
|
+
const isHighlight: HTMLElement = this.ulElement.querySelector('.e-active');
|
|
598
|
+
if (!isHighlight) {
|
|
599
|
+
revertHighlightSearch(this.liCollections[i as number]);
|
|
600
|
+
highlightSearch(this.liCollections[i as number], this.queryString, this.ignoreCase, this.filterType);
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
/**
|
|
606
|
+
* Return the module name of this component.
|
|
607
|
+
*
|
|
608
|
+
* @private
|
|
609
|
+
* @returns {string} Return the module name of this component.
|
|
610
|
+
*/
|
|
611
|
+
public getModuleName(): string {
|
|
612
|
+
return 'autocomplete';
|
|
613
|
+
}
|
|
614
|
+
/**
|
|
615
|
+
* To initialize the control rendering
|
|
616
|
+
*
|
|
617
|
+
* @private
|
|
618
|
+
* @returns {void}
|
|
619
|
+
*/
|
|
620
|
+
public render(): void {
|
|
621
|
+
super.render();
|
|
622
|
+
}
|
|
623
|
+
}
|