@syncfusion/ej2-dropdowns 24.1.43 → 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 -2058
- 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 +94 -74
- package/dist/es6/ej2-dropdowns.es2015.js.map +1 -1
- package/dist/es6/ej2-dropdowns.es5.js +236 -216
- 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 +31 -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 +20 -28
- 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 +34 -22
- package/src/mention/mention-model.d.ts +261 -261
- package/src/mention/mention.js +29 -22
- 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 +9 -0
- package/styles/bootstrap.css +9 -0
- package/styles/bootstrap4.css +9 -0
- package/styles/bootstrap5-dark.css +9 -0
- package/styles/bootstrap5.css +9 -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 -1418
- 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/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 +4 -0
- package/styles/drop-down-tree/bootstrap5.css +4 -0
- 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 +4 -0
- package/styles/drop-down-tree/fluent.css +4 -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-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/material-dark.css +4 -0
- package/styles/drop-down-tree/material.css +4 -0
- package/styles/drop-down-tree/material3-dark.css +4 -0
- package/styles/drop-down-tree/material3-dark.scss +1 -1
- package/styles/drop-down-tree/material3.css +4 -0
- package/styles/drop-down-tree/material3.scss +1 -1
- package/styles/drop-down-tree/tailwind-dark.css +4 -0
- package/styles/drop-down-tree/tailwind.css +4 -0
- package/styles/fabric-dark.css +9 -0
- package/styles/fabric.css +9 -0
- package/styles/fluent-dark.css +9 -0
- package/styles/fluent.css +9 -0
- package/styles/highcontrast-light.css +9 -0
- package/styles/highcontrast.css +9 -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 +9 -0
- package/styles/material.css +9 -0
- package/styles/material3-dark.css +9 -0
- package/styles/material3-dark.scss +1 -1
- package/styles/material3.css +9 -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 +9 -0
- package/styles/tailwind.css +9 -0
- package/.eslintrc.json +0 -260
- package/tslint.json +0 -111
|
@@ -0,0 +1,388 @@
|
|
|
1
|
+
import { EventHandler, Browser, ScrollEventArgs, select, isNullOrUndefined } from '@syncfusion/ej2-base';
|
|
2
|
+
import { debounce, Touch } from '@syncfusion/ej2-base';
|
|
3
|
+
import { IDropdownlist } from './interface';
|
|
4
|
+
import { DropDownList } from '../drop-down-list/';
|
|
5
|
+
import { DataManager, Query } from '@syncfusion/ej2-data';
|
|
6
|
+
export type ScrollDirection = 'up' | 'down';
|
|
7
|
+
type ScrollArg = { direction: string, sentinel: SentinelType, offset: Offsets, focusElement: HTMLElement };
|
|
8
|
+
export type SentinelType = {
|
|
9
|
+
check?: (rect: ClientRect, info: SentinelType) => boolean,
|
|
10
|
+
top?: number, entered?: boolean,
|
|
11
|
+
axis?: string;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export type SentinelInfo = { up?: SentinelType, down?: SentinelType, right?: SentinelType, left?: SentinelType };
|
|
15
|
+
|
|
16
|
+
export type Offsets = { top?: number, left?: number };
|
|
17
|
+
export interface VirtualInfo {
|
|
18
|
+
currentPageNumber?: number;
|
|
19
|
+
direction?: string;
|
|
20
|
+
sentinelInfo?: SentinelType;
|
|
21
|
+
offsets?: Offsets;
|
|
22
|
+
startIndex?: number;
|
|
23
|
+
endIndex?: number;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export class VirtualScroll {
|
|
27
|
+
private parent: IDropdownlist;
|
|
28
|
+
private containerElementRect: ClientRect;
|
|
29
|
+
private element: HTMLElement;
|
|
30
|
+
private options: any;
|
|
31
|
+
private touchModule: Touch;
|
|
32
|
+
private component: string;
|
|
33
|
+
|
|
34
|
+
constructor(parent: IDropdownlist) {
|
|
35
|
+
this.parent = parent;
|
|
36
|
+
this.removeEventListener();
|
|
37
|
+
this.addEventListener();
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
public addEventListener(): void {
|
|
41
|
+
if (this.parent.isDestroyed) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
this.parent.on('observe', this.observe, this);
|
|
45
|
+
this.parent.on('setGeneratedData', this.setGeneratedData, this);
|
|
46
|
+
this.parent.on('dataProcessAsync', this.dataProcessAsync, this);
|
|
47
|
+
this.parent.on('setCurrentViewDataAsync', this.setCurrentViewDataAsync, this);
|
|
48
|
+
this.parent.on('bindScrollEvent', this.bindScrollEvent, this);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
public removeEventListener(): void {
|
|
52
|
+
if (this.parent.isDestroyed) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
this.parent.off('observe', this.observe);
|
|
56
|
+
this.parent.off('setGeneratedData', this.setGeneratedData);
|
|
57
|
+
this.parent.off('dataProcessAsync', this.dataProcessAsync);
|
|
58
|
+
this.parent.off('setCurrentViewDataAsync', this.setCurrentViewDataAsync);
|
|
59
|
+
this.parent.off('bindScrollEvent', this.bindScrollEvent);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
private bindScrollEvent(component: object): void {
|
|
63
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
64
|
+
this.component = (component as any).component;
|
|
65
|
+
this.observe((scrollArgs: ScrollArg) => this.scrollListener(scrollArgs));
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
private observe(callback: Function): void {
|
|
69
|
+
this.containerElementRect = this.parent.popupContentElement.getBoundingClientRect();
|
|
70
|
+
EventHandler.add(this.parent.popupContentElement, 'wheel mousedown', this.popupScrollHandler, this);
|
|
71
|
+
this.touchModule = new Touch(this.parent.popupContentElement, {
|
|
72
|
+
scroll: this.popupScrollHandler.bind(this)
|
|
73
|
+
});
|
|
74
|
+
EventHandler.add(this.parent.popupContentElement, 'scroll', this.virtualScrollHandler(callback), this);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
public getModuleName(): string {
|
|
78
|
+
return 'VirtualScroll';
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
private popupScrollHandler(e: ScrollEventArgs): void {
|
|
82
|
+
this.parent.isMouseScrollAction = true;
|
|
83
|
+
this.parent.isPreventScrollAction = false;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
private getPageQuery(query: Query, virtualStartIndex: number, virtualEndIndex: number): Query {
|
|
87
|
+
if (virtualEndIndex !== 0 && !this.parent.allowFiltering && this.component !== 'autocomplete') {
|
|
88
|
+
query = query.skip(virtualStartIndex);
|
|
89
|
+
}
|
|
90
|
+
return query;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
private setGeneratedData(qStartIndex: number, recentlyGeneratedData: object[]): void {
|
|
94
|
+
let loopIteration: number = 0;
|
|
95
|
+
let endIndex: number = this.parent.listData.length + this.parent.virtualItemStartIndex;
|
|
96
|
+
for (let i = this.parent.virtualItemStartIndex; i < endIndex; i++) {
|
|
97
|
+
const alreadyAddedData: object | undefined = this.parent.generatedDataObject[i as number];
|
|
98
|
+
if (!alreadyAddedData) {
|
|
99
|
+
if (recentlyGeneratedData !== null && this.parent.listData.slice(loopIteration, loopIteration + 1).length > 0) {
|
|
100
|
+
const slicedData = this.parent.listData.slice(loopIteration, loopIteration + 1);
|
|
101
|
+
if (slicedData.length > 0) {
|
|
102
|
+
// Safely assign slicedData to this.parent.generatedDataObject[i]
|
|
103
|
+
this.parent.generatedDataObject[i as number] = slicedData;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
loopIteration++;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
private generateAndExecuteQueryAsync(query: Query, virtualItemStartIndex: number = 0, virtualItemEndIndex: number = 0, isQueryGenerated: boolean = false): void {
|
|
112
|
+
let dataSource = this.parent.dataSource;
|
|
113
|
+
if (!isQueryGenerated) {
|
|
114
|
+
if(!isNullOrUndefined((this.parent as any).query))
|
|
115
|
+
{
|
|
116
|
+
var newQuery = this.removeSkipAndTakeEvents((this.parent as any).query.clone());
|
|
117
|
+
query = this.getPageQuery(newQuery, virtualItemStartIndex, virtualItemEndIndex);
|
|
118
|
+
} else {
|
|
119
|
+
query = this.getPageQuery(query, virtualItemStartIndex, virtualItemEndIndex);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
const tempCustomFilter: boolean = this.parent.isCustomFilter;
|
|
123
|
+
if(this.component === 'combobox'){
|
|
124
|
+
let totalData: number = 0;
|
|
125
|
+
if(this.parent.dataSource instanceof DataManager){
|
|
126
|
+
totalData = this.parent.dataSource.dataSource.json.length;
|
|
127
|
+
}
|
|
128
|
+
else if(this.parent.dataSource && (this.parent.dataSource as any).length > 0){
|
|
129
|
+
totalData = (this.parent.dataSource as any).length;
|
|
130
|
+
}
|
|
131
|
+
if(totalData > 0){
|
|
132
|
+
this.parent.isCustomFilter = (totalData == this.parent.totalItemCount && this.parent.queryString != this.parent.typedString) ? true : this.parent.isCustomFilter;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
this.parent.resetList(dataSource, this.parent.fields, query);
|
|
136
|
+
this.parent.isCustomFilter = tempCustomFilter;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
private removeSkipAndTakeEvents (query: Query) : Query {
|
|
140
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
141
|
+
query.queries = query.queries.filter(function (event:any) {
|
|
142
|
+
return event.fn !== 'onSkip' && event.fn !== 'onTake';
|
|
143
|
+
});
|
|
144
|
+
return query;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
public setCurrentViewDataAsync(): void {
|
|
148
|
+
// eslint-disable-next-line
|
|
149
|
+
let currentData: any = [];
|
|
150
|
+
for (let i = this.parent.viewPortInfo.startIndex; i < this.parent.viewPortInfo.endIndex; i++) {
|
|
151
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
152
|
+
const alreadyAddedData: any = this.parent.generatedDataObject[i as number];
|
|
153
|
+
if (alreadyAddedData) {
|
|
154
|
+
currentData.push(alreadyAddedData[0]);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
this.parent.renderItems(currentData, this.parent.fields);
|
|
158
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
159
|
+
const virtualTrackElement = this.parent.list.getElementsByClassName('e-virtual-ddl')[0] as any;
|
|
160
|
+
if (virtualTrackElement) {
|
|
161
|
+
(virtualTrackElement).style = this.parent.GetVirtualTrackHeight();
|
|
162
|
+
}
|
|
163
|
+
this.parent.UpdateSkeleton();
|
|
164
|
+
this.parent.liCollections = <HTMLElement[] & NodeListOf<Element>>this.parent.list.querySelectorAll('.e-list-item');
|
|
165
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
166
|
+
const virtualContentElement = this.parent.list.getElementsByClassName('e-virtual-ddl-content')[0] as any;
|
|
167
|
+
if (virtualContentElement) {
|
|
168
|
+
(virtualContentElement).style = this.parent.getTransformValues();
|
|
169
|
+
}
|
|
170
|
+
if(this.parent.fields.groupBy){
|
|
171
|
+
this.parent.scrollStop();
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
private generateQueryAndSetQueryIndexAsync(query: Query, isPopupOpen?: boolean): void {
|
|
176
|
+
let isStartIndexInitialised: boolean = false;
|
|
177
|
+
let queryStartIndex: number = 0;
|
|
178
|
+
let queryEndIndex: number = 0;
|
|
179
|
+
let sortedDataStartIndex: number = 0;
|
|
180
|
+
let vEndIndex: number = this.parent && this.parent.viewPortInfo.endIndex !== 0 ? this.parent.viewPortInfo.endIndex : sortedDataStartIndex + this.parent.getItems().length;
|
|
181
|
+
if (!isPopupOpen && vEndIndex !== 0) {
|
|
182
|
+
for (let i = this.parent.viewPortInfo.startIndex; i <= vEndIndex; i++) {
|
|
183
|
+
if (!(i in this.parent.generatedDataObject)) {
|
|
184
|
+
if (!isStartIndexInitialised) {
|
|
185
|
+
isStartIndexInitialised = true;
|
|
186
|
+
queryStartIndex = queryEndIndex = i;
|
|
187
|
+
} else {
|
|
188
|
+
queryEndIndex = i === vEndIndex ? i : i + 1;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
if (isStartIndexInitialised && !((this.parent.totalItemCount == queryStartIndex) && (this.parent.totalItemCount == queryEndIndex))) {
|
|
194
|
+
this.parent.virtualItemStartIndex = queryStartIndex;
|
|
195
|
+
this.parent.virtualItemEndIndex = queryEndIndex;
|
|
196
|
+
this.generateAndExecuteQueryAsync(query, queryStartIndex, queryEndIndex);
|
|
197
|
+
}
|
|
198
|
+
this.setCurrentViewDataAsync();
|
|
199
|
+
}
|
|
200
|
+
private dataProcessAsync(isOpenPopup?: boolean): void {
|
|
201
|
+
this.parent.selectedValueInfo = null;
|
|
202
|
+
this.parent.virtualItemStartIndex = this.parent.viewPortInfo.startIndex;
|
|
203
|
+
this.parent.virtualItemEndIndex = this.parent.viewPortInfo.endIndex;
|
|
204
|
+
this.generateQueryAndSetQueryIndexAsync(new Query(), isOpenPopup);
|
|
205
|
+
}
|
|
206
|
+
private async virtualScrollRefreshAsync(): Promise<void> {
|
|
207
|
+
this.parent.isCustomFilter = (!(this.parent.isTyped || (this.component === 'combobox' && this.parent.allowFiltering && this.parent.queryString != this.parent.typedString) || (!isNullOrUndefined(this.parent.filterInput) && !isNullOrUndefined(this.parent.filterInput.value) && this.parent.filterInput.value !=='') && this.component !== 'combobox') && !(this.component === 'autocomplete' && this.parent.value != null)) || this.parent.isCustomFilter;
|
|
208
|
+
if (this.parent.allowFiltering || this.component === 'autocomplete') {
|
|
209
|
+
if (!isNullOrUndefined(this.parent.typedString) && !(this.component === 'combobox' && !isNullOrUndefined(this.parent.typedString) && this.parent.allowFiltering)) {
|
|
210
|
+
if (this.parent.viewPortInfo.endIndex >= this.parent.dataCount) {
|
|
211
|
+
this.parent.viewPortInfo.endIndex = this.parent.dataCount;
|
|
212
|
+
}
|
|
213
|
+
if (this.parent.viewPortInfo.startIndex >= this.parent.dataCount) {
|
|
214
|
+
this.parent.viewPortInfo.startIndex = this.parent.dataCount - this.parent.itemCount;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
else {
|
|
218
|
+
this.parent.getSkeletonCount(true);
|
|
219
|
+
if(this.component === 'combobox'){
|
|
220
|
+
this.parent.skeletonCount = this.parent.totalItemCount != 0 && this.parent.totalItemCount < (this.parent.itemCount * 2) ? 0 : this.parent.skeletonCount;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
await this.dataProcessAsync();
|
|
225
|
+
if (this.parent.keyboardEvent != null) {
|
|
226
|
+
this.parent.handleVirtualKeyboardActions(this.parent.keyboardEvent, this.parent.pageCount);
|
|
227
|
+
}
|
|
228
|
+
this.parent.isCustomFilter = false;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
public scrollListener(scrollArgs: ScrollArg): void {
|
|
232
|
+
if (!this.parent.isPreventScrollAction) {
|
|
233
|
+
let info: SentinelType = scrollArgs.sentinel;
|
|
234
|
+
let pStartIndex: number = this.parent.previousStartIndex;
|
|
235
|
+
this.parent.viewPortInfo = this.getInfoFromView(scrollArgs.direction, info, scrollArgs.offset, false);
|
|
236
|
+
this.parent.isUpwardScrolling = false;
|
|
237
|
+
if (this.parent.previousStartIndex !== pStartIndex && !this.parent.isKeyBoardAction) {
|
|
238
|
+
this.parent.isScrollActionTriggered = false;
|
|
239
|
+
this.parent.currentPageNumber = this.parent.viewPortInfo.currentPageNumber;
|
|
240
|
+
this.parent.virtualListInfo = { ...this.parent.viewPortInfo };
|
|
241
|
+
this.parent.isPreventKeyAction = true;
|
|
242
|
+
this.parent.isVirtualScrolling = true;
|
|
243
|
+
setTimeout(() => {
|
|
244
|
+
this.parent.pageCount = this.parent.getPageCount();
|
|
245
|
+
this.virtualScrollRefreshAsync().then(() => {
|
|
246
|
+
if (this.parent.popupObj) {
|
|
247
|
+
this.parent.list = this.parent.popupObj.element.querySelector('.' + 'e-content') || select('.' + 'e-content');
|
|
248
|
+
this.parent.updateSelectionList();
|
|
249
|
+
this.parent.liCollections = <HTMLElement[] & NodeListOf<Element>>this.parent.getItems();
|
|
250
|
+
}
|
|
251
|
+
this.parent.isKeyBoardAction = false;
|
|
252
|
+
this.parent.isVirtualScrolling = false;
|
|
253
|
+
this.parent.isPreventKeyAction = false;
|
|
254
|
+
});
|
|
255
|
+
}, 5);
|
|
256
|
+
}
|
|
257
|
+
else if (this.parent.isScrollActionTriggered) {
|
|
258
|
+
this.parent.isPreventKeyAction = false;
|
|
259
|
+
this.parent.isScrollActionTriggered = false;
|
|
260
|
+
let virtualListCount: number = this.parent.list.querySelectorAll('.e-virtual-list').length;
|
|
261
|
+
let listElement: HTMLElement = this.parent.list.querySelector('.' + 'e-list-item');
|
|
262
|
+
let translateY: number = scrollArgs.offset.top - (listElement.offsetHeight * virtualListCount);
|
|
263
|
+
(this.parent.list.getElementsByClassName('e-virtual-ddl-content') as HTMLCollectionOf<HTMLElement>)[0].style.transform = "translate(0px," + translateY + "px)"
|
|
264
|
+
}
|
|
265
|
+
this.parent.previousInfo = this.parent.viewPortInfo;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
private getPageCount(popupElement: HTMLElement, returnExactCount: boolean = false): number {
|
|
270
|
+
var list = popupElement && popupElement.querySelector('.e-content');
|
|
271
|
+
if (list) {
|
|
272
|
+
var liHeight = list.classList.contains('e-nodata') ? null : getComputedStyle(list.querySelectorAll('.e-list-item')[0], null).getPropertyValue('height');
|
|
273
|
+
var pageCount = list.getBoundingClientRect().height / parseInt(liHeight, 10)
|
|
274
|
+
return returnExactCount ? pageCount : Math.round(pageCount);
|
|
275
|
+
}
|
|
276
|
+
return 0;
|
|
277
|
+
};
|
|
278
|
+
|
|
279
|
+
private getRowHeight(): number {
|
|
280
|
+
return (isNullOrUndefined(this.parent.liCollections) || this.parent.liCollections.length == 0) ? 0 : Math.ceil(this.parent.liCollections[0].getBoundingClientRect().height);
|
|
281
|
+
}
|
|
282
|
+
private getInfoFromView(direction: string, info: SentinelType, e: Offsets, isscrollAction: boolean): VirtualInfo {
|
|
283
|
+
|
|
284
|
+
let infoType: VirtualInfo = {
|
|
285
|
+
direction: direction, sentinelInfo: info, offsets: e,
|
|
286
|
+
startIndex: this.parent.previousStartIndex, endIndex: this.parent.previousEndIndex
|
|
287
|
+
};
|
|
288
|
+
let vHeight: string | number = this.parent.popupContentElement.getBoundingClientRect().height;
|
|
289
|
+
//Row Start and End Index calculation
|
|
290
|
+
let rowHeight: number = this.parent.listItemHeight;
|
|
291
|
+
let exactTopIndex: number = e.top / rowHeight;
|
|
292
|
+
let infoViewIndices: number = vHeight / rowHeight;
|
|
293
|
+
let exactEndIndex: number = exactTopIndex + infoViewIndices;
|
|
294
|
+
let pageSizeBy4: number = this.parent.virtualItemCount / 4;
|
|
295
|
+
let totalItemCount: number = this.parent.totalItemCount;
|
|
296
|
+
if (infoType.direction === 'down') {
|
|
297
|
+
let sIndex: number = Math.round(exactEndIndex) - Math.round((pageSizeBy4));
|
|
298
|
+
|
|
299
|
+
if (isNullOrUndefined(infoType.startIndex) || (exactEndIndex >
|
|
300
|
+
(infoType.startIndex + Math.round((this.parent.virtualItemCount / 2 + pageSizeBy4)))
|
|
301
|
+
&& infoType.endIndex !== totalItemCount)) {
|
|
302
|
+
infoType.startIndex = sIndex >= 0 ? Math.round(sIndex) : 0;
|
|
303
|
+
infoType.startIndex = infoType.startIndex > exactTopIndex ? Math.floor(exactTopIndex) : infoType.startIndex;
|
|
304
|
+
let eIndex: number = infoType.startIndex + this.parent.virtualItemCount;
|
|
305
|
+
infoType.startIndex = eIndex < exactEndIndex ? (Math.ceil(exactEndIndex) - this.parent.virtualItemCount)
|
|
306
|
+
: infoType.startIndex;
|
|
307
|
+
infoType.endIndex = eIndex < totalItemCount ? eIndex : totalItemCount;
|
|
308
|
+
infoType.startIndex = eIndex >= totalItemCount ? (infoType.endIndex - this.parent.virtualItemCount > 0 ? infoType.endIndex - this.parent.virtualItemCount : 0) : infoType.startIndex;
|
|
309
|
+
infoType.currentPageNumber = Math.ceil(infoType.endIndex / this.parent.virtualItemCount);
|
|
310
|
+
}
|
|
311
|
+
} else if (infoType.direction === 'up') {
|
|
312
|
+
if (infoType.startIndex && infoType.endIndex) {
|
|
313
|
+
let loadAtIndex: number = Math.round(((infoType.startIndex * rowHeight) + (pageSizeBy4 * rowHeight)) / rowHeight);
|
|
314
|
+
if (exactTopIndex < loadAtIndex) {
|
|
315
|
+
let idxAddedToExactTop: number = (pageSizeBy4) > infoViewIndices ? pageSizeBy4 :
|
|
316
|
+
(infoViewIndices + infoViewIndices / 4);
|
|
317
|
+
let eIndex: number = Math.round(exactTopIndex + idxAddedToExactTop);
|
|
318
|
+
infoType.endIndex = eIndex < totalItemCount ? eIndex : totalItemCount;
|
|
319
|
+
let sIndex: number = infoType.endIndex - this.parent.virtualItemCount;
|
|
320
|
+
infoType.startIndex = sIndex > 0 ? sIndex : 0;
|
|
321
|
+
infoType.endIndex = sIndex < 0 ? this.parent.virtualItemCount : infoType.endIndex;
|
|
322
|
+
infoType.currentPageNumber = Math.ceil(infoType.startIndex / this.parent.virtualItemCount);
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
if (!isscrollAction) {
|
|
327
|
+
this.parent.previousStartIndex = infoType.startIndex;
|
|
328
|
+
this.parent.startIndex = infoType.startIndex;
|
|
329
|
+
this.parent.previousEndIndex = infoType.endIndex;
|
|
330
|
+
}
|
|
331
|
+
else {
|
|
332
|
+
this.parent.scrollPreStartIndex = infoType.startIndex;
|
|
333
|
+
}
|
|
334
|
+
return infoType;
|
|
335
|
+
}
|
|
336
|
+
private sentinelInfo: SentinelInfo = {
|
|
337
|
+
'up': {
|
|
338
|
+
check: (rect: ClientRect, info: SentinelType) => {
|
|
339
|
+
let top: number = rect.top - this.containerElementRect.top;
|
|
340
|
+
info.entered = top >= 0;
|
|
341
|
+
return top + (this.parent.listItemHeight * this.parent.virtualItemCount / 2) >= 0;
|
|
342
|
+
},
|
|
343
|
+
axis: 'Y'
|
|
344
|
+
},
|
|
345
|
+
'down': {
|
|
346
|
+
check: (rect: ClientRect, info: SentinelType) => {
|
|
347
|
+
let cHeight: number = this.parent.popupContentElement.clientHeight;
|
|
348
|
+
let top: number = rect.bottom;
|
|
349
|
+
info.entered = rect.bottom <= this.containerElementRect.bottom;
|
|
350
|
+
return top - (this.parent.listItemHeight * this.parent.virtualItemCount / 2) <= this.parent.listItemHeight * this.parent.virtualItemCount / 2;
|
|
351
|
+
}, axis: 'Y'
|
|
352
|
+
}
|
|
353
|
+
};
|
|
354
|
+
|
|
355
|
+
private virtualScrollHandler(callback?: Function): Function {
|
|
356
|
+
let delay: number = Browser.info.name === 'chrome' ? 200 : 100;
|
|
357
|
+
let prevTop: number = 0; let debounced100: Function = debounce(callback, delay);
|
|
358
|
+
let debounced50: Function = debounce(callback, 50);
|
|
359
|
+
return (e: Event) => {
|
|
360
|
+
let top: number = (<HTMLElement>e.target).scrollTop;
|
|
361
|
+
let left: number = (<HTMLElement>e.target).scrollLeft;
|
|
362
|
+
let direction: ScrollDirection = prevTop < top && !this.parent.isUpwardScrolling ? 'down' : 'up';
|
|
363
|
+
prevTop = top;
|
|
364
|
+
let current: SentinelType = this.sentinelInfo[direction as 'up' | 'down'];
|
|
365
|
+
var pstartIndex = this.parent.scrollPreStartIndex;
|
|
366
|
+
var scrollOffsetargs = {
|
|
367
|
+
top: top,
|
|
368
|
+
left: left
|
|
369
|
+
}
|
|
370
|
+
if (this.parent.list.querySelectorAll('.e-virtual-list').length > 0) {
|
|
371
|
+
var infoview = this.getInfoFromView(direction, current, scrollOffsetargs, true)
|
|
372
|
+
if (this.parent.scrollPreStartIndex != pstartIndex && !this.parent.isPreventScrollAction) {
|
|
373
|
+
this.parent.isScrollActionTriggered = true;
|
|
374
|
+
let virtualPoup: HTMLElement = (this.parent.list.querySelector('.e-virtual-ddl-content'));
|
|
375
|
+
virtualPoup.style.transform = "translate(0px," + top + "px)";
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
let debounceFunction: Function = debounced100;
|
|
379
|
+
if (current.axis === 'X') { debounceFunction = debounced50; }
|
|
380
|
+
debounceFunction({ direction: direction, sentinel: current, offset: { top: top, left: left },
|
|
381
|
+
focusElement: document.activeElement});
|
|
382
|
+
};
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
public destroy(): void {
|
|
386
|
+
this.removeEventListener();
|
|
387
|
+
}
|
|
388
|
+
}
|