Skip to content

Commit 27b68d5

Browse files
committed
add deselect-row event
1 parent 18b9010 commit 27b68d5

File tree

5 files changed

+10
-2
lines changed

5 files changed

+10
-2
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"author": "HC200ok",
44
"description": "A customizable and easy-to-use data table component made with Vue.js 3.x.",
55
"private": false,
6-
"version": "1.5.18",
6+
"version": "1.5.20",
77
"types": "./types/main.d.ts",
88
"license": "MIT",
99
"files": [

src/components/DataTable.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,7 @@ onMounted(() => {
382382
const emits = defineEmits([
383383
'clickRow',
384384
'selectRow',
385+
'deselectRow',
385386
'expandRow',
386387
'updateSort',
387388
'updateFilter',

src/hooks/useTotalItems.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ export default function useTotalItems(
151151
} else {
152152
selectItemsComputed.value = selectItemsComputed.value.filter((selectedItem) => JSON.stringify(selectedItem)
153153
!== JSON.stringify(item));
154+
emits('deselectRow', item);
154155
}
155156
};
156157

src/modes/Client.vue

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
:filter-options="filterOptions"
4242
click-event-type="double"
4343
@select-row="showItem"
44+
@deselect-row="deselectRow"
4445
>
4546
<template #expand="item">
4647
<div style="padding: 15px">
@@ -210,6 +211,11 @@ const showItem = (item: ClickRowArgument) => {
210211
console.log(JSON.stringify(item));
211212
};
212213
214+
const deselectRow = (item: ClickRowArgument) => {
215+
console.log('deselectRow');
216+
console.log(JSON.stringify(item));
217+
};
218+
213219
const updateSort = (sortOption: UpdateSortArgument) => {
214220
console.log(sortOption);
215221
};

src/types/internal.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@ export type ClickEventType = 'single' | 'double'
2626
export type MultipleSelectStatus = 'allSelected' | 'noneSelected' | 'partSelected'
2727

2828
// eslint-disable-next-line max-len
29-
export type EmitsEventName = 'clickRow' | 'selectRow' | 'expandRow' | 'updateSort' | 'update:itemsSelected' | 'update:serverOptions' | 'updateFilter'
29+
export type EmitsEventName = 'clickRow' | 'selectRow' | 'deselectRow' | 'expandRow' | 'updateSort' | 'update:itemsSelected' | 'update:serverOptions' | 'updateFilter'

0 commit comments

Comments
 (0)