Add Selection Prop

This commit is contained in:
Samuel Lorch 2023-03-31 19:40:13 +02:00
parent a7446d9663
commit 234ad792d1

View file

@ -15,15 +15,18 @@ const props = defineModel<{
sortSelf?: boolean, sortSelf?: boolean,
sortBy?: string, sortBy?: string,
sortDesc?: boolean, sortDesc?: boolean,
selection?: number[],
}>(); }>();
let { columns, data, sort, sortSelf, sortBy, sortDesc } = $(props); let { columns, data, sort, sortSelf, sortBy, sortDesc, selection } = $(props);
const emit = defineEmits<{ const emit = defineEmits<{
(event: 'rowAction', index: number): void, (event: 'rowAction', index: number): void,
(event: 'selectionChanged'): void (event: 'selectionChanged'): void
}>(); }>();
let selection = $ref([] as number[]); if (selection == undefined) {
selection = [];
}
const displayData = $computed(() => (sortSelf && sortBy !== '') const displayData = $computed(() => (sortSelf && sortBy !== '')
? data?.sort((a, b) => { ? data?.sort((a, b) => {