@visns-studio/visns-components 4.9.0 → 4.9.2

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
@@ -75,7 +75,7 @@
75
75
  "react-dom": "^17.0.0 || ^18.0.0"
76
76
  },
77
77
  "name": "@visns-studio/visns-components",
78
- "version": "4.9.0",
78
+ "version": "4.9.2",
79
79
  "description": "Various packages to assist in the development of our Custom Applications.",
80
80
  "main": "src/index.js",
81
81
  "files": [
@@ -3,9 +3,17 @@ import { Link } from 'react-router-dom';
3
3
  import { CircleChevronRight } from 'akar-icons';
4
4
 
5
5
  function Breadcrumb({ data, page }) {
6
- const getNestedData = (data, keys) =>
7
- keys.reduce((acc, key) => (acc && acc[key] ? acc[key] : null), data);
6
+ // Function to get nested data, handling array of keys
7
+ const getNestedData = (data, keys) => {
8
+ return Array.isArray(keys)
9
+ ? keys.reduce(
10
+ (acc, key) => (acc && acc[key] ? acc[key] : null),
11
+ data
12
+ )
13
+ : data[keys];
14
+ };
8
15
 
16
+ // Get the nested data for parent title key if it exists
9
17
  const nestedData =
10
18
  data && page.parentTitleKey
11
19
  ? getNestedData(data, page.parentTitleKey)
@@ -42,8 +50,21 @@ function Breadcrumb({ data, page }) {
42
50
  )
43
51
  )}
44
52
 
45
- {page.titleKey && data && data[page.titleKey] && (
46
- <>{data[page.titleKey]}</>
53
+ {page.titleKey && data && (
54
+ <>
55
+ {Array.isArray(page.titleKey) ? (
56
+ // If titleKey is an array, iterate and display each nested value
57
+ page.titleKey.map((key, index) => (
58
+ <span key={index}>
59
+ {data[key]}
60
+ {index < page.titleKey.length - 1 && ' '}
61
+ </span>
62
+ ))
63
+ ) : (
64
+ // If titleKey is a single string, display the corresponding data
65
+ <>{data[page.titleKey]}</>
66
+ )}
67
+ </>
47
68
  )}
48
69
  </h1>
49
70
  );
@@ -673,13 +673,18 @@ function Field({
673
673
  className={inputClass[settings.id]}
674
674
  onChange={onChange}
675
675
  />
676
+ {console.info(inputValue)}
676
677
  {inputValue && inputValue.length > 0 && (
677
678
  <ul className="file-list">
678
679
  {inputValue.map((file, index) => (
679
680
  <li
680
681
  key={`file-${settings.id}-${index}`}
681
682
  >
682
- {file.name}
683
+ {file.name
684
+ ? file.name
685
+ : file.file_name
686
+ ? file.file_name
687
+ : ''}
683
688
  <button
684
689
  className="trash-button"
685
690
  onClick={(e) => {
@@ -432,10 +432,6 @@ function Form({
432
432
  const renderInputValue = (i, f) => {
433
433
  let value = '';
434
434
 
435
- if (i.id === 'event_detail.type_of_event') {
436
- console.info(i, f);
437
- }
438
-
439
435
  if (i.hasOwnProperty('parent') && i.parent) {
440
436
  if (f[i.parent]) {
441
437
  value = i.hasOwnProperty('key')