@shwfed/config 2.9.4 → 2.9.6
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 +558 -102
- package/dist/module.json +1 -1
- package/dist/module.mjs +1 -0
- package/dist/preview/assets/FieldGroup.vue_vue_type_script_setup_true_lang-B-Cwm94m.js +1 -0
- package/dist/preview/assets/badge-nn3uvUrR.js +1 -0
- package/dist/preview/assets/config-BNQXbhtM.js +1 -0
- package/dist/preview/assets/config-Bg95dd9K.js +1 -0
- package/dist/preview/assets/config-C6LousLT.js +1 -0
- package/dist/preview/assets/config-CGhV-PCy.js +1 -0
- package/dist/preview/assets/config-CUkEZF8G.js +1 -0
- package/dist/preview/assets/config-DO77XC7j.js +1 -0
- package/dist/preview/assets/config-DbjXscRV.js +1 -0
- package/dist/preview/assets/config-DiD-8mMw.js +1 -0
- package/dist/preview/assets/config-Dvq_Xh7I.js +1 -0
- package/dist/preview/assets/config-d8ZhbBPg.js +1 -0
- package/dist/preview/assets/config-e8Li9jh4.js +1 -0
- package/dist/preview/assets/definition.vue_vue_type_script_setup_true_lang-DuO-EwWA.js +1 -0
- package/dist/preview/assets/{index-cyMSopN_.js → index-Bpap7h0Q.js} +217 -186
- package/dist/preview/assets/{index-CHkjJPVP.js → index-DZyYLnIs.js} +1 -1
- package/dist/preview/assets/index-jHSCIEVi.js +1 -0
- package/dist/preview/assets/index-vPcvbp7e.css +1 -0
- package/dist/preview/assets/item-BqnYkxMr.js +1 -0
- package/dist/preview/assets/{runtime-Dy1bI4VO.js → runtime-BFAxoqEC.js} +1 -1
- package/dist/preview/assets/runtime-BntIEgRD.js +1 -0
- package/dist/preview/assets/{runtime-lZLYBBgn.js → runtime-Bu6BEaxq.js} +1 -1
- package/dist/preview/assets/runtime-CfdnDil3.js +1 -0
- package/dist/preview/assets/runtime-CqoGHW0U.js +1 -0
- package/dist/preview/assets/runtime-D6blej8e.js +1 -0
- package/dist/preview/assets/runtime-DEsY0ihh.js +1 -0
- package/dist/preview/assets/runtime-DrnADq2i.js +1 -0
- package/dist/preview/assets/runtime-JW4LSnRF.js +1 -0
- package/dist/preview/assets/runtime-U7gyBbWI.js +1 -0
- 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 +20 -0
- package/dist/runtime/components/actions/buttons/2026-04-18/com.shwfed.actions.button.http.request.json/config.vue.d.ts +20 -0
- package/dist/runtime/components/actions/buttons/2026-04-18/com.shwfed.actions.button.http.request.json/schema.d.ts +22 -0
- package/dist/runtime/components/actions/buttons/2026-04-18/com.shwfed.actions.button.http.request.json/schema.js +33 -1
- package/dist/runtime/components/actions/buttons/2026-04-18/com.shwfed.actions.button.http.request.json.confirm/config.d.vue.ts +20 -0
- package/dist/runtime/components/actions/buttons/2026-04-18/com.shwfed.actions.button.http.request.json.confirm/config.vue.d.ts +20 -0
- package/dist/runtime/components/actions/buttons/2026-04-18/com.shwfed.actions.button.http.request.json.confirm/schema.d.ts +10 -0
- package/dist/runtime/components/actions/buttons/2026-05-15/com.shwfed.actions.button.event.dispatch/config.d.vue.ts +4 -0
- package/dist/runtime/components/actions/buttons/2026-05-15/com.shwfed.actions.button.event.dispatch/config.vue.d.ts +4 -0
- package/dist/runtime/components/actions/buttons/2026-05-15/com.shwfed.actions.button.event.dispatch/schema.d.ts +2 -0
- package/dist/runtime/components/actions/buttons/2026-05-21/com.shwfed.actions.button.http.download/config.d.vue.ts +16 -0
- package/dist/runtime/components/actions/buttons/2026-05-21/com.shwfed.actions.button.http.download/config.vue.d.ts +16 -0
- package/dist/runtime/components/actions/buttons/2026-05-21/com.shwfed.actions.button.http.download/schema.d.ts +8 -0
- package/dist/runtime/components/actions/buttons/2026-05-24/com.shwfed.actions.button.state.write/config.d.vue.ts +4 -0
- package/dist/runtime/components/actions/buttons/2026-05-24/com.shwfed.actions.button.state.write/config.vue.d.ts +4 -0
- package/dist/runtime/components/actions/buttons/2026-05-24/com.shwfed.actions.button.state.write/schema.d.ts +2 -0
- package/dist/runtime/components/actions/buttons/2026-06-08/com.shwfed.actions.button.http.request.json.batch/config.d.vue.ts +51 -0
- package/dist/runtime/components/actions/buttons/2026-06-08/com.shwfed.actions.button.http.request.json.batch/config.vue +201 -0
- package/dist/runtime/components/actions/buttons/2026-06-08/com.shwfed.actions.button.http.request.json.batch/config.vue.d.ts +51 -0
- package/dist/runtime/components/actions/buttons/2026-06-08/com.shwfed.actions.button.http.request.json.batch/runtime.d.vue.ts +8 -0
- package/dist/runtime/components/actions/buttons/2026-06-08/com.shwfed.actions.button.http.request.json.batch/runtime.vue +37 -0
- package/dist/runtime/components/actions/buttons/2026-06-08/com.shwfed.actions.button.http.request.json.batch/runtime.vue.d.ts +8 -0
- package/dist/runtime/components/actions/buttons/2026-06-08/com.shwfed.actions.button.http.request.json.batch/schema.d.ts +30 -0
- package/dist/runtime/components/actions/buttons/2026-06-08/com.shwfed.actions.button.http.request.json.batch/schema.js +87 -0
- package/dist/runtime/components/actions/components/triggers-field.d.vue.ts +4 -0
- package/dist/runtime/components/actions/components/triggers-field.vue +65 -7
- package/dist/runtime/components/actions/components/triggers-field.vue.d.ts +4 -0
- package/dist/runtime/components/actions/config.vue +68 -1
- package/dist/runtime/components/actions/utils/resolve.d.ts +85 -2
- package/dist/runtime/components/actions/utils/resolve.js +122 -21
- package/dist/runtime/components/app.vue +59 -4
- package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.table/config.d.vue.ts +2 -2
- package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.table/config.vue.d.ts +2 -2
- package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.table/runtime.d.vue.ts +2 -2
- package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.table/runtime.vue.d.ts +2 -2
- package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.table/schema.d.ts +1 -1
- package/dist/runtime/components/config/index.vue +9 -2
- package/dist/runtime/components/config/schema.d.ts +6 -10
- package/dist/runtime/components/config/schema.js +12 -2
- package/dist/runtime/components/form/fields/2026-04-28/com.shwfed.form.field.number/config.d.vue.ts +2 -2
- package/dist/runtime/components/form/fields/2026-04-28/com.shwfed.form.field.number/config.vue.d.ts +2 -2
- package/dist/runtime/components/form/fields/2026-04-28/com.shwfed.form.field.numberrange/config.d.vue.ts +2 -2
- package/dist/runtime/components/form/fields/2026-04-28/com.shwfed.form.field.numberrange/config.vue.d.ts +2 -2
- package/dist/runtime/components/form/fields/2026-05-13/com.shwfed.form.field.list/config.d.vue.ts +2 -2
- package/dist/runtime/components/form/fields/2026-05-13/com.shwfed.form.field.list/config.vue.d.ts +2 -2
- package/dist/runtime/components/form/fields/2026-05-13/com.shwfed.form.field.list/schema.d.ts +1 -1
- package/dist/runtime/components/operations/2026-06-09/com.shwfed.operation.alert/config.d.vue.ts +31 -0
- package/dist/runtime/components/operations/2026-06-09/com.shwfed.operation.alert/config.vue +89 -0
- package/dist/runtime/components/operations/2026-06-09/com.shwfed.operation.alert/config.vue.d.ts +31 -0
- package/dist/runtime/components/operations/2026-06-09/com.shwfed.operation.alert/runtime.d.ts +2 -0
- package/dist/runtime/components/operations/2026-06-09/com.shwfed.operation.alert/runtime.js +14 -0
- package/dist/runtime/components/operations/2026-06-09/com.shwfed.operation.alert/schema.d.ts +21 -0
- package/dist/runtime/components/operations/2026-06-09/com.shwfed.operation.alert/schema.js +36 -0
- package/dist/runtime/components/operations/utils/resolve.d.ts +48 -0
- package/dist/runtime/components/operations/utils/resolve.js +76 -0
- package/dist/runtime/components/table/columns/2026-05-13/com.shwfed.table.column.switch/schema.d.ts +2 -0
- package/dist/runtime/components/table/columns/2026-05-13/com.shwfed.table.column.switch.remote/schema.d.ts +2 -0
- package/dist/runtime/components/table/columns/2026-05-24/com.shwfed.table.column.combobox-single.remote.options-remote/config.d.vue.ts +4 -0
- package/dist/runtime/components/table/columns/2026-05-24/com.shwfed.table.column.combobox-single.remote.options-remote/config.vue.d.ts +4 -0
- package/dist/runtime/components/table/columns/2026-05-24/com.shwfed.table.column.combobox-single.remote.options-remote/schema.d.ts +2 -0
- package/dist/runtime/components/table/columns/2026-05-24/com.shwfed.table.column.combobox-single.remote.options-static/config.d.vue.ts +4 -0
- package/dist/runtime/components/table/columns/2026-05-24/com.shwfed.table.column.combobox-single.remote.options-static/config.vue.d.ts +4 -0
- package/dist/runtime/components/table/columns/2026-05-24/com.shwfed.table.column.combobox-single.remote.options-static/schema.d.ts +2 -0
- package/dist/runtime/components/table/columns/2026-05-25/com.shwfed.table.column.combobox-multi.remote.options-remote/config.d.vue.ts +4 -0
- package/dist/runtime/components/table/columns/2026-05-25/com.shwfed.table.column.combobox-multi.remote.options-remote/config.vue.d.ts +4 -0
- package/dist/runtime/components/table/columns/2026-05-25/com.shwfed.table.column.combobox-multi.remote.options-remote/schema.d.ts +2 -0
- package/dist/runtime/components/table/columns/2026-05-25/com.shwfed.table.column.combobox-multi.remote.options-static/config.d.vue.ts +4 -0
- package/dist/runtime/components/table/columns/2026-05-25/com.shwfed.table.column.combobox-multi.remote.options-static/config.vue.d.ts +4 -0
- package/dist/runtime/components/table/columns/2026-05-25/com.shwfed.table.column.combobox-multi.remote.options-static/schema.d.ts +2 -0
- package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-multi.remote/config.d.vue.ts +4 -0
- package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-multi.remote/config.vue.d.ts +4 -0
- package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-multi.remote/schema.d.ts +2 -0
- package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-single.remote/config.d.vue.ts +4 -0
- package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-single.remote/config.vue.d.ts +4 -0
- package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-single.remote/schema.d.ts +2 -0
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-multi/config.d.vue.ts +4 -0
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-multi/config.vue.d.ts +4 -0
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-multi/schema.d.ts +4 -0
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-single/config.d.vue.ts +4 -0
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-single/config.vue.d.ts +4 -0
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-single/schema.d.ts +4 -0
- package/dist/runtime/components/table/schema.d.ts +2 -2
- package/dist/runtime/components/ui/progress/Progress.d.vue.ts +11 -0
- package/dist/runtime/components/ui/progress/Progress.vue +32 -0
- package/dist/runtime/components/ui/progress/Progress.vue.d.ts +11 -0
- package/dist/runtime/components/ui/progress/index.d.ts +1 -0
- package/dist/runtime/components/ui/progress/index.js +1 -0
- package/dist/runtime/composables/useOverlay.d.ts +35 -0
- package/dist/runtime/composables/useOverlay.js +52 -0
- package/dist/runtime/share/event-bus.d.ts +24 -2
- package/dist/runtime/share/event-bus.js +21 -3
- package/dist/runtime/share/interpolate.d.ts +12 -0
- package/dist/runtime/share/interpolate.js +18 -0
- package/dist/runtime/share/page-target.d.ts +16 -0
- package/dist/runtime/share/page-target.js +1 -0
- package/dist/runtime/share/schema-meta.d.ts +5 -0
- package/dist/runtime/share/schema-meta.js +48 -0
- package/dist/runtime/style.css +1 -1
- package/package.json +1 -1
- package/dist/preview/assets/badge-Nmf0QGvo.js +0 -1
- package/dist/preview/assets/config-BuBQPlju.js +0 -1
- package/dist/preview/assets/config-CBxDLjqQ.js +0 -1
- package/dist/preview/assets/config-CSU0Tuu4.js +0 -1
- package/dist/preview/assets/config-Cnu3ZCPF.js +0 -1
- package/dist/preview/assets/config-CzBP2y8L.js +0 -1
- package/dist/preview/assets/config-nczxdERQ.js +0 -1
- package/dist/preview/assets/config-qCPGn6mB.js +0 -1
- package/dist/preview/assets/config-vHYVnzyt.js +0 -1
- package/dist/preview/assets/config-w2mvI_4h.js +0 -1
- package/dist/preview/assets/definition.vue_vue_type_script_setup_true_lang-DqE0YNVF.js +0 -1
- package/dist/preview/assets/index-BgvMBKzp.js +0 -1
- package/dist/preview/assets/index-COSjWreD.css +0 -1
- package/dist/preview/assets/item-DAL4Ui_l.js +0 -1
- package/dist/preview/assets/runtime-BcsMOkA2.js +0 -1
- package/dist/preview/assets/runtime-BzwoxDCd.js +0 -1
- package/dist/preview/assets/runtime-Cu2DKoI0.js +0 -1
- package/dist/preview/assets/runtime-Dp0JEFtU.js +0 -1
- package/dist/preview/assets/runtime-YE1oXXQN.js +0 -1
- package/dist/preview/assets/runtime-YRSxexBQ.js +0 -1
- package/dist/preview/assets/runtime-uwt0BxpS.js +0 -1
|
@@ -13,6 +13,8 @@ export declare function schema(configure: (env: Environment) => void): Schema.St
|
|
|
13
13
|
onSuccess: Schema.optional<Schema.Array$<Schema.Struct<{
|
|
14
14
|
target: Schema.refine<string, typeof Schema.String>;
|
|
15
15
|
operation: Schema.SchemaClass<string, string, never>;
|
|
16
|
+
compatibilityDate: Schema.optional<Schema.SchemaClass<string, string, never>>;
|
|
17
|
+
params: Schema.optional<Schema.SchemaClass<unknown, unknown, never>>;
|
|
16
18
|
}>>>;
|
|
17
19
|
}>;
|
|
18
20
|
export type Value = Schema.Schema.Type<ReturnType<typeof schema>>;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { type Value } from './schema.js';
|
|
2
|
+
type __VLS_ModelProps = {
|
|
3
|
+
modelValue: Value;
|
|
4
|
+
};
|
|
5
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
6
|
+
"update:modelValue": (value: {
|
|
7
|
+
readonly type: "com.shwfed.actions.button.http.request.json.batch";
|
|
8
|
+
readonly compatibilityDate: "2026-06-08";
|
|
9
|
+
readonly messageExpression?: string | undefined;
|
|
10
|
+
readonly resultExpression?: string | undefined;
|
|
11
|
+
readonly continueOnError?: boolean | undefined;
|
|
12
|
+
readonly markdown?: readonly [{
|
|
13
|
+
readonly locale: "zh";
|
|
14
|
+
readonly message: string;
|
|
15
|
+
}, ...{
|
|
16
|
+
readonly locale: "en" | "ja" | "ko";
|
|
17
|
+
readonly message: string;
|
|
18
|
+
}[]] | undefined;
|
|
19
|
+
readonly before?: readonly {
|
|
20
|
+
readonly params?: unknown;
|
|
21
|
+
readonly compatibilityDate?: string | undefined;
|
|
22
|
+
readonly target: string;
|
|
23
|
+
readonly operation: string;
|
|
24
|
+
}[] | undefined;
|
|
25
|
+
readonly expression: string;
|
|
26
|
+
}) => any;
|
|
27
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_ModelProps> & Readonly<{
|
|
28
|
+
"onUpdate:modelValue"?: ((value: {
|
|
29
|
+
readonly type: "com.shwfed.actions.button.http.request.json.batch";
|
|
30
|
+
readonly compatibilityDate: "2026-06-08";
|
|
31
|
+
readonly messageExpression?: string | undefined;
|
|
32
|
+
readonly resultExpression?: string | undefined;
|
|
33
|
+
readonly continueOnError?: boolean | undefined;
|
|
34
|
+
readonly markdown?: readonly [{
|
|
35
|
+
readonly locale: "zh";
|
|
36
|
+
readonly message: string;
|
|
37
|
+
}, ...{
|
|
38
|
+
readonly locale: "en" | "ja" | "ko";
|
|
39
|
+
readonly message: string;
|
|
40
|
+
}[]] | undefined;
|
|
41
|
+
readonly before?: readonly {
|
|
42
|
+
readonly params?: unknown;
|
|
43
|
+
readonly compatibilityDate?: string | undefined;
|
|
44
|
+
readonly target: string;
|
|
45
|
+
readonly operation: string;
|
|
46
|
+
}[] | undefined;
|
|
47
|
+
readonly expression: string;
|
|
48
|
+
}) => any) | undefined;
|
|
49
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
50
|
+
declare const _default: typeof __VLS_export;
|
|
51
|
+
export default _default;
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { Field, FieldLabel } from "../../../../ui/field";
|
|
3
|
+
import { ExpressionEditor } from "../../../../ui/expression-editor";
|
|
4
|
+
import { Locale as LocaleField } from "../../../../ui/locale";
|
|
5
|
+
import { Switch } from "../../../../ui/switch";
|
|
6
|
+
import { Markdown } from "../../../../ui/markdown";
|
|
7
|
+
import { getStructFieldDescription, getStructFieldTitle } from "../../../schema";
|
|
8
|
+
import TriggersField from "../../../components/triggers-field.vue";
|
|
9
|
+
import { schema } from "./schema";
|
|
10
|
+
defineOptions({ name: "ShwfedHttpRequestBatchActionConfig" });
|
|
11
|
+
const value = defineModel({ type: null, ...{ required: true } });
|
|
12
|
+
const actionSchema = schema(() => {
|
|
13
|
+
});
|
|
14
|
+
const fieldTitle = (f) => getStructFieldTitle(actionSchema, f) ?? f;
|
|
15
|
+
const fieldDescription = (f) => getStructFieldDescription(actionSchema, f);
|
|
16
|
+
function updateMessageExpression(v) {
|
|
17
|
+
const next = { ...value.value };
|
|
18
|
+
if (v.length === 0) delete next.messageExpression;
|
|
19
|
+
else next.messageExpression = v;
|
|
20
|
+
value.value = next;
|
|
21
|
+
}
|
|
22
|
+
function updateResultExpression(v) {
|
|
23
|
+
const next = { ...value.value };
|
|
24
|
+
if (v.length === 0) delete next.resultExpression;
|
|
25
|
+
else next.resultExpression = v;
|
|
26
|
+
value.value = next;
|
|
27
|
+
}
|
|
28
|
+
function updateBefore(next) {
|
|
29
|
+
const draft = { ...value.value };
|
|
30
|
+
if (next.length === 0) Reflect.deleteProperty(draft, "before");
|
|
31
|
+
else draft.before = next;
|
|
32
|
+
value.value = draft;
|
|
33
|
+
}
|
|
34
|
+
function updateMarkdown(next) {
|
|
35
|
+
const draft = { ...value.value };
|
|
36
|
+
if (!next || next.length === 0) delete draft.markdown;
|
|
37
|
+
else draft.markdown = next;
|
|
38
|
+
value.value = draft;
|
|
39
|
+
}
|
|
40
|
+
function updateContinueOnError(v) {
|
|
41
|
+
const next = { ...value.value };
|
|
42
|
+
if (v) next.continueOnError = true;
|
|
43
|
+
else delete next.continueOnError;
|
|
44
|
+
value.value = next;
|
|
45
|
+
}
|
|
46
|
+
</script>
|
|
47
|
+
|
|
48
|
+
<template>
|
|
49
|
+
<div class="flex flex-col gap-3">
|
|
50
|
+
<Field orientation="vertical">
|
|
51
|
+
<FieldLabel class="text-xs text-zinc-500">
|
|
52
|
+
<template
|
|
53
|
+
v-if="fieldDescription('expression')"
|
|
54
|
+
#tooltip
|
|
55
|
+
>
|
|
56
|
+
<Markdown
|
|
57
|
+
:source="fieldDescription('expression')"
|
|
58
|
+
block
|
|
59
|
+
class="prose prose-sm prose-zinc"
|
|
60
|
+
/>
|
|
61
|
+
</template>
|
|
62
|
+
{{ fieldTitle("expression") }}
|
|
63
|
+
</FieldLabel>
|
|
64
|
+
<ExpressionEditor
|
|
65
|
+
:model-value="value.expression"
|
|
66
|
+
multiline
|
|
67
|
+
placeholder="例:range(1, 10).map(i, http.post('/api/foo').body({ id: i }))"
|
|
68
|
+
result-type="list"
|
|
69
|
+
class="min-h-16"
|
|
70
|
+
@update:model-value="(v) => value = { ...value, expression: v }"
|
|
71
|
+
/>
|
|
72
|
+
</Field>
|
|
73
|
+
|
|
74
|
+
<div class="grid grid-cols-2 gap-3 items-start">
|
|
75
|
+
<!-- Pre-request triggers: run before the batch fires. A halting op
|
|
76
|
+
(e.g. the enclosing form's 校验) aborts the whole batch. -->
|
|
77
|
+
<Field
|
|
78
|
+
orientation="vertical"
|
|
79
|
+
class="min-w-0"
|
|
80
|
+
>
|
|
81
|
+
<FieldLabel class="text-xs text-zinc-500">
|
|
82
|
+
<template
|
|
83
|
+
v-if="fieldDescription('before')"
|
|
84
|
+
#tooltip
|
|
85
|
+
>
|
|
86
|
+
<Markdown
|
|
87
|
+
:source="fieldDescription('before')"
|
|
88
|
+
block
|
|
89
|
+
class="prose prose-sm prose-zinc"
|
|
90
|
+
/>
|
|
91
|
+
</template>
|
|
92
|
+
{{ fieldTitle("before") }}
|
|
93
|
+
</FieldLabel>
|
|
94
|
+
<TriggersField
|
|
95
|
+
:triggers="value.before ?? []"
|
|
96
|
+
@update:triggers="(v) => updateBefore(v)"
|
|
97
|
+
/>
|
|
98
|
+
</Field>
|
|
99
|
+
|
|
100
|
+
<!-- Progress-dialog body: localized markdown, interpolated with the live
|
|
101
|
+
total / succeeded / failure counters as the batch runs. -->
|
|
102
|
+
<Field
|
|
103
|
+
orientation="vertical"
|
|
104
|
+
class="min-w-0"
|
|
105
|
+
>
|
|
106
|
+
<FieldLabel class="text-xs text-zinc-500">
|
|
107
|
+
<template
|
|
108
|
+
v-if="fieldDescription('markdown')"
|
|
109
|
+
#tooltip
|
|
110
|
+
>
|
|
111
|
+
<Markdown
|
|
112
|
+
:source="fieldDescription('markdown')"
|
|
113
|
+
block
|
|
114
|
+
class="prose prose-sm prose-zinc"
|
|
115
|
+
/>
|
|
116
|
+
</template>
|
|
117
|
+
{{ fieldTitle("markdown") }}
|
|
118
|
+
</FieldLabel>
|
|
119
|
+
<LocaleField
|
|
120
|
+
markdown
|
|
121
|
+
:model-value="value.markdown"
|
|
122
|
+
@update:model-value="updateMarkdown"
|
|
123
|
+
/>
|
|
124
|
+
</Field>
|
|
125
|
+
</div>
|
|
126
|
+
|
|
127
|
+
<Field orientation="horizontal">
|
|
128
|
+
<FieldLabel class="text-xs text-zinc-500">
|
|
129
|
+
<template
|
|
130
|
+
v-if="fieldDescription('continueOnError')"
|
|
131
|
+
#tooltip
|
|
132
|
+
>
|
|
133
|
+
<Markdown
|
|
134
|
+
:source="fieldDescription('continueOnError')"
|
|
135
|
+
block
|
|
136
|
+
class="prose prose-sm prose-zinc"
|
|
137
|
+
/>
|
|
138
|
+
</template>
|
|
139
|
+
{{ fieldTitle("continueOnError") }}
|
|
140
|
+
</FieldLabel>
|
|
141
|
+
<Switch
|
|
142
|
+
:model-value="value.continueOnError ?? false"
|
|
143
|
+
@update:model-value="updateContinueOnError"
|
|
144
|
+
/>
|
|
145
|
+
</Field>
|
|
146
|
+
|
|
147
|
+
<div class="flex items-start gap-2">
|
|
148
|
+
<Field
|
|
149
|
+
orientation="vertical"
|
|
150
|
+
class="flex-1 basis-0 min-w-0"
|
|
151
|
+
>
|
|
152
|
+
<FieldLabel class="text-xs text-zinc-500">
|
|
153
|
+
<template
|
|
154
|
+
v-if="fieldDescription('messageExpression')"
|
|
155
|
+
#tooltip
|
|
156
|
+
>
|
|
157
|
+
<Markdown
|
|
158
|
+
:source="fieldDescription('messageExpression')"
|
|
159
|
+
block
|
|
160
|
+
class="prose prose-sm prose-zinc"
|
|
161
|
+
/>
|
|
162
|
+
</template>
|
|
163
|
+
{{ fieldTitle("messageExpression") }}
|
|
164
|
+
</FieldLabel>
|
|
165
|
+
<ExpressionEditor
|
|
166
|
+
:model-value="value.messageExpression ?? ''"
|
|
167
|
+
placeholder="例:string(jsons.size()) + ' 条已处理'"
|
|
168
|
+
result-type="string"
|
|
169
|
+
:extra-vars="{ jsons: { type: 'list', label: 'HTTP \u54CD\u5E94\u4F53\u5217\u8868\uFF08\u5DF2\u89E3\u6790 JSON\uFF0C\u4EC5\u6210\u529F\u9879\uFF09' } }"
|
|
170
|
+
@update:model-value="updateMessageExpression"
|
|
171
|
+
/>
|
|
172
|
+
</Field>
|
|
173
|
+
|
|
174
|
+
<Field
|
|
175
|
+
orientation="vertical"
|
|
176
|
+
class="flex-1 basis-0 min-w-0"
|
|
177
|
+
>
|
|
178
|
+
<FieldLabel class="text-xs text-zinc-500">
|
|
179
|
+
<template
|
|
180
|
+
v-if="fieldDescription('resultExpression')"
|
|
181
|
+
#tooltip
|
|
182
|
+
>
|
|
183
|
+
<Markdown
|
|
184
|
+
:source="fieldDescription('resultExpression')"
|
|
185
|
+
block
|
|
186
|
+
class="prose prose-sm prose-zinc"
|
|
187
|
+
/>
|
|
188
|
+
</template>
|
|
189
|
+
{{ fieldTitle("resultExpression") }}
|
|
190
|
+
</FieldLabel>
|
|
191
|
+
<ExpressionEditor
|
|
192
|
+
:model-value="value.resultExpression ?? ''"
|
|
193
|
+
placeholder="例:json.code == 0"
|
|
194
|
+
result-type="bool"
|
|
195
|
+
:extra-vars="{ json: { type: 'dyn', label: 'HTTP \u54CD\u5E94\u4F53\uFF08\u5DF2\u89E3\u6790 JSON\uFF09\uFF0C\u5F53\u524D\u8FD9\u4E00\u6761\u54CD\u5E94' } }"
|
|
196
|
+
@update:model-value="updateResultExpression"
|
|
197
|
+
/>
|
|
198
|
+
</Field>
|
|
199
|
+
</div>
|
|
200
|
+
</div>
|
|
201
|
+
</template>
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { type Value } from './schema.js';
|
|
2
|
+
type __VLS_ModelProps = {
|
|
3
|
+
modelValue: Value;
|
|
4
|
+
};
|
|
5
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
6
|
+
"update:modelValue": (value: {
|
|
7
|
+
readonly type: "com.shwfed.actions.button.http.request.json.batch";
|
|
8
|
+
readonly compatibilityDate: "2026-06-08";
|
|
9
|
+
readonly messageExpression?: string | undefined;
|
|
10
|
+
readonly resultExpression?: string | undefined;
|
|
11
|
+
readonly continueOnError?: boolean | undefined;
|
|
12
|
+
readonly markdown?: readonly [{
|
|
13
|
+
readonly locale: "zh";
|
|
14
|
+
readonly message: string;
|
|
15
|
+
}, ...{
|
|
16
|
+
readonly locale: "en" | "ja" | "ko";
|
|
17
|
+
readonly message: string;
|
|
18
|
+
}[]] | undefined;
|
|
19
|
+
readonly before?: readonly {
|
|
20
|
+
readonly params?: unknown;
|
|
21
|
+
readonly compatibilityDate?: string | undefined;
|
|
22
|
+
readonly target: string;
|
|
23
|
+
readonly operation: string;
|
|
24
|
+
}[] | undefined;
|
|
25
|
+
readonly expression: string;
|
|
26
|
+
}) => any;
|
|
27
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_ModelProps> & Readonly<{
|
|
28
|
+
"onUpdate:modelValue"?: ((value: {
|
|
29
|
+
readonly type: "com.shwfed.actions.button.http.request.json.batch";
|
|
30
|
+
readonly compatibilityDate: "2026-06-08";
|
|
31
|
+
readonly messageExpression?: string | undefined;
|
|
32
|
+
readonly resultExpression?: string | undefined;
|
|
33
|
+
readonly continueOnError?: boolean | undefined;
|
|
34
|
+
readonly markdown?: readonly [{
|
|
35
|
+
readonly locale: "zh";
|
|
36
|
+
readonly message: string;
|
|
37
|
+
}, ...{
|
|
38
|
+
readonly locale: "en" | "ja" | "ko";
|
|
39
|
+
readonly message: string;
|
|
40
|
+
}[]] | undefined;
|
|
41
|
+
readonly before?: readonly {
|
|
42
|
+
readonly params?: unknown;
|
|
43
|
+
readonly compatibilityDate?: string | undefined;
|
|
44
|
+
readonly target: string;
|
|
45
|
+
readonly operation: string;
|
|
46
|
+
}[] | undefined;
|
|
47
|
+
readonly expression: string;
|
|
48
|
+
}) => any) | undefined;
|
|
49
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
50
|
+
declare const _default: typeof __VLS_export;
|
|
51
|
+
export default _default;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Value } from './schema.js';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
buttonId: string;
|
|
4
|
+
config: Value;
|
|
5
|
+
};
|
|
6
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
7
|
+
declare const _default: typeof __VLS_export;
|
|
8
|
+
export default _default;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { Effect } from "effect";
|
|
3
|
+
import { useI18n } from "vue-i18n";
|
|
4
|
+
import { cel as _rawCel } from "../../../../../utils/cel";
|
|
5
|
+
import { celBindings, injectCELContext } from "../../../../../utils/cel-context";
|
|
6
|
+
import { getLocalizedText } from "../../../../../share/locale";
|
|
7
|
+
import { dispatchTriggers, useEventChannel } from "../../../../../share/event-bus";
|
|
8
|
+
import ShwfedActionDefinition from "../../../components/definition.vue";
|
|
9
|
+
import { executeHttpRequestBatch } from "../../../utils/resolve";
|
|
10
|
+
defineOptions({ name: "ShwfedHttpRequestBatchActionRuntime" });
|
|
11
|
+
const props = defineProps({
|
|
12
|
+
buttonId: { type: String, required: true },
|
|
13
|
+
config: { type: null, required: true }
|
|
14
|
+
});
|
|
15
|
+
const { locale } = useI18n();
|
|
16
|
+
const inherited = injectCELContext();
|
|
17
|
+
const $cel = (expression, context) => _rawCel(expression, { ...celBindings(inherited), ...context });
|
|
18
|
+
const channel = useEventChannel();
|
|
19
|
+
const effect = Effect.suspend(
|
|
20
|
+
() => Effect.andThen(
|
|
21
|
+
dispatchTriggers(channel, props.config.before),
|
|
22
|
+
() => executeHttpRequestBatch(props.config.expression, $cel, {
|
|
23
|
+
messageExpression: props.config.messageExpression,
|
|
24
|
+
resultExpression: props.config.resultExpression,
|
|
25
|
+
continueOnError: props.config.continueOnError,
|
|
26
|
+
markdown: getLocalizedText(props.config.markdown, locale.value) ?? ""
|
|
27
|
+
})
|
|
28
|
+
)
|
|
29
|
+
);
|
|
30
|
+
</script>
|
|
31
|
+
|
|
32
|
+
<template>
|
|
33
|
+
<ShwfedActionDefinition
|
|
34
|
+
:action-id="buttonId"
|
|
35
|
+
:effect="effect"
|
|
36
|
+
/>
|
|
37
|
+
</template>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Value } from './schema.js';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
buttonId: string;
|
|
4
|
+
config: Value;
|
|
5
|
+
};
|
|
6
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
7
|
+
declare const _default: typeof __VLS_export;
|
|
8
|
+
export default _default;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Schema } from 'effect';
|
|
2
|
+
import type { Environment } from '../../../../../vendor/cel-js/lib/index.js';
|
|
3
|
+
export declare const type: "com.shwfed.actions.button.http.request.json.batch";
|
|
4
|
+
export declare const compatibilityDate: "2026-06-08";
|
|
5
|
+
export declare const metadata: {
|
|
6
|
+
readonly name: "批量网络请求(JSON)";
|
|
7
|
+
readonly icon: "fluent:cloud-arrow-up-20-regular";
|
|
8
|
+
};
|
|
9
|
+
export declare function schema(configure: (env: Environment) => void): Schema.Struct<{
|
|
10
|
+
type: Schema.Literal<["com.shwfed.actions.button.http.request.json.batch"]>;
|
|
11
|
+
compatibilityDate: Schema.Literal<["2026-06-08"]>;
|
|
12
|
+
expression: Schema.Schema<string, string, never>;
|
|
13
|
+
before: Schema.optional<Schema.Array$<Schema.Struct<{
|
|
14
|
+
target: Schema.refine<string, typeof Schema.String>;
|
|
15
|
+
operation: Schema.SchemaClass<string, string, never>;
|
|
16
|
+
compatibilityDate: Schema.optional<Schema.SchemaClass<string, string, never>>;
|
|
17
|
+
params: Schema.optional<Schema.SchemaClass<unknown, unknown, never>>;
|
|
18
|
+
}>>>;
|
|
19
|
+
markdown: Schema.optional<Schema.TupleType<readonly [Schema.Struct<{
|
|
20
|
+
locale: Schema.Literal<["zh"]>;
|
|
21
|
+
message: Schema.SchemaClass<string, string, never>;
|
|
22
|
+
}>], [Schema.Struct<{
|
|
23
|
+
locale: Schema.Literal<["ja", "en", "ko"]>;
|
|
24
|
+
message: Schema.SchemaClass<string, string, never>;
|
|
25
|
+
}>]>>;
|
|
26
|
+
continueOnError: Schema.optional<Schema.SchemaClass<boolean, boolean, never>>;
|
|
27
|
+
messageExpression: Schema.optional<Schema.Schema<string, string, never>>;
|
|
28
|
+
resultExpression: Schema.optional<Schema.Schema<string, string, never>>;
|
|
29
|
+
}>;
|
|
30
|
+
export type Value = Schema.Schema.Type<ReturnType<typeof schema>>;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
import { Expression } from "../../../../../share/expression.js";
|
|
3
|
+
import { Triggers } from "../../../../../share/event-bus.js";
|
|
4
|
+
import { Locale } from "../../../../../share/locale.js";
|
|
5
|
+
import { md } from "../../../../../share/markdown.js";
|
|
6
|
+
export const type = "com.shwfed.actions.button.http.request.json.batch";
|
|
7
|
+
export const compatibilityDate = "2026-06-08";
|
|
8
|
+
export const metadata = {
|
|
9
|
+
name: "\u6279\u91CF\u7F51\u7EDC\u8BF7\u6C42\uFF08JSON\uFF09",
|
|
10
|
+
icon: "fluent:cloud-arrow-up-20-regular"
|
|
11
|
+
};
|
|
12
|
+
const isHttpRequestList = (t) => t === "dyn" || t === "list" || t === "list<dyn>" || t === "list<HttpRequest>";
|
|
13
|
+
export function schema(configure) {
|
|
14
|
+
const CelHttpRequestList = Expression({ configure, resultType: isHttpRequestList });
|
|
15
|
+
const CelMessage = Expression({
|
|
16
|
+
configure: (env) => {
|
|
17
|
+
configure(env);
|
|
18
|
+
env.registerVariable("jsons", "list<dyn>", {
|
|
19
|
+
description: "HTTP \u54CD\u5E94\u4F53\u5217\u8868\uFF08\u5DF2\u89E3\u6790 JSON\uFF0C\u4EC5\u6210\u529F\u9879\uFF0C\u6309\u53D1\u9001\u987A\u5E8F\uFF09"
|
|
20
|
+
});
|
|
21
|
+
},
|
|
22
|
+
resultType: "string"
|
|
23
|
+
});
|
|
24
|
+
const CelResult = Expression({
|
|
25
|
+
configure: (env) => {
|
|
26
|
+
configure(env);
|
|
27
|
+
env.registerVariable("json", "dyn", {
|
|
28
|
+
description: "HTTP \u54CD\u5E94\u4F53\uFF08\u5DF2\u89E3\u6790 JSON\uFF09\uFF0C\u5F53\u524D\u8FD9\u4E00\u6761\u54CD\u5E94"
|
|
29
|
+
});
|
|
30
|
+
},
|
|
31
|
+
resultType: "bool"
|
|
32
|
+
});
|
|
33
|
+
return Schema.Struct({
|
|
34
|
+
type: Schema.Literal(type),
|
|
35
|
+
compatibilityDate: Schema.Literal(compatibilityDate),
|
|
36
|
+
expression: CelHttpRequestList.annotations({
|
|
37
|
+
title: "\u8BF7\u6C42\u5217\u8868",
|
|
38
|
+
description: md`
|
|
39
|
+
点击后将立即被求值,返回一个 \`HttpRequest\` 列表。调度器将按列表顺序逐个发起请求,
|
|
40
|
+
并在弹窗中显示进度。
|
|
41
|
+
`
|
|
42
|
+
}),
|
|
43
|
+
before: Schema.optional(Triggers.annotations({
|
|
44
|
+
title: "\u8BF7\u6C42\u524D",
|
|
45
|
+
description: md`
|
|
46
|
+
整批请求发起前按列表顺序执行的操作。任一操作中止(例如表单校验未通过)将取消本次批量请求。
|
|
47
|
+
|
|
48
|
+
放在表单里的提交按钮应在此处首先触发所在表单的「校验」操作,使校验成为显式的提交前步骤。
|
|
49
|
+
`
|
|
50
|
+
})),
|
|
51
|
+
markdown: Schema.optional(Locale.annotations({
|
|
52
|
+
title: "\u8FDB\u5EA6\u4FE1\u606F",
|
|
53
|
+
description: md`
|
|
54
|
+
进度弹窗内显示的信息,支持 \`{{ expression }}\` 插值。可用变量:
|
|
55
|
+
\`total\`(请求总数)、\`succeeded\`(成功数)、\`failure\`(失败数)。
|
|
56
|
+
|
|
57
|
+
例:\`已处理 {{ succeeded + failure }} / {{ total }}\`。不配置则弹窗只显示进度条。
|
|
58
|
+
`
|
|
59
|
+
})),
|
|
60
|
+
continueOnError: Schema.optional(Schema.Boolean.annotations({
|
|
61
|
+
title: "\u5931\u8D25\u65F6\u7EE7\u7EED",
|
|
62
|
+
description: md`
|
|
63
|
+
开启后,单个请求失败不会中断整批 —— 失败项被跳过,继续发起后续请求。
|
|
64
|
+
缺省(关闭)时,遇到第一个失败即终止整批。
|
|
65
|
+
`
|
|
66
|
+
})),
|
|
67
|
+
messageExpression: Schema.optional(CelMessage.annotations({
|
|
68
|
+
title: "\u6D88\u606F",
|
|
69
|
+
description: md`
|
|
70
|
+
整批完成后对成功响应体列表 \`jsons\` 求值,返回 \`string\`,作为 toast 显示。
|
|
71
|
+
无失败时为成功样式,否则为错误样式。不配置则不显示。
|
|
72
|
+
`
|
|
73
|
+
})),
|
|
74
|
+
resultExpression: Schema.optional(CelResult.annotations({
|
|
75
|
+
title: "\u6267\u884C\u7ED3\u679C",
|
|
76
|
+
description: md`
|
|
77
|
+
对**每一条**响应体 \`json\` 求值,返回 \`bool\` —— \`true\` 视为该条成功、\`false\` 视为失败。
|
|
78
|
+
不配置时,任何未报错的响应都视为成功。
|
|
79
|
+
|
|
80
|
+
失败会计入进度信息的 \`failure\`,并在未开启「失败时继续」时终止整批。
|
|
81
|
+
`
|
|
82
|
+
}))
|
|
83
|
+
}).annotations({
|
|
84
|
+
title: "HttpRequestBatchAction",
|
|
85
|
+
description: "\u70B9\u51FB\u540E\u9010\u4E2A\u53D1\u8D77\u4E00\u6279 HTTP \u8BF7\u6C42\uFF0C\u5E76\u663E\u793A\u8FDB\u5EA6\u5F39\u7A97"
|
|
86
|
+
});
|
|
87
|
+
}
|
|
@@ -4,11 +4,15 @@ type __VLS_Props = {
|
|
|
4
4
|
};
|
|
5
5
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
6
6
|
"update:triggers": (triggers: readonly {
|
|
7
|
+
readonly params?: unknown;
|
|
8
|
+
readonly compatibilityDate?: string | undefined;
|
|
7
9
|
readonly target: string;
|
|
8
10
|
readonly operation: string;
|
|
9
11
|
}[]) => any;
|
|
10
12
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
11
13
|
"onUpdate:triggers"?: ((triggers: readonly {
|
|
14
|
+
readonly params?: unknown;
|
|
15
|
+
readonly compatibilityDate?: string | undefined;
|
|
12
16
|
readonly target: string;
|
|
13
17
|
readonly operation: string;
|
|
14
18
|
}[]) => any) | undefined;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import { computed } from "vue";
|
|
2
|
+
import { computed, ref } from "vue";
|
|
3
3
|
import { Icon } from "@iconify/vue";
|
|
4
4
|
import { useEventAncestry } from "../../../share/event-bus";
|
|
5
|
+
import { findOperation } from "../../operations/utils/resolve";
|
|
5
6
|
import {
|
|
6
7
|
useTreeDnd
|
|
7
8
|
} from "../../../composables/useTreeDnd";
|
|
@@ -28,6 +29,7 @@ const allOptions = computed(
|
|
|
28
29
|
key: keyOf(ancestor.instanceId, operation.id),
|
|
29
30
|
target: ancestor.instanceId,
|
|
30
31
|
operation: operation.id,
|
|
32
|
+
compatibilityDate: operation.compatibilityDate,
|
|
31
33
|
typeName: ancestor.typeName,
|
|
32
34
|
typeIcon: ancestor.typeIcon,
|
|
33
35
|
instanceName: ancestor.name,
|
|
@@ -42,25 +44,47 @@ const optionByKey = computed(() => {
|
|
|
42
44
|
return map;
|
|
43
45
|
});
|
|
44
46
|
const rows = computed(
|
|
45
|
-
() => props.triggers.map((trigger) => ({
|
|
46
|
-
key:
|
|
47
|
+
() => props.triggers.map((trigger, index) => ({
|
|
48
|
+
key: String(index),
|
|
47
49
|
trigger,
|
|
48
50
|
option: optionByKey.value.get(keyOf(trigger.target, trigger.operation))
|
|
49
51
|
}))
|
|
50
52
|
);
|
|
51
|
-
const available = computed(() =>
|
|
52
|
-
const used = new Set(props.triggers.map((t) => keyOf(t.target, t.operation)));
|
|
53
|
-
return allOptions.value.filter((option) => !used.has(option.key));
|
|
54
|
-
});
|
|
53
|
+
const available = computed(() => allOptions.value);
|
|
55
54
|
function searchValue(option) {
|
|
56
55
|
return [option.typeName, option.instanceName, option.opName].filter((part) => !!part).join(" ");
|
|
57
56
|
}
|
|
58
57
|
function addTrigger(option) {
|
|
58
|
+
if (option.compatibilityDate) {
|
|
59
|
+
const entry = findOperation(option.operation, option.compatibilityDate);
|
|
60
|
+
emit("update:triggers", [
|
|
61
|
+
...props.triggers,
|
|
62
|
+
{
|
|
63
|
+
target: option.target,
|
|
64
|
+
operation: option.operation,
|
|
65
|
+
compatibilityDate: option.compatibilityDate,
|
|
66
|
+
params: entry?.defaults?.() ?? {}
|
|
67
|
+
}
|
|
68
|
+
]);
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
59
71
|
emit("update:triggers", [
|
|
60
72
|
...props.triggers,
|
|
61
73
|
{ target: option.target, operation: option.operation }
|
|
62
74
|
]);
|
|
63
75
|
}
|
|
76
|
+
function updateParams(index, params) {
|
|
77
|
+
emit("update:triggers", props.triggers.map((t, i) => i === index ? { ...t, params } : t));
|
|
78
|
+
}
|
|
79
|
+
const collapsed = ref(/* @__PURE__ */ new Set());
|
|
80
|
+
function toggleCollapsed(key) {
|
|
81
|
+
if (collapsed.value.has(key)) collapsed.value.delete(key);
|
|
82
|
+
else collapsed.value.add(key);
|
|
83
|
+
}
|
|
84
|
+
function opConfigFor(trigger) {
|
|
85
|
+
if (!trigger.compatibilityDate) return void 0;
|
|
86
|
+
return findOperation(trigger.operation, trigger.compatibilityDate)?.config;
|
|
87
|
+
}
|
|
64
88
|
function removeTrigger(index) {
|
|
65
89
|
emit("update:triggers", props.triggers.filter((_, i) => i !== index));
|
|
66
90
|
}
|
|
@@ -149,6 +173,24 @@ function rowConfig(rowKey) {
|
|
|
149
173
|
</InputGroupText>
|
|
150
174
|
|
|
151
175
|
<InputGroupAddon align="inline-end">
|
|
176
|
+
<!-- Collapse toggle — only for rows with a param editor; param-less
|
|
177
|
+
and dangling rows have nothing to fold, so it is omitted. -->
|
|
178
|
+
<InputGroupButton
|
|
179
|
+
v-if="opConfigFor(row.trigger)"
|
|
180
|
+
size="icon-xs"
|
|
181
|
+
as-child
|
|
182
|
+
>
|
|
183
|
+
<button
|
|
184
|
+
type="button"
|
|
185
|
+
:aria-expanded="!collapsed.has(row.key)"
|
|
186
|
+
:aria-label="collapsed.has(row.key) ? '\u5C55\u5F00\u53C2\u6570' : '\u6298\u53E0\u53C2\u6570'"
|
|
187
|
+
@click="toggleCollapsed(row.key)"
|
|
188
|
+
>
|
|
189
|
+
<Icon
|
|
190
|
+
:icon="collapsed.has(row.key) ? 'fluent:chevron-right-20-regular' : 'fluent:chevron-down-20-regular'"
|
|
191
|
+
/>
|
|
192
|
+
</button>
|
|
193
|
+
</InputGroupButton>
|
|
152
194
|
<InputGroupButton
|
|
153
195
|
variant="destructive"
|
|
154
196
|
size="icon-xs"
|
|
@@ -164,6 +206,22 @@ function rowConfig(rowKey) {
|
|
|
164
206
|
</InputGroupButton>
|
|
165
207
|
</InputGroupAddon>
|
|
166
208
|
</InputGroup>
|
|
209
|
+
|
|
210
|
+
<!-- Parameterized op: its own `config.vue`, bound to the trigger's
|
|
211
|
+
`params`. Param-less ops and dangling rows render nothing here.
|
|
212
|
+
`v-show` (not `v-if`) so the editor stays mounted while collapsed —
|
|
213
|
+
its draft state and continuous validation keep running. -->
|
|
214
|
+
<div
|
|
215
|
+
v-if="opConfigFor(row.trigger)"
|
|
216
|
+
v-show="!collapsed.has(row.key)"
|
|
217
|
+
class="mt-2 rounded-md border border-zinc-200 bg-zinc-50/50 p-3"
|
|
218
|
+
>
|
|
219
|
+
<component
|
|
220
|
+
:is="opConfigFor(row.trigger)"
|
|
221
|
+
:model-value="row.trigger.params ?? {}"
|
|
222
|
+
@update:model-value="(v) => updateParams(index, v)"
|
|
223
|
+
/>
|
|
224
|
+
</div>
|
|
167
225
|
</div>
|
|
168
226
|
|
|
169
227
|
<InputGroup v-if="available.length > 0">
|
|
@@ -4,11 +4,15 @@ type __VLS_Props = {
|
|
|
4
4
|
};
|
|
5
5
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
6
6
|
"update:triggers": (triggers: readonly {
|
|
7
|
+
readonly params?: unknown;
|
|
8
|
+
readonly compatibilityDate?: string | undefined;
|
|
7
9
|
readonly target: string;
|
|
8
10
|
readonly operation: string;
|
|
9
11
|
}[]) => any;
|
|
10
12
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
11
13
|
"onUpdate:triggers"?: ((triggers: readonly {
|
|
14
|
+
readonly params?: unknown;
|
|
15
|
+
readonly compatibilityDate?: string | undefined;
|
|
12
16
|
readonly target: string;
|
|
13
17
|
readonly operation: string;
|
|
14
18
|
}[]) => any) | undefined;
|