@mythpe/quasar-ui-qui 0.0.23-dev → 0.0.24-dev

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.
Files changed (56) hide show
  1. package/index.d.ts +4 -0
  2. package/package.json +8 -5
  3. package/src/components/form/MAvatarViewer.vue +324 -0
  4. package/src/components/form/MBtn.vue +258 -91
  5. package/src/components/form/MCheckbox.vue +123 -0
  6. package/src/components/form/MColor.vue +122 -0
  7. package/src/components/form/MDate.vue +47 -0
  8. package/src/components/form/MEditor.vue +285 -0
  9. package/src/components/form/MEmail.vue +40 -0
  10. package/src/components/form/MField.vue +142 -0
  11. package/src/components/form/MFile.vue +209 -0
  12. package/src/components/form/MForm.vue +83 -0
  13. package/src/components/form/MHidden.vue +83 -0
  14. package/src/components/form/MHiddenInput.vue +55 -0
  15. package/src/components/form/MInput.vue +62 -65
  16. package/src/components/form/MInputFieldControl.vue +4 -1
  17. package/src/components/form/MInputLabel.vue +6 -2
  18. package/src/components/form/MMobile.vue +37 -0
  19. package/src/components/form/MPicker.vue +310 -0
  20. package/src/components/form/MRadio.vue +175 -0
  21. package/src/components/form/MSelect.vue +343 -0
  22. package/src/components/form/MTime.vue +45 -0
  23. package/src/components/form/index.ts +38 -1
  24. package/src/components/grid/MBlock.vue +31 -17
  25. package/src/components/grid/MCol.vue +2 -14
  26. package/src/components/grid/MContainer.vue +21 -12
  27. package/src/components/grid/MHelpRow.vue +4 -9
  28. package/src/components/grid/MRow.vue +22 -9
  29. package/src/components/index.ts +1 -0
  30. package/src/components/transition/MFadeTransition.vue +27 -0
  31. package/src/components/transition/MFadeXTransition.vue +26 -0
  32. package/src/components/transition/MTransition.vue +41 -0
  33. package/src/components/transition/index.ts +13 -0
  34. package/src/components/typography/index.ts +1 -0
  35. package/src/composable/index.ts +3 -1
  36. package/src/composable/{useHelpersMyth.ts → useBindInput.ts} +92 -62
  37. package/src/composable/useError.ts +11 -0
  38. package/src/composable/useMyth.ts +280 -3
  39. package/src/composable/useValue.ts +12 -0
  40. package/src/index.sass +7 -33
  41. package/src/style/m-container.sass +13 -0
  42. package/src/style/main.sass +42 -0
  43. package/src/types/api-helpers.d.ts +120 -0
  44. package/src/types/components.d.ts +550 -52
  45. package/src/types/dt.d.ts +142 -0
  46. package/src/types/index.d.ts +128 -47
  47. package/src/types/lodash.d.ts +26 -0
  48. package/src/types/quasar-helpers.d.ts +7 -0
  49. package/src/types/theme.d.ts +12 -0
  50. package/src/utils/Helpers.ts +321 -0
  51. package/src/utils/Str.ts +210 -0
  52. package/src/utils/index.ts +2 -0
  53. package/src/utils/myth.ts +75 -22
  54. package/src/utils/vee-rules.ts +2 -1
  55. package/src/utils/vue-plugin.ts +80 -3
  56. package/tsconfig.json +8 -11
