ng-virtual-list 14.7.12 → 14.7.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import { MethodsForSelecting, SnappingMethods } from "../enums";
1
+ import { CollectionModes, MethodsForSelecting, SnappingMethods } from "../enums";
2
2
  import { Directions } from "../enums/directions";
3
3
  export declare const DEFAULT_ITEM_SIZE = 24;
4
4
  export declare const DEFAULT_BUFFER_SIZE = 2;
@@ -11,6 +11,7 @@ export declare const DEFAULT_ENABLED_BUFFER_OPTIMIZATION = false;
11
11
  export declare const DEFAULT_DYNAMIC_SIZE = false;
12
12
  export declare const TRACK_BY_PROPERTY_NAME = "id";
13
13
  export declare const DEFAULT_DIRECTION = Directions.VERTICAL;
14
+ export declare const DEFAULT_COLLECTION_MODE = CollectionModes.NORMAL;
14
15
  export declare const DISPLAY_OBJECTS_LENGTH_MESUREMENT_ERROR = 1;
15
16
  export declare const MAX_SCROLL_TO_ITERATIONS = 5;
16
17
  export declare const DEFAULT_SNAPPING_METHOD = SnappingMethods.NORMAL;
@@ -0,0 +1,8 @@
1
+ import { CollectionModes } from "./collection-modes";
2
+ /**
3
+ * Action modes for collection elements.
4
+ * @link https://github.com/DjonnyX/ng-virtual-list/blob/14.x/projects/ng-virtual-list/src/lib/enums/collection-mode.ts
5
+ * @author Evgenii Grebennikov
6
+ * @email djonnyx@gmail.com
7
+ */
8
+ export declare type CollectionMode = CollectionModes | 'normal' | 'lazy';
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Action modes for collection elements.
3
+ * @link https://github.com/DjonnyX/ng-virtual-list/blob/14.x/projects/ng-virtual-list/src/lib/enums/collection-modes.ts
4
+ * @author Evgenii Grebennikov
5
+ * @email djonnyx@gmail.com
6
+ */
7
+ export declare enum CollectionModes {
8
+ /**
9
+ * When adding elements to the beginning of the collection, the scroll remains at the current position.
10
+ */
11
+ NORMAL = "normal",
12
+ /**
13
+ * When adding elements to the beginning of the collection, the scroll is shifted by the sum of the sizes of the new elements.
14
+ */
15
+ LAZY = "lazy"
16
+ }
@@ -1,8 +1,10 @@
1
+ import { CollectionMode } from "./collection-mode";
2
+ import { CollectionModes } from "./collection-modes";
1
3
  import { Directions } from "./directions";
2
4
  import { Direction } from "./direction";
3
5
  import { MethodsForSelecting } from "./methods-for-selecting";
4
6
  import { MethodForSelecting } from "./method-for-selecting";
5
7
  import { SnappingMethods } from "./snapping-methods";
6
8
  import { SnappingMethod } from "./snapping-method";
7
- export { Directions, MethodsForSelecting, SnappingMethods, };
8
- export type { Direction, MethodForSelecting, SnappingMethod, };
9
+ export { CollectionModes, Directions, MethodsForSelecting, SnappingMethods, };
10
+ export type { CollectionMode, Direction, MethodForSelecting, SnappingMethod, };
@@ -1,7 +1,7 @@
1
1
  import { AfterViewInit, ChangeDetectorRef, ElementRef, EventEmitter, OnDestroy, OnInit, TemplateRef } from '@angular/core';
2
2
  import { IRenderVirtualListItem, IScrollEvent, IVirtualListCollection, IVirtualListItemConfigMap } from './models';
3
3
  import { Id, ISize } from './types';
4
- import { Direction, Directions, MethodForSelecting, SnappingMethod } from './enums';
4
+ import { CollectionMode, Direction, Directions, MethodForSelecting, SnappingMethod } from './enums';
5
5
  import { DisposableComponent } from './utils/disposableComponent';
6
6
  import { NgVirtualListService } from './ng-virtual-list.service';
7
7
  import * as i0 from "@angular/core";
@@ -170,6 +170,14 @@ export declare class NgVirtualListComponent extends DisposableComponent implemen
170
170
  */
171
171
  set direction(v: Direction);
172
172
  get direction(): Direction;
173
+ private _$collectionMode;
174
+ readonly $collectionMode: import("rxjs").Observable<CollectionMode>;
175
+ private _collectionModeTransform;
176
+ /**
177
+ * Determines the action modes for collection elements. Default value is "normal".
178
+ */
179
+ set collectionMode(v: CollectionMode);
180
+ get collectionMode(): CollectionMode;
173
181
  private _$bufferSize;
