@winchsa/ui 0.1.52 → 0.1.53
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.
|
@@ -73,6 +73,21 @@ const initCropper = () => {
|
|
|
73
73
|
});
|
|
74
74
|
}
|
|
75
75
|
};
|
|
76
|
+
const closeCropper = () => {
|
|
77
|
+
if (cropperInstance.value) {
|
|
78
|
+
cropperInstance.value.destroy();
|
|
79
|
+
cropperInstance.value = null;
|
|
80
|
+
}
|
|
81
|
+
if (cropImageSrc.value) {
|
|
82
|
+
URL.revokeObjectURL(cropImageSrc.value);
|
|
83
|
+
cropImageSrc.value = null;
|
|
84
|
+
}
|
|
85
|
+
selectedFile.value = null;
|
|
86
|
+
if (fileInputRef.value) {
|
|
87
|
+
fileInputRef.value.value = "";
|
|
88
|
+
}
|
|
89
|
+
cropperDialog.value = false;
|
|
90
|
+
};
|
|
76
91
|
const cropImage = () => {
|
|
77
92
|
if (!cropperInstance.value) {
|
|
78
93
|
return;
|
|
@@ -81,15 +96,17 @@ const cropImage = () => {
|
|
|
81
96
|
width: 200,
|
|
82
97
|
height: 200
|
|
83
98
|
});
|
|
99
|
+
const fileType = selectedFile.value?.type;
|
|
100
|
+
const fileName = selectedFile.value?.name ?? "image.jpg";
|
|
84
101
|
canvas.toBlob((blob) => {
|
|
85
|
-
if (blob
|
|
86
|
-
const croppedFile = new File([blob],
|
|
102
|
+
if (blob) {
|
|
103
|
+
const croppedFile = new File([blob], fileName, { type: fileType });
|
|
87
104
|
generateImageUrl(croppedFile);
|
|
88
105
|
model.value = croppedFile;
|
|
89
106
|
emit("update");
|
|
90
|
-
|
|
107
|
+
closeCropper();
|
|
91
108
|
}
|
|
92
|
-
},
|
|
109
|
+
}, fileType);
|
|
93
110
|
};
|
|
94
111
|
const deleteUserImage = () => {
|
|
95
112
|
imageSrc.value = avatar;
|
|
@@ -179,7 +196,7 @@ const hasImage = computed(() => {
|
|
|
179
196
|
width="500"
|
|
180
197
|
:has-icon="false"
|
|
181
198
|
@save="cropImage"
|
|
182
|
-
@cancel="
|
|
199
|
+
@cancel="closeCropper"
|
|
183
200
|
>
|
|
184
201
|
<img
|
|
185
202
|
v-if="cropImageSrc"
|
|
@@ -62,9 +62,9 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
|
|
|
62
62
|
}>, {
|
|
63
63
|
modelValue: string[];
|
|
64
64
|
returnObject: boolean;
|
|
65
|
-
url: string;
|
|
66
65
|
headers: Header[];
|
|
67
66
|
formFilters: FormFilter[];
|
|
67
|
+
url: string;
|
|
68
68
|
queryParams: Record<string, string>;
|
|
69
69
|
enableButtons: boolean;
|
|
70
70
|
enableButtonsFilter: boolean;
|
|
@@ -62,9 +62,9 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
|
|
|
62
62
|
}>, {
|
|
63
63
|
modelValue: string[];
|
|
64
64
|
returnObject: boolean;
|
|
65
|
-
url: string;
|
|
66
65
|
headers: Header[];
|
|
67
66
|
formFilters: FormFilter[];
|
|
67
|
+
url: string;
|
|
68
68
|
queryParams: Record<string, string>;
|
|
69
69
|
enableButtons: boolean;
|
|
70
70
|
enableButtonsFilter: boolean;
|