@opengrid-ui/pro 0.0.0-stage → 0.1.25

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.
Files changed (56) hide show
  1. package/LICENSE +21 -0
  2. package/dist/LICENSE +21 -0
  3. package/dist/index.d.ts +20 -0
  4. package/dist/index.js +3 -0
  5. package/dist/index.js.map +7 -0
  6. package/dist/llms.txt +144 -0
  7. package/dist/persistence/preferences.d.ts +25 -0
  8. package/dist/persistence/use-preferences.d.ts +22 -0
  9. package/dist/query/contract.d.ts +29 -0
  10. package/dist/query/controller-controlled.test.d.ts +1 -0
  11. package/dist/query/controller-startup.test.d.ts +1 -0
  12. package/dist/query/controller.d.ts +45 -0
  13. package/dist/query/controller.test.d.ts +1 -0
  14. package/dist/query/filters.d.ts +7 -0
  15. package/dist/query/local-plan.d.ts +23 -0
  16. package/dist/query/local.d.ts +4 -0
  17. package/dist/query/local.test.d.ts +1 -0
  18. package/dist/query/request-slot.d.ts +6 -0
  19. package/dist/query/url.d.ts +8 -0
  20. package/dist/query/url.test.d.ts +1 -0
  21. package/dist/react/action-menu.d.ts +7 -0
  22. package/dist/react/api.d.ts +10 -0
  23. package/dist/react/cells.d.ts +17 -0
  24. package/dist/react/column-filter.d.ts +11 -0
  25. package/dist/react/environment.d.ts +12 -0
  26. package/dist/react/locale.d.ts +76 -0
  27. package/dist/react/pager.d.ts +9 -0
  28. package/dist/react/pro-grid.d.ts +3 -0
  29. package/dist/react/query-form.d.ts +24 -0
  30. package/dist/react/schema-editor.d.ts +10 -0
  31. package/dist/react/schema-spreadsheet.d.ts +4 -0
  32. package/dist/react/tabs.d.ts +18 -0
  33. package/dist/react/types.d.ts +109 -0
  34. package/dist/react/use-query.d.ts +7 -0
  35. package/dist/schema/cell-value.d.ts +6 -0
  36. package/dist/schema/cell-value.test.d.ts +1 -0
  37. package/dist/schema/column-order.d.ts +7 -0
  38. package/dist/schema/column-order.test.d.ts +1 -0
  39. package/dist/schema/columns.d.ts +35 -0
  40. package/dist/schema/migration.d.ts +33 -0
  41. package/dist/schema/value-types.d.ts +21 -0
  42. package/dist/skills/opengrid/SKILL.md +24 -0
  43. package/dist/styles.css +65 -0
  44. package/dist/toolbar/column-settings.d.ts +10 -0
  45. package/dist/toolbar/export.d.ts +4 -0
  46. package/dist/toolbar/export.test.d.ts +1 -0
  47. package/dist/toolbar/toolbar.d.ts +22 -0
  48. package/dist/toolbar/use-workbook-export.d.ts +6 -0
  49. package/dist/worker/local-client.d.ts +6 -0
  50. package/dist/worker/local-view.d.ts +2 -0
  51. package/dist/worker/protocol.d.ts +13 -0
  52. package/dist/worker.d.ts +1 -0
  53. package/dist/worker.js +2 -0
  54. package/dist/worker.js.map +7 -0
  55. package/package.json +1 -6
  56. package/README.md +0 -3
