Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .changeset/showcase-action-disabled-specimen.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
---

feat(showcase): add the action `disabled`-predicate specimen (`showcase_archive_task`) — greyed until `record.done`, contrasting `visible` (hide) with `disabled` (grey). Examples-only; releases nothing.
32 changes: 32 additions & 0 deletions examples/app-showcase/src/ui/actions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,37 @@ export const ActionParamGalleryAction = defineAction({
refreshAfter: false,
});

/**
* script — the `disabled` predicate specimen. Where `visible` HIDES an action
* (see MarkDoneAction), `disabled` keeps it ON SCREEN but greyed until its
* precondition holds: Archive stays visible on every task and only becomes
* clickable once the task is done. Same authoring rules as `visible`
* (`record.`-prefixed, single comparison; disabled when the CEL is TRUE).
* Exercises the renderer-side wiring (objectui: DeclaredActionsBar +
* action:button/group/icon/menu) that #1885's follow-through completed.
*/
export const ArchiveTaskAction = defineAction({
name: 'showcase_archive_task',
label: 'Archive',
icon: 'archive',
objectName: task,
type: 'script',
body: {
language: 'js',
// No destructive side effect — the specimen's value is the disabled
// behavior itself; echo which record would be archived.
source:
"var id = ctx.recordId || (ctx.record && ctx.record.id) || input.recordId;" +
"return { ok: true, archived: id };",
capabilities: [],
},
successMessage: 'Task archived (demo — no data changed).',
// Disabled while the task is not done — visible either way.
disabled: 'record.done != true',
locations: ['record_header', 'record_section'],
refreshAfter: false,
});

export const allActions = [
MarkDoneAction,
OpenDocsAction,
Expand All @@ -245,4 +276,5 @@ export const allActions = [
NewTaskAction,
SubmitForSignoffAction,
ActionParamGalleryAction,
ArchiveTaskAction,
];
5 changes: 4 additions & 1 deletion examples/app-showcase/src/ui/pages/task-detail.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,10 @@ export const TaskDetailPage = definePage({
properties: {
location: 'record_section',
align: 'start',
actionNames: ['showcase_mark_done', 'showcase_log_time'],
// showcase_archive_task is the `disabled`-predicate specimen:
// visible on every task, greyed until `record.done` (contrast with
// showcase_mark_done's `visible`, which HIDES once done).
actionNames: ['showcase_mark_done', 'showcase_log_time', 'showcase_archive_task'],
},
},
{
Expand Down
Loading