zartui 2.0.79 → 2.0.80-beta.1

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 (304) hide show
  1. package/es/action-sheet/index.js +15 -26
  2. package/es/area/index.js +5 -41
  3. package/es/avatar/index.js +3 -16
  4. package/es/back-top/index.js +4 -19
  5. package/es/badge/index.js +4 -12
  6. package/es/button/index.js +20 -40
  7. package/es/calendar/components/Header.js +3 -12
  8. package/es/calendar/components/Month.js +12 -65
  9. package/es/calendar/index.js +23 -94
  10. package/es/calendar/types.js +0 -6
  11. package/es/calendar/utils.js +5 -16
  12. package/es/cascader/index.js +4 -37
  13. package/es/cell/index.js +19 -37
  14. package/es/cell-group/index.js +5 -8
  15. package/es/checkbox/index.js +4 -11
  16. package/es/checkbox-group/index.js +4 -9
  17. package/es/col/index.js +6 -11
  18. package/es/collapse/index.js +2 -5
  19. package/es/collapse-item/index.js +19 -35
  20. package/es/count-down/index.js +2 -15
  21. package/es/count-down/utils.js +3 -10
  22. package/es/datetime-picker/DatePicker.js +12 -70
  23. package/es/datetime-picker/TimePicker.js +10 -23
  24. package/es/datetime-picker/index.js +2 -4
  25. package/es/datetime-picker/shared.js +5 -19
  26. package/es/datetime-picker/utils.js +0 -5
  27. package/es/dialog/Dialog.js +6 -21
  28. package/es/dialog/index.js +0 -16
  29. package/es/divider/index.js +5 -6
  30. package/es/dropdown-item/index.js +22 -35
  31. package/es/dropdown-menu/index.js +4 -9
  32. package/es/empty/index.js +3 -11
  33. package/es/field/index.js +20 -83
  34. package/es/fold-dialog/index.js +5 -20
  35. package/es/form/index.js +2 -18
  36. package/es/grid/index.js +2 -6
  37. package/es/grid-item/index.js +17 -30
  38. package/es/hierarchy-select/breadcrumb.js +2 -6
  39. package/es/hierarchy-select/index.js +3 -12
  40. package/es/hierarchy-select/markList.js +2 -25
  41. package/es/hierarchy-select/svg/SubIcon.js +0 -1
  42. package/es/icon/index.js +9 -13
  43. package/es/image/index.js +2 -17
  44. package/es/image-preview/ImagePreview.js +4 -8
  45. package/es/image-preview/ImagePreviewItem.js +14 -30
  46. package/es/image-preview/index.js +0 -12
  47. package/es/image-preview/shared.js +2 -4
  48. package/es/index-anchor/index.js +2 -6
  49. package/es/index-bar/IndexIndicate.js +0 -1
  50. package/es/index-bar/index.js +7 -28
  51. package/es/index.js +1 -4
  52. package/es/info/index.js +6 -8
  53. package/es/list/index.js +11 -27
  54. package/es/loading/index.js +7 -15
  55. package/es/locale/index.js +0 -2
  56. package/es/media-picker/index.js +33 -117
  57. package/es/media-picker/media-util.js +2 -5
  58. package/es/media-picker/type.js +0 -5
  59. package/es/media-player/index.js +7 -17
  60. package/es/mixins/bind-event.js +0 -3
  61. package/es/mixins/checkbox.js +5 -11
  62. package/es/mixins/click-outside.js +0 -2
  63. package/es/mixins/close-on-popstate.js +0 -1
  64. package/es/mixins/field.js +0 -2
  65. package/es/mixins/popup/index.js +12 -28
  66. package/es/mixins/popup/overlay.js +1 -11
  67. package/es/mixins/portal.js +2 -8
  68. package/es/mixins/relation.js +0 -8
  69. package/es/mixins/slots.js +1 -4
  70. package/es/mixins/touch.js +4 -9
  71. package/es/multiple-picker/MultiplePickerOptions.js +2 -18
  72. package/es/multiple-picker/index.js +5 -17
  73. package/es/nav-bar/index.js +4 -12
  74. package/es/notice-bar/index.js +10 -28
  75. package/es/number-keyboard/Key.js +2 -10
  76. package/es/number-keyboard/index.js +4 -19
  77. package/es/overlay/index.js +5 -8
  78. package/es/password-input/index.js +10 -16
  79. package/es/picker/PickerColumn.js +20 -54
  80. package/es/picker/index.js +13 -42
  81. package/es/popover/index.js +11 -20
  82. package/es/popup/index.js +5 -21
  83. package/es/pull-refresh/index.js +15 -32
  84. package/es/radio/index.js +2 -4
  85. package/es/radio-group/index.js +2 -4
  86. package/es/rate/index.js +12 -26
  87. package/es/row/index.js +3 -9
  88. package/es/search/index.js +8 -13
  89. package/es/signature/bezier.js +5 -12
  90. package/es/signature/force-landscape.js +0 -5
  91. package/es/signature/index.js +5 -24
  92. package/es/signature/point.js +1 -6
  93. package/es/signature/throttle.js +1 -10
  94. package/es/skeleton/index.js +5 -15
  95. package/es/slider/index.js +19 -55
  96. package/es/step/index.js +5 -12
  97. package/es/stepper/index.js +10 -37
  98. package/es/steps/index.js +2 -4
  99. package/es/sticky/index.js +8 -50
  100. package/es/swipe/index.js +19 -62
  101. package/es/swipe-cell/index.js +7 -23
  102. package/es/swipe-item/index.js +9 -19
  103. package/es/switch/index.js +8 -10
  104. package/es/switch/shared.js +1 -0
  105. package/es/switch-cell/index.js +7 -7
  106. package/es/tab/index.js +4 -15
  107. package/es/tabbar/index.js +4 -14
  108. package/es/tabbar-item/index.js +7 -15
  109. package/es/table/index.js +10 -35
  110. package/es/tabs/Content.js +5 -9
  111. package/es/tabs/Title.js +11 -19
  112. package/es/tabs/index.js +16 -51
  113. package/es/tabs/utils.js +0 -8
  114. package/es/tag/index.js +13 -17
  115. package/es/timeline/index.js +2 -25
  116. package/es/toast/Toast.js +11 -23
  117. package/es/toast/index.js +6 -33
  118. package/es/toast/lock-click.js +0 -2
  119. package/es/uploader/index.js +11 -62
  120. package/es/uploader/utils.js +0 -10
  121. package/es/utils/constant.js +2 -1
  122. package/es/utils/create/bem.js +1 -5
  123. package/es/utils/create/component.js +4 -7
  124. package/es/utils/create/i18n.js +0 -2
  125. package/es/utils/deep-assign.js +0 -4
  126. package/es/utils/deep-clone.js +0 -3
  127. package/es/utils/dom/event.js +2 -5
  128. package/es/utils/dom/node.js +0 -1
  129. package/es/utils/dom/raf.js +7 -6
  130. package/es/utils/dom/reset-scroll.js +2 -1
  131. package/es/utils/dom/scroll.js +8 -17
  132. package/es/utils/dom/style.js +3 -2
  133. package/es/utils/easings.js +2 -4
  134. package/es/utils/format/date-util.js +54 -122
  135. package/es/utils/format/number.js +2 -11
  136. package/es/utils/format/string.js +0 -3
  137. package/es/utils/format/unit.js +2 -12
  138. package/es/utils/functional.js +6 -9
  139. package/es/utils/getScroll.js +0 -5
  140. package/es/utils/index.js +3 -5
  141. package/es/utils/interceptor.js +2 -4
  142. package/es/utils/media/image-util.js +7 -19
  143. package/es/utils/raf.js +4 -12
  144. package/es/utils/router.js +7 -6
  145. package/es/utils/scrollTo.js +7 -12
  146. package/es/utils/validate/number.js +2 -2
  147. package/es/utils/vnodes.js +2 -8
  148. package/lib/action-sheet/index.js +11 -35
  149. package/lib/area/index.js +5 -45
  150. package/lib/avatar/index.js +3 -18
  151. package/lib/back-top/index.js +4 -25
  152. package/lib/badge/index.js +4 -15
  153. package/lib/button/index.js +19 -50
  154. package/lib/calendar/components/Header.js +3 -18
  155. package/lib/calendar/components/Month.js +12 -71
  156. package/lib/calendar/index.js +21 -106
  157. package/lib/calendar/types.js +0 -7
  158. package/lib/calendar/utils.js +5 -32
  159. package/lib/cascader/index.js +4 -46
  160. package/lib/cell/index.js +18 -48
  161. package/lib/cell-group/index.js +5 -15
  162. package/lib/checkbox/index.js +4 -14
  163. package/lib/checkbox-group/index.js +4 -13
  164. package/lib/col/index.js +6 -14
  165. package/lib/collapse/index.js +2 -8
  166. package/lib/collapse-item/index.js +18 -43
  167. package/lib/count-down/index.js +2 -19
  168. package/lib/count-down/utils.js +3 -15
  169. package/lib/datetime-picker/DatePicker.js +12 -81
  170. package/lib/datetime-picker/TimePicker.js +10 -30
  171. package/lib/datetime-picker/index.js +2 -10
  172. package/lib/datetime-picker/shared.js +5 -27
  173. package/lib/datetime-picker/utils.js +0 -9
  174. package/lib/dialog/Dialog.js +6 -28
  175. package/lib/dialog/index.js +0 -22
  176. package/lib/divider/index.js +5 -12
  177. package/lib/dropdown-item/index.js +21 -44
  178. package/lib/dropdown-menu/index.js +4 -15
  179. package/lib/empty/index.js +3 -23
  180. package/lib/field/index.js +20 -96
  181. package/lib/fold-dialog/index.js +5 -22
  182. package/lib/form/index.js +2 -21
  183. package/lib/grid/index.js +2 -10
  184. package/lib/grid-item/index.js +16 -37
  185. package/lib/hierarchy-select/breadcrumb.js +3 -10
  186. package/lib/hierarchy-select/index.js +4 -20
  187. package/lib/hierarchy-select/markList.js +3 -31
  188. package/lib/hierarchy-select/svg/SubIcon.js +0 -1
  189. package/lib/icon/index.js +8 -19
  190. package/lib/image/index.js +2 -22
  191. package/lib/image-preview/ImagePreview.js +0 -16
  192. package/lib/image-preview/ImagePreviewItem.js +13 -36
  193. package/lib/image-preview/index.js +0 -16
  194. package/lib/image-preview/shared.js +2 -5
  195. package/lib/index-anchor/index.js +2 -11
  196. package/lib/index-bar/IndexIndicate.js +0 -1
  197. package/lib/index-bar/index.js +7 -37
  198. package/lib/index.js +1 -157
  199. package/lib/info/index.js +6 -14
  200. package/lib/lazyload/index.js +0 -3
  201. package/lib/list/index.js +10 -33
  202. package/lib/loading/index.js +7 -21
  203. package/lib/locale/index.js +0 -7
  204. package/lib/media-picker/index.js +27 -153
  205. package/lib/media-picker/media-util.js +2 -15
  206. package/lib/media-picker/type.js +0 -5
  207. package/lib/media-player/index.js +6 -22
  208. package/lib/mixins/bind-event.js +1 -6
  209. package/lib/mixins/checkbox.js +6 -18
  210. package/lib/mixins/click-outside.js +1 -5
  211. package/lib/mixins/close-on-popstate.js +0 -4
  212. package/lib/mixins/field.js +0 -2
  213. package/lib/mixins/popup/index.js +11 -36
  214. package/lib/mixins/popup/overlay.js +1 -23
  215. package/lib/mixins/portal.js +2 -9
  216. package/lib/mixins/relation.js +0 -11
  217. package/lib/mixins/slots.js +1 -5
  218. package/lib/mixins/touch.js +4 -11
  219. package/lib/multiple-picker/MultiplePickerOptions.js +2 -23
  220. package/lib/multiple-picker/index.js +5 -26
  221. package/lib/nav-bar/index.js +4 -16
  222. package/lib/notice-bar/index.js +10 -40
  223. package/lib/number-keyboard/Key.js +2 -17
  224. package/lib/number-keyboard/index.js +4 -26
  225. package/lib/overlay/index.js +5 -16
  226. package/lib/password-input/index.js +10 -23
  227. package/lib/picker/PickerColumn.js +19 -63
  228. package/lib/picker/index.js +13 -53
  229. package/lib/popover/index.js +9 -27
  230. package/lib/popup/index.js +5 -27
  231. package/lib/pull-refresh/index.js +14 -38
  232. package/lib/radio/index.js +2 -7
  233. package/lib/radio-group/index.js +2 -8
  234. package/lib/rate/index.js +11 -31
  235. package/lib/row/index.js +3 -12
  236. package/lib/search/index.js +7 -21
  237. package/lib/signature/bezier.js +5 -15
  238. package/lib/signature/force-landscape.js +0 -11
  239. package/lib/signature/index.js +6 -31
  240. package/lib/signature/point.js +0 -8
  241. package/lib/signature/throttle.js +1 -11
  242. package/lib/skeleton/index.js +5 -21
  243. package/lib/slider/index.js +19 -63
  244. package/lib/step/index.js +5 -18
  245. package/lib/stepper/index.js +10 -46
  246. package/lib/steps/index.js +2 -7
  247. package/lib/sticky/index.js +8 -59
  248. package/lib/swipe/index.js +19 -70
  249. package/lib/swipe-cell/index.js +7 -29
  250. package/lib/swipe-item/index.js +9 -24
  251. package/lib/switch/index.js +7 -14
  252. package/lib/switch/shared.js +1 -1
  253. package/lib/switch-cell/index.js +6 -16
  254. package/lib/tab/index.js +4 -21
  255. package/lib/tabbar/index.js +4 -19
  256. package/lib/tabbar-item/index.js +5 -21
  257. package/lib/table/index.js +10 -38
  258. package/lib/tabs/Content.js +5 -15
  259. package/lib/tabs/Title.js +11 -23
  260. package/lib/tabs/index.js +15 -65
  261. package/lib/tabs/utils.js +0 -13
  262. package/lib/tag/index.js +12 -23
  263. package/lib/timeline/index.js +2 -32
  264. package/lib/toast/Toast.js +10 -30
  265. package/lib/toast/index.js +6 -38
  266. package/lib/toast/lock-click.js +0 -3
  267. package/lib/uploader/index.js +10 -72
  268. package/lib/uploader/utils.js +0 -17
  269. package/lib/utils/constant.js +2 -1
  270. package/lib/utils/create/bem.js +1 -6
  271. package/lib/utils/create/component.js +5 -14
  272. package/lib/utils/create/i18n.js +0 -8
  273. package/lib/utils/create/index.js +0 -4
  274. package/lib/utils/deep-assign.js +0 -6
  275. package/lib/utils/deep-clone.js +0 -5
  276. package/lib/utils/device.js +0 -2
  277. package/lib/utils/dom/event.js +2 -10
  278. package/lib/utils/dom/node.js +0 -2
  279. package/lib/utils/dom/raf.js +7 -11
  280. package/lib/utils/dom/reset-scroll.js +2 -4
  281. package/lib/utils/dom/scroll.js +8 -28
  282. package/lib/utils/dom/style.js +3 -3
  283. package/lib/utils/easings.js +2 -5
  284. package/lib/utils/format/date-util.js +54 -168
  285. package/lib/utils/format/number.js +2 -13
  286. package/lib/utils/format/string.js +0 -5
  287. package/lib/utils/format/unit.js +2 -16
  288. package/lib/utils/functional.js +6 -14
  289. package/lib/utils/getScroll.js +0 -7
  290. package/lib/utils/index.js +3 -19
  291. package/lib/utils/interceptor.js +2 -6
  292. package/lib/utils/media/image-util.js +7 -25
  293. package/lib/utils/raf.js +4 -13
  294. package/lib/utils/router.js +7 -9
  295. package/lib/utils/scrollTo.js +9 -21
  296. package/lib/utils/validate/date.js +0 -2
  297. package/lib/utils/validate/email.js +0 -1
  298. package/lib/utils/validate/mobile.js +0 -1
  299. package/lib/utils/validate/number.js +2 -4
  300. package/lib/utils/validate/system.js +0 -3
  301. package/lib/utils/vnodes.js +2 -9
  302. package/lib/zart.js +57 -18
  303. package/lib/zart.min.js +1 -1
  304. package/package.json +17 -18
