@shwfed/config 2.8.0 → 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 (110) hide show
  1. package/dist/mcp.mjs +61 -10
  2. package/dist/module.json +1 -1
  3. package/dist/preview/assets/{badge-BI1mdo92.js → badge-Ddz0ExD-.js} +1 -1
  4. package/dist/preview/assets/{config-XgVqueyq.js → config---5_lEKG.js} +1 -1
  5. package/dist/preview/assets/{config-OrJljNWU.js → config-5qIYVWZh.js} +1 -1
  6. package/dist/preview/assets/config-B8zbFg3y.js +1 -0
  7. package/dist/preview/assets/{config-DqUnpWZk.js → config-Bn619USg.js} +1 -1
  8. package/dist/preview/assets/{config-DuzQXHvg.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-lEhYVEcN.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-BvLLQuQr.js → index-CzWhSvDG.js} +1 -1
  18. package/dist/preview/assets/{item-DMtXi_cx.js → item-DHarupON.js} +1 -1
  19. package/dist/preview/assets/{runtime-CA58Mif7.js → runtime-560tuaHv.js} +1 -1
  20. package/dist/preview/assets/{runtime-CjJBU_e1.js → runtime-C2rQ3L3-.js} +1 -1
  21. package/dist/preview/assets/{runtime-DeUmGsM_.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-wVZ1xP8L.js → runtime-DOM_La4X.js} +1 -1
  25. package/dist/preview/assets/{runtime-BUPuX-Gq.js → runtime-DQHb9t0r.js} +1 -1
  26. package/dist/preview/assets/{runtime-DnXoWy2A.js → runtime-Dgl3wVfD.js} +1 -1
  27. package/dist/preview/assets/{runtime-CWqQzWuc.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/form/fields/2026-05-28/com.shwfed.form.field.combobox.multi/runtime.vue +13 -2
  42. package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.combobox.multi/schema.d.ts +1 -0
  43. package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.combobox.multi/schema.js +4 -1
  44. package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.combobox.single/runtime.vue +10 -2
  45. package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.combobox.single/schema.d.ts +1 -0
  46. package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.combobox.single/schema.js +4 -1
  47. package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.combobox.multi/runtime.vue +16 -0
  48. package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.combobox.multi/schema.d.ts +1 -0
  49. package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.combobox.multi/schema.js +4 -1
  50. package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.combobox.single/runtime.vue +13 -5
  51. package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.combobox.single/schema.d.ts +1 -0
  52. package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.combobox.single/schema.js +4 -1
  53. package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.multi/runtime.vue +25 -5
  54. package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.multi/schema.d.ts +1 -0
  55. package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.multi/schema.js +4 -1
  56. package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.single/runtime.vue +18 -8
  57. package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.single/schema.d.ts +1 -0
  58. package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.single/schema.js +4 -1
  59. package/dist/runtime/components/form/index.vue +11 -3
  60. package/dist/runtime/components/form/schema.d.ts +4 -0
  61. package/dist/runtime/components/form/schema.js +1 -0
  62. package/dist/runtime/components/form/unit-config.vue +6 -1
  63. package/dist/runtime/components/form/utils/form-vars.js +2 -0
  64. package/dist/runtime/components/form/utils/resolve.d.ts +10 -0
  65. package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-multi/runtime.vue +13 -2
  66. package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-multi/schema.d.ts +1 -0
  67. package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-multi/schema.js +4 -1
  68. package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-single/runtime.vue +10 -2
  69. package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-single/schema.d.ts +1 -0
  70. package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-single/schema.js +4 -1
  71. package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.tree-combobox-multi/runtime.vue +16 -0
  72. package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.tree-combobox-multi/schema.d.ts +1 -0
  73. package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.tree-combobox-multi/schema.js +3 -1
  74. package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.tree-combobox-single/runtime.vue +13 -5
  75. package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.tree-combobox-single/schema.d.ts +1 -0
  76. package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.tree-combobox-single/schema.js +3 -1
  77. package/dist/runtime/components/table/config.vue +5 -1
  78. package/dist/runtime/components/table/row-provider.vue +8 -0
  79. package/dist/runtime/components/table/utils/resolve.d.ts +7 -0
  80. package/dist/runtime/components/table/utils/shared.js +4 -0
  81. package/dist/runtime/components/ui/expression-editor/CodeMirrorInput.d.vue.ts +1 -0
  82. package/dist/runtime/components/ui/expression-editor/CodeMirrorInput.vue +9 -1
  83. package/dist/runtime/components/ui/expression-editor/CodeMirrorInput.vue.d.ts +1 -0
  84. package/dist/runtime/components/ui/expression-editor/ExpressionEditor.d.vue.ts +2 -2
  85. package/dist/runtime/components/ui/expression-editor/ExpressionEditor.vue +33 -4
  86. package/dist/runtime/components/ui/expression-editor/ExpressionEditor.vue.d.ts +2 -2
  87. package/dist/runtime/components/ui/expression-editor/picker-entries.d.ts +3 -2
  88. package/dist/runtime/components/ui/expression-editor/picker-entries.js +14 -3
  89. package/dist/runtime/components/ui/expression-editor/selection-chip-extension.d.ts +4 -0
  90. package/dist/runtime/components/ui/expression-editor/selection-chip-extension.js +119 -0
  91. package/dist/runtime/components/ui/expression-editor/selection-refs.d.ts +8 -0
  92. package/dist/runtime/components/ui/expression-editor/selection-refs.js +29 -0
  93. package/dist/runtime/share/event-bus.d.ts +12 -12
  94. package/dist/runtime/utils/cel-context.d.ts +22 -0
  95. package/dist/runtime/utils/cel-context.js +8 -0
  96. package/dist/runtime/utils/selections-registry.d.ts +77 -0
  97. package/dist/runtime/utils/selections-registry.js +49 -0
  98. package/package.json +1 -1
  99. package/dist/preview/assets/config-BNF2r9jW.js +0 -1
  100. package/dist/preview/assets/config-BxuGYvER.js +0 -1
  101. package/dist/preview/assets/config-Cy5w3JWQ.js +0 -1
  102. package/dist/preview/assets/config-Du5SuNSb.js +0 -1
  103. package/dist/preview/assets/config-ggyCcWNZ.js +0 -1
  104. package/dist/preview/assets/index-DsMR5NfK.css +0 -1
  105. package/dist/preview/assets/index-Yv78vz4W.js +0 -680
  106. package/dist/preview/assets/index-yrBKwEfk.js +0 -1
  107. package/dist/preview/assets/runtime-2S3Yr051.js +0 -1
  108. package/dist/preview/assets/runtime-C4jFTZ4Z.js +0 -1
  109. package/dist/runtime/share/form-validate.d.ts +0 -18
  110. 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"
@@ -8,6 +8,7 @@ import { useI18n } from "vue-i18n";
8
8
  import { asRequest, fetchJsonOption } from "../../../../../share/request";
9
9
  import { cel as _rawCel } from "../../../../../utils/cel";
10
10
  import { celBindings, injectCELContext } from "../../../../../utils/cel-context";
11
+ import { publishSelection } from "../../../../../utils/selections-registry";
11
12
  import { interpolateMarkdown } from "../../../../table/utils/runtime";
12
13
  import { getLocalizedText } from "../../../../../share/locale";
13
14
  import {
@@ -178,7 +179,8 @@ const entries = computed(() => {
178
179
  key: item.id,
179
180
  value: item.value.value,
180
181
  label: labelTpl ? safeInterpolate(labelTpl, ctx) : "",
181
- keywords: kw.length > 0 ? kw : void 0
182
+ keywords: kw.length > 0 ? kw : void 0,
183
+ raw: item
182
184
  };
183
185
  });
184
186
  }
