Some data table fixes (#20286)

This commit is contained in:
Bram Kragten 2024-03-30 21:11:35 +01:00 committed by GitHub
parent 503a7979d0
commit 7e3e224746
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 55 additions and 5 deletions

View File

@ -142,9 +142,12 @@ class HassSubpage extends LitElement {
right: calc(16px + env(safe-area-inset-right)); right: calc(16px + env(safe-area-inset-right));
inset-inline-end: calc(16px + env(safe-area-inset-right)); inset-inline-end: calc(16px + env(safe-area-inset-right));
inset-inline-start: initial; inset-inline-start: initial;
bottom: calc(16px + env(safe-area-inset-bottom)); bottom: calc(16px + env(safe-area-inset-bottom));
z-index: 1; z-index: 1;
display: flex;
flex-wrap: wrap;
justify-content: flex-end;
gap: 8px;
} }
:host([narrow]) #fab.tabs { :host([narrow]) #fab.tabs {
bottom: calc(84px + env(safe-area-inset-bottom)); bottom: calc(84px + env(safe-area-inset-bottom));

View File

@ -8,7 +8,7 @@ import {
mdiArrowDown, mdiArrowDown,
mdiArrowUp, mdiArrowUp,
mdiClose, mdiClose,
mdiFilterRemove, mdiFilterVariantRemove,
mdiFilterVariant, mdiFilterVariant,
mdiFormatListChecks, mdiFormatListChecks,
mdiMenuDown, mdiMenuDown,
@ -227,6 +227,9 @@ export class HaTabsSubpageDataTable extends LitElement {
class="has-dropdown select-mode-chip" class="has-dropdown select-mode-chip"
.active=${this._selectMode} .active=${this._selectMode}
@click=${this._enableSelectMode} @click=${this._enableSelectMode}
.label=${localize(
"ui.components.subpage-data-table.enter_selection_mode"
)}
> >
<ha-svg-icon slot="icon" .path=${mdiFormatListChecks}></ha-svg-icon> <ha-svg-icon slot="icon" .path=${mdiFormatListChecks}></ha-svg-icon>
</ha-assist-chip>` </ha-assist-chip>`
@ -294,6 +297,9 @@ export class HaTabsSubpageDataTable extends LitElement {
<ha-icon-button <ha-icon-button
.path=${mdiClose} .path=${mdiClose}
@click=${this._disableSelectMode} @click=${this._disableSelectMode}
.label=${localize(
"ui.components.subpage-data-table.exit_selection_mode"
)}
></ha-icon-button> ></ha-icon-button>
<p> <p>
${localize("ui.components.subpage-data-table.selected", { ${localize("ui.components.subpage-data-table.selected", {
@ -318,6 +324,9 @@ export class HaTabsSubpageDataTable extends LitElement {
slot="navigationIcon" slot="navigationIcon"
.path=${mdiClose} .path=${mdiClose}
@click=${this._toggleFilters} @click=${this._toggleFilters}
.label=${localize(
"ui.components.subpage-data-table.close_filter"
)}
></ha-icon-button> ></ha-icon-button>
<span slot="title" <span slot="title"
>${localize( >${localize(
@ -326,7 +335,11 @@ export class HaTabsSubpageDataTable extends LitElement {
> >
<ha-icon-button <ha-icon-button
slot="actionItems" slot="actionItems"
.path=${mdiFilterRemove} @click=${this._clearFilters}
.path=${mdiFilterVariantRemove}
.label=${localize(
"ui.components.subpage-data-table.clear_filter"
)}
></ha-icon-button> ></ha-icon-button>
</ha-dialog-header> </ha-dialog-header>
<div class="filter-dialog-content"> <div class="filter-dialog-content">
@ -347,8 +360,11 @@ export class HaTabsSubpageDataTable extends LitElement {
></ha-svg-icon> ></ha-svg-icon>
</ha-assist-chip> </ha-assist-chip>
<ha-icon-button <ha-icon-button
.path=${mdiFilterRemove} .path=${mdiFilterVariantRemove}
@click=${this._clearFilters} @click=${this._clearFilters}
.label=${localize(
"ui.components.subpage-data-table.clear_filter"
)}
></ha-icon-button> ></ha-icon-button>
</div> </div>
<div class="pane-content"> <div class="pane-content">

View File

@ -344,6 +344,10 @@ class HassTabsSubpage extends LitElement {
inset-inline-start: initial; inset-inline-start: initial;
bottom: calc(16px + env(safe-area-inset-bottom)); bottom: calc(16px + env(safe-area-inset-bottom));
z-index: 1; z-index: 1;
display: flex;
flex-wrap: wrap;
justify-content: flex-end;
gap: 8px;
} }
:host([narrow]) #fab.tabs { :host([narrow]) #fab.tabs {
bottom: calc(84px + env(safe-area-inset-bottom)); bottom: calc(84px + env(safe-area-inset-bottom));

View File

@ -424,7 +424,6 @@ export class HaConfigAreasDashboard extends SubscribeMixin(LitElement) {
} }
.floor { .floor {
--primary-color: var(--secondary-text-color); --primary-color: var(--secondary-text-color);
margin-inline-end: 8px;
} }
.warning { .warning {
color: var(--error-color); color: var(--error-color);

View File

@ -1,6 +1,7 @@
import { consume } from "@lit-labs/context"; import { consume } from "@lit-labs/context";
import "@lrnwebcomponents/simple-tooltip/simple-tooltip"; import "@lrnwebcomponents/simple-tooltip/simple-tooltip";
import { import {
mdiCog,
mdiContentDuplicate, mdiContentDuplicate,
mdiDelete, mdiDelete,
mdiHelpCircle, mdiHelpCircle,
@ -287,6 +288,13 @@ class HaAutomationPicker extends SubscribeMixin(LitElement) {
), ),
action: () => this._showInfo(automation), action: () => this._showInfo(automation),
}, },
{
path: mdiCog,
label: this.hass.localize(
"ui.panel.config.automation.picker.show_settings"
),
action: () => this._showSettings(automation),
},
{ {
path: mdiTag, path: mdiTag,
label: this.hass.localize( label: this.hass.localize(
@ -637,6 +645,13 @@ class HaAutomationPicker extends SubscribeMixin(LitElement) {
fireEvent(this, "hass-more-info", { entityId: automation.entity_id }); fireEvent(this, "hass-more-info", { entityId: automation.entity_id });
} }
private _showSettings(automation: any) {
fireEvent(this, "hass-more-info", {
entityId: automation.entity_id,
view: "settings",
});
}
private _runActions(automation: any) { private _runActions(automation: any) {
triggerAutomationActions(this.hass, automation.entity_id); triggerAutomationActions(this.hass, automation.entity_id);
} }

View File

@ -49,11 +49,19 @@ class DialogLabelDetail
this._icon = ""; this._icon = "";
this._color = ""; this._color = "";
} }
document.body.addEventListener("keydown", this._handleKeyPress);
} }
private _handleKeyPress = (ev: KeyboardEvent) => {
if (ev.key === "Escape") {
ev.stopPropagation();
}
};
public closeDialog(): void { public closeDialog(): void {
this._params = undefined; this._params = undefined;
fireEvent(this, "dialog-closed", { dialog: this.localName }); fireEvent(this, "dialog-closed", { dialog: this.localName });
document.body.removeEventListener("keydown", this._handleKeyPress);
} }
protected render() { protected render() {

View File

@ -501,6 +501,10 @@
}, },
"subpage-data-table": { "subpage-data-table": {
"filters": "Filters", "filters": "Filters",
"clear_filter": "Clear filter",
"close_filter": "Close filters",
"exit_selection_mode": "Exit selection mode",
"enter_selection_mode": "Enter selection mode",
"sort_by": "Sort by {sortColumn}", "sort_by": "Sort by {sortColumn}",
"group_by": "Group by {groupColumn}", "group_by": "Group by {groupColumn}",
"dont_group_by": "Don't group", "dont_group_by": "Don't group",
@ -2669,6 +2673,7 @@
"edit_automation": "Edit automation", "edit_automation": "Edit automation",
"dev_automation": "Debug automation", "dev_automation": "Debug automation",
"show_info_automation": "Show info about automation", "show_info_automation": "Show info about automation",
"show_settings": "Show settings",
"delete": "[%key:ui::common::delete%]", "delete": "[%key:ui::common::delete%]",
"delete_confirm_title": "Delete automation?", "delete_confirm_title": "Delete automation?",
"delete_confirm_text": "{name} will be permanently deleted.", "delete_confirm_text": "{name} will be permanently deleted.",