@ishibashi0112/spreadsheet-grid-core 1.0.2 → 1.1.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.
Files changed (90) hide show
  1. package/dist/controllers/clipboardController.cjs +1 -1
  2. package/dist/controllers/clipboardController.d.ts +3 -0
  3. package/dist/controllers/clipboardController.js +69 -50
  4. package/dist/controllers/columnAutosizeRunner.cjs +1 -1
  5. package/dist/controllers/columnAutosizeRunner.d.ts +1 -0
  6. package/dist/controllers/columnAutosizeRunner.js +10 -9
  7. package/dist/controllers/columnHeaderDragController.cjs +1 -1
  8. package/dist/controllers/columnHeaderDragController.js +169 -168
  9. package/dist/controllers/columnMenuController.cjs +1 -1
  10. package/dist/controllers/columnMenuController.js +71 -69
  11. package/dist/controllers/contextMenuController.cjs +1 -1
  12. package/dist/controllers/contextMenuController.d.ts +4 -1
  13. package/dist/controllers/contextMenuController.js +55 -38
  14. package/dist/controllers/fillHandleController.cjs +1 -1
  15. package/dist/controllers/fillHandleController.d.ts +1 -0
  16. package/dist/controllers/fillHandleController.js +135 -135
  17. package/dist/controllers/historyController.cjs +1 -1
  18. package/dist/controllers/historyController.d.ts +6 -0
  19. package/dist/controllers/historyController.js +79 -37
  20. package/dist/controllers/keyboardController.cjs +1 -1
  21. package/dist/controllers/keyboardController.d.ts +1 -0
  22. package/dist/controllers/keyboardController.js +4 -0
  23. package/dist/controllers/pointerInteractionsController.cjs +1 -1
  24. package/dist/controllers/pointerInteractionsController.d.ts +1 -0
  25. package/dist/controllers/pointerInteractionsController.js +142 -142
  26. package/dist/controllers/popoverSupport.cjs +1 -1
  27. package/dist/controllers/popoverSupport.d.ts +1 -0
  28. package/dist/controllers/popoverSupport.js +9 -4
  29. package/dist/controllers/rowDragController.cjs +1 -1
  30. package/dist/controllers/rowDragController.d.ts +1 -0
  31. package/dist/controllers/rowDragController.js +145 -144
  32. package/dist/controllers/toolPanelController.cjs +1 -1
  33. package/dist/controllers/toolPanelController.js +26 -14
  34. package/dist/controllers/tooltipController.cjs +1 -1
  35. package/dist/controllers/tooltipController.js +74 -72
  36. package/dist/controllers/viewportSyncController.cjs +1 -1
  37. package/dist/controllers/viewportSyncController.d.ts +3 -1
  38. package/dist/controllers/viewportSyncController.js +66 -28
  39. package/dist/engine/exportCommands.cjs +1 -1
  40. package/dist/engine/exportCommands.js +16 -9
  41. package/dist/engine/gridApi.cjs +2 -2
  42. package/dist/engine/gridApi.d.ts +6 -2
  43. package/dist/engine/gridApi.js +5 -5
  44. package/dist/index.cjs +1 -1
  45. package/dist/index.d.ts +3 -1
  46. package/dist/index.js +7 -6
  47. package/dist/locales/en.cjs +1 -1
  48. package/dist/locales/en.js +3 -0
  49. package/dist/logic/autoScrollGeometry.cjs +1 -1
  50. package/dist/logic/autoScrollGeometry.d.ts +2 -0
  51. package/dist/logic/autoScrollGeometry.js +3 -3
  52. package/dist/logic/editorValues.cjs +1 -1
  53. package/dist/logic/editorValues.js +37 -34
  54. package/dist/logic/exportCsv.cjs +3 -3
  55. package/dist/logic/exportCsv.d.ts +3 -1
  56. package/dist/logic/exportCsv.js +22 -20
  57. package/dist/logic/exportData.cjs +1 -1
  58. package/dist/logic/exportData.d.ts +3 -1
  59. package/dist/logic/exportData.js +40 -36
  60. package/dist/logic/filtering.cjs +1 -1
  61. package/dist/logic/filtering.d.ts +2 -1
  62. package/dist/logic/filtering.js +16 -3
  63. package/dist/logic/groupExport.cjs +1 -1
  64. package/dist/logic/groupExport.js +28 -27
  65. package/dist/logic/grouping.cjs +1 -1
  66. package/dist/logic/grouping.d.ts +1 -0
  67. package/dist/logic/grouping.js +52 -41
  68. package/dist/logic/historyRebase.cjs +1 -0
  69. package/dist/logic/historyRebase.d.ts +5 -0
  70. package/dist/logic/historyRebase.js +36 -0
  71. package/dist/logic/localeTextFeatures.cjs +1 -1
  72. package/dist/logic/localeTextFeatures.d.ts +4 -0
  73. package/dist/logic/localeTextFeatures.js +8 -5
  74. package/dist/logic/localeTextPopups.cjs +1 -1
  75. package/dist/logic/localeTextPopups.d.ts +1 -0
  76. package/dist/logic/localeTextPopups.js +1 -0
  77. package/dist/logic/selectLabels.cjs +1 -0
  78. package/dist/logic/selectLabels.d.ts +3 -0
  79. package/dist/logic/selectLabels.js +41 -0
  80. package/dist/logic/valueParsers.cjs +1 -0
  81. package/dist/logic/valueParsers.d.ts +14 -0
  82. package/dist/logic/valueParsers.js +23 -0
  83. package/dist/model/gridTypes.core.d.ts +174 -18
  84. package/dist/utils/clipboard.cjs +4 -4
  85. package/dist/utils/clipboard.d.ts +14 -2
  86. package/dist/utils/clipboard.js +101 -49
  87. package/dist/utils/popupContainer.cjs +1 -0
  88. package/dist/utils/popupContainer.d.ts +8 -0
  89. package/dist/utils/popupContainer.js +60 -0
  90. package/package.json +1 -1
@@ -2,6 +2,7 @@ import { DEFAULT_FILTERING_LOCALE_TEXT as e } from "./localeTextFeatures.js";
2
2
  //#region src/logic/localeTextPopups.ts
