@shwfed/config 2.2.5 → 2.3.1

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 (72) hide show
  1. package/dist/module.json +1 -1
  2. package/dist/runtime/components/actions/buttons/2026-05-21/com.shwfed.actions.button.http.download/config.d.vue.ts +61 -0
  3. package/dist/runtime/components/actions/buttons/2026-05-21/com.shwfed.actions.button.http.download/config.vue +187 -0
  4. package/dist/runtime/components/actions/buttons/2026-05-21/com.shwfed.actions.button.http.download/config.vue.d.ts +61 -0
  5. package/dist/runtime/components/actions/buttons/2026-05-21/com.shwfed.actions.button.http.download/runtime.d.vue.ts +8 -0
  6. package/dist/runtime/components/actions/buttons/2026-05-21/com.shwfed.actions.button.http.download/runtime.vue +62 -0
  7. package/dist/runtime/components/actions/buttons/2026-05-21/com.shwfed.actions.button.http.download/runtime.vue.d.ts +8 -0
  8. package/dist/runtime/components/actions/buttons/2026-05-21/com.shwfed.actions.button.http.download/schema.d.ts +40 -0
  9. package/dist/runtime/components/actions/buttons/2026-05-21/com.shwfed.actions.button.http.download/schema.js +87 -0
  10. package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.table/config.d.vue.ts +8 -8
  11. package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.table/config.vue.d.ts +8 -8
  12. package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.table/runtime.d.vue.ts +8 -8
  13. package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.table/runtime.vue.d.ts +8 -8
  14. package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.table/schema.d.ts +9 -15
  15. package/dist/runtime/components/form/fields/2026-05-18/com.shwfed.form.field.table/config.d.vue.ts +2 -2
  16. package/dist/runtime/components/form/fields/2026-05-18/com.shwfed.form.field.table/config.vue +32 -52
  17. package/dist/runtime/components/form/fields/2026-05-18/com.shwfed.form.field.table/config.vue.d.ts +2 -2
  18. package/dist/runtime/components/form/fields/2026-05-18/com.shwfed.form.field.table/runtime.vue +19 -8
  19. package/dist/runtime/components/form/fields/2026-05-18/com.shwfed.form.field.table/schema.d.ts +2 -2
  20. package/dist/runtime/components/form/fields/2026-05-18/com.shwfed.form.field.table/schema.js +4 -3
  21. package/dist/runtime/components/table/columns/2026-05-13/com.shwfed.table.column.switch/config.vue +25 -0
  22. package/dist/runtime/components/table/columns/2026-05-13/com.shwfed.table.column.switch/runtime.vue +2 -8
  23. package/dist/runtime/components/table/columns/2026-05-13/com.shwfed.table.column.switch/schema.d.ts +4 -0
  24. package/dist/runtime/components/table/columns/2026-05-13/com.shwfed.table.column.switch/schema.js +5 -0
  25. package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.combobox-single/config.d.vue.ts +133 -0
  26. package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.combobox-single/config.vue +533 -0
  27. package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.combobox-single/config.vue.d.ts +133 -0
  28. package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.combobox-single/runtime.d.vue.ts +9 -0
  29. package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.combobox-single/runtime.vue +237 -0
  30. package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.combobox-single/runtime.vue.d.ts +9 -0
  31. package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.combobox-single/schema.d.ts +124 -0
  32. package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.combobox-single/schema.js +96 -0
  33. package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.number-input/config.d.vue.ts +10 -0
  34. package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.number-input/config.vue +475 -0
  35. package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.number-input/config.vue.d.ts +10 -0
  36. package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.number-input/runtime.d.vue.ts +9 -0
  37. package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.number-input/runtime.vue +156 -0
  38. package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.number-input/runtime.vue.d.ts +9 -0
  39. package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.number-input/schema.d.ts +56 -0
  40. package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.number-input/schema.js +81 -0
  41. package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.switch/config.d.vue.ts +10 -0
  42. package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.switch/config.vue +310 -0
  43. package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.switch/config.vue.d.ts +10 -0
  44. package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.switch/runtime.d.vue.ts +9 -0
  45. package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.switch/runtime.vue +81 -0
  46. package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.switch/runtime.vue.d.ts +9 -0
  47. package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.switch/schema.d.ts +57 -0
  48. package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.switch/schema.js +59 -0
  49. package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.text-input/config.d.vue.ts +10 -0
  50. package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.text-input/config.vue +292 -0
  51. package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.text-input/config.vue.d.ts +10 -0
  52. package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.text-input/runtime.d.vue.ts +9 -0
  53. package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.text-input/runtime.vue +140 -0
  54. package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.text-input/runtime.vue.d.ts +9 -0
  55. package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.text-input/schema.d.ts +50 -0
  56. package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.text-input/schema.js +53 -0
  57. package/dist/runtime/components/table/config.d.vue.ts +2 -0
  58. package/dist/runtime/components/table/config.vue +136 -109
  59. package/dist/runtime/components/table/config.vue.d.ts +2 -0
  60. package/dist/runtime/components/table/index.d.vue.ts +2 -2
  61. package/dist/runtime/components/table/index.vue +46 -53
  62. package/dist/runtime/components/table/index.vue.d.ts +2 -2
  63. package/dist/runtime/components/table/row-provider.d.vue.ts +23 -0
  64. package/dist/runtime/components/table/row-provider.vue +55 -0
  65. package/dist/runtime/components/table/row-provider.vue.d.ts +23 -0
  66. package/dist/runtime/components/table/schema.d.ts +17 -29
  67. package/dist/runtime/components/table/schema.js +22 -18
  68. package/dist/runtime/components/table/utils/shared.d.ts +28 -0
  69. package/dist/runtime/components/table/utils/shared.js +40 -0
  70. package/dist/runtime/components/ui/field/index.js +6 -1
  71. package/dist/runtime/components/ui/input/Input.vue +1 -1
  72. package/package.json +1 -1
