From 4fb43bbc7f0c102742abb751ee9ff30c48735ac9 Mon Sep 17 00:00:00 2001 From: Jack Zhuang <277994282+os-zhuang@users.noreply.github.com> Date: Sat, 6 Jun 2026 19:34:46 +0800 Subject: [PATCH] chore(showcase): config-driven master-detail (derive child columns) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The project-workspace page now configures its Tasks subtable with just { childObject: 'showcase_task' } — the relationship FK and grid columns are auto-derived from the child object metadata by @object-ui/plugin-form. Drops the hand-authored ~40-line columns/relationshipField block. Co-Authored-By: Claude Opus 4.8 --- .../src/pages/project-workspace.page.ts | 41 +++---------------- 1 file changed, 6 insertions(+), 35 deletions(-) diff --git a/examples/app-showcase/src/pages/project-workspace.page.ts b/examples/app-showcase/src/pages/project-workspace.page.ts index 4a8502e88..37c275446 100644 --- a/examples/app-showcase/src/pages/project-workspace.page.ts +++ b/examples/app-showcase/src/pages/project-workspace.page.ts @@ -44,42 +44,13 @@ export const ProjectWorkspacePage: Page = { formType: 'simple', submitText: 'Create Project + Tasks', fields: ['name', 'account', 'status', 'health', 'budget', 'end_date'], + // Config-driven master-detail: only the child object is named. The + // relationship FK (showcase_task.project) and the editable grid + // columns are auto-derived from the child object's metadata — no + // hand-authored columns block. Add `columns`/`relationshipField` + // here only to override the derived defaults. details: [ - { - title: 'Tasks', - childObject: 'showcase_task', - relationshipField: 'project', - amountField: 'estimate_hours', - addLabel: 'Add task', - columns: [ - { field: 'title', label: 'Title', type: 'text', required: true }, - { - field: 'status', - label: 'Status', - type: 'select', - options: [ - { label: 'Backlog', value: 'backlog' }, - { label: 'To Do', value: 'todo' }, - { label: 'In Progress', value: 'in_progress' }, - { label: 'In Review', value: 'in_review' }, - { label: 'Done', value: 'done' }, - ], - }, - { - field: 'priority', - label: 'Priority', - type: 'select', - options: [ - { label: 'Low', value: 'low' }, - { label: 'Medium', value: 'medium' }, - { label: 'High', value: 'high' }, - { label: 'Urgent', value: 'urgent' }, - ], - }, - { field: 'estimate_hours', label: 'Estimate (h)', type: 'number' }, - { field: 'due_date', label: 'Due Date', type: 'date' }, - ], - }, + { title: 'Tasks', childObject: 'showcase_task', addLabel: 'Add task' }, ], }, },