3
3
  var t = {
4
4
  apply: "適用",
5
+ toolPanelLabel: "ツールパネル",
5
6
  columnsPinnedLeft: "左固定",
6
7
  columnsUnpinned: "固定なし",
7
8
  columnsPinnedRight: "右固定",
@@ -0,0 +1 @@
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=new WeakMap,t=t=>{let n=e.get(t);if(!n||n.size!==t.length){n={size:t.length,labelByValue:new Map,valueByLabel:new Map};for(let e of t){n.labelByValue.has(e.value)||n.labelByValue.set(e.value,e.label);let t=e.label.trim();t!==``&&!n.valueByLabel.has(t)&&n.valueByLabel.set(t,e.value)}e.set(t,n)}return n},n=(e,t)=>{let n=e.editor;if(n?.type!==`select`||n.clipboard!==`label`)return;if(typeof n.options!=`function`)return Array.isArray(n.options)?n.options:void 0;if(t===void 0)return;let r=n.options(t);return Array.isArray(r)?r:void 0},r=(e,r,i)=>{if(e.formatClipboardValue&&i!==void 0)return e.formatClipboardValue(r,i);let a=String(r??``),o=n(e,i);if(o===void 0)return a;let s=t(o).labelByValue.get(a);return s===void 0||s.trim()===``?a:s},i=e=>{let r=e.editor;if(!(r?.type!==`select`||r.clipboard!==`label`))return(r,i)=>{let a=n(e,i);if(a===void 0)return r;let o=t(a),s=r.trim(),c=o.valueByLabel.get(s);return c===void 0?o.labelByValue.has(r)?r:o.labelByValue.has(s)?s:r:c}};exports.formatCellClipboardText=r,exports.resolveSelectLabelParser=i;
@@ -0,0 +1,3 @@
1
+ import type { GridColumn } from '../model/gridTypes.unbound.js';
2
+ export declare const formatCellClipboardText: <T>(column: GridColumn<T>, value: unknown, row: T | undefined) => string;
3
+ export declare const resolveSelectLabelParser: <T>(column: GridColumn<T>) => ((raw: string, row: T) => unknown) | undefined;
@@ -0,0 +1,41 @@
1
+ //#region src/logic/selectLabels.ts
2
+ var e = /* @__PURE__ */ new WeakMap(), t = (t) => {
3
+ let n = e.get(t);
4
+ if (!n || n.size !== t.length) {
5
+ n = {
6
+ size: t.length,
7
+ labelByValue: /* @__PURE__ */ new Map(),
8
+ valueByLabel: /* @__PURE__ */ new Map()
9
+ };
10
+ for (let e of t) {
11
+ n.labelByValue.has(e.value) || n.labelByValue.set(e.value, e.label);
12
+ let t = e.label.trim();
13
+ t !== "" && !n.valueByLabel.has(t) && n.valueByLabel.set(t, e.value);
14
+ }
15
+ e.set(t, n);
16
+ }
17
+ return n;
18
+ }, n = (e, t) => {
19
+ let n = e.editor;
20
+ if (n?.type !== "select" || n.clipboard !== "label") return;
21
+ if (typeof n.options != "function") return Array.isArray(n.options) ? n.options : void 0;
22
+ if (t === void 0) return;
23
+ let r = n.options(t);
24
+ return Array.isArray(r) ? r : void 0;
25
+ }, r = (e, r, i) => {
26
+ if (e.formatClipboardValue && i !== void 0) return e.formatClipboardValue(r, i);
27
+ let a = String(r ?? ""), o = n(e, i);
28
+ if (o === void 0) return a;
29
+ let s = t(o).labelByValue.get(a);
30
+ return s === void 0 || s.trim() === "" ? a : s;
31
+ }, i = (e) => {
32
+ let r = e.editor;
33
+ if (!(r?.type !== "select" || r.clipboard !== "label")) return (r, i) => {
34
+ let a = n(e, i);
35
+ if (a === void 0) return r;
36
+ let o = t(a), s = r.trim(), c = o.valueByLabel.get(s);
37
+ return c === void 0 ? o.labelByValue.has(r) ? r : o.labelByValue.has(s) ? s : r : c;
38
+ };
39
+ };
40
+ //#endregion
41
+ export { r as formatCellClipboardText, i as resolveSelectLabelParser };
@@ -0,0 +1 @@
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./editorValues.cjs");var t=/^\s*[((]([^()()]*)[))]\s*$/,n=/^[\s\u3000]*[-+\u2212\uFF0D\uFF0B\u30FC]/;function r(r={}){let i=(r.strip??[]).filter(e=>e!==``),a=r.negativeParentheses===!0;return r=>{if(r.trim()===``)return null;let o=r;for(let e of i)o=o.split(e).join(``);let s=!1;if(a){let e=t.exec(o);if(e){if(o=e[1]??``,n.test(o))return r;s=!0}}let c=e.parseNumberText(o);return c===null?r:s&&c!==0?-c:c}}exports.numberParser=r;
@@ -0,0 +1,14 @@
1
+ /** `numberParser` のオプション。 */
2
+ export type NumberParserOptions = {
3
+ /** 読む前に外す文字(通貨記号や単位。例: `['¥', '¥', '円', '$']`)。外したあとが数値でなければ元の文字のまま。 */
4
+ strip?: readonly string[] | undefined;
5
+ /** `true` で、かっこで囲んだ数(`(1,200)` / `(1,200)`。会計の書式)を負の数として読む。既定 `false`。 */
6
+ negativeParentheses?: boolean | undefined;
7
+ };
8
+ /**
9
+ * 「文字列 → 数値」のパーサを作る(列の `parseClipboardValue` に渡す。貼り付け / Delete / エディタの確定で共通)。
10
+ * 読み方は number エディタの既定のパーサと同じ: 空・空白だけは `null`、数値として読める文字は `number`(全角の数字・符号・
11
+ * 小数点と 3 桁区切りも読む)、読めない文字は元の文字のまま(`validationMode` の `'mark'` なら印、`'reject'` なら書かない)。
12
+ * `strip` で通貨記号や単位を先に外し、`negativeParentheses` で `(1,200)` を `-1200` と読む。
13
+ */
14
+ export declare function numberParser(options?: NumberParserOptions): (raw: string) => unknown;
@@ -0,0 +1,23 @@
1
+ import { parseNumberText as e } from "./editorValues.js";
2
+ //#region src/logic/valueParsers.ts
3
+ var t = /^\s*[((]([^()()]*)[))]\s*$/, n = /^[\s\u3000]*[-+\u2212\uFF0D\uFF0B\u30FC]/;
4
+ function r(r = {}) {
5
+ let i = (r.strip ?? []).filter((e) => e !== ""), a = r.negativeParentheses === !0;
6
+ return (r) => {
7
+ if (r.trim() === "") return null;
8
+ let o = r;
9
+ for (let e of i) o = o.split(e).join("");
10
+ let s = !1;
11
+ if (a) {
12
+ let e = t.exec(o);
13
+ if (e) {
14
+ if (o = e[1] ?? "", n.test(o)) return r;
15
+ s = !0;
16
+ }
17
+ }
18
+ let c = e(o);
19
+ return c === null ? r : s && c !== 0 ? -c : c;
20
+ };
21
+ }
22
+ //#endregion
23
+ export { r as numberParser };
@@ -241,7 +241,11 @@ export type CellRenderContext<T, F extends GridFrameworkTypes = GridFrameworkTyp
241
241
  readOnly: boolean;
242
242
  setValue: (value: unknown) => void;
243
243
  detail?: CellDetailContext | undefined;
244
+ /** 固定行(`pinnedTopRows` / `pinnedBottomRows`)のセルのときだけ `'top'` / `'bottom'`(本体の行では無い)。 */
245
+ pinned?: GridPinnedRowPosition | undefined;
244
246
  };
