v-nuxt-ui 0.1.35 → 0.2.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.
Files changed (109) hide show
  1. package/dist/module.json +1 -1
  2. package/dist/module.mjs +1 -0
  3. package/dist/runtime/components/Watermark.d.vue.ts +3 -3
  4. package/dist/runtime/components/Watermark.vue.d.ts +3 -3
  5. package/dist/runtime/components/button/CircleColor.d.vue.ts +17 -0
  6. package/dist/runtime/components/button/CircleColor.vue +37 -0
  7. package/dist/runtime/components/button/CircleColor.vue.d.ts +17 -0
  8. package/dist/runtime/components/button/Dropdown.vue +5 -1
  9. package/dist/runtime/components/date-picker/Input.d.vue.ts +9 -1
  10. package/dist/runtime/components/date-picker/Input.vue +55 -11
  11. package/dist/runtime/components/date-picker/Input.vue.d.ts +9 -1
  12. package/dist/runtime/components/date-picker/index.vue +3 -3
  13. package/dist/runtime/components/flow/FlowEdge.client.vue +170 -41
  14. package/dist/runtime/components/flow/FlowEditor.client.d.vue.ts +51 -0
  15. package/dist/runtime/components/flow/FlowEditor.client.vue +287 -0
  16. package/dist/runtime/components/flow/FlowEditor.client.vue.d.ts +51 -0
  17. package/dist/runtime/components/flow/FlowNode.client.d.vue.ts +13 -2
  18. package/dist/runtime/components/flow/FlowNode.client.vue +44 -48
  19. package/dist/runtime/components/flow/FlowNode.client.vue.d.ts +13 -2
  20. package/dist/runtime/components/flow/FlowToolbar.d.vue.ts +41 -5
  21. package/dist/runtime/components/flow/FlowToolbar.vue +554 -88
  22. package/dist/runtime/components/flow/FlowToolbar.vue.d.ts +41 -5
  23. package/dist/runtime/components/flow/FlowToolbarItemWrapper.d.vue.ts +17 -0
  24. package/dist/runtime/components/flow/FlowToolbarItemWrapper.vue +16 -0
  25. package/dist/runtime/components/flow/FlowToolbarItemWrapper.vue.d.ts +17 -0
  26. package/dist/runtime/components/form/field/DatePicker.vue +1 -1
  27. package/dist/runtime/components/sys/flow/CreateModal.d.vue.ts +13 -0
  28. package/dist/runtime/components/sys/flow/CreateModal.vue +32 -0
  29. package/dist/runtime/components/sys/flow/CreateModal.vue.d.ts +13 -0
  30. package/dist/runtime/components/sys/flow/EditNodeModal.d.vue.ts +13 -0
  31. package/dist/runtime/components/sys/flow/EditNodeModal.vue +30 -0
  32. package/dist/runtime/components/sys/flow/EditNodeModal.vue.d.ts +13 -0
  33. package/dist/runtime/components/sys/flow/Table.d.vue.ts +3 -0
  34. package/dist/runtime/components/sys/flow/Table.vue +103 -0
  35. package/dist/runtime/components/sys/flow/Table.vue.d.ts +3 -0
  36. package/dist/runtime/components/sys/table/CreateModal.vue +9 -193
  37. package/dist/runtime/components/sys/table/Table.vue +6 -15
  38. package/dist/runtime/components/sys/table/TableColumnList.d.vue.ts +54 -0
  39. package/dist/runtime/components/sys/table/TableColumnList.vue +196 -0
  40. package/dist/runtime/components/sys/table/TableColumnList.vue.d.ts +54 -0
  41. package/dist/runtime/components/sys/table/TableColumnModal.d.vue.ts +3 -13
  42. package/dist/runtime/components/sys/table/TableColumnModal.vue +32 -100
  43. package/dist/runtime/components/sys/table/TableColumnModal.vue.d.ts +3 -13
  44. package/dist/runtime/components/sys/user/Table.vue +44 -27
  45. package/dist/runtime/components/table/permission/TablePermissionConfig.d.vue.ts +2 -2
  46. package/dist/runtime/components/table/permission/TablePermissionConfig.vue +3 -3
  47. package/dist/runtime/components/table/permission/TablePermissionConfig.vue.d.ts +2 -2
  48. package/dist/runtime/components/table/permission/TablePermissionTab.vue +7 -4
  49. package/dist/runtime/components/table/query/order/Item.d.vue.ts +2 -2
  50. package/dist/runtime/components/table/query/order/Item.vue.d.ts +2 -2
  51. package/dist/runtime/components/table/query/where/Newer.vue +2 -0
  52. package/dist/runtime/components/table/query/where/index.vue +46 -15
  53. package/dist/runtime/components/table/query/where/simple/item/ColumnPicker.vue +9 -4
  54. package/dist/runtime/components/table/query/where/simple/item/OprPicker.vue +3 -3
  55. package/dist/runtime/components/table/query/where/simple/item/opr/AsyncSelect.vue +45 -48
  56. package/dist/runtime/components/table/query/where/simple/item/opr/DatePicker.vue +137 -131
  57. package/dist/runtime/components/table/query/where/simple/item/opr/Select.d.vue.ts +4 -2
  58. package/dist/runtime/components/table/query/where/simple/item/opr/Select.vue +40 -40
  59. package/dist/runtime/components/table/query/where/simple/item/opr/Select.vue.d.ts +4 -2
  60. package/dist/runtime/components/table/query/where/simple/item/opr/index.vue +2 -0
  61. package/dist/runtime/components/table/settings/TableSettings.d.vue.ts +1 -1
  62. package/dist/runtime/components/table/settings/TableSettings.vue +0 -3
  63. package/dist/runtime/components/table/settings/TableSettings.vue.d.ts +1 -1
  64. package/dist/runtime/composables/api/sys/index.d.ts +3 -0
  65. package/dist/runtime/composables/api/sys/index.js +3 -0
  66. package/dist/runtime/composables/api/sys/useFlowApi.d.ts +2 -0
  67. package/dist/runtime/composables/api/sys/useFlowApi.js +5 -0
  68. package/dist/runtime/composables/api/sys/useFlowEdgeApi.d.ts +2 -0
  69. package/dist/runtime/composables/api/sys/useFlowEdgeApi.js +3 -0
  70. package/dist/runtime/composables/api/sys/useFlowNodeApi.d.ts +2 -0
  71. package/dist/runtime/composables/api/sys/useFlowNodeApi.js +3 -0
  72. package/dist/runtime/composables/api/sys/useRoleApi.js +3 -1
  73. package/dist/runtime/composables/api/sys/useUserApi.js +3 -1
  74. package/dist/runtime/composables/flow/index.d.ts +3 -0
  75. package/dist/runtime/composables/flow/index.js +3 -0
  76. package/dist/runtime/composables/flow/useFlow.d.ts +33 -0
  77. package/dist/runtime/composables/flow/useFlow.js +401 -0
  78. package/dist/runtime/composables/flow/useFlowNode.d.ts +17 -0
  79. package/dist/runtime/composables/flow/useFlowNode.js +106 -0
  80. package/dist/runtime/composables/flow/useFlowResize.d.ts +21 -0
  81. package/dist/runtime/composables/flow/useFlowResize.js +84 -0
  82. package/dist/runtime/composables/flow/useFlowStyles.d.ts +62 -9
  83. package/dist/runtime/composables/flow/useFlowStyles.js +127 -23
  84. package/dist/runtime/composables/table/useTableColumnPermission.d.ts +36 -0
  85. package/dist/runtime/composables/useDate.js +8 -8
  86. package/dist/runtime/composables/useSidebarMenu.js +0 -2
  87. package/dist/runtime/composables/useTheme.d.ts +1 -1
  88. package/dist/runtime/composables/useTheme.js +0 -1
  89. package/dist/runtime/constants/flow.d.ts +166 -0
  90. package/dist/runtime/constants/flow.js +171 -0
  91. package/dist/runtime/constants/index.d.ts +1 -0
  92. package/dist/runtime/constants/index.js +1 -0
  93. package/dist/runtime/constants/options.js +2 -3
  94. package/dist/runtime/constants/table.d.ts +2 -0
  95. package/dist/runtime/constants/table.js +8 -0
  96. package/dist/runtime/index.css +1 -1
  97. package/dist/runtime/types/components/table/column.d.ts +4 -3
  98. package/dist/runtime/types/components/table/query/where.d.ts +1 -5
  99. package/dist/runtime/types/models/flow.d.ts +61 -0
  100. package/dist/runtime/types/models/flow.js +0 -0
  101. package/dist/runtime/types/models/index.d.ts +1 -0
  102. package/dist/runtime/types/models/index.js +1 -0
  103. package/dist/runtime/types/models/table.d.ts +1 -0
  104. package/dist/runtime/types/storage.d.ts +3 -4
  105. package/dist/runtime/types/storage.js +3 -4
  106. package/package.json +3 -2
  107. package/dist/runtime/components/table/query/where/simple/index.d.vue.ts +0 -21
  108. package/dist/runtime/components/table/query/where/simple/index.vue +0 -52
  109. package/dist/runtime/components/table/query/where/simple/index.vue.d.ts +0 -21
