Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix oh-gauge-card action regression & Improve oh-card docs #2794

Merged
merged 1 commit into from
Oct 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions bundles/org.openhab.ui/doc/components/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ source: https://github.com/openhab/openhab-webui/edit/main/bundles/org.openhab.u
| [`oh-video-card`](./oh-video-card.html) | [Video Card](./oh-video-card.html) | Display a video (URL or URL from String item) in a card |
| [`oh-webframe-card`](./oh-webframe-card.html) | [Web Frame Card](./oh-webframe-card.html) | Display a web page in a card |

All cards are based on the [`oh-card`](./oh-card.html) component and share the same config options for modifying the card's appearance.
Refer to the [`oh-card` Style](./oh-card.html#style) documentation to learn about card styling options.

## Standard Widget Library (List Items)

Expand Down
1 change: 1 addition & 0 deletions bundles/org.openhab.ui/doc/components/oh-card.md
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,7 @@ You need to define either one of these two slots:

- `content`: The default slot for content, which will then be rendered inside a `f7-card-content` element.
- `content-root`: The slot for content that should be rendered directly inside the card, without any additional wrapping element.
If this slot is defined, the `content` slot will be ignored, and you have to implement the handling of `config.contentStyle` and `config.contentClass` yourself.

Optionally, you can define these slots:

Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,34 @@
<template>
<oh-card :context="context" :content-class="['oh-gauge-card', 'display-flex', 'justify-content-center']">
<template #content>
<oh-gauge :context="childContext(context.component)" />
<template #content-root>
<f7-card-content :style="config.contentStyle" :class="[ ...(Array.isArray(config.contentClass) ? config.contentClass : []), 'oh-gauge-card', 'display-flex', 'justify-content-center']">
<f7-link v-if="config.action" class="oh-gauge-link" @click="performAction">
<oh-gauge :context="childContext(context.component)" />
</f7-link>
<oh-gauge v-else :context="childContext(context.component)" />
</f7-card-content>
</template>
</oh-card>
</template>

<style lang="stylus">
.oh-gauge-link
position absolute
top 0
left 0
width 100%
height 100%
</style>

<script>
import mixin from '../widget-mixin'
import { actionsMixin } from '@/components/widgets/widget-actions'
import OhCard from '@/components/widgets/standard/oh-card.vue'
import OhGauge from '../system/oh-gauge.vue'
import { OhGaugeCardDefinition } from '@/assets/definitions/widgets/standard/cards'

export default {
mixins: [mixin],
mixins: [mixin, actionsMixin],
components: {
OhCard,
OhGauge
Expand Down