@shwfed/config 2.10.10 → 2.10.12
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 +1043 -880
- package/dist/module.json +1 -1
- package/dist/preview/assets/{FieldGroup.vue_vue_type_script_setup_true_lang-CsPU4iZU.js → FieldGroup.vue_vue_type_script_setup_true_lang-BeqytPDr.js} +1 -1
- package/dist/preview/assets/{badge-B953zx7V.js → badge-DkHwLDps.js} +1 -1
- package/dist/preview/assets/{config-B-o7DV04.js → config-7KeAl8UU.js} +1 -1
- package/dist/preview/assets/{config-D5m2C0xK.js → config-CVPVYMuh.js} +1 -1
- package/dist/preview/assets/{config-BajA-dJ1.js → config-CZ1e9utV.js} +1 -1
- package/dist/preview/assets/{config-C2-lrcCq.js → config-Cedm-E2H.js} +1 -1
- package/dist/preview/assets/{config-CFWXRIOe.js → config-Cft-srKd.js} +1 -1
- package/dist/preview/assets/{config-DAJ25V43.js → config-Cy6Eix27.js} +1 -1
- package/dist/preview/assets/{config-DqAigk_E.js → config-DAZ2Uj6B.js} +1 -1
- package/dist/preview/assets/{config-DmgHMdSz.js → config-DCANpbtq.js} +1 -1
- package/dist/preview/assets/{config-CqMqqE_9.js → config-DJQ2LOWo.js} +1 -1
- package/dist/preview/assets/{config-C4Twz5UA.js → config-DQVKd54J.js} +1 -1
- package/dist/preview/assets/{config-BjdMNJwa.js → config-DbV3RlZz.js} +1 -1
- package/dist/preview/assets/{config-C3v6QvLS.js → config-Dx1SXsSf.js} +1 -1
- package/dist/preview/assets/{config-DpEkjTKt.js → config-OPQWANCx.js} +1 -1
- package/dist/preview/assets/{config-C0xCcVfy.js → config-Uw4cvZGX.js} +1 -1
- package/dist/preview/assets/{definition.vue_vue_type_script_setup_true_lang-WNrh1xWy.js → definition.vue_vue_type_script_setup_true_lang-D4Gh9PzS.js} +1 -1
- package/dist/preview/assets/{index-BdS7dokp.js → index-B3HnlKis.js} +193 -193
- package/dist/preview/assets/index-BAY6NLoo.css +1 -0
- package/dist/preview/assets/{index-Bv_Ig-Tl.js → index-Cum0oK9u.js} +1 -1
- package/dist/preview/assets/index-CxUuhfsO.js +1 -0
- package/dist/preview/assets/{item-caTb4x-x.js → item-H4QeOpnC.js} +1 -1
- package/dist/preview/assets/{runtime-7ThCZ17X.js → runtime-BotFX6qJ.js} +1 -1
- package/dist/preview/assets/{runtime-DELhNsaH.js → runtime-C3532B0Y.js} +1 -1
- package/dist/preview/assets/{runtime-Bnaxoocd.js → runtime-CNMjRr9Y.js} +1 -1
- package/dist/preview/assets/{runtime-d4XHvjgW.js → runtime-CTnwTJlw.js} +1 -1
- package/dist/preview/assets/{runtime-CIWhgS6a.js → runtime-CwgX0PuH.js} +1 -1
- package/dist/preview/assets/{runtime-C8_u1NyC.js → runtime-D5HcLLLR.js} +1 -1
- package/dist/preview/assets/{runtime-B-tUuLEY.js → runtime-DvCHNIPq.js} +1 -1
- package/dist/preview/assets/{runtime-C9lZq_oo.js → runtime-cKOD2A6u.js} +1 -1
- package/dist/preview/assets/{runtime-D6EIpId9.js → runtime-ibuFFD1K.js} +1 -1
- package/dist/preview/assets/{runtime-CZrQz2RJ.js → runtime-sPGVp7yA.js} +1 -1
- package/dist/preview/assets/{schema-meta-Cf59HabB.js → schema-meta-DtZNwp3h.js} +1 -1
- package/dist/preview/index.html +2 -2
- package/dist/runtime/components/actions/components/group.d.vue.ts +2 -2
- package/dist/runtime/components/actions/components/group.vue.d.ts +2 -2
- package/dist/runtime/components/form/fields/2026-04-24/com.shwfed.form.field.actions/runtime.vue +1 -0
- package/dist/runtime/components/form/fields/2026-05-23/com.shwfed.form.field.tree.multi/config.d.vue.ts +22 -22
- package/dist/runtime/components/form/fields/2026-05-23/com.shwfed.form.field.tree.multi/config.vue.d.ts +22 -22
- package/dist/runtime/components/form/fields/2026-05-26/com.shwfed.form.field.tree.combobox.multi/config.d.vue.ts +22 -22
- package/dist/runtime/components/form/fields/2026-05-26/com.shwfed.form.field.tree.combobox.multi/config.vue.d.ts +22 -22
- package/dist/runtime/components/form/fields/2026-05-26/com.shwfed.form.field.tree.combobox.single/config.d.vue.ts +22 -22
- package/dist/runtime/components/form/fields/2026-05-26/com.shwfed.form.field.tree.combobox.single/config.vue.d.ts +22 -22
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.combobox.multi/config.d.vue.ts +22 -22
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.combobox.multi/config.vue.d.ts +22 -22
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.combobox.single/config.d.vue.ts +22 -22
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.combobox.single/config.vue.d.ts +22 -22
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.multi/config.d.vue.ts +22 -22
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.multi/config.vue.d.ts +22 -22
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.single/config.d.vue.ts +22 -22
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.single/config.vue.d.ts +22 -22
- package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.number-input/config.vue +83 -3
- package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.number-input/runtime.vue +28 -0
- package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.number-input/schema.d.ts +132 -0
- package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.number-input/schema.js +19 -2
- package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.text-input/config.vue +82 -2
- package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.text-input/runtime.vue +28 -0
- package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.text-input/schema.d.ts +132 -0
- package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.text-input/schema.js +19 -2
- package/dist/runtime/components/table/columns/2026-06-17/com.shwfed.table.column.date-input/runtime.vue +8 -0
- package/dist/runtime/components/table/columns/2026-06-22/com.shwfed.table.column.date-range-input/config.d.vue.ts +10 -0
- package/dist/runtime/components/table/columns/2026-06-22/com.shwfed.table.column.date-range-input/config.vue +717 -0
- package/dist/runtime/components/table/columns/2026-06-22/com.shwfed.table.column.date-range-input/config.vue.d.ts +10 -0
- package/dist/runtime/components/table/columns/2026-06-22/com.shwfed.table.column.date-range-input/runtime.d.vue.ts +9 -0
- package/dist/runtime/components/table/columns/2026-06-22/com.shwfed.table.column.date-range-input/runtime.vue +152 -0
- package/dist/runtime/components/table/columns/2026-06-22/com.shwfed.table.column.date-range-input/runtime.vue.d.ts +9 -0
- package/dist/runtime/components/table/columns/2026-06-22/com.shwfed.table.column.date-range-input/schema.d.ts +87 -0
- package/dist/runtime/components/table/columns/2026-06-22/com.shwfed.table.column.date-range-input/schema.js +122 -0
- package/dist/runtime/components/ui/date-picker/DatePicker.d.vue.ts +1 -0
- package/dist/runtime/components/ui/date-picker/DatePicker.vue +3 -0
- package/dist/runtime/components/ui/date-picker/DatePicker.vue.d.ts +1 -0
- package/dist/runtime/components/ui/date-range-picker/DateRangePicker.d.vue.ts +1 -0
- package/dist/runtime/components/ui/date-range-picker/DateRangePicker.vue +2 -0
- package/dist/runtime/components/ui/date-range-picker/DateRangePicker.vue.d.ts +1 -0
- package/package.json +1 -1
- package/dist/preview/assets/index-BkwnC_tl.js +0 -1
- package/dist/preview/assets/index-Cc4BT5dc.css +0 -1
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
type __VLS_ModelProps = {
|
|
2
|
+
modelValue: Record<string, any>;
|
|
3
|
+
};
|
|
4
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
5
|
+
"update:modelValue": (value: Record<string, any>) => any;
|
|
6
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_ModelProps> & Readonly<{
|
|
7
|
+
"onUpdate:modelValue"?: ((value: Record<string, any>) => any) | undefined;
|
|
8
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
9
|
+
declare const _default: typeof __VLS_export;
|
|
10
|
+
export default _default;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { CellContext } from '@tanstack/vue-table';
|
|
2
|
+
import type { Value } from './schema.js';
|
|
3
|
+
type __VLS_Props = {
|
|
4
|
+
column: Value;
|
|
5
|
+
ctx: CellContext<unknown, unknown>;
|
|
6
|
+
};
|
|
7
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
8
|
+
declare const _default: typeof __VLS_export;
|
|
9
|
+
export default _default;
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { Effect } from "effect";
|
|
3
|
+
import { computed } from "vue";
|
|
4
|
+
import { useI18n } from "vue-i18n";
|
|
5
|
+
import { format as formatDate } from "date-fns";
|
|
6
|
+
import { cel as $cel } from "../../../../../utils/cel";
|
|
7
|
+
import { celBindings, injectCELContext } from "../../../../../utils/cel-context";
|
|
8
|
+
import { useFormReadonly } from "../../../../form/utils/readonly";
|
|
9
|
+
import { getLocalizedText } from "../../../../../share/locale";
|
|
10
|
+
import { DATE_RANGE_PICKER_DEFAULT_FORMATS, DateRangePicker } from "../../../../ui/date-range-picker";
|
|
11
|
+
import { useFormState } from "../../../../form/utils/state";
|
|
12
|
+
defineOptions({ name: "ShwfedTableDateRangeInputRendererRuntime" });
|
|
13
|
+
const props = defineProps({
|
|
14
|
+
column: { type: null, required: true },
|
|
15
|
+
ctx: { type: Object, required: true }
|
|
16
|
+
});
|
|
17
|
+
const { locale } = useI18n();
|
|
18
|
+
const celContext = injectCELContext();
|
|
19
|
+
const { getAt, setAt } = useFormState();
|
|
20
|
+
const startPlaceholderText = computed(
|
|
21
|
+
() => props.column.startPlaceholder ? getLocalizedText(props.column.startPlaceholder, locale.value) : void 0
|
|
22
|
+
);
|
|
23
|
+
const endPlaceholderText = computed(
|
|
24
|
+
() => props.column.endPlaceholder ? getLocalizedText(props.column.endPlaceholder, locale.value) : void 0
|
|
25
|
+
);
|
|
26
|
+
function evalBool(expression, label) {
|
|
27
|
+
if (!expression) return false;
|
|
28
|
+
try {
|
|
29
|
+
return Effect.runSync($cel(expression, celBindings(celContext))) === true;
|
|
30
|
+
} catch (e) {
|
|
31
|
+
console.error(`[shwfed-table] date-range-input ${label} failed`, e);
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
const isHidden = computed(() => evalBool(props.column.hidden, "hidden"));
|
|
36
|
+
const isDisabled = computed(() => evalBool(props.column.disabled, "disabled"));
|
|
37
|
+
const formReadonly = useFormReadonly();
|
|
38
|
+
const isReadonly = computed(
|
|
39
|
+
() => props.column.readonly != null ? evalBool(props.column.readonly, "readonly") : formReadonly.value
|
|
40
|
+
);
|
|
41
|
+
const effectiveReadonly = computed(
|
|
42
|
+
() => isReadonly.value || props.column.derived?.mode === "formula"
|
|
43
|
+
);
|
|
44
|
+
const resolvedValueFormat = computed(
|
|
45
|
+
() => props.column.valueFormat ?? DATE_RANGE_PICKER_DEFAULT_FORMATS.daterange.value
|
|
46
|
+
);
|
|
47
|
+
const shortcuts = computed(() => {
|
|
48
|
+
const list = props.column.presets;
|
|
49
|
+
if (!list || list.length === 0) return void 0;
|
|
50
|
+
return list.map((preset) => ({
|
|
51
|
+
name: preset.label,
|
|
52
|
+
value: () => {
|
|
53
|
+
try {
|
|
54
|
+
const start = Effect.runSync($cel(preset.start, celBindings(celContext)));
|
|
55
|
+
const end = Effect.runSync($cel(preset.end, celBindings(celContext)));
|
|
56
|
+
return [
|
|
57
|
+
formatDate(start, resolvedValueFormat.value),
|
|
58
|
+
formatDate(end, resolvedValueFormat.value)
|
|
59
|
+
];
|
|
60
|
+
} catch (e) {
|
|
61
|
+
console.error(`[shwfed-table] date-range-input preset "${preset.start}" .. "${preset.end}" failed`, e);
|
|
62
|
+
return ["", ""];
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}));
|
|
66
|
+
});
|
|
67
|
+
function asRange(raw) {
|
|
68
|
+
if (!Array.isArray(raw) || raw.length !== 2) return void 0;
|
|
69
|
+
const [a, b] = raw;
|
|
70
|
+
if (typeof a !== "string" || typeof b !== "string") return void 0;
|
|
71
|
+
if (a.length === 0 || b.length === 0) return void 0;
|
|
72
|
+
return [a, b];
|
|
73
|
+
}
|
|
74
|
+
function asString(raw) {
|
|
75
|
+
return typeof raw === "string" && raw.length > 0 ? raw : void 0;
|
|
76
|
+
}
|
|
77
|
+
const model = computed({
|
|
78
|
+
get: () => {
|
|
79
|
+
const binding = props.column.binding;
|
|
80
|
+
if (typeof binding === "string") return asRange(getAt(binding));
|
|
81
|
+
const a = asString(getAt(binding[0]));
|
|
82
|
+
const b = asString(getAt(binding[1]));
|
|
83
|
+
if (a == null || b == null) return void 0;
|
|
84
|
+
return [a, b];
|
|
85
|
+
},
|
|
86
|
+
set: (next) => {
|
|
87
|
+
const binding = props.column.binding;
|
|
88
|
+
if (typeof binding === "string") {
|
|
89
|
+
setAt(binding, next ?? null);
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
setAt(binding[0], next?.[0] ?? null);
|
|
93
|
+
setAt(binding[1], next?.[1] ?? null);
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
const readonlyText = computed(() => {
|
|
97
|
+
const v = model.value;
|
|
98
|
+
if (!v) return null;
|
|
99
|
+
return `${v[0]} ~ ${v[1]}`;
|
|
100
|
+
});
|
|
101
|
+
</script>
|
|
102
|
+
|
|
103
|
+
<template>
|
|
104
|
+
<!--
|
|
105
|
+
Row budget matches the editable input columns: 2px outer inset around a 28px
|
|
106
|
+
(`h-7`) control — total 32px. Every branch (hidden / readonly / editable) is
|
|
107
|
+
sized identically so rows do not jump when a CEL condition flips.
|
|
108
|
+
-->
|
|
109
|
+
<div class="p-[0.125rem] w-full">
|
|
110
|
+
<span
|
|
111
|
+
v-if="isHidden"
|
|
112
|
+
class="block h-7 w-full"
|
|
113
|
+
/>
|
|
114
|
+
<!--
|
|
115
|
+
Readonly empty state mirrors the other editable columns: a centered, faded,
|
|
116
|
+
non-selectable `-` so a readonly grid reads uniformly. A non-empty readonly
|
|
117
|
+
range keeps left-aligned dark text joined by `~`.
|
|
118
|
+
-->
|
|
119
|
+
<span
|
|
120
|
+
v-else-if="effectiveReadonly"
|
|
121
|
+
:class="[
|
|
122
|
+
'flex items-center h-7 w-full px-2 text-[0.75rem] truncate',
|
|
123
|
+
readonlyText ? 'text-zinc-700' : 'justify-center font-mono text-zinc-300 select-none'
|
|
124
|
+
]"
|
|
125
|
+
>
|
|
126
|
+
{{ readonlyText || "-" }}
|
|
127
|
+
</span>
|
|
128
|
+
<!--
|
|
129
|
+
Idle border is faded to 30% so a whole grid of date cells reads as data,
|
|
130
|
+
not chrome — `hover:` / `focus-within:` snap it back to full so the active
|
|
131
|
+
cell stands out. Mirrors the `date-input` column exactly; routed to the
|
|
132
|
+
inner range input via `input-class` because `class` lands on the
|
|
133
|
+
DateRangePicker's anchor wrapper, not the input.
|
|
134
|
+
-->
|
|
135
|
+
<DateRangePicker
|
|
136
|
+
v-else
|
|
137
|
+
v-model="model"
|
|
138
|
+
type="daterange"
|
|
139
|
+
size="sm"
|
|
140
|
+
class="w-full"
|
|
141
|
+
input-class="border-zinc-200/30 hover:border-zinc-200 focus-within:border-zinc-200 transition-colors ease-out duration-180"
|
|
142
|
+
:format="column.format"
|
|
143
|
+
:value-format="column.valueFormat"
|
|
144
|
+
:start-placeholder="startPlaceholderText"
|
|
145
|
+
:end-placeholder="endPlaceholderText"
|
|
146
|
+
:range-separator-icon="column.rangeSeparatorIcon"
|
|
147
|
+
:number-of-months="column.numberOfMonths"
|
|
148
|
+
:disabled="isDisabled"
|
|
149
|
+
:shortcuts="shortcuts"
|
|
150
|
+
/>
|
|
151
|
+
</div>
|
|
152
|
+
</template>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { CellContext } from '@tanstack/vue-table';
|
|
2
|
+
import type { Value } from './schema.js';
|
|
3
|
+
type __VLS_Props = {
|
|
4
|
+
column: Value;
|
|
5
|
+
ctx: CellContext<unknown, unknown>;
|
|
6
|
+
};
|
|
7
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
8
|
+
declare const _default: typeof __VLS_export;
|
|
9
|
+
export default _default;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { Schema } from 'effect';
|
|
2
|
+
import type { ColumnDef } from '@tanstack/vue-table';
|
|
3
|
+
import type { Environment } from '../../../../../vendor/cel-js/lib/index.js';
|
|
4
|
+
import type { ColumnDefDeps } from '../../../utils/resolve.js';
|
|
5
|
+
export declare const type: "com.shwfed.table.column.date-range-input";
|
|
6
|
+
export declare const compatibilityDate: "2026-06-22";
|
|
7
|
+
export declare const metadata: {
|
|
8
|
+
readonly name: "日期范围输入";
|
|
9
|
+
readonly icon: "fluent:calendar-arrow-right-20-regular";
|
|
10
|
+
};
|
|
11
|
+
export declare function presetSchema(configure: (env: Environment) => void): Schema.Struct<{
|
|
12
|
+
id: Schema.refine<string, typeof Schema.String>;
|
|
13
|
+
label: Schema.TupleType<readonly [Schema.Struct<{
|
|
14
|
+
locale: Schema.Literal<["zh"]>;
|
|
15
|
+
message: Schema.SchemaClass<string, string, never>;
|
|
16
|
+
}>], [Schema.Struct<{
|
|
17
|
+
locale: Schema.Literal<["ja", "en", "ko"]>;
|
|
18
|
+
message: Schema.SchemaClass<string, string, never>;
|
|
19
|
+
}>]>;
|
|
20
|
+
start: Schema.Schema<string, string, never>;
|
|
21
|
+
end: Schema.Schema<string, string, never>;
|
|
22
|
+
}>;
|
|
23
|
+
export declare function schema(configure: (env: Environment) => void): Schema.Struct<{
|
|
24
|
+
binding: Schema.Union<[Schema.filter<typeof Schema.String>, Schema.filter<Schema.Tuple2<Schema.filter<typeof Schema.String>, Schema.filter<typeof Schema.String>>>]>;
|
|
25
|
+
startPlaceholder: Schema.optional<Schema.TupleType<readonly [Schema.Struct<{
|
|
26
|
+
locale: Schema.Literal<["zh"]>;
|
|
27
|
+
message: Schema.SchemaClass<string, string, never>;
|
|
28
|
+
}>], [Schema.Struct<{
|
|
29
|
+
locale: Schema.Literal<["ja", "en", "ko"]>;
|
|
30
|
+
message: Schema.SchemaClass<string, string, never>;
|
|
31
|
+
}>]>>;
|
|
32
|
+
endPlaceholder: 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
|
+
hidden: Schema.optional<Schema.Schema<string, string, never>>;
|
|
40
|
+
disabled: Schema.optional<Schema.Schema<string, string, never>>;
|
|
41
|
+
readonly: Schema.optional<Schema.Schema<string, string, never>>;
|
|
42
|
+
derived: Schema.optional<Schema.Struct<{
|
|
43
|
+
mode: Schema.Literal<["formula", "prefill"]>;
|
|
44
|
+
expression: Schema.Schema<string, string, never>;
|
|
45
|
+
}>>;
|
|
46
|
+
format: Schema.optional<Schema.refine<string, typeof Schema.String>>;
|
|
47
|
+
valueFormat: Schema.optional<Schema.refine<string, typeof Schema.String>>;
|
|
48
|
+
rangeSeparatorIcon: Schema.optional<Schema.refine<string, typeof Schema.String>>;
|
|
49
|
+
numberOfMonths: Schema.optional<Schema.refine<number, Schema.filter<typeof Schema.Number>>>;
|
|
50
|
+
presets: Schema.optional<Schema.Array$<Schema.Struct<{
|
|
51
|
+
id: Schema.refine<string, typeof Schema.String>;
|
|
52
|
+
label: Schema.TupleType<readonly [Schema.Struct<{
|
|
53
|
+
locale: Schema.Literal<["zh"]>;
|
|
54
|
+
message: Schema.SchemaClass<string, string, never>;
|
|
55
|
+
}>], [Schema.Struct<{
|
|
56
|
+
locale: Schema.Literal<["ja", "en", "ko"]>;
|
|
57
|
+
message: Schema.SchemaClass<string, string, never>;
|
|
58
|
+
}>]>;
|
|
59
|
+
start: Schema.Schema<string, string, never>;
|
|
60
|
+
end: Schema.Schema<string, string, never>;
|
|
61
|
+
}>>>;
|
|
62
|
+
title: Schema.TupleType<readonly [Schema.Struct<{
|
|
63
|
+
locale: Schema.Literal<["zh"]>;
|
|
64
|
+
message: Schema.SchemaClass<string, string, never>;
|
|
65
|
+
}>], [Schema.Struct<{
|
|
66
|
+
locale: Schema.Literal<["ja", "en", "ko"]>;
|
|
67
|
+
message: Schema.SchemaClass<string, string, never>;
|
|
68
|
+
}>]>;
|
|
69
|
+
enableSorting: Schema.optional<Schema.SchemaClass<boolean, boolean, never>>;
|
|
70
|
+
sortKey: Schema.optional<Schema.refine<string, typeof Schema.String>>;
|
|
71
|
+
size: Schema.optional<Schema.refine<number, Schema.filter<typeof Schema.Number>>>;
|
|
72
|
+
grow: Schema.optional<Schema.SchemaClass<boolean, boolean, never>>;
|
|
73
|
+
tooltip: Schema.optional<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
|
+
id: Schema.refine<string, typeof Schema.String>;
|
|
81
|
+
groupId: Schema.optional<typeof Schema.UUID>;
|
|
82
|
+
type: Schema.Literal<["com.shwfed.table.column.date-range-input"]>;
|
|
83
|
+
compatibilityDate: Schema.Literal<["2026-06-22"]>;
|
|
84
|
+
}>;
|
|
85
|
+
export type Value = Schema.Schema.Type<ReturnType<typeof schema>>;
|
|
86
|
+
export declare function defaults(): Partial<Value>;
|
|
87
|
+
export declare function toColumnDef(value: Value, { getLocaleText }: ColumnDefDeps): Partial<ColumnDef<unknown, unknown>>;
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
import { getProperty } from "dot-prop";
|
|
3
|
+
import { Locale } from "../../../../../share/locale.js";
|
|
4
|
+
import { CelRowAccess, derivedRowField, editableColumnFields, editableHeader } from "../../../utils/shared.js";
|
|
5
|
+
export const type = "com.shwfed.table.column.date-range-input";
|
|
6
|
+
export const compatibilityDate = "2026-06-22";
|
|
7
|
+
export const metadata = {
|
|
8
|
+
name: "\u65E5\u671F\u8303\u56F4\u8F93\u5165",
|
|
9
|
+
icon: "fluent:calendar-arrow-right-20-regular"
|
|
10
|
+
};
|
|
11
|
+
const BindingPath = Schema.String.pipe(Schema.minLength(1));
|
|
12
|
+
const SplitBinding = Schema.Tuple(BindingPath, BindingPath).pipe(
|
|
13
|
+
Schema.filter(([a, b]) => a !== b, {
|
|
14
|
+
message: () => "\u8D77\u59CB\u4E0E\u7ED3\u675F\u7ED1\u5B9A\u8DEF\u5F84\u4E0D\u80FD\u76F8\u540C"
|
|
15
|
+
})
|
|
16
|
+
);
|
|
17
|
+
const bindingSchema = Schema.Union(BindingPath, SplitBinding).annotations({
|
|
18
|
+
title: "\u7ED1\u5B9A\u8DEF\u5F84",
|
|
19
|
+
description: "\u5355\u5143\u683C\u8BFB\u5199\u7684 `dot-prop` \u8DEF\u5F84\uFF1B\u586B\u5199\u5355\u4E2A\u8DEF\u5F84\u65F6\u8BFB\u5199 `[start, end]` \u5B57\u7B26\u4E32\u6570\u7EC4\uFF0C\u4F8B\u5982 `event.range`\uFF1B\u586B\u5199 `[\u8D77\u59CB\u8DEF\u5F84, \u7ED3\u675F\u8DEF\u5F84]` \u5143\u7EC4\u65F6\u5206\u522B\u8BFB\u5199\u4E24\u7AEF"
|
|
20
|
+
});
|
|
21
|
+
export function presetSchema(configure) {
|
|
22
|
+
const CelDate = CelRowAccess(configure, { resultType: "Date" });
|
|
23
|
+
return Schema.Struct({
|
|
24
|
+
id: Schema.UUID.annotations({ description: "\u9884\u8BBE\u552F\u4E00\u6807\u8BC6\uFF0C\u7528\u4E8E\u7A33\u5B9A\u7684 v-for key" }),
|
|
25
|
+
label: Locale.annotations({
|
|
26
|
+
title: "\u6807\u7B7E",
|
|
27
|
+
description: "\u5FEB\u6377\u9009\u9879\u5C55\u793A\u7684\u672C\u5730\u5316\u6587\u672C"
|
|
28
|
+
}),
|
|
29
|
+
start: CelDate.annotations({
|
|
30
|
+
title: "\u8D77\u59CB\u503C",
|
|
31
|
+
description: '\u70B9\u51FB\u8BE5\u9884\u8BBE\u65F6\u8BA1\u7B97\u51FA\u7684\u8D77\u59CB\u65E5\u671F\uFF0C\u4F8B\u5982 `now.offset(-7, "days")`'
|
|
32
|
+
}),
|
|
33
|
+
end: CelDate.annotations({
|
|
34
|
+
title: "\u7ED3\u675F\u503C",
|
|
35
|
+
description: "\u70B9\u51FB\u8BE5\u9884\u8BBE\u65F6\u8BA1\u7B97\u51FA\u7684\u7ED3\u675F\u65E5\u671F\uFF0C\u4F8B\u5982 `now`"
|
|
36
|
+
})
|
|
37
|
+
}).annotations({
|
|
38
|
+
title: "DateRangeInputPreset"
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
export function schema(configure) {
|
|
42
|
+
const CelBool = CelRowAccess(configure, { resultType: "bool" });
|
|
43
|
+
const Preset = presetSchema(configure);
|
|
44
|
+
return Schema.Struct({
|
|
45
|
+
type: Schema.Literal(type),
|
|
46
|
+
compatibilityDate: Schema.Literal(compatibilityDate),
|
|
47
|
+
...editableColumnFields(),
|
|
48
|
+
// Swap the inherited single-string `binding` for the range union.
|
|
49
|
+
binding: bindingSchema,
|
|
50
|
+
startPlaceholder: Schema.optional(Locale.annotations({
|
|
51
|
+
title: "\u8D77\u59CB\u5360\u4F4D\u7B26",
|
|
52
|
+
description: "\u672A\u9009\u4E2D\u8D77\u59CB\u65E5\u671F\u65F6\u8F93\u5165\u6846\u4E2D\u7684\u5360\u4F4D\u6587\u672C"
|
|
53
|
+
})),
|
|
54
|
+
endPlaceholder: Schema.optional(Locale.annotations({
|
|
55
|
+
title: "\u7ED3\u675F\u5360\u4F4D\u7B26",
|
|
56
|
+
description: "\u672A\u9009\u4E2D\u7ED3\u675F\u65E5\u671F\u65F6\u8F93\u5165\u6846\u4E2D\u7684\u5360\u4F4D\u6587\u672C"
|
|
57
|
+
})),
|
|
58
|
+
hidden: Schema.optional(CelBool.annotations({
|
|
59
|
+
title: "\u9690\u85CF\u6761\u4EF6",
|
|
60
|
+
description: "\u8FD4\u56DE `true` \u65F6\u8BE5\u884C\u7684\u8F93\u5165\u6846\u4E0D\u6E32\u67D3\uFF08\u5176\u4F59\u884C\u4E0D\u53D7\u5F71\u54CD\uFF09"
|
|
61
|
+
})),
|
|
62
|
+
disabled: Schema.optional(CelBool.annotations({
|
|
63
|
+
title: "\u7981\u7528\u6761\u4EF6",
|
|
64
|
+
description: "\u8FD4\u56DE `true` \u65F6\u8F93\u5165\u6846\u4ECD\u7136\u6E32\u67D3\u4F46\u4E0D\u53EF\u7F16\u8F91"
|
|
65
|
+
})),
|
|
66
|
+
readonly: Schema.optional(CelBool.annotations({
|
|
67
|
+
title: "\u53EA\u8BFB\u6761\u4EF6",
|
|
68
|
+
description: "\u8FD4\u56DE `true` \u65F6\u4EC5\u4EE5\u7EAF\u6587\u672C\u5C55\u793A\u5F53\u524D\u503C"
|
|
69
|
+
})),
|
|
70
|
+
derived: derivedRowField(configure, "dyn"),
|
|
71
|
+
format: Schema.optional(Schema.String.pipe(Schema.minLength(1)).annotations({
|
|
72
|
+
title: "\u5C55\u793A\u683C\u5F0F",
|
|
73
|
+
description: "\u8F93\u5165\u6846\u4E2D\u5C55\u793A\u65E5\u671F\u7684 `date-fns` \u683C\u5F0F\u4E32\uFF1B\u7559\u7A7A\u65F6\u4F7F\u7528\u9ED8\u8BA4 `yyyy-MM-dd`"
|
|
74
|
+
})),
|
|
75
|
+
valueFormat: Schema.optional(Schema.String.pipe(Schema.minLength(1)).annotations({
|
|
76
|
+
title: "\u5B58\u50A8\u683C\u5F0F",
|
|
77
|
+
description: "\u5199\u5165\u884C\u6570\u636E\u7684 `date-fns` \u683C\u5F0F\u4E32\uFF1B\u7559\u7A7A\u65F6\u4F7F\u7528\u9ED8\u8BA4 `yyyy-MM-dd`"
|
|
78
|
+
})),
|
|
79
|
+
rangeSeparatorIcon: Schema.optional(Schema.String.pipe(Schema.minLength(1)).annotations({
|
|
80
|
+
title: "\u8303\u56F4\u5206\u9694\u56FE\u6807",
|
|
81
|
+
description: "\u8303\u56F4\u4E24\u7AEF\u4E4B\u95F4\u5206\u9694\u56FE\u6807\u7684 Iconify \u540D\u79F0"
|
|
82
|
+
})),
|
|
83
|
+
numberOfMonths: Schema.optional(Schema.Number.pipe(Schema.int(), Schema.positive()).annotations({
|
|
84
|
+
title: "\u9762\u677F\u6708\u6570",
|
|
85
|
+
description: "\u65E5\u5386\u9762\u677F\u4E2D\u5E76\u6392\u663E\u793A\u7684\u6708\u4EFD\u6570\uFF1B\u9ED8\u8BA4 `2`"
|
|
86
|
+
})),
|
|
87
|
+
presets: Schema.optional(Schema.Array(Preset).annotations({
|
|
88
|
+
title: "\u5FEB\u6377\u9009\u9879",
|
|
89
|
+
description: "\u5728\u9009\u62E9\u5668\u5E95\u90E8\u5C55\u793A\u7684\u5FEB\u6377\u9884\u8BBE\uFF1B\u7559\u7A7A\u5219\u4E0D\u6E32\u67D3"
|
|
90
|
+
}))
|
|
91
|
+
}).annotations({ title: "DateRangeInputRenderer", description: "\u65E5\u671F\u8303\u56F4\u8F93\u5165\u6E32\u67D3\u5668\uFF08\u53EF\u7F16\u8F91\uFF09" });
|
|
92
|
+
}
|
|
93
|
+
export function defaults() {
|
|
94
|
+
return {
|
|
95
|
+
title: [{ locale: "zh", message: "" }],
|
|
96
|
+
binding: "",
|
|
97
|
+
size: 240
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
export function toColumnDef(value, { getLocaleText }) {
|
|
101
|
+
return {
|
|
102
|
+
header: editableHeader(getLocaleText(value.title)),
|
|
103
|
+
// `binding` is a literal `dot-prop` path (or pair); the cell reads through
|
|
104
|
+
// the same path(s) it writes. No CEL. A single path holds the `[start, end]`
|
|
105
|
+
// array directly; a split tuple is recomposed into a `[start, end]` pair so
|
|
106
|
+
// read-only display and sorting see one consistent shape.
|
|
107
|
+
accessorFn: (row) => {
|
|
108
|
+
if (!row || typeof row !== "object") return void 0;
|
|
109
|
+
const r = row;
|
|
110
|
+
const binding = value.binding;
|
|
111
|
+
if (typeof binding === "string") return getProperty(r, binding);
|
|
112
|
+
return [getProperty(r, binding[0]), getProperty(r, binding[1])];
|
|
113
|
+
},
|
|
114
|
+
enableSorting: value.enableSorting ?? false,
|
|
115
|
+
sortingFn: "alphanumeric",
|
|
116
|
+
size: value.size,
|
|
117
|
+
meta: {
|
|
118
|
+
grow: value.grow ?? false,
|
|
119
|
+
tooltip: getLocaleText(value.tooltip)
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
}
|
|
@@ -21,6 +21,7 @@ type __VLS_Props = {
|
|
|
21
21
|
timeGranularity?: 'hour' | 'minute' | 'second';
|
|
22
22
|
hourCycle?: 12 | 24;
|
|
23
23
|
class?: HTMLAttributes['class'];
|
|
24
|
+
inputClass?: HTMLAttributes['class'];
|
|
24
25
|
popoverClass?: HTMLAttributes['class'];
|
|
25
26
|
prefixIcon?: string;
|
|
26
27
|
clearIcon?: string;
|
|
@@ -28,6 +28,7 @@ const props = defineProps({
|
|
|
28
28
|
timeGranularity: { type: String, required: false, default: "second" },
|
|
29
29
|
hourCycle: { type: Number, required: false, default: 24 },
|
|
30
30
|
class: { type: [Boolean, null, String, Object, Array], required: false, skipCheck: true },
|
|
31
|
+
inputClass: { type: [Boolean, null, String, Object, Array], required: false, skipCheck: true },
|
|
31
32
|
popoverClass: { type: [Boolean, null, String, Object, Array], required: false, skipCheck: true },
|
|
32
33
|
prefixIcon: { type: String, required: false },
|
|
33
34
|
clearIcon: { type: String, required: false },
|
|
@@ -185,6 +186,7 @@ function applyShortcut(index) {
|
|
|
185
186
|
:prefix-icon="props.prefixIcon"
|
|
186
187
|
:clear-icon="props.clearIcon"
|
|
187
188
|
:size="props.size"
|
|
189
|
+
:class="props.inputClass"
|
|
188
190
|
@update:model-value="setFromInputTime"
|
|
189
191
|
@clear="emits('clear')"
|
|
190
192
|
/>
|
|
@@ -205,6 +207,7 @@ function applyShortcut(index) {
|
|
|
205
207
|
:prefix-icon="props.prefixIcon"
|
|
206
208
|
:clear-icon="props.clearIcon"
|
|
207
209
|
:size="props.size"
|
|
210
|
+
:class="props.inputClass"
|
|
208
211
|
@update:model-value="setFromInputDate"
|
|
209
212
|
@focus="onInputFocus"
|
|
210
213
|
@blur="onInputBlur"
|
|
@@ -21,6 +21,7 @@ type __VLS_Props = {
|
|
|
21
21
|
timeGranularity?: 'hour' | 'minute' | 'second';
|
|
22
22
|
hourCycle?: 12 | 24;
|
|
23
23
|
class?: HTMLAttributes['class'];
|
|
24
|
+
inputClass?: HTMLAttributes['class'];
|
|
24
25
|
popoverClass?: HTMLAttributes['class'];
|
|
25
26
|
prefixIcon?: string;
|
|
26
27
|
clearIcon?: string;
|
|
@@ -28,6 +28,7 @@ type __VLS_Props = {
|
|
|
28
28
|
shortcuts?: ReadonlyArray<DateRangePickerShortcut>;
|
|
29
29
|
size?: 'sm' | 'md' | 'lg';
|
|
30
30
|
class?: HTMLAttributes['class'];
|
|
31
|
+
inputClass?: HTMLAttributes['class'];
|
|
31
32
|
popoverClass?: HTMLAttributes['class'];
|
|
32
33
|
};
|
|
33
34
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
@@ -35,6 +35,7 @@ const props = defineProps({
|
|
|
35
35
|
shortcuts: { type: Array, required: false },
|
|
36
36
|
size: { type: String, required: false, default: "md" },
|
|
37
37
|
class: { type: [Boolean, null, String, Object, Array], required: false, skipCheck: true },
|
|
38
|
+
inputClass: { type: [Boolean, null, String, Object, Array], required: false, skipCheck: true },
|
|
38
39
|
popoverClass: { type: [Boolean, null, String, Object, Array], required: false, skipCheck: true }
|
|
39
40
|
});
|
|
40
41
|
const emits = defineEmits(["update:modelValue", "change", "clear", "focus", "blur"]);
|
|
@@ -248,6 +249,7 @@ function onInputBlur(event, side) {
|
|
|
248
249
|
:readonly="props.readonly"
|
|
249
250
|
:open="open"
|
|
250
251
|
:size="props.size"
|
|
252
|
+
:class="props.inputClass"
|
|
251
253
|
@update:start-value="setStart"
|
|
252
254
|
@update:end-value="setEnd"
|
|
253
255
|
@focus="onInputFocus"
|
|
@@ -28,6 +28,7 @@ type __VLS_Props = {
|
|
|
28
28
|
shortcuts?: ReadonlyArray<DateRangePickerShortcut>;
|
|
29
29
|
size?: 'sm' | 'md' | 'lg';
|
|
30
30
|
class?: HTMLAttributes['class'];
|
|
31
|
+
inputClass?: HTMLAttributes['class'];
|
|
31
32
|
popoverClass?: HTMLAttributes['class'];
|
|
32
33
|
};
|
|
33
34
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{be as e}from"./index-BdS7dokp.js";import{bf as b,bg as r,bh as s}from"./index-BdS7dokp.js";export{b as TableConfig,r as createTableConfig,e as default,s as getColumnTechnicalKey};
|