reset fields id on collection duplicate
This commit is contained in:
@@ -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();
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user