@widget-js/cli 1.1.10 → 1.1.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@widget-js/cli",
3
- "version": "1.1.10",
3
+ "version": "1.1.11",
4
4
  "main": "lib/index.js",
5
5
  "author": "Neo Fu",
6
6
  "license": "MIT",
@@ -8,9 +8,9 @@ const description = {"zh-CN": ""};
8
8
  //组件关键词
9
9
  const keywords = [WidgetKeyword.RECOMMEND];
10
10
  //组件路由地址
11
- const url = "/widget/<%= snakeCaseName %>";
11
+ const path = "/widget/<%= snakeCaseName %>";
12
12
  //配置页路由地址
13
- const configUrl = <% if (configurable) { %>"/widget/config/<%= snakeCaseName %>"<% } else { %>undefined<% } %>;
13
+ const configPagePath = <% if (configurable) { %>"/widget/config/<%= snakeCaseName %>"<% } else { %>undefined<% } %>;
14
14
  //组件关键词
15
15
  const <%= name %>WidgetDefine = new Widget({
16
16
  name: name,
@@ -24,17 +24,9 @@ minWidth: <%= minWidth %>,
24
24
  maxWidth: <%= maxWidth %>,
25
25
  minHeight: <%= minHeight %>,
26
26
  maxHeight: <%= maxHeight %>,
27
- routes: [
28
- {
29
- url: url,
30
- name: 'index'
31
- },
32
- <% if (configurable) { %> {
33
- url: configUrl,
34
- name: 'config'
35
- },
36
- <% } %>
37
- ]
27
+ previewImage: "修改为组件预览图地址",
28
+ path,
29
+ configPagePath
38
30
  })
39
31
 
40
32
  export default <%= name %>WidgetDefine;
@@ -1,18 +1,18 @@
1
1
  import <%= name %>WidgetDefine from "./<%= name %>.widget";
2
2
 
3
- const url = <%= name %>WidgetDefine.getIndexRoute().url;
3
+ const path = <%= name %>WidgetDefine.path;
4
4
  const name = <%= name %>WidgetDefine.name;
