@coding-flow/flow-mobile-approval 0.0.1

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 (71) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +67 -0
  3. package/dist/api/index.d.ts +2 -0
  4. package/dist/api/index.js +12 -0
  5. package/dist/api/record.d.ts +10 -0
  6. package/dist/api/record.js +48 -0
  7. package/dist/api/workflow.d.ts +3 -0
  8. package/dist/api/workflow.js +7 -0
  9. package/dist/components/flow-approval/components/action/add-audit.d.ts +8 -0
  10. package/dist/components/flow-approval/components/action/add-audit.js +62 -0
  11. package/dist/components/flow-approval/components/action/custom.d.ts +8 -0
  12. package/dist/components/flow-approval/components/action/custom.js +17 -0
  13. package/dist/components/flow-approval/components/action/delegate.d.ts +8 -0
  14. package/dist/components/flow-approval/components/action/delegate.js +62 -0
  15. package/dist/components/flow-approval/components/action/factory.d.ts +9 -0
  16. package/dist/components/flow-approval/components/action/factory.js +38 -0
  17. package/dist/components/flow-approval/components/action/pass.d.ts +8 -0
  18. package/dist/components/flow-approval/components/action/pass.js +87 -0
  19. package/dist/components/flow-approval/components/action/reject.d.ts +8 -0
  20. package/dist/components/flow-approval/components/action/reject.js +64 -0
  21. package/dist/components/flow-approval/components/action/return.d.ts +8 -0
  22. package/dist/components/flow-approval/components/action/return.js +62 -0
  23. package/dist/components/flow-approval/components/action/revoke.d.ts +1 -0
  24. package/dist/components/flow-approval/components/action/revoke.js +32 -0
  25. package/dist/components/flow-approval/components/action/save.d.ts +8 -0
  26. package/dist/components/flow-approval/components/action/save.js +22 -0
  27. package/dist/components/flow-approval/components/action/transfer.d.ts +8 -0
  28. package/dist/components/flow-approval/components/action/transfer.js +62 -0
  29. package/dist/components/flow-approval/components/action/type.d.ts +4 -0
  30. package/dist/components/flow-approval/components/action/type.js +0 -0
  31. package/dist/components/flow-approval/components/action/urge.d.ts +1 -0
  32. package/dist/components/flow-approval/components/action/urge.js +29 -0
  33. package/dist/components/flow-approval/components/custom-style-button.d.ts +9 -0
  34. package/dist/components/flow-approval/components/custom-style-button.js +52 -0
  35. package/dist/components/flow-approval/components/flow-node-history.d.ts +9 -0
  36. package/dist/components/flow-approval/components/flow-node-history.js +46 -0
  37. package/dist/components/flow-approval/components/flow-time-node.d.ts +9 -0
  38. package/dist/components/flow-approval/components/flow-time-node.js +59 -0
  39. package/dist/components/flow-approval/components/form-view-component.d.ts +6 -0
  40. package/dist/components/flow-approval/components/form-view-component.js +68 -0
  41. package/dist/components/flow-approval/index.css +5 -0
  42. package/dist/components/flow-approval/index.d.ts +10 -0
  43. package/dist/components/flow-approval/index.js +24 -0
  44. package/dist/components/flow-approval/layout/body.d.ts +6 -0
  45. package/dist/components/flow-approval/layout/body.js +35 -0
  46. package/dist/components/flow-approval/layout/footer.d.ts +1 -0
  47. package/dist/components/flow-approval/layout/footer.js +84 -0
  48. package/dist/components/flow-approval/layout/header.d.ts +1 -0
  49. package/dist/components/flow-approval/layout/header.js +20 -0
  50. package/dist/components/flow-approval/layout/hooks/use-layout-presenter.d.ts +2 -0
  51. package/dist/components/flow-approval/layout/hooks/use-layout-presenter.js +7 -0
  52. package/dist/components/flow-approval/layout/index.d.ts +3 -0
  53. package/dist/components/flow-approval/layout/index.js +44 -0
  54. package/dist/components/flow-approval/layout/presenter.d.ts +15 -0
  55. package/dist/components/flow-approval/layout/presenter.js +40 -0
  56. package/dist/components/flow-approval/typings/index.d.ts +4 -0
  57. package/dist/components/flow-approval/typings/index.js +5 -0
  58. package/dist/favicon.png +0 -0
  59. package/dist/index.d.ts +1 -0
  60. package/dist/index.js +1 -0
  61. package/dist/plugins/view/add-audit-view.d.ts +3 -0
  62. package/dist/plugins/view/add-audit-view.js +39 -0
  63. package/dist/plugins/view/delegate-view.d.ts +3 -0
  64. package/dist/plugins/view/delegate-view.js +39 -0
  65. package/dist/plugins/view/return-view.d.ts +3 -0
  66. package/dist/plugins/view/return-view.js +47 -0
  67. package/dist/plugins/view/sign-key-view.d.ts +3 -0
  68. package/dist/plugins/view/sign-key-view.js +19 -0
  69. package/dist/plugins/view/transfer-view.d.ts +3 -0
  70. package/dist/plugins/view/transfer-view.js +39 -0
  71. package/package.json +57 -0
