6
6
:sort-by =" 'similarity'"
7
7
:sort-desc =" true"
8
8
:items-per-page =" 15"
9
- :search =" search "
9
+ :search =" searchValue "
10
10
:footer-props =" footerProps"
11
11
:hide-default-footer =" props.pairs.length <= props.itemsPerPage"
12
12
@click:row =" rowClicked"
20
20
<script lang="ts" setup>
21
21
import { shallowRef , onMounted } from " vue" ;
22
22
import { useRouter , useRoute } from " @/composables" ;
23
+ import { useVModel } from " @vueuse/core" ;
23
24
import { Pair } from " @/api/models" ;
24
25
import { DataTableHeader } from " vuetify" ;
25
26
import SimilarityDisplay from " @/components/pair/SimilarityDisplay.vue" ;
26
27
27
28
interface Props {
28
29
pairs: Pair [];
29
- itemsPerPage: number ;
30
+ itemsPerPage? : number ;
31
+ search? : string ;
30
32
}
31
33
32
34
const props = withDefaults (defineProps <Props >(), {
33
35
itemsPerPage: 15 ,
34
36
});
37
+ const emit = defineEmits ([" update:search" ]);
35
38
const router = useRouter ();
36
39
const route = useRoute ();
40
+ const searchValue = useVModel (props , " search" , emit );
37
41
38
42
// Table headers
39
43
const headers: DataTableHeader [] = [
@@ -51,17 +55,14 @@ const footerProps = {
51
55
showFirstLastPage: true ,
52
56
};
53
57
54
- // Search value.
55
- const search = shallowRef (" " );
56
-
57
58
// Items in the format for the the data-table.
58
59
const items = shallowRef <any []>([]);
59
60
60
61
// Calculate the items for the table.
61
62
const calculateItems = (): void => {
62
63
const str = route .value .query .showIds as string | null ;
63
64
64
- items .value = Object . values ( props .pairs )
65
+ items .value = props .pairs
65
66
.map ((pair ) => ({
66
67
pair ,
67
68
left: pair .leftFile .shortPath ,
0 commit comments