@coding-flow/flow-mobile-approval 0.0.47 → 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.
@@ -1,22 +1,23 @@
1
1
  import { Fragment, jsx } from "react/jsx-runtime";
2
2
  import "react";
3
- import { GroovyScriptConvertorUtil, ViewBindPlugin } from "@coding-flow/flow-core";
4
3
  import { ActionFactory } from "./factory.js";
4
+ import { ViewBindPlugin } from "@coding-flow/flow-core";
5
5
  import { APPROVAL_ACTION_CUSTOM_KEY } from "../../index.js";
6
6
  const CustomAction = (props)=>{
7
7
  const action = props.action;
8
- const script = action.script || '';
9
- const returnData = GroovyScriptConvertorUtil.getReturnScript(script);
10
- const triggerType = returnData.replaceAll('\'', '');
8
+ const triggerType = action.triggerType;
9
+ const triggerFrontEvent = action.triggerFrontEvent;
11
10
  const ActionPluginView = ViewBindPlugin.getInstance().get(APPROVAL_ACTION_CUSTOM_KEY);
12
11
  if (ActionPluginView) return /*#__PURE__*/ jsx(ActionPluginView, {
13
12
  ...props
14
13
  });
15
- const ActionView = ActionFactory.getInstance().render({
16
- ...props.action,
17
- type: triggerType
18
- });
19
- if (ActionView) return ActionView;
20
- return /*#__PURE__*/ jsx(Fragment, {});
14
+ if (triggerFrontEvent) return /*#__PURE__*/ jsx(Fragment, {});
15
+ if (triggerType) {
16
+ const ActionView = ActionFactory.getInstance().render({
17
+ ...props.action,
18
+ type: triggerType
19
+ });
20
+ if (ActionView) return ActionView;
21
+ }
21
22
  };
22
23
  export { CustomAction };
@@ -14,13 +14,17 @@ const FlowApprovalActions = ()=>{
14
14
  const presenter = useLayoutPresenter();
15
15
  const [moreVisible, setMoreVisible] = useState(false);
16
16
  const handlerAction = (id)=>{
17
+ const presenter = context.getPresenter().getFlowActionPresenter();
18
+ const action = presenter.getAction(id);
17
19
  if (state.flow?.mergeable) {
18
- const presenter = context.getPresenter().getFlowActionPresenter();
19
20
  const selectRecordIds = presenter.getSubmitRecordIds();
20
21
  const currentFormData = presenter.getCurrentFormData();
21
22
  if (ObjectUtils.isEmptyObject(currentFormData) && 0 == selectRecordIds.length) return void Toast.show('请先选择审批流程.');
22
23
  }
23
- EventBus.getInstance().emit(id);
24
+ if (action) {
25
+ const triggerFrontEvent = action.triggerFrontEvent;
26
+ if (triggerFrontEvent) EventBus.getInstance().emit(triggerFrontEvent);
27
+ } else EventBus.getInstance().emit(id);
24
28
  };
25
29
  return /*#__PURE__*/ jsxs("div", {
26
30
  style: {
@@ -35,7 +39,9 @@ const FlowApprovalActions = ()=>{
35
39
  presenter.getActions().map((action, index)=>ActionFactory.getInstance().render(action)),
36
40
  !presenter.isReview() && presenter.getFooterOptions().map((action, index)=>/*#__PURE__*/ jsx(CustomStyleButton, {
37
41
  onClick: ()=>{
38
- handlerAction(action.id);
42
+ const triggerFrontEvent = action.triggerFrontEvent;
43
+ if (triggerFrontEvent) EventBus.getInstance().emit(triggerFrontEvent);
44
+ else handlerAction(action.id);
39
45
  },
40
46
  display: action.display,
41
47
  title: action.title
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coding-flow/flow-mobile-approval",
3
- "version": "0.0.47",
3
+ "version": "0.0.48",
4
4
  "description": "flow-engine pc mobile 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-icons": "0.0.47",
44
- "@coding-flow/flow-mobile-ui": "0.0.47",
45
- "@coding-flow/flow-approval-presenter": "0.0.47",
46
- "@coding-flow/flow-types": "0.0.47",
47
- "@coding-flow/flow-mobile-form": "0.0.47"
42
+ "@coding-flow/flow-core": "0.0.48",
43
+ "@coding-flow/flow-types": "0.0.48",
44
+ "@coding-flow/flow-approval-presenter": "0.0.48",
45
+ "@coding-flow/flow-icons": "0.0.48",
46
+ "@coding-flow/flow-mobile-ui": "0.0.48",
47
+ "@coding-flow/flow-mobile-form": "0.0.48"
48
48
  },
49
49
  "devDependencies": {
50
- "@coding-flow/flow-core": "0.0.47",
51
- "@coding-flow/flow-approval-presenter": "0.0.47",
52
- "@coding-flow/flow-mobile-ui": "0.0.47",
53
- "@coding-flow/flow-mobile-form": "0.0.47",
54
- "@coding-flow/flow-types": "0.0.47"
50
+ "@coding-flow/flow-types": "0.0.48",
51
+ "@coding-flow/flow-mobile-ui": "0.0.48",
52
+ "@coding-flow/flow-approval-presenter": "0.0.48",
53
+ "@coding-flow/flow-core": "0.0.48",
54
+ "@coding-flow/flow-mobile-form": "0.0.48"
55
55
  },
56
56
  "scripts": {
57
57
  "build": "rslib build",