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
enh(NcInputField): Support numeric values - if numeric also emit numeric #4926
Conversation
b6d88ac
to
68abfbb
Compare
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.
Fine by me, but feels like reimplementing functionality that already exists in v9 because of Vue 3
If the type is set to number and a number is passed as value also emit a number instead of a string. Co-authored-by: Grigorii K. Shartsev <me@shgk.me> Co-authored-by: Ferdinand Thiessen <opensource@fthiessen.de> Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
68abfbb
to
a41711a
Compare
Well then remove with v9 and vue 3 :) |
@@ -53,7 +53,7 @@ For a list of all available props and attributes, please check the [HTMLInputEle | |||
'input-field__input--error': error, | |||
'input-field__input--pill': pill, | |||
}]" | |||
:value="value" | |||
:value="value.toString()" | |||
v-on="$listeners" | |||
@input="handleInput"> |
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.
Just to raise awareness (as i spend quite a time to understand it 🙈):
- TextField don't listen for
@update:value
, but for@input
- As it wasn't modified by this PR, TextField always emits a string
Is it expected? As InputField is marked as internal component, we usually avoid to use it directly in the app
What should we do?
- update vue-lib docs, and 'allow' to use InputField?
- expand PR changes to TextField? (not sure about rest wrappers)
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.
Basically a lot of apps use NcInputField because of the button limitations (NcTextField does not allow any kind of trailing button).
☑️ Resolves
If the type is set to number and a number is passed as value also emit a number instead of a string.
It always bugs me that you have to write wrappers otherwise, example:
vs with this:
🏁 Checklist