grantthomas-nuxt 1.0.3 → 1.0.4
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/module.json +1 -1
- package/dist/runtime/components/CrudImageCropper.d.vue.ts +7 -0
- package/dist/runtime/components/CrudImageCropper.vue +79 -0
- package/dist/runtime/components/CrudImageCropper.vue.d.ts +7 -0
- package/dist/runtime/components/CrudUploadField.d.vue.ts +2 -2
- package/dist/runtime/components/CrudUploadField.vue.d.ts +2 -2
- package/package.json +1 -1
package/dist/module.json
CHANGED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
declare const _default: import("vue").DefineComponent<{}, {
|
|
2
|
+
$emit: (event: "crop" | "cancel", ...args: any[]) => void;
|
|
3
|
+
imageUrl: string;
|
|
4
|
+
aspectRatio: string;
|
|
5
|
+
$props: any;
|
|
6
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
7
|
+
export default _default;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { ref, computed } from "vue";
|
|
3
|
+
import { Cropper } from "vue-advanced-cropper";
|
|
4
|
+
import "vue-advanced-cropper/dist/style.css";
|
|
5
|
+
const props = defineProps({
|
|
6
|
+
imageUrl: {
|
|
7
|
+
type: String,
|
|
8
|
+
required: true
|
|
9
|
+
},
|
|
10
|
+
aspectRatio: {
|
|
11
|
+
type: String,
|
|
12
|
+
default: "1:1"
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
const emit = defineEmits(["crop", "cancel"]);
|
|
16
|
+
const cropper = ref(null);
|
|
17
|
+
const parsedAspectRatio = computed(() => {
|
|
18
|
+
const parts = props.aspectRatio.split(":");
|
|
19
|
+
if (parts.length === 2) {
|
|
20
|
+
const width = parseFloat(parts[0]);
|
|
21
|
+
const height = parseFloat(parts[1]);
|
|
22
|
+
if (!isNaN(width) && !isNaN(height) && height !== 0) {
|
|
23
|
+
return width / height;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return 1;
|
|
27
|
+
});
|
|
28
|
+
const crop = () => {
|
|
29
|
+
if (cropper.value) {
|
|
30
|
+
const { canvas } = cropper.value.getResult();
|
|
31
|
+
if (canvas) {
|
|
32
|
+
const base64 = canvas.toDataURL("image/png");
|
|
33
|
+
emit("crop", base64);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
const cancel = () => {
|
|
38
|
+
emit("cancel");
|
|
39
|
+
};
|
|
40
|
+
</script>
|
|
41
|
+
|
|
42
|
+
<template>
|
|
43
|
+
<v-dialog :model-value="true" max-width="900" persistent>
|
|
44
|
+
<v-card>
|
|
45
|
+
<v-card-title class="border-b pa-4">
|
|
46
|
+
<h3 class="mb-0">Crop Image</h3>
|
|
47
|
+
</v-card-title>
|
|
48
|
+
|
|
49
|
+
<v-card-text class="pa-4">
|
|
50
|
+
<div style="max-height: 70vh;">
|
|
51
|
+
<Cropper
|
|
52
|
+
ref="cropper"
|
|
53
|
+
:src="imageUrl"
|
|
54
|
+
:stencil-props="{
|
|
55
|
+
aspectRatio: parsedAspectRatio
|
|
56
|
+
}"
|
|
57
|
+
class="cropper"
|
|
58
|
+
/>
|
|
59
|
+
</div>
|
|
60
|
+
</v-card-text>
|
|
61
|
+
|
|
62
|
+
<v-card-actions class="border-t pa-4">
|
|
63
|
+
<v-btn @click="cancel" color="error">
|
|
64
|
+
<v-icon small class="mr-1">mdi-close</v-icon>
|
|
65
|
+
Cancel
|
|
66
|
+
</v-btn>
|
|
67
|
+
<v-spacer />
|
|
68
|
+
<v-btn @click="crop" color="success">
|
|
69
|
+
<v-icon small class="mr-1">mdi-crop</v-icon>
|
|
70
|
+
Crop & Continue
|
|
71
|
+
</v-btn>
|
|
72
|
+
</v-card-actions>
|
|
73
|
+
</v-card>
|
|
74
|
+
</v-dialog>
|
|
75
|
+
</template>
|
|
76
|
+
|
|
77
|
+
<style scoped>
|
|
78
|
+
.cropper{background:#f0f0f0;max-height:60vh}
|
|
79
|
+
</style>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
declare const _default: import("vue").DefineComponent<{}, {
|
|
2
|
+
$emit: (event: "crop" | "cancel", ...args: any[]) => void;
|
|
3
|
+
imageUrl: string;
|
|
4
|
+
aspectRatio: string;
|
|
5
|
+
$props: any;
|
|
6
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
7
|
+
export default _default;
|
|
@@ -8,13 +8,13 @@ declare const __VLS_component: import("vue").DefineComponent<{}, {
|
|
|
8
8
|
customFilters: Record<string, any>;
|
|
9
9
|
multiple: boolean;
|
|
10
10
|
disabled: boolean;
|
|
11
|
+
aspectRatio: string;
|
|
12
|
+
crop: boolean;
|
|
11
13
|
mimeKey: string;
|
|
12
14
|
fileNameKey: string;
|
|
13
15
|
replaceable: boolean;
|
|
14
16
|
isPublic: boolean;
|
|
15
17
|
additionalPostData: Record<string, any>;
|
|
16
|
-
crop: boolean;
|
|
17
|
-
aspectRatio: string;
|
|
18
18
|
title?: any;
|
|
19
19
|
$props: any;
|
|
20
20
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
@@ -8,13 +8,13 @@ declare const __VLS_component: import("vue").DefineComponent<{}, {
|
|
|
8
8
|
customFilters: Record<string, any>;
|
|
9
9
|
multiple: boolean;
|
|
10
10
|
disabled: boolean;
|
|
11
|
+
aspectRatio: string;
|
|
12
|
+
crop: boolean;
|
|
11
13
|
mimeKey: string;
|
|
12
14
|
fileNameKey: string;
|
|
13
15
|
replaceable: boolean;
|
|
14
16
|
isPublic: boolean;
|
|
15
17
|
additionalPostData: Record<string, any>;
|
|
16
|
-
crop: boolean;
|
|
17
|
-
aspectRatio: string;
|
|
18
18
|
title?: any;
|
|
19
19
|
$props: any;
|
|
20
20
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|