@blueking/bkflow-canvas-editor 1.0.17 → 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/dist/index.d.ts CHANGED
@@ -635,7 +635,11 @@ interface FlowApiConfig {
635
635
  scope_type: string;
636
636
  scope_value: number;
637
637
  };
638
- /** 用户查询 API 地址(可选) */
638
+ /**
639
+ * 用户查询 API 地址(可选)
640
+ * @deprecated 请改用 FlowEdit/FlowView 顶层组件的 `memberSelectorConfig.fetchUserApi`。
641
+ * 该字段仅保留向后兼容,未来版本会移除。
642
+ */
639
643
  fetchUserApi?: string;
640
644
  /** 是否启用第三方插件(可选,默认为 true) */
641
645
  enableThirdPlugin?: boolean;
@@ -689,6 +693,10 @@ interface FlowViewApiConfig {
689
693
  fetchFlowDetail: (id: string) => Promise<FlowTemplate>;
690
694
  fetchSpaceFlowConfig: (id: string) => Promise<SpaceFlowConfig>;
691
695
  fetchSystemVariables: (id: string) => Promise<Variable[]>;
696
+ /**
697
+ * 用户查询 API 地址
698
+ * @deprecated 请改用 memberSelectorConfig.fetchUserApi(顶层组件 prop)
699
+ */
692
700
  fetchUserApi?: string;
693
701
  /** 作用域数据(必需,由外部传入) */
694
702
  scopeData: {
@@ -768,6 +776,97 @@ interface FlowEditApiConfig extends FlowViewApiConfig {
768
776
  }) => Promise<ExecuteFlowTaskResult>;
769
777
  }
770
778
 
