mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-02 20:19:44 +08:00
4299d774ac
* chore: bump trigger ver * chore: support auto flip + shift * test: update snapshot * chore: use in TreeSelect & Cascader
38 lines
772 B
TypeScript
38 lines
772 B
TypeScript
import type { AlignType, BuildInPlacements } from '@rc-component/trigger';
|
|
|
|
const sharedConfig = {
|
|
overflow: {
|
|
adjustX: true,
|
|
adjustY: true,
|
|
shiftY: true,
|
|
},
|
|
htmlRegion: 'visible' as const,
|
|
};
|
|
|
|
const defaultBuiltInPlacements: Record<string, AlignType> = {
|
|
bottomLeft: {
|
|
...sharedConfig,
|
|
points: ['tl', 'bl'],
|
|
offset: [0, 4],
|
|
},
|
|
bottomRight: {
|
|
...sharedConfig,
|
|
points: ['tr', 'br'],
|
|
offset: [0, 4],
|
|
},
|
|
topLeft: {
|
|
...sharedConfig,
|
|
points: ['bl', 'tl'],
|
|
offset: [0, -4],
|
|
},
|
|
topRight: {
|
|
...sharedConfig,
|
|
points: ['br', 'tr'],
|
|
offset: [0, -4],
|
|
},
|
|
};
|
|
|
|
export default function useBuiltinPlacements(buildInPlacements?: BuildInPlacements) {
|
|
return buildInPlacements || defaultBuiltInPlacements;
|
|
}
|