@@ -194,7 +196,8 @@ const entries = computed(() => {
194
196
  key: String(idx),
195
197
  value: remoteValueOf(option),
196
198
  label: remoteLabelOf(option),
197
- keywords: remoteKeywordsOf(option)
199
+ keywords: remoteKeywordsOf(option),
200
+ raw: option
198
201
  }));
199
202
  });
200
203
  const uncontrolled = ref([]);
@@ -243,6 +246,14 @@ const selectedEntries = computed(() => {
243
246
  });
244
247
  const selectedKeys = computed(() => selectedEntries.value.map((e) => e.key));
245
248
  const selectedKeySet = computed(() => new Set(selectedKeys.value));
249
+ publishSelection(
250
+ props.fieldId,
251
+ () => selectedEntries.value.length > 0 ? selectedEntries.value : void 0,
252
+ {
253
+ identity: (list) => list.map((e) => e.key).join("\0"),
254
+ raw: (list) => list.map((e) => e.raw)
255
+ }
256
+ );
246
257
  const triggerLabel = computed(() => {
247
258
  const arr = selectedEntries.value;
248
259
  if (arr.length === 0) return "";
@@ -16,6 +16,7 @@ export declare const metadata: {
16
16
  readonly min: 2;
17
17
  readonly max: 2;
18
18
  };
19
+ readonly selection: true;
19
20
  };
20
21
  export declare function itemSchema(configure: (env: Environment) => void): Schema.Struct<{
21
22
  id: Schema.refine<string, typeof Schema.String>;
@@ -8,7 +8,10 @@ export const metadata = {
8
8
  name: "\u4E0B\u62C9\u591A\u9009",
9
9
  icon: "fluent:chevron-down-20-regular",
10
10
  w: { initial: 8, min: 4, max: Infinity },
11
- h: { initial: 2, min: 2, max: 2 }
11
+ h: { initial: 2, min: 2, max: 2 },
12
+ // Publishes its resolved options (array, in selection order) to the
13
+ // `selections` registry (runtime.vue), readable via `selections["<id>"]`.
14
+ selection: true
12
15
  };
13
16
  const isListType = (actual) => actual === "dyn" || actual.startsWith("list") || actual.startsWith("optional");
14
17
  function configureWithOption(configure) {
@@ -8,6 +8,7 @@ import { useI18n } from "vue-i18n";
8
8
  import { asRequest, fetchJsonOption } from "../../../../../share/request";
9
9
  import { cel as _rawCel } from "../../../../../utils/cel";
10
10
  import { celBindings, injectCELContext } from "../../../../../utils/cel-context";
11
+ import { publishSelection } from "../../../../../utils/selections-registry";
11
12
  import { interpolateMarkdown } from "../../../../table/utils/runtime";
12
13
  import { getLocalizedText } from "../../../../../share/locale";
13
14
  import {
@@ -180,7 +181,8 @@ const entries = computed(() => {
180
181
  value: item.value.value,
181
182
  label: labelTpl ? safeInterpolate(labelTpl, ctx) : "",
182
183
  tooltip: tooltipTpl ? safeInterpolate(tooltipTpl, ctx) : void 0,
183
- keywords: kw.length > 0 ? kw : void 0
184
+ keywords: kw.length > 0 ? kw : void 0,
185
+ raw: item
184
186
  };
185
187
  });
186
188
  }
@@ -196,7 +198,8 @@ const entries = computed(() => {
196
198
  key: String(idx),
197
199
  value: remoteValueOf(option),
198
200
  label: remoteLabelOf(option),
199
- keywords: remoteKeywordsOf(option)
201
+ keywords: remoteKeywordsOf(option),
202
+ raw: option
200
203
  }));
201
204
  });
