@aiquants/spreadsheet 0.18.0 → 0.19.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/CHANGELOG.md +94 -0
- package/README.md +31 -12
- package/dist/index.cjs +8 -8
- package/dist/index.d.cts +78 -7
- package/dist/index.d.ts +78 -7
- package/dist/index.js +4006 -3985
- package/dist/styles/spreadsheet.css +1 -1
- package/dist/styles/spreadsheet.standalone.css +1 -1
- package/package.json +2 -2
- package/src/Spreadsheet.tsx +20 -0
- package/src/commands/useCommands.ts +33 -16
- package/src/keyboard/shortcuts.ts +74 -11
- package/src/keyboard/useGridKeyboard.ts +36 -11
- package/src/model/cellCoord.ts +31 -0
- package/src/model/dataAdapter.ts +53 -5
- package/src/overlay/SelectionOverlay.tsx +175 -95
- package/src/overlay/useFillHandle.ts +13 -12
- package/src/styles/spreadsheet.css +4 -0
|
@@ -18,8 +18,9 @@
|
|
|
18
18
|
* v0.10 read-only wall (G7 — design ADR-28 rule 5): `confirmFill` walks the ≤2-rect disjoint
|
|
19
19
|
* decomposition of box ∖ source (`fillExtensionRects` — diagonal L legs included) after the limit
|
|
20
20
|
* gate and before `expandFill`; a hit refuses the WHOLE fill through the required
|
|
21
|
-
* `rejectReadOnly` funnel
|
|
22
|
-
*
|
|
21
|
+
* `rejectReadOnly` funnel — `gesture: "fillHandle"`, `sources` = the source block, `targets` = the
|
|
22
|
+
* walked rects and `cellCount` = their area = box area − source area (exact — deliberately not the
|
|
23
|
+
* limit gate's estimate) — with the limit-refusal cleanup (no selection growth, no bumpEdit). Fill
|
|
23
24
|
* FROM a read-only source stays legal; capability undeclared = byte-identical behaviour.
|
|
24
25
|
*
|
|
25
26
|
* v0.9 trailing freeze (plan §2.1 / §4.5 — census #5 / #6): the hover hit test builds BOTH
|
|
@@ -47,8 +48,9 @@
|
|
|
47
48
|
*
|
|
48
49
|
* v0.10 読み取り専用壁 (G7 — 設計 ADR-28 rule 5): `confirmFill` は限度ゲート後・`expandFill` 前に
|
|
49
50
|
* box ∖ source の ≤2 非交矩形分解 (`fillExtensionRects` — 斜めの L 字 2 レッグ込み) を walk し、
|
|
50
|
-
* hit は必須 `rejectReadOnly` 漏斗経由で fill 全体を拒否する (
|
|
51
|
-
*
|
|
51
|
+
* hit は必須 `rejectReadOnly` 漏斗経由で fill 全体を拒否する (`gesture: "fillHandle"`、`sources` = 複製元の
|
|
52
|
+
* 塊、`targets` = walk した矩形、cellCount = その面積 = box 面積 − source 面積 — 限度ゲートの見積りとは
|
|
53
|
+
* 意図的に別の数)。後始末は限度拒否と同一 (選択不伸長・bumpEdit なし)。
|
|
52
54
|
* 読み取り専用ソースからの fill は合法のまま。能力未宣言は挙動バイト恒等。
|
|
53
55
|
*
|
|
54
56
|
* v0.9 末尾凍結 (計画 §2.1 / §4.5 — census #5 / #6): hover ヒットテストは 1 ハンドル快照から
|
|
@@ -63,7 +65,7 @@ import type { VirtualGridHandle } from "@aiquants/virtualscroll"
|
|
|
63
65
|
import { type RefObject, useCallback, useEffect, useMemo, useRef } from "react"
|
|
64
66
|
import { estimateFillCellCount, expandFill, fillExtensionRects, fillSourceEdit, readFillSource } from "../clipboard/tiling.ts"
|
|
65
67
|
import type { AxisModel } from "../model/axisModel.ts"
|
|
66
|
-
import { type CellCoord, type CellRange, clampCoord, makeRange, type SpreadsheetOperation } from "../model/cellCoord.ts"
|
|
68
|
+
import { type CellCoord, type CellRange, clampCoord, countRangeCells, makeRange, type SpreadsheetOperation } from "../model/cellCoord.ts"
|
|
67
69
|
import { type CellEdit, type EditRejection, type ReadOnlyRejection, rangesContainReadOnly, type SpreadsheetDataAdapter } from "../model/dataAdapter.ts"
|
|
68
70
|
import { type AxisForwardCtx, colToViewportX, rowToViewportY, viewportXToCol, viewportYToRow } from "../model/frozenPartition.ts"
|
|
69
71
|
import type { SelectionState } from "../selection/selectionState.ts"
|
|
@@ -289,13 +291,12 @@ export const useFillHandle = (params: UseFillHandleParams): SelectionEngine => {
|
|
|
289
291
|
// G7 (v0.10 §6.8 / 設計 ADR-28 rule 5): 読み取り専用壁 — walk は拡張域 (box ∖ source) の
|
|
290
292
|
// ≤2 非交矩形分解 fillExtensionRects (斜めドラッグの L 字 2 レッグ対応)。ソース行 / 列は
|
|
291
293
|
// 書込対象ではないため walk 外 = 読み取り専用ソースからの fill は合法 (Excel 同等)。座席は
|
|
292
|
-
// 限度ゲート後・expandFill (実体化)
|
|
293
|
-
//
|
|
294
|
-
//
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
p.rejectReadOnly({ kind: "operation", op: "fill", cellCount: boxArea - sourceArea })
|
|
294
|
+
// 限度ゲート後・expandFill (実体化) 前。拒否は walk した矩形をそのまま写し先として運び、cellCount =
|
|
295
|
+
// その面積の和 = box 面積 − source 面積 (正確 — 限度チャネルの見積り estimateFillCellCount とは別の数、
|
|
296
|
+
// 登記済み非対称)。後始末は限度拒否と同一 (cleanupDrag 済み — 選択不伸長・bumpEdit なし)
|
|
297
|
+
const extension = fillExtensionRects(source, box)
|
|
298
|
+
if (rangesContainReadOnly(p.adapter, extension)) {
|
|
299
|
+
p.rejectReadOnly({ kind: "operation", op: "fill", cellCount: countRangeCells(extension), gesture: "fillHandle", sources: [source], targets: extension })
|
|
299
300
|
return
|
|
300
301
|
}
|
|
301
302
|
// 展開は fillDown / fillRight と同じソース毎規則 (分冊 08 §4 の fill 行): 種 (数式ソースか正準
|
|
@@ -370,6 +370,10 @@
|
|
|
370
370
|
position: absolute;
|
|
371
371
|
overflow: hidden;
|
|
372
372
|
pointer-events: none;
|
|
373
|
+
/* 中の印はどれも左上を原点とする物理の px で置く。右から左のページでも、左右が過剰制約になった印 (象限の遠い端より先で始まり
|
|
374
|
+
遠い端に付く外枠など) が left でなく right を捨てて象限の外に留まるよう、象限の向きを左から右に固める。象限は線と塗りだけを
|
|
375
|
+
持ち、文字のシンクは象限の外にあるので、入力の向きは変わらない */
|
|
376
|
+
direction: ltr;
|
|
373
377
|
}
|
|
374
378
|
|
|
375
379
|
/*
|