Skip to content

Commit 07743c1

Browse files
authored
Merge pull request #2718 from benderl/koala
koala fixes
2 parents 46dc665 + 750968b commit 07743c1

9 files changed

Lines changed: 85 additions & 40 deletions

File tree

packages/modules/web_themes/koala/source/src/components/BaseCarousel.vue

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,14 @@
3434
</template>
3535

3636
<script setup lang="ts">
37-
import { ref, computed, nextTick, onMounted, onBeforeUnmount, watch } from 'vue';
37+
import {
38+
ref,
39+
computed,
40+
nextTick,
41+
onMounted,
42+
onBeforeUnmount,
43+
watch,
44+
} from 'vue';
3845
import { Screen } from 'quasar';
3946
4047
const props = defineProps<{ items: number[] }>();
@@ -69,7 +76,6 @@ function measure() {
6976
});
7077
}
7178
72-
7379
onMounted(() => {
7480
measure();
7581
window.addEventListener('resize', measure);
@@ -83,7 +89,13 @@ watch(() => props.items, measure);
8389
8490
const groupSize = computed(() => {
8591
if (!itemWidth.value || !carouselWidth.value) return 1;
86-
const maxGroup = Math.max(1, Math.floor((carouselWidth.value - (showArrows.value ? carouselPadding.value : 50)) / itemWidth.value));
92+
const maxGroup = Math.max(
93+
1,
94+
Math.floor(
95+
(carouselWidth.value - (showArrows.value ? carouselPadding.value : 50)) /
96+
itemWidth.value,
97+
),
98+
);
8799
// Spezialfall: Alle passen nebeneinander
88100
if (
89101
props.items.length > maxGroup &&

packages/modules/web_themes/koala/source/src/components/BaseTable.vue

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,12 @@
1515
binary-state-sort
1616
:pagination="{ rowsPerPage: 0 }"
1717
hide-bottom
18+
:dense="props.dense"
19+
:square="props.square"
1820
>
1921
<!-- search field ------------------------------------------------------->
2022
<template #top v-if="searchInputVisible">
21-
<div class="row full-width items-center q-mb-sm">
23+
<div class="row full-width items-center">
2224
<div class="col">
2325
<q-input
2426
v-model="filterModel"
@@ -146,6 +148,8 @@ const props = defineProps<{
146148
filter?: string;
147149
columnsToSearch?: string[];
148150
rowExpandable?: boolean;
151+
dense?: boolean;
152+
square?: boolean;
149153
}>();
150154
151155
/* ------------------------------------------------------------------ state */
@@ -211,7 +215,11 @@ const customFilterMethod: NonNullable<QTableProps['filterMethod']> = (
211215
const onRowClick = (evt: Event, row: T) => emit('row-click', row);
212216
</script>
213217

214-
<style scoped>
218+
<style scoped lang="scss">
219+
:deep(.q-table__top) {
220+
padding: #{map-get($space-xs, y)} #{map-get($space-xs, x)};
221+
}
222+
215223
.search-field {
216224
width: 100%;
217225
max-width: 18em;

packages/modules/web_themes/koala/source/src/components/BatteryCard.vue

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
<template>
22
<q-card
33
ref="cardRef"
4-
class="card-width full-height"
5-
:class="{ 'battery-sum': props.batteryId === -1 }"
4+
class="card-width"
5+
:class="{
6+
'battery-sum': props.batteryId === -1,
7+
'full-height': props.fullHeight,
8+
}"
69
>
710
<q-card-section class="row items-center justify-between">
811
<div class="text-h6 text-bold ellipsis" :title="cardTitle">
@@ -80,6 +83,7 @@ const cardRef = ref<{ $el: HTMLElement } | null>(null);
8083
8184
const props = defineProps<{
8285
batteryId: number;
86+
fullHeight?: boolean;
8387
}>();
8488
8589
const singleBattery = computed(() => {

packages/modules/web_themes/koala/source/src/components/BatteryInformation.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<template>
22
<BaseCarousel :items="batteryIds">
33
<template #item="{ item }">
4-
<BatteryCard :battery-id="item" />
4+
<BatteryCard :battery-id="item" full-height />
55
</template>
66
</BaseCarousel>
77
</template>

packages/modules/web_themes/koala/source/src/components/ChargePointCard.vue

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
<template>
2-
<q-card ref="cardRef" class="card-width full-height">
2+
<q-card
3+
ref="cardRef"
4+
class="card-width"
5+
:class="{ 'full-height': props.fullHeight }"
6+
>
37
<q-card-section class="row no-wrap">
48
<div class="text-h6 text-bold ellipsis" :title="name">
59
{{ name }}
@@ -127,6 +131,7 @@ const $q = useQuasar();
127131
const props = defineProps<{
128132
chargePointId: number;
129133
closeButton?: boolean;
134+
fullHeight?: boolean;
130135
}>();
131136
132137
const vehicleId = computed(() => {

packages/modules/web_themes/koala/source/src/components/ChargePointInformation.vue

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,25 @@
44
:items="chargePointIds"
55
>
66
<template #item="{ item }">
7-
<ChargePointCard :charge-point-id="item" />
7+
<ChargePointCard :charge-point-id="item" full-height />
88
</template>
99
</BaseCarousel>
1010

1111
<BaseTable
1212
v-else
1313
:items="chargePointIds"
1414
:row-data="tableRowData"
15-
:column-config="compactTable ? tableColumnsMobile : columnConfigDesktop"
15+
:column-config="compactTable ? tableColumnsCompact : columnConfig"
16+
:dense="compactTable"
17+
:square="compactTable"
1618
:search-input-visible="searchInputVisible"
1719
:table-height="compactTable ? '35vh' : '45vh'"
1820
v-model:filter="filter"
1921
:columns-to-search="['vehicle', 'name']"
2022
:row-expandable="compactTable"
2123
@row-click="onRowClick"
2224
>
23-
<!-- desktop view table body slots -->
25+
<!-- full view table body slots -->
2426
<template #body-cell-plugged="slotProps">
2527
<q-td :class="`text-${slotProps.col.align}`">
2628
<ChargePointStateIcon :charge-point-id="slotProps.row.id" />
@@ -54,16 +56,16 @@
5456
/>
5557
</q-td>
5658
</template>
57-
<!-- mobile view table body slots -->
58-
<!-- mobile view charge point name and vehicle name displayed in one field -->
59+
<!-- compact view table body slots -->
60+
<!-- compact view charge point name and vehicle name displayed in one field -->
5961
<template #body-cell-nameAndVehicle="slotProps">
6062
<q-td :class="`text-${slotProps.col.align}`">
6163
{{ slotProps.row.name }}<br />
6264
<span class="text-caption">{{ slotProps.row.vehicle }}</span>
6365
</q-td>
6466
</template>
6567

66-
<!-- mobile view charge point charge mode, plug status and time charging displayed in one field -->
68+
<!-- compact view charge point charge mode, plug status and time charging displayed in one field -->
6769
<template #body-cell-modePluggedTimeCharging="slotProps">
6870
<q-td :class="`text-${slotProps.col.align}`">
6971
<div class="items-center">
@@ -83,7 +85,7 @@
8385
<template #row-expand="slotProps">
8486
<div class="q-pa-xs column q-gutter-y-xs">
8587
<div
86-
v-for="column in expansionColumnsMobile"
88+
v-for="column in expansionColumnsCompact"
8789
:key="column.field"
8890
class="row items-start"
8991
>
@@ -191,7 +193,7 @@ const tableRowData = computed<(id: number) => ChargePointRow>(() => {
191193
};
192194
});
193195
194-
const columnConfigDesktop: ColumnConfiguration[] = [
196+
const columnConfig: ColumnConfiguration[] = [
195197
{ field: 'name', label: 'Ladepunkt' },
196198
{ field: 'vehicle', label: 'Fahrzeug' },
197199
{ field: 'plugged', label: 'Status', align: 'center' },
@@ -202,7 +204,7 @@ const columnConfigDesktop: ColumnConfiguration[] = [
202204
{ field: 'soc', label: 'Ladestand', align: 'right' },
203205
];
204206
205-
const columnConfigMobile: ColumnConfiguration[] = [
207+
const columnConfigCompact: ColumnConfiguration[] = [
206208
{ field: 'nameAndVehicle', label: 'Ladepunkt' },
207209
{ field: 'modePluggedTimeCharging', label: 'Lademodus', align: 'center' },
208210
{
@@ -214,10 +216,10 @@ const columnConfigMobile: ColumnConfiguration[] = [
214216
{ field: 'soc', label: 'Ladestand', align: 'right', expandField: true },
215217
];
216218
217-
const tableColumnsMobile = columnConfigMobile.filter(
219+
const tableColumnsCompact = columnConfigCompact.filter(
218220
(column) => !column.expandField,
219221
);
220-
const expansionColumnsMobile = columnConfigMobile.filter(
222+
const expansionColumnsCompact = columnConfigCompact.filter(
221223
(column) => column.expandField,
222224
);
223225

packages/modules/web_themes/koala/source/src/components/ChargePointPowerData.vue

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
<template>
22
<div
33
:class="[
4-
'text-no-wrap items-center q-gutter-xs',
4+
'text-no-wrap items-center',
55
columnDisplayFormat ? 'column' : 'row inline',
66
]"
77
>
88
<span>{{ power }}</span>
9-
<q-badge rounded color="primary" :label="phaseNumber">
10-
<q-tooltip>Phasenanzahl</q-tooltip>
11-
</q-badge>
12-
<span>{{ current }}</span>
9+
<div :class="{ 'q-ml-xs': !columnDisplayFormat }">
10+
<q-badge rounded color="primary" :label="phaseNumber" class="q-mr-xs">
11+
<q-tooltip>Phasenanzahl</q-tooltip>
12+
</q-badge>
13+
<span>{{ current }}</span>
14+
</div>
1315
</div>
1416
</template>
1517

packages/modules/web_themes/koala/source/src/components/VehicleCard.vue

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,22 @@
11
<template>
2-
<q-card ref="cardRef" class="card-width full-height">
2+
<q-card
3+
ref="cardRef"
4+
class="card-width"
5+
:class="{ 'full-height': props.fullHeight }"
6+
>
37
<q-card-section class="row">
48
<div class="text-h6 text-bold ellipsis" :title="vehicle?.name">
59
{{ vehicle?.name }}
610
</div>
11+
<q-space />
12+
<q-btn
13+
v-if="props.closeButton"
14+
icon="close"
15+
flat
16+
round
17+
dense
18+
v-close-popup
19+
/>
720
</q-card-section>
821
<q-separator class="q-mt-sm" />
922
<q-card-section class="row q-mt-sm">
@@ -57,6 +70,8 @@ const cardRef = ref<{ $el: HTMLElement } | null>(null);
5770
5871
const props = defineProps<{
5972
vehicleId: number;
73+
closeButton?: boolean;
74+
fullHeight?: boolean;
6075
}>();
6176
6277
const mqttStore = useMqttStore();

packages/modules/web_themes/koala/source/src/components/VehicleInformation.vue

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,19 @@
44
:items="vehicleIds"
55
>
66
<template #item="{ item }">
7-
<VehicleCard :vehicle-id="item" />
7+
<VehicleCard :vehicle-id="item" full-height />
88
</template>
99
</BaseCarousel>
1010

1111
<BaseTable
1212
v-else
1313
:items="vehicleIds"
1414
:row-data="tableRowData"
15-
:column-config="isMobile ? columnConfigMobile : columnConfigDesktop"
15+
:column-config="compactTable ? columnConfigCompact : columnConfig"
16+
:dense="compactTable"
17+
:square="compactTable"
1618
:search-input-visible="searchInputVisible"
17-
:table-height="isMobile ? '35vh' : '45vh'"
19+
:table-height="compactTable ? '35vh' : '45vh'"
1820
v-model:filter="filter"
1921
:columns-to-search="['name', 'manufacturer', 'model']"
2022
:row-expandable="true"
@@ -42,21 +44,16 @@
4244
<VehicleCard
4345
v-if="selectedVehicleId !== null"
4446
:vehicle-id="selectedVehicleId"
45-
>
46-
<template #card-actions>
47-
<q-btn color="primary" flat no-caps v-close-popup size="md">
48-
Schließen
49-
</q-btn>
50-
</template>
51-
</VehicleCard>
47+
closeButton
48+
/>
5249
</div>
5350
</q-dialog>
5451
</template>
5552

5653
<script setup lang="ts">
5754
import { computed, ref } from 'vue';
5855
import { useMqttStore } from 'src/stores/mqtt-store';
59-
import { Platform } from 'quasar';
56+
import { Screen } from 'quasar';
6057
import BaseCarousel from 'src/components/BaseCarousel.vue';
6158
import BaseTable from 'src/components/BaseTable.vue';
6259
import { VehicleRow } from 'src/components/models/table-model';
@@ -66,7 +63,7 @@ import VehicleCard from 'src/components/VehicleCard.vue';
6663
import { ColumnConfiguration } from 'src/components/models/table-model';
6764
6865
const mqttStore = useMqttStore();
69-
const isMobile = computed(() => Platform.is.mobile);
66+
const compactTable = computed(() => Screen.lt.md);
7067
const modalChargeVehicleCardVisible = ref(false);
7168
const selectedVehicleId = ref<number | null>(null);
7269
const filter = ref('');
@@ -103,15 +100,15 @@ const tableRowData = computed<(id: number) => VehicleRow>(() => {
103100
};
104101
});
105102
106-
const columnConfigDesktop: ColumnConfiguration[] = [
103+
const columnConfig: ColumnConfiguration[] = [
107104
{ field: 'name', label: 'Fahrzeug' },
108105
{ field: 'manufacturer', label: 'Hersteller' },
109106
{ field: 'model', label: 'Modell' },
110107
{ field: 'plugged', label: 'Status', align: 'center' },
111108
{ field: 'vehicleSocValue', label: 'Ladestand', align: 'right' },
112109
];
113110
114-
const columnConfigMobile: ColumnConfiguration[] = [
111+
const columnConfigCompact: ColumnConfiguration[] = [
115112
{ field: 'name', label: 'Fahrzeug' },
116113
{ field: 'plugged', label: 'Status', align: 'center' },
117114
{ field: 'vehicleSocValue', label: 'Ladestand', align: 'right' },

0 commit comments

Comments
 (0)