|
@ -8,6 +8,7 @@ |
|
|
:outlined="true" |
|
|
:outlined="true" |
|
|
:dense="true" |
|
|
:dense="true" |
|
|
v-bind="attrs" |
|
|
v-bind="attrs" |
|
|
|
|
|
mask="date" |
|
|
:rules="fieldMethodsClass.getRules(props, modelValue, dateRef, undefined)" |
|
|
:rules="fieldMethodsClass.getRules(props, modelValue, dateRef, undefined)" |
|
|
:readonly="fieldMethodsClass.getReadOnly(props, modelValue)" |
|
|
:readonly="fieldMethodsClass.getReadOnly(props, modelValue)" |
|
|
:disable="fieldMethodsClass.getDisable(props, modelValue)" |
|
|
:disable="fieldMethodsClass.getDisable(props, modelValue)" |
|
@ -23,7 +24,7 @@ |
|
|
</template> |
|
|
</template> |
|
|
<template v-if="!fieldMethodsClass.getReadOnly(props, modelValue)" #append> |
|
|
<template v-if="!fieldMethodsClass.getReadOnly(props, modelValue)" #append> |
|
|
<q-icon name="event" class="cursor-pointer"> |
|
|
<q-icon name="event" class="cursor-pointer"> |
|
|
<q-popup-proxy cover transition-show="scale" transition-hide="scale"> |
|
|
<q-popup-proxy cover transition-show="scale" transition-hide="scale" auto-close> |
|
|
<q-date v-model="modelValue" today-btn mask="YYYY-MM-DD" @update:model-value="fieldMethodsClass.updateValue"> </q-date> |
|
|
<q-date v-model="modelValue" today-btn mask="YYYY-MM-DD" @update:model-value="fieldMethodsClass.updateValue"> </q-date> |
|
|
</q-popup-proxy> |
|
|
</q-popup-proxy> |
|
|
</q-icon> |
|
|
</q-icon> |
|
@ -33,7 +34,8 @@ |
|
|
</template> |
|
|
</template> |
|
|
|
|
|
|
|
|
<script setup lang="ts"> |
|
|
<script setup lang="ts"> |
|
|
import { ref, useAttrs } from 'vue'; |
|
|
import { ref, useAttrs, watch } from 'vue'; |
|
|
|
|
|
import { Tools } from '@/platform'; |
|
|
import { FormFieldProps } from '@/platform/components/form/FormField.ts'; |
|
|
import { FormFieldProps } from '@/platform/components/form/FormField.ts'; |
|
|
import { FormFieldMethods } from '../form/FormField'; |
|
|
import { FormFieldMethods } from '../form/FormField'; |
|
|
|
|
|
|
|
@ -69,6 +71,15 @@ class FieldMethods extends FormFieldMethods { |
|
|
} |
|
|
} |
|
|
const fieldMethodsClass = new FieldMethods(); |
|
|
const fieldMethodsClass = new FieldMethods(); |
|
|
|
|
|
|
|
|
|
|
|
watch( |
|
|
|
|
|
() => modelValue.value, |
|
|
|
|
|
(newVal, oldVal) => { |
|
|
|
|
|
if (!Tools.isEmpty(newVal) && newVal !== oldVal && newVal.length > 10) { |
|
|
|
|
|
modelValue.value = newVal?.substring(0, 10); |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
defineExpose({ |
|
|
defineExpose({ |
|
|
validate: fieldMethodsClass.validate, |
|
|
validate: fieldMethodsClass.validate, |
|
|
setValue: fieldMethodsClass.setValue, |
|
|
setValue: fieldMethodsClass.setValue, |
|
|