amis-rpc-design/node_modules/antd/lib/select/useBuiltinPlacements.js

40 lines
1.0 KiB
JavaScript
Raw Normal View History

2023-10-07 19:42:30 +08:00
"use strict";
"use client";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = useBuiltinPlacements;
const getBuiltInPlacements = popupOverflow => {
const htmlRegion = popupOverflow === 'scroll' ? 'scroll' : 'visible';
const sharedConfig = {
overflow: {
adjustX: true,
adjustY: true,
shiftY: true
},
htmlRegion,
dynamicInset: true
};
return {
bottomLeft: Object.assign(Object.assign({}, sharedConfig), {
points: ['tl', 'bl'],
offset: [0, 4]
}),
bottomRight: Object.assign(Object.assign({}, sharedConfig), {
points: ['tr', 'br'],
offset: [0, 4]
}),
topLeft: Object.assign(Object.assign({}, sharedConfig), {
points: ['bl', 'tl'],
offset: [0, -4]
}),
topRight: Object.assign(Object.assign({}, sharedConfig), {
points: ['br', 'tr'],
offset: [0, -4]
})
};
};
function useBuiltinPlacements(buildInPlacements, popupOverflow) {
return buildInPlacements || getBuiltInPlacements(popupOverflow);
}