@mythpe/quasar-ui-qui 0.0.58 → 0.0.59
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/package.json
CHANGED
|
@@ -12,41 +12,39 @@
|
|
|
12
12
|
>
|
|
13
13
|
import { useField } from 'vee-validate'
|
|
14
14
|
import { reactive, toValue, useTemplateRef } from 'vue'
|
|
15
|
-
import type { MInputProps as Props } from '../../types'
|
|
16
15
|
import { QField, QInput, type QInputSlots } from 'quasar'
|
|
17
16
|
import { useBindInput, useMyth } from '../../composable'
|
|
17
|
+
import type { MInputProps as Props } from '../../types'
|
|
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
|
+
label?: Props['label'];
|
|
29
|
+
caption?: Props['caption'];
|
|
30
|
+
hint?: Props['hint'];
|
|
31
|
+
placeholder?: Props['placeholder'];
|
|
32
|
+
help?: Props['help'];
|
|
33
|
+
required?: Props['required'];
|
|
34
|
+
rules?: Props['rules'];
|
|
35
|
+
viewMode?: Props['viewMode'];
|
|
36
|
+
viewModeValue?: Props['viewModeValue'];
|
|
37
|
+
autocomplete?: Props['autocomplete'];
|
|
38
|
+
topLabel?: Props['topLabel'];
|
|
39
|
+
fieldOptions?: Props['fieldOptions'];
|
|
40
|
+
clearable?: Props['clearable'];
|
|
41
|
+
mobile?: Props['mobile'];
|
|
42
|
+
email?: Props['email'];
|
|
43
|
+
float?: Props['float'];
|
|
44
|
+
}
|
|
18
45
|
|
|
19
|
-
const props = withDefaults(defineProps<
|
|
46
|
+
const props = withDefaults(defineProps<P>(), {
|
|
20
47
|
name: () => '',
|
|
21
|
-
fillMask: undefined,
|
|
22
|
-
reverseFillMask: undefined,
|
|
23
|
-
unmaskedValue: undefined,
|
|
24
|
-
error: undefined,
|
|
25
|
-
noErrorIcon: undefined,
|
|
26
|
-
reactiveRules: undefined,
|
|
27
|
-
lazyRules: undefined,
|
|
28
|
-
stackLabel: undefined,
|
|
29
|
-
hideHint: undefined,
|
|
30
|
-
dark: undefined,
|
|
31
|
-
loading: undefined,
|
|
32
|
-
clearable: undefined,
|
|
33
|
-
filled: undefined,
|
|
34
|
-
outlined: undefined,
|
|
35
|
-
borderless: undefined,
|
|
36
|
-
standout: undefined,
|
|
37
|
-
labelSlot: undefined,
|
|
38
|
-
bottomSlots: undefined,
|
|
39
|
-
hideBottomSpace: undefined,
|
|
40
|
-
counter: undefined,
|
|
41
|
-
rounded: undefined,
|
|
42
|
-
square: undefined,
|
|
43
|
-
dense: undefined,
|
|
44
|
-
itemAligned: undefined,
|
|
45
|
-
disable: undefined,
|
|
46
|
-
readonly: undefined,
|
|
47
|
-
autofocus: undefined,
|
|
48
|
-
autogrow: undefined,
|
|
49
|
-
viewMode: undefined,
|
|
50
48
|
auto: undefined,
|
|
51
49
|
col: undefined,
|
|
52
50
|
xs: undefined,
|
|
@@ -54,9 +52,19 @@ const props = withDefaults(defineProps<Props>(), {
|
|
|
54
52
|
md: undefined,
|
|
55
53
|
lg: undefined,
|
|
56
54
|
xl: undefined,
|
|
55
|
+
label: undefined,
|
|
56
|
+
caption: undefined,
|
|
57
|
+
hint: undefined,
|
|
58
|
+
placeholder: undefined,
|
|
59
|
+
help: undefined,
|
|
57
60
|
required: undefined,
|
|
61
|
+
rules: undefined,
|
|
62
|
+
viewMode: () => !1,
|
|
63
|
+
viewModeValue: undefined,
|
|
58
64
|
autocomplete: undefined,
|
|
59
65
|
topLabel: undefined,
|
|
66
|
+
fieldOptions: undefined,
|
|
67
|
+
clearable: undefined,
|
|
60
68
|
mobile: undefined,
|
|
61
69
|
email: undefined,
|
|
62
70
|
float: undefined
|
|
@@ -64,7 +72,7 @@ const props = withDefaults(defineProps<Props>(), {
|
|
|
64
72
|
defineModel<Props['modelValue']>({ required: !1, default: undefined })
|
|
65
73
|
const { __ } = useMyth()
|
|
66
74
|
const helper = useBindInput<Props>(() => props, 'input')
|
|
67
|
-
const {
|
|
75
|
+
const { theme, hasTopLabel, getLabel, getPlaceholder, getAutocompleteAttribute, inputRules } = helper
|
|
68
76
|
const inputScope = useField<Props['modelValue']>(() => props.name, inputRules, {
|
|
69
77
|
syncVModel: !0,
|
|
70
78
|
label: getLabel,
|
|
@@ -126,17 +134,17 @@ defineOptions({
|
|
|
126
134
|
:is="viewMode ? QField : QInput"
|
|
127
135
|
ref="input"
|
|
128
136
|
v-bind="{
|
|
129
|
-
|
|
137
|
+
...$attrs,
|
|
138
|
+
...theme,
|
|
130
139
|
...( viewMode ? { stackLabel: !0 } : {} ),
|
|
131
140
|
autocomplete: getAutocompleteAttribute,
|
|
132
141
|
clearable: viewMode ? !1 : clearable,
|
|
133
142
|
error: !!errorMessage,
|
|
134
|
-
required,
|
|
135
143
|
errorMessage,
|
|
136
144
|
hint: __(hint),
|
|
137
|
-
label: hasTopLabel?undefined:getLabel,
|
|
145
|
+
label: hasTopLabel ? undefined : getLabel,
|
|
138
146
|
modelValue: value,
|
|
139
|
-
placeholder:getPlaceholder
|
|
147
|
+
placeholder: getPlaceholder
|
|
140
148
|
}"
|
|
141
149
|
v-on="listeners"
|
|
142
150
|
>
|
|
@@ -27,7 +27,15 @@ export const useBindInput = <P extends G = G> (Props: MaybeRefOrGetter<P>, key:
|
|
|
27
27
|
const themeStyle = computed(() => (key === 'btn' ? mTheme.value.buttons : mTheme.value.inputs) ?? {})
|
|
28
28
|
const theme = ref({})
|
|
29
29
|
for (const k in themeStyle.value) {
|
|
30
|
-
|
|
30
|
+
if (props[k] !== undefined) {
|
|
31
|
+
theme.value[k] = props[k]
|
|
32
|
+
continue
|
|
33
|
+
}
|
|
34
|
+
if (attributes[k] !== undefined) {
|
|
35
|
+
theme.value[k] = attributes[k]
|
|
36
|
+
continue
|
|
37
|
+
}
|
|
38
|
+
theme.value[k] = themeStyle.value[k]
|
|
31
39
|
}
|
|
32
40
|
|
|
33
41
|
const hasTopLabel = computed(() => {
|
|
@@ -195,7 +203,6 @@ export const useBindInput = <P extends G = G> (Props: MaybeRefOrGetter<P>, key:
|
|
|
195
203
|
return Object.values(rules).filter(e => !!e).length > 0 ? rules : undefined
|
|
196
204
|
})
|
|
197
205
|
const attrs = computed(() => ({
|
|
198
|
-
...props,
|
|
199
206
|
...attributes,
|
|
200
207
|
...theme.value
|
|
201
208
|
}))
|