@shwfed/config 2.7.8 → 2.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (153) hide show
  1. package/dist/mcp.mjs +97 -34
  2. package/dist/module.json +1 -1
  3. package/dist/preview/assets/{badge-KAEXz3VO.js → badge-Ddz0ExD-.js} +1 -1
  4. package/dist/preview/assets/{config-DbirfZyy.js → config---5_lEKG.js} +1 -1
  5. package/dist/preview/assets/{config-ZczGik30.js → config-5qIYVWZh.js} +1 -1
  6. package/dist/preview/assets/config-B8zbFg3y.js +1 -0
  7. package/dist/preview/assets/{config-DbfJWa8K.js → config-Bn619USg.js} +1 -1
  8. package/dist/preview/assets/{config-C-QRPeN1.js → config-CUeBTyLb.js} +1 -1
  9. package/dist/preview/assets/config-DN_3WauN.js +1 -0
  10. package/dist/preview/assets/config-U-3fWb-2.js +1 -0
  11. package/dist/preview/assets/config-q5VV9rp7.js +1 -0
  12. package/dist/preview/assets/config-vePqHFvZ.js +1 -0
  13. package/dist/preview/assets/{definition.vue_vue_type_script_setup_true_lang-CQ6MUPKO.js → definition.vue_vue_type_script_setup_true_lang-fQa65UMX.js} +1 -1
  14. package/dist/preview/assets/index-BKaqQGb-.js +688 -0
  15. package/dist/preview/assets/index-Bj8xIK5h.js +1 -0
  16. package/dist/preview/assets/index-BlHAyQdm.css +1 -0
  17. package/dist/preview/assets/{index-Bv_aA34a.js → index-CzWhSvDG.js} +1 -1
  18. package/dist/preview/assets/{item-SC0WQMVu.js → item-DHarupON.js} +1 -1
  19. package/dist/preview/assets/{runtime-DcStOiOi.js → runtime-560tuaHv.js} +1 -1
  20. package/dist/preview/assets/{runtime-Ckuz5Kxm.js → runtime-C2rQ3L3-.js} +1 -1
  21. package/dist/preview/assets/{runtime-BPOf7Yqz.js → runtime-CKghL8I_.js} +1 -1
  22. package/dist/preview/assets/runtime-CMsaNery.js +1 -0
  23. package/dist/preview/assets/runtime-CMuCGJZm.js +1 -0
  24. package/dist/preview/assets/{runtime-DO0anKbw.js → runtime-DOM_La4X.js} +1 -1
  25. package/dist/preview/assets/{runtime-EVgYW6_7.js → runtime-DQHb9t0r.js} +1 -1
  26. package/dist/preview/assets/{runtime-CnKlH0mi.js → runtime-Dgl3wVfD.js} +1 -1
  27. package/dist/preview/assets/{runtime-i32sR7d3.js → runtime-aLgWVLET.js} +1 -1
  28. package/dist/preview/index.html +2 -2
  29. package/dist/runtime/components/actions/buttons/2026-04-18/com.shwfed.actions.button.http.request.json/config.d.vue.ts +8 -0
  30. package/dist/runtime/components/actions/buttons/2026-04-18/com.shwfed.actions.button.http.request.json/config.vue +28 -0
  31. package/dist/runtime/components/actions/buttons/2026-04-18/com.shwfed.actions.button.http.request.json/config.vue.d.ts +8 -0
  32. package/dist/runtime/components/actions/buttons/2026-04-18/com.shwfed.actions.button.http.request.json/runtime.vue +17 -17
  33. package/dist/runtime/components/actions/buttons/2026-04-18/com.shwfed.actions.button.http.request.json/schema.d.ts +4 -0
  34. package/dist/runtime/components/actions/buttons/2026-04-18/com.shwfed.actions.button.http.request.json/schema.js +8 -0
  35. package/dist/runtime/components/actions/buttons/2026-04-18/com.shwfed.actions.button.http.request.json.confirm/config.d.vue.ts +8 -0
  36. package/dist/runtime/components/actions/buttons/2026-04-18/com.shwfed.actions.button.http.request.json.confirm/config.vue +25 -0
  37. package/dist/runtime/components/actions/buttons/2026-04-18/com.shwfed.actions.button.http.request.json.confirm/config.vue.d.ts +8 -0
  38. package/dist/runtime/components/actions/buttons/2026-04-18/com.shwfed.actions.button.http.request.json.confirm/runtime.vue +2 -7
  39. package/dist/runtime/components/actions/buttons/2026-04-18/com.shwfed.actions.button.http.request.json.confirm/schema.d.ts +4 -0
  40. package/dist/runtime/components/actions/buttons/2026-04-18/com.shwfed.actions.button.http.request.json.confirm/schema.js +8 -0
  41. package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.table/config.d.vue.ts +2 -0
  42. package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.table/config.vue.d.ts +2 -0
  43. package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.table/runtime.d.vue.ts +2 -0
  44. package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.table/runtime.vue.d.ts +2 -0
  45. package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.table/schema.d.ts +2 -0
  46. package/dist/runtime/components/config/blocks/2026-06-02/com.shwfed.block.card/config.vue +2 -0
  47. package/dist/runtime/components/config/blocks/2026-06-02/com.shwfed.block.card/schema.d.ts +5 -0
  48. package/dist/runtime/components/config/blocks/2026-06-02/com.shwfed.block.card/schema.js +8 -3
  49. package/dist/runtime/components/form/fields/2026-04-22/com.shwfed.form.field.markdown/runtime.vue +12 -1
  50. package/dist/runtime/components/form/fields/2026-04-22/com.shwfed.form.field.markdown/schema.d.ts +8 -2
  51. package/dist/runtime/components/form/fields/2026-04-22/com.shwfed.form.field.markdown/schema.js +3 -3
  52. package/dist/runtime/components/form/fields/2026-04-22/com.shwfed.form.field.textarea/config.d.vue.ts +2 -2
  53. package/dist/runtime/components/form/fields/2026-04-22/com.shwfed.form.field.textarea/config.vue +15 -25
  54. package/dist/runtime/components/form/fields/2026-04-22/com.shwfed.form.field.textarea/config.vue.d.ts +2 -2
  55. package/dist/runtime/components/form/fields/2026-04-22/com.shwfed.form.field.textarea/runtime.vue +11 -2
  56. package/dist/runtime/components/form/fields/2026-04-22/com.shwfed.form.field.textarea/schema.d.ts +1 -1
  57. package/dist/runtime/components/form/fields/2026-04-22/com.shwfed.form.field.textarea/schema.js +4 -4
  58. package/dist/runtime/components/form/fields/2026-05-18/com.shwfed.form.field.table/config.d.vue.ts +2 -0
  59. package/dist/runtime/components/form/fields/2026-05-18/com.shwfed.form.field.table/config.vue.d.ts +2 -0
  60. package/dist/runtime/components/form/fields/2026-05-18/com.shwfed.form.field.table/schema.d.ts +2 -0
  61. package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.combobox.multi/runtime.vue +13 -2
  62. package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.combobox.multi/schema.d.ts +1 -0
  63. package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.combobox.multi/schema.js +4 -1
  64. package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.combobox.single/runtime.vue +10 -2
  65. package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.combobox.single/schema.d.ts +1 -0
  66. package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.combobox.single/schema.js +4 -1
  67. package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.combobox.multi/runtime.vue +16 -0
  68. package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.combobox.multi/schema.d.ts +1 -0
  69. package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.combobox.multi/schema.js +4 -1
  70. package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.combobox.single/runtime.vue +13 -5
  71. package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.combobox.single/schema.d.ts +1 -0
  72. package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.combobox.single/schema.js +4 -1
  73. package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.multi/runtime.vue +25 -5
  74. package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.multi/schema.d.ts +1 -0
  75. package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.multi/schema.js +4 -1
  76. package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.single/runtime.vue +18 -8
  77. package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.single/schema.d.ts +1 -0
  78. package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.single/schema.js +4 -1
  79. package/dist/runtime/components/form/index.vue +15 -3
  80. package/dist/runtime/components/form/schema.d.ts +4 -0
  81. package/dist/runtime/components/form/schema.js +1 -0
  82. package/dist/runtime/components/form/unit-config.vue +6 -1
  83. package/dist/runtime/components/form/utils/form-vars.js +4 -0
  84. package/dist/runtime/components/form/utils/resolve.d.ts +10 -0
  85. package/dist/runtime/components/table/columns/2026-05-24/com.shwfed.table.column.combobox-single.remote.options-remote/config.d.vue.ts +2 -2
  86. package/dist/runtime/components/table/columns/2026-05-24/com.shwfed.table.column.combobox-single.remote.options-remote/config.vue.d.ts +2 -2
  87. package/dist/runtime/components/table/columns/2026-05-24/com.shwfed.table.column.combobox-single.remote.options-static/config.d.vue.ts +2 -2
  88. package/dist/runtime/components/table/columns/2026-05-24/com.shwfed.table.column.combobox-single.remote.options-static/config.vue.d.ts +2 -2
  89. package/dist/runtime/components/table/columns/2026-05-25/com.shwfed.table.column.combobox-multi.remote.options-remote/config.d.vue.ts +2 -2
  90. package/dist/runtime/components/table/columns/2026-05-25/com.shwfed.table.column.combobox-multi.remote.options-remote/config.vue.d.ts +2 -2
  91. package/dist/runtime/components/table/columns/2026-05-25/com.shwfed.table.column.combobox-multi.remote.options-static/config.d.vue.ts +2 -2
  92. package/dist/runtime/components/table/columns/2026-05-25/com.shwfed.table.column.combobox-multi.remote.options-static/config.vue.d.ts +2 -2
  93. package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-multi.remote/config.d.vue.ts +2 -2
  94. package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-multi.remote/config.vue.d.ts +2 -2
  95. package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-single.remote/config.d.vue.ts +2 -2
  96. package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-single.remote/config.vue.d.ts +2 -2
  97. package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-multi/config.d.vue.ts +2 -2
  98. package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-multi/config.vue.d.ts +2 -2
  99. package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-multi/runtime.vue +13 -2
  100. package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-multi/schema.d.ts +1 -0
  101. package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-multi/schema.js +4 -1
  102. package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-single/config.d.vue.ts +2 -2
  103. package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-single/config.vue.d.ts +2 -2
  104. package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-single/runtime.vue +10 -2
  105. package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-single/schema.d.ts +1 -0
  106. package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-single/schema.js +4 -1
  107. package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.tree-combobox-multi/runtime.vue +16 -0
  108. package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.tree-combobox-multi/schema.d.ts +1 -0
  109. package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.tree-combobox-multi/schema.js +3 -1
  110. package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.tree-combobox-single/runtime.vue +13 -5
  111. package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.tree-combobox-single/schema.d.ts +1 -0
  112. package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.tree-combobox-single/schema.js +3 -1
  113. package/dist/runtime/components/table/config.vue +35 -1
  114. package/dist/runtime/components/table/index.d.vue.ts +2 -0
  115. package/dist/runtime/components/table/index.vue +8 -0
  116. package/dist/runtime/components/table/index.vue.d.ts +2 -0
  117. package/dist/runtime/components/table/row-provider.vue +8 -0
  118. package/dist/runtime/components/table/schema.d.ts +4 -0
  119. package/dist/runtime/components/table/schema.js +4 -0
  120. package/dist/runtime/components/table/utils/resolve.d.ts +7 -0
  121. package/dist/runtime/components/table/utils/shared.js +4 -0
  122. package/dist/runtime/components/ui/expression-editor/CodeMirrorInput.d.vue.ts +1 -0
  123. package/dist/runtime/components/ui/expression-editor/CodeMirrorInput.vue +9 -1
  124. package/dist/runtime/components/ui/expression-editor/CodeMirrorInput.vue.d.ts +1 -0
  125. package/dist/runtime/components/ui/expression-editor/ExpressionEditor.d.vue.ts +2 -2
  126. package/dist/runtime/components/ui/expression-editor/ExpressionEditor.vue +33 -4
  127. package/dist/runtime/components/ui/expression-editor/ExpressionEditor.vue.d.ts +2 -2
  128. package/dist/runtime/components/ui/expression-editor/picker-entries.d.ts +3 -2
  129. package/dist/runtime/components/ui/expression-editor/picker-entries.js +14 -3
  130. package/dist/runtime/components/ui/expression-editor/selection-chip-extension.d.ts +4 -0
  131. package/dist/runtime/components/ui/expression-editor/selection-chip-extension.js +119 -0
  132. package/dist/runtime/components/ui/expression-editor/selection-refs.d.ts +8 -0
  133. package/dist/runtime/components/ui/expression-editor/selection-refs.js +29 -0
  134. package/dist/runtime/share/event-bus.d.ts +12 -12
  135. package/dist/runtime/share/use-persisted-query.d.ts +21 -0
  136. package/dist/runtime/share/use-persisted-query.js +33 -0
  137. package/dist/runtime/utils/cel-context.d.ts +22 -0
  138. package/dist/runtime/utils/cel-context.js +8 -0
  139. package/dist/runtime/utils/selections-registry.d.ts +77 -0
  140. package/dist/runtime/utils/selections-registry.js +49 -0
  141. package/package.json +1 -1
  142. package/dist/preview/assets/config-BXx5syNf.js +0 -1
  143. package/dist/preview/assets/config-Bb9Yeh33.js +0 -1
  144. package/dist/preview/assets/config-CkKx7sVR.js +0 -1
  145. package/dist/preview/assets/config-CtbYlZCL.js +0 -1
  146. package/dist/preview/assets/config-DPlbFBRi.js +0 -1
  147. package/dist/preview/assets/index-C9P-6gZd.css +0 -1
  148. package/dist/preview/assets/index-CJFU9znN.js +0 -1
  149. package/dist/preview/assets/index-DUOkekYu.js +0 -680
  150. package/dist/preview/assets/runtime-CC2caFS9.js +0 -1
  151. package/dist/preview/assets/runtime-CLaRFZzt.js +0 -1
  152. package/dist/runtime/share/form-validate.d.ts +0 -18
  153. package/dist/runtime/share/form-validate.js +0 -8