202
205
  const uncontrolled = ref(void 0);
@@ -246,6 +249,11 @@ const selectedEntry = computed(
246
249
  );
247
250
  const selectedKey = computed(() => selectedEntry.value?.key);
248
251
  const selectedLabel = computed(() => selectedEntry.value?.label ?? "");
252
+ publishSelection(
253
+ props.fieldId,
254
+ () => selectedEntry.value,
255
+ { identity: (entry) => entry.key, raw: (entry) => entry.raw }
256
+ );
249
257
  const open = ref(false);
250
258
  function handleSelect(key) {
251
259
  if (typeof key !== "string") return;
@@ -16,6 +16,7 @@ export declare const metadata: {
16
16
  readonly min: 2;
17
17
  readonly max: 2;
18
18
  };
19
+ readonly selection: true;
19
20
  };
20
21
  export declare function itemSchema(configure: (env: Environment) => void): Schema.Struct<{
21
22
  id: Schema.refine<string, typeof Schema.String>;
@@ -8,7 +8,10 @@ export const metadata = {
8
8
  name: "\u4E0B\u62C9\u5355\u9009",
9
9
  icon: "fluent:chevron-down-20-regular",
10
10
  w: { initial: 8, min: 4, max: Infinity },
11
- h: { initial: 2, min: 2, max: 2 }
11
+ h: { initial: 2, min: 2, max: 2 },
12
+ // Publishes its resolved option to the `selections` registry (runtime.vue), so
13
+ // a sibling expression can read the full chosen record via `selections["<id>"]`.
14
+ selection: true
12
15
  };
13
16
  const isListType = (actual) => actual === "dyn" || actual.startsWith("list") || actual.startsWith("optional");
14
17
  function configureWithOption(configure) {
@@ -7,6 +7,7 @@ import { useI18n } from "vue-i18n";
7
7
  import { fetchJsonOption } from "../../../../../share/request";
8
8
  import { cel as _rawCel } from "../../../../../utils/cel";
9
9
  import { celBindings, injectCELContext } from "../../../../../utils/cel-context";
10
+ import { publishSelection } from "../../../../../utils/selections-registry";
10
11
  import { getLocalizedText } from "../../../../../share/locale";
11
12
  import { Field, FieldLabel, FieldMessages } from "../../../../ui/field";
12
13
  import { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput } from "../../../../ui/input-group";
@@ -240,6 +241,21 @@ const triggerLabel = computed(() => {
240
241
  if (arr.length === 1) return head;
241
242
  return `${head} + ${arr.length - 1}`;
242
243
  });
244
+ const selectedLeaves = computed(
245
+ () => model.value.map((k) => {
246
+ const path = findWrappedPath(roots.value, k);
247
+ if (!path || path.length === 0) return void 0;
248
+ return path[path.length - 1];
249
+ }).filter((node) => node !== void 0)
250
+ );
251
+ publishSelection(
252
+ props.fieldId,
253
+ () => selectedLeaves.value.length > 0 ? selectedLeaves.value : void 0,
254
+ {
255
+ identity: (list) => list.map((w) => w.key).join(" "),
256
+ raw: (list) => list.map((w) => w.raw)
257
+ }
258
+ );
243
259
  const initialExpanded = computed(() => {
244
260
  if (!props.config.expandAll) return [];
245
261
  const out = [];
@@ -16,6 +16,7 @@ export declare const metadata: {
16
16
  readonly min: 2;
17
17
  readonly max: 2;
18
18
  };
19
+ readonly selection: true;
19
20
  };
20
21
  export declare function schema(configure: (env: Environment) => void): Schema.Struct<{
21
22
  label: Schema.optional<Schema.TupleType<readonly [Schema.Struct<{
@@ -9,7 +9,10 @@ export const metadata = {
9
9
  name: "\u4E0B\u62C9\u6811\uFF08\u591A\u9009\uFF09",
10
10
  icon: "fluent:tree-evergreen-20-regular",
11
11
  w: { initial: 8, min: 4, max: Infinity },
12
- h: { initial: 2, min: 2, max: 2 }
12
+ h: { initial: 2, min: 2, max: 2 },
13
+ // Publishes its resolved nodes (array, in selection order) to the `selections`
14
+ // registry (runtime.vue), readable via `selections["<id>"]`.
15
+ selection: true
13
16
  };
14
17
  const NODE_VAR = {
15
18
  type: "dyn",
@@ -7,6 +7,7 @@ import { useI18n } from "vue-i18n";
7
7
  import { fetchJsonOption } from "../../../../../share/request";
8
8
  import { cel as _rawCel } from "../../../../../utils/cel";
9
9
  import { celBindings, injectCELContext } from "../../../../../utils/cel-context";
10
+ import { publishSelection } from "../../../../../utils/selections-registry";
10
11
  import { getLocalizedText } from "../../../../../share/locale";
11
12
  import { Field, FieldLabel, FieldMessages } from "../../../../ui/field";
12
13
  import { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput } from "../../../../ui/input-group";
@@ -227,14 +228,21 @@ const roots = computed(
227
228
  nodeChildren: nodeChildrenList
228
229
  })
229
230
  );
230
- const triggerLabel = computed(() => {
231
+ const selectedWrapped = computed(() => {
231
232
  const k = model.value;
232
- if (!k) return "";
233
+ if (!k) return void 0;
233
234
  const path = findWrappedPath(roots.value, k);
234
- if (!path || path.length === 0) return "";
235
- const leaf = path[path.length - 1];
236
- return wrappedLabelText(leaf);
235
+ if (!path || path.length === 0) return void 0;
236
+ return path[path.length - 1];
237
237
  });
238
+ const triggerLabel = computed(
239
+ () => selectedWrapped.value ? wrappedLabelText(selectedWrapped.value) : ""
240
+ );
241
+ publishSelection(
242
+ props.fieldId,
243
+ () => selectedWrapped.value,
244
+ { identity: (w) => w.key, raw: (w) => w.raw }
245
+ );
238
246
  const initialExpanded = computed(() => {
239
247
  if (!props.config.expandAll) return [];
240
248
  const out = [];
@@ -16,6 +16,7 @@ export declare const metadata: {
16
16
  readonly min: 2;
17
17
  readonly max: 2;
18
18
  };
19
+ readonly selection: true;
19
20
  };
20
21
  export declare function schema(configure: (env: Environment) => void): Schema.Struct<{
21
22
  label: Schema.optional<Schema.TupleType<readonly [Schema.Struct<{
@@ -9,7 +9,10 @@ export const metadata = {
9
9
  name: "\u4E0B\u62C9\u6811\uFF08\u5355\u9009\uFF09",
10
10
  icon: "fluent:tree-evergreen-20-regular",
11
11
  w: { initial: 8, min: 4, max: Infinity },
12
- h: { initial: 2, min: 2, max: 2 }
12
+ h: { initial: 2, min: 2, max: 2 },
13
+ // Publishes its resolved node (the backend record) to the `selections`
14
+ // registry (runtime.vue), readable via `selections["<id>"]`.
15
+ selection: true
13
16
  };
14
17
  const NODE_VAR = {
15
18
  type: "dyn",
@@ -7,6 +7,7 @@ import { useI18n } from "vue-i18n";
7
7
  import { fetchJsonOption } from "../../../../../share/request";
8
8
  import { cel as _rawCel } from "../../../../../utils/cel";
9
9
  import { celBindings, injectCELContext } from "../../../../../utils/cel-context";
10
+ import { publishSelection } from "../../../../../utils/selections-registry";
10
11
  import { getLocalizedText } from "../../../../../share/locale";
11
12
  import { Checkbox } from "../../../../ui/checkbox";
12
13
  import { Field, FieldLabel, FieldMessages } from "../../../../ui/field";
@@ -262,20 +263,39 @@ const filterLabelText = computed(() => {
262
263
  const localized = props.config.filter?.label ? getLocalizedText(props.config.filter.label, locale.value) : void 0;
263
264
  return localized && localized.length > 0 ? localized : t("tree-multi-search-label");
264
265
  });
265
- const readonlyText = computed(() => {
266
+ const resolvedByKey = computed(() => {
266
267
  const selected = new Set(model.value);
267
- const empty = t("tree-multi-readonly-empty");
268
- if (selected.size === 0) return empty;
269
268
  const found = /* @__PURE__ */ new Map();
269
+ if (selected.size === 0) return found;
270
270
  const stack = [...roots.value];
271
271
  while (stack.length) {
272
272
  const n = stack.pop();
273
273
  const k = getKey(n);
274
- if (selected.has(k)) found.set(k, nodeLabelText(n));
274
+ if (selected.has(k)) found.set(k, n);
275
275
  const kids = getChildren(n);
276
276
  if (kids && kids.length) stack.push(...kids);
277
277
  }
278
- const labels = model.value.map((id) => found.get(id) ?? id).filter((l) => l.length > 0);
278
+ return found;
279
+ });
280
+ const selectedNodes = computed(
281
+ () => model.value.map((id) => resolvedByKey.value.get(id)).filter((n) => n !== void 0)
282
+ );
283
+ publishSelection(
284
+ props.fieldId,
285
+ () => selectedNodes.value.length > 0 ? selectedNodes.value : void 0,
286
+ {
287
+ identity: (list) => list.map((n) => getKey(n)).join(" "),
288
+ raw: (list) => list
289
+ }
290
+ );
291
+ const readonlyText = computed(() => {
292
+ const empty = t("tree-multi-readonly-empty");
293
+ if (model.value.length === 0) return empty;
294
+ const found = resolvedByKey.value;
295
+ const labels = model.value.map((id) => {
296
+ const n = found.get(id);
297
+ return n !== void 0 ? nodeLabelText(n) : id;
298
+ }).filter((l) => l.length > 0);
279
299
  return labels.length > 0 ? labels.join(t("tree-multi-readonly-separator")) : empty;
280
300
  });
281
301
  </script>
@@ -17,6 +17,7 @@ export declare const metadata: {
17
17
  readonly max: number;
18
18
  readonly grow: true;
19
19
  };
20
+ readonly selection: true;
20
21
  };
21
22
  export declare function schema(configure: (env: Environment) => void): Schema.Struct<{
22
23
  label: Schema.optional<Schema.TupleType<readonly [Schema.Struct<{
@@ -9,7 +9,10 @@ export const metadata = {
9
9
  name: "\u6811\uFF08\u591A\u9009\uFF09",
10
10
  icon: "fluent:tree-evergreen-20-regular",
11
11
  w: { initial: 8, min: 4, max: Infinity },
12
- h: { initial: 8, min: 4, max: Infinity, grow: true }
12
+ h: { initial: 8, min: 4, max: Infinity, grow: true },
13
+ // Publishes its resolved nodes (array, in selection order) to the `selections`
14
+ // registry (runtime.vue), readable via `selections["<id>"]`.
15
+ selection: true
13
16
  };
14
17
  export function schema(configure) {
15
18
  const CelBool = Expression({ configure, resultType: "bool" });
@@ -7,6 +7,7 @@ import { useI18n } from "vue-i18n";
7
7
  import { fetchJsonOption } from "../../../../../share/request";
8
8
  import { cel as _rawCel } from "../../../../../utils/cel";
9
9
  import { celBindings, injectCELContext } from "../../../../../utils/cel-context";
10
+ import { publishSelection } from "../../../../../utils/selections-registry";
10
11
  import { getLocalizedText } from "../../../../../share/locale";
11
12
  import { Field, FieldLabel, FieldMessages } from "../../../../ui/field";
12
13
  import { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput } from "../../../../ui/input-group";
@@ -258,21 +259,30 @@ const filterLabelText = computed(() => {
258
259
  const localized = props.config.filter?.label ? getLocalizedText(props.config.filter.label, locale.value) : void 0;
259
260
  return localized && localized.length > 0 ? localized : t("tree-single-search-label");
260
261
  });
261
- const readonlyText = computed(() => {
262
+ const selectedNode = computed(() => {
262
263
  const selected = model.value;
263
- const empty = t("tree-single-readonly-empty");
264
- if (selected == null) return empty;
264
+ if (selected == null) return void 0;
265
265
  const stack = [...roots.value];
266
266
  while (stack.length) {
267
267
  const n = stack.pop();
268
- if (getKey(n) === selected) {
269
- const label = nodeLabelText(n);
270
- return label.length > 0 ? label : selected;
271
- }
268
+ if (getKey(n) === selected) return n;
272
269
  const kids = getChildren(n);
273
270
  if (kids && kids.length) stack.push(...kids);
274
271
  }
275
- return selected;
272
+ return void 0;
273
+ });
274
+ publishSelection(
275
+ props.fieldId,
276
+ () => selectedNode.value,
277
+ { identity: (node) => getKey(node), raw: (node) => node }
278
+ );
279
+ const readonlyText = computed(() => {
280
+ const selected = model.value;
281
+ if (selected == null) return t("tree-single-readonly-empty");
282
+ const n = selectedNode.value;
283
+ if (n === void 0) return selected;
284
+ const label = nodeLabelText(n);
285
+ return label.length > 0 ? label : selected;
276
286
  });
277
287
  </script>
278
288
 
@@ -16,6 +16,7 @@ export declare const metadata: {
16
16
  readonly max: number;
17
17
  readonly grow: true;
18
18
  };
19
+ readonly selection: true;
19
20
  };
20
21
  export declare function schema(configure: (env: Environment) => void): Schema.Struct<{
21
22
  label: Schema.optional<Schema.TupleType<readonly [Schema.Struct<{