125125</template >
126126
127127<script setup>
128- import {computed , defineComponent , ref , useAttrs , useSlots , watch } from ' vue' ;
128+ import {computed , defineComponent , ref , useSlots , watch } from ' vue' ;
129129import TVPagination from ' ./TVPagination.vue' ;
130130
131131defineComponent ({
@@ -134,7 +134,6 @@ defineComponent({
134134})
135135
136136const slots = useSlots ();
137- const attrs = useAttrs ();
138137
139138const props = defineProps ({
140139 items: {
@@ -167,6 +166,7 @@ const props = defineProps({
167166 },
168167 hidePagination: Boolean ,
169168 multipleSortable: Boolean ,
169+ multipleSelection: Boolean ,
170170 enableCheck: Boolean ,
171171 busy: Boolean ,
172172})
@@ -200,12 +200,19 @@ const sortable = ref({})
200200const selectedRows = ref ([])
201201
202202const rowClicked = (item ) => {
203- if (selectedRows .value .includes (item)) {
204- let index = selectedRows .value .indexOf (item)
205- selectedRows .value .splice (index, 1 )
203+ if (props .multipleSelection ) {
204+
205+ if (selectedRows .value .includes (item)) {
206+ let index = selectedRows .value .indexOf (item)
207+ selectedRows .value .splice (index, 1 )
208+ } else {
209+ selectedRows .value .push (item)
210+ }
211+
206212 } else {
207- selectedRows .value . push (item)
213+ selectedRows .value = selectedRows . value . includes (item) ? [] : [item]
208214 }
215+
209216 emit (' rowClicked' , item)
210217}
211218
@@ -231,7 +238,7 @@ const refreshCounter = () => {
231238}
232239
233240const checkSelectedForRow = (item ) => {
234- return selectedRows .value .includes (item)
241+ return props . multipleSelection ? selectedRows .value .includes (item) : selectedRows . value === item
235242}
236243
237244watch (() => localCurrentPage .value , (value ) => {
0 commit comments