Skip to content
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

Merged
merged 5 commits into from Feb 22, 2019

Conversation

iantrich
Copy link
Member

@iantrich iantrich commented Feb 19, 2019

Should I worry about width for the state display with slider?

image

We previously has an IronResize and would hide it if the width went under 350

Should I worry about width for the state display with slider?
@ghost ghost assigned iantrich Feb 19, 2019
@ghost ghost added the in progress label Feb 19, 2019
<hui-generic-entity-row
.hass="${this.hass}"
.config="${this._config}"
id="input_number_card"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why?

Copy link
Member Author

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;
Copy link
Member

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.

Copy link
Member Author

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

Copy link
Member

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 }

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't follow

Copy link
Member

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 }

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

This is what linter wants me to do:
image

Copy link
Member

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
@balloob balloob merged commit 6da3110 into home-assistant:dev Feb 22, 2019
@ghost ghost removed the in progress label Feb 22, 2019
@balloob balloob mentioned this pull request Feb 28, 2019
@iantrich iantrich deleted the input-number-typescript branch March 9, 2019 02:52
@github-actions github-actions bot locked and limited conversation to collaborators Jul 7, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants