@stackline/angular-multiselect-dropdown 2.0.5 → 2.0.6

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