@@ -0,0 +1,68 @@
1
+ import { Fragment, jsx } from "react/jsx-runtime";
2
+ import react from "react";
3
+ import { useApprovalContext } from "@coding-flow/flow-approval-presenter";
4
+ import { ViewBindPlugin } from "@coding-flow/flow-core";
5
+ import { Form } from "antd-mobile";
6
+ import { FlowFormView } from "@coding-flow/flow-mobile-form";
7
+ const FormViewComponent = (props)=>{
8
+ const { state, context } = useApprovalContext();
9
+ const review = state.review || false;
10
+ const ViewComponent = ViewBindPlugin.getInstance().get(state.flow?.view || 'default') || FlowFormView;
11
+ const flowForm = state.flow?.form;
12
+ const fieldPermissions = state.flow?.fieldPermissions || [];
13
+ const mergeable = state.flow?.mergeable || false;
14
+ const todos = state.flow?.todos || [];
15
+ const formList = todos.length > 0 ? todos.map((item)=>({
16
+ form: Form.useForm()[0],
17
+ data: item
18
+ })) : [
19
+ {
20
+ form: Form.useForm()[0],
21
+ data: void 0
22
+ }
23
+ ];
24
+ react.useEffect(()=>{
25
+ formList.forEach((item)=>{
26
+ const formInstance = item.form;
27
+ const formRecord = item.data?.data;
28
+ context.getPresenter().getFormActionContext().addAction({
29
+ save: ()=>formInstance.getFieldsValue(),
30
+ key: ()=>'view-form',
31
+ validate: ()=>new Promise((resolve, reject)=>{
32
+ formInstance.validateFields().then(resolve).catch(reject);
33
+ })
34
+ });
35
+ formInstance.resetFields();
36
+ formInstance.setFieldsValue({
37
+ ...formRecord,
38
+ recordId: item.data?.recordId
39
+ });
40
+ });
41
+ }, []);
42
+ const handleMergeRecordIdsSelected = (recordIds)=>{
43
+ context.getPresenter().getFlowActionPresenter().setSubmitRecordIds(recordIds);
44
+ };
45
+ if (ViewComponent && flowForm) {
46
+ if (mergeable) return /*#__PURE__*/ jsx(ViewComponent, {
47
+ mergeable: mergeable,
48
+ fieldPermissions: fieldPermissions,
49
+ review: review,
50
+ meta: flowForm,
51
+ formList: formList,
52
+ onValuesChange: props.onValuesChange,
53
+ onMergeRecordIdsSelected: handleMergeRecordIdsSelected
54
+ });
55
+ return /*#__PURE__*/ jsx(Fragment, {
56
+ children: formList.map((item, index)=>/*#__PURE__*/ jsx(ViewComponent, {
57
+ data: item.data,
58
+ mergeable: mergeable,
59
+ fieldPermissions: fieldPermissions,
60
+ review: review,
61
+ meta: flowForm,
62
+ form: item.form,
63
+ onValuesChange: props.onValuesChange
64
+ }, index))
65
+ });
66
+ }
67
+ };
68
+ export { FormViewComponent };
@@ -0,0 +1,5 @@
1
+ body {
2
+ margin: 0 !important;
3
+ padding: 0 !important;
4
+ }
5
+
@@ -0,0 +1,10 @@
1
+ import React from "react";
2
+ import "./index.scss";
3
+ interface ApprovalPanelProps {
4
+ workflowCode?: string;
5
+ recordId?: string;
6
+ onClose?: () => void;
7
+ review?: boolean;
8
+ }
9
+ export declare const ApprovalPanel: React.FC<ApprovalPanelProps>;
10
+ export {};
@@ -0,0 +1,24 @@
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
+ review: props.review
21
+ })
22
+ });
23
+ };
24
+ export { ApprovalPanel };
@@ -0,0 +1,6 @@
1
+ import React from "react";
2
+ interface BodyProps {
3
+ height: string;
4
+ }
5
+ export declare const Body: React.FC<BodyProps>;
6
+ export {};
@@ -0,0 +1,35 @@
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";
6
+ const Body = (props)=>{
7
+ const flowNodeHistoryAction = react.useRef(null);
8
+ return /*#__PURE__*/ jsx("div", {
9
+ style: {
10
+ height: props.height,
11
+ overflowY: "auto"
12
+ },
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
+ })
33
+ });
34
+ };
35
+ export { Body };
@@ -0,0 +1 @@
1
+ export declare const Footer: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,84 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { useState } from "react";
3
+ import { MoreOutlined } from "@ant-design/icons";
4
+ 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";
13
+ 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
+ };
26
+ return /*#__PURE__*/ jsx("div", {
27
+ style: {
28
+ height: FOOTER_HEIGHT,
29
+ width: '100%',
30
+ borderTop: '1px solid lightgray'
31
+ },
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
+ })
82
+ });
83
+ };
84
+ export { Footer };
@@ -0,0 +1 @@
1
+ export declare const Header: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,20 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { NavBar } from "antd-mobile";
3
+ import "react";
4
+ import { useApprovalContext } from "@coding-flow/flow-approval-presenter";
5
+ import { HEADER_HEIGHT } from "../typings/index.js";
6
+ const Header = ()=>{
7
+ const { state, context } = useApprovalContext();
8
+ return /*#__PURE__*/ jsx(NavBar, {
9
+ style: {
10
+ height: HEADER_HEIGHT,
11
+ borderBottom: '1px solid lightgray'
12
+ },
13
+ onBack: ()=>{
14
+ context.close();
15
+ },
16
+ right: false,
17
+ children: state.flow?.title || '审批详情'
18
+ });
19
+ };
20
+ export { Header };
@@ -0,0 +1,2 @@
1
+ import { LayoutPresenter } from "../presenter";
2
+ export declare const useLayoutPresenter: () => LayoutPresenter;
@@ -0,0 +1,7 @@
1
+ import { useApprovalContext } from "@coding-flow/flow-approval-presenter";
2
+ import { LayoutPresenter } from "../presenter.js";
3
+ const useLayoutPresenter = ()=>{
4
+ const { state } = useApprovalContext();
5
+ return new LayoutPresenter(state);
6
+ };
7
+ export { useLayoutPresenter };
@@ -0,0 +1,3 @@
1
+ import React from "react";
2
+ import { ApprovalLayoutProps } from "@coding-flow/flow-approval-presenter";
3
+ export declare const ApprovalLayout: React.FC<ApprovalLayoutProps>;
@@ -0,0 +1,44 @@
1
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
+ import "react";
3
+ import { ApprovalContext, approvalStore, createApprovalContext } from "@coding-flow/flow-approval-presenter";
4
+ import { Provider } from "react-redux";
5
+ import { BODY_HEIGHT, BODY_MAX_HEIGHT } from "../typings/index.js";
6
+ import { Header } from "./header.js";
7
+ import { Body } from "./body.js";
8
+ import { Footer } from "./footer.js";
9
+ import { useLayoutPresenter } from "./hooks/use-layout-presenter.js";
10
+ const ApprovalContent = ()=>{
11
+ const presenter = useLayoutPresenter();
12
+ const hasFooter = presenter.hasFooter();
13
+ return /*#__PURE__*/ jsxs(Fragment, {
14
+ children: [
15
+ /*#__PURE__*/ jsx(Body, {
16
+ height: hasFooter ? BODY_HEIGHT : BODY_MAX_HEIGHT
17
+ }),
18
+ hasFooter && /*#__PURE__*/ jsx(Footer, {})
19
+ ]
20
+ });
21
+ };
22
+ const ApprovalLayoutScope = (props)=>{
23
+ const { context } = createApprovalContext(props);
24
+ return /*#__PURE__*/ jsx(ApprovalContext.Provider, {
25
+ value: context,
26
+ children: /*#__PURE__*/ jsxs("div", {
27
+ style: {
28
+ margin: 0,
29
+ padding: 0
30
+ },
31
+ children: [
32
+ /*#__PURE__*/ jsx(Header, {}),
33
+ /*#__PURE__*/ jsx(ApprovalContent, {})
34
+ ]
35
+ })
36
+ });
37
+ };
38
+ const ApprovalLayout = (props)=>/*#__PURE__*/ jsx(Provider, {
39
+ store: approvalStore,
40
+ children: /*#__PURE__*/ jsx(ApprovalLayoutScope, {
41
+ ...props
42
+ })
43
+ });
44
+ export { ApprovalLayout };
@@ -0,0 +1,15 @@
1
+ import { FlowAction } from "@coding-flow/flow-types";
2
+ import { ApprovalState } from "@coding-flow/flow-approval-presenter";
3
+ export declare class LayoutPresenter {
4
+ private static readonly MAX_OPTION_SIZE;
5
+ private readonly state;
6
+ private readonly actions;
7
+ private readonly review;
8
+ constructor(state: ApprovalState);
9
+ hasFooter(): boolean;
10
+ isReview(): boolean;
11
+ getActions(): FlowAction[];
12
+ getFooterOptions(): FlowAction[];
13
+ hasMoreOptions(): boolean;
14
+ getMoreOptions(): FlowAction[];
15
+ }
@@ -0,0 +1,40 @@
1
+ class LayoutPresenter {
2
+ static MAX_OPTION_SIZE = 3;
3
+ state;
4
+ actions;
5
+ review;
6
+ constructor(state){
7
+ this.state = state;
8
+ this.actions = state.flow?.actions || [];
9
+ this.review = state.review || false;
10
+ }
11
+ hasFooter() {
12
+ if (this.review) {
13
+ if (this.state.flow?.revoke) return true;
14
+ if (this.state.flow?.urge) return true;
15
+ return false;
16
+ }
17
+ return true;
18
+ }
19
+ isReview() {
20
+ return this.review;
21
+ }
22
+ getActions() {
23
+ return this.actions;
24
+ }
25
+ getFooterOptions() {
26
+ const options = [];
27
+ for(let i = 0; i < this.actions.length; i++){
28
+ const action = this.actions[i];
29
+ if (i < LayoutPresenter.MAX_OPTION_SIZE) options.push(action);
30
+ }
31
+ return options;
32
+ }
33
+ hasMoreOptions() {
34
+ return this.actions.length > LayoutPresenter.MAX_OPTION_SIZE;
35
+ }
36
+ getMoreOptions() {
37
+ return this.actions.slice(LayoutPresenter.MAX_OPTION_SIZE);
38
+ }
39
+ }
40
+ export { LayoutPresenter };
@@ -0,0 +1,4 @@
1
+ export declare const HEADER_HEIGHT = "60px";
2
+ export declare const FOOTER_HEIGHT = "80px";
3
+ export declare const BODY_HEIGHT = "calc(100vh - 140px)";
4
+ export declare const BODY_MAX_HEIGHT = "calc(100vh - 60px)";
@@ -0,0 +1,5 @@
1
+ const HEADER_HEIGHT = '60px';
2
+ const FOOTER_HEIGHT = '80px';
3
+ const BODY_HEIGHT = 'calc(100vh - 140px)';
4
+ const BODY_MAX_HEIGHT = 'calc(100vh - 60px)';
5
+ export { BODY_HEIGHT, BODY_MAX_HEIGHT, FOOTER_HEIGHT, HEADER_HEIGHT };
Binary file
@@ -0,0 +1 @@
1
+ export * from './components/flow-approval';
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ export * from "./components/flow-approval/index.js";
@@ -0,0 +1,3 @@
1
+ import React from "react";
2
+ import { AddAuditViewPlugin } from "@coding-flow/flow-approval-presenter";
3
+ export declare const AddAuditView: React.FC<AddAuditViewPlugin>;
@@ -0,0 +1,39 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import react from "react";
3
+ import { AddAuditViewPluginKey, useApprovalContext } from "@coding-flow/flow-approval-presenter";
4
+ import { ViewBindPlugin } from "@coding-flow/flow-core";
5
+ import { Selector } from "antd-mobile";
6
+ const AddAuditView = (props)=>{
7
+ const AddAuditViewComponent = ViewBindPlugin.getInstance().get(AddAuditViewPluginKey);
8
+ const { state } = useApprovalContext();
9
+ const value = react.useMemo(()=>{
10
+ if (props.value) if (Array.isArray(props.value)) return props.value;
11
+ else return [
12
+ props.value
13
+ ];
14
+ return [];
15
+ }, [
16
+ props.value
17
+ ]);
18
+ const createOperator = state.flow?.createOperator;
19
+ const options = createOperator ? [
20
+ {
21
+ label: createOperator.name,
22
+ value: createOperator.id + ''
23
+ }
24
+ ] : [];
25
+ if (AddAuditViewComponent) return /*#__PURE__*/ jsx(AddAuditViewComponent, {
26
+ ...props
27
+ });
28
+ const handleChange = (value)=>{
29
+ props.onChange?.(value);
30
+ };
31
+ return /*#__PURE__*/ jsx(Selector, {
32
+ value: value,
33
+ onChange: (value, option)=>{
34
+ handleChange(value);
35
+ },
36
+ options: options
37
+ });
38
+ };
39
+ export { AddAuditView };
@@ -0,0 +1,3 @@
1
+ import React from "react";
2
+ import { DelegateViewPlugin } from "@coding-flow/flow-approval-presenter";
3
+ export declare const DelegateView: React.FC<DelegateViewPlugin>;
@@ -0,0 +1,39 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import react from "react";
3
+ import { DelegateViewPluginKey, useApprovalContext } from "@coding-flow/flow-approval-presenter";
4
+ import { ViewBindPlugin } from "@coding-flow/flow-core";
5
+ import { Selector } from "antd-mobile";
6
+ const DelegateView = (props)=>{
7
+ const DelegateViewComponent = ViewBindPlugin.getInstance().get(DelegateViewPluginKey);
8
+ const { state } = useApprovalContext();
9
+ const value = react.useMemo(()=>{
10
+ if (props.value) if (Array.isArray(props.value)) return props.value;
11
+ else return [
12
+ props.value
13
+ ];
14
+ return [];
15
+ }, [
16
+ props.value
17
+ ]);
18
+ const createOperator = state.flow?.createOperator;
19
+ const options = createOperator ? [
20
+ {
21
+ label: createOperator.name,
22
+ value: createOperator.id + ''
23
+ }
24
+ ] : [];
25
+ if (DelegateViewComponent) return /*#__PURE__*/ jsx(DelegateViewComponent, {
26
+ ...props
27
+ });
28
+ const handleChange = (value)=>{
29
+ props.onChange?.(value);
30
+ };
31
+ return /*#__PURE__*/ jsx(Selector, {
32
+ value: value,
33
+ onChange: (value, option)=>{
34
+ handleChange(value);
35
+ },
36
+ options: options
37
+ });
38
+ };
39
+ export { DelegateView };
@@ -0,0 +1,3 @@
1
+ import React from "react";
2
+ import { ReturnViewPlugin } from "@coding-flow/flow-approval-presenter";
3
+ export declare const ReturnView: React.FC<ReturnViewPlugin>;
@@ -0,0 +1,47 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import react from "react";
3
+ import { ReturnViewPluginKey, useApprovalContext } from "@coding-flow/flow-approval-presenter";
4
+ import { ViewBindPlugin } from "@coding-flow/flow-core";
5
+ import { Selector } from "antd-mobile";
6
+ const ReturnView = (props)=>{
7
+ const ReturnViewComponent = ViewBindPlugin.getInstance().get(ReturnViewPluginKey);
8
+ const { state } = useApprovalContext();
9
+ const value = react.useMemo(()=>{
10
+ if (props.value) if (Array.isArray(props.value)) return props.value;
11
+ else return [
12
+ props.value
13
+ ];
14
+ return [];
15
+ }, [
16
+ props.value
17
+ ]);
18
+ const nodeOptions = react.useMemo(()=>{
19
+ const nodes = state.flow?.nodes || [];
20
+ const currentId = state.flow?.nodeId || '';
21
+ const options = [];
22
+ for (const node of nodes){
23
+ if (currentId === node.id) break;
24
+ if (node.display) options.push({
25
+ label: node.name,
26
+ value: node.id
27
+ });
28
+ }
29
+ return options;
30
+ }, [
31
+ state.flow?.nodes
32
+ ]);
33
+ if (ReturnViewComponent) return /*#__PURE__*/ jsx(ReturnViewComponent, {
34
+ ...props
35
+ });
36
+ const handleChange = (value)=>{
37
+ props.onChange?.(value);
38
+ };
39
+ return /*#__PURE__*/ jsx(Selector, {
40
+ value: value,
41
+ onChange: (value, option)=>{
42
+ handleChange(value);
43
+ },
44
+ options: nodeOptions
45
+ });
46
+ };
47
+ export { ReturnView };
@@ -0,0 +1,3 @@
1
+ import React from "react";
2
+ import { SignKeyViewPlugin } from "@coding-flow/flow-approval-presenter";
3
+ export declare const SignKeyView: React.FC<SignKeyViewPlugin>;
@@ -0,0 +1,19 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import "react";
3
+ import { SignKeyViewPluginKey } from "@coding-flow/flow-approval-presenter";
4
+ import { ViewBindPlugin } from "@coding-flow/flow-core";
5
+ import { TextArea } from "antd-mobile";
6
+ const SignKeyView = (props)=>{
7
+ const SignKeyViewComponent = ViewBindPlugin.getInstance().get(SignKeyViewPluginKey);
8
+ if (SignKeyViewComponent) return /*#__PURE__*/ jsx(SignKeyViewComponent, {
9
+ ...props
10
+ });
11
+ return /*#__PURE__*/ jsx(TextArea, {
12
+ value: props.value,
13
+ placeholder: "请输入审批签名",
14
+ onChange: (value)=>{
15
+ props.onChange?.(value);
16
+ }
17
+ });
18
+ };
19
+ export { SignKeyView };
@@ -0,0 +1,3 @@
1
+ import React from "react";
2
+ import { TransferViewPlugin } from "@coding-flow/flow-approval-presenter";
3
+ export declare const TransferView: React.FC<TransferViewPlugin>;
@@ -0,0 +1,39 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import react from "react";
3
+ import { TransferViewPluginKey, useApprovalContext } from "@coding-flow/flow-approval-presenter";
4
+ import { ViewBindPlugin } from "@coding-flow/flow-core";
5
+ import { Selector } from "antd-mobile";
6
+ const TransferView = (props)=>{
7
+ const TransferViewComponent = ViewBindPlugin.getInstance().get(TransferViewPluginKey);
8
+ const { state } = useApprovalContext();
9
+ const value = react.useMemo(()=>{
10
+ if (props.value) if (Array.isArray(props.value)) return props.value;
11
+ else return [
12
+ props.value
13
+ ];
14
+ return [];
15
+ }, [
16
+ props.value
17
+ ]);
18
+ const createOperator = state.flow?.createOperator;
19
+ const options = createOperator ? [
20
+ {
21
+ label: createOperator.name,
22
+ value: createOperator.id + ''
23
+ }
24
+ ] : [];
25
+ if (TransferViewComponent) return /*#__PURE__*/ jsx(TransferViewComponent, {
26
+ ...props
27
+ });
28
+ const handleChange = (value)=>{
29
+ props.onChange?.(value);
30
+ };
31
+ return /*#__PURE__*/ jsx(Selector, {
32
+ value: value,
33
+ onChange: (value, option)=>{
34
+ handleChange(value);
35
+ },
36
+ options: options
37
+ });
38
+ };
39
+ export { TransferView };