@coding-flow/flow-pc-approval 0.0.47 → 0.0.49

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 { GroovyScriptConvertorUtil, ViewBindPlugin } from "@coding-flow/flow-core";
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 script = action.script || '';
14
- const returnData = GroovyScriptConvertorUtil.getReturnScript(script);
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
- const FlowActionComponent = ActionFactory.getInstance().getFlowActionComponent({
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 (props.onClickCheck?.(action.id)) actionPresenter.action(action.id).then((res)=>{
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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coding-flow/flow-pc-approval",
3
- "version": "0.0.47",
3
+ "version": "0.0.49",
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-core": "0.0.47",
43
- "@coding-flow/flow-types": "0.0.47",
44
- "@coding-flow/flow-approval-presenter": "0.0.47",
45
- "@coding-flow/flow-pc-ui": "0.0.47",
46
- "@coding-flow/flow-icons": "0.0.47",
47
- "@coding-flow/flow-pc-form": "0.0.47"
42
+ "@coding-flow/flow-types": "0.0.49",
43
+ "@coding-flow/flow-core": "0.0.49",
44
+ "@coding-flow/flow-approval-presenter": "0.0.49",
45
+ "@coding-flow/flow-icons": "0.0.49",
46
+ "@coding-flow/flow-pc-ui": "0.0.49",
47
+ "@coding-flow/flow-pc-form": "0.0.49"
48
48
  },
49
49
  "devDependencies": {
50
- "@coding-flow/flow-core": "0.0.47",
51
- "@coding-flow/flow-types": "0.0.47",
52
- "@coding-flow/flow-approval-presenter": "0.0.47",
53
- "@coding-flow/flow-pc-ui": "0.0.47",
54
- "@coding-flow/flow-pc-form": "0.0.47"
50
+ "@coding-flow/flow-types": "0.0.49",
51
+ "@coding-flow/flow-approval-presenter": "0.0.49",
52
+ "@coding-flow/flow-core": "0.0.49",
53
+ "@coding-flow/flow-pc-ui": "0.0.49",
54
+ "@coding-flow/flow-pc-form": "0.0.49"
55
55
  },
56
56
  "scripts": {
57
57
  "build": "rslib build",