From ba64bd62b4407c387bffd58d1718f22239d686b9 Mon Sep 17 00:00:00 2001 From: Lightling Date: Sun, 23 Mar 2025 23:21:49 -0400 Subject: [PATCH] add clone button --- src/views/Editor/DataEditor.vue | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/views/Editor/DataEditor.vue b/src/views/Editor/DataEditor.vue index 8b79a67..1900f6c 100644 --- a/src/views/Editor/DataEditor.vue +++ b/src/views/Editor/DataEditor.vue @@ -101,6 +101,11 @@ const onEditRow = (event: Event, slotProps: EditingRow) => { editingRowData.value = slotProps } +const onCloneRow = (event: Event, slotProps: EditingRow) => { + event.preventDefault() + onAddRow(undefined, slotProps.data) +} + const onRemoveImage = (event: Event, slotProps: EditingRow) => { event.preventDefault() const row = { ...model.value[slotProps.index] } as any @@ -285,7 +290,7 @@ DataTable.data-editor( Column( rowEditor header='Actions' - style='width:10%;min-width:8rem;' + style='width:10%;min-width:14rem;' bodyStyle='text-align:center;' ) template( @@ -299,6 +304,14 @@ DataTable.data-editor( variant='text' @click='slotProps.editorInitCallback' ) + Button.edit( + icon='pi pi-clone' + aria-label='Row Clone' + rounded + severity='secondary' + variant='text' + @click='(e) => onCloneRow(e, slotProps)' + ) Button.edit( icon='pi pi-pen-to-square' aria-label='Row Edit Details'