@yugu-ui/flow-ui 0.1.18 → 0.1.20

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.
@@ -3,6 +3,7 @@
3
3
  * ⚠️ URL 前缀规则:注入 request 的 baseURL 已包含 `/ygm/api/ygmpc`,
4
4
  * 后端文档里的 `/ygmpc/wflow/*` 在此只写 `/wflow/*`;
5
5
  * tenant_no / operator 由注入 request(宿主实例)自动填充,无需传递。
6
+ * 路径覆盖(多项目复用参数化):5 条路径默认值见 provider FlowUIEndpoints,多项目后端路径不一致时可经注入 endpoints 逐项覆盖,缺省与现网一致。
6
7
  */
7
8
  /** 流程配置详情 */
8
9
  export interface WflowConfigDetail {
@@ -20,7 +21,7 @@ export interface WflowConfigDetail {
20
21
  /** 外部流程标识:0=非外部展示全部配置项(缺省默认),1=外部默认隐藏内置配置 */
21
22
  is_external?: number;
22
23
  }
23
- /** 获取流程配置详情(GET /wflow/config/{config_id}) */
24
+ /** 获取流程配置详情(GET /wflow/config/{config_id};路径可经注入 endpoints.configDetail 覆盖) */
24
25
  export declare function fetchGetWflowConfigDetail(configId: number): Promise<import('..').FlowUIResponse<WflowConfigDetail>>;
25
26
  /** 流程节点请求参数:form 为整份表单数据(后端按表单值匹配条件分支);tenant_no/initor_id/initor_name 后端自动取当前登录租户/用户,无需传递 */
26
27
  export interface WflowFlowNodesParams {
@@ -49,7 +50,7 @@ export interface WflowFlowNodesResult {
49
50
  flow_name?: string;
50
51
  nodes: WflowFlowNode[];
51
52
  }
52
- /** 获取流程节点(POST /wflow/flow/nodes:整份表单数据 + 流程 ID,后端按表单值匹配条件分支得到节点链) */
53
+ /** 获取流程节点(POST /wflow/flow/nodes:整份表单数据 + 流程 ID,后端按表单值匹配条件分支得到节点链;路径可经注入 endpoints.flowNodes 覆盖) */
53
54
  export declare function fetchGetWflowFlowNodes(data: WflowFlowNodesParams): Promise<import('..').FlowUIResponse<WflowFlowNodesResult>>;
54
55
  /** 发起流程请求参数(tenant_no 后端自动取当前登录租户无需传递) */
55
56
  export interface WflowFlowLaunchParams {
@@ -87,7 +88,7 @@ export interface WflowFlowLaunchResult {
87
88
  /** 当前待办节点名称 */
88
89
  node_name?: string;
89
90
  }
90
- /** 发起流程(POST /wflow/flow/launch:创建流程实例与首个审批节点任务) */
91
+ /** 发起流程(POST /wflow/flow/launch:创建流程实例与首个审批节点任务;路径可经注入 endpoints.flowLaunch 覆盖) */
91
92
  export declare function fetchLaunchWflowFlow(data: WflowFlowLaunchParams): Promise<import('..').FlowUIResponse<WflowFlowLaunchResult>>;
92
93
  /** 待办详情-表单字段定义(渲染只读表单) */
93
94
  export interface WflowTodoField {
@@ -252,7 +253,7 @@ export interface WflowUndoResult {
252
253
  node_name?: string;
253
254
  task_id?: number;
254
255
  }
255
- /** 审批同意(POST /wflow/undo/approve:或签任一人同意即过,依次/会签全员同意后推进下一节点,末节点通过后流程完成) */
256
+ /** 审批同意(POST /wflow/undo/approve:或签任一人同意即过,依次/会签全员同意后推进下一节点,末节点通过后流程完成;路径可经注入 endpoints.undoApprove 覆盖) */
256
257
  export declare function fetchWflowUndoApprove(data: WflowUndoApproveParams): Promise<import('..').FlowUIResponse<WflowUndoResult>>;
257
- /** 审批驳回(POST /wflow/undo/reject:驳回到发起人=终止流程,驳回到历史审批节点=该节点起重置重审) */
258
+ /** 审批驳回(POST /wflow/undo/reject:驳回到发起人=终止流程,驳回到历史审批节点=该节点起重置重审;路径可经注入 endpoints.undoReject 覆盖) */
258
259
  export declare function fetchWflowUndoReject(data: WflowUndoRejectParams): Promise<import('..').FlowUIResponse<WflowUndoResult>>;
package/dist/index.js CHANGED
@@ -43,13 +43,26 @@ var fallbackPersonSelectorApi = async () => ({
43
43
  data: null,
44
44
  error: createFallbackError()
45
45
  });
46
+ /** wflow 接口路径默认值(与现网路径一致;宿主可经注入 endpoints 逐项覆盖) */
47
+ var DEFAULT_ENDPOINTS = {
48
+ configDetail: "/wflow/config",
49
+ flowNodes: "/wflow/flow/nodes",
50
+ flowLaunch: "/wflow/flow/launch",
51
+ undoApprove: "/wflow/undo/approve",
52
+ undoReject: "/wflow/undo/reject"
53
+ };
46
54
  /** 未注入兜底配置:可渲染、可告警,能力调用统一走 error 分支 */
47
55
  var fallbackConfig = {
48
56
  request: fallbackRequest,
49
57
  getToken: () => "",
50
58
  baseURL: "",
51
59
  personSelectorApi: fallbackPersonSelectorApi,
52
- components: {}
60
+ components: {},
61
+ fileBaseURL: "https://download.yugu8.com",
62
+ fileProxyPrefix: "/download-proxy",
63
+ feedback: {},
64
+ devMode: false,
65
+ endpoints: DEFAULT_ENDPOINTS
53
66
  };
54
67
  /** install 时记录的应用级配置(单应用场景唯一) */
55
68
  var currentConfig = null;
@@ -58,6 +71,14 @@ function getFlowUIConfig() {
58
71
  if (!currentConfig) return fallbackConfig;
59
72
  return currentConfig;
60
73
  }
74
+ /** 反馈 API 读取(可在任意上下文调用):注入 feedback 逐项优先,缺省逐项回落宿主 app-provider 挂载的 window.$message / window.$dialog(挂载前为 undefined,调用侧以 ?. 兜底) */
75
+ function getFlowUIFeedback() {
76
+ const injected = currentConfig?.feedback;
77
+ return {
78
+ message: injected?.message ?? window.$message,
79
+ dialog: injected?.dialog ?? window.$dialog
80
+ };
81
+ }
61
82
  /** 人员选择器默认数据源:GET /system/person-selector(走注入 request) */
62
83
  function createDefaultPersonSelectorApi(request) {
63
84
  return () => request({
@@ -112,7 +133,8 @@ function validatePersonSelectorComponent(comp) {
112
133
  * - `baseURL`:后端接口基础路径,远程选项相对 action 拼接用;
113
134
  * - `personSelectorApi`:人员选择器数据源,默认请求 GET /system/person-selector。
114
135
  * - `components`:能力组件注入(附件上传、选人组件),包内以动态组件消费——附件上传未注入降级提示,选人组件未注入回落内置实现。
115
- * Developed collaboratively with vscode - 改动代码行数: 1行(2.12 宿主全局组件解耦:注入入口文档补能力组件说明)
136
+ * - `fileBaseURL`/`fileProxyPrefix`/`feedback`/`devMode`/`endpoints`:多项目复用参数化注入项(均可选,缺省值与既有行为一致)。
137
+ * Developed collaboratively with vscode - 改动代码行数: 2行(2.12 宿主全局组件解耦:注入入口文档补能力组件说明;多项目复用参数化:文档补参数化注入项说明)
116
138
  */
117
139
  function createFlowUI(options) {
118
140
  if (options.components?.PersonSelector !== void 0) validatePersonSelectorComponent(options.components.PersonSelector);
@@ -121,7 +143,15 @@ function createFlowUI(options) {
121
143
  getToken: options.getToken ?? (() => ""),
122
144
  baseURL: options.baseURL ?? "",
123
145
  personSelectorApi: options.personSelectorApi ?? createDefaultPersonSelectorApi(options.request),
124
- components: options.components ?? {}
146
+ components: options.components ?? {},
147
+ fileBaseURL: options.fileBaseURL ?? "https://download.yugu8.com",
148
+ fileProxyPrefix: options.fileProxyPrefix ?? "/download-proxy",
149
+ feedback: options.feedback ?? {},
150
+ devMode: options.devMode ?? false,
151
+ endpoints: {
152
+ ...DEFAULT_ENDPOINTS,
153
+ ...options.endpoints
154
+ }
125
155
  };
126
156
  return { install(app) {
127
157
  currentConfig = config;
@@ -3198,7 +3228,7 @@ var person_selector_default = /* @__PURE__ */ _plugin_vue_export_helper_default(
3198
3228
  const source = isPersonCovered(p.id) ? personCoverSource(p.id) : null;
3199
3229
  if (source) {
3200
3230
  const kindLabel = source.kind === "dept" ? "部门" : "角色";
3201
- window.$message?.warning(`${p.name} 已通过${kindLabel}「${source.label}」包含,如需单独调整请先取消该${kindLabel}`);
3231
+ getFlowUIFeedback().message?.warning(`${p.name} 已通过${kindLabel}「${source.label}」包含,如需单独调整请先取消该${kindLabel}`);
3202
3232
  return;
3203
3233
  }
3204
3234
  toggleItem({
@@ -3557,7 +3587,7 @@ var person_selector_default = /* @__PURE__ */ _plugin_vue_export_helper_default(
3557
3587
  ])]);
3558
3588
  };
3559
3589
  }
3560
- }), [["__scopeId", "data-v-94c096c2"]]);
3590
+ }), [["__scopeId", "data-v-2068f959"]]);
3561
3591
  //#endregion
3562
3592
  //#region src/person-selector/PersonSelectorSlot.vue
3563
3593
  var PersonSelectorSlot_default = /* @__PURE__ */ defineComponent({
@@ -4073,7 +4103,7 @@ var NodeConfigDrawer_default = /* @__PURE__ */ _plugin_vue_export_helper_default
4073
4103
  const handleConfirm = (close) => {
4074
4104
  if (nodeType.value === NODE_TYPE.APPROVER && form.config.assigneeType === "specified") {
4075
4105
  if (!(Array.isArray(form.config.approvers) ? form.config.approvers : []).length) {
4076
- window.$message?.warning("请选择审批人");
4106
+ getFlowUIFeedback().message?.warning("请选择审批人");
4077
4107
  close(false);
4078
4108
  return;
4079
4109
  }
@@ -4081,7 +4111,7 @@ var NodeConfigDrawer_default = /* @__PURE__ */ _plugin_vue_export_helper_default
4081
4111
  if (nodeType.value === NODE_TYPE.CONDITION) {
4082
4112
  const groups = form.config.conditionGroups || [];
4083
4113
  if (!groups.some((g) => g.rules?.some((r) => r.field))) {
4084
- window.$message?.warning("请先添加条件");
4114
+ getFlowUIFeedback().message?.warning("请先添加条件");
4085
4115
  close(false);
4086
4116
  return;
4087
4117
  }
@@ -4091,7 +4121,7 @@ var NodeConfigDrawer_default = /* @__PURE__ */ _plugin_vue_export_helper_default
4091
4121
  const r = rules[ri];
4092
4122
  if (!r.field) continue;
4093
4123
  if (Array.isArray(r.value) ? !r.value.length : r.value === "" || r.value == null) {
4094
- window.$message?.warning(`条件组 ${gi + 1} 第 ${ri + 1} 条规则未填写条件值`);
4124
+ getFlowUIFeedback().message?.warning(`条件组 ${gi + 1} 第 ${ri + 1} 条规则未填写条件值`);
4095
4125
  close(false);
4096
4126
  return;
4097
4127
  }
@@ -4144,7 +4174,7 @@ var NodeConfigDrawer_default = /* @__PURE__ */ _plugin_vue_export_helper_default
4144
4174
  }, 8, ["show", "title"]);
4145
4175
  };
4146
4176
  }
4147
- }), [["__scopeId", "data-v-1d8631e0"]]);
4177
+ }), [["__scopeId", "data-v-df4cce1b"]]);
4148
4178
  //#endregion
