@mythpe/quasar-ui-qui 0.0.25 → 0.0.26-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 (71) hide show
  1. package/index.d.ts +17 -0
  2. package/package.json +14 -8
  3. package/src/boot/register.ts +14 -0
  4. package/src/components/form/MAvatarViewer.vue +324 -0
  5. package/src/components/form/MAxios.vue +141 -0
  6. package/src/components/form/MBtn.vue +271 -93
  7. package/src/components/form/MCheckbox.vue +126 -0
  8. package/src/components/form/MColor.vue +122 -0
  9. package/src/components/form/MDate.vue +47 -0
  10. package/src/components/form/MEditor.vue +285 -0
  11. package/src/components/form/MEmail.vue +40 -0
  12. package/src/components/form/MField.vue +145 -0
  13. package/src/components/form/MFile.vue +212 -0
  14. package/src/components/form/MForm.vue +86 -0
  15. package/src/components/form/MHidden.vue +86 -0
  16. package/src/components/form/MHiddenInput.vue +55 -0
  17. package/src/components/form/MInput.vue +178 -0
  18. package/src/components/form/MInputFieldControl.vue +27 -0
  19. package/src/components/form/MInputLabel.vue +35 -0
  20. package/src/components/form/MMobile.vue +40 -0
  21. package/src/components/form/MPassword.vue +73 -0
  22. package/src/components/form/MPicker.vue +313 -0
  23. package/src/components/form/MRadio.vue +178 -0
  24. package/src/components/form/MSelect.vue +349 -0
  25. package/src/components/form/MTime.vue +45 -0
  26. package/src/components/form/index.ts +55 -0
  27. package/src/components/grid/MBlock.vue +39 -18
  28. package/src/components/grid/MCol.vue +11 -15
  29. package/src/components/grid/MColumn.vue +8 -0
  30. package/src/components/grid/MContainer.vue +22 -13
  31. package/src/components/grid/MHelpRow.vue +9 -12
  32. package/src/components/grid/MRow.vue +31 -10
  33. package/src/components/grid/index.ts +16 -0
  34. package/src/components/index.ts +12 -0
  35. package/src/components/transition/MFadeTransition.vue +27 -0
  36. package/src/components/transition/MFadeXTransition.vue +26 -0
  37. package/src/components/transition/MTransition.vue +41 -0
  38. package/src/components/transition/index.ts +13 -0
  39. package/src/components/typography/MTypingString.vue +8 -0
  40. package/src/components/typography/index.ts +11 -0
  41. package/src/composable/index.ts +12 -0
  42. package/src/composable/useBindInput.ts +209 -0
  43. package/src/composable/useError.ts +11 -0
  44. package/src/composable/useMyth.ts +302 -0
  45. package/src/composable/useValue.ts +12 -0
  46. package/src/index.common.js +19 -1
  47. package/src/index.esm.js +18 -3
  48. package/src/index.js +19 -0
  49. package/src/index.sass +8 -26
  50. package/src/index.ts +18 -4
  51. package/src/index.umd.js +17 -2
  52. package/src/style/m-container.sass +13 -0
  53. package/src/style/main.sass +42 -0
  54. package/src/types/api-helpers.d.ts +123 -0
  55. package/src/types/components.d.ts +769 -27
  56. package/src/types/dt.d.ts +144 -0
  57. package/src/types/index.d.ts +155 -1
  58. package/src/types/lodash.d.ts +26 -0
  59. package/src/types/quasar-helpers.d.ts +7 -0
  60. package/src/types/theme.d.ts +12 -0
  61. package/src/utils/Helpers.ts +293 -0
  62. package/src/utils/Str.ts +211 -0
  63. package/src/utils/index.ts +13 -0
  64. package/src/utils/myth.ts +95 -0
  65. package/src/utils/vee-rules.ts +32 -0
  66. package/src/utils/vue-plugin.ts +129 -0
  67. package/tsconfig.json +9 -13
  68. package/src/myth.ts +0 -30
  69. package/src/types/myth.ts +0 -42
  70. package/src/vue-plugin.ts +0 -41
  71. package/types.d.ts +0 -1
