-
Notifications
You must be signed in to change notification settings - Fork 22
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
Dynamic component input value assignment #1793
Conversation
Deployed to https://pr-1793.aam-digital.net/ |
afa0f78
to
116b0f3
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.
😍 😻
I absolutely love this refactoring - feels so much clearer and can avoid duplicated and convoluted code.
I commented a few places where I would prefer to have non-nested, more clear Inputs instead of the config
property. Maybe a two-way with the config implemented as a setter can be a workaround/fallback?
filterByActivityType: string; | ||
child: Child; | ||
@Input() entity: Child; | ||
@Input() config: { filterByActivityType: 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.
let's make this the more clean direct input @Input() filterByActivityType: string;
. I think the block is currently not used anywhere due to performance issues anyway, so the backward compatibility could be sacrificed here.
...roject/children/children-list/recent-attendance-blocks/recent-attendance-blocks.component.ts
Outdated
Show resolved
Hide resolved
...roject/children/dashboard-widgets/entity-count-dashboard/entity-count-dashboard.component.ts
Show resolved
Hide resolved
src/app/child-dev-project/notes/note-attendance-block/note-attendance-count-block.component.ts
Show resolved
Hide resolved
src/app/child-dev-project/notes/notes-related-to-entity/notes-related-to-entity.component.ts
Outdated
Show resolved
Hide resolved
src/app/core/entity-components/entity-details/related-entities/related-entities.component.ts
Outdated
Show resolved
Hide resolved
...p/core/entity-components/entity-utils/view-components/display-date/display-date.component.ts
Show resolved
Hide resolved
export class HistoricalDataComponent implements OnInitDynamicComponent { | ||
export class HistoricalDataComponent implements OnInit { | ||
@Input() entity: Entity; | ||
@Input() config: FormFieldConfig[] = []; |
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.
maybe "columns" is more clear and descriptive - so we could also consider doing just a .config setter as an alternative route
src/app/features/matching-entities/matching-entities/matching-entities.component.ts
Outdated
Show resolved
Hide resolved
src/app/features/todos/todos-related-to-entity/todos-related-to-entity.component.ts
Outdated
Show resolved
Hide resolved
src/app/child-dev-project/children/children-list/bmi-block/bmi-block.component.ts
Outdated
Show resolved
Hide resolved
TODO:
|
ccdff23
to
ccd388d
Compare
Kudos, SonarCloud Quality Gate passed!
|
🎉 This PR is included in version 3.20.0-master.1 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
🎉 This PR is included in version 3.20.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
For some time we have already been planning to replace the
OnInitDynamicComponent
interface with a more Angular-like approach where we make use of the class properties marked with the@Input()
annotation.This has been implemented here.
Now the components that are dynamically created just work like they are used in a template where
@Input()
properties are automatically set and available in thengOnInit
or evenngOnChanges
functions.Visible/Frontend Changes
--
Architectural/Backend Changes
DynamicComponentDirective
automatically assigns config values to component properties annotated with@Input()
OnInitDynamicComponent
interface