diff --git a/docs/dev-guide/ui-api.md b/docs/dev-guide/ui-api.md index df7e64b0dd..f0a476904c 100644 --- a/docs/dev-guide/ui-api.md +++ b/docs/dev-guide/ui-api.md @@ -1288,6 +1288,58 @@ In this example we only display the vue-router suggestion in the plugins view an Note: `addSuggestion` and `removeSuggestion` can be namespaced with `api.namespace()`. +## Widgets + +You can register a widget for the project dashboard in your plugin ui file: + +```js +registerWidget({ + // Unique ID + id: 'org.vue.widgets.news', + // Basic infos + title: 'org.vue.widgets.news.title', + description: 'org.vue.widgets.news.description', + icon: 'rss_feed', + // Main component used to render the widget + component: 'org.vue.widgets.components.news', + // (Optional) Secondary component for widget 'fullscreen' view + detailsComponent: 'org.vue.widgets.components.news', + // Size + minWidth: 2, + minHeight: 1, + maxWidth: 6, + maxHeight: 6, + defaultWidth: 2, + defaultHeight: 3, + // (Optional) Limit the maximum number of this widget on the dashboard + maxCount: 1, + // (Optional) Add a 'fullscreen' button in widget header + openDetailsButton: true, + // (Optional) Default configuration for the widget + defaultConfig: () => ({ + url: 'https://vuenews.fireside.fm/rss' + }), + // (Optional) Require user to configure widget when added + // You shouldn't use `defaultConfig` with this + needsUserConfig: true, + // (Optional) Display prompts to configure the widget + onConfigOpen: async ({ context }) => { + return { + prompts: [ + { + name: 'url', + type: 'input', + message: 'org.vue.widgets.news.prompts.url', + validate: input => !!input // Required + } + ] + } + } +}) +``` + +Note: `registerWidget` can be namespaced with `api.namespace()`. + ## Other methods ### hasPlugin @@ -1324,6 +1376,21 @@ Get currently open project. api.getProject() ``` +### requestRoute + +Switch the user on a specific route in the web client. + +```js +api.requestRoute({ + name: 'foo', + params: { + id: 'bar' + } +}) + +api.requestRoute('/foobar') +``` + ## Public static files You may need to expose some static files over the cli-ui builtin HTTP server (typically if you want to specify an icon to a custom view). diff --git a/packages/@vue/cli-ui-addon-webpack/src/components/AssetList.vue b/packages/@vue/cli-ui-addon-webpack/src/components/AssetList.vue index 643e95571a..f893351a12 100644 --- a/packages/@vue/cli-ui-addon-webpack/src/components/AssetList.vue +++ b/packages/@vue/cli-ui-addon-webpack/src/components/AssetList.vue @@ -1,5 +1,5 @@