automan-cmd 2.1.5
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +65 -0
- package/README.md +56 -0
- package/bin/automan +3 -0
- package/bin/automan-build +3 -0
- package/bin/automan-config +3 -0
- package/bin/automan-create +3 -0
- package/bin/automan-publish +3 -0
- package/lib/automan-build.js +41 -0
- package/lib/automan-config.js +82 -0
- package/lib/automan-create.js +137 -0
- package/lib/automan-publish.js +331 -0
- package/lib/index.js +13 -0
- package/lib/install.js.tpl +47 -0
- package/lib/util.js +174 -0
- package/package.json +37 -0
- package/tpl/.babelrc +16 -0
- package/tpl/.browserslistrc +3 -0
- package/tpl/.eslintignore +2 -0
- package/tpl/.eslintrc.js +228 -0
- package/tpl/.gitignore.ejs +12 -0
- package/tpl/.postcssrc.js +12 -0
- package/tpl/README.md +1 -0
- package/tpl/changelog.md +1 -0
- package/tpl/editor/index.vue +45 -0
- package/tpl/icon.png +0 -0
- package/tpl/jsconfig.json +7 -0
- package/tpl/package.json.ejs +66 -0
- package/tpl/preview/app.vue +326 -0
- package/tpl/preview/attr/Data.vue +69 -0
- package/tpl/preview/attr/Resource.vue +79 -0
- package/tpl/preview/attr/com.vue +21 -0
- package/tpl/preview/attr/index.js +16 -0
- package/tpl/preview/components/Attribute.vue +365 -0
- package/tpl/preview/components/FitImg.vue +152 -0
- package/tpl/preview/components/ImgViewer.vue +80 -0
- package/tpl/preview/components/Loading.vue +55 -0
- package/tpl/preview/components/Toast.vue +111 -0
- package/tpl/preview/index.js +22 -0
- package/tpl/preview/index.tpl +13 -0
- package/tpl/preview/lib/ESlog.js +46 -0
- package/tpl/preview/lib/Util.js +57 -0
- package/tpl/preview/lib/fetch.js +139 -0
- package/tpl/preview/lib/index.js +15 -0
- package/tpl/preview/lib/vue/filters.js +53 -0
- package/tpl/preview/lib/vue/index.js +9 -0
- package/tpl/preview/lib/vue/mixin.js +166 -0
- package/tpl/preview/mint-ui/message-box/index.js +1503 -0
- package/tpl/preview/mint-ui/message-box/style.css +159 -0
- package/tpl/preview/mint-ui/popup/index.js +1046 -0
- package/tpl/preview/mint-ui/popup/style.css +115 -0
- package/tpl/preview/mint-ui/spinner/index.js +657 -0
- package/tpl/preview/mint-ui/spinner/style.css +227 -0
- package/tpl/preview/mint-ui/swipe/index.js +907 -0
- package/tpl/preview/mint-ui/swipe/style.css +43 -0
- package/tpl/preview/mint-ui/swipe-item/index.js +171 -0
- package/tpl/preview/mint-ui/swipe-item/style.css +1 -0
- package/tpl/preview/style.css +126 -0
- package/tpl/server.config.js +6 -0
- package/tpl/src/assets/css/index.scss +29 -0
- package/tpl/src/example.vue +165 -0
- package/tpl/src/index.vue.ejs +32 -0
- package/tpl/webpack.config.js.ejs +267 -0
- package/tpl/yarn.lock +6037 -0
@@ -0,0 +1,326 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
<template>
|
4
|
+
<div class="page" @mousemove="mousemove" @mouseup="mouseup">
|
5
|
+
<div>
|
6
|
+
<el-menu
|
7
|
+
:default-active="sizeIndex"
|
8
|
+
class="el-menu-demo"
|
9
|
+
mode="horizontal"
|
10
|
+
@select="handleSelect"
|
11
|
+
>
|
12
|
+
<el-submenu index="2">
|
13
|
+
<template slot="title">分辨率</template>
|
14
|
+
<el-menu-item
|
15
|
+
v-for="(item,index) in sizes"
|
16
|
+
:key="item.name"
|
17
|
+
:index="index"
|
18
|
+
>{{ item.name }} ({{ item.width }}*{{ item.height }})</el-menu-item>
|
19
|
+
</el-submenu>
|
20
|
+
</el-menu>
|
21
|
+
</div>
|
22
|
+
<div class="content">
|
23
|
+
<vue-drag
|
24
|
+
class="componentWrap"
|
25
|
+
:w="componentSize.width"
|
26
|
+
:h="componentSize.height"
|
27
|
+
@resizing="onResize"
|
28
|
+
>
|
29
|
+
<div class="sizeTip">组件显示区域({{ componentSize.width }}*{{ componentSize.height }})</div>
|
30
|
+
<com v-bind="componentProps" ref="component" />
|
31
|
+
</vue-drag>
|
32
|
+
<div class="block editor" :style="editerStyle">
|
33
|
+
<div class="title" @click="editerActive = true" @mousedown="mousedown" @mouseup="mouseup">编辑面板</div>
|
34
|
+
<div class="node">
|
35
|
+
<editor :component-info="componentProps" />
|
36
|
+
<attribute v-if="isInit" :component-props="componentProps" />
|
37
|
+
</div>
|
38
|
+
</div>
|
39
|
+
</div>
|
40
|
+
<toast ref="toast" :compromise="true" />
|
41
|
+
<loading ref="loading" />
|
42
|
+
<img-viewer ref="imgViewer" />
|
43
|
+
</div>
|
44
|
+
</template>
|
45
|
+
|
46
|
+
<script>
|
47
|
+
import com from '../src/index'
|
48
|
+
import Attribute from './components/Attribute'
|
49
|
+
import Loading from './components/Loading'
|
50
|
+
// import example from '../src/example'
|
51
|
+
import Editor from '../editor/index'
|
52
|
+
import ImgViewer from './components/ImgViewer'
|
53
|
+
import Toast from './components/Toast'
|
54
|
+
import MessageBox from 'mint-ui/message-box/'
|
55
|
+
import 'mint-ui/message-box/style.css'
|
56
|
+
|
57
|
+
export default {
|
58
|
+
name: 'P',
|
59
|
+
components: { Toast, Loading, ImgViewer, com, Editor, Attribute },
|
60
|
+
data() {
|
61
|
+
return {
|
62
|
+
// 开发过程的分辨率选项
|
63
|
+
sizes: {
|
64
|
+
'Mobile S': {
|
65
|
+
name: 'Mobile S',
|
66
|
+
width: 320,
|
67
|
+
height: 500
|
68
|
+
},
|
69
|
+
'Mobile M': {
|
70
|
+
name: 'Mobile M',
|
71
|
+
width: 375,
|
72
|
+
height: 600
|
73
|
+
},
|
74
|
+
'Mobile L': {
|
75
|
+
name: 'Mobile L',
|
76
|
+
width: 414,
|
77
|
+
height: 700
|
78
|
+
},
|
79
|
+
'Desktop': {
|
80
|
+
name: 'Desktop',
|
81
|
+
width: 960,
|
82
|
+
height: 720
|
83
|
+
}
|
84
|
+
},
|
85
|
+
sizeIndex: 'Mobile S',
|
86
|
+
isInit: false, // 是否初始化完成
|
87
|
+
editerActive: false, // 编辑面板是否要拖拽了
|
88
|
+
componentSize: { // 组件当前的大小
|
89
|
+
width: 320,
|
90
|
+
height: 500
|
91
|
+
},
|
92
|
+
editerPanel: {
|
93
|
+
x: 600,
|
94
|
+
y: 0,
|
95
|
+
active: false,
|
96
|
+
org: { x: 0, y: 0 },
|
97
|
+
start: { x: 0, y: 0 }
|
98
|
+
},
|
99
|
+
|
100
|
+
// 组件开发的时候,配置传入的默认参数,按需修改,这里面的字段一般需要和 src/index.vue 里面的props的key保持一致
|
101
|
+
componentProps: {
|
102
|
+
reanderType: 'canvas',
|
103
|
+
packageType: 'common',
|
104
|
+
datasourcekey: '',
|
105
|
+
option: {
|
106
|
+
title: {
|
107
|
+
text: 'ECharts 入门示例'
|
108
|
+
},
|
109
|
+
tooltip: {},
|
110
|
+
legend: {
|
111
|
+
data: ['销量']
|
112
|
+
},
|
113
|
+
xAxis: {
|
114
|
+
data: ['衬衫', '羊毛衫', '雪纺衫', '裤子', '高跟鞋', '袜子']
|
115
|
+
},
|
116
|
+
yAxis: {},
|
117
|
+
series: [{
|
118
|
+
name: '销量',
|
119
|
+
type: 'bar',
|
120
|
+
data: [5, 20, 36, 10, 10, 20]
|
121
|
+
}]
|
122
|
+
}
|
123
|
+
}
|
124
|
+
}
|
125
|
+
},
|
126
|
+
computed: {
|
127
|
+
editerStyle() {
|
128
|
+
return {
|
129
|
+
left: this.editerPanel.x + 'px',
|
130
|
+
top: this.editerPanel.y + 'px'
|
131
|
+
}
|
132
|
+
}
|
133
|
+
},
|
134
|
+
created() {
|
135
|
+
// 这里注册了一些全局方法,和渲染器里面的统一的。
|
136
|
+
const that = this
|
137
|
+
window.msgBox = MessageBox
|
138
|
+
window.alert = function(msg, fn) {
|
139
|
+
MessageBox.close()
|
140
|
+
let m, t
|
141
|
+
if (typeof msg === 'object') {
|
142
|
+
m = msg.msg
|
143
|
+
t = msg.title
|
144
|
+
} else {
|
145
|
+
m = String(msg)
|
146
|
+
t = '提示'
|
147
|
+
}
|
148
|
+
MessageBox.alert(m, t).then(action => {
|
149
|
+
typeof fn === 'function' && fn(action)
|
150
|
+
})
|
151
|
+
}
|
152
|
+
window.confirm = function(msg, fn, re) {
|
153
|
+
MessageBox.close()
|
154
|
+
let m, t
|
155
|
+
if (typeof msg === 'object') {
|
156
|
+
m = msg.msg
|
157
|
+
t = msg.title
|
158
|
+
} else {
|
159
|
+
m = String(msg)
|
160
|
+
t = '提示'
|
161
|
+
}
|
162
|
+
MessageBox.confirm(m, t).then(action => {
|
163
|
+
typeof fn === 'function' && fn(action)
|
164
|
+
}).catch(action => {
|
165
|
+
typeof re === 'function' && re(action)
|
166
|
+
})
|
167
|
+
}
|
168
|
+
window.prompt = function(msg, fn, re) {
|
169
|
+
MessageBox.close()
|
170
|
+
let m, t
|
171
|
+
if (typeof msg === 'object') {
|
172
|
+
m = msg.msg
|
173
|
+
t = msg.title
|
174
|
+
} else {
|
175
|
+
m = String(msg)
|
176
|
+
t = '提示'
|
177
|
+
}
|
178
|
+
MessageBox.prompt(m, t).then(val => {
|
179
|
+
typeof fn === 'function' && fn(val)
|
180
|
+
}).catch(action => {
|
181
|
+
typeof re === 'function' && re(action)
|
182
|
+
})
|
183
|
+
}
|
184
|
+
window.loading = function(hide) {
|
185
|
+
if (!that.$refs.loading) { return }
|
186
|
+
if (!hide) { that.$refs.loading.open() }
|
187
|
+
else { that.$refs.loading.hide() }
|
188
|
+
}
|
189
|
+
window.toast = function(msg, fn) {
|
190
|
+
if (!that.$refs.toast) { return }
|
191
|
+
that.$refs.toast.render({ msg, fn })
|
192
|
+
}
|
193
|
+
window.viewImg = (imgs, index) => {
|
194
|
+
if (!that.$refs.imgViewer) { return }
|
195
|
+
that.$refs.imgViewer.open(imgs, index)
|
196
|
+
}
|
197
|
+
},
|
198
|
+
mounted() {
|
199
|
+
this.componentSize = this.sizes[this.sizeIndex]
|
200
|
+
window.componentVm = this.$refs.component
|
201
|
+
this.isInit = true
|
202
|
+
},
|
203
|
+
methods: {
|
204
|
+
mousedown: function(event) {
|
205
|
+
this.editerPanel.org = {
|
206
|
+
x: this.editerPanel.x,
|
207
|
+
y: this.editerPanel.y
|
208
|
+
}
|
209
|
+
this.editerPanel.start = {
|
210
|
+
x: event.pageX,
|
211
|
+
y: event.pageY
|
212
|
+
}
|
213
|
+
this.active = true
|
214
|
+
},
|
215
|
+
mousemove: function(event) {
|
216
|
+
if (!this.active) {
|
217
|
+
return
|
218
|
+
}
|
219
|
+
this.editerPanel.x = this.editerPanel.org.x + (event.pageX - this.editerPanel.start.x)
|
220
|
+
this.editerPanel.y = this.editerPanel.org.y + (event.pageY - this.editerPanel.start.y)
|
221
|
+
},
|
222
|
+
mouseup() {
|
223
|
+
this.active = false
|
224
|
+
},
|
225
|
+
onActivated(e) {
|
226
|
+
console.log(e)
|
227
|
+
e.stopPropagation()
|
228
|
+
if (e && e.target) {
|
229
|
+
// e.target.focus()
|
230
|
+
}
|
231
|
+
},
|
232
|
+
handleSelect(key) {
|
233
|
+
this.sizeIndex = key
|
234
|
+
this.componentSize = this.sizes[this.sizeIndex]
|
235
|
+
},
|
236
|
+
onResize(x, y, width, height) {
|
237
|
+
this.componentSize.width = width
|
238
|
+
this.componentSize.height = height
|
239
|
+
},
|
240
|
+
getComponent(order) {
|
241
|
+
return this.$refs.ones[order - 1]
|
242
|
+
}
|
243
|
+
}
|
244
|
+
}
|
245
|
+
</script>
|
246
|
+
|
247
|
+
<style lang="stylus" rel="stylesheet/stylus" type="text/stylus">
|
248
|
+
@require './style.css';
|
249
|
+
|
250
|
+
html, body {
|
251
|
+
margin: 0;
|
252
|
+
padding: 0;
|
253
|
+
}
|
254
|
+
|
255
|
+
.page {
|
256
|
+
display: flex;
|
257
|
+
flex-direction: column;
|
258
|
+
width: 100%;
|
259
|
+
height: 100%;
|
260
|
+
position: absolute;
|
261
|
+
|
262
|
+
.content {
|
263
|
+
position: relative;
|
264
|
+
flex: 1;
|
265
|
+
|
266
|
+
.componentWrap {
|
267
|
+
width: 100%;
|
268
|
+
height: 100%;
|
269
|
+
left: 0;
|
270
|
+
top: 0;
|
271
|
+
border: 1px solid red;
|
272
|
+
box-shadow: 0px 5px 10px 0px #ccc;
|
273
|
+
position: absolute;
|
274
|
+
|
275
|
+
.sizeTip {
|
276
|
+
bottom: -26px;
|
277
|
+
position: absolute;
|
278
|
+
color: #ccc;
|
279
|
+
right: 0;
|
280
|
+
}
|
281
|
+
|
282
|
+
.node {
|
283
|
+
width: 100%;
|
284
|
+
height: 100%;
|
285
|
+
}
|
286
|
+
}
|
287
|
+
|
288
|
+
.editor {
|
289
|
+
flex: 1;
|
290
|
+
position: absolute;
|
291
|
+
width: 300px;
|
292
|
+
right: 0;
|
293
|
+
box-shadow: 0px 1px 1px 1px #ccc;
|
294
|
+
display: flex;
|
295
|
+
flex-direction: column;
|
296
|
+
|
297
|
+
&:hover {
|
298
|
+
opacity: 1;
|
299
|
+
}
|
300
|
+
|
301
|
+
.node {
|
302
|
+
flex: 1;
|
303
|
+
padding: 10px;
|
304
|
+
overflow: auto;
|
305
|
+
}
|
306
|
+
}
|
307
|
+
}
|
308
|
+
|
309
|
+
.title {
|
310
|
+
cursor: move;
|
311
|
+
border-bottom: 1px solid #ccc;
|
312
|
+
box-shadow: 0px -1px 10px 0px #ccc;
|
313
|
+
color: #666;
|
314
|
+
padding: 10px;
|
315
|
+
}
|
316
|
+
|
317
|
+
.block {
|
318
|
+
margin: 10px;
|
319
|
+
min-height: 200px;
|
320
|
+
margin-bottom: 20px;
|
321
|
+
background-color: #fff;
|
322
|
+
}
|
323
|
+
}
|
324
|
+
</style>
|
325
|
+
|
326
|
+
|
@@ -0,0 +1,69 @@
|
|
1
|
+
<template>
|
2
|
+
<div class="dataEditor">
|
3
|
+
<el-input type="textarea" class="input" v-model="inContent" />
|
4
|
+
</div>
|
5
|
+
</template>
|
6
|
+
<style lang="stylus" rel="stylesheet/stylus" scoped type="text/stylus">
|
7
|
+
.dataEditor {
|
8
|
+
height: 300px;
|
9
|
+
width: 100%;
|
10
|
+
|
11
|
+
.input {
|
12
|
+
height: 100%;
|
13
|
+
width: 100%;
|
14
|
+
|
15
|
+
>>>textarea {
|
16
|
+
height: 100%;
|
17
|
+
width: 100%;
|
18
|
+
}
|
19
|
+
}
|
20
|
+
}
|
21
|
+
</style>
|
22
|
+
|
23
|
+
<script type="text/ecmascript-6">
|
24
|
+
/**
|
25
|
+
* 数据编辑器,
|
26
|
+
* 后续扩展接口访问支持
|
27
|
+
*/
|
28
|
+
export default {
|
29
|
+
name: 'DataEditor',
|
30
|
+
components: {},
|
31
|
+
mixins: [],
|
32
|
+
props: {
|
33
|
+
content: {
|
34
|
+
type: [String, Array, Object]
|
35
|
+
},
|
36
|
+
/**
|
37
|
+
* 支持 空,array,object
|
38
|
+
*/
|
39
|
+
type: {
|
40
|
+
type: String
|
41
|
+
}
|
42
|
+
},
|
43
|
+
data: function() {
|
44
|
+
return {
|
45
|
+
inContent: ''
|
46
|
+
}
|
47
|
+
},
|
48
|
+
watch: {
|
49
|
+
inContent: function(newVal) {
|
50
|
+
if (this.type) {
|
51
|
+
try {
|
52
|
+
newVal = JSON.parse(newVal)
|
53
|
+
} catch (e) {
|
54
|
+
|
55
|
+
}
|
56
|
+
}
|
57
|
+
this.$emit('update:content', newVal)
|
58
|
+
this.$emit('change', newVal)
|
59
|
+
}
|
60
|
+
},
|
61
|
+
mounted: function() {
|
62
|
+
if (this.type) {
|
63
|
+
this.inContent = JSON.stringify(this.content, null, 2)
|
64
|
+
}
|
65
|
+
},
|
66
|
+
methods: {
|
67
|
+
}
|
68
|
+
}
|
69
|
+
</script>
|
@@ -0,0 +1,79 @@
|
|
1
|
+
<template>
|
2
|
+
<div class="resourceEditor">
|
3
|
+
<el-input placeholder="选择资源" size="mini" v-model="inUrl">
|
4
|
+
<el-button slot="append" icon="el-icon-upload" @click="selectImage">选择</el-button>
|
5
|
+
<el-button size="mini" slot="append" icon="el-icon-picture" @click="cropper">裁剪</el-button>
|
6
|
+
</el-input>
|
7
|
+
<div class="preview">
|
8
|
+
<div class="in" :style="previewBg"></div>
|
9
|
+
</div>
|
10
|
+
</div>
|
11
|
+
</template>
|
12
|
+
<style lang="stylus" rel="stylesheet/stylus" scoped type="text/stylus">
|
13
|
+
.resourceEditor {
|
14
|
+
padding: 0 10px;
|
15
|
+
|
16
|
+
.preview {
|
17
|
+
width: 100%;
|
18
|
+
height: 150px;
|
19
|
+
margin-top: 10px;
|
20
|
+
background-color: #dddddd;
|
21
|
+
|
22
|
+
.in {
|
23
|
+
width: 100%;
|
24
|
+
height: 100%;
|
25
|
+
background-size: contain;
|
26
|
+
background-repeat: no-repeat;
|
27
|
+
background-position: center;
|
28
|
+
}
|
29
|
+
}
|
30
|
+
}
|
31
|
+
</style>
|
32
|
+
|
33
|
+
<script type="text/ecmascript-6">
|
34
|
+
export default {
|
35
|
+
name: 'ResourceEditor',
|
36
|
+
components: {},
|
37
|
+
props: {
|
38
|
+
url: {
|
39
|
+
type: String
|
40
|
+
},
|
41
|
+
type: {
|
42
|
+
type: String,
|
43
|
+
default: 'image'
|
44
|
+
}
|
45
|
+
},
|
46
|
+
data: function() {
|
47
|
+
return {
|
48
|
+
inUrl: this.url
|
49
|
+
}
|
50
|
+
},
|
51
|
+
computed: {
|
52
|
+
previewBg() {
|
53
|
+
return {
|
54
|
+
'background-image': `url(${this.inUrl})`
|
55
|
+
}
|
56
|
+
}
|
57
|
+
},
|
58
|
+
watch: {
|
59
|
+
url: function(newVal) {
|
60
|
+
this.inUrl = newVal
|
61
|
+
},
|
62
|
+
inUrl: function(newVal) {
|
63
|
+
this.$emit('update:url', newVal)
|
64
|
+
}
|
65
|
+
},
|
66
|
+
mounted: function() {
|
67
|
+
},
|
68
|
+
methods: {
|
69
|
+
selectImage: function() {
|
70
|
+
this.$message('编辑器模式下不能使用')
|
71
|
+
},
|
72
|
+
cropper: function() {
|
73
|
+
// this.crop = true
|
74
|
+
this.$message('编辑器模式下不能裁剪')
|
75
|
+
}
|
76
|
+
}
|
77
|
+
}
|
78
|
+
</script>
|
79
|
+
|
@@ -0,0 +1,21 @@
|
|
1
|
+
<template>
|
2
|
+
<el-input v-model="content" />
|
3
|
+
</template>
|
4
|
+
|
5
|
+
<script>
|
6
|
+
export default {
|
7
|
+
name: 'AttrCom',
|
8
|
+
props: ['content'],
|
9
|
+
data() {
|
10
|
+
return {}
|
11
|
+
},
|
12
|
+
computed: {
|
13
|
+
},
|
14
|
+
mounted: function() {
|
15
|
+
},
|
16
|
+
methods: {
|
17
|
+
}
|
18
|
+
}
|
19
|
+
</script>
|
20
|
+
|
21
|
+
<style lang="stylus" rel="stylesheet/stylus" type="text/stylus" scoped></style>
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import AttrCom from './com'
|
2
|
+
import AttrData from './Data'
|
3
|
+
import AttrResource from './Resource'
|
4
|
+
import Vue from 'vue'
|
5
|
+
|
6
|
+
const install = function() {
|
7
|
+
Vue.component('AttrData', AttrData)
|
8
|
+
Vue.component('Resource', AttrResource)
|
9
|
+
Vue.component('AttrFunction', AttrCom)
|
10
|
+
Vue.component('AttrRichtext', AttrCom)
|
11
|
+
Vue.component('AttrEvent', AttrCom)
|
12
|
+
}
|
13
|
+
|
14
|
+
export default {
|
15
|
+
install
|
16
|
+
}
|