@omnigrid/core 0.1.14 → 0.1.15

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 CHANGED
@@ -18,7 +18,8 @@ state, the data pipeline, 2D virtualization, DOM-pool row mapping, slots, and pl
18
18
 
19
19
  **Scroll is ephemeral, not state.** `scrollTop`/`scrollLeft` are kept out of the Store:
20
20
  scroll-only `setViewport({ scrollTop, scrollLeft })` calls never notify subscribers, so adapters do
21
- not re-render on scroll frames. Read them via `getScrollPosition()`.
21
+ not re-render on scroll frames. Read them via `getScrollPosition()`; use `scrollTo()` to request an
22
+ adapter-native scroll adjustment without moving scroll coordinates into the Store.
22
23
 
23
24
  ## Key contracts
24
25
 
@@ -109,6 +110,7 @@ UI code must never touch core internals directly.
109
110
  interface GridApi<T> {
110
111
  getState(): GridState<T>; // { data, columns, viewport, rowHeight, rowOverscan, columnOverscan }
111
112
  getScrollPosition(): ScrollPosition; // ephemeral scrollTop/scrollLeft
113
+ scrollTo(position: Partial<ScrollPosition>): void; // request a native scroll adjustment from the adapter
112
114
  getViewportData(): ViewportData<T>; // virtualized window: rows/columns + absolute offsets
113
115
  getProcessedData(): T[]; // after all registered data processors
114
116
  getRowId(row: T, index: number): RowId;
package/dist/grid.d.ts CHANGED
@@ -21,6 +21,7 @@ export declare class Grid<T> implements GridApi<T> {
21
21
  * - `overlayManual`: whether the overlay was set manually (showOverlay), which
22
22
  * disables auto-evaluation until hideOverlay re-enables it.
23
23
  */
24
+ private readonly licenseKey;
24
25
  private loading;
25
26
  private hasData;
26
27
  private loadError;
@@ -41,6 +42,12 @@ export declare class Grid<T> implements GridApi<T> {
41
42
  getState(): GridState<T>;
42
43
  /** Returns the current ephemeral scroll position (not part of Store state). */
43
44
  getScrollPosition(): ScrollPosition;
45
+ /**
46
+ * Requests the adapter to update the native scroll position.
47
+ * @param position - Partial scroll coordinates to set.
48
+ * @api
49
+ */
50
+ scrollTo(position: Partial<ScrollPosition>): void;
44
51
  getViewportData(): ViewportData<T>;
45
52
  getProcessedData(): T[];
46
53
  getRowId(row: T, index: number): RowId;
@@ -86,6 +93,7 @@ export declare class Grid<T> implements GridApi<T> {
86
93
  /** Monotonic counter for structural changes (refresh / data / columns). */
87
94
  getRevision(): number;
88
95
  destroy(): void;
96
+ getLicenseKey(): string | undefined;
89
97
  isDestroyed(): boolean;
90
98
  private assertActive;
91
99
  }
package/dist/grid.js CHANGED
@@ -14,13 +14,6 @@ export class Grid {
14
14
  this.processedDataCache = null;
15
15
  this.revision = 0;
16
16
  this.destroyed = false;
17
- /**
18
- * Overlay management state:
19
- * - `loading`: whether the grid is fetching data (set via setLoading / options.loading)
20
- * - `overlayState`: the current active overlay (type + payload)
21
- * - `overlayManual`: whether the overlay was set manually (showOverlay), which
22
- * disables auto-evaluation until hideOverlay re-enables it.
23
- */
24
17
  this.loading = false;
25
18
  this.hasData = true;
26
19
  this.overlayState = { type: null };
@@ -44,6 +37,7 @@ export class Grid {
44
37
  overlay: { type: null },
45
38
  };
46
39
  this.store = new Store(state);
40
+ this.licenseKey = options.licenseKey;
47
41
  this.resolveRowId = options.getRowId ?? ((_row, index) => index);
48
42
  this.loading = options.loading ?? false;
49
43
  this.hasData = options.data !== undefined && options.data !== null;
@@ -93,6 +87,19 @@ export class Grid {
93
87
  getScrollPosition() {
94
88
  return this.scrollPosition;
95
89
  }
90
+ /**
91
+ * Requests the adapter to update the native scroll position.
92
+ * @param position - Partial scroll coordinates to set.
93
+ * @api
94
+ */
95
+ scrollTo(position) {
96
+ this.assertActive();
97
+ const nextPosition = { ...this.scrollPosition, ...position };
98
+ if (nextPosition.scrollTop === this.scrollPosition.scrollTop && nextPosition.scrollLeft === this.scrollPosition.scrollLeft)
99
+ return;
100
+ this.scrollPosition = nextPosition;
101
+ this.events.emit("scrollTo", nextPosition);
102
+ }
96
103
  getViewportData() {
97
104
  const state = this.getState();
98
105
  const processedData = this.getProcessedData();
@@ -426,6 +433,9 @@ export class Grid {
426
433
  this.events.clear();
427
434
  this.destroyed = true;
428
435
  }
436
+ getLicenseKey() {
437
+ return this.licenseKey;
438
+ }
429
439
  isDestroyed() {
430
440
  return this.destroyed;
431
441
  }
package/dist/types.d.ts CHANGED
@@ -260,6 +260,13 @@ export interface GridOptions<T> {
260
260
  getRowClass?: (params: RowRenderParams<T>) => string | undefined;
261
261
  rowClassRules?: RowClassRules<T>;
262
262
  plugins?: GridPlugin<T>[];
263
+ /**
264
+ * License key for Pro plugins. When provided, Pro plugins verify the
265
+ * cryptographic signature and activate full functionality. When missing
266
+ * or invalid, Pro plugins enter demo mode with a non-intrusive watermark.
267
+ * @api
268
+ */
269
+ licenseKey?: string;
263
270
  /** Whether data is currently being fetched. Triggers a loading overlay. @default false when data is supplied */
264
271
  loading?: boolean;
265
272
  /**
@@ -378,6 +385,7 @@ export interface GridState<T> {
378
385
  export interface GridEvents<T> {
379
386
  stateChange: GridState<T>;
380
387
  viewportChange: ViewportState;
388
+ scrollTo: ScrollPosition;
381
389
  dataChange: T[];
382
390
  headerClick: {
383
391
  columnId: string;
@@ -470,7 +478,7 @@ export interface GridPlugin<T> {
470
478
  getRowClass?(params: RowRenderParams<T>): string | undefined;
471
479
  getRowStyle?(params: RowRenderParams<T>): RowStyle | undefined;
472
480
  }
473
- export type SlotName = "top" | "bottom" | "left" | "right";
481
+ export type SlotName = "top" | "bottom" | "left" | "right" | "bodyTop" | "bodyBottom";
474
482
  export type SlotPosition = "start" | "center" | "end";
475
483
  /**
476
484
  * Placement of a single UI block that a plugin mounts into a slot.
@@ -563,6 +571,12 @@ export interface SlotMount<T> {
563
571
  export interface GridApi<T> {
564
572
  getState(): GridState<T>;
565
573
  getScrollPosition(): ScrollPosition;
574
+ /**
575
+ * Requests a native scroll position update from the active adapter.
576
+ * @param position - Scroll coordinates to update.
577
+ * @api
578
+ */
579
+ scrollTo(position: Partial<ScrollPosition>): void;
566
580
  getViewportData(): ViewportData<T>;
567
581
  getColumnWidth(columnId: string): number | undefined;
568
582
  getProcessedData(): T[];
@@ -593,6 +607,12 @@ export interface GridApi<T> {
593
607
  readonly slots: SlotManager<T>;
594
608
  readonly icons: IconRegistry<T>;
595
609
  getSlotMounts(slot: SlotName): SlotMount<T>[];
610
+ /**
611
+ * Returns the `licenseKey` supplied in `GridOptions`. The core never
612
+ * interprets the key; Pro plugins verify it themselves.
613
+ * @api
614
+ */
615
+ getLicenseKey(): string | undefined;
596
616
  /**
597
617
  * Shows an overlay using the supplied options.
598
618
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omnigrid/core",
3
- "version": "0.1.14",
3
+ "version": "0.1.15",
4
4
  "description": "Framework-agnostic core engine for OmniGrid",
5
5
  "keywords": [
6
6
  "omnigrid",