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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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