iov-design 2.15.46 → 2.15.48
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/alert.js +2 -2
- package/lib/aside.js +2 -2
- package/lib/autocomplete.js +2 -2
- package/lib/avatar.js +2 -2
- package/lib/backtop.js +2 -2
- package/lib/badge.js +2 -2
- package/lib/breadcrumb-item.js +2 -2
- package/lib/breadcrumb.js +2 -2
- package/lib/button-group.js +2 -2
- package/lib/button.js +2 -2
- package/lib/calendar.js +4 -4
- package/lib/card.js +2 -2
- package/lib/carousel-item.js +2 -2
- package/lib/carousel.js +16 -16
- package/lib/cascader-panel.js +6 -6
- package/lib/cascader.js +96 -96
- package/lib/checkbox-button.js +2 -2
- package/lib/checkbox-group.js +2 -2
- package/lib/checkbox.js +2 -2
- package/lib/col.js +2 -2
- package/lib/collapse-item.js +23 -23
- package/lib/collapse.js +2 -2
- package/lib/color-picker.js +2 -2
- package/lib/container.js +2 -2
- package/lib/date-picker.js +70 -91
- package/lib/descriptions-item.js +2 -2
- package/lib/descriptions.js +2 -2
- package/lib/dialog.js +9 -9
- package/lib/divider.js +2 -2
- package/lib/dropdown-item.js +2 -2
- package/lib/dropdown-menu.js +2 -2
- package/lib/dropdown.js +11 -11
- package/lib/empty.js +9 -9
- package/lib/footer.js +2 -2
- package/lib/form-item.js +4 -4
- package/lib/form.js +2 -2
- package/lib/header.js +2 -2
- package/lib/icon.js +2 -2
- package/lib/image.js +9 -9
- package/lib/index.js +1 -1
- package/lib/infinite-scroll.js +2 -2
- package/lib/input-number.js +62 -62
- package/lib/iov-design.common.js +968 -163
- package/lib/link.js +2 -2
- package/lib/loading.js +11 -11
- package/lib/main.js +2 -2
- package/lib/menu-item-group.js +2 -2
- package/lib/menu-item.js +65 -65
- package/lib/menu.js +2 -2
- package/lib/message-box.js +11 -11
- package/lib/message.js +9 -9
- package/lib/notification.js +9 -9
- package/lib/option-group.js +2 -2
- package/lib/option.js +4 -4
- package/lib/page-header.js +2 -2
- package/lib/pagination.js +6 -6
- package/lib/popconfirm.js +24 -24
- package/lib/popover.js +9 -9
- package/lib/progress.js +2 -2
- package/lib/radio-button.js +2 -2
- package/lib/radio-group.js +2 -2
- package/lib/radio.js +9 -9
- package/lib/rate.js +23 -23
- package/lib/result.js +2 -2
- package/lib/row.js +2 -2
- package/lib/scrollbar.js +4 -4
- package/lib/select.js +18 -18
- package/lib/skeleton-item.js +2 -2
- package/lib/skeleton.js +2 -2
- package/lib/slider.js +4 -4
- package/lib/spinner.js +2 -2
- package/lib/static/excel.dc22a8c4.png +1 -0
- package/lib/static/excel.f44318e.png +0 -0
- package/lib/static/excel.f44318e0.png +0 -0
- package/lib/static/file.4ed3551.png +0 -0
- package/lib/static/file.4ed35511.png +0 -0
- package/lib/static/file.c0509952.png +1 -0
- package/lib/static/img.8229bb3e.png +1 -0
- package/lib/static/img.cd179e5.png +0 -0
- package/lib/static/img.cd179e5b.png +0 -0
- package/lib/static/pdf.79cb57f.png +0 -0
- package/lib/static/pdf.79cb57f8.png +0 -0
- package/lib/static/pdf.f5235ea1.png +1 -0
- package/lib/static/ppt.5eedddef.png +1 -0
- package/lib/static/ppt.eed4918.png +0 -0
- package/lib/static/ppt.eed4918e.png +0 -0
- package/lib/static/word.35070ef.png +0 -0
- package/lib/static/word.35070ef0.png +0 -0
- package/lib/static/word.5fe9189c.png +1 -0
- package/lib/static/zip.dca21a8.png +0 -0
- package/lib/static/zip.dca21a88.png +0 -0
- package/lib/static/zip.e2bfc796.png +1 -0
- package/lib/statistic.js +4 -4
- package/lib/step.js +2 -2
- package/lib/steps.js +9 -9
- package/lib/submenu.js +4 -4
- package/lib/switch.js +2 -2
- package/lib/tab-pane.js +2 -2
- package/lib/table-column.js +2 -2
- package/lib/table.js +23 -15
- package/lib/tabs.js +2 -2
- package/lib/tag.js +2 -2
- package/lib/theme-chalk/assets/img_fail.png +0 -0
- package/lib/theme-chalk/assets/img_placeholder.png +0 -0
- package/lib/theme-chalk/base.css +1 -1
- package/lib/theme-chalk/dialog.css +1 -1
- package/lib/theme-chalk/index.css +1 -1
- package/lib/theme-chalk/iovfont.css +1 -1
- package/lib/theme-chalk/upload.css +1 -1
- package/lib/time-picker.js +12 -12
- package/lib/time-select.js +9 -9
- package/lib/timeline-item.js +2 -2
- package/lib/timeline.js +2 -2
- package/lib/tooltip.js +2 -2
- package/lib/transfer.js +11 -11
- package/lib/tree.js +2 -2
- package/lib/upload.js +920 -119
- package/package.json +1 -1
- package/packages/theme-chalk/src/assets/img_fail.png +0 -0
- package/packages/theme-chalk/src/assets/img_placeholder.png +0 -0
- package/packages/theme-chalk/src/dialog.scss +4 -0
- package/packages/theme-chalk/src/iovfont.scss +3 -3
- package/packages/theme-chalk/src/upload.scss +568 -603
- package/packages/upload/src/assets/excel.png +0 -0
- package/packages/upload/src/assets/file.png +0 -0
- package/packages/upload/src/assets/img.png +0 -0
- package/packages/upload/src/assets/pdf.png +0 -0
- package/packages/upload/src/assets/ppt.png +0 -0
- package/packages/upload/src/assets/word.png +0 -0
- package/packages/upload/src/assets/zip.png +0 -0
- package/packages/upload/src/index.vue +73 -5
- package/packages/upload/src/upload-file.vue +90 -0
- package/packages/upload/src/upload-list.vue +52 -50
- package/packages/upload/src/upload-picture.vue +90 -0
- package/packages/upload/src/upload.vue +231 -211
- package/packages/upload/src/utils.js +30 -0
- package/src/index.js +1 -1
|
@@ -1,211 +1,231 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import ajax from './ajax';
|
|
3
|
-
import UploadDragger from './upload-dragger.vue';
|
|
4
|
-
|
|
5
|
-
export default {
|
|
6
|
-
inject: ['uploader'],
|
|
7
|
-
components: {
|
|
8
|
-
UploadDragger
|
|
9
|
-
},
|
|
10
|
-
props: {
|
|
11
|
-
type: String,
|
|
12
|
-
action: {
|
|
13
|
-
type: String,
|
|
14
|
-
required: true
|
|
15
|
-
},
|
|
16
|
-
name: {
|
|
17
|
-
type: String,
|
|
18
|
-
default: 'file'
|
|
19
|
-
},
|
|
20
|
-
data: Object,
|
|
21
|
-
headers: Object,
|
|
22
|
-
withCredentials: Boolean,
|
|
23
|
-
multiple: Boolean,
|
|
24
|
-
accept: String,
|
|
25
|
-
onStart: Function,
|
|
26
|
-
onProgress: Function,
|
|
27
|
-
onSuccess: Function,
|
|
28
|
-
onError: Function,
|
|
29
|
-
beforeUpload: Function,
|
|
30
|
-
drag: Boolean,
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
if (!
|
|
76
|
-
|
|
77
|
-
if (
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
}
|
|
128
|
-
} else {
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
1
|
+
<script>
|
|
2
|
+
import ajax from './ajax';
|
|
3
|
+
import UploadDragger from './upload-dragger.vue';
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
inject: ['uploader'],
|
|
7
|
+
components: {
|
|
8
|
+
UploadDragger
|
|
9
|
+
},
|
|
10
|
+
props: {
|
|
11
|
+
type: String,
|
|
12
|
+
action: {
|
|
13
|
+
type: String,
|
|
14
|
+
required: true
|
|
15
|
+
},
|
|
16
|
+
name: {
|
|
17
|
+
type: String,
|
|
18
|
+
default: 'file'
|
|
19
|
+
},
|
|
20
|
+
data: Object,
|
|
21
|
+
headers: Object,
|
|
22
|
+
withCredentials: Boolean,
|
|
23
|
+
multiple: Boolean,
|
|
24
|
+
accept: String,
|
|
25
|
+
onStart: Function,
|
|
26
|
+
onProgress: Function,
|
|
27
|
+
onSuccess: Function,
|
|
28
|
+
onError: Function,
|
|
29
|
+
beforeUpload: Function,
|
|
30
|
+
drag: Boolean,
|
|
31
|
+
size: String,
|
|
32
|
+
onPreview: {
|
|
33
|
+
type: Function,
|
|
34
|
+
default: function() {}
|
|
35
|
+
},
|
|
36
|
+
onRemove: {
|
|
37
|
+
type: Function,
|
|
38
|
+
default: function() {}
|
|
39
|
+
},
|
|
40
|
+
fileList: Array,
|
|
41
|
+
autoUpload: Boolean,
|
|
42
|
+
listType: String,
|
|
43
|
+
httpRequest: {
|
|
44
|
+
type: Function,
|
|
45
|
+
default: ajax
|
|
46
|
+
},
|
|
47
|
+
disabled: Boolean,
|
|
48
|
+
limit: Number,
|
|
49
|
+
onExceed: Function
|
|
50
|
+
},
|
|
51
|
+
|
|
52
|
+
data() {
|
|
53
|
+
return {
|
|
54
|
+
mouseover: false,
|
|
55
|
+
reqs: {}
|
|
56
|
+
};
|
|
57
|
+
},
|
|
58
|
+
|
|
59
|
+
computed: {
|
|
60
|
+
hideUploadInput() {
|
|
61
|
+
return !this.showFileList &&
|
|
62
|
+
this.listType === 'picture-card' &&
|
|
63
|
+
this.limit === 1 &&
|
|
64
|
+
this.fileList.length === 1;
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
|
|
68
|
+
methods: {
|
|
69
|
+
isImage(str) {
|
|
70
|
+
return str.indexOf('image') !== -1;
|
|
71
|
+
},
|
|
72
|
+
handleChange(ev) {
|
|
73
|
+
const files = ev.target.files;
|
|
74
|
+
|
|
75
|
+
if (!files) return;
|
|
76
|
+
|
|
77
|
+
if (this.drag && this.limit === 1 || this.hideUploadInput) {
|
|
78
|
+
this.fileList.length = [];
|
|
79
|
+
}
|
|
80
|
+
this.uploadFiles(files);
|
|
81
|
+
},
|
|
82
|
+
uploadFiles(files) {
|
|
83
|
+
if (this.limit && this.fileList.length + files.length > this.limit) {
|
|
84
|
+
this.onExceed && this.onExceed(files, this.fileList);
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
let postFiles = Array.prototype.slice.call(files);
|
|
89
|
+
if (!this.multiple) { postFiles = postFiles.slice(0, 1); }
|
|
90
|
+
|
|
91
|
+
if (postFiles.length === 0) { return; }
|
|
92
|
+
|
|
93
|
+
postFiles.forEach(rawFile => {
|
|
94
|
+
this.onStart(rawFile);
|
|
95
|
+
if (this.autoUpload) this.upload(rawFile);
|
|
96
|
+
});
|
|
97
|
+
},
|
|
98
|
+
upload(rawFile) {
|
|
99
|
+
this.$refs.input.value = null;
|
|
100
|
+
|
|
101
|
+
if (!this.beforeUpload) {
|
|
102
|
+
return this.post(rawFile);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
const before = this.beforeUpload(rawFile);
|
|
106
|
+
if (before && before.then) {
|
|
107
|
+
before.then(processedFile => {
|
|
108
|
+
const fileType = Object.prototype.toString.call(processedFile);
|
|
109
|
+
|
|
110
|
+
if (fileType === '[object File]' || fileType === '[object Blob]') {
|
|
111
|
+
if (fileType === '[object Blob]') {
|
|
112
|
+
processedFile = new File([processedFile], rawFile.name, {
|
|
113
|
+
type: rawFile.type
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
for (const p in rawFile) {
|
|
117
|
+
if (rawFile.hasOwnProperty(p)) {
|
|
118
|
+
processedFile[p] = rawFile[p];
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
this.post(processedFile);
|
|
122
|
+
} else {
|
|
123
|
+
this.post(rawFile);
|
|
124
|
+
}
|
|
125
|
+
}, () => {
|
|
126
|
+
this.onRemove(null, rawFile);
|
|
127
|
+
});
|
|
128
|
+
} else if (before !== false) {
|
|
129
|
+
this.post(rawFile);
|
|
130
|
+
} else {
|
|
131
|
+
this.onRemove(null, rawFile);
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
abort(file) {
|
|
135
|
+
const { reqs } = this;
|
|
136
|
+
if (file) {
|
|
137
|
+
let uid = file;
|
|
138
|
+
if (file.uid) uid = file.uid;
|
|
139
|
+
if (reqs[uid]) {
|
|
140
|
+
reqs[uid].abort();
|
|
141
|
+
}
|
|
142
|
+
} else {
|
|
143
|
+
Object.keys(reqs).forEach((uid) => {
|
|
144
|
+
if (reqs[uid]) reqs[uid].abort();
|
|
145
|
+
delete reqs[uid];
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
post(rawFile) {
|
|
150
|
+
const { uid } = rawFile;
|
|
151
|
+
const options = {
|
|
152
|
+
headers: this.headers,
|
|
153
|
+
withCredentials: this.withCredentials,
|
|
154
|
+
file: rawFile,
|
|
155
|
+
data: this.data,
|
|
156
|
+
filename: this.name,
|
|
157
|
+
action: this.action,
|
|
158
|
+
onProgress: e => {
|
|
159
|
+
this.onProgress(e, rawFile);
|
|
160
|
+
},
|
|
161
|
+
onSuccess: res => {
|
|
162
|
+
this.onSuccess(res, rawFile);
|
|
163
|
+
delete this.reqs[uid];
|
|
164
|
+
},
|
|
165
|
+
onError: err => {
|
|
166
|
+
this.onError(err, rawFile);
|
|
167
|
+
delete this.reqs[uid];
|
|
168
|
+
}
|
|
169
|
+
};
|
|
170
|
+
const req = this.httpRequest(options);
|
|
171
|
+
this.reqs[uid] = req;
|
|
172
|
+
if (req && req.then) {
|
|
173
|
+
req.then(options.onSuccess, options.onError);
|
|
174
|
+
}
|
|
175
|
+
},
|
|
176
|
+
handleClick() {
|
|
177
|
+
if (!this.disabled) {
|
|
178
|
+
this.$refs.input.value = null;
|
|
179
|
+
this.$refs.input.click();
|
|
180
|
+
}
|
|
181
|
+
},
|
|
182
|
+
handleKeydown(e) {
|
|
183
|
+
if (e.target !== e.currentTarget) return;
|
|
184
|
+
if (e.keyCode === 13 || e.keyCode === 32) {
|
|
185
|
+
this.handleClick();
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
|
|
190
|
+
render(h) {
|
|
191
|
+
let {
|
|
192
|
+
handleClick,
|
|
193
|
+
drag,
|
|
194
|
+
name,
|
|
195
|
+
handleChange,
|
|
196
|
+
multiple,
|
|
197
|
+
accept,
|
|
198
|
+
listType,
|
|
199
|
+
uploadFiles,
|
|
200
|
+
disabled,
|
|
201
|
+
handleKeydown,
|
|
202
|
+
size
|
|
203
|
+
} = this;
|
|
204
|
+
const data = {
|
|
205
|
+
class: {
|
|
206
|
+
'el-upload': true,
|
|
207
|
+
'el-upload--drag': drag,
|
|
208
|
+
[`el-upload--drag__${size}`]: drag,
|
|
209
|
+
[`el-upload--${size}`]: !drag,
|
|
210
|
+
'el-upload--picture-card': listType === 'picture-card',
|
|
211
|
+
'el-upload--picture-card__no-border': this.hideUploadInput
|
|
212
|
+
},
|
|
213
|
+
on: {
|
|
214
|
+
click: handleClick,
|
|
215
|
+
keydown: handleKeydown
|
|
216
|
+
}
|
|
217
|
+
};
|
|
218
|
+
data.class[`el-upload--${listType}`] = true;
|
|
219
|
+
return (
|
|
220
|
+
<div {...data} tabindex="0" >
|
|
221
|
+
{
|
|
222
|
+
drag
|
|
223
|
+
? <upload-dragger disabled={disabled} on-file={uploadFiles}>{this.$slots.default}{this.$slots.tip}</upload-dragger>
|
|
224
|
+
: this.$slots.default
|
|
225
|
+
}
|
|
226
|
+
<input class="el-upload__input" type="file" ref="input" name={name} on-change={handleChange} multiple={multiple} accept={accept}></input>
|
|
227
|
+
</div>
|
|
228
|
+
);
|
|
229
|
+
}
|
|
230
|
+
};
|
|
231
|
+
</script>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
const ICON_MAP = {
|
|
2
|
+
img: require('./assets/img.png'),
|
|
3
|
+
pdf: require('./assets/pdf.png'),
|
|
4
|
+
excel: require('./assets/excel.png'),
|
|
5
|
+
zip: require('./assets/zip.png'),
|
|
6
|
+
rar: require('./assets/zip.png'),
|
|
7
|
+
'7z': require('./assets/zip.png'),
|
|
8
|
+
ppt: require('./assets/ppt.png'),
|
|
9
|
+
word: require('./assets/word.png'),
|
|
10
|
+
default: require('./assets/file.png')
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export function iconStyle(fileName) {
|
|
14
|
+
const suffixMap = {
|
|
15
|
+
img: ['png', 'jpg', 'jpeg'],
|
|
16
|
+
word: ['doc', 'docx'],
|
|
17
|
+
excel: ['xls', 'xlsx'],
|
|
18
|
+
ppt: ['ppt', 'pptx']
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const ext = fileName.split('.').pop().toLowerCase();
|
|
22
|
+
|
|
23
|
+
for (const [key, list] of Object.entries(suffixMap)) {
|
|
24
|
+
if (list.includes(ext)) {
|
|
25
|
+
return { 'background-image': `url(${ICON_MAP[key]})` };
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return { 'background-image': `url(${ICON_MAP[ext] || ICON_MAP.default})` };
|
|
30
|
+
}
|