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.
Files changed (53) hide show
  1. package/es/composables/use-media-download.d.ts +20 -0
  2. package/es/composables/use-media-download.mjs +111 -0
  3. package/es/image-preview/ImagePreview.d.ts +2 -5
  4. package/es/image-preview/ImagePreview.mjs +32 -79
  5. package/es/image-preview/function-call.mjs +4 -1
  6. package/es/image-preview/index.css +1 -1
  7. package/es/image-preview/index.d.ts +1 -2
  8. package/es/image-preview/style/index.mjs +2 -0
  9. package/es/image-preview/types.d.ts +3 -1
  10. package/es/index.d.ts +1 -1
  11. package/es/index.mjs +1 -1
  12. package/es/media-picker/MediaPicker.d.ts +1 -1
  13. package/es/media-picker/MediaPicker.mjs +54 -36
  14. package/es/media-picker/index.d.ts +2 -2
  15. package/es/media-picker/style/index.mjs +3 -1
  16. package/es/media-player/MediaPlayer.d.ts +21 -0
  17. package/es/media-player/MediaPlayer.mjs +25 -2
  18. package/es/media-player/index.css +1 -1
  19. package/es/media-player/index.d.ts +14 -0
  20. package/es/media-player/style/index.mjs +4 -0
  21. package/es/photo-picker/index.d.ts +2 -2
  22. package/es/photo-picker/style/index.mjs +2 -0
  23. package/es/uploader/style/index.mjs +2 -0
  24. package/lib/composables/use-media-download.d.ts +20 -0
  25. package/lib/composables/use-media-download.js +138 -0
  26. package/lib/image-preview/ImagePreview.d.ts +2 -5
  27. package/lib/image-preview/ImagePreview.js +32 -79
  28. package/lib/image-preview/function-call.js +4 -1
  29. package/lib/image-preview/index.css +1 -1
  30. package/lib/image-preview/index.d.ts +1 -2
  31. package/lib/image-preview/style/index.js +2 -0
  32. package/lib/image-preview/types.d.ts +3 -1
  33. package/lib/index.css +1 -1
  34. package/lib/index.d.ts +1 -1
  35. package/lib/index.js +1 -1
  36. package/lib/media-picker/MediaPicker.d.ts +1 -1
  37. package/lib/media-picker/MediaPicker.js +51 -35
  38. package/lib/media-picker/index.d.ts +2 -2
  39. package/lib/media-picker/style/index.js +3 -1
  40. package/lib/media-player/MediaPlayer.d.ts +21 -0
  41. package/lib/media-player/MediaPlayer.js +25 -2
  42. package/lib/media-player/index.css +1 -1
  43. package/lib/media-player/index.d.ts +14 -0
  44. package/lib/media-player/style/index.js +4 -0
  45. package/lib/photo-picker/index.d.ts +2 -2
  46. package/lib/photo-picker/style/index.js +2 -0
  47. package/lib/uploader/style/index.js +2 -0
  48. package/lib/web-types.json +1 -1
  49. package/lib/zartui.cjs.js +196 -105
  50. package/lib/zartui.es.js +196 -105
  51. package/lib/zartui.js +204 -113
  52. package/lib/zartui.min.js +2 -2
  53. 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
