You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/docs/references/data/field.mdx
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -222,7 +222,7 @@ const result = AddressSchema.parse(data);
222
222
|**value**|`string`| ✅ | Stored value (lowercase machine identifier) |
223
223
|**color**|`string`| optional | Color code for badges/charts |
224
224
|**default**|`boolean`| optional | Is default option |
225
-
|**visibleWhen**|`string \| { dialect: Enum<'cel' \| 'cron' \| 'template'>; source?: string; ast?: any; meta?: object }`| optional | Per-option visibility predicate (CEL) — option is offered only when TRUE (else omitted). Same env as field visibleWhen (record + current_user). e.g. P`record.country == 'cn'` or P`'admin' in current_user.positions`|
225
+
|**visibleWhen**|`string \| { dialect: Enum<'cel' \| 'cron' \| 'template'>; source?: string; ast?: any; meta?: object }`| optional | Per-option visibility predicate (CEL) — option is offered only when TRUE (else omitted). Env: the live `record` plus the host predicate scope, which binds `current_user` — wider than field-level visibleWhen, which has no `current_user`. e.g. P`record.country == 'cn'` or P`'admin' in current_user.positions`|
|**dependsOn**|`string`| optional | Parent field name for cascading |
162
-
|**visibleWhen**|`string \| { dialect: Enum<'cel' \| 'cron' \| 'template'>; source?: string; ast?: any; meta?: object }`| optional | Visibility predicate (CEL) — field shown only when TRUE. Root: `record`+`current_user` (runtime forms) or `data`(metadata forms). e.g. P`record.priority == 'urgent'`|
162
+
|**visibleWhen**|`string \| { dialect: Enum<'cel' \| 'cron' \| 'template'>; source?: string; ast?: any; meta?: object }`| optional | Visibility predicate (CEL) — field shown only when TRUE. Root: `record` (+ `previous`, `parent`) in runtime forms, or `data`in metadata forms. No `current_user` at field level — it is unbound here and the predicate would fault open (per-option `visibleWhen` is the surface that binds it). e.g. P`record.priority == 'urgent'`|
|**visibleWhen**|`string \| { dialect: Enum<'cel' \| 'cron' \| 'template'>; source?: string; ast?: any; meta?: object }`| optional | Visibility predicate (CEL) — section shown only when TRUE. Root: `record` (+ `previous`, `parent`) in runtime forms, or `data`in metadata forms. No `current_user` at section level — it is unbound here and the predicate would fault open. |
182
182
|**visibleOn**|`string \| { dialect: Enum<'cel' \| 'cron' \| 'template'>; source?: string; ast?: any; meta?: object }`| optional |[DEPRECATED → `visibleWhen`] Visibility predicate (CEL). Hides the whole section when false. Normalized to `visibleWhen` at parse. |
* rule-validator evaluates the picked value's `visibleWhen`) — hiding it in the
134
141
* dropdown alone is bypassable.
135
142
*/
136
-
visibleWhen: ExpressionInputSchema.optional().describe("Per-option visibility predicate (CEL) — option is offered only when TRUE (else omitted). Same env as field visibleWhen (record + current_user). e.g. P`record.country == 'cn'` or P`'admin' in current_user.positions`"),
143
+
visibleWhen: ExpressionInputSchema.optional().describe("Per-option visibility predicate (CEL) — option is offered only when TRUE (else omitted). Env: the live `record` plus the host predicate scope, which binds `current_user` — wider than field-level visibleWhen, which has no `current_user`. e.g. P`record.country == 'cn'` or P`'admin' in current_user.positions`"),
* Conditional-visibility predicate (CEL) — the field is shown only when TRUE
1412
1412
* (ADR-0089, canonical `*When` name). Binding root depends on the surface:
1413
-
* runtime record forms bind `record` + `current_user`; metadata-editing forms
1413
+
* runtime record forms bind `record` (plus `previous`, the saved record, and
1414
+
* `parent` for master-detail line items); metadata-editing forms
1414
1415
* (`*.form.ts`) bind the row under edit as `data`.
1416
+
*
1417
+
* ⚠️ **No `current_user` here** (#6146). Field-level rules are evaluated by
1418
+
* `evalFieldPredicate` / `resolveFieldRuleState` (`@object-ui/core`), which
1419
+
* binds `record` + `previous` + an `extra` scope and nothing else — the
1420
+
* autocomplete pins the same set (objectui#1582). A predicate referencing
1421
+
* `current_user` is an UNBOUND identifier: the evaluation faults and falls
1422
+
* back, and visibility's fallback is `true`, so the field a `current_user`
1423
+
* test was meant to hide stays **permanently visible**. `current_user` IS
1424
+
* bound for **per-option** `visibleWhen` (a different evaluator —
1425
+
* `resolveCascadingOptions` against the host's predicate scope, ADR-0068 /
1426
+
* objectui#2284); that is the only `*When` surface where it resolves.
1415
1427
*/
1416
-
visibleWhen: ExpressionInputSchema.optional().describe("Visibility predicate (CEL) — field shown only when TRUE. Root: `record`+`current_user` (runtime forms) or `data` (metadata forms). e.g. P`record.priority == 'urgent'`"),
1428
+
visibleWhen: ExpressionInputSchema.optional().describe("Visibility predicate (CEL) — field shown only when TRUE. Root: `record` (+ `previous`, `parent`) in runtime forms, or `data` in metadata forms. No `current_user` at field level — it is unbound here and the predicate would fault open (per-option `visibleWhen` is the surface that binds it). e.g. P`record.priority == 'urgent'`"),
1417
1429
/** @deprecated ADR-0089 — use `visibleWhen`. Accepted and normalized to `visibleWhen` at parse. */
1418
1430
visibleOn: ExpressionInputSchema.optional().describe('[DEPRECATED → `visibleWhen`] Visibility predicate (CEL). Normalized to `visibleWhen` at parse.'),
1419
1431
disclosure: z.enum(['inline','popover']).optional().describe('Composite rendering: inline bordered box (default) or a summary line + gear popover (progressive disclosure).'),
* Conditional-visibility predicate (CEL) — the whole section is shown only
1506
1518
* when TRUE (ADR-0089, canonical `*When` name). Same per-layer binding root as
1507
-
* {@link FormFieldSchema.visibleWhen}: `record`+`current_user` in runtime
1508
-
* forms, `data` in metadata-editing forms.
1519
+
* {@link FormFieldSchema.visibleWhen}: `record` (+ `previous`, `parent`) in
1520
+
* runtime forms, `data` in metadata-editing forms — and, as there, **no
1521
+
* `current_user`**: it is unbound at this level, so such a predicate faults
1522
+
* and falls back to visible (#6146).
1509
1523
*/
1510
-
visibleWhen: ExpressionInputSchema.optional().describe('Visibility predicate (CEL) — section shown only when TRUE. Root: `record`+`current_user` (runtime forms) or `data` (metadata forms).'),
1524
+
visibleWhen: ExpressionInputSchema.optional().describe('Visibility predicate (CEL) — section shown only when TRUE. Root: `record` (+ `previous`, `parent`) in runtime forms, or `data` in metadata forms. No `current_user` at section level — it is unbound here and the predicate would fault open.'),
1511
1525
/** @deprecated ADR-0089 — use `visibleWhen`. Accepted and normalized to `visibleWhen` at parse. */
1512
1526
visibleOn: ExpressionInputSchema.optional().describe('[DEPRECATED → `visibleWhen`] Visibility predicate (CEL). Hides the whole section when false. Normalized to `visibleWhen` at parse.'),
0 commit comments