@mythpe/quasar-ui-qui 0.0.26 → 0.0.27-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 (92) hide show
  1. package/index.d.ts +13 -0
  2. package/package.json +15 -8
  3. package/src/boot/register.ts +14 -0
  4. package/src/components/datatable/MDatatable.vue +2305 -0
  5. package/src/components/datatable/MDtAvatar.vue +49 -0
  6. package/src/components/datatable/MDtBtn.vue +153 -0
  7. package/src/components/datatable/MDtContextmenuItems.vue +54 -0
  8. package/src/components/datatable/index.ts +6 -0
  9. package/src/components/form/MAvatarViewer.vue +327 -0
  10. package/src/components/form/MAxios.vue +144 -0
  11. package/src/components/form/MBtn.vue +271 -93
  12. package/src/components/form/MCheckbox.vue +150 -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 +148 -0
  18. package/src/components/form/MFile.vue +215 -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 +178 -0
  23. package/src/components/form/MInputFieldControl.vue +27 -0
  24. package/src/components/form/MInputLabel.vue +38 -0
  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 +313 -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 +63 -0
  36. package/src/components/grid/MBlock.vue +39 -18
  37. package/src/components/grid/MCol.vue +11 -15
  38. package/src/components/grid/MColumn.vue +12 -1
  39. package/src/components/grid/MContainer.vue +22 -13
  40. package/src/components/grid/MHelpRow.vue +13 -12
  41. package/src/components/grid/MRow.vue +31 -10
  42. package/src/components/grid/index.ts +16 -0
  43. package/src/components/index.ts +15 -0
  44. package/src/components/modal/MDialog.vue +58 -0
  45. package/src/components/modal/MModalMenu.vue +62 -0
  46. package/src/components/modal/MTooltip.vue +39 -0
  47. package/src/components/modal/index.ts +5 -0
  48. package/src/components/parials/UploaderItem.vue +298 -0
  49. package/src/components/parials/index.ts +3 -0
  50. package/src/components/transition/MFadeTransition.vue +27 -0
  51. package/src/components/transition/MFadeXTransition.vue +26 -0
  52. package/src/components/transition/MTransition.vue +44 -0
  53. package/src/components/transition/index.ts +13 -0
  54. package/src/components/typography/MTypingString.vue +8 -0
  55. package/src/components/typography/index.ts +11 -0
  56. package/src/composable/index.ts +12 -0
  57. package/src/composable/useBindInput.ts +209 -0
  58. package/src/composable/useError.ts +11 -0
  59. package/src/composable/useMyth.ts +311 -0
  60. package/src/composable/useValue.ts +12 -0
  61. package/src/index.common.js +19 -1
  62. package/src/index.esm.js +18 -3
  63. package/src/index.js +19 -0
  64. package/src/index.sass +9 -26
  65. package/src/index.ts +18 -4
  66. package/src/index.umd.js +17 -2
  67. package/src/style/m-container.sass +13 -0
  68. package/src/style/main.sass +146 -0
  69. package/src/style/print.sass +14 -0
  70. package/src/style/transition.sass +40 -0
  71. package/src/types/api-helpers.d.ts +62 -0
  72. package/src/types/components.d.ts +1075 -27
  73. package/src/types/index.d.ts +21 -1
  74. package/src/types/install-options.d.ts +19 -0
  75. package/src/types/lodash.d.ts +26 -0
  76. package/src/types/m-datatable.d.ts +316 -0
  77. package/src/types/m-geolocation.d.ts +16 -0
  78. package/src/types/m-helpers.d.ts +97 -0
  79. package/src/types/plugin-props-option.d.ts +301 -0
  80. package/src/types/quasar-helpers.d.ts +7 -0
  81. package/src/types/theme.d.ts +12 -0
  82. package/src/utils/Helpers.ts +293 -0
  83. package/src/utils/Str.ts +211 -0
  84. package/src/utils/index.ts +13 -0
  85. package/src/utils/myth.ts +109 -0
  86. package/src/utils/vee-rules.ts +32 -0
  87. package/src/utils/vue-plugin.ts +161 -0
  88. package/tsconfig.json +9 -13
  89. package/src/myth.ts +0 -30
  90. package/src/types/myth.ts +0 -42
  91. package/src/vue-plugin.ts +0 -41
  92. package/types.d.ts +0 -1
