@mythpe/quasar-ui-qui 0.0.44 → 0.0.45
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/MCheckbox.vue +0 -1
- package/src/components/form/MInput.vue +8 -12
- package/src/components/form/MPassword.vue +7 -3
- package/src/components/form/MSelect.vue +16 -16
- package/src/composable/useBindInput.ts +1 -0
- package/src/utils/Str.ts +2 -2
- package/src/utils/myth.ts +3 -0
- package/src/utils/vue-plugin.ts +2 -1
package/package.json
CHANGED
|
@@ -12,11 +12,10 @@
|
|
|
12
12
|
>
|
|
13
13
|
|
|
14
14
|
import { useField } from 'vee-validate'
|
|
15
|
-
import {
|
|
15
|
+
import { reactive, toValue, useTemplateRef } from 'vue'
|
|
16
16
|
import type { MInputProps as Props } from '../../types'
|
|
17
17
|
import { QField, QInput, type QInputSlots } from 'quasar'
|
|
18
18
|
import { useBindInput, useMyth } from '../../composable'
|
|
19
|
-
import { myth } from '../../utils'
|
|
20
19
|
|
|
21
20
|
const props = withDefaults(defineProps<Props>(), {
|
|
22
21
|
name: () => '',
|
|
@@ -65,9 +64,8 @@ const props = withDefaults(defineProps<Props>(), {
|
|
|
65
64
|
})
|
|
66
65
|
defineModel<Props['modelValue']>({ required: !1, default: undefined })
|
|
67
66
|
const { __ } = useMyth()
|
|
68
|
-
const options = computed(() => myth.props.value)
|
|
69
67
|
const helper = useBindInput<Props>(() => props, 'input')
|
|
70
|
-
const { attrs, hasTopLabel, getLabel, getPlaceholder, getAutocompleteAttribute, inputRules } = helper
|
|
68
|
+
const { theme, attrs, hasTopLabel, getLabel, getPlaceholder, getAutocompleteAttribute, inputRules } = helper
|
|
71
69
|
const inputScope = useField<Props['modelValue']>(() => props.name, inputRules, {
|
|
72
70
|
syncVModel: !0,
|
|
73
71
|
label: getLabel,
|
|
@@ -128,17 +126,15 @@ defineOptions({
|
|
|
128
126
|
:is="viewMode ? QField : QInput"
|
|
129
127
|
ref="input"
|
|
130
128
|
v-bind="{
|
|
131
|
-
...( viewMode ? options.field : {} ),
|
|
132
|
-
...$props,
|
|
133
129
|
...attrs as any,
|
|
134
130
|
...( viewMode ? { stackLabel: !0 } : {} ),
|
|
135
|
-
autocomplete:getAutocompleteAttribute,
|
|
136
|
-
clearable:viewMode
|
|
137
|
-
error
|
|
131
|
+
autocomplete: getAutocompleteAttribute,
|
|
132
|
+
clearable: viewMode ? !1 : clearable,
|
|
133
|
+
error: !!errorMessage,
|
|
138
134
|
errorMessage,
|
|
139
|
-
hint:__(hint),
|
|
140
|
-
label:hasTopLabel?undefined:getLabel,
|
|
141
|
-
modelValue:value,
|
|
135
|
+
hint: __(hint),
|
|
136
|
+
label: hasTopLabel?undefined:getLabel,
|
|
137
|
+
modelValue: value,
|
|
142
138
|
placeholder:getPlaceholder
|
|
143
139
|
}"
|
|
144
140
|
v-on="listeners"
|
|
@@ -18,12 +18,14 @@ type P = {
|
|
|
18
18
|
name?: Props['name'];
|
|
19
19
|
icon?: Props['icon'];
|
|
20
20
|
noToggle?: Props['noToggle'];
|
|
21
|
+
viewMode?: Props['viewMode'];
|
|
21
22
|
}
|
|
22
23
|
|
|
23
24
|
withDefaults(defineProps<P>(), {
|
|
24
25
|
name: () => '',
|
|
25
26
|
icon: () => !1,
|
|
26
|
-
noToggle: () => !1
|
|
27
|
+
noToggle: () => !1,
|
|
28
|
+
viewMode: () => !1
|
|
27
29
|
})
|
|
28
30
|
const modelValue = defineModel<Props['modelValue']>({ required: !1, default: undefined })
|
|
29
31
|
const inputType = ref<'text' | 'password'>('password')
|
|
@@ -41,9 +43,11 @@ defineOptions({
|
|
|
41
43
|
<template>
|
|
42
44
|
<MInput
|
|
43
45
|
ref="input"
|
|
44
|
-
|
|
46
|
+
:model-value="viewMode ? undefined : modelValue"
|
|
45
47
|
:name="name"
|
|
48
|
+
:view-mode="viewMode"
|
|
46
49
|
v-bind="{...$attrs,type:inputType}"
|
|
50
|
+
@update:model-value="modelValue = $event"
|
|
47
51
|
>
|
|
48
52
|
<template
|
|
49
53
|
v-if="icon && !Boolean($slots.prepend)"
|
|
@@ -52,7 +56,7 @@ defineOptions({
|
|
|
52
56
|
<q-icon name="password" />
|
|
53
57
|
</template>
|
|
54
58
|
<template
|
|
55
|
-
v-if="!noToggle && !Boolean($slots.prepend)"
|
|
59
|
+
v-if="!noToggle && !Boolean($slots.prepend) && !viewMode"
|
|
56
60
|
#append
|
|
57
61
|
>
|
|
58
62
|
<q-btn
|
|
@@ -113,7 +113,7 @@ const emit = defineEmits<Emits>()
|
|
|
113
113
|
const { __ } = useMyth()
|
|
114
114
|
const { props: pluginOptions, themeInput } = myth
|
|
115
115
|
const helper = useBindInput<P & Props>(() => props, 'select', () => ({ choose: !0 }))
|
|
116
|
-
const { hasTopLabel, getLabel, getPlaceholder, getAutocompleteAttribute, inputRules, getProp } = helper
|
|
116
|
+
const { attrs, hasTopLabel, getLabel, getPlaceholder, getAutocompleteAttribute, inputRules, getProp } = helper
|
|
117
117
|
const inputScope = useField<Props['modelValue']>(() => props.name, inputRules, {
|
|
118
118
|
syncVModel: !0,
|
|
119
119
|
label: getLabel,
|
|
@@ -216,22 +216,20 @@ defineOptions({
|
|
|
216
216
|
<component
|
|
217
217
|
:is="viewMode ? QField : QSelect"
|
|
218
218
|
ref="input"
|
|
219
|
-
:behavior="$q.platform.is.ios === !0 ? 'dialog' : behavior"
|
|
220
|
-
:emit-value="emitValue"
|
|
221
|
-
:error="!!errorMessage"
|
|
222
|
-
:error-message="errorMessage"
|
|
223
|
-
:hide-selected="hideSelected !== undefined ? hideSelected : search.length > 0"
|
|
224
|
-
:hint="__(hint)"
|
|
225
|
-
:label="viewMode && hasTopLabel ? undefined : (loading ? undefined : getPlaceholder)"
|
|
226
|
-
:model-value="value"
|
|
227
|
-
:option-label="optionLabel"
|
|
228
|
-
:option-value="optionValue"
|
|
229
|
-
:options="getOptions"
|
|
230
|
-
:readonly="readonly"
|
|
231
219
|
v-bind="{
|
|
220
|
+
behavior: $q.platform.is.ios === !0 ? 'dialog' : behavior,
|
|
221
|
+
...attrs,
|
|
232
222
|
...pluginOptions.select as any,
|
|
233
223
|
...( viewMode ? pluginOptions.field : {} ),
|
|
234
|
-
|
|
224
|
+
emitValue: emitValue,
|
|
225
|
+
error: !!errorMessage,
|
|
226
|
+
errorMessage,
|
|
227
|
+
hideSelected: hideSelected !== undefined ? hideSelected : search.length > 0,
|
|
228
|
+
modelValue: value,
|
|
229
|
+
optionLabel: optionLabel,
|
|
230
|
+
optionValue: optionValue,
|
|
231
|
+
options: getOptions,
|
|
232
|
+
readonly: readonly,
|
|
235
233
|
...(viewMode ? { stackLabel: !0 } : { stackLabel: hasTopLabel ? !1 : (
|
|
236
234
|
themeInput.dense !== undefined ? themeInput.dense : getProp('dense')
|
|
237
235
|
) } ),
|
|
@@ -240,8 +238,10 @@ defineOptions({
|
|
|
240
238
|
mapOptions,
|
|
241
239
|
loading,
|
|
242
240
|
useInput,
|
|
243
|
-
autocomplete:getAutocompleteAttribute,
|
|
244
|
-
clearable: viewMode ? !1 : clearable
|
|
241
|
+
autocomplete: getAutocompleteAttribute,
|
|
242
|
+
clearable: viewMode ? !1 : clearable,
|
|
243
|
+
hint: __(hint),
|
|
244
|
+
label: viewMode && hasTopLabel ? undefined : (loading ? undefined : getPlaceholder),
|
|
245
245
|
}"
|
|
246
246
|
v-on="listeners"
|
|
247
247
|
>
|
|
@@ -23,6 +23,7 @@ export const useBindInput = <P extends G = G> (Props: MaybeRefOrGetter<P>, key:
|
|
|
23
23
|
})
|
|
24
24
|
|
|
25
25
|
const { themeBtn, themeInput, props: pluginProps } = myth
|
|
26
|
+
// console.log(themeInput.value)
|
|
26
27
|
const themeStyle = computed(() => (key === 'btn' ? themeBtn.value : themeInput.value) ?? {})
|
|
27
28
|
const theme = ref({})
|
|
28
29
|
for (const k in themeStyle.value) {
|
package/src/utils/Str.ts
CHANGED
package/src/utils/myth.ts
CHANGED
package/src/utils/vue-plugin.ts
CHANGED
|
@@ -14,6 +14,7 @@ import { myth } from './myth'
|
|
|
14
14
|
import type { InstallOptions } from '../types'
|
|
15
15
|
|
|
16
16
|
function install (app: App, options: InstallOptions = {}) {
|
|
17
|
+
console.log(options)
|
|
17
18
|
if (options.rounded !== undefined) {
|
|
18
19
|
myth.rounded.value = options.rounded
|
|
19
20
|
}
|
|
@@ -36,7 +37,7 @@ function install (app: App, options: InstallOptions = {}) {
|
|
|
36
37
|
myth.themeBtn.value = options.themeBtn
|
|
37
38
|
}
|
|
38
39
|
if (options.themeInput !== undefined) {
|
|
39
|
-
myth.
|
|
40
|
+
myth.setThemeInput(options.themeInput)
|
|
40
41
|
}
|
|
41
42
|
if (options.baseUrl !== undefined) {
|
|
42
43
|
myth.baseUrl.value = options.baseUrl
|