@visns-studio/visns-components 3.1.7 → 3.1.9
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.
|
@@ -13,6 +13,8 @@ import moment from 'moment';
|
|
|
13
13
|
import numeral from 'numeral';
|
|
14
14
|
import Popup from 'reactjs-popup';
|
|
15
15
|
import parse from 'html-react-parser';
|
|
16
|
+
import { saveAs } from 'file-saver';
|
|
17
|
+
import pluralize from 'pluralize';
|
|
16
18
|
import NumberFilter from '@inovua/reactdatagrid-community/NumberFilter';
|
|
17
19
|
import SelectFilter from '@inovua/reactdatagrid-community/SelectFilter';
|
|
18
20
|
import DateFilter from '@inovua/reactdatagrid-community/DateFilter';
|
|
@@ -28,6 +30,7 @@ import {
|
|
|
28
30
|
CloudDownload,
|
|
29
31
|
Copy,
|
|
30
32
|
Edit,
|
|
33
|
+
Envelope,
|
|
31
34
|
Folder,
|
|
32
35
|
Inbox,
|
|
33
36
|
Network,
|
|
@@ -42,6 +45,7 @@ import '@inovua/reactdatagrid-community/index.css';
|
|
|
42
45
|
import 'react-confirm-alert/src/react-confirm-alert.css';
|
|
43
46
|
|
|
44
47
|
import CustomFetch from './Fetch';
|
|
48
|
+
import Download from './Download';
|
|
45
49
|
import Form from './Form';
|
|
46
50
|
import _ from 'lodash';
|
|
47
51
|
|
|
@@ -191,6 +195,33 @@ const DataGrid = forwardRef(
|
|
|
191
195
|
},
|
|
192
196
|
}));
|
|
193
197
|
|
|
198
|
+
const handleDownload = async (d) => {
|
|
199
|
+
try {
|
|
200
|
+
toast.success('Starting download please wait...');
|
|
201
|
+
|
|
202
|
+
const res = await Download(
|
|
203
|
+
`/ajax/files/download/${d.id}/null`,
|
|
204
|
+
'GET',
|
|
205
|
+
{}
|
|
206
|
+
);
|
|
207
|
+
|
|
208
|
+
if (res.data.error) {
|
|
209
|
+
toast.error(res.data.error);
|
|
210
|
+
} else {
|
|
211
|
+
// Assuming the response contains a Blob or similar data
|
|
212
|
+
if (res.data && res.data instanceof Blob) {
|
|
213
|
+
const fileName = `${d.file_name}`;
|
|
214
|
+
saveAs(res.data, fileName);
|
|
215
|
+
} else {
|
|
216
|
+
// Handle the case where the response is not a Blob
|
|
217
|
+
toast.error('Invalid file format received.');
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
} catch (error) {
|
|
221
|
+
console.info(error);
|
|
222
|
+
}
|
|
223
|
+
};
|
|
224
|
+
|
|
194
225
|
const handleTimer = async (id, key) => {
|
|
195
226
|
try {
|
|
196
227
|
const res = await CustomFetch(`${form.url}/${id}`, 'PUT', {
|
|
@@ -385,6 +416,11 @@ const DataGrid = forwardRef(
|
|
|
385
416
|
],
|
|
386
417
|
});
|
|
387
418
|
break;
|
|
419
|
+
case 'envelope':
|
|
420
|
+
CustomFetch(s.url, 'POST', { id: d[s.key] }, (result) => {
|
|
421
|
+
toast.success(result.message);
|
|
422
|
+
});
|
|
423
|
+
break;
|
|
388
424
|
case 'sound':
|
|
389
425
|
const soundRelation = s.relation.reduce((acc, id) => {
|
|
390
426
|
if (acc === '') {
|
|
@@ -570,6 +606,31 @@ const DataGrid = forwardRef(
|
|
|
570
606
|
};
|
|
571
607
|
}, []);
|
|
572
608
|
|
|
609
|
+
const exportTrigger = async () => {
|
|
610
|
+
try {
|
|
611
|
+
toast.success('Starting export please wait...');
|
|
612
|
+
|
|
613
|
+
const res = await Download(form.export.url, 'POST', {
|
|
614
|
+
filter: filterValue,
|
|
615
|
+
});
|
|
616
|
+
|
|
617
|
+
if (res.data.error) {
|
|
618
|
+
toast.error(res.data.error);
|
|
619
|
+
} else {
|
|
620
|
+
// Assuming the response contains a Blob or similar data
|
|
621
|
+
if (res.data && res.data instanceof Blob) {
|
|
622
|
+
const fileName = `${form.export.filename}`;
|
|
623
|
+
saveAs(res.data, fileName);
|
|
624
|
+
} else {
|
|
625
|
+
// Handle the case where the response is not a Blob
|
|
626
|
+
toast.error('Invalid file format received.');
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
} catch (error) {
|
|
630
|
+
console.info(error);
|
|
631
|
+
}
|
|
632
|
+
};
|
|
633
|
+
|
|
573
634
|
const sortTrigger = () => {
|
|
574
635
|
const url = form.url.replace('/ajax', '');
|
|
575
636
|
|
|
@@ -594,35 +655,45 @@ const DataGrid = forwardRef(
|
|
|
594
655
|
|
|
595
656
|
return (
|
|
596
657
|
<div className="filterAction--alt">
|
|
658
|
+
{form.export && form.export.url && (
|
|
659
|
+
<button className="btn" onClick={exportTrigger}>
|
|
660
|
+
Export
|
|
661
|
+
</button>
|
|
662
|
+
)}
|
|
597
663
|
{form.sort && form.sort.title && (
|
|
598
664
|
<button className="btn" onClick={sortTrigger}>
|
|
599
665
|
<div className="icon-plus"></div> Sort Order
|
|
600
666
|
</button>
|
|
601
667
|
)}
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
668
|
+
|
|
669
|
+
{form.create &&
|
|
670
|
+
form.create.title &&
|
|
671
|
+
form.create.title !== '' && (
|
|
672
|
+
<button
|
|
673
|
+
className="btn"
|
|
674
|
+
onClick={(e) => {
|
|
675
|
+
e.preventDefault();
|
|
676
|
+
|
|
677
|
+
if (form.create) {
|
|
678
|
+
if (form.create.url) {
|
|
679
|
+
navigate(form.create.url);
|
|
680
|
+
} else {
|
|
681
|
+
modalOpen('create', 0);
|
|
682
|
+
}
|
|
683
|
+
} else {
|
|
684
|
+
if (form.url) {
|
|
685
|
+
window.open(
|
|
686
|
+
form.url,
|
|
687
|
+
'',
|
|
688
|
+
'width=1440,height=1024,menubar=1,resizable=1,status=1,titlebar=1,toolbar=1'
|
|
689
|
+
);
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
}}
|
|
693
|
+
>
|
|
694
|
+
<div className="icon-plus"></div> Create
|
|
695
|
+
</button>
|
|
696
|
+
)}
|
|
626
697
|
</div>
|
|
627
698
|
);
|
|
628
699
|
};
|
|
@@ -649,7 +720,7 @@ const DataGrid = forwardRef(
|
|
|
649
720
|
return (
|
|
650
721
|
<div
|
|
651
722
|
className="filterInput--alt"
|
|
652
|
-
style={{ height: '
|
|
723
|
+
style={{ height: '58px' }}
|
|
653
724
|
></div>
|
|
654
725
|
);
|
|
655
726
|
}
|
|
@@ -838,6 +909,8 @@ const DataGrid = forwardRef(
|
|
|
838
909
|
return getIconComponent(Copy);
|
|
839
910
|
case 'delete':
|
|
840
911
|
return getIconComponent(Backspace);
|
|
912
|
+
case 'envelope':
|
|
913
|
+
return getIconComponent(Envelope);
|
|
841
914
|
case 'family':
|
|
842
915
|
return getIconComponent(Network);
|
|
843
916
|
case 'primary':
|
|
@@ -909,6 +982,7 @@ const DataGrid = forwardRef(
|
|
|
909
982
|
link: column.link ?? {},
|
|
910
983
|
minWidth: column.minWidth ?? undefined,
|
|
911
984
|
maxWidth: column.maxWidth ?? undefined,
|
|
985
|
+
textAlign: column.textAlign ?? undefined,
|
|
912
986
|
textVerticalAlign:
|
|
913
987
|
style && style.text_vertical_align
|
|
914
988
|
? style.text_vertical_align
|
|
@@ -1295,7 +1369,14 @@ const DataGrid = forwardRef(
|
|
|
1295
1369
|
render: ({ data }) => {
|
|
1296
1370
|
if (data && data[column.id]) {
|
|
1297
1371
|
return (
|
|
1298
|
-
<span
|
|
1372
|
+
<span
|
|
1373
|
+
onClick={(e) => {
|
|
1374
|
+
e.stopPropagation();
|
|
1375
|
+
e.preventDefault();
|
|
1376
|
+
|
|
1377
|
+
handleDownload(data[column.id]);
|
|
1378
|
+
}}
|
|
1379
|
+
>
|
|
1299
1380
|
<CloudDownload
|
|
1300
1381
|
data-tooltip-id="system-tooltip"
|
|
1301
1382
|
data-tooltip-content="Download File"
|
package/components/crm/Field.jsx
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React, { useEffect, useRef, useState } from 'react';
|
|
2
2
|
import DatePicker from 'react-datepicker';
|
|
3
3
|
import _ from 'lodash';
|
|
4
|
-
import ReactQuill from 'react-quill';
|
|
5
4
|
import Toggle from 'react-toggle';
|
|
6
5
|
import moment from 'moment';
|
|
7
6
|
import { BlockPicker } from 'react-color';
|
package/package.json
CHANGED
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
"moment": "^2.30.1",
|
|
15
15
|
"motion": "^10.17.0",
|
|
16
16
|
"numeral": "^2.0.6",
|
|
17
|
+
"pluralize": "^8.0.0",
|
|
17
18
|
"quill-image-uploader": "^1.3.0",
|
|
18
19
|
"react-color": "^2.19.3",
|
|
19
20
|
"react-confirm-alert": "^3.0.6",
|
|
@@ -29,9 +30,9 @@
|
|
|
29
30
|
"react-slugify": "^3.0.3",
|
|
30
31
|
"react-sortable-hoc": "^2.0.0",
|
|
31
32
|
"react-to-print": "^2.14.15",
|
|
32
|
-
"react-toastify": "^10.0.
|
|
33
|
+
"react-toastify": "^10.0.4",
|
|
33
34
|
"react-toggle": "^4.1.3",
|
|
34
|
-
"react-tooltip": "^5.
|
|
35
|
+
"react-tooltip": "^5.26.0",
|
|
35
36
|
"react-window": "^1.8.10",
|
|
36
37
|
"reactjs-popup": "^2.0.6",
|
|
37
38
|
"truncate": "^3.0.0",
|
|
@@ -47,7 +48,7 @@
|
|
|
47
48
|
"react-dom": "^17.0.1"
|
|
48
49
|
},
|
|
49
50
|
"name": "@visns-studio/visns-components",
|
|
50
|
-
"version": "3.1.
|
|
51
|
+
"version": "3.1.9",
|
|
51
52
|
"description": "Various packages to assist in the development of our Custom Applications.",
|
|
52
53
|
"main": "index.js",
|
|
53
54
|
"scripts": {
|