@mythpe/quasar-ui-qui 0.1.98 → 0.1.99
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
|
@@ -52,6 +52,7 @@ interface P {
|
|
|
52
52
|
noDefaultLocale?: boolean;
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
+
type ModelType = Props['modelValue']
|
|
55
56
|
const props = withDefaults(defineProps<P>(), {
|
|
56
57
|
name: () => '',
|
|
57
58
|
auto: undefined,
|
|
@@ -84,11 +85,11 @@ const props = withDefaults(defineProps<P>(), {
|
|
|
84
85
|
noDefaultLocale: !1
|
|
85
86
|
})
|
|
86
87
|
|
|
87
|
-
defineModel<
|
|
88
|
+
defineModel<ModelType>({ required: !1, default: undefined })
|
|
88
89
|
const helper = useBindInput<Props>(() => props, 'picker', () => ({ choose: !0 }))
|
|
89
90
|
const { theme, hasTopLabel, getLabel, getPlaceholder, inputRules, getAutocompleteAttribute, getProp } = helper
|
|
90
91
|
const { __, props: pluginOptions } = useMyth()
|
|
91
|
-
const inputScope = useField<
|
|
92
|
+
const inputScope = useField<ModelType>(() => props.name, inputRules, {
|
|
92
93
|
syncVModel: !0,
|
|
93
94
|
label: getLabel,
|
|
94
95
|
...toValue<any>(props.fieldOptions)
|
|
@@ -105,7 +106,7 @@ const isDate = computed(() => props.type !== 'time')
|
|
|
105
106
|
// return isDate.value ? '####/##/##' : '##:##'
|
|
106
107
|
// })
|
|
107
108
|
const format = computed(() => isDate.value ? 'YYYY/MM/DD' : 'HH:mm')
|
|
108
|
-
const dateRef = ref<
|
|
109
|
+
const dateRef = ref<ModelType>(null)
|
|
109
110
|
|
|
110
111
|
const { t, te } = useI18n({ useScope: 'global' })
|
|
111
112
|
const daysShort = computed(() => {
|
|
@@ -142,19 +143,20 @@ const onBeforeHide = () => {
|
|
|
142
143
|
dateRef.value = null
|
|
143
144
|
}
|
|
144
145
|
const saveDialog = () => {
|
|
145
|
-
|
|
146
|
+
const newVal: ModelType = toValue(dateRef.value || null)
|
|
146
147
|
if (!newVal) {
|
|
147
148
|
return
|
|
148
149
|
}
|
|
149
|
-
if (
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
150
|
+
// if (isDate.value) {
|
|
151
|
+
// const values: string[] = Object.values(newVal)
|
|
152
|
+
// console.log(values)
|
|
153
|
+
// for (const aKey in values) {
|
|
154
|
+
// if (typeof values[aKey] === 'object') {
|
|
155
|
+
// values[aKey] = Object.values(values[aKey])
|
|
156
|
+
// }
|
|
157
|
+
// }
|
|
158
|
+
// newVal = values
|
|
159
|
+
// }
|
|
158
160
|
handleChange(newVal, !!errorMessage.value)
|
|
159
161
|
}
|
|
160
162
|
|
|
@@ -170,7 +172,7 @@ defineOptions({
|
|
|
170
172
|
<template>
|
|
171
173
|
<MCol
|
|
172
174
|
:auto="auto"
|
|
173
|
-
:class="[$attrs.class,{'m--input__required':inputRules?.required!==undefined,'m--input__error':!!errorMessage,'m--input__view':viewMode}]"
|
|
175
|
+
:class="[$attrs.class,{'m--input__required':inputRules?.required!==undefined,'m--input__error':!!errorMessage,'m--input__view':viewMode,'m--picker':!0}]"
|
|
174
176
|
:col="col"
|
|
175
177
|
:lg="lg"
|
|
176
178
|
:md="md"
|
|
@@ -231,8 +233,8 @@ defineOptions({
|
|
|
231
233
|
</template>
|
|
232
234
|
<template v-else>
|
|
233
235
|
<div>
|
|
234
|
-
<template v-if="value &&
|
|
235
|
-
{{ value.join(rangeSeparator || pluginOptions.picker?.rangeSeparator || defSeparator) }}
|
|
236
|
+
<template v-if="value && typeof value === 'object'">
|
|
237
|
+
{{ Object.values(value).join(rangeSeparator || pluginOptions.picker?.rangeSeparator || defSeparator) }}
|
|
236
238
|
</template>
|
|
237
239
|
<template v-else>
|
|
238
240
|
{{ value?.toString() }}
|
|
@@ -263,6 +265,7 @@ defineOptions({
|
|
|
263
265
|
<q-date
|
|
264
266
|
v-if="isDate"
|
|
265
267
|
ref="dateElm"
|
|
268
|
+
class="m--date__picker"
|
|
266
269
|
v-bind="{
|
|
267
270
|
...pluginOptions.date as any,
|
|
268
271
|
...$attrs,
|
|
@@ -295,6 +298,7 @@ defineOptions({
|
|
|
295
298
|
<q-time
|
|
296
299
|
v-else
|
|
297
300
|
ref="timeElm"
|
|
301
|
+
class="m--time__picker"
|
|
298
302
|
v-bind="{
|
|
299
303
|
...pluginOptions.time,
|
|
300
304
|
...$attrs,
|
package/src/style/main.sass
CHANGED
|
@@ -185,3 +185,11 @@ $m--select__popup-content: 300px !default
|
|
|
185
185
|
font-size: 18px
|
|
186
186
|
line-height: 16px
|
|
187
187
|
height: 15px
|
|
188
|
+
|
|
189
|
+
.m--date__picker,
|
|
190
|
+
.m--time__picker
|
|
191
|
+
.q-date__calendar-item
|
|
192
|
+
> div
|
|
193
|
+
text-overflow: ellipsis
|
|
194
|
+
white-space: nowrap
|
|
195
|
+
overflow: hidden
|
|
@@ -408,7 +408,7 @@ export interface MPickerProps extends BaseInputsProps, Omit<QDateProps, 'modelVa
|
|
|
408
408
|
* Initial value of the picker.
|
|
409
409
|
* Default is: null.
|
|
410
410
|
*/
|
|
411
|
-
modelValue?: any;
|
|
411
|
+
modelValue?: string | any[] | any | null | undefined;
|
|
412
412
|
/**
|
|
413
413
|
* Type of picker. 'date' or 'time'.
|
|
414
414
|
* Default is: 'date'.
|