ng-virtual-list 14.7.0 → 14.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/esm2020/lib/components/ng-virtual-list-item.component.mjs +18 -4
- package/esm2020/lib/const/index.mjs +2 -1
- package/esm2020/lib/models/index.mjs +1 -1
- package/esm2020/lib/models/item-config-map.model.mjs +2 -0
- package/esm2020/lib/models/render-item-config.model.mjs +1 -1
- package/esm2020/lib/ng-virtual-list.component.mjs +58 -26
- package/esm2020/lib/ng-virtual-list.service.mjs +46 -9
- package/esm2020/lib/utils/trackBox.mjs +22 -19
- package/fesm2015/ng-virtual-list.mjs +145 -59
- package/fesm2015/ng-virtual-list.mjs.map +1 -1
- package/fesm2020/ng-virtual-list.mjs +139 -53
- package/fesm2020/ng-virtual-list.mjs.map +1 -1
- package/lib/components/ng-virtual-list-item.component.d.ts +22 -4
- 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/models/sticky-map.model.mjs +0 -2
- package/esm2022/lib/components/ng-virtual-list-item.component.mjs +0 -158
- package/esm2022/lib/const/index.mjs +0 -49
- package/esm2022/lib/enums/direction.mjs +0 -2
- package/esm2022/lib/enums/directions.mjs +0 -18
- package/esm2022/lib/enums/index.mjs +0 -4
- package/esm2022/lib/enums/snapping-method.mjs +0 -2
- package/esm2022/lib/enums/snapping-methods.mjs +0 -18
- package/esm2022/lib/models/base-virtual-list-item-component.mjs +0 -9
- package/esm2022/lib/models/collection.model.mjs +0 -3
- package/esm2022/lib/models/component.model.mjs +0 -2
- package/esm2022/lib/models/index.mjs +0 -2
- package/esm2022/lib/models/item.model.mjs +0 -2
- package/esm2022/lib/models/render-collection.model.mjs +0 -3
- package/esm2022/lib/models/render-item-config.model.mjs +0 -2
- package/esm2022/lib/models/render-item.model.mjs +0 -3
- package/esm2022/lib/models/scroll-direction.model.mjs +0 -2
- package/esm2022/lib/models/scroll-event.model.mjs +0 -2
- package/esm2022/lib/models/sticky-map.model.mjs +0 -2
- package/esm2022/lib/ng-virtual-list.component.mjs +0 -555
- package/esm2022/lib/ng-virtual-list.module.mjs +0 -20
- package/esm2022/lib/ng-virtual-list.service.mjs +0 -29
- package/esm2022/lib/types/id.mjs +0 -2
- package/esm2022/lib/types/index.mjs +0 -2
- package/esm2022/lib/types/rect.mjs +0 -2
- package/esm2022/lib/types/size.mjs +0 -2
- package/esm2022/lib/utils/browser.mjs +0 -3
- package/esm2022/lib/utils/buffer-interpolation.mjs +0 -27
- package/esm2022/lib/utils/cacheMap.mjs +0 -168
- package/esm2022/lib/utils/debounce.mjs +0 -31
- package/esm2022/lib/utils/eventEmitter.mjs +0 -105
- package/esm2022/lib/utils/index.mjs +0 -5
- package/esm2022/lib/utils/isDirection.mjs +0 -15
- package/esm2022/lib/utils/scrollEvent.mjs +0 -42
- package/esm2022/lib/utils/snapping-method.mjs +0 -9
- package/esm2022/lib/utils/toggleClassName.mjs +0 -15
- package/esm2022/lib/utils/trackBox.mjs +0 -768
- package/esm2022/lib/utils/tracker.mjs +0 -144
- package/esm2022/ng-virtual-list.mjs +0 -5
- package/esm2022/public-api.mjs +0 -11
- package/fesm2022/ng-virtual-list.mjs +0 -2359
- package/fesm2022/ng-virtual-list.mjs.map +0 -1
- package/lib/models/sticky-map.model.d.ts +0 -14
|
@@ -69,6 +69,7 @@ const DEFAULT_BUFFER_SIZE = 2;
|
|
|
69
69
|
const DEFAULT_MAX_BUFFER_SIZE = 100;
|
|
70
70
|
const DEFAULT_LIST_SIZE = 400;
|
|
71
71
|
const DEFAULT_SNAP = false;
|
|
72
|
+
const DEFAULT_SELECT_BY_CLICK = true;
|
|
72
73
|
const DEFAULT_ENABLED_BUFFER_OPTIMIZATION = false;
|
|
73
74
|
const DEFAULT_DYNAMIC_SIZE = false;
|
|
74
75
|
const TRACK_BY_PROPERTY_NAME = 'id';
|
|
@@ -154,6 +155,7 @@ class NgVirtualListService {
|
|
|
154
155
|
this.$selectedIds = this._$selectedIds.asObservable();
|
|
155
156
|
this._$methodOfSelecting = new BehaviorSubject(0);
|
|
156
157
|
this.$methodOfSelecting = this._$methodOfSelecting.asObservable();
|
|
158
|
+
this.selectByClick = DEFAULT_SELECT_BY_CLICK;
|
|
157
159
|
this._$methodOfSelecting.pipe(takeUntil(this._$unsubscribe), tap(v => {
|
|
158
160
|
switch (v) {
|
|
159
161
|
case MethodsForSelectingTypes.SELECT: {
|
|
@@ -181,25 +183,60 @@ class NgVirtualListService {
|
|
|
181
183
|
this._$methodOfSelecting.next(v);
|
|
182
184
|
}
|
|
183
185
|
setSelectedIds(ids) {
|
|
184
|
-
this._$selectedIds.
|
|
186
|
+
if (JSON.stringify(this._$selectedIds.getValue()) !== JSON.stringify(ids)) {
|
|
187
|
+
this._$selectedIds.next(ids);
|
|
188
|
+
}
|
|
185
189
|
}
|
|
186
190
|
itemClick(data) {
|
|
187
|
-
this.
|
|
188
|
-
|
|
191
|
+
if (this.selectByClick) {
|
|
192
|
+
this.select(data);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Selects a list item
|
|
197
|
+
* @param data
|
|
198
|
+
* @param selected - If the value is undefined, then the toggle method is executed, if false or true, then the selection/deselection is performed.
|
|
199
|
+
*/
|
|
200
|
+
select(data, selected = undefined) {
|
|
201
|
+
if (data && data.config.selectable) {
|
|
189
202
|
switch (this._$methodOfSelecting.getValue()) {
|
|
190
203
|
case MethodsForSelectingTypes.SELECT: {
|
|
191
204
|
const curr = this._$selectedIds.getValue();
|
|
192
|
-
|
|
205
|
+
if (selected === undefined) {
|
|
206
|
+
this._$selectedIds.next(curr !== data?.id ? data?.id : undefined);
|
|
207
|
+
}
|
|
208
|
+
else {
|
|
209
|
+
this._$selectedIds.next(selected ? data?.id : undefined);
|
|
210
|
+
}
|
|
193
211
|
break;
|
|
194
212
|
}
|
|
195
213
|
case MethodsForSelectingTypes.MULTI_SELECT: {
|
|
196
214
|
const curr = [...(this._$selectedIds.getValue() || [])], index = curr.indexOf(data.id);
|
|
197
|
-
if (
|
|
198
|
-
|
|
199
|
-
|
|
215
|
+
if (selected === undefined) {
|
|
216
|
+
if (index > -1) {
|
|
217
|
+
curr.splice(index, 1);
|
|
218
|
+
this._$selectedIds.next(curr);
|
|
219
|
+
}
|
|
220
|
+
else {
|
|
221
|
+
this._$selectedIds.next([...curr, data.id]);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
else if (selected) {
|
|
225
|
+
if (index > -1) {
|
|
226
|
+
this._$selectedIds.next(curr);
|
|
227
|
+
}
|
|
228
|
+
else {
|
|
229
|
+
this._$selectedIds.next([...curr, data.id]);
|
|
230
|
+
}
|
|
200
231
|
}
|
|
201
232
|
else {
|
|
202
|
-
|
|
233
|
+
if (index > -1) {
|
|
234
|
+
curr.splice(index, 1);
|
|
235
|
+
this._$selectedIds.next(curr);
|
|
236
|
+
}
|
|
237
|
+
else {
|
|
238
|
+
this._$selectedIds.next(curr);
|
|
239
|
+
}
|
|
203
240
|
}
|
|
204
241
|
break;
|
|
205
242
|
}
|
|
@@ -250,10 +287,19 @@ class NgVirtualListItemComponent extends BaseVirtualListItemComponent {
|
|
|
250
287
|
this._part = PART_DEFAULT_ITEM;
|
|
251
288
|
this._isSelected = false;
|
|
252
289
|
this.config = new BehaviorSubject$1({});
|
|
290
|
+
this.measures = new BehaviorSubject$1(undefined);
|
|
253
291
|
this.regular = false;
|
|
254
292
|
this._$data = new BehaviorSubject$1(this.data);
|
|
255
293
|
this.$data = this._$data.asObservable();
|
|
256
294
|
this._regularLength = SIZE_100_PERSENT;
|
|
295
|
+
this._selectHandler = (data) =>
|
|
296
|
+
/**
|
|
297
|
+
* Selects a list item
|
|
298
|
+
* @param selected - If the value is undefined, then the toggle method is executed, if false or true, then the selection/deselection is performed.
|
|
299
|
+
*/
|
|
300
|
+
(selected = undefined) => {
|
|
301
|
+
this._service.select(data, selected);
|
|
302
|
+
};
|
|
257
303
|
this._id = this._service.generateComponentId();
|
|
258
304
|
const $data = this.$data;
|
|
259
305
|
combineLatest([$data, this._service.$methodOfSelecting, this._service.$selectedIds]).pipe(takeUntil$1(this._$unsubscribe), map(([, m, ids]) => ({ method: m, ids })), tap$1(({ method, ids }) => {
|
|
@@ -279,6 +325,7 @@ class NgVirtualListItemComponent extends BaseVirtualListItemComponent {
|
|
|
279
325
|
}
|
|
280
326
|
this.updatePartStr(this.data, this._isSelected);
|
|
281
327
|
this.updateConfig(this.data);
|
|
328
|
+
this.updateMeasures(this.data);
|
|
282
329
|
})).subscribe();
|
|
283
330
|
}
|
|
284
331
|
get id() {
|
|
@@ -292,6 +339,7 @@ class NgVirtualListItemComponent extends BaseVirtualListItemComponent {
|
|
|
292
339
|
this.data = v;
|
|
293
340
|
this.updatePartStr(v, this._isSelected);
|
|
294
341
|
this.updateConfig(v);
|
|
342
|
+
this.updateMeasures(v);
|
|
295
343
|
this.update();
|
|
296
344
|
this._$data.next(v);
|
|
297
345
|
this._cdr.detectChanges();
|
|
@@ -320,8 +368,11 @@ class NgVirtualListItemComponent extends BaseVirtualListItemComponent {
|
|
|
320
368
|
get element() {
|
|
321
369
|
return this._elementRef.nativeElement;
|
|
322
370
|
}
|
|
371
|
+
updateMeasures(v) {
|
|
372
|
+
this.measures.next(v?.measures ? { ...v.measures } : undefined);
|
|
373
|
+
}
|
|
323
374
|
updateConfig(v) {
|
|
324
|
-
this.config.next({ ...v?.config || {}, selected: this._isSelected });
|
|
375
|
+
this.config.next({ ...v?.config || {}, selected: this._isSelected, select: this._selectHandler(v) });
|
|
325
376
|
}
|
|
326
377
|
update() {
|
|
327
378
|
const data = this.data, regular = this.regular, length = this._regularLength;
|
|
@@ -413,13 +464,13 @@ class NgVirtualListItemComponent extends BaseVirtualListItemComponent {
|
|
|
413
464
|
}
|
|
414
465
|
}
|
|
415
466
|
NgVirtualListItemComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: NgVirtualListItemComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i0.ElementRef }, { token: NgVirtualListService }], target: i0.ɵɵFactoryTarget.Component });
|
|
416
|
-
NgVirtualListItemComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", 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
|
+
NgVirtualListItemComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", 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 });
|
|
417
468
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: NgVirtualListItemComponent, decorators: [{
|
|
418
469
|
type: Component,
|
|
419
470
|
args: [{ selector: 'ng-virtual-list-item', host: {
|
|
420
471
|
'class': 'ngvl__item',
|
|
421
472
|
'role': 'listitem',
|
|
422
|
-
}, 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"] }]
|
|
473
|
+
}, 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"] }]
|
|
423
474
|
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: i0.ElementRef }, { type: NgVirtualListService }]; } });
|
|
424
475
|
|
|
425
476
|
/**
|
|
@@ -1129,8 +1180,8 @@ class TrackBox extends CacheMap {
|
|
|
1129
1180
|
/**
|
|
1130
1181
|
* Finds the position of a collection element by the given Id
|
|
1131
1182
|
*/
|
|
1132
|
-
getItemPosition(id,
|
|
1133
|
-
const opt = { fromItemId: id,
|
|
1183
|
+
getItemPosition(id, itemConfigMap, options) {
|
|
1184
|
+
const opt = { fromItemId: id, itemConfigMap, ...options };
|
|
1134
1185
|
this._defaultBufferSize = opt.bufferSize;
|
|
1135
1186
|
this._maxBufferSize = opt.maxBufferSize;
|
|
1136
1187
|
const { scrollSize, isFromItemIdFound } = this.recalculateMetrics({
|
|
@@ -1145,8 +1196,8 @@ class TrackBox extends CacheMap {
|
|
|
1145
1196
|
/**
|
|
1146
1197
|
* Updates the collection of display objects
|
|
1147
1198
|
*/
|
|
1148
|
-
updateCollection(items,
|
|
1149
|
-
const opt = {
|
|
1199
|
+
updateCollection(items, itemConfigMap, options) {
|
|
1200
|
+
const opt = { itemConfigMap, ...options }, crudDetected = this._crudDetected, deletedItemsMap = this._deletedItemsMap;
|
|
1150
1201
|
if (opt.dynamicSize) {
|
|
1151
1202
|
this.cacheElements();
|
|
1152
1203
|
}
|
|
@@ -1167,7 +1218,7 @@ class TrackBox extends CacheMap {
|
|
|
1167
1218
|
if (opt.dynamicSize) {
|
|
1168
1219
|
this.snapshot();
|
|
1169
1220
|
}
|
|
1170
|
-
const displayItems = this.generateDisplayCollection(items,
|
|
1221
|
+
const displayItems = this.generateDisplayCollection(items, itemConfigMap, { ...metrics, });
|
|
1171
1222
|
return { displayItems, totalSize: metrics.totalSize, delta: metrics.delta, crudDetected };
|
|
1172
1223
|
}
|
|
1173
1224
|
/**
|
|
@@ -1247,7 +1298,7 @@ class TrackBox extends CacheMap {
|
|
|
1247
1298
|
* Calculates list metrics
|
|
1248
1299
|
*/
|
|
1249
1300
|
recalculateMetrics(options) {
|
|
1250
|
-
const { fromItemId, bounds, collection, dynamicSize, isVertical, itemSize, bufferSize: minBufferSize, scrollSize, snap,
|
|
1301
|
+
const { fromItemId, bounds, collection, dynamicSize, isVertical, itemSize, bufferSize: minBufferSize, scrollSize, snap, itemConfigMap, enabledBufferOptimization, previousTotalSize, crudDetected, deletedItemsMap } = options;
|
|
1251
1302
|
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)
|
|
1252
1303
|
|| (typeof fromItemId === 'string' && fromItemId > '-1');
|
|
1253
1304
|
let leftItemsOffset = 0, rightItemsOffset = 0;
|
|
@@ -1307,21 +1358,21 @@ class TrackBox extends CacheMap {
|
|
|
1307
1358
|
totalSize += componentSize;
|
|
1308
1359
|
if (isFromId) {
|
|
1309
1360
|
if (itemById === undefined) {
|
|
1310
|
-
if (id !== fromItemId &&
|
|
1361
|
+
if (id !== fromItemId && itemConfigMap && itemConfigMap[id]?.sticky === 1) {
|
|
1311
1362
|
stickyComponentSize = componentSize;
|
|
1312
1363
|
stickyCollectionItem = collectionItem;
|
|
1313
1364
|
}
|
|
1314
1365
|
if (id === fromItemId) {
|
|
1315
1366
|
isFromItemIdFound = true;
|
|
1316
1367
|
targetDisplayItemIndex = i;
|
|
1317
|
-
if (stickyCollectionItem &&
|
|
1368
|
+
if (stickyCollectionItem && itemConfigMap) {
|
|
1318
1369
|
const { num } = this.getElementNumToEnd(i, collection, map, typicalItemSize, size, isVertical);
|
|
1319
1370
|
if (num > 0) {
|
|
1320
1371
|
isTargetInOverscroll = true;
|
|
1321
1372
|
y -= size - componentSize;
|
|
1322
1373
|
}
|
|
1323
1374
|
else {
|
|
1324
|
-
if (
|
|
1375
|
+
if (itemConfigMap && !itemConfigMap[collectionItem.id] && y >= scrollSize && y < scrollSize + stickyComponentSize) {
|
|
1325
1376
|
const snappedY = scrollSize - stickyComponentSize;
|
|
1326
1377
|
leftHiddenItemsWeight -= (snappedY - y);
|
|
1327
1378
|
y = snappedY;
|
|
@@ -1504,7 +1555,7 @@ class TrackBox extends CacheMap {
|
|
|
1504
1555
|
changes() {
|
|
1505
1556
|
this.bumpVersion();
|
|
1506
1557
|
}
|
|
1507
|
-
generateDisplayCollection(items,
|
|
1558
|
+
generateDisplayCollection(items, itemConfigMap, metrics) {
|
|
1508
1559
|
const { width, height, normalizedItemWidth, normalizedItemHeight, dynamicSize, itemsOnDisplayLength, itemsFromStartToScrollEnd, isVertical, renderItems: renderItemsLength, scrollSize, sizeProperty, snap, snippedPos, startPosition, totalLength, startIndex, typicalItemSize, } = metrics, displayItems = [];
|
|
1509
1560
|
if (items.length) {
|
|
1510
1561
|
const actualSnippedPosition = snippedPos, isSnappingMethodAdvanced = this.isSnappingMethodAdvanced, boundsSize = isVertical ? height : width, actualEndSnippedPosition = boundsSize;
|
|
@@ -1514,7 +1565,7 @@ class TrackBox extends CacheMap {
|
|
|
1514
1565
|
if (!items[i]) {
|
|
1515
1566
|
continue;
|
|
1516
1567
|
}
|
|
1517
|
-
const id = items[i].id, sticky =
|
|
1568
|
+
const id = items[i].id, sticky = itemConfigMap[id]?.sticky ?? 0, selectable = itemConfigMap[id]?.selectable ?? true, size = dynamicSize ? this.get(id)?.[sizeProperty] || typicalItemSize : typicalItemSize;
|
|
1518
1569
|
if (sticky === 1) {
|
|
1519
1570
|
const isOdd = i % 2 != 0, measures = {
|
|
1520
1571
|
x: isVertical ? 0 : actualSnippedPosition,
|
|
@@ -1526,6 +1577,7 @@ class TrackBox extends CacheMap {
|
|
|
1526
1577
|
odd: isOdd,
|
|
1527
1578
|
even: !isOdd,
|
|
1528
1579
|
isVertical,
|
|
1580
|
+
selectable,
|
|
1529
1581
|
sticky,
|
|
1530
1582
|
snap,
|
|
1531
1583
|
snapped: true,
|
|
@@ -1549,7 +1601,7 @@ class TrackBox extends CacheMap {
|
|
|
1549
1601
|
if (!items[i]) {
|
|
1550
1602
|
continue;
|
|
1551
1603
|
}
|
|
1552
|
-
const id = items[i].id, sticky =
|
|
1604
|
+
const id = items[i].id, sticky = itemConfigMap[id]?.sticky ?? 0, selectable = itemConfigMap[id]?.selectable ?? true, size = dynamicSize
|
|
1553
1605
|
? this.get(id)?.[sizeProperty] || typicalItemSize
|
|
1554
1606
|
: typicalItemSize;
|
|
1555
1607
|
if (sticky === 2) {
|
|
@@ -1563,6 +1615,7 @@ class TrackBox extends CacheMap {
|
|
|
1563
1615
|
odd: isOdd,
|
|
1564
1616
|
even: !isOdd,
|
|
1565
1617
|
isVertical,
|
|
1618
|
+
selectable,
|
|
1566
1619
|
sticky,
|
|
1567
1620
|
snap,
|
|
1568
1621
|
snapped: true,
|
|
@@ -1590,9 +1643,9 @@ class TrackBox extends CacheMap {
|
|
|
1590
1643
|
}
|
|
1591
1644
|
const id = items[i].id, size = dynamicSize ? this.get(id)?.[sizeProperty] || typicalItemSize : typicalItemSize;
|
|
1592
1645
|
if (id !== stickyItem?.id && id !== endStickyItem?.id) {
|
|
1593
|
-
const isOdd = i % 2 != 0, snapped = snap && (
|
|
1594
|
-
x: isVertical ?
|
|
1595
|
-
y: isVertical ? pos :
|
|
1646
|
+
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 = {
|
|
1647
|
+
x: isVertical ? sticky === 1 ? 0 : boundsSize - size : pos,
|
|
1648
|
+
y: isVertical ? pos : sticky === 2 ? boundsSize - size : 0,
|
|
1596
1649
|
width: isVertical ? normalizedItemWidth : size,
|
|
1597
1650
|
height: isVertical ? size : normalizedItemHeight,
|
|
1598
1651
|
delta: 0,
|
|
@@ -1600,7 +1653,8 @@ class TrackBox extends CacheMap {
|
|
|
1600
1653
|
odd: isOdd,
|
|
1601
1654
|
even: !isOdd,
|
|
1602
1655
|
isVertical,
|
|
1603
|
-
|
|
1656
|
+
selectable,
|
|
1657
|
+
sticky: sticky,
|
|
1604
1658
|
snap,
|
|
1605
1659
|
snapped: false,
|
|
1606
1660
|
snappedOut: false,
|
|
@@ -1613,7 +1667,7 @@ class TrackBox extends CacheMap {
|
|
|
1613
1667
|
}
|
|
1614
1668
|
const itemData = items[i];
|
|
1615
1669
|
const item = { index: i, id, measures, data: itemData, config };
|
|
1616
|
-
if (!nextSticky && stickyItemIndex < i &&
|
|
1670
|
+
if (!nextSticky && stickyItemIndex < i && sticky === 1 && (pos <= scrollSize + size + stickyItemSize)) {
|
|
1617
1671
|
item.measures.x = isVertical ? 0 : snapped ? actualSnippedPosition : pos;
|
|
1618
1672
|
item.measures.y = isVertical ? snapped ? actualSnippedPosition : pos : 0;
|
|
1619
1673
|
nextSticky = item;
|
|
@@ -1621,7 +1675,7 @@ class TrackBox extends CacheMap {
|
|
|
1621
1675
|
nextSticky.measures.delta = isVertical ? (item.measures.y - scrollSize) : (item.measures.x - scrollSize);
|
|
1622
1676
|
nextSticky.config.zIndex = '3';
|
|
1623
1677
|
}
|
|
1624
|
-
else if (!nextEndSticky && endStickyItemIndex > i &&
|
|
1678
|
+
else if (!nextEndSticky && endStickyItemIndex > i && sticky === 2 && (pos >= scrollSize + boundsSize - size - endStickyItemSize)) {
|
|
1625
1679
|
item.measures.x = isVertical ? 0 : snapped ? actualEndSnippedPosition - size : pos;
|
|
1626
1680
|
item.measures.y = isVertical ? snapped ? actualEndSnippedPosition - size : pos : 0;
|
|
1627
1681
|
nextEndSticky = item;
|
|
@@ -1820,6 +1874,8 @@ class NgVirtualListComponent extends DisposableComponent {
|
|
|
1820
1874
|
};
|
|
1821
1875
|
this._$selectedIds = new BehaviorSubject$1(undefined);
|
|
1822
1876
|
this.$selectedIds = this._$selectedIds.asObservable();
|
|
1877
|
+
this._$selectByClick = new BehaviorSubject$1(DEFAULT_SELECT_BY_CLICK);
|
|
1878
|
+
this.$selectByClick = this._$selectByClick.asObservable();
|
|
1823
1879
|
this._$snap = new BehaviorSubject$1(DEFAULT_SNAP);
|
|
1824
1880
|
this.$snap = this._$snap.asObservable();
|
|
1825
1881
|
this._$enabledBufferOptimization = new BehaviorSubject$1(DEFAULT_ENABLED_BUFFER_OPTIMIZATION);
|
|
@@ -1827,8 +1883,8 @@ class NgVirtualListComponent extends DisposableComponent {
|
|
|
1827
1883
|
this._$itemRenderer = new BehaviorSubject$1(undefined);
|
|
1828
1884
|
this.$itemRenderer = this._$itemRenderer.asObservable();
|
|
1829
1885
|
this._$renderer = new BehaviorSubject$1(undefined);
|
|
1830
|
-
this._$
|
|
1831
|
-
this.$
|
|
1886
|
+
this._$itemConfigMap = new BehaviorSubject$1({});
|
|
1887
|
+
this.$itemConfigMap = this._$itemConfigMap.asObservable();
|
|
1832
1888
|
this._itemSizeOptions = (v) => {
|
|
1833
1889
|
if (v === undefined) {
|
|
1834
1890
|
return DEFAULT_ITEM_SIZE;
|
|
@@ -1974,11 +2030,14 @@ class NgVirtualListComponent extends DisposableComponent {
|
|
|
1974
2030
|
this._$initialized = new BehaviorSubject$1(false);
|
|
1975
2031
|
this.$initialized = this._$initialized.asObservable();
|
|
1976
2032
|
this._trackBox.displayComponents = this._displayComponents;
|
|
1977
|
-
const $trackBy = this.$trackBy;
|
|
2033
|
+
const $trackBy = this.$trackBy, $selectByClick = this.$selectByClick;
|
|
2034
|
+
$selectByClick.pipe(takeUntil(this._$unsubscribe), tap(v => {
|
|
2035
|
+
this._service.selectByClick = v;
|
|
2036
|
+
})).subscribe();
|
|
1978
2037
|
$trackBy.pipe(takeUntil(this._$unsubscribe), tap(v => {
|
|
1979
2038
|
this._trackBox.trackingPropertyName = v;
|
|
1980
2039
|
})).subscribe();
|
|
1981
|
-
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)), $
|
|
2040
|
+
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;
|
|
1982
2041
|
$isVertical.pipe(takeUntil(this._$unsubscribe), tap(v => {
|
|
1983
2042
|
this._isVertical = v;
|
|
1984
2043
|
const el = this._elementRef.nativeElement;
|
|
@@ -1993,7 +2052,6 @@ class NgVirtualListComponent extends DisposableComponent {
|
|
|
1993
2052
|
this._isMultiSelecting = true;
|
|
1994
2053
|
this._isNotSelecting = this._isSingleSelecting = false;
|
|
1995
2054
|
if (el) {
|
|
1996
|
-
console.log('set role', ROLE_LIST_BOX);
|
|
1997
2055
|
el.setAttribute('role', ROLE_LIST_BOX);
|
|
1998
2056
|
}
|
|
1999
2057
|
this._service.methodOfSelecting = MethodsForSelectingTypes.MULTI_SELECT;
|
|
@@ -2002,7 +2060,6 @@ class NgVirtualListComponent extends DisposableComponent {
|
|
|
2002
2060
|
this._isSingleSelecting = true;
|
|
2003
2061
|
this._isNotSelecting = this._isMultiSelecting = false;
|
|
2004
2062
|
if (el) {
|
|
2005
|
-
console.log('set role', ROLE_LIST_BOX);
|
|
2006
2063
|
el.setAttribute('role', ROLE_LIST_BOX);
|
|
2007
2064
|
}
|
|
2008
2065
|
this._service.methodOfSelecting = MethodsForSelectingTypes.SELECT;
|
|
@@ -2011,7 +2068,6 @@ class NgVirtualListComponent extends DisposableComponent {
|
|
|
2011
2068
|
this._isNotSelecting = true;
|
|
2012
2069
|
this._isSingleSelecting = this._isMultiSelecting = false;
|
|
2013
2070
|
if (el) {
|
|
2014
|
-
console.log('set role', ROLE_LIST);
|
|
2015
2071
|
el.setAttribute('role', ROLE_LIST);
|
|
2016
2072
|
}
|
|
2017
2073
|
this._service.methodOfSelecting = MethodsForSelectingTypes.NONE;
|
|
@@ -2020,14 +2076,14 @@ class NgVirtualListComponent extends DisposableComponent {
|
|
|
2020
2076
|
$dynamicSize.pipe(takeUntil(this._$unsubscribe), tap(dynamicSize => {
|
|
2021
2077
|
this.listenCacheChangesIfNeed(dynamicSize);
|
|
2022
2078
|
})).subscribe();
|
|
2023
|
-
combineLatest([this.$initialized, $bounds, $items, $
|
|
2079
|
+
combineLatest([this.$initialized, $bounds, $items, $itemConfigMap, $scrollSize, $itemSize,
|
|
2024
2080
|
$bufferSize, $maxBufferSize, $snap, $isVertical, $dynamicSize, $enabledBufferOptimization, $cacheVersion,
|
|
2025
|
-
]).pipe(takeUntil(this._$unsubscribe), distinctUntilChanged(), filter(([initialized]) => !!initialized), switchMap(([, bounds, items,
|
|
2081
|
+
]).pipe(takeUntil(this._$unsubscribe), distinctUntilChanged(), filter(([initialized]) => !!initialized), switchMap(([, bounds, items, itemConfigMap, scrollSize, itemSize, bufferSize, maxBufferSize, snap, isVertical, dynamicSize, enabledBufferOptimization, cacheVersion,]) => {
|
|
2026
2082
|
let actualScrollSize = (this._isVertical ? this._container?.nativeElement.scrollTop ?? 0 : this._container?.nativeElement.scrollLeft) ?? 0;
|
|
2027
2083
|
const { width, height } = bounds, opts = {
|
|
2028
2084
|
bounds: { width, height }, dynamicSize, isVertical, itemSize,
|
|
2029
2085
|
bufferSize, maxBufferSize, scrollSize: actualScrollSize, snap, enabledBufferOptimization,
|
|
2030
|
-
}, { displayItems, totalSize } = this._trackBox.updateCollection(items,
|
|
2086
|
+
}, { displayItems, totalSize } = this._trackBox.updateCollection(items, itemConfigMap, opts);
|
|
2031
2087
|
this.resetBoundsSize(isVertical, totalSize);
|
|
2032
2088
|
this.createDisplayComponentsIfNeed(displayItems);
|
|
2033
2089
|
this.tracking();
|
|
@@ -2059,10 +2115,19 @@ class NgVirtualListComponent extends DisposableComponent {
|
|
|
2059
2115
|
this._service.$itemClick.pipe(takeUntil(this._$unsubscribe), tap(v => {
|
|
2060
2116
|
this.onItemClick.emit(v ?? undefined);
|
|
2061
2117
|
})).subscribe();
|
|
2062
|
-
|
|
2063
|
-
|
|
2118
|
+
let isSelectedIdsFirstEmit = 0;
|
|
2119
|
+
this._service.$selectedIds.pipe(takeUntil(this._$unsubscribe), distinctUntilChanged(), tap(v => {
|
|
2120
|
+
if (this.isSingleSelecting || (this.isMultiSelecting && isSelectedIdsFirstEmit >= 2)) {
|
|
2121
|
+
const curr = this._$selectedIds.getValue();
|
|
2122
|
+
if ((this.isSingleSelecting && JSON.stringify(v) !== JSON.stringify(curr)) || (isSelectedIdsFirstEmit === 2 && JSON.stringify(v) !== JSON.stringify(curr)) || isSelectedIdsFirstEmit > 2) {
|
|
2123
|
+
this.onSelect.emit(v);
|
|
2124
|
+
}
|
|
2125
|
+
}
|
|
2126
|
+
if (isSelectedIdsFirstEmit < 3) {
|
|
2127
|
+
isSelectedIdsFirstEmit++;
|
|
2128
|
+
}
|
|
2064
2129
|
})).subscribe();
|
|
2065
|
-
$selectedIds.pipe(takeUntil(this._$unsubscribe), tap(v => {
|
|
2130
|
+
$selectedIds.pipe(takeUntil(this._$unsubscribe), distinctUntilChanged(), tap(v => {
|
|
2066
2131
|
this._service.setSelectedIds(v);
|
|
2067
2132
|
})).subscribe();
|
|
2068
2133
|
}
|
|
@@ -2095,6 +2160,19 @@ class NgVirtualListComponent extends DisposableComponent {
|
|
|
2095
2160
|
}
|
|
2096
2161
|
;
|
|
2097
2162
|
get selectedIds() { return this._$selectedIds.getValue(); }
|
|
2163
|
+
/**
|
|
2164
|
+
* If false, the element is selected using the config.select method passed to the template;
|
|
2165
|
+
* if true, the element is selected by clicking on it. The default value is true.
|
|
2166
|
+
*/
|
|
2167
|
+
set selectByClick(v) {
|
|
2168
|
+
if (this._$selectByClick.getValue() === v) {
|
|
2169
|
+
return;
|
|
2170
|
+
}
|
|
2171
|
+
this._$selectByClick.next(v);
|
|
2172
|
+
this._cdr.markForCheck();
|
|
2173
|
+
}
|
|
2174
|
+
;
|
|
2175
|
+
get selectByClick() { return this._$selectByClick.getValue(); }
|
|
2098
2176
|
/**
|
|
2099
2177
|
* Determines whether elements will snap. Default value is "true".
|
|
2100
2178
|
*/
|
|
@@ -2135,18 +2213,22 @@ class NgVirtualListComponent extends DisposableComponent {
|
|
|
2135
2213
|
;
|
|
2136
2214
|
get itemRenderer() { return this._$itemRenderer.getValue(); }
|
|
2137
2215
|
/**
|
|
2138
|
-
*
|
|
2139
|
-
*
|
|
2216
|
+
* Sets sticky position and selectable for the list item element. If sticky position is greater than 0, then sticky position is applied.
|
|
2217
|
+
* 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`.
|
|
2218
|
+
* selectable determines whether an element can be selected or not. Default value is `true`.
|
|
2219
|
+
* @link https://github.com/DjonnyX/ng-virtual-list/blob/14.x/projects/ng-virtual-list/src/lib/models/item-config-map.model.ts
|
|
2220
|
+
* @author Evgenii Grebennikov
|
|
2221
|
+
* @email djonnyx@gmail.com
|
|
2140
2222
|
*/
|
|
2141
|
-
set
|
|
2142
|
-
if (this._$
|
|
2223
|
+
set itemConfigMap(v) {
|
|
2224
|
+
if (this._$itemConfigMap.getValue() === v) {
|
|
2143
2225
|
return;
|
|
2144
2226
|
}
|
|
2145
|
-
this._$
|
|
2227
|
+
this._$itemConfigMap.next(v);
|
|
2146
2228
|
this._cdr.markForCheck();
|
|
2147
2229
|
}
|
|
2148
2230
|
;
|
|
2149
|
-
get
|
|
2231
|
+
get itemConfigMap() { return this._$itemConfigMap.getValue(); }
|
|
2150
2232
|
/**
|
|
2151
2233
|
* If direction = 'vertical', then the height of a typical element. If direction = 'horizontal', then the width of a typical element.
|
|
2152
2234
|
* Ignored if the dynamicSize property is true.
|
|
@@ -2385,18 +2467,18 @@ class NgVirtualListComponent extends DisposableComponent {
|
|
|
2385
2467
|
if (container) {
|
|
2386
2468
|
container.nativeElement.removeEventListener(SCROLL, this._onScrollHandler);
|
|
2387
2469
|
}
|
|
2388
|
-
const { width, height } = this._$bounds.getValue() || { width: 0, height: 0 },
|
|
2470
|
+
const { width, height } = this._$bounds.getValue() || { width: 0, height: 0 }, itemConfigMap = this.itemConfigMap, items = this.items, isVertical = this._isVertical, delta = this._trackBox.delta, opts = {
|
|
2389
2471
|
bounds: { width, height }, collection: items, dynamicSize, isVertical: this._isVertical, itemSize,
|
|
2390
2472
|
bufferSize: this.bufferSize, maxBufferSize: this.maxBufferSize, scrollSize: (isVertical ? container.nativeElement.scrollTop : container.nativeElement.scrollLeft) + delta,
|
|
2391
2473
|
snap: this.snap, fromItemId: id, enabledBufferOptimization: this.enabledBufferOptimization,
|
|
2392
|
-
}, scrollSize = this._trackBox.getItemPosition(id,
|
|
2474
|
+
}, scrollSize = this._trackBox.getItemPosition(id, itemConfigMap, opts), params = { [isVertical ? TOP_PROP_NAME : LEFT_PROP_NAME]: scrollSize, behavior };
|
|
2393
2475
|
if (scrollSize === -1) {
|
|
2394
2476
|
container.nativeElement.addEventListener(SCROLL, this._onScrollHandler);
|
|
2395
2477
|
return;
|
|
2396
2478
|
}
|
|
2397
2479
|
this._trackBox.clearDelta();
|
|
2398
2480
|
if (container) {
|
|
2399
|
-
const { displayItems, totalSize } = this._trackBox.updateCollection(items,
|
|
2481
|
+
const { displayItems, totalSize } = this._trackBox.updateCollection(items, itemConfigMap, {
|
|
2400
2482
|
...opts, scrollSize, fromItemId: isLastIteration ? undefined : id,
|
|
2401
2483
|
}), delta = this._trackBox.delta;
|
|
2402
2484
|
this._trackBox.clearDelta();
|
|
@@ -2404,7 +2486,7 @@ class NgVirtualListComponent extends DisposableComponent {
|
|
|
2404
2486
|
this.resetBoundsSize(isVertical, totalSize);
|
|
2405
2487
|
this.createDisplayComponentsIfNeed(displayItems);
|
|
2406
2488
|
this.tracking();
|
|
2407
|
-
const _scrollSize = this._trackBox.getItemPosition(id,
|
|
2489
|
+
const _scrollSize = this._trackBox.getItemPosition(id, itemConfigMap, { ...opts, scrollSize: actualScrollSize, fromItemId: id });
|
|
2408
2490
|
if (_scrollSize === -1) {
|
|
2409
2491
|
container.nativeElement.addEventListener(SCROLL, this._onScrollHandler);
|
|
2410
2492
|
return;
|
|
@@ -2498,7 +2580,7 @@ class NgVirtualListComponent extends DisposableComponent {
|
|
|
2498
2580
|
}
|
|
2499
2581
|
NgVirtualListComponent.__nextId = 0;
|
|
2500
2582
|
NgVirtualListComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: NgVirtualListComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i0.ElementRef }, { token: NgVirtualListService }], target: i0.ɵɵFactoryTarget.Component });
|
|
2501
|
-
NgVirtualListComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", 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 }], usesInheritance: true, 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 });
|
|
2583
|
+
NgVirtualListComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", 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 }], usesInheritance: true, 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 });
|
|
2502
2584
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: NgVirtualListComponent, decorators: [{
|
|
2503
2585
|
type: Component,
|
|
2504
2586
|
args: [{ selector: 'ng-virtual-list', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.ShadowDom, providers: [NgVirtualListService], 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"] }]
|
|
@@ -2531,6 +2613,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
|
|
|
2531
2613
|
type: Input
|
|
2532
2614
|
}], selectedIds: [{
|
|
2533
2615
|
type: Input
|
|
2616
|
+
}], selectByClick: [{
|
|
2617
|
+
type: Input
|
|
2534
2618
|
}], snap: [{
|
|
2535
2619
|
type: Input
|
|
2536
2620
|
}], enabledBufferOptimization: [{
|
|
@@ -2539,6 +2623,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
|
|
|
2539
2623
|
type: Input
|
|
2540
2624
|
}], stickyMap: [{
|
|
2541
2625
|
type: Input
|
|
2626
|
+
}], itemConfigMap: [{
|
|
2627
|
+
type: Input
|
|
2542
2628
|
}], itemSize: [{
|
|
2543
2629
|
type: Input
|
|
2544
2630
|
}], dynamicSize: [{
|