@@ -0,0 +1,209 @@
1
+ <!--
2
+ - MyTh Ahmed Faiz Copyright © 2016-2024 All rights reserved.
3
+ - Email: mythpe@gmail.com
4
+ - Mobile: +966590470092
5
+ - Website: https://www.4myth.com
6
+ - Github: https://github.com/mythpe
7
+ -->
8
+
9
+ <script lang="ts" setup>
10
+
11
+ import { QField, QFile, QFileSlots } from 'quasar'
12
+ import { useBindInput, useMyth } from '../../composable'
13
+ import { useField } from 'vee-validate'
14
+ import { defineProps, reactive, ref, toValue } from 'vue'
15
+ import type { MFileProps as Props } from '../../types'
16
+ import { myth } from '../../utils'
17
+
18
+ interface P {
19
+ name: Props['name'];
20
+ auto?: Props['auto'];
21
+ col?: Props['col'];
22
+ xs?: Props['xs'];
23
+ sm?: Props['sm'];
24
+ md?: Props['md'];
25
+ lg?: Props['lg'];
26
+ xl?: Props['xl'];
27
+ label?: Props['label'];
28
+ caption?: Props['caption'];
29
+ hint?: Props['hint'];
30
+ placeholder?: Props['placeholder'];
31
+ help?: Props['help'];
32
+ required?: Props['required'];
33
+ rules?: Props['rules'];
34
+ viewMode?: Props['viewMode'];
35
+ viewModeValue?: Props['viewModeValue'];
36
+ topLabel?: Props['topLabel'];
37
+ accept?: Props['accept'];
38
+ images?: Props['images'];
39
+ svg?: Props['svg'];
40
+ video?: Props['video'];
41
+ pdf?: Props['pdf'];
42
+ excel?: Props['excel'];
43
+ fieldOptions?: Props['fieldOptions'];
44
+ }
45
+
46
+ const props = withDefaults(defineProps<P>(), {
47
+ name: () => '',
48
+ auto: undefined,
49
+ col: undefined,
50
+ xs: undefined,
51
+ sm: undefined,
52
+ md: undefined,
53
+ lg: undefined,
54
+ xl: undefined,
55
+ label: undefined,
56
+ caption: undefined,
57
+ hint: undefined,
58
+ placeholder: undefined,
59
+ help: undefined,
60
+ required: undefined,
61
+ rules: undefined,
62
+ viewMode: () => !1,
63
+ viewModeValue: undefined,
64
+ topLabel: undefined,
65
+ accept: undefined,
66
+ images: () => !1,
67
+ svg: () => !1,
68
+ video: () => !1,
69
+ pdf: () => !1,
70
+ excel: () => !1,
71
+ fieldOptions: undefined
72
+ })
73
+ defineModel<Props['modelValue']>({ required: !1, default: undefined })
74
+ const { __ } = useMyth()
75
+ const { props: options } = myth
76
+ const helper = useBindInput<P>(() => props, 'file', () => ({ choose: !0 }))
77
+ const { hasTopLabel, getLabel, getPlaceholder, accepts, inputRules } = helper
78
+ const inputScope = useField<Props['modelValue']>(() => props.name, inputRules, {
79
+ syncVModel: !0,
80
+ label: getLabel,
81
+ ...toValue<any>(props.fieldOptions)
82
+ })
83
+ const { value, errorMessage, handleChange, handleBlur } = inputScope
84
+
85
+ const listeners = {
86
+ focus: (v: Event) => handleBlur(v, !1),
87
+ blur: (v: Event) => handleBlur(v, !1),
88
+ clear: (v: Event) => handleBlur(v, !0),
89
+ 'update:modelValue': (v: Props['modelValue']) => handleChange(v, !!errorMessage.value)
90
+ }
91
+ const input = ref<InstanceType<typeof QFile | typeof QField> | null>(null)
92
+ const scopes = reactive(inputScope)
93
+
94
+ const pickFiles = (evt?: Event) => (input.value as QFile)?.pickFiles(evt)
95
+ const addFiles = (files: readonly any[] | FileList) => (input.value as QFile)?.addFiles(files)
96
+ const resetValidation = () => (input.value as QFile)?.resetValidation()
97
+ const validate = (value?: any) => (input.value as QFile)?.validate(value)
98
+ const focus = () => (input.value as QFile)?.focus()
99
+ const blur = () => (input.value as QFile)?.blur()
100
+ const removeAtIndex = (index: number) => (input.value as QFile)?.removeAtIndex(index)
101
+ const removeFile = (index: number) => (input.value as QFile)?.removeAtIndex(index)
102
+ const methods = {
103
+ pickFiles,
104
+ addFiles,
105
+ resetValidation,
106
+ validate,
107
+ focus,
108
+ blur,
109
+ removeAtIndex,
110
+ removeFile
111
+ }
112
+
113
+ defineExpose({ input, ...scopes, ...methods })
114
+ defineOptions({ name: 'MFile', inheritAttrs: !1 })
115
+ </script>
116
+
117
+ <template>
118
+ <MCol
119
+ :auto="auto"
120
+ :class="[$attrs.class,{'m--input__required':inputRules?.required!==undefined,'m--input__error':!!errorMessage,'m--input__view':viewMode}]"
121
+ :col="col"
122
+ :lg="lg"
123
+ :md="md"
124
+ :name="name"
125
+ :sm="sm"
126
+ :xs="xs"
127
+ >
128
+ <slot
129
+ name="top-input"
130
+ v-bind="scopes"
131
+ />
132
+ <slot name="top-label">
133
+ <MInputLabel
134
+ v-if="hasTopLabel"
135
+ :field="scopes"
136
+ >
137
+ <MHelpRow
138
+ :text="help"
139
+ tooltip
140
+ />
141
+ </MInputLabel>
142
+ </slot>
143
+ <slot name="caption">
144
+ <div
145
+ v-if="!!caption"
146
+ class="m--input__caption"
147
+ >
148
+ {{ __(caption) }}
149
+ </div>
150
+ </slot>
151
+ <component
152
+ :is="viewMode ? QField : QFile"
153
+ ref="input"
154
+ :accept="accepts.join(',')"
155
+ :error="!!errorMessage"
156
+ :error-message="errorMessage"
157
+ :hint="__(hint)"
158
+ :label="hasTopLabel ? (viewMode ? undefined : getPlaceholder) : getLabel"
159
+ :model-value="value"
160
+ v-bind="{ ...options.file as any,...( viewMode ? options.field : {} ), ...$attrs, ...( viewMode ? { stackLabel: !0 } : {} ) }"
161
+ v-on="listeners"
162
+ >
163
+ <template #prepend>
164
+ <slot name="prepend">
165
+ <q-icon
166
+ class="cursor-pointer"
167
+ name="ion-ios-attach"
168
+ @click="pickFiles($event)"
169
+ />
170
+ </slot>
171
+ </template>
172
+
173
+ <template
174
+ v-for="(_,slot) in $slots as Readonly<QFileSlots>"
175
+ :key="slot"
176
+ #[slot]
177
+ >
178
+ <slot :name="slot" />
179
+ </template>
180
+ <template
181
+ v-if="viewMode"
182
+ #control
183
+ >
184
+ <slot name="control">
185
+ <MInputFieldControl>
186
+ {{ viewModeValue ?? value }}
187
+ </MInputFieldControl>
188
+ </slot>
189
+ </template>
190
+ </component>
191
+ <slot
192
+ name="help"
193
+ v-bind="scopes"
194
+ >
195
+ <MHelpRow
196
+ v-if="!hasTopLabel"
197
+ :text="help"
198
+ />
199
+ </slot>
200
+ <slot
201
+ name="bottom-input"
202
+ v-bind="scopes"
203
+ />
204
+ </MCol>
205
+ <slot
206
+ name="hidden"
207
+ v-bind="scopes"
208
+ />
209
+ </template>
@@ -0,0 +1,83 @@
1
+ <!--
2
+ - MyTh Ahmed Faiz Copyright © 2016-2024 All rights reserved.
3
+ - Email: mythpe@gmail.com
4
+ - Mobile: +966590470092
5
+ - Website: https://www.4myth.com
6
+ - Github: https://github.com/mythpe
7
+ -->
8
+
9
+ <script lang="ts" setup>
10
+ import type { InvalidSubmissionHandler, SubmissionContext, SubmissionHandler } from 'vee-validate'
11
+ import { useForm } from 'vee-validate'
12
+ import type { MFormProps as Props } from '../../types'
13
+ import { computed, reactive, toValue, watch } from 'vue'
14
+ import { useMyth } from '../../composable'
15
+
16
+ interface P {
17
+ formProps?: Props['formProps'];
18
+ opts?: Props['opts'];
19
+ target?: Props['target'];
20
+ emitValues?: Props['emitValues'];
21
+ readonly state?: Props['state'];
22
+ readonly form?: Props['form'];
23
+ readonly values?: Props['values'];
24
+ readonly errors?: Props['errors'];
25
+ readonly padding?: Props['padding'];
26
+ }
27
+
28
+ const props = withDefaults(defineProps<P>(), {
29
+ formProps: undefined,
30
+ opts: undefined,
31
+ target: undefined,
32
+ emitValues: () => !1,
33
+ state: () => () => ({}),
34
+ form: () => () => ({}),
35
+ values: () => () => ({}),
36
+ errors: () => () => ({}),
37
+ padding: undefined
38
+ })
39
+ const formScope = useForm<Record<string, any>>(props.opts)
40
+ const myth = useMyth()
41
+ const scope = reactive(formScope)
42
+ const { handleSubmit, resetForm, setErrors, setValues } = scope
43
+ type Emits = {
44
+ (e: 'submit', values: Record<string, any>, ctx: SubmissionContext, scope: typeof formScope): void;
45
+ }
46
+ const emit = defineEmits<Emits>()
47
+ const onSuccessSubmission: SubmissionHandler = async (values, ctx) => emit('submit', values, ctx, formScope)
48
+ const onErrorSubmission: InvalidSubmissionHandler = ({ errors }) => {
49
+ const keys: any[] = Object.keys(errors)
50
+ if (keys.length) {
51
+ const message = errors[keys[0]] as string || myth.__('messages.the_given_data_was_invalid')
52
+ myth.helpers.scrollToElementFromErrors({ [keys[0]]: [message] }, undefined, props.target)
53
+ }
54
+ }
55
+ const defaultSubmit = props.emitValues ? handleSubmit(onSuccessSubmission, onErrorSubmission) : handleSubmit.withControlled(onSuccessSubmission,
56
+ onErrorSubmission)
57
+ defineExpose({ ...scope, defaultSubmit })
58
+ defineOptions({ name: 'MForm', inheritAttrs: !1 })
59
+ const options = { deep: !0, immediate: !0 }
60
+ const stateComputed = computed(() => props.state ? toValue(props.state) : {})
61
+ watch(stateComputed, v => v && resetForm(v), options)
62
+ const formComputed = computed(() => props.form ? toValue(props.form) : {})
63
+ watch(formComputed, values => values && resetForm({ values, errors: {}, touched: {} }), options)
64
+ const valuesComputed = computed(() => props.values ? toValue(props.values) : {})
65
+ watch(valuesComputed, v => v && setValues(v), options)
66
+ const errorsComputed = computed(() => props.errors ? toValue(props.errors) : {})
67
+ watch(errorsComputed, v => v && setErrors(v), options)
68
+ </script>
69
+
70
+ <template>
71
+ <div
72
+ class="m--form__container"
73
+ v-bind="$attrs"
74
+ >
75
+ <form
76
+ :class="{'m--form': !0, 'm--container': padding}"
77
+ v-bind="formProps"
78
+ @submit="defaultSubmit"
79
+ >
80
+ <slot v-bind="scope" />
81
+ </form>
82
+ </div>
83
+ </template>
@@ -0,0 +1,83 @@
1
+ <!--
2
+ - MyTh Ahmed Faiz Copyright © 2016-2024 All rights reserved.
3
+ - Email: mythpe@gmail.com
4
+ - Mobile: +966590470092
5
+ - Website: https://www.4myth.com
6
+ - Github: https://github.com/mythpe
7
+ -->
8
+
9
+ <script
10
+ lang="ts"
11
+ setup
12
+ >
13
+
14
+ import { useField } from 'vee-validate'
15
+ import type { MHiddenProps as Props } from '../../types'
16
+ import { reactive, toValue } from 'vue'
17
+ import { useBindInput } from '../../composable'
18
+
19
+ type P = {
20
+ name: Props['name'];
21
+ auto?: Props['auto'];
22
+ col?: Props['col'];
23
+ xs?: Props['xs'];
24
+ sm?: Props['sm'];
25
+ md?: Props['md'];
26
+ lg?: Props['lg'];
27
+ xl?: Props['xl'];
28
+ rules?: Props['rules'];
29
+ required?: Props['required'];
30
+ fieldOptions?: Props['modelValue'];
31
+ viewMode?: Props['viewMode'];
32
+ }
33
+
34
+ const props = withDefaults(defineProps<P>(), {
35
+ name: () => '',
36
+ auto: undefined,
37
+ col: undefined,
38
+ xs: undefined,
39
+ sm: undefined,
40
+ md: undefined,
41
+ lg: undefined,
42
+ xl: undefined,
43
+ rules: undefined,
44
+ required: () => !1,
45
+ fieldOptions: undefined,
46
+ viewMode: () => !1
47
+ })
48
+ defineModel<Props['modelValue']>({ required: !1, default: undefined })
49
+ const helper = useBindInput<P>(() => props, 'input')
50
+ const { inputRules, getLabel } = helper
51
+ const inputScope = useField<Props['modelValue']>(() => props.name, inputRules, {
52
+ syncVModel: !0,
53
+ label: getLabel,
54
+ validateOnValueUpdate: !1,
55
+ validateOnMount: !1,
56
+ controlled: !0,
57
+ ...toValue<any>(props.fieldOptions)
58
+ })
59
+ const { value, errorMessage } = inputScope
60
+
61
+ const scopes = reactive(inputScope)
62
+ defineExpose<typeof scopes>({ ...scopes })
63
+ defineOptions({ name: 'MHidden', inheritAttrs: !1 })
64
+ </script>
65
+
66
+ <template>
67
+ <MCol
68
+ :auto="auto"
69
+ :class="[$attrs.class,{'m--input__required':inputRules?.required!==undefined,'m--input__error':!!errorMessage,'m--input__view':viewMode}]"
70
+ :col="col"
71
+ :lg="lg"
72
+ :md="md"
73
+ :name="name"
74
+ :sm="sm"
75
+ :xs="xs"
76
+ >
77
+ <input
78
+ v-model="value"
79
+ v-bind="{...$attrs,type: 'hidden' }"
80
+ >
81
+ <slot />
82
+ </MCol>
83
+ </template>
@@ -0,0 +1,55 @@
1
+ <!--
2
+ - MyTh Ahmed Faiz Copyright © 2016-2024 All rights reserved.
3
+ - Email: mythpe@gmail.com
4
+ - Mobile: +966590470092
5
+ - Website: https://www.4myth.com
6
+ - Github: https://github.com/mythpe
7
+ -->
8
+
9
+ <script lang="ts" setup>
10
+
11
+ import { useField } from 'vee-validate'
12
+ import type { MHiddenInputProps as Props } from '../../types'
13
+ import { reactive, toValue } from 'vue'
14
+ import { useBindInput } from '../../composable'
15
+
16
+ type P = {
17
+ name: Props['name'];
18
+ rules?: Props['rules'];
19
+ required?: Props['required'];
20
+ fieldOptions?: Props['modelValue'];
21
+ }
22
+
23
+ const props = withDefaults(defineProps<P>(), {
24
+ name: () => '',
25
+ rules: undefined,
26
+ required: () => !1,
27
+ fieldOptions: undefined
28
+ })
29
+ defineModel<Props['modelValue']>({ required: !1, default: undefined })
30
+ const helper = useBindInput<P>(() => props, 'input')
31
+ const { inputRules, getLabel } = helper
32
+ const inputScope = useField<Props['modelValue']>(() => props.name, inputRules, {
33
+ syncVModel: !0,
34
+ label: getLabel,
35
+ validateOnValueUpdate: !1,
36
+ validateOnMount: !1,
37
+ controlled: !0,
38
+ ...toValue<any>(props.fieldOptions)
39
+ })
40
+ const { value } = inputScope
41
+
42
+ const scopes = reactive(inputScope)
43
+ defineExpose<typeof scopes>({ ...scopes })
44
+ defineOptions({
45
+ name: 'MHiddenInput',
46
+ inheritAttrs: !1
47
+ })
48
+ </script>
49
+
50
+ <template>
51
+ <input
52
+ v-model="value"
53
+ v-bind="{...$attrs,type: 'hidden' }"
54
+ >
55
+ </template>
@@ -12,66 +12,63 @@
12
12
  >
