@antv/x6-react-components
Version:
React components for building x6 editors
55 lines • 1.66 kB
JavaScript
import React from 'react';
export class Box extends React.PureComponent {
render() {
const { refIt, className, index, currentSize, oppositeSize, vertical } = this.props;
const style = Object.assign(Object.assign({}, this.props.style), { overflow: 'hidden', position: 'absolute', zIndex: 1 });
if (vertical) {
style.bottom = 0;
style.top = 0;
}
else {
style.left = 0;
style.right = 0;
}
if (currentSize != null) {
if (vertical) {
style.width = currentSize;
if (index === 1) {
style.left = 0;
}
else {
style.right = 0;
}
}
else {
style.height = currentSize;
if (index === 1) {
style.top = 0;
}
else {
style.bottom = 0;
}
}
}
else if (vertical) {
if (index === 1) {
style.left = 0;
style.right = oppositeSize;
}
else {
style.left = oppositeSize;
style.right = 0;
}
}
else if (index === 1) {
style.top = 0;
style.bottom = oppositeSize;
}
else {
style.top = oppositeSize;
style.bottom = 0;
}
return (React.createElement("div", { ref: refIt, style: style, className: className }, this.props.children));
}
}
//# sourceMappingURL=box.js.map