feature suggestions/documentation improvements
-
- When working on templates or components, it would be great if the editor could do intellisense on handlebar functions in your globalhelper.js asset. After you get so many functions it becomes hard to remember all their names and parameters unless you use them everyday so you have to constantly be flipping between the tabs.
- Conversely, when editing or looking at the globalhelpers.js, it would be useful to see a references popup similar to what vstudio has so you can tell what if any templates/components reference the function. This would make refactoring a lot easier, because invariably I'll write a function, and then realize after I use it in more places, it could have been done more optimally - but I'm always hesitant to change because there is no easy way to see what changing it might break short of going out to the filesystem and doing a recursive grep. It would also be helpful if the globalhelpers.js editor pulled in any intellisense for libraries that it requires like dayjs.
Maybe both 1 and 2 could be accomplished by just using vscode directly on the data folder via ssh or something, but I suspect it would need some configuring to make all that work?
- Components are really a useful feature for managing complexity - the docs you have are a start, but more examples would be good - particularly on passing data. For example, if you call a component inside of #each it seems to pass the context ok, but if you want to pass in additional parameters from elsewhere in the data object, I didn't have much luck getting any of the stuff that is in the current documentation or anything else I tried to work. A real working template that used multiple components with a fairly complicated data object would be a great addition.
All that said - I love jsreports for its simplicity, flexibility, and robustness. Looking forward to what's in store for the next version!
-
Thank you for the suggestions.
Yes, this is our plan at the top of the list. We should get to it during the next few months.
https://github.com/jsreport/jsreport/issues/971This can be tricky but let's see what will be possible with the intelli-sense.
You can use the full text search feature for this purpose for now.
in studio CTRL+SHIFT+fYes components has improved managing complexity a lot.
Isn't the example for passing root data to the component in docs actually?{{#each customers}} {{component "customer" prop1="A" prop2=@root.prop}} {{/each}
Anyway, I've updated the documentation linked playground example to cover a more complex case with root data.
https://playground.jsreport.net/w/admin/mcb0pE1a
Let me know if it needs more improvements. Thank you
-
Thanks for the example and reply. Turns out, we were still using 3.6.2 and while it had the component feature in the UI, i think it was maybe buggy. As soon as I updated to 3.11.3, passing parameters works as documented. Posting this just in case anyone else runs into it. Should have known to upgrade to latest before trying a new feature!