@object-ui/plugin-form 15.0.0 → 16.1.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 CHANGED
@@ -1,5 +1,169 @@
1
1
  # @object-ui/plugin-form
2
2
 
3
+ ## 16.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 62b9ab5: feat(data): unify master-detail saves behind `DataSource.batchTransaction`, isolate the non-atomic fallback in the adapter (#2679)
8
+
9
+ Master-detail saves (`MasterDetailForm`, `LineItemsPanel`) now always persist
10
+ through `dataSource.batchTransaction(operations)` — one ordered cross-object
11
+ operation list, with `{ $ref: <op index> }` linking a child to a parent created
12
+ in the same batch. The form no longer contains any client-side orchestration or
13
+ best-effort compensation-delete; that atomicity anti-pattern is gone from the UI
14
+ layer (framework #1604 / framework ADR-0034 item 4).
15
+
16
+ - **`@object-ui/types`** — `batchTransaction?` is now a first-class (optional)
17
+ method on the `DataSource` contract, typed via `BatchTransactionOperation` /
18
+ `BatchRef`. Replaces the previous `(dataSource as any).batchTransaction`
19
+ method-sniffing.
20
+ - **`@object-ui/core`** — new `emulateBatchTransaction(dataSource, operations)`
21
+ (sequential writes, `$ref` resolution, best-effort reverse-order compensation)
22
+ and `runBatchTransaction(dataSource, operations)` (prefers the adapter's method,
23
+ emulates otherwise). `ApiDataSource` / `ValueDataSource` implement
24
+ `batchTransaction` via the emulation.
25
+ - **`@object-ui/data-objectstack`** — `ObjectStackAdapter.batchTransaction` uses
26
+ the server's atomic `POST /api/v1/batch`, prefers the typed
27
+ `client.data.batchTransaction` SDK method when the installed client exposes it,
28
+ and degrades to the client-side emulation ONLY when the endpoint is missing
29
+ (404/405) or the runtime can't do transactions (501). Real errors (400/401/403/
30
+ 409/500) still surface. This is the isolated, tested home of the non-atomic
31
+ fallback.
32
+ - **`@object-ui/plugin-form`** — removed `applyDetail` / `createMany` /
33
+ `ApplyDetailResult` from `masterDetailTx.ts`; `MasterDetailForm` and
34
+ `LineItemsPanel` build ops and call `runBatchTransaction`. `LineItemsPanel`
35
+ saves are now atomic on a capable backend, with the rollup folded into the same
36
+ batch.
37
+
38
+ No behavior change on a current ObjectStack backend (it has `/api/v1/batch`);
39
+ older/limited backends keep a working — now clearly non-atomic — save path.
40
+
41
+ ### Patch Changes
42
+
43
+ - 7cf4051: chore(deps): align every `@objectstack/*` dependency to `^16.0.0-rc.0`
44
+
45
+ Bumps `@objectstack/spec` / `client` / `formula` / `lint` from `^15.1.1` to the
46
+ `16.0.0-rc.0` pre-release across the workspace (root + `apps/console` +
47
+ `apps/site` + all consuming packages). ObjectUI's own packages are already on
48
+ major 16, so this closes the 15↔16 skew between ObjectUI and the `@objectstack`
49
+ contract libraries (which publish in lockstep with `spec`).
50
+
51
+ This is a dependency alignment, not a behavioral migration: the full workspace
52
+ build (43/43) and the `@objectstack`-consuming package test suites
53
+ (`core` / `app-shell` / `data-objectstack` / `plugin-form` / `types`) are green
54
+ against `16.0.0-rc.0` with no source changes required.
55
+
56
+ Practical effect: `@objectstack/client@16.0.0-rc.0` now ships
57
+ `data.batchTransaction` (framework #3271), so `ObjectStackAdapter`'s feature
58
+ detect (`typeof client.data.batchTransaction === 'function'`) routes
59
+ master-detail cross-object saves through the typed SDK method instead of the
60
+ raw `fetch('/api/v1/batch')` fallback — realizing the "verify SDK path" half of
61
+ #2694. The raw-fetch branch stays as a defensive fallback (removal tracked in
62
+ #2694).
63
+
64
+ - 0a3710b: **Finish the `managedBy` / `userActions` de-dup — one parser for the override shape (completes objectui#2712, framework#3343).** #2712 consolidated the bucket _union_ + affordance _set_ mirrors but left four surfaces still parsing the `userActions.{create,edit,delete}` override shape by hand. They now all route through the shared `@object-ui/core` policy, so no package re-implements the boolean / #2614-object-form parse locally.
65
+
66
+ - **`@object-ui/core`** promotes the internal `normalizeOverride` to the exported **`normalizeUserAction(v, base)`** (the one parser) and adds **`userActionPredicates(v)`** for per-record CEL predicate extraction.
67
+ - **`app-shell/utils/managedByEmptyState.ts`** — the writable-`system` create check and its local `EmptyStateUserActions` interface are replaced by `resolveCrudAffordances({ managedBy, userActions }).create`.
68
+ - **`plugin-grid/rowCrudAffordances.ts`** — the local `isOptedOut` / `predicatesOf` helpers (and duplicated `RowCrudUserAction` / `RowCrudPredicates` types) fold into `normalizeUserAction`; the historical type names stay re-exported for compat.
69
+ - **`plugin-detail/RelatedList.tsx`** — its inline `predicatesOf` fold into `userActionPredicates`.
70
+ - **`plugin-form/ObjectForm.tsx`** — the hand-rolled `managedBy !== 'platform'` blanket lock + `userActions` unlock is replaced by the resolved affordance for the current mode (`edit` / `create`), the **same** `resolveCrudAffordances` contract the detail (`isObjectInlineEditable`) and grid surfaces use.
71
+
72
+ Behavior-preserving for `platform` / `system` / `append-only` / `better-auth`, with one deliberate alignment: an admin-editable **`config`**-bucket object (e.g. `sys_webhook`, `sys_permission_set`) is now editable in `ObjectForm` — it was previously over-locked as "non-`platform`", while detail/grid already treated it as editable (`config` resolves `edit: true`). New unit coverage for the shared parser and the config / create-mode form gate; all existing affordance/edit-gate tests stay green.
73
+
74
+ - Updated dependencies [0318118]
75
+ - Updated dependencies [1c8935a]
76
+ - Updated dependencies [af1b0db]
77
+ - Updated dependencies [8b8b744]
78
+ - Updated dependencies [7cf4051]
79
+ - Updated dependencies [803558e]
80
+ - Updated dependencies [aefcf39]
81
+ - Updated dependencies [2e7d7f0]
82
+ - Updated dependencies [ef14f69]
83
+ - Updated dependencies [94d4876]
84
+ - Updated dependencies [1100a8b]
85
+ - Updated dependencies [7abe4cd]
86
+ - Updated dependencies [69fa5d1]
87
+ - Updated dependencies [549c67d]
88
+ - Updated dependencies [ebe6494]
89
+ - Updated dependencies [2b17339]
90
+ - Updated dependencies [31b77d4]
91
+ - Updated dependencies [6d4fbe6]
92
+ - Updated dependencies [0a3710b]
93
+ - Updated dependencies [f80aaf2]
94
+ - Updated dependencies [62b9ab5]
95
+ - Updated dependencies [14cb729]
96
+ - Updated dependencies [1629313]
97
+ - Updated dependencies [29c6040]
98
+ - Updated dependencies [faebac3]
99
+ - Updated dependencies [2331ac9]
100
+ - Updated dependencies [199fa83]
101
+ - Updated dependencies [eee4ded]
102
+ - Updated dependencies [3b2e4d9]
103
+ - @object-ui/fields@16.1.0
104
+ - @object-ui/i18n@16.1.0
105
+ - @object-ui/core@16.1.0
106
+ - @object-ui/types@16.1.0
107
+ - @object-ui/react@16.1.0
108
+ - @object-ui/components@16.1.0
109
+ - @object-ui/permissions@16.1.0
110
+
111
+ ## 16.0.0
112
+
113
+ ### Minor Changes
114
+
115
+ - 9d4a429: fix(form+detail): keep single-file children as inline grids; drop non-spec `attachment` handling
116
+
117
+ Two follow-ups to the upload-in-grid work (objectui#2360):
118
+
119
+ - **#2654** — Now that `file`/`image`/`avatar` fields render a compact upload
120
+ cell in the line-item grid, a child object with a _single_ such field no
121
+ longer flips the smart `inlineEdit` default to a per-row form. `resolveInlineMode`
122
+ splits the old `FORM_ONLY_TYPES`: truly form-only types (textarea / richtext /
123
+ html / markdown / json / location / address) still tip to `form` on their own,
124
+ while file-family types only tip when several rich fields pile up
125
+ (`RICH_FIELD_FORM_THRESHOLD`, default 2). An explicit `inlineEdit` always wins.
126
+
127
+ - **#2655** — `attachment` is not a `@objectstack/spec` field type (the spec
128
+ media types are file/image/avatar/video/audio), so the renderer no longer
129
+ models it: removed from `fieldTypeToColumnType`, the inline-mode heuristic, and
130
+ `RelatedList`'s auto-column `SKIP_TYPES`. Contract-first cleanup — the renderer
131
+ stops fossilizing a phantom type (AGENTS.md #0.1).
132
+
133
+ ### Patch Changes
134
+
135
+ - 5534535: feat(grid): built-in row Edit/Delete honor per-record CEL predicates (#2614)
136
+
137
+ The object's `userActions.edit` / `userActions.delete` now also accept an
138
+ object form `{ enabled?, visibleWhen?, disabledWhen? }`. The predicates are
139
+ evaluated per row on the canonical CEL engine (`useRowPredicate`, the same
140
+ machinery custom row actions use): `visibleWhen` false → the built-in
141
+ Edit/Delete item is not rendered for that row (fail-closed); `disabledWhen`
142
+ true → rendered disabled (fail-soft). Wired through ObjectGrid's
143
+ RowActionMenu and the data-table's row overflow menu (the related-list
144
+ path), with the app-shell `crudAffordances` mirror kept in lockstep.
145
+ Omitting the predicates (or using plain booleans) keeps today's behavior
146
+ bit-for-bit; declared predicates evaluate only when a row's menu opens, so
147
+ grid rendering cost is unchanged.
148
+
149
+ - Updated dependencies [d3e19ed]
150
+ - Updated dependencies [59d4fa9]
151
+ - Updated dependencies [4c7c47f]
152
+ - Updated dependencies [210806a]
153
+ - Updated dependencies [b4ef588]
154
+ - Updated dependencies [ca0f5f0]
155
+ - Updated dependencies [5534535]
156
+ - Updated dependencies [9b8f978]
157
+ - Updated dependencies [195a651]
158
+ - Updated dependencies [33b4995]
159
+ - @object-ui/react@16.0.0
160
+ - @object-ui/components@16.0.0
161
+ - @object-ui/types@16.0.0
162
+ - @object-ui/i18n@16.0.0
163
+ - @object-ui/fields@16.0.0
164
+ - @object-ui/core@16.0.0
165
+ - @object-ui/permissions@16.0.0
166
+
3
167
  ## 15.0.0
4
168
 
5
169
  ### Patch Changes
@@ -60,12 +60,17 @@ export declare function deriveFormFields(childSchema: ObjectSchemaLike | undefin
60
60
  export type InlineMode = 'grid' | 'form';
61
61
  /** Above this many editable business fields, the grid gets cramped → `form`. */
62
62
  export declare const SMART_FORM_FIELD_THRESHOLD = 8;
63
+ /** When a child has at least this many rich fields (form-only + grid-capable
64
+ * file-family combined), the row is too busy for a grid → `form`. Set to 2 so a
65
+ * single file/image column stays a grid but a pile of them prefers the form. */
66
+ export declare const RICH_FIELD_FORM_THRESHOLD = 2;
63
67
  /**
64
68
  * Resolve the inline-edit form factor for a child collection.
65
69
  * - explicit `'grid'` / `'form'` win;
66
70
  * - otherwise (`true` / undefined) pick by the child's shape: a `form` when it
67
- * has rich/form-only fields or more than {@link SMART_FORM_FIELD_THRESHOLD}
68
- * editable business fields, else a `grid`.
71
+ * has a truly form-only field, several rich fields
72
+ * ({@link RICH_FIELD_FORM_THRESHOLD}), or more than
73
+ * {@link SMART_FORM_FIELD_THRESHOLD} editable business fields; else a `grid`.
69
74
  */
70
75
  export declare function resolveInlineMode(childSchema: ObjectSchemaLike | undefined, inlineEdit: boolean | InlineMode | undefined, opts?: {
71
76
  relationshipField?: string;