feat: withDefaults for Flatpickr

This commit is contained in:
Dominik Pschenitschni
2025-01-16 14:16:20 +01:00
committed by konrad
parent 8bada3e967
commit 289bb73e9e

View File

@@ -62,29 +62,22 @@ export default {inheritAttrs: false}
</script> </script>
<script setup lang="ts"> <script setup lang="ts">
import {computed, onBeforeUnmount, onMounted, ref, toRefs, useAttrs, watch, watchEffect, type PropType} from 'vue' import {computed, onBeforeUnmount, onMounted, ref, toRefs, useAttrs, watch, watchEffect} from 'vue'
const props = defineProps({ const props = withDefaults(defineProps<{
modelValue: { modelValue: DateOption | DateOption[] | null,
type: [String, Number, Date, Array] as PropType<DateOption | DateOption[] | null>, /** https://flatpickr.js.org/options/ */
default: null, config: Options,
}, events: HookKey[],
// https://flatpickr.js.org/options/ disabled: boolean,
config: { }>(), {
type: Object as PropType<Options>, modelValue: null,
default: () => ({ config: () => ({
defaultDate: null, defaultDate: undefined,
wrap: false, wrap: false,
}), }),
}, events: () => includedEvents,
events: { disabled: false,
type: Array as PropType<HookKey[]>,
default: () => includedEvents,
},
disabled: {
type: Boolean,
default: false,
},
}) })
const emit = defineEmits([ const emit = defineEmits([