174
182
  readonly $bufferSize: import("rxjs").Observable<number>;
175
183
  private _bufferSizeTransform;
@@ -218,6 +226,7 @@ export declare class NgVirtualListComponent extends DisposableComponent implemen
218
226
  set trackBy(v: string);
219
227
  get trackBy(): string;
220
228
  private _isVertical;
229
+ private _isLazy;
221
230
  get orientation(): Directions;
222
231
  private _$focusedElement;
223
232
  readonly $focusedElement: import("rxjs").Observable<Id | undefined>;
@@ -262,6 +271,8 @@ export declare class NgVirtualListComponent extends DisposableComponent implemen
262
271
  private _onTrackBoxChangeHandler;
263
272
  private _$cacheVersion;
264
273
  get $cacheVersion(): import("rxjs").Observable<number>;
274
+ private _isResetedReachStart;
275
+ private _onTrackBoxResetHandler;
265
276
  constructor(_cdr: ChangeDetectorRef, _elementRef: ElementRef<HTMLDivElement>, _service: NgVirtualListService);
266
277
  ngOnInit(): void;
267
278
  private onInit;
@@ -271,6 +282,7 @@ export declare class NgVirtualListComponent extends DisposableComponent implemen
271
282
  private getIsSingleSelecting;
272
283
  private getIsMultiSelecting;
273
284
  private getIsVertical;
285
+ private getIsLazy;
274
286
  private _componentsResizeObserver;
275
287
  private createDisplayComponentsIfNeed;
276
288
  private updateRegularRenderer;
@@ -303,5 +315,5 @@ export declare class NgVirtualListComponent extends DisposableComponent implemen
303
315
  ngOnDestroy(): void;
304
316
  private dispose;
305
317
  static ɵfac: i0.ɵɵFactoryDeclaration<NgVirtualListComponent, never>;
306
- static ɵcmp: i0.ɵɵComponentDeclaration<NgVirtualListComponent, "ng-virtual-list", never, { "items": "items"; "selectedIds": "selectedIds"; "collapsedIds": "collapsedIds"; "selectByClick": "selectByClick"; "collapseByClick": "collapseByClick"; "snap": "snap"; "enabledBufferOptimization": "enabledBufferOptimization"; "itemRenderer": "itemRenderer"; "itemConfigMap": "itemConfigMap"; "itemSize": "itemSize"; "dynamicSize": "dynamicSize"; "direction": "direction"; "bufferSize": "bufferSize"; "maxBufferSize": "maxBufferSize"; "snappingMethod": "snappingMethod"; "methodForSelecting": "methodForSelecting"; "trackBy": "trackBy"; }, { "onScroll": "onScroll"; "onScrollEnd": "onScrollEnd"; "onViewportChange": "onViewportChange"; "onItemClick": "onItemClick"; "onSelect": "onSelect"; "onCollapse": "onCollapse"; "onScrollReachStart": "onScrollReachStart"; "onScrollReachEnd": "onScrollReachEnd"; }, never, never, false>;
318
+ static ɵcmp: i0.ɵɵComponentDeclaration<NgVirtualListComponent, "ng-virtual-list", never, { "items": "items"; "selectedIds": "selectedIds"; "collapsedIds": "collapsedIds"; "selectByClick": "selectByClick"; "collapseByClick": "collapseByClick"; "snap": "snap"; "enabledBufferOptimization": "enabledBufferOptimization"; "itemRenderer": "itemRenderer"; "itemConfigMap": "itemConfigMap"; "itemSize": "itemSize"; "dynamicSize": "dynamicSize"; "direction": "direction"; "collectionMode": "collectionMode"; "bufferSize": "bufferSize"; "maxBufferSize": "maxBufferSize"; "snappingMethod": "snappingMethod"; "methodForSelecting": "methodForSelecting"; "trackBy": "trackBy"; }, { "onScroll": "onScroll"; "onScrollEnd": "onScrollEnd"; "onViewportChange": "onViewportChange"; "onItemClick": "onItemClick"; "onSelect": "onSelect"; "onCollapse": "onCollapse"; "onScrollReachStart": "onScrollReachStart"; "onScrollReachEnd": "onScrollReachEnd"; }, never, never, false>;
307
319
  }
@@ -0,0 +1,8 @@
1
+ import { CollectionMode } from "../enums";
2
+ /**
3
+ * Determines the axis membership of a virtual list
4
+ * @link https://github.com/DjonnyX/ng-virtual-list/blob/14.x/projects/ng-virtual-list/src/lib/utils/isCollectionMode.ts
5
+ * @author Evgenii Grebennikov
6
+ * @email djonnyx@gmail.com
7
+ */
8
+ export declare const isCollectionMode: (src: CollectionMode, expected: CollectionMode) => boolean;
@@ -7,7 +7,10 @@ import { ISize } from "../types";
7
7
  import { HEIGHT_PROP_NAME, WIDTH_PROP_NAME } from "../const";
