zartui 3.1.41 → 3.1.43
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/README.md +27 -27
- package/es/index.d.ts +1 -1
- package/es/index.mjs +1 -1
- package/es/lazyload/vue-lazyload/index.d.ts +55 -55
- package/es/media-picker/MediaPicker.d.ts +2 -1
- package/es/media-picker/MediaPicker.mjs +41 -14
- package/es/media-picker/index.d.ts +2 -1
- package/es/media-picker/type.d.ts +1 -1
- package/es/vue-sfc-shim.d.ts +6 -6
- package/es/vue-tsx-shim.d.ts +23 -23
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/lazyload/vue-lazyload/index.d.ts +55 -55
- package/lib/media-picker/MediaPicker.d.ts +2 -1
- package/lib/media-picker/MediaPicker.js +41 -14
- package/lib/media-picker/index.d.ts +2 -1
- package/lib/media-picker/type.d.ts +1 -1
- package/lib/vue-sfc-shim.d.ts +6 -6
- package/lib/vue-tsx-shim.d.ts +23 -23
- package/lib/web-types.json +1 -1
- package/lib/zartui.cjs.js +42 -15
- package/lib/zartui.es.js +42 -15
- package/lib/zartui.js +42 -15
- package/lib/zartui.min.js +1 -1
- package/package.json +5 -5
|
@@ -134,7 +134,7 @@ const mediaPickerProps = {
|
|
|
134
134
|
var stdin_default = (0, import_vue2.defineComponent)({
|
|
135
135
|
name,
|
|
136
136
|
props: mediaPickerProps,
|
|
137
|
-
emits: ["update:mediaList", "delete"],
|
|
137
|
+
emits: ["update:mediaList", "delete", "processing"],
|
|
138
138
|
setup(props, {
|
|
139
139
|
emit,
|
|
140
140
|
slots
|
|
@@ -152,6 +152,7 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
|
152
152
|
const audioRecorderInputRef = (0, import_vue2.ref)();
|
|
153
153
|
const audioFileInputRef = (0, import_vue2.ref)();
|
|
154
154
|
const fileInputRef = (0, import_vue2.ref)();
|
|
155
|
+
const mediaListPlaceholder = (0, import_vue2.ref)([]);
|
|
155
156
|
const checkFileCountBeforeAdd = (mediaType) => {
|
|
156
157
|
if (props.mediaList.length === props.maxMediaCount) {
|
|
157
158
|
(0, import_toast.showFailToast)("\u5DF2\u8FBE\u5230\u6587\u4EF6\u6700\u5927\u6570\u91CF\u9650\u5236");
|
|
@@ -361,11 +362,6 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
|
361
362
|
return media;
|
|
362
363
|
});
|
|
363
364
|
});
|
|
364
|
-
(0, import_toast.showLoadingToast)({
|
|
365
|
-
message: "\u5904\u7406\u4E2D...",
|
|
366
|
-
forbidClick: true,
|
|
367
|
-
duration: 0
|
|
368
|
-
});
|
|
369
365
|
return Promise.all(mediaList).then((medias) => {
|
|
370
366
|
const _medias = [];
|
|
371
367
|
medias.forEach((media) => {
|
|
@@ -375,7 +371,6 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
|
375
371
|
});
|
|
376
372
|
return _medias;
|
|
377
373
|
}).finally(() => {
|
|
378
|
-
(0, import_toast.closeToast)();
|
|
379
374
|
});
|
|
380
375
|
};
|
|
381
376
|
const transformImageFiles = (files) => {
|
|
@@ -434,11 +429,6 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
|
434
429
|
});
|
|
435
430
|
promisesTodo.push(promise);
|
|
436
431
|
}
|
|
437
|
-
(0, import_toast.showLoadingToast)({
|
|
438
|
-
message: "\u5904\u7406\u4E2D...",
|
|
439
|
-
forbidClick: true,
|
|
440
|
-
duration: 0
|
|
441
|
-
});
|
|
442
432
|
return Promise.all(promisesTodo).then((medias) => {
|
|
443
433
|
const _medias = [];
|
|
444
434
|
medias.forEach((media) => {
|
|
@@ -448,10 +438,28 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
|
448
438
|
});
|
|
449
439
|
return _medias;
|
|
450
440
|
}).finally(() => {
|
|
451
|
-
(0, import_toast.closeToast)();
|
|
452
441
|
});
|
|
453
442
|
};
|
|
454
443
|
const readFiles = (files) => {
|
|
444
|
+
emit("processing", true);
|
|
445
|
+
mediaListPlaceholder.value = files.map((file) => {
|
|
446
|
+
let type;
|
|
447
|
+
if ((0, import_media_util.isAudioType)(file)) {
|
|
448
|
+
type = "audio";
|
|
449
|
+
} else if ((0, import_media_util.isVideoType)(file)) {
|
|
450
|
+
type = "video";
|
|
451
|
+
} else if ((0, import_media_util.isImageType)(file)) {
|
|
452
|
+
type = "photo";
|
|
453
|
+
} else {
|
|
454
|
+
type = "file";
|
|
455
|
+
}
|
|
456
|
+
return {
|
|
457
|
+
file,
|
|
458
|
+
message: "\u5904\u7406\u4E2D...",
|
|
459
|
+
status: "processing",
|
|
460
|
+
type
|
|
461
|
+
};
|
|
462
|
+
});
|
|
455
463
|
const notImages = files.filter((f) => !(0, import_media_util.isImageType)(f)).map((f) => transformNotImageFile(f));
|
|
456
464
|
let newMedias = [];
|
|
457
465
|
if (notImages.length > 0) {
|
|
@@ -474,6 +482,8 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
|
474
482
|
newMedia.label = newMedia.originalName;
|
|
475
483
|
});
|
|
476
484
|
}
|
|
485
|
+
mediaListPlaceholder.value = [];
|
|
486
|
+
emit("processing", false);
|
|
477
487
|
emit("update:mediaList", [...props.mediaList, ...newMedias]);
|
|
478
488
|
if (props.afterRead) {
|
|
479
489
|
props.afterRead(newMedias);
|
|
@@ -650,7 +660,7 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
|
650
660
|
status,
|
|
651
661
|
message
|
|
652
662
|
} = media;
|
|
653
|
-
if (status === "uploading" || status === "failed") {
|
|
663
|
+
if (status === "processing" || status === "uploading" || status === "failed") {
|
|
654
664
|
const MaskIcon = status === "failed" ? (0, import_vue.createVNode)(import_icon.default, {
|
|
655
665
|
"name": "close",
|
|
656
666
|
"class": bem("mask-icon")
|
|
@@ -785,6 +795,15 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
|
785
795
|
(0, import_toast.showFailToast)("\u6682\u4E0D\u652F\u6301\u6B64\u7C7B\u6587\u4EF6\u7684\u9884\u89C8");
|
|
786
796
|
}
|
|
787
797
|
});
|
|
798
|
+
const renderMediaListPlaceholder = () => {
|
|
799
|
+
return mediaListPlaceholder.value.map((media) => {
|
|
800
|
+
return (0, import_vue.createVNode)(import_grid_item.default, {
|
|
801
|
+
"key": media.uniqueCode
|
|
802
|
+
}, {
|
|
803
|
+
default: () => [renderMediaThumbnail(media), renderMediaLabel(media), genThumbnailMask(media)]
|
|
804
|
+
});
|
|
805
|
+
});
|
|
806
|
+
};
|
|
788
807
|
const renderMediaList = () => props.mediaList.map((media, index) => {
|
|
789
808
|
const showDelete = media.deletable && media.status !== "uploading";
|
|
790
809
|
const deleteIcon = showDelete && (0, import_vue.createVNode)(import_DeleteIcon.default, {
|
|
@@ -836,6 +855,14 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
|
836
855
|
"square": true,
|
|
837
856
|
"gutter": "4",
|
|
838
857
|
"class": bem("grid")
|
|
858
|
+
}, {
|
|
859
|
+
default: () => [renderMediaListPlaceholder()]
|
|
860
|
+
}), [[import_vue.vShow, mediaListPlaceholder.value.length]]), (0, import_vue.withDirectives)((0, import_vue.createVNode)(import_grid.default, {
|
|
861
|
+
"column-num": "3",
|
|
862
|
+
"border": false,
|
|
863
|
+
"square": true,
|
|
864
|
+
"gutter": "4",
|
|
865
|
+
"class": bem("grid")
|
|
839
866
|
}, {
|
|
840
867
|
default: () => [renderMediaList()]
|
|
841
868
|
}), [[import_vue.vShow, props.mediaList.length]])]);
|
|
@@ -66,7 +66,7 @@ export declare const MediaPicker: import("../utils").WithInstall<import("vue").D
|
|
|
66
66
|
default: import("./type").MediaSizeType;
|
|
67
67
|
};
|
|
68
68
|
mediaPlayerProps: import("vue").PropType<Partial<import("..").MediaPlayerProps>>;
|
|
69
|
-
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("delete" | "update:mediaList")[], "delete" | "update:mediaList", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
69
|
+
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("delete" | "processing" | "update:mediaList")[], "delete" | "processing" | "update:mediaList", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
70
70
|
disabled: BooleanConstructor;
|
|
71
71
|
showTitle: BooleanConstructor;
|
|
72
72
|
useFileNameAsLabel: BooleanConstructor;
|
|
@@ -136,6 +136,7 @@ export declare const MediaPicker: import("../utils").WithInstall<import("vue").D
|
|
|
136
136
|
mediaPlayerProps: import("vue").PropType<Partial<import("..").MediaPlayerProps>>;
|
|
137
137
|
}>> & Readonly<{
|
|
138
138
|
onDelete?: ((...args: any[]) => any) | undefined;
|
|
139
|
+
onProcessing?: ((...args: any[]) => any) | undefined;
|
|
139
140
|
"onUpdate:mediaList"?: ((...args: any[]) => any) | undefined;
|
|
140
141
|
}>, {
|
|
141
142
|
title: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export type MediaType = 'photo' | 'audio' | 'video' | 'file';
|
|
2
2
|
export type MediaAddType = 'take' | 'pick' | 'take_and_pick';
|
|
3
|
-
export type MediaUploadStatus = 'uploading' | 'done' | 'failed';
|
|
3
|
+
export type MediaUploadStatus = 'processing' | 'uploading' | 'done' | 'failed';
|
|
4
4
|
export type WxMediaType = 'camera' | 'album';
|
|
5
5
|
export type MediaSizeType = 'original' | 'compressed';
|
|
6
6
|
export type Media = {
|
package/lib/vue-sfc-shim.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
declare module '*.vue' {
|
|
2
|
-
// eslint-disable-next-line
|
|
3
|
-
import { DefineComponent } from 'vue';
|
|
4
|
-
const Component: DefineComponent;
|
|
5
|
-
export default Component;
|
|
6
|
-
}
|
|
1
|
+
declare module '*.vue' {
|
|
2
|
+
// eslint-disable-next-line
|
|
3
|
+
import { DefineComponent } from 'vue';
|
|
4
|
+
const Component: DefineComponent;
|
|
5
|
+
export default Component;
|
|
6
|
+
}
|
package/lib/vue-tsx-shim.d.ts
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import 'vue';
|
|
2
|
-
|
|
3
|
-
type EventHandler = (...args: any[]) => void;
|
|
4
|
-
|
|
5
|
-
declare module 'vue' {
|
|
6
|
-
interface ComponentCustomProps {
|
|
7
|
-
id?: string;
|
|
8
|
-
role?: string;
|
|
9
|
-
tabindex?: number;
|
|
10
|
-
onClick?: EventHandler;
|
|
11
|
-
onTouchend?: EventHandler;
|
|
12
|
-
onTouchmove?: EventHandler;
|
|
13
|
-
onTouchstart?: EventHandler;
|
|
14
|
-
onTouchcancel?: EventHandler;
|
|
15
|
-
onTouchmovePassive?: EventHandler;
|
|
16
|
-
onTouchstartPassive?: EventHandler;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
interface HTMLAttributes {
|
|
20
|
-
onTouchmovePassive?: EventHandler;
|
|
21
|
-
onTouchstartPassive?: EventHandler;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
1
|
+
import 'vue';
|
|
2
|
+
|
|
3
|
+
type EventHandler = (...args: any[]) => void;
|
|
4
|
+
|
|
5
|
+
declare module 'vue' {
|
|
6
|
+
interface ComponentCustomProps {
|
|
7
|
+
id?: string;
|
|
8
|
+
role?: string;
|
|
9
|
+
tabindex?: number;
|
|
10
|
+
onClick?: EventHandler;
|
|
11
|
+
onTouchend?: EventHandler;
|
|
12
|
+
onTouchmove?: EventHandler;
|
|
13
|
+
onTouchstart?: EventHandler;
|
|
14
|
+
onTouchcancel?: EventHandler;
|
|
15
|
+
onTouchmovePassive?: EventHandler;
|
|
16
|
+
onTouchstartPassive?: EventHandler;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
interface HTMLAttributes {
|
|
20
|
+
onTouchmovePassive?: EventHandler;
|
|
21
|
+
onTouchstartPassive?: EventHandler;
|
|
22
|
+
}
|
|
23
|
+
}
|