@nkhang1902/strapi-plugin-export-import-clsx 1.3.5 → 1.3.7

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nkhang1902/strapi-plugin-export-import-clsx",
3
- "version": "1.3.5",
3
+ "version": "1.3.7",
4
4
  "description": "A powerful Strapi plugin for exporting and importing data with Excel support and advanced filtering",
5
5
  "main": "./strapi-server.js",
6
6
  "scripts": {
@@ -88,8 +88,9 @@ module.exports = ({ strapi }) => ({
88
88
  throw new Error(`Sheet name "${sheetName}" does not match the target content type "${targetContentType.split(".")[1]}"`);
89
89
  }
90
90
  const worksheet = workbook.Sheets[sheetName];
91
- const rows = XLSX.utils.sheet_to_json(worksheet);
92
- console.log(rows)
91
+ const rows = XLSX.utils.sheet_to_json(worksheet, {
92
+ defval: null
93
+ });
93
94
 
94
95
  if (!rows.length) return;
95
96
 
@@ -186,7 +187,7 @@ module.exports = ({ strapi }) => ({
186
187
  }
187
188
 
188
189
  // Excel explicitly empty → unlink
189
- if (value === "") {
190
+ if (value === "" || value === null) {
190
191
  if (relation === "manyToMany" || relation === "oneToMany") {
191
192
  updatedEntry[field] = [];
192
193
  } else {
@@ -301,6 +302,11 @@ module.exports = ({ strapi }) => ({
301
302
 
302
303
  if (value === undefined) continue;
303
304
 
305
+ if (value === null && attr.required) {
306
+ cleaned[key] = attr.default;
307
+ continue;
308
+ };
309
+
304
310
  if (attr.type === 'component') {
305
311
  if (!value) {
306
312
  cleaned[key] = attr.repeatable ? [] : null;
@@ -314,7 +320,7 @@ module.exports = ({ strapi }) => ({
314
320
  : this.sanitizeComponent(value, attr.component);
315
321
  continue;
316
322
  }
317
-
323
+
318
324
  cleaned[key] = this.sanitizePrimitive(value, attr);
319
325
  }
320
326