13
13
 
14
14
  import { useField } from 'vee-validate'
15
- import { computed, reactive, ref, toValue } from 'vue'
15
+ import { computed, reactive, toValue, useTemplateRef } from 'vue'
16
16
  import type { MInputProps as Props } from '../../types'
17
17
  import { QField, QInput, type QInputSlots } from 'quasar'
18
- import { useInputHelper, useMyth } from '../../composable'
18
+ import { useBindInput, useMyth } from '../../composable'
19
19
  import { myth } from '../../utils'
20
20
 
21
- type P = {
22
- name: Props['name'];
23
- auto?: Props['auto'];
24
- col?: Props['col'];
25
- xs?: Props['xs'];
26
- sm?: Props['sm'];
27
- md?: Props['md'];
28
- lg?: Props['lg'];
29
- xl?: Props['xl'];
30
- label?: Props['label'];
31
- caption?: Props['caption'];
32
- hint?: Props['hint'];
33
- placeholder?: Props['placeholder'];
34
- help?: Props['help'];
35
- required?: Props['required'];
36
- rules?: Props['rules'];
37
- viewMode?: Props['viewMode'];
38
- viewModeValue?: Props['viewModeValue'];
39
- autocomplete?: Props['autocomplete'];
40
- topLabel?: Props['topLabel'];
41
- fieldOptions?: Props['fieldOptions'];
42
- clearable?: Props['clearable'];
43
- }
44
-
45
- // const props = withDefaults(defineProps<P>(), {
46
- // name: () => '',
47
- // auto: undefined,
48
- // col: undefined,
49
- // xs: undefined,
50
- // sm: undefined,
51
- // md: undefined,
52
- // lg: undefined,
53
- // xl: undefined,
54
- // label: undefined,
55
- // caption: undefined,
56
- // hint: undefined,
57
- // placeholder: undefined,
58
- // help: undefined,
59
- // required: undefined,
60
- // rules: undefined,
61
- // viewMode: () => !1,
62
- // viewModeValue: undefined,
63
- // autocomplete: undefined,
64
- // topLabel: undefined,
65
- // fieldOptions: undefined,
66
- // clearable: undefined
67
- // })
68
- const props = defineProps<Props>()
21
+ const props = withDefaults(defineProps<Props>(), {
22
+ name: () => '',
23
+ fillMask: undefined,
24
+ reverseFillMask: undefined,
25
+ unmaskedValue: undefined,
26
+ error: undefined,
27
+ noErrorIcon: undefined,
28
+ reactiveRules: undefined,
29
+ lazyRules: undefined,
30
+ stackLabel: undefined,
31
+ hideHint: undefined,
32
+ dark: undefined,
33
+ loading: undefined,
34
+ clearable: undefined,
35
+ filled: undefined,
36
+ outlined: undefined,
37
+ borderless: undefined,
38
+ standout: undefined,
39
+ labelSlot: undefined,
40
+ bottomSlots: undefined,
41
+ hideBottomSpace: undefined,
42
+ counter: undefined,
43
+ rounded: undefined,
44
+ square: undefined,
45
+ dense: undefined,
46
+ itemAligned: undefined,
47
+ disable: undefined,
48
+ readonly: undefined,
49
+ autofocus: undefined,
50
+ autogrow: undefined,
51
+ viewMode: undefined,
52
+ auto: undefined,
53
+ col: undefined,
54
+ xs: undefined,
55
+ sm: undefined,
56
+ md: undefined,
57
+ lg: undefined,
58
+ xl: undefined,
59
+ required: undefined,
60
+ autocomplete: undefined,
61
+ topLabel: undefined,
62
+ mobile: undefined,
63
+ email: undefined,
64
+ float: undefined
65
+ })
69
66
  defineModel<Props['modelValue']>({ required: !1, default: undefined })