package/dist/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "shwfed",
3
3
  "configKey": "shwfed",
4
- "version": "2.2.5",
4
+ "version": "2.3.1",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "unknown"
@@ -0,0 +1,61 @@
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 template: {
8
+ readonly download?: string | undefined;
9
+ readonly request: string;
10
+ };
11
+ readonly onError?: readonly {
12
+ readonly target: string;
13
+ readonly operation: string;
14
+ }[] | undefined;
15
+ readonly type: "com.shwfed.actions.button.http.download";
16
+ readonly compatibilityDate: "2026-05-21";
17
+ readonly messageExpression?: string | undefined;
18
+ readonly resultExpression?: string | undefined;
19
+ readonly onSuccess?: readonly {
20
+ readonly target: string;
21
+ readonly operation: string;
22
+ }[] | undefined;
23
+ readonly onWarning?: readonly {
24
+ readonly target: string;
25
+ readonly operation: string;
26
+ }[] | undefined;
27
+ readonly onInfo?: readonly {
28
+ readonly target: string;
29
+ readonly operation: string;
30
+ }[] | undefined;
31
+ }) => any;
32
+ }, string, import("vue").PublicProps, Readonly<__VLS_ModelProps> & Readonly<{
33
+ "onUpdate:modelValue"?: ((value: {
34
+ readonly template: {
35
+ readonly download?: string | undefined;
36
+ readonly request: string;
37
+ };
38
+ readonly onError?: readonly {
39
+ readonly target: string;
40
+ readonly operation: string;
41
+ }[] | undefined;
42
+ readonly type: "com.shwfed.actions.button.http.download";
43
+ readonly compatibilityDate: "2026-05-21";
44
+ readonly messageExpression?: string | undefined;
45
+ readonly resultExpression?: string | undefined;
46
+ readonly onSuccess?: readonly {
47
+ readonly target: string;
48
+ readonly operation: string;
49
+ }[] | undefined;
50
+ readonly onWarning?: readonly {
51
+ readonly target: string;
52
+ readonly operation: string;
53
+ }[] | undefined;
54
+ readonly onInfo?: readonly {
55
+ readonly target: string;
56
+ readonly operation: string;
57
+ }[] | undefined;
58
+ }) => any) | undefined;
59
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
60
+ declare const _default: typeof __VLS_export;
61
+ export default _default;
@@ -0,0 +1,187 @@
1
+ <script setup>
2
+ import { computed } from "vue";
3
+ import { Field, FieldLabel } from "../../../../ui/field";
4
+ import { ExpressionEditor } from "../../../../ui/expression-editor";
5
+ import { Markdown } from "../../../../ui/markdown";
6
+ import { getStructFieldDescription, getStructFieldTitle } from "../../../schema";
7
+ import TriggersField from "../../../components/triggers-field.vue";
8
+ import { JSON_VAR, schema } from "./schema";
9
+ defineOptions({ name: "ShwfedHttpDownloadActionConfig" });
10
+ const value = defineModel({ type: null, ...{ required: true } });
11
+ const actionSchema = schema(() => {
12
+ });
13
+ const fieldTitle = (f) => getStructFieldTitle(actionSchema, f) ?? f;
14
+ const fieldDescription = (f) => getStructFieldDescription(actionSchema, f);
15
+ const RESULT_FIELDS = ["onSuccess", "onWarning", "onError", "onInfo"];
16
+ const templateRequestText = computed({
17
+ get: () => value.value.template?.request ?? "",
18
+ set: (next) => {
19
+ value.value = {
20
+ ...value.value,
21
+ template: { ...value.value.template, request: next }
22
+ };
23
+ }
24
+ });
25
+ const templateDownloadText = computed({
26
+ get: () => value.value.template?.download ?? "",
27
+ set: (next) => {
28
+ const current = value.value.template ?? { request: "" };
29
+ if (next.length === 0) {
30
+ const { download: _omit, ...rest } = current;
31
+ value.value = { ...value.value, template: rest };
32
+ } else {
33
+ value.value = { ...value.value, template: { ...current, download: next } };
34
+ }
35
+ }
36
+ });
37
+ function updateMessageExpression(v) {
38
+ const next = { ...value.value };
39
+ if (v.length === 0) delete next.messageExpression;
40
+ else next.messageExpression = v;
41
+ value.value = next;
42
+ }
43
+ function updateResultExpression(v) {
44
+ const next = { ...value.value };
45
+ if (v.length === 0) delete next.resultExpression;
46
+ else next.resultExpression = v;
47
+ value.value = next;
48
+ }
49
+ function updateTriggers(key, next) {
50
+ const draft = { ...value.value };
51
+ if (next.length === 0) Reflect.deleteProperty(draft, key);
52
+ else draft[key] = next;
53
+ value.value = draft;
54
+ }
55
+ </script>
56
+
57
+ <template>
58
+ <div class="flex flex-col gap-3">
59
+ <div class="grid grid-cols-2 gap-3">
60
+ <Field orientation="vertical">
61
+ <FieldLabel class="text-xs text-zinc-500">
62
+ <template #tooltip>
63
+ <Markdown
64
+ :source="fieldDescription('template') ?? '\u8FD4\u56DE `HttpRequest` \u7684 CEL \u8868\u8FBE\u5F0F\uFF1B\u672A\u914D\u7F6E\u300C\u4E0B\u8F7D\u8BF7\u6C42\u300D\u65F6\u76F4\u63A5\u4E0B\u8F7D\u5176\u54CD\u5E94'"
65
+ block
66
+ class="prose prose-sm prose-zinc"
67
+ />
68
+ </template>
69
+ 请求
70
+ </FieldLabel>
71
+ <ExpressionEditor
72
+ :model-value="templateRequestText"
73
+ multiline
74
+ placeholder="例:http.get('https://api.example.com/files/123')"
75
+ result-type="HttpRequest"
76
+ class="min-h-16"
77
+ @update:model-value="(v) => templateRequestText = v"
78
+ />
79
+ </Field>
80
+
81
+ <Field orientation="vertical">
82
+ <FieldLabel class="text-xs text-zinc-500">
83
+ <template #tooltip>
84
+ <Markdown
85
+ source="可选的第二步:用第一步响应 `json` 中的凭据构造真正的下载请求,例如 `json.data.key`"
86
+ block
87
+ class="prose prose-sm prose-zinc"
88
+ />
89
+ </template>
90
+ 下载请求
91
+ </FieldLabel>
92
+ <ExpressionEditor
93
+ :model-value="templateDownloadText"
94
+ multiline
95
+ placeholder="例:http.get('https://api.example.com/download').query('key', json.data.key)"
96
+ result-type="HttpRequest"
97
+ :extra-vars="{ json: JSON_VAR }"
98
+ class="min-h-16"
99
+ @update:model-value="(v) => templateDownloadText = v"
100
+ />
101
+ </Field>
102
+ </div>
103
+
104
+ <div class="flex items-start gap-2">
105
+ <Field
106
+ orientation="vertical"
107
+ class="flex-1 basis-0 min-w-0"
108
+ >
109
+ <FieldLabel class="text-xs text-zinc-500">
110
+ <template
111
+ v-if="fieldDescription('messageExpression')"
112
+ #tooltip
113
+ >
114
+ <Markdown
115
+ :source="fieldDescription('messageExpression')"
116
+ block
117
+ class="prose prose-sm prose-zinc"
118
+ />
119
+ </template>
120
+ {{ fieldTitle("messageExpression") }}
121
+ </FieldLabel>
122
+ <ExpressionEditor
123
+ :model-value="value.messageExpression ?? ''"
124
+ placeholder="例:string(json.message)"
125
+ result-type="string"
126
+ :extra-vars="{ json: JSON_VAR }"
127
+ @update:model-value="updateMessageExpression"
128
+ />
129
+ </Field>
130
+
131
+ <Field
132
+ orientation="vertical"
133
+ class="flex-1 basis-0 min-w-0"
134
+ >
135
+ <FieldLabel class="text-xs text-zinc-500">
136
+ <template
137
+ v-if="fieldDescription('resultExpression')"
138
+ #tooltip
139
+ >
140
+ <Markdown
141
+ :source="fieldDescription('resultExpression')"
142
+ block
143
+ class="prose prose-sm prose-zinc"
144
+ />
145
+ </template>
146
+ {{ fieldTitle("resultExpression") }}
147
+ </FieldLabel>
148
+ <ExpressionEditor
149
+ :model-value="value.resultExpression ?? ''"
150
+ placeholder="例:json.code == 0 ? 'success' : 'error'"
151
+ result-type="string"
152
+ :extra-vars="{ json: JSON_VAR }"
153
+ @update:model-value="updateResultExpression"
154
+ />
155
+ </Field>
156
+ </div>
157
+
158
+ <!-- One trigger list per 「执行结果」: the request completes, the result
159
+ classifies the outcome, and the matching cell's operations run. -->
160
+ <div class="grid grid-cols-2 gap-3">
161
+ <Field
162
+ v-for="key in RESULT_FIELDS"
163
+ :key="key"
164
+ orientation="vertical"
165
+ class="min-w-0"
166
+ >
167
+ <FieldLabel class="text-xs text-zinc-500">
168
+ <template
169
+ v-if="fieldDescription(key)"
170
+ #tooltip
171
+ >
172
+ <Markdown
173
+ :source="fieldDescription(key)"
174
+ block
175
+ class="prose prose-sm prose-zinc"
176
+ />
177
+ </template>
178
+ {{ fieldTitle(key) }}
179
+ </FieldLabel>
180
+ <TriggersField
181
+ :triggers="value[key] ?? []"
182
+ @update:triggers="(v) => updateTriggers(key, v)"
183
+ />
184
+ </Field>
185
+ </div>
186
+ </div>
187
+ </template>
@@ -0,0 +1,61 @@
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 template: {
8
+ readonly download?: string | undefined;
9
+ readonly request: string;
10
+ };
11
+ readonly onError?: readonly {
12
+ readonly target: string;
13
+ readonly operation: string;
14
+ }[] | undefined;
15
+ readonly type: "com.shwfed.actions.button.http.download";
16
+ readonly compatibilityDate: "2026-05-21";
17
+ readonly messageExpression?: string | undefined;
18
+ readonly resultExpression?: string | undefined;
19
+ readonly onSuccess?: readonly {
20
+ readonly target: string;
21
+ readonly operation: string;
22
+ }[] | undefined;
23
+ readonly onWarning?: readonly {
24
+ readonly target: string;
25
+ readonly operation: string;
26
+ }[] | undefined;
27
+ readonly onInfo?: readonly {
28
+ readonly target: string;
29
+ readonly operation: string;
30
+ }[] | undefined;
31
+ }) => any;
32
+ }, string, import("vue").PublicProps, Readonly<__VLS_ModelProps> & Readonly<{
33
+ "onUpdate:modelValue"?: ((value: {
34
+ readonly template: {
35
+ readonly download?: string | undefined;
36
+ readonly request: string;
37
+ };
38
+ readonly onError?: readonly {
39
+ readonly target: string;
40
+ readonly operation: string;
41
+ }[] | undefined;
42
+ readonly type: "com.shwfed.actions.button.http.download";
43
+ readonly compatibilityDate: "2026-05-21";
44
+ readonly messageExpression?: string | undefined;
45
+ readonly resultExpression?: string | undefined;
46
+ readonly onSuccess?: readonly {
47
+ readonly target: string;
48
+ readonly operation: string;
49
+ }[] | undefined;
50
+ readonly onWarning?: readonly {
51
+ readonly target: string;
52
+ readonly operation: string;
53
+ }[] | undefined;
54
+ readonly onInfo?: readonly {
55
+ readonly target: string;
56
+ readonly operation: string;
57
+ }[] | undefined;
58
+ }) => any) | undefined;
59
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
60
+ declare const _default: typeof __VLS_export;
61
+ 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 { toast } from "vue-sonner";
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 ShwfedActionDefinition from "../../../components/definition.vue";
8
+ defineOptions({ name: "ShwfedHttpDownloadActionRuntime" });
9
+ const props = defineProps({
10
+ buttonId: { type: String, required: true },
11
+ config: { type: null, required: true }
12
+ });
13
+ const inherited = injectCELContext();
14
+ const $cel = (expression, context) => _rawCel(expression, { ...celBindings(inherited), ...context });
15
+ const channel = useEventChannel();
16
+ const TOAST_STYLES = /* @__PURE__ */ new Set(["success", "error", "warning", "info"]);
17
+ function saveFile(file) {
18
+ const url = URL.createObjectURL(file);
19
+ const a = document.createElement("a");
20
+ a.href = url;
21
+ a.download = file.name;
22
+ document.body.appendChild(a);
23
+ a.click();
24
+ a.remove();
25
+ URL.revokeObjectURL(url);
26
+ }
27
+ const effect = Effect.suspend(() => Effect.gen(function* () {
28
+ const { template, messageExpression, resultExpression } = props.config;
29
+ const requestBuilder = yield* $cel(template.request);
30
+ if (!template.download) {
31
+ const file = yield* requestBuilder.file();
32
+ yield* Effect.sync(() => saveFile(file));
33
+ return yield* dispatchTriggers(channel, props.config.onSuccess);
34
+ }
35
+ const json = yield* requestBuilder.json();
36
+ const context = { json };
37
+ const kind = resultExpression === void 0 ? "success" : yield* Effect.map($cel(resultExpression, context), (s) => TOAST_STYLES.has(s) ? s : "success");
38
+ if (messageExpression !== void 0) {
39
+ const message = yield* $cel(messageExpression, context);
40
+ yield* Effect.sync(() => toast[kind](message));
41
+ }
42
+ if (kind === "success" || kind === "info") {
43
+ const downloadBuilder = yield* $cel(template.download, context);
44
+ const file = yield* downloadBuilder.file();
45
+ yield* Effect.sync(() => saveFile(file));
46
+ }
47
+ const triggers = {
48
+ success: props.config.onSuccess,
49
+ warning: props.config.onWarning,
50
+ error: props.config.onError,
51
+ info: props.config.onInfo
52
+ };
53
+ return yield* dispatchTriggers(channel, triggers[kind]);
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,40 @@
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.download";
4
+ export declare const compatibilityDate: "2026-05-21";
5
+ export declare const metadata: {
6
+ readonly name: "下载文件";
7
+ readonly icon: "fluent:arrow-download-20-regular";
8
+ };
9
+ export declare const JSON_VAR: {
10
+ readonly type: "dyn";
11
+ readonly label: "HTTP 响应体";
12
+ readonly description: "第一步 `请求` 的响应体(已解析 JSON);用于构造第二步下载请求";
13
+ };
14
+ export declare function schema(configure: (env: Environment) => void): Schema.Struct<{
15
+ type: Schema.Literal<["com.shwfed.actions.button.http.download"]>;
16
+ compatibilityDate: Schema.Literal<["2026-05-21"]>;
17
+ template: Schema.Struct<{
18
+ request: Schema.Schema<string, string, never>;
19
+ download: Schema.optional<Schema.Schema<string, string, never>>;
20
+ }>;
21
+ messageExpression: Schema.optional<Schema.Schema<string, string, never>>;
22
+ resultExpression: Schema.optional<Schema.Schema<string, string, never>>;
23
+ onSuccess: Schema.optional<Schema.Array$<Schema.Struct<{
24
+ target: Schema.refine<string, typeof Schema.String>;
25
+ operation: Schema.SchemaClass<string, string, never>;
26
+ }>>>;
27
+ onWarning: Schema.optional<Schema.Array$<Schema.Struct<{
28
+ target: Schema.refine<string, typeof Schema.String>;
29
+ operation: Schema.SchemaClass<string, string, never>;
30
+ }>>>;
31
+ onError: Schema.optional<Schema.Array$<Schema.Struct<{
32
+ target: Schema.refine<string, typeof Schema.String>;
33
+ operation: Schema.SchemaClass<string, string, never>;
34
+ }>>>;
35
+ onInfo: Schema.optional<Schema.Array$<Schema.Struct<{
36
+ target: Schema.refine<string, typeof Schema.String>;
37
+ operation: Schema.SchemaClass<string, string, never>;
38
+ }>>>;
39
+ }>;
40
+ 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 { md } from "../../../../../share/markdown.js";
5
+ export const type = "com.shwfed.actions.button.http.download";
6
+ export const compatibilityDate = "2026-05-21";
7
+ export const metadata = {
8
+ name: "\u4E0B\u8F7D\u6587\u4EF6",
9
+ icon: "fluent:arrow-download-20-regular"
10
+ };
11
+ export const JSON_VAR = {
12
+ type: "dyn",
13
+ label: "HTTP \u54CD\u5E94\u4F53",
14
+ description: "\u7B2C\u4E00\u6B65 `\u8BF7\u6C42` \u7684\u54CD\u5E94\u4F53\uFF08\u5DF2\u89E3\u6790 JSON\uFF09\uFF1B\u7528\u4E8E\u6784\u9020\u7B2C\u4E8C\u6B65\u4E0B\u8F7D\u8BF7\u6C42"
15
+ };
16
+ function configureWithJson(configure) {
17
+ return (env) => {
18
+ configure(env);
19
+ env.registerVariable("json", JSON_VAR.type, { description: JSON_VAR.description });
20
+ };
21
+ }
22
+ export function schema(configure) {
23
+ const CelHttpRequest = Expression({ configure, resultType: "HttpRequest" });
24
+ const CelDownloadRequest = Expression({ configure: configureWithJson(configure), resultType: "HttpRequest" });
25
+ const CelMessage = Expression({ configure: configureWithJson(configure), resultType: "string" });
26
+ return Schema.Struct({
27
+ type: Schema.Literal(type),
28
+ compatibilityDate: Schema.Literal(compatibilityDate),
29
+ template: Schema.Struct({
30
+ request: CelHttpRequest.annotations({
31
+ title: "\u8BF7\u6C42",
32
+ description: md`
33
+ 返回 \`HttpRequest\` 的 CEL 表达式。未配置「下载请求」时直接作为文件下载请求;
34
+ 配置了「下载请求」时作为第一步请求,其响应体(JSON)通过 \`json\` 暴露给「下载请求」与状态表达式
35
+ `
36
+ }),
37
+ download: Schema.optional(CelDownloadRequest.annotations({
38
+ title: "\u4E0B\u8F7D\u8BF7\u6C42",
39
+ description: md`
40
+ 可选的第二步:返回 \`HttpRequest\` 的 CEL 表达式,可通过 \`json\` 引用第一步的响应体,
41
+ 例如用 \`json.data.key\` 构造真正的下载请求
42
+ `
43
+ }))
44
+ }).annotations({
45
+ title: "\u4E0B\u8F7D",
46
+ description: "\u70B9\u51FB\u540E\u53D1\u8D77 HTTP \u8BF7\u6C42\u5E76\u628A\u54CD\u5E94\u4FDD\u5B58\u4E3A\u672C\u5730\u6587\u4EF6"
47
+ }),
48
+ messageExpression: Schema.optional(CelMessage.annotations({
49
+ title: "\u6D88\u606F",
50
+ description: md`
51
+ 仅当配置了「下载请求」时生效;对第一步响应体(\`json\`)求值,返回 \`string\` 作为 toast 显示。
52
+ 不配置则不显示。未配置「下载请求」时被忽略。
53
+ `
54
+ })),
55
+ resultExpression: Schema.optional(CelMessage.annotations({
56
+ title: "\u6267\u884C\u7ED3\u679C",
57
+ description: md`
58
+ 仅当配置了「下载请求」时生效;对第一步响应体(\`json\`)求值,返回 \`string\`。
59
+ 支持 \`'success' | 'warning' | 'error' | 'info'\`;其他值按 \`success\` 处理。不配置则按 \`success\` 处理。
60
+
61
+ \`error\` 与 \`warning\` 会跳过实际的文件下载,只触发对应分支的操作;
62
+ \`success\` 与 \`info\` 会继续执行「下载请求」并保存文件。
63
+
64
+ 它同时决定 toast 的样式,以及完成后执行下方哪一组操作。
65
+ `
66
+ })),
67
+ onSuccess: Schema.optional(Triggers.annotations({
68
+ title: "\u6210\u529F",
69
+ description: "\u300C\u6267\u884C\u7ED3\u679C\u300D\u4E3A `success` \u65F6\uFF0C\u4E0B\u8F7D\u5B8C\u6210\u540E\u6267\u884C\u7684\u64CD\u4F5C\uFF1B\u672A\u914D\u7F6E\u300C\u4E0B\u8F7D\u8BF7\u6C42\u300D\u65F6\uFF0CHTTP \u6210\u529F\u5373\u89C6\u4E3A `success`"
70
+ })),
71
+ onWarning: Schema.optional(Triggers.annotations({
72
+ title: "\u8B66\u544A",
73
+ description: "\u300C\u6267\u884C\u7ED3\u679C\u300D\u4E3A `warning` \u65F6\u6267\u884C\u7684\u64CD\u4F5C\uFF1B\u8DF3\u8FC7\u5B9E\u9645\u7684\u6587\u4EF6\u4E0B\u8F7D"
74
+ })),
75
+ onError: Schema.optional(Triggers.annotations({
76
+ title: "\u9519\u8BEF",
77
+ description: "\u300C\u6267\u884C\u7ED3\u679C\u300D\u4E3A `error` \u65F6\u6267\u884C\u7684\u64CD\u4F5C\uFF1B\u8DF3\u8FC7\u5B9E\u9645\u7684\u6587\u4EF6\u4E0B\u8F7D"
78
+ })),
79
+ onInfo: Schema.optional(Triggers.annotations({
80
+ title: "\u4FE1\u606F",
81
+ description: "\u300C\u6267\u884C\u7ED3\u679C\u300D\u4E3A `info` \u65F6\uFF0C\u4E0B\u8F7D\u5B8C\u6210\u540E\u6267\u884C\u7684\u64CD\u4F5C"
82
+ }))
83
+ }).annotations({
84
+ title: "HttpDownloadAction",
85
+ description: "\u70B9\u51FB\u540E\u53D1\u8D77 HTTP \u8BF7\u6C42\u5E76\u628A\u54CD\u5E94\u4FDD\u5B58\u4E3A\u672C\u5730\u6587\u4EF6\uFF0C\u652F\u6301\u4E24\u6B65\u5F0F\uFF08\u5148\u53D6\u51ED\u636E\u518D\u4E0B\u8F7D\uFF09"
86
+ });
87
+ }
@@ -34,11 +34,11 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
34
34
  readonly message: string;
35
35
  }[]] | undefined;
36
36
  }[];
37
- readonly dataSource: {
37
+ readonly dataSource?: {
38
38
  readonly data: string;
39
39
  readonly request?: string | undefined;
40
40
  readonly total?: string | undefined;
41
- };
41
+ } | undefined;
42
42
  readonly actions?: {
43
43
  readonly size: "default" | "sm" | "xs";
44
44
  readonly style?: string | undefined;
@@ -147,9 +147,9 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
147
147
  readonly locale: "en" | "ja" | "ko";
148
148
  readonly message: string;
149
149
  }[]] | undefined;
