uc-apx create dynamic-action toggle
Splice a dynamicAction that pairs native-hide + native-show actions under a single change-triggered DA. Canonical “depends-on” pattern: show a set of items/region when a controlling item has a certain value.
—trigger-item is the item whose change event fires the DA. —affected-items (CSV) or —affected-region selects what to show/hide. —condition-item + —condition-value emit a clientSideCondition so the show action fires when the condition is true and the hide action fires when it is false. Both flags must be set together or not at all.
uc-apx create dynamic-action toggle [flags]| Flag | Type | Default | Description |
|---|---|---|---|
--affected-items | string | CSV of item ids to show/hide (one of —affected-items or —affected-region required) | |
--affected-region | string | Region id to show/hide (one of —affected-items or —affected-region required) | |
--condition-item | string | Item id for clientSideCondition (must pair with —condition-value) | |
--condition-value | string | Value for clientSideCondition (must pair with —condition-item) | |
--dry-run | Print rendered dynamicAction to stdout without writing | ||
--name | string | Display name (default: “Toggle <trigger-item>“) | |
--page | string | Target page (numeric ID, alias, or name) [required] | |
--sequence | int | execution.sequence (default: max existing dynamicAction sequence + 10) | |
--trigger-event | string | Override the trigger event (default: omitted, APEX uses change) | |
--trigger-item | string | Page item id whose change event triggers the DA [required] |
Global Flags
Section titled “Global Flags”| Flag | Type | Default | Description |
|---|---|---|---|
--app-dir | string | . | Path to the APEX application directory |
--json-pretty | Output in pretty-printed JSON (human-readable) instead of minified JSON | ||
--toon | Output in TOON format (human-readable, token-efficient) instead of JSON |
Example Generated APEXlang
Section titled “Example Generated APEXlang”Using --dry-run to preview the generated construct (no files are written):
uc-apx --app-dir examples/brookstrut create dynamic-action toggle --page 46 --name Toggle Facets --trigger-item P46_NAVIGATION --affected-region @facets --dry-runGenerated APEXlang
dynamicAction toggle-P46_NAVIGATION ( name: Toggle Facets execution { sequence: 20 } when { selectionType: items items: P46_NAVIGATION }
action native-hide ( action: hide affectedElements { selectionType: region region: @facets } execution { sequence: 10 } )
action native-show ( action: show affectedElements { selectionType: region region: @facets } execution { sequence: 10 } )
)