@yugu-ui/flow-ui 0.1.23 → 0.1.24

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
@@ -3,8 +3,8 @@ export { default as FlowConfigField } from './config/FlowConfigField';
3
3
  export { default as FlowConfigMore } from './config/FlowConfigMore';
4
4
  export { default as FlowNodesPanel } from './timeline/FlowNodesPanel';
5
5
  export { default as FlowActions } from './timeline/FlowActions';
6
- export type { FlowTimelineData, FlowStatusTag, FlowApprovalData, FlowStatusInfo, FlowStatusType } from './timeline/timeline-mapping';
7
- export { FLOW_STATUS_MAP, FLOW_STATUS_OPTIONS, getFlowStatusInfo } from './timeline/timeline-mapping';
6
+ export type { FlowTimelineData, FlowStatusTag, FlowApprovalData } from './timeline/timeline-mapping';
7
+ export { FlowStatus, FLOW_STATUS_LABEL, FLOW_STATUS_OPTIONS, resolveFlowStatus } from './timeline/timeline-mapping';
8
8
  export { default as FlowNode } from './timeline/FlowNode';
9
9
  export { default as FlowAvatar } from './timeline/FlowAvatar';
10
10
  export { default as ApprovalModal } from './timeline/ApprovalModal';
package/dist/index.js CHANGED
@@ -6016,42 +6016,45 @@ function formatTime(value, format = "YYYY-MM-DD HH:mm:ss") {
6016
6016
  }
6017
6017
  //#endregion
6018
6018
  //#region src/timeline/timeline-mapping.ts
