@coding-flow/flow-pc-approval 0.0.12 → 0.0.15

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 (32) hide show
  1. package/dist/components/flow-approval/components/action/add-audit.js +6 -0
  2. package/dist/components/flow-approval/components/action/close.d.ts +1 -0
  3. package/dist/components/flow-approval/components/action/close.js +18 -0
  4. package/dist/components/flow-approval/components/action/custom.js +6 -1
  5. package/dist/components/flow-approval/components/action/delegate.js +6 -0
  6. package/dist/components/flow-approval/components/action/pass.js +6 -0
  7. package/dist/components/flow-approval/components/action/reject.js +6 -0
  8. package/dist/components/flow-approval/components/action/return.js +6 -0
  9. package/dist/components/flow-approval/components/action/revoke.js +4 -0
  10. package/dist/components/flow-approval/components/action/save.js +6 -0
  11. package/dist/components/flow-approval/components/action/transfer.js +6 -0
  12. package/dist/components/flow-approval/components/action/urge.js +4 -0
  13. package/dist/components/flow-approval/components/flow-approval-actions.d.ts +1 -0
  14. package/dist/components/flow-approval/components/flow-approval-actions.js +42 -0
  15. package/dist/components/flow-approval/components/flow-approval-content.d.ts +7 -0
  16. package/dist/components/flow-approval/components/flow-approval-content.js +32 -0
  17. package/dist/components/flow-approval/components/flow-approval-sider.d.ts +7 -0
  18. package/dist/components/flow-approval/components/flow-approval-sider.js +116 -0
  19. package/dist/components/flow-approval/components/flow-approval-title.d.ts +1 -0
  20. package/dist/components/flow-approval/components/flow-approval-title.js +17 -0
  21. package/dist/components/flow-approval/index.d.ts +5 -16
  22. package/dist/components/flow-approval/index.js +5 -38
  23. package/dist/components/flow-approval/layout/body.js +13 -133
  24. package/dist/components/flow-approval/layout/footer.d.ts +1 -0
  25. package/dist/components/flow-approval/layout/footer.js +10 -0
  26. package/dist/components/flow-approval/layout/header.js +9 -50
  27. package/dist/components/flow-approval/layout/index.js +5 -2
  28. package/dist/components/flow-approval/typings/plugin-type.d.ts +14 -0
  29. package/dist/components/flow-approval/typings/plugin-type.js +15 -0
  30. package/dist/components/flow-approval/view.d.ts +10 -0
  31. package/dist/components/flow-approval/view.js +40 -0
  32. package/package.json +9 -9
@@ -4,6 +4,8 @@ import { Form, Modal, message } from "antd";
4
4
  import { useApprovalContext } from "@coding-flow/flow-approval-presenter";
5
5
  import { AddAuditView } from "../../../../plugins/view/add-audit-view.js";
6
6
  import { CustomStyleButton } from "../custom-style-button.js";
7
+ import { ViewBindPlugin } from "@coding-flow/flow-core";
8
+ import { APPROVAL_ACTION_ADD_AUDIT_KEY } from "../../index.js";
7
9
  const AddAuditAction = (props)=>{
8
10
  const action = props.action;
9
11
  const { context } = useApprovalContext();
@@ -26,6 +28,10 @@ const AddAuditAction = (props)=>{
26
28
  }
27
29
  });
28
30
  };
