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

feat: add internal has-input-value-changed event #4276

Merged
merged 7 commits into from
Jul 28, 2022

Conversation

yuriy-fix
Copy link
Contributor

@yuriy-fix yuriy-fix commented Jul 28, 2022

Introduce __inputValuePopulated property and input-value-populated-changed event which will be used from the Flow counter-part.
Needed for the cases when value is not synced with the flow counter-part because of type differences. For example, in case of date-picker flow counterpart is not notified about inputing arbitrary string qwerty therefore it cannot be properly validated.

Event is not documented on purpose as intended for internal use.

Related: vaadin/flow-components#3524.

Related vaadin/platform#3066

packages/field-base/src/input-mixin.js Outdated Show resolved Hide resolved
packages/field-base/src/input-mixin.js Outdated Show resolved Hide resolved
packages/field-base/src/input-mixin.js Outdated Show resolved Hide resolved
packages/field-base/test/input-mixin.test.js Outdated Show resolved Hide resolved
packages/field-base/src/input-mixin.d.ts Outdated Show resolved Hide resolved
packages/field-base/src/input-mixin.js Outdated Show resolved Hide resolved
@yuriy-fix yuriy-fix force-pushed the feat/input-value-populated branch from fe0061c to 0b93276 Compare July 28, 2022 07:31
@yuriy-fix yuriy-fix marked this pull request as ready for review July 28, 2022 07:32
* @private
*/
_hasInputValueChanged() {
this.dispatchEvent(new CustomEvent('has-input-value-changed'));
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm wondering if the event should contain the value.. this would allow to let the server parse the value and react differently depending on the value

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We were considering this option.
Conclusion was that parsing logic for the value is already implemented for the component. This is for the cases when the value cannot be parsed, but flow counterpart should still be aware if there is some arbitrary content in the input field. (An example would be qwerty string in date-picker)

Copy link
Contributor

Choose a reason for hiding this comment

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

This reminded me of another feature request, where today would be send to the server in this case and the server can parse it, like it was possible with V8. That why I wanted to mention it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are right, that's a valid point, but that feature should be tackled separately (not in scope of this PR).
Related ticket: vaadin/flow-components#2466

@web-padawan web-padawan changed the title feat: introduce input value populated feat: add internal has-input-value-changed event Jul 28, 2022
packages/field-base/src/input-mixin.js Outdated Show resolved Hide resolved
packages/field-base/src/input-mixin.js Outdated Show resolved Hide resolved
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants