centrifugal 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/LICENSE +21 -0
- package/README.md +270 -0
- package/fesm2022/centrifugal.mjs +13007 -0
- package/fesm2022/centrifugal.mjs.map +1 -0
- package/index.d.ts +4337 -0
- package/package.json +53 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 djonnyx (Evgenii Alexandrovich Grebennikov)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
# Centrifugal
|
|
2
|
+
|
|
3
|
+
π A high-performance web-based development kit for POS and IoT devices. Smooth, customizable, and developer-friendly.
|
|
4
|
+
|
|
5
|
+
β‘A powerful API for implementing components of varying functionality and complexity.
|
|
6
|
+
|
|
7
|
+
π» Works correctly in all browsers and platforms.
|
|
8
|
+
|
|
9
|
+
πͺ The software portion of the project was completed without a single line of code written using AI (artificial intelligence)!
|
|
10
|
+
|
|
11
|
+
<img width="1033" height="171" alt="logo" src="https://github.com/user-attachments/assets/b559cfde-405a-4361-b71b-6715478d997d" />
|
|
12
|
+
|
|
13
|
+
<b>Angular version 20.X.X</b>.
|
|
14
|
+
|
|
15
|
+
[Documentation](https://centrifugal.eugene-grebennikov.pro/)
|
|
16
|
+
|
|
17
|
+
<br/>
|
|
18
|
+
|
|
19
|
+
## π¦ Installation
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npm i centrifugal
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
<br/>
|
|
26
|
+
|
|
27
|
+
## π Quick Start
|
|
28
|
+
```html
|
|
29
|
+
<cn-virtual-scroll-view #scrollView class="scroll-view" direction="both">
|
|
30
|
+
<div class="scroll-view__background" [style.width.px]="3000" [style.height.px]="3000" [class.grabbing]="scrollView.$grabbing | async"></div>
|
|
31
|
+
</cn-virtual-scroll-view>
|
|
32
|
+
|
|
33
|
+
<cn-virtual-list [items]="items" [bufferSize]="5" [itemRenderer]="itemRenderer" [dynamicSize]="false" [itemSize]="64"></cn-virtual-list>
|
|
34
|
+
|
|
35
|
+
<ng-template #itemRenderer let-data="data">
|
|
36
|
+
@if (data) {
|
|
37
|
+
<span>{{data.name}}</span>
|
|
38
|
+
}
|
|
39
|
+
</ng-template>
|
|
40
|
+
```
|
|
41
|
+
```ts
|
|
42
|
+
items = Array.from({ length: 100000 }, (_, i) => ({ id: i, name: `Item #${i}` }));
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
<br/>
|
|
46
|
+
|
|
47
|
+
## π API
|
|
48
|
+
|
|
49
|
+
### [CnVirtualSCrollViewComponent](https://github.com/DjonnyX/centrifugal/blob/main/src/lib/scroll-view/cn-virtual-scroll-view.component.ts)
|
|
50
|
+
|
|
51
|
+
Inputs
|
|
52
|
+
|
|
53
|
+
| Property | Type | Description |
|
|
54
|
+
|---|---|---|
|
|
55
|
+
| animationParams | [IAnimationParams](https://github.com/DjonnyX/centrifugal/blob/main/src/lib/scroll-view/interfaces/animation-params.ts)? = { scrollToItem: 150, navigateByKeyboard: 50 } | Animation parameters. The default value is "{ scrollToItem: 150, navigateByKeyboard: 50 }". |
|
|
56
|
+
| clickDistance | number? = 40 | The maximum scroll distance at which a click event is triggered. |
|
|
57
|
+
| direction | [Direction? = 'both'](https://github.com/DjonnyX/centrifugal/blob/main/src/lib/scroll-view/enums/direction.ts) | Determines the direction in which elements are placed. Default value is "both". |
|
|
58
|
+
| id | number | Readonly. Returns the unique identifier of the component. |
|
|
59
|
+
| langTextDir | [TextDirection? = 'ltr'](https://github.com/DjonnyX/centrifugal/blob/main/src/lib/common/enums/text-directions.ts) | A string indicating the direction of text for the locale. Can be either "ltr" (left-to-right) or "rtl" (right-to-left). |
|
|
60
|
+
| loading | boolean? = false | If `true`, the scrollBar goes into loading state. The default value is `false`. |
|
|
61
|
+
| maxMotionBlur | number = 0.5 | Maximum motion blur effect. The default value is `0.5`. |
|
|
62
|
+
| motionBlur | number \| 'disabled' = 0.15 | Motion blur effect. The default value is `0.25`. |
|
|
63
|
+
| motionBlurEnabled | boolean = false | Determines whether to apply motion blur or not. The default value is `false`. |
|
|
64
|
+
| overscrollEnabled | boolean? = true | Determines whether the overscroll (re-scroll) feature will work. The default value is "true". |
|
|
65
|
+
| overlappingScrollbar | boolean? = false | Determines whether the scroll bar will overlap the list. The default value is "false". |
|
|
66
|
+
| scrollLeftOffset | [FloatOrPersentageValue](https://github.com/DjonnyX/centrifugal/blob/main/src/lib/common/types/float-or-persentage-value.ts) = 0 | Sets the scroll left offset value. Can be specified in absolute or percentage values. Supports arithmetic expressions of addition `50% + 25` or subtraction `50% - 25`. Default value is "0". |
|
|
67
|
+
| scrollRightOffset | [FloatOrPersentageValue](https://github.com/DjonnyX/centrifugal/blob/main/src/lib/common/types/float-or-persentage-value.ts) = 0 | Sets the scroll right offset value. Can be specified in absolute or percentage values. Supports arithmetic expressions of addition `50% + 25` or subtraction `50% - 25`. Default value is "0". |
|
|
68
|
+
| scrollTopOffset | [FloatOrPersentageValue](https://github.com/DjonnyX/centrifugal/blob/main/src/lib/common/types/float-or-persentage-value.ts) = 0 | Sets the scroll top offset value. Can be specified in absolute or percentage values. Supports arithmetic expressions of addition `50% + 25` or subtraction `50% - 25`. Default value is "0". |
|
|
69
|
+
| scrollBottomOffset | [FloatOrPersentageValue](https://github.com/DjonnyX/centrifugal/blob/main/src/lib/common/types/float-or-persentage-value.ts) = 0 | Sets the scroll bottom offset value. Can be specified in absolute or percentage values. Supports arithmetic expressions of addition `50% + 25` or subtraction `50% - 25`. Default value is "0". |
|
|
70
|
+
| snapScrollToLeft | boolean? = true | Determines whether the scrollbar is snapped to the left of the scroller. The default value is "true". That is, if `snapScrollToLeft` and `snapScrollToRight` are enabled, the scroller will initially snap to the left; if you move the scrollbar right, the scroller will snap to the right. If `snapScrollToLeft` is disabled and `snapScrollToRight` is enabled, the scroller will snap to the right; If you move the scrollbar left, the scroller will snap to the left. If both `snapScrollToLeft` and `snapScrollToRight` are disabled, the scroller will never snap to the left or right. |
|
|
71
|
+
| snapScrollToRight | boolean? = true | Determines whether the scrollbar is snapped to the right of the scroller. The default value is "true". That is, if `snapScrollToRight` and `snapScrollToRight` are enabled, the scroller will initially snap to the left; if you move the scrollbar right, the scroller will snap to the right. If `snapScrollToLeft` is disabled and `snapScrollToRight` is enabled, the scroller will snap to the right; If you move the scrollbar left, the scroller will snap to the left. If both `snapScrollToLeft` and `snapScrollToRight` are disabled, the scroller will never snap to the left or right. |
|
|
72
|
+
| snapScrollToTop | boolean? = true | Determines whether the scrollbar is snapped to the top of the scroller. The default value is "true". That is, if `snapScrollToTop` and `snapScrollToBottom` are enabled, the scroller will initially snap to the top; if you move the scrollbar down, the scroller will snap to the bottom. If `snapScrollToTop` is disabled and `snapScrollToBottom` is enabled, the scroller will snap to the bottom; If you move the scrollbar up, the scroller will snap to the top. If both `snapScrollToTop` and `snapScrollToBottom` are disabled, the scroller will never snap to the top or bottom. |
|
|
73
|
+
| snapScrollToBottom | boolean? = true | Determines whether the scrollbar is snapped to the bottom of the scroller. The default value is "true". That is, if `snapScrollToTop` and `snapScrollToBottom` are enabled, the scroller will initially snap to the top; if you move the scrollbar down, the scroller will snap to the bottom. If `snapScrollToTop` is disabled and `snapScrollToBottom` is enabled, the scroller will snap to the bottom; If you move the scrollbar up, the scroller will snap to the top. If both `snapScrollToTop` and `snapScrollToBottom` are disabled, the scroller will never snap to the top or bottom. |
|
|
74
|
+
| scrollable | boolean? = true | Determines whether the scrollbar is shown or not. The default value is "true". |
|
|
75
|
+
| scrollbarEnabled | boolean? = true | Determines whether the scrollbar is shown or not. The default value is "true". |
|
|
76
|
+
| scrollbarInteractive | boolean? = true | Determines whether scrolling using the scrollbar will be possible. The default value is "true". |
|
|
77
|
+
| scrollbarMinSize | number? = 80 | Minimum scrollbar size. |
|
|
78
|
+
| scrollbarThickness | number? = 6 | Scrollbar thickness. |
|
|
79
|
+
| scrollbarThumbRenderer | TemplateRef<any> \| null = null | Scrollbar customization template. |
|
|
80
|
+
| scrollbarThumbParams | {[propName: string]: any;} \| null | Additional options for the scrollbar. |
|
|
81
|
+
| scrollBehavior | ScrollBehavior? = 'smooth' | Defines the scrolling behavior for any element on the page. The default value is "smooth". |
|
|
82
|
+
| scrollingSettings | [IScrollingSettings](https://github.com/DjonnyX/centrifugal/blob/main/src/lib/scroll-view/interfaces/scrolling-settings.ts) = {frictionalForce: 0.035, mass: 0.005, maxDistance: 100000, maxDuration: 4000, speedScale: 10, optimization: true} | Scrolling settings. |
|
|
83
|
+
|
|
84
|
+
<br/>
|
|
85
|
+
|
|
86
|
+
Outputs
|
|
87
|
+
|
|
88
|
+
| Event | Type | Description |
|
|
89
|
+
|---|---|---|
|
|
90
|
+
| onScroll | ([IScrollEvent](https://github.com/DjonnyX/centrifugal/blob/main/src/lib/scroll-view/interfaces/scroll-event.ts)) => void | Fires when the list has been scrolled. |
|
|
91
|
+
| onScrollEnd | ([IScrollEvent](https://github.com/DjonnyX/centrifugal/blob/main/src/lib/scroll-view/interfaces/scroll-event.ts)) => void | Fires when the list has completed scrolling. |
|
|
92
|
+
| onViewportChange | [ISize](https://github.com/DjonnyX/centrifugal/blob/main/src/lib/common/interfaces/size.ts) | Fires when the viewport size is changed. |
|
|
93
|
+
| onScrollReachLeft | void | Fires when the scroll reaches the left. |
|
|
94
|
+
| onScrollReachRight | void | Fires when the scroll reaches the right. |
|
|
95
|
+
| onScrollReachTop | void | Fires when the scroll reaches the top. |
|
|
96
|
+
| onScrollReachBottom | void | Fires when the scroll reaches the bottom. |
|
|
97
|
+
|
|
98
|
+
<br/>
|
|
99
|
+
|
|
100
|
+
Methods
|
|
101
|
+
|
|
102
|
+
| Method | Type | Description |
|
|
103
|
+
|--|--|--|
|
|
104
|
+
| scrollTo | (options: [IScrollOptions](https://github.com/DjonnyX/centrifugal/blob/main/src/lib/scroll-view/interfaces/scroll-options.ts)) => Array<number> \| null | The method scrolls the scroll view and returns the animation ids if the behavior is set to smooth or null if the behavior is set to auto, instant, or not set. |
|
|
105
|
+
|
|
106
|
+
<br/>
|
|
107
|
+
<br/>
|
|
108
|
+
|
|
109
|
+
### [CnVirtualListComponent](https://github.com/DjonnyX/centrifugal/blob/main/src/lib/list/cn-virtual-list.component.ts)
|
|
110
|
+
|
|
111
|
+
Inputs
|
|
112
|
+
|
|
113
|
+
| Property | Type | Description |
|
|
114
|
+
|---|---|---|
|
|
115
|
+
| alignment | [Alignment](https://github.com/DjonnyX/centrifugal/blob/main/src/lib/list/enums/alignment.ts) | Determines the alignment of the list. Two modes are available: `none` and `center`. The `center` mode aligns the list items to the center of the viewport, ideal for use with the `itemTransform` property. The `none` mode means no alignment. The default value is `none`. |
|
|
116
|
+
| animationParams | [IAnimationParams](https://github.com/DjonnyX/centrifugal/blob/main/src/lib/list/interfaces/animation-params.ts)? = { scrollToItem: 150, snapToItem: 150, navigateToItem: 150, navigateByKeyboard: 50 } | Animation parameters. The default value is "{ scrollToItem: 150, snapToItem: 150, navigateToItem: 150, navigateByKeyboard: 50 }". |
|
|
117
|
+
| bufferSize | number? = 2 | Number of elements outside the scope of visibility. Default value is 2. |
|
|
118
|
+
| clickDistance | number? = 40 | The maximum scroll distance at which a click event is triggered. |
|
|
119
|
+
| collapsedIds | Array<[Id](https://github.com/DjonnyX/centrifugal/blob/main/src/lib/common/types/id.ts)> | Sets the collapsed items. |
|
|
120
|
+
| collapseByClick | boolean? = true | If `false`, the element is collapsed using the config.collapse method passed to the template; if `true`, the element is collapsed by clicking on it. The default value is `true`. |
|
|
121
|
+
| collapsingMode | [CollapsingMode](https://github.com/DjonnyX/centrifugal/blob/main/src/lib/list/enums/collapsing-modes.ts) | Mode for collapsing list items. Default value is `none`. `none` - List items are not selectable. `multi-collapse` - List items are collapsed one by one. 'accordion' - Accordion collapsible list items. Default value is `multi-collapse`. |
|
|
122
|
+
| collectionMode | [CollectionMode? = 'normal'](https://github.com/DjonnyX/centrifugal/blob/main/src/lib/list/enums/collection-mode.ts) | Determines the action modes for collection elements. Default value is `normal`. |
|
|
123
|
+
| divides | number = 1 | Column or row numbers. The default value is `1`. |
|
|
124
|
+
| direction | [Direction? = 'vertical'](https://github.com/DjonnyX/centrifugal/blob/main/src/lib/list/enums/direction.ts) | Determines the direction in which elements are placed. Default value is "vertical". |
|
|
125
|
+
| dynamicSize | boolean? = true | If true, items in the list may have different sizes, and the itemSize property must be specified to adjust the sizes of items in the unallocated area. If false then the items in the list have a fixed size specified by the itemSize property. The default value is true. |
|
|
126
|
+
| enabledBufferOptimization | boolean? = false | Experimental! Enables buffer optimization. Can only be used if items in the collection are not added or updated. |
|
|
127
|
+
| id | number | Readonly. Returns the unique identifier of the component. |
|
|
128
|
+
| items | [IVirtualListCollection](https://github.com/DjonnyX/centrifugal/blob/main/src/lib/list/models/collection.model.ts) | Collection of list items. The collection of elements must be immutable. |
|
|
129
|
+
| itemSize | number \| 'viewport' = 24 | If direction = 'vertical', then the height of a typical element. If direction = 'horizontal', then the width of a typical element. If the dynamicSize property is true, the items in the list can have different sizes, and you must specify the itemSize property to adjust the sizes of the items in the unallocated area. If the value is 'viewport', the sizes of elements are automatically resized to fit the viewport size. |
|
|
130
|
+
| itemTransform | [ItemTransform](https://github.com/DjonnyX/centrifugal/blob/main/src/lib/list/types/item-transform.ts) \| null = null | Custom transformation of element's position, rotation, scale, opacity and zIndex. The default value is `null`. |
|
|
131
|
+
| itemRenderer | TemplateRef | Rendering element template. |
|
|
132
|
+
| itemConfigMap | [IVirtualListItemConfigMap?](https://github.com/DjonnyX/centrifugal/blob/main/src/lib/list/models/item-config-map.model.ts) | Sets `sticky` position, `fullSize`, `collapsable` and `selectable` for the list item element. If `sticky` position is greater than `0`, then `sticky` position is applied. 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`. `selectable` determines whether an element can be selected or not. Default value is `true`. `collapsable` determines whether an element with a `sticky` property greater than zero can collapse and collapse elements in front that do not have a `sticky` property. `fullSize` determines the size of an element when rendering lists with cell divisions. If sticky is 1 or 2, fullSize automatically becomes true. The default value is false. |
|
|
133
|
+
| langTextDir | [TextDirection? = 'ltr'](https://github.com/DjonnyX/centrifugal/blob/main/src/lib/common/enums/text-directions.ts) | A string indicating the direction of text for the locale. Can be either "ltr" (left-to-right) or "rtl" (right-to-left). |
|
|
134
|
+
| loading | boolean? = false | If `true`, the scrollBar goes into loading state. The default value is `false`. |
|
|
135
|
+
| maxBufferSize | number? = 10 | Maximum number of elements outside the scope of visibility. Default value is 10. If maxBufferSize is set to be greater than bufferSize, then adaptive buffer mode is enabled. The greater the scroll size, the more elements are allocated for rendering. |
|
|
136
|
+
| maxMotionBlur | number = 0.5 | Maximum motion blur effect. The default value is `0.5`. |
|
|
137
|
+
| selectingMode | [SelectingMode](https://github.com/DjonnyX/centrifugal/blob/main/src/lib/list/enums/selecting-mode.ts) | Method for selecting list items. Default value is 'none'. 'select' - List items are selected one by one. 'multi-select' - Multiple selection of list items. 'none' - List items are not selectable. |
|
|
138
|
+
| minItemSize | number \| 'viewport' = 1 | If the `dynamicSize` property is enabled, the minimum size of the element is set. If the value is 'viewport', the sizes of elements are automatically resized to fit the viewport size. |
|
|
139
|
+
| maxItemSize | number \| 'viewport' = Number.MAX_SAFE_INTEGER | If the `dynamicSize` property is enabled, the maximum size of the element is set. If the value is 'viewport', the sizes of elements are automatically resized to fit the viewport size. |
|
|
140
|
+
| motionBlur | number \| 'disabled' = 0.15 | Motion blur effect. The default value is `0.25`. |
|
|
141
|
+
| motionBlurEnabled | boolean = false | Determines whether to apply motion blur or not. The default value is `false`. |
|
|
142
|
+
| overscrollEnabled | boolean? = true | Determines whether the overscroll (re-scroll) feature will work. The default value is "true". |
|
|
143
|
+
| overlappingScrollbar | boolean? = false | Determines whether the scroll bar will overlap the list. The default value is "false". |
|
|
144
|
+
| selectByClick | boolean? = true | If `false`, the element is selected using the config.select method passed to the template; if `true`, the element is selected by clicking on it. The default value is `true`. |
|
|
145
|
+
| stickyEnabled | boolean? = false | Determines whether items with the given `sticky` in `itemConfigMap` will stick to the edges. Default value is "false". |
|
|
146
|
+
| selectedIds | Array<[Id](https://github.com/DjonnyX/centrifugal/blob/main/src/lib/common/types/id.ts)> \| [Id](https://github.com/DjonnyX/centrifugal/blob/main/src/lib/common/types/id.ts) \| null | Sets the selected items. |
|
|
147
|
+
| screenReaderMessage | string? = "Showing items $1 to $2" | Message for screen reader. The message format is: "some text `$1` some text `$2`", where `$1` is the number of the first element of the screen collection, `$2` is the number of the last element of the screen collection. |
|
|
148
|
+
| waitForPreparation | boolean? = true | If true, it will wait until the list items are fully prepared before displaying them.. The default value is `true`. |
|
|
149
|
+
| scrollStartOffset | [FloatOrPersentageValue](https://github.com/DjonnyX/centrifugal/blob/main/src/lib/common/types/float-or-persentage-value.ts) = 0 | Sets the scroll start offset value. Can be specified in absolute or percentage values. Supports arithmetic expressions of addition `50% + 25` or subtraction `50% - 25`. Default value is "0". |
|
|
150
|
+
| scrollEndOffset | [FloatOrPersentageValue](https://github.com/DjonnyX/centrifugal/blob/main/src/lib/common/types/float-or-persentage-value.ts) = 0 | Sets the scroll end offset value. Can be specified in absolute or percentage values. Supports arithmetic expressions of addition `50% + 25` or subtraction `50% - 25`. Default value is "0". |
|
|
151
|
+
| snapToItem | boolean = false | Snap to an item. The default value is `false`. |
|
|
152
|
+
| snapToItemAlign | [SnapToItemAlign](https://github.com/DjonnyX/centrifugal/blob/main/src/lib/list/enums/snap-to-item-align.ts) = [SnapToItemAligns](https://github.com/DjonnyX/centrifugal/blob/main/src/lib/list/enums/snap-to-item-aligns.ts).CENTER | Alignment for snapToItem. Available values ββare `start`, `center`, and `end`. The default value is `center`. |
|
|
153
|
+
| snappingDistance | [SnappingDistance](https://github.com/DjonnyX/centrifugal/blob/main/src/lib/list/types/snapping-distance.ts) = "25%" | Snapping activation distance. Can be specified as a percentage of the element size or in absolute values. The default value is `25%`. |
|
|
154
|
+
| snappingMethod | [SnappingMethod](https://github.com/DjonnyX/centrifugal/blob/main/src/lib/list/enums/snapping-method.ts) = [SnappingMethods.STANDART](https://github.com/DjonnyX/centrifugal/blob/main/src/lib/list/enums/snapping-methods.ts) | Snapping method. Default value is [SnappingMethods.STANDART](https://github.com/DjonnyX/centrifugal/blob/main/src/lib/list/enums/snapping-method.ts). [SnappingMethods.STANDART](https://github.com/DjonnyX/centrifugal/blob/main/src/lib/list/enums/snapping-method.ts) - Classic group visualization. [SnappingMethods.ADVANCED](https://github.com/DjonnyX/centrifugal/blob/main/src/lib/list/enums/snapping-method.ts) - A mask is applied to the viewport area so that the background is displayed underneath the attached group. |
|
|
155
|
+
| snapScrollToStart | boolean? = true | Determines whether the scroll will be anchored to the start of the list. Default value is "true". This property takes precedence over the snapScrollToEnd property. That is, if snapScrollToStart and snapScrollToEnd are enabled, the list will initially snap to the beginning; if you move the scroll bar to the end, the list will snap to the end. If snapScrollToStart is disabled and snapScrollToEnd is enabled, the list will snap to the end; if you move the scroll bar to the beginning, the list will snap to the beginning. If both snapScrollToStart and snapScrollToEnd are disabled, the list will never snap to the beginning or end. In the `spreadingMode=SpreadingModes.INFINITY` mode, the `snapScrollToStart` property is automatically disabled, since the list has no beginning or end. |
|
|
156
|
+
| snapScrollToEnd | boolean? = true | Determines whether the scroll will be anchored to the ΡΡΠ² of the list. Default value is "true". That is, if snapScrollToStart and snapScrollToEnd are enabled, the list will initially snap to the beginning; if you move the scroll bar to the end, the list will snap to the end. If snapScrollToStart is disabled and snapScrollToEnd is enabled, the list will snap to the end; if you move the scroll bar to the beginning, the list will snap to the beginning. If both snapScrollToStart and snapScrollToEnd are disabled, the list will never snap to the beginning or end. In the `spreadingMode=SpreadingModes.INFINITY` mode, the `snapScrollToEnd` property is automatically disabled, since the list has no beginning or end. |
|
|
157
|
+
| snapToEndTransitionInstantOffset | number? = 0 | Sets the offset value; if the scroll area value is exceeded, the scroll animation will be disabled. Default value is "0". |
|
|
158
|
+
| scrollbarEnabled | boolean? = true | Determines whether the scrollbar is shown or not. The default value is "true". |
|
|
159
|
+
| scrollbarInteractive | boolean? = true | Determines whether scrolling using the scrollbar will be possible. The default value is "true". |
|
|
160
|
+
| scrollbarMinSize | number? = 80 | Minimum scrollbar size. |
|
|
161
|
+
| scrollbarThickness | number? = 6 | Scrollbar thickness. |
|
|
162
|
+
| scrollbarThumbRenderer | TemplateRef<any> \| null = null | Scrollbar customization template. |
|
|
163
|
+
| scrollbarThumbParams | {[propName: string]: any;} \| null | Additional options for the scrollbar. |
|
|
164
|
+
| scrollBehavior | ScrollBehavior? = 'smooth' | Defines the scrolling behavior for any element on the page. The default value is "smooth". |
|
|
165
|
+
| scrollingSettings | [IScrollingSettings](https://github.com/DjonnyX/centrifugal/blob/main/src/lib/list/interfaces/scrolling-settings.ts) = {frictionalForce: 0.035, mass: 0.005, maxDistance: 100000, maxDuration: 4000, speedScale: 10, optimization: true} | Scrolling settings. |
|
|
166
|
+
| scrollingOneByOne | boolean = false | Specifies whether to scroll one item at a time if true and the scrollToItem property is set. The default value is `false`. |
|
|
167
|
+
| spreadingMode | [SpreadingMode](https://github.com/DjonnyX/centrifugal/blob/main/src/lib/list/enums/spreading-mode.ts) ='standart' | The order of list elements. Available values ββare `standard` and `infinity`. `normal` β list elements are ordered according to the collection sequence. `infinity` β list elements are ordered cyclically, forming an infinite list. When set to `infinity`, the `alignment` property is forced to the value `Alignments.CENTER`, the `scrollbarEnabled` property is forced to the `false`. The default value is `standard`. |
|
|
168
|
+
| trackBy | string? = 'id' | The name of the property by which tracking is performed. |
|
|
169
|
+
| zIndexWhenSelecting | string \| null = null | Defines the zIndex when a list item is selected. The default value is `null`. |
|
|
170
|
+
|
|
171
|
+
<br/>
|
|
172
|
+
|
|
173
|
+
Outputs
|
|
174
|
+
|
|
175
|
+
| Event | Type | Description |
|
|
176
|
+
|---|---|---|
|
|
177
|
+
| onSnapItem | [Id](https://github.com/DjonnyX/centrifugal/blob/main/src/lib/common/types/id.ts) | Emit the component ID when an element crosses the alignment line specified by the snapToItemAlign property. |
|
|
178
|
+
| onItemClick | [IRenderVirtualListItem](https://github.com/DjonnyX/centrifugal/blob/main/src/lib/list/models/render-item.model.ts) \| null | Fires when an element is clicked. |
|
|
179
|
+
| onScroll | ([IScrollEvent](https://github.com/DjonnyX/centrifugal/blob/main/src/lib/list/interfaces/scroll-event.ts)) => void | Fires when the list has been scrolled. |
|
|
180
|
+
| onScrollEnd | ([IScrollEvent](https://github.com/DjonnyX/centrifugal/blob/main/src/lib/list/interfaces/scroll-event.ts)) => void | Fires when the list has completed scrolling. |
|
|
181
|
+
| onSelect | Array<[Id](https://github.com/DjonnyX/centrifugal/blob/main/src/lib/common/types/id.ts)> \| [Id](https://github.com/DjonnyX/centrifugal/blob/main/src/lib/common/types/id.ts) \| null | Fires when an elements are selected. |
|
|
182
|
+
| onCollapse | Array<[Id](https://github.com/DjonnyX/centrifugal/blob/main/src/lib/common/types/id.ts)> \| [Id](https://github.com/DjonnyX/centrifugal/blob/main/src/lib/common/types/id.ts) \| null | Fires when elements are collapsed. |
|
|
183
|
+
| onViewportChange | [ISize](https://github.com/DjonnyX/centrifugal/blob/main/src/lib/common/interfaces/size.ts) | Fires when the viewport size is changed. |
|
|
184
|
+
| onScrollReachStart | void | Fires when the scroll reaches the start. |
|
|
185
|
+
| onScrollReachEnd | void | Fires when the scroll reaches the end. |
|
|
186
|
+
|
|
187
|
+
<br/>
|
|
188
|
+
|
|
189
|
+
Methods
|
|
190
|
+
|
|
191
|
+
| Method | Type | Description |
|
|
192
|
+
|--|--|--|
|
|
193
|
+
| scrollTo | (id: [Id](https://github.com/DjonnyX/centrifugal/blob/main/src/lib/common/types/id.ts), (cb: () => void) \| null = null, options: [IScrollOptions](https://github.com/DjonnyX/centrifugal/blob/main/src/lib/list/interfaces/scroll-options.ts) \| null = null) | The method scrolls the list to the element with the given `id` and returns the value of the scrolled area. |
|
|
194
|
+
| scrollToStart | (cb: (() => void) \| null = null, options: [IScrollOptions](https://github.com/DjonnyX/centrifugal/blob/main/src/lib/list/interfaces/scroll-options.ts) \| null = null) | Scrolls the scroll area to the first item in the collection. |
|
|
195
|
+
| scrollToEnd | (cb: (() => void) \| null = null, options: [IScrollOptions](https://github.com/DjonnyX/centrifugal/blob/main/src/lib/list/interfaces/scroll-options.ts) \| null = null) | Scrolls the list to the end of the content height. |
|
|
196
|
+
| getItemBounds | (id: [Id](https://github.com/DjonnyX/centrifugal/blob/main/src/lib/common/types/id.ts)) => [ISize \| null](https://github.com/DjonnyX/centrifugal/blob/main/src/lib/common/interfaces/size.ts) | Returns the bounds of an element with a given id |
|
|
197
|
+
| focus | [Id](https://github.com/DjonnyX/centrifugal/blob/main/src/lib/common/types/id.ts), align: [FocusAlignment](https://github.com/DjonnyX/centrifugal/blob/main/src/lib/list/types/focus-alignment.ts) = [FocusAlignments.NONE](https://github.com/DjonnyX/centrifugal/blob/main/src/lib/list/enums/focus-alignments.ts) | Focus an list item by a given id. |
|
|
198
|
+
| preventSnapping | | Prevents the list from snapping to its start or end edge. |
|
|
199
|
+
|
|
200
|
+
<br/>
|
|
201
|
+
|
|
202
|
+
### Template API
|
|
203
|
+
|
|
204
|
+
```html
|
|
205
|
+
<ng-template #itemRenderer let-data="data" let-config="config" let-measures="measures" let-api="api">
|
|
206
|
+
<!-- content -->
|
|
207
|
+
</ng-template>
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
Properties
|
|
211
|
+
|
|
212
|
+
| Property | Type | Description |
|
|
213
|
+
|--|--|--|
|
|
214
|
+
| api | [CnVirtualListPublicService](https://github.com/DjonnyX/centrifugal/blob/main/src/lib/list/cn-virtual-list-public.service.ts) | List API Provider. |
|
|
215
|
+
| data | {\[id: [Id](https://github.com/DjonnyX/centrifugal/blob/main/src/lib/common/types/id.ts) \], [otherProps: string]: any;} | Collection item data. |
|
|
216
|
+
| config | [IDisplayObjectConfig](https://github.com/DjonnyX/centrifugal/blob/main/src/lib/list/models/display-object-config.model.ts) | Display object configuration. A set of `select`, `collapse`, `focus` and `grabbing` properties are also provided. |
|
|
217
|
+
| measures | [IDisplayObjectMeasures](https://github.com/DjonnyX/centrifugal/blob/main/src/lib/list/models/display-object-measures.model.ts) \| null | Display object metrics. |
|
|
218
|
+
|
|
219
|
+
<br/>
|
|
220
|
+
|
|
221
|
+
### [CnVirtualClickModule](https://github.com/DjonnyX/centrifugal/blob/main/src/lib/list/directives/cn-virtual-click/cn-virtual-click.module.ts)
|
|
222
|
+
|
|
223
|
+
### Virtual click directive
|
|
224
|
+
|
|
225
|
+
To correctly handle interactive elements within a list, such as buttons, you need to use the VirtualClick directive.
|
|
226
|
+
|
|
227
|
+
```ts
|
|
228
|
+
import { CnVirtualListModule, CnVirtualClickModule } from 'centrifugal';
|
|
229
|
+
|
|
230
|
+
@Component({
|
|
231
|
+
selector: 'example',
|
|
232
|
+
imports: [CnVirtualListModule, CnVirtualClickModule],
|
|
233
|
+
})
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
```html
|
|
237
|
+
<ng-template #itemRenderer let-data="data" let-config="config" let-api="api">
|
|
238
|
+
@if (data) {
|
|
239
|
+
<div virtualClick (onVirtualClick)="api.select(data.id, true)">
|
|
240
|
+
<span>{{data.name}}</span>
|
|
241
|
+
</div>
|
|
242
|
+
}
|
|
243
|
+
</ng-template>
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
<br/>
|
|
247
|
+
|
|
248
|
+
## π License
|
|
249
|
+
|
|
250
|
+
MIT License
|
|
251
|
+
|
|
252
|
+
Copyright (c) 2026 djonnyx (Evgenii Alexandrovich Grebennikov)
|
|
253
|
+
|
|
254
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
255
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
256
|
+
in the Software without restriction, including without limitation the rights
|
|
257
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
258
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
259
|
+
furnished to do so, subject to the following conditions:
|
|
260
|
+
|
|
261
|
+
The above copyright notice and this permission notice shall be included in all
|
|
262
|
+
copies or substantial portions of the Software.
|
|
263
|
+
|
|
264
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
265
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
266
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
267
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
268
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
269
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
270
|
+
SOFTWARE.
|