atom-nuxt 1.4.1 → 1.4.3

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/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@atomengine/atom-nuxt",
3
3
  "configKey": "atomNuxt",
4
- "version": "1.4.1",
4
+ "version": "1.4.3",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.1",
7
7
  "unbuild": "3.5.0"
@@ -4,7 +4,7 @@ import { useCrudConverters } from "../composables/useCrudConverters";
4
4
  import { usePreviousRoute } from "../composables/usePreviousRoute";
5
5
  import { useRoute, useRouter } from "#app";
6
6
  import CrudFilterList from "./CrudFilterList.vue";
7
- import { computed, ref, watch, onMounted, onBeforeUnmount } from "vue";
7
+ import { computed, ref, watch, onMounted, onBeforeUnmount, toRaw } from "vue";
8
8
  import { useDebounceFn } from "@vueuse/core";
9
9
  import { useListenerService } from "../composables/useListenerService";
10
10
  import CrudFormDialog from "./CrudFormDialog.vue";
@@ -336,9 +336,46 @@ const createForm = () => {
336
336
  }
337
337
  router.push(newQuery);
338
338
  };
339
+ function deepCloneWithFiles(obj, seen = /* @__PURE__ */ new WeakMap()) {
340
+ if (obj === null || typeof obj !== "object") {
341
+ return obj;
342
+ }
343
+ if (seen.has(obj)) {
344
+ return seen.get(obj);
345
+ }
346
+ if (obj instanceof File || obj instanceof Blob) {
347
+ return obj;
348
+ }
349
+ if (obj instanceof Date) {
350
+ return new Date(obj.getTime());
351
+ }
352
+ if (obj instanceof RegExp) {
353
+ return new RegExp(obj.source, obj.flags);
354
+ }
355
+ if (Array.isArray(obj)) {
356
+ const arrCopy = [];
357
+ seen.set(obj, arrCopy);
358
+ for (let i = 0; i < obj.length; i++) {
359
+ arrCopy[i] = deepCloneWithFiles(obj[i], seen);
360
+ }
361
+ return arrCopy;
362
+ }
363
+ const objCopy = {};
364
+ seen.set(obj, objCopy);
365
+ for (const key in obj) {
366
+ if (Object.prototype.hasOwnProperty.call(obj, key)) {
367
+ const value = obj[key];
368
+ if (typeof value === "function") {
369
+ continue;
370
+ }
371
+ objCopy[key] = deepCloneWithFiles(value, seen);
372
+ }
373
+ }
374
+ return objCopy;
375
+ }
339
376
  const saveAction = async () => {
340
377
  formPending.value = true;
341
- let itemToSave = structuredClone(item.value);
378
+ let itemToSave = deepCloneWithFiles(toRaw(item.value));
342
379
  if (props.beforeSave != null) {
343
380
  itemToSave = await props.beforeSave(itemToSave);
344
381
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "atom-nuxt",
3
- "version": "1.4.1",
3
+ "version": "1.4.3",
4
4
  "description": "My new Nuxt module",
5
5
  "repository": "atomengine/atom-nuxt",
6
6
  "license": "MIT",