@@ -44,8 +44,10 @@ import { ref, onMounted } from 'vue'
import NuxtLink from '#app/components/nuxt-link'
import Icon from '../elements/Icon.vue'
import Avatar from '../elements/Avatar.vue'
-import { classNames, usePopper } from '../../utils'
+import { classNames } from '../../utils'
+import { usePopper } from '../../composables/usePopper'
import type { Avatar as AvatarType } from '../../types/avatar'
+import type { PopperOptions } from './../types'
import $ui from '#build/ui'
const props = defineProps({
@@ -64,20 +66,6 @@ const props = defineProps({
}[][]>,
default: () => []
},
- placement: {
- type: String,
- default: 'bottom-end',
- validator: (value: string) => {
- return ['auto', 'auto-start', 'auto-end', 'top', 'top-start', 'top-end', 'bottom', 'bottom-start', 'bottom-end', 'right', 'right-start', 'right-end', 'left', 'left-start', 'left-end'].includes(value)
- }
- },
- strategy: {
- type: String,
- default: 'fixed',
- validator: (value: string) => {
- return ['absolute', 'fixed'].includes(value)
- }
- },
mode: {
type: String,
default: 'click',
@@ -93,6 +81,10 @@ const props = defineProps({
type: String,
default: () => $ui.dropdown.container
},
+ widthClass: {
+ type: String,
+ default: () => $ui.dropdown.width
+ },
baseClass: {
type: String,
default: () => $ui.dropdown.base
@@ -128,32 +120,17 @@ const props = defineProps({
itemShortcutsClass: {
type: String,
default: () => $ui.dropdown.item.shortcuts
+ },
+ popperOptions: {
+ type: Object as PropType
,
+ default: () => ({
+ placement: 'bottom-end',
+ strategy: 'fixed'
+ })
}
})
-const [trigger, container] = usePopper({
- placement: props.placement,
- strategy: props.strategy,
- modifiers: [{
- name: 'offset',
- options: {
- offset: 0
- }
- },
- {
- name: 'computeStyles',
- options: {
- gpuAcceleration: false,
- adaptive: false
- }
- },
- {
- name: 'preventOverflow',
- options: {
- padding: 8
- }
- }]
-})
+const [trigger, container] = usePopper(props.popperOptions)
function resolveItemClass ({ active, disabled }: { active: boolean, disabled: boolean }) {
return classNames(
diff --git a/src/runtime/components/forms/SelectCustom.vue b/src/runtime/components/forms/SelectCustom.vue
index ab1893e8..7b3cb6de 100644
--- a/src/runtime/components/forms/SelectCustom.vue
+++ b/src/runtime/components/forms/SelectCustom.vue
@@ -27,7 +27,7 @@
-
+
,
default: () => []
},
- placement: {
- type: String,
- default: 'bottom-end',
- validator: (value: string) => {
- return ['auto', 'auto-start', 'auto-end', 'top', 'top-start', 'top-end', 'bottom', 'bottom-start', 'bottom-end', 'right', 'right-start', 'right-end', 'left', 'left-start', 'left-end'].includes(value)
- }
- },
- strategy: {
- type: String,
- default: 'absolute',
- validator: (value: string) => {
- return ['absolute', 'fixed'].includes(value)
- }
- },
required: {
type: Boolean,
default: false
@@ -189,6 +177,10 @@ const props = defineProps({
type: String,
default: () => $ui.selectCustom.list.container
},
+ listWidthClass: {
+ type: String,
+ default: () => $ui.selectCustom.list.width
+ },
listInputClass: {
type: String,
default: () => $ui.selectCustom.list.input
@@ -256,34 +248,18 @@ const props = defineProps({
searchAttributes: {
type: Array,
default: null
+ },
+ popperOptions: {
+ type: Object as PropType,
+ default: () => ({
+ placement: 'bottom-end'
+ })
}
})
const emit = defineEmits(['update:modelValue'])
-const [trigger, container] = usePopper({
- placement: props.placement,
- strategy: props.strategy,
- modifiers: [{
- name: 'offset',
- options: {
- offset: 0
- }
- },
- {
- name: 'computeStyles',
- options: {
- gpuAcceleration: false,
- adaptive: false
- }
- },
- {
- name: 'preventOverflow',
- options: {
- padding: 8
- }
- }]
-})
+const [trigger, container] = usePopper(props.popperOptions)
const query = ref('')
const searchInput = ref>()
diff --git a/src/runtime/components/overlays/Popover.vue b/src/runtime/components/overlays/Popover.vue
index 774a46c9..f03995f3 100644
--- a/src/runtime/components/overlays/Popover.vue
+++ b/src/runtime/components/overlays/Popover.vue
@@ -6,7 +6,7 @@
-