ui-sdk-table-react 0.0.0-stage → 0.2.7
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/LICENSE +21 -0
- package/README.md +8 -2
- package/docs/api-react.md +312 -0
- package/docs/cell-editing.md +246 -0
- package/docs/cells-and-slots.md +127 -0
- package/docs/component-body.md +33 -0
- package/docs/component-cell.md +31 -0
- package/docs/component-col.md +31 -0
- package/docs/component-edit-error.md +31 -0
- package/docs/component-editor.md +31 -0
- package/docs/component-fill-handle.md +31 -0
- package/docs/component-foot.md +31 -0
- package/docs/component-head.md +31 -0
- package/docs/component-header-cell.md +31 -0
- package/docs/component-header-row.md +33 -0
- package/docs/component-plain-row.md +31 -0
- package/docs/component-resizer.md +33 -0
- package/docs/component-root.md +36 -0
- package/docs/component-row.md +33 -0
- package/docs/component-spacer.md +31 -0
- package/docs/controller-and-view.md +104 -0
- package/docs/examples-agents.md +50 -0
- package/docs/examples-column-definitions.md +179 -0
- package/docs/examples-formula-writer.md +276 -0
- package/docs/examples-styling.md +173 -0
- package/docs/examples.md +114 -0
- package/docs/excel-formulas.md +115 -0
- package/docs/export.md +96 -0
- package/docs/fill.md +126 -0
- package/docs/first-table.md +150 -0
- package/docs/formats.md +176 -0
- package/docs/groups-and-totals.md +118 -0
- package/docs/history.md +126 -0
- package/docs/installation.md +52 -0
- package/docs/llms.txt +13 -0
- package/docs/pages-and-server-mode.md +246 -0
- package/docs/range-copy-and-paste.md +115 -0
- package/docs/react.md +85 -0
- package/docs/reference-columns.md +179 -0
- package/docs/reference-controller.md +137 -0
- package/docs/reference-export.md +59 -0
- package/docs/reference-formulas.md +42 -0
- package/docs/reference-implementation.md +29 -0
- package/docs/reference-messages.md +55 -0
- package/docs/reference-view.md +116 -0
- package/docs/row-numbers-and-letters.md +112 -0
- package/docs/rows.md +350 -0
- package/docs/selection-and-keyboard.md +151 -0
- package/docs/sheet-formulas.md +329 -0
- package/docs/sheet-options.md +214 -0
- package/docs/skills.md +41 -0
- package/docs/sort-filter-and-search.md +260 -0
- package/docs/state-and-events.md +90 -0
- package/docs/styled-table.md +237 -0
- package/docs/table-components.md +105 -0
- package/package.json +45 -3
- package/src/index.ts +62 -0
- package/src/reference.ts +113 -0
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
# Formulas
|
|
2
|
+
|
|
3
|
+
Compute values with formulas as in a spreadsheet: a computed column, or a formula in one cell.
|
|
4
|
+
|
|
5
|
+
Use a column formula for a value that every row has, such as a total of price and quantity. Use a cell formula for a sheet where a person types `=` into a cell. A **column formula** makes a computed column: every row gets the value of the formula of its own row, also a row that comes later, and a group, a sort, a filter and a total read it as any column. A **cell formula** belongs to one cell: the table computes it, reports the result in the cell edit report as a plain value in the row, and reports again the cells that follow when a cell they read changes.
|
|
6
|
+
|
|
7
|
+
```tsx title="column.tsx"
|
|
8
|
+
'use client'
|
|
9
|
+
|
|
10
|
+
import { Table } from 'ui-sdk-table-react/reference'
|
|
11
|
+
import type { ColumnDef } from 'ui-sdk-table-core'
|
|
12
|
+
import { formulaColumn } from 'ui-sdk-table-core/formulas'
|
|
13
|
+
|
|
14
|
+
type Order = { id: string; product: string; price: number; qty: number }
|
|
15
|
+
|
|
16
|
+
const orders: Order[] = [
|
|
17
|
+
{ id: 'o1', product: 'Desk lamp', price: 39, qty: 4 },
|
|
18
|
+
{ id: 'o2', product: 'Chair', price: 249, qty: 1 },
|
|
19
|
+
{ id: 'o3', product: 'Cable', price: 6, qty: 10 },
|
|
20
|
+
]
|
|
21
|
+
|
|
22
|
+
const base: ColumnDef<Order>[] = [
|
|
23
|
+
{ id: 'product', header: 'Product' },
|
|
24
|
+
{ id: 'price', header: 'Price', format: 'decimal', sortable: true },
|
|
25
|
+
{ id: 'qty', header: 'Quantity', format: 'integer' },
|
|
26
|
+
]
|
|
27
|
+
|
|
28
|
+
const columns: ColumnDef<Order>[] = [
|
|
29
|
+
...base,
|
|
30
|
+
formulaColumn(
|
|
31
|
+
{
|
|
32
|
+
id: 'total',
|
|
33
|
+
header: 'Total',
|
|
34
|
+
format: 'decimal',
|
|
35
|
+
aggregate: 'sum',
|
|
36
|
+
sortable: true,
|
|
37
|
+
formula: '=[price]*[qty]',
|
|
38
|
+
},
|
|
39
|
+
base,
|
|
40
|
+
),
|
|
41
|
+
formulaColumn(
|
|
42
|
+
{
|
|
43
|
+
id: 'band',
|
|
44
|
+
header: 'Band',
|
|
45
|
+
formula: '=IFS([price]<10, "small", [price]<100, "medium", TRUE, "large")',
|
|
46
|
+
},
|
|
47
|
+
base,
|
|
48
|
+
),
|
|
49
|
+
]
|
|
50
|
+
|
|
51
|
+
export default function Column() {
|
|
52
|
+
return <Table rows={orders} columns={columns} aria-label="Orders" locale="en-US" />
|
|
53
|
+
}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Total is the price times the quantity of its row, and Band an IFS of the price. Press Total: the column sorts like any other, and the footer adds it up.
|
|
57
|
+
|
|
58
|
+
## The entry
|
|
59
|
+
|
|
60
|
+
The engine is an entry of its own, so a table without formulas does not carry it:
|
|
61
|
+
|
|
62
|
+
```ts
|
|
63
|
+
import { createFormulaEngine, formulaColumn } from 'ui-sdk-table-core/formulas'
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Create one engine for the life of the table: a new engine at each render computes every formula again.
|
|
67
|
+
|
|
68
|
+
## A column formula
|
|
69
|
+
|
|
70
|
+
`formulaColumn(definition, columns, { timeZone? })` needs no engine and no option of the table: it is a column with a `value` function.
|
|
71
|
+
|
|
72
|
+
- It reads the columns of its own row by id (`[price]`) or by header (`[Price]`).
|
|
73
|
+
- It throws with the words that say why for a formula that cannot be read.
|
|
74
|
+
- It keeps the value of each row object, so an owner that changes a row passes a new object for it.
|
|
75
|
+
- Its cells cannot be edited.
|
|
76
|
+
|
|
77
|
+
A column formula that a person sets at run time is state instead: `cellFormulas` with a `columns` layer, and `controller.setColumnFormula(columnId, text | null)`, which throws with the words of the issue.
|
|
78
|
+
|
|
79
|
+
- The column is a plain column of the owner (`{ id: 'custom', header: 'Custom' }`); the formula gives it its values.
|
|
80
|
+
- It is one change of `cellFormulas` and one step of the history, and it reports no value.
|
|
81
|
+
- When the column of the owner can be edited, a cell of it opens with the formula of the column as a person reads it (`=[Quantity]*2`). Enter on a text with `=` sets the formula of the column, as one step that Control+Z takes back. A value is refused with words (issue `columnCell`). `editCell` still refuses a value there.
|
|
82
|
+
- A formula of the owner that cannot be read, or column formulas that read each other in a circle, show an error in every row of the column, with the words of the issue as `aria-description` (for a range or a whole column: the formula of a column reads the cells of its own row only).
|
|
83
|
+
|
|
84
|
+
## A date group with the `period` format
|
|
85
|
+
|
|
86
|
+
```ts
|
|
87
|
+
const week = formulaColumn(
|
|
88
|
+
{ id: 'week', header: 'Week', groupable: true, sortable: true, formula: '=WEEKOF([created], 2)' },
|
|
89
|
+
base,
|
|
90
|
+
)
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Include `week` in `columns` after the base columns. Set `groupBy` to `['week']` and `sort` to `[{ id: 'week', desc: false }]` to group the orders by week, earliest first.
|
|
94
|
+
|
|
95
|
+
- `WEEKOF`, `MONTHOF`, `QUARTEROF`, `YEAROF` and `DAYOF` give the first day of the period as a day (`2026-11-16`). Each period is one group, a sort puts the groups in time order, and the date filter, the facets, a fill and an export treat it as a day. `HOUROF` gives the moment at which the hour began.
|
|
96
|
+
- A column formula whose outer function gives a period gets the format `period` when its definition has no `format`: "Nov 16 – 22, 2026", "November 2026", "Q4 2026", "2026".
|
|
97
|
+
- Set it by hand with `format: 'period'` and `formatOptions: { unit: 'hour' | 'day' | 'week' | 'month' | 'quarter' | 'year' | 'weekday', weekdays?, timeZone? }`. `unit: 'weekday'` writes the name of the day for a number of `WEEKDAY` (`weekdays` is the type that gave it).
|
|
98
|
+
- The label of a group is the text of the format.
|
|
99
|
+
- **The zone.** A date function that reads a column reads the moment on the clock of the `timeZone` of that column's `formatOptions`, so a moment that reads 23:30 on the 21st falls on the 21st. Any other date uses the `timeZone` of `formulaColumn` or of `createFormulaEngine`, else local time. Pass a zone when a saved result must be the same for every person.
|
|
100
|
+
- **The week.** `WEEKOF(d, [type])` takes the type of `WEEKNUM` of Excel for the first day: Sunday without it or with 1, Monday with 2 or 11, 12 to 16 Tuesday to Saturday, 17 Sunday, 21 Monday. Another type gives `#NUM!`.
|
|
101
|
+
|
|
102
|
+
## Cell formulas and a formula bar
|
|
103
|
+
|
|
104
|
+
```tsx title="cells.tsx"
|
|
105
|
+
'use client'
|
|
106
|
+
|
|
107
|
+
import { useEffect, useState, useRef } from 'react'
|
|
108
|
+
import { createTableController } from 'ui-sdk-table-react'
|
|
109
|
+
import { Table } from 'ui-sdk-table-react/reference'
|
|
110
|
+
import {
|
|
111
|
+
applyEdits,
|
|
112
|
+
rowNumberColumn,
|
|
113
|
+
type CellFormulas,
|
|
114
|
+
type ColumnDef,
|
|
115
|
+
type FormulaView,
|
|
116
|
+
type TableView,
|
|
117
|
+
} from 'ui-sdk-table-core'
|
|
118
|
+
import { createFormulaEngine } from 'ui-sdk-table-core/formulas'
|
|
119
|
+
|
|
120
|
+
type Line = { id: string; item: string; price: number | null; qty: number | null; total?: unknown }
|
|
121
|
+
|
|
122
|
+
const initialLines: Line[] = [
|
|
123
|
+
{ id: 'l1', item: 'Desk lamp', price: 39, qty: 4, total: 156 },
|
|
124
|
+
{ id: 'l2', item: 'Monitor arm', price: 89, qty: 2, total: 178 },
|
|
125
|
+
{ id: 'l3', item: 'Keyboard', price: 59, qty: 3, total: 177 },
|
|
126
|
+
{ id: 'sum', item: 'Order total', price: null, qty: null, total: 511 },
|
|
127
|
+
]
|
|
128
|
+
|
|
129
|
+
const columns: ColumnDef<Line>[] = [
|
|
130
|
+
rowNumberColumn<Line>(),
|
|
131
|
+
{ id: 'item', header: 'Item', allowFormula: false },
|
|
132
|
+
{ id: 'price', header: 'Price', format: 'decimal' },
|
|
133
|
+
{ id: 'qty', header: 'Qty', format: 'integer' },
|
|
134
|
+
{ id: 'total', header: 'Total', format: 'decimal' },
|
|
135
|
+
]
|
|
136
|
+
|
|
137
|
+
const initialFormulas: CellFormulas = {
|
|
138
|
+
cells: {
|
|
139
|
+
l1: { total: '=[price]*[qty]' },
|
|
140
|
+
l2: { total: '=[price]*[qty]' },
|
|
141
|
+
l3: { total: '=[price]*[qty]' },
|
|
142
|
+
sum: { total: '=SUM([total@l1]:[total@l3])' },
|
|
143
|
+
},
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export default function Cells() {
|
|
147
|
+
const [lines, setLines] = useState<Line[]>(initialLines)
|
|
148
|
+
const [formulas, setFormulas] = useState<CellFormulas>(initialFormulas)
|
|
149
|
+
const [controller] = useState(createTableController)
|
|
150
|
+
const [engine] = useState(createFormulaEngine)
|
|
151
|
+
const [view, setView] = useState<TableView>()
|
|
152
|
+
useEffect(() => {
|
|
153
|
+
const read = () => setView(controller.getView())
|
|
154
|
+
const stop = controller.subscribe(read)
|
|
155
|
+
read()
|
|
156
|
+
return stop
|
|
157
|
+
}, [controller])
|
|
158
|
+
const frame = useRef<HTMLDivElement>(null)
|
|
159
|
+
const [draft, setDraft] = useState<{ at: FormulaView; text: string } | null>(null)
|
|
160
|
+
const [error, setError] = useState('')
|
|
161
|
+
const at = draft?.at ?? view?.formula
|
|
162
|
+
const text = draft?.text ?? at?.text ?? ''
|
|
163
|
+
function input(value: string) {
|
|
164
|
+
if (at) {
|
|
165
|
+
setDraft({ at, text: value })
|
|
166
|
+
setError('')
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
function cancel() {
|
|
170
|
+
setDraft(null)
|
|
171
|
+
setError('')
|
|
172
|
+
}
|
|
173
|
+
async function commit() {
|
|
174
|
+
if (draft) {
|
|
175
|
+
try {
|
|
176
|
+
await controller.editCell(draft.at.rowId, draft.at.columnId, draft.text)
|
|
177
|
+
cancel()
|
|
178
|
+
} catch (reason) {
|
|
179
|
+
setError(
|
|
180
|
+
reason instanceof Error
|
|
181
|
+
? typeof reason.cause === 'string'
|
|
182
|
+
? reason.cause
|
|
183
|
+
: reason.message
|
|
184
|
+
: String(reason),
|
|
185
|
+
)
|
|
186
|
+
return
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
frame.current?.querySelector<HTMLElement>('[data-active]')?.focus()
|
|
190
|
+
}
|
|
191
|
+
return (
|
|
192
|
+
<>
|
|
193
|
+
<form
|
|
194
|
+
onSubmit={(event) => {
|
|
195
|
+
event.preventDefault()
|
|
196
|
+
void commit()
|
|
197
|
+
}}
|
|
198
|
+
>
|
|
199
|
+
<output data-testid="address">{at?.address || '—'}</output>
|
|
200
|
+
<input
|
|
201
|
+
aria-label="Formula of the active cell"
|
|
202
|
+
placeholder="Press a cell"
|
|
203
|
+
value={text}
|
|
204
|
+
disabled={!at}
|
|
205
|
+
aria-invalid={!!error}
|
|
206
|
+
onChange={(event) => input(event.currentTarget.value)}
|
|
207
|
+
onKeyDown={(event) => {
|
|
208
|
+
if (event.key === 'Escape') {
|
|
209
|
+
event.preventDefault()
|
|
210
|
+
cancel()
|
|
211
|
+
frame.current?.querySelector<HTMLElement>('[data-active]')?.focus()
|
|
212
|
+
}
|
|
213
|
+
}}
|
|
214
|
+
/>
|
|
215
|
+
<p role="status">{error}</p>
|
|
216
|
+
</form>
|
|
217
|
+
<div ref={frame}>
|
|
218
|
+
<Table
|
|
219
|
+
rows={lines}
|
|
220
|
+
columns={columns}
|
|
221
|
+
aria-label="An order with formulas"
|
|
222
|
+
controller={controller}
|
|
223
|
+
locale="en-US"
|
|
224
|
+
sheet
|
|
225
|
+
columnLetters
|
|
226
|
+
cellFormulas={formulas}
|
|
227
|
+
onCellFormulasChange={setFormulas}
|
|
228
|
+
formulas={engine}
|
|
229
|
+
onCellEdit={(edits) => setLines((current) => applyEdits(current, edits))}
|
|
230
|
+
/>
|
|
231
|
+
</div>
|
|
232
|
+
</>
|
|
233
|
+
)
|
|
234
|
+
}
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
Press the price of the Desk lamp (B1) and type 49, then Enter: its total and the order total change. Press D4 and type =SUMM(D1:D3) in the field above: the bar shows why it refuses.
|
|
238
|
+
|
|
239
|
+
- **Typing.** A text that starts with `=` in the editor of a cell, the formula bar, a paste, a fill or `editCell` is a formula: `=B1*C1`, `=SUM(D1:D4)`, `=$C$1*D2`, `=SUM(D:D)`. A refusal keeps the editor open with the words of the issue. `'=text` is the text `=text`.
|
|
240
|
+
- A column with `allowFormula: false` keeps such a text as its value. A cell that cannot be edited, a computed column and a table with `manualPage` hold no formula. A formula that would read its own cell is refused, with its path ("D2 reads B2, and B2 reads D2").
|
|
241
|
+
- **Addresses** are places in the document, not on the screen. The number of a row is its place in `rows` (children after their parent), and the letter of a column its place among `columns`, without the columns that lead. A sort, a filter, a page, a pin and a move change neither: after a sort the row numbers read 7, 2, 9, and a hidden column leaves a gap in the row of letters (A, C). Without `formulas`, the numbers and the letters are places of the view.
|
|
242
|
+
- **The stored form** holds ids, so it survives a sort and a new row before it: with the columns item, price, qty and total after the row numbers, `=B1*C1` in row 1 is `=[price]*[qty]` ("this row"), another row is `[price@l3]`, a whole column `[price@*]`, and `$` signs stay.
|
|
243
|
+
- **The locale.** In the stored form `.` is the decimal sign and `,` separates arguments, in every locale. A person types and reads the signs of the `locale` of the table: with a decimal comma (`fi-FI`) a number is `1,5` and only `;` separates arguments. Function names are English in every locale. The locale never changes what a formula computes.
|
|
244
|
+
- **One act, one report.** An edit reports its cell and every formula cell that follows, in order, in one cell edit report (`CellEdit.formula` is the formula that was set, or `null` for one that went), then `cellFormulas` changes. A listener that refuses the values refuses all of it; one that refuses the formulas keeps the values. It is one step of the history, and its undo puts the values and the formulas back without computing.
|
|
245
|
+
- **Fill, paste, cut, copy, clear.** A copy puts the values on the clipboard and remembers the formulas. A paste of that same text pastes the formulas, with each reference without `$` moved by the distance the cell moved (past the edge, `#REF!`). A cut moves its formulas once, unmoved. A fill gives the formula of its source to its targets, moved. Delete takes values and formulas. A paste of the formula that a cell holds is no change.
|
|
246
|
+
- **New rows of the owner.** After new `rows` the table checks the formula cells that they change, in a microtask, and reports the differences with the reason `recalculate`, which is no step. A row that a formula names and that is gone turns it into `#REF!`. An owner that does not take a result gets it once, not in a loop. At the mount nothing is computed: `controller.recalculate()` checks every formula cell, for a check after a load. With `manualPage` there is no check.
|
|
247
|
+
- **Errors** are texts in the row: `#DIV/0!`, `#VALUE!`, `#REF!`, `#NAME?`, `#NUM!`, `#N/A`, `#CYCLE!` (`FORMULA_ERRORS`, `isFormulaError`). A formula that reads an error passes it on, a sum skips it, a range filter leaves it out, and the text of the cell is the code in every format. Type a column that can hold a formula so that it can hold such a text.
|
|
248
|
+
|
|
249
|
+
To build a bar from the shared API, read `getView().formula` for the active cell. When typing starts, keep its row and column ids with the draft. Save through `editCell(rowId, columnId, text)` so moving the active cell cannot redirect the edit. After a commit or a cancel, give focus back to the active cell (`[data-active]`).
|
|
250
|
+
|
|
251
|
+
## Functions
|
|
252
|
+
|
|
253
|
+
`controller.getFormulaFunctions()` and `FORMULA_FUNCTIONS` list each with its arguments (as a text in `args` and as a list in `arguments`), one line of help and its `group`. [A formula writer](https://ui-sdk-table.fdts.dev/docs/formula-writer.md) builds suggestions and a hint on them.
|
|
254
|
+
|
|
255
|
+
| Group | Functions |
|
|
256
|
+
| --- | --- |
|
|
257
|
+
| Operators | `+ - * / ^`, a leading `-`, `%` after a number, `&` (joins texts), `= <> < <= > >=` |
|
|
258
|
+
| Numbers | `SUM`, `AVERAGE`, `MIN`, `MAX`, `COUNT`, `COUNTA`, `ROUND`, `ROUNDUP`, `ROUNDDOWN`, `FLOOR`, `CEILING`, `ABS`, `INT`, `MOD` |
|
|
259
|
+
| Conditions | `IF`, `IFS`, `SWITCH`, `AND`, `OR`, `NOT`, `IFERROR`, `IFNA`, `ISBLANK`, `ISNUMBER`, `ISTEXT`, `ISERROR` |
|
|
260
|
+
| Ranges with criteria | `COUNTIF`, `COUNTIFS`, `SUMIF`, `SUMIFS`, `AVERAGEIF`, `AVERAGEIFS`, `COUNTBLANK` |
|
|
261
|
+
| Lookups | `XLOOKUP`, `VLOOKUP`, `INDEX`, `MATCH` |
|
|
262
|
+
| Texts | `CONCAT`, `TEXTJOIN`, `LEN`, `LEFT`, `RIGHT`, `MID`, `UPPER`, `LOWER`, `TRIM`, `SUBSTITUTE`, `FIND`, `SEARCH`, `VALUE`, `TEXT` |
|
|
263
|
+
| Periods of a date | `DAYOF`, `WEEKOF(d, [type])`, `MONTHOF`, `QUARTEROF`, `YEAROF`, `HOUROF` |
|
|
264
|
+
| Parts of a date | `YEAR`, `QUARTER`, `MONTH`, `DAY`, `HOUR`, `MINUTE`, `WEEKDAY(d, [type])`, `ISOWEEKNUM`, `ISOYEAR` |
|
|
265
|
+
| Date math | `DATE(year, month, day)`, `DAYS(end, start)`, `DATEADD(date, count, unit)`, `EOMONTH(date, months)`, `TODAY()`, `NOW()` |
|
|
266
|
+
|
|
267
|
+
A function whose name Excel has behaves as in Excel, with its arguments and edges: `MONTH` gives 1 to 12, `WEEKDAY` counts from Sunday by default and takes the types of Excel, `IF`, `IFS`, `SWITCH`, `AND`, `OR` and `IFERROR` read only the arguments they need. The differences:
|
|
268
|
+
|
|
269
|
+
- `DAYOF`, `WEEKOF`, `MONTHOF`, `QUARTEROF`, `YEAROF`, `HOUROF`, `QUARTER`, `ISOYEAR` and `DATEADD` are not in Excel. `DATEADD` takes the units `year`, `quarter`, `month`, `week`, `day`, `hour` and `minute`; a month at its end stays at the end of a shorter month.
|
|
270
|
+
- A day is a text `YYYY-MM-DD` and a moment a `Date`, not a serial number: `DATE(2026, 11, 21)` gives `2026-11-21`, and `DAYS` and the parts read both kinds. A date before 1900 gives `#NUM!`, and a year under 1900 gets 1900 added, as in Excel.
|
|
271
|
+
- The date functions read the clock of a zone (above); Excel has no zone.
|
|
272
|
+
- `#CYCLE!` is not in Excel: a circle that comes with the `cellFormulas` of the owner. Excel stores such a formula and warns; here an entry that makes a circle is refused.
|
|
273
|
+
- **Criteria** of `COUNTIF` and its family are those of Excel: `5`, `">5"`, `"<>done"`, `""` for the empty cells, `"a*"` and `"?"` as wildcards and `~` before one of them; capital and small letters are the same, and a criterion of a number takes a text of that number. A date is no number here, so a day text in a criterion (`">2026-01-31"`) compares with the days of a range, and a number never takes a date. The ranges of one call have the same rows and columns: `SUMIF` and `AVERAGEIF` give `#VALUE!` where Excel would stretch a smaller range of values.
|
|
274
|
+
- **Lookups** give one cell. A result that Excel spills into the cells beside it, such as `XLOOKUP` with results of two columns or `INDEX` with a row or a column 0 of a range of more than one, is `#VALUE!`. A value matches a cell of its own kind only. `MATCH` and `VLOOKUP` with an approximate match, and `XLOOKUP` with the search `2` or `-2`, give what Excel gives on sorted data; Excel searches such data in halves, and on data that is not sorted it can give another cell, where these look at every cell. A lookup of an empty value is `#N/A`.
|
|
275
|
+
- **`VALUE`** reads a text as a formula reads a number: `12.5`, `-3`, `1e3`, with spaces around it. It reads no comma of thousands, no currency, no percent and no date, in any locale: those are `#VALUE!`.
|
|
276
|
+
- **`TEXT`** knows these codes, the same in every locale. A number: `0`, `#`, the decimal point, a comma between the digits (thousands, as in `#,##0.00`) and `%`. A date: `yy`, `yyyy`, `m` to `mmmmm`, `d` to `dddd` (the months and days in English), `h`, `hh`, `m` and `mm` after an hour or before a second (the minutes), `s`, `ss` and `AM/PM`. Both take text in quotes, a character after `\`, a space and the characters `$-+()/:` (and `.` and `,` in a date); `General` gives the plain text. Any other code is `#VALUE!`: no colours, no sections with `;`, no `E+`, no comma at the end. A date with a number code and a number with a date code are `#VALUE!`, because a date is no number here. A half goes away from zero.
|
|
277
|
+
- **`TODAY()` and `NOW()`** hold the moment when they were computed: after an entry, after rows came or went, or at `controller.recalculate()`. Nothing computes them on a timer and a render does not. `TODAY()` is the day in the zone of the formula (`timeZone` of the engine), `NOW()` a `Date`. A test passes a clock: `createFormulaEngine({ now: () => Date.UTC(2026, 10, 22) })`.
|
|
278
|
+
- **Left out:** `FILTER`, `UNIQUE`, `SORT`, `SORTBY`, `SEQUENCE` and `TRANSPOSE` give a list that Excel spills into the cells beside the formula; a cell of the table holds one value and the rows belong to the owner. `SUBTOTAL` skips the rows that a filter hides; a formula reads places of the document and never the view, and the footer, `getTotals` and the selection summary already follow the filter. No other sheets, names or arrays.
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
## What a styled table needs
|
|
282
|
+
|
|
283
|
+
- A formula bar: the address, a text field for the draft, the words of an error in a plain element with `role="status"`.
|
|
284
|
+
- A look for `[data-formula]` (a small mark in a corner), for `[data-formula-error]` (a colour of the alert kind; the `aria-description` as a tooltip if you want one) and for `[data-formula-column]` in a header.
|
|
285
|
+
- A field or a menu item for the formula of a column (`setColumnFormula`, and the `error` of `getColumnFormula`), and a list of functions from `getFormulaFunctions()`.
|
|
286
|
+
- A choice "group by day, week, month, quarter, year" for a date column: it sets a column formula (`=WEEKOF([created], 2)`) and `groupBy`.
|
|
287
|
+
- The row numbers (`rowNumberColumn()`) and `columnLetters`, so a person sees the addresses that a formula names.
|
|
288
|
+
|
|
289
|
+
## Attributes
|
|
290
|
+
|
|
291
|
+
- `data-formulas` on the table.
|
|
292
|
+
- `data-formula` on a cell with a formula of its own.
|
|
293
|
+
- `data-formula-error` (`div0`, `value`, `ref`, `name`, `num`, `na`, `cycle`) with the words of the error as `aria-description`.
|
|
294
|
+
- `data-formula-column` on the header and the cells of a computed column.
|
|
295
|
+
|
|
296
|
+
See the [Formula tiles of the sink](https://ui-sdk-table.fdts.dev/?page=sink&only=formula).
|
|
297
|
+
|
|
298
|
+
## Names
|
|
299
|
+
|
|
300
|
+
- **Value:** `CellFormulas` is `{ columns?: { [columnId]: formula }, cells?: { [rowId]: { [columnId]: formula } } }`, in the stored form: plain data that an app saves with its document. `setFormulas`, `revertFormulas`, `pruneFormulas` and `formulaAt` of the formulas entry are the pure functions behind it.
|
|
301
|
+
- **Controller:** the formula methods throw "This table has no formulas: pass `formulas`." without an engine. `getFormulaSummary(limit?)` gives each text of a column once with its count, so an agent reads 50,000 cells as one line.
|
|
302
|
+
- **`FormulaView`**, the `formula` of the view for the active cell: `rowId`, `columnId`, `address`, `formula`, `text`, `value`, `error`, `ofColumn`.
|
|
303
|
+
- **Attributes:** `data-formulas` on the table; `data-formula` on a cell with a formula of its own; `data-formula-error` (`div0`, `value`, `ref`, `name`, `num`, `na`, `cycle`) with the words of the error as `aria-description`; `data-formula-column` on the header and the cells of a computed column.
|
|
304
|
+
- **Words of a refusal.** `editCell`, `setCellFormula` and `setColumnFormula` throw an `Error` whose `message` is for a developer or an agent: it names the column, the row and the text (`Column "total" refuses "=SUMM(B2)" for row "l2": No function …`). Its `cause` is a text with the words for a person, the words that the editor of the cell shows. A control beside the table shows the `cause`.
|
|
305
|
+
|
|
306
|
+
```ts
|
|
307
|
+
function saveBand(text: string) {
|
|
308
|
+
try {
|
|
309
|
+
controller.setColumnFormula('band', text)
|
|
310
|
+
return ''
|
|
311
|
+
} catch (error) {
|
|
312
|
+
return error instanceof Error && typeof error.cause === 'string' ? error.cause : String(error)
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
- **Own words for one kind of issue.** `messages.formulaIssue` gets the issue as data (`code` and its fields) and decides for every kind; `describeFormulaIssue` of the formulas entry gives the words of the engine for the rest. They reach the editor, the formula bar and the `cause` of a refusal alike:
|
|
318
|
+
|
|
319
|
+
```ts
|
|
320
|
+
const messages = {
|
|
321
|
+
formulaIssue: (issue: FormulaIssue) =>
|
|
322
|
+
issue.code === 'unknownFunction' ? `No function ${issue.name}.` : describeFormulaIssue(issue),
|
|
323
|
+
}
|
|
324
|
+
```
|
|
325
|
+
- **Exports of the formulas entry:** `createFormulaEngine`, `formulaColumn`, `compileRowFormula`, `parseFormula`, `printFormula`, `formulaShows`, `formulaSigns`, `describeFormulaIssue`, `FORMULA_FUNCTIONS`, `setFormulas`, `revertFormulas`, `pruneFormulas`, `formulaAt`, `excelFormulas`, `EXCEL_FUNCTIONS`. Of the export entry: the `formula` option of `toXlsx` and the type `XlsxFormulas`.
|
|
326
|
+
|
|
327
|
+
For shared methods and result types, see [Controller](./reference-controller.md) and [View](./reference-view.md).
|
|
328
|
+
|
|
329
|
+
For props, callbacks and render functions, see the [React API reference](./api-react.md).
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
# The sheet options
|
|
2
|
+
|
|
3
|
+
Turn a table into a data sheet: cells that a person types into, ranges, undo and a fill handle.
|
|
4
|
+
|
|
5
|
+
Use it for data that people change cell by cell, as in a spreadsheet: prices, stock, a budget. A data sheet is the same `Table` with more options. There is no second component.
|
|
6
|
+
|
|
7
|
+
```tsx title="sheet.tsx"
|
|
8
|
+
'use client'
|
|
9
|
+
|
|
10
|
+
import { useEffect, useState } from 'react'
|
|
11
|
+
import { createTableController } from 'ui-sdk-table-react'
|
|
12
|
+
import { Table } from 'ui-sdk-table-react/reference'
|
|
13
|
+
import { applyEdits, type ColumnDef, type TableView } from 'ui-sdk-table-core'
|
|
14
|
+
import { Button } from '@ui-sdk/react/button'
|
|
15
|
+
|
|
16
|
+
type Item = { id: string; name: string; price: number; stock: number }
|
|
17
|
+
|
|
18
|
+
const columns: ColumnDef<Item>[] = [
|
|
19
|
+
{ id: 'name', header: 'Item' },
|
|
20
|
+
{ id: 'price', header: 'Price', format: 'decimal' },
|
|
21
|
+
{ id: 'stock', header: 'Stock', format: 'integer' },
|
|
22
|
+
]
|
|
23
|
+
|
|
24
|
+
const initialRows: Item[] = [
|
|
25
|
+
{ id: 'i1', name: 'Notebook', price: 4.5, stock: 120 },
|
|
26
|
+
{ id: 'i2', name: 'Pencil', price: 0.8, stock: 640 },
|
|
27
|
+
{ id: 'i3', name: 'Eraser', price: 1.2, stock: 310 },
|
|
28
|
+
{ id: 'i4', name: 'Ruler', price: 2.3, stock: 95 },
|
|
29
|
+
]
|
|
30
|
+
|
|
31
|
+
const styles = `
|
|
32
|
+
.demo-sheet-options-sheet td { position: relative; }
|
|
33
|
+
.demo-sheet-options-sheet td[data-selected] { background: var(--picked, light-dark(#dbeafe, #24375b)); }
|
|
34
|
+
.demo-sheet-options-sheet [data-slot='table-fill-handle'] {
|
|
35
|
+
position: absolute;
|
|
36
|
+
inset-block-end: -3px;
|
|
37
|
+
inset-inline-end: -3px;
|
|
38
|
+
width: 8px;
|
|
39
|
+
height: 8px;
|
|
40
|
+
background: Highlight;
|
|
41
|
+
cursor: crosshair;
|
|
42
|
+
touch-action: none;
|
|
43
|
+
z-index: 1;
|
|
44
|
+
}
|
|
45
|
+
`
|
|
46
|
+
|
|
47
|
+
export default function Sheet() {
|
|
48
|
+
const [rows, setRows] = useState<Item[]>(initialRows)
|
|
49
|
+
const [controller] = useState(createTableController)
|
|
50
|
+
const [view, setView] = useState<TableView>()
|
|
51
|
+
useEffect(() => {
|
|
52
|
+
const read = () => setView(controller.getView())
|
|
53
|
+
const stop = controller.subscribe(read)
|
|
54
|
+
read()
|
|
55
|
+
return stop
|
|
56
|
+
}, [controller])
|
|
57
|
+
return (
|
|
58
|
+
<div className="demo-sheet-options-sheet">
|
|
59
|
+
<style>{styles}</style>
|
|
60
|
+
<div>
|
|
61
|
+
<Button disabled={!view?.canUndo} onClick={() => controller.undo()}>
|
|
62
|
+
Undo
|
|
63
|
+
</Button>
|
|
64
|
+
<Button disabled={!view?.canRedo} onClick={() => controller.redo()}>
|
|
65
|
+
Redo
|
|
66
|
+
</Button>
|
|
67
|
+
</div>
|
|
68
|
+
<Table
|
|
69
|
+
rows={rows}
|
|
70
|
+
columns={columns}
|
|
71
|
+
aria-label="Stock of the shop"
|
|
72
|
+
controller={controller}
|
|
73
|
+
sheet
|
|
74
|
+
onCellEdit={(edits) => setRows((current) => applyEdits(current, edits))}
|
|
75
|
+
/>
|
|
76
|
+
</div>
|
|
77
|
+
)
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Press a price and type 5: the editor opens with that character. Press Enter to save and move down. Select two cells with Shift and an arrow, press Delete, then Undo.
|
|
82
|
+
|
|
83
|
+
## Turn it on
|
|
84
|
+
|
|
85
|
+
- `sheet` is a preset: `editable`, `cellSelection`, `history` and `fillHandle` are on unless one is set to false.
|
|
86
|
+
- Each of them also works alone, so enabling `editable` and `history` gives an editable table with undo.
|
|
87
|
+
- Without these options, a table behaves as before. The keys of a sheet do nothing in a plain table.
|
|
88
|
+
- The table has `data-sheet` with the option.
|
|
89
|
+
- The owner applies every change. Handle the cell edit report and put the edits into your rows, for example with `applyEdits`. See [Editing](./cell-editing.md).
|
|
90
|
+
|
|
91
|
+
## Keys
|
|
92
|
+
|
|
93
|
+
| Key | With `sheet` |
|
|
94
|
+
| --- | --- |
|
|
95
|
+
| A character on a cell | Opens the editor with that character (`mode` is `replace`) |
|
|
96
|
+
| Enter in the editor | Saves and moves down, with Shift up. Inside a range it walks the range column by column |
|
|
97
|
+
| Tab in the editor | Saves and moves to the next cell. Inside a range it walks the range row by row |
|
|
98
|
+
| An arrow in the editor | After a character: saves and moves one cell (reason `list-navigation`). After F2, Enter or a double press: moves the caret. F2 in the editor turns the first into the second |
|
|
99
|
+
| Tab on a cell | Leaves the table. With a range of more than one cell it walks the range, and Escape drops the range |
|
|
100
|
+
| Delete, Backspace on a cell | Empties the selected cells (reason `clear`) |
|
|
101
|
+
| Control or Command with X | Cuts: the text of a copy, then a clear (reason `cut`) |
|
|
102
|
+
| Control or Command with V | Pastes. A block repeats over a range that it fits a whole number of times |
|
|
103
|
+
| Control or Command with Z; with Y or Shift+Z | Undo and redo, with `history` |
|
|
104
|
+
| Control or Command with D; with R | Fills the selected cells down from their first row; forward from their first column, with `fillHandle`. With one line selected the keys stay the browser's |
|
|
105
|
+
| Control or Command with B; with I | Makes the selected cells bold; italic. On, unless every selected cell has it, and then off |
|
|
106
|
+
|
|
107
|
+
Delete and Backspace inside an open editor remove a character. A key in a control inside a cell belongs to that control.
|
|
108
|
+
|
|
109
|
+
## Empty a cell
|
|
110
|
+
|
|
111
|
+
`emptyValue(row, column)` is what a clear writes: the `parse` of the column for an empty text, else `null` for a number or a date, `false` for a boolean and an empty text for the rest. It goes through the schema of the column, and one refusal stops the whole clear. The table then says why and changes nothing.
|
|
112
|
+
|
|
113
|
+
## The function of a total at run time
|
|
114
|
+
|
|
115
|
+
A person can change the function of a total, for example from a sum to an average.
|
|
116
|
+
|
|
117
|
+
```tsx title="totals.tsx"
|
|
118
|
+
'use client'
|
|
119
|
+
|
|
120
|
+
import { useState } from 'react'
|
|
121
|
+
import { Table } from 'ui-sdk-table-react/reference'
|
|
122
|
+
import type { ColumnAggregates, ColumnDef, AggregateName } from 'ui-sdk-table-core'
|
|
123
|
+
import { Button } from '@ui-sdk/react/button'
|
|
124
|
+
|
|
125
|
+
type Trip = { id: string; city: string; nights: number; cost: number }
|
|
126
|
+
|
|
127
|
+
const trips: Trip[] = [
|
|
128
|
+
{ id: 't1', city: 'Lisbon', nights: 3, cost: 420 },
|
|
129
|
+
{ id: 't2', city: 'Vienna', nights: 2, cost: 380 },
|
|
130
|
+
{ id: 't3', city: 'Krakow', nights: 4, cost: 310 },
|
|
131
|
+
]
|
|
132
|
+
|
|
133
|
+
const columns: ColumnDef<Trip>[] = [
|
|
134
|
+
{ id: 'city', header: 'City' },
|
|
135
|
+
{ id: 'nights', header: 'Nights', format: 'integer', aggregate: 'sum' },
|
|
136
|
+
{ id: 'cost', header: 'Cost', format: 'integer', aggregate: 'sum' },
|
|
137
|
+
]
|
|
138
|
+
|
|
139
|
+
const initialAggregates: ColumnAggregates = {}
|
|
140
|
+
|
|
141
|
+
const choices: AggregateName[] = ['sum', 'mean', 'max']
|
|
142
|
+
|
|
143
|
+
export default function Totals() {
|
|
144
|
+
const [aggregates, setAggregates] = useState<ColumnAggregates>(initialAggregates)
|
|
145
|
+
|
|
146
|
+
return (
|
|
147
|
+
<Table
|
|
148
|
+
rows={trips}
|
|
149
|
+
columns={columns}
|
|
150
|
+
aria-label="Trips of the year"
|
|
151
|
+
columnAggregates={aggregates}
|
|
152
|
+
onColumnAggregatesChange={setAggregates}
|
|
153
|
+
slots={{
|
|
154
|
+
foot: ({ column, text, aggregate, setAggregate }) =>
|
|
155
|
+
aggregate && (
|
|
156
|
+
<>
|
|
157
|
+
{text}{' '}
|
|
158
|
+
{choices.map((name) => (
|
|
159
|
+
<Button
|
|
160
|
+
key={name}
|
|
161
|
+
aria-label={`${name} of ${column.header}`}
|
|
162
|
+
aria-pressed={aggregate === name}
|
|
163
|
+
onClick={() => setAggregate(name)}
|
|
164
|
+
>
|
|
165
|
+
{name}
|
|
166
|
+
</Button>
|
|
167
|
+
))}
|
|
168
|
+
</>
|
|
169
|
+
),
|
|
170
|
+
}}
|
|
171
|
+
/>
|
|
172
|
+
)
|
|
173
|
+
}
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
Press mean under Nights: the footer shows the average. Press sum to go back.
|
|
177
|
+
|
|
178
|
+
- `columnAggregates` is a record by column id: `'sum' | 'mean' | 'min' | 'max' | 'count' | 'uniqueCount' | 'first'`, or `null` for no total. Pass `columnAggregates` to control it, or `defaultColumnAggregates` to set its initial value.
|
|
179
|
+
- An entry wins over the `aggregate` of the column definition. A column without an entry keeps its definition.
|
|
180
|
+
- The footer, the group rows, `getTotals` and an export follow. The footer row goes away with its last total.
|
|
181
|
+
- `setAggregate(name | null | undefined, event?)` in custom `foot` content and `controller.setColumnAggregate(columnId, name)` change it. `undefined` gives the definition back.
|
|
182
|
+
- `foot` and `group-total` get `aggregate`: a name, `custom` for a function of the column, or `undefined`.
|
|
183
|
+
- A footer cell has `data-aggregate`. A cell whose function a person chose has the name "Average: 12.40" (messages `aggregateLabel`, `totalLabel`).
|
|
184
|
+
- A change of the function is no step of the history.
|
|
185
|
+
|
|
186
|
+
## Your own editor
|
|
187
|
+
|
|
188
|
+
`editor` and `edit-{column id}` get `mode` (`replace` or `edit`) and `typed`, the character that opened the editor. `save(value, event)` with an Enter key moves down. `header` gets `selectColumn(event?)`, for a control that selects the cells of the column, with Shift from the active cell on.
|
|
189
|
+
|
|
190
|
+
## A number keyboard on a phone
|
|
191
|
+
|
|
192
|
+
A column with `numberKeyboard: true` gives the field of its editor `inputmode="decimal"`. Custom editors (`editor` or `edit-{id}` in the reference table) receive the same answer as `inputMode` (`'decimal'` or `undefined`).
|
|
193
|
+
|
|
194
|
+
The table holds the attribute back where the number keyboard has no key that a person needs:
|
|
195
|
+
|
|
196
|
+
- in a cell that can hold a formula: it takes a text with `=`. `allowFormula: false` gives the keyboard back;
|
|
197
|
+
- in a cell whose format is set and is no number format (`integer`, `decimal`, `number`, `currency`, `percentage`), such as a cell that a person gave a date format.
|
|
198
|
+
|
|
199
|
+
The field stays a text field and never `type="number"`: such a field refuses a decimal comma in some locales, a percent sign and a pasted text.
|
|
200
|
+
|
|
201
|
+
## The view
|
|
202
|
+
|
|
203
|
+
`getView()` returns `canUndo`, `canRedo`, `activeCell` (`{ rowId, columnId }` or `null`), `cellSelection` (`{ from, to, rows, columns }`, by id, data rows only) and `columnAggregates`.
|
|
204
|
+
|
|
205
|
+
See the [Sheet tiles of the sink](https://ui-sdk-table.fdts.dev/?page=sink&only=sheet).
|
|
206
|
+
|
|
207
|
+
## Names
|
|
208
|
+
|
|
209
|
+
- **Attributes:** `data-sheet`, `data-aggregate`.
|
|
210
|
+
- **Exports:** `emptyValue`, `aggregateName`, and the types `ColumnAggregates`, `AggregateName`, `TableStepReason`.
|
|
211
|
+
|
|
212
|
+
For shared methods and result types, see [Controller](./reference-controller.md) and [View](./reference-view.md).
|
|
213
|
+
|
|
214
|
+
For props, callbacks and render functions, see the [React API reference](./api-react.md).
|
package/docs/skills.md
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Skills
|
|
2
|
+
|
|
3
|
+
Use the `ui-sdk-table` skill to help a coding agent build and test an interactive table in React, Vue, Svelte, Solid or Web Components.
|
|
4
|
+
|
|
5
|
+
The table skill helps the agent choose parts from your app’s adapter. The separate `ui-sdk` skill helps it build the controls around the table, such as a search field or a column menu. Neither skill installs a table in your app. For that, see [Installation](./installation.md). To let an agent **operate a running table** instead of writing its code, follow UI SDK’s [Connect an agent](https://ui-sdk.dev/docs/agents/connect-an-agent) and the [table actions example](https://ui-sdk-table.fdts.dev/docs/agents.md#connect-an-agent).
|
|
6
|
+
|
|
7
|
+
## Install the skill
|
|
8
|
+
|
|
9
|
+
From the app’s project directory, install the table skill for your coding agent:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npx skills@latest add FallDownTheSystem/ui-sdk-table --skill ui-sdk-table
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
The Skills CLI discovers `skills/ui-sdk-table/SKILL.md` in the table repository. To see the available skills without installing one, use `npx skills@latest add FallDownTheSystem/ui-sdk-table --list`. If you need the skill from a particular checkout rather than the default branch, use that checkout’s local path in place of `FallDownTheSystem/ui-sdk-table`.
|
|
16
|
+
|
|
17
|
+
If your app uses UI SDK controls around the table, also install the `ui-sdk` skill:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npx skills@latest add vercel-labs/ui --skill ui-sdk
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
If your agent doesn’t support skills, point it at [the table skill](https://github.com/FallDownTheSystem/ui-sdk-table/blob/master/skills/ui-sdk-table/SKILL.md) and the `references/` directory beside it. The table skill lives in the repository, not in the npm adapter. Each adapter ships its own guide at `node_modules/ui-sdk-table-<adapter>/docs/llms.txt`; replace `<adapter>` with `react`, `vue`, `svelte`, `solid` or `web`. UI SDK also ships its version-matched skill at `node_modules/@ui-sdk/core/skills/ui-sdk/SKILL.md`.
|
|
24
|
+
|
|
25
|
+
## Use the skill
|
|
26
|
+
|
|
27
|
+
Ask for a component your project can reuse. Describe what belongs to the component and what each page supplies. For example:
|
|
28
|
+
|
|
29
|
+
```text
|
|
30
|
+
Use ui-sdk-table to build a reusable DataTable for this project. Check our shared components first. If we already have a table component, extend it instead of adding another.
|
|
31
|
+
|
|
32
|
+
Use the native table parts for our framework and follow our design system. Let each page supply its rows, column definitions and accessible table name. Give pages a way to customize a cell, such as a link in a name column. Keep sorting and pagination optional.
|
|
33
|
+
|
|
34
|
+
Show how to use the component with two different row types. Test that both uses work without changes to DataTable.
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
The skill directs the agent to the guide for the project’s framework. The [reference implementation](./reference-implementation.md#source-code) shows one way to compose the parts; your project owns its component’s public API and appearance. For an HTML page with no bundler or installed packages, ask for the standalone parts in the [Web Components guide](https://ui-sdk-table.fdts.dev/docs/web-components.md) instead.
|
|
38
|
+
|
|
39
|
+
## Report a bug
|
|
40
|
+
|
|
41
|
+
If the component fails, ask the agent to reproduce the problem with sample rows and no private app code. Have it check existing issues and show you the report before it opens one. Report table or adapter bugs in [ui-sdk-table issues](https://github.com/FallDownTheSystem/ui-sdk-table/issues). If the same failure occurs in a UI SDK component without the table, use [UI SDK issues](https://github.com/vercel-labs/ui/issues) instead.
|