mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-30 20:56:36 +00:00
Simplify config
This commit is contained in:
parent
fb499f09fb
commit
0dd290cd85
@ -75,7 +75,7 @@ export class HuiCardFeatures extends LitElement {
|
|||||||
return nothing;
|
return nothing;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.layout?.type === "compact") {
|
if (this.layout === "compact") {
|
||||||
const currentFeature = this.features[this._currentFeatureIndex];
|
const currentFeature = this.features[this._currentFeatureIndex];
|
||||||
return html`
|
return html`
|
||||||
<div class="container horizontal">
|
<div class="container horizontal">
|
||||||
@ -95,7 +95,7 @@ export class HuiCardFeatures extends LitElement {
|
|||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
const containerClass = this.layout?.type ? ` ${this.layout.type}` : "";
|
const containerClass = this.layout ? ` ${this.layout}` : "";
|
||||||
|
|
||||||
return html`
|
return html`
|
||||||
<div class="container${containerClass}">
|
<div class="container${containerClass}">
|
||||||
|
@ -126,12 +126,12 @@ export class HuiTileCard extends LitElement implements LovelaceCard {
|
|||||||
grid_columns: 2,
|
grid_columns: 2,
|
||||||
grid_rows: 1,
|
grid_rows: 1,
|
||||||
};
|
};
|
||||||
const featureLayoutType = this._config?.feature_layout?.type || "vertical";
|
const featureLayout = this._config?.feature_layout || "vertical";
|
||||||
|
|
||||||
if (this._config?.features?.length) {
|
if (this._config?.features?.length) {
|
||||||
if (featureLayoutType === "compact") {
|
if (featureLayout === "compact") {
|
||||||
options.grid_rows += 1;
|
options.grid_rows += 1;
|
||||||
} else if (featureLayoutType === "horizontal") {
|
} else if (featureLayout === "horizontal") {
|
||||||
options.grid_rows += 1;
|
options.grid_rows += 1;
|
||||||
options.grid_columns = 4;
|
options.grid_columns = 4;
|
||||||
} else {
|
} else {
|
||||||
|
@ -24,9 +24,7 @@ export type AlarmPanelCardConfigState =
|
|||||||
| "arm_vacation"
|
| "arm_vacation"
|
||||||
| "arm_custom_bypass";
|
| "arm_custom_bypass";
|
||||||
|
|
||||||
export type LovelaceCardFeatureLayout = {
|
export type LovelaceCardFeatureLayout = "vertical" | "horizontal" | "compact";
|
||||||
type?: "vertical" | "horizontal" | "compact";
|
|
||||||
};
|
|
||||||
|
|
||||||
export interface AlarmPanelCardConfig extends LovelaceCardConfig {
|
export interface AlarmPanelCardConfig extends LovelaceCardConfig {
|
||||||
entity: string;
|
entity: string;
|
||||||
|
@ -2,9 +2,5 @@ import { any, array, enums, object, optional } from "superstruct";
|
|||||||
|
|
||||||
export const cardFeatureConfig = object({
|
export const cardFeatureConfig = object({
|
||||||
features: optional(array(any())),
|
features: optional(array(any())),
|
||||||
feature_layout: optional(
|
feature_layout: optional(enums(["vertical", "horizontal", "compact"])),
|
||||||
object({
|
|
||||||
type: enums(["vertical", "horizontal", "compact"]),
|
|
||||||
})
|
|
||||||
),
|
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user