@shwfed/config 2.10.3 → 2.10.5

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 (159) hide show
  1. package/dist/mcp.mjs +1600 -1317
  2. package/dist/module.json +1 -1
  3. package/dist/preview/assets/{FieldGroup.vue_vue_type_script_setup_true_lang-sT5i_dnE.js → FieldGroup.vue_vue_type_script_setup_true_lang-D-COryaS.js} +1 -1
  4. package/dist/preview/assets/{badge-ZFj45FMd.js → badge-Sb01O_E2.js} +1 -1
  5. package/dist/preview/assets/{config-3rP_f_3o.js → config-99L3dMcP.js} +1 -1
  6. package/dist/preview/assets/{config-cD091sze.js → config-BgJWNJ-L.js} +1 -1
  7. package/dist/preview/assets/{config-CEBzJOHo.js → config-BjSI3yTw.js} +1 -1
  8. package/dist/preview/assets/{config-BBvebIQw.js → config-BzMW9qCl.js} +1 -1
  9. package/dist/preview/assets/{config-BLesYihN.js → config-CEM0BCax.js} +1 -1
  10. package/dist/preview/assets/{config-D1uMzMiN.js → config-CtKXZjQl.js} +1 -1
  11. package/dist/preview/assets/{config-CSR1JNVB.js → config-CyRpAiSg.js} +1 -1
  12. package/dist/preview/assets/{config-Rz0II9u6.js → config-Cz3VQcLY.js} +1 -1
  13. package/dist/preview/assets/{config-2iinn_1E.js → config-D6BiWm3q.js} +1 -1
  14. package/dist/preview/assets/{config-lskK7grq.js → config-DA1Knc1V.js} +1 -1
  15. package/dist/preview/assets/{config-DfVc2Iy9.js → config-DGBuMIqU.js} +1 -1
  16. package/dist/preview/assets/{config-BwDPPmtn.js → config-DK0wxXG_.js} +1 -1
  17. package/dist/preview/assets/{config-DZPLqFqt.js → config-Du8kzY9H.js} +1 -1
  18. package/dist/preview/assets/{config-CgM75jSO.js → config-n4AGAnL-.js} +1 -1
  19. package/dist/preview/assets/{definition.vue_vue_type_script_setup_true_lang-Ce_NeQUa.js → definition.vue_vue_type_script_setup_true_lang-BtOF0dda.js} +1 -1
  20. package/dist/preview/assets/{index-_KA5_QIV.js → index-BOnw60vg.js} +1 -1
  21. package/dist/preview/assets/index-BZlqSG2R.js +763 -0
  22. package/dist/preview/assets/index-D3Az3yzR.css +1 -0
  23. package/dist/preview/assets/index-Rj5bF6fM.js +1 -0
  24. package/dist/preview/assets/{item-CBFJ6f6b.js → item-D7avZRKo.js} +1 -1
  25. package/dist/preview/assets/{runtime-DO9HS0Rb.js → runtime-BWlX7BAG.js} +1 -1
  26. package/dist/preview/assets/{runtime-BKqyqEeD.js → runtime-Bek88ifk.js} +1 -1
  27. package/dist/preview/assets/{runtime-CIc3k_jd.js → runtime-C9kOkTYc.js} +1 -1
  28. package/dist/preview/assets/{runtime-Q_isegB9.js → runtime-CSrgcLuC.js} +1 -1
  29. package/dist/preview/assets/{runtime-jWibKv1T.js → runtime-CWTz9Iy4.js} +1 -1
  30. package/dist/preview/assets/{runtime-Cu0RJn8g.js → runtime-D-HZWcV-.js} +1 -1
  31. package/dist/preview/assets/{runtime-CvMryNNx.js → runtime-DMsPs0Pz.js} +1 -1
  32. package/dist/preview/assets/{runtime-BIGEoc5L.js → runtime-DOqVHcvv.js} +1 -1
  33. package/dist/preview/assets/{runtime-DQXLscBz.js → runtime-Dhl0NpTL.js} +1 -1
  34. package/dist/preview/assets/{runtime-enspc5HG.js → runtime-Dxb1-gUN.js} +1 -1
  35. package/dist/preview/assets/{schema-meta-B5tln_XH.js → schema-meta-DXS0vi6v.js} +1 -1
  36. package/dist/preview/index.html +2 -2
  37. package/dist/runtime/components/block-layout-editor/index.vue +8 -0
  38. package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.table/schema.d.ts +1 -0
  39. package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.table/schema.js +5 -1
  40. package/dist/runtime/components/config/blocks/2026-06-17/com.shwfed.block.tree.single/config.d.vue.ts +223 -0
  41. package/dist/runtime/components/config/blocks/2026-06-17/com.shwfed.block.tree.single/config.vue +496 -0
  42. package/dist/runtime/components/config/blocks/2026-06-17/com.shwfed.block.tree.single/config.vue.d.ts +223 -0
  43. package/dist/runtime/components/config/blocks/2026-06-17/com.shwfed.block.tree.single/node-actions.d.vue.ts +10 -0
  44. package/dist/runtime/components/config/blocks/2026-06-17/com.shwfed.block.tree.single/node-actions.vue +25 -0
  45. package/dist/runtime/components/config/blocks/2026-06-17/com.shwfed.block.tree.single/node-actions.vue.d.ts +10 -0
  46. package/dist/runtime/components/config/blocks/2026-06-17/com.shwfed.block.tree.single/runtime.d.vue.ts +228 -0
  47. package/dist/runtime/components/config/blocks/2026-06-17/com.shwfed.block.tree.single/runtime.vue +355 -0
  48. package/dist/runtime/components/config/blocks/2026-06-17/com.shwfed.block.tree.single/runtime.vue.d.ts +228 -0
  49. package/dist/runtime/components/config/blocks/2026-06-17/com.shwfed.block.tree.single/schema.d.ts +227 -0
  50. package/dist/runtime/components/config/blocks/2026-06-17/com.shwfed.block.tree.single/schema.js +130 -0
  51. package/dist/runtime/components/config/utils/resolve.d.ts +16 -0
  52. package/dist/runtime/components/form/fields/2026-04-22/com.shwfed.form.field.text/config.d.vue.ts +134 -0
  53. package/dist/runtime/components/form/fields/2026-04-22/com.shwfed.form.field.text/config.vue +78 -2
  54. package/dist/runtime/components/form/fields/2026-04-22/com.shwfed.form.field.text/config.vue.d.ts +134 -0
  55. package/dist/runtime/components/form/fields/2026-04-22/com.shwfed.form.field.text/runtime.vue +24 -0
  56. package/dist/runtime/components/form/fields/2026-04-22/com.shwfed.form.field.text/schema.d.ts +132 -0
  57. package/dist/runtime/components/form/fields/2026-04-22/com.shwfed.form.field.text/schema.js +14 -1
  58. package/dist/runtime/components/form/fields/2026-04-28/com.shwfed.form.field.number/config.d.vue.ts +134 -0
  59. package/dist/runtime/components/form/fields/2026-04-28/com.shwfed.form.field.number/config.vue +77 -2
  60. package/dist/runtime/components/form/fields/2026-04-28/com.shwfed.form.field.number/config.vue.d.ts +134 -0
  61. package/dist/runtime/components/form/fields/2026-04-28/com.shwfed.form.field.number/runtime.vue +24 -0
  62. package/dist/runtime/components/form/fields/2026-04-28/com.shwfed.form.field.number/schema.d.ts +132 -0
  63. package/dist/runtime/components/form/fields/2026-04-28/com.shwfed.form.field.number/schema.js +14 -1
  64. package/dist/runtime/components/form/fields/2026-05-23/com.shwfed.form.field.tree.multi/config.d.vue.ts +22 -22
  65. package/dist/runtime/components/form/fields/2026-05-23/com.shwfed.form.field.tree.multi/config.vue.d.ts +22 -22
  66. package/dist/runtime/components/form/fields/2026-05-23/com.shwfed.form.field.tree.multi/schema.js +2 -1
  67. package/dist/runtime/components/form/fields/2026-05-26/com.shwfed.form.field.tree.combobox.multi/config.d.vue.ts +22 -22
  68. package/dist/runtime/components/form/fields/2026-05-26/com.shwfed.form.field.tree.combobox.multi/config.vue.d.ts +22 -22
  69. package/dist/runtime/components/form/fields/2026-05-26/com.shwfed.form.field.tree.combobox.multi/schema.js +2 -1
  70. package/dist/runtime/components/form/fields/2026-05-26/com.shwfed.form.field.tree.combobox.single/config.d.vue.ts +22 -22
  71. package/dist/runtime/components/form/fields/2026-05-26/com.shwfed.form.field.tree.combobox.single/config.vue.d.ts +22 -22
  72. package/dist/runtime/components/form/fields/2026-05-26/com.shwfed.form.field.tree.combobox.single/schema.js +2 -1
  73. package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.combobox.multi/config.d.vue.ts +22 -22
  74. package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.combobox.multi/config.vue.d.ts +22 -22
  75. package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.combobox.multi/schema.js +2 -1
  76. package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.combobox.single/config.d.vue.ts +22 -22
  77. package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.combobox.single/config.vue.d.ts +22 -22
  78. package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.combobox.single/schema.js +2 -1
  79. package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.multi/config.d.vue.ts +22 -22
  80. package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.multi/config.vue.d.ts +22 -22
  81. package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.multi/schema.js +2 -1
  82. package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.single/config.d.vue.ts +22 -22
  83. package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.single/config.vue.d.ts +22 -22
  84. package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.single/schema.js +2 -1
  85. package/dist/runtime/components/table/columns/2026-04-14/com.shwfed.table.column.select/runtime.vue +3 -3
  86. package/dist/runtime/components/table/columns/2026-04-14/com.shwfed.table.column.text/runtime.vue +54 -2
  87. package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.combobox-single/config.d.vue.ts +2 -2
  88. package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.combobox-single/config.vue.d.ts +2 -2
  89. package/dist/runtime/components/table/columns/2026-05-24/com.shwfed.table.column.combobox-single.remote.options-remote/config.d.vue.ts +2 -2
  90. package/dist/runtime/components/table/columns/2026-05-24/com.shwfed.table.column.combobox-single.remote.options-remote/config.vue.d.ts +2 -2
  91. package/dist/runtime/components/table/columns/2026-05-24/com.shwfed.table.column.combobox-single.remote.options-static/config.d.vue.ts +2 -2
  92. package/dist/runtime/components/table/columns/2026-05-24/com.shwfed.table.column.combobox-single.remote.options-static/config.vue.d.ts +2 -2
  93. package/dist/runtime/components/table/columns/2026-05-25/com.shwfed.table.column.combobox-multi/config.d.vue.ts +2 -2
  94. package/dist/runtime/components/table/columns/2026-05-25/com.shwfed.table.column.combobox-multi/config.vue.d.ts +2 -2
  95. package/dist/runtime/components/table/columns/2026-05-25/com.shwfed.table.column.combobox-multi.remote.options-remote/config.d.vue.ts +2 -2
  96. package/dist/runtime/components/table/columns/2026-05-25/com.shwfed.table.column.combobox-multi.remote.options-remote/config.vue.d.ts +2 -2
  97. package/dist/runtime/components/table/columns/2026-05-25/com.shwfed.table.column.combobox-multi.remote.options-static/config.d.vue.ts +2 -2
  98. package/dist/runtime/components/table/columns/2026-05-25/com.shwfed.table.column.combobox-multi.remote.options-static/config.vue.d.ts +2 -2
  99. package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-multi/config.d.vue.ts +2 -2
  100. package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-multi/config.vue.d.ts +2 -2
  101. package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-multi.remote/config.d.vue.ts +2 -2
  102. package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-multi.remote/config.vue.d.ts +2 -2
  103. package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-single/config.d.vue.ts +2 -2
  104. package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-single/config.vue.d.ts +2 -2
  105. package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-single.remote/config.d.vue.ts +2 -2
  106. package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-single.remote/config.vue.d.ts +2 -2
  107. package/dist/runtime/components/table/columns/2026-05-27/com.shwfed.table.column.tree-combobox-multi/config.d.vue.ts +2 -2
  108. package/dist/runtime/components/table/columns/2026-05-27/com.shwfed.table.column.tree-combobox-multi/config.vue.d.ts +2 -2
  109. package/dist/runtime/components/table/columns/2026-05-27/com.shwfed.table.column.tree-combobox-multi/schema.js +2 -1
  110. package/dist/runtime/components/table/columns/2026-05-27/com.shwfed.table.column.tree-combobox-single/config.d.vue.ts +2 -2
  111. package/dist/runtime/components/table/columns/2026-05-27/com.shwfed.table.column.tree-combobox-single/config.vue.d.ts +2 -2
  112. package/dist/runtime/components/table/columns/2026-05-27/com.shwfed.table.column.tree-combobox-single/schema.js +2 -1
  113. package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-multi/config.d.vue.ts +2 -2
  114. package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-multi/config.vue.d.ts +2 -2
  115. package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-single/config.d.vue.ts +2 -2
  116. package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-single/config.vue.d.ts +2 -2
  117. package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.tree-combobox-multi/config.d.vue.ts +2 -2
  118. package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.tree-combobox-multi/config.vue.d.ts +2 -2
  119. package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.tree-combobox-multi/schema.js +2 -1
  120. package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.tree-combobox-single/config.d.vue.ts +2 -2
  121. package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.tree-combobox-single/config.vue.d.ts +2 -2
  122. package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.tree-combobox-single/schema.js +2 -1
  123. package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.combobox-multi/config.d.vue.ts +2 -2
  124. package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.combobox-multi/config.vue.d.ts +2 -2
  125. package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.combobox-single/config.d.vue.ts +2 -2
  126. package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.combobox-single/config.vue.d.ts +2 -2
  127. package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.tree-combobox-multi/config.d.vue.ts +2 -2
  128. package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.tree-combobox-multi/config.vue.d.ts +2 -2
  129. package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.tree-combobox-multi/schema.js +2 -1
  130. package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.tree-combobox-single/config.d.vue.ts +2 -2
  131. package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.tree-combobox-single/config.vue.d.ts +2 -2
  132. package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.tree-combobox-single/schema.js +2 -1
  133. package/dist/runtime/components/table/columns/2026-06-17/com.shwfed.table.column.date-input/config.d.vue.ts +10 -0
  134. package/dist/runtime/components/table/columns/2026-06-17/com.shwfed.table.column.date-input/config.vue +543 -0
  135. package/dist/runtime/components/table/columns/2026-06-17/com.shwfed.table.column.date-input/config.vue.d.ts +10 -0
  136. package/dist/runtime/components/table/columns/2026-06-17/com.shwfed.table.column.date-input/runtime.d.vue.ts +9 -0
  137. package/dist/runtime/components/table/columns/2026-06-17/com.shwfed.table.column.date-input/runtime.vue +110 -0
  138. package/dist/runtime/components/table/columns/2026-06-17/com.shwfed.table.column.date-input/runtime.vue.d.ts +9 -0
  139. package/dist/runtime/components/table/columns/2026-06-17/com.shwfed.table.column.date-input/schema.d.ts +76 -0
  140. package/dist/runtime/components/table/columns/2026-06-17/com.shwfed.table.column.date-input/schema.js +89 -0
  141. package/dist/runtime/components/ui/tree/Tree.d.vue.ts +13 -0
  142. package/dist/runtime/components/ui/tree/Tree.vue +8 -1
  143. package/dist/runtime/components/ui/tree/Tree.vue.d.ts +13 -0
  144. package/dist/runtime/components/ui/tree/TreeNode.d.vue.ts +2 -0
  145. package/dist/runtime/components/ui/tree/TreeNode.vue +5 -2
  146. package/dist/runtime/components/ui/tree/TreeNode.vue.d.ts +2 -0
  147. package/dist/runtime/share/slot-renderer.d.vue.ts +5 -0
  148. package/dist/runtime/share/slot-renderer.vue +43 -28
  149. package/dist/runtime/share/slot-renderer.vue.d.ts +5 -0
  150. package/dist/runtime/share/tree-node-var.d.ts +25 -0
  151. package/dist/runtime/share/tree-node-var.js +10 -0
  152. package/dist/runtime/vendor/cel-js/CLAUDE.md +1 -1
  153. package/dist/runtime/vendor/cel-js/PROMPT.md +6 -0
  154. package/dist/runtime/vendor/cel-js/lib/http-builtins.d.ts +0 -14
  155. package/dist/runtime/vendor/cel-js/lib/http-builtins.js +17 -0
  156. package/package.json +1 -1
  157. package/dist/preview/assets/index-Zc4Mcm3J.js +0 -761
  158. package/dist/preview/assets/index-pkoEF5dC.css +0 -1
  159. package/dist/preview/assets/index-snO3CfdE.js +0 -1
