@uzum-tech/ui 2.3.1 → 2.3.2
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/dist/index.js +373 -340
- package/dist/index.mjs +373 -340
- package/dist/index.prod.js +2 -2
- package/dist/index.prod.mjs +2 -2
- package/es/components.d.ts +10 -7
- package/es/image/src/ImagePreview.d.ts +1 -0
- package/es/image/src/ImagePreview.mjs +7 -35
- package/es/image/src/public-types.d.ts +4 -4
- package/es/message-bubble/src/MessageBubble.mjs +10 -3
- package/es/upload/index.d.ts +2 -1
- package/es/upload/index.mjs +2 -1
- package/es/upload/src/Upload.d.ts +73 -1007
- package/es/upload/src/Upload.mjs +43 -124
- package/es/upload/src/UploadFile.d.ts +1 -1
- package/es/upload/src/UploadFile.mjs +8 -2
- package/es/upload/src/UploadFileList.mjs +17 -2
- package/es/upload/src/UploadProgress.d.ts +3 -2
- package/es/upload/src/interface.d.ts +1086 -92
- package/es/upload/src/interface.mjs +117 -1
- package/es/upload/src/public-types.d.ts +17 -2
- package/es/upload/src/useUploadActionsRender.d.ts +2 -27
- package/es/upload/src/useUploadActionsRender.mjs +2 -2
- package/es/upload/src/useUploadInternals.d.ts +2 -25
- package/es/upload/src/utils.d.ts +2 -0
- package/es/upload/src/utils.mjs +7 -0
- package/es/version.d.ts +1 -1
- package/es/version.mjs +1 -1
- package/lib/components.d.ts +10 -7
- package/lib/image/src/ImagePreview.d.ts +1 -0
- package/lib/image/src/ImagePreview.js +3 -19
- package/lib/image/src/public-types.d.ts +4 -4
- package/lib/message-bubble/src/MessageBubble.js +10 -4
- package/lib/upload/index.d.ts +2 -1
- package/lib/upload/index.js +2 -1
- package/lib/upload/src/Upload.d.ts +73 -1007
- package/lib/upload/src/Upload.js +40 -68
- package/lib/upload/src/UploadFile.d.ts +1 -1
- package/lib/upload/src/UploadFile.js +12 -4
- package/lib/upload/src/UploadFileList.js +8 -1
- package/lib/upload/src/UploadProgress.d.ts +3 -2
- package/lib/upload/src/interface.d.ts +1086 -92
- package/lib/upload/src/interface.js +59 -1
- package/lib/upload/src/public-types.d.ts +17 -2
- package/lib/upload/src/useUploadActionsRender.d.ts +2 -27
- package/lib/upload/src/useUploadActionsRender.js +2 -2
- package/lib/upload/src/useUploadInternals.d.ts +2 -25
- package/lib/upload/src/utils.d.ts +2 -0
- package/lib/upload/src/utils.js +10 -0
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +1 -1
- package/web-types.json +104 -23
package/dist/index.js
CHANGED
|
@@ -15760,7 +15760,7 @@
|
|
|
15760
15760
|
}
|
|
15761
15761
|
});
|
|
15762
15762
|
|
|
15763
|
-
|
|
15763
|
+
vue.defineComponent({
|
|
15764
15764
|
name: "ResizeSmall",
|
|
15765
15765
|
render() {
|
|
15766
15766
|
return /* @__PURE__ */ vue.h("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 20 20" }, /* @__PURE__ */ vue.h("g", { fill: "none" }, /* @__PURE__ */ vue.h(
|
|
@@ -46766,6 +46766,283 @@
|
|
|
46766
46766
|
}
|
|
46767
46767
|
});
|
|
46768
46768
|
|
|
46769
|
+
function isImageFileType(type) {
|
|
46770
|
+
return type.includes("image/");
|
|
46771
|
+
}
|
|
46772
|
+
function getExtname(url = "") {
|
|
46773
|
+
const temp = url.split("/");
|
|
46774
|
+
const filename = temp[temp.length - 1];
|
|
46775
|
+
const filenameWithoutSuffix = filename.split(/#|\?/)[0];
|
|
46776
|
+
return (/\.[^./\\]*$/.exec(filenameWithoutSuffix) || [""])[0];
|
|
46777
|
+
}
|
|
46778
|
+
const imageExtensionRegex = /(webp|svg|png|gif|jpg|jpeg|jfif|bmp|dpg|ico)$/i;
|
|
46779
|
+
function capitalizeFirstLetter(str) {
|
|
46780
|
+
if (!str) return str;
|
|
46781
|
+
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
46782
|
+
}
|
|
46783
|
+
const isImageFile = file => {
|
|
46784
|
+
if (file.type) {
|
|
46785
|
+
return isImageFileType(file.type);
|
|
46786
|
+
}
|
|
46787
|
+
const fileNameExtension = getExtname(file.name || "");
|
|
46788
|
+
if (imageExtensionRegex.test(fileNameExtension)) {
|
|
46789
|
+
return true;
|
|
46790
|
+
}
|
|
46791
|
+
const url = file.thumbnailUrl || file.url || "";
|
|
46792
|
+
const urlExtension = getExtname(url);
|
|
46793
|
+
if (/^data:image\//.test(url) || imageExtensionRegex.test(urlExtension)) {
|
|
46794
|
+
return true;
|
|
46795
|
+
}
|
|
46796
|
+
return false;
|
|
46797
|
+
};
|
|
46798
|
+
async function createImageDataUrl(file) {
|
|
46799
|
+
return await new Promise(resolve => {
|
|
46800
|
+
if (!file.type || !isImageFileType(file.type)) {
|
|
46801
|
+
resolve("");
|
|
46802
|
+
return;
|
|
46803
|
+
}
|
|
46804
|
+
resolve(window.URL.createObjectURL(file));
|
|
46805
|
+
});
|
|
46806
|
+
}
|
|
46807
|
+
const environmentSupportFile = isBrowser$1 && window.FileReader && window.File;
|
|
46808
|
+
function isFileSystemDirectoryEntry(item) {
|
|
46809
|
+
return item.isDirectory;
|
|
46810
|
+
}
|
|
46811
|
+
function isFileSystemFileEntry(item) {
|
|
46812
|
+
return item.isFile;
|
|
46813
|
+
}
|
|
46814
|
+
async function getFilesFromEntries(entries, directory) {
|
|
46815
|
+
const fileAndEntries = [];
|
|
46816
|
+
let _resolve;
|
|
46817
|
+
let requestCallbackCount = 0;
|
|
46818
|
+
function lock() {
|
|
46819
|
+
requestCallbackCount++;
|
|
46820
|
+
}
|
|
46821
|
+
function unlock() {
|
|
46822
|
+
requestCallbackCount--;
|
|
46823
|
+
if (!requestCallbackCount) {
|
|
46824
|
+
_resolve(fileAndEntries);
|
|
46825
|
+
}
|
|
46826
|
+
}
|
|
46827
|
+
function _getFilesFromEntries(entries2) {
|
|
46828
|
+
entries2.forEach(entry => {
|
|
46829
|
+
if (!entry) return;
|
|
46830
|
+
lock();
|
|
46831
|
+
if (directory && isFileSystemDirectoryEntry(entry)) {
|
|
46832
|
+
const directoryReader = entry.createReader();
|
|
46833
|
+
lock();
|
|
46834
|
+
directoryReader.readEntries(entries3 => {
|
|
46835
|
+
_getFilesFromEntries(entries3);
|
|
46836
|
+
unlock();
|
|
46837
|
+
}, () => {
|
|
46838
|
+
unlock();
|
|
46839
|
+
});
|
|
46840
|
+
} else if (isFileSystemFileEntry(entry)) {
|
|
46841
|
+
lock();
|
|
46842
|
+
entry.file(file => {
|
|
46843
|
+
fileAndEntries.push({
|
|
46844
|
+
file,
|
|
46845
|
+
entry,
|
|
46846
|
+
source: "dnd"
|
|
46847
|
+
});
|
|
46848
|
+
unlock();
|
|
46849
|
+
}, () => {
|
|
46850
|
+
unlock();
|
|
46851
|
+
});
|
|
46852
|
+
}
|
|
46853
|
+
unlock();
|
|
46854
|
+
});
|
|
46855
|
+
}
|
|
46856
|
+
await new Promise(resolve => {
|
|
46857
|
+
_resolve = resolve;
|
|
46858
|
+
_getFilesFromEntries(entries);
|
|
46859
|
+
});
|
|
46860
|
+
return fileAndEntries;
|
|
46861
|
+
}
|
|
46862
|
+
function getFilePreviewSrc(file) {
|
|
46863
|
+
return file.url || file.thumbnailUrl || null;
|
|
46864
|
+
}
|
|
46865
|
+
function isFileSizeExceeded(file, maxSize) {
|
|
46866
|
+
if (maxSize === void 0 || !file) return false;
|
|
46867
|
+
return file.size > maxSize;
|
|
46868
|
+
}
|
|
46869
|
+
function createSettledFileInfo(fileInfo) {
|
|
46870
|
+
const {
|
|
46871
|
+
id,
|
|
46872
|
+
name,
|
|
46873
|
+
percentage,
|
|
46874
|
+
status,
|
|
46875
|
+
url,
|
|
46876
|
+
file,
|
|
46877
|
+
thumbnailUrl,
|
|
46878
|
+
type,
|
|
46879
|
+
fullPath,
|
|
46880
|
+
batchId
|
|
46881
|
+
} = fileInfo;
|
|
46882
|
+
return {
|
|
46883
|
+
id,
|
|
46884
|
+
name,
|
|
46885
|
+
percentage: percentage ?? null,
|
|
46886
|
+
status,
|
|
46887
|
+
url: url ?? null,
|
|
46888
|
+
file: file ?? null,
|
|
46889
|
+
thumbnailUrl: thumbnailUrl ?? null,
|
|
46890
|
+
type: type ?? null,
|
|
46891
|
+
fullPath: fullPath ?? null,
|
|
46892
|
+
batchId: batchId ?? null
|
|
46893
|
+
};
|
|
46894
|
+
}
|
|
46895
|
+
function matchType(name, mimeType, accept) {
|
|
46896
|
+
name = name.toLowerCase();
|
|
46897
|
+
mimeType = mimeType.toLocaleLowerCase();
|
|
46898
|
+
accept = accept.toLocaleLowerCase();
|
|
46899
|
+
const acceptAtoms = accept.split(",").map(acceptAtom => acceptAtom.trim()).filter(Boolean);
|
|
46900
|
+
return acceptAtoms.some(acceptAtom => {
|
|
46901
|
+
if (acceptAtom.startsWith(".")) {
|
|
46902
|
+
if (name.endsWith(acceptAtom)) return true;
|
|
46903
|
+
} else if (acceptAtom.includes("/")) {
|
|
46904
|
+
const [type, subtype] = mimeType.split("/");
|
|
46905
|
+
const [acceptType, acceptSubtype] = acceptAtom.split("/");
|
|
46906
|
+
if (acceptType === "*" || type && acceptType && acceptType === type) {
|
|
46907
|
+
if (acceptSubtype === "*" || subtype && acceptSubtype && acceptSubtype === subtype) {
|
|
46908
|
+
return true;
|
|
46909
|
+
}
|
|
46910
|
+
}
|
|
46911
|
+
} else {
|
|
46912
|
+
return true;
|
|
46913
|
+
}
|
|
46914
|
+
return false;
|
|
46915
|
+
});
|
|
46916
|
+
}
|
|
46917
|
+
function download(url, name) {
|
|
46918
|
+
if (!url) return;
|
|
46919
|
+
const a = document.createElement("a");
|
|
46920
|
+
a.href = url;
|
|
46921
|
+
if (name !== void 0) {
|
|
46922
|
+
a.download = name;
|
|
46923
|
+
}
|
|
46924
|
+
document.body.appendChild(a);
|
|
46925
|
+
a.click();
|
|
46926
|
+
document.body.removeChild(a);
|
|
46927
|
+
}
|
|
46928
|
+
|
|
46929
|
+
const uploadInjectionKey = createInjectionKey("u-upload");
|
|
46930
|
+
const uploadProps = {
|
|
46931
|
+
...useTheme.props,
|
|
46932
|
+
name: {
|
|
46933
|
+
type: String,
|
|
46934
|
+
default: "file"
|
|
46935
|
+
},
|
|
46936
|
+
accept: String,
|
|
46937
|
+
action: String,
|
|
46938
|
+
customRequest: Function,
|
|
46939
|
+
directory: Boolean,
|
|
46940
|
+
directoryDnd: {
|
|
46941
|
+
type: Boolean,
|
|
46942
|
+
default: void 0
|
|
46943
|
+
},
|
|
46944
|
+
method: {
|
|
46945
|
+
type: String,
|
|
46946
|
+
default: "POST"
|
|
46947
|
+
},
|
|
46948
|
+
multiple: Boolean,
|
|
46949
|
+
showFileList: {
|
|
46950
|
+
type: Boolean,
|
|
46951
|
+
default: true
|
|
46952
|
+
},
|
|
46953
|
+
data: [Object, Function],
|
|
46954
|
+
headers: [Object, Function],
|
|
46955
|
+
withCredentials: Boolean,
|
|
46956
|
+
responseType: {
|
|
46957
|
+
type: String,
|
|
46958
|
+
default: ""
|
|
46959
|
+
},
|
|
46960
|
+
disabled: {
|
|
46961
|
+
type: Boolean,
|
|
46962
|
+
default: void 0
|
|
46963
|
+
},
|
|
46964
|
+
vertical: {
|
|
46965
|
+
type: Boolean,
|
|
46966
|
+
default: false
|
|
46967
|
+
},
|
|
46968
|
+
icon: Object,
|
|
46969
|
+
onChange: Function,
|
|
46970
|
+
onRemove: Function,
|
|
46971
|
+
onFinish: Function,
|
|
46972
|
+
onError: Function,
|
|
46973
|
+
onRetry: Function,
|
|
46974
|
+
onBeforeUpload: Function,
|
|
46975
|
+
isErrorState: Function,
|
|
46976
|
+
onDownload: Function,
|
|
46977
|
+
defaultUpload: {
|
|
46978
|
+
type: Boolean,
|
|
46979
|
+
default: true
|
|
46980
|
+
},
|
|
46981
|
+
fileList: Array,
|
|
46982
|
+
"onUpdate:fileList": [Function, Array],
|
|
46983
|
+
onUpdateFileList: [Function, Array],
|
|
46984
|
+
fileListClass: String,
|
|
46985
|
+
fileListStyle: [String, Object],
|
|
46986
|
+
defaultFileList: {
|
|
46987
|
+
type: Array,
|
|
46988
|
+
default: () => []
|
|
46989
|
+
},
|
|
46990
|
+
showCancelButton: {
|
|
46991
|
+
type: Boolean,
|
|
46992
|
+
default: true
|
|
46993
|
+
},
|
|
46994
|
+
showRemoveButton: {
|
|
46995
|
+
type: Boolean,
|
|
46996
|
+
default: true
|
|
46997
|
+
},
|
|
46998
|
+
showDownloadButton: Boolean,
|
|
46999
|
+
showRetryButton: {
|
|
47000
|
+
type: Boolean,
|
|
47001
|
+
default: true
|
|
47002
|
+
},
|
|
47003
|
+
customDownload: Function,
|
|
47004
|
+
showPreviewButton: {
|
|
47005
|
+
type: Boolean,
|
|
47006
|
+
default: true
|
|
47007
|
+
},
|
|
47008
|
+
listType: {
|
|
47009
|
+
type: String,
|
|
47010
|
+
default: "text"
|
|
47011
|
+
},
|
|
47012
|
+
onPreview: Function,
|
|
47013
|
+
shouldUseThumbnailUrl: {
|
|
47014
|
+
type: Function,
|
|
47015
|
+
default: file => {
|
|
47016
|
+
if (!environmentSupportFile) return false;
|
|
47017
|
+
return isImageFile(file);
|
|
47018
|
+
}
|
|
47019
|
+
},
|
|
47020
|
+
createThumbnailUrl: Function,
|
|
47021
|
+
abstract: Boolean,
|
|
47022
|
+
max: Number,
|
|
47023
|
+
maxSize: Number,
|
|
47024
|
+
showTrigger: {
|
|
47025
|
+
type: Boolean,
|
|
47026
|
+
default: true
|
|
47027
|
+
},
|
|
47028
|
+
imageGroupProps: Object,
|
|
47029
|
+
inputProps: Object,
|
|
47030
|
+
triggerClass: String,
|
|
47031
|
+
triggerStyle: [String, Object],
|
|
47032
|
+
renderIcon: Function,
|
|
47033
|
+
label: String,
|
|
47034
|
+
size: {
|
|
47035
|
+
type: String,
|
|
47036
|
+
default: "medium"
|
|
47037
|
+
},
|
|
47038
|
+
title: String,
|
|
47039
|
+
subtitle: String,
|
|
47040
|
+
noIcon: {
|
|
47041
|
+
type: Boolean,
|
|
47042
|
+
default: false
|
|
47043
|
+
}
|
|
47044
|
+
};
|
|
47045
|
+
|
|
46769
47046
|
function self$13(vars) {
|
|
46770
47047
|
const {
|
|
46771
47048
|
fontWeight,
|
|
@@ -46896,8 +47173,6 @@
|
|
|
46896
47173
|
style: rtlStyle$i
|
|
46897
47174
|
};
|
|
46898
47175
|
|
|
46899
|
-
const uploadInjectionKey = createInjectionKey("u-upload");
|
|
46900
|
-
|
|
46901
47176
|
var style$1a = c$1([cB("upload", "width: var(--u-upload-width)", [cM("dragger-inside", [cB("upload-trigger", `
|
|
46902
47177
|
display: block;
|
|
46903
47178
|
`)]), cM("drag-over", [cB("upload-dragger", `
|
|
@@ -50576,20 +50851,6 @@
|
|
|
50576
50851
|
self: self$g
|
|
50577
50852
|
};
|
|
50578
50853
|
|
|
50579
|
-
const prevIcon = /* @__PURE__ */ vue.h("svg", { viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, /* @__PURE__ */ vue.h(
|
|
50580
|
-
"path",
|
|
50581
|
-
{
|
|
50582
|
-
d: "M6 5C5.75454 5 5.55039 5.17688 5.50806 5.41012L5.5 5.5V14.5C5.5 14.7761 5.72386 15 6 15C6.24546 15 6.44961 14.8231 6.49194 14.5899L6.5 14.5V5.5C6.5 5.22386 6.27614 5 6 5ZM13.8536 5.14645C13.68 4.97288 13.4106 4.9536 13.2157 5.08859L13.1464 5.14645L8.64645 9.64645C8.47288 9.82001 8.4536 10.0894 8.58859 10.2843L8.64645 10.3536L13.1464 14.8536C13.3417 15.0488 13.6583 15.0488 13.8536 14.8536C14.0271 14.68 14.0464 14.4106 13.9114 14.2157L13.8536 14.1464L9.70711 10L13.8536 5.85355C14.0488 5.65829 14.0488 5.34171 13.8536 5.14645Z",
|
|
50583
|
-
fill: "currentColor"
|
|
50584
|
-
}
|
|
50585
|
-
));
|
|
50586
|
-
const nextIcon = /* @__PURE__ */ vue.h("svg", { viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, /* @__PURE__ */ vue.h(
|
|
50587
|
-
"path",
|
|
50588
|
-
{
|
|
50589
|
-
d: "M13.5 5C13.7455 5 13.9496 5.17688 13.9919 5.41012L14 5.5V14.5C14 14.7761 13.7761 15 13.5 15C13.2545 15 13.0504 14.8231 13.0081 14.5899L13 14.5V5.5C13 5.22386 13.2239 5 13.5 5ZM5.64645 5.14645C5.82001 4.97288 6.08944 4.9536 6.28431 5.08859L6.35355 5.14645L10.8536 9.64645C11.0271 9.82001 11.0464 10.0894 10.9114 10.2843L10.8536 10.3536L6.35355 14.8536C6.15829 15.0488 5.84171 15.0488 5.64645 14.8536C5.47288 14.68 5.4536 14.4106 5.58859 14.2157L5.64645 14.1464L9.79289 10L5.64645 5.85355C5.45118 5.65829 5.45118 5.34171 5.64645 5.14645Z",
|
|
50590
|
-
fill: "currentColor"
|
|
50591
|
-
}
|
|
50592
|
-
));
|
|
50593
50854
|
const closeIcon = /* @__PURE__ */ vue.h("svg", { viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, /* @__PURE__ */ vue.h(
|
|
50594
50855
|
"path",
|
|
50595
50856
|
{
|
|
@@ -50597,22 +50858,6 @@
|
|
|
50597
50858
|
fill: "currentColor"
|
|
50598
50859
|
}
|
|
50599
50860
|
));
|
|
50600
|
-
const downloadIcon = /* @__PURE__ */ vue.h(
|
|
50601
|
-
"svg",
|
|
50602
|
-
{
|
|
50603
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
50604
|
-
width: "32",
|
|
50605
|
-
height: "32",
|
|
50606
|
-
viewBox: "0 0 1024 1024"
|
|
50607
|
-
},
|
|
50608
|
-
/* @__PURE__ */ vue.h(
|
|
50609
|
-
"path",
|
|
50610
|
-
{
|
|
50611
|
-
fill: "currentColor",
|
|
50612
|
-
d: "M505.7 661a8 8 0 0 0 12.6 0l112-141.7c4.1-5.2.4-12.9-6.3-12.9h-74.1V168c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v338.3H400c-6.7 0-10.4 7.7-6.3 12.9l112 141.8zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z"
|
|
50613
|
-
}
|
|
50614
|
-
)
|
|
50615
|
-
);
|
|
50616
50861
|
|
|
50617
50862
|
const imagePreviewSharedProps = {
|
|
50618
50863
|
...useTheme.props,
|
|
@@ -51062,7 +51307,8 @@
|
|
|
51062
51307
|
toolbarIconColor,
|
|
51063
51308
|
toolbarBorderRadius,
|
|
51064
51309
|
toolbarBoxShadow,
|
|
51065
|
-
toolbarColor
|
|
51310
|
+
toolbarColor,
|
|
51311
|
+
overlayColor
|
|
51066
51312
|
}
|
|
51067
51313
|
} = themeRef.value;
|
|
51068
51314
|
return {
|
|
@@ -51070,7 +51316,8 @@
|
|
|
51070
51316
|
"--u-toolbar-icon-color": toolbarIconColor,
|
|
51071
51317
|
"--u-toolbar-color": toolbarColor,
|
|
51072
51318
|
"--u-toolbar-border-radius": toolbarBorderRadius,
|
|
51073
|
-
"--u-toolbar-box-shadow": toolbarBoxShadow
|
|
51319
|
+
"--u-toolbar-box-shadow": toolbarBoxShadow,
|
|
51320
|
+
"--u-overlay-color": overlayColor
|
|
51074
51321
|
};
|
|
51075
51322
|
});
|
|
51076
51323
|
const { inlineThemeDisabled } = useConfig();
|
|
@@ -51119,14 +51366,6 @@
|
|
|
51119
51366
|
},
|
|
51120
51367
|
render() {
|
|
51121
51368
|
const { clsPrefix, renderToolbar, withTooltip } = this;
|
|
51122
|
-
const prevNode = withTooltip(
|
|
51123
|
-
/* @__PURE__ */ vue.h(UBaseIcon, { clsPrefix, onClick: this.handleSwitchPrev }, { default: () => prevIcon }),
|
|
51124
|
-
"tipPrevious"
|
|
51125
|
-
);
|
|
51126
|
-
const nextNode = withTooltip(
|
|
51127
|
-
/* @__PURE__ */ vue.h(UBaseIcon, { clsPrefix, onClick: this.handleSwitchNext }, { default: () => nextIcon }),
|
|
51128
|
-
"tipNext"
|
|
51129
|
-
);
|
|
51130
51369
|
const rotateCounterclockwiseNode = withTooltip(
|
|
51131
51370
|
/* @__PURE__ */ vue.h(UBaseIcon, { clsPrefix, onClick: this.rotateCounterclockwise }, {
|
|
51132
51371
|
default: () => /* @__PURE__ */ vue.h(RotateCounterclockwiseIcon, null)
|
|
@@ -51139,22 +51378,10 @@
|
|
|
51139
51378
|
}),
|
|
51140
51379
|
"tipClockwise"
|
|
51141
51380
|
);
|
|
51142
|
-
const originalSizeNode = withTooltip(
|
|
51143
|
-
/* @__PURE__ */ vue.h(UBaseIcon, { clsPrefix, onClick: this.resizeToOrignalImageSize }, {
|
|
51144
|
-
default: () => {
|
|
51145
|
-
return /* @__PURE__ */ vue.h(ResizeSmallIcon, null);
|
|
51146
|
-
}
|
|
51147
|
-
}),
|
|
51148
|
-
"tipOriginalSize"
|
|
51149
|
-
);
|
|
51150
51381
|
const zoomOutNode = withTooltip(
|
|
51151
51382
|
/* @__PURE__ */ vue.h(UBaseIcon, { clsPrefix, onClick: this.zoomOut }, { default: () => /* @__PURE__ */ vue.h(ZoomOutIcon, null) }),
|
|
51152
51383
|
"tipZoomOut"
|
|
51153
51384
|
);
|
|
51154
|
-
const downloadNode = withTooltip(
|
|
51155
|
-
/* @__PURE__ */ vue.h(UBaseIcon, { clsPrefix, onClick: this.handleDownloadClick }, { default: () => downloadIcon }),
|
|
51156
|
-
"tipDownload"
|
|
51157
|
-
);
|
|
51158
51385
|
const closeNode = withTooltip(
|
|
51159
51386
|
/* @__PURE__ */ vue.h(UBaseIcon, { clsPrefix, onClick: () => this.close() }, { default: () => closeIcon }),
|
|
51160
51387
|
"tipClose"
|
|
@@ -51196,17 +51423,13 @@
|
|
|
51196
51423
|
return null;
|
|
51197
51424
|
return /* @__PURE__ */ vue.h("div", { class: `${clsPrefix}-image-preview-toolbar` }, renderToolbar ? renderToolbar({
|
|
51198
51425
|
nodes: {
|
|
51199
|
-
prev: prevNode,
|
|
51200
|
-
next: nextNode,
|
|
51201
51426
|
rotateCounterclockwise: rotateCounterclockwiseNode,
|
|
51202
51427
|
rotateClockwise: rotateClockwiseNode,
|
|
51203
|
-
resizeToOriginalSize: originalSizeNode,
|
|
51204
51428
|
zoomOut: zoomOutNode,
|
|
51205
51429
|
zoomIn: zoomInNode,
|
|
51206
|
-
download: downloadNode,
|
|
51207
51430
|
close: closeNode
|
|
51208
51431
|
}
|
|
51209
|
-
}) : /* @__PURE__ */ vue.h(vue.Fragment, null,
|
|
51432
|
+
}) : /* @__PURE__ */ vue.h(vue.Fragment, null, rotateCounterclockwiseNode, rotateClockwiseNode, zoomOutNode, zoomInNode, closeNode));
|
|
51210
51433
|
}
|
|
51211
51434
|
}) : null,
|
|
51212
51435
|
/* @__PURE__ */ vue.h(
|
|
@@ -51861,7 +52084,7 @@
|
|
|
51861
52084
|
}
|
|
51862
52085
|
});
|
|
51863
52086
|
|
|
51864
|
-
function useUploadActionsRender(
|
|
52087
|
+
function useUploadActionsRender(options) {
|
|
51865
52088
|
const {
|
|
51866
52089
|
clsPrefix,
|
|
51867
52090
|
listType,
|
|
@@ -51881,7 +52104,7 @@
|
|
|
51881
52104
|
handleRetryClick,
|
|
51882
52105
|
handleDownloadClick,
|
|
51883
52106
|
capitalizeFirstLetter
|
|
51884
|
-
} =
|
|
52107
|
+
} = options;
|
|
51885
52108
|
const getExt = (name) => {
|
|
51886
52109
|
const i = name.lastIndexOf(".");
|
|
51887
52110
|
return i === -1 || i === name.length - 1 ? "" : name.slice(i + 1);
|
|
@@ -52008,159 +52231,6 @@
|
|
|
52008
52231
|
return { icon, actionsNode };
|
|
52009
52232
|
}
|
|
52010
52233
|
|
|
52011
|
-
function isImageFileType(type) {
|
|
52012
|
-
return type.includes("image/");
|
|
52013
|
-
}
|
|
52014
|
-
function getExtname(url = "") {
|
|
52015
|
-
const temp = url.split("/");
|
|
52016
|
-
const filename = temp[temp.length - 1];
|
|
52017
|
-
const filenameWithoutSuffix = filename.split(/#|\?/)[0];
|
|
52018
|
-
return (/\.[^./\\]*$/.exec(filenameWithoutSuffix) || [""])[0];
|
|
52019
|
-
}
|
|
52020
|
-
const imageExtensionRegex = /(webp|svg|png|gif|jpg|jpeg|jfif|bmp|dpg|ico)$/i;
|
|
52021
|
-
function capitalizeFirstLetter(str) {
|
|
52022
|
-
if (!str) return str;
|
|
52023
|
-
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
52024
|
-
}
|
|
52025
|
-
const isImageFile = file => {
|
|
52026
|
-
if (file.type) {
|
|
52027
|
-
return isImageFileType(file.type);
|
|
52028
|
-
}
|
|
52029
|
-
const fileNameExtension = getExtname(file.name || "");
|
|
52030
|
-
if (imageExtensionRegex.test(fileNameExtension)) {
|
|
52031
|
-
return true;
|
|
52032
|
-
}
|
|
52033
|
-
const url = file.thumbnailUrl || file.url || "";
|
|
52034
|
-
const urlExtension = getExtname(url);
|
|
52035
|
-
if (/^data:image\//.test(url) || imageExtensionRegex.test(urlExtension)) {
|
|
52036
|
-
return true;
|
|
52037
|
-
}
|
|
52038
|
-
return false;
|
|
52039
|
-
};
|
|
52040
|
-
async function createImageDataUrl(file) {
|
|
52041
|
-
return await new Promise(resolve => {
|
|
52042
|
-
if (!file.type || !isImageFileType(file.type)) {
|
|
52043
|
-
resolve("");
|
|
52044
|
-
return;
|
|
52045
|
-
}
|
|
52046
|
-
resolve(window.URL.createObjectURL(file));
|
|
52047
|
-
});
|
|
52048
|
-
}
|
|
52049
|
-
const environmentSupportFile = isBrowser$1 && window.FileReader && window.File;
|
|
52050
|
-
function isFileSystemDirectoryEntry(item) {
|
|
52051
|
-
return item.isDirectory;
|
|
52052
|
-
}
|
|
52053
|
-
function isFileSystemFileEntry(item) {
|
|
52054
|
-
return item.isFile;
|
|
52055
|
-
}
|
|
52056
|
-
async function getFilesFromEntries(entries, directory) {
|
|
52057
|
-
const fileAndEntries = [];
|
|
52058
|
-
let _resolve;
|
|
52059
|
-
let requestCallbackCount = 0;
|
|
52060
|
-
function lock() {
|
|
52061
|
-
requestCallbackCount++;
|
|
52062
|
-
}
|
|
52063
|
-
function unlock() {
|
|
52064
|
-
requestCallbackCount--;
|
|
52065
|
-
if (!requestCallbackCount) {
|
|
52066
|
-
_resolve(fileAndEntries);
|
|
52067
|
-
}
|
|
52068
|
-
}
|
|
52069
|
-
function _getFilesFromEntries(entries2) {
|
|
52070
|
-
entries2.forEach(entry => {
|
|
52071
|
-
if (!entry) return;
|
|
52072
|
-
lock();
|
|
52073
|
-
if (directory && isFileSystemDirectoryEntry(entry)) {
|
|
52074
|
-
const directoryReader = entry.createReader();
|
|
52075
|
-
lock();
|
|
52076
|
-
directoryReader.readEntries(entries3 => {
|
|
52077
|
-
_getFilesFromEntries(entries3);
|
|
52078
|
-
unlock();
|
|
52079
|
-
}, () => {
|
|
52080
|
-
unlock();
|
|
52081
|
-
});
|
|
52082
|
-
} else if (isFileSystemFileEntry(entry)) {
|
|
52083
|
-
lock();
|
|
52084
|
-
entry.file(file => {
|
|
52085
|
-
fileAndEntries.push({
|
|
52086
|
-
file,
|
|
52087
|
-
entry,
|
|
52088
|
-
source: "dnd"
|
|
52089
|
-
});
|
|
52090
|
-
unlock();
|
|
52091
|
-
}, () => {
|
|
52092
|
-
unlock();
|
|
52093
|
-
});
|
|
52094
|
-
}
|
|
52095
|
-
unlock();
|
|
52096
|
-
});
|
|
52097
|
-
}
|
|
52098
|
-
await new Promise(resolve => {
|
|
52099
|
-
_resolve = resolve;
|
|
52100
|
-
_getFilesFromEntries(entries);
|
|
52101
|
-
});
|
|
52102
|
-
return fileAndEntries;
|
|
52103
|
-
}
|
|
52104
|
-
function createSettledFileInfo(fileInfo) {
|
|
52105
|
-
const {
|
|
52106
|
-
id,
|
|
52107
|
-
name,
|
|
52108
|
-
percentage,
|
|
52109
|
-
status,
|
|
52110
|
-
url,
|
|
52111
|
-
file,
|
|
52112
|
-
thumbnailUrl,
|
|
52113
|
-
type,
|
|
52114
|
-
fullPath,
|
|
52115
|
-
batchId
|
|
52116
|
-
} = fileInfo;
|
|
52117
|
-
return {
|
|
52118
|
-
id,
|
|
52119
|
-
name,
|
|
52120
|
-
percentage: percentage ?? null,
|
|
52121
|
-
status,
|
|
52122
|
-
url: url ?? null,
|
|
52123
|
-
file: file ?? null,
|
|
52124
|
-
thumbnailUrl: thumbnailUrl ?? null,
|
|
52125
|
-
type: type ?? null,
|
|
52126
|
-
fullPath: fullPath ?? null,
|
|
52127
|
-
batchId: batchId ?? null
|
|
52128
|
-
};
|
|
52129
|
-
}
|
|
52130
|
-
function matchType(name, mimeType, accept) {
|
|
52131
|
-
name = name.toLowerCase();
|
|
52132
|
-
mimeType = mimeType.toLocaleLowerCase();
|
|
52133
|
-
accept = accept.toLocaleLowerCase();
|
|
52134
|
-
const acceptAtoms = accept.split(",").map(acceptAtom => acceptAtom.trim()).filter(Boolean);
|
|
52135
|
-
return acceptAtoms.some(acceptAtom => {
|
|
52136
|
-
if (acceptAtom.startsWith(".")) {
|
|
52137
|
-
if (name.endsWith(acceptAtom)) return true;
|
|
52138
|
-
} else if (acceptAtom.includes("/")) {
|
|
52139
|
-
const [type, subtype] = mimeType.split("/");
|
|
52140
|
-
const [acceptType, acceptSubtype] = acceptAtom.split("/");
|
|
52141
|
-
if (acceptType === "*" || type && acceptType && acceptType === type) {
|
|
52142
|
-
if (acceptSubtype === "*" || subtype && acceptSubtype && acceptSubtype === subtype) {
|
|
52143
|
-
return true;
|
|
52144
|
-
}
|
|
52145
|
-
}
|
|
52146
|
-
} else {
|
|
52147
|
-
return true;
|
|
52148
|
-
}
|
|
52149
|
-
return false;
|
|
52150
|
-
});
|
|
52151
|
-
}
|
|
52152
|
-
function download(url, name) {
|
|
52153
|
-
if (!url) return;
|
|
52154
|
-
const a = document.createElement("a");
|
|
52155
|
-
a.href = url;
|
|
52156
|
-
if (name !== void 0) {
|
|
52157
|
-
a.download = name;
|
|
52158
|
-
}
|
|
52159
|
-
document.body.appendChild(a);
|
|
52160
|
-
a.click();
|
|
52161
|
-
document.body.removeChild(a);
|
|
52162
|
-
}
|
|
52163
|
-
|
|
52164
52234
|
const buttonThemeOverrides = {
|
|
52165
52235
|
paddingMedium: "0 3px",
|
|
52166
52236
|
heightMedium: "24px",
|
|
@@ -52238,7 +52308,12 @@
|
|
|
52238
52308
|
file: { status },
|
|
52239
52309
|
listType
|
|
52240
52310
|
} = props;
|
|
52241
|
-
|
|
52311
|
+
if (!["finished"].includes(status))
|
|
52312
|
+
return false;
|
|
52313
|
+
if (listType === "preview-list") {
|
|
52314
|
+
return UUpload.isFilePreviewable(props.file);
|
|
52315
|
+
}
|
|
52316
|
+
return !!mergedThumbnailUrlRef.value && listType === "image-card";
|
|
52242
52317
|
});
|
|
52243
52318
|
async function handleRetryClick() {
|
|
52244
52319
|
const onRetry = UUpload.onRetryRef.value;
|
|
@@ -52317,6 +52392,8 @@
|
|
|
52317
52392
|
} = UUpload;
|
|
52318
52393
|
if (onPreview) {
|
|
52319
52394
|
onPreview(props.file);
|
|
52395
|
+
} else if (props.listType === "preview-list") {
|
|
52396
|
+
UUpload.openFilePreview(props.file);
|
|
52320
52397
|
} else if (props.listType === "image-card") {
|
|
52321
52398
|
const { value } = imageRef;
|
|
52322
52399
|
if (!value)
|
|
@@ -52403,7 +52480,8 @@
|
|
|
52403
52480
|
`${clsPrefix}-upload-file`,
|
|
52404
52481
|
`${clsPrefix}-upload-file--${this.progressStatus}-status`,
|
|
52405
52482
|
file.url && file.status !== "error" && imageCardTypes.includes(listType) && `${clsPrefix}-upload-file--with-url`,
|
|
52406
|
-
`${clsPrefix}-upload-file--${listType === "image" || listType === "image-card" ? "image-card" : "text"}-type
|
|
52483
|
+
`${clsPrefix}-upload-file--${listType === "image" || listType === "image-card" ? "image-card" : "text"}-type`,
|
|
52484
|
+
listType === "preview-list" && `${clsPrefix}-upload-file--preview-list-type`
|
|
52407
52485
|
]
|
|
52408
52486
|
},
|
|
52409
52487
|
/* @__PURE__ */ vue.h(
|
|
@@ -52571,11 +52649,17 @@
|
|
|
52571
52649
|
themeClassRef,
|
|
52572
52650
|
maxReachedRef,
|
|
52573
52651
|
showTriggerRef,
|
|
52574
|
-
imageGroupPropsRef
|
|
52652
|
+
imageGroupPropsRef,
|
|
52653
|
+
previewSrcListRef,
|
|
52654
|
+
previewShowRef,
|
|
52655
|
+
previewCurrentRef
|
|
52575
52656
|
} = UUpload;
|
|
52576
52657
|
const isImageCardTypeRef = vue.computed(
|
|
52577
52658
|
() => listTypeRef.value === "image-card" || listTypeRef.value === "image"
|
|
52578
52659
|
);
|
|
52660
|
+
const isPreviewListTypeRef = vue.computed(
|
|
52661
|
+
() => listTypeRef.value === "preview-list"
|
|
52662
|
+
);
|
|
52579
52663
|
const renderFileList = () => mergedFileListRef.value.map((file) => /* @__PURE__ */ vue.h(
|
|
52580
52664
|
UUploadFile,
|
|
52581
52665
|
{
|
|
@@ -52589,6 +52673,21 @@
|
|
|
52589
52673
|
const renderUploadFileList = () => isImageCardTypeRef.value ? /* @__PURE__ */ vue.h(_UImageGroup, { ...imageGroupPropsRef.value }, { default: renderFileList }) : /* @__PURE__ */ vue.h(FadeInExpandTransition, { group: true }, {
|
|
52590
52674
|
default: renderFileList
|
|
52591
52675
|
});
|
|
52676
|
+
const renderPreview = () => /* @__PURE__ */ vue.h(
|
|
52677
|
+
_UImageGroup,
|
|
52678
|
+
{
|
|
52679
|
+
...imageGroupPropsRef.value,
|
|
52680
|
+
srcList: previewSrcListRef.value,
|
|
52681
|
+
show: previewShowRef.value,
|
|
52682
|
+
current: previewCurrentRef.value,
|
|
52683
|
+
onUpdateShow: (show) => {
|
|
52684
|
+
previewShowRef.value = show;
|
|
52685
|
+
},
|
|
52686
|
+
onUpdateCurrent: (current) => {
|
|
52687
|
+
previewCurrentRef.value = current;
|
|
52688
|
+
}
|
|
52689
|
+
}
|
|
52690
|
+
);
|
|
52592
52691
|
return () => {
|
|
52593
52692
|
const { value: mergedClsPrefix } = mergedClsPrefixRef;
|
|
52594
52693
|
const { value: abstract } = abstractRef;
|
|
@@ -52607,6 +52706,7 @@
|
|
|
52607
52706
|
]
|
|
52608
52707
|
},
|
|
52609
52708
|
renderUploadFileList(),
|
|
52709
|
+
isPreviewListTypeRef.value && renderPreview(),
|
|
52610
52710
|
showTriggerRef.value && !maxReachedRef.value && isImageCardTypeRef.value && /* @__PURE__ */ vue.h(_UUploadTrigger, null, slots)
|
|
52611
52711
|
);
|
|
52612
52712
|
};
|
|
@@ -52872,119 +52972,6 @@
|
|
|
52872
52972
|
};
|
|
52873
52973
|
}
|
|
52874
52974
|
|
|
52875
|
-
const uploadProps = {
|
|
52876
|
-
...useTheme.props,
|
|
52877
|
-
name: {
|
|
52878
|
-
type: String,
|
|
52879
|
-
default: "file"
|
|
52880
|
-
},
|
|
52881
|
-
accept: String,
|
|
52882
|
-
action: String,
|
|
52883
|
-
customRequest: Function,
|
|
52884
|
-
directory: Boolean,
|
|
52885
|
-
directoryDnd: { type: Boolean, default: void 0 },
|
|
52886
|
-
method: {
|
|
52887
|
-
type: String,
|
|
52888
|
-
default: "POST"
|
|
52889
|
-
},
|
|
52890
|
-
multiple: Boolean,
|
|
52891
|
-
showFileList: {
|
|
52892
|
-
type: Boolean,
|
|
52893
|
-
default: true
|
|
52894
|
-
},
|
|
52895
|
-
data: [Object, Function],
|
|
52896
|
-
headers: [Object, Function],
|
|
52897
|
-
withCredentials: Boolean,
|
|
52898
|
-
responseType: {
|
|
52899
|
-
type: String,
|
|
52900
|
-
default: ""
|
|
52901
|
-
},
|
|
52902
|
-
disabled: {
|
|
52903
|
-
type: Boolean,
|
|
52904
|
-
default: void 0
|
|
52905
|
-
},
|
|
52906
|
-
vertical: {
|
|
52907
|
-
type: Boolean,
|
|
52908
|
-
default: false
|
|
52909
|
-
},
|
|
52910
|
-
icon: Object,
|
|
52911
|
-
onChange: Function,
|
|
52912
|
-
onRemove: Function,
|
|
52913
|
-
onFinish: Function,
|
|
52914
|
-
onError: Function,
|
|
52915
|
-
onRetry: Function,
|
|
52916
|
-
onBeforeUpload: Function,
|
|
52917
|
-
isErrorState: Function,
|
|
52918
|
-
/** currently not used */
|
|
52919
|
-
onDownload: Function,
|
|
52920
|
-
defaultUpload: {
|
|
52921
|
-
type: Boolean,
|
|
52922
|
-
default: true
|
|
52923
|
-
},
|
|
52924
|
-
fileList: Array,
|
|
52925
|
-
"onUpdate:fileList": [Function, Array],
|
|
52926
|
-
onUpdateFileList: [Function, Array],
|
|
52927
|
-
fileListClass: String,
|
|
52928
|
-
fileListStyle: [String, Object],
|
|
52929
|
-
defaultFileList: {
|
|
52930
|
-
type: Array,
|
|
52931
|
-
default: () => []
|
|
52932
|
-
},
|
|
52933
|
-
showCancelButton: {
|
|
52934
|
-
type: Boolean,
|
|
52935
|
-
default: true
|
|
52936
|
-
},
|
|
52937
|
-
showRemoveButton: {
|
|
52938
|
-
type: Boolean,
|
|
52939
|
-
default: true
|
|
52940
|
-
},
|
|
52941
|
-
showDownloadButton: Boolean,
|
|
52942
|
-
showRetryButton: {
|
|
52943
|
-
type: Boolean,
|
|
52944
|
-
default: true
|
|
52945
|
-
},
|
|
52946
|
-
customDownload: Function,
|
|
52947
|
-
showPreviewButton: {
|
|
52948
|
-
type: Boolean,
|
|
52949
|
-
default: true
|
|
52950
|
-
},
|
|
52951
|
-
listType: {
|
|
52952
|
-
type: String,
|
|
52953
|
-
default: "text"
|
|
52954
|
-
},
|
|
52955
|
-
onPreview: Function,
|
|
52956
|
-
shouldUseThumbnailUrl: {
|
|
52957
|
-
type: Function,
|
|
52958
|
-
default: (file) => {
|
|
52959
|
-
if (!environmentSupportFile)
|
|
52960
|
-
return false;
|
|
52961
|
-
return isImageFile(file);
|
|
52962
|
-
}
|
|
52963
|
-
},
|
|
52964
|
-
createThumbnailUrl: Function,
|
|
52965
|
-
abstract: Boolean,
|
|
52966
|
-
max: Number,
|
|
52967
|
-
showTrigger: {
|
|
52968
|
-
type: Boolean,
|
|
52969
|
-
default: true
|
|
52970
|
-
},
|
|
52971
|
-
imageGroupProps: Object,
|
|
52972
|
-
inputProps: Object,
|
|
52973
|
-
triggerClass: String,
|
|
52974
|
-
triggerStyle: [String, Object],
|
|
52975
|
-
renderIcon: Function,
|
|
52976
|
-
label: String,
|
|
52977
|
-
size: {
|
|
52978
|
-
type: String,
|
|
52979
|
-
default: "medium"
|
|
52980
|
-
},
|
|
52981
|
-
title: String,
|
|
52982
|
-
subtitle: String,
|
|
52983
|
-
noIcon: {
|
|
52984
|
-
type: Boolean,
|
|
52985
|
-
default: false
|
|
52986
|
-
}
|
|
52987
|
-
};
|
|
52988
52975
|
var _UUpload = vue.defineComponent({
|
|
52989
52976
|
name: "Upload",
|
|
52990
52977
|
props: uploadProps,
|
|
@@ -53034,15 +53021,15 @@
|
|
|
53034
53021
|
function openFileDialog() {
|
|
53035
53022
|
inputElRef.value?.click();
|
|
53036
53023
|
}
|
|
53037
|
-
function handleFileInputChange(
|
|
53038
|
-
const target =
|
|
53024
|
+
function handleFileInputChange(event) {
|
|
53025
|
+
const target = event.target;
|
|
53039
53026
|
handleFileAddition(
|
|
53040
53027
|
target.files ? Array.from(target.files).map((file) => ({
|
|
53041
53028
|
file,
|
|
53042
53029
|
entry: null,
|
|
53043
53030
|
source: "input"
|
|
53044
53031
|
})) : null,
|
|
53045
|
-
|
|
53032
|
+
event
|
|
53046
53033
|
);
|
|
53047
53034
|
target.value = "";
|
|
53048
53035
|
}
|
|
@@ -53062,12 +53049,12 @@
|
|
|
53062
53049
|
uploadKeyIndexRef.value += 1;
|
|
53063
53050
|
return key;
|
|
53064
53051
|
}
|
|
53065
|
-
function handleFileAddition(fileAndEntries,
|
|
53052
|
+
function handleFileAddition(fileAndEntries, event) {
|
|
53066
53053
|
if (!fileAndEntries || fileAndEntries.length === 0)
|
|
53067
53054
|
return;
|
|
53068
53055
|
const { onBeforeUpload } = props;
|
|
53069
53056
|
fileAndEntries = mergedMultipleRef.value ? fileAndEntries : [fileAndEntries[0]];
|
|
53070
|
-
const { max, accept } = props;
|
|
53057
|
+
const { max, accept, maxSize } = props;
|
|
53071
53058
|
fileAndEntries = fileAndEntries.filter(({ file, source }) => {
|
|
53072
53059
|
if (source === "dnd" && accept?.trim()) {
|
|
53073
53060
|
return matchType(file.name, file.type, accept);
|
|
@@ -53096,6 +53083,10 @@
|
|
|
53096
53083
|
thumbnailUrl: null,
|
|
53097
53084
|
fullPath: entry?.fullPath ?? `/${file.webkitRelativePath || file.name}`
|
|
53098
53085
|
};
|
|
53086
|
+
if (isFileSizeExceeded(file, maxSize)) {
|
|
53087
|
+
fileInfo.status = "error";
|
|
53088
|
+
return fileInfo;
|
|
53089
|
+
}
|
|
53099
53090
|
if (!onBeforeUpload || await onBeforeUpload({
|
|
53100
53091
|
file: fileInfo,
|
|
53101
53092
|
fileList: mergedFileListRef.value
|
|
@@ -53108,7 +53099,7 @@
|
|
|
53108
53099
|
let nextTickChain = Promise.resolve();
|
|
53109
53100
|
fileInfos.forEach((fileInfo) => {
|
|
53110
53101
|
nextTickChain = nextTickChain.then(vue.nextTick).then(() => {
|
|
53111
|
-
fileInfo && doChange(fileInfo,
|
|
53102
|
+
fileInfo && doChange(fileInfo, event, {
|
|
53112
53103
|
append: true
|
|
53113
53104
|
});
|
|
53114
53105
|
});
|
|
@@ -53135,6 +53126,15 @@
|
|
|
53135
53126
|
filesToUpload.forEach((file) => {
|
|
53136
53127
|
const { status } = file;
|
|
53137
53128
|
if (status === "pending" || status === "error" && shouldReupload) {
|
|
53129
|
+
if (isFileSizeExceeded(file.file, props.maxSize)) {
|
|
53130
|
+
if (status === "pending") {
|
|
53131
|
+
const fileAfterChange = Object.assign({}, file, {
|
|
53132
|
+
status: "error"
|
|
53133
|
+
});
|
|
53134
|
+
doChange(fileAfterChange);
|
|
53135
|
+
}
|
|
53136
|
+
return;
|
|
53137
|
+
}
|
|
53138
53138
|
if (props.customRequest) {
|
|
53139
53139
|
customSubmitImpl({
|
|
53140
53140
|
inst: {
|
|
@@ -53215,6 +53215,26 @@
|
|
|
53215
53215
|
}
|
|
53216
53216
|
return "";
|
|
53217
53217
|
}
|
|
53218
|
+
function isFilePreviewable(file) {
|
|
53219
|
+
return props.shouldUseThumbnailUrl(file) && getFilePreviewSrc(file) !== null;
|
|
53220
|
+
}
|
|
53221
|
+
const previewFileListRef = vue.computed(
|
|
53222
|
+
() => mergedFileListRef.value.filter(isFilePreviewable)
|
|
53223
|
+
);
|
|
53224
|
+
const previewSrcListRef = vue.computed(
|
|
53225
|
+
() => previewFileListRef.value.map((file) => getFilePreviewSrc(file))
|
|
53226
|
+
);
|
|
53227
|
+
const previewShowRef = vue.ref(false);
|
|
53228
|
+
const previewCurrentRef = vue.ref(0);
|
|
53229
|
+
function openFilePreview(file) {
|
|
53230
|
+
const index = previewFileListRef.value.findIndex(
|
|
53231
|
+
({ id }) => id === file.id
|
|
53232
|
+
);
|
|
53233
|
+
if (index < 0)
|
|
53234
|
+
return;
|
|
53235
|
+
previewCurrentRef.value = index;
|
|
53236
|
+
previewShowRef.value = true;
|
|
53237
|
+
}
|
|
53218
53238
|
const cssVarsRef = vue.computed(() => {
|
|
53219
53239
|
const { value: size } = formItem.mergedSizeRef;
|
|
53220
53240
|
const {
|
|
@@ -53334,7 +53354,12 @@
|
|
|
53334
53354
|
imageGroupPropsRef: vue.toRef(props, "imageGroupProps"),
|
|
53335
53355
|
mergedDirectoryDndRef: vue.computed(() => {
|
|
53336
53356
|
return props.directoryDnd ?? props.directory;
|
|
53337
|
-
})
|
|
53357
|
+
}),
|
|
53358
|
+
previewSrcListRef,
|
|
53359
|
+
previewShowRef,
|
|
53360
|
+
previewCurrentRef,
|
|
53361
|
+
isFilePreviewable,
|
|
53362
|
+
openFilePreview
|
|
53338
53363
|
});
|
|
53339
53364
|
const exposedMethods = {
|
|
53340
53365
|
clear: () => {
|
|
@@ -54837,6 +54862,12 @@
|
|
|
54837
54862
|
);
|
|
54838
54863
|
return url ?? null;
|
|
54839
54864
|
};
|
|
54865
|
+
const getAttachmentUrl = (attachment) => {
|
|
54866
|
+
if (!attachment.url || attachment.url === "#")
|
|
54867
|
+
return null;
|
|
54868
|
+
return attachment.url;
|
|
54869
|
+
};
|
|
54870
|
+
const isAttachmentPreviewable = (file) => Boolean(file.thumbnailUrl);
|
|
54840
54871
|
const handleAttachmentDownload = async (file) => {
|
|
54841
54872
|
if (props.onAttachmentDownload) {
|
|
54842
54873
|
const attachment = normalizedAttachmentsRef.value.find(
|
|
@@ -54877,7 +54908,7 @@
|
|
|
54877
54908
|
name: attachment.name,
|
|
54878
54909
|
status: attachment.status || MessageBubbleAttachmentStatus.FINISHED,
|
|
54879
54910
|
percentage: attachment.percentage ?? null,
|
|
54880
|
-
url: attachment
|
|
54911
|
+
url: getAttachmentUrl(attachment),
|
|
54881
54912
|
thumbnailUrl: getThumbnailUrl(attachment),
|
|
54882
54913
|
type: attachment.type ?? null,
|
|
54883
54914
|
file: null,
|
|
@@ -54888,6 +54919,8 @@
|
|
|
54888
54919
|
_UUpload,
|
|
54889
54920
|
{
|
|
54890
54921
|
abstract: true,
|
|
54922
|
+
listType: "preview-list",
|
|
54923
|
+
shouldUseThumbnailUrl: isAttachmentPreviewable,
|
|
54891
54924
|
fileList,
|
|
54892
54925
|
fileListStyle: withPadding ? {
|
|
54893
54926
|
display: "flex",
|
|
@@ -117097,7 +117130,7 @@ ${icon.label}`.toLowerCase()
|
|
|
117097
117130
|
});
|
|
117098
117131
|
}
|
|
117099
117132
|
|
|
117100
|
-
var version = "2.3.
|
|
117133
|
+
var version = "2.3.2";
|
|
117101
117134
|
|
|
117102
117135
|
function create({
|
|
117103
117136
|
componentPrefix = "U",
|