@difizen/mana-react
Version:
68 lines • 1.95 kB
JavaScript
import { ResizeHandleVertical, ResizeHandleHorizontal } from "../resize/index";
var flexDirectionMap = {
'left-to-right': {
direction: 'row',
size: 'width',
domSize: 'clientHeight',
minSize: 'minWidth',
maxSize: 'maxWidth'
},
'right-to-left': {
direction: 'row-reverse',
size: 'width',
domSize: 'clientHeight',
minSize: 'minWidth',
maxSize: 'maxWidth'
},
'top-to-bottom': {
direction: 'column',
size: 'height',
domSize: 'clientWidth',
minSize: 'minHeight',
maxSize: 'maxHeight'
},
'bottom-to-top': {
direction: 'column-reverse',
size: 'height',
domSize: 'clientWidth',
minSize: 'minHeight',
maxSize: 'maxHeight'
}
};
export var Layout;
(function (_Layout) {
function getFlexDirection(direction) {
return flexDirectionMap[direction].direction;
}
_Layout.getFlexDirection = getFlexDirection;
function getSizeProperty(direction) {
return flexDirectionMap[direction].size;
}
_Layout.getSizeProperty = getSizeProperty;
function getDomSizeProperty(direction) {
return flexDirectionMap[direction].domSize;
}
_Layout.getDomSizeProperty = getDomSizeProperty;
function getMinSizeProperty(direction) {
return flexDirectionMap[direction].minSize;
}
_Layout.getMinSizeProperty = getMinSizeProperty;
function getMaxSizeProperty(direction) {
return flexDirectionMap[direction].maxSize;
}
_Layout.getMaxSizeProperty = getMaxSizeProperty;
function getResizeHandle(direction) {
if (direction === 'bottom-to-top' || direction === 'top-to-bottom') {
return ResizeHandleVertical;
}
return ResizeHandleHorizontal;
}
_Layout.getResizeHandle = getResizeHandle;
function getTabbarDirection(direction) {
if (direction === 'bottom-to-top' || direction === 'top-to-bottom') {
return 'row';
}
return 'column';
}
_Layout.getTabbarDirection = getTabbarDirection;
})(Layout || (Layout = {}));