@coding-flow/flow-mobile-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.
@@ -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
@@ -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), [
@@ -56,7 +57,8 @@ const FormViewComponent = (props)=>{
56
57
  meta: formMeta,
57
58
  formList: formList,
58
59
  onValuesChange: props.onValuesChange,
59
- onMergeRecordIdsSelected: handleMergeRecordIdsSelected
60
+ onMergeRecordIdsSelected: handleMergeRecordIdsSelected,
61
+ viewCode: viewCode
60
62
  });
61
63
  return /*#__PURE__*/ jsx(Fragment, {
62
64
  children: formList.map((item, index)=>/*#__PURE__*/ jsx(ViewComponent, {
@@ -67,7 +69,8 @@ const FormViewComponent = (props)=>{
67
69
  review: review,
68
70
  meta: formMeta,
69
71
  form: item.form,
70
- onValuesChange: props.onValuesChange
72
+ onValuesChange: props.onValuesChange,
73
+ viewCode: viewCode
71
74
  }, index))
72
75
  });
73
76
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coding-flow/flow-mobile-approval",
3
- "version": "0.0.46",
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-types": "0.0.46",
43
- "@coding-flow/flow-core": "0.0.46",
44
- "@coding-flow/flow-icons": "0.0.46",
45
- "@coding-flow/flow-mobile-ui": "0.0.46",
46
- "@coding-flow/flow-approval-presenter": "0.0.46",
47
- "@coding-flow/flow-mobile-form": "0.0.46"
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.46",
51
- "@coding-flow/flow-types": "0.0.46",
52
- "@coding-flow/flow-mobile-ui": "0.0.46",
53
- "@coding-flow/flow-approval-presenter": "0.0.46",
54
- "@coding-flow/flow-mobile-form": "0.0.46"
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",