zartui 3.1.92 → 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/drawer-select/DrawerSelect.mjs +13 -30
- package/es/drawer-select/index.css +1 -1
- 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/drawer-select/DrawerSelect.js +12 -29
- package/lib/drawer-select/index.css +1 -1
- 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 +208 -134
- package/lib/zartui.es.js +208 -134
- package/lib/zartui.js +216 -142
- package/lib/zartui.min.js +2 -2
- package/package.json +5 -5
package/lib/zartui.cjs.js
CHANGED
|
@@ -9083,7 +9083,6 @@ var stdin_default$15 = vue.defineComponent({
|
|
|
9083
9083
|
const commonTypesListRef = vue.ref();
|
|
9084
9084
|
const showLeftCommonTypesMask = vue.ref(false);
|
|
9085
9085
|
const showRightCommonTypesMask = vue.ref(false);
|
|
9086
|
-
let commonTypesResizeObserver;
|
|
9087
9086
|
const defaultTreeNode = vue.ref(props.treeData);
|
|
9088
9087
|
const fields = vue.computed(() => assignDefaultFields$1(props.treeFieldName));
|
|
9089
9088
|
const visibleCommonTypeList = vue.computed(() => {
|
|
@@ -9098,35 +9097,25 @@ var stdin_default$15 = vue.defineComponent({
|
|
|
9098
9097
|
children,
|
|
9099
9098
|
text: key
|
|
9100
9099
|
} = fields.value;
|
|
9100
|
+
const syncSelectCommonId = (node) => {
|
|
9101
|
+
const selectedId = node == null ? void 0 : node[value];
|
|
9102
|
+
selectCommonId.value = typeof selectedId === "string" || typeof selectedId === "number" ? selectedId : -1;
|
|
9103
|
+
};
|
|
9104
|
+
syncSelectCommonId(props.defaultSelectNode);
|
|
9105
|
+
vue.watch(() => props.defaultSelectNode, (node) => {
|
|
9106
|
+
selectNode.value = node;
|
|
9107
|
+
syncSelectCommonId(node);
|
|
9108
|
+
});
|
|
9101
9109
|
const updateCommonTypesMask = () => {
|
|
9102
9110
|
const list = commonTypesListRef.value;
|
|
9103
|
-
if (!list)
|
|
9104
|
-
showLeftCommonTypesMask.value = false;
|
|
9105
|
-
showRightCommonTypesMask.value = false;
|
|
9111
|
+
if (!list)
|
|
9106
9112
|
return;
|
|
9107
|
-
}
|
|
9108
|
-
const remainingScrollWidth = list.scrollWidth - list.clientWidth - list.scrollLeft;
|
|
9109
9113
|
showLeftCommonTypesMask.value = list.scrollLeft > 0;
|
|
9110
|
-
showRightCommonTypesMask.value =
|
|
9114
|
+
showRightCommonTypesMask.value = list.scrollLeft + list.clientWidth < list.scrollWidth;
|
|
9111
9115
|
};
|
|
9112
9116
|
const onCommonTypesScroll = () => {
|
|
9113
9117
|
updateCommonTypesMask();
|
|
9114
9118
|
};
|
|
9115
|
-
const observeCommonTypesList = () => {
|
|
9116
|
-
commonTypesResizeObserver == null ? void 0 : commonTypesResizeObserver.disconnect();
|
|
9117
|
-
const list = commonTypesListRef.value;
|
|
9118
|
-
if (!list || typeof ResizeObserver === "undefined") {
|
|
9119
|
-
return;
|
|
9120
|
-
}
|
|
9121
|
-
commonTypesResizeObserver = new ResizeObserver(updateCommonTypesMask);
|
|
9122
|
-
commonTypesResizeObserver.observe(list);
|
|
9123
|
-
};
|
|
9124
|
-
const updateCommonTypesLayout = () => {
|
|
9125
|
-
vue.nextTick(() => {
|
|
9126
|
-
observeCommonTypesList();
|
|
9127
|
-
updateCommonTypesMask();
|
|
9128
|
-
});
|
|
9129
|
-
};
|
|
9130
9119
|
const allData = {
|
|
9131
9120
|
[value]: -1,
|
|
9132
9121
|
[key]: "全部",
|
|
@@ -9203,13 +9192,7 @@ var stdin_default$15 = vue.defineComponent({
|
|
|
9203
9192
|
};
|
|
9204
9193
|
flatData(props.treeData);
|
|
9205
9194
|
updateOffset();
|
|
9206
|
-
|
|
9207
|
-
});
|
|
9208
|
-
vue.watch(visibleCommonTypeList, updateCommonTypesLayout, {
|
|
9209
|
-
flush: "post"
|
|
9210
|
-
});
|
|
9211
|
-
vue.onBeforeUnmount(() => {
|
|
9212
|
-
commonTypesResizeObserver == null ? void 0 : commonTypesResizeObserver.disconnect();
|
|
9195
|
+
vue.nextTick(updateCommonTypesMask);
|
|
9213
9196
|
});
|
|
9214
9197
|
const isEmpty = (item) => !item[children] || item[children].length === 0;
|
|
9215
9198
|
const syncExpandNodeByParent = (item) => {
|
|
@@ -12458,15 +12441,25 @@ var stdin_default$U = vue.defineComponent({
|
|
|
12458
12441
|
};
|
|
12459
12442
|
}
|
|
12460
12443
|
});
|
|
12461
|
-
|
|
12462
|
-
|
|
12463
|
-
|
|
12464
|
-
|
|
12465
|
-
|
|
12466
|
-
|
|
12467
|
-
|
|
12468
|
-
|
|
12469
|
-
}
|
|
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));
|
|
12470
12463
|
var __async$4 = (__this, __arguments, generator) => {
|
|
12471
12464
|
return new Promise((resolve, reject) => {
|
|
12472
12465
|
var fulfilled = (value) => {
|
|
@@ -12487,6 +12480,72 @@ var __async$4 = (__this, __arguments, generator) => {
|
|
|
12487
12480
|
step((generator = generator.apply(__this, __arguments)).next());
|
|
12488
12481
|
});
|
|
12489
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
|
+
}
|
|
12490
12549
|
const [name$C, bem$B] = createNamespace("image-preview");
|
|
12491
12550
|
const popupProps$1 = ["show", "transition", "overlayStyle", "closeOnPopstate", "teleport"];
|
|
12492
12551
|
const imagePreviewProps = {
|
|
@@ -12523,8 +12582,13 @@ var stdin_default$T = vue.defineComponent({
|
|
|
12523
12582
|
slots
|
|
12524
12583
|
}) {
|
|
12525
12584
|
const swipeRef = vue.ref();
|
|
12585
|
+
const {
|
|
12586
|
+
downloading,
|
|
12587
|
+
download,
|
|
12588
|
+
downloadFile
|
|
12589
|
+
} = useMediaDownload(props);
|
|
12526
12590
|
const state = vue.reactive({
|
|
12527
|
-
active:
|
|
12591
|
+
active: +props.startPosition,
|
|
12528
12592
|
rootWidth: 0,
|
|
12529
12593
|
rootHeight: 0,
|
|
12530
12594
|
disableZoom: false
|
|
@@ -12562,71 +12626,38 @@ var stdin_default$T = vue.defineComponent({
|
|
|
12562
12626
|
}, [props.images[state.active].title]);
|
|
12563
12627
|
}
|
|
12564
12628
|
};
|
|
12565
|
-
const onDownload = () =>
|
|
12629
|
+
const onDownload = () => {
|
|
12566
12630
|
var _a, _b, _c;
|
|
12567
|
-
|
|
12631
|
+
return download({
|
|
12568
12632
|
index: state.active,
|
|
12569
12633
|
url: (_a = props.images[state.active]) == null ? void 0 : _a.url,
|
|
12570
|
-
title: (_b = props.images[state.active]) == null ? void 0 : _b.title
|
|
12571
|
-
|
|
12572
|
-
|
|
12573
|
-
|
|
12574
|
-
|
|
12575
|
-
|
|
12576
|
-
|
|
12577
|
-
|
|
12578
|
-
|
|
12579
|
-
|
|
12580
|
-
|
|
12581
|
-
|
|
12582
|
-
|
|
12583
|
-
|
|
12584
|
-
message: "下载中...",
|
|
12585
|
-
forbidClick: true,
|
|
12586
|
-
duration: 0
|
|
12587
|
-
});
|
|
12588
|
-
fileJsi.download({
|
|
12589
|
-
url: downloadParams.url
|
|
12590
|
-
}).then(({
|
|
12591
|
-
tempFilePath
|
|
12592
|
-
}) => {
|
|
12593
|
-
closeToast();
|
|
12594
|
-
showSuccessToast("下载成功");
|
|
12595
|
-
}).catch(() => {
|
|
12596
|
-
closeToast();
|
|
12597
|
-
showFailToast("下载失败");
|
|
12598
|
-
});
|
|
12599
|
-
return;
|
|
12600
|
-
} else {
|
|
12601
|
-
showFailToast("当前环境暂不支持下载");
|
|
12602
|
-
}
|
|
12603
|
-
}
|
|
12604
|
-
} catch (e) {
|
|
12605
|
-
console.log(e.message);
|
|
12606
|
-
}
|
|
12607
|
-
});
|
|
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)]);
|
|
12608
12648
|
const renderIndex = () => {
|
|
12609
12649
|
const image = props.images[state.active];
|
|
12610
|
-
const showDownload = props.showDownload && !image.url.startsWith("data:");
|
|
12650
|
+
const showDownload = props.showDownload && (image == null ? void 0 : image.url) && !image.url.startsWith("data:");
|
|
12611
12651
|
if (props.showIndex || showDownload) {
|
|
12612
|
-
if (props.showIndex && slots.index) {
|
|
12613
|
-
return vue.createVNode("div", {
|
|
12614
|
-
"class": bem$B("index")
|
|
12615
|
-
}, [slots.index({
|
|
12616
|
-
index: state.active
|
|
12617
|
-
})]);
|
|
12618
|
-
}
|
|
12619
12652
|
return vue.createVNode("div", {
|
|
12620
12653
|
"class": bem$B("index")
|
|
12621
|
-
}, [props.showIndex &&
|
|
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()]);
|
|
12622
12659
|
}
|
|
12623
12660
|
};
|
|
12624
|
-
const renderDownloadIcon = () => {
|
|
12625
|
-
return vue.createVNode("div", {
|
|
12626
|
-
"class": bem$B("download-icon"),
|
|
12627
|
-
"onClick": onDownload
|
|
12628
|
-
}, [Download(bem$B)]);
|
|
12629
|
-
};
|
|
12630
12661
|
const renderCover = () => {
|
|
12631
12662
|
if (slots.cover) {
|
|
12632
12663
|
return vue.createVNode("div", {
|
|
@@ -12688,7 +12719,8 @@ var stdin_default$T = vue.defineComponent({
|
|
|
12688
12719
|
return (_a = swipeRef.value) == null ? void 0 : _a.swipeTo(index2, options);
|
|
12689
12720
|
};
|
|
12690
12721
|
useExpose({
|
|
12691
|
-
swipeTo
|
|
12722
|
+
swipeTo,
|
|
12723
|
+
downloadFile
|
|
12692
12724
|
});
|
|
12693
12725
|
vue.onMounted(() => {
|
|
12694
12726
|
resize();
|
|
@@ -12718,6 +12750,7 @@ var stdin_default$T = vue.defineComponent({
|
|
|
12718
12750
|
return () => vue.createVNode(Popup, vue.mergeProps({
|
|
12719
12751
|
"class": [bem$B(), props.className],
|
|
12720
12752
|
"overlayClass": [bem$B("overlay"), props.overlayClass],
|
|
12753
|
+
"onClick": (event) => event.stopPropagation(),
|
|
12721
12754
|
"onClosed": onClosed,
|
|
12722
12755
|
"onUpdate:show": updateShow
|
|
12723
12756
|
}, pick(props, popupProps$1)), {
|
|
@@ -12738,6 +12771,8 @@ const defaultConfig = {
|
|
|
12738
12771
|
className: "",
|
|
12739
12772
|
showIndex: true,
|
|
12740
12773
|
closeable: false,
|
|
12774
|
+
showDownload: false,
|
|
12775
|
+
downloadAction: void 0,
|
|
12741
12776
|
closeIcon: "clear",
|
|
12742
12777
|
transition: void 0,
|
|
12743
12778
|
beforeClose: void 0,
|
|
@@ -12786,7 +12821,8 @@ const showImagePreview = (options, startPosition = 0) => {
|
|
|
12786
12821
|
}
|
|
12787
12822
|
return {
|
|
12788
12823
|
url: opt.url,
|
|
12789
|
-
title: opt.title || ""
|
|
12824
|
+
title: opt.title || "",
|
|
12825
|
+
fileName: opt.fileName
|
|
12790
12826
|
};
|
|
12791
12827
|
}),
|
|
12792
12828
|
startPosition
|
|
@@ -13448,6 +13484,9 @@ const mediaPlayerProps = {
|
|
|
13448
13484
|
show: Boolean,
|
|
13449
13485
|
mediaType: makeStringProp("file"),
|
|
13450
13486
|
mediaUrl: makeStringProp(""),
|
|
13487
|
+
fileName: makeStringProp(""),
|
|
13488
|
+
showDownload: Boolean,
|
|
13489
|
+
downloadAction: Function,
|
|
13451
13490
|
/** 视频播放时的控件展示列表,参考:https://wicg.github.io/controls-list/explainer.html */
|
|
13452
13491
|
controlsList: makeArrayProp([]),
|
|
13453
13492
|
teleport: [String, Object]
|
|
@@ -13462,6 +13501,15 @@ var stdin_default$O = vue.defineComponent({
|
|
|
13462
13501
|
}) {
|
|
13463
13502
|
const audioRef = vue.ref();
|
|
13464
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
|
+
});
|
|
13465
13513
|
const getMediaElement = () => {
|
|
13466
13514
|
let player;
|
|
13467
13515
|
if (props.mediaType === "audio") {
|
|
@@ -13508,7 +13556,7 @@ var stdin_default$O = vue.defineComponent({
|
|
|
13508
13556
|
"src": props.mediaUrl,
|
|
13509
13557
|
"ref": videoRef,
|
|
13510
13558
|
"controls": true,
|
|
13511
|
-
"controlslist": props.controlsList.join(" "),
|
|
13559
|
+
"controlslist": [.../* @__PURE__ */ new Set([...props.controlsList, "nodownload"])].join(" "),
|
|
13512
13560
|
"autoplay": true,
|
|
13513
13561
|
"id": "video",
|
|
13514
13562
|
"webkit-playsinline": true,
|
|
@@ -13544,7 +13592,16 @@ var stdin_default$O = vue.defineComponent({
|
|
|
13544
13592
|
"type": "button",
|
|
13545
13593
|
"class": bem$x("cancel-btn"),
|
|
13546
13594
|
"onClick": onClose
|
|
13547
|
-
}, [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)])])]
|
|
13548
13605
|
});
|
|
13549
13606
|
}
|
|
13550
13607
|
});
|
|
@@ -16264,6 +16321,25 @@ _extends(Remove, {
|
|
|
16264
16321
|
});
|
|
16265
16322
|
Sortable.mount(new AutoScrollPlugin());
|
|
16266
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));
|
|
16267
16343
|
var __async$3 = (__this, __arguments, generator) => {
|
|
16268
16344
|
return new Promise((resolve, reject) => {
|
|
16269
16345
|
var fulfilled = (value) => {
|
|
@@ -16369,6 +16445,9 @@ var stdin_default$E = vue.defineComponent({
|
|
|
16369
16445
|
emit,
|
|
16370
16446
|
slots
|
|
16371
16447
|
}) {
|
|
16448
|
+
const {
|
|
16449
|
+
downloadFile
|
|
16450
|
+
} = useMediaDownload(props);
|
|
16372
16451
|
const videoOptionsVisible = vue.ref(false);
|
|
16373
16452
|
const audioOptionsVisible = vue.ref(false);
|
|
16374
16453
|
const photoOptionsVisible = vue.ref(false);
|
|
@@ -16376,6 +16455,8 @@ var stdin_default$E = vue.defineComponent({
|
|
|
16376
16455
|
const mediaPlayerVisible = vue.ref(false);
|
|
16377
16456
|
const mediaTypeToPlay = vue.ref("file");
|
|
16378
16457
|
const mediaUrlToPlay = vue.ref("");
|
|
16458
|
+
const mediaFileNameToPlay = vue.ref("");
|
|
16459
|
+
const mediaIndexToPlay = vue.ref(0);
|
|
16379
16460
|
const cameraInputRef = vue.ref();
|
|
16380
16461
|
const imageInputRef = vue.ref();
|
|
16381
16462
|
const camcorderInputRef = vue.ref();
|
|
@@ -17061,7 +17142,6 @@ var stdin_default$E = vue.defineComponent({
|
|
|
17061
17142
|
deleteMedia(media, index2);
|
|
17062
17143
|
});
|
|
17063
17144
|
const previewMedia = (index2) => __async$3(this, null, function* () {
|
|
17064
|
-
var _a;
|
|
17065
17145
|
if (props.preview && (yield props.preview(props.mediaList, index2))) {
|
|
17066
17146
|
return;
|
|
17067
17147
|
}
|
|
@@ -17070,7 +17150,9 @@ var stdin_default$E = vue.defineComponent({
|
|
|
17070
17150
|
const imageIndex = imageList.value.indexOf(media);
|
|
17071
17151
|
showImagePreview({
|
|
17072
17152
|
images: imageList.value.map((image) => ({
|
|
17073
|
-
url: image.url || image.showSrc || ""
|
|
17153
|
+
url: image.url || image.showSrc || "",
|
|
17154
|
+
title: image.label,
|
|
17155
|
+
fileName: image.originalName || image.fileName
|
|
17074
17156
|
})),
|
|
17075
17157
|
showDownload: props.showDownload,
|
|
17076
17158
|
downloadAction: props.downloadAction,
|
|
@@ -17082,45 +17164,28 @@ var stdin_default$E = vue.defineComponent({
|
|
|
17082
17164
|
showFailToast("文件参数缺失");
|
|
17083
17165
|
} else {
|
|
17084
17166
|
mediaTypeToPlay.value = media.type;
|
|
17167
|
+
mediaFileNameToPlay.value = media.originalName || media.fileName;
|
|
17168
|
+
mediaIndexToPlay.value = index2;
|
|
17085
17169
|
mediaUrlToPlay.value = media.url || (URL || webkitURL).createObjectURL(media.file);
|
|
17086
17170
|
mediaPlayerVisible.value = true;
|
|
17087
17171
|
}
|
|
17088
17172
|
} else if (media.type === "file") {
|
|
17089
|
-
|
|
17090
|
-
|
|
17091
|
-
|
|
17092
|
-
|
|
17093
|
-
|
|
17094
|
-
|
|
17095
|
-
|
|
17096
|
-
|
|
17097
|
-
|
|
17098
|
-
|
|
17099
|
-
|
|
17100
|
-
url: media.url
|
|
17101
|
-
}).then(({
|
|
17102
|
-
tempFilePath
|
|
17103
|
-
}) => {
|
|
17104
|
-
if (fileJsi && fileJsi.openDocument) {
|
|
17105
|
-
fileJsi.openDocument({
|
|
17106
|
-
localFilePath: tempFilePath
|
|
17107
|
-
}).finally(() => {
|
|
17108
|
-
closeToast();
|
|
17109
|
-
});
|
|
17110
|
-
} else {
|
|
17111
|
-
closeToast();
|
|
17112
|
-
}
|
|
17113
|
-
}).catch(() => {
|
|
17114
|
-
closeToast();
|
|
17115
|
-
showFailToast("下载失败");
|
|
17116
|
-
});
|
|
17117
|
-
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);
|
|
17118
17184
|
}
|
|
17119
17185
|
}
|
|
17120
|
-
}
|
|
17121
|
-
|
|
17186
|
+
} else {
|
|
17187
|
+
showFailToast("暂不支持此类文件的预览");
|
|
17122
17188
|
}
|
|
17123
|
-
showFailToast("暂不支持此类文件的预览");
|
|
17124
17189
|
}
|
|
17125
17190
|
});
|
|
17126
17191
|
const renderMediaListPlaceholder = () => {
|
|
@@ -17187,7 +17252,16 @@ var stdin_default$E = vue.defineComponent({
|
|
|
17187
17252
|
"mediaType": mediaTypeToPlay.value,
|
|
17188
17253
|
"mediaUrl": mediaUrlToPlay.value,
|
|
17189
17254
|
"teleport": "body"
|
|
17190
|
-
}, props.mediaPlayerProps
|
|
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, {
|
|
17191
17265
|
"show": actionVisible.value,
|
|
17192
17266
|
"onUpdate:show": ($event) => actionVisible.value = $event,
|
|
17193
17267
|
"actions": actionOptions.value,
|
|
@@ -24424,7 +24498,7 @@ const Lazyload = {
|
|
|
24424
24498
|
});
|
|
24425
24499
|
}
|
|
24426
24500
|
};
|
|
24427
|
-
const version = "3.1.
|
|
24501
|
+
const version = "3.1.94";
|
|
24428
24502
|
function install(app) {
|
|
24429
24503
|
const components = [
|
|
24430
24504
|
ActionSheet,
|