@ishibashi0112/spreadsheet-grid-solid 1.5.0 → 1.5.1

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/API_REFERENCE.md CHANGED
@@ -18,6 +18,8 @@
18
18
 
19
19
  ## SpreadsheetGrid props (`SpreadsheetGridProps<T>`)
20
20
 
21
+ `T` は行の型(オブジェクト)。グリッドを包む汎用の部品は `function MyGrid<T extends object>(props: SpreadsheetGridProps<T>)` のように `<T extends object>` で書く(グリッドの部品の型引数は `T extends object` で、`SpreadsheetGridProps<T>` には制約が無いため、`<T>` のままでは TS2322 になる。2.0 で `SpreadsheetGridProps<T>` にも同じ制約を付ける候補)。
22
+
21
23
  | Name | Type | Default | Description |
22
24
  | --- | --- | --- | --- |
23
25
  | `rows` | `readonly T[]` | — | clientSide モードの行データ。readonly 配列も受け付ける(グリッドは入力配列を破壊的に変更しない。編集結果は `onRowsChange` が新配列で返す)。`dataSource` を指定した場合は無視され serverSide モードになる(両者は排他)。 |
@@ -1650,7 +1652,7 @@ const lastYear: Sale = { id: 'last-year', region: '前年', q1: 980, q2: 1110, q
1650
1652
  - **`renderCell` からの操作(`ctx.detail`)**: `detailRow` 有効時、`CellRenderContext` に `detail: { expanded, expandable, toggle(), setExpanded(bool) }` が入ります(無効時は `undefined`)。`showToggleColumn: false` と組み合わせて、商品名セルの横などにトグルを自前配置できます。
1651
1653
  - **選択 / アクティブセル**: 帯はセルではないため選択・アクティブセルの対象外です。帯を跨ぐ範囲選択のハイライトは帯を避けて分割描画されます。
1652
1654
  - **serverSide(`dataSource`)**: 使えますが、(1) クエリ(フィルター / ソート / グローバル)が変わると展開状態は**すべて閉じ**ます(結果セットが総入れ替えされ、未ロード行のキーを走査できないため)。(2) 未ロード行の帯は表示されません。
1653
- - **上限**: 帯は auto-height 行と同じ可変行高ジオメトリで描画するため、`rows × rowHeight + 展開中の帯の合計` が 15,000,000px(36px 行で約 41 万行)を超える構成では帯を描画しません(開発時警告。展開状態は保持され、行数を絞ると表示されます)。行だけで 15,000,000px を超える間は、展開のトグル(▸)も出さず、`Enter` / `Space` でも開閉しません(`ctx.detail.expandable` も `false`。1.0.1 から)。
1655
+ - **上限**: 帯は auto-height 行と同じ可変行高ジオメトリで描画するため、`rows × rowHeight + 展開中の帯の合計` が 15,000,000px(36px 行で約 41 万行。Firefox は 8,000,000px = 約 22 万行)を超える構成では帯を描画しません(開発時警告。展開状態は保持され、行数を絞ると表示されます)。行だけでこの上限を超える間は、展開のトグル(▸)も出さず、`Enter` / `Space` でも開閉しません(`ctx.detail.expandable` も `false`。1.0.1 から)。
1654
1656
  - **行グルーピング併用**: 展開できるのは leaf 行のみ(グループ行は対象外)。
1655
1657
 
1656
1658
  ### ラベル行(見出し / 区切り行)(`labelRow`)
@@ -1711,7 +1713,7 @@ type Row = { id: string; kind?: 'label'; code: string; name: string; qty: number
1711
1713
  - **展開行併用**: 可。ラベル行は展開できません(データ行のみ)。
1712
1714
  - **serverSide(`dataSource`)**: サーバーが `getRows` の結果にラベル行を含めて返し(`totalRowCount` にも数える)、`isLabelRow` で識別します。セクションの並べ替え / `sectionRowCount` / 縦固定(`sticky`)/ ラベル行の `height` はサーバー行モデルでは適用されず、件数表示はサーバー総数のままです。
1713
1715
  - **エクスポート**: 既定では出力に含みません(scope `'raw'` でもデータ行として出ません)。`exportCsv` / `getExportData` の `includeLabelRows: true` で 1 行として出力し、`getExportData` は `rowKinds` で行種を返します(「Excel / スプレッドシート エクスポート」節のレシピ参照)。コピー(`Ctrl/Cmd+C`)には含まれません。
1714
- - **上限**: `height` を指定した場合は可変行高ジオメトリで描画するため、論理全高が 15,000,000px を超える構成では上書きを諦めて `rowHeight` に戻ります。
1716
+ - **上限**: `height` を指定した場合は可変行高ジオメトリで描画するため、論理全高が 15,000,000px(Firefox は 8,000,000px)を超える構成では上書きを諦めて `rowHeight` に戻ります。
1715
1717
 
1716
1718
  ラベル行の記述子は `GridLabelRow<T>`(`{ kind: 'label', row, sourceIndex, label, sectionRowCount }`)としてバレルから公開されます(`LabelRowOptions<T>` / `LabelRowRenderContext<T>` / `LabelRowSortMode` も同様)。
1717
1719
 
package/README.md CHANGED
@@ -68,7 +68,7 @@ The feature names and what they enable are listed in the bundled `API_REFERENCE.
68
68
  - **`ref` works like Solid's DOM refs.** `let grid!: SpreadsheetGridHandle<Row>` with `ref={grid}`, or `ref={(handle) => (grid = handle)}`, gives you the handle with the same methods (there are no React ref objects). The handle is set before your component's first `createEffect` and `onSettled` run, so you can call it there (for example to restore a saved state or scroll to the bottom). Inside `<Loading>`, the grid is not drawn until the first rows arrive, and methods that change its state do nothing before that (the grid warns once in development): pass the first state as `initialState`, or call the handle from an effect that reads the rows (`createEffect(() => rows().length, …)`). After the grid is removed (hidden with `<Show>` and so on), a handle left in your variable does nothing for methods that change the state (the grid warns once in development), and methods that read return the values from when it was removed (save `grid.getState()` in `onCleanup`; `getScrollPosition()` returns `null` and `isAtBottom()` `false`).
69
69
  - **Render functions run only when needed.** `renderCell` and `renderHeader` run again when their column changes, and the bar renderers when the function changes; not on every update as in React. Everything in the context (`row`, `value`, `rowIndex`, `isActive`, the bar context and each field of its `derivedSummary`, and so on) is read when you access it: read it inside JSX and only that expression follows, so an input inside a cell can call `ctx.setValue` on every keystroke and keep its focus (1.4.0+; earlier versions re-created the cell content whenever its row changed). Reading a value in the function body (destructuring the arguments included) re-creates the content when that value changes. Reading it at the top of your own component's body (`renderCell={(ctx) => <MyCell ctx={ctx} />}` with `const v = props.ctx.value` in `MyCell`) does not follow later changes (Solid reports `STRICT_READ_UNTRACKED` in development), so read it inside JSX there. Signals from outside the grid read in the `renderCell` body re-create the content of every visible cell when they change, so read them inside JSX (or through a memo per row key).
70
70
  - **Natural-language filter (`/ai`).** `GridAskBar` and `createGridAsk` (the React version's `useGridAsk`; Solid names it `create…`) come from `@ishibashi0112/spreadsheet-grid-solid/ai` (about 15KB gzip, separate from the grid's bundle). Pass the grid as a function that returns the handle, `grid={() => grid}` (with `let grid!` and `ref={grid}`), or as a signal (`ref={setGrid}` with `grid={grid}`); there are no ref objects. Everything else (your `ask` function, the answer format, `gridAskLocaleTextEn` from `/locales/en`) is the same as the React version ([AI filter guide](https://datasheet-grid.vercel.app/docs/guides/ai-filter)).
71
- - **Speed.** Scrolling and editing feel about the same as the React version. In our measurement on 1.5.0, `Ctrl+End` in 1,000,000 rows and large vertical jumps in a table of about 200 columns take about the same JavaScript time as the React version (about 1.1 times). Short scrolls and large horizontal jumps take about 1.5 to 2 times the script time, and a table of about 200 columns uses about 9 MB more memory (each visible cell is a small set of Solid computations; when only the drawn range changes, row and cell elements are reused and only their contents are rewritten).
71
+ - **Speed.** Scrolling and editing feel about the same as the React version. In our measurement on 2026-11-28 (production build, Chromium), `Ctrl+End` in 1,000,000 rows takes about the same time as the React version, large vertical jumps in a table of about 200 columns take less JavaScript time (about 0.6 times), short scrolls about 1.2 times and large horizontal jumps about 1.5 times, and a table of about 200 columns uses about 3.5 MB more memory (each visible cell is a small set of Solid computations; when only the drawn range changes, row and cell elements are reused and only their contents are rewritten).
72
72
  - Everything else (props, column options, handle methods, callbacks, CSS classes and tokens) is the same as in the React version. The package ships `API_REFERENCE.md` (0.1.2+; the same document as the React version's, with a note at the top on reading it for Solid; also [on GitHub](https://github.com/ishibashi0112/datasheet-grid/blob/main/packages/react/API_REFERENCE.md)).
73
73
 
74
74
  ## Solid-specific notes
@@ -135,7 +135,7 @@ Solid 2.0 向けの仮想化スプレッドシート / データグリッドで
135
135
  - **`ref` は Solid の DOM の ref と同じです。** `let grid!: SpreadsheetGridHandle<Row>` と `ref={grid}`、または `ref={(handle) => (grid = handle)}` で、同じメソッドを持つハンドルを受け取れます(React の ref オブジェクトはありません)。ハンドルは利用側の部品の最初の `createEffect` と `onSettled` より前に入るので、そこで呼べます(保存した状態を戻す、末尾へスクロールする など)。`<Loading>` の中では最初の行が届くまでグリッドを描かず、それまでに呼んだ状態を変えるメソッドは何もしません(開発時に 1 回知らせます)。最初の状態は `initialState` で渡すか、行を読む effect(`createEffect(() => rows().length, …)`)から呼んでください。グリッドを外した後(`<Show>` で隠したときなど)も変数に残ったハンドルは、状態を変えるメソッドは何もせず(開発時に 1 回知らせます)、読むメソッドは外したときの値を返します(`onCleanup` で `grid.getState()` を保存できます。`getScrollPosition()` は `null`、`isAtBottom()` は `false`)。
136
136
  - **描く関数は必要なときだけ呼びます。** `renderCell` と `renderHeader` は列が変わったとき、バーの関数は関数が変わったときに呼び直します(React 版のように更新のたびには呼びません)。文脈の値(`row` / `value` / `rowIndex` / `isActive`、バーの文脈と、その `derivedSummary` の各項目など)は読んだときに引くので、JSX の中で読めばその式だけが追従します。セルの中の入力欄で打つたびに `ctx.setValue` しても、入力欄はそのままでフォーカスも外れません(1.4.0 から。それまでは行が変わるたびにセルの中身を作り直していました)。関数の本体で読むと(引数の分割代入も)、その値が変わったときに中身を作り直します(バーの入力欄なら、フォーカスと打ちかけの文字が消えます)。自分の部品の本体の一番上で読むと(`renderCell={(ctx) => <MyCell ctx={ctx} />}` で `MyCell` の中の `const v = props.ctx.value`)、その後の変化に追従しません(開発時に Solid が `STRICT_READ_UNTRACKED` を出します)。そこでも JSX の中で読んでください。グリッドの外の signal を `renderCell` の本体で読むと、変わるたびに見えているすべてのセルの中身を作り直します。JSX の中で読むか、行のキーごとの memo を通してください。
137
137
  - **ことばで絞り込み(`/ai`)。** `GridAskBar` と `createGridAsk`(React 版の `useGridAsk`。Solid の慣例で `create…` の名前)は `@ishibashi0112/spreadsheet-grid-solid/ai` から import します(約 15KB gzip。グリッドのバンドルとは別)。グリッドはハンドルを返す関数 `grid={() => grid}`(`let grid!` と `ref={grid}`)か signal(`ref={setGrid}` と `grid={grid}`)で渡します(ref オブジェクトはありません)。そのほか(利用側の `ask`・答えの形・`/locales/en` の `gridAskLocaleTextEn`)は React 版と同じです([ことばで絞り込み](https://datasheet-grid.vercel.app/docs/guides/ai-filter))。
138
- - **速さ。** スクロールと編集は React 版とほぼ同じです。1.5.0 で測ると、100 万行の `Ctrl+End` と、約 200 列の表で縦に大きく飛ぶときの JS の時間は React 版と同じくらい(約 1.1 倍)です。少しずつのスクロールと横に大きく飛ぶときは JS の時間が React 版の約 1.5〜2 倍で、約 200 列の表ではメモリが約 9MB 多くなります(見えているセルごとに Solid の計算をいくつか持つため。描く範囲だけが変わったときは、行の要素とセルの部品を使い回して中身だけを書き換えます)。
138
+ - **速さ。** スクロールと編集は React 版とほぼ同じです。2026-11-28 に本番ビルドの Chromium で測ると、100 万行の `Ctrl+End` は React 版と同じくらい、約 200 列の表で縦に大きく飛ぶときの JS の時間は React 版より短く(約 0.6 倍)、少しずつのスクロールは約 1.2 倍、横に大きく飛ぶときは約 1.5 倍で、約 200 列の表ではメモリが約 3.5MB 多くなります(見えているセルごとに Solid の計算をいくつか持つため。描く範囲だけが変わったときは、行の要素とセルの部品を使い回して中身だけを書き換えます)。
139
139
  - そのほか(props・列の定義・ハンドルのメソッド・通知・CSS のクラスとトークン)は React 版と同じです。パッケージに `API_REFERENCE.md` を同梱しています(0.1.2 から。React 版と同じ文書で、先頭に Solid 版での読み替えがあります。[GitHub](https://github.com/ishibashi0112/datasheet-grid/blob/main/packages/react/API_REFERENCE.md) でも読めます)。
140
140
 
141
141
  ### Solid で気をつけること
@@ -18,6 +18,7 @@ export type ShellDevWarningArgs = {
18
18
  detailRowEnabled: () => boolean;
19
19
  detailExtraCount: () => number;
20
20
  detailActive: () => boolean;
21
+ maxBodyPx: () => number;
21
22
  globalFilterText: () => string;
22
23
  columnFilterCount: () => number;
23
24
  };