6019
- /** 流程状态字典(单一来源,key=接口 status:-1 已驳回 / 0 已撤销 / 1 审批中 / 2 已通过) */
6020
- var FLOW_STATUS_MAP = {
6021
- [-1]: {
6022
- label: "已驳回",
6023
- type: "rejected"
6024
- },
6025
- 0: {
6026
- label: "已撤销",
6027
- type: "cancelled"
6028
- },
6029
- 1: {
6030
- label: "审批中",
6031
- type: "processing"
6032
- },
6033
- 2: {
6034
- label: "已通过",
6035
- type: "success"
6036
- }
6019
+ /** 流程状态枚举(接口 status:-1 已驳回 / 0 已撤销 / 1 审批中 / 2 已通过) */
6020
+ var FlowStatus = /* @__PURE__ */ function(FlowStatus) {
6021
+ FlowStatus[FlowStatus["Rejected"] = -1] = "Rejected";
6022
+ FlowStatus[FlowStatus["Cancelled"] = 0] = "Cancelled";
6023
+ FlowStatus[FlowStatus["Processing"] = 1] = "Processing";
6024
+ FlowStatus[FlowStatus["Approved"] = 2] = "Approved";
6025
+ return FlowStatus;
6026
+ }({});
6027
+ /** 流程状态文案字典(项目侧渲染文案统一取此,标签样式由项目自行决定) */
6028
+ var FLOW_STATUS_LABEL = {
6029
+ [FlowStatus.Rejected]: "已驳回",
6030
+ [FlowStatus.Cancelled]: "已撤销",
6031
+ [FlowStatus.Processing]: "审批中",
6032
+ [FlowStatus.Approved]: "已通过"
6037
6033
  };
6038
6034
  /** 流程状态下拉选项(筛选表单直接用,value 对齐接口 status) */
6039
- var FLOW_STATUS_OPTIONS = Object.entries(FLOW_STATUS_MAP).map(([value, info]) => ({
6040
- label: info.label,
6041
- value: Number(value)
6035
+ var FLOW_STATUS_OPTIONS = Object.keys(FLOW_STATUS_LABEL).map((key) => ({
6036
+ label: FLOW_STATUS_LABEL[Number(key)],
6037
+ value: Number(key)
6042
6038
  }));
6043
6039
  /**
6044
- * 解析流程状态展示信息:
6045
- * - status 明确为 -1/0/2 时直接取字典(已驳回/已撤销/已通过);
6046
- * - status=1 或缺失时结合 finished 判断——已结束按已通过兜底,未结束=审批中;
6040
+ * 解析流程状态枚举(status 与 finished 联合判断):
6041
+ * - status 明确为 -1/0/2 时直接返回(已驳回/已撤销/已通过);
6042
+ * - status=1 或缺失时结合 finished——已结束按已通过兜底,未结束=审批中;
6047
6043
  * - 无数据时默认审批中。
6048
6044
  */
6049
- function getFlowStatusInfo(data) {
6050
- if (!data) return FLOW_STATUS_MAP[1];
6045
+ function resolveFlowStatus(data) {
6046
+ if (!data) return FlowStatus.Processing;
6051
6047
  const status = Number(data.status);
6052
- if (status === -1 || status === 0 || status === 2) return FLOW_STATUS_MAP[status];
6053
- return data.finished === 1 ? FLOW_STATUS_MAP[2] : FLOW_STATUS_MAP[1];
6048
+ if (status === FlowStatus.Rejected || status === FlowStatus.Cancelled || status === FlowStatus.Approved) return status;
6049
+ return data.finished === 1 ? FlowStatus.Approved : FlowStatus.Processing;
6054
6050
  }
6051
+ /** 状态枚举 → NTag 配色(仅 FlowNodesPanel 内部使用) */
6052
+ var FLOW_STATUS_N_TAG_TYPE = {
6053
+ [FlowStatus.Rejected]: "error",
6054
+ [FlowStatus.Cancelled]: "default",
6055
+ [FlowStatus.Processing]: "warning",
6056
+ [FlowStatus.Approved]: "success"
6057
+ };
6055
6058
  /** 固定尾节点:节点有数据时渲染追加(display 下状态按流程是否走完覆盖),接口返回与提交数据均不包含 */
6056
6059
  var END_NODE = {
6057
6060
  type: "end",
@@ -6152,10 +6155,10 @@ function withEndNode(baseNodes, mode) {
6152
6155
  /** 折叠面板标题流程状态标签:仅 display 模式且有详情数据时推导(判断口径见 getFlowStatusInfo);form 发起模式无实例状态不展示,数据未返回前隐藏避免先展示「审批中」再跳变 */
6153
6156
  function getFlowStatusTag(mode, data) {
6154
6157
  if (mode === "form" || !data) return void 0;
6155
- const info = getFlowStatusInfo(data);
6158
+ const status = resolveFlowStatus(data);
6156
6159
  return {
6157
- text: info.label,
6158
- type: info.type
6160
+ text: FLOW_STATUS_LABEL[status],
6161
+ type: FLOW_STATUS_N_TAG_TYPE[status]
6159
6162
  };
6160
6163
  }
6161
6164
  //#endregion
@@ -6191,14 +6194,6 @@ var FlowNodesPanel_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/
6191
6194
  if (props.mode === "form") return withEndNode(props.nodes ?? [], "form");
6192
6195
  return withEndNode(props.data ? mapTimelineNodes(props.data) : props.nodes ?? [], "display");
6193
6196
  });
6194
- /** 语义状态 → NTag 配色(仅组件内部渲染适配,业务侧统一用 StatusTag 等宿主状态标签组件) */
6195
- const N_TAG_TYPE_MAP = {
6196
- pending: "warning",
6197
- processing: "info",
6198
- success: "success",
6199
- cancelled: "default",
6200
- rejected: "error"
6201
- };
6202
6197
  /** 折叠面板标题流程状态标签 */
6203
6198
  const panelStatusTag = computed(() => props.data ? getFlowStatusTag(props.mode, props.data) : props.statusTag);
6204
6199
  return (_ctx, _cache) => {
@@ -6216,7 +6211,7 @@ var FlowNodesPanel_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/
6216
6211
  default: withCtx(() => [createVNode(_component_NCollapseItem, { name: "flow" }, {
6217
6212
  header: withCtx(() => [createElementVNode("span", _hoisted_1$3, [createTextVNode(toDisplayString(__props.title) + " ", 1), panelStatusTag.value ? (openBlock(), createBlock(_component_NTag, {
6218
6213
  key: 0,
6219
- type: N_TAG_TYPE_MAP[panelStatusTag.value.type],
6214
+ type: panelStatusTag.value.type,
6220
6215
  size: "small"
6221
6216
  }, {
6222
6217
  default: withCtx(() => [createTextVNode(toDisplayString(panelStatusTag.value.text), 1)]),
@@ -6253,7 +6248,7 @@ var FlowNodesPanel_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/
6253
6248
  });
6254
6249
  };
6255
6250
  }
6256
- }), [["__scopeId", "data-v-45c00590"]]);
6251
+ }), [["__scopeId", "data-v-25e5146e"]]);
6257
6252
  //#endregion
6258
6253
  //#region src/composables/form.ts
6259
6254
  var invalidLiterals = [
@@ -6870,4 +6865,4 @@ var flow_list_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__
6870
6865
  }
6871
6866
  }), [["__scopeId", "data-v-56ed3cd3"]]);
6872
6867
  //#endregion
6873
- export { ApprovalModal_default as ApprovalModal, FLOW_STATUS_MAP, FLOW_STATUS_OPTIONS, FLOW_UI_KEY, FlowActions_default as FlowActions, FlowAvatar_default as FlowAvatar, FlowConfig_default as FlowConfig, FlowConfigField_default as FlowConfigField, FlowConfigMore_default as FlowConfigMore, flow_list_default as FlowList, FlowNode_default as FlowNode, FlowNodesPanel_default as FlowNodesPanel, person_selector_default as PersonSelector, createFlowUI, fetchGetWflowConfigDetail, fetchGetWflowFlowNodes, fetchLaunchWflowFlow, fetchWflowUndoApprove, fetchWflowUndoReject, getFlowStatusInfo, getRemoteOptions, isRemoteField, useFlowUI };
6868
+ export { ApprovalModal_default as ApprovalModal, FLOW_STATUS_LABEL, FLOW_STATUS_OPTIONS, FLOW_UI_KEY, FlowActions_default as FlowActions, FlowAvatar_default as FlowAvatar, FlowConfig_default as FlowConfig, FlowConfigField_default as FlowConfigField, FlowConfigMore_default as FlowConfigMore, flow_list_default as FlowList, FlowNode_default as FlowNode, FlowNodesPanel_default as FlowNodesPanel, FlowStatus, person_selector_default as PersonSelector, createFlowUI, fetchGetWflowConfigDetail, fetchGetWflowFlowNodes, fetchLaunchWflowFlow, fetchWflowUndoApprove, fetchWflowUndoReject, getRemoteOptions, isRemoteField, resolveFlowStatus, useFlowUI };
package/dist/style.css CHANGED
@@ -2262,39 +2262,39 @@ to {
2262
2262
  }
2263
2263
 
2264
2264
  /* Developed collaboratively with vscode - 改动代码行数: 31行(折叠面板样式自 FlowLayout.vue 迁入:单个折叠项间距/标题行布局/标题字号与底边框/内容区留白) */
2265
- .flow-node[data-v-45c00590] {
2265
+ .flow-node[data-v-25e5146e] {
2266
2266
  /* 单个折叠项:去掉默认上外边距,上下间距统一由 header 内边距控制 */
2267
2267
  }
2268
- .flow-node[data-v-45c00590] .n-collapse-item {
2268
+ .flow-node[data-v-25e5146e] .n-collapse-item {
2269
2269
  margin: 0;
2270
2270
  }
2271
- .flow-node[data-v-45c00590] {
2271
+ .flow-node[data-v-25e5146e] {
2272
2272
  /* 标题行:文字左对齐、箭头右对齐;左右留白放在 header-main 上,保证 header 底边框顶满两侧 */
2273
2273
  }
2274
- .flow-node[data-v-45c00590] .n-collapse-item__header-main {
2274
+ .flow-node[data-v-25e5146e] .n-collapse-item__header-main {
2275
2275
  justify-content: space-between;
2276
2276
  padding: 0 16px;
2277
2277
  }
2278
- .flow-node[data-v-45c00590] {
2278
+ .flow-node[data-v-25e5146e] {
2279
2279
  /* 标题插槽包装:标题文案与状态标签横向排列、垂直居中;自身为 header-main 单一 flex 项,不参与 space-between 分离 */
2280
2280
  }
2281
- .flow-node .flow-node__title[data-v-45c00590] {
2281
+ .flow-node .flow-node__title[data-v-25e5146e] {
2282
2282
  display: inline-flex;
2283
2283
  align-items: center;
2284
2284
  gap: 8px;
2285
2285
  }
2286
- .flow-node[data-v-45c00590] {
2286
+ .flow-node[data-v-25e5146e] {
2287
2287
  /* 标题字号增大,上下等距内边距 + 底部分隔边框;用 first-child 提高优先级,覆盖 naive-ui 对首个折叠项 header 强制的 padding-top: 0 */
2288
2288
  }
2289
- .flow-node[data-v-45c00590] .n-collapse-item:first-child > .n-collapse-item__header {
2289
+ .flow-node[data-v-25e5146e] .n-collapse-item:first-child > .n-collapse-item__header {
2290
2290
  padding: 16px 0;
2291
2291
  font-size: 16px;
2292
2292
  border-bottom: 1px solid var(--n-divider-color, rgba(0, 0, 0, 0.09));
2293
2293
  }
2294
- .flow-node[data-v-45c00590] {
2294
+ .flow-node[data-v-25e5146e] {
2295
2295
  /* 内容区留白与标题行对齐 */
2296
2296
  }
2297
- .flow-node[data-v-45c00590] .n-collapse-item__content-wrapper {
2297
+ .flow-node[data-v-25e5146e] .n-collapse-item__content-wrapper {
2298
2298
  padding: 0 16px 16px;
2299
2299
  }
2300
2300
  /* Developed collaboratively with vscode - 改动代码行数: 3行 */
@@ -4,35 +4,35 @@ import { WflowTodoDetail, WflowTodoRecord } from '../adapter/wflow';
4
4
  export type FlowTimelineData = Pick<WflowTodoDetail, 'nodes' | 'finished' | 'status'>;
5
5
  /** FlowActions 审批操作数据:FlowTimelineData 基础上补充 undo_id(同意/驳回接口入参)与 undo_finished(操作按钮显隐)——待办详情接口整份数据可直接传入 */
6
6
  export type FlowApprovalData = FlowTimelineData & Pick<WflowTodoDetail, 'undo_id' | 'undo_finished'>;
7
- /** 流程状态语义类型(对齐全系统 UI「列表枚举值标签样式规范」的 5 类语义:待处理/进行中/成功/取消/拒绝) */
8
- export type FlowStatusType = 'pending' | 'processing' | 'success' | 'cancelled' | 'rejected';
9
- /** 流程状态展示信息:文案 + 语义类型(宿主状态标签组件按语义类型统一配色) */
10
- export interface FlowStatusInfo {
11
- label: string;
12
- type: FlowStatusType;
13
- }
14
- /** 流程状态标签(getFlowStatusTag 返回):颜色由语义类型决定,审批中=processing / 已通过=success / 已驳回=rejected / 已撤销=cancelled */
15
- export interface FlowStatusTag {
16
- text: string;
17
- type: FlowStatusType;
7
+ /** 流程状态枚举(接口 status:-1 已驳回 / 0 已撤销 / 1 审批中 / 2 已通过) */
8
+ export declare enum FlowStatus {
9
+ Rejected = -1,
10
+ Cancelled = 0,
11
+ Processing = 1,
12
+ Approved = 2
18
13
  }
19
- /** 流程状态字典(单一来源,key=接口 status:-1 已驳回 / 0 已撤销 / 1 审批中 / 2 已通过) */
20
- export declare const FLOW_STATUS_MAP: Record<number, FlowStatusInfo>;
14
+ /** 流程状态文案字典(项目侧渲染文案统一取此,标签样式由项目自行决定) */
15
+ export declare const FLOW_STATUS_LABEL: Record<FlowStatus, string>;
21
16
  /** 流程状态下拉选项(筛选表单直接用,value 对齐接口 status) */
22
17
  export declare const FLOW_STATUS_OPTIONS: {
23
18
  label: string;
24
19
  value: number;
25
20
  }[];
26
21
  /**
27
- * 解析流程状态展示信息:
28
- * - status 明确为 -1/0/2 时直接取字典(已驳回/已撤销/已通过);
29
- * - status=1 或缺失时结合 finished 判断——已结束按已通过兜底,未结束=审批中;
22
+ * 解析流程状态枚举(status 与 finished 联合判断):
23
+ * - status 明确为 -1/0/2 时直接返回(已驳回/已撤销/已通过);
24
+ * - status=1 或缺失时结合 finished——已结束按已通过兜底,未结束=审批中;
30
25
  * - 无数据时默认审批中。
31
26
  */
32
- export declare function getFlowStatusInfo(data?: {
27
+ export declare function resolveFlowStatus(data?: {
33
28
  status?: number;
34
29
  finished?: number;
35
- }): FlowStatusInfo;
30
+ }): FlowStatus;
31
+ /** 节点面板标题状态标签(组件内部渲染用):仅文案 + NTag 配色,非业务状态枚举 */
32
+ export interface FlowStatusTag {
33
+ text: string;
34
+ type: 'success' | 'error' | 'warning' | 'default';
35
+ }
36
36
  /** 固定尾节点:节点有数据时渲染追加(display 下状态按流程是否走完覆盖),接口返回与提交数据均不包含 */
37
37
  export declare const END_NODE: FlowNodeItem;
38
38
  /** 人员处理记录映射:一行 records 对应一条展示记录(finished=0 未完成行过滤)——result 优先:result=2 同意;result=3 或 is_reject=1 驳回行按记录操作人判定方向(record.user_id=挂载人员 id 主动驳回「驳回到 rejecters.name」、否则被驳回「被 user_name 驳回」、名字均缺且 flowRejected=true 展示「驳回到 发起人」、否则「驳回」);result=0 不展示 */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yugu-ui/flow-ui",
3
- "version": "0.1.23",
3
+ "version": "0.1.24",
4
4
  "description": "堉古商城流程组件库:流程设计器(config)/ 审批时间线(timeline)/ 流程列表(FlowList)",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",