247
+ /** 固定行の帯。`'top'` は `pinnedTopRows`、`'bottom'` は `pinnedBottomRows`。 */
248
+ export type GridPinnedRowPosition = 'top' | 'bottom';
245
249
  export type CellDetailContext = {
246
250
  expanded: boolean;
247
251
  expandable: boolean;
@@ -473,6 +477,8 @@ export type CellStyleContext<T, F extends GridFrameworkTypes = GridFrameworkType
473
477
  isSelected: boolean;
474
478
  isEditing: boolean;
475
479
  readOnly: boolean;
480
+ /** 固定行(`pinnedTopRows` / `pinnedBottomRows`)のセルのときだけ `'top'` / `'bottom'`。 */
481
+ pinned?: GridPinnedRowPosition | undefined;
476
482
  };
477
483
  /**
478
484
  * `canEditCell` の第 5 引数。`sourceRowIndex` は元 `rows` の index(serverSide では view index と同値)、
@@ -488,6 +494,8 @@ export type RowStyleContext<T> = {
488
494
  sourceRowIndex: number;
489
495
  rowKey: GridRowKey;
490
496
  isSelected: boolean;
497
+ /** 固定行(`pinnedTopRows` / `pinnedBottomRows`)のときだけ `'top'` / `'bottom'`。 */
498
+ pinned?: GridPinnedRowPosition | undefined;
491
499
  };