4149
4179
  //#region src/config/FlowConfigFlow/composables/useNodeDrawer.ts
4150
4180
  /**
@@ -4717,7 +4747,7 @@ var FlowConfigFlow_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/
4717
4747
  }
4718
4748
  if (data?.type === NODE_TYPE.END) return;
4719
4749
  if (data?.type === NODE_TYPE.START && props.isExternal !== 0) {
4720
- window.$message?.warning("外部流程由外部系统发起,发起人无需配置");
4750
+ getFlowUIFeedback().message?.warning("外部流程由外部系统发起,发起人无需配置");
4721
4751
  return;
4722
4752
  }
4723
4753
  if (data?.isDefault) return;
@@ -4787,7 +4817,7 @@ var FlowConfigFlow_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/
4787
4817
  ]);
4788
4818
  };
4789
4819
  }
4790
- }), [["__scopeId", "data-v-edefe008"]]);
4820
+ }), [["__scopeId", "data-v-3e939f20"]]);
4791
4821
  //#endregion
4792
4822
  //#region src/config/FlowConfigMore.vue?vue&type=script&setup=true&lang.ts
4793
4823
  var _hoisted_1$9 = { class: "flow-config-more" };
@@ -5002,7 +5032,7 @@ var FlowConfig_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @_
5002
5032
  isExternal: { default: 0 },
5003
5033
  devMode: {
5004
5034
  type: Boolean,
5005
- default: false
5035
+ default: void 0
5006
5036
  }
5007
5037
  },
5008
5038
  emits: [
@@ -5015,12 +5045,15 @@ var FlowConfig_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @_
5015
5045
  const props = __props;
5016
5046
  const emit = __emit;
5017
5047
  const cssVars = useFcCssVars();
5048
+ const flowUIConfig = useFlowUI();
5049
+ /** 生效开发模式:props.devMode 显式传值优先,未传回落注入配置 devMode(缺省 false) */
5050
+ const effectiveDevMode = computed(() => props.devMode ?? flowUIConfig.devMode);
5018
5051
  const tabToStep = {
5019
5052
  form: 1,
5020
5053
  flow: 2,
5021
5054
  more: 3
5022
5055
  };
