Skip to content
This repository was archived by the owner on Oct 19, 2023. It is now read-only.

Commit 317fef5

Browse files
committed
build
1 parent c4d5007 commit 317fef5

File tree

5 files changed

+245
-247
lines changed

5 files changed

+245
-247
lines changed

lib/HandleBar.js

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,30 @@ var __extends = (this && this.__extends) || (function () {
1111
})();
1212
Object.defineProperty(exports, "__esModule", { value: true });
1313
var React = require("react");
14-
var HandleBar = (function (_super) {
14+
var ReactDOM = require("react-dom");
15+
var HandleBar = /** @class */ (function (_super) {
1516
__extends(HandleBar, _super);
1617
function HandleBar() {
17-
return _super !== null && _super.apply(this, arguments) || this;
18+
var _this = _super !== null && _super.apply(this, arguments) || this;
19+
_this.getDivInstance = function () {
20+
return ReactDOM.findDOMNode(_this.div);
21+
};
22+
return _this;
1823
}
1924
HandleBar.prototype.render = function () {
25+
var _this = this;
2026
var _a = this.props, position = _a.position, handleMouseDown = _a.handleMouseDown, allowResize = _a.allowResize;
21-
var allowResizeClass = allowResize ? '' : 'resize-not-allowed';
22-
return (React.createElement("div", { className: "handle-bar " + position + " " + allowResizeClass, onMouseDown: function (e) { return handleMouseDown(e); }, onTouchStart: function (e) { return handleMouseDown(e); } },
27+
var classNames = [
28+
'handle-bar',
29+
position,
30+
!allowResize && 'resize-not-allowed',
31+
].filter(function (cls) { return cls; }).join(' ');
32+
return (React.createElement("div", { className: classNames, ref: function (node) { return _this.div = node; }, onMouseDown: function (e) { return handleMouseDown(e); }, onTouchStart: function (e) { return handleMouseDown(e); } },
2333
React.createElement("span", { className: "handle-bar_drag" })));
2434
};
25-
;
35+
HandleBar.defaultProps = {
36+
allowResize: true
37+
};
2638
return HandleBar;
2739
}(React.Component));
28-
HandleBar.defaultProps = {
29-
allowResize: true
30-
};
3140
exports.default = HandleBar;

lib/Helpers.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,35 @@ function unselectAll() {
99
}
1010
}
1111
exports.unselectAll = unselectAll;
12+
function getPrimaryPaneWidth(position, lastX, lastY, maxMousePosition, handleBarOffsetFromParent, primaryPaneMinHeight, primaryPaneMinWidth) {
13+
var primaryPanePosition;
14+
switch (position) {
15+
case 'horizontal': {
16+
if (lastY > maxMousePosition) {
17+
primaryPanePosition = maxMousePosition - handleBarOffsetFromParent;
18+
}
19+
else if ((lastY - handleBarOffsetFromParent) <= primaryPaneMinHeight) {
20+
primaryPanePosition = primaryPaneMinHeight + 0.001;
21+
}
22+
else {
23+
primaryPanePosition = lastY - handleBarOffsetFromParent;
24+
}
25+
break;
26+
}
27+
case 'vertical':
28+
default: {
29+
if (lastX >= maxMousePosition) {
30+
primaryPanePosition = maxMousePosition - handleBarOffsetFromParent;
31+
}
32+
else if ((lastX - handleBarOffsetFromParent) <= primaryPaneMinWidth) {
33+
primaryPanePosition = primaryPaneMinWidth + 0.001;
34+
}
35+
else {
36+
primaryPanePosition = lastX - handleBarOffsetFromParent;
37+
}
38+
break;
39+
}
40+
}
41+
return primaryPanePosition;
42+
}
43+
exports.getPrimaryPaneWidth = getPrimaryPaneWidth;

lib/Pane.js

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,26 @@ var __extends = (this && this.__extends) || (function () {
1111
})();
1212
Object.defineProperty(exports, "__esModule", { value: true });
1313
var React = require("react");
14-
var Pane = (function (_super) {
14+
var ReactDOM = require("react-dom");
15+
var Pane = /** @class */ (function (_super) {
1516
__extends(Pane, _super);
1617
function Pane() {
17-
return _super !== null && _super.apply(this, arguments) || this;
18+
var _this = _super !== null && _super.apply(this, arguments) || this;
19+
_this.getDivInstance = function () {
20+
return ReactDOM.findDOMNode(_this.div);
21+
};
22+
return _this;
1823
}
1924
Pane.prototype.render = function () {
25+
var _this = this;
2026
var _a = this.props, hasDetailPane = _a.hasDetailPane, id = _a.id, style = _a.style, position = _a.position, className = _a.className;
21-
var isDetailPane = hasDetailPane ? 'bottom-detail-pane' : '';
22-
return (React.createElement("div", { id: id, className: "pane " + position + " " + isDetailPane + " " + (className || ''), style: style }, this.props.children));
27+
var classNames = [
28+
'pane',
29+
hasDetailPane && 'bottom-detail-pane',
30+
position,
31+
className
32+
].filter(function (cls) { return cls; }).join(' ');
33+
return (React.createElement("div", { id: id, ref: function (node) { return _this.div = node; }, className: classNames, style: style }, this.props.children));
2334
};
2435
return Pane;
2536
}(React.Component));

0 commit comments

Comments
 (0)