@shwfed/config 2.9.12 → 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 +1610 -1107
- package/dist/module.json +1 -1
- package/dist/preview/assets/{FieldGroup.vue_vue_type_script_setup_true_lang-CpDhqXJp.js → FieldGroup.vue_vue_type_script_setup_true_lang-CCaOWk_7.js} +1 -1
- package/dist/preview/assets/{badge-Dsz2Rn8b.js → badge-D9_7atSJ.js} +1 -1
- package/dist/preview/assets/{config-vsMk-zRS.js → config-B2d8SiPi.js} +1 -1
- package/dist/preview/assets/{config-if9TvUw2.js → config-BLEovXei.js} +1 -1
- package/dist/preview/assets/{config-CRD1MpEn.js → config-Bf5Vckj3.js} +1 -1
- package/dist/preview/assets/{config-BePS5kQb.js → config-Bk2VSNeu.js} +1 -1
- package/dist/preview/assets/{config-X6-9yQmS.js → config-C8lCItmz.js} +1 -1
- package/dist/preview/assets/{config-CQLR1Zao.js → config-C9WPOoA7.js} +1 -1
- package/dist/preview/assets/{config-9-c5e5iP.js → config-CNKb25Qo.js} +1 -1
- package/dist/preview/assets/{config-DY7nQeRd.js → config-CQrqVV1U.js} +1 -1
- package/dist/preview/assets/{config-bFWnH6k3.js → config-DWA385pD.js} +1 -1
- package/dist/preview/assets/{config-Y2YuesjH.js → config-DYxMKhCU.js} +1 -1
- package/dist/preview/assets/{config-BCvaA0as.js → config-DZlaJUlF.js} +1 -1
- package/dist/preview/assets/{config-hrBgOr32.js → config-DyPl6K2G.js} +1 -1
- package/dist/preview/assets/{definition.vue_vue_type_script_setup_true_lang-CPrYbKjH.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-DJ5rzQJr.css → index-BnJ5p1Mx.css} +1 -1
- package/dist/preview/assets/index-Bwv0Yz_L.js +1 -0
- package/dist/preview/assets/{index-DFRXx_kG.js → index-CXOEVGFP.js} +1 -1
- package/dist/preview/assets/{item-auVJu6jy.js → item-DCVX69_o.js} +1 -1
- package/dist/preview/assets/{runtime-DyeSWij2.js → runtime-BD1A-g1h.js} +1 -1
- package/dist/preview/assets/{runtime-1DsatQOR.js → runtime-BNk4EliL.js} +1 -1
- package/dist/preview/assets/{runtime-Do_KQ5le.js → runtime-BO-KY3T_.js} +1 -1
- package/dist/preview/assets/{runtime-_5B97gRO.js → runtime-BsNSI1XP.js} +1 -1
- package/dist/preview/assets/{runtime-28a_li4U.js → runtime-Cbc5NH57.js} +1 -1
- package/dist/preview/assets/{runtime-DaaQn8fX.js → runtime-DEWGIyvr.js} +1 -1
- package/dist/preview/assets/{runtime-H7c112vi.js → runtime-DJ9ElxWB.js} +1 -1
- package/dist/preview/assets/{runtime-CBDARlsK.js → runtime-DSfMvph3.js} +1 -1
- package/dist/preview/assets/{runtime-CmgeUPz4.js → runtime-O6MNC3GA.js} +1 -1
- package/dist/preview/assets/{runtime-BDvuTpxY.js → runtime-r1wbrr4k.js} +1 -1
- package/dist/preview/assets/{schema-meta-Dc89aD6v.js → schema-meta-ovcuERKg.js} +1 -1
- package/dist/preview/index.html +2 -2
- package/dist/runtime/components/actions/buttons/2026-05-15/com.shwfed.actions.button.event.dispatch/schema.d.ts +15 -0
- package/dist/runtime/components/actions/buttons/2026-05-15/com.shwfed.actions.button.event.dispatch/schema.js +57 -1
- package/dist/runtime/components/actions/components/triggers-field.vue +12 -12
- package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.table/config.d.vue.ts +134 -0
- package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.table/config.vue.d.ts +134 -0
- package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.table/runtime.d.vue.ts +134 -0
- package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.table/runtime.vue.d.ts +134 -0
- package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.table/schema.d.ts +195 -0
- 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-18/com.shwfed.form.field.table/config.d.vue.ts +2 -0
- package/dist/runtime/components/form/fields/2026-05-18/com.shwfed.form.field.table/config.vue.d.ts +2 -0
- package/dist/runtime/components/form/fields/2026-05-18/com.shwfed.form.field.table/schema.d.ts +2 -0
- 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/operations/2026-06-11/com.shwfed.operation.http.request.json/runtime.js +5 -3
- package/dist/runtime/components/operations/2026-06-11/com.shwfed.operation.http.request.json/schema.js +3 -2
- package/dist/runtime/components/table/columns/2026-05-24/com.shwfed.table.column.combobox-single.remote.options-remote/config.d.vue.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-24/com.shwfed.table.column.combobox-single.remote.options-remote/config.vue.d.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-24/com.shwfed.table.column.combobox-single.remote.options-static/config.d.vue.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-24/com.shwfed.table.column.combobox-single.remote.options-static/config.vue.d.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-25/com.shwfed.table.column.combobox-multi.remote.options-remote/config.d.vue.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-25/com.shwfed.table.column.combobox-multi.remote.options-remote/config.vue.d.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-25/com.shwfed.table.column.combobox-multi.remote.options-static/config.d.vue.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-25/com.shwfed.table.column.combobox-multi.remote.options-static/config.vue.d.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-multi.remote/config.d.vue.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-multi.remote/config.vue.d.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-single.remote/config.d.vue.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-single.remote/config.vue.d.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-multi/config.d.vue.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-multi/config.vue.d.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-single/config.d.vue.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-single/config.vue.d.ts +2 -2
- package/dist/runtime/components/table/config.d.vue.ts +3 -3
- package/dist/runtime/components/table/config.vue +54 -20
- package/dist/runtime/components/table/config.vue.d.ts +3 -3
- package/dist/runtime/components/table/index.d.vue.ts +2 -0
- package/dist/runtime/components/table/index.vue +12 -3
- package/dist/runtime/components/table/index.vue.d.ts +2 -0
- package/dist/runtime/components/table/schema.d.ts +263 -0
- package/dist/runtime/components/table/schema.js +8 -4
- 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-BoyzyftU.js +0 -1
- package/dist/preview/assets/index-Bvlt8fEt.js +0 -734
|
@@ -3,9 +3,43 @@ function isDiscriminatorMiss(issue) {
|
|
|
3
3
|
const last = issue.path[issue.path.length - 1];
|
|
4
4
|
return (last === "type" || last === "compatibilityDate") && issue.message.startsWith('Expected "');
|
|
5
5
|
}
|
|
6
|
-
function
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
function isObject(v) {
|
|
7
|
+
return typeof v === "object" && v !== null;
|
|
8
|
+
}
|
|
9
|
+
function localeText(v) {
|
|
10
|
+
if (!Array.isArray(v)) return void 0;
|
|
11
|
+
for (const item of v) {
|
|
12
|
+
if (isObject(item) && typeof item.message === "string" && item.message.trim()) {
|
|
13
|
+
return item.message.trim();
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
return void 0;
|
|
17
|
+
}
|
|
18
|
+
function nodeLabel(node) {
|
|
19
|
+
if (!isObject(node)) return void 0;
|
|
20
|
+
return localeText(node.label) ?? localeText(node.title) ?? (typeof node.displayName === "string" && node.displayName.trim() ? node.displayName.trim() : void 0) ?? (typeof node.type === "string" ? node.type : void 0);
|
|
21
|
+
}
|
|
22
|
+
function describePath(path, rootData, blockLabelAt) {
|
|
23
|
+
const segs = [];
|
|
24
|
+
let node = rootData;
|
|
25
|
+
let labeledTopBlock = false;
|
|
26
|
+
for (let i = 0; i < path.length; i++) {
|
|
27
|
+
const seg = path[i];
|
|
28
|
+
node = isObject(node) ? node[seg] : void 0;
|
|
29
|
+
const isLeaf = i === path.length - 1;
|
|
30
|
+
if (typeof seg === "number") {
|
|
31
|
+
const isTopBlock = !labeledTopBlock && path[i - 1] === "blocks" && path[i - 2] === "slot";
|
|
32
|
+
if (isTopBlock) {
|
|
33
|
+
labeledTopBlock = true;
|
|
34
|
+
segs.push(blockLabelAt(seg) ?? nodeLabel(node) ?? `#${seg}`);
|
|
35
|
+
} else {
|
|
36
|
+
segs.push(nodeLabel(node) ?? `#${seg}`);
|
|
37
|
+
}
|
|
38
|
+
} else if (isLeaf) {
|
|
39
|
+
segs.push(String(seg));
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return segs;
|
|
9
43
|
}
|
|
10
44
|
function fallback(err) {
|
|
11
45
|
if (err instanceof Error) return err.message;
|
|
@@ -15,7 +49,7 @@ function fallback(err) {
|
|
|
15
49
|
return String(err);
|
|
16
50
|
}
|
|
17
51
|
}
|
|
18
|
-
export function formatValidationError(err, blockLabelAt) {
|
|
52
|
+
export function formatValidationError(err, blockLabelAt, rootData) {
|
|
19
53
|
if (!ParseResult.isParseError(err)) return fallback(err);
|
|
20
54
|
try {
|
|
21
55
|
const issues = ParseResult.ArrayFormatter.formatErrorSync(err);
|
|
@@ -23,9 +57,8 @@ export function formatValidationError(err, blockLabelAt) {
|
|
|
23
57
|
const picked = real.length > 0 ? real : issues;
|
|
24
58
|
const first = picked[0];
|
|
25
59
|
if (!first) return fallback(err);
|
|
26
|
-
const
|
|
27
|
-
const
|
|
28
|
-
const prefix = label ? `\u300C${label}\u300D\uFF1A` : "";
|
|
60
|
+
const segs = describePath(first.path, rootData, blockLabelAt);
|
|
61
|
+
const prefix = segs.length > 0 ? `\u300C${segs.join(" \u203A ")}\u300D\uFF1A` : "";
|
|
29
62
|
const suffix = picked.length > 1 ? `\uFF08\u8FD8\u6709 ${picked.length - 1} \u4E2A\u95EE\u9898\uFF09` : "";
|
|
30
63
|
return `${prefix}${first.message}${suffix}`;
|
|
31
64
|
} catch {
|
package/dist/runtime/components/form/fields/2026-04-22/com.shwfed.form.field.markdown/runtime.vue
CHANGED
|
@@ -6,20 +6,20 @@ import { celBindings, injectCELContext } from "../../../../../utils/cel-context"
|
|
|
6
6
|
import { getLocalizedText } from "../../../../../share/locale";
|
|
7
7
|
import { Markdown } from "../../../../ui/markdown";
|
|
8
8
|
import { interpolateMarkdown } from "../../../../table/utils/runtime";
|
|
9
|
-
import {
|
|
9
|
+
import { useFormScope } from "../../../utils/state";
|
|
10
10
|
defineOptions({ name: "ShwfedMarkdownFieldRuntime" });
|
|
11
11
|
const props = defineProps({
|
|
12
12
|
fieldId: { type: String, required: true },
|
|
13
13
|
config: { type: null, required: true }
|
|
14
14
|
});
|
|
15
15
|
const { locale } = useI18n();
|
|
16
|
-
const
|
|
16
|
+
const formScope = useFormScope();
|
|
17
17
|
const inherited = injectCELContext();
|
|
18
18
|
const $cel = (expression, context) => _rawCel(expression, { ...celBindings(inherited), ...context });
|
|
19
19
|
const source = computed(() => {
|
|
20
20
|
const template = getLocalizedText(props.config.content, locale.value) ?? "";
|
|
21
21
|
if (!template) return "";
|
|
22
|
-
return interpolateMarkdown(template, $cel, { form: state.value ?? {} });
|
|
22
|
+
return interpolateMarkdown(template, $cel, { form: formScope.state.value ?? {} });
|
|
23
23
|
});
|
|
24
24
|
</script>
|
|
25
25
|
|
package/dist/runtime/components/form/fields/2026-04-22/com.shwfed.form.field.text/runtime.vue
CHANGED
|
@@ -13,14 +13,14 @@ import { DEFAULT_FIELD_ORIENTATION } from "../../../utils/common";
|
|
|
13
13
|
import { useFieldValue } from "../../../utils/field-value";
|
|
14
14
|
import { useFieldValidation } from "../../../utils/validation";
|
|
15
15
|
import { useFormReadonly } from "../../../utils/readonly";
|
|
16
|
-
import {
|
|
16
|
+
import { useFormScope } from "../../../utils/state";
|
|
17
17
|
defineOptions({ name: "ShwfedTextFieldRuntime" });
|
|
18
18
|
const props = defineProps({
|
|
19
19
|
fieldId: { type: String, required: true },
|
|
20
20
|
config: { type: null, required: true }
|
|
21
21
|
});
|
|
22
22
|
const { locale } = useI18n();
|
|
23
|
-
const
|
|
23
|
+
const formScope = useFormScope();
|
|
24
24
|
const inherited = injectCELContext();
|
|
25
25
|
const $cel = (expression, context) => _rawCel(expression, { ...celBindings(inherited), ...context });
|
|
26
26
|
const labelText = computed(() => getLocalizedText(props.config.label, locale.value));
|
|
@@ -33,7 +33,7 @@ const tooltipText = computed(
|
|
|
33
33
|
function evalBool(expression, label) {
|
|
34
34
|
if (!expression) return false;
|
|
35
35
|
try {
|
|
36
|
-
return Effect.runSync($cel(expression, { form: state.value ?? {} }));
|
|
36
|
+
return Effect.runSync($cel(expression, { form: formScope.state.value ?? {} }));
|
|
37
37
|
} catch (err) {
|
|
38
38
|
console.error(`[shwfed-form] failed to evaluate ${label} for ${props.fieldId}:`, err);
|
|
39
39
|
return false;
|
|
@@ -90,9 +90,10 @@ function handleClear() {
|
|
|
90
90
|
</FieldLabel>
|
|
91
91
|
<div
|
|
92
92
|
v-if="effectiveReadonly"
|
|
93
|
-
class="min-h-9 py-1.5 text-sm
|
|
93
|
+
class="min-h-9 py-1.5 text-sm"
|
|
94
|
+
:class="draft ? 'text-zinc-700' : 'font-mono text-zinc-300 select-none'"
|
|
94
95
|
>
|
|
95
|
-
{{ draft || "
|
|
96
|
+
{{ draft || "-" }}
|
|
96
97
|
</div>
|
|
97
98
|
<InputGroup
|
|
98
99
|
v-else
|
package/dist/runtime/components/form/fields/2026-04-22/com.shwfed.form.field.textarea/runtime.vue
CHANGED
|
@@ -12,14 +12,14 @@ import { DEFAULT_FIELD_ORIENTATION } from "../../../utils/common";
|
|
|
12
12
|
import { useFieldValue } from "../../../utils/field-value";
|
|
13
13
|
import { useFieldValidation } from "../../../utils/validation";
|
|
14
14
|
import { useFormReadonly } from "../../../utils/readonly";
|
|
15
|
-
import {
|
|
15
|
+
import { useFormScope } from "../../../utils/state";
|
|
16
16
|
defineOptions({ name: "ShwfedTextareaFieldRuntime" });
|
|
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 formScope = useFormScope();
|
|
23
23
|
const inherited = injectCELContext();
|
|
24
24
|
const $cel = (expression, context) => _rawCel(expression, { ...celBindings(inherited), ...context });
|
|
25
25
|
const labelText = computed(() => getLocalizedText(props.config.label, locale.value));
|
|
@@ -33,7 +33,7 @@ const maxLength = computed(() => props.config.maxLength);
|
|
|
33
33
|
function evalBool(expression, label) {
|
|
34
34
|
if (!expression) return false;
|
|
35
35
|
try {
|
|
36
|
-
return Effect.runSync($cel(expression, { form: state.value ?? {} }));
|
|
36
|
+
return Effect.runSync($cel(expression, { form: formScope.state.value ?? {} }));
|
|
37
37
|
} catch (err) {
|
|
38
38
|
console.error(`[shwfed-form] failed to evaluate ${label} for ${props.fieldId}:`, err);
|
|
39
39
|
return false;
|
|
@@ -85,9 +85,10 @@ const { isRequired, errors, warnings, visible } = useFieldValidation({
|
|
|
85
85
|
</FieldLabel>
|
|
86
86
|
<div
|
|
87
87
|
v-if="effectiveReadonly"
|
|
88
|
-
class="min-h-9 py-1.5 text-sm whitespace-pre-wrap
|
|
88
|
+
class="min-h-9 py-1.5 text-sm whitespace-pre-wrap"
|
|
89
|
+
:class="draft ? 'text-zinc-700' : 'font-mono text-zinc-300 select-none'"
|
|
89
90
|
>
|
|
90
|
-
{{ draft || "
|
|
91
|
+
{{ draft || "-" }}
|
|
91
92
|
</div>
|
|
92
93
|
<InputGroup v-else>
|
|
93
94
|
<InputGroupTextarea
|
|
@@ -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: "ShwfedComboboxSingleFieldRuntime" });
|
|
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 [];
|
|
@@ -175,9 +176,10 @@ function handleClear() {
|
|
|
175
176
|
</FieldLabel>
|
|
176
177
|
<div
|
|
177
178
|
v-if="effectiveReadonly"
|
|
178
|
-
class="min-h-9 py-1.5 text-sm
|
|
179
|
+
class="min-h-9 py-1.5 text-sm"
|
|
180
|
+
:class="selectedLabel ? 'text-zinc-700' : 'font-mono text-zinc-300 select-none'"
|
|
179
181
|
>
|
|
180
|
-
{{ selectedLabel || "
|
|
182
|
+
{{ selectedLabel || "-" }}
|
|
181
183
|
</div>
|
|
182
184
|
<Popover
|
|
183
185
|
v-else
|
package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.date/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: "ShwfedDateFieldRuntime" });
|
|
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;
|
|
@@ -54,7 +55,7 @@ const shortcuts = computed(() => {
|
|
|
54
55
|
name: preset.label,
|
|
55
56
|
value: () => {
|
|
56
57
|
try {
|
|
57
|
-
const d = Effect.runSync($cel(preset.value, { form: state.value ?? {} }));
|
|
58
|
+
const d = Effect.runSync($cel(preset.value, { form: formScope.state.value ?? {} }));
|
|
58
59
|
return formatDate(d, resolvedValueFormat.value);
|
|
59
60
|
} catch (err) {
|
|
60
61
|
console.error(`[shwfed-form] failed to evaluate preset "${preset.value}" for ${props.fieldId}:`, err);
|
|
@@ -115,9 +116,10 @@ const { isRequired, errors, warnings, visible } = useFieldValidation({
|
|
|
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-04-27/com.shwfed.form.field.daterange/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: "ShwfedDateRangeFieldRuntime" });
|
|
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;
|
|
@@ -57,8 +58,8 @@ const shortcuts = computed(() => {
|
|
|
57
58
|
name: preset.label,
|
|
58
59
|
value: () => {
|
|
59
60
|
try {
|
|
60
|
-
const start = Effect.runSync($cel(preset.start, { form: state.value ?? {} }));
|
|
61
|
-
const end = Effect.runSync($cel(preset.end, { form: state.value ?? {} }));
|
|
61
|
+
const start = Effect.runSync($cel(preset.start, { form: formScope.state.value ?? {} }));
|
|
62
|
+
const end = Effect.runSync($cel(preset.end, { form: formScope.state.value ?? {} }));
|
|
62
63
|
return [
|
|
63
64
|
formatDate(start, resolvedValueFormat.value),
|
|
64
65
|
formatDate(end, resolvedValueFormat.value)
|
|
@@ -113,7 +114,7 @@ const { isRequired, errors, warnings, visible } = useFieldValidation({
|
|
|
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
|
package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.datetime/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: "ShwfedDateTimeFieldRuntime" });
|
|
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;
|
|
@@ -54,7 +55,7 @@ const shortcuts = computed(() => {
|
|
|
54
55
|
name: preset.label,
|
|
55
56
|
value: () => {
|
|
56
57
|
try {
|
|
57
|
-
const d = Effect.runSync($cel(preset.value, { form: state.value ?? {} }));
|
|
58
|
+
const d = Effect.runSync($cel(preset.value, { form: formScope.state.value ?? {} }));
|
|
58
59
|
return formatDate(d, resolvedValueFormat.value);
|
|
59
60
|
} catch (err) {
|
|
60
61
|
console.error(`[shwfed-form] failed to evaluate preset "${preset.value}" for ${props.fieldId}:`, err);
|
|
@@ -115,9 +116,10 @@ const { isRequired, errors, warnings, visible } = useFieldValidation({
|
|
|
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
|
|
@@ -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: "ShwfedDateTimeRangeFieldRuntime" });
|
|
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;
|
|
@@ -57,8 +58,8 @@ const shortcuts = computed(() => {
|
|
|
57
58
|
name: preset.label,
|
|
58
59
|
value: () => {
|
|
59
60
|
try {
|
|
60
|
-
const start = Effect.runSync($cel(preset.start, { form: state.value ?? {} }));
|
|
61
|
-
const end = Effect.runSync($cel(preset.end, { form: state.value ?? {} }));
|
|
61
|
+
const start = Effect.runSync($cel(preset.start, { form: formScope.state.value ?? {} }));
|
|
62
|
+
const end = Effect.runSync($cel(preset.end, { form: formScope.state.value ?? {} }));
|
|
62
63
|
return [
|
|
63
64
|
formatDate(start, resolvedValueFormat.value),
|
|
64
65
|
formatDate(end, resolvedValueFormat.value)
|
|
@@ -113,7 +114,7 @@ const { isRequired, errors, warnings, visible } = useFieldValidation({
|
|
|
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
|
package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.time/runtime.vue
CHANGED
|
@@ -11,14 +11,15 @@ import { Markdown } from "../../../../ui/markdown";
|
|
|
11
11
|
import { DEFAULT_FIELD_ORIENTATION } from "../../../utils/common";
|
|
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: "ShwfedTimeFieldRuntime" });
|
|
16
16
|
const props = defineProps({
|
|
17
17
|
fieldId: { type: String, required: true },
|
|
18
18
|
config: { type: null, required: true }
|
|
19
19
|
});
|
|
20
20
|
const { locale } = useI18n();
|
|
21
|
-
const {
|
|
21
|
+
const { getAt, setAt } = useFormState();
|
|
22
|
+
const formScope = useFormScope();
|
|
22
23
|
const inherited = injectCELContext();
|
|
23
24
|
const $cel = (expression, context) => _rawCel(expression, { ...celBindings(inherited), ...context });
|
|
24
25
|
const labelText = computed(() => getLocalizedText(props.config.label, locale.value));
|
|
@@ -28,7 +29,7 @@ const tooltipText = computed(
|
|
|
28
29
|
function evalBool(expression, label) {
|
|
29
30
|
if (!expression) return false;
|
|
30
31
|
try {
|
|
31
|
-
return Effect.runSync($cel(expression, { form: state.value ?? {} }));
|
|
32
|
+
return Effect.runSync($cel(expression, { form: formScope.state.value ?? {} }));
|
|
32
33
|
} catch (err) {
|
|
33
34
|
console.error(`[shwfed-form] failed to evaluate ${label} for ${props.fieldId}:`, err);
|
|
34
35
|
return false;
|
|
@@ -92,9 +93,10 @@ const { isRequired, errors, warnings, visible } = useFieldValidation({
|
|
|
92
93
|
</FieldLabel>
|
|
93
94
|
<div
|
|
94
95
|
v-if="effectiveReadonly"
|
|
95
|
-
class="min-h-9 py-1.5 text-sm
|
|
96
|
+
class="min-h-9 py-1.5 text-sm"
|
|
97
|
+
:class="model ? 'text-zinc-700' : 'font-mono text-zinc-300 select-none'"
|
|
96
98
|
>
|
|
97
|
-
{{ model || "
|
|
99
|
+
{{ model || "-" }}
|
|
98
100
|
</div>
|
|
99
101
|
<DatePicker
|
|
100
102
|
v-else
|
package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.timerange/runtime.vue
CHANGED
|
@@ -11,14 +11,15 @@ import { Markdown } from "../../../../ui/markdown";
|
|
|
11
11
|
import { DEFAULT_FIELD_ORIENTATION } from "../../../utils/common";
|
|
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: "ShwfedTimeRangeFieldRuntime" });
|
|
16
16
|
const props = defineProps({
|
|
17
17
|
fieldId: { type: String, required: true },
|
|
18
18
|
config: { type: null, required: true }
|
|
19
19
|
});
|
|
20
20
|
const { locale } = useI18n();
|
|
21
|
-
const {
|
|
21
|
+
const { getAt, setAt } = useFormState();
|
|
22
|
+
const formScope = useFormScope();
|
|
22
23
|
const inherited = injectCELContext();
|
|
23
24
|
const $cel = (expression, context) => _rawCel(expression, { ...celBindings(inherited), ...context });
|
|
24
25
|
const labelText = computed(() => getLocalizedText(props.config.label, locale.value));
|
|
@@ -28,7 +29,7 @@ const tooltipText = computed(
|
|
|
28
29
|
function evalBool(expression, label) {
|
|
29
30
|
if (!expression) return false;
|
|
30
31
|
try {
|
|
31
|
-
return Effect.runSync($cel(expression, { form: state.value ?? {} }));
|
|
32
|
+
return Effect.runSync($cel(expression, { form: formScope.state.value ?? {} }));
|
|
32
33
|
} catch (err) {
|
|
33
34
|
console.error(`[shwfed-form] failed to evaluate ${label} for ${props.fieldId}:`, err);
|
|
34
35
|
return false;
|
|
@@ -83,7 +84,7 @@ const { isRequired, errors, warnings, visible } = useFieldValidation({
|
|
|
83
84
|
});
|
|
84
85
|
const readonlyText = computed(() => {
|
|
85
86
|
const v = model.value;
|
|
86
|
-
if (!v) return
|
|
87
|
+
if (!v) return null;
|
|
87
88
|
return `${v[0]} ~ ${v[1]}`;
|
|
88
89
|
});
|
|
89
90
|
</script>
|
|
@@ -115,9 +116,10 @@ const readonlyText = 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="readonlyText ? 'text-zinc-700' : 'font-mono text-zinc-300 select-none'"
|
|
119
121
|
>
|
|
120
|
-
{{ readonlyText }}
|
|
122
|
+
{{ readonlyText || "-" }}
|
|
121
123
|
</div>
|
|
122
124
|
<DateRangePicker
|
|
123
125
|
v-else
|
package/dist/runtime/components/form/fields/2026-04-28/com.shwfed.form.field.number/runtime.vue
CHANGED
|
@@ -13,14 +13,14 @@ import { DEFAULT_FIELD_ORIENTATION } from "../../../utils/common";
|
|
|
13
13
|
import { useFieldValue } from "../../../utils/field-value";
|
|
14
14
|
import { useFieldValidation } from "../../../utils/validation";
|
|
15
15
|
import { useFormReadonly } from "../../../utils/readonly";
|
|
16
|
-
import {
|
|
16
|
+
import { useFormScope } from "../../../utils/state";
|
|
17
17
|
defineOptions({ name: "ShwfedNumberFieldRuntime" });
|
|
18
18
|
const props = defineProps({
|
|
19
19
|
fieldId: { type: String, required: true },
|
|
20
20
|
config: { type: null, required: true }
|
|
21
21
|
});
|
|
22
22
|
const { locale } = useI18n();
|
|
23
|
-
const
|
|
23
|
+
const formScope = useFormScope();
|
|
24
24
|
const inherited = injectCELContext();
|
|
25
25
|
const $cel = (expression, context) => _rawCel(expression, { ...celBindings(inherited), ...context });
|
|
26
26
|
const labelText = computed(() => getLocalizedText(props.config.label, locale.value));
|
|
@@ -33,7 +33,7 @@ const tooltipText = computed(
|
|
|
33
33
|
function evalBool(expression, label) {
|
|
34
34
|
if (!expression) return false;
|
|
35
35
|
try {
|
|
36
|
-
return Effect.runSync($cel(expression, { form: state.value ?? {} }));
|
|
36
|
+
return Effect.runSync($cel(expression, { form: formScope.state.value ?? {} }));
|
|
37
37
|
} catch (err) {
|
|
38
38
|
console.error(`[shwfed-form] failed to evaluate ${label} for ${props.fieldId}:`, err);
|
|
39
39
|
return false;
|
|
@@ -42,7 +42,7 @@ function evalBool(expression, label) {
|
|
|
42
42
|
function evalNumber(expression, label) {
|
|
43
43
|
if (!expression) return void 0;
|
|
44
44
|
try {
|
|
45
|
-
const result = Effect.runSync($cel(expression, { form: state.value ?? {} }));
|
|
45
|
+
const result = Effect.runSync($cel(expression, { form: formScope.state.value ?? {} }));
|
|
46
46
|
return typeof result === "number" && Number.isFinite(result) ? result : void 0;
|
|
47
47
|
} catch (err) {
|
|
48
48
|
console.error(`[shwfed-form] failed to evaluate ${label} for ${props.fieldId}:`, err);
|
|
@@ -139,9 +139,10 @@ async function onBlur() {
|
|
|
139
139
|
</FieldLabel>
|
|
140
140
|
<div
|
|
141
141
|
v-if="effectiveReadonly"
|
|
142
|
-
class="min-h-9 py-1.5 text-sm
|
|
142
|
+
class="min-h-9 py-1.5 text-sm"
|
|
143
|
+
:class="draft != null ? 'text-zinc-700' : 'font-mono text-zinc-300 select-none'"
|
|
143
144
|
>
|
|
144
|
-
{{ draft ?? "
|
|
145
|
+
{{ draft ?? "-" }}
|
|
145
146
|
</div>
|
|
146
147
|
<InputGroup
|
|
147
148
|
v-else
|
package/dist/runtime/components/form/fields/2026-04-28/com.shwfed.form.field.numberrange/runtime.vue
CHANGED
|
@@ -13,14 +13,15 @@ import { useCommitBus } from "../../../utils/commit-bus";
|
|
|
13
13
|
import { DEFAULT_FIELD_ORIENTATION } from "../../../utils/common";
|
|
14
14
|
import { useFieldValidation } from "../../../utils/validation";
|
|
15
15
|
import { useFormReadonly } from "../../../utils/readonly";
|
|
16
|
-
import { useFormState } from "../../../utils/state";
|
|
16
|
+
import { useFormScope, useFormState } from "../../../utils/state";
|
|
17
17
|
defineOptions({ name: "ShwfedNumberRangeFieldRuntime" });
|
|
18
18
|
const props = defineProps({
|
|
19
19
|
fieldId: { type: String, required: true },
|
|
20
20
|
config: { type: null, required: true }
|
|
21
21
|
});
|
|
22
22
|
const { locale } = useI18n();
|
|
23
|
-
const {
|
|
23
|
+
const { getAt, setAt } = useFormState();
|
|
24
|
+
const formScope = useFormScope();
|
|
24
25
|
const inherited = injectCELContext();
|
|
25
26
|
const $cel = (expression, context) => _rawCel(expression, { ...celBindings(inherited), ...context });
|
|
26
27
|
const labelText = computed(() => getLocalizedText(props.config.label, locale.value));
|
|
@@ -36,7 +37,7 @@ const tooltipText = computed(
|
|
|
36
37
|
function evalBool(expression, label) {
|
|
37
38
|
if (!expression) return false;
|
|
38
39
|
try {
|
|
39
|
-
return Effect.runSync($cel(expression, { form: state.value ?? {} }));
|
|
40
|
+
return Effect.runSync($cel(expression, { form: formScope.state.value ?? {} }));
|
|
40
41
|
} catch (err) {
|
|
41
42
|
console.error(`[shwfed-form] failed to evaluate ${label} for ${props.fieldId}:`, err);
|
|
42
43
|
return false;
|
|
@@ -45,7 +46,7 @@ function evalBool(expression, label) {
|
|
|
45
46
|
function evalNumber(expression, label) {
|
|
46
47
|
if (!expression) return void 0;
|
|
47
48
|
try {
|
|
48
|
-
const result = Effect.runSync($cel(expression, { form: state.value ?? {} }));
|
|
49
|
+
const result = Effect.runSync($cel(expression, { form: formScope.state.value ?? {} }));
|
|
49
50
|
return typeof result === "number" && Number.isFinite(result) ? result : void 0;
|
|
50
51
|
} catch (err) {
|
|
51
52
|
console.error(`[shwfed-form] failed to evaluate ${label} for ${props.fieldId}:`, err);
|
|
@@ -189,7 +190,7 @@ function handleClear() {
|
|
|
189
190
|
}
|
|
190
191
|
const readonlyText = computed(() => {
|
|
191
192
|
const v = model.value;
|
|
192
|
-
if (!v) return
|
|
193
|
+
if (!v) return null;
|
|
193
194
|
return `${v[0]} ~ ${v[1]}`;
|
|
194
195
|
});
|
|
195
196
|
</script>
|
|
@@ -221,9 +222,10 @@ const readonlyText = computed(() => {
|
|
|
221
222
|
</FieldLabel>
|
|
222
223
|
<div
|
|
223
224
|
v-if="effectiveReadonly"
|
|
224
|
-
class="min-h-9 py-1.5 text-sm
|
|
225
|
+
class="min-h-9 py-1.5 text-sm"
|
|
226
|
+
:class="readonlyText ? 'text-zinc-700' : 'font-mono text-zinc-300 select-none'"
|
|
225
227
|
>
|
|
226
|
-
{{ readonlyText }}
|
|
228
|
+
{{ readonlyText || "-" }}
|
|
227
229
|
</div>
|
|
228
230
|
<InputGroup
|
|
229
231
|
v-else
|