zartui 3.1.71 → 3.1.73
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/image-preview/ImagePreview.d.ts +14 -1
- package/es/image-preview/ImagePreview.mjs +94 -5
- package/es/image-preview/index.css +1 -1
- package/es/image-preview/index.d.ts +7 -1
- package/es/image-preview/style/index.mjs +1 -0
- package/es/image-preview/svg/Download.d.ts +2 -0
- package/es/image-preview/svg/Download.mjs +13 -0
- package/es/image-preview/types.d.ts +1 -0
- package/es/index.d.ts +1 -1
- package/es/index.mjs +1 -1
- package/es/media-picker/MediaPicker.d.ts +4 -0
- package/es/media-picker/MediaPicker.mjs +2 -0
- package/es/media-picker/index.d.ts +3 -0
- package/es/picker/Picker.d.ts +3 -0
- package/es/picker/Picker.mjs +5 -2
- package/es/picker/index.d.ts +2 -0
- package/es/uploader/style/index.mjs +1 -0
- package/lib/image-preview/ImagePreview.d.ts +14 -1
- package/lib/image-preview/ImagePreview.js +94 -5
- package/lib/image-preview/index.css +1 -1
- package/lib/image-preview/index.d.ts +7 -1
- package/lib/image-preview/style/index.js +1 -0
- package/lib/image-preview/svg/Download.d.ts +2 -0
- package/lib/image-preview/svg/Download.js +32 -0
- package/lib/image-preview/types.d.ts +1 -0
- package/lib/{index-8bc782d2.mjs → index-096e2873.mjs} +4220 -2916
- package/lib/{index-d66aaef4.js → index-bb5638a0.js} +4219 -2916
- 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 +4 -0
- package/lib/media-picker/MediaPicker.js +2 -0
- package/lib/media-picker/index.d.ts +3 -0
- package/lib/picker/Picker.d.ts +3 -0
- package/lib/picker/Picker.js +5 -2
- package/lib/picker/index.d.ts +2 -0
- package/lib/uploader/style/index.js +1 -0
- package/lib/web-types.json +1 -1
- package/lib/zartui.cjs.js +110 -9
- package/lib/zartui.es.js +110 -9
- package/lib/zartui.js +4302 -2895
- package/lib/zartui.min.js +2 -2
- package/package.json +8 -8
package/lib/zartui.cjs.js
CHANGED
|
@@ -6732,6 +6732,7 @@ const pickerProps = extend$1({}, pickerSharedProps$1, {
|
|
|
6732
6732
|
columnsFieldNames: Object,
|
|
6733
6733
|
showPicker: Boolean,
|
|
6734
6734
|
popup: truthProp,
|
|
6735
|
+
teleport: [String, Object],
|
|
6735
6736
|
showType: makeStringProp("default"),
|
|
6736
6737
|
columnCounts: makeNumberProp(3)
|
|
6737
6738
|
});
|
|
@@ -6974,7 +6975,8 @@ var stdin_default$1i = vue.defineComponent({
|
|
|
6974
6975
|
"show": showPicker.value,
|
|
6975
6976
|
"onUpdate:show": [($event) => showPicker.value = $event, updateShow],
|
|
6976
6977
|
"round": true,
|
|
6977
|
-
"position": "bottom"
|
|
6978
|
+
"position": "bottom",
|
|
6979
|
+
"teleport": props.teleport
|
|
6978
6980
|
}, {
|
|
6979
6981
|
default: renderTiledPicker
|
|
6980
6982
|
});
|
|
@@ -6986,7 +6988,8 @@ var stdin_default$1i = vue.defineComponent({
|
|
|
6986
6988
|
"show": showPicker.value,
|
|
6987
6989
|
"onUpdate:show": [($event) => showPicker.value = $event, updateShow],
|
|
6988
6990
|
"round": true,
|
|
6989
|
-
"position": "bottom"
|
|
6991
|
+
"position": "bottom",
|
|
6992
|
+
"teleport": props.teleport
|
|
6990
6993
|
}, {
|
|
6991
6994
|
default: renderPicker
|
|
6992
6995
|
});
|
|
@@ -12244,6 +12247,35 @@ var stdin_default$S = vue.defineComponent({
|
|
|
12244
12247
|
};
|
|
12245
12248
|
}
|
|
12246
12249
|
});
|
|
12250
|
+
const Download = (bem2) => vue.createVNode("svg", {
|
|
12251
|
+
"class": bem2("svg-download-icon"),
|
|
12252
|
+
"xmlns": "http://www.w3.org/2000/svg",
|
|
12253
|
+
"viewBox": "0 0 20 20"
|
|
12254
|
+
}, [vue.createVNode("path", {
|
|
12255
|
+
"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",
|
|
12256
|
+
"fill": "#FFF",
|
|
12257
|
+
"fill-rule": "nonzero"
|
|
12258
|
+
}, null)]);
|
|
12259
|
+
var __async$3 = (__this, __arguments, generator) => {
|
|
12260
|
+
return new Promise((resolve, reject) => {
|
|
12261
|
+
var fulfilled = (value) => {
|
|
12262
|
+
try {
|
|
12263
|
+
step(generator.next(value));
|
|
12264
|
+
} catch (e) {
|
|
12265
|
+
reject(e);
|
|
12266
|
+
}
|
|
12267
|
+
};
|
|
12268
|
+
var rejected = (value) => {
|
|
12269
|
+
try {
|
|
12270
|
+
step(generator.throw(value));
|
|
12271
|
+
} catch (e) {
|
|
12272
|
+
reject(e);
|
|
12273
|
+
}
|
|
12274
|
+
};
|
|
12275
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
12276
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
12277
|
+
});
|
|
12278
|
+
};
|
|
12247
12279
|
const [name$A, bem$z] = createNamespace("image-preview");
|
|
12248
12280
|
const popupProps$1 = ["show", "transition", "overlayStyle", "closeOnPopstate", "teleport"];
|
|
12249
12281
|
const imagePreviewProps = {
|
|
@@ -12255,6 +12287,8 @@ const imagePreviewProps = {
|
|
|
12255
12287
|
overlay: truthProp,
|
|
12256
12288
|
closeable: Boolean,
|
|
12257
12289
|
showIndex: truthProp,
|
|
12290
|
+
showDownload: Boolean,
|
|
12291
|
+
downloadAction: Function,
|
|
12258
12292
|
className: unknownProp,
|
|
12259
12293
|
closeIcon: makeStringProp("clear"),
|
|
12260
12294
|
transition: String,
|
|
@@ -12272,12 +12306,13 @@ const imagePreviewProps = {
|
|
|
12272
12306
|
var stdin_default$R = vue.defineComponent({
|
|
12273
12307
|
name: name$A,
|
|
12274
12308
|
props: imagePreviewProps,
|
|
12275
|
-
emits: ["scale", "close", "closed", "change", "longPress", "update:show"],
|
|
12309
|
+
emits: ["scale", "close", "closed", "change", "longPress", "update:show", "download"],
|
|
12276
12310
|
setup(props, {
|
|
12277
12311
|
emit,
|
|
12278
12312
|
slots
|
|
12279
12313
|
}) {
|
|
12280
12314
|
const swipeRef = vue.ref();
|
|
12315
|
+
const hasDownloadSupport = vue.ref(false);
|
|
12281
12316
|
const state = vue.reactive({
|
|
12282
12317
|
active: 0,
|
|
12283
12318
|
rootWidth: 0,
|
|
@@ -12317,9 +12352,54 @@ var stdin_default$R = vue.defineComponent({
|
|
|
12317
12352
|
}, [props.images[state.active].title]);
|
|
12318
12353
|
}
|
|
12319
12354
|
};
|
|
12355
|
+
const onDownload = () => __async$3(this, null, function* () {
|
|
12356
|
+
var _a, _b, _c;
|
|
12357
|
+
const downloadParams = {
|
|
12358
|
+
index: state.active,
|
|
12359
|
+
url: (_a = props.images[state.active]) == null ? void 0 : _a.url,
|
|
12360
|
+
title: (_b = props.images[state.active]) == null ? void 0 : _b.title
|
|
12361
|
+
};
|
|
12362
|
+
if (props.downloadAction) {
|
|
12363
|
+
const result = props.downloadAction(downloadParams);
|
|
12364
|
+
if (result) {
|
|
12365
|
+
return;
|
|
12366
|
+
}
|
|
12367
|
+
}
|
|
12368
|
+
try {
|
|
12369
|
+
let universalJsSdk = yield Promise.resolve().then(() => require("./index-bb5638a0.js"));
|
|
12370
|
+
if (universalJsSdk && universalJsSdk.getJSI && downloadParams.url) {
|
|
12371
|
+
let fileJsi = (_c = universalJsSdk.getJSI()) == null ? void 0 : _c.file;
|
|
12372
|
+
if (fileJsi && fileJsi.download) {
|
|
12373
|
+
showLoadingToast({
|
|
12374
|
+
message: "下载中...",
|
|
12375
|
+
forbidClick: true,
|
|
12376
|
+
duration: 0
|
|
12377
|
+
});
|
|
12378
|
+
fileJsi.download({
|
|
12379
|
+
url: downloadParams.url
|
|
12380
|
+
}).then(({
|
|
12381
|
+
tempFilePath
|
|
12382
|
+
}) => {
|
|
12383
|
+
closeToast();
|
|
12384
|
+
showSuccessToast("下载成功");
|
|
12385
|
+
}).catch(() => {
|
|
12386
|
+
closeToast();
|
|
12387
|
+
showFailToast("下载失败");
|
|
12388
|
+
});
|
|
12389
|
+
return;
|
|
12390
|
+
} else {
|
|
12391
|
+
showFailToast("当前环境暂不支持下载");
|
|
12392
|
+
}
|
|
12393
|
+
}
|
|
12394
|
+
} catch (e) {
|
|
12395
|
+
console.log(e.message);
|
|
12396
|
+
}
|
|
12397
|
+
});
|
|
12320
12398
|
const renderIndex = () => {
|
|
12321
|
-
|
|
12322
|
-
|
|
12399
|
+
const image = props.images[state.active];
|
|
12400
|
+
const showDownload = props.showDownload && hasDownloadSupport.value && !image.url.startsWith("data:");
|
|
12401
|
+
if (props.showIndex || showDownload) {
|
|
12402
|
+
if (props.showIndex && slots.index) {
|
|
12323
12403
|
return vue.createVNode("div", {
|
|
12324
12404
|
"class": bem$z("index")
|
|
12325
12405
|
}, [slots.index({
|
|
@@ -12328,9 +12408,15 @@ var stdin_default$R = vue.defineComponent({
|
|
|
12328
12408
|
}
|
|
12329
12409
|
return vue.createVNode("div", {
|
|
12330
12410
|
"class": bem$z("index")
|
|
12331
|
-
}, [renderIndexText(), renderImageTitle()]);
|
|
12411
|
+
}, [props.showIndex && renderIndexText(), props.showIndex && renderImageTitle(), showDownload && renderDownloadIcon()]);
|
|
12332
12412
|
}
|
|
12333
12413
|
};
|
|
12414
|
+
const renderDownloadIcon = () => {
|
|
12415
|
+
return vue.createVNode("div", {
|
|
12416
|
+
"class": bem$z("download-icon"),
|
|
12417
|
+
"onClick": onDownload
|
|
12418
|
+
}, [Download(bem$z)]);
|
|
12419
|
+
};
|
|
12334
12420
|
const renderCover = () => {
|
|
12335
12421
|
if (slots.cover) {
|
|
12336
12422
|
return vue.createVNode("div", {
|
|
@@ -12394,7 +12480,20 @@ var stdin_default$R = vue.defineComponent({
|
|
|
12394
12480
|
useExpose({
|
|
12395
12481
|
swipeTo
|
|
12396
12482
|
});
|
|
12397
|
-
vue.onMounted(
|
|
12483
|
+
vue.onMounted(() => __async$3(this, null, function* () {
|
|
12484
|
+
var _a;
|
|
12485
|
+
resize();
|
|
12486
|
+
try {
|
|
12487
|
+
const universalJsSdk = yield Promise.resolve().then(() => require("./index-bb5638a0.js"));
|
|
12488
|
+
if (universalJsSdk && universalJsSdk.getJSI) {
|
|
12489
|
+
const fileJsi = (_a = universalJsSdk.getJSI()) == null ? void 0 : _a.file;
|
|
12490
|
+
hasDownloadSupport.value = !!(fileJsi && fileJsi.download);
|
|
12491
|
+
}
|
|
12492
|
+
} catch (e) {
|
|
12493
|
+
console.warn("Failed to check download support:", e);
|
|
12494
|
+
hasDownloadSupport.value = false;
|
|
12495
|
+
}
|
|
12496
|
+
}));
|
|
12398
12497
|
vue.watch([windowWidth, windowHeight], resize);
|
|
12399
12498
|
vue.watch(() => props.startPosition, (value) => setActive(+value));
|
|
12400
12499
|
vue.watch(() => props.show, (value) => {
|
|
@@ -15993,6 +16092,7 @@ const mediaPickerProps = {
|
|
|
15993
16092
|
},
|
|
15994
16093
|
disabled: Boolean,
|
|
15995
16094
|
showTitle: Boolean,
|
|
16095
|
+
showDownload: Boolean,
|
|
15996
16096
|
useFileNameAsLabel: Boolean,
|
|
15997
16097
|
title: makeStringProp("添加附件"),
|
|
15998
16098
|
mediaList: makeArrayProp(),
|
|
@@ -16683,6 +16783,7 @@ var stdin_default$C = vue.defineComponent({
|
|
|
16683
16783
|
images: imageList.value.map((image) => ({
|
|
16684
16784
|
url: image.url || image.showSrc || ""
|
|
16685
16785
|
})),
|
|
16786
|
+
showDownload: props.showDownload,
|
|
16686
16787
|
startPosition: imageIndex,
|
|
16687
16788
|
closeable: true
|
|
16688
16789
|
});
|
|
@@ -16696,7 +16797,7 @@ var stdin_default$C = vue.defineComponent({
|
|
|
16696
16797
|
}
|
|
16697
16798
|
} else if (media.type === "file") {
|
|
16698
16799
|
try {
|
|
16699
|
-
let universalJsSdk = yield Promise.resolve().then(() => require("./index-
|
|
16800
|
+
let universalJsSdk = yield Promise.resolve().then(() => require("./index-bb5638a0.js"));
|
|
16700
16801
|
if (universalJsSdk && universalJsSdk.getJSI && media.url) {
|
|
16701
16802
|
let fileJsi = (_a = universalJsSdk.getJSI()) == null ? void 0 : _a.file;
|
|
16702
16803
|
if (fileJsi && fileJsi.download && fileJsi.openDocument) {
|
|
@@ -23408,7 +23509,7 @@ const Lazyload = {
|
|
|
23408
23509
|
});
|
|
23409
23510
|
}
|
|
23410
23511
|
};
|
|
23411
|
-
const version = "3.1.
|
|
23512
|
+
const version = "3.1.73";
|
|
23412
23513
|
function install(app) {
|
|
23413
23514
|
const components = [
|
|
23414
23515
|
ActionSheet,
|
package/lib/zartui.es.js
CHANGED
|
@@ -6730,6 +6730,7 @@ const pickerProps = extend$1({}, pickerSharedProps$1, {
|
|
|
6730
6730
|
columnsFieldNames: Object,
|
|
6731
6731
|
showPicker: Boolean,
|
|
6732
6732
|
popup: truthProp,
|
|
6733
|
+
teleport: [String, Object],
|
|
6733
6734
|
showType: makeStringProp("default"),
|
|
6734
6735
|
columnCounts: makeNumberProp(3)
|
|
6735
6736
|
});
|
|
@@ -6972,7 +6973,8 @@ var stdin_default$1i = defineComponent({
|
|
|
6972
6973
|
"show": showPicker.value,
|
|
6973
6974
|
"onUpdate:show": [($event) => showPicker.value = $event, updateShow],
|
|
6974
6975
|
"round": true,
|
|
6975
|
-
"position": "bottom"
|
|
6976
|
+
"position": "bottom",
|
|
6977
|
+
"teleport": props.teleport
|
|
6976
6978
|
}, {
|
|
6977
6979
|
default: renderTiledPicker
|
|
6978
6980
|
});
|
|
@@ -6984,7 +6986,8 @@ var stdin_default$1i = defineComponent({
|
|
|
6984
6986
|
"show": showPicker.value,
|
|
6985
6987
|
"onUpdate:show": [($event) => showPicker.value = $event, updateShow],
|
|
6986
6988
|
"round": true,
|
|
6987
|
-
"position": "bottom"
|
|
6989
|
+
"position": "bottom",
|
|
6990
|
+
"teleport": props.teleport
|
|
6988
6991
|
}, {
|
|
6989
6992
|
default: renderPicker
|
|
6990
6993
|
});
|
|
@@ -12242,6 +12245,35 @@ var stdin_default$S = defineComponent({
|
|
|
12242
12245
|
};
|
|
12243
12246
|
}
|
|
12244
12247
|
});
|
|
12248
|
+
const Download = (bem2) => createVNode("svg", {
|
|
12249
|
+
"class": bem2("svg-download-icon"),
|
|
12250
|
+
"xmlns": "http://www.w3.org/2000/svg",
|
|
12251
|
+
"viewBox": "0 0 20 20"
|
|
12252
|
+
}, [createVNode("path", {
|
|
12253
|
+
"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",
|
|
12254
|
+
"fill": "#FFF",
|
|
12255
|
+
"fill-rule": "nonzero"
|
|
12256
|
+
}, null)]);
|
|
12257
|
+
var __async$3 = (__this, __arguments, generator) => {
|
|
12258
|
+
return new Promise((resolve, reject) => {
|
|
12259
|
+
var fulfilled = (value) => {
|
|
12260
|
+
try {
|
|
12261
|
+
step(generator.next(value));
|
|
12262
|
+
} catch (e) {
|
|
12263
|
+
reject(e);
|
|
12264
|
+
}
|
|
12265
|
+
};
|
|
12266
|
+
var rejected = (value) => {
|
|
12267
|
+
try {
|
|
12268
|
+
step(generator.throw(value));
|
|
12269
|
+
} catch (e) {
|
|
12270
|
+
reject(e);
|
|
12271
|
+
}
|
|
12272
|
+
};
|
|
12273
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
12274
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
12275
|
+
});
|
|
12276
|
+
};
|
|
12245
12277
|
const [name$A, bem$z] = createNamespace("image-preview");
|
|
12246
12278
|
const popupProps$1 = ["show", "transition", "overlayStyle", "closeOnPopstate", "teleport"];
|
|
12247
12279
|
const imagePreviewProps = {
|
|
@@ -12253,6 +12285,8 @@ const imagePreviewProps = {
|
|
|
12253
12285
|
overlay: truthProp,
|
|
12254
12286
|
closeable: Boolean,
|
|
12255
12287
|
showIndex: truthProp,
|
|
12288
|
+
showDownload: Boolean,
|
|
12289
|
+
downloadAction: Function,
|
|
12256
12290
|
className: unknownProp,
|
|
12257
12291
|
closeIcon: makeStringProp("clear"),
|
|
12258
12292
|
transition: String,
|
|
@@ -12270,12 +12304,13 @@ const imagePreviewProps = {
|
|
|
12270
12304
|
var stdin_default$R = defineComponent({
|
|
12271
12305
|
name: name$A,
|
|
12272
12306
|
props: imagePreviewProps,
|
|
12273
|
-
emits: ["scale", "close", "closed", "change", "longPress", "update:show"],
|
|
12307
|
+
emits: ["scale", "close", "closed", "change", "longPress", "update:show", "download"],
|
|
12274
12308
|
setup(props, {
|
|
12275
12309
|
emit,
|
|
12276
12310
|
slots
|
|
12277
12311
|
}) {
|
|
12278
12312
|
const swipeRef = ref();
|
|
12313
|
+
const hasDownloadSupport = ref(false);
|
|
12279
12314
|
const state = reactive({
|
|
12280
12315
|
active: 0,
|
|
12281
12316
|
rootWidth: 0,
|
|
@@ -12315,9 +12350,54 @@ var stdin_default$R = defineComponent({
|
|
|
12315
12350
|
}, [props.images[state.active].title]);
|
|
12316
12351
|
}
|
|
12317
12352
|
};
|
|
12353
|
+
const onDownload = () => __async$3(this, null, function* () {
|
|
12354
|
+
var _a, _b, _c;
|
|
12355
|
+
const downloadParams = {
|
|
12356
|
+
index: state.active,
|
|
12357
|
+
url: (_a = props.images[state.active]) == null ? void 0 : _a.url,
|
|
12358
|
+
title: (_b = props.images[state.active]) == null ? void 0 : _b.title
|
|
12359
|
+
};
|
|
12360
|
+
if (props.downloadAction) {
|
|
12361
|
+
const result = props.downloadAction(downloadParams);
|
|
12362
|
+
if (result) {
|
|
12363
|
+
return;
|
|
12364
|
+
}
|
|
12365
|
+
}
|
|
12366
|
+
try {
|
|
12367
|
+
let universalJsSdk = yield import("./index-096e2873.mjs");
|
|
12368
|
+
if (universalJsSdk && universalJsSdk.getJSI && downloadParams.url) {
|
|
12369
|
+
let fileJsi = (_c = universalJsSdk.getJSI()) == null ? void 0 : _c.file;
|
|
12370
|
+
if (fileJsi && fileJsi.download) {
|
|
12371
|
+
showLoadingToast({
|
|
12372
|
+
message: "下载中...",
|
|
12373
|
+
forbidClick: true,
|
|
12374
|
+
duration: 0
|
|
12375
|
+
});
|
|
12376
|
+
fileJsi.download({
|
|
12377
|
+
url: downloadParams.url
|
|
12378
|
+
}).then(({
|
|
12379
|
+
tempFilePath
|
|
12380
|
+
}) => {
|
|
12381
|
+
closeToast();
|
|
12382
|
+
showSuccessToast("下载成功");
|
|
12383
|
+
}).catch(() => {
|
|
12384
|
+
closeToast();
|
|
12385
|
+
showFailToast("下载失败");
|
|
12386
|
+
});
|
|
12387
|
+
return;
|
|
12388
|
+
} else {
|
|
12389
|
+
showFailToast("当前环境暂不支持下载");
|
|
12390
|
+
}
|
|
12391
|
+
}
|
|
12392
|
+
} catch (e) {
|
|
12393
|
+
console.log(e.message);
|
|
12394
|
+
}
|
|
12395
|
+
});
|
|
12318
12396
|
const renderIndex = () => {
|
|
12319
|
-
|
|
12320
|
-
|
|
12397
|
+
const image = props.images[state.active];
|
|
12398
|
+
const showDownload = props.showDownload && hasDownloadSupport.value && !image.url.startsWith("data:");
|
|
12399
|
+
if (props.showIndex || showDownload) {
|
|
12400
|
+
if (props.showIndex && slots.index) {
|
|
12321
12401
|
return createVNode("div", {
|
|
12322
12402
|
"class": bem$z("index")
|
|
12323
12403
|
}, [slots.index({
|
|
@@ -12326,9 +12406,15 @@ var stdin_default$R = defineComponent({
|
|
|
12326
12406
|
}
|
|
12327
12407
|
return createVNode("div", {
|
|
12328
12408
|
"class": bem$z("index")
|
|
12329
|
-
}, [renderIndexText(), renderImageTitle()]);
|
|
12409
|
+
}, [props.showIndex && renderIndexText(), props.showIndex && renderImageTitle(), showDownload && renderDownloadIcon()]);
|
|
12330
12410
|
}
|
|
12331
12411
|
};
|
|
12412
|
+
const renderDownloadIcon = () => {
|
|
12413
|
+
return createVNode("div", {
|
|
12414
|
+
"class": bem$z("download-icon"),
|
|
12415
|
+
"onClick": onDownload
|
|
12416
|
+
}, [Download(bem$z)]);
|
|
12417
|
+
};
|
|
12332
12418
|
const renderCover = () => {
|
|
12333
12419
|
if (slots.cover) {
|
|
12334
12420
|
return createVNode("div", {
|
|
@@ -12392,7 +12478,20 @@ var stdin_default$R = defineComponent({
|
|
|
12392
12478
|
useExpose({
|
|
12393
12479
|
swipeTo
|
|
12394
12480
|
});
|
|
12395
|
-
onMounted(
|
|
12481
|
+
onMounted(() => __async$3(this, null, function* () {
|
|
12482
|
+
var _a;
|
|
12483
|
+
resize();
|
|
12484
|
+
try {
|
|
12485
|
+
const universalJsSdk = yield import("./index-096e2873.mjs");
|
|
12486
|
+
if (universalJsSdk && universalJsSdk.getJSI) {
|
|
12487
|
+
const fileJsi = (_a = universalJsSdk.getJSI()) == null ? void 0 : _a.file;
|
|
12488
|
+
hasDownloadSupport.value = !!(fileJsi && fileJsi.download);
|
|
12489
|
+
}
|
|
12490
|
+
} catch (e) {
|
|
12491
|
+
console.warn("Failed to check download support:", e);
|
|
12492
|
+
hasDownloadSupport.value = false;
|
|
12493
|
+
}
|
|
12494
|
+
}));
|
|
12396
12495
|
watch([windowWidth, windowHeight], resize);
|
|
12397
12496
|
watch(() => props.startPosition, (value) => setActive(+value));
|
|
12398
12497
|
watch(() => props.show, (value) => {
|
|
@@ -15991,6 +16090,7 @@ const mediaPickerProps = {
|
|
|
15991
16090
|
},
|
|
15992
16091
|
disabled: Boolean,
|
|
15993
16092
|
showTitle: Boolean,
|
|
16093
|
+
showDownload: Boolean,
|
|
15994
16094
|
useFileNameAsLabel: Boolean,
|
|
15995
16095
|
title: makeStringProp("添加附件"),
|
|
15996
16096
|
mediaList: makeArrayProp(),
|
|
@@ -16681,6 +16781,7 @@ var stdin_default$C = defineComponent({
|
|
|
16681
16781
|
images: imageList.value.map((image) => ({
|
|
16682
16782
|
url: image.url || image.showSrc || ""
|
|
16683
16783
|
})),
|
|
16784
|
+
showDownload: props.showDownload,
|
|
16684
16785
|
startPosition: imageIndex,
|
|
16685
16786
|
closeable: true
|
|
16686
16787
|
});
|
|
@@ -16694,7 +16795,7 @@ var stdin_default$C = defineComponent({
|
|
|
16694
16795
|
}
|
|
16695
16796
|
} else if (media.type === "file") {
|
|
16696
16797
|
try {
|
|
16697
|
-
let universalJsSdk = yield import("./index-
|
|
16798
|
+
let universalJsSdk = yield import("./index-096e2873.mjs");
|
|
16698
16799
|
if (universalJsSdk && universalJsSdk.getJSI && media.url) {
|
|
16699
16800
|
let fileJsi = (_a = universalJsSdk.getJSI()) == null ? void 0 : _a.file;
|
|
16700
16801
|
if (fileJsi && fileJsi.download && fileJsi.openDocument) {
|
|
@@ -23406,7 +23507,7 @@ const Lazyload = {
|
|
|
23406
23507
|
});
|
|
23407
23508
|
}
|
|
23408
23509
|
};
|
|
23409
|
-
const version = "3.1.
|
|
23510
|
+
const version = "3.1.73";
|
|
23410
23511
|
function install(app) {
|
|
23411
23512
|
const components = [
|
|
23412
23513
|
ActionSheet,
|