@visns-studio/visns-components 1.8.5 → 2.0.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/.prettierrc.json +7 -0
- package/components/cms/{visns-data-grid.jsx → DataGrid.jsx} +2 -2
- package/components/cms/DropZone.jsx +161 -0
- package/components/cms/Field.jsx +747 -0
- package/components/cms/Form.jsx +475 -0
- package/components/cms/sorting/{list.jsx → List.jsx} +3 -3
- package/components/crm/{visns-async-select.jsx → AsyncSelect.jsx} +9 -9
- package/components/crm/Call.jsx +220 -0
- package/components/crm/{visns-data-grid.jsx → DataGrid.jsx} +263 -277
- package/components/crm/{visns-field.jsx → Field.jsx} +5 -5
- package/components/crm/{visns-form.jsx → Form.jsx} +302 -205
- package/components/crm/{visns-multi-select.jsx → MultiSelect.jsx} +1 -1
- package/components/crm/{visns-navigation.jsx → Navigation.jsx} +22 -18
- package/components/crm/{visns-notification.jsx → Notification.jsx} +1 -1
- package/components/crm/TableFilter.jsx +125 -0
- package/components/crm/auth/Login.jsx +158 -0
- package/components/crm/auth/Profile.jsx +163 -0
- package/components/crm/auth/Reset.jsx +87 -0
- package/components/crm/auth/Verify.jsx +162 -0
- package/components/crm/generic/GenericDetail.jsx +380 -0
- package/components/crm/generic/GenericIndex.jsx +112 -0
- package/components/crm/generic/NotificationList.jsx +64 -0
- package/index.js +37 -19
- package/package.json +6 -6
- package/components/cms/visns-dropzone.jsx +0 -161
- package/components/cms/visns-field.jsx +0 -747
- package/components/cms/visns-form.jsx +0 -475
- package/components/crm/visns-call.jsx +0 -220
- package/components/crm/visns-table-filter.jsx +0 -153
- /package/components/cms/sorting/{item.jsx → Item.jsx} +0 -0
- /package/components/crm/{visns-autocomplete.jsx → Autocomplete.jsx} +0 -0
- /package/components/crm/{visns-download.jsx → Download.jsx} +0 -0
- /package/components/crm/{visns-fetch.jsx → Fetch.jsx} +0 -0
- /package/components/crm/{visns-loader.jsx → Loader.jsx} +0 -0
- /package/components/crm/{visns-select.jsx → Select.jsx} +0 -0
- /package/components/crm/{visns-select-list.jsx → SelectList.jsx} +0 -0
package/.prettierrc.json
ADDED
|
@@ -35,8 +35,8 @@ import "@inovua/reactdatagrid-community/index.css";
|
|
|
35
35
|
import "react-confirm-alert/src/react-confirm-alert.css";
|
|
36
36
|
import "react-toggle/style.css";
|
|
37
37
|
|
|
38
|
-
import CustomFetch from "../crm/
|
|
39
|
-
import Form from "./
|
|
38
|
+
import CustomFetch from "../crm/Fetch";
|
|
39
|
+
import Form from "./Form";
|
|
40
40
|
|
|
41
41
|
const loadData = async (
|
|
42
42
|
{ skip, limit, sortInfo, currentData, filterValue, groupBy },
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import React, { useState, useCallback } from "react";
|
|
2
|
+
import { motion } from "framer-motion";
|
|
3
|
+
import { useDropzone } from "react-dropzone";
|
|
4
|
+
import { confirmAlert } from "react-confirm-alert";
|
|
5
|
+
import { File, TrashCan } from "akar-icons";
|
|
6
|
+
import { toast } from "react-toastify";
|
|
7
|
+
|
|
8
|
+
import "react-confirm-alert/src/react-confirm-alert.css";
|
|
9
|
+
|
|
10
|
+
import CustomFetch from "../crm/Fetch";
|
|
11
|
+
|
|
12
|
+
function VisnsDropZone(props) {
|
|
13
|
+
const { fetchData, files, settings } = props;
|
|
14
|
+
const [loadingProgress, setLoadingProgress] = useState(0);
|
|
15
|
+
|
|
16
|
+
const onDrop = useCallback((acceptedFiles) => {
|
|
17
|
+
acceptedFiles.forEach((a) => {
|
|
18
|
+
Vapor.store(a, {
|
|
19
|
+
progress: (progress) => {
|
|
20
|
+
setLoadingProgress(progress * 100);
|
|
21
|
+
},
|
|
22
|
+
}).then((response) => {
|
|
23
|
+
setLoadingProgress(0);
|
|
24
|
+
CustomFetch(
|
|
25
|
+
settings.url,
|
|
26
|
+
settings.method,
|
|
27
|
+
{
|
|
28
|
+
uuid: response.uuid,
|
|
29
|
+
key: response.key,
|
|
30
|
+
bucket: response.bucket,
|
|
31
|
+
filename: a.name,
|
|
32
|
+
filesize: a.size,
|
|
33
|
+
extension: response.extension,
|
|
34
|
+
...settings.data,
|
|
35
|
+
},
|
|
36
|
+
function (result) {
|
|
37
|
+
if (result.error === "") {
|
|
38
|
+
fetchData();
|
|
39
|
+
|
|
40
|
+
toast.success(
|
|
41
|
+
"File has been successfully uploaded."
|
|
42
|
+
);
|
|
43
|
+
} else {
|
|
44
|
+
toast.error(String(result.error));
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
);
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
}, []);
|
|
51
|
+
|
|
52
|
+
const { getRootProps, getInputProps, isDragActive } = useDropzone({
|
|
53
|
+
onDrop,
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
const handleDownload = (id) => {
|
|
57
|
+
if (id && id > 0) {
|
|
58
|
+
window.open(`/ajax/file/download/${id}/${settings.model}`);
|
|
59
|
+
} else {
|
|
60
|
+
toast.warning("Issue with downloading the selected file.");
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const handleDelete = (e, id, name) => {
|
|
65
|
+
if (e) {
|
|
66
|
+
e.preventDefault();
|
|
67
|
+
e.stopPropagation();
|
|
68
|
+
|
|
69
|
+
if (id && id > 0) {
|
|
70
|
+
confirmAlert({
|
|
71
|
+
title: "Confirm to Delete File",
|
|
72
|
+
message: "Are you sure you want to delete " + name,
|
|
73
|
+
buttons: [
|
|
74
|
+
{
|
|
75
|
+
label: "Yes",
|
|
76
|
+
onClick: () => {
|
|
77
|
+
CustomFetch(
|
|
78
|
+
`/ajax/file/delete`,
|
|
79
|
+
"POST",
|
|
80
|
+
{
|
|
81
|
+
file_id: id,
|
|
82
|
+
},
|
|
83
|
+
function (result) {
|
|
84
|
+
if (result.error === "") {
|
|
85
|
+
fetchData();
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
);
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
label: "No",
|
|
93
|
+
onClick: () => close(),
|
|
94
|
+
},
|
|
95
|
+
],
|
|
96
|
+
});
|
|
97
|
+
} else {
|
|
98
|
+
toast.error("Issue with deleting the selected file.");
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
return (
|
|
104
|
+
<>
|
|
105
|
+
<div className="progress">
|
|
106
|
+
<motion.div
|
|
107
|
+
className="progress__bar"
|
|
108
|
+
initial={{ width: "0%" }}
|
|
109
|
+
animate={{
|
|
110
|
+
width: loadingProgress + "%",
|
|
111
|
+
}}
|
|
112
|
+
transition={{
|
|
113
|
+
duration: 1,
|
|
114
|
+
ease: [0.165, 0.84, 0.44, 1.0],
|
|
115
|
+
}}
|
|
116
|
+
/>
|
|
117
|
+
</div>
|
|
118
|
+
<section className="dropzone__container">
|
|
119
|
+
<div {...getRootProps()}>
|
|
120
|
+
<input {...getInputProps()} />
|
|
121
|
+
{isDragActive ? (
|
|
122
|
+
<p>Drop the files here ...</p>
|
|
123
|
+
) : (
|
|
124
|
+
<p>
|
|
125
|
+
Drag 'n' drop some files here, or click to select
|
|
126
|
+
files
|
|
127
|
+
</p>
|
|
128
|
+
)}
|
|
129
|
+
</div>
|
|
130
|
+
<ul className="dropzone__files">
|
|
131
|
+
{files && files.length > 0
|
|
132
|
+
? files.map((a, b) => (
|
|
133
|
+
<li
|
|
134
|
+
onClick={() => {
|
|
135
|
+
handleDownload(a.id);
|
|
136
|
+
}}
|
|
137
|
+
key={"tf-" + b}
|
|
138
|
+
>
|
|
139
|
+
<File strokeWidth={2} size={18} />
|
|
140
|
+
{a.file_name}
|
|
141
|
+
<button
|
|
142
|
+
onClick={(event) => {
|
|
143
|
+
handleDelete(
|
|
144
|
+
event,
|
|
145
|
+
a.id,
|
|
146
|
+
a.file_name
|
|
147
|
+
);
|
|
148
|
+
}}
|
|
149
|
+
>
|
|
150
|
+
<TrashCan strokeWidth={2} size={18} />
|
|
151
|
+
</button>
|
|
152
|
+
</li>
|
|
153
|
+
))
|
|
154
|
+
: null}
|
|
155
|
+
</ul>
|
|
156
|
+
</section>
|
|
157
|
+
</>
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
export default VisnsDropZone;
|