angular-layout-virtual 0.0.1

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 ADDED
@@ -0,0 +1,6 @@
1
+ # angular-layout-virtual
2
+
3
+ Angular virtual scrolling component for responsive lists and grids with dynamic item sizes.
4
+
5
+ - Homepage: [https://itihon.github.io/layout-virtual/](https://itihon.github.io/layout-virtual/)
6
+ - GitHub: [https://github.com/itihon/layout-virtual](https://github.com/itihon/layout-virtual)
@@ -0,0 +1,33 @@
1
+ /**
2
+ * @fileoverview VirtualizedList Angular component.
3
+ * @license MIT
4
+ * @author Alexandr Kalabin
5
+ */
6
+ import { TemplateRef } from '@angular/core';
7
+ import type { AfterViewInit } from '@angular/core';
8
+ import { type ListItemProps } from './AngularRenderer';
9
+ export type VirtualizedListItemContext<T> = ListItemProps<T> & {
10
+ $implicit: T;
11
+ };
12
+ export default class VirtualizedListAngular<T> implements AfterViewInit {
13
+ data: T[];
14
+ overscanHeight: number;
15
+ renderItemTemplate: TemplateRef<VirtualizedListItemContext<T>>;
16
+ private containerRef;
17
+ private scrollHeightFillerRef;
18
+ private viewportContainerRef;
19
+ private scrollCanvasRef;
20
+ private topSpacerRef;
21
+ private contentLayerRef;
22
+ private bottomSpacerRef;
23
+ private itemRefs;
24
+ visibleItems: ListItemProps<T>[];
25
+ private renderer;
26
+ private readonly changeDetectorRef;
27
+ ngAfterViewInit(): void;
28
+ trackByIndex(_position: number, item: ListItemProps<T>): number;
29
+ getItemContext(item: ListItemProps<T>): VirtualizedListItemContext<T>;
30
+ private setVisibleItems;
31
+ private flushVisibleItems;
32
+ private commit;
33
+ }
@@ -0,0 +1,41 @@
1
+ /**
2
+ * @fileoverview AngularRenderer.
3
+ * @license MIT
4
+ * @author Alexandr Kalabin
5
+ */
6
+ import { ScrollableContainer } from 'layout-virtual';
7
+ import type { IItem, IItemStore, IRangeRenderer, ScrollDirection, VirtualScrollStructure } from 'layout-virtual/types';
8
+ export interface ListItemProps<T = unknown> {
9
+ data: T;
10
+ index: number;
11
+ }
12
+ type AngularRendererOptions<T> = {
13
+ itemsSetter: (items: ListItemProps<T>[]) => void;
14
+ itemsFlusher: () => void;
15
+ } & VirtualScrollStructure;
16
+ export type AngularListItem<T = unknown> = {
17
+ data: T;
18
+ render?: unknown;
19
+ };
20
+ export default class AngularRenderer<T> implements IRangeRenderer<T> {
21
+ private _store;
22
+ private _scrollableContainer;
23
+ private _renderedIndexRegistry;
24
+ private _renderedItemsRegistry;
25
+ private _itemsSetter;
26
+ private _itemsFlusher;
27
+ private _listItems;
28
+ private _getRenderedBoundaryIndex;
29
+ constructor(opts: AngularRendererOptions<T>);
30
+ render(startIndex: number, endIndex: number, direction: ScrollDirection): number;
31
+ renderRange(startIndex: number, endIndex: number, direction: ScrollDirection): void;
32
+ removeRange(startIndex: number, endIndex: number, direction: ScrollDirection): number;
33
+ clear(): void;
34
+ getIndex(item: Element): number | undefined;
35
+ getItem(index: number): Element | undefined;
36
+ get scrollableContainer(): ScrollableContainer;
37
+ attach(store: IItemStore<IItem<T>>): void;
38
+ flush(): Promise<void>;
39
+ commit(renderedRefs: Map<number, Element>): void;
40
+ }
41
+ export {};
@@ -0,0 +1,6 @@
1
+ /**
2
+ * @fileoverview Package entry point
3
+ * @license MIT
4
+ * @author Alexandr Kalabin
5
+ */
6
+ export { default } from './AngularLayoutVirtual';