mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-24 09:46:36 +00:00
Show position on sidebar card and hide arrow on panel card (#17092)
This commit is contained in:
parent
6cc207752f
commit
77d24f4129
@ -46,7 +46,7 @@ export class HuiCardOptions extends LitElement {
|
||||
|
||||
@queryAssignedNodes() private _assignedNodes?: NodeListOf<LovelaceCard>;
|
||||
|
||||
@property({ type: Boolean }) public showPosition = false;
|
||||
@property({ type: Boolean }) public hidePosition = false;
|
||||
|
||||
@storage({
|
||||
key: "lovelaceClipboard",
|
||||
@ -82,36 +82,38 @@ export class HuiCardOptions extends LitElement {
|
||||
>
|
||||
<div class="right">
|
||||
<slot name="buttons"></slot>
|
||||
<ha-icon-button
|
||||
.label=${this.hass!.localize(
|
||||
"ui.panel.lovelace.editor.edit_card.move_down"
|
||||
)}
|
||||
.path=${mdiArrowDown}
|
||||
class="move-arrow"
|
||||
@click=${this._cardDown}
|
||||
.disabled=${this.lovelace!.config.views[this.path![0]].cards!
|
||||
.length ===
|
||||
this.path![1] + 1}
|
||||
></ha-icon-button>
|
||||
${this.showPosition
|
||||
? html`<ha-icon-button
|
||||
@click=${this._changeCardPosition}
|
||||
.label=${this.hass!.localize(
|
||||
"ui.panel.lovelace.editor.edit_card.change_position"
|
||||
)}
|
||||
>
|
||||
<div class="position-badge">${this.path![1] + 1}</div>
|
||||
</ha-icon-button>`
|
||||
${!this.hidePosition
|
||||
? html`
|
||||
<ha-icon-button
|
||||
.label=${this.hass!.localize(
|
||||
"ui.panel.lovelace.editor.edit_card.move_down"
|
||||
)}
|
||||
.path=${mdiArrowDown}
|
||||
class="move-arrow"
|
||||
@click=${this._cardDown}
|
||||
.disabled=${this.lovelace!.config.views[this.path![0]]
|
||||
.cards!.length ===
|
||||
this.path![1] + 1}
|
||||
></ha-icon-button>
|
||||
<ha-icon-button
|
||||
@click=${this._changeCardPosition}
|
||||
.label=${this.hass!.localize(
|
||||
"ui.panel.lovelace.editor.edit_card.change_position"
|
||||
)}
|
||||
>
|
||||
<div class="position-badge">${this.path![1] + 1}</div>
|
||||
</ha-icon-button>
|
||||
<ha-icon-button
|
||||
.label=${this.hass!.localize(
|
||||
"ui.panel.lovelace.editor.edit_card.move_up"
|
||||
)}
|
||||
.path=${mdiArrowUp}
|
||||
class="move-arrow"
|
||||
@click=${this._cardUp}
|
||||
?disabled=${this.path![1] === 0}
|
||||
></ha-icon-button>
|
||||
`
|
||||
: nothing}
|
||||
<ha-icon-button
|
||||
.label=${this.hass!.localize(
|
||||
"ui.panel.lovelace.editor.edit_card.move_up"
|
||||
)}
|
||||
.path=${mdiArrowUp}
|
||||
class="move-arrow"
|
||||
@click=${this._cardUp}
|
||||
?disabled=${this.path![1] === 0}
|
||||
></ha-icon-button>
|
||||
<ha-button-menu @action=${this._handleAction}>
|
||||
<ha-icon-button
|
||||
slot="trigger"
|
||||
|
@ -272,7 +272,6 @@ export class MasonryView extends LitElement implements LovelaceViewElement {
|
||||
wrapper.hass = this.hass;
|
||||
wrapper.lovelace = this.lovelace;
|
||||
wrapper.path = [this.index!, index];
|
||||
wrapper.showPosition = true;
|
||||
card.editMode = true;
|
||||
wrapper.appendChild(card);
|
||||
columnEl.appendChild(wrapper);
|
||||
|
@ -121,6 +121,7 @@ export class PanelView extends LitElement implements LovelaceViewElement {
|
||||
wrapper.hass = this.hass;
|
||||
wrapper.lovelace = this.lovelace;
|
||||
wrapper.path = [this.index!, 0];
|
||||
wrapper.hidePosition = true;
|
||||
card.editMode = true;
|
||||
wrapper.appendChild(card);
|
||||
this._card = wrapper;
|
||||
|
Loading…
x
Reference in New Issue
Block a user