@ishibashi0112/spreadsheet-grid-solid 1.4.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.
@@ -315,6 +315,7 @@ function createLiveObject(keys, read) {
315
315
  // src/primitives/serverSnapshot.ts
316
316
  var SERVER_FRAME_ATTRIBUTE = "data-ssg-ssr";
317
317
  var SERVER_SNAPSHOT_ATTRIBUTE = "data-ssg-ssr-snapshot";
318
+ var ROOT_CLASS_NAME = "ssg-root";
318
319
  var NOOP = () => {
319
320
  };
320
321
  var isCallbackKey = (key) => typeof key === "string" && /^on[A-Z]/.test(key);
@@ -346,6 +347,7 @@ function revealServerFrame(root, display) {
346
347
  }
347
348
  root.removeAttribute(SERVER_FRAME_ATTRIBUTE);
348
349
  root.removeAttribute("hidden");
350
+ root.classList.add(ROOT_CLASS_NAME);
349
351
  const style = root.style;
350
352
  if (display === void 0 || display === "") {
351
353
  style.removeProperty("display");
@@ -1196,6 +1198,7 @@ function DetailToggleButton(props) {
1196
1198
  }
1197
1199
  event.preventDefault();
1198
1200
  event.currentTarget.closest(".ssg-shell")?.focus({ preventScroll: true });
1201
+ props.onPress?.();
1199
1202
  }}
1200
1203
  onDblClick={(event) => event.stopPropagation()}
1201
1204
  >
