nkk-flow 0.1.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/LICENSE +21 -0
- package/README.md +180 -0
- package/dist/index.cjs +226 -0
- package/dist/index.js +5682 -0
- package/dist/style.css +2 -0
- package/dist/types/components/ui/cascader/Cascader.vue.d.ts +44 -0
- package/dist/types/components/ui/cascader/index.d.ts +2 -0
- package/dist/types/components/ui/cascader/types.d.ts +27 -0
- package/dist/types/components/ui/checkbox/Checkbox.vue.d.ts +24 -0
- package/dist/types/components/ui/checkbox/index.d.ts +1 -0
- package/dist/types/components/ui/date/DatePanel.vue.d.ts +11 -0
- package/dist/types/components/ui/date/DatePicker.vue.d.ts +21 -0
- package/dist/types/components/ui/date/index.d.ts +2 -0
- package/dist/types/components/ui/date/useFloatingPanel.d.ts +18 -0
- package/dist/types/components/ui/date-time/DateTimePicker.vue.d.ts +18 -0
- package/dist/types/components/ui/date-time/index.d.ts +1 -0
- package/dist/types/components/ui/drawer/Drawer.vue.d.ts +40 -0
- package/dist/types/components/ui/drawer/index.d.ts +1 -0
- package/dist/types/components/ui/empty/Empty.vue.d.ts +11 -0
- package/dist/types/components/ui/empty/index.d.ts +1 -0
- package/dist/types/components/ui/input/Input.vue.d.ts +20 -0
- package/dist/types/components/ui/input/index.d.ts +1 -0
- package/dist/types/components/ui/input-number/InputNumber.vue.d.ts +23 -0
- package/dist/types/components/ui/input-number/index.d.ts +1 -0
- package/dist/types/components/ui/loading/Loading.vue.d.ts +9 -0
- package/dist/types/components/ui/loading/LoadingMask.vue.d.ts +15 -0
- package/dist/types/components/ui/loading/index.d.ts +14 -0
- package/dist/types/components/ui/loading/service.d.ts +20 -0
- package/dist/types/components/ui/radio/Radio.vue.d.ts +26 -0
- package/dist/types/components/ui/radio/index.d.ts +1 -0
- package/dist/types/components/ui/scrollbar/Scrollbar.vue.d.ts +24 -0
- package/dist/types/components/ui/scrollbar/index.d.ts +1 -0
- package/dist/types/components/ui/segmented/Segmented.vue.d.ts +20 -0
- package/dist/types/components/ui/segmented/index.d.ts +2 -0
- package/dist/types/components/ui/segmented/types.d.ts +12 -0
- package/dist/types/components/ui/select/Select.vue.d.ts +34 -0
- package/dist/types/components/ui/select/index.d.ts +2 -0
- package/dist/types/components/ui/select-field/SelectField.vue.d.ts +33 -0
- package/dist/types/components/ui/select-field/index.d.ts +3 -0
- package/dist/types/components/ui/switch/Switch.vue.d.ts +15 -0
- package/dist/types/components/ui/switch/index.d.ts +1 -0
- package/dist/types/components/ui/tree-node/TreeNode.vue.d.ts +55 -0
- package/dist/types/components/ui/tree-node/TreeNodeRow.vue.d.ts +22 -0
- package/dist/types/components/ui/tree-node/context.d.ts +23 -0
- package/dist/types/components/ui/tree-node/index.d.ts +3 -0
- package/dist/types/components/ui/tree-node/types.d.ts +15 -0
- package/dist/types/components/ui/tree-node/utils.d.ts +41 -0
- package/dist/types/hooks/logicflow/adapter.d.ts +17 -0
- package/dist/types/hooks/logicflow/components/add-node-dialog/index.vue.d.ts +18 -0
- package/dist/types/hooks/logicflow/components/index.d.ts +3 -0
- package/dist/types/hooks/logicflow/components/node-config/ApprovalNodeConfig.vue.d.ts +4 -0
- package/dist/types/hooks/logicflow/components/node-config/CcNodeConfig.vue.d.ts +4 -0
- package/dist/types/hooks/logicflow/components/node-config/ConditionNodeConfig.vue.d.ts +4 -0
- package/dist/types/hooks/logicflow/components/node-config/StartNodeConfig.vue.d.ts +4 -0
- package/dist/types/hooks/logicflow/components/node-config/TimerNodeConfig.vue.d.ts +4 -0
- package/dist/types/hooks/logicflow/components/node-config/index.d.ts +19 -0
- package/dist/types/hooks/logicflow/components/node-config/index.vue.d.ts +43 -0
- package/dist/types/hooks/logicflow/components/node-config/types.d.ts +28 -0
- package/dist/types/hooks/logicflow/components/primitives/pickers/NodeConfigAssigneePicker.vue.d.ts +56 -0
- package/dist/types/hooks/logicflow/components/primitives/pickers/NodeConfigAssigneeTags.vue.d.ts +12 -0
- package/dist/types/hooks/logicflow/components/primitives/pickers/NodeConfigInitiatorPicker.vue.d.ts +30 -0
- package/dist/types/hooks/logicflow/components/primitives/ui/NodeConfigAddButton.vue.d.ts +12 -0
- package/dist/types/hooks/logicflow/components/primitives/ui/NodeConfigRadioCard.vue.d.ts +14 -0
- package/dist/types/hooks/logicflow/components/primitives/ui/NodeConfigSectionTitle.vue.d.ts +9 -0
- package/dist/types/hooks/logicflow/defaults.d.ts +9 -0
- package/dist/types/hooks/logicflow/edges/index.d.ts +1 -0
- package/dist/types/hooks/logicflow/edges/process/FlowProcessEdge.d.ts +34 -0
- package/dist/types/hooks/logicflow/edges/process/index.d.ts +1 -0
- package/dist/types/hooks/logicflow/index.d.ts +31 -0
- package/dist/types/hooks/logicflow/nodes/process/FlowProcessNode.d.ts +93 -0
- package/dist/types/hooks/logicflow/nodes/process/index.d.ts +1 -0
- package/dist/types/hooks/logicflow/register.d.ts +2 -0
- package/dist/types/hooks/logicflow/types/form.d.ts +26 -0
- package/dist/types/hooks/logicflow/types/index.d.ts +3 -0
- package/dist/types/hooks/logicflow/types/logicflow.d.ts +209 -0
- package/dist/types/hooks/logicflow/types/process/base.d.ts +52 -0
- package/dist/types/hooks/logicflow/types/process/endpoint.d.ts +19 -0
- package/dist/types/hooks/logicflow/types/process/router.d.ts +48 -0
- package/dist/types/hooks/logicflow/types/process/task.d.ts +86 -0
- package/dist/types/hooks/logicflow/types/process.d.ts +24 -0
- package/dist/types/index.d.ts +1 -0
- package/package.json +77 -0
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import type LogicFlow from '@logicflow/core';
|
|
2
|
+
import type { MiniMap } from '@logicflow/extension';
|
|
3
|
+
import type { FlowProcessApproveNode, FlowProcessAssignee, FlowProcessConditionBranchNode, FlowProcessNode, FlowProcessNodeType, FlowProcessTaskNodeFields, FlowProcessTimerNode } from './process';
|
|
4
|
+
export type FlowGraphData = LogicFlow.GraphConfigData;
|
|
5
|
+
export interface FlowProcessEdgeProperties {
|
|
6
|
+
__editable?: boolean;
|
|
7
|
+
showPlus?: boolean;
|
|
8
|
+
routeMode?: 'vertical-first' | 'horizontal-first';
|
|
9
|
+
fixedBendY?: number;
|
|
10
|
+
}
|
|
11
|
+
export type FlowNodeKind = 'start' | 'approval' | 'cc' | 'condition' | 'router' | 'call' | 'timer' | 'trigger' | 'route' | 'autoPass' | 'autoReject' | 'end';
|
|
12
|
+
export interface FlowNodeSize {
|
|
13
|
+
width: number;
|
|
14
|
+
height: number;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* 节点配置字段集合,从 process 数据模型类型中 Pick,
|
|
18
|
+
* 保证 UI 层(DisplayMeta/ActionPayload)与提交结构的字段名和类型完全一致。
|
|
19
|
+
*/
|
|
20
|
+
type FlowNodeConfigFields = Pick<FlowProcessTaskNodeFields, 'setType' | 'examineMode' | 'rejectStrategy' | 'termMode' | 'nodeAssigneeList'> & Pick<FlowProcessApproveNode, 'approveSelf' | 'examineLevel' | 'allowTransfer' | 'allowAppendNode' | 'allowRollback' | 'allowCc'> & Pick<FlowProcessTimerNode, 'delayTime' | 'delayUnit'> & Pick<FlowProcessConditionBranchNode, 'conditionList'>;
|
|
21
|
+
export interface FlowNodeDisplayMeta extends FlowNodeConfigFields {
|
|
22
|
+
kind: FlowNodeKind;
|
|
23
|
+
nodeType?: FlowProcessNodeType;
|
|
24
|
+
title: string;
|
|
25
|
+
content?: string;
|
|
26
|
+
subtitle?: string;
|
|
27
|
+
badge?: string;
|
|
28
|
+
gatewayRole?: 'split' | 'merge';
|
|
29
|
+
routerType?: 'condition' | 'parallel' | 'inclusive';
|
|
30
|
+
branchRole?: 'normal' | 'default';
|
|
31
|
+
priority?: number;
|
|
32
|
+
description?: string;
|
|
33
|
+
assignees?: string[];
|
|
34
|
+
conditions?: string[];
|
|
35
|
+
directorLevel?: number;
|
|
36
|
+
directorMode?: number;
|
|
37
|
+
selectMode?: number | string;
|
|
38
|
+
typeOfApprove?: number;
|
|
39
|
+
}
|
|
40
|
+
export interface FlowDesignerStats {
|
|
41
|
+
nodeCount: number;
|
|
42
|
+
branchCount: number;
|
|
43
|
+
assigneeCount: number;
|
|
44
|
+
}
|
|
45
|
+
export interface FlowFlowNodeActionPayload extends FlowNodeConfigFields {
|
|
46
|
+
nodeId: string;
|
|
47
|
+
nodeKey: string;
|
|
48
|
+
nodeType: FlowProcessNodeType;
|
|
49
|
+
kind: FlowNodeKind;
|
|
50
|
+
title: string;
|
|
51
|
+
content?: string;
|
|
52
|
+
description?: string;
|
|
53
|
+
assignees?: string[];
|
|
54
|
+
directorLevel?: number;
|
|
55
|
+
directorMode?: number;
|
|
56
|
+
selectMode?: number | string;
|
|
57
|
+
typeOfApprove?: number;
|
|
58
|
+
routerType?: 'condition' | 'parallel' | 'inclusive';
|
|
59
|
+
branchRole?: 'normal' | 'default';
|
|
60
|
+
/** 是否启用超时提醒 */
|
|
61
|
+
timeoutEnabled?: boolean;
|
|
62
|
+
/** 超时时间(小时) */
|
|
63
|
+
timeoutHours?: number;
|
|
64
|
+
/** 催办间隔时间(小时) */
|
|
65
|
+
remindHours?: number;
|
|
66
|
+
/** 是否启用超时自动审批 */
|
|
67
|
+
autoApproveEnabled?: boolean;
|
|
68
|
+
/** 超时自动审批期限(小时) */
|
|
69
|
+
autoApproveHours?: number;
|
|
70
|
+
/** 超时后自动处理方式:pass-自动通过 / reject-自动拒绝 */
|
|
71
|
+
autoApproveAction?: 'pass' | 'reject';
|
|
72
|
+
}
|
|
73
|
+
export interface FlowFlowNodeDrawerSavePayload extends FlowFlowNodeActionPayload {
|
|
74
|
+
patch: Record<string, unknown>;
|
|
75
|
+
}
|
|
76
|
+
export interface FlowFlowNodeTitleChangePayload {
|
|
77
|
+
nodeId: string;
|
|
78
|
+
nodeKey: string;
|
|
79
|
+
title: string;
|
|
80
|
+
kind: FlowNodeKind;
|
|
81
|
+
nodeType: FlowProcessNodeType;
|
|
82
|
+
}
|
|
83
|
+
export interface FlowFlowNodeInsertPayload {
|
|
84
|
+
targetNodeKey: string;
|
|
85
|
+
nodeType: FlowProcessNodeType;
|
|
86
|
+
}
|
|
87
|
+
export interface FlowFlowEdgePlusPayload {
|
|
88
|
+
edgeId: string;
|
|
89
|
+
sourceNodeId: string;
|
|
90
|
+
targetNodeId: string;
|
|
91
|
+
canvasX: number;
|
|
92
|
+
canvasY: number;
|
|
93
|
+
}
|
|
94
|
+
export interface FlowFlowRouterBranchPayload {
|
|
95
|
+
nodeId: string;
|
|
96
|
+
routerType?: 'condition' | 'parallel' | 'inclusive';
|
|
97
|
+
}
|
|
98
|
+
export interface FlowFlowInteractionOptions {
|
|
99
|
+
enableNodeDelete?: boolean;
|
|
100
|
+
showNodeDeleteOnHover?: boolean;
|
|
101
|
+
enableNodeClick?: boolean;
|
|
102
|
+
}
|
|
103
|
+
export type FlowFlowToolName = 'zoom' | 'MiniMap';
|
|
104
|
+
export type FlowFlowMiniMapPosition = MiniMap.MiniMapPosition;
|
|
105
|
+
export interface FlowFlowMiniMapOptions extends Partial<{
|
|
106
|
+
width: number;
|
|
107
|
+
height: number;
|
|
108
|
+
showEdge: boolean;
|
|
109
|
+
isShowHeader: boolean;
|
|
110
|
+
isShowCloseIcon: boolean;
|
|
111
|
+
headerTitle: string;
|
|
112
|
+
leftPosition: number;
|
|
113
|
+
rightPosition: number;
|
|
114
|
+
topPosition: number;
|
|
115
|
+
bottomPosition: number;
|
|
116
|
+
}> {
|
|
117
|
+
/**
|
|
118
|
+
* 便捷定位参数,允许直接复用官方 updatePosition 的位置配置。
|
|
119
|
+
* 该字段会在 useFlow 里转换后调用 miniMap.updatePosition。
|
|
120
|
+
*/
|
|
121
|
+
position?: FlowFlowMiniMapPosition;
|
|
122
|
+
}
|
|
123
|
+
export interface FlowFlowNodePickerOption {
|
|
124
|
+
type: FlowProcessNodeType;
|
|
125
|
+
label: string;
|
|
126
|
+
description: string;
|
|
127
|
+
}
|
|
128
|
+
export interface FlowFlowNodeDrawerChoiceOption {
|
|
129
|
+
value: number | string;
|
|
130
|
+
label: string;
|
|
131
|
+
description?: string;
|
|
132
|
+
}
|
|
133
|
+
export interface FlowFlowNodeDrawerRoleOption {
|
|
134
|
+
id: string;
|
|
135
|
+
name: string;
|
|
136
|
+
}
|
|
137
|
+
/** 组织架构节点(树形,用于指定成员 / 发起人自选 场景) */
|
|
138
|
+
export interface FlowFlowNodeDrawerOrgNode {
|
|
139
|
+
id: string;
|
|
140
|
+
name: string;
|
|
141
|
+
/** 节点类型 */
|
|
142
|
+
type?: 'company' | 'department' | 'team';
|
|
143
|
+
/** 该组织下的人员 id 列表(可选,人员统一在 people 里) */
|
|
144
|
+
memberIds?: string[];
|
|
145
|
+
/** 子部门 / 子团队 */
|
|
146
|
+
children?: FlowFlowNodeDrawerOrgNode[];
|
|
147
|
+
/** 索引签名:兼容 TreeNodeData,允许后端 DTO 携带额外字段 */
|
|
148
|
+
[key: string]: unknown;
|
|
149
|
+
}
|
|
150
|
+
export interface FlowFlowNodeDrawerOptions {
|
|
151
|
+
enabled?: boolean;
|
|
152
|
+
roles?: FlowFlowNodeDrawerRoleOption[];
|
|
153
|
+
/** 组织架构树(供审批人员选择器使用) */
|
|
154
|
+
orgTree?: FlowFlowNodeDrawerOrgNode[];
|
|
155
|
+
/** 人员列表(扁平) */
|
|
156
|
+
people?: FlowProcessAssignee[];
|
|
157
|
+
approvalPersonTypes?: FlowFlowNodeDrawerChoiceOption[];
|
|
158
|
+
approvalModes?: FlowFlowNodeDrawerChoiceOption[];
|
|
159
|
+
samePersonModes?: FlowFlowNodeDrawerChoiceOption[];
|
|
160
|
+
approvalRejectStrategies?: FlowFlowNodeDrawerChoiceOption[];
|
|
161
|
+
conditionFields?: FlowFlowNodeDrawerChoiceOption[];
|
|
162
|
+
conditionOperators?: FlowFlowNodeDrawerChoiceOption[];
|
|
163
|
+
nodeConfigs?: FlowNodeConfigDefinition[];
|
|
164
|
+
}
|
|
165
|
+
export interface FlowFlowNodePickerOptions {
|
|
166
|
+
enabled?: boolean;
|
|
167
|
+
options?: FlowFlowNodePickerOption[];
|
|
168
|
+
nodeFactories?: Partial<Record<FlowProcessNodeType, FlowProcessNodeFactory>>;
|
|
169
|
+
}
|
|
170
|
+
export interface FlowFlowEventHandlers {
|
|
171
|
+
onNodeClick?: (payload: FlowFlowNodeActionPayload) => void;
|
|
172
|
+
onNodeDelete?: (payload: FlowFlowNodeActionPayload) => void;
|
|
173
|
+
onNodeTitleChange?: (payload: FlowFlowNodeTitleChangePayload) => void;
|
|
174
|
+
onNodeInsert?: (payload: FlowFlowNodeInsertPayload) => void;
|
|
175
|
+
onEdgePlusClick?: (payload: FlowFlowEdgePlusPayload) => void;
|
|
176
|
+
onRouterAddBranch?: (payload: FlowFlowRouterBranchPayload) => void;
|
|
177
|
+
onNodeDrawerOpen?: (payload: FlowFlowNodeActionPayload) => void;
|
|
178
|
+
onNodeDrawerSave?: (payload: FlowFlowNodeDrawerSavePayload) => void;
|
|
179
|
+
}
|
|
180
|
+
export interface FlowFlowOptions extends Omit<Partial<LogicFlow.Options>, 'container'> {
|
|
181
|
+
editable?: boolean;
|
|
182
|
+
tools?: FlowFlowToolName[];
|
|
183
|
+
miniMap?: FlowFlowMiniMapOptions;
|
|
184
|
+
nodePicker?: FlowFlowNodePickerOptions;
|
|
185
|
+
nodeDrawer?: FlowFlowNodeDrawerOptions;
|
|
186
|
+
interaction?: FlowFlowInteractionOptions;
|
|
187
|
+
events?: FlowFlowEventHandlers;
|
|
188
|
+
}
|
|
189
|
+
export interface FlowCreateNodeContext {
|
|
190
|
+
nodeType: FlowProcessNodeType;
|
|
191
|
+
nextNode?: FlowProcessNode | null;
|
|
192
|
+
createNodeKey: (prefix: string) => string;
|
|
193
|
+
}
|
|
194
|
+
export type FlowProcessNodeFactory = (context: FlowCreateNodeContext) => FlowProcessNode;
|
|
195
|
+
export interface FlowNodeConfigDefinition {
|
|
196
|
+
type: FlowProcessNodeType;
|
|
197
|
+
kind: FlowNodeKind;
|
|
198
|
+
title: string | ((payload: FlowFlowNodeActionPayload) => string);
|
|
199
|
+
description?: string | ((payload: FlowFlowNodeActionPayload) => string);
|
|
200
|
+
component: import('vue').Component;
|
|
201
|
+
}
|
|
202
|
+
export type FlowOptions = FlowFlowOptions;
|
|
203
|
+
export type FlowNodeActionPayload = FlowFlowNodeActionPayload;
|
|
204
|
+
export type FlowNodeDrawerSavePayload = FlowFlowNodeDrawerSavePayload;
|
|
205
|
+
export type FlowNodePickerOption = FlowFlowNodePickerOption;
|
|
206
|
+
export type FlowNodeDrawerChoiceOption = FlowFlowNodeDrawerChoiceOption;
|
|
207
|
+
export type FlowNodeDrawerRoleOption = FlowFlowNodeDrawerRoleOption;
|
|
208
|
+
export type FlowEventHandlers = FlowFlowEventHandlers;
|
|
209
|
+
export {};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { FlowProcessNode } from '../process';
|
|
2
|
+
/**
|
|
3
|
+
* 流程节点类型枚举,与后端 FlowNodeTypeEnum 一一对应。
|
|
4
|
+
*/
|
|
5
|
+
export type FlowProcessNodeType = -1 | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 23 | 30 | 31;
|
|
6
|
+
/**
|
|
7
|
+
* 驳回策略:1 驳回到发起人 / 2 上一节点 / 3 指定节点 / 4 终止流程,
|
|
8
|
+
* 与后端 FlowRejectStrategyEnum 对齐。
|
|
9
|
+
*/
|
|
10
|
+
export type FlowProcessApprovalRejectStrategy = 1 | 2 | 3 | 4;
|
|
11
|
+
/**
|
|
12
|
+
* 流程节点办理人,与后端 FlowNodeAssignee 对齐。
|
|
13
|
+
*/
|
|
14
|
+
export interface FlowProcessAssignee {
|
|
15
|
+
id: string;
|
|
16
|
+
name: string;
|
|
17
|
+
/** 参与者类型:0-用户 1-角色 2-部门(后端 FlowTaskActorEnum.ActorType) */
|
|
18
|
+
actorType?: number;
|
|
19
|
+
/** 票签权重 */
|
|
20
|
+
weight?: number;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* 条件表达式规则,与后端 FlowCondition 对齐。
|
|
24
|
+
* label/type 为设计器展示字段,需随 JSON 往返保留。
|
|
25
|
+
*/
|
|
26
|
+
export interface FlowProcessConditionRule {
|
|
27
|
+
label: string;
|
|
28
|
+
field: string;
|
|
29
|
+
operator: string;
|
|
30
|
+
value: string;
|
|
31
|
+
type: string;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* childNode 哨兵包装:内部用空对象 {} 表示"无后续节点",提交前由 sanitizeFlowSourceForSubmit 清理。
|
|
35
|
+
*/
|
|
36
|
+
export interface FlowProcessChildNodeWrapper {
|
|
37
|
+
childNode?: FlowProcessNode | FlowProcessChildNodeWrapper | Record<string, never> | null;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* 流程节点基类,与后端 FlowNodeModel 对齐。
|
|
41
|
+
* callAi / extendConfig 为后端基类字段,前端可选携带。
|
|
42
|
+
*/
|
|
43
|
+
export interface FlowProcessBaseNode {
|
|
44
|
+
nodeName: string;
|
|
45
|
+
nodeKey: string;
|
|
46
|
+
type: FlowProcessNodeType;
|
|
47
|
+
/** AI 处理器编码,配置后路由决策交给 AI 扩展点 */
|
|
48
|
+
callAi?: string;
|
|
49
|
+
/** 扩展配置(票签策略、提醒配置等非固定字段) */
|
|
50
|
+
extendConfig?: Record<string, unknown>;
|
|
51
|
+
childNode?: FlowProcessNode | FlowProcessChildNodeWrapper | Record<string, never> | null;
|
|
52
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { FlowProcessBaseNode } from './base';
|
|
2
|
+
/**
|
|
3
|
+
* 结束节点(type=-1),与后端 EndNodeModel 对齐。执行到该节点时实例正常完成。
|
|
4
|
+
*/
|
|
5
|
+
export interface FlowProcessEndNode extends FlowProcessBaseNode {
|
|
6
|
+
type: -1;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* 自动通过节点(type=30),与后端 AutoPassNodeModel 对齐。
|
|
10
|
+
*/
|
|
11
|
+
export interface FlowProcessAutoPassNode extends FlowProcessBaseNode {
|
|
12
|
+
type: 30;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* 自动拒绝节点(type=31),与后端 AutoRejectNodeModel 对齐。
|
|
16
|
+
*/
|
|
17
|
+
export interface FlowProcessAutoRejectNode extends FlowProcessBaseNode {
|
|
18
|
+
type: 31;
|
|
19
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { FlowProcessBaseNode, FlowProcessConditionRule } from './base';
|
|
2
|
+
/**
|
|
3
|
+
* 路由容器公共字段,与后端 RouterNodeModel 对齐。
|
|
4
|
+
*/
|
|
5
|
+
export interface FlowProcessRouterFields {
|
|
6
|
+
/** 分支汇聚策略,1 表示所有分支汇聚后再继续流转 */
|
|
7
|
+
groupStrategy?: number;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* 分支条件节点(type=3),与后端 FlowConditionNode 对齐。
|
|
11
|
+
* conditionList 为二维数组:外层条件组(组间 OR),内层组内条件(组内 AND)。
|
|
12
|
+
*/
|
|
13
|
+
export interface FlowProcessConditionBranchNode extends FlowProcessBaseNode {
|
|
14
|
+
type: 3;
|
|
15
|
+
priorityLevel: number;
|
|
16
|
+
conditionList?: FlowProcessConditionRule[][];
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* 条件路由容器(type=4),与后端 ConditionRouterNodeModel 对齐。
|
|
20
|
+
*/
|
|
21
|
+
export interface FlowProcessConditionRouterNode extends FlowProcessBaseNode, FlowProcessRouterFields {
|
|
22
|
+
type: 4;
|
|
23
|
+
conditionNodes: FlowProcessConditionBranchNode[];
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* 并行路由容器(type=8),与后端 ParallelRouterNodeModel 对齐。
|
|
27
|
+
*/
|
|
28
|
+
export interface FlowProcessParallelRouterNode extends FlowProcessBaseNode, FlowProcessRouterFields {
|
|
29
|
+
type: 8;
|
|
30
|
+
parallelNodes: FlowProcessConditionBranchNode[];
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* 包容路由容器(type=9),与后端 InclusiveRouterNodeModel 对齐。
|
|
34
|
+
*/
|
|
35
|
+
export interface FlowProcessInclusiveRouterNode extends FlowProcessBaseNode, FlowProcessRouterFields {
|
|
36
|
+
type: 9;
|
|
37
|
+
inclusiveNodes: FlowProcessConditionBranchNode[];
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* 路由分支节点(type=23),与后端 RouteRouterNodeModel 对齐。
|
|
41
|
+
*/
|
|
42
|
+
export interface FlowProcessRouteBranchNode extends FlowProcessBaseNode, FlowProcessRouterFields {
|
|
43
|
+
type: 23;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* 路由节点联合类型。
|
|
47
|
+
*/
|
|
48
|
+
export type FlowProcessRouterNode = FlowProcessConditionRouterNode | FlowProcessParallelRouterNode | FlowProcessInclusiveRouterNode;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import type { FlowProcessApprovalRejectStrategy, FlowProcessAssignee, FlowProcessBaseNode } from './base';
|
|
2
|
+
/**
|
|
3
|
+
* 任务节点公共字段,与后端 TaskNodeModel 对齐。
|
|
4
|
+
* 发起、审批、抄送、延迟等待、触发器、子流程等会创建办理任务的节点均继承这些字段。
|
|
5
|
+
*/
|
|
6
|
+
export interface FlowProcessTaskNodeFields {
|
|
7
|
+
/** 审批人设置类型,见后端 FlowNodeSetTypeEnum */
|
|
8
|
+
setType?: number;
|
|
9
|
+
/** 审批参与方式:1 顺序 / 2 会签 / 3 或签 / 4 票签 */
|
|
10
|
+
examineMode?: number | string;
|
|
11
|
+
/** 票签通过权重 */
|
|
12
|
+
passWeight?: number;
|
|
13
|
+
/** 驳回策略 */
|
|
14
|
+
rejectStrategy?: FlowProcessApprovalRejectStrategy;
|
|
15
|
+
/** 是否允许驳回到发起节点,1 表示允许 */
|
|
16
|
+
rejectStart?: number;
|
|
17
|
+
/** 是否开启任务到期自动处理 */
|
|
18
|
+
termAuto?: boolean;
|
|
19
|
+
/** 任务期限(小时) */
|
|
20
|
+
term?: number;
|
|
21
|
+
/** 到期处理模式:1 超时自动拒绝,其他自动通过 */
|
|
22
|
+
termMode?: number;
|
|
23
|
+
/** 是否开启任务提醒 */
|
|
24
|
+
remind?: boolean;
|
|
25
|
+
/** 节点任务办理页地址 */
|
|
26
|
+
actionUrl?: string;
|
|
27
|
+
/** 节点办理人配置 */
|
|
28
|
+
nodeAssigneeList?: FlowProcessAssignee[];
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* 发起节点(type=0),与后端 StartNodeModel 对齐。
|
|
32
|
+
*/
|
|
33
|
+
export interface FlowProcessStartNode extends FlowProcessBaseNode, FlowProcessTaskNodeFields {
|
|
34
|
+
type: 0;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* 审批节点(type=1),与后端 ApprovalNodeModel 对齐。
|
|
38
|
+
*/
|
|
39
|
+
export interface FlowProcessApproveNode extends FlowProcessBaseNode, FlowProcessTaskNodeFields {
|
|
40
|
+
type: 1;
|
|
41
|
+
/** 审批人自审:1 自动跳过 */
|
|
42
|
+
approveSelf?: number | string;
|
|
43
|
+
/** 部门领导层级(setType=2 指定级别 / setType=6 连续多级审批起始级别) */
|
|
44
|
+
examineLevel?: number;
|
|
45
|
+
/** 是否允许审批转办 */
|
|
46
|
+
allowTransfer?: boolean;
|
|
47
|
+
/** 是否允许加签或减签 */
|
|
48
|
+
allowAppendNode?: boolean;
|
|
49
|
+
/** 是否允许审批回退 */
|
|
50
|
+
allowRollback?: boolean;
|
|
51
|
+
/** 是否允许手动抄送 */
|
|
52
|
+
allowCc?: boolean;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* 抄送节点(type=2),与后端 CopyNodeModel 对齐。
|
|
56
|
+
*/
|
|
57
|
+
export interface FlowProcessCcNode extends FlowProcessBaseNode, FlowProcessTaskNodeFields {
|
|
58
|
+
type: 2;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* 延迟等待节点(type=6),与后端 TimerNodeModel 对齐。
|
|
62
|
+
*/
|
|
63
|
+
export interface FlowProcessTimerNode extends FlowProcessBaseNode, FlowProcessTaskNodeFields {
|
|
64
|
+
type: 6;
|
|
65
|
+
delayTime?: number | null;
|
|
66
|
+
delayUnit?: 'day' | 'hour' | 'minute';
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* 触发器节点(type=7),与后端 TriggerNodeModel 对齐。
|
|
70
|
+
*/
|
|
71
|
+
export interface FlowProcessTriggerNode extends FlowProcessBaseNode, FlowProcessTaskNodeFields {
|
|
72
|
+
type: 7;
|
|
73
|
+
/** 触发器类型 */
|
|
74
|
+
triggerType?: number;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* 子流程节点(type=5),与后端 CallProcessNodeModel 对齐。
|
|
78
|
+
* callProcess 为后端校验必填字段。
|
|
79
|
+
*/
|
|
80
|
+
export interface FlowProcessCallProcessNode extends FlowProcessBaseNode, FlowProcessTaskNodeFields {
|
|
81
|
+
type: 5;
|
|
82
|
+
/** 子流程引用:processKey / processKey:version / processId */
|
|
83
|
+
callProcess?: string;
|
|
84
|
+
/** 子流程是否异步执行 */
|
|
85
|
+
callAsync?: boolean;
|
|
86
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 流程节点模型类型统一入口。
|
|
3
|
+
*
|
|
4
|
+
* 各节点类型按职责拆分到 ./process 子目录:
|
|
5
|
+
* - base.ts 基类与公共辅助类型(FlowProcessBaseNode、FlowProcessAssignee 等)
|
|
6
|
+
* - task.ts 任务型节点(发起/审批/抄送/延迟/触发/子流程)
|
|
7
|
+
* - router.ts 路由容器与分支项(条件/并行/包容/路由)
|
|
8
|
+
* - endpoint.ts 终止类节点(结束/自动通过/自动拒绝)
|
|
9
|
+
*
|
|
10
|
+
* 本文件仅做类型汇总与联合类型定义,所有类型名称与拆分前保持一致,向后兼容。
|
|
11
|
+
*/
|
|
12
|
+
import type { FlowProcessNodeType, FlowProcessApprovalRejectStrategy, FlowProcessAssignee, FlowProcessConditionRule, FlowProcessChildNodeWrapper, FlowProcessBaseNode } from './process/base';
|
|
13
|
+
import type { FlowProcessTaskNodeFields, FlowProcessStartNode, FlowProcessApproveNode, FlowProcessCcNode, FlowProcessTimerNode, FlowProcessTriggerNode, FlowProcessCallProcessNode } from './process/task';
|
|
14
|
+
import type { FlowProcessRouterFields, FlowProcessConditionBranchNode, FlowProcessConditionRouterNode, FlowProcessParallelRouterNode, FlowProcessInclusiveRouterNode, FlowProcessRouteBranchNode, FlowProcessRouterNode } from './process/router';
|
|
15
|
+
import type { FlowProcessEndNode, FlowProcessAutoPassNode, FlowProcessAutoRejectNode } from './process/endpoint';
|
|
16
|
+
export type { FlowProcessNodeType, FlowProcessApprovalRejectStrategy, FlowProcessAssignee, FlowProcessConditionRule, FlowProcessChildNodeWrapper, FlowProcessBaseNode, FlowProcessTaskNodeFields, FlowProcessStartNode, FlowProcessApproveNode, FlowProcessCcNode, FlowProcessTimerNode, FlowProcessTriggerNode, FlowProcessCallProcessNode, FlowProcessRouterFields, FlowProcessConditionBranchNode, FlowProcessConditionRouterNode, FlowProcessParallelRouterNode, FlowProcessInclusiveRouterNode, FlowProcessRouteBranchNode, FlowProcessRouterNode, FlowProcessEndNode, FlowProcessAutoPassNode, FlowProcessAutoRejectNode, };
|
|
17
|
+
/**
|
|
18
|
+
* 流程节点联合类型,覆盖全部 14 种节点类型,与后端多态模型一一对应。
|
|
19
|
+
*/
|
|
20
|
+
export type FlowProcessNode = FlowProcessStartNode | FlowProcessApproveNode | FlowProcessCcNode | FlowProcessConditionBranchNode | FlowProcessConditionRouterNode | FlowProcessCallProcessNode | FlowProcessTimerNode | FlowProcessTriggerNode | FlowProcessParallelRouterNode | FlowProcessInclusiveRouterNode | FlowProcessRouteBranchNode | FlowProcessAutoPassNode | FlowProcessAutoRejectNode | FlowProcessEndNode;
|
|
21
|
+
/**
|
|
22
|
+
* 流程定义 JSON 根类型(即 FlowProcessModel.nodeConfig 的结构)。
|
|
23
|
+
*/
|
|
24
|
+
export type FlowProcessJson = FlowProcessNode;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './hooks/logicflow';
|
package/package.json
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "nkk-flow",
|
|
3
|
+
"private": false,
|
|
4
|
+
"version": "0.1.0",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"description": "Vue 3 + LogicFlow 审批流画布封装,核心入口 useFlow 提供容器、流程 JSON 和配置即用",
|
|
7
|
+
"keywords": [
|
|
8
|
+
"vue",
|
|
9
|
+
"vue3",
|
|
10
|
+
"logicflow",
|
|
11
|
+
"workflow",
|
|
12
|
+
"approval",
|
|
13
|
+
"bpmn",
|
|
14
|
+
"flow-designer",
|
|
15
|
+
"process"
|
|
16
|
+
],
|
|
17
|
+
"author": "nkk",
|
|
18
|
+
"license": "MIT",
|
|
19
|
+
"homepage": "https://github.com/nkk/nkk-flow#readme",
|
|
20
|
+
"repository": {
|
|
21
|
+
"type": "git",
|
|
22
|
+
"url": "git+https://github.com/nkk/nkk-flow.git"
|
|
23
|
+
},
|
|
24
|
+
"bugs": {
|
|
25
|
+
"url": "https://github.com/nkk/nkk-flow/issues"
|
|
26
|
+
},
|
|
27
|
+
"main": "./dist/index.cjs",
|
|
28
|
+
"module": "./dist/index.js",
|
|
29
|
+
"types": "./dist/types/index.d.ts",
|
|
30
|
+
"exports": {
|
|
31
|
+
".": {
|
|
32
|
+
"types": "./dist/types/index.d.ts",
|
|
33
|
+
"import": "./dist/index.js",
|
|
34
|
+
"require": "./dist/index.cjs"
|
|
35
|
+
},
|
|
36
|
+
"./style.css": "./dist/style.css"
|
|
37
|
+
},
|
|
38
|
+
"files": [
|
|
39
|
+
"dist"
|
|
40
|
+
],
|
|
41
|
+
"sideEffects": [
|
|
42
|
+
"*.css",
|
|
43
|
+
"**/*.css"
|
|
44
|
+
],
|
|
45
|
+
"scripts": {
|
|
46
|
+
"dev": "vite",
|
|
47
|
+
"build": "vue-tsc -b && vite build",
|
|
48
|
+
"build:lib": "vite build --config vite.lib.config.ts --emptyOutDir && vue-tsc -p tsconfig.lib.json",
|
|
49
|
+
"preview": "vite preview",
|
|
50
|
+
"prepublishOnly": "npm run build:lib"
|
|
51
|
+
},
|
|
52
|
+
"peerDependencies": {
|
|
53
|
+
"@logicflow/core": "^2.2.5",
|
|
54
|
+
"@logicflow/extension": "^2.3.1",
|
|
55
|
+
"@vueuse/core": "^14.4.0",
|
|
56
|
+
"vue": "^3.5.40"
|
|
57
|
+
},
|
|
58
|
+
"devDependencies": {
|
|
59
|
+
"@logicflow/core": "^2.2.5",
|
|
60
|
+
"@logicflow/extension": "^2.3.1",
|
|
61
|
+
"@tailwindcss/vite": "^4.3.3",
|
|
62
|
+
"@types/node": "^24.13.3",
|
|
63
|
+
"@vitejs/plugin-vue": "^6.0.8",
|
|
64
|
+
"@vue/tsconfig": "^0.9.1",
|
|
65
|
+
"@vueuse/core": "^14.4.0",
|
|
66
|
+
"tailwindcss": "^4.3.3",
|
|
67
|
+
"typescript": "~6.0.2",
|
|
68
|
+
"vite": "^8.2.0",
|
|
69
|
+
"vue": "^3.5.40",
|
|
70
|
+
"vue-router": "^5.2.0",
|
|
71
|
+
"vue-tsc": "^3.3.8"
|
|
72
|
+
},
|
|
73
|
+
"packageManager": "pnpm@11.16.0+sha512.b767e9a98fc87aec0f42daefcd0e84941c2cdb45d73c4e1e68860fb2bdfdbe032ab592105479e5e05c237f740c8a5ffdbbb52385797ddc2296745a1bbb883e8d",
|
|
74
|
+
"dependencies": {
|
|
75
|
+
"axios": "^1.20.0"
|
|
76
|
+
}
|
|
77
|
+
}
|