@shwfed/config 2.3.28 → 2.3.29

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 (127) hide show
  1. package/dist/mcp.mjs +3124 -1268
  2. package/dist/module.json +1 -1
  3. package/dist/preview/assets/{config-fvkC2rB8.js → config-6IiXCmyu.js} +1 -1
  4. package/dist/preview/assets/{config--PcXQV_r.js → config-BJzUh1_G.js} +1 -1
  5. package/dist/preview/assets/{config-B5avpKJE.js → config-Bl80ye-i.js} +1 -1
  6. package/dist/preview/assets/{config-DDfTl9Cs.js → config-CZOeZ8ty.js} +1 -1
  7. package/dist/preview/assets/{config-CJHPt8Gx.js → config-DaZD4ZSa.js} +1 -1
  8. package/dist/preview/assets/{config-CNo3isHa.js → config-DhsbcNzx.js} +1 -1
  9. package/dist/preview/assets/{config-5KVDXgUF.js → config-Diuyh0Ex.js} +1 -1
  10. package/dist/preview/assets/{config-D0_1yZdF.js → config-aK67Rsw5.js} +1 -1
  11. package/dist/preview/assets/{config-CQHS6cZe.js → config-rpX_Mc6I.js} +1 -1
  12. package/dist/preview/assets/{definition.vue_vue_type_script_setup_true_lang-RM-qDh0R.js → definition.vue_vue_type_script_setup_true_lang-C_jU8d47.js} +1 -1
  13. package/dist/preview/assets/{index-a2QwAots.css → index-2eQR4s3q.css} +1 -1
  14. package/dist/preview/assets/index-DEF3_MKr.js +659 -0
  15. package/dist/preview/assets/index-Df-thth9.js +1 -0
  16. package/dist/preview/assets/{runtime-Dr_10emf.js → runtime-3p1K6te5.js} +1 -1
  17. package/dist/preview/assets/{runtime-C_XX6a0C.js → runtime-BcLnafic.js} +1 -1
  18. package/dist/preview/assets/{runtime-CtqwtTE_.js → runtime-CSaV-359.js} +1 -1
  19. package/dist/preview/assets/{runtime-CCbyrqQT.js → runtime-CjR8Vi5N.js} +1 -1
  20. package/dist/preview/assets/{runtime-BGTWf-O7.js → runtime-D_fJCKX_.js} +1 -1
  21. package/dist/preview/assets/{runtime-BPjZQmcY.js → runtime-DpeCgGEG.js} +1 -1
  22. package/dist/preview/assets/{runtime-DcrzodsN.js → runtime-K2a1x0TJ.js} +1 -1
  23. package/dist/preview/assets/{runtime-Dy4ZmQ-n.js → runtime-g9Zu3VNQ.js} +1 -1
  24. package/dist/preview/assets/{runtime-Bq3fmxeF.js → runtime-jTnh_6Dm.js} +1 -1
  25. package/dist/preview/index.html +2 -2
  26. package/dist/runtime/components/block-layout-editor/index.d.vue.ts +10 -2
  27. package/dist/runtime/components/block-layout-editor/index.vue +44 -8
  28. package/dist/runtime/components/block-layout-editor/index.vue.d.ts +10 -2
  29. package/dist/runtime/components/config/config.vue +35 -0
  30. package/dist/runtime/components/config/use-editor.d.ts +11 -1
  31. package/dist/runtime/components/config/use-editor.js +27 -1
  32. package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.combobox.multi/config.d.vue.ts +163 -0
  33. package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.combobox.multi/config.vue +745 -0
  34. package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.combobox.multi/config.vue.d.ts +163 -0
  35. package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.combobox.multi/runtime.d.vue.ts +8 -0
  36. package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.combobox.multi/runtime.vue +383 -0
  37. package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.combobox.multi/runtime.vue.d.ts +8 -0
  38. package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.combobox.multi/schema.d.ts +264 -0
  39. package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.combobox.multi/schema.js +183 -0
  40. package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.combobox.single/config.d.vue.ts +163 -0
  41. package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.combobox.single/config.vue +745 -0
  42. package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.combobox.single/config.vue.d.ts +163 -0
  43. package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.combobox.single/runtime.d.vue.ts +8 -0
  44. package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.combobox.single/runtime.vue +402 -0
  45. package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.combobox.single/runtime.vue.d.ts +8 -0
  46. package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.combobox.single/schema.d.ts +264 -0
  47. package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.combobox.single/schema.js +209 -0
  48. package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.combobox.multi/config.d.vue.ts +129 -0
  49. package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.combobox.multi/config.vue +618 -0
  50. package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.combobox.multi/config.vue.d.ts +129 -0
  51. package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.combobox.multi/runtime.d.vue.ts +8 -0
  52. package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.combobox.multi/runtime.vue +501 -0
  53. package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.combobox.multi/runtime.vue.d.ts +8 -0
  54. package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.combobox.multi/schema.d.ts +99 -0
  55. package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.combobox.multi/schema.js +133 -0
  56. package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.combobox.single/config.d.vue.ts +127 -0
  57. package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.combobox.single/config.vue +550 -0
  58. package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.combobox.single/config.vue.d.ts +127 -0
  59. package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.combobox.single/runtime.d.vue.ts +8 -0
  60. package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.combobox.single/runtime.vue +496 -0
  61. package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.combobox.single/runtime.vue.d.ts +8 -0
  62. package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.combobox.single/schema.d.ts +96 -0
  63. package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.combobox.single/schema.js +125 -0
  64. package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.multi/config.d.vue.ts +133 -0
  65. package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.multi/config.vue +605 -0
  66. package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.multi/config.vue.d.ts +133 -0
  67. package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.multi/runtime.d.vue.ts +8 -0
  68. package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.multi/runtime.vue +401 -0
  69. package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.multi/runtime.vue.d.ts +8 -0
  70. package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.multi/schema.d.ts +102 -0
  71. package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.multi/schema.js +142 -0
  72. package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.single/config.d.vue.ts +131 -0
  73. package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.single/config.vue +560 -0
  74. package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.single/config.vue.d.ts +131 -0
  75. package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.single/runtime.d.vue.ts +8 -0
  76. package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.single/runtime.vue +395 -0
  77. package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.single/runtime.vue.d.ts +8 -0
  78. package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.single/schema.d.ts +96 -0
  79. package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.single/schema.js +118 -0
  80. package/dist/runtime/components/form/fields/2026-05-28/tree-combobox-shared.d.ts +35 -0
  81. package/dist/runtime/components/form/fields/2026-05-28/tree-combobox-shared.js +31 -0
  82. package/dist/runtime/components/form/unit-config.vue +45 -1
  83. package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-multi/config.d.vue.ts +183 -0
  84. package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-multi/config.vue +931 -0
  85. package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-multi/config.vue.d.ts +183 -0
  86. package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-multi/runtime.d.vue.ts +9 -0
  87. package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-multi/runtime.vue +463 -0
  88. package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-multi/runtime.vue.d.ts +9 -0
  89. package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-multi/schema.d.ts +283 -0
  90. package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-multi/schema.js +275 -0
  91. package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-single/config.d.vue.ts +183 -0
  92. package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-single/config.vue +931 -0
  93. package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-single/config.vue.d.ts +183 -0
  94. package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-single/runtime.d.vue.ts +9 -0
  95. package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-single/runtime.vue +414 -0
  96. package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-single/runtime.vue.d.ts +9 -0
  97. package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-single/schema.d.ts +283 -0
  98. package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-single/schema.js +275 -0
  99. package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.tree-combobox-multi/config.d.vue.ts +133 -0
  100. package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.tree-combobox-multi/config.vue +632 -0
  101. package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.tree-combobox-multi/config.vue.d.ts +133 -0
  102. package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.tree-combobox-multi/runtime.d.vue.ts +9 -0
  103. package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.tree-combobox-multi/runtime.vue +461 -0
  104. package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.tree-combobox-multi/runtime.vue.d.ts +9 -0
  105. package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.tree-combobox-multi/schema.d.ts +93 -0
  106. package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.tree-combobox-multi/schema.js +161 -0
  107. package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.tree-combobox-single/config.d.vue.ts +131 -0
  108. package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.tree-combobox-single/config.vue +563 -0
  109. package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.tree-combobox-single/config.vue.d.ts +131 -0
  110. package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.tree-combobox-single/runtime.d.vue.ts +9 -0
  111. package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.tree-combobox-single/runtime.vue +443 -0
  112. package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.tree-combobox-single/runtime.vue.d.ts +9 -0
  113. package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.tree-combobox-single/schema.d.ts +90 -0
  114. package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.tree-combobox-single/schema.js +153 -0
  115. package/dist/runtime/components/table/columns/2026-05-28/tree-combobox-shared.d.ts +35 -0
  116. package/dist/runtime/components/table/columns/2026-05-28/tree-combobox-shared.js +31 -0
  117. package/dist/runtime/components/table/config.vue +1 -30
  118. package/dist/runtime/components/ui/command/CommandItem.d.vue.ts +7 -0
  119. package/dist/runtime/components/ui/command/CommandItem.vue +13 -4
  120. package/dist/runtime/components/ui/command/CommandItem.vue.d.ts +7 -0
  121. package/dist/runtime/share/clipboard.d.ts +26 -0
  122. package/dist/runtime/share/clipboard.js +82 -0
  123. package/dist/runtime/share/layout.d.ts +4 -0
  124. package/dist/runtime/share/layout.js +35 -0
  125. package/package.json +1 -1
  126. package/dist/preview/assets/index-DNd8J9Zv.js +0 -643
  127. package/dist/preview/assets/index-DrIMqXAa.js +0 -1
@@ -0,0 +1,443 @@
1
+ <script setup>
2
+ import { Icon } from "@iconify/vue";
3
+ import { Effect, Fiber, Option } from "effect";
4
+ import { computed, ref, shallowRef, watch } from "vue";
5
+ import { useI18n } from "vue-i18n";
6
+ import { cel as _rawCel } from "../../../../../utils/cel";
7
+ import { celBindings, injectCELContext } from "../../../../../utils/cel-context";
8
+ import { getLocalizedText } from "../../../../../share/locale";
9
+ import { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput } from "../../../../ui/input-group";
10
+ import { Markdown } from "../../../../ui/markdown";
11
+ import { Popover, PopoverAnchor, PopoverContent, PopoverTrigger } from "../../../../ui/popover";
12
+ import { Skeleton } from "../../../../ui/skeleton";
13
+ import { Tree as UiTree } from "../../../../ui/tree";
14
+ import { useFormState } from "../../../../form/utils/state";
15
+ import { interpolateMarkdown } from "../../../utils/runtime";
16
+ import { useSharedFetchLayer } from "../../../utils/shared-fetch";
17
+ import {
18
+ findWrappedPath,
19
+ getWrappedChildren,
20
+ wrapStructuralAll
21
+ } from "../tree-combobox-shared";
22
+ defineOptions({ name: "ShwfedTableTreeComboboxSingleRendererRuntime" });
23
+ const props = defineProps({
24
+ column: { type: null, required: true },
25
+ ctx: { type: Object, required: true }
26
+ });
27
+ const { locale, t } = useI18n({
28
+ inheritLocale: true,
29
+ messages: {
30
+ zh: {
31
+ "tree-combobox-single-placeholder": "\u8BF7\u9009\u62E9",
32
+ "tree-combobox-single-search-placeholder": "\u641C\u7D22\u2026",
33
+ "tree-combobox-single-empty": "\u65E0\u53EF\u9009\u9879",
34
+ "tree-combobox-single-load-error": "\u52A0\u8F7D\u5931\u8D25",
35
+ "tree-combobox-single-retry": "\u91CD\u8BD5"
36
+ },
37
+ en: {
38
+ "tree-combobox-single-placeholder": "Select\u2026",
39
+ "tree-combobox-single-search-placeholder": "Search\u2026",
40
+ "tree-combobox-single-empty": "No options",
41
+ "tree-combobox-single-load-error": "Failed to load",
42
+ "tree-combobox-single-retry": "Retry"
43
+ },
44
+ ja: {
45
+ "tree-combobox-single-placeholder": "\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044",
46
+ "tree-combobox-single-search-placeholder": "\u691C\u7D22\u2026",
47
+ "tree-combobox-single-empty": "\u9078\u629E\u80A2\u306A\u3057",
48
+ "tree-combobox-single-load-error": "\u8AAD\u307F\u8FBC\u307F\u306B\u5931\u6557\u3057\u307E\u3057\u305F",
49
+ "tree-combobox-single-retry": "\u518D\u8A66\u884C"
50
+ }
51
+ }
52
+ });
53
+ const formState = useFormState();
54
+ const inherited = injectCELContext();
55
+ const $cel = (expression, context) => _rawCel(expression, { ...celBindings(inherited), ...context });
56
+ const sharedFetchLayer = useSharedFetchLayer();
57
+ const row = computed(() => props.ctx.row.original);
58
+ const rowIndex = computed(() => props.ctx.row.index);
59
+ const placeholderText = computed(
60
+ () => props.column.placeholder ? getLocalizedText(props.column.placeholder, locale.value) : t("tree-combobox-single-placeholder")
61
+ );
62
+ function evalBool(expression, label) {
63
+ if (!expression) return false;
64
+ try {
65
+ return Effect.runSync($cel(expression, { row: row.value, index: rowIndex.value })) === true;
66
+ } catch (e) {
67
+ console.error(`[shwfed-table] tree-combobox-single ${label} failed`, e);
68
+ return false;
69
+ }
70
+ }
71
+ const isHidden = computed(() => evalBool(props.column.hidden, "hidden"));
72
+ const isDisabled = computed(() => evalBool(props.column.disabled, "disabled"));
73
+ const isReadonly = computed(() => evalBool(props.column.readonly, "readonly"));
74
+ const effectiveReadonly = computed(
75
+ () => isReadonly.value || props.column.derived?.mode === "formula"
76
+ );
77
+ const model = computed({
78
+ get: () => {
79
+ const raw = formState.getAt(props.column.binding);
80
+ if (raw == null) return void 0;
81
+ return String(raw);
82
+ },
83
+ set: (next) => {
84
+ formState.setAt(props.column.binding, next == null ? void 0 : String(next));
85
+ }
86
+ });
87
+ function nodeCtx(raw) {
88
+ return { row: row.value, index: rowIndex.value, node: raw };
89
+ }
90
+ function nodeKey(raw) {
91
+ try {
92
+ return String(Effect.runSync($cel(props.column.nodeKey, nodeCtx(raw))));
93
+ } catch (e) {
94
+ console.error("[shwfed-table] tree-combobox-single nodeKey failed", e);
95
+ return "";
96
+ }
97
+ }
98
+ function nodeChildrenList(raw) {
99
+ let v;
100
+ try {
101
+ v = Effect.runSync($cel(props.column.nodeChildren, nodeCtx(raw)));
102
+ } catch (e) {
103
+ console.error("[shwfed-table] tree-combobox-single nodeChildren failed", e);
104
+ return void 0;
105
+ }
106
+ if (v == null) return void 0;
107
+ if (!Array.isArray(v)) return void 0;
108
+ return v;
109
+ }
110
+ function safeInterpolate(tpl, raw) {
111
+ try {
112
+ return interpolateMarkdown(tpl, $cel, nodeCtx(raw));
113
+ } catch (e) {
114
+ console.error("[shwfed-table] tree-combobox-single node interpolation failed", e);
115
+ return tpl;
116
+ }
117
+ }
118
+ function wrappedLabelText(w) {
119
+ const tpl = getLocalizedText(props.column.nodeLabel, locale.value) ?? "";
120
+ return tpl ? safeInterpolate(tpl, w.raw) : "";
121
+ }
122
+ function wrappedTooltipText(w) {
123
+ if (!props.column.nodeTooltip) return void 0;
124
+ const tpl = getLocalizedText(props.column.nodeTooltip, locale.value);
125
+ return tpl ? safeInterpolate(tpl, w.raw) : void 0;
126
+ }
127
+ function wrappedKeywords(w) {
128
+ const expr = props.column.keywords;
129
+ if (!expr) return [];
130
+ let v;
131
+ try {
132
+ v = Effect.runSync($cel(expr, nodeCtx(w.raw)));
133
+ } catch (e) {
134
+ console.error("[shwfed-table] tree-combobox-single keywords failed", e);
135
+ return [];
136
+ }
137
+ if (!Array.isArray(v)) return [];
138
+ return v.filter((k) => k != null).map((k) => String(k).trim().toLowerCase()).filter((k) => k.length > 0);
139
+ }
140
+ function wrappedSelectable(w, _depth) {
141
+ if (isDisabled.value) return false;
142
+ const expr = props.column.nodeSelectable;
143
+ if (!expr) return true;
144
+ try {
145
+ return Effect.runSync($cel(expr, nodeCtx(w.raw)));
146
+ } catch {
147
+ return false;
148
+ }
149
+ }
150
+ const rawRoots = shallowRef([]);
151
+ const loading = ref(false);
152
+ const fetchError = ref(null);
153
+ async function fetchTree() {
154
+ const dataSource = props.column.dataSource;
155
+ if (!dataSource) {
156
+ rawRoots.value = [];
157
+ return;
158
+ }
159
+ const effect = Effect.gen(function* () {
160
+ let jsonOpt = Option.none();
161
+ if (dataSource.request) {
162
+ const builder = yield* $cel(dataSource.request, {
163
+ row: row.value,
164
+ index: rowIndex.value
165
+ });
166
+ const response = yield* builder.json();
167
+ jsonOpt = Option.some(response);
168
+ }
169
+ const dataRaw = yield* $cel(dataSource.data, {
170
+ row: row.value,
171
+ index: rowIndex.value,
172
+ json: jsonOpt
173
+ });
174
+ return Array.isArray(dataRaw) ? dataRaw : [];
175
+ });
176
+ const program = Effect.gen(function* () {
177
+ const showMaskFiber = yield* Effect.fork(
178
+ Effect.sync(() => {
179
+ loading.value = true;
180
+ }).pipe(Effect.delay("30 millis"))
181
+ );
182
+ return yield* Effect.ensuring(effect, Fiber.interrupt(showMaskFiber));
183
+ }).pipe(
184
+ Effect.ensuring(Effect.sync(() => {
185
+ loading.value = false;
186
+ }))
187
+ );
188
+ try {
189
+ const result = await Effect.runPromise(Effect.provide(program, sharedFetchLayer));
190
+ rawRoots.value = result;
191
+ fetchError.value = null;
192
+ } catch (e) {
193
+ console.warn("[shwfed-table] tree-combobox-single dataSource fetch failed", e);
194
+ fetchError.value = e;
195
+ }
196
+ }
197
+ watch(
198
+ () => [props.column.dataSource?.request, props.column.dataSource?.data],
199
+ () => {
200
+ void fetchTree();
201
+ },
202
+ { immediate: true }
203
+ );
204
+ const roots = computed(
205
+ () => wrapStructuralAll(rawRoots.value, {
206
+ nodeKey,
207
+ nodeChildren: nodeChildrenList
208
+ })
209
+ );
210
+ const triggerLabel = computed(() => {
211
+ const k = model.value;
212
+ if (!k) return "";
213
+ const path = findWrappedPath(roots.value, k);
214
+ if (!path || path.length === 0) return "";
215
+ const leaf = path[path.length - 1];
216
+ return wrappedLabelText(leaf);
217
+ });
218
+ const initialExpanded = computed(() => {
219
+ if (!props.column.expandAll) return [];
220
+ const out = [];
221
+ const stack = [...roots.value];
222
+ while (stack.length) {
223
+ const n = stack.pop();
224
+ if (n.kind === "branch") {
225
+ out.push(n.key);
226
+ stack.push(...n.children);
227
+ }
228
+ }
229
+ return out;
230
+ });
231
+ const filterQuery = ref("");
232
+ function filterPredicate(w, query) {
233
+ const q = query.trim().toLowerCase();
234
+ if (!q) return true;
235
+ if (wrappedLabelText(w).trim().toLowerCase().includes(q)) return true;
236
+ return wrappedKeywords(w).some((k) => k.includes(q));
237
+ }
238
+ const open = ref(false);
239
+ function handleUpdate(next) {
240
+ const k = typeof next === "string" ? next : void 0;
241
+ model.value = k;
242
+ if (k) open.value = false;
243
+ }
244
+ const showClear = computed(
245
+ () => !isDisabled.value && !loading.value && !!model.value
246
+ );
247
+ function handleClear() {
248
+ model.value = void 0;
249
+ open.value = false;
250
+ }
251
+ const hoveredKey = ref(null);
252
+ watch(open, (isOpen) => {
253
+ if (!isOpen) hoveredKey.value = null;
254
+ });
255
+ function collectTooltipNodes(out, siblings) {
256
+ for (const n of siblings) {
257
+ if (wrappedTooltipText(n)) out.push(n.key);
258
+ if (n.kind === "branch") collectTooltipNodes(out, n.children);
259
+ }
260
+ }
261
+ const anyHasTooltip = computed(() => {
262
+ if (!props.column.nodeTooltip) return false;
263
+ const out = [];
264
+ collectTooltipNodes(out, roots.value);
265
+ return out.length > 0;
266
+ });
267
+ const hoveredTooltip = computed(() => {
268
+ const k = hoveredKey.value;
269
+ if (!k) return void 0;
270
+ const path = findWrappedPath(roots.value, k);
271
+ if (!path || path.length === 0) return void 0;
272
+ return wrappedTooltipText(path[path.length - 1]);
273
+ });
274
+ </script>
275
+
276
+ <template>
277
+ <div class="p-[0.125rem] w-full">
278
+ <span
279
+ v-if="isHidden"
280
+ class="block h-7 w-full"
281
+ />
282
+ <span
283
+ v-else-if="effectiveReadonly"
284
+ class="flex items-center h-7 w-full px-2 text-[0.75rem] text-zinc-700 truncate"
285
+ >
286
+ {{ triggerLabel || "\u2014" }}
287
+ </span>
288
+ <Popover
289
+ v-else
290
+ v-model:open="open"
291
+ >
292
+ <PopoverAnchor as-child>
293
+ <InputGroup
294
+ class="group/tree-combobox-single h-7 rounded border-zinc-200/30 hover:border-zinc-200 focus-within:border-zinc-200 transition-colors ease-out duration-180"
295
+ :data-disabled="isDisabled ? 'true' : void 0"
296
+ >
297
+ <PopoverTrigger as-child>
298
+ <InputGroupInput
299
+ :model-value="triggerLabel"
300
+ :disabled="isDisabled"
301
+ :placeholder="placeholderText"
302
+ class="h-7 text-[0.75rem] md:text-[0.75rem] px-2 cursor-pointer text-left"
303
+ readonly
304
+ />
305
+ </PopoverTrigger>
306
+ <InputGroupAddon
307
+ v-if="loading"
308
+ align="inline-end"
309
+ data-slot="tree-combobox-single-loading"
310
+ class="text-zinc-400"
311
+ >
312
+ <Icon
313
+ icon="fluent:spinner-ios-20-regular"
314
+ class="size-3 animate-spin"
315
+ />
316
+ </InputGroupAddon>
317
+ <InputGroupAddon
318
+ v-else-if="showClear"
319
+ align="inline-end"
320
+ class="[@media(hover:hover)]:opacity-0 transition-opacity group-hover/tree-combobox-single:opacity-100 focus-within:opacity-100"
321
+ >
322
+ <InputGroupButton
323
+ size="icon-xs"
324
+ data-slot="tree-combobox-single-clear"
325
+ class="size-4 text-zinc-500 hover:text-zinc-700"
326
+ tabindex="-1"
327
+ @mousedown.prevent
328
+ @click.stop="handleClear"
329
+ >
330
+ <Icon
331
+ icon="fluent:dismiss-20-regular"
332
+ class="size-3"
333
+ />
334
+ </InputGroupButton>
335
+ </InputGroupAddon>
336
+ </InputGroup>
337
+ </PopoverAnchor>
338
+ <PopoverContent
339
+ class="p-0"
340
+ :style="{ width: 'var(--reka-popover-trigger-width)' }"
341
+ >
342
+ <div
343
+ data-slot="tree-combobox-single-search"
344
+ class="flex h-7 items-center gap-2 border-b border-zinc-200 px-2"
345
+ >
346
+ <Icon
347
+ icon="fluent:search-20-filled"
348
+ class="size-3 shrink-0 opacity-50"
349
+ />
350
+ <input
351
+ v-model="filterQuery"
352
+ :disabled="isDisabled"
353
+ :placeholder="t('tree-combobox-single-search-placeholder')"
354
+ class="flex h-7 w-full bg-transparent text-[0.75rem] outline-hidden placeholder:text-zinc-500 disabled:cursor-not-allowed disabled:opacity-50"
355
+ >
356
+ </div>
357
+ <div class="flex flex-col p-1">
358
+ <div
359
+ v-if="fetchError && roots.length === 0"
360
+ class="min-h-7 px-2 py-1 text-[0.75rem] text-red-500"
361
+ >
362
+ {{ t("tree-combobox-single-load-error") }}
363
+ </div>
364
+ <div
365
+ v-else-if="loading && roots.length === 0"
366
+ class="flex flex-col gap-1 px-2 py-1"
367
+ aria-busy="true"
368
+ >
369
+ <Skeleton class="h-4 w-2/3" />
370
+ <Skeleton class="h-4 w-1/2" />
371
+ <Skeleton class="h-4 w-3/5" />
372
+ </div>
373
+
374
+ <UiTree
375
+ v-else
376
+ :roots="roots"
377
+ :get-key="(w) => w.key"
378
+ :get-children="getWrappedChildren"
379
+ selection-mode="single"
380
+ :model-value="model"
381
+ :selectable="wrappedSelectable"
382
+ :filter-predicate="filterPredicate"
383
+ :filter-query="filterQuery"
384
+ :initial-expanded="initialExpanded"
385
+ :show-focused-row="false"
386
+ :class="isDisabled ? 'pointer-events-none opacity-60' : void 0"
387
+ class="max-h-72 overflow-y-auto"
388
+ @update:model-value="handleUpdate"
389
+ >
390
+ <template #node="{ node, selected }">
391
+ <span
392
+ class="flex flex-1 min-w-0 items-center justify-between gap-2"
393
+ @mouseenter="hoveredKey = node.key"
394
+ @focusin="hoveredKey = node.key"
395
+ >
396
+ <Markdown
397
+ :source="wrappedLabelText(node)"
398
+ class="prose prose-xs prose-zinc text-zinc-700 min-w-0"
399
+ />
400
+ <Icon
401
+ v-if="selected"
402
+ icon="fluent:checkmark-20-regular"
403
+ class="size-3 shrink-0 text-zinc-700"
404
+ />
405
+ </span>
406
+ </template>
407
+
408
+ <template #empty>
409
+ <div class="min-h-7 px-2 py-1 text-[0.75rem] text-zinc-400">
410
+ {{ t("tree-combobox-single-empty") }}
411
+ </div>
412
+ </template>
413
+
414
+ <template #error="{ error, retry }">
415
+ <span class="inline-flex items-center gap-1 text-xs text-red-500">
416
+ {{ t("tree-combobox-single-load-error") }}
417
+ <button
418
+ type="button"
419
+ class="underline hover:text-red-600"
420
+ @click.stop="retry"
421
+ >
422
+ {{ t("tree-combobox-single-retry") }}
423
+ </button>
424
+ <span class="sr-only">{{ String(error) }}</span>
425
+ </span>
426
+ </template>
427
+ </UiTree>
428
+ </div>
429
+ <div
430
+ v-if="anyHasTooltip && hoveredTooltip"
431
+ data-slot="tree-combobox-single-tooltip"
432
+ class="border-t border-zinc-200 px-2 py-1.5"
433
+ >
434
+ <Markdown
435
+ :source="hoveredTooltip"
436
+ block
437
+ class="prose prose-xs prose-zinc"
438
+ />
439
+ </div>
440
+ </PopoverContent>
441
+ </Popover>
442
+ </div>
443
+ </template>
@@ -0,0 +1,9 @@
1
+ import type { CellContext } from '@tanstack/vue-table';
2
+ import type { Value } from './schema.js';
3
+ type __VLS_Props = {
4
+ column: Value;
5
+ ctx: CellContext<unknown, unknown>;
6
+ };
7
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
8
+ declare const _default: typeof __VLS_export;
9
+ export default _default;
@@ -0,0 +1,90 @@
1
+ import { Schema } from 'effect';
2
+ import type { ColumnDef } from '@tanstack/vue-table';
3
+ import type { Environment } from '../../../../../vendor/cel-js/lib/index.js';
4
+ import type { ColumnDefDeps, MigrateFn, MigrateSource } from '../../../utils/resolve.js';
5
+ export declare const type: "com.shwfed.table.column.tree-combobox-single";
6
+ export declare const compatibilityDate: "2026-05-28";
7
+ export declare const metadata: {
8
+ readonly name: "下拉树(单选)";
9
+ readonly icon: "fluent:tree-evergreen-20-regular";
10
+ };
11
+ export declare function schema(configure: (env: Environment) => void): Schema.Struct<{
12
+ placeholder: Schema.optional<Schema.TupleType<readonly [Schema.Struct<{
13
+ locale: Schema.Literal<["zh"]>;
14
+ message: Schema.SchemaClass<string, string, never>;
15
+ }>], [Schema.Struct<{
16
+ locale: Schema.Literal<["ja", "en", "ko"]>;
17
+ message: Schema.SchemaClass<string, string, never>;
18
+ }>]>>;
19
+ hidden: Schema.optional<Schema.Schema<string, string, never>>;
20
+ disabled: Schema.optional<Schema.Schema<string, string, never>>;
21
+ readonly: Schema.optional<Schema.Schema<string, string, never>>;
22
+ derived: Schema.optional<Schema.Struct<{
23
+ mode: Schema.Literal<["formula", "prefill"]>;
24
+ expression: Schema.Schema<string, string, never>;
25
+ }>>;
26
+ dataSource: Schema.Struct<{
27
+ request: Schema.optional<Schema.Schema<string, string, never>>;
28
+ data: Schema.Schema<string, string, never>;
29
+ }>;
30
+ nodeKey: Schema.Schema<string, string, never>;
31
+ nodeChildren: Schema.Schema<string, string, never>;
32
+ nodeLabel: Schema.refine<readonly [{
33
+ readonly locale: "zh";
34
+ readonly message: string;
35
+ }, ...{
36
+ readonly locale: "en" | "ja" | "ko";
37
+ readonly message: string;
38
+ }[]], Schema.TupleType<readonly [Schema.Struct<{
39
+ locale: Schema.Literal<["zh"]>;
40
+ message: Schema.SchemaClass<string, string, never>;
41
+ }>], [Schema.Struct<{
42
+ locale: Schema.Literal<["ja", "en", "ko"]>;
43
+ message: Schema.SchemaClass<string, string, never>;
44
+ }>]>>;
45
+ nodeTooltip: Schema.optional<Schema.refine<readonly [{
46
+ readonly locale: "zh";
47
+ readonly message: string;
48
+ }, ...{
49
+ readonly locale: "en" | "ja" | "ko";
50
+ readonly message: string;
51
+ }[]], Schema.TupleType<readonly [Schema.Struct<{
52
+ locale: Schema.Literal<["zh"]>;
53
+ message: Schema.SchemaClass<string, string, never>;
54
+ }>], [Schema.Struct<{
55
+ locale: Schema.Literal<["ja", "en", "ko"]>;
56
+ message: Schema.SchemaClass<string, string, never>;
57
+ }>]>>>;
58
+ keywords: Schema.optional<Schema.Schema<string, string, never>>;
59
+ nodeSelectable: Schema.optional<Schema.Schema<string, string, never>>;
60
+ expandAll: Schema.optionalWith<typeof Schema.Boolean, {
61
+ default: () => false;
62
+ }>;
63
+ title: Schema.TupleType<readonly [Schema.Struct<{
64
+ locale: Schema.Literal<["zh"]>;
65
+ message: Schema.SchemaClass<string, string, never>;
66
+ }>], [Schema.Struct<{
67
+ locale: Schema.Literal<["ja", "en", "ko"]>;
68
+ message: Schema.SchemaClass<string, string, never>;
69
+ }>]>;
70
+ binding: Schema.refine<string, typeof Schema.String>;
71
+ enableSorting: Schema.optional<Schema.SchemaClass<boolean, boolean, never>>;
72
+ size: Schema.optional<Schema.refine<number, Schema.filter<typeof Schema.Number>>>;
73
+ grow: Schema.optional<Schema.SchemaClass<boolean, boolean, never>>;
74
+ tooltip: Schema.optional<Schema.TupleType<readonly [Schema.Struct<{
75
+ locale: Schema.Literal<["zh"]>;
76
+ message: Schema.SchemaClass<string, string, never>;
77
+ }>], [Schema.Struct<{
78
+ locale: Schema.Literal<["ja", "en", "ko"]>;
79
+ message: Schema.SchemaClass<string, string, never>;
80
+ }>]>>;
81
+ id: Schema.refine<string, typeof Schema.String>;
82
+ groupId: Schema.optional<typeof Schema.UUID>;
83
+ type: Schema.Literal<["com.shwfed.table.column.tree-combobox-single"]>;
84
+ compatibilityDate: Schema.Literal<["2026-05-28"]>;
85
+ }>;
86
+ export type Value = Schema.Schema.Type<ReturnType<typeof schema>>;
87
+ export declare function defaults(): Partial<Value>;
88
+ export declare const migrateFrom: ReadonlyArray<MigrateSource>;
89
+ export declare const migrate: MigrateFn;
90
+ export declare function toColumnDef(value: Value, { getLocaleText }: ColumnDefDeps): Partial<ColumnDef<unknown, unknown>>;