8
8
  import { IVirtualListItemConfigMap } from "../models";
9
9
  import { BaseVirtualListItemComponent } from "../models/base-virtual-list-item-component";
10
- export declare const TRACK_BOX_CHANGE_EVENT_NAME = "change";
10
+ export declare enum TrackBoxEvents {
11
+ CHANGE = "change",
12
+ RESET = "reset"
13
+ }
11
14
  export interface IMetrics {
12
15
  delta: number;
13
16
  normalizedItemWidth: number;
@@ -68,9 +71,10 @@ export interface IUpdateCollectionOptions<I extends {
68
71
  id: Id;
69
72
  }, C extends Array<I>> extends Omit<IRecalculateMetricsOptions<I, C>, 'collection' | 'previousTotalSize' | 'crudDetected' | 'deletedItemsMap'> {
70
73
  }
71
- export declare type CacheMapEvents = typeof TRACK_BOX_CHANGE_EVENT_NAME;
74
+ export declare type CacheMapEvents = TrackBoxEvents.CHANGE | TrackBoxEvents.RESET;
72
75
  export declare type OnChangeEventListener = (version: number) => void;
73
- export declare type CacheMapListeners = OnChangeEventListener;
76
+ export declare type OnResetEventListener = (reseted: boolean) => void;
77
+ export declare type CacheMapListeners = OnChangeEventListener | OnResetEventListener;
74
78
  export declare enum ItemDisplayMethods {
75
79
  CREATE = 0,
76
80
  UPDATE = 1,
@@ -83,17 +87,18 @@ export interface IUpdateCollectionReturns {
83
87
  delta: number;
84
88
  crudDetected: boolean;
85
89
  }
90
+ declare type Cache = ISize & {
91
+ method?: ItemDisplayMethods;
92
+ } & {
93
+ [prop: string]: any;
94
+ };
86
95
  /**
87
96
  * An object that performs tracking, calculations and caching.
88
97
  * @link https://github.com/DjonnyX/ng-virtual-list/blob/14.x/projects/ng-virtual-list/src/lib/utils/trackBox.ts
89
98
  * @author Evgenii Grebennikov
90
99
  * @email djonnyx@gmail.com
91
100
  */
92
- export declare class TrackBox<C extends BaseVirtualListItemComponent = any> extends CacheMap<Id, ISize & {
93
- method?: ItemDisplayMethods;
94
- } & {
95
- [prop: string]: any;
96
- }, CacheMapEvents, CacheMapListeners> {
101
+ export declare class TrackBox<C extends BaseVirtualListItemComponent = any> extends CacheMap<Id, Cache, CacheMapEvents, CacheMapListeners> {
97
102
  protected _tracker: Tracker<C>;
98
103
  protected _items: IRenderVirtualListCollection | null | undefined;
99
104
  set items(v: IRenderVirtualListCollection | null | undefined);
@@ -103,6 +108,8 @@ export declare class TrackBox<C extends BaseVirtualListItemComponent = any> exte
103
108
  set snapedDisplayComponent(v: ComponentRef<C> | null | undefined);
104
109
  protected _isSnappingMethodAdvanced: boolean;
105
110
  set isSnappingMethodAdvanced(v: boolean);
111
+ protected _isLazy: boolean;
112
+ set isLazy(v: boolean);
106
113
  /**
107
114
  * Set the trackBy property
108
115
  */
@@ -133,7 +140,7 @@ export declare class TrackBox<C extends BaseVirtualListItemComponent = any> exte
133
140
  protected _maxBufferSize: number;
134
141
  protected _resetBufferSizeTimeout: number;
135
142
  protected _resetBufferSizeTimer: number | undefined;
136
- protected isInit: boolean;
143
+ protected isReseted: boolean;
137
144
  protected lifeCircle(): void;
138
145
  /**
139
146
  * Scans the collection for deleted items and flushes the deleted item cache.
@@ -208,3 +215,4 @@ export declare class TrackBox<C extends BaseVirtualListItemComponent = any> exte
208
215
  protected cacheElements(): void;
209
216
  dispose(): void;
210
217
  }
218
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ng-virtual-list",
3
- "version": "14.7.12",
3
+ "version": "14.7.13",
4
4
  "author": {
5
5
  "name": "Evgenii Grebennikov",
6
6
  "email": "djonnyx@gmail.com"