diff --git a/.changeset/37057-actionlayout-validate-scope.md b/.changeset/37057-actionlayout-validate-scope.md new file mode 100644 index 00000000000..05691f90d9c --- /dev/null +++ b/.changeset/37057-actionlayout-validate-scope.md @@ -0,0 +1,10 @@ +--- +'@objectstack/skills': patch +--- + +docs(skills): objectstack-ui says where `os validate` judges `actionLayout` names + +Clause-②: no +Metadata-protocol: none + +objectstack-ui's `rules/actions.md`, "Button Order (`actionLayout`)": the sentence "`os validate` refuses a name the arm's scope does not place" now says where that holds: on the object, or on an extension of an object the same stack defines. The next sentence, on the paired `.custom` package's extension of an installed object, now says those names are not judged there and that a wrong name draws nothing. The rule itself is unchanged; the text said more than the rule does. Three Add to Campaign example lines that repeated a key another example in the file already shows (`icon`, `successMessage`, `refreshAfter`) and the gloss "(the handler's answer)" on the copy-holes bullet, which the `resultDialog` bullet above it already says, were removed to pay for the new words. diff --git a/skills/objectstack-ui/rules/actions.md b/skills/objectstack-ui/rules/actions.md index 2652f16de46..5aa84bafab5 100644 --- a/skills/objectstack-ui/rules/actions.md +++ b/skills/objectstack-ui/rules/actions.md @@ -35,8 +35,10 @@ goes to the ⋯ menu, those `more` names first. `record` takes `record_header` / `record_more` actions wherever that header draws (record page, side preview, phone bar, a row's ⋮ menu order); `list` takes `list_toolbar` actions and may pin `$import` / `$export` (pinned only). `os validate` refuses a name the arm's -scope does not place. On an installed object only its paired `.custom` package's -extension writes it (as `fieldGroups`, objectstack-data), each arm whole. +scope does not place, on the object or an extension of one the same stack +defines. On an installed object only its paired `.custom` package's extension +writes it (as `fieldGroups`, objectstack-data), each arm whole, not judged +there: a wrong name draws nothing. ## Visibility, Disable & Feedback @@ -49,7 +51,7 @@ extension writes it (as `fieldGroups`, objectstack-data), each arm whole. - `preflight` — a read the param dialog shows above the params before submit: `{ read: { url }, path?, fields?, seed? }` sends one `GET` (no other `method`, no body or credentials) to a same-origin API path (one leading `/`) whose only holes are `${param.NAME}` (a declared param; re-read when it changes), `${ctx.recordId}` and `${ctx.record.FIELD}`. `path` selects the answer's sub-tree (`data`); `fields` rows are `resultDialog.fields`' (omitted: JSON). Each `seed: [{ param, path }]` entry fills a declared param, drawn read-only and submitted as shown: seeded once, no `defaultValue` / `defaultFromRow` / `carryOver`, read by no hole; mark it `required` so Confirm waits for the answer. Refused without a non-empty `params` and beside `execution: 'aggregate'`. UX, not authorization: the endpoint still checks a seeded value. - `resultDialog` — a one-shot dialog that shows the server answer in place of the success toast (so no `successMessage`; `outcomeMessages` is refused beside it): `{ title?, description?, acknowledge?, format?, fields? }`. `fields: [{ path, label?, format? }]`, `path` a dot path into `result.data` (omitted: the whole answer as JSON); `format` is one of `qrcode`, `code-list`, `secret`, `text`, `json`, or `table` with `columns: [{ path, label?, format? }]` (one row per element of the array at `path`, one cell per column; required with `table` and refused beside any other format). The dialog-level `format` (default `json`) and a cell's (default `text`) take every format but `table`. A `text` or `code-list` cell draws the value with no copy control; a `secret` or `qrcode` cell keeps its own. - `successMessage` / `errorMessage` — toast copy; without `successMessage` the UI shows a generic "Action completed". -- Copy holes are `{{ }}`: `confirmText`, `description` and a param's `helpText` read `record`; `successMessage` and each `outcomeMessages` entry (`resent: 'Invitation resent to {{ result.email }}'`) read `result` (the handler's answer) and `record`; `errorMessage` takes none. A `bulkActionDefs` entry's `confirmText` reads `{{ count }}` and its params by bare name (`{{ tier }}`). In all of them `${record.name}`, `{name}`, logic in a hole and a blank sentence fail `os validate`. +- Copy holes are `{{ }}`: `confirmText`, `description` and a param's `helpText` read `record`; `successMessage` and each `outcomeMessages` entry (`resent: 'Invitation resent to {{ result.email }}'`) read `result` and `record`; `errorMessage` takes none. A `bulkActionDefs` entry's `confirmText` reads `{{ count }}` and its params by bare name (`{{ tier }}`). In all of them `${record.name}`, `{name}`, logic in a hole and a blank sentence fail `os validate`. - A param's `helpText`, like `description`, is a sentence or an inline locale map (`{ en: 'Why {{ record.name }} is paused', 'zh-CN': '暂停原因' }`); the map is how a page button's inline `action` (no bundle reaches it) writes its hint per locale. - `undoable: true` — an **Undo** in the success toast (and `Ctrl+Z`). Snapshot: runtime on `operation: 'update'`, console on `type: 'api'`; else refused. - A list view's `bulkActions: ['']` runs the action once per ticked row. A body that writes each selected row takes that form: declare `execution: 'perRecord'` and write the row it is handed (`ctx.record`, `ctx.recordId`; `crm_create_campaign` below); a row whose run throws is listed with its message. A `bulkActionDefs` entry `{ name, operation: 'custom', execution: 'aggregate' }` runs it once for the selection. A script body or a flow receives the ids under the built-in key `params._selectedIds` (`input._selectedIds`), at most 5000 and only ids the caller can read: one the caller cannot read refuses the whole call (`404 RECORD_NOT_FOUND`) before it starts. A throw is one outcome for the selection; a return value's top-level `succeeded` or `failed` is read as a `BulkActionResult` (`@objectstack/spec/ui`), and in any other form (counts, one list) reported as unreadable. @@ -109,7 +111,6 @@ export const AddToCampaignAction = defineAction({ name: 'crm_create_campaign', label: 'Add to Campaign', objectName: 'lead', - icon: 'send', type: 'script', execution: 'perRecord', params: [ @@ -125,8 +126,6 @@ export const AddToCampaignAction = defineAction({ capabilities: ['api.write'], timeoutMs: 10000, }, - successMessage: 'Leads added to campaign!', - refreshAfter: true, }); ```