@aiquants/spreadsheet 0.12.0 → 0.13.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 +54 -0
- package/README.md +60 -19
- package/dist/index.cjs +13 -13
- package/dist/index.d.cts +113 -119
- package/dist/index.d.ts +113 -119
- package/dist/index.js +3457 -3328
- package/package.json +3 -3
- package/src/Spreadsheet.tsx +68 -13
- package/src/grid/GridBody.tsx +30 -1
- package/src/index.ts +1 -1
- package/src/model/dataValidation.ts +84 -67
- package/src/model/labels.ts +313 -101
- package/src/model/validationMessages.ts +203 -0
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,8 @@ import { ReactNode } from 'react';
|
|
|
4
4
|
import { RefAttributes } from 'react';
|
|
5
5
|
import { ScrollBarTapCircleOptions } from '@aiquants/virtualscroll';
|
|
6
6
|
import { TapScrollCircleRenderProps } from '@aiquants/virtualscroll';
|
|
7
|
+
import { VirtualScrollLabels } from '@aiquants/virtualscroll';
|
|
8
|
+
import { VirtualScrollLocale } from '@aiquants/virtualscroll';
|
|
7
9
|
|
|
8
10
|
/** Border colour when `CellBorder.color` is absent (a stated default, not a fallback). / 罫線色の宣言済み既定 (fallback ではなく仕様上の既定)。 */
|
|
9
11
|
export declare const BORDER_DEFAULT_COLOR = "#000000";
|
|
@@ -481,17 +483,6 @@ export declare const DEFAULT_CUSTOM_COLORS: readonly string[];
|
|
|
481
483
|
/** Default band palette (plan §1.9) — the same values the `.aqsp-root` CSS variables fall back to. / 既定の帯パレット (計画 §1.9) — `.aqsp-root` の CSS 変数既定と同値。 */
|
|
482
484
|
export declare const DEFAULT_HIGHLIGHT_COLORS: HighlightColors;
|
|
483
485
|
|
|
484
|
-
/**
|
|
485
|
-
* English defaults for every key. `sinkAriaLabel` / `rootAriaLabel` are byte-identical to the
|
|
486
|
-
* v0.7 prop defaults (the fold is DOM-identical); `noteEscapeHint` = "Escape saves and closes"
|
|
487
|
-
* and its v0.10 viewer counterpart `noteViewerHint` = "Escape closes without saving";
|
|
488
|
-
* `commentCount` and `listMore` pluralise ("1 comment" / "n comments", "1 more value" / "n more values"). Frozen.
|
|
489
|
-
* 全キーの英語既定。`sinkAriaLabel` / `rootAriaLabel` は v0.7 の prop 既定と byte 同一 (畳込みは
|
|
490
|
-
* DOM 恒等)、`noteEscapeHint` = "Escape saves and closes" とその v0.10 ビューア対応
|
|
491
|
-
* `noteViewerHint` = "Escape closes without saving"、`commentCount` / `listMore` は単複を区別。凍結済み。
|
|
492
|
-
*/
|
|
493
|
-
export declare const DEFAULT_LABELS: SpreadsheetLabels;
|
|
494
|
-
|
|
495
486
|
/**
|
|
496
487
|
* Default chords per command, derived from the `command === K` rows of BUILTIN_ROWS in table
|
|
497
488
|
* order (`[]` = unbound by default: hideColumns and every extension command). Validates under
|
|
@@ -1067,9 +1058,44 @@ export declare type RenderCellContext = {
|
|
|
1067
1058
|
* returned as-is and ignores `n`.
|
|
1068
1059
|
* 唯一の読み出し点: ラベル 1 件を表示文字列へ解決。関数値は n で呼ぶ (n 省略は呼び手バグとして
|
|
1069
1060
|
* RangeError — 黙って 0 にしない)、文字列値はそのまま (n は無視)。
|
|
1061
|
+
*
|
|
1062
|
+
* @param labels - The resolved label bag / 解決済みラベル集合
|
|
1063
|
+
* @param key - The label key to read / 読み出すラベルキー
|
|
1064
|
+
* @param n - The count for a count-aware (function-valued) label / 件数キー (関数値) に渡す件数
|
|
1065
|
+
* @returns The display string / 表示文字列
|
|
1066
|
+
* @throws {RangeError} When the label is a function and `n` is omitted / 関数値で n を省略した場合
|
|
1070
1067
|
*/
|
|
1071
1068
|
export declare const resolveLabel: (labels: SpreadsheetLabels, key: keyof SpreadsheetLabels, n?: number) => string;
|
|
1072
1069
|
|
|
1070
|
+
/**
|
|
1071
|
+
* The single fold point of the `locale` + `labels` props. The locale is resolved by
|
|
1072
|
+
* `resolveVirtualScrollLocale` (undefined ⇒ "en"). `undefined` overrides return
|
|
1073
|
+
* SPREADSHEET_LABEL_CATALOGS[locale] by identity. Otherwise: the overrides must be a plain object
|
|
1074
|
+
* (prototype `Object.prototype` or `null`) whose own keys all belong to LABEL_KEYS, and only its
|
|
1075
|
+
* own properties are read; the engine subset is resolved by `resolveVirtualScrollLabels` (the
|
|
1076
|
+
* engine's own validation); an own key takes its override when it is not `undefined`
|
|
1077
|
+
* (destructuring-default semantics of the folded v0.7 props) and the catalog value otherwise; the
|
|
1078
|
+
* result is validated by assertLabels and frozen. Inputs are never mutated.
|
|
1079
|
+
* `locale` + `labels` prop の唯一の畳込み点。ロケールは `resolveVirtualScrollLocale` で解決
|
|
1080
|
+
* (undefined は "en")。override 未指定は SPREADSHEET_LABEL_CATALOGS[locale] を identity で返却。
|
|
1081
|
+
* それ以外は、override は自身のキーがすべて LABEL_KEYS に属する素の object (プロトタイプが
|
|
1082
|
+
* `Object.prototype` か `null`) で、読むのは自身のプロパティのみ。エンジン部分は
|
|
1083
|
+
* `resolveVirtualScrollLabels` (エンジン自身の検証) で解決、固有キーは undefined でない override を採用し
|
|
1084
|
+
* それ以外はカタログ値 (畳み込んだ v0.7 prop の分割代入既定の意味論)、結果は assertLabels で検証し凍結。
|
|
1085
|
+
* 入力は変更しない。
|
|
1086
|
+
*
|
|
1087
|
+
* @param locale - UI chrome locale, or `undefined` for the default "en" / UI クロームロケール (`undefined` で既定の "en")
|
|
1088
|
+
* @param overrides - Per-key overrides, or `undefined` for none / キー単位の上書き (`undefined` で上書きなし)
|
|
1089
|
+
* @returns The resolved, frozen label bag / 解決済みの凍結ラベル集合
|
|
1090
|
+
* @throws {RangeError} When the locale is unsupported, the overrides are `null` / not an object,
|
|
1091
|
+
* the overrides are not a plain object (an array, a class instance, an object inheriting from
|
|
1092
|
+
* another object), an own key is not a label key (including the removed validationRejected /
|
|
1093
|
+
* indicator* keys), or a value violates its key's rule / ロケールが非対応、override が `null` /
|
|
1094
|
+
* 非 object、override が素の object でない (配列・クラスインスタンス・他 object 継承)、自身のキーが
|
|
1095
|
+
* ラベルキー外 (削除済みの validationRejected / indicator* を含む)、または値がキーの規則に違反した場合
|
|
1096
|
+
*/
|
|
1097
|
+
export declare const resolveLabels: (locale: SpreadsheetLocale | undefined, overrides: SpreadsheetLabelOverrides | undefined) => SpreadsheetLabels;
|
|
1098
|
+
|
|
1073
1099
|
/** One colour-scale point; `value` omitted = the range extremum from `getRangeExtrema` (min / max) or the arithmetic midpoint (mid). / 色スケールの 1 点。value 省略 = getRangeExtrema のレンジ極値 (min / max) か算術中点 (mid)。 */
|
|
1074
1100
|
export declare type ScalePoint = {
|
|
1075
1101
|
color: string;
|
|
@@ -1167,6 +1193,16 @@ export declare type ShortcutOverrides = {
|
|
|
1167
1193
|
*/
|
|
1168
1194
|
export declare const Spreadsheet: ForwardRefExoticComponent<SpreadsheetProps & SpreadsheetTestProps & RefAttributes<SpreadsheetHandle>>;
|
|
1169
1195
|
|
|
1196
|
+
/**
|
|
1197
|
+
* Frozen full catalogs per locale (outer record and every entry frozen): each entry is the engine
|
|
1198
|
+
* catalog `VIRTUAL_SCROLL_LABEL_CATALOGS[locale]` (reused by value — single source of truth for
|
|
1199
|
+
* the 7 chrome strings) overlaid by the own-key catalog of the same locale.
|
|
1200
|
+
* ロケール別の凍結済み完全カタログ (外側のレコードと各エントリを凍結): 各エントリはエンジンカタログ
|
|
1201
|
+
* `VIRTUAL_SCROLL_LABEL_CATALOGS[locale]` (値を再利用 — 7 クローム文言の単一の真実源) に同ロケールの
|
|
1202
|
+
* 固有キーカタログを重ねたもの。
|
|
1203
|
+
*/
|
|
1204
|
+
export declare const SPREADSHEET_LABEL_CATALOGS: Readonly<Record<SpreadsheetLocale, SpreadsheetLabels>>;
|
|
1205
|
+
|
|
1170
1206
|
/**
|
|
1171
1207
|
* Reserved chords for EVERY command: the exact chords of `rebindable: false` rows consulted in
|
|
1172
1208
|
* the idle column (`"idle" | "both"` — every command is consulted there). Editing-only rows
|
|
@@ -1527,48 +1563,22 @@ export declare type SpreadsheetHandle = {
|
|
|
1527
1563
|
|
|
1528
1564
|
/**
|
|
1529
1565
|
* The `labels` prop shape: any subset of SpreadsheetLabels (an omitted or `undefined` key keeps
|
|
1530
|
-
* the
|
|
1531
|
-
* `labels` prop の形: SpreadsheetLabels の任意の部分集合 (省略 / undefined
|
|
1532
|
-
* SpreadsheetLabels に閉じる。
|
|
1566
|
+
* the catalog value of the chosen locale). Keys are closed to SpreadsheetLabels.
|
|
1567
|
+
* `labels` prop の形: SpreadsheetLabels の任意の部分集合 (省略 / undefined は選択ロケールのカタログ値の
|
|
1568
|
+
* まま)。キーは SpreadsheetLabels に閉じる。
|
|
1533
1569
|
*/
|
|
1534
1570
|
export declare type SpreadsheetLabelOverrides = {
|
|
1535
1571
|
readonly [K in keyof SpreadsheetLabels]?: SpreadsheetLabels[K];
|
|
1536
1572
|
};
|
|
1537
1573
|
|
|
1538
1574
|
/**
|
|
1539
|
-
*
|
|
1540
|
-
*
|
|
1541
|
-
*
|
|
1542
|
-
*
|
|
1543
|
-
*
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
* - `resolveLabels(overrides)` is the single fold point: a key takes its override when the
|
|
1547
|
-
* override is not `undefined` and the default otherwise (exactly the destructuring-default
|
|
1548
|
-
* semantics the two folded props had in v0.7), then `assertLabels` runs on the result.
|
|
1549
|
-
* `undefined` overrides resolve to `DEFAULT_LABELS` by identity.
|
|
1550
|
-
* - `assertLabels`: `sinkAriaLabel` MUST be a string mentioning "Escape" (WCAG 2.1.2 escape-method
|
|
1551
|
-
* advisement, spec 00 §10-4) — otherwise a RangeError, thrown at mount by the root.
|
|
1552
|
-
* - `resolveLabel(labels, key, n)` is the single read point: a function-valued label receives `n`
|
|
1553
|
-
* (omitting `n` for a function value is a RangeError — never a silent 0), a string is returned
|
|
1554
|
-
* as-is (`n` ignored, so a consumer may override a count key with a plain string).
|
|
1555
|
-
*
|
|
1556
|
-
* UI ラベル語彙 (v0.8 §1.6 / §4.1.17) — パッケージ唯一のラベル集合。v0.7 の `sinkAriaLabel` /
|
|
1557
|
-
* `rootAriaLabel` prop を畳み込み (クリーンカットオーバー: 別名 prop は残さない)、リッチセル UI の
|
|
1558
|
-
* ポップオーバー / インジケータ文言を加える。純関数・React 非依存。
|
|
1559
|
-
* 契約: `SpreadsheetLabels` は閉じたキー集合、`DEFAULT_LABELS` は全キーの英語既定、件数キーは
|
|
1560
|
-
* `string | ((n: number) => string)`。`resolveLabels` が唯一の畳込み点 (undefined でない override を
|
|
1561
|
-
* 採用、それ以外は既定 — 畳み込んだ 2 prop が v0.7 で持っていた分割代入既定と同じ意味論。
|
|
1562
|
-
* override 未指定は `DEFAULT_LABELS` を identity で返却) で、続けて `assertLabels`
|
|
1563
|
-
* (`sinkAriaLabel` は "Escape" を含む文字列であること — spec 00 §10-4、違反はマウント時 RangeError)。
|
|
1564
|
-
* `resolveLabel` が唯一の読み出し点 (関数値は n 必須 — 省略は RangeError、文字列はそのまま)。
|
|
1565
|
-
*/
|
|
1566
|
-
/**
|
|
1567
|
-
* The closed label vocabulary. Every key has a default in DEFAULT_LABELS; consumers override any
|
|
1568
|
-
* subset through the `labels` prop (SpreadsheetLabelOverrides).
|
|
1569
|
-
* 閉じたラベル語彙。全キーが DEFAULT_LABELS に既定を持ち、消費者は `labels` prop で任意の部分集合を上書き。
|
|
1570
|
-
*/
|
|
1571
|
-
export declare type SpreadsheetLabels = {
|
|
1575
|
+
* The closed label vocabulary: the 7 engine chrome keys of `@aiquants/virtualscroll` plus the 21
|
|
1576
|
+
* own keys of the spreadsheet. Every key has a value in each SPREADSHEET_LABEL_CATALOGS entry;
|
|
1577
|
+
* consumers override any subset through the `labels` prop (SpreadsheetLabelOverrides).
|
|
1578
|
+
* 閉じたラベル語彙: `@aiquants/virtualscroll` のエンジンクローム 7 キーとスプレッドシート固有の 21 キー。
|
|
1579
|
+
* 全キーが SPREADSHEET_LABEL_CATALOGS の各ロケールに値を持ち、消費者は `labels` prop で任意の部分集合を上書き。
|
|
1580
|
+
*/
|
|
1581
|
+
export declare type SpreadsheetLabels = VirtualScrollLabels & {
|
|
1572
1582
|
/** Accessible name of the sink (grid input receptor); MUST mention "Escape" (spec 00 §10-4). / シンクのアクセシブルネーム ("Escape" 必須)。 */
|
|
1573
1583
|
sinkAriaLabel: string;
|
|
1574
1584
|
/** Accessible name of the root role="group" landing point. / root 着地点のアクセシブルネーム。 */
|
|
@@ -1609,18 +1619,21 @@ export declare type SpreadsheetLabels = {
|
|
|
1609
1619
|
listMore: string | ((n: number) => string);
|
|
1610
1620
|
/** Message popover heading. / メッセージポップオーバーの見出し。 */
|
|
1611
1621
|
messageTitle: string;
|
|
1612
|
-
/** Message shown when a strict validation rule rejects the typed value. / 厳格検証で拒否されたときの文言。 */
|
|
1613
|
-
validationRejected: string;
|
|
1614
1622
|
/** Close button of every popover. / ポップオーバー共通の閉じるボタン。 */
|
|
1615
1623
|
popoverClose: string;
|
|
1616
|
-
/** Accessible label of the note indicator on a cell. / ノートインジケータのラベル。 */
|
|
1617
|
-
indicatorNote: string;
|
|
1618
|
-
/** Accessible label of the comment indicator on a cell. / コメントインジケータのラベル。 */
|
|
1619
|
-
indicatorComment: string;
|
|
1620
|
-
/** Accessible label of the invalid-value indicator on a cell. / 無効値インジケータのラベル。 */
|
|
1621
|
-
indicatorInvalid: string;
|
|
1622
1624
|
};
|
|
1623
1625
|
|
|
1626
|
+
/**
|
|
1627
|
+
* The UI chrome language of the spreadsheet ("en" | "ja") — the engine's locale set, so the grid
|
|
1628
|
+
* body and the embedded scroll chrome always speak one language. A different axis from
|
|
1629
|
+
* `formats.locale`, which is the BCP-47 locale of value formatting (numbers / dates); a BCP-47 tag
|
|
1630
|
+
* such as "ja-JP" is NOT a SpreadsheetLocale.
|
|
1631
|
+
* スプレッドシートの UI クローム言語 ("en" | "ja") — エンジンのロケール集合そのもので、グリッド本体と
|
|
1632
|
+
* 埋込みスクロールクロームが常に同一言語。値書式 (数値 / 日付) の BCP-47 ロケールである
|
|
1633
|
+
* `formats.locale` とは別軸 ("ja-JP" のような BCP-47 タグは SpreadsheetLocale ではない)。
|
|
1634
|
+
*/
|
|
1635
|
+
export declare type SpreadsheetLocale = VirtualScrollLocale;
|
|
1636
|
+
|
|
1624
1637
|
/**
|
|
1625
1638
|
* Bulk-operation kind for the ADR-12 rejection channel (public vocabulary). Serialize-only
|
|
1626
1639
|
* gestures ("copy" / "cut"), grid geometry ("resize") and the WRITE gestures ("delete" /
|
|
@@ -1968,14 +1981,30 @@ export declare type SpreadsheetProps = {
|
|
|
1968
1981
|
command: SpreadsheetCommand;
|
|
1969
1982
|
state: boolean | null;
|
|
1970
1983
|
}) => string;
|
|
1984
|
+
/**
|
|
1985
|
+
* UI chrome language ("en" | "ja"; default "en"): selects the label catalog, the built-in
|
|
1986
|
+
* data-validation messages, and is forwarded to the grid scrollbars (arrow labels,
|
|
1987
|
+
* scroll-to-edge pills, "No items"). An unsupported value throws a RangeError during render —
|
|
1988
|
+
* there is no language negotiation: hosts map `navigator.language` themselves. Unrelated to
|
|
1989
|
+
* `formats.locale`, which is the BCP-47 value-formatting locale ("ja-JP" is NOT a valid value
|
|
1990
|
+
* here).
|
|
1991
|
+
* UI クローム言語 ("en" | "ja"、既定 "en"): ラベルカタログと組み込みデータ検証メッセージを選び、
|
|
1992
|
+
* グリッドのスクロールバー (矢印ラベル・端スクロールピル・"No items") へ素通し。非対応値は render 中
|
|
1993
|
+
* RangeError — 言語ネゴシエーションなし (`navigator.language` の写像はホスト側)。値書式の BCP-47
|
|
1994
|
+
* ロケールである `formats.locale` とは無関係 ("ja-JP" はここでは不正値)。
|
|
1995
|
+
*/
|
|
1996
|
+
locale?: SpreadsheetLocale;
|
|
1971
1997
|
/**
|
|
1972
1998
|
* UI label vocabulary (v0.8 §1.6) — folds the former `sinkAriaLabel` / `rootAriaLabel` props
|
|
1973
|
-
* (clean cut-over).
|
|
1974
|
-
*
|
|
1975
|
-
*
|
|
1999
|
+
* (clean cut-over). 28 keys = the 7 engine chrome keys (scrollUp / scrollDown / scrollLeft /
|
|
2000
|
+
* scrollRight / scrollToTop / scrollToBottom / noItems) + 21 own keys. An omitted prop or an
|
|
2001
|
+
* explicitly `undefined` key keeps the value of the `locale` catalog. An unknown key or an
|
|
2002
|
+
* empty / blank value throws a RangeError during render, and the resolved `sinkAriaLabel` MUST
|
|
2003
|
+
* mention "Escape" (WCAG 2.1.2 escape advisement, §10-4).
|
|
1976
2004
|
* UI ラベル語彙 (v0.8 §1.6) — 旧 sinkAriaLabel / rootAriaLabel prop を畳込み (クリーンカットオーバー)。
|
|
1977
|
-
*
|
|
1978
|
-
*
|
|
2005
|
+
* 28 キー = エンジンクローム 7 キー (scrollUp / scrollDown / scrollLeft / scrollRight / scrollToTop /
|
|
2006
|
+
* scrollToBottom / noItems) + 固有 21 キー。prop 省略 / 明示 undefined のキーは `locale` のカタログ値。
|
|
2007
|
+
* 未知キー・空 / 空白値は render 中 RangeError、解決後の sinkAriaLabel は "Escape" を含むこと (§10-4)。
|
|
1979
2008
|
*/
|
|
1980
2009
|
labels?: SpreadsheetLabelOverrides;
|
|
1981
2010
|
/**
|
|
@@ -2042,7 +2071,7 @@ export declare type SpreadsheetProps = {
|
|
|
2042
2071
|
onClipChange?: (clip: ClipInfo | null) => void;
|
|
2043
2072
|
/** Hyperlink navigation seam (Alt+Enter, the link popover's Open button, and Ctrl / Meta+click on a link cell — spec 08 §11 D-53) — undeclared ⇒ no navigation, no Open button, no pointer gesture. / ハイパーリンク遷移シーム (Alt+Enter / Open ボタン / リンクセルへの Ctrl / Meta+クリック — 分冊 08 §11 D-53)。未宣言 = 遷移なし・Open ボタンなし・ポインタジェスチャなし。 */
|
|
2044
2073
|
onHyperlinkOpen?: (url: string, cell: CellCoord) => void;
|
|
2045
|
-
/** Strict validation rejection notice (v0.8 §1.9) — the commit never reaches the adapter; the message popover shows the rejection. / strict 検証拒否の通知 (commit はアダプタへ届かず、message ポップオーバーが拒否を示す)
|
|
2074
|
+
/** Strict validation rejection notice (v0.8 §1.9) — the commit never reaches the adapter; the message popover shows the rejection. `message` is `rule.errorMessage` when declared, otherwise the built-in message in the active `locale`. / strict 検証拒否の通知 (commit はアダプタへ届かず、message ポップオーバーが拒否を示す)。`message` は `rule.errorMessage` 宣言時はそれ、未宣言なら現在の `locale` の組み込みメッセージ。 */
|
|
2046
2075
|
onValidationRejected?: (ctx: {
|
|
2047
2076
|
cell: CellCoord;
|
|
2048
2077
|
rule: DataValidationRule;
|
|
@@ -2163,65 +2192,30 @@ export declare type TextValidationRule = {
|
|
|
2163
2192
|
export declare const toR1C1: (formula: string, origin: CellCoord) => string;
|
|
2164
2193
|
|
|
2165
2194
|
/**
|
|
2166
|
-
* Validates committed text against a rule.
|
|
2167
|
-
*
|
|
2168
|
-
*
|
|
2169
|
-
*
|
|
2170
|
-
*
|
|
2171
|
-
*
|
|
2172
|
-
*
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
* @fileoverview Data-validation rule vocabulary and the pure verdict engine (v0.8 — the
|
|
2178
|
-
* getCellValidation capability, ADR-13). The consumer declares a per-cell DataValidationRule
|
|
2179
|
-
* via the optional adapter capability getCellValidation(row, col); the editor asks
|
|
2180
|
-
* validateCellText at COMMIT (passing the adapter's formula evaluator for `custom` rules) and
|
|
2181
|
-
* the grid asks isVisiblyInvalid at PAINT (never evaluating a formula) to draw the invalid
|
|
2182
|
-
* indicator. React-free and total.
|
|
2195
|
+
* Validates committed text against a rule. The locale is checked FIRST (before the rule and the
|
|
2196
|
+
* text), so an unsupported locale fails fast even for a passing text — this pure function has no
|
|
2197
|
+
* hidden default locale. Blank always passes; `custom` is evaluated only when the caller passes
|
|
2198
|
+
* `evaluate` (commit time — paint omits it); an incomplete rule (unparseable bound, missing `b` /
|
|
2199
|
+
* `value`) is inert; a rule outside the vocabulary throws RangeError. Message = `rule.errorMessage`
|
|
2200
|
+
* when set (the empty string included), else the built-in summary in the given locale.
|
|
2201
|
+
* 確定テキストの規則検証。ロケールを最初に (規則と text より前に) 検査するため、非対応ロケールは
|
|
2202
|
+
* 合格する text でも fail-fast (純関数に隠れた既定ロケールは無い)。空文字は常に合格、custom は呼び手が
|
|
2203
|
+
* evaluate を渡すとき (確定時 — 描画は渡さない) だけ評価、不完全な規則 (解釈不能な境界・b / value 欠落) は
|
|
2204
|
+
* 不活性、語彙外の規則は RangeError。メッセージは errorMessage があればそれ (空文字も含む)、無ければ
|
|
2205
|
+
* 指定ロケールの組込み要約。
|
|
2183
2206
|
*
|
|
2184
|
-
*
|
|
2185
|
-
*
|
|
2186
|
-
*
|
|
2187
|
-
* -
|
|
2188
|
-
*
|
|
2189
|
-
*
|
|
2190
|
-
*
|
|
2191
|
-
*
|
|
2192
|
-
*
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
* non-finite `a` / `b` for textLength, a missing `b` for between / notBetween, a missing `value`
|
|
2197
|
-
* for the needle text ops) makes the rule accept everything — a half-written rule never locks a
|
|
2198
|
-
* cell. Bounds are never swapped: `between 10 and 5` accepts nothing but blank.
|
|
2199
|
-
* - FAIL-FAST on a rule OUTSIDE the vocabulary: an unknown `type` or `op` is a consumer bug and
|
|
2200
|
-
* throws RangeError regardless of the text (fail-soft would silently disable validation).
|
|
2201
|
-
* - INTERNED list Sets per rule object (WeakMap identity), so the paint-time `list` check is O(1)
|
|
2202
|
-
* even for a 10k-item list; a fresh rule object interns a fresh Set.
|
|
2203
|
-
* - MESSAGE resolution: `errorMessage` when the consumer set it (an empty string is honoured as
|
|
2204
|
-
* is), else a built-in English summary of the rule.
|
|
2205
|
-
* - `custom` needs the caller's `evaluate`; without it the rule is not evaluated (verdict ok), and
|
|
2206
|
-
* truth = `true` or a finite non-zero number (the conditionalFormat customFormula convention).
|
|
2207
|
-
* - Matching is exact (case-sensitive, untrimmed) for `list` / `text` / `checkbox`; textLength
|
|
2208
|
-
* counts Unicode code points. `isEmail` is the WHATWG valid-e-mail grammar with a mandatory
|
|
2209
|
-
* dotted domain; `isUrl` is a WHATWG-parsable absolute http(s) URL.
|
|
2210
|
-
*
|
|
2211
|
-
* データ検証の規則語彙と純関数の判定エンジン (v0.8 — getCellValidation 能力、ADR-13)。
|
|
2212
|
-
* consumer が任意能力 getCellValidation(row, col) で規則を宣言し、エディタが確定時に
|
|
2213
|
-
* validateCellText (custom 規則にはアダプタの数式評価器を渡す)、グリッドが描画時に
|
|
2214
|
-
* isVisiblyInvalid (数式は決して評価しない) を呼んで不正インジケータを描く。React 非依存・全域関数。
|
|
2215
|
-
* エンジン契約 (全て変異検証で封印 — spec 01 §8.3): 空文字は常に有効 (Excel の「空白を無視」—
|
|
2216
|
-
* 検証セルは必ず消去できる、custom も評価しない)、number は cellFormat.ts と同じ厳密 10 進文法で
|
|
2217
|
-
* 符号 / 有効数字 / 小数点位置の正規形として正確比較 (double 非経由)、date は Date 非依存の純暦文法を
|
|
2218
|
-
* タプル比較 (between は両端含み)、不完全な規則 (解釈不能な境界・between の b 欠落・needle 欠落) は
|
|
2219
|
-
* 不活性 = 全受理 (書きかけの規則でセルを閉じ込めない、境界の入替もしない)、語彙外の type / op は
|
|
2220
|
-
* consumer バグとして text に依らず RangeError、list の Set は規則 object 毎に WeakMap intern、
|
|
2221
|
-
* メッセージは errorMessage (空文字も尊重) が無ければ組込みの英語要約、custom は evaluate 無しなら
|
|
2222
|
-
* 未評価 (ok)・真 = true か有限非 0 数、照合は完全一致 (大文字小文字区別・trim 無し)、textLength は
|
|
2223
|
-
* コードポイント数、isEmail は WHATWG 文法 + ドット付きドメイン必須、isUrl は WHATWG 絶対 http(s) URL。
|
|
2224
|
-
*/
|
|
2207
|
+
* @param rule - The cell's data-validation rule / セルのデータ検証規則
|
|
2208
|
+
* @param text - The committed text / 確定テキスト
|
|
2209
|
+
* @param locale - The UI chrome locale of the built-in message ("en" | "ja"; required) / 組込みメッセージの UI クロームロケール ("en" | "ja"、必須)
|
|
2210
|
+
* @param evaluate - The consumer's formula evaluator for `custom` rules (omit to leave them unevaluated) / custom 規則用の consumer の数式評価器 (省略で未評価)
|
|
2211
|
+
* @returns The frozen shared ok verdict, or a rejection carrying the resolved message / 共有の凍結 ok 判定、または解決済みメッセージ付きの拒否
|
|
2212
|
+
* @throws {RangeError} When `locale` is not a supported SpreadsheetLocale (`undefined`, `null`,
|
|
2213
|
+
* `"EN"`, `"ja-JP"`, ...), or the rule's `type` / `op` is outside the vocabulary / `locale` が
|
|
2214
|
+
* 対応 SpreadsheetLocale でない場合 (`undefined`、`null`、`"EN"`、`"ja-JP"` など)、または規則の
|
|
2215
|
+
* type / op が語彙外の場合
|
|
2216
|
+
*/
|
|
2217
|
+
export declare const validateCellText: (rule: DataValidationRule, text: string, locale: SpreadsheetLocale, evaluate?: ValidationEvaluate) => ValidationVerdict;
|
|
2218
|
+
|
|
2225
2219
|
/** Ordered comparison vocabulary shared by number / textLength / date rules; between / notBetween include both bounds. / number / textLength / date 規則が共有する比較語彙。between / notBetween は両端含み。 */
|
|
2226
2220
|
export declare type ValidationCompareOp = "gt" | "gte" | "lt" | "lte" | "eq" | "neq" | "between" | "notBetween";
|
|
2227
2221
|
|