@@ -0,0 +1,148 @@
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 { useFieldError, useFieldValue } from 'vee-validate'
15
+ import type { MFieldProps as Props } from '../../types'
16
+ import { useTemplateRef } from 'vue'
17
+ import { QField, QFieldSlots } from 'quasar'
18
+ import { useBindInput, useMyth } from '../../composable'
19
+ import { myth } from '../../utils'
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
+ autocomplete?: Props['autocomplete'];
38
+ topLabel?: Props['topLabel'];
39
+ clearable?: Props['clearable'];
40
+ }
41
+
42
+ const props = withDefaults(defineProps<P>(), {
43
+ name: () => '',
44
+ auto: undefined,
45
+ col: undefined,
46
+ xs: undefined,
47
+ sm: undefined,
48
+ md: undefined,
49
+ lg: undefined,
50
+ xl: undefined,
51
+ label: undefined,
52
+ caption: undefined,
53
+ hint: undefined,
54
+ placeholder: undefined,
55
+ help: undefined,
56
+ required: undefined,
57
+ rules: undefined,
58
+ autocomplete: undefined,
59
+ topLabel: undefined,
60
+ clearable: undefined
61
+ })
62
+ const { __ } = useMyth()
63
+ const { props: options } = myth
64
+ const modelValue = defineModel<Props['modelValue']>({ required: !1, default: undefined })
65
+ const helper = useBindInput<P>(() => props, 'input')
66
+ const { hasTopLabel, getLabel, getPlaceholder, inputRules, attrs } = helper
67
+ const value = useFieldValue(() => props.name)
68
+ const errorMessage = useFieldError(() => props.name)
69
+ const input = useTemplateRef<InstanceType<typeof QField>>('input')
70
+ defineExpose<{ input: typeof input }>({ input })
71
+ defineOptions({
72
+ name: 'MField',
73
+ inheritAttrs: !1
74
+ })
75
+ </script>
76
+
77
+ <template>
78
+ <MCol
79
+ :auto="auto"
80
+ :class="[$attrs.class,{'m--input__required':inputRules?.required!==undefined,'m--input__error':!!errorMessage,'m--input__view': !0}]"
81
+ :col="col"
82
+ :lg="lg"
83
+ :md="md"
84
+ :name="name"
85
+ :sm="sm"
86
+ :xs="xs"
87
+ >
88
+ <slot name="top-input" />
89
+ <slot name="top-label">
90
+ <MInputLabel
91
+ v-if="hasTopLabel"
92
+ :field="{label: getLabel} as any"
93
+ >
94
+ <MHelpRow
95
+ :text="help"
96
+ tooltip
97
+ />
98
+ </MInputLabel>
99
+ </slot>
100
+ <slot name="caption">
101
+ <div
102
+ v-if="!!caption"
103
+ class="m--input__caption"
104
+ >
105
+ {{ __(caption) }}
106
+ </div>
107
+ </slot>
108
+ <q-field
109
+ ref="input"
110
+ v-bind="{
111
+ ...options.input as any,
112
+ ...options.field as any,
113
+ ...$attrs,
114
+ ...myth.themeInput,
115
+ clearable: !1,
116
+ stackLabel: !0,
117
+ error:!!errorMessage,
118
+ errorMessage,
119
+ hint:__(hint),
120
+ label:hasTopLabel ? undefined : getLabel,
121
+ modelValue:value,
122
+ placeholder:getPlaceholder,
123
+ }"
124
+ >
125
+ <template
126
+ v-for="(_,slot) in $slots as Readonly<QFieldSlots>"
127
+ :key="slot"
128
+ #[slot]
129
+ >
130
+ <slot :name="slot" />
131
+ </template>
132
+ <template #control>
133
+ <slot name="control">
134
+ <MInputFieldControl>
135
+ {{ modelValue ?? value }}
136
+ </MInputFieldControl>
137
+ </slot>
138
+ </template>
139
+ </q-field>
140
+ <slot name="help">
141
+ <MHelpRow
142
+ v-if="!hasTopLabel"
143
+ :text="help"
144
+ />
145
+ </slot>
146
+ <slot name="bottom-input" />
147
+ </MCol>
148
+ </template>
@@ -0,0 +1,215 @@
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 { QField, QFile, QFileSlots } from 'quasar'
15
+ import { useBindInput, useMyth } from '../../composable'
16
+ import { useField } from 'vee-validate'
17
+ import { reactive, toValue, useTemplateRef } from 'vue'
18
+ import type { MFileProps as Props } from '../../types'
19
+ import { myth } from '../../utils'
20
+
21
+ interface 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
+ topLabel?: Props['topLabel'];
40
+ accept?: Props['accept'];
41
+ images?: Props['images'];
42
+ svg?: Props['svg'];
43
+ video?: Props['video'];
44
+ pdf?: Props['pdf'];
45
+ excel?: Props['excel'];
46
+ fieldOptions?: Props['fieldOptions'];
47
+ }
48
+
49
+ const props = withDefaults(defineProps<P>(), {
50
+ name: () => '',
51
+ auto: undefined,
52
+ col: undefined,
53
+ xs: undefined,
54
+ sm: undefined,
55
+ md: undefined,
56
+ lg: undefined,
57
+ xl: undefined,
58
+ label: undefined,
59
+ caption: undefined,
60
+ hint: undefined,
61
+ placeholder: undefined,
62
+ help: undefined,
63
+ required: undefined,
64
+ rules: undefined,
65
+ viewMode: () => !1,
66
+ viewModeValue: undefined,
67
+ topLabel: undefined,
68
+ accept: undefined,
69
+ images: () => !1,
70
+ svg: () => !1,
71
+ video: () => !1,
72
+ pdf: () => !1,
73
+ excel: () => !1,
74
+ fieldOptions: undefined
75
+ })
76
+ defineModel<Props['modelValue']>({ required: !1, default: undefined })
77
+ const { __ } = useMyth()
78
+ const { props: options } = myth
79
+ const helper = useBindInput<P>(() => props, 'file', () => ({ choose: !0 }))
80
+ const { hasTopLabel, getLabel, getPlaceholder, accepts, inputRules } = helper
81
+ const inputScope = useField<Props['modelValue']>(() => props.name, inputRules, {
82
+ syncVModel: !0,
83
+ label: getLabel,
84
+ ...toValue<any>(props.fieldOptions)
85
+ })
86
+ const { value, errorMessage, handleChange, handleBlur } = inputScope
87
+
88
+ const listeners = {
89
+ focus: (v: Event) => handleBlur(v, !1),
90
+ blur: (v: Event) => handleBlur(v, !1),
91
+ clear: (v: Event) => handleBlur(v, !0),
92
+ 'update:modelValue': (v: Props['modelValue']) => handleChange(v, !!errorMessage.value)
93
+ }
94
+ const input = useTemplateRef<InstanceType<typeof QFile> | InstanceType<typeof QField>>('input')
95
+ const scopes = reactive(inputScope)
96
+
97
+ const pickFiles = (evt?: Event) => (input.value as QFile)?.pickFiles(evt)
98
+ const addFiles = (files: readonly any[] | FileList) => (input.value as QFile)?.addFiles(files)
99
+ const resetValidation = () => (input.value as QFile)?.resetValidation()
100
+ const validate = (value?: any) => (input.value as QFile)?.validate(value)
101
+ const focus = () => (input.value as QFile)?.focus()
102
+ const blur = () => (input.value as QFile)?.blur()
103
+ const removeAtIndex = (index: number) => (input.value as QFile)?.removeAtIndex(index)
104
+ const removeFile = (index: number) => (input.value as QFile)?.removeAtIndex(index)
105
+ const methods = {
106
+ pickFiles,
107
+ addFiles,
108
+ resetValidation,
109
+ validate,
110
+ focus,
111
+ blur,
112
+ removeAtIndex,
113
+ removeFile
114
+ }
115
+
116
+ defineExpose({ input, ...scopes, ...methods })
117
+ defineOptions({
118
+ name: 'MFile',
119
+ inheritAttrs: !1
120
+ })
121
+ </script>
122
+
123
+ <template>
124
+ <MCol
125
+ :auto="auto"
126
+ :class="[$attrs.class,{'m--input__required':inputRules?.required!==undefined,'m--input__error':!!errorMessage,'m--input__view':viewMode}]"
127
+ :col="col"
128
+ :lg="lg"
129
+ :md="md"
130
+ :name="name"
131
+ :sm="sm"
132
+ :xs="xs"
133
+ >
134
+ <slot
135
+ name="top-input"
136
+ v-bind="scopes"
137
+ />
138
+ <slot name="top-label">
139
+ <MInputLabel
140
+ v-if="hasTopLabel"
141
+ :field="scopes"
142
+ >
143
+ <MHelpRow
144
+ :text="help"
145
+ tooltip
146
+ />
147
+ </MInputLabel>
148
+ </slot>
149
+ <slot name="caption">
150
+ <div
151
+ v-if="!!caption"
152
+ class="m--input__caption"
153
+ >
154
+ {{ __(caption) }}
155
+ </div>
156
+ </slot>
157
+ <component
158
+ :is="viewMode ? QField : QFile"
159
+ ref="input"
160
+ :accept="accepts.join(',')"
161
+ :error="!!errorMessage"
162
+ :error-message="errorMessage"
163
+ :hint="__(hint)"
164
+ :label="hasTopLabel ? (viewMode ? undefined : getPlaceholder) : getLabel"
165
+ :model-value="value"
166
+ v-bind="{ ...options.file as any,...( viewMode ? options.field : {} ), ...$attrs, ...( viewMode ? { stackLabel: !0 } : {} ) }"
167
+ v-on="listeners"
168
+ >
169
+ <template #prepend>
170
+ <slot name="prepend">
171
+ <q-icon
172
+ class="cursor-pointer"
173
+ name="ion-ios-attach"
174
+ @click="pickFiles($event)"
175
+ />
176
+ </slot>
177
+ </template>
178
+
179
+ <template
180
+ v-for="(_,slot) in $slots as Readonly<QFileSlots>"
181
+ :key="slot"
182
+ #[slot]
183
+ >
184
+ <slot :name="slot" />
185
+ </template>
186
+ <template
187
+ v-if="viewMode"
188
+ #control
189
+ >
190
+ <slot name="control">
191
+ <MInputFieldControl>
192
+ {{ viewModeValue ?? value }}
193
+ </MInputFieldControl>
194
+ </slot>
195
+ </template>
196
+ </component>
197
+ <slot
198
+ name="help"
199
+ v-bind="scopes"
200
+ >
201
+ <MHelpRow
202
+ v-if="!hasTopLabel"
203
+ :text="help"
204
+ />
205
+ </slot>
206
+ <slot
207
+ name="bottom-input"
208
+ v-bind="scopes"
209
+ />
210
+ </MCol>
211
+ <slot
212
+ name="hidden"
213
+ v-bind="scopes"
214
+ />
215
+ </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>