@@ -1841,13 +1844,29 @@ function DateCellEditor(props) {
1841
1844
  import { onCleanup as onCleanup7, untrack as untrack10 } from "solid-js";
1842
1845
  function CustomCellEditor(props) {
1843
1846
  let alive = true;
1847
+ let late = null;
1848
+ const unregisterLateCommit = untrack10(() => props.onRegisterLateCommit)?.((commit) => {
1849
+ late = commit;
1850
+ });
1844
1851
  onCleanup7(() => {
1845
1852
  alive = false;
1853
+ unregisterLateCommit?.();
1846
1854
  });
1847
1855
  const context = untrack10(() => props.context);
1848
1856
  const sessionContext = Object.defineProperties({}, Object.getOwnPropertyDescriptors(context));
1849
- sessionContext.commit = (value, direction) => alive ? context.commit(value, direction) : { status: "noop" };
1857
+ sessionContext.commit = (value, direction) => {
1858
+ if (late !== null) {
1859
+ const commit = late;
1860
+ late = null;
1861
+ return commit(value);
1862
+ }
1863
+ return alive ? context.commit(value, direction) : { status: "noop" };
1864
+ };
1850
1865
  sessionContext.cancel = () => {
1866
+ if (late !== null) {
1867
+ late = null;
1868
+ return;
1869
+ }
1851
1870
  if (alive) {
1852
1871
  context.cancel();
1853
1872
  }
@@ -1856,6 +1875,8 @@ function CustomCellEditor(props) {
1856
1875
  }
1857
1876
 
1858
1877
  // src/editors/CellEditorLayer.tsx
1878
+ var NOOP2 = () => {
1879
+ };
1859
1880
  function CellEditorLayer(props) {
1860
1881
  const texts = useGridLocaleText();
1861
1882
  const editor = () => props.editor;
@@ -1914,7 +1935,11 @@ function CellEditorLayer(props) {
1914
1935
  cancel: () => props.onCancel()
1915
1936
  };
1916
1937
  return <Show8 when={session() !== null}>
1917
- <CustomCellEditor render={render} context={context} />
1938
+ <CustomCellEditor
1939
+ render={render}
1940
+ context={context}
1941
+ onRegisterLateCommit={(receiver) => props.onRegisterLateCommit?.(receiver) ?? NOOP2}
1942
+ />
1918
1943
  </Show8>;
1919
1944
  };
1920
1945
  const renderEditor = (type, sessionId) => {
@@ -3489,11 +3514,14 @@ function GridShellBody(props, features, mountGate, mode) {
3489
3514
  "effect",
3490
3515
  "activeCellNotifier"
3491
3516
  );
3517
+ const edit = createEditController();
3492
3518
  const pointer = createPointerInteractionsController();
3493
3519
  connectController(pointer, () => ({
3494
3520
  gridRootRef,
3495
3521
  bodyScrollRef,
3496
3522
  onCellDoubleClickRef: cellDoubleClickRef,
3523
+ // 押してフォーカスをルートへ移した後、開いたままの custom エディタの編集を終える(1.4.1 / AP-11)。
3524
+ endEditLeftOpen: edit.endEditLeftOpen,
3497
3525
  scrollContainerRef,
3498
3526
  leftPaneScrollRef,
3499
3527
  rightPaneScrollRef,
@@ -3869,7 +3897,6 @@ function GridShellBody(props, features, mountGate, mode) {
3869
3897
  // 最終列の Tab: その行のカードが開いていればカードの最初の要素へ、無ければ表の直後の目印から既定の Tab(段階 2 C-N2 / F-10)。
3870
3898
  onTabPastLastColumn: detailRows.handleTabPastLastColumn
3871
3899
  }), "render", "keyboard");
3872
- const edit = createEditController();
3873
3900
  connectController(edit, () => ({
3874
3901
  uiState: ui(),
3875
3902
  rows: rows(),
@@ -4182,6 +4209,8 @@ function GridShellBody(props, features, mountGate, mode) {
4182
4209
  scrollContainerRef,
4183
4210
  bodyScrollRef,
4184
4211
  gridRootRef,
4212
+ // 追加(1.4.1 / AP-11 のレビュー): フォーカスを移した後に、開いたままの custom エディタの編集を終える。
4213
+ endEditLeftOpen: edit.endEditLeftOpen,
4185
4214
  commitRowMove: commitRowMoveFromDrag,
4186
4215
  ghostSlot: slots().dragGhost,
4187
4216
  motion: resolvedMotion() === "off" ? "ghost" : props.rowDragMotion ?? "ghost"
@@ -4209,6 +4238,7 @@ function GridShellBody(props, features, mountGate, mode) {
4209
4238
  return;
4210
4239
  }
4211
4240
  gridRootRef.current?.focus({ preventScroll: true });
4241
+ edit.endEditLeftOpen();
4212
4242
  if (enableSelectAllRows()) {
4213
4243
  rowSelectionCommands.handleToggleSelectAllRows();
4214
4244
  return;
@@ -4574,7 +4604,7 @@ function GridShellBody(props, features, mountGate, mode) {
4574
4604
  return indexes ? resolveDataRowNumber2(indexes, cell.rowIndex) : cell.rowIndex + 1;
4575
4605
  };
4576
4606
  return <Show11 when={expandable()}>
4577
- <DetailToggleButton detail={detail} rowNumber={rowNumber()} />
4607
+ <DetailToggleButton detail={detail} rowNumber={rowNumber()} onPress={edit.endEditLeftOpen} />
4578
4608
  </Show11>;
4579
4609
  }
4580
4610
  return column.renderCell({
@@ -4864,6 +4894,7 @@ function GridShellBody(props, features, mountGate, mode) {
4864
4894
  onCommit={(value, direction) => edit.commitEdit(value, direction)}
4865
4895
  onCancel={edit.cancelEdit}
4866
4896
  onRegisterFlush={edit.registerDraftFlush}
4897
+ onRegisterLateCommit={edit.registerLateCommitReceiver}
4867
4898
  align={editingColumn()?.align}
4868
4899
  enterMove={props.editorEnterMove}
4869
4900
  domId={cellEditorDomId}
@@ -4958,7 +4989,7 @@ function GridShellBody(props, features, mountGate, mode) {
4958
4989
  <GridPortalContext value={portalContext}>
4959
4990
  <div
4960
4991
  class={[
4961
- "ssg-root",
4992
+ mode === "hiddenFrame" ? void 0 : "ssg-root",
4962
4993
  themeClassName(),
4963
4994
  slots().root?.className,
4964
4995
  props.className,
@@ -5047,6 +5078,7 @@ function GridShellBody(props, features, mountGate, mode) {
5047
5078
  onFocusIn={(event) => {
5048
5079
  if (event.target === event.currentTarget) {
5049
5080
  gridRootRef.current?.focus({ preventScroll: true });
5081
+ edit.endEditLeftOpen();
5050
5082
  }
5051
5083
  }}
5052
5084
  role="grid"
@@ -2,4 +2,5 @@ import type { CellDetailContext } from '@ishibashi0112/spreadsheet-grid-core';
2
2
  export declare function DetailToggleButton(props: {
3
3
  detail: CellDetailContext;
4
4
  rowNumber: number;
5
+ onPress?: (() => void) | undefined;
5
6
  }): import("@solidjs/web").JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ishibashi0112/spreadsheet-grid-solid",
3
- "version": "1.4.0",
3
+ "version": "1.4.1",
4
4
  "description": "Solid 2.0 向けの仮想化データグリッド。React 版(@ishibashi0112/spreadsheet-grid)と同じ props・同じ見た目で、SSRM(書き戻し付き)/ 行グルーピング + 集計 / Master/Detail / 範囲選択 + クリップボードを MIT で。IME に強い編集、100 万行の仮想化。コアは @ishibashi0112/spreadsheet-grid-core。",
5
5
  "keywords": [
6
6
  "solid",
@@ -101,7 +101,7 @@
101
101
  },
102
102
  "dependencies": {
103
103
  "@tanstack/virtual-core": "^3.19.11",
104
- "@ishibashi0112/spreadsheet-grid-core": "1.4.0"
104
+ "@ishibashi0112/spreadsheet-grid-core": "1.4.1"
105
105
  },
106
106
  "devDependencies": {
107
107
  "@babel/core": "^7.28.0",
@@ -115,7 +115,7 @@
115
115
  "react": "^19.3.0",
116
116
  "react-dom": "^19.3.0",
117
117
  "solid-js": "2.0.0",
118
- "@ishibashi0112/spreadsheet-grid": "1.4.0"
118
+ "@ishibashi0112/spreadsheet-grid": "1.4.1"
119
119
  },
120
120
  "scripts": {
121
121
  "dev": "vp dev --config vite.config.ts",
@@ -66,7 +66,7 @@ export function Inventory() {
66
66
  - **改行を含む値の列は `editor: { type: 'text', multiline: true }`。** 既定の 1 行の入力欄はブラウザが改行を消すので、直して確定すると改行が無くなります。
67
67
  - **行のクラスは行と各セルの両方に付く。** `getRowClassName` の class と style は行・「#」セル・各セルに付きます。行を薄くするなら class を返して `.ssg-body-row.<class> { opacity: 0.5 }` と書きます(style で `opacity` を書くと 2 回掛かります)。
68
68
  - **テスト(Vitest + jsdom)。** Vitest にも `@solidjs/vite-plugin` を入れ、`/testing` の `installJsdomLayoutStubs()` を呼びます。signal を変えた・イベントを送った後は、DOM を見る前に `flush()` を呼びます(React 版の `act()` の代わり)。
69
- - **SSR。** SolidStart は Solid 1 だけなので、Vite の SSR と `@solidjs/vite-plugin`(`ssr: true`)で `renderToString` / `hydrate` を使います。サーバーは React 版と同じく行(行番号と固定列)・件数・合計まで描き、ハイドレーションの後にブラウザで計算した行へ入れ替えます(サーバーの HTML には隠した骨組みと写しの `.ssg-root` が 2 つ)。本番のサーバーは `NODE_ENV=production` で動かします(README の「SSR」)。
69
+ - **SSR。** SolidStart は Solid 1 だけなので、Vite の SSR と `@solidjs/vite-plugin`(`ssr: true`)で `renderToString` / `hydrate` を使います。サーバーは React 版と同じく行(行番号と固定列)・件数・合計まで描き、ハイドレーションの後にブラウザで計算した行へ入れ替えます(サーバーの HTML には隠した骨組みと写しが並ぶ。`.ssg-root` は写しだけ)。本番のサーバーは `NODE_ENV=production` で動かします(README の「SSR」)。
70
70
  - **UI の言語。** 既定は日本語です。英語は `@ishibashi0112/spreadsheet-grid-solid/locales/en` の `localeTextEn` を `localeText` に渡します。
71
71
 
72
72
  ## 4. 入口の選び方