tianheng-ui 0.0.56 → 0.0.57
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/lib/039af9192b9bb277966ceb4e4ce29c41.js +16 -0
- package/lib/{c755e7fc08446566ee8dd3a8aa8fe43f.js → 2d84c80112a372bc149cad3464e90fa3.js} +404 -502
- package/lib/5977b934a4c6b480790864ea01303173.js +10834 -0
- package/lib/7745f3e776488705a38e62f85adad54d.js +16 -0
- package/lib/de8dee841ffdaaede3a2254deef30376.js +15395 -0
- package/lib/e78eab250e7f8ccac3d918dfdb06ca10.js +8904 -0
- package/lib/index.js +4 -2
- package/lib/theme-chalk/fonts/PingFang.ttf +0 -0
- package/lib/theme-chalk/fonts/bpmn.eot +0 -0
- package/lib/theme-chalk/fonts/bpmn.svg +224 -0
- package/lib/theme-chalk/fonts/bpmn.ttf +0 -0
- package/lib/theme-chalk/fonts/bpmn.woff +0 -0
- package/lib/theme-chalk/fonts/bpmn.woff2 +0 -0
- package/lib/theme-chalk/fonts/fontawesome-webfont.eot +0 -0
- package/lib/theme-chalk/fonts/fontawesome-webfont.svg +2671 -0
- package/lib/theme-chalk/fonts/fontawesome-webfont.ttf +0 -0
- package/lib/theme-chalk/fonts/fontawesome-webfont.woff +0 -0
- package/lib/theme-chalk/fonts/fontawesome-webfont.woff2 +0 -0
- package/lib/{iconfont.eot → theme-chalk/fonts/iconfont.eot} +0 -0
- package/lib/{iconfont.svg → theme-chalk/fonts/iconfont.svg} +0 -0
- package/lib/theme-chalk/fonts/iconfont.ttf +0 -0
- package/lib/theme-chalk/fonts/iconfont.woff +0 -0
- package/lib/theme-chalk/images/notData.png +0 -0
- package/lib/theme-chalk/index.scss +29 -0
- package/lib/theme-chalk/styles/button.scss +501 -0
- package/lib/theme-chalk/styles/card.scss +29 -0
- package/lib/theme-chalk/styles/cell.scss +54 -0
- package/lib/theme-chalk/styles/codeEditor.scss +9 -0
- package/lib/theme-chalk/styles/col.scss +151 -0
- package/lib/theme-chalk/styles/dialog.scss +59 -0
- package/lib/theme-chalk/styles/empty.scss +22 -0
- package/lib/theme-chalk/styles/feature.scss +42 -0
- package/lib/theme-chalk/styles/font.css +7 -0
- package/lib/theme-chalk/{icon.css → styles/icon.css} +3 -3
- package/lib/theme-chalk/styles/imagePreview.scss +113 -0
- package/lib/theme-chalk/styles/img.scss +35 -0
- package/lib/theme-chalk/styles/reset.scss +8 -0
- package/lib/theme-chalk/{root.css → styles/root.css} +2 -35
- package/lib/theme-chalk/styles/row.scss +23 -0
- package/lib/theme-chalk/styles/variable.scss +80 -0
- package/lib/tianheng-ui.js +71 -9
- package/package.json +24 -4
- package/packages/Button/index.js +8 -0
- package/packages/Button/index.vue +80 -0
- package/packages/Card/index.js +8 -0
- package/packages/Card/index.vue +37 -0
- package/packages/{cell → Cell}/index.js +0 -0
- package/packages/Cell/index.vue +68 -0
- package/packages/{codeEditor → CodeEditor}/index.js +0 -0
- package/packages/{codeEditor → CodeEditor}/index.vue +73 -108
- package/packages/Col/index.js +8 -0
- package/packages/Col/index.vue +41 -0
- package/packages/{dialog → Dialog}/index.js +0 -0
- package/packages/{dialog → Dialog}/index.vue +19 -10
- package/packages/Empty/images/notData.png +0 -0
- package/packages/{empty → Empty}/index.js +0 -0
- package/packages/Empty/index.vue +35 -0
- package/packages/FormMaking/Container.vue +1907 -0
- package/packages/{formMaking → FormMaking}/FormConfig.vue +22 -6
- package/packages/FormMaking/GenerateForm.vue +246 -0
- package/packages/{formMaking → FormMaking}/GenerateFormItem.vue +340 -172
- package/packages/FormMaking/GenerateFormItemH5.vue +828 -0
- package/packages/{formMaking → FormMaking}/Upload/index.vue +0 -0
- package/packages/FormMaking/WidgetConfig.vue +473 -0
- package/packages/{formMaking → FormMaking}/WidgetForm.vue +49 -31
- package/packages/FormMaking/WidgetFormItem.vue +157 -0
- package/packages/{formMaking/componentsConfig.js → FormMaking/custom/config.js} +379 -163
- package/packages/FormMaking/custom/configs/alliance.vue +0 -0
- package/packages/FormMaking/custom/configs/blank.vue +54 -0
- package/packages/FormMaking/custom/configs/button.vue +144 -0
- package/packages/FormMaking/custom/configs/cascader.vue +182 -0
- package/packages/FormMaking/custom/configs/cell.vue +81 -0
- package/packages/FormMaking/custom/configs/checkbox.vue +237 -0
- package/packages/FormMaking/custom/configs/color.vue +137 -0
- package/packages/FormMaking/custom/configs/date.vue +158 -0
- package/packages/FormMaking/custom/configs/divider.vue +61 -0
- package/packages/FormMaking/custom/configs/editor.vue +71 -0
- package/packages/FormMaking/custom/configs/filler.vue +52 -0
- package/packages/FormMaking/custom/configs/grid.vue +103 -0
- package/packages/FormMaking/custom/configs/image.vue +148 -0
- package/packages/FormMaking/custom/configs/input.vue +176 -0
- package/packages/FormMaking/custom/configs/number.vue +140 -0
- package/packages/FormMaking/custom/configs/radio.vue +215 -0
- package/packages/FormMaking/custom/configs/rate.vue +109 -0
- package/packages/FormMaking/custom/configs/select.vue +308 -0
- package/packages/FormMaking/custom/configs/slider.vue +142 -0
- package/packages/FormMaking/custom/configs/switch.vue +130 -0
- package/packages/FormMaking/custom/configs/table.vue +105 -0
- package/packages/FormMaking/custom/configs/table_h5.vue +102 -0
- package/packages/FormMaking/custom/configs/tabs.vue +175 -0
- package/packages/FormMaking/custom/configs/text.vue +71 -0
- package/packages/FormMaking/custom/configs/textarea.vue +167 -0
- package/packages/FormMaking/custom/configs/time.vue +153 -0
- package/packages/FormMaking/custom/configs/upload.vue +150 -0
- package/packages/FormMaking/custom/index.js +33 -0
- package/packages/FormMaking/custom/items/alliance.vue +132 -0
- package/packages/FormMaking/custom/items/blank.vue +16 -0
- package/packages/FormMaking/custom/items/button.vue +27 -0
- package/packages/FormMaking/custom/items/cascader.vue +29 -0
- package/packages/FormMaking/custom/items/cell.vue +18 -0
- package/packages/FormMaking/custom/items/checkbox.vue +46 -0
- package/packages/FormMaking/custom/items/color.vue +19 -0
- package/packages/FormMaking/custom/items/date.vue +29 -0
- package/packages/FormMaking/custom/items/divider.vue +14 -0
- package/packages/FormMaking/custom/items/editor.vue +22 -0
- package/packages/FormMaking/custom/items/filler.vue +17 -0
- package/packages/FormMaking/custom/items/grid.vue +129 -0
- package/packages/FormMaking/custom/items/image.vue +42 -0
- package/packages/FormMaking/custom/items/input.vue +36 -0
- package/packages/FormMaking/custom/items/login.vue +13 -0
- package/packages/FormMaking/custom/items/number.vue +24 -0
- package/packages/FormMaking/custom/items/radio.vue +44 -0
- package/packages/FormMaking/custom/items/rate.vue +20 -0
- package/packages/FormMaking/custom/items/select.vue +32 -0
- package/packages/FormMaking/custom/items/slider.vue +34 -0
- package/packages/FormMaking/custom/items/switch.vue +22 -0
- package/packages/FormMaking/custom/items/table.vue +106 -0
- package/packages/FormMaking/custom/items/table_h5.vue +126 -0
- package/packages/FormMaking/custom/items/tabs.vue +145 -0
- package/packages/FormMaking/custom/items/text.vue +18 -0
- package/packages/FormMaking/custom/items/textarea.vue +37 -0
- package/packages/FormMaking/custom/items/time.vue +32 -0
- package/packages/FormMaking/custom/items/upload.vue +83 -0
- package/packages/FormMaking/custom/mixins/index.js +61 -0
- package/packages/FormMaking/custom/register.js +18 -0
- package/packages/{formMaking → FormMaking}/iconfont/demo.css +0 -0
- package/packages/{formMaking → FormMaking}/iconfont/demo_index.html +0 -0
- package/packages/{formMaking → FormMaking}/iconfont/iconfont.css +0 -0
- package/packages/{formMaking → FormMaking}/iconfont/iconfont.eot +0 -0
- package/packages/{formMaking → FormMaking}/iconfont/iconfont.js +0 -0
- package/packages/{formMaking → FormMaking}/iconfont/iconfont.svg +0 -0
- package/{lib → packages/FormMaking/iconfont}/iconfont.ttf +0 -0
- package/{lib → packages/FormMaking/iconfont}/iconfont.woff +0 -0
- package/packages/{formMaking → FormMaking}/iconfont/iconfont.woff2 +0 -0
- package/packages/FormMaking/index.js +35 -0
- package/packages/{formMaking → FormMaking}/lang/en-US.js +1 -1
- package/packages/{formMaking → FormMaking}/lang/zh-CN.js +1 -1
- package/packages/{formMaking → FormMaking}/styles/cover.scss +1 -1
- package/packages/{formMaking → FormMaking}/styles/index.scss +445 -429
- package/packages/{formMaking → FormMaking/util}/generateCode.js +5 -5
- package/packages/{formMaking → FormMaking}/util/index.js +0 -0
- package/packages/{formMaking → FormMaking}/util/request.js +0 -0
- package/packages/{icons → Icons}/index.js +0 -0
- package/packages/{icons → Icons}/index.vue +26 -9
- package/packages/Image/index.js +8 -0
- package/packages/Image/index.vue +146 -0
- package/packages/ImagePreview/index.js +8 -0
- package/packages/ImagePreview/index.vue +386 -0
- package/packages/Row/index.js +8 -0
- package/packages/Row/index.vue +35 -0
- package/packages/{table → Table}/action.js +0 -0
- package/packages/{table → Table}/action.vue +1 -1
- package/packages/Table/column.vue +63 -0
- package/packages/{table → Table}/index.js +0 -0
- package/packages/{table → Table}/index.vue +25 -23
- package/packages/{table → Table}/search.js +0 -0
- package/packages/{table → Table}/search.vue +2 -2
- package/packages/{table → Table}/tools.js +0 -0
- package/packages/{table → Table}/tools.vue +0 -0
- package/packages/Workflow/Log.js +99 -0
- package/packages/Workflow/designer/ProcessDesigner.vue +628 -0
- package/packages/Workflow/designer/index.js +7 -0
- package/packages/Workflow/designer/plugins/content-pad/contentPadProvider.js +390 -0
- package/packages/Workflow/designer/plugins/content-pad/index.js +6 -0
- package/packages/Workflow/designer/plugins/defaultEmpty.js +24 -0
- package/packages/Workflow/designer/plugins/descriptor/activitiDescriptor.json +1071 -0
- package/packages/Workflow/designer/plugins/descriptor/camundaDescriptor.json +1087 -0
- package/packages/Workflow/designer/plugins/descriptor/flowableDescriptor.json +1215 -0
- package/packages/Workflow/designer/plugins/extension-moddle/activiti/activitiExtension.js +74 -0
- package/packages/Workflow/designer/plugins/extension-moddle/activiti/index.js +9 -0
- package/packages/Workflow/designer/plugins/extension-moddle/camunda/extension.js +148 -0
- package/packages/Workflow/designer/plugins/extension-moddle/camunda/index.js +6 -0
- package/packages/Workflow/designer/plugins/extension-moddle/flowable/flowableExtension.js +74 -0
- package/packages/Workflow/designer/plugins/extension-moddle/flowable/index.js +9 -0
- package/packages/Workflow/designer/plugins/palette/CustomPalette.js +156 -0
- package/packages/Workflow/designer/plugins/palette/index.js +6 -0
- package/packages/Workflow/designer/plugins/palette/paletteProvider.js +160 -0
- package/packages/Workflow/designer/plugins/translate/customTranslate.js +41 -0
- package/packages/Workflow/designer/plugins/translate/zh.js +238 -0
- package/packages/Workflow/highlight/index.js +5 -0
- package/packages/Workflow/index.js +26 -0
- package/packages/Workflow/index.vue +394 -0
- package/packages/Workflow/modules/auto-place/CustomAutoPlace.js +81 -0
- package/packages/Workflow/modules/auto-place/index.js +6 -0
- package/packages/Workflow/modules/custom-renderer/CustomRenderer.js +17 -0
- package/packages/Workflow/modules/custom-renderer/index.js +6 -0
- package/packages/Workflow/modules/rules/CustomRules.js +16 -0
- package/packages/Workflow/modules/rules/index.js +6 -0
- package/packages/Workflow/palette/ProcessPalette.vue +106 -0
- package/packages/Workflow/palette/index.js +7 -0
- package/packages/Workflow/penal/PropertiesPanel.vue +247 -0
- package/packages/Workflow/penal/base/ElementBaseInfo.vue +80 -0
- package/packages/Workflow/penal/flow-condition/FlowCondition.vue +142 -0
- package/packages/Workflow/penal/form/ElementForm.vue +367 -0
- package/packages/Workflow/penal/index.js +7 -0
- package/packages/Workflow/penal/listeners/ElementListeners.vue +299 -0
- package/packages/Workflow/penal/listeners/UserTaskListeners.vue +322 -0
- package/packages/Workflow/penal/listeners/template.js +178 -0
- package/packages/Workflow/penal/listeners/utilSelf.js +62 -0
- package/packages/Workflow/penal/multi-instance/ElementMultiInstance.vue +200 -0
- package/packages/Workflow/penal/other/ElementOtherConfig.vue +59 -0
- package/packages/Workflow/penal/properties/ElementProperties.vue +135 -0
- package/packages/Workflow/penal/signal-message/SignalAndMessage.vue +104 -0
- package/packages/Workflow/penal/task/ElementTask.vue +73 -0
- package/packages/Workflow/penal/task/task-components/ReceiveTask.vue +97 -0
- package/packages/Workflow/penal/task/task-components/ScriptTask.vue +85 -0
- package/packages/Workflow/penal/task/task-components/UserTask.vue +535 -0
- package/packages/Workflow/theme/element-variables.scss +70 -0
- package/packages/Workflow/theme/index.scss +2 -0
- package/packages/Workflow/theme/process-designer.scss +157 -0
- package/packages/Workflow/theme/process-panel.scss +107 -0
- package/packages/Workflow/translations.js +25 -0
- package/packages/Workflow/utils.js +71 -0
- package/packages/upload/ajax.js +85 -0
- package/packages/upload/index.js +8 -0
- package/packages/upload/index.vue +325 -0
- package/packages/upload/locale.js +9 -0
- package/packages/upload/upload-dragger.vue +70 -0
- package/packages/upload/upload-list.vue +101 -0
- package/packages/upload/upload.vue +211 -0
- package/lib/03250ed25fc1b305e9980cf7cf0dfb09.js +0 -1
- package/lib/theme-chalk/cell.css +0 -53
- package/lib/theme-chalk/dialog.css +0 -41
- package/lib/theme-chalk/empty.css +0 -27
- package/lib/theme-chalk/index.css +0 -6
- package/lib/theme-chalk/reset.css +0 -4
- package/lib/tianheng-ui.js.map +0 -1
- package/packages/cell/index.vue +0 -116
- package/packages/empty/index.vue +0 -33
- package/packages/formMaking/Container.vue +0 -591
- package/packages/formMaking/CusDialog.vue +0 -134
- package/packages/formMaking/GenerateForm.vue +0 -174
- package/packages/formMaking/WidgetConfig.vue +0 -1539
- package/packages/formMaking/WidgetFormItem.vue +0 -817
- package/packages/formMaking/iconfont/iconfont.ttf +0 -0
- package/packages/formMaking/iconfont/iconfont.woff +0 -0
- package/packages/formMaking/index.js +0 -77
- package/packages/table/column.vue +0 -111
@@ -1,591 +0,0 @@
|
|
1
|
-
<template>
|
2
|
-
<div class="fm-style">
|
3
|
-
<el-container class="fm2-container">
|
4
|
-
<el-main class="fm2-main">
|
5
|
-
<el-container>
|
6
|
-
<el-aside width="250px">
|
7
|
-
<div class="components-list">
|
8
|
-
<template v-if="basicFields.length">
|
9
|
-
<div class="widget-cate">
|
10
|
-
基础字段
|
11
|
-
</div>
|
12
|
-
<draggable
|
13
|
-
tag="ul"
|
14
|
-
:list="basicComponents"
|
15
|
-
v-bind="{
|
16
|
-
group: { name: 'people', pull: 'clone', put: false },
|
17
|
-
sort: false,
|
18
|
-
ghostClass: 'ghost'
|
19
|
-
}"
|
20
|
-
@end="handleMoveEnd"
|
21
|
-
@start="handleMoveStart"
|
22
|
-
:move="handleMove"
|
23
|
-
>
|
24
|
-
<template v-for="(item, index) in basicComponents">
|
25
|
-
<li
|
26
|
-
v-if="basicFields.indexOf(item.type) >= 0"
|
27
|
-
class="form-edit-widget-label"
|
28
|
-
:class="{ 'no-put': item.type == 'divider' }"
|
29
|
-
:key="index"
|
30
|
-
>
|
31
|
-
<a>
|
32
|
-
<i class="icon iconfont" :class="item.icon"></i>
|
33
|
-
<span>{{ item.name }}</span>
|
34
|
-
</a>
|
35
|
-
</li>
|
36
|
-
</template>
|
37
|
-
</draggable>
|
38
|
-
</template>
|
39
|
-
<template v-if="advanceFields.length">
|
40
|
-
<div class="widget-cate">
|
41
|
-
高级字段
|
42
|
-
</div>
|
43
|
-
<draggable
|
44
|
-
tag="ul"
|
45
|
-
:list="advanceComponents"
|
46
|
-
v-bind="{
|
47
|
-
group: { name: 'people', pull: 'clone', put: false },
|
48
|
-
sort: false,
|
49
|
-
ghostClass: 'ghost'
|
50
|
-
}"
|
51
|
-
@end="handleMoveEnd"
|
52
|
-
@start="handleMoveStart"
|
53
|
-
:move="handleMove"
|
54
|
-
>
|
55
|
-
<template v-for="(item, index) in advanceComponents">
|
56
|
-
<li
|
57
|
-
v-if="advanceFields.indexOf(item.type) >= 0"
|
58
|
-
class="form-edit-widget-label"
|
59
|
-
:class="{ 'no-put': item.type == 'table' }"
|
60
|
-
:key="index"
|
61
|
-
>
|
62
|
-
<a>
|
63
|
-
<i class="icon iconfont" :class="item.icon"></i>
|
64
|
-
<span>{{ item.name }}</span>
|
65
|
-
</a>
|
66
|
-
</li>
|
67
|
-
</template>
|
68
|
-
</draggable>
|
69
|
-
</template>
|
70
|
-
|
71
|
-
<template v-if="layoutFields.length">
|
72
|
-
<div class="widget-cate">
|
73
|
-
布局字段
|
74
|
-
</div>
|
75
|
-
<draggable
|
76
|
-
tag="ul"
|
77
|
-
:list="layoutComponents"
|
78
|
-
v-bind="{
|
79
|
-
group: { name: 'people', pull: 'clone', put: false },
|
80
|
-
sort: false,
|
81
|
-
ghostClass: 'ghost'
|
82
|
-
}"
|
83
|
-
>
|
84
|
-
<template v-for="(item, index) in layoutComponents">
|
85
|
-
<li
|
86
|
-
v-if="layoutFields.indexOf(item.type) >= 0"
|
87
|
-
class="form-edit-widget-label no-put"
|
88
|
-
:key="index"
|
89
|
-
>
|
90
|
-
<a>
|
91
|
-
<i class="icon iconfont" :class="item.icon"></i>
|
92
|
-
<span>{{ item.name }}</span>
|
93
|
-
</a>
|
94
|
-
</li>
|
95
|
-
</template>
|
96
|
-
</draggable>
|
97
|
-
</template>
|
98
|
-
</div>
|
99
|
-
</el-aside>
|
100
|
-
<el-container class="center-container" direction="vertical">
|
101
|
-
<el-header class="btn-bar" style="height: 45px;">
|
102
|
-
<slot name="action"> </slot>
|
103
|
-
<el-button
|
104
|
-
v-if="upload"
|
105
|
-
type="text"
|
106
|
-
size="medium"
|
107
|
-
icon="el-icon-upload2"
|
108
|
-
@click="handleUpload"
|
109
|
-
>导入JSON</el-button
|
110
|
-
>
|
111
|
-
<el-button
|
112
|
-
v-if="clearable"
|
113
|
-
type="text"
|
114
|
-
size="medium"
|
115
|
-
icon="el-icon-delete"
|
116
|
-
@click="handleClear"
|
117
|
-
>清空</el-button
|
118
|
-
>
|
119
|
-
<el-button
|
120
|
-
v-if="preview"
|
121
|
-
type="text"
|
122
|
-
size="medium"
|
123
|
-
icon="el-icon-view"
|
124
|
-
@click="handlePreview"
|
125
|
-
>预览</el-button
|
126
|
-
>
|
127
|
-
<el-button
|
128
|
-
v-if="generateJson"
|
129
|
-
type="text"
|
130
|
-
size="medium"
|
131
|
-
icon="el-icon-tickets"
|
132
|
-
@click="handleGenerateJson"
|
133
|
-
>生成JSON</el-button
|
134
|
-
>
|
135
|
-
<el-button
|
136
|
-
v-if="generateCode"
|
137
|
-
type="text"
|
138
|
-
size="medium"
|
139
|
-
icon="el-icon-document"
|
140
|
-
@click="handleGenerateCode"
|
141
|
-
>生成代码</el-button
|
142
|
-
>
|
143
|
-
</el-header>
|
144
|
-
<el-main :class="{ 'widget-empty': widgetForm.list.length == 0 }">
|
145
|
-
<widget-form
|
146
|
-
v-if="!resetJson"
|
147
|
-
ref="widgetForm"
|
148
|
-
:data="widgetForm"
|
149
|
-
:select.sync="widgetFormSelect"
|
150
|
-
>
|
151
|
-
</widget-form>
|
152
|
-
</el-main>
|
153
|
-
</el-container>
|
154
|
-
|
155
|
-
<el-aside class="widget-config-container">
|
156
|
-
<el-container>
|
157
|
-
<el-header height="45px">
|
158
|
-
<div
|
159
|
-
class="config-tab"
|
160
|
-
:class="{ active: configTab == 'widget' }"
|
161
|
-
@click="handleConfigSelect('widget')"
|
162
|
-
>
|
163
|
-
字段属性
|
164
|
-
</div>
|
165
|
-
<div
|
166
|
-
class="config-tab"
|
167
|
-
:class="{ active: configTab == 'form' }"
|
168
|
-
@click="handleConfigSelect('form')"
|
169
|
-
>
|
170
|
-
表单属性
|
171
|
-
</div>
|
172
|
-
</el-header>
|
173
|
-
<el-main class="config-content">
|
174
|
-
<widget-config
|
175
|
-
v-show="configTab == 'widget'"
|
176
|
-
:data="widgetFormSelect"
|
177
|
-
:remoteApis="remoteApis"
|
178
|
-
></widget-config>
|
179
|
-
<form-config
|
180
|
-
v-show="configTab == 'form'"
|
181
|
-
:data="widgetForm.config"
|
182
|
-
></form-config>
|
183
|
-
</el-main>
|
184
|
-
</el-container>
|
185
|
-
</el-aside>
|
186
|
-
|
187
|
-
<cus-dialog
|
188
|
-
:visible="previewVisible"
|
189
|
-
@on-close="previewVisible = false"
|
190
|
-
ref="widgetPreview"
|
191
|
-
width="1000px"
|
192
|
-
form
|
193
|
-
>
|
194
|
-
<generate-form
|
195
|
-
insite="true"
|
196
|
-
@on-change="handleDataChange"
|
197
|
-
v-if="previewVisible"
|
198
|
-
:data="widgetForm"
|
199
|
-
:value="widgetModels"
|
200
|
-
:remote="remoteFuncs"
|
201
|
-
:slotKeys="slotKeys"
|
202
|
-
ref="generateForm"
|
203
|
-
>
|
204
|
-
<template v-for="name in slotKeys" :slot="name">
|
205
|
-
<slot :name="name" />
|
206
|
-
</template>
|
207
|
-
</generate-form>
|
208
|
-
|
209
|
-
<template slot="action">
|
210
|
-
<el-button type="primary" @click="handleTest">获取数据</el-button>
|
211
|
-
<el-button @click="handleReset">重置</el-button>
|
212
|
-
</template>
|
213
|
-
</cus-dialog>
|
214
|
-
|
215
|
-
<cus-dialog
|
216
|
-
:visible="uploadVisible"
|
217
|
-
@on-close="uploadVisible = false"
|
218
|
-
@on-submit="handleUploadJson"
|
219
|
-
ref="uploadJson"
|
220
|
-
width="800px"
|
221
|
-
form
|
222
|
-
>
|
223
|
-
<el-alert
|
224
|
-
type="info"
|
225
|
-
title="JSON格式如下,直接复制生成的json覆盖此处代码点击确定即可"
|
226
|
-
></el-alert>
|
227
|
-
<div id="uploadeditor" style="height: 400px;width: 100%;">
|
228
|
-
{{ jsonEg }}
|
229
|
-
</div>
|
230
|
-
</cus-dialog>
|
231
|
-
|
232
|
-
<cus-dialog
|
233
|
-
:visible="jsonVisible"
|
234
|
-
@on-close="jsonVisible = false"
|
235
|
-
ref="jsonPreview"
|
236
|
-
width="800px"
|
237
|
-
form
|
238
|
-
>
|
239
|
-
<div id="jsoneditor" style="height: 400px;width: 100%;">
|
240
|
-
{{ jsonTemplate }}
|
241
|
-
</div>
|
242
|
-
|
243
|
-
<template slot="action">
|
244
|
-
<el-button
|
245
|
-
type="primary"
|
246
|
-
class="json-btn"
|
247
|
-
:data-clipboard-text="jsonCopyValue"
|
248
|
-
>复制数据</el-button
|
249
|
-
>
|
250
|
-
</template>
|
251
|
-
</cus-dialog>
|
252
|
-
|
253
|
-
<cus-dialog
|
254
|
-
:visible="codeVisible"
|
255
|
-
@on-close="codeVisible = false"
|
256
|
-
ref="codePreview"
|
257
|
-
width="800px"
|
258
|
-
form
|
259
|
-
:action="false"
|
260
|
-
>
|
261
|
-
<!-- <div id="codeeditor" style="height: 500px; width: 100%;">{{htmlTemplate}}</div> -->
|
262
|
-
<el-tabs
|
263
|
-
type="border-card"
|
264
|
-
style="box-shadow: none;"
|
265
|
-
v-model="codeActiveName"
|
266
|
-
>
|
267
|
-
<el-tab-pane label="Vue Component" name="vue">
|
268
|
-
<div id="vuecodeeditor" style="height: 500px; width: 100%;">
|
269
|
-
{{ vueTemplate }}
|
270
|
-
</div>
|
271
|
-
</el-tab-pane>
|
272
|
-
<el-tab-pane label="HTML" name="html">
|
273
|
-
<div id="codeeditor" style="height: 500px; width: 100%;">
|
274
|
-
{{ htmlTemplate }}
|
275
|
-
</div>
|
276
|
-
</el-tab-pane>
|
277
|
-
</el-tabs>
|
278
|
-
</cus-dialog>
|
279
|
-
</el-container>
|
280
|
-
</el-main>
|
281
|
-
<!-- <el-footer height="30px" style="font-weight: 600;"
|
282
|
-
>Powered by
|
283
|
-
<a target="_blank" href="https://github.com/GavinZhuLei/vue-form-making"
|
284
|
-
>vue-form-making</a
|
285
|
-
></el-footer
|
286
|
-
> -->
|
287
|
-
</el-container>
|
288
|
-
</div>
|
289
|
-
</template>
|
290
|
-
|
291
|
-
<script>
|
292
|
-
import ace from "ace-builds";
|
293
|
-
import "ace-builds/src-min-noconflict/mode-json";
|
294
|
-
import "ace-builds/src-min-noconflict/mode-html";
|
295
|
-
import htmlWorkerUrl from "file-loader!ace-builds/src-min-noconflict/worker-html";
|
296
|
-
ace.config.setModuleUrl("ace/mode/html_worker", htmlWorkerUrl);
|
297
|
-
import jsonWorkerUrl from "file-loader!ace-builds/src-noconflict/worker-json";
|
298
|
-
ace.config.setModuleUrl("ace/mode/json_worker", jsonWorkerUrl);
|
299
|
-
|
300
|
-
import Draggable from "vuedraggable";
|
301
|
-
import Clipboard from "clipboard";
|
302
|
-
import WidgetConfig from "./WidgetConfig";
|
303
|
-
import FormConfig from "./FormConfig";
|
304
|
-
import WidgetForm from "./WidgetForm";
|
305
|
-
import CusDialog from "./CusDialog";
|
306
|
-
import GenerateForm from "./GenerateForm";
|
307
|
-
import {
|
308
|
-
basicComponents,
|
309
|
-
advanceComponents,
|
310
|
-
layoutComponents
|
311
|
-
} from "./componentsConfig.js";
|
312
|
-
// import {loadJs, loadCss} from '../util/index.js'
|
313
|
-
import request from "./util/request";
|
314
|
-
import generateCode from "./generateCode.js";
|
315
|
-
|
316
|
-
export default {
|
317
|
-
name: "fm-making-form",
|
318
|
-
components: {
|
319
|
-
Draggable,
|
320
|
-
WidgetConfig,
|
321
|
-
FormConfig,
|
322
|
-
WidgetForm,
|
323
|
-
CusDialog,
|
324
|
-
GenerateForm
|
325
|
-
},
|
326
|
-
props: {
|
327
|
-
preview: {
|
328
|
-
type: Boolean,
|
329
|
-
default: false
|
330
|
-
},
|
331
|
-
generateCode: {
|
332
|
-
type: Boolean,
|
333
|
-
default: false
|
334
|
-
},
|
335
|
-
generateJson: {
|
336
|
-
type: Boolean,
|
337
|
-
default: false
|
338
|
-
},
|
339
|
-
upload: {
|
340
|
-
type: Boolean,
|
341
|
-
default: false
|
342
|
-
},
|
343
|
-
clearable: {
|
344
|
-
type: Boolean,
|
345
|
-
default: false
|
346
|
-
},
|
347
|
-
basicFields: {
|
348
|
-
type: Array,
|
349
|
-
default: () => [
|
350
|
-
"input",
|
351
|
-
"textarea",
|
352
|
-
"number",
|
353
|
-
"radio",
|
354
|
-
"checkbox",
|
355
|
-
"time",
|
356
|
-
"date",
|
357
|
-
"rate",
|
358
|
-
"color",
|
359
|
-
"select",
|
360
|
-
"switch",
|
361
|
-
"slider",
|
362
|
-
"text",
|
363
|
-
"button"
|
364
|
-
]
|
365
|
-
},
|
366
|
-
advanceFields: {
|
367
|
-
type: Array,
|
368
|
-
default: () => ["blank", "imgupload", "editor", "cascader", "table"]
|
369
|
-
},
|
370
|
-
layoutFields: {
|
371
|
-
type: Array,
|
372
|
-
default: () => ["grid", "tabs", "divider"]
|
373
|
-
},
|
374
|
-
remoteApis: {
|
375
|
-
type: Array,
|
376
|
-
default: () => []
|
377
|
-
}
|
378
|
-
},
|
379
|
-
data() {
|
380
|
-
return {
|
381
|
-
basicComponents,
|
382
|
-
layoutComponents,
|
383
|
-
advanceComponents,
|
384
|
-
resetJson: false,
|
385
|
-
widgetForm: {
|
386
|
-
list: [],
|
387
|
-
config: {
|
388
|
-
labelWidth: 100,
|
389
|
-
labelPosition: "right",
|
390
|
-
size: "small"
|
391
|
-
}
|
392
|
-
},
|
393
|
-
configTab: "widget",
|
394
|
-
widgetFormSelect: null,
|
395
|
-
previewVisible: false,
|
396
|
-
jsonVisible: false,
|
397
|
-
codeVisible: false,
|
398
|
-
uploadVisible: false,
|
399
|
-
remoteFuncs: {
|
400
|
-
func_test(resolve) {
|
401
|
-
setTimeout(() => {
|
402
|
-
const options = [
|
403
|
-
{ id: "1", name: "1111" },
|
404
|
-
{ id: "2", name: "2222" },
|
405
|
-
{ id: "3", name: "3333" }
|
406
|
-
];
|
407
|
-
|
408
|
-
resolve(options);
|
409
|
-
}, 2000);
|
410
|
-
},
|
411
|
-
funcGetToken(resolve) {
|
412
|
-
request
|
413
|
-
.get("http://tools-server.making.link/api/uptoken")
|
414
|
-
.then(res => {
|
415
|
-
resolve(res.uptoken);
|
416
|
-
});
|
417
|
-
},
|
418
|
-
upload_callback(response, file, fileList) {
|
419
|
-
console.log("callback", response, file, fileList);
|
420
|
-
}
|
421
|
-
},
|
422
|
-
widgetModels: { table: [{ name: "这是" }] },
|
423
|
-
blank: "",
|
424
|
-
htmlTemplate: "",
|
425
|
-
vueTemplate: "",
|
426
|
-
jsonTemplate: "",
|
427
|
-
uploadEditor: null,
|
428
|
-
jsonCopyValue: "",
|
429
|
-
jsonClipboard: null,
|
430
|
-
jsonEg: `
|
431
|
-
{
|
432
|
-
"list": [],
|
433
|
-
"config": {
|
434
|
-
"labelWidth": 100,
|
435
|
-
"labelPosition": "top",
|
436
|
-
"size": "small"
|
437
|
-
}
|
438
|
-
}`,
|
439
|
-
codeActiveName: "vue",
|
440
|
-
slotKeys: []
|
441
|
-
};
|
442
|
-
},
|
443
|
-
mounted() {
|
444
|
-
// this._loadComponents();
|
445
|
-
},
|
446
|
-
methods: {
|
447
|
-
// _loadComponents() {
|
448
|
-
// this.basicComponents = this.basicComponents.map(item => {
|
449
|
-
// return {
|
450
|
-
// ...item,
|
451
|
-
// name: this.$t(`fm.components.fields.${item.type}`)
|
452
|
-
// };
|
453
|
-
// });
|
454
|
-
// this.advanceComponents = this.advanceComponents.map(item => {
|
455
|
-
// return {
|
456
|
-
// ...item,
|
457
|
-
// name: this.$t(`fm.components.fields.${item.type}`)
|
458
|
-
// };
|
459
|
-
// });
|
460
|
-
// this.layoutComponents = this.layoutComponents.map(item => {
|
461
|
-
// return {
|
462
|
-
// ...item,
|
463
|
-
// name: this.$t(`fm.components.fields.${item.type}`)
|
464
|
-
// };
|
465
|
-
// });
|
466
|
-
// },
|
467
|
-
handleConfigSelect(value) {
|
468
|
-
this.configTab = value;
|
469
|
-
},
|
470
|
-
handleMoveEnd(evt) {
|
471
|
-
// console.log("end", evt);
|
472
|
-
},
|
473
|
-
handleMoveStart({ oldIndex }) {
|
474
|
-
// console.log("start", oldIndex, this.basicComponents);
|
475
|
-
},
|
476
|
-
handleMove() {
|
477
|
-
return true;
|
478
|
-
},
|
479
|
-
handlePreview() {
|
480
|
-
// console.log(this.widgetForm);
|
481
|
-
this.slotKeys = Object.keys(this.$slots);
|
482
|
-
this.previewVisible = true;
|
483
|
-
},
|
484
|
-
handleTest() {
|
485
|
-
this.$refs.generateForm
|
486
|
-
.getData()
|
487
|
-
.then(data => {
|
488
|
-
this.$alert(data, "").catch(e => {});
|
489
|
-
this.$refs.widgetPreview.end();
|
490
|
-
})
|
491
|
-
.catch(e => {
|
492
|
-
this.$refs.widgetPreview.end();
|
493
|
-
});
|
494
|
-
},
|
495
|
-
handleReset() {
|
496
|
-
this.$refs.generateForm.reset();
|
497
|
-
},
|
498
|
-
handleGenerateJson() {
|
499
|
-
this.jsonVisible = true;
|
500
|
-
this.jsonTemplate = this.widgetForm;
|
501
|
-
this.$nextTick(() => {
|
502
|
-
const editor = ace.edit("jsoneditor");
|
503
|
-
editor.session.setMode("ace/mode/json");
|
504
|
-
|
505
|
-
if (!this.jsonClipboard) {
|
506
|
-
this.jsonClipboard = new Clipboard(".json-btn");
|
507
|
-
this.jsonClipboard.on("success", e => {
|
508
|
-
this.$message.success("复制成功");
|
509
|
-
});
|
510
|
-
}
|
511
|
-
this.jsonCopyValue = JSON.stringify(this.widgetForm);
|
512
|
-
});
|
513
|
-
},
|
514
|
-
handleGenerateCode() {
|
515
|
-
this.codeVisible = true;
|
516
|
-
this.htmlTemplate = generateCode(JSON.stringify(this.widgetForm), "html");
|
517
|
-
this.vueTemplate = generateCode(JSON.stringify(this.widgetForm), "vue");
|
518
|
-
this.$nextTick(() => {
|
519
|
-
const editor = ace.edit("codeeditor");
|
520
|
-
editor.session.setMode("ace/mode/html");
|
521
|
-
|
522
|
-
const vueeditor = ace.edit("vuecodeeditor");
|
523
|
-
vueeditor.session.setMode("ace/mode/html");
|
524
|
-
});
|
525
|
-
},
|
526
|
-
handleUpload() {
|
527
|
-
this.uploadVisible = true;
|
528
|
-
this.$nextTick(() => {
|
529
|
-
this.uploadEditor = ace.edit("uploadeditor");
|
530
|
-
this.uploadEditor.session.setMode("ace/mode/json");
|
531
|
-
});
|
532
|
-
},
|
533
|
-
handleUploadJson() {
|
534
|
-
try {
|
535
|
-
this.setJSON(JSON.parse(this.uploadEditor.getValue()));
|
536
|
-
this.uploadVisible = false;
|
537
|
-
} catch (e) {
|
538
|
-
this.$message.error(e.message);
|
539
|
-
this.$refs.uploadJson.end();
|
540
|
-
}
|
541
|
-
},
|
542
|
-
handleClear() {
|
543
|
-
this.widgetForm = {
|
544
|
-
list: [],
|
545
|
-
config: {
|
546
|
-
labelWidth: 100,
|
547
|
-
labelPosition: "right",
|
548
|
-
size: "small",
|
549
|
-
customClass: ""
|
550
|
-
}
|
551
|
-
};
|
552
|
-
|
553
|
-
this.widgetFormSelect = {};
|
554
|
-
},
|
555
|
-
clear() {
|
556
|
-
this.handleClear();
|
557
|
-
},
|
558
|
-
getJSON() {
|
559
|
-
return this.widgetForm;
|
560
|
-
},
|
561
|
-
getHtml() {
|
562
|
-
return generateCode(JSON.stringify(this.widgetForm));
|
563
|
-
},
|
564
|
-
setJSON(json) {
|
565
|
-
this.widgetForm = json;
|
566
|
-
|
567
|
-
if (json.list.length > 0) {
|
568
|
-
this.widgetFormSelect = json.list[0];
|
569
|
-
}
|
570
|
-
},
|
571
|
-
handleInput(val) {
|
572
|
-
// console.log(val);
|
573
|
-
this.blank = val;
|
574
|
-
},
|
575
|
-
handleDataChange(field, value, data) {
|
576
|
-
// console.log(field, value, data);
|
577
|
-
}
|
578
|
-
},
|
579
|
-
watch: {
|
580
|
-
widgetForm: {
|
581
|
-
deep: true,
|
582
|
-
handler: function(val) {
|
583
|
-
// console.log(this.$refs.widgetForm);
|
584
|
-
}
|
585
|
-
},
|
586
|
-
$lang: function(val) {
|
587
|
-
this._loadComponents();
|
588
|
-
}
|
589
|
-
}
|
590
|
-
};
|
591
|
-
</script>
|