@visns-studio/visns-components 5.1.3 → 5.1.5

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.3",
80
+ "version": "5.1.5",
81
81
  "description": "Various packages to assist in the development of our Custom Applications.",
82
82
  "main": "src/index.js",
83
83
  "files": [
@@ -150,6 +150,16 @@ function GenericDetail({
150
150
  }));
151
151
  };
152
152
 
153
+ const handleSelectedHeadingKey = (value, action, id) => {
154
+ setData((prevState) => ({
155
+ ...prevState,
156
+ [id]: {
157
+ ...prevState[id],
158
+ headingKey: value,
159
+ },
160
+ }));
161
+ };
162
+
153
163
  const handleSelectedOcrKey = (value, action, id) => {
154
164
  setOcrRowsSelected(value.value);
155
165
 
@@ -184,8 +194,10 @@ function GenericDetail({
184
194
  }
185
195
  };
186
196
 
187
- const handleOcrTemplateSave = async (id) => {
197
+ const handleOcrTemplateSave = async () => {
188
198
  try {
199
+ console.info(data);
200
+
189
201
  const res = await CustomFetch(
190
202
  `${activeTabConfig.form.url}/${data.id}`,
191
203
  'PUT',
@@ -520,7 +532,10 @@ function GenericDetail({
520
532
  }
521
533
 
522
534
  // Split the string on both '\n' and '<br>' using a regular expression.
523
- const lines = truncatedValue.split(/<br>|\\n/);
535
+ // Also handles any additional whitespace around the line breaks.
536
+ const lines = truncatedValue
537
+ .split(/<br\s*\/?>|\n/)
538
+ .map((line) => line.trim());
524
539
 
525
540
  if (lines.length === 0) {
526
541
  return null;
@@ -529,7 +544,11 @@ function GenericDetail({
529
544
  return (
530
545
  <>
531
546
  {lines.map((line, index) => (
532
- <p key={index}>{line}</p>
547
+ <React.Fragment key={index}>
548
+ {line}
549
+ {index < lines.length - 1 && <br />}{' '}
550
+ {/* Add <br /> between lines */}
551
+ </React.Fragment>
533
552
  ))}
534
553
  </>
535
554
  );
@@ -630,6 +649,13 @@ function GenericDetail({
630
649
  ocrTemplateBuilder.selectedKey &&
631
650
  ocrTemplateBuilder.selectedKey.length > 0 && (
632
651
  <>
652
+ <h2
653
+ style={{
654
+ borderBottom: '1px solid grey',
655
+ }}
656
+ >
657
+ File Name Template
658
+ </h2>
633
659
  <strong>Selected Keys</strong>
634
660
  <MultiSelect
635
661
  className=""
@@ -657,6 +683,53 @@ function GenericDetail({
657
683
  onChange={handleOcrInputChange}
658
684
  name="dynamicFilename"
659
685
  />
686
+ <h2
687
+ style={{
688
+ paddingTop: '20px',
689
+ borderBottom: '1px solid grey',
690
+ }}
691
+ >
692
+ Folder Setting
693
+ </h2>
694
+ <strong>Watch Folder</strong>
695
+ <input
696
+ type="text"
697
+ name="watchFolder"
698
+ value={data?.content?.watchFolder || ''}
699
+ onChange={(e) => {
700
+ const { name, value } = e.target;
701
+
702
+ setData((prevState) => ({
703
+ ...prevState,
704
+ content: {
705
+ ...prevState.content,
706
+ [name]: value,
707
+ },
708
+ }));
709
+ }}
710
+ />
711
+
712
+ <br />
713
+ <br />
714
+ <strong>Destination Folder</strong>
715
+ <input
716
+ type="text"
717
+ name="destinationFolder"
718
+ value={
719
+ data?.content?.destinationFolder || ''
720
+ }
721
+ onChange={(e) => {
722
+ const { name, value } = e.target;
723
+
724
+ setData((prevState) => ({
725
+ ...prevState,
726
+ content: {
727
+ ...prevState.content,
728
+ [name]: value,
729
+ },
730
+ }));
731
+ }}
732
+ />
660
733
  </>
661
734
  )}
662
735
  </>