ng-virtual-list 16.7.0 → 16.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -16
- package/esm2022/lib/components/ng-virtual-list-item.component.mjs +28 -8
- package/esm2022/lib/const/index.mjs +2 -1
- package/esm2022/lib/models/index.mjs +1 -1
- package/esm2022/lib/models/item-config-map.model.mjs +2 -0
- package/esm2022/lib/models/render-item-config.model.mjs +1 -1
- package/esm2022/lib/ng-virtual-list.component.mjs +63 -26
- package/esm2022/lib/ng-virtual-list.service.mjs +46 -9
- package/esm2022/lib/utils/trackBox.mjs +22 -19
- package/fesm2022/ng-virtual-list.mjs +154 -56
- package/fesm2022/ng-virtual-list.mjs.map +1 -1
- package/lib/components/ng-virtual-list-item.component.d.ts +25 -5
- package/lib/const/index.d.ts +1 -0
- package/lib/models/index.d.ts +2 -2
- package/lib/models/item-config-map.model.d.ts +23 -0
- package/lib/models/render-item-config.model.d.ts +5 -1
- package/lib/ng-virtual-list.component.d.ts +25 -8
- package/lib/ng-virtual-list.service.d.ts +7 -0
- package/lib/utils/trackBox.d.ts +4 -4
- package/package.json +1 -1
- package/esm2020/lib/components/ng-virtual-list-item.component.mjs +0 -198
- package/esm2020/lib/const/index.mjs +0 -51
- package/esm2020/lib/enums/direction.mjs +0 -2
- package/esm2020/lib/enums/directions.mjs +0 -18
- package/esm2020/lib/enums/index.mjs +0 -5
- package/esm2020/lib/enums/method-for-selecting-types.mjs +0 -22
- package/esm2020/lib/enums/method-for-selecting.mjs +0 -2
- package/esm2020/lib/enums/methods-for-selecting.mjs +0 -22
- package/esm2020/lib/enums/snapping-method.mjs +0 -2
- package/esm2020/lib/enums/snapping-methods.mjs +0 -18
- package/esm2020/lib/models/base-virtual-list-item-component.mjs +0 -9
- package/esm2020/lib/models/collection.model.mjs +0 -3
- package/esm2020/lib/models/component.model.mjs +0 -2
- package/esm2020/lib/models/index.mjs +0 -2
- package/esm2020/lib/models/item.model.mjs +0 -2
- package/esm2020/lib/models/render-collection.model.mjs +0 -3
- package/esm2020/lib/models/render-item-config.model.mjs +0 -2
- package/esm2020/lib/models/render-item.model.mjs +0 -3
- package/esm2020/lib/models/scroll-direction.model.mjs +0 -2
- package/esm2020/lib/models/scroll-event.model.mjs +0 -2
- package/esm2020/lib/models/sticky-map.model.mjs +0 -2
- package/esm2020/lib/ng-virtual-list.component.mjs +0 -800
- package/esm2020/lib/ng-virtual-list.module.mjs +0 -20
- package/esm2020/lib/ng-virtual-list.service.mjs +0 -94
- package/esm2020/lib/types/id.mjs +0 -2
- package/esm2020/lib/types/index.mjs +0 -2
- package/esm2020/lib/types/rect.mjs +0 -2
- package/esm2020/lib/types/size.mjs +0 -2
- package/esm2020/lib/utils/browser.mjs +0 -3
- package/esm2020/lib/utils/buffer-interpolation.mjs +0 -27
- package/esm2020/lib/utils/cacheMap.mjs +0 -167
- package/esm2020/lib/utils/debounce.mjs +0 -31
- package/esm2020/lib/utils/disposableComponent.mjs +0 -29
- package/esm2020/lib/utils/eventEmitter.mjs +0 -106
- package/esm2020/lib/utils/index.mjs +0 -5
- package/esm2020/lib/utils/isDirection.mjs +0 -15
- package/esm2020/lib/utils/isMethodForSelecting.mjs +0 -18
- package/esm2020/lib/utils/scrollEvent.mjs +0 -42
- package/esm2020/lib/utils/snapping-method.mjs +0 -9
- package/esm2020/lib/utils/toggleClassName.mjs +0 -15
- package/esm2020/lib/utils/trackBox.mjs +0 -762
- package/esm2020/lib/utils/tracker.mjs +0 -143
- package/esm2020/ng-virtual-list.mjs +0 -5
- package/esm2020/public-api.mjs +0 -10
- package/esm2022/lib/models/sticky-map.model.mjs +0 -2
- package/fesm2015/ng-virtual-list.mjs +0 -2582
- package/fesm2015/ng-virtual-list.mjs.map +0 -1
- package/fesm2020/ng-virtual-list.mjs +0 -2586
- package/fesm2020/ng-virtual-list.mjs.map +0 -1
- package/lib/models/sticky-map.model.d.ts +0 -14
- package/lib/utils/disposableComponent.d.ts +0 -15
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { Injectable, Component, ChangeDetectionStrategy, EventEmitter as EventEmitter$1, ViewContainerRef, ElementRef, ViewEncapsulation, ViewChild, Output, Input, NgModule, NO_ERRORS_SCHEMA } from '@angular/core';
|
|
3
|
-
import { map, tap as tap$1 } from 'rxjs/operators';
|
|
3
|
+
import { takeUntil, map, tap as tap$1 } from 'rxjs/operators';
|
|
4
4
|
import { Subject, tap, BehaviorSubject as BehaviorSubject$1, combineLatest, filter, map as map$1, debounceTime, distinctUntilChanged, switchMap, of } from 'rxjs';
|
|
5
|
-
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
6
5
|
import { BehaviorSubject } from 'rxjs/internal/BehaviorSubject';
|
|
6
|
+
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
7
7
|
import * as i2 from '@angular/common';
|
|
8
8
|
import { CommonModule } from '@angular/common';
|
|
9
9
|
|
|
@@ -70,6 +70,7 @@ const DEFAULT_BUFFER_SIZE = 2;
|
|
|
70
70
|
const DEFAULT_MAX_BUFFER_SIZE = 100;
|
|
71
71
|
const DEFAULT_LIST_SIZE = 400;
|
|
72
72
|
const DEFAULT_SNAP = false;
|
|
73
|
+
const DEFAULT_SELECT_BY_CLICK = true;
|
|
73
74
|
const DEFAULT_ENABLED_BUFFER_OPTIMIZATION = false;
|
|
74
75
|
const DEFAULT_DYNAMIC_SIZE = false;
|
|
75
76
|
const TRACK_BY_PROPERTY_NAME = 'id';
|
|
@@ -156,6 +157,7 @@ class NgVirtualListService {
|
|
|
156
157
|
set methodOfSelecting(v) {
|
|
157
158
|
this._$methodOfSelecting.next(v);
|
|
158
159
|
}
|
|
160
|
+
selectByClick = DEFAULT_SELECT_BY_CLICK;
|
|
159
161
|
_trackBox;
|
|
160
162
|
constructor() {
|
|
161
163
|
this._$methodOfSelecting.pipe(takeUntilDestroyed(), tap(v => {
|
|
@@ -182,25 +184,60 @@ class NgVirtualListService {
|
|
|
182
184
|
})).subscribe();
|
|
183
185
|
}
|
|
184
186
|
setSelectedIds(ids) {
|
|
185
|
-
this._$selectedIds.
|
|
187
|
+
if (JSON.stringify(this._$selectedIds.getValue()) !== JSON.stringify(ids)) {
|
|
188
|
+
this._$selectedIds.next(ids);
|
|
189
|
+
}
|
|
186
190
|
}
|
|
187
191
|
itemClick(data) {
|
|
188
|
-
this.
|
|
189
|
-
|
|
192
|
+
if (this.selectByClick) {
|
|
193
|
+
this.select(data);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Selects a list item
|
|
198
|
+
* @param data
|
|
199
|
+
* @param selected - If the value is undefined, then the toggle method is executed, if false or true, then the selection/deselection is performed.
|
|
200
|
+
*/
|
|
201
|
+
select(data, selected = undefined) {
|
|
202
|
+
if (data && data.config.selectable) {
|
|
190
203
|
switch (this._$methodOfSelecting.getValue()) {
|
|
191
204
|
case MethodsForSelectingTypes.SELECT: {
|
|
192
205
|
const curr = this._$selectedIds.getValue();
|
|
193
|
-
|
|
206
|
+
if (selected === undefined) {
|
|
207
|
+
this._$selectedIds.next(curr !== data?.id ? data?.id : undefined);
|
|
208
|
+
}
|
|
209
|
+
else {
|
|
210
|
+
this._$selectedIds.next(selected ? data?.id : undefined);
|
|
211
|
+
}
|
|
194
212
|
break;
|
|
195
213
|
}
|
|
196
214
|
case MethodsForSelectingTypes.MULTI_SELECT: {
|
|
197
215
|
const curr = [...(this._$selectedIds.getValue() || [])], index = curr.indexOf(data.id);
|
|
198
|
-
if (
|
|
199
|
-
|
|
200
|
-
|
|
216
|
+
if (selected === undefined) {
|
|
217
|
+
if (index > -1) {
|
|
218
|
+
curr.splice(index, 1);
|
|
219
|
+
this._$selectedIds.next(curr);
|
|
220
|
+
}
|
|
221
|
+
else {
|
|
222
|
+
this._$selectedIds.next([...curr, data.id]);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
else if (selected) {
|
|
226
|
+
if (index > -1) {
|
|
227
|
+
this._$selectedIds.next(curr);
|
|
228
|
+
}
|
|
229
|
+
else {
|
|
230
|
+
this._$selectedIds.next([...curr, data.id]);
|
|
231
|
+
}
|
|
201
232
|
}
|
|
202
233
|
else {
|
|
203
|
-
|
|
234
|
+
if (index > -1) {
|
|
235
|
+
curr.splice(index, 1);
|
|
236
|
+
this._$selectedIds.next(curr);
|
|
237
|
+
}
|
|
238
|
+
else {
|
|
239
|
+
this._$selectedIds.next(curr);
|
|
240
|
+
}
|
|
204
241
|
}
|
|
205
242
|
break;
|
|
206
243
|
}
|
|
@@ -239,6 +276,7 @@ class NgVirtualListItemComponent extends BaseVirtualListItemComponent {
|
|
|
239
276
|
_cdr;
|
|
240
277
|
_elementRef;
|
|
241
278
|
_service;
|
|
279
|
+
_$unsubscribe = new Subject();
|
|
242
280
|
_id;
|
|
243
281
|
get id() {
|
|
244
282
|
return this._id;
|
|
@@ -247,6 +285,7 @@ class NgVirtualListItemComponent extends BaseVirtualListItemComponent {
|
|
|
247
285
|
get part() { return this._part; }
|
|
248
286
|
_isSelected = false;
|
|
249
287
|
config = new BehaviorSubject$1({});
|
|
288
|
+
measures = new BehaviorSubject$1(undefined);
|
|
250
289
|
regular = false;
|
|
251
290
|
data;
|
|
252
291
|
_$data = new BehaviorSubject$1(this.data);
|
|
@@ -258,6 +297,7 @@ class NgVirtualListItemComponent extends BaseVirtualListItemComponent {
|
|
|
258
297
|
this.data = v;
|
|
259
298
|
this.updatePartStr(v, this._isSelected);
|
|
260
299
|
this.updateConfig(v);
|
|
300
|
+
this.updateMeasures(v);
|
|
261
301
|
this.update();
|
|
262
302
|
this._$data.next(v);
|
|
263
303
|
this._cdr.detectChanges();
|
|
@@ -288,6 +328,14 @@ class NgVirtualListItemComponent extends BaseVirtualListItemComponent {
|
|
|
288
328
|
get element() {
|
|
289
329
|
return this._elementRef.nativeElement;
|
|
290
330
|
}
|
|
331
|
+
_selectHandler = (data) =>
|
|
332
|
+
/**
|
|
333
|
+
* Selects a list item
|
|
334
|
+
* @param selected - If the value is undefined, then the toggle method is executed, if false or true, then the selection/deselection is performed.
|
|
335
|
+
*/
|
|
336
|
+
(selected = undefined) => {
|
|
337
|
+
this._service.select(data, selected);
|
|
338
|
+
};
|
|
291
339
|
constructor(_cdr, _elementRef, _service) {
|
|
292
340
|
super();
|
|
293
341
|
this._cdr = _cdr;
|
|
@@ -295,7 +343,7 @@ class NgVirtualListItemComponent extends BaseVirtualListItemComponent {
|
|
|
295
343
|
this._service = _service;
|
|
296
344
|
this._id = this._service.generateComponentId();
|
|
297
345
|
const $data = this.$data;
|
|
298
|
-
combineLatest([$data, this._service.$methodOfSelecting, this._service.$selectedIds]).pipe(
|
|
346
|
+
combineLatest([$data, this._service.$methodOfSelecting, this._service.$selectedIds]).pipe(takeUntil(this._$unsubscribe), map(([, m, ids]) => ({ method: m, ids })), tap$1(({ method, ids }) => {
|
|
299
347
|
switch (method) {
|
|
300
348
|
case MethodsForSelectingTypes.SELECT: {
|
|
301
349
|
const id = ids, isSelected = id === this.itemId;
|
|
@@ -318,10 +366,14 @@ class NgVirtualListItemComponent extends BaseVirtualListItemComponent {
|
|
|
318
366
|
}
|
|
319
367
|
this.updatePartStr(this.data, this._isSelected);
|
|
320
368
|
this.updateConfig(this.data);
|
|
369
|
+
this.updateMeasures(this.data);
|
|
321
370
|
})).subscribe();
|
|
322
371
|
}
|
|
372
|
+
updateMeasures(v) {
|
|
373
|
+
this.measures.next(v?.measures ? { ...v.measures } : undefined);
|
|
374
|
+
}
|
|
323
375
|
updateConfig(v) {
|
|
324
|
-
this.config.next({ ...v?.config || {}, selected: this._isSelected });
|
|
376
|
+
this.config.next({ ...v?.config || {}, selected: this._isSelected, select: this._selectHandler(v) });
|
|
325
377
|
}
|
|
326
378
|
update() {
|
|
327
379
|
const data = this.data, regular = this.regular, length = this._regularLength;
|
|
@@ -405,15 +457,21 @@ class NgVirtualListItemComponent extends BaseVirtualListItemComponent {
|
|
|
405
457
|
onClickHandler() {
|
|
406
458
|
this._service.itemClick(this.data);
|
|
407
459
|
}
|
|
460
|
+
ngOnDestroy() {
|
|
461
|
+
if (this._$unsubscribe) {
|
|
462
|
+
this._$unsubscribe.next();
|
|
463
|
+
this._$unsubscribe.complete();
|
|
464
|
+
}
|
|
465
|
+
}
|
|
408
466
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: NgVirtualListItemComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i0.ElementRef }, { token: NgVirtualListService }], target: i0.ɵɵFactoryTarget.Component });
|
|
409
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: NgVirtualListItemComponent, selector: "ng-virtual-list-item", host: { attributes: { "role": "listitem" }, classAttribute: "ngvl__item" }, usesInheritance: true, ngImport: i0, template: "<ng-container *ngIf=\"data\">\r\n <div #listItem [part]=\"part\" class=\"ngvl-item__container\" [ngClass]=\"{'snapped': data.config.snapped,\r\n 'snapped-out': data.config.snappedOut}\" (click)=\"onClickHandler()\">\r\n <ng-container *ngIf=\"itemRenderer\">\r\n <ng-container [ngTemplateOutlet]=\"itemRenderer\"\r\n [ngTemplateOutletContext]=\"{data: data.data || {}, config: config | async}\"></ng-container>\r\n </ng-container>\r\n </div>\r\n</ng-container>", styles: [":host{display:block;position:absolute;left:0;top:0;box-sizing:border-box;overflow:hidden}.ngvl-item__container{margin:0;padding:0;overflow:hidden;background-color:#fff;width:inherit;height:inherit}\n"], dependencies: [{ kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "pipe", type: i2.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
467
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: NgVirtualListItemComponent, selector: "ng-virtual-list-item", host: { attributes: { "role": "listitem" }, classAttribute: "ngvl__item" }, usesInheritance: true, ngImport: i0, template: "<ng-container *ngIf=\"data\">\r\n <div #listItem [part]=\"part\" class=\"ngvl-item__container\" [ngClass]=\"{'snapped': data.config.snapped,\r\n 'snapped-out': data.config.snappedOut}\" (click)=\"onClickHandler()\">\r\n <ng-container *ngIf=\"itemRenderer\">\r\n <ng-container [ngTemplateOutlet]=\"itemRenderer\"\r\n [ngTemplateOutletContext]=\"{data: data.data || {}, measures: measures | async, config: config | async}\"></ng-container>\r\n </ng-container>\r\n </div>\r\n</ng-container>", styles: [":host{display:block;position:absolute;left:0;top:0;box-sizing:border-box;overflow:hidden}.ngvl-item__container{margin:0;padding:0;overflow:hidden;background-color:#fff;width:inherit;height:inherit}\n"], dependencies: [{ kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "pipe", type: i2.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
410
468
|
}
|
|
411
469
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: NgVirtualListItemComponent, decorators: [{
|
|
412
470
|
type: Component,
|
|
413
471
|
args: [{ selector: 'ng-virtual-list-item', host: {
|
|
414
472
|
'class': 'ngvl__item',
|
|
415
473
|
'role': 'listitem',
|
|
416
|
-
}, changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-container *ngIf=\"data\">\r\n <div #listItem [part]=\"part\" class=\"ngvl-item__container\" [ngClass]=\"{'snapped': data.config.snapped,\r\n 'snapped-out': data.config.snappedOut}\" (click)=\"onClickHandler()\">\r\n <ng-container *ngIf=\"itemRenderer\">\r\n <ng-container [ngTemplateOutlet]=\"itemRenderer\"\r\n [ngTemplateOutletContext]=\"{data: data.data || {}, config: config | async}\"></ng-container>\r\n </ng-container>\r\n </div>\r\n</ng-container>", styles: [":host{display:block;position:absolute;left:0;top:0;box-sizing:border-box;overflow:hidden}.ngvl-item__container{margin:0;padding:0;overflow:hidden;background-color:#fff;width:inherit;height:inherit}\n"] }]
|
|
474
|
+
}, changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-container *ngIf=\"data\">\r\n <div #listItem [part]=\"part\" class=\"ngvl-item__container\" [ngClass]=\"{'snapped': data.config.snapped,\r\n 'snapped-out': data.config.snappedOut}\" (click)=\"onClickHandler()\">\r\n <ng-container *ngIf=\"itemRenderer\">\r\n <ng-container [ngTemplateOutlet]=\"itemRenderer\"\r\n [ngTemplateOutletContext]=\"{data: data.data || {}, measures: measures | async, config: config | async}\"></ng-container>\r\n </ng-container>\r\n </div>\r\n</ng-container>", styles: [":host{display:block;position:absolute;left:0;top:0;box-sizing:border-box;overflow:hidden}.ngvl-item__container{margin:0;padding:0;overflow:hidden;background-color:#fff;width:inherit;height:inherit}\n"] }]
|
|
417
475
|
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: i0.ElementRef }, { type: NgVirtualListService }]; } });
|
|
418
476
|
|
|
419
477
|
/**
|
|
@@ -1129,8 +1187,8 @@ class TrackBox extends CacheMap {
|
|
|
1129
1187
|
/**
|
|
1130
1188
|
* Finds the position of a collection element by the given Id
|
|
1131
1189
|
*/
|
|
1132
|
-
getItemPosition(id,
|
|
1133
|
-
const opt = { fromItemId: id,
|
|
1190
|
+
getItemPosition(id, itemConfigMap, options) {
|
|
1191
|
+
const opt = { fromItemId: id, itemConfigMap, ...options };
|
|
1134
1192
|
this._defaultBufferSize = opt.bufferSize;
|
|
1135
1193
|
this._maxBufferSize = opt.maxBufferSize;
|
|
1136
1194
|
const { scrollSize, isFromItemIdFound } = this.recalculateMetrics({
|
|
@@ -1145,8 +1203,8 @@ class TrackBox extends CacheMap {
|
|
|
1145
1203
|
/**
|
|
1146
1204
|
* Updates the collection of display objects
|
|
1147
1205
|
*/
|
|
1148
|
-
updateCollection(items,
|
|
1149
|
-
const opt = {
|
|
1206
|
+
updateCollection(items, itemConfigMap, options) {
|
|
1207
|
+
const opt = { itemConfigMap, ...options }, crudDetected = this._crudDetected, deletedItemsMap = this._deletedItemsMap;
|
|
1150
1208
|
if (opt.dynamicSize) {
|
|
1151
1209
|
this.cacheElements();
|
|
1152
1210
|
}
|
|
@@ -1167,7 +1225,7 @@ class TrackBox extends CacheMap {
|
|
|
1167
1225
|
if (opt.dynamicSize) {
|
|
1168
1226
|
this.snapshot();
|
|
1169
1227
|
}
|
|
1170
|
-
const displayItems = this.generateDisplayCollection(items,
|
|
1228
|
+
const displayItems = this.generateDisplayCollection(items, itemConfigMap, { ...metrics, });
|
|
1171
1229
|
return { displayItems, totalSize: metrics.totalSize, delta: metrics.delta, crudDetected };
|
|
1172
1230
|
}
|
|
1173
1231
|
/**
|
|
@@ -1248,7 +1306,7 @@ class TrackBox extends CacheMap {
|
|
|
1248
1306
|
* Calculates list metrics
|
|
1249
1307
|
*/
|
|
1250
1308
|
recalculateMetrics(options) {
|
|
1251
|
-
const { fromItemId, bounds, collection, dynamicSize, isVertical, itemSize, bufferSize: minBufferSize, scrollSize, snap,
|
|
1309
|
+
const { fromItemId, bounds, collection, dynamicSize, isVertical, itemSize, bufferSize: minBufferSize, scrollSize, snap, itemConfigMap, enabledBufferOptimization, previousTotalSize, crudDetected, deletedItemsMap } = options;
|
|
1252
1310
|
const bufferSize = Math.max(minBufferSize, this._bufferSize), { width, height } = bounds, sizeProperty = isVertical ? HEIGHT_PROP_NAME : WIDTH_PROP_NAME, size = isVertical ? height : width, totalLength = collection.length, typicalItemSize = itemSize, w = isVertical ? width : typicalItemSize, h = isVertical ? typicalItemSize : height, map = this._map, snapshot = this._snapshot, checkOverscrollItemsLimit = Math.ceil(size / typicalItemSize), snippedPos = Math.floor(scrollSize), leftItemsWeights = [], isFromId = fromItemId !== undefined && (typeof fromItemId === 'number' && fromItemId > -1)
|
|
1253
1311
|
|| (typeof fromItemId === 'string' && fromItemId > '-1');
|
|
1254
1312
|
let leftItemsOffset = 0, rightItemsOffset = 0;
|
|
@@ -1308,21 +1366,21 @@ class TrackBox extends CacheMap {
|
|
|
1308
1366
|
totalSize += componentSize;
|
|
1309
1367
|
if (isFromId) {
|
|
1310
1368
|
if (itemById === undefined) {
|
|
1311
|
-
if (id !== fromItemId &&
|
|
1369
|
+
if (id !== fromItemId && itemConfigMap && itemConfigMap[id]?.sticky === 1) {
|
|
1312
1370
|
stickyComponentSize = componentSize;
|
|
1313
1371
|
stickyCollectionItem = collectionItem;
|
|
1314
1372
|
}
|
|
1315
1373
|
if (id === fromItemId) {
|
|
1316
1374
|
isFromItemIdFound = true;
|
|
1317
1375
|
targetDisplayItemIndex = i;
|
|
1318
|
-
if (stickyCollectionItem &&
|
|
1376
|
+
if (stickyCollectionItem && itemConfigMap) {
|
|
1319
1377
|
const { num } = this.getElementNumToEnd(i, collection, map, typicalItemSize, size, isVertical);
|
|
1320
1378
|
if (num > 0) {
|
|
1321
1379
|
isTargetInOverscroll = true;
|
|
1322
1380
|
y -= size - componentSize;
|
|
1323
1381
|
}
|
|
1324
1382
|
else {
|
|
1325
|
-
if (
|
|
1383
|
+
if (itemConfigMap && !itemConfigMap[collectionItem.id] && y >= scrollSize && y < scrollSize + stickyComponentSize) {
|
|
1326
1384
|
const snappedY = scrollSize - stickyComponentSize;
|
|
1327
1385
|
leftHiddenItemsWeight -= (snappedY - y);
|
|
1328
1386
|
y = snappedY;
|
|
@@ -1505,7 +1563,7 @@ class TrackBox extends CacheMap {
|
|
|
1505
1563
|
changes() {
|
|
1506
1564
|
this.bumpVersion();
|
|
1507
1565
|
}
|
|
1508
|
-
generateDisplayCollection(items,
|
|
1566
|
+
generateDisplayCollection(items, itemConfigMap, metrics) {
|
|
1509
1567
|
const { width, height, normalizedItemWidth, normalizedItemHeight, dynamicSize, itemsOnDisplayLength, itemsFromStartToScrollEnd, isVertical, renderItems: renderItemsLength, scrollSize, sizeProperty, snap, snippedPos, startPosition, totalLength, startIndex, typicalItemSize, } = metrics, displayItems = [];
|
|
1510
1568
|
if (items.length) {
|
|
1511
1569
|
const actualSnippedPosition = snippedPos, isSnappingMethodAdvanced = this.isSnappingMethodAdvanced, boundsSize = isVertical ? height : width, actualEndSnippedPosition = boundsSize;
|
|
@@ -1515,7 +1573,7 @@ class TrackBox extends CacheMap {
|
|
|
1515
1573
|
if (!items[i]) {
|
|
1516
1574
|
continue;
|
|
1517
1575
|
}
|
|
1518
|
-
const id = items[i].id, sticky =
|
|
1576
|
+
const id = items[i].id, sticky = itemConfigMap[id]?.sticky ?? 0, selectable = itemConfigMap[id]?.selectable ?? true, size = dynamicSize ? this.get(id)?.[sizeProperty] || typicalItemSize : typicalItemSize;
|
|
1519
1577
|
if (sticky === 1) {
|
|
1520
1578
|
const isOdd = i % 2 != 0, measures = {
|
|
1521
1579
|
x: isVertical ? 0 : actualSnippedPosition,
|
|
@@ -1527,6 +1585,7 @@ class TrackBox extends CacheMap {
|
|
|
1527
1585
|
odd: isOdd,
|
|
1528
1586
|
even: !isOdd,
|
|
1529
1587
|
isVertical,
|
|
1588
|
+
selectable,
|
|
1530
1589
|
sticky,
|
|
1531
1590
|
snap,
|
|
1532
1591
|
snapped: true,
|
|
@@ -1550,7 +1609,7 @@ class TrackBox extends CacheMap {
|
|
|
1550
1609
|
if (!items[i]) {
|
|
1551
1610
|
continue;
|
|
1552
1611
|
}
|
|
1553
|
-
const id = items[i].id, sticky =
|
|
1612
|
+
const id = items[i].id, sticky = itemConfigMap[id]?.sticky ?? 0, selectable = itemConfigMap[id]?.selectable ?? true, size = dynamicSize
|
|
1554
1613
|
? this.get(id)?.[sizeProperty] || typicalItemSize
|
|
1555
1614
|
: typicalItemSize;
|
|
1556
1615
|
if (sticky === 2) {
|
|
@@ -1564,6 +1623,7 @@ class TrackBox extends CacheMap {
|
|
|
1564
1623
|
odd: isOdd,
|
|
1565
1624
|
even: !isOdd,
|
|
1566
1625
|
isVertical,
|
|
1626
|
+
selectable,
|
|
1567
1627
|
sticky,
|
|
1568
1628
|
snap,
|
|
1569
1629
|
snapped: true,
|
|
@@ -1591,9 +1651,9 @@ class TrackBox extends CacheMap {
|
|
|
1591
1651
|
}
|
|
1592
1652
|
const id = items[i].id, size = dynamicSize ? this.get(id)?.[sizeProperty] || typicalItemSize : typicalItemSize;
|
|
1593
1653
|
if (id !== stickyItem?.id && id !== endStickyItem?.id) {
|
|
1594
|
-
const isOdd = i % 2 != 0, snapped = snap && (
|
|
1595
|
-
x: isVertical ?
|
|
1596
|
-
y: isVertical ? pos :
|
|
1654
|
+
const isOdd = i % 2 != 0, sticky = itemConfigMap[id]?.sticky ?? 0, selectable = itemConfigMap[id]?.selectable ?? true, snapped = snap && (sticky === 1 && pos <= scrollSize || sticky === 2 && pos >= scrollSize + boundsSize - size), measures = {
|
|
1655
|
+
x: isVertical ? sticky === 1 ? 0 : boundsSize - size : pos,
|
|
1656
|
+
y: isVertical ? pos : sticky === 2 ? boundsSize - size : 0,
|
|
1597
1657
|
width: isVertical ? normalizedItemWidth : size,
|
|
1598
1658
|
height: isVertical ? size : normalizedItemHeight,
|
|
1599
1659
|
delta: 0,
|
|
@@ -1601,7 +1661,8 @@ class TrackBox extends CacheMap {
|
|
|
1601
1661
|
odd: isOdd,
|
|
1602
1662
|
even: !isOdd,
|
|
1603
1663
|
isVertical,
|
|
1604
|
-
|
|
1664
|
+
selectable,
|
|
1665
|
+
sticky: sticky,
|
|
1605
1666
|
snap,
|
|
1606
1667
|
snapped: false,
|
|
1607
1668
|
snappedOut: false,
|
|
@@ -1614,7 +1675,7 @@ class TrackBox extends CacheMap {
|
|
|
1614
1675
|
}
|
|
1615
1676
|
const itemData = items[i];
|
|
1616
1677
|
const item = { index: i, id, measures, data: itemData, config };
|
|
1617
|
-
if (!nextSticky && stickyItemIndex < i &&
|
|
1678
|
+
if (!nextSticky && stickyItemIndex < i && sticky === 1 && (pos <= scrollSize + size + stickyItemSize)) {
|
|
1618
1679
|
item.measures.x = isVertical ? 0 : snapped ? actualSnippedPosition : pos;
|
|
1619
1680
|
item.measures.y = isVertical ? snapped ? actualSnippedPosition : pos : 0;
|
|
1620
1681
|
nextSticky = item;
|
|
@@ -1622,7 +1683,7 @@ class TrackBox extends CacheMap {
|
|
|
1622
1683
|
nextSticky.measures.delta = isVertical ? (item.measures.y - scrollSize) : (item.measures.x - scrollSize);
|
|
1623
1684
|
nextSticky.config.zIndex = '3';
|
|
1624
1685
|
}
|
|
1625
|
-
else if (!nextEndSticky && endStickyItemIndex > i &&
|
|
1686
|
+
else if (!nextEndSticky && endStickyItemIndex > i && sticky === 2 && (pos >= scrollSize + boundsSize - size - endStickyItemSize)) {
|
|
1626
1687
|
item.measures.x = isVertical ? 0 : snapped ? actualEndSnippedPosition - size : pos;
|
|
1627
1688
|
item.measures.y = isVertical ? snapped ? actualEndSnippedPosition - size : pos : 0;
|
|
1628
1689
|
nextEndSticky = item;
|
|
@@ -1828,6 +1889,21 @@ class NgVirtualListComponent {
|
|
|
1828
1889
|
}
|
|
1829
1890
|
;
|
|
1830
1891
|
get selectedIds() { return this._$selectedIds.getValue(); }
|
|
1892
|
+
_$selectByClick = new BehaviorSubject$1(DEFAULT_SELECT_BY_CLICK);
|
|
1893
|
+
$selectByClick = this._$selectByClick.asObservable();
|
|
1894
|
+
/**
|
|
1895
|
+
* If false, the element is selected using the config.select method passed to the template;
|
|
1896
|
+
* if true, the element is selected by clicking on it. The default value is true.
|
|
1897
|
+
*/
|
|
1898
|
+
set selectByClick(v) {
|
|
1899
|
+
if (this._$selectByClick.getValue() === v) {
|
|
1900
|
+
return;
|
|
1901
|
+
}
|
|
1902
|
+
this._$selectByClick.next(v);
|
|
1903
|
+
this._cdr.markForCheck();
|
|
1904
|
+
}
|
|
1905
|
+
;
|
|
1906
|
+
get selectByClick() { return this._$selectByClick.getValue(); }
|
|
1831
1907
|
_$snap = new BehaviorSubject$1(DEFAULT_SNAP);
|
|
1832
1908
|
$snap = this._$snap.asObservable();
|
|
1833
1909
|
/**
|
|
@@ -1874,21 +1950,30 @@ class NgVirtualListComponent {
|
|
|
1874
1950
|
}
|
|
1875
1951
|
;
|
|
1876
1952
|
get itemRenderer() { return this._$itemRenderer.getValue(); }
|
|
1877
|
-
_$stickyMap = new BehaviorSubject$1({});
|
|
1878
|
-
$stickyMap = this._$stickyMap.asObservable();
|
|
1879
1953
|
/**
|
|
1880
|
-
*
|
|
1881
|
-
*
|
|
1954
|
+
* @deprecated
|
|
1955
|
+
* Use `itemConfigMap` instead.
|
|
1882
1956
|
*/
|
|
1883
|
-
|
|
1884
|
-
|
|
1957
|
+
stickyMap;
|
|
1958
|
+
_$itemConfigMap = new BehaviorSubject$1({});
|
|
1959
|
+
$itemConfigMap = this._$itemConfigMap.asObservable();
|
|
1960
|
+
/**
|
|
1961
|
+
* Sets sticky position and selectable for the list item element. If sticky position is greater than 0, then sticky position is applied.
|
|
1962
|
+
* If the sticky value is greater than `0`, then the sticky position mode is enabled for the element. `1` - position start, `2` - position end. Default value is `0`.
|
|
1963
|
+
* selectable determines whether an element can be selected or not. Default value is `true`.
|
|
1964
|
+
* @link https://github.com/DjonnyX/ng-virtual-list/blob/16.x/projects/ng-virtual-list/src/lib/models/item-config-map.model.ts
|
|
1965
|
+
* @author Evgenii Grebennikov
|
|
1966
|
+
* @email djonnyx@gmail.com
|
|
1967
|
+
*/
|
|
1968
|
+
set itemConfigMap(v) {
|
|
1969
|
+
if (this._$itemConfigMap.getValue() === v) {
|
|
1885
1970
|
return;
|
|
1886
1971
|
}
|
|
1887
|
-
this._$
|
|
1972
|
+
this._$itemConfigMap.next(v);
|
|
1888
1973
|
this._cdr.markForCheck();
|
|
1889
1974
|
}
|
|
1890
1975
|
;
|
|
1891
|
-
get
|
|
1976
|
+
get itemConfigMap() { return this._$itemConfigMap.getValue(); }
|
|
1892
1977
|
_itemSizeOptions = (v) => {
|
|
1893
1978
|
if (v === undefined) {
|
|
1894
1979
|
return DEFAULT_ITEM_SIZE;
|
|
@@ -2127,11 +2212,14 @@ class NgVirtualListComponent {
|
|
|
2127
2212
|
this._$initialized = new BehaviorSubject$1(false);
|
|
2128
2213
|
this.$initialized = this._$initialized.asObservable();
|
|
2129
2214
|
this._trackBox.displayComponents = this._displayComponents;
|
|
2130
|
-
const $trackBy = this.$trackBy;
|
|
2215
|
+
const $trackBy = this.$trackBy, $selectByClick = this.$selectByClick;
|
|
2216
|
+
$selectByClick.pipe(takeUntilDestroyed(), tap(v => {
|
|
2217
|
+
this._service.selectByClick = v;
|
|
2218
|
+
})).subscribe();
|
|
2131
2219
|
$trackBy.pipe(takeUntilDestroyed(), tap(v => {
|
|
2132
2220
|
this._trackBox.trackingPropertyName = v;
|
|
2133
2221
|
})).subscribe();
|
|
2134
|
-
const $bounds = this._$bounds.asObservable().pipe(filter(b => !!b)), $items = this.$items.pipe(map$1(i => !i ? [] : i)), $scrollSize = this._$scrollSize.asObservable(), $itemSize = this.$itemSize.pipe(map$1(v => v <= 0 ? DEFAULT_ITEM_SIZE : v)), $bufferSize = this.$bufferSize.pipe(map$1(v => v < 0 ? DEFAULT_BUFFER_SIZE : v)), $maxBufferSize = this.$maxBufferSize.pipe(map$1(v => v < 0 ? DEFAULT_MAX_BUFFER_SIZE : v)), $
|
|
2222
|
+
const $bounds = this._$bounds.asObservable().pipe(filter(b => !!b)), $items = this.$items.pipe(map$1(i => !i ? [] : i)), $scrollSize = this._$scrollSize.asObservable(), $itemSize = this.$itemSize.pipe(map$1(v => v <= 0 ? DEFAULT_ITEM_SIZE : v)), $bufferSize = this.$bufferSize.pipe(map$1(v => v < 0 ? DEFAULT_BUFFER_SIZE : v)), $maxBufferSize = this.$maxBufferSize.pipe(map$1(v => v < 0 ? DEFAULT_MAX_BUFFER_SIZE : v)), $itemConfigMap = this.$itemConfigMap.pipe(map$1(v => !v ? {} : v)), $snap = this.$snap, $isVertical = this.$direction.pipe(map$1(v => this.getIsVertical(v || DEFAULT_DIRECTION))), $dynamicSize = this.$dynamicSize, $enabledBufferOptimization = this.$enabledBufferOptimization, $snappingMethod = this.$snappingMethod.pipe(map$1(v => this.getIsSnappingMethodAdvanced(v || DEFAULT_SNAPPING_METHOD))), $methodForSelecting = this.$methodForSelecting, $selectedIds = this.$selectedIds, $cacheVersion = this.$cacheVersion;
|
|
2135
2223
|
$isVertical.pipe(takeUntilDestroyed(), tap(v => {
|
|
2136
2224
|
this._isVertical = v;
|
|
2137
2225
|
const el = this._elementRef.nativeElement;
|
|
@@ -2146,7 +2234,6 @@ class NgVirtualListComponent {
|
|
|
2146
2234
|
this._isMultiSelecting = true;
|
|
2147
2235
|
this._isNotSelecting = this._isSingleSelecting = false;
|
|
2148
2236
|
if (el) {
|
|
2149
|
-
console.log('set role', ROLE_LIST_BOX);
|
|
2150
2237
|
el.setAttribute('role', ROLE_LIST_BOX);
|
|
2151
2238
|
}
|
|
2152
2239
|
this._service.methodOfSelecting = MethodsForSelectingTypes.MULTI_SELECT;
|
|
@@ -2155,7 +2242,6 @@ class NgVirtualListComponent {
|
|
|
2155
2242
|
this._isSingleSelecting = true;
|
|
2156
2243
|
this._isNotSelecting = this._isMultiSelecting = false;
|
|
2157
2244
|
if (el) {
|
|
2158
|
-
console.log('set role', ROLE_LIST_BOX);
|
|
2159
2245
|
el.setAttribute('role', ROLE_LIST_BOX);
|
|
2160
2246
|
}
|
|
2161
2247
|
this._service.methodOfSelecting = MethodsForSelectingTypes.SELECT;
|
|
@@ -2164,7 +2250,6 @@ class NgVirtualListComponent {
|
|
|
2164
2250
|
this._isNotSelecting = true;
|
|
2165
2251
|
this._isSingleSelecting = this._isMultiSelecting = false;
|
|
2166
2252
|
if (el) {
|
|
2167
|
-
console.log('set role', ROLE_LIST);
|
|
2168
2253
|
el.setAttribute('role', ROLE_LIST);
|
|
2169
2254
|
}
|
|
2170
2255
|
this._service.methodOfSelecting = MethodsForSelectingTypes.NONE;
|
|
@@ -2173,14 +2258,14 @@ class NgVirtualListComponent {
|
|
|
2173
2258
|
$dynamicSize.pipe(takeUntilDestroyed(), tap(dynamicSize => {
|
|
2174
2259
|
this.listenCacheChangesIfNeed(dynamicSize);
|
|
2175
2260
|
})).subscribe();
|
|
2176
|
-
combineLatest([this.$initialized, $bounds, $items, $
|
|
2261
|
+
combineLatest([this.$initialized, $bounds, $items, $itemConfigMap, $scrollSize, $itemSize,
|
|
2177
2262
|
$bufferSize, $maxBufferSize, $snap, $isVertical, $dynamicSize, $enabledBufferOptimization, $cacheVersion,
|
|
2178
|
-
]).pipe(takeUntilDestroyed(), distinctUntilChanged(), filter(([initialized]) => !!initialized), switchMap(([, bounds, items,
|
|
2263
|
+
]).pipe(takeUntilDestroyed(), distinctUntilChanged(), filter(([initialized]) => !!initialized), switchMap(([, bounds, items, itemConfigMap, scrollSize, itemSize, bufferSize, maxBufferSize, snap, isVertical, dynamicSize, enabledBufferOptimization, cacheVersion,]) => {
|
|
2179
2264
|
let actualScrollSize = (this._isVertical ? this._container?.nativeElement.scrollTop ?? 0 : this._container?.nativeElement.scrollLeft) ?? 0;
|
|
2180
2265
|
const { width, height } = bounds, opts = {
|
|
2181
2266
|
bounds: { width, height }, dynamicSize, isVertical, itemSize,
|
|
2182
2267
|
bufferSize, maxBufferSize, scrollSize: actualScrollSize, snap, enabledBufferOptimization,
|
|
2183
|
-
}, { displayItems, totalSize } = this._trackBox.updateCollection(items,
|
|
2268
|
+
}, { displayItems, totalSize } = this._trackBox.updateCollection(items, itemConfigMap, opts);
|
|
2184
2269
|
this.resetBoundsSize(isVertical, totalSize);
|
|
2185
2270
|
this.createDisplayComponentsIfNeed(displayItems);
|
|
2186
2271
|
this.tracking();
|
|
@@ -2212,10 +2297,19 @@ class NgVirtualListComponent {
|
|
|
2212
2297
|
this._service.$itemClick.pipe(takeUntilDestroyed(), tap(v => {
|
|
2213
2298
|
this.onItemClick.emit(v ?? undefined);
|
|
2214
2299
|
})).subscribe();
|
|
2215
|
-
|
|
2216
|
-
|
|
2300
|
+
let isSelectedIdsFirstEmit = 0;
|
|
2301
|
+
this._service.$selectedIds.pipe(takeUntilDestroyed(), distinctUntilChanged(), tap(v => {
|
|
2302
|
+
if (this.isSingleSelecting || (this.isMultiSelecting && isSelectedIdsFirstEmit >= 2)) {
|
|
2303
|
+
const curr = this._$selectedIds.getValue();
|
|
2304
|
+
if ((this.isSingleSelecting && JSON.stringify(v) !== JSON.stringify(curr)) || (isSelectedIdsFirstEmit === 2 && JSON.stringify(v) !== JSON.stringify(curr)) || isSelectedIdsFirstEmit > 2) {
|
|
2305
|
+
this.onSelect.emit(v);
|
|
2306
|
+
}
|
|
2307
|
+
}
|
|
2308
|
+
if (isSelectedIdsFirstEmit < 3) {
|
|
2309
|
+
isSelectedIdsFirstEmit++;
|
|
2310
|
+
}
|
|
2217
2311
|
})).subscribe();
|
|
2218
|
-
$selectedIds.pipe(takeUntilDestroyed(), tap(v => {
|
|
2312
|
+
$selectedIds.pipe(takeUntilDestroyed(), distinctUntilChanged(), tap(v => {
|
|
2219
2313
|
this._service.setSelectedIds(v);
|
|
2220
2314
|
})).subscribe();
|
|
2221
2315
|
}
|
|
@@ -2345,18 +2439,18 @@ class NgVirtualListComponent {
|
|
|
2345
2439
|
if (container) {
|
|
2346
2440
|
container.nativeElement.removeEventListener(SCROLL, this._onScrollHandler);
|
|
2347
2441
|
}
|
|
2348
|
-
const { width, height } = this._$bounds.getValue() || { width: 0, height: 0 },
|
|
2442
|
+
const { width, height } = this._$bounds.getValue() || { width: 0, height: 0 }, itemConfigMap = this.itemConfigMap, items = this.items, isVertical = this._isVertical, delta = this._trackBox.delta, opts = {
|
|
2349
2443
|
bounds: { width, height }, collection: items, dynamicSize, isVertical: this._isVertical, itemSize,
|
|
2350
2444
|
bufferSize: this.bufferSize, maxBufferSize: this.maxBufferSize, scrollSize: (isVertical ? container.nativeElement.scrollTop : container.nativeElement.scrollLeft) + delta,
|
|
2351
2445
|
snap: this.snap, fromItemId: id, enabledBufferOptimization: this.enabledBufferOptimization,
|
|
2352
|
-
}, scrollSize = this._trackBox.getItemPosition(id,
|
|
2446
|
+
}, scrollSize = this._trackBox.getItemPosition(id, itemConfigMap, opts), params = { [isVertical ? TOP_PROP_NAME : LEFT_PROP_NAME]: scrollSize, behavior };
|
|
2353
2447
|
if (scrollSize === -1) {
|
|
2354
2448
|
container.nativeElement.addEventListener(SCROLL, this._onScrollHandler);
|
|
2355
2449
|
return;
|
|
2356
2450
|
}
|
|
2357
2451
|
this._trackBox.clearDelta();
|
|
2358
2452
|
if (container) {
|
|
2359
|
-
const { displayItems, totalSize } = this._trackBox.updateCollection(items,
|
|
2453
|
+
const { displayItems, totalSize } = this._trackBox.updateCollection(items, itemConfigMap, {
|
|
2360
2454
|
...opts, scrollSize, fromItemId: isLastIteration ? undefined : id,
|
|
2361
2455
|
}), delta = this._trackBox.delta;
|
|
2362
2456
|
this._trackBox.clearDelta();
|
|
@@ -2364,7 +2458,7 @@ class NgVirtualListComponent {
|
|
|
2364
2458
|
this.resetBoundsSize(isVertical, totalSize);
|
|
2365
2459
|
this.createDisplayComponentsIfNeed(displayItems);
|
|
2366
2460
|
this.tracking();
|
|
2367
|
-
const _scrollSize = this._trackBox.getItemPosition(id,
|
|
2461
|
+
const _scrollSize = this._trackBox.getItemPosition(id, itemConfigMap, { ...opts, scrollSize: actualScrollSize, fromItemId: id });
|
|
2368
2462
|
if (_scrollSize === -1) {
|
|
2369
2463
|
container.nativeElement.addEventListener(SCROLL, this._onScrollHandler);
|
|
2370
2464
|
return;
|
|
@@ -2478,7 +2572,7 @@ class NgVirtualListComponent {
|
|
|
2478
2572
|
}
|
|
2479
2573
|
}
|
|
2480
2574
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: NgVirtualListComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i0.ElementRef }, { token: NgVirtualListService }], target: i0.ɵɵFactoryTarget.Component });
|
|
2481
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: NgVirtualListComponent, selector: "ng-virtual-list", inputs: { items: "items", selectedIds: "selectedIds", snap: "snap", enabledBufferOptimization: "enabledBufferOptimization", itemRenderer: "itemRenderer", stickyMap: "stickyMap", itemSize: "itemSize", dynamicSize: "dynamicSize", direction: "direction", itemsOffset: "itemsOffset", bufferSize: "bufferSize", maxBufferSize: "maxBufferSize", trackBy: "trackBy", snappingMethod: "snappingMethod", methodForSelecting: "methodForSelecting" }, outputs: { onScroll: "onScroll", onScrollEnd: "onScrollEnd", onViewportChange: "onViewportChange", onItemClick: "onItemClick", onSelect: "onSelect" }, providers: [NgVirtualListService], viewQueries: [{ propertyName: "_listContainerRef", first: true, predicate: ["renderersContainer"], descendants: true, read: ViewContainerRef }, { propertyName: "_container", first: true, predicate: ["container"], descendants: true, read: (ElementRef) }, { propertyName: "_list", first: true, predicate: ["list"], descendants: true, read: (ElementRef) }, { propertyName: "_snapContainerRef", first: true, predicate: ["snapRendererContainer"], descendants: true, read: ViewContainerRef }, { propertyName: "_snappedContainer", first: true, predicate: ["snapped"], descendants: true, read: ViewContainerRef }], ngImport: i0, template: "<div *ngIf=\"snap\" #snapped part=\"snapped-item\" class=\"ngvl__list-snapper\">\r\n <ng-container #snapRendererContainer></ng-container>\r\n</div>\r\n<div #container part=\"scroller\" class=\"ngvl__scroller\">\r\n <div [attr.aria-orientation]=\"orientation\" #list part=\"list\" class=\"ngvl__list\">\r\n <ng-container #renderersContainer></ng-container>\r\n </div>\r\n</div>", styles: [":host{position:relative;display:block;width:400px;overflow:hidden}:host(.horizontal){height:48px}:host(.horizontal) .ngvl__list{display:inline-flex}:host(.horizontal) .ngvl__scroller{overflow:auto hidden}:host(.vertical) .ngvl__scroller{overflow:hidden auto}:host(.vertical){height:320px}.ngvl__scroller{overflow:auto;width:100%;height:100%}.ngvl__list-snapper{pointer-events:none;position:absolute;list-style:none;left:0;top:0;z-index:1}.ngvl__list{position:relative;list-style:none;padding:0;margin:0;width:100%;height:100%}\n"], dependencies: [{ kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.ShadowDom });
|
|
2575
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: NgVirtualListComponent, selector: "ng-virtual-list", inputs: { items: "items", selectedIds: "selectedIds", selectByClick: "selectByClick", snap: "snap", enabledBufferOptimization: "enabledBufferOptimization", itemRenderer: "itemRenderer", stickyMap: "stickyMap", itemConfigMap: "itemConfigMap", itemSize: "itemSize", dynamicSize: "dynamicSize", direction: "direction", itemsOffset: "itemsOffset", bufferSize: "bufferSize", maxBufferSize: "maxBufferSize", trackBy: "trackBy", snappingMethod: "snappingMethod", methodForSelecting: "methodForSelecting" }, outputs: { onScroll: "onScroll", onScrollEnd: "onScrollEnd", onViewportChange: "onViewportChange", onItemClick: "onItemClick", onSelect: "onSelect" }, providers: [NgVirtualListService], viewQueries: [{ propertyName: "_listContainerRef", first: true, predicate: ["renderersContainer"], descendants: true, read: ViewContainerRef }, { propertyName: "_container", first: true, predicate: ["container"], descendants: true, read: (ElementRef) }, { propertyName: "_list", first: true, predicate: ["list"], descendants: true, read: (ElementRef) }, { propertyName: "_snapContainerRef", first: true, predicate: ["snapRendererContainer"], descendants: true, read: ViewContainerRef }, { propertyName: "_snappedContainer", first: true, predicate: ["snapped"], descendants: true, read: ViewContainerRef }], ngImport: i0, template: "<div *ngIf=\"snap\" #snapped part=\"snapped-item\" class=\"ngvl__list-snapper\">\r\n <ng-container #snapRendererContainer></ng-container>\r\n</div>\r\n<div #container part=\"scroller\" class=\"ngvl__scroller\">\r\n <div [attr.aria-orientation]=\"orientation\" #list part=\"list\" class=\"ngvl__list\">\r\n <ng-container #renderersContainer></ng-container>\r\n </div>\r\n</div>", styles: [":host{position:relative;display:block;width:400px;overflow:hidden}:host(.horizontal){height:48px}:host(.horizontal) .ngvl__list{display:inline-flex}:host(.horizontal) .ngvl__scroller{overflow:auto hidden}:host(.vertical) .ngvl__scroller{overflow:hidden auto}:host(.vertical){height:320px}.ngvl__scroller{overflow:auto;width:100%;height:100%}.ngvl__list-snapper{pointer-events:none;position:absolute;list-style:none;left:0;top:0;z-index:1}.ngvl__list{position:relative;list-style:none;padding:0;margin:0;width:100%;height:100%}\n"], dependencies: [{ kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.ShadowDom });
|
|
2482
2576
|
}
|
|
2483
2577
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: NgVirtualListComponent, decorators: [{
|
|
2484
2578
|
type: Component,
|
|
@@ -2512,6 +2606,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
|
2512
2606
|
type: Input
|
|
2513
2607
|
}], selectedIds: [{
|
|
2514
2608
|
type: Input
|
|
2609
|
+
}], selectByClick: [{
|
|
2610
|
+
type: Input
|
|
2515
2611
|
}], snap: [{
|
|
2516
2612
|
type: Input
|
|
2517
2613
|
}], enabledBufferOptimization: [{
|
|
@@ -2520,6 +2616,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
|
2520
2616
|
type: Input
|
|
2521
2617
|
}], stickyMap: [{
|
|
2522
2618
|
type: Input
|
|
2619
|
+
}], itemConfigMap: [{
|
|
2620
|
+
type: Input
|
|
2523
2621
|
}], itemSize: [{
|
|
2524
2622
|
type: Input
|
|
2525
2623
|
}], dynamicSize: [{
|