150
- readonly pageSizes: readonly number[];
151
- readonly pageIndex: number;
152
150
  readonly pageSize: number;
151
+ readonly pageSizes?: readonly number[] | undefined;
152
+ readonly pageIndex?: number | undefined;
153
153
  } | undefined;
154
154
  readonly initialState?: {
155
155
  readonly expanded?: boolean | {
@@ -209,11 +209,11 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
209
209
  readonly message: string;
210
210
  }[]] | undefined;
211
211
  }[];
212
- readonly dataSource: {
212
+ readonly dataSource?: {
213
213
  readonly data: string;
214
214
  readonly request?: string | undefined;
215
215
  readonly total?: string | undefined;
216
- };
216
+ } | undefined;
217
217
  readonly actions?: {
218
218
  readonly size: "default" | "sm" | "xs";
219
219
  readonly style?: string | undefined;
@@ -322,9 +322,9 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
322
322
  readonly locale: "en" | "ja" | "ko";
323
323
  readonly message: string;
324
324
  }[]] | undefined;
325
- readonly pageSizes: readonly number[];
326
- readonly pageIndex: number;
327
325
  readonly pageSize: number;
326
+ readonly pageSizes?: readonly number[] | undefined;
327
+ readonly pageIndex?: number | undefined;
328
328
  } | undefined;