5023
- const currentStep = ref(!props.devMode && (tabToStep[props.activeTab] ?? 1) === 1 ? 2 : tabToStep[props.activeTab] ?? 1);
5056
+ const currentStep = ref(!effectiveDevMode.value && (tabToStep[props.activeTab] ?? 1) === 1 ? 2 : tabToStep[props.activeTab] ?? 1);
5024
5057
  /** tab 配置(v-for 渲染,value 即步骤序号) */
5025
5058
  const steps = computed(() => [
5026
5059
  {
@@ -5035,8 +5068,8 @@ var FlowConfig_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @_
5035
5068
  value: 3,
5036
5069
  label: "更多设置"
5037
5070
  }
5038
- ].filter((step) => props.devMode || step.value !== 1));
5039
- watch(() => props.devMode, (v) => {
5071
+ ].filter((step) => effectiveDevMode.value || step.value !== 1));
5072
+ watch(() => effectiveDevMode.value, (v) => {
5040
5073
  if (!v && currentStep.value === 1) currentStep.value = 2;
5041
5074
  });
5042
5075
  const formData = ref({});
@@ -5072,11 +5105,11 @@ var FlowConfig_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @_
5072
5105
  /** 校验失败提示:每个模块弹一条 message,标题下列具体错误明细(含节点名),便于直接定位无需逐个排查 */
