-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Expand file tree
/
Copy pathAppTable.vue
More file actions
100 lines (85 loc) · 2.07 KB
/
Copy pathAppTable.vue
File metadata and controls
100 lines (85 loc) · 2.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
<!--
- SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors
- SPDX-License-Identifier: AGPL-3.0-or-later
-->
<script setup lang="ts">
import type { IAppstoreApp, IAppstoreExApp } from '../../apps.d.ts'
import { t } from '@nextcloud/l10n'
import { useElementSize } from '@vueuse/core'
import { computed, useTemplateRef } from 'vue'
import AppTableRow from './AppTableRow.vue'
defineProps<{
apps: (IAppstoreApp | IAppstoreExApp)[]
}>()
const tableElement = useTemplateRef('table')
const { width: tableWidth } = useElementSize(tableElement)
const isNarrow = computed(() => tableWidth.value < 768)
const isWide = computed(() => tableWidth.value >= 1280)
</script>
<template>
<table
ref="table"
:class="[$style.appTable, {
[$style.appTable_narrow]: isNarrow,
[$style.appTable_wide]: isWide,
}]">
<colgroup>
<col :class="$style.appTable__colName">
<col :class="$style.appTable__colVersion">
<col v-if="!isNarrow" :class="$style.appTable__colSupport">
<col v-if="isWide" :class="$style.appTable__colGroups">
<col :class="$style.appTable__colActions">
</colgroup>
<thead hidden>
<tr>
<th>{{ t('appstore', 'App name') }}</th>
<th>{{ t('appstore', 'Version') }}</th>
<th v-if="!isNarrow">
{{ t('appstore', 'Support level') }}
</th>
<th v-if="isWide">
{{ t('appstore', 'Groups') }}
</th>
<th>{{ t('appstore', 'Actions') }}</th>
</tr>
</thead>
<tbody>
<AppTableRow
v-for="app in apps"
:key="app.id"
:app
:isNarrow
:isWide />
</tbody>
</table>
</template>
<style module>
.appTable {
table-layout: fixed;
width: 100%;
}
.appTable__colName {
width: 45%;
}
.appTable_narrow .appTable__colName {
width: 60%;
}
.appTable_wide .appTable__colName {
width: 37%;
}
.appTable__colSupport {
width: 15%;
}
.appTable_wide .appTable__colSupport {
width: 12%;
}
.appTable__colActions {
width: 25%;
}
.appTable_wide .appTable__colActions {
width: 20%;
}
.appTable_narrow .appTable__colActions {
width: calc(3 * var(--default-grid-baseline) + 2 * var(--default-clickable-area));
}
</style>