Don't use the word column in section view (#21834)

This commit is contained in:
Paul Bottein 2024-08-29 15:30:25 +02:00 committed by GitHub
parent 1c9d411d3a
commit 362a6f46fe
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 13 deletions

View File

@ -2,7 +2,6 @@ import { LitElement, html } from "lit";
import { customElement, property } from "lit/decorators"; import { customElement, property } from "lit/decorators";
import memoizeOne from "memoize-one"; import memoizeOne from "memoize-one";
import { fireEvent } from "../../../../common/dom/fire_event"; import { fireEvent } from "../../../../common/dom/fire_event";
import { LocalizeFunc } from "../../../../common/translations/localize";
import { import {
HaFormSchema, HaFormSchema,
SchemaUnion, SchemaUnion,
@ -25,7 +24,7 @@ export class HuiDialogEditSection extends LitElement {
@property({ attribute: false }) public viewConfig!: LovelaceViewConfig; @property({ attribute: false }) public viewConfig!: LovelaceViewConfig;
private _schema = memoizeOne( private _schema = memoizeOne(
(localize: LocalizeFunc, maxColumns: number) => (maxColumns: number) =>
[ [
{ {
name: "title", name: "title",
@ -37,9 +36,6 @@ export class HuiDialogEditSection extends LitElement {
number: { number: {
min: 1, min: 1,
max: maxColumns, max: maxColumns,
unit_of_measurement: localize(
`ui.panel.lovelace.editor.edit_section.settings.column_span_unit`
),
}, },
}, },
}, },
@ -52,10 +48,7 @@ export class HuiDialogEditSection extends LitElement {
column_span: this.config.column_span || 1, column_span: this.config.column_span || 1,
}; };
const schema = this._schema( const schema = this._schema(this.viewConfig.max_columns || 4);
this.hass.localize,
this.viewConfig.max_columns || 4
);
return html` return html`
<ha-form <ha-form

View File

@ -5549,7 +5549,7 @@
"sections": "Sections (experimental)" "sections": "Sections (experimental)"
}, },
"subview": "Subview", "subview": "Subview",
"max_columns": "Max number of columns", "max_columns": "Max number of sections wide",
"subview_helper": "Subviews don't appear in tabs and have a back button.", "subview_helper": "Subviews don't appear in tabs and have a back button.",
"edit_ui": "Edit in visual editor", "edit_ui": "Edit in visual editor",
"edit_yaml": "Edit in YAML", "edit_yaml": "Edit in YAML",
@ -5665,9 +5665,8 @@
"settings": { "settings": {
"title": "Title", "title": "Title",
"title_helper": "The title will appear at the top of section. Leave empty to hide the title.", "title_helper": "The title will appear at the top of section. Leave empty to hide the title.",
"column_span": "Size", "column_span": "Width",
"column_span_unit": "columns", "column_span_helper": "Larger sections will be made smaller to fit the display. (e.g. on mobile devices)"
"column_span_helper": "The size may be smaller if less columns are displayed (e.g. on mobile devices)."
}, },
"visibility": { "visibility": {
"explanation": "The section will be shown when ALL conditions below are fulfilled. If no conditions are set, the section will always be shown." "explanation": "The section will be shown when ALL conditions below are fulfilled. If no conditions are set, the section will always be shown."