mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-25 18:26:35 +00:00
open option for lock (#14852)
Co-authored-by: Bram Kragten <mail@bramkragten.nl>
This commit is contained in:
parent
9b35c06eef
commit
3d6cfc4037
@ -3,8 +3,10 @@ import "@polymer/iron-flex-layout/iron-flex-layout-classes";
|
|||||||
import { html } from "@polymer/polymer/lib/utils/html-tag";
|
import { html } from "@polymer/polymer/lib/utils/html-tag";
|
||||||
/* eslint-plugin-disable lit */
|
/* eslint-plugin-disable lit */
|
||||||
import { PolymerElement } from "@polymer/polymer/polymer-element";
|
import { PolymerElement } from "@polymer/polymer/polymer-element";
|
||||||
|
import { supportsFeature } from "../common/entity/supports-feature";
|
||||||
import "../components/entity/state-info";
|
import "../components/entity/state-info";
|
||||||
import LocalizeMixin from "../mixins/localize-mixin";
|
import LocalizeMixin from "../mixins/localize-mixin";
|
||||||
|
import { LockEntityFeature } from "../data/lock";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @appliesMixin LocalizeMixin
|
* @appliesMixin LocalizeMixin
|
||||||
@ -19,10 +21,19 @@ class StateCardLock extends LocalizeMixin(PolymerElement) {
|
|||||||
height: 37px;
|
height: 37px;
|
||||||
margin-right: -0.57em;
|
margin-right: -0.57em;
|
||||||
}
|
}
|
||||||
|
[hidden] {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<div class="horizontal justified layout">
|
<div class="horizontal justified layout">
|
||||||
${this.stateInfoTemplate}
|
${this.stateInfoTemplate}
|
||||||
|
<mwc-button
|
||||||
|
on-click="_callService"
|
||||||
|
data-service="open"
|
||||||
|
hidden$="[[!supportsOpen]]"
|
||||||
|
>[[localize('ui.card.lock.open')]]</mwc-button
|
||||||
|
>
|
||||||
<mwc-button
|
<mwc-button
|
||||||
on-click="_callService"
|
on-click="_callService"
|
||||||
data-service="unlock"
|
data-service="unlock"
|
||||||
@ -61,12 +72,14 @@ class StateCardLock extends LocalizeMixin(PolymerElement) {
|
|||||||
value: false,
|
value: false,
|
||||||
},
|
},
|
||||||
isLocked: Boolean,
|
isLocked: Boolean,
|
||||||
|
supportsOpen: Boolean,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
_stateObjChanged(newVal) {
|
_stateObjChanged(newVal) {
|
||||||
if (newVal) {
|
if (newVal) {
|
||||||
this.isLocked = newVal.state === "locked";
|
this.isLocked = newVal.state === "locked";
|
||||||
|
this.supportsOpen = supportsFeature(newVal, LockEntityFeature.OPEN);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -147,7 +147,8 @@
|
|||||||
"lock": {
|
"lock": {
|
||||||
"code": "[%key:ui::card::alarm_control_panel::code%]",
|
"code": "[%key:ui::card::alarm_control_panel::code%]",
|
||||||
"lock": "Lock",
|
"lock": "Lock",
|
||||||
"unlock": "Unlock"
|
"unlock": "Unlock",
|
||||||
|
"open": "Open"
|
||||||
},
|
},
|
||||||
"media_player": {
|
"media_player": {
|
||||||
"source": "Source",
|
"source": "Source",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user