@mythpe/quasar-ui-qui 0.3.78 → 0.3.80
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
|
@@ -16,7 +16,13 @@ import MInput from './MInput.vue'
|
|
|
16
16
|
|
|
17
17
|
const modelValue = defineModel<Props['modelValue']>({ required: !1, default: undefined })
|
|
18
18
|
const input = useTemplateRef<InstanceType<typeof MInput>>('input')
|
|
19
|
-
|
|
19
|
+
const focus = () => {
|
|
20
|
+
input?.value?.focus?.()
|
|
21
|
+
}
|
|
22
|
+
const select = () => {
|
|
23
|
+
input?.value?.select?.()
|
|
24
|
+
}
|
|
25
|
+
defineExpose<{ input: typeof input; focus:() => void; select: () => void; }>({ focus, select, input })
|
|
20
26
|
defineOptions({
|
|
21
27
|
name: 'MEmail',
|
|
22
28
|
inheritAttrs: !1
|
|
@@ -70,7 +70,7 @@ const listeners = {
|
|
|
70
70
|
blur: (v: any) => handleBlur(v, !0),
|
|
71
71
|
'update:modelValue': (v: Props['modelValue']) => handleChange(v, !!errorMessage.value)
|
|
72
72
|
}
|
|
73
|
-
const input = useTemplateRef<InstanceType<typeof QInput
|
|
73
|
+
const input = useTemplateRef<InstanceType<typeof QInput>>('input')
|
|
74
74
|
const scopes = reactive(inputScope)
|
|
75
75
|
const sarValue = computed<string | null>(() => {
|
|
76
76
|
if (!props.sar) {
|
|
@@ -102,7 +102,14 @@ const computedInputClass = computed(() => {
|
|
|
102
102
|
}
|
|
103
103
|
return classes
|
|
104
104
|
})
|
|
105
|
-
|
|
105
|
+
const focus = () => {
|
|
106
|
+
input?.value?.focus?.()
|
|
107
|
+
}
|
|
108
|
+
const select = () => {
|
|
109
|
+
input?.value?.select?.()
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
defineExpose<typeof scopes & { input: typeof input; focus:() => void; select: () => void; }>({ focus, select, input, ...scopes })
|
|
106
113
|
defineOptions({
|
|
107
114
|
name: 'MInput',
|
|
108
115
|
inheritAttrs: !1
|
|
@@ -12,7 +12,8 @@ import { useFieldValue } from 'vee-validate'
|
|
|
12
12
|
import { computed, useTemplateRef } from 'vue'
|
|
13
13
|
import type { MInputSlots, MPhoneProps as Props } from '../../types'
|
|
14
14
|
import { useMyth } from '../../composable'
|
|
15
|
-
import
|
|
15
|
+
import MInput from './MInput.vue'
|
|
16
|
+
import { useQuasar } from 'quasar'
|
|
16
17
|
|
|
17
18
|
interface P {
|
|
18
19
|
name: Props['name'];
|
|
@@ -35,11 +36,32 @@ interface P {
|
|
|
35
36
|
const props = defineProps<P>()
|
|
36
37
|
const countryName = computed(() => props.countryPhone || `${props.name}_country`)
|
|
37
38
|
const countryValue = useFieldValue(countryName)
|
|
39
|
+
const $q = useQuasar()
|
|
38
40
|
const { __ } = useMyth()
|
|
39
|
-
const
|
|
40
|
-
const onSelectCountry = () => {
|
|
41
|
+
const focus = () => {
|
|
41
42
|
phoneRef?.value?.input?.focus?.()
|
|
42
43
|
}
|
|
44
|
+
const select = () => {
|
|
45
|
+
phoneRef?.value?.input?.select?.()
|
|
46
|
+
}
|
|
47
|
+
const onSelectCountry = () => {
|
|
48
|
+
focus()
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const phoneRef = useTemplateRef<InstanceType<typeof MInput>>('phoneRef')
|
|
52
|
+
|
|
53
|
+
interface MPhoneExposed {
|
|
54
|
+
focus: () => void;
|
|
55
|
+
select: () => void;
|
|
56
|
+
input?: typeof phoneRef | null | any
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
defineExpose<MPhoneExposed>({
|
|
60
|
+
focus,
|
|
61
|
+
select,
|
|
62
|
+
input: phoneRef
|
|
63
|
+
})
|
|
64
|
+
|
|
43
65
|
defineOptions({
|
|
44
66
|
name: 'MPhone',
|
|
45
67
|
inheritAttrs: !1
|
|
@@ -91,11 +113,11 @@ defineOptions({
|
|
|
91
113
|
<MAxios
|
|
92
114
|
:autocomplete="false"
|
|
93
115
|
:class="{hidden: readonly}"
|
|
116
|
+
:dense="dense"
|
|
94
117
|
:name="countryName"
|
|
95
118
|
:prepend-icon="$q.screen.gt.xs ? 'ion-keypad' : undefined"
|
|
96
119
|
:required="readonly ? undefined : required"
|
|
97
120
|
:view-mode="readonly"
|
|
98
|
-
:dense="dense"
|
|
99
121
|
col
|
|
100
122
|
hide-bottom-space
|
|
101
123
|
hide-dropdown-icon
|