试试这个
- 在内存中的小型名册上编辑。
- 注意标准 Chrome 仍可正常工作。
- 将它与 Worker/WASM 演示作比较。
它是怎么做到的
只有三个 backend 方法是必选的。可选 capability port 会增强 UI;未实现时,对应命令会消失,而不是留下一个半成品的模仿。
PORT CONTRACT
static backend 只在这里出现,用来演示必选 port 契约和可选能力缺失时的平稳降级。
只有三个 backend 方法是必选的。可选 capability port 会增强 UI;未实现时,对应命令会消失,而不是留下一个半成品的模仿。
/**
* Seed data for the "basics" demo — a small, honest team roster. Verified
* against `excel/solid-excel/src-vnext/adapter/static-backend.ts`: the
* static backend's `matrix` seed does NOT parse leading `=` in strings as a
* formula (every matrix string lands as literal `valueKind: 'string'` text
* via `valueToDisplayCell`) — formulas only evaluate when set explicitly on
* a `DisplayCell.formula` field through the sparse `cells` array. So the
* roster body comes from `matrix` (plain header/name/number cells) and the
* three totals-row formulas are layered on top via `cells`, landing on rows
* the matrix left blank.
*/
import type {
DisplayCell,
StaticSeedMatrix,
StaticSpreadsheetSeed,
} from '@einfach/solid-excel/vnext'
const matrix: StaticSeedMatrix = [
['Name', 'Role', 'Hours Logged', 'Tasks Done', 'Rating'],
['Mina Cho', 'Product Designer', 34, 9, 4.5],
['Diego Alvarez', 'Backend Engineer', 38, 11, 4.2],
['Priya Nair', 'Frontend Engineer', 36, 10, 4.8],
["Sam O'Connor", 'QA Analyst', 30, 14, 4.1],
['Layla Haddad', 'Project Manager', 32, 7, 4.6],