iov-design 2.15.46 → 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 (128) 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 +9 -9
  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 +9 -9
  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 +968 -163
  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 +9 -9
  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/base.css +1 -1
  97. package/lib/theme-chalk/dialog.css +1 -1
  98. package/lib/theme-chalk/index.css +1 -1
  99. package/lib/theme-chalk/iovfont.css +1 -1
  100. package/lib/theme-chalk/upload.css +1 -1
  101. package/lib/time-picker.js +12 -12
  102. package/lib/time-select.js +9 -9
  103. package/lib/timeline-item.js +2 -2
  104. package/lib/timeline.js +2 -2
  105. package/lib/tooltip.js +2 -2
  106. package/lib/transfer.js +11 -11
  107. package/lib/tree.js +2 -2
  108. package/lib/upload.js +920 -119
  109. package/package.json +1 -1
  110. package/packages/theme-chalk/src/assets/img_fail.png +0 -0
  111. package/packages/theme-chalk/src/assets/img_placeholder.png +0 -0
  112. package/packages/theme-chalk/src/dialog.scss +4 -0
  113. package/packages/theme-chalk/src/iovfont.scss +3 -3
  114. package/packages/theme-chalk/src/upload.scss +568 -603
  115. package/packages/upload/src/assets/excel.png +0 -0
  116. package/packages/upload/src/assets/file.png +0 -0
  117. package/packages/upload/src/assets/img.png +0 -0
  118. package/packages/upload/src/assets/pdf.png +0 -0
  119. package/packages/upload/src/assets/ppt.png +0 -0
  120. package/packages/upload/src/assets/word.png +0 -0
  121. package/packages/upload/src/assets/zip.png +0 -0
  122. package/packages/upload/src/index.vue +73 -5
  123. package/packages/upload/src/upload-file.vue +90 -0
  124. package/packages/upload/src/upload-list.vue +52 -50
  125. package/packages/upload/src/upload-picture.vue +90 -0
  126. package/packages/upload/src/upload.vue +231 -211
  127. package/packages/upload/src/utils.js +30 -0
  128. package/src/index.js +1 -1
@@ -1,5 +1,7 @@
1
1
  <script>
2
2
  import UploadList from './upload-list';
3
+ import UploadFile from './upload-file';
4
+ import UploadPicture from './upload-picture';
3
5
  import Upload from './upload';
4
6
  import ElProgress from 'iov-design/packages/progress';
5
7
  import Migrating from 'iov-design/src/mixins/migrating';
