Skip to content

Commit be1f07c

Browse files
committed
docs(showcase): demo per-record row Edit/Delete CEL gating on Invoice (objectui#2614)
A PAID invoice's fields already freeze via readonlyWhen; the built-in row actions now follow the same truth: Edit renders DISABLED on paid rows (disabledWhen), Delete is HIDDEN outright (visibleWhen). Draft and sent invoices keep the untouched menu. Browser-verified against the objectui HMR console: paid row menu = greyed Edit only; sent row menu = enabled Edit + Delete. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HnCZhYpQjRyg2E44RHBiNE
1 parent 08378ac commit be1f07c

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

examples/app-showcase/src/data/objects/invoice.object.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,20 @@ export const Invoice = ObjectSchema.create({
4646
icon: 'receipt',
4747
description: 'A customer invoice entered together with its line items.',
4848

49+
// Per-record row-action gating (objectui#2614) — a PAID invoice is frozen:
50+
// its fields already lock via `readonlyWhen: record.status == 'paid'` below,
51+
// and here the built-in row buttons follow the same truth instead of
52+
// advertising an edit the record will refuse. The two flags demonstrate the
53+
// two semantics: Edit stays visible but DISABLED on paid rows (the user sees
54+
// the affordance exists and is off), while Delete is HIDDEN outright (a paid
55+
// invoice is an accounting record; offering delete would be noise). Draft
56+
// and sent invoices keep the full untouched menu — the predicates evaluate
57+
// per row against `record.*` on the same CEL engine as everything else.
58+
userActions: {
59+
edit: { disabledWhen: P`record.status == 'paid'` },
60+
delete: { visibleWhen: P`record.status != 'paid'` },
61+
},
62+
4963
fields: {
5064
name: Field.text({ label: 'Invoice Number', required: true, searchable: true, maxLength: 60 }),
5165
// Forward record-picker config (spec lookup* props). The renderer

0 commit comments

Comments
 (0)