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

fix: (platform) Introduce Checkbox as a Component #2293

Merged
merged 11 commits into from Jun 17, 2020
Merged

Conversation

DeepakSap14
Copy link
Contributor

@DeepakSap14 DeepakSap14 commented Apr 8, 2020

Please provide a link to the associated issue.

#2292

Please provide a brief summary of this pull request.

Created Checkbox component in platform, which works with platform FormFieldControl.
It works fine with Reactive form as well as template driven form.

Please check whether the PR fulfills the following requirements

Documentation checklist:

  • update README.md
  • Documentation Examples
  • Stackblitz works for all examples

Technical specification:
https://github.com/SAP/fundamental-ngx/wiki/Platform:-Checkbox-Component-Technical-Design

@DeepakSap14 DeepakSap14 self-assigned this Apr 8, 2020
@DeepakSap14 DeepakSap14 added the platform platform label Apr 8, 2020
@netlify
Copy link

netlify bot commented Apr 8, 2020

Deploy preview for fundamental-ngx ready!

Built with commit 6bf9738

https://deploy-preview-2293--fundamental-ngx.netlify.app

@fkolar
Copy link
Member

fkolar commented Apr 8, 2020

Build failed

@DeepakSap14
Copy link
Contributor Author

Build failed

Build is passed, but deploy is failing. there may be some issue with netify. will check with Deno and team.
I have also checked it in local with "npm run build-all", it was passing.

@DeepakSap14
Copy link
Contributor Author

Deployment failing is happening for other PR as well. once reviewed will check on that issue.

@DeepakSap14 DeepakSap14 added this to In Review in Platform Development Apr 9, 2020
@DeepakSap14 DeepakSap14 linked an issue Apr 9, 2020 that may be closed by this pull request
@DeepakSap14 DeepakSap14 force-pushed the feat/checkbox branch 2 times, most recently from 9e1683b to fc693e8 Compare April 15, 2020 06:43
@DeepakSap14
Copy link
Contributor Author

Have pushed new changes based on reviews.
This is platform checkbox implementation only (not checkbox group), there will be a separate PR for checkbox group.

@DeepakSap14 DeepakSap14 requested a review from sKudum April 15, 2020 06:46
@InnaAtanasova InnaAtanasova changed the title feat: (Platform) Checkbox As a Component feat: (platform) Checkbox As a Component Apr 16, 2020
Copy link
Contributor

@InnaAtanasova InnaAtanasova left a comment

Choose a reason for hiding this comment

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

I see a lot of any for types and methods are missing return type.

Copy link
Member

@fkolar fkolar left a comment

Choose a reason for hiding this comment

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

it does not feel right, the component is not really using things from baseInput + it will not really work with formfield formgroup structure..

Try to look at the previous implementation I prepared for D-com. even its hacky, you see some structure that I put in place https://github.com/ngx-meta/rules/tree/master/libs/fiori-rules

