@shwfed/config 2.9.13 → 2.10.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.
- package/dist/mcp.mjs +1553 -1112
- package/dist/module.json +1 -1
- package/dist/preview/assets/{FieldGroup.vue_vue_type_script_setup_true_lang-DZ_H-YRf.js → FieldGroup.vue_vue_type_script_setup_true_lang-CCaOWk_7.js} +1 -1
- package/dist/preview/assets/{badge-DoNuZh0A.js → badge-D9_7atSJ.js} +1 -1
- package/dist/preview/assets/{config-DTEJOYqA.js → config-B2d8SiPi.js} +1 -1
- package/dist/preview/assets/{config-D4rFsdGO.js → config-BLEovXei.js} +1 -1
- package/dist/preview/assets/{config-BrNZsgV0.js → config-Bf5Vckj3.js} +1 -1
- package/dist/preview/assets/{config-ugF_BOWz.js → config-Bk2VSNeu.js} +1 -1
- package/dist/preview/assets/{config-Cla0Qngs.js → config-C8lCItmz.js} +1 -1
- package/dist/preview/assets/{config-BDDuqAht.js → config-C9WPOoA7.js} +1 -1
- package/dist/preview/assets/{config-YGBoSq6x.js → config-CNKb25Qo.js} +1 -1
- package/dist/preview/assets/{config-CLsjWZz2.js → config-CQrqVV1U.js} +1 -1
- package/dist/preview/assets/{config-CIYui2J_.js → config-DWA385pD.js} +1 -1
- package/dist/preview/assets/{config-C6Cm7DWx.js → config-DYxMKhCU.js} +1 -1
- package/dist/preview/assets/{config-Bhc_Vu67.js → config-DZlaJUlF.js} +1 -1
- package/dist/preview/assets/{config-tdZMdIN3.js → config-DyPl6K2G.js} +1 -1
- package/dist/preview/assets/{definition.vue_vue_type_script_setup_true_lang-CgNXv26P.js → definition.vue_vue_type_script_setup_true_lang-CFzQ7icU.js} +1 -1
- package/dist/preview/assets/index-7BE56IYF.js +739 -0
- package/dist/preview/assets/{index-CzzwZ7bp.css → index-BnJ5p1Mx.css} +1 -1
- package/dist/preview/assets/index-Bwv0Yz_L.js +1 -0
- package/dist/preview/assets/{index-C3FdepLE.js → index-CXOEVGFP.js} +1 -1
- package/dist/preview/assets/{item-DecwNzYq.js → item-DCVX69_o.js} +1 -1
- package/dist/preview/assets/{runtime-C3dmOj9s.js → runtime-BD1A-g1h.js} +1 -1
- package/dist/preview/assets/{runtime-C8Ufkmiw.js → runtime-BNk4EliL.js} +1 -1
- package/dist/preview/assets/{runtime-BK7KNEyN.js → runtime-BO-KY3T_.js} +1 -1
- package/dist/preview/assets/{runtime-DZ_AwduQ.js → runtime-BsNSI1XP.js} +1 -1
- package/dist/preview/assets/{runtime-blb90Fhv.js → runtime-Cbc5NH57.js} +1 -1
- package/dist/preview/assets/{runtime-CYpXd7Pq.js → runtime-DEWGIyvr.js} +1 -1
- package/dist/preview/assets/{runtime-CjPtRd-T.js → runtime-DJ9ElxWB.js} +1 -1
- package/dist/preview/assets/{runtime-C5hqSHRW.js → runtime-DSfMvph3.js} +1 -1
- package/dist/preview/assets/{runtime-DSUjc0Pk.js → runtime-O6MNC3GA.js} +1 -1
- package/dist/preview/assets/{runtime-DtP98Km5.js → runtime-r1wbrr4k.js} +1 -1
- package/dist/preview/assets/{schema-meta-DWUHNP8E.js → schema-meta-ovcuERKg.js} +1 -1
- package/dist/preview/index.html +2 -2
- package/dist/runtime/components/actions/components/triggers-field.vue +12 -12
- package/dist/runtime/components/config/use-editor.js +1 -1
- package/dist/runtime/components/config/utils/validation-error.d.ts +1 -1
- package/dist/runtime/components/config/utils/validation-error.js +40 -7
- package/dist/runtime/components/form/fields/2026-04-22/com.shwfed.form.field.markdown/runtime.vue +3 -3
- package/dist/runtime/components/form/fields/2026-04-22/com.shwfed.form.field.text/runtime.vue +6 -5
- package/dist/runtime/components/form/fields/2026-04-22/com.shwfed.form.field.textarea/runtime.vue +6 -5
- package/dist/runtime/components/form/fields/2026-04-24/com.shwfed.form.field.combobox.single/runtime.vue +10 -8
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.date/runtime.vue +8 -6
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.daterange/runtime.vue +10 -8
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.datetime/runtime.vue +8 -6
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.datetimerange/runtime.vue +10 -8
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.time/runtime.vue +7 -5
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.timerange/runtime.vue +8 -6
- package/dist/runtime/components/form/fields/2026-04-28/com.shwfed.form.field.number/runtime.vue +7 -6
- package/dist/runtime/components/form/fields/2026-04-28/com.shwfed.form.field.numberrange/runtime.vue +9 -7
- package/dist/runtime/components/form/fields/2026-04-28/com.shwfed.form.field.switch/runtime.vue +4 -3
- package/dist/runtime/components/form/fields/2026-04-29/com.shwfed.form.field.combobox.single/runtime.vue +8 -6
- package/dist/runtime/components/form/fields/2026-05-12/com.shwfed.form.field.upload/runtime.vue +5 -4
- package/dist/runtime/components/form/fields/2026-05-13/com.shwfed.form.field.combobox.single.remote/runtime.vue +12 -10
- package/dist/runtime/components/form/fields/2026-05-13/com.shwfed.form.field.list/runtime.vue +5 -4
- package/dist/runtime/components/form/fields/2026-05-17/com.shwfed.form.field.checkbox.group/runtime.vue +9 -7
- package/dist/runtime/components/form/fields/2026-05-17/com.shwfed.form.field.radio.group/runtime.vue +9 -7
- package/dist/runtime/components/form/fields/2026-05-23/com.shwfed.form.field.tree.multi/runtime.vue +13 -15
- package/dist/runtime/components/form/fields/2026-05-24/com.shwfed.form.field.month/runtime.vue +8 -6
- package/dist/runtime/components/form/fields/2026-05-24/com.shwfed.form.field.monthrange/runtime.vue +10 -8
- package/dist/runtime/components/form/fields/2026-05-25/com.shwfed.form.field.combobox.multi/runtime.vue +10 -8
- package/dist/runtime/components/form/fields/2026-05-26/com.shwfed.form.field.tree.combobox.multi/runtime.vue +13 -14
- package/dist/runtime/components/form/fields/2026-05-26/com.shwfed.form.field.tree.combobox.single/runtime.vue +13 -14
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.combobox.multi/runtime.vue +14 -12
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.combobox.single/runtime.vue +14 -12
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.combobox.multi/runtime.vue +13 -14
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.combobox.single/runtime.vue +13 -14
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.multi/runtime.vue +13 -15
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.single/runtime.vue +15 -16
- package/dist/runtime/components/form/fields/2026-06-09/com.shwfed.form.field.upload/runtime.vue +8 -7
- package/dist/runtime/components/form/fields/2026-06-14/com.shwfed.form.field.combobox.multi/config.d.vue.ts +175 -0
- package/dist/runtime/components/form/fields/2026-06-14/com.shwfed.form.field.combobox.multi/config.vue +782 -0
- package/dist/runtime/components/form/fields/2026-06-14/com.shwfed.form.field.combobox.multi/config.vue.d.ts +175 -0
- package/dist/runtime/components/form/fields/2026-06-14/com.shwfed.form.field.combobox.multi/runtime.d.vue.ts +8 -0
- package/dist/runtime/components/form/fields/2026-06-14/com.shwfed.form.field.combobox.multi/runtime.vue +413 -0
- package/dist/runtime/components/form/fields/2026-06-14/com.shwfed.form.field.combobox.multi/runtime.vue.d.ts +8 -0
- package/dist/runtime/components/form/fields/2026-06-14/com.shwfed.form.field.combobox.multi/schema.d.ts +214 -0
- package/dist/runtime/components/form/fields/2026-06-14/com.shwfed.form.field.combobox.multi/schema.js +191 -0
- package/dist/runtime/components/form/fields/2026-06-14/com.shwfed.form.field.combobox.single/config.d.vue.ts +175 -0
- package/dist/runtime/components/form/fields/2026-06-14/com.shwfed.form.field.combobox.single/config.vue +782 -0
- package/dist/runtime/components/form/fields/2026-06-14/com.shwfed.form.field.combobox.single/config.vue.d.ts +175 -0
- package/dist/runtime/components/form/fields/2026-06-14/com.shwfed.form.field.combobox.single/runtime.d.vue.ts +8 -0
- package/dist/runtime/components/form/fields/2026-06-14/com.shwfed.form.field.combobox.single/runtime.vue +426 -0
- package/dist/runtime/components/form/fields/2026-06-14/com.shwfed.form.field.combobox.single/runtime.vue.d.ts +8 -0
- package/dist/runtime/components/form/fields/2026-06-14/com.shwfed.form.field.combobox.single/schema.d.ts +214 -0
- package/dist/runtime/components/form/fields/2026-06-14/com.shwfed.form.field.combobox.single/schema.js +191 -0
- package/dist/runtime/components/form/fields/2026-06-14/combobox-migrate.d.ts +18 -0
- package/dist/runtime/components/form/fields/2026-06-14/combobox-migrate.js +36 -0
- package/dist/runtime/components/form/utils/state.d.ts +11 -0
- package/dist/runtime/components/form/utils/state.js +5 -0
- package/dist/runtime/components/ui/input-group/InputGroupNumberField.vue +1 -1
- package/dist/runtime/share/expression.js +1 -0
- package/package.json +1 -1
- package/dist/preview/assets/index-B-QhiviS.js +0 -1
- package/dist/preview/assets/index-CWMhB7z4.js +0 -735
package/dist/runtime/components/form/fields/2026-05-17/com.shwfed.form.field.radio.group/runtime.vue
CHANGED
|
@@ -11,7 +11,7 @@ import { Field, FieldLabel, FieldMessages } from "../../../../ui/field";
|
|
|
11
11
|
import { Markdown } from "../../../../ui/markdown";
|
|
12
12
|
import { useFieldValidation } from "../../../utils/validation";
|
|
13
13
|
import { useFormReadonly } from "../../../utils/readonly";
|
|
14
|
-
import { useFormState } from "../../../utils/state";
|
|
14
|
+
import { useFormScope, useFormState } from "../../../utils/state";
|
|
15
15
|
defineOptions({ name: "ShwfedRadioGroupFieldRuntime" });
|
|
16
16
|
const props = defineProps({
|
|
17
17
|
fieldId: { type: String, required: true },
|
|
@@ -25,7 +25,8 @@ const { locale, t } = useI18n({
|
|
|
25
25
|
ja: { "radio-group-empty": "\u9078\u629E\u80A2\u306A\u3057" }
|
|
26
26
|
}
|
|
27
27
|
});
|
|
28
|
-
const {
|
|
28
|
+
const { getAt, setAt } = useFormState();
|
|
29
|
+
const formScope = useFormScope();
|
|
29
30
|
const inherited = injectCELContext();
|
|
30
31
|
const $cel = (expression, context) => _rawCel(expression, { ...celBindings(inherited), ...context });
|
|
31
32
|
const labelText = computed(() => getLocalizedText(props.config.label, locale.value));
|
|
@@ -35,7 +36,7 @@ const tooltipText = computed(
|
|
|
35
36
|
function evalBool(expression, label) {
|
|
36
37
|
if (!expression) return false;
|
|
37
38
|
try {
|
|
38
|
-
return Effect.runSync($cel(expression, { form: state.value ?? {} }));
|
|
39
|
+
return Effect.runSync($cel(expression, { form: formScope.state.value ?? {} }));
|
|
39
40
|
} catch (err) {
|
|
40
41
|
console.error(`[shwfed-form] failed to evaluate ${label} for ${props.fieldId}:`, err);
|
|
41
42
|
return false;
|
|
@@ -65,7 +66,7 @@ const entries = computed(
|
|
|
65
66
|
() => (props.config.items ?? []).map((item) => {
|
|
66
67
|
const labelTpl = getLocalizedText(item.label, locale.value) ?? "";
|
|
67
68
|
const tooltipTpl = item.tooltip ? getLocalizedText(item.tooltip, locale.value) : void 0;
|
|
68
|
-
const ctx = { form: state.value ?? {} };
|
|
69
|
+
const ctx = { form: formScope.state.value ?? {} };
|
|
69
70
|
return {
|
|
70
71
|
key: item.id,
|
|
71
72
|
value: item.value.value,
|
|
@@ -96,7 +97,7 @@ function onSelect(next) {
|
|
|
96
97
|
}
|
|
97
98
|
const readonlyText = computed(() => {
|
|
98
99
|
const selected = entries.value.find((e) => e.value === model.value);
|
|
99
|
-
return selected?.label ||
|
|
100
|
+
return selected?.label || null;
|
|
100
101
|
});
|
|
101
102
|
</script>
|
|
102
103
|
|
|
@@ -126,9 +127,10 @@ const readonlyText = computed(() => {
|
|
|
126
127
|
</FieldLabel>
|
|
127
128
|
<div
|
|
128
129
|
v-if="effectiveReadonly"
|
|
129
|
-
class="min-h-9 py-1.5 text-sm
|
|
130
|
+
class="min-h-9 py-1.5 text-sm"
|
|
131
|
+
:class="readonlyText ? 'text-zinc-700' : 'font-mono text-zinc-300 select-none'"
|
|
130
132
|
>
|
|
131
|
-
{{ readonlyText }}
|
|
133
|
+
{{ readonlyText || "-" }}
|
|
132
134
|
</div>
|
|
133
135
|
<div
|
|
134
136
|
v-else-if="entries.length === 0"
|
package/dist/runtime/components/form/fields/2026-05-23/com.shwfed.form.field.tree.multi/runtime.vue
CHANGED
|
@@ -15,7 +15,7 @@ import { Skeleton } from "../../../../ui/skeleton";
|
|
|
15
15
|
import { Tree as UiTree } from "../../../../ui/tree";
|
|
16
16
|
import { interpolateMarkdown } from "../../../../table/utils/runtime";
|
|
17
17
|
import { useFormReadonly } from "../../../utils/readonly";
|
|
18
|
-
import { useFormState } from "../../../utils/state";
|
|
18
|
+
import { useFormScope, useFormState } from "../../../utils/state";
|
|
19
19
|
defineOptions({ name: "ShwfedTreeMultiFieldRuntime" });
|
|
20
20
|
const props = defineProps({
|
|
21
21
|
fieldId: { type: String, required: true },
|
|
@@ -29,7 +29,6 @@ const { locale, t } = useI18n({
|
|
|
29
29
|
"tree-multi-search-clear": "\u6E05\u9664\u641C\u7D22",
|
|
30
30
|
"tree-multi-load-error": "\u52A0\u8F7D\u5931\u8D25",
|
|
31
31
|
"tree-multi-empty": "\u65E0\u53EF\u9009\u9879",
|
|
32
|
-
"tree-multi-readonly-empty": "\u2014",
|
|
33
32
|
"tree-multi-readonly-separator": "\u3001"
|
|
34
33
|
},
|
|
35
34
|
en: {
|
|
@@ -37,7 +36,6 @@ const { locale, t } = useI18n({
|
|
|
37
36
|
"tree-multi-search-clear": "Clear search",
|
|
38
37
|
"tree-multi-load-error": "Failed to load",
|
|
39
38
|
"tree-multi-empty": "No options",
|
|
40
|
-
"tree-multi-readonly-empty": "\u2014",
|
|
41
39
|
"tree-multi-readonly-separator": ", "
|
|
42
40
|
},
|
|
43
41
|
ja: {
|
|
@@ -45,12 +43,12 @@ const { locale, t } = useI18n({
|
|
|
45
43
|
"tree-multi-search-clear": "\u691C\u7D22\u3092\u30AF\u30EA\u30A2",
|
|
46
44
|
"tree-multi-load-error": "\u8AAD\u307F\u8FBC\u307F\u306B\u5931\u6557\u3057\u307E\u3057\u305F",
|
|
47
45
|
"tree-multi-empty": "\u9078\u629E\u80A2\u306A\u3057",
|
|
48
|
-
"tree-multi-readonly-empty": "\u2014",
|
|
49
46
|
"tree-multi-readonly-separator": "\u3001"
|
|
50
47
|
}
|
|
51
48
|
}
|
|
52
49
|
});
|
|
53
|
-
const {
|
|
50
|
+
const { getAt, setAt } = useFormState();
|
|
51
|
+
const formScope = useFormScope();
|
|
54
52
|
const inherited = injectCELContext();
|
|
55
53
|
const $cel = (expression, context) => _rawCel(expression, { ...celBindings(inherited), ...context });
|
|
56
54
|
const labelText = computed(() => getLocalizedText(props.config.label, locale.value));
|
|
@@ -60,7 +58,7 @@ const tooltipText = computed(
|
|
|
60
58
|
function evalBool(expression, label) {
|
|
61
59
|
if (!expression) return false;
|
|
62
60
|
try {
|
|
63
|
-
return Effect.runSync($cel(expression, { form: state.value ?? {} }));
|
|
61
|
+
return Effect.runSync($cel(expression, { form: formScope.state.value ?? {} }));
|
|
64
62
|
} catch (err) {
|
|
65
63
|
console.error(`[shwfed-form] failed to evaluate ${label} for ${props.fieldId}:`, err);
|
|
66
64
|
return false;
|
|
@@ -102,11 +100,11 @@ async function fetchTree() {
|
|
|
102
100
|
let jsonOpt = Option.none();
|
|
103
101
|
if (dataSource.request) {
|
|
104
102
|
jsonOpt = yield* fetchJsonOption(yield* $cel(dataSource.request, {
|
|
105
|
-
form: state.value ?? {}
|
|
103
|
+
form: formScope.state.value ?? {}
|
|
106
104
|
}));
|
|
107
105
|
}
|
|
108
106
|
const dataRaw = yield* $cel(dataSource.data, {
|
|
109
|
-
form: state.value ?? {},
|
|
107
|
+
form: formScope.state.value ?? {},
|
|
110
108
|
json: jsonOpt
|
|
111
109
|
});
|
|
112
110
|
return Array.isArray(dataRaw) ? dataRaw : [];
|
|
@@ -140,7 +138,7 @@ watch(
|
|
|
140
138
|
{ immediate: true }
|
|
141
139
|
);
|
|
142
140
|
function nodeCtx(node) {
|
|
143
|
-
return { form: state.value ?? {}, node };
|
|
141
|
+
return { form: formScope.state.value ?? {}, node };
|
|
144
142
|
}
|
|
145
143
|
function getKey(node) {
|
|
146
144
|
try {
|
|
@@ -177,7 +175,7 @@ function nodeSelectable(node, _depth) {
|
|
|
177
175
|
}
|
|
178
176
|
function safeInterpolate(tpl, node) {
|
|
179
177
|
try {
|
|
180
|
-
return interpolateMarkdown(tpl, $cel, { form: state.value ?? {}, node });
|
|
178
|
+
return interpolateMarkdown(tpl, $cel, { form: formScope.state.value ?? {}, node });
|
|
181
179
|
} catch (err) {
|
|
182
180
|
console.error(`[shwfed-form] failed to interpolate node text for ${props.fieldId}:`, err);
|
|
183
181
|
return tpl;
|
|
@@ -256,8 +254,7 @@ const filterLabelText = computed(() => {
|
|
|
256
254
|
});
|
|
257
255
|
const readonlyText = computed(() => {
|
|
258
256
|
const selected = new Set(model.value);
|
|
259
|
-
|
|
260
|
-
if (selected.size === 0) return empty;
|
|
257
|
+
if (selected.size === 0) return null;
|
|
261
258
|
const found = /* @__PURE__ */ new Map();
|
|
262
259
|
const stack = [...roots.value];
|
|
263
260
|
while (stack.length) {
|
|
@@ -268,7 +265,7 @@ const readonlyText = computed(() => {
|
|
|
268
265
|
if (kids && kids.length) stack.push(...kids);
|
|
269
266
|
}
|
|
270
267
|
const labels = model.value.map((id) => found.get(id) ?? id).filter((l) => l.length > 0);
|
|
271
|
-
return labels.length > 0 ? labels.join(t("tree-multi-readonly-separator")) :
|
|
268
|
+
return labels.length > 0 ? labels.join(t("tree-multi-readonly-separator")) : null;
|
|
272
269
|
});
|
|
273
270
|
</script>
|
|
274
271
|
|
|
@@ -295,9 +292,10 @@ const readonlyText = computed(() => {
|
|
|
295
292
|
|
|
296
293
|
<div
|
|
297
294
|
v-if="effectiveReadonly"
|
|
298
|
-
class="min-h-9 py-1.5 text-sm
|
|
295
|
+
class="min-h-9 py-1.5 text-sm"
|
|
296
|
+
:class="readonlyText ? 'text-zinc-700' : 'font-mono text-zinc-300 select-none'"
|
|
299
297
|
>
|
|
300
|
-
{{ readonlyText }}
|
|
298
|
+
{{ readonlyText || "-" }}
|
|
301
299
|
</div>
|
|
302
300
|
|
|
303
301
|
<template v-else>
|
package/dist/runtime/components/form/fields/2026-05-24/com.shwfed.form.field.month/runtime.vue
CHANGED
|
@@ -12,14 +12,15 @@ import { Markdown } from "../../../../ui/markdown";
|
|
|
12
12
|
import { DEFAULT_FIELD_ORIENTATION } from "../../../utils/common";
|
|
13
13
|
import { useFieldValidation } from "../../../utils/validation";
|
|
14
14
|
import { useFormReadonly } from "../../../utils/readonly";
|
|
15
|
-
import { useFormState } from "../../../utils/state";
|
|
15
|
+
import { useFormScope, useFormState } from "../../../utils/state";
|
|
16
16
|
defineOptions({ name: "ShwfedMonthFieldRuntime" });
|
|
17
17
|
const props = defineProps({
|
|
18
18
|
fieldId: { type: String, required: true },
|
|
19
19
|
config: { type: null, required: true }
|
|
20
20
|
});
|
|
21
21
|
const { locale } = useI18n();
|
|
22
|
-
const {
|
|
22
|
+
const { getAt, setAt } = useFormState();
|
|
23
|
+
const formScope = useFormScope();
|
|
23
24
|
const inherited = injectCELContext();
|
|
24
25
|
const $cel = (expression, context) => _rawCel(expression, { ...celBindings(inherited), ...context });
|
|
25
26
|
const labelText = computed(() => getLocalizedText(props.config.label, locale.value));
|
|
@@ -32,7 +33,7 @@ const tooltipText = computed(
|
|
|
32
33
|
function evalBool(expression, label) {
|
|
33
34
|
if (!expression) return false;
|
|
34
35
|
try {
|
|
35
|
-
return Effect.runSync($cel(expression, { form: state.value ?? {} }));
|
|
36
|
+
return Effect.runSync($cel(expression, { form: formScope.state.value ?? {} }));
|
|
36
37
|
} catch (err) {
|
|
37
38
|
console.error(`[shwfed-form] failed to evaluate ${label} for ${props.fieldId}:`, err);
|
|
38
39
|
return false;
|
|
@@ -60,7 +61,7 @@ const shortcuts = computed(() => {
|
|
|
60
61
|
name: preset.label,
|
|
61
62
|
value: () => {
|
|
62
63
|
try {
|
|
63
|
-
const d = Effect.runSync($cel(preset.value, { form: state.value ?? {} }));
|
|
64
|
+
const d = Effect.runSync($cel(preset.value, { form: formScope.state.value ?? {} }));
|
|
64
65
|
return formatDate(d, resolvedValueFormat.value);
|
|
65
66
|
} catch (err) {
|
|
66
67
|
console.error(`[shwfed-form] failed to evaluate preset "${preset.value}" for ${props.fieldId}:`, err);
|
|
@@ -115,9 +116,10 @@ const model = computed({
|
|
|
115
116
|
</FieldLabel>
|
|
116
117
|
<div
|
|
117
118
|
v-if="effectiveReadonly"
|
|
118
|
-
class="min-h-9 py-1.5 text-sm
|
|
119
|
+
class="min-h-9 py-1.5 text-sm"
|
|
120
|
+
:class="model ? 'text-zinc-700' : 'font-mono text-zinc-300 select-none'"
|
|
119
121
|
>
|
|
120
|
-
{{ model || "
|
|
122
|
+
{{ model || "-" }}
|
|
121
123
|
</div>
|
|
122
124
|
<DatePicker
|
|
123
125
|
v-else
|
package/dist/runtime/components/form/fields/2026-05-24/com.shwfed.form.field.monthrange/runtime.vue
CHANGED
|
@@ -12,14 +12,15 @@ import { Markdown } from "../../../../ui/markdown";
|
|
|
12
12
|
import { DEFAULT_FIELD_ORIENTATION } from "../../../utils/common";
|
|
13
13
|
import { useFieldValidation } from "../../../utils/validation";
|
|
14
14
|
import { useFormReadonly } from "../../../utils/readonly";
|
|
15
|
-
import { useFormState } from "../../../utils/state";
|
|
15
|
+
import { useFormScope, useFormState } from "../../../utils/state";
|
|
16
16
|
defineOptions({ name: "ShwfedMonthRangeFieldRuntime" });
|
|
17
17
|
const props = defineProps({
|
|
18
18
|
fieldId: { type: String, required: true },
|
|
19
19
|
config: { type: null, required: true }
|
|
20
20
|
});
|
|
21
21
|
const { locale } = useI18n();
|
|
22
|
-
const {
|
|
22
|
+
const { getAt, setAt } = useFormState();
|
|
23
|
+
const formScope = useFormScope();
|
|
23
24
|
const inherited = injectCELContext();
|
|
24
25
|
const $cel = (expression, context) => _rawCel(expression, { ...celBindings(inherited), ...context });
|
|
25
26
|
const labelText = computed(() => getLocalizedText(props.config.label, locale.value));
|
|
@@ -35,7 +36,7 @@ const tooltipText = computed(
|
|
|
35
36
|
function evalBool(expression, label) {
|
|
36
37
|
if (!expression) return false;
|
|
37
38
|
try {
|
|
38
|
-
return Effect.runSync($cel(expression, { form: state.value ?? {} }));
|
|
39
|
+
return Effect.runSync($cel(expression, { form: formScope.state.value ?? {} }));
|
|
39
40
|
} catch (err) {
|
|
40
41
|
console.error(`[shwfed-form] failed to evaluate ${label} for ${props.fieldId}:`, err);
|
|
41
42
|
return false;
|
|
@@ -63,8 +64,8 @@ const shortcuts = computed(() => {
|
|
|
63
64
|
name: preset.label,
|
|
64
65
|
value: () => {
|
|
65
66
|
try {
|
|
66
|
-
const start = Effect.runSync($cel(preset.start, { form: state.value ?? {} }));
|
|
67
|
-
const end = Effect.runSync($cel(preset.end, { form: state.value ?? {} }));
|
|
67
|
+
const start = Effect.runSync($cel(preset.start, { form: formScope.state.value ?? {} }));
|
|
68
|
+
const end = Effect.runSync($cel(preset.end, { form: formScope.state.value ?? {} }));
|
|
68
69
|
return [
|
|
69
70
|
formatDate(start, resolvedValueFormat.value),
|
|
70
71
|
formatDate(end, resolvedValueFormat.value)
|
|
@@ -113,7 +114,7 @@ const model = computed({
|
|
|
113
114
|
});
|
|
114
115
|
const readonlyText = computed(() => {
|
|
115
116
|
const v = model.value;
|
|
116
|
-
if (!v) return
|
|
117
|
+
if (!v) return null;
|
|
117
118
|
return `${v[0]} ~ ${v[1]}`;
|
|
118
119
|
});
|
|
119
120
|
</script>
|
|
@@ -145,9 +146,10 @@ const readonlyText = computed(() => {
|
|
|
145
146
|
</FieldLabel>
|
|
146
147
|
<div
|
|
147
148
|
v-if="effectiveReadonly"
|
|
148
|
-
class="min-h-9 py-1.5 text-sm
|
|
149
|
+
class="min-h-9 py-1.5 text-sm"
|
|
150
|
+
:class="readonlyText ? 'text-zinc-700' : 'font-mono text-zinc-300 select-none'"
|
|
149
151
|
>
|
|
150
|
-
{{ readonlyText }}
|
|
152
|
+
{{ readonlyText || "-" }}
|
|
151
153
|
</div>
|
|
152
154
|
<DateRangePicker
|
|
153
155
|
v-else
|
|
@@ -21,7 +21,7 @@ import { Markdown } from "../../../../ui/markdown";
|
|
|
21
21
|
import { Popover, PopoverAnchor, PopoverContent, PopoverTrigger } from "../../../../ui/popover";
|
|
22
22
|
import { DEFAULT_FIELD_ORIENTATION } from "../../../utils/common";
|
|
23
23
|
import { useFormReadonly } from "../../../utils/readonly";
|
|
24
|
-
import { useFormState } from "../../../utils/state";
|
|
24
|
+
import { useFormScope, useFormState } from "../../../utils/state";
|
|
25
25
|
defineOptions({ name: "ShwfedComboboxMultiFieldRuntime" });
|
|
26
26
|
const props = defineProps({
|
|
27
27
|
fieldId: { type: String, required: true },
|
|
@@ -47,7 +47,8 @@ const { locale, t } = useI18n({
|
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
});
|
|
50
|
-
const {
|
|
50
|
+
const { getAt, setAt } = useFormState();
|
|
51
|
+
const formScope = useFormScope();
|
|
51
52
|
const inherited = injectCELContext();
|
|
52
53
|
const $cel = (expression, context) => _rawCel(expression, { ...celBindings(inherited), ...context });
|
|
53
54
|
const labelText = computed(() => getLocalizedText(props.config.label, locale.value));
|
|
@@ -60,7 +61,7 @@ const tooltipText = computed(
|
|
|
60
61
|
function evalBool(expression, label) {
|
|
61
62
|
if (!expression) return false;
|
|
62
63
|
try {
|
|
63
|
-
return Effect.runSync($cel(expression, { form: state.value ?? {} }));
|
|
64
|
+
return Effect.runSync($cel(expression, { form: formScope.state.value ?? {} }));
|
|
64
65
|
} catch (err) {
|
|
65
66
|
console.error(`[shwfed-form] failed to evaluate ${label} for ${props.fieldId}:`, err);
|
|
66
67
|
return false;
|
|
@@ -74,7 +75,7 @@ const isReadonly = computed(
|
|
|
74
75
|
const effectiveReadonly = computed(() => isReadonly.value || props.config.derived?.mode === "formula");
|
|
75
76
|
function valueOf(option) {
|
|
76
77
|
try {
|
|
77
|
-
return Effect.runSync($cel(props.config.optionValue, { form: state.value ?? {}, option }));
|
|
78
|
+
return Effect.runSync($cel(props.config.optionValue, { form: formScope.state.value ?? {}, option }));
|
|
78
79
|
} catch (err) {
|
|
79
80
|
console.error(`[shwfed-form] failed to evaluate optionValue for ${props.fieldId}:`, err);
|
|
80
81
|
return void 0;
|
|
@@ -83,12 +84,12 @@ function valueOf(option) {
|
|
|
83
84
|
function labelOf(option) {
|
|
84
85
|
const tpl = getLocalizedText(props.config.optionLabel, locale.value) ?? "";
|
|
85
86
|
if (!tpl) return "";
|
|
86
|
-
return interpolateMarkdown(tpl, $cel, { form: state.value ?? {}, option });
|
|
87
|
+
return interpolateMarkdown(tpl, $cel, { form: formScope.state.value ?? {}, option });
|
|
87
88
|
}
|
|
88
89
|
const entries = computed(() => {
|
|
89
90
|
let raw;
|
|
90
91
|
try {
|
|
91
|
-
raw = Effect.runSync($cel(props.config.options, { form: state.value ?? {} }));
|
|
92
|
+
raw = Effect.runSync($cel(props.config.options, { form: formScope.state.value ?? {} }));
|
|
92
93
|
} catch (err) {
|
|
93
94
|
console.error(`[shwfed-form] failed to evaluate options for ${props.fieldId}:`, err);
|
|
94
95
|
return [];
|
|
@@ -187,9 +188,10 @@ function handleClear() {
|
|
|
187
188
|
</FieldLabel>
|
|
188
189
|
<div
|
|
189
190
|
v-if="effectiveReadonly"
|
|
190
|
-
class="min-h-9 py-1.5 text-sm
|
|
191
|
+
class="min-h-9 py-1.5 text-sm"
|
|
192
|
+
:class="triggerLabel ? 'text-zinc-700' : 'font-mono text-zinc-300 select-none'"
|
|
191
193
|
>
|
|
192
|
-
{{ triggerLabel || "
|
|
194
|
+
{{ triggerLabel || "-" }}
|
|
193
195
|
</div>
|
|
194
196
|
<Popover
|
|
195
197
|
v-else
|
|
@@ -17,7 +17,7 @@ import { Tree as UiTree } from "../../../../ui/tree";
|
|
|
17
17
|
import { interpolateMarkdown } from "../../../../table/utils/runtime";
|
|
18
18
|
import { DEFAULT_FIELD_ORIENTATION } from "../../../utils/common";
|
|
19
19
|
import { useFormReadonly } from "../../../utils/readonly";
|
|
20
|
-
import { useFormState } from "../../../utils/state";
|
|
20
|
+
import { useFormScope, useFormState } from "../../../utils/state";
|
|
21
21
|
import {
|
|
22
22
|
findWrappedPath,
|
|
23
23
|
getWrappedChildren,
|
|
@@ -37,8 +37,7 @@ const { locale, t } = useI18n({
|
|
|
37
37
|
"tree-combobox-multi-search-clear": "\u6E05\u9664\u641C\u7D22",
|
|
38
38
|
"tree-combobox-multi-empty": "\u65E0\u53EF\u9009\u9879",
|
|
39
39
|
"tree-combobox-multi-load-error": "\u52A0\u8F7D\u5931\u8D25",
|
|
40
|
-
"tree-combobox-multi-retry": "\u91CD\u8BD5"
|
|
41
|
-
"tree-combobox-multi-readonly-empty": "\u2014"
|
|
40
|
+
"tree-combobox-multi-retry": "\u91CD\u8BD5"
|
|
42
41
|
},
|
|
43
42
|
en: {
|
|
44
43
|
"tree-combobox-multi-placeholder": "Select\u2026",
|
|
@@ -46,8 +45,7 @@ const { locale, t } = useI18n({
|
|
|
46
45
|
"tree-combobox-multi-search-clear": "Clear search",
|
|
47
46
|
"tree-combobox-multi-empty": "No options",
|
|
48
47
|
"tree-combobox-multi-load-error": "Failed to load",
|
|
49
|
-
"tree-combobox-multi-retry": "Retry"
|
|
50
|
-
"tree-combobox-multi-readonly-empty": "\u2014"
|
|
48
|
+
"tree-combobox-multi-retry": "Retry"
|
|
51
49
|
},
|
|
52
50
|
ja: {
|
|
53
51
|
"tree-combobox-multi-placeholder": "\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044",
|
|
@@ -55,12 +53,12 @@ const { locale, t } = useI18n({
|
|
|
55
53
|
"tree-combobox-multi-search-clear": "\u691C\u7D22\u3092\u30AF\u30EA\u30A2",
|
|
56
54
|
"tree-combobox-multi-empty": "\u9078\u629E\u80A2\u306A\u3057",
|
|
57
55
|
"tree-combobox-multi-load-error": "\u8AAD\u307F\u8FBC\u307F\u306B\u5931\u6557\u3057\u307E\u3057\u305F",
|
|
58
|
-
"tree-combobox-multi-retry": "\u518D\u8A66\u884C"
|
|
59
|
-
"tree-combobox-multi-readonly-empty": "\u2014"
|
|
56
|
+
"tree-combobox-multi-retry": "\u518D\u8A66\u884C"
|
|
60
57
|
}
|
|
61
58
|
}
|
|
62
59
|
});
|
|
63
|
-
const {
|
|
60
|
+
const { getAt, setAt } = useFormState();
|
|
61
|
+
const formScope = useFormScope();
|
|
64
62
|
const inherited = injectCELContext();
|
|
65
63
|
const $cel = (expression, context) => _rawCel(expression, { ...celBindings(inherited), ...context });
|
|
66
64
|
const labelText = computed(() => getLocalizedText(props.config.label, locale.value));
|
|
@@ -73,7 +71,7 @@ const placeholderText = computed(
|
|
|
73
71
|
function evalBool(expression, label) {
|
|
74
72
|
if (!expression) return false;
|
|
75
73
|
try {
|
|
76
|
-
return Effect.runSync($cel(expression, { form: state.value ?? {} }));
|
|
74
|
+
return Effect.runSync($cel(expression, { form: formScope.state.value ?? {} }));
|
|
77
75
|
} catch (err) {
|
|
78
76
|
console.error(`[shwfed-form] failed to evaluate ${label} for ${props.fieldId}:`, err);
|
|
79
77
|
return false;
|
|
@@ -103,7 +101,7 @@ const model = computed({
|
|
|
103
101
|
}
|
|
104
102
|
});
|
|
105
103
|
function nodeCtx(raw) {
|
|
106
|
-
return { form: state.value ?? {}, node: raw };
|
|
104
|
+
return { form: formScope.state.value ?? {}, node: raw };
|
|
107
105
|
}
|
|
108
106
|
function nodeKey(raw) {
|
|
109
107
|
try {
|
|
@@ -165,11 +163,11 @@ async function fetchTree() {
|
|
|
165
163
|
let jsonOpt = Option.none();
|
|
166
164
|
if (dataSource.request) {
|
|
167
165
|
jsonOpt = yield* fetchJsonOption(yield* $cel(dataSource.request, {
|
|
168
|
-
form: state.value ?? {}
|
|
166
|
+
form: formScope.state.value ?? {}
|
|
169
167
|
}));
|
|
170
168
|
}
|
|
171
169
|
const dataRaw = yield* $cel(dataSource.data, {
|
|
172
|
-
form: state.value ?? {},
|
|
170
|
+
form: formScope.state.value ?? {},
|
|
173
171
|
json: jsonOpt
|
|
174
172
|
});
|
|
175
173
|
return Array.isArray(dataRaw) ? dataRaw : [];
|
|
@@ -302,9 +300,10 @@ const hoveredTooltip = computed(() => {
|
|
|
302
300
|
|
|
303
301
|
<div
|
|
304
302
|
v-if="effectiveReadonly"
|
|
305
|
-
class="min-h-9 py-1.5 text-sm
|
|
303
|
+
class="min-h-9 py-1.5 text-sm"
|
|
304
|
+
:class="triggerLabel ? 'text-zinc-700' : 'font-mono text-zinc-300 select-none'"
|
|
306
305
|
>
|
|
307
|
-
{{ triggerLabel ||
|
|
306
|
+
{{ triggerLabel || "-" }}
|
|
308
307
|
</div>
|
|
309
308
|
|
|
310
309
|
<Popover
|
|
@@ -17,7 +17,7 @@ import { Tree as UiTree } from "../../../../ui/tree";
|
|
|
17
17
|
import { interpolateMarkdown } from "../../../../table/utils/runtime";
|
|
18
18
|
import { DEFAULT_FIELD_ORIENTATION } from "../../../utils/common";
|
|
19
19
|
import { useFormReadonly } from "../../../utils/readonly";
|
|
20
|
-
import { useFormState } from "../../../utils/state";
|
|
20
|
+
import { useFormScope, useFormState } from "../../../utils/state";
|
|
21
21
|
import {
|
|
22
22
|
findWrappedPath,
|
|
23
23
|
getWrappedChildren,
|
|
@@ -37,8 +37,7 @@ const { locale, t } = useI18n({
|
|
|
37
37
|
"tree-combobox-single-search-clear": "\u6E05\u9664\u641C\u7D22",
|
|
38
38
|
"tree-combobox-single-empty": "\u65E0\u53EF\u9009\u9879",
|
|
39
39
|
"tree-combobox-single-load-error": "\u52A0\u8F7D\u5931\u8D25",
|
|
40
|
-
"tree-combobox-single-retry": "\u91CD\u8BD5"
|
|
41
|
-
"tree-combobox-single-readonly-empty": "\u2014"
|
|
40
|
+
"tree-combobox-single-retry": "\u91CD\u8BD5"
|
|
42
41
|
},
|
|
43
42
|
en: {
|
|
44
43
|
"tree-combobox-single-placeholder": "Select\u2026",
|
|
@@ -46,8 +45,7 @@ const { locale, t } = useI18n({
|
|
|
46
45
|
"tree-combobox-single-search-clear": "Clear search",
|
|
47
46
|
"tree-combobox-single-empty": "No options",
|
|
48
47
|
"tree-combobox-single-load-error": "Failed to load",
|
|
49
|
-
"tree-combobox-single-retry": "Retry"
|
|
50
|
-
"tree-combobox-single-readonly-empty": "\u2014"
|
|
48
|
+
"tree-combobox-single-retry": "Retry"
|
|
51
49
|
},
|
|
52
50
|
ja: {
|
|
53
51
|
"tree-combobox-single-placeholder": "\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044",
|
|
@@ -55,12 +53,12 @@ const { locale, t } = useI18n({
|
|
|
55
53
|
"tree-combobox-single-search-clear": "\u691C\u7D22\u3092\u30AF\u30EA\u30A2",
|
|
56
54
|
"tree-combobox-single-empty": "\u9078\u629E\u80A2\u306A\u3057",
|
|
57
55
|
"tree-combobox-single-load-error": "\u8AAD\u307F\u8FBC\u307F\u306B\u5931\u6557\u3057\u307E\u3057\u305F",
|
|
58
|
-
"tree-combobox-single-retry": "\u518D\u8A66\u884C"
|
|
59
|
-
"tree-combobox-single-readonly-empty": "\u2014"
|
|
56
|
+
"tree-combobox-single-retry": "\u518D\u8A66\u884C"
|
|
60
57
|
}
|
|
61
58
|
}
|
|
62
59
|
});
|
|
63
|
-
const {
|
|
60
|
+
const { getAt, setAt } = useFormState();
|
|
61
|
+
const formScope = useFormScope();
|
|
64
62
|
const inherited = injectCELContext();
|
|
65
63
|
const $cel = (expression, context) => _rawCel(expression, { ...celBindings(inherited), ...context });
|
|
66
64
|
const labelText = computed(() => getLocalizedText(props.config.label, locale.value));
|
|
@@ -73,7 +71,7 @@ const placeholderText = computed(
|
|
|
73
71
|
function evalBool(expression, label) {
|
|
74
72
|
if (!expression) return false;
|
|
75
73
|
try {
|
|
76
|
-
return Effect.runSync($cel(expression, { form: state.value ?? {} }));
|
|
74
|
+
return Effect.runSync($cel(expression, { form: formScope.state.value ?? {} }));
|
|
77
75
|
} catch (err) {
|
|
78
76
|
console.error(`[shwfed-form] failed to evaluate ${label} for ${props.fieldId}:`, err);
|
|
79
77
|
return false;
|
|
@@ -104,7 +102,7 @@ const model = computed({
|
|
|
104
102
|
}
|
|
105
103
|
});
|
|
106
104
|
function nodeCtx(raw) {
|
|
107
|
-
return { form: state.value ?? {}, node: raw };
|
|
105
|
+
return { form: formScope.state.value ?? {}, node: raw };
|
|
108
106
|
}
|
|
109
107
|
function nodeKey(raw) {
|
|
110
108
|
try {
|
|
@@ -166,11 +164,11 @@ async function fetchTree() {
|
|
|
166
164
|
let jsonOpt = Option.none();
|
|
167
165
|
if (dataSource.request) {
|
|
168
166
|
jsonOpt = yield* fetchJsonOption(yield* $cel(dataSource.request, {
|
|
169
|
-
form: state.value ?? {}
|
|
167
|
+
form: formScope.state.value ?? {}
|
|
170
168
|
}));
|
|
171
169
|
}
|
|
172
170
|
const dataRaw = yield* $cel(dataSource.data, {
|
|
173
|
-
form: state.value ?? {},
|
|
171
|
+
form: formScope.state.value ?? {},
|
|
174
172
|
json: jsonOpt
|
|
175
173
|
});
|
|
176
174
|
return Array.isArray(dataRaw) ? dataRaw : [];
|
|
@@ -298,9 +296,10 @@ const hoveredTooltip = computed(() => {
|
|
|
298
296
|
|
|
299
297
|
<div
|
|
300
298
|
v-if="effectiveReadonly"
|
|
301
|
-
class="min-h-9 py-1.5 text-sm
|
|
299
|
+
class="min-h-9 py-1.5 text-sm"
|
|
300
|
+
:class="triggerLabel ? 'text-zinc-700' : 'font-mono text-zinc-300 select-none'"
|
|
302
301
|
>
|
|
303
|
-
{{ triggerLabel ||
|
|
302
|
+
{{ triggerLabel || "-" }}
|
|
304
303
|
</div>
|
|
305
304
|
|
|
306
305
|
<Popover
|
|
@@ -25,7 +25,7 @@ import { Markdown } from "../../../../ui/markdown";
|
|
|
25
25
|
import { Popover, PopoverAnchor, PopoverContent, PopoverTrigger } from "../../../../ui/popover";
|
|
26
26
|
import { DEFAULT_FIELD_ORIENTATION } from "../../../utils/common";
|
|
27
27
|
import { useFormReadonly } from "../../../utils/readonly";
|
|
28
|
-
import { useFormState } from "../../../utils/state";
|
|
28
|
+
import { useFormScope, useFormState } from "../../../utils/state";
|
|
29
29
|
import { useFieldValidation } from "../../../utils/validation";
|
|
30
30
|
defineOptions({ name: "ShwfedComboboxMultiFieldRuntime" });
|
|
31
31
|
const props = defineProps({
|
|
@@ -55,7 +55,8 @@ const { locale, t } = useI18n({
|
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
});
|
|
58
|
-
const {
|
|
58
|
+
const { getAt, setAt } = useFormState();
|
|
59
|
+
const formScope = useFormScope();
|
|
59
60
|
const inherited = injectCELContext();
|
|
60
61
|
const $cel = (expression, context) => _rawCel(expression, { ...celBindings(inherited), ...context });
|
|
61
62
|
const labelText = computed(() => getLocalizedText(props.config.label, locale.value));
|
|
@@ -68,7 +69,7 @@ const tooltipText = computed(
|
|
|
68
69
|
function evalBool(expression, label) {
|
|
69
70
|
if (!expression) return false;
|
|
70
71
|
try {
|
|
71
|
-
return Effect.runSync($cel(expression, { form: state.value ?? {} }));
|
|
72
|
+
return Effect.runSync($cel(expression, { form: formScope.state.value ?? {} }));
|
|
72
73
|
} catch (err) {
|
|
73
74
|
console.error(`[shwfed-form] failed to evaluate ${label} for ${props.fieldId}:`, err);
|
|
74
75
|
return false;
|
|
@@ -103,7 +104,7 @@ const requestSignature = computed(() => {
|
|
|
103
104
|
const expr = opts.request;
|
|
104
105
|
if (!expr) return null;
|
|
105
106
|
try {
|
|
106
|
-
const req = asRequest(Effect.runSync($cel(expr, { form: state.value ?? {} })));
|
|
107
|
+
const req = asRequest(Effect.runSync($cel(expr, { form: formScope.state.value ?? {} })));
|
|
107
108
|
return Option.isSome(req) ? JSON.stringify(req.value.describe()) : null;
|
|
108
109
|
} catch {
|
|
109
110
|
return null;
|
|
@@ -126,7 +127,7 @@ async function fetchOptions() {
|
|
|
126
127
|
}
|
|
127
128
|
isLoading.value = true;
|
|
128
129
|
const program = Effect.gen(function* () {
|
|
129
|
-
const body = yield* fetchJsonOption(yield* $cel(expr, { form: state.value ?? {} }));
|
|
130
|
+
const body = yield* fetchJsonOption(yield* $cel(expr, { form: formScope.state.value ?? {} }));
|
|
130
131
|
return Option.getOrNull(body);
|
|
131
132
|
});
|
|
132
133
|
try {
|
|
@@ -142,7 +143,7 @@ function remoteValueOf(option) {
|
|
|
142
143
|
const opts = props.config.options;
|
|
143
144
|
if (opts.kind !== "remote") return void 0;
|
|
144
145
|
try {
|
|
145
|
-
return Effect.runSync($cel(opts.optionValue, { form: state.value ?? {}, option }));
|
|
146
|
+
return Effect.runSync($cel(opts.optionValue, { form: formScope.state.value ?? {}, option }));
|
|
146
147
|
} catch (err) {
|
|
147
148
|
console.error(`[shwfed-form] failed to evaluate optionValue for ${props.fieldId}:`, err);
|
|
148
149
|
return void 0;
|
|
@@ -153,13 +154,13 @@ function remoteLabelOf(option) {
|
|
|
153
154
|
if (opts.kind !== "remote") return "";
|
|
154
155
|
const tpl = getLocalizedText(opts.optionLabel, locale.value) ?? "";
|
|
155
156
|
if (!tpl) return "";
|
|
156
|
-
return interpolateMarkdown(tpl, $cel, { form: state.value ?? {}, option });
|
|
157
|
+
return interpolateMarkdown(tpl, $cel, { form: formScope.state.value ?? {}, option });
|
|
157
158
|
}
|
|
158
159
|
function remoteKeywordsOf(option) {
|
|
159
160
|
const opts = props.config.options;
|
|
160
161
|
if (opts.kind !== "remote" || !opts.optionKeywords) return void 0;
|
|
161
162
|
try {
|
|
162
|
-
const raw = Effect.runSync($cel(opts.optionKeywords, { form: state.value ?? {}, option }));
|
|
163
|
+
const raw = Effect.runSync($cel(opts.optionKeywords, { form: formScope.state.value ?? {}, option }));
|
|
163
164
|
if (!Array.isArray(raw)) return void 0;
|
|
164
165
|
const joined = raw.map((k) => k == null ? "" : String(k)).filter(Boolean).join(" ");
|
|
165
166
|
return joined.length > 0 ? joined : void 0;
|
|
@@ -173,7 +174,7 @@ const entries = computed(() => {
|
|
|
173
174
|
if (opts.kind === "static") {
|
|
174
175
|
return (opts.items ?? []).map((item) => {
|
|
175
176
|
const labelTpl = getLocalizedText(item.label, locale.value) ?? "";
|
|
176
|
-
const ctx = { form: state.value ?? {} };
|
|
177
|
+
const ctx = { form: formScope.state.value ?? {} };
|
|
177
178
|
const kw = (item.keywords ?? []).filter(Boolean).join(" ");
|
|
178
179
|
return {
|
|
179
180
|
key: item.id,
|
|
@@ -186,7 +187,7 @@ const entries = computed(() => {
|
|
|
186
187
|
}
|
|
187
188
|
let raw;
|
|
188
189
|
try {
|
|
189
|
-
raw = Effect.runSync($cel(opts.options, { form: state.value ?? {}, json: json.value }));
|
|
190
|
+
raw = Effect.runSync($cel(opts.options, { form: formScope.state.value ?? {}, json: json.value }));
|
|
190
191
|
} catch (err) {
|
|
191
192
|
console.error(`[shwfed-form] failed to evaluate options for ${props.fieldId}:`, err);
|
|
192
193
|
return [];
|
|
@@ -306,9 +307,10 @@ function handleClear() {
|
|
|
306
307
|
</FieldLabel>
|
|
307
308
|
<div
|
|
308
309
|
v-if="effectiveReadonly"
|
|
309
|
-
class="min-h-9 py-1.5 text-sm
|
|
310
|
+
class="min-h-9 py-1.5 text-sm"
|
|
311
|
+
:class="triggerLabel ? 'text-zinc-700' : 'font-mono text-zinc-300 select-none'"
|
|
310
312
|
>
|
|
311
|
-
{{ triggerLabel || "
|
|
313
|
+
{{ triggerLabel || "-" }}
|
|
312
314
|
</div>
|
|
313
315
|
<Popover
|
|
314
316
|
v-else
|