forked from home-assistant/frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Convert zwave-values to ts & add translation strings (home-assistant#…
…3367) * Convert zwave-values to ts & add translation strings * lint * Change some common translation strings to live under "common" instead of "values" * Cleanup & address review comments
- Loading branch information
Showing
4 changed files
with
137 additions
and
121 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
import "@polymer/paper-dropdown-menu/paper-dropdown-menu"; | ||
import "@polymer/paper-item/paper-item"; | ||
import "@polymer/paper-listbox/paper-listbox"; | ||
|
||
import { | ||
css, | ||
CSSResult, | ||
customElement, | ||
html, | ||
LitElement, | ||
property, | ||
TemplateResult, | ||
} from "lit-element"; | ||
|
||
import { haStyle } from "../../../resources/styles"; | ||
import { HomeAssistant } from "../../../types"; | ||
|
||
import "../../../components/buttons/ha-call-service-button"; | ||
import "../../../components/ha-card"; | ||
|
||
import { ZWaveValue } from "../../../data/zwave"; | ||
|
||
@customElement("zwave-values") | ||
export class ZwaveValues extends LitElement { | ||
@property() public hass!: HomeAssistant; | ||
@property() private _values: ZWaveValue[] = []; | ||
@property() private _selectedValue: number = -1; | ||
|
||
protected render(): TemplateResult | void { | ||
return html` | ||
<div class="content"> | ||
<ha-card | ||
.header=${this.hass.localize("ui.panel.config.zwave.values.header")} | ||
> | ||
<div class="device-picker"> | ||
<paper-dropdown-menu | ||
label=${this.hass.localize("ui.panel.config.zwave.common.value")} | ||
dynamic-align | ||
class="flex" | ||
> | ||
<paper-listbox | ||
slot="dropdown-content" | ||
.selected=${this._selectedValue} | ||
> | ||
${this._values.map( | ||
(item) => html` | ||
<paper-item | ||
>${item.label} | ||
(${this.hass.localize( | ||
"ui.panel.config.zwave.common.instance" | ||
)}: | ||
${item.instance}, | ||
${this.hass.localize( | ||
"ui.panel.config.zwave.common.index" | ||
)}: | ||
${item.index})</paper-item | ||
> | ||
` | ||
)} | ||
</paper-listbox> | ||
</paper-dropdown-menu> | ||
</div> | ||
</ha-card> | ||
</div> | ||
`; | ||
} | ||
|
||
static get styles(): CSSResult[] { | ||
return [ | ||
haStyle, | ||
css` | ||
.content { | ||
margin-top: 24px; | ||
} | ||
ha-card { | ||
margin: 0 auto; | ||
max-width: 600px; | ||
} | ||
.device-picker { | ||
@apply --layout-horizontal; | ||
@apply --layout-center-center; | ||
display: -ms-flexbox; | ||
display: -webkit-flex; | ||
display: flex; | ||
-ms-flex-direction: row; | ||
-webkit-flex-direction: row; | ||
flex-direction: row; | ||
-ms-flex-align: center; | ||
-webkit-align-items: center; | ||
align-items: center; | ||
padding-left: 24px; | ||
padding-right: 24px; | ||
padding-bottom: 24px; | ||
} | ||
.flex { | ||
-ms-flex: 1 1 0.000000001px; | ||
-webkit-flex: 1; | ||
flex: 1; | ||
-webkit-flex-basis: 0.000000001px; | ||
flex-basis: 0.000000001px; | ||
} | ||
.help-text { | ||
padding-left: 24px; | ||
padding-right: 24px; | ||
} | ||
`, | ||
]; | ||
} | ||
} | ||
|
||
declare global { | ||
interface HTMLElementTagNameMap { | ||
"zwave-values": ZwaveValues; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters