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.es.js
CHANGED
|
@@ -12439,15 +12439,25 @@ var stdin_default$U = defineComponent({
|
|
|
12439
12439
|
};
|
|
12440
12440
|
}
|
|
12441
12441
|
});
|
|
12442
|
-
|
|
12443
|
-
|
|
12444
|
-
|
|
12445
|
-
|
|
12446
|
-
|
|
12447
|
-
|
|
12448
|
-
|
|
12449
|
-
|
|
12450
|
-
}
|
|
12442
|
+
var __defProp$1 = Object.defineProperty;
|
|
12443
|
+
var __defProps$1 = Object.defineProperties;
|
|
12444
|
+
var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors;
|
|
12445
|
+
var __getOwnPropSymbols$1 = Object.getOwnPropertySymbols;
|
|
12446
|
+
var __hasOwnProp$1 = Object.prototype.hasOwnProperty;
|
|
12447
|
+
var __propIsEnum$1 = Object.prototype.propertyIsEnumerable;
|
|
12448
|
+
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
12449
|
+
var __spreadValues$1 = (a, b) => {
|
|
12450
|
+
for (var prop in b || (b = {}))
|
|
12451
|
+
if (__hasOwnProp$1.call(b, prop))
|
|
12452
|
+
__defNormalProp$1(a, prop, b[prop]);
|
|
12453
|
+
if (__getOwnPropSymbols$1)
|
|
12454
|
+
for (var prop of __getOwnPropSymbols$1(b)) {
|
|
12455
|
+
if (__propIsEnum$1.call(b, prop))
|
|
12456
|
+
__defNormalProp$1(a, prop, b[prop]);
|
|
12457
|
+
}
|
|
12458
|
+
return a;
|
|
12459
|
+
};
|
|
12460
|
+
var __spreadProps$1 = (a, b) => __defProps$1(a, __getOwnPropDescs$1(b));
|
|
12451
12461
|
var __async$4 = (__this, __arguments, generator) => {
|
|
12452
12462
|
return new Promise((resolve, reject) => {
|
|
12453
12463
|
var fulfilled = (value) => {
|
|
@@ -12468,6 +12478,72 @@ var __async$4 = (__this, __arguments, generator) => {
|
|
|
12468
12478
|
step((generator = generator.apply(__this, __arguments)).next());
|
|
12469
12479
|
});
|
|
12470
12480
|
};
|
|
12481
|
+
function useMediaDownload(props) {
|
|
12482
|
+
const downloading = ref(false);
|
|
12483
|
+
const downloadInBrowser = (params) => {
|
|
12484
|
+
const link = document.createElement("a");
|
|
12485
|
+
link.href = params.url;
|
|
12486
|
+
link.download = params.fileName || "";
|
|
12487
|
+
document.body.appendChild(link);
|
|
12488
|
+
link.click();
|
|
12489
|
+
link.remove();
|
|
12490
|
+
};
|
|
12491
|
+
const download = (params, confirm = false) => __async$4(this, null, function* () {
|
|
12492
|
+
var _a, _b, _c;
|
|
12493
|
+
if (!props.showDownload || downloading.value || !params.url || params.url.startsWith("data:")) {
|
|
12494
|
+
return;
|
|
12495
|
+
}
|
|
12496
|
+
downloading.value = true;
|
|
12497
|
+
try {
|
|
12498
|
+
if (confirm) {
|
|
12499
|
+
try {
|
|
12500
|
+
yield showConfirmDialog({ message: "附件格式暂不支持预览,是否下载原文件" });
|
|
12501
|
+
} catch (action) {
|
|
12502
|
+
if (action !== "cancel") {
|
|
12503
|
+
throw action;
|
|
12504
|
+
}
|
|
12505
|
+
return;
|
|
12506
|
+
}
|
|
12507
|
+
}
|
|
12508
|
+
if (!props.showDownload || ((_a = props.downloadAction) == null ? void 0 : _a.call(props, params))) {
|
|
12509
|
+
return;
|
|
12510
|
+
}
|
|
12511
|
+
let file;
|
|
12512
|
+
try {
|
|
12513
|
+
const sdk = yield import("./index-096e2873.mjs");
|
|
12514
|
+
file = (_b = sdk.getJSI()) == null ? void 0 : _b.file;
|
|
12515
|
+
} catch (e) {
|
|
12516
|
+
downloadInBrowser(params);
|
|
12517
|
+
return;
|
|
12518
|
+
}
|
|
12519
|
+
if (!(file == null ? void 0 : file.download)) {
|
|
12520
|
+
downloadInBrowser(params);
|
|
12521
|
+
return;
|
|
12522
|
+
}
|
|
12523
|
+
showLoadingToast({ message: "下载中...", forbidClick: true, duration: 0 });
|
|
12524
|
+
try {
|
|
12525
|
+
const result = yield file.download({ url: params.url });
|
|
12526
|
+
const displayPath = (_c = result == null ? void 0 : result.tempFilePath) == null ? void 0 : _c.replace(/^\/storage\/emulated\/0\//, "");
|
|
12527
|
+
closeToast();
|
|
12528
|
+
showSuccessToast({
|
|
12529
|
+
message: displayPath ? `下载成功
|
|
12530
|
+
保存路径:${displayPath}` : "下载成功",
|
|
12531
|
+
duration: 5e3
|
|
12532
|
+
});
|
|
12533
|
+
} catch (e) {
|
|
12534
|
+
closeToast();
|
|
12535
|
+
showFailToast("下载失败");
|
|
12536
|
+
}
|
|
12537
|
+
} finally {
|
|
12538
|
+
downloading.value = false;
|
|
12539
|
+
}
|
|
12540
|
+
});
|
|
12541
|
+
const downloadFile = (options) => {
|
|
12542
|
+
var _a;
|
|
12543
|
+
return download(__spreadProps$1(__spreadValues$1({}, options), { index: (_a = options.index) != null ? _a : -1 }), true);
|
|
12544
|
+
};
|
|
12545
|
+
return { downloading, download, downloadFile };
|
|
12546
|
+
}
|
|
12471
12547
|
const [name$C, bem$B] = createNamespace("image-preview");
|
|
12472
12548
|
const popupProps$1 = ["show", "transition", "overlayStyle", "closeOnPopstate", "teleport"];
|
|
12473
12549
|
const imagePreviewProps = {
|
|
@@ -12504,8 +12580,13 @@ var stdin_default$T = defineComponent({
|
|
|
12504
12580
|
slots
|
|
12505
12581
|
}) {
|
|
12506
12582
|
const swipeRef = ref();
|
|
12583
|
+
const {
|
|
12584
|
+
downloading,
|
|
12585
|
+
download,
|
|
12586
|
+
downloadFile
|
|
12587
|
+
} = useMediaDownload(props);
|
|
12507
12588
|
const state = reactive({
|
|
12508
|
-
active:
|
|
12589
|
+
active: +props.startPosition,
|
|
12509
12590
|
rootWidth: 0,
|
|
12510
12591
|
rootHeight: 0,
|
|
12511
12592
|
disableZoom: false
|
|
@@ -12543,71 +12624,38 @@ var stdin_default$T = defineComponent({
|
|
|
12543
12624
|
}, [props.images[state.active].title]);
|
|
12544
12625
|
}
|
|
12545
12626
|
};
|
|
12546
|
-
const onDownload = () =>
|
|
12627
|
+
const onDownload = () => {
|
|
12547
12628
|
var _a, _b, _c;
|
|
12548
|
-
|
|
12629
|
+
return download({
|
|
12549
12630
|
index: state.active,
|
|
12550
12631
|
url: (_a = props.images[state.active]) == null ? void 0 : _a.url,
|
|
12551
|
-
title: (_b = props.images[state.active]) == null ? void 0 : _b.title
|
|
12552
|
-
|
|
12553
|
-
|
|
12554
|
-
|
|
12555
|
-
|
|
12556
|
-
|
|
12557
|
-
|
|
12558
|
-
|
|
12559
|
-
|
|
12560
|
-
|
|
12561
|
-
|
|
12562
|
-
|
|
12563
|
-
|
|
12564
|
-
|
|
12565
|
-
message: "下载中...",
|
|
12566
|
-
forbidClick: true,
|
|
12567
|
-
duration: 0
|
|
12568
|
-
});
|
|
12569
|
-
fileJsi.download({
|
|
12570
|
-
url: downloadParams.url
|
|
12571
|
-
}).then(({
|
|
12572
|
-
tempFilePath
|
|
12573
|
-
}) => {
|
|
12574
|
-
closeToast();
|
|
12575
|
-
showSuccessToast("下载成功");
|
|
12576
|
-
}).catch(() => {
|
|
12577
|
-
closeToast();
|
|
12578
|
-
showFailToast("下载失败");
|
|
12579
|
-
});
|
|
12580
|
-
return;
|
|
12581
|
-
} else {
|
|
12582
|
-
showFailToast("当前环境暂不支持下载");
|
|
12583
|
-
}
|
|
12584
|
-
}
|
|
12585
|
-
} catch (e) {
|
|
12586
|
-
console.log(e.message);
|
|
12587
|
-
}
|
|
12588
|
-
});
|
|
12632
|
+
title: (_b = props.images[state.active]) == null ? void 0 : _b.title,
|
|
12633
|
+
fileName: (_c = props.images[state.active]) == null ? void 0 : _c.fileName
|
|
12634
|
+
});
|
|
12635
|
+
};
|
|
12636
|
+
const renderDownloadIcon = () => createVNode("button", {
|
|
12637
|
+
"type": "button",
|
|
12638
|
+
"class": bem$B("download-icon"),
|
|
12639
|
+
"aria-label": "下载原图",
|
|
12640
|
+
"disabled": downloading.value,
|
|
12641
|
+
"onClick": onDownload
|
|
12642
|
+
}, [createVNode(Icon, {
|
|
12643
|
+
"name": "download",
|
|
12644
|
+
"size": "24"
|
|
12645
|
+
}, null)]);
|
|
12589
12646
|
const renderIndex = () => {
|
|
12590
12647
|
const image = props.images[state.active];
|
|
12591
|
-
const showDownload = props.showDownload && !image.url.startsWith("data:");
|
|
12648
|
+
const showDownload = props.showDownload && (image == null ? void 0 : image.url) && !image.url.startsWith("data:");
|
|
12592
12649
|
if (props.showIndex || showDownload) {
|
|
12593
|
-
if (props.showIndex && slots.index) {
|
|
12594
|
-
return createVNode("div", {
|
|
12595
|
-
"class": bem$B("index")
|
|
12596
|
-
}, [slots.index({
|
|
12597
|
-
index: state.active
|
|
12598
|
-
})]);
|
|
12599
|
-
}
|
|
12600
12650
|
return createVNode("div", {
|
|
12601
12651
|
"class": bem$B("index")
|
|
12602
|
-
}, [props.showIndex &&
|
|
12652
|
+
}, [props.showIndex && createVNode("div", {
|
|
12653
|
+
"class": bem$B("index-content")
|
|
12654
|
+
}, [slots.index ? slots.index({
|
|
12655
|
+
index: state.active
|
|
12656
|
+
}) : [renderIndexText(), renderImageTitle()]]), showDownload && renderDownloadIcon()]);
|
|
12603
12657
|
}
|
|
12604
12658
|
};
|
|
12605
|
-
const renderDownloadIcon = () => {
|
|
12606
|
-
return createVNode("div", {
|
|
12607
|
-
"class": bem$B("download-icon"),
|
|
12608
|
-
"onClick": onDownload
|
|
12609
|
-
}, [Download(bem$B)]);
|
|
12610
|
-
};
|
|
12611
12659
|
const renderCover = () => {
|
|
12612
12660
|
if (slots.cover) {
|
|
12613
12661
|
return createVNode("div", {
|
|
@@ -12669,7 +12717,8 @@ var stdin_default$T = defineComponent({
|
|
|
12669
12717
|
return (_a = swipeRef.value) == null ? void 0 : _a.swipeTo(index2, options);
|
|
12670
12718
|
};
|
|
12671
12719
|
useExpose({
|
|
12672
|
-
swipeTo
|
|
12720
|
+
swipeTo,
|
|
12721
|
+
downloadFile
|
|
12673
12722
|
});
|
|
12674
12723
|
onMounted(() => {
|
|
12675
12724
|
resize();
|
|
@@ -12699,6 +12748,7 @@ var stdin_default$T = defineComponent({
|
|
|
12699
12748
|
return () => createVNode(Popup, mergeProps({
|
|
12700
12749
|
"class": [bem$B(), props.className],
|
|
12701
12750
|
"overlayClass": [bem$B("overlay"), props.overlayClass],
|
|
12751
|
+
"onClick": (event) => event.stopPropagation(),
|
|
12702
12752
|
"onClosed": onClosed,
|
|
12703
12753
|
"onUpdate:show": updateShow
|
|
12704
12754
|
}, pick(props, popupProps$1)), {
|
|
@@ -12719,6 +12769,8 @@ const defaultConfig = {
|
|
|
12719
12769
|
className: "",
|
|
12720
12770
|
showIndex: true,
|
|
12721
12771
|
closeable: false,
|
|
12772
|
+
showDownload: false,
|
|
12773
|
+
downloadAction: void 0,
|
|
12722
12774
|
closeIcon: "clear",
|
|
12723
12775
|
transition: void 0,
|
|
12724
12776
|
beforeClose: void 0,
|
|
@@ -12767,7 +12819,8 @@ const showImagePreview = (options, startPosition = 0) => {
|
|
|
12767
12819
|
}
|
|
12768
12820
|
return {
|
|
12769
12821
|
url: opt.url,
|
|
12770
|
-
title: opt.title || ""
|
|
12822
|
+
title: opt.title || "",
|
|
12823
|
+
fileName: opt.fileName
|
|
12771
12824
|
};
|
|
12772
12825
|
}),
|
|
12773
12826
|
startPosition
|
|
@@ -13429,6 +13482,9 @@ const mediaPlayerProps = {
|
|
|
13429
13482
|
show: Boolean,
|
|
13430
13483
|
mediaType: makeStringProp("file"),
|
|
13431
13484
|
mediaUrl: makeStringProp(""),
|
|
13485
|
+
fileName: makeStringProp(""),
|
|
13486
|
+
showDownload: Boolean,
|
|
13487
|
+
downloadAction: Function,
|
|
13432
13488
|
/** 视频播放时的控件展示列表,参考:https://wicg.github.io/controls-list/explainer.html */
|
|
13433
13489
|
controlsList: makeArrayProp([]),
|
|
13434
13490
|
teleport: [String, Object]
|
|
@@ -13443,6 +13499,15 @@ var stdin_default$O = defineComponent({
|
|
|
13443
13499
|
}) {
|
|
13444
13500
|
const audioRef = ref();
|
|
13445
13501
|
const videoRef = ref();
|
|
13502
|
+
const {
|
|
13503
|
+
downloading,
|
|
13504
|
+
download
|
|
13505
|
+
} = useMediaDownload(props);
|
|
13506
|
+
const onDownload = () => download({
|
|
13507
|
+
index: 0,
|
|
13508
|
+
url: props.mediaUrl,
|
|
13509
|
+
fileName: props.fileName
|
|
13510
|
+
});
|
|
13446
13511
|
const getMediaElement = () => {
|
|
13447
13512
|
let player;
|
|
13448
13513
|
if (props.mediaType === "audio") {
|
|
@@ -13489,7 +13554,7 @@ var stdin_default$O = defineComponent({
|
|
|
13489
13554
|
"src": props.mediaUrl,
|
|
13490
13555
|
"ref": videoRef,
|
|
13491
13556
|
"controls": true,
|
|
13492
|
-
"controlslist": props.controlsList.join(" "),
|
|
13557
|
+
"controlslist": [.../* @__PURE__ */ new Set([...props.controlsList, "nodownload"])].join(" "),
|
|
13493
13558
|
"autoplay": true,
|
|
13494
13559
|
"id": "video",
|
|
13495
13560
|
"webkit-playsinline": true,
|
|
@@ -13525,7 +13590,16 @@ var stdin_default$O = defineComponent({
|
|
|
13525
13590
|
"type": "button",
|
|
13526
13591
|
"class": bem$x("cancel-btn"),
|
|
13527
13592
|
"onClick": onClose
|
|
13528
|
-
}, [createTextVNode("关闭")])
|
|
13593
|
+
}, [createTextVNode("关闭")]), props.showDownload && props.mediaType === "video" && props.mediaUrl && !props.mediaUrl.startsWith("data:") && createVNode("button", {
|
|
13594
|
+
"type": "button",
|
|
13595
|
+
"class": bem$x("download-btn"),
|
|
13596
|
+
"aria-label": "下载视频",
|
|
13597
|
+
"disabled": downloading.value,
|
|
13598
|
+
"onClick": onDownload
|
|
13599
|
+
}, [createVNode(stdin_default$1$, {
|
|
13600
|
+
"name": "download",
|
|
13601
|
+
"size": "24"
|
|
13602
|
+
}, null)])])]
|
|
13529
13603
|
});
|
|
13530
13604
|
}
|
|
13531
13605
|
});
|
|
@@ -16245,6 +16319,25 @@ _extends(Remove, {
|
|
|
16245
16319
|
});
|
|
16246
16320
|
Sortable.mount(new AutoScrollPlugin());
|
|
16247
16321
|
Sortable.mount(Remove, Revert);
|
|
16322
|
+
var __defProp = Object.defineProperty;
|
|
16323
|
+
var __defProps = Object.defineProperties;
|
|
16324
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
16325
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
16326
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
16327
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
16328
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
16329
|
+
var __spreadValues = (a, b) => {
|
|
16330
|
+
for (var prop in b || (b = {}))
|
|
16331
|
+
if (__hasOwnProp.call(b, prop))
|
|
16332
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16333
|
+
if (__getOwnPropSymbols)
|
|
16334
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
16335
|
+
if (__propIsEnum.call(b, prop))
|
|
16336
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16337
|
+
}
|
|
16338
|
+
return a;
|
|
16339
|
+
};
|
|
16340
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
16248
16341
|
var __async$3 = (__this, __arguments, generator) => {
|
|
16249
16342
|
return new Promise((resolve, reject) => {
|
|
16250
16343
|
var fulfilled = (value) => {
|
|
@@ -16350,6 +16443,9 @@ var stdin_default$E = defineComponent({
|
|
|
16350
16443
|
emit,
|
|
16351
16444
|
slots
|
|
16352
16445
|
}) {
|
|
16446
|
+
const {
|
|
16447
|
+
downloadFile
|
|
16448
|
+
} = useMediaDownload(props);
|
|
16353
16449
|
const videoOptionsVisible = ref(false);
|
|
16354
16450
|
const audioOptionsVisible = ref(false);
|
|
16355
16451
|
const photoOptionsVisible = ref(false);
|
|
@@ -16357,6 +16453,8 @@ var stdin_default$E = defineComponent({
|
|
|
16357
16453
|
const mediaPlayerVisible = ref(false);
|
|
16358
16454
|
const mediaTypeToPlay = ref("file");
|
|
16359
16455
|
const mediaUrlToPlay = ref("");
|
|
16456
|
+
const mediaFileNameToPlay = ref("");
|
|
16457
|
+
const mediaIndexToPlay = ref(0);
|
|
16360
16458
|
const cameraInputRef = ref();
|
|
16361
16459
|
const imageInputRef = ref();
|
|
16362
16460
|
const camcorderInputRef = ref();
|
|
@@ -17042,7 +17140,6 @@ var stdin_default$E = defineComponent({
|
|
|
17042
17140
|
deleteMedia(media, index2);
|
|
17043
17141
|
});
|
|
17044
17142
|
const previewMedia = (index2) => __async$3(this, null, function* () {
|
|
17045
|
-
var _a;
|
|
17046
17143
|
if (props.preview && (yield props.preview(props.mediaList, index2))) {
|
|
17047
17144
|
return;
|
|
17048
17145
|
}
|
|
@@ -17051,7 +17148,9 @@ var stdin_default$E = defineComponent({
|
|
|
17051
17148
|
const imageIndex = imageList.value.indexOf(media);
|
|
17052
17149
|
showImagePreview({
|
|
17053
17150
|
images: imageList.value.map((image) => ({
|
|
17054
|
-
url: image.url || image.showSrc || ""
|
|
17151
|
+
url: image.url || image.showSrc || "",
|
|
17152
|
+
title: image.label,
|
|
17153
|
+
fileName: image.originalName || image.fileName
|
|
17055
17154
|
})),
|
|
17056
17155
|
showDownload: props.showDownload,
|
|
17057
17156
|
downloadAction: props.downloadAction,
|
|
@@ -17063,45 +17162,28 @@ var stdin_default$E = defineComponent({
|
|
|
17063
17162
|
showFailToast("文件参数缺失");
|
|
17064
17163
|
} else {
|
|
17065
17164
|
mediaTypeToPlay.value = media.type;
|
|
17165
|
+
mediaFileNameToPlay.value = media.originalName || media.fileName;
|
|
17166
|
+
mediaIndexToPlay.value = index2;
|
|
17066
17167
|
mediaUrlToPlay.value = media.url || (URL || webkitURL).createObjectURL(media.file);
|
|
17067
17168
|
mediaPlayerVisible.value = true;
|
|
17068
17169
|
}
|
|
17069
17170
|
} else if (media.type === "file") {
|
|
17070
|
-
|
|
17071
|
-
|
|
17072
|
-
|
|
17073
|
-
|
|
17074
|
-
|
|
17075
|
-
|
|
17076
|
-
|
|
17077
|
-
|
|
17078
|
-
|
|
17079
|
-
|
|
17080
|
-
|
|
17081
|
-
url: media.url
|
|
17082
|
-
}).then(({
|
|
17083
|
-
tempFilePath
|
|
17084
|
-
}) => {
|
|
17085
|
-
if (fileJsi && fileJsi.openDocument) {
|
|
17086
|
-
fileJsi.openDocument({
|
|
17087
|
-
localFilePath: tempFilePath
|
|
17088
|
-
}).finally(() => {
|
|
17089
|
-
closeToast();
|
|
17090
|
-
});
|
|
17091
|
-
} else {
|
|
17092
|
-
closeToast();
|
|
17093
|
-
}
|
|
17094
|
-
}).catch(() => {
|
|
17095
|
-
closeToast();
|
|
17096
|
-
showFailToast("下载失败");
|
|
17097
|
-
});
|
|
17098
|
-
return;
|
|
17171
|
+
if (props.showDownload) {
|
|
17172
|
+
const url = media.url || (media.file ? URL.createObjectURL(media.file) : "");
|
|
17173
|
+
try {
|
|
17174
|
+
yield downloadFile({
|
|
17175
|
+
url,
|
|
17176
|
+
fileName: media.originalName || media.fileName,
|
|
17177
|
+
index: index2
|
|
17178
|
+
});
|
|
17179
|
+
} finally {
|
|
17180
|
+
if (!media.url && url) {
|
|
17181
|
+
URL.revokeObjectURL(url);
|
|
17099
17182
|
}
|
|
17100
17183
|
}
|
|
17101
|
-
}
|
|
17102
|
-
|
|
17184
|
+
} else {
|
|
17185
|
+
showFailToast("暂不支持此类文件的预览");
|
|
17103
17186
|
}
|
|
17104
|
-
showFailToast("暂不支持此类文件的预览");
|
|
17105
17187
|
}
|
|
17106
17188
|
});
|
|
17107
17189
|
const renderMediaListPlaceholder = () => {
|
|
@@ -17168,7 +17250,16 @@ var stdin_default$E = defineComponent({
|
|
|
17168
17250
|
"mediaType": mediaTypeToPlay.value,
|
|
17169
17251
|
"mediaUrl": mediaUrlToPlay.value,
|
|
17170
17252
|
"teleport": "body"
|
|
17171
|
-
}, props.mediaPlayerProps
|
|
17253
|
+
}, props.mediaPlayerProps, {
|
|
17254
|
+
"showDownload": props.showDownload,
|
|
17255
|
+
"fileName": mediaFileNameToPlay.value,
|
|
17256
|
+
"downloadAction": (params) => {
|
|
17257
|
+
var _a, _b, _c;
|
|
17258
|
+
return (_c = (_b = props.downloadAction || ((_a = props.mediaPlayerProps) == null ? void 0 : _a.downloadAction)) == null ? void 0 : _b(__spreadProps(__spreadValues({}, params), {
|
|
17259
|
+
index: mediaIndexToPlay.value
|
|
17260
|
+
}))) != null ? _c : false;
|
|
17261
|
+
}
|
|
17262
|
+
}), null), createVNode(stdin_default$1U, {
|
|
17172
17263
|
"show": actionVisible.value,
|
|
17173
17264
|
"onUpdate:show": ($event) => actionVisible.value = $event,
|
|
17174
17265
|
"actions": actionOptions.value,
|
|
@@ -24405,7 +24496,7 @@ const Lazyload = {
|
|
|
24405
24496
|
});
|
|
24406
24497
|
}
|
|
24407
24498
|
};
|
|
24408
|
-
const version = "3.1.
|
|
24499
|
+
const version = "3.1.94";
|
|
24409
24500
|
function install(app) {
|
|
24410
24501
|
const components = [
|
|
24411
24502
|
ActionSheet,
|