mirror of
https://github.com/solidtime-io/solidtime.git
synced 2026-08-14 19:22:14 +01:00
fix tests, add autofocus disable option for dropdown
This commit is contained in:
@@ -10,7 +10,6 @@ withDefaults(
|
||||
}
|
||||
);
|
||||
</script>
|
||||
Modal.vue
|
||||
<template>
|
||||
<button
|
||||
:type="type"
|
||||
|
||||
@@ -5,18 +5,23 @@ const props = withDefaults(
|
||||
defineProps<{
|
||||
align?: 'center' | 'end' | 'start';
|
||||
closeOnContentClick?: boolean;
|
||||
autoFocus?: boolean;
|
||||
}>(),
|
||||
{
|
||||
align: 'start',
|
||||
closeOnContentClick: true,
|
||||
autoFocus: true,
|
||||
}
|
||||
);
|
||||
|
||||
const emit = defineEmits(['open', 'submit']);
|
||||
const open = defineModel({ default: false });
|
||||
|
||||
|
||||
|
||||
function handleAutofocus(event: Event) {
|
||||
if (props.autoFocus === false) {
|
||||
event.preventDefault();
|
||||
}
|
||||
}
|
||||
|
||||
function onContentClick() {
|
||||
if (props.closeOnContentClick === true) {
|
||||
@@ -42,6 +47,7 @@ function onOpenChange(value: boolean) {
|
||||
<PopoverContent
|
||||
:align="align"
|
||||
class="rounded-lg overflow-hidden relative border border-card-border overflow-none shadow-dropdown bg-card-background"
|
||||
@open-auto-focus="handleAutofocus"
|
||||
@click="onContentClick">
|
||||
<slot name="content" />
|
||||
</PopoverContent>
|
||||
|
||||
@@ -171,6 +171,7 @@ function closeAndFocusInput() {
|
||||
<Dropdown
|
||||
v-model="open"
|
||||
align="center"
|
||||
:auto-focus="false"
|
||||
:close-on-content-click="false"
|
||||
@submit="open = false">
|
||||
<template #trigger>
|
||||
|
||||
Reference in New Issue
Block a user