- const Download = (bem2) => createVNode("svg", {
12443
- "class": bem2("svg-download-icon"),
12444
- "xmlns": "http://www.w3.org/2000/svg",
12445
- "viewBox": "0 0 20 20"
12446
- }, [createVNode("path", {
12447
- "d": "M3.75,17.5 C3.28976271,17.5 2.91666667,17.126904 2.91666667,16.6666667 L2.91666667,12.5 C2.91666667,12.0397627 3.28976271,11.6666667 3.75,11.6666667 C4.21023729,11.6666667 4.58333333,12.0397627 4.58333333,12.5 L4.58266667,15.833 L15.4166667,15.833 L15.4166667,12.5 C15.4166667,12.0397627 15.7897627,11.6666667 16.25,11.6666667 C16.7102373,11.6666667 17.0833333,12.0397627 17.0833333,12.5 L17.0833333,16.6666667 C17.0833333,17.0915011 16.765429,17.442085 16.3545316,17.4935072 L16.25,17.5 L3.75,17.5 Z M10,2.5 C10.4602373,2.5 10.8333333,2.87309604 10.8333333,3.33333333 L10.834,10.904 L12.327411,9.41074435 L12.3804172,9.36206404 C12.7078286,9.08620893 13.1976137,9.1024357 13.5059223,9.41074435 C13.8313592,9.73618126 13.8313592,10.2638187 13.5059223,10.5892557 L10.5892557,13.5059223 L10.5659501,13.5283458 C10.5602582,13.5336148 10.5544926,13.5388053 10.548655,13.5439156 L10.5362495,13.5546026 L10.5121742,13.5740743 C10.4949132,13.5875412 10.4771081,13.6003432 10.4586783,13.6126074 C10.4455853,13.6212563 10.4323019,13.6294968 10.4192578,13.6370097 C10.4029078,13.6465464 10.3862038,13.6555423 10.3690405,13.664083 C10.3522054,13.6723976 10.3351478,13.6801087 10.3177097,13.6872958 C10.3045293,13.6927357 10.2911788,13.6978473 10.2777746,13.7025471 C10.2584813,13.7093513 10.2389875,13.7154237 10.2194971,13.7207897 C10.2011918,13.7257748 10.1826357,13.7301514 10.1634324,13.7339067 L10.1207556,13.7413147 C10.0813306,13.7470375 10.0410112,13.75 10,13.75 L10.0566667,13.747 L10.0399512,13.7490477 L9.96132783,13.7491078 C9.94161389,13.7481976 9.92192612,13.746591 9.89546844,13.7435072 C9.79274407,13.7306516 9.69583178,13.6990985 9.6082458,13.6523619 L9.59484365,13.6451239 C9.58442452,13.639322 9.57410342,13.6332795 9.56375825,13.6268308 C9.54437371,13.6148978 9.52551484,13.6021934 9.50686916,13.5885746 L9.48480346,13.5717051 L9.41074435,13.5059223 L6.49407768,10.5892557 L6.44539737,10.5362495 C6.16954226,10.2088381 6.18576903,9.719053 6.49407768,9.41074435 L6.54708384,9.36206404 C6.87449527,9.08620893 7.36428033,9.1024357 7.67258898,9.41074435 L9.167,10.905 L9.16666667,3.33333333 C9.16666667,2.87309604 9.53976271,2.5 10,2.5 Z",
12448
- "fill": "#FFF",
12449
- "fill-rule": "nonzero"
12450
- }, null)]);
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: 0,
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 = () => __async$4(this, null, function* () {
12627
+ const onDownload = () => {
12547
12628
  var _a, _b, _c;
12548
- const downloadParams = {
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
- if (props.downloadAction) {
12554
- const result = props.downloadAction(downloadParams);
12555
- if (result) {
12556
- return;
12557
- }
12558
- }
12559
- try {
12560
- let universalJsSdk = yield import("./index-096e2873.mjs");
12561
- if (universalJsSdk && universalJsSdk.getJSI && downloadParams.url) {
12562
- let fileJsi = (_c = universalJsSdk.getJSI()) == null ? void 0 : _c.file;
12563
- if (fileJsi && fileJsi.download) {
12564
- showLoadingToast({
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 && renderIndexText(), props.showIndex && renderImageTitle(), showDownload && renderDownloadIcon()]);
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
- try {
17071
- let universalJsSdk = yield import("./index-096e2873.mjs");
17072
- if (universalJsSdk && universalJsSdk.getJSI && media.url) {
17073
- let fileJsi = (_a = universalJsSdk.getJSI()) == null ? void 0 : _a.file;
17074
- if (fileJsi && fileJsi.download && fileJsi.openDocument) {
17075
- showLoadingToast({
17076
- message: "打开中...",
17077
- forbidClick: true,
17078
- duration: 0
17079
- });
17080
- fileJsi.download({
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
- } catch (e) {
17102
- console.log(e.message);
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), null), createVNode(stdin_default$1U, {
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.93";
24499
+ const version = "3.1.94";
24409
24500
  function install(app) {
24410
24501
  const components = [
24411
24502
  ActionSheet,