mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-25 18:26:35 +00:00
Revert "Fix drag and drop when using action and trigger selector" (#22296)
Revert "Fix drag and drop when using action and trigger selector (#22291)" This reverts commit 99035cea8fb2676a14da92434bfebdc6c7cb9c4b.
This commit is contained in:
parent
1f838d7529
commit
67a93013c7
@ -4,7 +4,7 @@ import memoizeOne from "memoize-one";
|
|||||||
import { Action, migrateAutomationAction } from "../../data/script";
|
import { Action, migrateAutomationAction } from "../../data/script";
|
||||||
import { ActionSelector } from "../../data/selector";
|
import { ActionSelector } from "../../data/selector";
|
||||||
import "../../panels/config/automation/action/ha-automation-action";
|
import "../../panels/config/automation/action/ha-automation-action";
|
||||||
import { HomeAssistant, ItemPath } from "../../types";
|
import { HomeAssistant } from "../../types";
|
||||||
|
|
||||||
@customElement("ha-selector-action")
|
@customElement("ha-selector-action")
|
||||||
export class HaActionSelector extends LitElement {
|
export class HaActionSelector extends LitElement {
|
||||||
@ -18,22 +18,19 @@ export class HaActionSelector extends LitElement {
|
|||||||
|
|
||||||
@property({ type: Boolean, reflect: true }) public disabled = false;
|
@property({ type: Boolean, reflect: true }) public disabled = false;
|
||||||
|
|
||||||
// Add path here to ignore memoize if the path changes
|
private _actions = memoizeOne((action: Action | undefined) => {
|
||||||
private _actions = memoizeOne(
|
if (!action) {
|
||||||
(action: Action | undefined, _path?: ItemPath) => {
|
return [];
|
||||||
if (!action) {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
return migrateAutomationAction(action);
|
|
||||||
}
|
}
|
||||||
);
|
return migrateAutomationAction(action);
|
||||||
|
});
|
||||||
|
|
||||||
protected render() {
|
protected render() {
|
||||||
return html`
|
return html`
|
||||||
${this.label ? html`<label>${this.label}</label>` : nothing}
|
${this.label ? html`<label>${this.label}</label>` : nothing}
|
||||||
<ha-automation-action
|
<ha-automation-action
|
||||||
.disabled=${this.disabled}
|
.disabled=${this.disabled}
|
||||||
.actions=${this._actions(this.value, this.selector.action?.path)}
|
.actions=${this._actions(this.value)}
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
.path=${this.selector.action?.path}
|
.path=${this.selector.action?.path}
|
||||||
></ha-automation-action>
|
></ha-automation-action>
|
||||||
|
@ -4,7 +4,7 @@ import memoizeOne from "memoize-one";
|
|||||||
import { migrateAutomationTrigger, Trigger } from "../../data/automation";
|
import { migrateAutomationTrigger, Trigger } from "../../data/automation";
|
||||||
import { TriggerSelector } from "../../data/selector";
|
import { TriggerSelector } from "../../data/selector";
|
||||||
import "../../panels/config/automation/trigger/ha-automation-trigger";
|
import "../../panels/config/automation/trigger/ha-automation-trigger";
|
||||||
import { HomeAssistant, ItemPath } from "../../types";
|
import { HomeAssistant } from "../../types";
|
||||||
|
|
||||||
@customElement("ha-selector-trigger")
|
@customElement("ha-selector-trigger")
|
||||||
export class HaTriggerSelector extends LitElement {
|
export class HaTriggerSelector extends LitElement {
|
||||||
@ -18,22 +18,19 @@ export class HaTriggerSelector extends LitElement {
|
|||||||
|
|
||||||
@property({ type: Boolean, reflect: true }) public disabled = false;
|
@property({ type: Boolean, reflect: true }) public disabled = false;
|
||||||
|
|
||||||
// Add path here to ignore memoize if the path changes
|
private _triggers = memoizeOne((trigger: Trigger | undefined) => {
|
||||||
private _triggers = memoizeOne(
|
if (!trigger) {
|
||||||
(trigger: Trigger | undefined, _path?: ItemPath) => {
|
return [];
|
||||||
if (!trigger) {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
return migrateAutomationTrigger(trigger);
|
|
||||||
}
|
}
|
||||||
);
|
return migrateAutomationTrigger(trigger);
|
||||||
|
});
|
||||||
|
|
||||||
protected render() {
|
protected render() {
|
||||||
return html`
|
return html`
|
||||||
${this.label ? html`<label>${this.label}</label>` : nothing}
|
${this.label ? html`<label>${this.label}</label>` : nothing}
|
||||||
<ha-automation-trigger
|
<ha-automation-trigger
|
||||||
.disabled=${this.disabled}
|
.disabled=${this.disabled}
|
||||||
.triggers=${this._triggers(this.value, this.selector.trigger?.path)}
|
.triggers=${this._triggers(this.value)}
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
.path=${this.selector.trigger?.path}
|
.path=${this.selector.trigger?.path}
|
||||||
></ha-automation-trigger>
|
></ha-automation-trigger>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user