@@ -1,79 +1,50 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  exports.__esModule = true;
6
5
  exports.default = void 0;
7
-
8
6
  var _utils = require("../utils");
9
-
10
7
  var _icon = _interopRequireDefault(require("../icon"));
11
-
12
8
  var _loading = _interopRequireDefault(require("../loading"));
13
-
14
9
  var _image = _interopRequireDefault(require("../image"));
15
-
16
10
  var _gridItem = _interopRequireDefault(require("../grid-item"));
17
-
18
11
  var _mediaPlayer = _interopRequireDefault(require("../media-player"));
19
-
20
12
  var _actionSheet = _interopRequireDefault(require("../action-sheet"));
21
-
22
13
  var _grid = _interopRequireDefault(require("../grid"));
23
-
24
14
  var _type = require("./type");
25
-
26
15
  var _media = require("@egova/media");
27
-
28
16
  var _toast = _interopRequireDefault(require("../toast"));
29
-
30
17
  var _imagePreview = _interopRequireDefault(require("../image-preview"));
31
-
32
18
  var _TakePhotoIcon = _interopRequireDefault(require("./image/TakePhotoIcon"));
33
-
34
19
  var _PickPhotoIcon = _interopRequireDefault(require("./image/PickPhotoIcon"));
35
-
36
20
  var _TakeVideoIcon = _interopRequireDefault(require("./image/TakeVideoIcon"));
