@visns-studio/visns-components 4.0.4 → 4.0.6
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.
|
@@ -34,16 +34,13 @@ const updateField = (fields, name, value) => {
|
|
|
34
34
|
const renderValue = (field, data) => {
|
|
35
35
|
switch (field.type) {
|
|
36
36
|
case 'datetime':
|
|
37
|
-
return field.value && moment(field.value).isValid()
|
|
38
|
-
? moment(field.value).toDate()
|
|
39
|
-
: '';
|
|
40
37
|
case 'date':
|
|
41
38
|
return field.value && moment(field.value).isValid()
|
|
42
39
|
? moment(field.value).toDate()
|
|
43
40
|
: '';
|
|
41
|
+
|
|
44
42
|
case 'dynamicdata':
|
|
45
43
|
if (field.dynamicfield && typeof field.dynamicfield === 'string') {
|
|
46
|
-
// Split the dynamicfield string into table and key parts using the "::" delimiter
|
|
47
44
|
const [table, key] = field.dynamicfield.split('::');
|
|
48
45
|
|
|
49
46
|
if (table && key) {
|
|
@@ -51,6 +48,9 @@ const renderValue = (field, data) => {
|
|
|
51
48
|
case 'opportunities':
|
|
52
49
|
return data[table][key];
|
|
53
50
|
default:
|
|
51
|
+
if (key === 'surname' && !data[key]) {
|
|
52
|
+
return data['lastname'] || '';
|
|
53
|
+
}
|
|
54
54
|
return data[key];
|
|
55
55
|
}
|
|
56
56
|
} else {
|
|
@@ -67,21 +67,12 @@ const renderValue = (field, data) => {
|
|
|
67
67
|
return field.value && moment(field.value).isValid()
|
|
68
68
|
? moment(field.value).toDate()
|
|
69
69
|
: '';
|
|
70
|
+
|
|
70
71
|
default:
|
|
71
72
|
return field.value || '';
|
|
72
73
|
}
|
|
73
74
|
};
|
|
74
75
|
|
|
75
|
-
const slugify = (text) => {
|
|
76
|
-
return text
|
|
77
|
-
.toString()
|
|
78
|
-
.toLowerCase()
|
|
79
|
-
.trim()
|
|
80
|
-
.replace(/\s+/g, '-') // Replace spaces with -
|
|
81
|
-
.replace(/[^\w\-]+/g, '') // Remove all non-word chars
|
|
82
|
-
.replace(/\-\-+/g, '-'); // Replace multiple - with single -
|
|
83
|
-
};
|
|
84
|
-
|
|
85
76
|
const GenericDynamic = ({
|
|
86
77
|
data,
|
|
87
78
|
fetchData,
|
package/package.json
CHANGED