@aiquants/spreadsheet 0.19.0 → 0.20.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/CHANGELOG.md +94 -1
- package/README.md +27 -19
- package/dist/index.cjs +8 -8
- package/dist/index.d.cts +75 -18
- package/dist/index.d.ts +75 -18
- package/dist/index.js +3592 -3564
- package/dist/styles/spreadsheet.standalone.css +1 -1
- package/package.json +6 -6
- package/src/Spreadsheet.tsx +138 -34
- package/src/clipboard/useClipboard.ts +22 -9
- package/src/commands/useCommands.ts +21 -8
- package/src/grid/GridBody.tsx +32 -3
- package/src/index.ts +1 -1
package/src/grid/GridBody.tsx
CHANGED
|
@@ -36,6 +36,11 @@
|
|
|
36
36
|
* and both scroll bars are declared pointer-only (`enableArrowButtonTabStops: false` — the grid owns keyboard
|
|
37
37
|
* scrolling), so no `scrollbar` / `button` becomes a child of the grid.
|
|
38
38
|
*
|
|
39
|
+
* Scrollbar controls: the host decides through the root's `scrollBarControls` whether both bars draw their arrow buttons
|
|
40
|
+
* and whether their thumb drag and track press scroll (the engine's `showArrowButtons` / `enableThumbDrag` /
|
|
41
|
+
* `enableTrackClick`, received here one by one, so an equal new object at the root pierces neither this memo boundary nor
|
|
42
|
+
* the engine options); the bar width and the pointer-only declaration stay the grid's own.
|
|
43
|
+
*
|
|
39
44
|
* UI chrome locale: the resolved `locale` and the value-stable engine subset `scrollLabels` are
|
|
40
45
|
* forwarded to VirtualGrid, which localizes the embedded vertical bar, the horizontal bar and the
|
|
41
46
|
* degenerate-band "No items" — no lang attribute, no new data-* hook.
|
|
@@ -70,11 +75,15 @@
|
|
|
70
75
|
* (`data-aqsp-header-row`)、両方のスクロールバーはポインタ専用 (`enableArrowButtonTabStops: false` — キーボードのスクロールは
|
|
71
76
|
* グリッドが持つ) と宣言し、`scrollbar` / `button` をグリッドの子にしない。
|
|
72
77
|
*
|
|
78
|
+
* スクロールバーの部品: 両バーが矢印ボタンを描くか、つまみのドラッグとトラックの押下がスクロールするかは、ホストが root の
|
|
79
|
+
* `scrollBarControls` で決める (エンジンの `showArrowButtons` / `enableThumbDrag` / `enableTrackClick`。ここでは 1 つずつ受けるので、
|
|
80
|
+
* root での値の等しい新しい object は、この memo 境界もエンジンの設定も貫通しない)。バーの幅とポインタ専用の宣言はグリッド自身のもの。
|
|
81
|
+
*
|
|
73
82
|
* UI クロームロケール: 解決済み `locale` と値安定なエンジン部分集合 `scrollLabels` を VirtualGrid へ
|
|
74
83
|
* 素通しし、埋込み縦バー・横バー・退化帯の "No items" を現地化する (lang 属性・新規 data-* フックなし)。
|
|
75
84
|
*/
|
|
76
85
|
|
|
77
|
-
import { type ScrollBarTapCircleOptions, VirtualGrid, type VirtualGridHandle, type VirtualGridRange, type VirtualScrollLabels } from "@aiquants/virtualscroll"
|
|
86
|
+
import { type ScrollBarTapCircleOptions, VirtualGrid, type VirtualGridHandle, type VirtualGridRange, type VirtualScrollLabels, type VirtualScrollScrollBarOptions } from "@aiquants/virtualscroll"
|
|
78
87
|
import { type HTMLAttributes, memo, type ProfilerOnRenderCallback, type ReactNode, type RefObject, useCallback, useMemo, useRef, useSyncExternalStore } from "react"
|
|
79
88
|
import { type AxisModel, nextVisibleIndex } from "../model/axisModel.ts"
|
|
80
89
|
import { normalizeAdapterHyperlink } from "../model/cellAnnotations.ts"
|
|
@@ -361,6 +370,18 @@ type GridBodyProps = {
|
|
|
361
370
|
* キー同乗のままエンジン宣言の不在信号 (エンジン既定) — この層での値フォールバックなし。
|
|
362
371
|
*/
|
|
363
372
|
tapScrollCircleOptions?: ScrollBarTapCircleOptions
|
|
373
|
+
/**
|
|
374
|
+
* Whether both bars draw their arrow buttons (`SpreadsheetProps["scrollBarControls"]` member, passed on its own like the
|
|
375
|
+
* two below, so a root render with an equal new object never pierces this memo boundary); undefined is the engine's
|
|
376
|
+
* default.
|
|
377
|
+
* 両バーが矢印ボタンを描くか (`SpreadsheetProps["scrollBarControls"]` の項目。下の 2 つと同じく 1 つずつ渡すので、値の等しい
|
|
378
|
+
* 新しい object での root の描画がこの memo 境界を貫通しない)。undefined はエンジンの既定。
|
|
379
|
+
*/
|
|
380
|
+
showArrowButtons?: boolean
|
|
381
|
+
/** Whether dragging either bar's thumb scrolls (`scrollBarControls` member); undefined is the engine's default. / 両バーのつまみのドラッグでスクロールするか (`scrollBarControls` の項目)。undefined はエンジンの既定。 */
|
|
382
|
+
enableThumbDrag?: boolean
|
|
383
|
+
/** Whether pressing either bar's track scrolls there (`scrollBarControls` member); undefined is the engine's default. / 両バーのトラックの押下でそこへスクロールするか (`scrollBarControls` の項目)。undefined はエンジンの既定。 */
|
|
384
|
+
enableTrackClick?: boolean
|
|
364
385
|
/**
|
|
365
386
|
* Row-axis overscan (the engine `overscanRows` pass-through; the Spreadsheet surface owns
|
|
366
387
|
* the fail-fast validation — the engine clamps silently). Undefined ⇒ engine default (3).
|
|
@@ -431,6 +452,9 @@ const GridBodyInner = ({
|
|
|
431
452
|
cfMemoRef,
|
|
432
453
|
isPointing,
|
|
433
454
|
tapScrollCircleOptions,
|
|
455
|
+
showArrowButtons,
|
|
456
|
+
enableThumbDrag,
|
|
457
|
+
enableTrackClick,
|
|
434
458
|
overscanRows,
|
|
435
459
|
overscanCols,
|
|
436
460
|
background,
|
|
@@ -466,8 +490,13 @@ const GridBodyInner = ({
|
|
|
466
490
|
const behaviorOptions = useMemo(() => ({ enableKeyboardNavigation: false, pointerDragInputs: ["pen", "touch"] as const, resetOnGetItemHeightChange: true, resetOnGetColWidthChange: true, defaultColWidth: defaultColumnWidth }), [defaultColumnWidth])
|
|
467
491
|
// タップサークル素通し (v0.10 §2.1): 未指定は undefined キー同乗 = エンジン宣言の不在信号
|
|
468
492
|
// 矢印の Tab の止まり先は false: キーボードのスクロールはグリッド自身 (シンク) が持つので、バーはネイティブのスクロールバーと同じ
|
|
469
|
-
// ポインタ専用の部品になり (aria-hidden)、role="grid" の中に許されない子 (scrollbar・button)
|
|
470
|
-
|
|
493
|
+
// ポインタ専用の部品になり (aria-hidden)、role="grid" の中に許されない子 (scrollbar・button) を作らない。矢印を外せるのもこのため
|
|
494
|
+
// (エンジンはキーボードのバーの矢印なしを RangeError で拒む)
|
|
495
|
+
// 部品の 3 項目は値で受けて名指しで並べるので、ホストの object に余計なキー (幅・Tab の止まり先) があってもグリッドの値を上書きできない
|
|
496
|
+
const scrollBarOptions = useMemo(
|
|
497
|
+
(): VirtualScrollScrollBarOptions => ({ width: SPREADSHEET_SCROLLBAR_SIZE_PX, tapScrollCircleOptions, enableArrowButtonTabStops: false, showArrowButtons, enableThumbDrag, enableTrackClick }),
|
|
498
|
+
[tapScrollCircleOptions, showArrowButtons, enableThumbDrag, enableTrackClick],
|
|
499
|
+
)
|
|
471
500
|
// 表示値書式の掛け金 (getCellProps が書き、同じセルの children が直後に消費 — 番兵は届かない座標)
|
|
472
501
|
const displayLatchRef = useRef<DisplayLatch>({ row: -1, col: -1, value: undefined })
|
|
473
502
|
/**
|
package/src/index.ts
CHANGED
|
@@ -122,5 +122,5 @@ export { NoteTip, type NoteTipProps } from "./popover/NoteTip.tsx"
|
|
|
122
122
|
// PopoverContext.anchorRect の型 (層座標系の矩形) — 配置エンジン placePopover 本体は非公開のまま
|
|
123
123
|
export type { PopoverRect } from "./popover/placement.ts"
|
|
124
124
|
export type { CommentPopoverContext, LinkPopoverContext, ListPopoverContext, MessagePopoverContext, NotePopoverContext, NoteTipContext, PopoverContext, PopoverKind, PopoverOverrides } from "./popover/usePopovers.ts"
|
|
125
|
-
export { DEFAULT_CUSTOM_COLORS, type ScrollToCellOptions, Spreadsheet, type SpreadsheetContentSize, type SpreadsheetHandle, type SpreadsheetProps } from "./Spreadsheet.tsx"
|
|
125
|
+
export { DEFAULT_CUSTOM_COLORS, type ScrollToCellOptions, Spreadsheet, type SpreadsheetContentSize, type SpreadsheetHandle, type SpreadsheetProps, type SpreadsheetScrollBarControls } from "./Spreadsheet.tsx"
|
|
126
126
|
export type { SelectionState } from "./selection/selectionState.ts"
|