@coding-flow/flow-pc-approval 0.0.46 → 0.0.48
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.
|
@@ -2,36 +2,26 @@ 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 {
|
|
5
|
+
import { EventBus, ViewBindPlugin } from "@coding-flow/flow-core";
|
|
6
6
|
import { ActionFactory } from "./factory.js";
|
|
7
7
|
import { CustomStyleButton } from "../custom-style-button.js";
|
|
8
8
|
import { APPROVAL_ACTION_CUSTOM_KEY } from "../../index.js";
|
|
9
9
|
const CustomAction = (props)=>{
|
|
10
|
+
console.log('custom11:', props);
|
|
10
11
|
const action = props.action;
|
|
11
12
|
const { context } = useApprovalContext();
|
|
12
13
|
const actionPresenter = context.getPresenter().getFlowActionPresenter();
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const triggerType = returnData.replaceAll('\'', '');
|
|
14
|
+
const triggerType = action.triggerType;
|
|
15
|
+
const triggerFrontEvent = action.triggerFrontEvent;
|
|
16
16
|
const ActionView = ViewBindPlugin.getInstance().get(APPROVAL_ACTION_CUSTOM_KEY);
|
|
17
17
|
if (ActionView) return /*#__PURE__*/ jsx(ActionView, {
|
|
18
18
|
...props
|
|
19
19
|
});
|
|
20
|
-
|
|
21
|
-
...props.action,
|
|
22
|
-
type: triggerType
|
|
23
|
-
});
|
|
24
|
-
if (FlowActionComponent) return /*#__PURE__*/ jsx(FlowActionComponent, {
|
|
25
|
-
action: action,
|
|
26
|
-
onClickCheck: (actionId)=>{
|
|
27
|
-
if (props.onClickCheck) return props.onClickCheck?.(actionId);
|
|
28
|
-
return false;
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
return /*#__PURE__*/ jsx(CustomStyleButton, {
|
|
20
|
+
if (triggerFrontEvent) return /*#__PURE__*/ jsx(CustomStyleButton, {
|
|
32
21
|
display: props.action.display,
|
|
33
22
|
onClick: ()=>{
|
|
34
|
-
if (
|
|
23
|
+
if (triggerFrontEvent) EventBus.getInstance().emit(triggerFrontEvent);
|
|
24
|
+
else if (props.onClickCheck?.(action.id)) actionPresenter.action(action.id).then((res)=>{
|
|
35
25
|
if (res.success) {
|
|
36
26
|
message.success("操作成功");
|
|
37
27
|
context.close();
|
|
@@ -40,5 +30,18 @@ const CustomAction = (props)=>{
|
|
|
40
30
|
},
|
|
41
31
|
title: action.title
|
|
42
32
|
});
|
|
33
|
+
if (triggerType) {
|
|
34
|
+
const FlowActionComponent = ActionFactory.getInstance().getFlowActionComponent({
|
|
35
|
+
...props.action,
|
|
36
|
+
type: triggerType
|
|
37
|
+
});
|
|
38
|
+
if (FlowActionComponent) return /*#__PURE__*/ jsx(FlowActionComponent, {
|
|
39
|
+
action: action,
|
|
40
|
+
onClickCheck: (actionId)=>{
|
|
41
|
+
if (props.onClickCheck) return props.onClickCheck?.(actionId);
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
}
|
|
43
46
|
};
|
|
44
47
|
export { CustomAction };
|
|
@@ -8,6 +8,7 @@ const FormViewComponent = (props)=>{
|
|
|
8
8
|
const { state, context } = useApprovalContext();
|
|
9
9
|
const review = state.review || false;
|
|
10
10
|
const ViewComponent = ViewBindPlugin.getInstance().get(state.flow?.view || 'default') || FlowFormView;
|
|
11
|
+
const viewCode = state.flow?.code;
|
|
11
12
|
const flowForm = state.flow?.form;
|
|
12
13
|
const fieldPermissions = state.flow?.fieldPermissions || [];
|
|
13
14
|
const formMeta = react.useMemo(()=>context.convertMeta(flowForm || void 0, fieldPermissions), [
|
|
@@ -60,7 +61,8 @@ const FormViewComponent = (props)=>{
|
|
|
60
61
|
initData: context.getInitData(),
|
|
61
62
|
formList: formList,
|
|
62
63
|
onValuesChange: props.onValuesChange,
|
|
63
|
-
onMergeRecordIdsSelected: handleMergeRecordIdsSelected
|
|
64
|
+
onMergeRecordIdsSelected: handleMergeRecordIdsSelected,
|
|
65
|
+
viewCode: viewCode
|
|
64
66
|
});
|
|
65
67
|
return /*#__PURE__*/ jsx(Fragment, {
|
|
66
68
|
children: formList.map((item, index)=>/*#__PURE__*/ jsx(ViewComponent, {
|
|
@@ -71,7 +73,8 @@ const FormViewComponent = (props)=>{
|
|
|
71
73
|
initData: context.getInitData(),
|
|
72
74
|
meta: formMeta,
|
|
73
75
|
form: item.form,
|
|
74
|
-
onValuesChange: props.onValuesChange
|
|
76
|
+
onValuesChange: props.onValuesChange,
|
|
77
|
+
viewCode: viewCode
|
|
75
78
|
}, index))
|
|
76
79
|
});
|
|
77
80
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coding-flow/flow-pc-approval",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.48",
|
|
4
4
|
"description": "flow-engine pc form approval components",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
@@ -39,19 +39,19 @@
|
|
|
39
39
|
"dayjs": "^1.11.19",
|
|
40
40
|
"immer": "^11.1.3",
|
|
41
41
|
"react-redux": "^9.2.0",
|
|
42
|
-
"@coding-flow/flow-
|
|
43
|
-
"@coding-flow/flow-
|
|
44
|
-
"@coding-flow/flow-
|
|
45
|
-
"@coding-flow/flow-
|
|
46
|
-
"@coding-flow/flow-
|
|
47
|
-
"@coding-flow/flow-pc-form": "0.0.
|
|
42
|
+
"@coding-flow/flow-core": "0.0.48",
|
|
43
|
+
"@coding-flow/flow-approval-presenter": "0.0.48",
|
|
44
|
+
"@coding-flow/flow-types": "0.0.48",
|
|
45
|
+
"@coding-flow/flow-icons": "0.0.48",
|
|
46
|
+
"@coding-flow/flow-pc-ui": "0.0.48",
|
|
47
|
+
"@coding-flow/flow-pc-form": "0.0.48"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@coding-flow/flow-types": "0.0.
|
|
51
|
-
"@coding-flow/flow-approval-presenter": "0.0.
|
|
52
|
-
"@coding-flow/flow-
|
|
53
|
-
"@coding-flow/flow-
|
|
54
|
-
"@coding-flow/flow-pc-
|
|
50
|
+
"@coding-flow/flow-types": "0.0.48",
|
|
51
|
+
"@coding-flow/flow-approval-presenter": "0.0.48",
|
|
52
|
+
"@coding-flow/flow-pc-form": "0.0.48",
|
|
53
|
+
"@coding-flow/flow-core": "0.0.48",
|
|
54
|
+
"@coding-flow/flow-pc-ui": "0.0.48"
|
|
55
55
|
},
|
|
56
56
|
"scripts": {
|
|
57
57
|
"build": "rslib build",
|