@visns-studio/visns-components 5.15.32 → 5.15.33

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
@@ -13,7 +13,7 @@
13
13
  "@nivo/line": "^0.87.0",
14
14
  "@nivo/pie": "^0.87.0",
15
15
  "@react-pdf/renderer": "^4.3.2",
16
- "@tanstack/react-query": "^5.91.2",
16
+ "@tanstack/react-query": "^5.95.2",
17
17
  "@tinymce/miniature": "^6.0.0",
18
18
  "@tinymce/tinymce-react": "^6.3.0",
19
19
  "@uiw/react-color": "^2.9.6",
@@ -46,7 +46,7 @@
46
46
  "react-datepicker": "^8.10.0",
47
47
  "react-dropzone": "^14.4.1",
48
48
  "react-grid-gallery": "^1.0.1",
49
- "react-number-format": "^5.4.4",
49
+ "react-number-format": "^5.4.5",
50
50
  "react-password-strength-bar": "^0.4.1",
51
51
  "react-promise-tracker": "^2.1.1",
52
52
  "react-quill": "^2.0.0",
@@ -64,7 +64,7 @@
64
64
  "reactjs-popup": "^2.0.6",
65
65
  "style-loader": "^4.0.0",
66
66
  "swapy": "^1.0.5",
67
- "sweetalert2": "^11.26.23",
67
+ "sweetalert2": "^11.26.24",
68
68
  "tesseract.js": "^6.0.1",
69
69
  "truncate": "^3.0.0",
70
70
  "uuid": "^11.1.0",
@@ -72,7 +72,7 @@
72
72
  "vite": "^6.4.1",
73
73
  "xlsx": "^0.18.5",
74
74
  "yarn": "^1.22.22",
75
- "yet-another-react-lightbox": "^3.29.1"
75
+ "yet-another-react-lightbox": "^3.29.2"
76
76
  },
77
77
  "devDependencies": {
78
78
  "@babel/core": "^7.29.0",
@@ -94,7 +94,7 @@
94
94
  "react-dom": "^17.0.0 || ^18.0.0"
95
95
  },
96
96
  "name": "@visns-studio/visns-components",
97
- "version": "5.15.32",
97
+ "version": "5.15.33",
98
98
  "description": "Various packages to assist in the development of our Custom Applications.",
99
99
  "main": "src/index.js",
100
100
  "files": [
@@ -1508,11 +1508,11 @@ function Form({
1508
1508
  Object.keys(formData).forEach((item) => {
1509
1509
  const value = formData[item];
1510
1510
 
1511
- // Check if it's a single File or an array of File objects
1511
+ // Check if it's a single File or an array containing File objects
1512
1512
  if (
1513
1513
  value instanceof File ||
1514
1514
  (Array.isArray(value) &&
1515
- value.every(
1515
+ value.some(
1516
1516
  (file) => file instanceof File
1517
1517
  ))
1518
1518
  ) {
@@ -1530,9 +1530,34 @@ function Form({
1530
1530
  });
1531
1531
  }
1532
1532
 
1533
+ // Separate existing file objects from new File instances for the file field
1534
+ // and pass existing files to the backend so it knows which to keep
1535
+ if (fileKey && Array.isArray(formData[fileKey])) {
1536
+ const existingFiles = formData[fileKey].filter(
1537
+ (file) => !(file instanceof File)
1538
+ );
1539
+ if (existingFiles.length > 0) {
1540
+ updatedFormData['existingFiles'] = existingFiles;
1541
+ }
1542
+ } else if (fileKey === null && formData) {
1543
+ // No new files, but check if there are existing file objects to preserve
1544
+ const fileFields = formSettings?.fields?.filter(f => f.type === 'file') || [];
1545
+ fileFields.forEach((field) => {
1546
+ const val = formData[field.id];
1547
+ if (Array.isArray(val) && val.length > 0 && val.every(f => !(f instanceof File))) {
1548
+ updatedFormData['existingFiles'] = val;
1549
+ }
1550
+ });
1551
+ }
1552
+
1533
1553
  if (fileUpload && formData[fileKey]) {
1534
1554
  if (Array.isArray(formData[fileKey])) {
1535
- const uploadPromises = formData[fileKey].map(
1555
+ // Filter to only upload new File instances
1556
+ const newFiles = formData[fileKey].filter(
1557
+ (file) => file instanceof File
1558
+ );
1559
+
1560
+ const uploadPromises = newFiles.map(
1536
1561
  async (file) => {
1537
1562
  // Optimize image if it's an image file
1538
1563
  const optimizedFile =