@mythpe/quasar-ui-qui 0.0.40 → 0.0.42
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 +1 -1
- package/src/components/form/MBtn.vue +152 -151
- package/src/components/form/MCheckbox.vue +10 -15
- package/src/composable/useBindInput.ts +9 -8
- package/src/types/theme.d.ts +31 -2
package/package.json
CHANGED
|
@@ -16,160 +16,161 @@ import { myth } from '../../utils'
|
|
|
16
16
|
import { useBindInput, useMyth } from '../../composable'
|
|
17
17
|
import type { QBtnProps } from 'quasar'
|
|
18
18
|
|
|
19
|
-
const props = withDefaults(defineProps<Props>(), {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
})
|
|
19
|
+
// const props = withDefaults(defineProps<Props>(), {
|
|
20
|
+
// /**
|
|
21
|
+
// * Size in CSS units, including unit name or standard size name (xs|sm|md|lg|xl)
|
|
22
|
+
// */
|
|
23
|
+
// size: undefined,
|
|
24
|
+
// /**
|
|
25
|
+
// * 1) Define the button native type attribute (submit, reset, button) or 2) render component with <a> tag so you can access events even if disable or 3) Use 'href' prop and specify 'type' as a media tag
|
|
26
|
+
// * Default value: 'button'
|
|
27
|
+
// */
|
|
28
|
+
// type: undefined,
|
|
29
|
+
// /**
|
|
30
|
+
// * Equivalent to Vue Router <router-link> 'to' property; Superseded by 'href' prop if used
|
|
31
|
+
// */
|
|
32
|
+
// to: undefined,
|
|
33
|
+
// /**
|
|
34
|
+
// * Equivalent to Vue Router <router-link> 'replace' property; Superseded by 'href' prop if used
|
|
35
|
+
// */
|
|
36
|
+
// replace: undefined,
|
|
37
|
+
// /**
|
|
38
|
+
// * Native <a> link href attribute; Has priority over the 'to' and 'replace' props
|
|
39
|
+
// */
|
|
40
|
+
// href: undefined,
|
|
41
|
+
// /**
|
|
42
|
+
// * Native <a> link target attribute; Use it only with 'to' or 'href' props
|
|
43
|
+
// */
|
|
44
|
+
// target: undefined,
|
|
45
|
+
// /**
|
|
46
|
+
// * The text that will be shown on the button
|
|
47
|
+
// */
|
|
48
|
+
// label: undefined,
|
|
49
|
+
// /**
|
|
50
|
+
// * Icon name following Quasar convention; Make sure you have the icon library installed unless you are using 'img:' prefix; If 'none' (Str) is used as value then no icon is rendered (but screen real estate will still be used for it)
|
|
51
|
+
// */
|
|
52
|
+
// icon: undefined,
|
|
53
|
+
// /**
|
|
54
|
+
// * Icon name following Quasar convention; Make sure you have the icon library installed unless you are using 'img:' prefix; If 'none' (Str) is used as value then no icon is rendered (but screen real estate will still be used for it)
|
|
55
|
+
// */
|
|
56
|
+
// iconRight: undefined,
|
|
57
|
+
// /**
|
|
58
|
+
// * Use 'outline' design
|
|
59
|
+
// */
|
|
60
|
+
// outline: undefined,
|
|
61
|
+
// /**
|
|
62
|
+
// * Use 'flat' design
|
|
63
|
+
// */
|
|
64
|
+
// flat: undefined,
|
|
65
|
+
// /**
|
|
66
|
+
// * Remove shadow
|
|
67
|
+
// */
|
|
68
|
+
// unelevated: undefined,
|
|
69
|
+
// /**
|
|
70
|
+
// * Applies a more prominent border-radius for a squared shape button
|
|
71
|
+
// */
|
|
72
|
+
// rounded: undefined,
|
|
73
|
+
// /**
|
|
74
|
+
// * Use 'push' design
|
|
75
|
+
// */
|
|
76
|
+
// push: undefined,
|
|
77
|
+
// /**
|
|
78
|
+
// * Removes border-radius so borders are squared
|
|
79
|
+
// */
|
|
80
|
+
// square: undefined,
|
|
81
|
+
// /**
|
|
82
|
+
// * Applies a glossy effect
|
|
83
|
+
// */
|
|
84
|
+
// glossy: undefined,
|
|
85
|
+
// /**
|
|
86
|
+
// * Makes button size and shape to fit a Floating Action Button
|
|
87
|
+
// */
|
|
88
|
+
// fab: undefined,
|
|
89
|
+
// /**
|
|
90
|
+
// * Makes button size and shape to fit a small Floating Action Button
|
|
91
|
+
// */
|
|
92
|
+
// fabMini: undefined,
|
|
93
|
+
// /**
|
|
94
|
+
// * Apply custom padding (vertical [horizontal]); Size in CSS units, including unit name or standard size name (none|xs|sm|md|lg|xl); Also removes the min width and height when set
|
|
95
|
+
// */
|
|
96
|
+
// padding: undefined,
|
|
97
|
+
// /**
|
|
98
|
+
// * Color name for component from the Quasar Color Palette
|
|
99
|
+
// */
|
|
100
|
+
// color: 'primary',
|
|
101
|
+
// /**
|
|
102
|
+
// * Overrides text color (if needed); Color name from the Quasar Color Palette
|
|
103
|
+
// */
|
|
104
|
+
// textColor: undefined,
|
|
105
|
+
// /**
|
|
106
|
+
// * Avoid turning label text into caps (which happens by default)
|
|
107
|
+
// */
|
|
108
|
+
// noCaps: undefined,
|
|
109
|
+
// /**
|
|
110
|
+
// * Avoid label text wrapping
|
|
111
|
+
// */
|
|
112
|
+
// noWrap: undefined,
|
|
113
|
+
// /**
|
|
114
|
+
// * Dense mode; occupies less space
|
|
115
|
+
// */
|
|
116
|
+
// dense: undefined,
|
|
117
|
+
// /**
|
|
118
|
+
// * Configure material ripple (disable it by setting it to 'false' or supply a config object)
|
|
119
|
+
// * Default value: true
|
|
120
|
+
// */
|
|
121
|
+
// ripple: undefined,
|
|
122
|
+
// /**
|
|
123
|
+
// * Tabindex HTML attribute value
|
|
124
|
+
// */
|
|
125
|
+
// tabindex: undefined,
|
|
126
|
+
// /**
|
|
127
|
+
// * Label or content alignment
|
|
128
|
+
// * Default value: 'center'
|
|
129
|
+
// */
|
|
130
|
+
// align: undefined,
|
|
131
|
+
// /**
|
|
132
|
+
// * Stack icon and label vertically instead of on same line (like it is by default)
|
|
133
|
+
// */
|
|
134
|
+
// stack: undefined,
|
|
135
|
+
// /**
|
|
136
|
+
// * When used on flexbox parent, button will stretch to parent's height
|
|
137
|
+
// */
|
|
138
|
+
// stretch: undefined,
|
|
139
|
+
// /**
|
|
140
|
+
// * Put button into loading state (displays a QSpinner -- can be overridden by using a 'loading' slot)
|
|
141
|
+
// * Default value: null
|
|
142
|
+
// */
|
|
143
|
+
// loading: undefined,
|
|
144
|
+
// /**
|
|
145
|
+
// * Put component in disabled mode
|
|
146
|
+
// */
|
|
147
|
+
// disable: undefined,
|
|
148
|
+
// /**
|
|
149
|
+
// * Makes a circle shaped button
|
|
150
|
+
// */
|
|
151
|
+
// round: undefined,
|
|
152
|
+
// /**
|
|
153
|
+
// * Percentage (0.0 < x < 100.0); To be used along 'loading' prop; Display a progress bar on the background
|
|
154
|
+
// */
|
|
155
|
+
// percentage: undefined,
|
|
156
|
+
// /**
|
|
157
|
+
// * Progress bar on the background should have dark color; To be used along with 'percentage' and 'loading' props
|
|
158
|
+
// */
|
|
159
|
+
// darkPercentage: undefined,
|
|
160
|
+
// /**
|
|
161
|
+
// * Emitted when the component is clicked
|
|
162
|
+
// * @param evt JS event object; If you are using route navigation ('to'/'replace' props) and you want to cancel navigation then call evt.preventDefault() synchronously in your event handler
|
|
163
|
+
// * @param go Available ONLY if you are using route navigation ('to'/'replace' props); When you need to control the time at which the component should trigger the route navigation then call evt.preventDefault() synchronously and then call this function at your convenience; Useful if you have async work to be done before the actual route navigation or if you want to redirect somewhere else
|
|
164
|
+
// */
|
|
165
|
+
// onClick: undefined
|
|
166
|
+
// })
|
|
167
|
+
const props = defineProps<Props>()
|
|
167
168
|
const { __ } = useMyth()
|
|
168
169
|
const btnLoading = computed(() => myth.btnLoading.value)
|
|
169
170
|
const getLabel = computed<string | undefined>(() => props.label ? (__(props.label) ?? undefined) : undefined)
|
|
170
171
|
const getSize = computed<string>(() => myth.btnLoading.value?.size || '20px')
|
|
171
172
|
const getColor = computed<string | undefined>(() => myth.btnLoading.value?.color || undefined)
|
|
172
|
-
const { attrs } = useBindInput<QBtnProps & { name: string }>(() => props, 'btn')
|
|
173
|
+
const { theme, attrs } = useBindInput<QBtnProps & { name: string }>(() => props, 'btn')
|
|
173
174
|
defineOptions({
|
|
174
175
|
name: 'MBtn',
|
|
175
176
|
inheritAttrs: !1
|
|
@@ -179,8 +180,8 @@ defineOptions({
|
|
|
179
180
|
<template>
|
|
180
181
|
<q-btn
|
|
181
182
|
v-bind="{
|
|
182
|
-
...$
|
|
183
|
-
...
|
|
183
|
+
...$attrs,
|
|
184
|
+
...theme,
|
|
184
185
|
label: loading ? `${getLabel} ...` : getLabel,
|
|
185
186
|
ariaLabel: 'ariaLabel' in attrs && attrs.ariaLabel ? __(attrs.ariaLabel) : getLabel
|
|
186
187
|
}"
|
|
@@ -19,11 +19,6 @@ import { QCheckbox, QField } from 'quasar'
|
|
|
19
19
|
const props = withDefaults(defineProps<Props>(), {
|
|
20
20
|
name: '',
|
|
21
21
|
label: undefined,
|
|
22
|
-
toggleIndeterminate: undefined,
|
|
23
|
-
leftLabel: undefined,
|
|
24
|
-
keepColor: undefined,
|
|
25
|
-
dark: undefined,
|
|
26
|
-
dense: undefined,
|
|
27
22
|
disable: undefined,
|
|
28
23
|
viewMode: undefined,
|
|
29
24
|
auto: undefined,
|
|
@@ -42,8 +37,8 @@ const props = withDefaults(defineProps<Props>(), {
|
|
|
42
37
|
})
|
|
43
38
|
defineModel<Props['modelValue']>({ required: !1, default: undefined })
|
|
44
39
|
const { __ } = useMyth()
|
|
45
|
-
const helper = useBindInput<
|
|
46
|
-
const { getLabel,
|
|
40
|
+
const helper = useBindInput<Props>(() => props, 'checkbox')
|
|
41
|
+
const { getLabel, inputRules, theme } = helper
|
|
47
42
|
const inputScope = useField<Props['modelValue']>(() => props.name, inputRules, {
|
|
48
43
|
syncVModel: !0,
|
|
49
44
|
label: getLabel,
|
|
@@ -96,11 +91,11 @@ defineOptions({
|
|
|
96
91
|
<MCol v-bind="colProps">
|
|
97
92
|
<q-field
|
|
98
93
|
v-bind="{
|
|
99
|
-
...$
|
|
100
|
-
...
|
|
101
|
-
error
|
|
94
|
+
...$attrs,
|
|
95
|
+
...theme,
|
|
96
|
+
error: !!errorMessage,
|
|
102
97
|
errorMessage,
|
|
103
|
-
hint:__(hint),
|
|
98
|
+
hint: __(hint),
|
|
104
99
|
borderless: !0,
|
|
105
100
|
outlined: !1,
|
|
106
101
|
stackLabel: !0
|
|
@@ -109,10 +104,10 @@ defineOptions({
|
|
|
109
104
|
<q-checkbox
|
|
110
105
|
ref="input"
|
|
111
106
|
v-bind="{
|
|
112
|
-
...$
|
|
113
|
-
...
|
|
114
|
-
modelValue:value,
|
|
115
|
-
disable:viewMode,
|
|
107
|
+
...$attrs,
|
|
108
|
+
...theme,
|
|
109
|
+
modelValue: value,
|
|
110
|
+
disable: viewMode === !0 ? viewMode : disable,
|
|
116
111
|
label: undefined,
|
|
117
112
|
}"
|
|
118
113
|
v-on="listeners"
|
|
@@ -23,10 +23,10 @@ export const useBindInput = <P extends G = G> (Props: MaybeRefOrGetter<P>, key:
|
|
|
23
23
|
})
|
|
24
24
|
|
|
25
25
|
const { themeBtn, themeInput, props: pluginProps } = myth
|
|
26
|
-
const
|
|
27
|
-
const
|
|
28
|
-
for (const k in
|
|
29
|
-
|
|
26
|
+
const themeStyle = computed(() => (key === 'btn' ? themeBtn.value : themeInput.value) ?? {})
|
|
27
|
+
const theme = ref({})
|
|
28
|
+
for (const k in themeStyle.value) {
|
|
29
|
+
theme.value[k] = props[k] !== undefined ? props[k] : themeStyle.value[k]
|
|
30
30
|
}
|
|
31
31
|
/**
|
|
32
32
|
* Top Label Style.
|
|
@@ -35,8 +35,8 @@ export const useBindInput = <P extends G = G> (Props: MaybeRefOrGetter<P>, key:
|
|
|
35
35
|
if (props.topLabel !== undefined) {
|
|
36
36
|
return props.topLabel !== !1
|
|
37
37
|
}
|
|
38
|
-
if ('topLabel' in
|
|
39
|
-
return
|
|
38
|
+
if ('topLabel' in themeStyle.value && themeStyle.value.topLabel !== undefined) {
|
|
39
|
+
return themeStyle.value.topLabel !== !1
|
|
40
40
|
}
|
|
41
41
|
if (pluginProps.value[key] && 'topLabel' in pluginProps.value[key]) {
|
|
42
42
|
return pluginProps.value[key]?.topLabel !== !1
|
|
@@ -195,7 +195,7 @@ export const useBindInput = <P extends G = G> (Props: MaybeRefOrGetter<P>, key:
|
|
|
195
195
|
const attrs = computed(() => ({
|
|
196
196
|
...props,
|
|
197
197
|
...attributes,
|
|
198
|
-
...
|
|
198
|
+
...theme.value
|
|
199
199
|
}))
|
|
200
200
|
return {
|
|
201
201
|
inputRules,
|
|
@@ -205,6 +205,7 @@ export const useBindInput = <P extends G = G> (Props: MaybeRefOrGetter<P>, key:
|
|
|
205
205
|
getPlaceholder,
|
|
206
206
|
getAutocompleteAttribute,
|
|
207
207
|
getProp,
|
|
208
|
-
attrs
|
|
208
|
+
attrs,
|
|
209
|
+
theme
|
|
209
210
|
}
|
|
210
211
|
}
|
package/src/types/theme.d.ts
CHANGED
|
@@ -5,8 +5,37 @@ export type ThemeShadow = string | number | 'transition' | 'none';
|
|
|
5
5
|
export type ThemeRounded = boolean;
|
|
6
6
|
export type ThemeFluid = boolean;
|
|
7
7
|
export type ThemeInput =
|
|
8
|
-
Partial<Pick<QInputProps, 'standout'
|
|
8
|
+
Partial<Pick<QInputProps, 'standout'
|
|
9
|
+
| 'dense'
|
|
10
|
+
| 'filled'
|
|
11
|
+
| 'outlined'
|
|
12
|
+
| 'rounded'
|
|
13
|
+
| 'borderless'
|
|
14
|
+
| 'counter'
|
|
15
|
+
| 'noErrorIcon'
|
|
16
|
+
| 'hideBottomSpace'
|
|
17
|
+
| 'bottomSlots'
|
|
18
|
+
| 'clearIcon'
|
|
19
|
+
| 'itemAligned'
|
|
20
|
+
| 'square'
|
|
21
|
+
| 'stackLabel'
|
|
22
|
+
| 'color'
|
|
23
|
+
| 'textColor'
|
|
24
|
+
>>
|
|
9
25
|
& {
|
|
10
26
|
topLabel?: boolean;
|
|
11
27
|
}
|
|
12
|
-
export type ThemeBtn = Partial<Pick<QBtnProps, 'flat'
|
|
28
|
+
export type ThemeBtn = Partial<Pick<QBtnProps, 'flat'
|
|
29
|
+
| 'outline'
|
|
30
|
+
| 'push'
|
|
31
|
+
| 'unelevated'
|
|
32
|
+
| 'noCaps'
|
|
33
|
+
| 'rounded'
|
|
34
|
+
| 'glossy'
|
|
35
|
+
| 'square'
|
|
36
|
+
| 'padding'
|
|
37
|
+
| 'ripple'
|
|
38
|
+
| 'dense'
|
|
39
|
+
| 'color'
|
|
40
|
+
| 'textColor'
|
|
41
|
+
>>
|