@juv/codego-react-ui 3.4.4 → 3.4.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/dist/index.cjs CHANGED
@@ -6648,7 +6648,9 @@ function FieldRenderer({ field, value, onChange }) {
6648
6648
  case "rich-text":
6649
6649
  return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(RichTextEditor, { value: value ?? "", onChange: (v) => onChange(v) });
6650
6650
  case "file-upload":
6651
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(FileUpload, { onFilesChange: (files) => onChange(files), multiple: true });
6651
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(FileUpload, { onFileSelect: (file) => onChange(file), onFilesChange: (files) => {
6652
+ if (files.length > 1) onChange(files);
6653
+ } });
6652
6654
  case "repeater": {
6653
6655
  const items = Array.isArray(value) ? value : [];
6654
6656
  return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
@@ -6747,19 +6749,19 @@ function EditModal({
6747
6749
  try {
6748
6750
  const csrfToken = document.querySelector('meta[name="csrf-token"]')?.getAttribute("content");
6749
6751
  if (!csrfToken) throw new Error("[Table] CSRF token not found.");
6750
- const hasFiles = Object.values(form).some(
6751
- (v) => Array.isArray(v) && v.length > 0 && v[0] instanceof File || v instanceof File
6752
- );
6752
+ const isFile = (v) => v instanceof File;
6753
+ const isFileArray = (v) => Array.isArray(v) && v.length > 0 && v[0] instanceof File;
6754
+ const hasFiles = Object.values(form).some((v) => isFile(v) || isFileArray(v));
6753
6755
  let body;
6754
6756
  if (hasFiles) {
6755
6757
  const fd = new FormData();
6756
6758
  fd.append("_method", "PUT");
6757
6759
  Object.entries(form).forEach(([k, v]) => {
6758
- if (Array.isArray(v) && v[0] instanceof File) {
6760
+ if (isFileArray(v)) {
6759
6761
  v.forEach((f) => fd.append(k, f));
6760
- } else if (v instanceof File) {
6762
+ } else if (isFile(v)) {
6761
6763
  fd.append(k, v);
6762
- } else if (v !== null && v !== void 0) {
6764
+ } else if (v !== null && v !== void 0 && !Array.isArray(v)) {
6763
6765
  fd.append(k, String(v));
6764
6766
  }
6765
6767
  });
@@ -12868,6 +12870,12 @@ var axiosInstance = import_axios5.default.create({
12868
12870
  Accept: "application/json"
12869
12871
  }
12870
12872
  });
12873
+ axiosInstance.interceptors.request.use((config) => {
12874
+ if (config.data instanceof FormData) {
12875
+ delete config.headers["Content-Type"];
12876
+ }
12877
+ return config;
12878
+ });
12871
12879
 
12872
12880
  // src/lib/codego/request.ts
12873
12881
  var request = async (config) => {
@@ -69794,7 +69794,9 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
69794
69794
  case "rich-text":
69795
69795
  return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(RichTextEditor, { value: value ?? "", onChange: (v) => onChange(v) });
69796
69796
  case "file-upload":
69797
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(FileUpload, { onFilesChange: (files) => onChange(files), multiple: true });
69797
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(FileUpload, { onFileSelect: (file) => onChange(file), onFilesChange: (files) => {
69798
+ if (files.length > 1) onChange(files);
69799
+ } });
69798
69800
  case "repeater": {
69799
69801
  const items = Array.isArray(value) ? value : [];
69800
69802
  return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
@@ -69893,19 +69895,19 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
69893
69895
  try {
69894
69896
  const csrfToken = document.querySelector('meta[name="csrf-token"]')?.getAttribute("content");
69895
69897
  if (!csrfToken) throw new Error("[Table] CSRF token not found.");
69896
- const hasFiles = Object.values(form).some(
69897
- (v) => Array.isArray(v) && v.length > 0 && v[0] instanceof File || v instanceof File
69898
- );
69898
+ const isFile2 = (v) => v instanceof File;
69899
+ const isFileArray = (v) => Array.isArray(v) && v.length > 0 && v[0] instanceof File;
69900
+ const hasFiles = Object.values(form).some((v) => isFile2(v) || isFileArray(v));
69899
69901
  let body;
69900
69902
  if (hasFiles) {
69901
69903
  const fd = new FormData();
69902
69904
  fd.append("_method", "PUT");
69903
69905
  Object.entries(form).forEach(([k, v]) => {
69904
- if (Array.isArray(v) && v[0] instanceof File) {
69906
+ if (isFileArray(v)) {
69905
69907
  v.forEach((f) => fd.append(k, f));
69906
- } else if (v instanceof File) {
69908
+ } else if (isFile2(v)) {
69907
69909
  fd.append(k, v);
69908
- } else if (v !== null && v !== void 0) {
69910
+ } else if (v !== null && v !== void 0 && !Array.isArray(v)) {
69909
69911
  fd.append(k, String(v));
69910
69912
  }
69911
69913
  });
@@ -76424,6 +76426,12 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
76424
76426
  Accept: "application/json"
76425
76427
  }
76426
76428
  });
76429
+ axiosInstance.interceptors.request.use((config) => {
76430
+ if (config.data instanceof FormData) {
76431
+ delete config.headers["Content-Type"];
76432
+ }
76433
+ return config;
76434
+ });
76427
76435
 
76428
76436
  // src/lib/codego/request.ts
76429
76437
  var request = async (config) => {
package/dist/index.js CHANGED
@@ -6527,7 +6527,9 @@ function FieldRenderer({ field, value, onChange }) {
6527
6527
  case "rich-text":
6528
6528
  return /* @__PURE__ */ jsx32(RichTextEditor, { value: value ?? "", onChange: (v) => onChange(v) });
6529
6529
  case "file-upload":
6530
- return /* @__PURE__ */ jsx32(FileUpload, { onFilesChange: (files) => onChange(files), multiple: true });
6530
+ return /* @__PURE__ */ jsx32(FileUpload, { onFileSelect: (file) => onChange(file), onFilesChange: (files) => {
6531
+ if (files.length > 1) onChange(files);
6532
+ } });
6531
6533
  case "repeater": {
6532
6534
  const items = Array.isArray(value) ? value : [];
6533
6535
  return /* @__PURE__ */ jsx32(
@@ -6626,19 +6628,19 @@ function EditModal({
6626
6628
  try {
6627
6629
  const csrfToken = document.querySelector('meta[name="csrf-token"]')?.getAttribute("content");
6628
6630
  if (!csrfToken) throw new Error("[Table] CSRF token not found.");
6629
- const hasFiles = Object.values(form).some(
6630
- (v) => Array.isArray(v) && v.length > 0 && v[0] instanceof File || v instanceof File
6631
- );
6631
+ const isFile = (v) => v instanceof File;
6632
+ const isFileArray = (v) => Array.isArray(v) && v.length > 0 && v[0] instanceof File;
6633
+ const hasFiles = Object.values(form).some((v) => isFile(v) || isFileArray(v));
6632
6634
  let body;
6633
6635
  if (hasFiles) {
6634
6636
  const fd = new FormData();
6635
6637
  fd.append("_method", "PUT");
6636
6638
  Object.entries(form).forEach(([k, v]) => {
6637
- if (Array.isArray(v) && v[0] instanceof File) {
6639
+ if (isFileArray(v)) {
6638
6640
  v.forEach((f) => fd.append(k, f));
6639
- } else if (v instanceof File) {
6641
+ } else if (isFile(v)) {
6640
6642
  fd.append(k, v);
6641
- } else if (v !== null && v !== void 0) {
6643
+ } else if (v !== null && v !== void 0 && !Array.isArray(v)) {
6642
6644
  fd.append(k, String(v));
6643
6645
  }
6644
6646
  });
@@ -12747,6 +12749,12 @@ var axiosInstance = axios5.create({
12747
12749
  Accept: "application/json"
12748
12750
  }
12749
12751
  });
12752
+ axiosInstance.interceptors.request.use((config) => {
12753
+ if (config.data instanceof FormData) {
12754
+ delete config.headers["Content-Type"];
12755
+ }
12756
+ return config;
12757
+ });
12750
12758
 
12751
12759
  // src/lib/codego/request.ts
12752
12760
  var request = async (config) => {
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "registry": "https://registry.npmjs.org/",
5
5
  "access": "public"
6
6
  },
7
- "version": "3.4.4",
7
+ "version": "3.4.5",
8
8
  "description": "Reusable React UI components",
9
9
  "license": "MIT",
10
10
  "main": "dist/index.js",