@visns-studio/visns-components 5.0.16 → 5.0.18

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": "5.0.16",
78
+ "version": "5.0.18",
79
79
  "description": "Various packages to assist in the development of our Custom Applications.",
80
80
  "main": "src/index.js",
81
81
  "files": [
@@ -871,7 +871,9 @@ function Form({
871
871
  _formData[id] =
872
872
  newValue instanceof Date
873
873
  ? newValue
874
- : moment(newValue).toDate();
874
+ : newValue !== undefined
875
+ ? moment(newValue).toDate()
876
+ : '';
875
877
  } else {
876
878
  _formData[id] = newValue;
877
879
  }
@@ -1,11 +1,12 @@
1
1
  import { useEffect, useRef, useState } from 'react';
2
- import ReactToPrint from 'react-to-print';
2
+ import { useReactToPrint } from 'react-to-print';
3
3
 
4
4
  import CustomFetch from './Fetch';
5
5
  import styles from './styles/QrCode.module.scss';
6
6
 
7
7
  const QrCode = ({ config, dataId }) => {
8
- const printComponentRef = useRef();
8
+ const contentRef = useRef(null);
9
+ const reactToPrintFn = useReactToPrint({ contentRef });
9
10
  const [qrCodeData, setQrCodeData] = useState({
10
11
  logo: '',
11
12
  qrCode: '',
@@ -26,9 +27,13 @@ const QrCode = ({ config, dataId }) => {
26
27
  fetchQrCode(config);
27
28
  }, []);
28
29
 
30
+ useEffect(() => {
31
+ console.info(qrCodeData);
32
+ }, [qrCodeData]);
33
+
29
34
  return (
30
35
  <>
31
- <div className={styles.gridtxt} ref={printComponentRef}>
36
+ <div className={styles.gridtxt} ref={contentRef}>
32
37
  {qrCodeData.logo && qrCodeData.logo !== '' && (
33
38
  <ul className={styles.customer__overview}>
34
39
  <li
@@ -52,7 +57,7 @@ const QrCode = ({ config, dataId }) => {
52
57
  textAlign: 'center',
53
58
  }}
54
59
  >
55
- {qrCodeData.title}
60
+ {qrCodeData.title || ''}
56
61
  </li>
57
62
  </ul>
58
63
  <ul className={styles.customer__overview}>
@@ -71,10 +76,9 @@ const QrCode = ({ config, dataId }) => {
71
76
  </ul>
72
77
  </div>
73
78
  <div className={styles.polActions}>
74
- <ReactToPrint
75
- trigger={() => <button className="btn">Print</button>}
76
- content={() => printComponentRef.current}
77
- />
79
+ <button className={styles.btn} onClick={() => reactToPrintFn()}>
80
+ Print
81
+ </button>
78
82
  </div>
79
83
  </>
80
84
  );