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.es.js
CHANGED
|
@@ -9081,7 +9081,6 @@ var stdin_default$15 = defineComponent({
|
|
|
9081
9081
|
const commonTypesListRef = ref();
|
|
9082
9082
|
const showLeftCommonTypesMask = ref(false);
|
|
9083
9083
|
const showRightCommonTypesMask = ref(false);
|
|
9084
|
-
let commonTypesResizeObserver;
|
|
9085
9084
|
const defaultTreeNode = ref(props.treeData);
|
|
9086
9085
|
const fields = computed(() => assignDefaultFields$1(props.treeFieldName));
|
|
9087
9086
|
const visibleCommonTypeList = computed(() => {
|
|
@@ -9096,35 +9095,25 @@ var stdin_default$15 = defineComponent({
|
|
|
9096
9095
|
children,
|
|
9097
9096
|
text: key
|
|
9098
9097
|
} = fields.value;
|
|
9098
|
+
const syncSelectCommonId = (node) => {
|
|
9099
|
+
const selectedId = node == null ? void 0 : node[value];
|
|
9100
|
+
selectCommonId.value = typeof selectedId === "string" || typeof selectedId === "number" ? selectedId : -1;
|
|
9101
|
+
};
|
|
9102
|
+
syncSelectCommonId(props.defaultSelectNode);
|
|
9103
|
+
watch(() => props.defaultSelectNode, (node) => {
|
|
9104
|
+
selectNode.value = node;
|
|
9105
|
+
syncSelectCommonId(node);
|
|
9106
|
+
});
|
|
9099
9107
|
const updateCommonTypesMask = () => {
|
|
9100
9108
|
const list = commonTypesListRef.value;
|
|
9101
|
-
if (!list)
|
|
9102
|
-
showLeftCommonTypesMask.value = false;
|
|
9103
|
-
showRightCommonTypesMask.value = false;
|
|
9109
|
+
if (!list)
|
|
9104
9110
|
return;
|
|
9105
|
-
}
|
|
9106
|
-
const remainingScrollWidth = list.scrollWidth - list.clientWidth - list.scrollLeft;
|
|
9107
9111
|
showLeftCommonTypesMask.value = list.scrollLeft > 0;
|
|
9108
|
-
showRightCommonTypesMask.value =
|
|
9112
|
+
showRightCommonTypesMask.value = list.scrollLeft + list.clientWidth < list.scrollWidth;
|
|
9109
9113
|
};
|
|
9110
9114
|
const onCommonTypesScroll = () => {
|
|
9111
9115
|
updateCommonTypesMask();
|
|
9112
9116
|
};
|
|
9113
|
-
const observeCommonTypesList = () => {
|
|
9114
|
-
commonTypesResizeObserver == null ? void 0 : commonTypesResizeObserver.disconnect();
|
|
9115
|
-
const list = commonTypesListRef.value;
|
|
9116
|
-
if (!list || typeof ResizeObserver === "undefined") {
|
|
9117
|
-
return;
|
|
9118
|
-
}
|
|
9119
|
-
commonTypesResizeObserver = new ResizeObserver(updateCommonTypesMask);
|
|
9120
|
-
commonTypesResizeObserver.observe(list);
|
|
9121
|
-
};
|
|
9122
|
-
const updateCommonTypesLayout = () => {
|
|
9123
|
-
nextTick(() => {
|
|
9124
|
-
observeCommonTypesList();
|
|
9125
|
-
updateCommonTypesMask();
|
|
9126
|
-
});
|
|
9127
|
-
};
|
|
9128
9117
|
const allData = {
|
|
9129
9118
|
[value]: -1,
|
|
9130
9119
|
[key]: "全部",
|
|
@@ -9201,13 +9190,7 @@ var stdin_default$15 = defineComponent({
|
|
|
9201
9190
|
};
|
|
9202
9191
|
flatData(props.treeData);
|
|
9203
9192
|
updateOffset();
|
|
9204
|
-
|
|
9205
|
-
});
|
|
9206
|
-
watch(visibleCommonTypeList, updateCommonTypesLayout, {
|
|
9207
|
-
flush: "post"
|
|
9208
|
-
});
|
|
9209
|
-
onBeforeUnmount(() => {
|
|
9210
|
-
commonTypesResizeObserver == null ? void 0 : commonTypesResizeObserver.disconnect();
|
|
9193
|
+
nextTick(updateCommonTypesMask);
|
|
9211
9194
|
});
|
|
9212
9195
|
const isEmpty = (item) => !item[children] || item[children].length === 0;
|
|
9213
9196
|
const syncExpandNodeByParent = (item) => {
|
|
@@ -12456,15 +12439,25 @@ var stdin_default$U = defineComponent({
|
|
|
12456
12439
|
};
|
|
12457
12440
|
}
|
|
12458
12441
|
});
|
|
12459
|
-
|
|
12460
|
-
|
|
12461
|
-
|
|
12462
|
-
|
|
12463
|
-
|
|
12464
|
-
|
|
12465
|
-
|
|
12466
|
-
|
|
12467
|
-
}
|
|
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));
|
|
12468
12461
|
var __async$4 = (__this, __arguments, generator) => {
|
|
12469
12462
|
return new Promise((resolve, reject) => {
|
|
12470
12463
|
var fulfilled = (value) => {
|
|
@@ -12485,6 +12478,72 @@ var __async$4 = (__this, __arguments, generator) => {
|
|
|
12485
12478
|
step((generator = generator.apply(__this, __arguments)).next());
|
|
12486
12479
|
});
|
|
12487
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
|
+
}
|
|
12488
12547
|
const [name$C, bem$B] = createNamespace("image-preview");
|
|
12489
12548
|
const popupProps$1 = ["show", "transition", "overlayStyle", "closeOnPopstate", "teleport"];
|
|
12490
12549
|
const imagePreviewProps = {
|
|
@@ -12521,8 +12580,13 @@ var stdin_default$T = defineComponent({
|
|
|
12521
12580
|
slots
|
|
12522
12581
|
}) {
|
|
12523
12582
|
const swipeRef = ref();
|
|
12583
|
+
const {
|
|
12584
|
+
downloading,
|
|
12585
|
+
download,
|
|
12586
|
+
downloadFile
|
|
12587
|
+
} = useMediaDownload(props);
|
|
12524
12588
|
const state = reactive({
|
|
12525
|
-
active:
|
|
12589
|
+
active: +props.startPosition,
|
|
12526
12590
|
rootWidth: 0,
|
|
12527
12591
|
rootHeight: 0,
|
|
12528
12592
|
disableZoom: false
|
|
@@ -12560,71 +12624,38 @@ var stdin_default$T = defineComponent({
|
|
|
12560
12624
|
}, [props.images[state.active].title]);
|
|
12561
12625
|
}
|
|
12562
12626
|
};
|
|
12563
|
-
const onDownload = () =>
|
|
12627
|
+
const onDownload = () => {
|
|
12564
12628
|
var _a, _b, _c;
|
|
12565
|
-
|
|
12629
|
+
return download({
|
|
12566
12630
|
index: state.active,
|
|
12567
12631
|
url: (_a = props.images[state.active]) == null ? void 0 : _a.url,
|
|
12568
|
-
title: (_b = props.images[state.active]) == null ? void 0 : _b.title
|
|
12569
|
-
|
|
12570
|
-
|
|
12571
|
-
|
|
12572
|
-
|
|
12573
|
-
|
|
12574
|
-
|
|
12575
|
-
|
|
12576
|
-
|
|
12577
|
-
|
|
12578
|
-
|
|
12579
|
-
|
|
12580
|
-
|
|
12581
|
-
|
|
12582
|
-
message: "下载中...",
|
|
12583
|
-
forbidClick: true,
|
|
12584
|
-
duration: 0
|
|
12585
|
-
});
|
|
12586
|
-
fileJsi.download({
|
|
12587
|
-
url: downloadParams.url
|
|
12588
|
-
}).then(({
|
|
12589
|
-
tempFilePath
|
|
12590
|
-
}) => {
|
|
12591
|
-
closeToast();
|
|
12592
|
-
showSuccessToast("下载成功");
|
|
12593
|
-
}).catch(() => {
|
|
12594
|
-
closeToast();
|
|
12595
|
-
showFailToast("下载失败");
|
|
12596
|
-
});
|
|
12597
|
-
return;
|
|
12598
|
-
} else {
|
|
12599
|
-
showFailToast("当前环境暂不支持下载");
|
|
12600
|
-
}
|
|
12601
|
-
}
|
|
12602
|
-
} catch (e) {
|
|
12603
|
-
console.log(e.message);
|
|
12604
|
-
}
|
|
12605
|
-
});
|
|
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)]);
|
|
12606
12646
|
const renderIndex = () => {
|
|
12607
12647
|
const image = props.images[state.active];
|
|
12608
|
-
const showDownload = props.showDownload && !image.url.startsWith("data:");
|
|
12648
|
+
const showDownload = props.showDownload && (image == null ? void 0 : image.url) && !image.url.startsWith("data:");
|
|
12609
12649
|
if (props.showIndex || showDownload) {
|
|
12610
|
-
if (props.showIndex && slots.index) {
|
|
12611
|
-
return createVNode("div", {
|
|
12612
|
-
"class": bem$B("index")
|
|
12613
|
-
}, [slots.index({
|
|
12614
|
-
index: state.active
|
|
12615
|
-
})]);
|
|
12616
|
-
}
|
|
12617
12650
|
return createVNode("div", {
|
|
12618
12651
|
"class": bem$B("index")
|
|
12619
|
-
}, [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()]);
|
|
12620
12657
|
}
|
|
12621
12658
|
};
|
|
12622
|
-
const renderDownloadIcon = () => {
|
|
12623
|
-
return createVNode("div", {
|
|
12624
|
-
"class": bem$B("download-icon"),
|
|
12625
|
-
"onClick": onDownload
|
|
12626
|
-
}, [Download(bem$B)]);
|
|
12627
|
-
};
|
|
12628
12659
|
const renderCover = () => {
|
|
12629
12660
|
if (slots.cover) {
|
|
12630
12661
|
return createVNode("div", {
|
|
@@ -12686,7 +12717,8 @@ var stdin_default$T = defineComponent({
|
|
|
12686
12717
|
return (_a = swipeRef.value) == null ? void 0 : _a.swipeTo(index2, options);
|
|
12687
12718
|
};
|
|
12688
12719
|
useExpose({
|
|
12689
|
-
swipeTo
|
|
12720
|
+
swipeTo,
|
|
12721
|
+
downloadFile
|
|
12690
12722
|
});
|
|
12691
12723
|
onMounted(() => {
|
|
12692
12724
|
resize();
|
|
@@ -12716,6 +12748,7 @@ var stdin_default$T = defineComponent({
|
|
|
12716
12748
|
return () => createVNode(Popup, mergeProps({
|
|
12717
12749
|
"class": [bem$B(), props.className],
|
|
12718
12750
|
"overlayClass": [bem$B("overlay"), props.overlayClass],
|
|
12751
|
+
"onClick": (event) => event.stopPropagation(),
|
|
12719
12752
|
"onClosed": onClosed,
|
|
12720
12753
|
"onUpdate:show": updateShow
|
|
12721
12754
|
}, pick(props, popupProps$1)), {
|
|
@@ -12736,6 +12769,8 @@ const defaultConfig = {
|
|
|
12736
12769
|
className: "",
|
|
12737
12770
|
showIndex: true,
|
|
12738
12771
|
closeable: false,
|
|
12772
|
+
showDownload: false,
|
|
12773
|
+
downloadAction: void 0,
|
|
12739
12774
|
closeIcon: "clear",
|
|
12740
12775
|
transition: void 0,
|
|
12741
12776
|
beforeClose: void 0,
|
|
@@ -12784,7 +12819,8 @@ const showImagePreview = (options, startPosition = 0) => {
|
|
|
12784
12819
|
}
|
|
12785
12820
|
return {
|
|
12786
12821
|
url: opt.url,
|
|
12787
|
-
title: opt.title || ""
|
|
12822
|
+
title: opt.title || "",
|
|
12823
|
+
fileName: opt.fileName
|
|
12788
12824
|
};
|
|
12789
12825
|
}),
|
|
12790
12826
|
startPosition
|
|
@@ -13446,6 +13482,9 @@ const mediaPlayerProps = {
|
|
|
13446
13482
|
show: Boolean,
|
|
13447
13483
|
mediaType: makeStringProp("file"),
|
|
13448
13484
|
mediaUrl: makeStringProp(""),
|
|
13485
|
+
fileName: makeStringProp(""),
|
|
13486
|
+
showDownload: Boolean,
|
|
13487
|
+
downloadAction: Function,
|
|
13449
13488
|
/** 视频播放时的控件展示列表,参考:https://wicg.github.io/controls-list/explainer.html */
|
|
13450
13489
|
controlsList: makeArrayProp([]),
|
|
13451
13490
|
teleport: [String, Object]
|
|
@@ -13460,6 +13499,15 @@ var stdin_default$O = defineComponent({
|
|
|
13460
13499
|
}) {
|
|
13461
13500
|
const audioRef = ref();
|
|
13462
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
|
+
});
|
|
13463
13511
|
const getMediaElement = () => {
|
|
13464
13512
|
let player;
|
|
13465
13513
|
if (props.mediaType === "audio") {
|
|
@@ -13506,7 +13554,7 @@ var stdin_default$O = defineComponent({
|
|
|
13506
13554
|
"src": props.mediaUrl,
|
|
13507
13555
|
"ref": videoRef,
|
|
13508
13556
|
"controls": true,
|
|
13509
|
-
"controlslist": props.controlsList.join(" "),
|
|
13557
|
+
"controlslist": [.../* @__PURE__ */ new Set([...props.controlsList, "nodownload"])].join(" "),
|
|
13510
13558
|
"autoplay": true,
|
|
13511
13559
|
"id": "video",
|
|
13512
13560
|
"webkit-playsinline": true,
|
|
@@ -13542,7 +13590,16 @@ var stdin_default$O = defineComponent({
|
|
|
13542
13590
|
"type": "button",
|
|
13543
13591
|
"class": bem$x("cancel-btn"),
|
|
13544
13592
|
"onClick": onClose
|
|
13545
|
-
}, [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)])])]
|
|
13546
13603
|
});
|
|
13547
13604
|
}
|
|
13548
13605
|
});
|
|
@@ -16262,6 +16319,25 @@ _extends(Remove, {
|
|
|
16262
16319
|
});
|
|
16263
16320
|
Sortable.mount(new AutoScrollPlugin());
|
|
16264
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));
|
|
16265
16341
|
var __async$3 = (__this, __arguments, generator) => {
|
|
16266
16342
|
return new Promise((resolve, reject) => {
|
|
16267
16343
|
var fulfilled = (value) => {
|
|
@@ -16367,6 +16443,9 @@ var stdin_default$E = defineComponent({
|
|
|
16367
16443
|
emit,
|
|
16368
16444
|
slots
|
|
16369
16445
|
}) {
|
|
16446
|
+
const {
|
|
16447
|
+
downloadFile
|
|
16448
|
+
} = useMediaDownload(props);
|
|
16370
16449
|
const videoOptionsVisible = ref(false);
|
|
16371
16450
|
const audioOptionsVisible = ref(false);
|
|
16372
16451
|
const photoOptionsVisible = ref(false);
|
|
@@ -16374,6 +16453,8 @@ var stdin_default$E = defineComponent({
|
|
|
16374
16453
|
const mediaPlayerVisible = ref(false);
|
|
16375
16454
|
const mediaTypeToPlay = ref("file");
|
|
16376
16455
|
const mediaUrlToPlay = ref("");
|
|
16456
|
+
const mediaFileNameToPlay = ref("");
|
|
16457
|
+
const mediaIndexToPlay = ref(0);
|
|
16377
16458
|
const cameraInputRef = ref();
|
|
16378
16459
|
const imageInputRef = ref();
|
|
16379
16460
|
const camcorderInputRef = ref();
|
|
@@ -17059,7 +17140,6 @@ var stdin_default$E = defineComponent({
|
|
|
17059
17140
|
deleteMedia(media, index2);
|
|
17060
17141
|
});
|
|
17061
17142
|
const previewMedia = (index2) => __async$3(this, null, function* () {
|
|
17062
|
-
var _a;
|
|
17063
17143
|
if (props.preview && (yield props.preview(props.mediaList, index2))) {
|
|
17064
17144
|
return;
|
|
17065
17145
|
}
|
|
@@ -17068,7 +17148,9 @@ var stdin_default$E = defineComponent({
|
|
|
17068
17148
|
const imageIndex = imageList.value.indexOf(media);
|
|
17069
17149
|
showImagePreview({
|
|
17070
17150
|
images: imageList.value.map((image) => ({
|
|
17071
|
-
url: image.url || image.showSrc || ""
|
|
17151
|
+
url: image.url || image.showSrc || "",
|
|
17152
|
+
title: image.label,
|
|
17153
|
+
fileName: image.originalName || image.fileName
|
|
17072
17154
|
})),
|
|
17073
17155
|
showDownload: props.showDownload,
|
|
17074
17156
|
downloadAction: props.downloadAction,
|
|
@@ -17080,45 +17162,28 @@ var stdin_default$E = defineComponent({
|
|
|
17080
17162
|
showFailToast("文件参数缺失");
|
|
17081
17163
|
} else {
|
|
17082
17164
|
mediaTypeToPlay.value = media.type;
|
|
17165
|
+
mediaFileNameToPlay.value = media.originalName || media.fileName;
|
|
17166
|
+
mediaIndexToPlay.value = index2;
|
|
17083
17167
|
mediaUrlToPlay.value = media.url || (URL || webkitURL).createObjectURL(media.file);
|
|
17084
17168
|
mediaPlayerVisible.value = true;
|
|
17085
17169
|
}
|
|
17086
17170
|
} else if (media.type === "file") {
|
|
17087
|
-
|
|
17088
|
-
|
|
17089
|
-
|
|
17090
|
-
|
|
17091
|
-
|
|
17092
|
-
|
|
17093
|
-
|
|
17094
|
-
|
|
17095
|
-
|
|
17096
|
-
|
|
17097
|
-
|
|
17098
|
-
url: media.url
|
|
17099
|
-
}).then(({
|
|
17100
|
-
tempFilePath
|
|
17101
|
-
}) => {
|
|
17102
|
-
if (fileJsi && fileJsi.openDocument) {
|
|
17103
|
-
fileJsi.openDocument({
|
|
17104
|
-
localFilePath: tempFilePath
|
|
17105
|
-
}).finally(() => {
|
|
17106
|
-
closeToast();
|
|
17107
|
-
});
|
|
17108
|
-
} else {
|
|
17109
|
-
closeToast();
|
|
17110
|
-
}
|
|
17111
|
-
}).catch(() => {
|
|
17112
|
-
closeToast();
|
|
17113
|
-
showFailToast("下载失败");
|
|
17114
|
-
});
|
|
17115
|
-
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);
|
|
17116
17182
|
}
|
|
17117
17183
|
}
|
|
17118
|
-
}
|
|
17119
|
-
|
|
17184
|
+
} else {
|
|
17185
|
+
showFailToast("暂不支持此类文件的预览");
|
|
17120
17186
|
}
|
|
17121
|
-
showFailToast("暂不支持此类文件的预览");
|
|
17122
17187
|
}
|
|
17123
17188
|
});
|
|
17124
17189
|
const renderMediaListPlaceholder = () => {
|
|
@@ -17185,7 +17250,16 @@ var stdin_default$E = defineComponent({
|
|
|
17185
17250
|
"mediaType": mediaTypeToPlay.value,
|
|
17186
17251
|
"mediaUrl": mediaUrlToPlay.value,
|
|
17187
17252
|
"teleport": "body"
|
|
17188
|
-
}, 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, {
|
|
17189
17263
|
"show": actionVisible.value,
|
|
17190
17264
|
"onUpdate:show": ($event) => actionVisible.value = $event,
|
|
17191
17265
|
"actions": actionOptions.value,
|
|
@@ -24422,7 +24496,7 @@ const Lazyload = {
|
|
|
24422
24496
|
});
|
|
24423
24497
|
}
|
|
24424
24498
|
};
|
|
24425
|
-
const version = "3.1.
|
|
24499
|
+
const version = "3.1.94";
|
|
24426
24500
|
function install(app) {
|
|
24427
24501
|
const components = [
|
|
24428
24502
|
ActionSheet,
|