@syncfusion/ej2-dropdowns 22.2.11 → 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/CHANGELOG.md +2 -201
- 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 +1128 -73
- package/dist/es6/ej2-dropdowns.es2015.js.map +1 -1
- package/dist/es6/ej2-dropdowns.es5.js +1182 -69
- 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/drop-down-tree/drop-down-tree.js +2 -4
- 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 +2 -0
- package/src/multi-select/multi-select.js +43 -12
- 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
|
@@ -0,0 +1,376 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
13
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
14
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
15
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
16
|
+
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
|
17
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
21
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
22
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
23
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
24
|
+
function step(op) {
|
|
25
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
26
|
+
while (_) try {
|
|
27
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
28
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
29
|
+
switch (op[0]) {
|
|
30
|
+
case 0: case 1: t = op; break;
|
|
31
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
32
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
33
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
34
|
+
default:
|
|
35
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
36
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
37
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
38
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
39
|
+
if (t[2]) _.ops.pop();
|
|
40
|
+
_.trys.pop(); continue;
|
|
41
|
+
}
|
|
42
|
+
op = body.call(thisArg, _);
|
|
43
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
44
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
import { EventHandler, Browser, select, isNullOrUndefined } from '@syncfusion/ej2-base';
|
|
48
|
+
import { debounce, Touch } from '@syncfusion/ej2-base';
|
|
49
|
+
import { Query } from '@syncfusion/ej2-data';
|
|
50
|
+
var VirtualScroll = /** @class */ (function () {
|
|
51
|
+
function VirtualScroll(parent) {
|
|
52
|
+
var _this = this;
|
|
53
|
+
this.sentinelInfo = {
|
|
54
|
+
'up': {
|
|
55
|
+
check: function (rect, info) {
|
|
56
|
+
var top = rect.top - _this.containerElementRect.top;
|
|
57
|
+
info.entered = top >= 0;
|
|
58
|
+
return top + (_this.parent.listItemHeight * _this.parent.virtualItemCount / 2) >= 0;
|
|
59
|
+
},
|
|
60
|
+
axis: 'Y'
|
|
61
|
+
},
|
|
62
|
+
'down': {
|
|
63
|
+
check: function (rect, info) {
|
|
64
|
+
var cHeight = _this.parent.popupContentElement.clientHeight;
|
|
65
|
+
var top = rect.bottom;
|
|
66
|
+
info.entered = rect.bottom <= _this.containerElementRect.bottom;
|
|
67
|
+
return top - (_this.parent.listItemHeight * _this.parent.virtualItemCount / 2) <= _this.parent.listItemHeight * _this.parent.virtualItemCount / 2;
|
|
68
|
+
}, axis: 'Y'
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
this.parent = parent;
|
|
72
|
+
this.removeEventListener();
|
|
73
|
+
this.addEventListener();
|
|
74
|
+
}
|
|
75
|
+
VirtualScroll.prototype.addEventListener = function () {
|
|
76
|
+
if (this.parent.isDestroyed) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
this.parent.on('observe', this.observe, this);
|
|
80
|
+
this.parent.on('setGeneratedData', this.setGeneratedData, this);
|
|
81
|
+
this.parent.on('dataProcessAsync', this.dataProcessAsync, this);
|
|
82
|
+
this.parent.on('setCurrentViewDataAsync', this.setCurrentViewDataAsync, this);
|
|
83
|
+
this.parent.on('bindScrollEvent', this.bindScrollEvent, this);
|
|
84
|
+
};
|
|
85
|
+
VirtualScroll.prototype.removeEventListener = function () {
|
|
86
|
+
if (this.parent.isDestroyed) {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
this.parent.off('observe', this.observe);
|
|
90
|
+
this.parent.off('setGeneratedData', this.setGeneratedData);
|
|
91
|
+
this.parent.off('dataProcessAsync', this.dataProcessAsync);
|
|
92
|
+
this.parent.off('setCurrentViewDataAsync', this.setCurrentViewDataAsync);
|
|
93
|
+
this.parent.off('bindScrollEvent', this.bindScrollEvent);
|
|
94
|
+
};
|
|
95
|
+
VirtualScroll.prototype.bindScrollEvent = function (component) {
|
|
96
|
+
var _this = this;
|
|
97
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
98
|
+
this.component = component.component;
|
|
99
|
+
this.observe(function (scrollArgs) { return _this.scrollListener(scrollArgs); });
|
|
100
|
+
};
|
|
101
|
+
VirtualScroll.prototype.observe = function (callback) {
|
|
102
|
+
this.containerElementRect = this.parent.popupContentElement.getBoundingClientRect();
|
|
103
|
+
EventHandler.add(this.parent.popupContentElement, 'wheel mousedown', this.popupScrollHandler, this);
|
|
104
|
+
this.touchModule = new Touch(this.parent.popupContentElement, {
|
|
105
|
+
scroll: this.popupScrollHandler.bind(this)
|
|
106
|
+
});
|
|
107
|
+
EventHandler.add(this.parent.popupContentElement, 'scroll', this.virtualScrollHandler(callback), this);
|
|
108
|
+
};
|
|
109
|
+
VirtualScroll.prototype.getModuleName = function () {
|
|
110
|
+
return 'VirtualScroll';
|
|
111
|
+
};
|
|
112
|
+
VirtualScroll.prototype.popupScrollHandler = function (e) {
|
|
113
|
+
this.parent.isMouseScrollAction = true;
|
|
114
|
+
this.parent.isPreventScrollAction = false;
|
|
115
|
+
};
|
|
116
|
+
VirtualScroll.prototype.getPageQuery = function (query, virtualStartIndex, virtualEndIndex) {
|
|
117
|
+
if (virtualEndIndex !== 0 && !this.parent.allowFiltering && this.component !== 'autocomplete') {
|
|
118
|
+
query = query.skip(virtualStartIndex);
|
|
119
|
+
}
|
|
120
|
+
return query;
|
|
121
|
+
};
|
|
122
|
+
VirtualScroll.prototype.setGeneratedData = function (qStartIndex, recentlyGeneratedData) {
|
|
123
|
+
var loopIteration = 0;
|
|
124
|
+
var endIndex = this.parent.listData.length + this.parent.virtualItemStartIndex;
|
|
125
|
+
for (var i = this.parent.virtualItemStartIndex; i < endIndex; i++) {
|
|
126
|
+
var alreadyAddedData = this.parent.generatedDataObject[i];
|
|
127
|
+
if (!alreadyAddedData) {
|
|
128
|
+
if (recentlyGeneratedData !== null && this.parent.listData.slice(loopIteration, loopIteration + 1).length > 0) {
|
|
129
|
+
var slicedData = this.parent.listData.slice(loopIteration, loopIteration + 1);
|
|
130
|
+
if (slicedData.length > 0) {
|
|
131
|
+
// Safely assign slicedData to this.parent.generatedDataObject[i]
|
|
132
|
+
this.parent.generatedDataObject[i] = slicedData;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
loopIteration++;
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
VirtualScroll.prototype.generateAndExecuteQueryAsync = function (query, virtualItemStartIndex, virtualItemEndIndex, isQueryGenerated) {
|
|
140
|
+
if (virtualItemStartIndex === void 0) { virtualItemStartIndex = 0; }
|
|
141
|
+
if (virtualItemEndIndex === void 0) { virtualItemEndIndex = 0; }
|
|
142
|
+
if (isQueryGenerated === void 0) { isQueryGenerated = false; }
|
|
143
|
+
var dataSource = this.parent.dataSource;
|
|
144
|
+
if (!isQueryGenerated) {
|
|
145
|
+
query = this.getPageQuery(query, virtualItemStartIndex, virtualItemEndIndex);
|
|
146
|
+
}
|
|
147
|
+
this.parent.resetList(dataSource, this.parent.fields, query);
|
|
148
|
+
};
|
|
149
|
+
VirtualScroll.prototype.setCurrentViewDataAsync = function () {
|
|
150
|
+
// eslint-disable-next-line
|
|
151
|
+
var currentData = [];
|
|
152
|
+
for (var i = this.parent.viewPortInfo.startIndex; i < this.parent.viewPortInfo.endIndex; i++) {
|
|
153
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
154
|
+
var alreadyAddedData = this.parent.generatedDataObject[i];
|
|
155
|
+
if (alreadyAddedData) {
|
|
156
|
+
currentData.push(alreadyAddedData[0]);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
this.parent.renderItems(currentData, this.parent.fields);
|
|
160
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
161
|
+
var virtualTrackElement = this.parent.list.getElementsByClassName('e-virtual-ddl')[0];
|
|
162
|
+
if (virtualTrackElement) {
|
|
163
|
+
(virtualTrackElement).style = this.parent.GetVirtualTrackHeight();
|
|
164
|
+
}
|
|
165
|
+
this.parent.UpdateSkeleton();
|
|
166
|
+
this.parent.liCollections = this.parent.list.querySelectorAll('.e-list-item');
|
|
167
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
168
|
+
var virtualContentElement = this.parent.list.getElementsByClassName('e-virtual-ddl-content')[0];
|
|
169
|
+
if (virtualContentElement) {
|
|
170
|
+
(virtualContentElement).style = this.parent.getTransformValues();
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
VirtualScroll.prototype.generateQueryAndSetQueryIndexAsync = function (query, isPopupOpen) {
|
|
174
|
+
var isStartIndexInitialised = false;
|
|
175
|
+
var queryStartIndex = 0;
|
|
176
|
+
var queryEndIndex = 0;
|
|
177
|
+
var sortedDataStartIndex = 0;
|
|
178
|
+
var vEndIndex = this.parent && this.parent.viewPortInfo.endIndex !== 0 ? this.parent.viewPortInfo.endIndex : sortedDataStartIndex + this.parent.getItems().length;
|
|
179
|
+
if (!isPopupOpen && vEndIndex !== 0) {
|
|
180
|
+
for (var i = this.parent.viewPortInfo.startIndex; i <= vEndIndex; i++) {
|
|
181
|
+
if (!(i in this.parent.generatedDataObject)) {
|
|
182
|
+
if (!isStartIndexInitialised) {
|
|
183
|
+
isStartIndexInitialised = true;
|
|
184
|
+
queryStartIndex = queryEndIndex = i;
|
|
185
|
+
}
|
|
186
|
+
else {
|
|
187
|
+
queryEndIndex = i === vEndIndex ? i : i + 1;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
if (isStartIndexInitialised && !((this.parent.totalItemCount == queryStartIndex) && (this.parent.totalItemCount == queryEndIndex))) {
|
|
193
|
+
this.parent.virtualItemStartIndex = queryStartIndex;
|
|
194
|
+
this.parent.virtualItemEndIndex = queryEndIndex;
|
|
195
|
+
this.generateAndExecuteQueryAsync(query, queryStartIndex, queryEndIndex);
|
|
196
|
+
}
|
|
197
|
+
this.setCurrentViewDataAsync();
|
|
198
|
+
};
|
|
199
|
+
VirtualScroll.prototype.dataProcessAsync = function (isOpenPopup) {
|
|
200
|
+
this.parent.selectedValueInfo = null;
|
|
201
|
+
this.parent.virtualItemStartIndex = this.parent.viewPortInfo.startIndex;
|
|
202
|
+
this.parent.virtualItemEndIndex = this.parent.viewPortInfo.endIndex;
|
|
203
|
+
this.generateQueryAndSetQueryIndexAsync(new Query(), isOpenPopup);
|
|
204
|
+
};
|
|
205
|
+
VirtualScroll.prototype.virtualScrollRefreshAsync = function () {
|
|
206
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
207
|
+
return __generator(this, function (_a) {
|
|
208
|
+
switch (_a.label) {
|
|
209
|
+
case 0:
|
|
210
|
+
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;
|
|
211
|
+
if (this.parent.allowFiltering || this.component === 'autocomplete') {
|
|
212
|
+
if (!isNullOrUndefined(this.parent.typedString) && !(this.component === 'combobox' && !isNullOrUndefined(this.parent.typedString) && this.parent.allowFiltering)) {
|
|
213
|
+
if (this.parent.viewPortInfo.endIndex >= this.parent.dataCount) {
|
|
214
|
+
this.parent.viewPortInfo.endIndex = this.parent.dataCount;
|
|
215
|
+
}
|
|
216
|
+
if (this.parent.viewPortInfo.startIndex >= this.parent.dataCount) {
|
|
217
|
+
this.parent.viewPortInfo.startIndex = this.parent.dataCount - this.parent.itemCount;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
else {
|
|
221
|
+
this.parent.getSkeletonCount(true);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
return [4 /*yield*/, this.dataProcessAsync()];
|
|
225
|
+
case 1:
|
|
226
|
+
_a.sent();
|
|
227
|
+
if (this.parent.keyboardEvent != null) {
|
|
228
|
+
this.parent.handleVirtualKeyboardActions(this.parent.keyboardEvent, this.parent.pageCount);
|
|
229
|
+
}
|
|
230
|
+
this.parent.isCustomFilter = false;
|
|
231
|
+
return [2 /*return*/];
|
|
232
|
+
}
|
|
233
|
+
});
|
|
234
|
+
});
|
|
235
|
+
};
|
|
236
|
+
VirtualScroll.prototype.scrollListener = function (scrollArgs) {
|
|
237
|
+
var _this = this;
|
|
238
|
+
if (!this.parent.isPreventScrollAction) {
|
|
239
|
+
var info = scrollArgs.sentinel;
|
|
240
|
+
var pStartIndex = this.parent.previousStartIndex;
|
|
241
|
+
this.parent.viewPortInfo = this.getInfoFromView(scrollArgs.direction, info, scrollArgs.offset, false);
|
|
242
|
+
this.parent.isUpwardScrolling = false;
|
|
243
|
+
if (this.parent.previousStartIndex !== pStartIndex && !this.parent.isKeyBoardAction) {
|
|
244
|
+
this.parent.isScrollActionTriggered = false;
|
|
245
|
+
this.parent.currentPageNumber = this.parent.viewPortInfo.currentPageNumber;
|
|
246
|
+
this.parent.virtualListInfo = __assign({}, this.parent.viewPortInfo);
|
|
247
|
+
this.parent.isPreventKeyAction = true;
|
|
248
|
+
this.parent.isVirtualScrolling = true;
|
|
249
|
+
setTimeout(function () {
|
|
250
|
+
_this.parent.pageCount = _this.parent.getPageCount();
|
|
251
|
+
_this.virtualScrollRefreshAsync().then(function () {
|
|
252
|
+
if (_this.parent.popupObj) {
|
|
253
|
+
_this.parent.list = _this.parent.popupObj.element.querySelector('.' + 'e-content') || select('.' + 'e-content');
|
|
254
|
+
_this.parent.updateSelectionList();
|
|
255
|
+
_this.parent.liCollections = _this.parent.getItems();
|
|
256
|
+
}
|
|
257
|
+
_this.parent.isKeyBoardAction = false;
|
|
258
|
+
_this.parent.isVirtualScrolling = false;
|
|
259
|
+
_this.parent.isPreventKeyAction = false;
|
|
260
|
+
});
|
|
261
|
+
}, 5);
|
|
262
|
+
}
|
|
263
|
+
else if (this.parent.isScrollActionTriggered) {
|
|
264
|
+
this.parent.isPreventKeyAction = false;
|
|
265
|
+
this.parent.isScrollActionTriggered = false;
|
|
266
|
+
var virtualListCount = this.parent.list.querySelectorAll('.e-virtual-list').length;
|
|
267
|
+
var listElement = this.parent.list.querySelector('.' + 'e-list-item');
|
|
268
|
+
var translateY = scrollArgs.offset.top - (listElement.offsetHeight * virtualListCount);
|
|
269
|
+
this.parent.list.getElementsByClassName('e-virtual-ddl-content')[0].style.transform = "translate(0px," + translateY + "px)";
|
|
270
|
+
}
|
|
271
|
+
this.parent.previousInfo = this.parent.viewPortInfo;
|
|
272
|
+
}
|
|
273
|
+
};
|
|
274
|
+
VirtualScroll.prototype.getPageCount = function (popupElement, returnExactCount) {
|
|
275
|
+
if (returnExactCount === void 0) { returnExactCount = false; }
|
|
276
|
+
var list = popupElement && popupElement.querySelector('.e-content');
|
|
277
|
+
if (list) {
|
|
278
|
+
var liHeight = list.classList.contains('e-nodata') ? null : getComputedStyle(list.querySelectorAll('.e-list-item')[0], null).getPropertyValue('height');
|
|
279
|
+
var pageCount = list.getBoundingClientRect().height / parseInt(liHeight, 10);
|
|
280
|
+
return returnExactCount ? pageCount : Math.round(pageCount);
|
|
281
|
+
}
|
|
282
|
+
return 0;
|
|
283
|
+
};
|
|
284
|
+
;
|
|
285
|
+
VirtualScroll.prototype.getRowHeight = function () {
|
|
286
|
+
return (isNullOrUndefined(this.parent.liCollections) || this.parent.liCollections.length == 0) ? 0 : Math.ceil(this.parent.liCollections[0].getBoundingClientRect().height);
|
|
287
|
+
};
|
|
288
|
+
VirtualScroll.prototype.getInfoFromView = function (direction, info, e, isscrollAction) {
|
|
289
|
+
var infoType = {
|
|
290
|
+
direction: direction, sentinelInfo: info, offsets: e,
|
|
291
|
+
startIndex: this.parent.previousStartIndex, endIndex: this.parent.previousEndIndex
|
|
292
|
+
};
|
|
293
|
+
var vHeight = this.parent.popupContentElement.getBoundingClientRect().height;
|
|
294
|
+
//Row Start and End Index calculation
|
|
295
|
+
var rowHeight = this.parent.listItemHeight;
|
|
296
|
+
var exactTopIndex = e.top / rowHeight;
|
|
297
|
+
var infoViewIndices = vHeight / rowHeight;
|
|
298
|
+
var exactEndIndex = exactTopIndex + infoViewIndices;
|
|
299
|
+
var pageSizeBy4 = this.parent.virtualItemCount / 4;
|
|
300
|
+
var totalItemCount = this.parent.totalItemCount;
|
|
301
|
+
if (infoType.direction === 'down') {
|
|
302
|
+
var sIndex = Math.round(exactEndIndex) - Math.round((pageSizeBy4));
|
|
303
|
+
if (isNullOrUndefined(infoType.startIndex) || (exactEndIndex >
|
|
304
|
+
(infoType.startIndex + Math.round((this.parent.virtualItemCount / 2 + pageSizeBy4)))
|
|
305
|
+
&& infoType.endIndex !== totalItemCount)) {
|
|
306
|
+
infoType.startIndex = sIndex >= 0 ? Math.round(sIndex) : 0;
|
|
307
|
+
infoType.startIndex = infoType.startIndex > exactTopIndex ? Math.floor(exactTopIndex) : infoType.startIndex;
|
|
308
|
+
var eIndex = infoType.startIndex + this.parent.virtualItemCount;
|
|
309
|
+
infoType.startIndex = eIndex < exactEndIndex ? (Math.ceil(exactEndIndex) - this.parent.virtualItemCount)
|
|
310
|
+
: infoType.startIndex;
|
|
311
|
+
infoType.endIndex = eIndex < totalItemCount ? eIndex : totalItemCount;
|
|
312
|
+
infoType.startIndex = eIndex >= totalItemCount ? (infoType.endIndex - this.parent.virtualItemCount > 0 ? infoType.endIndex - this.parent.virtualItemCount : 0) : infoType.startIndex;
|
|
313
|
+
infoType.currentPageNumber = Math.ceil(infoType.endIndex / this.parent.virtualItemCount);
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
else if (infoType.direction === 'up') {
|
|
317
|
+
if (infoType.startIndex && infoType.endIndex) {
|
|
318
|
+
var loadAtIndex = Math.round(((infoType.startIndex * rowHeight) + (pageSizeBy4 * rowHeight)) / rowHeight);
|
|
319
|
+
if (exactTopIndex < loadAtIndex) {
|
|
320
|
+
var idxAddedToExactTop = (pageSizeBy4) > infoViewIndices ? pageSizeBy4 :
|
|
321
|
+
(infoViewIndices + infoViewIndices / 4);
|
|
322
|
+
var eIndex = Math.round(exactTopIndex + idxAddedToExactTop);
|
|
323
|
+
infoType.endIndex = eIndex < totalItemCount ? eIndex : totalItemCount;
|
|
324
|
+
var sIndex = infoType.endIndex - this.parent.virtualItemCount;
|
|
325
|
+
infoType.startIndex = sIndex > 0 ? sIndex : 0;
|
|
326
|
+
infoType.endIndex = sIndex < 0 ? this.parent.virtualItemCount : infoType.endIndex;
|
|
327
|
+
infoType.currentPageNumber = Math.ceil(infoType.startIndex / this.parent.virtualItemCount);
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
if (!isscrollAction) {
|
|
332
|
+
this.parent.previousStartIndex = infoType.startIndex;
|
|
333
|
+
this.parent.startIndex = infoType.startIndex;
|
|
334
|
+
this.parent.previousEndIndex = infoType.endIndex;
|
|
335
|
+
}
|
|
336
|
+
else {
|
|
337
|
+
this.parent.scrollPreStartIndex = infoType.startIndex;
|
|
338
|
+
}
|
|
339
|
+
return infoType;
|
|
340
|
+
};
|
|
341
|
+
VirtualScroll.prototype.virtualScrollHandler = function (callback) {
|
|
342
|
+
var _this = this;
|
|
343
|
+
var delay = Browser.info.name === 'chrome' ? 200 : 100;
|
|
344
|
+
var prevTop = 0;
|
|
345
|
+
var debounced100 = debounce(callback, delay);
|
|
346
|
+
var debounced50 = debounce(callback, 50);
|
|
347
|
+
return function (e) {
|
|
348
|
+
var top = e.target.scrollTop;
|
|
349
|
+
var left = e.target.scrollLeft;
|
|
350
|
+
var direction = prevTop < top && !_this.parent.isUpwardScrolling ? 'down' : 'up';
|
|
351
|
+
prevTop = top;
|
|
352
|
+
var current = _this.sentinelInfo[direction];
|
|
353
|
+
var pstartIndex = _this.parent.scrollPreStartIndex;
|
|
354
|
+
var scrollOffsetargs = {
|
|
355
|
+
top: top,
|
|
356
|
+
left: left
|
|
357
|
+
};
|
|
358
|
+
if (_this.parent.list.querySelectorAll('.e-virtual-list').length > 0) {
|
|
359
|
+
var infoview = _this.getInfoFromView(direction, current, scrollOffsetargs, true);
|
|
360
|
+
if (_this.parent.scrollPreStartIndex != pstartIndex && !_this.parent.isPreventScrollAction) {
|
|
361
|
+
_this.parent.isScrollActionTriggered = true;
|
|
362
|
+
var virtualPoup = (_this.parent.list.querySelector('.e-virtual-ddl-content'));
|
|
363
|
+
virtualPoup.style.transform = "translate(0px," + top + "px)";
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
var debounceFunction = debounced100;
|
|
367
|
+
if (current.axis === 'X') {
|
|
368
|
+
debounceFunction = debounced50;
|
|
369
|
+
}
|
|
370
|
+
debounceFunction({ direction: direction, sentinel: current, offset: { top: top, left: left },
|
|
371
|
+
focusElement: document.activeElement });
|
|
372
|
+
};
|
|
373
|
+
};
|
|
374
|
+
return VirtualScroll;
|
|
375
|
+
}());
|
|
376
|
+
export { VirtualScroll };
|
|
@@ -218,6 +218,11 @@ export declare class DropDownBase extends Component<HTMLElement> implements INot
|
|
|
218
218
|
protected addedNewItem: boolean;
|
|
219
219
|
protected isAddNewItemTemplate: boolean;
|
|
220
220
|
private isRequesting;
|
|
221
|
+
private isVirtualizationEnabled;
|
|
222
|
+
private isAllowFiltering;
|
|
223
|
+
private virtualizedItemsCount;
|
|
224
|
+
protected totalItemCount: number;
|
|
225
|
+
protected dataCount: number;
|
|
221
226
|
/**
|
|
222
227
|
* The `fields` property maps the columns of the data table and binds the data to the component.
|
|
223
228
|
* * text - Maps the text column from data table for each list item.
|
|
@@ -507,6 +512,7 @@ export declare class DropDownBase extends Component<HTMLElement> implements INot
|
|
|
507
512
|
* @returns {Query} Returns the query to do the data query operation.
|
|
508
513
|
*/
|
|
509
514
|
protected getQuery(query: Query): Query;
|
|
515
|
+
protected updateVirtualizationProperties(itemCount: number, filtering: boolean): void;
|
|
510
516
|
/**
|
|
511
517
|
* To render the template content for group header element.
|
|
512
518
|
*
|
|
@@ -694,21 +700,21 @@ export interface FilteringEventArgs {
|
|
|
694
700
|
}
|
|
695
701
|
export interface PopupEventArgs {
|
|
696
702
|
/**
|
|
697
|
-
*
|
|
703
|
+
* Specifies the popup Object.
|
|
698
704
|
*
|
|
699
705
|
|
|
700
706
|
*/
|
|
701
707
|
popup: Popup;
|
|
702
708
|
/**
|
|
703
|
-
*
|
|
709
|
+
* Illustrates whether the current action needs to be prevented or not.
|
|
704
710
|
*/
|
|
705
711
|
cancel?: boolean;
|
|
706
712
|
/**
|
|
707
|
-
*
|
|
713
|
+
* Specifies the animation Object.
|
|
708
714
|
*/
|
|
709
715
|
animation?: AnimationModel;
|
|
710
716
|
/**
|
|
711
|
-
*
|
|
717
|
+
* Specifies the event.
|
|
712
718
|
*/
|
|
713
719
|
event?: MouseEvent | KeyboardEventArgs | TouchEvent | Object;
|
|
714
720
|
}
|
|
@@ -91,6 +91,11 @@ var DropDownBase = /** @class */ (function (_super) {
|
|
|
91
91
|
_this.addedNewItem = false;
|
|
92
92
|
_this.isAddNewItemTemplate = false;
|
|
93
93
|
_this.isRequesting = false;
|
|
94
|
+
_this.isVirtualizationEnabled = false;
|
|
95
|
+
_this.isAllowFiltering = false;
|
|
96
|
+
_this.virtualizedItemsCount = 0;
|
|
97
|
+
_this.totalItemCount = 0;
|
|
98
|
+
_this.dataCount = 0;
|
|
94
99
|
return _this;
|
|
95
100
|
}
|
|
96
101
|
DropDownBase.prototype.getPropObject = function (prop, newProp, oldProp) {
|
|
@@ -495,11 +500,12 @@ var DropDownBase = /** @class */ (function (_super) {
|
|
|
495
500
|
_this.isPreventChange = _this.isAngular && _this.preventChange ? true : _this.isPreventChange;
|
|
496
501
|
_this.trigger('actionComplete', e, function (e) {
|
|
497
502
|
if (!e.cancel) {
|
|
498
|
-
_this.isRequesting = false;
|
|
499
503
|
var listItems = e.result;
|
|
500
504
|
if (listItems.length === 0) {
|
|
501
505
|
_this.isDataFetched = true;
|
|
502
506
|
}
|
|
507
|
+
_this.dataCount = e.count;
|
|
508
|
+
_this.totalItemCount = e.count;
|
|
503
509
|
ulElement = _this.renderItems(listItems, fields);
|
|
504
510
|
_this.onActionComplete(ulElement, listItems, e);
|
|
505
511
|
if (_this.groupTemplate) {
|
|
@@ -508,6 +514,7 @@ var DropDownBase = /** @class */ (function (_super) {
|
|
|
508
514
|
_this.isRequested = false;
|
|
509
515
|
_this.bindChildItems(listItems, ulElement, fields, e);
|
|
510
516
|
}
|
|
517
|
+
_this.isRequesting = false;
|
|
511
518
|
});
|
|
512
519
|
}).catch(function (e) {
|
|
513
520
|
_this.isRequested = false;
|
|
@@ -517,13 +524,19 @@ var DropDownBase = /** @class */ (function (_super) {
|
|
|
517
524
|
});
|
|
518
525
|
}
|
|
519
526
|
else {
|
|
527
|
+
_this.isRequesting = false;
|
|
520
528
|
var dataManager = new DataManager(eventArgs.data);
|
|
521
529
|
var listItems = (_this.getQuery(eventArgs.query)).executeLocal(dataManager);
|
|
530
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
531
|
+
_this.dataCount = listItems.count;
|
|
532
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
533
|
+
_this.totalItemCount = listItems.count;
|
|
534
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
535
|
+
listItems = _this.isVirtualizationEnabled ? listItems.result : listItems;
|
|
522
536
|
var localDataArgs = { cancel: false, result: listItems };
|
|
523
537
|
_this.isPreventChange = _this.isAngular && _this.preventChange ? true : _this.isPreventChange;
|
|
524
538
|
_this.trigger('actionComplete', localDataArgs, function (localDataArgs) {
|
|
525
539
|
if (!localDataArgs.cancel) {
|
|
526
|
-
_this.isRequesting = false;
|
|
527
540
|
ulElement = _this.renderItems(localDataArgs.result, fields);
|
|
528
541
|
_this.onActionComplete(ulElement, localDataArgs.result, event);
|
|
529
542
|
if (_this.groupTemplate) {
|
|
@@ -617,6 +630,11 @@ var DropDownBase = /** @class */ (function (_super) {
|
|
|
617
630
|
DropDownBase.prototype.onActionComplete = function (ulElement, list, e) {
|
|
618
631
|
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
619
632
|
this.listData = list;
|
|
633
|
+
if (this.isVirtualizationEnabled) {
|
|
634
|
+
this.notify("setGeneratedData", {
|
|
635
|
+
module: "VirtualScroll",
|
|
636
|
+
});
|
|
637
|
+
}
|
|
620
638
|
if (this.getModuleName() !== 'listbox') {
|
|
621
639
|
ulElement.setAttribute('tabindex', '0');
|
|
622
640
|
}
|
|
@@ -635,11 +653,13 @@ var DropDownBase = /** @class */ (function (_super) {
|
|
|
635
653
|
}
|
|
636
654
|
}
|
|
637
655
|
if (!isNullOrUndefined(this.list)) {
|
|
638
|
-
this.
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
656
|
+
if (!this.isVirtualizationEnabled) {
|
|
657
|
+
this.list.innerHTML = '';
|
|
658
|
+
this.list.appendChild(ulElement);
|
|
659
|
+
this.liCollections = this.list.querySelectorAll('.' + dropDownBaseClasses.li);
|
|
660
|
+
this.ulElement = this.list.querySelector('ul');
|
|
661
|
+
this.postRender(this.list, list, this.bindEvent);
|
|
662
|
+
}
|
|
643
663
|
}
|
|
644
664
|
};
|
|
645
665
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
@@ -667,6 +687,11 @@ var DropDownBase = /** @class */ (function (_super) {
|
|
|
667
687
|
DropDownBase.prototype.getQuery = function (query) {
|
|
668
688
|
return query ? query : this.query ? this.query : new Query();
|
|
669
689
|
};
|
|
690
|
+
DropDownBase.prototype.updateVirtualizationProperties = function (itemCount, filtering) {
|
|
691
|
+
this.isVirtualizationEnabled = true;
|
|
692
|
+
this.virtualizedItemsCount = itemCount;
|
|
693
|
+
this.isAllowFiltering = filtering;
|
|
694
|
+
};
|
|
670
695
|
/**
|
|
671
696
|
* To render the template content for group header element.
|
|
672
697
|
*
|
|
@@ -805,9 +830,47 @@ var DropDownBase = /** @class */ (function (_super) {
|
|
|
805
830
|
new DataManager(dataSource).executeLocal(new Query().take(100))
|
|
806
831
|
: dataSource;
|
|
807
832
|
ulElement = this.templateListItem((this.getModuleName() === 'autocomplete') ? spliceData : dataSource, fields);
|
|
833
|
+
if (this.isVirtualizationEnabled) {
|
|
834
|
+
var oldUlElement = this.list.querySelector('.e-list-parent');
|
|
835
|
+
var virtualUlElement = this.list.querySelector('.e-virtual-ddl-content');
|
|
836
|
+
if ((listData.length >= this.virtualizedItemsCount && oldUlElement && virtualUlElement) || (oldUlElement && virtualUlElement && this.isAllowFiltering) || (oldUlElement && virtualUlElement && this.getModuleName() === 'autocomplete')) {
|
|
837
|
+
virtualUlElement.replaceChild(ulElement, oldUlElement);
|
|
838
|
+
this.liCollections = this.list.querySelectorAll('.' + dropDownBaseClasses.li);
|
|
839
|
+
this.ulElement = this.list.querySelector('ul');
|
|
840
|
+
this.listData = listData;
|
|
841
|
+
this.postRender(this.list, listData, this.bindEvent);
|
|
842
|
+
}
|
|
843
|
+
else if ((!virtualUlElement)) {
|
|
844
|
+
this.list.innerHTML = '';
|
|
845
|
+
this.list.appendChild(ulElement);
|
|
846
|
+
this.liCollections = this.list.querySelectorAll('.' + dropDownBaseClasses.li);
|
|
847
|
+
this.ulElement = this.list.querySelector('ul');
|
|
848
|
+
this.listData = listData;
|
|
849
|
+
this.postRender(this.list, listData, this.bindEvent);
|
|
850
|
+
}
|
|
851
|
+
}
|
|
808
852
|
}
|
|
809
853
|
else {
|
|
810
854
|
ulElement = this.createListItems(listData, fields);
|
|
855
|
+
if (this.isVirtualizationEnabled) {
|
|
856
|
+
var oldUlElement = this.list.querySelector('.e-list-parent');
|
|
857
|
+
var virtualUlElement = this.list.querySelector('.e-virtual-ddl-content');
|
|
858
|
+
if ((listData.length >= this.virtualizedItemsCount && oldUlElement && virtualUlElement) || (oldUlElement && virtualUlElement && this.isAllowFiltering) || (oldUlElement && virtualUlElement && this.getModuleName() === 'autocomplete')) {
|
|
859
|
+
virtualUlElement.replaceChild(ulElement, oldUlElement);
|
|
860
|
+
this.liCollections = this.list.querySelectorAll('.' + dropDownBaseClasses.li);
|
|
861
|
+
this.ulElement = this.list.querySelector('ul');
|
|
862
|
+
this.listData = listData;
|
|
863
|
+
this.postRender(this.list, listData, this.bindEvent);
|
|
864
|
+
}
|
|
865
|
+
else if ((!virtualUlElement)) {
|
|
866
|
+
this.list.innerHTML = '';
|
|
867
|
+
this.list.appendChild(ulElement);
|
|
868
|
+
this.liCollections = this.list.querySelectorAll('.' + dropDownBaseClasses.li);
|
|
869
|
+
this.ulElement = this.list.querySelector('ul');
|
|
870
|
+
this.listData = listData;
|
|
871
|
+
this.postRender(this.list, listData, this.bindEvent);
|
|
872
|
+
}
|
|
873
|
+
}
|
|
811
874
|
}
|
|
812
875
|
return ulElement;
|
|
813
876
|
};
|
|
@@ -947,7 +1010,7 @@ var DropDownBase = /** @class */ (function (_super) {
|
|
|
947
1010
|
}
|
|
948
1011
|
};
|
|
949
1012
|
DropDownBase.prototype.updateSelectElementData = function (isFiltering) {
|
|
950
|
-
if (isFiltering && isNullOrUndefined(this.selectData) && this.listData && this.listData.length > 0) {
|
|
1013
|
+
if ((isFiltering || this.isVirtualizationEnabled) && isNullOrUndefined(this.selectData) && this.listData && this.listData.length > 0) {
|
|
951
1014
|
this.selectData = this.listData;
|
|
952
1015
|
}
|
|
953
1016
|
};
|
|
@@ -961,6 +1024,7 @@ var DropDownBase = /** @class */ (function (_super) {
|
|
|
961
1024
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
962
1025
|
DropDownBase.prototype.updateDataSource = function (props) {
|
|
963
1026
|
this.resetList(this.dataSource);
|
|
1027
|
+
this.totalItemCount = this.dataSource instanceof DataManager ? this.dataSource.dataSource.json.length : 0;
|
|
964
1028
|
};
|
|
965
1029
|
DropDownBase.prototype.setUpdateInitial = function (props, newProp) {
|
|
966
1030
|
this.isDataFetched = false;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EventHandler, Property, Event, compile, EmitType, KeyboardEvents, append, select } from '@syncfusion/ej2-base';import { attributes, isNullOrUndefined, getUniqueID, formatUnit, isUndefined, getValue } from '@syncfusion/ej2-base';import { Animation, AnimationModel, Browser, KeyboardEventArgs, NotifyPropertyChanges } from '@syncfusion/ej2-base';import { addClass, removeClass, closest, prepend, detach, classList } from '@syncfusion/ej2-base';import { Popup, isCollide, createSpinner, showSpinner, hideSpinner } from '@syncfusion/ej2-popups';import { IInput, Input, InputObject, FloatLabelType } from '@syncfusion/ej2-inputs';import { incrementalSearch, resetIncrementalSearchValues } from '../common/incremental-search';import { DropDownBase, dropDownBaseClasses, SelectEventArgs, FilteringEventArgs, PopupEventArgs } from '../drop-down-base/drop-down-base';import { FocusEventArgs, ResultData, BeforeOpenEventArgs } from '../drop-down-base/drop-down-base';import { FieldSettingsModel } from '../drop-down-base/drop-down-base-model';import { DataManager, Query, Predicate } from '@syncfusion/ej2-data';
|
|
1
|
+
import { EventHandler, Property, Event, compile, EmitType, KeyboardEvents, append, select, ModuleDeclaration } from '@syncfusion/ej2-base';import { attributes, isNullOrUndefined, getUniqueID, formatUnit, isUndefined, getValue } from '@syncfusion/ej2-base';import { Animation, AnimationModel, Browser, KeyboardEventArgs, NotifyPropertyChanges } from '@syncfusion/ej2-base';import { addClass, removeClass, closest, prepend, detach, classList } from '@syncfusion/ej2-base';import { Popup, isCollide, createSpinner, showSpinner, hideSpinner } from '@syncfusion/ej2-popups';import { IInput, Input, InputObject, FloatLabelType } from '@syncfusion/ej2-inputs';import { incrementalSearch, resetIncrementalSearchValues } from '../common/incremental-search';import { DropDownBase, dropDownBaseClasses, SelectEventArgs, FilteringEventArgs, PopupEventArgs } from '../drop-down-base/drop-down-base';import { FocusEventArgs, ResultData, BeforeOpenEventArgs } from '../drop-down-base/drop-down-base';import { FieldSettingsModel } from '../drop-down-base/drop-down-base-model';import { DataManager, Query, Predicate, DataOptions } from '@syncfusion/ej2-data';import {VirtualScroll, Offsets, ScrollDirection, SentinelType, VirtualInfo} from '../common/virtual-scroll';import { Skeleton } from '@syncfusion/ej2-notifications';
|
|
2
2
|
import {ChangeEventArgs} from "./drop-down-list";
|
|
3
3
|
import {DropDownBaseModel} from "../drop-down-base/drop-down-base-model";
|
|
4
4
|
|
|
@@ -152,6 +152,13 @@ export interface DropDownListModel extends DropDownBaseModel{
|
|
|
152
152
|
*/
|
|
153
153
|
readonly?: boolean;
|
|
154
154
|
|
|
155
|
+
/**
|
|
156
|
+
* Defines whether to enable virtual scrolling in the component.
|
|
157
|
+
*
|
|
158
|
+
* @default false
|
|
159
|
+
*/
|
|
160
|
+
enableVirtualization?: boolean;
|
|
161
|
+
|
|
155
162
|
/**
|
|
156
163
|
* Gets or sets the display text of the selected item in the component.
|
|
157
164
|
*
|