492
500
  export type CellRenderState = {
493
501
  isActive: boolean;
@@ -526,6 +534,14 @@ export type GridColumnEditor<T, F extends GridFrameworkTypes = GridFrameworkType
526
534
  } | {
527
535
  type: 'select';
528
536
  options: GridSelectEditorOption[] | ((row: T) => GridSelectEditorOption[]);
537
+ /**
538
+ * クリップボードとのやり取りの文字(1.1.0 から)。`'value'`(既定)は値のまま。`'label'` はコピー / CSV / TSV /
539
+ * `getExportData` の `text` を候補の label にし、貼り付けた文字が label ならその value へ読み替える(value はそのまま、
540
+ * どちらでもない文字は生のまま)。列の `formatClipboardValue` / `parseClipboardValue` があればそちらが勝つ。
541
+ *
542
+ * @defaultValue `'value'`
543
+ */
544
+ clipboard?: 'value' | 'label' | undefined;
529
545
  } | {
530
546
  type: 'date';
531
547
  } | {
@@ -564,6 +580,43 @@ export type GridInvalidCell = {
564
580
  columnKey: string;
565
581
  message: string;
566
582
  };
583
+ /** `applyRows` のオプション。 */
584
+ export type GridApplyRowsOptions = {
585
+ /**
586
+ * `false` で「元に戻す」の履歴に積まず、今の履歴も消さない(株価のような外からのライブの更新)。元に戻す / やり直すは、
587
+ * その後の外からの更新を残したまま、グリッドでの編集だけを取り消す / やり直す(行は `rowKeyGetter` で対応づける)。既定 `true`。
588
+ */
589
+ undoable?: boolean | undefined;
590
+ };
591
+ /**
592
+ * 貼り付けで書かなかったセル(`onPasteSkipped`)。`reason` は `'readOnly'`(編集できないセル = 列の `editable` /
593
+ * `canEditCell`)か `'invalid'`(`validationMode: 'reject'` の列で検査に通らなかった値)。
594
+ */
595
+ export type GridPasteSkippedCell<T> = {
596
+ /** 貼り付け先の行(表の末尾に足した行を含む)。 */
597
+ row: T;
598
+ /** 行のキー(`rowKeyGetter`。無ければ `rows` の index)。 */
599
+ rowKey: GridRowKey;
600
+ /** ビュー行 index(フィルター / ソート後の位置。末尾に足した行は足した後の位置)。 */
601
+ rowIndex: number;
602
+ /** 列の key。 */
603
+ columnKey: string;
604
+ /** 表示列の index(合成列を含む画面の並び)。 */
605
+ colIndex: number;
606
+ /** 貼り付けた文字(そのセルの 1 つぶん)。 */
607
+ text: string;
608
+ /** 書かなかったわけ。 */
609
+ reason: 'readOnly' | 'invalid';
610
+ /** `'invalid'` のとき、列のパーサが読んだ値(`'readOnly'` では読まないので `undefined`)。 */
611
+ value?: unknown;
612
+ /** `'invalid'` のときの検査のメッセージ。 */
613
+ message?: string | undefined;
614
+ };
615
+ /** `onPasteSkipped` の引数。 */
616
+ export type GridPasteSkippedParams<T> = {
617
+ /** 書かなかったセル(貼り付けた文字の順。行ごとに左から)。 */
618
+ cells: GridPasteSkippedCell<T>[];
619
+ };
567
620
  export type EditorCommitResult = {
568
621
  status: 'committed';
569
622
  } | {
@@ -718,6 +771,16 @@ export type GridColumn<T, F extends GridFrameworkTypes = GridFrameworkTypes> = {
718
771
  * もないときは無視。
719
772
  */
720
773
  aggFunc?: GridAggFuncName | GridAggFunc<T, F> | undefined;
774
+ /**
775
+ * 行グルーピングのグループ行の見出しの文字(1.1.0 から)。`'value'` は値の文字(1.0 までと同じ)、
776
+ * `'formatted'` は列の `valueFormatter`(セルと同じ表示名。無ければ値の文字)、
777
+ * 関数はその返り値(`row` はそのグループの最初の行)。空白のグループは「(空白)」のまま。
778
+ * エクスポートの小計の行の見出しはコピーと同じ規則(`formatClipboardValue`)。
779
+ * 詳細は「値と表示名が別の列」節。
780
+ *
781
+ * @defaultValue `'value'`
782
+ */
783
+ groupLabel?: 'value' | 'formatted' | CellValueFormatter<T, F> | undefined;
721
784
  /**
722
785
  * 値アクセサ。`setValue` の無い列へ書き込むと値は `row[key]` へ入り、表示(`getValue`)
723
786
  * は変わらない。計算列は `editable: false` にするか `setValue` を渡す(開発時は、
@@ -783,7 +846,9 @@ export type GridColumn<T, F extends GridFrameworkTypes = GridFrameworkTypes> = {
783
846
  headerAlign?: 'left' | 'center' | 'right' | undefined;
784
847
  /**
785
848
  * セル表示値の整形(UI 表示のみ)。`renderCell` 未指定の既定セルが返り値を表示。組み込み
786
- * `numberFormatter` 等を渡せる。元の値/編集/コピー/ソート/フィルターには影響しない。
849
+ * `numberFormatter` 等を渡せる。
850
+ * 元の値/編集/コピー/ソート/フィルターには影響しない(全体フィルターは `globalFilterMatch`、
851
+ * グループ行の見出しは `groupLabel: 'formatted'` で使える。1.1.0 から)。
787
852
  * グループ行の集計値と合計行の値の整形にも使い、そのときは元の行が無いので `row` は
788
853
  * `undefined`(型は `T | undefined`。`row` を読むときは `row?.x` と書く)。
789
854
  */
@@ -858,12 +923,17 @@ export type GridColumn<T, F extends GridFrameworkTypes = GridFrameworkTypes> = {
858
923
  /**
859
924
  * 「文字列 → セル値」のパーサ(貼り付け / クリア / エディタ commit
860
925
  * で共通)。**明示指定が常に優先**。未指定で `editor` が number / date / checkbox
861
- * のときは種別の既定パーサが自動供給されます(「セルエディタ」節の表参照)。
926
+ * のときは種別の既定パーサが自動供給されます(「セルエディタ」節の表参照)。number
927
+ * の既定と同じ読み方に通貨記号などを足すときは組み込みの `numberParser({ strip })`(1.1.0 から。
928
+ * 「貼り付けで読めない値」節)。
862
929
  *
863
930
  * @defaultValue editor 既定パーサ
864
931
  */
865
932
  parseClipboardValue?: ((raw: string, row: T) => unknown) | undefined;
866
- /** コピー時のフォーマッタ。 */
933
+ /**
934
+ * コピー時のフォーマッタ(CSV / TSV と `getExportData` の `text` も同じ)。未指定で select
935
+ * エディタの `clipboard: 'label'` の列は候補の label(1.1.0 から)。
936
+ */
867
937
  formatClipboardValue?: ((value: unknown, row: T) => string) | undefined;
868
938
  };
869
939
  export type ColumnResizeDragState = {
@@ -1131,6 +1201,8 @@ export type GridLocaleText = {
1131
1201
  toolPanelSort: string;
1132
1202
  /** ツールパネルのタブ。既定 `列`、英語 `Columns`。 */
1133
1203
  toolPanelColumns: string;
1204
+ /** ツールパネル(ダイアログ)の読み上げの名前(1.1.0 から)。既定 `ツールパネル`、英語 `Tool panel`。 */
1205
+ toolPanelLabel: string;
1134
1206
  /** 列のタブの見出し。既定 `左固定`、英語 `Pinned left`。 */
1135
1207
  columnsPinnedLeft: string;
1136
1208
  /** 列のタブの見出し。既定 `固定なし`、英語 `Not pinned`。 */
@@ -1542,6 +1614,14 @@ export type GridLocaleText = {
1542
1614
  }>;
1543
1615
  /** 同上の × の読み上げの名前。既定 `保存エラー通知を閉じる`、英語 `Dismiss the save error`。 */
1544
1616
  dismissSaveError: string;
1617
+ /** 上の固定行の行見出しの読み上げの名前(`pinnedTopRows`)。既定 `上に固定 {row}`、英語 `Pinned to top {row}`。 */
1618
+ pinnedTopRow: GridLocaleTextTemplate<{
1619
+ row: number;
1620
+ }>;
1621
+ /** 下の固定行の行見出しの読み上げの名前(`pinnedBottomRows`)。既定 `下に固定 {row}`、英語 `Pinned to bottom {row}`。 */
1622
+ pinnedBottomRow: GridLocaleTextTemplate<{
1623
+ row: number;
1624
+ }>;
1545
1625
  /** 合計行の左端の文字(`totalRow.label` を渡せばそちら)。既定 `合計`、英語 `Total`。 */
1546
1626
  totalRowLabel: string;
1547
1627
  /** 合計行 / グループ行の集計の種類。既定 `平均`、英語 `Avg`。 */
@@ -1805,13 +1885,13 @@ export type GridClassNames<F extends GridFrameworkTypes = GridFrameworkTypes> =
1805
1885
  totalCell?: GridSlotProps<F> | undefined;
1806
1886
  /**
1807
1887
  * 付与先: ポータル系パネルの root(列メニュー / フィルター / コンテキストメニュー / select
1808
- * エディタ候補 / ツールパネル。`document.body` 直下)
1888
+ * エディタ候補 / ツールパネル。表の外 = `popupContainer`)
1809
1889
  */
1810
1890
  popover?: GridSlotProps<F> | undefined;
1811
1891
  /** 付与先: メニュー項目 `.ssg-menu-item`(列メニュー / コンテキストメニュー) */
1812
1892
  menuItem?: GridSlotProps<F> | undefined;
1813
1893
  /**
1814
- * 付与先: カスタムツールチップ `.ssg-tooltip`(body 直下のシングルトン。
1894
+ * 付与先: カスタムツールチップ `.ssg-tooltip`(表の外のシングルトン。
1815
1895
  * 複数グリッド同居時は最後に更新したグリッドの値)
1816
1896
  */
1817
1897
  tooltip?: GridSlotProps<F> | undefined;
@@ -1865,12 +1945,14 @@ export type CsvExportOptions = {
1865
1945
  escapeFormulas?: boolean | undefined;
1866
1946
  includeLabelRows?: boolean | undefined;
1867
1947
  includeTotalRow?: boolean | undefined;
1948
+ includePinnedRows?: boolean | undefined;
1868
1949
  includeGroupRows?: boolean | undefined;
1869
1950
  };
1870
1951
  export type GridExportOptions = {
1871
1952
  scope?: CsvExportScope | undefined;
1872
1953
  includeLabelRows?: boolean | undefined;
1873
1954
  includeTotalRow?: boolean | undefined;
1955
+ includePinnedRows?: boolean | undefined;
1874
1956
  includeGroupRows?: boolean | undefined;
1875
1957
  };
1876
1958
  export type GridExportCell = {
@@ -1883,7 +1965,7 @@ export type GridExportData = {
1883
1965
  title: string;
1884
1966
  }[];
1885
1967
  rows: GridExportCell[][];
1886
- rowKinds?: Array<'data' | 'label' | 'total' | 'group'> | undefined;
1968
+ rowKinds?: Array<'data' | 'label' | 'total' | 'group' | 'pinned'> | undefined;
1887
1969
  };
1888
1970
  export type GridColumnState = {
1889
1971
  key: string;
@@ -2117,12 +2199,17 @@ export type SpreadsheetGridHandle<T> = {
2117
2199
  /**
2118
2200
  * 外からの変更(行の削除ボタン / 一括更新など)を「元に戻す」の履歴に積んでから `onRowsChange`
2119
2201
  * へ渡す(`Ctrl/Cmd+Z` / `undo()` で戻せる)。`rows` を外から直接差し替えると履歴は消えるので、
2120
- * 元に戻せるようにしたい変更はこれで渡す。履歴が無効(`enableUndoRedo={false}` / `readOnly`)
2121
- * なら積まずに `onRowsChange` へ渡す。`onRowsChange` が無いとき・serverSide
2122
- * では何もしない(開発時に警告)。渡すのは次の行の配列で、関数(`setRows((prev) => …)` の形)
2123
- * は受けない(今の `rows` から次の配列を作って渡す)。
2124
- */
2125
- applyRows: (nextRows: T[]) => void;
2202
+ * 元に戻せるようにしたい変更はこれで渡す。`nextRows` は次の行の配列か、関数(`(prev) => next`。
2203
+ * `prev` は最後に渡した行で、続けて呼んでも重なる。1.1.0 から)。`undoable: false`(1.1.0 から)
2204
+ * は履歴に積まず、今の履歴も消さない(株価のような外からのライブの更新)。そのときの元に戻す /
2205
+ * やり直すは、外からの更新を残したままグリッドでの編集だけを取り消す / やり直す(行は
2206
+ * `rowKeyGetter` で対応づける。無いときは位置なので、行を足す / 消す更新では `rowKeyGetter`
2207
+ * を書く。`rowKeyGetter` が無い表で行の数が変わったときと、行キーが重なっているときは、1.0
2208
+ * と同じく編集の前の行をそのまま戻す = 外からの更新も戻る)。履歴が無効(`enableUndoRedo={false}` /
2209
+ * `readOnly`)なら積まずに `onRowsChange` へ渡す。`onRowsChange` が無いとき・serverSide
2210
+ * では何もしない(開発時に警告)。
2211
+ */
2212
+ applyRows: (nextRows: T[] | ((prev: T[]) => T[]), options?: GridApplyRowsOptions | undefined) => void;
2126
2213
  /**
2127
2214
  * 指定グループを開閉する(`collapsed: true` = 折りたたみ)。`groupKey` は `getGroupRows()`
2128
2215
  * の記述子から取得。同一イベント内の連続呼び出しも正しく積み重なる。
@@ -2274,6 +2361,18 @@ export type FindChangeParams = {
2274
2361
  open: boolean;
2275
2362
  };
2276
2363
  export type GridMotion = 'auto' | 'on' | 'off';
2364
+ /**
2365
+ * ポップアップを描く場所(`popupContainer`)。`'auto'` はグリッドを囲むダイアログ(`<dialog>` / `popover` /
2366
+ * `aria-modal="true"` / `role="dialog"` / `role="alertdialog"`)の中、無ければ `document.body`。`'body'` はいつも
2367
+ * `document.body`。要素ならその中。関数はグリッドの要素を受け取って描く場所を返す(`null` / `undefined` なら
2368
+ * `document.body`。ポップアップを描くたびに呼ぶ)。
2369
+ */
2370
+ export type GridPopupContainer = 'auto' | 'body' | HTMLElement | ((gridElement: HTMLElement) => HTMLElement | null | undefined);
2371
+ /**
2372
+ * グローバルフィルターが照らし合わせる文字(`globalFilterMatch`)。`'value'` はセルの値の文字(1.0 までと同じ)、
2373
+ * `'display'` は画面の文字(列の `valueFormatter` の結果。無い列は値の文字)、`'both'` はどちらか。
2374
+ */
2375
+ export type GridGlobalFilterMatch = 'value' | 'display' | 'both';
2277
2376
  export type AutoSizeColumnsMode = 'onMount' | 'onDataChange' | false;
2278
2377
  export type ScrollHintTrigger = 'scroll' | 'hover' | 'always';
2279
2378
  export type ScrollHintRenderArgs<T> = {
@@ -2462,6 +2561,17 @@ export type SpreadsheetGridProps<T, F extends GridFrameworkTypes = GridFramework
2462
2561
  * と一緒に使う)。
2463
2562
  */
2464
2563
  createOverflowColumn?: ((columnIndex: number) => GridColumn<T, F>) | undefined;
2564
+ /**
2565
+ * 貼り付けで書かなかったセルの通知(1.1.0 から)。1 回の貼り付けで 1 回、
2566
+ * 書かなかったセルがあるときだけ呼ぶ(書いたセルは書く)。`params.cells` の各セルは `row` /
2567
+ * `rowKey` / `rowIndex`(ビュー行)/ `columnKey` / `colIndex` / `text`(貼り付けた文字)/
2568
+ * `reason`(`'readOnly'` = 編集できないセル(列の `editable` / `canEditCell`)、`'invalid'` =
2569
+ * `validationMode: 'reject'` の列で検査に通らない値)/ `value`(`'invalid'` のときパーサが読んだ値)
2570
+ * / `message`(`'invalid'` のときの検査のメッセージ)。`validationMode: 'mark'`(既定)
2571
+ * の列は書いて印を付けるので入らない。表の外(`createRow` / `createOverflowColumn`
2572
+ * が無くて足せない行 / 列)・ラベル行・グループ行は数えない。詳細は「貼り付けで読めない値」節。
2573
+ */
2574
+ onPasteSkipped?: ((params: GridPasteSkippedParams<T>) => void) | undefined;
2465
2575
  /**
2466
2576
  * uniform 行の行高(px)。未指定時は density プリセット(compact: `28` / comfortable: `44`)
2467
2577
  * から解決。明示指定が常に優先。
@@ -2511,9 +2621,10 @@ export type SpreadsheetGridProps<T, F extends GridFrameworkTypes = GridFramework
2511
2621
  * ・ドラッグゴースト・ツールチップへ適用。`'auto'` は `prefers-color-scheme` へ追従。`'class'`
2512
2622
  * は祖先の `class="dark"` か `data-theme="dark"` を CSS で見てダークにする(Tailwind / next-themes
2513
2623
  * / shadcn/ui / HeroUI のようなクラスによるダーク向け。サーバーの描画から正しい色になる。
2514
- * ポップアップ類は `document.body` の直下に出るので、`dark` のクラス / 属性は `<html>` か
2515
- * `<body>` に付ける)。Mantine のようにほかの方法でダークを決めるものは、利用側の解決値を
2516
- * `'light' | 'dark'` で渡す。個別の色調整はトークン(`--ssg-*`)の上書きで可能。
2624
+ * ポップアップ類は表の外(既定は `document.body` の直下。`popupContainer`)に出るので、`dark`
2625
+ * のクラス / 属性は `<html>` か `<body>` に付ける)。Mantine
2626
+ * のようにほかの方法でダークを決めるものは、利用側の解決値を `'light' | 'dark'` で渡す。
2627
+ * 個別の色調整はトークン(`--ssg-*`)の上書きで可能。
2517
2628
  *
2518
2629
  * @defaultValue `'light'`
2519
2630
  */
@@ -2530,6 +2641,18 @@ export type SpreadsheetGridProps<T, F extends GridFrameworkTypes = GridFramework
2530
2641
  * @defaultValue `'auto'`
2531
2642
  */
2532
2643
  motion?: GridMotion | undefined;
2644
+ /**
2645
+ * ポップアップ(列メニュー / 列フィルター / 右クリックメニュー / select の候補 / ツールパネル /
2646
+ * フィルハンドルのメニュー / ツールチップ / ドラッグのゴースト)を描く場所(1.1.0 から)。`'auto'`
2647
+ * はグリッドを囲むダイアログ(`<dialog>` / `popover` / `aria-modal="true"` / `role="dialog"` /
2648
+ * `role="alertdialog"`)の中、無ければ `document.body`。`'body'` はいつも `document.body`(1.0
2649
+ * までと同じ)。要素ならその中、関数はグリッドの要素を受け取って描く場所を返す(`null` /
2650
+ * `undefined` なら `document.body`。ポップアップを開いている間の描画ごとに呼ぶ。
2651
+ * 閉じている間は呼ばない)。詳細は「ダイアログの中のグリッド」節。
2652
+ *
2653
+ * @defaultValue `'auto'`
2654
+ */
2655
+ popupContainer?: GridPopupContainer | undefined;
2533
2656
  /**
2534
2657
  * 行の並び替えアニメ。ソート / フィルター / グループ開閉 / `rows` の差し替えで、
2535
2658
  * 描画中の行が新しい位置へ滑り(`--ssg-motion-base`)、
@@ -2801,6 +2924,17 @@ export type SpreadsheetGridProps<T, F extends GridFrameworkTypes = GridFramework
2801
2924
  * @defaultValue `true`
2802
2925
  */
2803
2926
  enableGlobalFilter?: boolean | undefined;
2927
+ /**
2928
+ * グローバルフィルターが照らし合わせる文字(1.1.0 から)。`'value'` はセルの値の文字(1.0
2929
+ * までと同じ)、`'display'` は画面の文字(列の `valueFormatter` の結果。無い列は値の文字)、`'both'`
2930
+ * はどちらか(値と表示名が別の列で、コードでも表示名でも探せる)。状態チップの
2931
+ * `label`・`renderCell` の中身は見ない。clientSide だけ(serverSide
2932
+ * ではグローバルフィルターの文字をサーバーへ渡すだけ。`manualFiltering` でも絞り込まない)。
2933
+ * 詳細は「値と表示名が別の列」節。
2934
+ *
2935
+ * @defaultValue `'value'`
2936
+ */
2937
+ globalFilterMatch?: GridGlobalFilterMatch | undefined;
2804
2938
  /**
2805
2939
  * 列ごとのフィルター。
2806
2940
  *
@@ -3099,8 +3233,10 @@ export type SpreadsheetGridProps<T, F extends GridFrameworkTypes = GridFramework
3099
3233
  * 行ごとの追加 class(または `{ className, style }`)。行コンテナ + 行ヘッダー「#」セル +
3100
3234
  * 各データセルに付与され、Tailwind / StyleX での行ハイライトに使える。`style`
3101
3235
  * はインラインで付与され、座標 / 寸法はグリッドが後勝ち(返した style は内容比較で memo される)。
3102
- * 第 3 引数 `ctx` は `{ row, rowIndex, sourceRowIndex, rowKey, isSelected }`(「補助型」節参照)。
3103
- * 既存の 2 引数関数もそのまま動く(後方互換)。グループ行は対象外。class と style
3236
+ * 第 3 引数 `ctx` は `{ row, rowIndex, sourceRowIndex, rowKey, isSelected, pinned? }`(「補助型」
3237
+ * 節参照)。固定行(`pinnedTopRows` / `pinnedBottomRows`)にも呼ばれ、そのときは `ctx.pinned` が
3238
+ * `'top'` / `'bottom'`(`rowIndex` / `sourceRowIndex` は固定行の中の位置)。既存の 2
3239
+ * 引数関数もそのまま動く(後方互換)。グループ行は対象外。class と style
3104
3240
  * は行と各セルの両方に付くので、`opacity` / `filter` のように重なる指定は style で返さず、class
3105
3241
  * を返して `.ssg-body-row.<class>` で行だけに当てる(style の `opacity: 0.5` は 0.25 になる)。
3106
3242
  */
@@ -3147,6 +3283,25 @@ export type SpreadsheetGridProps<T, F extends GridFrameworkTypes = GridFramework
3147
3283
  * @defaultValue —(無効)
3148
3284
  */
3149
3285
  totalRow?: boolean | TotalRowOptions<T, F> | undefined;
3286
+ /**
3287
+ * **固定行(上)**。列見出しのすぐ下に固定して表示する行(縦スクロールしても動かず、
3288
+ * 横スクロールと左右の固定列には付いていく)。目標値・前年の実績・平均のような比べる行を、
3289
+ * 本体の行とは別の配列で渡す(`rows` には入れない)。セルは列の `valueFormatter` /
3290
+ * `renderCell`(`ctx.pinned` が `'top'`)/ `cellClassName` / 条件付き書式で描く。表示専用(選択 /
3291
+ * 編集 / 貼り付け / コピー / キー操作 / セル内検索(`find`)の対象外。並べ替え /
3292
+ * フィルターも効かない)。行の高さは `rowHeight`。エクスポートは `includePinnedRows: true`
3293
+ * のときだけ。詳細は「固定行」節。
3294
+ *
3295
+ * @defaultValue —(無効)
3296
+ */
3297
+ pinnedTopRows?: T[] | undefined;
3298
+ /**
3299
+ * **固定行(下)**。表の下端(合計行(`totalRow`)があればそのすぐ上)に固定して表示する行。ほかは
3300
+ * `pinnedTopRows` と同じ(`ctx.pinned` は `'bottom'`)。
3301
+ *
3302
+ * @defaultValue —(無効)
3303
+ */
3304
+ pinnedBottomRows?: T[] | undefined;
3150
3305
  /**
3151
3306
  * **フィルハンドル**。選択範囲(無ければアクティブセル)の右下に小さな四角を出し、
3152
3307
  * 引いた先のセルを**連続データ**(1, 2, 3 … / 日付 / 曜日・月の名前 / `P-001` のような末尾の数)
@@ -3195,7 +3350,8 @@ export type SpreadsheetGridProps<T, F extends GridFrameworkTypes = GridFramework
3195
3350
  */
3196
3351
  enableContextMenu?: boolean | undefined;
3197
3352
  /**
3198
- * セル/行の**完全カスタム**コンテキストメニュー。右クリック時のみ呼ばれ、
3353
+ * セル/行の**完全カスタム**コンテキストメニュー。右クリックと、アクティブセルでの `Shift+F10` /
3354
+ * メニューキー(1.1.0)のときだけ呼ばれ(1 回の操作で 1 回)、
3199
3355
  * 返した項目でメニューを描画する(ライブラリは固定の既定項目を持たない)。opt-in は
3200
3356
  * `enableContextMenu={true}` かつ本コールバックの指定の両方。**未指定、または `[]`
3201
3357
  * を返したときはブラウザ標準の右クリックメニューへフォールスルー**(空パネルは出さない)。SSRM
@@ -1,7 +1,7 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./permissions.cjs"),t=require("../logic/detailRow.cjs"),n=require("../model/gridSelectors.cjs"),r=require("../logic/editorValues.cjs"),i=require("../logic/validation.cjs");var a=e=>{let t=e.replace(/\r\n/g,`
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./permissions.cjs"),t=require("../logic/detailRow.cjs"),n=require("../model/gridSelectors.cjs"),r=require("../logic/selectLabels.cjs"),i=require("../logic/editorValues.cjs"),a=require("../logic/validation.cjs");var o=e=>{let t=e.replace(/\r\n/g,`
2
2
  `).replace(/\r/g,`
3
3
  `);if(!t)return[];let n=[],r=[],i=``,a=0,o=t.length,s=-1,c=0;for(;a<o;){let e=t[a];if(i===``&&e===`"`&&a===c&&a!==s){let e=a+1,n=``,r=!1;for(;e<o;){let i=t[e];if(i===`"`){if(t[e+1]===`"`){n+=`"`,e+=2;continue}r=!0,e+=1;break}n+=i,e+=1}if(!r){s=a;continue}i=n,a=e;continue}if(e===` `){r.push(i),i=``,a+=1,c=a;continue}if(e===`
4
4
  `){r.push(i),n.push(r),r=[],i=``,a+=1,c=a;continue}i+=e,a+=1}return i===``&&r.length===0&&t.endsWith(`
5
- `)||(r.push(i),n.push(r)),n},o=e=>/[\t\n\r"]/.test(e)?`"${e.replace(/"/g,`""`)}"`:e,s=e=>e.map(o).join(` `),c=e=>{let t=e[e.length-1],n=e.join(`
6
- `);return t!==void 0&&/^\t*$/.test(t)?`${n}\n`:n},l=e=>e!==void 0&&!t.isSyntheticColumnKey(e.key),u=(e,t,n)=>{let r=[];for(let i=t;r.length<n;i+=1){let t=e[i];(t===void 0||l(t))&&r.push(i)}return r},d=(t,n)=>{let r=e.getCellValue(t,n);return n.formatClipboardValue?n.formatClipboardValue(r,t):String(r??``)},f=e=>e.filter(l),p=(e,t,r,i,a)=>{if(!i)return``;let o=[];if(i.type===`cell`){let t=n.normalizeCellRange(i.range),u=r.slice(t.start.col,t.end.col+1).filter(l);if(u.length===0)return``;for(let n=t.start.row;n<=t.end.row;n+=1){let t=e(n);t&&(a&&!a(t,n)||o.push(s(u.map(e=>d(t,e)))))}return c(o)}if(i.type===`row`){let t=n.normalizeRowRange(i.startRow,i.endRow),u=r.filter(l);if(u.length===0)return``;for(let n=t.startRow;n<=t.endRow;n+=1){let t=e(n);t&&(a&&!a(t,n)||o.push(s(u.map(e=>d(t,e)))))}return c(o)}let u=n.normalizeColumnRange(i.startCol,i.endCol),f=r.slice(u.startCol,u.endCol+1).filter(l);if(f.length===0)return``;for(let n=0;n<t;n+=1){let t=e(n);t&&(a&&!a(t,n)||o.push(s(f.map(e=>d(t,e)))))}return c(o)},m=(t,n,a,o,s,c,l)=>{if(o.length===0)return t;let d=[...t],f=u(a,c,o.reduce((e,t)=>Math.max(e,t.length),0));for(let t=0;t<o.length;t+=1){let c=s+t,u=n(c);if(u===void 0)continue;let p=d[u];if(!p)continue;let m=p,h=!1;for(let n=0;n<o[t].length;n+=1){let s=f[n],d=a[s];if(!d||!l(u,s,p,d,c))continue;let g=o[t][n],_=r.resolveCellParser(d)(g,p);i.decideCellWrite(d,p,_).action!==`reject`&&(m=e.setCellValue(m,d,_),h=!0)}h&&(d[u]=m)}return d},h=(e,t,n,a,o,s)=>{let c=[],l=u(t,o,n.reduce((e,t)=>Math.max(e,t.length),0));for(let o=0;o<n.length;o+=1){let u=a+o,d=e(u);if(d)for(let e=0;e<n[o].length;e+=1){let a=l[e],f=t[a];if(!f||!s(u,a,d,f))continue;let p=r.resolveCellParser(f)(n[o][e],d);i.decideCellWrite(f,d,p).action!==`reject`&&c.push({viewIndex:u,column:f,value:p})}}return c},g=e=>{let{body:t,activeElement:n}=document;if(!t)return!1;let r=document.createElement(`textarea`);r.value=e,r.setAttribute(`readonly`,``),r.style.position=`fixed`,r.style.top=`0`,r.style.left=`-9999px`,r.style.opacity=`0`,t.appendChild(r);let i;try{r.select(),i=document.execCommand(`copy`)}catch{i=!1}finally{t.removeChild(r),n instanceof HTMLElement&&n.focus()}return i},_=async e=>{if(navigator.clipboard?.writeText)try{return await navigator.clipboard.writeText(e),!0}catch{}return g(e)?!0:(console.warn(`[SpreadsheetGrid] クリップボードへのコピーに失敗しました(navigator.clipboard が利用できず、execCommand フォールバックも失敗)。
7
- [SpreadsheetGrid] Failed to copy to the clipboard (navigator.clipboard is unavailable and the execCommand fallback failed).`),!1)};exports.applyClipboardMatrixToRows=m,exports.buildClipboardCellEdits=h,exports.copyTextViaExecCommand=g,exports.escapeTsvField=o,exports.filterClipboardColumns=f,exports.formatClipboardCell=d,exports.joinTsvLines=c,exports.joinTsvRow=s,exports.parseClipboardText=a,exports.resolvePasteColumnIndexes=u,exports.serializeSelectionToTsv=p,exports.writeTextToClipboard=_;
5
+ `)||(r.push(i),n.push(r)),n},s=e=>/[\t\n\r"]/.test(e)?`"${e.replace(/"/g,`""`)}"`:e,c=e=>e.map(s).join(` `),l=e=>{let t=e[e.length-1],n=e.join(`
6
+ `);return t!==void 0&&/^\t*$/.test(t)?`${n}\n`:n},u=e=>e!==void 0&&!t.isSyntheticColumnKey(e.key),d=(e,t,n)=>{let r=[];for(let i=t;r.length<n;i+=1){let t=e[i];(t===void 0||u(t))&&r.push(i)}return r},f=(t,n)=>r.formatCellClipboardText(n,e.getCellValue(t,n),t),p=e=>e.filter(u),m=(e,t,r,i,a)=>{if(!i)return``;let o=[];if(i.type===`cell`){let t=n.normalizeCellRange(i.range),s=r.slice(t.start.col,t.end.col+1).filter(u);if(s.length===0)return``;for(let n=t.start.row;n<=t.end.row;n+=1){let t=e(n);t&&(a&&!a(t,n)||o.push(c(s.map(e=>f(t,e)))))}return l(o)}if(i.type===`row`){let t=n.normalizeRowRange(i.startRow,i.endRow),s=r.filter(u);if(s.length===0)return``;for(let n=t.startRow;n<=t.endRow;n+=1){let t=e(n);t&&(a&&!a(t,n)||o.push(c(s.map(e=>f(t,e)))))}return l(o)}let s=n.normalizeColumnRange(i.startCol,i.endCol),d=r.slice(s.startCol,s.endCol+1).filter(u);if(d.length===0)return``;for(let n=0;n<t;n+=1){let t=e(n);t&&(a&&!a(t,n)||o.push(c(d.map(e=>f(t,e)))))}return l(o)},h=(t,n,r,o,s,c,l,u,f)=>{if(o.length===0)return t;let p=[...t],m=d(r,c,o.reduce((e,t)=>Math.max(e,t.length),0));for(let t=0;t<o.length;t+=1){let c=s+t,d=n(c);if(d===void 0)continue;let h=p[d];if(!h)continue;let g=h,_=!1;for(let n=0;n<o[t].length;n+=1){let s=m[n],p=r[s];if(!p)continue;let v=o[t][n];if(!l(d,s,h,p,c)){u?.({rowIndex:c,sourceRowIndex:d,colIndex:s,row:h,column:p,text:v,reason:`readOnly`});continue}let y=i.resolveCellParser(p)(v,h),b=a.decideCellWrite(p,h,y,f);if(b.action===`reject`){u?.({rowIndex:c,sourceRowIndex:d,colIndex:s,row:h,column:p,text:v,reason:`invalid`,value:y,message:b.message});continue}g=e.setCellValue(g,p,y),_=!0}_&&(p[d]=g)}return p},g=(e,t,n,r,o,s,c,l)=>{let u=[],f=d(t,o,n.reduce((e,t)=>Math.max(e,t.length),0));for(let o=0;o<n.length;o+=1){let d=r+o,p=e(d);if(p)for(let e=0;e<n[o].length;e+=1){let r=f[e],m=t[r];if(!m)continue;let h=n[o][e];if(!s(d,r,p,m)){c?.({rowIndex:d,sourceRowIndex:void 0,colIndex:r,row:p,column:m,text:h,reason:`readOnly`});continue}let g=i.resolveCellParser(m)(h,p),_=a.decideCellWrite(m,p,g,l);if(_.action===`reject`){c?.({rowIndex:d,sourceRowIndex:void 0,colIndex:r,row:p,column:m,text:h,reason:`invalid`,value:g,message:_.message});continue}u.push({viewIndex:d,column:m,value:g})}}return u},_=e=>{let{body:t,activeElement:n}=document;if(!t)return!1;let r=document.createElement(`textarea`);r.value=e,r.setAttribute(`readonly`,``),r.style.position=`fixed`,r.style.top=`0`,r.style.left=`-9999px`,r.style.opacity=`0`,t.appendChild(r);let i;try{r.select(),i=document.execCommand(`copy`)}catch{i=!1}finally{t.removeChild(r),n instanceof HTMLElement&&n.focus()}return i},v=async e=>{if(navigator.clipboard?.writeText)try{return await navigator.clipboard.writeText(e),!0}catch{}return _(e)?!0:(console.warn(`[SpreadsheetGrid] クリップボードへのコピーに失敗しました(navigator.clipboard が利用できず、execCommand フォールバックも失敗)。
7
+ [SpreadsheetGrid] Failed to copy to the clipboard (navigator.clipboard is unavailable and the execCommand fallback failed).`),!1)};exports.applyClipboardMatrixToRows=h,exports.buildClipboardCellEdits=g,exports.copyTextViaExecCommand=_,exports.escapeTsvField=s,exports.filterClipboardColumns=p,exports.formatClipboardCell=f,exports.joinTsvLines=l,exports.joinTsvRow=c,exports.parseClipboardText=o,exports.resolvePasteColumnIndexes=d,exports.serializeSelectionToTsv=m,exports.writeTextToClipboard=v;
@@ -1,5 +1,6 @@
1
1
  import type { GridColumn } from '../model/gridTypes.unbound.js';
2
2
  import type { ServerSideCellEditInput } from '../logic/serverSideEdits.js';
3
+ import { type ValidationLocaleText } from '../logic/validation.js';
3
4
  export type ClipboardMatrix = string[][];
4
5
  export declare const parseClipboardText: (text: string) => ClipboardMatrix;
5
6
  export declare const escapeTsvField: (value: string) => string;
@@ -29,7 +30,18 @@ export declare const serializeSelectionToTsv: <T>(getRow: (viewIndex: number) =>
29
30
  startCol: number;
30
31
  endCol: number;
31
32
  } | null, isRowIncluded?: (row: T, viewRowIndex: number) => boolean) => string;
32
- export declare const applyClipboardMatrixToRows: <T extends object>(rows: T[], resolveSourceIndex: (viewIndex: number) => number | undefined, columns: GridColumn<T>[], matrix: ClipboardMatrix, startRowIndex: number, startColIndex: number, canWriteCell: (originalRowIndex: number, colIndex: number, row: T, column: GridColumn<T>, filteredRowIndex: number) => boolean) => T[];
33
- export declare const buildClipboardCellEdits: <T extends object>(getRow: (viewIndex: number) => T | undefined, columns: GridColumn<T>[], matrix: ClipboardMatrix, startRowIndex: number, startColIndex: number, canWriteCell: (viewIndex: number, colIndex: number, row: T, column: GridColumn<T>) => boolean) => ServerSideCellEditInput<T>[];
33
+ export type PasteSkip<T> = {
34
+ rowIndex: number;
35
+ sourceRowIndex: number | undefined;
36
+ colIndex: number;
37
+ row: T;
38
+ column: GridColumn<T>;
39
+ text: string;
40
+ reason: 'readOnly' | 'invalid';
41
+ value?: unknown;
42
+ message?: string | undefined;
43
+ };
44
+ export declare const applyClipboardMatrixToRows: <T extends object>(rows: T[], resolveSourceIndex: (viewIndex: number) => number | undefined, columns: GridColumn<T>[], matrix: ClipboardMatrix, startRowIndex: number, startColIndex: number, canWriteCell: (originalRowIndex: number, colIndex: number, row: T, column: GridColumn<T>, filteredRowIndex: number) => boolean, onSkip?: (skip: PasteSkip<T>) => void, validationTexts?: ValidationLocaleText) => T[];
45
+ export declare const buildClipboardCellEdits: <T extends object>(getRow: (viewIndex: number) => T | undefined, columns: GridColumn<T>[], matrix: ClipboardMatrix, startRowIndex: number, startColIndex: number, canWriteCell: (viewIndex: number, colIndex: number, row: T, column: GridColumn<T>) => boolean, onSkip?: (skip: PasteSkip<T>) => void, validationTexts?: ValidationLocaleText) => ServerSideCellEditInput<T>[];
34
46
  export declare const copyTextViaExecCommand: (text: string) => boolean;
35
47
  export declare const writeTextToClipboard: (text: string) => Promise<boolean>;