@dentira/dentira-bulk-upload-widget 0.0.2 → 0.0.4
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 +27 -39
- package/dist/index.d.ts +0 -1
- package/dist/index.es.js +24234 -24230
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +11 -11
- package/dist/index.umd.js.map +1 -1
- package/dist/src/components/FileIcon.d.ts +1 -2
- package/dist/src/hooks/useDownloadTemplate.d.ts +2 -2
- package/dist/src/types.d.ts +3 -12
- package/dist/src/utils/constants.d.ts +2 -0
- package/package.json +1 -1
- package/dist/vite.svg +0 -1
package/README.md
CHANGED
|
@@ -2,34 +2,27 @@
|
|
|
2
2
|
|
|
3
3
|
```
|
|
4
4
|
type BulkUploadConfig = {
|
|
5
|
-
|
|
6
|
-
type: BulkUploadType;
|
|
5
|
+
type: string;
|
|
7
6
|
isOpen: boolean;
|
|
8
7
|
handleClose: () => void;
|
|
9
8
|
handleBackButton?: () => void;
|
|
10
9
|
bodyText?: string;
|
|
11
10
|
title?: string;
|
|
12
|
-
fileType:
|
|
11
|
+
fileType: "CSV" | "EXCEL";
|
|
13
12
|
rules?: string[];
|
|
14
13
|
columns?: string[];
|
|
15
|
-
downloadTemplateConfig?:
|
|
16
|
-
hasDynamicTemplate?: boolean;
|
|
17
|
-
payload?: downloadTemplatePayloadType;
|
|
18
|
-
};
|
|
14
|
+
downloadTemplateConfig?: DownloadTemplateConfigType;
|
|
19
15
|
uploadConfig?: Record<any, any>;
|
|
20
16
|
session: string;
|
|
21
17
|
apiKey: string;
|
|
22
18
|
};
|
|
23
19
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
FORMULARY_UPLOAD = "FORMULARY_UPLOAD",
|
|
31
|
-
SAMPLE = "sample",
|
|
32
|
-
}
|
|
20
|
+
type DownloadTemplateConfigType =
|
|
21
|
+
| {
|
|
22
|
+
hasDynamicTemplate?: boolean;
|
|
23
|
+
payload?: downloadTemplatePayloadType;
|
|
24
|
+
}
|
|
25
|
+
| undefined;
|
|
33
26
|
|
|
34
27
|
type downloadTemplatePayloadType = Record<
|
|
35
28
|
string,
|
|
@@ -40,7 +33,12 @@ type downloadTemplatePayloadType = Record<
|
|
|
40
33
|
## Example use.
|
|
41
34
|
|
|
42
35
|
```
|
|
43
|
-
import {
|
|
36
|
+
import { Button } from "@mui/material";
|
|
37
|
+
import { BulkUploadDialog } from "../src/components/BulkUploadDialog.tsx";
|
|
38
|
+
import { useDialog } from "../src/hooks/useDialog.ts";
|
|
39
|
+
import { BulkUploadConfig } from "../src/types.ts";
|
|
40
|
+
import { session, apiKey } from "../variables.ts";
|
|
41
|
+
import { EXCEL } from "../src/utils/constants.ts";
|
|
44
42
|
|
|
45
43
|
function App() {
|
|
46
44
|
const { isOpen, closeDialog, openDialog } = useDialog();
|
|
@@ -48,10 +46,8 @@ function App() {
|
|
|
48
46
|
const handleClose = () => {
|
|
49
47
|
closeDialog();
|
|
50
48
|
};
|
|
51
|
-
|
|
52
49
|
const bodyText =
|
|
53
50
|
"Lorem ipsum dolor sit amet consectetur adipisicing elit. Quospraesentium distinctio a tempora est et fugiat! Quam neque distinctio iure possimus, nam voluptatum repellat eius facere dolorem, magni vel nesciunt. Lorem ipsum dolor Lorem ipsum dolor Lorem ipsum dolor Lorem ipsum dolor Lorem";
|
|
54
|
-
|
|
55
51
|
const title = "Modal title";
|
|
56
52
|
|
|
57
53
|
const rules = [
|
|
@@ -59,15 +55,10 @@ function App() {
|
|
|
59
55
|
"sit amet consectetur adipisicing elit.",
|
|
60
56
|
"Quam neque distinctio iure possimus, nam voluptatum repellat",
|
|
61
57
|
];
|
|
62
|
-
|
|
63
|
-
const
|
|
64
|
-
|
|
65
|
-
const columns = ["Lorem", "distinctio", "nam"]; // strings here will be used to highlight these words in rules section of the modal.
|
|
66
|
-
|
|
67
|
-
const fileType: FileType = FileType.EXCEL;
|
|
58
|
+
const columns = ["Lorem", "distinctio", "nam"];
|
|
59
|
+
const fileType = EXCEL;
|
|
68
60
|
|
|
69
61
|
const config: BulkUploadConfig = {
|
|
70
|
-
id,
|
|
71
62
|
isOpen,
|
|
72
63
|
bodyText,
|
|
73
64
|
handleClose,
|
|
@@ -75,30 +66,27 @@ function App() {
|
|
|
75
66
|
rules,
|
|
76
67
|
columns,
|
|
77
68
|
fileType,
|
|
78
|
-
downloadTemplateConfig: {
|
|
79
|
-
hasDynamicTemplate: true,
|
|
80
|
-
payload: { testKey: "test" },
|
|
81
|
-
},
|
|
82
69
|
uploadConfig: {
|
|
83
|
-
|
|
84
|
-
testKey1: "testKey1",
|
|
85
|
-
testKey2: "testKey2",
|
|
70
|
+
shoppinglist_name: "test group list bulk upload",
|
|
86
71
|
},
|
|
87
|
-
session
|
|
88
|
-
apiKey
|
|
89
|
-
type:
|
|
72
|
+
session,
|
|
73
|
+
apiKey,
|
|
74
|
+
type: "GROUPITEMLIST",
|
|
90
75
|
};
|
|
91
76
|
|
|
92
77
|
return (
|
|
93
78
|
<>
|
|
94
|
-
<
|
|
79
|
+
<Button onClick={openDialog} variant="contained">
|
|
95
80
|
{!isOpen ? "Open" : "Close"}
|
|
96
|
-
</
|
|
97
|
-
<BulkUploadDialog
|
|
81
|
+
</Button>
|
|
82
|
+
<BulkUploadDialog config={config} />
|
|
98
83
|
</>
|
|
99
84
|
);
|
|
100
85
|
}
|
|
101
86
|
|
|
102
87
|
export default App;
|
|
103
88
|
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
|
|
104
92
|
```
|
package/dist/index.d.ts
CHANGED