@coreui/vue
Version:
UI Components Library for Vue.js
38 lines (35 loc) • 1.13 kB
JavaScript
const getAlignmentClassNames = (alignment) => {
const classNames = [];
if (typeof alignment === 'object') {
for (const key in alignment) {
classNames.push(`dropdown-menu${key === 'xs' ? '' : `-${key}`}-${alignment[key]}`);
}
}
if (typeof alignment === 'string') {
classNames.push(`dropdown-menu-${alignment}`);
}
return classNames;
};
const getPlacement = (placement, direction, alignment, isRTL) => {
let _placement = placement;
if (direction === 'dropup') {
_placement = isRTL ? 'top-end' : 'top-start';
}
if (direction === 'dropup-center') {
_placement = 'top';
}
if (direction === 'dropend') {
_placement = isRTL ? 'left-start' : 'right-start';
}
if (direction === 'dropstart') {
_placement = isRTL ? 'right-start' : 'left-start';
}
if (alignment === 'end') {
_placement = isRTL ? 'bottom-start' : 'bottom-end';
}
return _placement;
};
exports.getAlignmentClassNames = getAlignmentClassNames;
exports.getPlacement = getPlacement;
//# sourceMappingURL=utils.js.map
;