779
+ /**
780
+ * 插件分组选择面板配置
781
+ */
782
+ interface SelectPanelConfig {
783
+ agentApplyUrl?: string;
784
+ agentResourceUrl?: string;
785
+ agentButtonText?: string;
786
+ knowledgebaseResourceUrl?: string;
787
+ }
788
+ /**
789
+ * 人员选择器配置
790
+ * 采用判别联合(discriminated union):
791
+ * - mode 缺省或为 'legacy':使用组件内置的 UserSelector,依赖 fetchUserApi
792
+ * - mode 为 'tenant':使用多租户人员选择器 @blueking/bk-user-selector,
793
+ * tenantId 与 apiBaseUrl 在类型上即为必填
794
+ * 接入方需自行安装 npm 包 @blueking/bk-user-selector
795
+ */
796
+ type MemberSelectorConfig = {
797
+ mode?: 'legacy';
798
+ /** 用户查询 API 地址 */
799
+ fetchUserApi?: string;
800
+ } | {
801
+ mode: 'tenant';
802
+ /** 租户 ID */
803
+ tenantId: string;
804
+ /** bk-user 服务的 API 基础地址 */
805
+ apiBaseUrl: string;
806
+ /** 当前登录用户 ID,开启后可在下拉中快捷选择"我" */
807
+ currentUserId?: string;
808
+ /** 是否启用跨租户搜索,默认 false */
809
+ enableMultiTenantMode?: boolean;
810
+ /** 是否展示头像,默认 false */
811
+ hasAvatar?: boolean;
812
+ /** 头像 CDN 基础地址 */
813
+ avatarBaseUrl?: string;
814
+ /** 最近选择的用户 ID 列表 */
815
+ recentUserIds?: string[];
816
+ };
817
+ /**
818
+ * 在顶层组件中提供 FlowApiConfig
819
+ * @param config FlowApiConfig 配置对象或已处理的 API 配置对象
820
+ * @returns 返回处理后的 API 配置对象
821
+ */
822
+ declare function provideFlowApiConfig(config: FlowApiConfig | FlowEditApiConfig | FlowViewApiConfig): FlowEditApiConfig | FlowViewApiConfig;
823
+ /**
824
+ * 在子组件中注入 FlowApiConfig(通用版本)
825
+ * @returns FlowEditApiConfig
826
+ * @throws 如果 apiConfig 未提供则抛出错误
827
+ */
828
+ declare function useFlowApiConfig(): FlowEditApiConfig;
829
+ /**
830
+ * 在子组件中注入 FlowEditApiConfig(类型化版本)
831
+ * @returns FlowEditApiConfig
832
+ */
833
+ declare function useFlowEditApiConfig(): FlowEditApiConfig;
834
+ /**
835
+ * 在子组件中注入 FlowViewApiConfig(类型化版本)
836
+ * 注意:实际上返回的是 FlowEditApiConfig,但类型上兼容 FlowViewApiConfig
837
+ * @returns FlowViewApiConfig
838
+ */
839
+ declare function useFlowViewApiConfig(): FlowViewApiConfig;
840
+ /**
841
+ * 在顶层组件中提供 SelectPanelConfig
842
+ * @param config SelectPanelConfig 配置对象
843
+ */
844
+ declare function provideSelectPanelConfig(config: SelectPanelConfig): void;
845
+ /**
846
+ * 在子组件中注入 SelectPanelConfig
847
+ * @returns SelectPanelConfig 或 null(如果未提供配置)
848
+ */
849
+ declare function useSelectPanelConfig(): SelectPanelConfig | null;
850
+ /**
851
+ * 在顶层组件中提供 MemberSelectorConfig
852
+ *
853
+ * 注意:当 `config` 为 undefined 时,**不会调用 provide**,从而不会遮蔽
854
+ * 父级(如外层 FlowView/FlowEdit)已经 provide 的配置。
855
+ * 例如 `FlowView` 内部渲染 `FlowCreateTask` 时,如果调用方仅在 `FlowView`
856
+ * 上传入 `memberSelectorConfig`,则 `FlowCreateTask` 不会因为自己未收到 prop
857
+ * 而把 tenant 配置覆盖回 legacy。
858
+ *
859
+ * 若调用方主动传入 `{ mode: 'legacy' }`,则视为显式覆盖,按正常 provide。
860
+ *
861
+ * @param config MemberSelectorConfig 配置对象;为 undefined 时跳过 provide
862
+ */
863
+ declare function provideMemberSelectorConfig(config?: MemberSelectorConfig): void;
864
+ /**
865
+ * 在子组件中注入 MemberSelectorConfig
866
+ * @returns MemberSelectorConfig,未提供时返回 { mode: 'legacy' }
867
+ */
868
+ declare function useMemberSelectorConfig(): MemberSelectorConfig;
869
+
771
870
  type __VLS_Props$5 = {
772
871
  flowId: string;
773
872
  show: boolean;
@@ -783,6 +882,7 @@ type __VLS_Props$5 = {
783
882
  bkflowSaasUrl?: string;
784
883
  enableVersion?: boolean;
785
884
  flowVersion?: string;
885
+ memberSelectorConfig?: MemberSelectorConfig;
786
886
  };
787
887
  declare var __VLS_65: {
788
888
  formData: {
@@ -911,6 +1011,7 @@ type __VLS_Props$3 = {
911
1011
  apiConfig: FlowApiConfig;
912
1012
  onExecuteSuccess?: (result: FlowTaskExecuteSuccessResult) => void;
913
1013
  bkflowSaasUrl?: string;
1014
+ memberSelectorConfig?: MemberSelectorConfig;
914
1015
  };
915
1016
  declare const __VLS_base$3: vue.DefineComponent<__VLS_Props$3, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {
916
1017
  close: (...args: any[]) => void;
@@ -943,49 +1044,6 @@ declare namespace __create_task_vue {
943
1044
  };
944
1045
  }
945
1046
 
946
- /**
947
- * 插件分组选择面板配置
948
- */
949
- interface SelectPanelConfig {
950
- agentApplyUrl?: string;
951
- agentResourceUrl?: string;
952
- agentButtonText?: string;
953
- knowledgebaseResourceUrl?: string;
954
- }
955
- /**
956
- * 在顶层组件中提供 FlowApiConfig
957
- * @param config FlowApiConfig 配置对象或已处理的 API 配置对象
958
- * @returns 返回处理后的 API 配置对象
959
- */
960
- declare function provideFlowApiConfig(config: FlowApiConfig | FlowEditApiConfig | FlowViewApiConfig): FlowEditApiConfig | FlowViewApiConfig;
961
- /**
962
- * 在子组件中注入 FlowApiConfig(通用版本)
963
- * @returns FlowEditApiConfig
964
- * @throws 如果 apiConfig 未提供则抛出错误
965
- */
966
- declare function useFlowApiConfig(): FlowEditApiConfig;
967
- /**
968
- * 在子组件中注入 FlowEditApiConfig(类型化版本)
969
- * @returns FlowEditApiConfig
970
- */
971
- declare function useFlowEditApiConfig(): FlowEditApiConfig;
972
- /**
973
- * 在子组件中注入 FlowViewApiConfig(类型化版本)
974
- * 注意:实际上返回的是 FlowEditApiConfig,但类型上兼容 FlowViewApiConfig
975
- * @returns FlowViewApiConfig
976
- */
977
- declare function useFlowViewApiConfig(): FlowViewApiConfig;
978
- /**
979
- * 在顶层组件中提供 SelectPanelConfig
980
- * @param config SelectPanelConfig 配置对象
981
- */
982
- declare function provideSelectPanelConfig(config: SelectPanelConfig): void;
983
- /**
984
- * 在子组件中注入 SelectPanelConfig
985
- * @returns SelectPanelConfig 或 null(如果未提供配置)
986
- */
987
- declare function useSelectPanelConfig(): SelectPanelConfig | null;
988
-
989
1047
  type __VLS_Slots$2 = {
990
1048
  header?: () => any;
991
1049
  inputParams?: (props: {
@@ -1023,6 +1081,7 @@ type __VLS_Props$2 = {
1023
1081
  }) => Promise<void> | void;
1024
1082
  useCustomDebugConfirm?: boolean;
1025
1083
  selectPanelConfig?: SelectPanelConfig;
1084
+ memberSelectorConfig?: MemberSelectorConfig;
1026
1085
  onSave?: (flowData: FlowTemplate) => void;
1027
1086
  onSaveSuccess?: () => void;
1028
1087
  onBack?: () => void;
@@ -1121,6 +1180,7 @@ type __VLS_Props$1 = {
1121
1180
  onExecuteSuccess?: (result: FlowTaskExecuteSuccessResult) => void;
1122
1181
  /** 是否隐藏基础信息中的触发器配置表单,默认 false */
1123
1182
  hideTrigger?: boolean;
1183
+ memberSelectorConfig?: MemberSelectorConfig;
1124
1184
  };
1125
1185
  declare const __VLS_base$1: vue.DefineComponent<__VLS_Props$1, {
1126
1186
  zoomToFit: (options?: ZoomToFitOptions) => void;
@@ -1396,5 +1456,5 @@ declare const _default: {
1396
1456
  FlowDebug: () => Promise<typeof __debug_vue>;
1397
1457
  };
1398
1458
 
1399
- export { _default$1 as BkFlowCanvas, BkFlowModelAccessor, BkFlowNodeAccessor, _default$4 as FlowCreateTask, _default$6 as FlowDebug, _default$3 as FlowEdit, _default$5 as FlowExecute, _default$2 as FlowView, bkflowConnectionValidator, createBkflowPlugin, createBkflowSchema, createExecutionStatusPlugin, _default as default, exportToPipelineTree, generateId, getUniformApiPluginFormValue, getVariableDefaultConfig, importFromPipelineTree, provideFlowApiConfig, provideSelectPanelConfig, random4, resolveExecutionActions, useFlowApiConfig, useFlowEditApiConfig, useFlowViewApiConfig, useSelectPanelConfig, validatePipelineTree };
1400
- export type { Activity, CanvasViewportExpose, CreateFlowTaskResult, DndNodeItem, ExecuteFlowTaskResult, ExecutionNodeAction, FlowApiConfig, FlowEditExpose, FlowTaskExecuteSuccessResult, FlowTemplate, FlowViewExpose, Gateway, GatewayCondition, NodeExecutionState, NodeExecutionStatus, NotifyConfig, PipelineTree, PluginDetailCommon, PluginInputDataItem, SelectPanelConfig, SpaceFlowConfig, TaskExecutionStates, TemplateConfigs, TriggerCron, TriggerItem, UniformApiPluginInputsItem, UpdateFlowParams, Variable, VariableReference };
1459
+ export { _default$1 as BkFlowCanvas, BkFlowModelAccessor, BkFlowNodeAccessor, _default$4 as FlowCreateTask, _default$6 as FlowDebug, _default$3 as FlowEdit, _default$5 as FlowExecute, _default$2 as FlowView, bkflowConnectionValidator, createBkflowPlugin, createBkflowSchema, createExecutionStatusPlugin, _default as default, exportToPipelineTree, generateId, getUniformApiPluginFormValue, getVariableDefaultConfig, importFromPipelineTree, provideFlowApiConfig, provideMemberSelectorConfig, provideSelectPanelConfig, random4, resolveExecutionActions, useFlowApiConfig, useFlowEditApiConfig, useFlowViewApiConfig, useMemberSelectorConfig, useSelectPanelConfig, validatePipelineTree };
1460
+ export type { Activity, CanvasViewportExpose, CreateFlowTaskResult, DndNodeItem, ExecuteFlowTaskResult, ExecutionNodeAction, FlowApiConfig, FlowEditExpose, FlowTaskExecuteSuccessResult, FlowTemplate, FlowViewExpose, Gateway, GatewayCondition, MemberSelectorConfig, NodeExecutionState, NodeExecutionStatus, NotifyConfig, PipelineTree, PluginDetailCommon, PluginInputDataItem, SelectPanelConfig, SpaceFlowConfig, TaskExecutionStates, TemplateConfigs, TriggerCron, TriggerItem, UniformApiPluginInputsItem, UpdateFlowParams, Variable, VariableReference };