Force narrow style for action, condition and trigger in flows (#25619)

This commit is contained in:
Paul Bottein 2025-05-28 12:04:54 +02:00 committed by Bram Kragten
parent 5371fd649c
commit b907dbefad
7 changed files with 19 additions and 0 deletions

View File

@ -34,6 +34,8 @@ const getWarning = (obj, item) => (obj && item.name ? obj[item.name] : null);
export class HaForm extends LitElement implements HaFormElement {
@property({ attribute: false }) public hass?: HomeAssistant;
@property({ type: Boolean }) public narrow = false;
@property({ attribute: false }) public data!: HaFormDataContainer;
@property({ attribute: false }) public schema!: readonly HaFormSchema[];
@ -135,6 +137,7 @@ export class HaForm extends LitElement implements HaFormElement {
? html`<ha-selector
.schema=${item}
.hass=${this.hass}
.narrow=${this.narrow}
.name=${item.name}
.selector=${item.selector}
.value=${getValue(this.data, item)}

View File

@ -19,6 +19,8 @@ import { SubscribeMixin } from "../../mixins/subscribe-mixin";
export class HaActionSelector extends SubscribeMixin(LitElement) {
@property({ attribute: false }) public hass!: HomeAssistant;
@property({ type: Boolean }) public narrow = false;
@property({ attribute: false }) public selector!: ActionSelector;
@property({ attribute: false }) public value?: Action;
@ -66,6 +68,7 @@ export class HaActionSelector extends SubscribeMixin(LitElement) {
.disabled=${this.disabled}
.actions=${this._actions(this.value)}
.hass=${this.hass}
.narrow=${this.narrow}
></ha-automation-action>
`;
}

View File

@ -9,6 +9,8 @@ import type { HomeAssistant } from "../../types";
export class HaConditionSelector extends LitElement {
@property({ attribute: false }) public hass!: HomeAssistant;
@property({ type: Boolean }) public narrow = false;
@property({ attribute: false }) public selector!: ConditionSelector;
@property({ attribute: false }) public value?: Condition;
@ -24,6 +26,7 @@ export class HaConditionSelector extends LitElement {
.disabled=${this.disabled}
.conditions=${this.value || []}
.hass=${this.hass}
.narrow=${this.narrow}
></ha-automation-condition>
`;
}

View File

@ -11,6 +11,8 @@ import type { HomeAssistant } from "../../types";
export class HaTriggerSelector extends LitElement {
@property({ attribute: false }) public hass!: HomeAssistant;
@property({ type: Boolean }) public narrow = false;
@property({ attribute: false }) public selector!: TriggerSelector;
@property({ attribute: false }) public value?: Trigger;
@ -33,6 +35,7 @@ export class HaTriggerSelector extends LitElement {
.disabled=${this.disabled}
.triggers=${this._triggers(this.value)}
.hass=${this.hass}
.narrow=${this.narrow}
></ha-automation-trigger>
`;
}

View File

@ -69,6 +69,8 @@ const LEGACY_UI_SELECTORS = new Set(["ui-action", "ui-color"]);
export class HaSelector extends LitElement {
@property({ attribute: false }) public hass!: HomeAssistant;
@property({ type: Boolean }) public narrow = false;
@property() public name?: string;
@property({ attribute: false }) public selector!: Selector;
@ -127,6 +129,7 @@ export class HaSelector extends LitElement {
return html`
${dynamicElement(`ha-selector-${this._type}`, {
hass: this.hass,
narrow: this.narrow,
name: this.name,
selector: this._handleLegacySelector(this.selector),
value: this.value,

View File

@ -349,6 +349,7 @@ class DataEntryFlowDialog extends LitElement {
${this._step.type === "form"
? html`
<step-flow-form
narrow
.flowConfig=${this._params.flowConfig}
.step=${this._step}
.hass=${this.hass}

View File

@ -27,6 +27,8 @@ import { configFlowContentStyles } from "./styles";
class StepFlowForm extends LitElement {
@property({ attribute: false }) public flowConfig!: FlowConfig;
@property({ type: Boolean }) public narrow = false;
@property({ attribute: false }) public step!: DataEntryFlowStepForm;
@property({ attribute: false }) public hass!: HomeAssistant;
@ -63,6 +65,7 @@ class StepFlowForm extends LitElement {
: ""}
<ha-form
.hass=${this.hass}
.narrow=${this.narrow}
.data=${stepData}
.disabled=${this._loading}
@value-changed=${this._stepDataChanged}