37
-
38
21
  var _TakeAudioIcon = _interopRequireDefault(require("./image/TakeAudioIcon"));
39
-
40
22
  var _PickFileIcon = _interopRequireDefault(require("./image/PickFileIcon"));
41
-
42
23
  var _DeleteIcon = _interopRequireDefault(require("./image/DeleteIcon"));
43
-
44
24
  var _ReUpload = _interopRequireDefault(require("./image/ReUpload"));
45
-
46
25
  var _DefaultVideoIcon = _interopRequireDefault(require("./image/DefaultVideoIcon"));
47
-
48
26
  var _DefaultAudioIcon = _interopRequireDefault(require("./image/DefaultAudioIcon"));
49
-
50
27
  var _DefaultFileIcon = _interopRequireDefault(require("./image/DefaultFileIcon"));
51
-
52
28
  var _DefaultDocIcon = _interopRequireDefault(require("./image/DefaultDocIcon"));
53
-
54
29
  var _DefaultExcelIcon = _interopRequireDefault(require("./image/DefaultExcelIcon"));
55
-
56
30
  var _DefaultPdfIcon = _interopRequireDefault(require("./image/DefaultPdfIcon"));
57
-
58
31
  var _DefaultPptIcon = _interopRequireDefault(require("./image/DefaultPptIcon"));
