@syncfusion/ej2-dropdowns 22.2.12 → 23.1.36
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 +260 -0
- package/CHANGELOG.md +2 -215
- package/dist/ej2-dropdowns.min.js +2 -2
- package/dist/ej2-dropdowns.umd.min.js +2 -2
- package/dist/ej2-dropdowns.umd.min.js.map +1 -1
- package/dist/es6/ej2-dropdowns.es2015.js +1118 -66
- package/dist/es6/ej2-dropdowns.es2015.js.map +1 -1
- package/dist/es6/ej2-dropdowns.es5.js +1172 -62
- package/dist/es6/ej2-dropdowns.es5.js.map +1 -1
- package/dist/global/ej2-dropdowns.min.js +2 -2
- package/dist/global/ej2-dropdowns.min.js.map +1 -1
- package/dist/global/index.d.ts +1 -1
- package/package.json +13 -12
- package/src/auto-complete/auto-complete.js +40 -2
- package/src/combo-box/combo-box.js +9 -3
- package/src/common/index.d.ts +2 -0
- package/src/common/index.js +1 -0
- package/src/common/interface.d.ts +76 -0
- package/src/common/interface.js +1 -0
- package/src/common/virtual-scroll.d.ts +61 -0
- package/src/common/virtual-scroll.js +376 -0
- package/src/drop-down-base/drop-down-base.d.ts +10 -4
- package/src/drop-down-base/drop-down-base.js +72 -8
- package/src/drop-down-list/drop-down-list-model.d.ts +8 -1
- package/src/drop-down-list/drop-down-list.d.ts +55 -1
- package/src/drop-down-list/drop-down-list.js +635 -37
- package/src/drop-down-list/index.d.ts +1 -0
- package/src/drop-down-list/index.js +1 -0
- package/src/drop-down-tree/drop-down-tree.d.ts +1 -1
- package/src/global.js +3 -0
- package/src/mention/mention.js +8 -1
- package/src/multi-select/checkbox-selection.js +1 -1
- package/src/multi-select/multi-select.d.ts +1 -0
- package/src/multi-select/multi-select.js +34 -8
- package/styles/auto-complete/bootstrap-dark.scss +1 -1
- package/styles/auto-complete/bootstrap.scss +1 -1
- package/styles/auto-complete/bootstrap4.scss +1 -1
- package/styles/auto-complete/bootstrap5-dark.scss +1 -1
- package/styles/auto-complete/bootstrap5.scss +1 -1
- package/styles/auto-complete/fabric-dark.scss +1 -1
- package/styles/auto-complete/fabric.scss +1 -1
- package/styles/auto-complete/fluent-dark.scss +1 -1
- package/styles/auto-complete/fluent.scss +1 -1
- package/styles/auto-complete/highcontrast-light.scss +1 -1
- package/styles/auto-complete/highcontrast.scss +1 -1
- package/styles/auto-complete/material-dark.css +0 -1
- package/styles/auto-complete/material-dark.scss +1 -1
- package/styles/auto-complete/material.css +0 -1
- package/styles/auto-complete/material.scss +1 -1
- package/styles/auto-complete/material3-dark.css +0 -1
- package/styles/auto-complete/material3-dark.scss +1 -1
- package/styles/auto-complete/material3.css +0 -1
- package/styles/auto-complete/material3.scss +1 -1
- package/styles/auto-complete/tailwind-dark.css +0 -1
- package/styles/auto-complete/tailwind-dark.scss +1 -1
- package/styles/auto-complete/tailwind.css +0 -1
- package/styles/auto-complete/tailwind.scss +1 -1
- package/styles/bootstrap-dark.css +0 -8
- package/styles/bootstrap.css +0 -8
- package/styles/bootstrap4.css +4 -12
- package/styles/bootstrap5-dark.css +0 -8
- package/styles/bootstrap5.css +0 -8
- package/styles/combo-box/bootstrap-dark.scss +1 -1
- package/styles/combo-box/bootstrap.scss +1 -1
- package/styles/combo-box/bootstrap4.scss +1 -1
- package/styles/combo-box/bootstrap5-dark.scss +1 -1
- package/styles/combo-box/bootstrap5.scss +1 -1
- package/styles/combo-box/fabric-dark.scss +1 -1
- package/styles/combo-box/fabric.scss +1 -1
- package/styles/combo-box/fluent-dark.scss +1 -1
- package/styles/combo-box/fluent.scss +1 -1
- package/styles/combo-box/highcontrast-light.scss +1 -1
- package/styles/combo-box/highcontrast.scss +1 -1
- package/styles/combo-box/material-dark.css +0 -1
- package/styles/combo-box/material-dark.scss +1 -1
- package/styles/combo-box/material.css +0 -1
- package/styles/combo-box/material.scss +1 -1
- package/styles/combo-box/material3-dark.css +0 -1
- package/styles/combo-box/material3-dark.scss +1 -1
- package/styles/combo-box/material3.css +0 -1
- package/styles/combo-box/material3.scss +1 -1
- package/styles/combo-box/tailwind-dark.css +0 -1
- package/styles/combo-box/tailwind-dark.scss +1 -1
- package/styles/combo-box/tailwind.css +0 -1
- package/styles/combo-box/tailwind.scss +1 -1
- package/styles/drop-down-base/bootstrap-dark.scss +1 -1
- package/styles/drop-down-base/bootstrap.scss +1 -1
- package/styles/drop-down-base/bootstrap4.scss +1 -1
- package/styles/drop-down-base/bootstrap5-dark.scss +1 -1
- package/styles/drop-down-base/bootstrap5.scss +1 -1
- package/styles/drop-down-base/fabric-dark.scss +1 -1
- package/styles/drop-down-base/fabric.scss +1 -1
- package/styles/drop-down-base/fluent-dark.scss +1 -1
- package/styles/drop-down-base/fluent.scss +1 -1
- package/styles/drop-down-base/highcontrast-light.scss +1 -1
- package/styles/drop-down-base/highcontrast.scss +1 -1
- package/styles/drop-down-base/material-dark.css +0 -1
- package/styles/drop-down-base/material-dark.scss +1 -1
- package/styles/drop-down-base/material.css +0 -1
- package/styles/drop-down-base/material.scss +1 -1
- package/styles/drop-down-base/material3-dark.css +0 -1
- package/styles/drop-down-base/material3-dark.scss +1 -1
- package/styles/drop-down-base/material3.css +0 -1
- package/styles/drop-down-base/material3.scss +1 -1
- package/styles/drop-down-base/tailwind-dark.css +0 -1
- package/styles/drop-down-base/tailwind-dark.scss +1 -1
- package/styles/drop-down-base/tailwind.css +0 -1
- package/styles/drop-down-base/tailwind.scss +1 -1
- package/styles/drop-down-list/bootstrap-dark.scss +2 -1
- package/styles/drop-down-list/bootstrap.scss +2 -1
- package/styles/drop-down-list/bootstrap4.scss +2 -1
- package/styles/drop-down-list/bootstrap5-dark.scss +2 -1
- package/styles/drop-down-list/bootstrap5.scss +2 -1
- package/styles/drop-down-list/fabric-dark.scss +2 -1
- package/styles/drop-down-list/fabric.scss +2 -1
- package/styles/drop-down-list/fluent-dark.scss +2 -1
- package/styles/drop-down-list/fluent.scss +2 -1
- package/styles/drop-down-list/highcontrast-light.scss +2 -1
- package/styles/drop-down-list/highcontrast.scss +2 -1
- package/styles/drop-down-list/material-dark.css +0 -1
- package/styles/drop-down-list/material-dark.scss +2 -1
- package/styles/drop-down-list/material.css +0 -1
- package/styles/drop-down-list/material.scss +2 -1
- package/styles/drop-down-list/material3-dark.css +0 -1
- package/styles/drop-down-list/material3-dark.scss +2 -1
- package/styles/drop-down-list/material3.css +0 -1
- package/styles/drop-down-list/material3.scss +2 -1
- package/styles/drop-down-list/tailwind-dark.css +0 -1
- package/styles/drop-down-list/tailwind-dark.scss +2 -1
- package/styles/drop-down-list/tailwind.css +0 -1
- package/styles/drop-down-list/tailwind.scss +2 -1
- package/styles/drop-down-tree/bootstrap-dark.scss +1 -1
- package/styles/drop-down-tree/bootstrap.scss +1 -1
- package/styles/drop-down-tree/bootstrap4.scss +1 -1
- package/styles/drop-down-tree/bootstrap5-dark.scss +1 -1
- package/styles/drop-down-tree/bootstrap5.scss +1 -1
- package/styles/drop-down-tree/fabric-dark.scss +1 -1
- package/styles/drop-down-tree/fabric.scss +1 -1
- package/styles/drop-down-tree/fluent-dark.scss +1 -1
- package/styles/drop-down-tree/fluent.scss +1 -1
- package/styles/drop-down-tree/highcontrast-light.scss +1 -1
- package/styles/drop-down-tree/highcontrast.scss +1 -1
- package/styles/drop-down-tree/material-dark.css +0 -1
- package/styles/drop-down-tree/material-dark.scss +1 -1
- package/styles/drop-down-tree/material.css +0 -1
- package/styles/drop-down-tree/material.scss +1 -1
- package/styles/drop-down-tree/material3-dark.css +0 -1
- package/styles/drop-down-tree/material3-dark.scss +1 -1
- package/styles/drop-down-tree/material3.css +0 -1
- package/styles/drop-down-tree/material3.scss +1 -1
- package/styles/drop-down-tree/tailwind-dark.css +0 -1
- package/styles/drop-down-tree/tailwind-dark.scss +1 -1
- package/styles/drop-down-tree/tailwind.css +0 -1
- package/styles/drop-down-tree/tailwind.scss +1 -1
- package/styles/fabric-dark.css +0 -8
- package/styles/fabric.css +0 -8
- package/styles/fluent-dark.css +4 -12
- package/styles/fluent.css +4 -12
- package/styles/highcontrast-light.css +0 -8
- package/styles/highcontrast.css +0 -8
- package/styles/list-box/_bootstrap4-definition.scss +4 -4
- package/styles/list-box/_fluent-definition.scss +4 -4
- package/styles/list-box/_layout.scss +0 -6
- package/styles/list-box/_material3-definition.scss +4 -4
- package/styles/list-box/_tailwind-definition.scss +3 -3
- package/styles/list-box/bootstrap-dark.css +0 -8
- package/styles/list-box/bootstrap-dark.scss +1 -1
- package/styles/list-box/bootstrap.css +0 -8
- package/styles/list-box/bootstrap.scss +1 -1
- package/styles/list-box/bootstrap4.css +4 -12
- package/styles/list-box/bootstrap4.scss +1 -1
- package/styles/list-box/bootstrap5-dark.css +0 -8
- package/styles/list-box/bootstrap5-dark.scss +1 -1
- package/styles/list-box/bootstrap5.css +0 -8
- package/styles/list-box/bootstrap5.scss +1 -1
- package/styles/list-box/fabric-dark.css +0 -8
- package/styles/list-box/fabric-dark.scss +1 -1
- package/styles/list-box/fabric.css +0 -8
- package/styles/list-box/fabric.scss +1 -1
- package/styles/list-box/fluent-dark.css +4 -12
- package/styles/list-box/fluent-dark.scss +1 -1
- package/styles/list-box/fluent.css +4 -12
- package/styles/list-box/fluent.scss +1 -1
- package/styles/list-box/highcontrast-light.css +0 -8
- package/styles/list-box/highcontrast-light.scss +1 -1
- package/styles/list-box/highcontrast.css +0 -8
- package/styles/list-box/highcontrast.scss +1 -1
- package/styles/list-box/material-dark.css +0 -9
- package/styles/list-box/material-dark.scss +1 -1
- package/styles/list-box/material.css +0 -9
- package/styles/list-box/material.scss +1 -1
- package/styles/list-box/material3-dark.css +4 -13
- package/styles/list-box/material3-dark.scss +1 -1
- package/styles/list-box/material3.css +4 -13
- package/styles/list-box/material3.scss +1 -1
- package/styles/list-box/tailwind-dark.css +3 -12
- package/styles/list-box/tailwind-dark.scss +1 -1
- package/styles/list-box/tailwind.css +3 -12
- package/styles/list-box/tailwind.scss +1 -1
- package/styles/material-dark.css +0 -9
- package/styles/material.css +0 -9
- package/styles/material3-dark.css +4 -13
- package/styles/material3-dark.scss +1 -1
- package/styles/material3.css +4 -13
- package/styles/material3.scss +1 -1
- package/styles/mention/bootstrap-dark.scss +1 -1
- package/styles/mention/bootstrap.scss +1 -1
- package/styles/mention/bootstrap4.scss +1 -1
- package/styles/mention/bootstrap5-dark.scss +1 -1
- package/styles/mention/bootstrap5.scss +1 -1
- package/styles/mention/fabric-dark.scss +1 -1
- package/styles/mention/fabric.scss +1 -1
- package/styles/mention/fluent-dark.scss +1 -1
- package/styles/mention/fluent.scss +1 -1
- package/styles/mention/highcontrast-light.scss +1 -1
- package/styles/mention/highcontrast.scss +1 -1
- package/styles/mention/material-dark.css +0 -1
- package/styles/mention/material-dark.scss +1 -1
- package/styles/mention/material.css +0 -1
- package/styles/mention/material.scss +1 -1
- package/styles/mention/material3-dark.css +0 -1
- package/styles/mention/material3-dark.scss +1 -1
- package/styles/mention/material3.css +0 -1
- package/styles/mention/material3.scss +1 -1
- package/styles/mention/tailwind-dark.css +0 -1
- package/styles/mention/tailwind-dark.scss +1 -1
- package/styles/mention/tailwind.css +0 -1
- package/styles/mention/tailwind.scss +1 -1
- package/styles/multi-select/bootstrap-dark.scss +1 -1
- package/styles/multi-select/bootstrap.scss +1 -1
- package/styles/multi-select/bootstrap4.scss +1 -1
- package/styles/multi-select/bootstrap5-dark.scss +1 -1
- package/styles/multi-select/bootstrap5.scss +1 -1
- package/styles/multi-select/fabric-dark.scss +1 -1
- package/styles/multi-select/fabric.scss +1 -1
- package/styles/multi-select/fluent-dark.scss +1 -1
- package/styles/multi-select/fluent.scss +1 -1
- package/styles/multi-select/highcontrast-light.scss +1 -1
- package/styles/multi-select/highcontrast.scss +1 -1
- package/styles/multi-select/material-dark.css +0 -1
- package/styles/multi-select/material-dark.scss +1 -1
- package/styles/multi-select/material.css +0 -1
- package/styles/multi-select/material.scss +1 -1
- package/styles/multi-select/material3-dark.css +0 -1
- package/styles/multi-select/material3-dark.scss +1 -1
- package/styles/multi-select/material3.css +0 -1
- package/styles/multi-select/material3.scss +1 -1
- package/styles/multi-select/tailwind-dark.css +0 -1
- package/styles/multi-select/tailwind-dark.scss +1 -1
- package/styles/multi-select/tailwind.css +0 -1
- package/styles/multi-select/tailwind.scss +1 -1
- package/styles/tailwind-dark.css +3 -19
- package/styles/tailwind.css +3 -19
- package/tslint.json +111 -0
|
@@ -28,6 +28,8 @@ import { Input } from '@syncfusion/ej2-inputs';
|
|
|
28
28
|
import { incrementalSearch, resetIncrementalSearchValues } from '../common/incremental-search';
|
|
29
29
|
import { DropDownBase, dropDownBaseClasses } from '../drop-down-base/drop-down-base';
|
|
30
30
|
import { DataManager, Query, Predicate } from '@syncfusion/ej2-data';
|
|
31
|
+
import { Skeleton } from '@syncfusion/ej2-notifications';
|
|
32
|
+
[];
|
|
31
33
|
// don't use space in classnames
|
|
32
34
|
export var dropDownListClasses = {
|
|
33
35
|
root: 'e-dropdownlist',
|
|
@@ -38,6 +40,7 @@ export var dropDownListClasses = {
|
|
|
38
40
|
disable: dropDownBaseClasses.disabled,
|
|
39
41
|
base: dropDownBaseClasses.root,
|
|
40
42
|
focus: dropDownBaseClasses.focus,
|
|
43
|
+
content: dropDownBaseClasses.content,
|
|
41
44
|
input: 'e-input-group',
|
|
42
45
|
inputFocus: 'e-input-focus',
|
|
43
46
|
icon: 'e-input-group-icon e-ddl-icon',
|
|
@@ -55,7 +58,8 @@ export var dropDownListClasses = {
|
|
|
55
58
|
clearIconHide: 'e-clear-icon-hide',
|
|
56
59
|
popupFullScreen: 'e-popup-full-page',
|
|
57
60
|
disableIcon: 'e-ddl-disable-icon',
|
|
58
|
-
hiddenElement: 'e-ddl-hidden'
|
|
61
|
+
hiddenElement: 'e-ddl-hidden',
|
|
62
|
+
virtualList: 'e-list-item e-virtual-list',
|
|
59
63
|
};
|
|
60
64
|
var inputObject = {
|
|
61
65
|
container: null,
|
|
@@ -83,9 +87,52 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
83
87
|
*/
|
|
84
88
|
function DropDownList(options, element) {
|
|
85
89
|
var _this = _super.call(this, options, element) || this;
|
|
90
|
+
_this.skeletonCount = 32;
|
|
86
91
|
_this.isListSearched = false;
|
|
87
92
|
_this.preventChange = false;
|
|
88
93
|
_this.isAngular = false;
|
|
94
|
+
_this.itemCount = 10;
|
|
95
|
+
_this.virtualListHeight = 0;
|
|
96
|
+
_this.isVirtualScrolling = false;
|
|
97
|
+
_this.isPreventScrollAction = false;
|
|
98
|
+
_this.scrollPreStartIndex = 0;
|
|
99
|
+
_this.isScrollActionTriggered = false;
|
|
100
|
+
_this.previousStartIndex = 0;
|
|
101
|
+
_this.isMouseScrollAction = false;
|
|
102
|
+
_this.isKeyBoardAction = false;
|
|
103
|
+
_this.isUpwardScrolling = false;
|
|
104
|
+
_this.startIndex = 0;
|
|
105
|
+
_this.currentPageNumber = 0;
|
|
106
|
+
_this.pageCount = 0;
|
|
107
|
+
_this.isPreventKeyAction = false;
|
|
108
|
+
_this.generatedDataObject = {};
|
|
109
|
+
_this.virtualListInfo = {
|
|
110
|
+
currentPageNumber: null,
|
|
111
|
+
direction: null,
|
|
112
|
+
sentinelInfo: {},
|
|
113
|
+
offsets: {},
|
|
114
|
+
startIndex: 0,
|
|
115
|
+
endIndex: 0,
|
|
116
|
+
};
|
|
117
|
+
_this.viewPortInfo = {
|
|
118
|
+
currentPageNumber: null,
|
|
119
|
+
direction: null,
|
|
120
|
+
sentinelInfo: {},
|
|
121
|
+
offsets: {},
|
|
122
|
+
startIndex: 0,
|
|
123
|
+
endIndex: 0,
|
|
124
|
+
};
|
|
125
|
+
_this.selectedValueInfo = {
|
|
126
|
+
currentPageNumber: null,
|
|
127
|
+
direction: null,
|
|
128
|
+
sentinelInfo: {},
|
|
129
|
+
offsets: {},
|
|
130
|
+
startIndex: 0,
|
|
131
|
+
endIndex: 0,
|
|
132
|
+
};
|
|
133
|
+
_this.IsScrollerAtEnd = function () {
|
|
134
|
+
return this.list && this.list.scrollTop + this.list.clientHeight >= this.list.scrollHeight;
|
|
135
|
+
};
|
|
89
136
|
return _this;
|
|
90
137
|
}
|
|
91
138
|
/**
|
|
@@ -144,14 +191,31 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
144
191
|
hide: 'alt+38',
|
|
145
192
|
space: '32'
|
|
146
193
|
};
|
|
194
|
+
this.viewPortInfo = {
|
|
195
|
+
currentPageNumber: null,
|
|
196
|
+
direction: null,
|
|
197
|
+
sentinelInfo: {},
|
|
198
|
+
offsets: {},
|
|
199
|
+
startIndex: 0,
|
|
200
|
+
endIndex: this.itemCount,
|
|
201
|
+
};
|
|
147
202
|
};
|
|
148
203
|
DropDownList.prototype.setZIndex = function () {
|
|
149
204
|
if (this.popupObj) {
|
|
150
205
|
this.popupObj.setProperties({ 'zIndex': this.zIndex });
|
|
151
206
|
}
|
|
152
207
|
};
|
|
208
|
+
DropDownList.prototype.requiredModules = function () {
|
|
209
|
+
var modules = [];
|
|
210
|
+
if (this.enableVirtualization) {
|
|
211
|
+
modules.push({ args: [this], member: 'VirtualScroll' });
|
|
212
|
+
}
|
|
213
|
+
return modules;
|
|
214
|
+
};
|
|
153
215
|
DropDownList.prototype.renderList = function (e, isEmptyData) {
|
|
154
216
|
_super.prototype.render.call(this, e, isEmptyData);
|
|
217
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
218
|
+
this.totalItemCount = this.dataSource && this.dataSource.length ? this.dataSource.length : 0;
|
|
155
219
|
this.unWireListEvents();
|
|
156
220
|
this.wireListEvents();
|
|
157
221
|
};
|
|
@@ -169,6 +233,12 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
169
233
|
DropDownList.prototype.resetHandler = function (e) {
|
|
170
234
|
e.preventDefault();
|
|
171
235
|
this.clearAll(e);
|
|
236
|
+
if (this.enableVirtualization) {
|
|
237
|
+
this.list.scrollTop = 0;
|
|
238
|
+
this.virtualListInfo = null;
|
|
239
|
+
this.previousStartIndex = 0;
|
|
240
|
+
this.previousEndIndex = 0;
|
|
241
|
+
}
|
|
172
242
|
};
|
|
173
243
|
DropDownList.prototype.resetFocusElement = function () {
|
|
174
244
|
this.removeHover();
|
|
@@ -177,6 +247,9 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
177
247
|
this.list.scrollTop = 0;
|
|
178
248
|
if (this.getModuleName() !== 'autocomplete' && !isNullOrUndefined(this.ulElement)) {
|
|
179
249
|
var li = this.ulElement.querySelector('.' + dropDownListClasses.li);
|
|
250
|
+
if (this.enableVirtualization) {
|
|
251
|
+
li = this.liCollections[this.skeletonCount];
|
|
252
|
+
}
|
|
180
253
|
if (li) {
|
|
181
254
|
li.classList.add(dropDownListClasses.focus);
|
|
182
255
|
}
|
|
@@ -195,6 +268,10 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
195
268
|
return;
|
|
196
269
|
}
|
|
197
270
|
this.onChangeEvent(e);
|
|
271
|
+
this.checkAndResetCache();
|
|
272
|
+
if (this.enableVirtualization) {
|
|
273
|
+
this.updateInitialData();
|
|
274
|
+
}
|
|
198
275
|
};
|
|
199
276
|
DropDownList.prototype.resetSelection = function (properties) {
|
|
200
277
|
if (this.list) {
|
|
@@ -261,10 +338,10 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
261
338
|
this.inputWrapper.container.setAttribute('style', this.htmlAttributes["" + htmlAttr]);
|
|
262
339
|
}
|
|
263
340
|
else if (htmlAttr === 'aria-label') {
|
|
264
|
-
if (this.getModuleName() === 'autocomplete' || this.getModuleName() === 'combobox') {
|
|
341
|
+
if ((this.getModuleName() === 'autocomplete' || this.getModuleName() === 'combobox') && !this.readonly) {
|
|
265
342
|
this.inputElement.setAttribute('aria-label', this.htmlAttributes["" + htmlAttr]);
|
|
266
343
|
}
|
|
267
|
-
else {
|
|
344
|
+
else if (this.getModuleName() === 'dropdownlist') {
|
|
268
345
|
this.inputWrapper.container.setAttribute('aria-label', this.htmlAttributes["" + htmlAttr]);
|
|
269
346
|
}
|
|
270
347
|
}
|
|
@@ -364,6 +441,8 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
364
441
|
return item;
|
|
365
442
|
};
|
|
366
443
|
DropDownList.prototype.initValue = function () {
|
|
444
|
+
this.viewPortInfo.startIndex = this.virtualItemStartIndex = 0;
|
|
445
|
+
this.viewPortInfo.endIndex = this.virtualItemEndIndex = this.itemCount;
|
|
367
446
|
this.renderList();
|
|
368
447
|
if (this.dataSource instanceof DataManager) {
|
|
369
448
|
this.initRemoteRender = true;
|
|
@@ -373,6 +452,7 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
373
452
|
}
|
|
374
453
|
};
|
|
375
454
|
DropDownList.prototype.updateValues = function () {
|
|
455
|
+
this.selectedValueInfo = this.viewPortInfo;
|
|
376
456
|
if (!isNullOrUndefined(this.value)) {
|
|
377
457
|
this.setSelection(this.getElementByValue(this.value), null);
|
|
378
458
|
}
|
|
@@ -561,6 +641,7 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
561
641
|
};
|
|
562
642
|
DropDownList.prototype.onMouseClick = function (e) {
|
|
563
643
|
var target = e.target;
|
|
644
|
+
this.keyboardEvent = null;
|
|
564
645
|
var li = closest(target, '.' + dropDownBaseClasses.li);
|
|
565
646
|
if (!this.isValidLI(li)) {
|
|
566
647
|
return;
|
|
@@ -641,6 +722,10 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
641
722
|
if (!this.enabled) {
|
|
642
723
|
return;
|
|
643
724
|
}
|
|
725
|
+
this.keyboardEvent = e;
|
|
726
|
+
if (this.isPreventKeyAction && this.enableVirtualization) {
|
|
727
|
+
e.preventDefault();
|
|
728
|
+
}
|
|
644
729
|
var preventAction = e.action === 'pageUp' || e.action === 'pageDown';
|
|
645
730
|
var preventHomeEnd = this.getModuleName() !== 'dropdownlist' && (e.action === 'home' || e.action === 'end');
|
|
646
731
|
this.isEscapeKey = e.action === 'escape';
|
|
@@ -680,9 +765,11 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
680
765
|
e.preventDefault();
|
|
681
766
|
break;
|
|
682
767
|
case 'home':
|
|
768
|
+
this.isMouseScrollAction = true;
|
|
683
769
|
this.updateHomeEndAction(e);
|
|
684
770
|
break;
|
|
685
771
|
case 'end':
|
|
772
|
+
this.isMouseScrollAction = true;
|
|
686
773
|
this.updateHomeEndAction(e);
|
|
687
774
|
break;
|
|
688
775
|
case 'space':
|
|
@@ -716,13 +803,19 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
716
803
|
}
|
|
717
804
|
}
|
|
718
805
|
};
|
|
719
|
-
DropDownList.prototype.updateUpDownAction = function (e) {
|
|
806
|
+
DropDownList.prototype.updateUpDownAction = function (e, isVirtualKeyAction) {
|
|
720
807
|
var focusEle = this.list.querySelector('.' + dropDownListClasses.focus);
|
|
721
|
-
if (this.isSelectFocusItem(focusEle)) {
|
|
808
|
+
if (this.isSelectFocusItem(focusEle) && !isVirtualKeyAction) {
|
|
722
809
|
this.setSelection(focusEle, e);
|
|
810
|
+
if (this.enableVirtualization) {
|
|
811
|
+
var selectedLiOffsetTop = this.virtualListInfo && this.virtualListInfo.startIndex ? this.selectedLI.offsetTop + (this.virtualListInfo.startIndex * this.selectedLI.offsetHeight) : this.selectedLI.offsetTop;
|
|
812
|
+
this.list.scrollTop = selectedLiOffsetTop - (this.list.querySelectorAll('.e-virtual-list').length * this.selectedLI.offsetHeight);
|
|
813
|
+
}
|
|
723
814
|
}
|
|
724
815
|
else if (!isNullOrUndefined(this.liCollections)) {
|
|
816
|
+
var virtualIndex = this.activeIndex;
|
|
725
817
|
var index = e.action === 'down' ? this.activeIndex + 1 : this.activeIndex - 1;
|
|
818
|
+
index = isVirtualKeyAction ? virtualIndex : index;
|
|
726
819
|
var startIndex = 0;
|
|
727
820
|
if (this.getModuleName() === 'autocomplete') {
|
|
728
821
|
startIndex = e.action === 'down' && isNullOrUndefined(this.activeIndex) ? 0 : this.liCollections.length - 1;
|
|
@@ -730,8 +823,26 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
730
823
|
}
|
|
731
824
|
var nextItem = void 0;
|
|
732
825
|
if (this.getModuleName() !== 'autocomplete' || this.getModuleName() === 'autocomplete' && this.isPopupOpen) {
|
|
733
|
-
|
|
734
|
-
|
|
826
|
+
if (!this.enableVirtualization) {
|
|
827
|
+
nextItem = isNullOrUndefined(this.activeIndex) ? this.liCollections[startIndex]
|
|
828
|
+
: this.liCollections[index];
|
|
829
|
+
}
|
|
830
|
+
else {
|
|
831
|
+
if (!isVirtualKeyAction) {
|
|
832
|
+
nextItem = isNullOrUndefined(this.activeIndex) ? this.liCollections[this.skeletonCount]
|
|
833
|
+
: this.liCollections[index];
|
|
834
|
+
nextItem = !isNullOrUndefined(nextItem) && !nextItem.classList.contains('e-virtual-list') ? nextItem : null;
|
|
835
|
+
}
|
|
836
|
+
else {
|
|
837
|
+
if (this.getModuleName() === 'autocomplete') {
|
|
838
|
+
var value = this.selectedLI.dataset.value;
|
|
839
|
+
nextItem = this.getElementByValue(value);
|
|
840
|
+
}
|
|
841
|
+
else {
|
|
842
|
+
nextItem = this.getElementByValue(this.getItemData().value);
|
|
843
|
+
}
|
|
844
|
+
}
|
|
845
|
+
}
|
|
735
846
|
}
|
|
736
847
|
if (!isNullOrUndefined(nextItem)) {
|
|
737
848
|
this.setSelection(nextItem, e);
|
|
@@ -739,17 +850,23 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
739
850
|
}
|
|
740
851
|
e.preventDefault();
|
|
741
852
|
};
|
|
742
|
-
DropDownList.prototype.updateHomeEndAction = function (e) {
|
|
853
|
+
DropDownList.prototype.updateHomeEndAction = function (e, isVirtualKeyAction) {
|
|
743
854
|
if (this.getModuleName() === 'dropdownlist') {
|
|
744
855
|
var findLi = 0;
|
|
745
856
|
if (e.action === 'home') {
|
|
746
857
|
findLi = 0;
|
|
858
|
+
if (this.enableVirtualization) {
|
|
859
|
+
findLi = this.skeletonCount;
|
|
860
|
+
}
|
|
747
861
|
}
|
|
748
862
|
else {
|
|
749
863
|
findLi = this.getItems().length - 1;
|
|
750
864
|
}
|
|
751
865
|
e.preventDefault();
|
|
752
866
|
if (this.activeIndex === findLi) {
|
|
867
|
+
if (isVirtualKeyAction) {
|
|
868
|
+
this.setSelection(this.liCollections[findLi], e);
|
|
869
|
+
}
|
|
753
870
|
return;
|
|
754
871
|
}
|
|
755
872
|
this.setSelection(this.liCollections[findLi], e);
|
|
@@ -787,6 +904,36 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
787
904
|
}
|
|
788
905
|
}
|
|
789
906
|
};
|
|
907
|
+
DropDownList.prototype.handleVirtualKeyboardActions = function (e, pageCount) {
|
|
908
|
+
switch (e.action) {
|
|
909
|
+
case 'down':
|
|
910
|
+
case 'up':
|
|
911
|
+
if (this.itemData != null || this.getModuleName() === 'autocomplete') {
|
|
912
|
+
this.updateUpDownAction(e, true);
|
|
913
|
+
}
|
|
914
|
+
break;
|
|
915
|
+
case 'pageUp':
|
|
916
|
+
var count = (pageCount * 2) - 4;
|
|
917
|
+
this.activeIndex = Math.round(count);
|
|
918
|
+
this.pageUpSelection(this.activeIndex - this.getPageCount(), e, true);
|
|
919
|
+
e.preventDefault();
|
|
920
|
+
break;
|
|
921
|
+
case 'pageDown':
|
|
922
|
+
this.activeIndex = 1;
|
|
923
|
+
this.pageDownSelection(this.activeIndex + this.getPageCount(), e, true);
|
|
924
|
+
e.preventDefault();
|
|
925
|
+
break;
|
|
926
|
+
case 'home':
|
|
927
|
+
this.isMouseScrollAction = true;
|
|
928
|
+
this.updateHomeEndAction(e, true);
|
|
929
|
+
break;
|
|
930
|
+
case 'end':
|
|
931
|
+
this.isMouseScrollAction = true;
|
|
932
|
+
this.updateHomeEndAction(e, true);
|
|
933
|
+
break;
|
|
934
|
+
}
|
|
935
|
+
this.keyboardEvent = null;
|
|
936
|
+
};
|
|
790
937
|
DropDownList.prototype.selectCurrentItem = function (e) {
|
|
791
938
|
if (this.isPopupOpen) {
|
|
792
939
|
var li = this.list.querySelector('.' + dropDownListClasses.focus);
|
|
@@ -808,18 +955,28 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
808
955
|
DropDownList.prototype.isSelectFocusItem = function (element) {
|
|
809
956
|
return !isNullOrUndefined(element);
|
|
810
957
|
};
|
|
811
|
-
DropDownList.prototype.getPageCount = function () {
|
|
958
|
+
DropDownList.prototype.getPageCount = function (returnExactCount) {
|
|
812
959
|
var liHeight = this.list.classList.contains(dropDownBaseClasses.noData) ? null :
|
|
813
960
|
getComputedStyle(this.getItems()[0], null).getPropertyValue('height');
|
|
814
|
-
|
|
961
|
+
var pageCount = Math.round(this.list.getBoundingClientRect().height / parseInt(liHeight, 10));
|
|
962
|
+
return returnExactCount ? pageCount : Math.round(pageCount);
|
|
815
963
|
};
|
|
816
|
-
DropDownList.prototype.pageUpSelection = function (steps, event) {
|
|
964
|
+
DropDownList.prototype.pageUpSelection = function (steps, event, isVirtualKeyAction) {
|
|
817
965
|
var previousItem = steps >= 0 ? this.liCollections[steps + 1] : this.liCollections[0];
|
|
966
|
+
if ((this.enableVirtualization && this.activeIndex == null) || isVirtualKeyAction) {
|
|
967
|
+
previousItem = steps >= 0 ? this.liCollections[steps + this.skeletonCount + 1] : this.liCollections[0];
|
|
968
|
+
}
|
|
969
|
+
if (!isNullOrUndefined(previousItem) && previousItem.classList.contains('e-virtual-list')) {
|
|
970
|
+
previousItem = this.liCollections[this.skeletonCount];
|
|
971
|
+
}
|
|
818
972
|
this.setSelection(previousItem, event);
|
|
819
973
|
};
|
|
820
|
-
DropDownList.prototype.pageDownSelection = function (steps, event) {
|
|
974
|
+
DropDownList.prototype.pageDownSelection = function (steps, event, isVirtualKeyAction) {
|
|
821
975
|
var list = this.getItems();
|
|
822
976
|
var previousItem = steps <= list.length ? this.liCollections[steps - 1] : this.liCollections[list.length - 1];
|
|
977
|
+
if ((this.enableVirtualization && this.activeIndex == null) || isVirtualKeyAction) {
|
|
978
|
+
previousItem = steps <= list.length ? this.liCollections[steps + this.skeletonCount - 1] : this.liCollections[list.length - 1];
|
|
979
|
+
}
|
|
823
980
|
this.setSelection(previousItem, event);
|
|
824
981
|
};
|
|
825
982
|
DropDownList.prototype.unWireEvent = function () {
|
|
@@ -885,6 +1042,7 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
885
1042
|
if (e.which === 3 || e.button === 2) {
|
|
886
1043
|
return;
|
|
887
1044
|
}
|
|
1045
|
+
this.keyboardEvent = null;
|
|
888
1046
|
if (this.targetElement().classList.contains(dropDownListClasses.disable) || this.inputWrapper.clearButton === e.target) {
|
|
889
1047
|
return;
|
|
890
1048
|
}
|
|
@@ -1030,6 +1188,14 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
1030
1188
|
}
|
|
1031
1189
|
else {
|
|
1032
1190
|
this.setSelectOptions(li, e);
|
|
1191
|
+
if (this.enableVirtualization) {
|
|
1192
|
+
var fields = (this.fields.value) ? this.fields.value : '';
|
|
1193
|
+
var getItem = new DataManager(this.dataSource).executeLocal(new Query().where(new Predicate(fields, 'equal', this.value)));
|
|
1194
|
+
if (getItem && getItem.length > 0) {
|
|
1195
|
+
this.itemData = getItem[0];
|
|
1196
|
+
this.setProperties({ 'text': getItem[0].text, 'value': getItem[0].value }, true);
|
|
1197
|
+
}
|
|
1198
|
+
}
|
|
1033
1199
|
}
|
|
1034
1200
|
};
|
|
1035
1201
|
DropDownList.prototype.setSelectOptions = function (li, e) {
|
|
@@ -1288,6 +1454,9 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
1288
1454
|
this.typedString = this.filterInput.value;
|
|
1289
1455
|
this.preventAutoFill = false;
|
|
1290
1456
|
this.searchLists(e);
|
|
1457
|
+
if (this.enableVirtualization) {
|
|
1458
|
+
this.getFilteringSkeletonCount();
|
|
1459
|
+
}
|
|
1291
1460
|
break;
|
|
1292
1461
|
}
|
|
1293
1462
|
}
|
|
@@ -1295,6 +1464,33 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
1295
1464
|
this.isValidKey = false;
|
|
1296
1465
|
}
|
|
1297
1466
|
};
|
|
1467
|
+
DropDownList.prototype.getFilteringSkeletonCount = function () {
|
|
1468
|
+
var difference = this.dataCount - this.viewPortInfo.endIndex;
|
|
1469
|
+
var currentSkeletonCount = this.skeletonCount;
|
|
1470
|
+
this.getSkeletonCount(true);
|
|
1471
|
+
this.skeletonCount = this.dataCount > this.itemCount * 2 ? this.skeletonCount : difference > this.skeletonCount ? this.skeletonCount : difference > 0 ? difference : 0;
|
|
1472
|
+
if (!this.list.classList.contains(dropDownBaseClasses.noData)) {
|
|
1473
|
+
var isSkeletonCountChange = currentSkeletonCount !== this.skeletonCount;
|
|
1474
|
+
if (currentSkeletonCount !== this.skeletonCount) {
|
|
1475
|
+
this.UpdateSkeleton(true, Math.abs(currentSkeletonCount - this.skeletonCount));
|
|
1476
|
+
}
|
|
1477
|
+
else {
|
|
1478
|
+
this.UpdateSkeleton();
|
|
1479
|
+
}
|
|
1480
|
+
this.liCollections = this.list.querySelectorAll('.e-list-item');
|
|
1481
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1482
|
+
this.list.getElementsByClassName('e-virtual-ddl')[0].style = this.GetVirtualTrackHeight();
|
|
1483
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1484
|
+
this.list.getElementsByClassName('e-virtual-ddl-content')[0].style = this.getTransformValues();
|
|
1485
|
+
}
|
|
1486
|
+
};
|
|
1487
|
+
DropDownList.prototype.getSkeletonCount = function (retainSkeleton) {
|
|
1488
|
+
this.virtualListHeight = this.listHeight != null ? parseInt(this.listHeight, 10) : this.virtualListHeight;
|
|
1489
|
+
var actualCount = this.virtualListHeight > 0 ? Math.floor(this.virtualListHeight / this.listItemHeight) : 0;
|
|
1490
|
+
this.skeletonCount = actualCount * 2 < this.itemCount ? this.itemCount : actualCount * 2;
|
|
1491
|
+
this.itemCount = retainSkeleton ? this.itemCount : this.skeletonCount;
|
|
1492
|
+
this.skeletonCount = Math.floor(this.skeletonCount / 2) + 2;
|
|
1493
|
+
};
|
|
1298
1494
|
DropDownList.prototype.onFilterDown = function (e) {
|
|
1299
1495
|
switch (e.keyCode) {
|
|
1300
1496
|
case 13: //enter
|
|
@@ -1338,6 +1534,14 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
1338
1534
|
else {
|
|
1339
1535
|
filterQuery = query ? query.clone() : this.query ? this.query.clone() : new Query();
|
|
1340
1536
|
}
|
|
1537
|
+
if (this.enableVirtualization && (this.viewPortInfo.endIndex != 0)) {
|
|
1538
|
+
var takeValue = this.getTakeValue();
|
|
1539
|
+
if (this.allowFiltering) {
|
|
1540
|
+
filterQuery.skip(this.virtualItemStartIndex);
|
|
1541
|
+
}
|
|
1542
|
+
filterQuery.take(takeValue);
|
|
1543
|
+
filterQuery.requiresCount();
|
|
1544
|
+
}
|
|
1341
1545
|
return filterQuery;
|
|
1342
1546
|
};
|
|
1343
1547
|
DropDownList.prototype.getSelectionPoints = function () {
|
|
@@ -1355,6 +1559,7 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
1355
1559
|
}
|
|
1356
1560
|
this.isDataFetched = false;
|
|
1357
1561
|
if (this.isFiltering()) {
|
|
1562
|
+
this.checkAndResetCache();
|
|
1358
1563
|
var eventArgs_1 = {
|
|
1359
1564
|
preventDefaultAction: false,
|
|
1360
1565
|
text: this.filterInput.value,
|
|
@@ -1392,10 +1597,30 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
1392
1597
|
if (!isNullOrUndefined(this.filterInput)) {
|
|
1393
1598
|
this.beforePopupOpen = (!this.isPopupOpen && this.getModuleName() === 'combobox' && this.filterInput.value === '') ?
|
|
1394
1599
|
false : true;
|
|
1600
|
+
var isNoData = this.list.classList.contains(dropDownBaseClasses.noData);
|
|
1395
1601
|
if (this.filterInput.value.trim() === '' && !this.itemTemplate) {
|
|
1396
1602
|
this.actionCompleteData.isUpdated = false;
|
|
1397
1603
|
this.isTyped = false;
|
|
1398
1604
|
if (!isNullOrUndefined(this.actionCompleteData.ulElement) && !isNullOrUndefined(this.actionCompleteData.list)) {
|
|
1605
|
+
if (this.enableVirtualization) {
|
|
1606
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1607
|
+
this.totalItemCount = this.dataSource && this.dataSource.length ? this.dataSource.length : 0;
|
|
1608
|
+
this.resetList(dataSource, fields, query);
|
|
1609
|
+
if (isNoData && !this.list.classList.contains(dropDownBaseClasses.noData)) {
|
|
1610
|
+
if (!this.list.querySelector('.e-virtual-ddl-content')) {
|
|
1611
|
+
this.list.appendChild(this.createElement('div', {
|
|
1612
|
+
className: 'e-virtual-ddl-content',
|
|
1613
|
+
styles: this.getTransformValues()
|
|
1614
|
+
})).appendChild(this.list.querySelector('.e-list-parent'));
|
|
1615
|
+
}
|
|
1616
|
+
if (!this.list.querySelector('.e-virtual-ddl')) {
|
|
1617
|
+
var virualElement = this.createElement('div', {
|
|
1618
|
+
id: this.element.id + '_popup', className: 'e-virtual-ddl', styles: this.GetVirtualTrackHeight()
|
|
1619
|
+
});
|
|
1620
|
+
document.getElementsByClassName('e-popup')[0].querySelector('.e-dropdownbase').appendChild(virualElement);
|
|
1621
|
+
}
|
|
1622
|
+
}
|
|
1623
|
+
}
|
|
1399
1624
|
this.onActionComplete(this.actionCompleteData.ulElement, this.actionCompleteData.list);
|
|
1400
1625
|
}
|
|
1401
1626
|
this.isTyped = true;
|
|
@@ -1408,7 +1633,30 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
1408
1633
|
else {
|
|
1409
1634
|
this.isNotSearchList = false;
|
|
1410
1635
|
query = (this.filterInput.value.trim() === '') ? null : query;
|
|
1636
|
+
if (this.enableVirtualization && this.isFiltering() && this.isTyped) {
|
|
1637
|
+
this.isPreventScrollAction = true;
|
|
1638
|
+
this.list.scrollTop = 0;
|
|
1639
|
+
this.previousStartIndex = 0;
|
|
1640
|
+
this.virtualListInfo = null;
|
|
1641
|
+
}
|
|
1411
1642
|
this.resetList(dataSource, fields, query);
|
|
1643
|
+
if (this.enableVirtualization && isNoData && !this.list.classList.contains(dropDownBaseClasses.noData)) {
|
|
1644
|
+
if (!this.list.querySelector('.e-virtual-ddl-content')) {
|
|
1645
|
+
this.list.appendChild(this.createElement('div', {
|
|
1646
|
+
className: 'e-virtual-ddl-content',
|
|
1647
|
+
styles: this.getTransformValues()
|
|
1648
|
+
})).appendChild(this.list.querySelector('.e-list-parent'));
|
|
1649
|
+
}
|
|
1650
|
+
if (!this.list.querySelector('.e-virtual-ddl')) {
|
|
1651
|
+
var virualElement = this.createElement('div', {
|
|
1652
|
+
id: this.element.id + '_popup', className: 'e-virtual-ddl', styles: this.GetVirtualTrackHeight()
|
|
1653
|
+
});
|
|
1654
|
+
document.getElementsByClassName('e-popup')[0].querySelector('.e-dropdownbase').appendChild(virualElement);
|
|
1655
|
+
}
|
|
1656
|
+
}
|
|
1657
|
+
}
|
|
1658
|
+
if (this.enableVirtualization) {
|
|
1659
|
+
this.getFilteringSkeletonCount();
|
|
1412
1660
|
}
|
|
1413
1661
|
this.renderReactTemplates();
|
|
1414
1662
|
}
|
|
@@ -1506,16 +1754,45 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
1506
1754
|
this.renderPopup();
|
|
1507
1755
|
}
|
|
1508
1756
|
};
|
|
1757
|
+
DropDownList.prototype.UpdateSkeleton = function (isSkeletonCountChange, skeletonCount) {
|
|
1758
|
+
var isContainSkeleton = this.list.querySelector('.e-virtual-ddl-content');
|
|
1759
|
+
var isContainVirtualList = this.list.querySelector('.e-virtual-list');
|
|
1760
|
+
if (isContainSkeleton && (!isContainVirtualList || isSkeletonCountChange) && this.enableVirtualization) {
|
|
1761
|
+
var totalSkeletonCount = isSkeletonCountChange ? skeletonCount : this.skeletonCount;
|
|
1762
|
+
for (var i = 0; i < totalSkeletonCount; i++) {
|
|
1763
|
+
var liElement = this.createElement('li', { className: dropDownListClasses.virtualList, styles: 'overflow: inherit' });
|
|
1764
|
+
var skeleton = new Skeleton({
|
|
1765
|
+
shape: "Text",
|
|
1766
|
+
height: "10px",
|
|
1767
|
+
width: "95%",
|
|
1768
|
+
cssClass: "e-skeleton-text",
|
|
1769
|
+
});
|
|
1770
|
+
skeleton.appendTo(this.createElement('div'));
|
|
1771
|
+
liElement.appendChild(skeleton.element);
|
|
1772
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1773
|
+
isContainSkeleton.firstChild.insertBefore(liElement, isContainSkeleton.firstChild.children[0]);
|
|
1774
|
+
}
|
|
1775
|
+
}
|
|
1776
|
+
};
|
|
1777
|
+
DropDownList.prototype.getTakeValue = function () {
|
|
1778
|
+
return this.allowFiltering && this.getModuleName() === 'dropdownlist' && Browser.isDevice ? Math.round(window.outerHeight / this.listItemHeight) : this.itemCount;
|
|
1779
|
+
};
|
|
1509
1780
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
1510
1781
|
DropDownList.prototype.onActionComplete = function (ulElement, list, e, isUpdated) {
|
|
1511
1782
|
var _this = this;
|
|
1512
|
-
if (this.
|
|
1783
|
+
if (this.dataSource instanceof DataManager && !isNullOrUndefined(e)) {
|
|
1784
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1785
|
+
this.totalItemCount = e.count;
|
|
1786
|
+
}
|
|
1787
|
+
if (this.isNotSearchList && !this.enableVirtualization) {
|
|
1513
1788
|
this.isNotSearchList = false;
|
|
1514
1789
|
return;
|
|
1515
1790
|
}
|
|
1791
|
+
var tempItemCount = this.itemCount;
|
|
1516
1792
|
if (this.isActive || !isNullOrUndefined(ulElement)) {
|
|
1517
1793
|
var selectedItem = this.selectedLI ? this.selectedLI.cloneNode(true) : null;
|
|
1518
1794
|
_super.prototype.onActionComplete.call(this, ulElement, list, e);
|
|
1795
|
+
this.skeletonCount = this.totalItemCount != 0 && this.totalItemCount < (this.itemCount * 2) ? 0 : this.skeletonCount;
|
|
1519
1796
|
this.updateSelectElementData(this.allowFiltering);
|
|
1520
1797
|
if (this.isRequested && !isNullOrUndefined(this.searchKeyEvent) && this.searchKeyEvent.type === 'keydown') {
|
|
1521
1798
|
this.isRequested = false;
|
|
@@ -1526,7 +1803,9 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
1526
1803
|
this.incrementalSearch(this.searchKeyEvent);
|
|
1527
1804
|
this.searchKeyEvent = null;
|
|
1528
1805
|
}
|
|
1529
|
-
this.
|
|
1806
|
+
if (!this.enableVirtualization) {
|
|
1807
|
+
this.list.scrollTop = 0;
|
|
1808
|
+
}
|
|
1530
1809
|
if (!isNullOrUndefined(ulElement)) {
|
|
1531
1810
|
attributes(ulElement, { 'id': this.element.id + '_options', 'role': 'listbox', 'aria-hidden': 'false' });
|
|
1532
1811
|
}
|
|
@@ -1580,13 +1859,36 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
1580
1859
|
this.updateActionCompleteDataValues(ulElement, list);
|
|
1581
1860
|
}
|
|
1582
1861
|
}
|
|
1583
|
-
this.
|
|
1584
|
-
|
|
1862
|
+
if (!this.enableVirtualization) {
|
|
1863
|
+
this.addNewItem(list, selectedItem);
|
|
1864
|
+
}
|
|
1865
|
+
if (!isNullOrUndefined(this.itemData) || (isNullOrUndefined(this.itemData) && this.enableVirtualization)) {
|
|
1585
1866
|
this.focusIndexItem();
|
|
1586
1867
|
}
|
|
1868
|
+
if (this.enableVirtualization) {
|
|
1869
|
+
this.updateActionCompleteDataValues(ulElement, list);
|
|
1870
|
+
}
|
|
1871
|
+
}
|
|
1872
|
+
else if (this.enableVirtualization && this.getModuleName() !== 'autocomplete' && !this.isFiltering()) {
|
|
1873
|
+
var value = this.getItemData().value;
|
|
1874
|
+
this.activeIndex = this.getIndexByValue(value);
|
|
1875
|
+
var element = this.findListElement(this.list, 'li', 'data-value', value);
|
|
1876
|
+
this.selectedLI = element;
|
|
1877
|
+
}
|
|
1878
|
+
else if (this.enableVirtualization && this.getModuleName() === 'autocomplete') {
|
|
1879
|
+
this.activeIndex = this.skeletonCount;
|
|
1587
1880
|
}
|
|
1588
1881
|
if (this.beforePopupOpen) {
|
|
1589
1882
|
this.renderPopup(e);
|
|
1883
|
+
if (this.enableVirtualization) {
|
|
1884
|
+
if (!this.list.querySelector('.e-virtual-list')) {
|
|
1885
|
+
this.UpdateSkeleton();
|
|
1886
|
+
this.liCollections = this.list.querySelectorAll('.e-list-item');
|
|
1887
|
+
}
|
|
1888
|
+
}
|
|
1889
|
+
if (this.enableVirtualization && tempItemCount != this.itemCount) {
|
|
1890
|
+
this.resetList(this.dataSource, this.fields);
|
|
1891
|
+
}
|
|
1590
1892
|
}
|
|
1591
1893
|
}
|
|
1592
1894
|
};
|
|
@@ -1649,7 +1951,9 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
1649
1951
|
var element = this.findListElement(this.list, 'li', 'data-value', value);
|
|
1650
1952
|
this.selectedLI = element;
|
|
1651
1953
|
this.activeItem(element);
|
|
1652
|
-
this.
|
|
1954
|
+
if (!(this.enableVirtualization && isNullOrUndefined(element))) {
|
|
1955
|
+
this.removeFocus();
|
|
1956
|
+
}
|
|
1653
1957
|
};
|
|
1654
1958
|
DropDownList.prototype.updateSelection = function () {
|
|
1655
1959
|
var selectedItem = this.list.querySelector('.' + dropDownBaseClasses.selected);
|
|
@@ -1662,12 +1966,46 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
1662
1966
|
this.list.querySelector('.' + dropDownBaseClasses.li).classList.add(dropDownListClasses.focus);
|
|
1663
1967
|
}
|
|
1664
1968
|
};
|
|
1969
|
+
DropDownList.prototype.updateSelectionList = function () {
|
|
1970
|
+
var selectedItem = this.list && this.list.querySelector('.' + 'e-active');
|
|
1971
|
+
if (!selectedItem && !isNullOrUndefined(this.value)) {
|
|
1972
|
+
var findEle = this.findListElement(this.list, 'li', 'data-value', this.value);
|
|
1973
|
+
if (findEle) {
|
|
1974
|
+
findEle.classList.add('e-active');
|
|
1975
|
+
}
|
|
1976
|
+
}
|
|
1977
|
+
};
|
|
1978
|
+
DropDownList.prototype.checkAndResetCache = function () {
|
|
1979
|
+
if (this.enableVirtualization) {
|
|
1980
|
+
this.generatedDataObject = {};
|
|
1981
|
+
this.virtualItemStartIndex = this.virtualItemEndIndex = 0;
|
|
1982
|
+
this.viewPortInfo = { currentPageNumber: null,
|
|
1983
|
+
direction: null,
|
|
1984
|
+
sentinelInfo: {},
|
|
1985
|
+
offsets: {},
|
|
1986
|
+
startIndex: 0,
|
|
1987
|
+
endIndex: this.itemCount, };
|
|
1988
|
+
this.selectedValueInfo = null;
|
|
1989
|
+
}
|
|
1990
|
+
};
|
|
1665
1991
|
DropDownList.prototype.removeFocus = function () {
|
|
1666
1992
|
var highlightedItem = this.list.querySelectorAll('.' + dropDownListClasses.focus);
|
|
1667
1993
|
if (highlightedItem && highlightedItem.length) {
|
|
1668
1994
|
removeClass(highlightedItem, dropDownListClasses.focus);
|
|
1669
1995
|
}
|
|
1670
1996
|
};
|
|
1997
|
+
DropDownList.prototype.getTransformValues = function () {
|
|
1998
|
+
var translateY = this.viewPortInfo.startIndex * this.listItemHeight;
|
|
1999
|
+
translateY = translateY - (this.skeletonCount * this.listItemHeight);
|
|
2000
|
+
translateY = this.viewPortInfo.startIndex === 0 && this.listData && this.listData.length === 0 ? 0 : translateY;
|
|
2001
|
+
var styleText = "transform: translate(0px, " + translateY + "px);";
|
|
2002
|
+
return styleText;
|
|
2003
|
+
};
|
|
2004
|
+
DropDownList.prototype.GetVirtualTrackHeight = function () {
|
|
2005
|
+
var height = this.totalItemCount === this.viewPortInfo.endIndex ? this.totalItemCount * this.listItemHeight - this.itemCount * this.listItemHeight : this.totalItemCount * this.listItemHeight;
|
|
2006
|
+
var heightDimension = "height: " + (height - this.itemCount * this.listItemHeight) + "px;";
|
|
2007
|
+
return heightDimension;
|
|
2008
|
+
};
|
|
1671
2009
|
DropDownList.prototype.renderPopup = function (e) {
|
|
1672
2010
|
var _this = this;
|
|
1673
2011
|
if (this.popupObj && document.body.contains(this.popupObj.element)) {
|
|
@@ -1690,10 +2028,35 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
1690
2028
|
_this.setFooterTemplate(popupEle);
|
|
1691
2029
|
}
|
|
1692
2030
|
document.body.appendChild(popupEle);
|
|
2031
|
+
if (_this.enableVirtualization && !_this.list.classList.contains(dropDownBaseClasses.noData)) {
|
|
2032
|
+
if (!_this.list.querySelector('.e-virtual-ddl-content')) {
|
|
2033
|
+
_this.list.appendChild(_this.createElement('div', {
|
|
2034
|
+
className: 'e-virtual-ddl-content',
|
|
2035
|
+
styles: _this.getTransformValues()
|
|
2036
|
+
})).appendChild(_this.list.querySelector('.e-list-parent'));
|
|
2037
|
+
}
|
|
2038
|
+
else {
|
|
2039
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2040
|
+
_this.list.getElementsByClassName('e-virtual-ddl-content')[0].style = _this.getTransformValues();
|
|
2041
|
+
}
|
|
2042
|
+
_this.UpdateSkeleton();
|
|
2043
|
+
_this.liCollections = _this.list.querySelectorAll('.' + dropDownBaseClasses.li);
|
|
2044
|
+
_this.virtualItemCount = _this.itemCount;
|
|
2045
|
+
if (!_this.list.querySelector('.e-virtual-ddl')) {
|
|
2046
|
+
var virualElement = _this.createElement('div', {
|
|
2047
|
+
id: _this.element.id + '_popup', className: 'e-virtual-ddl', styles: _this.GetVirtualTrackHeight()
|
|
2048
|
+
});
|
|
2049
|
+
popupEle.querySelector('.e-dropdownbase').appendChild(virualElement);
|
|
2050
|
+
}
|
|
2051
|
+
else {
|
|
2052
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2053
|
+
_this.list.getElementsByClassName('e-virtual-ddl')[0].style = _this.GetVirtualTrackHeight();
|
|
2054
|
+
}
|
|
2055
|
+
}
|
|
1693
2056
|
popupEle.style.visibility = 'hidden';
|
|
1694
2057
|
if (_this.popupHeight !== 'auto') {
|
|
1695
2058
|
_this.searchBoxHeight = 0;
|
|
1696
|
-
if (!isNullOrUndefined(searchBox.container)) {
|
|
2059
|
+
if (!isNullOrUndefined(searchBox.container) && _this.getModuleName() !== 'combobox' && _this.getModuleName() !== 'autocomplete') {
|
|
1697
2060
|
_this.searchBoxHeight = (searchBox.container.parentElement).getBoundingClientRect().height;
|
|
1698
2061
|
_this.listHeight = (parseInt(_this.listHeight, 10) - (_this.searchBoxHeight)).toString() + 'px';
|
|
1699
2062
|
}
|
|
@@ -1715,9 +2078,13 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
1715
2078
|
}
|
|
1716
2079
|
var offsetValue = 0;
|
|
1717
2080
|
var left = void 0;
|
|
2081
|
+
_this.isPreventScrollAction = true;
|
|
1718
2082
|
if (!isNullOrUndefined(_this.selectedLI) && (!isNullOrUndefined(_this.activeIndex) && _this.activeIndex >= 0)) {
|
|
1719
2083
|
_this.setScrollPosition();
|
|
1720
2084
|
}
|
|
2085
|
+
else if (_this.enableVirtualization) {
|
|
2086
|
+
_this.setScrollPosition();
|
|
2087
|
+
}
|
|
1721
2088
|
else {
|
|
1722
2089
|
_this.list.scrollTop = 0;
|
|
1723
2090
|
}
|
|
@@ -1733,6 +2100,7 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
1733
2100
|
}
|
|
1734
2101
|
_this.getFocusElement();
|
|
1735
2102
|
_this.createPopup(popupEle, offsetValue, left);
|
|
2103
|
+
_this.popupContentElement = _this.popupObj.element.querySelector('.e-content');
|
|
1736
2104
|
_this.checkCollision(popupEle);
|
|
1737
2105
|
if (Browser.isDevice) {
|
|
1738
2106
|
_this.popupObj.element.classList.add(dropDownListClasses.device);
|
|
@@ -1765,6 +2133,24 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
1765
2133
|
_this.wireListEvents();
|
|
1766
2134
|
}
|
|
1767
2135
|
_this.selectedElementID = _this.selectedLI ? _this.selectedLI.id : null;
|
|
2136
|
+
if (_this.enableVirtualization) {
|
|
2137
|
+
_this.notify("bindScrollEvent", {
|
|
2138
|
+
module: "VirtualScroll",
|
|
2139
|
+
component: _this.getModuleName(),
|
|
2140
|
+
enable: _this.enableVirtualization,
|
|
2141
|
+
});
|
|
2142
|
+
setTimeout(function () {
|
|
2143
|
+
if (_this.value) {
|
|
2144
|
+
_this.updateSelectionList();
|
|
2145
|
+
if (_this.selectedValueInfo && _this.viewPortInfo && _this.viewPortInfo.offsets.top) {
|
|
2146
|
+
_this.list.scrollTop = _this.viewPortInfo.offsets.top;
|
|
2147
|
+
}
|
|
2148
|
+
else {
|
|
2149
|
+
_this.scrollBottom(true, true);
|
|
2150
|
+
}
|
|
2151
|
+
}
|
|
2152
|
+
}, 5);
|
|
2153
|
+
}
|
|
1768
2154
|
attributes(_this.targetElement(), { 'aria-expanded': 'true', 'aria-owns': _this.element.id + '_options' });
|
|
1769
2155
|
_this.inputElement.setAttribute('aria-expanded', 'true');
|
|
1770
2156
|
var inputParent = _this.isFiltering() ? _this.filterInput.parentElement : _this.inputWrapper.container;
|
|
@@ -1899,6 +2285,7 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
1899
2285
|
var firstItem = this.isEmptyList() ? this.list : this.liCollections[0];
|
|
1900
2286
|
var lastItem = this.isEmptyList() ? this.list : this.liCollections[this.getItems().length - 1];
|
|
1901
2287
|
var liHeight = firstItem.getBoundingClientRect().height;
|
|
2288
|
+
this.listItemHeight = liHeight;
|
|
1902
2289
|
var listHeight = this.list.offsetHeight / 2;
|
|
1903
2290
|
var height = isNullOrUndefined(selectedLI) ? firstItem.offsetTop : selectedLI.offsetTop;
|
|
1904
2291
|
var lastItemOffsetValue = lastItem.offsetTop;
|
|
@@ -1909,7 +2296,7 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
1909
2296
|
offsetValue = (count - (this.liCollections.length - this.activeIndex)) * liHeight - popupOffset + paddingBottom;
|
|
1910
2297
|
this.list.scrollTop = selectedLI.offsetTop;
|
|
1911
2298
|
}
|
|
1912
|
-
else if (height > listHeight) {
|
|
2299
|
+
else if (height > listHeight && !this.enableVirtualization) {
|
|
1913
2300
|
offsetValue = listHeight - liHeight / 2;
|
|
1914
2301
|
this.list.scrollTop = height - listHeight + liHeight / 2;
|
|
1915
2302
|
}
|
|
@@ -1935,34 +2322,109 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
1935
2322
|
}
|
|
1936
2323
|
return width;
|
|
1937
2324
|
};
|
|
1938
|
-
DropDownList.prototype.scrollBottom = function (isInitial) {
|
|
2325
|
+
DropDownList.prototype.scrollBottom = function (isInitial, isInitialSelection, keyAction) {
|
|
2326
|
+
if (isInitialSelection === void 0) { isInitialSelection = false; }
|
|
2327
|
+
if (keyAction === void 0) { keyAction = null; }
|
|
2328
|
+
if (isNullOrUndefined(this.selectedLI) && this.enableVirtualization) {
|
|
2329
|
+
this.selectedLI = this.list.querySelector('.' + dropDownBaseClasses.li);
|
|
2330
|
+
if (!isNullOrUndefined(this.selectedLI) && this.selectedLI.classList.contains('e-virtual-list')) {
|
|
2331
|
+
this.selectedLI = this.liCollections[this.skeletonCount];
|
|
2332
|
+
}
|
|
2333
|
+
}
|
|
1939
2334
|
if (!isNullOrUndefined(this.selectedLI)) {
|
|
2335
|
+
this.isUpwardScrolling = false;
|
|
2336
|
+
var virtualListCount = this.list.querySelectorAll('.e-virtual-list').length;
|
|
2337
|
+
var lastElementValue = this.list.querySelector('li:last-of-type') ? this.list.querySelector('li:last-of-type').getAttribute('data-value') : null;
|
|
2338
|
+
var selectedLiOffsetTop = this.virtualListInfo && this.virtualListInfo.startIndex ? this.selectedLI.offsetTop + (this.virtualListInfo.startIndex * this.selectedLI.offsetHeight) : this.selectedLI.offsetTop;
|
|
1940
2339
|
var currentOffset = this.list.offsetHeight;
|
|
1941
|
-
var nextBottom = this.selectedLI.
|
|
2340
|
+
var nextBottom = selectedLiOffsetTop - (virtualListCount * this.selectedLI.offsetHeight) + this.selectedLI.offsetHeight - this.list.scrollTop;
|
|
1942
2341
|
var nextOffset = this.list.scrollTop + nextBottom - currentOffset;
|
|
1943
|
-
|
|
1944
|
-
var
|
|
2342
|
+
var isScrollerCHanged = false;
|
|
2343
|
+
var isScrollTopChanged = false;
|
|
2344
|
+
nextOffset = isInitial ? nextOffset + parseInt(getComputedStyle(this.list).paddingTop, 10) * 2 : nextOffset + parseInt(getComputedStyle(this.list).paddingTop, 10);
|
|
2345
|
+
var boxRange = selectedLiOffsetTop - (virtualListCount * this.selectedLI.offsetHeight) + this.selectedLI.offsetHeight - this.list.scrollTop;
|
|
1945
2346
|
boxRange = this.fields.groupBy && !isNullOrUndefined(this.fixedHeaderElement) ?
|
|
1946
2347
|
boxRange - this.fixedHeaderElement.offsetHeight : boxRange;
|
|
1947
|
-
if (this.activeIndex === 0) {
|
|
2348
|
+
if (this.activeIndex === 0 && !this.enableVirtualization) {
|
|
1948
2349
|
this.list.scrollTop = 0;
|
|
2350
|
+
isScrollerCHanged = this.isKeyBoardAction;
|
|
1949
2351
|
}
|
|
1950
2352
|
else if (nextBottom > currentOffset || !(boxRange > 0 && this.list.offsetHeight > boxRange)) {
|
|
1951
|
-
this.
|
|
2353
|
+
var currentElementValue = this.selectedLI ? this.selectedLI.getAttribute('data-value') : null;
|
|
2354
|
+
var liCount = keyAction == "pageDown" ? this.getPageCount() - 2 : 1;
|
|
2355
|
+
if (!this.enableVirtualization || this.isKeyBoardAction || isInitialSelection) {
|
|
2356
|
+
if (this.isKeyBoardAction && this.enableVirtualization && lastElementValue && currentElementValue === lastElementValue && keyAction != "end" && !this.isVirtualScrolling) {
|
|
2357
|
+
this.isPreventKeyAction = true;
|
|
2358
|
+
this.list.scrollTop += this.selectedLI.offsetHeight * liCount;
|
|
2359
|
+
this.isPreventKeyAction = this.IsScrollerAtEnd() ? false : this.isPreventKeyAction;
|
|
2360
|
+
this.isKeyBoardAction = false;
|
|
2361
|
+
this.isPreventScrollAction = false;
|
|
2362
|
+
}
|
|
2363
|
+
else if (this.enableVirtualization && keyAction == "end") {
|
|
2364
|
+
this.isPreventKeyAction = false;
|
|
2365
|
+
this.isKeyBoardAction = false;
|
|
2366
|
+
this.isPreventScrollAction = false;
|
|
2367
|
+
this.list.scrollTop = this.list.scrollHeight;
|
|
2368
|
+
}
|
|
2369
|
+
else {
|
|
2370
|
+
if (keyAction == "pageDown" && this.enableVirtualization && !this.isVirtualScrolling) {
|
|
2371
|
+
this.isPreventKeyAction = false;
|
|
2372
|
+
this.isKeyBoardAction = false;
|
|
2373
|
+
this.isPreventScrollAction = false;
|
|
2374
|
+
nextOffset = nextOffset + (this.selectedLI.offsetHeight * liCount);
|
|
2375
|
+
}
|
|
2376
|
+
this.list.scrollTop = nextOffset;
|
|
2377
|
+
}
|
|
2378
|
+
}
|
|
2379
|
+
else {
|
|
2380
|
+
this.list.scrollTop = this.virtualListInfo && this.virtualListInfo.startIndex ? this.virtualListInfo.startIndex * this.listItemHeight : 0;
|
|
2381
|
+
}
|
|
2382
|
+
isScrollerCHanged = this.isKeyBoardAction;
|
|
2383
|
+
isScrollTopChanged = true;
|
|
1952
2384
|
}
|
|
2385
|
+
this.isKeyBoardAction = isScrollerCHanged;
|
|
1953
2386
|
}
|
|
1954
2387
|
};
|
|
1955
|
-
DropDownList.prototype.scrollTop = function () {
|
|
2388
|
+
DropDownList.prototype.scrollTop = function (keyAction) {
|
|
2389
|
+
if (keyAction === void 0) { keyAction = null; }
|
|
1956
2390
|
if (!isNullOrUndefined(this.selectedLI)) {
|
|
1957
|
-
var
|
|
2391
|
+
var virtualListCount = this.list.querySelectorAll('.e-virtual-list').length;
|
|
2392
|
+
var selectedLiOffsetTop = (this.virtualListInfo && this.virtualListInfo.startIndex) ? this.selectedLI.offsetTop + (this.virtualListInfo.startIndex * this.selectedLI.offsetHeight) : this.selectedLI.offsetTop;
|
|
2393
|
+
var nextOffset = selectedLiOffsetTop - (virtualListCount * this.selectedLI.offsetHeight) - this.list.scrollTop;
|
|
2394
|
+
var firstElementValue = this.list.querySelector('li.e-list-item:not(.e-virtual-list)') ? this.list.querySelector('li.e-list-item:not(.e-virtual-list)').getAttribute('data-value') : null;
|
|
1958
2395
|
nextOffset = this.fields.groupBy && !isNullOrUndefined(this.fixedHeaderElement) ?
|
|
1959
2396
|
nextOffset - this.fixedHeaderElement.offsetHeight : nextOffset;
|
|
1960
|
-
var boxRange = (this.selectedLI.
|
|
1961
|
-
|
|
2397
|
+
var boxRange = (selectedLiOffsetTop - (virtualListCount * this.selectedLI.offsetHeight) + this.selectedLI.offsetHeight - this.list.scrollTop);
|
|
2398
|
+
var isPageUpKeyAction = this.enableVirtualization && this.getModuleName() === 'autocomplete' && nextOffset <= 0;
|
|
2399
|
+
if (this.activeIndex === 0 && !this.enableVirtualization) {
|
|
1962
2400
|
this.list.scrollTop = 0;
|
|
1963
2401
|
}
|
|
1964
|
-
else if (nextOffset < 0) {
|
|
1965
|
-
this.
|
|
2402
|
+
else if (nextOffset < 0 || isPageUpKeyAction) {
|
|
2403
|
+
var currentElementValue = this.selectedLI ? this.selectedLI.getAttribute('data-value') : null;
|
|
2404
|
+
var liCount = keyAction == "pageUp" ? this.getPageCount() - 2 : 1;
|
|
2405
|
+
if (this.enableVirtualization && this.isKeyBoardAction && firstElementValue && currentElementValue === firstElementValue && keyAction != "home" && !this.isVirtualScrolling) {
|
|
2406
|
+
this.isUpwardScrolling = true;
|
|
2407
|
+
this.isPreventKeyAction = true;
|
|
2408
|
+
this.list.scrollTop -= this.selectedLI.offsetHeight * liCount;
|
|
2409
|
+
this.isPreventKeyAction = this.list.scrollTop != 0 ? this.isPreventKeyAction : false;
|
|
2410
|
+
this.isKeyBoardAction = false;
|
|
2411
|
+
this.isPreventScrollAction = false;
|
|
2412
|
+
}
|
|
2413
|
+
else if (this.enableVirtualization && keyAction == "home") {
|
|
2414
|
+
this.isPreventScrollAction = false;
|
|
2415
|
+
this.isPreventKeyAction = true;
|
|
2416
|
+
this.isKeyBoardAction = false;
|
|
2417
|
+
this.list.scrollTo(0, 0);
|
|
2418
|
+
}
|
|
2419
|
+
else {
|
|
2420
|
+
if (keyAction == "pageUp" && this.enableVirtualization && !this.isVirtualScrolling) {
|
|
2421
|
+
this.isPreventKeyAction = false;
|
|
2422
|
+
this.isKeyBoardAction = false;
|
|
2423
|
+
this.isPreventScrollAction = false;
|
|
2424
|
+
nextOffset = nextOffset - (this.selectedLI.offsetHeight * liCount);
|
|
2425
|
+
}
|
|
2426
|
+
this.list.scrollTop = this.list.scrollTop + nextOffset;
|
|
2427
|
+
}
|
|
1966
2428
|
}
|
|
1967
2429
|
else if (!(boxRange > 0 && this.list.offsetHeight > boxRange)) {
|
|
1968
2430
|
this.list.scrollTop = this.selectedLI.offsetTop - (this.fields.groupBy && !isNullOrUndefined(this.fixedHeaderElement) ?
|
|
@@ -1980,25 +2442,47 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
1980
2442
|
return true;
|
|
1981
2443
|
};
|
|
1982
2444
|
DropDownList.prototype.setScrollPosition = function (e) {
|
|
2445
|
+
this.isPreventScrollAction = true;
|
|
1983
2446
|
if (!isNullOrUndefined(e)) {
|
|
1984
2447
|
switch (e.action) {
|
|
1985
2448
|
case 'pageDown':
|
|
1986
2449
|
case 'down':
|
|
1987
2450
|
case 'end':
|
|
1988
|
-
this.
|
|
2451
|
+
this.isKeyBoardAction = true;
|
|
2452
|
+
this.scrollBottom(false, false, e.action);
|
|
1989
2453
|
break;
|
|
1990
2454
|
default:
|
|
1991
|
-
this.
|
|
2455
|
+
this.isKeyBoardAction = e.action == 'up' || e.action == 'pageUp' || e.action == 'open';
|
|
2456
|
+
this.scrollTop(e.action);
|
|
1992
2457
|
break;
|
|
1993
2458
|
}
|
|
1994
2459
|
}
|
|
1995
2460
|
else {
|
|
1996
2461
|
this.scrollBottom(true);
|
|
1997
2462
|
}
|
|
2463
|
+
this.isKeyBoardAction = false;
|
|
1998
2464
|
};
|
|
1999
2465
|
DropDownList.prototype.clearText = function () {
|
|
2000
2466
|
this.filterInput.value = this.typedString = '';
|
|
2001
2467
|
this.searchLists(null);
|
|
2468
|
+
if (this.enableVirtualization) {
|
|
2469
|
+
this.list.scrollTop = 0;
|
|
2470
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2471
|
+
this.totalItemCount = this.dataCount = this.dataSource && this.dataSource.length ? this.dataSource.length : 0;
|
|
2472
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2473
|
+
if (this.list.getElementsByClassName('e-virtual-ddl')[0]) {
|
|
2474
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2475
|
+
this.list.getElementsByClassName('e-virtual-ddl')[0].style = this.GetVirtualTrackHeight();
|
|
2476
|
+
}
|
|
2477
|
+
this.getSkeletonCount();
|
|
2478
|
+
this.UpdateSkeleton();
|
|
2479
|
+
this.liCollections = this.list.querySelectorAll('.e-list-item');
|
|
2480
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2481
|
+
if (this.list.getElementsByClassName('e-virtual-ddl-content')[0]) {
|
|
2482
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2483
|
+
this.list.getElementsByClassName('e-virtual-ddl-content')[0].style = this.getTransformValues();
|
|
2484
|
+
}
|
|
2485
|
+
}
|
|
2002
2486
|
};
|
|
2003
2487
|
DropDownList.prototype.setEleWidth = function (width) {
|
|
2004
2488
|
if (!isNullOrUndefined(width)) {
|
|
@@ -2012,10 +2496,13 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
2012
2496
|
};
|
|
2013
2497
|
DropDownList.prototype.closePopup = function (delay, e) {
|
|
2014
2498
|
var _this = this;
|
|
2499
|
+
var isFilterValue = !isNullOrUndefined(this.filterInput) && !isNullOrUndefined(this.filterInput.value) && this.filterInput.value !== '';
|
|
2500
|
+
var typedString = this.getModuleName() === 'combobox' ? this.typedString : null;
|
|
2015
2501
|
this.isTyped = false;
|
|
2016
2502
|
if (!(this.popupObj && document.body.contains(this.popupObj.element) && this.beforePopupOpen)) {
|
|
2017
2503
|
return;
|
|
2018
2504
|
}
|
|
2505
|
+
this.keyboardEvent = null;
|
|
2019
2506
|
EventHandler.remove(document, 'mousedown', this.onDocumentClick);
|
|
2020
2507
|
this.isActive = false;
|
|
2021
2508
|
this.filterInputObj = null;
|
|
@@ -2057,6 +2544,20 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
2057
2544
|
if (this.isFiltering()) {
|
|
2058
2545
|
this.actionCompleteData.isUpdated = false;
|
|
2059
2546
|
}
|
|
2547
|
+
if (this.enableVirtualization) {
|
|
2548
|
+
if ((this.value == null || this.isTyped)) {
|
|
2549
|
+
this.viewPortInfo.endIndex = this.viewPortInfo && this.viewPortInfo.endIndex > 0 ? this.viewPortInfo.endIndex : this.itemCount;
|
|
2550
|
+
if (this.getModuleName() === 'autocomplete' || (this.getModuleName() === 'dropdownlist' && !isNullOrUndefined(this.typedString) && this.typedString != "") || (this.getModuleName() === 'combobox' && this.allowFiltering && !isNullOrUndefined(this.typedString) && this.typedString != "")) {
|
|
2551
|
+
this.checkAndResetCache();
|
|
2552
|
+
}
|
|
2553
|
+
}
|
|
2554
|
+
else if (this.getModuleName() === 'autocomplete') {
|
|
2555
|
+
this.checkAndResetCache();
|
|
2556
|
+
}
|
|
2557
|
+
if ((this.getModuleName() === 'dropdownlist' || this.getModuleName() === 'combobox') && !(this.skeletonCount == 0)) {
|
|
2558
|
+
this.getSkeletonCount(true);
|
|
2559
|
+
}
|
|
2560
|
+
}
|
|
2060
2561
|
this.beforePopupOpen = false;
|
|
2061
2562
|
var animModel = {
|
|
2062
2563
|
name: 'FadeOut',
|
|
@@ -2087,6 +2588,46 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
2087
2588
|
if (this.isReact && this.isFiltering() && this.itemTemplate != null) {
|
|
2088
2589
|
this.actionCompleteData.ulElement = this.ulElement.cloneNode(true);
|
|
2089
2590
|
}
|
|
2591
|
+
var dataSourceCount = this.dataSource && this.dataSource.length ? this.dataSource.length : 0;
|
|
2592
|
+
if (this.enableVirtualization && this.isFiltering() && this.value != null && isFilterValue && this.totalItemCount !== dataSourceCount) {
|
|
2593
|
+
this.updateInitialData();
|
|
2594
|
+
this.checkAndResetCache();
|
|
2595
|
+
}
|
|
2596
|
+
};
|
|
2597
|
+
DropDownList.prototype.updateInitialData = function () {
|
|
2598
|
+
var currentData = this.selectData;
|
|
2599
|
+
var ulElement = this.renderItems(currentData, this.fields);
|
|
2600
|
+
this.list.scrollTop = 0;
|
|
2601
|
+
this.virtualListInfo = {
|
|
2602
|
+
currentPageNumber: null,
|
|
2603
|
+
direction: null,
|
|
2604
|
+
sentinelInfo: {},
|
|
2605
|
+
offsets: {},
|
|
2606
|
+
startIndex: 0,
|
|
2607
|
+
endIndex: 0,
|
|
2608
|
+
};
|
|
2609
|
+
if (this.getModuleName() === 'combobox') {
|
|
2610
|
+
this.typedString = "";
|
|
2611
|
+
}
|
|
2612
|
+
this.previousStartIndex = 0;
|
|
2613
|
+
this.previousEndIndex = 0;
|
|
2614
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2615
|
+
this.totalItemCount = this.dataCount = this.dataSource && this.dataSource.length ? this.dataSource.length : 0;
|
|
2616
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2617
|
+
if (this.list.getElementsByClassName('e-virtual-ddl')[0]) {
|
|
2618
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2619
|
+
this.list.getElementsByClassName('e-virtual-ddl')[0].style = this.GetVirtualTrackHeight();
|
|
2620
|
+
}
|
|
2621
|
+
this.getSkeletonCount();
|
|
2622
|
+
this.UpdateSkeleton();
|
|
2623
|
+
this.listData = currentData;
|
|
2624
|
+
this.updateActionCompleteDataValues(ulElement, currentData);
|
|
2625
|
+
this.liCollections = this.list.querySelectorAll('.e-list-item');
|
|
2626
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2627
|
+
if (this.list.getElementsByClassName('e-virtual-ddl-content')[0]) {
|
|
2628
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2629
|
+
this.list.getElementsByClassName('e-virtual-ddl-content')[0].style = this.getTransformValues();
|
|
2630
|
+
}
|
|
2090
2631
|
};
|
|
2091
2632
|
DropDownList.prototype.destroyPopup = function () {
|
|
2092
2633
|
this.isPopupOpen = false;
|
|
@@ -2173,10 +2714,10 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
2173
2714
|
this.element.id = id;
|
|
2174
2715
|
this.hiddenElement.id = id + '_hidden';
|
|
2175
2716
|
this.targetElement().setAttribute('tabindex', this.tabIndex);
|
|
2176
|
-
if (this.getModuleName() === 'autocomplete' || this.getModuleName() === 'combobox') {
|
|
2717
|
+
if ((this.getModuleName() === 'autocomplete' || this.getModuleName() === 'combobox') && !this.readonly) {
|
|
2177
2718
|
this.inputElement.setAttribute('aria-label', this.getModuleName());
|
|
2178
2719
|
}
|
|
2179
|
-
else {
|
|
2720
|
+
else if (this.getModuleName() === 'dropdownlist') {
|
|
2180
2721
|
attributes(this.targetElement(), { 'aria-label': this.getModuleName() });
|
|
2181
2722
|
}
|
|
2182
2723
|
attributes(this.targetElement(), this.getAriaAttributes());
|
|
@@ -2186,7 +2727,16 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
2186
2727
|
this.inputElement.removeAttribute('aria-labelledby');
|
|
2187
2728
|
}
|
|
2188
2729
|
if (this.value !== null || this.activeIndex !== null || this.text !== null) {
|
|
2730
|
+
if (this.enableVirtualization) {
|
|
2731
|
+
this.listItemHeight = this.getListHeight();
|
|
2732
|
+
this.getSkeletonCount();
|
|
2733
|
+
this.updateVirtualizationProperties(this.itemCount, this.allowFiltering);
|
|
2734
|
+
}
|
|
2189
2735
|
this.initValue();
|
|
2736
|
+
this.selectedValueInfo = this.viewPortInfo;
|
|
2737
|
+
if (this.enableVirtualization) {
|
|
2738
|
+
this.activeIndex = this.activeIndex + this.skeletonCount;
|
|
2739
|
+
}
|
|
2190
2740
|
}
|
|
2191
2741
|
else if (this.element.tagName === 'SELECT' && this.element.options[0]) {
|
|
2192
2742
|
var selectElement = this.element;
|
|
@@ -2222,6 +2772,29 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
2222
2772
|
attributes(this.inputElement, { 'aria-labelledby': floatLabelElement.id });
|
|
2223
2773
|
}
|
|
2224
2774
|
this.renderComplete();
|
|
2775
|
+
this.listItemHeight = this.getListHeight();
|
|
2776
|
+
this.getSkeletonCount();
|
|
2777
|
+
if (this.enableVirtualization) {
|
|
2778
|
+
this.updateVirtualizationProperties(this.itemCount, this.allowFiltering);
|
|
2779
|
+
}
|
|
2780
|
+
this.viewPortInfo.startIndex = this.virtualItemStartIndex = 0;
|
|
2781
|
+
this.viewPortInfo.endIndex = this.virtualItemEndIndex = this.viewPortInfo.startIndex > 0 ? this.viewPortInfo.endIndex : this.itemCount;
|
|
2782
|
+
};
|
|
2783
|
+
DropDownList.prototype.getListHeight = function () {
|
|
2784
|
+
var listParent = this.createElement('div', {
|
|
2785
|
+
className: 'e-dropdownbase'
|
|
2786
|
+
});
|
|
2787
|
+
var item = this.createElement('li', {
|
|
2788
|
+
className: 'e-list-item'
|
|
2789
|
+
});
|
|
2790
|
+
var listParentHeight = formatUnit(this.popupHeight);
|
|
2791
|
+
listParent.style.height = (parseInt(listParentHeight, 10)).toString() + 'px';
|
|
2792
|
+
listParent.appendChild(item);
|
|
2793
|
+
document.body.appendChild(listParent);
|
|
2794
|
+
this.virtualListHeight = listParent.getBoundingClientRect().height;
|
|
2795
|
+
var listItemHeight = Math.ceil(item.getBoundingClientRect().height);
|
|
2796
|
+
listParent.remove();
|
|
2797
|
+
return listItemHeight;
|
|
2225
2798
|
};
|
|
2226
2799
|
DropDownList.prototype.setFooterTemplate = function (popupEle) {
|
|
2227
2800
|
var compiledString;
|
|
@@ -2365,7 +2938,10 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
2365
2938
|
var _loop_1 = function (prop) {
|
|
2366
2939
|
switch (prop) {
|
|
2367
2940
|
case 'query':
|
|
2368
|
-
case 'dataSource':
|
|
2941
|
+
case 'dataSource':
|
|
2942
|
+
this_1.getSkeletonCount();
|
|
2943
|
+
this_1.checkAndResetCache();
|
|
2944
|
+
break;
|
|
2369
2945
|
case 'htmlAttributes':
|
|
2370
2946
|
this_1.setHTMLAttributes();
|
|
2371
2947
|
break;
|
|
@@ -2659,7 +3235,23 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
2659
3235
|
this.list.querySelectorAll('.' + dropDownBaseClasses.li).length <= 0)) {
|
|
2660
3236
|
this.renderList(e);
|
|
2661
3237
|
}
|
|
3238
|
+
if (this.enableVirtualization && this.listData && this.listData.length) {
|
|
3239
|
+
if (!isNullOrUndefined(this.value) && (this.getModuleName() === 'dropdownlist' || this.getModuleName() === 'combobox')) {
|
|
3240
|
+
this.removeHover();
|
|
3241
|
+
}
|
|
3242
|
+
if (!this.beforePopupOpen) {
|
|
3243
|
+
this.notify("setCurrentViewDataAsync", {
|
|
3244
|
+
module: "VirtualScroll",
|
|
3245
|
+
});
|
|
3246
|
+
}
|
|
3247
|
+
}
|
|
2662
3248
|
this.invokeRenderPopup(e);
|
|
3249
|
+
if (this.enableVirtualization && !this.allowFiltering && this.selectedValueInfo != null && this.selectedValueInfo.startIndex > 0 && this.value != null) {
|
|
3250
|
+
this.notify("dataProcessAsync", {
|
|
3251
|
+
module: "VirtualScroll",
|
|
3252
|
+
isOpen: true,
|
|
3253
|
+
});
|
|
3254
|
+
}
|
|
2663
3255
|
};
|
|
2664
3256
|
DropDownList.prototype.invokeRenderPopup = function (e) {
|
|
2665
3257
|
if (Browser.isDevice && this.isFilterLayout()) {
|
|
@@ -2753,7 +3345,9 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
2753
3345
|
if (!this.enabled) {
|
|
2754
3346
|
return;
|
|
2755
3347
|
}
|
|
2756
|
-
this.
|
|
3348
|
+
if (!this.enableVirtualization && this.getModuleName() === 'combobox') {
|
|
3349
|
+
this.isTyped = true;
|
|
3350
|
+
}
|
|
2757
3351
|
this.hidePopup(e);
|
|
2758
3352
|
if (this.targetElement()) {
|
|
2759
3353
|
this.targetElement().blur();
|
|
@@ -2809,6 +3403,7 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
2809
3403
|
this.ulElement = null;
|
|
2810
3404
|
this.list = null;
|
|
2811
3405
|
this.popupObj = null;
|
|
3406
|
+
this.popupContentElement = null;
|
|
2812
3407
|
this.rippleFun = null;
|
|
2813
3408
|
this.selectedLI = null;
|
|
2814
3409
|
this.liCollections = null;
|
|
@@ -2905,6 +3500,9 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
2905
3500
|
__decorate([
|
|
2906
3501
|
Property(false)
|
|
2907
3502
|
], DropDownList.prototype, "readonly", void 0);
|
|
3503
|
+
__decorate([
|
|
3504
|
+
Property(false)
|
|
3505
|
+
], DropDownList.prototype, "enableVirtualization", void 0);
|
|
2908
3506
|
__decorate([
|
|
2909
3507
|
Property(null)
|
|
2910
3508
|
], DropDownList.prototype, "text", void 0);
|