sun-form-v3 1.0.70 → 1.0.72
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/abap-DfvySaIJ.js +1404 -0
- package/dist/apex-B__0irD3.js +332 -0
- package/dist/assets/css.worker-OK053IOu.js +84 -0
- package/dist/assets/editor.worker-D9iUZyMP.js +11 -0
- package/dist/assets/html.worker-CL40hqKM.js +458 -0
- package/dist/assets/json.worker-6f9bhSHY.js +42 -0
- package/dist/assets/ts.worker-B6g3wjaE.js +37021 -0
- package/dist/azcli-CDMGhRmx.js +74 -0
- package/dist/bat-0Mk8aqzx.js +106 -0
- package/dist/bicep-BBi_I06Z.js +108 -0
- package/dist/cameligo-D0G_Zm6X.js +180 -0
- package/dist/clojure-o2ZKLeMp.js +767 -0
- package/dist/coffee-DOQff5VC.js +238 -0
- package/dist/cpp-CQGJnWhD.js +395 -0
- package/dist/csharp-C1jLsHl8.js +332 -0
- package/dist/csp-C_ttMQaW.js +59 -0
- package/dist/css-BC202kVV.js +193 -0
- package/dist/cssMode-D3INtz5D.js +1541 -0
- package/dist/cypher-DwtEH7Fi.js +269 -0
- package/dist/dart-D9XknsP2.js +287 -0
- package/dist/dockerfile-DgsNjqqa.js +136 -0
- package/dist/ecl-BAMCHBl6.js +462 -0
- package/dist/elixir-CegIttP8.js +575 -0
- package/dist/favicon.ico +0 -0
- package/dist/flow9-9608t7UV.js +148 -0
- package/dist/freemarker2-hasIzj0A.js +995 -0
- package/dist/fsharp-CCtt9-1_.js +223 -0
- package/dist/go-CGUIPbct.js +224 -0
- package/dist/graphql-BNRIFFIn.js +157 -0
- package/dist/handlebars-Cqza9dif.js +425 -0
- package/dist/hcl-C__KLIXe.js +189 -0
- package/dist/html-QpDlLWtS.js +314 -0
- package/dist/htmlMode-3p93KT8l.js +1551 -0
- package/dist/index2-jkDcibEo.js +120443 -0
- package/dist/ini-CeKYn_zA.js +77 -0
- package/dist/java-Dm24deQl.js +238 -0
- package/dist/javascript-CSPB5Brm.js +76 -0
- package/dist/jsonMode-qA6pURD0.js +1957 -0
- package/dist/julia-BImNW7VE.js +517 -0
- package/dist/kotlin-BfE79GEb.js +259 -0
- package/dist/less-DglNOcaC.js +168 -0
- package/dist/lexon-BA0dRz9Q.js +163 -0
- package/dist/liquid-BWuASSim.js +246 -0
- package/dist/lua-DMkWzJcm.js +168 -0
- package/dist/m3-sA-5shO8.js +216 -0
- package/dist/markdown-OYRB1igA.js +235 -0
- package/dist/mdx-CnHJXO9F.js +171 -0
- package/dist/mips-rRzkJ_7G.js +204 -0
- package/dist/msdax-DoVJdUhd.js +381 -0
- package/dist/mysql-Ty44IHXo.js +884 -0
- package/dist/objective-c-VUfyhYrA.js +189 -0
- package/dist/pascal-DkASiYyw.js +257 -0
- package/dist/pascaligo-p-ELPlVO.js +170 -0
- package/dist/perl-Cjl1FxLZ.js +632 -0
- package/dist/pgsql-DjVenF7s.js +857 -0
- package/dist/php-CwvGzZOO.js +506 -0
- package/dist/pla-Br1iaBIV.js +143 -0
- package/dist/postiats-BaeP8zZY.js +913 -0
- package/dist/powerquery-CLCshuo8.js +896 -0
- package/dist/powershell-CZV50w5N.js +245 -0
- package/dist/protobuf-MV3XTewJ.js +426 -0
- package/dist/pug-DkDg4c4l.js +408 -0
- package/dist/python-CRYsEVap.js +282 -0
- package/dist/qsharp-BAtiKA97.js +291 -0
- package/dist/r-8ocrd-h-.js +249 -0
- package/dist/razor-DyEtGntt.js +556 -0
- package/dist/redis-9sZiddxc.js +308 -0
- package/dist/redshift-DQfTOGC0.js +815 -0
- package/dist/restructuredtext-DXU-vkgr.js +180 -0
- package/dist/ruby-DotfqwMf.js +517 -0
- package/dist/rust-BIauJ5KN.js +349 -0
- package/dist/sb-CmWMvDEV.js +121 -0
- package/dist/scala-C81brEbk.js +376 -0
- package/dist/scheme-D0pcFz2x.js +114 -0
- package/dist/scss-BOdN2fGG.js +268 -0
- package/dist/shell-6E09eAkU.js +227 -0
- package/dist/solidity-CWStzA1K.js +1373 -0
- package/dist/sophia-76Sb6CWe.js +205 -0
- package/dist/sparql-BmZTkOWT.js +207 -0
- package/dist/sql-Cs9TBAW5.js +859 -0
- package/dist/st-B-rqE1Bu.js +422 -0
- package/dist/style.css +1 -0
- package/dist/sun-form-v3.es.js +4 -0
- package/dist/sun-form-v3.umd.js +1902 -0
- package/dist/swift-Btsj6YxQ.js +318 -0
- package/dist/systemverilog-B3RHBRa2.js +582 -0
- package/dist/tcl-Dpj776pn.js +238 -0
- package/dist/tsMode-BrlIPEQw.js +885 -0
- package/dist/twig-Bb9JmBsE.js +398 -0
- package/dist/typescript-CYTudnTM.js +349 -0
- package/dist/typespec-CDWeg3SU.js +123 -0
- package/dist/vb-DEXnYwEI.js +378 -0
- package/dist/wgsl-D602c1lx.js +445 -0
- package/dist/xml-B-x5164u.js +101 -0
- package/dist/yaml-Buq2hM65.js +212 -0
- package/package.json +5 -8
- package/src/App.vue +0 -9
- package/src/assets/font/YouSheBiaoTiHei-2.ttf +0 -0
- package/src/assets/font/demo.css +0 -539
- package/src/assets/font/demo_index.html +0 -1200
- package/src/assets/font/iconfont.css +0 -191
- package/src/assets/font/iconfont.js +0 -1
- package/src/assets/font/iconfont.json +0 -317
- package/src/assets/font/iconfont.ttf +0 -0
- package/src/assets/font/iconfont.woff +0 -0
- package/src/assets/font/iconfont.woff2 +0 -0
- package/src/assets/img/bg_footer.png +0 -0
- package/src/assets/img/bg_title.png +0 -0
- package/src/assets/img/file.png +0 -0
- package/src/assets/img/logo.png +0 -0
- package/src/assets/img/logo2.png +0 -0
- package/src/assets/img/logo22.png +0 -0
- package/src/assets/img/logo23.png +0 -0
- package/src/assets/img/logo3.png +0 -0
- package/src/assets/img//347/237/251/345/275/242@2x.png +0 -0
- package/src/assets/logo.svg +0 -1
- package/src/assets/styles/element/index.scss +0 -15
- package/src/assets/styles/index.css +0 -3
- package/src/components/a.js +0 -14
- package/src/components/aDesigner/config.vue +0 -127
- package/src/components/aDesigner/design.vue +0 -20
- package/src/components/aDesigner/designer.js +0 -342
- package/src/components/aDesigner/http.js +0 -292
- package/src/components/aDesigner/index.vue +0 -144
- package/src/components/aDesigner/panel.vue +0 -144
- package/src/components/aDesigner/show.vue +0 -24
- package/src/components/widgetCommonComps/commonApiConfig/index.vue +0 -194
- package/src/components/widgetCommonComps/commonCard/index.vue +0 -36
- package/src/components/widgetCommonComps/commonCodeEditor/editor.vue +0 -219
- package/src/components/widgetCommonComps/commonCodeEditor/modalEditor.vue +0 -68
- package/src/components/widgetCommonComps/commonCollapseCard/index.vue +0 -10
- package/src/components/widgetCommonComps/commonContainer/index.vue +0 -95
- package/src/components/widgetCommonComps/commonJsonInput/index.vue +0 -59
- package/src/components/widgetCommonComps/commonLabelContainer/index.vue +0 -39
- package/src/components/widgetCommonComps/commonSidetree/index.vue +0 -61
- package/src/components/widgetCommonComps/commonTypeInput/index.vue +0 -75
- package/src/components/widgetCommonComps/commonWidgetLabelContainer/index.vue +0 -55
- package/src/components/widgetCommonComps/index copy.js +0 -17
- package/src/components/widgetCommonComps/index.js +0 -17
- package/src/components/widgetConfigComps/config-input/index.vue +0 -60
- package/src/components/widgetConfigComps/index copy.js +0 -13
- package/src/components/widgetConfigComps/index.js +0 -17
- package/src/components/widgetShowComps/index.js +0 -29
- package/src/components/widgetShowComps/widget-form/index.vue +0 -43
- package/src/components/widgetShowComps/widget-homepage/index.vue +0 -41
- package/src/components/widgetShowComps/widget-input/index.vue +0 -85
- package/src/components/widgetShowComps/widget-select/index.vue +0 -31
- package/src/designer.js +0 -342
- package/src/http.js +0 -293
- package/src/index.js +0 -24
- package/src/index2.js +0 -23
- package/src/main.js +0 -19
- package/src/remark.js +0 -708
- package/src/testBtn.vue +0 -11
- package/src/testInput.vue +0 -12
- package/src/util/jsformat.js +0 -568
- package/src/widgetConfig.js +0 -1112
@@ -1,194 +0,0 @@
|
|
1
|
-
<template>
|
2
|
-
<el-button plain :type="props.modelValue.apiurl ? 'primary' : ''" icon="Setting" @click="openEvent">
|
3
|
-
{{ props.buttonName }}
|
4
|
-
</el-button>
|
5
|
-
<vxe-modal transfer v-model="showModal" width="600px" height="600px" show-footer @close="closeHandle">
|
6
|
-
<template #title>
|
7
|
-
<span>{{ props.title }}</span>
|
8
|
-
</template>
|
9
|
-
<template #default>
|
10
|
-
<div class="item">
|
11
|
-
<div class="lab">发送方式</div>
|
12
|
-
<div class="con">
|
13
|
-
<el-radio-group v-model="data.method">
|
14
|
-
<el-radio-button value="get" label="GET"></el-radio-button>
|
15
|
-
<el-radio-button value="post" label="POST"></el-radio-button>
|
16
|
-
<el-radio-button value="put" label="PUT"></el-radio-button>
|
17
|
-
<el-radio-button value="patch" label="PATCH"></el-radio-button>
|
18
|
-
<el-radio-button value="delete" label="DELETE"></el-radio-button>
|
19
|
-
</el-radio-group>
|
20
|
-
</div>
|
21
|
-
</div>
|
22
|
-
<div class="item">
|
23
|
-
<div class="lab">数据格式</div>
|
24
|
-
<div class="con">
|
25
|
-
<el-radio-group v-model="data.contentType">
|
26
|
-
<el-radio-button value="JSON" label="JSON"></el-radio-button>
|
27
|
-
<el-radio-button value="FormData" label="FormData"></el-radio-button>
|
28
|
-
</el-radio-group>
|
29
|
-
</div>
|
30
|
-
</div>
|
31
|
-
<div class="item">
|
32
|
-
<div class="lab">接口地址</div>
|
33
|
-
<div class="con">
|
34
|
-
<el-input v-model="data.apiurl" placeholder="例:/api/getData"></el-input>
|
35
|
-
</div>
|
36
|
-
</div>
|
37
|
-
<div class="item">
|
38
|
-
<div class="lab">参数数据</div>
|
39
|
-
<div class="con">
|
40
|
-
<common-json-input v-model="data.params"></common-json-input>
|
41
|
-
</div>
|
42
|
-
</div>
|
43
|
-
<div class="item">
|
44
|
-
<div class="lab">参数适配器</div>
|
45
|
-
<div class="con">
|
46
|
-
<modal-editor :designer="designer" v-model="data.paramsFormat" :params="['params', 'widget', 'app']"></modal-editor>
|
47
|
-
<el-popover placement="top-start" title="示例" :width="150" trigger="hover">
|
48
|
-
<slot>
|
49
|
-
return
|
50
|
-
{<br>
|
51
|
-
"name":'张三',<br>
|
52
|
-
"age":22<br>
|
53
|
-
},<br>
|
54
|
-
</slot>
|
55
|
-
<template #reference>
|
56
|
-
<el-icon class="ml-2 cursor-pointer">
|
57
|
-
<WarningFilled />
|
58
|
-
</el-icon>
|
59
|
-
</template>
|
60
|
-
</el-popover>
|
61
|
-
<!-- <common-code-editor v-model="data.beforeSend" height="300px"></common-code-editor> -->
|
62
|
-
</div>
|
63
|
-
</div>
|
64
|
-
<div class="item">
|
65
|
-
<div class="lab">请求头数据</div>
|
66
|
-
<div class="con">
|
67
|
-
<common-json-input v-model="data.headers"></common-json-input>
|
68
|
-
</div>
|
69
|
-
</div>
|
70
|
-
|
71
|
-
<div class="item">
|
72
|
-
<div class="lab">请求头适配器</div>
|
73
|
-
<div class="con">
|
74
|
-
<modal-editor :designer="designer" v-model="data.headersFormat" :params="['headers', 'widget', 'app']"></modal-editor>
|
75
|
-
<el-popover placement="top-start" title="示例" :width="150" trigger="hover">
|
76
|
-
<slot>
|
77
|
-
return
|
78
|
-
{<br>
|
79
|
-
"token":'abc',<br>
|
80
|
-
"serial-no":22<br>
|
81
|
-
},<br>
|
82
|
-
</slot>
|
83
|
-
<template #reference>
|
84
|
-
<el-icon class="ml-2 cursor-pointer">
|
85
|
-
<WarningFilled />
|
86
|
-
</el-icon>
|
87
|
-
</template>
|
88
|
-
</el-popover>
|
89
|
-
<!-- <common-code-editor v-model="data.beforeSend" height="300px"></common-code-editor> -->
|
90
|
-
</div>
|
91
|
-
</div>
|
92
|
-
<div class="item">
|
93
|
-
<div class="lab">请求成功适配器</div>
|
94
|
-
<div class="con">
|
95
|
-
<modal-editor :designer="designer" v-model="data.successFormat" :params="['res', 'widget', 'app']"></modal-editor>
|
96
|
-
<el-popover placement="top-start" title="注意" :width="200" trigger="hover">
|
97
|
-
<slot>
|
98
|
-
请求成功是指数据上的请求成功,不代表业务上的请求成功,axios中进入的是then回调
|
99
|
-
</slot>
|
100
|
-
<template #reference>
|
101
|
-
<el-icon class="ml-2 cursor-pointer">
|
102
|
-
<WarningFilled />
|
103
|
-
</el-icon>
|
104
|
-
</template>
|
105
|
-
</el-popover>
|
106
|
-
</div>
|
107
|
-
</div>
|
108
|
-
<div class="item">
|
109
|
-
<div class="lab">请求失败适配器</div>
|
110
|
-
<div class="con">
|
111
|
-
<modal-editor :designer="designer" v-model="data.errorFormat" :params="['error', 'widget', 'app']"></modal-editor>
|
112
|
-
<el-popover placement="top-start" title="注意" :width="200" trigger="hover">
|
113
|
-
<slot>
|
114
|
-
请求失败是指数据上的请求成功,不代表业务上的请求成功,axios中进入的是catch回调
|
115
|
-
</slot>
|
116
|
-
<template #reference>
|
117
|
-
<el-icon class="ml-2 cursor-pointer">
|
118
|
-
<WarningFilled />
|
119
|
-
</el-icon>
|
120
|
-
</template>
|
121
|
-
</el-popover>
|
122
|
-
</div>
|
123
|
-
</div>
|
124
|
-
</template>
|
125
|
-
<template #footer>
|
126
|
-
<el-button icon="Promotion" size="small" @click="testHandle">测试请求</el-button>
|
127
|
-
<el-button icon="Close" size="small" @click="closeHandle">关闭</el-button>
|
128
|
-
<el-button icon="Check" type="primary" size="small" @click="confirmHandle">确认</el-button>
|
129
|
-
</template>
|
130
|
-
</vxe-modal>
|
131
|
-
</template>
|
132
|
-
|
133
|
-
<script setup>
|
134
|
-
import { ref, reactive, computed } from 'vue';
|
135
|
-
import commonCodeEditor from '../commonCodeEditor/editor.vue'
|
136
|
-
import modalEditor from '../commonCodeEditor/modalEditor.vue'
|
137
|
-
|
138
|
-
defineOptions({ name: "commonApiConfig" })
|
139
|
-
const emit = defineEmits(['update:modelValue'])
|
140
|
-
let props = defineProps({
|
141
|
-
modelValue: [Object, null],
|
142
|
-
designer: {
|
143
|
-
type: Object
|
144
|
-
},
|
145
|
-
buttonName: {
|
146
|
-
type: [String],
|
147
|
-
default: '接口配置'
|
148
|
-
}, title: {
|
149
|
-
type: [String],
|
150
|
-
default: '请求配置'
|
151
|
-
},
|
152
|
-
})
|
153
|
-
let designer = props.designer
|
154
|
-
// let data = computed({
|
155
|
-
// set(value) {
|
156
|
-
// emit('update:modelValue', value)
|
157
|
-
// },
|
158
|
-
// get() {
|
159
|
-
// return props.modelValue
|
160
|
-
// }
|
161
|
-
// })
|
162
|
-
let data = ref(null)
|
163
|
-
let showModal = ref(false)
|
164
|
-
const openEvent = () => {
|
165
|
-
data.value = designer.$utils.clone(props.modelValue, true)
|
166
|
-
// data.apiSet = props.modelValue
|
167
|
-
showModal.value = true;
|
168
|
-
}
|
169
|
-
const closeHandle = () => {
|
170
|
-
showModal.value = false
|
171
|
-
}
|
172
|
-
const testHandle = () => {
|
173
|
-
emit('update:modelValue', data.value)
|
174
|
-
designer.requestByApisetConfig(designer.chosenWidget)
|
175
|
-
}
|
176
|
-
const confirmHandle = () => {
|
177
|
-
emit('update:modelValue', data.value)
|
178
|
-
showModal.value = false
|
179
|
-
}
|
180
|
-
</script>
|
181
|
-
|
182
|
-
<style scoped lang="scss">
|
183
|
-
.item {
|
184
|
-
@apply flex my-4 items-center;
|
185
|
-
|
186
|
-
.lab {
|
187
|
-
@apply flex-none w-32 flex justify-end pr-4;
|
188
|
-
}
|
189
|
-
|
190
|
-
.con {
|
191
|
-
@apply flex-1;
|
192
|
-
}
|
193
|
-
}
|
194
|
-
</style>
|
@@ -1,36 +0,0 @@
|
|
1
|
-
<template>
|
2
|
-
<div class="border-gray-200 border-t border-b">
|
3
|
-
<!-- 卡片头 -->
|
4
|
-
<div class="flex items-center justify-between p-2 bg-gray-100 cursor-pointer text-sm" @click="toggle = !toggle">
|
5
|
-
<span class="select-none">
|
6
|
-
{{ props.title }}
|
7
|
-
</span>
|
8
|
-
<span>
|
9
|
-
<el-icon v-if="toggle">
|
10
|
-
<ArrowUp />
|
11
|
-
</el-icon>
|
12
|
-
<el-icon v-else>
|
13
|
-
<ArrowDown />
|
14
|
-
</el-icon>
|
15
|
-
</span>
|
16
|
-
</div>
|
17
|
-
<!-- 卡片内容 -->
|
18
|
-
<div class="px-3 py-2 bg-white" v-if="toggle">
|
19
|
-
<slot></slot>
|
20
|
-
</div>
|
21
|
-
</div>
|
22
|
-
</template>
|
23
|
-
|
24
|
-
<script setup>
|
25
|
-
import { ref, reactive } from 'vue';
|
26
|
-
let props = defineProps({
|
27
|
-
title: {
|
28
|
-
type: String,
|
29
|
-
default: "标题"
|
30
|
-
}
|
31
|
-
})
|
32
|
-
defineOptions({ name: "commonCard" })
|
33
|
-
let toggle = ref(true);
|
34
|
-
</script>
|
35
|
-
|
36
|
-
<style scoped lang="scss"></style>
|
@@ -1,219 +0,0 @@
|
|
1
|
-
<template>
|
2
|
-
<div class="flex w-full h-full">
|
3
|
-
<div class="tree_wrap flex-none w-[320px] border" v-if="!props.pure">
|
4
|
-
<common-sidetree :designer="designer" :canAddApi="true" @addApi="addApiHandle"></common-sidetree>
|
5
|
-
</div>
|
6
|
-
<div class="h-full w-full flex flex-col flex-1">
|
7
|
-
<div class="head py-2 px-2 box-border bg-[#191c20]" v-if="!props.pure">
|
8
|
-
<span class="text-[#569cd6]">function</span>
|
9
|
-
<span class="text-[#ffd700]">( </span>
|
10
|
-
<span v-for="(item, index) in props.params" class="text-[#d4d4d4]">
|
11
|
-
{{ item }}
|
12
|
-
{{ index == props.params.length - 1 ? '' : ' , ' }}
|
13
|
-
</span>
|
14
|
-
<span class="text-[#ffd700]"> ) {</span>
|
15
|
-
</div>
|
16
|
-
<div class="flex-1 h-full" ref="container" :style="{ width: props.width, height: props.height }">
|
17
|
-
</div>
|
18
|
-
<div v-if="!props.pure" class="footer text-[#ffd700] bg-[#2f3129] py-2 px-2">}</div>
|
19
|
-
</div>
|
20
|
-
</div>
|
21
|
-
</template>
|
22
|
-
|
23
|
-
<script setup>
|
24
|
-
import { ref, onMounted, onUnmounted, watch } from 'vue';
|
25
|
-
import * as monaco from 'monaco-editor';
|
26
|
-
import editorWorker from 'monaco-editor/esm/vs/editor/editor.worker?worker';
|
27
|
-
import jsonWorker from 'monaco-editor/esm/vs/language/json/json.worker?worker';
|
28
|
-
import cssWorker from 'monaco-editor/esm/vs/language/css/css.worker?worker';
|
29
|
-
import htmlWorker from 'monaco-editor/esm/vs/language/html/html.worker?worker';
|
30
|
-
import tsWorker from 'monaco-editor/esm/vs/language/typescript/ts.worker?worker';
|
31
|
-
import "monaco-editor/esm/vs/basic-languages/typescript/typescript.contribution"; // 代码高亮&提示
|
32
|
-
import "monaco-editor/esm/vs/basic-languages/javascript/javascript.contribution"; // 代码高亮&提示
|
33
|
-
import "monaco-editor/esm/vs/language/typescript/monaco.contribution"; // 代码高亮&提示
|
34
|
-
import 'monaco-editor/esm/vs/editor/contrib/contextmenu/browser/contextmenu.js'; // 右键显示菜单
|
35
|
-
import 'monaco-editor/esm/vs/editor/contrib/folding/browser/folding.js'; // 折叠
|
36
|
-
import 'monaco-editor/esm/vs/editor/contrib/format/browser/formatActions.js'; // 格式化代码
|
37
|
-
import 'monaco-editor/esm/vs/editor/contrib/suggest/browser/suggestController.js'; // 代码联想提示
|
38
|
-
import 'monaco-editor/esm/vs/editor/contrib/tokenization/browser/tokenization.js'; // 代码联想提示
|
39
|
-
import 'monaco-editor/esm/vs/editor/contrib/snippet/browser/snippetController2.js'; //代码片段支持
|
40
|
-
|
41
|
-
defineOptions({ name: "commonCodeEditor" });
|
42
|
-
const props = defineProps({
|
43
|
-
modelValue: [String, null],
|
44
|
-
designer: {
|
45
|
-
type: Object,
|
46
|
-
default: {}
|
47
|
-
},
|
48
|
-
width: {
|
49
|
-
type: [String],
|
50
|
-
default: '100%'
|
51
|
-
},
|
52
|
-
height: {
|
53
|
-
type: [String],
|
54
|
-
default: '100%'
|
55
|
-
},
|
56
|
-
language: {
|
57
|
-
type: [String],
|
58
|
-
default: 'javascript'
|
59
|
-
},
|
60
|
-
theme: {
|
61
|
-
type: [String],
|
62
|
-
default: 'vs-dark'
|
63
|
-
// default: 'vs'
|
64
|
-
},
|
65
|
-
params: {
|
66
|
-
type: [Array],
|
67
|
-
default: []
|
68
|
-
},
|
69
|
-
minimap: {
|
70
|
-
type: [Boolean],
|
71
|
-
default: true,
|
72
|
-
},
|
73
|
-
pure: {
|
74
|
-
type: [Boolean],
|
75
|
-
default: false,
|
76
|
-
},
|
77
|
-
tabSize: {
|
78
|
-
type: [Number],
|
79
|
-
default: 4,
|
80
|
-
}
|
81
|
-
})
|
82
|
-
const emit = defineEmits(['update:modelValue'])
|
83
|
-
const container = ref(null);
|
84
|
-
let editor = null
|
85
|
-
onMounted(() => {
|
86
|
-
// 设置 Monaco 编辑器的基础路径
|
87
|
-
window.MonacoEnvironment = {
|
88
|
-
getWorker(_, label) {
|
89
|
-
if (label === 'json') {
|
90
|
-
return new jsonWorker();
|
91
|
-
}
|
92
|
-
if (label === 'css' || label === 'scss' || label === 'less') {
|
93
|
-
return new cssWorker();
|
94
|
-
}
|
95
|
-
if (label === 'html' || label === 'handlebars' || label === 'razor') {
|
96
|
-
return new htmlWorker();
|
97
|
-
}
|
98
|
-
if (label === 'typescript' || label === 'javascript') {
|
99
|
-
return new tsWorker();
|
100
|
-
}
|
101
|
-
return new editorWorker();
|
102
|
-
}
|
103
|
-
};
|
104
|
-
|
105
|
-
// 确保容器元素存在且尺寸正确
|
106
|
-
if (container.value) {
|
107
|
-
editor = monaco.editor.create(container.value, {
|
108
|
-
value: props.modelValue || "",
|
109
|
-
language: props.language,
|
110
|
-
theme: props.theme, // 可选:使用暗色主题 默认
|
111
|
-
automaticLayout: true, // 自动调整布局以适应容器大小变化
|
112
|
-
minimap: { enabled: props.minimap }, // 启用小地图
|
113
|
-
folding: true, // 启用代码折叠
|
114
|
-
foldingStrategy: 'auto', // 自动折叠策略
|
115
|
-
renderLineHighlight: 'all', // 高亮当前行
|
116
|
-
scrollBeyondLastLine: false, // 禁止滚动超过最后一行
|
117
|
-
quickSuggestions: true, // 快速建议
|
118
|
-
suggestOnTriggerCharacters: true, // 在触发字符时提供建议
|
119
|
-
parameterHints: { enabled: true }, // 启用参数提示
|
120
|
-
autoClosingBrackets: 'always', // 自动闭合括号
|
121
|
-
autoClosingQuotes: 'always', // 自动闭合引号
|
122
|
-
guides: { indentation: true }, // 缩进指南
|
123
|
-
autoIndent: 'full', // 自动缩进
|
124
|
-
formatOnType: true, // 在输入时格式化
|
125
|
-
formatOnPaste: true, // 在粘贴时格式化
|
126
|
-
wordWrap: 'wordWrapColumn',// 自动换行
|
127
|
-
tabSize: props.tabSize,// 缩进大小
|
128
|
-
});
|
129
|
-
// monaco.languages.registerHoverProvider('javascript', {
|
130
|
-
// provideHover: function (model, position) {
|
131
|
-
// const word = model.getWordAtPosition(position);
|
132
|
-
// if (word.word.startsWith('btn_')) {
|
133
|
-
// return {
|
134
|
-
// contents: [
|
135
|
-
// { value: '按钮组件: 提交表单' },
|
136
|
-
// { value: '属性: label="提交", type="primary"' },
|
137
|
-
// { value: '方法: onClick="submitForm()"' }
|
138
|
-
// ]
|
139
|
-
// };
|
140
|
-
// }
|
141
|
-
// // 处理其他组件类型...
|
142
|
-
// }
|
143
|
-
// });
|
144
|
-
|
145
|
-
editor.addAction({
|
146
|
-
id: 'show-component-info',
|
147
|
-
label: '显示组件信息',
|
148
|
-
keybindings: [monaco.KeyMod.CtrlCmd | monaco.KeyCode.I],
|
149
|
-
contextMenuGroupId: 'operation',
|
150
|
-
contextMenuOrder: 1.5,
|
151
|
-
run: function (ed) {
|
152
|
-
const model = ed.getModel();
|
153
|
-
const selection = ed.getSelection();
|
154
|
-
const word = model.getWordAtPosition(selection.getStartPosition());
|
155
|
-
if (word && word.word.startsWith('grid_')) {
|
156
|
-
console.log('组件名称:', word.word);
|
157
|
-
showComponentInfo(word.word); // 自定义函数,显示组件信息
|
158
|
-
}
|
159
|
-
}
|
160
|
-
});
|
161
|
-
editor.onDidChangeModelContent((event) => {
|
162
|
-
emit('update:modelValue', editor.getValue());
|
163
|
-
});
|
164
|
-
setTimeout(() => {
|
165
|
-
formatCode();
|
166
|
-
}, 20);
|
167
|
-
// watch(() => props.modelValue, (val) => {
|
168
|
-
// console.log(val);
|
169
|
-
// setValue(val)
|
170
|
-
// setTimeout(() => {
|
171
|
-
// formatCode();
|
172
|
-
// }, 20);
|
173
|
-
// }, {
|
174
|
-
// deep: true,
|
175
|
-
// immediate: true
|
176
|
-
// })
|
177
|
-
// 可选:在组件卸载时销毁编辑器
|
178
|
-
onUnmounted(() => {
|
179
|
-
editor.dispose();
|
180
|
-
});
|
181
|
-
} else {
|
182
|
-
console.error('编辑器容器元素不存在');
|
183
|
-
}
|
184
|
-
});
|
185
|
-
const getValue = () => {
|
186
|
-
console.log(editor.getValue());
|
187
|
-
}
|
188
|
-
const setValue = (val) => {
|
189
|
-
editor.setValue(val);
|
190
|
-
}
|
191
|
-
const formatCode = () => {
|
192
|
-
editor.trigger('keyboard', 'editor.action.formatDocument', null);
|
193
|
-
}
|
194
|
-
const setPositionValue = (val) => {
|
195
|
-
const position = editor.getPosition();
|
196
|
-
editor.executeEdits('', [{
|
197
|
-
range: new monaco.Range(
|
198
|
-
position.lineNumber,
|
199
|
-
position.column,
|
200
|
-
position.lineNumber,
|
201
|
-
position.column
|
202
|
-
),
|
203
|
-
text: val,
|
204
|
-
forceMoveMarkers: true
|
205
|
-
}]);
|
206
|
-
}
|
207
|
-
const addApiHandle = (row) => {
|
208
|
-
console.log(row);
|
209
|
-
}
|
210
|
-
|
211
|
-
defineExpose({
|
212
|
-
getValue,
|
213
|
-
setValue,
|
214
|
-
setPositionValue,
|
215
|
-
formatCode
|
216
|
-
})
|
217
|
-
</script>
|
218
|
-
|
219
|
-
<style scoped lang="scss"></style>
|
@@ -1,68 +0,0 @@
|
|
1
|
-
<template>
|
2
|
-
<el-button plain :type="props.modelValue ? 'primary' : ''" icon="Edit" @click="openEvent">
|
3
|
-
{{ props.buttonName }}
|
4
|
-
</el-button>
|
5
|
-
<vxe-modal transfer v-model="showModal" width="80%" height="80%" show-footer @close="closeHandle">
|
6
|
-
<template #title>
|
7
|
-
<span>{{ props.title }}</span>
|
8
|
-
</template>
|
9
|
-
<template #default>
|
10
|
-
<commonCodeEditor :designer="designer" :params="props.params" v-if="showModal" v-model="codeString">
|
11
|
-
</commonCodeEditor>
|
12
|
-
</template>
|
13
|
-
<template #footer>
|
14
|
-
<el-button icon="Close" size="small" @click="closeHandle">关闭</el-button>
|
15
|
-
<el-button icon="Check" size="small" type="primary" @click="confirmHandle">确认</el-button>
|
16
|
-
</template>
|
17
|
-
</vxe-modal>
|
18
|
-
</template>
|
19
|
-
|
20
|
-
<script setup>
|
21
|
-
import { ref, reactive, computed } from 'vue';
|
22
|
-
import commonCodeEditor from './editor.vue'
|
23
|
-
|
24
|
-
let props = defineProps({
|
25
|
-
modelValue: [String, null],
|
26
|
-
params: {
|
27
|
-
type: [Array],
|
28
|
-
default: []
|
29
|
-
},
|
30
|
-
designer: {
|
31
|
-
type: Object,
|
32
|
-
default: {}
|
33
|
-
},
|
34
|
-
buttonName: {
|
35
|
-
type: [String],
|
36
|
-
default: '编辑代码'
|
37
|
-
}, title: {
|
38
|
-
type: [String],
|
39
|
-
default: '代码编辑器'
|
40
|
-
},
|
41
|
-
})
|
42
|
-
const emit = defineEmits(['update:modelValue'])
|
43
|
-
|
44
|
-
let showModal = ref(false)
|
45
|
-
// let codeString = computed({
|
46
|
-
// get() {
|
47
|
-
// return props.modelValue
|
48
|
-
// },
|
49
|
-
// set(value) {
|
50
|
-
// emit('update:modelValue', value);
|
51
|
-
// }
|
52
|
-
// })
|
53
|
-
let codeString = ref(null)
|
54
|
-
const openEvent = () => {
|
55
|
-
codeString.value = props.modelValue
|
56
|
-
showModal.value = true;
|
57
|
-
}
|
58
|
-
const closeHandle = () => {
|
59
|
-
showModal.value = false
|
60
|
-
}
|
61
|
-
const confirmHandle = () => {
|
62
|
-
emit('update:modelValue', codeString.value);
|
63
|
-
showModal.value = false
|
64
|
-
}
|
65
|
-
defineOptions({ name: "modalEditor" })
|
66
|
-
</script>
|
67
|
-
|
68
|
-
<style scoped lang="scss"></style>
|
@@ -1,95 +0,0 @@
|
|
1
|
-
<template>
|
2
|
-
<div @click.stop="activeWidget" class="box-border relative "
|
3
|
-
v-if="!(designer.showMode&&props.widget.props.hide)"
|
4
|
-
:style="{width: 100/24 * props.widget.props.width + '%'}"
|
5
|
-
:class="designer.showMode||(widget.id == designer.widgetConfig.chosenId ? 'border-blue-700 border-2' : 'border-2 border-gray-100 ') + ' ' + (designer.showMode||(props.widget.type == 'homepage' ? 'overflow-y-auto py-5 ' : ''))">
|
6
|
-
<slot></slot>
|
7
|
-
<div v-if="widget.id == designer.widgetConfig.chosenId && widget.type != 'homepage'&&!designer.showMode"
|
8
|
-
class="absolute right-[-2px] top-[-22px] h-[20px] bg-blue-700">
|
9
|
-
<el-tooltip class="box-item" effect="dark" content="父级" placement="top">
|
10
|
-
<el-icon size="22" color="#ffffff" class="icon_item" @click.stop="gotoParent">
|
11
|
-
<Top />
|
12
|
-
</el-icon>
|
13
|
-
</el-tooltip>
|
14
|
-
<el-tooltip class="box-item" effect="dark" content="复制" placement="top">
|
15
|
-
<el-icon size="22" color="#ffffff" class="icon_item" @click.stop="copyWidget">
|
16
|
-
<CopyDocument />
|
17
|
-
</el-icon>
|
18
|
-
</el-tooltip>
|
19
|
-
<el-tooltip class="box-item" effect="dark" content="删除" placement="top">
|
20
|
-
<el-icon @click.stop="deleteWidget" size="22" color="#ffffff" class="icon_item">
|
21
|
-
<Delete />
|
22
|
-
</el-icon>
|
23
|
-
</el-tooltip>
|
24
|
-
</div>
|
25
|
-
<div v-if="props.widget.id == designer.widgetConfig.chosenId && props.widget.type != 'homepage'&&!designer.showMode"
|
26
|
-
class="handle absolute top-[-22px] h-[20px] bg-blue-700 text-gray-50 text-xs px-1 flex items-center justify-center cursor-pointer"
|
27
|
-
:class="(widget.type == 'homepage') ? 'right-[-2px]' : 'right-[68px]'">
|
28
|
-
<el-icon v-if="widget.type != 'homepage'" size="12" color="#ffffff" class="mr-1">
|
29
|
-
<Rank />
|
30
|
-
</el-icon>
|
31
|
-
{{ props.widget.displayName }}
|
32
|
-
</div>
|
33
|
-
</div>
|
34
|
-
</template>
|
35
|
-
|
36
|
-
<script setup>
|
37
|
-
import widgetConfig from '../../../widgetConfig';
|
38
|
-
import { ref, reactive, watch } from 'vue';
|
39
|
-
defineOptions({ name: "commonContainer" })
|
40
|
-
let props = defineProps({
|
41
|
-
designer: {
|
42
|
-
type: Object,
|
43
|
-
default: {}
|
44
|
-
},
|
45
|
-
widget: {
|
46
|
-
type: Object,
|
47
|
-
default: {}
|
48
|
-
},
|
49
|
-
parentWidget: {
|
50
|
-
type: Object,
|
51
|
-
default: {}
|
52
|
-
}
|
53
|
-
})
|
54
|
-
let widget = reactive(props.widget)
|
55
|
-
let designer = props.designer
|
56
|
-
let parentWidget = reactive(props.parentWidget)
|
57
|
-
|
58
|
-
let activeWidget = () => {
|
59
|
-
if(!designer.showMode){
|
60
|
-
designer.setChosenId(widget.id)
|
61
|
-
}
|
62
|
-
}
|
63
|
-
let deleteWidget = () => {
|
64
|
-
let widgetList = parentWidget.widgetList
|
65
|
-
let index = widgetList.findIndex(item => item.id == widget.id);
|
66
|
-
widgetList.splice(index, 1);
|
67
|
-
if (widgetList.length) {
|
68
|
-
if (index == 0) {
|
69
|
-
designer.setChosenId(widgetList[0].id)
|
70
|
-
} else {
|
71
|
-
designer.setChosenId(widgetList[index - 1].id)
|
72
|
-
}
|
73
|
-
} else {
|
74
|
-
designer.setChosenId(parentWidget.id)
|
75
|
-
}
|
76
|
-
}
|
77
|
-
let gotoParent = () => {
|
78
|
-
designer.setChosenId(parentWidget.id)
|
79
|
-
}
|
80
|
-
let copyWidget = () => {
|
81
|
-
let widgetList = parentWidget.widgetList
|
82
|
-
let index = widgetList.findIndex(item => item.id == widget.id);
|
83
|
-
let obj = widgetConfig[widget.type]
|
84
|
-
let newWidget = designer.getChosenInitData(obj)
|
85
|
-
widgetList.splice(index + 1, 0, newWidget);
|
86
|
-
}
|
87
|
-
</script>
|
88
|
-
|
89
|
-
<style scoped lang="scss">
|
90
|
-
@import url("../../../assets/font/iconfont.css");
|
91
|
-
|
92
|
-
.icon_item {
|
93
|
-
@apply px-1 cursor-pointer;
|
94
|
-
}
|
95
|
-
</style>
|