@mythpe/quasar-ui-qui 0.0.19-dev → 0.0.19

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