@ishibashi0112/spreadsheet-grid 1.3.0 → 1.4.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
@@ -1189,7 +1189,7 @@ const columns: GridColumn<Expense>[] = [
1189
1189
  | `'select'` | 候補ドロップダウン(表の外のポータル。`popupContainer`)。↑↓=ハイライト移動 / Enter=確定(下へ)/ Tab=確定(左右へ)/ クリック=確定 / 印字キー=label 前方一致のタイプアヘッド(約 700ms でリセット)/ IME で確定した文字(日本語の名前など)= その文字で始まる候補、無ければ含む候補へ(1.0.2) | `options: readonly GridSelectEditorOption[] \| (row) => readonly GridSelectEditorOption[]`(静的 or 行依存。関数はレンダー中に呼ばれるため純粋であること。readonly / `as const` の配列も可。1.3.0 から)/ `clipboard: 'value' \| 'label'`(既定 `'value'`。`'label'` でコピー・CSV は label、貼り付けた label は value へ。1.1.0) | パススルー(`option.value` は string。型変換したい場合は `parseClipboardValue` を併用)。`clipboard: 'label'` なら、貼り付けた文字が候補の label(前後の空白は外して比べる)ならその value、value ならそのまま、どちらでもなければ生文字列のまま(label を先に見る。エディタで選んだ候補は読み替えずにその value を書く) |
1190
1190
  | `'date'` | ネイティブ `<input type="date">`。ドラフトは `'YYYY-MM-DD' \| ''`。入力欄は中身(年 / 月 / 日)より狭くせず、細い列ではセルからはみ出して開く。セルを選んで文字から打ち始めたときは、その文字を消さないよう文字の入力欄で開き、確定するときに日付として読む(`2026/3/15`・`2026-03-15` など。読み方は既定パーサに、全角の数字・記号と「2026年3月15日」の書き方を足したもの。貼り付けではこれらを読まない)。読めなければ「日付で入力してください」を出して編集を続ける(フォーカスが外れたら取り消し。1.0.2) | `strict`(`true` で日付として読めない値に印。1.2.0。「バリデーション」節) | `''`→`null` / 解釈可能→`'YYYY-MM-DD'` へ正規化(数字の日付は年 / 月 / 日と、年が後ろの月 / 日 / 年 = 「4/11/2026」は 4 月 11 日。日 / 月 / 年としては読まない)/ 解釈不可→生文字列のまま(数字だけの文字列 = Excel の日付のシリアル値「45678」や「5」と、年が 4 桁にならない文字列、年の無い文字列(「11/2」「Nov 1」)、ありえない日付(「2026/2/30」)も解釈不可。翌月へ繰り越さない) |
1191
1191
  | `'checkbox'` | **直接トグル**(編集セッションなし)。チェックボックスそのものを押すか、アクティブセルで Space を押すと即トグル(セルのチェックボックスの外を押したときはアクティブセルになるだけ。ダブルクリックでも切り替わらない)。Enter / F2 / ダブルクリックではエディタが開かない | `checkedValue`(既定 `true`)/ `uncheckedValue`(既定 `false`)。checked 判定は `Object.is(value, checkedValue)` のみ | `''`→unchecked / checked・unchecked の文字列表現→対応値 / `'true'`・`'1'`→checked / その他→unchecked |
1192
- | `'custom'` | `render(ctx)` の返り値を編集オーバーレイ内に描画。**フォーカス管理・キーバインドは利用側の責務**(開いたままグリッドの中の別のセルを押したときに値を残す / エディタを閉じるには、入力欄の `onBlur` で `ctx.commit` か `ctx.cancel` を呼ぶ。呼ばないとエディタが開いたまま残り、グリッドのキー操作が効かない) | `render: (ctx: CellEditorContext<T>) => ReactNode`, `imeDirectInput?: boolean`(グリッドの `imeDirectInput` が有効なとき、IME で確定した文字を `ctx.initialText` に入れて開く。既定 `false`。1.2.0 から) | パススルー |
1192
+ | `'custom'` | `render(ctx)` の返り値を編集オーバーレイ内に描画。**フォーカス管理・キーバインドは利用側の責務**(開いたままグリッドの中の別のセル・行番号・列見出し・見出しの角・行の掴み手・展開トグル・表の余白を押すと、グリッドが編集を終えてエディタを閉じる。編集していたセルの中でエディタが覆っていない所を押したときは閉じない。打った値を残すには入力欄の `onBlur` で `ctx.commit(value)` を呼ぶ。サーバーの検査を待ってから呼んでも、閉じた後に編集していたセルへ書く(その前に同じセルをまた開いて編集しているときとグリッドを外した後は書かない。検査で reject する値は書かず `{ status: 'rejected' }` を返す)。呼ばなければ打ちかけは書かない。1.4.0 まではエディタが開いたまま残り、別のセルをダブルクリックするまでグリッドのキー操作が効かなかった) | `render: (ctx: CellEditorContext<T>) => ReactNode`, `imeDirectInput?: boolean`(グリッドの `imeDirectInput` が有効なとき、IME で確定した文字を `ctx.initialText` に入れて開く。既定 `false`。1.2.0 から) | パススルー |
1193
1193
 
1194
1194
  注意点:
1195
1195
 
@@ -2293,14 +2293,14 @@ export const OrdersTable = () => <Grid columns={columns} dataSource={dataSource}
2293
2293
  | `motionExtras` | `motionExtrasFeature` | 変更のハイライト、コピー範囲の点線、十字ホバー(`highlightChanges` / `showCopyRange` / `hoverHighlight`) | +1.2KB |
2294
2294
  | `autoHeight` | `autoHeightFeature` | 行の高さの実測(`autoHeight` / `columns[].autoHeight`) | +1.2KB |
2295
2295
 
2296
- サイズ(初期読み込みの JS の gzip。esbuild で minify・React は外部化・`@tanstack/virtual-core` 込み。2026-11-08 の dist で計測):
2296
+ サイズ(初期読み込みの JS の gzip。esbuild で minify・React は外部化・`@tanstack/virtual-core` 込み。2026-11-23 の dist で計測):
2297
2297
 
2298
2298
  | 構成 | 初期 JS(gzip) |
2299
2299
  | --- | --- |
2300
- | 全部入り(`SpreadsheetGrid`) | 約 140KB |
2301
- | `/lite` 機能なし | 約 80KB |
2302
- | `/lite` + `standardFeatures` | 約 102KB |
2303
- | `/lite` + `standardFeatures` + `serverSideFeature` | 約 107KB |
2300
+ | 全部入り(`SpreadsheetGrid`) | 約 153KB |
2301
+ | `/lite` 機能なし | 約 90KB |
2302
+ | `/lite` + `standardFeatures` | 約 114KB |
2303
+ | `/lite` + `standardFeatures` + `serverSideFeature` | 約 118KB |
2304
2304
 
2305
2305
  - 各機能の目安は「機能なし」に 1 つだけ足したときの増え方で、組み合わせると共通部分のぶん合計より少し小さくなる。バンドラーによって数 KB 前後する(0.61.0 の全部入りの実測で、Vite 8(Rolldown)は esbuild より約 1.5KB 小さく、Vite 7(Rollup)はほぼ同じ。Next.js 16 では webpack が Turbopack より約 4KB 大きい)。
2306
2306
  - 使わない機能がバンドルから落ちることは、Vite 8・webpack 5・Next.js 16(既定の Turbopack)・esbuild で確かめている(バンドラーが `package.json` の `sideEffects` と `/* @__PURE__ */` を解釈する必要がある)。
package/README.md CHANGED
@@ -52,7 +52,7 @@ More runnable examples (server-side row model, Astryx) are in [`examples/`](http
52
52
 
53
53
  ## Smaller bundles: `/lite` (0.54.0+)
54
54
 
55
- `SpreadsheetGrid` includes every feature (about 140KB gzip of initial JS). The `/lite` entry builds a grid with only the features you pass; the rest is left out of your bundle (about 80KB with no features, about 102KB with the `standardFeatures` preset).
55
+ `SpreadsheetGrid` includes every feature (about 153KB gzip of initial JS). The `/lite` entry builds a grid with only the features you pass; the rest is left out of your bundle (about 90KB with no features, about 114KB with the `standardFeatures` preset).
56
56
 
57
57
  ```tsx
58
58
  import { createSpreadsheetGrid, standardFeatures, serverSideFeature } from '@ishibashi0112/spreadsheet-grid/lite'
@@ -107,7 +107,7 @@ This library is new, so AI coding assistants rarely know its API and tend to gue
107
107
 
108
108
  ## Versioning
109
109
 
110
- Releases follow semver, and this package and the core always share one version. Since 1.0, breaking changes ship only in major releases and are listed in the [changelog](https://github.com/ishibashi0112/datasheet-grid/blob/main/CHANGELOG.md) (before 1.0 they shipped in minor releases, under 「挙動の変化」 / 「core の破壊的変更」). The public surface is the entry points above (`.` / `/lite` / `/ai` / `/locales/en` / `/testing`), the CSS files, `API_REFERENCE.md`, and the CSS tokens, classes and attributes listed there. TypeScript 5.8 or later is supported (`moduleResolution` `bundler` or `nodenext`). Anything to be removed is deprecated in a minor release first, with a one-time console warning in development builds. The core's building blocks (`@ishibashi0112/spreadsheet-grid-core/internal/…`; the old subpaths without `internal/` were removed in 0.61.0) are internal and may change in any release (this package depends on the core of exactly the same version). Details: [Versioning](https://datasheet-grid.vercel.app/docs/versioning) (Japanese).
110
+ Releases follow semver, and this package, the core and the Solid version (`@ishibashi0112/spreadsheet-grid-solid`, from 1.4.0) always share one version. Since 1.0, breaking changes ship only in major releases and are listed in the [changelog](https://github.com/ishibashi0112/datasheet-grid/blob/main/CHANGELOG.md) (before 1.0 they shipped in minor releases, under 「挙動の変化」 / 「core の破壊的変更」). The public surface is the entry points above (`.` / `/lite` / `/ai` / `/locales/en` / `/testing`), the CSS files, `API_REFERENCE.md`, and the CSS tokens, classes and attributes listed there. TypeScript 5.8 or later is supported (`moduleResolution` `bundler` or `nodenext`). Anything to be removed is deprecated in a minor release first, with a one-time console warning in development builds. The core's building blocks (`@ishibashi0112/spreadsheet-grid-core/internal/…`; the old subpaths without `internal/` were removed in 0.61.0) are internal and may change in any release (this package depends on the core of exactly the same version). Details: [Versioning](https://datasheet-grid.vercel.app/docs/versioning) (Japanese).
111
111
 
112
112
  ## License
113
113
 
@@ -133,7 +133,7 @@ Astryx / Mantine / HeroUI v3 / shadcn/ui の中で使うときは、`style.css`
133
133
 
134
134
  ### バンドルを小さくする: `/lite`(0.54.0 から)
135
135
 
136
- `SpreadsheetGrid` は全機能入りです(初期読み込みの JS が約 140KB gzip)。`/lite` の入口では、渡した機能だけを入れたグリッドを作れます。渡さなかった機能はバンドルに入りません(機能なしで約 80KB、プリセット `standardFeatures` で約 102KB)。
136
+ `SpreadsheetGrid` は全機能入りです(初期読み込みの JS が約 153KB gzip)。`/lite` の入口では、渡した機能だけを入れたグリッドを作れます。渡さなかった機能はバンドルに入りません(機能なしで約 90KB、プリセット `standardFeatures` で約 114KB)。
137
137
 
138
138
  ```tsx
139
139
  import { createSpreadsheetGrid, standardFeatures, serverSideFeature } from '@ishibashi0112/spreadsheet-grid/lite'
@@ -188,4 +188,4 @@ npm パッケージに同梱されているため、オフライン(`node_module
188
188
 
189
189
  ### バージョンの方針
190
190
 
191
- 版は semver に沿って上げ、このパッケージと core はいつも同じ版で出します。1.0 から、壊す変更は major でだけ出し、[CHANGELOG](https://github.com/ishibashi0112/datasheet-grid/blob/main/CHANGELOG.md) に書きます(1.0 より前は minor で出し、「挙動の変化」「core の破壊的変更」に書いていました)。公開範囲は上の入口(`.` / `/lite` / `/ai` / `/locales/en` / `/testing`)、CSS ファイル、`API_REFERENCE.md` と、そこに載せた CSS のトークン・クラス・属性です。TypeScript は 5.8 以上(`moduleResolution` は `bundler` か `nodenext`)。消すものは前の minor で非推奨にし、開発ビルドでだけ console に 1 回警告を出します。core の部品(`@ishibashi0112/spreadsheet-grid-core/internal/…`。`internal/` の無い旧サブパスは 0.61.0 で消しました)は内部で、どの版でも変わることがあります(このパッケージは同じ版の core に固定で依存します)。詳しくは[バージョンと互換性](https://datasheet-grid.vercel.app/docs/versioning)。
191
+ 版は semver に沿って上げ、このパッケージ・core・Solid 版(`@ishibashi0112/spreadsheet-grid-solid`。1.4.0 から)はいつも同じ版で出します。1.0 から、壊す変更は major でだけ出し、[CHANGELOG](https://github.com/ishibashi0112/datasheet-grid/blob/main/CHANGELOG.md) に書きます(1.0 より前は minor で出し、「挙動の変化」「core の破壊的変更」に書いていました)。公開範囲は上の入口(`.` / `/lite` / `/ai` / `/locales/en` / `/testing`)、CSS ファイル、`API_REFERENCE.md` と、そこに載せた CSS のトークン・クラス・属性です。TypeScript は 5.8 以上(`moduleResolution` は `bundler` か `nodenext`)。消すものは前の minor で非推奨にし、開発ビルドでだけ console に 1 回警告を出します。core の部品(`@ishibashi0112/spreadsheet-grid-core/internal/…`。`internal/` の無い旧サブパスは 0.61.0 で消しました)は内部で、どの版でも変わることがあります(このパッケージは同じ版の core に固定で依存します)。詳しくは[バージョンと互換性](https://datasheet-grid.vercel.app/docs/versioning)。
@@ -1,5 +1,6 @@
1
1
  import type { EditorCommitDirection, EditorCommitResult, EditorEnterMove, GridColumn, GridColumnEditor, GridRowKey } from './model/gridTypes.js';
2
2
  import type { GridResolvedSlots } from './model/gridTypes.js';
3
+ import type { LateEditCommitReceiver } from '@ishibashi0112/spreadsheet-grid-core/internal/controllers/editController';
3
4
  export type { EditorCommitDirection };
4
5
  type CellEditorRect = {
5
6
  left: number;
@@ -29,10 +30,11 @@ type CellEditorLayerProps<T> = {
29
30
  onCommit: (value: unknown, direction?: EditorCommitDirection) => EditorCommitResult | void;
30
31
  onCancel: () => void;
31
32
  onRegisterFlush?: ((flush: (() => void) | null) => void) | undefined;
33
+ onRegisterLateCommit?: ((receiver: LateEditCommitReceiver) => () => void) | undefined;
32
34
  align?: 'left' | 'center' | 'right';
33
35
  enterMove?: EditorEnterMove;
34
36
  domId?: string;
35
37
  alignTop?: boolean;
36
38
  };
37
- export declare function CellEditorLayer<T>({ rect, headerHeight, leadingWidth, baseOffset, initialValue, editor, editorSession, themeClassName, slots, onCommit, onCancel, onRegisterFlush, align, enterMove, domId, alignTop, }: CellEditorLayerProps<T>): import("react").JSX.Element | null;
39
+ export declare function CellEditorLayer<T>({ rect, headerHeight, leadingWidth, baseOffset, initialValue, editor, editorSession, themeClassName, slots, onCommit, onCancel, onRegisterFlush, onRegisterLateCommit, align, enterMove, domId, alignTop, }: CellEditorLayerProps<T>): import("react").JSX.Element | null;
38
40
  export default CellEditorLayer;
@@ -1,9 +1,11 @@
1
1
  import { type ReactNode } from 'react';
2
2
  import type { CellEditorContext } from '../model/gridTypes.js';
3
+ import type { LateEditCommitReceiver } from '@ishibashi0112/spreadsheet-grid-core/internal/controllers/editController';
3
4
  type CustomCellEditorProps<T> = {
4
5
  render: (ctx: CellEditorContext<T>) => ReactNode;
5
6
  context: CellEditorContext<T> | null;
6
7
  onRegisterFlush?: ((flush: (() => void) | null) => void) | undefined;
8
+ onRegisterLateCommit?: ((receiver: LateEditCommitReceiver) => () => void) | undefined;
7
9
  };
8
- export declare function CustomCellEditor<T>({ render, context, onRegisterFlush, }: CustomCellEditorProps<T>): import("react").JSX.Element | null;
10
+ export declare function CustomCellEditor<T>({ render, context, onRegisterFlush, onRegisterLateCommit, }: CustomCellEditorProps<T>): import("react").JSX.Element | null;
9
11
  export default CustomCellEditor;
@@ -1,5 +1,5 @@
1
- import { type EditControllerArgs } from '@ishibashi0112/spreadsheet-grid-core/internal/controllers/editController';
2
- export declare const useGridEditController: <T extends object>(args: EditControllerArgs<T>) => {
1
+ import { type EditController, type EditControllerArgs } from '@ishibashi0112/spreadsheet-grid-core/internal/controllers/editController';
2
+ export declare const useGridEditController: <T extends object>(args: EditControllerArgs<T>, created?: EditController<T>) => {
3
3
  activateSingleCell: (cell: import("@ishibashi0112/spreadsheet-grid-core").CellCoord) => void;
4
4
  startEditWithValue: (cell: import("@ishibashi0112/spreadsheet-grid-core").CellCoord, initialValue: string) => void;
5
5
  commitEdit: (committedValue: unknown, direction?: import("@ishibashi0112/spreadsheet-grid-core").EditorCommitDirection) => import("@ishibashi0112/spreadsheet-grid-core").EditorCommitResult;