@@ -0,0 +1,227 @@
1
+ import { Schema } from 'effect';
2
+ import type { Environment } from '../../../../../vendor/cel-js/lib/index.js';
3
+ type AnySchema = Schema.Schema<any, any, never>;
4
+ export declare const type: "com.shwfed.block.tree.single";
5
+ export declare const compatibilityDate: "2026-06-17";
6
+ export declare const metadata: {
7
+ readonly name: "树(单选)";
8
+ readonly icon: "fluent:tree-evergreen-20-regular";
9
+ readonly w: {
10
+ readonly initial: 12;
11
+ readonly min: 6;
12
+ readonly max: number;
13
+ };
14
+ readonly h: {
15
+ readonly initial: 12;
16
+ readonly min: 4;
17
+ readonly max: number;
18
+ readonly grow: true;
19
+ };
20
+ readonly operations: readonly [{
21
+ readonly id: "refresh";
22
+ readonly name: "刷新";
23
+ readonly icon: "fluent:arrow-sync-20-regular";
24
+ }, {
25
+ readonly id: "clear-selection";
26
+ readonly name: "清空选中";
27
+ readonly icon: "fluent:select-all-off-20-regular";
28
+ }];
29
+ };
30
+ /**
31
+ * Standalone page-level single-select tree (a navigator). Mirrors the tree
32
+ * FORM FIELD's node-config surface — same designer experience — but is a
33
+ * different beast: no form binding, no validation, no derived value. The
34
+ * picked node is published to the page `selections` registry under this
35
+ * block's `id`, so a sibling block's expression can read the full chosen
36
+ * record via `selections["<block-id>"]`.
37
+ *
38
+ * The schema is intentionally NOT shared with the form field at the code
39
+ * level: block and field are diverging surfaces (one is form-bound, one is a
40
+ * page navigator), so coupling them would couple two things that evolve
41
+ * apart. The designer UI is kept visually similar in `config.vue` instead.
42
+ */
43
+ export declare function schema(configure: (env: Environment) => void, _blockRef?: AnySchema): Schema.Struct<{
44
+ id: Schema.refine<string, typeof Schema.String>;
45
+ type: Schema.tag<"com.shwfed.block.tree.single">;
46
+ compatibilityDate: Schema.tag<"2026-06-17">;
47
+ style: Schema.optional<Schema.Schema<string, string, never>>;
48
+ dataSource: Schema.Struct<{
49
+ request: Schema.optional<Schema.Schema<string, string, never>>;
50
+ data: Schema.Schema<string, string, never>;
51
+ }>;
52
+ nodeKey: Schema.Schema<string, string, never>;
53
+ nodeChildren: Schema.Schema<string, string, never>;
54
+ nodeLabel: Schema.refine<readonly [{
55
+ readonly locale: "zh";
56
+ readonly message: string;
57
+ }, ...{
58
+ readonly locale: "en" | "ja" | "ko";
59
+ readonly message: string;
60
+ }[]], Schema.TupleType<readonly [Schema.Struct<{
61
+ locale: Schema.Literal<["zh"]>;
62
+ message: Schema.SchemaClass<string, string, never>;
63
+ }>], [Schema.Struct<{
64
+ locale: Schema.Literal<["ja", "en", "ko"]>;
65
+ message: Schema.SchemaClass<string, string, never>;
66
+ }>]>>;
67
+ nodeTooltip: Schema.optional<Schema.refine<readonly [{
68
+ readonly locale: "zh";
69
+ readonly message: string;
70
+ }, ...{
71
+ readonly locale: "en" | "ja" | "ko";
72
+ readonly message: string;
73
+ }[]], Schema.TupleType<readonly [Schema.Struct<{
74
+ locale: Schema.Literal<["zh"]>;
75
+ message: Schema.SchemaClass<string, string, never>;
76
+ }>], [Schema.Struct<{
77
+ locale: Schema.Literal<["ja", "en", "ko"]>;
78
+ message: Schema.SchemaClass<string, string, never>;
79
+ }>]>>>;
80
+ nodeSelectable: Schema.optional<Schema.Schema<string, string, never>>;
81
+ expandAll: Schema.optionalWith<typeof Schema.Boolean, {
82
+ default: () => false;
83
+ }>;
84
+ filter: Schema.optional<Schema.Struct<{
85
+ enabled: Schema.SchemaClass<boolean, boolean, never>;
86
+ label: Schema.optional<Schema.TupleType<readonly [Schema.Struct<{
87
+ locale: Schema.Literal<["zh"]>;
88
+ message: Schema.SchemaClass<string, string, never>;
89
+ }>], [Schema.Struct<{
90
+ locale: Schema.Literal<["ja", "en", "ko"]>;
91
+ message: Schema.SchemaClass<string, string, never>;
92
+ }>]>>;
93
+ keywords: Schema.optional<Schema.Schema<string, string, never>>;
94
+ }>>;
95
+ nodeActions: Schema.Struct<{
96
+ size: Schema.optionalWith<Schema.Literal<["default", "sm", "xs"]>, {
97
+ default: () => "default";
98
+ }>;
99
+ gap: Schema.optionalWith<Schema.filter<Schema.filter<typeof Schema.Number>>, {
100
+ default: () => number;
101
+ }>;
102
+ style: Schema.optional<typeof Schema.String>;
103
+ groups: Schema.Array$<Schema.Struct<{
104
+ id: Schema.refine<string, typeof Schema.String>;
105
+ variant: Schema.optional<Schema.Literal<["default", "primary", "destructive", "ghost", "link"]>>;
106
+ }>>;
107
+ items: Schema.Array$<Schema.Schema<import("../../../../actions/schema.js").RegistryItemValue | {
108
+ readonly disabled?: string | undefined;
109
+ readonly id: string;
110
+ readonly title: readonly [{
111
+ readonly locale: "zh";
112
+ readonly message: string;
113
+ }, ...{
114
+ readonly locale: "en" | "ja" | "ko";
115
+ readonly message: string;
116
+ }[]];
117
+ readonly icon?: string | undefined;
118
+ readonly hidden?: string | undefined;
119
+ readonly tooltip?: readonly [{
120
+ readonly locale: "zh";
121
+ readonly message: string;
122
+ }, ...{
123
+ readonly locale: "en" | "ja" | "ko";
124
+ readonly message: string;
125
+ }[]] | undefined;
126
+ readonly variant?: "default" | "link" | "destructive" | "primary" | "ghost" | undefined;
127
+ readonly action?: any;
128
+ readonly groupId: string;
129
+ readonly hideTitle?: boolean | undefined;
130
+ } | {
131
+ readonly id: string;
132
+ readonly title: readonly [{
133
+ readonly locale: "zh";
134
+ readonly message: string;
135
+ }, ...{
136
+ readonly locale: "en" | "ja" | "ko";
137
+ readonly message: string;
138
+ }[]];
139
+ readonly icon?: string | undefined;
140
+ readonly items: readonly (import("../../../../actions/schema.js").RegistrySubItemValue | {
141
+ readonly disabled?: string | undefined;
142
+ readonly id: string;
143
+ readonly title: readonly [{
144
+ readonly locale: "zh";
145
+ readonly message: string;
146
+ }, ...{
147
+ readonly locale: "en" | "ja" | "ko";
148
+ readonly message: string;
149
+ }[]];
150
+ readonly icon?: string | undefined;
151
+ readonly hidden?: string | undefined;
152
+ readonly tooltip?: readonly [{
153
+ readonly locale: "zh";
154
+ readonly message: string;
155
+ }, ...{
156
+ readonly locale: "en" | "ja" | "ko";
157
+ readonly message: string;
158
+ }[]] | undefined;
159
+ readonly variant?: "default" | "link" | "destructive" | "primary" | "ghost" | undefined;
160
+ readonly action?: any;
161
+ })[];
162
+ readonly groupId: string;
163
+ readonly hideTitle?: boolean | undefined;
164
+ }, import("../../../../actions/schema.js").RegistryItemValue | {
165
+ readonly id: string;
166
+ readonly title: readonly [{
167
+ readonly locale: "zh";
168
+ readonly message: string;
169
+ }, ...{
170
+ readonly locale: "en" | "ja" | "ko";
171
+ readonly message: string;
172
+ }[]];
173
+ readonly groupId: string;
174
+ readonly disabled?: string | undefined;
175
+ readonly icon?: string | undefined;
176
+ readonly hidden?: string | undefined;
177
+ readonly tooltip?: readonly [{
178
+ readonly locale: "zh";
179
+ readonly message: string;
180
+ }, ...{
181
+ readonly locale: "en" | "ja" | "ko";
182
+ readonly message: string;
183
+ }[]] | undefined;
184
+ readonly variant?: "default" | "link" | "destructive" | "primary" | "ghost" | undefined;
185
+ readonly action?: any;
186
+ readonly hideTitle?: boolean | undefined;
187
+ } | {
188
+ readonly id: string;
189
+ readonly title: readonly [{
190
+ readonly locale: "zh";
191
+ readonly message: string;
192
+ }, ...{
193
+ readonly locale: "en" | "ja" | "ko";
194
+ readonly message: string;
195
+ }[]];
196
+ readonly items: readonly (import("../../../../actions/schema.js").RegistrySubItemValue | {
197
+ readonly id: string;
198
+ readonly title: readonly [{
199
+ readonly locale: "zh";
200
+ readonly message: string;
201
+ }, ...{
202
+ readonly locale: "en" | "ja" | "ko";
203
+ readonly message: string;
204
+ }[]];
205
+ readonly disabled?: string | undefined;
206
+ readonly icon?: string | undefined;
207
+ readonly hidden?: string | undefined;
208
+ readonly tooltip?: readonly [{
209
+ readonly locale: "zh";
210
+ readonly message: string;
211
+ }, ...{
212
+ readonly locale: "en" | "ja" | "ko";
213
+ readonly message: string;
214
+ }[]] | undefined;
215
+ readonly variant?: "default" | "link" | "destructive" | "primary" | "ghost" | undefined;
216
+ readonly action?: any;
217
+ })[];
218
+ readonly groupId: string;
219
+ readonly icon?: string | undefined;
220
+ readonly hideTitle?: boolean | undefined;
221
+ }, never>>;
222
+ kind: Schema.tag<"shwfed.component.action">;
223
+ }>;
224
+ }>;
225
+ export type Value = Schema.Schema.Type<ReturnType<typeof schema>>;
226
+ export declare function defaultBody(): Record<string, unknown>;
227
+ export {};
@@ -0,0 +1,130 @@
1
+ import { Schema } from "effect";
2
+ import { Expression, LocaleMarkdown } from "../../../../../share/expression.js";
3
+ import { registerNodeVariableIfAbsent } from "../../../../../share/tree-node-var.js";
4
+ import { ActionsConfig, defaultActionsConfig } from "../../../../actions/schema.js";
5
+ import { DataSource } from "../../../../table/schema.js";
6
+ import { Locale } from "../../../../../share/locale.js";
7
+ export const type = "com.shwfed.block.tree.single";
8
+ export const compatibilityDate = "2026-06-17";
9
+ export const metadata = {
10
+ name: "\u6811\uFF08\u5355\u9009\uFF09",
11
+ icon: "fluent:tree-evergreen-20-regular",
12
+ w: { initial: 12, min: 6, max: Infinity },
13
+ // `grow: true`: the tree's height is content-driven (nodes expand/collapse),
14
+ // so its row escapes the grid's `1fr` equal-share (bare `auto`) and the tree
15
+ // grows top-anchored — expanding a node reveals children below instead of
16
+ // repositioning the whole block inside an oversized track. See
17
+ // `config/utils/resolve.ts` `BlockSizeRange.grow`.
18
+ h: { initial: 12, min: 4, max: Infinity, grow: true },
19
+ // Capability manifest — the operations this block exposes to op-requests
20
+ // bubbled up from its descendants (a per-node action button). Both are
21
+ // param-less, mirroring the table's atomic ops: `refresh` re-runs the
22
+ // DataSource fetch (like the table's `search`); `clear-selection` drops the
23
+ // picked node (like the table's `clear-selection`), which also clears the
24
+ // published `selections` entry once the resolved node falls away.
25
+ operations: [
26
+ { id: "refresh", name: "\u5237\u65B0", icon: "fluent:arrow-sync-20-regular" },
27
+ { id: "clear-selection", name: "\u6E05\u7A7A\u9009\u4E2D", icon: "fluent:select-all-off-20-regular" }
28
+ ]
29
+ };
30
+ export function schema(configure, _blockRef) {
31
+ const nodeConfigure = (env) => {
32
+ configure(env);
33
+ registerNodeVariableIfAbsent(env);
34
+ };
35
+ const CelNodeKey = Expression({
36
+ configure: nodeConfigure,
37
+ resultType: (t) => t === "string" || t === "number" || t === "dyn"
38
+ });
39
+ const CelNodeChildren = Expression({
40
+ configure: nodeConfigure,
41
+ // Accept lists, optional lists, and `dyn` — CEL infers an empty literal
42
+ // such as `[]` as `list<dyn>`; a configured expression like
43
+ // `has(node.kids) ? node.kids : null` lands on `dyn`. Mirrors the table's
44
+ // `data` expression.
45
+ resultType: (t) => t === "dyn" || t.startsWith("list") || t.startsWith("optional")
46
+ });
47
+ const CelNodeBool = Expression({ configure: nodeConfigure, resultType: "bool" });
48
+ const NodeLocaleMd = LocaleMarkdown({ configure: nodeConfigure });
49
+ const CelKeywords = Expression({
50
+ configure: nodeConfigure,
51
+ resultType: (t) => t === "dyn" || t.startsWith("list") || t.startsWith("optional")
52
+ });
53
+ const CelStyle = Expression({
54
+ configure,
55
+ resultType: (t) => t === "string" || t === "dyn" || t.startsWith("map") || t.startsWith("optional")
56
+ });
57
+ return Schema.Struct({
58
+ id: Schema.UUID.annotations({ description: "\u5757\u552F\u4E00\u6807\u8BC6" }),
59
+ type: Schema.tag(type),
60
+ compatibilityDate: Schema.tag(compatibilityDate),
61
+ style: Schema.optional(CelStyle).annotations({
62
+ title: "\u6837\u5F0F",
63
+ description: "\u8FD4\u56DE\u5E94\u7528\u5728\u6811\u5757\u6839\u5143\u7D20\u4E0A\u7684\u6837\u5F0F\u7684 CEL \u8868\u8FBE\u5F0F\uFF0C\u53EF\u8FD4\u56DE CSS \u5B57\u7B26\u4E32\uFF08\u5982 `'max-height: 24rem'`\uFF09\u6216\u6837\u5F0F\u5BF9\u8C61\uFF08\u5982 `{'max-height': '24rem'}`\uFF09\uFF1B\u5E38\u7528\u4E8E\u9650\u5236\u9AD8\u5EA6\uFF0C\u8D85\u51FA\u90E8\u5206\u6811\u4F53\u81EA\u52A8\u6EDA\u52A8\u3002\u7559\u7A7A\u5219\u4E0D\u8BBE\u989D\u5916\u6837\u5F0F"
64
+ }),
65
+ dataSource: DataSource(configure).annotations({
66
+ title: "\u6570\u636E\u6E90",
67
+ description: "\u8FD4\u56DE\u5B8C\u6574\u6811\uFF08\u6839\u8282\u70B9\u5217\u8868\uFF09\u7684\u6570\u636E\u6E90\uFF1B\u6811\u901A\u8FC7 `\u8282\u70B9\u5B50\u7EA7` \u8868\u8FBE\u5F0F\u9010\u5C42\u5411\u4E0B\u8BFB\u53D6\u5B50\u7EA7"
68
+ }),
69
+ nodeKey: CelNodeKey.annotations({
70
+ title: "\u8282\u70B9 ID",
71
+ description: "\u4E3A\u6BCF\u4E2A\u8282\u70B9\u8BA1\u7B97\u7A33\u5B9A\u552F\u4E00 ID \u7684 CEL \u8868\u8FBE\u5F0F\uFF0C\u53EF\u8BBF\u95EE `node`\uFF1B\u8FD0\u884C\u65F6\u4EE5\u5B57\u7B26\u4E32\u5F62\u5F0F\u5B58\u50A8"
72
+ }),
73
+ nodeChildren: CelNodeChildren.annotations({
74
+ title: "\u8282\u70B9\u5B50\u7EA7",
75
+ description: "\u8FD4\u56DE\u5F53\u524D\u8282\u70B9\u7684\u5B50\u7EA7\u5217\u8868\u7684 CEL \u8868\u8FBE\u5F0F\uFF1B\u8FD4\u56DE `none` / `null` \u89C6\u4E3A\u53F6\u5B50\u8282\u70B9"
76
+ }),
77
+ nodeLabel: NodeLocaleMd.annotations({
78
+ title: "\u8282\u70B9\u6807\u7B7E",
79
+ description: "\u8282\u70B9\u5C55\u793A\u7684\u672C\u5730\u5316\u6587\u672C\uFF0C\u652F\u6301 Markdown \u4E0E `{{ node.foo }}` \u63D2\u503C"
80
+ }),
81
+ nodeTooltip: Schema.optional(NodeLocaleMd.annotations({
82
+ title: "\u8282\u70B9\u63D0\u793A",
83
+ description: "\u9F20\u6807\u60AC\u505C\u5728\u8282\u70B9\u4E0A\u65F6\u5C55\u793A\u7684\u672C\u5730\u5316\u63D0\u793A\uFF0C\u652F\u6301 Markdown \u4E0E\u63D2\u503C"
84
+ })),
85
+ nodeSelectable: Schema.optional(CelNodeBool.annotations({
86
+ title: "\u8282\u70B9\u53EF\u9009\u6761\u4EF6",
87
+ description: "\u8FD4\u56DE `true` \u8868\u793A\u8BE5\u8282\u70B9\u53EF\u88AB\u9009\u62E9"
88
+ })),
89
+ expandAll: Schema.optionalWith(Schema.Boolean, { default: () => false }).annotations({
90
+ title: "\u9ED8\u8BA4\u5168\u90E8\u5C55\u5F00",
91
+ description: "\u5F00\u542F\u540E\u6302\u8F7D\u65F6\u5C55\u5F00\u6240\u6709\u975E\u53F6\u5B50\u8282\u70B9"
92
+ }),
93
+ filter: Schema.optional(Schema.Struct({
94
+ enabled: Schema.Boolean.annotations({ title: "\u542F\u7528", description: "\u662F\u5426\u5728\u6811\u4E0A\u65B9\u663E\u793A\u641C\u7D22\u8F93\u5165\u6846" }),
95
+ label: Schema.optional(Locale.annotations({
96
+ title: "\u6807\u7B7E",
97
+ description: "\u641C\u7D22\u8F93\u5165\u6846\u7684\u6D6E\u52A8\u6807\u7B7E\uFF1B\u7559\u7A7A\u5219\u4F7F\u7528\u9ED8\u8BA4\u503C\u300C\u641C\u7D22\u300D"
98
+ })),
99
+ keywords: Schema.optional(CelKeywords.annotations({
100
+ title: "\u989D\u5916\u5173\u952E\u8BCD",
101
+ description: "\u8FD4\u56DE\u5B57\u7B26\u4E32\u5217\u8868\u7684 CEL \u8868\u8FBE\u5F0F\uFF0C\u53EF\u8BBF\u95EE `node`\uFF1B\u5339\u914D\u89C4\u5219\u4E3A\u300C\u8282\u70B9\u6807\u7B7E \u6216 \u4EFB\u4E00\u5173\u952E\u8BCD\u300D\u5305\u542B\u641C\u7D22\u8BCD\uFF08\u4E0D\u533A\u5206\u5927\u5C0F\u5199\uFF09"
102
+ }))
103
+ }).annotations({
104
+ title: "\u8FC7\u6EE4",
105
+ description: "\u5BA2\u6237\u7AEF\u8FC7\u6EE4\uFF1B\u8FC7\u6EE4\u4E0D\u4F1A\u5F71\u54CD\u5DF2\u9009\u4E2D\u7684\u8282\u70B9 ID"
106
+ })),
107
+ // Per-node actions, revealed on hover. The full Actions config nested
108
+ // under one key — button conditions / expressions evaluate against the
109
+ // hovered `node` (and nothing else beyond the ambient page context).
110
+ nodeActions: ActionsConfig(nodeConfigure).annotations({
111
+ title: "\u8282\u70B9\u64CD\u4F5C",
112
+ description: "\u6BCF\u4E2A\u8282\u70B9\u53F3\u4FA7\u3001\u9F20\u6807\u60AC\u505C\u65F6\u663E\u793A\u7684\u64CD\u4F5C\u6309\u94AE\uFF1B\u6309\u94AE\u8868\u8FBE\u5F0F\u53EF\u8BBF\u95EE `node`"
113
+ })
114
+ }).annotations({
115
+ title: "TreeSingleBlock",
116
+ description: "\u57FA\u4E8E\u6811\u5F62\u6570\u636E\u7684\u5355\u9009\u5BFC\u822A\u5757"
117
+ });
118
+ }
119
+ export function defaultBody() {
120
+ return {
121
+ dataSource: { data: "[]" },
122
+ nodeKey: "string(node.id)",
123
+ nodeChildren: "has(node.children) ? node.children : null",
124
+ nodeLabel: [{ locale: "zh", message: "{{ node.label }}" }],
125
+ expandAll: false,
126
+ // Per-node actions default to the small button size — a tree row is a
127
+ // tight surface, unlike a standalone Actions block.
128
+ nodeActions: { ...defaultActionsConfig(), size: "sm" }
129
+ };
130
+ }
@@ -12,6 +12,22 @@ export type BlockSizeRange = Readonly<{
12
12
  initial: number;
13
13
  min: number;
14
14
  max: number;
15
+ /**
16
+ * When true on the height axis, the block's row tracks switch from the
17
+ * default `minmax(auto, 1fr)` to a bare `auto` in `slot-renderer.vue`, so the
18
+ * block escapes the grid's `1fr` equal-share and follows its own intrinsic
19
+ * height. Honored only on `h`. Identical mechanism to the form's
20
+ * `FieldSizeRange.grow` (see `FormUnitRenderer`).
21
+ *
22
+ * Use for blocks with dynamic, content-driven height (tree, table). Without
23
+ * it, such a block sits inside a `1fr`-sized track — usually taller than its
24
+ * collapsed content — and visibly *repositions* (floats / re-centers) as the
25
+ * content grows. The bare `auto` makes the track exactly the block's height,
26
+ * so the block is top-anchored and grows straight down ("expanding, not
27
+ * moving"), and its growth no longer redistributes the slot's slack across
28
+ * sibling blocks.
29
+ */
30
+ grow?: boolean;
15
31
  }>;