@@ -1,13 +1,49 @@
1
+ import type { FlowEdgeStrokeType, FlowEdgePathType, FlowArrowType } from '#v/constants';
2
+ import type { FlowColorMode } from '#v/composables/flow/useFlowStyles';
1
3
  type __VLS_Props = {
2
4
  onAddNode?: () => void;
5
+ /** 是否有 API 操作正在进行,用于禁用交互 */
6
+ loading?: boolean;
3
7
  edgeStrokeWidth?: number;
4
- edgeMarkerStart?: boolean;
5
- edgeMarkerEnd?: boolean;
8
+ edgeStrokeType?: FlowEdgeStrokeType;
9
+ edgePathType?: FlowEdgePathType;
10
+ edgeMarkerStart?: FlowArrowType;
11
+ edgeMarkerEnd?: FlowArrowType;
12
+ edgeAnimated?: boolean;
13
+ edgeColor?: string;
14
+ edgeLabelColor?: string;
6
15
  nodeBorderWidth?: number;
7
- onEdgeStrokeWidthChange?: (width: number) => void;
8
- onToggleEdgeMarkerStart?: () => void;
9
- onToggleEdgeMarkerEnd?: () => void;
16
+ nodeBorderRadius?: number;
17
+ nodeBorderColor?: string;
18
+ nodeBgColor?: string;
19
+ nodeFontColor?: string;
20
+ nodeFontSize?: number;
21
+ nodeHandleSize?: number;
22
+ nodeHandleColor?: string;
23
+ /** 颜色模式 */
24
+ colorMode?: FlowColorMode;
25
+ /** 统一颜色名称 */
26
+ unifiedColor?: string;
27
+ /** 是否统一模式 */
28
+ isUnifiedMode?: boolean;
29
+ onEdgeStrokeWidthChange: (width: number) => void;
30
+ onEdgeStrokeTypeChange?: (type: FlowEdgeStrokeType) => void;
31
+ onEdgePathTypeChange?: (type: FlowEdgePathType) => void;
32
+ onEdgeMarkerStartChange?: (type: FlowArrowType) => void;
33
+ onEdgeMarkerEndChange?: (type: FlowArrowType) => void;
34
+ onToggleEdgeAnimated?: () => void;
35
+ onEdgeColorChange?: (color: string) => void;
36
+ onEdgeLabelColorChange?: (color: string) => void;
10
37
  onNodeBorderWidthChange?: (width: number) => void;
38
+ onNodeBorderRadiusChange?: (radius: number) => void;
39
+ onNodeBorderColorChange?: (color: string) => void;
40
+ onNodeBgColorChange?: (color: string) => void;
41
+ onNodeFontColorChange?: (color: string) => void;
42
+ onNodeFontSizeChange?: (size: number) => void;
43
+ onNodeHandleSizeChange?: (size: number) => void;
44
+ onNodeHandleColorChange?: (color: string) => void;
45
+ onColorModeChange?: (mode: FlowColorMode) => void;
46
+ onUnifiedColorChange?: (name: string) => void;
11
47
  };
