@visns-studio/visns-components 5.1.10 → 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.10",
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.titleText && <span>{page.titleText} </span>}
76
- <span>{data[page.titleKey]}</span>
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
  </>
@@ -502,12 +502,37 @@ function GenericDetail({
502
502
 
503
503
  const renderDateTime = () => formatDateTimeValue(value);
504
504
 
505
- const renderFile = () =>
506
- value ? (
507
- <a href={value} target="_blank">
508
- Download
509
- </a>
510
- ) : null;
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
+ };
511
536
 
512
537
  const renderExist = () => (truncatedValue ? 'Yes' : 'No');
513
538