@blueking/bkflow-canvas-editor 1.0.9 → 1.0.10
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 +30 -30
- package/dist/advanced.d.ts +25 -15
- package/dist/index.cjs.js +37 -37
- package/dist/index.d.ts +34 -17
- package/dist/index.esm.js +15909 -15357
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -64,20 +64,20 @@ npm install @blueking/bkflow-canvas-editor
|
|
|
64
64
|
|
|
65
65
|
#### Props
|
|
66
66
|
|
|
67
|
-
| 参数 | 类型
|
|
68
|
-
| ------------------- |
|
|
69
|
-
| `flowId` | `string`
|
|
70
|
-
| `apiConfig` | `FlowApiConfig`
|
|
71
|
-
| `permissions` | `{ canEdit?: boolean }`
|
|
72
|
-
| `thumbnail` | `boolean`
|
|
73
|
-
| `enableVersion` | `boolean`
|
|
74
|
-
| `flowVersion` | `string`
|
|
75
|
-
| `showHeaderActions` | `boolean`
|
|
76
|
-
| `defaultZoom` | `number`
|
|
77
|
-
| `bkflowSaasUrl` | `string`
|
|
78
|
-
| `onEdit` | `() => void`
|
|
79
|
-
| `onBack` | `() => void`
|
|
80
|
-
| `onExecuteSuccess` | `(
|
|
67
|
+
| 参数 | 类型 | 默认值 | 说明 |
|
|
68
|
+
| ------------------- | ------------------------------------------------ | ------------------- | --------------------------------------------------------------------------------------------------------------------------- |
|
|
69
|
+
| `flowId` | `string` | - | **必需**,流程 ID |
|
|
70
|
+
| `apiConfig` | `FlowApiConfig` | - | **必需**,API 配置对象,详见 [API 配置](#api-配置) |
|
|
71
|
+
| `permissions` | `{ canEdit?: boolean }` | `{ canEdit: true }` | 权限配置对象,`canEdit` 控制头部编辑按钮是否使用禁用样式 |
|
|
72
|
+
| `thumbnail` | `boolean` | `false` | 小地图模式,启用后只显示画布内容,不显示顶部 header 和操作按钮,禁用节点点击事件 |
|
|
73
|
+
| `enableVersion` | `boolean` | `false` | 是否开启流程版本功能,开启后会根据 `flowVersion` 的值获取对应版本的流程数据 |
|
|
74
|
+
| `flowVersion` | `string` | - | 流程版本号,仅在 `enableVersion` 为 `true` 时生效。为空时表示草稿版本,不为空时表示指定版本 |
|
|
75
|
+
| `showHeaderActions` | `boolean` | `true` | 是否显示头部操作按钮(编辑、执行流程、调试),仅在非小地图模式下生效 |
|
|
76
|
+
| `defaultZoom` | `number` | `1` | x6 画布的默认缩放比例,用于控制画布的初始显示效果。取值范围建议在 0.25 到 1.5 之间 |
|
|
77
|
+
| `bkflowSaasUrl` | `string` | - | bkflow-saas-url,用于设置 `$.context.site_url` 的值,供插件内部使用 |
|
|
78
|
+
| `onEdit` | `() => void` | - | 编辑按钮点击回调(可选,也可以通过 `@edit` 事件监听) |
|
|
79
|
+
| `onBack` | `() => void` | - | 返回按钮点击回调(可选,也可以通过 `@back` 事件监听) |
|
|
80
|
+
| `onExecuteSuccess` | `(result: FlowTaskExecuteSuccessResult) => void` | - | 执行成功回调(可选),参数含 `createResult`(create_task) 与 `executeResult`(operate_task),用 `executeResult.data.url` 跳转 |
|
|
81
81
|
|
|
82
82
|
#### Slots
|
|
83
83
|
|
|
@@ -224,25 +224,25 @@ interface SelectPanelConfig {
|
|
|
224
224
|
|
|
225
225
|
#### Props
|
|
226
226
|
|
|
227
|
-
| 参数 | 类型
|
|
228
|
-
| ------------------ |
|
|
229
|
-
| `flowId` | `string`
|
|
230
|
-
| `show` | `boolean`
|
|
231
|
-
| `apiConfig` | `FlowApiConfig`
|
|
232
|
-
| `editable` | `boolean`
|
|
233
|
-
| `showFlowEntry` | `boolean`
|
|
234
|
-
| `bkflowSaasUrl` | `string`
|
|
235
|
-
| `onExecuteSuccess` | `(
|
|
227
|
+
| 参数 | 类型 | 默认值 | 说明 |
|
|
228
|
+
| ------------------ | ------------------------------------------------ | ------- | ------------------------------------------------------------------------------------------------------------------- |
|
|
229
|
+
| `flowId` | `string` | - | **必需**,流程 ID |
|
|
230
|
+
| `show` | `boolean` | - | **必需**,是否显示执行面板 |
|
|
231
|
+
| `apiConfig` | `FlowApiConfig` | - | **必需**,API 配置对象,详见 [API 配置](#api-配置) |
|
|
232
|
+
| `editable` | `boolean` | `true` | 是否可编辑 |
|
|
233
|
+
| `showFlowEntry` | `boolean` | `false` | 是否显示流程入口 |
|
|
234
|
+
| `bkflowSaasUrl` | `string` | - | bkflow-saas-url,用于设置 `$.context.site_url` 的值,供插件内部使用 |
|
|
235
|
+
| `onExecuteSuccess` | `(result: FlowTaskExecuteSuccessResult) => void` | - | 执行成功回调,参数含 `createResult`(create_task) 与 `executeResult`(operate_task),用 `executeResult.data.url` 跳转 |
|
|
236
236
|
|
|
237
237
|
#### Events
|
|
238
238
|
|
|
239
|
-
| 事件名 | 参数
|
|
240
|
-
| -------------- |
|
|
241
|
-
| `confirm` | `
|
|
242
|
-
| `close` | -
|
|
243
|
-
| `update:show` | `show: boolean`
|
|
244
|
-
| `before-close` | -
|
|
245
|
-
| `view-flow` | -
|
|
239
|
+
| 事件名 | 参数 | 说明 |
|
|
240
|
+
| -------------- | -------------------------------------- | ------------------------ |
|
|
241
|
+
| `confirm` | `result: FlowTaskExecuteSuccessResult` | 执行确认时触发 |
|
|
242
|
+
| `close` | - | 关闭面板时触发 |
|
|
243
|
+
| `update:show` | `show: boolean` | 显示状态更新时触发 |
|
|
244
|
+
| `before-close` | - | 面板关闭前触发 |
|
|
245
|
+
| `view-flow` | - | 点击查看排障流程按钮触发 |
|
|
246
246
|
|
|
247
247
|
---
|
|
248
248
|
|
package/dist/advanced.d.ts
CHANGED
|
@@ -561,7 +561,27 @@ interface DrawPipelineParams {
|
|
|
561
561
|
gateway_size?: [number, number];
|
|
562
562
|
start?: [number, number];
|
|
563
563
|
}
|
|
564
|
-
|
|
564
|
+
interface CreateFlowTaskResult {
|
|
565
|
+
data: {
|
|
566
|
+
id: number;
|
|
567
|
+
template_id: number;
|
|
568
|
+
[key: string]: unknown;
|
|
569
|
+
};
|
|
570
|
+
[key: string]: unknown;
|
|
571
|
+
}
|
|
572
|
+
interface ExecuteFlowTaskResult {
|
|
573
|
+
result?: boolean;
|
|
574
|
+
code?: number;
|
|
575
|
+
data?: {
|
|
576
|
+
/** 任务详情页跳转地址(含正确的 bkflow task id 与 templateId) */
|
|
577
|
+
url?: string;
|
|
578
|
+
[key: string]: unknown;
|
|
579
|
+
};
|
|
580
|
+
message?: string | null;
|
|
581
|
+
request_id?: string;
|
|
582
|
+
trace_id?: string | null;
|
|
583
|
+
[key: string]: unknown;
|
|
584
|
+
}
|
|
565
585
|
interface FlowViewApiConfig {
|
|
566
586
|
fetchFlowDetail: (id: string) => Promise<FlowTemplate>;
|
|
567
587
|
fetchSpaceFlowConfig: (id: string) => Promise<SpaceFlowConfig>;
|
|
@@ -595,19 +615,14 @@ interface FlowViewApiConfig {
|
|
|
595
615
|
name: string;
|
|
596
616
|
creator: string;
|
|
597
617
|
constants: Record<string, any>;
|
|
598
|
-
}) => Promise<
|
|
599
|
-
data: {
|
|
600
|
-
id: number;
|
|
601
|
-
template_id: number;
|
|
602
|
-
};
|
|
603
|
-
}>;
|
|
618
|
+
}) => Promise<CreateFlowTaskResult>;
|
|
604
619
|
executeFlowTask?: (params: {
|
|
605
620
|
task_id: number;
|
|
606
621
|
action: string;
|
|
607
622
|
resource_type: string;
|
|
608
623
|
resource_id: number;
|
|
609
624
|
permission_type: string;
|
|
610
|
-
}) => Promise<
|
|
625
|
+
}) => Promise<ExecuteFlowTaskResult>;
|
|
611
626
|
fetchControlConfig?: () => Promise<Record<string, any>>;
|
|
612
627
|
checkSpaceConfig?: (scopeValue: number, params: {
|
|
613
628
|
name: string;
|
|
@@ -650,19 +665,14 @@ interface FlowEditApiConfig extends FlowViewApiConfig {
|
|
|
650
665
|
name: string;
|
|
651
666
|
creator: string;
|
|
652
667
|
constants: Record<string, any>;
|
|
653
|
-
}) => Promise<
|
|
654
|
-
data: {
|
|
655
|
-
id: number;
|
|
656
|
-
template_id: number;
|
|
657
|
-
};
|
|
658
|
-
}>;
|
|
668
|
+
}) => Promise<CreateFlowTaskResult>;
|
|
659
669
|
executeFlowTask?: (params: {
|
|
660
670
|
task_id: number;
|
|
661
671
|
action: string;
|
|
662
672
|
resource_type: string;
|
|
663
673
|
resource_id: number;
|
|
664
674
|
permission_type: string;
|
|
665
|
-
}) => Promise<
|
|
675
|
+
}) => Promise<ExecuteFlowTaskResult>;
|
|
666
676
|
}
|
|
667
677
|
|
|
668
678
|
declare const PLUGIN_GROUP_ICON_MAP: Record<string, string>;
|