12
48
  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>;
13
49
  declare const _default: typeof __VLS_export;
@@ -0,0 +1,17 @@
1
+ type __VLS_Props = {
2
+ label: string;
3
+ description?: string;
4
+ };
5
+ declare var __VLS_1: {};
6
+ type __VLS_Slots = {} & {
7
+ default?: (props: typeof __VLS_1) => any;
8
+ };
9
+ declare const __VLS_base: 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>;
10
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
11
+ declare const _default: typeof __VLS_export;
12
+ export default _default;
13
+ type __VLS_WithSlots<T, S> = T & {
14
+ new (): {
15
+ $slots: S;
16
+ };
17
+ };
@@ -0,0 +1,16 @@
1
+ <script setup>
2
+ defineProps({
3
+ label: { type: String, required: true },
4
+ description: { type: String, required: false }
5
+ });
6
+ </script>
7
+
8
+ <template>
9
+ <div class="flex items-center gap-12 justify-between min-h-4">
10
+ <div class="flex flex-col flex-1">
11
+ <span class="font-bold text-sm">{{ label }}</span>
12
+ <span v-if="description" class="text-xs text-muted">{{ description }}</span>
13
+ </div>
14
+ <slot name="default" />
15
+ </div>
16
+ </template>
@@ -0,0 +1,17 @@
1
+ type __VLS_Props = {
2
+ label: string;
3
+ description?: string;
4
+ };
5
+ declare var __VLS_1: {};
6
+ type __VLS_Slots = {} & {
7
+ default?: (props: typeof __VLS_1) => any;
8
+ };
9
+ declare const __VLS_base: 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>;
10
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
11
+ declare const _default: typeof __VLS_export;
12
+ export default _default;
13
+ type __VLS_WithSlots<T, S> = T & {
14
+ new (): {
15
+ $slots: S;
16
+ };
17
+ };
@@ -71,7 +71,7 @@ const dateStrInputFocus = () => {
71
71
  <DatePickerInput
72
72
  ref="dateStrValueInput"
73
73
  v-model:value="dateStrValue"
74
- placeholder="YYYY/MM/DD 日期"
74
+ placeholder="YYYY-MM-DD 日期"
75
75
  />
76
76
  <UCalendar
77
77
  :model-value="dateValue"
@@ -0,0 +1,13 @@
1
+ import type { Flow } from '#v/types';
2
+ type __VLS_Props = {
3
+ model: Flow;
4
+ };
5
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
6
+ close: (args_0: boolean) => any;
7
+ save: (args_0: Flow) => any;
8
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
9
+ onClose?: ((args_0: boolean) => any) | undefined;
10
+ onSave?: ((args_0: Flow) => any) | undefined;
11
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
12
+ declare const _default: typeof __VLS_export;
13
+ export default _default;
@@ -0,0 +1,32 @@
1
+ <script setup>
2
+ import * as z from "zod";
3
+ import FormCreateModalTemplate from "#v/components/form/create-modal-template/index.vue";
4
+ import { useFlowApi, useFormSubmission, useFormValues } from "#v/composables";
5
+ import { toRef } from "vue";
6
+ const props = defineProps({
7
+ model: { type: Object, required: true }
8
+ });
9
+ const emit = defineEmits(["close", "save"]);
10
+ const { oldValues, newValues } = useFormValues(toRef(props.model), { id: 0 });
11
+ const { onSubmit } = useFormSubmission(
12
+ toRef(oldValues),
13
+ toRef(newValues),
14
+ (close) => emit("close", close),
15
+ (model) => emit("save", model),
16
+ useFlowApi
17
+ );
18
+ </script>
19
+
20
+ <template>
21
+ <FormCreateModalTemplate
22
+ title="流程信息"
23
+ :on-close="(ok) => emit('close', ok)"
24
+ :fields="[
25
+ { name: 'name', type: 'input', label: '\u6D41\u7A0B\u540D\u79F0', colSpan: '24', zodType: z.string().min(2, '\u540D\u79F0\u5B57\u6570\u4E0D\u8DB3') },
26
+ { name: 'description', type: 'textarea', label: '\u6D41\u7A0B\u63CF\u8FF0', colSpan: '24' }
27
+ ]"
28
+ :model-value="newValues"
29
+ @update-model-value="(newVal) => newValues = { ...newValues, ...newVal }"
30
+ @submit="onSubmit"
31
+ />
32
+ </template>
@@ -0,0 +1,13 @@
1
+ import type { Flow } from '#v/types';
2
+ type __VLS_Props = {
3
+ model: Flow;
4
+ };
5
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
6
+ close: (args_0: boolean) => any;
7
+ save: (args_0: Flow) => any;
8
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
9
+ onClose?: ((args_0: boolean) => any) | undefined;
10
+ onSave?: ((args_0: Flow) => any) | undefined;
11
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
12
+ declare const _default: typeof __VLS_export;
13
+ export default _default;
@@ -0,0 +1,13 @@
1
+ import type { FlowNode } from '#v/types';
2
+ type __VLS_Props = {
3
+ model: FlowNode;
4
+ };
5
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
6
+ close: (args_0: boolean) => any;
7
+ save: (args_0: FlowNode) => any;
8
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
9
+ onClose?: ((args_0: boolean) => any) | undefined;
10
+ onSave?: ((args_0: FlowNode) => any) | undefined;
11
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
12
+ declare const _default: typeof __VLS_export;
13
+ export default _default;
@@ -0,0 +1,30 @@
1
+ <script setup>
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 { toRef } from "vue";
6
+ const props = defineProps({
7
+ model: { type: Object, required: true }
8
+ });
9
+ const emit = defineEmits(["close", "save"]);
10
+ const { newValues } = useFormValues(toRef(props.model), {
11
+ id: 0,
12
+ name: ""
13
+ });
14
+ </script>
15
+
16
+ <template>
17
+ <FormCreateModalTemplate
18
+ title="编辑节点"
19
+ :on-close="(ok) => emit('close', ok)"
20
+ :fields="[
21
+ { name: 'name', type: 'input', label: '\u8282\u70B9\u540D\u79F0', colSpan: '24', zodType: z.string().min(1, '\u8BF7\u8F93\u5165\u8282\u70B9\u540D\u79F0') }
22
+ ]"
23
+ :model-value="newValues"
24
+ @update-model-value="(newVal) => newValues = { ...props.model, ...newVal }"
25
+ @submit="async () => {
26
+ emit('save', newValues);
27
+ emit('close', true);
28
+ }"
29
+ />
30
+ </template>
@@ -0,0 +1,13 @@
1
+ import type { FlowNode } from '#v/types';
2
+ type __VLS_Props = {
3
+ model: FlowNode;
4
+ };
5
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
6
+ close: (args_0: boolean) => any;
7
+ save: (args_0: FlowNode) => any;
8
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
9
+ onClose?: ((args_0: boolean) => any) | undefined;
10
+ onSave?: ((args_0: FlowNode) => any) | undefined;
11
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
12
+ declare const _default: typeof __VLS_export;
13
+ export default _default;
@@ -0,0 +1,3 @@
1
+ declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
2
+ declare const _default: typeof __VLS_export;
3
+ export default _default;
@@ -0,0 +1,103 @@
1
+ <script setup>
2
+ import { h, ref } from "vue";
3
+ import { useOverlay } from "@nuxt/ui/composables";
4
+ import { getCreateAtColumn } from "#v/constants";
5
+ import { useFlowApi, useFlowNodeApi, useFlowEdgeApi } from "#v/composables";
6
+ import TablePage from "#v/components/table/Page.vue";
7
+ import FlowEditor from "#v/components/flow/FlowEditor.client.vue";
8
+ import CreateModal from "./CreateModal.vue";
9
+ import EditNodeModal from "./EditNodeModal.vue";
10
+ const overlay = useOverlay();
11
+ const createModal = overlay.create(CreateModal);
12
+ const editNodeModal = overlay.create(EditNodeModal);
13
+ const tablePageRef = ref(null);
14
+ const columns = [
15
+ {
16
+ accessorKey: "name",
17
+ header: "\u6D41\u7A0B\u540D\u79F0",
18
+ sortOption: true,
19
+ filterOption: {
20
+ type: "input",
21
+ initHide: false
22
+ }
23
+ },
24
+ {
25
+ accessorKey: "description",
26
+ header: "\u6D41\u7A0B\u63CF\u8FF0",
27
+ cell: ({ row }) => row.original.description || "\u2014"
28
+ },
29
+ {
30
+ accessorKey: "nodes",
31
+ header: "\u8282\u70B9\u6570",
32
+ cell: ({ row }) => `${row.original.nodes?.length ?? 0}\u4E2A`
33
+ },
34
+ {
35
+ accessorKey: "edges",
36
+ header: "\u8FDE\u63A5\u6570",
37
+ cell: ({ row }) => `${row.original.edges?.length ?? 0}\u4E2A`
38
+ },
39
+ getCreateAtColumn()
40
+ ];
41
+ const flowNodeApi = useFlowNodeApi();
42
+ const flowEdgeApi = useFlowEdgeApi();
43
+ const flowEditorApi = {
44
+ createNode: flowNodeApi.create,
45
+ updateNode: flowNodeApi.update,
46
+ deleteNode: flowNodeApi.deleteById,
47
+ createEdge: flowEdgeApi.create,
48
+ updateEdge: flowEdgeApi.update,
49
+ deleteEdge: flowEdgeApi.deleteById
50
+ };
51
+ function updateExpandedFlow(row, updatedFlow) {
52
+ tablePageRef.value?.updateRow(updatedFlow);
53
+ Object.assign(row, updatedFlow);
54
+ }
55
+ function updateNodeInFlow(row, updatedNode) {
56
+ const currentNodes = row.nodes ?? [];
57
+ const nodes = currentNodes.map((node) => node.id === updatedNode.id ? { ...node, ...updatedNode } : node);
58
+ const updatedFlow = { ...row, nodes };
59
+ updateExpandedFlow(row, updatedFlow);
60
+ }
61
+ async function handleEditNode(row, node) {
62
+ const updatedNode = await new Promise((resolve, reject) => {
63
+ editNodeModal.open({ model: node }).result.then((result) => {
64
+ if (!result || typeof result === "boolean") {
65
+ resolve(null);
66
+ return;
67
+ }
68
+ resolve(result);
69
+ }).catch(reject);
70
+ });
71
+ if (!updatedNode) return;
72
+ const { data } = await flowNodeApi.update(updatedNode);
73
+ if (data.value.data) {
74
+ updateNodeInFlow(row, data.value.data);
75
+ }
76
+ }
77
+ function getExpandVNode(row) {
78
+ return h("div", {
79
+ class: "w-full h-150 border border-default rounded bg-default"
80
+ }, [
81
+ h(FlowEditor, {
82
+ "modelValue": row,
83
+ "api": flowEditorApi,
84
+ "showStats": false,
85
+ "onUpdate:modelValue": (updatedModel) => updateExpandedFlow(row, updatedModel),
86
+ "onEditNode": (node) => handleEditNode(row, node)
87
+ })
88
+ ]);
89
+ }
90
+ </script>
91
+
92
+ <template>
93
+ <TablePage
94
+ ref="tablePageRef"
95
+ name="sys-flow"
96
+ cn-name="流程列表"
97
+ :use-api-group="useFlowApi"
98
+ :biz-columns="columns"
99
+ expandable
100
+ :expand-v-node="getExpandVNode"
101
+ @edit-row-from-modal="async (row) => Boolean(await createModal.open({ model: { ...row } }).result)"
102
+ />
103
+ </template>
@@ -0,0 +1,3 @@
1
+ declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
2
+ declare const _default: typeof __VLS_export;
3
+ export default _default;
@@ -1,145 +1,15 @@
1
1
  <script setup>
