@yugu-ui/flow-ui 0.1.21 → 0.1.23
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 +2 -1
- package/dist/index.js +51 -20
- package/dist/style.css +10 -10
- package/dist/timeline/timeline-mapping.d.ts +27 -3
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +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 } from './timeline/timeline-mapping';
|
|
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';
|
|
7
8
|
export { default as FlowNode } from './timeline/FlowNode';
|
|
8
9
|
export { default as FlowAvatar } from './timeline/FlowAvatar';
|
|
9
10
|
export { default as ApprovalModal } from './timeline/ApprovalModal';
|
package/dist/index.js
CHANGED
|
@@ -6016,6 +6016,42 @@ 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
|
+
}
|
|
6037
|
+
};
|
|
6038
|
+
/** 流程状态下拉选项(筛选表单直接用,value 对齐接口 status) */
|
|
6039
|
+
var FLOW_STATUS_OPTIONS = Object.entries(FLOW_STATUS_MAP).map(([value, info]) => ({
|
|
6040
|
+
label: info.label,
|
|
6041
|
+
value: Number(value)
|
|
6042
|
+
}));
|
|
6043
|
+
/**
|
|
6044
|
+
* 解析流程状态展示信息:
|
|
6045
|
+
* - status 明确为 -1/0/2 时直接取字典(已驳回/已撤销/已通过);
|
|
6046
|
+
* - status=1 或缺失时结合 finished 判断——已结束按已通过兜底,未结束=审批中;
|
|
6047
|
+
* - 无数据时默认审批中。
|
|
6048
|
+
*/
|
|
6049
|
+
function getFlowStatusInfo(data) {
|
|
6050
|
+
if (!data) return FLOW_STATUS_MAP[1];
|
|
6051
|
+
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];
|
|
6054
|
+
}
|
|
6019
6055
|
/** 固定尾节点:节点有数据时渲染追加(display 下状态按流程是否走完覆盖),接口返回与提交数据均不包含 */
|
|
6020
6056
|
var END_NODE = {
|
|
6021
6057
|
type: "end",
|
|
@@ -6113,26 +6149,13 @@ function withEndNode(baseNodes, mode) {
|
|
|
6113
6149
|
status: allDone ? "done" : "pending"
|
|
6114
6150
|
}];
|
|
6115
6151
|
}
|
|
6116
|
-
/** 折叠面板标题流程状态标签:仅 display
|
|
6152
|
+
/** 折叠面板标题流程状态标签:仅 display 模式且有详情数据时推导(判断口径见 getFlowStatusInfo);form 发起模式无实例状态不展示,数据未返回前隐藏避免先展示「审批中」再跳变 */
|
|
6117
6153
|
function getFlowStatusTag(mode, data) {
|
|
6118
6154
|
if (mode === "form" || !data) return void 0;
|
|
6119
|
-
|
|
6120
|
-
if (data.status === -1) return {
|
|
6121
|
-
text: "已驳回",
|
|
6122
|
-
type: "error"
|
|
6123
|
-
};
|
|
6124
|
-
if (data.status === 0) return {
|
|
6125
|
-
text: "已撤销",
|
|
6126
|
-
type: "default"
|
|
6127
|
-
};
|
|
6128
|
-
return {
|
|
6129
|
-
text: "已通过",
|
|
6130
|
-
type: "success"
|
|
6131
|
-
};
|
|
6132
|
-
}
|
|
6155
|
+
const info = getFlowStatusInfo(data);
|
|
6133
6156
|
return {
|
|
6134
|
-
text:
|
|
6135
|
-
type:
|
|
6157
|
+
text: info.label,
|
|
6158
|
+
type: info.type
|
|
6136
6159
|
};
|
|
6137
6160
|
}
|
|
6138
6161
|
//#endregion
|
|
@@ -6168,6 +6191,14 @@ var FlowNodesPanel_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/
|
|
|
6168
6191
|
if (props.mode === "form") return withEndNode(props.nodes ?? [], "form");
|
|
6169
6192
|
return withEndNode(props.data ? mapTimelineNodes(props.data) : props.nodes ?? [], "display");
|
|
6170
6193
|
});
|
|
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
|
+
};
|
|
6171
6202
|
/** 折叠面板标题流程状态标签 */
|
|
6172
6203
|
const panelStatusTag = computed(() => props.data ? getFlowStatusTag(props.mode, props.data) : props.statusTag);
|
|
6173
6204
|
return (_ctx, _cache) => {
|
|
@@ -6185,7 +6216,7 @@ var FlowNodesPanel_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/
|
|
|
6185
6216
|
default: withCtx(() => [createVNode(_component_NCollapseItem, { name: "flow" }, {
|
|
6186
6217
|
header: withCtx(() => [createElementVNode("span", _hoisted_1$3, [createTextVNode(toDisplayString(__props.title) + " ", 1), panelStatusTag.value ? (openBlock(), createBlock(_component_NTag, {
|
|
6187
6218
|
key: 0,
|
|
6188
|
-
type: panelStatusTag.value.type,
|
|
6219
|
+
type: N_TAG_TYPE_MAP[panelStatusTag.value.type],
|
|
6189
6220
|
size: "small"
|
|
6190
6221
|
}, {
|
|
6191
6222
|
default: withCtx(() => [createTextVNode(toDisplayString(panelStatusTag.value.text), 1)]),
|
|
@@ -6222,7 +6253,7 @@ var FlowNodesPanel_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/
|
|
|
6222
6253
|
});
|
|
6223
6254
|
};
|
|
6224
6255
|
}
|
|
6225
|
-
}), [["__scopeId", "data-v-
|
|
6256
|
+
}), [["__scopeId", "data-v-45c00590"]]);
|
|
6226
6257
|
//#endregion
|
|
6227
6258
|
//#region src/composables/form.ts
|
|
6228
6259
|
var invalidLiterals = [
|
|
@@ -6839,4 +6870,4 @@ var flow_list_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__
|
|
|
6839
6870
|
}
|
|
6840
6871
|
}), [["__scopeId", "data-v-56ed3cd3"]]);
|
|
6841
6872
|
//#endregion
|
|
6842
|
-
export { ApprovalModal_default as ApprovalModal, 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, getRemoteOptions, isRemoteField, useFlowUI };
|
|
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 };
|
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-
|
|
2265
|
+
.flow-node[data-v-45c00590] {
|
|
2266
2266
|
/* 单个折叠项:去掉默认上外边距,上下间距统一由 header 内边距控制 */
|
|
2267
2267
|
}
|
|
2268
|
-
.flow-node[data-v-
|
|
2268
|
+
.flow-node[data-v-45c00590] .n-collapse-item {
|
|
2269
2269
|
margin: 0;
|
|
2270
2270
|
}
|
|
2271
|
-
.flow-node[data-v-
|
|
2271
|
+
.flow-node[data-v-45c00590] {
|
|
2272
2272
|
/* 标题行:文字左对齐、箭头右对齐;左右留白放在 header-main 上,保证 header 底边框顶满两侧 */
|
|
2273
2273
|
}
|
|
2274
|
-
.flow-node[data-v-
|
|
2274
|
+
.flow-node[data-v-45c00590] .n-collapse-item__header-main {
|
|
2275
2275
|
justify-content: space-between;
|
|
2276
2276
|
padding: 0 16px;
|
|
2277
2277
|
}
|
|
2278
|
-
.flow-node[data-v-
|
|
2278
|
+
.flow-node[data-v-45c00590] {
|
|
2279
2279
|
/* 标题插槽包装:标题文案与状态标签横向排列、垂直居中;自身为 header-main 单一 flex 项,不参与 space-between 分离 */
|
|
2280
2280
|
}
|
|
2281
|
-
.flow-node .flow-node__title[data-v-
|
|
2281
|
+
.flow-node .flow-node__title[data-v-45c00590] {
|
|
2282
2282
|
display: inline-flex;
|
|
2283
2283
|
align-items: center;
|
|
2284
2284
|
gap: 8px;
|
|
2285
2285
|
}
|
|
2286
|
-
.flow-node[data-v-
|
|
2286
|
+
.flow-node[data-v-45c00590] {
|
|
2287
2287
|
/* 标题字号增大,上下等距内边距 + 底部分隔边框;用 first-child 提高优先级,覆盖 naive-ui 对首个折叠项 header 强制的 padding-top: 0 */
|
|
2288
2288
|
}
|
|
2289
|
-
.flow-node[data-v-
|
|
2289
|
+
.flow-node[data-v-45c00590] .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-
|
|
2294
|
+
.flow-node[data-v-45c00590] {
|
|
2295
2295
|
/* 内容区留白与标题行对齐 */
|
|
2296
2296
|
}
|
|
2297
|
-
.flow-node[data-v-
|
|
2297
|
+
.flow-node[data-v-45c00590] .n-collapse-item__content-wrapper {
|
|
2298
2298
|
padding: 0 16px 16px;
|
|
2299
2299
|
}
|
|
2300
2300
|
/* Developed collaboratively with vscode - 改动代码行数: 3行 */
|
|
@@ -4,11 +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
|
-
/**
|
|
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 */
|
|
8
15
|
export interface FlowStatusTag {
|
|
9
16
|
text: string;
|
|
10
|
-
type:
|
|
17
|
+
type: FlowStatusType;
|
|
11
18
|
}
|
|
19
|
+
/** 流程状态字典(单一来源,key=接口 status:-1 已驳回 / 0 已撤销 / 1 审批中 / 2 已通过) */
|
|
20
|
+
export declare const FLOW_STATUS_MAP: Record<number, FlowStatusInfo>;
|
|
21
|
+
/** 流程状态下拉选项(筛选表单直接用,value 对齐接口 status) */
|
|
22
|
+
export declare const FLOW_STATUS_OPTIONS: {
|
|
23
|
+
label: string;
|
|
24
|
+
value: number;
|
|
25
|
+
}[];
|
|
26
|
+
/**
|
|
27
|
+
* 解析流程状态展示信息:
|
|
28
|
+
* - status 明确为 -1/0/2 时直接取字典(已驳回/已撤销/已通过);
|
|
29
|
+
* - status=1 或缺失时结合 finished 判断——已结束按已通过兜底,未结束=审批中;
|
|
30
|
+
* - 无数据时默认审批中。
|
|
31
|
+
*/
|
|
32
|
+
export declare function getFlowStatusInfo(data?: {
|
|
33
|
+
status?: number;
|
|
34
|
+
finished?: number;
|
|
35
|
+
}): FlowStatusInfo;
|
|
12
36
|
/** 固定尾节点:节点有数据时渲染追加(display 下状态按流程是否走完覆盖),接口返回与提交数据均不包含 */
|
|
13
37
|
export declare const END_NODE: FlowNodeItem;
|
|
14
38
|
/** 人员处理记录映射:一行 records 对应一条展示记录(finished=0 未完成行过滤)——result 优先:result=2 同意;result=3 或 is_reject=1 驳回行按记录操作人判定方向(record.user_id=挂载人员 id 主动驳回「驳回到 rejecters.name」、否则被驳回「被 user_name 驳回」、名字均缺且 flowRejected=true 展示「驳回到 发起人」、否则「驳回」);result=0 不展示 */
|
|
@@ -22,5 +46,5 @@ export declare function isLatestRowsReject(rows: WflowTodoRecord[]): boolean;
|
|
|
22
46
|
export declare function mapTimelineNodes(data?: FlowTimelineData): FlowNodeItem[];
|
|
23
47
|
/** 组装完整节点链:有数据统一追加 END 结束节点,无数据为空数组走空态;display(非 form)流程全部完成时 END 状态同步 done;末节点已是 end(后端快照自带 end、或调用方传入已组装过 END 的节点链,如 FlowLayout → FlowNodesPanel)时幂等跳过,防止结束节点重复渲染 */
|
|
24
48
|
export declare function withEndNode(baseNodes: FlowNodeItem[], mode?: 'display' | 'form'): FlowNodeItem[];
|
|
25
|
-
/** 折叠面板标题流程状态标签:仅 display
|
|
49
|
+
/** 折叠面板标题流程状态标签:仅 display 模式且有详情数据时推导(判断口径见 getFlowStatusInfo);form 发起模式无实例状态不展示,数据未返回前隐藏避免先展示「审批中」再跳变 */
|
|
26
50
|
export declare function getFlowStatusTag(mode: 'display' | 'form' | undefined, data?: FlowTimelineData): FlowStatusTag | undefined;
|