@omnigrid/core 0.1.13 → 0.1.14

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/dist/grid.d.ts CHANGED
@@ -45,6 +45,14 @@ export declare class Grid<T> implements GridApi<T> {
45
45
  getProcessedData(): T[];
46
46
  getRowId(row: T, index: number): RowId;
47
47
  setData(data: T[] | null | undefined): void;
48
+ /**
49
+ * Chunk-append API for incremental data loading (infinite scroll, live
50
+ * feeds). Concatenates `rows` onto the existing dataset inside the State
51
+ * Store — the host does not need to re-send the whole array — then emits
52
+ * a single `dataChange` with the combined result. A no-op for empty or
53
+ * missing `rows`.
54
+ */
55
+ appendData(rows: T[] | null | undefined): void;
48
56
  setViewport(viewport: Partial<ViewportState>): void;
49
57
  /**
50
58
  * Repaints the current viewport: notifies Store subscribers that
package/dist/grid.js CHANGED
@@ -208,6 +208,26 @@ export class Grid {
208
208
  this.events.emit("dataChange", nextData);
209
209
  this.recomputeOverlay();
210
210
  }
211
+ /**
212
+ * Chunk-append API for incremental data loading (infinite scroll, live
213
+ * feeds). Concatenates `rows` onto the existing dataset inside the State
214
+ * Store — the host does not need to re-send the whole array — then emits
215
+ * a single `dataChange` with the combined result. A no-op for empty or
216
+ * missing `rows`.
217
+ */
218
+ appendData(rows) {
219
+ this.assertActive();
220
+ if (!rows || rows.length === 0)
221
+ return;
222
+ const currentData = this.store.getState().data;
223
+ const nextData = [...currentData, ...rows];
224
+ this.hasData = true;
225
+ this.processedDataCache = null;
226
+ this.revision += 1;
227
+ this.store.setState({ data: nextData });
228
+ this.events.emit("dataChange", nextData);
229
+ this.recomputeOverlay();
230
+ }
211
231
  setViewport(viewport) {
212
232
  this.assertActive();
213
233
  const state = this.store.getState();
package/dist/types.d.ts CHANGED
@@ -568,6 +568,16 @@ export interface GridApi<T> {
568
568
  getProcessedData(): T[];
569
569
  getRowId(row: T, index: number): RowId;
570
570
  setData(data: T[] | null | undefined): void;
571
+ /**
572
+ * Chunk-append API for incremental data loading (infinite scroll, live
573
+ * feeds): appends `rows` to the end of the existing dataset without
574
+ * rebuilding it from the host side. Patches the State Store directly and
575
+ * emits a single `dataChange` with the combined array. Empty or missing
576
+ * `rows` is a no-op.
577
+ * @param rows - Chunk of rows appended to the end of the dataset.
578
+ * @api
579
+ */
580
+ appendData(rows: T[] | null | undefined): void;
571
581
  setViewport(viewport: Partial<ViewportState>): void;
572
582
  refresh(): void;
573
583
  subscribe(listener: () => void): () => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omnigrid/core",
3
- "version": "0.1.13",
3
+ "version": "0.1.14",
4
4
  "description": "Framework-agnostic core engine for OmniGrid",
5
5
  "keywords": [
6
6
  "omnigrid",