@shwfed/config 2.10.11 → 2.11.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 +1085 -925
- package/dist/module.json +1 -1
- package/dist/preview/assets/{FieldGroup.vue_vue_type_script_setup_true_lang-DSupaUBQ.js → FieldGroup.vue_vue_type_script_setup_true_lang-UfhMyymD.js} +1 -1
- package/dist/preview/assets/{badge-BpMIBZb2.js → badge-CJ9IQ3Jx.js} +1 -1
- package/dist/preview/assets/{config-CM4nX_7y.js → config--Vx4fL61.js} +1 -1
- package/dist/preview/assets/{config-CujkaO8S.js → config-5PPug5mk.js} +1 -1
- package/dist/preview/assets/{config-c2iiXckz.js → config-7V1qHjUk.js} +1 -1
- package/dist/preview/assets/{config-DrkDnICQ.js → config-BYktCefJ.js} +1 -1
- package/dist/preview/assets/{config-Cc1ThF9T.js → config-BeRYF_cz.js} +1 -1
- package/dist/preview/assets/{config-DbtYnaaf.js → config-BldsYfGM.js} +1 -1
- package/dist/preview/assets/{config-BCCT-UCw.js → config-CQrDCzYN.js} +1 -1
- package/dist/preview/assets/{config-CY9L8__h.js → config-C_g-FYCR.js} +1 -1
- package/dist/preview/assets/{config-Bz643_RE.js → config-DIsAIc7H.js} +1 -1
- package/dist/preview/assets/{config-CNJS9Ncm.js → config-DPX7vGqV.js} +1 -1
- package/dist/preview/assets/{config-C7nJ8jl6.js → config-DpLMetys.js} +1 -1
- package/dist/preview/assets/{config-Bx4-IdW5.js → config-IMd4FZi8.js} +1 -1
- package/dist/preview/assets/{config-v7UFMF25.js → config-N-FdgfwK.js} +1 -1
- package/dist/preview/assets/{config-agH4hNej.js → config-uUF-UHPt.js} +1 -1
- package/dist/preview/assets/{definition.vue_vue_type_script_setup_true_lang-B1dZHF9Z.js → definition.vue_vue_type_script_setup_true_lang-B_PKfe3G.js} +1 -1
- package/dist/preview/assets/index-8Ph-sFDI.css +1 -0
- package/dist/preview/assets/index-BCl1NN6k.js +763 -0
- package/dist/preview/assets/index-Core7vRW.js +1 -0
- package/dist/preview/assets/{index-B10aTz32.js → index-DKWp47QP.js} +1 -1
- package/dist/preview/assets/{item-DxWeqOxe.js → item-XsW7swFt.js} +1 -1
- package/dist/preview/assets/{runtime-CeItNJdF.js → runtime-B-ABO0r0.js} +1 -1
- package/dist/preview/assets/{runtime-C6oMTKIZ.js → runtime-BeHohaOZ.js} +1 -1
- package/dist/preview/assets/{runtime-rpKOBs2Q.js → runtime-BiFFwOIl.js} +1 -1
- package/dist/preview/assets/{runtime-BO_Ak4ly.js → runtime-ByArW-jJ.js} +1 -1
- package/dist/preview/assets/{runtime-3VPnK4Ve.js → runtime-CpVTGNFZ.js} +1 -1
- package/dist/preview/assets/{runtime-DQK6Vajf.js → runtime-DQ1TnQ7n.js} +1 -1
- package/dist/preview/assets/{runtime-P58D1JCj.js → runtime-DY7hr7v1.js} +1 -1
- package/dist/preview/assets/{runtime-BcWQ55Ub.js → runtime-Dn172S7t.js} +1 -1
- package/dist/preview/assets/{runtime-DwgCzoDf.js → runtime-JxBzvGnw.js} +1 -1
- package/dist/preview/assets/{runtime-D6jswLOt.js → runtime-bq0hmEXY.js} +1 -1
- package/dist/preview/assets/{schema-meta-BtDKldOy.js → schema-meta-CZ9yXnsa.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/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/form/fields/2026-06-09/com.shwfed.form.field.upload/runtime.vue +23 -1
- package/dist/runtime/components/table/columns/2026-04-14/com.shwfed.table.column.date/config.vue +30 -0
- package/dist/runtime/components/table/columns/2026-04-14/com.shwfed.table.column.date/schema.d.ts +2 -1
- package/dist/runtime/components/table/columns/2026-04-14/com.shwfed.table.column.date/schema.js +1 -1
- package/dist/runtime/components/table/columns/2026-04-14/com.shwfed.table.column.icon/config.vue +30 -0
- package/dist/runtime/components/table/columns/2026-04-14/com.shwfed.table.column.icon/schema.d.ts +2 -1
- package/dist/runtime/components/table/columns/2026-04-14/com.shwfed.table.column.icon/schema.js +7 -4
- package/dist/runtime/components/table/columns/2026-04-14/com.shwfed.table.column.number/config.vue +30 -0
- package/dist/runtime/components/table/columns/2026-04-14/com.shwfed.table.column.number/schema.d.ts +2 -1
- package/dist/runtime/components/table/columns/2026-04-14/com.shwfed.table.column.number/schema.js +1 -1
- package/dist/runtime/components/table/columns/2026-04-14/com.shwfed.table.column.text/config.vue +30 -0
- package/dist/runtime/components/table/columns/2026-04-14/com.shwfed.table.column.text/schema.d.ts +2 -1
- package/dist/runtime/components/table/columns/2026-04-14/com.shwfed.table.column.text/schema.js +1 -1
- package/dist/runtime/components/table/columns/2026-05-13/com.shwfed.table.column.switch/schema.d.ts +2 -1
- package/dist/runtime/components/table/columns/2026-05-13/com.shwfed.table.column.switch/schema.js +1 -0
- package/dist/runtime/components/table/columns/2026-05-13/com.shwfed.table.column.switch.remote/config.vue +30 -0
- package/dist/runtime/components/table/columns/2026-05-13/com.shwfed.table.column.switch.remote/schema.d.ts +2 -1
- package/dist/runtime/components/table/columns/2026-05-13/com.shwfed.table.column.switch.remote/schema.js +1 -1
- package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.number-input/config.vue +143 -35
- package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.number-input/runtime.vue +35 -9
- package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.number-input/schema.d.ts +136 -1
- package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.number-input/schema.js +20 -6
- package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.switch.local/config.vue +67 -32
- package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.switch.local/runtime.vue +6 -9
- package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.switch.local/schema.d.ts +4 -1
- package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.switch.local/schema.js +2 -5
- package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.text-input/config.vue +148 -33
- package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.text-input/runtime.vue +35 -9
- package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.text-input/schema.d.ts +136 -1
- package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.text-input/schema.js +20 -6
- 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-remote/schema.d.ts +1 -1
- package/dist/runtime/components/table/columns/2026-05-24/com.shwfed.table.column.combobox-single.remote.options-remote/schema.js +1 -0
- 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-24/com.shwfed.table.column.combobox-single.remote.options-static/schema.d.ts +1 -1
- package/dist/runtime/components/table/columns/2026-05-24/com.shwfed.table.column.combobox-single.remote.options-static/schema.js +1 -0
- 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-remote/schema.d.ts +1 -1
- package/dist/runtime/components/table/columns/2026-05-25/com.shwfed.table.column.combobox-multi.remote.options-remote/schema.js +1 -0
- 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-25/com.shwfed.table.column.combobox-multi.remote.options-static/schema.d.ts +1 -1
- package/dist/runtime/components/table/columns/2026-05-25/com.shwfed.table.column.combobox-multi.remote.options-static/schema.js +1 -0
- 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-multi.remote/schema.d.ts +1 -1
- package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-multi.remote/schema.js +1 -0
- 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-26/com.shwfed.table.column.combobox-single.remote/schema.d.ts +1 -1
- package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-single.remote/schema.js +1 -0
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.combobox-multi/config.d.vue.ts +4 -2
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.combobox-multi/config.vue +61 -22
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.combobox-multi/config.vue.d.ts +4 -2
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.combobox-multi/runtime.vue +6 -9
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.combobox-multi/schema.d.ts +4 -1
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.combobox-multi/schema.js +3 -4
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.combobox-single/config.d.vue.ts +4 -2
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.combobox-single/config.vue +61 -22
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.combobox-single/config.vue.d.ts +4 -2
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.combobox-single/runtime.vue +6 -9
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.combobox-single/schema.d.ts +4 -1
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.combobox-single/schema.js +3 -4
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.tree-combobox-multi/config.d.vue.ts +4 -2
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.tree-combobox-multi/config.vue +67 -23
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.tree-combobox-multi/config.vue.d.ts +4 -2
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.tree-combobox-multi/runtime.vue +6 -9
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.tree-combobox-multi/schema.d.ts +4 -1
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.tree-combobox-multi/schema.js +2 -4
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.tree-combobox-single/config.d.vue.ts +4 -2
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.tree-combobox-single/config.vue +67 -23
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.tree-combobox-single/config.vue.d.ts +4 -2
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.tree-combobox-single/runtime.vue +6 -9
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.tree-combobox-single/schema.d.ts +4 -1
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.tree-combobox-single/schema.js +2 -4
- package/dist/runtime/components/table/columns/2026-06-17/com.shwfed.table.column.date-input/config.vue +67 -32
- package/dist/runtime/components/table/columns/2026-06-17/com.shwfed.table.column.date-input/runtime.vue +14 -8
- package/dist/runtime/components/table/columns/2026-06-17/com.shwfed.table.column.date-input/schema.d.ts +4 -1
- package/dist/runtime/components/table/columns/2026-06-17/com.shwfed.table.column.date-input/schema.js +2 -5
- 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 +752 -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 +149 -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 +90 -0
- package/dist/runtime/components/table/columns/2026-06-22/com.shwfed.table.column.date-range-input/schema.js +119 -0
- package/dist/runtime/components/table/index.vue +46 -7
- package/dist/runtime/components/table/utils/runtime.d.ts +1 -0
- package/dist/runtime/components/table/utils/runtime.js +5 -0
- package/dist/runtime/components/table/utils/shared.d.ts +3 -1
- package/dist/runtime/components/table/utils/shared.js +17 -5
- 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-Cc4BT5dc.css +0 -1
- package/dist/preview/assets/index-DdySlgoq.js +0 -763
- package/dist/preview/assets/index-j5Pri4vN.js +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,149 @@
|
|
|
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
|
+
import { JUSTIFY_CLASS } from "../../../utils/runtime";
|
|
13
|
+
defineOptions({ name: "ShwfedTableDateRangeInputRendererRuntime" });
|
|
14
|
+
const props = defineProps({
|
|
15
|
+
column: { type: null, required: true },
|
|
16
|
+
ctx: { type: Object, required: true }
|
|
17
|
+
});
|
|
18
|
+
const { locale } = useI18n();
|
|
19
|
+
const celContext = injectCELContext();
|
|
20
|
+
const { getAt, setAt } = useFormState();
|
|
21
|
+
const startPlaceholderText = computed(
|
|
22
|
+
() => props.column.startPlaceholder ? getLocalizedText(props.column.startPlaceholder, locale.value) : void 0
|
|
23
|
+
);
|
|
24
|
+
const endPlaceholderText = computed(
|
|
25
|
+
() => props.column.endPlaceholder ? getLocalizedText(props.column.endPlaceholder, locale.value) : void 0
|
|
26
|
+
);
|
|
27
|
+
function evalBool(expression, label) {
|
|
28
|
+
if (!expression) return false;
|
|
29
|
+
try {
|
|
30
|
+
return Effect.runSync($cel(expression, celBindings(celContext))) === true;
|
|
31
|
+
} catch (e) {
|
|
32
|
+
console.error(`[shwfed-table] date-range-input ${label} failed`, e);
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
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 justifyClass = computed(() => JUSTIFY_CLASS[props.column.align ?? "left"] ?? JUSTIFY_CLASS.left);
|
|
48
|
+
const shortcuts = computed(() => {
|
|
49
|
+
const list = props.column.presets;
|
|
50
|
+
if (!list || list.length === 0) return void 0;
|
|
51
|
+
return list.map((preset) => ({
|
|
52
|
+
name: preset.label,
|
|
53
|
+
value: () => {
|
|
54
|
+
try {
|
|
55
|
+
const start = Effect.runSync($cel(preset.start, celBindings(celContext)));
|
|
56
|
+
const end = Effect.runSync($cel(preset.end, celBindings(celContext)));
|
|
57
|
+
return [
|
|
58
|
+
formatDate(start, resolvedValueFormat.value),
|
|
59
|
+
formatDate(end, resolvedValueFormat.value)
|
|
60
|
+
];
|
|
61
|
+
} catch (e) {
|
|
62
|
+
console.error(`[shwfed-table] date-range-input preset "${preset.start}" .. "${preset.end}" failed`, e);
|
|
63
|
+
return ["", ""];
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}));
|
|
67
|
+
});
|
|
68
|
+
function asRange(raw) {
|
|
69
|
+
if (!Array.isArray(raw) || raw.length !== 2) return void 0;
|
|
70
|
+
const [a, b] = raw;
|
|
71
|
+
if (typeof a !== "string" || typeof b !== "string") return void 0;
|
|
72
|
+
if (a.length === 0 || b.length === 0) return void 0;
|
|
73
|
+
return [a, b];
|
|
74
|
+
}
|
|
75
|
+
function asString(raw) {
|
|
76
|
+
return typeof raw === "string" && raw.length > 0 ? raw : void 0;
|
|
77
|
+
}
|
|
78
|
+
const model = computed({
|
|
79
|
+
get: () => {
|
|
80
|
+
const binding = props.column.binding;
|
|
81
|
+
if (typeof binding === "string") return asRange(getAt(binding));
|
|
82
|
+
const a = asString(getAt(binding[0]));
|
|
83
|
+
const b = asString(getAt(binding[1]));
|
|
84
|
+
if (a == null || b == null) return void 0;
|
|
85
|
+
return [a, b];
|
|
86
|
+
},
|
|
87
|
+
set: (next) => {
|
|
88
|
+
const binding = props.column.binding;
|
|
89
|
+
if (typeof binding === "string") {
|
|
90
|
+
setAt(binding, next ?? null);
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
setAt(binding[0], next?.[0] ?? null);
|
|
94
|
+
setAt(binding[1], next?.[1] ?? null);
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
const readonlyText = computed(() => {
|
|
98
|
+
const v = model.value;
|
|
99
|
+
if (!v) return null;
|
|
100
|
+
return `${v[0]} ~ ${v[1]}`;
|
|
101
|
+
});
|
|
102
|
+
</script>
|
|
103
|
+
|
|
104
|
+
<template>
|
|
105
|
+
<!--
|
|
106
|
+
Row budget matches the editable input columns: 2px outer inset around a 28px
|
|
107
|
+
(`h-7`) control — total 32px. Every branch (readonly / editable) is
|
|
108
|
+
sized identically so rows do not jump when a CEL condition flips.
|
|
109
|
+
-->
|
|
110
|
+
<div class="p-[0.125rem] w-full">
|
|
111
|
+
<!--
|
|
112
|
+
Readonly empty state mirrors the other editable columns: a centered, faded,
|
|
113
|
+
non-selectable `-` so a readonly grid reads uniformly. A non-empty readonly
|
|
114
|
+
range keeps left-aligned dark text joined by `~`.
|
|
115
|
+
-->
|
|
116
|
+
<span
|
|
117
|
+
v-if="effectiveReadonly"
|
|
118
|
+
:class="[
|
|
119
|
+
'flex items-center h-7 w-full px-2 text-[0.75rem] truncate',
|
|
120
|
+
readonlyText ? ['text-zinc-700', justifyClass] : 'justify-center font-mono text-zinc-300 select-none'
|
|
121
|
+
]"
|
|
122
|
+
>
|
|
123
|
+
{{ readonlyText || "-" }}
|
|
124
|
+
</span>
|
|
125
|
+
<!--
|
|
126
|
+
Idle border is faded to 30% so a whole grid of date cells reads as data,
|
|
127
|
+
not chrome — `hover:` / `focus-within:` snap it back to full so the active
|
|
128
|
+
cell stands out. Mirrors the `date-input` column exactly; routed to the
|
|
129
|
+
inner range input via `input-class` because `class` lands on the
|
|
130
|
+
DateRangePicker's anchor wrapper, not the input.
|
|
131
|
+
-->
|
|
132
|
+
<DateRangePicker
|
|
133
|
+
v-else
|
|
134
|
+
v-model="model"
|
|
135
|
+
type="daterange"
|
|
136
|
+
size="sm"
|
|
137
|
+
class="w-full"
|
|
138
|
+
input-class="border-zinc-200/30 hover:border-zinc-200 focus-within:border-zinc-200 transition-colors ease-out duration-180"
|
|
139
|
+
:format="column.format"
|
|
140
|
+
:value-format="column.valueFormat"
|
|
141
|
+
:start-placeholder="startPlaceholderText"
|
|
142
|
+
:end-placeholder="endPlaceholderText"
|
|
143
|
+
:range-separator-icon="column.rangeSeparatorIcon"
|
|
144
|
+
:number-of-months="column.numberOfMonths"
|
|
145
|
+
:disabled="isDisabled"
|
|
146
|
+
:shortcuts="shortcuts"
|
|
147
|
+
/>
|
|
148
|
+
</div>
|
|
149
|
+
</template>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { CellContext } from '@tanstack/vue-table';
|
|
2
|
+
import type { Value } from './schema.js';
|
|
3
|
+
type __VLS_Props = {
|
|
4
|
+
column: Value;
|
|
5
|
+
ctx: CellContext<unknown, unknown>;
|
|
6
|
+
};
|
|
7
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
8
|
+
declare const _default: typeof __VLS_export;
|
|
9
|
+
export default _default;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { Schema } from 'effect';
|
|
2
|
+
import type { ColumnDef } from '@tanstack/vue-table';
|
|
3
|
+
import type { Environment } from '../../../../../vendor/cel-js/lib/index.js';
|
|
4
|
+
import type { ColumnDefDeps } 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
|
+
align: Schema.optionalWith<Schema.Literal<["left", "center", "right"]>, {
|
|
25
|
+
default: () => "left";
|
|
26
|
+
}>;
|
|
27
|
+
binding: Schema.Union<[Schema.filter<typeof Schema.String>, Schema.filter<Schema.Tuple2<Schema.filter<typeof Schema.String>, Schema.filter<typeof Schema.String>>>]>;
|
|
28
|
+
startPlaceholder: Schema.optional<Schema.TupleType<readonly [Schema.Struct<{
|
|
29
|
+
locale: Schema.Literal<["zh"]>;
|
|
30
|
+
message: Schema.SchemaClass<string, string, never>;
|
|
31
|
+
}>], [Schema.Struct<{
|
|
32
|
+
locale: Schema.Literal<["ja", "en", "ko"]>;
|
|
33
|
+
message: Schema.SchemaClass<string, string, never>;
|
|
34
|
+
}>]>>;
|
|
35
|
+
endPlaceholder: Schema.optional<Schema.TupleType<readonly [Schema.Struct<{
|
|
36
|
+
locale: Schema.Literal<["zh"]>;
|
|
37
|
+
message: Schema.SchemaClass<string, string, never>;
|
|
38
|
+
}>], [Schema.Struct<{
|
|
39
|
+
locale: Schema.Literal<["ja", "en", "ko"]>;
|
|
40
|
+
message: Schema.SchemaClass<string, string, never>;
|
|
41
|
+
}>]>>;
|
|
42
|
+
disabled: Schema.optional<Schema.Schema<string, string, never>>;
|
|
43
|
+
readonly: Schema.optional<Schema.Schema<string, string, never>>;
|
|
44
|
+
derived: Schema.optional<Schema.Struct<{
|
|
45
|
+
mode: Schema.Literal<["formula", "prefill"]>;
|
|
46
|
+
expression: Schema.Schema<string, string, never>;
|
|
47
|
+
}>>;
|
|
48
|
+
format: Schema.optional<Schema.refine<string, typeof Schema.String>>;
|
|
49
|
+
valueFormat: Schema.optional<Schema.refine<string, typeof Schema.String>>;
|
|
50
|
+
rangeSeparatorIcon: Schema.optional<Schema.refine<string, typeof Schema.String>>;
|
|
51
|
+
numberOfMonths: Schema.optional<Schema.refine<number, Schema.filter<typeof Schema.Number>>>;
|
|
52
|
+
presets: Schema.optional<Schema.Array$<Schema.Struct<{
|
|
53
|
+
id: Schema.refine<string, typeof Schema.String>;
|
|
54
|
+
label: Schema.TupleType<readonly [Schema.Struct<{
|
|
55
|
+
locale: Schema.Literal<["zh"]>;
|
|
56
|
+
message: Schema.SchemaClass<string, string, never>;
|
|
57
|
+
}>], [Schema.Struct<{
|
|
58
|
+
locale: Schema.Literal<["ja", "en", "ko"]>;
|
|
59
|
+
message: Schema.SchemaClass<string, string, never>;
|
|
60
|
+
}>]>;
|
|
61
|
+
start: Schema.Schema<string, string, never>;
|
|
62
|
+
end: Schema.Schema<string, string, never>;
|
|
63
|
+
}>>>;
|
|
64
|
+
title: Schema.TupleType<readonly [Schema.Struct<{
|
|
65
|
+
locale: Schema.Literal<["zh"]>;
|
|
66
|
+
message: Schema.SchemaClass<string, string, never>;
|
|
67
|
+
}>], [Schema.Struct<{
|
|
68
|
+
locale: Schema.Literal<["ja", "en", "ko"]>;
|
|
69
|
+
message: Schema.SchemaClass<string, string, never>;
|
|
70
|
+
}>]>;
|
|
71
|
+
enableSorting: Schema.optional<Schema.SchemaClass<boolean, boolean, never>>;
|
|
72
|
+
sortKey: Schema.optional<Schema.refine<string, typeof Schema.String>>;
|
|
73
|
+
size: Schema.optional<Schema.refine<number, Schema.filter<typeof Schema.Number>>>;
|
|
74
|
+
grow: Schema.optional<Schema.SchemaClass<boolean, boolean, never>>;
|
|
75
|
+
tooltip: Schema.optional<Schema.TupleType<readonly [Schema.Struct<{
|
|
76
|
+
locale: Schema.Literal<["zh"]>;
|
|
77
|
+
message: Schema.SchemaClass<string, string, never>;
|
|
78
|
+
}>], [Schema.Struct<{
|
|
79
|
+
locale: Schema.Literal<["ja", "en", "ko"]>;
|
|
80
|
+
message: Schema.SchemaClass<string, string, never>;
|
|
81
|
+
}>]>>;
|
|
82
|
+
hidden: Schema.optional<Schema.SchemaClass<boolean, boolean, never>>;
|
|
83
|
+
id: Schema.refine<string, typeof Schema.String>;
|
|
84
|
+
groupId: Schema.optional<typeof Schema.UUID>;
|
|
85
|
+
type: Schema.Literal<["com.shwfed.table.column.date-range-input"]>;
|
|
86
|
+
compatibilityDate: Schema.Literal<["2026-06-22"]>;
|
|
87
|
+
}>;
|
|
88
|
+
export type Value = Schema.Schema.Type<ReturnType<typeof schema>>;
|
|
89
|
+
export declare function defaults(): Partial<Value>;
|
|
90
|
+
export declare function toColumnDef(value: Value, { getLocaleText }: ColumnDefDeps): Partial<ColumnDef<unknown, unknown>>;
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
import { getProperty } from "dot-prop";
|
|
3
|
+
import { Locale } from "../../../../../share/locale.js";
|
|
4
|
+
import { Align, 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
|
+
align: Schema.optionalWith(Align.annotations({ title: "\u5BF9\u9F50" }), { default: () => "left" }),
|
|
49
|
+
// Swap the inherited single-string `binding` for the range union.
|
|
50
|
+
binding: bindingSchema,
|
|
51
|
+
startPlaceholder: Schema.optional(Locale.annotations({
|
|
52
|
+
title: "\u8D77\u59CB\u5360\u4F4D\u7B26",
|
|
53
|
+
description: "\u672A\u9009\u4E2D\u8D77\u59CB\u65E5\u671F\u65F6\u8F93\u5165\u6846\u4E2D\u7684\u5360\u4F4D\u6587\u672C"
|
|
54
|
+
})),
|
|
55
|
+
endPlaceholder: Schema.optional(Locale.annotations({
|
|
56
|
+
title: "\u7ED3\u675F\u5360\u4F4D\u7B26",
|
|
57
|
+
description: "\u672A\u9009\u4E2D\u7ED3\u675F\u65E5\u671F\u65F6\u8F93\u5165\u6846\u4E2D\u7684\u5360\u4F4D\u6587\u672C"
|
|
58
|
+
})),
|
|
59
|
+
disabled: Schema.optional(CelBool.annotations({
|
|
60
|
+
title: "\u7981\u7528\u6761\u4EF6",
|
|
61
|
+
description: "\u8FD4\u56DE `true` \u65F6\u8F93\u5165\u6846\u4ECD\u7136\u6E32\u67D3\u4F46\u4E0D\u53EF\u7F16\u8F91"
|
|
62
|
+
})),
|
|
63
|
+
readonly: Schema.optional(CelBool.annotations({
|
|
64
|
+
title: "\u53EA\u8BFB\u6761\u4EF6",
|
|
65
|
+
description: "\u8FD4\u56DE `true` \u65F6\u4EC5\u4EE5\u7EAF\u6587\u672C\u5C55\u793A\u5F53\u524D\u503C"
|
|
66
|
+
})),
|
|
67
|
+
derived: derivedRowField(configure, "dyn"),
|
|
68
|
+
format: Schema.optional(Schema.String.pipe(Schema.minLength(1)).annotations({
|
|
69
|
+
title: "\u5C55\u793A\u683C\u5F0F",
|
|
70
|
+
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`"
|
|
71
|
+
})),
|
|
72
|
+
valueFormat: Schema.optional(Schema.String.pipe(Schema.minLength(1)).annotations({
|
|
73
|
+
title: "\u5B58\u50A8\u683C\u5F0F",
|
|
74
|
+
description: "\u5199\u5165\u884C\u6570\u636E\u7684 `date-fns` \u683C\u5F0F\u4E32\uFF1B\u7559\u7A7A\u65F6\u4F7F\u7528\u9ED8\u8BA4 `yyyy-MM-dd`"
|
|
75
|
+
})),
|
|
76
|
+
rangeSeparatorIcon: Schema.optional(Schema.String.pipe(Schema.minLength(1)).annotations({
|
|
77
|
+
title: "\u8303\u56F4\u5206\u9694\u56FE\u6807",
|
|
78
|
+
description: "\u8303\u56F4\u4E24\u7AEF\u4E4B\u95F4\u5206\u9694\u56FE\u6807\u7684 Iconify \u540D\u79F0"
|
|
79
|
+
})),
|
|
80
|
+
numberOfMonths: Schema.optional(Schema.Number.pipe(Schema.int(), Schema.positive()).annotations({
|
|
81
|
+
title: "\u9762\u677F\u6708\u6570",
|
|
82
|
+
description: "\u65E5\u5386\u9762\u677F\u4E2D\u5E76\u6392\u663E\u793A\u7684\u6708\u4EFD\u6570\uFF1B\u9ED8\u8BA4 `2`"
|
|
83
|
+
})),
|
|
84
|
+
presets: Schema.optional(Schema.Array(Preset).annotations({
|
|
85
|
+
title: "\u5FEB\u6377\u9009\u9879",
|
|
86
|
+
description: "\u5728\u9009\u62E9\u5668\u5E95\u90E8\u5C55\u793A\u7684\u5FEB\u6377\u9884\u8BBE\uFF1B\u7559\u7A7A\u5219\u4E0D\u6E32\u67D3"
|
|
87
|
+
}))
|
|
88
|
+
}).annotations({ title: "DateRangeInputRenderer", description: "\u65E5\u671F\u8303\u56F4\u8F93\u5165\u6E32\u67D3\u5668\uFF08\u53EF\u7F16\u8F91\uFF09" });
|
|
89
|
+
}
|
|
90
|
+
export function defaults() {
|
|
91
|
+
return {
|
|
92
|
+
title: [{ locale: "zh", message: "" }],
|
|
93
|
+
binding: "",
|
|
94
|
+
size: 240
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
export function toColumnDef(value, { getLocaleText }) {
|
|
98
|
+
return {
|
|
99
|
+
header: editableHeader(getLocaleText(value.title)),
|
|
100
|
+
// `binding` is a literal `dot-prop` path (or pair); the cell reads through
|
|
101
|
+
// the same path(s) it writes. No CEL. A single path holds the `[start, end]`
|
|
102
|
+
// array directly; a split tuple is recomposed into a `[start, end]` pair so
|
|
103
|
+
// read-only display and sorting see one consistent shape.
|
|
104
|
+
accessorFn: (row) => {
|
|
105
|
+
if (!row || typeof row !== "object") return void 0;
|
|
106
|
+
const r = row;
|
|
107
|
+
const binding = value.binding;
|
|
108
|
+
if (typeof binding === "string") return getProperty(r, binding);
|
|
109
|
+
return [getProperty(r, binding[0]), getProperty(r, binding[1])];
|
|
110
|
+
},
|
|
111
|
+
enableSorting: value.enableSorting ?? false,
|
|
112
|
+
sortingFn: "alphanumeric",
|
|
113
|
+
size: value.size,
|
|
114
|
+
meta: {
|
|
115
|
+
grow: value.grow ?? false,
|
|
116
|
+
tooltip: getLocaleText(value.tooltip)
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
}
|
|
@@ -100,6 +100,34 @@ const { t, locale } = useI18n({
|
|
|
100
100
|
const inheritedContext = injectCELContext();
|
|
101
101
|
const containerRef = ref(null);
|
|
102
102
|
const appliedInitialStateKey = ref("");
|
|
103
|
+
const frozenGrowColumns = ref(/* @__PURE__ */ new Set());
|
|
104
|
+
function isEffectiveGrow(column) {
|
|
105
|
+
return !!column.columnDef.meta?.grow && !frozenGrowColumns.value.has(column.id);
|
|
106
|
+
}
|
|
107
|
+
function freezeGrowColumns() {
|
|
108
|
+
const grows = tableApi.getVisibleLeafColumns().filter(isEffectiveGrow);
|
|
109
|
+
if (grows.length === 0) return;
|
|
110
|
+
const measured = {};
|
|
111
|
+
for (const column of grows) {
|
|
112
|
+
const el = containerRef.value?.querySelector(`thead [data-col-id="${column.id}"]`);
|
|
113
|
+
if (el) measured[column.id] = el.offsetWidth;
|
|
114
|
+
}
|
|
115
|
+
tableApi.setColumnSizing((prev) => ({ ...prev, ...measured }));
|
|
116
|
+
const next = new Set(frozenGrowColumns.value);
|
|
117
|
+
grows.forEach((column) => next.add(column.id));
|
|
118
|
+
frozenGrowColumns.value = next;
|
|
119
|
+
}
|
|
120
|
+
function onResizeMouseDown(header, event) {
|
|
121
|
+
freezeGrowColumns();
|
|
122
|
+
header.getResizeHandler()(event);
|
|
123
|
+
}
|
|
124
|
+
function growLeafCount(header) {
|
|
125
|
+
return header.getLeafHeaders().filter((h2) => isEffectiveGrow(h2.column)).length;
|
|
126
|
+
}
|
|
127
|
+
function headerGrowStyle(header) {
|
|
128
|
+
const n = growLeafCount(header);
|
|
129
|
+
return n > 0 ? { flex: `${n} 1 auto` } : {};
|
|
130
|
+
}
|
|
103
131
|
const formReadonly = useFormReadonly();
|
|
104
132
|
function isHeaderReadonly(readonlyExpr) {
|
|
105
133
|
if (readonlyExpr == null) return formReadonly.value;
|
|
@@ -494,13 +522,19 @@ function getDisplayIndex(row) {
|
|
|
494
522
|
watch(config, (config2) => {
|
|
495
523
|
if (!config2) return;
|
|
496
524
|
const initialState = config2.initialState;
|
|
497
|
-
const
|
|
498
|
-
|
|
525
|
+
const hiddenSeed = {};
|
|
526
|
+
for (const col of config2.columns) {
|
|
527
|
+
if (col.hidden) hiddenSeed[col.id] = false;
|
|
528
|
+
}
|
|
529
|
+
const hasSeed = Object.keys(hiddenSeed).length > 0;
|
|
530
|
+
const effective = initialState || hasSeed ? { ...initialState ?? {}, columnVisibility: { ...hiddenSeed, ...initialState?.columnVisibility ?? {} } } : void 0;
|
|
531
|
+
const nextKey = effective ? JSON.stringify(effective) : "";
|
|
532
|
+
if (appliedInitialStateKey.value === nextKey || !effective) {
|
|
499
533
|
appliedInitialStateKey.value = nextKey;
|
|
500
534
|
syncPaginationPageSize();
|
|
501
535
|
return;
|
|
502
536
|
}
|
|
503
|
-
tableApi.initialState = mergeInitialState(tableApi.initialState,
|
|
537
|
+
tableApi.initialState = mergeInitialState(tableApi.initialState, effective);
|
|
504
538
|
tableApi.reset();
|
|
505
539
|
appliedInitialStateKey.value = nextKey;
|
|
506
540
|
syncPaginationPageSize();
|
|
@@ -712,8 +746,8 @@ export { TableConfig, createTableConfig, getColumnTechnicalKey } from "./schema"
|
|
|
712
746
|
v-for="header in group.headers"
|
|
713
747
|
:key="header.id"
|
|
714
748
|
:colspan="header.colSpan"
|
|
749
|
+
:data-col-id="header.column.id"
|
|
715
750
|
:class="[
|
|
716
|
-
header.column.columnDef.meta?.grow && 'flex-1',
|
|
717
751
|
'flex items-center gap-2 border-zinc-300 py-2 text-zinc-600',
|
|
718
752
|
'text-xs flex items-center justify-center relative',
|
|
719
753
|
'bg-[color-mix(in_srgb,var(--primary)_7%,white)] group',
|
|
@@ -722,7 +756,12 @@ export { TableConfig, createTableConfig, getColumnTechnicalKey } from "./schema"
|
|
|
722
756
|
shouldHaveLeftBorder(header.column) && 'border-l'
|
|
723
757
|
]"
|
|
724
758
|
:style="{
|
|
759
|
+
// Grow until first resize (see freezeGrowColumns): fill the
|
|
760
|
+
// remaining space, with `width` as the flex-basis so the
|
|
761
|
+
// configured size acts as a floor. Group headers grow by
|
|
762
|
+
// the count of grow leaves they span (see headerGrowStyle).
|
|
725
763
|
width: `${header.getSize()}px`,
|
|
764
|
+
...headerGrowStyle(header),
|
|
726
765
|
...pinnedStyle(header.column)
|
|
727
766
|
}"
|
|
728
767
|
>
|
|
@@ -816,7 +855,7 @@ export { TableConfig, createTableConfig, getColumnTechnicalKey } from "./schema"
|
|
|
816
855
|
'hover:opacity-100',
|
|
817
856
|
'cursor-col-resize'
|
|
818
857
|
]"
|
|
819
|
-
@mousedown="header
|
|
858
|
+
@mousedown="onResizeMouseDown(header, $event)"
|
|
820
859
|
>
|
|
821
860
|
<div class="w-2pt h-full translate-x-1pt transform-3d bg-[color-mix(in_srgb,var(--primary)_80%,white)]" />
|
|
822
861
|
</div>
|
|
@@ -875,7 +914,7 @@ export { TableConfig, createTableConfig, getColumnTechnicalKey } from "./schema"
|
|
|
875
914
|
:key="cell.id"
|
|
876
915
|
:class="[
|
|
877
916
|
'border-zinc-300',
|
|
878
|
-
cell.column
|
|
917
|
+
isEffectiveGrow(cell.column) && 'flex-[1_1_auto]',
|
|
879
918
|
cell.column.getIsPinned() && 'sticky z-15',
|
|
880
919
|
shouldHaveRightBorder(cell.column) && 'border-r',
|
|
881
920
|
shouldHaveLeftBorder(cell.column) && 'border-l'
|
|
@@ -908,7 +947,6 @@ export { TableConfig, createTableConfig, getColumnTechnicalKey } from "./schema"
|
|
|
908
947
|
:key="header.id"
|
|
909
948
|
:colspan="header.colSpan"
|
|
910
949
|
:class="[
|
|
911
|
-
header.column.columnDef.meta?.grow && 'flex-1',
|
|
912
950
|
'flex items-center gap-2 border-zinc-300 text-zinc-600 p-0',
|
|
913
951
|
'text-xs flex items-center justify-center relative',
|
|
914
952
|
'bg-[color-mix(in_srgb,var(--primary)_7%,white)] group',
|
|
@@ -918,6 +956,7 @@ export { TableConfig, createTableConfig, getColumnTechnicalKey } from "./schema"
|
|
|
918
956
|
]"
|
|
919
957
|
:style="{
|
|
920
958
|
width: `${header.getSize()}px`,
|
|
959
|
+
...headerGrowStyle(header),
|
|
921
960
|
...pinnedStyle(header.column)
|
|
922
961
|
}"
|
|
923
962
|
>
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Effect as EffectType } from 'effect';
|
|
2
2
|
export declare const JUSTIFY_CLASS: Record<string, string>;
|
|
3
|
+
export declare const TEXT_ALIGN_CLASS: Record<string, string>;
|
|
3
4
|
type CelEvaluator = <T>(expression: string, context?: Record<string, unknown>) => EffectType.Effect<T, any>;
|
|
4
5
|
export declare function interpolateMarkdown(template: string, $cel: CelEvaluator, context: Record<string, unknown>): string;
|
|
5
6
|
export declare function evaluateMarkdown(template: string, $cel: CelEvaluator, context: Record<string, unknown>): string;
|
|
@@ -5,6 +5,11 @@ export const JUSTIFY_CLASS = {
|
|
|
5
5
|
center: "justify-center",
|
|
6
6
|
right: "justify-end"
|
|
7
7
|
};
|
|
8
|
+
export const TEXT_ALIGN_CLASS = {
|
|
9
|
+
left: "text-left",
|
|
10
|
+
center: "text-center",
|
|
11
|
+
right: "text-right"
|
|
12
|
+
};
|
|
8
13
|
const INTERPOLATION_RE = /\{\{(.*?)\}\}/gs;
|
|
9
14
|
function stringifyCelResult(value) {
|
|
10
15
|
if (value === null || value === void 0) return "";
|
|
@@ -15,7 +15,7 @@ export declare function columnFields(configure: (env: Environment) => void): {
|
|
|
15
15
|
locale: Schema.Literal<["ja", "en", "ko"]>;
|
|
16
16
|
message: Schema.SchemaClass<string, string, never>;
|
|
17
17
|
}>]>;
|
|
18
|
-
accessor: Schema.Schema<string, string, never
|
|
18
|
+
accessor: Schema.optional<Schema.Schema<string, string, never>>;
|
|
19
19
|
enableSorting: Schema.optional<Schema.SchemaClass<boolean, boolean, never>>;
|
|
20
20
|
sortKey: Schema.optional<Schema.refine<string, typeof Schema.String>>;
|
|
21
21
|
size: Schema.optional<Schema.refine<number, Schema.filter<typeof Schema.Number>>>;
|
|
@@ -27,6 +27,7 @@ export declare function columnFields(configure: (env: Environment) => void): {
|
|
|
27
27
|
locale: Schema.Literal<["ja", "en", "ko"]>;
|
|
28
28
|
message: Schema.SchemaClass<string, string, never>;
|
|
29
29
|
}>]>>;
|
|
30
|
+
hidden: Schema.optional<Schema.SchemaClass<boolean, boolean, never>>;
|
|
30
31
|
id: Schema.refine<string, typeof Schema.String>;
|
|
31
32
|
groupId: Schema.optional<typeof Schema.UUID>;
|
|
32
33
|
};
|
|
@@ -50,6 +51,7 @@ export declare function editableColumnFields(): {
|
|
|
50
51
|
locale: Schema.Literal<["ja", "en", "ko"]>;
|
|
51
52
|
message: Schema.SchemaClass<string, string, never>;
|
|
52
53
|
}>]>>;
|
|
54
|
+
hidden: Schema.optional<Schema.SchemaClass<boolean, boolean, never>>;
|
|
53
55
|
id: Schema.refine<string, typeof Schema.String>;
|
|
54
56
|
groupId: Schema.optional<typeof Schema.UUID>;
|
|
55
57
|
};
|
|
@@ -20,10 +20,14 @@ export function columnFields(configure) {
|
|
|
20
20
|
return {
|
|
21
21
|
...columnIdentityFields(),
|
|
22
22
|
title: Locale.annotations({ title: "\u540D\u79F0", description: "\u5217\u6807\u9898" }),
|
|
23
|
-
|
|
23
|
+
// Optional: a purely visual column (icon, badge, computed-elsewhere cell)
|
|
24
|
+
// may have no backing data path, letting designers refine the display layer
|
|
25
|
+
// without an API contract first. Absent → the cell renders no data; present
|
|
26
|
+
// → still validated as a CEL expression (empty string stays invalid).
|
|
27
|
+
accessor: Schema.optional(CelRowAccess(configure).annotations({
|
|
24
28
|
title: "\u8DEF\u5F84",
|
|
25
|
-
description: "\u884C\u6570\u636E\u8BBF\u95EE CEL \u8868\u8FBE\u5F0F\uFF0C\u4F8B\u5982 `row.user.name
|
|
26
|
-
}),
|
|
29
|
+
description: "\u884C\u6570\u636E\u8BBF\u95EE CEL \u8868\u8FBE\u5F0F\uFF0C\u4F8B\u5982 `row.user.name`\uFF1B\u53EF\u7559\u7A7A\uFF0C\u7559\u7A7A\u65F6\u8BE5\u5217\u4E0D\u8BFB\u53D6\u6570\u636E\uFF08\u7528\u4E8E\u7EAF\u89C6\u89C9\u5217\uFF09"
|
|
30
|
+
})),
|
|
27
31
|
enableSorting: Schema.optional(Schema.Boolean.annotations({
|
|
28
32
|
title: "\u5141\u8BB8\u6392\u5E8F",
|
|
29
33
|
description: md`
|
|
@@ -48,7 +52,11 @@ export function columnFields(configure) {
|
|
|
48
52
|
description: "\u6307\u5B9A\u4E00\u4E2A\u5408\u9002\u7684\u8868\u683C\u5217\u5BBD\u5EA6\uFF0C\u5F53\u5217\u5185\u5BB9\u957F\u5EA6\u5927\u4E8E\u8FD9\u91CC\u6307\u5B9A\u7684\u5BBD\u5EA6\u540E\uFF0C\u4F1A\u5BFC\u81F4\u8D85\u51FA\u7684\u90E8\u5206\u88AB\u622A\u65AD\u3002"
|
|
49
53
|
})),
|
|
50
54
|
grow: Schema.optional(Schema.Boolean.annotations({ title: "\u5360\u636E\u5269\u4F59\u5BBD\u5EA6", description: "\u5217\u662F\u5426\u5360\u636E\u5269\u4F59\u7A7A\u4F59\u5BBD\u5EA6" })),
|
|
51
|
-
tooltip: Schema.optional(Locale.annotations({ title: "\u63D0\u793A", description: "\u5217\u6807\u9898\u60AC\u6D6E\u63D0\u793A\uFF0C\u652F\u6301 Markdown" }))
|
|
55
|
+
tooltip: Schema.optional(Locale.annotations({ title: "\u63D0\u793A", description: "\u5217\u6807\u9898\u60AC\u6D6E\u63D0\u793A\uFF0C\u652F\u6301 Markdown" })),
|
|
56
|
+
hidden: Schema.optional(Schema.Boolean.annotations({
|
|
57
|
+
title: "\u9ED8\u8BA4\u9690\u85CF",
|
|
58
|
+
description: "\u5F00\u542F\u540E\u8BE5\u5217\u9ED8\u8BA4\u9690\u85CF\uFF1B\u4F7F\u7528\u8005\u53EF\u5728\u8868\u683C\u7684\u5217\u8BBE\u7F6E\u4E2D\u91CD\u65B0\u663E\u793A\u3002\u4EC5\u4F5C\u4E3A\u521D\u59CB\u72B6\u6001\uFF0C\u4E0D\u968F\u6570\u636E\u53D8\u5316"
|
|
59
|
+
}))
|
|
52
60
|
};
|
|
53
61
|
}
|
|
54
62
|
export function editableColumnFields() {
|
|
@@ -72,7 +80,11 @@ export function editableColumnFields() {
|
|
|
72
80
|
description: "\u6307\u5B9A\u4E00\u4E2A\u5408\u9002\u7684\u8868\u683C\u5217\u5BBD\u5EA6\uFF0C\u5F53\u5217\u5185\u5BB9\u957F\u5EA6\u5927\u4E8E\u8FD9\u91CC\u6307\u5B9A\u7684\u5BBD\u5EA6\u540E\uFF0C\u4F1A\u5BFC\u81F4\u8D85\u51FA\u7684\u90E8\u5206\u88AB\u622A\u65AD\u3002"
|
|
73
81
|
})),
|
|
74
82
|
grow: Schema.optional(Schema.Boolean.annotations({ title: "\u5360\u636E\u5269\u4F59\u5BBD\u5EA6", description: "\u5217\u662F\u5426\u5360\u636E\u5269\u4F59\u7A7A\u4F59\u5BBD\u5EA6" })),
|
|
75
|
-
tooltip: Schema.optional(Locale.annotations({ title: "\u63D0\u793A", description: "\u5217\u6807\u9898\u60AC\u6D6E\u63D0\u793A\uFF0C\u652F\u6301 Markdown" }))
|
|
83
|
+
tooltip: Schema.optional(Locale.annotations({ title: "\u63D0\u793A", description: "\u5217\u6807\u9898\u60AC\u6D6E\u63D0\u793A\uFF0C\u652F\u6301 Markdown" })),
|
|
84
|
+
hidden: Schema.optional(Schema.Boolean.annotations({
|
|
85
|
+
title: "\u9ED8\u8BA4\u9690\u85CF",
|
|
86
|
+
description: "\u5F00\u542F\u540E\u8BE5\u5217\u9ED8\u8BA4\u9690\u85CF\uFF1B\u4F7F\u7528\u8005\u53EF\u5728\u8868\u683C\u7684\u5217\u8BBE\u7F6E\u4E2D\u91CD\u65B0\u663E\u793A\u3002\u4EC5\u4F5C\u4E3A\u521D\u59CB\u72B6\u6001\uFF0C\u4E0D\u968F\u6570\u636E\u53D8\u5316"
|
|
87
|
+
}))
|
|
76
88
|
};
|
|
77
89
|
}
|
|
78
90
|
const EDITABLE_HEADER_MARKER = Symbol("shwfed-editable-header");
|
|
@@ -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, {
|