@blueking/bkflow-canvas-editor 1.0.16 → 1.0.18
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 +69 -2
- package/dist/advanced.d.ts +9 -1
- package/dist/index.cjs.js +37 -37
- package/dist/index.d.ts +106 -46
- package/dist/index.esm.js +14960 -14709
- package/dist/style.css +1 -1
- package/package.json +8 -2
package/README.md
CHANGED
|
@@ -36,7 +36,7 @@ npm install @blueking/bkflow-canvas-editor
|
|
|
36
36
|
scope_type: 'space',
|
|
37
37
|
scope_value: 123,
|
|
38
38
|
}, // 作用域数据(必需)
|
|
39
|
-
fetchUserApi: `${window.BK_COMPONENT_API_URL}/api/c/compapi/v2/usermanage/fs_list_users/`, //
|
|
39
|
+
fetchUserApi: `${window.BK_COMPONENT_API_URL}/api/c/compapi/v2/usermanage/fs_list_users/`, // @deprecated 仅保留向后兼容,推荐使用 memberSelectorConfig
|
|
40
40
|
// 可选:使用自定义 axios 实例
|
|
41
41
|
// axiosInstance: customAxiosInstance,
|
|
42
42
|
// 可选:axios 配置
|
|
@@ -46,6 +46,22 @@ npm install @blueking/bkflow-canvas-editor
|
|
|
46
46
|
// },
|
|
47
47
|
};
|
|
48
48
|
|
|
49
|
+
// 人员选择器配置(可选)
|
|
50
|
+
// legacy 模式:使用组件内置的 UserSelector
|
|
51
|
+
const memberSelectorConfig = {
|
|
52
|
+
mode: 'legacy',
|
|
53
|
+
fetchUserApi: `${window.BK_COMPONENT_API_URL}/api/c/compapi/v2/usermanage/fs_list_users/`,
|
|
54
|
+
};
|
|
55
|
+
// tenant 模式:使用 @blueking/bk-user-selector(需接入方单独安装该 npm 包)
|
|
56
|
+
// const memberSelectorConfig = {
|
|
57
|
+
// mode: 'tenant',
|
|
58
|
+
// tenantId: 'default',
|
|
59
|
+
// apiBaseUrl: 'https://bk-user.example.com',
|
|
60
|
+
// currentUserId: 'admin',
|
|
61
|
+
// enableMultiTenantMode: false,
|
|
62
|
+
// hasAvatar: false,
|
|
63
|
+
// };
|
|
64
|
+
|
|
49
65
|
const handleEdit = () => {
|
|
50
66
|
// 跳转到编辑页面
|
|
51
67
|
};
|
|
@@ -1009,13 +1025,64 @@ interface FlowApiConfig {
|
|
|
1009
1025
|
scope_type: string;
|
|
1010
1026
|
scope_value: number;
|
|
1011
1027
|
};
|
|
1012
|
-
/**
|
|
1028
|
+
/**
|
|
1029
|
+
* 用户查询 API 地址
|
|
1030
|
+
* @deprecated 请改用 FlowEdit/FlowView/FlowCreateTask 的 memberSelectorConfig prop。
|
|
1031
|
+
* 仅保留以后兼容旧版本。
|
|
1032
|
+
*/
|
|
1013
1033
|
fetchUserApi?: string;
|
|
1014
1034
|
/** 是否启用第三方插件(可选,默认为 true) */
|
|
1015
1035
|
enableThirdPlugin?: boolean;
|
|
1016
1036
|
}
|
|
1017
1037
|
```
|
|
1018
1038
|
|
|
1039
|
+
### MemberSelectorConfig
|
|
1040
|
+
|
|
1041
|
+
`FlowEdit` / `FlowView` / `FlowCreateTask` 组件提供可选的 `memberSelectorConfig` prop,用于控制人员选择器的行为。未传入时默认为 `{ mode: 'legacy' }`。
|
|
1042
|
+
|
|
1043
|
+
```typescript
|
|
1044
|
+
type MemberSelectorConfig =
|
|
1045
|
+
| {
|
|
1046
|
+
/** legacy 模式:使用组件内置的 UserSelector */
|
|
1047
|
+
mode?: 'legacy';
|
|
1048
|
+
/** 用户查询 API 地址 */
|
|
1049
|
+
fetchUserApi?: string;
|
|
1050
|
+
}
|
|
1051
|
+
| {
|
|
1052
|
+
/** tenant 模式:使用多租户人员选择器 @blueking/bk-user-selector */
|
|
1053
|
+
mode: 'tenant';
|
|
1054
|
+
/** 租户 ID(必填) */
|
|
1055
|
+
tenantId: string;
|
|
1056
|
+
/** bk-user 服务的 API 基础地址(必填) */
|
|
1057
|
+
apiBaseUrl: string;
|
|
1058
|
+
/** 当前登录用户 ID */
|
|
1059
|
+
currentUserId?: string;
|
|
1060
|
+
/** 是否启用跨租户搜索,默认 false */
|
|
1061
|
+
enableMultiTenantMode?: boolean;
|
|
1062
|
+
/** 是否展示头像,默认 false */
|
|
1063
|
+
hasAvatar?: boolean;
|
|
1064
|
+
/** 头像 CDN 基础地址 */
|
|
1065
|
+
avatarBaseUrl?: string;
|
|
1066
|
+
/** 最近选择的用户 ID 列表 */
|
|
1067
|
+
recentUserIds?: string[];
|
|
1068
|
+
};
|
|
1069
|
+
```
|
|
1070
|
+
|
|
1071
|
+
使用示例:
|
|
1072
|
+
|
|
1073
|
+
```vue
|
|
1074
|
+
<FlowEdit
|
|
1075
|
+
:flow-id="flowId"
|
|
1076
|
+
:api-config="apiConfig"
|
|
1077
|
+
:member-selector-config="{
|
|
1078
|
+
mode: 'tenant',
|
|
1079
|
+
tenantId: 'default',
|
|
1080
|
+
apiBaseUrl: 'https://bk-user.example.com',
|
|
1081
|
+
}" />
|
|
1082
|
+
```
|
|
1083
|
+
|
|
1084
|
+
> 提示:选择 `tenant` 模式时,接入方需安装可选 peer 依赖 `@blueking/bk-user-selector`。它仅在 tenant 模式下被动态加载,legacy 模式下未安装也不会报错。
|
|
1085
|
+
|
|
1019
1086
|
组件内部会自动实现所有 API 方法,包括:
|
|
1020
1087
|
|
|
1021
1088
|
- `fetchFlowDetail` - 获取流程详情
|
package/dist/advanced.d.ts
CHANGED
|
@@ -547,7 +547,11 @@ interface FlowApiConfig {
|
|
|
547
547
|
scope_type: string;
|
|
548
548
|
scope_value: number;
|
|
549
549
|
};
|
|
550
|
-
/**
|
|
550
|
+
/**
|
|
551
|
+
* 用户查询 API 地址(可选)
|
|
552
|
+
* @deprecated 请改用 FlowEdit/FlowView 顶层组件的 `memberSelectorConfig.fetchUserApi`。
|
|
553
|
+
* 该字段仅保留向后兼容,未来版本会移除。
|
|
554
|
+
*/
|
|
551
555
|
fetchUserApi?: string;
|
|
552
556
|
/** 是否启用第三方插件(可选,默认为 true) */
|
|
553
557
|
enableThirdPlugin?: boolean;
|
|
@@ -594,6 +598,10 @@ interface FlowViewApiConfig {
|
|
|
594
598
|
fetchFlowDetail: (id: string) => Promise<FlowTemplate>;
|
|
595
599
|
fetchSpaceFlowConfig: (id: string) => Promise<SpaceFlowConfig>;
|
|
596
600
|
fetchSystemVariables: (id: string) => Promise<Variable[]>;
|
|
601
|
+
/**
|
|
602
|
+
* 用户查询 API 地址
|
|
603
|
+
* @deprecated 请改用 memberSelectorConfig.fetchUserApi(顶层组件 prop)
|
|
604
|
+
*/
|
|
597
605
|
fetchUserApi?: string;
|
|
598
606
|
/** 作用域数据(必需,由外部传入) */
|
|
599
607
|
scopeData: {
|