v-nuxt-ui 0.1.36 → 0.2.1
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/module.json +1 -1
- package/dist/module.mjs +1 -0
- package/dist/runtime/components/Watermark.d.vue.ts +3 -3
- package/dist/runtime/components/Watermark.vue.d.ts +3 -3
- package/dist/runtime/components/button/CircleColor.d.vue.ts +17 -0
- package/dist/runtime/components/button/CircleColor.vue +37 -0
- package/dist/runtime/components/button/CircleColor.vue.d.ts +17 -0
- package/dist/runtime/components/flow/FlowEdge.client.vue +170 -41
- package/dist/runtime/components/flow/FlowEditor.client.d.vue.ts +51 -0
- package/dist/runtime/components/flow/FlowEditor.client.vue +294 -0
- package/dist/runtime/components/flow/FlowEditor.client.vue.d.ts +51 -0
- package/dist/runtime/components/flow/FlowNode.client.d.vue.ts +13 -2
- package/dist/runtime/components/flow/FlowNode.client.vue +44 -48
- package/dist/runtime/components/flow/FlowNode.client.vue.d.ts +13 -2
- package/dist/runtime/components/flow/FlowToolbar.d.vue.ts +41 -5
- package/dist/runtime/components/flow/FlowToolbar.vue +554 -88
- package/dist/runtime/components/flow/FlowToolbar.vue.d.ts +41 -5
- package/dist/runtime/components/flow/FlowToolbarItemWrapper.d.vue.ts +17 -0
- package/dist/runtime/components/flow/FlowToolbarItemWrapper.vue +16 -0
- package/dist/runtime/components/flow/FlowToolbarItemWrapper.vue.d.ts +17 -0
- package/dist/runtime/components/sys/flow/CreateModal.d.vue.ts +13 -0
- package/dist/runtime/components/sys/flow/CreateModal.vue +32 -0
- package/dist/runtime/components/sys/flow/CreateModal.vue.d.ts +13 -0
- package/dist/runtime/components/sys/flow/EditNodeModal.d.vue.ts +13 -0
- package/dist/runtime/components/sys/flow/EditNodeModal.vue +30 -0
- package/dist/runtime/components/sys/flow/EditNodeModal.vue.d.ts +13 -0
- package/dist/runtime/components/sys/flow/Table.d.vue.ts +3 -0
- package/dist/runtime/components/sys/flow/Table.vue +98 -0
- package/dist/runtime/components/sys/flow/Table.vue.d.ts +3 -0
- package/dist/runtime/components/sys/table/CreateModal.vue +9 -191
- package/dist/runtime/components/sys/table/Table.vue +0 -11
- package/dist/runtime/components/sys/table/TableColumnList.d.vue.ts +54 -0
- package/dist/runtime/components/sys/table/TableColumnList.vue +196 -0
- package/dist/runtime/components/sys/table/TableColumnList.vue.d.ts +54 -0
- package/dist/runtime/components/sys/table/TableColumnModal.d.vue.ts +3 -13
- package/dist/runtime/components/sys/table/TableColumnModal.vue +32 -100
- package/dist/runtime/components/sys/table/TableColumnModal.vue.d.ts +3 -13
- package/dist/runtime/components/table/query/order/Item.d.vue.ts +2 -2
- package/dist/runtime/components/table/query/order/Item.vue.d.ts +2 -2
- package/dist/runtime/composables/api/sys/index.d.ts +3 -0
- package/dist/runtime/composables/api/sys/index.js +3 -0
- package/dist/runtime/composables/api/sys/useFlowApi.d.ts +2 -0
- package/dist/runtime/composables/api/sys/useFlowApi.js +5 -0
- package/dist/runtime/composables/api/sys/useFlowEdgeApi.d.ts +2 -0
- package/dist/runtime/composables/api/sys/useFlowEdgeApi.js +3 -0
- package/dist/runtime/composables/api/sys/useFlowNodeApi.d.ts +2 -0
- package/dist/runtime/composables/api/sys/useFlowNodeApi.js +3 -0
- package/dist/runtime/composables/flow/index.d.ts +3 -0
- package/dist/runtime/composables/flow/index.js +3 -0
- package/dist/runtime/composables/flow/useFlow.d.ts +33 -0
- package/dist/runtime/composables/flow/useFlow.js +401 -0
- package/dist/runtime/composables/flow/useFlowNode.d.ts +17 -0
- package/dist/runtime/composables/flow/useFlowNode.js +106 -0
- package/dist/runtime/composables/flow/useFlowResize.d.ts +21 -0
- package/dist/runtime/composables/flow/useFlowResize.js +84 -0
- package/dist/runtime/composables/flow/useFlowStyles.d.ts +62 -9
- package/dist/runtime/composables/flow/useFlowStyles.js +127 -23
- package/dist/runtime/composables/table/useTableColumnPermission.d.ts +36 -0
- package/dist/runtime/composables/useSidebarMenu.js +0 -2
- package/dist/runtime/composables/useTheme.d.ts +1 -1
- package/dist/runtime/composables/useTheme.js +0 -1
- package/dist/runtime/constants/flow.d.ts +166 -0
- package/dist/runtime/constants/flow.js +171 -0
- package/dist/runtime/index.css +1 -1
- package/dist/runtime/types/models/flow.d.ts +61 -0
- package/dist/runtime/types/models/flow.js +0 -0
- package/dist/runtime/types/models/index.d.ts +1 -0
- package/dist/runtime/types/models/index.js +1 -0
- package/dist/runtime/types/models/table.d.ts +1 -0
- package/dist/runtime/types/storage.d.ts +3 -4
- package/dist/runtime/types/storage.js +3 -4
- package/package.json +3 -2
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { useOverlay } from "@nuxt/ui/composables";
|
|
3
|
+
import TableColumnModal from "./TableColumnModal.vue";
|
|
4
|
+
import { useTableColumnApi } from "#v/composables";
|
|
5
|
+
import { ref, watch } from "vue";
|
|
6
|
+
import ScrollArea from "#v/components/ScrollArea.vue";
|
|
7
|
+
const props = defineProps({
|
|
8
|
+
initialColumns: { type: Array, required: false }
|
|
9
|
+
});
|
|
10
|
+
const overlay = useOverlay();
|
|
11
|
+
const columnModal = overlay.create(TableColumnModal);
|
|
12
|
+
const tableColumnApi = useTableColumnApi();
|
|
13
|
+
const columns = ref([]);
|
|
14
|
+
const deletedColumnIds = ref([]);
|
|
15
|
+
watch(() => props.initialColumns, (val) => {
|
|
16
|
+
if (val && val.length && columns.value.length === 0) {
|
|
17
|
+
columns.value = val.map((col) => ({
|
|
18
|
+
...col,
|
|
19
|
+
columnKey: col.columnKey ?? "",
|
|
20
|
+
label: col.label ?? "",
|
|
21
|
+
order: col.order ?? 0,
|
|
22
|
+
width: col.width ?? 100,
|
|
23
|
+
fixed: col.fixed ?? "",
|
|
24
|
+
visible: col.visible ?? true
|
|
25
|
+
}));
|
|
26
|
+
}
|
|
27
|
+
}, { immediate: true });
|
|
28
|
+
function addColumn() {
|
|
29
|
+
const maxOrder = columns.value.reduce((max, col) => Math.max(max, col.order ?? 0), 0);
|
|
30
|
+
const defaultCol = {
|
|
31
|
+
id: 0,
|
|
32
|
+
columnKey: "",
|
|
33
|
+
label: "",
|
|
34
|
+
order: maxOrder + 1,
|
|
35
|
+
width: 100,
|
|
36
|
+
fixed: "",
|
|
37
|
+
visible: true
|
|
38
|
+
};
|
|
39
|
+
columnModal.open({
|
|
40
|
+
column: defaultCol,
|
|
41
|
+
onSaveColumn: (col) => {
|
|
42
|
+
columns.value.push({ ...col, id: 0, _isDirty: true });
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
function removeColumn(index) {
|
|
47
|
+
const col = columns.value[index];
|
|
48
|
+
if (!col) return;
|
|
49
|
+
if (col.id !== 0) {
|
|
50
|
+
deletedColumnIds.value.push(col.id);
|
|
51
|
+
}
|
|
52
|
+
columns.value.splice(index, 1);
|
|
53
|
+
}
|
|
54
|
+
function editColumn(index) {
|
|
55
|
+
const col = columns.value[index];
|
|
56
|
+
if (!col) return;
|
|
57
|
+
columnModal.open({
|
|
58
|
+
column: col,
|
|
59
|
+
onSaveColumn: (updated) => {
|
|
60
|
+
columns.value[index] = { ...updated, id: col.id, _isDirty: true };
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
function fixedLabel(fixed) {
|
|
65
|
+
const map = { left: "\u56FA\u5B9A\u5DE6", right: "\u56FA\u5B9A\u53F3" };
|
|
66
|
+
return map[fixed] ?? "";
|
|
67
|
+
}
|
|
68
|
+
async function createAllColumns(tableId) {
|
|
69
|
+
for (const col of columns.value) {
|
|
70
|
+
await tableColumnApi.create(tableColumnApi.prune({
|
|
71
|
+
...col,
|
|
72
|
+
tableId
|
|
73
|
+
}));
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
async function saveDirtyColumns(tableId) {
|
|
77
|
+
for (const col of columns.value) {
|
|
78
|
+
if (col._isDirty) {
|
|
79
|
+
const colData = {
|
|
80
|
+
id: col.id,
|
|
81
|
+
tableId,
|
|
82
|
+
columnKey: col.columnKey,
|
|
83
|
+
label: col.label,
|
|
84
|
+
order: col.order,
|
|
85
|
+
width: col.width,
|
|
86
|
+
fixed: col.fixed,
|
|
87
|
+
visible: col.visible
|
|
88
|
+
};
|
|
89
|
+
if (col.id === 0) {
|
|
90
|
+
await tableColumnApi.create(tableColumnApi.prune(colData));
|
|
91
|
+
} else {
|
|
92
|
+
await tableColumnApi.update(tableColumnApi.prune(colData));
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
for (const id of deletedColumnIds.value) {
|
|
97
|
+
await tableColumnApi.deleteById(id);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
defineExpose({
|
|
101
|
+
columns,
|
|
102
|
+
createAllColumns,
|
|
103
|
+
saveDirtyColumns
|
|
104
|
+
});
|
|
105
|
+
</script>
|
|
106
|
+
|
|
107
|
+
<template>
|
|
108
|
+
<div class="pt-6">
|
|
109
|
+
<div class="flex items-center justify-between mb-3">
|
|
110
|
+
<div>
|
|
111
|
+
<div class="font-semibold text-sm">
|
|
112
|
+
列配置
|
|
113
|
+
</div>
|
|
114
|
+
<div class="text-sm text-dimmed text-xs">
|
|
115
|
+
配置 Table 的列信息
|
|
116
|
+
</div>
|
|
117
|
+
</div>
|
|
118
|
+
<UButton
|
|
119
|
+
label="添加列"
|
|
120
|
+
icon="i-lucide-plus"
|
|
121
|
+
variant="soft"
|
|
122
|
+
size="sm"
|
|
123
|
+
@click="addColumn"
|
|
124
|
+
/>
|
|
125
|
+
</div>
|
|
126
|
+
|
|
127
|
+
<div v-if="columns.length === 0" class="py-8 text-center text-dimmed text-xs">
|
|
128
|
+
暂无列配置,点击"添加列"创建
|
|
129
|
+
</div>
|
|
130
|
+
<ScrollArea v-else class="max-h-72 rounded-md border border-default">
|
|
131
|
+
<div class="flex flex-col divide-y divide-default">
|
|
132
|
+
<div
|
|
133
|
+
v-for="(col, index) in columns"
|
|
134
|
+
:key="col.id + '-' + index"
|
|
135
|
+
class="group flex items-center gap-3 px-3 py-2.5 transition-colors hover:bg-muted"
|
|
136
|
+
>
|
|
137
|
+
<!-- index box -->
|
|
138
|
+
<div class="flex size-8 shrink-0 items-center justify-center rounded-md bg-primary/10 text-primary text-xs font-semibold">
|
|
139
|
+
{{ col.order }}
|
|
140
|
+
</div>
|
|
141
|
+
|
|
142
|
+
<div class="min-w-0 flex-1">
|
|
143
|
+
<div class="flex items-center gap-2">
|
|
144
|
+
<span class="font-medium text-sm truncate">{{ col.label || "\u672A\u547D\u540D" }}</span>
|
|
145
|
+
<span class="text-xs text-dimmed font-mono truncate">{{ col.columnKey || "-" }}</span>
|
|
146
|
+
</div>
|
|
147
|
+
<div class="flex items-center gap-2 mt-0.5">
|
|
148
|
+
<span class="text-xs text-dimmed">宽 {{ col.width }}px</span>
|
|
149
|
+
<UBadge
|
|
150
|
+
v-if="col.fixed"
|
|
151
|
+
size="xs"
|
|
152
|
+
variant="subtle"
|
|
153
|
+
color="info"
|
|
154
|
+
>
|
|
155
|
+
{{ fixedLabel(col.fixed) }}
|
|
156
|
+
</UBadge>
|
|
157
|
+
<UBadge
|
|
158
|
+
v-if="!col.visible"
|
|
159
|
+
size="xs"
|
|
160
|
+
variant="subtle"
|
|
161
|
+
color="warning"
|
|
162
|
+
>
|
|
163
|
+
已隐藏
|
|
164
|
+
</UBadge>
|
|
165
|
+
<UBadge
|
|
166
|
+
v-if="col.id === 0"
|
|
167
|
+
size="xs"
|
|
168
|
+
variant="subtle"
|
|
169
|
+
color="success"
|
|
170
|
+
>
|
|
171
|
+
新增
|
|
172
|
+
</UBadge>
|
|
173
|
+
</div>
|
|
174
|
+
</div>
|
|
175
|
+
|
|
176
|
+
<div class="flex shrink-0 items-center opacity-0 group-hover:opacity-100 transition-opacity">
|
|
177
|
+
<UButton
|
|
178
|
+
icon="i-lucide-pencil"
|
|
179
|
+
variant="ghost"
|
|
180
|
+
size="xs"
|
|
181
|
+
color="neutral"
|
|
182
|
+
@click="editColumn(index)"
|
|
183
|
+
/>
|
|
184
|
+
<UButton
|
|
185
|
+
icon="i-lucide-trash-2"
|
|
186
|
+
variant="ghost"
|
|
187
|
+
size="xs"
|
|
188
|
+
color="error"
|
|
189
|
+
@click="removeColumn(index)"
|
|
190
|
+
/>
|
|
191
|
+
</div>
|
|
192
|
+
</div>
|
|
193
|
+
</div>
|
|
194
|
+
</ScrollArea>
|
|
195
|
+
</div>
|
|
196
|
+
</template>
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { TableColumn } from '#v/types';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
initialColumns?: TableColumn[];
|
|
4
|
+
};
|
|
5
|
+
interface ColumnRow extends TableColumn {
|
|
6
|
+
_isDirty?: boolean;
|
|
7
|
+
}
|
|
8
|
+
/** 供父组件在提交时调用:创建新表后批量创建列 */
|
|
9
|
+
declare function createAllColumns(tableId: number): Promise<void>;
|
|
10
|
+
/** 供父组件在提交时调用:保存已有表的列变更 */
|
|
11
|
+
declare function saveDirtyColumns(tableId: number): Promise<void>;
|
|
12
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {
|
|
13
|
+
columns: import("vue").Ref<{
|
|
14
|
+
_isDirty?: boolean | undefined;
|
|
15
|
+
tableId?: number | undefined;
|
|
16
|
+
columnKey?: string | undefined;
|
|
17
|
+
label?: string | undefined;
|
|
18
|
+
labelI18nKey?: string | undefined;
|
|
19
|
+
order?: number | undefined;
|
|
20
|
+
width?: number | undefined;
|
|
21
|
+
fixed?: "left" | "right" | "" | undefined;
|
|
22
|
+
visible?: boolean | undefined;
|
|
23
|
+
id: number;
|
|
24
|
+
createdAt?: string | undefined;
|
|
25
|
+
updatedAt?: string | undefined;
|
|
26
|
+
version?: number | undefined;
|
|
27
|
+
createdBy?: number | undefined;
|
|
28
|
+
creator?: any;
|
|
29
|
+
updatedBy?: number | undefined;
|
|
30
|
+
updater?: any;
|
|
31
|
+
}[], ColumnRow[] | {
|
|
32
|
+
_isDirty?: boolean | undefined;
|
|
33
|
+
tableId?: number | undefined;
|
|
34
|
+
columnKey?: string | undefined;
|
|
35
|
+
label?: string | undefined;
|
|
36
|
+
labelI18nKey?: string | undefined;
|
|
37
|
+
order?: number | undefined;
|
|
38
|
+
width?: number | undefined;
|
|
39
|
+
fixed?: "left" | "right" | "" | undefined;
|
|
40
|
+
visible?: boolean | undefined;
|
|
41
|
+
id: number;
|
|
42
|
+
createdAt?: string | undefined;
|
|
43
|
+
updatedAt?: string | undefined;
|
|
44
|
+
version?: number | undefined;
|
|
45
|
+
createdBy?: number | undefined;
|
|
46
|
+
creator?: any;
|
|
47
|
+
updatedBy?: number | undefined;
|
|
48
|
+
updater?: any;
|
|
49
|
+
}[]>;
|
|
50
|
+
createAllColumns: typeof createAllColumns;
|
|
51
|
+
saveDirtyColumns: typeof saveDirtyColumns;
|
|
52
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
53
|
+
declare const _default: typeof __VLS_export;
|
|
54
|
+
export default _default;
|
|
@@ -1,22 +1,12 @@
|
|
|
1
|
-
import type { TableColumn
|
|
1
|
+
import type { TableColumn } from '#v/types';
|
|
2
2
|
type __VLS_Props = {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
id: number;
|
|
6
|
-
columnKey: string;
|
|
7
|
-
label: string;
|
|
8
|
-
order: number;
|
|
9
|
-
width: number;
|
|
10
|
-
fixed: 'left' | 'right' | '';
|
|
11
|
-
visible: boolean;
|
|
12
|
-
};
|
|
3
|
+
column: TableColumn;
|
|
4
|
+
onSaveColumn: (col: TableColumn) => void;
|
|
13
5
|
};
|
|
14
6
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
15
7
|
close: (args_0: boolean) => any;
|
|
16
|
-
save: (args_0: Partial<TableColumn>) => any;
|
|
17
8
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
18
9
|
onClose?: ((args_0: boolean) => any) | undefined;
|
|
19
|
-
onSave?: ((args_0: Partial<TableColumn>) => any) | undefined;
|
|
20
10
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
21
11
|
declare const _default: typeof __VLS_export;
|
|
22
12
|
export default _default;
|
|
@@ -1,107 +1,39 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
2
|
+
import * as z from "zod";
|
|
3
|
+
import FormCreateModalTemplate from "#v/components/form/create-modal-template/index.vue";
|
|
4
|
+
import { useFormValues } from "#v/composables";
|
|
5
|
+
import { computed, toRef } from "vue";
|
|
5
6
|
const props = defineProps({
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
column: { type: Object, required: true },
|
|
8
|
+
onSaveColumn: { type: Function, required: true }
|
|
8
9
|
});
|
|
9
|
-
const emit = defineEmits(["close"
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
label:
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
id: props.column?.id,
|
|
25
|
-
columnKey: formData.value.columnKey,
|
|
26
|
-
label: formData.value.label,
|
|
27
|
-
order: formData.value.order,
|
|
28
|
-
width: formData.value.width,
|
|
29
|
-
fixed: formData.value.fixed,
|
|
30
|
-
visible: formData.value.visible
|
|
31
|
-
});
|
|
32
|
-
emit("close", true);
|
|
33
|
-
} catch (error) {
|
|
34
|
-
useToast().add({
|
|
35
|
-
title: "\u4FDD\u5B58\u5931\u8D25",
|
|
36
|
-
description: String(error),
|
|
37
|
-
color: "error",
|
|
38
|
-
icon: "i-lucide-x-circle"
|
|
39
|
-
});
|
|
40
|
-
emit("close", false);
|
|
41
|
-
} finally {
|
|
42
|
-
saving.value = false;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
10
|
+
const emit = defineEmits(["close"]);
|
|
11
|
+
const { newValues } = useFormValues(toRef(props.column), { id: 0 });
|
|
12
|
+
const fixedItems = [
|
|
13
|
+
{ label: "\u4E0D\u56FA\u5B9A", value: "" },
|
|
14
|
+
{ label: "\u5DE6\u4FA7\u56FA\u5B9A", value: "left" },
|
|
15
|
+
{ label: "\u53F3\u4FA7\u56FA\u5B9A", value: "right" }
|
|
16
|
+
];
|
|
17
|
+
const fields = computed(() => [
|
|
18
|
+
{ name: "columnKey", type: "input", label: "\u5217\u6807\u8BC6", colSpan: "12", zodType: z.string().min(1, "\u5217\u6807\u8BC6\u4E0D\u80FD\u4E3A\u7A7A") },
|
|
19
|
+
{ name: "label", type: "input", label: "\u663E\u793A\u540D", colSpan: "12", zodType: z.string().min(1, "\u663E\u793A\u540D\u4E0D\u80FD\u4E3A\u7A7A") },
|
|
20
|
+
{ name: "order", type: "input-number", label: "\u987A\u5E8F", colSpan: "8", zodType: z.number() },
|
|
21
|
+
{ name: "width", type: "input-number", label: "\u5BBD\u5EA6", colSpan: "8", zodType: z.number() },
|
|
22
|
+
{ name: "fixed", type: "select", label: "\u56FA\u5B9A", colSpan: "8", items: fixedItems, enableEmptyOption: false, zodType: z.string().optional() },
|
|
23
|
+
{ name: "visible", type: "switch", label: "\u662F\u5426\u663E\u793A", colSpan: "24", zodType: z.boolean().optional() }
|
|
24
|
+
]);
|
|
45
25
|
</script>
|
|
46
26
|
|
|
47
27
|
<template>
|
|
48
|
-
<
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
:
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
<div>
|
|
60
|
-
<label class="text-sm font-medium mb-1 block">显示名</label>
|
|
61
|
-
<UInput v-model="formData.label" placeholder="显示名" />
|
|
62
|
-
</div>
|
|
63
|
-
</div>
|
|
64
|
-
<div class="grid grid-cols-3 gap-4">
|
|
65
|
-
<div>
|
|
66
|
-
<label class="text-sm font-medium mb-1 block">顺序</label>
|
|
67
|
-
<UInputNumber v-model="formData.order" :min="0" class="w-full" />
|
|
68
|
-
</div>
|
|
69
|
-
<div>
|
|
70
|
-
<label class="text-sm font-medium mb-1 block">宽度</label>
|
|
71
|
-
<UInputNumber v-model="formData.width" :min="0" class="w-full" />
|
|
72
|
-
</div>
|
|
73
|
-
<div>
|
|
74
|
-
<label class="text-sm font-medium mb-1 block">固定</label>
|
|
75
|
-
<USelect
|
|
76
|
-
v-model="formData.fixed"
|
|
77
|
-
:items="[
|
|
78
|
-
{ label: '\u4E0D\u56FA\u5B9A', value: '' },
|
|
79
|
-
{ label: '\u5DE6\u4FA7', value: 'left' },
|
|
80
|
-
{ label: '\u53F3\u4FA7', value: 'right' }
|
|
81
|
-
]"
|
|
82
|
-
class="w-full"
|
|
83
|
-
/>
|
|
84
|
-
</div>
|
|
85
|
-
</div>
|
|
86
|
-
<div class="flex items-center gap-2">
|
|
87
|
-
<USwitch v-model="formData.visible" />
|
|
88
|
-
<span class="text-sm">{{ formData.visible ? "\u663E\u793A" : "\u9690\u85CF" }}</span>
|
|
89
|
-
</div>
|
|
90
|
-
</div>
|
|
91
|
-
<template #footer>
|
|
92
|
-
<UButton
|
|
93
|
-
label="取消"
|
|
94
|
-
color="neutral"
|
|
95
|
-
variant="subtle"
|
|
96
|
-
@click="emit('close', false)"
|
|
97
|
-
/>
|
|
98
|
-
<UButton
|
|
99
|
-
label="保存"
|
|
100
|
-
color="primary"
|
|
101
|
-
variant="solid"
|
|
102
|
-
:loading="saving"
|
|
103
|
-
@click="handleSave"
|
|
104
|
-
/>
|
|
105
|
-
</template>
|
|
106
|
-
</UModal>
|
|
28
|
+
<FormCreateModalTemplate
|
|
29
|
+
title="列配置"
|
|
30
|
+
:on-close="(ok) => emit('close', ok)"
|
|
31
|
+
:fields="fields"
|
|
32
|
+
:model-value="newValues"
|
|
33
|
+
@update-model-value="(newVal) => newValues = { id: 0, ...newVal }"
|
|
34
|
+
@submit="async () => {
|
|
35
|
+
props.onSaveColumn(newValues);
|
|
36
|
+
emit('close', true);
|
|
37
|
+
}"
|
|
38
|
+
/>
|
|
107
39
|
</template>
|
|
@@ -1,22 +1,12 @@
|
|
|
1
|
-
import type { TableColumn
|
|
1
|
+
import type { TableColumn } from '#v/types';
|
|
2
2
|
type __VLS_Props = {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
id: number;
|
|
6
|
-
columnKey: string;
|
|
7
|
-
label: string;
|
|
8
|
-
order: number;
|
|
9
|
-
width: number;
|
|
10
|
-
fixed: 'left' | 'right' | '';
|
|
11
|
-
visible: boolean;
|
|
12
|
-
};
|
|
3
|
+
column: TableColumn;
|
|
4
|
+
onSaveColumn: (col: TableColumn) => void;
|
|
13
5
|
};
|
|
14
6
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
15
7
|
close: (args_0: boolean) => any;
|
|
16
|
-
save: (args_0: Partial<TableColumn>) => any;
|
|
17
8
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
18
9
|
onClose?: ((args_0: boolean) => any) | undefined;
|
|
19
|
-
onSave?: ((args_0: Partial<TableColumn>) => any) | undefined;
|
|
20
10
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
21
11
|
declare const _default: typeof __VLS_export;
|
|
22
12
|
export default _default;
|
|
@@ -7,15 +7,15 @@ declare const __VLS_export: <T>(__VLS_props: NonNullable<Awaited<typeof __VLS_se
|
|
|
7
7
|
orderOptions: OrderQueryOption<T>[];
|
|
8
8
|
unselectedFields: string[];
|
|
9
9
|
} & {
|
|
10
|
-
onRemove?: (() => any) | undefined;
|
|
11
10
|
onChange?: ((args_0: string, args_1: OrderQueryOpr) => any) | undefined;
|
|
11
|
+
onRemove?: (() => any) | undefined;
|
|
12
12
|
}> & (typeof globalThis extends {
|
|
13
13
|
__VLS_PROPS_FALLBACK: infer P;
|
|
14
14
|
} ? P : {});
|
|
15
15
|
expose: (exposed: {}) => void;
|
|
16
16
|
attrs: any;
|
|
17
17
|
slots: {};
|
|
18
|
-
emit: ((evt: "
|
|
18
|
+
emit: ((evt: "change", args_0: string, args_1: OrderQueryOpr) => void) & ((evt: "remove") => void);
|
|
19
19
|
}>) => import("vue").VNode & {
|
|
20
20
|
__ctx?: Awaited<typeof __VLS_setup>;
|
|
21
21
|
};
|
|
@@ -7,15 +7,15 @@ declare const __VLS_export: <T>(__VLS_props: NonNullable<Awaited<typeof __VLS_se
|
|
|
7
7
|
orderOptions: OrderQueryOption<T>[];
|
|
8
8
|
unselectedFields: string[];
|
|
9
9
|
} & {
|
|
10
|
-
onRemove?: (() => any) | undefined;
|
|
11
10
|
onChange?: ((args_0: string, args_1: OrderQueryOpr) => any) | undefined;
|
|
11
|
+
onRemove?: (() => any) | undefined;
|
|
12
12
|
}> & (typeof globalThis extends {
|
|
13
13
|
__VLS_PROPS_FALLBACK: infer P;
|
|
14
14
|
} ? P : {});
|
|
15
15
|
expose: (exposed: {}) => void;
|
|
16
16
|
attrs: any;
|
|
17
17
|
slots: {};
|
|
18
|
-
emit: ((evt: "
|
|
18
|
+
emit: ((evt: "change", args_0: string, args_1: OrderQueryOpr) => void) & ((evt: "remove") => void);
|
|
19
19
|
}>) => import("vue").VNode & {
|
|
20
20
|
__ctx?: Awaited<typeof __VLS_setup>;
|
|
21
21
|
};
|
|
@@ -12,3 +12,6 @@ export * from './useUserApi.js';
|
|
|
12
12
|
export * from '../useTableApi.js';
|
|
13
13
|
export * from '../useTableColumnApi.js';
|
|
14
14
|
export * from '../useTablePermissionApi.js';
|
|
15
|
+
export * from './useFlowApi.js';
|
|
16
|
+
export * from './useFlowNodeApi.js';
|
|
17
|
+
export * from './useFlowEdgeApi.js';
|
|
@@ -12,3 +12,6 @@ export * from "./useUserApi.js";
|
|
|
12
12
|
export * from "../useTableApi.js";
|
|
13
13
|
export * from "../useTableColumnApi.js";
|
|
14
14
|
export * from "../useTablePermissionApi.js";
|
|
15
|
+
export * from "./useFlowApi.js";
|
|
16
|
+
export * from "./useFlowNodeApi.js";
|
|
17
|
+
export * from "./useFlowEdgeApi.js";
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { Node, Edge, Connection } from '@vue-flow/core';
|
|
2
|
+
import type { ComputedRef, ShallowRef, Ref } from 'vue';
|
|
3
|
+
import type { Flow, FlowNode, FlowApi, UseFlowResizeDimensions } from '#v/types';
|
|
4
|
+
export interface UseFlowOptions {
|
|
5
|
+
flow: ComputedRef<Flow | undefined>;
|
|
6
|
+
onUpdateModel?: ComputedRef<((model: Flow) => void) | undefined>;
|
|
7
|
+
/** CRUD API 回调,在节点/边增删改时调用 */
|
|
8
|
+
api?: ComputedRef<FlowApi | undefined>;
|
|
9
|
+
}
|
|
10
|
+
export interface UseFlowReturn {
|
|
11
|
+
nodes: ShallowRef<Node[]>;
|
|
12
|
+
edges: ShallowRef<Edge[]>;
|
|
13
|
+
GRID_SIZE: number;
|
|
14
|
+
/** 是否有 API 操作正在进行 */
|
|
15
|
+
loading: Ref<boolean>;
|
|
16
|
+
deleteNode: (nodeId: string) => Promise<void>;
|
|
17
|
+
deleteEdge: (edgeId: string) => Promise<void>;
|
|
18
|
+
createEdge: (params: Connection) => Promise<void>;
|
|
19
|
+
/** 重连边:乐观更新,立即移动到新位置(带 opacity),API 完成后恢复 */
|
|
20
|
+
reconnectEdge: (oldEdgeId: string, connection: Connection) => Promise<void>;
|
|
21
|
+
updateNodePosition: (nodeId: string, x: number, y: number) => Promise<void>;
|
|
22
|
+
updateNodeDimensions: (nodeId: string, dimensions: UseFlowResizeDimensions) => Promise<void>;
|
|
23
|
+
updateNode: (updatedNode: FlowNode) => Promise<void>;
|
|
24
|
+
createNode: () => Promise<void>;
|
|
25
|
+
syncNodes: (createHandlers: (nodeId: string) => Record<string, any>) => void;
|
|
26
|
+
updateEdgeLabel: (edgeId: string, label: string) => Promise<void>;
|
|
27
|
+
syncEdges: (createHandlers: (edgeId: string) => Record<string, any>) => void;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Flow 业务逻辑 Composable
|
|
31
|
+
* 管理节点和边的 CRUD 操作,并同步到外部数据模型
|
|
32
|
+
*/
|
|
33
|
+
export declare function useFlow(options: UseFlowOptions): UseFlowReturn;
|