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(core): support custom model json map fn injectionToken #1009

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

ronnetzer
Copy link

@ronnetzer ronnetzer commented Aug 17, 2019

The map func is of type DynamicFormControlModelConfigMapFn which passes the model along with an instance of the service. This is done in order to support recursive calling to fromJSON and other methods for cases like ARRAY.

The motivation behind this PR is to truly support custom controls.
Currently, you can only extend known types and the extension is limited, you cannot really add new options to the model.
This PR allows mapping model config JSON to a new model class with custom options and configurations.

My use case is a draggable form control which can be enabled from the JSON.

Also solves #762

The map func is of type DynamicFormControlModelConfigMapFn which passes an instance of the service with the model. this is done in order to support recursive calling fromJSON and other methods for cases like ARRAY. The motivation behind this PR is to truly support custom controls. Currently you can only extend known types and the extension is limited, you cannot really add new options to the json config. this allowes to map model config json to a new model class with custom options and configurations. My use case is a draggable form control which can be enabled from the json.
@codecov-io
Copy link

codecov-io commented Aug 17, 2019

Codecov Report

Merging #1009 into development will decrease coverage by 0.14%.
The diff coverage is 60%.

Impacted file tree graph

@@               Coverage Diff               @@
##           development    #1009      +/-   ##
===============================================
- Coverage        91.62%   91.48%   -0.15%     
===============================================
  Files              154      154              
  Lines             2293     2302       +9     
  Branches           236      238       +2     
===============================================
+ Hits              2101     2106       +5     
- Misses             135      137       +2     
- Partials            57       59       +2
Impacted Files Coverage Δ
...forms/core/src/lib/service/dynamic-form.service.ts 90.5% <60%> (-2.12%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update dfc275f...23ad525. Read the comment docs.

@udos86
Copy link
Owner

udos86 commented Aug 19, 2019

@ronnetzer Thank you very much for this PR!

Please give a bit of time to review this. Thanks again

@ronnetzer
Copy link
Author

@udos86 any news? would love to see this PR merged :)

@Zelgadis87
Copy link

@udos86 Can this be merged? It would be a very useful functionality :)

@SoulOnFire
Copy link

@udos86 Can you please review and merge this for the next version!!??

@MalTarDesigns
Copy link

@udos86 any update on this?

@wdunn001
Copy link

@udos86 any updates on this PR?

@Neolin-Pachai
Copy link

@ronnetzer Thank you very much for this PR!

Please give a bit of time to review this. Thanks again

Has this been resolved @udos86 ?

@udos86 udos86 changed the base branch from development to master December 3, 2022 11:24
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.

9 participants