329
329
  readonly initialState?: {
330
330
  readonly expanded?: boolean | {
@@ -34,11 +34,11 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
34
34
  readonly message: string;
35
35
  }[]] | undefined;
36
36
  }[];
37
- readonly dataSource: {
37
+ readonly dataSource?: {
38
38
  readonly data: string;
39
39
  readonly request?: string | undefined;
40
40
  readonly total?: string | undefined;
41
- };
41
+ } | undefined;
42
42
  readonly actions?: {
43
43
  readonly size: "default" | "sm" | "xs";
44
44
  readonly style?: string | undefined;
@@ -147,9 +147,9 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
147
147
  readonly locale: "en" | "ja" | "ko";
148
148
  readonly message: string;
149
149
  }[]] | undefined;
150
- readonly pageSizes: readonly number[];
151
- readonly pageIndex: number;
152
150
  readonly pageSize: number;
151
+ readonly pageSizes?: readonly number[] | undefined;
152
+ readonly pageIndex?: number | undefined;
153
153
  } | undefined;
154
154
  readonly initialState?: {
155
155
  readonly expanded?: boolean | {
@@ -209,11 +209,11 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
209
209
  readonly message: string;
210
210
  }[]] | undefined;
211
211
  }[];
212
- readonly dataSource: {
212
+ readonly dataSource?: {
213
213
  readonly data: string;
214
214
  readonly request?: string | undefined;
215
215
  readonly total?: string | undefined;
216
- };
216
+ } | undefined;
217
217
  readonly actions?: {
218
218
  readonly size: "default" | "sm" | "xs";
219
219
  readonly style?: string | undefined;
@@ -322,9 +322,9 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
322
322
  readonly locale: "en" | "ja" | "ko";
323
323
  readonly message: string;
324
324
  }[]] | undefined;
325
- readonly pageSizes: readonly number[];
326
- readonly pageIndex: number;
327
325
  readonly pageSize: number;
326
+ readonly pageSizes?: readonly number[] | undefined;
327
+ readonly pageIndex?: number | undefined;
328
328
  } | undefined;
329
329
  readonly initialState?: {
330
330
  readonly expanded?: boolean | {