@mythpe/quasar-ui-qui 0.4.4 → 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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mythpe/quasar-ui-qui",
3
- "version": "0.4.4",
3
+ "version": "0.4.5",
4
4
  "description": "MyTh Quasar UI Kit App Extension",
5
5
  "author": {
6
6
  "name": "MyTh Ahmed Faiz",
@@ -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'
@@ -36,12 +36,15 @@ interface P {
36
36
  noIcon?: Props['noIcon'];
37
37
  selectProps?: Props['selectProps'];
38
38
  noCountry?: Props['noCountry'];
39
+ prefix?: Props['prefix'];
40
+ suffix?: Props['suffix'];
39
41
  }
40
42
 
41
43
  const props = defineProps<P>()
42
44
  const countryName = computed(() => props.countryPhone || `${props.name}_country`)
43
45
  const countryValue = useFieldValue(countryName)
44
46
  const $q = useQuasar()
47
+ const rtl = computed(() => $q.lang.rtl)
45
48
  const { __ } = useMyth()
46
49
  const getPlaceholder = computed(() => {
47
50
  return !countryValue.value ? __('replace.choose', { name: __(`attributes.${countryName.value}`) }) : props.placeholder
@@ -58,6 +61,13 @@ const onSelectCountry = () => {
58
61
  }
59
62
 
60
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
+ })
61
71
 
62
72
  interface MPhoneExposed {
63
73
  focus: () => void;
@@ -92,6 +102,7 @@ defineOptions({
92
102
  >
93
103
  <MRow :col="noCountry ? undefined : !0">
94
104
  <MAxios
105
+ v-model:items="countries"
95
106
  :autocomplete="false"
96
107
  :class="['self-start overflow-hidden',{hidden: readonly || !!noCountry,'order-last': $q.lang.rtl}]"
97
108
  :dense="dense"
@@ -121,6 +132,8 @@ defineOptions({
121
132
  :ltr="!!countryValue"
122
133
  :mobile="mobile === undefined ? !1 : mobile"
123
134
  :name="name"
135
+ :prefix="noCountry ? (prefix ?? (!rtl ? (selectedCountryKey ?? prefix) : prefix)) : prefix"
136
+ :suffix="noCountry ? (suffix ?? (rtl ? (selectedCountryKey ?? suffix) : suffix)) : suffix"
124
137
  prepend-icon="ion-ios-phone-portrait"
125
138
  stack-label
126
139
  type="text"