@shwfed/config 2.3.16 → 2.3.18
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 +727 -534
- package/dist/module.json +1 -1
- package/dist/preview/assets/{config-C19W7NmV.js → config-C8Y4mJbo.js} +1 -1
- package/dist/preview/assets/{config-8iL9DU55.js → config-CGjY6-4G.js} +1 -1
- package/dist/preview/assets/{config-CRUg_Pcx.js → config-CR-ypZys.js} +1 -1
- package/dist/preview/assets/{config-B4ITIOSI.js → config-Cs3k3BuR.js} +1 -1
- package/dist/preview/assets/{config-DyvYQUK3.js → config-D9mrL0UY.js} +1 -1
- package/dist/preview/assets/{config-AEM1zjvE.js → config-DRy0SpMq.js} +1 -1
- package/dist/preview/assets/{config-m-s6iTyN.js → config-eopfzGON.js} +1 -1
- package/dist/preview/assets/{config-C4t_as1U.js → config-qmkDiyXK.js} +1 -1
- package/dist/preview/assets/{definition.vue_vue_type_script_setup_true_lang-CiwBbLRf.js → definition.vue_vue_type_script_setup_true_lang-BakGkJ_w.js} +1 -1
- package/dist/preview/assets/index-BUyz4nJb.css +1 -0
- package/dist/preview/assets/index-Bsbk3Okp.js +1 -0
- package/dist/preview/assets/index-Dz_SnGc9.js +639 -0
- package/dist/preview/assets/{runtime-KCPICzI0.js → runtime-B1Lqn7iS.js} +1 -1
- package/dist/preview/assets/{runtime-DTtdk8hJ.js → runtime-BvJjQaAU.js} +1 -1
- package/dist/preview/assets/{runtime-BlndSTII.js → runtime-C-3DIGFz.js} +1 -1
- package/dist/preview/assets/{runtime--kEuSRJR.js → runtime-C2q2Mp8_.js} +1 -1
- package/dist/preview/assets/{runtime-n8qxUfe8.js → runtime-CdELhC3y.js} +1 -1
- package/dist/preview/assets/{runtime-DDA8wR0s.js → runtime-D8OAMic8.js} +1 -1
- package/dist/preview/assets/{runtime-BiAcObbN.js → runtime-DQcKN5I_.js} +1 -1
- package/dist/preview/assets/{runtime-BHeaq-Ju.js → runtime-DQvlwOZl.js} +1 -1
- package/dist/preview/index.html +2 -2
- package/dist/runtime/components/form/fields/2026-05-23/com.shwfed.form.field.tree.multi/runtime.vue +36 -12
- package/dist/runtime/components/form/fields/2026-05-24/com.shwfed.form.field.month/config.d.vue.ts +107 -0
- package/dist/runtime/components/form/fields/2026-05-24/com.shwfed.form.field.month/config.vue +493 -0
- package/dist/runtime/components/form/fields/2026-05-24/com.shwfed.form.field.month/config.vue.d.ts +107 -0
- package/dist/runtime/components/form/fields/2026-05-24/com.shwfed.form.field.month/runtime.d.vue.ts +8 -0
- package/dist/runtime/components/form/fields/2026-05-24/com.shwfed.form.field.month/runtime.vue +123 -0
- package/dist/runtime/components/form/fields/2026-05-24/com.shwfed.form.field.month/runtime.vue.d.ts +8 -0
- package/dist/runtime/components/form/fields/2026-05-24/com.shwfed.form.field.month/schema.d.ts +79 -0
- package/dist/runtime/components/form/fields/2026-05-24/com.shwfed.form.field.month/schema.js +78 -0
- package/dist/runtime/components/form/fields/2026-05-24/com.shwfed.form.field.monthrange/config.d.vue.ts +125 -0
- package/dist/runtime/components/form/fields/2026-05-24/com.shwfed.form.field.monthrange/config.vue +645 -0
- package/dist/runtime/components/form/fields/2026-05-24/com.shwfed.form.field.monthrange/config.vue.d.ts +125 -0
- package/dist/runtime/components/form/fields/2026-05-24/com.shwfed.form.field.monthrange/runtime.d.vue.ts +8 -0
- package/dist/runtime/components/form/fields/2026-05-24/com.shwfed.form.field.monthrange/runtime.vue +155 -0
- package/dist/runtime/components/form/fields/2026-05-24/com.shwfed.form.field.monthrange/runtime.vue.d.ts +8 -0
- package/dist/runtime/components/form/fields/2026-05-24/com.shwfed.form.field.monthrange/schema.d.ts +90 -0
- package/dist/runtime/components/form/fields/2026-05-24/com.shwfed.form.field.monthrange/schema.js +100 -0
- package/dist/runtime/components/ui/tree/Tree.d.vue.ts +7 -0
- package/dist/runtime/components/ui/tree/Tree.vue +3 -1
- package/dist/runtime/components/ui/tree/Tree.vue.d.ts +7 -0
- package/dist/runtime/components/ui/tree/TreeNode.d.vue.ts +1 -0
- package/dist/runtime/components/ui/tree/TreeNode.vue +4 -2
- package/dist/runtime/components/ui/tree/TreeNode.vue.d.ts +1 -0
- package/package.json +1 -1
- package/dist/preview/assets/index-BT8fF6jA.js +0 -637
- package/dist/preview/assets/index-Br_eXThF.css +0 -1
- package/dist/preview/assets/index-DrZ27b4e.js +0 -1
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { type Value } from './schema.js';
|
|
2
|
+
type __VLS_ModelProps = {
|
|
3
|
+
modelValue: Value;
|
|
4
|
+
};
|
|
5
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
6
|
+
"update:modelValue": (value: {
|
|
7
|
+
readonly label?: readonly [{
|
|
8
|
+
readonly locale: "zh";
|
|
9
|
+
readonly message: string;
|
|
10
|
+
}, ...{
|
|
11
|
+
readonly locale: "en" | "ja" | "ko";
|
|
12
|
+
readonly message: string;
|
|
13
|
+
}[]] | undefined;
|
|
14
|
+
readonly disabled?: string | undefined;
|
|
15
|
+
readonly type: "com.shwfed.form.field.monthrange";
|
|
16
|
+
readonly id: string;
|
|
17
|
+
readonly hidden?: string | undefined;
|
|
18
|
+
readonly tooltip?: readonly [{
|
|
19
|
+
readonly locale: "zh";
|
|
20
|
+
readonly message: string;
|
|
21
|
+
}, ...{
|
|
22
|
+
readonly locale: "en" | "ja" | "ko";
|
|
23
|
+
readonly message: string;
|
|
24
|
+
}[]] | undefined;
|
|
25
|
+
readonly displayName?: string | undefined;
|
|
26
|
+
readonly compatibilityDate: "2026-05-24";
|
|
27
|
+
readonly orientation?: "vertical" | "floating" | undefined;
|
|
28
|
+
readonly readonly?: string | undefined;
|
|
29
|
+
readonly binding?: string | readonly [string, string] | undefined;
|
|
30
|
+
readonly derived?: {
|
|
31
|
+
readonly mode: "formula" | "prefill";
|
|
32
|
+
readonly expression: string;
|
|
33
|
+
} | undefined;
|
|
34
|
+
readonly format?: string | undefined;
|
|
35
|
+
readonly valueFormat?: string | undefined;
|
|
36
|
+
readonly rangeSeparatorIcon?: string | undefined;
|
|
37
|
+
readonly startPlaceholder?: readonly [{
|
|
38
|
+
readonly locale: "zh";
|
|
39
|
+
readonly message: string;
|
|
40
|
+
}, ...{
|
|
41
|
+
readonly locale: "en" | "ja" | "ko";
|
|
42
|
+
readonly message: string;
|
|
43
|
+
}[]] | undefined;
|
|
44
|
+
readonly endPlaceholder?: readonly [{
|
|
45
|
+
readonly locale: "zh";
|
|
46
|
+
readonly message: string;
|
|
47
|
+
}, ...{
|
|
48
|
+
readonly locale: "en" | "ja" | "ko";
|
|
49
|
+
readonly message: string;
|
|
50
|
+
}[]] | undefined;
|
|
51
|
+
readonly presets?: readonly {
|
|
52
|
+
readonly label: readonly [{
|
|
53
|
+
readonly locale: "zh";
|
|
54
|
+
readonly message: string;
|
|
55
|
+
}, ...{
|
|
56
|
+
readonly locale: "en" | "ja" | "ko";
|
|
57
|
+
readonly message: string;
|
|
58
|
+
}[]];
|
|
59
|
+
readonly id: string;
|
|
60
|
+
readonly end: string;
|
|
61
|
+
readonly start: string;
|
|
62
|
+
}[] | undefined;
|
|
63
|
+
}) => any;
|
|
64
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_ModelProps> & Readonly<{
|
|
65
|
+
"onUpdate:modelValue"?: ((value: {
|
|
66
|
+
readonly label?: readonly [{
|
|
67
|
+
readonly locale: "zh";
|
|
68
|
+
readonly message: string;
|
|
69
|
+
}, ...{
|
|
70
|
+
readonly locale: "en" | "ja" | "ko";
|
|
71
|
+
readonly message: string;
|
|
72
|
+
}[]] | undefined;
|
|
73
|
+
readonly disabled?: string | undefined;
|
|
74
|
+
readonly type: "com.shwfed.form.field.monthrange";
|
|
75
|
+
readonly id: string;
|
|
76
|
+
readonly hidden?: string | undefined;
|
|
77
|
+
readonly tooltip?: readonly [{
|
|
78
|
+
readonly locale: "zh";
|
|
79
|
+
readonly message: string;
|
|
80
|
+
}, ...{
|
|
81
|
+
readonly locale: "en" | "ja" | "ko";
|
|
82
|
+
readonly message: string;
|
|
83
|
+
}[]] | undefined;
|
|
84
|
+
readonly displayName?: string | undefined;
|
|
85
|
+
readonly compatibilityDate: "2026-05-24";
|
|
86
|
+
readonly orientation?: "vertical" | "floating" | undefined;
|
|
87
|
+
readonly readonly?: string | undefined;
|
|
88
|
+
readonly binding?: string | readonly [string, string] | undefined;
|
|
89
|
+
readonly derived?: {
|
|
90
|
+
readonly mode: "formula" | "prefill";
|
|
91
|
+
readonly expression: string;
|
|
92
|
+
} | undefined;
|
|
93
|
+
readonly format?: string | undefined;
|
|
94
|
+
readonly valueFormat?: string | undefined;
|
|
95
|
+
readonly rangeSeparatorIcon?: string | undefined;
|
|
96
|
+
readonly startPlaceholder?: readonly [{
|
|
97
|
+
readonly locale: "zh";
|
|
98
|
+
readonly message: string;
|
|
99
|
+
}, ...{
|
|
100
|
+
readonly locale: "en" | "ja" | "ko";
|
|
101
|
+
readonly message: string;
|
|
102
|
+
}[]] | undefined;
|
|
103
|
+
readonly endPlaceholder?: readonly [{
|
|
104
|
+
readonly locale: "zh";
|
|
105
|
+
readonly message: string;
|
|
106
|
+
}, ...{
|
|
107
|
+
readonly locale: "en" | "ja" | "ko";
|
|
108
|
+
readonly message: string;
|
|
109
|
+
}[]] | undefined;
|
|
110
|
+
readonly presets?: readonly {
|
|
111
|
+
readonly label: readonly [{
|
|
112
|
+
readonly locale: "zh";
|
|
113
|
+
readonly message: string;
|
|
114
|
+
}, ...{
|
|
115
|
+
readonly locale: "en" | "ja" | "ko";
|
|
116
|
+
readonly message: string;
|
|
117
|
+
}[]];
|
|
118
|
+
readonly id: string;
|
|
119
|
+
readonly end: string;
|
|
120
|
+
readonly start: string;
|
|
121
|
+
}[] | undefined;
|
|
122
|
+
}) => any) | undefined;
|
|
123
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
124
|
+
declare const _default: typeof __VLS_export;
|
|
125
|
+
export default _default;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Value } from './schema.js';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
fieldId: string;
|
|
4
|
+
config: Value;
|
|
5
|
+
};
|
|
6
|
+
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>;
|
|
7
|
+
declare const _default: typeof __VLS_export;
|
|
8
|
+
export default _default;
|
package/dist/runtime/components/form/fields/2026-05-24/com.shwfed.form.field.monthrange/runtime.vue
ADDED
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { format as formatDate } from "date-fns";
|
|
3
|
+
import { Effect } from "effect";
|
|
4
|
+
import { computed, ref } 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 { DATE_RANGE_PICKER_DEFAULT_FORMATS, DateRangePicker } from "../../../../ui/date-range-picker";
|
|
10
|
+
import { Field, FieldLabel } from "../../../../ui/field";
|
|
11
|
+
import { Markdown } from "../../../../ui/markdown";
|
|
12
|
+
import { DEFAULT_FIELD_ORIENTATION } from "../../../utils/common";
|
|
13
|
+
import { useFormReadonly } from "../../../utils/readonly";
|
|
14
|
+
import { useFormState } from "../../../utils/state";
|
|
15
|
+
defineOptions({ name: "ShwfedMonthRangeFieldRuntime" });
|
|
16
|
+
const props = defineProps({
|
|
17
|
+
fieldId: { type: String, required: true },
|
|
18
|
+
config: { type: null, required: true }
|
|
19
|
+
});
|
|
20
|
+
const { locale } = useI18n();
|
|
21
|
+
const { state, getAt, setAt } = useFormState();
|
|
22
|
+
const inherited = injectCELContext();
|
|
23
|
+
const $cel = (expression, context) => _rawCel(expression, { ...celBindings(inherited), ...context });
|
|
24
|
+
const labelText = computed(() => getLocalizedText(props.config.label, locale.value));
|
|
25
|
+
const startPlaceholderText = computed(
|
|
26
|
+
() => props.config.startPlaceholder ? getLocalizedText(props.config.startPlaceholder, locale.value) : void 0
|
|
27
|
+
);
|
|
28
|
+
const endPlaceholderText = computed(
|
|
29
|
+
() => props.config.endPlaceholder ? getLocalizedText(props.config.endPlaceholder, locale.value) : void 0
|
|
30
|
+
);
|
|
31
|
+
const tooltipText = computed(
|
|
32
|
+
() => props.config.tooltip ? getLocalizedText(props.config.tooltip, locale.value) : void 0
|
|
33
|
+
);
|
|
34
|
+
function evalBool(expression, label) {
|
|
35
|
+
if (!expression) return false;
|
|
36
|
+
try {
|
|
37
|
+
return Effect.runSync($cel(expression, { form: state.value ?? {} }));
|
|
38
|
+
} catch (err) {
|
|
39
|
+
console.error(`[shwfed-form] failed to evaluate ${label} for ${props.fieldId}:`, err);
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
const isDisabled = computed(() => evalBool(props.config.disabled, "disabled"));
|
|
44
|
+
const formReadonly = useFormReadonly();
|
|
45
|
+
const isReadonly = computed(
|
|
46
|
+
() => props.config.readonly != null ? evalBool(props.config.readonly, "readonly") : formReadonly.value
|
|
47
|
+
);
|
|
48
|
+
const effectiveReadonly = computed(() => isReadonly.value || props.config.derived?.mode === "formula");
|
|
49
|
+
const resolvedValueFormat = computed(
|
|
50
|
+
() => props.config.valueFormat ?? DATE_RANGE_PICKER_DEFAULT_FORMATS.monthrange.value
|
|
51
|
+
);
|
|
52
|
+
const shortcuts = computed(() => {
|
|
53
|
+
const list = props.config.presets;
|
|
54
|
+
if (!list || list.length === 0) return void 0;
|
|
55
|
+
return list.map((preset) => ({
|
|
56
|
+
name: preset.label,
|
|
57
|
+
value: () => {
|
|
58
|
+
try {
|
|
59
|
+
const start = Effect.runSync($cel(preset.start, { form: state.value ?? {} }));
|
|
60
|
+
const end = Effect.runSync($cel(preset.end, { form: state.value ?? {} }));
|
|
61
|
+
return [
|
|
62
|
+
formatDate(start, resolvedValueFormat.value),
|
|
63
|
+
formatDate(end, resolvedValueFormat.value)
|
|
64
|
+
];
|
|
65
|
+
} catch (err) {
|
|
66
|
+
console.error(`[shwfed-form] failed to evaluate preset "${preset.start}" .. "${preset.end}" for ${props.fieldId}:`, err);
|
|
67
|
+
return ["", ""];
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}));
|
|
71
|
+
});
|
|
72
|
+
function asRange(raw) {
|
|
73
|
+
if (!Array.isArray(raw) || raw.length !== 2) return void 0;
|
|
74
|
+
const [a, b] = raw;
|
|
75
|
+
if (typeof a !== "string" || typeof b !== "string") return void 0;
|
|
76
|
+
if (a.length === 0 || b.length === 0) return void 0;
|
|
77
|
+
return [a, b];
|
|
78
|
+
}
|
|
79
|
+
function asString(raw) {
|
|
80
|
+
return typeof raw === "string" && raw.length > 0 ? raw : void 0;
|
|
81
|
+
}
|
|
82
|
+
const uncontrolled = ref(void 0);
|
|
83
|
+
const model = computed({
|
|
84
|
+
get: () => {
|
|
85
|
+
const binding = props.config.binding;
|
|
86
|
+
if (binding == null) return uncontrolled.value;
|
|
87
|
+
if (typeof binding === "string") return asRange(getAt(binding));
|
|
88
|
+
const a = asString(getAt(binding[0]));
|
|
89
|
+
const b = asString(getAt(binding[1]));
|
|
90
|
+
if (a == null || b == null) return void 0;
|
|
91
|
+
return [a, b];
|
|
92
|
+
},
|
|
93
|
+
set: (next) => {
|
|
94
|
+
const binding = props.config.binding;
|
|
95
|
+
if (binding == null) {
|
|
96
|
+
uncontrolled.value = next;
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
if (typeof binding === "string") {
|
|
100
|
+
setAt(binding, next);
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
setAt(binding[0], next?.[0]);
|
|
104
|
+
setAt(binding[1], next?.[1]);
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
const readonlyText = computed(() => {
|
|
108
|
+
const v = model.value;
|
|
109
|
+
if (!v) return "\u2014";
|
|
110
|
+
return `${v[0]} ~ ${v[1]}`;
|
|
111
|
+
});
|
|
112
|
+
</script>
|
|
113
|
+
|
|
114
|
+
<template>
|
|
115
|
+
<Field
|
|
116
|
+
:orientation="config.orientation ?? DEFAULT_FIELD_ORIENTATION"
|
|
117
|
+
:data-disabled="isDisabled || void 0"
|
|
118
|
+
>
|
|
119
|
+
<FieldLabel
|
|
120
|
+
v-if="labelText"
|
|
121
|
+
:for="fieldId"
|
|
122
|
+
class="text-xs text-zinc-500"
|
|
123
|
+
>
|
|
124
|
+
<template
|
|
125
|
+
v-if="tooltipText"
|
|
126
|
+
#tooltip
|
|
127
|
+
>
|
|
128
|
+
<Markdown
|
|
129
|
+
:source="tooltipText"
|
|
130
|
+
class="prose prose-xs prose-zinc"
|
|
131
|
+
/>
|
|
132
|
+
</template>
|
|
133
|
+
{{ labelText }}
|
|
134
|
+
</FieldLabel>
|
|
135
|
+
<div
|
|
136
|
+
v-if="effectiveReadonly"
|
|
137
|
+
class="min-h-9 py-1.5 text-sm text-zinc-700"
|
|
138
|
+
>
|
|
139
|
+
{{ readonlyText }}
|
|
140
|
+
</div>
|
|
141
|
+
<DateRangePicker
|
|
142
|
+
v-else
|
|
143
|
+
:id="fieldId"
|
|
144
|
+
v-model="model"
|
|
145
|
+
type="monthrange"
|
|
146
|
+
:format="config.format"
|
|
147
|
+
:value-format="config.valueFormat"
|
|
148
|
+
:start-placeholder="startPlaceholderText"
|
|
149
|
+
:end-placeholder="endPlaceholderText"
|
|
150
|
+
:range-separator-icon="config.rangeSeparatorIcon"
|
|
151
|
+
:disabled="isDisabled"
|
|
152
|
+
:shortcuts="shortcuts"
|
|
153
|
+
/>
|
|
154
|
+
</Field>
|
|
155
|
+
</template>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Value } from './schema.js';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
fieldId: string;
|
|
4
|
+
config: Value;
|
|
5
|
+
};
|
|
6
|
+
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>;
|
|
7
|
+
declare const _default: typeof __VLS_export;
|
|
8
|
+
export default _default;
|
package/dist/runtime/components/form/fields/2026-05-24/com.shwfed.form.field.monthrange/schema.d.ts
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { Schema } from 'effect';
|
|
2
|
+
import type { Environment } from '../../../../../vendor/cel-js/lib/index.js';
|
|
3
|
+
export declare const type: "com.shwfed.form.field.monthrange";
|
|
4
|
+
export declare const compatibilityDate: "2026-05-24";
|
|
5
|
+
export declare const metadata: {
|
|
6
|
+
readonly name: "月份范围";
|
|
7
|
+
readonly icon: "fluent:calendar-arrow-right-20-regular";
|
|
8
|
+
readonly w: {
|
|
9
|
+
readonly initial: 10;
|
|
10
|
+
readonly min: 10;
|
|
11
|
+
readonly max: number;
|
|
12
|
+
};
|
|
13
|
+
readonly h: {
|
|
14
|
+
readonly initial: 2;
|
|
15
|
+
readonly min: 2;
|
|
16
|
+
readonly max: 2;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
export declare function presetSchema(configure: (env: Environment) => void): Schema.Struct<{
|
|
20
|
+
id: Schema.refine<string, typeof Schema.String>;
|
|
21
|
+
label: Schema.TupleType<readonly [Schema.Struct<{
|
|
22
|
+
locale: Schema.Literal<["zh"]>;
|
|
23
|
+
message: Schema.SchemaClass<string, string, never>;
|
|
24
|
+
}>], [Schema.Struct<{
|
|
25
|
+
locale: Schema.Literal<["ja", "en", "ko"]>;
|
|
26
|
+
message: Schema.SchemaClass<string, string, never>;
|
|
27
|
+
}>]>;
|
|
28
|
+
start: Schema.Schema<string, string, never>;
|
|
29
|
+
end: Schema.Schema<string, string, never>;
|
|
30
|
+
}>;
|
|
31
|
+
export declare function schema(configure: (env: Environment) => void): Schema.Struct<{
|
|
32
|
+
label: Schema.optional<Schema.TupleType<readonly [Schema.Struct<{
|
|
33
|
+
locale: Schema.Literal<["zh"]>;
|
|
34
|
+
message: Schema.SchemaClass<string, string, never>;
|
|
35
|
+
}>], [Schema.Struct<{
|
|
36
|
+
locale: Schema.Literal<["ja", "en", "ko"]>;
|
|
37
|
+
message: Schema.SchemaClass<string, string, never>;
|
|
38
|
+
}>]>>;
|
|
39
|
+
startPlaceholder: Schema.optional<Schema.TupleType<readonly [Schema.Struct<{
|
|
40
|
+
locale: Schema.Literal<["zh"]>;
|
|
41
|
+
message: Schema.SchemaClass<string, string, never>;
|
|
42
|
+
}>], [Schema.Struct<{
|
|
43
|
+
locale: Schema.Literal<["ja", "en", "ko"]>;
|
|
44
|
+
message: Schema.SchemaClass<string, string, never>;
|
|
45
|
+
}>]>>;
|
|
46
|
+
endPlaceholder: Schema.optional<Schema.TupleType<readonly [Schema.Struct<{
|
|
47
|
+
locale: Schema.Literal<["zh"]>;
|
|
48
|
+
message: Schema.SchemaClass<string, string, never>;
|
|
49
|
+
}>], [Schema.Struct<{
|
|
50
|
+
locale: Schema.Literal<["ja", "en", "ko"]>;
|
|
51
|
+
message: Schema.SchemaClass<string, string, never>;
|
|
52
|
+
}>]>>;
|
|
53
|
+
tooltip: Schema.optional<Schema.TupleType<readonly [Schema.Struct<{
|
|
54
|
+
locale: Schema.Literal<["zh"]>;
|
|
55
|
+
message: Schema.SchemaClass<string, string, never>;
|
|
56
|
+
}>], [Schema.Struct<{
|
|
57
|
+
locale: Schema.Literal<["ja", "en", "ko"]>;
|
|
58
|
+
message: Schema.SchemaClass<string, string, never>;
|
|
59
|
+
}>]>>;
|
|
60
|
+
orientation: Schema.optional<Schema.Literal<["vertical", "floating"]>>;
|
|
61
|
+
binding: Schema.optional<Schema.Union<[Schema.filter<typeof Schema.String>, Schema.filter<Schema.Tuple2<Schema.filter<typeof Schema.String>, Schema.filter<typeof Schema.String>>>]>>;
|
|
62
|
+
disabled: Schema.optional<Schema.Schema<string, string, never>>;
|
|
63
|
+
readonly: Schema.optional<Schema.Schema<string, string, never>>;
|
|
64
|
+
derived: Schema.optional<Schema.Struct<{
|
|
65
|
+
mode: Schema.Literal<["formula", "prefill"]>;
|
|
66
|
+
expression: Schema.Schema<string, string, never>;
|
|
67
|
+
}>>;
|
|
68
|
+
format: Schema.optional<Schema.refine<string, typeof Schema.String>>;
|
|
69
|
+
valueFormat: Schema.optional<Schema.refine<string, typeof Schema.String>>;
|
|
70
|
+
rangeSeparatorIcon: Schema.optional<Schema.refine<string, typeof Schema.String>>;
|
|
71
|
+
presets: Schema.optional<Schema.Array$<Schema.Struct<{
|
|
72
|
+
id: Schema.refine<string, typeof Schema.String>;
|
|
73
|
+
label: Schema.TupleType<readonly [Schema.Struct<{
|
|
74
|
+
locale: Schema.Literal<["zh"]>;
|
|
75
|
+
message: Schema.SchemaClass<string, string, never>;
|
|
76
|
+
}>], [Schema.Struct<{
|
|
77
|
+
locale: Schema.Literal<["ja", "en", "ko"]>;
|
|
78
|
+
message: Schema.SchemaClass<string, string, never>;
|
|
79
|
+
}>]>;
|
|
80
|
+
start: Schema.Schema<string, string, never>;
|
|
81
|
+
end: Schema.Schema<string, string, never>;
|
|
82
|
+
}>>>;
|
|
83
|
+
id: Schema.refine<string, typeof Schema.String>;
|
|
84
|
+
displayName: Schema.optional<Schema.SchemaClass<string, string, never>>;
|
|
85
|
+
hidden: Schema.optional<Schema.Schema<string, string, never>>;
|
|
86
|
+
type: Schema.Literal<["com.shwfed.form.field.monthrange"]>;
|
|
87
|
+
compatibilityDate: Schema.Literal<["2026-05-24"]>;
|
|
88
|
+
}>;
|
|
89
|
+
export type Value = Schema.Schema.Type<ReturnType<typeof schema>>;
|
|
90
|
+
export declare function defaults(): Partial<Value>;
|
package/dist/runtime/components/form/fields/2026-05-24/com.shwfed.form.field.monthrange/schema.js
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
import { Expression } from "../../../../../share/expression.js";
|
|
3
|
+
import { Locale } from "../../../../../share/locale.js";
|
|
4
|
+
import { commonFieldFields, derivedField, FieldOrientationSchema } from "../../../utils/common.js";
|
|
5
|
+
export const type = "com.shwfed.form.field.monthrange";
|
|
6
|
+
export const compatibilityDate = "2026-05-24";
|
|
7
|
+
const BindingPath = Schema.String.pipe(Schema.minLength(1));
|
|
8
|
+
const SplitBinding = Schema.Tuple(BindingPath, BindingPath).pipe(
|
|
9
|
+
Schema.filter(([a, b]) => a !== b, {
|
|
10
|
+
message: () => "\u8D77\u59CB\u4E0E\u7ED3\u675F\u7ED1\u5B9A\u8DEF\u5F84\u4E0D\u80FD\u76F8\u540C"
|
|
11
|
+
})
|
|
12
|
+
);
|
|
13
|
+
const bindingSchema = Schema.Union(BindingPath, SplitBinding).annotations({
|
|
14
|
+
title: "\u7ED1\u5B9A\u8DEF\u5F84",
|
|
15
|
+
description: "\u5199\u5165\u8868\u5355\u72B6\u6001\u7684 `dot-prop` \u8DEF\u5F84\uFF1B\u586B\u5199\u5355\u4E2A\u8DEF\u5F84\u65F6\u5199\u5165 `[start, end]` \u5B57\u7B26\u4E32\u6570\u7EC4\uFF0C\u4F8B\u5982 `event.months`\uFF1B\u586B\u5199 `[\u8D77\u59CB\u8DEF\u5F84, \u7ED3\u675F\u8DEF\u5F84]` \u5143\u7EC4\u65F6\u5206\u522B\u5199\u5165\u4E24\u7AEF\uFF1B\u7559\u7A7A\u5219\u4E3A\u975E\u53D7\u63A7\u5B57\u6BB5"
|
|
16
|
+
});
|
|
17
|
+
export const metadata = {
|
|
18
|
+
name: "\u6708\u4EFD\u8303\u56F4",
|
|
19
|
+
icon: "fluent:calendar-arrow-right-20-regular",
|
|
20
|
+
w: { initial: 10, min: 10, max: Infinity },
|
|
21
|
+
h: { initial: 2, min: 2, max: 2 }
|
|
22
|
+
};
|
|
23
|
+
export function presetSchema(configure) {
|
|
24
|
+
const CelDate = Expression({ configure, resultType: "Date" });
|
|
25
|
+
return Schema.Struct({
|
|
26
|
+
id: Schema.UUID.annotations({ description: "\u9884\u8BBE\u552F\u4E00\u6807\u8BC6\uFF0C\u7528\u4E8E\u7A33\u5B9A\u7684 v-for key" }),
|
|
27
|
+
label: Locale.annotations({
|
|
28
|
+
title: "\u6807\u7B7E",
|
|
29
|
+
description: "\u5FEB\u6377\u9009\u9879\u5C55\u793A\u7684\u672C\u5730\u5316\u6587\u672C"
|
|
30
|
+
}),
|
|
31
|
+
start: CelDate.annotations({
|
|
32
|
+
title: "\u8D77\u59CB\u503C",
|
|
33
|
+
description: '\u70B9\u51FB\u8BE5\u9884\u8BBE\u65F6\u8BA1\u7B97\u51FA\u7684\u8D77\u59CB\u6708\u4EFD\uFF0C\u4F8B\u5982 `now.offset(-3, "months")`'
|
|
34
|
+
}),
|
|
35
|
+
end: CelDate.annotations({
|
|
36
|
+
title: "\u7ED3\u675F\u503C",
|
|
37
|
+
description: "\u70B9\u51FB\u8BE5\u9884\u8BBE\u65F6\u8BA1\u7B97\u51FA\u7684\u7ED3\u675F\u6708\u4EFD\uFF0C\u4F8B\u5982 `now`"
|
|
38
|
+
})
|
|
39
|
+
}).annotations({
|
|
40
|
+
title: "MonthRangeFieldPreset"
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
export function schema(configure) {
|
|
44
|
+
const CelBool = Expression({ configure, resultType: "bool" });
|
|
45
|
+
const Preset = presetSchema(configure);
|
|
46
|
+
return Schema.Struct({
|
|
47
|
+
type: Schema.Literal(type),
|
|
48
|
+
compatibilityDate: Schema.Literal(compatibilityDate),
|
|
49
|
+
...commonFieldFields(configure),
|
|
50
|
+
label: Schema.optional(Locale.annotations({
|
|
51
|
+
title: "\u6807\u7B7E",
|
|
52
|
+
description: "\u5B57\u6BB5\u524D\u5C55\u793A\u7684\u6587\u672C\uFF1B\u7559\u7A7A\u5219\u4E0D\u6E32\u67D3\u6807\u7B7E"
|
|
53
|
+
})),
|
|
54
|
+
startPlaceholder: Schema.optional(Locale.annotations({
|
|
55
|
+
title: "\u8D77\u59CB\u5360\u4F4D\u7B26",
|
|
56
|
+
description: "\u672A\u9009\u4E2D\u8D77\u59CB\u6708\u4EFD\u65F6\u8F93\u5165\u6846\u4E2D\u7684\u5360\u4F4D\u6587\u672C"
|
|
57
|
+
})),
|
|
58
|
+
endPlaceholder: Schema.optional(Locale.annotations({
|
|
59
|
+
title: "\u7ED3\u675F\u5360\u4F4D\u7B26",
|
|
60
|
+
description: "\u672A\u9009\u4E2D\u7ED3\u675F\u6708\u4EFD\u65F6\u8F93\u5165\u6846\u4E2D\u7684\u5360\u4F4D\u6587\u672C"
|
|
61
|
+
})),
|
|
62
|
+
tooltip: Schema.optional(Locale.annotations({
|
|
63
|
+
title: "\u63D0\u793A",
|
|
64
|
+
description: "\u9F20\u6807\u60AC\u505C\u5728\u6807\u7B7E\u4E0A\u65F6\u5C55\u793A\u7684\u8BF4\u660E"
|
|
65
|
+
})),
|
|
66
|
+
orientation: Schema.optional(FieldOrientationSchema),
|
|
67
|
+
binding: Schema.optional(bindingSchema),
|
|
68
|
+
disabled: Schema.optional(CelBool.annotations({
|
|
69
|
+
title: "\u7981\u7528\u6761\u4EF6",
|
|
70
|
+
description: "\u8FD4\u56DE `true` \u65F6\u8F93\u5165\u6846\u4ECD\u7136\u6E32\u67D3\u4F46\u4E0D\u53EF\u7F16\u8F91"
|
|
71
|
+
})),
|
|
72
|
+
readonly: Schema.optional(CelBool.annotations({
|
|
73
|
+
title: "\u53EA\u8BFB\u6761\u4EF6",
|
|
74
|
+
description: "\u8FD4\u56DE `true` \u65F6\u4EC5\u4EE5\u7EAF\u6587\u672C\u5C55\u793A\u5F53\u524D\u503C"
|
|
75
|
+
})),
|
|
76
|
+
derived: derivedField(configure, "dyn"),
|
|
77
|
+
format: Schema.optional(Schema.String.pipe(Schema.minLength(1)).annotations({
|
|
78
|
+
title: "\u5C55\u793A\u683C\u5F0F",
|
|
79
|
+
description: "\u8F93\u5165\u6846\u4E2D\u5C55\u793A\u6708\u4EFD\u7684 `date-fns` \u683C\u5F0F\u4E32\uFF1B\u7559\u7A7A\u65F6\u4F7F\u7528\u9ED8\u8BA4 `yyyy-MM`"
|
|
80
|
+
})),
|
|
81
|
+
valueFormat: Schema.optional(Schema.String.pipe(Schema.minLength(1)).annotations({
|
|
82
|
+
title: "\u5B58\u50A8\u683C\u5F0F",
|
|
83
|
+
description: "\u5199\u5165\u8868\u5355\u72B6\u6001\u7684 `date-fns` \u683C\u5F0F\u4E32\uFF1B\u7559\u7A7A\u65F6\u4F7F\u7528\u9ED8\u8BA4 `yyyy-MM`"
|
|
84
|
+
})),
|
|
85
|
+
rangeSeparatorIcon: Schema.optional(Schema.String.pipe(Schema.minLength(1)).annotations({
|
|
86
|
+
title: "\u8303\u56F4\u5206\u9694\u56FE\u6807",
|
|
87
|
+
description: "\u8303\u56F4\u4E24\u7AEF\u4E4B\u95F4\u5206\u9694\u56FE\u6807\u7684 Iconify \u540D\u79F0"
|
|
88
|
+
})),
|
|
89
|
+
presets: Schema.optional(Schema.Array(Preset).annotations({
|
|
90
|
+
title: "\u5FEB\u6377\u9009\u9879",
|
|
91
|
+
description: "\u5728\u9009\u62E9\u5668\u5E95\u90E8\u5C55\u793A\u7684\u5FEB\u6377\u9884\u8BBE\uFF1B\u7559\u7A7A\u5219\u4E0D\u6E32\u67D3"
|
|
92
|
+
}))
|
|
93
|
+
}).annotations({
|
|
94
|
+
title: "MonthRangeField",
|
|
95
|
+
description: "\u6708\u4EFD\u8303\u56F4\u9009\u62E9\u8F93\u5165"
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
export function defaults() {
|
|
99
|
+
return { rangeSeparatorIcon: "fluent:arrow-right-20-regular" };
|
|
100
|
+
}
|
|
@@ -23,6 +23,13 @@ declare const __VLS_export: <Node>(__VLS_props: NonNullable<Awaited<typeof __VLS
|
|
|
23
23
|
filterQuery?: string;
|
|
24
24
|
/** Initial expanded set (uncontrolled). */
|
|
25
25
|
initialExpanded?: NodeKey[];
|
|
26
|
+
/**
|
|
27
|
+
* Paint the focused row with a subtle background. Keyboard navigation
|
|
28
|
+
* still tracks focus either way — this only controls the visual. Forms
|
|
29
|
+
* and similar surfaces that don't expose keyboard nav to users can turn
|
|
30
|
+
* it off so a stray click doesn't leave a permanent highlight.
|
|
31
|
+
*/
|
|
32
|
+
showFocusedRow?: boolean;
|
|
26
33
|
} & {
|
|
27
34
|
onMove?: ((payload: MoveEventPayload) => any) | undefined;
|
|
28
35
|
"onUpdate:modelValue"?: ((value: string | string[] | undefined) => any) | undefined;
|
|
@@ -16,7 +16,8 @@ const props = defineProps({
|
|
|
16
16
|
canDrop: { type: Function, required: false, default: void 0 },
|
|
17
17
|
filterPredicate: { type: Function, required: false, default: void 0 },
|
|
18
18
|
filterQuery: { type: String, required: false, default: "" },
|
|
19
|
-
initialExpanded: { type: Array, required: false, default: () => [] }
|
|
19
|
+
initialExpanded: { type: Array, required: false, default: () => [] },
|
|
20
|
+
showFocusedRow: { type: Boolean, required: false, default: true }
|
|
20
21
|
});
|
|
21
22
|
const emit = defineEmits(["update:modelValue", "update:roots", "move"]);
|
|
22
23
|
defineSlots();
|
|
@@ -275,6 +276,7 @@ const selectedPanePayload = computed(() => ({
|
|
|
275
276
|
:is-expandable="isExpandable"
|
|
276
277
|
:tree="tree"
|
|
277
278
|
:focused-key="state.focusedKey.value"
|
|
279
|
+
:show-focused-row="showFocusedRow"
|
|
278
280
|
@toggle-expand="handleToggleExpand"
|
|
279
281
|
@toggle-select="handleToggleSelect"
|
|
280
282
|
@focus-row="handleFocusRow"
|
|
@@ -23,6 +23,13 @@ declare const __VLS_export: <Node>(__VLS_props: NonNullable<Awaited<typeof __VLS
|
|
|
23
23
|
filterQuery?: string;
|
|
24
24
|
/** Initial expanded set (uncontrolled). */
|
|
25
25
|
initialExpanded?: NodeKey[];
|
|
26
|
+
/**
|
|
27
|
+
* Paint the focused row with a subtle background. Keyboard navigation
|
|
28
|
+
* still tracks focus either way — this only controls the visual. Forms
|
|
29
|
+
* and similar surfaces that don't expose keyboard nav to users can turn
|
|
30
|
+
* it off so a stray click doesn't leave a permanent highlight.
|
|
31
|
+
*/
|
|
32
|
+
showFocusedRow?: boolean;
|
|
26
33
|
} & {
|
|
27
34
|
onMove?: ((payload: MoveEventPayload) => any) | undefined;
|
|
28
35
|
"onUpdate:modelValue"?: ((value: string | string[] | undefined) => any) | undefined;
|
|
@@ -25,6 +25,7 @@ declare const __VLS_export: <Node>(__VLS_props: NonNullable<Awaited<typeof __VLS
|
|
|
25
25
|
isExpandable: (n: Node) => boolean;
|
|
26
26
|
tree: TreeHandle<Node>;
|
|
27
27
|
focusedKey: NodeKey | null;
|
|
28
|
+
showFocusedRow: boolean;
|
|
28
29
|
} & {
|
|
29
30
|
"onToggle-expand"?: ((key: string) => any) | undefined;
|
|
30
31
|
"onToggle-select"?: ((key: string) => any) | undefined;
|
|
@@ -27,7 +27,8 @@ const props = defineProps({
|
|
|
27
27
|
filterQuery: { type: String, required: true },
|
|
28
28
|
isExpandable: { type: Function, required: true },
|
|
29
29
|
tree: { type: Object, required: true },
|
|
30
|
-
focusedKey: { type: [String, null], required: true }
|
|
30
|
+
focusedKey: { type: [String, null], required: true },
|
|
31
|
+
showFocusedRow: { type: Boolean, required: true }
|
|
31
32
|
});
|
|
32
33
|
const emit = defineEmits(["toggle-expand", "toggle-select", "focus-row"]);
|
|
33
34
|
defineSlots();
|
|
@@ -109,7 +110,7 @@ const showChildren = computed(
|
|
|
109
110
|
v-if="subtreeMatches"
|
|
110
111
|
:class="cn(
|
|
111
112
|
'group flex items-center justify-between gap-2 rounded px-1 py-1 outline-none',
|
|
112
|
-
focusedKey === key && 'bg-(--primary)/10'
|
|
113
|
+
showFocusedRow && focusedKey === key && 'bg-(--primary)/10'
|
|
113
114
|
)"
|
|
114
115
|
tabindex="-1"
|
|
115
116
|
@click.stop="emit('focus-row', key)"
|
|
@@ -250,6 +251,7 @@ const showChildren = computed(
|
|
|
250
251
|
:is-expandable="isExpandable"
|
|
251
252
|
:tree="tree"
|
|
252
253
|
:focused-key="focusedKey"
|
|
254
|
+
:show-focused-row="showFocusedRow"
|
|
253
255
|
@toggle-expand="(k) => emit('toggle-expand', k)"
|
|
254
256
|
@toggle-select="(k) => emit('toggle-select', k)"
|
|
255
257
|
@focus-row="(k) => emit('focus-row', k)"
|
|
@@ -25,6 +25,7 @@ declare const __VLS_export: <Node>(__VLS_props: NonNullable<Awaited<typeof __VLS
|
|
|
25
25
|
isExpandable: (n: Node) => boolean;
|
|
26
26
|
tree: TreeHandle<Node>;
|
|
27
27
|
focusedKey: NodeKey | null;
|
|
28
|
+
showFocusedRow: boolean;
|
|
28
29
|
} & {
|
|
29
30
|
"onToggle-expand"?: ((key: string) => any) | undefined;
|
|
30
31
|
"onToggle-select"?: ((key: string) => any) | undefined;
|