@shwfed/config 2.11.0 → 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.
Files changed (110) hide show
  1. package/dist/mcp.mjs +1458 -1216
  2. package/dist/module.json +1 -1
  3. package/dist/preview/assets/{FieldGroup.vue_vue_type_script_setup_true_lang-UfhMyymD.js → FieldGroup.vue_vue_type_script_setup_true_lang-BE68tZWF.js} +1 -1
  4. package/dist/preview/assets/{badge-CJ9IQ3Jx.js → badge-CGMjdhLX.js} +1 -1
  5. package/dist/preview/assets/config-B7TZ-128.js +1 -0
  6. package/dist/preview/assets/{config-uUF-UHPt.js → config-BSym_jQg.js} +1 -1
  7. package/dist/preview/assets/{config-DIsAIc7H.js → config-ByCFJbd-.js} +1 -1
  8. package/dist/preview/assets/{config--Vx4fL61.js → config-C4cv2S64.js} +1 -1
  9. package/dist/preview/assets/{config-BYktCefJ.js → config-ChrJHusi.js} +1 -1
  10. package/dist/preview/assets/config-CxbYENZ0.js +1 -0
  11. package/dist/preview/assets/{config-5PPug5mk.js → config-DFS2XL3-.js} +1 -1
  12. package/dist/preview/assets/{config-DpLMetys.js → config-DWj1CTai.js} +1 -1
  13. package/dist/preview/assets/{config-CQrDCzYN.js → config-DZI21_UB.js} +1 -1
  14. package/dist/preview/assets/{config-C_g-FYCR.js → config-D_O4ACtH.js} +1 -1
  15. package/dist/preview/assets/{config-BldsYfGM.js → config-DjA8bfLm.js} +1 -1
  16. package/dist/preview/assets/{config-7V1qHjUk.js → config-DwPGLI3R.js} +1 -1
  17. package/dist/preview/assets/{config-N-FdgfwK.js → config-dkVvsr4h.js} +1 -1
  18. package/dist/preview/assets/{config-BeRYF_cz.js → config-hsH0bSZh.js} +1 -1
  19. package/dist/preview/assets/{config-IMd4FZi8.js → config-xrfje67L.js} +1 -1
  20. package/dist/preview/assets/{definition.vue_vue_type_script_setup_true_lang-B_PKfe3G.js → definition.vue_vue_type_script_setup_true_lang-BGk00yfB.js} +1 -1
  21. package/dist/preview/assets/index-B4oT9ZrQ.js +1 -0
  22. package/dist/preview/assets/{index-BCl1NN6k.js → index-BSQlKkJR.js} +214 -202
  23. package/dist/preview/assets/{index-DKWp47QP.js → index-CzQKNngS.js} +1 -1
  24. package/dist/preview/assets/index-DPFQgj9g.css +1 -0
  25. package/dist/preview/assets/{item-XsW7swFt.js → item-D4gmvDO-.js} +1 -1
  26. package/dist/preview/assets/{runtime-JxBzvGnw.js → runtime--e0UxK6b.js} +1 -1
  27. package/dist/preview/assets/runtime-BWH8ForT.js +1 -0
  28. package/dist/preview/assets/runtime-BgO2briD.js +1 -0
  29. package/dist/preview/assets/{runtime-BiFFwOIl.js → runtime-BmEP7xID.js} +1 -1
  30. package/dist/preview/assets/runtime-C66GF-2d.js +1 -0
  31. package/dist/preview/assets/{runtime-BeHohaOZ.js → runtime-CJCOS6D_.js} +1 -1
  32. package/dist/preview/assets/{runtime-ByArW-jJ.js → runtime-CREolKJd.js} +1 -1
  33. package/dist/preview/assets/runtime-CjU46djh.js +1 -0
  34. package/dist/preview/assets/{runtime-Dn172S7t.js → runtime-e59FkBkL.js} +1 -1
  35. package/dist/preview/assets/runtime-pYLX1Bb-.js +1 -0
  36. package/dist/preview/assets/{runtime-bq0hmEXY.js → runtime-wvP7jhBK.js} +1 -1
  37. package/dist/preview/assets/{schema-meta-CZ9yXnsa.js → schema-meta-C4Ttq3eE.js} +1 -1
  38. package/dist/preview/index.html +2 -2
  39. package/dist/runtime/components/actions/buttons/2026-06-25/com.shwfed.actions.button.state.write/config.d.vue.ts +39 -0
  40. package/dist/runtime/components/actions/buttons/2026-06-25/com.shwfed.actions.button.state.write/config.vue +127 -0
  41. package/dist/runtime/components/actions/buttons/2026-06-25/com.shwfed.actions.button.state.write/config.vue.d.ts +39 -0
  42. package/dist/runtime/components/actions/buttons/2026-06-25/com.shwfed.actions.button.state.write/runtime.d.vue.ts +8 -0
  43. package/dist/runtime/components/actions/buttons/2026-06-25/com.shwfed.actions.button.state.write/runtime.vue +62 -0
  44. package/dist/runtime/components/actions/buttons/2026-06-25/com.shwfed.actions.button.state.write/runtime.vue.d.ts +8 -0
  45. package/dist/runtime/components/actions/buttons/2026-06-25/com.shwfed.actions.button.state.write/schema.d.ts +25 -0
  46. package/dist/runtime/components/actions/buttons/2026-06-25/com.shwfed.actions.button.state.write/schema.js +41 -0
  47. package/dist/runtime/components/config/blocks/2026-06-17/com.shwfed.block.tree.single/runtime.vue +5 -22
  48. package/dist/runtime/components/config/blocks/2026-06-25/com.shwfed.block.loop/config.d.vue.ts +70 -0
  49. package/dist/runtime/components/config/blocks/2026-06-25/com.shwfed.block.loop/config.vue +349 -0
  50. package/dist/runtime/components/config/blocks/2026-06-25/com.shwfed.block.loop/config.vue.d.ts +70 -0
  51. package/dist/runtime/components/config/blocks/2026-06-25/com.shwfed.block.loop/loop-item.d.vue.ts +33 -0
  52. package/dist/runtime/components/config/blocks/2026-06-25/com.shwfed.block.loop/loop-item.vue +37 -0
  53. package/dist/runtime/components/config/blocks/2026-06-25/com.shwfed.block.loop/loop-item.vue.d.ts +33 -0
  54. package/dist/runtime/components/config/blocks/2026-06-25/com.shwfed.block.loop/loop-scope-provider.d.vue.ts +13 -0
  55. package/dist/runtime/components/config/blocks/2026-06-25/com.shwfed.block.loop/loop-scope-provider.vue +22 -0
  56. package/dist/runtime/components/config/blocks/2026-06-25/com.shwfed.block.loop/loop-scope-provider.vue.d.ts +13 -0
  57. package/dist/runtime/components/config/blocks/2026-06-25/com.shwfed.block.loop/runtime.d.vue.ts +70 -0
  58. package/dist/runtime/components/config/blocks/2026-06-25/com.shwfed.block.loop/runtime.vue +62 -0
  59. package/dist/runtime/components/config/blocks/2026-06-25/com.shwfed.block.loop/runtime.vue.d.ts +70 -0
  60. package/dist/runtime/components/config/blocks/2026-06-25/com.shwfed.block.loop/schema.d.ts +85 -0
  61. package/dist/runtime/components/config/blocks/2026-06-25/com.shwfed.block.loop/schema.js +60 -0
  62. package/dist/runtime/components/form/fields/2026-04-22/com.shwfed.form.field.text/schema.js +10 -1
  63. package/dist/runtime/components/form/fields/2026-04-28/com.shwfed.form.field.number/schema.js +10 -1
  64. package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.multi/runtime.vue +2 -19
  65. package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.single/runtime.vue +5 -22
  66. package/dist/runtime/components/operations/2026-06-15/com.shwfed.operation.http.download/config.d.vue.ts +2 -0
  67. package/dist/runtime/components/operations/2026-06-15/com.shwfed.operation.http.download/config.vue +49 -22
  68. package/dist/runtime/components/operations/2026-06-15/com.shwfed.operation.http.download/config.vue.d.ts +2 -0
  69. package/dist/runtime/components/operations/2026-06-15/com.shwfed.operation.http.download/runtime.js +17 -10
  70. package/dist/runtime/components/operations/2026-06-15/com.shwfed.operation.http.download/schema.d.ts +1 -0
  71. package/dist/runtime/components/operations/2026-06-15/com.shwfed.operation.http.download/schema.js +25 -3
  72. package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.number-input/schema.js +10 -1
  73. package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.text-input/schema.js +10 -1
  74. package/dist/runtime/components/table/columns/2026-05-24/com.shwfed.table.column.combobox-single.remote.options-remote/config.d.vue.ts +2 -2
  75. package/dist/runtime/components/table/columns/2026-05-24/com.shwfed.table.column.combobox-single.remote.options-remote/config.vue.d.ts +2 -2
  76. package/dist/runtime/components/table/columns/2026-05-24/com.shwfed.table.column.combobox-single.remote.options-static/config.d.vue.ts +2 -2
  77. package/dist/runtime/components/table/columns/2026-05-24/com.shwfed.table.column.combobox-single.remote.options-static/config.vue.d.ts +2 -2
  78. package/dist/runtime/components/table/columns/2026-05-25/com.shwfed.table.column.combobox-multi.remote.options-remote/config.d.vue.ts +2 -2
  79. package/dist/runtime/components/table/columns/2026-05-25/com.shwfed.table.column.combobox-multi.remote.options-remote/config.vue.d.ts +2 -2
  80. package/dist/runtime/components/table/columns/2026-05-25/com.shwfed.table.column.combobox-multi.remote.options-static/config.d.vue.ts +2 -2
  81. package/dist/runtime/components/table/columns/2026-05-25/com.shwfed.table.column.combobox-multi.remote.options-static/config.vue.d.ts +2 -2
  82. package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-multi.remote/config.d.vue.ts +2 -2
  83. package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-multi.remote/config.vue.d.ts +2 -2
  84. package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-single.remote/config.d.vue.ts +2 -2
  85. package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-single.remote/config.vue.d.ts +2 -2
  86. package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-multi/config.d.vue.ts +2 -2
  87. package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-multi/config.vue.d.ts +2 -2
  88. package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-single/config.d.vue.ts +2 -2
  89. package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-single/config.vue.d.ts +2 -2
  90. package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.combobox-multi/config.d.vue.ts +2 -2
  91. package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.combobox-multi/config.vue.d.ts +2 -2
  92. package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.combobox-single/config.d.vue.ts +2 -2
  93. package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.combobox-single/config.vue.d.ts +2 -2
  94. package/dist/runtime/components/table/columns/2026-06-22/com.shwfed.table.column.date-range-input/schema.js +2 -1
  95. package/dist/runtime/components/ui/date-picker/DatePickerInput.vue +9 -2
  96. package/dist/runtime/components/ui/date-range-picker/DateRangePickerInput.vue +13 -4
  97. package/dist/runtime/components/ui/expression-editor/ExpressionEditor.vue +1 -1
  98. package/dist/runtime/share/loop-item-var.d.ts +21 -0
  99. package/dist/runtime/share/loop-item-var.js +13 -0
  100. package/dist/runtime/vendor/cel-js/CLAUDE.md +1 -1
  101. package/dist/runtime/vendor/cel-js/lib/http-builder.d.ts +38 -3
  102. package/dist/runtime/vendor/cel-js/lib/http-builder.js +33 -0
  103. package/package.json +1 -1
  104. package/dist/preview/assets/config-DPX7vGqV.js +0 -1
  105. package/dist/preview/assets/index-8Ph-sFDI.css +0 -1
  106. package/dist/preview/assets/index-Core7vRW.js +0 -1
  107. package/dist/preview/assets/runtime-B-ABO0r0.js +0 -1
  108. package/dist/preview/assets/runtime-CpVTGNFZ.js +0 -1
  109. package/dist/preview/assets/runtime-DQ1TnQ7n.js +0 -1
  110. package/dist/preview/assets/runtime-DY7hr7v1.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
+ }
@@ -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="fetchError && roots.length === 0"
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
- <div class="py-1.5 text-sm text-zinc-400">
351
- {{ t("tree-single-empty") }}
352
- </div>
335
+ <span />
353
336
  </template>
354
337
  </UiTree>
355
338
  </div>
@@ -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;