@aiquants/spreadsheet 0.16.0 → 0.17.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 +84 -1
- package/README.md +55 -17
- package/dist/index.cjs +8 -8
- package/dist/index.d.cts +69 -0
- package/dist/index.d.ts +69 -0
- package/dist/index.js +4249 -4172
- package/dist/styles/spreadsheet.css +1 -1
- package/dist/styles/spreadsheet.standalone.css +1 -1
- package/dist/tsv.cjs +6 -6
- package/dist/tsv.d.cts +16 -0
- package/dist/tsv.d.ts +16 -0
- package/dist/tsv.js +48 -41
- package/package.json +3 -3
- package/src/Spreadsheet.tsx +280 -92
- package/src/clipboard/tsv.ts +97 -45
- package/src/header/useHeaderResize.ts +137 -68
- package/src/index.ts +2 -2
- package/src/styles/spreadsheet.css +20 -0
- package/src/tsv.ts +5 -3
package/dist/index.d.cts
CHANGED
|
@@ -670,6 +670,22 @@ export declare type HtmlTableResult = {
|
|
|
670
670
|
readonly outcome: "none";
|
|
671
671
|
};
|
|
672
672
|
|
|
673
|
+
/**
|
|
674
|
+
* Yields the rows of a text that may be only the beginning of a TSV (a file read partway, a stream not yet ended), in
|
|
675
|
+
* exactly iterateTsvRows's grammar, but only those the rest of the text cannot change: every row the text ends with a
|
|
676
|
+
* line terminator, up to the first field that opens a quote the text does not close (whether it is one quoted field or a
|
|
677
|
+
* literal one split at its line breaks is the rest's to decide). So the rows of any beginning of a TSV are the first
|
|
678
|
+
* rows of the whole: a reader of a stream can show them as final. Empty text yields no row. Unpadded.
|
|
679
|
+
* TSV の先頭だけかもしれない文字 (途中まで読んだファイル、まだ終わらないストリーム) の行を、iterateTsvRows とちょうど同じ文法で、
|
|
680
|
+
* ただし文字の続きが変えられない行だけ出す処理。文字が改行で終える行すべてを、文字が閉じない引用を開く最初の値まで出す (それが 1 つの
|
|
681
|
+
* 引用の値か、改行で割れる文字どおりの値かは続きが決める)。そのため TSV のどの先頭の行も全体の最初の行で、ストリームの読み手は
|
|
682
|
+
* それを確定したものとして見せられる。空の文字は行を出さない。埋めない。
|
|
683
|
+
*
|
|
684
|
+
* @param text - The beginning of a TSV text, as read. 読んだままの TSV の文字の先頭。
|
|
685
|
+
* @returns The rows the rest of the text cannot change, unpadded. 文字の続きが変えられない行 (埋めない)。
|
|
686
|
+
*/
|
|
687
|
+
export declare function iterateTsvPrefixRows(text: string): Generator<string[]>;
|
|
688
|
+
|
|
673
689
|
/**
|
|
674
690
|
* Yields the rows of a TSV text one at a time, in exactly parseTsv's grammar (the same quoting rule, line terminators
|
|
675
691
|
* and final-terminator handling; empty text is one row with one empty cell), WITHOUT padding them to a common width. A
|
|
@@ -1308,6 +1324,20 @@ export declare const SPREADSHEET_RESERVED_SHORTCUTS: readonly string[];
|
|
|
1308
1324
|
*/
|
|
1309
1325
|
export declare type SpreadsheetCommand = "bold" | "italic" | "underline" | "strikethrough" | "clearFormatting" | "alignLeft" | "alignCenter" | "alignRight" | "formatNumber" | "formatTime" | "formatDate" | "formatCurrency" | "formatPercent" | "formatScientific" | "bordersOuter" | "bordersClear" | "borderTop" | "borderRight" | "borderBottom" | "borderLeft" | "insertLink" | "insertNote" | "insertComment" | "openHyperlink" | "openValidationList" | "pasteSpecial" | "fillDown" | "fillRight" | "fillSelection" | "insertDate" | "insertTime" | "hideRows" | "hideColumns" | "unhideRows" | "unhideColumns" | "increaseColumnWidth" | "decreaseColumnWidth" | "increaseRowHeight" | "decreaseRowHeight" | "autoFitColumnWidth" | "formatGeneral" | "bordersAll" | "pasteFormats" | "pasteFormulas" | "pasteAdd" | "pasteSubtract" | "pasteMultiply" | "pasteDivide" | "multiplyBy100" | "multiplyBy1000" | "divideBy100" | "divideBy1000" | "signReversal" | "fillColorYellow" | "fillColorBlue" | "fillColorGreen" | "fillColorRed" | "fillColorCustom1" | "fillColorCustom2" | "fillColorCustom3" | "fillColorCustom4" | "fillColorCustom5" | "fontColorYellow" | "fontColorBlue" | "fontColorGreen" | "fontColorRed" | "fontColorCustom1" | "fontColorCustom2" | "fontColorCustom3" | "fontColorCustom4" | "fontColorCustom5" | "toggleRowHighlight" | "toggleColumnHighlight" | "toggleBothHighlight" | "toggleIntersectionHighlight";
|
|
1310
1326
|
|
|
1327
|
+
/**
|
|
1328
|
+
* The size of a grid's content in CSS px of the page (v0.17): the column-letter and row-number bands (0 when `headings`
|
|
1329
|
+
* is false), every column and row at its current size, and the two scroll bars the grid always reserves, all scaled by
|
|
1330
|
+
* the zoom — the box a host gives the grid to show every column and row without scrolling.
|
|
1331
|
+
* グリッドの中身の大きさ (ページの CSS px。v0.17)。列の記号と行の番号の帯 (`headings` が false なら 0)、今の大きさの全部の列と行、
|
|
1332
|
+
* グリッドがいつも取る 2 本のスクロールバーを、どれも倍率で伸び縮みさせたもの。ホストがスクロールなしで全部の列と行を見せる箱の大きさ。
|
|
1333
|
+
*/
|
|
1334
|
+
export declare type SpreadsheetContentSize = {
|
|
1335
|
+
/** The width in CSS px. 幅 (CSS px)。 */
|
|
1336
|
+
readonly width: number;
|
|
1337
|
+
/** The height in CSS px. 高さ (CSS px)。 */
|
|
1338
|
+
readonly height: number;
|
|
1339
|
+
};
|
|
1340
|
+
|
|
1311
1341
|
/**
|
|
1312
1342
|
* The single data boundary between the grid and the consumer. Reads via getCellText (renderCell
|
|
1313
1343
|
* — a SpreadsheetProps prop, not an adapter member — customizes only the presentation of that
|
|
@@ -1578,6 +1608,22 @@ export declare type SpreadsheetHandle = {
|
|
|
1578
1608
|
resizeRow: (row: number, heightPx: number) => void;
|
|
1579
1609
|
/** Column-width resize (§6.9-8). / 列幅変更。 */
|
|
1580
1610
|
resizeColumn: (col: number, widthPx: number) => void;
|
|
1611
|
+
/**
|
|
1612
|
+
* Fits each listed column to the widest text of ALL its rows (header rows included; v0.17), as Alt+Shift+= fits the
|
|
1613
|
+
* active column over the rows in view: the same painted fonts, the 9 px padding and the 10,000 px bound, measured with
|
|
1614
|
+
* the cells' base font. A hidden column keeps its width and so does an empty one. Refused through
|
|
1615
|
+
* onOperationRejected("resize", cells, "limit") when the cells to measure exceed `maxOperationCells`. Works whatever
|
|
1616
|
+
* `enableResizeUI` and `headings` say (an imperative path, like resizeColumn).
|
|
1617
|
+
* 名指した列を、その列の**全部の行** (見出しの行も) で最も広い文字に合わせる (v0.17)。Alt+Shift+= が表示中の行で active 列を
|
|
1618
|
+
* 合わせるのと同じ塗りの書体・余白 9 px・上限 10,000 px で、セルの基本の書体で測る。隠した列と空の列は幅を保つ。測るセルが
|
|
1619
|
+
* `maxOperationCells` を超えると onOperationRejected("resize", セル, "limit") で拒む。`enableResizeUI` と `headings` に依らず
|
|
1620
|
+
* 働く (resizeColumn と同じ命令の経路)。
|
|
1621
|
+
*
|
|
1622
|
+
* @param columns - The columns to fit (repeats count once). 合わせる列 (重複は 1 回)。
|
|
1623
|
+
* @returns True when the fit ran (a hidden or empty column changes nothing); false when refused or when the grid cannot measure (`renderCell` is set, or the grid is not mounted). 走ったら true (隠した列・空の列は何も変えない)。拒まれたとき・測れないとき (`renderCell` がある、または未装着) は false。
|
|
1624
|
+
* @throws {RangeError} When a column is not an integer between 0 and the column count − 1. 列が 0〜列数 − 1 の整数でない場合。
|
|
1625
|
+
*/
|
|
1626
|
+
autoFitColumns: (columns: readonly number[]) => boolean;
|
|
1581
1627
|
/**
|
|
1582
1628
|
* Programmatic viewport jump to a cell (delegates to the engine's scrollToCell — the
|
|
1583
1629
|
* floor-and-pin jump API). Selection is unchanged; the deep grid stays reachable at any
|
|
@@ -2026,6 +2072,29 @@ export declare type SpreadsheetProps = {
|
|
|
2026
2072
|
* 復元手段を失う (命令 API のみ)。
|
|
2027
2073
|
*/
|
|
2028
2074
|
enableResizeUI?: boolean;
|
|
2075
|
+
/**
|
|
2076
|
+
* v0.17 — Shows the column letters, the row numbers and the corner (Excel's "headings"; not `headerRows`), true by
|
|
2077
|
+
* default. False draws none of the three and collapses their grid tracks to 0, so the cells start at the grid's
|
|
2078
|
+
* top-left corner; the gestures that live only on them go with them (header presses, the corner's select-all, the
|
|
2079
|
+
* resize strips and unhide markers), and their keyboard twins stay (Ctrl+Space, Shift+Space, Ctrl+A, Alt+Shift+Arrow,
|
|
2080
|
+
* Alt+Shift+=). The bands are `aria-hidden`, so assistive technology meets the same grid. The root carries
|
|
2081
|
+
* `data-aqsp-headings-hidden` while they are hidden. LIVE prop.
|
|
2082
|
+
* v0.17 — 列の記号・行の番号・角 (Excel の「見出し」。`headerRows` とは別) を見せるか (既定 true)。false は 3 つを描かず、
|
|
2083
|
+
* その格子の帯を 0 にしてセルを根の左上から始める。それらの上にだけある操作 (見出しの押下・角の全選択・境の帯と再表示の印) は
|
|
2084
|
+
* 無くなり、キーの双子 (Ctrl+Space・Shift+Space・Ctrl+A・Alt+Shift+矢印・Alt+Shift+=) は残る。帯は `aria-hidden` なので、
|
|
2085
|
+
* 支援技術から見えるグリッドは変わらない。隠している間、根は `data-aqsp-headings-hidden` を持つ。
|
|
2086
|
+
*/
|
|
2087
|
+
headings?: boolean;
|
|
2088
|
+
/**
|
|
2089
|
+
* v0.17 — Receives the size of the grid's content (`SpreadsheetContentSize`) after the first layout and again after
|
|
2090
|
+
* every change of it: a track's size (a resize, an autofit, a hide or unhide, the imperative resizeRow / resizeColumn),
|
|
2091
|
+
* the row or column count, the default sizes, the zoom or `headings`. An unchanged size is not repeated. A host uses it
|
|
2092
|
+
* to size the grid's box to its content.
|
|
2093
|
+
* v0.17 — グリッドの中身の大きさ (`SpreadsheetContentSize`) を、最初の配置の後と、それが変わるたびに受け取る (トラックの
|
|
2094
|
+
* 大きさ — 境の操作・autofit・隠す・再表示・命令の resizeRow / resizeColumn —、行や列の数、既定の大きさ、倍率、`headings`)。
|
|
2095
|
+
* 同じ大きさは繰り返さない。ホストはこれでグリッドの箱を中身に合わせる。
|
|
2096
|
+
*/
|
|
2097
|
+
onContentSizeChange?: (size: SpreadsheetContentSize) => void;
|
|
2029
2098
|
/**
|
|
2030
2099
|
* AT announcement text for the active cell; omit for silence (no built-in strings). `text`
|
|
2031
2100
|
* is the RAW canonical getCellText; `displayText` is the value-format display string (the
|
package/dist/index.d.ts
CHANGED
|
@@ -670,6 +670,22 @@ export declare type HtmlTableResult = {
|
|
|
670
670
|
readonly outcome: "none";
|
|
671
671
|
};
|
|
672
672
|
|
|
673
|
+
/**
|
|
674
|
+
* Yields the rows of a text that may be only the beginning of a TSV (a file read partway, a stream not yet ended), in
|
|
675
|
+
* exactly iterateTsvRows's grammar, but only those the rest of the text cannot change: every row the text ends with a
|
|
676
|
+
* line terminator, up to the first field that opens a quote the text does not close (whether it is one quoted field or a
|
|
677
|
+
* literal one split at its line breaks is the rest's to decide). So the rows of any beginning of a TSV are the first
|
|
678
|
+
* rows of the whole: a reader of a stream can show them as final. Empty text yields no row. Unpadded.
|
|
679
|
+
* TSV の先頭だけかもしれない文字 (途中まで読んだファイル、まだ終わらないストリーム) の行を、iterateTsvRows とちょうど同じ文法で、
|
|
680
|
+
* ただし文字の続きが変えられない行だけ出す処理。文字が改行で終える行すべてを、文字が閉じない引用を開く最初の値まで出す (それが 1 つの
|
|
681
|
+
* 引用の値か、改行で割れる文字どおりの値かは続きが決める)。そのため TSV のどの先頭の行も全体の最初の行で、ストリームの読み手は
|
|
682
|
+
* それを確定したものとして見せられる。空の文字は行を出さない。埋めない。
|
|
683
|
+
*
|
|
684
|
+
* @param text - The beginning of a TSV text, as read. 読んだままの TSV の文字の先頭。
|
|
685
|
+
* @returns The rows the rest of the text cannot change, unpadded. 文字の続きが変えられない行 (埋めない)。
|
|
686
|
+
*/
|
|
687
|
+
export declare function iterateTsvPrefixRows(text: string): Generator<string[]>;
|
|
688
|
+
|
|
673
689
|
/**
|
|
674
690
|
* Yields the rows of a TSV text one at a time, in exactly parseTsv's grammar (the same quoting rule, line terminators
|
|
675
691
|
* and final-terminator handling; empty text is one row with one empty cell), WITHOUT padding them to a common width. A
|
|
@@ -1308,6 +1324,20 @@ export declare const SPREADSHEET_RESERVED_SHORTCUTS: readonly string[];
|
|
|
1308
1324
|
*/
|
|
1309
1325
|
export declare type SpreadsheetCommand = "bold" | "italic" | "underline" | "strikethrough" | "clearFormatting" | "alignLeft" | "alignCenter" | "alignRight" | "formatNumber" | "formatTime" | "formatDate" | "formatCurrency" | "formatPercent" | "formatScientific" | "bordersOuter" | "bordersClear" | "borderTop" | "borderRight" | "borderBottom" | "borderLeft" | "insertLink" | "insertNote" | "insertComment" | "openHyperlink" | "openValidationList" | "pasteSpecial" | "fillDown" | "fillRight" | "fillSelection" | "insertDate" | "insertTime" | "hideRows" | "hideColumns" | "unhideRows" | "unhideColumns" | "increaseColumnWidth" | "decreaseColumnWidth" | "increaseRowHeight" | "decreaseRowHeight" | "autoFitColumnWidth" | "formatGeneral" | "bordersAll" | "pasteFormats" | "pasteFormulas" | "pasteAdd" | "pasteSubtract" | "pasteMultiply" | "pasteDivide" | "multiplyBy100" | "multiplyBy1000" | "divideBy100" | "divideBy1000" | "signReversal" | "fillColorYellow" | "fillColorBlue" | "fillColorGreen" | "fillColorRed" | "fillColorCustom1" | "fillColorCustom2" | "fillColorCustom3" | "fillColorCustom4" | "fillColorCustom5" | "fontColorYellow" | "fontColorBlue" | "fontColorGreen" | "fontColorRed" | "fontColorCustom1" | "fontColorCustom2" | "fontColorCustom3" | "fontColorCustom4" | "fontColorCustom5" | "toggleRowHighlight" | "toggleColumnHighlight" | "toggleBothHighlight" | "toggleIntersectionHighlight";
|
|
1310
1326
|
|
|
1327
|
+
/**
|
|
1328
|
+
* The size of a grid's content in CSS px of the page (v0.17): the column-letter and row-number bands (0 when `headings`
|
|
1329
|
+
* is false), every column and row at its current size, and the two scroll bars the grid always reserves, all scaled by
|
|
1330
|
+
* the zoom — the box a host gives the grid to show every column and row without scrolling.
|
|
1331
|
+
* グリッドの中身の大きさ (ページの CSS px。v0.17)。列の記号と行の番号の帯 (`headings` が false なら 0)、今の大きさの全部の列と行、
|
|
1332
|
+
* グリッドがいつも取る 2 本のスクロールバーを、どれも倍率で伸び縮みさせたもの。ホストがスクロールなしで全部の列と行を見せる箱の大きさ。
|
|
1333
|
+
*/
|
|
1334
|
+
export declare type SpreadsheetContentSize = {
|
|
1335
|
+
/** The width in CSS px. 幅 (CSS px)。 */
|
|
1336
|
+
readonly width: number;
|
|
1337
|
+
/** The height in CSS px. 高さ (CSS px)。 */
|
|
1338
|
+
readonly height: number;
|
|
1339
|
+
};
|
|
1340
|
+
|
|
1311
1341
|
/**
|
|
1312
1342
|
* The single data boundary between the grid and the consumer. Reads via getCellText (renderCell
|
|
1313
1343
|
* — a SpreadsheetProps prop, not an adapter member — customizes only the presentation of that
|
|
@@ -1578,6 +1608,22 @@ export declare type SpreadsheetHandle = {
|
|
|
1578
1608
|
resizeRow: (row: number, heightPx: number) => void;
|
|
1579
1609
|
/** Column-width resize (§6.9-8). / 列幅変更。 */
|
|
1580
1610
|
resizeColumn: (col: number, widthPx: number) => void;
|
|
1611
|
+
/**
|
|
1612
|
+
* Fits each listed column to the widest text of ALL its rows (header rows included; v0.17), as Alt+Shift+= fits the
|
|
1613
|
+
* active column over the rows in view: the same painted fonts, the 9 px padding and the 10,000 px bound, measured with
|
|
1614
|
+
* the cells' base font. A hidden column keeps its width and so does an empty one. Refused through
|
|
1615
|
+
* onOperationRejected("resize", cells, "limit") when the cells to measure exceed `maxOperationCells`. Works whatever
|
|
1616
|
+
* `enableResizeUI` and `headings` say (an imperative path, like resizeColumn).
|
|
1617
|
+
* 名指した列を、その列の**全部の行** (見出しの行も) で最も広い文字に合わせる (v0.17)。Alt+Shift+= が表示中の行で active 列を
|
|
1618
|
+
* 合わせるのと同じ塗りの書体・余白 9 px・上限 10,000 px で、セルの基本の書体で測る。隠した列と空の列は幅を保つ。測るセルが
|
|
1619
|
+
* `maxOperationCells` を超えると onOperationRejected("resize", セル, "limit") で拒む。`enableResizeUI` と `headings` に依らず
|
|
1620
|
+
* 働く (resizeColumn と同じ命令の経路)。
|
|
1621
|
+
*
|
|
1622
|
+
* @param columns - The columns to fit (repeats count once). 合わせる列 (重複は 1 回)。
|
|
1623
|
+
* @returns True when the fit ran (a hidden or empty column changes nothing); false when refused or when the grid cannot measure (`renderCell` is set, or the grid is not mounted). 走ったら true (隠した列・空の列は何も変えない)。拒まれたとき・測れないとき (`renderCell` がある、または未装着) は false。
|
|
1624
|
+
* @throws {RangeError} When a column is not an integer between 0 and the column count − 1. 列が 0〜列数 − 1 の整数でない場合。
|
|
1625
|
+
*/
|
|
1626
|
+
autoFitColumns: (columns: readonly number[]) => boolean;
|
|
1581
1627
|
/**
|
|
1582
1628
|
* Programmatic viewport jump to a cell (delegates to the engine's scrollToCell — the
|
|
1583
1629
|
* floor-and-pin jump API). Selection is unchanged; the deep grid stays reachable at any
|
|
@@ -2026,6 +2072,29 @@ export declare type SpreadsheetProps = {
|
|
|
2026
2072
|
* 復元手段を失う (命令 API のみ)。
|
|
2027
2073
|
*/
|
|
2028
2074
|
enableResizeUI?: boolean;
|
|
2075
|
+
/**
|
|
2076
|
+
* v0.17 — Shows the column letters, the row numbers and the corner (Excel's "headings"; not `headerRows`), true by
|
|
2077
|
+
* default. False draws none of the three and collapses their grid tracks to 0, so the cells start at the grid's
|
|
2078
|
+
* top-left corner; the gestures that live only on them go with them (header presses, the corner's select-all, the
|
|
2079
|
+
* resize strips and unhide markers), and their keyboard twins stay (Ctrl+Space, Shift+Space, Ctrl+A, Alt+Shift+Arrow,
|
|
2080
|
+
* Alt+Shift+=). The bands are `aria-hidden`, so assistive technology meets the same grid. The root carries
|
|
2081
|
+
* `data-aqsp-headings-hidden` while they are hidden. LIVE prop.
|
|
2082
|
+
* v0.17 — 列の記号・行の番号・角 (Excel の「見出し」。`headerRows` とは別) を見せるか (既定 true)。false は 3 つを描かず、
|
|
2083
|
+
* その格子の帯を 0 にしてセルを根の左上から始める。それらの上にだけある操作 (見出しの押下・角の全選択・境の帯と再表示の印) は
|
|
2084
|
+
* 無くなり、キーの双子 (Ctrl+Space・Shift+Space・Ctrl+A・Alt+Shift+矢印・Alt+Shift+=) は残る。帯は `aria-hidden` なので、
|
|
2085
|
+
* 支援技術から見えるグリッドは変わらない。隠している間、根は `data-aqsp-headings-hidden` を持つ。
|
|
2086
|
+
*/
|
|
2087
|
+
headings?: boolean;
|
|
2088
|
+
/**
|
|
2089
|
+
* v0.17 — Receives the size of the grid's content (`SpreadsheetContentSize`) after the first layout and again after
|
|
2090
|
+
* every change of it: a track's size (a resize, an autofit, a hide or unhide, the imperative resizeRow / resizeColumn),
|
|
2091
|
+
* the row or column count, the default sizes, the zoom or `headings`. An unchanged size is not repeated. A host uses it
|
|
2092
|
+
* to size the grid's box to its content.
|
|
2093
|
+
* v0.17 — グリッドの中身の大きさ (`SpreadsheetContentSize`) を、最初の配置の後と、それが変わるたびに受け取る (トラックの
|
|
2094
|
+
* 大きさ — 境の操作・autofit・隠す・再表示・命令の resizeRow / resizeColumn —、行や列の数、既定の大きさ、倍率、`headings`)。
|
|
2095
|
+
* 同じ大きさは繰り返さない。ホストはこれでグリッドの箱を中身に合わせる。
|
|
2096
|
+
*/
|
|
2097
|
+
onContentSizeChange?: (size: SpreadsheetContentSize) => void;
|
|
2029
2098
|
/**
|
|
2030
2099
|
* AT announcement text for the active cell; omit for silence (no built-in strings). `text`
|
|
2031
2100
|
* is the RAW canonical getCellText; `displayText` is the value-format display string (the
|