return super.getValue();
}
set value(value: any) {
if (value) {
Copy link
Member

Choose a reason for hiding this comment

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

check parent implementation what it is doing, when setting a value, I need to emit event to parent formField so form field can call markForCheck.

there is stateChanges - please check it out.

Also what is the added value set your value here instead of setValue from parent?

}

/** ControlvalueAccessor */
writeValue(value: any) {
Copy link
Member

Choose a reason for hiding this comment

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

check what parent writeValue is doing and why

}

/** @hidden captures controller value */
private modelValue: any;
Copy link
Member

Choose a reason for hiding this comment

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

why do you need this extra property, why cant you set it directly? to 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.

now using set value method to call setValue() of baseInput.

@@ -0,0 +1,14 @@
<fd-checkbox
Copy link
Member

Choose a reason for hiding this comment

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

Also I see only checkbox here but how this is going to work with FormField and FormGroup? It needs to be part of it, so in formField you set label for the field ..

Copy link
Contributor Author

Choose a reason for hiding this comment

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

have included " div fd-form-item " in template.

@droshev droshev self-requested a review April 19, 2020 01:52
Copy link
Contributor

@droshev droshev left a comment

Choose a reason for hiding this comment

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

What are the breaking changes?

@DeepakSap14 DeepakSap14 changed the title feat: (platform) Checkbox As a Component [WIP] feat: (platform) Checkbox As a Component Apr 20, 2020
@DeepakSap14
Copy link
Contributor Author

DeepakSap14 commented Apr 20, 2020

What are the breaking changes?

@droshev
In platform we need checkbox something like "https://primefaces.org/primeng/showcase/#/checkbox".
This will be easy to integrate with MetaUi Implementation. current implementation in checkbox expects to have values {"truevalue: '', falseValue: '', tristatevalue:''} passed. but with this implementation, application developer have to just pass value='checkboxvalueonselect', and on select it will update controller. on uncheck, it will be removed from controller.

@droshev
Copy link
Contributor

droshev commented Apr 20, 2020

What are the breaking changes?

@droshev
In platform we need checkbox something like "https://primefaces.org/primeng/showcase/#/checkbox".
This will be easy to integrate with MetaUi Implementation. current implementation in checkbox expects to have values {"truevalue: '', falseValue: '', tristatevalue:''} passed. but with this implementation, application developer have to just pass value='checkboxvalueonselect', and on select it will update controller. on uncheck, it will be removed from controller.

My comment was related to the changes you did with this PR. Do you introduce a breaking changes with this PR? If not then you need to update the title of the PR.

@DeepakSap14 DeepakSap14 changed the title [WIP] feat: (platform) Checkbox As a Component [WIP] fix: (platform) Checkbox As a Component Apr 21, 2020
@DeepakSap14 DeepakSap14 requested a review from fkolar April 24, 2020 04:36
@fkolar fkolar self-requested a review June 11, 2020 17:07
})
export class CheckboxComponent extends BaseInput implements AfterViewInit {
/** set to true if binary checkbox */
@Input()
Copy link
Member

Choose a reason for hiding this comment

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

I am more or less ok with this version I would work on more on the Selection Model and remove all the code and replace it with Selection Model that exists in the Material/cdk. it will make things much cleaner

@stefanoScalzo
Copy link
Contributor

After clicking checkbox quickly the page generates errors out

Copy link
Contributor

@stefanoScalzo stefanoScalzo left a comment

Choose a reason for hiding this comment

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

see comment

@DeepakSap14
Copy link
Contributor Author

After clicking checkbox quickly the page generates errors out

This issue is coming from core checkbox. Will raise issue for fix in core checkbox.

Copy link
Contributor

@JKMarkowski JKMarkowski left a comment

Choose a reason for hiding this comment

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

Code LGTM, let's take a look at 1 comment, but I guess it's not in scope of this PR.

@JKMarkowski
Copy link
Contributor

JKMarkowski commented Jun 16, 2020

@stefanoScalzo @DeepakSap14

After clicking checkbox quickly the page generates errors out

This issue is coming from core checkbox. Will raise issue for fix in core checkbox.

This issue was reported some time ago. It's not even ngx problem, but chrome&styles issue.

@DeepakSap14 DeepakSap14 dismissed stale reviews from KevinOkamoto, droshev, rengare, and InnaAtanasova June 17, 2020 03:35

All required changes are done.

Platform Development automation moved this from In Review to Approved by Reviewer Jun 17, 2020
Copy link
Contributor

@sKudum sKudum left a comment

Choose a reason for hiding this comment

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

LGTM

@DeepakSap14
Copy link
Contributor Author

Approvals are done. It looks Good for me. Merging it.

@DeepakSap14 DeepakSap14 merged commit 9f410fb into master Jun 17, 2020
@DeepakSap14 DeepakSap14 deleted the feat/checkbox branch June 17, 2020 04:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform platform
Projects
No open projects
Platform Development
  
Approved by Reviewer
Development

Successfully merging this pull request may close these issues.

fix: (Platform) Checkbox Component created in Platform
9 participants