@aiquants/spreadsheet 0.20.3 → 0.21.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 +67 -0
- package/README.md +56 -15
- package/dist/index.cjs +8 -8
- package/dist/index.d.cts +60 -20
- package/dist/index.d.ts +60 -20
- package/dist/index.js +4764 -4682
- package/dist/styles/spreadsheet.css +1 -1
- package/dist/styles/spreadsheet.standalone.css +1 -1
- package/package.json +6 -3
- package/src/Spreadsheet.tsx +117 -10
- package/src/index.ts +1 -1
- package/src/keyboard/compositionGuard.ts +15 -9
- package/src/model/dataAdapter.ts +48 -0
- package/src/overlay/SelectionOverlay.tsx +9 -8
- package/src/selection/useSelectionEngine.ts +192 -21
- package/src/styles/spreadsheet.css +8 -0
package/dist/index.d.cts
CHANGED
|
@@ -212,6 +212,34 @@ export declare type CellFormatPatch = {
|
|
|
212
212
|
readonly [K in keyof CellFormat]?: CellFormat[K] | null;
|
|
213
213
|
};
|
|
214
214
|
|
|
215
|
+
/**
|
|
216
|
+
* The single data boundary between the grid and the consumer. Reads via getCellText (renderCell
|
|
217
|
+
* — a SpreadsheetProps prop, not an adapter member — customizes only the presentation of that
|
|
218
|
+
* text) plus the optional capability reads, writes via applyEdits as ONE transaction per
|
|
219
|
+
* gesture (editor commit / Delete / paste / cut-clear / fill / format / calc / annotate). This
|
|
220
|
+
* seam is where the consumer implements undo (inverse patches grouped by `transaction`). Every
|
|
221
|
+
* optional member is a CAPABILITY DECLARATION ("what cannot be read cannot be written"): the
|
|
222
|
+
* grid enables a feature only when the read it depends on is declared, and an undeclared
|
|
223
|
+
* capability reproduces the v0.7 behaviour exactly (never a value fallback). Declaring
|
|
224
|
+
* getConditionalFormats without getCellFormat is a RangeError at mount (a painted format is
|
|
225
|
+
* base ⊕ CF and there is no base without getCellFormat).
|
|
226
|
+
* グリッドと consumer の唯一のデータ境界。読みは getCellText (renderCell は SpreadsheetProps の
|
|
227
|
+
* prop であってアダプタメンバーではない — その文字列の表現のみを差し替える) と任意の能力読み、
|
|
228
|
+
* 書きは applyEdits のジェスチャ毎 1 トランザクション (編集確定 / Delete / 貼り付け / 切り取り
|
|
229
|
+
* 清算 / フィル / 書式 / 自己計算 / 注釈)。consumer の Undo 実装点 (`transaction` で束ねる逆
|
|
230
|
+
* パッチ)。任意メンバーは全て**能力宣言** (「読めないものは書けない」): グリッドは依存する読みが
|
|
231
|
+
* 宣言されたときだけ機能を有効化し、未宣言能力は v0.7 の振る舞いを厳密に再現する (値フォール
|
|
232
|
+
* バックではない)。getCellFormat なしの getConditionalFormats 宣言はマウント時 RangeError
|
|
233
|
+
* (塗り書式は base ⊕ CF で、getCellFormat なしに base は無い)。
|
|
234
|
+
*/
|
|
235
|
+
/**
|
|
236
|
+
* The on-screen keyboard a cell asks for while the grid invites one: HTML's `inputmode` values except `"none"` (the grid
|
|
237
|
+
* renders `"none"` itself while it does not invite a keyboard).
|
|
238
|
+
* グリッドが画面のキーボードを招いている間に、セルが求めるキーボード。`"none"` を除く HTML の `inputmode` の値 (招かない間の `"none"` は
|
|
239
|
+
* グリッド自身が描く)。
|
|
240
|
+
*/
|
|
241
|
+
export declare type CellInputMode = "text" | "decimal" | "numeric" | "tel" | "search" | "email" | "url";
|
|
242
|
+
|
|
215
243
|
/**
|
|
216
244
|
* One per-cell PATCH (ADR-16): an ABSENT key leaves that aspect untouched, `null` CLEARS it, a
|
|
217
245
|
* value replaces it whole. `text` is the canonical string (a cleared cell is `text: ""` — text
|
|
@@ -1462,26 +1490,6 @@ export declare type SpreadsheetContentSize = {
|
|
|
1462
1490
|
readonly height: number;
|
|
1463
1491
|
};
|
|
1464
1492
|
|
|
1465
|
-
/**
|
|
1466
|
-
* The single data boundary between the grid and the consumer. Reads via getCellText (renderCell
|
|
1467
|
-
* — a SpreadsheetProps prop, not an adapter member — customizes only the presentation of that
|
|
1468
|
-
* text) plus the optional capability reads, writes via applyEdits as ONE transaction per
|
|
1469
|
-
* gesture (editor commit / Delete / paste / cut-clear / fill / format / calc / annotate). This
|
|
1470
|
-
* seam is where the consumer implements undo (inverse patches grouped by `transaction`). Every
|
|
1471
|
-
* optional member is a CAPABILITY DECLARATION ("what cannot be read cannot be written"): the
|
|
1472
|
-
* grid enables a feature only when the read it depends on is declared, and an undeclared
|
|
1473
|
-
* capability reproduces the v0.7 behaviour exactly (never a value fallback). Declaring
|
|
1474
|
-
* getConditionalFormats without getCellFormat is a RangeError at mount (a painted format is
|
|
1475
|
-
* base ⊕ CF and there is no base without getCellFormat).
|
|
1476
|
-
* グリッドと consumer の唯一のデータ境界。読みは getCellText (renderCell は SpreadsheetProps の
|
|
1477
|
-
* prop であってアダプタメンバーではない — その文字列の表現のみを差し替える) と任意の能力読み、
|
|
1478
|
-
* 書きは applyEdits のジェスチャ毎 1 トランザクション (編集確定 / Delete / 貼り付け / 切り取り
|
|
1479
|
-
* 清算 / フィル / 書式 / 自己計算 / 注釈)。consumer の Undo 実装点 (`transaction` で束ねる逆
|
|
1480
|
-
* パッチ)。任意メンバーは全て**能力宣言** (「読めないものは書けない」): グリッドは依存する読みが
|
|
1481
|
-
* 宣言されたときだけ機能を有効化し、未宣言能力は v0.7 の振る舞いを厳密に再現する (値フォール
|
|
1482
|
-
* バックではない)。getCellFormat なしの getConditionalFormats 宣言はマウント時 RangeError
|
|
1483
|
-
* (塗り書式は base ⊕ CF で、getCellFormat なしに base は無い)。
|
|
1484
|
-
*/
|
|
1485
1493
|
export declare type SpreadsheetDataAdapter = {
|
|
1486
1494
|
rowCount: number;
|
|
1487
1495
|
colCount: number;
|
|
@@ -1666,6 +1674,19 @@ export declare type SpreadsheetDataAdapter = {
|
|
|
1666
1674
|
* (getCellText と同格、描画パスでも呼ばれるため)。未宣言 = 全セル編集可 = 従来挙動とバイト同一。
|
|
1667
1675
|
*/
|
|
1668
1676
|
isCellReadOnly?: (row: number, col: number) => boolean;
|
|
1677
|
+
/**
|
|
1678
|
+
* OPTIONAL capability (v0.21): the on-screen keyboard one cell asks for. While the grid invites a keyboard (an editor
|
|
1679
|
+
* opened by a pointer — the mouse double-click, or a finger or pen tap of `touchEditing`) the hidden input's `inputmode`
|
|
1680
|
+
* is the active cell's answer, so a numeric column can bring up the number pad. Absent = `"text"` for every cell. Any
|
|
1681
|
+
* value outside `CellInputMode` is a `RangeError` at render naming the cell and the value (never a silent `"text"`).
|
|
1682
|
+
* Read at every render of the grid (never memoised); publish changes via `dataVersion`. The grid only ever calls this
|
|
1683
|
+
* with in-grid coordinates. Host cost budget: O(1) and allocation-free.
|
|
1684
|
+
* 任意の能力 (v0.21): 1 つのセルが求める画面のキーボード。グリッドがキーボードを招いている間 (ポインタで開いたエディタ — マウスの二度押し、
|
|
1685
|
+
* または `touchEditing` の指とペンの叩き) の受け口の `inputmode` は、選んでいるセルのこの答えになるので、数の列は数の鍵盤を出せる。未宣言 =
|
|
1686
|
+
* どのセルも `"text"`。`CellInputMode` の外の値は描画の時に `RangeError` (セルと値を名指す。黙って `"text"` にしない)。グリッドの描画の
|
|
1687
|
+
* たびに読む (覚えない)。変更は `dataVersion` で公開。座標は常にグリッドの中。ホストのコストは O(1)・割当なし。
|
|
1688
|
+
*/
|
|
1689
|
+
getCellInputMode?: (row: number, col: number) => CellInputMode;
|
|
1669
1690
|
/**
|
|
1670
1691
|
* OPTIONAL capability (v0.12): host-owned `data-*` attributes for one cell, merged verbatim
|
|
1671
1692
|
* onto the PACKAGE-OWNED cell element (`[data-aqsp-cell]`) so host CSS can target cell
|
|
@@ -2392,6 +2413,25 @@ export declare type SpreadsheetProps = {
|
|
|
2392
2413
|
* 復元もこの API だけ。
|
|
2393
2414
|
*/
|
|
2394
2415
|
enableResizeUI?: boolean;
|
|
2416
|
+
/**
|
|
2417
|
+
* v0.21 — Lets a finger or a pen (`pointerType` `"touch"` / `"pen"`) select, write and open the row menu, false by
|
|
2418
|
+
* default. When true: a tap on a body cell selects it (through the gates of a mouse click — an open editor commits
|
|
2419
|
+
* first); a tap on the active cell (a double tap's second tap included) opens its editor and, inside the same tap, the
|
|
2420
|
+
* on-screen keyboard (the hidden input's `inputmode` is the adapter's `getCellInputMode` for the cell, `"text"` when
|
|
2421
|
+
* undeclared); a long-press (500 ms, held within the tap slop) calls `onCellContextMenu` with `{ kind: "pointer" }` (the native
|
|
2422
|
+
* long-press menu and callout are suppressed on the cells, and the release after it moves nothing). A press that only
|
|
2423
|
+
* stopped the moving list (virtualscroll's `didPressStopScrollMotion`), a press that pans past the tap slop and a press
|
|
2424
|
+
* the browser cancels are no tap. Range selection, the fill handle, the resize grips and formula pointing stay
|
|
2425
|
+
* mouse-only. False (or absent) keeps the 0.20 behaviour byte-for-byte: touch / pen only scrolls.
|
|
2426
|
+
* v0.21 — 指とペン (`pointerType` が `"touch"` / `"pen"`) で選び、書き、行の品書きを開けるようにする。既定は false。true のとき: 体のマスの叩きが
|
|
2427
|
+
* そのマスを選ぶ (マウスのクリックの関門を通る — 開いているエディタは先に確定)。選んでいるマスの叩き (二度叩きの 2 つ目も) はそのエディタを開き、同じ
|
|
2428
|
+
* 叩きの中で画面のキーボードも開く (受け口の `inputmode` はそのマスのアダプタの `getCellInputMode`。宣言しなければ `"text"`)。長押し (叩きの許しの内で
|
|
2429
|
+
* 500 ms) は `onCellContextMenu` を `{ kind: "pointer" }` で呼ぶ (マスの上の素の長押しの品書きと吹き出しは止め、その後の解放は何も動かさない)。
|
|
2430
|
+
* 流れている一覧を止めただけの押下 (virtualscroll の `didPressStopScrollMotion`)・叩きの許しを超えてなぞった押下・ブラウザーが取り消した押下は
|
|
2431
|
+
* 叩きにならない。範囲の選択・fill handle・寸法のつまみ・数式の参照の指し示しはマウスだけのまま。false (か未指定) は 0.20 の動きを byte 同一に
|
|
2432
|
+
* 保つ (指とペンは送るだけ)。
|
|
2433
|
+
*/
|
|
2434
|
+
touchEditing?: boolean;
|
|
2395
2435
|
/**
|
|
2396
2436
|
* v0.17 — Shows the column letters, the row numbers and the corner (Excel's "headings"; not `headerRows`), true by
|
|
2397
2437
|
* default. False draws none of the three and collapses their grid tracks to 0, so the cells start at the grid's
|
package/dist/index.d.ts
CHANGED
|
@@ -212,6 +212,34 @@ export declare type CellFormatPatch = {
|
|
|
212
212
|
readonly [K in keyof CellFormat]?: CellFormat[K] | null;
|
|
213
213
|
};
|
|
214
214
|
|
|
215
|
+
/**
|
|
216
|
+
* The single data boundary between the grid and the consumer. Reads via getCellText (renderCell
|
|
217
|
+
* — a SpreadsheetProps prop, not an adapter member — customizes only the presentation of that
|
|
218
|
+
* text) plus the optional capability reads, writes via applyEdits as ONE transaction per
|
|
219
|
+
* gesture (editor commit / Delete / paste / cut-clear / fill / format / calc / annotate). This
|
|
220
|
+
* seam is where the consumer implements undo (inverse patches grouped by `transaction`). Every
|
|
221
|
+
* optional member is a CAPABILITY DECLARATION ("what cannot be read cannot be written"): the
|
|
222
|
+
* grid enables a feature only when the read it depends on is declared, and an undeclared
|
|
223
|
+
* capability reproduces the v0.7 behaviour exactly (never a value fallback). Declaring
|
|
224
|
+
* getConditionalFormats without getCellFormat is a RangeError at mount (a painted format is
|
|
225
|
+
* base ⊕ CF and there is no base without getCellFormat).
|
|
226
|
+
* グリッドと consumer の唯一のデータ境界。読みは getCellText (renderCell は SpreadsheetProps の
|
|
227
|
+
* prop であってアダプタメンバーではない — その文字列の表現のみを差し替える) と任意の能力読み、
|
|
228
|
+
* 書きは applyEdits のジェスチャ毎 1 トランザクション (編集確定 / Delete / 貼り付け / 切り取り
|
|
229
|
+
* 清算 / フィル / 書式 / 自己計算 / 注釈)。consumer の Undo 実装点 (`transaction` で束ねる逆
|
|
230
|
+
* パッチ)。任意メンバーは全て**能力宣言** (「読めないものは書けない」): グリッドは依存する読みが
|
|
231
|
+
* 宣言されたときだけ機能を有効化し、未宣言能力は v0.7 の振る舞いを厳密に再現する (値フォール
|
|
232
|
+
* バックではない)。getCellFormat なしの getConditionalFormats 宣言はマウント時 RangeError
|
|
233
|
+
* (塗り書式は base ⊕ CF で、getCellFormat なしに base は無い)。
|
|
234
|
+
*/
|
|
235
|
+
/**
|
|
236
|
+
* The on-screen keyboard a cell asks for while the grid invites one: HTML's `inputmode` values except `"none"` (the grid
|
|
237
|
+
* renders `"none"` itself while it does not invite a keyboard).
|
|
238
|
+
* グリッドが画面のキーボードを招いている間に、セルが求めるキーボード。`"none"` を除く HTML の `inputmode` の値 (招かない間の `"none"` は
|
|
239
|
+
* グリッド自身が描く)。
|
|
240
|
+
*/
|
|
241
|
+
export declare type CellInputMode = "text" | "decimal" | "numeric" | "tel" | "search" | "email" | "url";
|
|
242
|
+
|
|
215
243
|
/**
|
|
216
244
|
* One per-cell PATCH (ADR-16): an ABSENT key leaves that aspect untouched, `null` CLEARS it, a
|
|
217
245
|
* value replaces it whole. `text` is the canonical string (a cleared cell is `text: ""` — text
|
|
@@ -1462,26 +1490,6 @@ export declare type SpreadsheetContentSize = {
|
|
|
1462
1490
|
readonly height: number;
|
|
1463
1491
|
};
|
|
1464
1492
|
|
|
1465
|
-
/**
|
|
1466
|
-
* The single data boundary between the grid and the consumer. Reads via getCellText (renderCell
|
|
1467
|
-
* — a SpreadsheetProps prop, not an adapter member — customizes only the presentation of that
|
|
1468
|
-
* text) plus the optional capability reads, writes via applyEdits as ONE transaction per
|
|
1469
|
-
* gesture (editor commit / Delete / paste / cut-clear / fill / format / calc / annotate). This
|
|
1470
|
-
* seam is where the consumer implements undo (inverse patches grouped by `transaction`). Every
|
|
1471
|
-
* optional member is a CAPABILITY DECLARATION ("what cannot be read cannot be written"): the
|
|
1472
|
-
* grid enables a feature only when the read it depends on is declared, and an undeclared
|
|
1473
|
-
* capability reproduces the v0.7 behaviour exactly (never a value fallback). Declaring
|
|
1474
|
-
* getConditionalFormats without getCellFormat is a RangeError at mount (a painted format is
|
|
1475
|
-
* base ⊕ CF and there is no base without getCellFormat).
|
|
1476
|
-
* グリッドと consumer の唯一のデータ境界。読みは getCellText (renderCell は SpreadsheetProps の
|
|
1477
|
-
* prop であってアダプタメンバーではない — その文字列の表現のみを差し替える) と任意の能力読み、
|
|
1478
|
-
* 書きは applyEdits のジェスチャ毎 1 トランザクション (編集確定 / Delete / 貼り付け / 切り取り
|
|
1479
|
-
* 清算 / フィル / 書式 / 自己計算 / 注釈)。consumer の Undo 実装点 (`transaction` で束ねる逆
|
|
1480
|
-
* パッチ)。任意メンバーは全て**能力宣言** (「読めないものは書けない」): グリッドは依存する読みが
|
|
1481
|
-
* 宣言されたときだけ機能を有効化し、未宣言能力は v0.7 の振る舞いを厳密に再現する (値フォール
|
|
1482
|
-
* バックではない)。getCellFormat なしの getConditionalFormats 宣言はマウント時 RangeError
|
|
1483
|
-
* (塗り書式は base ⊕ CF で、getCellFormat なしに base は無い)。
|
|
1484
|
-
*/
|
|
1485
1493
|
export declare type SpreadsheetDataAdapter = {
|
|
1486
1494
|
rowCount: number;
|
|
1487
1495
|
colCount: number;
|
|
@@ -1666,6 +1674,19 @@ export declare type SpreadsheetDataAdapter = {
|
|
|
1666
1674
|
* (getCellText と同格、描画パスでも呼ばれるため)。未宣言 = 全セル編集可 = 従来挙動とバイト同一。
|
|
1667
1675
|
*/
|
|
1668
1676
|
isCellReadOnly?: (row: number, col: number) => boolean;
|
|
1677
|
+
/**
|
|
1678
|
+
* OPTIONAL capability (v0.21): the on-screen keyboard one cell asks for. While the grid invites a keyboard (an editor
|
|
1679
|
+
* opened by a pointer — the mouse double-click, or a finger or pen tap of `touchEditing`) the hidden input's `inputmode`
|
|
1680
|
+
* is the active cell's answer, so a numeric column can bring up the number pad. Absent = `"text"` for every cell. Any
|
|
1681
|
+
* value outside `CellInputMode` is a `RangeError` at render naming the cell and the value (never a silent `"text"`).
|
|
1682
|
+
* Read at every render of the grid (never memoised); publish changes via `dataVersion`. The grid only ever calls this
|
|
1683
|
+
* with in-grid coordinates. Host cost budget: O(1) and allocation-free.
|
|
1684
|
+
* 任意の能力 (v0.21): 1 つのセルが求める画面のキーボード。グリッドがキーボードを招いている間 (ポインタで開いたエディタ — マウスの二度押し、
|
|
1685
|
+
* または `touchEditing` の指とペンの叩き) の受け口の `inputmode` は、選んでいるセルのこの答えになるので、数の列は数の鍵盤を出せる。未宣言 =
|
|
1686
|
+
* どのセルも `"text"`。`CellInputMode` の外の値は描画の時に `RangeError` (セルと値を名指す。黙って `"text"` にしない)。グリッドの描画の
|
|
1687
|
+
* たびに読む (覚えない)。変更は `dataVersion` で公開。座標は常にグリッドの中。ホストのコストは O(1)・割当なし。
|
|
1688
|
+
*/
|
|
1689
|
+
getCellInputMode?: (row: number, col: number) => CellInputMode;
|
|
1669
1690
|
/**
|
|
1670
1691
|
* OPTIONAL capability (v0.12): host-owned `data-*` attributes for one cell, merged verbatim
|
|
1671
1692
|
* onto the PACKAGE-OWNED cell element (`[data-aqsp-cell]`) so host CSS can target cell
|
|
@@ -2392,6 +2413,25 @@ export declare type SpreadsheetProps = {
|
|
|
2392
2413
|
* 復元もこの API だけ。
|
|
2393
2414
|
*/
|
|
2394
2415
|
enableResizeUI?: boolean;
|
|
2416
|
+
/**
|
|
2417
|
+
* v0.21 — Lets a finger or a pen (`pointerType` `"touch"` / `"pen"`) select, write and open the row menu, false by
|
|
2418
|
+
* default. When true: a tap on a body cell selects it (through the gates of a mouse click — an open editor commits
|
|
2419
|
+
* first); a tap on the active cell (a double tap's second tap included) opens its editor and, inside the same tap, the
|
|
2420
|
+
* on-screen keyboard (the hidden input's `inputmode` is the adapter's `getCellInputMode` for the cell, `"text"` when
|
|
2421
|
+
* undeclared); a long-press (500 ms, held within the tap slop) calls `onCellContextMenu` with `{ kind: "pointer" }` (the native
|
|
2422
|
+
* long-press menu and callout are suppressed on the cells, and the release after it moves nothing). A press that only
|
|
2423
|
+
* stopped the moving list (virtualscroll's `didPressStopScrollMotion`), a press that pans past the tap slop and a press
|
|
2424
|
+
* the browser cancels are no tap. Range selection, the fill handle, the resize grips and formula pointing stay
|
|
2425
|
+
* mouse-only. False (or absent) keeps the 0.20 behaviour byte-for-byte: touch / pen only scrolls.
|
|
2426
|
+
* v0.21 — 指とペン (`pointerType` が `"touch"` / `"pen"`) で選び、書き、行の品書きを開けるようにする。既定は false。true のとき: 体のマスの叩きが
|
|
2427
|
+
* そのマスを選ぶ (マウスのクリックの関門を通る — 開いているエディタは先に確定)。選んでいるマスの叩き (二度叩きの 2 つ目も) はそのエディタを開き、同じ
|
|
2428
|
+
* 叩きの中で画面のキーボードも開く (受け口の `inputmode` はそのマスのアダプタの `getCellInputMode`。宣言しなければ `"text"`)。長押し (叩きの許しの内で
|
|
2429
|
+
* 500 ms) は `onCellContextMenu` を `{ kind: "pointer" }` で呼ぶ (マスの上の素の長押しの品書きと吹き出しは止め、その後の解放は何も動かさない)。
|
|
2430
|
+
* 流れている一覧を止めただけの押下 (virtualscroll の `didPressStopScrollMotion`)・叩きの許しを超えてなぞった押下・ブラウザーが取り消した押下は
|
|
2431
|
+
* 叩きにならない。範囲の選択・fill handle・寸法のつまみ・数式の参照の指し示しはマウスだけのまま。false (か未指定) は 0.20 の動きを byte 同一に
|
|
2432
|
+
* 保つ (指とペンは送るだけ)。
|
|
2433
|
+
*/
|
|
2434
|
+
touchEditing?: boolean;
|
|
2395
2435
|
/**
|
|
2396
2436
|
* v0.17 — Shows the column letters, the row numbers and the corner (Excel's "headings"; not `headerRows`), true by
|
|
2397
2437
|
* default. False draws none of the three and collapses their grid tracks to 0, so the cells start at the grid's
|