@coding-flow/flow-approval-presenter 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.
- package/dist/hooks/use-approval-context.d.ts +2 -1
- package/dist/hooks/use-approval-context.js +2 -3
- package/package.json +4 -4
- package/dist/api/index.d.ts +0 -2
- package/dist/api/index.js +0 -12
- package/dist/api/record.d.ts +0 -10
- package/dist/api/record.js +0 -48
- package/dist/api/workflow.d.ts +0 -3
- package/dist/api/workflow.js +0 -7
- package/dist/model/index.d.ts +0 -8
- package/dist/model/index.js +0 -16
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { ApprovalContextScope } from "../context";
|
|
2
|
+
import { FlowApprovalApi } from "../typings";
|
|
2
3
|
import { ApprovalLayoutProps } from "../typings";
|
|
3
4
|
export declare const useApprovalContext: () => {
|
|
4
5
|
state: import("../typings").ApprovalState;
|
|
5
6
|
context: ApprovalContextScope;
|
|
6
7
|
};
|
|
7
|
-
export declare const createApprovalContext: (props: ApprovalLayoutProps) => {
|
|
8
|
+
export declare const createApprovalContext: (props: ApprovalLayoutProps, flowApprovalApi: FlowApprovalApi) => {
|
|
8
9
|
state: import("../typings").ApprovalState;
|
|
9
10
|
context: ApprovalContextScope;
|
|
10
11
|
};
|
|
@@ -3,7 +3,6 @@ import { useDispatch, useSelector } from "react-redux";
|
|
|
3
3
|
import { ApprovalContext, ApprovalContextScope } from "../context/index.js";
|
|
4
4
|
import { updateState } from "../store/index.js";
|
|
5
5
|
import { ApprovalPresenter } from "../presenters/index.js";
|
|
6
|
-
import { FlowApprovalApiImpl } from "../model/index.js";
|
|
7
6
|
import { useMockContext } from "./use-mock-context.js";
|
|
8
7
|
const useApprovalContext = ()=>{
|
|
9
8
|
const context = react.useContext(ApprovalContext);
|
|
@@ -14,7 +13,7 @@ const useApprovalContext = ()=>{
|
|
|
14
13
|
context
|
|
15
14
|
};
|
|
16
15
|
};
|
|
17
|
-
const createApprovalContext = (props)=>{
|
|
16
|
+
const createApprovalContext = (props, flowApprovalApi)=>{
|
|
18
17
|
const ref = react.useRef(void 0);
|
|
19
18
|
const dispatch = useDispatch();
|
|
20
19
|
const state = useSelector((state)=>state.approval);
|
|
@@ -23,7 +22,7 @@ const createApprovalContext = (props)=>{
|
|
|
23
22
|
const presenter = new ApprovalPresenter(state, (prevState)=>{
|
|
24
23
|
dispatch(updateState(prevState));
|
|
25
24
|
return prevState;
|
|
26
|
-
},
|
|
25
|
+
}, flowApprovalApi, mockKey);
|
|
27
26
|
ref.current = new ApprovalContextScope(presenter, props);
|
|
28
27
|
ref.current.initialState();
|
|
29
28
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coding-flow/flow-approval-presenter",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2",
|
|
4
4
|
"description": "flow-engine approval presenter framework ",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
@@ -36,11 +36,11 @@
|
|
|
36
36
|
"dayjs": "^1.11.19",
|
|
37
37
|
"immer": "^11.1.3",
|
|
38
38
|
"react-redux": "^9.2.0",
|
|
39
|
-
"@coding-flow/flow-core": "0.0.
|
|
40
|
-
"@coding-flow/flow-types": "0.0.
|
|
39
|
+
"@coding-flow/flow-core": "0.0.2",
|
|
40
|
+
"@coding-flow/flow-types": "0.0.2"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@coding-flow/flow-types": "0.0.
|
|
43
|
+
"@coding-flow/flow-types": "0.0.2"
|
|
44
44
|
},
|
|
45
45
|
"scripts": {
|
|
46
46
|
"build": "rslib build",
|
package/dist/api/index.d.ts
DELETED
package/dist/api/index.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { HttpClient } from "@coding-flow/flow-core";
|
|
2
|
-
import { message } from "antd";
|
|
3
|
-
const httpClient = new HttpClient(10000, {
|
|
4
|
-
success: (msg)=>{
|
|
5
|
-
message.success(msg);
|
|
6
|
-
},
|
|
7
|
-
error: (msg)=>{
|
|
8
|
-
console.log(msg);
|
|
9
|
-
message.error(msg);
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
export { httpClient };
|
package/dist/api/record.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export declare const detail: (id: string, mockKey?: string) => Promise<import("@coding-flow/flow-core").Response>;
|
|
2
|
-
export declare const processNodes: (body: any, mockKey?: string) => Promise<import("@coding-flow/flow-core").Response>;
|
|
3
|
-
export declare const create: (body: any, mockKey?: string) => Promise<import("@coding-flow/flow-core").Response>;
|
|
4
|
-
export declare const action: (body: any, mockKey?: string) => Promise<import("@coding-flow/flow-core").Response>;
|
|
5
|
-
export declare const revoke: (id: any, mockKey?: string) => Promise<import("@coding-flow/flow-core").Response>;
|
|
6
|
-
export declare const urge: (id: any, mockKey?: string) => Promise<import("@coding-flow/flow-core").Response>;
|
|
7
|
-
export declare const list: (request: any, mockKey?: string) => Promise<import("@coding-flow/flow-core").Response>;
|
|
8
|
-
export declare const todo: (request: any, mockKey?: string) => Promise<import("@coding-flow/flow-core").Response>;
|
|
9
|
-
export declare const done: (request: any, mockKey?: string) => Promise<import("@coding-flow/flow-core").Response>;
|
|
10
|
-
export declare const notify: (request: any, mockKey?: string) => Promise<import("@coding-flow/flow-core").Response>;
|
package/dist/api/record.js
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { httpClient } from "./index.js";
|
|
2
|
-
const detail = (id, mockKey)=>{
|
|
3
|
-
const key = mockKey ? mockKey : '';
|
|
4
|
-
return httpClient.get('/api/cmd/record/detail?mockKey=' + key, {
|
|
5
|
-
id
|
|
6
|
-
});
|
|
7
|
-
};
|
|
8
|
-
const processNodes = (body, mockKey)=>{
|
|
9
|
-
const key = mockKey ? mockKey : '';
|
|
10
|
-
return httpClient.post('/api/cmd/record/processNodes?mockKey=' + key, body);
|
|
11
|
-
};
|
|
12
|
-
const create = (body, mockKey)=>{
|
|
13
|
-
const key = mockKey ? mockKey : '';
|
|
14
|
-
return httpClient.post('/api/cmd/record/create?mockKey=' + key, body);
|
|
15
|
-
};
|
|
16
|
-
const action = (body, mockKey)=>{
|
|
17
|
-
const key = mockKey ? mockKey : '';
|
|
18
|
-
return httpClient.post('/api/cmd/record/action?mockKey=' + key, body);
|
|
19
|
-
};
|
|
20
|
-
const revoke = (id, mockKey)=>{
|
|
21
|
-
const key = mockKey ? mockKey : '';
|
|
22
|
-
return httpClient.post('/api/cmd/record/revoke?mockKey=' + key, {
|
|
23
|
-
id
|
|
24
|
-
});
|
|
25
|
-
};
|
|
26
|
-
const urge = (id, mockKey)=>{
|
|
27
|
-
const key = mockKey ? mockKey : '';
|
|
28
|
-
return httpClient.post('/api/cmd/record/urge?mockKey=' + key, {
|
|
29
|
-
id
|
|
30
|
-
});
|
|
31
|
-
};
|
|
32
|
-
const list = (request, mockKey)=>{
|
|
33
|
-
const key = mockKey ? mockKey : '';
|
|
34
|
-
return httpClient.page('/api/query/record/list?mockKey=' + key, request, {}, {}, []);
|
|
35
|
-
};
|
|
36
|
-
const todo = (request, mockKey)=>{
|
|
37
|
-
const key = mockKey ? mockKey : '';
|
|
38
|
-
return httpClient.page('/api/query/record/todo?mockKey=' + key, request, {}, {}, []);
|
|
39
|
-
};
|
|
40
|
-
const done = (request, mockKey)=>{
|
|
41
|
-
const key = mockKey ? mockKey : '';
|
|
42
|
-
return httpClient.page('/api/query/record/done?mockKey=' + key, request, {}, {}, []);
|
|
43
|
-
};
|
|
44
|
-
const notify = (request, mockKey)=>{
|
|
45
|
-
const key = mockKey ? mockKey : '';
|
|
46
|
-
return httpClient.page('/api/query/record/notify?mockKey=' + key, request, {}, {}, []);
|
|
47
|
-
};
|
|
48
|
-
export { action, create, detail, done, list, notify, processNodes, revoke, todo, urge };
|
package/dist/api/workflow.d.ts
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
export declare const mock: () => Promise<import("@coding-flow/flow-core").Response>;
|
|
2
|
-
export declare const cleanMock: (id: string) => Promise<import("@coding-flow/flow-core").Response>;
|
|
3
|
-
export declare const options: () => Promise<import("@coding-flow/flow-core").Response>;
|
package/dist/api/workflow.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { httpClient } from "./index.js";
|
|
2
|
-
const mock = ()=>httpClient.post('/api/cmd/workflow/mock', {});
|
|
3
|
-
const cleanMock = (id)=>httpClient.post('/api/cmd/workflow/cleanMock', {
|
|
4
|
-
id
|
|
5
|
-
});
|
|
6
|
-
const options = ()=>httpClient.get('/api/query/workflow/options');
|
|
7
|
-
export { cleanMock, mock, options };
|
package/dist/model/index.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { FlowApprovalApi } from "../typings";
|
|
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
|
-
}
|
package/dist/model/index.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
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 };
|