tianheng-ui 0.0.59 → 0.0.62
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/index.js +41 -3
- package/lib/theme-chalk/styles/upload.scss +744 -598
- package/lib/tianheng-ui.js +23 -38
- package/package.json +1 -2
- package/packages/Button/index.vue +4 -4
- package/packages/CodeEditor/index.vue +1 -1
- package/packages/FormMaking/GenerateForm.vue +69 -35
- package/packages/FormMaking/WidgetForm.vue +12 -5
- package/packages/FormMaking/custom/items/button.vue +2 -2
- package/packages/FormMaking/custom/items/input.vue +0 -3
- package/packages/{upload → Upload}/ajax.js +0 -0
- package/packages/{upload → Upload}/index.js +0 -0
- package/packages/{upload → Upload}/index.vue +1 -1
- package/packages/{upload → Upload}/upload-dragger.vue +1 -1
- package/packages/{upload → Upload}/upload-list.vue +12 -14
- package/packages/{upload → Upload}/upload.vue +18 -36
- package/packages/Workflow/penal/listeners/utilSelf.js +3 -1
- package/packages/upload/locale.js +0 -9
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "tianheng-ui",
|
3
3
|
"description": "A Vue.js project",
|
4
|
-
"version": "0.0.
|
4
|
+
"version": "0.0.62",
|
5
5
|
"author": "shu lang <403732931@qq.com>",
|
6
6
|
"license": "MIT",
|
7
7
|
"private": false,
|
@@ -25,7 +25,6 @@
|
|
25
25
|
"mini-css-extract-plugin": "^2.6.1",
|
26
26
|
"normalize.css": "^8.0.1",
|
27
27
|
"nprogress": "^0.2.0",
|
28
|
-
"vant": "^2.12.50",
|
29
28
|
"viewerjs": "^1.10.5",
|
30
29
|
"vue": "^2.5.11",
|
31
30
|
"vue-i18n": "^5.0.3",
|
@@ -58,16 +58,16 @@ export default {
|
|
58
58
|
];
|
59
59
|
return className;
|
60
60
|
},
|
61
|
-
|
62
|
-
return (this.
|
61
|
+
_thFormItemSize() {
|
62
|
+
return (this.thFormItem || {}).thFormItemSize;
|
63
63
|
},
|
64
64
|
buttonSize() {
|
65
|
-
return this.size || this.
|
65
|
+
return this.size || this._thFormItemSize || (this.$ELEMENT || {}).size;
|
66
66
|
},
|
67
67
|
buttonDisabled() {
|
68
68
|
return this.$options.propsData.hasOwnProperty("disabled")
|
69
69
|
? this.disabled
|
70
|
-
: (this.
|
70
|
+
: (this.thForm || {}).disabled;
|
71
71
|
}
|
72
72
|
},
|
73
73
|
|
@@ -1,24 +1,24 @@
|
|
1
1
|
<template>
|
2
|
-
<div>
|
2
|
+
<div v-if="formJson.config">
|
3
3
|
<el-form
|
4
4
|
class="generateForm"
|
5
|
-
:class="{ 'form-hideLabel':
|
5
|
+
:class="{ 'form-hideLabel': formJson.config.hideLabel }"
|
6
6
|
:style="{ width: formWidth }"
|
7
|
-
:label-suffix="
|
8
|
-
:size="
|
7
|
+
:label-suffix="formJson.config.labelSuffix"
|
8
|
+
:size="formJson.config.size"
|
9
9
|
:model="models"
|
10
|
-
:label-position="
|
11
|
-
:label-width="
|
10
|
+
:label-position="formJson.config.labelPosition"
|
11
|
+
:label-width="formJson.config.labelWidth + 'px'"
|
12
12
|
ref="generateForm"
|
13
13
|
>
|
14
14
|
<genetate-form-item
|
15
|
-
v-for="item in
|
15
|
+
v-for="item in formJson.list"
|
16
16
|
:key="item.key"
|
17
17
|
:models.sync="models"
|
18
18
|
:widget="item"
|
19
19
|
:slotKeys="slotKeys"
|
20
20
|
:remote="remote"
|
21
|
-
:config="
|
21
|
+
:config="formJson.config"
|
22
22
|
:prop="item.type === 'grid' ? '' : item.model"
|
23
23
|
:componentsData="componentsData"
|
24
24
|
@input-change="onInputChange"
|
@@ -31,21 +31,21 @@
|
|
31
31
|
<!-- <van-form
|
32
32
|
v-else
|
33
33
|
class="generateForm"
|
34
|
-
:class="{ 'form-hideLabel':
|
34
|
+
:class="{ 'form-hideLabel': formJson.config.hideLabel }"
|
35
35
|
:style="{ width: formWidth }"
|
36
36
|
style="margin: 0 auto;"
|
37
|
-
:label-align="
|
38
|
-
:label-width="
|
37
|
+
:label-align="formJson.config.labelPosition"
|
38
|
+
:label-width="formJson.config.labelWidth + 'px'"
|
39
39
|
ref="generateForm"
|
40
40
|
>
|
41
41
|
<genetate-form-item-h5
|
42
|
-
v-for="item in
|
42
|
+
v-for="item in formJson.list"
|
43
43
|
:key="item.key"
|
44
44
|
:models.sync="models"
|
45
45
|
:widget="item"
|
46
46
|
:slotKeys="slotKeys"
|
47
47
|
:remote="remote"
|
48
|
-
:config="
|
48
|
+
:config="formJson.config"
|
49
49
|
:prop="item.type === 'grid' ? '' : item.model"
|
50
50
|
:componentsData="componentsData"
|
51
51
|
@input-change="onInputChange"
|
@@ -60,35 +60,80 @@
|
|
60
60
|
|
61
61
|
<script>
|
62
62
|
import GenetateFormItem from "./GenerateFormItem";
|
63
|
-
import GenetateFormItemH5 from "./GenerateFormItemH5";
|
64
|
-
import Vue from "vue";
|
65
|
-
import { Form } from "vant";
|
66
|
-
Vue.use(Form);
|
63
|
+
// import GenetateFormItemH5 from "./GenerateFormItemH5";
|
64
|
+
// import Vue from "vue";
|
65
|
+
// import { Form } from "vant";
|
66
|
+
// Vue.use(Form);
|
67
67
|
|
68
68
|
export default {
|
69
69
|
name: "th-generate-form",
|
70
|
-
components: { GenetateFormItem
|
71
|
-
props:
|
70
|
+
components: { GenetateFormItem },
|
71
|
+
props: {
|
72
|
+
data: {
|
73
|
+
type: Object,
|
74
|
+
default: () => {
|
75
|
+
return {};
|
76
|
+
}
|
77
|
+
},
|
78
|
+
remote: {
|
79
|
+
type: Object,
|
80
|
+
default: () => {
|
81
|
+
return {};
|
82
|
+
}
|
83
|
+
},
|
84
|
+
value: {
|
85
|
+
type: Object,
|
86
|
+
default: () => {
|
87
|
+
return {};
|
88
|
+
}
|
89
|
+
},
|
90
|
+
slotKeys: {
|
91
|
+
type: Array,
|
92
|
+
default: () => {
|
93
|
+
return [];
|
94
|
+
}
|
95
|
+
},
|
96
|
+
client: String
|
97
|
+
},
|
72
98
|
data() {
|
73
99
|
return {
|
100
|
+
formJson: this.data,
|
74
101
|
models: {},
|
75
102
|
componentsData: []
|
76
103
|
};
|
77
104
|
},
|
78
105
|
computed: {
|
79
106
|
formWidth() {
|
80
|
-
if (this.
|
107
|
+
if (this.formJson.config.width) return this.formJson.config.width;
|
81
108
|
if (this.client === "mobile") return "375px";
|
82
109
|
|
83
110
|
return "";
|
84
111
|
}
|
85
112
|
},
|
113
|
+
watch: {
|
114
|
+
data(val) {
|
115
|
+
this.formJson = val;
|
116
|
+
},
|
117
|
+
formJson: {
|
118
|
+
handler(val) {
|
119
|
+
this.$emit("update:data", val);
|
120
|
+
},
|
121
|
+
deep: true
|
122
|
+
},
|
123
|
+
value: {
|
124
|
+
deep: true,
|
125
|
+
handler(val) {
|
126
|
+
this.models = { ...this.models, ...val };
|
127
|
+
}
|
128
|
+
}
|
129
|
+
},
|
86
130
|
created() {
|
87
|
-
this.generateModle(this.
|
131
|
+
this.generateModle(this.formJson.list);
|
88
132
|
},
|
89
133
|
mounted() {},
|
90
134
|
methods: {
|
91
135
|
generateModle(genList, modelObj) {
|
136
|
+
if (!genList) return;
|
92
137
|
genList.map(item => {
|
93
138
|
if (item.type === "grid") {
|
94
139
|
item.columns.forEach(item => {
|
@@ -185,20 +230,9 @@ export default {
|
|
185
230
|
onInputChange(value, field) {
|
186
231
|
this.$emit("on-change", field, value, this.models);
|
187
232
|
},
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
data: {
|
192
|
-
deep: true,
|
193
|
-
handler(val) {
|
194
|
-
// this.generateModle(val.list);
|
195
|
-
}
|
196
|
-
},
|
197
|
-
value: {
|
198
|
-
deep: true,
|
199
|
-
handler(val) {
|
200
|
-
this.models = { ...this.models, ...val };
|
201
|
-
}
|
233
|
+
setJSON(json) {
|
234
|
+
this.formJson = json;
|
235
|
+
this.generateModle(this.formJson.list);
|
202
236
|
}
|
203
237
|
}
|
204
238
|
};
|
@@ -33,10 +33,8 @@
|
|
33
33
|
>
|
34
34
|
<transition-group name="fade" tag="div" class="widget-form-list">
|
35
35
|
<widget-form-item
|
36
|
-
v-for="(element, elementIndex) in
|
37
|
-
|
38
|
-
})"
|
39
|
-
:key="elementIndex"
|
36
|
+
v-for="(element, elementIndex) in widgetList"
|
37
|
+
:key="element.key"
|
40
38
|
:widget="element"
|
41
39
|
:widgetIndex="elementIndex"
|
42
40
|
:widgetArray="data"
|
@@ -75,6 +73,11 @@ export default {
|
|
75
73
|
}
|
76
74
|
},
|
77
75
|
computed: {
|
76
|
+
widgetList() {
|
77
|
+
return this.data.list.filter(item => {
|
78
|
+
return item.key;
|
79
|
+
});
|
80
|
+
},
|
78
81
|
formWidth() {
|
79
82
|
if (this.data.config.width) return this.data.config.width;
|
80
83
|
if (this.client === "mobile") return "375px";
|
@@ -84,7 +87,11 @@ export default {
|
|
84
87
|
},
|
85
88
|
mounted() {
|
86
89
|
document.body.ondrop = function(event) {
|
87
|
-
let
|
90
|
+
let s = navigator.userAgent;
|
91
|
+
let isFirefox =
|
92
|
+
typeof s === "string"
|
93
|
+
? s.toLowerCase().indexOf("firefox") > -1
|
94
|
+
: s.indexOf("firefox") > -1;
|
88
95
|
if (isFirefox) {
|
89
96
|
event.preventDefault();
|
90
97
|
event.stopPropagation();
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<template>
|
2
|
-
<
|
2
|
+
<th-button
|
3
3
|
:style="{
|
4
4
|
width: widget.options.width,
|
5
5
|
height: widget.options.height
|
@@ -14,7 +14,7 @@
|
|
14
14
|
:icon="widget.options.buttonIcon"
|
15
15
|
>
|
16
16
|
{{ widget.options.defaultValue }}
|
17
|
-
</
|
17
|
+
</th-button>
|
18
18
|
</template>
|
19
19
|
|
20
20
|
<script>
|
File without changes
|
File without changes
|
@@ -283,7 +283,7 @@ export default {
|
|
283
283
|
action: this.action,
|
284
284
|
multiple: this.multiple,
|
285
285
|
'before-upload': this.beforeUpload,
|
286
|
-
'with-credentials': this.withCredentials,
|
286
|
+
// 'with-credentials': this.withCredentials,
|
287
287
|
headers: this.headers,
|
288
288
|
name: this.name,
|
289
289
|
data: this.data,
|
@@ -2,16 +2,16 @@
|
|
2
2
|
<transition-group
|
3
3
|
tag="ul"
|
4
4
|
:class="[
|
5
|
-
'
|
6
|
-
'
|
5
|
+
'th-upload-list',
|
6
|
+
'th-upload-list--' + listType,
|
7
7
|
{ 'is-disabled': disabled }
|
8
8
|
]"
|
9
|
-
name="
|
9
|
+
name="th-list"
|
10
10
|
>
|
11
11
|
<li
|
12
12
|
v-for="file in files"
|
13
13
|
:class="[
|
14
|
-
'
|
14
|
+
'th-upload-list__item',
|
15
15
|
'is-' + file.status,
|
16
16
|
focusing ? 'focusing' : ''
|
17
17
|
]"
|
@@ -24,7 +24,7 @@
|
|
24
24
|
>
|
25
25
|
<slot :file="file">
|
26
26
|
<img
|
27
|
-
class="
|
27
|
+
class="th-upload-list__item-thumbnail"
|
28
28
|
v-if="
|
29
29
|
file.status !== 'uploading' &&
|
30
30
|
['picture-card', 'picture'].indexOf(listType) > -1
|
@@ -32,10 +32,10 @@
|
|
32
32
|
:src="file.url"
|
33
33
|
alt=""
|
34
34
|
/>
|
35
|
-
<a class="
|
35
|
+
<a class="th-upload-list__item-name" @click="handleClick(file)">
|
36
36
|
<i class="el-icon-document"></i>{{ file.name }}
|
37
37
|
</a>
|
38
|
-
<label class="
|
38
|
+
<label class="th-upload-list__item-status-label">
|
39
39
|
<i
|
40
40
|
:class="{
|
41
41
|
'el-icon-upload-success': true,
|
@@ -50,9 +50,9 @@
|
|
50
50
|
v-if="!disabled"
|
51
51
|
@click="$emit('remove', file)"
|
52
52
|
></i>
|
53
|
-
<i class="el-icon-close-tip" v-if="!disabled">{{
|
53
|
+
<!-- <i class="el-icon-close-tip" v-if="!disabled">{{
|
54
54
|
t("el.upload.deleteTip")
|
55
|
-
}}</i>
|
55
|
+
}}</i> -->
|
56
56
|
<!--因为close按钮只在li:focus的时候 display, li blur后就不存在了,所以键盘导航时永远无法 focus到 close按钮上-->
|
57
57
|
<el-progress
|
58
58
|
v-if="file.status === 'uploading'"
|
@@ -62,11 +62,11 @@
|
|
62
62
|
>
|
63
63
|
</el-progress>
|
64
64
|
<span
|
65
|
-
class="
|
65
|
+
class="th-upload-list__item-actions"
|
66
66
|
v-if="listType === 'picture-card'"
|
67
67
|
>
|
68
68
|
<span
|
69
|
-
class="
|
69
|
+
class="th-upload-list__item-preview"
|
70
70
|
v-if="handlePreview && listType === 'picture-card'"
|
71
71
|
@click="handlePreview(file)"
|
72
72
|
>
|
@@ -74,7 +74,7 @@
|
|
74
74
|
</span>
|
75
75
|
<span
|
76
76
|
v-if="!disabled"
|
77
|
-
class="
|
77
|
+
class="th-upload-list__item-delete"
|
78
78
|
@click="$emit('remove', file)"
|
79
79
|
>
|
80
80
|
<i class="el-icon-delete"></i>
|
@@ -85,11 +85,9 @@
|
|
85
85
|
</transition-group>
|
86
86
|
</template>
|
87
87
|
<script>
|
88
|
-
import Locale from "element-ui/src/mixins/locale";
|
89
88
|
import ElProgress from "element-ui/packages/progress";
|
90
89
|
export default {
|
91
90
|
name: "ThUploadList",
|
92
|
-
mixins: [Locale],
|
93
91
|
data() {
|
94
92
|
return {
|
95
93
|
focusing: false
|
@@ -1,3 +1,12 @@
|
|
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
|
+
|
1
10
|
<script>
|
2
11
|
import ajax from './ajax';
|
3
12
|
import UploadDragger from './upload-dragger.vue';
|
@@ -54,7 +63,15 @@ export default {
|
|
54
63
|
reqs: {}
|
55
64
|
};
|
56
65
|
},
|
57
|
-
|
66
|
+
computed: {
|
67
|
+
classMatch(){
|
68
|
+
const classGroup = {
|
69
|
+
'th-upload': true
|
70
|
+
}
|
71
|
+
classGroup[`th-upload--${this.listType}`] = true;
|
72
|
+
return classGroup
|
73
|
+
},
|
74
|
+
},
|
58
75
|
methods: {
|
59
76
|
isImage(str) {
|
60
77
|
return str.indexOf('image') !== -1;
|
@@ -172,40 +189,5 @@ export default {
|
|
172
189
|
}
|
173
190
|
}
|
174
191
|
},
|
175
|
-
|
176
|
-
render(h) {
|
177
|
-
let {
|
178
|
-
handleClick,
|
179
|
-
drag,
|
180
|
-
name,
|
181
|
-
handleChange,
|
182
|
-
multiple,
|
183
|
-
accept,
|
184
|
-
listType,
|
185
|
-
uploadFiles,
|
186
|
-
disabled,
|
187
|
-
handleKeydown
|
188
|
-
} = this;
|
189
|
-
const data = {
|
190
|
-
class: {
|
191
|
-
'el-upload': true
|
192
|
-
},
|
193
|
-
on: {
|
194
|
-
click: handleClick,
|
195
|
-
keydown: handleKeydown
|
196
|
-
}
|
197
|
-
};
|
198
|
-
data.class[`el-upload--${listType}`] = true;
|
199
|
-
return (
|
200
|
-
<div {...data} tabindex="0" >
|
201
|
-
{
|
202
|
-
drag
|
203
|
-
? <upload-dragger disabled={disabled} on-file={uploadFiles}>{this.$slots.default}</upload-dragger>
|
204
|
-
: this.$slots.default
|
205
|
-
}
|
206
|
-
<input class="el-upload__input" type="file" ref="input" name={name} on-change={handleChange} multiple={multiple} accept={accept}></input>
|
207
|
-
</div>
|
208
|
-
);
|
209
|
-
}
|
210
192
|
};
|
211
193
|
</script>
|
@@ -17,7 +17,9 @@ export function initListenerForm(listener) {
|
|
17
17
|
console.log(listener.eventDefinitions, key);
|
18
18
|
if (key.indexOf("time") !== -1) {
|
19
19
|
k = key;
|
20
|
-
|
20
|
+
let s = key.replace("time", "");
|
21
|
+
self.eventDefinitionType =
|
22
|
+
typeof s === "string" ? s.toLowerCase() : s;
|
21
23
|
}
|
22
24
|
}
|
23
25
|
console.log(k);
|