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