59
-
60
32
  var _DefaultTextIcon = _interopRequireDefault(require("./image/DefaultTextIcon"));
61
-
62
33
  var _Img = require("./image/Img64");
63
-
64
34
  var _mediaUtil = require("./media-util");
65
-
66
35
  // Utils
36
+
67
37
  // Types
38
+
68
39
  // import components
40
+
69
41
  // Images
42
+
70
43
  // 单个文件最大限制,单位为M(目前限制是100M)
71
44
  var FILE_SIZE_LIMIT = 100;
72
-
73
45
  var _createNamespace = (0, _utils.createNamespace)('media-picker'),
74
- createComponent = _createNamespace[0],
75
- bem = _createNamespace[1];
76
-
46
+ createComponent = _createNamespace[0],
47
+ bem = _createNamespace[1];
77
48
  var _default2 = createComponent({
78
49
  props: {
79
50
  disabled: Boolean,
@@ -106,7 +77,6 @@ var _default2 = createComponent({
106
77
  type: Number,
107
78
  default: FILE_SIZE_LIMIT * 1024
108
79
  },
109
-
110
80
  /**
111
81
  * {
112
82
  * maxImageSideLength,
@@ -220,7 +190,6 @@ var _default2 = createComponent({
220
190
  },
221
191
  actionOptions: function actionOptions() {
222
192
  var _this = this;
223
-
224
193
  if (this.videoOptionsVisible) {
225
194
  return [{
226
195
  name: '拍摄',
@@ -253,24 +222,20 @@ var _default2 = createComponent({
253
222
  if (this.disabled) {
254
223
  return;
255
224
  }
256
-
257
225
  if (!this.checkFileCountBeforeAdd(mediaType)) {
258
226
  return;
259
227
  }
260
-
261
228
  if (this.mediaPickAction && this.mediaPickAction(mediaType, mediaAddType)) {
262
229
  return;
263
230
  }
264
-
265
231
  var _this$$refs = this.$refs,
266
- cameraInput = _this$$refs.cameraInput,
267
- imageInput = _this$$refs.imageInput,
268
- camcorderInput = _this$$refs.camcorderInput,
269
- videoFileInput = _this$$refs.videoFileInput,
270
- audioRecorderInput = _this$$refs.audioRecorderInput,
271
- audioFileInput = _this$$refs.audioFileInput,
272
- fileInput = _this$$refs.fileInput;
273
-
232
+ cameraInput = _this$$refs.cameraInput,
233
+ imageInput = _this$$refs.imageInput,
234
+ camcorderInput = _this$$refs.camcorderInput,
235
+ videoFileInput = _this$$refs.videoFileInput,
236
+ audioRecorderInput = _this$$refs.audioRecorderInput,
237
+ audioFileInput = _this$$refs.audioFileInput,
238
+ fileInput = _this$$refs.fileInput;
274
239
  if (mediaType === _type.MediaType.PHOTO) {
275
240
  if (mediaAddType === _type.MediaAddType.TAKE) {
276
241
  this.triggerHiddenInput(cameraInput);
@@ -306,7 +271,6 @@ var _default2 = createComponent({
306
271
  ref.click();
307
272
  }
308
273
  },
309
-
310
274
  /**
311
275
  * 清空value,避免添加相同图片时 change 事件不触发:https://stackoverflow.com/a/54125788/1263423
312
276
  * @param mediaType
@@ -314,14 +278,13 @@ var _default2 = createComponent({
314
278
  */
315
279
  resetInput: function resetInput(mediaType, mediaAddType) {
316
280
  var _this$$refs2 = this.$refs,
317
- cameraInput = _this$$refs2.cameraInput,
318
- imageInput = _this$$refs2.imageInput,
319
- camcorderInput = _this$$refs2.camcorderInput,
320
- videoFileInput = _this$$refs2.videoFileInput,
321
- audioRecorderInput = _this$$refs2.audioRecorderInput,
322
- audioFileInput = _this$$refs2.audioFileInput,
323
- fileInput = _this$$refs2.fileInput;
324
-
281
+ cameraInput = _this$$refs2.cameraInput,
282
+ imageInput = _this$$refs2.imageInput,
283
+ camcorderInput = _this$$refs2.camcorderInput,
284
+ videoFileInput = _this$$refs2.videoFileInput,
285
+ audioRecorderInput = _this$$refs2.audioRecorderInput,
286
+ audioFileInput = _this$$refs2.audioFileInput,
287
+ fileInput = _this$$refs2.fileInput;
325
288
  if (mediaType === _type.MediaType.PHOTO) {
326
289
  if (mediaAddType === _type.MediaAddType.TAKE) {
327
290
  cameraInput.value = '';
@@ -346,34 +309,25 @@ var _default2 = createComponent({
346
309
  },
347
310
  handleInputFiles: function handleInputFiles(event) {
348
311
  var _this2 = this;
349
-
350
312
  var files = event.target.files;
351
-
352
313
  if (!files || files.length === 0) {
353
314
  return;
354
315
  }
355
-
356
316
  if (this.pickerMode === "certificate") {
357
317
  files = [files[0]];
358
318
  }
359
-
360
319
  files = this.filterValidFiles(files);
361
-
362
320
  if (files.length === 0) {
363
321
  return;
364
322
  }
365
-
366
323
  if (!this.checkFileCountAfterAdd(files)) {
367
324
  return;
368
325
  }
369
-
370
326
  if (this.beforeRead) {
371
327
  var response = this.beforeRead(files);
372
-
373
328
  if (!response) {
374
329
  return;
375
330
  }
376
-
377
331
  if ((0, _utils.isPromise)(response)) {
378
332
  response.then(function (data) {
379
333
  if (data) {
@@ -385,12 +339,10 @@ var _default2 = createComponent({
385
339
  return;
386
340
  }
387
341
  }
388
-
389
342
  this.readFiles(files);
390
343
  },
391
344
  readFiles: function readFiles(files) {
392
345
  var _this3 = this;
393
-
394
346
  // 处理非图片
395
347
  var notImages = files.filter(function (f) {
396
348
  return !(0, _mediaUtil.isImageType)(f);
@@ -398,23 +350,19 @@ var _default2 = createComponent({
398
350
  return _this3.transformNotImageFile(f);
399
351
  });
400
352
  var newMedias = [];
401
-
402
353
  if (notImages.length > 0) {
403
354
  newMedias = newMedias.concat(notImages);
404
- } // 处理图片并合并
405
-
406
-
355
+ }
356
+ // 处理图片并合并
407
357
  var imageFiles = files.filter(function (f) {
408
358
  return (0, _mediaUtil.isImageType)(f);
409
359
  });
410
360
  var promise;
411
-
412
361
  if (imageFiles.length === 0) {
413
362
  promise = Promise.resolve();
414
363
  } else {
415
364
  promise = this.transformImageFiles(imageFiles);
416
365
  }
417
-
418
366
  promise.then(function (medias) {
419
367
  if (medias && medias.length > 0) {
420
368
  newMedias = newMedias.concat(medias);
@@ -425,116 +373,89 @@ var _default2 = createComponent({
425
373
  } else {
426
374
  _this3.$emit('input', [].concat(_this3.mediaList, newMedias));
427
375
  }
428
-
429
376
  if (_this3.afterRead) {
430
377
  _this3.afterRead(newMedias);
431
378
  }
432
379
  });
433
380
  },
434
-
435
381
  /**
436
382
  * 选择多媒体前进行数量检查
437
383
  */
438
384
  checkFileCountBeforeAdd: function checkFileCountBeforeAdd(mediaType) {
439
385
  if (this.mediaList.length === this.maxMediaCount) {
440
386
  _toast.default.fail("\u5DF2\u8FBE\u5230\u6587\u4EF6\u6700\u5927\u6570\u91CF\u9650\u5236");
441
-
442
387
  return false;
443
388
  }
444
-
445
389
  if (mediaType === _type.MediaType.PHOTO && this.mediaList.filter(function (media) {
446
390
  return media.type === _type.MediaType.PHOTO;
447
391
  }).length > this.maxImageCount) {
448
392
  _toast.default.fail("\u5DF2\u8FBE\u5230\u56FE\u7247\u6700\u5927\u6570\u91CF\u9650\u5236");
449
-
450
393
  return false;
451
394
  }
452
-
453
395
  if (mediaType === _type.MediaType.VIDEO && this.mediaList.filter(function (media) {
454
396
  return media.type === _type.MediaType.VIDEO;
455
397
  }).length > this.maxVideoCount) {
456
398
  _toast.default.fail("\u5DF2\u8FBE\u5230\u89C6\u9891\u6700\u5927\u6570\u91CF\u9650\u5236");
457
-
458
399
  return false;
459
400
  }
460
-
461
401
  if (mediaType === _type.MediaType.AUDIO && this.mediaList.filter(function (media) {
462
402
  return media.type === _type.MediaType.AUDIO;
463
403
  }).length > this.maxAudioCount) {
464
404
  _toast.default.fail("\u5DF2\u8FBE\u5230\u5F55\u97F3\u6700\u5927\u6570\u91CF\u9650\u5236");
465
-
466
405
  return false;
467
406
  }
468
-
469
407
  return true;
470
408
  },
471
-
472
409
  /**
473
410
  * 选择多媒体后进行数量检查
474
411
  */
475
412
  checkFileCountAfterAdd: function checkFileCountAfterAdd(files) {
476
413
  if (this.mediaList.length + files.length > this.maxMediaCount) {
477
414
  _toast.default.fail("\u6700\u591A\u53EA\u80FD\u4E0A\u4F20" + this.maxMediaCount + "\u4E2A\u6587\u4EF6");
478
-
479
415
  return false;
480
416
  }
481
-
482
417
  if (this.mediaList.filter(function (media) {
483
418
  return media.type === _type.MediaType.PHOTO;
484
419
  }).length + files.filter(function (media) {
485
420
  return (0, _mediaUtil.isImageType)(media);
486
421
  }).length > this.maxImageCount) {
487
422
  _toast.default.fail("\u6700\u591A\u53EA\u80FD\u4E0A\u4F20" + this.maxImageCount + "\u5F20\u56FE\u7247");
488
-
489
423
  return false;
490
424
  }
491
-
492
425
  if (this.mediaList.filter(function (media) {
493
426
  return media.type === _type.MediaType.VIDEO;
494
427
  }).length + files.filter(function (media) {
495
428
  return (0, _mediaUtil.isVideoType)(media);
496
429
  }).length > this.maxVideoCount) {
497
430
  _toast.default.fail("\u6700\u591A\u53EA\u80FD\u4E0A\u4F20" + this.maxVideoCount + "\u4E2A\u89C6\u9891");
498
-
499
431
  return false;
500
432
  }
501
-
502
433
  if (this.mediaList.filter(function (media) {
503
434
  return media.type === _type.MediaType.AUDIO;
504
435
  }).length + files.filter(function (media) {
505
436
  return (0, _mediaUtil.isAudioType)(media);
506
437
  }).length > this.maxAudioCount) {
507
438
  _toast.default.fail("\u6700\u591A\u53EA\u80FD\u4E0A\u4F20" + this.maxAudioCount + "\u4E2A\u5F55\u97F3");
508
-
509
439
  return false;
510
440
  }
511
-
512
441
  return true;
513
442
  },
514
443
  filterValidFiles: function filterValidFiles(files) {
515
444
  var validFiles = [];
516
-
517
445
  for (var i = 0; i < files.length; i++) {
518
446
  var file = files[i];
519
-
520
447
  if (file.size > this.maxFileSize * 1024) {
521
448
  _toast.default.fail("\u8BF7\u52FF\u6DFB\u52A0\u5927\u4E8E" + this.maxFileSize + "K\u7684\u6587\u4EF6");
522
-
523
449
  return validFiles;
524
450
  }
525
-
526
451
  if (this.checkFileExist(file)) {
527
452
  _toast.default.fail('请勿重复添加文件');
528
-
529
453
  return validFiles;
530
454
  }
531
-
532
455
  validFiles.push(file);
533
456
  }
534
-
535
457
  return validFiles;
536
458
  },
537
-
538
459
  /**
539
460
  * 转换图片文件,压缩、加水印,返回Media格式的图片
540
461
  * @param files 图片文件
@@ -542,16 +463,13 @@ var _default2 = createComponent({
542
463
  */
543
464
  transformImageFiles: function transformImageFiles(files) {
544
465
  var _this4 = this;
545
-
546
466
  var promisesTodo = [];
547
467
  var resizeOptions = new _media.ResizeOptions(this.maxImageSideLength);
548
468
  var compressOptions = new _media.CompressOptions(this.maxImageFileSize);
549
-
550
469
  var _loop = function _loop(i) {
551
470
  var file = files[i];
552
471
  var watermarkEnabled = _this4.watermarkOptions && _this4.watermarkOptions.watermarkConfigString && (0, _media.checkWatermarkConfigSupported)(_this4.watermarkOptions.watermarkConfigString);
553
472
  var watermarkOpt = void 0;
554
-
555
473
  if (watermarkEnabled) {
556
474
  watermarkOpt = new _media.WatermarkOptions({
557
475
  enabled: true,
@@ -570,12 +488,10 @@ var _default2 = createComponent({
570
488
  enabled: false
571
489
  });
572
490
  }
573
-
574
491
  var promise = new _media.ImageProcessor(file, resizeOptions, watermarkOpt, compressOptions).process().then(function (f) {
575
492
  if (!f) {
576
493
  return Promise.resolve();
577
494
  }
578
-
579
495
  return (0, _media.file2DataURL)(f).then(function (base64) {
580
496
  var uniqueFileName = (0, _mediaUtil.getUniqueFileName)(f, 'jpg');
581
497
  return Promise.resolve({
@@ -599,23 +515,19 @@ var _default2 = createComponent({
599
515
  originalName: file.name,
600
516
  // 原始名称
601
517
  originalSize: file.size // 原始大小
602
-
603
518
  });
604
519
  });
605
520
  });
606
521
  promisesTodo.push(promise);
607
522
  };
608
-
609
523
  for (var i = 0; i < files.length; i++) {
610
524
  _loop(i);
611
525
  }
612
-
613
526
  _toast.default.loading({
614
527
  message: '处理中...',
615
528
  forbidClick: true,
616
529
  duration: 0
617
530
  });
618
-
619
531
  return Promise.all(promisesTodo).then(function (medias) {
620
532
  return medias.filter(function (media) {
621
533
  return !!media;
@@ -624,7 +536,6 @@ var _default2 = createComponent({
624
536
  _toast.default.clear();
625
537
  });
626
538
  },
627
-
628
539
  /**
629
540
  * 转换非图片文件
630
541
  * @param {File} f 非图片文件
@@ -634,7 +545,6 @@ var _default2 = createComponent({
634
545
  console.warn("type", f.type);
635
546
  var suffix = '';
636
547
  var type = _type.MediaType.FILE;
637
-
638
548
  if ((0, _mediaUtil.isAudioType)(f)) {
639
549
  type = _type.MediaType.AUDIO;
640
550
  suffix = 'mp3';
@@ -654,7 +564,6 @@ var _default2 = createComponent({
654
564
  } else {
655
565
  type = _type.MediaType.FILE;
656
566
  }
657
-
658
567
  var uniqueFileName = (0, _mediaUtil.getUniqueFileName)(f, suffix);
659
568
  return {
660
569
  type: type,
@@ -670,7 +579,6 @@ var _default2 = createComponent({
670
579
  message: ''
671
580
  };
672
581
  },
673
-
674
582
  /**
675
583
  * 检查文件是否重复添加
676
584
  */
@@ -679,7 +587,6 @@ var _default2 = createComponent({
679
587
  return media.uniqueCode === (0, _mediaUtil.getFileUniqueCode)(file);
680
588
  });
681
589
  },
682
-
683
590
  /**
684
591
  * 点击预览
685
592
  */
@@ -687,7 +594,6 @@ var _default2 = createComponent({
687
594
  if (this.preview && this.preview(media, index)) {
688
595
  return;
689
596
  }
690
-
691
597
  if (media.type === _type.MediaType.PHOTO) {
692
598
  var imageIndex = this.imageList.indexOf(media);
693
599
  (0, _imagePreview.default)({
@@ -704,8 +610,8 @@ var _default2 = createComponent({
704
610
  (0, _toast.default)('文件参数缺失');
705
611
  } else {
706
612
  this.mediaTypeToPlay = media.type;
707
- this.mediaUrlToPlay = media.url || (URL || webkitURL).createObjectURL(media.file); // this.mediaUrlToPlay = 'http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4'
708
-
613
+ this.mediaUrlToPlay = media.url || (URL || webkitURL).createObjectURL(media.file);
614
+ // this.mediaUrlToPlay = 'http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4'
709
615
  this.mediaPlayerVisible = true;
710
616
  }
711
617
  } else {
@@ -714,14 +620,11 @@ var _default2 = createComponent({
714
620
  },
715
621
  onDelete: function onDelete(media, index) {
716
622
  var _this5 = this;
717
-
718
623
  if (this.beforeDelete) {
719
624
  var response = this.beforeDelete(media);
720
-
721
625
  if (!response) {
722
626
  return;
723
627
  }
724
-
725
628
  if ((0, _utils.isPromise)(response)) {
726
629
  response.then(function () {
727
630
  _this5.deleteMedia(media, index);
@@ -729,7 +632,6 @@ var _default2 = createComponent({
729
632
  return;
730
633
  }
731
634
  }
732
-
733
635
  this.deleteMedia(media, index);
734
636
  },
735
637
  deleteMedia: function deleteMedia(media, index) {
@@ -740,7 +642,6 @@ var _default2 = createComponent({
740
642
  },
741
643
  hiddenInput: function hiddenInput() {
742
644
  var _this6 = this;
743
-
744
645
  var h = this.$createElement;
745
646
  return [h("input", {
746
647
  "attrs": {
@@ -842,9 +743,7 @@ var _default2 = createComponent({
842
743
  },
843
744
  renderIcon: function renderIcon(mediaType, mediaAddType) {
844
745
  var _this7 = this;
845
-
846
746
  var h = this.$createElement;
847
-
848
747
  if (mediaType === _type.MediaType.PHOTO) {
849
748
  if (mediaAddType === _type.MediaAddType.TAKE) {
850
749
  return h(_TakePhotoIcon.default, {
@@ -897,7 +796,6 @@ var _default2 = createComponent({
897
796
  renderButton: function renderButton(mediaType, mediaAddType) {
898
797
  var h = this.$createElement;
899
798
  var label = '';
900
-
901
799
  if (mediaType === _type.MediaType.PHOTO) {
902
800
  if (mediaAddType === _type.MediaAddType.TAKE) {
903
801
  label = '拍照';
@@ -911,7 +809,6 @@ var _default2 = createComponent({
911
809
  } else if (mediaType === _type.MediaType.FILE) {
912
810
  label = '文档';
913
811
  }
914
-
915
812
  return h("div", {
916
813
  "class": bem('box')
917
814
  }, [this.renderIcon(mediaType, mediaAddType), h("div", {
@@ -920,9 +817,7 @@ var _default2 = createComponent({
920
817
  },
921
818
  renderCertificates: function renderCertificates() {
922
819
  var _this8 = this;
923
-
924
820
  var h = this.$createElement;
925
-
926
821
  if (this.mediaList && this.mediaList.length) {
927
822
  var media = this.mediaList[0];
928
823
  var showDelete = media.deletable && media.status !== _type.MediaUploadStatus.UPLOADING;
@@ -931,9 +826,7 @@ var _default2 = createComponent({
931
826
  "on": {
932
827
  "click": function click(event) {
933
828
  event.stopPropagation();
934
-
935
829
  _this8.onDelete(media, 0);
936
-
937
830
  _this8.mediaPick(_type.MediaType.PHOTO, _type.MediaAddType.PICK);
938
831
  }
939
832
  }
@@ -950,8 +843,8 @@ var _default2 = createComponent({
950
843
  },
951
844
  "on": {
952
845
  "click": function click(event) {
953
- event.stopPropagation(); // 证件照模式只有一张图片
954
-
846
+ event.stopPropagation();
847
+ // 证件照模式只有一张图片
955
848
  _this8.previewMedia(media, 0);
956
849
  }
957
850
  }
@@ -979,50 +872,39 @@ var _default2 = createComponent({
979
872
  },
980
873
  renderButtons: function renderButtons() {
981
874
  var buttons = [];
982
-
983
875
  if (this.allowTakePhoto) {
984
876
  buttons.push(this.renderButton(_type.MediaType.PHOTO, _type.MediaAddType.TAKE));
985
877
  }
986
-
987
878
  if (this.allowPickPhoto) {
988
879
  buttons.push(this.renderButton(_type.MediaType.PHOTO, _type.MediaAddType.PICK));
989
880
  }
990
-
991
881
  if (this.allowTakeVideo || this.allowPickVideo) {
992
882
  var addType = _type.MediaAddType.TAKE_AND_PICK;
993
-
994
883
  if (!this.allowTakeVideo) {
995
884
  addType = _type.MediaAddType.PICK;
996
885
  } else if (!this.allowPickVideo) {
997
886
  addType = _type.MediaAddType.TAKE;
998
887
  }
999
-
1000
888
  buttons.push(this.renderButton(_type.MediaType.VIDEO, addType));
1001
889
  }
1002
-
1003
890
  if (this.allowTakeAudio || this.allowPickAudio) {
1004
891
  var _addType = _type.MediaAddType.TAKE_AND_PICK;
1005
-
1006
892
  if (!this.allowTakeAudio) {
1007
893
  _addType = _type.MediaAddType.PICK;
1008
894
  } else if (!this.allowPickAudio) {
1009
895
  _addType = _type.MediaAddType.TAKE;
1010
896
  }
1011
-
1012
897
  buttons.push(this.renderButton(_type.MediaType.AUDIO, _addType));
1013
898
  }
1014
-
1015
899
  if (this.allowPickFile) {
1016
900
  buttons.push(this.renderButton(_type.MediaType.FILE, _type.MediaAddType.PICK));
1017
901
  }
1018
-
1019
902
  return buttons;
1020
903
  },
1021
904
  genThumbnailMask: function genThumbnailMask(media) {
1022
905
  var h = this.$createElement;
1023
906
  var status = media.status,
1024
- message = media.message;
1025
-
907
+ message = media.message;
1026
908
  if (status === _type.MediaUploadStatus.UPLOADING || status === _type.MediaUploadStatus.FAILED) {
1027
909
  var MaskIcon = status === _type.MediaUploadStatus.FAILED ? h(_icon.default, {
1028
910
  "attrs": {
@@ -1042,7 +924,6 @@ var _default2 = createComponent({
1042
924
  },
1043
925
  renderMediaBox: function renderMediaBox(media) {
1044
926
  var h = this.$createElement;
1045
-
1046
927
  if (!this.showFileName) {
1047
928
  return this.renderMediaThumbnail(media);
1048
929
  } else {
@@ -1053,13 +934,11 @@ var _default2 = createComponent({
1053
934
  }, [media.name || media.fileName])]);
1054
935
  }
1055
936
  },
1056
-
1057
937
  /**
1058
938
  * 多媒体对应展示的缩略图
1059
939
  */
1060
940
  renderMediaThumbnail: function renderMediaThumbnail(media) {
1061
941
  var h = this.$createElement;
1062
-
1063
942
  if (media.showSrc) {
1064
943
  return h(_image.default, {
1065
944
  "attrs": {
@@ -1104,7 +983,6 @@ var _default2 = createComponent({
1104
983
  },
1105
984
  renderMediaList: function renderMediaList() {
1106
985
  var _this9 = this;
1107
-
1108
986
  var h = this.$createElement;
1109
987
  return this.mediaList.map(function (media, index) {
1110
988
  var showDelete = media.deletable && media.status !== _type.MediaUploadStatus.UPLOADING;
@@ -1113,7 +991,6 @@ var _default2 = createComponent({
1113
991
  "on": {
1114
992
  "click": function click(event) {
1115
993
  event.stopPropagation();
1116
-
1117
994
  _this9.onDelete(media, index);
1118
995
  }
1119
996
  }
@@ -1123,7 +1000,6 @@ var _default2 = createComponent({
1123
1000
  "on": {
1124
1001
  "click": function click(event) {
1125
1002
  event.stopPropagation();
1126
-
1127
1003
  _this9.previewMedia(media, index);
1128
1004
  }
1129
1005
  }
@@ -1137,7 +1013,6 @@ var _default2 = createComponent({
1137
1013
  },
1138
1014
  render: function render() {
1139
1015
  var _this10 = this;
1140
-
1141
1016
  var h = arguments[0];
1142
1017
  var title = this.showTitle && h("div", {
1143
1018
  "class": bem('title')
@@ -1193,5 +1068,4 @@ var _default2 = createComponent({
1193
1068
  }, [this.renderMediaList()])]);
1194
1069
  }
1195
1070
  });
1196
-
1197
1071
  exports.default = _default2;