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.js
CHANGED
|
@@ -9332,7 +9332,6 @@ var __publicField = (obj, key, value) => {
|
|
|
9332
9332
|
const commonTypesListRef = vue.ref();
|
|
9333
9333
|
const showLeftCommonTypesMask = vue.ref(false);
|
|
9334
9334
|
const showRightCommonTypesMask = vue.ref(false);
|
|
9335
|
-
let commonTypesResizeObserver;
|
|
9336
9335
|
const defaultTreeNode = vue.ref(props.treeData);
|
|
9337
9336
|
const fields = vue.computed(() => assignDefaultFields$1(props.treeFieldName));
|
|
9338
9337
|
const visibleCommonTypeList = vue.computed(() => {
|
|
@@ -9347,35 +9346,25 @@ var __publicField = (obj, key, value) => {
|
|
|
9347
9346
|
children,
|
|
9348
9347
|
text: key
|
|
9349
9348
|
} = fields.value;
|
|
9349
|
+
const syncSelectCommonId = (node) => {
|
|
9350
|
+
const selectedId = node == null ? void 0 : node[value];
|
|
9351
|
+
selectCommonId.value = typeof selectedId === "string" || typeof selectedId === "number" ? selectedId : -1;
|
|
9352
|
+
};
|
|
9353
|
+
syncSelectCommonId(props.defaultSelectNode);
|
|
9354
|
+
vue.watch(() => props.defaultSelectNode, (node) => {
|
|
9355
|
+
selectNode.value = node;
|
|
9356
|
+
syncSelectCommonId(node);
|
|
9357
|
+
});
|
|
9350
9358
|
const updateCommonTypesMask = () => {
|
|
9351
9359
|
const list = commonTypesListRef.value;
|
|
9352
|
-
if (!list)
|
|
9353
|
-
showLeftCommonTypesMask.value = false;
|
|
9354
|
-
showRightCommonTypesMask.value = false;
|
|
9360
|
+
if (!list)
|
|
9355
9361
|
return;
|
|
9356
|
-
}
|
|
9357
|
-
const remainingScrollWidth = list.scrollWidth - list.clientWidth - list.scrollLeft;
|
|
9358
9362
|
showLeftCommonTypesMask.value = list.scrollLeft > 0;
|
|
9359
|
-
showRightCommonTypesMask.value =
|
|
9363
|
+
showRightCommonTypesMask.value = list.scrollLeft + list.clientWidth < list.scrollWidth;
|
|
9360
9364
|
};
|
|
9361
9365
|
const onCommonTypesScroll = () => {
|
|
9362
9366
|
updateCommonTypesMask();
|
|
9363
9367
|
};
|
|
9364
|
-
const observeCommonTypesList = () => {
|
|
9365
|
-
commonTypesResizeObserver == null ? void 0 : commonTypesResizeObserver.disconnect();
|
|
9366
|
-
const list = commonTypesListRef.value;
|
|
9367
|
-
if (!list || typeof ResizeObserver === "undefined") {
|
|
9368
|
-
return;
|
|
9369
|
-
}
|
|
9370
|
-
commonTypesResizeObserver = new ResizeObserver(updateCommonTypesMask);
|
|
9371
|
-
commonTypesResizeObserver.observe(list);
|
|
9372
|
-
};
|
|
9373
|
-
const updateCommonTypesLayout = () => {
|
|
9374
|
-
vue.nextTick(() => {
|
|
9375
|
-
observeCommonTypesList();
|
|
9376
|
-
updateCommonTypesMask();
|
|
9377
|
-
});
|
|
9378
|
-
};
|
|
9379
9368
|
const allData = {
|
|
9380
9369
|
[value]: -1,
|
|
9381
9370
|
[key]: "全部",
|
|
@@ -9452,13 +9441,7 @@ var __publicField = (obj, key, value) => {
|
|
|
9452
9441
|
};
|
|
9453
9442
|
flatData(props.treeData);
|
|
9454
9443
|
updateOffset();
|
|
9455
|
-
|
|
9456
|
-
});
|
|
9457
|
-
vue.watch(visibleCommonTypeList, updateCommonTypesLayout, {
|
|
9458
|
-
flush: "post"
|
|
9459
|
-
});
|
|
9460
|
-
vue.onBeforeUnmount(() => {
|
|
9461
|
-
commonTypesResizeObserver == null ? void 0 : commonTypesResizeObserver.disconnect();
|
|
9444
|
+
vue.nextTick(updateCommonTypesMask);
|
|
9462
9445
|
});
|
|
9463
9446
|
const isEmpty = (item) => !item[children] || item[children].length === 0;
|
|
9464
9447
|
const syncExpandNodeByParent = (item) => {
|
|
@@ -12701,15 +12684,25 @@ var __publicField = (obj, key, value) => {
|
|
|
12701
12684
|
};
|
|
12702
12685
|
}
|
|
12703
12686
|
});
|
|
12704
|
-
|
|
12705
|
-
|
|
12706
|
-
|
|
12707
|
-
|
|
12708
|
-
|
|
12709
|
-
|
|
12710
|
-
|
|
12711
|
-
|
|
12712
|
-
|
|
12687
|
+
var __defProp$2 = Object.defineProperty;
|
|
12688
|
+
var __defProps$1 = Object.defineProperties;
|
|
12689
|
+
var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors;
|
|
12690
|
+
var __getOwnPropSymbols$1 = Object.getOwnPropertySymbols;
|
|
12691
|
+
var __hasOwnProp$2 = Object.prototype.hasOwnProperty;
|
|
12692
|
+
var __propIsEnum$1 = Object.prototype.propertyIsEnumerable;
|
|
12693
|
+
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
12694
|
+
var __spreadValues$1 = (a2, b) => {
|
|
12695
|
+
for (var prop in b || (b = {}))
|
|
12696
|
+
if (__hasOwnProp$2.call(b, prop))
|
|
12697
|
+
__defNormalProp$1(a2, prop, b[prop]);
|
|
12698
|
+
if (__getOwnPropSymbols$1)
|
|
12699
|
+
for (var prop of __getOwnPropSymbols$1(b)) {
|
|
12700
|
+
if (__propIsEnum$1.call(b, prop))
|
|
12701
|
+
__defNormalProp$1(a2, prop, b[prop]);
|
|
12702
|
+
}
|
|
12703
|
+
return a2;
|
|
12704
|
+
};
|
|
12705
|
+
var __spreadProps$1 = (a2, b) => __defProps$1(a2, __getOwnPropDescs$1(b));
|
|
12713
12706
|
var __async$5 = (__this, __arguments, generator) => {
|
|
12714
12707
|
return new Promise((resolve, reject) => {
|
|
12715
12708
|
var fulfilled = (value) => {
|
|
@@ -12730,6 +12723,72 @@ var __publicField = (obj, key, value) => {
|
|
|
12730
12723
|
step((generator = generator.apply(__this, __arguments)).next());
|
|
12731
12724
|
});
|
|
12732
12725
|
};
|
|
12726
|
+
function useMediaDownload(props) {
|
|
12727
|
+
const downloading = vue.ref(false);
|
|
12728
|
+
const downloadInBrowser = (params) => {
|
|
12729
|
+
const link = document.createElement("a");
|
|
12730
|
+
link.href = params.url;
|
|
12731
|
+
link.download = params.fileName || "";
|
|
12732
|
+
document.body.appendChild(link);
|
|
12733
|
+
link.click();
|
|
12734
|
+
link.remove();
|
|
12735
|
+
};
|
|
12736
|
+
const download2 = (params, confirm = false) => __async$5(this, null, function* () {
|
|
12737
|
+
var _a, _b, _c;
|
|
12738
|
+
if (!props.showDownload || downloading.value || !params.url || params.url.startsWith("data:")) {
|
|
12739
|
+
return;
|
|
12740
|
+
}
|
|
12741
|
+
downloading.value = true;
|
|
12742
|
+
try {
|
|
12743
|
+
if (confirm) {
|
|
12744
|
+
try {
|
|
12745
|
+
yield showConfirmDialog({ message: "附件格式暂不支持预览,是否下载原文件" });
|
|
12746
|
+
} catch (action) {
|
|
12747
|
+
if (action !== "cancel") {
|
|
12748
|
+
throw action;
|
|
12749
|
+
}
|
|
12750
|
+
return;
|
|
12751
|
+
}
|
|
12752
|
+
}
|
|
12753
|
+
if (!props.showDownload || ((_a = props.downloadAction) == null ? void 0 : _a.call(props, params))) {
|
|
12754
|
+
return;
|
|
12755
|
+
}
|
|
12756
|
+
let file;
|
|
12757
|
+
try {
|
|
12758
|
+
const sdk = yield Promise.resolve().then(() => index);
|
|
12759
|
+
file = (_b = sdk.getJSI()) == null ? void 0 : _b.file;
|
|
12760
|
+
} catch (e) {
|
|
12761
|
+
downloadInBrowser(params);
|
|
12762
|
+
return;
|
|
12763
|
+
}
|
|
12764
|
+
if (!(file == null ? void 0 : file.download)) {
|
|
12765
|
+
downloadInBrowser(params);
|
|
12766
|
+
return;
|
|
12767
|
+
}
|
|
12768
|
+
showLoadingToast({ message: "下载中...", forbidClick: true, duration: 0 });
|
|
12769
|
+
try {
|
|
12770
|
+
const result = yield file.download({ url: params.url });
|
|
12771
|
+
const displayPath = (_c = result == null ? void 0 : result.tempFilePath) == null ? void 0 : _c.replace(/^\/storage\/emulated\/0\//, "");
|
|
12772
|
+
closeToast();
|
|
12773
|
+
showSuccessToast({
|
|
12774
|
+
message: displayPath ? `下载成功
|
|
12775
|
+
保存路径:${displayPath}` : "下载成功",
|
|
12776
|
+
duration: 5e3
|
|
12777
|
+
});
|
|
12778
|
+
} catch (e) {
|
|
12779
|
+
closeToast();
|
|
12780
|
+
showFailToast("下载失败");
|
|
12781
|
+
}
|
|
12782
|
+
} finally {
|
|
12783
|
+
downloading.value = false;
|
|
12784
|
+
}
|
|
12785
|
+
});
|
|
12786
|
+
const downloadFile = (options) => {
|
|
12787
|
+
var _a;
|
|
12788
|
+
return download2(__spreadProps$1(__spreadValues$1({}, options), { index: (_a = options.index) != null ? _a : -1 }), true);
|
|
12789
|
+
};
|
|
12790
|
+
return { downloading, download: download2, downloadFile };
|
|
12791
|
+
}
|
|
12733
12792
|
const [name$C, bem$B] = createNamespace("image-preview");
|
|
12734
12793
|
const popupProps$1 = ["show", "transition", "overlayStyle", "closeOnPopstate", "teleport"];
|
|
12735
12794
|
const imagePreviewProps = {
|
|
@@ -12766,8 +12825,13 @@ var __publicField = (obj, key, value) => {
|
|
|
12766
12825
|
slots
|
|
12767
12826
|
}) {
|
|
12768
12827
|
const swipeRef = vue.ref();
|
|
12828
|
+
const {
|
|
12829
|
+
downloading,
|
|
12830
|
+
download: download2,
|
|
12831
|
+
downloadFile
|
|
12832
|
+
} = useMediaDownload(props);
|
|
12769
12833
|
const state = vue.reactive({
|
|
12770
|
-
active:
|
|
12834
|
+
active: +props.startPosition,
|
|
12771
12835
|
rootWidth: 0,
|
|
12772
12836
|
rootHeight: 0,
|
|
12773
12837
|
disableZoom: false
|
|
@@ -12805,71 +12869,38 @@ var __publicField = (obj, key, value) => {
|
|
|
12805
12869
|
}, [props.images[state.active].title]);
|
|
12806
12870
|
}
|
|
12807
12871
|
};
|
|
12808
|
-
const onDownload = () =>
|
|
12872
|
+
const onDownload = () => {
|
|
12809
12873
|
var _a, _b, _c;
|
|
12810
|
-
|
|
12874
|
+
return download2({
|
|
12811
12875
|
index: state.active,
|
|
12812
12876
|
url: (_a = props.images[state.active]) == null ? void 0 : _a.url,
|
|
12813
|
-
title: (_b = props.images[state.active]) == null ? void 0 : _b.title
|
|
12814
|
-
|
|
12815
|
-
|
|
12816
|
-
|
|
12817
|
-
|
|
12818
|
-
|
|
12819
|
-
|
|
12820
|
-
|
|
12821
|
-
|
|
12822
|
-
|
|
12823
|
-
|
|
12824
|
-
|
|
12825
|
-
|
|
12826
|
-
|
|
12827
|
-
message: "下载中...",
|
|
12828
|
-
forbidClick: true,
|
|
12829
|
-
duration: 0
|
|
12830
|
-
});
|
|
12831
|
-
fileJsi.download({
|
|
12832
|
-
url: downloadParams.url
|
|
12833
|
-
}).then(({
|
|
12834
|
-
tempFilePath
|
|
12835
|
-
}) => {
|
|
12836
|
-
closeToast();
|
|
12837
|
-
showSuccessToast("下载成功");
|
|
12838
|
-
}).catch(() => {
|
|
12839
|
-
closeToast();
|
|
12840
|
-
showFailToast("下载失败");
|
|
12841
|
-
});
|
|
12842
|
-
return;
|
|
12843
|
-
} else {
|
|
12844
|
-
showFailToast("当前环境暂不支持下载");
|
|
12845
|
-
}
|
|
12846
|
-
}
|
|
12847
|
-
} catch (e) {
|
|
12848
|
-
console.log(e.message);
|
|
12849
|
-
}
|
|
12850
|
-
});
|
|
12877
|
+
title: (_b = props.images[state.active]) == null ? void 0 : _b.title,
|
|
12878
|
+
fileName: (_c = props.images[state.active]) == null ? void 0 : _c.fileName
|
|
12879
|
+
});
|
|
12880
|
+
};
|
|
12881
|
+
const renderDownloadIcon = () => vue.createVNode("button", {
|
|
12882
|
+
"type": "button",
|
|
12883
|
+
"class": bem$B("download-icon"),
|
|
12884
|
+
"aria-label": "下载原图",
|
|
12885
|
+
"disabled": downloading.value,
|
|
12886
|
+
"onClick": onDownload
|
|
12887
|
+
}, [vue.createVNode(Icon, {
|
|
12888
|
+
"name": "download",
|
|
12889
|
+
"size": "24"
|
|
12890
|
+
}, null)]);
|
|
12851
12891
|
const renderIndex = () => {
|
|
12852
12892
|
const image2 = props.images[state.active];
|
|
12853
|
-
const showDownload = props.showDownload && !image2.url.startsWith("data:");
|
|
12893
|
+
const showDownload = props.showDownload && (image2 == null ? void 0 : image2.url) && !image2.url.startsWith("data:");
|
|
12854
12894
|
if (props.showIndex || showDownload) {
|
|
12855
|
-
if (props.showIndex && slots.index) {
|
|
12856
|
-
return vue.createVNode("div", {
|
|
12857
|
-
"class": bem$B("index")
|
|
12858
|
-
}, [slots.index({
|
|
12859
|
-
index: state.active
|
|
12860
|
-
})]);
|
|
12861
|
-
}
|
|
12862
12895
|
return vue.createVNode("div", {
|
|
12863
12896
|
"class": bem$B("index")
|
|
12864
|
-
}, [props.showIndex &&
|
|
12897
|
+
}, [props.showIndex && vue.createVNode("div", {
|
|
12898
|
+
"class": bem$B("index-content")
|
|
12899
|
+
}, [slots.index ? slots.index({
|
|
12900
|
+
index: state.active
|
|
12901
|
+
}) : [renderIndexText(), renderImageTitle()]]), showDownload && renderDownloadIcon()]);
|
|
12865
12902
|
}
|
|
12866
12903
|
};
|
|
12867
|
-
const renderDownloadIcon = () => {
|
|
12868
|
-
return vue.createVNode("div", {
|
|
12869
|
-
"class": bem$B("download-icon"),
|
|
12870
|
-
"onClick": onDownload
|
|
12871
|
-
}, [Download(bem$B)]);
|
|
12872
|
-
};
|
|
12873
12904
|
const renderCover = () => {
|
|
12874
12905
|
if (slots.cover) {
|
|
12875
12906
|
return vue.createVNode("div", {
|
|
@@ -12931,7 +12962,8 @@ var __publicField = (obj, key, value) => {
|
|
|
12931
12962
|
return (_a = swipeRef.value) == null ? void 0 : _a.swipeTo(index2, options);
|
|
12932
12963
|
};
|
|
12933
12964
|
useExpose({
|
|
12934
|
-
swipeTo
|
|
12965
|
+
swipeTo,
|
|
12966
|
+
downloadFile
|
|
12935
12967
|
});
|
|
12936
12968
|
vue.onMounted(() => {
|
|
12937
12969
|
resize2();
|
|
@@ -12961,6 +12993,7 @@ var __publicField = (obj, key, value) => {
|
|
|
12961
12993
|
return () => vue.createVNode(Popup, vue.mergeProps({
|
|
12962
12994
|
"class": [bem$B(), props.className],
|
|
12963
12995
|
"overlayClass": [bem$B("overlay"), props.overlayClass],
|
|
12996
|
+
"onClick": (event) => event.stopPropagation(),
|
|
12964
12997
|
"onClosed": onClosed,
|
|
12965
12998
|
"onUpdate:show": updateShow
|
|
12966
12999
|
}, pick(props, popupProps$1)), {
|
|
@@ -12981,6 +13014,8 @@ var __publicField = (obj, key, value) => {
|
|
|
12981
13014
|
className: "",
|
|
12982
13015
|
showIndex: true,
|
|
12983
13016
|
closeable: false,
|
|
13017
|
+
showDownload: false,
|
|
13018
|
+
downloadAction: void 0,
|
|
12984
13019
|
closeIcon: "clear",
|
|
12985
13020
|
transition: void 0,
|
|
12986
13021
|
beforeClose: void 0,
|
|
@@ -13029,7 +13064,8 @@ var __publicField = (obj, key, value) => {
|
|
|
13029
13064
|
}
|
|
13030
13065
|
return {
|
|
13031
13066
|
url: opt.url,
|
|
13032
|
-
title: opt.title || ""
|
|
13067
|
+
title: opt.title || "",
|
|
13068
|
+
fileName: opt.fileName
|
|
13033
13069
|
};
|
|
13034
13070
|
}),
|
|
13035
13071
|
startPosition
|
|
@@ -17050,6 +17086,9 @@ var __publicField = (obj, key, value) => {
|
|
|
17050
17086
|
show: Boolean,
|
|
17051
17087
|
mediaType: makeStringProp("file"),
|
|
17052
17088
|
mediaUrl: makeStringProp(""),
|
|
17089
|
+
fileName: makeStringProp(""),
|
|
17090
|
+
showDownload: Boolean,
|
|
17091
|
+
downloadAction: Function,
|
|
17053
17092
|
/** 视频播放时的控件展示列表,参考:https://wicg.github.io/controls-list/explainer.html */
|
|
17054
17093
|
controlsList: makeArrayProp([]),
|
|
17055
17094
|
teleport: [String, Object]
|
|
@@ -17064,6 +17103,15 @@ var __publicField = (obj, key, value) => {
|
|
|
17064
17103
|
}) {
|
|
17065
17104
|
const audioRef = vue.ref();
|
|
17066
17105
|
const videoRef = vue.ref();
|
|
17106
|
+
const {
|
|
17107
|
+
downloading,
|
|
17108
|
+
download: download2
|
|
17109
|
+
} = useMediaDownload(props);
|
|
17110
|
+
const onDownload = () => download2({
|
|
17111
|
+
index: 0,
|
|
17112
|
+
url: props.mediaUrl,
|
|
17113
|
+
fileName: props.fileName
|
|
17114
|
+
});
|
|
17067
17115
|
const getMediaElement = () => {
|
|
17068
17116
|
let player;
|
|
17069
17117
|
if (props.mediaType === "audio") {
|
|
@@ -17110,7 +17158,7 @@ var __publicField = (obj, key, value) => {
|
|
|
17110
17158
|
"src": props.mediaUrl,
|
|
17111
17159
|
"ref": videoRef,
|
|
17112
17160
|
"controls": true,
|
|
17113
|
-
"controlslist": props.controlsList.join(" "),
|
|
17161
|
+
"controlslist": [.../* @__PURE__ */ new Set([...props.controlsList, "nodownload"])].join(" "),
|
|
17114
17162
|
"autoplay": true,
|
|
17115
17163
|
"id": "video",
|
|
17116
17164
|
"webkit-playsinline": true,
|
|
@@ -17146,7 +17194,16 @@ var __publicField = (obj, key, value) => {
|
|
|
17146
17194
|
"type": "button",
|
|
17147
17195
|
"class": bem$x("cancel-btn"),
|
|
17148
17196
|
"onClick": onClose
|
|
17149
|
-
}, [vue.createTextVNode("关闭")])
|
|
17197
|
+
}, [vue.createTextVNode("关闭")]), props.showDownload && props.mediaType === "video" && props.mediaUrl && !props.mediaUrl.startsWith("data:") && vue.createVNode("button", {
|
|
17198
|
+
"type": "button",
|
|
17199
|
+
"class": bem$x("download-btn"),
|
|
17200
|
+
"aria-label": "下载视频",
|
|
17201
|
+
"disabled": downloading.value,
|
|
17202
|
+
"onClick": onDownload
|
|
17203
|
+
}, [vue.createVNode(stdin_default$1$, {
|
|
17204
|
+
"name": "download",
|
|
17205
|
+
"size": "24"
|
|
17206
|
+
}, null)])])]
|
|
17150
17207
|
});
|
|
17151
17208
|
}
|
|
17152
17209
|
});
|
|
@@ -17604,19 +17661,19 @@ var __publicField = (obj, key, value) => {
|
|
|
17604
17661
|
});
|
|
17605
17662
|
}
|
|
17606
17663
|
var __create = Object.create;
|
|
17607
|
-
var
|
|
17664
|
+
var __defProp$1 = Object.defineProperty;
|
|
17608
17665
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
17609
17666
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
17610
17667
|
var __getProtoOf = Object.getPrototypeOf;
|
|
17611
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
17668
|
+
var __hasOwnProp$1 = Object.prototype.hasOwnProperty;
|
|
17612
17669
|
var __commonJS = (cb, mod) => function __require() {
|
|
17613
17670
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
17614
17671
|
};
|
|
17615
17672
|
var __copyProps = (to, from, except, desc) => {
|
|
17616
17673
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
17617
17674
|
for (let key of __getOwnPropNames(from))
|
|
17618
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
17619
|
-
|
|
17675
|
+
if (!__hasOwnProp$1.call(to, key) && key !== except)
|
|
17676
|
+
__defProp$1(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17620
17677
|
}
|
|
17621
17678
|
return to;
|
|
17622
17679
|
};
|
|
@@ -17625,7 +17682,7 @@ var __publicField = (obj, key, value) => {
|
|
|
17625
17682
|
// file that has been converted to a CommonJS file using a Babel-
|
|
17626
17683
|
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
17627
17684
|
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
17628
|
-
isNodeMode || !mod || !mod.__esModule ?
|
|
17685
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp$1(target, "default", { value: mod, enumerable: true }) : target,
|
|
17629
17686
|
mod
|
|
17630
17687
|
));
|
|
17631
17688
|
var __async$4 = (__this, __arguments, generator) => {
|
|
@@ -21493,6 +21550,25 @@ var __publicField = (obj, key, value) => {
|
|
|
21493
21550
|
});
|
|
21494
21551
|
Sortable.mount(new AutoScrollPlugin());
|
|
21495
21552
|
Sortable.mount(Remove, Revert);
|
|
21553
|
+
var __defProp2 = Object.defineProperty;
|
|
21554
|
+
var __defProps = Object.defineProperties;
|
|
21555
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
21556
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
21557
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
21558
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
21559
|
+
var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
21560
|
+
var __spreadValues = (a2, b) => {
|
|
21561
|
+
for (var prop in b || (b = {}))
|
|
21562
|
+
if (__hasOwnProp.call(b, prop))
|
|
21563
|
+
__defNormalProp2(a2, prop, b[prop]);
|
|
21564
|
+
if (__getOwnPropSymbols)
|
|
21565
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
21566
|
+
if (__propIsEnum.call(b, prop))
|
|
21567
|
+
__defNormalProp2(a2, prop, b[prop]);
|
|
21568
|
+
}
|
|
21569
|
+
return a2;
|
|
21570
|
+
};
|
|
21571
|
+
var __spreadProps = (a2, b) => __defProps(a2, __getOwnPropDescs(b));
|
|
21496
21572
|
var __async$3 = (__this, __arguments, generator) => {
|
|
21497
21573
|
return new Promise((resolve, reject) => {
|
|
21498
21574
|
var fulfilled = (value) => {
|
|
@@ -21598,6 +21674,9 @@ var __publicField = (obj, key, value) => {
|
|
|
21598
21674
|
emit,
|
|
21599
21675
|
slots
|
|
21600
21676
|
}) {
|
|
21677
|
+
const {
|
|
21678
|
+
downloadFile
|
|
21679
|
+
} = useMediaDownload(props);
|
|
21601
21680
|
const videoOptionsVisible = vue.ref(false);
|
|
21602
21681
|
const audioOptionsVisible = vue.ref(false);
|
|
21603
21682
|
const photoOptionsVisible = vue.ref(false);
|
|
@@ -21605,6 +21684,8 @@ var __publicField = (obj, key, value) => {
|
|
|
21605
21684
|
const mediaPlayerVisible = vue.ref(false);
|
|
21606
21685
|
const mediaTypeToPlay = vue.ref("file");
|
|
21607
21686
|
const mediaUrlToPlay = vue.ref("");
|
|
21687
|
+
const mediaFileNameToPlay = vue.ref("");
|
|
21688
|
+
const mediaIndexToPlay = vue.ref(0);
|
|
21608
21689
|
const cameraInputRef = vue.ref();
|
|
21609
21690
|
const imageInputRef = vue.ref();
|
|
21610
21691
|
const camcorderInputRef = vue.ref();
|
|
@@ -22289,17 +22370,18 @@ var __publicField = (obj, key, value) => {
|
|
|
22289
22370
|
}
|
|
22290
22371
|
deleteMedia(media, index2);
|
|
22291
22372
|
});
|
|
22292
|
-
const previewMedia = (
|
|
22293
|
-
|
|
22294
|
-
if (props.preview && (yield props.preview(props.mediaList, index$12))) {
|
|
22373
|
+
const previewMedia = (index2) => __async$3(this, null, function* () {
|
|
22374
|
+
if (props.preview && (yield props.preview(props.mediaList, index2))) {
|
|
22295
22375
|
return;
|
|
22296
22376
|
}
|
|
22297
|
-
const media = props.mediaList[
|
|
22377
|
+
const media = props.mediaList[index2];
|
|
22298
22378
|
if (media.type === "photo") {
|
|
22299
22379
|
const imageIndex = imageList.value.indexOf(media);
|
|
22300
22380
|
showImagePreview({
|
|
22301
22381
|
images: imageList.value.map((image2) => ({
|
|
22302
|
-
url: image2.url || image2.showSrc || ""
|
|
22382
|
+
url: image2.url || image2.showSrc || "",
|
|
22383
|
+
title: image2.label,
|
|
22384
|
+
fileName: image2.originalName || image2.fileName
|
|
22303
22385
|
})),
|
|
22304
22386
|
showDownload: props.showDownload,
|
|
22305
22387
|
downloadAction: props.downloadAction,
|
|
@@ -22311,45 +22393,28 @@ var __publicField = (obj, key, value) => {
|
|
|
22311
22393
|
showFailToast("文件参数缺失");
|
|
22312
22394
|
} else {
|
|
22313
22395
|
mediaTypeToPlay.value = media.type;
|
|
22396
|
+
mediaFileNameToPlay.value = media.originalName || media.fileName;
|
|
22397
|
+
mediaIndexToPlay.value = index2;
|
|
22314
22398
|
mediaUrlToPlay.value = media.url || (URL || webkitURL).createObjectURL(media.file);
|
|
22315
22399
|
mediaPlayerVisible.value = true;
|
|
22316
22400
|
}
|
|
22317
22401
|
} else if (media.type === "file") {
|
|
22318
|
-
|
|
22319
|
-
|
|
22320
|
-
|
|
22321
|
-
|
|
22322
|
-
|
|
22323
|
-
|
|
22324
|
-
|
|
22325
|
-
|
|
22326
|
-
|
|
22327
|
-
|
|
22328
|
-
|
|
22329
|
-
url: media.url
|
|
22330
|
-
}).then(({
|
|
22331
|
-
tempFilePath
|
|
22332
|
-
}) => {
|
|
22333
|
-
if (fileJsi && fileJsi.openDocument) {
|
|
22334
|
-
fileJsi.openDocument({
|
|
22335
|
-
localFilePath: tempFilePath
|
|
22336
|
-
}).finally(() => {
|
|
22337
|
-
closeToast();
|
|
22338
|
-
});
|
|
22339
|
-
} else {
|
|
22340
|
-
closeToast();
|
|
22341
|
-
}
|
|
22342
|
-
}).catch(() => {
|
|
22343
|
-
closeToast();
|
|
22344
|
-
showFailToast("下载失败");
|
|
22345
|
-
});
|
|
22346
|
-
return;
|
|
22402
|
+
if (props.showDownload) {
|
|
22403
|
+
const url = media.url || (media.file ? URL.createObjectURL(media.file) : "");
|
|
22404
|
+
try {
|
|
22405
|
+
yield downloadFile({
|
|
22406
|
+
url,
|
|
22407
|
+
fileName: media.originalName || media.fileName,
|
|
22408
|
+
index: index2
|
|
22409
|
+
});
|
|
22410
|
+
} finally {
|
|
22411
|
+
if (!media.url && url) {
|
|
22412
|
+
URL.revokeObjectURL(url);
|
|
22347
22413
|
}
|
|
22348
22414
|
}
|
|
22349
|
-
}
|
|
22350
|
-
|
|
22415
|
+
} else {
|
|
22416
|
+
showFailToast("暂不支持此类文件的预览");
|
|
22351
22417
|
}
|
|
22352
|
-
showFailToast("暂不支持此类文件的预览");
|
|
22353
22418
|
}
|
|
22354
22419
|
});
|
|
22355
22420
|
const renderMediaListPlaceholder = () => {
|
|
@@ -22416,7 +22481,16 @@ var __publicField = (obj, key, value) => {
|
|
|
22416
22481
|
"mediaType": mediaTypeToPlay.value,
|
|
22417
22482
|
"mediaUrl": mediaUrlToPlay.value,
|
|
22418
22483
|
"teleport": "body"
|
|
22419
|
-
}, props.mediaPlayerProps
|
|
22484
|
+
}, props.mediaPlayerProps, {
|
|
22485
|
+
"showDownload": props.showDownload,
|
|
22486
|
+
"fileName": mediaFileNameToPlay.value,
|
|
22487
|
+
"downloadAction": (params) => {
|
|
22488
|
+
var _a, _b, _c;
|
|
22489
|
+
return (_c = (_b = props.downloadAction || ((_a = props.mediaPlayerProps) == null ? void 0 : _a.downloadAction)) == null ? void 0 : _b(__spreadProps(__spreadValues({}, params), {
|
|
22490
|
+
index: mediaIndexToPlay.value
|
|
22491
|
+
}))) != null ? _c : false;
|
|
22492
|
+
}
|
|
22493
|
+
}), null), vue.createVNode(stdin_default$1U, {
|
|
22420
22494
|
"show": actionVisible.value,
|
|
22421
22495
|
"onUpdate:show": ($event) => actionVisible.value = $event,
|
|
22422
22496
|
"actions": actionOptions.value,
|
|
@@ -31937,7 +32011,7 @@ var __publicField = (obj, key, value) => {
|
|
|
31937
32011
|
});
|
|
31938
32012
|
}
|
|
31939
32013
|
};
|
|
31940
|
-
const version = "3.1.
|
|
32014
|
+
const version = "3.1.94";
|
|
31941
32015
|
function install(app) {
|
|
31942
32016
|
const components = [
|
|
31943
32017
|
ActionSheet,
|