16
32
  export type BlockMetadata = Readonly<{
17
33
  name: string;
@@ -50,6 +50,73 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
50
50
  readonly warning?: boolean | undefined;
51
51
  readonly when: string;
52
52
  }[] | undefined;
53
+ readonly addon?: {
54
+ readonly size: "default" | "sm" | "xs";
55
+ readonly style?: string | undefined;
56
+ readonly gap: number;
57
+ readonly items: readonly (import("../../../../actions/schema.js").RegistryItemValue | {
58
+ readonly disabled?: string | undefined;
59
+ readonly id: string;
60
+ readonly title: readonly [{
61
+ readonly locale: "zh";
62
+ readonly message: string;
63
+ }, ...{
64
+ readonly locale: "en" | "ja" | "ko";
65
+ readonly message: string;
66
+ }[]];
67
+ readonly icon?: string | undefined;
68
+ readonly hidden?: string | undefined;
69
+ readonly tooltip?: readonly [{
70
+ readonly locale: "zh";
71
+ readonly message: string;
72
+ }, ...{
73
+ readonly locale: "en" | "ja" | "ko";
74
+ readonly message: string;
75
+ }[]] | undefined;
76
+ readonly variant?: "default" | "link" | "destructive" | "primary" | "ghost" | undefined;
77
+ readonly action?: any;
78
+ readonly groupId: string;
79
+ readonly hideTitle?: boolean | undefined;
80
+ } | {
81
+ readonly id: string;
82
+ readonly title: readonly [{
83
+ readonly locale: "zh";
84
+ readonly message: string;
85
+ }, ...{
86
+ readonly locale: "en" | "ja" | "ko";
87
+ readonly message: string;
88
+ }[]];
89
+ readonly icon?: string | undefined;
90
+ readonly items: readonly (import("../../../../actions/schema.js").RegistrySubItemValue | {
91
+ readonly disabled?: string | undefined;
92
+ readonly id: string;
93
+ readonly title: readonly [{
94
+ readonly locale: "zh";
95
+ readonly message: string;
96
+ }, ...{
97
+ readonly locale: "en" | "ja" | "ko";
98
+ readonly message: string;
99
+ }[]];
100
+ readonly icon?: string | undefined;
101
+ readonly hidden?: string | undefined;
102
+ readonly tooltip?: readonly [{
103
+ readonly locale: "zh";
104
+ readonly message: string;
105
+ }, ...{
106
+ readonly locale: "en" | "ja" | "ko";
107
+ readonly message: string;
108
+ }[]] | undefined;
109
+ readonly variant?: "default" | "link" | "destructive" | "primary" | "ghost" | undefined;
110
+ readonly action?: any;
111
+ })[];
112
+ readonly groupId: string;
113
+ readonly hideTitle?: boolean | undefined;
114
+ })[];
115
+ readonly groups: readonly {
116
+ readonly id: string;
117
+ readonly variant?: "default" | "link" | "destructive" | "primary" | "ghost" | undefined;
118
+ }[];
119
+ } | undefined;
53
120
  }) => any;
