@shwfed/config 2.7.8 → 2.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/mcp.mjs +97 -34
- package/dist/module.json +1 -1
- package/dist/preview/assets/{badge-KAEXz3VO.js → badge-Ddz0ExD-.js} +1 -1
- package/dist/preview/assets/{config-DbirfZyy.js → config---5_lEKG.js} +1 -1
- package/dist/preview/assets/{config-ZczGik30.js → config-5qIYVWZh.js} +1 -1
- package/dist/preview/assets/config-B8zbFg3y.js +1 -0
- package/dist/preview/assets/{config-DbfJWa8K.js → config-Bn619USg.js} +1 -1
- package/dist/preview/assets/{config-C-QRPeN1.js → config-CUeBTyLb.js} +1 -1
- package/dist/preview/assets/config-DN_3WauN.js +1 -0
- package/dist/preview/assets/config-U-3fWb-2.js +1 -0
- package/dist/preview/assets/config-q5VV9rp7.js +1 -0
- package/dist/preview/assets/config-vePqHFvZ.js +1 -0
- package/dist/preview/assets/{definition.vue_vue_type_script_setup_true_lang-CQ6MUPKO.js → definition.vue_vue_type_script_setup_true_lang-fQa65UMX.js} +1 -1
- package/dist/preview/assets/index-BKaqQGb-.js +688 -0
- package/dist/preview/assets/index-Bj8xIK5h.js +1 -0
- package/dist/preview/assets/index-BlHAyQdm.css +1 -0
- package/dist/preview/assets/{index-Bv_aA34a.js → index-CzWhSvDG.js} +1 -1
- package/dist/preview/assets/{item-SC0WQMVu.js → item-DHarupON.js} +1 -1
- package/dist/preview/assets/{runtime-DcStOiOi.js → runtime-560tuaHv.js} +1 -1
- package/dist/preview/assets/{runtime-Ckuz5Kxm.js → runtime-C2rQ3L3-.js} +1 -1
- package/dist/preview/assets/{runtime-BPOf7Yqz.js → runtime-CKghL8I_.js} +1 -1
- package/dist/preview/assets/runtime-CMsaNery.js +1 -0
- package/dist/preview/assets/runtime-CMuCGJZm.js +1 -0
- package/dist/preview/assets/{runtime-DO0anKbw.js → runtime-DOM_La4X.js} +1 -1
- package/dist/preview/assets/{runtime-EVgYW6_7.js → runtime-DQHb9t0r.js} +1 -1
- package/dist/preview/assets/{runtime-CnKlH0mi.js → runtime-Dgl3wVfD.js} +1 -1
- package/dist/preview/assets/{runtime-i32sR7d3.js → runtime-aLgWVLET.js} +1 -1
- package/dist/preview/index.html +2 -2
- package/dist/runtime/components/actions/buttons/2026-04-18/com.shwfed.actions.button.http.request.json/config.d.vue.ts +8 -0
- package/dist/runtime/components/actions/buttons/2026-04-18/com.shwfed.actions.button.http.request.json/config.vue +28 -0
- package/dist/runtime/components/actions/buttons/2026-04-18/com.shwfed.actions.button.http.request.json/config.vue.d.ts +8 -0
- package/dist/runtime/components/actions/buttons/2026-04-18/com.shwfed.actions.button.http.request.json/runtime.vue +17 -17
- package/dist/runtime/components/actions/buttons/2026-04-18/com.shwfed.actions.button.http.request.json/schema.d.ts +4 -0
- package/dist/runtime/components/actions/buttons/2026-04-18/com.shwfed.actions.button.http.request.json/schema.js +8 -0
- package/dist/runtime/components/actions/buttons/2026-04-18/com.shwfed.actions.button.http.request.json.confirm/config.d.vue.ts +8 -0
- package/dist/runtime/components/actions/buttons/2026-04-18/com.shwfed.actions.button.http.request.json.confirm/config.vue +25 -0
- package/dist/runtime/components/actions/buttons/2026-04-18/com.shwfed.actions.button.http.request.json.confirm/config.vue.d.ts +8 -0
- package/dist/runtime/components/actions/buttons/2026-04-18/com.shwfed.actions.button.http.request.json.confirm/runtime.vue +2 -7
- package/dist/runtime/components/actions/buttons/2026-04-18/com.shwfed.actions.button.http.request.json.confirm/schema.d.ts +4 -0
- package/dist/runtime/components/actions/buttons/2026-04-18/com.shwfed.actions.button.http.request.json.confirm/schema.js +8 -0
- package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.table/config.d.vue.ts +2 -0
- package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.table/config.vue.d.ts +2 -0
- package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.table/runtime.d.vue.ts +2 -0
- package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.table/runtime.vue.d.ts +2 -0
- package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.table/schema.d.ts +2 -0
- package/dist/runtime/components/config/blocks/2026-06-02/com.shwfed.block.card/config.vue +2 -0
- package/dist/runtime/components/config/blocks/2026-06-02/com.shwfed.block.card/schema.d.ts +5 -0
- package/dist/runtime/components/config/blocks/2026-06-02/com.shwfed.block.card/schema.js +8 -3
- package/dist/runtime/components/form/fields/2026-04-22/com.shwfed.form.field.markdown/runtime.vue +12 -1
- package/dist/runtime/components/form/fields/2026-04-22/com.shwfed.form.field.markdown/schema.d.ts +8 -2
- package/dist/runtime/components/form/fields/2026-04-22/com.shwfed.form.field.markdown/schema.js +3 -3
- package/dist/runtime/components/form/fields/2026-04-22/com.shwfed.form.field.textarea/config.d.vue.ts +2 -2
- package/dist/runtime/components/form/fields/2026-04-22/com.shwfed.form.field.textarea/config.vue +15 -25
- package/dist/runtime/components/form/fields/2026-04-22/com.shwfed.form.field.textarea/config.vue.d.ts +2 -2
- package/dist/runtime/components/form/fields/2026-04-22/com.shwfed.form.field.textarea/runtime.vue +11 -2
- package/dist/runtime/components/form/fields/2026-04-22/com.shwfed.form.field.textarea/schema.d.ts +1 -1
- package/dist/runtime/components/form/fields/2026-04-22/com.shwfed.form.field.textarea/schema.js +4 -4
- package/dist/runtime/components/form/fields/2026-05-18/com.shwfed.form.field.table/config.d.vue.ts +2 -0
- package/dist/runtime/components/form/fields/2026-05-18/com.shwfed.form.field.table/config.vue.d.ts +2 -0
- package/dist/runtime/components/form/fields/2026-05-18/com.shwfed.form.field.table/schema.d.ts +2 -0
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.combobox.multi/runtime.vue +13 -2
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.combobox.multi/schema.d.ts +1 -0
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.combobox.multi/schema.js +4 -1
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.combobox.single/runtime.vue +10 -2
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.combobox.single/schema.d.ts +1 -0
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.combobox.single/schema.js +4 -1
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.combobox.multi/runtime.vue +16 -0
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.combobox.multi/schema.d.ts +1 -0
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.combobox.multi/schema.js +4 -1
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.combobox.single/runtime.vue +13 -5
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.combobox.single/schema.d.ts +1 -0
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.combobox.single/schema.js +4 -1
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.multi/runtime.vue +25 -5
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.multi/schema.d.ts +1 -0
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.multi/schema.js +4 -1
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.single/runtime.vue +18 -8
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.single/schema.d.ts +1 -0
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.single/schema.js +4 -1
- package/dist/runtime/components/form/index.vue +15 -3
- package/dist/runtime/components/form/schema.d.ts +4 -0
- package/dist/runtime/components/form/schema.js +1 -0
- package/dist/runtime/components/form/unit-config.vue +6 -1
- package/dist/runtime/components/form/utils/form-vars.js +4 -0
- package/dist/runtime/components/form/utils/resolve.d.ts +10 -0
- package/dist/runtime/components/table/columns/2026-05-24/com.shwfed.table.column.combobox-single.remote.options-remote/config.d.vue.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-24/com.shwfed.table.column.combobox-single.remote.options-remote/config.vue.d.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-24/com.shwfed.table.column.combobox-single.remote.options-static/config.d.vue.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-24/com.shwfed.table.column.combobox-single.remote.options-static/config.vue.d.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-25/com.shwfed.table.column.combobox-multi.remote.options-remote/config.d.vue.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-25/com.shwfed.table.column.combobox-multi.remote.options-remote/config.vue.d.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-25/com.shwfed.table.column.combobox-multi.remote.options-static/config.d.vue.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-25/com.shwfed.table.column.combobox-multi.remote.options-static/config.vue.d.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-multi.remote/config.d.vue.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-multi.remote/config.vue.d.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-single.remote/config.d.vue.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-single.remote/config.vue.d.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-multi/config.d.vue.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-multi/config.vue.d.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-multi/runtime.vue +13 -2
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-multi/schema.d.ts +1 -0
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-multi/schema.js +4 -1
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-single/config.d.vue.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-single/config.vue.d.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-single/runtime.vue +10 -2
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-single/schema.d.ts +1 -0
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-single/schema.js +4 -1
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.tree-combobox-multi/runtime.vue +16 -0
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.tree-combobox-multi/schema.d.ts +1 -0
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.tree-combobox-multi/schema.js +3 -1
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.tree-combobox-single/runtime.vue +13 -5
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.tree-combobox-single/schema.d.ts +1 -0
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.tree-combobox-single/schema.js +3 -1
- package/dist/runtime/components/table/config.vue +35 -1
- package/dist/runtime/components/table/index.d.vue.ts +2 -0
- package/dist/runtime/components/table/index.vue +8 -0
- package/dist/runtime/components/table/index.vue.d.ts +2 -0
- package/dist/runtime/components/table/row-provider.vue +8 -0
- package/dist/runtime/components/table/schema.d.ts +4 -0
- package/dist/runtime/components/table/schema.js +4 -0
- package/dist/runtime/components/table/utils/resolve.d.ts +7 -0
- package/dist/runtime/components/table/utils/shared.js +4 -0
- package/dist/runtime/components/ui/expression-editor/CodeMirrorInput.d.vue.ts +1 -0
- package/dist/runtime/components/ui/expression-editor/CodeMirrorInput.vue +9 -1
- package/dist/runtime/components/ui/expression-editor/CodeMirrorInput.vue.d.ts +1 -0
- package/dist/runtime/components/ui/expression-editor/ExpressionEditor.d.vue.ts +2 -2
- package/dist/runtime/components/ui/expression-editor/ExpressionEditor.vue +33 -4
- package/dist/runtime/components/ui/expression-editor/ExpressionEditor.vue.d.ts +2 -2
- package/dist/runtime/components/ui/expression-editor/picker-entries.d.ts +3 -2
- package/dist/runtime/components/ui/expression-editor/picker-entries.js +14 -3
- package/dist/runtime/components/ui/expression-editor/selection-chip-extension.d.ts +4 -0
- package/dist/runtime/components/ui/expression-editor/selection-chip-extension.js +119 -0
- package/dist/runtime/components/ui/expression-editor/selection-refs.d.ts +8 -0
- package/dist/runtime/components/ui/expression-editor/selection-refs.js +29 -0
- package/dist/runtime/share/event-bus.d.ts +12 -12
- package/dist/runtime/share/use-persisted-query.d.ts +21 -0
- package/dist/runtime/share/use-persisted-query.js +33 -0
- package/dist/runtime/utils/cel-context.d.ts +22 -0
- package/dist/runtime/utils/cel-context.js +8 -0
- package/dist/runtime/utils/selections-registry.d.ts +77 -0
- package/dist/runtime/utils/selections-registry.js +49 -0
- package/package.json +1 -1
- package/dist/preview/assets/config-BXx5syNf.js +0 -1
- package/dist/preview/assets/config-Bb9Yeh33.js +0 -1
- package/dist/preview/assets/config-CkKx7sVR.js +0 -1
- package/dist/preview/assets/config-CtbYlZCL.js +0 -1
- package/dist/preview/assets/config-DPlbFBRi.js +0 -1
- package/dist/preview/assets/index-C9P-6gZd.css +0 -1
- package/dist/preview/assets/index-CJFU9znN.js +0 -1
- package/dist/preview/assets/index-DUOkekYu.js +0 -680
- package/dist/preview/assets/runtime-CC2caFS9.js +0 -1
- package/dist/preview/assets/runtime-CLaRFZzt.js +0 -1
- package/dist/runtime/share/form-validate.d.ts +0 -18
- package/dist/runtime/share/form-validate.js +0 -8
|
@@ -51,19 +51,19 @@ export type EventChannel = Readonly<{
|
|
|
51
51
|
* A handler MAY still *halt* the chain — the "guard" shape: stop everything
|
|
52
52
|
* queued after it. `dispatchTriggers` runs the list with `Effect.forEach`,
|
|
53
53
|
* which short-circuits the moment one request's effect aborts, so triggers
|
|
54
|
-
* after the guard never dispatch.
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
* `
|
|
59
|
-
*
|
|
60
|
-
*
|
|
54
|
+
* after the guard never dispatch. Two ops use this: the page's `close` (halts
|
|
55
|
+
* unconditionally — nothing should run after a close) and the form's `validate`
|
|
56
|
+
* (halts only when an `error`-severity result remains, gating a submit). Both
|
|
57
|
+
* halt with `Effect.die`, not `Effect.fail`: a defect aborts the chain without
|
|
58
|
+
* widening the `void` error channel here (and `ActionEffect`'s `catchTags`
|
|
59
|
+
* union over in `actions/components/group.vue`). The defect propagates to that
|
|
60
|
+
* runner's `runPromise`, whose outer try/catch absorbs it silently — `catchTags`
|
|
61
|
+
* only intercepts typed failures, so no toast.
|
|
61
62
|
*
|
|
62
|
-
* Pre-submit form validation
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
* `form-validate.ts`).
|
|
63
|
+
* Pre-submit form validation rides this bus as that `validate` guard: a
|
|
64
|
+
* submit-style button (e.g. the HTTP-request buttons) puts it first in its own
|
|
65
|
+
* pre-request trigger list, so validation is explicit and configured rather
|
|
66
|
+
* than an implicit host gate.
|
|
67
67
|
*/
|
|
68
68
|
export type OperationHandlers = Readonly<Record<string, () => Effect.Effect<void>>>;
|
|
69
69
|
export declare const EVENT_CHANNEL_KEY: InjectionKey<EventChannel>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type Ref } from 'vue';
|
|
2
|
+
import type { FormState } from '../components/form/utils/state.js';
|
|
3
|
+
/**
|
|
4
|
+
* Mirrors a table's query form state into `sessionStorage` so filters survive
|
|
5
|
+
* a page reload — until the tab is closed / the user leaves the site.
|
|
6
|
+
*
|
|
7
|
+
* Modeled on `useActiveTabId`: storage is keyed on the table's stable
|
|
8
|
+
* `config.id`, every access is guarded against SSR and unavailable storage
|
|
9
|
+
* (privacy modes), and `restore()` is meant to run in `onMounted` after the
|
|
10
|
+
* form's CEL `initial` seed has landed so the stored value overrides it.
|
|
11
|
+
*
|
|
12
|
+
* - `restore()` applies a stored snapshot onto `queryState` (no-op when
|
|
13
|
+
* disabled, when there is no `tableId`, or when nothing is stored).
|
|
14
|
+
* - `clear()` drops the stored snapshot (used by `reset-query`, so a reset is
|
|
15
|
+
* authoritative and the stale query does not reappear on the next load).
|
|
16
|
+
* - A deep watch persists live changes while enabled.
|
|
17
|
+
*/
|
|
18
|
+
export declare function usePersistedQuery(tableId: string | undefined, queryState: Ref<FormState>, enabled: () => boolean): {
|
|
19
|
+
restore: () => void;
|
|
20
|
+
clear: () => void;
|
|
21
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { watch } from "vue";
|
|
2
|
+
const STORAGE_PREFIX = "shwfed.table.query.";
|
|
3
|
+
export function usePersistedQuery(tableId, queryState, enabled) {
|
|
4
|
+
const active = () => Boolean(tableId) && enabled() && typeof window !== "undefined";
|
|
5
|
+
const key = () => `${STORAGE_PREFIX}${tableId}`;
|
|
6
|
+
function restore() {
|
|
7
|
+
if (!active()) return;
|
|
8
|
+
try {
|
|
9
|
+
const raw = window.sessionStorage.getItem(key());
|
|
10
|
+
if (!raw) return;
|
|
11
|
+
const parsed = JSON.parse(raw);
|
|
12
|
+
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
13
|
+
queryState.value = parsed;
|
|
14
|
+
}
|
|
15
|
+
} catch {
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
function clear() {
|
|
19
|
+
if (!tableId || typeof window === "undefined") return;
|
|
20
|
+
try {
|
|
21
|
+
window.sessionStorage.removeItem(key());
|
|
22
|
+
} catch {
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
watch(queryState, (next) => {
|
|
26
|
+
if (!active()) return;
|
|
27
|
+
try {
|
|
28
|
+
window.sessionStorage.setItem(key(), JSON.stringify(next));
|
|
29
|
+
} catch {
|
|
30
|
+
}
|
|
31
|
+
}, { deep: true });
|
|
32
|
+
return { restore, clear };
|
|
33
|
+
}
|
|
@@ -7,6 +7,7 @@ export type CELVar = {
|
|
|
7
7
|
};
|
|
8
8
|
export type CELContext = Record<string, CELVar>;
|
|
9
9
|
export declare const SCOPE_ADDRESS_VAR = "__scopes__";
|
|
10
|
+
export declare const SELECTIONS_VAR = "selections";
|
|
10
11
|
export type ScopeAccessor = Record<string, () => unknown>;
|
|
11
12
|
export declare function provideCELContext(context: CELContext): void;
|
|
12
13
|
export declare function injectCELContext(): CELContext;
|
|
@@ -43,4 +44,25 @@ export declare function provideScopeAncestor(ancestor: Ref<ScopeAncestor | null>
|
|
|
43
44
|
* first. Empty when nothing up the config tree exposes an addressable scope.
|
|
44
45
|
*/
|
|
45
46
|
export declare function useScopeAncestry(): Ref<ReadonlyArray<ScopeAncestor>>;
|
|
47
|
+
/** One selection-like field in the editing form, as the picker/chip surfaces it. */
|
|
48
|
+
export type SelectionFieldRef = Readonly<{
|
|
49
|
+
/** Field uuid keyed into `selections["<id>"]` — the registry/publish key. */
|
|
50
|
+
id: string;
|
|
51
|
+
/** The field's designer-facing name, shown instead of the raw uuid. */
|
|
52
|
+
name: string;
|
|
53
|
+
}>;
|
|
54
|
+
/**
|
|
55
|
+
* Advertise the form's selection-like fields to every descendant
|
|
56
|
+
* ExpressionEditor, so it can render `selections["<id>"]` as the field's name
|
|
57
|
+
* and list those fields in the variable picker. Design-time only — the runtime
|
|
58
|
+
* counterpart is `provideSelectionsRegistry` (utils/selections-registry). A form
|
|
59
|
+
* host provides the whole roster; a nested form overrides with its own (a field
|
|
60
|
+
* references its own form's siblings, not an outer form's).
|
|
61
|
+
*/
|
|
62
|
+
export declare function provideSelectionRoster(roster: Ref<ReadonlyArray<SelectionFieldRef>>): void;
|
|
63
|
+
/**
|
|
64
|
+
* The selection-like fields of the enclosing form, or empty when the editor
|
|
65
|
+
* sits outside any form (a table column expression, a standalone editor).
|
|
66
|
+
*/
|
|
67
|
+
export declare function useSelectionRoster(): Ref<ReadonlyArray<SelectionFieldRef>>;
|
|
46
68
|
export declare function celBindings(context: CELContext): Record<string, unknown>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { computed, inject, provide, shallowRef } from "vue";
|
|
2
2
|
import { injectLocal, provideLocal } from "@vueuse/core";
|
|
3
3
|
export const SCOPE_ADDRESS_VAR = "__scopes__";
|
|
4
|
+
export const SELECTIONS_VAR = "selections";
|
|
4
5
|
const CEL_CONTEXT_KEY = Symbol("cel-context");
|
|
5
6
|
export function provideCELContext(context) {
|
|
6
7
|
const parent = injectLocal(CEL_CONTEXT_KEY, {});
|
|
@@ -46,6 +47,13 @@ export function provideScopeAncestor(ancestor) {
|
|
|
46
47
|
export function useScopeAncestry() {
|
|
47
48
|
return inject(SCOPE_ANCESTRY_KEY, void 0) ?? shallowRef([]);
|
|
48
49
|
}
|
|
50
|
+
const SELECTION_ROSTER_KEY = Symbol("cel-selection-roster");
|
|
51
|
+
export function provideSelectionRoster(roster) {
|
|
52
|
+
provide(SELECTION_ROSTER_KEY, roster);
|
|
53
|
+
}
|
|
54
|
+
export function useSelectionRoster() {
|
|
55
|
+
return inject(SELECTION_ROSTER_KEY, void 0) ?? shallowRef([]);
|
|
56
|
+
}
|
|
49
57
|
export function celBindings(context) {
|
|
50
58
|
const out = {};
|
|
51
59
|
for (const [name, entry] of Object.entries(context)) {
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import type { ShallowRef } from 'vue';
|
|
2
|
+
/**
|
|
3
|
+
* Host-owned map of `field-uuid → the field's currently-resolved full option`.
|
|
4
|
+
*
|
|
5
|
+
* Selection-like fields (combobox, tree-select, …) persist only a *key* — the
|
|
6
|
+
* scalar `optionValue` / `nodeKey` extracts from the chosen option. The rest of
|
|
7
|
+
* the option object (a backend record's `code`, `label`, …) is in hand while the
|
|
8
|
+
* field resolves the selection but is otherwise dropped. A *sibling* expression
|
|
9
|
+
* — say a related select whose request needs the chosen option's `code` — has no
|
|
10
|
+
* way to reach it: siblings share only the form state (the `form` CEL var), and
|
|
11
|
+
* the persisted key deliberately doesn't carry the rest.
|
|
12
|
+
*
|
|
13
|
+
* This registry is that missing channel. The common host (the form root; a table
|
|
14
|
+
* row) owns one and exposes it as the `selections` CEL variable; each select-like
|
|
15
|
+
* field publishes its resolved option here under its own uuid. A sibling reads
|
|
16
|
+
* `selections["<field-uuid>"].code`. It is NOT form state, so it never rides
|
|
17
|
+
* along in the submit payload — that separation is the whole point.
|
|
18
|
+
*
|
|
19
|
+
* Keyed by field uuid, not by binding: a table cell's value lives in row data
|
|
20
|
+
* (no form binding) while a form field's lives in form state, but the uuid is the
|
|
21
|
+
* one identity both share — and the one the expression editor surfaces as a
|
|
22
|
+
* field-name chip so the designer never sees the raw uuid.
|
|
23
|
+
*/
|
|
24
|
+
export type SelectionsRegistry = {
|
|
25
|
+
/**
|
|
26
|
+
* Live uuid → resolved-option map. Read by the host's `selections` thunk. A
|
|
27
|
+
* `shallowRef`, deliberately: the stored options are opaque snapshots a
|
|
28
|
+
* sibling expression reads but never the registry mutates, so deep-proxying
|
|
29
|
+
* them is wasted work — and worse, it would replace the references we store
|
|
30
|
+
* with reactive proxies, defeating the identity-based de-dup in `set`.
|
|
31
|
+
* Reactivity rides on the `.value` swap alone (every `set`/`clear` replaces
|
|
32
|
+
* the whole map), which is exactly what a `shallowRef` tracks.
|
|
33
|
+
*/
|
|
34
|
+
entries: ShallowRef<Record<string, unknown>>;
|
|
35
|
+
/** Publish (or replace) the resolved option for a field. */
|
|
36
|
+
set: (uuid: string, option: unknown) => void;
|
|
37
|
+
/** Drop a field's entry — on clear, or when the field unmounts. */
|
|
38
|
+
clear: (uuid: string) => void;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Create a registry and provide it to descendants. Called once per host (the
|
|
42
|
+
* form root; later, a table row). The returned `entries` ref is what the host
|
|
43
|
+
* overlays as the `selections` CEL thunk.
|
|
44
|
+
*/
|
|
45
|
+
export declare function provideSelectionsRegistry(): SelectionsRegistry;
|
|
46
|
+
/**
|
|
47
|
+
* Inject the nearest registry, or `undefined` when there's no providing host
|
|
48
|
+
* (an uncontrolled field, a unit test). Callers must tolerate the absent case —
|
|
49
|
+
* publishing is best-effort.
|
|
50
|
+
*/
|
|
51
|
+
export declare function useSelectionsRegistry(): SelectionsRegistry | undefined;
|
|
52
|
+
/**
|
|
53
|
+
* Wire a selection field's publish lifecycle to the nearest registry. Call once
|
|
54
|
+
* in setup; it injects the host registry (tolerating absence), watches the
|
|
55
|
+
* resolved selection, and clears on unmount.
|
|
56
|
+
*
|
|
57
|
+
* The de-dup is the whole point. A field's resolved-option computed re-mints on
|
|
58
|
+
* every re-evaluation — and `cel.ts`'s `unwrapCelValue` deep-copies every CEL
|
|
59
|
+
* result, so a remote option's backend record is a brand-new object on each
|
|
60
|
+
* pass even when the underlying data is unchanged. Worse, `celBindings` reads
|
|
61
|
+
* the `selections` map on every `$cel` call, so any publish re-triggers every
|
|
62
|
+
* selectable's own option resolution. Publishing on each re-mint would replace
|
|
63
|
+
* the map, re-trigger resolution, re-mint, and re-publish without bound — the
|
|
64
|
+
* "Maximum recursive updates exceeded" loop. So we key on a STABLE selection
|
|
65
|
+
* identity (the persisted key, or the ordered keys for multi), never the option
|
|
66
|
+
* payload: the data is irrelevant to identity and is swept wholesale whenever
|
|
67
|
+
* the selection actually changes. An unchanged selection is a no-op, which
|
|
68
|
+
* keeps the `selections` reference stable and cuts the feedback at the source.
|
|
69
|
+
*
|
|
70
|
+
* `resolved` returns the value to publish, or `undefined` when nothing resolves
|
|
71
|
+
* (cleared). `identity` projects that value to its stable selection key;
|
|
72
|
+
* `raw` projects it to the payload stored for siblings to read.
|
|
73
|
+
*/
|
|
74
|
+
export declare function publishSelection<T>(key: string, resolved: () => T | undefined, project: {
|
|
75
|
+
identity: (value: T) => string;
|
|
76
|
+
raw: (value: T) => unknown;
|
|
77
|
+
}): void;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { inject, onUnmounted, provide, shallowRef, watch } from "vue";
|
|
2
|
+
const SELECTIONS_KEY = Symbol("shwfed-selections");
|
|
3
|
+
function sameSelection(a, b) {
|
|
4
|
+
if (Object.is(a, b)) return true;
|
|
5
|
+
if (Array.isArray(a) && Array.isArray(b)) {
|
|
6
|
+
if (a.length !== b.length) return false;
|
|
7
|
+
return a.every((item, i) => Object.is(item, b[i]));
|
|
8
|
+
}
|
|
9
|
+
return false;
|
|
10
|
+
}
|
|
11
|
+
export function provideSelectionsRegistry() {
|
|
12
|
+
const entries = shallowRef({});
|
|
13
|
+
const registry = {
|
|
14
|
+
entries,
|
|
15
|
+
set: (uuid, option) => {
|
|
16
|
+
if (uuid in entries.value && sameSelection(entries.value[uuid], option)) return;
|
|
17
|
+
entries.value = { ...entries.value, [uuid]: option };
|
|
18
|
+
},
|
|
19
|
+
clear: (uuid) => {
|
|
20
|
+
if (!(uuid in entries.value)) return;
|
|
21
|
+
entries.value = Object.fromEntries(
|
|
22
|
+
Object.entries(entries.value).filter(([key]) => key !== uuid)
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
provide(SELECTIONS_KEY, registry);
|
|
27
|
+
return registry;
|
|
28
|
+
}
|
|
29
|
+
export function useSelectionsRegistry() {
|
|
30
|
+
return inject(SELECTIONS_KEY, void 0);
|
|
31
|
+
}
|
|
32
|
+
export function publishSelection(key, resolved, project) {
|
|
33
|
+
const registry = useSelectionsRegistry();
|
|
34
|
+
const NONE = "\0:none";
|
|
35
|
+
let last = "\0:init";
|
|
36
|
+
watch(
|
|
37
|
+
resolved,
|
|
38
|
+
(value) => {
|
|
39
|
+
if (!registry) return;
|
|
40
|
+
const id = value === void 0 ? NONE : project.identity(value);
|
|
41
|
+
if (id === last) return;
|
|
42
|
+
last = id;
|
|
43
|
+
if (value === void 0) registry.clear(key);
|
|
44
|
+
else registry.set(key, project.raw(value));
|
|
45
|
+
},
|
|
46
|
+
{ immediate: true }
|
|
47
|
+
);
|
|
48
|
+
onUnmounted(() => registry?.clear(key));
|
|
49
|
+
}
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{d as y,Q as U,a5 as w,z as v,I as e,H as n,b as s,S as _,K as F,a1 as H,a as E,U as c,V as u,W as d,X as p,J as m,Y as f,T as x,a2 as N,a3 as R,a4 as j}from"./index-DUOkekYu.js";const k={class:"flex flex-col gap-3"},D={class:"flex items-start gap-2"},$={class:"grid grid-cols-2 gap-3"},B=y({name:"ShwfedHttpRequestActionConfig",__name:"config",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(h){const o=U(h,"modelValue"),g=w(()=>{}),i=t=>R(g,t)??t,r=t=>j(g,t),S=["onSuccess","onWarning","onError","onInfo"];function T(t){const l={...o.value};t.length===0?delete l.messageExpression:l.messageExpression=t,o.value=l}function b(t){const l={...o.value};t.length===0?delete l.resultExpression:l.resultExpression=t,o.value=l}function V(t,l){const a={...o.value};l.length===0?Reflect.deleteProperty(a,t):a[t]=l,o.value=a}return(t,l)=>(E(),v("div",k,[e(s(x),{orientation:"vertical"},{default:n(()=>[e(s(c),{class:"text-xs text-zinc-500"},u({default:n(()=>[d(" "+p(i("expression")),1)]),_:2},[r("expression")?{name:"tooltip",fn:n(()=>[e(s(m),{source:r("expression"),block:"",class:"prose prose-sm prose-zinc"},null,8,["source"])]),key:"0"}:void 0]),1024),e(s(f),{"model-value":o.value.expression,multiline:"",placeholder:"例:http.post('/api/foo').body({ id: row.id })","result-type":"HttpRequest",class:"min-h-16","onUpdate:modelValue":l[0]||(l[0]=a=>o.value={...o.value,expression:a})},null,8,["model-value"])]),_:1}),_("div",D,[e(s(x),{orientation:"vertical",class:"flex-1 basis-0 min-w-0"},{default:n(()=>[e(s(c),{class:"text-xs text-zinc-500"},u({default:n(()=>[d(" "+p(i("messageExpression")),1)]),_:2},[r("messageExpression")?{name:"tooltip",fn:n(()=>[e(s(m),{source:r("messageExpression"),block:"",class:"prose prose-sm prose-zinc"},null,8,["source"])]),key:"0"}:void 0]),1024),e(s(f),{"model-value":o.value.messageExpression??"",placeholder:"例:string(json.message)","result-type":"string","extra-vars":{json:{type:"dyn",label:"HTTP 响应体(已解析 JSON)"}},"onUpdate:modelValue":T},null,8,["model-value"])]),_:1}),e(s(x),{orientation:"vertical",class:"flex-1 basis-0 min-w-0"},{default:n(()=>[e(s(c),{class:"text-xs text-zinc-500"},u({default:n(()=>[d(" "+p(i("resultExpression")),1)]),_:2},[r("resultExpression")?{name:"tooltip",fn:n(()=>[e(s(m),{source:r("resultExpression"),block:"",class:"prose prose-sm prose-zinc"},null,8,["source"])]),key:"0"}:void 0]),1024),e(s(f),{"model-value":o.value.resultExpression??"",placeholder:"例:json.code == 0 ? 'success' : 'error'","result-type":"string","extra-vars":{json:{type:"dyn",label:"HTTP 响应体(已解析 JSON)"}},"onUpdate:modelValue":b},null,8,["model-value"])]),_:1})]),_("div",$,[(E(),v(F,null,H(S,a=>e(s(x),{key:a,orientation:"vertical",class:"min-w-0"},{default:n(()=>[e(s(c),{class:"text-xs text-zinc-500"},u({default:n(()=>[d(" "+p(i(a)),1)]),_:2},[r(a)?{name:"tooltip",fn:n(()=>[e(s(m),{source:r(a),block:"",class:"prose prose-sm prose-zinc"},null,8,["source"])]),key:"0"}:void 0]),1024),e(N,{triggers:o.value[a]??[],"onUpdate:triggers":z=>V(a,z)},null,8,["triggers","onUpdate:triggers"])]),_:2},1024)),64))])]))}});export{B as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{d as v,Q as S,aD as h,a as V,z as k,I as s,H as l,b as t,U as r,V as u,W as d,X as p,J as m,Y as T,T as f,a2 as y,a3 as z,a4 as w}from"./index-DUOkekYu.js";const D={class:"flex flex-col gap-3"},b=v({name:"ShwfedStateWriteActionConfig",__name:"config",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(_){const o=S(_,"modelValue"),i=h(()=>{}),c=e=>z(i,e)??e,n=e=>w(i,e);function g(e){const a={...o.value};e.length===0?Reflect.deleteProperty(a,"onSuccess"):a.onSuccess=e,o.value=a}return(e,a)=>(V(),k("div",D,[s(t(f),{orientation:"vertical"},{default:l(()=>[s(t(r),{class:"text-xs text-zinc-500"},u({default:l(()=>[d(" "+p(c("expression")),1)]),_:2},[n("expression")?{name:"tooltip",fn:l(()=>[s(t(m),{source:n("expression"),block:"",class:"prose prose-sm prose-zinc"},null,8,["source"])]),key:"0"}:void 0]),1024),s(t(T),{"model-value":o.value.expression,multiline:"",placeholder:"例:{ invoices: rows, totalAmount: rows.map(r, r.amount).sum() }","result-type":"map",class:"min-h-16","onUpdate:modelValue":a[0]||(a[0]=x=>o.value={...o.value,expression:x})},null,8,["model-value"])]),_:1}),s(t(f),{orientation:"vertical"},{default:l(()=>[s(t(r),{class:"text-xs text-zinc-500"},u({default:l(()=>[d(" "+p(c("onSuccess")),1)]),_:2},[n("onSuccess")?{name:"tooltip",fn:l(()=>[s(t(m),{source:n("onSuccess"),block:"",class:"prose prose-sm prose-zinc"},null,8,["source"])]),key:"0"}:void 0]),1024),s(y,{triggers:o.value.onSuccess??[],"onUpdate:triggers":g},null,8,["triggers"])]),_:1})]))}});export{b as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{d as y,a as z,z as E,x as V,O as T,b as e,P as U,Q as $,R as j,c as F,H as l,S as v,I as s,T as d,U as u,V as p,W as m,X as f,J as g,Y as b,Z as h,$ as B,a0 as C,K as H,a1 as N,a2 as O,a3 as R,a4 as D}from"./index-DUOkekYu.js";const P=y({__name:"FieldGroup",props:{class:{type:[Boolean,null,String,Object,Array]}},setup(_){const r=_;return(x,i)=>(z(),E("div",{"data-slot":"field-group",class:T(e(U)("group/field-group @container/field-group flex w-full flex-col gap-7 data-[slot=checkbox-group]:gap-3 *:data-[slot=field-group]:gap-4",r.class))},[V(x.$slots,"default")],2))}}),q={class:"grid grid-cols-2 gap-4"},I={class:"grid grid-cols-2 gap-4"},J={class:"flex items-start gap-2"},L={class:"grid grid-cols-2 gap-3"},M=y({name:"ShwfedHttpRequestConfirmActionConfig",__name:"config",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(_){const r=$(_,"modelValue"),x=j(()=>{}),i=n=>R(x,n)??n,a=n=>D(x,n);function c(n){const t={...r.value,...n};for(const[o,k]of Object.entries(n))k===void 0&&Reflect.deleteProperty(t,o);r.value=t}const S=["onSuccess","onWarning","onError","onInfo"];function w(n,t){c({[n]:t.length===0?void 0:t})}return(n,t)=>(z(),F(e(P),null,{default:l(()=>[v("div",q,[s(e(d),{orientation:"vertical"},{default:l(()=>[s(e(u),{class:"text-xs text-zinc-500"},p({default:l(()=>[m(" "+f(i("expression")),1)]),_:2},[a("expression")?{name:"tooltip",fn:l(()=>[s(e(g),{source:a("expression"),block:"",class:"prose prose-sm prose-zinc"},null,8,["source"])]),key:"0"}:void 0]),1024),s(e(b),{"model-value":r.value.expression,multiline:"",placeholder:"例:http.post('/api/foo').body({ id: row.id })","result-type":"HttpRequest",class:"min-h-16","onUpdate:modelValue":t[0]||(t[0]=o=>c({expression:o}))},null,8,["model-value"])]),_:1}),s(e(d),{orientation:"vertical"},{default:l(()=>[s(e(u),{class:"text-xs text-zinc-500"},p({default:l(()=>[m(" "+f(i("markdown")),1)]),_:2},[a("markdown")?{name:"tooltip",fn:l(()=>[s(e(g),{source:a("markdown"),block:"",class:"prose prose-sm prose-zinc"},null,8,["source"])]),key:"0"}:void 0]),1024),s(e(h),{markdown:"","model-value":r.value.markdown,"onUpdate:modelValue":t[1]||(t[1]=o=>c({markdown:o}))},null,8,["model-value"])]),_:1})]),v("div",I,[s(e(d),{orientation:"vertical"},{default:l(()=>[s(e(u),{class:"text-xs text-zinc-500"},p({default:l(()=>[m(" "+f(i("icon")),1)]),_:2},[a("icon")?{name:"tooltip",fn:l(()=>[s(e(g),{source:a("icon"),block:"",class:"prose prose-sm prose-zinc"},null,8,["source"])]),key:"0"}:void 0]),1024),s(e(B),{"model-value":r.value.icon??"","onUpdate:modelValue":t[2]||(t[2]=o=>c(o.trim()===""?{icon:void 0}:{icon:o}))},null,8,["model-value"])]),_:1}),s(e(d),{orientation:"vertical"},{default:l(()=>[s(e(u),{class:"text-xs text-zinc-500"},p({default:l(()=>[m(" "+f(i("color")),1)]),_:2},[a("color")?{name:"tooltip",fn:l(()=>[s(e(g),{source:a("color"),block:"",class:"prose prose-sm prose-zinc"},null,8,["source"])]),key:"0"}:void 0]),1024),s(e(C),{"model-value":r.value.color??"","onUpdate:modelValue":t[3]||(t[3]=o=>c(o.trim()===""?{color:void 0}:{color:o}))},null,8,["model-value"])]),_:1})]),v("div",J,[s(e(d),{orientation:"vertical",class:"flex-1 basis-0 min-w-0"},{default:l(()=>[s(e(u),{class:"text-xs text-zinc-500"},p({default:l(()=>[m(" "+f(i("messageExpression")),1)]),_:2},[a("messageExpression")?{name:"tooltip",fn:l(()=>[s(e(g),{source:a("messageExpression"),block:"",class:"prose prose-sm prose-zinc"},null,8,["source"])]),key:"0"}:void 0]),1024),s(e(b),{"model-value":r.value.messageExpression??"",placeholder:"例:string(json.message)","result-type":"string","extra-vars":{json:{type:"dyn",label:"HTTP 响应体(已解析 JSON)"}},"onUpdate:modelValue":t[4]||(t[4]=o=>c({messageExpression:o===""?void 0:o}))},null,8,["model-value"])]),_:1}),s(e(d),{orientation:"vertical",class:"flex-1 basis-0 min-w-0"},{default:l(()=>[s(e(u),{class:"text-xs text-zinc-500"},p({default:l(()=>[m(" "+f(i("resultExpression")),1)]),_:2},[a("resultExpression")?{name:"tooltip",fn:l(()=>[s(e(g),{source:a("resultExpression"),block:"",class:"prose prose-sm prose-zinc"},null,8,["source"])]),key:"0"}:void 0]),1024),s(e(b),{"model-value":r.value.resultExpression??"",placeholder:"例:json.code == 0 ? 'success' : 'error'","result-type":"string","extra-vars":{json:{type:"dyn",label:"HTTP 响应体(已解析 JSON)"}},"onUpdate:modelValue":t[5]||(t[5]=o=>c({resultExpression:o===""?void 0:o}))},null,8,["model-value"])]),_:1})]),v("div",L,[(z(),E(H,null,N(S,o=>s(e(d),{key:o,orientation:"vertical",class:"min-w-0"},{default:l(()=>[s(e(u),{class:"text-xs text-zinc-500"},p({default:l(()=>[m(" "+f(i(o)),1)]),_:2},[a(o)?{name:"tooltip",fn:l(()=>[s(e(g),{source:a(o),block:"",class:"prose prose-sm prose-zinc"},null,8,["source"])]),key:"0"}:void 0]),1024),s(O,{triggers:r.value[o]??[],"onUpdate:triggers":k=>w(o,k)},null,8,["triggers","onUpdate:triggers"])]),_:2},1024)),64))])]),_:1}))}});export{M as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{d as g,Q as d,a3 as u,aA as f,z as m,I as s,H as i,b as r,a as p,U as _,W as v,X as x,a2 as h,T,e as V}from"./index-DUOkekYu.js";const C={class:"flex flex-col gap-3"},k=g({name:"ShwfedEventDispatchActionConfig",__name:"config",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(l){const t=d(l,"modelValue"),o=u(f(),"triggers")??"触发的操作",n=V(()=>t.value.triggers??[]);function c(a){const e={...t.value};a.length===0?Reflect.deleteProperty(e,"triggers"):e.triggers=a,t.value=e}return(a,e)=>(p(),m("div",C,[s(r(T),{orientation:"vertical"},{default:i(()=>[s(r(_),{class:"text-xs text-zinc-500"},{default:i(()=>[v(x(r(o)),1)]),_:1}),s(h,{triggers:n.value,"onUpdate:triggers":c},null,8,["triggers"])]),_:1})]))}});export{k as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{d as U,Q as k,aB as y,z as w,S as x,I as t,H as n,b as s,K as D,a1 as C,a as z,U as i,W as u,J as c,Y as d,T as p,aC as g,V as f,X as _,a2 as F,a3 as H,a4 as B,e as S}from"./index-DUOkekYu.js";const L={class:"flex flex-col gap-3"},N={class:"grid grid-cols-2 gap-3"},$={class:"flex items-start gap-2"},I={class:"grid grid-cols-2 gap-3"},A=U({name:"ShwfedHttpDownloadActionConfig",__name:"config",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(q){const l=k(q,"modelValue"),E=y(()=>{}),m=a=>H(E,a)??a,r=a=>B(E,a),T=["onSuccess","onWarning","onError","onInfo"],h=S({get:()=>l.value.template?.request??"",set:a=>{l.value={...l.value,template:{...l.value.template,request:a}}}}),V=S({get:()=>l.value.template?.download??"",set:a=>{const e=l.value.template??{request:""};if(a.length===0){const{download:o,...v}=e;l.value={...l.value,template:v}}else l.value={...l.value,template:{...e,download:a}}}});function b(a){const e={...l.value};a.length===0?delete e.messageExpression:e.messageExpression=a,l.value=e}function j(a){const e={...l.value};a.length===0?delete e.resultExpression:e.resultExpression=a,l.value=e}function R(a,e){const o={...l.value};e.length===0?Reflect.deleteProperty(o,a):o[a]=e,l.value=o}return(a,e)=>(z(),w("div",L,[x("div",N,[t(s(p),{orientation:"vertical"},{default:n(()=>[t(s(i),{class:"text-xs text-zinc-500"},{tooltip:n(()=>[t(s(c),{source:r("template")??"返回 `HttpRequest` 的 CEL 表达式;未配置「下载请求」时直接下载其响应",block:"",class:"prose prose-sm prose-zinc"},null,8,["source"])]),default:n(()=>[e[2]||(e[2]=u(" 请求 ",-1))]),_:1}),t(s(d),{"model-value":h.value,multiline:"",placeholder:"例:http.get('https://api.example.com/files/123')","result-type":"HttpRequest",class:"min-h-16","onUpdate:modelValue":e[0]||(e[0]=o=>h.value=o)},null,8,["model-value"])]),_:1}),t(s(p),{orientation:"vertical"},{default:n(()=>[t(s(i),{class:"text-xs text-zinc-500"},{tooltip:n(()=>[t(s(c),{source:"可选的第二步:用第一步响应 `json` 中的凭据构造真正的下载请求,例如 `json.data.key`",block:"",class:"prose prose-sm prose-zinc"})]),default:n(()=>[e[3]||(e[3]=u(" 下载请求 ",-1))]),_:1}),t(s(d),{"model-value":V.value,multiline:"",placeholder:"例:http.get('https://api.example.com/download').query('key', json.data.key)","result-type":"HttpRequest","extra-vars":{json:s(g)},class:"min-h-16","onUpdate:modelValue":e[1]||(e[1]=o=>V.value=o)},null,8,["model-value","extra-vars"])]),_:1})]),x("div",$,[t(s(p),{orientation:"vertical",class:"flex-1 basis-0 min-w-0"},{default:n(()=>[t(s(i),{class:"text-xs text-zinc-500"},f({default:n(()=>[u(" "+_(m("messageExpression")),1)]),_:2},[r("messageExpression")?{name:"tooltip",fn:n(()=>[t(s(c),{source:r("messageExpression"),block:"",class:"prose prose-sm prose-zinc"},null,8,["source"])]),key:"0"}:void 0]),1024),t(s(d),{"model-value":l.value.messageExpression??"",placeholder:"例:string(json.message)","result-type":"string","extra-vars":{json:s(g)},"onUpdate:modelValue":b},null,8,["model-value","extra-vars"])]),_:1}),t(s(p),{orientation:"vertical",class:"flex-1 basis-0 min-w-0"},{default:n(()=>[t(s(i),{class:"text-xs text-zinc-500"},f({default:n(()=>[u(" "+_(m("resultExpression")),1)]),_:2},[r("resultExpression")?{name:"tooltip",fn:n(()=>[t(s(c),{source:r("resultExpression"),block:"",class:"prose prose-sm prose-zinc"},null,8,["source"])]),key:"0"}:void 0]),1024),t(s(d),{"model-value":l.value.resultExpression??"",placeholder:"例:json.code == 0 ? 'success' : 'error'","result-type":"string","extra-vars":{json:s(g)},"onUpdate:modelValue":j},null,8,["model-value","extra-vars"])]),_:1})]),x("div",I,[(z(),w(D,null,C(T,o=>t(s(p),{key:o,orientation:"vertical",class:"min-w-0"},{default:n(()=>[t(s(i),{class:"text-xs text-zinc-500"},f({default:n(()=>[u(" "+_(m(o)),1)]),_:2},[r(o)?{name:"tooltip",fn:n(()=>[t(s(c),{source:r(o),block:"",class:"prose prose-sm prose-zinc"},null,8,["source"])]),key:"0"}:void 0]),1024),t(F,{triggers:l.value[o]??[],"onUpdate:triggers":v=>R(o,v)},null,8,["triggers","onUpdate:triggers"])]),_:2},1024)),64))])]))}});export{A as default};
|