Move admintable vue component to its own package #11107
Merged
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.
Description
Currently, all the Vue related things for the admin table are located in the
admintable
asset bundle. This works perfectly fine if you are using it as part of a template or maybe even if you are instantiating it from another piece of JS.In both of those cases calling
new Craft.VueAdminTable({ ... })
will get you what you need.From a plugin's perspective, the problem (that this PR looks to solve) arises when you are using Vue and would like to use the component inside your app. At this point you have two options, either instantiate it with the normal JS method (losing out on being able to hook into the Vue "goodness") or include it by having the
cms
repo checked out and having a long-winded relative path on the import (e.g.../../../../../../cms/src/web/assets/admintable/App.vue
).Neither are particularly ideal, but moving it to its own package means it is easily includable both from within
cms
and for plugin developers.This PR gives scope to also have further components in the future. For example Commerce had a need to recreate the HTML for a field in a Vue file. This could easily be moved to this new package and be available for the
cms
and everyone else.The package will be publish to
npm
in the same way we deal with thewebpack
andsass
packages./cc @timkelty