@@ -4,6 +4,7 @@ import AButton from "../AButton.vue";
44import ACrop from " ../ACrop.vue" ;
55import { toValue } from " @vueuse/core" ;
66import AInputRadio from " ../AInputRadio.vue" ;
7+ import { useTranslate } from " @addeus/vue3-stores/stores/translate" ;
78import { ref } from " vue" ;
89
910export interface ACropPromptEmits {
@@ -26,63 +27,86 @@ export interface ACropPromptProps {
2627 quality? : number ;
2728}
2829
29- const selectedOption = ref <string | undefined >(" 1:1 " );
30+ const selectedOption = ref <string >(" 4:5 " );
3031const props = defineProps <ACropPromptProps >();
32+ const portraitLabel = useTranslate (" crop.portrait" );
33+ const squareLabel = useTranslate (" crop.square" );
34+ const landscapeLabel = useTranslate (" crop.landscape" );
3135const model = defineModel ();
3236 </script >
3337
3438<template >
35- <AModal :open =" true" @close =" $emit('cancel')" :title =" toValue(title)" >
39+ <AModal :open =" true" @close =" $emit('cancel')" :title =" toValue(props. title)" >
3640 <template #content >
3741 <div class =" container-ratio" >
38- <label >Ratio:</label >
42+ <label >Ratio :</label >
43+
3944 <AInputRadio
4045 v-model =" selectedOption"
4146 name =" aspectRatio"
42- value =" 4:5" >4:5</AInputRadio >
47+ value =" 4:5"
48+ >
49+ {{ portraitLabel || '4:5' }}
50+ </AInputRadio >
51+
4352 <AInputRadio
4453 v-model =" selectedOption"
4554 name =" aspectRatio"
4655 value =" 1:1"
47- label =" 1:1"
48- >1:1</AInputRadio >
56+ >
57+ {{ squareLabel || '1:1' }}
58+ </AInputRadio >
59+
60+ <AInputRadio
61+ v-model =" selectedOption"
62+ name =" aspectRatio"
63+ value =" 5:4"
64+ >
65+ {{ landscapeLabel || '5:4' }}
66+ </AInputRadio >
4967 </div >
50- <ACrop v-model =" model"
51- :aspectRatio =" selectedOption === '4:5' ? 4/5 : 1"
52- :maxHeight =" maxHeight"
53- :maxWidth =" maxWidth"
54- :mimeType =" mimeType"
55- :minHeight =" minHeight"
56- :minWidth =" minWidth"
57- :quality =" quality"
58- ></ACrop >
68+
69+ <ACrop
70+ v-model =" model"
71+ :aspectRatio =" selectedOption === '4:5' ? 4 / 5 : selectedOption === '5:4' ? 5 / 4 : 1"
72+ :maxHeight =" props.maxHeight"
73+ :maxWidth =" props.maxWidth"
74+ :mimeType =" props.mimeType"
75+ :minHeight =" props.minHeight"
76+ :minWidth =" props.minWidth"
77+ :quality =" props.quality"
78+ />
5979 </template >
60- <template #action >
61-
62- <AButton @click =" $emit('cancel')" >{{
63- toValue(cancel)
64- }}</AButton >
65- <AButton @click =" $emit('confirm')" color =" primary" >{{
66- toValue(confirm)
67- }}</AButton >
80+
81+ <template #action >
82+ <AButton @click =" $emit('cancel')" >{{ toValue(props.cancel) }}</AButton >
83+ <AButton @click =" $emit('confirm')" color =" primary" >{{ toValue(props.confirm) }}</AButton >
6884 </template >
6985 </AModal >
7086</template >
87+
7188<style lang="scss" scoped>
7289.container-ratio {
7390 margin-bottom : 1rem ;
7491 display : flex ;
75- gap : 10px ;
7692 align-items : center ;
93+ gap : 1rem ;
94+
95+ label {
96+ white-space : nowrap ;
97+ }
7798
78- .a-input-radio {
79- width : 50px ;
80- min-width : inherit ;
99+ .a-input-radio {
100+ display : flex ;
101+ align-items : center ;
102+ min-width : 80px ;
103+ flex-shrink : 0 ;
81104 }
105+
82106 :deep (.label-text ) {
83- padding : 0 ;
84- width : 20 px !important ;
85- }
107+ margin-left : 0.5 rem ;
108+ white-space : nowrap ;
109+ }
86110}
87111
88112 </style >
0 commit comments