@ox0/data-grid 0.0.0-stage → 0.1.0
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 +9 -2
- package/dist/components/ColumnChooser.d.ts +21 -0
- package/dist/components/ColumnChooser.d.ts.map +1 -0
- package/dist/components/ColumnChooser.test.d.ts +2 -0
- package/dist/components/ColumnChooser.test.d.ts.map +1 -0
- package/dist/components/DataGrid.d.ts +14 -0
- package/dist/components/DataGrid.d.ts.map +1 -0
- package/dist/components/DataGrid.test.d.ts +2 -0
- package/dist/components/DataGrid.test.d.ts.map +1 -0
- package/dist/components/VirtualScroller.d.ts +42 -0
- package/dist/components/VirtualScroller.d.ts.map +1 -0
- package/dist/components/column-layout.d.ts +31 -0
- package/dist/components/column-layout.d.ts.map +1 -0
- package/dist/components/column-layout.test.d.ts +2 -0
- package/dist/components/column-layout.test.d.ts.map +1 -0
- package/dist/hooks/use-grid.d.ts +32 -0
- package/dist/hooks/use-grid.d.ts.map +1 -0
- package/dist/hooks/use-grid.test.d.ts +2 -0
- package/dist/hooks/use-grid.test.d.ts.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1861 -0
- package/dist/ingest.d.ts +14 -0
- package/dist/ingest.d.ts.map +1 -0
- package/dist/ingest.test.d.ts +2 -0
- package/dist/ingest.test.d.ts.map +1 -0
- package/dist/store/grid-store.d.ts +43 -0
- package/dist/store/grid-store.d.ts.map +1 -0
- package/dist/store/grid-store.test.d.ts +2 -0
- package/dist/store/grid-store.test.d.ts.map +1 -0
- package/dist/types.d.ts +437 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.test.d.ts +2 -0
- package/dist/types.test.d.ts.map +1 -0
- package/dist/worker/dataset.d.ts +20 -0
- package/dist/worker/dataset.d.ts.map +1 -0
- package/dist/worker/date.d.ts +10 -0
- package/dist/worker/date.d.ts.map +1 -0
- package/dist/worker/date.test.d.ts +2 -0
- package/dist/worker/date.test.d.ts.map +1 -0
- package/dist/worker/filter.d.ts +6 -0
- package/dist/worker/filter.d.ts.map +1 -0
- package/dist/worker/filter.test.d.ts +2 -0
- package/dist/worker/filter.test.d.ts.map +1 -0
- package/dist/worker/resolve-value.d.ts +4 -0
- package/dist/worker/resolve-value.d.ts.map +1 -0
- package/dist/worker/sort.d.ts +8 -0
- package/dist/worker/sort.d.ts.map +1 -0
- package/dist/worker/sort.test.d.ts +2 -0
- package/dist/worker/sort.test.d.ts.map +1 -0
- package/dist/worker/sync-engine.d.ts +9 -0
- package/dist/worker/sync-engine.d.ts.map +1 -0
- package/dist/worker/sync-engine.test.d.ts +2 -0
- package/dist/worker/sync-engine.test.d.ts.map +1 -0
- package/dist/worker/types.d.ts +65 -0
- package/dist/worker/types.d.ts.map +1 -0
- package/package.json +36 -3
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { SortEntry } from "../types";
|
|
2
|
+
import type { IngestedRow, SerializableColumnMeta } from "./types";
|
|
3
|
+
/**
|
|
4
|
+
* Multi-column stable sort. Returns a new array of row-array indices in sorted order; row data is
|
|
5
|
+
* never reordered in memory.
|
|
6
|
+
*/
|
|
7
|
+
export declare function sortIndices<Row>(rows: readonly IngestedRow<Row>[], sort: readonly SortEntry[], columnsById: ReadonlyMap<string, SerializableColumnMeta>): number[];
|
|
8
|
+
//# sourceMappingURL=sort.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sort.d.ts","sourceRoot":"","sources":["../../src/worker/sort.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AAEzC,OAAO,KAAK,EAAE,WAAW,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAA;AAmClE;;;GAGG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAC7B,IAAI,EAAE,SAAS,WAAW,CAAC,GAAG,CAAC,EAAE,EACjC,IAAI,EAAE,SAAS,SAAS,EAAE,EAC1B,WAAW,EAAE,WAAW,CAAC,MAAM,EAAE,sBAAsB,CAAC,GACvD,MAAM,EAAE,CA2BV"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sort.test.d.ts","sourceRoot":"","sources":["../../src/worker/sort.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { DataEngineInterface } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* Synchronous in-process implementation of {@link DataEngineInterface}, for SSR and tests where
|
|
4
|
+
* no Worker API exists. Wraps the same `Dataset` the Web Worker transport will wrap — behavior is
|
|
5
|
+
* identical, only the transport differs. See docs/llm/data-grid-architecture.md "Worker-less
|
|
6
|
+
* engine for SSR and tests".
|
|
7
|
+
*/
|
|
8
|
+
export declare function createSyncEngine<Row>(): DataEngineInterface<Row>;
|
|
9
|
+
//# sourceMappingURL=sync-engine.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sync-engine.d.ts","sourceRoot":"","sources":["../../src/worker/sync-engine.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAA;AAElD;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,KAAK,mBAAmB,CAAC,GAAG,CAAC,CAuBhE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sync-engine.test.d.ts","sourceRoot":"","sources":["../../src/worker/sync-engine.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { AggregateStat, FilterToken, SortEntry } from "../types";
|
|
2
|
+
/**
|
|
3
|
+
* Internal counterpart of the public `ColumnDef` — the projection the engine needs, with every
|
|
4
|
+
* function stripped (functions cannot cross the worker boundary; see
|
|
5
|
+
* docs/llm/data-grid-architecture.md "Closure boundary").
|
|
6
|
+
*/
|
|
7
|
+
export type SerializableColumnMeta = {
|
|
8
|
+
readonly id: string;
|
|
9
|
+
readonly dataType: "text" | "numeric" | "date" | "enum";
|
|
10
|
+
readonly sortable: boolean;
|
|
11
|
+
readonly searchable: boolean;
|
|
12
|
+
readonly filterable: boolean;
|
|
13
|
+
readonly enumValues?: readonly string[];
|
|
14
|
+
readonly aggregate?: readonly AggregateStat[];
|
|
15
|
+
readonly valueSource: {
|
|
16
|
+
readonly kind: "key";
|
|
17
|
+
readonly key: string;
|
|
18
|
+
} | {
|
|
19
|
+
readonly kind: "derived";
|
|
20
|
+
readonly key: `__derived_${string}`;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
/** `__rowId` and any `accessorFn` output are materialized before a row crosses the engine boundary. */
|
|
24
|
+
export type IngestedRow<Row> = Row & {
|
|
25
|
+
readonly __rowId: string;
|
|
26
|
+
} & Partial<Record<`__derived_${string}`, unknown>>;
|
|
27
|
+
/**
|
|
28
|
+
* Internal counterpart of the public `GridRow<Row>`. Field-identical except `row` entries carry
|
|
29
|
+
* `IngestedRow<Row>` instead of `Row`. Group-header entries are part of the v1 shape so the slice
|
|
30
|
+
* contract does not change shape in a later phase, even though nothing produces one until
|
|
31
|
+
* grouping (Phase 6) lands.
|
|
32
|
+
*/
|
|
33
|
+
export type IndexEntry<Row> = {
|
|
34
|
+
readonly kind: "row";
|
|
35
|
+
readonly data: IngestedRow<Row>;
|
|
36
|
+
readonly level?: number;
|
|
37
|
+
} | {
|
|
38
|
+
readonly kind: "group-header";
|
|
39
|
+
readonly groupKey: string;
|
|
40
|
+
readonly groupValues: Readonly<Record<string, unknown>>;
|
|
41
|
+
readonly rowCount: number;
|
|
42
|
+
readonly isExpanded: boolean;
|
|
43
|
+
readonly level: number;
|
|
44
|
+
readonly aggregates?: Readonly<Record<string, Partial<Record<AggregateStat, unknown>>>>;
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* Shared contract between the Web Worker transport and the synchronous in-process engine used
|
|
48
|
+
* for SSR and tests (docs/llm/data-grid-architecture.md "Worker-less engine for SSR and tests").
|
|
49
|
+
*
|
|
50
|
+
* This is the Phase 1 subset: client-mode ingest, sort, filter, and slice. `ingestPage` (server
|
|
51
|
+
* mode, Phase 3), `reorderRow` and `scan` (Phase 5) are added to this interface when those phases
|
|
52
|
+
* land — they are not stubbed here.
|
|
53
|
+
*/
|
|
54
|
+
export interface DataEngineInterface<Row> {
|
|
55
|
+
configure(columns: readonly SerializableColumnMeta[], mode: "client" | "server", timeZone: string): void;
|
|
56
|
+
ingestRows(rows: readonly IngestedRow<Row>[], replace: boolean): void;
|
|
57
|
+
sort(sort: readonly SortEntry[]): void;
|
|
58
|
+
filter(tokens: readonly FilterToken[], evalNow: string): void;
|
|
59
|
+
slice(start: number, end: number): {
|
|
60
|
+
readonly start: number;
|
|
61
|
+
readonly entries: IndexEntry<Row>[];
|
|
62
|
+
};
|
|
63
|
+
readonly totalCount: number;
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/worker/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AAErE;;;;GAIG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACnC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,MAAM,CAAA;IACvD,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAA;IAC1B,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAA;IAC5B,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAA;IAC5B,QAAQ,CAAC,UAAU,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IACvC,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,aAAa,EAAE,CAAA;IAC7C,QAAQ,C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AE,EAC1C,IAAI,EAAE,QAAQ,GAAG,QAAQ,EACzB,QAAQ,EAAE,MAAM,GACf,IAAI,CAAA;IACP,UAAU,CAAC,IAAI,EAAE,SAAS,WAAW,CAAC,GAAG,CAAC,EAAE,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI,CAAA;IACrE,IAAI,CAAC,IAAI,EAAE,SAAS,SAAS,EAAE,GAAG,IAAI,CAAA;IACtC,MAAM,CAAC,MAAM,EAAE,SAAS,WAAW,EAAE,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;IAC7D,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG;QAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,CAAC,EAAE,CAAA;KAAE,CAAA;IAClG,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;CAC5B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,39 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ox0/data-grid",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"repository": {
|
|
5
|
+
"type": "git",
|
|
6
|
+
"url": "https://github.com/esturcke/ox0-platform.git",
|
|
7
|
+
"directory": "packages/data-grid"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"dist"
|
|
11
|
+
],
|
|
12
|
+
"type": "module",
|
|
13
|
+
"exports": {
|
|
14
|
+
".": {
|
|
15
|
+
"source": "./src/index.ts",
|
|
16
|
+
"import": "./dist/index.js",
|
|
17
|
+
"types": "./dist/index.d.ts"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"publishConfig": {
|
|
21
|
+
"access": "public"
|
|
22
|
+
},
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"@tanstack/react-virtual": "^3.14.13",
|
|
25
|
+
"zustand": "^5.0.0",
|
|
26
|
+
"@ox0/ui": "3.0.0",
|
|
27
|
+
"@ox0/tokens": "0.4.0",
|
|
28
|
+
"@ox0/hooks": "0.2.1"
|
|
29
|
+
},
|
|
30
|
+
"peerDependencies": {
|
|
31
|
+
"react": "^19.0.0"
|
|
32
|
+
},
|
|
33
|
+
"scripts": {
|
|
34
|
+
"build": "rslib build -c ../../rslib.config.ts && tsc --build --force tsconfig.build.json",
|
|
35
|
+
"typecheck": "tsc -p tsconfig.json",
|
|
36
|
+
"lint": "oxlint .",
|
|
37
|
+
"test": "vitest run"
|
|
38
|
+
}
|
|
6
39
|
}
|