@@ -14,6 +16,8 @@ export default {
14
16
  components: {
15
17
  ElProgress,
16
18
  UploadList,
19
+ UploadFile,
20
+ UploadPicture,
17
21
  Upload
18
22
  },
19
23
 
@@ -103,6 +107,11 @@ export default {
103
107
  onExceed: {
104
108
  type: Function,
105
109
  default: noop
110
+ },
111
+ background: Boolean,
112
+ size: {
113
+ type: String,
114
+ default: 'medium'
106
115
  }
107
116
  },
108
117
 
@@ -267,13 +276,53 @@ export default {
267
276
 
268
277
  render(h) {
269
278
  let uploadList;
270
-
279
+ let uploadFile = (
280
+ <UploadFile
281
+ disabled={this.uploadDisabled}
282
+ listType={this.listType}
283
+ files={this.uploadFiles}
284
+ width={this.width}
285
+ height={this.height}
286
+ size={this.size}
287
+ on-remove={this.handleRemove}
288
+ handlePreview={this.onPreview}>
289
+ {
290
+ (props) => {
291
+ if (this.$scopedSlots.file) {
292
+ return this.$scopedSlots.file({
293
+ file: props.file
294
+ });
295
+ }
296
+ }
297
+ }
298
+ </UploadFile>
299
+ );
300
+ let uploadPicture = (
301
+ <UploadPicture
302
+ disabled={this.uploadDisabled}
303
+ listType={this.listType}
304
+ files={this.uploadFiles}
305
+ size={this.size}
306
+ on-remove={this.handleRemove}
307
+ handlePreview={this.onPreview}>
308
+ {
309
+ (props) => {
310
+ if (this.$scopedSlots.file) {
311
+ return this.$scopedSlots.file({
312
+ file: props.file
313
+ });
314
+ }
315
+ }
316
+ }
317
+ </UploadPicture>
318
+ );
271
319
  if (this.showFileList) {
272
320
  uploadList = (
273
321
  <UploadList
274
322
  disabled={this.uploadDisabled}
275
323
  listType={this.listType}
276
324
  files={this.uploadFiles}
325
+ size={this.size}
277
326
  on-remove={this.handleRemove}
278
327
  handlePreview={this.onPreview}>
279
328
  {
@@ -293,6 +342,7 @@ export default {
293
342
  props: {
294
343
  type: this.type,
295
344
  drag: this.drag,
345
+ size: this.size,
296
346
  action: this.action,
297
347
  multiple: this.multiple,
298
348
  'before-upload': this.beforeUpload,
@@ -302,6 +352,7 @@ export default {
302
352
  data: this.data,
303
353
  accept: this.accept,
304
354
  fileList: this.uploadFiles,
355
+ showFileList: this.showFileList,
305
356
  autoUpload: this.autoUpload,
306
357
  listType: this.listType,
307
358
  disabled: this.uploadDisabled,
@@ -318,18 +369,35 @@ export default {
318
369
  ref: 'upload-inner'
319
370
  };
320
371
 
321
- const trigger = this.$slots.trigger || this.$slots.default;
322
- const uploadComponent = <upload {...uploadData}>{trigger}</upload>;
372
+ const hideUploadInput = !this.showFileList && this.listType === 'picture-card' && this.limit === 1;
373
+ let slotDefault = this.$slots.default;
374
+ if (this.drag) {
375
+ // 拖动文件上传
376
+ if (this.limit === 1 && !this.showFileList) {
377
+ slotDefault = this.uploadFiles.length > 0
378
+ ? uploadFile
379
+ : [this.$slots.default, this.$slots.tip];
380
+ } else {
381
+ slotDefault = [this.$slots.default, this.$slots.tip];
382
+ }
383
+ } else if (hideUploadInput) {
384
+ // 单个图片上传(不显示图片墙)
385
+ slotDefault = [ uploadPicture, this.$slots.default];
386
+ } else {
387
+ slotDefault = this.$slots.default;
388
+ }
323
389
 
390
+ const trigger = this.$slots.trigger || slotDefault;
391
+ const uploadComponent = <upload {...uploadData}>{trigger}</upload>;
324
392
  return (
325
- <div>
393
+ <div class={{ 'el-upload--wrap': true, 'el-upload-bg': this.background }}>
326
394
  { this.listType === 'picture-card' ? uploadList : ''}
327
395
  {
328
396
  this.$slots.trigger
329
397
  ? [uploadComponent, this.$slots.default]
330
398
  : uploadComponent
331
399
  }
332
- {this.$slots.tip}
400
+ { !this.drag && this.$slots.tip }
333
401
  { this.listType !== 'picture-card' ? uploadList : ''}
334
402
  </div>
335
403
  );
@@ -0,0 +1,90 @@
1
+ <template>
2
+ <ul
3
+ :class="[
4
+ 'el-upload-list',
5
+ 'el-upload-list--' + listType,
6
+ { 'is-disabled': disabled }
7
+ ]"
8
+ >
9
+ <li
10
+ v-for="file in files"
11
+ :class="['el-upload-list__item', 'is-' + file.status, focusing ? 'focusing' : '']"
12
+ :key="file.uid"
13
+ tabindex="0"
14
+ @focus="focusing = true"
15
+ @blur="focusing = false"
16
+ @click="focusing = false"
17
+ >
18
+ <slot :file="file">
19
+ <div class="el-upload-list__file">
20
+ <div v-if="file.status === 'success'" class="el-upload-list__item-name">
21
+ <span v-if="['picture-card', 'picture'].includes(listType)" class="el-upload-list__item-thumbnail">
22
+ <el-image :src="file.url" :preview-src-list="[file.url]" fit="contain">
23
+ <i slot="placeholder" class="el-image__placeholder"></i>
24
+ <i slot="error" class="el-image__error"></i>
25
+ </el-image>
26
+ </span>
27
+ <i v-else-if="['text'].includes(listType)" class="el-upload-list__icon" @click="handleClick(file)" :style="iconStyle(file.name)"></i>
28
+ <div class="el-upload-list__name" @click="handleClick(file)">
29
+ <span class="file-name">{{file.name}}</span>
30
+ </div>
31
+ <el-button v-if="size === 'medium'" class="el-upload__btn" round size="small" slot="trigger">重新上传</el-button>
32
+ </div>
33
+ <div v-if="file.status === 'uploading'" class="el-upload-list__item-status-label">
34
+ <el-progress
35
+ :percentage="file.percentage"
36
+ :stroke-width="2"
37
+ :show-text="false"
38
+ type="line"
39
+ color="#3F57FF"
40
+ define-back-color="#F2F3F5"
41
+ class="el-upload-progress"
42
+ />
43
+ <span class="el-upload-progress__text">文件上传中</span>
44
+ </div>
45
+ </div>
46
+ <i class="el-upload__remove iov-icon-close-mini" v-if="!disabled" @click.stop="$emit('remove', file)"></i>
47
+ </slot>
48
+ </li>
49
+ </ul>
50
+ </template>
51
+ <script>
52
+ import ElProgress from 'iov-design/packages/progress';
53
+ import { iconStyle } from './utils';
54
+ export default {
55
+ name: 'ElUploadFile',
56
+ data() {
57
+ return {
58
+ focusing: false,
59
+ iconStyle
60
+ };
61
+ },
62
+ components: { ElProgress },
63
+
64
+ props: {
65
+ files: {
66
+ type: Array,
67
+ default() {
68
+ return [];
69
+ }
70
+ },
71
+ disabled: {
72
+ type: Boolean,
73
+ default: false
74
+ },
75
+ size: String,
76
+ width: String,
77
+ height: String,
78
+ handlePreview: Function,
79
+ listType: String
80
+ },
81
+ methods: {
82
+ parsePercentage(val) {
83
+ return parseInt(val, 10);
84
+ },
85
+ handleClick(file) {
86
+ this.handlePreview && this.handlePreview(file);
87
+ }
88
+ }
89
+ };
90
+ </script>
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <transition-group
2
+ <ul
3
3
  tag="ul"
4
4
  :class="[
5
5
  'el-upload-list',
@@ -10,71 +10,72 @@
10
10
  >
11
11
  <li
12
12
  v-for="file in files"
13
- :class="['el-upload-list__item', 'is-' + file.status, focusing ? 'focusing' : '']"
13
+ :class="['el-upload-list__item', 'el-upload-list__item-' + size, 'is-' + file.status, focusing ? 'focusing' : '']"
14
14
  :key="file.uid"
15
15
  tabindex="0"
16
- @keydown.delete="!disabled && $emit('remove', file)"
17
16
  @focus="focusing = true"
18
17
  @blur="focusing = false"
19
18
  @click="focusing = false"
20
19
  >
21
20
  <slot :file="file">
22
- <img
23
- class="el-upload-list__item-thumbnail"
24
- v-if="file.status !== 'uploading' && ['picture-card', 'picture'].indexOf(listType) > -1"
25
- :src="file.url" alt=""
26
- >
27
- <a class="el-upload-list__item-name" @click="handleClick(file)">
28
- <i class="el-icon-document"></i>{{file.name}}
29
- </a>
30
- <label class="el-upload-list__item-status-label">
31
- <i :class="{
32
- 'el-icon-upload-success': true,
33
- 'el-icon-circle-check': listType === 'text',
34
- 'el-icon-check': ['picture-card', 'picture'].indexOf(listType) > -1
35
- }"></i>
36
- </label>
37
- <i class="el-icon-close" v-if="!disabled" @click="$emit('remove', file)"></i>
38
- <i class="el-icon-close-tip" v-if="!disabled">{{ t('el.upload.deleteTip') }}</i> <!--因为close按钮只在li:focus的时候 display, li blur后就不存在了,所以键盘导航时永远无法 focus到 close按钮上-->
39
- <el-progress
40
- v-if="file.status === 'uploading'"
41
- :type="listType === 'picture-card' ? 'circle' : 'line'"
42
- :stroke-width="listType === 'picture-card' ? 6 : 2"
43
- :percentage="parsePercentage(file.percentage)">
44
- </el-progress>
45
- <span class="el-upload-list__item-actions" v-if="listType === 'picture-card'">
46
- <span
47
- class="el-upload-list__item-preview"
48
- v-if="handlePreview && listType === 'picture-card'"
49
- @click="handlePreview(file)"
50
- >
51
- <i class="el-icon-zoom-in"></i>
52
- </span>
53
- <span
54
- v-if="!disabled"
55
- class="el-upload-list__item-delete"
56
- @click="$emit('remove', file)"
57
- >
58
- <i class="el-icon-delete"></i>
59
- </span>
21
+ <div class="el-upload-list__file">
22
+ <div class="el-upload-list__item-name" @click="handleClick(file)">
23
+ <span v-if="['picture-card', 'picture'].includes(listType)" class="el-upload-list__item-thumbnail">
24
+ <el-image :src="file.url" :preview-src-list="handlePreview ? [] : [file.url]" fit="contain">
25
+ <i slot="placeholder" class="el-image__placeholder"></i>
26
+ <i slot="error" class="el-image__error"></i>
27
+ </el-image>
28
+ </span>
29
+ <i v-else-if="['text'].includes(listType)" class="el-upload-list__icon" :style="iconStyle(file.name)"></i>
30
+ <div v-if="['text', 'picture'].includes(listType)" class="el-upload-list__name">
31
+ <span class="file-name">{{file.name}}</span>
32
+ </div>
33
+ </div>
34
+ <div v-if="['text', 'picture'].includes(listType)" class="el-upload-list__item-status-label">
35
+ <el-progress
36
+ v-if="file.status === 'uploading'"
37
+ :percentage="file.percentage"
38
+ :width="14"
39
+ :stroke-width="7"
40
+ :show-text="false"
41
+ type="circle"
42
+ stroke-linecap="butt"
43
+ class="el-upload-progress"
44
+ />
45
+ <i v-else-if="file.status === 'success'" class="el-upload-success iov-icon-success"></i>
46
+ </div>
47
+ <div v-else-if="['picture-card'].includes(listType) && file.status === 'uploading'" class="el-upload-list__item-status-label">
48
+ <el-progress
49
+ :percentage="file.percentage"
50
+ :stroke-width="2"
51
+ :show-text="false"
52
+ type="line"
53
+ color="#3F57FF"
54
+ define-back-color="#F2F3F5"
55
+ class="el-upload-progress"
56
+ />
57
+ <span class="el-upload-progress__text">上传中</span>
58
+ </div>
59
+ </div>
60
+ <i class="iov-icon-delete" v-if="!disabled && ['text', 'picture'].includes(listType)" @click="$emit('remove', file)"></i>
61
+ <span class="el-upload-list__item-actions" v-if="listType === 'picture-card' && file.status === 'success'">
62
+ <i v-if="handlePreview" @click.stop="handlePreview(file)" class="el-upload-list__item-preview iov-icon-eye"></i>
63
+ <i v-if="!disabled" class="el-upload-list__item-delete iov-icon-delete" @click.stop="$emit('remove', file)"></i>
64
+ <i v-if="!disabled" class="el-upload-list__item-update iov-icon-update"></i>
60
65
  </span>
61
66
  </slot>
62
67
  </li>
63
- </transition-group>
68
+ </ul>
64
69
  </template>
65
70
  <script>
66
- import Locale from 'iov-design/src/mixins/locale';
67
71
  import ElProgress from 'iov-design/packages/progress';
68
-
72
+ import { iconStyle } from './utils';
69
73
  export default {
70
-
71
74
  name: 'ElUploadList',
72
-
73
- mixins: [Locale],
74
-
75
75
  data() {
76
76
  return {
77
- focusing: false
77
+ focusing: false,
78
+ iconStyle
78
79
  };
79
80
  },
80
81
  components: { ElProgress },
@@ -90,7 +91,8 @@
90
91
  type: Boolean,
91
92
  default: false
92
93
  },
93
- handlePreview: Function,
94
+ size: String,
95
+ handlePreview: null,
94
96
  listType: String
95
97
  },
96
98
  methods: {
@@ -0,0 +1,90 @@
1
+ <template>
2
+ <ul
3
+ tag="ul"
4
+ :class="[
5
+ 'el-upload-list',
6
+ 'el-upload-list--' + listType,
7
+ { 'is-disabled': disabled }
8
+ ]"
9
+ name="el-list"
10
+ >
11
+ <li
12
+ v-for="file in files"
13
+ :class="['el-upload-list__item', 'el-upload-list__item-' + size, 'is-' + file.status, focusing ? 'focusing' : '']"
14
+ :key="file.uid"
15
+ tabindex="0"
16
+ @focus="focusing = true"
17
+ @blur="focusing = false"
18
+ @click="focusing = false"
19
+ >
20
+ <slot :file="file">
21
+ <div class="el-upload-list__file">
22
+ <div v-if="file.status === 'success'" class="el-upload-list__item-name" @click="handleClick(file)">
23
+ <span class="el-upload-list__item-thumbnail">
24
+ <el-image :src="file.url" :preview-src-list="handlePreview ? [] : [file.url]" fit="contain">
25
+ <i slot="placeholder" class="el-image__placeholder"></i>
26
+ <i slot="error" class="el-image__error"></i>
27
+ </el-image>
28
+ </span>
29
+ </div>
30
+ <div v-if="file.status === 'uploading'" class="el-upload-list__item-status-label">
31
+ <el-progress
32
+ :percentage="file.percentage"
33
+ :stroke-width="2"
34
+ :show-text="false"
35
+ type="line"
36
+ color="#3F57FF"
37
+ define-back-color="#F2F3F5"
38
+ class="el-upload-progress"
39
+ />
40
+ <span class="el-upload-progress__text">上传中</span>
41
+ </div>
42
+ </div>
43
+ <span class="el-upload-list__item-actions" v-if="file.status === 'success'">
44
+ <i v-if="handlePreview" @click="handlePreview(file)" class="el-upload-list__item-preview iov-icon-eye"></i>
45
+ <i v-if="!disabled" class="el-upload-list__item-delete iov-icon-delete" @click.stop="$emit('remove', file)"></i>
46
+ <i v-if="!disabled" class="el-upload-list__item-update iov-icon-update"></i>
47
+ </span>
48
+ </slot>
49
+ </li>
50
+ </ul>
51
+ </template>
52
+ <script>
53
+ import ElProgress from 'iov-design/packages/progress';
54
+ import { iconStyle } from './utils';
55
+
56
+ export default {
57
+ name: 'ElUploadPicture',
58
+ data() {
59
+ return {
60
+ focusing: false,
61
+ iconStyle
62
+ };
63
+ },
64
+ components: { ElProgress },
65
+
66
+ props: {
67
+ files: {
68
+ type: Array,
69
+ default() {
70
+ return [];
71
+ }
72
+ },
73
+ disabled: {
74
+ type: Boolean,
75
+ default: false
76
+ },
77
+ size: String,
78
+ handlePreview: Function,
79
+ listType: String
80
+ },
81
+ methods: {
82
+ parsePercentage(val) {
83
+ return parseInt(val, 10);
84
+ },
85
+ handleClick(file) {
86
+ this.handlePreview && this.handlePreview(file);
87
+ }
88
+ }
89
+ };
90
+ </script>