5073
5106
  const notifyErrors = (tip, errors = []) => {
5074
5107
  if (!errors.length) {
5075
- window.$message?.error(tip);
5108
+ getFlowUIFeedback().message?.error(tip);
5076
5109
  return;
5077
5110
  }
5078
5111
  const shown = errors.slice(0, 5);
5079
- window.$message?.error(() => h("div", { style: "max-width:420px" }, [
5112
+ getFlowUIFeedback().message?.error(() => h("div", { style: "max-width:420px" }, [
5080
5113
  h("div", { style: "font-weight:600" }, tip),
5081
5114
  ...shown.map((e) => h("div", { style: "font-size:12px;opacity:.85;margin-top:4px;line-height:1.5" }, `· ${e}`)),
5082
5115
  ...errors.length > shown.length ? [h("div", { style: "font-size:12px;opacity:.85;margin-top:4px" }, `…等共 ${errors.length} 项问题`)] : []
@@ -5093,7 +5126,7 @@ var FlowConfig_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @_
5093
5126
  validating.value = true;
5094
5127
  try {
5095
5128
  const failed = [
5096
- ...!props.devMode ? [] : [{
5129
+ ...!effectiveDevMode.value ? [] : [{
5097
5130
  step: 1,
5098
5131
  tip: "【字段配置】存在未填写项",
5099
5132
  errors: fieldRef.value?.validate?.() || []
@@ -5195,7 +5228,7 @@ var FlowConfig_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @_
5195
5228
  ref_key: "moreRef",
5196
5229
  ref: moreRef,
5197
5230
  data: moreData.value,
5198
- "show-reserved": __props.devMode,
5231
+ "show-reserved": effectiveDevMode.value,
5199
5232
  onChange: handleMoreChange
5200
5233
  }, null, 8, ["data", "show-reserved"]), [[vShow, currentStep.value === 3]])
5201
5234
  ])]),
@@ -5205,7 +5238,7 @@ var FlowConfig_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @_
5205
5238
  }, 8, ["style"]);
5206
5239
  };
5207
5240
  }
5208
- }), [["__scopeId", "data-v-a1a3b101"]]);
5241
+ }), [["__scopeId", "data-v-76cca869"]]);
5209
5242
  //#endregion
5210
5243
  //#region src/file-preview/index.vue?vue&type=script&setup=true&lang.ts
5211
5244
  var _hoisted_1$7 = ["src"];
@@ -5217,10 +5250,6 @@ var _hoisted_3$4 = {
5217
5250
  key: 3,
5218
5251
  class: "h-full flex-center"
5219
5252
  };
5220
- /** 扩展名 → 预览类型映射(代码/文本类不在表内,走下载兜底) */
5221
- var FILE_ORIGIN = "https://download.yugu8.com";
5222
- /** 文件同域反代前缀(仅 localhost dev) */
5223
- var FILE_PROXY_PREFIX = "/download-proxy";
5224
5253
  //#endregion
5225
5254
  //#region src/file-preview/index.vue
5226
5255
  var file_preview_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
@@ -5281,12 +5310,13 @@ var file_preview_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/*
5281
5310
  "excel",
5282
5311
  "pptx"
5283
5312
  ].includes(kind.value));
5284
- /** 文件资源域名(vite.config.ts 的 /download-proxy 代理目标;仅 localhost dev 走该改写,线上直连) */
5313
+ /** 是否本地开发环境:文件域名 CORS 白名单不含 localhost,本地预览需走 vite 同域反代 */
5285
5314
  const isLocalhost = ["localhost", "127.0.0.1"].includes(window.location.hostname);
5286
- /** 文档类预览 URL:线上直连完整文件域名(CORS 已放行);仅 localhost 开发环境改写为同域反代路径 */
5315
+ const { fileBaseURL, fileProxyPrefix } = useFlowUI();
5316
+ /** 文档类预览 URL:线上直连文件域名(CORS 已放行);仅 localhost 开发环境且 URL 以文件域名为前缀时改写为同域反代路径 */
5287
5317
  const previewUrl = computed(() => {
5288
5318
  if (!isDocKind.value) return props.url;
5289
- if (isLocalhost && props.url.startsWith(FILE_ORIGIN)) return FILE_PROXY_PREFIX + props.url.slice(26);
5319
+ if (fileBaseURL && isLocalhost && props.url.startsWith(fileBaseURL)) return fileProxyPrefix + props.url.slice(fileBaseURL.length);
5290
5320
  return props.url;
5291
5321
  });
5292
5322
  /** @vue-office 可选组件懒加载器:kind → 动态 import(未安装/加载失败时 promise reject,由加载函数降级) */
@@ -5464,7 +5494,7 @@ var file_preview_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/*
5464
5494
  }, 8, ["description"])]))], 4);
5465
5495
  };
5466
5496
  }
5467
- }), [["__scopeId", "data-v-39ebb3af"]]);
5497
+ }), [["__scopeId", "data-v-bc97b9f1"]]);
5468
5498
  //#endregion
5469
5499
  //#region src/file-preview/file-preview-modal.vue
5470
5500
  var file_preview_modal_default = /* @__PURE__ */ defineComponent({
@@ -6266,13 +6296,10 @@ var ApprovalModal_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/*
6266
6296
  rejectTarget: null
6267
6297
  };
6268
6298
  }
6269
- /** 表单校验规则(驳回时:意见必填+需选择驳回节点;同意时:意见非必填) */
6299
+ /** 表单校验规则(意见必填;驳回时:另需选择驳回节点) */
6270
6300
  const rules = computed(() => {
6271
- const base = {};
6272
- if (props.type === "reject") {
6273
- base.opinion = createRequiredRule("请输入审批意见");
6274
- base.rejectTarget = createRequiredRule("请选择驳回节点");
6275
- }
6301
+ const base = { opinion: createRequiredRule("请输入审批意见") };
6302
+ if (props.type === "reject") base.rejectTarget = createRequiredRule("请选择驳回节点");
6276
6303
  return base;
6277
6304
  });
6278
6305
  /**
@@ -6386,7 +6413,9 @@ var ApprovalModal_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/*
6386
6413
  "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => model.attachments = $event),
6387
6414
  "upload-type": "file",
6388
6415
  drag: false,
6389
- accept: ".doc,.docx,.xls,.xlsx,.ppt,.pptx,.txt,.pdf,.zip,.rar,.7z,.jpg,.jpeg,.png,.gif,.bmp,.webp"
6416
+ max: 10,
6417
+ accept: ".doc,.docx,.docm,.xls,.xlsx,.xlsm,.xlsb,.jpg,.jpeg,.png,.gif,.bmp,.webp",
6418
+ "accept-tip": "图片、Excel、Word"
6390
6419
  }, null, 8, ["modelValue"])) : (openBlock(), createElementBlock("div", _hoisted_2$2, "未注入附件上传组件(components.FileUpload),附件上传不可用"))]),
6391
6420
  _: 1
6392
6421
  })
@@ -6397,44 +6426,44 @@ var ApprovalModal_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/*
6397
6426
  }, 8, ["show", "title"]);
6398
6427
  };
6399
6428
  }
6400
- }), [["__scopeId", "data-v-4d9540ab"]]);
6429
+ }), [["__scopeId", "data-v-5376ec57"]]);
6401
6430
  //#endregion
6402
6431
  //#region src/adapter/wflow.ts
6403
- /** 获取流程配置详情(GET /wflow/config/{config_id}) */
6432
+ /** 获取流程配置详情(GET /wflow/config/{config_id};路径可经注入 endpoints.configDetail 覆盖) */
6404
6433
  function fetchGetWflowConfigDetail(configId) {
6405
6434
  return getFlowUIConfig().request({
6406
- url: `/wflow/config/${configId}`,
6435
+ url: `${getFlowUIConfig().endpoints.configDetail}/${configId}`,
6407
6436
  method: "get"
6408
6437
  });
6409
6438
  }
6410
- /** 获取流程节点(POST /wflow/flow/nodes:整份表单数据 + 流程 ID,后端按表单值匹配条件分支得到节点链) */
6439
+ /** 获取流程节点(POST /wflow/flow/nodes:整份表单数据 + 流程 ID,后端按表单值匹配条件分支得到节点链;路径可经注入 endpoints.flowNodes 覆盖) */
6411
6440
  function fetchGetWflowFlowNodes(data) {
6412
6441
  return getFlowUIConfig().request({
6413
- url: "/wflow/flow/nodes",
6442
+ url: getFlowUIConfig().endpoints.flowNodes,
6414
6443
  method: "post",
6415
6444
  data
6416
6445
  });
6417
6446
  }
6418
- /** 发起流程(POST /wflow/flow/launch:创建流程实例与首个审批节点任务) */
6447
+ /** 发起流程(POST /wflow/flow/launch:创建流程实例与首个审批节点任务;路径可经注入 endpoints.flowLaunch 覆盖) */
6419
6448
  function fetchLaunchWflowFlow(data) {
6420
6449
  return getFlowUIConfig().request({
6421
- url: "/wflow/flow/launch",
6450
+ url: getFlowUIConfig().endpoints.flowLaunch,
6422
6451
  method: "post",
6423
6452
  data
6424
6453
  });
6425
6454
  }
6426
- /** 审批同意(POST /wflow/undo/approve:或签任一人同意即过,依次/会签全员同意后推进下一节点,末节点通过后流程完成) */
6455
+ /** 审批同意(POST /wflow/undo/approve:或签任一人同意即过,依次/会签全员同意后推进下一节点,末节点通过后流程完成;路径可经注入 endpoints.undoApprove 覆盖) */
6427
6456
  function fetchWflowUndoApprove(data) {
6428
6457
  return getFlowUIConfig().request({
6429
- url: "/wflow/undo/approve",
6458
+ url: getFlowUIConfig().endpoints.undoApprove,
6430
6459
  method: "post",
6431
6460
  data
6432
6461
  });
6433
6462
  }
6434
- /** 审批驳回(POST /wflow/undo/reject:驳回到发起人=终止流程,驳回到历史审批节点=该节点起重置重审) */
6463
+ /** 审批驳回(POST /wflow/undo/reject:驳回到发起人=终止流程,驳回到历史审批节点=该节点起重置重审;路径可经注入 endpoints.undoReject 覆盖) */
6435
6464
  function fetchWflowUndoReject(data) {
6436
6465
  return getFlowUIConfig().request({
6437
- url: "/wflow/undo/reject",
6466
+ url: getFlowUIConfig().endpoints.undoReject,
6438
6467
  method: "post",
6439
6468
  data
6440
6469
  });
@@ -6449,6 +6478,10 @@ var FlowActions_default = /* @__PURE__ */ defineComponent({
6449
6478
  approval: {
6450
6479
  type: Boolean,
6451
6480
  default: true
6481
+ },
6482
+ showWithdraw: {
6483
+ type: Boolean,
6484
+ default: true
6452
6485
  }
6453
6486
  },
6454
6487
  emits: ["success"],
@@ -6470,15 +6503,15 @@ var FlowActions_default = /* @__PURE__ */ defineComponent({
6470
6503
  approvalType.value = type;
6471
6504
  approvalVisible.value = true;
6472
6505
  }
6473
- /** 撤回:二次确认(window.$dialog 由宿主 app-provider 注入);撤回接口待接入,确认后暂仅提示成功 */
6506
+ /** 撤回:二次确认(反馈 API 经 getFlowUIFeedback:注入 feedback 优先,回落宿主 app-provider 挂载的 window.$dialog);撤回接口待接入,确认后暂仅提示成功 */
6474
6507
  function handleWithdraw() {
6475
- window.$dialog?.warning({
6508
+ getFlowUIFeedback().dialog?.warning({
6476
6509
  title: "撤回确认",
6477
6510
  content: "确定撤回当前流程吗?",
6478
6511
  positiveText: "确定",
6479
6512
  negativeText: "取消",
6480
6513
  onPositiveClick: () => {
6481
- window.$message?.success("流程已撤回");
6514
+ getFlowUIFeedback().message?.success("流程已撤回");
6482
6515
  }
6483
6516
  });
6484
6517
  }
@@ -6486,7 +6519,7 @@ var FlowActions_default = /* @__PURE__ */ defineComponent({
6486
6519
  async function handleApprovalSubmit(value, done) {
6487
6520
  const undoId = props.data?.undo_id;
6488
6521
  if (!undoId) {
6489
- window.$message?.error("未获取到待办审批记录ID,无法处理");
6522
+ getFlowUIFeedback().message?.error("未获取到待办审批记录ID,无法处理");
6490
6523
  done(false);
6491
6524
  return;
6492
6525
  }
@@ -6499,10 +6532,10 @@ var FlowActions_default = /* @__PURE__ */ defineComponent({
6499
6532
  });
6500
6533
  done(!error);
6501
6534
  if (error) return;
6502
- window.$message?.success("审批成功");
6535
+ getFlowUIFeedback().message?.success("审批成功");
6503
6536
  } else {
6504
6537
  if (!value.rejectNodeId) {
6505
- window.$message?.error("未获取到驳回目标节点ID");
6538
+ getFlowUIFeedback().message?.error("未获取到驳回目标节点ID");
6506
6539
  done(false);
6507
6540
  return;
6508
6541
  }
@@ -6514,7 +6547,7 @@ var FlowActions_default = /* @__PURE__ */ defineComponent({
6514
6547
  });
6515
6548
  done(!error);
6516
6549
  if (error) return;
6517
- window.$message?.success(`已驳回至 ${value.rejectNode}`);
6550
+ getFlowUIFeedback().message?.success(`已驳回至 ${value.rejectNode}`);
6518
6551
  }
6519
6552
  emit("success");
6520
6553
  }
@@ -6525,13 +6558,14 @@ var FlowActions_default = /* @__PURE__ */ defineComponent({
6525
6558
  align: "center"
6526
6559
  }, {
6527
6560
  default: withCtx(() => [
6528
- createVNode(unref(NButton), {
6561
+ __props.showWithdraw ? (openBlock(), createBlock(unref(NButton), {
6562
+ key: 0,
6529
6563
  type: "warning",
6530
6564
  onClick: handleWithdraw
6531
6565
  }, {
6532
6566
  default: withCtx(() => [..._cache[3] || (_cache[3] = [createTextVNode("撤回", -1)])]),
6533
6567
  _: 1
6534
- }),
6568
+ })) : createCommentVNode("", true),
6535
6569
  createVNode(unref(NButton), {
6536
6570
  type: "error",
6537
6571
  onClick: _cache[0] || (_cache[0] = ($event) => openApproval("reject"))
@@ -1,6 +1,6 @@
1
1
  import { App } from 'vue';
2
- import { FlowUIConfig, FlowUIOptions } from './types';
3
- export type { FlowUIComponents, FlowUIConfig, FlowUIOptions, FlowUIRequest, FlowUIRequestConfig, FlowUIResponse, PersonSelectorApi, PersonSelectorRawData } from './types';
2
+ import { FlowUIConfig, FlowUIFeedback, FlowUIOptions } from './types';
3
+ export type { FlowUIComponents, FlowUIConfig, FlowUIEndpoints, FlowUIFeedback, FlowUIOptions, FlowUIRequest, FlowUIRequestConfig, FlowUIResponse, PersonSelectorApi, PersonSelectorRawData } from './types';
4
4
  export { FLOW_UI_KEY } from './key';
5
5
  /** createFlowUI 返回的 Vue 插件实例(供 app.use 使用) */
6
6
  export interface FlowUIInstance {
@@ -8,6 +8,8 @@ export interface FlowUIInstance {
8
8
  }
9
9
  /** 非 setup 上下文(adapter 层等)读取注入配置:未注入时 DEV 告警一次并返回兜底配置(不抛错) */
10
10
  export declare function getFlowUIConfig(): FlowUIConfig;
11
+ /** 反馈 API 读取(可在任意上下文调用):注入 feedback 逐项优先,缺省逐项回落宿主 app-provider 挂载的 window.$message / window.$dialog(挂载前为 undefined,调用侧以 ?. 兜底) */
12
+ export declare function getFlowUIFeedback(): FlowUIFeedback;
11
13
  /**
12
14
  * 自定义选人组件契约校验(createFlowUI 注入时与 PersonSelectorSlot 渲染时各调用,按组件实例去重警告):
13
15
  * 硬性不合格(非组件本体 / props 未声明 modelValue / emits 未声明 update:modelValue)返回 false,槽位据此回落内置实现。
@@ -22,7 +24,8 @@ export declare function validatePersonSelectorComponent(comp: unknown): boolean;
22
24
  * - `baseURL`:后端接口基础路径,远程选项相对 action 拼接用;
23
25
  * - `personSelectorApi`:人员选择器数据源,默认请求 GET /system/person-selector。
24
26
  * - `components`:能力组件注入(附件上传、选人组件),包内以动态组件消费——附件上传未注入降级提示,选人组件未注入回落内置实现。
25
- * Developed collaboratively with vscode - 改动代码行数: 1行(2.12 宿主全局组件解耦:注入入口文档补能力组件说明)
27
+ * - `fileBaseURL`/`fileProxyPrefix`/`feedback`/`devMode`/`endpoints`:多项目复用参数化注入项(均可选,缺省值与既有行为一致)。
28
+ * Developed collaboratively with vscode - 改动代码行数: 2行(2.12 宿主全局组件解耦:注入入口文档补能力组件说明;多项目复用参数化:文档补参数化注入项说明)
26
29
  */
27
30
  export declare function createFlowUI(options: FlowUIOptions): FlowUIInstance;
28
31
  /**
@@ -1,4 +1,5 @@
1
1
  import { Component } from 'vue';
2
+ import { DialogProviderInst, MessageProviderInst } from 'naive-ui';
2
3
  /** 请求配置(axios 风格子集,包内仅用到 url/method/params/data) */
3
4
  export interface FlowUIRequestConfig {
4
5
  url: string;
@@ -46,6 +47,24 @@ export interface FlowUIComponents {
46
47
  /** 选人组件:替换包内全部选人点(流程管理员/指定成员/指定审批人/抄送人/条件值-人员/发起人自选)。契约同内置 PersonSelector:props 须支持 modelValue(SelectedItem[],v-model)/placeholder/display-mode('wrap'|'overflow')/selectable-types,emit 须回传 update:modelValue(SelectedItem[]);注入与渲染时做契约校验,不合格 console.warn 且回落内置 PersonSelector */
47
48
  PersonSelector?: Component;
48
49
  }
50
+ /** 消息/弹窗反馈 API(naive-ui Provider 实例形态,均为可选:缺省逐项回落宿主 app-provider 挂载的 window.$message / window.$dialog) */
51
+ export interface FlowUIFeedback {
52
+ message?: MessageProviderInst;
53
+ dialog?: DialogProviderInst;
54
+ }
55
+ /** wflow 接口路径集合(默认值=现网路径;注入 endpoints 为 Partial,仅传需覆盖项) */
56
+ export interface FlowUIEndpoints {
57
+ /** 流程配置详情:GET `${configDetail}/${configId}`,默认 '/wflow/config' */
58
+ configDetail: string;
59
+ /** 获取流程节点(form 发起模式),默认 '/wflow/flow/nodes' */
60
+ flowNodes: string;
61
+ /** 发起流程,默认 '/wflow/flow/launch' */
62
+ flowLaunch: string;
63
+ /** 审批同意,默认 '/wflow/undo/approve' */
64
+ undoApprove: string;
65
+ /** 审批驳回,默认 '/wflow/undo/reject' */
66
+ undoReject: string;
67
+ }
49
68
  /** 注入选项(宿主 app.use(createFlowUI(options)) 传入) */
50
69
  export interface FlowUIOptions {
51
70
  /** 宿主请求实例(必填):包内 wflow/PersonSelector 等接口全部改走它 */
@@ -58,6 +77,16 @@ export interface FlowUIOptions {
58
77
  personSelectorApi?: PersonSelectorApi;
59
78
  /** 能力组件注入:附件上传、选人组件等宿主专属组件 */
60
79
  components?: FlowUIComponents;
80
+ /** 文件资源域名(FilePreview 文档类预览 URL 改写用),默认 'https://download.yugu8.com';注入空串则跳过改写 */
81
+ fileBaseURL?: string;
82
+ /** 本地开发同域反代前缀(仅 localhost dev 且 URL 以 fileBaseURL 为前缀时改写走 vite 代理),默认 '/download-proxy' */
83
+ fileProxyPrefix?: string;
84
+ /** 消息/弹窗反馈 API(未传逐项回落 window.$message / window.$dialog) */
85
+ feedback?: FlowUIFeedback;
86
+ /** 开发模式开关(默认 false):true 时 FlowConfig 展示「字段配置」页签与「更多设置」预留字段;组件 dev-mode prop 显式传值优先,未传回落注入值 */
87
+ devMode?: boolean;
88
+ /** wflow 接口路径覆盖(Partial 逐项可选,缺省为包内默认路径) */
89
+ endpoints?: Partial<FlowUIEndpoints>;
61
90
  }
62
91
  /** 解析后的注入配置(包内 useFlowUI 返回,全部字段有兜底值) */
63
92
  export interface FlowUIConfig {
@@ -67,4 +96,14 @@ export interface FlowUIConfig {
67
96
  personSelectorApi: PersonSelectorApi;
68
97
  /** 能力组件(未注入为空对象,对应能力降级提示) */
69
98
  components: FlowUIComponents;
99
+ /** 文件资源域名(未注入默认 'https://download.yugu8.com') */
100
+ fileBaseURL: string;
101
+ /** 本地开发同域反代前缀(未注入默认 '/download-proxy') */
102
+ fileProxyPrefix: string;
103
+ /** 反馈 API(原样透传注入值,逐项回落逻辑在 getFlowUIFeedback 内) */
104
+ feedback: FlowUIFeedback;
105
+ /** 开发模式兜底开关(未注入默认 false;组件 dev-mode prop 显式传值优先) */
106
+ devMode: boolean;
107
+ /** wflow 接口路径(注入 Partial 与默认合并后的完整集合) */
108
+ endpoints: FlowUIEndpoints;
70
109
  }