This repository has been archived by the owner on Jul 3, 2024. It is now read-only.
forked from Tokyo-Metro-Gov/covid19
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathDataTable.vue
154 lines (141 loc) · 3.09 KB
/
DataTable.vue
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
<template>
<data-view :title="title" :title-id="titleId" :date="date">
<template v-slot:description>
<slot name="description" />
</template>
<template v-slot:button>
<span />
</template>
<v-data-table
:ref="'displayedTable'"
:headers="patientsChartData.headers"
:items="patientsChartData.datasets"
:items-per-page="-1"
:hide-default-footer="true"
:height="200"
:fixed-header="true"
:mobile-breakpoint="0"
class="cardTable"
/>
<v-data-table
:ref="'displayedTable'"
:headers="patientsPerCityChartData.headers"
:items="patientsPerCityChartData.datasets"
:items-per-page="-1"
:hide-default-footer="true"
:height="125"
:fixed-header="true"
:mobile-breakpoint="0"
class="cardTable"
/>
<template v-slot:infoPanel>
<data-view-basic-info-panel
:l-text="info.lText"
:s-text="info.sText"
:unit="info.unit"
/>
</template>
<template v-slot:footer>
<open-data-link :url="url" />
</template>
</data-view>
</template>
<style lang="scss">
.cardTable {
&.v-data-table {
box-shadow: 0 -20px 12px -12px #0003 inset;
th {
padding: 30px 10px 8px 10px;
height: auto;
border-bottom: 1px solid $gray-4;
white-space: nowrap;
color: $gray-2;
font-size: 12px;
&.text-center {
text-align: center;
}
}
tbody {
tr {
color: $gray-1;
td {
padding: 8px 10px;
height: auto;
font-size: 12px;
&.text-center {
text-align: center;
}
}
&:nth-child(odd) {
td {
background: rgba($gray-4, 0.3);
}
}
&:not(:last-child) {
td:not(.v-data-table__mobile-row) {
border: none;
}
}
}
}
&:focus {
outline: dotted $gray-3 1px;
}
}
}
.note {
padding: 8px;
font-size: 12px;
color: $gray-3;
ul {
list-style: none;
}
}
</style>
<script lang="ts">
import Vue from 'vue'
import DataView from '@/components/DataView.vue'
import DataViewBasicInfoPanel from '@/components/DataViewBasicInfoPanel.vue'
import OpenDataLink from '@/components/OpenDataLink.vue'
export default Vue.extend({
components: { DataView, DataViewBasicInfoPanel, OpenDataLink },
props: {
title: {
type: String,
default: ''
},
titleId: {
type: String,
default: ''
},
patientsChartData: {
type: Object,
default: () => {}
},
patientsPerCityChartData: {
type: Object,
default: () => {}
},
date: {
type: String,
default: ''
},
info: {
type: Object,
default: () => {}
},
url: {
type: String,
default: ''
}
},
mounted() {
const vTables = this.$refs.displayedTable as Vue
const vTableElement = vTables.$el
const tables = vTableElement.querySelectorAll('table')
tables.forEach((table: HTMLElement) => {
table.setAttribute('tabindex', '0')
})
}
})
</script>