@mythpe/quasar-ui-qui 0.0.23 → 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.
- package/index.d.ts +17 -0
- package/package.json +14 -9
- package/src/boot/register.ts +14 -0
- package/src/components/form/MAvatarViewer.vue +324 -0
- package/src/components/form/MBtn.vue +271 -93
- package/src/components/form/MCheckbox.vue +123 -0
- package/src/components/form/MColor.vue +122 -0
- package/src/components/form/MDate.vue +47 -0
- package/src/components/form/MEditor.vue +285 -0
- package/src/components/form/MEmail.vue +40 -0
- package/src/components/form/MField.vue +142 -0
- package/src/components/form/MFile.vue +209 -0
- package/src/components/form/MForm.vue +83 -0
- package/src/components/form/MHidden.vue +83 -0
- package/src/components/form/MHiddenInput.vue +55 -0
- package/src/components/form/MInput.vue +178 -0
- package/src/components/form/MInputFieldControl.vue +27 -0
- package/src/components/form/MInputLabel.vue +35 -0
- package/src/components/form/MMobile.vue +37 -0
- package/src/components/form/MPicker.vue +310 -0
- package/src/components/form/MRadio.vue +175 -0
- package/src/components/form/MSelect.vue +343 -0
- package/src/components/form/MTime.vue +45 -0
- package/src/components/form/index.ts +51 -0
- package/src/components/grid/MBlock.vue +40 -18
- package/src/components/grid/MCol.vue +11 -15
- package/src/components/grid/MColumn.vue +8 -0
- package/src/components/grid/MContainer.vue +22 -13
- package/src/components/grid/MHelpRow.vue +9 -12
- package/src/components/grid/MRow.vue +31 -10
- package/src/components/grid/index.ts +16 -0
- package/src/components/index.ts +12 -0
- package/src/components/transition/MFadeTransition.vue +27 -0
- package/src/components/transition/MFadeXTransition.vue +26 -0
- package/src/components/transition/MTransition.vue +41 -0
- package/src/components/transition/index.ts +13 -0
- package/src/components/typography/MTypingString.vue +8 -0
- package/src/components/typography/index.ts +11 -0
- package/src/composable/index.ts +12 -0
- package/src/composable/useBindInput.ts +209 -0
- package/src/composable/useError.ts +11 -0
- package/src/composable/useMyth.ts +294 -0
- package/src/composable/useValue.ts +12 -0
- package/src/index.common.js +19 -1
- package/src/index.esm.js +18 -3
- package/src/index.js +19 -0
- package/src/index.sass +8 -26
- package/src/index.ts +18 -4
- package/src/index.umd.js +16 -2
- package/src/style/m-container.sass +13 -0
- package/src/style/main.sass +42 -0
- package/src/types/api-helpers.d.ts +120 -0
- package/src/types/components.d.ts +682 -28
- package/src/types/dt.d.ts +142 -0
- package/src/types/index.d.ts +153 -1
- package/src/types/lodash.d.ts +26 -0
- package/src/types/quasar-helpers.d.ts +7 -0
- package/src/types/theme.d.ts +12 -0
- package/src/utils/Helpers.ts +321 -0
- package/src/utils/Str.ts +210 -0
- package/src/utils/index.ts +13 -0
- package/src/utils/myth.ts +90 -0
- package/src/utils/vee-rules.ts +32 -0
- package/src/utils/vue-plugin.ts +122 -0
- package/tsconfig.json +9 -13
- package/src/myth.ts +0 -30
- package/src/types/myth.ts +0 -42
- package/src/vue-plugin.ts +0 -41
- package/types.d.ts +0 -1
|
@@ -0,0 +1,47 @@
|
|
|
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 { MDateProps as Props, MInputSlots } from '../../types'
|
|
11
|
+
import { useTemplateRef } from 'vue'
|
|
12
|
+
import MPicker from './MPicker.vue'
|
|
13
|
+
|
|
14
|
+
type P = {
|
|
15
|
+
name: Props['name'];
|
|
16
|
+
rules?: Props['rules'];
|
|
17
|
+
}
|
|
18
|
+
withDefaults(defineProps<P>(), {
|
|
19
|
+
name: () => '',
|
|
20
|
+
rules: undefined
|
|
21
|
+
})
|
|
22
|
+
const modelValue = defineModel<Props['modelValue']>({ required: !1, default: undefined })
|
|
23
|
+
const input = useTemplateRef<InstanceType<typeof MPicker>>('input')
|
|
24
|
+
defineExpose<{
|
|
25
|
+
input: typeof input
|
|
26
|
+
}>({ input })
|
|
27
|
+
defineOptions({
|
|
28
|
+
name: 'MDate',
|
|
29
|
+
inheritAttrs: !1
|
|
30
|
+
})
|
|
31
|
+
</script>
|
|
32
|
+
|
|
33
|
+
<template>
|
|
34
|
+
<MPicker
|
|
35
|
+
ref="input"
|
|
36
|
+
v-model="modelValue"
|
|
37
|
+
v-bind="{...$attrs,type:'date',name}"
|
|
38
|
+
>
|
|
39
|
+
<template
|
|
40
|
+
v-for="(_,slot) in $slots as Readonly<MInputSlots>"
|
|
41
|
+
:key="slot"
|
|
42
|
+
#[slot]
|
|
43
|
+
>
|
|
44
|
+
<slot :name="slot" />
|
|
45
|
+
</template>
|
|
46
|
+
</MPicker>
|
|
47
|
+
</template>
|
|
@@ -0,0 +1,285 @@
|
|
|
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 { QEditor, QField, useQuasar } from 'quasar'
|
|
14
|
+
import { useBindInput, useMyth } from '../../composable'
|
|
15
|
+
import { useField } from 'vee-validate'
|
|
16
|
+
import type { MEditorProps as Props } from '../../types'
|
|
17
|
+
import { reactive, toValue, useTemplateRef } from 'vue'
|
|
18
|
+
import { myth } from '../../utils'
|
|
19
|
+
|
|
20
|
+
const $q = useQuasar()
|
|
21
|
+
const _toolbar = [
|
|
22
|
+
[
|
|
23
|
+
// {
|
|
24
|
+
// label: $q.lang.editor.align,
|
|
25
|
+
// icon: $q.iconSet.editor.align,
|
|
26
|
+
// fixedLabel: true,
|
|
27
|
+
// list: 'only-icons',
|
|
28
|
+
// options: ['left', 'center', 'right', 'justify']
|
|
29
|
+
// },
|
|
30
|
+
{
|
|
31
|
+
label: $q.lang.editor.align,
|
|
32
|
+
icon: $q.iconSet.editor.align,
|
|
33
|
+
fixedLabel: true,
|
|
34
|
+
options: ['left', 'center', 'right', 'justify']
|
|
35
|
+
}
|
|
36
|
+
],
|
|
37
|
+
['bold', 'italic', 'strike', 'underline', 'subscript', 'superscript'],
|
|
38
|
+
['hr', 'link', 'print', 'fullscreen'],
|
|
39
|
+
[
|
|
40
|
+
{
|
|
41
|
+
label: $q.lang.editor.formatting,
|
|
42
|
+
icon: $q.iconSet.editor.formatting,
|
|
43
|
+
list: 'no-icons',
|
|
44
|
+
options: [
|
|
45
|
+
'p',
|
|
46
|
+
'h1',
|
|
47
|
+
'h2',
|
|
48
|
+
'h3',
|
|
49
|
+
'h4',
|
|
50
|
+
'h5',
|
|
51
|
+
'h6',
|
|
52
|
+
'code'
|
|
53
|
+
]
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
label: $q.lang.editor.fontSize,
|
|
57
|
+
icon: $q.iconSet.editor.fontSize,
|
|
58
|
+
fixedLabel: true,
|
|
59
|
+
fixedIcon: true,
|
|
60
|
+
list: 'no-icons',
|
|
61
|
+
options: [
|
|
62
|
+
'size-1',
|
|
63
|
+
'size-2',
|
|
64
|
+
'size-3',
|
|
65
|
+
'size-4',
|
|
66
|
+
'size-5',
|
|
67
|
+
'size-6',
|
|
68
|
+
'size-7'
|
|
69
|
+
]
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
label: $q.lang.editor.fontSize,
|
|
73
|
+
icon: $q.iconSet.editor.fontSize,
|
|
74
|
+
fixedLabel: true,
|
|
75
|
+
fixedIcon: true,
|
|
76
|
+
list: 'no-icons',
|
|
77
|
+
options: [
|
|
78
|
+
'size-1',
|
|
79
|
+
'size-2',
|
|
80
|
+
'size-3',
|
|
81
|
+
'size-4',
|
|
82
|
+
'size-5',
|
|
83
|
+
'size-6',
|
|
84
|
+
'size-7'
|
|
85
|
+
]
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
label: $q.lang.editor.defaultFont,
|
|
89
|
+
icon: $q.iconSet.editor.font,
|
|
90
|
+
fixedIcon: true,
|
|
91
|
+
list: 'no-icons',
|
|
92
|
+
options: [
|
|
93
|
+
'default_font',
|
|
94
|
+
'arial',
|
|
95
|
+
'arial_black',
|
|
96
|
+
'comic_sans',
|
|
97
|
+
'courier_new',
|
|
98
|
+
'impact',
|
|
99
|
+
'lucida_grande',
|
|
100
|
+
'times_new_roman',
|
|
101
|
+
'verdana'
|
|
102
|
+
]
|
|
103
|
+
},
|
|
104
|
+
'removeFormat'
|
|
105
|
+
],
|
|
106
|
+
['quote', 'unordered', 'ordered', 'outdent', 'indent'],
|
|
107
|
+
['undo', 'redo'],
|
|
108
|
+
['viewsource']
|
|
109
|
+
]
|
|
110
|
+
const _fonts = {
|
|
111
|
+
arial: 'Arial',
|
|
112
|
+
arial_black: 'Arial Black',
|
|
113
|
+
comic_sans: 'Comic Sans MS',
|
|
114
|
+
courier_new: 'Courier New',
|
|
115
|
+
impact: 'Impact',
|
|
116
|
+
lucida_grande: 'Lucida Grande',
|
|
117
|
+
times_new_roman: 'Times New Roman',
|
|
118
|
+
verdana: 'Verdana'
|
|
119
|
+
}
|
|
120
|
+
const _definitions = {
|
|
121
|
+
colors: {
|
|
122
|
+
label: 'Colors',
|
|
123
|
+
tip: 'Change the text & background colors',
|
|
124
|
+
icon: 'colorize'
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
interface P {
|
|
129
|
+
auto?: Props['auto'];
|
|
130
|
+
col?: Props['col'];
|
|
131
|
+
xs?: Props['xs'];
|
|
132
|
+
sm?: Props['sm'];
|
|
133
|
+
md?: Props['md'];
|
|
134
|
+
lg?: Props['lg'];
|
|
135
|
+
xl?: Props['xl'];
|
|
136
|
+
minHeight?: Props['minHeight'];
|
|
137
|
+
name: Props['name'];
|
|
138
|
+
label?: Props['label'];
|
|
139
|
+
caption?: Props['caption'];
|
|
140
|
+
hint?: Props['hint'];
|
|
141
|
+
placeholder?: Props['placeholder'];
|
|
142
|
+
help?: Props['help'];
|
|
143
|
+
dense?: Props['dense'];
|
|
144
|
+
toolbar?: Props['toolbar'];
|
|
145
|
+
fonts?: Props['fonts'];
|
|
146
|
+
rules?: Props['rules'];
|
|
147
|
+
viewMode?: Props['viewMode'];
|
|
148
|
+
topLabel?: Props['topLabel'];
|
|
149
|
+
required?: Props['required'];
|
|
150
|
+
fieldOptions?: Props['fieldOptions'];
|
|
151
|
+
useChoice?: Props['useChoice'];
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
const props = withDefaults(defineProps<P>(), {
|
|
155
|
+
auto: undefined,
|
|
156
|
+
col: undefined,
|
|
157
|
+
xs: undefined,
|
|
158
|
+
sm: undefined,
|
|
159
|
+
md: undefined,
|
|
160
|
+
lg: undefined,
|
|
161
|
+
xl: undefined,
|
|
162
|
+
minHeight: () => '10rem',
|
|
163
|
+
name: () => '',
|
|
164
|
+
label: undefined,
|
|
165
|
+
caption: undefined,
|
|
166
|
+
hint: undefined,
|
|
167
|
+
placeholder: undefined,
|
|
168
|
+
help: undefined,
|
|
169
|
+
dense: undefined,
|
|
170
|
+
toolbar: undefined,
|
|
171
|
+
fonts: undefined,
|
|
172
|
+
rules: undefined,
|
|
173
|
+
topLabel: undefined,
|
|
174
|
+
viewMode: undefined,
|
|
175
|
+
required: undefined,
|
|
176
|
+
fieldOptions: undefined,
|
|
177
|
+
useChoice: undefined
|
|
178
|
+
})
|
|
179
|
+
const { __ } = useMyth()
|
|
180
|
+
const { props: pluginOptions, themeInput } = myth
|
|
181
|
+
defineModel<Props['modelValue']>({ required: !1, default: undefined })
|
|
182
|
+
const helper = useBindInput<any>(() => props, 'editor')
|
|
183
|
+
const { hasTopLabel, getLabel, getPlaceholder, inputRules } = helper
|
|
184
|
+
const inputScope = useField<Props['modelValue']>(() => props.name, inputRules, {
|
|
185
|
+
syncVModel: !0,
|
|
186
|
+
label: getLabel,
|
|
187
|
+
...toValue<any>(props.fieldOptions)
|
|
188
|
+
})
|
|
189
|
+
const { value, errorMessage, handleChange } = inputScope
|
|
190
|
+
|
|
191
|
+
const listeners = {
|
|
192
|
+
'update:modelValue': (v: Props['modelValue']) => handleChange(v, !!errorMessage.value)
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
const input = useTemplateRef<InstanceType<typeof QEditor> | InstanceType<typeof QField>>('input')
|
|
196
|
+
const scopes = reactive(inputScope)
|
|
197
|
+
defineExpose<typeof scopes & { input: typeof input }>({ input, ...scopes })
|
|
198
|
+
defineOptions({
|
|
199
|
+
name: 'MEditor',
|
|
200
|
+
inheritAttrs: !1
|
|
201
|
+
})
|
|
202
|
+
</script>
|
|
203
|
+
|
|
204
|
+
<template>
|
|
205
|
+
<MCol
|
|
206
|
+
:auto="auto"
|
|
207
|
+
:class="[$attrs.class,{'m--input__required':inputRules?.required!==undefined,'m--input__error':!!errorMessage,'m--input__view':viewMode}]"
|
|
208
|
+
:col="col"
|
|
209
|
+
:lg="lg"
|
|
210
|
+
:md="md"
|
|
211
|
+
:name="name"
|
|
212
|
+
:sm="sm"
|
|
213
|
+
:xs="xs"
|
|
214
|
+
>
|
|
215
|
+
<slot
|
|
216
|
+
name="top-input"
|
|
217
|
+
v-bind="inputScope"
|
|
218
|
+
/>
|
|
219
|
+
<slot name="top-label">
|
|
220
|
+
<MInputLabel
|
|
221
|
+
v-if="hasTopLabel"
|
|
222
|
+
:field="scopes"
|
|
223
|
+
>
|
|
224
|
+
<MHelpRow
|
|
225
|
+
:text="help"
|
|
226
|
+
tooltip
|
|
227
|
+
/>
|
|
228
|
+
</MInputLabel>
|
|
229
|
+
</slot>
|
|
230
|
+
<slot name="caption">
|
|
231
|
+
<div
|
|
232
|
+
v-if="!!caption"
|
|
233
|
+
class="m--input__caption"
|
|
234
|
+
>
|
|
235
|
+
{{ __(caption) }}
|
|
236
|
+
</div>
|
|
237
|
+
</slot>
|
|
238
|
+
<slot
|
|
239
|
+
name="help"
|
|
240
|
+
v-bind="inputScope"
|
|
241
|
+
>
|
|
242
|
+
<MHelpRow :text="help" />
|
|
243
|
+
</slot>
|
|
244
|
+
<component
|
|
245
|
+
:is="viewMode ? QField : QEditor"
|
|
246
|
+
ref="input"
|
|
247
|
+
:_definitions="{..._definitions,...pluginOptions.editor?.definitions}"
|
|
248
|
+
:fonts="fonts || _fonts"
|
|
249
|
+
:label="hasTopLabel ? undefined : getLabel"
|
|
250
|
+
:min-height="minHeight"
|
|
251
|
+
:model-value="value || ''"
|
|
252
|
+
:placeholder="getPlaceholder"
|
|
253
|
+
:toolbar="toolbar || _toolbar"
|
|
254
|
+
v-bind="{
|
|
255
|
+
...pluginOptions.editor as any,
|
|
256
|
+
...( viewMode ? pluginOptions.field : {} ),
|
|
257
|
+
...$attrs,
|
|
258
|
+
...( viewMode ? { stackLabel: !0 } : {} ),
|
|
259
|
+
dense: themeInput.dense !== undefined ? themeInput.dense : $q.screen.lt.lg
|
|
260
|
+
}"
|
|
261
|
+
v-on="listeners"
|
|
262
|
+
/>
|
|
263
|
+
<slot
|
|
264
|
+
name="help"
|
|
265
|
+
v-bind="scopes"
|
|
266
|
+
>
|
|
267
|
+
<MHelpRow
|
|
268
|
+
v-if="!hasTopLabel"
|
|
269
|
+
:text="help"
|
|
270
|
+
/>
|
|
271
|
+
</slot>
|
|
272
|
+
<slot
|
|
273
|
+
name="bottom-input"
|
|
274
|
+
v-bind="inputScope"
|
|
275
|
+
/>
|
|
276
|
+
<MFadeXTransition>
|
|
277
|
+
<p
|
|
278
|
+
v-if="!!errorMessage"
|
|
279
|
+
class="text-body2 text-negative"
|
|
280
|
+
>
|
|
281
|
+
{{ errorMessage }}
|
|
282
|
+
</p>
|
|
283
|
+
</MFadeXTransition>
|
|
284
|
+
</MCol>
|
|
285
|
+
</template>
|
|
@@ -0,0 +1,40 @@
|
|
|
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
|
+
|
|
14
|
+
defineProps<Props>()
|
|
15
|
+
const modelValue = defineModel<Props['modelValue']>({ required: !1, default: undefined })
|
|
16
|
+
const input = useTemplateRef<InstanceType<typeof MInput>>('input')
|
|
17
|
+
defineExpose<{
|
|
18
|
+
input: typeof input
|
|
19
|
+
}>({ input })
|
|
20
|
+
defineOptions({
|
|
21
|
+
name: 'MEmail',
|
|
22
|
+
inheritAttrs: !1
|
|
23
|
+
})
|
|
24
|
+
</script>
|
|
25
|
+
|
|
26
|
+
<template>
|
|
27
|
+
<MInput
|
|
28
|
+
ref="input"
|
|
29
|
+
v-model="modelValue"
|
|
30
|
+
v-bind="{...$attrs,...$props,type:'email',email:!0}"
|
|
31
|
+
>
|
|
32
|
+
<template
|
|
33
|
+
v-for="(_,slot) in $slots as Readonly<MInputSlots>"
|
|
34
|
+
:key="slot"
|
|
35
|
+
#[slot]
|
|
36
|
+
>
|
|
37
|
+
<slot :name="slot" />
|
|
38
|
+
</template>
|
|
39
|
+
</MInput>
|
|
40
|
+
</template>
|
|
@@ -0,0 +1,142 @@
|
|
|
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 { useFieldError, useFieldValue } from 'vee-validate'
|
|
12
|
+
import type { MFieldProps as Props } from '../../types'
|
|
13
|
+
import { useTemplateRef } from 'vue'
|
|
14
|
+
import { QField, QFieldSlots } from 'quasar'
|
|
15
|
+
import { useBindInput, useMyth } from '../../composable'
|
|
16
|
+
import { myth } from '../../utils'
|
|
17
|
+
|
|
18
|
+
type 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
|
+
autocomplete?: Props['autocomplete'];
|
|
35
|
+
topLabel?: Props['topLabel'];
|
|
36
|
+
clearable?: Props['clearable'];
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const props = withDefaults(defineProps<P>(), {
|
|
40
|
+
name: () => '',
|
|
41
|
+
auto: undefined,
|
|
42
|
+
col: undefined,
|
|
43
|
+
xs: undefined,
|
|
44
|
+
sm: undefined,
|
|
45
|
+
md: undefined,
|
|
46
|
+
lg: undefined,
|
|
47
|
+
xl: undefined,
|
|
48
|
+
label: undefined,
|
|
49
|
+
caption: undefined,
|
|
50
|
+
hint: undefined,
|
|
51
|
+
placeholder: undefined,
|
|
52
|
+
help: undefined,
|
|
53
|
+
required: undefined,
|
|
54
|
+
rules: undefined,
|
|
55
|
+
autocomplete: undefined,
|
|
56
|
+
topLabel: undefined,
|
|
57
|
+
clearable: undefined
|
|
58
|
+
})
|
|
59
|
+
const { __ } = useMyth()
|
|
60
|
+
const { props: options } = myth
|
|
61
|
+
const modelValue = defineModel<Props['modelValue']>({ required: !1, default: undefined })
|
|
62
|
+
const helper = useBindInput<P>(() => props, 'input')
|
|
63
|
+
const { hasTopLabel, getLabel, getPlaceholder, inputRules, attrs } = helper
|
|
64
|
+
const value = useFieldValue(() => props.name)
|
|
65
|
+
const errorMessage = useFieldError(() => props.name)
|
|
66
|
+
const input = useTemplateRef<InstanceType<typeof QField>>('input')
|
|
67
|
+
defineExpose<{ input: typeof input }>({ input })
|
|
68
|
+
defineOptions({ name: 'MField', inheritAttrs: !1 })
|
|
69
|
+
</script>
|
|
70
|
+
|
|
71
|
+
<template>
|
|
72
|
+
<MCol
|
|
73
|
+
:auto="auto"
|
|
74
|
+
:class="[$attrs.class,{'m--input__required':inputRules?.required!==undefined,'m--input__error':!!errorMessage,'m--input__view': !0}]"
|
|
75
|
+
:col="col"
|
|
76
|
+
:lg="lg"
|
|
77
|
+
:md="md"
|
|
78
|
+
:name="name"
|
|
79
|
+
:sm="sm"
|
|
80
|
+
:xs="xs"
|
|
81
|
+
>
|
|
82
|
+
<slot name="top-input" />
|
|
83
|
+
<slot name="top-label">
|
|
84
|
+
<MInputLabel
|
|
85
|
+
v-if="hasTopLabel"
|
|
86
|
+
:field="{label: getLabel} as any"
|
|
87
|
+
>
|
|
88
|
+
<MHelpRow
|
|
89
|
+
:text="help"
|
|
90
|
+
tooltip
|
|
91
|
+
/>
|
|
92
|
+
</MInputLabel>
|
|
93
|
+
</slot>
|
|
94
|
+
<slot name="caption">
|
|
95
|
+
<div
|
|
96
|
+
v-if="!!caption"
|
|
97
|
+
class="m--input__caption"
|
|
98
|
+
>
|
|
99
|
+
{{ __(caption) }}
|
|
100
|
+
</div>
|
|
101
|
+
</slot>
|
|
102
|
+
<q-field
|
|
103
|
+
ref="input"
|
|
104
|
+
v-bind="{
|
|
105
|
+
...options.input as any,
|
|
106
|
+
...options.field as any,
|
|
107
|
+
...$attrs,
|
|
108
|
+
...myth.themeInput,
|
|
109
|
+
clearable: !1,
|
|
110
|
+
stackLabel: !0,
|
|
111
|
+
error:!!errorMessage,
|
|
112
|
+
errorMessage,
|
|
113
|
+
hint:__(hint),
|
|
114
|
+
label:hasTopLabel ? undefined : getLabel,
|
|
115
|
+
modelValue:value,
|
|
116
|
+
placeholder:getPlaceholder,
|
|
117
|
+
}"
|
|
118
|
+
>
|
|
119
|
+
<template
|
|
120
|
+
v-for="(_,slot) in $slots as Readonly<QFieldSlots>"
|
|
121
|
+
:key="slot"
|
|
122
|
+
#[slot]
|
|
123
|
+
>
|
|
124
|
+
<slot :name="slot" />
|
|
125
|
+
</template>
|
|
126
|
+
<template #control>
|
|
127
|
+
<slot name="control">
|
|
128
|
+
<MInputFieldControl>
|
|
129
|
+
{{ modelValue ?? value }}
|
|
130
|
+
</MInputFieldControl>
|
|
131
|
+
</slot>
|
|
132
|
+
</template>
|
|
133
|
+
</q-field>
|
|
134
|
+
<slot name="help">
|
|
135
|
+
<MHelpRow
|
|
136
|
+
v-if="!hasTopLabel"
|
|
137
|
+
:text="help"
|
|
138
|
+
/>
|
|
139
|
+
</slot>
|
|
140
|
+
<slot name="bottom-input" />
|
|
141
|
+
</MCol>
|
|
142
|
+
</template>
|