mirror of
https://github.com/home-assistant/frontend.git
synced 2025-11-16 22:40:55 +00:00
Fix automation narrow bottom sheet close animation (#26850)
This commit is contained in:
@@ -694,8 +694,7 @@ export default class HaAutomationActionRow extends LitElement {
|
|||||||
ev?.stopPropagation();
|
ev?.stopPropagation();
|
||||||
|
|
||||||
if (this._selected) {
|
if (this._selected) {
|
||||||
this._selected = false;
|
fireEvent(this, "request-close-sidebar");
|
||||||
fireEvent(this, "close-sidebar");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.openSidebar();
|
this.openSidebar();
|
||||||
|
|||||||
@@ -669,8 +669,7 @@ export default class HaAutomationConditionRow extends LitElement {
|
|||||||
ev?.stopPropagation();
|
ev?.stopPropagation();
|
||||||
|
|
||||||
if (this._selected) {
|
if (this._selected) {
|
||||||
this._selected = false;
|
fireEvent(this, "request-close-sidebar");
|
||||||
fireEvent(this, "close-sidebar");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.openSidebar();
|
this.openSidebar();
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ export default class HaAutomationSidebar extends LitElement {
|
|||||||
.yamlMode=${this._yamlMode}
|
.yamlMode=${this._yamlMode}
|
||||||
.sidebarKey=${this.sidebarKey}
|
.sidebarKey=${this.sidebarKey}
|
||||||
@toggle-yaml-mode=${this._toggleYamlMode}
|
@toggle-yaml-mode=${this._toggleYamlMode}
|
||||||
@close-sidebar=${this._handleCloseSidebar}
|
@close-sidebar=${this.triggerCloseSidebar}
|
||||||
></ha-automation-sidebar-trigger>
|
></ha-automation-sidebar-trigger>
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
@@ -71,7 +71,7 @@ export default class HaAutomationSidebar extends LitElement {
|
|||||||
.yamlMode=${this._yamlMode}
|
.yamlMode=${this._yamlMode}
|
||||||
.sidebarKey=${this.sidebarKey}
|
.sidebarKey=${this.sidebarKey}
|
||||||
@toggle-yaml-mode=${this._toggleYamlMode}
|
@toggle-yaml-mode=${this._toggleYamlMode}
|
||||||
@close-sidebar=${this._handleCloseSidebar}
|
@close-sidebar=${this.triggerCloseSidebar}
|
||||||
></ha-automation-sidebar-condition>
|
></ha-automation-sidebar-condition>
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
@@ -87,7 +87,7 @@ export default class HaAutomationSidebar extends LitElement {
|
|||||||
.yamlMode=${this._yamlMode}
|
.yamlMode=${this._yamlMode}
|
||||||
.sidebarKey=${this.sidebarKey}
|
.sidebarKey=${this.sidebarKey}
|
||||||
@toggle-yaml-mode=${this._toggleYamlMode}
|
@toggle-yaml-mode=${this._toggleYamlMode}
|
||||||
@close-sidebar=${this._handleCloseSidebar}
|
@close-sidebar=${this.triggerCloseSidebar}
|
||||||
></ha-automation-sidebar-action>
|
></ha-automation-sidebar-action>
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
@@ -100,7 +100,7 @@ export default class HaAutomationSidebar extends LitElement {
|
|||||||
.isWide=${this.isWide}
|
.isWide=${this.isWide}
|
||||||
.narrow=${this.narrow}
|
.narrow=${this.narrow}
|
||||||
.disabled=${this.disabled}
|
.disabled=${this.disabled}
|
||||||
@close-sidebar=${this._handleCloseSidebar}
|
@close-sidebar=${this.triggerCloseSidebar}
|
||||||
></ha-automation-sidebar-option>
|
></ha-automation-sidebar-option>
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
@@ -116,7 +116,7 @@ export default class HaAutomationSidebar extends LitElement {
|
|||||||
.yamlMode=${this._yamlMode}
|
.yamlMode=${this._yamlMode}
|
||||||
.sidebarKey=${this.sidebarKey}
|
.sidebarKey=${this.sidebarKey}
|
||||||
@toggle-yaml-mode=${this._toggleYamlMode}
|
@toggle-yaml-mode=${this._toggleYamlMode}
|
||||||
@close-sidebar=${this._handleCloseSidebar}
|
@close-sidebar=${this.triggerCloseSidebar}
|
||||||
></ha-automation-sidebar-script-field-selector>
|
></ha-automation-sidebar-script-field-selector>
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
@@ -132,7 +132,7 @@ export default class HaAutomationSidebar extends LitElement {
|
|||||||
.yamlMode=${this._yamlMode}
|
.yamlMode=${this._yamlMode}
|
||||||
.sidebarKey=${this.sidebarKey}
|
.sidebarKey=${this.sidebarKey}
|
||||||
@toggle-yaml-mode=${this._toggleYamlMode}
|
@toggle-yaml-mode=${this._toggleYamlMode}
|
||||||
@close-sidebar=${this._handleCloseSidebar}
|
@close-sidebar=${this.triggerCloseSidebar}
|
||||||
></ha-automation-sidebar-script-field>
|
></ha-automation-sidebar-script-field>
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
@@ -188,8 +188,8 @@ export default class HaAutomationSidebar extends LitElement {
|
|||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
private _handleCloseSidebar(ev: CustomEvent) {
|
public triggerCloseSidebar(ev?: CustomEvent) {
|
||||||
ev.stopPropagation();
|
ev?.stopPropagation();
|
||||||
if (this.narrow) {
|
if (this.narrow) {
|
||||||
this._bottomSheetElement?.closeSheet();
|
this._bottomSheetElement?.closeSheet();
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -166,7 +166,7 @@ export class HaManualAutomationEditor extends LitElement {
|
|||||||
.disabled=${this.disabled || this.saving}
|
.disabled=${this.disabled || this.saving}
|
||||||
.narrow=${this.narrow}
|
.narrow=${this.narrow}
|
||||||
@open-sidebar=${this._openSidebar}
|
@open-sidebar=${this._openSidebar}
|
||||||
@request-close-sidebar=${this._closeSidebar}
|
@request-close-sidebar=${this._triggerCloseSidebar}
|
||||||
@close-sidebar=${this._handleCloseSidebar}
|
@close-sidebar=${this._handleCloseSidebar}
|
||||||
root
|
root
|
||||||
sidebar
|
sidebar
|
||||||
@@ -213,7 +213,7 @@ export class HaManualAutomationEditor extends LitElement {
|
|||||||
.disabled=${this.disabled || this.saving}
|
.disabled=${this.disabled || this.saving}
|
||||||
.narrow=${this.narrow}
|
.narrow=${this.narrow}
|
||||||
@open-sidebar=${this._openSidebar}
|
@open-sidebar=${this._openSidebar}
|
||||||
@request-close-sidebar=${this._closeSidebar}
|
@request-close-sidebar=${this._triggerCloseSidebar}
|
||||||
@close-sidebar=${this._handleCloseSidebar}
|
@close-sidebar=${this._handleCloseSidebar}
|
||||||
root
|
root
|
||||||
sidebar
|
sidebar
|
||||||
@@ -255,7 +255,7 @@ export class HaManualAutomationEditor extends LitElement {
|
|||||||
.highlightedActions=${this._pastedConfig?.actions || []}
|
.highlightedActions=${this._pastedConfig?.actions || []}
|
||||||
@value-changed=${this._actionChanged}
|
@value-changed=${this._actionChanged}
|
||||||
@open-sidebar=${this._openSidebar}
|
@open-sidebar=${this._openSidebar}
|
||||||
@request-close-sidebar=${this._closeSidebar}
|
@request-close-sidebar=${this._triggerCloseSidebar}
|
||||||
@close-sidebar=${this._handleCloseSidebar}
|
@close-sidebar=${this._handleCloseSidebar}
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
.narrow=${this.narrow}
|
.narrow=${this.narrow}
|
||||||
@@ -351,8 +351,12 @@ export class HaManualAutomationEditor extends LitElement {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private _closeSidebar() {
|
private _triggerCloseSidebar() {
|
||||||
if (this._sidebarConfig) {
|
if (this._sidebarConfig) {
|
||||||
|
if (this._sidebarElement) {
|
||||||
|
this._sidebarElement.triggerCloseSidebar();
|
||||||
|
return;
|
||||||
|
}
|
||||||
this._sidebarConfig?.close();
|
this._sidebarConfig?.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -389,7 +393,7 @@ export class HaManualAutomationEditor extends LitElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private _saveAutomation() {
|
private _saveAutomation() {
|
||||||
this._closeSidebar();
|
this._triggerCloseSidebar();
|
||||||
fireEvent(this, "save-automation");
|
fireEvent(this, "save-automation");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -381,8 +381,7 @@ export default class HaAutomationOptionRow extends LitElement {
|
|||||||
ev?.stopPropagation();
|
ev?.stopPropagation();
|
||||||
|
|
||||||
if (this._selected) {
|
if (this._selected) {
|
||||||
this._selected = false;
|
fireEvent(this, "request-close-sidebar");
|
||||||
fireEvent(this, "close-sidebar");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.openSidebar();
|
this.openSidebar();
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ import { preventDefaultStopPropagation } from "../../../../common/dom/prevent_de
|
|||||||
import { stopPropagation } from "../../../../common/dom/stop_propagation";
|
import { stopPropagation } from "../../../../common/dom/stop_propagation";
|
||||||
import { capitalizeFirstLetter } from "../../../../common/string/capitalize-first-letter";
|
import { capitalizeFirstLetter } from "../../../../common/string/capitalize-first-letter";
|
||||||
import { handleStructError } from "../../../../common/structs/handle-errors";
|
import { handleStructError } from "../../../../common/structs/handle-errors";
|
||||||
|
import { copyToClipboard } from "../../../../common/util/copy-clipboard";
|
||||||
import { debounce } from "../../../../common/util/debounce";
|
import { debounce } from "../../../../common/util/debounce";
|
||||||
import "../../../../components/ha-alert";
|
import "../../../../components/ha-alert";
|
||||||
import "../../../../components/ha-automation-row";
|
import "../../../../components/ha-automation-row";
|
||||||
@@ -75,7 +76,6 @@ import "./types/ha-automation-trigger-time";
|
|||||||
import "./types/ha-automation-trigger-time_pattern";
|
import "./types/ha-automation-trigger-time_pattern";
|
||||||
import "./types/ha-automation-trigger-webhook";
|
import "./types/ha-automation-trigger-webhook";
|
||||||
import "./types/ha-automation-trigger-zone";
|
import "./types/ha-automation-trigger-zone";
|
||||||
import { copyToClipboard } from "../../../../common/util/copy-clipboard";
|
|
||||||
|
|
||||||
export interface TriggerElement extends LitElement {
|
export interface TriggerElement extends LitElement {
|
||||||
trigger: Trigger;
|
trigger: Trigger;
|
||||||
@@ -482,8 +482,7 @@ export default class HaAutomationTriggerRow extends LitElement {
|
|||||||
ev?.stopPropagation();
|
ev?.stopPropagation();
|
||||||
|
|
||||||
if (this._selected) {
|
if (this._selected) {
|
||||||
this._selected = false;
|
fireEvent(this, "request-close-sidebar");
|
||||||
fireEvent(this, "close-sidebar");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.openSidebar();
|
this.openSidebar();
|
||||||
|
|||||||
@@ -162,8 +162,7 @@ export default class HaScriptFieldRow extends LitElement {
|
|||||||
ev?.stopPropagation();
|
ev?.stopPropagation();
|
||||||
|
|
||||||
if (this._selected) {
|
if (this._selected) {
|
||||||
this._selected = false;
|
fireEvent(this, "request-close-sidebar");
|
||||||
fireEvent(this, "close-sidebar");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -176,8 +175,7 @@ export default class HaScriptFieldRow extends LitElement {
|
|||||||
ev?.stopPropagation();
|
ev?.stopPropagation();
|
||||||
|
|
||||||
if (this._selectorRowSelected) {
|
if (this._selectorRowSelected) {
|
||||||
this._selectorRowSelected = false;
|
fireEvent(this, "request-close-sidebar");
|
||||||
fireEvent(this, "close-sidebar");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -170,6 +170,7 @@ export class HaManualScriptEditor extends LitElement {
|
|||||||
.disabled=${this.disabled}
|
.disabled=${this.disabled}
|
||||||
.narrow=${this.narrow}
|
.narrow=${this.narrow}
|
||||||
@open-sidebar=${this._openSidebar}
|
@open-sidebar=${this._openSidebar}
|
||||||
|
@request-close-sidebar=${this._triggerCloseSidebar}
|
||||||
@close-sidebar=${this._handleCloseSidebar}
|
@close-sidebar=${this._handleCloseSidebar}
|
||||||
></ha-script-fields>`
|
></ha-script-fields>`
|
||||||
: nothing
|
: nothing
|
||||||
@@ -200,6 +201,7 @@ export class HaManualScriptEditor extends LitElement {
|
|||||||
.highlightedActions=${this._pastedConfig?.sequence || []}
|
.highlightedActions=${this._pastedConfig?.sequence || []}
|
||||||
@value-changed=${this._sequenceChanged}
|
@value-changed=${this._sequenceChanged}
|
||||||
@open-sidebar=${this._openSidebar}
|
@open-sidebar=${this._openSidebar}
|
||||||
|
@request-close-sidebar=${this._triggerCloseSidebar}
|
||||||
@close-sidebar=${this._handleCloseSidebar}
|
@close-sidebar=${this._handleCloseSidebar}
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
.narrow=${this.narrow}
|
.narrow=${this.narrow}
|
||||||
@@ -506,11 +508,13 @@ export class HaManualScriptEditor extends LitElement {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private _closeSidebar() {
|
private _triggerCloseSidebar() {
|
||||||
if (this._sidebarConfig) {
|
if (this._sidebarConfig) {
|
||||||
const closeRow = this._sidebarConfig?.close;
|
if (this._sidebarElement) {
|
||||||
this._sidebarConfig = undefined;
|
this._sidebarElement.triggerCloseSidebar();
|
||||||
closeRow?.();
|
return;
|
||||||
|
}
|
||||||
|
this._sidebarConfig?.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -519,7 +523,7 @@ export class HaManualScriptEditor extends LitElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private _saveScript() {
|
private _saveScript() {
|
||||||
this._closeSidebar();
|
this._triggerCloseSidebar();
|
||||||
fireEvent(this, "save-script");
|
fireEvent(this, "save-script");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user