@visns-studio/visns-components 4.7.0 → 4.7.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/104e5636d8ddb791614c.woff2 +0 -0
- package/dist/11fe6a83d647de5daf95.woff +0 -0
- package/dist/141e2a8c7836495afe2a.woff +0 -0
- package/dist/2ba5877f7079830b5383.woff +0 -0
- package/dist/2d6836f45b2037be41f3.woff +0 -0
- package/dist/399.0a0f3e0d21be1057d599.css +8 -0
- package/dist/399.b8f57fa3f8c0c10119e4.js +1 -0
- package/dist/47d566c3b1293dfd9d77.woff +0 -0
- package/dist/6282a13cbba671a71913.woff2 +0 -0
- package/dist/78266f551031aa9db127.woff +0 -0
- package/dist/7b7da89f1e3fdcbfe36c.woff2 +0 -0
- package/dist/7e78e8338af7efeda712.woff2 +0 -0
- package/dist/7fa387951673abf164b1.woff2 +0 -0
- package/dist/819d59862c2d0640aad8.woff +0 -0
- package/dist/b615e1a6c838ea059a56.woff +0 -0
- package/dist/b9b1aa739c660c4ce67c.woff2 +0 -0
- package/dist/c5f3640b11df9414facb.woff +0 -0
- package/dist/da26d162ff5af71d6590.woff2 +0 -0
- package/dist/dd5b2912dbf896310865.woff2 +0 -0
- package/dist/f282b331272463c1aa6c.woff2 +0 -0
- package/dist/index.css +2902 -0
- package/dist/index.js +2 -0
- package/dist/index.js.LICENSE.txt +150 -0
- package/dist/main.83b033670d64419bb497.css +1 -0
- package/dist/main.b1723d17cd2d3513ab62.js +1 -0
- package/dist/report.html +39 -0
- package/dist/runtime.33c276593b23f8035b8d.js +1 -0
- package/package.json +26 -6
- package/.idea/codeStyles/Project.xml +0 -50
- package/.idea/codeStyles/codeStyleConfig.xml +0 -5
- package/.idea/deployment.xml +0 -4
- package/.idea/modules.xml +0 -8
- package/.idea/php.xml +0 -19
- package/.idea/vcs.xml +0 -6
- package/.idea/visns-components.iml +0 -8
- package/.prettierrc.json +0 -7
- package/.yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs +0 -541
- package/.yarn/releases/yarn-3.6.1.cjs +0 -874
- package/.yarnrc.yml +0 -7
- package/components/cms/DataGrid.jsx +0 -1461
- package/components/cms/DropZone.jsx +0 -349
- package/components/cms/Field.jsx +0 -802
- package/components/cms/Form.jsx +0 -476
- package/components/cms/generic/CmsDetail.jsx +0 -36
- package/components/cms/generic/CmsIndex.jsx +0 -73
- package/components/cms/generic/CmsSort.jsx +0 -125
- package/components/cms/sorting/Item.jsx +0 -115
- package/components/cms/sorting/List.jsx +0 -30
- package/components/crm/AsyncSelect.jsx +0 -125
- package/components/crm/Autocomplete.jsx +0 -174
- package/components/crm/Breadcrumb.jsx +0 -52
- package/components/crm/Call.jsx +0 -220
- package/components/crm/DataGrid.jsx +0 -2701
- package/components/crm/Download.jsx +0 -101
- package/components/crm/Fetch.jsx +0 -119
- package/components/crm/Field.jsx +0 -1557
- package/components/crm/Form.jsx +0 -1409
- package/components/crm/Loader.jsx +0 -29
- package/components/crm/MultiSelect.jsx +0 -78
- package/components/crm/Navigation.jsx +0 -619
- package/components/crm/Notification.jsx +0 -197
- package/components/crm/QrCode.jsx +0 -83
- package/components/crm/Select.jsx +0 -58
- package/components/crm/SelectList.jsx +0 -21
- package/components/crm/TableFilter.jsx +0 -198
- package/components/crm/auth/Login.jsx +0 -223
- package/components/crm/auth/Profile.jsx +0 -280
- package/components/crm/auth/Reset.jsx +0 -111
- package/components/crm/auth/Verify.jsx +0 -174
- package/components/crm/auth/styles/Login.module.css +0 -243
- package/components/crm/auth/styles/Profile.module.css +0 -222
- package/components/crm/auth/styles/Reset.module.css +0 -216
- package/components/crm/auth/styles/Verify.module.css +0 -216
- package/components/crm/generic/AuditLog.jsx +0 -108
- package/components/crm/generic/AuditLogs.jsx +0 -115
- package/components/crm/generic/GenericAuth.jsx +0 -166
- package/components/crm/generic/GenericDashboard.jsx +0 -42
- package/components/crm/generic/GenericDetail.jsx +0 -1499
- package/components/crm/generic/GenericDynamic.jsx +0 -915
- package/components/crm/generic/GenericFormBuilder.jsx +0 -1765
- package/components/crm/generic/GenericIndex.jsx +0 -376
- package/components/crm/generic/GenericMain.jsx +0 -129
- package/components/crm/generic/GenericSort.jsx +0 -188
- package/components/crm/generic/NotificationList.jsx +0 -64
- package/components/crm/generic/styles/AuditLog.module.css +0 -147
- package/components/crm/generic/styles/AuditLogs.module.css +0 -92
- package/components/crm/generic/styles/GenericDetail.module.css +0 -634
- package/components/crm/generic/styles/GenericDynamic.module.css +0 -932
- package/components/crm/generic/styles/GenericFormBuilder.module.css +0 -944
- package/components/crm/generic/styles/GenericIndex.module.css +0 -247
- package/components/crm/generic/styles/GenericMain.module.css +0 -91
- package/components/crm/generic/styles/GenericSort.module.css +0 -123
- package/components/crm/generic/styles/NotificationList.module.css +0 -67
- package/components/crm/sorting/Item.jsx +0 -117
- package/components/crm/sorting/List.jsx +0 -32
- package/components/crm/sorting/styles/Item.module.css +0 -68
- package/components/crm/sorting/styles/List.module.css +0 -68
- package/components/crm/styles/AsyncSelect.module.css +0 -8
- package/components/crm/styles/Autocomplete.module.css +0 -44
- package/components/crm/styles/DataGrid.module.css +0 -210
- package/components/crm/styles/Field.module.css +0 -311
- package/components/crm/styles/Form.module.css +0 -499
- package/components/crm/styles/Loader.module.css +0 -94
- package/components/crm/styles/MultiSelect.module.css +0 -8
- package/components/crm/styles/Navigation.module.css +0 -978
- package/components/crm/styles/Notification.module.css +0 -147
- package/components/crm/styles/QrCode.module.css +0 -87
- package/components/crm/styles/TableFilter.module.css +0 -52
- package/components/styles/global.css +0 -73
- package/index.js +0 -86
|
@@ -1,349 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, 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 { CircleX, File, TrashCan } from 'akar-icons';
|
|
6
|
-
import { toast } from 'react-toastify';
|
|
7
|
-
import { arrayMoveImmutable } from 'array-move';
|
|
8
|
-
import Popup from 'reactjs-popup';
|
|
9
|
-
|
|
10
|
-
import 'react-confirm-alert/src/react-confirm-alert.css';
|
|
11
|
-
|
|
12
|
-
import CustomFetch from '../crm/Fetch';
|
|
13
|
-
import SortableList from './sorting/List';
|
|
14
|
-
|
|
15
|
-
function VisnsDropZone({ fetchData, files, settings }) {
|
|
16
|
-
const [data, setData] = useState(files);
|
|
17
|
-
|
|
18
|
-
/** Modal States */
|
|
19
|
-
const [modalData, setModalData] = useState({
|
|
20
|
-
id: 0,
|
|
21
|
-
title: '',
|
|
22
|
-
description: '',
|
|
23
|
-
});
|
|
24
|
-
const [modalShow, setModalShow] = useState(false);
|
|
25
|
-
|
|
26
|
-
/** Modal Functions */
|
|
27
|
-
const modalOpen = () => {
|
|
28
|
-
setModalShow(true);
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
const modalClose = () => {
|
|
32
|
-
setModalShow(false);
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
const [loadingProgress, setLoadingProgress] = useState(0);
|
|
36
|
-
|
|
37
|
-
const onSortEnd = ({ oldIndex, newIndex }) => {
|
|
38
|
-
setData((prevItem) => arrayMoveImmutable(prevItem, oldIndex, newIndex));
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
const onDrop = useCallback((acceptedFiles) => {
|
|
42
|
-
acceptedFiles.forEach((a) => {
|
|
43
|
-
Vapor.store(a, {
|
|
44
|
-
progress: (progress) => {
|
|
45
|
-
setLoadingProgress(progress * 100);
|
|
46
|
-
},
|
|
47
|
-
}).then((response) => {
|
|
48
|
-
setLoadingProgress(0);
|
|
49
|
-
CustomFetch(
|
|
50
|
-
settings.url,
|
|
51
|
-
settings.method,
|
|
52
|
-
{
|
|
53
|
-
uuid: response.uuid,
|
|
54
|
-
key: response.key,
|
|
55
|
-
bucket: response.bucket,
|
|
56
|
-
filename: a.name,
|
|
57
|
-
filesize: a.size,
|
|
58
|
-
extension: response.extension,
|
|
59
|
-
...settings.data,
|
|
60
|
-
},
|
|
61
|
-
function (result) {
|
|
62
|
-
if (result.error === '') {
|
|
63
|
-
if (typeof fetchData === 'function') {
|
|
64
|
-
fetchData();
|
|
65
|
-
|
|
66
|
-
toast.success(
|
|
67
|
-
'File has been successfully uploaded.'
|
|
68
|
-
);
|
|
69
|
-
}
|
|
70
|
-
} else {
|
|
71
|
-
toast.error(String(result.error));
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
);
|
|
75
|
-
});
|
|
76
|
-
});
|
|
77
|
-
}, []);
|
|
78
|
-
|
|
79
|
-
const { getRootProps, getInputProps, isDragActive } = useDropzone({
|
|
80
|
-
onDrop,
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
const handleDownload = (id) => {
|
|
84
|
-
if (id && id > 0 && settings.model && settings.model !== '') {
|
|
85
|
-
window.open(`/ajax/files/download/${id}/${settings.model}`);
|
|
86
|
-
} else {
|
|
87
|
-
toast.warning('Issue with downloading the selected file.');
|
|
88
|
-
}
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
const handleChange = (e) => {
|
|
92
|
-
const { name, value } = e.target;
|
|
93
|
-
|
|
94
|
-
setModalData((prevState) => ({
|
|
95
|
-
...prevState,
|
|
96
|
-
[name]: value,
|
|
97
|
-
}));
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
const handleEdit = async (fileData) => {
|
|
101
|
-
try {
|
|
102
|
-
const res = await CustomFetch(
|
|
103
|
-
`/ajax/files/${fileData.id}`,
|
|
104
|
-
'GET',
|
|
105
|
-
{}
|
|
106
|
-
);
|
|
107
|
-
|
|
108
|
-
setModalData((prevState) => ({
|
|
109
|
-
...prevState,
|
|
110
|
-
id: res.data.id,
|
|
111
|
-
file_name: res.data.file_name,
|
|
112
|
-
title: res.data.file_title,
|
|
113
|
-
description: res.data.file_description,
|
|
114
|
-
}));
|
|
115
|
-
|
|
116
|
-
modalOpen();
|
|
117
|
-
} catch (error) {
|
|
118
|
-
console.info(error);
|
|
119
|
-
}
|
|
120
|
-
};
|
|
121
|
-
|
|
122
|
-
const handleDelete = (id, name) => {
|
|
123
|
-
if (id && id > 0) {
|
|
124
|
-
confirmAlert({
|
|
125
|
-
title: 'Confirm to Delete File',
|
|
126
|
-
message: 'Are you sure you want to delete ' + name,
|
|
127
|
-
buttons: [
|
|
128
|
-
{
|
|
129
|
-
label: 'Yes',
|
|
130
|
-
onClick: () => {
|
|
131
|
-
CustomFetch(
|
|
132
|
-
`/ajax/files/delete`,
|
|
133
|
-
'POST',
|
|
134
|
-
{
|
|
135
|
-
file_id: id,
|
|
136
|
-
},
|
|
137
|
-
function (result) {
|
|
138
|
-
if (result.error === '') {
|
|
139
|
-
if (typeof fetchData === 'function') {
|
|
140
|
-
fetchData();
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
);
|
|
145
|
-
},
|
|
146
|
-
},
|
|
147
|
-
{
|
|
148
|
-
label: 'No',
|
|
149
|
-
onClick: () => close(),
|
|
150
|
-
},
|
|
151
|
-
],
|
|
152
|
-
});
|
|
153
|
-
} else {
|
|
154
|
-
toast.error('Issue with deleting the selected file.');
|
|
155
|
-
}
|
|
156
|
-
};
|
|
157
|
-
|
|
158
|
-
const handleSubmit = async (e) => {
|
|
159
|
-
try {
|
|
160
|
-
if (e) {
|
|
161
|
-
e.preventDefault();
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
const res = await CustomFetch(
|
|
165
|
-
`/ajax/files/${modalData.id}`,
|
|
166
|
-
'PUT',
|
|
167
|
-
{
|
|
168
|
-
file_name: modalData.file_name,
|
|
169
|
-
file_title: modalData.title,
|
|
170
|
-
file_description: modalData.description,
|
|
171
|
-
}
|
|
172
|
-
);
|
|
173
|
-
|
|
174
|
-
if (res.data.error === '') {
|
|
175
|
-
toast.success('File metadata has been successfully updated.');
|
|
176
|
-
modalClose();
|
|
177
|
-
|
|
178
|
-
if (typeof fetchData === 'function') {
|
|
179
|
-
fetchData();
|
|
180
|
-
}
|
|
181
|
-
} else {
|
|
182
|
-
toast.error(res.data.error);
|
|
183
|
-
}
|
|
184
|
-
} catch (error) {
|
|
185
|
-
console.info(error);
|
|
186
|
-
}
|
|
187
|
-
};
|
|
188
|
-
|
|
189
|
-
useEffect(() => {
|
|
190
|
-
if (data?.length > 0) {
|
|
191
|
-
CustomFetch(
|
|
192
|
-
'/ajax/files/sort_update',
|
|
193
|
-
'POST',
|
|
194
|
-
{
|
|
195
|
-
list: data,
|
|
196
|
-
},
|
|
197
|
-
function (result) {
|
|
198
|
-
if (result.error === '') {
|
|
199
|
-
} else {
|
|
200
|
-
toast.error(String(result.error));
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
);
|
|
204
|
-
}
|
|
205
|
-
}, [data]);
|
|
206
|
-
|
|
207
|
-
useEffect(() => {
|
|
208
|
-
setData(files);
|
|
209
|
-
}, [files]);
|
|
210
|
-
|
|
211
|
-
return (
|
|
212
|
-
<>
|
|
213
|
-
{settings.type === 'gallery' ? (
|
|
214
|
-
<div className="image-container">
|
|
215
|
-
{data && data.length > 0 ? (
|
|
216
|
-
<SortableList
|
|
217
|
-
items={data}
|
|
218
|
-
onSortEnd={onSortEnd}
|
|
219
|
-
axis="xy"
|
|
220
|
-
helperClass="dragitem"
|
|
221
|
-
transitionDuration={250}
|
|
222
|
-
handleDelete={handleDelete}
|
|
223
|
-
handleEdit={handleEdit}
|
|
224
|
-
useDragHandle
|
|
225
|
-
showImage={true}
|
|
226
|
-
/>
|
|
227
|
-
) : null}
|
|
228
|
-
</div>
|
|
229
|
-
) : null}
|
|
230
|
-
<div className="progress">
|
|
231
|
-
<motion.div
|
|
232
|
-
className="progress__bar"
|
|
233
|
-
initial={{ width: '0%' }}
|
|
234
|
-
animate={{
|
|
235
|
-
width: loadingProgress + '%',
|
|
236
|
-
}}
|
|
237
|
-
transition={{
|
|
238
|
-
duration: 1,
|
|
239
|
-
ease: [0.165, 0.84, 0.44, 1.0],
|
|
240
|
-
}}
|
|
241
|
-
/>
|
|
242
|
-
</div>
|
|
243
|
-
<section className="dropzone__container">
|
|
244
|
-
<div {...getRootProps()}>
|
|
245
|
-
<input {...getInputProps()} />
|
|
246
|
-
{isDragActive ? (
|
|
247
|
-
<p>Drop the files here ...</p>
|
|
248
|
-
) : (
|
|
249
|
-
<p>
|
|
250
|
-
Drag 'n' drop some files here, or click to select
|
|
251
|
-
files
|
|
252
|
-
</p>
|
|
253
|
-
)}
|
|
254
|
-
</div>
|
|
255
|
-
{settings.type !== 'gallery' ? (
|
|
256
|
-
<ul className="dropzone__files">
|
|
257
|
-
{data && data.length > 0
|
|
258
|
-
? data.map((a, b) => (
|
|
259
|
-
<li
|
|
260
|
-
onClick={() => {
|
|
261
|
-
handleDownload(a.id);
|
|
262
|
-
}}
|
|
263
|
-
key={'tf-' + b}
|
|
264
|
-
>
|
|
265
|
-
<File strokeWidth={2} size={18} />
|
|
266
|
-
{a.file_name}
|
|
267
|
-
<button
|
|
268
|
-
onClick={(e) => {
|
|
269
|
-
e.preventDefault();
|
|
270
|
-
e.stopPropagation();
|
|
271
|
-
|
|
272
|
-
handleDelete(a.id, a.file_name);
|
|
273
|
-
}}
|
|
274
|
-
>
|
|
275
|
-
<TrashCan strokeWidth={2} size={18} />
|
|
276
|
-
</button>
|
|
277
|
-
</li>
|
|
278
|
-
))
|
|
279
|
-
: null}
|
|
280
|
-
</ul>
|
|
281
|
-
) : null}
|
|
282
|
-
</section>
|
|
283
|
-
<Popup
|
|
284
|
-
open={modalShow}
|
|
285
|
-
onClose={modalClose}
|
|
286
|
-
closeOnDocumentClick={false}
|
|
287
|
-
>
|
|
288
|
-
<div className="modalwrap top--modal">
|
|
289
|
-
<div className="modal">
|
|
290
|
-
<div className="modal__header">
|
|
291
|
-
<h1>Update File Metadata</h1>
|
|
292
|
-
<button
|
|
293
|
-
className="modal__close"
|
|
294
|
-
onClick={modalClose}
|
|
295
|
-
>
|
|
296
|
-
<CircleX strokeWidth={1} size={24} />
|
|
297
|
-
</button>
|
|
298
|
-
</div>
|
|
299
|
-
<div className="modal__content">
|
|
300
|
-
<div className="formcontainer">
|
|
301
|
-
<form
|
|
302
|
-
className="modalForm"
|
|
303
|
-
onSubmit={handleSubmit}
|
|
304
|
-
>
|
|
305
|
-
<div className="formItem fwItem">
|
|
306
|
-
<label className="fi__label">
|
|
307
|
-
<input
|
|
308
|
-
type="text"
|
|
309
|
-
name="title"
|
|
310
|
-
onChange={handleChange}
|
|
311
|
-
value={modalData.title}
|
|
312
|
-
/>
|
|
313
|
-
<span className="fi__span">
|
|
314
|
-
Title
|
|
315
|
-
</span>
|
|
316
|
-
</label>
|
|
317
|
-
</div>
|
|
318
|
-
<div className="formItem fwItem">
|
|
319
|
-
<label className="fi__label">
|
|
320
|
-
<textarea
|
|
321
|
-
name="description"
|
|
322
|
-
rows="5"
|
|
323
|
-
onChange={handleChange}
|
|
324
|
-
value={modalData.description}
|
|
325
|
-
></textarea>
|
|
326
|
-
<span className="fi__span">
|
|
327
|
-
Description
|
|
328
|
-
</span>
|
|
329
|
-
</label>
|
|
330
|
-
</div>
|
|
331
|
-
<div className="formItem fwItem lastItem">
|
|
332
|
-
<button
|
|
333
|
-
className="btn modalsave"
|
|
334
|
-
type="submit"
|
|
335
|
-
>
|
|
336
|
-
Save
|
|
337
|
-
</button>
|
|
338
|
-
</div>
|
|
339
|
-
</form>
|
|
340
|
-
</div>
|
|
341
|
-
</div>
|
|
342
|
-
</div>
|
|
343
|
-
</div>
|
|
344
|
-
</Popup>
|
|
345
|
-
</>
|
|
346
|
-
);
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
export default VisnsDropZone;
|