@coding-flow/flow-pc-approval 0.0.1 → 0.0.2

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,8 +2,8 @@ import { Fragment, jsx } from "react/jsx-runtime";
2
2
  import react from "react";
3
3
  import { useApprovalContext } from "@coding-flow/flow-approval-presenter";
4
4
  import { ViewBindPlugin } from "@coding-flow/flow-core";
5
- import { Form } from "antd";
6
5
  import { FlowFormView } from "@coding-flow/flow-pc-form";
6
+ import { createFormInstance } from "@coding-form/form-engine";
7
7
  const FormViewComponent = (props)=>{
8
8
  const { state, context } = useApprovalContext();
9
9
  const review = state.review || false;
@@ -13,11 +13,11 @@ const FormViewComponent = (props)=>{
13
13
  const mergeable = state.flow?.mergeable || false;
14
14
  const todos = state.flow?.todos || [];
15
15
  const formList = todos.length > 0 ? todos.map((item)=>({
16
- form: Form.useForm()[0],
16
+ form: createFormInstance(flowForm),
17
17
  data: item
18
18
  })) : [
19
19
  {
20
- form: Form.useForm()[0],
20
+ form: createFormInstance(flowForm),
21
21
  data: void 0
22
22
  }
23
23
  ];
@@ -26,7 +26,11 @@ const FormViewComponent = (props)=>{
26
26
  const formInstance = item.form;
27
27
  const formRecord = item.data?.data;
28
28
  context.getPresenter().getFormActionContext().addAction({
29
- save: ()=>formInstance.getFieldsValue(),
29
+ save: ()=>{
30
+ const data = formInstance.getFieldsValue();
31
+ console.log('save:', data);
32
+ return data;
33
+ },
30
34
  key: ()=>'view-form',
31
35
  validate: ()=>new Promise((resolve, reject)=>{
32
36
  formInstance.validateFields().then(resolve).catch(reject);
@@ -4,8 +4,9 @@ import { Provider } from "react-redux";
4
4
  import { ApprovalContext, approvalStore, createApprovalContext } from "@coding-flow/flow-approval-presenter";
5
5
  import { Header } from "./header.js";
6
6
  import { Body } from "./body.js";
7
+ import { FlowApprovalApiImpl } from "../model/index.js";
7
8
  const ApprovalLayoutScope = (props)=>{
8
- const { context } = createApprovalContext(props);
9
+ const { context } = createApprovalContext(props, new FlowApprovalApiImpl());
9
10
  return /*#__PURE__*/ jsx(ApprovalContext.Provider, {
10
11
  value: context,
11
12
  children: /*#__PURE__*/ jsxs("div", {
@@ -0,0 +1,8 @@
1
+ import { FlowApprovalApi } from "@coding-flow/flow-approval-presenter";
2
+ export declare class FlowApprovalApiImpl implements FlowApprovalApi {
3
+ create: (body: Record<string, any>, mockKey: string) => Promise<any>;
4
+ action: (body: Record<string, any>, mockKey: string) => Promise<import("@coding-flow/flow-core").Response>;
5
+ processNodes: (body: Record<string, any>, mockKey: string) => Promise<any>;
6
+ revoke: (id: any, mockKey: string) => Promise<import("@coding-flow/flow-core").Response>;
7
+ urge: (id: any, mockKey: string) => Promise<import("@coding-flow/flow-core").Response>;
8
+ }
@@ -0,0 +1,16 @@
1
+ import { action, create, processNodes, revoke, urge } from "../../../api/record.js";
2
+ class FlowApprovalApiImpl {
3
+ create = async (body, mockKey)=>{
4
+ const response = await create(body, mockKey);
5
+ if (response.success) return response.data;
6
+ };
7
+ action = async (body, mockKey)=>await action(body, mockKey);
8
+ processNodes = async (body, mockKey)=>{
9
+ const response = await processNodes(body, mockKey);
10
+ if (response.success) return response.data.list;
11
+ return [];
12
+ };
13
+ revoke = async (id, mockKey)=>await revoke(id, mockKey);
14
+ urge = async (id, mockKey)=>await urge(id, mockKey);
15
+ }
16
+ export { FlowApprovalApiImpl };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coding-flow/flow-pc-approval",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "description": "flow-engine pc form approval components",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -33,20 +33,21 @@
33
33
  },
34
34
  "dependencies": {
35
35
  "@ant-design/icons": "~6.1.0",
36
+ "@coding-form/form-engine": "^0.0.11",
36
37
  "@reduxjs/toolkit": "^2.11.2",
37
38
  "antd": "^6.2.1",
38
39
  "dayjs": "^1.11.19",
39
40
  "immer": "^11.1.3",
40
41
  "react-redux": "^9.2.0",
41
- "@coding-flow/flow-core": "0.0.1",
42
- "@coding-flow/flow-types": "0.0.1",
43
- "@coding-flow/flow-icons": "0.0.1",
44
- "@coding-flow/flow-approval-presenter": "0.0.1",
45
- "@coding-flow/flow-pc-ui": "0.0.1",
46
- "@coding-flow/flow-pc-form": "0.0.1"
42
+ "@coding-flow/flow-core": "0.0.2",
43
+ "@coding-flow/flow-types": "0.0.2",
44
+ "@coding-flow/flow-icons": "0.0.2",
45
+ "@coding-flow/flow-pc-ui": "0.0.2",
46
+ "@coding-flow/flow-pc-form": "0.0.2",
47
+ "@coding-flow/flow-approval-presenter": "0.0.2"
47
48
  },
48
49
  "devDependencies": {
49
- "@coding-flow/flow-types": "0.0.1"
50
+ "@coding-flow/flow-types": "0.0.2"
50
51
  },
51
52
  "scripts": {
52
53
  "build": "rslib build",