54
121
  }, string, import("vue").PublicProps, Readonly<__VLS_ModelProps> & Readonly<{
55
122
  "onUpdate:modelValue"?: ((value: {
@@ -99,6 +166,73 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
99
166
  readonly warning?: boolean | undefined;
100
167
  readonly when: string;
101
168
  }[] | undefined;
169
+ readonly addon?: {
170
+ readonly size: "default" | "sm" | "xs";
171
+ readonly style?: string | undefined;
172
+ readonly gap: number;
173
+ readonly items: readonly (import("../../../../actions/schema.js").RegistryItemValue | {
174
+ readonly disabled?: string | undefined;
175
+ readonly id: string;
176
+ readonly title: readonly [{
177
+ readonly locale: "zh";
178
+ readonly message: string;
179
+ }, ...{
180
+ readonly locale: "en" | "ja" | "ko";
181
+ readonly message: string;
182
+ }[]];
183
+ readonly icon?: string | undefined;
184
+ readonly hidden?: string | undefined;
185
+ readonly tooltip?: readonly [{
186
+ readonly locale: "zh";
187
+ readonly message: string;
188
+ }, ...{
189
+ readonly locale: "en" | "ja" | "ko";
190
+ readonly message: string;
191
+ }[]] | undefined;
192
+ readonly variant?: "default" | "link" | "destructive" | "primary" | "ghost" | undefined;
193
+ readonly action?: any;
194
+ readonly groupId: string;
195
+ readonly hideTitle?: boolean | undefined;
196
+ } | {
197
+ readonly id: string;
198
+ readonly title: readonly [{
199
+ readonly locale: "zh";
200
+ readonly message: string;
201
+ }, ...{
202
+ readonly locale: "en" | "ja" | "ko";
203
+ readonly message: string;
204
+ }[]];
205
+ readonly icon?: string | undefined;
206
+ readonly items: readonly (import("../../../../actions/schema.js").RegistrySubItemValue | {
207
+ readonly disabled?: string | undefined;
208
+ readonly id: string;
209
+ readonly title: readonly [{
210
+ readonly locale: "zh";
211
+ readonly message: string;
212
+ }, ...{
213
+ readonly locale: "en" | "ja" | "ko";
214
+ readonly message: string;
215
+ }[]];
216
+ readonly icon?: string | undefined;
217
+ readonly hidden?: string | undefined;
218
+ readonly tooltip?: readonly [{
219
+ readonly locale: "zh";
220
+ readonly message: string;
221
+ }, ...{
222
+ readonly locale: "en" | "ja" | "ko";
223
+ readonly message: string;
224
+ }[]] | undefined;
225
+ readonly variant?: "default" | "link" | "destructive" | "primary" | "ghost" | undefined;
226
+ readonly action?: any;
227
+ })[];
228
+ readonly groupId: string;
229
+ readonly hideTitle?: boolean | undefined;
230
+ })[];
231
+ readonly groups: readonly {
232
+ readonly id: string;
233
+ readonly variant?: "default" | "link" | "destructive" | "primary" | "ghost" | undefined;
234
+ }[];
235
+ } | undefined;
102
236
  }) => any) | undefined;
