iov-design 2.15.45 → 2.15.47

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.
Files changed (141) hide show
  1. package/lib/alert.js +2 -2
  2. package/lib/aside.js +2 -2
  3. package/lib/autocomplete.js +2 -2
  4. package/lib/avatar.js +2 -2
  5. package/lib/backtop.js +2 -2
  6. package/lib/badge.js +2 -2
  7. package/lib/breadcrumb-item.js +2 -2
  8. package/lib/breadcrumb.js +2 -2
  9. package/lib/button-group.js +2 -2
  10. package/lib/button.js +2 -2
  11. package/lib/calendar.js +4 -4
  12. package/lib/card.js +2 -2
  13. package/lib/carousel-item.js +2 -2
  14. package/lib/carousel.js +16 -16
  15. package/lib/cascader-panel.js +6 -6
  16. package/lib/cascader.js +96 -96
  17. package/lib/checkbox-button.js +2 -2
  18. package/lib/checkbox-group.js +2 -2
  19. package/lib/checkbox.js +2 -2
  20. package/lib/col.js +2 -2
  21. package/lib/collapse-item.js +23 -23
  22. package/lib/collapse.js +2 -2
  23. package/lib/color-picker.js +2 -2
  24. package/lib/container.js +2 -2
  25. package/lib/date-picker.js +70 -91
  26. package/lib/descriptions-item.js +2 -2
  27. package/lib/descriptions.js +2 -2
  28. package/lib/dialog.js +58 -12
  29. package/lib/divider.js +2 -2
  30. package/lib/dropdown-item.js +2 -2
  31. package/lib/dropdown-menu.js +2 -2
  32. package/lib/dropdown.js +11 -11
  33. package/lib/empty.js +13 -10
  34. package/lib/footer.js +2 -2
  35. package/lib/form-item.js +4 -4
  36. package/lib/form.js +2 -2
  37. package/lib/header.js +2 -2
  38. package/lib/icon.js +2 -2
  39. package/lib/image.js +9 -9
  40. package/lib/index.js +1 -1
  41. package/lib/infinite-scroll.js +2 -2
  42. package/lib/input-number.js +62 -62
  43. package/lib/iov-design.common.js +1027 -173
  44. package/lib/link.js +2 -2
  45. package/lib/loading.js +11 -11
  46. package/lib/main.js +2 -2
  47. package/lib/menu-item-group.js +2 -2
  48. package/lib/menu-item.js +65 -65
  49. package/lib/menu.js +2 -2
  50. package/lib/message-box.js +11 -11
  51. package/lib/message.js +15 -15
  52. package/lib/notification.js +9 -9
  53. package/lib/option-group.js +2 -2
  54. package/lib/option.js +4 -4
  55. package/lib/page-header.js +2 -2
  56. package/lib/pagination.js +6 -6
  57. package/lib/popconfirm.js +24 -24
  58. package/lib/popover.js +9 -9
  59. package/lib/progress.js +2 -2
  60. package/lib/radio-button.js +2 -2
  61. package/lib/radio-group.js +2 -2
  62. package/lib/radio.js +9 -9
  63. package/lib/rate.js +23 -23
  64. package/lib/result.js +2 -2
  65. package/lib/row.js +2 -2
  66. package/lib/scrollbar.js +4 -4
  67. package/lib/select.js +18 -18
  68. package/lib/skeleton-item.js +2 -2
  69. package/lib/skeleton.js +2 -2
  70. package/lib/slider.js +4 -4
  71. package/lib/spinner.js +2 -2
  72. package/lib/static/excel.f44318e.png +0 -0
  73. package/lib/static/excel.f44318e0.png +0 -0
  74. package/lib/static/file.4ed3551.png +0 -0
  75. package/lib/static/file.4ed35511.png +0 -0
  76. package/lib/static/img.cd179e5.png +0 -0
  77. package/lib/static/img.cd179e5b.png +0 -0
  78. package/lib/static/pdf.79cb57f.png +0 -0
  79. package/lib/static/pdf.79cb57f8.png +0 -0
  80. package/lib/static/ppt.eed4918.png +0 -0
  81. package/lib/static/ppt.eed4918e.png +0 -0
  82. package/lib/static/word.35070ef.png +0 -0
  83. package/lib/static/word.35070ef0.png +0 -0
  84. package/lib/static/zip.dca21a8.png +0 -0
  85. package/lib/static/zip.dca21a88.png +0 -0
  86. package/lib/statistic.js +4 -4
  87. package/lib/step.js +2 -2
  88. package/lib/steps.js +9 -9
  89. package/lib/submenu.js +4 -4
  90. package/lib/switch.js +2 -2
  91. package/lib/tab-pane.js +2 -2
  92. package/lib/table-column.js +2 -2
  93. package/lib/table.js +23 -15
  94. package/lib/tabs.js +2 -2
  95. package/lib/tag.js +2 -2
  96. package/lib/theme-chalk/alert.css +1 -1
  97. package/lib/theme-chalk/base.css +1 -1
  98. package/lib/theme-chalk/dialog.css +1 -1
  99. package/lib/theme-chalk/index.css +1 -1
  100. package/lib/theme-chalk/iovfont.css +1 -1
  101. package/lib/theme-chalk/message.css +1 -1
  102. package/lib/theme-chalk/notification.css +1 -1
  103. package/lib/theme-chalk/upload.css +1 -1
  104. package/lib/time-picker.js +12 -12
  105. package/lib/time-select.js +9 -9
  106. package/lib/timeline-item.js +2 -2
  107. package/lib/timeline.js +2 -2
  108. package/lib/tooltip.js +2 -2
  109. package/lib/transfer.js +11 -11
  110. package/lib/tree.js +2 -2
  111. package/lib/upload.js +920 -119
  112. package/package.json +1 -1
  113. package/packages/dialog/src/component.vue +44 -4
  114. package/packages/empty/src/index.vue +4 -1
  115. package/packages/message/src/main.js +1 -1
  116. package/packages/message/src/main.vue +6 -6
  117. package/packages/tabs/src/tabs.vue +196 -196
  118. package/packages/theme-chalk/src/alert.scss +21 -18
  119. package/packages/theme-chalk/src/assets/img_fail.png +0 -0
  120. package/packages/theme-chalk/src/assets/img_placeholder.png +0 -0
  121. package/packages/theme-chalk/src/common/var.scss +1 -34
  122. package/packages/theme-chalk/src/dialog.scss +20 -6
  123. package/packages/theme-chalk/src/iovfont.scss +3 -3
  124. package/packages/theme-chalk/src/message-box.scss +207 -207
  125. package/packages/theme-chalk/src/message.scss +28 -37
  126. package/packages/theme-chalk/src/tabs.scss +686 -686
  127. package/packages/theme-chalk/src/upload.scss +568 -603
  128. package/packages/upload/src/assets/excel.png +0 -0
  129. package/packages/upload/src/assets/file.png +0 -0
  130. package/packages/upload/src/assets/img.png +0 -0
  131. package/packages/upload/src/assets/pdf.png +0 -0
  132. package/packages/upload/src/assets/ppt.png +0 -0
  133. package/packages/upload/src/assets/word.png +0 -0
  134. package/packages/upload/src/assets/zip.png +0 -0
  135. package/packages/upload/src/index.vue +73 -5
  136. package/packages/upload/src/upload-file.vue +90 -0
  137. package/packages/upload/src/upload-list.vue +52 -50
  138. package/packages/upload/src/upload-picture.vue +90 -0
  139. package/packages/upload/src/upload.vue +231 -211
  140. package/packages/upload/src/utils.js +30 -0
  141. 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
