@mythpe/quasar-ui-qui 0.4.3 → 0.4.5
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/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
<script lang="ts" setup>
|
|
10
10
|
|
|
11
11
|
import { useFieldValue } from 'vee-validate'
|
|
12
|
-
import { computed, useTemplateRef } from 'vue'
|
|
12
|
+
import { computed, ref, useTemplateRef } from 'vue'
|
|
13
13
|
import type { MInputSlots, MPhoneProps as Props } from '../../types'
|
|
14
14
|
import { useMyth } from '../../composable'
|
|
15
15
|
import MInput from './MInput.vue'
|
|
@@ -35,12 +35,16 @@ interface P {
|
|
|
35
35
|
searchLength?: Props['searchLength'];
|
|
36
36
|
noIcon?: Props['noIcon'];
|
|
37
37
|
selectProps?: Props['selectProps'];
|
|
38
|
+
noCountry?: Props['noCountry'];
|
|
39
|
+
prefix?: Props['prefix'];
|
|
40
|
+
suffix?: Props['suffix'];
|
|
38
41
|
}
|
|
39
42
|
|
|
40
43
|
const props = defineProps<P>()
|
|
41
44
|
const countryName = computed(() => props.countryPhone || `${props.name}_country`)
|
|
42
45
|
const countryValue = useFieldValue(countryName)
|
|
43
46
|
const $q = useQuasar()
|
|
47
|
+
const rtl = computed(() => $q.lang.rtl)
|
|
44
48
|
const { __ } = useMyth()
|
|
45
49
|
const getPlaceholder = computed(() => {
|
|
46
50
|
return !countryValue.value ? __('replace.choose', { name: __(`attributes.${countryName.value}`) }) : props.placeholder
|
|
@@ -57,6 +61,13 @@ const onSelectCountry = () => {
|
|
|
57
61
|
}
|
|
58
62
|
|
|
59
63
|
const phoneRef = useTemplateRef<InstanceType<typeof MInput>>('phoneRef')
|
|
64
|
+
const countries = ref<any[]>([])
|
|
65
|
+
const selectedCountryKey = computed<string | undefined>(() => {
|
|
66
|
+
if (!countryValue.value) {
|
|
67
|
+
return undefined
|
|
68
|
+
}
|
|
69
|
+
return countries.value.find((e: any) => !!e?.id && e?.id === countryValue.value)?.key || undefined
|
|
70
|
+
})
|
|
60
71
|
|
|
61
72
|
interface MPhoneExposed {
|
|
62
73
|
focus: () => void;
|
|
@@ -89,10 +100,11 @@ defineOptions({
|
|
|
89
100
|
xl: xl,
|
|
90
101
|
}"
|
|
91
102
|
>
|
|
92
|
-
<MRow col>
|
|
103
|
+
<MRow :col="noCountry ? undefined : !0">
|
|
93
104
|
<MAxios
|
|
105
|
+
v-model:items="countries"
|
|
94
106
|
:autocomplete="false"
|
|
95
|
-
:class="['self-start overflow-hidden',{hidden: readonly,'order-last': $q.lang.rtl}]"
|
|
107
|
+
:class="['self-start overflow-hidden',{hidden: readonly || !!noCountry,'order-last': $q.lang.rtl}]"
|
|
96
108
|
:dense="dense"
|
|
97
109
|
:name="countryName"
|
|
98
110
|
:prepend-icon="noIcon ? undefined : (!isSmall ? 'ion-keypad' : undefined)"
|
|
@@ -120,6 +132,8 @@ defineOptions({
|
|
|
120
132
|
:ltr="!!countryValue"
|
|
121
133
|
:mobile="mobile === undefined ? !1 : mobile"
|
|
122
134
|
:name="name"
|
|
135
|
+
:prefix="noCountry ? (prefix ?? (!rtl ? (selectedCountryKey ?? prefix) : prefix)) : prefix"
|
|
136
|
+
:suffix="noCountry ? (suffix ?? (rtl ? (selectedCountryKey ?? suffix) : suffix)) : suffix"
|
|
123
137
|
prepend-icon="ion-ios-phone-portrait"
|
|
124
138
|
stack-label
|
|
125
139
|
type="text"
|
|
@@ -129,7 +143,7 @@ defineOptions({
|
|
|
129
143
|
dense,
|
|
130
144
|
viewModeValue: viewModeValue !== undefined ? viewModeValue : getPlaceholder,
|
|
131
145
|
placeholder:getPlaceholder,
|
|
132
|
-
col: !0,
|
|
146
|
+
col: noCountry ? 12 : !0,
|
|
133
147
|
viewMode: (readonly || viewMode) ? !0 : !countryValue,
|
|
134
148
|
readonly: undefined,
|
|
135
149
|
}"
|