70
67
  const { __ } = useMyth()
71
- const options = computed(() => myth.options.value)
72
- const helper = useInputHelper<P>(() => props, 'input')
73
- const { hasTopLabel, getLabel, getPlaceholder, getAutocompleteAttribute, getRules } = helper
74
- const inputScope = useField<Props['modelValue']>(() => props.name, getRules, {
68
+ const options = computed(() => myth.props.value)
69
+ const helper = useBindInput<Props>(() => props, 'input')
70
+ const { attrs, hasTopLabel, getLabel, getPlaceholder, getAutocompleteAttribute, inputRules } = helper
71
+ const inputScope = useField<Props['modelValue']>(() => props.name, inputRules, {
75
72
  syncVModel: !0,
76
73
  label: getLabel,
77
74
  ...toValue<any>(props.fieldOptions)
@@ -81,7 +78,7 @@ const listeners = {
81
78
  blur: (v: any) => handleBlur(v, !0),
82
79
  'update:modelValue': (v: Props['modelValue']) => handleChange(v, !!errorMessage.value)
83
80
  }
84
- const input = ref<InstanceType<typeof QInput | typeof QField> | null>(null)
81
+ const input = useTemplateRef<InstanceType<typeof QInput | typeof QField> | null>('input')
85
82
  const scopes = reactive(inputScope)
86
83
  defineExpose<typeof scopes & { input: typeof input }>({ input, ...scopes })
87
84
  defineOptions({
@@ -93,7 +90,7 @@ defineOptions({
93
90
  <template>
94
91
  <MCol
95
92
  :auto="auto"
96
- :class="[$attrs.class,{'m--input__required':getRules?.required!==undefined,'m--input__error':!!errorMessage,'m--input__view':viewMode}]"
93
+ :class="[$attrs.class,{'m--input__required':inputRules?.required!==undefined,'m--input__error':!!errorMessage,'m--input__view':viewMode}]"
97
94
  :col="col"
98
95
  :lg="lg"
99
96
  :md="md"
@@ -130,19 +127,19 @@ defineOptions({
130
127
  <component
131
128
  :is="viewMode ? QField : QInput"
132
129
  ref="input"
133
- :error="!!errorMessage"
134
- :error-message="errorMessage"
135
- :hint="hint ? __(hint) : hint"
136
- :label="hasTopLabel ? undefined : getLabel"
137
- :model-value="value"
138
- :placeholder="getPlaceholder"
139
130
  v-bind="{
140
- ...options.input as any,
141
131
  ...( viewMode ? options.field : {} ),
142
- ...$attrs,
132
+ ...$props,
133
+ ...attrs as any,
143
134
  ...( viewMode ? { stackLabel: !0 } : {} ),
144
135
  autocomplete:getAutocompleteAttribute,
145
- clearable: viewMode ? !1 : clearable
136
+ clearable:viewMode?!1:clearable,
137
+ error:!!errorMessage,
138
+ errorMessage,
139
+ hint:__(hint),
140
+ label:hasTopLabel?undefined:getLabel,
141
+ modelValue:value,
142
+ placeholder:getPlaceholder
146
143
  }"
147
144
  v-on="listeners"
148
145
  >
@@ -10,7 +10,10 @@
10
10
  lang="ts"
11
11
  setup
12
12
  >
13
- defineOptions({ name: 'MInputFieldControl', inheritAttrs: !1 })
13
+ defineOptions({
14
+ name: 'MInputFieldControl',
15
+ inheritAttrs: !1
16
+ })
14
17
  </script>
15
18
 
16
19
  <template>
@@ -8,12 +8,15 @@
8
8
 
9
9
  <script lang="ts" setup>
10
10
 
11
- import { MInputLabelProps as Props } from '../../types'
11
+ import type { MInputLabelProps as Props } from '../../types'
12
12
  import { useMyth } from '../../composable'
13
13
 
14
14
  const { __ } = useMyth()
15
15
  defineProps<Props>()
16
- defineOptions({ name: 'MInputLabel' })
16
+ defineOptions({
17
+ name: 'MInputLabel',
18
+ inheritAttrs: !1
19
+ })
17
20
  </script>
18
21
 
19
22
  <template>
@@ -22,6 +25,7 @@ defineOptions({ name: 'MInputLabel' })
22
25
  'row items-center m--input__top-label' : !0,
23
26
  'm--input__top-label__invalid' : !field?.meta?.valid && field?.meta?.dirty
24
27
  }"
28
+ v-bind="$attrs"
25
29
  >
26
30
  <div class="m--input__top-label__content">
27
31
  {{ label !== undefined ? __(label) : field?.label }}
@@ -0,0 +1,37 @@
1
+ <!--
2
+ - MyTh Ahmed Faiz Copyright © 2016-2024 All rights reserved.
3
+ - Email: mythpe@gmail.com
4
+ - Mobile: +966590470092
5
+ - Website: https://www.4myth.com
6
+ - Github: https://github.com/mythpe
7
+ -->
8
+
9
+ <script lang="ts" setup>
10
+ import type { MInputProps as Props, MInputSlots } from '../../types'
11
+ import { useTemplateRef } from 'vue'
12
+ import MInput from './MInput.vue'
13
+ import { myth } from '../../utils'
14
+
15
+ const modelValue = defineModel<Props['modelValue']>({ required: !1, default: undefined })
16
+ const input = useTemplateRef<InstanceType<typeof MInput>>('input')
17
+ const { props: options } = myth
18
+ defineExpose<{ input: typeof input }>({ input })
19
+ defineOptions({ name: 'MMobile', inheritAttrs: !1 })
20
+ </script>
21
+
22
+ <template>
23
+ <MInput
24
+ ref="input"
25
+ v-model="modelValue"
26
+ type="tel"
27
+ v-bind="{...options.mobile as any,...$attrs}"
28
+ >
29
+ <template
30
+ v-for="(_,slot) in $slots as Readonly<MInputSlots>"
31
+ :key="slot"
32
+ #[slot]
33
+ >
34
+ <slot :name="slot" />
35
+ </template>
36
+ </MInput>
37
+ </template>