- onPreview: {
32
- type: Function,
33
- default: function() {}
34
- },
35
- onRemove: {
36
- type: Function,
37
- default: function() {}
38
- },
39
- fileList: Array,
40
- autoUpload: Boolean,
41
- listType: String,
42
- httpRequest: {
43
- type: Function,
44
- default: ajax
45
- },
46
- disabled: Boolean,
47
- limit: Number,
48
- onExceed: Function
49
- },
50
-
51
- data() {
52
- return {
53
- mouseover: false,
54
- reqs: {}
55
- };
56
- },
57
-
58
- methods: {
59
- isImage(str) {
60
- return str.indexOf('image') !== -1;
61
- },
62
- handleChange(ev) {
63
- const files = ev.target.files;
64
-
65
- if (!files) return;
66
- this.uploadFiles(files);
67
- },
68
- uploadFiles(files) {
69
- if (this.limit && this.fileList.length + files.length > this.limit) {
70
- this.onExceed && this.onExceed(files, this.fileList);
71
- return;
72
- }
73
-
74
- let postFiles = Array.prototype.slice.call(files);
75
- if (!this.multiple) { postFiles = postFiles.slice(0, 1); }
76
-
77
- if (postFiles.length === 0) { return; }
78
-
79
- postFiles.forEach(rawFile => {
80
- this.onStart(rawFile);
81
- if (this.autoUpload) this.upload(rawFile);
82
- });
83
- },
84
- upload(rawFile) {
85
- this.$refs.input.value = null;
86
-
87
- if (!this.beforeUpload) {
88
- return this.post(rawFile);
89
- }
90
-
91
- const before = this.beforeUpload(rawFile);
92
- if (before && before.then) {
93
- before.then(processedFile => {
94
- const fileType = Object.prototype.toString.call(processedFile);
95
-
96
- if (fileType === '[object File]' || fileType === '[object Blob]') {
97
- if (fileType === '[object Blob]') {
98
- processedFile = new File([processedFile], rawFile.name, {
99
- type: rawFile.type
100
- });
101
- }
102
- for (const p in rawFile) {
103
- if (rawFile.hasOwnProperty(p)) {
104
- processedFile[p] = rawFile[p];
105
- }
106
- }
107
- this.post(processedFile);
108
- } else {
109
- this.post(rawFile);
110
- }
111
- }, () => {
112
- this.onRemove(null, rawFile);
113
- });
114
- } else if (before !== false) {
115
- this.post(rawFile);
116
- } else {
117
- this.onRemove(null, rawFile);
118
- }
119
- },
120
- abort(file) {
121
- const { reqs } = this;
122
- if (file) {
123
- let uid = file;
124
- if (file.uid) uid = file.uid;
125
- if (reqs[uid]) {
126
- reqs[uid].abort();
127
- }
128
- } else {
129
- Object.keys(reqs).forEach((uid) => {
130
- if (reqs[uid]) reqs[uid].abort();
131
- delete reqs[uid];
132
- });
133
- }
134
- },
135
- post(rawFile) {
136
- const { uid } = rawFile;
137
- const options = {
138
- headers: this.headers,
139
- withCredentials: this.withCredentials,
140
- file: rawFile,
141
- data: this.data,
142
- filename: this.name,
143
- action: this.action,
144
- onProgress: e => {
145
- this.onProgress(e, rawFile);
146
- },
147
- onSuccess: res => {
148
- this.onSuccess(res, rawFile);
149
- delete this.reqs[uid];
150
- },
151
- onError: err => {
152
- this.onError(err, rawFile);
153
- delete this.reqs[uid];
154
- }
155
- };
156
- const req = this.httpRequest(options);
157
- this.reqs[uid] = req;
158
- if (req && req.then) {
159
- req.then(options.onSuccess, options.onError);
160
- }
161
- },
162
- handleClick() {
163
- if (!this.disabled) {
164
- this.$refs.input.value = null;
165
- this.$refs.input.click();
166
- }
167
- },
168
- handleKeydown(e) {
169
- if (e.target !== e.currentTarget) return;
170
- if (e.keyCode === 13 || e.keyCode === 32) {
171
- this.handleClick();
172
- }
173
- }
174
- },
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
- };
211
- </script>
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
+ }
package/src/index.js CHANGED
@@ -212,7 +212,7 @@ if (typeof window !== 'undefined' && window.Vue) {
212
212
  }
213
213
 
214
214
  export default {
215
- version: '2.15.45',
215
+ version: '2.15.47',
216
216
  locale: locale.use,
217
217
  i18n: locale.i18n,
218
218
  install,