package/dist/llms.txt ADDED
@@ -0,0 +1,144 @@
1
+ # OpenGrid
2
+
3
+ OpenGrid is an MIT-licensed React data grid for CRUD, large local datasets, and spreadsheet editing. Use it with Arco Design, Ant Design, or the host-neutral ProGrid.
4
+
5
+ [Live documentation and sandbox](https://han-wangyu.github.io/opengrid-ui/) · [GitHub releases](https://github.com/Han-wangyu/opengrid-ui/releases) · [简体中文](https://han-wangyu.github.io/opengrid-ui/?lang=zh)
6
+
7
+ ## Install
8
+
9
+ Releases are distributed as npm-compatible tarballs on GitHub. Install Core and Pro together so the package manager can resolve both packages from the same release.
10
+
11
+ ```sh
12
+ release=https://github.com/Han-wangyu/opengrid-ui/releases/download/v0.1.25
13
+ npm install "$release/opengrid-ui-core-0.1.25.tgz" "$release/opengrid-ui-pro-0.1.25.tgz"
14
+ ```
15
+
16
+ ```tsx
17
+ import { ProGrid } from '@opengrid-ui/pro';
18
+ import '@opengrid-ui/core/styles.css';
19
+ import '@opengrid-ui/pro/styles.css';
20
+
21
+ const rows = [{ id: 'A-104', name: 'Lumen', amount: 230 }];
22
+
23
+ export function Invoices() {
24
+ return (
25
+ <ProGrid
26
+ label="Invoices"
27
+ rows={rows}
28
+ getRowId={row => row.id}
29
+ columns={[
30
+ { id: 'name', title: 'Account', query: true },
31
+ { id: 'amount', title: 'Amount', valueType: 'money', sortable: true },
32
+ ]}
33
+ />
34
+ );
35
+ }
36
+ ```
37
+
38
+ For native tokens and scoped tooltips, add the Arco or Ant Design adapter tarball and import its `ProGrid`. Check the [packed React and TypeScript compatibility matrix](https://github.com/Han-wangyu/opengrid-ui/blob/main/docs/specs/compat-matrix.spec.md) for peer versions and React 19 setup.
39
+
40
+ ProGrid automatically sorts and filters local datasets above 5,000 rows in a Worker. Plain pages slice the supplied data directly. The [local query contract](https://github.com/Han-wangyu/opengrid-ui/blob/main/docs/specs/pro-crud.spec.md#local-datasets) describes refresh and data ownership.
41
+
42
+ Pass `pageData` for a page already fetched by the host. Send the current rows and full result count, and use `pager={false}` to keep the host's pagination controls. [Host-owned pages](https://github.com/Han-wangyu/opengrid-ui/blob/main/docs/specs/pro-crud.spec.md#host-owned-pages)
43
+
44
+ Enable cell editing by passing a `spreadsheet.commit` handler. Pro uses each column's value type for the editor and respects column-level edit permissions during inline edits and pastes. The [Pro contract](https://github.com/Han-wangyu/opengrid-ui/blob/main/docs/specs/pro-crud.spec.md#spreadsheet-editors) describes value adapters and custom editors.
45
+
46
+ Enable Core header reordering with `<Grid columnReordering />`. Drag the grip, activate two grips, or focus a grip and press an arrow key. The [Core contract](https://github.com/Han-wangyu/opengrid-ui/blob/main/docs/specs/core-engine.spec.md#column-reordering) covers grouped headers and storing column order.
47
+
48
+ Use `useServerTree` with Core to expand remote groups in place. The [server-side row model contract](https://github.com/Han-wangyu/opengrid-ui/blob/main/docs/specs/ssrm.spec.md) describes block requests, projections and retries.
49
+
50
+ Configure a pivot report with `PivotSidebar`. The sidebar controls result columns, filters and grouping, and applies filters through the existing pivot Worker. [Pivot sidebar](https://github.com/Han-wangyu/opengrid-ui/blob/main/docs/specs/analytics.spec.md#pivot-sidebar)
51
+
52
+ The installed packages include `dist/llms.txt` and `dist/skills/opengrid/SKILL.md`. Coding agents can read the guide and migration instructions from the same version as the installed package.
53
+
54
+ ## Packages
55
+
56
+ | Package | Provides |
57
+ | --- | --- |
58
+ | `core` | Real DOM virtualization, column pinning and reordering, keyboard selection, TSV, edit transactions and Worker data windows |
59
+ | `pro` | Query schema, tabs, controlled state, URL history, preferences and paged selection |
60
+ | `arco`, `antd` | Scoped tokens, locale and column migration |
61
+ | `engine-wasm` | Numeric sort, filter and aggregation, plus [incremental formula sessions](https://github.com/Han-wangyu/opengrid-ui/blob/main/docs/specs/analytics.spec.md#formulas) |
62
+ | `plugin-pivot` | Grouping, [Worker and WASM pivot views](https://github.com/Han-wangyu/opengrid-ui/blob/main/docs/specs/analytics.spec.md#pivot), advanced filters and [lazy server groups](https://github.com/Han-wangyu/opengrid-ui/blob/main/docs/specs/ssrm.spec.md) |
63
+ | `plugin-excel` | Styled multi-sheet XLSX and streaming CSV/XLSX IO ([workbook text contract](https://github.com/Han-wangyu/opengrid-ui/blob/main/docs/specs/excel.spec.md)) |
64
+ | `plugin-charts` | Sparklines, conditional formatting and [charts from a spreadsheet selection](https://github.com/Han-wangyu/opengrid-ui/blob/main/docs/specs/charts.spec.md) |
65
+
66
+ ## Verify
67
+
68
+ Use Node.js 22, Corepack, and stable Rust with the WebAssembly target for repository builds. Consumers install the already-built packages.
69
+
70
+ ```sh
71
+ corepack enable
72
+ rustup target add wasm32-unknown-unknown --toolchain stable
73
+ pnpm install --frozen-lockfile
74
+ pnpm exec playwright install chromium
75
+ pnpm verify:m4
76
+ ```
77
+
78
+ The [live comparison](https://han-wangyu.github.io/opengrid-ui/benchmark/?engine=compare) sends the same navigation and sort commands to the JS and Rust/WASM workers on 50,000 or 500,000 rows. The [reference benchmarks](https://github.com/Han-wangyu/opengrid-ui/blob/main/docs/benchmarks/m5-reference.json) measure each engine independently. Read [AGENTS.md](https://github.com/Han-wangyu/opengrid-ui/blob/main/AGENTS.md), the [contribution guide](https://github.com/Han-wangyu/opengrid-ui/blob/main/CONTRIBUTING.md), or the [agent skill](https://github.com/Han-wangyu/opengrid-ui/blob/main/skills/opengrid/SKILL.md) before changing the public contract.
79
+
80
+ # OpenGrid architecture
81
+
82
+ OpenGrid is a client-side React toolkit for CRUD pages, large datasets, and spreadsheet editing. It is independently maintained and MIT licensed.
83
+
84
+ | Layer | Ownership |
85
+ | --- | --- |
86
+ | Arco and AntD adapters | Host tokens, scoped overlays and locale, migration converters |
87
+ | Pro | Column schema, form and tabs, query store, column preferences, toolbar, and paged selection |
88
+ | Core | TanStack column model, React external-store bridge, DOM viewport, and spreadsheet interactions |
89
+ | Compute and optional plugins | JavaScript worker, Rust WebAssembly, pivot, Excel, and charts |
90
+
91
+ The data plane accepts a columnar dataset, materializes sorted or filtered views, returns only the requested viewport, and applies versioned edit transactions. A dataset epoch and query generation help callers discard late responses. Paged CRUD renders supplied rows directly. Its query state has one commit point with cancellation, stale response rejection, URL synchronization and separate tab counts.
92
+
93
+ React 17 and TypeScript 4 are supported targets alongside React 18 and 19. All packages are tested from packed artifacts in isolated applications. The [compatibility matrix](https://github.com/Han-wangyu/opengrid-ui/blob/main/docs/specs/compat-matrix.spec.md) checks published declarations with legacy Node, Node16, NodeNext, and Bundler resolution as supported by each compiler. Core emits scoped styles. Adapters map host visual tokens into each instance and attach overlays within the instance. When a React 17 Ant Design host enables CSS variables, an explicit light or dark grid theme gets a stable key for that mounted instance.
94
+
95
+ The [milestones](https://github.com/Han-wangyu/opengrid-ui/blob/main/docs/ROADMAP.md) define observable launch criteria. [Package contracts](https://github.com/Han-wangyu/opengrid-ui/tree/main/docs/specs/) and [decision records](https://github.com/Han-wangyu/opengrid-ui/tree/main/docs/adr/) define behavior and document changes.
96
+
97
+ The first virtualizer uses an eight-million-pixel physical scroll track and arithmetic row coordinates. It measures its live viewport and keeps an overscanned window plus a prefetched worker chunk. The reference benchmark runs one engine at a time in Chromium against the production build. The 500,000-row scroll gate captures the sampled renderer JavaScript heap peak in the same trace window as the frame measurements. The public comparison starts both engines on identical datasets and displays each panel's ingestion, paint and sort timings while the two engines share the browser.
98
+
99
+ Core's opt-in column reordering applies sibling preferences to the definitions passed to TanStack. A pointer drag resolves the destination against logical column boxes and holds capture on the header while center columns virtualize. The same sibling rules serve keyboard moves and successive grip activation.
100
+
101
+ The horizontal virtualizer stores column offsets and pin boundaries with the layout. A binary search locates the first visible center column. The mounted leaves identify the grouped headers using a per-pane ancestry index, so horizontal scroll work follows the visible columns, pinned columns and header depth.
102
+
103
+ Pro's committed query is distinct from form drafts and asynchronously restored column preferences. An opt-in saved query read waits up to its configured deadline. The first commit combines the resulting fields with the current URL and controlled props, replaces the history entry, and starts rows and category counts. A single query slot tracks active requests by normalized key, aborts superseded work and checks each generation. A separate slot handles category counts. A pending query intent can receive controlled acknowledgements across renders. The controller keeps its staged fields out of the accepted query until they are all confirmed. Export consumers receive the query corresponding to the last accepted batch of rows. For full-query Excel export, Pro opens a host-provided revision and passes ordered, validated blocks to the workbook handler. The Excel plugin owns file encoding. Migration converters preserve native field paths and emit diagnostics for callbacks with different semantics.
104
+
105
+ Category tabs track keyboard focus within each visible list. The committed query supplies the selected path and labels the shared grid panel. Host changes to the query view and a Pro-owned page reset use a single query commit.
106
+
107
+ The query form and the header filter dialog share schema inputs. Header filter edits stay local until an explicit column change. The accepted column value is copied into the query form while its other drafts are preserved. The header dialog mounts in the owning theme container.
108
+
109
+ Pro feeds Core header moves into the same column preference as the toolbar. It reconciles the visible heading tree with the schema's hidden leaves and uses the current visible pin panes for export order.
110
+
111
+ For large local Pro queries, the browser Worker caches sort and filter columns and returns a page of original row positions. Core's compute protocol serves applications that supply full columnar datasets and edit transactions. Both paths avoid feeding the complete row model through TanStack.
112
+
113
+ When an application supplies [host-owned pages](https://github.com/Han-wangyu/opengrid-ui/blob/main/docs/specs/pro-crud.spec.md#host-owned-pages), Pro keeps the same query intent handling and renders the page supplied by the host. The host controls page loading, retry and the authoritative result metadata.
114
+
115
+ Spreadsheet mode adds a coordinate selection model and an on-demand cell editor. Core sends scalar values through validation and the edit interface, which accepts an authoritative transaction ACK and inverse patches. Pro selects editors and edit permissions through the same column schema used for display, search and filters. A recovering Worker client captures submitted inputs, replays confirmed batches against its owned dataset checkpoint, rebuilds active views and then resumes queued work.
116
+
117
+ The [compute protocol](https://github.com/Han-wangyu/opengrid-ui/blob/main/docs/specs/wasm-protocol.spec.md) reuses the row order when a view's definition and dependencies remain current. Spreadsheet actions bridge to one edit transaction, and recovery retries an interrupted edit with its original transaction ID.
118
+
119
+ [Selection summaries](https://github.com/Han-wangyu/opengrid-ui/blob/main/docs/specs/core-engine.spec.md#selection-summaries) run against Worker views when the spreadsheet uses raw source values. Sheets with custom value projections read bounded blocks and yield between batches of main-thread work.
120
+
121
+ Enterprise features are explicit imports. Core supports pinned rows, dynamic heights, local cell spans, row drag, trees and nested details. The pivot plugin owns grouping, aggregation, filters and server-side blocks. The Excel plugin owns streamed file IO. The Charts plugin maps a Core spreadsheet selection to a chart adapter's series and categories. The Rust worker shares the JS transaction and viewport contract while providing native numeric sorting, filters and aggregates.
122
+
123
+ The [server-side tree](https://github.com/Han-wangyu/opengrid-ui/blob/main/docs/specs/ssrm.spec.md) keeps a sparse list of spans for the expanded hierarchy. Core reads the requested window through its tree source capability and renders loaded siblings while child blocks resolve. New windows release abandoned requests and reuse in-flight blocks where both windows overlap.
124
+
125
+ [Pivot and formula sessions](https://github.com/Han-wangyu/opengrid-ui/blob/main/docs/specs/analytics.spec.md) use dedicated Workers when their workflows become active. Large pivot views batch numeric reducers through a lazily loaded Rust kernel. JavaScript retains the layout and source-order semantics, the Worker reuses projected columns, and the host applies custom reducers. Formula sessions keep the dependency graph off the main thread and use acknowledged raw values for recovery.
126
+
127
+ The pivot session applies filters against its cached projections before aggregation. Sidebar filter drafts stay in the UI until the host applies them. Report-column visibility and order change the rendered columns without a pivot computation.
128
+
129
+ # Roadmap
130
+
131
+ | Milestone | Deliverables | Exit criteria |
132
+ | --- | --- | --- |
133
+ | M0 | Workspace, published contracts, fixtures, structured verification | React 17/TS4, 18 and 19 packed hosts typecheck, build and run |
134
+ | M1 | Two-dimensional virtual grid, pinned columns, grouped headers, resizing, reordering, worker sorting, native themes, benchmark | 500,000 rows reach the final row and meet agreed paint, scroll, sort and size budgets. Column moves work across the virtual window, and four theme snapshots and dual-locale isolation pass |
135
+ | M2 | Pro schema, value types, tabs, forms, toolbar, persistence, URL, selection, migration adapters | Migrated Arco and AntD examples pass request-race, StrictMode, history and persistence cases |
136
+ | M3 | Range selection, fill handle, TSV, keyboard, editing, undo/redo, aggregates, context menu | Cross-window edit and undo after worker recovery pass on 500,000 rows. IME editing passes in browser |
137
+ | M4 | Grouping, pivot, SSRM with inline expansion, filters, detail, dynamic rows, merging, row drag, tree, Excel, charts, Rust/WASM formulas | Shared engine contract passes in both engines. WASM sort and size budgets pass. The server tree reaches the end of a large group with bounded block reads |
138
+ | M5 | Bilingual documentation, sandbox, benchmark, agent skill, published packages and React 17 adoption pilot | All verification layers pass. Docs and npm packages are reachable. The pilot passes on the agreed real list page |
139
+
140
+ The two first-release scenarios are a production-style Pro migration and a 500,000-row virtual grid. Performance claims require a recorded Chromium run and reference machine.
141
+
142
+ ## First delivery
143
+
144
+ The published GitHub release supplies the nine installable tarballs and public documentation. The registry publish and an internal rollout are follow-up activities. The [status board](https://github.com/Han-wangyu/opengrid-ui/blob/main/docs/progress/STATUS.md) records the evidence for the GitHub gate and the current rollout boundary.
@@ -0,0 +1,25 @@
1
+ import type { QueryPatch } from '../query/contract.js';
2
+ export type Density = 'compact' | 'normal' | 'comfortable';
3
+ export interface ColumnPreferences {
4
+ columnVisibility: Readonly<Record<string, boolean>>;
5
+ columnOrder: readonly string[];
6
+ columnPinning: {
7
+ left: readonly string[];
8
+ right: readonly string[];
9
+ };
10
+ columnSizing: Readonly<Record<string, number>>;
11
+ density: Density;
12
+ }
13
+ export interface PreferenceStorage {
14
+ get(key: string): Promise<Partial<ColumnPreferences> | null> | Partial<ColumnPreferences> | null;
15
+ set(key: string, value: ColumnPreferences): Promise<void> | void;
16
+ }
17
+ export interface PersistenceOptions {
18
+ key: string;
19
+ storage?: PreferenceStorage;
20
+ onError?(error: unknown): void;
21
+ restoreQuery?(key: string): Promise<QueryPatch | null>;
22
+ queryRestoreTimeoutMs?: number;
23
+ }
24
+ export declare const emptyPreferences: ColumnPreferences;
25
+ export declare function localPreferenceStorage(storage?: Storage): PreferenceStorage;
@@ -0,0 +1,22 @@
1
+ import type { ColumnPreferences, PersistenceOptions } from './preferences.js';
2
+ type Change = <K extends keyof ColumnPreferences>(key: K, value: ColumnPreferences[K]) => void;
3
+ interface Options {
4
+ defaults: Partial<ColumnPreferences>;
5
+ controlled: Partial<ColumnPreferences>;
6
+ persistence: PersistenceOptions | undefined;
7
+ onChange: Change;
8
+ }
9
+ export declare function usePreferences({ defaults, controlled, persistence, onChange }: Options): {
10
+ preferences: {
11
+ columnVisibility: Readonly<Record<string, boolean>>;
12
+ columnOrder: readonly string[];
13
+ columnPinning: {
14
+ left: readonly string[];
15
+ right: readonly string[];
16
+ };
17
+ columnSizing: Readonly<Record<string, number>>;
18
+ density: import("./preferences.js").Density;
19
+ };
20
+ change: <K extends keyof ColumnPreferences>(key: K, value: ColumnPreferences[K]) => void;
21
+ };
22
+ export {};
@@ -0,0 +1,29 @@
1
+ import type { FilterColumn, SortColumn } from '@opengrid-ui/core';
2
+ export interface Pagination {
3
+ page: number;
4
+ pageSize: number;
5
+ }
6
+ export interface GridQuery {
7
+ pagination: Pagination;
8
+ sorting: readonly SortColumn[];
9
+ filters: readonly FilterColumn[];
10
+ activeTab: string | null;
11
+ }
12
+ export interface QueryResult<T> {
13
+ rows: readonly T[];
14
+ total: number;
15
+ }
16
+ export type GridRequest<T> = (query: GridQuery, options: {
17
+ signal: AbortSignal;
18
+ }) => Promise<QueryResult<T>>;
19
+ export type QueryPatch = Partial<GridQuery>;
20
+ export type QueryReason = 'submit' | 'autoSearch' | 'tab' | 'pagination' | 'sort' | 'filter' | 'history' | 'controlled' | 'refresh';
21
+ export interface QueryHistory {
22
+ read(): QueryPatch;
23
+ write(query: GridQuery, mode: 'replace' | 'push'): void;
24
+ listen(listener: () => void): () => void;
25
+ }
26
+ export type TabCounts = Readonly<Record<string, number>>;
27
+ export type TabCountRequest = (filters: GridQuery['filters'], options: {
28
+ signal: AbortSignal;
29
+ }) => Promise<TabCounts>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,45 @@
1
+ import type { ExternalStore } from '@opengrid-ui/core/engine';
2
+ import type { GridQuery, GridRequest, QueryHistory, QueryPatch, QueryReason, QueryResult, TabCountRequest, TabCounts } from './contract.js';
3
+ import type { FilterValues } from './filters.js';
4
+ type Status = 'idle' | 'loading' | 'ready' | 'error';
5
+ export interface QuerySnapshot<T> {
6
+ query: GridQuery;
7
+ draft: GridQuery['filters'];
8
+ status: Status;
9
+ data: QueryResult<T> | undefined;
10
+ dataQuery: GridQuery | undefined;
11
+ error: unknown;
12
+ updatedAt: number | undefined;
13
+ counts: {
14
+ status: Status;
15
+ data: TabCounts;
16
+ error: unknown;
17
+ };
18
+ }
19
+ type Change = (query: GridQuery, patch: QueryPatch, reason: QueryReason) => void;
20
+ export interface QueryOptions<T> {
21
+ request: GridRequest<T>;
22
+ isHostPage?(): boolean;
23
+ requestCounts?: TabCountRequest | undefined;
24
+ controlled?: QueryPatch;
25
+ defaults?: QueryPatch;
26
+ history?: QueryHistory | undefined;
27
+ onChange?: Change | undefined;
28
+ onDeactivate?(): void;
29
+ autoSearch?: number | undefined;
30
+ restoreQuery?: (() => Promise<QueryPatch | null>) | undefined;
31
+ restoreTimeoutMs?: number | undefined;
32
+ }
33
+ export interface QueryController<T> extends ExternalStore<QuerySnapshot<T>> {
34
+ activate(): () => void;
35
+ reload(reason?: 'provider' | 'refresh'): void;
36
+ control(controlled: QueryPatch): void;
37
+ dispatch(patch: QueryPatch, reason: QueryReason): void;
38
+ filterColumn(id: string, values: FilterValues): void;
39
+ draft(filters: GridQuery['filters']): void;
40
+ submit(): void;
41
+ resetFilters(): void;
42
+ retryCounts(): void;
43
+ }
44
+ export declare function createQueryController<T>(options: QueryOptions<T>): QueryController<T>;
45
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,7 @@
1
+ import type { FilterColumn } from '@opengrid-ui/core';
2
+ import type { GridQuery } from './contract.js';
3
+ type Filters = GridQuery['filters'];
4
+ export type FilterValues = FilterColumn['values'];
5
+ export declare function filterValues(filters: Filters, id: string): FilterValues;
6
+ export declare function replaceFilter(filters: Filters, id: string, values: FilterValues): Filters;
7
+ export {};
@@ -0,0 +1,23 @@
1
+ import type { CellValue } from '@opengrid-ui/core/engine';
2
+ import type { GridQuery } from './contract.js';
3
+ type Range = readonly [string | undefined, string | undefined];
4
+ export type LocalValue = CellValue | Range | undefined;
5
+ export interface LocalField {
6
+ id: string;
7
+ kind: 'equals' | 'contains' | 'range' | 'order';
8
+ }
9
+ export interface LocalPlan {
10
+ filters: readonly {
11
+ field: LocalField;
12
+ values: readonly CellValue[];
13
+ }[];
14
+ sorting: readonly {
15
+ field: LocalField;
16
+ desc: boolean;
17
+ }[];
18
+ }
19
+ export declare function localPlan(query: GridQuery, valueType: (id: string) => string | undefined): LocalPlan;
20
+ export declare function fieldKey({ id, kind }: LocalField): string;
21
+ export declare function projectValue(kind: LocalField['kind'], value: unknown): LocalValue;
22
+ export declare function localView<T>(rows: readonly T[], plan: LocalPlan, resolve: (field: LocalField) => (row: T) => LocalValue): readonly T[];
23
+ export {};
@@ -0,0 +1,4 @@
1
+ import type { GridQuery, QueryResult } from './contract.js';
2
+ import type { ProColumn } from '../schema/columns.js';
3
+ export declare function localResult<T>(rows: readonly T[], columns: readonly ProColumn<T>[], query: GridQuery): QueryResult<T>;
4
+ export declare function localPage<T>(ordered: readonly T[], pagination: GridQuery['pagination']): QueryResult<T>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,6 @@
1
+ interface RequestSlot {
2
+ run<T>(key: string, execute: (signal: AbortSignal) => Promise<T>, receive: (value: T) => void, reject: (error: unknown) => void): boolean;
3
+ cancel(): void;
4
+ }
5
+ export declare function requestSlot(): RequestSlot;
6
+ export {};
@@ -0,0 +1,8 @@
1
+ import type { GridQuery, QueryHistory, QueryPatch } from './contract.js';
2
+ export declare function decodeQuery(params: URLSearchParams, namespace?: string): QueryPatch;
3
+ export declare function encodeQuery(params: URLSearchParams, query: GridQuery, namespace?: string): URLSearchParams;
4
+ export interface URLSyncOptions {
5
+ namespace?: string;
6
+ history?: 'push' | 'replace';
7
+ }
8
+ export declare function browserQueryHistory(options?: URLSyncOptions, host?: Window & typeof globalThis): QueryHistory;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import type { ReactNode } from 'react';
3
+ export declare function ActionMenu({ label, children, closeVersion }: {
4
+ label: string;
5
+ children: ReactNode;
6
+ closeVersion: number;
7
+ }): React.JSX.Element;
@@ -0,0 +1,10 @@
1
+ import type { GridHandle } from '@opengrid-ui/core';
2
+ import type { GridQuery } from '../query/contract.js';
3
+ export interface OpenGridApi<T> {
4
+ query: GridQuery;
5
+ refresh(): void;
6
+ scrollToRow(index: number): void;
7
+ getTable(): GridHandle<T>['table'] | undefined;
8
+ }
9
+ export declare const OpenGridContext: import("react").Context<OpenGridApi<unknown> | null>;
10
+ export declare function useOpenGrid<T = unknown>(): OpenGridApi<T>;
@@ -0,0 +1,17 @@
1
+ import type { GridColumn } from '@opengrid-ui/core';
2
+ import type { GridQuery } from '../query/contract.js';
3
+ import type { FilterValues } from '../query/filters.js';
4
+ import type { ColumnPreferences } from '../persistence/preferences.js';
5
+ import type { ProColumn } from '../schema/columns.js';
6
+ import type { GridEnvironment } from './environment.js';
7
+ import type { ProMessages } from './locale.js';
8
+ interface CellOptions {
9
+ locale: string;
10
+ environment: GridEnvironment;
11
+ messages: ProMessages;
12
+ prefs: ColumnPreferences;
13
+ filters: GridQuery['filters'];
14
+ filter(id: string, values: FilterValues): void;
15
+ }
16
+ export declare function renderColumns<T>(columns: readonly ProColumn<T>[], options: CellOptions): GridColumn<T>[];
17
+ export {};
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import type { FilterValues } from '../query/filters.js';
3
+ import type { ProColumn } from '../schema/columns.js';
4
+ import type { ProMessages } from './locale.js';
5
+ export declare function ColumnFilter<T>({ column, values, locale, messages, apply }: {
6
+ column: ProColumn<T>;
7
+ values: FilterValues;
8
+ locale: string;
9
+ messages: ProMessages;
10
+ apply(values: FilterValues): void;
11
+ }): React.JSX.Element;
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ import type { CSSProperties, ReactElement, ReactNode } from 'react';
3
+ export type GridLocale = 'en-US' | 'zh-CN';
4
+ export type ThemeMode = 'host' | 'light' | 'dark';
5
+ export type GridTokens = CSSProperties & Partial<Record<`--og-${string}`, string | number>>;
6
+ export interface GridEnvironment {
7
+ locale: GridLocale;
8
+ tooltip?(content: ReactNode, trigger: ReactElement): ReactElement;
9
+ }
10
+ export declare const GridEnvironmentProvider: React.Provider<GridEnvironment>;
11
+ export declare const useGridEnvironment: () => GridEnvironment;
12
+ export declare const localeFromHost: (locale?: string) => GridLocale;
@@ -0,0 +1,76 @@
1
+ import type { GridLocale } from './environment.js';
2
+ declare const en: {
3
+ expandRow: string;
4
+ collapseRow: string;
5
+ dragRow: string;
6
+ startDate: string;
7
+ endDate: string;
8
+ label: string;
9
+ search: string;
10
+ reset: string;
11
+ showFilters: string;
12
+ hideFilters: string;
13
+ refresh: string;
14
+ density: string;
15
+ compact: string;
16
+ normal: string;
17
+ comfortable: string;
18
+ fullscreen: string;
19
+ exitFullscreen: string;
20
+ columns: string;
21
+ exportCsv: string;
22
+ exportXlsx: string;
23
+ exportingXlsx: string;
24
+ cancelExport: string;
25
+ more: string;
26
+ copy: string;
27
+ copied: string;
28
+ loading: string;
29
+ empty: string;
30
+ error: string;
31
+ retry: string;
32
+ retryCounts: string;
33
+ prev: string;
34
+ next: string;
35
+ pageSize: string;
36
+ page: string;
37
+ of: string;
38
+ total: string;
39
+ selected: string;
40
+ clear: string;
41
+ selectPage: string;
42
+ selectRow: string;
43
+ moveUp: string;
44
+ moveDown: string;
45
+ pin: string;
46
+ none: string;
47
+ left: string;
48
+ right: string;
49
+ tabList: string;
50
+ filter: string;
51
+ clearFilter: string;
52
+ exportError: string;
53
+ columnReordering: {
54
+ move: (column: string) => string;
55
+ picked: (column: string) => string;
56
+ moved: (column: string, target: string, side: "before" | "after") => string;
57
+ };
58
+ spreadsheet: {
59
+ editor: string;
60
+ fill: string;
61
+ copy: string;
62
+ undo: string;
63
+ redo: string;
64
+ count: string;
65
+ sum: string;
66
+ average: string;
67
+ min: string;
68
+ max: string;
69
+ };
70
+ };
71
+ export type ResolvedProMessages = typeof en;
72
+ type WorkbookMessage = 'exportingXlsx' | 'cancelExport';
73
+ export type ProMessages = Omit<ResolvedProMessages, WorkbookMessage> & Partial<Pick<ResolvedProMessages, WorkbookMessage>>;
74
+ export type ProLocale = GridLocale | Partial<ProMessages>;
75
+ export declare function messagesFor(host: GridLocale, override: ProLocale | undefined): ResolvedProMessages;
76
+ export {};
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import type { Pagination } from '../query/contract.js';
3
+ import type { ProMessages } from './locale.js';
4
+ export declare function Pager({ pagination, total, change, messages }: {
5
+ pagination: Pagination;
6
+ total: number;
7
+ change(pagination: Pagination): void;
8
+ messages: ProMessages;
9
+ }): React.JSX.Element;
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ import type { ProGridProps } from './types.js';
3
+ export declare function ProGrid<T>(props: ProGridProps<T>): React.JSX.Element;
@@ -0,0 +1,24 @@
1
+ import React from 'react';
2
+ import type { GridQuery } from '../query/contract.js';
3
+ import type { FilterValues } from '../query/filters.js';
4
+ import type { ProColumn } from '../schema/columns.js';
5
+ import type { ProMessages } from './locale.js';
6
+ import type { QueryFormOptions } from './types.js';
7
+ interface FormProps<T> {
8
+ fields: readonly ProColumn<T>[];
9
+ draft: GridQuery['filters'];
10
+ messages: ProMessages;
11
+ locale: string;
12
+ options: QueryFormOptions;
13
+ change(value: GridQuery['filters']): void;
14
+ submit(): void;
15
+ reset(): void;
16
+ }
17
+ export declare function QueryField<T>({ column, values, locale, change }: {
18
+ column: ProColumn<T>;
19
+ values: FilterValues;
20
+ locale: string;
21
+ change(values: FilterValues): void;
22
+ }): React.JSX.Element;
23
+ export declare function QueryForm<T>({ fields, draft, messages, locale, options, change, submit, reset }: FormProps<T>): React.JSX.Element;
24
+ export {};
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import type { CellEditorContext } from '@opengrid-ui/core';
3
+ import type { ProColumn } from '../schema/columns.js';
4
+ import type { ValueType } from '../schema/value-types.js';
5
+ export declare function SchemaEditor<T>({ editor, column, locale, context }: {
6
+ editor: NonNullable<ValueType['editor']>;
7
+ column: ProColumn<T>;
8
+ locale: string;
9
+ context: CellEditorContext<T>;
10
+ }): React.JSX.Element;
@@ -0,0 +1,4 @@
1
+ import type { SpreadsheetOptions } from '@opengrid-ui/core';
2
+ import type { ProColumn } from '../schema/columns.js';
3
+ import type { ProSpreadsheetOptions } from './types.js';
4
+ export declare function schemaSpreadsheet<T>(columns: readonly ProColumn<T>[], config: ProSpreadsheetOptions<T>, locale: string): SpreadsheetOptions<T>;
@@ -0,0 +1,18 @@
1
+ import React from 'react';
2
+ import type { TabCounts } from '../query/contract.js';
3
+ import type { ProMessages } from './locale.js';
4
+ import type { TabItem } from './types.js';
5
+ export declare function useTabPanel(items: readonly TabItem[] | undefined, active: string | null): {
6
+ id: string | undefined;
7
+ path: number[];
8
+ labelledBy: string | undefined;
9
+ };
10
+ export declare function Tabs({ items, path, panel, counts, label, change, parents }: {
11
+ items: readonly TabItem[];
12
+ path: readonly number[];
13
+ panel: string | undefined;
14
+ counts: TabCounts;
15
+ label: ProMessages['tabList'];
16
+ change(id: string): void;
17
+ parents?: readonly number[];
18
+ }): React.JSX.Element;