@blueking/bkflow-canvas-editor 0.0.37 → 0.0.39

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
@@ -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/`, // 用户查询 API(可选)
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
  };
@@ -941,13 +957,64 @@ interface FlowApiConfig {
941
957
  scope_type: string;
942
958
  scope_value: number;
943
959
  };
944
- /** 用户查询 API 地址(可选) */
960
+ /**
961
+ * 用户查询 API 地址
962
+ * @deprecated 请改用 FlowEdit/FlowView/FlowCreateTask 的 memberSelectorConfig prop。
963
+ * 仅保留以后兼容旧版本。
964
+ */
945
965
  fetchUserApi?: string;
946
966
  /** 是否启用第三方插件(可选,默认为 true) */
947
967
  enableThirdPlugin?: boolean;
948
968
  }
949
969
  ```
950
970
 
971
+ ### MemberSelectorConfig
972
+
973
+ `FlowEdit` / `FlowView` / `FlowCreateTask` 组件提供可选的 `memberSelectorConfig` prop,用于控制人员选择器的行为。未传入时默认为 `{ mode: 'legacy' }`。
974
+
975
+ ```typescript
976
+ type MemberSelectorConfig =
977
+ | {
978
+ /** legacy 模式:使用组件内置的 UserSelector */
979
+ mode?: 'legacy';
980
+ /** 用户查询 API 地址 */
981
+ fetchUserApi?: string;
982
+ }
983
+ | {
984
+ /** tenant 模式:使用多租户人员选择器 @blueking/bk-user-selector */
985
+ mode: 'tenant';
986
+ /** 租户 ID(必填) */
987
+ tenantId: string;
988
+ /** bk-user 服务的 API 基础地址(必填) */
989
+ apiBaseUrl: string;
990
+ /** 当前登录用户 ID */
991
+ currentUserId?: string;
992
+ /** 是否启用跨租户搜索,默认 false */
993
+ enableMultiTenantMode?: boolean;
994
+ /** 是否展示头像,默认 false */
995
+ hasAvatar?: boolean;
996
+ /** 头像 CDN 基础地址 */
997
+ avatarBaseUrl?: string;
998
+ /** 最近选择的用户 ID 列表 */
999
+ recentUserIds?: string[];
1000
+ };
1001
+ ```
1002
+
1003
+ 使用示例:
1004
+
1005
+ ```vue
1006
+ <FlowEdit
1007
+ :flow-id="flowId"
1008
+ :api-config="apiConfig"
1009
+ :member-selector-config="{
1010
+ mode: 'tenant',
1011
+ tenantId: 'default',
1012
+ apiBaseUrl: 'https://bk-user.example.com',
1013
+ }" />
1014
+ ```
1015
+
1016
+ > 提示:选择 `tenant` 模式时,接入方需安装可选 peer 依赖 `@blueking/bk-user-selector`。它仅在 tenant 模式下被动态加载,legacy 模式下未安装也不会报错。
1017
+
951
1018
  组件内部会自动实现所有 API 方法,包括:
952
1019
 
953
1020
  - `fetchFlowDetail` - 获取流程详情