@visns-studio/visns-components 1.0.3 → 1.0.5
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/components/cms/sorting/item.jsx +21 -0
- package/components/cms/sorting/list.jsx +21 -0
- package/components/cms/visns-data-grid.jsx +597 -0
- package/components/cms/visns-dropzone.jsx +190 -0
- package/components/cms/visns-field.jsx +696 -0
- package/components/cms/visns-form.jsx +467 -0
- package/components/crm/visns-download.jsx +102 -0
- package/index.js +27 -15
- package/package.json +1 -1
- /package/components/{visns-download.jsx → cms/visns-download.jsx} +0 -0
- /package/components/{visns-async-select.jsx → crm/visns-async-select.jsx} +0 -0
- /package/components/{visns-autocomplete.jsx → crm/visns-autocomplete.jsx} +0 -0
- /package/components/{visns-call.jsx → crm/visns-call.jsx} +0 -0
- /package/components/{visns-data-grid.jsx → crm/visns-data-grid.jsx} +0 -0
- /package/components/{visns-fetch.jsx → crm/visns-fetch.jsx} +0 -0
- /package/components/{visns-field.jsx → crm/visns-field.jsx} +0 -0
- /package/components/{visns-form.jsx → crm/visns-form.jsx} +0 -0
- /package/components/{visns-loader.jsx → crm/visns-loader.jsx} +0 -0
- /package/components/{visns-multi-select.jsx → crm/visns-multi-select.jsx} +0 -0
- /package/components/{visns-notification.jsx → crm/visns-notification.jsx} +0 -0
- /package/components/{visns-select-list.jsx → crm/visns-select-list.jsx} +0 -0
- /package/components/{visns-select.jsx → crm/visns-select.jsx} +0 -0
- /package/components/{visns-table-filter.jsx → crm/visns-table-filter.jsx} +0 -0
|
@@ -0,0 +1,467 @@
|
|
|
1
|
+
import React, { useState, useEffect } from "react";
|
|
2
|
+
import CustomFetch from "../crm/visns-fetch";
|
|
3
|
+
import Field from "./visns-field";
|
|
4
|
+
import slugify from "react-slugify";
|
|
5
|
+
import moment from "moment";
|
|
6
|
+
import Reveal from "react-reveal/Reveal";
|
|
7
|
+
import { confirmAlert } from "react-confirm-alert";
|
|
8
|
+
import { Copy, Send, TrashBin } from "akar-icons";
|
|
9
|
+
|
|
10
|
+
import "react-confirm-alert/src/react-confirm-alert.css";
|
|
11
|
+
|
|
12
|
+
function Form(props) {
|
|
13
|
+
const { dataId, navigate, form, setActiveNav, alertStateChange } = props;
|
|
14
|
+
const [data, setData] = useState({});
|
|
15
|
+
const [dataClass, setDataClass] = useState({});
|
|
16
|
+
const [audit, setAudit] = useState({
|
|
17
|
+
createdBy: {},
|
|
18
|
+
created: "",
|
|
19
|
+
updatedBy: {},
|
|
20
|
+
updated: "",
|
|
21
|
+
});
|
|
22
|
+
const [uploadProgress, setUploadProgress] = useState({});
|
|
23
|
+
|
|
24
|
+
const handleChange = (e) => {
|
|
25
|
+
if (e) {
|
|
26
|
+
switch (e.target.name) {
|
|
27
|
+
case "title":
|
|
28
|
+
setData((prevState) => ({
|
|
29
|
+
...prevState,
|
|
30
|
+
[e.target.name]: e.target.value,
|
|
31
|
+
}));
|
|
32
|
+
|
|
33
|
+
setData((prevState) => ({
|
|
34
|
+
...prevState,
|
|
35
|
+
slug: slugify(e.target.value),
|
|
36
|
+
}));
|
|
37
|
+
break;
|
|
38
|
+
default:
|
|
39
|
+
setData((prevState) => ({
|
|
40
|
+
...prevState,
|
|
41
|
+
[e.target.name]: e.target.value,
|
|
42
|
+
}));
|
|
43
|
+
break;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const handleChangeSelect = (value, action, id) => {
|
|
49
|
+
if (value && action && id) {
|
|
50
|
+
setData((prevState) => ({
|
|
51
|
+
...prevState,
|
|
52
|
+
[id]: value,
|
|
53
|
+
}));
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
const handleChangeRicheditor = (value, name) => {
|
|
58
|
+
setData((prevState) => ({
|
|
59
|
+
...prevState,
|
|
60
|
+
[name]: value,
|
|
61
|
+
}));
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const handleChangeFile = (e) => {
|
|
65
|
+
if (e) {
|
|
66
|
+
setData((prevState) => ({
|
|
67
|
+
...prevState,
|
|
68
|
+
[e.target.name]: e.target.files[0],
|
|
69
|
+
}));
|
|
70
|
+
|
|
71
|
+
Vapor.store(e.target.files[0], {
|
|
72
|
+
progress: (progress) => {
|
|
73
|
+
setUploadProgress((prevState) => ({
|
|
74
|
+
...prevState,
|
|
75
|
+
[e.target.name]: progress * 100,
|
|
76
|
+
}));
|
|
77
|
+
},
|
|
78
|
+
}).then((response) => {
|
|
79
|
+
if (data.hasOwnProperty("files")) {
|
|
80
|
+
let _files = data.files;
|
|
81
|
+
let _new = true;
|
|
82
|
+
|
|
83
|
+
data.files.forEach((a, b) => {
|
|
84
|
+
if (e.target.name === a.field) {
|
|
85
|
+
_files[b] = {
|
|
86
|
+
field: e.target.name,
|
|
87
|
+
uuid: response.uuid,
|
|
88
|
+
key: response.key,
|
|
89
|
+
bucket: response.bucket,
|
|
90
|
+
filename: e.target.files[0].name,
|
|
91
|
+
filesize: e.target.files[0].size,
|
|
92
|
+
extension: response.extension,
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
_new = false;
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
if (_new === true) {
|
|
100
|
+
setData((prevState) => ({
|
|
101
|
+
...prevState,
|
|
102
|
+
files: [
|
|
103
|
+
...prevState.files,
|
|
104
|
+
{
|
|
105
|
+
field: e.target.name,
|
|
106
|
+
uuid: response.uuid,
|
|
107
|
+
key: response.key,
|
|
108
|
+
bucket: response.bucket,
|
|
109
|
+
filename: e.target.files[0].name,
|
|
110
|
+
filesize: e.target.files[0].size,
|
|
111
|
+
extension: response.extension,
|
|
112
|
+
},
|
|
113
|
+
],
|
|
114
|
+
}));
|
|
115
|
+
} else {
|
|
116
|
+
setData((prevState) => ({
|
|
117
|
+
...prevState,
|
|
118
|
+
files: _files,
|
|
119
|
+
}));
|
|
120
|
+
}
|
|
121
|
+
} else {
|
|
122
|
+
setData((prevState) => ({
|
|
123
|
+
...prevState,
|
|
124
|
+
files: [
|
|
125
|
+
{
|
|
126
|
+
field: e.target.name,
|
|
127
|
+
uuid: response.uuid,
|
|
128
|
+
key: response.key,
|
|
129
|
+
bucket: response.bucket,
|
|
130
|
+
filename: e.target.files[0].name,
|
|
131
|
+
filesize: e.target.files[0].size,
|
|
132
|
+
extension: response.extension,
|
|
133
|
+
},
|
|
134
|
+
],
|
|
135
|
+
}));
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
const handleSubmit = (e) => {
|
|
142
|
+
if (e) {
|
|
143
|
+
e.preventDefault();
|
|
144
|
+
|
|
145
|
+
let error = "";
|
|
146
|
+
let url = "";
|
|
147
|
+
let method = "";
|
|
148
|
+
let message = "";
|
|
149
|
+
|
|
150
|
+
if (data.title === "") {
|
|
151
|
+
error += "Please enter a title.<br />";
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
if (data.summary === "") {
|
|
155
|
+
error += "Please enter a summary.<br />";
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
if (error === "") {
|
|
159
|
+
if (dataId === "create") {
|
|
160
|
+
url = form.url;
|
|
161
|
+
method = "POST";
|
|
162
|
+
message = "You have successfully created a new entry.";
|
|
163
|
+
} else {
|
|
164
|
+
url = form.url + "/" + dataId;
|
|
165
|
+
method = "PUT";
|
|
166
|
+
message = "You have successfully updated this entry.";
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
CustomFetch(
|
|
170
|
+
url,
|
|
171
|
+
method,
|
|
172
|
+
data,
|
|
173
|
+
function (result) {
|
|
174
|
+
if (result.error === "") {
|
|
175
|
+
let _uploadProgress = uploadProgress;
|
|
176
|
+
|
|
177
|
+
Object.keys(_uploadProgress).forEach((a, b) => {
|
|
178
|
+
setUploadProgress((prevState) => ({
|
|
179
|
+
...prevState,
|
|
180
|
+
[b]: 0,
|
|
181
|
+
}));
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
alertStateChange({
|
|
185
|
+
show: true,
|
|
186
|
+
alertClass: "dialog success",
|
|
187
|
+
alertText: message,
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
if (dataId === "create") {
|
|
191
|
+
navigate(
|
|
192
|
+
form.url.replace("/ajax", "") +
|
|
193
|
+
"/" +
|
|
194
|
+
result.data.id,
|
|
195
|
+
{
|
|
196
|
+
state: {
|
|
197
|
+
form: form,
|
|
198
|
+
},
|
|
199
|
+
}
|
|
200
|
+
);
|
|
201
|
+
}
|
|
202
|
+
} else {
|
|
203
|
+
alertStateChange({
|
|
204
|
+
show: true,
|
|
205
|
+
alertClass: "dialog error",
|
|
206
|
+
alertText: result.error,
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
},
|
|
210
|
+
function (error) {
|
|
211
|
+
alertStateChange({
|
|
212
|
+
show: true,
|
|
213
|
+
alertClass: "dialog error",
|
|
214
|
+
alertText: String(error),
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
);
|
|
218
|
+
} else {
|
|
219
|
+
alertStateChange({
|
|
220
|
+
show: true,
|
|
221
|
+
alertClass: "dialog error",
|
|
222
|
+
alertText: error,
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
};
|
|
227
|
+
|
|
228
|
+
const handleDelete = (e) => {
|
|
229
|
+
if (e) {
|
|
230
|
+
confirmAlert({
|
|
231
|
+
title: "Delete this entry",
|
|
232
|
+
message: "Are you sure you want to delete it?",
|
|
233
|
+
buttons: [
|
|
234
|
+
{
|
|
235
|
+
label: "Yes",
|
|
236
|
+
onClick: () =>
|
|
237
|
+
CustomFetch(
|
|
238
|
+
`${form.url}/${dataId}`,
|
|
239
|
+
"DELETE",
|
|
240
|
+
{},
|
|
241
|
+
function (result) {
|
|
242
|
+
if (result.error === "") {
|
|
243
|
+
navigate(form.url.replace("/ajax", ""));
|
|
244
|
+
alertStateChange({
|
|
245
|
+
show: true,
|
|
246
|
+
alertClass: "dialog success",
|
|
247
|
+
alertText:
|
|
248
|
+
"You have successfully deleted this entry.",
|
|
249
|
+
});
|
|
250
|
+
} else {
|
|
251
|
+
alertStateChange({
|
|
252
|
+
show: true,
|
|
253
|
+
alertClass: "dialog error",
|
|
254
|
+
alertText: result.error,
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
},
|
|
258
|
+
function (error) {
|
|
259
|
+
alertStateChange({
|
|
260
|
+
show: true,
|
|
261
|
+
alertClass: "dialog error",
|
|
262
|
+
alertText: String(error),
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
),
|
|
266
|
+
},
|
|
267
|
+
{
|
|
268
|
+
label: "No",
|
|
269
|
+
onClick: () => close(),
|
|
270
|
+
},
|
|
271
|
+
],
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
};
|
|
275
|
+
|
|
276
|
+
const fetchData = () => {
|
|
277
|
+
form.fields.forEach((a) => {
|
|
278
|
+
setData((prevState) => ({
|
|
279
|
+
...prevState,
|
|
280
|
+
[a.id]: "",
|
|
281
|
+
}));
|
|
282
|
+
});
|
|
283
|
+
|
|
284
|
+
if (dataId !== "create") {
|
|
285
|
+
CustomFetch(
|
|
286
|
+
`${form.url}/${dataId}`,
|
|
287
|
+
"GET",
|
|
288
|
+
{},
|
|
289
|
+
function (result) {
|
|
290
|
+
let now = moment();
|
|
291
|
+
let created = moment.duration(
|
|
292
|
+
now.diff(result.data.created_at)
|
|
293
|
+
);
|
|
294
|
+
let updated = moment.duration(
|
|
295
|
+
now.diff(result.data.updated_at)
|
|
296
|
+
);
|
|
297
|
+
|
|
298
|
+
setData(result.data);
|
|
299
|
+
setAudit((prevState) => ({
|
|
300
|
+
...prevState,
|
|
301
|
+
createdBy: result.audit_first,
|
|
302
|
+
created:
|
|
303
|
+
created.hours() > 24
|
|
304
|
+
? created.days() +
|
|
305
|
+
" Days " +
|
|
306
|
+
created.hours() +
|
|
307
|
+
" Hour(s) " +
|
|
308
|
+
created.minutes() +
|
|
309
|
+
" Minutes"
|
|
310
|
+
: created.hours() +
|
|
311
|
+
" Hour(s) " +
|
|
312
|
+
created.minutes() +
|
|
313
|
+
" Minutes",
|
|
314
|
+
updatedBy: result.audit_latest,
|
|
315
|
+
updated:
|
|
316
|
+
updated.hours() > 24
|
|
317
|
+
? updated.days() +
|
|
318
|
+
" Days " +
|
|
319
|
+
updated.hours() +
|
|
320
|
+
" Hour(s) " +
|
|
321
|
+
updated.minutes() +
|
|
322
|
+
" Minutes"
|
|
323
|
+
: updated.hours() +
|
|
324
|
+
" Hour(s) " +
|
|
325
|
+
updated.minutes() +
|
|
326
|
+
" Minutes",
|
|
327
|
+
}));
|
|
328
|
+
},
|
|
329
|
+
function (error) {
|
|
330
|
+
navigate("/insights");
|
|
331
|
+
alertStateChange({
|
|
332
|
+
show: true,
|
|
333
|
+
alertClass: "dialog error",
|
|
334
|
+
alertText: String(error),
|
|
335
|
+
});
|
|
336
|
+
}
|
|
337
|
+
);
|
|
338
|
+
}
|
|
339
|
+
};
|
|
340
|
+
|
|
341
|
+
useEffect(() => {
|
|
342
|
+
form.fields.forEach((a) => {
|
|
343
|
+
if (a.type === "image") {
|
|
344
|
+
setUploadProgress((prevState) => ({
|
|
345
|
+
...prevState,
|
|
346
|
+
[a.id]: 0,
|
|
347
|
+
}));
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
setData((prevState) => ({
|
|
351
|
+
...prevState,
|
|
352
|
+
[a.id]: "",
|
|
353
|
+
}));
|
|
354
|
+
|
|
355
|
+
setDataClass((prevState) => ({
|
|
356
|
+
...prevState,
|
|
357
|
+
[a.id]: "",
|
|
358
|
+
}));
|
|
359
|
+
});
|
|
360
|
+
|
|
361
|
+
fetchData();
|
|
362
|
+
setActiveNav();
|
|
363
|
+
}, [dataId]);
|
|
364
|
+
|
|
365
|
+
return (
|
|
366
|
+
<Reveal effect="fadeInUp">
|
|
367
|
+
<div className="grid">
|
|
368
|
+
<div className="grid__row">
|
|
369
|
+
<div className="grid__full cmstitle">
|
|
370
|
+
<h1>{data.title}</h1>
|
|
371
|
+
<div className="cmstitle__actions">
|
|
372
|
+
<button
|
|
373
|
+
className="btn actionbtn"
|
|
374
|
+
onClick={handleSubmit}
|
|
375
|
+
>
|
|
376
|
+
<Copy size={18} strokeWidth={2} />{" "}
|
|
377
|
+
{dataId !== "create" ? "Save" : "Create"}
|
|
378
|
+
</button>
|
|
379
|
+
</div>
|
|
380
|
+
</div>
|
|
381
|
+
</div>
|
|
382
|
+
</div>
|
|
383
|
+
<div className="dynamic">
|
|
384
|
+
<div className="dynamic__left">
|
|
385
|
+
<div className="formcontainer">
|
|
386
|
+
<div className="dynamicform">
|
|
387
|
+
{form.fields.map((a, b) => (
|
|
388
|
+
<Field
|
|
389
|
+
alertStateChange={alertStateChange}
|
|
390
|
+
settings={a}
|
|
391
|
+
key={
|
|
392
|
+
b +
|
|
393
|
+
"-fields-" +
|
|
394
|
+
(a.hasOwnProperty("key")
|
|
395
|
+
? a.id + "-" + a.key
|
|
396
|
+
: a.id)
|
|
397
|
+
}
|
|
398
|
+
inputValue={
|
|
399
|
+
a.hasOwnProperty("key")
|
|
400
|
+
? data[a.key]
|
|
401
|
+
: Array.isArray(data[a.id]) &&
|
|
402
|
+
a.type === "image"
|
|
403
|
+
? data[a.id].length > 0
|
|
404
|
+
? data[a.id][0]
|
|
405
|
+
: ""
|
|
406
|
+
: data[a.id]
|
|
407
|
+
}
|
|
408
|
+
inputClass={dataClass}
|
|
409
|
+
onChange={handleChange}
|
|
410
|
+
onChangeFile={handleChangeFile}
|
|
411
|
+
onChangeRicheditor={handleChangeRicheditor}
|
|
412
|
+
onChangeSelect={handleChangeSelect}
|
|
413
|
+
setFormData={setData}
|
|
414
|
+
uploadProgress={uploadProgress}
|
|
415
|
+
/>
|
|
416
|
+
))}
|
|
417
|
+
</div>
|
|
418
|
+
</div>
|
|
419
|
+
</div>
|
|
420
|
+
<div className="dynamic__right">
|
|
421
|
+
<h1>Information</h1>
|
|
422
|
+
<ul>
|
|
423
|
+
<li>
|
|
424
|
+
Created: <span>{audit.created} Ago</span>
|
|
425
|
+
</li>
|
|
426
|
+
<li>
|
|
427
|
+
By:{" "}
|
|
428
|
+
<span>
|
|
429
|
+
{audit &&
|
|
430
|
+
audit.createdBy &&
|
|
431
|
+
audit.createdBy.user
|
|
432
|
+
? audit.createdBy.user.name
|
|
433
|
+
: null}
|
|
434
|
+
</span>
|
|
435
|
+
</li>
|
|
436
|
+
<li>
|
|
437
|
+
Last Update: <span>{audit.updated} Ago</span>
|
|
438
|
+
</li>
|
|
439
|
+
<li>
|
|
440
|
+
by:{" "}
|
|
441
|
+
<span>
|
|
442
|
+
{audit &&
|
|
443
|
+
audit.updatedBy &&
|
|
444
|
+
audit.updatedBy.user
|
|
445
|
+
? audit.updatedBy.user.name
|
|
446
|
+
: null}
|
|
447
|
+
</span>
|
|
448
|
+
</li>
|
|
449
|
+
{dataId !== "create" ? (
|
|
450
|
+
<li>
|
|
451
|
+
<button
|
|
452
|
+
className="btn actionbtn deletebtn"
|
|
453
|
+
onClick={handleDelete}
|
|
454
|
+
>
|
|
455
|
+
<TrashBin size={14} strokeWidth={2} />{" "}
|
|
456
|
+
Delete Entry
|
|
457
|
+
</button>
|
|
458
|
+
</li>
|
|
459
|
+
) : null}
|
|
460
|
+
</ul>
|
|
461
|
+
</div>
|
|
462
|
+
</div>
|
|
463
|
+
</Reveal>
|
|
464
|
+
);
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
export default Form;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import _ from 'lodash';
|
|
2
|
+
import axios from 'axios';
|
|
3
|
+
import { trackPromise } from 'react-promise-tracker';
|
|
4
|
+
|
|
5
|
+
const CustomDownload = (
|
|
6
|
+
url,
|
|
7
|
+
method,
|
|
8
|
+
formData,
|
|
9
|
+
successCallback,
|
|
10
|
+
errorCallback
|
|
11
|
+
) => {
|
|
12
|
+
let baseUrl = '';
|
|
13
|
+
let fileUpload = false;
|
|
14
|
+
let body;
|
|
15
|
+
let headers = {};
|
|
16
|
+
let options = {};
|
|
17
|
+
|
|
18
|
+
if (!_.isEmpty(formData)) {
|
|
19
|
+
Object.keys(formData).forEach((item) => {
|
|
20
|
+
if (formData[item] !== undefined) {
|
|
21
|
+
if (formData[item] instanceof File && formData[item] !== null) {
|
|
22
|
+
fileUpload = true;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
if (method.toUpperCase() === 'PUT' || method.toUpperCase() === 'PATCH') {
|
|
29
|
+
if (fileUpload === false) {
|
|
30
|
+
body = {
|
|
31
|
+
...body,
|
|
32
|
+
_method: method,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (fileUpload === false) {
|
|
38
|
+
body = JSON.stringify(formData);
|
|
39
|
+
headers = {
|
|
40
|
+
...headers,
|
|
41
|
+
'Content-Type': 'application/json',
|
|
42
|
+
};
|
|
43
|
+
} else {
|
|
44
|
+
body = new FormData();
|
|
45
|
+
|
|
46
|
+
headers = {
|
|
47
|
+
...headers,
|
|
48
|
+
'Content-Type': 'multipart/form-data',
|
|
49
|
+
contentType: false,
|
|
50
|
+
processData: false,
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
if (!_.isEmpty(formData)) {
|
|
54
|
+
Object.keys(formData).forEach((item) => {
|
|
55
|
+
body.append(item, formData[item]);
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
if (
|
|
60
|
+
method.toUpperCase() === 'PUT' ||
|
|
61
|
+
method.toUpperCase() === 'PATCH'
|
|
62
|
+
) {
|
|
63
|
+
if (fileUpload === false) {
|
|
64
|
+
} else {
|
|
65
|
+
body.append('_method', method);
|
|
66
|
+
method = 'POST';
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
options = {
|
|
72
|
+
method: method,
|
|
73
|
+
data: body,
|
|
74
|
+
headers: headers,
|
|
75
|
+
url: baseUrl + url,
|
|
76
|
+
responseType: 'blob',
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
trackPromise(
|
|
80
|
+
axios(options).then(
|
|
81
|
+
(result) => {
|
|
82
|
+
successCallback(result.data);
|
|
83
|
+
},
|
|
84
|
+
(error) => {
|
|
85
|
+
if (
|
|
86
|
+
error.response.hasOwnProperty('data') &&
|
|
87
|
+
error.response.data.hasOwnProperty('message') &&
|
|
88
|
+
error.response.data.message !== ''
|
|
89
|
+
) {
|
|
90
|
+
if (error.response.data.message === 'Unauthenticated.') {
|
|
91
|
+
localStorage.clear();
|
|
92
|
+
}
|
|
93
|
+
errorCallback(error.response.data.message);
|
|
94
|
+
} else {
|
|
95
|
+
errorCallback(error);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
)
|
|
99
|
+
);
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
export default CustomDownload;
|
package/index.js
CHANGED
|
@@ -1,25 +1,35 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
1
|
+
/** CMS Components */
|
|
2
|
+
import CmsForm from "./components/cms/visns-form";
|
|
3
|
+
import DataGrid from "./components/cms/visns-data-grid";
|
|
4
|
+
import Download from "./components/cms/visns-download";
|
|
5
|
+
import DropZone from "./components/cms/visns-dropzone";
|
|
6
|
+
import SortableList from "./components/cms/sorting/list";
|
|
7
|
+
|
|
8
|
+
/** CRM Components */
|
|
9
|
+
import AsyncSelect from "./components/crm/visns-async-select";
|
|
10
|
+
import Autocomplete from "./components/crm/visns-autocomplete";
|
|
11
|
+
import Call from "./components/crm/visns-call";
|
|
12
|
+
import CustomFetch from "./components/crm/visns-fetch";
|
|
13
|
+
import Download from "./components/crm/visns-download";
|
|
14
|
+
import Field from "./components/crm/visns-field";
|
|
15
|
+
import Form from "./components/crm/visns-form";
|
|
16
|
+
import Loader from "./components/crm/visns-loader";
|
|
17
|
+
import MultiSelect from "./components/crm/visns-multi-select";
|
|
18
|
+
import Notification from "./components/crm/visns-notification";
|
|
19
|
+
import SelectList from "./components/crm/visns-select-list";
|
|
20
|
+
import Select from "./components/crm/visns-select";
|
|
21
|
+
import Table from "./components/crm/visns-data-grid";
|
|
22
|
+
import TableFilter from "./components/crm/visns-table-filter";
|
|
15
23
|
|
|
16
24
|
export {
|
|
17
25
|
AsyncSelect,
|
|
18
26
|
Autocomplete,
|
|
19
27
|
Call,
|
|
28
|
+
CmsForm,
|
|
29
|
+
CustomFetch,
|
|
20
30
|
DataGrid,
|
|
21
31
|
Download,
|
|
22
|
-
|
|
32
|
+
DropZone,
|
|
23
33
|
Field,
|
|
24
34
|
Form,
|
|
25
35
|
Loader,
|
|
@@ -27,5 +37,7 @@ export {
|
|
|
27
37
|
Notification,
|
|
28
38
|
SelectList,
|
|
29
39
|
Select,
|
|
40
|
+
SortableList,
|
|
41
|
+
Table,
|
|
30
42
|
TableFilter,
|
|
31
43
|
};
|
package/package.json
CHANGED
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"react-dom": ">=18.2.0"
|
|
31
31
|
},
|
|
32
32
|
"name": "@visns-studio/visns-components",
|
|
33
|
-
"version": "1.0.
|
|
33
|
+
"version": "1.0.5",
|
|
34
34
|
"description": "Various packages to assist in the development of our Custom Applications.",
|
|
35
35
|
"main": "index.js",
|
|
36
36
|
"devDependencies": {},
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|