@maxelms/create-plugin-cli 1.1.17 → 1.1.19
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 +1 -1
- package/templates/playground/dist/playground.html +1 -1
- package/templates/playground/dist/vue.runtime.global.js +9054 -0
- package/templates/vue3-micro-button/README.md +24 -0
- package/templates/vue3-micro-button/babel.config.js +8 -0
- package/templates/vue3-micro-button/configuration/App.vue +78 -0
- package/templates/vue3-micro-button/configuration/main.js +11 -0
- package/templates/vue3-micro-button/manifest.json.tpl +3 -0
- package/templates/vue3-micro-button/package.json.tpl +57 -0
- package/templates/vue3-micro-button/public/basicConfiguration.json +34 -0
- package/templates/vue3-micro-button/public/configuration.html +10 -0
- package/templates/vue3-micro-button/public/configuration.json +34 -0
- package/templates/vue3-micro-button/public/index.html +10 -0
- package/templates/vue3-micro-button/scripts/compress.js +32 -0
- package/templates/vue3-micro-button/src/App.vue.tpl +39 -0
- package/templates/vue3-micro-button/src/main.js +41 -0
- package/templates/vue3-micro-button/src/style.less.tpl +16 -0
- package/templates/vue3-micro-button/src/vue.runtime.global.js +9051 -0
- package/templates/vue3-micro-button/vue.config.js +46 -0
- package/templates/vue3-micro-field/configuration/App.vue +78 -0
- package/templates/vue3-micro-field/configuration/main.js +11 -0
- package/templates/vue3-micro-field/public/basicConfiguration.json +34 -0
- package/templates/vue3-micro-field/public/configuration.html +10 -0
- package/templates/vue3-micro-field/public/configuration.json +4 -0
- package/templates/vue3-micro-field/public/index.html +1 -1
- package/templates/vue3-micro-field/src/App.vue.tpl +20 -2
- package/templates/vue3-micro-field/src/vue.runtime.global.js +9051 -0
- package/templates/vue3-micro-field/vue.config.js +1 -1
- package/templates/vue3-micro-plugin/src/App.vue.tpl +4 -0
- package/templates/vue3-micro-plugin/src/vue.runtime.global.js +9051 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
const path = require('path');
|
|
2
|
+
const CopyWebpackPlugin = require('copy-webpack-plugin');
|
|
3
|
+
|
|
4
|
+
module.exports = {
|
|
5
|
+
pages: {
|
|
6
|
+
index: {
|
|
7
|
+
entry: "src/main.js",
|
|
8
|
+
template: "public/index.html",
|
|
9
|
+
filename: "index.html",
|
|
10
|
+
title: "Maxelms Plugin",
|
|
11
|
+
},
|
|
12
|
+
|
|
13
|
+
},
|
|
14
|
+
publicPath: './',
|
|
15
|
+
css: {
|
|
16
|
+
extract: true,
|
|
17
|
+
},
|
|
18
|
+
productionSourceMap: false,
|
|
19
|
+
devServer: {
|
|
20
|
+
headers: {
|
|
21
|
+
"Access-Control-Allow-Origin": "*",
|
|
22
|
+
},
|
|
23
|
+
port: 8080,
|
|
24
|
+
open: ['/', '/playground.html'],
|
|
25
|
+
contentBase: path.join(__dirname, 'examples/'),
|
|
26
|
+
},
|
|
27
|
+
chainWebpack: (config) => {
|
|
28
|
+
config.module
|
|
29
|
+
.rule('fonts')
|
|
30
|
+
.test(/.(ttf|otf|eot|woff|woff2)$/)
|
|
31
|
+
.use('url-loader')
|
|
32
|
+
.loader('url-loader')
|
|
33
|
+
.tap(() => ({
|
|
34
|
+
name: '/fonts/[name].[hash:8].[ext]'
|
|
35
|
+
}))
|
|
36
|
+
.end()
|
|
37
|
+
},
|
|
38
|
+
configureWebpack: {
|
|
39
|
+
plugins: [
|
|
40
|
+
new CopyWebpackPlugin([
|
|
41
|
+
{ from: 'README.md' },
|
|
42
|
+
{ from: 'manifest.json' },
|
|
43
|
+
]),
|
|
44
|
+
]
|
|
45
|
+
},
|
|
46
|
+
};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<el-form label-position="top" :model="form">
|
|
3
|
+
<el-form-item label="是否禁用">
|
|
4
|
+
<el-switch v-model="form.disabled"></el-switch>
|
|
5
|
+
</el-form-item>
|
|
6
|
+
<el-form-item label="最大长度">
|
|
7
|
+
<el-input-number v-model="form.maxLength"></el-input-number>
|
|
8
|
+
</el-form-item>
|
|
9
|
+
<el-form-item label="控件大小">
|
|
10
|
+
<el-select v-model="form.size">
|
|
11
|
+
<el-option label="small" value="small"></el-option>
|
|
12
|
+
<el-option label="default" value="default"></el-option>
|
|
13
|
+
<el-option label="large" value="large"></el-option>
|
|
14
|
+
</el-select>
|
|
15
|
+
</el-form-item>
|
|
16
|
+
<el-form-item label="占位符">
|
|
17
|
+
<el-input v-model="form.placeholder"></el-input>
|
|
18
|
+
</el-form-item>
|
|
19
|
+
<el-form-item label="label">
|
|
20
|
+
<el-input v-model="form.label"></el-input>
|
|
21
|
+
</el-form-item>
|
|
22
|
+
</el-form>
|
|
23
|
+
</template>
|
|
24
|
+
|
|
25
|
+
<script>
|
|
26
|
+
import { PluginChannel } from '@maxelms/create-pulgin-api'
|
|
27
|
+
|
|
28
|
+
export default {
|
|
29
|
+
name: 'App',
|
|
30
|
+
data() {
|
|
31
|
+
return {
|
|
32
|
+
form: {
|
|
33
|
+
size: 'default',
|
|
34
|
+
disabled: false,
|
|
35
|
+
placeholder: '',
|
|
36
|
+
maxLength: 1,
|
|
37
|
+
label: '',
|
|
38
|
+
},
|
|
39
|
+
pluginChannel: null
|
|
40
|
+
};
|
|
41
|
+
},
|
|
42
|
+
mounted() {
|
|
43
|
+
this.pluginChannel = new PluginChannel({
|
|
44
|
+
init: this.initConfigs
|
|
45
|
+
})
|
|
46
|
+
},
|
|
47
|
+
beforeDestroy() {
|
|
48
|
+
this.pluginChannel && this.pluginChannel.destroy()
|
|
49
|
+
},
|
|
50
|
+
methods: {
|
|
51
|
+
initConfigs (configs) {
|
|
52
|
+
if (!configs || typeof configs !== 'object') return
|
|
53
|
+
this.form = {
|
|
54
|
+
...this.form,
|
|
55
|
+
...configs
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
watch: {
|
|
60
|
+
// 表单变化是,提交配置信息
|
|
61
|
+
form: {
|
|
62
|
+
handler() {
|
|
63
|
+
const config = { ...this.form };
|
|
64
|
+
this.pluginChannel.update(config);
|
|
65
|
+
},
|
|
66
|
+
deep: true,
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
}
|
|
70
|
+
</script>
|
|
71
|
+
|
|
72
|
+
<style lang="scss">
|
|
73
|
+
#app {
|
|
74
|
+
font-family: Avenir, Helvetica, Arial, sans-serif;
|
|
75
|
+
-webkit-font-smoothing: antialiased;
|
|
76
|
+
-moz-osx-font-smoothing: grayscale;
|
|
77
|
+
}
|
|
78
|
+
</style>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"propName1": {
|
|
3
|
+
"label": "配置项一",
|
|
4
|
+
"type": "string",
|
|
5
|
+
"defaultValue": "配置项内容"
|
|
6
|
+
},
|
|
7
|
+
"propName2": {
|
|
8
|
+
"label": "配置项二",
|
|
9
|
+
"type": "number",
|
|
10
|
+
"defaultValue": 350
|
|
11
|
+
},
|
|
12
|
+
"propName3": {
|
|
13
|
+
"label": "配置项三",
|
|
14
|
+
"type": "select",
|
|
15
|
+
"options": [
|
|
16
|
+
{
|
|
17
|
+
"label": "选项1",
|
|
18
|
+
"value": "option1"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"label": "选项2",
|
|
22
|
+
"value": "option2"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"label": "选项3",
|
|
26
|
+
"value": "option3"
|
|
27
|
+
}
|
|
28
|
+
]
|
|
29
|
+
},
|
|
30
|
+
"externalParams": {
|
|
31
|
+
"label": "外部参数",
|
|
32
|
+
"type": "string"
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
<div class="maxelms-customize-component-<%= timestamp %>">
|
|
4
4
|
<input
|
|
5
5
|
:style="{width: `${width}px`}"
|
|
6
|
+
:value="value"
|
|
6
7
|
:disabled="disabled"
|
|
7
8
|
:placeholder="placeholder"
|
|
8
|
-
|
|
9
|
+
@input="change"
|
|
9
10
|
/>
|
|
10
11
|
</div>
|
|
11
12
|
</div>
|
|
@@ -13,14 +14,31 @@
|
|
|
13
14
|
|
|
14
15
|
<script>
|
|
15
16
|
|
|
17
|
+
if (process.env.NODE_ENV === 'development') {
|
|
18
|
+
const runtime = require('./vue.runtime.global.js')
|
|
19
|
+
console.log(12341234123412, runtime)
|
|
20
|
+
}
|
|
21
|
+
|
|
16
22
|
export default {
|
|
17
23
|
name: 'App',
|
|
18
24
|
components: {
|
|
19
25
|
},
|
|
20
26
|
methods: {
|
|
21
|
-
|
|
27
|
+
change(e) {
|
|
28
|
+
this.onChange && this.onChange({
|
|
29
|
+
text: null,
|
|
30
|
+
value: e.target.value
|
|
31
|
+
})
|
|
32
|
+
}
|
|
22
33
|
},
|
|
23
34
|
computed: {
|
|
35
|
+
/** value、onChange 是字段组件作为表单受控组件的必要属性 */
|
|
36
|
+
value () {
|
|
37
|
+
return this.$root?.masterProps?.value?.value || "欢迎使用 Maxelms 字段组件"
|
|
38
|
+
},
|
|
39
|
+
onChange () {
|
|
40
|
+
return this.$root?.masterProps?.onChange
|
|
41
|
+
},
|
|
24
42
|
/** 是否禁用 */
|
|
25
43
|
disabled () {
|
|
26
44
|
return this.$root?.masterProps?.configurations?.propName3
|