Open DenisLantero opened 2 weeks ago
For anyone wondering, the workaround is this:
const props = withDefaults(defineProps<BsdkNewDatePickerProps>(), {
...Object.entries(VueDatePicker.props).reduce((acc, [key, prop]: any[]) => {
acc[key] = prop.default
return acc
}, {} as Record<string, any>),
// Redifine all the props' defaults here
enableTimePicker: false,
})
Still, it would be nice to have access to those interfaces, or to the source code directly
Describe the problem that you have I am trying to create a rapper to
VueDatePicker
, the issue that I'm having is that as soon as I use Vue'swithDefaults
anddefineProps
, and v-bind the props objects toVueDatePicker
, I rightfully lose the default values of the props, like this:It would be nice to have them available somewhere, either via exports or via the
VueDatePicker
exposes.Describe the solution you'd like I noticed that there are already 2 objects defined in your source code that define the defaults for the component,
AllProps
andPickerBaseProps
. The problem is that you don't export them inentry.esm.ts
, and, when we install the package, the source code isn't included, therefore I don't have a real way to access these objects.You could either export those and any other useful constants/objects in the
entry.esm.ts
file, include the source code in the npm registry, or expose them using Vue'sdefineExpose
inVueDatePicker
, as you are already doing for the following methods:Describe alternatives you've considered I already tried the following, but nothing worked:
1:
2:
Are there any other ways to do this, without changing the library that might work? Please let me know, thanks