zartui 3.1.93 → 3.1.94
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/composables/use-media-download.d.ts +20 -0
- package/es/composables/use-media-download.mjs +111 -0
- package/es/image-preview/ImagePreview.d.ts +2 -5
- package/es/image-preview/ImagePreview.mjs +32 -79
- package/es/image-preview/function-call.mjs +4 -1
- package/es/image-preview/index.css +1 -1
- package/es/image-preview/index.d.ts +1 -2
- package/es/image-preview/style/index.mjs +2 -0
- package/es/image-preview/types.d.ts +3 -1
- package/es/index.d.ts +1 -1
- package/es/index.mjs +1 -1
- package/es/media-picker/MediaPicker.d.ts +1 -1
- package/es/media-picker/MediaPicker.mjs +54 -36
- package/es/media-picker/index.d.ts +2 -2
- package/es/media-picker/style/index.mjs +3 -1
- package/es/media-player/MediaPlayer.d.ts +21 -0
- package/es/media-player/MediaPlayer.mjs +25 -2
- package/es/media-player/index.css +1 -1
- package/es/media-player/index.d.ts +14 -0
- package/es/media-player/style/index.mjs +4 -0
- package/es/photo-picker/index.d.ts +2 -2
- package/es/photo-picker/style/index.mjs +2 -0
- package/es/uploader/style/index.mjs +2 -0
- package/lib/composables/use-media-download.d.ts +20 -0
- package/lib/composables/use-media-download.js +138 -0
- package/lib/image-preview/ImagePreview.d.ts +2 -5
- package/lib/image-preview/ImagePreview.js +32 -79
- package/lib/image-preview/function-call.js +4 -1
- package/lib/image-preview/index.css +1 -1
- package/lib/image-preview/index.d.ts +1 -2
- package/lib/image-preview/style/index.js +2 -0
- package/lib/image-preview/types.d.ts +3 -1
- package/lib/index.css +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/media-picker/MediaPicker.d.ts +1 -1
- package/lib/media-picker/MediaPicker.js +51 -35
- package/lib/media-picker/index.d.ts +2 -2
- package/lib/media-picker/style/index.js +3 -1
- package/lib/media-player/MediaPlayer.d.ts +21 -0
- package/lib/media-player/MediaPlayer.js +25 -2
- package/lib/media-player/index.css +1 -1
- package/lib/media-player/index.d.ts +14 -0
- package/lib/media-player/style/index.js +4 -0
- package/lib/photo-picker/index.d.ts +2 -2
- package/lib/photo-picker/style/index.js +2 -0
- package/lib/uploader/style/index.js +2 -0
- package/lib/web-types.json +1 -1
- package/lib/zartui.cjs.js +196 -105
- package/lib/zartui.es.js +196 -105
- package/lib/zartui.js +204 -113
- package/lib/zartui.min.js +2 -2
- package/package.json +2 -2
package/lib/zartui.js
CHANGED
|
@@ -12684,15 +12684,25 @@ var __publicField = (obj, key, value) => {
|
|
|
12684
12684
|
};
|
|
12685
12685
|
}
|
|
12686
12686
|
});
|
|
12687
|
-
|
|
12688
|
-
|
|
12689
|
-
|
|
12690
|
-
|
|
12691
|
-
|
|
12692
|
-
|
|
12693
|
-
|
|
12694
|
-
|
|
12695
|
-
|
|
12687
|
+
var __defProp$2 = Object.defineProperty;
|
|
12688
|
+
var __defProps$1 = Object.defineProperties;
|
|
12689
|
+
var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors;
|
|
12690
|
+
var __getOwnPropSymbols$1 = Object.getOwnPropertySymbols;
|
|
12691
|
+
var __hasOwnProp$2 = Object.prototype.hasOwnProperty;
|
|
12692
|
+
var __propIsEnum$1 = Object.prototype.propertyIsEnumerable;
|
|
12693
|
+
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
12694
|
+
var __spreadValues$1 = (a2, b) => {
|
|
12695
|
+
for (var prop in b || (b = {}))
|
|
12696
|
+
if (__hasOwnProp$2.call(b, prop))
|
|
12697
|
+
__defNormalProp$1(a2, prop, b[prop]);
|
|
12698
|
+
if (__getOwnPropSymbols$1)
|
|
12699
|
+
for (var prop of __getOwnPropSymbols$1(b)) {
|
|
12700
|
+
if (__propIsEnum$1.call(b, prop))
|
|
12701
|
+
__defNormalProp$1(a2, prop, b[prop]);
|
|
12702
|
+
}
|
|
12703
|
+
return a2;
|
|
12704
|
+
};
|
|
12705
|
+
var __spreadProps$1 = (a2, b) => __defProps$1(a2, __getOwnPropDescs$1(b));
|
|
12696
12706
|
var __async$5 = (__this, __arguments, generator) => {
|
|
12697
12707
|
return new Promise((resolve, reject) => {
|
|
12698
12708
|
var fulfilled = (value) => {
|
|
@@ -12713,6 +12723,72 @@ var __publicField = (obj, key, value) => {
|
|
|
12713
12723
|
step((generator = generator.apply(__this, __arguments)).next());
|
|
12714
12724
|
});
|
|
12715
12725
|
};
|
|
12726
|
+
function useMediaDownload(props) {
|
|
12727
|
+
const downloading = vue.ref(false);
|
|
12728
|
+
const downloadInBrowser = (params) => {
|
|
12729
|
+
const link = document.createElement("a");
|
|
12730
|
+
link.href = params.url;
|
|
12731
|
+
link.download = params.fileName || "";
|
|
12732
|
+
document.body.appendChild(link);
|
|
12733
|
+
link.click();
|
|
12734
|
+
link.remove();
|
|
12735
|
+
};
|
|
12736
|
+
const download2 = (params, confirm = false) => __async$5(this, null, function* () {
|
|
12737
|
+
var _a, _b, _c;
|
|
12738
|
+
if (!props.showDownload || downloading.value || !params.url || params.url.startsWith("data:")) {
|
|
12739
|
+
return;
|
|
12740
|
+
}
|
|
12741
|
+
downloading.value = true;
|
|
12742
|
+
try {
|
|
12743
|
+
if (confirm) {
|
|
12744
|
+
try {
|
|
12745
|
+
yield showConfirmDialog({ message: "附件格式暂不支持预览,是否下载原文件" });
|
|
12746
|
+
} catch (action) {
|
|
12747
|
+
if (action !== "cancel") {
|
|
12748
|
+
throw action;
|
|
12749
|
+
}
|
|
12750
|
+
return;
|
|
12751
|
+
}
|
|
12752
|
+
}
|
|
12753
|
+
if (!props.showDownload || ((_a = props.downloadAction) == null ? void 0 : _a.call(props, params))) {
|
|
12754
|
+
return;
|
|
12755
|
+
}
|
|
12756
|
+
let file;
|
|
12757
|
+
try {
|
|
12758
|
+
const sdk = yield Promise.resolve().then(() => index);
|
|
12759
|
+
file = (_b = sdk.getJSI()) == null ? void 0 : _b.file;
|
|
12760
|
+
} catch (e) {
|
|
12761
|
+
downloadInBrowser(params);
|
|
12762
|
+
return;
|
|
12763
|
+
}
|
|
12764
|
+
if (!(file == null ? void 0 : file.download)) {
|
|
12765
|
+
downloadInBrowser(params);
|
|
12766
|
+
return;
|
|
12767
|
+
}
|
|
12768
|
+
showLoadingToast({ message: "下载中...", forbidClick: true, duration: 0 });
|
|
12769
|
+
try {
|
|
12770
|
+
const result = yield file.download({ url: params.url });
|
|
12771
|
+
const displayPath = (_c = result == null ? void 0 : result.tempFilePath) == null ? void 0 : _c.replace(/^\/storage\/emulated\/0\//, "");
|
|
12772
|
+
closeToast();
|
|
12773
|
+
showSuccessToast({
|
|
12774
|
+
message: displayPath ? `下载成功
|
|
12775
|
+
保存路径:${displayPath}` : "下载成功",
|
|
12776
|
+
duration: 5e3
|
|
12777
|
+
});
|
|
12778
|
+
} catch (e) {
|
|
12779
|
+
closeToast();
|
|
12780
|
+
showFailToast("下载失败");
|
|
12781
|
+
}
|
|
12782
|
+
} finally {
|
|
12783
|
+
downloading.value = false;
|
|
12784
|
+
}
|
|
12785
|
+
});
|
|
12786
|
+
const downloadFile = (options) => {
|
|
12787
|
+
var _a;
|
|
12788
|
+
return download2(__spreadProps$1(__spreadValues$1({}, options), { index: (_a = options.index) != null ? _a : -1 }), true);
|
|
12789
|
+
};
|
|
12790
|
+
return { downloading, download: download2, downloadFile };
|
|
12791
|
+
}
|
|
12716
12792
|
const [name$C, bem$B] = createNamespace("image-preview");
|
|
12717
12793
|
const popupProps$1 = ["show", "transition", "overlayStyle", "closeOnPopstate", "teleport"];
|
|
12718
12794
|
const imagePreviewProps = {
|
|
@@ -12749,8 +12825,13 @@ var __publicField = (obj, key, value) => {
|
|
|
12749
12825
|
slots
|
|
12750
12826
|
}) {
|
|
12751
12827
|
const swipeRef = vue.ref();
|
|
12828
|
+
const {
|
|
12829
|
+
downloading,
|
|
12830
|
+
download: download2,
|
|
12831
|
+
downloadFile
|
|
12832
|
+
} = useMediaDownload(props);
|
|
12752
12833
|
const state = vue.reactive({
|
|
12753
|
-
active:
|
|
12834
|
+
active: +props.startPosition,
|
|
12754
12835
|
rootWidth: 0,
|
|
12755
12836
|
rootHeight: 0,
|
|
12756
12837
|
disableZoom: false
|
|
@@ -12788,71 +12869,38 @@ var __publicField = (obj, key, value) => {
|
|
|
12788
12869
|
}, [props.images[state.active].title]);
|
|
12789
12870
|
}
|
|
12790
12871
|
};
|
|
12791
|
-
const onDownload = () =>
|
|
12872
|
+
const onDownload = () => {
|
|
12792
12873
|
var _a, _b, _c;
|
|
12793
|
-
|
|
12874
|
+
return download2({
|
|
12794
12875
|
index: state.active,
|
|
12795
12876
|
url: (_a = props.images[state.active]) == null ? void 0 : _a.url,
|
|
12796
|
-
title: (_b = props.images[state.active]) == null ? void 0 : _b.title
|
|
12797
|
-
|
|
12798
|
-
|
|
12799
|
-
|
|
12800
|
-
|
|
12801
|
-
|
|
12802
|
-
|
|
12803
|
-
|
|
12804
|
-
|
|
12805
|
-
|
|
12806
|
-
|
|
12807
|
-
|
|
12808
|
-
|
|
12809
|
-
|
|
12810
|
-
message: "下载中...",
|
|
12811
|
-
forbidClick: true,
|
|
12812
|
-
duration: 0
|
|
12813
|
-
});
|
|
12814
|
-
fileJsi.download({
|
|
12815
|
-
url: downloadParams.url
|
|
12816
|
-
}).then(({
|
|
12817
|
-
tempFilePath
|
|
12818
|
-
}) => {
|
|
12819
|
-
closeToast();
|
|
12820
|
-
showSuccessToast("下载成功");
|
|
12821
|
-
}).catch(() => {
|
|
12822
|
-
closeToast();
|
|
12823
|
-
showFailToast("下载失败");
|
|
12824
|
-
});
|
|
12825
|
-
return;
|
|
12826
|
-
} else {
|
|
12827
|
-
showFailToast("当前环境暂不支持下载");
|
|
12828
|
-
}
|
|
12829
|
-
}
|
|
12830
|
-
} catch (e) {
|
|
12831
|
-
console.log(e.message);
|
|
12832
|
-
}
|
|
12833
|
-
});
|
|
12877
|
+
title: (_b = props.images[state.active]) == null ? void 0 : _b.title,
|
|
12878
|
+
fileName: (_c = props.images[state.active]) == null ? void 0 : _c.fileName
|
|
12879
|
+
});
|
|
12880
|
+
};
|
|
12881
|
+
const renderDownloadIcon = () => vue.createVNode("button", {
|
|
12882
|
+
"type": "button",
|
|
12883
|
+
"class": bem$B("download-icon"),
|
|
12884
|
+
"aria-label": "下载原图",
|
|
12885
|
+
"disabled": downloading.value,
|
|
12886
|
+
"onClick": onDownload
|
|
12887
|
+
}, [vue.createVNode(Icon, {
|
|
12888
|
+
"name": "download",
|
|
12889
|
+
"size": "24"
|
|
12890
|
+
}, null)]);
|
|
12834
12891
|
const renderIndex = () => {
|
|
12835
12892
|
const image2 = props.images[state.active];
|
|
12836
|
-
const showDownload = props.showDownload && !image2.url.startsWith("data:");
|
|
12893
|
+
const showDownload = props.showDownload && (image2 == null ? void 0 : image2.url) && !image2.url.startsWith("data:");
|
|
12837
12894
|
if (props.showIndex || showDownload) {
|
|
12838
|
-
if (props.showIndex && slots.index) {
|
|
12839
|
-
return vue.createVNode("div", {
|
|
12840
|
-
"class": bem$B("index")
|
|
12841
|
-
}, [slots.index({
|
|
12842
|
-
index: state.active
|
|
12843
|
-
})]);
|
|
12844
|
-
}
|
|
12845
12895
|
return vue.createVNode("div", {
|
|
12846
12896
|
"class": bem$B("index")
|
|
12847
|
-
}, [props.showIndex &&
|
|
12897
|
+
}, [props.showIndex && vue.createVNode("div", {
|
|
12898
|
+
"class": bem$B("index-content")
|
|
12899
|
+
}, [slots.index ? slots.index({
|
|
12900
|
+
index: state.active
|
|
12901
|
+
}) : [renderIndexText(), renderImageTitle()]]), showDownload && renderDownloadIcon()]);
|
|
12848
12902
|
}
|
|
12849
12903
|
};
|
|
12850
|
-
const renderDownloadIcon = () => {
|
|
12851
|
-
return vue.createVNode("div", {
|
|
12852
|
-
"class": bem$B("download-icon"),
|
|
12853
|
-
"onClick": onDownload
|
|
12854
|
-
}, [Download(bem$B)]);
|
|
12855
|
-
};
|
|
12856
12904
|
const renderCover = () => {
|
|
12857
12905
|
if (slots.cover) {
|
|
12858
12906
|
return vue.createVNode("div", {
|
|
@@ -12914,7 +12962,8 @@ var __publicField = (obj, key, value) => {
|
|
|
12914
12962
|
return (_a = swipeRef.value) == null ? void 0 : _a.swipeTo(index2, options);
|
|
12915
12963
|
};
|
|
12916
12964
|
useExpose({
|
|
12917
|
-
swipeTo
|
|
12965
|
+
swipeTo,
|
|
12966
|
+
downloadFile
|
|
12918
12967
|
});
|
|
12919
12968
|
vue.onMounted(() => {
|
|
12920
12969
|
resize2();
|
|
@@ -12944,6 +12993,7 @@ var __publicField = (obj, key, value) => {
|
|
|
12944
12993
|
return () => vue.createVNode(Popup, vue.mergeProps({
|
|
12945
12994
|
"class": [bem$B(), props.className],
|
|
12946
12995
|
"overlayClass": [bem$B("overlay"), props.overlayClass],
|
|
12996
|
+
"onClick": (event) => event.stopPropagation(),
|
|
12947
12997
|
"onClosed": onClosed,
|
|
12948
12998
|
"onUpdate:show": updateShow
|
|
12949
12999
|
}, pick(props, popupProps$1)), {
|
|
@@ -12964,6 +13014,8 @@ var __publicField = (obj, key, value) => {
|
|
|
12964
13014
|
className: "",
|
|
12965
13015
|
showIndex: true,
|
|
12966
13016
|
closeable: false,
|
|
13017
|
+
showDownload: false,
|
|
13018
|
+
downloadAction: void 0,
|
|
12967
13019
|
closeIcon: "clear",
|
|
12968
13020
|
transition: void 0,
|
|
12969
13021
|
beforeClose: void 0,
|
|
@@ -13012,7 +13064,8 @@ var __publicField = (obj, key, value) => {
|
|
|
13012
13064
|
}
|
|
13013
13065
|
return {
|
|
13014
13066
|
url: opt.url,
|
|
13015
|
-
title: opt.title || ""
|
|
13067
|
+
title: opt.title || "",
|
|
13068
|
+
fileName: opt.fileName
|
|
13016
13069
|
};
|
|
13017
13070
|
}),
|
|
13018
13071
|
startPosition
|
|
@@ -17033,6 +17086,9 @@ var __publicField = (obj, key, value) => {
|
|
|
17033
17086
|
show: Boolean,
|
|
17034
17087
|
mediaType: makeStringProp("file"),
|
|
17035
17088
|
mediaUrl: makeStringProp(""),
|
|
17089
|
+
fileName: makeStringProp(""),
|
|
17090
|
+
showDownload: Boolean,
|
|
17091
|
+
downloadAction: Function,
|
|
17036
17092
|
/** 视频播放时的控件展示列表,参考:https://wicg.github.io/controls-list/explainer.html */
|
|
17037
17093
|
controlsList: makeArrayProp([]),
|
|
17038
17094
|
teleport: [String, Object]
|
|
@@ -17047,6 +17103,15 @@ var __publicField = (obj, key, value) => {
|
|
|
17047
17103
|
}) {
|
|
17048
17104
|
const audioRef = vue.ref();
|
|
17049
17105
|
const videoRef = vue.ref();
|
|
17106
|
+
const {
|
|
17107
|
+
downloading,
|
|
17108
|
+
download: download2
|
|
17109
|
+
} = useMediaDownload(props);
|
|
17110
|
+
const onDownload = () => download2({
|
|
17111
|
+
index: 0,
|
|
17112
|
+
url: props.mediaUrl,
|
|
17113
|
+
fileName: props.fileName
|
|
17114
|
+
});
|
|
17050
17115
|
const getMediaElement = () => {
|
|
17051
17116
|
let player;
|
|
17052
17117
|
if (props.mediaType === "audio") {
|
|
@@ -17093,7 +17158,7 @@ var __publicField = (obj, key, value) => {
|
|
|
17093
17158
|
"src": props.mediaUrl,
|
|
17094
17159
|
"ref": videoRef,
|
|
17095
17160
|
"controls": true,
|
|
17096
|
-
"controlslist": props.controlsList.join(" "),
|
|
17161
|
+
"controlslist": [.../* @__PURE__ */ new Set([...props.controlsList, "nodownload"])].join(" "),
|
|
17097
17162
|
"autoplay": true,
|
|
17098
17163
|
"id": "video",
|
|
17099
17164
|
"webkit-playsinline": true,
|
|
@@ -17129,7 +17194,16 @@ var __publicField = (obj, key, value) => {
|
|
|
17129
17194
|
"type": "button",
|
|
17130
17195
|
"class": bem$x("cancel-btn"),
|
|
17131
17196
|
"onClick": onClose
|
|
17132
|
-
}, [vue.createTextVNode("关闭")])
|
|
17197
|
+
}, [vue.createTextVNode("关闭")]), props.showDownload && props.mediaType === "video" && props.mediaUrl && !props.mediaUrl.startsWith("data:") && vue.createVNode("button", {
|
|
17198
|
+
"type": "button",
|
|
17199
|
+
"class": bem$x("download-btn"),
|
|
17200
|
+
"aria-label": "下载视频",
|
|
17201
|
+
"disabled": downloading.value,
|
|
17202
|
+
"onClick": onDownload
|
|
17203
|
+
}, [vue.createVNode(stdin_default$1$, {
|
|
17204
|
+
"name": "download",
|
|
17205
|
+
"size": "24"
|
|
17206
|
+
}, null)])])]
|
|
17133
17207
|
});
|
|
17134
17208
|
}
|
|
17135
17209
|
});
|
|
@@ -17587,19 +17661,19 @@ var __publicField = (obj, key, value) => {
|
|
|
17587
17661
|
});
|
|
17588
17662
|
}
|
|
17589
17663
|
var __create = Object.create;
|
|
17590
|
-
var
|
|
17664
|
+
var __defProp$1 = Object.defineProperty;
|
|
17591
17665
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
17592
17666
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
17593
17667
|
var __getProtoOf = Object.getPrototypeOf;
|
|
17594
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
17668
|
+
var __hasOwnProp$1 = Object.prototype.hasOwnProperty;
|
|
17595
17669
|
var __commonJS = (cb, mod) => function __require() {
|
|
17596
17670
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
17597
17671
|
};
|
|
17598
17672
|
var __copyProps = (to, from, except, desc) => {
|
|
17599
17673
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
17600
17674
|
for (let key of __getOwnPropNames(from))
|
|
17601
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
17602
|
-
|
|
17675
|
+
if (!__hasOwnProp$1.call(to, key) && key !== except)
|
|
17676
|
+
__defProp$1(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17603
17677
|
}
|
|
17604
17678
|
return to;
|
|
17605
17679
|
};
|
|
@@ -17608,7 +17682,7 @@ var __publicField = (obj, key, value) => {
|
|
|
17608
17682
|
// file that has been converted to a CommonJS file using a Babel-
|
|
17609
17683
|
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
17610
17684
|
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
17611
|
-
isNodeMode || !mod || !mod.__esModule ?
|
|
17685
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp$1(target, "default", { value: mod, enumerable: true }) : target,
|
|
17612
17686
|
mod
|
|
17613
17687
|
));
|
|
17614
17688
|
var __async$4 = (__this, __arguments, generator) => {
|
|
@@ -21476,6 +21550,25 @@ var __publicField = (obj, key, value) => {
|
|
|
21476
21550
|
});
|
|
21477
21551
|
Sortable.mount(new AutoScrollPlugin());
|
|
21478
21552
|
Sortable.mount(Remove, Revert);
|
|
21553
|
+
var __defProp2 = Object.defineProperty;
|
|
21554
|
+
var __defProps = Object.defineProperties;
|
|
21555
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
21556
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
21557
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
21558
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
21559
|
+
var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
21560
|
+
var __spreadValues = (a2, b) => {
|
|
21561
|
+
for (var prop in b || (b = {}))
|
|
21562
|
+
if (__hasOwnProp.call(b, prop))
|
|
21563
|
+
__defNormalProp2(a2, prop, b[prop]);
|
|
21564
|
+
if (__getOwnPropSymbols)
|
|
21565
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
21566
|
+
if (__propIsEnum.call(b, prop))
|
|
21567
|
+
__defNormalProp2(a2, prop, b[prop]);
|
|
21568
|
+
}
|
|
21569
|
+
return a2;
|
|
21570
|
+
};
|
|
21571
|
+
var __spreadProps = (a2, b) => __defProps(a2, __getOwnPropDescs(b));
|
|
21479
21572
|
var __async$3 = (__this, __arguments, generator) => {
|
|
21480
21573
|
return new Promise((resolve, reject) => {
|
|
21481
21574
|
var fulfilled = (value) => {
|
|
@@ -21581,6 +21674,9 @@ var __publicField = (obj, key, value) => {
|
|
|
21581
21674
|
emit,
|
|
21582
21675
|
slots
|
|
21583
21676
|
}) {
|
|
21677
|
+
const {
|
|
21678
|
+
downloadFile
|
|
21679
|
+
} = useMediaDownload(props);
|
|
21584
21680
|
const videoOptionsVisible = vue.ref(false);
|
|
21585
21681
|
const audioOptionsVisible = vue.ref(false);
|
|
21586
21682
|
const photoOptionsVisible = vue.ref(false);
|
|
@@ -21588,6 +21684,8 @@ var __publicField = (obj, key, value) => {
|
|
|
21588
21684
|
const mediaPlayerVisible = vue.ref(false);
|
|
21589
21685
|
const mediaTypeToPlay = vue.ref("file");
|
|
21590
21686
|
const mediaUrlToPlay = vue.ref("");
|
|
21687
|
+
const mediaFileNameToPlay = vue.ref("");
|
|
21688
|
+
const mediaIndexToPlay = vue.ref(0);
|
|
21591
21689
|
const cameraInputRef = vue.ref();
|
|
21592
21690
|
const imageInputRef = vue.ref();
|
|
21593
21691
|
const camcorderInputRef = vue.ref();
|
|
@@ -22272,17 +22370,18 @@ var __publicField = (obj, key, value) => {
|
|
|
22272
22370
|
}
|
|
22273
22371
|
deleteMedia(media, index2);
|
|
22274
22372
|
});
|
|
22275
|
-
const previewMedia = (
|
|
22276
|
-
|
|
22277
|
-
if (props.preview && (yield props.preview(props.mediaList, index$12))) {
|
|
22373
|
+
const previewMedia = (index2) => __async$3(this, null, function* () {
|
|
22374
|
+
if (props.preview && (yield props.preview(props.mediaList, index2))) {
|
|
22278
22375
|
return;
|
|
22279
22376
|
}
|
|
22280
|
-
const media = props.mediaList[
|
|
22377
|
+
const media = props.mediaList[index2];
|
|
22281
22378
|
if (media.type === "photo") {
|
|
22282
22379
|
const imageIndex = imageList.value.indexOf(media);
|
|
22283
22380
|
showImagePreview({
|
|
22284
22381
|
images: imageList.value.map((image2) => ({
|
|
22285
|
-
url: image2.url || image2.showSrc || ""
|
|
22382
|
+
url: image2.url || image2.showSrc || "",
|
|
22383
|
+
title: image2.label,
|
|
22384
|
+
fileName: image2.originalName || image2.fileName
|
|
22286
22385
|
})),
|
|
22287
22386
|
showDownload: props.showDownload,
|
|
22288
22387
|
downloadAction: props.downloadAction,
|
|
@@ -22294,45 +22393,28 @@ var __publicField = (obj, key, value) => {
|
|
|
22294
22393
|
showFailToast("文件参数缺失");
|
|
22295
22394
|
} else {
|
|
22296
22395
|
mediaTypeToPlay.value = media.type;
|
|
22396
|
+
mediaFileNameToPlay.value = media.originalName || media.fileName;
|
|
22397
|
+
mediaIndexToPlay.value = index2;
|
|
22297
22398
|
mediaUrlToPlay.value = media.url || (URL || webkitURL).createObjectURL(media.file);
|
|
22298
22399
|
mediaPlayerVisible.value = true;
|
|
22299
22400
|
}
|
|
22300
22401
|
} else if (media.type === "file") {
|
|
22301
|
-
|
|
22302
|
-
|
|
22303
|
-
|
|
22304
|
-
|
|
22305
|
-
|
|
22306
|
-
|
|
22307
|
-
|
|
22308
|
-
|
|
22309
|
-
|
|
22310
|
-
|
|
22311
|
-
|
|
22312
|
-
url: media.url
|
|
22313
|
-
}).then(({
|
|
22314
|
-
tempFilePath
|
|
22315
|
-
}) => {
|
|
22316
|
-
if (fileJsi && fileJsi.openDocument) {
|
|
22317
|
-
fileJsi.openDocument({
|
|
22318
|
-
localFilePath: tempFilePath
|
|
22319
|
-
}).finally(() => {
|
|
22320
|
-
closeToast();
|
|
22321
|
-
});
|
|
22322
|
-
} else {
|
|
22323
|
-
closeToast();
|
|
22324
|
-
}
|
|
22325
|
-
}).catch(() => {
|
|
22326
|
-
closeToast();
|
|
22327
|
-
showFailToast("下载失败");
|
|
22328
|
-
});
|
|
22329
|
-
return;
|
|
22402
|
+
if (props.showDownload) {
|
|
22403
|
+
const url = media.url || (media.file ? URL.createObjectURL(media.file) : "");
|
|
22404
|
+
try {
|
|
22405
|
+
yield downloadFile({
|
|
22406
|
+
url,
|
|
22407
|
+
fileName: media.originalName || media.fileName,
|
|
22408
|
+
index: index2
|
|
22409
|
+
});
|
|
22410
|
+
} finally {
|
|
22411
|
+
if (!media.url && url) {
|
|
22412
|
+
URL.revokeObjectURL(url);
|
|
22330
22413
|
}
|
|
22331
22414
|
}
|
|
22332
|
-
}
|
|
22333
|
-
|
|
22415
|
+
} else {
|
|
22416
|
+
showFailToast("暂不支持此类文件的预览");
|
|
22334
22417
|
}
|
|
22335
|
-
showFailToast("暂不支持此类文件的预览");
|
|
22336
22418
|
}
|
|
22337
22419
|
});
|
|
22338
22420
|
const renderMediaListPlaceholder = () => {
|
|
@@ -22399,7 +22481,16 @@ var __publicField = (obj, key, value) => {
|
|
|
22399
22481
|
"mediaType": mediaTypeToPlay.value,
|
|
22400
22482
|
"mediaUrl": mediaUrlToPlay.value,
|
|
22401
22483
|
"teleport": "body"
|
|
22402
|
-
}, props.mediaPlayerProps
|
|
22484
|
+
}, props.mediaPlayerProps, {
|
|
22485
|
+
"showDownload": props.showDownload,
|
|
22486
|
+
"fileName": mediaFileNameToPlay.value,
|
|
22487
|
+
"downloadAction": (params) => {
|
|
22488
|
+
var _a, _b, _c;
|
|
22489
|
+
return (_c = (_b = props.downloadAction || ((_a = props.mediaPlayerProps) == null ? void 0 : _a.downloadAction)) == null ? void 0 : _b(__spreadProps(__spreadValues({}, params), {
|
|
22490
|
+
index: mediaIndexToPlay.value
|
|
22491
|
+
}))) != null ? _c : false;
|
|
22492
|
+
}
|
|
22493
|
+
}), null), vue.createVNode(stdin_default$1U, {
|
|
22403
22494
|
"show": actionVisible.value,
|
|
22404
22495
|
"onUpdate:show": ($event) => actionVisible.value = $event,
|
|
22405
22496
|
"actions": actionOptions.value,
|
|
@@ -31920,7 +32011,7 @@ var __publicField = (obj, key, value) => {
|
|
|
31920
32011
|
});
|
|
31921
32012
|
}
|
|
31922
32013
|
};
|
|
31923
|
-
const version = "3.1.
|
|
32014
|
+
const version = "3.1.94";
|
|
31924
32015
|
function install(app) {
|
|
31925
32016
|
const components = [
|
|
31926
32017
|
ActionSheet,
|