@visns-studio/visns-components 5.2.1 → 5.2.3

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
@@ -78,7 +78,7 @@
78
78
  "react-dom": "^17.0.0 || ^18.0.0"
79
79
  },
80
80
  "name": "@visns-studio/visns-components",
81
- "version": "5.2.1",
81
+ "version": "5.2.3",
82
82
  "description": "Various packages to assist in the development of our Custom Applications.",
83
83
  "main": "src/index.js",
84
84
  "files": [
@@ -284,12 +284,11 @@ function GenericDetail({
284
284
  }
285
285
  };
286
286
 
287
- const handleExport = (config) => {
288
- if (config.url && config.key) {
289
- window.open(`${config.url}/${data[config.key]}`);
290
- } else {
291
- toast.error('Export URL not found');
292
- }
287
+ const handleExport = ({ url, key }) => {
288
+ if (!url) return toast.error('Export URL not found');
289
+
290
+ const exportUrl = key ? `${url}/${data[key]}` : url;
291
+ window.open(exportUrl);
293
292
  };
294
293
 
295
294
  const handleCheckboxUpdate = async () => {
@@ -623,6 +622,9 @@ function GenericDetail({
623
622
 
624
623
  const renderOcrTemplate = (id) => {
625
624
  const ocrTemplateBuilder = data[id];
625
+ const listOfKeys = data[id]?.DeducedData
626
+ ? Object.assign({}, ...data[id].DeducedData)
627
+ : {};
626
628
 
627
629
  return (
628
630
  <>
@@ -644,30 +646,30 @@ function GenericDetail({
644
646
  </tr>
645
647
  </thead>
646
648
  <tbody>
647
- {Object.entries(
648
- ocrTemplateBuilder.DeducedData[0]
649
- ).map(([key, value], index) => (
650
- <tr key={`ocr-keys-${index}`}>
651
- <td>
652
- <input
653
- type="checkbox"
654
- name={key}
655
- value={key}
656
- data-id={id}
657
- checked={
658
- ocrTemplateBuilder?.selectedKey?.includes(
659
- key
660
- ) || false
661
- }
662
- onChange={
663
- handleOcrKeyChange
664
- }
665
- />
666
- </td>
667
- <td>{key}</td>
668
- <td>{value}</td>
669
- </tr>
670
- ))}
649
+ {Object.entries(listOfKeys).map(
650
+ ([key, value], index) => (
651
+ <tr key={`ocr-keys-${index}`}>
652
+ <td>
653
+ <input
654
+ type="checkbox"
655
+ name={key}
656
+ value={key}
657
+ data-id={id}
658
+ checked={
659
+ ocrTemplateBuilder?.selectedKey?.includes(
660
+ key
661
+ ) || false
662
+ }
663
+ onChange={
664
+ handleOcrKeyChange
665
+ }
666
+ />
667
+ </td>
668
+ <td>{key}</td>
669
+ <td>{value}</td>
670
+ </tr>
671
+ )
672
+ )}
671
673
  </tbody>
672
674
  </table>
673
675
  )}