@coding-flow/flow-pc-approval 0.0.6 → 0.0.8

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.
@@ -4,21 +4,30 @@ import { Form, Input, Modal, message } from "antd";
4
4
  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
+ import { ManualView } from "../../../../plugins/view/manual-view.js";
7
8
  const { TextArea } = Input;
8
9
  const PassAction = (props)=>{
9
10
  const action = props.action;
10
11
  const { state, context } = useApprovalContext();
11
12
  const actionPresenter = context.getPresenter().getFlowActionPresenter();
12
13
  const [modalVisible, setModalVisible] = react.useState(false);
14
+ const [options, setOptions] = react.useState([]);
15
+ const [request, setRequest] = react.useState({});
13
16
  const isStartNode = state.flow?.nodeType === 'START';
14
17
  const currentOperator = state.flow?.currentOperator;
15
18
  const [form] = Form.useForm();
16
19
  const handleSubmit = (params)=>{
17
20
  actionPresenter.action(action.id, params).then((res)=>{
18
21
  if (res.success) {
19
- message.success("操作成功");
20
- setModalVisible(false);
21
- context.close();
22
+ const options = res.data?.options || [];
23
+ if (options.length > 0) {
24
+ setRequest(params);
25
+ setOptions(options);
26
+ } else {
27
+ message.success("操作成功");
28
+ setModalVisible(false);
29
+ context.close();
30
+ }
22
31
  }
23
32
  });
24
33
  };
@@ -81,6 +90,16 @@ const PassAction = (props)=>{
81
90
  })
82
91
  ]
83
92
  })
93
+ }),
94
+ options && options.length > 0 && /*#__PURE__*/ jsx(ManualView, {
95
+ options: options,
96
+ onChange: (value)=>{
97
+ setOptions([]);
98
+ if (value) handleSubmit({
99
+ ...request,
100
+ manualNodeId: value
101
+ });
102
+ }
84
103
  })
85
104
  ]
86
105
  });
@@ -32,9 +32,9 @@ const CustomStyleButton = (props)=>{
32
32
  return /*#__PURE__*/ jsx(Button, {
33
33
  onClick: props.onClick,
34
34
  style: style,
35
- icon: /*#__PURE__*/ jsx(Icon, {
35
+ icon: display.icon ? /*#__PURE__*/ jsx(Icon, {
36
36
  type: display.icon
37
- }),
37
+ }) : void 0,
38
38
  children: title
39
39
  });
40
40
  };
@@ -138,7 +138,7 @@ const FlowTimeNode = (props)=>{
138
138
  operators.map((operator)=>/*#__PURE__*/ jsx(FlowOperatorItem, {
139
139
  operator: operator,
140
140
  state: node.state
141
- }))
141
+ }, operator.flowOperator.id))
142
142
  ]
143
143
  });
144
144
  };
@@ -0,0 +1,3 @@
1
+ import React from "react";
2
+ import { ManualViewPlugin } from "@coding-flow/flow-approval-presenter";
3
+ export declare const ManualView: React.FC<ManualViewPlugin>;
@@ -0,0 +1,44 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import react from "react";
3
+ import { ManualViewPluginKey } from "@coding-flow/flow-approval-presenter";
4
+ import { ViewBindPlugin } from "@coding-flow/flow-core";
5
+ import { Form, Modal, Select } from "antd";
6
+ const ManualView = (props)=>{
7
+ const [visible, setVisible] = react.useState(true);
8
+ const ManualViewComponent = ViewBindPlugin.getInstance().get(ManualViewPluginKey);
9
+ const [form] = Form.useForm();
10
+ const handleOk = (value)=>{
11
+ props.onChange(value?.manualNodeId || '');
12
+ setVisible(false);
13
+ };
14
+ if (ManualViewComponent) return /*#__PURE__*/ jsx(ManualViewComponent, {
15
+ ...props
16
+ });
17
+ return /*#__PURE__*/ jsx(Modal, {
18
+ title: "请选择下级节点",
19
+ width: "40%",
20
+ open: visible,
21
+ destroyOnHidden: true,
22
+ onCancel: ()=>setVisible(false),
23
+ onOk: ()=>{
24
+ form.submit();
25
+ },
26
+ children: /*#__PURE__*/ jsx(Form, {
27
+ form: form,
28
+ onFinish: handleOk,
29
+ layout: "vertical",
30
+ children: /*#__PURE__*/ jsx(Form.Item, {
31
+ name: "manualNodeId",
32
+ label: "下级节点",
33
+ children: /*#__PURE__*/ jsx(Select, {
34
+ placeholder: "请选择下级节点走向",
35
+ options: props.options.map((item)=>({
36
+ value: item.id,
37
+ label: item.name
38
+ }))
39
+ })
40
+ })
41
+ })
42
+ });
43
+ };
44
+ export { ManualView };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coding-flow/flow-pc-approval",
3
- "version": "0.0.6",
3
+ "version": "0.0.8",
4
4
  "description": "flow-engine pc form 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-core": "0.0.6",
43
- "@coding-flow/flow-icons": "0.0.6",
44
- "@coding-flow/flow-pc-ui": "0.0.6",
45
- "@coding-flow/flow-types": "0.0.6",
46
- "@coding-flow/flow-pc-form": "0.0.6",
47
- "@coding-flow/flow-approval-presenter": "0.0.6"
42
+ "@coding-flow/flow-core": "0.0.8",
43
+ "@coding-flow/flow-types": "0.0.8",
44
+ "@coding-flow/flow-icons": "0.0.8",
45
+ "@coding-flow/flow-pc-ui": "0.0.8",
46
+ "@coding-flow/flow-approval-presenter": "0.0.8",
47
+ "@coding-flow/flow-pc-form": "0.0.8"
48
48
  },
49
49
  "devDependencies": {
50
- "@coding-flow/flow-types": "0.0.6"
50
+ "@coding-flow/flow-types": "0.0.8"
51
51
  },
52
52
  "scripts": {
53
53
  "build": "rslib build",