adding raw template to decorator
Description
Currently setting the template for a custom decorator requires using the template cache, and you cannot pass in a raw template string. There is some code inside the decorator provider to support it, but it is not exposed, as it does not work.
When manually setting the decorator to have type equals to template, the builder cannot find the raw template. This is because it is looking for the 'template' field on the wrong variable, checking the form instead of the 'field'.
To test out using a raw template, you can try
schemaFormDecoratorsProvider.decorator('bootstrapDecorator')['myCustomDecorator'].type = 'template';
Fixes Related issues
- This doesn't expose raw templates to the decorator helper methods, however, it does get rid of the bugs so it can be exposed in the future.
Checklist
- [x] I have read and understand the CONTRIBUTIONS.md file
- [x] I have searched for and linked related issues
- [x] I have created test cases to ensure quick resolution of the PR is easier
- [x] I am NOT targeting main branch
- [x] I did NOT include the dist folder in my PR
@json-schema-form/angular-schema-form-lead
@Traksewt thanks for your PR sorry for the delayed response, I was in the middle of the separated core changes and then holidays, would you be able to update to the latest version and reapply your changes to the renamed files? Would love to accept your efforts :)
src/services/builder.js -> src/services/sf-builder.provider.js test/services/decorators-test.js -> src/services/schema-form-decorators.provider.spec.js
@Anthropic ok no problem. rebased.
Didn't realise I could change it myself within your commit, how cool :)
Oh but then your test fails... hmmm...
@Traksewt any ideas?
The tests are failing because the decorator is trying to load the template remotely as a url, but the template is a string.