@coding-flow/flow-mobile-approval 0.0.11 → 0.0.13

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 (27) hide show
  1. package/dist/components/flow-approval/components/action/add-audit.js +6 -1
  2. package/dist/components/flow-approval/components/action/custom.js +6 -1
  3. package/dist/components/flow-approval/components/action/delegate.js +6 -1
  4. package/dist/components/flow-approval/components/action/pass.js +6 -1
  5. package/dist/components/flow-approval/components/action/reject.js +6 -1
  6. package/dist/components/flow-approval/components/action/return.js +6 -1
  7. package/dist/components/flow-approval/components/action/revoke.js +4 -0
  8. package/dist/components/flow-approval/components/action/save.js +4 -1
  9. package/dist/components/flow-approval/components/action/transfer.js +4 -1
  10. package/dist/components/flow-approval/components/action/urge.js +4 -0
  11. package/dist/components/flow-approval/components/flow-approval-actions.d.ts +1 -0
  12. package/dist/components/flow-approval/components/flow-approval-actions.js +76 -0
  13. package/dist/components/flow-approval/components/flow-approval-content.d.ts +1 -0
  14. package/dist/components/flow-approval/components/flow-approval-content.js +29 -0
  15. package/dist/components/flow-approval/components/flow-approval-title.d.ts +1 -0
  16. package/dist/components/flow-approval/components/flow-approval-title.js +10 -0
  17. package/dist/components/flow-approval/index.d.ts +5 -4
  18. package/dist/components/flow-approval/index.js +5 -25
  19. package/dist/components/flow-approval/layout/body.js +8 -26
  20. package/dist/components/flow-approval/layout/footer.js +7 -73
  21. package/dist/components/flow-approval/layout/header.js +7 -2
  22. package/dist/components/flow-approval/layout/index.js +1 -0
  23. package/dist/components/flow-approval/typings/plugin-type.d.ts +13 -0
  24. package/dist/components/flow-approval/typings/plugin-type.js +14 -0
  25. package/dist/components/flow-approval/view.d.ts +4 -0
  26. package/dist/components/flow-approval/view.js +25 -0
  27. package/package.json +8 -8
@@ -4,7 +4,8 @@ import { Form, Toast } from "antd-mobile";
4
4
  import { useApprovalContext } from "@coding-flow/flow-approval-presenter";
5
5
  import { AddAuditView } from "../../../../plugins/view/add-audit-view.js";
6
6
  import { PopupModal } from "@coding-flow/flow-mobile-ui";
7
- import { EventBus } from "@coding-flow/flow-core";
7
+ import { EventBus, ViewBindPlugin } from "@coding-flow/flow-core";
8
+ import { APPROVAL_ACTION_ADD_AUDIT_KEY } from "../../index.js";
8
9
  const AddAuditAction = (props)=>{
9
10
  const action = props.action;
10
11
  const { context } = useApprovalContext();
@@ -36,6 +37,10 @@ const AddAuditAction = (props)=>{
36
37
  EventBus.getInstance().off(action.id);
37
38
  };
38
39
  }, []);