5
5
  <% if (configurable) { %>
6
- const configUrl = <%= name %>WidgetDefine.getConfigRoute()!.url;
6
+ const configPagePath = <%= name %>WidgetDefine.configPagePath;
7
7
 
8
8
  const <%= name %>WidgetRoutes = [
9
9
  {
10
- path: url,
10
+ path: path,
11
11
  name: `${name}`,
12
12
  component: () => import(/* webpackChunkName: "<%= widgetName %>" */ './<%= name %>WidgetView.vue')
13
13
  },
14
14
  {
15
- path: configUrl,
15
+ path: configPagePath,
16
16
  name: `${name}.config`,
17
17
  component: () => import(/* webpackChunkName: "<%= widgetName %>.config" */ './<%= name %>ConfigView.vue')
18
18
  }
@@ -20,7 +20,7 @@ const <%= name %>WidgetRoutes = [
20
20
  <% } else { %>
21
21
  const <%= name %>WidgetRoutes = [
22
22
  {
23
- path: url,
23
+ path: path,
24
24
  name: `${name}`,
25
25
  component: () => import(/* webpackChunkName: "<%= widgetName %>" */ './<%= name %>WidgetView.vue')
26
26
  }
@@ -1,39 +0,0 @@
1
- import { Widget, WidgetKeyword } from '@widget-js/core';
2
- //TODO 修改组件信息,标题,描述,关键词
3
- const name = 'cn.widgetjs.widgets.hotspot.test';
4
- //组件标题
5
- const title = { 'zh-CN': '123' };
6
- //组件描述
7
- const description = { 'zh-CN': '' };
8
- //组件关键词
9
- const keywords = [WidgetKeyword.RECOMMEND];
10
- //组件路由地址
11
- const url = '/widget/test';
12
- //配置页路由地址
13
- const configUrl = '/widget/config/test';
14
- //组件关键词
15
- const TestWidgetDefine = new Widget({
16
- name: name,
17
- title: title,
18
- description: description,
19
- keywords: keywords,
20
- lang: 'zh-CN',
21
- width: 2,
22
- height: 3,
23
- minWidth: 1,
24
- maxWidth: 3,
25
- minHeight: 2,
26
- maxHeight: 3,
27
- routes: [
28
- {
29
- url: url,
30
- name: 'index',
31
- },
32
- {
33
- url: configUrl,
34
- name: 'config',
35
- },
36
- ],
37
- });
38
-
39
- export default TestWidgetDefine;
@@ -1,41 +0,0 @@
1
- <template>
2
- <widget-edit-dialog
3
- :widget-params="widgetParams"
4
- :option="widgetConfigOption"
5
- :widget-data="widgetData"
6
- @confirm="onSaveClick()"
7
- >
8
- <template v-slot:form>
9
- <!-- TODO 这里写自定义表单内容 -->
10
- </template>
11
- </widget-edit-dialog>
12
- </template>
13
-
14
- <script lang="ts" setup>
15
- import {
16
- useWidget,
17
- WidgetConfigOption,
18
- WidgetEditDialog,
19
- } from '@widget-js/vue3';
20
- import { WidgetData, WidgetDataApi } from '@widget-js/core';
21
- import { reactive } from 'vue';
22
-
23
- const { widgetData, widgetParams } = useWidget(WidgetData);
24
-
25
- //修改成需要设置组件参数配置
26
- const widgetConfigOption = reactive(
27
- new WidgetConfigOption({
28
- custom: true,
29
- backgroundColor: true,
30
- borderRadius: true,
31
- preview: false,
32
- })
33
- );
34
-
35
- const onSaveClick = async () => {
36
- await WidgetDataApi.save(widgetData);
37
- window.close();
38
- };
39
- </script>
40
-
41
- <style scoped></style>
@@ -1,7 +0,0 @@
1
- <template>
2
- <!-- TODO 这里只写组件内容,不做自定义数据、业务处理 -->
3
- </template>
4
-
5
- <script lang="ts" setup></script>
6
-
7
- <style scoped></style>
@@ -1,27 +0,0 @@
1
- import TestWidgetDefine from './Test.widget';
2
-
3
- const url = TestWidgetDefine.getIndexRoute().url;
4
- const name = TestWidgetDefine.name;
5
-
6
- const configUrl = TestWidgetDefine.getConfigRoute()!.url;
7
-
8
- const TestWidgetRoutes = [
9
- {
10
- path: url,
11
- name: `${name}`,
12
- component: () =>
13
- import(
14
- /* webpackChunkName: "cn.widgetjs.widgets.hotspot.test" */ './TestWidgetView.vue'
15
- ),
16
- },
17
- {
18
- path: configUrl,
19
- name: `${name}.config`,
20
- component: () =>
21
- import(
22
- /* webpackChunkName: "cn.widgetjs.widgets.hotspot.test.config" */ './TestConfigView.vue'
23
- ),
24
- },
25
- ];
26
-
27
- export default TestWidgetRoutes;
@@ -1,14 +0,0 @@
1
- <template>
2
- <!-- TODO:组件页面,这里编写组件业务逻辑-->
3
- <test-widget></test-widget>
4
- </template>
5
-
6
- <script lang="ts" setup>
7
- import { WidgetData } from '@widget-js/core';
8
- import TestWidget from './TestWidget.vue';
9
- import { useWidget } from '@widget-js/vue3';
10
-
11
- const { widgetData, widgetParams } = useWidget(WidgetData);
12
- </script>
13
-
14
- <style scoped></style>
@@ -1,8 +0,0 @@
1
- import TestWidgetRoutes from "./test/TestWidgetRoutes";
2
- //FBI WANING! IMPORT PLACE, DONT DELETE THIS LINE
3
-
4
- const WidgetRouter = [
5
- ...TestWidgetRoutes,
6
- //FBI WANING! ROUTE PLACE, DONT DELETE THIS LINE
7
- ];
8
- export default WidgetRouter