mirror of
https://github.com/home-assistant/frontend.git
synced 2025-04-19 10:57:19 +00:00
Add not displayed info for feature in inline mode
This commit is contained in:
parent
3a1d371b0b
commit
7781401b41
@ -203,6 +203,9 @@ export class HuiCardFeaturesEditor extends LitElement {
|
||||
@property({ attribute: false })
|
||||
public featuresTypes?: FeatureType[];
|
||||
|
||||
@property({ type: Number, attribute: "max-feature-count" })
|
||||
public maxFeaturesCount?: number;
|
||||
|
||||
@property()
|
||||
public label?: string;
|
||||
|
||||
@ -280,6 +283,10 @@ export class HuiCardFeaturesEditor extends LitElement {
|
||||
const type = featureConf.type;
|
||||
const supported = this._supportsFeatureType(type);
|
||||
const editable = this._isFeatureTypeEditable(type);
|
||||
const hidden =
|
||||
this.maxFeaturesCount !== undefined &&
|
||||
index >= this.maxFeaturesCount;
|
||||
|
||||
return html`
|
||||
<div class="feature">
|
||||
<div class="handle">
|
||||
@ -296,7 +303,15 @@ export class HuiCardFeaturesEditor extends LitElement {
|
||||
)}
|
||||
</span>
|
||||
`
|
||||
: nothing}
|
||||
: hidden
|
||||
? html`
|
||||
<span class="secondary">
|
||||
${this.hass!.localize(
|
||||
"ui.panel.lovelace.editor.features.not_displayed"
|
||||
)}
|
||||
</span>
|
||||
`
|
||||
: nothing}
|
||||
</div>
|
||||
</div>
|
||||
${editable
|
||||
|
@ -300,6 +300,9 @@ export class HuiTileCardEditor
|
||||
const hasCompatibleFeatures =
|
||||
(stateObj && this._hasCompatibleFeatures(stateObj)) || false;
|
||||
|
||||
const maxFeaturesCount =
|
||||
this._config.features_position === "inline" ? 1 : undefined;
|
||||
|
||||
return html`
|
||||
<ha-form
|
||||
.hass=${this.hass}
|
||||
@ -334,6 +337,7 @@ export class HuiTileCardEditor
|
||||
.hass=${this.hass}
|
||||
.stateObj=${stateObj}
|
||||
.features=${this._config!.features ?? []}
|
||||
.maxFeaturesCount=${maxFeaturesCount}
|
||||
@features-changed=${this._featuresChanged}
|
||||
@edit-detail-element=${this._editDetailElement}
|
||||
></hui-card-features-editor>
|
||||
|
@ -7259,6 +7259,7 @@
|
||||
"features": {
|
||||
"name": "Features",
|
||||
"not_compatible": "Not compatible",
|
||||
"not_displayed": "Not displayed",
|
||||
"no_compatible_available": "No compatible features available for this entity",
|
||||
"add": "Add feature",
|
||||
"edit": "Edit feature",
|
||||
|
Loading…
x
Reference in New Issue
Block a user