mirror of
https://github.com/home-assistant/frontend.git
synced 2025-11-10 03:19:44 +00:00
Add collapse/expand all for automations (#26695)
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { mdiPlus } from "@mdi/js";
|
||||
import type { PropertyValues } from "lit";
|
||||
import { LitElement, css, html, nothing } from "lit";
|
||||
import { customElement, property } from "lit/decorators";
|
||||
import { customElement, property, queryAll } from "lit/decorators";
|
||||
import { fireEvent } from "../../../common/dom/fire_event";
|
||||
import "../../../components/ha-button";
|
||||
import "../../../components/ha-button-menu";
|
||||
@@ -23,6 +23,9 @@ export default class HaScriptFields extends LitElement {
|
||||
|
||||
@property({ type: Boolean }) public narrow = false;
|
||||
|
||||
@queryAll("ha-script-field-row")
|
||||
private _fieldRowElements?: HaScriptFieldRow[];
|
||||
|
||||
private _focusLastActionOnChange = false;
|
||||
|
||||
protected render() {
|
||||
@@ -48,12 +51,7 @@ export default class HaScriptFields extends LitElement {
|
||||
)}
|
||||
</div> `
|
||||
: nothing}
|
||||
<ha-button
|
||||
appearance="filled"
|
||||
size="small"
|
||||
@click=${this._addField}
|
||||
.disabled=${this.disabled}
|
||||
>
|
||||
<ha-button @click=${this._addField} .disabled=${this.disabled}>
|
||||
<ha-svg-icon .path=${mdiPlus} slot="start"></ha-svg-icon>
|
||||
${this.hass.localize("ui.panel.config.script.editor.field.add_field")}
|
||||
</ha-button>
|
||||
@@ -144,6 +142,18 @@ export default class HaScriptFields extends LitElement {
|
||||
return key;
|
||||
}
|
||||
|
||||
public expandAll() {
|
||||
this._fieldRowElements?.forEach((row) => {
|
||||
row.expandAll();
|
||||
});
|
||||
}
|
||||
|
||||
public collapseAll() {
|
||||
this._fieldRowElements?.forEach((row) => {
|
||||
row.collapseAll();
|
||||
});
|
||||
}
|
||||
|
||||
static styles = css`
|
||||
ha-script-field-row {
|
||||
display: block;
|
||||
|
||||
Reference in New Issue
Block a user