@tristan2828/ui-foundation 3.6.0 → 3.7.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.
@@ -103,7 +103,23 @@ is a filled-in example while the Widgets demo is still here).
103
103
  controls named by position ("Item 2 text"), a per-item `FieldError`
104
104
  (a server 422 at `["body", "checklist", 2, "text"]` arrives as
105
105
  `fieldErrors["checklist.2.text"]` and binds to that row), and a summary
106
- in the table, never the items):
106
+ in the table, never the items — and a `computed` field copies
107
+ Progress (`checklistState`): `readOnly` in `openapi.yaml` and absent
108
+ from `<Entity>Create`/`<Entity>Update`, one SQL expression in the
109
+ router that the filter and sort use (correlated `EXISTS`, or a scalar
110
+ subquery for a count, so they hold across pages), a Python mirror on
111
+ the model for the value each row reads back with, a test that the two
112
+ agree for every value, the mocks recomputing it on every write and
113
+ ignoring any client-sent value, a read-only column and a filter, and
114
+ nothing on the form):
115
+
116
+ **Keep column definitions stable.** Build them once
117
+ (`useMemo(() => build<Entity>Columns(), [])`) from nothing that loads
118
+ later. TanStack's `flexRender` treats each column's `cell` as a
119
+ component, so rebuilt columns remount every cell: focus is lost and the
120
+ table flickers when, say, reference names arrive after the rows. Data
121
+ that arrives later reaches the cells through context, as
122
+ `category-names.tsx` does for category names.
107
123
  - `src/routes/widgets/use-widgets.ts`, `use-categories.ts` →
108
124
  `src/routes/<entity>/use-<entity>.ts` (TanStack Query hooks over the
109
125
  new gateway module)
@@ -33,7 +33,12 @@ One or two sentences: what one record is, and who uses the screens.
33
33
  (to another entity — name it; a searchable combobox), `multi reference`
34
34
  (to any number of records of another entity — name it; chips with a
35
35
  searchable dropdown, names as badges in the table, an any-of filter;
36
- the other entity's list endpoint must also accept `ids`).
36
+ the other entity's list endpoint must also accept `ids`),
37
+ `computed` (read-only: the server works it out from other data on
38
+ every read and never stores it — give its rule, and if it's a choice,
39
+ its values in sort order; a read-only column, a filter and a sort the
40
+ server evaluates, never on the form). A count of related records is a
41
+ `computed` integer.
37
42
  - *Close variants* (built by a small, stated change to the nearest
38
43
  pattern): `integer` (from decimal), `url` (from email — a format
39
44
  check), `date` (from date-time — no time part).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tristan2828/ui-foundation",
3
- "version": "3.6.0",
3
+ "version": "3.7.0",
4
4
  "description": "Shared UI foundation for contract-first, database-backed React apps: shadcn primitives, DataTable/EntityForm composites, auth, the gateway error seam, design tokens, lint rules and the AI playbook.",
5
5
  "license": "MIT",
6
6
  "repository": {