Skip to content

Commit c81ee7c

Browse files
feat: Add delete action to row
AI-assistant: Claude Code v2.1.101 (Claude Sonnet 4.6) Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
1 parent a9b323d commit c81ee7c

4 files changed

Lines changed: 18 additions & 1 deletion

File tree

src/modules/main/partials/TableView.vue

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
@create-row="createRow"
2626
@edit-row="editRow"
2727
@copy-row="copyRow"
28+
@delete-row="deleteRow"
2829
@delete-selected-rows="deleteSelectedRows">
2930
<template #actions>
3031
<slot name="actions" />
@@ -134,6 +135,9 @@ export default {
134135
copyRow(rowId) {
135136
emit('tables:row:copy', { row: this.rows.find(r => r.id === rowId), columns: this.columns, isView: this.isView, elementId: this.element.id })
136137
},
138+
deleteRow(rowId) {
139+
emit('tables:row:delete', { rows: [rowId], isView: this.isView, elementId: this.element.id })
140+
},
137141
deleteSelectedRows(rows) {
138142
emit('tables:row:delete', { rows, isView: this.isView, elementId: this.element.id })
139143
},

src/shared/components/ncTable/NcTable.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ deselect-all-rows -> unselect all rows, e.g. after deleting selected rows
5656
:config="config" @create-row="$emit('create-row')"
5757
@edit-row="rowId => $emit('edit-row', rowId)"
5858
@copy-row="rowId => $emit('copy-row', rowId)"
59+
@delete-row="rowId => $emit('delete-row', rowId)"
5960
@create-column="$emit('create-column')"
6061
@edit-column="col => $emit('edit-column', col)"
6162
@delete-column="col => $emit('delete-column', col)"

src/shared/components/ncTable/partials/TableRow.vue

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,15 @@
4444
</template>
4545
{{ t('tables', 'Copy row') }}
4646
</NcActionButton>
47+
<NcActionButton v-if="config.canDeleteRows"
48+
data-cy="deleteRowBtn"
49+
:close-after-click="true"
50+
@click="$emit('delete-row', row.id)">
51+
<template #icon>
52+
<TrashCanOutline :size="20" />
53+
</template>
54+
{{ t('tables', 'Delete row') }}
55+
</NcActionButton>
4756
</NcActions>
4857
</td>
4958
</tr>
@@ -53,6 +62,7 @@
5362
import { NcCheckboxRadioSwitch, NcActions, NcActionButton } from '@nextcloud/vue'
5463
import ContentCopy from 'vue-material-design-icons/ContentCopy.vue'
5564
import Pencil from 'vue-material-design-icons/PencilOutline.vue'
65+
import TrashCanOutline from 'vue-material-design-icons/TrashCanOutline.vue'
5666
import TableCellHtml from './TableCellHtml.vue'
5767
import TableCellProgress from './TableCellProgress.vue'
5868
import TableCellLink from './TableCellLink.vue'
@@ -85,6 +95,7 @@ export default {
8595
NcActionButton,
8696
ContentCopy,
8797
Pencil,
98+
TrashCanOutline,
8899
NcCheckboxRadioSwitch,
89100
TableCellDateTime,
90101
TableCellTextLine,

src/shared/components/ncTable/sections/CustomTable.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@
3939
:is-view="isView"
4040
@update-row-selection="updateRowSelection"
4141
@edit-row="rowId => $emit('edit-row', rowId)"
42-
@copy-row="rowId => $emit('copy-row', rowId)" />
42+
@copy-row="rowId => $emit('copy-row', rowId)"
43+
@delete-row="rowId => $emit('delete-row', rowId)" />
4344
</transition-group>
4445
</table>
4546
<div v-if="totalPages > 1" class="pagination-footer" :class="{'large-width': !appNavCollapsed || isMobile}">

0 commit comments

Comments
 (0)