angular-multiselect3 10.0.0
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/LICENSE +20 -0
- package/README.md +306 -0
- package/esm2022/angular-multiselect.mjs +5 -0
- package/esm2022/lib/clickOutside.mjs +58 -0
- package/esm2022/lib/list-filter.mjs +59 -0
- package/esm2022/lib/menu-item.mjs +352 -0
- package/esm2022/lib/multiselect.component.mjs +1038 -0
- package/esm2022/lib/multiselect.interface.mjs +2 -0
- package/esm2022/lib/multiselect.model.mjs +9 -0
- package/esm2022/lib/multiselect.service.mjs +28 -0
- package/esm2022/lib/virtual-scroll/defaultoptions.mjs +2 -0
- package/esm2022/lib/virtual-scroll/idimension.mjs +2 -0
- package/esm2022/lib/virtual-scroll/ipageinfo.mjs +2 -0
- package/esm2022/lib/virtual-scroll/iviewport.mjs +2 -0
- package/esm2022/lib/virtual-scroll/virtual-scroll.mjs +1162 -0
- package/esm2022/lib/virtual-scroll/wrapgroupdimension.mjs +2 -0
- package/esm2022/lib/virtual-scroll/wrapgroupdimensions.mjs +2 -0
- package/esm2022/public_api.mjs +7 -0
- package/fesm2022/angular-multiselect.mjs +2689 -0
- package/fesm2022/angular-multiselect.mjs.map +1 -0
- package/index.d.ts +5 -0
- package/lib/clickOutside.d.ts +17 -0
- package/lib/list-filter.d.ts +12 -0
- package/lib/menu-item.d.ts +36 -0
- package/lib/multiselect.component.d.ts +134 -0
- package/lib/multiselect.interface.d.ts +34 -0
- package/lib/multiselect.model.d.ts +5 -0
- package/lib/multiselect.service.d.ts +11 -0
- package/lib/virtual-scroll/defaultoptions.d.ts +11 -0
- package/lib/virtual-scroll/idimension.d.ts +12 -0
- package/lib/virtual-scroll/ipageinfo.d.ts +9 -0
- package/lib/virtual-scroll/iviewport.d.ts +5 -0
- package/lib/virtual-scroll/virtual-scroll.d.ts +132 -0
- package/lib/virtual-scroll/wrapgroupdimension.d.ts +5 -0
- package/lib/virtual-scroll/wrapgroupdimensions.d.ts +7 -0
- package/package.json +37 -0
- package/public_api.d.ts +6 -0
- package/themes/dark.theme.scss +113 -0
- package/themes/default.theme.css +107 -0
- package/themes/default.theme.scss +155 -0
|
@@ -0,0 +1,2689 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { EventEmitter, Directive, Input, Output, HostListener, Injectable, Pipe, TemplateRef, Component, ContentChild, ViewEncapsulation, PLATFORM_ID, ElementRef, Inject, Optional, ViewChild, NgModule, forwardRef } from '@angular/core';
|
|
3
|
+
import * as i3 from '@angular/forms';
|
|
4
|
+
import { NG_VALUE_ACCESSOR, NG_VALIDATORS, FormsModule } from '@angular/forms';
|
|
5
|
+
import * as i2 from '@angular/common';
|
|
6
|
+
import { isPlatformServer, CommonModule } from '@angular/common';
|
|
7
|
+
import { Subject } from 'rxjs';
|
|
8
|
+
import * as tween from '@tweenjs/tween.js';
|
|
9
|
+
import { debounceTime, distinctUntilChanged, tap } from 'rxjs/operators';
|
|
10
|
+
|
|
11
|
+
class MyException {
|
|
12
|
+
status;
|
|
13
|
+
body;
|
|
14
|
+
constructor(status, body) {
|
|
15
|
+
this.status = status;
|
|
16
|
+
this.body = body;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
class ClickOutsideDirective {
|
|
21
|
+
_elementRef;
|
|
22
|
+
constructor(_elementRef) {
|
|
23
|
+
this._elementRef = _elementRef;
|
|
24
|
+
}
|
|
25
|
+
enabled;
|
|
26
|
+
clickOutside = new EventEmitter();
|
|
27
|
+
onClick(event, targetElement) {
|
|
28
|
+
console.log('clicked outside');
|
|
29
|
+
if (!targetElement || !this.enabled) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
const clickedInside = this._elementRef.nativeElement.contains(targetElement);
|
|
33
|
+
if (!clickedInside) {
|
|
34
|
+
this.clickOutside.emit(event);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: ClickOutsideDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
38
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.14", type: ClickOutsideDirective, selector: "[clickOutside]", inputs: { enabled: "enabled" }, outputs: { clickOutside: "clickOutside" }, host: { listeners: { "document:pointerdown": "onClick($event,$event.target)", "document:touchstart": "onClick($event,$event.target)" } }, ngImport: i0 });
|
|
39
|
+
}
|
|
40
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: ClickOutsideDirective, decorators: [{
|
|
41
|
+
type: Directive,
|
|
42
|
+
args: [{
|
|
43
|
+
selector: '[clickOutside]',
|
|
44
|
+
}]
|
|
45
|
+
}], ctorParameters: () => [{ type: i0.ElementRef }], propDecorators: { enabled: [{
|
|
46
|
+
type: Input
|
|
47
|
+
}], clickOutside: [{
|
|
48
|
+
type: Output
|
|
49
|
+
}], onClick: [{
|
|
50
|
+
type: HostListener,
|
|
51
|
+
args: ['document:pointerdown', ['$event', '$event.target']]
|
|
52
|
+
}, {
|
|
53
|
+
type: HostListener,
|
|
54
|
+
args: ['document:touchstart', ['$event', '$event.target']]
|
|
55
|
+
}] } });
|
|
56
|
+
class ScrollDirective {
|
|
57
|
+
scroll = new EventEmitter();
|
|
58
|
+
onClick(event, targetElement) {
|
|
59
|
+
this.scroll.emit(event);
|
|
60
|
+
}
|
|
61
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: ScrollDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
62
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.14", type: ScrollDirective, selector: "[scroll]", outputs: { scroll: "scroll" }, host: { listeners: { "scroll": "onClick($event)" } }, ngImport: i0 });
|
|
63
|
+
}
|
|
64
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: ScrollDirective, decorators: [{
|
|
65
|
+
type: Directive,
|
|
66
|
+
args: [{
|
|
67
|
+
selector: '[scroll]',
|
|
68
|
+
}]
|
|
69
|
+
}], propDecorators: { scroll: [{
|
|
70
|
+
type: Output
|
|
71
|
+
}], onClick: [{
|
|
72
|
+
type: HostListener,
|
|
73
|
+
args: ['scroll', ['$event']]
|
|
74
|
+
}] } });
|
|
75
|
+
|
|
76
|
+
class DataService {
|
|
77
|
+
filteredData = [];
|
|
78
|
+
subject = new Subject();
|
|
79
|
+
setData(data) {
|
|
80
|
+
this.filteredData = data;
|
|
81
|
+
this.subject.next(data);
|
|
82
|
+
}
|
|
83
|
+
getData() {
|
|
84
|
+
return this.subject.asObservable();
|
|
85
|
+
}
|
|
86
|
+
getFilteredData() {
|
|
87
|
+
if (this.filteredData && this.filteredData.length > 0) {
|
|
88
|
+
return this.filteredData;
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
return [];
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: DataService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
95
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: DataService });
|
|
96
|
+
}
|
|
97
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: DataService, decorators: [{
|
|
98
|
+
type: Injectable
|
|
99
|
+
}] });
|
|
100
|
+
|
|
101
|
+
class ListFilterPipe {
|
|
102
|
+
ds;
|
|
103
|
+
filteredList = [];
|
|
104
|
+
constructor(ds) {
|
|
105
|
+
this.ds = ds;
|
|
106
|
+
}
|
|
107
|
+
transform(items, filter, searchBy) {
|
|
108
|
+
if (!items || !filter || filter == "") {
|
|
109
|
+
return items;
|
|
110
|
+
}
|
|
111
|
+
this.filteredList = items.filter((item) => this.applyFilter(item, filter, searchBy));
|
|
112
|
+
return this.filteredList;
|
|
113
|
+
}
|
|
114
|
+
applyFilter(item, filter, searchBy) {
|
|
115
|
+
let found = false;
|
|
116
|
+
if (searchBy.length > 0) {
|
|
117
|
+
if (item.grpTitle) {
|
|
118
|
+
found = true;
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
for (var t = 0; t < searchBy.length; t++) {
|
|
122
|
+
if (filter && item[searchBy[t]] && item[searchBy[t]] != "") {
|
|
123
|
+
if (item[searchBy[t]].toString().toLowerCase().indexOf(filter.toLowerCase()) >= 0) {
|
|
124
|
+
found = true;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
if (item.grpTitle) {
|
|
132
|
+
found = true;
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
for (var prop in item) {
|
|
136
|
+
if (filter && item[prop]) {
|
|
137
|
+
if (item[prop].toString().toLowerCase().indexOf(filter.toLowerCase()) >= 0) {
|
|
138
|
+
found = true;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
return found;
|
|
145
|
+
}
|
|
146
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: ListFilterPipe, deps: [{ token: DataService }], target: i0.ɵɵFactoryTarget.Pipe });
|
|
147
|
+
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.2.14", ngImport: i0, type: ListFilterPipe, name: "listFilter" });
|
|
148
|
+
}
|
|
149
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: ListFilterPipe, decorators: [{
|
|
150
|
+
type: Pipe,
|
|
151
|
+
args: [{
|
|
152
|
+
name: 'listFilter',
|
|
153
|
+
pure: true
|
|
154
|
+
}]
|
|
155
|
+
}], ctorParameters: () => [{ type: DataService }] });
|
|
156
|
+
|
|
157
|
+
class Item {
|
|
158
|
+
template;
|
|
159
|
+
constructor() { }
|
|
160
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: Item, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
161
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.14", type: Item, selector: "c-item", queries: [{ propertyName: "template", first: true, predicate: TemplateRef, descendants: true, static: true }], ngImport: i0, template: ``, isInline: true });
|
|
162
|
+
}
|
|
163
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: Item, decorators: [{
|
|
164
|
+
type: Component,
|
|
165
|
+
args: [{
|
|
166
|
+
selector: 'c-item',
|
|
167
|
+
template: ``,
|
|
168
|
+
}]
|
|
169
|
+
}], ctorParameters: () => [], propDecorators: { template: [{
|
|
170
|
+
type: ContentChild,
|
|
171
|
+
args: [TemplateRef, { static: true }]
|
|
172
|
+
}] } });
|
|
173
|
+
class Badge {
|
|
174
|
+
template;
|
|
175
|
+
constructor() { }
|
|
176
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: Badge, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
177
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.14", type: Badge, selector: "c-badge", queries: [{ propertyName: "template", first: true, predicate: TemplateRef, descendants: true, static: true }], ngImport: i0, template: ``, isInline: true });
|
|
178
|
+
}
|
|
179
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: Badge, decorators: [{
|
|
180
|
+
type: Component,
|
|
181
|
+
args: [{
|
|
182
|
+
selector: 'c-badge',
|
|
183
|
+
template: ``,
|
|
184
|
+
}]
|
|
185
|
+
}], ctorParameters: () => [], propDecorators: { template: [{
|
|
186
|
+
type: ContentChild,
|
|
187
|
+
args: [TemplateRef, { static: true }]
|
|
188
|
+
}] } });
|
|
189
|
+
class Search {
|
|
190
|
+
template;
|
|
191
|
+
constructor() { }
|
|
192
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: Search, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
193
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.14", type: Search, selector: "c-search", queries: [{ propertyName: "template", first: true, predicate: TemplateRef, descendants: true, static: true }], ngImport: i0, template: ``, isInline: true });
|
|
194
|
+
}
|
|
195
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: Search, decorators: [{
|
|
196
|
+
type: Component,
|
|
197
|
+
args: [{
|
|
198
|
+
selector: 'c-search',
|
|
199
|
+
template: ``,
|
|
200
|
+
}]
|
|
201
|
+
}], ctorParameters: () => [], propDecorators: { template: [{
|
|
202
|
+
type: ContentChild,
|
|
203
|
+
args: [TemplateRef, { static: true }]
|
|
204
|
+
}] } });
|
|
205
|
+
class TemplateRenderer {
|
|
206
|
+
viewContainer;
|
|
207
|
+
data;
|
|
208
|
+
item;
|
|
209
|
+
view;
|
|
210
|
+
constructor(viewContainer) {
|
|
211
|
+
this.viewContainer = viewContainer;
|
|
212
|
+
}
|
|
213
|
+
ngOnInit() {
|
|
214
|
+
this.view = this.viewContainer.createEmbeddedView(this.data.template, {
|
|
215
|
+
$implicit: this.data,
|
|
216
|
+
item: this.item,
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
ngOnDestroy() {
|
|
220
|
+
this.view.destroy();
|
|
221
|
+
}
|
|
222
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: TemplateRenderer, deps: [{ token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
223
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.14", type: TemplateRenderer, selector: "c-templateRenderer", inputs: { data: "data", item: "item" }, ngImport: i0, template: ``, isInline: true });
|
|
224
|
+
}
|
|
225
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: TemplateRenderer, decorators: [{
|
|
226
|
+
type: Component,
|
|
227
|
+
args: [{
|
|
228
|
+
selector: 'c-templateRenderer',
|
|
229
|
+
template: ``,
|
|
230
|
+
}]
|
|
231
|
+
}], ctorParameters: () => [{ type: i0.ViewContainerRef }], propDecorators: { data: [{
|
|
232
|
+
type: Input
|
|
233
|
+
}], item: [{
|
|
234
|
+
type: Input
|
|
235
|
+
}] } });
|
|
236
|
+
class CIcon {
|
|
237
|
+
name;
|
|
238
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: CIcon, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
239
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.14", type: CIcon, selector: "c-icon", inputs: { name: "name" }, ngImport: i0, template: `<svg
|
|
240
|
+
*ngIf="name == 'remove'"
|
|
241
|
+
width="100%"
|
|
242
|
+
height="100%"
|
|
243
|
+
version="1.1"
|
|
244
|
+
id="Capa_1"
|
|
245
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
246
|
+
xmlns:xlink="http://www.w3.org/1999/xlink"
|
|
247
|
+
x="0px"
|
|
248
|
+
y="0px"
|
|
249
|
+
viewBox="0 0 47.971 47.971"
|
|
250
|
+
style="enable-background:new 0 0 47.971 47.971;"
|
|
251
|
+
xml:space="preserve"
|
|
252
|
+
>
|
|
253
|
+
<g>
|
|
254
|
+
<path
|
|
255
|
+
d="M28.228,23.986L47.092,5.122c1.172-1.171,1.172-3.071,0-4.242c-1.172-1.172-3.07-1.172-4.242,0L23.986,19.744L5.121,0.88
|
|
256
|
+
c-1.172-1.172-3.07-1.172-4.242,0c-1.172,1.171-1.172,3.071,0,4.242l18.865,18.864L0.879,42.85c-1.172,1.171-1.172,3.071,0,4.242
|
|
257
|
+
C1.465,47.677,2.233,47.97,3,47.97s1.535-0.293,2.121-0.879l18.865-18.864L42.85,47.091c0.586,0.586,1.354,0.879,2.121,0.879
|
|
258
|
+
s1.535-0.293,2.121-0.879c1.172-1.171,1.172-3.071,0-4.242L28.228,23.986z"
|
|
259
|
+
/>
|
|
260
|
+
</g>
|
|
261
|
+
</svg>
|
|
262
|
+
<svg
|
|
263
|
+
*ngIf="name == 'angle-down'"
|
|
264
|
+
version="1.1"
|
|
265
|
+
id="Capa_1"
|
|
266
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
267
|
+
xmlns:xlink="http://www.w3.org/1999/xlink"
|
|
268
|
+
x="0px"
|
|
269
|
+
y="0px"
|
|
270
|
+
width="100%"
|
|
271
|
+
height="100%"
|
|
272
|
+
viewBox="0 0 612 612"
|
|
273
|
+
style="enable-background:new 0 0 612 612;"
|
|
274
|
+
xml:space="preserve"
|
|
275
|
+
>
|
|
276
|
+
<g>
|
|
277
|
+
<g id="_x31_0_34_">
|
|
278
|
+
<g>
|
|
279
|
+
<path
|
|
280
|
+
d="M604.501,134.782c-9.999-10.05-26.222-10.05-36.221,0L306.014,422.558L43.721,134.782
|
|
281
|
+
c-9.999-10.05-26.223-10.05-36.222,0s-9.999,26.35,0,36.399l279.103,306.241c5.331,5.357,12.422,7.652,19.386,7.296
|
|
282
|
+
c6.988,0.356,14.055-1.939,19.386-7.296l279.128-306.268C614.5,161.106,614.5,144.832,604.501,134.782z"
|
|
283
|
+
/>
|
|
284
|
+
</g>
|
|
285
|
+
</g>
|
|
286
|
+
</g>
|
|
287
|
+
</svg>
|
|
288
|
+
<svg
|
|
289
|
+
*ngIf="name == 'angle-up'"
|
|
290
|
+
version="1.1"
|
|
291
|
+
id="Capa_1"
|
|
292
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
293
|
+
xmlns:xlink="http://www.w3.org/1999/xlink"
|
|
294
|
+
x="0px"
|
|
295
|
+
y="0px"
|
|
296
|
+
width="100%"
|
|
297
|
+
height="100%"
|
|
298
|
+
viewBox="0 0 612 612"
|
|
299
|
+
style="enable-background:new 0 0 612 612;"
|
|
300
|
+
xml:space="preserve"
|
|
301
|
+
>
|
|
302
|
+
<g>
|
|
303
|
+
<g id="_x39__30_">
|
|
304
|
+
<g>
|
|
305
|
+
<path
|
|
306
|
+
d="M604.501,440.509L325.398,134.956c-5.331-5.357-12.423-7.627-19.386-7.27c-6.989-0.357-14.056,1.913-19.387,7.27
|
|
307
|
+
L7.499,440.509c-9.999,10.024-9.999,26.298,0,36.323s26.223,10.024,36.222,0l262.293-287.164L568.28,476.832
|
|
308
|
+
c9.999,10.024,26.222,10.024,36.221,0C614.5,466.809,614.5,450.534,604.501,440.509z"
|
|
309
|
+
/>
|
|
310
|
+
</g>
|
|
311
|
+
</g>
|
|
312
|
+
</g>
|
|
313
|
+
</svg>
|
|
314
|
+
<svg
|
|
315
|
+
*ngIf="name == 'search'"
|
|
316
|
+
version="1.1"
|
|
317
|
+
id="Capa_1"
|
|
318
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
319
|
+
xmlns:xlink="http://www.w3.org/1999/xlink"
|
|
320
|
+
x="0px"
|
|
321
|
+
y="0px"
|
|
322
|
+
width="100%"
|
|
323
|
+
height="100%"
|
|
324
|
+
viewBox="0 0 615.52 615.52"
|
|
325
|
+
style="enable-background:new 0 0 615.52 615.52;"
|
|
326
|
+
xml:space="preserve"
|
|
327
|
+
>
|
|
328
|
+
<g>
|
|
329
|
+
<g>
|
|
330
|
+
<g id="Search__x28_and_thou_shall_find_x29_">
|
|
331
|
+
<g>
|
|
332
|
+
<path
|
|
333
|
+
d="M602.531,549.736l-184.31-185.368c26.679-37.72,42.528-83.729,42.528-133.548C460.75,103.35,357.997,0,231.258,0
|
|
334
|
+
C104.518,0,1.765,103.35,1.765,230.82c0,127.47,102.753,230.82,229.493,230.82c49.53,0,95.271-15.944,132.78-42.777
|
|
335
|
+
l184.31,185.366c7.482,7.521,17.292,11.291,27.102,11.291c9.812,0,19.62-3.77,27.083-11.291
|
|
336
|
+
C617.496,589.188,617.496,564.777,602.531,549.736z M355.9,319.763l-15.042,21.273L319.7,356.174
|
|
337
|
+
c-26.083,18.658-56.667,28.526-88.442,28.526c-84.365,0-152.995-69.035-152.995-153.88c0-84.846,68.63-153.88,152.995-153.88
|
|
338
|
+
s152.996,69.034,152.996,153.88C384.271,262.769,374.462,293.526,355.9,319.763z"
|
|
339
|
+
/>
|
|
340
|
+
</g>
|
|
341
|
+
</g>
|
|
342
|
+
</g>
|
|
343
|
+
</g>
|
|
344
|
+
</svg>
|
|
345
|
+
<svg
|
|
346
|
+
*ngIf="name == 'clear'"
|
|
347
|
+
version="1.1"
|
|
348
|
+
id="Capa_1"
|
|
349
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
350
|
+
xmlns:xlink="http://www.w3.org/1999/xlink"
|
|
351
|
+
x="0px"
|
|
352
|
+
y="0px"
|
|
353
|
+
viewBox="0 0 51.976 51.976"
|
|
354
|
+
style="enable-background:new 0 0 51.976 51.976;"
|
|
355
|
+
xml:space="preserve"
|
|
356
|
+
>
|
|
357
|
+
<g>
|
|
358
|
+
<path
|
|
359
|
+
d="M44.373,7.603c-10.137-10.137-26.632-10.138-36.77,0c-10.138,10.138-10.137,26.632,0,36.77s26.632,10.138,36.77,0
|
|
360
|
+
C54.51,34.235,54.51,17.74,44.373,7.603z M36.241,36.241c-0.781,0.781-2.047,0.781-2.828,0l-7.425-7.425l-7.778,7.778
|
|
361
|
+
c-0.781,0.781-2.047,0.781-2.828,0c-0.781-0.781-0.781-2.047,0-2.828l7.778-7.778l-7.425-7.425c-0.781-0.781-0.781-2.048,0-2.828
|
|
362
|
+
c0.781-0.781,2.047-0.781,2.828,0l7.425,7.425l7.071-7.071c0.781-0.781,2.047-0.781,2.828,0c0.781,0.781,0.781,2.047,0,2.828
|
|
363
|
+
l-7.071,7.071l7.425,7.425C37.022,34.194,37.022,35.46,36.241,36.241z"
|
|
364
|
+
/>
|
|
365
|
+
</g>
|
|
366
|
+
</svg>`, isInline: true, dependencies: [{ kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], encapsulation: i0.ViewEncapsulation.None });
|
|
367
|
+
}
|
|
368
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: CIcon, decorators: [{
|
|
369
|
+
type: Component,
|
|
370
|
+
args: [{
|
|
371
|
+
selector: 'c-icon',
|
|
372
|
+
template: `<svg
|
|
373
|
+
*ngIf="name == 'remove'"
|
|
374
|
+
width="100%"
|
|
375
|
+
height="100%"
|
|
376
|
+
version="1.1"
|
|
377
|
+
id="Capa_1"
|
|
378
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
379
|
+
xmlns:xlink="http://www.w3.org/1999/xlink"
|
|
380
|
+
x="0px"
|
|
381
|
+
y="0px"
|
|
382
|
+
viewBox="0 0 47.971 47.971"
|
|
383
|
+
style="enable-background:new 0 0 47.971 47.971;"
|
|
384
|
+
xml:space="preserve"
|
|
385
|
+
>
|
|
386
|
+
<g>
|
|
387
|
+
<path
|
|
388
|
+
d="M28.228,23.986L47.092,5.122c1.172-1.171,1.172-3.071,0-4.242c-1.172-1.172-3.07-1.172-4.242,0L23.986,19.744L5.121,0.88
|
|
389
|
+
c-1.172-1.172-3.07-1.172-4.242,0c-1.172,1.171-1.172,3.071,0,4.242l18.865,18.864L0.879,42.85c-1.172,1.171-1.172,3.071,0,4.242
|
|
390
|
+
C1.465,47.677,2.233,47.97,3,47.97s1.535-0.293,2.121-0.879l18.865-18.864L42.85,47.091c0.586,0.586,1.354,0.879,2.121,0.879
|
|
391
|
+
s1.535-0.293,2.121-0.879c1.172-1.171,1.172-3.071,0-4.242L28.228,23.986z"
|
|
392
|
+
/>
|
|
393
|
+
</g>
|
|
394
|
+
</svg>
|
|
395
|
+
<svg
|
|
396
|
+
*ngIf="name == 'angle-down'"
|
|
397
|
+
version="1.1"
|
|
398
|
+
id="Capa_1"
|
|
399
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
400
|
+
xmlns:xlink="http://www.w3.org/1999/xlink"
|
|
401
|
+
x="0px"
|
|
402
|
+
y="0px"
|
|
403
|
+
width="100%"
|
|
404
|
+
height="100%"
|
|
405
|
+
viewBox="0 0 612 612"
|
|
406
|
+
style="enable-background:new 0 0 612 612;"
|
|
407
|
+
xml:space="preserve"
|
|
408
|
+
>
|
|
409
|
+
<g>
|
|
410
|
+
<g id="_x31_0_34_">
|
|
411
|
+
<g>
|
|
412
|
+
<path
|
|
413
|
+
d="M604.501,134.782c-9.999-10.05-26.222-10.05-36.221,0L306.014,422.558L43.721,134.782
|
|
414
|
+
c-9.999-10.05-26.223-10.05-36.222,0s-9.999,26.35,0,36.399l279.103,306.241c5.331,5.357,12.422,7.652,19.386,7.296
|
|
415
|
+
c6.988,0.356,14.055-1.939,19.386-7.296l279.128-306.268C614.5,161.106,614.5,144.832,604.501,134.782z"
|
|
416
|
+
/>
|
|
417
|
+
</g>
|
|
418
|
+
</g>
|
|
419
|
+
</g>
|
|
420
|
+
</svg>
|
|
421
|
+
<svg
|
|
422
|
+
*ngIf="name == 'angle-up'"
|
|
423
|
+
version="1.1"
|
|
424
|
+
id="Capa_1"
|
|
425
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
426
|
+
xmlns:xlink="http://www.w3.org/1999/xlink"
|
|
427
|
+
x="0px"
|
|
428
|
+
y="0px"
|
|
429
|
+
width="100%"
|
|
430
|
+
height="100%"
|
|
431
|
+
viewBox="0 0 612 612"
|
|
432
|
+
style="enable-background:new 0 0 612 612;"
|
|
433
|
+
xml:space="preserve"
|
|
434
|
+
>
|
|
435
|
+
<g>
|
|
436
|
+
<g id="_x39__30_">
|
|
437
|
+
<g>
|
|
438
|
+
<path
|
|
439
|
+
d="M604.501,440.509L325.398,134.956c-5.331-5.357-12.423-7.627-19.386-7.27c-6.989-0.357-14.056,1.913-19.387,7.27
|
|
440
|
+
L7.499,440.509c-9.999,10.024-9.999,26.298,0,36.323s26.223,10.024,36.222,0l262.293-287.164L568.28,476.832
|
|
441
|
+
c9.999,10.024,26.222,10.024,36.221,0C614.5,466.809,614.5,450.534,604.501,440.509z"
|
|
442
|
+
/>
|
|
443
|
+
</g>
|
|
444
|
+
</g>
|
|
445
|
+
</g>
|
|
446
|
+
</svg>
|
|
447
|
+
<svg
|
|
448
|
+
*ngIf="name == 'search'"
|
|
449
|
+
version="1.1"
|
|
450
|
+
id="Capa_1"
|
|
451
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
452
|
+
xmlns:xlink="http://www.w3.org/1999/xlink"
|
|
453
|
+
x="0px"
|
|
454
|
+
y="0px"
|
|
455
|
+
width="100%"
|
|
456
|
+
height="100%"
|
|
457
|
+
viewBox="0 0 615.52 615.52"
|
|
458
|
+
style="enable-background:new 0 0 615.52 615.52;"
|
|
459
|
+
xml:space="preserve"
|
|
460
|
+
>
|
|
461
|
+
<g>
|
|
462
|
+
<g>
|
|
463
|
+
<g id="Search__x28_and_thou_shall_find_x29_">
|
|
464
|
+
<g>
|
|
465
|
+
<path
|
|
466
|
+
d="M602.531,549.736l-184.31-185.368c26.679-37.72,42.528-83.729,42.528-133.548C460.75,103.35,357.997,0,231.258,0
|
|
467
|
+
C104.518,0,1.765,103.35,1.765,230.82c0,127.47,102.753,230.82,229.493,230.82c49.53,0,95.271-15.944,132.78-42.777
|
|
468
|
+
l184.31,185.366c7.482,7.521,17.292,11.291,27.102,11.291c9.812,0,19.62-3.77,27.083-11.291
|
|
469
|
+
C617.496,589.188,617.496,564.777,602.531,549.736z M355.9,319.763l-15.042,21.273L319.7,356.174
|
|
470
|
+
c-26.083,18.658-56.667,28.526-88.442,28.526c-84.365,0-152.995-69.035-152.995-153.88c0-84.846,68.63-153.88,152.995-153.88
|
|
471
|
+
s152.996,69.034,152.996,153.88C384.271,262.769,374.462,293.526,355.9,319.763z"
|
|
472
|
+
/>
|
|
473
|
+
</g>
|
|
474
|
+
</g>
|
|
475
|
+
</g>
|
|
476
|
+
</g>
|
|
477
|
+
</svg>
|
|
478
|
+
<svg
|
|
479
|
+
*ngIf="name == 'clear'"
|
|
480
|
+
version="1.1"
|
|
481
|
+
id="Capa_1"
|
|
482
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
483
|
+
xmlns:xlink="http://www.w3.org/1999/xlink"
|
|
484
|
+
x="0px"
|
|
485
|
+
y="0px"
|
|
486
|
+
viewBox="0 0 51.976 51.976"
|
|
487
|
+
style="enable-background:new 0 0 51.976 51.976;"
|
|
488
|
+
xml:space="preserve"
|
|
489
|
+
>
|
|
490
|
+
<g>
|
|
491
|
+
<path
|
|
492
|
+
d="M44.373,7.603c-10.137-10.137-26.632-10.138-36.77,0c-10.138,10.138-10.137,26.632,0,36.77s26.632,10.138,36.77,0
|
|
493
|
+
C54.51,34.235,54.51,17.74,44.373,7.603z M36.241,36.241c-0.781,0.781-2.047,0.781-2.828,0l-7.425-7.425l-7.778,7.778
|
|
494
|
+
c-0.781,0.781-2.047,0.781-2.828,0c-0.781-0.781-0.781-2.047,0-2.828l7.778-7.778l-7.425-7.425c-0.781-0.781-0.781-2.048,0-2.828
|
|
495
|
+
c0.781-0.781,2.047-0.781,2.828,0l7.425,7.425l7.071-7.071c0.781-0.781,2.047-0.781,2.828,0c0.781,0.781,0.781,2.047,0,2.828
|
|
496
|
+
l-7.071,7.071l7.425,7.425C37.022,34.194,37.022,35.46,36.241,36.241z"
|
|
497
|
+
/>
|
|
498
|
+
</g>
|
|
499
|
+
</svg>`,
|
|
500
|
+
encapsulation: ViewEncapsulation.None,
|
|
501
|
+
}]
|
|
502
|
+
}], propDecorators: { name: [{
|
|
503
|
+
type: Input
|
|
504
|
+
}] } });
|
|
505
|
+
|
|
506
|
+
function VIRTUAL_SCROLLER_DEFAULT_OPTIONS_FACTORY() {
|
|
507
|
+
return {
|
|
508
|
+
scrollThrottlingTime: 0,
|
|
509
|
+
scrollDebounceTime: 0,
|
|
510
|
+
scrollAnimationTime: 750,
|
|
511
|
+
checkResizeInterval: 1000,
|
|
512
|
+
resizeBypassRefreshThreshold: 5,
|
|
513
|
+
modifyOverflowStyleOfParentScroll: true,
|
|
514
|
+
stripedTable: false,
|
|
515
|
+
};
|
|
516
|
+
}
|
|
517
|
+
class VirtualScrollerComponent {
|
|
518
|
+
element;
|
|
519
|
+
renderer;
|
|
520
|
+
zone;
|
|
521
|
+
changeDetectorRef;
|
|
522
|
+
viewPortItems;
|
|
523
|
+
window = window;
|
|
524
|
+
get viewPortInfo() {
|
|
525
|
+
let pageInfo = this.previousViewPort || {};
|
|
526
|
+
return {
|
|
527
|
+
startIndex: pageInfo.startIndex || 0,
|
|
528
|
+
endIndex: pageInfo.endIndex || 0,
|
|
529
|
+
scrollStartPosition: pageInfo.scrollStartPosition || 0,
|
|
530
|
+
scrollEndPosition: pageInfo.scrollEndPosition || 0,
|
|
531
|
+
maxScrollPosition: pageInfo.maxScrollPosition || 0,
|
|
532
|
+
startIndexWithBuffer: pageInfo.startIndexWithBuffer || 0,
|
|
533
|
+
endIndexWithBuffer: pageInfo.endIndexWithBuffer || 0,
|
|
534
|
+
};
|
|
535
|
+
}
|
|
536
|
+
executeRefreshOutsideAngularZone = false;
|
|
537
|
+
_enableUnequalChildrenSizes = false;
|
|
538
|
+
get enableUnequalChildrenSizes() {
|
|
539
|
+
return this._enableUnequalChildrenSizes;
|
|
540
|
+
}
|
|
541
|
+
set enableUnequalChildrenSizes(value) {
|
|
542
|
+
if (this._enableUnequalChildrenSizes === value) {
|
|
543
|
+
return;
|
|
544
|
+
}
|
|
545
|
+
this._enableUnequalChildrenSizes = value;
|
|
546
|
+
this.minMeasuredChildWidth = undefined;
|
|
547
|
+
this.minMeasuredChildHeight = undefined;
|
|
548
|
+
}
|
|
549
|
+
useMarginInsteadOfTranslate = false;
|
|
550
|
+
modifyOverflowStyleOfParentScroll;
|
|
551
|
+
stripedTable;
|
|
552
|
+
scrollbarWidth;
|
|
553
|
+
scrollbarHeight;
|
|
554
|
+
childWidth;
|
|
555
|
+
childHeight;
|
|
556
|
+
ssrChildWidth;
|
|
557
|
+
ssrChildHeight;
|
|
558
|
+
ssrViewportWidth = 1920;
|
|
559
|
+
ssrViewportHeight = 1080;
|
|
560
|
+
_bufferAmount = 0;
|
|
561
|
+
get bufferAmount() {
|
|
562
|
+
if (typeof this._bufferAmount === 'number' && this._bufferAmount >= 0) {
|
|
563
|
+
return this._bufferAmount;
|
|
564
|
+
}
|
|
565
|
+
else {
|
|
566
|
+
return this.enableUnequalChildrenSizes ? 5 : 0;
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
set bufferAmount(value) {
|
|
570
|
+
this._bufferAmount = value;
|
|
571
|
+
}
|
|
572
|
+
scrollAnimationTime;
|
|
573
|
+
resizeBypassRefreshThreshold;
|
|
574
|
+
_scrollThrottlingTime;
|
|
575
|
+
get scrollThrottlingTime() {
|
|
576
|
+
return this._scrollThrottlingTime;
|
|
577
|
+
}
|
|
578
|
+
set scrollThrottlingTime(value) {
|
|
579
|
+
this._scrollThrottlingTime = value;
|
|
580
|
+
this.updateOnScrollFunction();
|
|
581
|
+
}
|
|
582
|
+
_scrollDebounceTime;
|
|
583
|
+
get scrollDebounceTime() {
|
|
584
|
+
return this._scrollDebounceTime;
|
|
585
|
+
}
|
|
586
|
+
set scrollDebounceTime(value) {
|
|
587
|
+
this._scrollDebounceTime = value;
|
|
588
|
+
this.updateOnScrollFunction();
|
|
589
|
+
}
|
|
590
|
+
onScroll;
|
|
591
|
+
updateOnScrollFunction() {
|
|
592
|
+
if (this.scrollDebounceTime) {
|
|
593
|
+
this.onScroll = this.debounce(() => {
|
|
594
|
+
this.refresh_internal(false);
|
|
595
|
+
}, this.scrollDebounceTime);
|
|
596
|
+
}
|
|
597
|
+
else if (this.scrollThrottlingTime) {
|
|
598
|
+
this.onScroll = this.throttleTrailing(() => {
|
|
599
|
+
this.refresh_internal(false);
|
|
600
|
+
}, this.scrollThrottlingTime);
|
|
601
|
+
}
|
|
602
|
+
else {
|
|
603
|
+
this.onScroll = () => {
|
|
604
|
+
this.refresh_internal(false);
|
|
605
|
+
};
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
checkScrollElementResizedTimer;
|
|
609
|
+
_checkResizeInterval;
|
|
610
|
+
get checkResizeInterval() {
|
|
611
|
+
return this._checkResizeInterval;
|
|
612
|
+
}
|
|
613
|
+
set checkResizeInterval(value) {
|
|
614
|
+
if (this._checkResizeInterval === value) {
|
|
615
|
+
return;
|
|
616
|
+
}
|
|
617
|
+
this._checkResizeInterval = value;
|
|
618
|
+
this.addScrollEventHandlers();
|
|
619
|
+
}
|
|
620
|
+
_items = [];
|
|
621
|
+
get items() {
|
|
622
|
+
return this._items;
|
|
623
|
+
}
|
|
624
|
+
set items(value) {
|
|
625
|
+
if (value === this._items) {
|
|
626
|
+
return;
|
|
627
|
+
}
|
|
628
|
+
this._items = value || [];
|
|
629
|
+
this.refresh_internal(true);
|
|
630
|
+
}
|
|
631
|
+
compareItems = (item1, item2) => item1 === item2;
|
|
632
|
+
_horizontal;
|
|
633
|
+
get horizontal() {
|
|
634
|
+
return this._horizontal;
|
|
635
|
+
}
|
|
636
|
+
set horizontal(value) {
|
|
637
|
+
this._horizontal = value;
|
|
638
|
+
this.updateDirection();
|
|
639
|
+
}
|
|
640
|
+
revertParentOverscroll() {
|
|
641
|
+
const scrollElement = this.getScrollElement();
|
|
642
|
+
if (scrollElement && this.oldParentScrollOverflow) {
|
|
643
|
+
scrollElement.style['overflow-y'] = this.oldParentScrollOverflow.y;
|
|
644
|
+
scrollElement.style['overflow-x'] = this.oldParentScrollOverflow.x;
|
|
645
|
+
}
|
|
646
|
+
this.oldParentScrollOverflow = undefined;
|
|
647
|
+
}
|
|
648
|
+
oldParentScrollOverflow;
|
|
649
|
+
_parentScroll;
|
|
650
|
+
get parentScroll() {
|
|
651
|
+
return this._parentScroll;
|
|
652
|
+
}
|
|
653
|
+
set parentScroll(value) {
|
|
654
|
+
if (this._parentScroll === value) {
|
|
655
|
+
return;
|
|
656
|
+
}
|
|
657
|
+
this.revertParentOverscroll();
|
|
658
|
+
this._parentScroll = value;
|
|
659
|
+
this.addScrollEventHandlers();
|
|
660
|
+
const scrollElement = this.getScrollElement();
|
|
661
|
+
if (this.modifyOverflowStyleOfParentScroll &&
|
|
662
|
+
scrollElement !== this.element.nativeElement) {
|
|
663
|
+
this.oldParentScrollOverflow = {
|
|
664
|
+
x: scrollElement.style['overflow-x'],
|
|
665
|
+
y: scrollElement.style['overflow-y'],
|
|
666
|
+
};
|
|
667
|
+
scrollElement.style['overflow-y'] = this.horizontal ? 'visible' : 'auto';
|
|
668
|
+
scrollElement.style['overflow-x'] = this.horizontal ? 'auto' : 'visible';
|
|
669
|
+
}
|
|
670
|
+
}
|
|
671
|
+
vsUpdate = new EventEmitter();
|
|
672
|
+
vsChange = new EventEmitter();
|
|
673
|
+
vsStart = new EventEmitter();
|
|
674
|
+
vsEnd = new EventEmitter();
|
|
675
|
+
contentElementRef;
|
|
676
|
+
invisiblePaddingElementRef;
|
|
677
|
+
headerElementRef;
|
|
678
|
+
containerElementRef;
|
|
679
|
+
ngOnInit() {
|
|
680
|
+
this.addScrollEventHandlers();
|
|
681
|
+
}
|
|
682
|
+
ngOnDestroy() {
|
|
683
|
+
this.removeScrollEventHandlers();
|
|
684
|
+
this.revertParentOverscroll();
|
|
685
|
+
}
|
|
686
|
+
ngOnChanges(changes) {
|
|
687
|
+
let indexLengthChanged = this.cachedItemsLength !== this.items.length;
|
|
688
|
+
this.cachedItemsLength = this.items.length;
|
|
689
|
+
const firstRun = !changes.items ||
|
|
690
|
+
!changes.items.previousValue ||
|
|
691
|
+
changes.items.previousValue.length === 0;
|
|
692
|
+
this.refresh_internal(indexLengthChanged || firstRun);
|
|
693
|
+
}
|
|
694
|
+
ngDoCheck() {
|
|
695
|
+
if (this.cachedItemsLength !== this.items.length) {
|
|
696
|
+
this.cachedItemsLength = this.items.length;
|
|
697
|
+
this.refresh_internal(true);
|
|
698
|
+
return;
|
|
699
|
+
}
|
|
700
|
+
if (this.previousViewPort &&
|
|
701
|
+
this.viewPortItems &&
|
|
702
|
+
this.viewPortItems.length > 0) {
|
|
703
|
+
let itemsArrayChanged = false;
|
|
704
|
+
for (let i = 0; i < this.viewPortItems.length; ++i) {
|
|
705
|
+
if (!this.compareItems(this.items[this.previousViewPort.startIndexWithBuffer + i], this.viewPortItems[i])) {
|
|
706
|
+
itemsArrayChanged = true;
|
|
707
|
+
break;
|
|
708
|
+
}
|
|
709
|
+
}
|
|
710
|
+
if (itemsArrayChanged) {
|
|
711
|
+
this.refresh_internal(true);
|
|
712
|
+
}
|
|
713
|
+
}
|
|
714
|
+
}
|
|
715
|
+
refresh() {
|
|
716
|
+
this.refresh_internal(true);
|
|
717
|
+
}
|
|
718
|
+
invalidateAllCachedMeasurements() {
|
|
719
|
+
this.wrapGroupDimensions = {
|
|
720
|
+
maxChildSizePerWrapGroup: [],
|
|
721
|
+
numberOfKnownWrapGroupChildSizes: 0,
|
|
722
|
+
sumOfKnownWrapGroupChildWidths: 0,
|
|
723
|
+
sumOfKnownWrapGroupChildHeights: 0,
|
|
724
|
+
};
|
|
725
|
+
this.minMeasuredChildWidth = undefined;
|
|
726
|
+
this.minMeasuredChildHeight = undefined;
|
|
727
|
+
this.refresh_internal(false);
|
|
728
|
+
}
|
|
729
|
+
invalidateCachedMeasurementForItem(item) {
|
|
730
|
+
if (this.enableUnequalChildrenSizes) {
|
|
731
|
+
let index = this.items && this.items.indexOf(item);
|
|
732
|
+
if (index >= 0) {
|
|
733
|
+
this.invalidateCachedMeasurementAtIndex(index);
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
else {
|
|
737
|
+
this.minMeasuredChildWidth = undefined;
|
|
738
|
+
this.minMeasuredChildHeight = undefined;
|
|
739
|
+
}
|
|
740
|
+
this.refresh_internal(false);
|
|
741
|
+
}
|
|
742
|
+
invalidateCachedMeasurementAtIndex(index) {
|
|
743
|
+
if (this.enableUnequalChildrenSizes) {
|
|
744
|
+
let cachedMeasurement = this.wrapGroupDimensions.maxChildSizePerWrapGroup[index];
|
|
745
|
+
if (cachedMeasurement) {
|
|
746
|
+
this.wrapGroupDimensions.maxChildSizePerWrapGroup[index] = undefined;
|
|
747
|
+
--this.wrapGroupDimensions.numberOfKnownWrapGroupChildSizes;
|
|
748
|
+
this.wrapGroupDimensions.sumOfKnownWrapGroupChildWidths -=
|
|
749
|
+
cachedMeasurement.childWidth || 0;
|
|
750
|
+
this.wrapGroupDimensions.sumOfKnownWrapGroupChildHeights -=
|
|
751
|
+
cachedMeasurement.childHeight || 0;
|
|
752
|
+
}
|
|
753
|
+
}
|
|
754
|
+
else {
|
|
755
|
+
this.minMeasuredChildWidth = undefined;
|
|
756
|
+
this.minMeasuredChildHeight = undefined;
|
|
757
|
+
}
|
|
758
|
+
this.refresh_internal(false);
|
|
759
|
+
}
|
|
760
|
+
scrollInto(item, alignToBeginning = true, additionalOffset = 0, animationMilliseconds = undefined, animationCompletedCallback = undefined) {
|
|
761
|
+
let index = this.items.indexOf(item);
|
|
762
|
+
if (index === -1) {
|
|
763
|
+
return;
|
|
764
|
+
}
|
|
765
|
+
this.scrollToIndex(index, alignToBeginning, additionalOffset, animationMilliseconds, animationCompletedCallback);
|
|
766
|
+
}
|
|
767
|
+
scrollToIndex(index, alignToBeginning = true, additionalOffset = 0, animationMilliseconds = undefined, animationCompletedCallback = undefined) {
|
|
768
|
+
let maxRetries = 5;
|
|
769
|
+
let retryIfNeeded = () => {
|
|
770
|
+
--maxRetries;
|
|
771
|
+
if (maxRetries <= 0) {
|
|
772
|
+
if (animationCompletedCallback) {
|
|
773
|
+
animationCompletedCallback();
|
|
774
|
+
}
|
|
775
|
+
return;
|
|
776
|
+
}
|
|
777
|
+
let dimensions = this.calculateDimensions();
|
|
778
|
+
let desiredStartIndex = Math.min(Math.max(index, 0), dimensions.itemCount - 1);
|
|
779
|
+
if (this.previousViewPort.startIndex === desiredStartIndex) {
|
|
780
|
+
if (animationCompletedCallback) {
|
|
781
|
+
animationCompletedCallback();
|
|
782
|
+
}
|
|
783
|
+
return;
|
|
784
|
+
}
|
|
785
|
+
this.scrollToIndex_internal(index, alignToBeginning, additionalOffset, 0, retryIfNeeded);
|
|
786
|
+
};
|
|
787
|
+
this.scrollToIndex_internal(index, alignToBeginning, additionalOffset, animationMilliseconds, retryIfNeeded);
|
|
788
|
+
}
|
|
789
|
+
scrollToIndex_internal(index, alignToBeginning = true, additionalOffset = 0, animationMilliseconds = undefined, animationCompletedCallback = undefined) {
|
|
790
|
+
animationMilliseconds =
|
|
791
|
+
animationMilliseconds === undefined
|
|
792
|
+
? this.scrollAnimationTime
|
|
793
|
+
: animationMilliseconds;
|
|
794
|
+
let dimensions = this.calculateDimensions();
|
|
795
|
+
let scroll = this.calculatePadding(index, dimensions) + additionalOffset;
|
|
796
|
+
if (!alignToBeginning) {
|
|
797
|
+
scroll -= dimensions.wrapGroupsPerPage * dimensions[this._childScrollDim];
|
|
798
|
+
}
|
|
799
|
+
this.scrollToPosition(scroll, animationMilliseconds, animationCompletedCallback);
|
|
800
|
+
}
|
|
801
|
+
scrollToPosition(scrollPosition, animationMilliseconds = undefined, animationCompletedCallback = undefined) {
|
|
802
|
+
scrollPosition += this.getElementsOffset();
|
|
803
|
+
animationMilliseconds =
|
|
804
|
+
animationMilliseconds === undefined
|
|
805
|
+
? this.scrollAnimationTime
|
|
806
|
+
: animationMilliseconds;
|
|
807
|
+
let scrollElement = this.getScrollElement();
|
|
808
|
+
let animationRequest;
|
|
809
|
+
if (this.currentTween) {
|
|
810
|
+
this.currentTween.stop();
|
|
811
|
+
this.currentTween = undefined;
|
|
812
|
+
}
|
|
813
|
+
if (!animationMilliseconds) {
|
|
814
|
+
this.renderer.setProperty(scrollElement, this._scrollType, scrollPosition);
|
|
815
|
+
this.refresh_internal(false, animationCompletedCallback);
|
|
816
|
+
return;
|
|
817
|
+
}
|
|
818
|
+
const tweenConfigObj = { scrollPosition: scrollElement[this._scrollType] };
|
|
819
|
+
let newTween = new tween.Tween(tweenConfigObj)
|
|
820
|
+
.to({ scrollPosition }, animationMilliseconds)
|
|
821
|
+
.easing(tween.Easing.Quadratic.Out)
|
|
822
|
+
.onUpdate((data) => {
|
|
823
|
+
if (isNaN(data.scrollPosition)) {
|
|
824
|
+
return;
|
|
825
|
+
}
|
|
826
|
+
this.renderer.setProperty(scrollElement, this._scrollType, data.scrollPosition);
|
|
827
|
+
this.refresh_internal(false);
|
|
828
|
+
})
|
|
829
|
+
.onStop(() => {
|
|
830
|
+
cancelAnimationFrame(animationRequest);
|
|
831
|
+
})
|
|
832
|
+
.start();
|
|
833
|
+
const animate = (time) => {
|
|
834
|
+
if (!newTween['isPlaying']()) {
|
|
835
|
+
return;
|
|
836
|
+
}
|
|
837
|
+
newTween.update(time);
|
|
838
|
+
if (tweenConfigObj.scrollPosition === scrollPosition) {
|
|
839
|
+
this.refresh_internal(false, animationCompletedCallback);
|
|
840
|
+
return;
|
|
841
|
+
}
|
|
842
|
+
this.zone.runOutsideAngular(() => {
|
|
843
|
+
animationRequest = requestAnimationFrame(animate);
|
|
844
|
+
});
|
|
845
|
+
};
|
|
846
|
+
animate();
|
|
847
|
+
this.currentTween = newTween;
|
|
848
|
+
}
|
|
849
|
+
isAngularUniversalSSR;
|
|
850
|
+
constructor(element, renderer, zone, changeDetectorRef, platformId, options) {
|
|
851
|
+
this.element = element;
|
|
852
|
+
this.renderer = renderer;
|
|
853
|
+
this.zone = zone;
|
|
854
|
+
this.changeDetectorRef = changeDetectorRef;
|
|
855
|
+
this.isAngularUniversalSSR = isPlatformServer(platformId);
|
|
856
|
+
this.scrollThrottlingTime = options.scrollThrottlingTime;
|
|
857
|
+
this.scrollDebounceTime = options.scrollDebounceTime;
|
|
858
|
+
this.scrollAnimationTime = options.scrollAnimationTime;
|
|
859
|
+
this.scrollbarWidth = options.scrollbarWidth;
|
|
860
|
+
this.scrollbarHeight = options.scrollbarHeight;
|
|
861
|
+
this.checkResizeInterval = options.checkResizeInterval;
|
|
862
|
+
this.resizeBypassRefreshThreshold = options.resizeBypassRefreshThreshold;
|
|
863
|
+
this.modifyOverflowStyleOfParentScroll =
|
|
864
|
+
options.modifyOverflowStyleOfParentScroll;
|
|
865
|
+
this.stripedTable = options.stripedTable;
|
|
866
|
+
this.horizontal = false;
|
|
867
|
+
this.resetWrapGroupDimensions();
|
|
868
|
+
}
|
|
869
|
+
getElementSize(element) {
|
|
870
|
+
let result = element.getBoundingClientRect();
|
|
871
|
+
let styles = getComputedStyle(element);
|
|
872
|
+
let marginTop = parseInt(styles['margin-top'], 10) || 0;
|
|
873
|
+
let marginBottom = parseInt(styles['margin-bottom'], 10) || 0;
|
|
874
|
+
let marginLeft = parseInt(styles['margin-left'], 10) || 0;
|
|
875
|
+
let marginRight = parseInt(styles['margin-right'], 10) || 0;
|
|
876
|
+
return {
|
|
877
|
+
top: result.top + marginTop,
|
|
878
|
+
bottom: result.bottom + marginBottom,
|
|
879
|
+
left: result.left + marginLeft,
|
|
880
|
+
right: result.right + marginRight,
|
|
881
|
+
width: result.width + marginLeft + marginRight,
|
|
882
|
+
height: result.height + marginTop + marginBottom,
|
|
883
|
+
y: result.top + marginTop,
|
|
884
|
+
x: result.left + marginLeft,
|
|
885
|
+
toJSON() {
|
|
886
|
+
result.toJSON();
|
|
887
|
+
},
|
|
888
|
+
};
|
|
889
|
+
}
|
|
890
|
+
previousScrollBoundingRect;
|
|
891
|
+
checkScrollElementResized() {
|
|
892
|
+
let boundingRect = this.getElementSize(this.getScrollElement());
|
|
893
|
+
let sizeChanged;
|
|
894
|
+
if (!this.previousScrollBoundingRect) {
|
|
895
|
+
sizeChanged = true;
|
|
896
|
+
}
|
|
897
|
+
else {
|
|
898
|
+
let widthChange = Math.abs(boundingRect.width - this.previousScrollBoundingRect.width);
|
|
899
|
+
let heightChange = Math.abs(boundingRect.height - this.previousScrollBoundingRect.height);
|
|
900
|
+
sizeChanged =
|
|
901
|
+
widthChange > this.resizeBypassRefreshThreshold ||
|
|
902
|
+
heightChange > this.resizeBypassRefreshThreshold;
|
|
903
|
+
}
|
|
904
|
+
if (sizeChanged) {
|
|
905
|
+
this.previousScrollBoundingRect = boundingRect;
|
|
906
|
+
if (boundingRect.width > 0 && boundingRect.height > 0) {
|
|
907
|
+
this.refresh_internal(false);
|
|
908
|
+
}
|
|
909
|
+
}
|
|
910
|
+
}
|
|
911
|
+
_invisiblePaddingProperty;
|
|
912
|
+
_offsetType;
|
|
913
|
+
_scrollType;
|
|
914
|
+
_pageOffsetType;
|
|
915
|
+
_childScrollDim;
|
|
916
|
+
_translateDir;
|
|
917
|
+
_marginDir;
|
|
918
|
+
updateDirection() {
|
|
919
|
+
if (this.horizontal) {
|
|
920
|
+
this._invisiblePaddingProperty = 'width';
|
|
921
|
+
this._offsetType = 'offsetLeft';
|
|
922
|
+
this._pageOffsetType = 'pageXOffset';
|
|
923
|
+
this._childScrollDim = 'childWidth';
|
|
924
|
+
this._marginDir = 'margin-left';
|
|
925
|
+
this._translateDir = 'translateX';
|
|
926
|
+
this._scrollType = 'scrollLeft';
|
|
927
|
+
}
|
|
928
|
+
else {
|
|
929
|
+
this._invisiblePaddingProperty = 'height';
|
|
930
|
+
this._offsetType = 'offsetTop';
|
|
931
|
+
this._pageOffsetType = 'pageYOffset';
|
|
932
|
+
this._childScrollDim = 'childHeight';
|
|
933
|
+
this._marginDir = 'margin-top';
|
|
934
|
+
this._translateDir = 'translateY';
|
|
935
|
+
this._scrollType = 'scrollTop';
|
|
936
|
+
}
|
|
937
|
+
}
|
|
938
|
+
debounce(func, wait) {
|
|
939
|
+
const throttled = this.throttleTrailing(func, wait);
|
|
940
|
+
const result = function () {
|
|
941
|
+
throttled['cancel']();
|
|
942
|
+
throttled.apply(this, arguments);
|
|
943
|
+
};
|
|
944
|
+
result['cancel'] = function () {
|
|
945
|
+
throttled['cancel']();
|
|
946
|
+
};
|
|
947
|
+
return result;
|
|
948
|
+
}
|
|
949
|
+
throttleTrailing(func, wait) {
|
|
950
|
+
let timeout = undefined;
|
|
951
|
+
let _arguments = arguments;
|
|
952
|
+
const result = function () {
|
|
953
|
+
const _this = this;
|
|
954
|
+
_arguments = arguments;
|
|
955
|
+
if (timeout) {
|
|
956
|
+
return;
|
|
957
|
+
}
|
|
958
|
+
if (wait <= 0) {
|
|
959
|
+
func.apply(_this, _arguments);
|
|
960
|
+
}
|
|
961
|
+
else {
|
|
962
|
+
timeout = setTimeout(function () {
|
|
963
|
+
timeout = undefined;
|
|
964
|
+
func.apply(_this, _arguments);
|
|
965
|
+
}, wait);
|
|
966
|
+
}
|
|
967
|
+
};
|
|
968
|
+
result['cancel'] = function () {
|
|
969
|
+
if (timeout) {
|
|
970
|
+
clearTimeout(timeout);
|
|
971
|
+
timeout = undefined;
|
|
972
|
+
}
|
|
973
|
+
};
|
|
974
|
+
return result;
|
|
975
|
+
}
|
|
976
|
+
calculatedScrollbarWidth = 0;
|
|
977
|
+
calculatedScrollbarHeight = 0;
|
|
978
|
+
padding = 0;
|
|
979
|
+
previousViewPort = {};
|
|
980
|
+
currentTween;
|
|
981
|
+
cachedItemsLength;
|
|
982
|
+
disposeScrollHandler;
|
|
983
|
+
disposeResizeHandler;
|
|
984
|
+
refresh_internal(itemsArrayModified, refreshCompletedCallback = undefined, maxRunTimes = 2) {
|
|
985
|
+
//note: maxRunTimes is to force it to keep recalculating if the previous iteration caused a re-render (different sliced items in viewport or scrollPosition changed).
|
|
986
|
+
//The default of 2x max will probably be accurate enough without causing too large a performance bottleneck
|
|
987
|
+
//The code would typically quit out on the 2nd iteration anyways. The main time it'd think more than 2 runs would be necessary would be for vastly different sized child items or if this is the 1st time the items array was initialized.
|
|
988
|
+
//Without maxRunTimes, If the user is actively scrolling this code would become an infinite loop until they stopped scrolling. This would be okay, except each scroll event would start an additional infinte loop. We want to short-circuit it to prevent this.
|
|
989
|
+
if (itemsArrayModified &&
|
|
990
|
+
this.previousViewPort &&
|
|
991
|
+
this.previousViewPort.scrollStartPosition > 0) {
|
|
992
|
+
//if items were prepended, scroll forward to keep same items visible
|
|
993
|
+
let oldViewPort = this.previousViewPort;
|
|
994
|
+
let oldViewPortItems = this.viewPortItems;
|
|
995
|
+
let oldRefreshCompletedCallback = refreshCompletedCallback;
|
|
996
|
+
refreshCompletedCallback = () => {
|
|
997
|
+
let scrollLengthDelta = this.previousViewPort.scrollLength - oldViewPort.scrollLength;
|
|
998
|
+
if (scrollLengthDelta > 0 && this.viewPortItems) {
|
|
999
|
+
let oldStartItem = oldViewPortItems[0];
|
|
1000
|
+
let oldStartItemIndex = this.items.findIndex((x) => this.compareItems(oldStartItem, x));
|
|
1001
|
+
if (oldStartItemIndex > this.previousViewPort.startIndexWithBuffer) {
|
|
1002
|
+
let itemOrderChanged = false;
|
|
1003
|
+
for (let i = 1; i < this.viewPortItems.length; ++i) {
|
|
1004
|
+
if (!this.compareItems(this.items[oldStartItemIndex + i], oldViewPortItems[i])) {
|
|
1005
|
+
itemOrderChanged = true;
|
|
1006
|
+
break;
|
|
1007
|
+
}
|
|
1008
|
+
}
|
|
1009
|
+
if (!itemOrderChanged) {
|
|
1010
|
+
this.scrollToPosition(this.previousViewPort.scrollStartPosition + scrollLengthDelta, 0, oldRefreshCompletedCallback);
|
|
1011
|
+
return;
|
|
1012
|
+
}
|
|
1013
|
+
}
|
|
1014
|
+
}
|
|
1015
|
+
if (oldRefreshCompletedCallback) {
|
|
1016
|
+
oldRefreshCompletedCallback();
|
|
1017
|
+
}
|
|
1018
|
+
};
|
|
1019
|
+
}
|
|
1020
|
+
this.zone.runOutsideAngular(() => {
|
|
1021
|
+
requestAnimationFrame(() => {
|
|
1022
|
+
if (itemsArrayModified) {
|
|
1023
|
+
this.resetWrapGroupDimensions();
|
|
1024
|
+
}
|
|
1025
|
+
let viewport = this.calculateViewport();
|
|
1026
|
+
let startChanged = itemsArrayModified ||
|
|
1027
|
+
viewport.startIndex !== this.previousViewPort.startIndex;
|
|
1028
|
+
let endChanged = itemsArrayModified ||
|
|
1029
|
+
viewport.endIndex !== this.previousViewPort.endIndex;
|
|
1030
|
+
let scrollLengthChanged = viewport.scrollLength !== this.previousViewPort.scrollLength;
|
|
1031
|
+
let paddingChanged = viewport.padding !== this.previousViewPort.padding;
|
|
1032
|
+
let scrollPositionChanged = viewport.scrollStartPosition !==
|
|
1033
|
+
this.previousViewPort.scrollStartPosition ||
|
|
1034
|
+
viewport.scrollEndPosition !==
|
|
1035
|
+
this.previousViewPort.scrollEndPosition ||
|
|
1036
|
+
viewport.maxScrollPosition !==
|
|
1037
|
+
this.previousViewPort.maxScrollPosition;
|
|
1038
|
+
this.previousViewPort = viewport;
|
|
1039
|
+
if (scrollLengthChanged) {
|
|
1040
|
+
this.renderer.setStyle(this.invisiblePaddingElementRef.nativeElement, this._invisiblePaddingProperty, `${viewport.scrollLength}px`);
|
|
1041
|
+
}
|
|
1042
|
+
if (paddingChanged) {
|
|
1043
|
+
if (this.useMarginInsteadOfTranslate) {
|
|
1044
|
+
this.renderer.setStyle(this.contentElementRef.nativeElement, this._marginDir, `${viewport.padding}px`);
|
|
1045
|
+
}
|
|
1046
|
+
else {
|
|
1047
|
+
this.renderer.setStyle(this.contentElementRef.nativeElement, 'transform', `${this._translateDir}(${viewport.padding}px)`);
|
|
1048
|
+
this.renderer.setStyle(this.contentElementRef.nativeElement, 'webkitTransform', `${this._translateDir}(${viewport.padding}px)`);
|
|
1049
|
+
}
|
|
1050
|
+
}
|
|
1051
|
+
if (this.headerElementRef) {
|
|
1052
|
+
let scrollPosition = this.getScrollElement()[this._scrollType];
|
|
1053
|
+
let containerOffset = this.getElementsOffset();
|
|
1054
|
+
let offset = Math.max(scrollPosition -
|
|
1055
|
+
viewport.padding -
|
|
1056
|
+
containerOffset +
|
|
1057
|
+
this.headerElementRef.nativeElement.clientHeight, 0);
|
|
1058
|
+
this.renderer.setStyle(this.headerElementRef.nativeElement, 'transform', `${this._translateDir}(${offset}px)`);
|
|
1059
|
+
this.renderer.setStyle(this.headerElementRef.nativeElement, 'webkitTransform', `${this._translateDir}(${offset}px)`);
|
|
1060
|
+
}
|
|
1061
|
+
const changeEventArg = startChanged || endChanged
|
|
1062
|
+
? {
|
|
1063
|
+
startIndex: viewport.startIndex,
|
|
1064
|
+
endIndex: viewport.endIndex,
|
|
1065
|
+
scrollStartPosition: viewport.scrollStartPosition,
|
|
1066
|
+
scrollEndPosition: viewport.scrollEndPosition,
|
|
1067
|
+
startIndexWithBuffer: viewport.startIndexWithBuffer,
|
|
1068
|
+
endIndexWithBuffer: viewport.endIndexWithBuffer,
|
|
1069
|
+
maxScrollPosition: viewport.maxScrollPosition,
|
|
1070
|
+
}
|
|
1071
|
+
: undefined;
|
|
1072
|
+
if (startChanged || endChanged || scrollPositionChanged) {
|
|
1073
|
+
const handleChanged = () => {
|
|
1074
|
+
// update the scroll list to trigger re-render of components in viewport
|
|
1075
|
+
this.viewPortItems =
|
|
1076
|
+
viewport.startIndexWithBuffer >= 0 &&
|
|
1077
|
+
viewport.endIndexWithBuffer >= 0
|
|
1078
|
+
? this.items.slice(viewport.startIndexWithBuffer, viewport.endIndexWithBuffer + 1)
|
|
1079
|
+
: [];
|
|
1080
|
+
this.vsUpdate.emit(this.viewPortItems);
|
|
1081
|
+
if (startChanged) {
|
|
1082
|
+
this.vsStart.emit(changeEventArg);
|
|
1083
|
+
}
|
|
1084
|
+
if (endChanged) {
|
|
1085
|
+
this.vsEnd.emit(changeEventArg);
|
|
1086
|
+
}
|
|
1087
|
+
if (startChanged || endChanged) {
|
|
1088
|
+
this.changeDetectorRef.markForCheck();
|
|
1089
|
+
this.vsChange.emit(changeEventArg);
|
|
1090
|
+
}
|
|
1091
|
+
if (maxRunTimes > 0) {
|
|
1092
|
+
this.refresh_internal(false, refreshCompletedCallback, maxRunTimes - 1);
|
|
1093
|
+
return;
|
|
1094
|
+
}
|
|
1095
|
+
if (refreshCompletedCallback) {
|
|
1096
|
+
refreshCompletedCallback();
|
|
1097
|
+
}
|
|
1098
|
+
};
|
|
1099
|
+
if (this.executeRefreshOutsideAngularZone) {
|
|
1100
|
+
handleChanged();
|
|
1101
|
+
}
|
|
1102
|
+
else {
|
|
1103
|
+
this.zone.run(handleChanged);
|
|
1104
|
+
}
|
|
1105
|
+
}
|
|
1106
|
+
else {
|
|
1107
|
+
if (maxRunTimes > 0 && (scrollLengthChanged || paddingChanged)) {
|
|
1108
|
+
this.refresh_internal(false, refreshCompletedCallback, maxRunTimes - 1);
|
|
1109
|
+
return;
|
|
1110
|
+
}
|
|
1111
|
+
if (refreshCompletedCallback) {
|
|
1112
|
+
refreshCompletedCallback();
|
|
1113
|
+
}
|
|
1114
|
+
}
|
|
1115
|
+
});
|
|
1116
|
+
});
|
|
1117
|
+
}
|
|
1118
|
+
getScrollElement() {
|
|
1119
|
+
return this.parentScroll instanceof Window
|
|
1120
|
+
? document.scrollingElement || document.documentElement || document.body
|
|
1121
|
+
: this.parentScroll || this.element.nativeElement;
|
|
1122
|
+
}
|
|
1123
|
+
addScrollEventHandlers() {
|
|
1124
|
+
if (this.isAngularUniversalSSR) {
|
|
1125
|
+
return;
|
|
1126
|
+
}
|
|
1127
|
+
let scrollElement = this.getScrollElement();
|
|
1128
|
+
this.removeScrollEventHandlers();
|
|
1129
|
+
this.zone.runOutsideAngular(() => {
|
|
1130
|
+
if (this.parentScroll instanceof Window) {
|
|
1131
|
+
this.disposeScrollHandler = this.renderer.listen('window', 'scroll', this.onScroll);
|
|
1132
|
+
this.disposeResizeHandler = this.renderer.listen('window', 'resize', this.onScroll);
|
|
1133
|
+
}
|
|
1134
|
+
else {
|
|
1135
|
+
this.disposeScrollHandler = this.renderer.listen(scrollElement, 'scroll', this.onScroll);
|
|
1136
|
+
if (this._checkResizeInterval > 0) {
|
|
1137
|
+
this.checkScrollElementResizedTimer = setInterval(() => {
|
|
1138
|
+
this.checkScrollElementResized();
|
|
1139
|
+
}, this._checkResizeInterval);
|
|
1140
|
+
}
|
|
1141
|
+
}
|
|
1142
|
+
});
|
|
1143
|
+
}
|
|
1144
|
+
removeScrollEventHandlers() {
|
|
1145
|
+
if (this.checkScrollElementResizedTimer) {
|
|
1146
|
+
clearInterval(this.checkScrollElementResizedTimer);
|
|
1147
|
+
}
|
|
1148
|
+
if (this.disposeScrollHandler) {
|
|
1149
|
+
this.disposeScrollHandler();
|
|
1150
|
+
this.disposeScrollHandler = undefined;
|
|
1151
|
+
}
|
|
1152
|
+
if (this.disposeResizeHandler) {
|
|
1153
|
+
this.disposeResizeHandler();
|
|
1154
|
+
this.disposeResizeHandler = undefined;
|
|
1155
|
+
}
|
|
1156
|
+
}
|
|
1157
|
+
getElementsOffset() {
|
|
1158
|
+
if (this.isAngularUniversalSSR) {
|
|
1159
|
+
return 0;
|
|
1160
|
+
}
|
|
1161
|
+
let offset = 0;
|
|
1162
|
+
if (this.containerElementRef && this.containerElementRef.nativeElement) {
|
|
1163
|
+
offset += this.containerElementRef.nativeElement[this._offsetType];
|
|
1164
|
+
}
|
|
1165
|
+
if (this.parentScroll) {
|
|
1166
|
+
let scrollElement = this.getScrollElement();
|
|
1167
|
+
let elementClientRect = this.getElementSize(this.element.nativeElement);
|
|
1168
|
+
let scrollClientRect = this.getElementSize(scrollElement);
|
|
1169
|
+
if (this.horizontal) {
|
|
1170
|
+
offset += elementClientRect.left - scrollClientRect.left;
|
|
1171
|
+
}
|
|
1172
|
+
else {
|
|
1173
|
+
offset += elementClientRect.top - scrollClientRect.top;
|
|
1174
|
+
}
|
|
1175
|
+
if (!(this.parentScroll instanceof Window)) {
|
|
1176
|
+
offset += scrollElement[this._scrollType];
|
|
1177
|
+
}
|
|
1178
|
+
}
|
|
1179
|
+
return offset;
|
|
1180
|
+
}
|
|
1181
|
+
countItemsPerWrapGroup() {
|
|
1182
|
+
if (this.isAngularUniversalSSR) {
|
|
1183
|
+
return Math.round(this.horizontal
|
|
1184
|
+
? this.ssrViewportHeight / this.ssrChildHeight
|
|
1185
|
+
: this.ssrViewportWidth / this.ssrChildWidth);
|
|
1186
|
+
}
|
|
1187
|
+
let propertyName = this.horizontal ? 'offsetLeft' : 'offsetTop';
|
|
1188
|
+
let children = ((this.containerElementRef && this.containerElementRef.nativeElement) ||
|
|
1189
|
+
this.contentElementRef.nativeElement).children;
|
|
1190
|
+
let childrenLength = children ? children.length : 0;
|
|
1191
|
+
if (childrenLength === 0) {
|
|
1192
|
+
return 1;
|
|
1193
|
+
}
|
|
1194
|
+
let firstOffset = children[0][propertyName];
|
|
1195
|
+
let result = 1;
|
|
1196
|
+
while (result < childrenLength &&
|
|
1197
|
+
firstOffset === children[result][propertyName]) {
|
|
1198
|
+
++result;
|
|
1199
|
+
}
|
|
1200
|
+
return result;
|
|
1201
|
+
}
|
|
1202
|
+
getScrollStartPosition() {
|
|
1203
|
+
let windowScrollValue = undefined;
|
|
1204
|
+
if (this.parentScroll instanceof Window) {
|
|
1205
|
+
windowScrollValue = window[this._pageOffsetType];
|
|
1206
|
+
}
|
|
1207
|
+
return windowScrollValue || this.getScrollElement()[this._scrollType] || 0;
|
|
1208
|
+
}
|
|
1209
|
+
minMeasuredChildWidth;
|
|
1210
|
+
minMeasuredChildHeight;
|
|
1211
|
+
wrapGroupDimensions;
|
|
1212
|
+
resetWrapGroupDimensions() {
|
|
1213
|
+
const oldWrapGroupDimensions = this.wrapGroupDimensions;
|
|
1214
|
+
this.invalidateAllCachedMeasurements();
|
|
1215
|
+
if (!this.enableUnequalChildrenSizes ||
|
|
1216
|
+
!oldWrapGroupDimensions ||
|
|
1217
|
+
oldWrapGroupDimensions.numberOfKnownWrapGroupChildSizes === 0) {
|
|
1218
|
+
return;
|
|
1219
|
+
}
|
|
1220
|
+
const itemsPerWrapGroup = this.countItemsPerWrapGroup();
|
|
1221
|
+
for (let wrapGroupIndex = 0; wrapGroupIndex < oldWrapGroupDimensions.maxChildSizePerWrapGroup.length; ++wrapGroupIndex) {
|
|
1222
|
+
const oldWrapGroupDimension = oldWrapGroupDimensions.maxChildSizePerWrapGroup[wrapGroupIndex];
|
|
1223
|
+
if (!oldWrapGroupDimension ||
|
|
1224
|
+
!oldWrapGroupDimension.items ||
|
|
1225
|
+
!oldWrapGroupDimension.items.length) {
|
|
1226
|
+
continue;
|
|
1227
|
+
}
|
|
1228
|
+
if (oldWrapGroupDimension.items.length !== itemsPerWrapGroup) {
|
|
1229
|
+
return;
|
|
1230
|
+
}
|
|
1231
|
+
let itemsChanged = false;
|
|
1232
|
+
let arrayStartIndex = itemsPerWrapGroup * wrapGroupIndex;
|
|
1233
|
+
for (let i = 0; i < itemsPerWrapGroup; ++i) {
|
|
1234
|
+
if (!this.compareItems(oldWrapGroupDimension.items[i], this.items[arrayStartIndex + i])) {
|
|
1235
|
+
itemsChanged = true;
|
|
1236
|
+
break;
|
|
1237
|
+
}
|
|
1238
|
+
}
|
|
1239
|
+
if (!itemsChanged) {
|
|
1240
|
+
++this.wrapGroupDimensions.numberOfKnownWrapGroupChildSizes;
|
|
1241
|
+
this.wrapGroupDimensions.sumOfKnownWrapGroupChildWidths +=
|
|
1242
|
+
oldWrapGroupDimension.childWidth || 0;
|
|
1243
|
+
this.wrapGroupDimensions.sumOfKnownWrapGroupChildHeights +=
|
|
1244
|
+
oldWrapGroupDimension.childHeight || 0;
|
|
1245
|
+
this.wrapGroupDimensions.maxChildSizePerWrapGroup[wrapGroupIndex] =
|
|
1246
|
+
oldWrapGroupDimension;
|
|
1247
|
+
}
|
|
1248
|
+
}
|
|
1249
|
+
}
|
|
1250
|
+
calculateDimensions() {
|
|
1251
|
+
let scrollElement = this.getScrollElement();
|
|
1252
|
+
const maxCalculatedScrollBarSize = 25; // Note: Formula to auto-calculate doesn't work for ParentScroll, so we default to this if not set by consuming application
|
|
1253
|
+
this.calculatedScrollbarHeight = Math.max(Math.min(scrollElement.offsetHeight - scrollElement.clientHeight, maxCalculatedScrollBarSize), this.calculatedScrollbarHeight);
|
|
1254
|
+
this.calculatedScrollbarWidth = Math.max(Math.min(scrollElement.offsetWidth - scrollElement.clientWidth, maxCalculatedScrollBarSize), this.calculatedScrollbarWidth);
|
|
1255
|
+
let viewportWidth = scrollElement.offsetWidth -
|
|
1256
|
+
(this.scrollbarWidth ||
|
|
1257
|
+
this.calculatedScrollbarWidth ||
|
|
1258
|
+
(this.horizontal ? 0 : maxCalculatedScrollBarSize));
|
|
1259
|
+
let viewportHeight = scrollElement.offsetHeight -
|
|
1260
|
+
(this.scrollbarHeight ||
|
|
1261
|
+
this.calculatedScrollbarHeight ||
|
|
1262
|
+
(this.horizontal ? maxCalculatedScrollBarSize : 0));
|
|
1263
|
+
let content = (this.containerElementRef && this.containerElementRef.nativeElement) ||
|
|
1264
|
+
this.contentElementRef.nativeElement;
|
|
1265
|
+
let itemsPerWrapGroup = this.countItemsPerWrapGroup();
|
|
1266
|
+
let wrapGroupsPerPage;
|
|
1267
|
+
let defaultChildWidth;
|
|
1268
|
+
let defaultChildHeight;
|
|
1269
|
+
if (this.isAngularUniversalSSR) {
|
|
1270
|
+
viewportWidth = this.ssrViewportWidth;
|
|
1271
|
+
viewportHeight = this.ssrViewportHeight;
|
|
1272
|
+
defaultChildWidth = this.ssrChildWidth;
|
|
1273
|
+
defaultChildHeight = this.ssrChildHeight;
|
|
1274
|
+
let itemsPerRow = Math.max(Math.ceil(viewportWidth / defaultChildWidth), 1);
|
|
1275
|
+
let itemsPerCol = Math.max(Math.ceil(viewportHeight / defaultChildHeight), 1);
|
|
1276
|
+
wrapGroupsPerPage = this.horizontal ? itemsPerRow : itemsPerCol;
|
|
1277
|
+
}
|
|
1278
|
+
else if (!this.enableUnequalChildrenSizes) {
|
|
1279
|
+
if (content.children.length > 0) {
|
|
1280
|
+
if (!this.childWidth || !this.childHeight) {
|
|
1281
|
+
if (!this.minMeasuredChildWidth && viewportWidth > 0) {
|
|
1282
|
+
this.minMeasuredChildWidth = viewportWidth;
|
|
1283
|
+
}
|
|
1284
|
+
if (!this.minMeasuredChildHeight && viewportHeight > 0) {
|
|
1285
|
+
this.minMeasuredChildHeight = viewportHeight;
|
|
1286
|
+
}
|
|
1287
|
+
}
|
|
1288
|
+
let child = content.children[0];
|
|
1289
|
+
let clientRect = this.getElementSize(child);
|
|
1290
|
+
this.minMeasuredChildWidth = Math.min(this.minMeasuredChildWidth, clientRect.width);
|
|
1291
|
+
this.minMeasuredChildHeight = Math.min(this.minMeasuredChildHeight, clientRect.height);
|
|
1292
|
+
}
|
|
1293
|
+
defaultChildWidth =
|
|
1294
|
+
this.childWidth || this.minMeasuredChildWidth || viewportWidth;
|
|
1295
|
+
defaultChildHeight =
|
|
1296
|
+
this.childHeight || this.minMeasuredChildHeight || viewportHeight;
|
|
1297
|
+
let itemsPerRow = Math.max(Math.ceil(viewportWidth / defaultChildWidth), 1);
|
|
1298
|
+
let itemsPerCol = Math.max(Math.ceil(viewportHeight / defaultChildHeight), 1);
|
|
1299
|
+
wrapGroupsPerPage = this.horizontal ? itemsPerRow : itemsPerCol;
|
|
1300
|
+
}
|
|
1301
|
+
else {
|
|
1302
|
+
let scrollOffset = scrollElement[this._scrollType] -
|
|
1303
|
+
(this.previousViewPort ? this.previousViewPort.padding : 0);
|
|
1304
|
+
let arrayStartIndex = this.previousViewPort.startIndexWithBuffer || 0;
|
|
1305
|
+
let wrapGroupIndex = Math.ceil(arrayStartIndex / itemsPerWrapGroup);
|
|
1306
|
+
let maxWidthForWrapGroup = 0;
|
|
1307
|
+
let maxHeightForWrapGroup = 0;
|
|
1308
|
+
let sumOfVisibleMaxWidths = 0;
|
|
1309
|
+
let sumOfVisibleMaxHeights = 0;
|
|
1310
|
+
wrapGroupsPerPage = 0;
|
|
1311
|
+
for (let i = 0; i < content.children.length; ++i) {
|
|
1312
|
+
++arrayStartIndex;
|
|
1313
|
+
let child = content.children[i];
|
|
1314
|
+
let clientRect = this.getElementSize(child);
|
|
1315
|
+
maxWidthForWrapGroup = Math.max(maxWidthForWrapGroup, clientRect.width);
|
|
1316
|
+
maxHeightForWrapGroup = Math.max(maxHeightForWrapGroup, clientRect.height);
|
|
1317
|
+
if (arrayStartIndex % itemsPerWrapGroup === 0) {
|
|
1318
|
+
let oldValue = this.wrapGroupDimensions.maxChildSizePerWrapGroup[wrapGroupIndex];
|
|
1319
|
+
if (oldValue) {
|
|
1320
|
+
--this.wrapGroupDimensions.numberOfKnownWrapGroupChildSizes;
|
|
1321
|
+
this.wrapGroupDimensions.sumOfKnownWrapGroupChildWidths -=
|
|
1322
|
+
oldValue.childWidth || 0;
|
|
1323
|
+
this.wrapGroupDimensions.sumOfKnownWrapGroupChildHeights -=
|
|
1324
|
+
oldValue.childHeight || 0;
|
|
1325
|
+
}
|
|
1326
|
+
++this.wrapGroupDimensions.numberOfKnownWrapGroupChildSizes;
|
|
1327
|
+
const items = this.items.slice(arrayStartIndex - itemsPerWrapGroup, arrayStartIndex);
|
|
1328
|
+
this.wrapGroupDimensions.maxChildSizePerWrapGroup[wrapGroupIndex] = {
|
|
1329
|
+
childWidth: maxWidthForWrapGroup,
|
|
1330
|
+
childHeight: maxHeightForWrapGroup,
|
|
1331
|
+
items: items,
|
|
1332
|
+
};
|
|
1333
|
+
this.wrapGroupDimensions.sumOfKnownWrapGroupChildWidths +=
|
|
1334
|
+
maxWidthForWrapGroup;
|
|
1335
|
+
this.wrapGroupDimensions.sumOfKnownWrapGroupChildHeights +=
|
|
1336
|
+
maxHeightForWrapGroup;
|
|
1337
|
+
if (this.horizontal) {
|
|
1338
|
+
let maxVisibleWidthForWrapGroup = Math.min(maxWidthForWrapGroup, Math.max(viewportWidth - sumOfVisibleMaxWidths, 0));
|
|
1339
|
+
if (scrollOffset > 0) {
|
|
1340
|
+
let scrollOffsetToRemove = Math.min(scrollOffset, maxVisibleWidthForWrapGroup);
|
|
1341
|
+
maxVisibleWidthForWrapGroup -= scrollOffsetToRemove;
|
|
1342
|
+
scrollOffset -= scrollOffsetToRemove;
|
|
1343
|
+
}
|
|
1344
|
+
sumOfVisibleMaxWidths += maxVisibleWidthForWrapGroup;
|
|
1345
|
+
if (maxVisibleWidthForWrapGroup > 0 &&
|
|
1346
|
+
viewportWidth >= sumOfVisibleMaxWidths) {
|
|
1347
|
+
++wrapGroupsPerPage;
|
|
1348
|
+
}
|
|
1349
|
+
}
|
|
1350
|
+
else {
|
|
1351
|
+
let maxVisibleHeightForWrapGroup = Math.min(maxHeightForWrapGroup, Math.max(viewportHeight - sumOfVisibleMaxHeights, 0));
|
|
1352
|
+
if (scrollOffset > 0) {
|
|
1353
|
+
let scrollOffsetToRemove = Math.min(scrollOffset, maxVisibleHeightForWrapGroup);
|
|
1354
|
+
maxVisibleHeightForWrapGroup -= scrollOffsetToRemove;
|
|
1355
|
+
scrollOffset -= scrollOffsetToRemove;
|
|
1356
|
+
}
|
|
1357
|
+
sumOfVisibleMaxHeights += maxVisibleHeightForWrapGroup;
|
|
1358
|
+
if (maxVisibleHeightForWrapGroup > 0 &&
|
|
1359
|
+
viewportHeight >= sumOfVisibleMaxHeights) {
|
|
1360
|
+
++wrapGroupsPerPage;
|
|
1361
|
+
}
|
|
1362
|
+
}
|
|
1363
|
+
++wrapGroupIndex;
|
|
1364
|
+
maxWidthForWrapGroup = 0;
|
|
1365
|
+
maxHeightForWrapGroup = 0;
|
|
1366
|
+
}
|
|
1367
|
+
}
|
|
1368
|
+
let averageChildWidth = this.wrapGroupDimensions.sumOfKnownWrapGroupChildWidths /
|
|
1369
|
+
this.wrapGroupDimensions.numberOfKnownWrapGroupChildSizes;
|
|
1370
|
+
let averageChildHeight = this.wrapGroupDimensions.sumOfKnownWrapGroupChildHeights /
|
|
1371
|
+
this.wrapGroupDimensions.numberOfKnownWrapGroupChildSizes;
|
|
1372
|
+
defaultChildWidth = this.childWidth || averageChildWidth || viewportWidth;
|
|
1373
|
+
defaultChildHeight =
|
|
1374
|
+
this.childHeight || averageChildHeight || viewportHeight;
|
|
1375
|
+
if (this.horizontal) {
|
|
1376
|
+
if (viewportWidth > sumOfVisibleMaxWidths) {
|
|
1377
|
+
wrapGroupsPerPage += Math.ceil((viewportWidth - sumOfVisibleMaxWidths) / defaultChildWidth);
|
|
1378
|
+
}
|
|
1379
|
+
}
|
|
1380
|
+
else {
|
|
1381
|
+
if (viewportHeight > sumOfVisibleMaxHeights) {
|
|
1382
|
+
wrapGroupsPerPage += Math.ceil((viewportHeight - sumOfVisibleMaxHeights) / defaultChildHeight);
|
|
1383
|
+
}
|
|
1384
|
+
}
|
|
1385
|
+
}
|
|
1386
|
+
let itemCount = this.items.length;
|
|
1387
|
+
let itemsPerPage = itemsPerWrapGroup * wrapGroupsPerPage;
|
|
1388
|
+
let pageCount_fractional = itemCount / itemsPerPage;
|
|
1389
|
+
let numberOfWrapGroups = Math.ceil(itemCount / itemsPerWrapGroup);
|
|
1390
|
+
let scrollLength = 0;
|
|
1391
|
+
let defaultScrollLengthPerWrapGroup = this.horizontal
|
|
1392
|
+
? defaultChildWidth
|
|
1393
|
+
: defaultChildHeight;
|
|
1394
|
+
if (this.enableUnequalChildrenSizes) {
|
|
1395
|
+
let numUnknownChildSizes = 0;
|
|
1396
|
+
for (let i = 0; i < numberOfWrapGroups; ++i) {
|
|
1397
|
+
let childSize = this.wrapGroupDimensions.maxChildSizePerWrapGroup[i] &&
|
|
1398
|
+
this.wrapGroupDimensions.maxChildSizePerWrapGroup[i][this._childScrollDim];
|
|
1399
|
+
if (childSize) {
|
|
1400
|
+
scrollLength += childSize;
|
|
1401
|
+
}
|
|
1402
|
+
else {
|
|
1403
|
+
++numUnknownChildSizes;
|
|
1404
|
+
}
|
|
1405
|
+
}
|
|
1406
|
+
scrollLength += Math.round(numUnknownChildSizes * defaultScrollLengthPerWrapGroup);
|
|
1407
|
+
}
|
|
1408
|
+
else {
|
|
1409
|
+
scrollLength = numberOfWrapGroups * defaultScrollLengthPerWrapGroup;
|
|
1410
|
+
}
|
|
1411
|
+
if (this.headerElementRef) {
|
|
1412
|
+
scrollLength += this.headerElementRef.nativeElement.clientHeight;
|
|
1413
|
+
}
|
|
1414
|
+
let viewportLength = this.horizontal ? viewportWidth : viewportHeight;
|
|
1415
|
+
let maxScrollPosition = Math.max(scrollLength - viewportLength, 0);
|
|
1416
|
+
return {
|
|
1417
|
+
itemCount: itemCount,
|
|
1418
|
+
itemsPerWrapGroup: itemsPerWrapGroup,
|
|
1419
|
+
wrapGroupsPerPage: wrapGroupsPerPage,
|
|
1420
|
+
itemsPerPage: itemsPerPage,
|
|
1421
|
+
pageCount_fractional: pageCount_fractional,
|
|
1422
|
+
childWidth: defaultChildWidth,
|
|
1423
|
+
childHeight: defaultChildHeight,
|
|
1424
|
+
scrollLength: scrollLength,
|
|
1425
|
+
viewportLength: viewportLength,
|
|
1426
|
+
maxScrollPosition: maxScrollPosition,
|
|
1427
|
+
};
|
|
1428
|
+
}
|
|
1429
|
+
cachedPageSize = 0;
|
|
1430
|
+
previousScrollNumberElements = 0;
|
|
1431
|
+
calculatePadding(arrayStartIndexWithBuffer, dimensions) {
|
|
1432
|
+
if (dimensions.itemCount === 0) {
|
|
1433
|
+
return 0;
|
|
1434
|
+
}
|
|
1435
|
+
let defaultScrollLengthPerWrapGroup = dimensions[this._childScrollDim];
|
|
1436
|
+
let startingWrapGroupIndex = Math.floor(arrayStartIndexWithBuffer / dimensions.itemsPerWrapGroup) || 0;
|
|
1437
|
+
if (!this.enableUnequalChildrenSizes) {
|
|
1438
|
+
return defaultScrollLengthPerWrapGroup * startingWrapGroupIndex;
|
|
1439
|
+
}
|
|
1440
|
+
let numUnknownChildSizes = 0;
|
|
1441
|
+
let result = 0;
|
|
1442
|
+
for (let i = 0; i < startingWrapGroupIndex; ++i) {
|
|
1443
|
+
let childSize = this.wrapGroupDimensions.maxChildSizePerWrapGroup[i] &&
|
|
1444
|
+
this.wrapGroupDimensions.maxChildSizePerWrapGroup[i][this._childScrollDim];
|
|
1445
|
+
if (childSize) {
|
|
1446
|
+
result += childSize;
|
|
1447
|
+
}
|
|
1448
|
+
else {
|
|
1449
|
+
++numUnknownChildSizes;
|
|
1450
|
+
}
|
|
1451
|
+
}
|
|
1452
|
+
result += Math.round(numUnknownChildSizes * defaultScrollLengthPerWrapGroup);
|
|
1453
|
+
return result;
|
|
1454
|
+
}
|
|
1455
|
+
calculatePageInfo(scrollPosition, dimensions) {
|
|
1456
|
+
let scrollPercentage = 0;
|
|
1457
|
+
if (this.enableUnequalChildrenSizes) {
|
|
1458
|
+
const numberOfWrapGroups = Math.ceil(dimensions.itemCount / dimensions.itemsPerWrapGroup);
|
|
1459
|
+
let totalScrolledLength = 0;
|
|
1460
|
+
let defaultScrollLengthPerWrapGroup = dimensions[this._childScrollDim];
|
|
1461
|
+
for (let i = 0; i < numberOfWrapGroups; ++i) {
|
|
1462
|
+
let childSize = this.wrapGroupDimensions.maxChildSizePerWrapGroup[i] &&
|
|
1463
|
+
this.wrapGroupDimensions.maxChildSizePerWrapGroup[i][this._childScrollDim];
|
|
1464
|
+
if (childSize) {
|
|
1465
|
+
totalScrolledLength += childSize;
|
|
1466
|
+
}
|
|
1467
|
+
else {
|
|
1468
|
+
totalScrolledLength += defaultScrollLengthPerWrapGroup;
|
|
1469
|
+
}
|
|
1470
|
+
if (scrollPosition < totalScrolledLength) {
|
|
1471
|
+
scrollPercentage = i / numberOfWrapGroups;
|
|
1472
|
+
break;
|
|
1473
|
+
}
|
|
1474
|
+
}
|
|
1475
|
+
}
|
|
1476
|
+
else {
|
|
1477
|
+
scrollPercentage = scrollPosition / dimensions.scrollLength;
|
|
1478
|
+
}
|
|
1479
|
+
let startingArrayIndex_fractional = Math.min(Math.max(scrollPercentage * dimensions.pageCount_fractional, 0), dimensions.pageCount_fractional) * dimensions.itemsPerPage;
|
|
1480
|
+
let maxStart = dimensions.itemCount - dimensions.itemsPerPage - 1;
|
|
1481
|
+
let arrayStartIndex = Math.min(Math.floor(startingArrayIndex_fractional), maxStart);
|
|
1482
|
+
arrayStartIndex -= arrayStartIndex % dimensions.itemsPerWrapGroup; // round down to start of wrapGroup
|
|
1483
|
+
if (this.stripedTable) {
|
|
1484
|
+
let bufferBoundary = 2 * dimensions.itemsPerWrapGroup;
|
|
1485
|
+
if (arrayStartIndex % bufferBoundary !== 0) {
|
|
1486
|
+
arrayStartIndex = Math.max(arrayStartIndex - (arrayStartIndex % bufferBoundary), 0);
|
|
1487
|
+
}
|
|
1488
|
+
}
|
|
1489
|
+
let arrayEndIndex = Math.ceil(startingArrayIndex_fractional) + dimensions.itemsPerPage - 1;
|
|
1490
|
+
let endIndexWithinWrapGroup = (arrayEndIndex + 1) % dimensions.itemsPerWrapGroup;
|
|
1491
|
+
if (endIndexWithinWrapGroup > 0) {
|
|
1492
|
+
arrayEndIndex += dimensions.itemsPerWrapGroup - endIndexWithinWrapGroup; // round up to end of wrapGroup
|
|
1493
|
+
}
|
|
1494
|
+
if (isNaN(arrayStartIndex)) {
|
|
1495
|
+
arrayStartIndex = 0;
|
|
1496
|
+
}
|
|
1497
|
+
if (isNaN(arrayEndIndex)) {
|
|
1498
|
+
arrayEndIndex = 0;
|
|
1499
|
+
}
|
|
1500
|
+
arrayStartIndex = Math.min(Math.max(arrayStartIndex, 0), dimensions.itemCount - 1);
|
|
1501
|
+
arrayEndIndex = Math.min(Math.max(arrayEndIndex, 0), dimensions.itemCount - 1);
|
|
1502
|
+
let bufferSize = this.bufferAmount * dimensions.itemsPerWrapGroup;
|
|
1503
|
+
let startIndexWithBuffer = Math.min(Math.max(arrayStartIndex - bufferSize, 0), dimensions.itemCount - 1);
|
|
1504
|
+
let endIndexWithBuffer = Math.min(Math.max(arrayEndIndex + bufferSize, 0), dimensions.itemCount - 1);
|
|
1505
|
+
return {
|
|
1506
|
+
startIndex: arrayStartIndex,
|
|
1507
|
+
endIndex: arrayEndIndex,
|
|
1508
|
+
startIndexWithBuffer: startIndexWithBuffer,
|
|
1509
|
+
endIndexWithBuffer: endIndexWithBuffer,
|
|
1510
|
+
scrollStartPosition: scrollPosition,
|
|
1511
|
+
scrollEndPosition: scrollPosition + dimensions.viewportLength,
|
|
1512
|
+
maxScrollPosition: dimensions.maxScrollPosition,
|
|
1513
|
+
};
|
|
1514
|
+
}
|
|
1515
|
+
calculateViewport() {
|
|
1516
|
+
let dimensions = this.calculateDimensions();
|
|
1517
|
+
let offset = this.getElementsOffset();
|
|
1518
|
+
let scrollStartPosition = this.getScrollStartPosition();
|
|
1519
|
+
if (scrollStartPosition > dimensions.scrollLength + offset &&
|
|
1520
|
+
!(this.parentScroll instanceof Window)) {
|
|
1521
|
+
scrollStartPosition = dimensions.scrollLength;
|
|
1522
|
+
}
|
|
1523
|
+
else {
|
|
1524
|
+
scrollStartPosition -= offset;
|
|
1525
|
+
}
|
|
1526
|
+
scrollStartPosition = Math.max(0, scrollStartPosition);
|
|
1527
|
+
let pageInfo = this.calculatePageInfo(scrollStartPosition, dimensions);
|
|
1528
|
+
let newPadding = this.calculatePadding(pageInfo.startIndexWithBuffer, dimensions);
|
|
1529
|
+
let newScrollLength = dimensions.scrollLength;
|
|
1530
|
+
return {
|
|
1531
|
+
startIndex: pageInfo.startIndex,
|
|
1532
|
+
endIndex: pageInfo.endIndex,
|
|
1533
|
+
startIndexWithBuffer: pageInfo.startIndexWithBuffer,
|
|
1534
|
+
endIndexWithBuffer: pageInfo.endIndexWithBuffer,
|
|
1535
|
+
padding: Math.round(newPadding),
|
|
1536
|
+
scrollLength: Math.round(newScrollLength),
|
|
1537
|
+
scrollStartPosition: pageInfo.scrollStartPosition,
|
|
1538
|
+
scrollEndPosition: pageInfo.scrollEndPosition,
|
|
1539
|
+
maxScrollPosition: pageInfo.maxScrollPosition,
|
|
1540
|
+
};
|
|
1541
|
+
}
|
|
1542
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: VirtualScrollerComponent, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.NgZone }, { token: i0.ChangeDetectorRef }, { token: PLATFORM_ID }, { token: 'virtual-scroller-default-options', optional: true }], target: i0.ɵɵFactoryTarget.Component });
|
|
1543
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.14", type: VirtualScrollerComponent, selector: "virtual-scroller,[virtualScroller]", inputs: { executeRefreshOutsideAngularZone: "executeRefreshOutsideAngularZone", enableUnequalChildrenSizes: "enableUnequalChildrenSizes", useMarginInsteadOfTranslate: "useMarginInsteadOfTranslate", modifyOverflowStyleOfParentScroll: "modifyOverflowStyleOfParentScroll", stripedTable: "stripedTable", scrollbarWidth: "scrollbarWidth", scrollbarHeight: "scrollbarHeight", childWidth: "childWidth", childHeight: "childHeight", ssrChildWidth: "ssrChildWidth", ssrChildHeight: "ssrChildHeight", ssrViewportWidth: "ssrViewportWidth", ssrViewportHeight: "ssrViewportHeight", bufferAmount: "bufferAmount", scrollAnimationTime: "scrollAnimationTime", resizeBypassRefreshThreshold: "resizeBypassRefreshThreshold", scrollThrottlingTime: "scrollThrottlingTime", scrollDebounceTime: "scrollDebounceTime", checkResizeInterval: "checkResizeInterval", items: "items", compareItems: "compareItems", horizontal: "horizontal", parentScroll: "parentScroll" }, outputs: { vsUpdate: "vsUpdate", vsChange: "vsChange", vsStart: "vsStart", vsEnd: "vsEnd" }, host: { properties: { "class.horizontal": "horizontal", "class.vertical": "!horizontal", "class.selfScroll": "!parentScroll" } }, queries: [{ propertyName: "headerElementRef", first: true, predicate: ["header"], descendants: true, read: ElementRef }, { propertyName: "containerElementRef", first: true, predicate: ["container"], descendants: true, read: ElementRef }], viewQueries: [{ propertyName: "contentElementRef", first: true, predicate: ["content"], descendants: true, read: ElementRef }, { propertyName: "invisiblePaddingElementRef", first: true, predicate: ["invisiblePadding"], descendants: true, read: ElementRef }], exportAs: ["virtualScroller"], usesOnChanges: true, ngImport: i0, template: `
|
|
1544
|
+
<div class="total-padding" #invisiblePadding></div>
|
|
1545
|
+
<div class="scrollable-content" #content>
|
|
1546
|
+
<ng-content></ng-content>
|
|
1547
|
+
</div>
|
|
1548
|
+
`, isInline: true, styles: [":host{position:relative;display:block;-webkit-overflow-scrolling:touch}:host.horizontal.selfScroll{overflow-y:visible;overflow-x:auto}:host.vertical.selfScroll{overflow-y:auto;overflow-x:visible}.scrollable-content{top:0;left:0;width:100%;height:100%;max-width:100vw;max-height:100vh;position:absolute}.scrollable-content ::ng-deep>*{box-sizing:border-box}:host.horizontal{white-space:nowrap}:host.horizontal .scrollable-content{display:flex}:host.horizontal .scrollable-content ::ng-deep>*{flex-shrink:0;flex-grow:0;white-space:initial}.total-padding{width:1px;opacity:0}:host.horizontal .total-padding{height:100%}\n"] });
|
|
1549
|
+
}
|
|
1550
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: VirtualScrollerComponent, decorators: [{
|
|
1551
|
+
type: Component,
|
|
1552
|
+
args: [{ selector: 'virtual-scroller,[virtualScroller]', exportAs: 'virtualScroller', template: `
|
|
1553
|
+
<div class="total-padding" #invisiblePadding></div>
|
|
1554
|
+
<div class="scrollable-content" #content>
|
|
1555
|
+
<ng-content></ng-content>
|
|
1556
|
+
</div>
|
|
1557
|
+
`, host: {
|
|
1558
|
+
'[class.horizontal]': 'horizontal',
|
|
1559
|
+
'[class.vertical]': '!horizontal',
|
|
1560
|
+
'[class.selfScroll]': '!parentScroll',
|
|
1561
|
+
}, styles: [":host{position:relative;display:block;-webkit-overflow-scrolling:touch}:host.horizontal.selfScroll{overflow-y:visible;overflow-x:auto}:host.vertical.selfScroll{overflow-y:auto;overflow-x:visible}.scrollable-content{top:0;left:0;width:100%;height:100%;max-width:100vw;max-height:100vh;position:absolute}.scrollable-content ::ng-deep>*{box-sizing:border-box}:host.horizontal{white-space:nowrap}:host.horizontal .scrollable-content{display:flex}:host.horizontal .scrollable-content ::ng-deep>*{flex-shrink:0;flex-grow:0;white-space:initial}.total-padding{width:1px;opacity:0}:host.horizontal .total-padding{height:100%}\n"] }]
|
|
1562
|
+
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.NgZone }, { type: i0.ChangeDetectorRef }, { type: Object, decorators: [{
|
|
1563
|
+
type: Inject,
|
|
1564
|
+
args: [PLATFORM_ID]
|
|
1565
|
+
}] }, { type: undefined, decorators: [{
|
|
1566
|
+
type: Optional
|
|
1567
|
+
}, {
|
|
1568
|
+
type: Inject,
|
|
1569
|
+
args: ['virtual-scroller-default-options']
|
|
1570
|
+
}] }], propDecorators: { executeRefreshOutsideAngularZone: [{
|
|
1571
|
+
type: Input
|
|
1572
|
+
}], enableUnequalChildrenSizes: [{
|
|
1573
|
+
type: Input
|
|
1574
|
+
}], useMarginInsteadOfTranslate: [{
|
|
1575
|
+
type: Input
|
|
1576
|
+
}], modifyOverflowStyleOfParentScroll: [{
|
|
1577
|
+
type: Input
|
|
1578
|
+
}], stripedTable: [{
|
|
1579
|
+
type: Input
|
|
1580
|
+
}], scrollbarWidth: [{
|
|
1581
|
+
type: Input
|
|
1582
|
+
}], scrollbarHeight: [{
|
|
1583
|
+
type: Input
|
|
1584
|
+
}], childWidth: [{
|
|
1585
|
+
type: Input
|
|
1586
|
+
}], childHeight: [{
|
|
1587
|
+
type: Input
|
|
1588
|
+
}], ssrChildWidth: [{
|
|
1589
|
+
type: Input
|
|
1590
|
+
}], ssrChildHeight: [{
|
|
1591
|
+
type: Input
|
|
1592
|
+
}], ssrViewportWidth: [{
|
|
1593
|
+
type: Input
|
|
1594
|
+
}], ssrViewportHeight: [{
|
|
1595
|
+
type: Input
|
|
1596
|
+
}], bufferAmount: [{
|
|
1597
|
+
type: Input
|
|
1598
|
+
}], scrollAnimationTime: [{
|
|
1599
|
+
type: Input
|
|
1600
|
+
}], resizeBypassRefreshThreshold: [{
|
|
1601
|
+
type: Input
|
|
1602
|
+
}], scrollThrottlingTime: [{
|
|
1603
|
+
type: Input
|
|
1604
|
+
}], scrollDebounceTime: [{
|
|
1605
|
+
type: Input
|
|
1606
|
+
}], checkResizeInterval: [{
|
|
1607
|
+
type: Input
|
|
1608
|
+
}], items: [{
|
|
1609
|
+
type: Input
|
|
1610
|
+
}], compareItems: [{
|
|
1611
|
+
type: Input
|
|
1612
|
+
}], horizontal: [{
|
|
1613
|
+
type: Input
|
|
1614
|
+
}], parentScroll: [{
|
|
1615
|
+
type: Input
|
|
1616
|
+
}], vsUpdate: [{
|
|
1617
|
+
type: Output
|
|
1618
|
+
}], vsChange: [{
|
|
1619
|
+
type: Output
|
|
1620
|
+
}], vsStart: [{
|
|
1621
|
+
type: Output
|
|
1622
|
+
}], vsEnd: [{
|
|
1623
|
+
type: Output
|
|
1624
|
+
}], contentElementRef: [{
|
|
1625
|
+
type: ViewChild,
|
|
1626
|
+
args: ['content', { read: ElementRef, static: false }]
|
|
1627
|
+
}], invisiblePaddingElementRef: [{
|
|
1628
|
+
type: ViewChild,
|
|
1629
|
+
args: ['invisiblePadding', { read: ElementRef, static: false }]
|
|
1630
|
+
}], headerElementRef: [{
|
|
1631
|
+
type: ContentChild,
|
|
1632
|
+
args: ['header', { read: ElementRef, static: false }]
|
|
1633
|
+
}], containerElementRef: [{
|
|
1634
|
+
type: ContentChild,
|
|
1635
|
+
args: ['container', { read: ElementRef, static: false }]
|
|
1636
|
+
}] } });
|
|
1637
|
+
class VirtualScrollerModule {
|
|
1638
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: VirtualScrollerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1639
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.14", ngImport: i0, type: VirtualScrollerModule, declarations: [VirtualScrollerComponent], imports: [CommonModule], exports: [VirtualScrollerComponent] });
|
|
1640
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: VirtualScrollerModule, providers: [
|
|
1641
|
+
{
|
|
1642
|
+
provide: 'virtual-scroller-default-options',
|
|
1643
|
+
useFactory: VIRTUAL_SCROLLER_DEFAULT_OPTIONS_FACTORY,
|
|
1644
|
+
},
|
|
1645
|
+
], imports: [CommonModule] });
|
|
1646
|
+
}
|
|
1647
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: VirtualScrollerModule, decorators: [{
|
|
1648
|
+
type: NgModule,
|
|
1649
|
+
args: [{
|
|
1650
|
+
exports: [VirtualScrollerComponent],
|
|
1651
|
+
declarations: [VirtualScrollerComponent],
|
|
1652
|
+
imports: [CommonModule],
|
|
1653
|
+
providers: [
|
|
1654
|
+
{
|
|
1655
|
+
provide: 'virtual-scroller-default-options',
|
|
1656
|
+
useFactory: VIRTUAL_SCROLLER_DEFAULT_OPTIONS_FACTORY,
|
|
1657
|
+
},
|
|
1658
|
+
],
|
|
1659
|
+
}]
|
|
1660
|
+
}] });
|
|
1661
|
+
|
|
1662
|
+
const DROPDOWN_CONTROL_VALUE_ACCESSOR = {
|
|
1663
|
+
provide: NG_VALUE_ACCESSOR,
|
|
1664
|
+
useExisting: forwardRef(() => AngularMultiSelect),
|
|
1665
|
+
multi: true,
|
|
1666
|
+
};
|
|
1667
|
+
const DROPDOWN_CONTROL_VALIDATION = {
|
|
1668
|
+
provide: NG_VALIDATORS,
|
|
1669
|
+
useExisting: forwardRef(() => AngularMultiSelect),
|
|
1670
|
+
multi: true,
|
|
1671
|
+
};
|
|
1672
|
+
const noop = () => { };
|
|
1673
|
+
class AngularMultiSelect {
|
|
1674
|
+
_elementRef;
|
|
1675
|
+
cdr;
|
|
1676
|
+
filterPipe;
|
|
1677
|
+
data;
|
|
1678
|
+
settings;
|
|
1679
|
+
loading;
|
|
1680
|
+
onSelect = new EventEmitter();
|
|
1681
|
+
onDeSelect = new EventEmitter();
|
|
1682
|
+
onSelectAll = new EventEmitter();
|
|
1683
|
+
onDeSelectAll = new EventEmitter();
|
|
1684
|
+
onOpen = new EventEmitter();
|
|
1685
|
+
onClose = new EventEmitter();
|
|
1686
|
+
onScrollToEnd = new EventEmitter();
|
|
1687
|
+
onFilterSelectAll = new EventEmitter();
|
|
1688
|
+
onFilterDeSelectAll = new EventEmitter();
|
|
1689
|
+
onAddFilterNewItem = new EventEmitter();
|
|
1690
|
+
onGroupSelect = new EventEmitter();
|
|
1691
|
+
onGroupDeSelect = new EventEmitter();
|
|
1692
|
+
itemTempl;
|
|
1693
|
+
badgeTempl;
|
|
1694
|
+
searchTempl;
|
|
1695
|
+
searchInput;
|
|
1696
|
+
selectedListElem;
|
|
1697
|
+
dropdownListElem;
|
|
1698
|
+
cuppaDropdown;
|
|
1699
|
+
onEscapeDown(event) {
|
|
1700
|
+
if (this.settings.escapeToClose) {
|
|
1701
|
+
this.closeDropdown();
|
|
1702
|
+
}
|
|
1703
|
+
}
|
|
1704
|
+
onScroll(event) {
|
|
1705
|
+
if (this.isActive && this.settings.tagToBody) {
|
|
1706
|
+
this.closeDropdown();
|
|
1707
|
+
/* const elem = this.cuppaDropdown.nativeElement;
|
|
1708
|
+
if(this.settings.autoPosition){
|
|
1709
|
+
this.dropDownTop = elem.getBoundingClientRect().y + elem.clientHeight + 1;
|
|
1710
|
+
}
|
|
1711
|
+
this.dropDownLeft = elem.getBoundingClientRect().x; */
|
|
1712
|
+
}
|
|
1713
|
+
}
|
|
1714
|
+
virtualdata = [];
|
|
1715
|
+
searchTerm$ = new Subject();
|
|
1716
|
+
selectedItems;
|
|
1717
|
+
isActive = false;
|
|
1718
|
+
isSelectAll = false;
|
|
1719
|
+
isFilterSelectAll = false;
|
|
1720
|
+
isInfiniteFilterSelectAll = false;
|
|
1721
|
+
groupedData;
|
|
1722
|
+
filter;
|
|
1723
|
+
chunkArray;
|
|
1724
|
+
scrollTop;
|
|
1725
|
+
chunkIndex = [];
|
|
1726
|
+
cachedItems = [];
|
|
1727
|
+
groupCachedItems = [];
|
|
1728
|
+
totalRows;
|
|
1729
|
+
itemHeight = 41.6;
|
|
1730
|
+
screenItemsLen;
|
|
1731
|
+
cachedItemsLen;
|
|
1732
|
+
totalHeight;
|
|
1733
|
+
scroller;
|
|
1734
|
+
maxBuffer;
|
|
1735
|
+
lastScrolled;
|
|
1736
|
+
lastRepaintY;
|
|
1737
|
+
selectedListHeight;
|
|
1738
|
+
filterLength = 0;
|
|
1739
|
+
infiniteFilterLength = 0;
|
|
1740
|
+
viewPortItems;
|
|
1741
|
+
item;
|
|
1742
|
+
dropdownListYOffset = 0;
|
|
1743
|
+
subscription;
|
|
1744
|
+
dropDownWidth = 0;
|
|
1745
|
+
dropDownTop = '';
|
|
1746
|
+
dropDownBottom = 'unset';
|
|
1747
|
+
dropDownLeft = 0;
|
|
1748
|
+
id = Math.random().toString(36).substring(2);
|
|
1749
|
+
defaultSettings = {
|
|
1750
|
+
singleSelection: false,
|
|
1751
|
+
text: 'Select',
|
|
1752
|
+
enableCheckAll: true,
|
|
1753
|
+
selectAllText: 'Select All',
|
|
1754
|
+
unSelectAllText: 'UnSelect All',
|
|
1755
|
+
filterSelectAllText: 'Select all filtered results',
|
|
1756
|
+
filterUnSelectAllText: 'UnSelect all filtered results',
|
|
1757
|
+
enableSearchFilter: false,
|
|
1758
|
+
searchBy: [],
|
|
1759
|
+
maxHeight: 300,
|
|
1760
|
+
badgeShowLimit: 999999999999,
|
|
1761
|
+
classes: '',
|
|
1762
|
+
disabled: false,
|
|
1763
|
+
searchPlaceholderText: 'Search',
|
|
1764
|
+
showCheckbox: true,
|
|
1765
|
+
noDataLabel: 'No Data Available',
|
|
1766
|
+
searchAutofocus: true,
|
|
1767
|
+
lazyLoading: false,
|
|
1768
|
+
labelKey: 'itemName',
|
|
1769
|
+
primaryKey: 'id',
|
|
1770
|
+
position: 'bottom',
|
|
1771
|
+
autoPosition: true,
|
|
1772
|
+
enableFilterSelectAll: true,
|
|
1773
|
+
selectGroup: false,
|
|
1774
|
+
addNewItemOnFilter: false,
|
|
1775
|
+
addNewButtonText: 'Add',
|
|
1776
|
+
escapeToClose: true,
|
|
1777
|
+
clearAll: true,
|
|
1778
|
+
tagToBody: true,
|
|
1779
|
+
};
|
|
1780
|
+
randomSize = true;
|
|
1781
|
+
parseError;
|
|
1782
|
+
filteredList = [];
|
|
1783
|
+
virtualScroollInit = false;
|
|
1784
|
+
virtualScroller;
|
|
1785
|
+
isDisabledItemPresent = false;
|
|
1786
|
+
constructor(_elementRef, cdr, filterPipe) {
|
|
1787
|
+
this._elementRef = _elementRef;
|
|
1788
|
+
this.cdr = cdr;
|
|
1789
|
+
this.filterPipe = filterPipe;
|
|
1790
|
+
this.searchTerm$
|
|
1791
|
+
.asObservable()
|
|
1792
|
+
.pipe(debounceTime(1000), distinctUntilChanged(), tap((term) => term))
|
|
1793
|
+
.subscribe((val) => {
|
|
1794
|
+
this.filterInfiniteList(val);
|
|
1795
|
+
});
|
|
1796
|
+
}
|
|
1797
|
+
ngOnInit() {
|
|
1798
|
+
this.settings = Object.assign(this.defaultSettings, this.settings);
|
|
1799
|
+
this.cachedItems = this.cloneArray(this.data);
|
|
1800
|
+
if (this.settings.position == 'top') {
|
|
1801
|
+
setTimeout(() => {
|
|
1802
|
+
this.selectedListHeight = { val: 0 };
|
|
1803
|
+
this.selectedListHeight.val =
|
|
1804
|
+
this.selectedListElem.nativeElement.clientHeight;
|
|
1805
|
+
});
|
|
1806
|
+
}
|
|
1807
|
+
setTimeout(() => {
|
|
1808
|
+
this.calculateDropdownDirection();
|
|
1809
|
+
});
|
|
1810
|
+
this.virtualScroollInit = false;
|
|
1811
|
+
}
|
|
1812
|
+
onKeyUp(evt) {
|
|
1813
|
+
this.searchTerm$.next(evt.target.value);
|
|
1814
|
+
}
|
|
1815
|
+
ngOnChanges(changes) {
|
|
1816
|
+
if (changes.data && !changes.data.firstChange) {
|
|
1817
|
+
if (this.settings.groupBy) {
|
|
1818
|
+
this.groupedData = this.transformData(this.data, this.settings.groupBy);
|
|
1819
|
+
if (this.data.length == 0) {
|
|
1820
|
+
this.selectedItems = [];
|
|
1821
|
+
}
|
|
1822
|
+
this.groupCachedItems = this.cloneArray(this.groupedData);
|
|
1823
|
+
}
|
|
1824
|
+
this.cachedItems = this.cloneArray(this.data);
|
|
1825
|
+
}
|
|
1826
|
+
if (changes.settings && !changes.settings.firstChange) {
|
|
1827
|
+
this.settings = Object.assign(this.defaultSettings, this.settings);
|
|
1828
|
+
}
|
|
1829
|
+
if (changes.loading) {
|
|
1830
|
+
}
|
|
1831
|
+
if (this.settings.lazyLoading && this.virtualScroollInit && changes.data) {
|
|
1832
|
+
this.virtualdata = changes.data.currentValue;
|
|
1833
|
+
}
|
|
1834
|
+
}
|
|
1835
|
+
ngDoCheck() {
|
|
1836
|
+
if (this.selectedItems) {
|
|
1837
|
+
if (this.selectedItems.length == 0 ||
|
|
1838
|
+
this.data.length == 0 ||
|
|
1839
|
+
this.selectedItems.length < this.data.length) {
|
|
1840
|
+
this.isSelectAll = false;
|
|
1841
|
+
}
|
|
1842
|
+
}
|
|
1843
|
+
}
|
|
1844
|
+
ngAfterViewInit() {
|
|
1845
|
+
if (this.settings.lazyLoading) {
|
|
1846
|
+
// this._elementRef.nativeElement.getElementsByClassName("lazyContainer")[0].addEventListener('scroll', this.onScroll.bind(this));
|
|
1847
|
+
}
|
|
1848
|
+
}
|
|
1849
|
+
ngAfterViewChecked() {
|
|
1850
|
+
if (this.selectedListElem.nativeElement.clientHeight &&
|
|
1851
|
+
this.settings.position == 'top' &&
|
|
1852
|
+
this.selectedListHeight) {
|
|
1853
|
+
this.selectedListHeight.val =
|
|
1854
|
+
this.selectedListElem.nativeElement.clientHeight;
|
|
1855
|
+
this.cdr.detectChanges();
|
|
1856
|
+
}
|
|
1857
|
+
//this.calculateDropdownDirection();
|
|
1858
|
+
}
|
|
1859
|
+
onItemClick(item, index, evt) {
|
|
1860
|
+
if (item.disabled) {
|
|
1861
|
+
return;
|
|
1862
|
+
}
|
|
1863
|
+
if (this.settings.disabled) {
|
|
1864
|
+
return;
|
|
1865
|
+
}
|
|
1866
|
+
let found = this.isSelected(item);
|
|
1867
|
+
let limit = this.selectedItems.length < this.settings.limitSelection ? true : false;
|
|
1868
|
+
if (!found) {
|
|
1869
|
+
if (this.settings.limitSelection) {
|
|
1870
|
+
if (limit) {
|
|
1871
|
+
this.addSelected(item);
|
|
1872
|
+
this.onSelect.emit(item);
|
|
1873
|
+
}
|
|
1874
|
+
}
|
|
1875
|
+
else {
|
|
1876
|
+
this.addSelected(item);
|
|
1877
|
+
this.onSelect.emit(item);
|
|
1878
|
+
}
|
|
1879
|
+
}
|
|
1880
|
+
else {
|
|
1881
|
+
this.removeSelected(item);
|
|
1882
|
+
this.onDeSelect.emit(item);
|
|
1883
|
+
}
|
|
1884
|
+
if (this.isSelectAll || this.data.length > this.selectedItems.length) {
|
|
1885
|
+
this.isSelectAll = false;
|
|
1886
|
+
}
|
|
1887
|
+
if (this.data.length == this.selectedItems.length) {
|
|
1888
|
+
this.isSelectAll = true;
|
|
1889
|
+
}
|
|
1890
|
+
if (this.settings.groupBy) {
|
|
1891
|
+
this.updateGroupInfo(item);
|
|
1892
|
+
}
|
|
1893
|
+
}
|
|
1894
|
+
validate(c) {
|
|
1895
|
+
return null;
|
|
1896
|
+
}
|
|
1897
|
+
onTouchedCallback = noop;
|
|
1898
|
+
onChangeCallback = noop;
|
|
1899
|
+
writeValue(value) {
|
|
1900
|
+
if (value !== undefined && value !== null && value !== '') {
|
|
1901
|
+
if (this.settings.singleSelection) {
|
|
1902
|
+
if (this.settings.groupBy) {
|
|
1903
|
+
this.groupedData = this.transformData(this.data, this.settings.groupBy);
|
|
1904
|
+
this.groupCachedItems = this.cloneArray(this.groupedData);
|
|
1905
|
+
this.selectedItems = [value[0]];
|
|
1906
|
+
}
|
|
1907
|
+
else {
|
|
1908
|
+
try {
|
|
1909
|
+
if (value.length > 1) {
|
|
1910
|
+
this.selectedItems = [value[0]];
|
|
1911
|
+
throw new MyException(404, {
|
|
1912
|
+
msg: 'Single Selection Mode, Selected Items cannot have more than one item.',
|
|
1913
|
+
});
|
|
1914
|
+
}
|
|
1915
|
+
else {
|
|
1916
|
+
this.selectedItems = value;
|
|
1917
|
+
}
|
|
1918
|
+
}
|
|
1919
|
+
catch (e) {
|
|
1920
|
+
console.error(e.body.msg);
|
|
1921
|
+
}
|
|
1922
|
+
}
|
|
1923
|
+
}
|
|
1924
|
+
else {
|
|
1925
|
+
if (this.settings.limitSelection) {
|
|
1926
|
+
this.selectedItems = value.slice(0, this.settings.limitSelection);
|
|
1927
|
+
}
|
|
1928
|
+
else {
|
|
1929
|
+
this.selectedItems = value;
|
|
1930
|
+
}
|
|
1931
|
+
if (this.selectedItems != null &&
|
|
1932
|
+
this.selectedItems.length === this.data.length &&
|
|
1933
|
+
this.data.length > 0) {
|
|
1934
|
+
this.isSelectAll = true;
|
|
1935
|
+
}
|
|
1936
|
+
if (this.settings.groupBy) {
|
|
1937
|
+
this.groupedData = this.transformData(this.data, this.settings.groupBy);
|
|
1938
|
+
this.groupCachedItems = this.cloneArray(this.groupedData);
|
|
1939
|
+
}
|
|
1940
|
+
}
|
|
1941
|
+
}
|
|
1942
|
+
else {
|
|
1943
|
+
this.selectedItems = [];
|
|
1944
|
+
}
|
|
1945
|
+
}
|
|
1946
|
+
//From ControlValueAccessor interface
|
|
1947
|
+
registerOnChange(fn) {
|
|
1948
|
+
this.onChangeCallback = fn;
|
|
1949
|
+
}
|
|
1950
|
+
//From ControlValueAccessor interface
|
|
1951
|
+
registerOnTouched(fn) {
|
|
1952
|
+
this.onTouchedCallback = fn;
|
|
1953
|
+
}
|
|
1954
|
+
trackByFn(index, item) {
|
|
1955
|
+
return item[this.settings.primaryKey];
|
|
1956
|
+
}
|
|
1957
|
+
isSelected(clickedItem) {
|
|
1958
|
+
if (clickedItem.disabled) {
|
|
1959
|
+
return false;
|
|
1960
|
+
}
|
|
1961
|
+
let found = false;
|
|
1962
|
+
this.selectedItems &&
|
|
1963
|
+
this.selectedItems.forEach((item) => {
|
|
1964
|
+
if (clickedItem[this.settings.primaryKey] ===
|
|
1965
|
+
item[this.settings.primaryKey]) {
|
|
1966
|
+
found = true;
|
|
1967
|
+
}
|
|
1968
|
+
});
|
|
1969
|
+
return found;
|
|
1970
|
+
}
|
|
1971
|
+
addSelected(item) {
|
|
1972
|
+
if (item.disabled) {
|
|
1973
|
+
return;
|
|
1974
|
+
}
|
|
1975
|
+
if (this.settings.singleSelection) {
|
|
1976
|
+
this.selectedItems = [];
|
|
1977
|
+
this.selectedItems.push(item);
|
|
1978
|
+
this.closeDropdown();
|
|
1979
|
+
}
|
|
1980
|
+
else
|
|
1981
|
+
this.selectedItems = [...this.selectedItems, item];
|
|
1982
|
+
this.onChangeCallback(this.selectedItems);
|
|
1983
|
+
this.onTouchedCallback(this.selectedItems);
|
|
1984
|
+
}
|
|
1985
|
+
removeSelected(clickedItem) {
|
|
1986
|
+
this.selectedItems &&
|
|
1987
|
+
this.selectedItems.forEach((item) => {
|
|
1988
|
+
if (clickedItem[this.settings.primaryKey] ===
|
|
1989
|
+
item[this.settings.primaryKey]) {
|
|
1990
|
+
this.selectedItems.splice(this.selectedItems.indexOf(item), 1);
|
|
1991
|
+
}
|
|
1992
|
+
});
|
|
1993
|
+
this.onChangeCallback(this.selectedItems);
|
|
1994
|
+
this.onTouchedCallback(this.selectedItems);
|
|
1995
|
+
}
|
|
1996
|
+
toggleDropdown(evt) {
|
|
1997
|
+
if (this.settings.disabled) {
|
|
1998
|
+
return;
|
|
1999
|
+
}
|
|
2000
|
+
this.isActive = !this.isActive;
|
|
2001
|
+
if (this.isActive) {
|
|
2002
|
+
this.openDropdown();
|
|
2003
|
+
}
|
|
2004
|
+
else {
|
|
2005
|
+
this.closeDropdown();
|
|
2006
|
+
}
|
|
2007
|
+
if (this.settings.lazyLoading) {
|
|
2008
|
+
this.virtualdata = this.data;
|
|
2009
|
+
this.virtualScroollInit = true;
|
|
2010
|
+
}
|
|
2011
|
+
evt.preventDefault();
|
|
2012
|
+
}
|
|
2013
|
+
openDropdown() {
|
|
2014
|
+
if (this.settings.disabled) {
|
|
2015
|
+
return;
|
|
2016
|
+
}
|
|
2017
|
+
this.isActive = true;
|
|
2018
|
+
this.calculateDropdownDirection();
|
|
2019
|
+
if (this.settings.searchAutofocus &&
|
|
2020
|
+
this.searchInput &&
|
|
2021
|
+
this.settings.enableSearchFilter &&
|
|
2022
|
+
!this.searchTempl) {
|
|
2023
|
+
setTimeout(() => {
|
|
2024
|
+
this.searchInput.nativeElement.focus();
|
|
2025
|
+
}, 0);
|
|
2026
|
+
}
|
|
2027
|
+
this.onOpen.emit(true);
|
|
2028
|
+
}
|
|
2029
|
+
closeDropdown() {
|
|
2030
|
+
if (this.searchInput && this.settings.lazyLoading) {
|
|
2031
|
+
this.searchInput.nativeElement.value = '';
|
|
2032
|
+
}
|
|
2033
|
+
if (this.searchInput) {
|
|
2034
|
+
this.searchInput.nativeElement.value = '';
|
|
2035
|
+
}
|
|
2036
|
+
this.filter = '';
|
|
2037
|
+
this.isActive = false;
|
|
2038
|
+
this.searchTerm$.next('');
|
|
2039
|
+
this.onClose.emit(false);
|
|
2040
|
+
}
|
|
2041
|
+
closeDropdownOnClickOut() {
|
|
2042
|
+
if (this.isActive) {
|
|
2043
|
+
if (this.searchInput && this.settings.lazyLoading) {
|
|
2044
|
+
this.searchInput.nativeElement.value = '';
|
|
2045
|
+
}
|
|
2046
|
+
if (this.searchInput) {
|
|
2047
|
+
this.searchInput.nativeElement.value = '';
|
|
2048
|
+
}
|
|
2049
|
+
this.filter = '';
|
|
2050
|
+
this.isActive = false;
|
|
2051
|
+
this.clearSearch();
|
|
2052
|
+
this.searchTerm$.next('');
|
|
2053
|
+
this.onClose.emit(false);
|
|
2054
|
+
}
|
|
2055
|
+
}
|
|
2056
|
+
toggleSelectAll(event) {
|
|
2057
|
+
if (!this.isSelectAll) {
|
|
2058
|
+
this.selectedItems = [];
|
|
2059
|
+
if (this.settings.groupBy) {
|
|
2060
|
+
this.groupedData.forEach((obj) => {
|
|
2061
|
+
obj.selected = !obj.disabled;
|
|
2062
|
+
});
|
|
2063
|
+
this.groupCachedItems.forEach((obj) => {
|
|
2064
|
+
obj.selected = !obj.disabled;
|
|
2065
|
+
});
|
|
2066
|
+
}
|
|
2067
|
+
// this.selectedItems = this.data.slice();
|
|
2068
|
+
this.selectedItems = this.data.filter((individualData) => !individualData.disabled);
|
|
2069
|
+
this.isSelectAll = true;
|
|
2070
|
+
this.onChangeCallback(this.selectedItems);
|
|
2071
|
+
this.onTouchedCallback(this.selectedItems);
|
|
2072
|
+
this.onSelectAll.emit(this.selectedItems);
|
|
2073
|
+
}
|
|
2074
|
+
else {
|
|
2075
|
+
if (this.settings.groupBy) {
|
|
2076
|
+
this.groupedData.forEach((obj) => {
|
|
2077
|
+
obj.selected = false;
|
|
2078
|
+
});
|
|
2079
|
+
this.groupCachedItems.forEach((obj) => {
|
|
2080
|
+
obj.selected = false;
|
|
2081
|
+
});
|
|
2082
|
+
}
|
|
2083
|
+
this.selectedItems = [];
|
|
2084
|
+
this.isSelectAll = false;
|
|
2085
|
+
this.onChangeCallback(this.selectedItems);
|
|
2086
|
+
this.onTouchedCallback(this.selectedItems);
|
|
2087
|
+
this.onDeSelectAll.emit(this.selectedItems);
|
|
2088
|
+
}
|
|
2089
|
+
setTimeout(() => {
|
|
2090
|
+
this.calculateDropdownDirection();
|
|
2091
|
+
});
|
|
2092
|
+
event.stopPropagation();
|
|
2093
|
+
}
|
|
2094
|
+
filterGroupedList() {
|
|
2095
|
+
if (this.filter == '' || this.filter == null) {
|
|
2096
|
+
this.clearSearch();
|
|
2097
|
+
return;
|
|
2098
|
+
}
|
|
2099
|
+
this.groupedData = this.cloneArray(this.groupCachedItems);
|
|
2100
|
+
this.groupedData = this.groupedData.filter((obj) => {
|
|
2101
|
+
let arr = [];
|
|
2102
|
+
if (obj[this.settings.labelKey]
|
|
2103
|
+
.toLowerCase()
|
|
2104
|
+
.indexOf(this.filter.toLowerCase()) > -1) {
|
|
2105
|
+
arr = obj.list;
|
|
2106
|
+
}
|
|
2107
|
+
else {
|
|
2108
|
+
arr = obj.list.filter((t) => {
|
|
2109
|
+
return (t[this.settings.labelKey]
|
|
2110
|
+
.toLowerCase()
|
|
2111
|
+
.indexOf(this.filter.toLowerCase()) > -1);
|
|
2112
|
+
});
|
|
2113
|
+
}
|
|
2114
|
+
obj.list = arr;
|
|
2115
|
+
if (obj[this.settings.labelKey]
|
|
2116
|
+
.toLowerCase()
|
|
2117
|
+
.indexOf(this.filter.toLowerCase()) > -1) {
|
|
2118
|
+
return arr;
|
|
2119
|
+
}
|
|
2120
|
+
else {
|
|
2121
|
+
return arr.some((cat) => {
|
|
2122
|
+
return (cat[this.settings.labelKey]
|
|
2123
|
+
.toLowerCase()
|
|
2124
|
+
.indexOf(this.filter.toLowerCase()) > -1);
|
|
2125
|
+
});
|
|
2126
|
+
}
|
|
2127
|
+
});
|
|
2128
|
+
}
|
|
2129
|
+
toggleFilterSelectAll() {
|
|
2130
|
+
if (!this.isFilterSelectAll) {
|
|
2131
|
+
let added = [];
|
|
2132
|
+
if (this.settings.groupBy) {
|
|
2133
|
+
this.groupedData.forEach((item) => {
|
|
2134
|
+
item.sele;
|
|
2135
|
+
if (item.list) {
|
|
2136
|
+
item.list.forEach((el) => {
|
|
2137
|
+
if (!this.isSelected(el)) {
|
|
2138
|
+
this.addSelected(el);
|
|
2139
|
+
added.push(el);
|
|
2140
|
+
}
|
|
2141
|
+
});
|
|
2142
|
+
}
|
|
2143
|
+
this.updateGroupInfo(item);
|
|
2144
|
+
});
|
|
2145
|
+
this.filteredList.forEach((el) => {
|
|
2146
|
+
if (!this.isSelected(el) && !el.hasOwnProperty('grpTitle')) {
|
|
2147
|
+
this.addSelected(el);
|
|
2148
|
+
added.push(el);
|
|
2149
|
+
}
|
|
2150
|
+
});
|
|
2151
|
+
}
|
|
2152
|
+
else {
|
|
2153
|
+
this.filteredList.forEach((item) => {
|
|
2154
|
+
if (!this.isSelected(item)) {
|
|
2155
|
+
this.addSelected(item);
|
|
2156
|
+
added.push(item);
|
|
2157
|
+
}
|
|
2158
|
+
});
|
|
2159
|
+
}
|
|
2160
|
+
this.isFilterSelectAll = true;
|
|
2161
|
+
this.onFilterSelectAll.emit(added);
|
|
2162
|
+
}
|
|
2163
|
+
else {
|
|
2164
|
+
let removed = [];
|
|
2165
|
+
if (this.settings.groupBy) {
|
|
2166
|
+
this.groupedData.forEach((item) => {
|
|
2167
|
+
if (item.list) {
|
|
2168
|
+
item.list.forEach((el) => {
|
|
2169
|
+
if (this.isSelected(el)) {
|
|
2170
|
+
this.removeSelected(el);
|
|
2171
|
+
removed.push(el);
|
|
2172
|
+
}
|
|
2173
|
+
});
|
|
2174
|
+
}
|
|
2175
|
+
this.updateGroupInfo(item);
|
|
2176
|
+
});
|
|
2177
|
+
this.filteredList.forEach((el) => {
|
|
2178
|
+
if (this.isSelected(el)) {
|
|
2179
|
+
this.removeSelected(el);
|
|
2180
|
+
removed.push(el);
|
|
2181
|
+
}
|
|
2182
|
+
});
|
|
2183
|
+
}
|
|
2184
|
+
else {
|
|
2185
|
+
this.filteredList.forEach((item) => {
|
|
2186
|
+
if (this.isSelected(item)) {
|
|
2187
|
+
this.removeSelected(item);
|
|
2188
|
+
removed.push(item);
|
|
2189
|
+
}
|
|
2190
|
+
});
|
|
2191
|
+
}
|
|
2192
|
+
this.isFilterSelectAll = false;
|
|
2193
|
+
this.onFilterDeSelectAll.emit(removed);
|
|
2194
|
+
}
|
|
2195
|
+
}
|
|
2196
|
+
toggleInfiniteFilterSelectAll() {
|
|
2197
|
+
if (!this.isInfiniteFilterSelectAll) {
|
|
2198
|
+
this.virtualdata.forEach((item) => {
|
|
2199
|
+
if (!this.isSelected(item)) {
|
|
2200
|
+
this.addSelected(item);
|
|
2201
|
+
}
|
|
2202
|
+
});
|
|
2203
|
+
this.isInfiniteFilterSelectAll = true;
|
|
2204
|
+
}
|
|
2205
|
+
else {
|
|
2206
|
+
this.virtualdata.forEach((item) => {
|
|
2207
|
+
if (this.isSelected(item)) {
|
|
2208
|
+
this.removeSelected(item);
|
|
2209
|
+
}
|
|
2210
|
+
});
|
|
2211
|
+
this.isInfiniteFilterSelectAll = false;
|
|
2212
|
+
}
|
|
2213
|
+
}
|
|
2214
|
+
clearSearch() {
|
|
2215
|
+
if (this.settings.groupBy) {
|
|
2216
|
+
this.groupedData = [];
|
|
2217
|
+
this.groupedData = this.cloneArray(this.groupCachedItems);
|
|
2218
|
+
}
|
|
2219
|
+
this.filter = '';
|
|
2220
|
+
this.isFilterSelectAll = false;
|
|
2221
|
+
this.searchTerm$.next('');
|
|
2222
|
+
this.data = this.cachedItems;
|
|
2223
|
+
}
|
|
2224
|
+
onFilterChange(data) {
|
|
2225
|
+
if ((this.filter && this.filter == '') || data.length == 0) {
|
|
2226
|
+
this.isFilterSelectAll = false;
|
|
2227
|
+
this.data = this.cachedItems.slice();
|
|
2228
|
+
}
|
|
2229
|
+
let cnt = 0;
|
|
2230
|
+
data.forEach((item) => {
|
|
2231
|
+
if (!item.hasOwnProperty('grpTitle') && this.isSelected(item)) {
|
|
2232
|
+
cnt++;
|
|
2233
|
+
}
|
|
2234
|
+
});
|
|
2235
|
+
if (cnt > 0 && this.filterLength == cnt) {
|
|
2236
|
+
this.isFilterSelectAll = true;
|
|
2237
|
+
}
|
|
2238
|
+
else if (cnt > 0 && this.filterLength != cnt) {
|
|
2239
|
+
this.isFilterSelectAll = false;
|
|
2240
|
+
}
|
|
2241
|
+
this.data = data;
|
|
2242
|
+
}
|
|
2243
|
+
cloneArray(arr) {
|
|
2244
|
+
let i, copy;
|
|
2245
|
+
if (Array.isArray(arr)) {
|
|
2246
|
+
return JSON.parse(JSON.stringify(arr));
|
|
2247
|
+
}
|
|
2248
|
+
else if (typeof arr === 'object') {
|
|
2249
|
+
throw 'Cannot clone array containing an object!';
|
|
2250
|
+
}
|
|
2251
|
+
else {
|
|
2252
|
+
return arr;
|
|
2253
|
+
}
|
|
2254
|
+
}
|
|
2255
|
+
updateGroupInfo(item) {
|
|
2256
|
+
if (item.disabled) {
|
|
2257
|
+
return;
|
|
2258
|
+
}
|
|
2259
|
+
let key = this.settings.groupBy;
|
|
2260
|
+
this.groupedData.forEach((obj) => {
|
|
2261
|
+
let cnt = 0;
|
|
2262
|
+
if (obj.grpTitle && item[key] == obj[key]) {
|
|
2263
|
+
if (obj.list) {
|
|
2264
|
+
obj.list.forEach((el) => {
|
|
2265
|
+
if (this.isSelected(el)) {
|
|
2266
|
+
cnt++;
|
|
2267
|
+
}
|
|
2268
|
+
});
|
|
2269
|
+
}
|
|
2270
|
+
}
|
|
2271
|
+
if (obj.list && cnt === obj.list.length && item[key] == obj[key]) {
|
|
2272
|
+
obj.selected = true;
|
|
2273
|
+
}
|
|
2274
|
+
else if (obj.list && cnt != obj.list.length && item[key] == obj[key]) {
|
|
2275
|
+
obj.selected = false;
|
|
2276
|
+
}
|
|
2277
|
+
});
|
|
2278
|
+
this.groupCachedItems.forEach((obj) => {
|
|
2279
|
+
let cnt = 0;
|
|
2280
|
+
if (obj.grpTitle && item[key] == obj[key]) {
|
|
2281
|
+
if (obj.list) {
|
|
2282
|
+
obj.list.forEach((el) => {
|
|
2283
|
+
if (this.isSelected(el)) {
|
|
2284
|
+
cnt++;
|
|
2285
|
+
}
|
|
2286
|
+
});
|
|
2287
|
+
}
|
|
2288
|
+
}
|
|
2289
|
+
if (obj.list && cnt === obj.list.length && item[key] == obj[key]) {
|
|
2290
|
+
obj.selected = true;
|
|
2291
|
+
}
|
|
2292
|
+
else if (obj.list && cnt != obj.list.length && item[key] == obj[key]) {
|
|
2293
|
+
obj.selected = false;
|
|
2294
|
+
}
|
|
2295
|
+
});
|
|
2296
|
+
}
|
|
2297
|
+
transformData(arr, field) {
|
|
2298
|
+
const groupedObj = arr.reduce((prev, cur) => {
|
|
2299
|
+
if (!prev[cur[field]]) {
|
|
2300
|
+
prev[cur[field]] = [cur];
|
|
2301
|
+
}
|
|
2302
|
+
else {
|
|
2303
|
+
prev[cur[field]].push(cur);
|
|
2304
|
+
}
|
|
2305
|
+
return prev;
|
|
2306
|
+
}, {});
|
|
2307
|
+
const tempArr = [];
|
|
2308
|
+
Object.keys(groupedObj).map((x) => {
|
|
2309
|
+
let obj = {};
|
|
2310
|
+
let disabledChildrens = [];
|
|
2311
|
+
obj['grpTitle'] = true;
|
|
2312
|
+
obj[this.settings.labelKey] = x;
|
|
2313
|
+
obj[this.settings.groupBy] = x;
|
|
2314
|
+
obj['selected'] = false;
|
|
2315
|
+
obj['list'] = [];
|
|
2316
|
+
let cnt = 0;
|
|
2317
|
+
groupedObj[x].forEach((item) => {
|
|
2318
|
+
item['list'] = [];
|
|
2319
|
+
if (item.disabled) {
|
|
2320
|
+
this.isDisabledItemPresent = true;
|
|
2321
|
+
disabledChildrens.push(item);
|
|
2322
|
+
}
|
|
2323
|
+
obj.list.push(item);
|
|
2324
|
+
if (this.isSelected(item)) {
|
|
2325
|
+
cnt++;
|
|
2326
|
+
}
|
|
2327
|
+
});
|
|
2328
|
+
if (cnt == obj.list.length) {
|
|
2329
|
+
obj.selected = true;
|
|
2330
|
+
}
|
|
2331
|
+
else {
|
|
2332
|
+
obj.selected = false;
|
|
2333
|
+
}
|
|
2334
|
+
// Check if current group item's all childrens are disabled or not
|
|
2335
|
+
obj['disabled'] = disabledChildrens.length === groupedObj[x].length;
|
|
2336
|
+
tempArr.push(obj);
|
|
2337
|
+
// obj.list.forEach((item: any) => {
|
|
2338
|
+
// tempArr.push(item);
|
|
2339
|
+
// });
|
|
2340
|
+
});
|
|
2341
|
+
return tempArr;
|
|
2342
|
+
}
|
|
2343
|
+
filterInfiniteList(evt) {
|
|
2344
|
+
let filteredElems = [];
|
|
2345
|
+
if (this.settings.groupBy) {
|
|
2346
|
+
this.groupedData = this.groupCachedItems.slice();
|
|
2347
|
+
}
|
|
2348
|
+
else {
|
|
2349
|
+
this.data = this.cachedItems.slice();
|
|
2350
|
+
this.virtualdata = this.cachedItems.slice();
|
|
2351
|
+
}
|
|
2352
|
+
if ((evt != null || evt != '') && !this.settings.groupBy) {
|
|
2353
|
+
if (this.settings.searchBy.length > 0) {
|
|
2354
|
+
for (let t = 0; t < this.settings.searchBy.length; t++) {
|
|
2355
|
+
this.virtualdata.filter((el) => {
|
|
2356
|
+
if (el[this.settings.searchBy[t].toString()]
|
|
2357
|
+
.toString()
|
|
2358
|
+
.toLowerCase()
|
|
2359
|
+
.indexOf(evt.toString().toLowerCase()) >= 0) {
|
|
2360
|
+
filteredElems.push(el);
|
|
2361
|
+
}
|
|
2362
|
+
});
|
|
2363
|
+
}
|
|
2364
|
+
}
|
|
2365
|
+
else {
|
|
2366
|
+
this.virtualdata.filter(function (el) {
|
|
2367
|
+
for (let prop in el) {
|
|
2368
|
+
if (el[prop]
|
|
2369
|
+
.toString()
|
|
2370
|
+
.toLowerCase()
|
|
2371
|
+
.indexOf(evt.toString().toLowerCase()) >= 0) {
|
|
2372
|
+
filteredElems.push(el);
|
|
2373
|
+
break;
|
|
2374
|
+
}
|
|
2375
|
+
}
|
|
2376
|
+
});
|
|
2377
|
+
}
|
|
2378
|
+
this.virtualdata = [];
|
|
2379
|
+
this.virtualdata = filteredElems;
|
|
2380
|
+
this.infiniteFilterLength = this.virtualdata.length;
|
|
2381
|
+
}
|
|
2382
|
+
if (evt.toString() != '' && this.settings.groupBy) {
|
|
2383
|
+
this.groupedData.filter(function (el) {
|
|
2384
|
+
if (el.hasOwnProperty('grpTitle')) {
|
|
2385
|
+
filteredElems.push(el);
|
|
2386
|
+
}
|
|
2387
|
+
else {
|
|
2388
|
+
for (let prop in el) {
|
|
2389
|
+
if (el[prop]
|
|
2390
|
+
.toString()
|
|
2391
|
+
.toLowerCase()
|
|
2392
|
+
.indexOf(evt.toString().toLowerCase()) >= 0) {
|
|
2393
|
+
filteredElems.push(el);
|
|
2394
|
+
break;
|
|
2395
|
+
}
|
|
2396
|
+
}
|
|
2397
|
+
}
|
|
2398
|
+
});
|
|
2399
|
+
this.groupedData = [];
|
|
2400
|
+
this.groupedData = filteredElems;
|
|
2401
|
+
this.infiniteFilterLength = this.groupedData.length;
|
|
2402
|
+
}
|
|
2403
|
+
else if (evt.toString() == '' && this.cachedItems.length > 0) {
|
|
2404
|
+
this.virtualdata = [];
|
|
2405
|
+
this.virtualdata = this.cachedItems;
|
|
2406
|
+
this.infiniteFilterLength = 0;
|
|
2407
|
+
}
|
|
2408
|
+
if (this.virtualScroller) {
|
|
2409
|
+
this.virtualScroller.refresh();
|
|
2410
|
+
}
|
|
2411
|
+
}
|
|
2412
|
+
resetInfiniteSearch() {
|
|
2413
|
+
this.filter = '';
|
|
2414
|
+
this.isInfiniteFilterSelectAll = false;
|
|
2415
|
+
this.virtualdata = [];
|
|
2416
|
+
this.virtualdata = this.cachedItems;
|
|
2417
|
+
this.groupedData = this.groupCachedItems;
|
|
2418
|
+
this.searchTerm$.next('');
|
|
2419
|
+
this.infiniteFilterLength = 0;
|
|
2420
|
+
}
|
|
2421
|
+
onScrollEnd(e) {
|
|
2422
|
+
if (e.endIndex === this.data.length - 1 || e.startIndex === 0) {
|
|
2423
|
+
}
|
|
2424
|
+
this.onScrollToEnd.emit(e);
|
|
2425
|
+
}
|
|
2426
|
+
ngOnDestroy() {
|
|
2427
|
+
if (this.subscription) {
|
|
2428
|
+
this.subscription.unsubscribe();
|
|
2429
|
+
}
|
|
2430
|
+
}
|
|
2431
|
+
selectGroup(item) {
|
|
2432
|
+
if (item.disabled) {
|
|
2433
|
+
return;
|
|
2434
|
+
}
|
|
2435
|
+
if (item.selected) {
|
|
2436
|
+
item.selected = false;
|
|
2437
|
+
item.list.forEach((obj) => {
|
|
2438
|
+
this.removeSelected(obj);
|
|
2439
|
+
});
|
|
2440
|
+
this.onGroupDeSelect.emit(item);
|
|
2441
|
+
this.updateGroupInfo(item);
|
|
2442
|
+
}
|
|
2443
|
+
else {
|
|
2444
|
+
item.selected = true;
|
|
2445
|
+
item.list.forEach((obj) => {
|
|
2446
|
+
if (!this.isSelected(obj)) {
|
|
2447
|
+
this.addSelected(obj);
|
|
2448
|
+
}
|
|
2449
|
+
});
|
|
2450
|
+
this.onGroupSelect.emit(item);
|
|
2451
|
+
this.updateGroupInfo(item);
|
|
2452
|
+
}
|
|
2453
|
+
}
|
|
2454
|
+
addFilterNewItem() {
|
|
2455
|
+
this.onAddFilterNewItem.emit(this.filter);
|
|
2456
|
+
this.filterPipe.transform(this.data, this.filter, this.settings.searchBy);
|
|
2457
|
+
}
|
|
2458
|
+
calculateDropdownDirection() {
|
|
2459
|
+
let shouldOpenTowardsTop = this.settings.position == 'top';
|
|
2460
|
+
const elem = this.cuppaDropdown.nativeElement;
|
|
2461
|
+
const dropdownWidth = elem.clientWidth;
|
|
2462
|
+
this.dropDownWidth = dropdownWidth;
|
|
2463
|
+
this.dropDownLeft = this.settings.tagToBody
|
|
2464
|
+
? elem.getBoundingClientRect().x
|
|
2465
|
+
: 'unset';
|
|
2466
|
+
if (this.settings.position == 'top' && !this.settings.autoPosition) {
|
|
2467
|
+
this.openTowardsTop(true);
|
|
2468
|
+
}
|
|
2469
|
+
else if (this.settings.position == 'bottom' &&
|
|
2470
|
+
!this.settings.autoPosition) {
|
|
2471
|
+
this.openTowardsTop(false);
|
|
2472
|
+
}
|
|
2473
|
+
if (this.settings.autoPosition) {
|
|
2474
|
+
const dropdownHeight = this.defaultSettings.maxHeight;
|
|
2475
|
+
const viewportHeight = document.documentElement.clientHeight;
|
|
2476
|
+
const selectedListBounds = this.selectedListElem.nativeElement.getBoundingClientRect();
|
|
2477
|
+
const spaceOnTop = selectedListBounds.top;
|
|
2478
|
+
const spaceOnBottom = viewportHeight - selectedListBounds.top;
|
|
2479
|
+
if (spaceOnBottom < spaceOnTop && dropdownHeight < spaceOnTop) {
|
|
2480
|
+
this.openTowardsTop(true);
|
|
2481
|
+
}
|
|
2482
|
+
else {
|
|
2483
|
+
this.openTowardsTop(false);
|
|
2484
|
+
}
|
|
2485
|
+
// Keep preference if there is not enough space on either the top or bottom
|
|
2486
|
+
/* if (spaceOnTop || spaceOnBottom) {
|
|
2487
|
+
if (shouldOpenTowardsTop) {
|
|
2488
|
+
shouldOpenTowardsTop = spaceOnTop;
|
|
2489
|
+
} else {
|
|
2490
|
+
shouldOpenTowardsTop = !spaceOnBottom;
|
|
2491
|
+
}
|
|
2492
|
+
} */
|
|
2493
|
+
}
|
|
2494
|
+
}
|
|
2495
|
+
openTowardsTop(value) {
|
|
2496
|
+
const elem = this.cuppaDropdown.nativeElement;
|
|
2497
|
+
if (value && this.selectedListElem.nativeElement.clientHeight) {
|
|
2498
|
+
this.dropdownListYOffset =
|
|
2499
|
+
15 - this.selectedListElem.nativeElement.clientHeight;
|
|
2500
|
+
if (this.settings.tagToBody) {
|
|
2501
|
+
this.dropDownTop =
|
|
2502
|
+
elem.getBoundingClientRect().y -
|
|
2503
|
+
this.selectedListElem.nativeElement.clientHeight * 2 -
|
|
2504
|
+
15 -
|
|
2505
|
+
this.defaultSettings.maxHeight +
|
|
2506
|
+
'px';
|
|
2507
|
+
}
|
|
2508
|
+
else {
|
|
2509
|
+
this.dropDownBottom =
|
|
2510
|
+
this.selectedListElem.nativeElement.clientHeight + 15 + 'px';
|
|
2511
|
+
}
|
|
2512
|
+
this.settings.position = 'top';
|
|
2513
|
+
}
|
|
2514
|
+
else {
|
|
2515
|
+
if (this.settings.tagToBody) {
|
|
2516
|
+
this.dropDownTop =
|
|
2517
|
+
elem.getBoundingClientRect().y + elem.clientHeight + 1 + 'px';
|
|
2518
|
+
}
|
|
2519
|
+
else {
|
|
2520
|
+
this.dropDownTop = 'unset';
|
|
2521
|
+
this.dropDownBottom = 'unset';
|
|
2522
|
+
}
|
|
2523
|
+
this.dropdownListYOffset = 0;
|
|
2524
|
+
this.settings.position = 'bottom';
|
|
2525
|
+
}
|
|
2526
|
+
}
|
|
2527
|
+
clearSelection(e) {
|
|
2528
|
+
if (this.settings.groupBy) {
|
|
2529
|
+
this.groupCachedItems.forEach((obj) => {
|
|
2530
|
+
obj.selected = false;
|
|
2531
|
+
});
|
|
2532
|
+
}
|
|
2533
|
+
this.clearSearch();
|
|
2534
|
+
this.selectedItems = [];
|
|
2535
|
+
this.isSelectAll = false;
|
|
2536
|
+
this.onChangeCallback(this.selectedItems);
|
|
2537
|
+
this.onTouchedCallback(this.selectedItems);
|
|
2538
|
+
this.onDeSelectAll.emit(this.selectedItems);
|
|
2539
|
+
}
|
|
2540
|
+
filteritems(evt) {
|
|
2541
|
+
this.filteredList = this.filterPipe.transform(this.cachedItems, evt.target.value, this.settings.searchBy);
|
|
2542
|
+
if (this.filteredList) {
|
|
2543
|
+
let len = 0;
|
|
2544
|
+
this.filteredList.forEach((obj, i) => {
|
|
2545
|
+
if (obj.disabled) {
|
|
2546
|
+
this.isDisabledItemPresent = true;
|
|
2547
|
+
}
|
|
2548
|
+
if (!obj.hasOwnProperty('grpTitle')) {
|
|
2549
|
+
len++;
|
|
2550
|
+
}
|
|
2551
|
+
});
|
|
2552
|
+
this.filterLength = len;
|
|
2553
|
+
}
|
|
2554
|
+
this.onFilterChange(this.filteredList);
|
|
2555
|
+
}
|
|
2556
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: AngularMultiSelect, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: ListFilterPipe }], target: i0.ɵɵFactoryTarget.Component });
|
|
2557
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.14", type: AngularMultiSelect, selector: "angular2-multiselect", inputs: { data: "data", settings: "settings", loading: "loading" }, outputs: { onSelect: "onSelect", onDeSelect: "onDeSelect", onSelectAll: "onSelectAll", onDeSelectAll: "onDeSelectAll", onOpen: "onOpen", onClose: "onClose", onScrollToEnd: "onScrollToEnd", onFilterSelectAll: "onFilterSelectAll", onFilterDeSelectAll: "onFilterDeSelectAll", onAddFilterNewItem: "onAddFilterNewItem", onGroupSelect: "onGroupSelect", onGroupDeSelect: "onGroupDeSelect" }, host: { listeners: { "document:keyup.escape": "onEscapeDown($event)", "window:scroll": "onScroll($event)" }, properties: { "class": "defaultSettings.classes" } }, providers: [DROPDOWN_CONTROL_VALUE_ACCESSOR, DROPDOWN_CONTROL_VALIDATION], queries: [{ propertyName: "itemTempl", first: true, predicate: Item, descendants: true }, { propertyName: "badgeTempl", first: true, predicate: Badge, descendants: true }, { propertyName: "searchTempl", first: true, predicate: Search, descendants: true }], viewQueries: [{ propertyName: "searchInput", first: true, predicate: ["searchInput"], descendants: true }, { propertyName: "selectedListElem", first: true, predicate: ["selectedList"], descendants: true }, { propertyName: "dropdownListElem", first: true, predicate: ["dropdownList"], descendants: true }, { propertyName: "cuppaDropdown", first: true, predicate: ["cuppaDropdown"], descendants: true }, { propertyName: "virtualScroller", first: true, predicate: VirtualScrollerComponent, descendants: true }], usesOnChanges: true, ngImport: i0, template: "<div class=\"cuppa-dropdown\" (clickOutside)=\"closeDropdownOnClickOut()\" [enabled]=\"isActive\" #cuppaDropdown>\n <div class=\"selected-list\" #selectedList>\n <div class=\"c-btn\" (click)=\"toggleDropdown($event)\" [ngClass]=\"{'disabled': settings.disabled}\" [attr.tabindex]=\"0\">\n\n <span *ngIf=\"selectedItems?.length == 0\">{{ settings.text }}</span>\n <span *ngIf=\"settings.singleSelection && !badgeTempl\">\n <span *ngFor=\"let item of selectedItems;trackBy: trackByFn.bind(this);let k = index\">\n {{ item[settings.labelKey] }}\n </span>\n </span>\n <span class=\"c-list\" *ngIf=\"selectedItems?.length > 0 && settings.singleSelection && badgeTempl \">\n <div class=\"c-token\" *ngFor=\"let item of selectedItems;trackBy: trackByFn.bind(this);let k = index\">\n <span *ngIf=\"!badgeTempl\" class=\"c-label\">{{ item[settings.labelKey] }}</span>\n\n <span *ngIf=\"badgeTempl\" class=\"c-label\">\n <c-templateRenderer [data]=\"badgeTempl\" [item]=\"item\"></c-templateRenderer>\n </span>\n <span class=\"c-remove\" (click)=\"onItemClick(item,k,$event);$event.stopPropagation()\">\n <c-icon name=\"remove\"/>\n </span>\n </div>\n </span>\n <div class=\"c-list\" *ngIf=\"selectedItems?.length > 0 && !settings.singleSelection\">\n <div class=\"c-token\" *ngFor=\"let item of selectedItems;trackBy: trackByFn.bind(this);let k = index\"\n [hidden]=\"k > settings.badgeShowLimit-1\">\n\n @if (badgeTempl) {\n <span class=\"c-label\"><c-templateRenderer [data]=\"badgeTempl\" [item]=\"item\"></c-templateRenderer></span>\n } @else {\n <span class=\"c-label\">{{ item[settings.labelKey] }}</span>\n\n }\n\n <span class=\"c-remove\" (click)=\"onItemClick(item,k,$event);$event.stopPropagation()\">\n <c-icon [name]=\"'remove'\"></c-icon>\n </span>\n </div>\n </div>\n <span class=\"countplaceholder\"\n *ngIf=\"selectedItems?.length > settings.badgeShowLimit\">+{{ selectedItems?.length - settings.badgeShowLimit }}</span>\n <span class=\"c-remove clear-all\" *ngIf=\"settings.clearAll && selectedItems?.length > 0 && !settings.disabled\"\n (click)=\"clearSelection($event);$event.stopPropagation()\">\n <c-icon [name]=\"'remove'\"></c-icon>\n </span>\n @if (isActive) {\n <span class=\"c-angle-up\"><c-icon [name]=\"'angle-up'\"></c-icon></span>\n } @else {\n <span class=\"c-angle-down\"><c-icon [name]=\"'angle-down'\"></c-icon></span>\n }\n </div>\n </div>\n <div #dropdownList class=\"dropdown-list animated fadeIn\"\n [ngClass]=\"{'tagToBody': settings.tagToBody}\"\n [style.width.px]=\"dropDownWidth\"\n [style.top]=\"dropDownTop\"\n [style.bottom]=\"dropDownBottom\"\n [style.left.px]=\"dropDownLeft\"\n [hidden]=\"!isActive\">\n <div [ngClass]=\"{'arrow-up': settings.position == 'bottom', 'arrow-down': settings.position == 'top'}\"\n class=\"arrow-2\"></div>\n <div [ngClass]=\"{'arrow-up': settings.position == 'bottom', 'arrow-down': settings.position == 'top'}\"></div>\n <div class=\"list-area\" [ngClass]=\"{'single-select-mode': settings.singleSelection }\">\n <div class=\"pure-checkbox select-all\"\n *ngIf=\"settings.enableCheckAll && !settings.singleSelection && !settings.limitSelection && data?.length > 0 && !isDisabledItemPresent\"\n >\n <input *ngIf=\"settings.showCheckbox\" type=\"checkbox\" [checked]=\"isSelectAll\"\n [disabled]=\"settings.limitSelection == selectedItems?.length\"\n [id]=\"id\" (change)=\"toggleSelectAll($event)\"/>\n <label [for]=\"id\">\n <span [hidden]=\"isSelectAll\">{{ settings.selectAllText }}</span>\n <span [hidden]=\"!isSelectAll\">{{ settings.unSelectAllText }}</span>\n </label>\n </div>\n <img class=\"loading-icon\" *ngIf=\"loading\" src=\"assets/img/loading.gif\"/>\n <div class=\"list-filter\" *ngIf=\"settings.enableSearchFilter\">\n <span class=\"c-search\" id=\"searchIcon\">\n <c-icon [name]=\"'search'\"></c-icon>\n </span>\n <span *ngIf=\"!settings.lazyLoading\" [hidden]=\"filter == undefined || filter?.length == 0\" class=\"c-clear\"\n (click)=\"clearSearch()\">\n <c-icon [name]=\"'clear'\"></c-icon>\n </span>\n <span *ngIf=\"settings.lazyLoading\" [hidden]=\"filter == undefined || filter?.length == 0\" class=\"c-clear\"\n (click)=\"resetInfiniteSearch()\">\n <c-icon [name]=\"'clear'\"></c-icon>\n </span>\n\n <input class=\"c-input\" *ngIf=\"settings.groupBy && !settings.lazyLoading && !searchTempl\" #searchInput\n type=\"text\" [placeholder]=\"settings.searchPlaceholderText\"\n [(ngModel)]=\"filter\" (keyup)=\"filterGroupedList()\" aria-labelledby=\"searchIcon\">\n <input class=\"c-input\" *ngIf=\"!settings.groupBy && !settings.lazyLoading && !searchTempl\" #searchInput\n type=\"text\" [placeholder]=\"settings.searchPlaceholderText\"\n [(ngModel)]=\"filter\" (keyup)=\"filteritems($event)\" aria-labelledby=\"searchIcon\">\n <input class=\"c-input\" *ngIf=\"settings.lazyLoading && !searchTempl\" #searchInput type=\"text\"\n [placeholder]=\"settings.searchPlaceholderText\"\n [(ngModel)]=\"filter\" (keyup)=\"onKeyUp($event)\" aria-labelledby=\"searchIcon\">\n <!-- <input class=\"c-input\" *ngIf=\"!settings.lazyLoading && !searchTempl && settings.groupBy\" #searchInput type=\"text\" [placeholder]=\"settings.searchPlaceholderText\"\n [(ngModel)]=\"filter\" (keyup)=\"filterGroupList($event)\">-->\n <c-templateRenderer *ngIf=\"searchTempl\" [data]=\"searchTempl\" [item]=\"item\"></c-templateRenderer>\n </div>\n <div class=\"filter-select-all\"\n *ngIf=\"!settings.lazyLoading && settings.enableFilterSelectAll && !isDisabledItemPresent\">\n <div class=\"pure-checkbox select-all\"\n *ngIf=\"!settings.groupBy && filter?.length > 0 && filterLength > 0 && !settings.singleSelection\"\n (click)=\"toggleFilterSelectAll()\">\n <input type=\"checkbox\" [checked]=\"isFilterSelectAll\"\n [disabled]=\"settings.limitSelection == selectedItems?.length\" aria-labelledby=\"optionName\"\n aria-label=\"option\"/>\n <label>\n <span [hidden]=\"isFilterSelectAll\">{{ settings.filterSelectAllText }}</span>\n <span [hidden]=\"!isFilterSelectAll\">{{ settings.filterUnSelectAllText }}</span>\n </label>\n </div>\n <div class=\"pure-checkbox select-all\"\n *ngIf=\"settings.groupBy && filter?.length > 0 && groupedData?.length > 0 && !settings.singleSelection\"\n (click)=\"toggleFilterSelectAll()\">\n <input type=\"checkbox\" [checked]=\"isFilterSelectAll && filter?.length > 0\"\n [disabled]=\"settings.limitSelection == selectedItems?.length\"\n aria-labelledby=\"option\"/>\n <label>\n <span [hidden]=\"isFilterSelectAll\">{{ settings.filterSelectAllText }}</span>\n <span [hidden]=\"!isFilterSelectAll\">{{ settings.filterUnSelectAllText }}</span>\n </label>\n </div>\n </div>\n <div class=\"filter-select-all\"\n *ngIf=\"settings.lazyLoading && settings.enableFilterSelectAll && !isDisabledItemPresent && !settings.singleSelection\">\n <div class=\"pure-checkbox select-all\" *ngIf=\"filter?.length > 0 && infiniteFilterLength > 0\"\n (click)=\"toggleInfiniteFilterSelectAll()\">\n <input type=\"checkbox\" [checked]=\"isInfiniteFilterSelectAll\"\n [disabled]=\"settings.limitSelection == selectedItems?.length\"\n aria-labelledby=\"option\"/>\n <label>\n <span [hidden]=\"isInfiniteFilterSelectAll\">{{ settings.filterSelectAllText }}</span>\n <span [hidden]=\"!isInfiniteFilterSelectAll\">{{ settings.filterUnSelectAllText }}</span>\n </label>\n </div>\n </div>\n <div class=\"filter-select-all\" *ngIf=\"filter?.length\">\n <div class=\"btn-container\" *ngIf=\"settings.addNewItemOnFilter\">\n <button class=\"c-btn btn-iceblue\" (click)=\"addFilterNewItem()\">{{ settings.addNewButtonText }}</button>\n </div>\n </div>\n\n <div *ngIf=\"!settings.groupBy && !settings.lazyLoading && itemTempl == undefined\"\n [style.maxHeight]=\"settings.maxHeight+'px'\"\n style=\"overflow: auto;\">\n <ul class=\"lazyContainer\">\n <li *ngFor=\"let item of data; let i = index;\" (click)=\"onItemClick(item,i,$event)\"\n class=\"pure-checkbox\" [ngClass]=\"{'selected-item': isSelected(item) == true }\">\n <input *ngIf=\"settings.showCheckbox\" type=\"checkbox\" [checked]=\"isSelected(item)\"\n [disabled]=\"(settings.limitSelection == selectedItems?.length && !isSelected(item)) || item.disabled\"\n aria-labelledby=\"option\"/>\n <label>{{ item[settings.labelKey] }}</label>\n </li>\n </ul>\n </div>\n <!-- lazy loading -->\n <div *ngIf=\"!settings.groupBy && settings.lazyLoading && itemTempl == undefined\"\n [style.maxHeight]=\"settings.maxHeight+'px'\"\n style=\"overflow: auto;\">\n <ul virtualScroller #scroll [enableUnequalChildrenSizes]=\"randomSize\" [items]=\"virtualdata\"\n (vsStart)=\"onScrollEnd($event)\"\n (vsEnd)=\"onScrollEnd($event)\" [ngStyle]=\"{'height': settings.maxHeight+'px'}\" class=\"lazyContainer\">\n <li *ngFor=\"let item of scroll.viewPortItems; let i = index;\" (click)=\"onItemClick(item,i,$event)\"\n class=\"pure-checkbox\"\n [ngClass]=\"{'selected-item': isSelected(item) == true }\">\n <input *ngIf=\"settings.showCheckbox\" type=\"checkbox\" [checked]=\"isSelected(item)\"\n [disabled]=\"(settings.limitSelection == selectedItems?.length && !isSelected(item)) || item.disabled\"\n />\n <label>{{ item[settings.labelKey] }}</label>\n </li>\n </ul>\n </div>\n <!-- custom template -->\n <div *ngIf=\"!settings.groupBy && !settings.lazyLoading && itemTempl != undefined\"\n [style.maxHeight]=\"settings.maxHeight+'px'\"\n style=\"overflow: auto;\">\n <ul class=\"lazyContainer\">\n <li *ngFor=\"let item of data; let i = index;\" (click)=\"onItemClick(item,i,$event)\"\n class=\"pure-checkbox\" [ngClass]=\"{'selected-item': isSelected(item) == true }\">\n <input *ngIf=\"settings.showCheckbox\" type=\"checkbox\" [checked]=\"isSelected(item)\"\n [disabled]=\"(settings.limitSelection == selectedItems?.length && !isSelected(item)) || item.disabled\"\n />\n <label></label>\n <c-templateRenderer [data]=\"itemTempl\" [item]=\"item\"></c-templateRenderer>\n </li>\n </ul>\n </div>\n <!-- lazy loading and custom template -->\n <div *ngIf=\"!settings.groupBy && settings.lazyLoading && itemTempl != undefined\"\n [style.maxHeight]=\"settings.maxHeight+'px'\"\n style=\"overflow: auto;\">\n <ul virtualScroller #scroll2 [enableUnequalChildrenSizes]=\"randomSize\" [items]=\"virtualdata\"\n (vsStart)=\"onScrollEnd($event)\"\n (vsEnd)=\"onScrollEnd($event)\" class=\"lazyContainer\" [ngStyle]=\"{'height': settings.maxHeight+'px'}\">\n <li *ngFor=\"let item of scroll2.viewPortItems; let i = index;\" (click)=\"onItemClick(item,i,$event)\"\n class=\"pure-checkbox\"\n [ngClass]=\"{'selected-item': isSelected(item) == true }\">\n <input *ngIf=\"settings.showCheckbox\" type=\"checkbox\" [checked]=\"isSelected(item)\"\n [disabled]=\"(settings.limitSelection == selectedItems?.length && !isSelected(item)) || item.disabled\"\n />\n <label></label>\n <c-templateRenderer [data]=\"itemTempl\" [item]=\"item\"></c-templateRenderer>\n </li>\n </ul>\n </div>\n <!-- lazy loading, group By and custom template -->\n <div *ngIf=\"settings.groupBy && settings.lazyLoading && itemTempl != undefined\"\n [style.maxHeight]=\"settings.maxHeight+'px'\"\n style=\"overflow: auto;\">\n <ul virtualScroller #scroll3 [enableUnequalChildrenSizes]=\"randomSize\" [items]=\"virtualdata\"\n (vsStart)=\"onScrollEnd($event)\"\n (vsEnd)=\"onScrollEnd($event)\" [ngStyle]=\"{'height': settings.maxHeight+'px'}\" class=\"lazyContainer\">\n <span *ngFor=\"let item of scroll3.viewPortItems; let i = index;\">\n <li (click)=\"onItemClick(item,i,$event)\" *ngIf=\"!item.grpTitle\"\n [ngClass]=\"{'grp-title': item.grpTitle,'grp-item': !item.grpTitle && !settings.singleSelection}\"\n class=\"pure-checkbox\">\n <input *ngIf=\"settings.showCheckbox && !settings.singleSelection\" type=\"checkbox\"\n [checked]=\"isSelected(item)\"\n [disabled]=\"(settings.limitSelection == selectedItems?.length && !isSelected(item)) || item.disabled\"\n />\n <label></label>\n <c-templateRenderer [data]=\"itemTempl\" [item]=\"item\"></c-templateRenderer>\n </li>\n <li *ngIf=\"item.grpTitle\"\n [ngClass]=\"{'grp-title': item.grpTitle,'grp-item': !item.grpTitle && !settings.singleSelection}\"\n class=\"pure-checkbox\">\n <input *ngIf=\"settings.showCheckbox\" type=\"checkbox\" [checked]=\"isSelected(item)\"\n [disabled]=\"(settings.limitSelection == selectedItems?.length && !isSelected(item)) || item.disabled\"\n />\n <label></label>\n <c-templateRenderer [data]=\"itemTempl\" [item]=\"item\"></c-templateRenderer>\n </li>\n </span>\n </ul>\n </div>\n <!-- group By and custom template -->\n <div *ngIf=\"settings.groupBy && !settings.lazyLoading && itemTempl != undefined\"\n [style.maxHeight]=\"settings.maxHeight+'px'\"\n style=\"overflow: auto;\">\n <ul class=\"lazyContainer\">\n <span *ngFor=\"let item of groupedData; let i = index;\">\n <li (click)=\"selectGroup(item)\"\n [ngClass]=\"{'grp-title': item.grpTitle,'grp-item': !item.grpTitle && !settings.singleSelection}\"\n class=\"pure-checkbox\">\n <input *ngIf=\"settings.showCheckbox && !settings.singleSelection\" type=\"checkbox\"\n [checked]=\"item.selected\"\n [disabled]=\"(settings.limitSelection == selectedItems?.length && !isSelected(item)) || item.disabled\"\n />\n <label>{{ item[settings.labelKey] }}</label>\n <ul class=\"lazyContainer\">\n <span *ngFor=\"let val of item.list ; let j = index;\">\n <li (click)=\"onItemClick(val,j,$event); $event.stopPropagation()\"\n [ngClass]=\"{'grp-title': val.grpTitle,'grp-item': !val.grpTitle && !settings.singleSelection}\"\n class=\"pure-checkbox\">\n <input *ngIf=\"settings.showCheckbox\" type=\"checkbox\" [checked]=\"isSelected(val)\"\n [disabled]=\"(settings.limitSelection == selectedItems?.length && !isSelected(val)) || val.disabled\"\n />\n <label></label>\n <c-templateRenderer [data]=\"itemTempl\" [item]=\"val\"></c-templateRenderer>\n </li>\n </span>\n </ul>\n\n </li>\n </span>\n </ul>\n </div>\n <!-- lazy loading, group By -->\n <div *ngIf=\"settings.groupBy && settings.lazyLoading && itemTempl == undefined\"\n [style.maxHeight]=\"settings.maxHeight+'px'\"\n style=\"overflow: auto;\">\n <virtual-scroller [items]=\"groupedData\" (vsUpdate)=\"viewPortItems = $event\" (vsEnd)=\"onScrollEnd($event)\"\n [ngStyle]=\"{'height': settings.maxHeight+'px'}\">\n <ul virtualScroller #scroll4 [enableUnequalChildrenSizes]=\"randomSize\" [items]=\"virtualdata\"\n (vsStart)=\"onScrollEnd($event)\"\n (vsEnd)=\"onScrollEnd($event)\" [ngStyle]=\"{'height': settings.maxHeight+'px'}\" class=\"lazyContainer\">\n <span *ngFor=\"let item of scroll4.viewPortItems; let i = index;\">\n <li *ngIf=\"item.grpTitle\"\n [ngClass]=\"{'grp-title': item.grpTitle,'grp-item': !item.grpTitle && !settings.singleSelection, 'selected-item': isSelected(item) == true }\"\n class=\"pure-checkbox\">\n <input *ngIf=\"settings.showCheckbox && !item.grpTitle && !settings.singleSelection\"\n type=\"checkbox\" [checked]=\"isSelected(item)\"\n [disabled]=\"(settings.limitSelection == selectedItems?.length && !isSelected(item)) || item.disabled\"\n />\n <label>{{ item[settings.labelKey] }}</label>\n </li>\n <li (click)=\"onItemClick(item,i,$event)\" *ngIf=\"!item.grpTitle\"\n [ngClass]=\"{'grp-title': item.grpTitle,'grp-item': !item.grpTitle && !settings.singleSelection, 'selected-item': isSelected(item) == true }\"\n class=\"pure-checkbox\">\n <input *ngIf=\"settings.showCheckbox && !item.grpTitle\" type=\"checkbox\"\n [checked]=\"isSelected(item)\"\n [disabled]=\"(settings.limitSelection == selectedItems?.length && !isSelected(item)) || item.disabled\"\n />\n <label>{{ item[settings.labelKey] }}</label>\n </li>\n </span>\n </ul>\n </virtual-scroller>\n </div>\n <!-- group By -->\n <div *ngIf=\"settings.groupBy && !settings.lazyLoading && itemTempl == undefined\"\n [style.maxHeight]=\"settings.maxHeight+'px'\"\n style=\"overflow: auto;\">\n <ul class=\"lazyContainer\">\n <span *ngFor=\"let item of groupedData ; let i = index;\">\n <li (click)=\"selectGroup(item)\"\n [ngClass]=\"{'grp-title': item.grpTitle,'grp-item': !item.grpTitle && !settings.singleSelection}\"\n class=\"pure-checkbox\">\n <input *ngIf=\"settings.showCheckbox && !settings.singleSelection\" type=\"checkbox\"\n [checked]=\"item.selected\"\n [disabled]=\"(settings.limitSelection == selectedItems?.length && !isSelected(item)) || item.disabled\"\n />\n <label>{{ item[settings.labelKey] }}</label>\n <ul class=\"lazyContainer\">\n <span *ngFor=\"let val of item.list ; let j = index;\">\n <li (click)=\"onItemClick(val,j,$event); $event.stopPropagation()\"\n [ngClass]=\"{'selected-item': isSelected(val) == true,'grp-title': val.grpTitle,'grp-item': !val.grpTitle && !settings.singleSelection}\"\n class=\"pure-checkbox\">\n <input *ngIf=\"settings.showCheckbox\" type=\"checkbox\" [checked]=\"isSelected(val)\"\n [disabled]=\"(settings.limitSelection == selectedItems?.length && !isSelected(val)) || val.disabled\"\n />\n <label>{{ val[settings.labelKey] }}</label>\n </li>\n </span>\n </ul>\n </li>\n </span>\n </ul>\n </div>\n <h5 class=\"list-message\" *ngIf=\"data?.length == 0\">{{ settings.noDataLabel }}</h5>\n </div>\n </div>\n</div>\n", styles: ["virtual-scroll{display:block;width:100%}.cuppa-dropdown{position:relative}.c-btn{display:inline-block;border-width:1px;line-height:1.25;border-radius:3px;font-size:.85rem;padding:5px 10px;cursor:pointer;align-items:center;min-height:38px}.c-btn.disabled{background:#ccc}.selected-list .c-list{float:left;padding:0;margin:0;width:calc(100% - 20px)}.selected-list .c-list .c-token{list-style:none;padding:4px 22px 4px 8px;border-radius:2px;margin-right:4px;margin-top:2px;float:left;position:relative}.selected-list .c-list .c-token .c-label{display:block;float:left}.selected-list .c-list .c-token .c-remove{position:absolute;right:8px;top:50%;transform:translateY(-50%);width:8px}.selected-list .c-list .c-token .c-remove svg{fill:#fff}.selected-list .fa-angle-down,.selected-list .fa-angle-up{font-size:15pt;position:absolute;right:10px;top:50%;transform:translateY(-50%)}.selected-list .c-angle-down,.selected-list .c-angle-up{width:12px;height:12px;position:absolute;right:10px;top:50%;transform:translateY(-50%);pointer-events:none}.selected-list .c-angle-down svg,.selected-list .c-angle-up svg{fill:#333}.selected-list .countplaceholder{position:absolute;right:45px;top:50%;transform:translateY(-50%)}.selected-list .c-btn{width:100%;padding:5px 10px;cursor:pointer;display:flex;position:relative}.selected-list .c-btn .c-icon{position:absolute;right:5px;top:50%;transform:translateY(-50%)}.dropdown-list.tagToBody{position:fixed}.dropdown-list{position:absolute;padding-top:14px;width:100%;z-index:99999}.dropdown-list ul{padding:0;list-style:none;overflow:auto;margin:0}.dropdown-list ul li{padding:10px;cursor:pointer;text-align:left}.dropdown-list ul li:first-child{padding-top:10px}.dropdown-list ul li:last-child{padding-bottom:10px}.dropdown-list ::-webkit-scrollbar{width:8px}.dropdown-list ::-webkit-scrollbar-thumb{background:#ccc;border-radius:5px}.dropdown-list ::-webkit-scrollbar-track{background:#f2f2f2}.arrow-up,.arrow-down{width:0;height:0;border-left:13px solid transparent;border-right:13px solid transparent;border-bottom:15px solid #fff;margin-left:15px;position:absolute;top:0}.arrow-down{bottom:-14px;top:unset;transform:rotate(180deg)}.arrow-2{border-bottom:15px solid #ccc;top:-1px}.arrow-down.arrow-2{top:unset;bottom:-16px}.list-area{border:1px solid #ccc;border-radius:3px;background:#fff;margin:0}.select-all{padding:10px;border-bottom:1px solid #ccc;text-align:left}.list-filter{border-bottom:1px solid #ccc;position:relative;padding-left:35px;height:35px}.list-filter input{border:0px;width:100%;height:100%;padding:0}.list-filter input:focus{outline:none}.list-filter .c-search{position:absolute;top:4px;left:10px;width:15px;height:15px}.list-filter .c-search svg{fill:#888}.list-filter .c-clear{position:absolute;top:4px;right:10px;width:15px;height:15px}.list-filter .c-clear svg{fill:#888}.pure-checkbox input[type=checkbox]{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.pure-checkbox input[type=checkbox]:focus+label:before,.pure-checkbox input[type=checkbox]:hover+label:before{background-color:none}.pure-checkbox input[type=checkbox]:active+label:before{transition-duration:0s}.pure-checkbox input[type=checkbox]:disabled+label{color:#ccc}.pure-checkbox input[type=checkbox]+label{position:relative;padding-left:2em;vertical-align:middle;-webkit-user-select:none;user-select:none;cursor:pointer;margin:0;font-weight:300}.pure-checkbox input[type=checkbox]+label:before{box-sizing:content-box;content:\"\";position:absolute;top:50%;left:0;width:15px;height:15px;margin-top:-9px;text-align:center;transition:all .4s ease;border-radius:3px}.pure-checkbox input[type=checkbox]+label:after{box-sizing:content-box;content:\"\";position:absolute;top:50%;left:0;width:15px;height:15px;margin-top:-9px;transform:scale(0);transform-origin:50%;transition:transform .2s ease-out}.pure-checkbox input[type=checkbox]:disabled+label:before{border-color:#ccc}.pure-checkbox input[type=checkbox]:disabled:focus+label:before .pure-checkbox input[type=checkbox]:disabled:hover+label:before{background-color:inherit}.pure-checkbox input[type=checkbox]:disabled:checked+label:before{background-color:#ccc}.pure-checkbox input[type=checkbox]+label:after{background-color:transparent;top:50%;left:3px;width:9px;height:4px;margin-top:-5px;border-style:solid;border-width:0 0 2px 2px;border-image:none;transform:rotate(-45deg) scale(0)}.pure-checkbox input[type=checkbox]:checked+label:after{content:\"\";transform:rotate(-45deg) scale(1);transition:transform .2s ease-out}.pure-checkbox input[type=radio]:checked+label:before{background-color:#fff}.pure-checkbox input[type=radio]:checked+label:after{transform:scale(1)}.pure-checkbox input[type=radio]+label:before{border-radius:50%}.pure-checkbox input[type=checkbox]:checked+label:after{transform:rotate(-45deg) scale(1)}.list-message{text-align:center;margin:0;padding:15px 0;font-size:initial}.list-grp{padding:0 15px!important}.list-grp h4{text-transform:capitalize;margin:15px 0 0;font-size:14px;font-weight:700}.list-grp>li{padding-left:15px!important}.grp-item{padding-left:30px!important}.grp-title{padding-bottom:0!important}.grp-title label{margin-bottom:0!important;font-weight:800;text-transform:capitalize}.grp-title:hover{background:none!important}.loading-icon{width:20px;position:absolute;right:10px;top:23px;z-index:1}.nodata-label{width:100%;text-align:center;padding:10px 0 0}.btn-container{text-align:center;padding:5px}.clear-all{width:8px;position:absolute;top:50%;right:30px;transform:translateY(-50%)}\n"], dependencies: [{ kind: "directive", type: i0.forwardRef(() => i2.NgClass), selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i0.forwardRef(() => i2.NgForOf), selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i0.forwardRef(() => i2.NgIf), selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i0.forwardRef(() => i2.NgStyle), selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: i0.forwardRef(() => i3.DefaultValueAccessor), selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i0.forwardRef(() => i3.NgControlStatus), selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i0.forwardRef(() => i3.NgModel), selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i0.forwardRef(() => VirtualScrollerComponent), selector: "virtual-scroller,[virtualScroller]", inputs: ["executeRefreshOutsideAngularZone", "enableUnequalChildrenSizes", "useMarginInsteadOfTranslate", "modifyOverflowStyleOfParentScroll", "stripedTable", "scrollbarWidth", "scrollbarHeight", "childWidth", "childHeight", "ssrChildWidth", "ssrChildHeight", "ssrViewportWidth", "ssrViewportHeight", "bufferAmount", "scrollAnimationTime", "resizeBypassRefreshThreshold", "scrollThrottlingTime", "scrollDebounceTime", "checkResizeInterval", "items", "compareItems", "horizontal", "parentScroll"], outputs: ["vsUpdate", "vsChange", "vsStart", "vsEnd"], exportAs: ["virtualScroller"] }, { kind: "directive", type: i0.forwardRef(() => ClickOutsideDirective), selector: "[clickOutside]", inputs: ["enabled"], outputs: ["clickOutside"] }, { kind: "component", type: i0.forwardRef(() => TemplateRenderer), selector: "c-templateRenderer", inputs: ["data", "item"] }, { kind: "component", type: i0.forwardRef(() => CIcon), selector: "c-icon", inputs: ["name"] }], encapsulation: i0.ViewEncapsulation.None });
|
|
2558
|
+
}
|
|
2559
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: AngularMultiSelect, decorators: [{
|
|
2560
|
+
type: Component,
|
|
2561
|
+
args: [{ selector: 'angular2-multiselect', host: { '[class]': 'defaultSettings.classes' }, providers: [DROPDOWN_CONTROL_VALUE_ACCESSOR, DROPDOWN_CONTROL_VALIDATION], encapsulation: ViewEncapsulation.None, template: "<div class=\"cuppa-dropdown\" (clickOutside)=\"closeDropdownOnClickOut()\" [enabled]=\"isActive\" #cuppaDropdown>\n <div class=\"selected-list\" #selectedList>\n <div class=\"c-btn\" (click)=\"toggleDropdown($event)\" [ngClass]=\"{'disabled': settings.disabled}\" [attr.tabindex]=\"0\">\n\n <span *ngIf=\"selectedItems?.length == 0\">{{ settings.text }}</span>\n <span *ngIf=\"settings.singleSelection && !badgeTempl\">\n <span *ngFor=\"let item of selectedItems;trackBy: trackByFn.bind(this);let k = index\">\n {{ item[settings.labelKey] }}\n </span>\n </span>\n <span class=\"c-list\" *ngIf=\"selectedItems?.length > 0 && settings.singleSelection && badgeTempl \">\n <div class=\"c-token\" *ngFor=\"let item of selectedItems;trackBy: trackByFn.bind(this);let k = index\">\n <span *ngIf=\"!badgeTempl\" class=\"c-label\">{{ item[settings.labelKey] }}</span>\n\n <span *ngIf=\"badgeTempl\" class=\"c-label\">\n <c-templateRenderer [data]=\"badgeTempl\" [item]=\"item\"></c-templateRenderer>\n </span>\n <span class=\"c-remove\" (click)=\"onItemClick(item,k,$event);$event.stopPropagation()\">\n <c-icon name=\"remove\"/>\n </span>\n </div>\n </span>\n <div class=\"c-list\" *ngIf=\"selectedItems?.length > 0 && !settings.singleSelection\">\n <div class=\"c-token\" *ngFor=\"let item of selectedItems;trackBy: trackByFn.bind(this);let k = index\"\n [hidden]=\"k > settings.badgeShowLimit-1\">\n\n @if (badgeTempl) {\n <span class=\"c-label\"><c-templateRenderer [data]=\"badgeTempl\" [item]=\"item\"></c-templateRenderer></span>\n } @else {\n <span class=\"c-label\">{{ item[settings.labelKey] }}</span>\n\n }\n\n <span class=\"c-remove\" (click)=\"onItemClick(item,k,$event);$event.stopPropagation()\">\n <c-icon [name]=\"'remove'\"></c-icon>\n </span>\n </div>\n </div>\n <span class=\"countplaceholder\"\n *ngIf=\"selectedItems?.length > settings.badgeShowLimit\">+{{ selectedItems?.length - settings.badgeShowLimit }}</span>\n <span class=\"c-remove clear-all\" *ngIf=\"settings.clearAll && selectedItems?.length > 0 && !settings.disabled\"\n (click)=\"clearSelection($event);$event.stopPropagation()\">\n <c-icon [name]=\"'remove'\"></c-icon>\n </span>\n @if (isActive) {\n <span class=\"c-angle-up\"><c-icon [name]=\"'angle-up'\"></c-icon></span>\n } @else {\n <span class=\"c-angle-down\"><c-icon [name]=\"'angle-down'\"></c-icon></span>\n }\n </div>\n </div>\n <div #dropdownList class=\"dropdown-list animated fadeIn\"\n [ngClass]=\"{'tagToBody': settings.tagToBody}\"\n [style.width.px]=\"dropDownWidth\"\n [style.top]=\"dropDownTop\"\n [style.bottom]=\"dropDownBottom\"\n [style.left.px]=\"dropDownLeft\"\n [hidden]=\"!isActive\">\n <div [ngClass]=\"{'arrow-up': settings.position == 'bottom', 'arrow-down': settings.position == 'top'}\"\n class=\"arrow-2\"></div>\n <div [ngClass]=\"{'arrow-up': settings.position == 'bottom', 'arrow-down': settings.position == 'top'}\"></div>\n <div class=\"list-area\" [ngClass]=\"{'single-select-mode': settings.singleSelection }\">\n <div class=\"pure-checkbox select-all\"\n *ngIf=\"settings.enableCheckAll && !settings.singleSelection && !settings.limitSelection && data?.length > 0 && !isDisabledItemPresent\"\n >\n <input *ngIf=\"settings.showCheckbox\" type=\"checkbox\" [checked]=\"isSelectAll\"\n [disabled]=\"settings.limitSelection == selectedItems?.length\"\n [id]=\"id\" (change)=\"toggleSelectAll($event)\"/>\n <label [for]=\"id\">\n <span [hidden]=\"isSelectAll\">{{ settings.selectAllText }}</span>\n <span [hidden]=\"!isSelectAll\">{{ settings.unSelectAllText }}</span>\n </label>\n </div>\n <img class=\"loading-icon\" *ngIf=\"loading\" src=\"assets/img/loading.gif\"/>\n <div class=\"list-filter\" *ngIf=\"settings.enableSearchFilter\">\n <span class=\"c-search\" id=\"searchIcon\">\n <c-icon [name]=\"'search'\"></c-icon>\n </span>\n <span *ngIf=\"!settings.lazyLoading\" [hidden]=\"filter == undefined || filter?.length == 0\" class=\"c-clear\"\n (click)=\"clearSearch()\">\n <c-icon [name]=\"'clear'\"></c-icon>\n </span>\n <span *ngIf=\"settings.lazyLoading\" [hidden]=\"filter == undefined || filter?.length == 0\" class=\"c-clear\"\n (click)=\"resetInfiniteSearch()\">\n <c-icon [name]=\"'clear'\"></c-icon>\n </span>\n\n <input class=\"c-input\" *ngIf=\"settings.groupBy && !settings.lazyLoading && !searchTempl\" #searchInput\n type=\"text\" [placeholder]=\"settings.searchPlaceholderText\"\n [(ngModel)]=\"filter\" (keyup)=\"filterGroupedList()\" aria-labelledby=\"searchIcon\">\n <input class=\"c-input\" *ngIf=\"!settings.groupBy && !settings.lazyLoading && !searchTempl\" #searchInput\n type=\"text\" [placeholder]=\"settings.searchPlaceholderText\"\n [(ngModel)]=\"filter\" (keyup)=\"filteritems($event)\" aria-labelledby=\"searchIcon\">\n <input class=\"c-input\" *ngIf=\"settings.lazyLoading && !searchTempl\" #searchInput type=\"text\"\n [placeholder]=\"settings.searchPlaceholderText\"\n [(ngModel)]=\"filter\" (keyup)=\"onKeyUp($event)\" aria-labelledby=\"searchIcon\">\n <!-- <input class=\"c-input\" *ngIf=\"!settings.lazyLoading && !searchTempl && settings.groupBy\" #searchInput type=\"text\" [placeholder]=\"settings.searchPlaceholderText\"\n [(ngModel)]=\"filter\" (keyup)=\"filterGroupList($event)\">-->\n <c-templateRenderer *ngIf=\"searchTempl\" [data]=\"searchTempl\" [item]=\"item\"></c-templateRenderer>\n </div>\n <div class=\"filter-select-all\"\n *ngIf=\"!settings.lazyLoading && settings.enableFilterSelectAll && !isDisabledItemPresent\">\n <div class=\"pure-checkbox select-all\"\n *ngIf=\"!settings.groupBy && filter?.length > 0 && filterLength > 0 && !settings.singleSelection\"\n (click)=\"toggleFilterSelectAll()\">\n <input type=\"checkbox\" [checked]=\"isFilterSelectAll\"\n [disabled]=\"settings.limitSelection == selectedItems?.length\" aria-labelledby=\"optionName\"\n aria-label=\"option\"/>\n <label>\n <span [hidden]=\"isFilterSelectAll\">{{ settings.filterSelectAllText }}</span>\n <span [hidden]=\"!isFilterSelectAll\">{{ settings.filterUnSelectAllText }}</span>\n </label>\n </div>\n <div class=\"pure-checkbox select-all\"\n *ngIf=\"settings.groupBy && filter?.length > 0 && groupedData?.length > 0 && !settings.singleSelection\"\n (click)=\"toggleFilterSelectAll()\">\n <input type=\"checkbox\" [checked]=\"isFilterSelectAll && filter?.length > 0\"\n [disabled]=\"settings.limitSelection == selectedItems?.length\"\n aria-labelledby=\"option\"/>\n <label>\n <span [hidden]=\"isFilterSelectAll\">{{ settings.filterSelectAllText }}</span>\n <span [hidden]=\"!isFilterSelectAll\">{{ settings.filterUnSelectAllText }}</span>\n </label>\n </div>\n </div>\n <div class=\"filter-select-all\"\n *ngIf=\"settings.lazyLoading && settings.enableFilterSelectAll && !isDisabledItemPresent && !settings.singleSelection\">\n <div class=\"pure-checkbox select-all\" *ngIf=\"filter?.length > 0 && infiniteFilterLength > 0\"\n (click)=\"toggleInfiniteFilterSelectAll()\">\n <input type=\"checkbox\" [checked]=\"isInfiniteFilterSelectAll\"\n [disabled]=\"settings.limitSelection == selectedItems?.length\"\n aria-labelledby=\"option\"/>\n <label>\n <span [hidden]=\"isInfiniteFilterSelectAll\">{{ settings.filterSelectAllText }}</span>\n <span [hidden]=\"!isInfiniteFilterSelectAll\">{{ settings.filterUnSelectAllText }}</span>\n </label>\n </div>\n </div>\n <div class=\"filter-select-all\" *ngIf=\"filter?.length\">\n <div class=\"btn-container\" *ngIf=\"settings.addNewItemOnFilter\">\n <button class=\"c-btn btn-iceblue\" (click)=\"addFilterNewItem()\">{{ settings.addNewButtonText }}</button>\n </div>\n </div>\n\n <div *ngIf=\"!settings.groupBy && !settings.lazyLoading && itemTempl == undefined\"\n [style.maxHeight]=\"settings.maxHeight+'px'\"\n style=\"overflow: auto;\">\n <ul class=\"lazyContainer\">\n <li *ngFor=\"let item of data; let i = index;\" (click)=\"onItemClick(item,i,$event)\"\n class=\"pure-checkbox\" [ngClass]=\"{'selected-item': isSelected(item) == true }\">\n <input *ngIf=\"settings.showCheckbox\" type=\"checkbox\" [checked]=\"isSelected(item)\"\n [disabled]=\"(settings.limitSelection == selectedItems?.length && !isSelected(item)) || item.disabled\"\n aria-labelledby=\"option\"/>\n <label>{{ item[settings.labelKey] }}</label>\n </li>\n </ul>\n </div>\n <!-- lazy loading -->\n <div *ngIf=\"!settings.groupBy && settings.lazyLoading && itemTempl == undefined\"\n [style.maxHeight]=\"settings.maxHeight+'px'\"\n style=\"overflow: auto;\">\n <ul virtualScroller #scroll [enableUnequalChildrenSizes]=\"randomSize\" [items]=\"virtualdata\"\n (vsStart)=\"onScrollEnd($event)\"\n (vsEnd)=\"onScrollEnd($event)\" [ngStyle]=\"{'height': settings.maxHeight+'px'}\" class=\"lazyContainer\">\n <li *ngFor=\"let item of scroll.viewPortItems; let i = index;\" (click)=\"onItemClick(item,i,$event)\"\n class=\"pure-checkbox\"\n [ngClass]=\"{'selected-item': isSelected(item) == true }\">\n <input *ngIf=\"settings.showCheckbox\" type=\"checkbox\" [checked]=\"isSelected(item)\"\n [disabled]=\"(settings.limitSelection == selectedItems?.length && !isSelected(item)) || item.disabled\"\n />\n <label>{{ item[settings.labelKey] }}</label>\n </li>\n </ul>\n </div>\n <!-- custom template -->\n <div *ngIf=\"!settings.groupBy && !settings.lazyLoading && itemTempl != undefined\"\n [style.maxHeight]=\"settings.maxHeight+'px'\"\n style=\"overflow: auto;\">\n <ul class=\"lazyContainer\">\n <li *ngFor=\"let item of data; let i = index;\" (click)=\"onItemClick(item,i,$event)\"\n class=\"pure-checkbox\" [ngClass]=\"{'selected-item': isSelected(item) == true }\">\n <input *ngIf=\"settings.showCheckbox\" type=\"checkbox\" [checked]=\"isSelected(item)\"\n [disabled]=\"(settings.limitSelection == selectedItems?.length && !isSelected(item)) || item.disabled\"\n />\n <label></label>\n <c-templateRenderer [data]=\"itemTempl\" [item]=\"item\"></c-templateRenderer>\n </li>\n </ul>\n </div>\n <!-- lazy loading and custom template -->\n <div *ngIf=\"!settings.groupBy && settings.lazyLoading && itemTempl != undefined\"\n [style.maxHeight]=\"settings.maxHeight+'px'\"\n style=\"overflow: auto;\">\n <ul virtualScroller #scroll2 [enableUnequalChildrenSizes]=\"randomSize\" [items]=\"virtualdata\"\n (vsStart)=\"onScrollEnd($event)\"\n (vsEnd)=\"onScrollEnd($event)\" class=\"lazyContainer\" [ngStyle]=\"{'height': settings.maxHeight+'px'}\">\n <li *ngFor=\"let item of scroll2.viewPortItems; let i = index;\" (click)=\"onItemClick(item,i,$event)\"\n class=\"pure-checkbox\"\n [ngClass]=\"{'selected-item': isSelected(item) == true }\">\n <input *ngIf=\"settings.showCheckbox\" type=\"checkbox\" [checked]=\"isSelected(item)\"\n [disabled]=\"(settings.limitSelection == selectedItems?.length && !isSelected(item)) || item.disabled\"\n />\n <label></label>\n <c-templateRenderer [data]=\"itemTempl\" [item]=\"item\"></c-templateRenderer>\n </li>\n </ul>\n </div>\n <!-- lazy loading, group By and custom template -->\n <div *ngIf=\"settings.groupBy && settings.lazyLoading && itemTempl != undefined\"\n [style.maxHeight]=\"settings.maxHeight+'px'\"\n style=\"overflow: auto;\">\n <ul virtualScroller #scroll3 [enableUnequalChildrenSizes]=\"randomSize\" [items]=\"virtualdata\"\n (vsStart)=\"onScrollEnd($event)\"\n (vsEnd)=\"onScrollEnd($event)\" [ngStyle]=\"{'height': settings.maxHeight+'px'}\" class=\"lazyContainer\">\n <span *ngFor=\"let item of scroll3.viewPortItems; let i = index;\">\n <li (click)=\"onItemClick(item,i,$event)\" *ngIf=\"!item.grpTitle\"\n [ngClass]=\"{'grp-title': item.grpTitle,'grp-item': !item.grpTitle && !settings.singleSelection}\"\n class=\"pure-checkbox\">\n <input *ngIf=\"settings.showCheckbox && !settings.singleSelection\" type=\"checkbox\"\n [checked]=\"isSelected(item)\"\n [disabled]=\"(settings.limitSelection == selectedItems?.length && !isSelected(item)) || item.disabled\"\n />\n <label></label>\n <c-templateRenderer [data]=\"itemTempl\" [item]=\"item\"></c-templateRenderer>\n </li>\n <li *ngIf=\"item.grpTitle\"\n [ngClass]=\"{'grp-title': item.grpTitle,'grp-item': !item.grpTitle && !settings.singleSelection}\"\n class=\"pure-checkbox\">\n <input *ngIf=\"settings.showCheckbox\" type=\"checkbox\" [checked]=\"isSelected(item)\"\n [disabled]=\"(settings.limitSelection == selectedItems?.length && !isSelected(item)) || item.disabled\"\n />\n <label></label>\n <c-templateRenderer [data]=\"itemTempl\" [item]=\"item\"></c-templateRenderer>\n </li>\n </span>\n </ul>\n </div>\n <!-- group By and custom template -->\n <div *ngIf=\"settings.groupBy && !settings.lazyLoading && itemTempl != undefined\"\n [style.maxHeight]=\"settings.maxHeight+'px'\"\n style=\"overflow: auto;\">\n <ul class=\"lazyContainer\">\n <span *ngFor=\"let item of groupedData; let i = index;\">\n <li (click)=\"selectGroup(item)\"\n [ngClass]=\"{'grp-title': item.grpTitle,'grp-item': !item.grpTitle && !settings.singleSelection}\"\n class=\"pure-checkbox\">\n <input *ngIf=\"settings.showCheckbox && !settings.singleSelection\" type=\"checkbox\"\n [checked]=\"item.selected\"\n [disabled]=\"(settings.limitSelection == selectedItems?.length && !isSelected(item)) || item.disabled\"\n />\n <label>{{ item[settings.labelKey] }}</label>\n <ul class=\"lazyContainer\">\n <span *ngFor=\"let val of item.list ; let j = index;\">\n <li (click)=\"onItemClick(val,j,$event); $event.stopPropagation()\"\n [ngClass]=\"{'grp-title': val.grpTitle,'grp-item': !val.grpTitle && !settings.singleSelection}\"\n class=\"pure-checkbox\">\n <input *ngIf=\"settings.showCheckbox\" type=\"checkbox\" [checked]=\"isSelected(val)\"\n [disabled]=\"(settings.limitSelection == selectedItems?.length && !isSelected(val)) || val.disabled\"\n />\n <label></label>\n <c-templateRenderer [data]=\"itemTempl\" [item]=\"val\"></c-templateRenderer>\n </li>\n </span>\n </ul>\n\n </li>\n </span>\n </ul>\n </div>\n <!-- lazy loading, group By -->\n <div *ngIf=\"settings.groupBy && settings.lazyLoading && itemTempl == undefined\"\n [style.maxHeight]=\"settings.maxHeight+'px'\"\n style=\"overflow: auto;\">\n <virtual-scroller [items]=\"groupedData\" (vsUpdate)=\"viewPortItems = $event\" (vsEnd)=\"onScrollEnd($event)\"\n [ngStyle]=\"{'height': settings.maxHeight+'px'}\">\n <ul virtualScroller #scroll4 [enableUnequalChildrenSizes]=\"randomSize\" [items]=\"virtualdata\"\n (vsStart)=\"onScrollEnd($event)\"\n (vsEnd)=\"onScrollEnd($event)\" [ngStyle]=\"{'height': settings.maxHeight+'px'}\" class=\"lazyContainer\">\n <span *ngFor=\"let item of scroll4.viewPortItems; let i = index;\">\n <li *ngIf=\"item.grpTitle\"\n [ngClass]=\"{'grp-title': item.grpTitle,'grp-item': !item.grpTitle && !settings.singleSelection, 'selected-item': isSelected(item) == true }\"\n class=\"pure-checkbox\">\n <input *ngIf=\"settings.showCheckbox && !item.grpTitle && !settings.singleSelection\"\n type=\"checkbox\" [checked]=\"isSelected(item)\"\n [disabled]=\"(settings.limitSelection == selectedItems?.length && !isSelected(item)) || item.disabled\"\n />\n <label>{{ item[settings.labelKey] }}</label>\n </li>\n <li (click)=\"onItemClick(item,i,$event)\" *ngIf=\"!item.grpTitle\"\n [ngClass]=\"{'grp-title': item.grpTitle,'grp-item': !item.grpTitle && !settings.singleSelection, 'selected-item': isSelected(item) == true }\"\n class=\"pure-checkbox\">\n <input *ngIf=\"settings.showCheckbox && !item.grpTitle\" type=\"checkbox\"\n [checked]=\"isSelected(item)\"\n [disabled]=\"(settings.limitSelection == selectedItems?.length && !isSelected(item)) || item.disabled\"\n />\n <label>{{ item[settings.labelKey] }}</label>\n </li>\n </span>\n </ul>\n </virtual-scroller>\n </div>\n <!-- group By -->\n <div *ngIf=\"settings.groupBy && !settings.lazyLoading && itemTempl == undefined\"\n [style.maxHeight]=\"settings.maxHeight+'px'\"\n style=\"overflow: auto;\">\n <ul class=\"lazyContainer\">\n <span *ngFor=\"let item of groupedData ; let i = index;\">\n <li (click)=\"selectGroup(item)\"\n [ngClass]=\"{'grp-title': item.grpTitle,'grp-item': !item.grpTitle && !settings.singleSelection}\"\n class=\"pure-checkbox\">\n <input *ngIf=\"settings.showCheckbox && !settings.singleSelection\" type=\"checkbox\"\n [checked]=\"item.selected\"\n [disabled]=\"(settings.limitSelection == selectedItems?.length && !isSelected(item)) || item.disabled\"\n />\n <label>{{ item[settings.labelKey] }}</label>\n <ul class=\"lazyContainer\">\n <span *ngFor=\"let val of item.list ; let j = index;\">\n <li (click)=\"onItemClick(val,j,$event); $event.stopPropagation()\"\n [ngClass]=\"{'selected-item': isSelected(val) == true,'grp-title': val.grpTitle,'grp-item': !val.grpTitle && !settings.singleSelection}\"\n class=\"pure-checkbox\">\n <input *ngIf=\"settings.showCheckbox\" type=\"checkbox\" [checked]=\"isSelected(val)\"\n [disabled]=\"(settings.limitSelection == selectedItems?.length && !isSelected(val)) || val.disabled\"\n />\n <label>{{ val[settings.labelKey] }}</label>\n </li>\n </span>\n </ul>\n </li>\n </span>\n </ul>\n </div>\n <h5 class=\"list-message\" *ngIf=\"data?.length == 0\">{{ settings.noDataLabel }}</h5>\n </div>\n </div>\n</div>\n", styles: ["virtual-scroll{display:block;width:100%}.cuppa-dropdown{position:relative}.c-btn{display:inline-block;border-width:1px;line-height:1.25;border-radius:3px;font-size:.85rem;padding:5px 10px;cursor:pointer;align-items:center;min-height:38px}.c-btn.disabled{background:#ccc}.selected-list .c-list{float:left;padding:0;margin:0;width:calc(100% - 20px)}.selected-list .c-list .c-token{list-style:none;padding:4px 22px 4px 8px;border-radius:2px;margin-right:4px;margin-top:2px;float:left;position:relative}.selected-list .c-list .c-token .c-label{display:block;float:left}.selected-list .c-list .c-token .c-remove{position:absolute;right:8px;top:50%;transform:translateY(-50%);width:8px}.selected-list .c-list .c-token .c-remove svg{fill:#fff}.selected-list .fa-angle-down,.selected-list .fa-angle-up{font-size:15pt;position:absolute;right:10px;top:50%;transform:translateY(-50%)}.selected-list .c-angle-down,.selected-list .c-angle-up{width:12px;height:12px;position:absolute;right:10px;top:50%;transform:translateY(-50%);pointer-events:none}.selected-list .c-angle-down svg,.selected-list .c-angle-up svg{fill:#333}.selected-list .countplaceholder{position:absolute;right:45px;top:50%;transform:translateY(-50%)}.selected-list .c-btn{width:100%;padding:5px 10px;cursor:pointer;display:flex;position:relative}.selected-list .c-btn .c-icon{position:absolute;right:5px;top:50%;transform:translateY(-50%)}.dropdown-list.tagToBody{position:fixed}.dropdown-list{position:absolute;padding-top:14px;width:100%;z-index:99999}.dropdown-list ul{padding:0;list-style:none;overflow:auto;margin:0}.dropdown-list ul li{padding:10px;cursor:pointer;text-align:left}.dropdown-list ul li:first-child{padding-top:10px}.dropdown-list ul li:last-child{padding-bottom:10px}.dropdown-list ::-webkit-scrollbar{width:8px}.dropdown-list ::-webkit-scrollbar-thumb{background:#ccc;border-radius:5px}.dropdown-list ::-webkit-scrollbar-track{background:#f2f2f2}.arrow-up,.arrow-down{width:0;height:0;border-left:13px solid transparent;border-right:13px solid transparent;border-bottom:15px solid #fff;margin-left:15px;position:absolute;top:0}.arrow-down{bottom:-14px;top:unset;transform:rotate(180deg)}.arrow-2{border-bottom:15px solid #ccc;top:-1px}.arrow-down.arrow-2{top:unset;bottom:-16px}.list-area{border:1px solid #ccc;border-radius:3px;background:#fff;margin:0}.select-all{padding:10px;border-bottom:1px solid #ccc;text-align:left}.list-filter{border-bottom:1px solid #ccc;position:relative;padding-left:35px;height:35px}.list-filter input{border:0px;width:100%;height:100%;padding:0}.list-filter input:focus{outline:none}.list-filter .c-search{position:absolute;top:4px;left:10px;width:15px;height:15px}.list-filter .c-search svg{fill:#888}.list-filter .c-clear{position:absolute;top:4px;right:10px;width:15px;height:15px}.list-filter .c-clear svg{fill:#888}.pure-checkbox input[type=checkbox]{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.pure-checkbox input[type=checkbox]:focus+label:before,.pure-checkbox input[type=checkbox]:hover+label:before{background-color:none}.pure-checkbox input[type=checkbox]:active+label:before{transition-duration:0s}.pure-checkbox input[type=checkbox]:disabled+label{color:#ccc}.pure-checkbox input[type=checkbox]+label{position:relative;padding-left:2em;vertical-align:middle;-webkit-user-select:none;user-select:none;cursor:pointer;margin:0;font-weight:300}.pure-checkbox input[type=checkbox]+label:before{box-sizing:content-box;content:\"\";position:absolute;top:50%;left:0;width:15px;height:15px;margin-top:-9px;text-align:center;transition:all .4s ease;border-radius:3px}.pure-checkbox input[type=checkbox]+label:after{box-sizing:content-box;content:\"\";position:absolute;top:50%;left:0;width:15px;height:15px;margin-top:-9px;transform:scale(0);transform-origin:50%;transition:transform .2s ease-out}.pure-checkbox input[type=checkbox]:disabled+label:before{border-color:#ccc}.pure-checkbox input[type=checkbox]:disabled:focus+label:before .pure-checkbox input[type=checkbox]:disabled:hover+label:before{background-color:inherit}.pure-checkbox input[type=checkbox]:disabled:checked+label:before{background-color:#ccc}.pure-checkbox input[type=checkbox]+label:after{background-color:transparent;top:50%;left:3px;width:9px;height:4px;margin-top:-5px;border-style:solid;border-width:0 0 2px 2px;border-image:none;transform:rotate(-45deg) scale(0)}.pure-checkbox input[type=checkbox]:checked+label:after{content:\"\";transform:rotate(-45deg) scale(1);transition:transform .2s ease-out}.pure-checkbox input[type=radio]:checked+label:before{background-color:#fff}.pure-checkbox input[type=radio]:checked+label:after{transform:scale(1)}.pure-checkbox input[type=radio]+label:before{border-radius:50%}.pure-checkbox input[type=checkbox]:checked+label:after{transform:rotate(-45deg) scale(1)}.list-message{text-align:center;margin:0;padding:15px 0;font-size:initial}.list-grp{padding:0 15px!important}.list-grp h4{text-transform:capitalize;margin:15px 0 0;font-size:14px;font-weight:700}.list-grp>li{padding-left:15px!important}.grp-item{padding-left:30px!important}.grp-title{padding-bottom:0!important}.grp-title label{margin-bottom:0!important;font-weight:800;text-transform:capitalize}.grp-title:hover{background:none!important}.loading-icon{width:20px;position:absolute;right:10px;top:23px;z-index:1}.nodata-label{width:100%;text-align:center;padding:10px 0 0}.btn-container{text-align:center;padding:5px}.clear-all{width:8px;position:absolute;top:50%;right:30px;transform:translateY(-50%)}\n"] }]
|
|
2562
|
+
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: ListFilterPipe }], propDecorators: { data: [{
|
|
2563
|
+
type: Input
|
|
2564
|
+
}], settings: [{
|
|
2565
|
+
type: Input
|
|
2566
|
+
}], loading: [{
|
|
2567
|
+
type: Input
|
|
2568
|
+
}], onSelect: [{
|
|
2569
|
+
type: Output,
|
|
2570
|
+
args: ['onSelect']
|
|
2571
|
+
}], onDeSelect: [{
|
|
2572
|
+
type: Output,
|
|
2573
|
+
args: ['onDeSelect']
|
|
2574
|
+
}], onSelectAll: [{
|
|
2575
|
+
type: Output,
|
|
2576
|
+
args: ['onSelectAll']
|
|
2577
|
+
}], onDeSelectAll: [{
|
|
2578
|
+
type: Output,
|
|
2579
|
+
args: ['onDeSelectAll']
|
|
2580
|
+
}], onOpen: [{
|
|
2581
|
+
type: Output,
|
|
2582
|
+
args: ['onOpen']
|
|
2583
|
+
}], onClose: [{
|
|
2584
|
+
type: Output,
|
|
2585
|
+
args: ['onClose']
|
|
2586
|
+
}], onScrollToEnd: [{
|
|
2587
|
+
type: Output,
|
|
2588
|
+
args: ['onScrollToEnd']
|
|
2589
|
+
}], onFilterSelectAll: [{
|
|
2590
|
+
type: Output,
|
|
2591
|
+
args: ['onFilterSelectAll']
|
|
2592
|
+
}], onFilterDeSelectAll: [{
|
|
2593
|
+
type: Output,
|
|
2594
|
+
args: ['onFilterDeSelectAll']
|
|
2595
|
+
}], onAddFilterNewItem: [{
|
|
2596
|
+
type: Output,
|
|
2597
|
+
args: ['onAddFilterNewItem']
|
|
2598
|
+
}], onGroupSelect: [{
|
|
2599
|
+
type: Output,
|
|
2600
|
+
args: ['onGroupSelect']
|
|
2601
|
+
}], onGroupDeSelect: [{
|
|
2602
|
+
type: Output,
|
|
2603
|
+
args: ['onGroupDeSelect']
|
|
2604
|
+
}], itemTempl: [{
|
|
2605
|
+
type: ContentChild,
|
|
2606
|
+
args: [Item, { static: false }]
|
|
2607
|
+
}], badgeTempl: [{
|
|
2608
|
+
type: ContentChild,
|
|
2609
|
+
args: [Badge, { static: false }]
|
|
2610
|
+
}], searchTempl: [{
|
|
2611
|
+
type: ContentChild,
|
|
2612
|
+
args: [Search, { static: false }]
|
|
2613
|
+
}], searchInput: [{
|
|
2614
|
+
type: ViewChild,
|
|
2615
|
+
args: ['searchInput', { static: false }]
|
|
2616
|
+
}], selectedListElem: [{
|
|
2617
|
+
type: ViewChild,
|
|
2618
|
+
args: ['selectedList', { static: false }]
|
|
2619
|
+
}], dropdownListElem: [{
|
|
2620
|
+
type: ViewChild,
|
|
2621
|
+
args: ['dropdownList', { static: false }]
|
|
2622
|
+
}], cuppaDropdown: [{
|
|
2623
|
+
type: ViewChild,
|
|
2624
|
+
args: ['cuppaDropdown', { static: false }]
|
|
2625
|
+
}], onEscapeDown: [{
|
|
2626
|
+
type: HostListener,
|
|
2627
|
+
args: ['document:keyup.escape', ['$event']]
|
|
2628
|
+
}], onScroll: [{
|
|
2629
|
+
type: HostListener,
|
|
2630
|
+
args: ['window:scroll', ['$event']]
|
|
2631
|
+
}], virtualScroller: [{
|
|
2632
|
+
type: ViewChild,
|
|
2633
|
+
args: [VirtualScrollerComponent, { static: false }]
|
|
2634
|
+
}] } });
|
|
2635
|
+
class AngularMultiSelectModule {
|
|
2636
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: AngularMultiSelectModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
2637
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.14", ngImport: i0, type: AngularMultiSelectModule, declarations: [AngularMultiSelect, ClickOutsideDirective,
|
|
2638
|
+
ScrollDirective,
|
|
2639
|
+
ListFilterPipe,
|
|
2640
|
+
Item,
|
|
2641
|
+
TemplateRenderer,
|
|
2642
|
+
Badge,
|
|
2643
|
+
Search,
|
|
2644
|
+
CIcon], imports: [CommonModule, FormsModule, VirtualScrollerModule], exports: [AngularMultiSelect, ClickOutsideDirective,
|
|
2645
|
+
ScrollDirective,
|
|
2646
|
+
ListFilterPipe,
|
|
2647
|
+
Item,
|
|
2648
|
+
TemplateRenderer,
|
|
2649
|
+
Badge,
|
|
2650
|
+
Search,
|
|
2651
|
+
CIcon] });
|
|
2652
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: AngularMultiSelectModule, providers: [DataService, ListFilterPipe], imports: [CommonModule, FormsModule, VirtualScrollerModule] });
|
|
2653
|
+
}
|
|
2654
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: AngularMultiSelectModule, decorators: [{
|
|
2655
|
+
type: NgModule,
|
|
2656
|
+
args: [{
|
|
2657
|
+
imports: [CommonModule, FormsModule, VirtualScrollerModule],
|
|
2658
|
+
declarations: [
|
|
2659
|
+
AngularMultiSelect,
|
|
2660
|
+
ClickOutsideDirective,
|
|
2661
|
+
ScrollDirective,
|
|
2662
|
+
ListFilterPipe,
|
|
2663
|
+
Item,
|
|
2664
|
+
TemplateRenderer,
|
|
2665
|
+
Badge,
|
|
2666
|
+
Search,
|
|
2667
|
+
CIcon,
|
|
2668
|
+
],
|
|
2669
|
+
exports: [
|
|
2670
|
+
AngularMultiSelect,
|
|
2671
|
+
ClickOutsideDirective,
|
|
2672
|
+
ScrollDirective,
|
|
2673
|
+
ListFilterPipe,
|
|
2674
|
+
Item,
|
|
2675
|
+
TemplateRenderer,
|
|
2676
|
+
Badge,
|
|
2677
|
+
Search,
|
|
2678
|
+
CIcon,
|
|
2679
|
+
],
|
|
2680
|
+
providers: [DataService, ListFilterPipe],
|
|
2681
|
+
}]
|
|
2682
|
+
}] });
|
|
2683
|
+
|
|
2684
|
+
/**
|
|
2685
|
+
* Generated bundle index. Do not edit.
|
|
2686
|
+
*/
|
|
2687
|
+
|
|
2688
|
+
export { AngularMultiSelect, AngularMultiSelectModule, Badge, CIcon, ClickOutsideDirective, Item, ListFilterPipe, ScrollDirective, Search, TemplateRenderer };
|
|
2689
|
+
//# sourceMappingURL=angular-multiselect.mjs.map
|