reset fields id on collection duplicate

This commit is contained in:
Gani Georgiev
2023-01-26 12:12:14 +02:00
parent 536707bfe7
commit a27298d1ef
31 changed files with 71 additions and 62 deletions
@@ -53,6 +53,8 @@
name: getUniqueFieldName(),
});
field.onMountExpand = true;
collection.schema.push(field);
collection.schema = collection.schema;
}
@@ -209,6 +209,13 @@
clone.created = "";
clone.updated = "";
clone.name += "_duplicate";
// reset the schema
if (!CommonHelper.isEmpty(clone.schema)) {
for (const field of clone.schema) {
field.id = "";
}
}
}
show(clone);
@@ -120,8 +120,8 @@
}
onMount(() => {
// auto expand new fields
if (!field.id) {
if (field?.onMountExpand) {
field.onMountExpand = false; // auto expand only the first time
expand();
}
});