@mythpe/quasar-ui-qui 0.4.68 → 0.4.70

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.68",
3
+ "version": "0.4.70",
4
4
  "description": "MyTh Quasar UI Kit App Extension",
5
5
  "author": {
6
6
  "name": "MyTh Ahmed Faiz",
@@ -94,6 +94,9 @@ const sarValue = computed<string | null>(() => {
94
94
  })
95
95
  const viewModeAttribute = useFieldValue(() => props.viewModeKey || props.name)
96
96
  const computedViewModeValue = computed<any>(() => {
97
+ if (props.viewModeValue !== undefined) {
98
+ return props.viewModeValue
99
+ }
97
100
  if (props.viewModeKey) {
98
101
  return viewModeAttribute.value
99
102
  }
@@ -14,6 +14,7 @@ import type { MInputSlots, MPhoneProps as Props } from '../../types'
14
14
  import { useMyth } from '../../composable'
15
15
  import MInput from './MInput.vue'
16
16
  import { useQuasar } from 'quasar'
17
+ import type Select from './MAxios.vue'
17
18
 
18
19
  interface P {
19
20
  name: Props['name'];
@@ -38,6 +39,7 @@ interface P {
38
39
  noCountry?: Props['noCountry'];
39
40
  prefix?: Props['prefix'];
40
41
  suffix?: Props['suffix'];
42
+ copy?: Props['copy'];
41
43
  }
42
44
 
43
45
  const props = defineProps<P>()
@@ -47,7 +49,7 @@ const $q = useQuasar()
47
49
  const rtl = computed(() => $q.lang.rtl)
48
50
  const { __ } = useMyth()
49
51
  const getPlaceholder = computed(() => {
50
- return !countryValue.value ? __('replace.choose', { name: __(`attributes.${countryName.value}`) }) : props.placeholder
52
+ return !countryValue.value && !props.readonly ? __('replace.choose', { name: __(`attributes.${countryName.value}`) }) : props.placeholder
51
53
  })
52
54
  const isSmall = computed(() => $q.screen.lt.md)
53
55
  const focus = () => {
@@ -62,6 +64,7 @@ const onSelectCountry = () => {
62
64
  }
63
65
 
64
66
  const phoneRef = useTemplateRef<InstanceType<typeof MInput>>('phoneRef')
67
+ const axiosRef = useTemplateRef<InstanceType<typeof Select>>('axiosRef')
65
68
  const countries = ref<any[]>([])
66
69
  const selectedCountryKey = computed<string | undefined>(() => {
67
70
  if (!countryValue.value) {
@@ -69,6 +72,23 @@ const selectedCountryKey = computed<string | undefined>(() => {
69
72
  }
70
73
  return countries.value.find((e: any) => !!e?.id && e?.id === countryValue.value)?.key || undefined
71
74
  })
75
+ const copyComputed = computed(() => {
76
+ if (!countryValue.value) {
77
+ return !1
78
+ }
79
+ return props.copy
80
+ })
81
+ const countryIconComputed = computed<any>(() => {
82
+ if (props.noIcon) {
83
+ return undefined
84
+ }
85
+ if (!isSmall.value) {
86
+ if (axiosRef.value?.$el?.offsetWidth && axiosRef.value?.$el?.offsetWidth > 199) {
87
+ return 'ion-keypad'
88
+ }
89
+ }
90
+ return undefined
91
+ })
72
92
 
73
93
  interface MPhoneExposed {
74
94
  focus: () => void;
@@ -102,15 +122,16 @@ defineOptions({
102
122
  >
103
123
  <MRow :col="noCountry ? undefined : 'xs'">
104
124
  <MAxios
125
+ ref="axiosRef"
105
126
  v-model:items="countries"
106
127
  :autocomplete="false"
107
128
  :class="['self-start overflow-hidden',{hidden: readonly || !!noCountry,'order-last': $q.lang.rtl}]"
108
129
  :dense="dense"
109
130
  :name="countryName"
131
+ :prepend-icon="countryIconComputed"
110
132
  :required="readonly ? undefined : required"
111
133
  :search-length="searchLength ?? 0"
112
134
  :style="`widthf: ${isSmall ? 150 : 200}px;max-height: 60px;`"
113
- :use-input="countries.length > 4"
114
135
  :view-mode="readonly"
115
136
  col="4"
116
137
  hide-bottom-space
@@ -122,6 +143,7 @@ defineOptions({
122
143
  popup-content-class="m-select__popup-phone"
123
144
  popup-no-route-dismiss
124
145
  service="country.codes"
146
+ use-input
125
147
  v-bind="selectProps"
126
148
  @model="onSelectCountry"
127
149
  />
@@ -141,11 +163,12 @@ defineOptions({
141
163
  ...$attrs,
142
164
  required,
143
165
  dense,
144
- viewModeValue: viewModeValue !== undefined ? viewModeValue : getPlaceholder,
145
- placeholder:getPlaceholder,
166
+ viewModeValue: viewModeValue === undefined ? getPlaceholder : viewModeValue,
167
+ placeholder: getPlaceholder,
146
168
  col: (readonly || viewMode || noCountry) ? 12 : 8,
147
169
  viewMode: (readonly || viewMode) ? !0 : !countryValue,
148
170
  readonly: undefined,
171
+ copy: copyComputed,
149
172
  }"
150
173
  >
151
174
  <template