@ishibashi0112/spreadsheet-grid-solid 1.9.0 → 1.11.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/API_REFERENCE.md +263 -31
- package/README.md +6 -6
- package/dist/{ColumnFilterPopover-mENgY4gl.js → ColumnFilterPopover-t32VGfTq.js} +135 -134
- package/dist/DateEditorCalendar-CWaFuibK.js +118 -0
- package/dist/devWarnings.d.ts +7 -0
- package/dist/editors/CellEditorLayer.d.ts +7 -2
- package/dist/editors/DateCellEditor.d.ts +2 -1
- package/dist/editors/DateTimeCellEditor.d.ts +26 -0
- package/dist/editors/MultiSelectCellEditor.d.ts +24 -0
- package/dist/editors/NumberCellEditor.d.ts +2 -1
- package/dist/editors/SearchSelectCellEditor.d.ts +1 -0
- package/dist/editors/SelectCellEditor.d.ts +1 -0
- package/dist/editors/TextCellEditor.d.ts +1 -0
- package/dist/features/dateTimeEditors.d.ts +2 -0
- package/dist/features/excelShortcuts.d.ts +2 -0
- package/dist/features/multiSelect.d.ts +2 -0
- package/dist/features/newRow.d.ts +2 -0
- package/dist/features/types.d.ts +18 -0
- package/dist/index.d.ts +5 -1
- package/dist/index.js +5064 -4128
- package/dist/localeText-CCqvpkYM.js +10 -0
- package/dist/model/gridTypes.d.ts +2 -0
- package/dist/portalTokens-LgUwLYnR.js +47 -0
- package/dist/source/chunks/{ColumnFilterPopover-D7INPNVB.jsx → ColumnFilterPopover-JL3HPGXY.jsx} +4 -2
- package/dist/source/chunks/DateEditorCalendar-FVUNVD7Y.jsx +170 -0
- package/dist/source/chunks/{chunk-RJB7JN2Y.jsx → chunk-AI3CSPI3.jsx} +3 -29
- package/dist/source/chunks/chunk-ZW5ET5DO.jsx +28 -0
- package/dist/source/chunks/{toolPanelViews-BRH5PCOI.jsx → toolPanelViews-N6TGBFFW.jsx} +4 -2
- package/dist/source/index.jsx +1719 -373
- package/dist/style.css +1 -1
- package/dist/style.layer.css +1 -1
- package/dist/{toolPanelViews-DMEVr1KV.js → toolPanelViews-CPYtBTQP.js} +2 -1
- package/dist/view/DateEditorCalendar.d.ts +15 -0
- package/dist/view/GridBodyLayer.d.ts +11 -0
- package/dist/view/GridMultiSelectChips.d.ts +6 -0
- package/dist/view/GridPinnedRows.d.ts +1 -0
- package/dist/view/lazyPopups.d.ts +3 -1
- package/package.json +3 -3
- package/skills/spreadsheet-grid-solid/SKILL.md +1 -1
- package/dist/portalTokens-Gz03P3fZ.js +0 -52
package/README.md
CHANGED
|
@@ -52,7 +52,7 @@ A runnable example (an editable inventory table with 10,000 rows) is in [`exampl
|
|
|
52
52
|
|
|
53
53
|
## Picking features
|
|
54
54
|
|
|
55
|
-
`SpreadsheetGrid` includes every feature (about
|
|
55
|
+
`SpreadsheetGrid` includes every feature (about 226KB gzip of initial JS; the column filter popover, the tool panel and the calendar, about 18KB, load later). `createSpreadsheetGrid` builds a grid with only the features you pass, and the rest is left out of your bundle (about 115KB with no features, about 144KB with the `standardFeatures` preset). Unlike the React version, the parts come from the main entry (there is no `/lite`).
|
|
56
56
|
|
|
57
57
|
```tsx
|
|
58
58
|
import { createSpreadsheetGrid, standardFeatures, serverSideFeature } from '@ishibashi0112/spreadsheet-grid-solid'
|
|
@@ -73,7 +73,7 @@ The feature names and what they enable are listed in the bundled `API_REFERENCE.
|
|
|
73
73
|
|
|
74
74
|
## Solid-specific notes
|
|
75
75
|
|
|
76
|
-
- **`rows` in a signal or a store.** `onRowsChange` returns a new array on every edit (the same contract as the React version). With a signal, put it back as is with `setRows(next)`. With `createStore`, pass `rows={state.rows}` and put it back with `setState((s) => {
|
|
76
|
+
- **`rows` in a signal or a store.** `onRowsChange` returns a new array on every edit (the same contract as the React version). With a signal, put it back as is with `setRows(next)`. With `createStore`, pass `rows={state.rows}` and put it back with `setState((s) => { reconcile(next, 'id')(s.rows) })`: undo / redo works as with a signal (1.4.0+). `setState((s) => { s.rows = next })` works too, but Solid prints `IMMUTABLE_UPDATE_IN_STORE` in development. Changes you make inside the store (`s.rows[0].name = …`, `push`, `splice`) show in the grid and, like the React version's rows replaced by the parent, clear the undo history. A store tracks each row to notice those changes, so with many rows every edit takes longer (about 0.1s per edit with 100,000 rows); keep tables of more than about 50,000 rows in a signal (the grid suggests it once in development).
|
|
77
77
|
- **Writes apply in a microtask.** After `setRows(...)`, the grid sees the new rows on the next flush. To use a row you just added right away (`getViewRowIndex(key)` then `startEditing(...)`), call `flush()` from `solid-js` first (the React docs use `flushSync` for the same thing). In tests, call `flush()` after changing a signal or firing an event, before looking at the DOM.
|
|
78
78
|
- **Saving with `action`.** You can start an `action` from a grid callback: `onRowsChange={(next) => save(next)}` with `createOptimistic` inside the action, or `setRows(next)` followed by `save(next)`. The grid keeps its own updates out of your action, so the editor closes and the next edit goes to the right row while the save is in flight (like `startTransition` in the React version). Take the save target (a project id and so on) from the rows you receive, not from props that may already point elsewhere. A `refresh()` that fetches the saved rows again replaces `rows` from outside, which clears the undo history (as in the React version).
|
|
79
79
|
- **Async rows.** Rows from an async `createMemo` / `createSignal(async)` work inside `<Loading>`: the fallback shows until the first rows arrive. While they are fetched again, the grid keeps the previous rows and stays usable; show the wait with `isPending(() => rows())`. With `<Loading on={...}>` the fallback replaces the grid during the refetch (the grid keeps its state and comes back when the rows arrive); an edit in progress is committed when the grid is replaced, so `onRowsChange` gets the previous rows. A failed refetch reaches your `<Errored>`. Rows read through `createDeferred` show the old values while a save's `refresh()` fetches them again (that is how `createDeferred` works); an async `createMemo` keeps the saved values.
|
|
@@ -85,7 +85,7 @@ The feature names and what they enable are listed in the bundled `API_REFERENCE.
|
|
|
85
85
|
- **Values from outside the rows.** `getValue` and `valueFormatter` should depend only on the row and the value. If they read a signal from outside, the cells follow it but totals (`aggFunc`) do not; re-create the columns when that signal changes (for example `const columns = createMemo(() => makeColumns(totals()))`).
|
|
86
86
|
- **Sharing props between grids.** Spread a stable object, or write the props out. Spreading an object that is re-created on every change (`{...gridProps()}`) works, but in development Solid reports `HUGE_FAN_OUT`.
|
|
87
87
|
- **Shadow DOM (Web Components).** Put `style.css` inside the shadow root (a `<style>` or `adoptedStyleSheets`), wrap the grid in an element instead of rendering it directly into the shadow root (popups are drawn inside that element), use an open shadow root, and call the `dispose` that `render()` returns from `disconnectedCallback`. Details: the section 「Shadow DOM の中のグリッド」 of the API reference.
|
|
88
|
-
- **Development diagnostics.** In `vite dev`, Solid may print `EFFECT_WRITES_OWN_SOURCE` for
|
|
88
|
+
- **Development diagnostics.** In `vite dev`, Solid may print `EFFECT_WRITES_OWN_SOURCE` for these effects: `autoHeightMeasurer` (with `autoHeight` columns, after measuring rows), `activeRowFollow` (with `activeCellFollows: 'row'` when the order changes), `edit` (when the order changes while editing), `newRow` (when the row count changes while the active cell is on the entry row; 1.10.0+), `history` (after undo / redo) and `rowSelectionCommands` (when rows are removed and dropped from the row selection). They come from the grid re-aligning its state after a change (the React version re-renders the same way), are harmless, and do not appear in production builds. Since 1.4.0 the grid's other re-alignments (selection clamping, column widths, scrolling, the server-side row model, notifications such as `onActiveCellChange`) no longer print `EFFECT_RELAY_TEAR`: their writes depend on state outside Solid's graph (the grid's store, the DOM), which Solid's tooling counts as the cost of measuring rather than derived state.
|
|
89
89
|
|
|
90
90
|
## Using with AI coding assistants
|
|
91
91
|
|
|
@@ -128,7 +128,7 @@ Solid 2.0 向けの仮想化スプレッドシート / データグリッドで
|
|
|
128
128
|
|
|
129
129
|
### 機能を選んで組み込む
|
|
130
130
|
|
|
131
|
-
`SpreadsheetGrid` は全機能入りです(初期読み込みの JS が約
|
|
131
|
+
`SpreadsheetGrid` は全機能入りです(初期読み込みの JS が約 226KB gzip。列フィルターのポップオーバーとツールパネル・カレンダーの約 18KB は後から読みます)。`createSpreadsheetGrid` では渡した機能だけを入れたグリッドを作れ、渡さなかった機能はバンドルに入りません(機能なしで約 115KB、プリセット `standardFeatures` で約 144KB)。React 版と違い、機能の部品も同じ入口から import します(`/lite` はありません)。機能の名前と中身は同梱の `API_REFERENCE.md` の「機能を選んで組み込む」のとおりです(部品の名前も React 版と同じ)。グリッドはコンポーネントの中ではなく、モジュールの先頭で 1 回だけ作ってください。
|
|
132
132
|
|
|
133
133
|
### React 版との違い
|
|
134
134
|
|
|
@@ -140,7 +140,7 @@ Solid 2.0 向けの仮想化スプレッドシート / データグリッドで
|
|
|
140
140
|
|
|
141
141
|
### Solid で気をつけること
|
|
142
142
|
|
|
143
|
-
- **`rows` は signal でも store でも持てます。** `onRowsChange` は編集のたびに新しい配列を返します(React 版と同じ約束)。signal なら `setRows(next)` でそのまま戻します。`createStore` なら `rows={state.rows}` で渡し、`setState((s) => {
|
|
143
|
+
- **`rows` は signal でも store でも持てます。** `onRowsChange` は編集のたびに新しい配列を返します(React 版と同じ約束)。signal なら `setRows(next)` でそのまま戻します。`createStore` なら `rows={state.rows}` で渡し、`setState((s) => { reconcile(next, 'id')(s.rows) })` で戻すと、signal のときと同じく元に戻す / やり直しが効きます(1.4.0 から。`setState((s) => { s.rows = next })` でも動きますが、開発時に Solid が `IMMUTABLE_UPDATE_IN_STORE` を出します)。store の中を直接変えたとき(`s.rows[0].name = …` / `push` / `splice`)もグリッドに映り、React 版で親が rows を差し替えたときと同じく元に戻すの履歴は消えます。store は中の変化に気づくため行ごとに追うので、行が多いと編集のたびに時間がかかります(10 万行で 1 回 0.1 秒ほど)。5 万行ほどより多い表は signal で持ってください(開発時に 1 回勧めます)。
|
|
144
144
|
- **書き込みはマイクロタスクで反映されます。** `setRows(...)` の後、グリッドが新しい行を見るのは次の反映のときです。足したばかりの行をすぐ使う(`getViewRowIndex(key)` → `startEditing(...)`)ときは、先に `solid-js` の `flush()` を呼んでください(React 版のドキュメントの `flushSync` と同じ)。テストでも、signal を変えた・イベントを送った後に DOM を見る前に `flush()` を呼びます。
|
|
145
145
|
- **`action` で保存する。** グリッドの通知の中で `action` を始めてかまいません(`onRowsChange={(next) => save(next)}` で action の中で `createOptimistic` に書く、または `setRows(next)` の後に `save(next)`)。グリッドは自分の書き込みを利用者の action に入れないので、保存の間もエディタは閉じ、続けた編集はその行に入ります(React 版の `startTransition` と同じ)。保存先(プロジェクトの ID など)は、先に別の値へ変わっていることがある props ではなく、受け取った行から取ってください。保存した行を `refresh()` で取り直すと、`rows` が外から差し替わるので、元に戻すの履歴は消えます(React 版と同じ)。
|
|
146
146
|
- **非同期の行。** 非同期の `createMemo` / `createSignal(async)` の行は `<Loading>` の中で使えます(最初の行が届くまでは fallback)。取り直しの間は前の行のまま操作できるので、待っていることは `isPending(() => rows())` で出してください。`<Loading on={...}>` では取り直しの間 fallback がグリッドに替わります(グリッドの状態は残り、行が届くと戻ります)。替わるときに編集中の値は確定し、`onRowsChange` には前の行が渡ります。取り直しの失敗は利用側の `<Errored>` が受けます。`createDeferred` で読んだ行は、保存の `refresh()` の取り直しの間は元の値を出します(`createDeferred` の意味どおり)。非同期の `createMemo` なら保存した値のままです。
|
|
@@ -152,7 +152,7 @@ Solid 2.0 向けの仮想化スプレッドシート / データグリッドで
|
|
|
152
152
|
- **行の外の値。** `getValue` / `valueFormatter` は行と値だけから決めてください。外の signal を読むと、セルはそれに追従しますが合計(`aggFunc`)は追従しません。その signal が変わったら列を作り直してください(`const columns = createMemo(() => makeColumns(totals()))` など)。
|
|
153
153
|
- **複数のグリッドで props を共有する。** 変わらないオブジェクトを spread するか、props を書き並べてください。変化のたびに作り直すオブジェクトを spread しても(`{...gridProps()}`)動きますが、開発時に Solid が `HUGE_FAN_OUT` を出します。
|
|
154
154
|
- **Shadow DOM(Web Components)。** `style.css` は Shadow root の中に入れ(`<style>` か `adoptedStyleSheets`)、グリッドは Shadow root の直下に描かずに要素で包み(ポップアップはその要素の中に出ます)、open の Shadow root を使い、`disconnectedCallback` で `render()` が返す `dispose` を呼んでください。詳しくは API リファレンスの「Shadow DOM の中のグリッド」。
|
|
155
|
-
- **開発時の Solid の知らせ。** `vite dev` では、Solid
|
|
155
|
+
- **開発時の Solid の知らせ。** `vite dev` では、Solid が次の effect の名前で `EFFECT_WRITES_OWN_SOURCE` を出すことがあります: `autoHeightMeasurer`(`autoHeight` の列で行を測った後)/ `activeRowFollow`(`activeCellFollows: 'row'` で並びが変わったとき)/ `edit`(編集中に並びが変わったとき)/ `newRow`(入力行にいる間に行の数が変わったとき。1.10.0 から)/ `history`(元に戻す / やり直すの後)/ `rowSelectionCommands`(行を消した後に、消えた行を行の選択から外すとき)。変化の後にグリッドが状態を合わせ直す処理(React 版も同じ描き直しをしている)で、害は無く、本番のビルドでは出ません。1.4.0 から、ほかの合わせ直し(選択を範囲の中へ詰める・列幅・スクロール・サーバーサイドの行モデル・`onActiveCellChange` などの通知)は `EFFECT_RELAY_TEAR` を出しません(書く値がグリッドの store や DOM など Solid のグラフの外の状態で決まるので、Solid の計測は派生した状態ではなく「測ることの手間」として扱います)。
|
|
156
156
|
|
|
157
157
|
### AI コーディングツールで使う
|
|
158
158
|
|