@yugu-ui/flow-ui 0.0.0-stage → 0.1.0

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.
Files changed (50) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +343 -2
  3. package/dist/adapter/wflow.d.ts +260 -0
  4. package/dist/base-ui/base-card-item.d.ts +26 -0
  5. package/dist/base-ui/base-card.d.ts +60 -0
  6. package/dist/base-ui/base-drawer.d.ts +56 -0
  7. package/dist/base-ui/base-modal.d.ts +43 -0
  8. package/dist/base-ui/yg-confirm.d.ts +79 -0
  9. package/dist/composables/form.d.ts +19 -0
  10. package/dist/config/FlowConfig.d.ts +34 -0
  11. package/dist/config/FlowConfigField.d.ts +12 -0
  12. package/dist/config/FlowConfigFlow/components/FlowIcon.d.ts +11 -0
  13. package/dist/config/FlowConfigFlow/components/FlowNodeCard.d.ts +7 -0
  14. package/dist/config/FlowConfigFlow/components/NodeConfigDrawer/index.d.ts +19 -0
  15. package/dist/config/FlowConfigFlow/components/NodeConfigDrawer/modules/ApproverConfig.d.ts +7 -0
  16. package/dist/config/FlowConfigFlow/components/NodeConfigDrawer/modules/CcConfig.d.ts +6 -0
  17. package/dist/config/FlowConfigFlow/components/NodeConfigDrawer/modules/ConditionConfig.d.ts +8 -0
  18. package/dist/config/FlowConfigFlow/components/NodeConfigDrawer/modules/StartConfig.d.ts +7 -0
  19. package/dist/config/FlowConfigFlow/composables/useNodeDrawer.d.ts +9 -0
  20. package/dist/config/FlowConfigFlow/index.d.ts +18 -0
  21. package/dist/config/FlowConfigMore.d.ts +12 -0
  22. package/dist/config/useFcCssVars.d.ts +2 -0
  23. package/dist/file-preview/file-preview-modal.d.ts +24 -0
  24. package/dist/file-preview/index.d.ts +21 -0
  25. package/dist/flow-list/index.d.ts +21 -0
  26. package/dist/flow-list/modules/FlowListGroup.d.ts +21 -0
  27. package/dist/flow-list/modules/FlowListItem.d.ts +21 -0
  28. package/dist/flow-list/types/index.d.ts +20 -0
  29. package/dist/index.d.ts +18 -0
  30. package/dist/index.js +6913 -0
  31. package/dist/person-selector/api/index.d.ts +4 -0
  32. package/dist/person-selector/composables/useOverflowTags.d.ts +13 -0
  33. package/dist/person-selector/composables/usePersonData.d.ts +40 -0
  34. package/dist/person-selector/composables/useSelection.d.ts +42 -0
  35. package/dist/person-selector/constants/index.d.ts +5 -0
  36. package/dist/person-selector/index.d.ts +21 -0
  37. package/dist/person-selector/types/index.d.ts +35 -0
  38. package/dist/person-selector/utils/index.d.ts +5 -0
  39. package/dist/provider/index.d.ts +25 -0
  40. package/dist/provider/key.d.ts +4 -0
  41. package/dist/provider/types.d.ts +68 -0
  42. package/dist/style.css +2430 -0
  43. package/dist/timeline/ApprovalModal.d.ts +47 -0
  44. package/dist/timeline/FlowAvatar.d.ts +11 -0
  45. package/dist/timeline/FlowLayout.d.ts +42 -0
  46. package/dist/timeline/FlowNode.d.ts +103 -0
  47. package/dist/timeline/flowUserKey.d.ts +18 -0
  48. package/dist/timeline/types.d.ts +9 -0
  49. package/dist/utils/common.d.ts +4 -0
  50. package/package.json +54 -3
