@dentira/dentira-bulk-upload-widget 0.0.1
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 +104 -0
- package/dist/UI-test/App.d.ts +2 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.es.js +48353 -0
- package/dist/index.es.js.map +1 -0
- package/dist/index.umd.js +315 -0
- package/dist/index.umd.js.map +1 -0
- package/dist/src/assets/UplaodingAnimation.json.d.ts +3 -0
- package/dist/src/assets/UploadFailedAnimation.json.d.ts +3 -0
- package/dist/src/assets/UploadProcessingAnimation.json.d.ts +3 -0
- package/dist/src/assets/getingStatusAnimation.json.d.ts +3 -0
- package/dist/src/backend/api-config.d.ts +2 -0
- package/dist/src/components/ActionsContent.d.ts +2 -0
- package/dist/src/components/BulkUploadDialog.d.ts +2 -0
- package/dist/src/components/DialogContent.d.ts +2 -0
- package/dist/src/components/FileIcon.d.ts +4 -0
- package/dist/src/components/FileUpload.d.ts +1 -0
- package/dist/src/components/LoadingIcon.d.ts +5 -0
- package/dist/src/components/Rules.d.ts +4 -0
- package/dist/src/components/TitleContent.d.ts +2 -0
- package/dist/src/dialogContext/DialogContext.d.ts +2 -0
- package/dist/src/dialogContext/DialogProvider.d.ts +8 -0
- package/dist/src/dialogContext/useDialogContext.d.ts +1 -0
- package/dist/src/hooks/useCheckStatusIntervally.d.ts +7 -0
- package/dist/src/hooks/useDialog.d.ts +5 -0
- package/dist/src/hooks/useDownloadFromS3.d.ts +6 -0
- package/dist/src/hooks/useDownloadTemplate.d.ts +6 -0
- package/dist/src/hooks/useQuery.d.ts +14 -0
- package/dist/src/hooks/useScreen.d.ts +19 -0
- package/dist/src/theme.d.ts +2 -0
- package/dist/src/types.d.ts +120 -0
- package/dist/src/utils/constants.d.ts +11 -0
- package/dist/src/utils/fetcher.d.ts +22 -0
- package/dist/src/utils/styles.d.ts +21 -0
- package/dist/src/utils/utils.d.ts +5 -0
- package/dist/vite.svg +1 -0
- package/package.json +61 -0
package/README.md
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
## Type Definitions.
|
|
2
|
+
|
|
3
|
+
```
|
|
4
|
+
type BulkUploadConfig = {
|
|
5
|
+
id: string;
|
|
6
|
+
type: BulkUploadType;
|
|
7
|
+
isOpen: boolean;
|
|
8
|
+
handleClose: () => void;
|
|
9
|
+
handleBackButton?: () => void;
|
|
10
|
+
bodyText?: string;
|
|
11
|
+
title?: string;
|
|
12
|
+
fileType: FileType;
|
|
13
|
+
rules?: string[];
|
|
14
|
+
columns?: string[];
|
|
15
|
+
downloadTemplateConfig?: {
|
|
16
|
+
hasDynamicTemplate?: boolean;
|
|
17
|
+
payload?: downloadTemplatePayloadType;
|
|
18
|
+
};
|
|
19
|
+
uploadConfig?: Record<any, any>;
|
|
20
|
+
session: string;
|
|
21
|
+
apiKey: string;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
enum FileType {
|
|
25
|
+
EXCEL = "EXCEL",
|
|
26
|
+
CSV = "CSV",
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
enum BulkUploadType {
|
|
30
|
+
FORMULARY_UPLOAD = "FORMULARY_UPLOAD",
|
|
31
|
+
SAMPLE = "sample",
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
type downloadTemplatePayloadType = Record<
|
|
35
|
+
string,
|
|
36
|
+
string | number | any[] | undefined
|
|
37
|
+
>;
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Example use.
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
import { BulkUploadDialog, BulkUploadConfig, BulkUploadType, FileType , useDialog} from "@dentira/dentira-bulk-upload-widget";
|
|
44
|
+
|
|
45
|
+
function App() {
|
|
46
|
+
const { isOpen, closeDialog, openDialog } = useDialog();
|
|
47
|
+
|
|
48
|
+
const handleClose = () => {
|
|
49
|
+
closeDialog();
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const bodyText =
|
|
53
|
+
"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
|
+
const title = "Modal title";
|
|
56
|
+
|
|
57
|
+
const rules = [
|
|
58
|
+
"Lorem ipsum dolor sit amet consectetur adipisicing elit.",
|
|
59
|
+
"sit amet consectetur adipisicing elit.",
|
|
60
|
+
"Quam neque distinctio iure possimus, nam voluptatum repellat",
|
|
61
|
+
];
|
|
62
|
+
|
|
63
|
+
const id = new Date().toISOString();
|
|
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;
|
|
68
|
+
|
|
69
|
+
const config: BulkUploadConfig = {
|
|
70
|
+
id,
|
|
71
|
+
isOpen,
|
|
72
|
+
bodyText,
|
|
73
|
+
handleClose,
|
|
74
|
+
title,
|
|
75
|
+
rules,
|
|
76
|
+
columns,
|
|
77
|
+
fileType,
|
|
78
|
+
downloadTemplateConfig: {
|
|
79
|
+
hasDynamicTemplate: true,
|
|
80
|
+
payload: { testKey: "test" },
|
|
81
|
+
},
|
|
82
|
+
uploadConfig: {
|
|
83
|
+
// additional kvp's for upload API request.
|
|
84
|
+
testKey1: "testKey1",
|
|
85
|
+
testKey2: "testKey2",
|
|
86
|
+
},
|
|
87
|
+
session: <sessionToken>,
|
|
88
|
+
apiKey: <apiKey>,
|
|
89
|
+
type: BulkUploadType.SAMPLE,
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
return (
|
|
93
|
+
<>
|
|
94
|
+
<button onClick={openDialog}>
|
|
95
|
+
{!isOpen ? "Open" : "Close"}
|
|
96
|
+
</button>
|
|
97
|
+
<BulkUploadDialog key={id} config={config} />
|
|
98
|
+
</>
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export default App;
|
|
103
|
+
|
|
104
|
+
```
|
package/dist/index.d.ts
ADDED