psychoinformatics-de / shacl-vue

https://psychoinformatics-de.github.io/shacl-vue/
MIT License
0 stars 0 forks source link

Implements basic factory pattern for matching editor components #26

Closed jsheunis closed 1 week ago

jsheunis commented 1 week ago

This introduces the 'editors.js' module which dynamically imports all vue components available in '../components/' and matching the '*Editor.vue' pattern, and then puts all of their individual shape matching functions into a single object which is provided to the necessary app components via provide/inject. This allows the PropertyShapeEditor component to loop through all component matching code and run them against any property shape, and the let the application render the matched component (or a default component in case no matches are found).

This commit also sets up the design that allows any new arbitrary components to be added to '../components/' and to be immediately available as part of the factory, provided that they include their own matching code and use the same design as existing components.

Lastly, the docstring in editors.js is also the first JSdoc-based documentation in the code. Future commits should start adding more similar docstrings for modules and functions.

Closes https://github.com/psychoinformatics-de/shacl-vue/issues/5