Implements basic factory pattern for matching editor components #26
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 #5