103
237
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
104
238
  declare const _default: typeof __VLS_export;
@@ -1,12 +1,15 @@
1
1
  <script setup>
2
- import { computed } from "vue";
2
+ import { computed, inject, onBeforeUnmount, ref, watch } from "vue";
3
+ import { Icon } from "@iconify/vue";
3
4
  import { Field, FieldLabel } from "../../../../ui/field";
5
+ import { Button } from "../../../../ui/button";
4
6
  import { ExpressionEditor } from "../../../../ui/expression-editor";
5
7
  import DerivedValueEditor from "../../../DerivedValueEditor.vue";
6
8
  import ValidationRulesField from "../../../ValidationRulesField.vue";
7
9
  import { InputGroup, InputGroupInput } from "../../../../ui/input-group";
8
10
  import { Locale as LocaleField } from "../../../../ui/locale";
9
11
  import { Markdown } from "../../../../ui/markdown";
12
+ import ActionsConfigEditor from "../../../../actions/config.vue";
10
13
  import {
11
14
  Select,
12
15
  SelectContent,
@@ -15,6 +18,8 @@ import {
15
18
  SelectValue
16
19
  } from "../../../../ui/select";
17
20
  import { getStructFieldDescription, getStructFieldTitle } from "../../../schema";
21
+ import { FORM_FIELD_LAYOUT_KEY } from "../../../field-layout";
22
+ import { BREADCRUMB_EXTENSION_KEY } from "../../../../config/breadcrumb-extension";
18
23
  import { DEFAULT_FIELD_ORIENTATION, FIELD_ORIENTATION_OPTIONS } from "../../../utils/common";
19
24
  import { schema } from "./schema";
20
25
  defineOptions({ name: "ShwfedTextFieldConfig" });
@@ -23,6 +28,47 @@ const fieldSchema = schema(() => {
23
28
  });
24
29
  const fieldTitle = (f) => getStructFieldTitle(fieldSchema, f) ?? f;
25
30
  const fieldDescription = (f) => getStructFieldDescription(fieldSchema, f);
31
+ const layout = inject(FORM_FIELD_LAYOUT_KEY, null);
32
+ const breadcrumbExt = inject(BREADCRUMB_EXTENSION_KEY, null);
33
+ const editingAddon = ref(false);
34
+ function closeAddon() {
35
+ editingAddon.value = false;
36
+ }
37
+ const addonCrumb = breadcrumbExt?.add();
38
+ watch(editingAddon, (on) => {
39
+ if (layout) layout.fullPane.value = on;
40
+ if (addonCrumb) {
41
+ addonCrumb.label.value = on ? "\u8F93\u5165\u6846\u5185\u6309\u94AE" : null;
42
+ addonCrumb.back.value = on ? closeAddon : null;
43
+ }
44
+ });
45
+ onBeforeUnmount(() => {
46
+ if (layout) layout.fullPane.value = false;
47
+ addonCrumb?.dispose();
48
+ });
49
+ const addonItemCount = computed(() => value.value.addon?.items.length ?? 0);
50
+ const addonValue = computed({
51
+ get: () => ({
52
+ kind: "shwfed.component.action",
53
+ size: value.value.addon?.size ?? "xs",
54
+ gap: value.value.addon?.gap ?? 4,
55
+ style: value.value.addon?.style,
56
+ groups: value.value.addon?.groups ?? [],
57
+ items: value.value.addon?.items ?? []
58
+ }),
59
+ set: (next) => {
60
+ const { size, gap, style, groups, items } = next;
61
+ if (groups.length === 0 && items.length === 0) {
62
+ const { addon: _omit, ...rest } = value.value;
63
+ value.value = rest;
64
+ return;
65
+ }
66
+ value.value = {
67
+ ...value.value,
68
+ addon: { size, gap, groups, items, ...style === void 0 ? {} : { style } }
69
+ };
70
+ }
71
+ });
26
72
  const pathText = computed({
27
73
  get: () => value.value.binding ?? "",
28
74
  set: (next) => {
@@ -38,7 +84,16 @@ const pathText = computed({
38
84
  </script>
39
85
 
40
86
  <template>
41
- <div class="flex flex-col gap-3">
87
+ <ActionsConfigEditor
88
+ v-if="editingAddon"
89
+ v-model="addonValue"
90
+ hide-size
91
+ />
92
+
93
+ <div
94
+ v-else
95
+ class="flex flex-col gap-3"
96
+ >
42
97
  <div class="grid grid-cols-2 gap-3">
43
98
  <Field orientation="vertical">
44
99
  <FieldLabel class="text-xs text-zinc-500">
@@ -302,5 +357,26 @@ const pathText = computed({
302
357
  @update:model-value="(v) => value = { ...value, validations: v.length > 0 ? v : void 0 }"
303
358
  />
304
359
  </Field>
360
+
361
+ <Field orientation="vertical">
362
+ <FieldLabel class="text-xs text-zinc-500">
363
+ <template #tooltip>
364
+ <Markdown
365
+ :source="fieldDescription('addon')"
366
+ block
367
+ class="prose prose-sm prose-zinc"
368
+ />
369
+ </template>
370
+ {{ fieldTitle("addon") }}
371
+ </FieldLabel>
372
+ <Button
373
+ type="button"
374
+ class="w-full justify-center"
375
+ @click="editingAddon = true"
376
+ >
377
+ <Icon icon="fluent:add-20-regular" />
378
+ <span>{{ addonItemCount > 0 ? "\u914D\u7F6E\u6309\u94AE" : "\u6DFB\u52A0\u6309\u94AE" }}</span>
379
+ </Button>
380
+ </Field>
305
381
  </div>
306
382
  </template>