@@ -30,6 +30,12 @@ function updateTriggers(key, next) {
30
30
  else draft[key] = next;
31
31
  value.value = draft;
32
32
  }
33
+ function updateBefore(next) {
34
+ const draft = { ...value.value };
35
+ if (next.length === 0) Reflect.deleteProperty(draft, "before");
36
+ else draft.before = next;
37
+ value.value = draft;
38
+ }
33
39
  </script>
34
40
 
35
41
  <template>
@@ -58,6 +64,28 @@ function updateTriggers(key, next) {
58
64
  />
59
65
  </Field>
60
66
 
67
+ <!-- Pre-request triggers: run before the request fires. A halting op
68
+ (e.g. the enclosing form's 校验) aborts the request. -->
69
+ <Field orientation="vertical">
70
+ <FieldLabel class="text-xs text-zinc-500">
71
+ <template
72
+ v-if="fieldDescription('before')"
73
+ #tooltip
74
+ >
75
+ <Markdown
76
+ :source="fieldDescription('before')"
77
+ block
78
+ class="prose prose-sm prose-zinc"
79
+ />
80
+ </template>
81
+ {{ fieldTitle("before") }}
82
+ </FieldLabel>
83
+ <TriggersField
84
+ :triggers="value.before ?? []"
85
+ @update:triggers="(v) => updateBefore(v)"
86
+ />
87
+ </Field>
88
+
61
89
  <div class="flex items-start gap-2">
62
90
  <Field
63
91
  orientation="vertical"
@@ -12,6 +12,10 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
12
12
  readonly compatibilityDate: "2026-04-18";
13
13
  readonly messageExpression?: string | undefined;
14
14
  readonly resultExpression?: string | undefined;
15
+ readonly before?: readonly {
16
+ readonly target: string;
17
+ readonly operation: string;
18
+ }[] | undefined;
15
19
  readonly expression: string;
16
20
  readonly onSuccess?: readonly {
17
21
  readonly target: string;
@@ -36,6 +40,10 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
36
40
  readonly compatibilityDate: "2026-04-18";
37
41
  readonly messageExpression?: string | undefined;
38
42
  readonly resultExpression?: string | undefined;
43
+ readonly before?: readonly {
44
+ readonly target: string;
45
+ readonly operation: string;
46
+ }[] | undefined;
39
47
  readonly expression: string;
40
48
  readonly onSuccess?: readonly {
41
49
  readonly target: string;
@@ -2,8 +2,7 @@
2
2
  import { Effect } from "effect";
3
3
  import { cel as _rawCel } from "../../../../../utils/cel";
4
4
  import { celBindings, injectCELContext } from "../../../../../utils/cel-context";
5
- import { useEventChannel } from "../../../../../share/event-bus";
6
- import { useFormValidate } from "../../../../../share/form-validate";
5
+ import { dispatchTriggers, useEventChannel } from "../../../../../share/event-bus";
7
6
  import ShwfedActionDefinition from "../../../components/definition.vue";
8
7
  import { executeHttpRequest } from "../../../utils/resolve";
9
8
  defineOptions({ name: "ShwfedHttpRequestActionRuntime" });
@@ -14,21 +13,22 @@ const props = defineProps({
14
13
  const inherited = injectCELContext();
15
14
  const $cel = (expression, context) => _rawCel(expression, { ...celBindings(inherited), ...context });
16
15
  const channel = useEventChannel();
17
- const validateForm = useFormValidate();
18
- const effect = Effect.suspend(() => {
19
- const gate = validateForm ? Effect.promise(() => validateForm()) : Effect.succeed(true);
20
- return Effect.flatMap(gate, (ok) => ok ? executeHttpRequest(props.config.expression, $cel, {
21
- messageExpression: props.config.messageExpression,
22
- resultExpression: props.config.resultExpression,
23
- channel,
24
- triggers: {
25
- success: props.config.onSuccess,
26
- warning: props.config.onWarning,
27
- error: props.config.onError,
28
- info: props.config.onInfo
29
- }
30
- }) : Effect.succeed(void 0));
31
- });
16
+ const effect = Effect.suspend(
17
+ () => Effect.andThen(
18
+ dispatchTriggers(channel, props.config.before),
19
+ () => executeHttpRequest(props.config.expression, $cel, {
20
+ messageExpression: props.config.messageExpression,
21
+ resultExpression: props.config.resultExpression,
22
+ channel,
23
+ triggers: {
24
+ success: props.config.onSuccess,
25
+ warning: props.config.onWarning,
26
+ error: props.config.onError,
27
+ info: props.config.onInfo
28
+ }
29
+ })
30
+ )
31
+ );
32
32
  </script>
33
33
 
34
34
  <template>
@@ -10,6 +10,10 @@ export declare function schema(configure: (env: Environment) => void): Schema.St
10
10
  type: Schema.Literal<["com.shwfed.actions.button.http.request.json"]>;
11
11
  compatibilityDate: Schema.Literal<["2026-04-18"]>;
12
12
  expression: Schema.Schema<string, string, never>;
13
+ before: Schema.optional<Schema.Array$<Schema.Struct<{
14
+ target: Schema.refine<string, typeof Schema.String>;
15
+ operation: Schema.SchemaClass<string, string, never>;
16
+ }>>>;
13
17
  messageExpression: Schema.optional<Schema.Schema<string, string, never>>;
14
18
  resultExpression: Schema.optional<Schema.Schema<string, string, never>>;
15
19
  onSuccess: Schema.optional<Schema.Array$<Schema.Struct<{
@@ -28,6 +28,14 @@ export function schema(configure) {
28
28
  点击后将立即被求值,当 HTTP 请求被成功构造后,调度器将尽可能快地安排执行这个请求
29
29
  `
30
30
  }),
31
+ before: Schema.optional(Triggers.annotations({
32
+ title: "\u8BF7\u6C42\u524D",
33
+ description: md`
34
+ 请求发起前按列表顺序执行的操作。任一操作中止(例如表单校验未通过)将取消本次请求。
35
+
36
+ 放在表单里的提交按钮应在此处首先触发所在表单的「校验」操作,使校验成为显式的提交前步骤。
37
+ `
38
+ })),
31
39
  messageExpression: Schema.optional(CelMessage.annotations({
32
40
  title: "\u6D88\u606F",
33
41
  description: md`
@@ -21,6 +21,10 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
21
21
  readonly locale: "en" | "ja" | "ko";
22
22
  readonly message: string;
23
23
  }[]];
24
+ readonly before?: readonly {
25
+ readonly target: string;
26
+ readonly operation: string;
27
+ }[] | undefined;
24
28
  readonly expression: string;
25
29
  readonly onSuccess?: readonly {
26
30
  readonly target: string;
@@ -54,6 +58,10 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
54
58
  readonly locale: "en" | "ja" | "ko";
55
59
  readonly message: string;
56
60
  }[]];
61
+ readonly before?: readonly {
62
+ readonly target: string;
63
+ readonly operation: string;
64
+ }[] | undefined;
57
65
  readonly expression: string;
58
66
  readonly onSuccess?: readonly {
59
67
  readonly target: string;
@@ -25,6 +25,9 @@ const RESULT_FIELDS = ["onSuccess", "onWarning", "onError", "onInfo"];
25
25
  function updateTriggers(key, next) {
26
26
  patch({ [key]: next.length === 0 ? void 0 : next });
27
27
  }
28
+ function updateBefore(next) {
29
+ patch({ before: next.length === 0 ? void 0 : next });
30
+ }
28
31
  </script>
29
32
 
30
33
  <template>
@@ -76,6 +79,28 @@ function updateTriggers(key, next) {
76
79
  </Field>
77
80
  </div>
78
81
 
82
+ <!-- Pre-confirm triggers: run before the confirm dialog. A halting op
83
+ (e.g. the enclosing form's 校验) skips both dialog and request. -->
84
+ <Field orientation="vertical">
85
+ <FieldLabel class="text-xs text-zinc-500">
86
+ <template
87
+ v-if="fieldDescription('before')"
88
+ #tooltip
89
+ >
90
+ <Markdown
91
+ :source="fieldDescription('before')"
92
+ block
93
+ class="prose prose-sm prose-zinc"
94
+ />
95
+ </template>
96
+ {{ fieldTitle("before") }}
97
+ </FieldLabel>
98
+ <TriggersField
99
+ :triggers="value.before ?? []"
100
+ @update:triggers="(v) => updateBefore(v)"
101
+ />
102
+ </Field>
103
+
79
104
  <div class="grid grid-cols-2 gap-4">
80
105
  <Field orientation="vertical">
81
106
  <FieldLabel class="text-xs text-zinc-500">
@@ -21,6 +21,10 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
21
21
  readonly locale: "en" | "ja" | "ko";
22
22
  readonly message: string;
23
23
  }[]];
24
+ readonly before?: readonly {
25
+ readonly target: string;
26
+ readonly operation: string;
27
+ }[] | undefined;
24
28
  readonly expression: string;
25
29
  readonly onSuccess?: readonly {
26
30
  readonly target: string;
@@ -54,6 +58,10 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
54
58
  readonly locale: "en" | "ja" | "ko";
55
59
  readonly message: string;
56
60
  }[]];
61
+ readonly before?: readonly {
62
+ readonly target: string;
63
+ readonly operation: string;
64
+ }[] | undefined;
57
65
  readonly expression: string;
58
66
  readonly onSuccess?: readonly {
59
67
  readonly target: string;
@@ -5,8 +5,7 @@ import { cel as _rawCel } from "../../../../../utils/cel";
5
5
  import { reject } from "../../../../../composables/useOverlay";
6
6
  import { celBindings, injectCELContext } from "../../../../../utils/cel-context";
7
7
  import { getLocalizedText } from "../../../../../share/locale";
8
- import { useEventChannel } from "../../../../../share/event-bus";
9
- import { useFormValidate } from "../../../../../share/form-validate";
8
+ import { dispatchTriggers, useEventChannel } from "../../../../../share/event-bus";
10
9
  import ShwfedActionDefinition from "../../../components/definition.vue";
11
10
  import { executeHttpRequest, interpolateMarkdown } from "../../../utils/resolve";
12
11
  defineOptions({ name: "ShwfedHttpRequestConfirmActionRuntime" });
@@ -18,12 +17,8 @@ const { locale } = useI18n();
18
17
  const inherited = injectCELContext();
19
18
  const $cel = (expression, context) => _rawCel(expression, { ...celBindings(inherited), ...context });
20
19
  const channel = useEventChannel();
21
- const validateForm = useFormValidate();
22
20
  const effect = Effect.gen(function* () {
23
- if (validateForm) {
24
- const ok = yield* Effect.promise(() => validateForm());
25
- if (!ok) return;
26
- }
21
+ yield* dispatchTriggers(channel, props.config.before);
27
22
  const raw = getLocalizedText(props.config.markdown, locale.value) ?? "";
28
23
  const content = interpolateMarkdown(raw, $cel);
29
24
  if (yield* reject({ content, icon: props.config.icon, color: props.config.color })) return;
@@ -10,6 +10,10 @@ export declare function schema(configure: (env: Environment) => void): Schema.St
10
10
  type: Schema.Literal<["com.shwfed.actions.button.http.request.json.confirm"]>;
11
11
  compatibilityDate: Schema.Literal<["2026-04-18"]>;
12
12
  expression: Schema.Schema<string, string, never>;
13
+ before: Schema.optional<Schema.Array$<Schema.Struct<{
14
+ target: Schema.refine<string, typeof Schema.String>;
15
+ operation: Schema.SchemaClass<string, string, never>;
16
+ }>>>;
13
17
  markdown: Schema.TupleType<readonly [Schema.Struct<{
14
18
  locale: Schema.Literal<["zh"]>;
15
19
  message: Schema.SchemaClass<string, string, never>;
@@ -29,6 +29,14 @@ export function schema(configure) {
29
29
  用户确认后将立即被求值,当 HTTP 请求被成功构造后,调度器将尽可能快地安排执行这个请求
30
30
  `
31
31
  }),
32
+ before: Schema.optional(Triggers.annotations({
33
+ title: "\u786E\u8BA4\u524D",
34
+ description: md`
35
+ 确认弹窗弹出前按列表顺序执行的操作。任一操作中止(例如表单校验未通过)将取消确认弹窗与请求。
36
+
37
+ 放在表单里的提交按钮应在此处首先触发所在表单的「校验」操作,使校验成为显式的提交前步骤。
38
+ `
39
+ })),
32
40
  markdown: Locale.annotations({
33
41
  title: "\u786E\u8BA4\u4FE1\u606F",
34
42
  description: "\u5F39\u7A97\u786E\u8BA4\u4FE1\u606F\uFF0C\u652F\u6301 `{{ expression }}` \u63D2\u503C"
@@ -156,6 +156,7 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
156
156
  readonly pageSizes?: readonly number[] | undefined;
157
157
  readonly pageIndex?: number | undefined;
158
158
  } | undefined;
159
+ readonly persistQuery?: boolean | undefined;
159
160
  readonly initialState?: {
160
161
  readonly expanded?: boolean | {
161
162
  readonly [x: string]: boolean;
@@ -336,6 +337,7 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
336
337
  readonly pageSizes?: readonly number[] | undefined;
337
338
  readonly pageIndex?: number | undefined;
338
339
  } | undefined;
340
+ readonly persistQuery?: boolean | undefined;
339
341
  readonly initialState?: {
340
342
  readonly expanded?: boolean | {
341
343
  readonly [x: string]: boolean;
@@ -156,6 +156,7 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
156
156
  readonly pageSizes?: readonly number[] | undefined;
157
157
  readonly pageIndex?: number | undefined;
158
158
  } | undefined;
159
+ readonly persistQuery?: boolean | undefined;
159
160
  readonly initialState?: {
160
161
  readonly expanded?: boolean | {
161
162
  readonly [x: string]: boolean;
@@ -336,6 +337,7 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
336
337
  readonly pageSizes?: readonly number[] | undefined;
337
338
  readonly pageIndex?: number | undefined;
338
339
  } | undefined;
340
+ readonly persistQuery?: boolean | undefined;
339
341
  readonly initialState?: {
340
342
  readonly expanded?: boolean | {
341
343
  readonly [x: string]: boolean;
@@ -151,6 +151,7 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
151
151
  readonly pageSizes?: readonly number[] | undefined;
152
152
  readonly pageIndex?: number | undefined;
153
153
  } | undefined;
154
+ readonly persistQuery?: boolean | undefined;
154
155
  readonly initialState?: {
155
156
  readonly expanded?: boolean | {
156
157
  readonly [x: string]: boolean;
@@ -331,6 +332,7 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
331
332
  readonly pageSizes?: readonly number[] | undefined;
332
333
  readonly pageIndex?: number | undefined;
333
334
  } | undefined;
335
+ readonly persistQuery?: boolean | undefined;
334
336
  readonly initialState?: {
335
337
  readonly expanded?: boolean | {
336
338
  readonly [x: string]: boolean;
@@ -151,6 +151,7 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
151
151
  readonly pageSizes?: readonly number[] | undefined;
152
152
  readonly pageIndex?: number | undefined;
153
153
  } | undefined;
154
+ readonly persistQuery?: boolean | undefined;
154
155
  readonly initialState?: {
155
156
  readonly expanded?: boolean | {
156
157
  readonly [x: string]: boolean;
@@ -331,6 +332,7 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
331
332
  readonly pageSizes?: readonly number[] | undefined;
332
333
  readonly pageIndex?: number | undefined;
333
334
  } | undefined;
335
+ readonly persistQuery?: boolean | undefined;
334
336
  readonly initialState?: {
335
337
  readonly expanded?: boolean | {
336
338
  readonly [x: string]: boolean;
@@ -166,6 +166,7 @@ export declare function schema(configure: (env: Environment) => void, _blockRef:
166
166
  readonly pageSizes?: readonly number[] | undefined;
167
167
  readonly pageIndex?: number | undefined;
168
168
  } | undefined;
169
+ readonly persistQuery?: boolean | undefined;
169
170
  readonly initialState?: {
170
171
  readonly expanded?: boolean | {
171
172
  readonly [x: string]: boolean;
@@ -447,6 +448,7 @@ export declare function schema(configure: (env: Environment) => void, _blockRef:
447
448
  message: Schema.SchemaClass<string, string, never>;
448
449
  }>]>>;
449
450
  }>>;
451
+ persistQuery: Schema.optional<Schema.SchemaClass<boolean, boolean, never>>;
450
452
  initialState: Schema.optional<Schema.Struct<{
451
453
  columnVisibility: Schema.optional<Schema.Record$<typeof Schema.String, typeof Schema.Boolean>>;
452
454
  columnOrder: Schema.optional<Schema.Array$<typeof Schema.String>>;
@@ -29,6 +29,7 @@ import {
29
29
  badgeSchema,
30
30
  getStructFieldDescription,
31
31
  getStructFieldTitle,
32
+ JSON_VAR,
32
33
  schema
33
34
  } from "./schema";
34
35
  defineOptions({ name: "ShwfedBlockCardConfig" });
@@ -419,6 +420,7 @@ if (breadcrumbExt) {
419
420
  :model-value="badge.show ?? ''"
420
421
  placeholder="例:json.?data.?total.orValue(0) != 0"
421
422
  result-type="bool"
423
+ :extra-vars="{ json: JSON_VAR }"
422
424
  multiline
423
425
  class="min-h-12"
424
426
  @update:model-value="(v) => setBadgeShow(v)"
@@ -19,6 +19,11 @@ export declare const metadata: {
19
19
  readonly max: number;
20
20
  };
21
21
  };
22
+ export declare const JSON_VAR: {
23
+ readonly type: "optional<dyn>";
24
+ readonly label: "HTTP 响应体";
25
+ readonly description: "HTTP 响应体(配置了请求时为已解析 JSON,否则为 none)";
26
+ };
22
27
  export declare const BADGE_VARIANTS: readonly ["default", "secondary", "destructive", "outline"];
23
28
  /**
24
29
  * The card's top-right badge: an optional HTTP datasource whose response feeds
@@ -10,10 +10,15 @@ export const metadata = {
10
10
  w: { initial: 12, min: 4, max: Infinity },
11
11
  h: { initial: 6, min: 4, max: Infinity }
12
12
  };
13
+ export const JSON_VAR = {
14
+ type: "optional<dyn>",
15
+ label: "HTTP \u54CD\u5E94\u4F53",
16
+ description: "HTTP \u54CD\u5E94\u4F53\uFF08\u914D\u7F6E\u4E86\u8BF7\u6C42\u65F6\u4E3A\u5DF2\u89E3\u6790 JSON\uFF0C\u5426\u5219\u4E3A none\uFF09"
17
+ };
13
18
  function registerJson(env) {
14
- env.registerVariable("json", "optional<dyn>", {
15
- label: "HTTP \u54CD\u5E94\u4F53",
16
- description: "HTTP \u54CD\u5E94\u4F53\uFF08\u914D\u7F6E\u4E86\u8BF7\u6C42\u65F6\u4E3A\u5DF2\u89E3\u6790 JSON\uFF0C\u5426\u5219\u4E3A none\uFF09"
19
+ env.registerVariable("json", JSON_VAR.type, {
20
+ label: JSON_VAR.label,
21
+ description: JSON_VAR.description
17
22
  });
18
23
  }
19
24
  export const BADGE_VARIANTS = ["default", "secondary", "destructive", "outline"];
@@ -1,15 +1,26 @@
1
1
  <script setup>
2
2
  import { computed } from "vue";
3
3
  import { useI18n } from "vue-i18n";
4
+ import { cel as _rawCel } from "../../../../../utils/cel";
5
+ import { celBindings, injectCELContext } from "../../../../../utils/cel-context";
4
6
  import { getLocalizedText } from "../../../../../share/locale";
5
7
  import { Markdown } from "../../../../ui/markdown";
8
+ import { interpolateMarkdown } from "../../../../table/utils/runtime";
9
+ import { useFormState } from "../../../utils/state";
6
10
  defineOptions({ name: "ShwfedMarkdownFieldRuntime" });
7
11
  const props = defineProps({
8
12
  fieldId: { type: String, required: true },
9
13
  config: { type: null, required: true }
10
14
  });
11
15
  const { locale } = useI18n();
12
- const source = computed(() => getLocalizedText(props.config.content, locale.value) ?? "");
16
+ const { state } = useFormState();
17
+ const inherited = injectCELContext();
18
+ const $cel = (expression, context) => _rawCel(expression, { ...celBindings(inherited), ...context });
19
+ const source = computed(() => {
20
+ const template = getLocalizedText(props.config.content, locale.value) ?? "";
21
+ if (!template) return "";
22
+ return interpolateMarkdown(template, $cel, { form: state.value ?? {} });
23
+ });
13
24
  </script>
14
25
 
15
26
  <template>
@@ -17,13 +17,19 @@ export declare const metadata: {
17
17
  };
18
18
  };
19
19
  export declare function schema(configure: (env: Environment) => void): Schema.Struct<{
20
- content: Schema.TupleType<readonly [Schema.Struct<{
20
+ content: Schema.refine<readonly [{
21
+ readonly locale: "zh";
22
+ readonly message: string;
23
+ }, ...{
24
+ readonly locale: "en" | "ja" | "ko";
25
+ readonly message: string;
26
+ }[]], Schema.TupleType<readonly [Schema.Struct<{
21
27
  locale: Schema.Literal<["zh"]>;
22
28
  message: Schema.SchemaClass<string, string, never>;
23
29
  }>], [Schema.Struct<{
24
30
  locale: Schema.Literal<["ja", "en", "ko"]>;
25
31
  message: Schema.SchemaClass<string, string, never>;
26
- }>]>;
32
+ }>]>>;
27
33
  id: Schema.refine<string, typeof Schema.String>;
28
34
  displayName: Schema.optional<Schema.SchemaClass<string, string, never>>;
29
35
  hidden: Schema.optional<Schema.Schema<string, string, never>>;
@@ -1,5 +1,5 @@
1
1
  import { Schema } from "effect";
2
- import { Locale } from "../../../../../share/locale.js";
2
+ import { LocaleMarkdown } from "../../../../../share/expression.js";
3
3
  import { commonFieldFields } from "../../../utils/common.js";
4
4
  export const type = "com.shwfed.form.field.markdown";
5
5
  export const compatibilityDate = "2026-04-22";
@@ -14,9 +14,9 @@ export function schema(configure) {
14
14
  type: Schema.Literal(type),
15
15
  compatibilityDate: Schema.Literal(compatibilityDate),
16
16
  ...commonFieldFields(configure),
17
- content: Locale.annotations({
17
+ content: LocaleMarkdown({ configure }).annotations({
18
18
  title: "\u5185\u5BB9",
19
- description: "\u6E32\u67D3\u4E3A Markdown \u7684\u591A\u8BED\u8A00\u6587\u672C"
19
+ description: "\u6E32\u67D3\u4E3A Markdown \u7684\u591A\u8BED\u8A00\u6587\u672C\uFF0C\u652F\u6301 `{{ \u8868\u8FBE\u5F0F }}` \u63D2\u503C"
20
20
  })
21
21
  }).annotations({
22
22
  title: "MarkdownField",
@@ -24,7 +24,6 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
24
24
  }[]] | undefined;
25
25
  readonly required?: string | undefined;
26
26
  readonly displayName?: string | undefined;
27
- readonly rows?: number | undefined;
28
27
  readonly compatibilityDate: "2026-04-22";
29
28
  readonly orientation?: "vertical" | "floating" | undefined;
30
29
  readonly placeholder?: readonly [{
@@ -51,6 +50,7 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
51
50
  readonly warning?: boolean | undefined;
52
51
  readonly when: string;
53
52
  }[] | undefined;
53
+ readonly maxLength?: number | undefined;
54
54
  }) => any;
55
55
  }, string, import("vue").PublicProps, Readonly<__VLS_ModelProps> & Readonly<{
56
56
  "onUpdate:modelValue"?: ((value: {
@@ -74,7 +74,6 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
74
74
  }[]] | undefined;
75
75
  readonly required?: string | undefined;
76
76
  readonly displayName?: string | undefined;
77
- readonly rows?: number | undefined;
78
77
  readonly compatibilityDate: "2026-04-22";
79
78
  readonly orientation?: "vertical" | "floating" | undefined;
80
79
  readonly placeholder?: readonly [{
@@ -101,6 +100,7 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
101
100
  readonly warning?: boolean | undefined;
102
101
  readonly when: string;
103
102
  }[] | undefined;
103
+ readonly maxLength?: number | undefined;
104
104
  }) => any) | undefined;
105
105
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
106
106
  declare const _default: typeof __VLS_export;
@@ -4,7 +4,7 @@ import { Field, FieldLabel } from "../../../../ui/field";
4
4
  import { ExpressionEditor } from "../../../../ui/expression-editor";
5
5
  import DerivedValueEditor from "../../../DerivedValueEditor.vue";
6
6
  import ValidationRulesField from "../../../ValidationRulesField.vue";
7
- import { InputGroup, InputGroupInput } from "../../../../ui/input-group";
7
+ import { InputGroup, InputGroupInput, InputGroupNumberField } from "../../../../ui/input-group";
8
8
  import { Locale as LocaleField } from "../../../../ui/locale";
9
9
  import { Markdown } from "../../../../ui/markdown";
10
10
  import {
@@ -35,22 +35,14 @@ const pathText = computed({
35
35
  }
36
36
  }
37
37
  });
38
- const rowsText = computed({
39
- get: () => value.value.rows != null ? String(value.value.rows) : "",
40
- set: (next) => {
41
- const trimmed = String(next ?? "").trim();
42
- if (trimmed.length === 0) {
43
- value.value = { ...value.value, rows: void 0 };
44
- return;
45
- }
46
- const n = Number(trimmed);
47
- if (!Number.isFinite(n) || !Number.isInteger(n) || n <= 0) {
48
- value.value = { ...value.value, rows: void 0 };
49
- return;
50
- }
51
- value.value = { ...value.value, rows: n };
38
+ function setMaxLength(v) {
39
+ if (v === void 0 || !(v > 0)) {
40
+ const { maxLength: _omit, ...rest } = value.value;
41
+ value.value = rest;
42
+ } else {
43
+ value.value = { ...value.value, maxLength: Math.round(v) };
52
44
  }
53
- });
45
+ }
54
46
  </script>
55
47
 
56
48
  <template>
@@ -203,24 +195,22 @@ const rowsText = computed({
203
195
  <Field orientation="vertical">
204
196
  <FieldLabel class="text-xs text-zinc-500">
205
197
  <template
206
- v-if="fieldDescription('rows')"
198
+ v-if="fieldDescription('maxLength')"
207
199
  #tooltip
208
200
  >
209
201
  <Markdown
210
- :source="fieldDescription('rows')"
202
+ :source="fieldDescription('maxLength')"
211
203
  block
212
204
  class="prose prose-sm prose-zinc"
213
205
  />
214
206
  </template>
215
- {{ fieldTitle("rows") }}
207
+ {{ fieldTitle("maxLength") }}
216
208
  </FieldLabel>
217
209
  <InputGroup>
218
- <InputGroupInput
219
- v-model="rowsText"
220
- type="number"
221
- min="1"
222
- step="1"
223
- placeholder="例:4"
210
+ <InputGroupNumberField
211
+ :model-value="value.maxLength"
212
+ :min="1"
213
+ @update:model-value="setMaxLength"
224
214
  />
225
215
  </InputGroup>
226
216
  </Field>
@@ -24,7 +24,6 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
24
24
  }[]] | undefined;
25
25
  readonly required?: string | undefined;
26
26
  readonly displayName?: string | undefined;
27
- readonly rows?: number | undefined;
28
27
  readonly compatibilityDate: "2026-04-22";
29
28
  readonly orientation?: "vertical" | "floating" | undefined;
30
29
  readonly placeholder?: readonly [{
@@ -51,6 +50,7 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
51
50
  readonly warning?: boolean | undefined;
52
51
  readonly when: string;
53
52
  }[] | undefined;
53
+ readonly maxLength?: number | undefined;
54
54
  }) => any;
55
55
  }, string, import("vue").PublicProps, Readonly<__VLS_ModelProps> & Readonly<{
56
56
  "onUpdate:modelValue"?: ((value: {
@@ -74,7 +74,6 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
74
74
  }[]] | undefined;
75
75
  readonly required?: string | undefined;
76
76
  readonly displayName?: string | undefined;
77
- readonly rows?: number | undefined;
78
77
  readonly compatibilityDate: "2026-04-22";
79
78
  readonly orientation?: "vertical" | "floating" | undefined;
80
79
  readonly placeholder?: readonly [{
@@ -101,6 +100,7 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
101
100
  readonly warning?: boolean | undefined;
102
101
  readonly when: string;
103
102
  }[] | undefined;
103
+ readonly maxLength?: number | undefined;
104
104
  }) => any) | undefined;
105
105
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
106
106
  declare const _default: typeof __VLS_export;