2
2
  import * as z from "zod";
3
- import { useOverlay } from "@nuxt/ui/composables";
4
3
  import FormCreateModalTemplate from "#v/components/form/create-modal-template/index.vue";
5
- import ProSimpleTable from "#v/components/simple-table/index.vue";
6
- import TableColumnModal from "./TableColumnModal.vue";
7
- import { useFormSubmission, useFormValues, useTableApi, useTableColumnApi } from "#v/composables";
8
- import { computed, ref, toRef, onMounted } from "vue";
4
+ import TableColumnList from "./TableColumnList.vue";
5
+ import { useFormSubmission, useFormValues, useTableApi } from "#v/composables";
6
+ import { computed, ref, toRef } from "vue";
9
7
  const props = defineProps({
10
8
  model: { type: Object, required: true }
11
9
  });
12
10
  const emit = defineEmits(["close", "save"]);
13
- const overlay = useOverlay();
14
- const columnModal = overlay.create(TableColumnModal);
15
11
  const { oldValues, newValues } = useFormValues(toRef(props.model), { id: 0 });
16
- const tableColumnApi = useTableColumnApi();
17
- const columns = ref([]);
18
- const deletedColumnIds = ref([]);
19
- const loading = ref(false);
20
- async function fetchColumns() {
21
- if (props.model.id === 0) return;
22
- loading.value = true;
23
- const { data } = await tableColumnApi.list({
24
- pagination: { pageNum: 0, pageSize: 0 },
25
- orderQuery: [{ field: "order", order: "asc" }],
26
- whereQuery: {
27
- items: [{ field: "tableId", value: props.model.id, opr: "eq" }]
28
- }
29
- });
30
- if (data.value.data) {
31
- columns.value = data.value.data.list.map((col) => ({
32
- id: col.id,
33
- columnKey: col.columnKey,
34
- label: col.label,
35
- order: col.order,
36
- width: col.width,
37
- fixed: col.fixed,
38
- visible: col.visible
39
- }));
40
- }
41
- loading.value = false;
42
- }
43
- onMounted(fetchColumns);
44
- function addColumn() {
45
- const maxOrder = columns.value.reduce((max, col) => Math.max(max, col.order ?? 0), 0);
46
- columns.value.push({
47
- id: 0,
48
- columnKey: "",
49
- label: "",
50
- order: maxOrder + 1,
51
- width: 100,
52
- fixed: "",
53
- visible: true,
54
- _isDirty: true
55
- });
56
- }
57
- function removeColumn(index) {
58
- const col = columns.value[index];
59
- if (col.id !== 0) {
60
- deletedColumnIds.value.push(col.id);
61
- }
62
- columns.value.splice(index, 1);
63
- }
64
- async function editColumn(index) {
65
- const col = columns.value[index];
66
- const isNew = col.id === 0;
67
- if (isNew) {
68
- return;
69
- }
70
- const result = await columnModal.open({ table: props.model, column: col }).result;
71
- if (result) {
72
- const updatedCol = result;
73
- columns.value[index] = { ...updatedCol, _isDirty: true };
74
- }
75
- }
76
- const tableColumns = [
77
- {
78
- accessorKey: "columnKey",
79
- header: "\u5217\u6807\u8BC6",
80
- size: 120
81
- },
82
- {
83
- accessorKey: "label",
84
- header: "\u663E\u793A\u540D",
85
- size: 120
86
- },
87
- {
88
- accessorKey: "order",
89
- header: "\u987A\u5E8F",
90
- size: 80
91
- },
92
- {
93
- accessorKey: "width",
94
- header: "\u5BBD\u5EA6",
95
- size: 80
96
- },
97
- {
98
- accessorKey: "fixed",
99
- header: "\u56FA\u5B9A",
100
- size: 80,
101
- cell: ({ row }) => {
102
- const fixedMap = { "": "\u5426", left: "\u5DE6", right: "\u53F3" };
103
- return fixedMap[row.fixed] ?? "\u5426";
104
- }
105
- },
106
- {
107
- accessorKey: "visible",
108
- header: "\u663E\u793A",
109
- size: 60,
110
- cell: ({ row }) => row.visible ? "\u662F" : "\u5426"
111
- },
112
- {
113
- accessorKey: "actions",
114
- header: "\u64CD\u4F5C",
115
- size: 100,
116
- cell: ({ row, index }) => {
117
- return {
118
- type: "div",
119
- class: "flex gap-1",
120
- children: [
121
- {
122
- type: "button",
123
- label: "\u7F16\u8F91",
124
- icon: "i-lucide-edit",
125
- variant: "ghost",
126
- size: "xs",
127
- onClick: () => editColumn(index)
128
- },
129
- {
130
- type: "button",
131
- label: "\u5220\u9664",
132
- icon: "i-lucide-trash-2",
133
- color: "error",
134
- variant: "ghost",
135
- size: "xs",
136
- onClick: () => removeColumn(index)
137
- }
138
- ]
139
- };
140
- }
141
- }
142
- ];
12
+ const columnListRef = ref();
143
13
  const { onSubmit } = useFormSubmission(
144
14
  toRef(oldValues),
145
15
  toRef(newValues),
@@ -149,38 +19,12 @@ const { onSubmit } = useFormSubmission(
149
19
  if (model.id === 0) {
150
20
  const { data } = await tableApi.create(model);
151
21
  const newTable = data.value?.data;
152
- if (newTable && columns.value.length > 0) {
153
- for (const col of columns.value) {
154
- await tableColumnApi.create({
155
- ...col,
156
- tableId: newTable.id
157
- });
158
- }
22
+ if (newTable && columnListRef.value?.columns.length) {
23
+ await columnListRef.value.createAllColumns(newTable.id);
159
24
  }
160
25
  emit("save", newTable);
161
26
  } else {
162
- for (const col of columns.value) {
163
- if (col._isDirty) {
164
- const colData = {
165
- id: col.id,
166
- tableId: props.model.id,
167
- columnKey: col.columnKey,
168
- label: col.label,
169
- order: col.order,
170
- width: col.width,
171
- fixed: col.fixed,
172
- visible: col.visible
173
- };
174
- if (col.id === 0) {
175
- await tableColumnApi.create(tableColumnApi.prune(colData));
176
- } else {
177
- await tableColumnApi.update(tableColumnApi.prune(colData));
178
- }
179
- }
180
- }
181
- for (const id of deletedColumnIds.value) {
182
- await tableColumnApi.deleteById(id);
183
- }
27
+ await columnListRef.value?.saveDirtyColumns(props.model.id);
184
28
  emit("save", model);
185
29
  }
186
30
  },
@@ -188,8 +32,7 @@ const { onSubmit } = useFormSubmission(
188
32
  );
189
33
  const fields = computed(() => [
190
34
  { name: "tblName", type: "input", label: "\u8868\u540D", colSpan: "12", zodType: z.string().min(1, "\u8868\u540D\u4E0D\u80FD\u4E3A\u7A7A") },
191
- { name: "label", type: "input", label: "\u663E\u793A\u540D", colSpan: "12", zodType: z.string().min(1, "\u663E\u793A\u540D\u4E0D\u80FD\u4E3A\u7A7A") },
192
- { name: "labelI18nKey", type: "input", label: "i18n Key", colSpan: "24", zodType: z.string().optional().nullable() }
35
+ { name: "label", type: "input", label: "\u663E\u793A\u540D", colSpan: "12", zodType: z.string().min(1, "\u663E\u793A\u540D\u4E0D\u80FD\u4E3A\u7A7A") }
193
36
  ]);
194
37
  function updateModelValue(newVal) {
195
38
  newValues.value = { id: 0, ...newVal };
@@ -206,34 +49,7 @@ function updateModelValue(newVal) {
206
49
  @submit="onSubmit"
207
50
  >
208
51
  <template #after-form>
209
- <div class="border-t pt-4 mt-4">
210
- <div class="flex items-center justify-between mb-2">
211
- <div>
212
- <div class="font-semibold">列配置</div>
213
- <div class="text-sm text-dimmed">配置 Table 的列信息</div>
214
- </div>
215
- <UButton
216
- label="添加列"
217
- icon="i-lucide-plus"
218
- variant="soft"
219
- size="sm"
220
- @click="addColumn"
221
- />
222
- </div>
223
-
224
- <div v-if="loading" class="py-8 text-center text-dimmed">
225
- 加载中...
226
- </div>
227
- <div v-else-if="columns.length === 0" class="py-8 text-center text-dimmed">
228
- 暂无列配置,点击"添加列"创建
229
- </div>
230
- <ProSimpleTable
231
- v-else
232
- :data="columns"
233
- :biz-columns="tableColumns"
234
- class="max-h-64 overflow-y-auto"
235
- />
236
- </div>
52
+ <TableColumnList ref="columnListRef" :initial-columns="model.columns" />
237
53
  </template>
238
54
  </FormCreateModalTemplate>
239
55
  </template>
@@ -47,20 +47,22 @@ async function fetchTableMeta(tables) {
47
47
  await Promise.all(
48
48
  tables.map(async (table) => {
49
49
  const [columnResult, permissionResult] = await Promise.all([
50
- tableColumnApi.count({
50
+ tableColumnApi.list({
51
+ pagination: { pageNum: 1, pageSize: 1 },
51
52
  whereQuery: {
52
53
  items: [{ field: "tableId", value: table.id, opr: "eq" }]
53
54
  }
54
55
  }),
55
- tablePermissionApi.count({
56
+ tablePermissionApi.list({
57
+ pagination: { pageNum: 1, pageSize: 1 },
56
58
  whereQuery: {
57
59
  items: [{ field: "tableId", value: table.id, opr: "eq" }]
58
60
  }
59
61
  })
60
62
  ]);
61
63
  newMeta[table.id] = {
62
- columnCount: columnResult.data.value?.data ?? 0,
63
- permissionCount: permissionResult.data.value?.data ?? 0
64
+ columnCount: columnResult.data.value?.data?.total ?? 0,
65
+ permissionCount: permissionResult.data.value?.data?.total ?? 0
64
66
  };
65
67
  })
66
68
  );
@@ -77,16 +79,6 @@ function getExpandVNode(row) {
77
79
  h("div", {}, `\u66F4\u65B0\u65F6\u95F4: ${row.updatedAt ? new Date(row.updatedAt).toLocaleString() : "-"}`)
78
80
  ]);
79
81
  }
80
- const extraRowActions = [
81
- {
82
- label: "\u7F16\u8F91",
83
- icon: "i-lucide-edit",
84
- fnWithModal: async (row) => {
85
- const result = await createModal.open({ model: { ...row } }).result;
86
- return result;
87
- }
88
- }
89
- ];
90
82
  watch(
91
83
  () => tablePageRef.value?.data,
92
84
  async (newData) => {
@@ -107,7 +99,6 @@ watch(
107
99
  :biz-columns="columns"
108
100
  :expandable="true"
109
101
  :expand-v-node="getExpandVNode"
110
- :extra-row-actions="extraRowActions"
111
102
  @edit-row-from-modal="async (row) => {
112
103
  const result = await createModal.open({ model: { ...row } }).result;
113
104
  return result === true;