31
+ const ActionView = ViewBindPlugin.getInstance().get(APPROVAL_ACTION_ADD_AUDIT_KEY);
32
+ if (ActionView) return /*#__PURE__*/ jsx(ActionView, {
33
+ ...props
34
+ });
29
35
  return /*#__PURE__*/ jsxs(Fragment, {
30
36
  children: [
31
37
  /*#__PURE__*/ jsx(CustomStyleButton, {
@@ -0,0 +1 @@
1
+ export declare const CloseAction: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,18 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { useApprovalContext } from "@coding-flow/flow-approval-presenter";
3
+ import { Button } from "antd";
4
+ import "react";
5
+ import { APPROVAL_ACTION_CLOSE_KEY } from "../../index.js";
6
+ import { ViewBindPlugin } from "@coding-flow/flow-core";
7
+ const CloseAction = ()=>{
8
+ const { context } = useApprovalContext();
9
+ const ActionView = ViewBindPlugin.getInstance().get(APPROVAL_ACTION_CLOSE_KEY);
10
+ if (ActionView) return /*#__PURE__*/ jsx(ActionView, {});
11
+ return /*#__PURE__*/ jsx(Button, {
12
+ onClick: ()=>{
13
+ context.close();
14
+ },
15
+ children: "关闭"
16
+ });
17
+ };
18
+ export { CloseAction };
@@ -2,9 +2,10 @@ import { jsx } from "react/jsx-runtime";
2
2
  import "react";
3
3
  import { message } from "antd";
4
4
  import { useApprovalContext } from "@coding-flow/flow-approval-presenter";
5
- import { GroovyScriptConvertorUtil } from "@coding-flow/flow-core";
5
+ import { GroovyScriptConvertorUtil, ViewBindPlugin } from "@coding-flow/flow-core";
6
6
  import { ActionFactory } from "./factory.js";
7
7
  import { CustomStyleButton } from "../custom-style-button.js";
8
+ import { APPROVAL_ACTION_CUSTOM_KEY } from "../../index.js";
8
9
  const CustomAction = (props)=>{
9
10
  const action = props.action;
10
11
  const { context } = useApprovalContext();
@@ -12,6 +13,10 @@ const CustomAction = (props)=>{
12
13
  const script = action.script || '';
13
14
  const returnData = GroovyScriptConvertorUtil.getReturnScript(script);
14
15
  const triggerType = returnData.replaceAll('\'', '');
16
+ const ActionView = ViewBindPlugin.getInstance().get(APPROVAL_ACTION_CUSTOM_KEY);
17
+ if (ActionView) return /*#__PURE__*/ jsx(ActionView, {
18
+ ...props
19
+ });
15
20
  const FlowActionComponent = ActionFactory.getInstance().getFlowActionComponent({
16
21
  ...props.action,
17
22
  type: triggerType
@@ -4,6 +4,8 @@ import { Form, Modal, message } from "antd";
4
4
  import { useApprovalContext } from "@coding-flow/flow-approval-presenter";
5
5
  import { DelegateView } from "../../../../plugins/view/delegate-view.js";
6
6
  import { CustomStyleButton } from "../custom-style-button.js";
7
+ import { APPROVAL_ACTION_DELEGATE_KEY } from "../../index.js";
8
+ import { ViewBindPlugin } from "@coding-flow/flow-core";
7
9
  const DelegateAction = (props)=>{
8
10
  const action = props.action;
9
11
  const { context } = useApprovalContext();
@@ -26,6 +28,10 @@ const DelegateAction = (props)=>{
26
28
  }
27
29
  });
28
30
  };
31
+ const ActionView = ViewBindPlugin.getInstance().get(APPROVAL_ACTION_DELEGATE_KEY);
32
+ if (ActionView) return /*#__PURE__*/ jsx(ActionView, {
33
+ ...props
34
+ });
29
35
  return /*#__PURE__*/ jsxs(Fragment, {
30
36
  children: [
31
37
  /*#__PURE__*/ jsx(CustomStyleButton, {
@@ -5,6 +5,8 @@ import { useApprovalContext } from "@coding-flow/flow-approval-presenter";
5
5
  import { SignKeyView } from "../../../../plugins/view/sign-key-view.js";
6
6
  import { CustomStyleButton } from "../custom-style-button.js";
7
7
  import { ManualView } from "../../../../plugins/view/manual-view.js";
8
+ import { APPROVAL_ACTION_PASS_KEY } from "../../index.js";
9
+ import { ViewBindPlugin } from "@coding-flow/flow-core";
8
10
  const { TextArea } = Input;
9
11
  const PassAction = (props)=>{
10
12
  const action = props.action;
@@ -44,6 +46,10 @@ const PassAction = (props)=>{
44
46
  message: '请输入审批意见'
45
47
  }
46
48
  ] : [];
49
+ const ActionView = ViewBindPlugin.getInstance().get(APPROVAL_ACTION_PASS_KEY);
50
+ if (ActionView) return /*#__PURE__*/ jsx(ActionView, {
51
+ ...props
52
+ });
47
53
  return /*#__PURE__*/ jsxs(Fragment, {
48
54
  children: [
49
55
  /*#__PURE__*/ jsx(CustomStyleButton, {
@@ -3,6 +3,8 @@ import react from "react";
3
3
  import { Form, Input, Modal, message } from "antd";
4
4
  import { useApprovalContext } from "@coding-flow/flow-approval-presenter";
5
5
  import { CustomStyleButton } from "../custom-style-button.js";
6
+ import { APPROVAL_ACTION_REJECT_KEY } from "../../index.js";
7
+ import { ViewBindPlugin } from "@coding-flow/flow-core";
6
8
  const { TextArea } = Input;
7
9
  const RejectAction = (props)=>{
8
10
  const action = props.action;
@@ -25,6 +27,10 @@ const RejectAction = (props)=>{
25
27
  message: '请输入审批意见'
26
28
  }
27
29
  ] : [];
30
+ const ActionView = ViewBindPlugin.getInstance().get(APPROVAL_ACTION_REJECT_KEY);
31
+ if (ActionView) return /*#__PURE__*/ jsx(ActionView, {
32
+ ...props
33
+ });
28
34
  return /*#__PURE__*/ jsxs(Fragment, {
29
35
  children: [
30
36
  /*#__PURE__*/ jsx(CustomStyleButton, {
@@ -4,6 +4,8 @@ import { Form, Modal, message } from "antd";
4
4
  import { useApprovalContext } from "@coding-flow/flow-approval-presenter";
5
5
  import { ReturnView } from "../../../../plugins/view/return-view.js";
6
6
  import { CustomStyleButton } from "../custom-style-button.js";
7
+ import { APPROVAL_ACTION_RETURN_KEY } from "../../index.js";
8
+ import { ViewBindPlugin } from "@coding-flow/flow-core";
7
9
  const ReturnAction = (props)=>{
8
10
  const action = props.action;
9
11
  const { context } = useApprovalContext();
@@ -26,6 +28,10 @@ const ReturnAction = (props)=>{
26
28
  }
27
29
  });
28
30
  };
31
+ const ActionView = ViewBindPlugin.getInstance().get(APPROVAL_ACTION_RETURN_KEY);
32
+ if (ActionView) return /*#__PURE__*/ jsx(ActionView, {
33
+ ...props
34
+ });
29
35
  return /*#__PURE__*/ jsxs(Fragment, {
30
36
  children: [
31
37
  /*#__PURE__*/ jsx(CustomStyleButton, {
@@ -2,10 +2,14 @@ import { Fragment, jsx } from "react/jsx-runtime";
2
2
  import "react";
3
3
  import { Button, Popconfirm, message } from "antd";
4
4
  import { useApprovalContext } from "@coding-flow/flow-approval-presenter";
5
+ import { APPROVAL_ACTION_REVOKE_KEY } from "../../index.js";
6
+ import { ViewBindPlugin } from "@coding-flow/flow-core";
5
7
  const RevokeAction = ()=>{
6
8
  const { state, context } = useApprovalContext();
7
9
  const presenter = context.getPresenter().getFlowActionPresenter();
8
10
  const revoke = state.flow?.revoke || false;
11
+ const ActionView = ViewBindPlugin.getInstance().get(APPROVAL_ACTION_REVOKE_KEY);
12
+ if (ActionView) return /*#__PURE__*/ jsx(ActionView, {});
9
13
  return /*#__PURE__*/ jsx(Fragment, {
10
14
  children: revoke && /*#__PURE__*/ jsx(Popconfirm, {
11
15
  title: "确认要撤销审批吗?",
@@ -3,10 +3,16 @@ import "react";
3
3
  import { message } from "antd";
4
4
  import { useApprovalContext } from "@coding-flow/flow-approval-presenter";
5
5
  import { CustomStyleButton } from "../custom-style-button.js";
6
+ import { APPROVAL_ACTION_SAVE_KEY } from "../../index.js";
7
+ import { ViewBindPlugin } from "@coding-flow/flow-core";
6
8
  const SaveAction = (props)=>{
7
9
  const action = props.action;
8
10
  const { context } = useApprovalContext();
9
11
  const actionPresenter = context.getPresenter().getFlowActionPresenter();
12
+ const ActionView = ViewBindPlugin.getInstance().get(APPROVAL_ACTION_SAVE_KEY);
13
+ if (ActionView) return /*#__PURE__*/ jsx(ActionView, {
14
+ ...props
15
+ });
10
16
  return /*#__PURE__*/ jsx(CustomStyleButton, {
11
17
  display: props.action.display,
12
18
  onClick: ()=>{
@@ -4,6 +4,8 @@ import { Form, Modal, message } from "antd";
4
4
  import { useApprovalContext } from "@coding-flow/flow-approval-presenter";
5
5
  import { TransferView } from "../../../../plugins/view/transfer-view.js";
6
6
  import { CustomStyleButton } from "../custom-style-button.js";
7
+ import { APPROVAL_ACTION_TRANSFER_KEY } from "../../index.js";
8
+ import { ViewBindPlugin } from "@coding-flow/flow-core";
7
9
  const TransferAction = (props)=>{
8
10
  const action = props.action;
9
11
  const { context } = useApprovalContext();
@@ -26,6 +28,10 @@ const TransferAction = (props)=>{
26
28
  }
27
29
  });
28
30
  };
31
+ const ActionView = ViewBindPlugin.getInstance().get(APPROVAL_ACTION_TRANSFER_KEY);
32
+ if (ActionView) return /*#__PURE__*/ jsx(ActionView, {
33
+ ...props
34
+ });
29
35
  return /*#__PURE__*/ jsxs(Fragment, {
30
36
  children: [
31
37
  /*#__PURE__*/ jsx(CustomStyleButton, {
@@ -2,10 +2,14 @@ import { Fragment, jsx } from "react/jsx-runtime";
2
2
  import "react";
3
3
  import { Button, Popconfirm, message } from "antd";
4
4
  import { useApprovalContext } from "@coding-flow/flow-approval-presenter";
5
+ import { APPROVAL_ACTION_URGE_KEY } from "../../index.js";
6
+ import { ViewBindPlugin } from "@coding-flow/flow-core";
5
7
  const UrgeAction = ()=>{
6
8
  const { state, context } = useApprovalContext();
7
9
  const presenter = context.getPresenter().getFlowActionPresenter();
8
10
  const urge = state.flow?.urge || false;
11
+ const ActionView = ViewBindPlugin.getInstance().get(APPROVAL_ACTION_URGE_KEY);
12
+ if (ActionView) return /*#__PURE__*/ jsx(ActionView, {});
9
13
  return /*#__PURE__*/ jsx(Fragment, {
10
14
  children: urge && /*#__PURE__*/ jsx(Popconfirm, {
11
15
  title: "确认要催办审批用户吗?",
@@ -0,0 +1 @@
1
+ export declare const FlowApprovalActions: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,42 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { useApprovalContext } from "@coding-flow/flow-approval-presenter";
3
+ import "react";
4
+ import { Space, message } from "antd";
5
+ import { ObjectUtils } from "@coding-flow/flow-core";
6
+ import { ActionFactory } from "./action/factory.js";
7
+ import { UrgeAction } from "./action/urge.js";
8
+ import { RevokeAction } from "./action/revoke.js";
9
+ import { CloseAction } from "./action/close.js";
10
+ const FlowApprovalActions = ()=>{
11
+ const { state, context } = useApprovalContext();
12
+ const actions = state.flow?.actions || [];
13
+ const review = state?.review || false;
14
+ const handlerClickCheck = (id)=>{
15
+ if (state.flow?.mergeable) {
16
+ const presenter = context.getPresenter().getFlowActionPresenter();
17
+ const selectRecordIds = presenter.getSubmitRecordIds();
18
+ const currentFormData = presenter.getCurrentFormData();
19
+ if (ObjectUtils.isEmptyObject(currentFormData) && 0 == selectRecordIds.length) {
20
+ message.error('请先选择审批流程.');
21
+ return false;
22
+ }
23
+ }
24
+ return true;
25
+ };
26
+ return /*#__PURE__*/ jsxs(Space, {
27
+ size: 8,
28
+ children: [
29
+ !review && actions.map((action)=>{
30
+ const FlowActionComponent = ActionFactory.getInstance().getFlowActionComponent(action);
31
+ if (FlowActionComponent) return /*#__PURE__*/ jsx(FlowActionComponent, {
32
+ action: action,
33
+ onClickCheck: (actionId)=>handlerClickCheck(actionId)
34
+ });
35
+ }),
36
+ /*#__PURE__*/ jsx(UrgeAction, {}),
37
+ /*#__PURE__*/ jsx(RevokeAction, {}),
38
+ /*#__PURE__*/ jsx(CloseAction, {})
39
+ ]
40
+ });
41
+ };
42
+ export { FlowApprovalActions };
@@ -0,0 +1,7 @@
1
+ import React from "react";
2
+ import { FlowNodeHistoryAction } from "./flow-node-history";
3
+ interface FlowApprovalContentProps {
4
+ flowNodeHistoryAction: React.RefObject<FlowNodeHistoryAction>;
5
+ }
6
+ export declare const FlowApprovalContent: React.FC<FlowApprovalContentProps>;
7
+ export {};
@@ -0,0 +1,32 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import "react";
3
+ import { FormViewComponent } from "./form-view-component.js";
4
+ import { Card, Layout } from "antd";
5
+ const { Content } = Layout;
6
+ const FlowApprovalContent = (props)=>{
7
+ const flowNodeHistoryAction = props.flowNodeHistoryAction;
8
+ const handleValuesChange = (values)=>{
9
+ flowNodeHistoryAction.current?.refresh();
10
+ };
11
+ return /*#__PURE__*/ jsx(Content, {
12
+ style: {
13
+ overflow: 'auto',
14
+ width: '100%'
15
+ },
16
+ children: /*#__PURE__*/ jsx(Card, {
17
+ style: {
18
+ height: '100%',
19
+ borderRadius: 8
20
+ },
21
+ styles: {
22
+ body: {
23
+ padding: 24
24
+ }
25
+ },
26
+ children: /*#__PURE__*/ jsx(FormViewComponent, {
27
+ onValuesChange: handleValuesChange
28
+ })
29
+ })
30
+ });
31
+ };
32
+ export { FlowApprovalContent };
@@ -0,0 +1,7 @@
1
+ import React from "react";
2
+ import { FlowNodeHistoryAction } from "./flow-node-history";
3
+ interface FlowApprovalSiderProps {
4
+ flowNodeHistoryAction: React.RefObject<FlowNodeHistoryAction>;
5
+ }
6
+ export declare const FlowApprovalSider: React.FC<FlowApprovalSiderProps>;
7
+ export {};
@@ -0,0 +1,116 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { useState } from "react";
3
+ import { FlowNodeHistory } from "./flow-node-history.js";
4
+ import { ApprovalSidebarCollapsedWidth, ApprovalSidebarWidth } from "../typings/index.js";
5
+ import { Button, Flex, Layout, Typography } from "antd";
6
+ import { LeftOutlined, RightOutlined } from "@ant-design/icons";
7
+ const { Sider } = Layout;
8
+ const { Title } = Typography;
9
+ const FlowApprovalSider = (props)=>{
10
+ const [collapsed, setCollapsed] = useState(false);
11
+ const flowNodeHistoryAction = props.flowNodeHistoryAction;
12
+ return /*#__PURE__*/ jsxs(Sider, {
13
+ width: ApprovalSidebarWidth,
14
+ collapsedWidth: ApprovalSidebarCollapsedWidth,
15
+ collapsible: true,
16
+ collapsed: collapsed,
17
+ onCollapse: setCollapsed,
18
+ trigger: null,
19
+ style: {
20
+ marginLeft: "8px",
21
+ backgroundColor: '#fff',
22
+ borderRadius: 8,
23
+ overflow: 'hidden'
24
+ },
25
+ children: [
26
+ !collapsed && /*#__PURE__*/ jsxs(Flex, {
27
+ vertical: true,
28
+ style: {
29
+ height: '100%'
30
+ },
31
+ children: [
32
+ /*#__PURE__*/ jsxs(Flex, {
33
+ justify: "space-between",
34
+ align: "center",
35
+ style: {
36
+ padding: '16px 24px',
37
+ borderBottom: '1px solid #f0f0f0',
38
+ backgroundColor: '#fafafa'
39
+ },
40
+ children: [
41
+ /*#__PURE__*/ jsx(Title, {
42
+ level: 5,
43
+ style: {
44
+ margin: 0,
45
+ fontSize: 15
46
+ },
47
+ children: "流程记录"
48
+ }),
49
+ /*#__PURE__*/ jsx(Button, {
50
+ type: "text",
51
+ size: "small",
52
+ icon: /*#__PURE__*/ jsx(LeftOutlined, {
53
+ style: {
54
+ fontSize: 12
55
+ }
56
+ }),
57
+ onClick: ()=>setCollapsed(true),
58
+ style: {
59
+ color: '#8c8c8c'
60
+ }
61
+ })
62
+ ]
63
+ }),
64
+ /*#__PURE__*/ jsx("div", {
65
+ style: {
66
+ padding: 16,
67
+ flex: 1,
68
+ overflow: 'auto'
69
+ },
70
+ children: /*#__PURE__*/ jsx(FlowNodeHistory, {
71
+ actionRef: flowNodeHistoryAction
72
+ })
73
+ })
74
+ ]
75
+ }),
76
+ collapsed && /*#__PURE__*/ jsxs(Flex, {
77
+ vertical: true,
78
+ align: "center",
79
+ justify: "center",
80
+ gap: 16,
81
+ style: {
82
+ height: '100%',
83
+ padding: '12px 8px',
84
+ backgroundColor: '#fafafa'
85
+ },
86
+ children: [
87
+ /*#__PURE__*/ jsx(Button, {
88
+ type: "text",
89
+ size: "small",
90
+ icon: /*#__PURE__*/ jsx(RightOutlined, {
91
+ style: {
92
+ fontSize: 12
93
+ }
94
+ }),
95
+ onClick: ()=>setCollapsed(false),
96
+ style: {
97
+ color: '#8c8c8c'
98
+ }
99
+ }),
100
+ /*#__PURE__*/ jsx("div", {
101
+ style: {
102
+ writingMode: 'vertical-rl',
103
+ textOrientation: 'mixed',
104
+ letterSpacing: 4,
105
+ fontSize: 14,
106
+ fontWeight: 500,
107
+ color: '#595959'
108
+ },
109
+ children: "流程记录"
110
+ })
111
+ ]
112
+ })
113
+ ]
114
+ });
115
+ };
116
+ export { FlowApprovalSider };
@@ -0,0 +1 @@
1
+ export declare const FlowApprovalTitle: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,17 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import "react";
3
+ import { Typography } from "antd";
4
+ import { useApprovalContext } from "@coding-flow/flow-approval-presenter";
5
+ const { Title } = Typography;
6
+ const FlowApprovalTitle = ()=>{
7
+ const { state } = useApprovalContext();
8
+ return /*#__PURE__*/ jsx(Title, {
9
+ level: 4,
10
+ style: {
11
+ fontSize: 16,
12
+ fontWeight: 500
13
+ },
14
+ children: state.flow?.title || '审批详情'
15
+ });
16
+ };
17
+ export { FlowApprovalTitle };
@@ -1,16 +1,5 @@
1
- import React from "react";
2
- interface ApprovalPanelProps {
3
- /** 初始化数据 **/
4
- initData?: any;
5
- workflowCode?: string;
6
- recordId?: string;
7
- onClose?: () => void;
8
- review?: boolean;
9
- }
10
- export declare const ApprovalPanel: React.FC<ApprovalPanelProps>;
11
- interface ApprovalPanelDrawerProps extends ApprovalPanelProps {
12
- open: boolean;
13
- onClose: () => void;
14
- }
15
- export declare const ApprovalPanelDrawer: React.FC<ApprovalPanelDrawerProps>;
16
- export {};
1
+ export * from "./view";
2
+ export * from "./typings/plugin-type";
3
+ export * from "./components/action/factory";
4
+ export * from "./components/action/type";
5
+ export * from "./components/flow-approval-actions";
@@ -1,38 +1,5 @@
1
- import { jsx } from "react/jsx-runtime";
2
- import react from "react";
3
- import { Drawer } from "@coding-flow/flow-pc-ui";
4
- import { detail } from "../../api/record.js";
5
- import { ApprovalLayout } from "./layout/index.js";
6
- import { useMockContext } from "@coding-flow/flow-approval-presenter";
7
- const ApprovalPanel = (props)=>{
8
- const [content, dispatch] = react.useState(void 0);
9
- const mockKey = useMockContext();
10
- react.useEffect(()=>{
11
- const id = props.recordId || props.workflowCode || '';
12
- detail(id, mockKey).then((res)=>{
13
- if (res.success) dispatch(res.data);
14
- });
15
- }, []);
16
- return /*#__PURE__*/ jsx("div", {
17
- children: content && /*#__PURE__*/ jsx(ApprovalLayout, {
18
- content: content,
19
- onClose: props.onClose,
20
- review: props.review,
21
- initData: props.initData
22
- })
23
- });
24
- };
25
- const ApprovalPanelDrawer = (props)=>/*#__PURE__*/ jsx(Drawer, {
26
- open: props.open,
27
- onClose: props.onClose,
28
- styles: {
29
- body: {
30
- padding: 0,
31
- margin: 0
32
- }
33
- },
34
- children: /*#__PURE__*/ jsx(ApprovalPanel, {
35
- ...props
36
- })
37
- });
38
- export { ApprovalPanel, ApprovalPanelDrawer };
1
+ export * from "./view.js";
2
+ export * from "./typings/plugin-type.js";
3
+ export * from "./components/action/factory.js";
4
+ export * from "./components/action/type.js";
5
+ export * from "./components/flow-approval-actions.js";
@@ -1,18 +1,15 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
- import react, { useState } from "react";
3
- import { FormViewComponent } from "../components/form-view-component.js";
4
- import { FlowNodeHistory } from "../components/flow-node-history.js";
5
- import { ApprovalContentPaddingH, ApprovalContentPaddingV, ApprovalLayoutHeight, ApprovalSidebarCollapsedWidth, ApprovalSidebarWidth } from "../typings/index.js";
6
- import { Button, Card, Flex, Layout, Typography } from "antd";
7
- import { LeftOutlined, RightOutlined } from "@ant-design/icons";
8
- const { Sider, Content } = Layout;
9
- const { Title } = Typography;
2
+ import react from "react";
3
+ import { ApprovalContentPaddingH, ApprovalContentPaddingV, ApprovalLayoutHeight } from "../typings/index.js";
4
+ import { Layout } from "antd";
5
+ import { FlowApprovalContent } from "../components/flow-approval-content.js";
6
+ import { FlowApprovalSider } from "../components/flow-approval-sider.js";
7
+ import { APPROVAL_BODY_VIEW_KEY } from "../index.js";
8
+ import { ViewBindPlugin } from "@coding-flow/flow-core";
10
9
  const Body = ()=>{
11
- const [collapsed, setCollapsed] = useState(false);
12
10
  const flowNodeHistoryAction = react.useRef(null);
13
- const handleValuesChange = (values)=>{
14
- flowNodeHistoryAction.current?.refresh();
15
- };
11
+ const BodyView = ViewBindPlugin.getInstance().get(APPROVAL_BODY_VIEW_KEY);
12
+ if (BodyView) return /*#__PURE__*/ jsx(BodyView, {});
16
13
  return /*#__PURE__*/ jsxs(Layout, {
17
14
  style: {
18
15
  padding: `${ApprovalContentPaddingV}px ${ApprovalContentPaddingH}px`,
@@ -21,128 +18,11 @@ const Body = ()=>{
21
18
  height: `calc(100vh - ${ApprovalLayoutHeight}px)`
22
19
  },
23
20
  children: [
24
- /*#__PURE__*/ jsx(Content, {
25
- style: {
26
- overflow: 'auto',
27
- width: '100%'
28
- },
29
- children: /*#__PURE__*/ jsx(Card, {
30
- style: {
31
- height: '100%',
32
- borderRadius: 8
33
- },
34
- styles: {
35
- body: {
36
- padding: 24
37
- }
38
- },
39
- children: /*#__PURE__*/ jsx(FormViewComponent, {
40
- onValuesChange: handleValuesChange
41
- })
42
- })
21
+ /*#__PURE__*/ jsx(FlowApprovalContent, {
22
+ flowNodeHistoryAction: flowNodeHistoryAction
43
23
  }),
44
- /*#__PURE__*/ jsxs(Sider, {
45
- width: ApprovalSidebarWidth,
46
- collapsedWidth: ApprovalSidebarCollapsedWidth,
47
- collapsible: true,
48
- collapsed: collapsed,
49
- onCollapse: setCollapsed,
50
- trigger: null,
51
- style: {
52
- marginLeft: "8px",
53
- backgroundColor: '#fff',
54
- borderRadius: 8,
55
- overflow: 'hidden'
56
- },
57
- children: [
58
- !collapsed && /*#__PURE__*/ jsxs(Flex, {
59
- vertical: true,
60
- style: {
61
- height: '100%'
62
- },
63
- children: [
64
- /*#__PURE__*/ jsxs(Flex, {
65
- justify: "space-between",
66
- align: "center",
67
- style: {
68
- padding: '16px 24px',
69
- borderBottom: '1px solid #f0f0f0',
70
- backgroundColor: '#fafafa'
71
- },
72
- children: [
73
- /*#__PURE__*/ jsx(Title, {
74
- level: 5,
75
- style: {
76
- margin: 0,
77
- fontSize: 15
78
- },
79
- children: "流程记录"
80
- }),
81
- /*#__PURE__*/ jsx(Button, {
82
- type: "text",
83
- size: "small",
84
- icon: /*#__PURE__*/ jsx(LeftOutlined, {
85
- style: {
86
- fontSize: 12
87
- }
88
- }),
89
- onClick: ()=>setCollapsed(true),
90
- style: {
91
- color: '#8c8c8c'
92
- }
93
- })
94
- ]
95
- }),
96
- /*#__PURE__*/ jsx("div", {
97
- style: {
98
- padding: 16,
99
- flex: 1,
100
- overflow: 'auto'
101
- },
102
- children: /*#__PURE__*/ jsx(FlowNodeHistory, {
103
- actionRef: flowNodeHistoryAction
104
- })
105
- })
106
- ]
107
- }),
108
- collapsed && /*#__PURE__*/ jsxs(Flex, {
109
- vertical: true,
110
- align: "center",
111
- justify: "center",
112
- gap: 16,
113
- style: {
114
- height: '100%',
115
- padding: '12px 8px',
116
- backgroundColor: '#fafafa'
117
- },
118
- children: [
119
- /*#__PURE__*/ jsx(Button, {
120
- type: "text",
121
- size: "small",
122
- icon: /*#__PURE__*/ jsx(RightOutlined, {
123
- style: {
124
- fontSize: 12
125
- }
126
- }),
127
- onClick: ()=>setCollapsed(false),
128
- style: {
129
- color: '#8c8c8c'
130
- }
131
- }),
132
- /*#__PURE__*/ jsx("div", {
133
- style: {
134
- writingMode: 'vertical-rl',
135
- textOrientation: 'mixed',
136
- letterSpacing: 4,
137
- fontSize: 14,
138
- fontWeight: 500,
139
- color: '#595959'
140
- },
141
- children: "流程记录"
142
- })
143
- ]
144
- })
145
- ]
24
+ /*#__PURE__*/ jsx(FlowApprovalSider, {
25
+ flowNodeHistoryAction: flowNodeHistoryAction
146
26
  })
147
27
  ]
148
28
  });
@@ -0,0 +1 @@
1
+ export declare const Footer: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,10 @@
1
+ import { Fragment, jsx } from "react/jsx-runtime";
2
+ import "react";
3
+ import { APPROVAL_FOOTER_VIEW_KEY } from "../index.js";
4
+ import { ViewBindPlugin } from "@coding-flow/flow-core";
5
+ const Footer = ()=>{
6
+ const HeaderView = ViewBindPlugin.getInstance().get(APPROVAL_FOOTER_VIEW_KEY);
7
+ if (HeaderView) return /*#__PURE__*/ jsx(HeaderView, {});
8
+ return /*#__PURE__*/ jsx(Fragment, {});
9
+ };
10
+ export { Footer };
@@ -1,29 +1,14 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import "react";
3
- import { useApprovalContext } from "@coding-flow/flow-approval-presenter";
4
- import { Button, Flex, Space, Typography, message } from "antd";
3
+ import { Flex } from "antd";
5
4
  import { ApprovalLayoutHeight } from "../typings/index.js";
6
- import { ActionFactory } from "../components/action/factory.js";
7
- import { UrgeAction } from "../components/action/urge.js";
8
- import { RevokeAction } from "../components/action/revoke.js";
9
- import { ObjectUtils } from "@coding-flow/flow-core";
10
- const { Title } = Typography;
5
+ import { FlowApprovalActions } from "../components/flow-approval-actions.js";
6
+ import { FlowApprovalTitle } from "../components/flow-approval-title.js";
7
+ import { ViewBindPlugin } from "@coding-flow/flow-core";
8
+ import { APPROVAL_HEADER_VIEW_KEY } from "../index.js";
11
9
  const Header = ()=>{
12
- const { state, context } = useApprovalContext();
13
- const actions = state.flow?.actions || [];
14
- const review = state?.review || false;
15
- const handlerClickCheck = (id)=>{
16
- if (state.flow?.mergeable) {
17
- const presenter = context.getPresenter().getFlowActionPresenter();
18
- const selectRecordIds = presenter.getSubmitRecordIds();
19
- const currentFormData = presenter.getCurrentFormData();
20
- if (ObjectUtils.isEmptyObject(currentFormData) && 0 == selectRecordIds.length) {
21
- message.error('请先选择审批流程.');
22
- return false;
23
- }
24
- }
25
- return true;
26
- };
10
+ const HeaderView = ViewBindPlugin.getInstance().get(APPROVAL_HEADER_VIEW_KEY);
11
+ if (HeaderView) return /*#__PURE__*/ jsx(HeaderView, {});
27
12
  return /*#__PURE__*/ jsx("div", {
28
13
  style: {
29
14
  width: "100%",
@@ -39,34 +24,8 @@ const Header = ()=>{
39
24
  height: '100%'
40
25
  },
41
26
  children: [
42
- /*#__PURE__*/ jsx(Title, {
43
- level: 4,
44
- style: {
45
- fontSize: 16,
46
- fontWeight: 500
47
- },
48
- children: state.flow?.title || '审批详情'
49
- }),
50
- /*#__PURE__*/ jsxs(Space, {
51
- size: 8,
52
- children: [
53
- !review && actions.map((action)=>{
54
- const FlowActionComponent = ActionFactory.getInstance().getFlowActionComponent(action);
55
- if (FlowActionComponent) return /*#__PURE__*/ jsx(FlowActionComponent, {
56
- action: action,
57
- onClickCheck: (actionId)=>handlerClickCheck(actionId)
58
- });
59
- }),
60
- /*#__PURE__*/ jsx(UrgeAction, {}),
61
- /*#__PURE__*/ jsx(RevokeAction, {}),
62
- /*#__PURE__*/ jsx(Button, {
63
- onClick: ()=>{
64
- context.close();
65
- },
66
- children: "关闭"
67
- })
68
- ]
69
- })
27
+ /*#__PURE__*/ jsx(FlowApprovalTitle, {}),
28
+ /*#__PURE__*/ jsx(FlowApprovalActions, {})
70
29
  ]
71
30
  })
72
31
  });
@@ -1,15 +1,17 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import "react";
3
- import { Provider } from "react-redux";
4
3
  import { ApprovalContext, approvalStore, createApprovalContext } from "@coding-flow/flow-approval-presenter";
4
+ import { Provider } from "react-redux";
5
5
  import { Header } from "./header.js";
6
6
  import { Body } from "./body.js";
7
7
  import { FlowApprovalApiImpl } from "../model/index.js";
8
+ import { Footer } from "./footer.js";
8
9
  const ApprovalLayoutScope = (props)=>{
9
10
  const { context } = createApprovalContext(props, new FlowApprovalApiImpl());
10
11
  return /*#__PURE__*/ jsx(ApprovalContext.Provider, {
11
12
  value: context,
12
13
  children: /*#__PURE__*/ jsxs("div", {
14
+ className: props.className,
13
15
  style: {
14
16
  width: '100%',
15
17
  height: '100vh',
@@ -19,7 +21,8 @@ const ApprovalLayoutScope = (props)=>{
19
21
  },
20
22
  children: [
21
23
  /*#__PURE__*/ jsx(Header, {}),
22
- /*#__PURE__*/ jsx(Body, {})
24
+ /*#__PURE__*/ jsx(Body, {}),
25
+ /*#__PURE__*/ jsx(Footer, {})
23
26
  ]
24
27
  })
25
28
  });
@@ -0,0 +1,14 @@
1
+ export declare const APPROVAL_HEADER_VIEW_KEY = "APPROVAL_HEADER_VIEW_KEY";
2
+ export declare const APPROVAL_BODY_VIEW_KEY = "APPROVAL_BODY_VIEW_KEY";
3
+ export declare const APPROVAL_FOOTER_VIEW_KEY = "APPROVAL_FOOTER_VIEW_KEY";
4
+ export declare const APPROVAL_ACTION_ADD_AUDIT_KEY = "APPROVAL_ACTION_ADD_AUDIT_KEY";
5
+ export declare const APPROVAL_ACTION_CLOSE_KEY = "APPROVAL_ACTION_CLOSE_KEY";
6
+ export declare const APPROVAL_ACTION_CUSTOM_KEY = "APPROVAL_ACTION_CUSTOM_KEY";
7
+ export declare const APPROVAL_ACTION_DELEGATE_KEY = "APPROVAL_ACTION_DELEGATE_KEY";
8
+ export declare const APPROVAL_ACTION_PASS_KEY = "APPROVAL_ACTION_PASS_KEY";
9
+ export declare const APPROVAL_ACTION_REJECT_KEY = "APPROVAL_ACTION_REJECT_KEY";
10
+ export declare const APPROVAL_ACTION_RETURN_KEY = "APPROVAL_ACTION_RETURN_KEY";
11
+ export declare const APPROVAL_ACTION_REVOKE_KEY = "APPROVAL_ACTION_REVOKE_KEY";
12
+ export declare const APPROVAL_ACTION_SAVE_KEY = "APPROVAL_ACTION_SAVE_KEY";
13
+ export declare const APPROVAL_ACTION_TRANSFER_KEY = "APPROVAL_ACTION_TRANSFER_KEY";
14
+ export declare const APPROVAL_ACTION_URGE_KEY = "APPROVAL_ACTION_URGE_KEY";
@@ -0,0 +1,15 @@
1
+ const APPROVAL_HEADER_VIEW_KEY = 'APPROVAL_HEADER_VIEW_KEY';
2
+ const APPROVAL_BODY_VIEW_KEY = 'APPROVAL_BODY_VIEW_KEY';
3
+ const APPROVAL_FOOTER_VIEW_KEY = 'APPROVAL_FOOTER_VIEW_KEY';
4
+ const APPROVAL_ACTION_ADD_AUDIT_KEY = 'APPROVAL_ACTION_ADD_AUDIT_KEY';
5
+ const APPROVAL_ACTION_CLOSE_KEY = 'APPROVAL_ACTION_CLOSE_KEY';
6
+ const APPROVAL_ACTION_CUSTOM_KEY = 'APPROVAL_ACTION_CUSTOM_KEY';
7
+ const APPROVAL_ACTION_DELEGATE_KEY = 'APPROVAL_ACTION_DELEGATE_KEY';
8
+ const APPROVAL_ACTION_PASS_KEY = 'APPROVAL_ACTION_PASS_KEY';
9
+ const APPROVAL_ACTION_REJECT_KEY = 'APPROVAL_ACTION_REJECT_KEY';
10
+ const APPROVAL_ACTION_RETURN_KEY = 'APPROVAL_ACTION_RETURN_KEY';
11
+ const APPROVAL_ACTION_REVOKE_KEY = 'APPROVAL_ACTION_REVOKE_KEY';
12
+ const APPROVAL_ACTION_SAVE_KEY = 'APPROVAL_ACTION_SAVE_KEY';
13
+ const APPROVAL_ACTION_TRANSFER_KEY = 'APPROVAL_ACTION_TRANSFER_KEY';
14
+ const APPROVAL_ACTION_URGE_KEY = 'APPROVAL_ACTION_URGE_KEY';
15
+ export { APPROVAL_ACTION_ADD_AUDIT_KEY, APPROVAL_ACTION_CLOSE_KEY, APPROVAL_ACTION_CUSTOM_KEY, APPROVAL_ACTION_DELEGATE_KEY, APPROVAL_ACTION_PASS_KEY, APPROVAL_ACTION_REJECT_KEY, APPROVAL_ACTION_RETURN_KEY, APPROVAL_ACTION_REVOKE_KEY, APPROVAL_ACTION_SAVE_KEY, APPROVAL_ACTION_TRANSFER_KEY, APPROVAL_ACTION_URGE_KEY, APPROVAL_BODY_VIEW_KEY, APPROVAL_FOOTER_VIEW_KEY, APPROVAL_HEADER_VIEW_KEY };
@@ -0,0 +1,10 @@
1
+ import React from "react";
2
+ import { ApprovalPanelProps } from "@coding-flow/flow-approval-presenter";
3
+ export declare const ApprovalPanel: React.FC<ApprovalPanelProps>;
4
+ interface ApprovalPanelDrawerProps extends ApprovalPanelProps {
5
+ open: boolean;
6
+ onClose: () => void;
7
+ drawerClassName?: string;
8
+ }
9
+ export declare const ApprovalPanelDrawer: React.FC<ApprovalPanelDrawerProps>;
10
+ export {};
@@ -0,0 +1,40 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import react from "react";
3
+ import { Drawer } from "@coding-flow/flow-pc-ui";
4
+ import { detail } from "../../api/record.js";
5
+ import { ApprovalLayout } from "./layout/index.js";
6
+ import { useMockContext } from "@coding-flow/flow-approval-presenter";
7
+ const ApprovalPanel = (props)=>{
8
+ const [content, dispatch] = react.useState(void 0);
9
+ const mockKey = useMockContext();
10
+ react.useEffect(()=>{
11
+ const id = props.recordId || props.workflowCode || '';
12
+ detail(id, mockKey).then((res)=>{
13
+ if (res.success) dispatch(res.data);
14
+ });
15
+ }, []);
16
+ return /*#__PURE__*/ jsx("div", {
17
+ children: content && /*#__PURE__*/ jsx(ApprovalLayout, {
18
+ className: props.className,
19
+ content: content,
20
+ onClose: props.onClose,
21
+ review: props.review,
22
+ initData: props.initData
23
+ })
24
+ });
25
+ };
26
+ const ApprovalPanelDrawer = (props)=>/*#__PURE__*/ jsx(Drawer, {
27
+ className: props.drawerClassName,
28
+ open: props.open,
29
+ onClose: props.onClose,
30
+ styles: {
31
+ body: {
32
+ padding: 0,
33
+ margin: 0
34
+ }
35
+ },
36
+ children: /*#__PURE__*/ jsx(ApprovalPanel, {
37
+ ...props
38
+ })
39
+ });
40
+ export { ApprovalPanel, ApprovalPanelDrawer };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coding-flow/flow-pc-approval",
3
- "version": "0.0.12",
3
+ "version": "0.0.15",
4
4
  "description": "flow-engine pc form approval components",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -33,21 +33,21 @@
33
33
  },
34
34
  "dependencies": {
35
35
  "@ant-design/icons": "~6.1.0",
36
- "@coding-form/form-engine": "^0.0.14",
36
+ "@coding-form/form-engine": "^0.0.15",
37
37
  "@reduxjs/toolkit": "^2.11.2",
38
38
  "antd": "^6.2.1",
39
39
  "dayjs": "^1.11.19",
40
40
  "immer": "^11.1.3",
41
41
  "react-redux": "^9.2.0",
42
- "@coding-flow/flow-approval-presenter": "0.0.12",
43
- "@coding-flow/flow-icons": "0.0.12",
44
- "@coding-flow/flow-core": "0.0.12",
45
- "@coding-flow/flow-types": "0.0.12",
46
- "@coding-flow/flow-pc-ui": "0.0.12",
47
- "@coding-flow/flow-pc-form": "0.0.12"
42
+ "@coding-flow/flow-core": "0.0.15",
43
+ "@coding-flow/flow-types": "0.0.15",
44
+ "@coding-flow/flow-icons": "0.0.15",
45
+ "@coding-flow/flow-approval-presenter": "0.0.15",
46
+ "@coding-flow/flow-pc-ui": "0.0.15",
47
+ "@coding-flow/flow-pc-form": "0.0.15"
48
48
  },
49
49
  "devDependencies": {
50
- "@coding-flow/flow-types": "0.0.12"
50
+ "@coding-flow/flow-types": "0.0.15"
51
51
  },
52
52
  "scripts": {
53
53
  "build": "rslib build",