@mythpe/quasar-ui-qui 0.4.74 → 0.4.76
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
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
>
|
|
13
13
|
import { useField, useFieldValue } from 'vee-validate'
|
|
14
14
|
import { computed, reactive, toValue, useTemplateRef } from 'vue'
|
|
15
|
-
import { QField, QInput, type QInputSlots } from 'quasar'
|
|
15
|
+
import { QField, QInput, type QInputSlots, useQuasar } from 'quasar'
|
|
16
16
|
import { useBindInput, useMyth } from '../../composable'
|
|
17
17
|
import type { MInputProps as Props } from '../../types'
|
|
18
18
|
import { MSarString } from '../sar'
|
|
@@ -57,6 +57,7 @@ interface P {
|
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
const props = defineProps<P>()
|
|
60
|
+
const $q = useQuasar()
|
|
60
61
|
defineModel<Props['modelValue']>({ required: !1, default: undefined })
|
|
61
62
|
const { __, props: pluginOptions, formatMoney, copyText } = useMyth()
|
|
62
63
|
const helper = useBindInput<Props>(() => props, 'input')
|
|
@@ -118,7 +119,15 @@ const focus = () => {
|
|
|
118
119
|
const select = () => {
|
|
119
120
|
input?.value?.select?.()
|
|
120
121
|
}
|
|
121
|
-
|
|
122
|
+
const isRtl = computed<boolean>(() => {
|
|
123
|
+
if (props.rtl) {
|
|
124
|
+
return true
|
|
125
|
+
}
|
|
126
|
+
if (props.ltr) {
|
|
127
|
+
return false
|
|
128
|
+
}
|
|
129
|
+
return $q.lang.rtl
|
|
130
|
+
})
|
|
122
131
|
defineExpose<typeof scopes & { input: typeof input; focus:() => void; select: () => void; }>({ focus, select, input, ...scopes })
|
|
123
132
|
defineOptions({
|
|
124
133
|
name: 'MInput',
|
|
@@ -200,6 +209,12 @@ defineOptions({
|
|
|
200
209
|
v-bind="prependIconProps"
|
|
201
210
|
/>
|
|
202
211
|
</template>
|
|
212
|
+
<template
|
|
213
|
+
v-else-if="sar && !viewMode && !isRtl"
|
|
214
|
+
#prepend
|
|
215
|
+
>
|
|
216
|
+
<MSarIcon />
|
|
217
|
+
</template>
|
|
203
218
|
<template
|
|
204
219
|
v-if="!!appendIcon"
|
|
205
220
|
#append
|
|
@@ -210,7 +225,7 @@ defineOptions({
|
|
|
210
225
|
/>
|
|
211
226
|
</template>
|
|
212
227
|
<template
|
|
213
|
-
v-else-if="sar && !viewMode"
|
|
228
|
+
v-else-if="sar && !viewMode && isRtl"
|
|
214
229
|
#append
|
|
215
230
|
>
|
|
216
231
|
<MSarIcon />
|
|
@@ -51,6 +51,8 @@ interface P {
|
|
|
51
51
|
prependIconProps?: Props['prependIconProps'];
|
|
52
52
|
appendIcon?: Props['appendIcon'];
|
|
53
53
|
appendIconProps?: Props['appendIconProps'];
|
|
54
|
+
yesNo?: boolean;
|
|
55
|
+
genders?: boolean;
|
|
54
56
|
}
|
|
55
57
|
|
|
56
58
|
const props = withDefaults(defineProps<P>(), {
|
|
@@ -86,7 +88,8 @@ const props = withDefaults(defineProps<P>(), {
|
|
|
86
88
|
prependIcon: undefined,
|
|
87
89
|
prependIconProps: undefined,
|
|
88
90
|
appendIcon: undefined,
|
|
89
|
-
appendIconProps: undefined
|
|
91
|
+
appendIconProps: undefined,
|
|
92
|
+
yesNo: undefined
|
|
90
93
|
})
|
|
91
94
|
defineModel<Props['modelValue']>({ required: !1, default: undefined })
|
|
92
95
|
const loading = defineModel<Props['loading']>('loading', { required: !1, default: !1 })
|
|
@@ -112,6 +115,32 @@ const scopes = reactive(inputScope)
|
|
|
112
115
|
defineExpose<typeof scopes & { input: typeof input }>({ input, ...scopes })
|
|
113
116
|
const { alertError, __, props: pluginProps, api } = useMyth()
|
|
114
117
|
const fetchData = async () => {
|
|
118
|
+
if (props.yesNo) {
|
|
119
|
+
options.value = [
|
|
120
|
+
{
|
|
121
|
+
label: __('labels.yes'),
|
|
122
|
+
value: true
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
label: __('labels.no'),
|
|
126
|
+
value: false
|
|
127
|
+
}
|
|
128
|
+
]
|
|
129
|
+
return
|
|
130
|
+
}
|
|
131
|
+
if (props.genders) {
|
|
132
|
+
options.value = [
|
|
133
|
+
{
|
|
134
|
+
label: __('labels.male'),
|
|
135
|
+
value: 'male'
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
label: __('labels.female'),
|
|
139
|
+
value: 'female'
|
|
140
|
+
}
|
|
141
|
+
]
|
|
142
|
+
return
|
|
143
|
+
}
|
|
115
144
|
if (props.service) {
|
|
116
145
|
const s = props.service
|
|
117
146
|
loading.value = !0
|
|
@@ -58,5 +58,15 @@ export type MOptionsProps = Omit<QOptionGroupProps, 'name' | 'modelValue' | 'opt
|
|
|
58
58
|
* Default is: 33.33333333%
|
|
59
59
|
*/
|
|
60
60
|
fitWidth?: boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Set options to yes/no.
|
|
63
|
+
* Default is: false
|
|
64
|
+
*/
|
|
65
|
+
yesNo?: boolean;
|
|
66
|
+
/**
|
|
67
|
+
* Set options to male/female.
|
|
68
|
+
* Default is: false
|
|
69
|
+
*/
|
|
70
|
+
genders?: boolean;
|
|
61
71
|
}
|
|
62
72
|
export type MOptionsSlots = QOptionGroupSlots & QFieldSlots & BaseInputsSlots
|