Tweak ha-form (#10194)

This commit is contained in:
Paulus Schoutsen 2021-10-08 08:19:02 -07:00 committed by GitHub
parent 588ee2c3b1
commit ad031d4bda
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 4 deletions

View File

@ -24,6 +24,7 @@ export class HaFormFloat extends LitElement implements HaFormElement {
protected render(): TemplateResult { protected render(): TemplateResult {
return html` return html`
<mwc-textfield <mwc-textfield
inputMode="decimal"
.label=${this.label} .label=${this.label}
.value=${this.data !== undefined ? this.data : ""} .value=${this.data !== undefined ? this.data : ""}
.required=${this.schema.required} .required=${this.schema.required}

View File

@ -63,6 +63,7 @@ export class HaFormInteger extends LitElement implements HaFormElement {
return html` return html`
<mwc-textfield <mwc-textfield
type="number" type="number"
inputMode="numeric"
.label=${this.label} .label=${this.label}
.value=${this.data !== undefined ? this.data : ""} .value=${this.data !== undefined ? this.data : ""}
.required=${this.schema.required} .required=${this.schema.required}

View File

@ -101,8 +101,6 @@ export class HaFormMultiSelect extends LitElement implements HaFormElement {
this.shadowRoot?.querySelector("mwc-textfield") || ({} as any); this.shadowRoot?.querySelector("mwc-textfield") || ({} as any);
if (formElement) { if (formElement) {
formElement.style.textOverflow = "ellipsis"; formElement.style.textOverflow = "ellipsis";
formElement.style.cursor = "pointer";
formElement.setAttribute("readonly", "");
} }
if (mdcRoot) { if (mdcRoot) {
mdcRoot.style.cursor = "pointer"; mdcRoot.style.cursor = "pointer";
@ -162,10 +160,17 @@ export class HaFormMultiSelect extends LitElement implements HaFormElement {
:host([own-margin]) { :host([own-margin]) {
margin-bottom: 5px; margin-bottom: 5px;
} }
ha-button-menu, ha-button-menu {
mwc-textfield, display: block;
cursor: pointer;
}
mwc-formfield { mwc-formfield {
display: block; display: block;
padding-right: 16px;
}
mwc-textfield {
display: block;
pointer-events: none;
} }
ha-svg-icon { ha-svg-icon {
color: var(--input-dropdown-icon-color); color: var(--input-dropdown-icon-color);

View File

@ -119,6 +119,7 @@ export class PaperTimeInput extends PolymerElement {
<paper-input <paper-input
id="hour" id="hour"
type="number" type="number"
inputmode="numeric"
value="{{hour}}" value="{{hour}}"
label="[[hourLabel]]" label="[[hourLabel]]"
on-change="_shouldFormatHour" on-change="_shouldFormatHour"
@ -141,6 +142,7 @@ export class PaperTimeInput extends PolymerElement {
class$="[[_computeClassNames(enableSecond)]]" class$="[[_computeClassNames(enableSecond)]]"
id="min" id="min"
type="number" type="number"
inputmode="numeric"
value="{{min}}" value="{{min}}"
label="[[minLabel]]" label="[[minLabel]]"
on-change="_formatMin" on-change="_formatMin"
@ -163,6 +165,7 @@ export class PaperTimeInput extends PolymerElement {
class$="[[_computeClassNames(enableMillisecond)]]" class$="[[_computeClassNames(enableMillisecond)]]"
id="sec" id="sec"
type="number" type="number"
inputmode="numeric"
value="{{sec}}" value="{{sec}}"
label="[[secLabel]]" label="[[secLabel]]"
on-change="_formatSec" on-change="_formatSec"