Put button menu above toolbar in automation editor (#16716)

This commit is contained in:
Paul Bottein 2023-06-01 13:35:23 +02:00 committed by GitHub
parent 9b2e77e781
commit efa02c309b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 49 additions and 39 deletions

View File

@ -191,6 +191,7 @@ export default class HaAutomationActionRow extends LitElement {
slot="icons" slot="icons"
@action=${this._handleAction} @action=${this._handleAction}
@click=${preventDefault} @click=${preventDefault}
fixed
> >
<ha-icon-button <ha-icon-button
slot="trigger" slot="trigger"

View File

@ -147,7 +147,11 @@ export default class HaAutomationAction extends LitElement {
` `
)} )}
</div> </div>
<ha-button-menu @action=${this._addAction} .disabled=${this.disabled}> <ha-button-menu
@action=${this._addAction}
.disabled=${this.disabled}
fixed
>
<ha-button <ha-button
slot="trigger" slot="trigger"
outlined outlined

View File

@ -130,6 +130,7 @@ export default class HaAutomationConditionRow extends LitElement {
slot="icons" slot="icons"
@action=${this._handleAction} @action=${this._handleAction}
@click=${preventDefault} @click=${preventDefault}
fixed
> >
<ha-icon-button <ha-icon-button
slot="trigger" slot="trigger"

View File

@ -191,7 +191,11 @@ export default class HaAutomationCondition extends LitElement {
` `
)} )}
</div> </div>
<ha-button-menu @action=${this._addCondition} .disabled=${this.disabled}> <ha-button-menu
@action=${this._addCondition}
.disabled=${this.disabled}
fixed
>
<ha-button <ha-button
slot="trigger" slot="trigger"
outlined outlined

View File

@ -153,6 +153,7 @@ export default class HaAutomationTriggerRow extends LitElement {
slot="icons" slot="icons"
@action=${this._handleAction} @action=${this._handleAction}
@click=${preventDefault} @click=${preventDefault}
fixed
> >
<ha-icon-button <ha-icon-button
slot="trigger" slot="trigger"

View File

@ -75,27 +75,25 @@ export default class HaAutomationTrigger extends LitElement {
protected render() { protected render() {
return html` return html`
${ ${this.reOrderMode && !this.nested
this.reOrderMode && !this.nested ? html`
? html` <ha-alert
<ha-alert alert-type="info"
alert-type="info" .title=${this.hass.localize(
.title=${this.hass.localize( "ui.panel.config.automation.editor.re_order_mode.title"
"ui.panel.config.automation.editor.re_order_mode.title" )}
)} >
> ${this.hass.localize(
"ui.panel.config.automation.editor.re_order_mode.description_triggers"
)}
<mwc-button slot="action" @click=${this._exitReOrderMode}>
${this.hass.localize( ${this.hass.localize(
"ui.panel.config.automation.editor.re_order_mode.description_triggers" "ui.panel.config.automation.editor.re_order_mode.exit"
)} )}
<mwc-button slot="action" @click=${this._exitReOrderMode}> </mwc-button>
${this.hass.localize( </ha-alert>
"ui.panel.config.automation.editor.re_order_mode.exit" `
)} : null}
</mwc-button>
</ha-alert>
`
: null
}
<div class="triggers"> <div class="triggers">
${repeat( ${repeat(
this.triggers, this.triggers,
@ -141,8 +139,11 @@ export default class HaAutomationTrigger extends LitElement {
</ha-automation-trigger-row> </ha-automation-trigger-row>
` `
)} )}
</div> <ha-button-menu
<ha-button-menu @action=${this._addTrigger} .disabled=${this.disabled}> @action=${this._addTrigger}
.disabled=${this.disabled}
fixed
>
<ha-button <ha-button
slot="trigger" slot="trigger"
outlined outlined
@ -153,22 +154,20 @@ export default class HaAutomationTrigger extends LitElement {
> >
<ha-svg-icon .path=${mdiPlus} slot="icon"></ha-svg-icon> <ha-svg-icon .path=${mdiPlus} slot="icon"></ha-svg-icon>
</ha-button> </ha-button>
${ ${this.clipboard?.trigger
this.clipboard?.trigger ? html` <mwc-list-item .value=${PASTE_VALUE} graphic="icon">
? html` <mwc-list-item .value=${PASTE_VALUE} graphic="icon"> ${this.hass.localize(
${this.hass.localize( "ui.panel.config.automation.editor.triggers.paste"
"ui.panel.config.automation.editor.triggers.paste" )}
)} (${this.hass.localize(
(${this.hass.localize( `ui.panel.config.automation.editor.triggers.type.${this.clipboard.trigger.platform}.label`
`ui.panel.config.automation.editor.triggers.type.${this.clipboard.trigger.platform}.label` )})
)}) <ha-svg-icon
<ha-svg-icon slot="graphic"
slot="graphic" .path=${mdiContentPaste}
.path=${mdiContentPaste} ></ha-svg-icon
></ha-svg-icon ></mwc-list-item>`
></mwc-list-item>` : nothing}
: nothing
}
${this._processedTypes(this.hass.localize).map( ${this._processedTypes(this.hass.localize).map(
([opt, label, icon]) => html` ([opt, label, icon]) => html`
<mwc-list-item .value=${opt} graphic="icon"> <mwc-list-item .value=${opt} graphic="icon">