tianheng-ui 0.1.0 → 0.1.1
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/README.md +9 -18
- package/lib/039af9192b9bb277966ceb4e4ce29c41.js +16 -0
- package/lib/2d84c80112a372bc149cad3464e90fa3.js +1617 -0
- 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/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/theme-chalk/fonts/iconfont.eot +0 -0
- package/lib/theme-chalk/fonts/iconfont.svg +155 -0
- package/lib/theme-chalk/fonts/iconfont.ttf +0 -0
- package/lib/theme-chalk/fonts/iconfont.woff +0 -0
- package/lib/theme-chalk/fonts/iconfont.woff2 +0 -0
- package/lib/theme-chalk/images/notData.png +0 -0
- package/lib/theme-chalk/index.scss +31 -0
- package/lib/theme-chalk/js/Log.js +99 -0
- package/lib/theme-chalk/js/axios.js +86 -0
- package/lib/theme-chalk/js/store/getters.js +5 -0
- package/lib/theme-chalk/js/store/modules/makingForm.js +21 -0
- package/lib/theme-chalk/js/store/store.js +26 -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 +56 -0
- package/lib/theme-chalk/styles/empty.scss +22 -0
- package/lib/theme-chalk/styles/feature.scss +46 -0
- package/lib/theme-chalk/styles/font.css +7 -0
- package/lib/theme-chalk/styles/grid.scss +41 -0
- package/lib/theme-chalk/styles/icon.css +1944 -0
- 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 +17 -0
- package/lib/theme-chalk/styles/root.css +64 -0
- package/lib/theme-chalk/styles/row.scss +23 -0
- package/lib/theme-chalk/styles/upload.scss +744 -0
- package/lib/theme-chalk/styles/variable.scss +80 -0
- package/lib/tianheng-ui.js +116 -0
- package/package.json +86 -48
- 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/index.js +8 -0
- package/packages/Cell/index.vue +68 -0
- package/packages/CodeEditor/index.js +8 -0
- package/packages/CodeEditor/index.vue +177 -0
- package/packages/Col/index.js +8 -0
- package/packages/Col/index.vue +43 -0
- package/packages/Dialog/index.js +8 -0
- package/packages/Dialog/index.vue +129 -0
- package/packages/Empty/index.js +8 -0
- package/packages/Empty/index.vue +35 -0
- package/packages/FormMaking/FormConfig.vue +60 -0
- package/packages/FormMaking/GenerateForm.vue +308 -0
- package/packages/FormMaking/GenerateFormItem.vue +887 -0
- package/packages/FormMaking/GenerateFormItemH5.vue +825 -0
- package/packages/FormMaking/Upload/index.vue +572 -0
- package/packages/FormMaking/WidgetConfig.vue +472 -0
- package/packages/FormMaking/WidgetForm.vue +159 -0
- package/packages/FormMaking/WidgetFormItem.vue +187 -0
- package/packages/FormMaking/custom/config.js +762 -0
- 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 +172 -0
- package/packages/FormMaking/custom/configs/cascader.vue +175 -0
- package/packages/FormMaking/custom/configs/cell.vue +81 -0
- package/packages/FormMaking/custom/configs/checkbox.vue +234 -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 +57 -0
- package/packages/FormMaking/custom/configs/grid.vue +103 -0
- package/packages/FormMaking/custom/configs/image.vue +138 -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 +211 -0
- package/packages/FormMaking/custom/configs/rate.vue +109 -0
- package/packages/FormMaking/custom/configs/select.vue +305 -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 +155 -0
- package/packages/FormMaking/custom/index.js +32 -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 +130 -0
- package/packages/FormMaking/custom/items/image.vue +70 -0
- package/packages/FormMaking/custom/items/input.vue +33 -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 +102 -0
- package/packages/FormMaking/custom/mixins/index.js +61 -0
- package/packages/FormMaking/custom/register.js +18 -0
- package/packages/FormMaking/generate.js +5 -0
- package/packages/FormMaking/iconfont/demo.css +539 -0
- package/packages/FormMaking/iconfont/demo_index.html +1159 -0
- package/packages/FormMaking/iconfont/iconfont.css +189 -0
- package/packages/FormMaking/iconfont/iconfont.eot +0 -0
- package/packages/FormMaking/iconfont/iconfont.js +1 -0
- package/packages/FormMaking/iconfont/iconfont.svg +155 -0
- package/packages/FormMaking/iconfont/iconfont.ttf +0 -0
- package/packages/FormMaking/iconfont/iconfont.woff +0 -0
- package/packages/FormMaking/iconfont/iconfont.woff2 +0 -0
- package/packages/FormMaking/index.js +33 -0
- package/packages/FormMaking/index.vue +807 -0
- package/packages/FormMaking/lang/en-US.js +187 -0
- package/packages/FormMaking/lang/zh-CN.js +187 -0
- package/packages/FormMaking/making.js +9 -0
- package/packages/FormMaking/styles/cover.scss +41 -0
- package/packages/FormMaking/styles/index.scss +785 -0
- package/packages/FormMaking/util/generateCode.js +163 -0
- package/packages/FormMaking/util/index.js +33 -0
- package/packages/FormMaking/util/request.js +28 -0
- package/packages/Grid/index.js +8 -0
- package/packages/Grid/index.vue +21 -0
- package/packages/GridItem/index.js +8 -0
- package/packages/GridItem/index.vue +69 -0
- package/packages/Icons/index.js +8 -0
- package/packages/Icons/index.vue +377 -0
- 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 +33 -0
- package/packages/Table/action.js +8 -0
- package/packages/Table/action.vue +168 -0
- package/packages/Table/column.vue +63 -0
- package/packages/Table/index.js +8 -0
- package/packages/Table/index.vue +327 -0
- package/packages/Table/search.js +8 -0
- package/packages/Table/search.vue +163 -0
- package/packages/Table/tools.js +8 -0
- package/packages/Table/tools.vue +49 -0
- package/packages/TableMaking/custom/configs/fieldSearch.vue +17 -0
- package/packages/TableMaking/custom/configs/fieldTable.vue +15 -0
- package/packages/TableMaking/custom/items/search/index.vue +158 -0
- package/packages/TableMaking/custom/items/tools/index.vue +49 -0
- package/packages/TableMaking/generate.js +5 -0
- package/packages/TableMaking/generateTable.vue +560 -0
- package/packages/TableMaking/index.vue +234 -0
- package/packages/TableMaking/making.js +5 -0
- package/packages/TableMaking/util/index.js +433 -0
- package/packages/TableMaking/widgetConfig.vue +390 -0
- package/packages/TableMaking/widgetTable.vue +305 -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/upload-dragger.vue +70 -0
- package/packages/Upload/upload-list.vue +121 -0
- package/packages/Upload/upload.vue +193 -0
- package/packages/VueEditor/index.js +8 -0
- package/packages/VueEditor/index.vue +38 -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 +34 -0
- package/packages/Workflow/index.vue +399 -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 +245 -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 +64 -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/index.js +160 -0
- package/babel.config.js +0 -15
- package/index.js +0 -11
- package/public/favicon.ico +0 -0
- package/public/index.html +0 -17
- package/src/App.vue +0 -28
- package/src/assets/logo.png +0 -0
- package/src/components/HelloWorld.vue +0 -58
- package/src/main.js +0 -8
@@ -0,0 +1,193 @@
|
|
1
|
+
<template>
|
2
|
+
<div @click="handleClick" :class="classMatch" @keydown="handleKeydown" tabindex="0" >
|
3
|
+
<upload-dragger v-if="drag" :disabled="disabled" @file="uploadFiles"><slot></slot></upload-dragger>
|
4
|
+
<slot v-else></slot>
|
5
|
+
<input class="th-upload__input" type="file" ref="input" :name="name" @change="handleChange" :multiple="multiple" :accept="accept"></input>
|
6
|
+
</div>
|
7
|
+
</template>
|
8
|
+
|
9
|
+
|
10
|
+
<script>
|
11
|
+
import ajax from './ajax';
|
12
|
+
import UploadDragger from './upload-dragger.vue';
|
13
|
+
|
14
|
+
export default {
|
15
|
+
inject: ['uploader'],
|
16
|
+
components: {
|
17
|
+
UploadDragger
|
18
|
+
},
|
19
|
+
props: {
|
20
|
+
type: String,
|
21
|
+
action: {
|
22
|
+
type: String,
|
23
|
+
required: true
|
24
|
+
},
|
25
|
+
name: {
|
26
|
+
type: String,
|
27
|
+
default: 'file'
|
28
|
+
},
|
29
|
+
data: Object,
|
30
|
+
headers: Object,
|
31
|
+
withCredentials: Boolean,
|
32
|
+
multiple: Boolean,
|
33
|
+
accept: String,
|
34
|
+
onStart: Function,
|
35
|
+
onProgress: Function,
|
36
|
+
onSuccess: Function,
|
37
|
+
onError: Function,
|
38
|
+
beforeUpload: Function,
|
39
|
+
drag: Boolean,
|
40
|
+
onPreview: {
|
41
|
+
type: Function,
|
42
|
+
default: function() {}
|
43
|
+
},
|
44
|
+
onRemove: {
|
45
|
+
type: Function,
|
46
|
+
default: function() {}
|
47
|
+
},
|
48
|
+
fileList: Array,
|
49
|
+
autoUpload: Boolean,
|
50
|
+
listType: String,
|
51
|
+
httpRequest: {
|
52
|
+
type: Function,
|
53
|
+
default: ajax
|
54
|
+
},
|
55
|
+
disabled: Boolean,
|
56
|
+
limit: Number,
|
57
|
+
onExceed: Function
|
58
|
+
},
|
59
|
+
|
60
|
+
data() {
|
61
|
+
return {
|
62
|
+
mouseover: false,
|
63
|
+
reqs: {}
|
64
|
+
};
|
65
|
+
},
|
66
|
+
computed: {
|
67
|
+
classMatch(){
|
68
|
+
const classGroup = {
|
69
|
+
'th-upload': true
|
70
|
+
}
|
71
|
+
classGroup[`th-upload--${this.listType}`] = true;
|
72
|
+
return classGroup
|
73
|
+
},
|
74
|
+
},
|
75
|
+
methods: {
|
76
|
+
isImage(str) {
|
77
|
+
return str.indexOf('image') !== -1;
|
78
|
+
},
|
79
|
+
handleChange(ev) {
|
80
|
+
const files = ev.target.files;
|
81
|
+
|
82
|
+
if (!files) return;
|
83
|
+
this.uploadFiles(files);
|
84
|
+
},
|
85
|
+
uploadFiles(files) {
|
86
|
+
if (this.limit && this.fileList.length + files.length > this.limit) {
|
87
|
+
this.onExceed && this.onExceed(files, this.fileList);
|
88
|
+
return;
|
89
|
+
}
|
90
|
+
|
91
|
+
let postFiles = Array.prototype.slice.call(files);
|
92
|
+
if (!this.multiple) { postFiles = postFiles.slice(0, 1); }
|
93
|
+
|
94
|
+
if (postFiles.length === 0) { return; }
|
95
|
+
|
96
|
+
postFiles.forEach(rawFile => {
|
97
|
+
this.onStart(rawFile);
|
98
|
+
if (this.autoUpload) this.upload(rawFile);
|
99
|
+
});
|
100
|
+
},
|
101
|
+
upload(rawFile) {
|
102
|
+
this.$refs.input.value = null;
|
103
|
+
|
104
|
+
if (!this.beforeUpload) {
|
105
|
+
return this.post(rawFile);
|
106
|
+
}
|
107
|
+
|
108
|
+
const before = this.beforeUpload(rawFile);
|
109
|
+
if (before && before.then) {
|
110
|
+
before.then(processedFile => {
|
111
|
+
const fileType = Object.prototype.toString.call(processedFile);
|
112
|
+
|
113
|
+
if (fileType === '[object File]' || fileType === '[object Blob]') {
|
114
|
+
if (fileType === '[object Blob]') {
|
115
|
+
processedFile = new File([processedFile], rawFile.name, {
|
116
|
+
type: rawFile.type
|
117
|
+
});
|
118
|
+
}
|
119
|
+
for (const p in rawFile) {
|
120
|
+
if (rawFile.hasOwnProperty(p)) {
|
121
|
+
processedFile[p] = rawFile[p];
|
122
|
+
}
|
123
|
+
}
|
124
|
+
this.post(processedFile);
|
125
|
+
} else {
|
126
|
+
this.post(rawFile);
|
127
|
+
}
|
128
|
+
}, () => {
|
129
|
+
this.onRemove(null, rawFile);
|
130
|
+
});
|
131
|
+
} else if (before !== false) {
|
132
|
+
this.post(rawFile);
|
133
|
+
} else {
|
134
|
+
this.onRemove(null, rawFile);
|
135
|
+
}
|
136
|
+
},
|
137
|
+
abort(file) {
|
138
|
+
const { reqs } = this;
|
139
|
+
if (file) {
|
140
|
+
let uid = file;
|
141
|
+
if (file.uid) uid = file.uid;
|
142
|
+
if (reqs[uid]) {
|
143
|
+
reqs[uid].abort();
|
144
|
+
}
|
145
|
+
} else {
|
146
|
+
Object.keys(reqs).forEach((uid) => {
|
147
|
+
if (reqs[uid]) reqs[uid].abort();
|
148
|
+
delete reqs[uid];
|
149
|
+
});
|
150
|
+
}
|
151
|
+
},
|
152
|
+
post(rawFile) {
|
153
|
+
const { uid } = rawFile;
|
154
|
+
const options = {
|
155
|
+
headers: this.headers,
|
156
|
+
withCredentials: this.withCredentials,
|
157
|
+
file: rawFile,
|
158
|
+
data: this.data,
|
159
|
+
filename: this.name,
|
160
|
+
action: this.action,
|
161
|
+
onProgress: e => {
|
162
|
+
this.onProgress(e, rawFile);
|
163
|
+
},
|
164
|
+
onSuccess: res => {
|
165
|
+
this.onSuccess(res, rawFile);
|
166
|
+
delete this.reqs[uid];
|
167
|
+
},
|
168
|
+
onError: err => {
|
169
|
+
this.onError(err, rawFile);
|
170
|
+
delete this.reqs[uid];
|
171
|
+
}
|
172
|
+
};
|
173
|
+
const req = this.httpRequest(options);
|
174
|
+
this.reqs[uid] = req;
|
175
|
+
if (req && req.then) {
|
176
|
+
req.then(options.onSuccess, options.onError);
|
177
|
+
}
|
178
|
+
},
|
179
|
+
handleClick() {
|
180
|
+
if (!this.disabled) {
|
181
|
+
this.$refs.input.value = null;
|
182
|
+
this.$refs.input.click();
|
183
|
+
}
|
184
|
+
},
|
185
|
+
handleKeydown(e) {
|
186
|
+
if (e.target !== e.currentTarget) return;
|
187
|
+
if (e.keyCode === 13 || e.keyCode === 32) {
|
188
|
+
this.handleClick();
|
189
|
+
}
|
190
|
+
}
|
191
|
+
},
|
192
|
+
};
|
193
|
+
</script>
|
@@ -0,0 +1,38 @@
|
|
1
|
+
<template>
|
2
|
+
<vue-editor v-model="data" :disabled="disabled"> </vue-editor>
|
3
|
+
</template>
|
4
|
+
|
5
|
+
<script>
|
6
|
+
import { VueEditor } from "vue2-editor";
|
7
|
+
export default {
|
8
|
+
name: "ThVueEditor",
|
9
|
+
components: { VueEditor },
|
10
|
+
model: {
|
11
|
+
prop: "value",
|
12
|
+
event: "upload:value"
|
13
|
+
},
|
14
|
+
props: {
|
15
|
+
value: String,
|
16
|
+
disabled: Boolean
|
17
|
+
},
|
18
|
+
data() {
|
19
|
+
return {
|
20
|
+
data: this.value
|
21
|
+
};
|
22
|
+
},
|
23
|
+
watch: {
|
24
|
+
data: {
|
25
|
+
handler(val) {
|
26
|
+
this.$emit("upload:value", val);
|
27
|
+
},
|
28
|
+
deep: true
|
29
|
+
},
|
30
|
+
value(val) {
|
31
|
+
this.data = val;
|
32
|
+
}
|
33
|
+
},
|
34
|
+
methods: {}
|
35
|
+
};
|
36
|
+
</script>
|
37
|
+
|
38
|
+
<style></style>
|
@@ -0,0 +1,99 @@
|
|
1
|
+
function Log() {}
|
2
|
+
|
3
|
+
Log.prototype.type = ["primary", "success", "warn", "error", "info"];
|
4
|
+
|
5
|
+
Log.prototype.typeColor = function(type) {
|
6
|
+
let color = "";
|
7
|
+
switch (type) {
|
8
|
+
case "primary":
|
9
|
+
color = "#2d8cf0";
|
10
|
+
break;
|
11
|
+
case "success":
|
12
|
+
color = "#19be6b";
|
13
|
+
break;
|
14
|
+
case "info":
|
15
|
+
color = "#909399";
|
16
|
+
break;
|
17
|
+
case "warn":
|
18
|
+
color = "#ff9900";
|
19
|
+
break;
|
20
|
+
case "error":
|
21
|
+
color = "#f03f14";
|
22
|
+
break;
|
23
|
+
default:
|
24
|
+
color = "#35495E";
|
25
|
+
break;
|
26
|
+
}
|
27
|
+
return color;
|
28
|
+
};
|
29
|
+
|
30
|
+
Log.prototype.isArray = function(obj) {
|
31
|
+
return Object.prototype.toString.call(obj) === "[object Array]";
|
32
|
+
};
|
33
|
+
|
34
|
+
Log.prototype.print = function(text, type = "default", back = false) {
|
35
|
+
if (typeof text === "object") {
|
36
|
+
// 如果是對象則調用打印對象方式
|
37
|
+
this.isArray(text) ? console.table(text) : console.dir(text);
|
38
|
+
return;
|
39
|
+
}
|
40
|
+
if (back) {
|
41
|
+
// 如果是打印帶背景圖的
|
42
|
+
console.log(`%c ${text} `, `background:${this.typeColor(type)}; padding: 2px; border-radius: 4px; color: #fff;`);
|
43
|
+
} else {
|
44
|
+
console.log(
|
45
|
+
`%c ${text} `,
|
46
|
+
`border: 1px solid ${this.typeColor(type)};
|
47
|
+
padding: 2px; border-radius: 4px;
|
48
|
+
color: ${this.typeColor(type)};`
|
49
|
+
);
|
50
|
+
}
|
51
|
+
};
|
52
|
+
|
53
|
+
Log.prototype.printBack = function(type = "primary", title) {
|
54
|
+
this.print(type, title, true);
|
55
|
+
};
|
56
|
+
|
57
|
+
Log.prototype.pretty = function(type = "primary", title, text) {
|
58
|
+
if (typeof text === "object") {
|
59
|
+
console.group("Console Group", title);
|
60
|
+
console.log(
|
61
|
+
`%c ${title}`,
|
62
|
+
`background:${this.typeColor(type)};border:1px solid ${this.typeColor(type)};
|
63
|
+
padding: 1px; border-radius: 4px; color: #fff;`
|
64
|
+
);
|
65
|
+
this.isArray(text) ? console.table(text) : console.dir(text);
|
66
|
+
console.groupEnd();
|
67
|
+
return;
|
68
|
+
}
|
69
|
+
console.log(
|
70
|
+
`%c ${title} %c ${text} %c`,
|
71
|
+
`background:${this.typeColor(type)};border:1px solid ${this.typeColor(type)};
|
72
|
+
padding: 1px; border-radius: 4px 0 0 4px; color: #fff;`,
|
73
|
+
`border:1px solid ${this.typeColor(type)};
|
74
|
+
padding: 1px; border-radius: 0 4px 4px 0; color: ${this.typeColor(type)};`,
|
75
|
+
"background:transparent"
|
76
|
+
);
|
77
|
+
};
|
78
|
+
|
79
|
+
Log.prototype.prettyPrimary = function(title, ...text) {
|
80
|
+
text.forEach(t => this.pretty("primary", title, t));
|
81
|
+
};
|
82
|
+
|
83
|
+
Log.prototype.prettySuccess = function(title, ...text) {
|
84
|
+
text.forEach(t => this.pretty("success", title, t));
|
85
|
+
};
|
86
|
+
|
87
|
+
Log.prototype.prettyWarn = function(title, ...text) {
|
88
|
+
text.forEach(t => this.pretty("warn", title, t));
|
89
|
+
};
|
90
|
+
|
91
|
+
Log.prototype.prettyError = function(title, ...text) {
|
92
|
+
text.forEach(t => this.pretty("error", title, t));
|
93
|
+
};
|
94
|
+
|
95
|
+
Log.prototype.prettyInfo = function(title, ...text) {
|
96
|
+
text.forEach(t => this.pretty("info", title, t));
|
97
|
+
};
|
98
|
+
|
99
|
+
export default new Log();
|