New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Convert input-number to Lit/TS #2792
Conversation
Should I worry about width for the state display with slider?
<hui-generic-entity-row | ||
.hass="${this.hass}" | ||
.config="${this._config}" | ||
id="input_number_card" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missed remnant from when width was being calculated
} | ||
|
||
private get _inputElement(): PaperInputElement { | ||
return this.shadowRoot!.getElementById("input") as PaperInputElement; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not always true, as both have an ID set. I would instead just use querySelector('paper-input')
, since we have just one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but only one will ever be rendered, the slider or the box
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh I see what you did there. Both have the same API so it works. I would suggest you just set the type to { value: string }
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't follow
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, you say your return value is a PaperInputElement, but it might be that you are rendering a slider, so that's the wrong type. It only works because the parts of PaperInputElement that you access have the same API as PaperSliderElement. The overlapping part that you care about is { value: string }
, so I suggest that you replace the return value and type casting (as
) to { value: string }
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah that's fine. just add a comment
* clientWidth not currently working * unsure about the typing of _InputElement
Should I worry about width for the state display with slider?
We previously has an IronResize and would hide it if the width went under 350