@yugu-ui/flow-ui 0.1.3 → 0.1.5

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.js CHANGED
@@ -6091,9 +6091,10 @@ function mapTimelineNodes(data) {
6091
6091
  };
6092
6092
  });
6093
6093
  }
6094
- /** 组装完整节点链:有数据统一追加 END 结束节点,无数据为空数组走空态;display(非 form)流程全部完成时 END 状态同步 done */
6094
+ /** 组装完整节点链:有数据统一追加 END 结束节点,无数据为空数组走空态;display(非 form)流程全部完成时 END 状态同步 done;末节点已是 end(后端快照自带 end、或调用方传入已组装过 END 的节点链,如 FlowLayout → FlowNodesPanel)时幂等跳过,防止结束节点重复渲染 */
6095
6095
  function withEndNode(baseNodes, mode) {
6096
6096
  if (!baseNodes.length) return [];
6097
+ if (baseNodes[baseNodes.length - 1].type === "end") return baseNodes;
6097
6098
  const allDone = mode !== "form" && baseNodes.every((node) => node.status === "done");
6098
6099
  return [...baseNodes, {
6099
6100
  ...END_NODE,
@@ -6517,7 +6518,8 @@ var FlowLayout_default = /* @__PURE__ */ defineComponent({
6517
6518
  mode: {},
6518
6519
  beforeSubmit: { type: Function },
6519
6520
  getFormData: { type: Function },
6520
- timelineData: {}
6521
+ timelineData: {},
6522
+ approval: { type: Boolean }
6521
6523
  },
6522
6524
  emits: [
6523
6525
  "success",
@@ -6529,10 +6531,10 @@ var FlowLayout_default = /* @__PURE__ */ defineComponent({
6529
6531
  const emit = __emit;
6530
6532
  /** 页面加载状态(透传给 BaseCard,控制内容区 loading 遮罩);flowId=流程 ID(display 模式传流程实例 ID 仅作标识,同意/驳回接口入参为详情返回的 undo_id;form 模式作为提交数据 flow_id) */
6531
6533
  const props = __props;
6532
- /** 是否展示操作按钮:form 模式恒展示;display 模式 undo_finished=0(未处理)才展示,详情未加载/已处理均隐藏 */
6533
- const canOperate = computed(() => props.mode === "form" || props.timelineData?.undo_finished === 0);
6534
- /** 是否展示驳回操作:仅 display 模式且 undo_finished=0(未处理);form 发起模式无驳回 */
6535
- const canReject = computed(() => props.mode !== "form" && props.timelineData?.undo_finished === 0);
6534
+ /** 是否展示操作按钮:form 模式恒展示;display 模式审批模式且 undo_finished=0(未处理)才展示,详情未加载/已处理/纯查看均隐藏 */
6535
+ const canOperate = computed(() => props.mode === "form" || props.approval !== false && props.timelineData?.undo_finished === 0);
6536
+ /** 是否展示驳回操作:仅 display 模式审批模式(approval 未传或 true)且 undo_finished=0(未处理);form 发起模式/纯查看无驳回 */
6537
+ const canReject = computed(() => props.mode !== "form" && props.approval !== false && props.timelineData?.undo_finished === 0);
6536
6538
  /** 折叠面板标题流程状态标签:仅 display 模式展示,颜色映射 已同意=success / 已拒绝=error / 进行中=warning */
6537
6539
  const flowStatusTag = computed(() => getFlowStatusTag(props.mode, props.timelineData));
6538
6540
  /** 关闭:通知消费页(display=关闭详情页,form=取消发起);页签关闭逻辑由消费页承担 */
@@ -6734,15 +6736,16 @@ var FlowLayout_default = /* @__PURE__ */ defineComponent({
6734
6736
  ])) : createCommentVNode("", true)
6735
6737
  ]),
6736
6738
  _: 2
6737
- }, [canReject.value ? {
6739
+ }, [canReject.value || _ctx.$slots["footer-center"] ? {
6738
6740
  name: "footer-center",
6739
- fn: withCtx(() => [createVNode(_component_NButton, {
6741
+ fn: withCtx(() => [canReject.value ? (openBlock(), createBlock(_component_NButton, {
6742
+ key: 0,
6740
6743
  type: "error",
6741
6744
  onClick: handleReject
6742
6745
  }, {
6743
6746
  default: withCtx(() => [..._cache[2] || (_cache[2] = [createTextVNode("驳回", -1)])]),
6744
6747
  _: 1
6745
- })]),
6748
+ })) : createCommentVNode("", true), renderSlot(_ctx.$slots, "footer-center")]),
6746
6749
  key: "0"
6747
6750
  } : void 0]), 1032, ["loading", "confirm-config"]);
6748
6751
  };
@@ -11,14 +11,18 @@ type __VLS_Props = {
11
11
  getFormData?: () => Record<string, unknown>;
12
12
  /** display 模式原始数据:流程实例详情(节点快照自带任务状态与每人处理结果 + status/finished 实例状态 + undo_id 待办审批记录 ID + undo_finished 处理状态),组件内部映射为审批时间线并对接同意/驳回接口,页面无需转换;nodes 为空时节点区展示空态提示 */
13
13
  timelineData?: Pick<WflowTodoDetail, 'nodes' | 'finished' | 'status' | 'undo_id' | 'undo_finished'>;
14
+ /** 是否审批处理模式(仅 display 模式生效,默认 true):按 undo_finished 判断展示同意/驳回;false=纯查看,仅展示流程节点与关闭按钮 */
15
+ approval?: boolean;
14
16
  };
15
17
  /** 条件字段是否全部填写完成:条件字段值取自父组件表单数据(数组非空 / 非 null / 非空串;流程无条件字段时视为填齐),暴露给父组件提交校验调用 */
16
18
  declare function isConditionsFilled(): boolean;
17
19
  /** 请求流程节点(暴露给父组件在表单变化防抖后调用):先等待流程配置就绪(条件字段提取完成)再校验条件字段填齐,随后携带整份表单数据 + 流程 ID 请求,后端按表单值匹配条件分支;条件字段未填齐/请求失败/返回为空时节点链保持不变(节点区空态提示) */
18
20
  declare function fetchFlowNodes(): Promise<void>;
19
- declare var __VLS_10: {};
21
+ declare var __VLS_10: {}, __VLS_26: {};
20
22
  type __VLS_Slots = {} & {
21
23
  default?: (props: typeof __VLS_10) => any;
24
+ } & {
25
+ 'footer-center'?: (props: typeof __VLS_26) => any;
22
26
  };
23
27
  declare const __VLS_base: import('vue').DefineComponent<__VLS_Props, {
24
28
  fetchFlowNodes: typeof fetchFlowNodes;
@@ -18,7 +18,7 @@ export declare function toUserRecords(user: {
18
18
  export declare function isLatestRowsReject(rows: WflowTodoRecord[]): boolean;
19
19
  /** display 模式审批时间线映射:节点快照直接映射 FlowNodeItem——发起人节点独立判定:流程被驳回到发起人(finished=1 且 status=-1)标红、其余一律完成绿色;其余节点按实例 finished、节点自带 finished(1=已完成)推导:进行中节点优先取第一个「未完成且 status=1 待处理」的节点,无激活节点时兜底认第一个存在待处理任务行(users.records 中 result=0 且 finished=0)的节点为当前节点,仍无则回退第一个未完成节点,有激活/兜底节点时其后节点一律待开始(剥离上一轮残留),流程被驳回终止时其余节点一律灰色待开始;人员状态按本人最新一条操作记录展示(已处理记录 result=2/3 或 is_reject=1 中 assertion_time 最新一条:驳回标红、同意标绿),无操作记录随节点状态(进行中节点淡黄、其余灰色未处理) */
20
20
  export declare function mapTimelineNodes(data?: FlowTimelineData): FlowNodeItem[];
21
- /** 组装完整节点链:有数据统一追加 END 结束节点,无数据为空数组走空态;display(非 form)流程全部完成时 END 状态同步 done */
21
+ /** 组装完整节点链:有数据统一追加 END 结束节点,无数据为空数组走空态;display(非 form)流程全部完成时 END 状态同步 done;末节点已是 end(后端快照自带 end、或调用方传入已组装过 END 的节点链,如 FlowLayout → FlowNodesPanel)时幂等跳过,防止结束节点重复渲染 */
22
22
  export declare function withEndNode(baseNodes: FlowNodeItem[], mode?: 'display' | 'form'): FlowNodeItem[];
23
23
  /** 折叠面板标题流程状态标签:仅 display 模式且有详情数据时推导——finished=1 且 status=-1 已拒绝(驳回到发起人终止)、finished=1 已同意、未结束进行中;form 发起模式无实例状态不展示,数据未返回前隐藏避免先展示「进行中」再跳变 */
24
24
  export declare function getFlowStatusTag(mode: 'display' | 'form' | undefined, data?: FlowTimelineData): FlowStatusTag | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yugu-ui/flow-ui",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "description": "堉古商城流程组件库:流程设计器(config)/ 审批时间线(timeline)/ 流程列表(FlowList)",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",
@@ -20,6 +20,10 @@
20
20
  },
21
21
  "./style.css": "./dist/style.css"
22
22
  },
23
+ "scripts": {
24
+ "build": "vite build --config vite.lib.config.ts",
25
+ "typecheck": "vue-tsc --noEmit --skipLibCheck"
26
+ },
23
27
  "peerDependencies": {
24
28
  "naive-ui": ">=2.40.0",
25
29
  "vue": ">=3.3.0"
@@ -50,9 +54,5 @@
50
54
  "publishConfig": {
51
55
  "access": "public",
52
56
  "registry": "https://registry.npmjs.org/"
53
- },
54
- "scripts": {
55
- "build": "vite build --config vite.lib.config.ts",
56
- "typecheck": "vue-tsc --noEmit --skipLibCheck"
57
57
  }
58
- }
58
+ }