@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.mjs
CHANGED
|
@@ -15756,7 +15756,7 @@ var RemoveIcon = defineComponent({
|
|
|
15756
15756
|
}
|
|
15757
15757
|
});
|
|
15758
15758
|
|
|
15759
|
-
|
|
15759
|
+
defineComponent({
|
|
15760
15760
|
name: "ResizeSmall",
|
|
15761
15761
|
render() {
|
|
15762
15762
|
return /* @__PURE__ */ h("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 20 20" }, /* @__PURE__ */ h("g", { fill: "none" }, /* @__PURE__ */ h(
|
|
@@ -46762,6 +46762,283 @@ var _UUl = defineComponent({
|
|
|
46762
46762
|
}
|
|
46763
46763
|
});
|
|
46764
46764
|
|
|
46765
|
+
function isImageFileType(type) {
|
|
46766
|
+
return type.includes("image/");
|
|
46767
|
+
}
|
|
46768
|
+
function getExtname(url = "") {
|
|
46769
|
+
const temp = url.split("/");
|
|
46770
|
+
const filename = temp[temp.length - 1];
|
|
46771
|
+
const filenameWithoutSuffix = filename.split(/#|\?/)[0];
|
|
46772
|
+
return (/\.[^./\\]*$/.exec(filenameWithoutSuffix) || [""])[0];
|
|
46773
|
+
}
|
|
46774
|
+
const imageExtensionRegex = /(webp|svg|png|gif|jpg|jpeg|jfif|bmp|dpg|ico)$/i;
|
|
46775
|
+
function capitalizeFirstLetter(str) {
|
|
46776
|
+
if (!str) return str;
|
|
46777
|
+
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
46778
|
+
}
|
|
46779
|
+
const isImageFile = file => {
|
|
46780
|
+
if (file.type) {
|
|
46781
|
+
return isImageFileType(file.type);
|
|
46782
|
+
}
|
|
46783
|
+
const fileNameExtension = getExtname(file.name || "");
|
|
46784
|
+
if (imageExtensionRegex.test(fileNameExtension)) {
|
|
46785
|
+
return true;
|
|
46786
|
+
}
|
|
46787
|
+
const url = file.thumbnailUrl || file.url || "";
|
|
46788
|
+
const urlExtension = getExtname(url);
|
|
46789
|
+
if (/^data:image\//.test(url) || imageExtensionRegex.test(urlExtension)) {
|
|
46790
|
+
return true;
|
|
46791
|
+
}
|
|
46792
|
+
return false;
|
|
46793
|
+
};
|
|
46794
|
+
async function createImageDataUrl(file) {
|
|
46795
|
+
return await new Promise(resolve => {
|
|
46796
|
+
if (!file.type || !isImageFileType(file.type)) {
|
|
46797
|
+
resolve("");
|
|
46798
|
+
return;
|
|
46799
|
+
}
|
|
46800
|
+
resolve(window.URL.createObjectURL(file));
|
|
46801
|
+
});
|
|
46802
|
+
}
|
|
46803
|
+
const environmentSupportFile = isBrowser$1 && window.FileReader && window.File;
|
|
46804
|
+
function isFileSystemDirectoryEntry(item) {
|
|
46805
|
+
return item.isDirectory;
|
|
46806
|
+
}
|
|
46807
|
+
function isFileSystemFileEntry(item) {
|
|
46808
|
+
return item.isFile;
|
|
46809
|
+
}
|
|
46810
|
+
async function getFilesFromEntries(entries, directory) {
|
|
46811
|
+
const fileAndEntries = [];
|
|
46812
|
+
let _resolve;
|
|
46813
|
+
let requestCallbackCount = 0;
|
|
46814
|
+
function lock() {
|
|
46815
|
+
requestCallbackCount++;
|
|
46816
|
+
}
|
|
46817
|
+
function unlock() {
|
|
46818
|
+
requestCallbackCount--;
|
|
46819
|
+
if (!requestCallbackCount) {
|
|
46820
|
+
_resolve(fileAndEntries);
|
|
46821
|
+
}
|
|
46822
|
+
}
|
|
46823
|
+
function _getFilesFromEntries(entries2) {
|
|
46824
|
+
entries2.forEach(entry => {
|
|
46825
|
+
if (!entry) return;
|
|
46826
|
+
lock();
|
|
46827
|
+
if (directory && isFileSystemDirectoryEntry(entry)) {
|
|
46828
|
+
const directoryReader = entry.createReader();
|
|
46829
|
+
lock();
|
|
46830
|
+
directoryReader.readEntries(entries3 => {
|
|
46831
|
+
_getFilesFromEntries(entries3);
|
|
46832
|
+
unlock();
|
|
46833
|
+
}, () => {
|
|
46834
|
+
unlock();
|
|
46835
|
+
});
|
|
46836
|
+
} else if (isFileSystemFileEntry(entry)) {
|
|
46837
|
+
lock();
|
|
46838
|
+
entry.file(file => {
|
|
46839
|
+
fileAndEntries.push({
|
|
46840
|
+
file,
|
|
46841
|
+
entry,
|
|
46842
|
+
source: "dnd"
|
|
46843
|
+
});
|
|
46844
|
+
unlock();
|
|
46845
|
+
}, () => {
|
|
46846
|
+
unlock();
|
|
46847
|
+
});
|
|
46848
|
+
}
|
|
46849
|
+
unlock();
|
|
46850
|
+
});
|
|
46851
|
+
}
|
|
46852
|
+
await new Promise(resolve => {
|
|
46853
|
+
_resolve = resolve;
|
|
46854
|
+
_getFilesFromEntries(entries);
|
|
46855
|
+
});
|
|
46856
|
+
return fileAndEntries;
|
|
46857
|
+
}
|
|
46858
|
+
function getFilePreviewSrc(file) {
|
|
46859
|
+
return file.url || file.thumbnailUrl || null;
|
|
46860
|
+
}
|
|
46861
|
+
function isFileSizeExceeded(file, maxSize) {
|
|
46862
|
+
if (maxSize === void 0 || !file) return false;
|
|
46863
|
+
return file.size > maxSize;
|
|
46864
|
+
}
|
|
46865
|
+
function createSettledFileInfo(fileInfo) {
|
|
46866
|
+
const {
|
|
46867
|
+
id,
|
|
46868
|
+
name,
|
|
46869
|
+
percentage,
|
|
46870
|
+
status,
|
|
46871
|
+
url,
|
|
46872
|
+
file,
|
|
46873
|
+
thumbnailUrl,
|
|
46874
|
+
type,
|
|
46875
|
+
fullPath,
|
|
46876
|
+
batchId
|
|
46877
|
+
} = fileInfo;
|
|
46878
|
+
return {
|
|
46879
|
+
id,
|
|
46880
|
+
name,
|
|
46881
|
+
percentage: percentage ?? null,
|
|
46882
|
+
status,
|
|
46883
|
+
url: url ?? null,
|
|
46884
|
+
file: file ?? null,
|
|
46885
|
+
thumbnailUrl: thumbnailUrl ?? null,
|
|
46886
|
+
type: type ?? null,
|
|
46887
|
+
fullPath: fullPath ?? null,
|
|
46888
|
+
batchId: batchId ?? null
|
|
46889
|
+
};
|
|
46890
|
+
}
|
|
46891
|
+
function matchType(name, mimeType, accept) {
|
|
46892
|
+
name = name.toLowerCase();
|
|
46893
|
+
mimeType = mimeType.toLocaleLowerCase();
|
|
46894
|
+
accept = accept.toLocaleLowerCase();
|
|
46895
|
+
const acceptAtoms = accept.split(",").map(acceptAtom => acceptAtom.trim()).filter(Boolean);
|
|
46896
|
+
return acceptAtoms.some(acceptAtom => {
|
|
46897
|
+
if (acceptAtom.startsWith(".")) {
|
|
46898
|
+
if (name.endsWith(acceptAtom)) return true;
|
|
46899
|
+
} else if (acceptAtom.includes("/")) {
|
|
46900
|
+
const [type, subtype] = mimeType.split("/");
|
|
46901
|
+
const [acceptType, acceptSubtype] = acceptAtom.split("/");
|
|
46902
|
+
if (acceptType === "*" || type && acceptType && acceptType === type) {
|
|
46903
|
+
if (acceptSubtype === "*" || subtype && acceptSubtype && acceptSubtype === subtype) {
|
|
46904
|
+
return true;
|
|
46905
|
+
}
|
|
46906
|
+
}
|
|
46907
|
+
} else {
|
|
46908
|
+
return true;
|
|
46909
|
+
}
|
|
46910
|
+
return false;
|
|
46911
|
+
});
|
|
46912
|
+
}
|
|
46913
|
+
function download(url, name) {
|
|
46914
|
+
if (!url) return;
|
|
46915
|
+
const a = document.createElement("a");
|
|
46916
|
+
a.href = url;
|
|
46917
|
+
if (name !== void 0) {
|
|
46918
|
+
a.download = name;
|
|
46919
|
+
}
|
|
46920
|
+
document.body.appendChild(a);
|
|
46921
|
+
a.click();
|
|
46922
|
+
document.body.removeChild(a);
|
|
46923
|
+
}
|
|
46924
|
+
|
|
46925
|
+
const uploadInjectionKey = createInjectionKey("u-upload");
|
|
46926
|
+
const uploadProps = {
|
|
46927
|
+
...useTheme.props,
|
|
46928
|
+
name: {
|
|
46929
|
+
type: String,
|
|
46930
|
+
default: "file"
|
|
46931
|
+
},
|
|
46932
|
+
accept: String,
|
|
46933
|
+
action: String,
|
|
46934
|
+
customRequest: Function,
|
|
46935
|
+
directory: Boolean,
|
|
46936
|
+
directoryDnd: {
|
|
46937
|
+
type: Boolean,
|
|
46938
|
+
default: void 0
|
|
46939
|
+
},
|
|
46940
|
+
method: {
|
|
46941
|
+
type: String,
|
|
46942
|
+
default: "POST"
|
|
46943
|
+
},
|
|
46944
|
+
multiple: Boolean,
|
|
46945
|
+
showFileList: {
|
|
46946
|
+
type: Boolean,
|
|
46947
|
+
default: true
|
|
46948
|
+
},
|
|
46949
|
+
data: [Object, Function],
|
|
46950
|
+
headers: [Object, Function],
|
|
46951
|
+
withCredentials: Boolean,
|
|
46952
|
+
responseType: {
|
|
46953
|
+
type: String,
|
|
46954
|
+
default: ""
|
|
46955
|
+
},
|
|
46956
|
+
disabled: {
|
|
46957
|
+
type: Boolean,
|
|
46958
|
+
default: void 0
|
|
46959
|
+
},
|
|
46960
|
+
vertical: {
|
|
46961
|
+
type: Boolean,
|
|
46962
|
+
default: false
|
|
46963
|
+
},
|
|
46964
|
+
icon: Object,
|
|
46965
|
+
onChange: Function,
|
|
46966
|
+
onRemove: Function,
|
|
46967
|
+
onFinish: Function,
|
|
46968
|
+
onError: Function,
|
|
46969
|
+
onRetry: Function,
|
|
46970
|
+
onBeforeUpload: Function,
|
|
46971
|
+
isErrorState: Function,
|
|
46972
|
+
onDownload: Function,
|
|
46973
|
+
defaultUpload: {
|
|
46974
|
+
type: Boolean,
|
|
46975
|
+
default: true
|
|
46976
|
+
},
|
|
46977
|
+
fileList: Array,
|
|
46978
|
+
"onUpdate:fileList": [Function, Array],
|
|
46979
|
+
onUpdateFileList: [Function, Array],
|
|
46980
|
+
fileListClass: String,
|
|
46981
|
+
fileListStyle: [String, Object],
|
|
46982
|
+
defaultFileList: {
|
|
46983
|
+
type: Array,
|
|
46984
|
+
default: () => []
|
|
46985
|
+
},
|
|
46986
|
+
showCancelButton: {
|
|
46987
|
+
type: Boolean,
|
|
46988
|
+
default: true
|
|
46989
|
+
},
|
|
46990
|
+
showRemoveButton: {
|
|
46991
|
+
type: Boolean,
|
|
46992
|
+
default: true
|
|
46993
|
+
},
|
|
46994
|
+
showDownloadButton: Boolean,
|
|
46995
|
+
showRetryButton: {
|
|
46996
|
+
type: Boolean,
|
|
46997
|
+
default: true
|
|
46998
|
+
},
|
|
46999
|
+
customDownload: Function,
|
|
47000
|
+
showPreviewButton: {
|
|
47001
|
+
type: Boolean,
|
|
47002
|
+
default: true
|
|
47003
|
+
},
|
|
47004
|
+
listType: {
|
|
47005
|
+
type: String,
|
|
47006
|
+
default: "text"
|
|
47007
|
+
},
|
|
47008
|
+
onPreview: Function,
|
|
47009
|
+
shouldUseThumbnailUrl: {
|
|
47010
|
+
type: Function,
|
|
47011
|
+
default: file => {
|
|
47012
|
+
if (!environmentSupportFile) return false;
|
|
47013
|
+
return isImageFile(file);
|
|
47014
|
+
}
|
|
47015
|
+
},
|
|
47016
|
+
createThumbnailUrl: Function,
|
|
47017
|
+
abstract: Boolean,
|
|
47018
|
+
max: Number,
|
|
47019
|
+
maxSize: Number,
|
|
47020
|
+
showTrigger: {
|
|
47021
|
+
type: Boolean,
|
|
47022
|
+
default: true
|
|
47023
|
+
},
|
|
47024
|
+
imageGroupProps: Object,
|
|
47025
|
+
inputProps: Object,
|
|
47026
|
+
triggerClass: String,
|
|
47027
|
+
triggerStyle: [String, Object],
|
|
47028
|
+
renderIcon: Function,
|
|
47029
|
+
label: String,
|
|
47030
|
+
size: {
|
|
47031
|
+
type: String,
|
|
47032
|
+
default: "medium"
|
|
47033
|
+
},
|
|
47034
|
+
title: String,
|
|
47035
|
+
subtitle: String,
|
|
47036
|
+
noIcon: {
|
|
47037
|
+
type: Boolean,
|
|
47038
|
+
default: false
|
|
47039
|
+
}
|
|
47040
|
+
};
|
|
47041
|
+
|
|
46765
47042
|
function self$13(vars) {
|
|
46766
47043
|
const {
|
|
46767
47044
|
fontWeight,
|
|
@@ -46892,8 +47169,6 @@ const uploadRtl = {
|
|
|
46892
47169
|
style: rtlStyle$i
|
|
46893
47170
|
};
|
|
46894
47171
|
|
|
46895
|
-
const uploadInjectionKey = createInjectionKey("u-upload");
|
|
46896
|
-
|
|
46897
47172
|
var style$1a = c$1([cB("upload", "width: var(--u-upload-width)", [cM("dragger-inside", [cB("upload-trigger", `
|
|
46898
47173
|
display: block;
|
|
46899
47174
|
`)]), cM("drag-over", [cB("upload-dragger", `
|
|
@@ -50572,20 +50847,6 @@ const imageDark = {
|
|
|
50572
50847
|
self: self$g
|
|
50573
50848
|
};
|
|
50574
50849
|
|
|
50575
|
-
const prevIcon = /* @__PURE__ */ h("svg", { viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, /* @__PURE__ */ h(
|
|
50576
|
-
"path",
|
|
50577
|
-
{
|
|
50578
|
-
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",
|
|
50579
|
-
fill: "currentColor"
|
|
50580
|
-
}
|
|
50581
|
-
));
|
|
50582
|
-
const nextIcon = /* @__PURE__ */ h("svg", { viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, /* @__PURE__ */ h(
|
|
50583
|
-
"path",
|
|
50584
|
-
{
|
|
50585
|
-
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",
|
|
50586
|
-
fill: "currentColor"
|
|
50587
|
-
}
|
|
50588
|
-
));
|
|
50589
50850
|
const closeIcon = /* @__PURE__ */ h("svg", { viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, /* @__PURE__ */ h(
|
|
50590
50851
|
"path",
|
|
50591
50852
|
{
|
|
@@ -50593,22 +50854,6 @@ const closeIcon = /* @__PURE__ */ h("svg", { viewBox: "0 0 20 20", fill: "none",
|
|
|
50593
50854
|
fill: "currentColor"
|
|
50594
50855
|
}
|
|
50595
50856
|
));
|
|
50596
|
-
const downloadIcon = /* @__PURE__ */ h(
|
|
50597
|
-
"svg",
|
|
50598
|
-
{
|
|
50599
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
50600
|
-
width: "32",
|
|
50601
|
-
height: "32",
|
|
50602
|
-
viewBox: "0 0 1024 1024"
|
|
50603
|
-
},
|
|
50604
|
-
/* @__PURE__ */ h(
|
|
50605
|
-
"path",
|
|
50606
|
-
{
|
|
50607
|
-
fill: "currentColor",
|
|
50608
|
-
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"
|
|
50609
|
-
}
|
|
50610
|
-
)
|
|
50611
|
-
);
|
|
50612
50857
|
|
|
50613
50858
|
const imagePreviewSharedProps = {
|
|
50614
50859
|
...useTheme.props,
|
|
@@ -51058,7 +51303,8 @@ var _UImagePreview = defineComponent({
|
|
|
51058
51303
|
toolbarIconColor,
|
|
51059
51304
|
toolbarBorderRadius,
|
|
51060
51305
|
toolbarBoxShadow,
|
|
51061
|
-
toolbarColor
|
|
51306
|
+
toolbarColor,
|
|
51307
|
+
overlayColor
|
|
51062
51308
|
}
|
|
51063
51309
|
} = themeRef.value;
|
|
51064
51310
|
return {
|
|
@@ -51066,7 +51312,8 @@ var _UImagePreview = defineComponent({
|
|
|
51066
51312
|
"--u-toolbar-icon-color": toolbarIconColor,
|
|
51067
51313
|
"--u-toolbar-color": toolbarColor,
|
|
51068
51314
|
"--u-toolbar-border-radius": toolbarBorderRadius,
|
|
51069
|
-
"--u-toolbar-box-shadow": toolbarBoxShadow
|
|
51315
|
+
"--u-toolbar-box-shadow": toolbarBoxShadow,
|
|
51316
|
+
"--u-overlay-color": overlayColor
|
|
51070
51317
|
};
|
|
51071
51318
|
});
|
|
51072
51319
|
const { inlineThemeDisabled } = useConfig();
|
|
@@ -51115,14 +51362,6 @@ var _UImagePreview = defineComponent({
|
|
|
51115
51362
|
},
|
|
51116
51363
|
render() {
|
|
51117
51364
|
const { clsPrefix, renderToolbar, withTooltip } = this;
|
|
51118
|
-
const prevNode = withTooltip(
|
|
51119
|
-
/* @__PURE__ */ h(UBaseIcon, { clsPrefix, onClick: this.handleSwitchPrev }, { default: () => prevIcon }),
|
|
51120
|
-
"tipPrevious"
|
|
51121
|
-
);
|
|
51122
|
-
const nextNode = withTooltip(
|
|
51123
|
-
/* @__PURE__ */ h(UBaseIcon, { clsPrefix, onClick: this.handleSwitchNext }, { default: () => nextIcon }),
|
|
51124
|
-
"tipNext"
|
|
51125
|
-
);
|
|
51126
51365
|
const rotateCounterclockwiseNode = withTooltip(
|
|
51127
51366
|
/* @__PURE__ */ h(UBaseIcon, { clsPrefix, onClick: this.rotateCounterclockwise }, {
|
|
51128
51367
|
default: () => /* @__PURE__ */ h(RotateCounterclockwiseIcon, null)
|
|
@@ -51135,22 +51374,10 @@ var _UImagePreview = defineComponent({
|
|
|
51135
51374
|
}),
|
|
51136
51375
|
"tipClockwise"
|
|
51137
51376
|
);
|
|
51138
|
-
const originalSizeNode = withTooltip(
|
|
51139
|
-
/* @__PURE__ */ h(UBaseIcon, { clsPrefix, onClick: this.resizeToOrignalImageSize }, {
|
|
51140
|
-
default: () => {
|
|
51141
|
-
return /* @__PURE__ */ h(ResizeSmallIcon, null);
|
|
51142
|
-
}
|
|
51143
|
-
}),
|
|
51144
|
-
"tipOriginalSize"
|
|
51145
|
-
);
|
|
51146
51377
|
const zoomOutNode = withTooltip(
|
|
51147
51378
|
/* @__PURE__ */ h(UBaseIcon, { clsPrefix, onClick: this.zoomOut }, { default: () => /* @__PURE__ */ h(ZoomOutIcon, null) }),
|
|
51148
51379
|
"tipZoomOut"
|
|
51149
51380
|
);
|
|
51150
|
-
const downloadNode = withTooltip(
|
|
51151
|
-
/* @__PURE__ */ h(UBaseIcon, { clsPrefix, onClick: this.handleDownloadClick }, { default: () => downloadIcon }),
|
|
51152
|
-
"tipDownload"
|
|
51153
|
-
);
|
|
51154
51381
|
const closeNode = withTooltip(
|
|
51155
51382
|
/* @__PURE__ */ h(UBaseIcon, { clsPrefix, onClick: () => this.close() }, { default: () => closeIcon }),
|
|
51156
51383
|
"tipClose"
|
|
@@ -51192,17 +51419,13 @@ var _UImagePreview = defineComponent({
|
|
|
51192
51419
|
return null;
|
|
51193
51420
|
return /* @__PURE__ */ h("div", { class: `${clsPrefix}-image-preview-toolbar` }, renderToolbar ? renderToolbar({
|
|
51194
51421
|
nodes: {
|
|
51195
|
-
prev: prevNode,
|
|
51196
|
-
next: nextNode,
|
|
51197
51422
|
rotateCounterclockwise: rotateCounterclockwiseNode,
|
|
51198
51423
|
rotateClockwise: rotateClockwiseNode,
|
|
51199
|
-
resizeToOriginalSize: originalSizeNode,
|
|
51200
51424
|
zoomOut: zoomOutNode,
|
|
51201
51425
|
zoomIn: zoomInNode,
|
|
51202
|
-
download: downloadNode,
|
|
51203
51426
|
close: closeNode
|
|
51204
51427
|
}
|
|
51205
|
-
}) : /* @__PURE__ */ h(Fragment, null,
|
|
51428
|
+
}) : /* @__PURE__ */ h(Fragment, null, rotateCounterclockwiseNode, rotateClockwiseNode, zoomOutNode, zoomInNode, closeNode));
|
|
51206
51429
|
}
|
|
51207
51430
|
}) : null,
|
|
51208
51431
|
/* @__PURE__ */ h(
|
|
@@ -51857,7 +52080,7 @@ var _USpin = defineComponent({
|
|
|
51857
52080
|
}
|
|
51858
52081
|
});
|
|
51859
52082
|
|
|
51860
|
-
function useUploadActionsRender(
|
|
52083
|
+
function useUploadActionsRender(options) {
|
|
51861
52084
|
const {
|
|
51862
52085
|
clsPrefix,
|
|
51863
52086
|
listType,
|
|
@@ -51877,7 +52100,7 @@ function useUploadActionsRender(opts) {
|
|
|
51877
52100
|
handleRetryClick,
|
|
51878
52101
|
handleDownloadClick,
|
|
51879
52102
|
capitalizeFirstLetter
|
|
51880
|
-
} =
|
|
52103
|
+
} = options;
|
|
51881
52104
|
const getExt = (name) => {
|
|
51882
52105
|
const i = name.lastIndexOf(".");
|
|
51883
52106
|
return i === -1 || i === name.length - 1 ? "" : name.slice(i + 1);
|
|
@@ -52004,159 +52227,6 @@ function useUploadActionsRender(opts) {
|
|
|
52004
52227
|
return { icon, actionsNode };
|
|
52005
52228
|
}
|
|
52006
52229
|
|
|
52007
|
-
function isImageFileType(type) {
|
|
52008
|
-
return type.includes("image/");
|
|
52009
|
-
}
|
|
52010
|
-
function getExtname(url = "") {
|
|
52011
|
-
const temp = url.split("/");
|
|
52012
|
-
const filename = temp[temp.length - 1];
|
|
52013
|
-
const filenameWithoutSuffix = filename.split(/#|\?/)[0];
|
|
52014
|
-
return (/\.[^./\\]*$/.exec(filenameWithoutSuffix) || [""])[0];
|
|
52015
|
-
}
|
|
52016
|
-
const imageExtensionRegex = /(webp|svg|png|gif|jpg|jpeg|jfif|bmp|dpg|ico)$/i;
|
|
52017
|
-
function capitalizeFirstLetter(str) {
|
|
52018
|
-
if (!str) return str;
|
|
52019
|
-
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
52020
|
-
}
|
|
52021
|
-
const isImageFile = file => {
|
|
52022
|
-
if (file.type) {
|
|
52023
|
-
return isImageFileType(file.type);
|
|
52024
|
-
}
|
|
52025
|
-
const fileNameExtension = getExtname(file.name || "");
|
|
52026
|
-
if (imageExtensionRegex.test(fileNameExtension)) {
|
|
52027
|
-
return true;
|
|
52028
|
-
}
|
|
52029
|
-
const url = file.thumbnailUrl || file.url || "";
|
|
52030
|
-
const urlExtension = getExtname(url);
|
|
52031
|
-
if (/^data:image\//.test(url) || imageExtensionRegex.test(urlExtension)) {
|
|
52032
|
-
return true;
|
|
52033
|
-
}
|
|
52034
|
-
return false;
|
|
52035
|
-
};
|
|
52036
|
-
async function createImageDataUrl(file) {
|
|
52037
|
-
return await new Promise(resolve => {
|
|
52038
|
-
if (!file.type || !isImageFileType(file.type)) {
|
|
52039
|
-
resolve("");
|
|
52040
|
-
return;
|
|
52041
|
-
}
|
|
52042
|
-
resolve(window.URL.createObjectURL(file));
|
|
52043
|
-
});
|
|
52044
|
-
}
|
|
52045
|
-
const environmentSupportFile = isBrowser$1 && window.FileReader && window.File;
|
|
52046
|
-
function isFileSystemDirectoryEntry(item) {
|
|
52047
|
-
return item.isDirectory;
|
|
52048
|
-
}
|
|
52049
|
-
function isFileSystemFileEntry(item) {
|
|
52050
|
-
return item.isFile;
|
|
52051
|
-
}
|
|
52052
|
-
async function getFilesFromEntries(entries, directory) {
|
|
52053
|
-
const fileAndEntries = [];
|
|
52054
|
-
let _resolve;
|
|
52055
|
-
let requestCallbackCount = 0;
|
|
52056
|
-
function lock() {
|
|
52057
|
-
requestCallbackCount++;
|
|
52058
|
-
}
|
|
52059
|
-
function unlock() {
|
|
52060
|
-
requestCallbackCount--;
|
|
52061
|
-
if (!requestCallbackCount) {
|
|
52062
|
-
_resolve(fileAndEntries);
|
|
52063
|
-
}
|
|
52064
|
-
}
|
|
52065
|
-
function _getFilesFromEntries(entries2) {
|
|
52066
|
-
entries2.forEach(entry => {
|
|
52067
|
-
if (!entry) return;
|
|
52068
|
-
lock();
|
|
52069
|
-
if (directory && isFileSystemDirectoryEntry(entry)) {
|
|
52070
|
-
const directoryReader = entry.createReader();
|
|
52071
|
-
lock();
|
|
52072
|
-
directoryReader.readEntries(entries3 => {
|
|
52073
|
-
_getFilesFromEntries(entries3);
|
|
52074
|
-
unlock();
|
|
52075
|
-
}, () => {
|
|
52076
|
-
unlock();
|
|
52077
|
-
});
|
|
52078
|
-
} else if (isFileSystemFileEntry(entry)) {
|
|
52079
|
-
lock();
|
|
52080
|
-
entry.file(file => {
|
|
52081
|
-
fileAndEntries.push({
|
|
52082
|
-
file,
|
|
52083
|
-
entry,
|
|
52084
|
-
source: "dnd"
|
|
52085
|
-
});
|
|
52086
|
-
unlock();
|
|
52087
|
-
}, () => {
|
|
52088
|
-
unlock();
|
|
52089
|
-
});
|
|
52090
|
-
}
|
|
52091
|
-
unlock();
|
|
52092
|
-
});
|
|
52093
|
-
}
|
|
52094
|
-
await new Promise(resolve => {
|
|
52095
|
-
_resolve = resolve;
|
|
52096
|
-
_getFilesFromEntries(entries);
|
|
52097
|
-
});
|
|
52098
|
-
return fileAndEntries;
|
|
52099
|
-
}
|
|
52100
|
-
function createSettledFileInfo(fileInfo) {
|
|
52101
|
-
const {
|
|
52102
|
-
id,
|
|
52103
|
-
name,
|
|
52104
|
-
percentage,
|
|
52105
|
-
status,
|
|
52106
|
-
url,
|
|
52107
|
-
file,
|
|
52108
|
-
thumbnailUrl,
|
|
52109
|
-
type,
|
|
52110
|
-
fullPath,
|
|
52111
|
-
batchId
|
|
52112
|
-
} = fileInfo;
|
|
52113
|
-
return {
|
|
52114
|
-
id,
|
|
52115
|
-
name,
|
|
52116
|
-
percentage: percentage ?? null,
|
|
52117
|
-
status,
|
|
52118
|
-
url: url ?? null,
|
|
52119
|
-
file: file ?? null,
|
|
52120
|
-
thumbnailUrl: thumbnailUrl ?? null,
|
|
52121
|
-
type: type ?? null,
|
|
52122
|
-
fullPath: fullPath ?? null,
|
|
52123
|
-
batchId: batchId ?? null
|
|
52124
|
-
};
|
|
52125
|
-
}
|
|
52126
|
-
function matchType(name, mimeType, accept) {
|
|
52127
|
-
name = name.toLowerCase();
|
|
52128
|
-
mimeType = mimeType.toLocaleLowerCase();
|
|
52129
|
-
accept = accept.toLocaleLowerCase();
|
|
52130
|
-
const acceptAtoms = accept.split(",").map(acceptAtom => acceptAtom.trim()).filter(Boolean);
|
|
52131
|
-
return acceptAtoms.some(acceptAtom => {
|
|
52132
|
-
if (acceptAtom.startsWith(".")) {
|
|
52133
|
-
if (name.endsWith(acceptAtom)) return true;
|
|
52134
|
-
} else if (acceptAtom.includes("/")) {
|
|
52135
|
-
const [type, subtype] = mimeType.split("/");
|
|
52136
|
-
const [acceptType, acceptSubtype] = acceptAtom.split("/");
|
|
52137
|
-
if (acceptType === "*" || type && acceptType && acceptType === type) {
|
|
52138
|
-
if (acceptSubtype === "*" || subtype && acceptSubtype && acceptSubtype === subtype) {
|
|
52139
|
-
return true;
|
|
52140
|
-
}
|
|
52141
|
-
}
|
|
52142
|
-
} else {
|
|
52143
|
-
return true;
|
|
52144
|
-
}
|
|
52145
|
-
return false;
|
|
52146
|
-
});
|
|
52147
|
-
}
|
|
52148
|
-
function download(url, name) {
|
|
52149
|
-
if (!url) return;
|
|
52150
|
-
const a = document.createElement("a");
|
|
52151
|
-
a.href = url;
|
|
52152
|
-
if (name !== void 0) {
|
|
52153
|
-
a.download = name;
|
|
52154
|
-
}
|
|
52155
|
-
document.body.appendChild(a);
|
|
52156
|
-
a.click();
|
|
52157
|
-
document.body.removeChild(a);
|
|
52158
|
-
}
|
|
52159
|
-
|
|
52160
52230
|
const buttonThemeOverrides = {
|
|
52161
52231
|
paddingMedium: "0 3px",
|
|
52162
52232
|
heightMedium: "24px",
|
|
@@ -52234,7 +52304,12 @@ var UUploadFile = defineComponent({
|
|
|
52234
52304
|
file: { status },
|
|
52235
52305
|
listType
|
|
52236
52306
|
} = props;
|
|
52237
|
-
|
|
52307
|
+
if (!["finished"].includes(status))
|
|
52308
|
+
return false;
|
|
52309
|
+
if (listType === "preview-list") {
|
|
52310
|
+
return UUpload.isFilePreviewable(props.file);
|
|
52311
|
+
}
|
|
52312
|
+
return !!mergedThumbnailUrlRef.value && listType === "image-card";
|
|
52238
52313
|
});
|
|
52239
52314
|
async function handleRetryClick() {
|
|
52240
52315
|
const onRetry = UUpload.onRetryRef.value;
|
|
@@ -52313,6 +52388,8 @@ var UUploadFile = defineComponent({
|
|
|
52313
52388
|
} = UUpload;
|
|
52314
52389
|
if (onPreview) {
|
|
52315
52390
|
onPreview(props.file);
|
|
52391
|
+
} else if (props.listType === "preview-list") {
|
|
52392
|
+
UUpload.openFilePreview(props.file);
|
|
52316
52393
|
} else if (props.listType === "image-card") {
|
|
52317
52394
|
const { value } = imageRef;
|
|
52318
52395
|
if (!value)
|
|
@@ -52399,7 +52476,8 @@ var UUploadFile = defineComponent({
|
|
|
52399
52476
|
`${clsPrefix}-upload-file`,
|
|
52400
52477
|
`${clsPrefix}-upload-file--${this.progressStatus}-status`,
|
|
52401
52478
|
file.url && file.status !== "error" && imageCardTypes.includes(listType) && `${clsPrefix}-upload-file--with-url`,
|
|
52402
|
-
`${clsPrefix}-upload-file--${listType === "image" || listType === "image-card" ? "image-card" : "text"}-type
|
|
52479
|
+
`${clsPrefix}-upload-file--${listType === "image" || listType === "image-card" ? "image-card" : "text"}-type`,
|
|
52480
|
+
listType === "preview-list" && `${clsPrefix}-upload-file--preview-list-type`
|
|
52403
52481
|
]
|
|
52404
52482
|
},
|
|
52405
52483
|
/* @__PURE__ */ h(
|
|
@@ -52567,11 +52645,17 @@ var _UUploadFileList = defineComponent({
|
|
|
52567
52645
|
themeClassRef,
|
|
52568
52646
|
maxReachedRef,
|
|
52569
52647
|
showTriggerRef,
|
|
52570
|
-
imageGroupPropsRef
|
|
52648
|
+
imageGroupPropsRef,
|
|
52649
|
+
previewSrcListRef,
|
|
52650
|
+
previewShowRef,
|
|
52651
|
+
previewCurrentRef
|
|
52571
52652
|
} = UUpload;
|
|
52572
52653
|
const isImageCardTypeRef = computed(
|
|
52573
52654
|
() => listTypeRef.value === "image-card" || listTypeRef.value === "image"
|
|
52574
52655
|
);
|
|
52656
|
+
const isPreviewListTypeRef = computed(
|
|
52657
|
+
() => listTypeRef.value === "preview-list"
|
|
52658
|
+
);
|
|
52575
52659
|
const renderFileList = () => mergedFileListRef.value.map((file) => /* @__PURE__ */ h(
|
|
52576
52660
|
UUploadFile,
|
|
52577
52661
|
{
|
|
@@ -52585,6 +52669,21 @@ var _UUploadFileList = defineComponent({
|
|
|
52585
52669
|
const renderUploadFileList = () => isImageCardTypeRef.value ? /* @__PURE__ */ h(_UImageGroup, { ...imageGroupPropsRef.value }, { default: renderFileList }) : /* @__PURE__ */ h(FadeInExpandTransition, { group: true }, {
|
|
52586
52670
|
default: renderFileList
|
|
52587
52671
|
});
|
|
52672
|
+
const renderPreview = () => /* @__PURE__ */ h(
|
|
52673
|
+
_UImageGroup,
|
|
52674
|
+
{
|
|
52675
|
+
...imageGroupPropsRef.value,
|
|
52676
|
+
srcList: previewSrcListRef.value,
|
|
52677
|
+
show: previewShowRef.value,
|
|
52678
|
+
current: previewCurrentRef.value,
|
|
52679
|
+
onUpdateShow: (show) => {
|
|
52680
|
+
previewShowRef.value = show;
|
|
52681
|
+
},
|
|
52682
|
+
onUpdateCurrent: (current) => {
|
|
52683
|
+
previewCurrentRef.value = current;
|
|
52684
|
+
}
|
|
52685
|
+
}
|
|
52686
|
+
);
|
|
52588
52687
|
return () => {
|
|
52589
52688
|
const { value: mergedClsPrefix } = mergedClsPrefixRef;
|
|
52590
52689
|
const { value: abstract } = abstractRef;
|
|
@@ -52603,6 +52702,7 @@ var _UUploadFileList = defineComponent({
|
|
|
52603
52702
|
]
|
|
52604
52703
|
},
|
|
52605
52704
|
renderUploadFileList(),
|
|
52705
|
+
isPreviewListTypeRef.value && renderPreview(),
|
|
52606
52706
|
showTriggerRef.value && !maxReachedRef.value && isImageCardTypeRef.value && /* @__PURE__ */ h(_UUploadTrigger, null, slots)
|
|
52607
52707
|
);
|
|
52608
52708
|
};
|
|
@@ -52868,119 +52968,6 @@ function useUploadInternals(options) {
|
|
|
52868
52968
|
};
|
|
52869
52969
|
}
|
|
52870
52970
|
|
|
52871
|
-
const uploadProps = {
|
|
52872
|
-
...useTheme.props,
|
|
52873
|
-
name: {
|
|
52874
|
-
type: String,
|
|
52875
|
-
default: "file"
|
|
52876
|
-
},
|
|
52877
|
-
accept: String,
|
|
52878
|
-
action: String,
|
|
52879
|
-
customRequest: Function,
|
|
52880
|
-
directory: Boolean,
|
|
52881
|
-
directoryDnd: { type: Boolean, default: void 0 },
|
|
52882
|
-
method: {
|
|
52883
|
-
type: String,
|
|
52884
|
-
default: "POST"
|
|
52885
|
-
},
|
|
52886
|
-
multiple: Boolean,
|
|
52887
|
-
showFileList: {
|
|
52888
|
-
type: Boolean,
|
|
52889
|
-
default: true
|
|
52890
|
-
},
|
|
52891
|
-
data: [Object, Function],
|
|
52892
|
-
headers: [Object, Function],
|
|
52893
|
-
withCredentials: Boolean,
|
|
52894
|
-
responseType: {
|
|
52895
|
-
type: String,
|
|
52896
|
-
default: ""
|
|
52897
|
-
},
|
|
52898
|
-
disabled: {
|
|
52899
|
-
type: Boolean,
|
|
52900
|
-
default: void 0
|
|
52901
|
-
},
|
|
52902
|
-
vertical: {
|
|
52903
|
-
type: Boolean,
|
|
52904
|
-
default: false
|
|
52905
|
-
},
|
|
52906
|
-
icon: Object,
|
|
52907
|
-
onChange: Function,
|
|
52908
|
-
onRemove: Function,
|
|
52909
|
-
onFinish: Function,
|
|
52910
|
-
onError: Function,
|
|
52911
|
-
onRetry: Function,
|
|
52912
|
-
onBeforeUpload: Function,
|
|
52913
|
-
isErrorState: Function,
|
|
52914
|
-
/** currently not used */
|
|
52915
|
-
onDownload: Function,
|
|
52916
|
-
defaultUpload: {
|
|
52917
|
-
type: Boolean,
|
|
52918
|
-
default: true
|
|
52919
|
-
},
|
|
52920
|
-
fileList: Array,
|
|
52921
|
-
"onUpdate:fileList": [Function, Array],
|
|
52922
|
-
onUpdateFileList: [Function, Array],
|
|
52923
|
-
fileListClass: String,
|
|
52924
|
-
fileListStyle: [String, Object],
|
|
52925
|
-
defaultFileList: {
|
|
52926
|
-
type: Array,
|
|
52927
|
-
default: () => []
|
|
52928
|
-
},
|
|
52929
|
-
showCancelButton: {
|
|
52930
|
-
type: Boolean,
|
|
52931
|
-
default: true
|
|
52932
|
-
},
|
|
52933
|
-
showRemoveButton: {
|
|
52934
|
-
type: Boolean,
|
|
52935
|
-
default: true
|
|
52936
|
-
},
|
|
52937
|
-
showDownloadButton: Boolean,
|
|
52938
|
-
showRetryButton: {
|
|
52939
|
-
type: Boolean,
|
|
52940
|
-
default: true
|
|
52941
|
-
},
|
|
52942
|
-
customDownload: Function,
|
|
52943
|
-
showPreviewButton: {
|
|
52944
|
-
type: Boolean,
|
|
52945
|
-
default: true
|
|
52946
|
-
},
|
|
52947
|
-
listType: {
|
|
52948
|
-
type: String,
|
|
52949
|
-
default: "text"
|
|
52950
|
-
},
|
|
52951
|
-
onPreview: Function,
|
|
52952
|
-
shouldUseThumbnailUrl: {
|
|
52953
|
-
type: Function,
|
|
52954
|
-
default: (file) => {
|
|
52955
|
-
if (!environmentSupportFile)
|
|
52956
|
-
return false;
|
|
52957
|
-
return isImageFile(file);
|
|
52958
|
-
}
|
|
52959
|
-
},
|
|
52960
|
-
createThumbnailUrl: Function,
|
|
52961
|
-
abstract: Boolean,
|
|
52962
|
-
max: Number,
|
|
52963
|
-
showTrigger: {
|
|
52964
|
-
type: Boolean,
|
|
52965
|
-
default: true
|
|
52966
|
-
},
|
|
52967
|
-
imageGroupProps: Object,
|
|
52968
|
-
inputProps: Object,
|
|
52969
|
-
triggerClass: String,
|
|
52970
|
-
triggerStyle: [String, Object],
|
|
52971
|
-
renderIcon: Function,
|
|
52972
|
-
label: String,
|
|
52973
|
-
size: {
|
|
52974
|
-
type: String,
|
|
52975
|
-
default: "medium"
|
|
52976
|
-
},
|
|
52977
|
-
title: String,
|
|
52978
|
-
subtitle: String,
|
|
52979
|
-
noIcon: {
|
|
52980
|
-
type: Boolean,
|
|
52981
|
-
default: false
|
|
52982
|
-
}
|
|
52983
|
-
};
|
|
52984
52971
|
var _UUpload = defineComponent({
|
|
52985
52972
|
name: "Upload",
|
|
52986
52973
|
props: uploadProps,
|
|
@@ -53030,15 +53017,15 @@ var _UUpload = defineComponent({
|
|
|
53030
53017
|
function openFileDialog() {
|
|
53031
53018
|
inputElRef.value?.click();
|
|
53032
53019
|
}
|
|
53033
|
-
function handleFileInputChange(
|
|
53034
|
-
const target =
|
|
53020
|
+
function handleFileInputChange(event) {
|
|
53021
|
+
const target = event.target;
|
|
53035
53022
|
handleFileAddition(
|
|
53036
53023
|
target.files ? Array.from(target.files).map((file) => ({
|
|
53037
53024
|
file,
|
|
53038
53025
|
entry: null,
|
|
53039
53026
|
source: "input"
|
|
53040
53027
|
})) : null,
|
|
53041
|
-
|
|
53028
|
+
event
|
|
53042
53029
|
);
|
|
53043
53030
|
target.value = "";
|
|
53044
53031
|
}
|
|
@@ -53058,12 +53045,12 @@ var _UUpload = defineComponent({
|
|
|
53058
53045
|
uploadKeyIndexRef.value += 1;
|
|
53059
53046
|
return key;
|
|
53060
53047
|
}
|
|
53061
|
-
function handleFileAddition(fileAndEntries,
|
|
53048
|
+
function handleFileAddition(fileAndEntries, event) {
|
|
53062
53049
|
if (!fileAndEntries || fileAndEntries.length === 0)
|
|
53063
53050
|
return;
|
|
53064
53051
|
const { onBeforeUpload } = props;
|
|
53065
53052
|
fileAndEntries = mergedMultipleRef.value ? fileAndEntries : [fileAndEntries[0]];
|
|
53066
|
-
const { max, accept } = props;
|
|
53053
|
+
const { max, accept, maxSize } = props;
|
|
53067
53054
|
fileAndEntries = fileAndEntries.filter(({ file, source }) => {
|
|
53068
53055
|
if (source === "dnd" && accept?.trim()) {
|
|
53069
53056
|
return matchType(file.name, file.type, accept);
|
|
@@ -53092,6 +53079,10 @@ var _UUpload = defineComponent({
|
|
|
53092
53079
|
thumbnailUrl: null,
|
|
53093
53080
|
fullPath: entry?.fullPath ?? `/${file.webkitRelativePath || file.name}`
|
|
53094
53081
|
};
|
|
53082
|
+
if (isFileSizeExceeded(file, maxSize)) {
|
|
53083
|
+
fileInfo.status = "error";
|
|
53084
|
+
return fileInfo;
|
|
53085
|
+
}
|
|
53095
53086
|
if (!onBeforeUpload || await onBeforeUpload({
|
|
53096
53087
|
file: fileInfo,
|
|
53097
53088
|
fileList: mergedFileListRef.value
|
|
@@ -53104,7 +53095,7 @@ var _UUpload = defineComponent({
|
|
|
53104
53095
|
let nextTickChain = Promise.resolve();
|
|
53105
53096
|
fileInfos.forEach((fileInfo) => {
|
|
53106
53097
|
nextTickChain = nextTickChain.then(nextTick).then(() => {
|
|
53107
|
-
fileInfo && doChange(fileInfo,
|
|
53098
|
+
fileInfo && doChange(fileInfo, event, {
|
|
53108
53099
|
append: true
|
|
53109
53100
|
});
|
|
53110
53101
|
});
|
|
@@ -53131,6 +53122,15 @@ var _UUpload = defineComponent({
|
|
|
53131
53122
|
filesToUpload.forEach((file) => {
|
|
53132
53123
|
const { status } = file;
|
|
53133
53124
|
if (status === "pending" || status === "error" && shouldReupload) {
|
|
53125
|
+
if (isFileSizeExceeded(file.file, props.maxSize)) {
|
|
53126
|
+
if (status === "pending") {
|
|
53127
|
+
const fileAfterChange = Object.assign({}, file, {
|
|
53128
|
+
status: "error"
|
|
53129
|
+
});
|
|
53130
|
+
doChange(fileAfterChange);
|
|
53131
|
+
}
|
|
53132
|
+
return;
|
|
53133
|
+
}
|
|
53134
53134
|
if (props.customRequest) {
|
|
53135
53135
|
customSubmitImpl({
|
|
53136
53136
|
inst: {
|
|
@@ -53211,6 +53211,26 @@ var _UUpload = defineComponent({
|
|
|
53211
53211
|
}
|
|
53212
53212
|
return "";
|
|
53213
53213
|
}
|
|
53214
|
+
function isFilePreviewable(file) {
|
|
53215
|
+
return props.shouldUseThumbnailUrl(file) && getFilePreviewSrc(file) !== null;
|
|
53216
|
+
}
|
|
53217
|
+
const previewFileListRef = computed(
|
|
53218
|
+
() => mergedFileListRef.value.filter(isFilePreviewable)
|
|
53219
|
+
);
|
|
53220
|
+
const previewSrcListRef = computed(
|
|
53221
|
+
() => previewFileListRef.value.map((file) => getFilePreviewSrc(file))
|
|
53222
|
+
);
|
|
53223
|
+
const previewShowRef = ref(false);
|
|
53224
|
+
const previewCurrentRef = ref(0);
|
|
53225
|
+
function openFilePreview(file) {
|
|
53226
|
+
const index = previewFileListRef.value.findIndex(
|
|
53227
|
+
({ id }) => id === file.id
|
|
53228
|
+
);
|
|
53229
|
+
if (index < 0)
|
|
53230
|
+
return;
|
|
53231
|
+
previewCurrentRef.value = index;
|
|
53232
|
+
previewShowRef.value = true;
|
|
53233
|
+
}
|
|
53214
53234
|
const cssVarsRef = computed(() => {
|
|
53215
53235
|
const { value: size } = formItem.mergedSizeRef;
|
|
53216
53236
|
const {
|
|
@@ -53330,7 +53350,12 @@ var _UUpload = defineComponent({
|
|
|
53330
53350
|
imageGroupPropsRef: toRef(props, "imageGroupProps"),
|
|
53331
53351
|
mergedDirectoryDndRef: computed(() => {
|
|
53332
53352
|
return props.directoryDnd ?? props.directory;
|
|
53333
|
-
})
|
|
53353
|
+
}),
|
|
53354
|
+
previewSrcListRef,
|
|
53355
|
+
previewShowRef,
|
|
53356
|
+
previewCurrentRef,
|
|
53357
|
+
isFilePreviewable,
|
|
53358
|
+
openFilePreview
|
|
53334
53359
|
});
|
|
53335
53360
|
const exposedMethods = {
|
|
53336
53361
|
clear: () => {
|
|
@@ -54833,6 +54858,12 @@ var _UMessageBubble = defineComponent({
|
|
|
54833
54858
|
);
|
|
54834
54859
|
return url ?? null;
|
|
54835
54860
|
};
|
|
54861
|
+
const getAttachmentUrl = (attachment) => {
|
|
54862
|
+
if (!attachment.url || attachment.url === "#")
|
|
54863
|
+
return null;
|
|
54864
|
+
return attachment.url;
|
|
54865
|
+
};
|
|
54866
|
+
const isAttachmentPreviewable = (file) => Boolean(file.thumbnailUrl);
|
|
54836
54867
|
const handleAttachmentDownload = async (file) => {
|
|
54837
54868
|
if (props.onAttachmentDownload) {
|
|
54838
54869
|
const attachment = normalizedAttachmentsRef.value.find(
|
|
@@ -54873,7 +54904,7 @@ var _UMessageBubble = defineComponent({
|
|
|
54873
54904
|
name: attachment.name,
|
|
54874
54905
|
status: attachment.status || MessageBubbleAttachmentStatus.FINISHED,
|
|
54875
54906
|
percentage: attachment.percentage ?? null,
|
|
54876
|
-
url: attachment
|
|
54907
|
+
url: getAttachmentUrl(attachment),
|
|
54877
54908
|
thumbnailUrl: getThumbnailUrl(attachment),
|
|
54878
54909
|
type: attachment.type ?? null,
|
|
54879
54910
|
file: null,
|
|
@@ -54884,6 +54915,8 @@ var _UMessageBubble = defineComponent({
|
|
|
54884
54915
|
_UUpload,
|
|
54885
54916
|
{
|
|
54886
54917
|
abstract: true,
|
|
54918
|
+
listType: "preview-list",
|
|
54919
|
+
shouldUseThumbnailUrl: isAttachmentPreviewable,
|
|
54887
54920
|
fileList,
|
|
54888
54921
|
fileListStyle: withPadding ? {
|
|
54889
54922
|
display: "flex",
|
|
@@ -117093,7 +117126,7 @@ function useThemeVars() {
|
|
|
117093
117126
|
});
|
|
117094
117127
|
}
|
|
117095
117128
|
|
|
117096
|
-
var version = "2.3.
|
|
117129
|
+
var version = "2.3.2";
|
|
117097
117130
|
|
|
117098
117131
|
function create({
|
|
117099
117132
|
componentPrefix = "U",
|