40
+ const ActionView = ViewBindPlugin.getInstance().get(APPROVAL_ACTION_ADD_AUDIT_KEY);
41
+ if (ActionView) return /*#__PURE__*/ jsx(ActionView, {
42
+ ...props
43
+ });
39
44
  return /*#__PURE__*/ jsx(Fragment, {
40
45
  children: /*#__PURE__*/ jsx(PopupModal, {
41
46
  title: "加签审批",
@@ -1,12 +1,17 @@
1
1
  import { Fragment, jsx } from "react/jsx-runtime";
2
2
  import "react";
3
- import { GroovyScriptConvertorUtil } from "@coding-flow/flow-core";
3
+ import { GroovyScriptConvertorUtil, ViewBindPlugin } from "@coding-flow/flow-core";
4
4
  import { ActionFactory } from "./factory.js";
5
+ import { APPROVAL_ACTION_CUSTOM_KEY } from "../../index.js";
5
6
  const CustomAction = (props)=>{
6
7
  const action = props.action;
7
8
  const script = action.script || '';
8
9
  const returnData = GroovyScriptConvertorUtil.getReturnScript(script);
9
10
  const triggerType = returnData.replaceAll('\'', '');
11
+ const ActionPluginView = ViewBindPlugin.getInstance().get(APPROVAL_ACTION_CUSTOM_KEY);
12
+ if (ActionPluginView) return /*#__PURE__*/ jsx(ActionPluginView, {
13
+ ...props
14
+ });
10
15
  const ActionView = ActionFactory.getInstance().render({
11
16
  ...props.action,
12
17
  type: triggerType
@@ -3,8 +3,9 @@ import react from "react";
3
3
  import { Form, Toast } from "antd-mobile";
4
4
  import { useApprovalContext } from "@coding-flow/flow-approval-presenter";
5
5
  import { DelegateView } from "../../../../plugins/view/delegate-view.js";
6
- import { EventBus } from "@coding-flow/flow-core";
6
+ import { EventBus, ViewBindPlugin } from "@coding-flow/flow-core";
7
7
  import { PopupModal } from "@coding-flow/flow-mobile-ui";
8
+ import { APPROVAL_ACTION_DELEGATE_KEY } from "../../index.js";
8
9
  const DelegateAction = (props)=>{
9
10
  const action = props.action;
10
11
  const { context } = useApprovalContext();
@@ -36,6 +37,10 @@ const DelegateAction = (props)=>{
36
37
  EventBus.getInstance().off(action.id);
37
38
  };
38
39
  }, []);
40
+ const ActionView = ViewBindPlugin.getInstance().get(APPROVAL_ACTION_DELEGATE_KEY);
41
+ if (ActionView) return /*#__PURE__*/ jsx(ActionView, {
42
+ ...props
43
+ });
39
44
  return /*#__PURE__*/ jsx(Fragment, {
40
45
  children: /*#__PURE__*/ jsx(PopupModal, {
41
46
  title: "委派审批",
@@ -4,8 +4,9 @@ import { Form, TextArea, Toast } from "antd-mobile";
4
4
  import { PopupModal } from "@coding-flow/flow-mobile-ui";
5
5
  import { useApprovalContext } from "@coding-flow/flow-approval-presenter";
6
6
  import { SignKeyView } from "../../../../plugins/view/sign-key-view.js";
7
- import { EventBus } from "@coding-flow/flow-core";
7
+ import { EventBus, ViewBindPlugin } from "@coding-flow/flow-core";
8
8
  import { ManualView } from "../../../../plugins/view/manual-view.js";
9
+ import { APPROVAL_ACTION_PASS_KEY } from "../../index.js";
9
10
  const PassAction = (props)=>{
10
11
  const action = props.action;
11
12
  const { state, context } = useApprovalContext();
@@ -56,6 +57,10 @@ const PassAction = (props)=>{
56
57
  message: '请输入审批意见'
57
58
  }
58
59
  ] : [];
60
+ const ActionView = ViewBindPlugin.getInstance().get(APPROVAL_ACTION_PASS_KEY);
61
+ if (ActionView) return /*#__PURE__*/ jsx(ActionView, {
62
+ ...props
63
+ });
59
64
  return /*#__PURE__*/ jsxs(Fragment, {
60
65
  children: [
61
66
  /*#__PURE__*/ jsx(PopupModal, {
@@ -3,7 +3,8 @@ import react from "react";
3
3
  import { Form, TextArea, Toast } from "antd-mobile";
4
4
  import { useApprovalContext } from "@coding-flow/flow-approval-presenter";
5
5
  import { PopupModal } from "@coding-flow/flow-mobile-ui";
6
- import { EventBus } from "@coding-flow/flow-core";
6
+ import { EventBus, ViewBindPlugin } from "@coding-flow/flow-core";
7
+ import { APPROVAL_ACTION_REJECT_KEY } from "../../index.js";
7
8
  const RejectAction = (props)=>{
8
9
  const action = props.action;
9
10
  const { state, context } = useApprovalContext();
@@ -34,6 +35,10 @@ const RejectAction = (props)=>{
34
35
  message: '请输入审批意见'
35
36
  }
36
37
  ] : [];
38
+ const ActionView = ViewBindPlugin.getInstance().get(APPROVAL_ACTION_REJECT_KEY);
39
+ if (ActionView) return /*#__PURE__*/ jsx(ActionView, {
40
+ ...props
41
+ });
37
42
  return /*#__PURE__*/ jsx(Fragment, {
38
43
  children: /*#__PURE__*/ jsx(PopupModal, {
39
44
  title: "审批拒绝",
@@ -4,7 +4,8 @@ import { Form, Toast } from "antd-mobile";
4
4
  import { useApprovalContext } from "@coding-flow/flow-approval-presenter";
5
5
  import { ReturnView } from "../../../../plugins/view/return-view.js";
6
6
  import { PopupModal } from "@coding-flow/flow-mobile-ui";
7
- import { EventBus } from "@coding-flow/flow-core";
7
+ import { EventBus, ViewBindPlugin } from "@coding-flow/flow-core";
8
+ import { APPROVAL_ACTION_RETURN_KEY } from "../../index.js";
8
9
  const ReturnAction = (props)=>{
9
10
  const action = props.action;
10
11
  const { context } = useApprovalContext();
@@ -36,6 +37,10 @@ const ReturnAction = (props)=>{
36
37
  EventBus.getInstance().off(action.id);
37
38
  };
38
39
  }, []);
40
+ const ActionView = ViewBindPlugin.getInstance().get(APPROVAL_ACTION_RETURN_KEY);
41
+ if (ActionView) return /*#__PURE__*/ jsx(ActionView, {
42
+ ...props
43
+ });
39
44
  return /*#__PURE__*/ jsx(Fragment, {
40
45
  children: /*#__PURE__*/ jsx(PopupModal, {
41
46
  title: "退回审批",
@@ -3,10 +3,14 @@ import "react";
3
3
  import { Button, Toast } from "antd-mobile";
4
4
  import { Popconfirm } from "@coding-flow/flow-mobile-ui";
5
5
  import { useApprovalContext } from "@coding-flow/flow-approval-presenter";
6
+ import { APPROVAL_ACTION_REVOKE_KEY } from "../../index.js";
7
+ import { ViewBindPlugin } from "@coding-flow/flow-core";
6
8
  const RevokeAction = ()=>{
7
9
  const { state, context } = useApprovalContext();
8
10
  const presenter = context.getPresenter().getFlowActionPresenter();
9
11
  const revoke = state.flow?.revoke || false;
12
+ const ActionView = ViewBindPlugin.getInstance().get(APPROVAL_ACTION_REVOKE_KEY);
13
+ if (ActionView) return /*#__PURE__*/ jsx(ActionView, {});
10
14
  return /*#__PURE__*/ jsx(Fragment, {
11
15
  children: revoke && /*#__PURE__*/ jsx(Popconfirm, {
12
16
  title: "确认要撤销审批吗?",
@@ -2,7 +2,8 @@ import { Fragment, jsx } from "react/jsx-runtime";
2
2
  import react from "react";
3
3
  import { Toast } from "antd-mobile";
4
4
  import { useApprovalContext } from "@coding-flow/flow-approval-presenter";
5
- import { EventBus } from "@coding-flow/flow-core";
5
+ import { EventBus, ViewBindPlugin } from "@coding-flow/flow-core";
6
+ import { APPROVAL_ACTION_SAVE_KEY } from "../../index.js";
6
7
  const SaveAction = (props)=>{
7
8
  const action = props.action;
8
9
  const { context } = useApprovalContext();
@@ -17,6 +18,8 @@ const SaveAction = (props)=>{
17
18
  EventBus.getInstance().off(action.id);
18
19
  };
19
20
  }, []);
21
+ const ActionView = ViewBindPlugin.getInstance().get(APPROVAL_ACTION_SAVE_KEY);
22
+ if (ActionView) return /*#__PURE__*/ jsx(ActionView, {});
20
23
  return /*#__PURE__*/ jsx(Fragment, {});
21
24
  };
22
25
  export { SaveAction };
@@ -3,8 +3,9 @@ import react from "react";
3
3
  import { Form, Toast } from "antd-mobile";
4
4
  import { useApprovalContext } from "@coding-flow/flow-approval-presenter";
5
5
  import { TransferView } from "../../../../plugins/view/transfer-view.js";
6
- import { EventBus } from "@coding-flow/flow-core";
6
+ import { EventBus, ViewBindPlugin } from "@coding-flow/flow-core";
7
7
  import { PopupModal } from "@coding-flow/flow-mobile-ui";
8
+ import { APPROVAL_ACTION_TRANSFER_KEY } from "../../index.js";
8
9
  const TransferAction = (props)=>{
9
10
  const action = props.action;
10
11
  const { context } = useApprovalContext();
@@ -36,6 +37,8 @@ const TransferAction = (props)=>{
36
37
  }
37
38
  });
38
39
  };
40
+ const ActionView = ViewBindPlugin.getInstance().get(APPROVAL_ACTION_TRANSFER_KEY);
41
+ if (ActionView) return /*#__PURE__*/ jsx(ActionView, {});
39
42
  return /*#__PURE__*/ jsx(Fragment, {
40
43
  children: /*#__PURE__*/ jsx(PopupModal, {
41
44
  title: "转办审批",
@@ -3,10 +3,14 @@ import "react";
3
3
  import { Button, Toast } from "antd-mobile";
4
4
  import { Popconfirm } from "@coding-flow/flow-mobile-ui";
5
5
  import { useApprovalContext } from "@coding-flow/flow-approval-presenter";
6
+ import { APPROVAL_ACTION_URGE_KEY } from "../../index.js";
7
+ import { ViewBindPlugin } from "@coding-flow/flow-core";
6
8
  const UrgeAction = ()=>{
7
9
  const { state, context } = useApprovalContext();
8
10
  const presenter = context.getPresenter().getFlowActionPresenter();
9
11
  const urge = state.flow?.urge || false;
12
+ const ActionView = ViewBindPlugin.getInstance().get(APPROVAL_ACTION_URGE_KEY);
13
+ if (ActionView) return /*#__PURE__*/ jsx(ActionView, {});
10
14
  return /*#__PURE__*/ jsx(Fragment, {
11
15
  children: urge && /*#__PURE__*/ jsx(Popconfirm, {
12
16
  title: "确认要催办审批用户吗?",
@@ -0,0 +1 @@
1
+ export declare const FlowApprovalActions: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,76 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { useState } from "react";
3
+ import { MoreOutlined } from "@ant-design/icons";
4
+ import { CustomStyleButton } from "./custom-style-button.js";
5
+ import { useLayoutPresenter } from "../layout/hooks/use-layout-presenter.js";
6
+ import { ActionSheet, Button, Space, Toast } from "antd-mobile";
7
+ import { RevokeAction } from "./action/revoke.js";
8
+ import { UrgeAction } from "./action/urge.js";
9
+ import { ActionFactory } from "./action/factory.js";
10
+ import { EventBus, ObjectUtils } from "@coding-flow/flow-core";
11
+ import { useApprovalContext } from "@coding-flow/flow-approval-presenter";
12
+ const FlowApprovalActions = ()=>{
13
+ const { state, context } = useApprovalContext();
14
+ const presenter = useLayoutPresenter();
15
+ const [moreVisible, setMoreVisible] = useState(false);
16
+ const handlerAction = (id)=>{
17
+ if (state.flow?.mergeable) {
18
+ const presenter = context.getPresenter().getFlowActionPresenter();
19
+ const selectRecordIds = presenter.getSubmitRecordIds();
20
+ const currentFormData = presenter.getCurrentFormData();
21
+ if (ObjectUtils.isEmptyObject(currentFormData) && 0 == selectRecordIds.length) return void Toast.show('请先选择审批流程.');
22
+ }
23
+ EventBus.getInstance().emit(id);
24
+ };
25
+ return /*#__PURE__*/ jsxs("div", {
26
+ style: {
27
+ width: '100%',
28
+ height: '100%',
29
+ display: 'flex',
30
+ justifyContent: 'space-around',
31
+ gap: '10px',
32
+ alignItems: 'center'
33
+ },
34
+ children: [
35
+ presenter.getActions().map((action, index)=>ActionFactory.getInstance().render(action)),
36
+ !presenter.isReview() && presenter.getFooterOptions().map((action, index)=>/*#__PURE__*/ jsx(CustomStyleButton, {
37
+ onClick: ()=>{
38
+ handlerAction(action.id);
39
+ },
40
+ display: action.display,
41
+ title: action.title
42
+ }, index)),
43
+ !presenter.isReview() && presenter.hasMoreOptions() && /*#__PURE__*/ jsx(Button, {
44
+ onClick: ()=>setMoreVisible(true),
45
+ style: {
46
+ width: '100%',
47
+ padding: '10px',
48
+ margin: '5px'
49
+ },
50
+ children: /*#__PURE__*/ jsxs(Space, {
51
+ children: [
52
+ /*#__PURE__*/ jsx("span", {
53
+ children: "更多操作"
54
+ }),
55
+ /*#__PURE__*/ jsx(MoreOutlined, {})
56
+ ]
57
+ })
58
+ }),
59
+ /*#__PURE__*/ jsx(RevokeAction, {}),
60
+ /*#__PURE__*/ jsx(UrgeAction, {}),
61
+ /*#__PURE__*/ jsx(ActionSheet, {
62
+ visible: moreVisible,
63
+ onAction: (action)=>{
64
+ handlerAction(action.key);
65
+ },
66
+ cancelText: "取消",
67
+ actions: presenter.getMoreOptions().map((action)=>({
68
+ text: action.title,
69
+ key: action.id
70
+ })),
71
+ onClose: ()=>setMoreVisible(false)
72
+ })
73
+ ]
74
+ });
75
+ };
76
+ export { FlowApprovalActions };
@@ -0,0 +1 @@
1
+ export declare const FlowApprovalContent: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,29 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { FormViewComponent } from "./form-view-component.js";
3
+ import { FlowNodeHistory } from "./flow-node-history.js";
4
+ import react from "react";
5
+ import { Tabs } from "antd-mobile";
6
+ const FlowApprovalContent = ()=>{
7
+ const flowNodeHistoryAction = react.useRef(null);
8
+ return /*#__PURE__*/ jsxs(Tabs, {
9
+ style: {
10
+ width: '100%'
11
+ },
12
+ onChange: (key)=>{
13
+ if ("history" === key) flowNodeHistoryAction.current?.refresh();
14
+ },
15
+ children: [
16
+ /*#__PURE__*/ jsx(Tabs.Tab, {
17
+ title: "流程详情",
18
+ children: /*#__PURE__*/ jsx(FormViewComponent, {})
19
+ }, "detail"),
20
+ /*#__PURE__*/ jsx(Tabs.Tab, {
21
+ title: "流程记录",
22
+ children: /*#__PURE__*/ jsx(FlowNodeHistory, {
23
+ actionRef: flowNodeHistoryAction
24
+ })
25
+ }, "history")
26
+ ]
27
+ });
28
+ };
29
+ export { FlowApprovalContent };
@@ -0,0 +1 @@
1
+ export declare const FlowApprovalTitle: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,10 @@
1
+ import { Fragment, jsx } from "react/jsx-runtime";
2
+ import "react";
3
+ import { useApprovalContext } from "@coding-flow/flow-approval-presenter";
4
+ const FlowApprovalTitle = ()=>{
5
+ const { state } = useApprovalContext();
6
+ return /*#__PURE__*/ jsx(Fragment, {
7
+ children: state.flow?.title || '审批详情'
8
+ });
9
+ };
10
+ export { FlowApprovalTitle };
@@ -1,4 +1,5 @@
1
- import React from "react";
2
- import { type ApprovalPanelProps } from "@coding-flow/flow-approval-presenter";
3
- import "./index.scss";
4
- export declare const ApprovalPanel: React.FC<ApprovalPanelProps>;
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,25 +1,5 @@
1
- import { jsx } from "react/jsx-runtime";
2
- import react from "react";
3
- import { detail } from "../../api/record.js";
4
- import { ApprovalLayout } from "./layout/index.js";
5
- import { useMockContext } from "@coding-flow/flow-approval-presenter";
6
- import "./index.css";
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
- initData: props.initData,
21
- review: props.review
22
- })
23
- });
24
- };
25
- export { ApprovalPanel };
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,35 +1,17 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
2
- import react from "react";
3
- import { Tabs } from "antd-mobile";
4
- import { FormViewComponent } from "../components/form-view-component.js";
5
- import { FlowNodeHistory } from "../components/flow-node-history.js";
1
+ import { jsx } from "react/jsx-runtime";
2
+ import "react";
3
+ import { FlowApprovalContent } from "../components/flow-approval-content.js";
4
+ import { ViewBindPlugin } from "@coding-flow/flow-core";
5
+ import { APPROVAL_BODY_VIEW_KEY } from "../index.js";
6
6
  const Body = (props)=>{
7
- const flowNodeHistoryAction = react.useRef(null);
7
+ const BodyView = ViewBindPlugin.getInstance().get(APPROVAL_BODY_VIEW_KEY);
8
+ if (BodyView) return /*#__PURE__*/ jsx(BodyView, {});
8
9
  return /*#__PURE__*/ jsx("div", {
9
10
  style: {
10
11
  height: props.height,
11
12
  overflowY: "auto"
12
13
  },
13
- children: /*#__PURE__*/ jsxs(Tabs, {
14
- style: {
15
- width: '100%'
16
- },
17
- onChange: (key)=>{
18
- if ("history" === key) flowNodeHistoryAction.current?.refresh();
19
- },
20
- children: [
21
- /*#__PURE__*/ jsx(Tabs.Tab, {
22
- title: "流程详情",
23
- children: /*#__PURE__*/ jsx(FormViewComponent, {})
24
- }, "detail"),
25
- /*#__PURE__*/ jsx(Tabs.Tab, {
26
- title: "流程记录",
27
- children: /*#__PURE__*/ jsx(FlowNodeHistory, {
28
- actionRef: flowNodeHistoryAction
29
- })
30
- }, "history")
31
- ]
32
- })
14
+ children: /*#__PURE__*/ jsx(FlowApprovalContent, {})
33
15
  });
34
16
  };
35
17
  export { Body };
@@ -1,84 +1,18 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
2
- import { useState } from "react";
3
- import { MoreOutlined } from "@ant-design/icons";
1
+ import { jsx } from "react/jsx-runtime";
2
+ import "react";
4
3
  import { FOOTER_HEIGHT } from "../typings/index.js";
5
- import { CustomStyleButton } from "../components/custom-style-button.js";
6
- import { useLayoutPresenter } from "./hooks/use-layout-presenter.js";
7
- import { ActionSheet, Button, Space, Toast } from "antd-mobile";
8
- import { RevokeAction } from "../components/action/revoke.js";
9
- import { UrgeAction } from "../components/action/urge.js";
10
- import { ActionFactory } from "../components/action/factory.js";
11
- import { EventBus, ObjectUtils } from "@coding-flow/flow-core";
12
- import { useApprovalContext } from "@coding-flow/flow-approval-presenter";
4
+ import { APPROVAL_FOOTER_VIEW_KEY, FlowApprovalActions } from "../index.js";
5
+ import { ViewBindPlugin } from "@coding-flow/flow-core";
13
6
  const Footer = ()=>{
14
- const { state, context } = useApprovalContext();
15
- const presenter = useLayoutPresenter();
16
- const [moreVisible, setMoreVisible] = useState(false);
17
- const handlerAction = (id)=>{
18
- if (state.flow?.mergeable) {
19
- const presenter = context.getPresenter().getFlowActionPresenter();
20
- const selectRecordIds = presenter.getSubmitRecordIds();
21
- const currentFormData = presenter.getCurrentFormData();
22
- if (ObjectUtils.isEmptyObject(currentFormData) && 0 == selectRecordIds.length) return void Toast.show('请先选择审批流程.');
23
- }
24
- EventBus.getInstance().emit(id);
25
- };
7
+ const HeaderView = ViewBindPlugin.getInstance().get(APPROVAL_FOOTER_VIEW_KEY);
8
+ if (HeaderView) return /*#__PURE__*/ jsx(HeaderView, {});
26
9
  return /*#__PURE__*/ jsx("div", {
27
10
  style: {
28
11
  height: FOOTER_HEIGHT,
29
12
  width: '100%',
30
13
  borderTop: '1px solid lightgray'
31
14
  },
32
- children: /*#__PURE__*/ jsxs("div", {
33
- style: {
34
- width: '100%',
35
- height: '100%',
36
- display: 'flex',
37
- justifyContent: 'space-around',
38
- gap: '10px',
39
- alignItems: 'center'
40
- },
41
- children: [
42
- presenter.getActions().map((action, index)=>ActionFactory.getInstance().render(action)),
43
- !presenter.isReview() && presenter.getFooterOptions().map((action, index)=>/*#__PURE__*/ jsx(CustomStyleButton, {
44
- onClick: ()=>{
45
- handlerAction(action.id);
46
- },
47
- display: action.display,
48
- title: action.title
49
- }, index)),
50
- !presenter.isReview() && presenter.hasMoreOptions() && /*#__PURE__*/ jsx(Button, {
51
- onClick: ()=>setMoreVisible(true),
52
- style: {
53
- width: '100%',
54
- padding: '10px',
55
- margin: '5px'
56
- },
57
- children: /*#__PURE__*/ jsxs(Space, {
58
- children: [
59
- /*#__PURE__*/ jsx("span", {
60
- children: "更多操作"
61
- }),
62
- /*#__PURE__*/ jsx(MoreOutlined, {})
63
- ]
64
- })
65
- }),
66
- /*#__PURE__*/ jsx(RevokeAction, {}),
67
- /*#__PURE__*/ jsx(UrgeAction, {}),
68
- /*#__PURE__*/ jsx(ActionSheet, {
69
- visible: moreVisible,
70
- onAction: (action)=>{
71
- handlerAction(action.key);
72
- },
73
- cancelText: "取消",
74
- actions: presenter.getMoreOptions().map((action)=>({
75
- text: action.title,
76
- key: action.id
77
- })),
78
- onClose: ()=>setMoreVisible(false)
79
- })
80
- ]
81
- })
15
+ children: /*#__PURE__*/ jsx(FlowApprovalActions, {})
82
16
  });
83
17
  };
84
18
  export { Footer };
@@ -3,8 +3,13 @@ import { NavBar } from "antd-mobile";
3
3
  import "react";
4
4
  import { useApprovalContext } from "@coding-flow/flow-approval-presenter";
5
5
  import { HEADER_HEIGHT } from "../typings/index.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";
6
9
  const Header = ()=>{
7
- const { state, context } = useApprovalContext();
10
+ const { context } = useApprovalContext();
11
+ const HeaderView = ViewBindPlugin.getInstance().get(APPROVAL_HEADER_VIEW_KEY);
12
+ if (HeaderView) return /*#__PURE__*/ jsx(HeaderView, {});
8
13
  return /*#__PURE__*/ jsx(NavBar, {
9
14
  style: {
10
15
  height: HEADER_HEIGHT,
@@ -14,7 +19,7 @@ const Header = ()=>{
14
19
  context.close();
15
20
  },
16
21
  right: false,
17
- children: state.flow?.title || '审批详情'
22
+ children: /*#__PURE__*/ jsx(FlowApprovalTitle, {})
18
23
  });
19
24
  };
20
25
  export { Header };
@@ -25,6 +25,7 @@ const ApprovalLayoutScope = (props)=>{
25
25
  return /*#__PURE__*/ jsx(ApprovalContext.Provider, {
26
26
  value: context,
27
27
  children: /*#__PURE__*/ jsxs("div", {
28
+ className: props.className,
28
29
  style: {
29
30
  margin: 0,
30
31
  padding: 0
@@ -0,0 +1,13 @@
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_CUSTOM_KEY = "APPROVAL_ACTION_CUSTOM_KEY";
6
+ export declare const APPROVAL_ACTION_DELEGATE_KEY = "APPROVAL_ACTION_DELEGATE_KEY";
7
+ export declare const APPROVAL_ACTION_PASS_KEY = "APPROVAL_ACTION_PASS_KEY";
8
+ export declare const APPROVAL_ACTION_REJECT_KEY = "APPROVAL_ACTION_REJECT_KEY";
9
+ export declare const APPROVAL_ACTION_RETURN_KEY = "APPROVAL_ACTION_RETURN_KEY";
10
+ export declare const APPROVAL_ACTION_REVOKE_KEY = "APPROVAL_ACTION_REVOKE_KEY";
11
+ export declare const APPROVAL_ACTION_SAVE_KEY = "APPROVAL_ACTION_SAVE_KEY";
12
+ export declare const APPROVAL_ACTION_TRANSFER_KEY = "APPROVAL_ACTION_TRANSFER_KEY";
13
+ export declare const APPROVAL_ACTION_URGE_KEY = "APPROVAL_ACTION_URGE_KEY";
@@ -0,0 +1,14 @@
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_CUSTOM_KEY = 'APPROVAL_ACTION_CUSTOM_KEY';
6
+ const APPROVAL_ACTION_DELEGATE_KEY = 'APPROVAL_ACTION_DELEGATE_KEY';
7
+ const APPROVAL_ACTION_PASS_KEY = 'APPROVAL_ACTION_PASS_KEY';
8
+ const APPROVAL_ACTION_REJECT_KEY = 'APPROVAL_ACTION_REJECT_KEY';
9
+ const APPROVAL_ACTION_RETURN_KEY = 'APPROVAL_ACTION_RETURN_KEY';
10
+ const APPROVAL_ACTION_REVOKE_KEY = 'APPROVAL_ACTION_REVOKE_KEY';
11
+ const APPROVAL_ACTION_SAVE_KEY = 'APPROVAL_ACTION_SAVE_KEY';
12
+ const APPROVAL_ACTION_TRANSFER_KEY = 'APPROVAL_ACTION_TRANSFER_KEY';
13
+ const APPROVAL_ACTION_URGE_KEY = 'APPROVAL_ACTION_URGE_KEY';
14
+ export { APPROVAL_ACTION_ADD_AUDIT_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,4 @@
1
+ import React from "react";
2
+ import { type ApprovalPanelProps } from "@coding-flow/flow-approval-presenter";
3
+ import "./index.scss";
4
+ export declare const ApprovalPanel: React.FC<ApprovalPanelProps>;
@@ -0,0 +1,25 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import react from "react";
3
+ import { detail } from "../../api/record.js";
4
+ import { ApprovalLayout } from "./layout/index.js";
5
+ import { useMockContext } from "@coding-flow/flow-approval-presenter";
6
+ import "./index.css";
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
+ initData: props.initData,
21
+ review: props.review
22
+ })
23
+ });
24
+ };
25
+ export { ApprovalPanel };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coding-flow/flow-mobile-approval",
3
- "version": "0.0.11",
3
+ "version": "0.0.13",
4
4
  "description": "flow-engine pc mobile approval components",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -39,15 +39,15 @@
39
39
  "dayjs": "^1.11.19",
40
40
  "immer": "^11.1.3",
41
41
  "react-redux": "^9.2.0",
42
- "@coding-flow/flow-types": "0.0.11",
43
- "@coding-flow/flow-approval-presenter": "0.0.11",
44
- "@coding-flow/flow-core": "0.0.11",
45
- "@coding-flow/flow-mobile-ui": "0.0.11",
46
- "@coding-flow/flow-icons": "0.0.11",
47
- "@coding-flow/flow-mobile-form": "0.0.11"
42
+ "@coding-flow/flow-core": "0.0.13",
43
+ "@coding-flow/flow-icons": "0.0.13",
44
+ "@coding-flow/flow-approval-presenter": "0.0.13",
45
+ "@coding-flow/flow-mobile-ui": "0.0.13",
46
+ "@coding-flow/flow-types": "0.0.13",
47
+ "@coding-flow/flow-mobile-form": "0.0.13"
48
48
  },
49
49
  "devDependencies": {
50
- "@coding-flow/flow-types": "0.0.11"
50
+ "@coding-flow/flow-types": "0.0.13"
51
51
  },
52
52
  "scripts": {
53
53
  "build": "rslib build",