@shwfed/config 2.11.1 → 2.11.4
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 +1416 -1211
- package/dist/module.json +1 -1
- package/dist/preview/assets/{FieldGroup.vue_vue_type_script_setup_true_lang-CosmpPSu.js → FieldGroup.vue_vue_type_script_setup_true_lang-BE68tZWF.js} +1 -1
- package/dist/preview/assets/{badge-BkYCxTFK.js → badge-CGMjdhLX.js} +1 -1
- package/dist/preview/assets/config-B7TZ-128.js +1 -0
- package/dist/preview/assets/{config-B62b9dMF.js → config-BSym_jQg.js} +1 -1
- package/dist/preview/assets/{config-Cbp7aAAw.js → config-ByCFJbd-.js} +1 -1
- package/dist/preview/assets/{config-Bbbyd5lB.js → config-C4cv2S64.js} +1 -1
- package/dist/preview/assets/{config-Dt8k1gnT.js → config-ChrJHusi.js} +1 -1
- package/dist/preview/assets/config-CxbYENZ0.js +1 -0
- package/dist/preview/assets/{config-Bt6--diX.js → config-DFS2XL3-.js} +1 -1
- package/dist/preview/assets/{config-C_Ia1CDq.js → config-DWj1CTai.js} +1 -1
- package/dist/preview/assets/{config-BcZe-bR9.js → config-DZI21_UB.js} +1 -1
- package/dist/preview/assets/{config-CPsd0ppi.js → config-D_O4ACtH.js} +1 -1
- package/dist/preview/assets/{config-Dk9OegYx.js → config-DjA8bfLm.js} +1 -1
- package/dist/preview/assets/{config-74YmXQsH.js → config-DwPGLI3R.js} +1 -1
- package/dist/preview/assets/{config-sCP15_0f.js → config-dkVvsr4h.js} +1 -1
- package/dist/preview/assets/{config-CYVafGLc.js → config-hsH0bSZh.js} +1 -1
- package/dist/preview/assets/{config-COr2MFhN.js → config-xrfje67L.js} +1 -1
- package/dist/preview/assets/{definition.vue_vue_type_script_setup_true_lang-C3NiB99t.js → definition.vue_vue_type_script_setup_true_lang-BGk00yfB.js} +1 -1
- package/dist/preview/assets/index-B4oT9ZrQ.js +1 -0
- package/dist/preview/assets/{index-DjG-VVR4.js → index-BSQlKkJR.js} +214 -202
- package/dist/preview/assets/{index-BMOizF8g.js → index-CzQKNngS.js} +1 -1
- package/dist/preview/assets/index-DPFQgj9g.css +1 -0
- package/dist/preview/assets/{item-C1efxuFt.js → item-D4gmvDO-.js} +1 -1
- package/dist/preview/assets/{runtime-LgZuN2Tf.js → runtime--e0UxK6b.js} +1 -1
- package/dist/preview/assets/runtime-BWH8ForT.js +1 -0
- package/dist/preview/assets/runtime-BgO2briD.js +1 -0
- package/dist/preview/assets/{runtime-DoLpKFu-.js → runtime-BmEP7xID.js} +1 -1
- package/dist/preview/assets/runtime-C66GF-2d.js +1 -0
- package/dist/preview/assets/{runtime-7z9N9JGG.js → runtime-CJCOS6D_.js} +1 -1
- package/dist/preview/assets/{runtime-S9eZ2nJS.js → runtime-CREolKJd.js} +1 -1
- package/dist/preview/assets/runtime-CjU46djh.js +1 -0
- package/dist/preview/assets/{runtime-Du0ghzR2.js → runtime-e59FkBkL.js} +1 -1
- package/dist/preview/assets/runtime-pYLX1Bb-.js +1 -0
- package/dist/preview/assets/{runtime-Dz7SCudL.js → runtime-wvP7jhBK.js} +1 -1
- package/dist/preview/assets/{schema-meta-CYKPEnu9.js → schema-meta-C4Ttq3eE.js} +1 -1
- package/dist/preview/index.html +2 -2
- package/dist/runtime/components/actions/buttons/2026-06-25/com.shwfed.actions.button.state.write/config.d.vue.ts +39 -0
- package/dist/runtime/components/actions/buttons/2026-06-25/com.shwfed.actions.button.state.write/config.vue +127 -0
- package/dist/runtime/components/actions/buttons/2026-06-25/com.shwfed.actions.button.state.write/config.vue.d.ts +39 -0
- package/dist/runtime/components/actions/buttons/2026-06-25/com.shwfed.actions.button.state.write/runtime.d.vue.ts +8 -0
- package/dist/runtime/components/actions/buttons/2026-06-25/com.shwfed.actions.button.state.write/runtime.vue +62 -0
- package/dist/runtime/components/actions/buttons/2026-06-25/com.shwfed.actions.button.state.write/runtime.vue.d.ts +8 -0
- package/dist/runtime/components/actions/buttons/2026-06-25/com.shwfed.actions.button.state.write/schema.d.ts +25 -0
- package/dist/runtime/components/actions/buttons/2026-06-25/com.shwfed.actions.button.state.write/schema.js +41 -0
- package/dist/runtime/components/config/blocks/2026-06-17/com.shwfed.block.tree.single/runtime.vue +5 -22
- package/dist/runtime/components/config/blocks/2026-06-25/com.shwfed.block.loop/config.d.vue.ts +70 -0
- package/dist/runtime/components/config/blocks/2026-06-25/com.shwfed.block.loop/config.vue +349 -0
- package/dist/runtime/components/config/blocks/2026-06-25/com.shwfed.block.loop/config.vue.d.ts +70 -0
- package/dist/runtime/components/config/blocks/2026-06-25/com.shwfed.block.loop/loop-item.d.vue.ts +33 -0
- package/dist/runtime/components/config/blocks/2026-06-25/com.shwfed.block.loop/loop-item.vue +37 -0
- package/dist/runtime/components/config/blocks/2026-06-25/com.shwfed.block.loop/loop-item.vue.d.ts +33 -0
- package/dist/runtime/components/config/blocks/2026-06-25/com.shwfed.block.loop/loop-scope-provider.d.vue.ts +13 -0
- package/dist/runtime/components/config/blocks/2026-06-25/com.shwfed.block.loop/loop-scope-provider.vue +22 -0
- package/dist/runtime/components/config/blocks/2026-06-25/com.shwfed.block.loop/loop-scope-provider.vue.d.ts +13 -0
- package/dist/runtime/components/config/blocks/2026-06-25/com.shwfed.block.loop/runtime.d.vue.ts +70 -0
- package/dist/runtime/components/config/blocks/2026-06-25/com.shwfed.block.loop/runtime.vue +62 -0
- package/dist/runtime/components/config/blocks/2026-06-25/com.shwfed.block.loop/runtime.vue.d.ts +70 -0
- package/dist/runtime/components/config/blocks/2026-06-25/com.shwfed.block.loop/schema.d.ts +85 -0
- package/dist/runtime/components/config/blocks/2026-06-25/com.shwfed.block.loop/schema.js +60 -0
- 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.d.ts +2 -2
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.daterange/config.d.vue.ts +4 -4
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.daterange/config.vue.d.ts +4 -4
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.datetimerange/config.d.vue.ts +6 -6
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.datetimerange/config.vue.d.ts +6 -6
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.timerange/config.d.vue.ts +2 -2
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.timerange/config.vue.d.ts +2 -2
- package/dist/runtime/components/form/fields/2026-05-23/com.shwfed.form.field.tree.multi/config.d.vue.ts +22 -22
- package/dist/runtime/components/form/fields/2026-05-23/com.shwfed.form.field.tree.multi/config.vue.d.ts +22 -22
- package/dist/runtime/components/form/fields/2026-05-24/com.shwfed.form.field.monthrange/config.d.vue.ts +4 -4
- package/dist/runtime/components/form/fields/2026-05-24/com.shwfed.form.field.monthrange/config.vue.d.ts +4 -4
- package/dist/runtime/components/form/fields/2026-05-26/com.shwfed.form.field.tree.combobox.multi/config.d.vue.ts +22 -22
- package/dist/runtime/components/form/fields/2026-05-26/com.shwfed.form.field.tree.combobox.multi/config.vue.d.ts +22 -22
- package/dist/runtime/components/form/fields/2026-05-26/com.shwfed.form.field.tree.combobox.single/config.d.vue.ts +22 -22
- package/dist/runtime/components/form/fields/2026-05-26/com.shwfed.form.field.tree.combobox.single/config.vue.d.ts +22 -22
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.combobox.multi/config.d.vue.ts +22 -22
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.combobox.multi/config.vue.d.ts +22 -22
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.combobox.single/config.d.vue.ts +22 -22
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.combobox.single/config.vue.d.ts +22 -22
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.multi/config.d.vue.ts +22 -22
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.multi/config.vue.d.ts +22 -22
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.multi/runtime.vue +2 -19
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.single/config.d.vue.ts +22 -22
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.single/config.vue.d.ts +22 -22
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.single/runtime.vue +5 -22
- package/dist/runtime/components/operations/2026-06-15/com.shwfed.operation.http.download/config.d.vue.ts +2 -0
- package/dist/runtime/components/operations/2026-06-15/com.shwfed.operation.http.download/config.vue +49 -22
- package/dist/runtime/components/operations/2026-06-15/com.shwfed.operation.http.download/config.vue.d.ts +2 -0
- package/dist/runtime/components/operations/2026-06-15/com.shwfed.operation.http.download/runtime.js +17 -10
- package/dist/runtime/components/operations/2026-06-15/com.shwfed.operation.http.download/schema.d.ts +1 -0
- package/dist/runtime/components/operations/2026-06-15/com.shwfed.operation.http.download/schema.js +25 -3
- 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/ui/date-picker/DatePickerInput.d.vue.ts +1 -1
- package/dist/runtime/components/ui/date-picker/DatePickerInput.vue.d.ts +1 -1
- package/dist/runtime/components/ui/date-picker/DatePickerTimeInput.d.vue.ts +1 -1
- package/dist/runtime/components/ui/date-picker/DatePickerTimeInput.vue.d.ts +1 -1
- package/dist/runtime/components/ui/date-range-picker/DateRangePickerInput.d.vue.ts +1 -1
- package/dist/runtime/components/ui/date-range-picker/DateRangePickerInput.vue.d.ts +1 -1
- package/dist/runtime/components/ui/date-range-picker/DateRangePickerTimeInput.d.vue.ts +2 -2
- package/dist/runtime/components/ui/date-range-picker/DateRangePickerTimeInput.vue.d.ts +2 -2
- package/dist/runtime/components/ui/expression-editor/ExpressionEditor.vue +1 -1
- package/dist/runtime/share/loop-item-var.d.ts +21 -0
- package/dist/runtime/share/loop-item-var.js +13 -0
- package/dist/runtime/vendor/cel-js/CLAUDE.md +1 -1
- package/dist/runtime/vendor/cel-js/lib/http-builder.d.ts +38 -3
- package/dist/runtime/vendor/cel-js/lib/http-builder.js +33 -0
- package/package.json +1 -1
- package/dist/preview/assets/config-BHYlKhDX.js +0 -1
- package/dist/preview/assets/index-C9G8y6qZ.js +0 -1
- package/dist/preview/assets/index-DqRQ67sX.css +0 -1
- package/dist/preview/assets/runtime-Bpa1zRxG.js +0 -1
- package/dist/preview/assets/runtime-Csv04MYG.js +0 -1
- package/dist/preview/assets/runtime-D0bjM4NL.js +0 -1
- package/dist/preview/assets/runtime-Dz3ZQYdq.js +0 -1
|
@@ -0,0 +1,39 @@
|
|
|
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.state.write";
|
|
8
|
+
readonly compatibilityDate: "2026-06-25";
|
|
9
|
+
readonly onSuccess?: readonly {
|
|
10
|
+
readonly id?: string | undefined;
|
|
11
|
+
readonly params?: unknown;
|
|
12
|
+
readonly compatibilityDate?: string | undefined;
|
|
13
|
+
readonly target: string;
|
|
14
|
+
readonly operation: string;
|
|
15
|
+
}[] | undefined;
|
|
16
|
+
readonly writes: readonly {
|
|
17
|
+
readonly path: string;
|
|
18
|
+
readonly value: string;
|
|
19
|
+
}[];
|
|
20
|
+
}) => any;
|
|
21
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_ModelProps> & Readonly<{
|
|
22
|
+
"onUpdate:modelValue"?: ((value: {
|
|
23
|
+
readonly type: "com.shwfed.actions.button.state.write";
|
|
24
|
+
readonly compatibilityDate: "2026-06-25";
|
|
25
|
+
readonly onSuccess?: readonly {
|
|
26
|
+
readonly id?: string | undefined;
|
|
27
|
+
readonly params?: unknown;
|
|
28
|
+
readonly compatibilityDate?: string | undefined;
|
|
29
|
+
readonly target: string;
|
|
30
|
+
readonly operation: string;
|
|
31
|
+
}[] | undefined;
|
|
32
|
+
readonly writes: readonly {
|
|
33
|
+
readonly path: string;
|
|
34
|
+
readonly value: string;
|
|
35
|
+
}[];
|
|
36
|
+
}) => any) | undefined;
|
|
37
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
38
|
+
declare const _default: typeof __VLS_export;
|
|
39
|
+
export default _default;
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed } from "vue";
|
|
3
|
+
import { Icon } from "@iconify/vue";
|
|
4
|
+
import { Button } from "../../../../ui/button";
|
|
5
|
+
import { Field, FieldLabel } from "../../../../ui/field";
|
|
6
|
+
import { ExpressionEditor } from "../../../../ui/expression-editor";
|
|
7
|
+
import { Markdown } from "../../../../ui/markdown";
|
|
8
|
+
import { InputGroupButton } from "../../../../ui/input-group";
|
|
9
|
+
import { getStructFieldDescription, getStructFieldTitle } from "../../../schema";
|
|
10
|
+
import TriggersField from "../../../components/triggers-field.vue";
|
|
11
|
+
import { schema } from "./schema";
|
|
12
|
+
defineOptions({ name: "ShwfedStateWriteActionConfig" });
|
|
13
|
+
const value = defineModel({ type: null, ...{ required: true } });
|
|
14
|
+
const actionSchema = schema(() => {
|
|
15
|
+
});
|
|
16
|
+
const fieldTitle = (f) => getStructFieldTitle(actionSchema, f) ?? f;
|
|
17
|
+
const fieldDescription = (f) => getStructFieldDescription(actionSchema, f);
|
|
18
|
+
const writes = computed(() => value.value.writes ?? []);
|
|
19
|
+
function patchWrites(next) {
|
|
20
|
+
value.value = { ...value.value, writes: next };
|
|
21
|
+
}
|
|
22
|
+
function updateRow(index, patch) {
|
|
23
|
+
patchWrites(writes.value.map((w, i) => i === index ? { ...w, ...patch } : w));
|
|
24
|
+
}
|
|
25
|
+
function addRow() {
|
|
26
|
+
patchWrites([...writes.value, { path: "", value: "" }]);
|
|
27
|
+
}
|
|
28
|
+
function removeRow(index) {
|
|
29
|
+
patchWrites(writes.value.filter((_, i) => i !== index));
|
|
30
|
+
}
|
|
31
|
+
function updateTriggers(next) {
|
|
32
|
+
const draft = { ...value.value };
|
|
33
|
+
if (next.length === 0) Reflect.deleteProperty(draft, "onSuccess");
|
|
34
|
+
else draft.onSuccess = next;
|
|
35
|
+
value.value = draft;
|
|
36
|
+
}
|
|
37
|
+
</script>
|
|
38
|
+
|
|
39
|
+
<template>
|
|
40
|
+
<div class="flex flex-col gap-3">
|
|
41
|
+
<Field orientation="vertical">
|
|
42
|
+
<FieldLabel class="text-xs text-zinc-500">
|
|
43
|
+
<template
|
|
44
|
+
v-if="fieldDescription('writes')"
|
|
45
|
+
#tooltip
|
|
46
|
+
>
|
|
47
|
+
<Markdown
|
|
48
|
+
:source="fieldDescription('writes')"
|
|
49
|
+
block
|
|
50
|
+
class="prose prose-sm prose-zinc"
|
|
51
|
+
/>
|
|
52
|
+
</template>
|
|
53
|
+
{{ fieldTitle("writes") }}
|
|
54
|
+
</FieldLabel>
|
|
55
|
+
|
|
56
|
+
<div class="flex flex-col gap-3">
|
|
57
|
+
<!-- One write item, on a single line: a monofont binding path notched
|
|
58
|
+
into the editor's `leading` slot, the value expression in the
|
|
59
|
+
editor itself (its own `{x}` badge), and a destructive delete in
|
|
60
|
+
the `trailing` slot. Reuses the ExpressionEditor's own InputGroup. -->
|
|
61
|
+
<ExpressionEditor
|
|
62
|
+
v-for="(row, index) in writes"
|
|
63
|
+
:key="index"
|
|
64
|
+
:model-value="row.value"
|
|
65
|
+
placeholder="值,如 selected[?0].?exchangeRate"
|
|
66
|
+
@update:model-value="(v) => updateRow(index, { value: v })"
|
|
67
|
+
>
|
|
68
|
+
<template #leading>
|
|
69
|
+
<input
|
|
70
|
+
type="text"
|
|
71
|
+
data-slot="state-write-path"
|
|
72
|
+
:value="row.path"
|
|
73
|
+
placeholder="路径"
|
|
74
|
+
class="w-44 min-w-0 border-r border-zinc-200 bg-transparent pr-3 font-mono text-sm text-zinc-700 outline-none placeholder:text-zinc-300"
|
|
75
|
+
:aria-label="`\u5199\u5165\u8DEF\u5F84 ${index + 1}`"
|
|
76
|
+
@input="updateRow(index, { path: $event.target.value })"
|
|
77
|
+
>
|
|
78
|
+
</template>
|
|
79
|
+
<template #trailing>
|
|
80
|
+
<InputGroupButton
|
|
81
|
+
variant="destructive"
|
|
82
|
+
size="icon-xs"
|
|
83
|
+
as-child
|
|
84
|
+
>
|
|
85
|
+
<button
|
|
86
|
+
type="button"
|
|
87
|
+
:aria-label="`\u79FB\u9664\u5199\u5165\u9879 ${index + 1}`"
|
|
88
|
+
@click="removeRow(index)"
|
|
89
|
+
>
|
|
90
|
+
<Icon icon="fluent:delete-20-regular" />
|
|
91
|
+
</button>
|
|
92
|
+
</InputGroupButton>
|
|
93
|
+
</template>
|
|
94
|
+
</ExpressionEditor>
|
|
95
|
+
|
|
96
|
+
<Button
|
|
97
|
+
type="button"
|
|
98
|
+
class="justify-center"
|
|
99
|
+
@click="addRow"
|
|
100
|
+
>
|
|
101
|
+
<Icon icon="fluent:add-20-regular" />
|
|
102
|
+
<span>添加写入项</span>
|
|
103
|
+
</Button>
|
|
104
|
+
</div>
|
|
105
|
+
</Field>
|
|
106
|
+
|
|
107
|
+
<Field orientation="vertical">
|
|
108
|
+
<FieldLabel class="text-xs text-zinc-500">
|
|
109
|
+
<template
|
|
110
|
+
v-if="fieldDescription('onSuccess')"
|
|
111
|
+
#tooltip
|
|
112
|
+
>
|
|
113
|
+
<Markdown
|
|
114
|
+
:source="fieldDescription('onSuccess')"
|
|
115
|
+
block
|
|
116
|
+
class="prose prose-sm prose-zinc"
|
|
117
|
+
/>
|
|
118
|
+
</template>
|
|
119
|
+
{{ fieldTitle("onSuccess") }}
|
|
120
|
+
</FieldLabel>
|
|
121
|
+
<TriggersField
|
|
122
|
+
:triggers="value.onSuccess ?? []"
|
|
123
|
+
@update:triggers="updateTriggers"
|
|
124
|
+
/>
|
|
125
|
+
</Field>
|
|
126
|
+
</div>
|
|
127
|
+
</template>
|
|
@@ -0,0 +1,39 @@
|
|
|
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.state.write";
|
|
8
|
+
readonly compatibilityDate: "2026-06-25";
|
|
9
|
+
readonly onSuccess?: readonly {
|
|
10
|
+
readonly id?: string | undefined;
|
|
11
|
+
readonly params?: unknown;
|
|
12
|
+
readonly compatibilityDate?: string | undefined;
|
|
13
|
+
readonly target: string;
|
|
14
|
+
readonly operation: string;
|
|
15
|
+
}[] | undefined;
|
|
16
|
+
readonly writes: readonly {
|
|
17
|
+
readonly path: string;
|
|
18
|
+
readonly value: string;
|
|
19
|
+
}[];
|
|
20
|
+
}) => any;
|
|
21
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_ModelProps> & Readonly<{
|
|
22
|
+
"onUpdate:modelValue"?: ((value: {
|
|
23
|
+
readonly type: "com.shwfed.actions.button.state.write";
|
|
24
|
+
readonly compatibilityDate: "2026-06-25";
|
|
25
|
+
readonly onSuccess?: readonly {
|
|
26
|
+
readonly id?: string | undefined;
|
|
27
|
+
readonly params?: unknown;
|
|
28
|
+
readonly compatibilityDate?: string | undefined;
|
|
29
|
+
readonly target: string;
|
|
30
|
+
readonly operation: string;
|
|
31
|
+
}[] | undefined;
|
|
32
|
+
readonly writes: readonly {
|
|
33
|
+
readonly path: string;
|
|
34
|
+
readonly value: string;
|
|
35
|
+
}[];
|
|
36
|
+
}) => any) | undefined;
|
|
37
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
38
|
+
declare const _default: typeof __VLS_export;
|
|
39
|
+
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,62 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { Effect } from "effect";
|
|
3
|
+
import { createDefu } from "defu";
|
|
4
|
+
import { cel as _rawCel } from "../../../../../utils/cel";
|
|
5
|
+
import { celBindings, injectCELContext } from "../../../../../utils/cel-context";
|
|
6
|
+
import { dispatchTriggers, useEventChannel } from "../../../../../share/event-bus";
|
|
7
|
+
import { useFormState } from "../../../../form/utils/state";
|
|
8
|
+
import ShwfedActionDefinition from "../../../components/definition.vue";
|
|
9
|
+
defineOptions({ name: "ShwfedStateWriteActionRuntime" });
|
|
10
|
+
const props = defineProps({
|
|
11
|
+
buttonId: { type: String, required: true },
|
|
12
|
+
config: { type: null, required: true }
|
|
13
|
+
});
|
|
14
|
+
const inherited = injectCELContext();
|
|
15
|
+
const $cel = (expression, context) => _rawCel(expression, { ...celBindings(inherited), ...context });
|
|
16
|
+
const nearestFormState = useFormState();
|
|
17
|
+
const formState = nearestFormState.kind === "form" && nearestFormState.parent ? nearestFormState.parent : nearestFormState;
|
|
18
|
+
const channel = useEventChannel();
|
|
19
|
+
const mergeObjects = createDefu((obj, key, value) => {
|
|
20
|
+
if (Array.isArray(obj[key]) && Array.isArray(value)) {
|
|
21
|
+
obj[key] = value;
|
|
22
|
+
return true;
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
function isPlainObject(v) {
|
|
26
|
+
return typeof v === "object" && v !== null && !Array.isArray(v);
|
|
27
|
+
}
|
|
28
|
+
function mergeAtPath(current, next) {
|
|
29
|
+
if (isPlainObject(current) && isPlainObject(next)) {
|
|
30
|
+
return mergeObjects({ ...next }, current);
|
|
31
|
+
}
|
|
32
|
+
return next;
|
|
33
|
+
}
|
|
34
|
+
const effect = Effect.suspend(
|
|
35
|
+
() => Effect.flatMap(
|
|
36
|
+
// Evaluate every row's `value` in list order. A row with a blank `path` is
|
|
37
|
+
// skipped (a half-authored row writes nowhere) but its value is never
|
|
38
|
+
// evaluated — `Effect.forEach` keeps the click sequential and short-circuits
|
|
39
|
+
// on the first failing expression, matching the old map-eval-then-write.
|
|
40
|
+
Effect.forEach(
|
|
41
|
+
props.config.writes ?? [],
|
|
42
|
+
(write) => {
|
|
43
|
+
const path = write.path?.trim() ?? "";
|
|
44
|
+
if (path.length === 0) return Effect.void;
|
|
45
|
+
return Effect.map($cel(write.value), (result) => {
|
|
46
|
+
const merged = mergeAtPath(formState.getAt(path), result);
|
|
47
|
+
formState.setAt(path, merged);
|
|
48
|
+
});
|
|
49
|
+
},
|
|
50
|
+
{ discard: true }
|
|
51
|
+
),
|
|
52
|
+
() => dispatchTriggers(channel, props.config.onSuccess, $cel)
|
|
53
|
+
)
|
|
54
|
+
);
|
|
55
|
+
</script>
|
|
56
|
+
|
|
57
|
+
<template>
|
|
58
|
+
<ShwfedActionDefinition
|
|
59
|
+
:action-id="buttonId"
|
|
60
|
+
:effect="effect"
|
|
61
|
+
/>
|
|
62
|
+
</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,25 @@
|
|
|
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.state.write";
|
|
4
|
+
export declare const compatibilityDate: "2026-06-25";
|
|
5
|
+
export declare const metadata: {
|
|
6
|
+
readonly name: "写入表单状态";
|
|
7
|
+
readonly icon: "fluent:document-edit-20-regular";
|
|
8
|
+
};
|
|
9
|
+
export declare function schema(configure: (env: Environment) => void): Schema.Struct<{
|
|
10
|
+
type: Schema.Literal<["com.shwfed.actions.button.state.write"]>;
|
|
11
|
+
compatibilityDate: Schema.Literal<["2026-06-25"]>;
|
|
12
|
+
writes: Schema.Array$<Schema.Struct<{
|
|
13
|
+
path: Schema.SchemaClass<string, string, never>;
|
|
14
|
+
value: Schema.Schema<string, string, never>;
|
|
15
|
+
}>>;
|
|
16
|
+
onSuccess: Schema.optional<Schema.Array$<Schema.Struct<{
|
|
17
|
+
id: Schema.optional<Schema.refine<string, typeof Schema.String>>;
|
|
18
|
+
target: Schema.refine<string, typeof Schema.String>;
|
|
19
|
+
operation: Schema.SchemaClass<string, string, never>;
|
|
20
|
+
compatibilityDate: Schema.optional<Schema.SchemaClass<string, string, never>>;
|
|
21
|
+
params: Schema.optional<Schema.SchemaClass<unknown, unknown, never>>;
|
|
22
|
+
}>>>;
|
|
23
|
+
}>;
|
|
24
|
+
export type Value = Schema.Schema.Type<ReturnType<typeof schema>>;
|
|
25
|
+
export type WriteValue = Value['writes'][number];
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
import { Expression } from "../../../../../share/expression.js";
|
|
3
|
+
import { Triggers } from "../../../../../share/event-bus.js";
|
|
4
|
+
import { md } from "../../../../../share/markdown.js";
|
|
5
|
+
export const type = "com.shwfed.actions.button.state.write";
|
|
6
|
+
export const compatibilityDate = "2026-06-25";
|
|
7
|
+
export const metadata = {
|
|
8
|
+
name: "\u5199\u5165\u8868\u5355\u72B6\u6001",
|
|
9
|
+
icon: "fluent:document-edit-20-regular"
|
|
10
|
+
};
|
|
11
|
+
export function schema(configure) {
|
|
12
|
+
const Write = Schema.Struct({
|
|
13
|
+
path: Schema.String.annotations({
|
|
14
|
+
title: "\u8DEF\u5F84",
|
|
15
|
+
description: "\u5199\u5165\u7684\u7ED1\u5B9A\u8DEF\u5F84\uFF0C\u5982 `dataJson.cus_currency`"
|
|
16
|
+
}),
|
|
17
|
+
value: Expression({ configure }).annotations({
|
|
18
|
+
title: "\u503C",
|
|
19
|
+
description: "\u70B9\u51FB\u540E\u6C42\u503C\uFF0C\u7ED3\u679C\u5199\u5165\u8BE5\u8DEF\u5F84"
|
|
20
|
+
})
|
|
21
|
+
});
|
|
22
|
+
return Schema.Struct({
|
|
23
|
+
type: Schema.Literal(type),
|
|
24
|
+
compatibilityDate: Schema.Literal(compatibilityDate),
|
|
25
|
+
writes: Schema.Array(Write).annotations({
|
|
26
|
+
title: "\u5199\u5165\u503C",
|
|
27
|
+
description: md`
|
|
28
|
+
点击后按列表顺序逐行求值并写入到最近祖先的表单状态:每行的 \`值\`
|
|
29
|
+
表达式结果写入其 \`路径\`。对象值与当前值深合并(数组整体替换),
|
|
30
|
+
其他类型直接替换。留空表示不进行任何写入。
|
|
31
|
+
`
|
|
32
|
+
}),
|
|
33
|
+
onSuccess: Schema.optional(Triggers.annotations({
|
|
34
|
+
title: "\u5199\u5165\u540E",
|
|
35
|
+
description: "\u5199\u5165\u5B8C\u6210\u540E\u6267\u884C\u7684\u64CD\u4F5C"
|
|
36
|
+
}))
|
|
37
|
+
}).annotations({
|
|
38
|
+
title: "StateWriteAction",
|
|
39
|
+
description: "\u70B9\u51FB\u540E\u6309\u987A\u5E8F\u5C06\u6BCF\u4E2A CEL \u8868\u8FBE\u5F0F\u7684\u7ED3\u679C\u5199\u56DE\u6700\u8FD1\u7956\u5148\u8868\u5355\u72B6\u6001\u7684\u5BF9\u5E94\u8DEF\u5F84"
|
|
40
|
+
});
|
|
41
|
+
}
|
package/dist/runtime/components/config/blocks/2026-06-17/com.shwfed.block.tree.single/runtime.vue
CHANGED
|
@@ -27,21 +27,15 @@ const { locale, t } = useI18n({
|
|
|
27
27
|
messages: {
|
|
28
28
|
zh: {
|
|
29
29
|
"tree-single-search-label": "\u641C\u7D22",
|
|
30
|
-
"tree-single-search-clear": "\u6E05\u9664\u641C\u7D22"
|
|
31
|
-
"tree-single-load-error": "\u52A0\u8F7D\u5931\u8D25",
|
|
32
|
-
"tree-single-empty": "\u65E0\u53EF\u9009\u9879"
|
|
30
|
+
"tree-single-search-clear": "\u6E05\u9664\u641C\u7D22"
|
|
33
31
|
},
|
|
34
32
|
en: {
|
|
35
33
|
"tree-single-search-label": "Search",
|
|
36
|
-
"tree-single-search-clear": "Clear search"
|
|
37
|
-
"tree-single-load-error": "Failed to load",
|
|
38
|
-
"tree-single-empty": "No options"
|
|
34
|
+
"tree-single-search-clear": "Clear search"
|
|
39
35
|
},
|
|
40
36
|
ja: {
|
|
41
37
|
"tree-single-search-label": "\u691C\u7D22",
|
|
42
|
-
"tree-single-search-clear": "\u691C\u7D22\u3092\u30AF\u30EA\u30A2"
|
|
43
|
-
"tree-single-load-error": "\u8AAD\u307F\u8FBC\u307F\u306B\u5931\u6557\u3057\u307E\u3057\u305F",
|
|
44
|
-
"tree-single-empty": "\u9078\u629E\u80A2\u306A\u3057"
|
|
38
|
+
"tree-single-search-clear": "\u691C\u7D22\u3092\u30AF\u30EA\u30A2"
|
|
45
39
|
}
|
|
46
40
|
}
|
|
47
41
|
});
|
|
@@ -63,7 +57,6 @@ const styleValue = computed(() => {
|
|
|
63
57
|
const model = ref(void 0);
|
|
64
58
|
const roots = ref([]);
|
|
65
59
|
const loading = ref(false);
|
|
66
|
-
const fetchError = ref(null);
|
|
67
60
|
async function fetchTree() {
|
|
68
61
|
const dataSource = block.value.dataSource;
|
|
69
62
|
if (!dataSource) {
|
|
@@ -93,10 +86,8 @@ async function fetchTree() {
|
|
|
93
86
|
try {
|
|
94
87
|
const result = await Effect.runPromise(Effect.provide(program, Fetch.layer));
|
|
95
88
|
roots.value = result;
|
|
96
|
-
fetchError.value = null;
|
|
97
89
|
} catch (e) {
|
|
98
90
|
console.warn("[shwfed-block] tree dataSource fetch failed", e);
|
|
99
|
-
fetchError.value = e;
|
|
100
91
|
}
|
|
101
92
|
}
|
|
102
93
|
watch(
|
|
@@ -279,13 +270,7 @@ const hasNodeActions = computed(() => block.value.nodeActions.items.length > 0);
|
|
|
279
270
|
</Field>
|
|
280
271
|
|
|
281
272
|
<div
|
|
282
|
-
v-if="
|
|
283
|
-
class="py-1.5 text-sm text-red-500"
|
|
284
|
-
>
|
|
285
|
-
{{ t("tree-single-load-error") }}
|
|
286
|
-
</div>
|
|
287
|
-
<div
|
|
288
|
-
v-else-if="loading && roots.length === 0"
|
|
273
|
+
v-if="loading && roots.length === 0"
|
|
289
274
|
class="flex flex-col gap-1.5 py-1"
|
|
290
275
|
aria-busy="true"
|
|
291
276
|
>
|
|
@@ -347,9 +332,7 @@ const hasNodeActions = computed(() => block.value.nodeActions.items.length > 0);
|
|
|
347
332
|
</template>
|
|
348
333
|
|
|
349
334
|
<template #empty>
|
|
350
|
-
<
|
|
351
|
-
{{ t("tree-single-empty") }}
|
|
352
|
-
</div>
|
|
335
|
+
<span />
|
|
353
336
|
</template>
|
|
354
337
|
</UiTree>
|
|
355
338
|
</div>
|
package/dist/runtime/components/config/blocks/2026-06-25/com.shwfed.block.loop/config.d.vue.ts
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type { Environment } from '../../../../../vendor/cel-js/lib/index.js';
|
|
2
|
+
import { type Value } from './schema.js';
|
|
3
|
+
type __VLS_Props = {
|
|
4
|
+
configure?: (env: Environment) => void;
|
|
5
|
+
};
|
|
6
|
+
type __VLS_ModelProps = {
|
|
7
|
+
modelValue: Value;
|
|
8
|
+
};
|
|
9
|
+
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
10
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
11
|
+
"update:modelValue": (value: {
|
|
12
|
+
readonly type: "com.shwfed.block.loop";
|
|
13
|
+
readonly style?: string | undefined;
|
|
14
|
+
readonly id: string;
|
|
15
|
+
readonly slot: {
|
|
16
|
+
readonly blocks: readonly any[];
|
|
17
|
+
readonly layouts: readonly {
|
|
18
|
+
readonly name: string;
|
|
19
|
+
readonly layout: {
|
|
20
|
+
readonly style?: string | undefined;
|
|
21
|
+
readonly columns: number;
|
|
22
|
+
readonly gap?: number | undefined;
|
|
23
|
+
readonly rows?: number | undefined;
|
|
24
|
+
readonly placements: {
|
|
25
|
+
readonly [x: string]: {
|
|
26
|
+
readonly area: readonly [readonly [number, number], readonly [number, number]];
|
|
27
|
+
readonly v?: "stretch" | "center" | "end" | "start" | undefined;
|
|
28
|
+
readonly h?: "stretch" | "center" | "end" | "start" | undefined;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
readonly media?: string | undefined;
|
|
33
|
+
}[];
|
|
34
|
+
};
|
|
35
|
+
readonly displayName?: string | undefined;
|
|
36
|
+
readonly compatibilityDate: "2026-06-25";
|
|
37
|
+
readonly items: string;
|
|
38
|
+
}) => any;
|
|
39
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
40
|
+
"onUpdate:modelValue"?: ((value: {
|
|
41
|
+
readonly type: "com.shwfed.block.loop";
|
|
42
|
+
readonly style?: string | undefined;
|
|
43
|
+
readonly id: string;
|
|
44
|
+
readonly slot: {
|
|
45
|
+
readonly blocks: readonly any[];
|
|
46
|
+
readonly layouts: readonly {
|
|
47
|
+
readonly name: string;
|
|
48
|
+
readonly layout: {
|
|
49
|
+
readonly style?: string | undefined;
|
|
50
|
+
readonly columns: number;
|
|
51
|
+
readonly gap?: number | undefined;
|
|
52
|
+
readonly rows?: number | undefined;
|
|
53
|
+
readonly placements: {
|
|
54
|
+
readonly [x: string]: {
|
|
55
|
+
readonly area: readonly [readonly [number, number], readonly [number, number]];
|
|
56
|
+
readonly v?: "stretch" | "center" | "end" | "start" | undefined;
|
|
57
|
+
readonly h?: "stretch" | "center" | "end" | "start" | undefined;
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
readonly media?: string | undefined;
|
|
62
|
+
}[];
|
|
63
|
+
};
|
|
64
|
+
readonly displayName?: string | undefined;
|
|
65
|
+
readonly compatibilityDate: "2026-06-25";
|
|
66
|
+
readonly items: string;
|
|
67
|
+
}) => any) | undefined;
|
|
68
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
69
|
+
declare const _default: typeof __VLS_export;
|
|
70
|
+
export default _default;
|