Coerce raw text input into a CellValue, following spreadsheet
input-bar conventions:
- blank (after trimming) clears the cell to a
null literal;
- text longer than one character beginning with
= becomes a formula;
- in a
number column a finite numeric string becomes a number literal;
- in a
date column a recognized date string (parseDateInput) becomes
its serial-number literal;
- in a
currency column a currency string (parseCurrencyInput) becomes
a plain number literal;
- anything else is stored verbatim as a text literal (the untrimmed
raw).
Shared by the grid's inline editor and any host-built formula bar, so input
parsing is identical everywhere instead of re-derived per consumer.
Declaration
Referenced by
Workspace packages depending on @sheetwrite/core
@sheetwrite/benchdependency
@sheetwrite/docs-startdependency
@sheetwrite/reactdependency
@sheetwrite/sveltedependency
@sheetwrite/vuedependency
@sheetwrite/xlsxdependency
Public exports naming parseCellInput
type CellFormat = "text" | "number" | "date" | "currency";type CellFormat = "text" | "number" | "date" | "currency";type CellFormat =
| "text"
| "number"
| "date"
| "currency";How a column's cells are typed, parsed, and rendered: text verbatim, number via its numberFormat, date as an Excel-style serial (see date-serial.ts) rendered by a date numberFormat, and currency as a plain number rendered by a currency numberFormat (e.g. $#,##0.00).API reference →type CellValue =
| { kind: "literal"; value: CellScalar }
| { kind: "ref"; target: CellAddress }
| { kind: "formula"; src: string };type CellValue =
| { kind: "literal"; value: CellScalar }
| { kind: "ref"; target: CellAddress }
| { kind: "formula"; src: string };type CellValue =
| {
kind: "literal";
value: CellScalar;
}
| {
kind: "ref";
target: CellAddress;
}
| {
kind: "formula";
src: string;
};A cell's persisted input: a literal, a cross-reference, or a formula. References resolve through the store's reference graph; formulas resolve in the WASM calculation engine.API reference →