tianheng-ui 0.1.82 → 0.1.84
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +72 -72
- package/lib/theme-chalk/fonts/formMaking-iconfont.svg +155 -155
- package/lib/theme-chalk/fonts/th-iconfont.css +2402 -2402
- package/lib/theme-chalk/js/axios.js +87 -87
- package/lib/tianheng-ui.js +4 -4
- package/package.json +87 -86
- package/packages/FormMaking/GenerateForm.vue +392 -392
- package/packages/FormMaking/Upload/index.vue +571 -571
- package/packages/FormMaking/WidgetForm.vue +145 -145
- package/packages/FormMaking/custom/register.js +43 -43
- package/packages/FormMaking/iconfont/demo.css +539 -539
- package/packages/FormMaking/iconfont/demo_index.html +1159 -1159
- package/packages/FormMaking/iconfont/formMaking-iconfont.css +189 -189
- package/packages/FormMaking/iconfont/formMaking-iconfont.svg +155 -155
- package/packages/FormMaking/index.js +33 -33
- package/packages/FormMaking/lang/en-US.js +187 -187
- package/packages/FormMaking/lang/zh-CN.js +187 -187
- package/packages/FormMaking/network/axios.js +88 -88
- package/packages/FormMaking/styles/index.scss +216 -216
- package/packages/FormMaking/util/index.js +98 -98
- package/packages/TableMaking/network/axios.js +88 -88
@@ -1,145 +1,145 @@
|
|
1
|
-
<template>
|
2
|
-
<div class="widgetForm" ref="formContainer">
|
3
|
-
<th-empty
|
4
|
-
v-if="data.list.length == 0"
|
5
|
-
class="form-empty"
|
6
|
-
description="从左侧拖拽来添加字段"
|
7
|
-
></th-empty>
|
8
|
-
<el-form
|
9
|
-
:class="{ isHideFormLabel: data.config.hideLabel }"
|
10
|
-
style="margin: 0 auto;padding:5px;height:100%;"
|
11
|
-
:style="{ width: formWidth }"
|
12
|
-
:size="data.config.size"
|
13
|
-
:label-suffix="data.config.labelSuffix"
|
14
|
-
:label-position="data.config.labelPosition"
|
15
|
-
:label-width="`${data.config.labelWidth}px`"
|
16
|
-
:disabled="data.config.disabled"
|
17
|
-
>
|
18
|
-
<draggable
|
19
|
-
class="draggable"
|
20
|
-
v-model="data.list"
|
21
|
-
v-bind="{
|
22
|
-
group: 'people',
|
23
|
-
animation: 200,
|
24
|
-
handle: '.drag-widget',
|
25
|
-
ghostClass: 'draggable-ghost'
|
26
|
-
}"
|
27
|
-
@add="handleWidgetAdd"
|
28
|
-
>
|
29
|
-
<transition-group name="fade" tag="div" class="draggable-list">
|
30
|
-
<widget-form-item
|
31
|
-
v-for="(element, elementIndex) in widgetList"
|
32
|
-
:key="element.key"
|
33
|
-
:widget="element"
|
34
|
-
:widgetArray="data.list"
|
35
|
-
:widgetIndex="elementIndex"
|
36
|
-
:config="data.config"
|
37
|
-
:select.sync="selectWidget"
|
38
|
-
></widget-form-item>
|
39
|
-
</transition-group>
|
40
|
-
</draggable>
|
41
|
-
</el-form>
|
42
|
-
</div>
|
43
|
-
</template>
|
44
|
-
|
45
|
-
<script>
|
46
|
-
import { deepClone } from "./util/index";
|
47
|
-
import Draggable from "vuedraggable";
|
48
|
-
import WidgetFormItem from "./WidgetFormItem.vue";
|
49
|
-
|
50
|
-
export default {
|
51
|
-
components: { Draggable, WidgetFormItem },
|
52
|
-
props: ["data", "select", "client"],
|
53
|
-
data() {
|
54
|
-
return {
|
55
|
-
selectWidget: this.select,
|
56
|
-
config: {}
|
57
|
-
};
|
58
|
-
},
|
59
|
-
watch: {
|
60
|
-
select(val) {
|
61
|
-
this.selectWidget = val;
|
62
|
-
},
|
63
|
-
selectWidget: {
|
64
|
-
handler(val) {
|
65
|
-
this.$emit("update:select", val);
|
66
|
-
},
|
67
|
-
deep: true
|
68
|
-
}
|
69
|
-
},
|
70
|
-
computed: {
|
71
|
-
widgetList() {
|
72
|
-
return this.data.list.filter(item => {
|
73
|
-
return item.key;
|
74
|
-
});
|
75
|
-
},
|
76
|
-
formWidth() {
|
77
|
-
if (this.data.config.width) return this.data.config.width;
|
78
|
-
if (this.client === "mobile") return "375px";
|
79
|
-
|
80
|
-
return "";
|
81
|
-
}
|
82
|
-
},
|
83
|
-
mounted() {
|
84
|
-
document.body.ondrop = function(event) {
|
85
|
-
let s = navigator.userAgent;
|
86
|
-
let isFirefox =
|
87
|
-
typeof s === "string"
|
88
|
-
? s.toLowerCase().indexOf("firefox") > -1
|
89
|
-
: s.indexOf("firefox") > -1;
|
90
|
-
if (isFirefox) {
|
91
|
-
event.preventDefault();
|
92
|
-
event.stopPropagation();
|
93
|
-
}
|
94
|
-
};
|
95
|
-
},
|
96
|
-
methods: {
|
97
|
-
handleSelectWidget(index) {
|
98
|
-
this.selectWidget = this.data.list[index];
|
99
|
-
},
|
100
|
-
handleWidgetAdd(evt) {
|
101
|
-
const newIndex = evt.newIndex;
|
102
|
-
let newComponent = deepClone(this.data.list[newIndex]);
|
103
|
-
//为拖拽到容器的元素添加唯一 key
|
104
|
-
if (!newComponent.key) {
|
105
|
-
const key =
|
106
|
-
Date.parse(new Date()) + "_" + Math.ceil(Math.random() * 99999);
|
107
|
-
newComponent.key = key;
|
108
|
-
newComponent.model = newComponent.type + "_" + key;
|
109
|
-
}
|
110
|
-
|
111
|
-
this.$set(this.data.list, newIndex, newComponent);
|
112
|
-
this.selectWidget = this.data.list[newIndex];
|
113
|
-
}
|
114
|
-
}
|
115
|
-
};
|
116
|
-
</script>
|
117
|
-
|
118
|
-
<style lang="scss" scoped>
|
119
|
-
.widgetForm {
|
120
|
-
position: relative;
|
121
|
-
width: 100%;
|
122
|
-
height: calc(100% - 45px);
|
123
|
-
overflow-y: overlay;
|
124
|
-
|
125
|
-
.form-empty {
|
126
|
-
position: absolute;
|
127
|
-
text-align: center;
|
128
|
-
width: 400px;
|
129
|
-
top: 200px;
|
130
|
-
left: 50%;
|
131
|
-
margin-left: -200px;
|
132
|
-
color: #ccc;
|
133
|
-
|
134
|
-
.th-empty-description {
|
135
|
-
font-size: 20px;
|
136
|
-
}
|
137
|
-
}
|
138
|
-
.draggable {
|
139
|
-
height: 100%;
|
140
|
-
.draggable-list {
|
141
|
-
min-height: 100%;
|
142
|
-
}
|
143
|
-
}
|
144
|
-
}
|
145
|
-
</style>
|
1
|
+
<template>
|
2
|
+
<div class="widgetForm" ref="formContainer">
|
3
|
+
<th-empty
|
4
|
+
v-if="data.list.length == 0"
|
5
|
+
class="form-empty"
|
6
|
+
description="从左侧拖拽来添加字段"
|
7
|
+
></th-empty>
|
8
|
+
<el-form
|
9
|
+
:class="{ isHideFormLabel: data.config.hideLabel }"
|
10
|
+
style="margin: 0 auto;padding:5px;height:100%;"
|
11
|
+
:style="{ width: formWidth }"
|
12
|
+
:size="data.config.size"
|
13
|
+
:label-suffix="data.config.labelSuffix"
|
14
|
+
:label-position="data.config.labelPosition"
|
15
|
+
:label-width="`${data.config.labelWidth}px`"
|
16
|
+
:disabled="data.config.disabled"
|
17
|
+
>
|
18
|
+
<draggable
|
19
|
+
class="draggable"
|
20
|
+
v-model="data.list"
|
21
|
+
v-bind="{
|
22
|
+
group: 'people',
|
23
|
+
animation: 200,
|
24
|
+
handle: '.drag-widget',
|
25
|
+
ghostClass: 'draggable-ghost'
|
26
|
+
}"
|
27
|
+
@add="handleWidgetAdd"
|
28
|
+
>
|
29
|
+
<transition-group name="fade" tag="div" class="draggable-list">
|
30
|
+
<widget-form-item
|
31
|
+
v-for="(element, elementIndex) in widgetList"
|
32
|
+
:key="element.key"
|
33
|
+
:widget="element"
|
34
|
+
:widgetArray="data.list"
|
35
|
+
:widgetIndex="elementIndex"
|
36
|
+
:config="data.config"
|
37
|
+
:select.sync="selectWidget"
|
38
|
+
></widget-form-item>
|
39
|
+
</transition-group>
|
40
|
+
</draggable>
|
41
|
+
</el-form>
|
42
|
+
</div>
|
43
|
+
</template>
|
44
|
+
|
45
|
+
<script>
|
46
|
+
import { deepClone } from "./util/index";
|
47
|
+
import Draggable from "vuedraggable";
|
48
|
+
import WidgetFormItem from "./WidgetFormItem.vue";
|
49
|
+
|
50
|
+
export default {
|
51
|
+
components: { Draggable, WidgetFormItem },
|
52
|
+
props: ["data", "select", "client"],
|
53
|
+
data() {
|
54
|
+
return {
|
55
|
+
selectWidget: this.select,
|
56
|
+
config: {}
|
57
|
+
};
|
58
|
+
},
|
59
|
+
watch: {
|
60
|
+
select(val) {
|
61
|
+
this.selectWidget = val;
|
62
|
+
},
|
63
|
+
selectWidget: {
|
64
|
+
handler(val) {
|
65
|
+
this.$emit("update:select", val);
|
66
|
+
},
|
67
|
+
deep: true
|
68
|
+
}
|
69
|
+
},
|
70
|
+
computed: {
|
71
|
+
widgetList() {
|
72
|
+
return this.data.list.filter(item => {
|
73
|
+
return item.key;
|
74
|
+
});
|
75
|
+
},
|
76
|
+
formWidth() {
|
77
|
+
if (this.data.config.width) return this.data.config.width;
|
78
|
+
if (this.client === "mobile") return "375px";
|
79
|
+
|
80
|
+
return "";
|
81
|
+
}
|
82
|
+
},
|
83
|
+
mounted() {
|
84
|
+
document.body.ondrop = function(event) {
|
85
|
+
let s = navigator.userAgent;
|
86
|
+
let isFirefox =
|
87
|
+
typeof s === "string"
|
88
|
+
? s.toLowerCase().indexOf("firefox") > -1
|
89
|
+
: s.indexOf("firefox") > -1;
|
90
|
+
if (isFirefox) {
|
91
|
+
event.preventDefault();
|
92
|
+
event.stopPropagation();
|
93
|
+
}
|
94
|
+
};
|
95
|
+
},
|
96
|
+
methods: {
|
97
|
+
handleSelectWidget(index) {
|
98
|
+
this.selectWidget = this.data.list[index];
|
99
|
+
},
|
100
|
+
handleWidgetAdd(evt) {
|
101
|
+
const newIndex = evt.newIndex;
|
102
|
+
let newComponent = deepClone(this.data.list[newIndex]);
|
103
|
+
//为拖拽到容器的元素添加唯一 key
|
104
|
+
if (!newComponent.key) {
|
105
|
+
const key =
|
106
|
+
Date.parse(new Date()) + "_" + Math.ceil(Math.random() * 99999);
|
107
|
+
newComponent.key = key;
|
108
|
+
newComponent.model = newComponent.type + "_" + key;
|
109
|
+
}
|
110
|
+
|
111
|
+
this.$set(this.data.list, newIndex, newComponent);
|
112
|
+
this.selectWidget = this.data.list[newIndex];
|
113
|
+
}
|
114
|
+
}
|
115
|
+
};
|
116
|
+
</script>
|
117
|
+
|
118
|
+
<style lang="scss" scoped>
|
119
|
+
.widgetForm {
|
120
|
+
position: relative;
|
121
|
+
width: 100%;
|
122
|
+
height: calc(100% - 45px);
|
123
|
+
overflow-y: overlay;
|
124
|
+
|
125
|
+
.form-empty {
|
126
|
+
position: absolute;
|
127
|
+
text-align: center;
|
128
|
+
width: 400px;
|
129
|
+
top: 200px;
|
130
|
+
left: 50%;
|
131
|
+
margin-left: -200px;
|
132
|
+
color: #ccc;
|
133
|
+
|
134
|
+
.th-empty-description {
|
135
|
+
font-size: 20px;
|
136
|
+
}
|
137
|
+
}
|
138
|
+
.draggable {
|
139
|
+
height: 100%;
|
140
|
+
.draggable-list {
|
141
|
+
min-height: 100%;
|
142
|
+
}
|
143
|
+
}
|
144
|
+
}
|
145
|
+
</style>
|
@@ -1,43 +1,43 @@
|
|
1
|
-
//在此注册组件
|
2
|
-
import {
|
3
|
-
basicComponents,
|
4
|
-
advanceComponents,
|
5
|
-
layoutComponents,
|
6
|
-
businessComponents
|
7
|
-
} from "./config";
|
8
|
-
|
9
|
-
let compsData = {};
|
10
|
-
for (const config of basicComponents) {
|
11
|
-
compsData[config.type] = {
|
12
|
-
name: config.name,
|
13
|
-
type: config.type,
|
14
|
-
config: config,
|
15
|
-
content: null
|
16
|
-
};
|
17
|
-
}
|
18
|
-
for (const config of advanceComponents) {
|
19
|
-
compsData[config.type] = {
|
20
|
-
name: config.name,
|
21
|
-
type: config.type,
|
22
|
-
config: config,
|
23
|
-
content: null
|
24
|
-
};
|
25
|
-
}
|
26
|
-
for (const config of layoutComponents) {
|
27
|
-
compsData[config.type] = {
|
28
|
-
name: config.name,
|
29
|
-
type: config.type,
|
30
|
-
config: config,
|
31
|
-
content: null
|
32
|
-
};
|
33
|
-
}
|
34
|
-
for (const config of businessComponents) {
|
35
|
-
compsData[config.type] = {
|
36
|
-
name: config.name,
|
37
|
-
type: config.type,
|
38
|
-
config: config,
|
39
|
-
content: null
|
40
|
-
};
|
41
|
-
}
|
42
|
-
|
43
|
-
export default compsData;
|
1
|
+
//在此注册组件
|
2
|
+
import {
|
3
|
+
basicComponents,
|
4
|
+
advanceComponents,
|
5
|
+
layoutComponents,
|
6
|
+
businessComponents
|
7
|
+
} from "./config";
|
8
|
+
|
9
|
+
let compsData = {};
|
10
|
+
for (const config of basicComponents) {
|
11
|
+
compsData[config.type] = {
|
12
|
+
name: config.name,
|
13
|
+
type: config.type,
|
14
|
+
config: config,
|
15
|
+
content: null
|
16
|
+
};
|
17
|
+
}
|
18
|
+
for (const config of advanceComponents) {
|
19
|
+
compsData[config.type] = {
|
20
|
+
name: config.name,
|
21
|
+
type: config.type,
|
22
|
+
config: config,
|
23
|
+
content: null
|
24
|
+
};
|
25
|
+
}
|
26
|
+
for (const config of layoutComponents) {
|
27
|
+
compsData[config.type] = {
|
28
|
+
name: config.name,
|
29
|
+
type: config.type,
|
30
|
+
config: config,
|
31
|
+
content: null
|
32
|
+
};
|
33
|
+
}
|
34
|
+
for (const config of businessComponents) {
|
35
|
+
compsData[config.type] = {
|
36
|
+
name: config.name,
|
37
|
+
type: config.type,
|
38
|
+
config: config,
|
39
|
+
content: null
|
40
|
+
};
|
41
|
+
}
|
42
|
+
|
43
|
+
export default compsData;
|