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