@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
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import { computed } from "vue";
|
|
2
|
+
import { computed, inject, onBeforeUnmount, ref, watch } from "vue";
|
|
3
3
|
import { Icon } from "@iconify/vue";
|
|
4
4
|
import { ExpressionEditor } from "../../../../ui/expression-editor";
|
|
5
5
|
import { Switch } from "../../../../ui/switch";
|
|
6
6
|
import { Separator } from "../../../../ui/separator";
|
|
7
|
+
import { Button } from "../../../../ui/button";
|
|
7
8
|
import { Field, FieldLabel } from "../../../../ui/field";
|
|
8
|
-
import { Locale } from "../../../../ui/locale";
|
|
9
9
|
import {
|
|
10
10
|
DropdownMenu,
|
|
11
11
|
DropdownMenuContent,
|
|
@@ -19,9 +19,14 @@ import {
|
|
|
19
19
|
InputGroupInput,
|
|
20
20
|
InputGroupNumberField
|
|
21
21
|
} from "../../../../ui/input-group";
|
|
22
|
+
import ActionsConfigEditor from "../../../../actions/config.vue";
|
|
22
23
|
import { getStructFieldDescription, getStructFieldTitle } from "../../../utils/schema-meta";
|
|
23
24
|
import { Markdown } from "../../../../ui/markdown";
|
|
24
25
|
import DerivedValueEditor from "../../../../form/DerivedValueEditor.vue";
|
|
26
|
+
import { Locale } from "../../../../ui/locale";
|
|
27
|
+
import { TABLE_COLUMN_LAYOUT_KEY } from "../../../column-layout";
|
|
28
|
+
import { BREADCRUMB_EXTENSION_KEY } from "../../../../config/breadcrumb-extension";
|
|
29
|
+
import { registerRowVariablesIfAbsent } from "../../../utils/shared";
|
|
25
30
|
import { schema } from "./schema";
|
|
26
31
|
defineOptions({ name: "ShwfedTableNumberInputRendererConfig" });
|
|
27
32
|
const value = defineModel({ type: Object, ...{ required: true } });
|
|
@@ -29,10 +34,59 @@ const fieldSchema = schema(() => {
|
|
|
29
34
|
});
|
|
30
35
|
const fieldTitle = (field) => getStructFieldTitle(fieldSchema, field) ?? field;
|
|
31
36
|
const fieldDescription = (field) => getStructFieldDescription(fieldSchema, field);
|
|
37
|
+
const ALIGN_OPTIONS = [
|
|
38
|
+
{ value: "left", label: "\u5DE6\u5BF9\u9F50", icon: "fluent:text-align-left-20-regular" },
|
|
39
|
+
{ value: "center", label: "\u5C45\u4E2D", icon: "fluent:text-align-center-20-regular" },
|
|
40
|
+
{ value: "right", label: "\u53F3\u5BF9\u9F50", icon: "fluent:text-align-right-20-regular" }
|
|
41
|
+
];
|
|
42
|
+
const currentAlignIcon = computed(
|
|
43
|
+
() => (ALIGN_OPTIONS.find((o) => o.value === (value.value.align ?? "right")) ?? ALIGN_OPTIONS[2]).icon
|
|
44
|
+
);
|
|
32
45
|
const ROW_VARS = {
|
|
33
46
|
row: { type: "dyn", label: "\u5F53\u524D\u884C\u6570\u636E" },
|
|
34
47
|
index: { type: "number", label: "\u884C\u7D22\u5F15" }
|
|
35
48
|
};
|
|
49
|
+
const layout = inject(TABLE_COLUMN_LAYOUT_KEY, null);
|
|
50
|
+
const breadcrumbExt = inject(BREADCRUMB_EXTENSION_KEY, null);
|
|
51
|
+
const editingAddon = ref(false);
|
|
52
|
+
function closeAddon() {
|
|
53
|
+
editingAddon.value = false;
|
|
54
|
+
}
|
|
55
|
+
const addonCrumb = breadcrumbExt?.add();
|
|
56
|
+
watch(editingAddon, (on) => {
|
|
57
|
+
if (layout) layout.fullPane.value = on;
|
|
58
|
+
if (addonCrumb) {
|
|
59
|
+
addonCrumb.label.value = on ? "\u8F93\u5165\u6846\u5185\u6309\u94AE" : null;
|
|
60
|
+
addonCrumb.back.value = on ? closeAddon : null;
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
onBeforeUnmount(() => {
|
|
64
|
+
if (layout) layout.fullPane.value = false;
|
|
65
|
+
addonCrumb?.dispose();
|
|
66
|
+
});
|
|
67
|
+
const addonItemCount = computed(() => value.value.addon?.items.length ?? 0);
|
|
68
|
+
const addonValue = computed({
|
|
69
|
+
get: () => ({
|
|
70
|
+
kind: "shwfed.component.action",
|
|
71
|
+
size: value.value.addon?.size ?? "xs",
|
|
72
|
+
gap: value.value.addon?.gap ?? 4,
|
|
73
|
+
style: value.value.addon?.style,
|
|
74
|
+
groups: value.value.addon?.groups ?? [],
|
|
75
|
+
items: value.value.addon?.items ?? []
|
|
76
|
+
}),
|
|
77
|
+
set: (next) => {
|
|
78
|
+
const { size, gap, style, groups, items } = next;
|
|
79
|
+
if (groups.length === 0 && items.length === 0) {
|
|
80
|
+
const { addon: _omit, ...rest } = value.value;
|
|
81
|
+
value.value = rest;
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
value.value = {
|
|
85
|
+
...value.value,
|
|
86
|
+
addon: { size, gap, groups, items, ...style === void 0 ? {} : { style } }
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
});
|
|
36
90
|
const ROUNDING_MODE_OPTIONS = [
|
|
37
91
|
{ value: "round", label: "\u56DB\u820D\u4E94\u5165" },
|
|
38
92
|
{ value: "floor", label: "\u5411\u4E0B\u53D6\u6574" },
|
|
@@ -50,17 +104,6 @@ const bindingText = computed({
|
|
|
50
104
|
}
|
|
51
105
|
}
|
|
52
106
|
});
|
|
53
|
-
const hiddenModel = computed({
|
|
54
|
-
get: () => value.value.hidden ?? "",
|
|
55
|
-
set: (v) => {
|
|
56
|
-
if (v === "") {
|
|
57
|
-
const { hidden: _drop, ...rest } = value.value;
|
|
58
|
-
value.value = rest;
|
|
59
|
-
} else {
|
|
60
|
-
value.value = { ...value.value, hidden: v };
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
});
|
|
64
107
|
const disabledModel = computed({
|
|
65
108
|
get: () => value.value.disabled ?? "",
|
|
66
109
|
set: (v) => {
|
|
@@ -126,6 +169,14 @@ function onValueAsStringChange(next) {
|
|
|
126
169
|
value.value = rest;
|
|
127
170
|
}
|
|
128
171
|
}
|
|
172
|
+
function onHiddenChange(v) {
|
|
173
|
+
if (v) {
|
|
174
|
+
value.value = { ...value.value, hidden: true };
|
|
175
|
+
} else {
|
|
176
|
+
const { hidden: _drop, ...rest } = value.value;
|
|
177
|
+
value.value = rest;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
129
180
|
function onMinChange(v) {
|
|
130
181
|
if (v.length > 0) {
|
|
131
182
|
value.value = { ...value.value, min: v };
|
|
@@ -145,7 +196,17 @@ function onMaxChange(v) {
|
|
|
145
196
|
</script>
|
|
146
197
|
|
|
147
198
|
<template>
|
|
148
|
-
<
|
|
199
|
+
<ActionsConfigEditor
|
|
200
|
+
v-if="editingAddon"
|
|
201
|
+
v-model="addonValue"
|
|
202
|
+
:configure="registerRowVariablesIfAbsent"
|
|
203
|
+
hide-size
|
|
204
|
+
/>
|
|
205
|
+
|
|
206
|
+
<div
|
|
207
|
+
v-else
|
|
208
|
+
class="space-y-5"
|
|
209
|
+
>
|
|
149
210
|
<div class="grid grid-cols-2 gap-x-6 gap-y-4">
|
|
150
211
|
<Field orientation="vertical">
|
|
151
212
|
<FieldLabel class="text-xs text-zinc-500">
|
|
@@ -244,6 +305,29 @@ function onMaxChange(v) {
|
|
|
244
305
|
{{ fieldTitle("size") }}
|
|
245
306
|
</FieldLabel>
|
|
246
307
|
<InputGroup>
|
|
308
|
+
<InputGroupAddon align="inline-start">
|
|
309
|
+
<DropdownMenu>
|
|
310
|
+
<DropdownMenuTrigger as-child>
|
|
311
|
+
<InputGroupButton
|
|
312
|
+
variant="ghost"
|
|
313
|
+
size="xs"
|
|
314
|
+
:title="fieldTitle('align')"
|
|
315
|
+
>
|
|
316
|
+
<Icon :icon="currentAlignIcon" />
|
|
317
|
+
</InputGroupButton>
|
|
318
|
+
</DropdownMenuTrigger>
|
|
319
|
+
<DropdownMenuContent align="start">
|
|
320
|
+
<DropdownMenuItem
|
|
321
|
+
v-for="opt in ALIGN_OPTIONS"
|
|
322
|
+
:key="opt.value"
|
|
323
|
+
@select="value = { ...value, align: opt.value }"
|
|
324
|
+
>
|
|
325
|
+
<Icon :icon="opt.icon" />
|
|
326
|
+
{{ opt.label }}
|
|
327
|
+
</DropdownMenuItem>
|
|
328
|
+
</DropdownMenuContent>
|
|
329
|
+
</DropdownMenu>
|
|
330
|
+
</InputGroupAddon>
|
|
247
331
|
<InputGroupNumberField
|
|
248
332
|
:model-value="value.size"
|
|
249
333
|
:disabled="value.grow"
|
|
@@ -405,27 +489,6 @@ function onMaxChange(v) {
|
|
|
405
489
|
</Field>
|
|
406
490
|
</div>
|
|
407
491
|
<div class="grid grid-cols-2 gap-x-6 gap-y-4">
|
|
408
|
-
<Field orientation="vertical">
|
|
409
|
-
<FieldLabel class="text-xs text-zinc-500">
|
|
410
|
-
<template
|
|
411
|
-
v-if="fieldDescription('hidden')"
|
|
412
|
-
#tooltip
|
|
413
|
-
>
|
|
414
|
-
<Markdown
|
|
415
|
-
:source="fieldDescription('hidden')"
|
|
416
|
-
block
|
|
417
|
-
class="prose prose-sm prose-zinc"
|
|
418
|
-
/>
|
|
419
|
-
</template>
|
|
420
|
-
{{ fieldTitle("hidden") }}
|
|
421
|
-
</FieldLabel>
|
|
422
|
-
<ExpressionEditor
|
|
423
|
-
v-model="hiddenModel"
|
|
424
|
-
placeholder="例:row.archived"
|
|
425
|
-
result-type="bool"
|
|
426
|
-
:extra-vars="ROW_VARS"
|
|
427
|
-
/>
|
|
428
|
-
</Field>
|
|
429
492
|
<Field orientation="vertical">
|
|
430
493
|
<FieldLabel class="text-xs text-zinc-500">
|
|
431
494
|
<template
|
|
@@ -529,6 +592,51 @@ function onMaxChange(v) {
|
|
|
529
592
|
</InputGroupAddon>
|
|
530
593
|
</InputGroup>
|
|
531
594
|
</Field>
|
|
595
|
+
<Field orientation="vertical">
|
|
596
|
+
<FieldLabel class="text-xs text-zinc-500">
|
|
597
|
+
<template
|
|
598
|
+
v-if="fieldDescription('hidden')"
|
|
599
|
+
#tooltip
|
|
600
|
+
>
|
|
601
|
+
<Markdown
|
|
602
|
+
:source="fieldDescription('hidden')"
|
|
603
|
+
block
|
|
604
|
+
class="prose prose-sm prose-zinc"
|
|
605
|
+
/>
|
|
606
|
+
</template>
|
|
607
|
+
{{ fieldTitle("hidden") }}
|
|
608
|
+
</FieldLabel>
|
|
609
|
+
<div>
|
|
610
|
+
<Switch
|
|
611
|
+
:model-value="value.hidden ?? false"
|
|
612
|
+
@update:model-value="onHiddenChange"
|
|
613
|
+
/>
|
|
614
|
+
</div>
|
|
615
|
+
</Field>
|
|
532
616
|
</div>
|
|
617
|
+
<Separator />
|
|
618
|
+
<Field orientation="vertical">
|
|
619
|
+
<FieldLabel class="text-xs text-zinc-500">
|
|
620
|
+
<template
|
|
621
|
+
v-if="fieldDescription('addon')"
|
|
622
|
+
#tooltip
|
|
623
|
+
>
|
|
624
|
+
<Markdown
|
|
625
|
+
:source="fieldDescription('addon')"
|
|
626
|
+
block
|
|
627
|
+
class="prose prose-sm prose-zinc"
|
|
628
|
+
/>
|
|
629
|
+
</template>
|
|
630
|
+
{{ fieldTitle("addon") }}
|
|
631
|
+
</FieldLabel>
|
|
632
|
+
<Button
|
|
633
|
+
type="button"
|
|
634
|
+
class="w-full justify-center"
|
|
635
|
+
@click="editingAddon = true"
|
|
636
|
+
>
|
|
637
|
+
<Icon icon="fluent:add-20-regular" />
|
|
638
|
+
<span>{{ addonItemCount > 0 ? "\u914D\u7F6E\u6309\u94AE" : "\u6DFB\u52A0\u6309\u94AE" }}</span>
|
|
639
|
+
</Button>
|
|
640
|
+
</Field>
|
|
533
641
|
</div>
|
|
534
642
|
</template>
|
|
@@ -8,7 +8,9 @@ import { celBindings, injectCELContext } from "../../../../../utils/cel-context"
|
|
|
8
8
|
import { useFormReadonly } from "../../../../form/utils/readonly";
|
|
9
9
|
import { getLocalizedText } from "../../../../../share/locale";
|
|
10
10
|
import { InputGroup, InputGroupAddon, InputGroupButton, InputGroupNumberField } from "../../../../ui/input-group";
|
|
11
|
+
import ShwfedActions from "../../../../actions/components/group.vue";
|
|
11
12
|
import { useFieldValue } from "../../../../form/utils/field-value";
|
|
13
|
+
import { JUSTIFY_CLASS, TEXT_ALIGN_CLASS } from "../../../utils/runtime";
|
|
12
14
|
defineOptions({ name: "ShwfedTableNumberInputRendererRuntime" });
|
|
13
15
|
const props = defineProps({
|
|
14
16
|
column: { type: null, required: true },
|
|
@@ -39,7 +41,6 @@ function evalNumber(expression, label) {
|
|
|
39
41
|
return void 0;
|
|
40
42
|
}
|
|
41
43
|
}
|
|
42
|
-
const isHidden = computed(() => evalBool(props.column.hidden, "hidden"));
|
|
43
44
|
const isDisabled = computed(() => evalBool(props.column.disabled, "disabled"));
|
|
44
45
|
const formReadonly = useFormReadonly();
|
|
45
46
|
const isReadonly = computed(
|
|
@@ -80,7 +81,21 @@ function applyRounding(n, precision, mode) {
|
|
|
80
81
|
return Math.round(n * factor) / factor;
|
|
81
82
|
}
|
|
82
83
|
}
|
|
84
|
+
const addonConfig = computed(() => {
|
|
85
|
+
const addon = props.column.addon;
|
|
86
|
+
if (!addon || addon.items.length === 0) return null;
|
|
87
|
+
return {
|
|
88
|
+
kind: "shwfed.component.action",
|
|
89
|
+
size: addon.size ?? "xs",
|
|
90
|
+
gap: addon.gap,
|
|
91
|
+
style: addon.style,
|
|
92
|
+
groups: addon.groups.map((group) => ({ ...group, variant: group.variant ?? "ghost" })),
|
|
93
|
+
items: addon.items
|
|
94
|
+
};
|
|
95
|
+
});
|
|
83
96
|
const showClear = computed(() => !isDisabled.value && draft.value !== void 0);
|
|
97
|
+
const justifyClass = computed(() => JUSTIFY_CLASS[props.column.align ?? "right"] ?? JUSTIFY_CLASS.right);
|
|
98
|
+
const textAlignClass = computed(() => TEXT_ALIGN_CLASS[props.column.align ?? "right"] ?? TEXT_ALIGN_CLASS.right);
|
|
84
99
|
function handleClear() {
|
|
85
100
|
draft.value = void 0;
|
|
86
101
|
commit();
|
|
@@ -102,16 +117,12 @@ async function onBlur() {
|
|
|
102
117
|
<template>
|
|
103
118
|
<!--
|
|
104
119
|
Row budget matches the text-input cell: 2px outer inset around an `h-7`
|
|
105
|
-
(28px) input — 32px total. Every branch (
|
|
120
|
+
(28px) input — 32px total. Every branch (readonly / editable)
|
|
106
121
|
is sized identically so rows do not jump when a CEL condition flips.
|
|
107
122
|
Both `text-[0.75rem]` breakpoints are explicit so `Input`'s default
|
|
108
123
|
`md:text-sm` cannot beat the override at md+.
|
|
109
124
|
-->
|
|
110
125
|
<div class="p-[0.125rem] w-full">
|
|
111
|
-
<span
|
|
112
|
-
v-if="isHidden"
|
|
113
|
-
class="block h-7 w-full"
|
|
114
|
-
/>
|
|
115
126
|
<!--
|
|
116
127
|
Readonly empty state mirrors the `text` column exactly: a centered,
|
|
117
128
|
faded, non-selectable `-` in `font-mono`, so a readonly grid reads
|
|
@@ -119,10 +130,10 @@ async function onBlur() {
|
|
|
119
130
|
left-aligned dark text.
|
|
120
131
|
-->
|
|
121
132
|
<span
|
|
122
|
-
v-
|
|
133
|
+
v-if="effectiveReadonly"
|
|
123
134
|
:class="[
|
|
124
135
|
'flex items-center h-7 w-full px-2 text-[0.75rem] truncate',
|
|
125
|
-
draft !== void 0 ? 'text-zinc-700' : 'justify-center font-mono text-zinc-300 select-none'
|
|
136
|
+
draft !== void 0 ? ['text-zinc-700', justifyClass] : 'justify-center font-mono text-zinc-300 select-none'
|
|
126
137
|
]"
|
|
127
138
|
>
|
|
128
139
|
{{ draft ?? "-" }}
|
|
@@ -141,7 +152,7 @@ async function onBlur() {
|
|
|
141
152
|
:format-options="formatOptions"
|
|
142
153
|
:disabled="isDisabled"
|
|
143
154
|
:placeholder="placeholderText"
|
|
144
|
-
input-class="h-7 text-[0.75rem] md:text-[0.75rem] px-2
|
|
155
|
+
:input-class="['h-7 text-[0.75rem] md:text-[0.75rem] px-2', textAlignClass]"
|
|
145
156
|
@update:model-value="(v) => draft = v"
|
|
146
157
|
@blur="onBlur"
|
|
147
158
|
/>
|
|
@@ -164,6 +175,21 @@ async function onBlur() {
|
|
|
164
175
|
/>
|
|
165
176
|
</InputGroupButton>
|
|
166
177
|
</InputGroupAddon>
|
|
178
|
+
<!-- `mr-[-0.45rem]` mirrors the clear addon's `has-[>button]:mr-[-0.45rem]`
|
|
179
|
+
pull-back: that compensation only fires when the addon's direct child
|
|
180
|
+
is a `<button>`, but `ShwfedActions` roots a `<div>`, so without it the
|
|
181
|
+
`inline-end` `pr-3` would leave a ~12px dead gap before the border. -->
|
|
182
|
+
<InputGroupAddon
|
|
183
|
+
v-if="addonConfig"
|
|
184
|
+
align="inline-end"
|
|
185
|
+
class="field-addon-actions mr-[-0.45rem]"
|
|
186
|
+
>
|
|
187
|
+
<ShwfedActions :config="addonConfig" />
|
|
188
|
+
</InputGroupAddon>
|
|
167
189
|
</InputGroup>
|
|
168
190
|
</div>
|
|
169
191
|
</template>
|
|
192
|
+
|
|
193
|
+
<style scoped>
|
|
194
|
+
.field-addon-actions :deep([data-slot=buttons]){align-items:center;gap:.125rem}.field-addon-actions :deep([data-slot=buttons-dropdown-trigger]),.field-addon-actions :deep([data-slot=buttons-item]){border-radius:.125rem;color:#71717a;height:1rem;min-width:1rem;padding:0}.field-addon-actions :deep([data-slot=buttons-dropdown-trigger] svg),.field-addon-actions :deep([data-slot=buttons-item] svg){height:.75rem;width:.75rem}.field-addon-actions :deep([data-slot=buttons-dropdown-trigger]:hover:not(:disabled)),.field-addon-actions :deep([data-slot=buttons-item]:hover:not(:disabled)){color:#3f3f46}
|
|
195
|
+
</style>
|
|
@@ -9,6 +9,9 @@ export declare const metadata: {
|
|
|
9
9
|
readonly icon: "fluent:number-symbol-20-regular";
|
|
10
10
|
};
|
|
11
11
|
export declare function schema(configure: (env: Environment) => void): Schema.Struct<{
|
|
12
|
+
align: Schema.optionalWith<Schema.Literal<["left", "center", "right"]>, {
|
|
13
|
+
default: () => "right";
|
|
14
|
+
}>;
|
|
12
15
|
placeholder: Schema.optional<Schema.TupleType<readonly [Schema.Struct<{
|
|
13
16
|
locale: Schema.Literal<["zh"]>;
|
|
14
17
|
message: Schema.SchemaClass<string, string, never>;
|
|
@@ -16,7 +19,6 @@ export declare function schema(configure: (env: Environment) => void): Schema.St
|
|
|
16
19
|
locale: Schema.Literal<["ja", "en", "ko"]>;
|
|
17
20
|
message: Schema.SchemaClass<string, string, never>;
|
|
18
21
|
}>]>>;
|
|
19
|
-
hidden: Schema.optional<Schema.Schema<string, string, never>>;
|
|
20
22
|
disabled: Schema.optional<Schema.Schema<string, string, never>>;
|
|
21
23
|
readonly: Schema.optional<Schema.Schema<string, string, never>>;
|
|
22
24
|
precision: Schema.optional<Schema.refine<number, Schema.filter<typeof Schema.Number>>>;
|
|
@@ -29,6 +31,138 @@ export declare function schema(configure: (env: Environment) => void): Schema.St
|
|
|
29
31
|
mode: Schema.Literal<["formula", "prefill"]>;
|
|
30
32
|
expression: Schema.Schema<string, string, never>;
|
|
31
33
|
}>>;
|
|
34
|
+
addon: Schema.optional<Schema.Struct<{
|
|
35
|
+
groups: Schema.optionalWith<Schema.Array$<Schema.Struct<{
|
|
36
|
+
id: Schema.refine<string, typeof Schema.String>;
|
|
37
|
+
variant: Schema.optional<Schema.Literal<["default", "primary", "destructive", "ghost", "link"]>>;
|
|
38
|
+
}>>, {
|
|
39
|
+
default: () => never[];
|
|
40
|
+
}>;
|
|
41
|
+
items: Schema.optionalWith<Schema.Array$<Schema.Schema<import("../../../../actions/schema.js").RegistryItemValue | {
|
|
42
|
+
readonly disabled?: string | undefined;
|
|
43
|
+
readonly id: string;
|
|
44
|
+
readonly title: readonly [{
|
|
45
|
+
readonly locale: "zh";
|
|
46
|
+
readonly message: string;
|
|
47
|
+
}, ...{
|
|
48
|
+
readonly locale: "en" | "ja" | "ko";
|
|
49
|
+
readonly message: string;
|
|
50
|
+
}[]];
|
|
51
|
+
readonly icon?: string | undefined;
|
|
52
|
+
readonly hidden?: string | undefined;
|
|
53
|
+
readonly tooltip?: readonly [{
|
|
54
|
+
readonly locale: "zh";
|
|
55
|
+
readonly message: string;
|
|
56
|
+
}, ...{
|
|
57
|
+
readonly locale: "en" | "ja" | "ko";
|
|
58
|
+
readonly message: string;
|
|
59
|
+
}[]] | undefined;
|
|
60
|
+
readonly variant?: "default" | "link" | "destructive" | "primary" | "ghost" | undefined;
|
|
61
|
+
readonly action?: any;
|
|
62
|
+
readonly groupId: string;
|
|
63
|
+
readonly hideTitle?: boolean | undefined;
|
|
64
|
+
} | {
|
|
65
|
+
readonly id: string;
|
|
66
|
+
readonly title: readonly [{
|
|
67
|
+
readonly locale: "zh";
|
|
68
|
+
readonly message: string;
|
|
69
|
+
}, ...{
|
|
70
|
+
readonly locale: "en" | "ja" | "ko";
|
|
71
|
+
readonly message: string;
|
|
72
|
+
}[]];
|
|
73
|
+
readonly icon?: string | undefined;
|
|
74
|
+
readonly items: readonly (import("../../../../actions/schema.js").RegistrySubItemValue | {
|
|
75
|
+
readonly disabled?: string | undefined;
|
|
76
|
+
readonly id: string;
|
|
77
|
+
readonly title: readonly [{
|
|
78
|
+
readonly locale: "zh";
|
|
79
|
+
readonly message: string;
|
|
80
|
+
}, ...{
|
|
81
|
+
readonly locale: "en" | "ja" | "ko";
|
|
82
|
+
readonly message: string;
|
|
83
|
+
}[]];
|
|
84
|
+
readonly icon?: string | undefined;
|
|
85
|
+
readonly hidden?: string | undefined;
|
|
86
|
+
readonly tooltip?: readonly [{
|
|
87
|
+
readonly locale: "zh";
|
|
88
|
+
readonly message: string;
|
|
89
|
+
}, ...{
|
|
90
|
+
readonly locale: "en" | "ja" | "ko";
|
|
91
|
+
readonly message: string;
|
|
92
|
+
}[]] | undefined;
|
|
93
|
+
readonly variant?: "default" | "link" | "destructive" | "primary" | "ghost" | undefined;
|
|
94
|
+
readonly action?: any;
|
|
95
|
+
})[];
|
|
96
|
+
readonly groupId: string;
|
|
97
|
+
readonly hideTitle?: boolean | undefined;
|
|
98
|
+
}, import("../../../../actions/schema.js").RegistryItemValue | {
|
|
99
|
+
readonly id: string;
|
|
100
|
+
readonly title: readonly [{
|
|
101
|
+
readonly locale: "zh";
|
|
102
|
+
readonly message: string;
|
|
103
|
+
}, ...{
|
|
104
|
+
readonly locale: "en" | "ja" | "ko";
|
|
105
|
+
readonly message: string;
|
|
106
|
+
}[]];
|
|
107
|
+
readonly groupId: string;
|
|
108
|
+
readonly disabled?: string | undefined;
|
|
109
|
+
readonly icon?: string | undefined;
|
|
110
|
+
readonly hidden?: string | undefined;
|
|
111
|
+
readonly tooltip?: readonly [{
|
|
112
|
+
readonly locale: "zh";
|
|
113
|
+
readonly message: string;
|
|
114
|
+
}, ...{
|
|
115
|
+
readonly locale: "en" | "ja" | "ko";
|
|
116
|
+
readonly message: string;
|
|
117
|
+
}[]] | undefined;
|
|
118
|
+
readonly variant?: "default" | "link" | "destructive" | "primary" | "ghost" | undefined;
|
|
119
|
+
readonly action?: any;
|
|
120
|
+
readonly hideTitle?: boolean | undefined;
|
|
121
|
+
} | {
|
|
122
|
+
readonly id: string;
|
|
123
|
+
readonly title: readonly [{
|
|
124
|
+
readonly locale: "zh";
|
|
125
|
+
readonly message: string;
|
|
126
|
+
}, ...{
|
|
127
|
+
readonly locale: "en" | "ja" | "ko";
|
|
128
|
+
readonly message: string;
|
|
129
|
+
}[]];
|
|
130
|
+
readonly items: readonly (import("../../../../actions/schema.js").RegistrySubItemValue | {
|
|
131
|
+
readonly id: string;
|
|
132
|
+
readonly title: readonly [{
|
|
133
|
+
readonly locale: "zh";
|
|
134
|
+
readonly message: string;
|
|
135
|
+
}, ...{
|
|
136
|
+
readonly locale: "en" | "ja" | "ko";
|
|
137
|
+
readonly message: string;
|
|
138
|
+
}[]];
|
|
139
|
+
readonly disabled?: string | undefined;
|
|
140
|
+
readonly icon?: string | undefined;
|
|
141
|
+
readonly hidden?: string | undefined;
|
|
142
|
+
readonly tooltip?: readonly [{
|
|
143
|
+
readonly locale: "zh";
|
|
144
|
+
readonly message: string;
|
|
145
|
+
}, ...{
|
|
146
|
+
readonly locale: "en" | "ja" | "ko";
|
|
147
|
+
readonly message: string;
|
|
148
|
+
}[]] | undefined;
|
|
149
|
+
readonly variant?: "default" | "link" | "destructive" | "primary" | "ghost" | undefined;
|
|
150
|
+
readonly action?: any;
|
|
151
|
+
})[];
|
|
152
|
+
readonly groupId: string;
|
|
153
|
+
readonly icon?: string | undefined;
|
|
154
|
+
readonly hideTitle?: boolean | undefined;
|
|
155
|
+
}, never>>, {
|
|
156
|
+
default: () => never[];
|
|
157
|
+
}>;
|
|
158
|
+
size: Schema.optionalWith<Schema.Literal<["default", "sm", "xs"]>, {
|
|
159
|
+
default: () => "default";
|
|
160
|
+
}>;
|
|
161
|
+
gap: Schema.optionalWith<Schema.filter<Schema.filter<typeof Schema.Number>>, {
|
|
162
|
+
default: () => number;
|
|
163
|
+
}>;
|
|
164
|
+
style: Schema.optional<typeof Schema.String>;
|
|
165
|
+
}>>;
|
|
32
166
|
title: Schema.TupleType<readonly [Schema.Struct<{
|
|
33
167
|
locale: Schema.Literal<["zh"]>;
|
|
34
168
|
message: Schema.SchemaClass<string, string, never>;
|
|
@@ -48,6 +182,7 @@ export declare function schema(configure: (env: Environment) => void): Schema.St
|
|
|
48
182
|
locale: Schema.Literal<["ja", "en", "ko"]>;
|
|
49
183
|
message: Schema.SchemaClass<string, string, never>;
|
|
50
184
|
}>]>>;
|
|
185
|
+
hidden: Schema.optional<Schema.SchemaClass<boolean, boolean, never>>;
|
|
51
186
|
id: Schema.refine<string, typeof Schema.String>;
|
|
52
187
|
groupId: Schema.optional<typeof Schema.UUID>;
|
|
53
188
|
type: Schema.Literal<["com.shwfed.table.column.number-input"]>;
|
|
@@ -1,13 +1,29 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
2
|
import { getProperty } from "dot-prop";
|
|
3
3
|
import { Locale } from "../../../../../share/locale.js";
|
|
4
|
-
import {
|
|
4
|
+
import { ActionSchemaFields } from "../../../../actions/schema.js";
|
|
5
|
+
import { Align, CelRowAccess, derivedRowField, editableColumnFields, editableHeader, registerRowVariablesIfAbsent } from "../../../utils/shared.js";
|
|
5
6
|
export const type = "com.shwfed.table.column.number-input";
|
|
6
7
|
export const compatibilityDate = "2026-05-20";
|
|
7
8
|
export const metadata = {
|
|
8
9
|
name: "\u6570\u503C\u8F93\u5165",
|
|
9
10
|
icon: "fluent:number-symbol-20-regular"
|
|
10
11
|
};
|
|
12
|
+
function AddonActions(configure) {
|
|
13
|
+
const configureWithRow = (env) => {
|
|
14
|
+
configure(env);
|
|
15
|
+
registerRowVariablesIfAbsent(env);
|
|
16
|
+
};
|
|
17
|
+
const { groups, items, ...rest } = ActionSchemaFields(configureWithRow).fields;
|
|
18
|
+
return Schema.Struct({
|
|
19
|
+
...rest,
|
|
20
|
+
groups: Schema.optionalWith(groups, { default: () => [] }),
|
|
21
|
+
items: Schema.optionalWith(items, { default: () => [] })
|
|
22
|
+
}).annotations({
|
|
23
|
+
title: "\u8F93\u5165\u6846\u5185\u6309\u94AE",
|
|
24
|
+
description: "\u5728\u8F93\u5165\u6846\u53F3\u4FA7\u5185\u5D4C\u4E00\u7EC4\u64CD\u4F5C\u6309\u94AE"
|
|
25
|
+
});
|
|
26
|
+
}
|
|
11
27
|
export function schema(configure) {
|
|
12
28
|
const CelBool = CelRowAccess(configure, { resultType: "bool" });
|
|
13
29
|
const CelNumber = CelRowAccess(configure, { resultType: "number" });
|
|
@@ -15,14 +31,11 @@ export function schema(configure) {
|
|
|
15
31
|
type: Schema.Literal(type),
|
|
16
32
|
compatibilityDate: Schema.Literal(compatibilityDate),
|
|
17
33
|
...editableColumnFields(),
|
|
34
|
+
align: Schema.optionalWith(Align.annotations({ title: "\u5BF9\u9F50" }), { default: () => "right" }),
|
|
18
35
|
placeholder: Schema.optional(Locale.annotations({
|
|
19
36
|
title: "\u5360\u4F4D\u7B26",
|
|
20
37
|
description: "\u5355\u5143\u683C\u4E3A\u7A7A\u65F6\u663E\u793A\u7684\u63D0\u793A\u6587\u672C"
|
|
21
38
|
})),
|
|
22
|
-
hidden: Schema.optional(CelBool.annotations({
|
|
23
|
-
title: "\u9690\u85CF\u6761\u4EF6",
|
|
24
|
-
description: "\u8FD4\u56DE `true` \u65F6\u8BE5\u884C\u7684\u8F93\u5165\u6846\u4E0D\u6E32\u67D3\uFF08\u5176\u4F59\u884C\u4E0D\u53D7\u5F71\u54CD\uFF09"
|
|
25
|
-
})),
|
|
26
39
|
disabled: Schema.optional(CelBool.annotations({
|
|
27
40
|
title: "\u7981\u7528\u6761\u4EF6",
|
|
28
41
|
description: "\u8FD4\u56DE `true` \u65F6\u8F93\u5165\u6846\u4ECD\u7136\u6E32\u67D3\u4F46\u4E0D\u53EF\u7F16\u8F91"
|
|
@@ -55,7 +68,8 @@ export function schema(configure) {
|
|
|
55
68
|
title: "\u6700\u5927\u503C",
|
|
56
69
|
description: "\u5141\u8BB8\u8F93\u5165\u7684\u6700\u5927\u503C\u8868\u8FBE\u5F0F\uFF0C\u53EF\u8BBF\u95EE `row` / `index` \u548C `form`\uFF1B\u7559\u7A7A\u65F6\u4E0D\u9650\u5236\u4E0A\u9650"
|
|
57
70
|
})),
|
|
58
|
-
derived: derivedRowField(configure, "number")
|
|
71
|
+
derived: derivedRowField(configure, "number"),
|
|
72
|
+
addon: Schema.optional(AddonActions(configure))
|
|
59
73
|
}).annotations({ title: "NumberInputRenderer", description: "\u6570\u503C\u8F93\u5165\u6E32\u67D3\u5668\uFF08\u53EF\u7F16\u8F91\uFF09" });
|
|
60
74
|
}
|
|
61
75
|
export function defaults() {
|