ng-virtual-list 18.7.0 → 18.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 +18 -16
- package/esm2022/lib/components/ng-virtual-list-item.component.mjs +18 -5
- 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 +45 -19
- package/esm2022/lib/ng-virtual-list.service.mjs +46 -8
- package/esm2022/lib/utils/trackBox.mjs +22 -19
- package/fesm2022/ng-virtual-list.mjs +126 -46
- package/fesm2022/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 +20 -6
- 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
|
@@ -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';
|
|
@@ -155,6 +156,7 @@ class NgVirtualListService {
|
|
|
155
156
|
set methodOfSelecting(v) {
|
|
156
157
|
this._$methodOfSelecting.next(v);
|
|
157
158
|
}
|
|
159
|
+
selectByClick = DEFAULT_SELECT_BY_CLICK;
|
|
158
160
|
_trackBox;
|
|
159
161
|
constructor() {
|
|
160
162
|
this._$methodOfSelecting.pipe(takeUntilDestroyed(), tap(v => {
|
|
@@ -181,25 +183,61 @@ class NgVirtualListService {
|
|
|
181
183
|
})).subscribe();
|
|
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
191
|
this._$itemClick.next(data);
|
|
188
|
-
if (
|
|
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) {
|
|
189
203
|
switch (this._$methodOfSelecting.getValue()) {
|
|
190
204
|
case MethodsForSelectingTypes.SELECT: {
|
|
191
205
|
const curr = this._$selectedIds.getValue();
|
|
192
|
-
|
|
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
|
+
}
|
|
193
212
|
break;
|
|
194
213
|
}
|
|
195
214
|
case MethodsForSelectingTypes.MULTI_SELECT: {
|
|
196
215
|
const curr = [...(this._$selectedIds.getValue() || [])], index = curr.indexOf(data.id);
|
|
197
|
-
if (
|
|
198
|
-
|
|
199
|
-
|
|
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
|
+
}
|
|
200
232
|
}
|
|
201
233
|
else {
|
|
202
|
-
|
|
234
|
+
if (index > -1) {
|
|
235
|
+
curr.splice(index, 1);
|
|
236
|
+
this._$selectedIds.next(curr);
|
|
237
|
+
}
|
|
238
|
+
else {
|
|
239
|
+
this._$selectedIds.next(curr);
|
|
240
|
+
}
|
|
203
241
|
}
|
|
204
242
|
break;
|
|
205
243
|
}
|
|
@@ -243,6 +281,7 @@ class NgVirtualListItemComponent extends BaseVirtualListItemComponent {
|
|
|
243
281
|
_service = inject(NgVirtualListService);
|
|
244
282
|
_isSelected = false;
|
|
245
283
|
config = signal({});
|
|
284
|
+
measures = signal(undefined);
|
|
246
285
|
_part = PART_DEFAULT_ITEM;
|
|
247
286
|
get part() { return this._part; }
|
|
248
287
|
regular = false;
|
|
@@ -255,6 +294,7 @@ class NgVirtualListItemComponent extends BaseVirtualListItemComponent {
|
|
|
255
294
|
this._data = v;
|
|
256
295
|
this.updatePartStr(v, this._isSelected);
|
|
257
296
|
this.updateConfig(v);
|
|
297
|
+
this.updateMeasures(v);
|
|
258
298
|
this.update();
|
|
259
299
|
this.data.set(v);
|
|
260
300
|
this._cdr.detectChanges();
|
|
@@ -282,6 +322,14 @@ class NgVirtualListItemComponent extends BaseVirtualListItemComponent {
|
|
|
282
322
|
get element() {
|
|
283
323
|
return this._elementRef.nativeElement;
|
|
284
324
|
}
|
|
325
|
+
_selectHandler = (data) =>
|
|
326
|
+
/**
|
|
327
|
+
* Selects a list item
|
|
328
|
+
* @param selected - If the value is undefined, then the toggle method is executed, if false or true, then the selection/deselection is performed.
|
|
329
|
+
*/
|
|
330
|
+
(selected = undefined) => {
|
|
331
|
+
this._service.select(data, selected);
|
|
332
|
+
};
|
|
285
333
|
constructor() {
|
|
286
334
|
super();
|
|
287
335
|
this._id = this._service.generateComponentId();
|
|
@@ -309,11 +357,14 @@ class NgVirtualListItemComponent extends BaseVirtualListItemComponent {
|
|
|
309
357
|
}
|
|
310
358
|
this.updatePartStr(this._data, this._isSelected);
|
|
311
359
|
this.updateConfig(this._data);
|
|
360
|
+
this.updateMeasures(this._data);
|
|
312
361
|
})).subscribe();
|
|
313
362
|
}
|
|
363
|
+
updateMeasures(v) {
|
|
364
|
+
this.measures.set(v?.measures ? { ...v.measures } : undefined);
|
|
365
|
+
}
|
|
314
366
|
updateConfig(v) {
|
|
315
|
-
this.config.set({ ...v?.config || {}, selected: this._isSelected });
|
|
316
|
-
this._cdr.markForCheck();
|
|
367
|
+
this.config.set({ ...v?.config || {}, selected: this._isSelected, select: this._selectHandler(v) });
|
|
317
368
|
}
|
|
318
369
|
update() {
|
|
319
370
|
const data = this._data, regular = this.regular, length = this._regularLength;
|
|
@@ -398,14 +449,14 @@ class NgVirtualListItemComponent extends BaseVirtualListItemComponent {
|
|
|
398
449
|
this._service.itemClick(this._data);
|
|
399
450
|
}
|
|
400
451
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: NgVirtualListItemComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
401
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: NgVirtualListItemComponent, selector: "ng-virtual-list-item", host: { attributes: { "role": "listitem" }, classAttribute: "ngvl__item" }, usesInheritance: true, ngImport: i0, template: "@if (data(); as item) {\r\n <div #listItem [part]=\"part\" class=\"ngvl-item__container\" [ngClass]=\"{'snapped': item.config.snapped,\r\n 'snapped-out': item.config.snappedOut}\" (click)=\"onClickHandler()\">\r\n @if (itemRenderer(); as renderer) {\r\n <ng-container [ngTemplateOutlet]=\"renderer\"\r\n [ngTemplateOutletContext]=\"{data: item.data || {}, config: config()}\" />\r\n }\r\n </div>\r\n}\r\n", 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: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
452
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: NgVirtualListItemComponent, selector: "ng-virtual-list-item", host: { attributes: { "role": "listitem" }, classAttribute: "ngvl__item" }, usesInheritance: true, ngImport: i0, template: "@if (data(); as item) {\r\n <div #listItem [part]=\"part\" class=\"ngvl-item__container\" [ngClass]=\"{'snapped': item.config.snapped,\r\n 'snapped-out': item.config.snappedOut}\" (click)=\"onClickHandler()\">\r\n @if (itemRenderer(); as renderer) {\r\n <ng-container [ngTemplateOutlet]=\"renderer\"\r\n [ngTemplateOutletContext]=\"{data: item.data || {}, measures: measures(), config: config()}\" />\r\n }\r\n </div>\r\n}\r\n", 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: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
402
453
|
}
|
|
403
454
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: NgVirtualListItemComponent, decorators: [{
|
|
404
455
|
type: Component,
|
|
405
456
|
args: [{ selector: 'ng-virtual-list-item', standalone: false, host: {
|
|
406
457
|
'class': 'ngvl__item',
|
|
407
458
|
'role': 'listitem',
|
|
408
|
-
}, changeDetection: ChangeDetectionStrategy.OnPush, template: "@if (data(); as item) {\r\n <div #listItem [part]=\"part\" class=\"ngvl-item__container\" [ngClass]=\"{'snapped': item.config.snapped,\r\n 'snapped-out': item.config.snappedOut}\" (click)=\"onClickHandler()\">\r\n @if (itemRenderer(); as renderer) {\r\n <ng-container [ngTemplateOutlet]=\"renderer\"\r\n [ngTemplateOutletContext]=\"{data: item.data || {}, config: config()}\" />\r\n }\r\n </div>\r\n}\r\n", 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"] }]
|
|
459
|
+
}, changeDetection: ChangeDetectionStrategy.OnPush, template: "@if (data(); as item) {\r\n <div #listItem [part]=\"part\" class=\"ngvl-item__container\" [ngClass]=\"{'snapped': item.config.snapped,\r\n 'snapped-out': item.config.snappedOut}\" (click)=\"onClickHandler()\">\r\n @if (itemRenderer(); as renderer) {\r\n <ng-container [ngTemplateOutlet]=\"renderer\"\r\n [ngTemplateOutletContext]=\"{data: item.data || {}, measures: measures(), config: config()}\" />\r\n }\r\n </div>\r\n}\r\n", 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"] }]
|
|
409
460
|
}], ctorParameters: () => [] });
|
|
410
461
|
|
|
411
462
|
/**
|
|
@@ -1121,8 +1172,8 @@ class TrackBox extends CacheMap {
|
|
|
1121
1172
|
/**
|
|
1122
1173
|
* Finds the position of a collection element by the given Id
|
|
1123
1174
|
*/
|
|
1124
|
-
getItemPosition(id,
|
|
1125
|
-
const opt = { fromItemId: id,
|
|
1175
|
+
getItemPosition(id, itemConfigMap, options) {
|
|
1176
|
+
const opt = { fromItemId: id, itemConfigMap, ...options };
|
|
1126
1177
|
this._defaultBufferSize = opt.bufferSize;
|
|
1127
1178
|
this._maxBufferSize = opt.maxBufferSize;
|
|
1128
1179
|
const { scrollSize, isFromItemIdFound } = this.recalculateMetrics({
|
|
@@ -1137,8 +1188,8 @@ class TrackBox extends CacheMap {
|
|
|
1137
1188
|
/**
|
|
1138
1189
|
* Updates the collection of display objects
|
|
1139
1190
|
*/
|
|
1140
|
-
updateCollection(items,
|
|
1141
|
-
const opt = {
|
|
1191
|
+
updateCollection(items, itemConfigMap, options) {
|
|
1192
|
+
const opt = { itemConfigMap, ...options }, crudDetected = this._crudDetected, deletedItemsMap = this._deletedItemsMap;
|
|
1142
1193
|
if (opt.dynamicSize) {
|
|
1143
1194
|
this.cacheElements();
|
|
1144
1195
|
}
|
|
@@ -1159,7 +1210,7 @@ class TrackBox extends CacheMap {
|
|
|
1159
1210
|
if (opt.dynamicSize) {
|
|
1160
1211
|
this.snapshot();
|
|
1161
1212
|
}
|
|
1162
|
-
const displayItems = this.generateDisplayCollection(items,
|
|
1213
|
+
const displayItems = this.generateDisplayCollection(items, itemConfigMap, { ...metrics, });
|
|
1163
1214
|
return { displayItems, totalSize: metrics.totalSize, delta: metrics.delta, crudDetected };
|
|
1164
1215
|
}
|
|
1165
1216
|
/**
|
|
@@ -1240,7 +1291,7 @@ class TrackBox extends CacheMap {
|
|
|
1240
1291
|
* Calculates list metrics
|
|
1241
1292
|
*/
|
|
1242
1293
|
recalculateMetrics(options) {
|
|
1243
|
-
const { fromItemId, bounds, collection, dynamicSize, isVertical, itemSize, bufferSize: minBufferSize, scrollSize, snap,
|
|
1294
|
+
const { fromItemId, bounds, collection, dynamicSize, isVertical, itemSize, bufferSize: minBufferSize, scrollSize, snap, itemConfigMap, enabledBufferOptimization, previousTotalSize, crudDetected, deletedItemsMap } = options;
|
|
1244
1295
|
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)
|
|
1245
1296
|
|| (typeof fromItemId === 'string' && fromItemId > '-1');
|
|
1246
1297
|
let leftItemsOffset = 0, rightItemsOffset = 0;
|
|
@@ -1300,21 +1351,21 @@ class TrackBox extends CacheMap {
|
|
|
1300
1351
|
totalSize += componentSize;
|
|
1301
1352
|
if (isFromId) {
|
|
1302
1353
|
if (itemById === undefined) {
|
|
1303
|
-
if (id !== fromItemId &&
|
|
1354
|
+
if (id !== fromItemId && itemConfigMap && itemConfigMap[id]?.sticky === 1) {
|
|
1304
1355
|
stickyComponentSize = componentSize;
|
|
1305
1356
|
stickyCollectionItem = collectionItem;
|
|
1306
1357
|
}
|
|
1307
1358
|
if (id === fromItemId) {
|
|
1308
1359
|
isFromItemIdFound = true;
|
|
1309
1360
|
targetDisplayItemIndex = i;
|
|
1310
|
-
if (stickyCollectionItem &&
|
|
1361
|
+
if (stickyCollectionItem && itemConfigMap) {
|
|
1311
1362
|
const { num } = this.getElementNumToEnd(i, collection, map, typicalItemSize, size, isVertical);
|
|
1312
1363
|
if (num > 0) {
|
|
1313
1364
|
isTargetInOverscroll = true;
|
|
1314
1365
|
y -= size - componentSize;
|
|
1315
1366
|
}
|
|
1316
1367
|
else {
|
|
1317
|
-
if (
|
|
1368
|
+
if (itemConfigMap && !itemConfigMap[collectionItem.id] && y >= scrollSize && y < scrollSize + stickyComponentSize) {
|
|
1318
1369
|
const snappedY = scrollSize - stickyComponentSize;
|
|
1319
1370
|
leftHiddenItemsWeight -= (snappedY - y);
|
|
1320
1371
|
y = snappedY;
|
|
@@ -1497,7 +1548,7 @@ class TrackBox extends CacheMap {
|
|
|
1497
1548
|
changes() {
|
|
1498
1549
|
this.bumpVersion();
|
|
1499
1550
|
}
|
|
1500
|
-
generateDisplayCollection(items,
|
|
1551
|
+
generateDisplayCollection(items, itemConfigMap, metrics) {
|
|
1501
1552
|
const { width, height, normalizedItemWidth, normalizedItemHeight, dynamicSize, itemsOnDisplayLength, itemsFromStartToScrollEnd, isVertical, renderItems: renderItemsLength, scrollSize, sizeProperty, snap, snippedPos, startPosition, totalLength, startIndex, typicalItemSize, } = metrics, displayItems = [];
|
|
1502
1553
|
if (items.length) {
|
|
1503
1554
|
const actualSnippedPosition = snippedPos, isSnappingMethodAdvanced = this.isSnappingMethodAdvanced, boundsSize = isVertical ? height : width, actualEndSnippedPosition = boundsSize;
|
|
@@ -1507,7 +1558,7 @@ class TrackBox extends CacheMap {
|
|
|
1507
1558
|
if (!items[i]) {
|
|
1508
1559
|
continue;
|
|
1509
1560
|
}
|
|
1510
|
-
const id = items[i].id, sticky =
|
|
1561
|
+
const id = items[i].id, sticky = itemConfigMap[id]?.sticky ?? 0, selectable = itemConfigMap[id]?.selectable ?? true, size = dynamicSize ? this.get(id)?.[sizeProperty] || typicalItemSize : typicalItemSize;
|
|
1511
1562
|
if (sticky === 1) {
|
|
1512
1563
|
const isOdd = i % 2 != 0, measures = {
|
|
1513
1564
|
x: isVertical ? 0 : actualSnippedPosition,
|
|
@@ -1519,6 +1570,7 @@ class TrackBox extends CacheMap {
|
|
|
1519
1570
|
odd: isOdd,
|
|
1520
1571
|
even: !isOdd,
|
|
1521
1572
|
isVertical,
|
|
1573
|
+
selectable,
|
|
1522
1574
|
sticky,
|
|
1523
1575
|
snap,
|
|
1524
1576
|
snapped: true,
|
|
@@ -1542,7 +1594,7 @@ class TrackBox extends CacheMap {
|
|
|
1542
1594
|
if (!items[i]) {
|
|
1543
1595
|
continue;
|
|
1544
1596
|
}
|
|
1545
|
-
const id = items[i].id, sticky =
|
|
1597
|
+
const id = items[i].id, sticky = itemConfigMap[id]?.sticky ?? 0, selectable = itemConfigMap[id]?.selectable ?? true, size = dynamicSize
|
|
1546
1598
|
? this.get(id)?.[sizeProperty] || typicalItemSize
|
|
1547
1599
|
: typicalItemSize;
|
|
1548
1600
|
if (sticky === 2) {
|
|
@@ -1556,6 +1608,7 @@ class TrackBox extends CacheMap {
|
|
|
1556
1608
|
odd: isOdd,
|
|
1557
1609
|
even: !isOdd,
|
|
1558
1610
|
isVertical,
|
|
1611
|
+
selectable,
|
|
1559
1612
|
sticky,
|
|
1560
1613
|
snap,
|
|
1561
1614
|
snapped: true,
|
|
@@ -1583,9 +1636,9 @@ class TrackBox extends CacheMap {
|
|
|
1583
1636
|
}
|
|
1584
1637
|
const id = items[i].id, size = dynamicSize ? this.get(id)?.[sizeProperty] || typicalItemSize : typicalItemSize;
|
|
1585
1638
|
if (id !== stickyItem?.id && id !== endStickyItem?.id) {
|
|
1586
|
-
const isOdd = i % 2 != 0, snapped = snap && (
|
|
1587
|
-
x: isVertical ?
|
|
1588
|
-
y: isVertical ? pos :
|
|
1639
|
+
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 = {
|
|
1640
|
+
x: isVertical ? sticky === 1 ? 0 : boundsSize - size : pos,
|
|
1641
|
+
y: isVertical ? pos : sticky === 2 ? boundsSize - size : 0,
|
|
1589
1642
|
width: isVertical ? normalizedItemWidth : size,
|
|
1590
1643
|
height: isVertical ? size : normalizedItemHeight,
|
|
1591
1644
|
delta: 0,
|
|
@@ -1593,7 +1646,8 @@ class TrackBox extends CacheMap {
|
|
|
1593
1646
|
odd: isOdd,
|
|
1594
1647
|
even: !isOdd,
|
|
1595
1648
|
isVertical,
|
|
1596
|
-
|
|
1649
|
+
selectable,
|
|
1650
|
+
sticky: sticky,
|
|
1597
1651
|
snap,
|
|
1598
1652
|
snapped: false,
|
|
1599
1653
|
snappedOut: false,
|
|
@@ -1606,7 +1660,7 @@ class TrackBox extends CacheMap {
|
|
|
1606
1660
|
}
|
|
1607
1661
|
const itemData = items[i];
|
|
1608
1662
|
const item = { index: i, id, measures, data: itemData, config };
|
|
1609
|
-
if (!nextSticky && stickyItemIndex < i &&
|
|
1663
|
+
if (!nextSticky && stickyItemIndex < i && sticky === 1 && (pos <= scrollSize + size + stickyItemSize)) {
|
|
1610
1664
|
item.measures.x = isVertical ? 0 : snapped ? actualSnippedPosition : pos;
|
|
1611
1665
|
item.measures.y = isVertical ? snapped ? actualSnippedPosition : pos : 0;
|
|
1612
1666
|
nextSticky = item;
|
|
@@ -1614,7 +1668,7 @@ class TrackBox extends CacheMap {
|
|
|
1614
1668
|
nextSticky.measures.delta = isVertical ? (item.measures.y - scrollSize) : (item.measures.x - scrollSize);
|
|
1615
1669
|
nextSticky.config.zIndex = '3';
|
|
1616
1670
|
}
|
|
1617
|
-
else if (!nextEndSticky && endStickyItemIndex > i &&
|
|
1671
|
+
else if (!nextEndSticky && endStickyItemIndex > i && sticky === 2 && (pos >= scrollSize + boundsSize - size - endStickyItemSize)) {
|
|
1618
1672
|
item.measures.x = isVertical ? 0 : snapped ? actualEndSnippedPosition - size : pos;
|
|
1619
1673
|
item.measures.y = isVertical ? snapped ? actualEndSnippedPosition - size : pos : 0;
|
|
1620
1674
|
nextEndSticky = item;
|
|
@@ -1801,6 +1855,11 @@ class NgVirtualListComponent {
|
|
|
1801
1855
|
* Sets the selected items.
|
|
1802
1856
|
*/
|
|
1803
1857
|
selectedIds = input(undefined);
|
|
1858
|
+
/**
|
|
1859
|
+
* If false, the element is selected using the config.select method passed to the template;
|
|
1860
|
+
* if true, the element is selected by clicking on it. The default value is true.
|
|
1861
|
+
*/
|
|
1862
|
+
selectByClick = input(DEFAULT_SELECT_BY_CLICK);
|
|
1804
1863
|
/**
|
|
1805
1864
|
* Determines whether elements will snap. Default value is "true".
|
|
1806
1865
|
*/
|
|
@@ -1818,10 +1877,19 @@ class NgVirtualListComponent {
|
|
|
1818
1877
|
itemRenderer = input.required();
|
|
1819
1878
|
_itemRenderer = signal(undefined);
|
|
1820
1879
|
/**
|
|
1821
|
-
*
|
|
1822
|
-
*
|
|
1880
|
+
* @deprecated
|
|
1881
|
+
* Use `itemConfigMap` instead.
|
|
1882
|
+
*/
|
|
1883
|
+
stickyMap = input();
|
|
1884
|
+
/**
|
|
1885
|
+
* Sets sticky position and selectable for the list item element. If sticky position is greater than 0, then sticky position is applied.
|
|
1886
|
+
* 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`.
|
|
1887
|
+
* selectable determines whether an element can be selected or not. Default value is `true`.
|
|
1888
|
+
* @link https://github.com/DjonnyX/ng-virtual-list/blob/18.x/projects/ng-virtual-list/src/lib/models/item-config-map.model.ts
|
|
1889
|
+
* @author Evgenii Grebennikov
|
|
1890
|
+
* @email djonnyx@gmail.com
|
|
1823
1891
|
*/
|
|
1824
|
-
|
|
1892
|
+
itemConfigMap = input({});
|
|
1825
1893
|
_itemSizeOptions = {
|
|
1826
1894
|
transform: (v) => {
|
|
1827
1895
|
if (v === undefined) {
|
|
@@ -1881,7 +1949,7 @@ class NgVirtualListComponent {
|
|
|
1881
1949
|
*/
|
|
1882
1950
|
snappingMethod = input(DEFAULT_SNAPPING_METHOD);
|
|
1883
1951
|
/**
|
|
1884
|
-
* Method for selecting list items.
|
|
1952
|
+
* Method for selecting list items. Default value is 'none'.
|
|
1885
1953
|
* 'select' - List items are selected one by one.
|
|
1886
1954
|
* 'multi-select' - Multiple selection of list items.
|
|
1887
1955
|
* 'none' - List items are not selectable.
|
|
@@ -1990,11 +2058,14 @@ class NgVirtualListComponent {
|
|
|
1990
2058
|
this._initialized = signal(false);
|
|
1991
2059
|
this.$initialized = toObservable(this._initialized);
|
|
1992
2060
|
this._trackBox.displayComponents = this._displayComponents;
|
|
1993
|
-
const $trackBy = toObservable(this.trackBy);
|
|
2061
|
+
const $trackBy = toObservable(this.trackBy), $selectByClick = toObservable(this.selectByClick);
|
|
2062
|
+
$selectByClick.pipe(takeUntilDestroyed(), tap(v => {
|
|
2063
|
+
this._service.selectByClick = v;
|
|
2064
|
+
})).subscribe();
|
|
1994
2065
|
$trackBy.pipe(takeUntilDestroyed(), tap(v => {
|
|
1995
2066
|
this._trackBox.trackingPropertyName = v;
|
|
1996
2067
|
})).subscribe();
|
|
1997
|
-
const $bounds = toObservable(this._bounds).pipe(filter(b => !!b)), $items = toObservable(this.items).pipe(map(i => !i ? [] : i)), $scrollSize = toObservable(this._scrollSize), $itemSize = toObservable(this.itemSize).pipe(map(v => v <= 0 ? DEFAULT_ITEM_SIZE : v)), $bufferSize = toObservable(this.bufferSize).pipe(map(v => v < 0 ? DEFAULT_BUFFER_SIZE : v)), $maxBufferSize = toObservable(this.maxBufferSize).pipe(map(v => v < 0 ? DEFAULT_BUFFER_SIZE : v)), $
|
|
2068
|
+
const $bounds = toObservable(this._bounds).pipe(filter(b => !!b)), $items = toObservable(this.items).pipe(map(i => !i ? [] : i)), $scrollSize = toObservable(this._scrollSize), $itemSize = toObservable(this.itemSize).pipe(map(v => v <= 0 ? DEFAULT_ITEM_SIZE : v)), $bufferSize = toObservable(this.bufferSize).pipe(map(v => v < 0 ? DEFAULT_BUFFER_SIZE : v)), $maxBufferSize = toObservable(this.maxBufferSize).pipe(map(v => v < 0 ? DEFAULT_BUFFER_SIZE : v)), $itemConfigMap = toObservable(this.itemConfigMap).pipe(map(v => !v ? {} : v)), $snap = toObservable(this.snap), $isVertical = toObservable(this.direction).pipe(map(v => this.getIsVertical(v || DEFAULT_DIRECTION))), $dynamicSize = toObservable(this.dynamicSize), $enabledBufferOptimization = toObservable(this.enabledBufferOptimization), $snappingMethod = toObservable(this.snappingMethod).pipe(map(v => this.getIsSnappingMethodAdvanced(v || DEFAULT_SNAPPING_METHOD))), $methodForSelecting = toObservable(this.methodForSelecting), $selectedIds = toObservable(this.selectedIds), $cacheVersion = toObservable(this._cacheVersion);
|
|
1998
2069
|
$isVertical.pipe(takeUntilDestroyed(), tap(v => {
|
|
1999
2070
|
this._isVertical = v;
|
|
2000
2071
|
const el = this._elementRef.nativeElement;
|
|
@@ -2033,14 +2104,14 @@ class NgVirtualListComponent {
|
|
|
2033
2104
|
$dynamicSize.pipe(takeUntilDestroyed(), tap(dynamicSize => {
|
|
2034
2105
|
this.listenCacheChangesIfNeed(dynamicSize);
|
|
2035
2106
|
})).subscribe();
|
|
2036
|
-
combineLatest([this.$initialized, $bounds, $items, $
|
|
2107
|
+
combineLatest([this.$initialized, $bounds, $items, $itemConfigMap, $scrollSize, $itemSize,
|
|
2037
2108
|
$bufferSize, $maxBufferSize, $snap, $isVertical, $dynamicSize, $enabledBufferOptimization, $cacheVersion,
|
|
2038
|
-
]).pipe(takeUntilDestroyed(), distinctUntilChanged(), filter(([initialized]) => !!initialized), switchMap(([, bounds, items,
|
|
2109
|
+
]).pipe(takeUntilDestroyed(), distinctUntilChanged(), filter(([initialized]) => !!initialized), switchMap(([, bounds, items, itemConfigMap, scrollSize, itemSize, bufferSize, maxBufferSize, snap, isVertical, dynamicSize, enabledBufferOptimization, cacheVersion,]) => {
|
|
2039
2110
|
let actualScrollSize = (this._isVertical ? this._container()?.nativeElement.scrollTop ?? 0 : this._container()?.nativeElement.scrollLeft) ?? 0;
|
|
2040
2111
|
const { width, height } = bounds, opts = {
|
|
2041
2112
|
bounds: { width, height }, dynamicSize, isVertical, itemSize,
|
|
2042
2113
|
bufferSize, maxBufferSize, scrollSize: actualScrollSize, snap, enabledBufferOptimization,
|
|
2043
|
-
}, { displayItems, totalSize } = this._trackBox.updateCollection(items,
|
|
2114
|
+
}, { displayItems, totalSize } = this._trackBox.updateCollection(items, itemConfigMap, opts);
|
|
2044
2115
|
this.resetBoundsSize(isVertical, totalSize);
|
|
2045
2116
|
this.createDisplayComponentsIfNeed(displayItems);
|
|
2046
2117
|
this.tracking();
|
|
@@ -2072,10 +2143,19 @@ class NgVirtualListComponent {
|
|
|
2072
2143
|
this._service.$itemClick.pipe(takeUntilDestroyed(), tap(v => {
|
|
2073
2144
|
this.onItemClick.emit(v);
|
|
2074
2145
|
})).subscribe();
|
|
2075
|
-
|
|
2076
|
-
|
|
2146
|
+
let isSelectedIdsFirstEmit = 0;
|
|
2147
|
+
this._service.$selectedIds.pipe(takeUntilDestroyed(), distinctUntilChanged(), tap(v => {
|
|
2148
|
+
if (this.isSingleSelecting || (this.isMultiSelecting && isSelectedIdsFirstEmit >= 2)) {
|
|
2149
|
+
const curr = this.selectedIds();
|
|
2150
|
+
if ((this.isSingleSelecting && JSON.stringify(v) !== JSON.stringify(curr)) || (isSelectedIdsFirstEmit === 2 && JSON.stringify(v) !== JSON.stringify(curr)) || isSelectedIdsFirstEmit > 2) {
|
|
2151
|
+
this.onSelect.emit(v);
|
|
2152
|
+
}
|
|
2153
|
+
}
|
|
2154
|
+
if (isSelectedIdsFirstEmit < 3) {
|
|
2155
|
+
isSelectedIdsFirstEmit++;
|
|
2156
|
+
}
|
|
2077
2157
|
})).subscribe();
|
|
2078
|
-
$selectedIds.pipe(takeUntilDestroyed(), tap(v => {
|
|
2158
|
+
$selectedIds.pipe(takeUntilDestroyed(), distinctUntilChanged(), tap(v => {
|
|
2079
2159
|
this._service.setSelectedIds(v);
|
|
2080
2160
|
})).subscribe();
|
|
2081
2161
|
}
|
|
@@ -2205,19 +2285,19 @@ class NgVirtualListComponent {
|
|
|
2205
2285
|
if (container) {
|
|
2206
2286
|
container.nativeElement.removeEventListener(SCROLL, this._onScrollHandler);
|
|
2207
2287
|
}
|
|
2208
|
-
const { width, height } = this._bounds() || { width: DEFAULT_LIST_SIZE, height: DEFAULT_LIST_SIZE },
|
|
2288
|
+
const { width, height } = this._bounds() || { width: DEFAULT_LIST_SIZE, height: DEFAULT_LIST_SIZE }, itemConfigMap = this.itemConfigMap(), items = this.items(), isVertical = this._isVertical, delta = this._trackBox.delta, opts = {
|
|
2209
2289
|
bounds: { width, height }, collection: items, dynamicSize, isVertical: this._isVertical, itemSize,
|
|
2210
2290
|
bufferSize: this.bufferSize(), maxBufferSize: this.maxBufferSize(),
|
|
2211
2291
|
scrollSize: (isVertical ? container.nativeElement.scrollTop : container.nativeElement.scrollLeft) + delta,
|
|
2212
2292
|
snap: this.snap(), fromItemId: id, enabledBufferOptimization: this.enabledBufferOptimization(),
|
|
2213
|
-
}, scrollSize = this._trackBox.getItemPosition(id,
|
|
2293
|
+
}, scrollSize = this._trackBox.getItemPosition(id, itemConfigMap, opts), params = { [isVertical ? TOP_PROP_NAME : LEFT_PROP_NAME]: scrollSize, behavior };
|
|
2214
2294
|
if (scrollSize === -1) {
|
|
2215
2295
|
container.nativeElement.addEventListener(SCROLL, this._onScrollHandler);
|
|
2216
2296
|
return;
|
|
2217
2297
|
}
|
|
2218
2298
|
this._trackBox.clearDelta();
|
|
2219
2299
|
if (container) {
|
|
2220
|
-
const { displayItems, totalSize } = this._trackBox.updateCollection(items,
|
|
2300
|
+
const { displayItems, totalSize } = this._trackBox.updateCollection(items, itemConfigMap, {
|
|
2221
2301
|
...opts, scrollSize, fromItemId: isLastIteration ? undefined : id,
|
|
2222
2302
|
}), delta = this._trackBox.delta;
|
|
2223
2303
|
this._trackBox.clearDelta();
|
|
@@ -2225,7 +2305,7 @@ class NgVirtualListComponent {
|
|
|
2225
2305
|
this.resetBoundsSize(isVertical, totalSize);
|
|
2226
2306
|
this.createDisplayComponentsIfNeed(displayItems);
|
|
2227
2307
|
this.tracking();
|
|
2228
|
-
const _scrollSize = this._trackBox.getItemPosition(id,
|
|
2308
|
+
const _scrollSize = this._trackBox.getItemPosition(id, itemConfigMap, { ...opts, scrollSize: actualScrollSize, fromItemId: id });
|
|
2229
2309
|
if (_scrollSize === -1) {
|
|
2230
2310
|
container.nativeElement.addEventListener(SCROLL, this._onScrollHandler);
|
|
2231
2311
|
return;
|
|
@@ -2339,7 +2419,7 @@ class NgVirtualListComponent {
|
|
|
2339
2419
|
}
|
|
2340
2420
|
}
|
|
2341
2421
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: NgVirtualListComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2342
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: NgVirtualListComponent, selector: "ng-virtual-list", inputs: { items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: true, transformFunction: null }, selectedIds: { classPropertyName: "selectedIds", publicName: "selectedIds", isSignal: true, isRequired: false, transformFunction: null }, snap: { classPropertyName: "snap", publicName: "snap", isSignal: true, isRequired: false, transformFunction: null }, enabledBufferOptimization: { classPropertyName: "enabledBufferOptimization", publicName: "enabledBufferOptimization", isSignal: true, isRequired: false, transformFunction: null }, itemRenderer: { classPropertyName: "itemRenderer", publicName: "itemRenderer", isSignal: true, isRequired: true, transformFunction: null }, stickyMap: { classPropertyName: "stickyMap", publicName: "stickyMap", isSignal: true, isRequired: false, transformFunction: null }, itemSize: { classPropertyName: "itemSize", publicName: "itemSize", isSignal: true, isRequired: false, transformFunction: null }, dynamicSize: { classPropertyName: "dynamicSize", publicName: "dynamicSize", isSignal: true, isRequired: false, transformFunction: null }, direction: { classPropertyName: "direction", publicName: "direction", isSignal: true, isRequired: false, transformFunction: null }, itemsOffset: { classPropertyName: "itemsOffset", publicName: "itemsOffset", isSignal: true, isRequired: false, transformFunction: null }, bufferSize: { classPropertyName: "bufferSize", publicName: "bufferSize", isSignal: true, isRequired: false, transformFunction: null }, maxBufferSize: { classPropertyName: "maxBufferSize", publicName: "maxBufferSize", isSignal: true, isRequired: false, transformFunction: null }, snappingMethod: { classPropertyName: "snappingMethod", publicName: "snappingMethod", isSignal: true, isRequired: false, transformFunction: null }, methodForSelecting: { classPropertyName: "methodForSelecting", publicName: "methodForSelecting", isSignal: true, isRequired: false, transformFunction: null }, trackBy: { classPropertyName: "trackBy", publicName: "trackBy", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onScroll: "onScroll", onScrollEnd: "onScrollEnd", onViewportChange: "onViewportChange", onItemClick: "onItemClick", onSelect: "onSelect" }, providers: [NgVirtualListService], viewQueries: [{ propertyName: "_snappedContainer", first: true, predicate: ["snapped"], descendants: true, isSignal: true }, { propertyName: "_container", first: true, predicate: ["container"], descendants: true, isSignal: true }, { propertyName: "_list", first: true, predicate: ["list"], descendants: true, isSignal: true }, { propertyName: "_listContainerRef", first: true, predicate: ["renderersContainer"], descendants: true, read: ViewContainerRef }, { propertyName: "_snapContainerRef", first: true, predicate: ["snapRendererContainer"], descendants: true, read: ViewContainerRef }], ngImport: i0, template: "@if (snap()) {\r\n <div #snapped part=\"snapped-item\" class=\"ngvl__list-snapper\">\r\n <ng-container #snapRendererContainer></ng-container>\r\n </div>\r\n}\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"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.ShadowDom });
|
|
2422
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: NgVirtualListComponent, selector: "ng-virtual-list", inputs: { items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: true, transformFunction: null }, selectedIds: { classPropertyName: "selectedIds", publicName: "selectedIds", isSignal: true, isRequired: false, transformFunction: null }, selectByClick: { classPropertyName: "selectByClick", publicName: "selectByClick", isSignal: true, isRequired: false, transformFunction: null }, snap: { classPropertyName: "snap", publicName: "snap", isSignal: true, isRequired: false, transformFunction: null }, enabledBufferOptimization: { classPropertyName: "enabledBufferOptimization", publicName: "enabledBufferOptimization", isSignal: true, isRequired: false, transformFunction: null }, itemRenderer: { classPropertyName: "itemRenderer", publicName: "itemRenderer", isSignal: true, isRequired: true, transformFunction: null }, stickyMap: { classPropertyName: "stickyMap", publicName: "stickyMap", isSignal: true, isRequired: false, transformFunction: null }, itemConfigMap: { classPropertyName: "itemConfigMap", publicName: "itemConfigMap", isSignal: true, isRequired: false, transformFunction: null }, itemSize: { classPropertyName: "itemSize", publicName: "itemSize", isSignal: true, isRequired: false, transformFunction: null }, dynamicSize: { classPropertyName: "dynamicSize", publicName: "dynamicSize", isSignal: true, isRequired: false, transformFunction: null }, direction: { classPropertyName: "direction", publicName: "direction", isSignal: true, isRequired: false, transformFunction: null }, itemsOffset: { classPropertyName: "itemsOffset", publicName: "itemsOffset", isSignal: true, isRequired: false, transformFunction: null }, bufferSize: { classPropertyName: "bufferSize", publicName: "bufferSize", isSignal: true, isRequired: false, transformFunction: null }, maxBufferSize: { classPropertyName: "maxBufferSize", publicName: "maxBufferSize", isSignal: true, isRequired: false, transformFunction: null }, snappingMethod: { classPropertyName: "snappingMethod", publicName: "snappingMethod", isSignal: true, isRequired: false, transformFunction: null }, methodForSelecting: { classPropertyName: "methodForSelecting", publicName: "methodForSelecting", isSignal: true, isRequired: false, transformFunction: null }, trackBy: { classPropertyName: "trackBy", publicName: "trackBy", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onScroll: "onScroll", onScrollEnd: "onScrollEnd", onViewportChange: "onViewportChange", onItemClick: "onItemClick", onSelect: "onSelect" }, providers: [NgVirtualListService], viewQueries: [{ propertyName: "_snappedContainer", first: true, predicate: ["snapped"], descendants: true, isSignal: true }, { propertyName: "_container", first: true, predicate: ["container"], descendants: true, isSignal: true }, { propertyName: "_list", first: true, predicate: ["list"], descendants: true, isSignal: true }, { propertyName: "_listContainerRef", first: true, predicate: ["renderersContainer"], descendants: true, read: ViewContainerRef }, { propertyName: "_snapContainerRef", first: true, predicate: ["snapRendererContainer"], descendants: true, read: ViewContainerRef }], ngImport: i0, template: "@if (snap()) {\r\n <div #snapped part=\"snapped-item\" class=\"ngvl__list-snapper\">\r\n <ng-container #snapRendererContainer></ng-container>\r\n </div>\r\n}\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"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.ShadowDom });
|
|
2343
2423
|
}
|
|
2344
2424
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: NgVirtualListComponent, decorators: [{
|
|
2345
2425
|
type: Component,
|