zartui 0.1.72 → 0.1.73
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/es/index.js +1 -1
- package/es/media-picker/image/TakePhotoIcon.js +0 -1
- package/es/media-picker/index.css +1 -1
- package/es/media-picker/index.js +246 -59
- package/es/media-picker/index.less +33 -0
- package/es/media-picker/type.js +8 -0
- package/es/utils/router.js +1 -2
- package/es/utils/vnodes.js +2 -2
- package/lib/calendar/utils.js +7 -9
- package/lib/count-down/utils.js +2 -2
- package/lib/datetime-picker/shared.js +1 -1
- package/lib/datetime-picker/utils.js +2 -2
- package/lib/image-preview/shared.js +1 -1
- package/lib/index.css +1 -1
- package/lib/index.js +2 -3
- package/lib/media-picker/image/TakePhotoIcon.js +0 -1
- package/lib/media-picker/index.css +1 -1
- package/lib/media-picker/index.js +253 -57
- package/lib/media-picker/index.less +33 -0
- package/lib/media-picker/media-util.js +3 -3
- package/lib/media-picker/type.js +10 -1
- package/lib/mixins/popup/overlay.js +2 -2
- package/lib/signature/force-landscape.js +1 -1
- package/lib/telemetry/index.js +1 -1
- package/lib/uploader/utils.js +4 -4
- package/lib/utils/constant.js +1 -1
- package/lib/utils/create/component.js +1 -1
- package/lib/utils/device.js +1 -1
- package/lib/utils/dom/event.js +2 -2
- package/lib/utils/dom/raf.js +2 -2
- package/lib/utils/dom/scroll.js +5 -5
- package/lib/utils/format/date-util.js +31 -32
- package/lib/utils/format/number.js +2 -2
- package/lib/utils/functional.js +1 -1
- package/lib/utils/getScroll.js +1 -1
- package/lib/utils/index.js +4 -6
- package/lib/utils/media/image-util.js +3 -3
- package/lib/utils/router.js +2 -3
- package/lib/utils/validate/number.js +1 -1
- package/lib/utils/vnodes.js +2 -2
- package/lib/zart.js +256 -63
- package/lib/zart.min.js +4 -4
- package/package.json +1 -1
package/es/index.js
CHANGED
|
@@ -74,7 +74,7 @@ import Tabs from './tabs';
|
|
|
74
74
|
import Tag from './tag';
|
|
75
75
|
import Toast from './toast';
|
|
76
76
|
import Uploader from './uploader';
|
|
77
|
-
var version = '0.1.
|
|
77
|
+
var version = '0.1.73';
|
|
78
78
|
|
|
79
79
|
function install(Vue) {
|
|
80
80
|
var components = [ActionSheet, Area, Avatar, BackTop, Badge, Button, Calendar, Cascader, Cell, CellGroup, Checkbox, CheckboxGroup, Col, Collapse, CollapseItem, CountDown, DatetimePicker, Dialog, Divider, DropdownItem, DropdownMenu, Empty, Field, FoldDialog, Form, Grid, GridItem, HierarchySelect, Icon, Image, ImagePreview, IndexAnchor, IndexBar, Info, Lazyload, List, Loading, Locale, MediaPicker, MediaPlayer, MultiplePicker, NavBar, NoticeBar, NumberKeyboard, Overlay, PasswordInput, PdfViewer, Picker, Popover, Popup, PullRefresh, Radio, RadioGroup, Rate, Row, Search, Signature, Skeleton, Slider, Step, Stepper, Steps, Sticky, Swipe, SwipeCell, SwipeItem, Switch, SwitchCell, Tab, Tabbar, TabbarItem, Table, Tabs, Tag, Toast, Uploader];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.zt-media-picker{background-color:#fff}.zt-media-picker__hidden{display:none}.zt-media-picker__title{position:relative;height:44px;line-height:44px;font-weight:700;font-size:16px;color:#000;padding:0 16px}.zt-media-picker__title::before{position:absolute;width:4px;height:16px;background:#0091fa;left:0;top:14px;content:' '}.zt-media-picker__title::after{position:absolute;box-sizing:border-box;content:' ';pointer-events:none;right:0;bottom:0;left:0;border-bottom:1px solid rgba(0,0,0,.1);-webkit-transform:scaleY(.5);transform:scaleY(.5)}.zt-media-picker__line{width:100%;height:92px;display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-align:center;-webkit-align-items:center;align-items:center;overflow-x:auto}.zt-media-picker__line::-webkit-scrollbar{width:0;height:0}.zt-media-picker__line::after{content:' ';min-width:16px;height:10px}.zt-media-picker__box{width:48px;display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-webkit-flex-direction:column;flex-direction:column;-webkit-box-align:center;-webkit-align-items:center;align-items:center}.zt-media-picker__box:first-child{margin-left:16px}.zt-media-picker__box:not(:last-child){margin-right:24px}.zt-media-picker__button{width:48px;height:48px}.zt-media-picker__label{margin-top:4px;font-size:12px;opacity:.8;color:#000;letter-spacing:0;text-align:center;line-height:16px}.zt-media-picker__grid{padding:0 16px 8px 16px!important}.zt-media-picker__delete{width:20px;height:20px;position:absolute;padding:4px;top:0;right:0}.zt-media-picker .zt-image{width:100%;height:100%}.zt-media-picker .zt-grid-item__content{padding:0}.zt-media-picker__thumbnail{width:100%;height:100%}
|
|
1
|
+
.zt-media-picker{background-color:#fff}.zt-media-picker__hidden{display:none}.zt-media-picker__title{position:relative;height:44px;line-height:44px;font-weight:700;font-size:16px;color:#000;padding:0 16px}.zt-media-picker__title::before{position:absolute;width:4px;height:16px;background:#0091fa;left:0;top:14px;content:' '}.zt-media-picker__title::after{position:absolute;box-sizing:border-box;content:' ';pointer-events:none;right:0;bottom:0;left:0;border-bottom:1px solid rgba(0,0,0,.1);-webkit-transform:scaleY(.5);transform:scaleY(.5)}.zt-media-picker__line{width:100%;height:92px;display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-align:center;-webkit-align-items:center;align-items:center;overflow-x:auto}.zt-media-picker__line::-webkit-scrollbar{width:0;height:0}.zt-media-picker__line::after{content:' ';min-width:16px;height:10px}.zt-media-picker__box{width:48px;display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-webkit-flex-direction:column;flex-direction:column;-webkit-box-align:center;-webkit-align-items:center;align-items:center}.zt-media-picker__box:first-child{margin-left:16px}.zt-media-picker__box:not(:last-child){margin-right:24px}.zt-media-picker__button{width:48px;height:48px}.zt-media-picker__label{margin-top:4px;font-size:12px;opacity:.8;color:#000;letter-spacing:0;text-align:center;line-height:16px}.zt-media-picker__grid{padding:0 16px 8px 16px!important}.zt-media-picker__delete{width:20px;height:20px;position:absolute;padding:4px;top:0;right:0}.zt-media-picker .zt-image{width:100%;height:100%}.zt-media-picker .zt-grid-item__content{padding:0}.zt-media-picker__thumbnail{width:100%;height:100%}.zt-media-picker__mask{position:absolute;top:0;right:0;bottom:0;left:0;display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-webkit-flex-direction:column;flex-direction:column;-webkit-box-align:center;-webkit-align-items:center;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;justify-content:center;color:#fff;background-color:rgba(50,50,51,.88);border-radius:4px}.zt-media-picker__mask-icon{font-size:22px}.zt-media-picker__mask-message{margin-top:6px;padding:0 4px;font-size:12px;line-height:14px}.zt-media-picker__loading{width:22px;height:22px;color:#fff}
|
package/es/media-picker/index.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
1
|
// Utils
|
|
3
|
-
import { createNamespace } from '../utils'; // Types
|
|
2
|
+
import { createNamespace, isDef, isPromise, noop } from '../utils'; // Types
|
|
4
3
|
|
|
5
|
-
import { MediaAddType, MediaType, Media } from "./type";
|
|
6
|
-
import { CompressOptions, file2DataURL, ImageProcessor, ResizeOptions, WatermarkOptions } from "@egova/media"; // 单个文件最大限制,单位为M(目前限制是100M)
|
|
4
|
+
import { MediaAddType, MediaType, Media, MediaUploadStatus } from "./type";
|
|
5
|
+
import { checkWatermarkConfigSupported, CompressOptions, file2DataURL, ImageProcessor, ResizeOptions, WatermarkOptions } from "@egova/media"; // 单个文件最大限制,单位为M(目前限制是100M)
|
|
7
6
|
|
|
8
7
|
var FILE_SIZE_LIMIT = 100;
|
|
9
8
|
|
|
@@ -25,6 +24,8 @@ import DefaultVideoIcon from "./image/DefaultVideoIcon";
|
|
|
25
24
|
import DefaultAudioIcon from "./image/DefaultAudioIcon";
|
|
26
25
|
import DefaultFileIcon from "./image/DefaultFileIcon";
|
|
27
26
|
import { getFileUniqueCode, getUniqueFileName, isAudioType, isImageType, isVideoType } from "./media-util";
|
|
27
|
+
import Icon from "../icon";
|
|
28
|
+
import Loading from "../loading";
|
|
28
29
|
export default createComponent({
|
|
29
30
|
props: {
|
|
30
31
|
disabled: Boolean,
|
|
@@ -41,22 +42,28 @@ export default createComponent({
|
|
|
41
42
|
// 图片压缩后的最大边长
|
|
42
43
|
maxImageSideLength: {
|
|
43
44
|
type: Number,
|
|
44
|
-
default:
|
|
45
|
+
default: 1920
|
|
45
46
|
},
|
|
46
47
|
// 单个图片文件大小限制(本单位为KB,默认最大1M)
|
|
47
48
|
maxImageFileSize: {
|
|
48
49
|
type: Number,
|
|
49
50
|
default: 1024
|
|
50
51
|
},
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* {
|
|
55
|
+
* maxImageSideLength,
|
|
56
|
+
* address,
|
|
57
|
+
* humanName,
|
|
58
|
+
* projectName,
|
|
59
|
+
* watermarkConfigString
|
|
60
|
+
* (http://faq.egova.com.cn:7777/redmine/projects/redmine/wiki/%E6%8B%8D%E7%85%A7%E6%B0%B4%E5%8D%B0%E9%85%8D%E7%BD%AE)
|
|
61
|
+
* }
|
|
62
|
+
*/
|
|
63
|
+
watermarkOptions: {
|
|
57
64
|
type: Object,
|
|
58
65
|
default: function _default() {
|
|
59
|
-
return
|
|
66
|
+
return null;
|
|
60
67
|
}
|
|
61
68
|
},
|
|
62
69
|
//多媒体类型、数量、大小配置
|
|
@@ -70,7 +77,12 @@ export default createComponent({
|
|
|
70
77
|
allowPickVideo: true,
|
|
71
78
|
allowTakeAudio: true,
|
|
72
79
|
allowPickAudio: true,
|
|
73
|
-
allowPickFile: true
|
|
80
|
+
allowPickFile: true,
|
|
81
|
+
maxMediaCount: Number.MAX_VALUE,
|
|
82
|
+
maxImageCount: Number.MAX_VALUE,
|
|
83
|
+
maxAudioCount: Number.MAX_VALUE,
|
|
84
|
+
maxVideoCount: Number.MAX_VALUE,
|
|
85
|
+
maxFileCount: Number.MAX_VALUE
|
|
74
86
|
};
|
|
75
87
|
}
|
|
76
88
|
},
|
|
@@ -79,7 +91,13 @@ export default createComponent({
|
|
|
79
91
|
preview: Function,
|
|
80
92
|
// 点击按钮事件(返回true时不再执行默认行为)
|
|
81
93
|
// 参数:mediaType,mediaAddType
|
|
82
|
-
mediaPickAction: Function
|
|
94
|
+
mediaPickAction: Function,
|
|
95
|
+
// 文件读取完成后的回调函数,获取到对应的 media 对象
|
|
96
|
+
afterRead: Function,
|
|
97
|
+
// 文件读取前的回调函数,返回 false 可终止文件读取,支持返回 Promise
|
|
98
|
+
beforeRead: Function,
|
|
99
|
+
// 文件删除前的回调函数,返回 false 可终止文件读取,支持返回 Promise
|
|
100
|
+
beforeDelete: Function
|
|
83
101
|
},
|
|
84
102
|
model: {
|
|
85
103
|
prop: 'mediaList'
|
|
@@ -136,6 +154,10 @@ export default createComponent({
|
|
|
136
154
|
return;
|
|
137
155
|
}
|
|
138
156
|
|
|
157
|
+
if (!this.checkFileCountBeforeAdd(mediaType)) {
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
|
|
139
161
|
if (this.mediaPickAction && this.mediaPickAction(mediaType, mediaAddType)) {
|
|
140
162
|
return;
|
|
141
163
|
}
|
|
@@ -235,18 +257,46 @@ export default createComponent({
|
|
|
235
257
|
|
|
236
258
|
if (files.length === 0) {
|
|
237
259
|
return;
|
|
238
|
-
}
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
if (!this.checkFileCountAfterAdd(files)) {
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
if (this.beforeRead) {
|
|
267
|
+
var response = this.beforeRead(files);
|
|
268
|
+
|
|
269
|
+
if (!response) {
|
|
270
|
+
return;
|
|
271
|
+
}
|
|
239
272
|
|
|
273
|
+
if (isPromise(response)) {
|
|
274
|
+
response.then(function (data) {
|
|
275
|
+
if (data) {
|
|
276
|
+
_this2.readFiles(data);
|
|
277
|
+
} else {
|
|
278
|
+
_this2.readFiles(files);
|
|
279
|
+
}
|
|
280
|
+
});
|
|
281
|
+
return;
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
this.readFiles(files);
|
|
286
|
+
},
|
|
287
|
+
readFiles: function readFiles(files) {
|
|
288
|
+
var _this3 = this;
|
|
240
289
|
|
|
290
|
+
// 处理非图片
|
|
241
291
|
var notImages = files.filter(function (f) {
|
|
242
292
|
return !isImageType(f);
|
|
243
293
|
}).map(function (f) {
|
|
244
|
-
return
|
|
294
|
+
return _this3.transformNotImageFile(f);
|
|
245
295
|
});
|
|
246
|
-
var
|
|
296
|
+
var newMedias = [];
|
|
247
297
|
|
|
248
298
|
if (notImages.length > 0) {
|
|
249
|
-
|
|
299
|
+
newMedias = newMedias.concat(notImages);
|
|
250
300
|
} // 处理图片并合并
|
|
251
301
|
|
|
252
302
|
|
|
@@ -263,12 +313,88 @@ export default createComponent({
|
|
|
263
313
|
|
|
264
314
|
promise.then(function (medias) {
|
|
265
315
|
if (medias && medias.length > 0) {
|
|
266
|
-
|
|
316
|
+
newMedias = newMedias.concat(medias);
|
|
267
317
|
}
|
|
268
318
|
}).finally(function () {
|
|
269
|
-
|
|
319
|
+
_this3.$emit('input', [].concat(_this3.mediaList, newMedias));
|
|
320
|
+
|
|
321
|
+
if (_this3.afterRead) {
|
|
322
|
+
_this3.afterRead(newMedias);
|
|
323
|
+
}
|
|
270
324
|
});
|
|
271
325
|
},
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
* 选择多媒体前进行数量检查
|
|
329
|
+
*/
|
|
330
|
+
checkFileCountBeforeAdd: function checkFileCountBeforeAdd(mediaType) {
|
|
331
|
+
if (this.mediaList.length === this.mediaLimitConfig.maxMediaCount) {
|
|
332
|
+
Toast.fail("\u5DF2\u8FBE\u5230\u6587\u4EF6\u6700\u5927\u6570\u91CF\u9650\u5236");
|
|
333
|
+
return false;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
if (mediaType === MediaType.PHOTO && this.mediaList.filter(function (media) {
|
|
337
|
+
return media.type === MediaType.PHOTO;
|
|
338
|
+
}).length > this.mediaLimitConfig.maxImageCount) {
|
|
339
|
+
Toast.fail("\u5DF2\u8FBE\u5230\u56FE\u7247\u6700\u5927\u6570\u91CF\u9650\u5236");
|
|
340
|
+
return false;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
if (mediaType === MediaType.VIDEO && this.mediaList.filter(function (media) {
|
|
344
|
+
return media.type === MediaType.VIDEO;
|
|
345
|
+
}).length > this.mediaLimitConfig.maxVideoCount) {
|
|
346
|
+
Toast.fail("\u5DF2\u8FBE\u5230\u89C6\u9891\u6700\u5927\u6570\u91CF\u9650\u5236");
|
|
347
|
+
return false;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
if (mediaType === MediaType.AUDIO && this.mediaList.filter(function (media) {
|
|
351
|
+
return media.type === MediaType.AUDIO;
|
|
352
|
+
}).length > this.mediaLimitConfig.maxAudioCount) {
|
|
353
|
+
Toast.fail("\u5DF2\u8FBE\u5230\u5F55\u97F3\u6700\u5927\u6570\u91CF\u9650\u5236");
|
|
354
|
+
return false;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
return true;
|
|
358
|
+
},
|
|
359
|
+
|
|
360
|
+
/**
|
|
361
|
+
* 选择多媒体后进行数量检查
|
|
362
|
+
*/
|
|
363
|
+
checkFileCountAfterAdd: function checkFileCountAfterAdd(files) {
|
|
364
|
+
if (this.mediaList.length + files.length > this.mediaLimitConfig.maxMediaCount) {
|
|
365
|
+
Toast.fail("\u6700\u591A\u53EA\u80FD\u4E0A\u4F20" + this.mediaLimitConfig.maxMediaCount + "\u4E2A\u6587\u4EF6");
|
|
366
|
+
return false;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
if (this.mediaList.filter(function (media) {
|
|
370
|
+
return media.type === MediaType.PHOTO;
|
|
371
|
+
}).length + files.filter(function (media) {
|
|
372
|
+
return isImageType(media);
|
|
373
|
+
}).length > this.mediaLimitConfig.maxImageCount) {
|
|
374
|
+
Toast.fail("\u6700\u591A\u53EA\u80FD\u4E0A\u4F20" + this.mediaLimitConfig.maxImageCount + "\u5F20\u56FE\u7247");
|
|
375
|
+
return false;
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
if (this.mediaList.filter(function (media) {
|
|
379
|
+
return media.type === MediaType.VIDEO;
|
|
380
|
+
}).length + files.filter(function (media) {
|
|
381
|
+
return isVideoType(media);
|
|
382
|
+
}).length > this.mediaLimitConfig.maxVideoCount) {
|
|
383
|
+
Toast.fail("\u6700\u591A\u53EA\u80FD\u4E0A\u4F20" + this.mediaLimitConfig.maxVideoCount + "\u4E2A\u89C6\u9891");
|
|
384
|
+
return false;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
if (this.mediaList.filter(function (media) {
|
|
388
|
+
return media.type === MediaType.AUDIO;
|
|
389
|
+
}).length + files.filter(function (media) {
|
|
390
|
+
return isAudioType(media);
|
|
391
|
+
}).length > this.mediaLimitConfig.maxAudioCount) {
|
|
392
|
+
Toast.fail("\u6700\u591A\u53EA\u80FD\u4E0A\u4F20" + this.mediaLimitConfig.maxAudioCount + "\u4E2A\u5F55\u97F3");
|
|
393
|
+
return false;
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
return true;
|
|
397
|
+
},
|
|
272
398
|
filterValidFiles: function filterValidFiles(files) {
|
|
273
399
|
var validFiles = [];
|
|
274
400
|
|
|
@@ -297,7 +423,7 @@ export default createComponent({
|
|
|
297
423
|
* @return {Promise<[Media]>}
|
|
298
424
|
*/
|
|
299
425
|
transformImageFiles: function transformImageFiles(files) {
|
|
300
|
-
var
|
|
426
|
+
var _this4 = this;
|
|
301
427
|
|
|
302
428
|
var promisesTodo = [];
|
|
303
429
|
var resizeOptions = new ResizeOptions(this.maxImageSideLength);
|
|
@@ -305,14 +431,27 @@ export default createComponent({
|
|
|
305
431
|
|
|
306
432
|
var _loop = function _loop(i) {
|
|
307
433
|
var file = files[i];
|
|
308
|
-
var
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
434
|
+
var watermarkEnabled = _this4.watermarkOptions && _this4.watermarkOptions.watermarkConfigString && checkWatermarkConfigSupported(_this4.watermarkOptions.watermarkConfigString);
|
|
435
|
+
var watermarkOpt = void 0;
|
|
436
|
+
|
|
437
|
+
if (watermarkEnabled) {
|
|
438
|
+
watermarkOpt = new WatermarkOptions({
|
|
439
|
+
enabled: true,
|
|
440
|
+
watermarkConfigString: watermarkEnabled ? _this4.watermarkOptions.watermarkConfigString : '',
|
|
441
|
+
context: {
|
|
442
|
+
address: _this4.watermarkOptions.address || "",
|
|
443
|
+
humanName: _this4.watermarkOptions.humanName || "",
|
|
444
|
+
projectName: _this4.watermarkOptions.projectName || "",
|
|
445
|
+
watermarkTime: new Date()
|
|
446
|
+
}
|
|
447
|
+
});
|
|
448
|
+
} else {
|
|
449
|
+
watermarkOpt = new WatermarkOptions({
|
|
450
|
+
enabled: false
|
|
451
|
+
});
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
var promise = new ImageProcessor(file, resizeOptions, watermarkOpt, compressOptions).process().then(function (f) {
|
|
316
455
|
if (!f) {
|
|
317
456
|
return Promise.resolve();
|
|
318
457
|
}
|
|
@@ -329,7 +468,8 @@ export default createComponent({
|
|
|
329
468
|
//需要以原始file的信息作为唯一标识
|
|
330
469
|
uniqueCode: getFileUniqueCode(file),
|
|
331
470
|
lastModified: f.lastModified,
|
|
332
|
-
fileSize: f.size
|
|
471
|
+
fileSize: f.size,
|
|
472
|
+
deletable: true
|
|
333
473
|
});
|
|
334
474
|
});
|
|
335
475
|
});
|
|
@@ -382,7 +522,8 @@ export default createComponent({
|
|
|
382
522
|
}),
|
|
383
523
|
uniqueCode: getFileUniqueCode(f),
|
|
384
524
|
lastModified: f.lastModified,
|
|
385
|
-
fileSize: f.size
|
|
525
|
+
fileSize: f.size,
|
|
526
|
+
deletable: true
|
|
386
527
|
};
|
|
387
528
|
},
|
|
388
529
|
|
|
@@ -421,6 +562,26 @@ export default createComponent({
|
|
|
421
562
|
} else if (media.type === MediaType.FILE) {//ignore
|
|
422
563
|
}
|
|
423
564
|
},
|
|
565
|
+
onDelete: function onDelete(media, index) {
|
|
566
|
+
var _this5 = this;
|
|
567
|
+
|
|
568
|
+
if (this.beforeDelete) {
|
|
569
|
+
var response = this.beforeDelete(media);
|
|
570
|
+
|
|
571
|
+
if (!response) {
|
|
572
|
+
return;
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
if (isPromise(response)) {
|
|
576
|
+
response.then(function () {
|
|
577
|
+
_this5.deleteMedia(media, index);
|
|
578
|
+
});
|
|
579
|
+
return;
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
this.deleteMedia(media, index);
|
|
584
|
+
},
|
|
424
585
|
deleteMedia: function deleteMedia(media, index) {
|
|
425
586
|
var list = this.mediaList.slice(0);
|
|
426
587
|
list.splice(index, 1);
|
|
@@ -428,7 +589,7 @@ export default createComponent({
|
|
|
428
589
|
this.$emit('delete', media, index);
|
|
429
590
|
},
|
|
430
591
|
hiddenInput: function hiddenInput() {
|
|
431
|
-
var
|
|
592
|
+
var _this6 = this;
|
|
432
593
|
|
|
433
594
|
var h = this.$createElement;
|
|
434
595
|
return [h("input", {
|
|
@@ -442,7 +603,7 @@ export default createComponent({
|
|
|
442
603
|
"on": {
|
|
443
604
|
"change": this.handleInputFiles,
|
|
444
605
|
"click": function click() {
|
|
445
|
-
return
|
|
606
|
+
return _this6.resetInput(MediaType.PHOTO, MediaAddType.TAKE);
|
|
446
607
|
}
|
|
447
608
|
},
|
|
448
609
|
"class": bem('hidden')
|
|
@@ -456,7 +617,7 @@ export default createComponent({
|
|
|
456
617
|
"on": {
|
|
457
618
|
"change": this.handleInputFiles,
|
|
458
619
|
"click": function click() {
|
|
459
|
-
return
|
|
620
|
+
return _this6.resetInput(MediaType.PHOTO, MediaAddType.PICK);
|
|
460
621
|
}
|
|
461
622
|
},
|
|
462
623
|
"class": bem('hidden')
|
|
@@ -470,7 +631,7 @@ export default createComponent({
|
|
|
470
631
|
"on": {
|
|
471
632
|
"change": this.handleInputFiles,
|
|
472
633
|
"click": function click() {
|
|
473
|
-
return
|
|
634
|
+
return _this6.resetInput(MediaType.VIDEO, MediaAddType.TAKE);
|
|
474
635
|
}
|
|
475
636
|
},
|
|
476
637
|
"class": bem('hidden')
|
|
@@ -483,7 +644,7 @@ export default createComponent({
|
|
|
483
644
|
"on": {
|
|
484
645
|
"change": this.handleInputFiles,
|
|
485
646
|
"click": function click() {
|
|
486
|
-
return
|
|
647
|
+
return _this6.resetInput(MediaType.VIDEO, MediaAddType.PICK);
|
|
487
648
|
}
|
|
488
649
|
},
|
|
489
650
|
"class": bem('hidden')
|
|
@@ -497,7 +658,7 @@ export default createComponent({
|
|
|
497
658
|
"on": {
|
|
498
659
|
"change": this.handleInputFiles,
|
|
499
660
|
"click": function click() {
|
|
500
|
-
return
|
|
661
|
+
return _this6.resetInput(MediaType.AUDIO, MediaAddType.TAKE);
|
|
501
662
|
}
|
|
502
663
|
},
|
|
503
664
|
"class": bem('hidden')
|
|
@@ -510,7 +671,7 @@ export default createComponent({
|
|
|
510
671
|
"on": {
|
|
511
672
|
"change": this.handleInputFiles,
|
|
512
673
|
"click": function click() {
|
|
513
|
-
return
|
|
674
|
+
return _this6.resetInput(MediaType.AUDIO, MediaAddType.PICK);
|
|
514
675
|
}
|
|
515
676
|
},
|
|
516
677
|
"class": bem('hidden')
|
|
@@ -522,14 +683,14 @@ export default createComponent({
|
|
|
522
683
|
"on": {
|
|
523
684
|
"change": this.handleInputFiles,
|
|
524
685
|
"click": function click() {
|
|
525
|
-
return
|
|
686
|
+
return _this6.resetInput(MediaType.FILE, MediaAddType.PICK);
|
|
526
687
|
}
|
|
527
688
|
},
|
|
528
689
|
"class": bem('hidden')
|
|
529
690
|
})];
|
|
530
691
|
},
|
|
531
692
|
renderIcon: function renderIcon(mediaType, mediaAddType) {
|
|
532
|
-
var
|
|
693
|
+
var _this7 = this;
|
|
533
694
|
|
|
534
695
|
var h = this.$createElement;
|
|
535
696
|
|
|
@@ -539,7 +700,7 @@ export default createComponent({
|
|
|
539
700
|
"class": bem('button'),
|
|
540
701
|
"on": {
|
|
541
702
|
"click": function click() {
|
|
542
|
-
return
|
|
703
|
+
return _this7.mediaPick(mediaType, mediaAddType);
|
|
543
704
|
}
|
|
544
705
|
}
|
|
545
706
|
});
|
|
@@ -548,7 +709,7 @@ export default createComponent({
|
|
|
548
709
|
"class": bem('button'),
|
|
549
710
|
"on": {
|
|
550
711
|
"click": function click() {
|
|
551
|
-
return
|
|
712
|
+
return _this7.mediaPick(mediaType, mediaAddType);
|
|
552
713
|
}
|
|
553
714
|
}
|
|
554
715
|
});
|
|
@@ -558,7 +719,7 @@ export default createComponent({
|
|
|
558
719
|
"class": bem('button'),
|
|
559
720
|
"on": {
|
|
560
721
|
"click": function click() {
|
|
561
|
-
return
|
|
722
|
+
return _this7.mediaPick(mediaType, mediaAddType);
|
|
562
723
|
}
|
|
563
724
|
}
|
|
564
725
|
});
|
|
@@ -567,7 +728,7 @@ export default createComponent({
|
|
|
567
728
|
"class": bem('button'),
|
|
568
729
|
"on": {
|
|
569
730
|
"click": function click() {
|
|
570
|
-
return
|
|
731
|
+
return _this7.mediaPick(mediaType, mediaAddType);
|
|
571
732
|
}
|
|
572
733
|
}
|
|
573
734
|
});
|
|
@@ -576,7 +737,7 @@ export default createComponent({
|
|
|
576
737
|
"class": bem('button'),
|
|
577
738
|
"on": {
|
|
578
739
|
"click": function click() {
|
|
579
|
-
return
|
|
740
|
+
return _this7.mediaPick(mediaType, mediaAddType);
|
|
580
741
|
}
|
|
581
742
|
}
|
|
582
743
|
});
|
|
@@ -648,6 +809,28 @@ export default createComponent({
|
|
|
648
809
|
|
|
649
810
|
return buttons;
|
|
650
811
|
},
|
|
812
|
+
genThumbnailMask: function genThumbnailMask(media) {
|
|
813
|
+
var h = this.$createElement;
|
|
814
|
+
var status = media.status,
|
|
815
|
+
message = media.message;
|
|
816
|
+
|
|
817
|
+
if (status === MediaUploadStatus.UPLOADING || status === MediaUploadStatus.FAILED) {
|
|
818
|
+
var MaskIcon = status === MediaUploadStatus.FAILED ? h(Icon, {
|
|
819
|
+
"attrs": {
|
|
820
|
+
"name": "close"
|
|
821
|
+
},
|
|
822
|
+
"class": bem('mask-icon')
|
|
823
|
+
}) : h(Loading, {
|
|
824
|
+
"class": bem('loading')
|
|
825
|
+
});
|
|
826
|
+
var showMessage = isDef(message) && message !== '';
|
|
827
|
+
return h("div", {
|
|
828
|
+
"class": bem('mask')
|
|
829
|
+
}, [MaskIcon, showMessage && h("div", {
|
|
830
|
+
"class": bem('mask-message')
|
|
831
|
+
}, [message])]);
|
|
832
|
+
}
|
|
833
|
+
},
|
|
651
834
|
|
|
652
835
|
/**
|
|
653
836
|
* 多媒体对应展示的缩略图
|
|
@@ -678,25 +861,29 @@ export default createComponent({
|
|
|
678
861
|
}
|
|
679
862
|
},
|
|
680
863
|
renderMediaList: function renderMediaList() {
|
|
681
|
-
var
|
|
864
|
+
var _this8 = this;
|
|
682
865
|
|
|
683
866
|
var h = this.$createElement;
|
|
684
867
|
return this.mediaList.map(function (media, index) {
|
|
685
|
-
|
|
686
|
-
|
|
868
|
+
var showDelete = media.deletable && media.status !== MediaUploadStatus.UPLOADING;
|
|
869
|
+
var deleteIcon = showDelete && h(DeleteIcon, {
|
|
870
|
+
"class": bem('delete'),
|
|
687
871
|
"on": {
|
|
688
|
-
"click": function click() {
|
|
689
|
-
|
|
872
|
+
"click": function click(event) {
|
|
873
|
+
event.stopPropagation();
|
|
874
|
+
|
|
875
|
+
_this8.onDelete(media, index);
|
|
690
876
|
}
|
|
691
877
|
}
|
|
692
|
-
}
|
|
693
|
-
|
|
878
|
+
});
|
|
879
|
+
return h("zt-grid-item", {
|
|
880
|
+
"key": media.uniqueCode,
|
|
694
881
|
"on": {
|
|
695
882
|
"click": function click() {
|
|
696
|
-
return
|
|
883
|
+
return _this8.previewMedia(media, index);
|
|
697
884
|
}
|
|
698
885
|
}
|
|
699
|
-
})]);
|
|
886
|
+
}, [_this8.renderMediaThumbnail(media), _this8.genThumbnailMask(media), deleteIcon]);
|
|
700
887
|
});
|
|
701
888
|
},
|
|
702
889
|
selectVideoAction: function selectVideoAction(videoAction) {
|
|
@@ -704,7 +891,7 @@ export default createComponent({
|
|
|
704
891
|
}
|
|
705
892
|
},
|
|
706
893
|
render: function render() {
|
|
707
|
-
var
|
|
894
|
+
var _this9 = this;
|
|
708
895
|
|
|
709
896
|
var h = arguments[0];
|
|
710
897
|
return h("div", {
|
|
@@ -717,9 +904,9 @@ export default createComponent({
|
|
|
717
904
|
"mediaUrl": this.mediaUrlToPlay
|
|
718
905
|
},
|
|
719
906
|
"model": {
|
|
720
|
-
value:
|
|
907
|
+
value: _this9.mediaPlayerVisible,
|
|
721
908
|
callback: function callback($$v) {
|
|
722
|
-
|
|
909
|
+
_this9.mediaPlayerVisible = $$v;
|
|
723
910
|
}
|
|
724
911
|
}
|
|
725
912
|
}), h("zt-action-sheet", {
|
|
@@ -733,9 +920,9 @@ export default createComponent({
|
|
|
733
920
|
"select": this.selectVideoAction
|
|
734
921
|
},
|
|
735
922
|
"model": {
|
|
736
|
-
value:
|
|
923
|
+
value: _this9.actionVisible,
|
|
737
924
|
callback: function callback($$v) {
|
|
738
|
-
|
|
925
|
+
_this9.actionVisible = $$v;
|
|
739
926
|
}
|
|
740
927
|
}
|
|
741
928
|
}), h("div", {
|
|
@@ -112,4 +112,37 @@
|
|
|
112
112
|
width: 100%;
|
|
113
113
|
height: 100%;
|
|
114
114
|
}
|
|
115
|
+
|
|
116
|
+
&__mask {
|
|
117
|
+
position: absolute;
|
|
118
|
+
top: 0;
|
|
119
|
+
right: 0;
|
|
120
|
+
bottom: 0;
|
|
121
|
+
left: 0;
|
|
122
|
+
display: flex;
|
|
123
|
+
flex-direction: column;
|
|
124
|
+
align-items: center;
|
|
125
|
+
justify-content: center;
|
|
126
|
+
color: @white;
|
|
127
|
+
background-color: @uploader-mask-background-color;
|
|
128
|
+
border-radius: 4px;
|
|
129
|
+
|
|
130
|
+
&-icon {
|
|
131
|
+
font-size: @uploader-mask-icon-size;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
&-message {
|
|
135
|
+
margin-top: 6px;
|
|
136
|
+
padding: 0 @padding-base;
|
|
137
|
+
font-size: @uploader-mask-message-font-size;
|
|
138
|
+
line-height: @uploader-mask-message-line-height;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
&__loading {
|
|
143
|
+
width: @uploader-loading-icon-size;
|
|
144
|
+
height: @uploader-loading-icon-size;
|
|
145
|
+
color: @uploader-loading-icon-color;
|
|
146
|
+
}
|
|
147
|
+
|
|
115
148
|
}
|
package/es/media-picker/type.js
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
export var MediaUploadStatus;
|
|
2
|
+
|
|
3
|
+
(function (MediaUploadStatus) {
|
|
4
|
+
MediaUploadStatus["UPLOADING"] = "uploading";
|
|
5
|
+
MediaUploadStatus["DONE"] = "done";
|
|
6
|
+
MediaUploadStatus["FAILED"] = "failed";
|
|
7
|
+
})(MediaUploadStatus || (MediaUploadStatus = {}));
|
|
8
|
+
|
|
1
9
|
export var MediaType;
|
|
2
10
|
|
|
3
11
|
(function (MediaType) {
|
package/es/utils/router.js
CHANGED
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
* Vue Router support
|
|
3
3
|
*/
|
|
4
4
|
function isRedundantNavigation(err) {
|
|
5
|
-
return err.name === 'NavigationDuplicated' ||
|
|
6
|
-
err.message && err.message.indexOf('redundant navigation') !== -1;
|
|
5
|
+
return err.name === 'NavigationDuplicated' || err.message && err.message.indexOf('redundant navigation') !== -1;
|
|
7
6
|
}
|
|
8
7
|
|
|
9
8
|
export function route(router, config) {
|
package/es/utils/vnodes.js
CHANGED
|
@@ -5,13 +5,13 @@ function flattenVNodes(vnodes) {
|
|
|
5
5
|
vnodes.forEach(function (vnode) {
|
|
6
6
|
result.push(vnode);
|
|
7
7
|
|
|
8
|
-
if (vnode.componentInstance) {
|
|
8
|
+
if (vnode && vnode.componentInstance) {
|
|
9
9
|
traverse(vnode.componentInstance.$children.map(function (item) {
|
|
10
10
|
return item.$vnode;
|
|
11
11
|
}));
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
if (vnode.children) {
|
|
14
|
+
if (vnode && vnode.children) {
|
|
15
15
|
traverse(vnode.children);
|
|
16
16
|
}
|
|
17
17
|
});
|
package/lib/calendar/utils.js
CHANGED
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
|
-
exports.bem = void 0;
|
|
5
|
-
exports.calcDateNum = calcDateNum;
|
|
6
|
-
exports.compareDay = compareDay;
|
|
7
|
-
exports.compareMonth = compareMonth;
|
|
8
|
-
exports.copyDate = copyDate;
|
|
9
|
-
exports.copyDates = copyDates;
|
|
10
|
-
exports.createComponent = void 0;
|
|
11
4
|
exports.formatMonthTitle = formatMonthTitle;
|
|
5
|
+
exports.compareMonth = compareMonth;
|
|
6
|
+
exports.compareDay = compareDay;
|
|
12
7
|
exports.getDayByOffset = getDayByOffset;
|
|
13
|
-
exports.getNextDay = getNextDay;
|
|
14
8
|
exports.getPrevDay = getPrevDay;
|
|
15
|
-
exports.
|
|
9
|
+
exports.getNextDay = getNextDay;
|
|
10
|
+
exports.calcDateNum = calcDateNum;
|
|
11
|
+
exports.copyDate = copyDate;
|
|
12
|
+
exports.copyDates = copyDates;
|
|
13
|
+
exports.t = exports.bem = exports.createComponent = void 0;
|
|
16
14
|
|
|
17
15
|
var _utils = require("../utils");
|
|
18
16
|
|