amp-workflow-ui 0.1.0
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/README.md +63 -0
- package/dist/index.d.mts +41 -0
- package/dist/index.d.ts +41 -0
- package/dist/index.js +695 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +681 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +43 -0
package/README.md
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# @ampersand/workflow-ui
|
|
2
|
+
|
|
3
|
+
Reusable Approval Workflow UI components for Ampersand portals.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @ampersand/workflow-ui
|
|
9
|
+
# or
|
|
10
|
+
yarn add @ampersand/workflow-ui
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Peer dependencies required in host:
|
|
14
|
+
|
|
15
|
+
- react, react-dom (18.x)
|
|
16
|
+
- @mui/material, @mui/system
|
|
17
|
+
- @emotion/react, @emotion/styled
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
```tsx
|
|
22
|
+
import { DialogOpener } from '@ampersand/workflow-ui'
|
|
23
|
+
import axios from 'axios'
|
|
24
|
+
|
|
25
|
+
const api = {
|
|
26
|
+
get: (p: any) => axios.get(p.url),
|
|
27
|
+
post: (p: any) => axios.post(p.url, p.data)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
<DialogOpener
|
|
31
|
+
openDialog={open}
|
|
32
|
+
handleClose={() => setOpen(false)}
|
|
33
|
+
userInfoData={userInfo}
|
|
34
|
+
api={api}
|
|
35
|
+
/>
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Or render inline:
|
|
39
|
+
|
|
40
|
+
```tsx
|
|
41
|
+
import { ApprovalWorkflow } from '@ampersand/workflow-ui'
|
|
42
|
+
|
|
43
|
+
<ApprovalWorkflow userInfo={userInfo} api={api} />
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Optional
|
|
47
|
+
|
|
48
|
+
- `urlBuilder`: (moduleName, moduleId, context, refId?) => string
|
|
49
|
+
- `loadingComponent`: custom loader
|
|
50
|
+
|
|
51
|
+
## Build
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
npm run build
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Publish
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
npm publish --access public
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
|
|
4
|
+
type ApiClient = {
|
|
5
|
+
get: (params: {
|
|
6
|
+
url: string;
|
|
7
|
+
serviceURL?: string;
|
|
8
|
+
[key: string]: any;
|
|
9
|
+
}) => Promise<any>;
|
|
10
|
+
post: (params: {
|
|
11
|
+
url: string;
|
|
12
|
+
data?: any;
|
|
13
|
+
serviceURL?: string;
|
|
14
|
+
[key: string]: any;
|
|
15
|
+
}) => Promise<any>;
|
|
16
|
+
};
|
|
17
|
+
type UrlBuilder = (moduleName: string, moduleId: string | number, context: any, referenceId?: string | number) => string;
|
|
18
|
+
type ApprovalWorkflowProps = {
|
|
19
|
+
userInfo: any;
|
|
20
|
+
selectedWorkflowsList?: any[];
|
|
21
|
+
};
|
|
22
|
+
type DialogOpenerProps = {
|
|
23
|
+
openDialog: boolean;
|
|
24
|
+
handleClose?: () => void;
|
|
25
|
+
title?: string;
|
|
26
|
+
userInfoData: any;
|
|
27
|
+
selectedWorkflowsList?: any[];
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
declare function DialogOpener(props: DialogOpenerProps & {
|
|
31
|
+
api: ApiClient;
|
|
32
|
+
urlBuilder?: UrlBuilder;
|
|
33
|
+
loadingComponent?: React.ReactNode;
|
|
34
|
+
}): react_jsx_runtime.JSX.Element;
|
|
35
|
+
declare function ApprovalWorkflow(props: ApprovalWorkflowProps & {
|
|
36
|
+
api: ApiClient;
|
|
37
|
+
urlBuilder?: UrlBuilder;
|
|
38
|
+
loadingComponent?: React.ReactNode;
|
|
39
|
+
}): react_jsx_runtime.JSX.Element;
|
|
40
|
+
|
|
41
|
+
export { type ApiClient, ApprovalWorkflow, type ApprovalWorkflowProps, DialogOpener, type DialogOpenerProps, type UrlBuilder };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
|
|
4
|
+
type ApiClient = {
|
|
5
|
+
get: (params: {
|
|
6
|
+
url: string;
|
|
7
|
+
serviceURL?: string;
|
|
8
|
+
[key: string]: any;
|
|
9
|
+
}) => Promise<any>;
|
|
10
|
+
post: (params: {
|
|
11
|
+
url: string;
|
|
12
|
+
data?: any;
|
|
13
|
+
serviceURL?: string;
|
|
14
|
+
[key: string]: any;
|
|
15
|
+
}) => Promise<any>;
|
|
16
|
+
};
|
|
17
|
+
type UrlBuilder = (moduleName: string, moduleId: string | number, context: any, referenceId?: string | number) => string;
|
|
18
|
+
type ApprovalWorkflowProps = {
|
|
19
|
+
userInfo: any;
|
|
20
|
+
selectedWorkflowsList?: any[];
|
|
21
|
+
};
|
|
22
|
+
type DialogOpenerProps = {
|
|
23
|
+
openDialog: boolean;
|
|
24
|
+
handleClose?: () => void;
|
|
25
|
+
title?: string;
|
|
26
|
+
userInfoData: any;
|
|
27
|
+
selectedWorkflowsList?: any[];
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
declare function DialogOpener(props: DialogOpenerProps & {
|
|
31
|
+
api: ApiClient;
|
|
32
|
+
urlBuilder?: UrlBuilder;
|
|
33
|
+
loadingComponent?: React.ReactNode;
|
|
34
|
+
}): react_jsx_runtime.JSX.Element;
|
|
35
|
+
declare function ApprovalWorkflow(props: ApprovalWorkflowProps & {
|
|
36
|
+
api: ApiClient;
|
|
37
|
+
urlBuilder?: UrlBuilder;
|
|
38
|
+
loadingComponent?: React.ReactNode;
|
|
39
|
+
}): react_jsx_runtime.JSX.Element;
|
|
40
|
+
|
|
41
|
+
export { type ApiClient, ApprovalWorkflow, type ApprovalWorkflowProps, DialogOpener, type DialogOpenerProps, type UrlBuilder };
|