v-nuxt-ui 0.1.10 → 0.1.11
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/date-picker/index.d.vue.ts +2 -1
- package/dist/runtime/components/date-picker/index.vue +1 -1
- package/dist/runtime/components/date-picker/index.vue.d.ts +2 -1
- package/dist/runtime/components/form/create-modal-template/WithApi.d.vue.ts +2 -2
- package/dist/runtime/components/form/create-modal-template/WithApi.vue.d.ts +2 -2
- package/dist/runtime/components/form/create-modal-template/index.d.vue.ts +2 -2
- package/dist/runtime/components/form/create-modal-template/index.vue.d.ts +2 -2
- package/dist/runtime/components/simple-table/index.d.vue.ts +1 -1
- package/dist/runtime/components/simple-table/index.vue.d.ts +1 -1
- package/dist/runtime/composables/api/index.d.ts +0 -1
- package/dist/runtime/composables/api/index.js +0 -1
- package/dist/runtime/composables/api/sys/useAuthApi.d.ts +4 -4
- package/dist/runtime/composables/api/sys/useCompanyApi.d.ts +2 -1
- package/dist/runtime/composables/api/sys/useDepartmentApi.d.ts +2 -2
- package/dist/runtime/composables/api/sys/useJobTitleApi.d.ts +2 -1
- package/dist/runtime/composables/api/sys/useLoginApi.d.ts +4 -4
- package/dist/runtime/composables/api/sys/useMenuApi.d.ts +2 -2
- package/dist/runtime/composables/api/sys/useRoleApi.d.ts +2 -2
- package/dist/runtime/composables/api/sys/useRowRecord.d.ts +4 -4
- package/dist/runtime/composables/api/sys/useUserApi.d.ts +3 -3
- package/dist/runtime/composables/api/useModel.d.ts +2 -1
- package/dist/runtime/composables/index.js +1 -1
- package/dist/runtime/composables/useAuth.d.ts +112 -5
- package/dist/runtime/composables/useAuth.js +1 -1
- package/dist/runtime/composables/useDate.d.ts +2 -1
- package/dist/runtime/composables/useForm.d.ts +2 -2
- package/dist/runtime/composables/useForm.js +1 -1
- package/dist/runtime/composables/usePermission.d.ts +3 -2
- package/dist/runtime/composables/useSidebarMenu.d.ts +37 -19
- package/dist/runtime/constants/columns.d.ts +3 -3
- package/dist/runtime/constants/time.d.ts +1 -0
- package/dist/runtime/plugins/05.api.d.ts +6 -0
- package/dist/runtime/plugins/05.api.js +157 -0
- package/dist/runtime/types/cmds/index.d.ts +3 -0
- package/dist/runtime/types/cmds/index.js +3 -0
- package/dist/runtime/types/cmds/login.d.ts +19 -23
- package/dist/runtime/types/cmds/login.js +0 -0
- package/dist/runtime/types/cmds/sys.d.ts +7 -10
- package/dist/runtime/types/cmds/sys.js +0 -0
- package/dist/runtime/types/cmds/user.d.ts +4 -8
- package/dist/runtime/types/cmds/user.js +0 -0
- package/dist/runtime/types/index.d.ts +2 -0
- package/dist/runtime/types/index.js +2 -0
- package/dist/runtime/types/models/base.d.ts +12 -15
- package/dist/runtime/types/models/base.js +0 -0
- package/dist/runtime/types/models/index.d.ts +2 -0
- package/dist/runtime/types/models/index.js +2 -0
- package/dist/runtime/types/models/sys.d.ts +84 -107
- package/dist/runtime/types/models/sys.js +0 -0
- package/dist/runtime/types/storage.d.ts +13 -0
- package/package.json +1 -1
- package/dist/runtime/composables/api/flow/index.d.ts +0 -3
- package/dist/runtime/composables/api/flow/index.js +0 -3
- package/dist/runtime/composables/api/flow/useFlowApi.d.ts +0 -1
- package/dist/runtime/composables/api/flow/useFlowApi.js +0 -3
- package/dist/runtime/composables/api/flow/useFlowNodeApi.d.ts +0 -1
- package/dist/runtime/composables/api/flow/useFlowNodeApi.js +0 -3
- package/dist/runtime/composables/api/flow/useFlowNodeLinkApi.d.ts +0 -1
- package/dist/runtime/composables/api/flow/useFlowNodeLinkApi.js +0 -3
- package/dist/runtime/composables/flow/index.d.ts +0 -3
- package/dist/runtime/composables/flow/index.js +0 -3
- package/dist/runtime/composables/flow/useFlow.d.ts +0 -46
- package/dist/runtime/composables/flow/useFlow.js +0 -162
- package/dist/runtime/composables/flow/useFlowResize.d.ts +0 -56
- package/dist/runtime/composables/flow/useFlowResize.js +0 -148
- package/dist/runtime/types/constants/time.d.ts +0 -5
- package/dist/runtime/types/localStorage.d.ts +0 -15
- package/dist/runtime/types/models/flow.d.ts +0 -31
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { useAuth } from "#v/composables";
|
|
2
|
+
import { StorageKey, ErrorCode, noErrorMsgCodes, ShowType } from "#v/types";
|
|
3
|
+
import { useToast } from "@nuxt/ui/runtime/composables/useToast.js";
|
|
4
|
+
import { useLocalStorage } from "@vueuse/core";
|
|
5
|
+
import { defineNuxtPlugin, useFetch } from "nuxt/app";
|
|
6
|
+
import { useRoute } from "vue-router";
|
|
7
|
+
function handleRequestResult(data, error) {
|
|
8
|
+
if (error) {
|
|
9
|
+
const fail = {
|
|
10
|
+
error,
|
|
11
|
+
data: null
|
|
12
|
+
};
|
|
13
|
+
return fail;
|
|
14
|
+
}
|
|
15
|
+
const success = {
|
|
16
|
+
error: null,
|
|
17
|
+
data
|
|
18
|
+
};
|
|
19
|
+
return success;
|
|
20
|
+
}
|
|
21
|
+
export default defineNuxtPlugin(() => {
|
|
22
|
+
const toast = useToast();
|
|
23
|
+
const route = useRoute();
|
|
24
|
+
const api = $fetch.create({
|
|
25
|
+
baseURL: "/api/v1",
|
|
26
|
+
onRequest({ options }) {
|
|
27
|
+
const token = useLocalStorage(StorageKey.ACCESS_TOKEN, "");
|
|
28
|
+
const Authorization = token.value ? `Bearer ${token.value}` : "";
|
|
29
|
+
options.headers.set("Authorization", Authorization);
|
|
30
|
+
},
|
|
31
|
+
onRequestError: async ({ error }) => {
|
|
32
|
+
toast.add({
|
|
33
|
+
title: "\u8BF7\u6C42\u9519\u8BEF",
|
|
34
|
+
description: error.message,
|
|
35
|
+
color: "error"
|
|
36
|
+
});
|
|
37
|
+
},
|
|
38
|
+
onResponse: async ({ response, options }) => {
|
|
39
|
+
const { status } = response;
|
|
40
|
+
if (status === 200 || status < 300 || status === 304) {
|
|
41
|
+
if (options.responseType === "blob") {
|
|
42
|
+
response._data = response.blob();
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
if (response._data.code === ErrorCode.FIELD_VALIDATION_ERROR_CODE) {
|
|
46
|
+
const errors = response._data.data;
|
|
47
|
+
toast.add({
|
|
48
|
+
title: "\u5B57\u6BB5\u6821\u9A8C\u9519\u8BEF",
|
|
49
|
+
description: errors.map((err) => err.errorMsg).join("\n"),
|
|
50
|
+
color: "error"
|
|
51
|
+
});
|
|
52
|
+
} else if (noErrorMsgCodes.includes(response._data.code)) {
|
|
53
|
+
console.error(response._data.message);
|
|
54
|
+
} else {
|
|
55
|
+
switch (response._data.showType) {
|
|
56
|
+
case ShowType.Silent:
|
|
57
|
+
break;
|
|
58
|
+
case ShowType.SuccessMessage:
|
|
59
|
+
toast.add({
|
|
60
|
+
title: "\u6210\u529F",
|
|
61
|
+
description: response._data.message,
|
|
62
|
+
color: "success"
|
|
63
|
+
});
|
|
64
|
+
break;
|
|
65
|
+
case ShowType.InfoMessage:
|
|
66
|
+
toast.add({
|
|
67
|
+
title: "\u4FE1\u606F",
|
|
68
|
+
description: response._data.message,
|
|
69
|
+
color: "info"
|
|
70
|
+
});
|
|
71
|
+
break;
|
|
72
|
+
case ShowType.WarnMessage:
|
|
73
|
+
toast.add({
|
|
74
|
+
title: "\u8B66\u544A",
|
|
75
|
+
description: response._data.message,
|
|
76
|
+
color: "warning"
|
|
77
|
+
});
|
|
78
|
+
break;
|
|
79
|
+
case ShowType.ErrorMessage:
|
|
80
|
+
toast.add({
|
|
81
|
+
title: "\u9519\u8BEF",
|
|
82
|
+
description: response._data.message,
|
|
83
|
+
color: "error"
|
|
84
|
+
});
|
|
85
|
+
break;
|
|
86
|
+
case ShowType.SuccessNotification:
|
|
87
|
+
toast.add({
|
|
88
|
+
title: "\u6210\u529F",
|
|
89
|
+
description: response._data.message,
|
|
90
|
+
color: "success"
|
|
91
|
+
});
|
|
92
|
+
break;
|
|
93
|
+
case ShowType.InfoNotification:
|
|
94
|
+
toast.add({
|
|
95
|
+
title: "\u4FE1\u606F",
|
|
96
|
+
description: response._data.message,
|
|
97
|
+
color: "info"
|
|
98
|
+
});
|
|
99
|
+
break;
|
|
100
|
+
case ShowType.WarnNotification:
|
|
101
|
+
toast.add({
|
|
102
|
+
title: "\u8B66\u544A",
|
|
103
|
+
description: response._data.message,
|
|
104
|
+
color: "warning"
|
|
105
|
+
});
|
|
106
|
+
break;
|
|
107
|
+
case ShowType.ErrorNotification:
|
|
108
|
+
toast.add({
|
|
109
|
+
title: "\u9519\u8BEF",
|
|
110
|
+
description: response._data.message,
|
|
111
|
+
color: "error"
|
|
112
|
+
});
|
|
113
|
+
break;
|
|
114
|
+
default:
|
|
115
|
+
toast.add({
|
|
116
|
+
title: "\u63D0\u793A",
|
|
117
|
+
description: response._data.message,
|
|
118
|
+
color: "info"
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
if (response._data.success) {
|
|
123
|
+
response._data = handleRequestResult(response._data.data, null);
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
if (response._data.code === ErrorCode.ACCESS_TOKEN_ERROR_CODE) {
|
|
127
|
+
const newOptions = await useAuth().refreshToken(route, options);
|
|
128
|
+
if (newOptions) {
|
|
129
|
+
const { data: refetchedData } = await useFetch(response.url, newOptions);
|
|
130
|
+
response._data = refetchedData.value;
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
response._data = handleRequestResult(null, new Error(response._data.message));
|
|
135
|
+
} else if (status === 500) {
|
|
136
|
+
toast.add({
|
|
137
|
+
title: "\u9519\u8BEF",
|
|
138
|
+
description: "\u670D\u52A1\u5668\u4E0D\u53EF\u7528\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5",
|
|
139
|
+
color: "error"
|
|
140
|
+
});
|
|
141
|
+
response._data = handleRequestResult(null, new Error(response.statusText));
|
|
142
|
+
} else {
|
|
143
|
+
toast.add({
|
|
144
|
+
title: "\u9519\u8BEF",
|
|
145
|
+
description: response.statusText,
|
|
146
|
+
color: "error"
|
|
147
|
+
});
|
|
148
|
+
response._data = handleRequestResult(null, new Error(response.statusText));
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
return {
|
|
153
|
+
provide: {
|
|
154
|
+
api
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
});
|
|
@@ -1,23 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
username?: string
|
|
4
|
-
password?: string
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
dupLogin?: boolean
|
|
21
|
-
user?: Model.User
|
|
22
|
-
}
|
|
23
|
-
}
|
|
1
|
+
import type { User } from '../models/index.js';
|
|
2
|
+
export type UsernamePasswordLoginPayload = {
|
|
3
|
+
username?: string;
|
|
4
|
+
password?: string;
|
|
5
|
+
};
|
|
6
|
+
export type RefreshTokensPayload = {
|
|
7
|
+
refreshToken: string;
|
|
8
|
+
};
|
|
9
|
+
export type ChangeUserPwdCmd = {
|
|
10
|
+
userId: number;
|
|
11
|
+
oldPwd: string;
|
|
12
|
+
newPwd: string;
|
|
13
|
+
};
|
|
14
|
+
export type LoginResult = {
|
|
15
|
+
refreshToken?: string;
|
|
16
|
+
accessToken?: string;
|
|
17
|
+
dupLogin?: boolean;
|
|
18
|
+
user?: User;
|
|
19
|
+
};
|
|
File without changes
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
id: number
|
|
9
|
-
}
|
|
10
|
-
}
|
|
1
|
+
export type RowRecordPayload = {
|
|
2
|
+
tableName?: string;
|
|
3
|
+
rowId?: number;
|
|
4
|
+
};
|
|
5
|
+
export type IdPayload = {
|
|
6
|
+
id: number;
|
|
7
|
+
};
|
|
File without changes
|
|
File without changes
|
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
updater?: any
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
type UniqueKey = {
|
|
14
|
-
key?: string
|
|
15
|
-
}
|
|
1
|
+
export interface BaseModel {
|
|
2
|
+
id: number;
|
|
3
|
+
createdAt?: string;
|
|
4
|
+
updatedAt?: string;
|
|
5
|
+
version?: number;
|
|
6
|
+
createdBy?: number;
|
|
7
|
+
creator?: any;
|
|
8
|
+
updatedBy?: number;
|
|
9
|
+
updater?: any;
|
|
16
10
|
}
|
|
11
|
+
export type UniqueKey = {
|
|
12
|
+
key?: string;
|
|
13
|
+
};
|
|
File without changes
|
|
@@ -1,107 +1,84 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
isAdmin?: boolean
|
|
4
|
-
type?: string
|
|
5
|
-
parentId?: number
|
|
6
|
-
parent?: Menu
|
|
7
|
-
name?: string
|
|
8
|
-
i18nKey?: string
|
|
9
|
-
staticRouteKeys?: string[]
|
|
10
|
-
permission?: string
|
|
11
|
-
order?: string
|
|
12
|
-
disabled?: boolean
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
roles?: Role[] // 角色
|
|
87
|
-
menus?: Menu[] // 菜单权限
|
|
88
|
-
|
|
89
|
-
needChangePwd?: boolean // 是否需要修改密码
|
|
90
|
-
|
|
91
|
-
needFillWh?: boolean // 是否需要填写工时
|
|
92
|
-
|
|
93
|
-
isAdmin?: boolean
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
type RowRecord = {
|
|
97
|
-
rowId?: number
|
|
98
|
-
rowVersion?: number
|
|
99
|
-
key?: string
|
|
100
|
-
oldValue?: string
|
|
101
|
-
newValue?: string
|
|
102
|
-
} & BaseModel
|
|
103
|
-
|
|
104
|
-
type UniqueKey = {
|
|
105
|
-
key?: string
|
|
106
|
-
}
|
|
107
|
-
}
|
|
1
|
+
import type { BaseModel } from './base.js';
|
|
2
|
+
export type Menu = {
|
|
3
|
+
isAdmin?: boolean;
|
|
4
|
+
type?: string;
|
|
5
|
+
parentId?: number;
|
|
6
|
+
parent?: Menu;
|
|
7
|
+
name?: string;
|
|
8
|
+
i18nKey?: string;
|
|
9
|
+
staticRouteKeys?: string[];
|
|
10
|
+
permission?: string;
|
|
11
|
+
order?: string;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
} & BaseModel;
|
|
14
|
+
export type Role = {
|
|
15
|
+
isAdmin?: boolean;
|
|
16
|
+
name?: string;
|
|
17
|
+
permission?: string;
|
|
18
|
+
disabled?: boolean;
|
|
19
|
+
remark?: string;
|
|
20
|
+
menus?: Menu[];
|
|
21
|
+
} & BaseModel;
|
|
22
|
+
export type Company = {
|
|
23
|
+
fullname?: string;
|
|
24
|
+
nickname?: string;
|
|
25
|
+
} & BaseModel;
|
|
26
|
+
export type Department = {
|
|
27
|
+
name?: string;
|
|
28
|
+
companyId?: number;
|
|
29
|
+
company?: Company;
|
|
30
|
+
leaderId?: number;
|
|
31
|
+
leader?: User;
|
|
32
|
+
parentId?: number;
|
|
33
|
+
parent?: Department;
|
|
34
|
+
} & BaseModel;
|
|
35
|
+
export type JobTitle = {
|
|
36
|
+
name?: string;
|
|
37
|
+
description?: string;
|
|
38
|
+
disabled?: boolean;
|
|
39
|
+
remark?: string;
|
|
40
|
+
} & BaseModel;
|
|
41
|
+
export type JobGrade = {
|
|
42
|
+
name?: string;
|
|
43
|
+
description?: string;
|
|
44
|
+
disabled?: boolean;
|
|
45
|
+
remark?: string;
|
|
46
|
+
} & BaseModel;
|
|
47
|
+
export type User = {
|
|
48
|
+
id: number;
|
|
49
|
+
createdAt?: string;
|
|
50
|
+
updatedAt?: string;
|
|
51
|
+
version?: number;
|
|
52
|
+
userCreatedBy?: number;
|
|
53
|
+
creator?: User;
|
|
54
|
+
userUpdatedBy?: number;
|
|
55
|
+
updater?: User;
|
|
56
|
+
nickname?: string;
|
|
57
|
+
jobTitleId?: number;
|
|
58
|
+
jobTitle?: JobTitle;
|
|
59
|
+
jobGradeId?: number;
|
|
60
|
+
jobGrade?: JobGrade;
|
|
61
|
+
departmentId?: number;
|
|
62
|
+
department?: Department;
|
|
63
|
+
supervisorId?: number;
|
|
64
|
+
supervisor?: User;
|
|
65
|
+
entryDate?: string;
|
|
66
|
+
resignDate?: string;
|
|
67
|
+
gender?: number;
|
|
68
|
+
username?: string;
|
|
69
|
+
email?: string;
|
|
70
|
+
telNo?: string;
|
|
71
|
+
loginType?: string;
|
|
72
|
+
roles?: Role[];
|
|
73
|
+
menus?: Menu[];
|
|
74
|
+
needChangePwd?: boolean;
|
|
75
|
+
needFillWh?: boolean;
|
|
76
|
+
isAdmin?: boolean;
|
|
77
|
+
};
|
|
78
|
+
export type RowRecord = {
|
|
79
|
+
rowId?: number;
|
|
80
|
+
rowVersion?: number;
|
|
81
|
+
key?: string;
|
|
82
|
+
oldValue?: string;
|
|
83
|
+
newValue?: string;
|
|
84
|
+
} & BaseModel;
|
|
File without changes
|
|
@@ -8,3 +8,16 @@ export declare enum StorageKey {
|
|
|
8
8
|
FLOW_EDGE_MARKER_END = "flow_edge_marker_end",
|
|
9
9
|
FLOW_NODE_BORDER_WIDTH = "flow_node_border_width"
|
|
10
10
|
}
|
|
11
|
+
export type Column = {
|
|
12
|
+
accessorKey: string;
|
|
13
|
+
checked?: boolean;
|
|
14
|
+
width?: string | number;
|
|
15
|
+
fixed: 'left' | 'right' | 'unfixed';
|
|
16
|
+
};
|
|
17
|
+
export type TableSettings<T> = {
|
|
18
|
+
columns?: Column[];
|
|
19
|
+
pageSize?: number;
|
|
20
|
+
whereQuery?: import('./query').WhereQuery<T>;
|
|
21
|
+
whereQueryOpen?: boolean;
|
|
22
|
+
orderQuery?: import('./query').OrderQuery<T>;
|
|
23
|
+
};
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const useFlowApi: () => import("../../../types/index.js").ApiGroup<Model.Flow>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const useFlowNodeApi: () => import("../../../types/index.js").ApiGroup<Model.FlowNode>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const useFlowNodeLinkApi: () => import("../../../types/index.js").ApiGroup<Model.FlowNodeLink>;
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { type Node } from '@vue-flow/core';
|
|
2
|
-
import type { Ref } from 'vue';
|
|
3
|
-
export interface UseFlowOptions {
|
|
4
|
-
flow?: Ref<Model.Flow | undefined>;
|
|
5
|
-
onUpdateModel?: Ref<((model: Model.Flow) => void) | undefined>;
|
|
6
|
-
}
|
|
7
|
-
export interface UseFlowReturn {
|
|
8
|
-
nodes: Ref<any[]>;
|
|
9
|
-
edges: Ref<any[]>;
|
|
10
|
-
GRID_SIZE: number;
|
|
11
|
-
syncNodes: (nodeHandlers?: (nodeId: string) => any) => void;
|
|
12
|
-
syncEdges: (styleOptions?: {
|
|
13
|
-
strokeWidth?: number;
|
|
14
|
-
markerStart?: boolean;
|
|
15
|
-
markerEnd?: boolean;
|
|
16
|
-
}) => void;
|
|
17
|
-
applyEdgeStyles: (styleOptions: {
|
|
18
|
-
strokeWidth: number;
|
|
19
|
-
markerStart: boolean;
|
|
20
|
-
markerEnd: boolean;
|
|
21
|
-
}) => void;
|
|
22
|
-
transformNode: (node: Model.FlowNode, handlers?: any) => Node;
|
|
23
|
-
refreshFlow: () => Promise<void>;
|
|
24
|
-
updateNode: (updatedNode: Model.FlowNode) => Promise<void>;
|
|
25
|
-
updateNodePosition: (nodeId: string, x: number, y: number) => Promise<void>;
|
|
26
|
-
updateNodeDimensions: (nodeId: string, dimensions: {
|
|
27
|
-
width: number;
|
|
28
|
-
height: number;
|
|
29
|
-
positionX: number;
|
|
30
|
-
positionY: number;
|
|
31
|
-
}) => Promise<void>;
|
|
32
|
-
createNode: () => Promise<void>;
|
|
33
|
-
deleteNode: (nodeId: string) => Promise<void>;
|
|
34
|
-
deleteEdge: (edgeId: string) => Promise<void>;
|
|
35
|
-
createEdge: (params: {
|
|
36
|
-
source: string;
|
|
37
|
-
target: string;
|
|
38
|
-
sourceHandle?: string | null;
|
|
39
|
-
targetHandle?: string | null;
|
|
40
|
-
}) => Promise<void>;
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Flow 业务逻辑 Composable
|
|
44
|
-
* 处理节点和边的 CRUD 操作、数据转换等
|
|
45
|
-
*/
|
|
46
|
-
export declare function useFlow(options: UseFlowOptions): UseFlowReturn;
|