|
49 | 49 | <Column frozen sortable field="pkg" header="Package" style="min-width: 200px;" /> |
50 | 50 |
|
51 | 51 | <Column v-if="C.display('last_commit_time')" sortable field="last_commit_time" |
52 | | - :header="C.name('last_commit_time')" :pt="ptColumnCenter" /> |
| 52 | + :header="C.name('last_commit_time')" :pt="center" /> |
53 | 53 |
|
54 | | - <Column v-if="C.display('version')" sortable field="version" :header="C.name('version')" :pt="ptColumnCenter" /> |
| 54 | + <Column v-if="C.display('version')" sortable field="version" :header="C.name('version')" :pt="center" /> |
55 | 55 |
|
56 | 56 | <Column v-if="C.display('release_count')" sortable field="release_count" :header="C.name('release_count')" |
57 | | - :pt="ptColumnCenter"> |
| 57 | + :pt="center"> |
58 | 58 | <template #body="{ data }"> |
59 | 59 | <NuxtLink :to="`https://crates.io/crates/${data.pkg}`" target="_blank" class="nav-link"> |
60 | 60 | {{ data.release_count }} |
|
63 | 63 | </Column> |
64 | 64 |
|
65 | 65 | <Column v-if="C.display('last_release_time')" sortable field="last_release_time" |
66 | | - :header="C.name('last_release_time')" style="min-width: 120px;" :pt="ptColumnCenter" /> |
| 66 | + :header="C.name('last_release_time')" style="min-width: 120px;" :pt="center" /> |
67 | 67 |
|
68 | 68 | <Column v-if="C.display('last_release_size')" sortable field="last_release_size" |
69 | | - :header="C.name('last_release_size')" :pt="ptColumnRight" /> |
| 69 | + :header="C.name('last_release_size')" :pt="right" /> |
70 | 70 |
|
71 | 71 | <Column v-if="C.display('diag_total_count')" sortable field="diag_total_count" |
72 | | - :header="C.name('diag_total_count')" :pt="ptColumnRight"> |
| 72 | + :header="C.name('diag_total_count')" :pt="right"> |
73 | 73 | <template #body="{ data }"> |
74 | 74 | <NuxtLink :to="`/${data.user}/${data.repo}`" target="_blank" class="nav-link"> |
75 | 75 | {{ data.diag_total_count }} |
|
78 | 78 | </Column> |
79 | 79 |
|
80 | 80 | <Column v-if="C.display('testcases')" sortable field="testcases" :header="C.name('testcases')" |
81 | | - style="font-weight: bold" :pt="ptColumnRight"> |
| 81 | + style="font-weight: bold" :pt="right"> |
82 | 82 | <template #body="{ data }"> |
83 | 83 | <span :style="{ color: data.testcases_color }"> |
84 | 84 | {{ data.testcases }} |
85 | 85 | </span> |
86 | 86 | </template> |
87 | 87 | </Column> |
88 | 88 |
|
89 | | - <Column v-if="C.display('lib')" sortable field="lib" :header="C.name('lib')" :pt="ptColumnCenter" /> |
90 | | - <Column v-if="C.display('bin')" sortable field="bin" :header="C.name('bin')" :pt="ptColumnCenter" /> |
| 89 | + <Column v-if="C.display('lib')" sortable field="lib" :header="C.name('lib')" :pt="center" /> |
| 90 | + <Column v-if="C.display('bin')" sortable field="bin" :header="C.name('bin')" :pt="center" /> |
91 | 91 | <Column v-if="C.display('dependencies')" sortable field="dependencies" :header="C.name('dependencies')" |
92 | | - :pt="ptColumnRight" /> |
| 92 | + :pt="right" /> |
93 | 93 |
|
94 | | - <Column v-if="C.display('tests')" sortable field="tests" :header="C.name('tests')" :pt="ptColumnRight" /> |
95 | | - <Column v-if="C.display('examples')" sortable field="examples" :header="C.name('examples')" :pt="ptColumnRight" /> |
96 | | - <Column v-if="C.display('benches')" sortable field="benches" :header="C.name('benches')" :pt="ptColumnRight" /> |
| 94 | + <Column v-if="C.display('tests')" sortable field="tests" :header="C.name('tests')" :pt="right" /> |
| 95 | + <Column v-if="C.display('examples')" sortable field="examples" :header="C.name('examples')" :pt="right" /> |
| 96 | + <Column v-if="C.display('benches')" sortable field="benches" :header="C.name('benches')" :pt="right" /> |
97 | 97 |
|
98 | | - <Column v-if="C.display('documentation')" field="documentation" :header="C.name('documentation')" |
99 | | - :pt="ptColumnCenter"> |
| 98 | + <Column v-if="C.display('documentation')" field="documentation" :header="C.name('documentation')" :pt="center"> |
100 | 99 | <template #body="{ data }"> |
101 | 100 | <NuxtLink v-if="data.documentation" :to="data.documentation" target="_blank" class="nav-link"> |
102 | 101 | link |
|
105 | 104 | </template> |
106 | 105 | </Column> |
107 | 106 |
|
108 | | - <Column v-if="C.display('latest_doc')" field="latest_doc" :header="C.name('latest_doc')" :pt="ptColumnCenter"> |
| 107 | + <Column v-if="C.display('latest_doc')" field="latest_doc" :header="C.name('latest_doc')" :pt="center"> |
109 | 108 | <template #body="{ data }"> |
110 | 109 | <NuxtLink v-if="data.latest_doc" :to="data.latest_doc" target="_blank" class="nav-link"> |
111 | 110 | link |
|
114 | 113 | </template> |
115 | 114 | </Column> |
116 | 115 |
|
117 | | - <Column v-if="C.display('homepage')" field="homepage" :header="C.name('homepage')" :pt="ptColumnCenter"> |
| 116 | + <Column v-if="C.display('homepage')" field="homepage" :header="C.name('homepage')" :pt="center"> |
118 | 117 | <template #body="{ data }"> |
119 | 118 | <NuxtLink v-if="data.homepage" :to="data.homepage" target="_blank" class="nav-link"> |
120 | 119 | link |
|
145 | 144 | style="min-width: 280px;" /> |
146 | 145 |
|
147 | 146 | <Column v-if="C.display('authors')" sortable field="authors" :header="C.name('authors')" style="min-width: 300px;" |
148 | | - :pt="ptColumnCenter"> |
| 147 | + :pt="center"> |
149 | 148 | <template #body="{ data: { authors } }"> |
150 | 149 | <div v-for="tag of authors"> |
151 | 150 | <Tag severity="info" :value="tag" style="margin-bottom: 5px;"></Tag> |
|
235 | 234 | import type { Pkg, PkgInfo, Test } from '~/shared/info'; |
236 | 235 | import { unique_field, unique_field_bool, InfoCols } from '~/shared/info'; |
237 | 236 | import { formatBytes } from '~/shared/columns-select'; |
| 237 | +import { center, right } from '~/shared/styling'; |
238 | 238 | import { FilterMatchMode } from '@primevue/core/api'; |
239 | 239 | import type { DataTableSortMeta } from 'primevue/datatable'; |
240 | 240 |
|
241 | 241 | const { color, viewportHeight } = storeToRefs(useStyleStore()); |
242 | 242 | const tableHeight = computed(() => `${Math.round(viewportHeight.value * 0.8)}px`); |
243 | 243 |
|
244 | | -// styling |
245 | | -const ptColumnCenter = ref({ |
246 | | - columnHeaderContent: { style: { "justify-content": "center" } }, |
247 | | - bodyCell: { style: { "text-align": "center" } } |
248 | | -}); |
249 | | -const ptColumnRight = ref({ |
250 | | - columnHeaderContent: { style: { "justify-content": "right" } }, |
251 | | - bodyCell: { style: { "text-align": "right" } } |
252 | | -}); |
253 | | -
|
254 | 244 | const summaries = ref<PkgInfo[]>([]); |
255 | 245 |
|
256 | 246 | githubFetch<PkgInfo[]>({ |
|
0 commit comments