@visns-studio/visns-components 5.1.9 → 5.1.11
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/package.json
CHANGED
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
"react-dom": "^17.0.0 || ^18.0.0"
|
|
78
78
|
},
|
|
79
79
|
"name": "@visns-studio/visns-components",
|
|
80
|
-
"version": "5.1.
|
|
80
|
+
"version": "5.1.11",
|
|
81
81
|
"description": "Various packages to assist in the development of our Custom Applications.",
|
|
82
82
|
"main": "src/index.js",
|
|
83
83
|
"files": [
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Link } from 'react-router-dom';
|
|
3
|
+
import dayjs from 'dayjs';
|
|
3
4
|
import { CircleChevronRight } from 'akar-icons';
|
|
4
5
|
|
|
5
6
|
function Breadcrumb({ data, page }) {
|
|
@@ -71,9 +72,15 @@ function Breadcrumb({ data, page }) {
|
|
|
71
72
|
))}
|
|
72
73
|
</>
|
|
73
74
|
) : (
|
|
75
|
+
// If titleKey is a single string, display the corresponding data
|
|
74
76
|
<>
|
|
75
|
-
{page
|
|
76
|
-
|
|
77
|
+
{page?.titleType && page.titleType === 'date'
|
|
78
|
+
? dayjs(data[page.titleKey]).format(
|
|
79
|
+
page.titleFormat
|
|
80
|
+
? page.titleFormat
|
|
81
|
+
: 'DD/MM/YYYY'
|
|
82
|
+
)
|
|
83
|
+
: getTitleData(data, page.titleKey)}
|
|
77
84
|
</>
|
|
78
85
|
)}
|
|
79
86
|
</>
|
|
@@ -25,8 +25,6 @@ import VisnsDropZone from '../cms/DropZone';
|
|
|
25
25
|
|
|
26
26
|
import 'react-toggle/style.css';
|
|
27
27
|
import 'react-datepicker/dist/react-datepicker.css';
|
|
28
|
-
import Item from '../cms/sorting/Item';
|
|
29
|
-
|
|
30
28
|
function Field({
|
|
31
29
|
api,
|
|
32
30
|
autocompleteCallback,
|
|
@@ -102,6 +100,13 @@ function Field({
|
|
|
102
100
|
filter.sort = settings.order.sort;
|
|
103
101
|
}
|
|
104
102
|
|
|
103
|
+
if (settings?.customParams) {
|
|
104
|
+
filter = {
|
|
105
|
+
...filter,
|
|
106
|
+
...settings.customParams,
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
|
|
105
110
|
CustomFetch(settings.url, 'POST', filter, function (result) {
|
|
106
111
|
setOptions(result.data);
|
|
107
112
|
|
|
@@ -144,8 +149,6 @@ function Field({
|
|
|
144
149
|
break;
|
|
145
150
|
}
|
|
146
151
|
|
|
147
|
-
console.info(settings);
|
|
148
|
-
|
|
149
152
|
switch (settings.size) {
|
|
150
153
|
case 'full':
|
|
151
154
|
setFormItemClass(`${styles.formItem} ${styles.fwItem}`);
|
|
@@ -159,10 +162,6 @@ function Field({
|
|
|
159
162
|
}
|
|
160
163
|
}, [settings, counter]);
|
|
161
164
|
|
|
162
|
-
useEffect(() => {
|
|
163
|
-
console.info(formItemClass);
|
|
164
|
-
}, [formItemClass]);
|
|
165
|
-
|
|
166
165
|
const fetchChildDropdownData = (s, v) => {
|
|
167
166
|
let filter = {};
|
|
168
167
|
|
|
@@ -196,8 +196,6 @@ function GenericDetail({
|
|
|
196
196
|
|
|
197
197
|
const handleOcrTemplateSave = async () => {
|
|
198
198
|
try {
|
|
199
|
-
console.info(data);
|
|
200
|
-
|
|
201
199
|
const res = await CustomFetch(
|
|
202
200
|
`${activeTabConfig.form.url}/${data.id}`,
|
|
203
201
|
'PUT',
|
|
@@ -504,12 +502,37 @@ function GenericDetail({
|
|
|
504
502
|
|
|
505
503
|
const renderDateTime = () => formatDateTimeValue(value);
|
|
506
504
|
|
|
507
|
-
const renderFile = () =>
|
|
508
|
-
value
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
505
|
+
const renderFile = () => {
|
|
506
|
+
if (value) {
|
|
507
|
+
return (
|
|
508
|
+
<a href={value} target="_blank">
|
|
509
|
+
Download
|
|
510
|
+
</a>
|
|
511
|
+
);
|
|
512
|
+
} else {
|
|
513
|
+
let fileData = null;
|
|
514
|
+
|
|
515
|
+
if (item.relation?.length > 0) {
|
|
516
|
+
item.relation.forEach((r, rKey) => {
|
|
517
|
+
if (rKey === 0) {
|
|
518
|
+
fileData = data[r];
|
|
519
|
+
} else {
|
|
520
|
+
fileData = fileData[r];
|
|
521
|
+
}
|
|
522
|
+
});
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
if (fileData && fileData.temporary_url) {
|
|
526
|
+
return (
|
|
527
|
+
<a href={fileData.temporary_url} target="_blank">
|
|
528
|
+
Download
|
|
529
|
+
</a>
|
|
530
|
+
);
|
|
531
|
+
} else {
|
|
532
|
+
return null;
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
};
|
|
513
536
|
|
|
514
537
|
const renderExist = () => (truncatedValue ? 'Yes' : 'No');
|
|
515
538
|
|