@blueking/bkflow-canvas-editor 1.0.0-beta.6 → 1.0.0-beta.8

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/README.md CHANGED
@@ -69,10 +69,10 @@ npm install @blueking/bkflow-canvas-editor
69
69
  | `flowId` | `string` | - | **必需**,流程 ID |
70
70
  | `apiConfig` | `FlowApiConfig` | - | **必需**,API 配置对象,详见 [API 配置](#api-配置) |
71
71
  | `permissions` | `{ canEdit?: boolean }` | `{ canEdit: true }` | 权限配置对象,`canEdit` 控制头部编辑按钮是否使用禁用样式 |
72
- | `thumbnail` | `boolean` | `false` | 缩略图模式,启用后只显示画布内容,不显示顶部 header 和操作按钮,禁用节点点击事件 |
72
+ | `thumbnail` | `boolean` | `false` | 小地图模式,启用后只显示画布内容,不显示顶部 header 和操作按钮,禁用节点点击事件 |
73
73
  | `enableVersion` | `boolean` | `false` | 是否开启流程版本功能,开启后会根据 `flowVersion` 的值获取对应版本的流程数据 |
74
74
  | `flowVersion` | `string` | - | 流程版本号,仅在 `enableVersion` 为 `true` 时生效。为空时表示草稿版本,不为空时表示指定版本 |
75
- | `showHeaderActions` | `boolean` | `true` | 是否显示头部操作按钮(编辑、执行流程、调试),仅在非缩略图模式下生效 |
75
+ | `showHeaderActions` | `boolean` | `true` | 是否显示头部操作按钮(编辑、执行流程、调试),仅在非小地图模式下生效 |
76
76
  | `defaultZoom` | `number` | `1` | x6 画布的默认缩放比例,用于控制画布的初始显示效果。取值范围建议在 0.25 到 1.5 之间 |
77
77
  | `bkflowSaasUrl` | `string` | - | bkflow-saas-url,用于设置 `$.context.site_url` 的值,供插件内部使用 |
78
78
  | `onEdit` | `() => void` | - | 编辑按钮点击回调(可选,也可以通过 `@edit` 事件监听) |
@@ -218,9 +218,9 @@ interface SelectPanelConfig {
218
218
 
219
219
  ---
220
220
 
221
- ### FlowExecute 组件
221
+ ### FlowCreateTask 组件
222
222
 
223
- 流程执行组件,用于执行流程任务。
223
+ 创建任务组件,用于填写参数并创建、触发执行流程任务。
224
224
 
225
225
  #### Props
226
226
 
@@ -246,9 +246,41 @@ interface SelectPanelConfig {
246
246
 
247
247
  ---
248
248
 
249
+ ### FlowExecute 组件
250
+
251
+ 流程执行视图组件,在任务执行页面嵌入只读画布,内置节点和连线在不同执行状态(未执行、成功、失败、执行中)下的样式效果。
252
+
253
+ #### Props
254
+
255
+ | 参数 | 类型 | 默认值 | 说明 |
256
+ | --------------- | --------------------- | ------ | ----------------------------------------------------- |
257
+ | `pipelineTree` | `PipelineTree` | - | **必需**,任务使用的流程模板数据 |
258
+ | `nodeStates` | `TaskExecutionStates` | `{}` | 节点执行状态映射 `Record<nodeId, { status }>` |
259
+ | `defaultZoom` | `number` | `1` | 默认缩放比例 |
260
+ | `apiConfig` | `FlowApiConfig` | - | **必需**,API 配置对象 |
261
+ | `bkflowSaasUrl` | `string` | - | bkflow SaaS 地址 |
262
+ | `onBack` | `() => void` | - | 返回回调 |
263
+
264
+ #### Events
265
+
266
+ | 事件名 | 参数 | 说明 |
267
+ | ------------ | --------------- | -------------------- |
268
+ | `back` | - | 点击返回按钮触发 |
269
+ | `node-click` | `CanvasUiEvent` | 点击节点时触发 |
270
+ | `ui-event` | `CanvasUiEvent` | 画布交互事件透传 |
271
+
272
+ #### Slots
273
+
274
+ | 插槽名 | 说明 |
275
+ | -------- | -------------------- |
276
+ | `header` | 完全替换默认标题区 |
277
+ | `extend` | 标题栏右侧扩展区域 |
278
+
279
+ ---
280
+
249
281
  ### FlowDebug 组件
250
282
 
251
- 流程调试组件,用于调试流程任务。基于 `FlowExecute` 组件实现,但增加了自定义表单插槽、自定义确定按钮回调及版本控制支持。
283
+ 流程调试组件,用于调试流程任务。基于 `FlowCreateTask` 组件实现,但增加了自定义表单插槽、自定义确定按钮回调及版本控制支持。
252
284
 
253
285
  #### Props
254
286
 
@@ -455,9 +487,9 @@ interface SelectPanelConfig {
455
487
  </template>
456
488
  ```
457
489
 
458
- ### 使用缩略图模式
490
+ ### 使用小地图模式
459
491
 
460
- 缩略图模式适用于只需要展示画布内容的场景,不显示顶部 header 和操作按钮,禁用节点点击事件:
492
+ 小地图模式适用于只需要展示画布内容的场景,不显示顶部 header 和操作按钮,禁用节点点击事件:
461
493
 
462
494
  ```vue
463
495
  <template>
@@ -610,7 +642,7 @@ interface SelectPanelConfig {
610
642
 
611
643
  <FlowEdit :flow-id="flowId" :api-config="apiConfig" :bkflow-saas-url="'https://example.com/bkflow'" />
612
644
 
613
- <FlowExecute
645
+ <FlowCreateTask
614
646
  :flow-id="flowId"
615
647
  :show="isExecuteShow"
616
648
  :api-config="apiConfig"
@@ -625,7 +657,7 @@ interface SelectPanelConfig {
625
657
 
626
658
  <script setup>
627
659
  import { ref } from 'vue';
628
- import { FlowView, FlowEdit, FlowExecute, FlowDebug } from 'bkflow-canvas-editor';
660
+ import { FlowView, FlowEdit, FlowCreateTask, FlowExecute, FlowDebug } from 'bkflow-canvas-editor';
629
661
 
630
662
  const flowId = '123';
631
663
  const isExecuteShow = ref(false);
@@ -1076,10 +1108,10 @@ resolve: {
1076
1108
  9. **API 配置类型说明**:
1077
1109
  - 外部使用者只需要使用 `FlowApiConfig` 类型
1078
1110
  - `FlowViewApiConfig` 和 `FlowEditApiConfig` 是组件内部使用的类型,通过 `useFlowApi` 自动转换
1079
- - `FlowExecute` 和 `FlowDebug` 组件可以直接接受 `FlowApiConfig` 类型,组件内部会自动处理
1111
+ - `FlowCreateTask` 和 `FlowDebug` 组件可以直接接受 `FlowApiConfig` 类型,组件内部会自动处理
1080
1112
  10. **调试功能**:
1081
1113
  - `FlowEdit` 组件的 `enableDebug` props 默认为 `false`,设置为 `true` 后才会显示可点击的调试按钮
1082
- - 点击调试按钮会打开 `FlowDebug` 组件,该组件提供了与 `FlowExecute` 相同的交互,但支持自定义表单插槽和自定义确定按钮回调
1114
+ - 点击调试按钮会打开 `FlowDebug` 组件,该组件提供了与 `FlowCreateTask` 相同的交互,但支持自定义表单插槽和自定义确定按钮回调
1083
1115
  - `FlowDebug` 组件的 `useCustomConfirm` 为 `false` 时,会先执行原有的创建和执行任务逻辑,然后执行 `onConfirm` 回调;为 `true` 时,只执行 `onConfirm` 回调
1084
1116
  11. **版本控制**:
1085
1117
  - FlowView、FlowEdit、FlowDebug 三个组件均支持 `enableVersion` 和 `flowVersion` props
@@ -1,5 +1,7 @@
1
1
  import { AxiosInstance, AxiosRequestConfig } from 'axios';
2
2
 
3
+ type NodeExecutionStatus = 'CREATED' | 'RUNNING' | 'FINISHED' | 'FAILED' | 'SUSPENDED' | 'REVOKED';
4
+
3
5
  type PortOrientation = 'Top' | 'Right' | 'Bottom' | 'Left';
4
6
 
5
7
  type GatewayType = 'ExclusiveGateway' | 'ParallelGateway' | 'ConditionalParallelGateway' | 'ConvergeGateway';
@@ -60,6 +62,7 @@ interface Activity {
60
62
  seconds: number;
61
63
  action: string;
62
64
  };
65
+ status?: NodeExecutionStatus;
63
66
  }
64
67
 
65
68
  interface StartEvent {
@@ -69,6 +72,7 @@ interface StartEvent {
69
72
  outgoing: string;
70
73
  type: 'EmptyStartEvent';
71
74
  labels: [];
75
+ status?: NodeExecutionStatus;
72
76
  }
73
77
 
74
78
  interface EndEvent {
@@ -78,6 +82,7 @@ interface EndEvent {
78
82
  outgoing: string;
79
83
  type: 'EmptyEndEvent';
80
84
  labels: [];
85
+ status?: NodeExecutionStatus;
81
86
  }
82
87
 
83
88
  interface GatewayCondition {
@@ -100,6 +105,7 @@ interface Gateway {
100
105
  extra_info?: {
101
106
  parse_lang?: 'boolrule' | 'FEEL' | 'MAKO';
102
107
  };
108
+ status?: NodeExecutionStatus;
103
109
  }
104
110
 
105
111
  interface Flow {
@@ -222,7 +228,7 @@ interface NodeConfigData {
222
228
  id: string;
223
229
  type: string;
224
230
  name: string;
225
- status?: string;
231
+ status?: NodeExecutionStatus;
226
232
  component?: Record<string, any>;
227
233
  error_ignorable?: boolean;
228
234
  isSkipped?: boolean;