@@ -0,0 +1,47 @@
1
+ import { UploadResource } from './types';
2
+ import { FlowNodeItem } from './FlowNode';
3
+ type __VLS_Props = {
4
+ /** 审批类型:approve=同意 / reject=驳回(决定弹窗标题) */
5
+ type?: 'approve' | 'reject';
6
+ /** 流程节点数据(驳回时用于选择驳回目标) */
7
+ nodes?: FlowNodeItem[];
8
+ };
9
+ type __VLS_ModelProps = {
10
+ 'visible'?: boolean;
11
+ };
12
+ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
13
+ declare const __VLS_export: import('vue').DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
14
+ "update:visible": (value: boolean) => any;
15
+ } & {
16
+ submitted: (value: {
17
+ opinion: string;
18
+ attachments: UploadResource[];
19
+ /** 驳回目标节点名称(仅驳回时存在) */
20
+ rejectNode?: string;
21
+ /** 驳回目标人员名称(仅驳回时存在) */
22
+ rejectUser?: string;
23
+ /** 驳回目标节点 ID(驳回接口 reject_node_id) */
24
+ rejectNodeId?: string;
25
+ /** 驳回目标人员 ID(驳回接口 reject_user_id,仅审批人节点携带) */
26
+ rejectUserId?: string;
27
+ }, done: (shouldClose?: boolean) => void) => any;
28
+ }, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
29
+ "onUpdate:visible"?: ((value: boolean) => any) | undefined;
30
+ onSubmitted?: ((value: {
31
+ opinion: string;
32
+ attachments: UploadResource[];
33
+ /** 驳回目标节点名称(仅驳回时存在) */
34
+ rejectNode?: string;
35
+ /** 驳回目标人员名称(仅驳回时存在) */
36
+ rejectUser?: string;
37
+ /** 驳回目标节点 ID(驳回接口 reject_node_id) */
38
+ rejectNodeId?: string;
39
+ /** 驳回目标人员 ID(驳回接口 reject_user_id,仅审批人节点携带) */
40
+ rejectUserId?: string;
41
+ }, done: (shouldClose?: boolean) => void) => any) | undefined;
42
+ }>, {
43
+ type: "approve" | "reject";
44
+ nodes: FlowNodeItem[];
45
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
46
+ declare const _default: typeof __VLS_export;
47
+ export default _default;
@@ -0,0 +1,11 @@
1
+ type __VLS_Props = {
2
+ /** 姓名(占位头像取首字并生成背景色) */
3
+ name: string;
4
+ /** 头像地址(为空时用姓名首字占位) */
5
+ avatar?: string;
6
+ };
7
+ declare const __VLS_export: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
8
+ avatar: string;
9
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
10
+ declare const _default: typeof __VLS_export;
11
+ export default _default;
@@ -0,0 +1,42 @@
1
+ import { WflowTodoDetail } from '../adapter/wflow';
2
+ /** 页面加载状态(透传给 BaseCard,控制内容区 loading 遮罩);flowId=流程 ID(display 模式传流程实例 ID 仅作标识,同意/驳回接口入参为详情返回的 undo_id;form 模式作为提交数据 flow_id) */
3
+ type __VLS_Props = {
4
+ loading?: boolean;
5
+ flowId?: string | number;
6
+ /** 渲染模式:display=审批详情(同意/驳回);form=发起流程(节点无状态、自选审批人为选择器、底部提交) */
7
+ mode?: 'display' | 'form';
8
+ /** form 模式提交前置校验钩子:返回 false 阻止提交(页面注入表单必填校验) */
9
+ beforeSubmit?: () => Promise<boolean> | boolean;
10
+ /** form 模式提交数据获取钩子:校验全部通过后调用,返回页面表单数据用于组装并打印提交数据 */
11
+ getFormData?: () => Record<string, unknown>;
12
+ /** display 模式原始数据:流程实例详情(节点快照自带任务状态与每人处理结果 + status/finished 实例状态 + undo_id 待办审批记录 ID + undo_finished 处理状态),组件内部映射为审批时间线并对接同意/驳回接口,页面无需转换;nodes 为空时节点区展示空态提示 */
13
+ timelineData?: Pick<WflowTodoDetail, 'nodes' | 'finished' | 'status' | 'undo_id' | 'undo_finished'>;
14
+ };
15
+ /** 条件字段是否全部填写完成:条件字段值取自父组件表单数据(数组非空 / 非 null / 非空串;流程无条件字段时视为填齐),暴露给父组件提交校验调用 */
16
+ declare function isConditionsFilled(): boolean;
17
+ /** 请求流程节点(暴露给父组件在表单变化防抖后调用):先等待流程配置就绪(条件字段提取完成)再校验条件字段填齐,随后携带整份表单数据 + 流程 ID 请求,后端按表单值匹配条件分支;条件字段未填齐/请求失败/返回为空时节点链保持不变(节点区空态提示) */
18
+ declare function fetchFlowNodes(): Promise<void>;
19
+ declare var __VLS_10: {};
20
+ type __VLS_Slots = {} & {
21
+ default?: (props: typeof __VLS_10) => any;
22
+ };
23
+ declare const __VLS_base: import('vue').DefineComponent<__VLS_Props, {
24
+ fetchFlowNodes: typeof fetchFlowNodes;
25
+ isConditionsFilled: typeof isConditionsFilled;
26
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
27
+ success: () => any;
28
+ close: () => any;
29
+ submitted: () => any;
30
+ }, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
31
+ onSuccess?: (() => any) | undefined;
32
+ onClose?: (() => any) | undefined;
33
+ onSubmitted?: (() => any) | undefined;
34
+ }>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
35
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
36
+ declare const _default: typeof __VLS_export;
37
+ export default _default;
38
+ type __VLS_WithSlots<T, S> = T & {
39
+ new (): {
40
+ $slots: S;
41
+ };
42
+ };
@@ -0,0 +1,103 @@
1
+ import { SelectedItem } from '../person-selector/types';
2
+ /** 流程节点类型 */
3
+ export type FlowNodeType = 'start' | 'approver' | 'cc' | 'end';
4
+ /** 节点状态 */
5
+ export type FlowNodeStatus = 'done' | 'doing' | 'rejected' | 'pending';
6
+ /** 审批方式(审批人节点) */
7
+ export type FlowApproveMode = 'countersign' | 'orsign' | 'sequence';
8
+ /** 审批附件 */
9
+ export interface FlowNodeAttachment {
10
+ /** 文件名 */
11
+ name: string;
12
+ /** 文件地址 */
13
+ url?: string;
14
+ }
15
+ /** 人员操作记录(display 审批详情:同一人员可有多条,含审批成功与驳回) */
16
+ export interface FlowNodeUserRecord {
17
+ /** 记录类型:approve=审批成功 / reject=驳回 */
18
+ type: 'approve' | 'reject';
19
+ /** 操作时间(成功=审批时间 / 驳回=驳回时间) */
20
+ time?: string;
21
+ /** 驳回目标人员名(本人主动驳回记录,来自 rejecters,展示「驳回到 xxx」) */
22
+ rejectNode?: string;
23
+ /** 驳回人名(被驳回记录,来自记录操作人 user_name,展示「被 xxx 驳回」) */
24
+ rejectBy?: string;
25
+ /** 审批意见 */
26
+ opinion?: string;
27
+ /** 附件列表 */
28
+ attachments?: FlowNodeAttachment[];
29
+ }
30
+ /** 流程节点人员 */
31
+ export interface FlowNodeUser {
32
+ /** 人员主键(form 发起模式接口注入带 id,display 审批详情 mock 不带) */
33
+ id?: number | string;
34
+ /** 姓名 */
35
+ name: string;
36
+ /** 头像(为空时用姓名首字生成占位头像) */
37
+ avatar?: string;
38
+ /** 人员审批状态(未标注则不做状态区分) */
39
+ status?: FlowNodeStatus;
40
+ /** 存在未处理任务行(当前轮次待办未完成,不能作为驳回目标) */
41
+ pendingTask?: boolean;
42
+ /** 操作记录列表(多条,有记录才可点击查看弹层) */
43
+ records?: FlowNodeUserRecord[];
44
+ }
45
+ /** 流程节点(时间线数据项) */
46
+ export interface FlowNodeItem {
47
+ /** 节点 ID(display 详情模式来自节点快照,审批驳回接口 reject_node_id 取值) */
48
+ id?: string;
49
+ /** 节点类型 */
50
+ type: FlowNodeType;
51
+ /** 节点状态 */
52
+ status?: FlowNodeStatus;
53
+ /** 节点名称 */
54
+ name: string;
55
+ /** 节点描述(审批人节点可省略,由 mode 生成标准文案) */
56
+ desc?: string;
57
+ /** 审批方式(仅审批人节点) */
58
+ mode?: FlowApproveMode;
59
+ /** 自选审批人标记(表单模式下人员区域渲染为人员选择器) */
60
+ selfSelect?: boolean;
61
+ /** 节点人员列表 */
62
+ users: FlowNodeUser[];
63
+ /** 发生时间(未发生为空) */
64
+ time?: string;
65
+ }
66
+ declare const _default: typeof __VLS_export;
67
+ export default _default;
68
+ declare const __VLS_export: import('vue').DefineComponent<{
69
+ /** 节点数据 */
70
+ node: FlowNodeItem;
71
+ /** 模式:display=展示 / select=可选择 / form=表单 */
72
+ mode?: "display" | "select" | "form";
73
+ /** 当前选中项(节点ID::人员ID),仅 select 模式 */
74
+ selectedKey?: string | null;
75
+ /** 人员折叠阈值:超出该人数时默认折叠展示,尾部显示展开/收起按钮 */
76
+ collapseCount?: number;
77
+ } & {
78
+ /** 表单模式自选审批人:已选人员(v-model:selectedUsers 双向绑定供父组件获取,未绑定时组件内自持) */
79
+ selectedUsers?: SelectedItem[];
80
+ }, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
81
+ "update:selectedUsers": (value: SelectedItem[]) => any;
82
+ } & {
83
+ select: (key: string) => any;
84
+ }, string, import('vue').PublicProps, Readonly<{
85
+ /** 节点数据 */
86
+ node: FlowNodeItem;
87
+ /** 模式:display=展示 / select=可选择 / form=表单 */
88
+ mode?: "display" | "select" | "form";
89
+ /** 当前选中项(节点ID::人员ID),仅 select 模式 */
90
+ selectedKey?: string | null;
91
+ /** 人员折叠阈值:超出该人数时默认折叠展示,尾部显示展开/收起按钮 */
92
+ collapseCount?: number;
93
+ } & {
94
+ /** 表单模式自选审批人:已选人员(v-model:selectedUsers 双向绑定供父组件获取,未绑定时组件内自持) */
95
+ selectedUsers?: SelectedItem[];
96
+ }> & Readonly<{
97
+ onSelect?: ((key: string) => any) | undefined;
98
+ "onUpdate:selectedUsers"?: ((value: SelectedItem[]) => any) | undefined;
99
+ }>, {
100
+ mode: "display" | "select" | "form";
101
+ selectedKey: string | null;
102
+ collapseCount: number;
103
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * 时间线人员选项唯一 key 共享模块
3
+ *
4
+ * 契约:`${节点ID ?? 节点名称}::${人员ID ?? 人员名称}`
5
+ * 拼接侧(FlowNode select 模式上抛选中项)与解析侧(ApprovalModal 驳回目标反查)共用。
6
+ */
7
+ /** 节点/人员的最小结构(仅 id 与 name,FlowNodeItem / FlowNodeUser 天然兼容) */
8
+ interface KeySource {
9
+ /** 主键(缺省回落名称) */
10
+ id?: number | string;
11
+ /** 名称 */
12
+ name: string;
13
+ }
14
+ /** 拼接人员选项 key:节点ID::人员ID(缺省回落名称) */
15
+ export declare function getUserKey(node: KeySource, user: KeySource): string;
16
+ /** 解析人员选项 key:返回 [节点 key, 人员 key] */
17
+ export declare function parseUserKey(key: string): [string, string];
18
+ export {};
@@ -0,0 +1,9 @@
1
+ /** 附件资源(流程审批附件列表项,与宿主文件上传组件导出的同名接口契约一致) */
2
+ export interface UploadResource {
3
+ id: number | string;
4
+ file_name: string;
5
+ original_filename: string;
6
+ url: string;
7
+ size: number;
8
+ content_type: string;
9
+ }
@@ -0,0 +1,4 @@
1
+ /** 判断是否为空(undefined/null/空字符串) */
2
+ export declare function isNull(value: any): boolean;
3
+ /** 时间格式化:兼容 10/13 位时间戳、字符串与 Date,空值返回 '--' */
4
+ export declare function formatTime(value: any, format?: string): string;
package/package.json CHANGED
@@ -1,6 +1,57 @@
1
1
  {
2
2
  "name": "@yugu-ui/flow-ui",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.1.0",
4
+ "description": "堉古商城流程组件库:流程设计器(config)/ 审批时间线(timeline)/ 流程列表(FlowList)",
5
+ "type": "module",
6
+ "license": "UNLICENSED",
7
+ "sideEffects": [
8
+ "**/*.css"
9
+ ],
10
+ "files": [
11
+ "dist"
12
+ ],
13
+ "main": "./dist/index.js",
14
+ "module": "./dist/index.js",
15
+ "types": "./dist/index.d.ts",
16
+ "exports": {
17
+ ".": {
18
+ "types": "./dist/index.d.ts",
19
+ "import": "./dist/index.js"
20
+ },
21
+ "./style.css": "./dist/style.css"
22
+ },
23
+ "peerDependencies": {
24
+ "@antv/x6": ">=3.1.0",
25
+ "@antv/x6-vue-shape": ">=3.0.0",
26
+ "naive-ui": ">=2.40.0",
27
+ "vue": ">=3.3.0"
28
+ },
29
+ "dependencies": {
30
+ "dayjs": "1.11.20"
31
+ },
32
+ "devDependencies": {
33
+ "@antv/x6": "^3.1.8",
34
+ "@antv/x6-vue-shape": "^3.0.2",
35
+ "@vitejs/plugin-vue": "6.0.6",
36
+ "naive-ui": "2.44.1",
37
+ "typescript": "6.0.3",
38
+ "unocss": "^66.6.8",
39
+ "unplugin-dts": "^1.1.2",
40
+ "unplugin-vue-components": "32.0.0",
41
+ "vite": "8.0.12",
42
+ "vue": "3.5.34",
43
+ "vue-tsc": "3.2.8",
44
+ "@sa/uno-preset": "2.2.0"
45
+ },
46
+ "engines": {
47
+ "node": ">=20.19.0"
48
+ },
49
+ "publishConfig": {
50
+ "access": "public",
51
+ "registry": "https://registry.npmjs.org/"
52
+ },
53
+ "scripts": {
54
+ "build": "vite build --config vite.lib.config.ts",
55
+ "typecheck": "vue-tsc --noEmit --skipLibCheck"
56
+ }
6
57
  }