You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -47,15 +47,6 @@ Try the live demo here: [StackBlitz Demo](https://stackblitz.com/edit/stackblitz
47
47
- Simpler integration, less boilerplate
48
48
- Designed for chat, feeds, and any list with variable content
49
49
50
-
## 🌐 Browser Support
51
-
52
-
- Chrome (latest 2 versions)
53
-
- Firefox (latest 2 versions)
54
-
- Edge (latest 2 versions)
55
-
- Safari (latest 2 versions)
56
-
- Opera (latest 2 versions)
57
-
- Mobile browsers (iOS Safari, Chrome for Android)
58
-
59
50
## Quick Start
60
51
61
52
### 1) Template
@@ -157,53 +148,113 @@ export class AppComponent {
157
148
-`get(id: ItemId, count: number): Observable<T[]>` — load items relative to a specific id.
158
149
-`settings.bufferSize` — page size.
159
150
-`settings.heightToLoadMore` — distance (in px) from the edge to trigger loading.
160
-
-`datasource.adapter` — get the Adapter instance for programmatic list control.
151
+
-`settings.addMethod` — defines how items are added to the view. Defaults to `fallback`.
152
+
-`datasource.adapter` — provides methods for programmatic list control:
153
+
-`addItem(item: T): boolean` — Adds an item to the list. If the scroll is at the bottom, the item is immediately visible. Otherwise, it will appear when the user scrolls to the bottom.
154
+
-`updateItem(id: string, changes: Partial<T>): boolean` — Updates an item by its ID with the provided changes.
155
+
-`deleteItem(id: string): boolean` — Deletes an item by its ID.
156
+
-`scrollToId(id: string): boolean` — Scrolls to the item with the specified ID.
157
+
-`scrollToBottomForce(): boolean` — Forces the scroll to the bottom of the list.
161
158
162
-
###Adapter API
159
+
##📖 Adapter API
163
160
164
161
You can access the adapter via `datasource.adapter`. The adapter provides convenient methods to manage the list items programmatically. Each method returns a boolean indicating whether the operation was successful.
165
162
166
-
#### Methods
167
-
168
-
-`addItem(item: T): boolean`
169
-
Adds an item to the end of the list. If the scroll is at the very bottom, the new item will appear immediately in the view. If the scroll is not at the bottom, the item will be shown only when the user scrolls to the bottom.
170
-
-**Parameters:**
171
-
-`item: T` — the item to add (must have a unique `id`)
172
-
-**Returns:**`boolean` — `true` if the item was added, `false` otherwise
173
-
174
-
-`addFirstItem(item: T): boolean`
175
-
Adds an item to the beginning of the list.
176
-
-**Parameters:**
177
-
-`item: T` — the item to add (must have a unique `id`)
178
-
-**Returns:**`boolean` — `true` if the item was added, `false` otherwise
179
-
180
-
-`update(id: ItemId, data: T): boolean`
181
-
Updates an existing item by its `id`.
182
-
-**Parameters:**
183
-
-`id: ItemId` — the id of the item to update
184
-
-`data: T` — the new data for the item
185
-
-**Returns:**`boolean` — `true` if the item was found and updated, `false` otherwise
Finds an item by a custom predicate and updates it.
189
-
-**Parameters:**
190
-
-`find: (item: T) => boolean` — function to find the item
191
-
-`data: T` — the new data for the item
192
-
-**Returns:**`boolean` — `true` if an item was found and updated, `false` otherwise
193
-
194
-
-`delete(id: ItemId): boolean`
195
-
Deletes an item by its `id`.
196
-
-**Parameters:**
197
-
-`id: ItemId` — the id of the item to delete
198
-
-**Returns:**`boolean` — `true` if the item was found and deleted, `false` otherwise
199
-
200
-
-`scrollToId(id: ItemId): boolean`
201
-
Scrolls the container to the item with the given `id`.
202
-
-**Parameters:**
203
-
-`id: ItemId` — the id of the item to scroll to
204
-
-**Returns:**`boolean` — `true` if the item was found and scrolled to, `false` otherwise
205
-
206
-
> **Note:** All adapter methods return `true` if the operation was successful, or `false` if the item was not found or could not be added/updated/deleted.
163
+
### Methods
164
+
165
+
-**addItem(item: T): boolean**
166
+
- Adds an item to the end of the list. If the scroll is at the very bottom, the new item will appear immediately in the view. If the scroll is not at the bottom, the item will be shown only when the user scrolls to the bottom.
167
+
168
+
**Parameters:**
169
+
-`item: T` — the item to add (must have a unique id)
170
+
171
+
**Returns:**
172
+
-`boolean` — true if the item was added, false otherwise
173
+
174
+
-**addFirstItem(item: T): boolean**
175
+
- Adds an item to the beginning of the list.
176
+
177
+
**Parameters:**
178
+
-`item: T` — the item to add (must have a unique id)
179
+
180
+
**Returns:**
181
+
-`boolean` — true if the item was added, false otherwise
182
+
183
+
-**update(id: ItemId, data: T): boolean**
184
+
- Updates an existing item by its id.
185
+
186
+
**Parameters:**
187
+
-`id: ItemId` — the id of the item to update
188
+
-`data: T` — the new data for the item
189
+
190
+
**Returns:**
191
+
-`boolean` — true if the item was found and updated, false otherwise
0 commit comments