@maxelms/create-plugin-cli 1.1.18 → 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/main.js +1 -1
- package/templates/playground/dist/playground.html +1 -1
- 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
|
@@ -1 +1 @@
|
|
|
1
|
-
<!doctype html><html><head><meta charset="utf-8"/><title>Maxelms Plugin Playground</title><script src="./zone.umd.min.js"></script><script src="./react.production.min.js"></script><script src="./react-dom.production.min.js"></script
|
|
1
|
+
<!doctype html><html><head><meta charset="utf-8"/><title>Maxelms Plugin Playground</title><script src="./zone.umd.min.js"></script><script src="./react.production.min.js"></script><script src="./react-dom.production.min.js"></script></script><script defer="defer" src="main.js"></script><link href="main.css" rel="stylesheet"></head><body><div id="root-playground"></div></body></html>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# vue-p2
|
|
2
|
+
|
|
3
|
+
## Project setup
|
|
4
|
+
```
|
|
5
|
+
pnpm install
|
|
6
|
+
```
|
|
7
|
+
|
|
8
|
+
### Compiles and hot-reloads for development
|
|
9
|
+
```
|
|
10
|
+
pnpm run serve
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
### Compiles and minifies for production
|
|
14
|
+
```
|
|
15
|
+
pnpm run build
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
### Lints and fixes files
|
|
19
|
+
```
|
|
20
|
+
pnpm run lint
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### Customize configuration
|
|
24
|
+
See [Configuration Reference](https://cli.vuejs.org/config/).
|
|
@@ -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,57 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "<%= pluginName %>",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"scripts": {
|
|
6
|
+
"serve": "vue-cli-service serve",
|
|
7
|
+
"start": "vue-cli-service serve",
|
|
8
|
+
"build": "vue-cli-service build && maxelms-plugin-cli -c",
|
|
9
|
+
"lint": "vue-cli-service lint"
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"@maxelms/create-pulgin-api": "1.0.0",
|
|
13
|
+
"core-js": "3.6.5",
|
|
14
|
+
"element-ui": "2.15.6",
|
|
15
|
+
"vue": "3.0.0",
|
|
16
|
+
"vue-router": "4.0.0-beta.11",
|
|
17
|
+
"vuex": "4.0.0-beta.4"
|
|
18
|
+
},
|
|
19
|
+
"devDependencies": {
|
|
20
|
+
"@babel/plugin-proposal-optional-chaining": "7.21.0",
|
|
21
|
+
"@maxelms/create-plugin-cli": "^1.0.0",
|
|
22
|
+
"@vue/cli-plugin-babel": "4.5.0",
|
|
23
|
+
"@vue/cli-plugin-eslint": "4.5.0",
|
|
24
|
+
"@vue/cli-service": "4.5.0",
|
|
25
|
+
"archiver": "5.3.1",
|
|
26
|
+
"@vue/compiler-sfc": "3.0.0",
|
|
27
|
+
"babel-eslint": "10.1.0",
|
|
28
|
+
"copy-webpack-plugin": "5.1.1",
|
|
29
|
+
"eslint": "6.7.2",
|
|
30
|
+
"eslint-plugin-vue": "6.2.2",
|
|
31
|
+
"less": "^4.1.3",
|
|
32
|
+
"less-loader": "5.0.0",
|
|
33
|
+
"sass": "1.47.0",
|
|
34
|
+
"sass-loader": "8.0.2",
|
|
35
|
+
"url-loader": "2.2.0",
|
|
36
|
+
"vue-template-compiler": "2.6.11"
|
|
37
|
+
},
|
|
38
|
+
"eslintConfig": {
|
|
39
|
+
"root": true,
|
|
40
|
+
"env": {
|
|
41
|
+
"node": true
|
|
42
|
+
},
|
|
43
|
+
"extends": [
|
|
44
|
+
"plugin:vue/essential",
|
|
45
|
+
"eslint:recommended"
|
|
46
|
+
],
|
|
47
|
+
"parserOptions": {
|
|
48
|
+
"parser": "babel-eslint"
|
|
49
|
+
},
|
|
50
|
+
"rules": {}
|
|
51
|
+
},
|
|
52
|
+
"browserslist": [
|
|
53
|
+
"> 1%",
|
|
54
|
+
"last 2 versions",
|
|
55
|
+
"not dead"
|
|
56
|
+
]
|
|
57
|
+
}
|
|
@@ -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
|
+
}
|
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const archiver = require('archiver');
|
|
3
|
+
|
|
4
|
+
const distDir = 'dist'
|
|
5
|
+
if (fs.existsSync(distDir)) {
|
|
6
|
+
if (fs.existsSync('dist.maxplugin')) {
|
|
7
|
+
fs.unlinkSync('dist.maxplugin')
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const output = fs.createWriteStream('dist.maxplugin');
|
|
11
|
+
const archive = archiver('zip', {
|
|
12
|
+
zlib: { level: 9 }
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
output.on('close', function() {
|
|
16
|
+
console.log('Compress completed!');
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
archive.on('error', function(err) {
|
|
20
|
+
console.log('Compress failed!');
|
|
21
|
+
throw err;
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
archive.pipe(output);
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
archive.directory('dist/', 'dist');
|
|
28
|
+
|
|
29
|
+
archive.finalize();
|
|
30
|
+
} else {
|
|
31
|
+
console.log('No dist directory found!');
|
|
32
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div id="app">
|
|
3
|
+
<!-- 集成在 系统 中时会走该逻辑 -->
|
|
4
|
+
<span v-if="buttonName" @click="visible = true">{{buttonName}}</span>
|
|
5
|
+
<!-- 由于独立开发时没有 系统 传递的上下文数据,会渲染一个按钮辅助开发 -->
|
|
6
|
+
<button v-if="!buttonName" @click="visible = true">自定义按钮</button>
|
|
7
|
+
</div>
|
|
8
|
+
</template>
|
|
9
|
+
|
|
10
|
+
<script>
|
|
11
|
+
|
|
12
|
+
if (process.env.NODE_ENV === 'development') {
|
|
13
|
+
const runtime = require('./vue.runtime.global.js')
|
|
14
|
+
console.log(12341234123412, runtime)
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export default {
|
|
18
|
+
name: 'App',
|
|
19
|
+
data() {
|
|
20
|
+
return {
|
|
21
|
+
visible: false,
|
|
22
|
+
buttonName: this.$root?.masterProps?.originalButtonProps?.name,
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
components: {
|
|
26
|
+
|
|
27
|
+
},
|
|
28
|
+
methods: {
|
|
29
|
+
|
|
30
|
+
},
|
|
31
|
+
created() {
|
|
32
|
+
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
</script>
|
|
36
|
+
|
|
37
|
+
<style>
|
|
38
|
+
|
|
39
|
+
</style>
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { createApp } from 'vue';
|
|
2
|
+
import { registerPlugin, poweredByMaxelms } from '@maxelms/create-pulgin-api'
|
|
3
|
+
import App from './App.vue'
|
|
4
|
+
|
|
5
|
+
// Vue.config.productionTip = false
|
|
6
|
+
|
|
7
|
+
window.__SINGLETON_MODE__ = true
|
|
8
|
+
|
|
9
|
+
// configureCompat({
|
|
10
|
+
// MODE: true, // 开启 Vue 2 兼容模式
|
|
11
|
+
// });
|
|
12
|
+
|
|
13
|
+
const vms = {}
|
|
14
|
+
|
|
15
|
+
const render = (props) => {
|
|
16
|
+
const { containerId } = props || {}
|
|
17
|
+
createApp(App, {
|
|
18
|
+
data: {
|
|
19
|
+
masterProps: props || {}
|
|
20
|
+
},
|
|
21
|
+
}).mount(containerId ? `#${containerId} #root` : '#root');
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if (poweredByMaxelms) {
|
|
25
|
+
registerPlugin({
|
|
26
|
+
mount(props) {
|
|
27
|
+
render(props)
|
|
28
|
+
},
|
|
29
|
+
update(props) {
|
|
30
|
+
if (vms[props.containerId]) {
|
|
31
|
+
vms[props.containerId].masterProps = props
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
unmount(props) {
|
|
35
|
+
vms[props.containerId]?.$destroy?.()
|
|
36
|
+
vms[props.containerId] = null
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
} else {
|
|
40
|
+
render()
|
|
41
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
|
|
2
|
+
@prefixCls: maxelms-customize-component-<%= timestamp %>;
|
|
3
|
+
|
|
4
|
+
.@{prefixCls} {
|
|
5
|
+
display: flex;
|
|
6
|
+
align-items: center;
|
|
7
|
+
justify-content: center;
|
|
8
|
+
flex-direction: column;
|
|
9
|
+
input {
|
|
10
|
+
width: 300px;
|
|
11
|
+
text-align: center;
|
|
12
|
+
}
|
|
13
|
+
img {
|
|
14
|
+
width: 350px;
|
|
15
|
+
}
|
|
16
|
+
}
|