|
1 | 1 | <template> |
2 | 2 | <v-data-table |
3 | | - @click:row="selectActivity($event.id)" |
4 | 3 | :headers="headers" |
5 | 4 | :items="items" |
6 | 5 | height="100%" |
7 | | - item-class="class" |
8 | 6 | disable-pagination hide-default-footer fixed-header |
9 | 7 | class="overview primary lighten-5"> |
10 | | - <template #item.name="{ item, value }"> |
11 | | - <div class="d-flex"> |
12 | | - <overview-name :value="value" /> |
13 | | - <publishing-badge v-if="isAdmin || isRepositoryAdmin" :activity="item" /> |
14 | | - </div> |
15 | | - </template> |
16 | | - <template #item.status="{ value }"> |
17 | | - <overview-status v-bind="value" /> |
18 | | - </template> |
19 | | - <template #item.assignee="{ value }"> |
20 | | - <overview-assignee v-bind="value" /> |
21 | | - </template> |
22 | | - <template #item.priority="{ value }"> |
23 | | - <overview-priority v-bind="value" /> |
24 | | - </template> |
25 | | - <template #item.dueDate="{ value }"> |
26 | | - <overview-due-date v-if="value" :value="value" /> |
| 8 | + <template v-slot:body="props"> |
| 9 | + <v-virtual-scroll :items="props.items" item-height="46"> |
| 10 | + <template v-slot:default="{ item }"> |
| 11 | + <v-row |
| 12 | + @click="selectActivity(item.id)" |
| 13 | + :class="{ selected: isActivitySelected(item.id) }"> |
| 14 | + <v-col class="name d-flex text-left"> |
| 15 | + <overview-name :value="item.name" /> |
| 16 | + <publishing-badge v-if="isAdmin || isRepositoryAdmin" :activity="item" /> |
| 17 | + </v-col> |
| 18 | + <div class="status d-flex align-center text-left"> |
| 19 | + <overview-status v-bind="item.status" /> |
| 20 | + </div> |
| 21 | + <div class="assignee d-flex align-center text-left"> |
| 22 | + <overview-assignee v-bind="item.assignee" /> |
| 23 | + </div> |
| 24 | + <div class="priority d-flex align-center text-left"> |
| 25 | + <overview-priority v-bind="item.priority" /> |
| 26 | + </div> |
| 27 | + <div class="date d-flex align-center text-left"> |
| 28 | + <overview-due-date v-if="item.dueDate" :value="item.dueDate" /> |
| 29 | + </div> |
| 30 | + </v-row> |
| 31 | + </template> |
| 32 | + </v-virtual-scroll> |
27 | 33 | </template> |
28 | 34 | </v-data-table> |
29 | 35 | </template> |
@@ -78,12 +84,14 @@ export default { |
78 | 84 | publishedAt, |
79 | 85 | type, |
80 | 86 | status: this.getStatusById(status.status), |
81 | | - priority: getPriority(status.priority), |
82 | | - class: this.isActivitySelected(id) && 'selected' |
| 87 | + priority: getPriority(status.priority) |
83 | 88 | })); |
84 | 89 | } |
85 | 90 | }, |
86 | 91 | methods: { |
| 92 | + selectItem(id) { |
| 93 | + this.selectedItemId = id; |
| 94 | + }, |
87 | 95 | isActivitySelected(id) { |
88 | 96 | return this.selectedActivity && this.selectedActivity.id === id; |
89 | 97 | }, |
@@ -116,33 +124,74 @@ export default { |
116 | 124 | </script> |
117 | 125 |
|
118 | 126 | <style lang="scss" scoped> |
119 | | -$row-background: var(--v-primary-lighten4); |
| 127 | +$row-background: var(--v-primary-lighten5); |
| 128 | +$row-hover-background: var(--v-primary-lighten4); |
| 129 | +$status-max-width: 180px; |
| 130 | +$assignee-max-width: 340px; |
| 131 | +$priority-max-width: 180px; |
| 132 | +$date-max-width: 160px; |
120 | 133 |
|
121 | 134 | .overview ::v-deep { |
| 135 | + table { |
| 136 | + table-layout: fixed; |
| 137 | +
|
| 138 | + th:nth-of-type(1), .name { |
| 139 | + max-width: calc(100% - #{$status-max-width} - #{$assignee-max-width} - #{$priority-max-width} - #{$date-max-width}); |
| 140 | + } |
| 141 | +
|
| 142 | + .name .v-badge { |
| 143 | + padding-left: 8px; |
| 144 | + } |
| 145 | +
|
| 146 | + th:nth-of-type(2), .status { |
| 147 | + width: $status-max-width; |
| 148 | + } |
| 149 | +
|
| 150 | + th:nth-of-type(3), .assignee { |
| 151 | + width: $assignee-max-width; |
| 152 | + } |
| 153 | +
|
| 154 | + th:nth-of-type(4), .priority { |
| 155 | + width: $priority-max-width; |
| 156 | + } |
| 157 | +
|
| 158 | + th:nth-of-type(5), .date { |
| 159 | + width: $date-max-width; |
| 160 | + } |
| 161 | + } |
| 162 | +
|
122 | 163 | thead.v-data-table-header { |
123 | 164 | tr th { |
124 | | - background: #eceff1; |
| 165 | + background: $row-background; |
125 | 166 | } |
126 | | - } |
127 | 167 |
|
128 | | - .column-name { |
129 | | - max-width: 17.75rem; |
| 168 | + tr:hover { |
| 169 | + th { |
| 170 | + background: $row-hover-background !important; |
| 171 | + } |
| 172 | + } |
130 | 173 | } |
131 | 174 |
|
132 | | - .column-assignee { |
133 | | - max-width: 11.5rem; |
134 | | - } |
| 175 | + .row { |
| 176 | + margin: 0; |
| 177 | + background-color: $row-background; |
| 178 | + border-bottom: thin solid rgba(0, 0, 0, 0.12); |
135 | 179 |
|
136 | | - tr:hover { |
137 | | - background: $row-background !important; |
| 180 | + &:hover { |
| 181 | + background-color: $row-hover-background; |
| 182 | + } |
| 183 | +
|
| 184 | + &.selected { |
| 185 | + background: $row-hover-background; |
| 186 | + } |
138 | 187 |
|
139 | 188 | &:not(.selected) { |
140 | 189 | cursor: pointer; |
141 | 190 | } |
142 | 191 | } |
143 | 192 |
|
144 | | - .selected { |
145 | | - background: $row-background; |
| 193 | + .v-virtual-scroll { |
| 194 | + display: table-row-group; |
146 | 195 | } |
147 | 196 | } |
148 | 197 | </style> |
0 commit comments