@@ -0,0 +1,212 @@
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, toValue, useTemplateRef } 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 = useTemplateRef<InstanceType<typeof QFile> | InstanceType<typeof QField>>('input')
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({
115
+ name: 'MFile',
116
+ inheritAttrs: !1
117
+ })
118
+ </script>
119
+
120
+ <template>
121
+ <MCol
122
+ :auto="auto"
123
+ :class="[$attrs.class,{'m--input__required':inputRules?.required!==undefined,'m--input__error':!!errorMessage,'m--input__view':viewMode}]"
124
+ :col="col"
125
+ :lg="lg"
126
+ :md="md"
127
+ :name="name"
128
+ :sm="sm"
129
+ :xs="xs"
130
+ >
131
+ <slot
132
+ name="top-input"
133
+ v-bind="scopes"
134
+ />
135
+ <slot name="top-label">
136
+ <MInputLabel
137
+ v-if="hasTopLabel"
138
+ :field="scopes"
139
+ >
140
+ <MHelpRow
141
+ :text="help"
142
+ tooltip
143
+ />
144
+ </MInputLabel>
145
+ </slot>
146
+ <slot name="caption">
147
+ <div
148
+ v-if="!!caption"
149
+ class="m--input__caption"
150
+ >
151
+ {{ __(caption) }}
152
+ </div>
153
+ </slot>
154
+ <component
155
+ :is="viewMode ? QField : QFile"
156
+ ref="input"
157
+ :accept="accepts.join(',')"
158
+ :error="!!errorMessage"
159
+ :error-message="errorMessage"
160
+ :hint="__(hint)"
161
+ :label="hasTopLabel ? (viewMode ? undefined : getPlaceholder) : getLabel"
162
+ :model-value="value"
163
+ v-bind="{ ...options.file as any,...( viewMode ? options.field : {} ), ...$attrs, ...( viewMode ? { stackLabel: !0 } : {} ) }"
164
+ v-on="listeners"
165
+ >
166
+ <template #prepend>
167
+ <slot name="prepend">
168
+ <q-icon
169
+ class="cursor-pointer"
170
+ name="ion-ios-attach"
171
+ @click="pickFiles($event)"
172
+ />
173
+ </slot>
174
+ </template>
175
+
176
+ <template
177
+ v-for="(_,slot) in $slots as Readonly<QFileSlots>"
178
+ :key="slot"
179
+ #[slot]
180
+ >
181
+ <slot :name="slot" />
182
+ </template>
183
+ <template
184
+ v-if="viewMode"
185
+ #control
186
+ >
187
+ <slot name="control">
188
+ <MInputFieldControl>
189
+ {{ viewModeValue ?? value }}
190
+ </MInputFieldControl>
191
+ </slot>
192
+ </template>
193
+ </component>
194
+ <slot
195
+ name="help"
196
+ v-bind="scopes"
197
+ >
198
+ <MHelpRow
199
+ v-if="!hasTopLabel"
200
+ :text="help"
201
+ />
202
+ </slot>
203
+ <slot
204
+ name="bottom-input"
205
+ v-bind="scopes"
206
+ />
207
+ </MCol>
208
+ <slot
209
+ name="hidden"
210
+ v-bind="scopes"
211
+ />
212
+ </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 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
+ state?: Props['state'];
22
+ form?: Props['form'];
23
+ values?: Props['values'];
24
+ errors?: Props['errors'];
25
+ 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 { __, scrollToElementFromErrors } = 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 || __('messages.the_given_data_was_invalid')
52
+ 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({
59
+ name: 'MForm',
60
+ inheritAttrs: !1
61
+ })
62
+ const options = { deep: !0, immediate: !0 }
63
+ const stateComputed = computed(() => props.state ? toValue(props.state) : {})
64
+ watch(stateComputed, v => v && resetForm(v), options)
65
+ const formComputed = computed(() => props.form ? toValue(props.form) : {})
66
+ watch(formComputed, values => values && resetForm({ values, errors: {}, touched: {} }), options)
67
+ const valuesComputed = computed(() => props.values ? toValue(props.values) : {})
68
+ watch(valuesComputed, v => v && setValues(v), options)
69
+ const errorsComputed = computed(() => props.errors ? toValue(props.errors) : {})
70
+ watch(errorsComputed, v => v && setErrors(v), options)
71
+ </script>
72
+
73
+ <template>
74
+ <div
75
+ class="m--form__container"
76
+ v-bind="$attrs"
77
+ >
78
+ <form
79
+ :class="{'m--form': !0, 'm--container': padding}"
80
+ v-bind="formProps"
81
+ @submit="defaultSubmit"
82
+ >
83
+ <slot v-bind="scope" />
84
+ </form>
85
+ </div>
86
+ </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,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>
@@ -0,0 +1,178 @@
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 { computed, reactive, toValue, useTemplateRef } from 'vue'
16
+ import type { MInputProps as Props } from '../../types'
17
+ import { QField, QInput, type QInputSlots } from 'quasar'
18
+ import { useBindInput, useMyth } from '../../composable'
19
+ import { myth } from '../../utils'
20
+
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
+ })
66
+ defineModel<Props['modelValue']>({ required: !1, default: undefined })
67
+ const { __ } = useMyth()
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, {
72
+ syncVModel: !0,
73
+ label: getLabel,
74
+ ...toValue<any>(props.fieldOptions)
75
+ })
76
+ const { value, errorMessage, handleChange, handleBlur } = inputScope
77
+ const listeners = {
78
+ blur: (v: any) => handleBlur(v, !0),
79
+ 'update:modelValue': (v: Props['modelValue']) => handleChange(v, !!errorMessage.value)
80
+ }
81
+ const input = useTemplateRef<InstanceType<typeof QInput | typeof QField> | null>('input')
82
+ const scopes = reactive(inputScope)
83
+ defineExpose<typeof scopes & { input: typeof input }>({ input, ...scopes })
84
+ defineOptions({
85
+ name: 'MInput',
86
+ inheritAttrs: !1
87
+ })
88
+ </script>
89
+
90
+ <template>
91
+ <MCol
92
+ :auto="auto"
93
+ :class="[$attrs.class,{'m--input__required':inputRules?.required!==undefined,'m--input__error':!!errorMessage,'m--input__view':viewMode}]"
94
+ :col="col"
95
+ :lg="lg"
96
+ :md="md"
97
+ :name="name"
98
+ :sm="sm"
99
+ :xs="xs"
100
+ >
101
+ <slot
102
+ name="top-input"
103
+ v-bind="scopes"
104
+ />
105
+ <slot
106
+ name="top-label"
107
+ v-bind="scopes"
108
+ >
109
+ <MInputLabel
110
+ v-if="hasTopLabel"
111
+ :field="scopes"
112
+ >
113
+ <MHelpRow
114
+ :text="help"
115
+ tooltip
116
+ />
117
+ </MInputLabel>
118
+ </slot>
119
+ <slot name="caption">
120
+ <div
121
+ v-if="!!caption"
122
+ class="m--input__caption"
123
+ >
124
+ {{ __(caption) }}
125
+ </div>
126
+ </slot>
127
+ <component
128
+ :is="viewMode ? QField : QInput"
129
+ ref="input"
130
+ v-bind="{
131
+ ...( viewMode ? options.field : {} ),
132
+ ...$props,
133
+ ...attrs as any,
134
+ ...( viewMode ? { stackLabel: !0 } : {} ),
135
+ autocomplete:getAutocompleteAttribute,
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
+ }"
144
+ v-on="listeners"
145
+ >
146
+ <template
147
+ v-for="(_,slot) in $slots as Readonly<QInputSlots>"
148
+ :key="slot"
149
+ #[slot]
150
+ >
151
+ <slot :name="slot" />
152
+ </template>
153
+ <template
154
+ v-if="viewMode"
155
+ #control
156
+ >
157
+ <slot name="control">
158
+ <MInputFieldControl>
159
+ {{ viewModeValue ?? value }}
160
+ </MInputFieldControl>
161
+ </slot>
162
+ </template>
163
+ </component>
164
+ <slot
165
+ name="help"
166
+ v-bind="scopes"
167
+ >
168
+ <MHelpRow
169
+ v-if="!hasTopLabel"
170
+ :text="help"
171
+ />
172
+ </slot>
173
+ <slot
174
+ name="bottom-input"
175
+ v-bind="scopes"
176
+ />
177
+ </MCol>
178
+ </template>
@@ -0,0 +1,27 @@
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
+ defineOptions({
14
+ name: 'MInputFieldControl',
15
+ inheritAttrs: !1
16
+ })
17
+ </script>
18
+
19
+ <template>
20
+ <div
21
+ class="self-center full-width no-outline ellipsis"
22
+ tabindex="0"
23
+ v-bind="$attrs"
24
+ >
25
+ <slot />
26
+ </div>
27
+ </template>
@@ -0,0 +1,35 @@
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 type { MInputLabelProps as Props } from '../../types'
12
+ import { useMyth } from '../../composable'
13
+
14
+ const { __ } = useMyth()
15
+ defineProps<Props>()
16
+ defineOptions({
17
+ name: 'MInputLabel',
18
+ inheritAttrs: !1
19
+ })
20
+ </script>
21
+
22
+ <template>
23
+ <div
24
+ :class="{
25
+ 'row items-center m--input__top-label' : !0,
26
+ 'm--input__top-label__invalid' : !field?.meta?.valid && field?.meta?.dirty
27
+ }"
28
+ v-bind="$attrs"
29
+ >
30
+ <div class="m--input__top-label__content">
31
+ {{ label !== undefined ? __(label) : field?.label }}
32
+ </div>
33
+ <slot />
34
+ </div>
35
+ </template>