element-plus/packages/hooks/use-popper/use-popper-options.ts
三咲智子 55348b30b6
style: use prettier (#3228)
* style: use prettier

* style: just prettier format, no code changes

* style: eslint fix
object-shorthand, prefer-const

* style: fix no-void

* style: no-console
2021-09-04 19:29:28 +08:00

50 lines
867 B
TypeScript

import type { PropType } from 'vue'
import type { Options } from '@popperjs/core'
export const DEFAULT_FALLBACK_PLACEMENTS = []
export const defaultModifiers = [
{
name: 'offset',
options: {
offset: [0, 12],
},
},
{
name: 'preventOverflow',
options: {
padding: {
top: 2,
bottom: 2,
left: 5,
right: 5,
},
},
},
{
name: 'flip',
options: {
padding: 5,
fallbackPlacements: [],
},
},
{
name: 'computeStyles',
options: {
gpuAcceleration: true,
adaptive: true,
},
},
]
export const defaultPopperOptions = {
type: Object as PropType<Partial<Options>>,
default: () => {
return {
fallbackPlacements: DEFAULT_FALLBACK_PLACEMENTS,
strategy: 'fixed',
modifiers: defaultModifiers,
} as Partial<Options>
},
}