easy-layout 5.0.104 → 5.0.106
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/example.js +1153 -464
- package/lib/constants.js +2 -4
- package/lib/div/splitter/horizontal.js +13 -43
- package/lib/div/splitter/vertical.js +13 -43
- package/lib/div/splitter.js +48 -219
- package/lib/example/div/sizeable/bottom.js +2 -2
- package/lib/example/div/splitter/horizontal/main.js +1 -61
- package/lib/example/view.js +12 -13
- package/lib/index.js +1 -8
- package/package.json +2 -1
- package/src/constants.js +0 -1
- package/src/div/splitter/horizontal.js +15 -60
- package/src/div/splitter/vertical.js +15 -60
- package/src/div/splitter.js +49 -197
- package/src/example/div/sizeable/bottom.js +0 -1
- package/src/example/div/splitter/horizontal/main.js +0 -19
- package/src/example/view.js +24 -10
- package/src/index.js +0 -2
- package/lib/options.js +0 -13
- package/src/options.js +0 -7
package/lib/index.js
CHANGED
|
@@ -2,12 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
Object.defineProperty(exports, "options", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return _options.default;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
5
|
Object.defineProperty(exports, "RowDiv", {
|
|
12
6
|
enumerable: true,
|
|
13
7
|
get: function() {
|
|
@@ -62,7 +56,6 @@ Object.defineProperty(exports, "HorizontalSplitterDiv", {
|
|
|
62
56
|
return _horizontal.default;
|
|
63
57
|
}
|
|
64
58
|
});
|
|
65
|
-
var _options = _interopRequireDefault(require("./options"));
|
|
66
59
|
var _row = _interopRequireDefault(require("./div/row"));
|
|
67
60
|
var _rows = _interopRequireDefault(require("./div/rows"));
|
|
68
61
|
var _column = _interopRequireDefault(require("./div/column"));
|
|
@@ -78,4 +71,4 @@ function _interopRequireDefault(obj) {
|
|
|
78
71
|
};
|
|
79
72
|
}
|
|
80
73
|
|
|
81
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
74
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9pbmRleC5qcyJdLCJzb3VyY2VzQ29udGVudCI6WyIndXNlIHN0cmljdCc7XG5cbmV4cG9ydCB7IGRlZmF1bHQgYXMgUm93RGl2IH0gZnJvbSBcIi4vZGl2L3Jvd1wiO1xuZXhwb3J0IHsgZGVmYXVsdCBhcyBSb3dzRGl2IH0gZnJvbSBcIi4vZGl2L3Jvd3NcIjtcbmV4cG9ydCB7IGRlZmF1bHQgYXMgQ29sdW1uRGl2IH0gZnJvbSBcIi4vZGl2L2NvbHVtblwiO1xuZXhwb3J0IHsgZGVmYXVsdCBhcyBDb2x1bW5zRGl2IH0gZnJvbSBcIi4vZGl2L2NvbHVtbnNcIjtcbmV4cG9ydCB7IGRlZmF1bHQgYXMgU3BsaXR0ZXJEaXYgfSBmcm9tIFwiLi9kaXYvc3BsaXR0ZXJcIjtcbmV4cG9ydCB7IGRlZmF1bHQgYXMgU2l6ZWFibGVEaXYgfSBmcm9tIFwiLi9kaXYvc2l6ZWFibGVcIjtcbmV4cG9ydCB7IGRlZmF1bHQgYXMgU2l6ZWFibGVTZWN0aW9uIH0gZnJvbSBcIi4vc2VjdGlvbi9zaXplYWJsZVwiO1xuZXhwb3J0IHsgZGVmYXVsdCBhcyBWZXJ0aWNhbFNwbGl0dGVyRGl2IH0gZnJvbSBcIi4vZGl2L3NwbGl0dGVyL3ZlcnRpY2FsXCI7XG5leHBvcnQgeyBkZWZhdWx0IGFzIEhvcml6b250YWxTcGxpdHRlckRpdiB9IGZyb20gXCIuL2Rpdi9zcGxpdHRlci9ob3Jpem9udGFsXCI7XG4iXSwibmFtZXMiOlsiUm93RGl2IiwiZGVmYXVsdCIsIlJvd3NEaXYiLCJDb2x1bW5EaXYiLCJDb2x1bW5zRGl2IiwiU3BsaXR0ZXJEaXYiLCJTaXplYWJsZURpdiIsIlNpemVhYmxlU2VjdGlvbiIsIlZlcnRpY2FsU3BsaXR0ZXJEaXYiLCJIb3Jpem9udGFsU3BsaXR0ZXJEaXYiXSwibWFwcGluZ3MiOiJBQUFBLFlBQVksQ0FBQzs7OzsrQkFFT0EsUUFBTTs7O29CQUFqQkMsT0FBTzs7OytCQUNJQyxTQUFPOzs7cUJBQWxCRCxPQUFPOzs7K0JBQ0lFLFdBQVM7Ozt1QkFBcEJGLE9BQU87OzsrQkFDSUcsWUFBVTs7O3dCQUFyQkgsT0FBTzs7OytCQUNJSSxhQUFXOzs7eUJBQXRCSixPQUFPOzs7K0JBQ0lLLGFBQVc7Ozt5QkFBdEJMLE9BQU87OzsrQkFDSU0saUJBQWU7OzswQkFBMUJOLE9BQU87OzsrQkFDSU8scUJBQW1COzs7eUJBQTlCUCxPQUFPOzs7K0JBQ0lRLHVCQUFxQjs7OzJCQUFoQ1IsT0FBTzs7OzBDQVJrQixXQUFXOzJDQUNWLFlBQVk7NkNBQ1YsY0FBYzs4Q0FDYixlQUFlOytDQUNkLGdCQUFnQjsrQ0FDaEIsZ0JBQWdCO2dEQUNaLG9CQUFvQjsrQ0FDaEIseUJBQXlCO2lEQUN2QiwyQkFBMkIifQ==
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "easy-layout",
|
|
3
3
|
"author": "James Smith",
|
|
4
|
-
"version": "5.0.
|
|
4
|
+
"version": "5.0.106",
|
|
5
5
|
"license": "MIT, Anti-996",
|
|
6
6
|
"homepage": "https://github.com/djalbat/easy-layout",
|
|
7
7
|
"description": "Layout elements that work with CSS flexbox.",
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
13
|
"easy": "^13.0.33",
|
|
14
|
+
"easy-drag-and-drop": "^1.2.51",
|
|
14
15
|
"easy-with-style": "^3.0.126"
|
|
15
16
|
},
|
|
16
17
|
"devDependencies": {
|
package/src/constants.js
CHANGED
|
@@ -2,14 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
import withStyle from "easy-with-style"; ///
|
|
4
4
|
|
|
5
|
-
import { eventTypes } from "easy";
|
|
6
|
-
|
|
7
5
|
import Splitter from "../splitter";
|
|
8
6
|
|
|
9
7
|
import { rowResizeCursor } from "../../cursor";
|
|
10
8
|
|
|
11
|
-
const { DRAG_EVENT_TYPE } = eventTypes;
|
|
12
|
-
|
|
13
9
|
class HorizontalSplitter extends Splitter {
|
|
14
10
|
mouseOverHandler(event, element) {
|
|
15
11
|
const disabled = this.isDisabled();
|
|
@@ -19,65 +15,32 @@ class HorizontalSplitter extends Splitter {
|
|
|
19
15
|
}
|
|
20
16
|
}
|
|
21
17
|
|
|
22
|
-
|
|
23
|
-
const
|
|
24
|
-
mouseTop = pageY, ///
|
|
25
|
-
disabled = this.isDisabled();
|
|
26
|
-
|
|
27
|
-
if (!disabled) {
|
|
28
|
-
const dragging = this.isDragging();
|
|
29
|
-
|
|
30
|
-
if (dragging) {
|
|
31
|
-
const direction = this.getDirection(),
|
|
32
|
-
sizeableElement = this.getSizeableElement();
|
|
33
|
-
|
|
34
|
-
const previousMouseTop = this.getPreviousMouseTop(),
|
|
35
|
-
previousSizeableElementHeight = this.getPreviousSizeableElementHeight(),
|
|
36
|
-
relativeMouseTop = mouseTop - previousMouseTop;
|
|
37
|
-
|
|
38
|
-
let sizeableElementHeight = previousSizeableElementHeight - direction * relativeMouseTop;
|
|
39
|
-
|
|
40
|
-
const height = sizeableElementHeight, ///
|
|
41
|
-
eventType = DRAG_EVENT_TYPE;
|
|
42
|
-
|
|
43
|
-
sizeableElement.setHeight(height);
|
|
44
|
-
|
|
45
|
-
sizeableElementHeight = sizeableElement.getHeight(); ///
|
|
46
|
-
|
|
47
|
-
this.callHandlers(eventType, sizeableElementHeight);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
mouseDownHandler(event, element) {
|
|
53
|
-
const { pageY } = event,
|
|
54
|
-
mouseTop = pageY, ///
|
|
55
|
-
disabled = this.isDisabled();
|
|
18
|
+
startDragHandler(element) {
|
|
19
|
+
const disabled = this.isDisabled();
|
|
56
20
|
|
|
57
21
|
if (!disabled) {
|
|
58
|
-
const
|
|
59
|
-
sizeableElement = this.getSizeableElement(),
|
|
60
|
-
previousMouseTop = mouseTop, ///
|
|
22
|
+
const sizeableElement = this.getSizeableElement(),
|
|
61
23
|
sizeableElementHeight = sizeableElement.getHeight(),
|
|
62
24
|
previousSizeableElementHeight = sizeableElementHeight; ///
|
|
63
25
|
|
|
64
|
-
this.setPreviousMouseTop(previousMouseTop);
|
|
65
|
-
|
|
66
26
|
this.setPreviousSizeableElementHeight(previousSizeableElementHeight);
|
|
67
27
|
|
|
68
28
|
rowResizeCursor();
|
|
69
|
-
|
|
70
|
-
if (!dragging) {
|
|
71
|
-
this.startDrag();
|
|
72
|
-
}
|
|
73
29
|
}
|
|
74
30
|
}
|
|
75
31
|
|
|
76
|
-
|
|
77
|
-
const
|
|
78
|
-
|
|
32
|
+
dragHandler(relativeMouseTop, relativeMouseLeft) {
|
|
33
|
+
const disabled = this.isDisabled();
|
|
34
|
+
|
|
35
|
+
if (!disabled) {
|
|
36
|
+
const direction = this.getDirection(),
|
|
37
|
+
sizeableElement = this.getSizeableElement(),
|
|
38
|
+
previousSizeableElementHeight = this.getPreviousSizeableElementHeight(),
|
|
39
|
+
sizeableElementHeight = previousSizeableElementHeight - direction * relativeMouseTop,
|
|
40
|
+
height = sizeableElementHeight; ///
|
|
79
41
|
|
|
80
|
-
|
|
42
|
+
sizeableElement.setHeight(height);
|
|
43
|
+
}
|
|
81
44
|
}
|
|
82
45
|
|
|
83
46
|
getPreviousSizeableElementHeight() {
|
|
@@ -87,12 +50,6 @@ class HorizontalSplitter extends Splitter {
|
|
|
87
50
|
return previousSizeableElementHeight;
|
|
88
51
|
}
|
|
89
52
|
|
|
90
|
-
setPreviousMouseTop(previousMouseTop) {
|
|
91
|
-
this.updateState({
|
|
92
|
-
previousMouseTop
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
|
|
96
53
|
setPreviousSizeableElementHeight(previousSizeableElementHeight) {
|
|
97
54
|
this.updateState({
|
|
98
55
|
previousSizeableElementHeight
|
|
@@ -100,11 +57,9 @@ class HorizontalSplitter extends Splitter {
|
|
|
100
57
|
}
|
|
101
58
|
|
|
102
59
|
setInitialState() {
|
|
103
|
-
const
|
|
104
|
-
previousSizeableElementHeight = null;
|
|
60
|
+
const previousSizeableElementHeight = null;
|
|
105
61
|
|
|
106
62
|
this.setState({
|
|
107
|
-
previousMouseTop,
|
|
108
63
|
previousSizeableElementHeight
|
|
109
64
|
});
|
|
110
65
|
}
|
|
@@ -2,14 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
import withStyle from "easy-with-style"; ///
|
|
4
4
|
|
|
5
|
-
import { eventTypes } from "easy";
|
|
6
|
-
|
|
7
5
|
import Splitter from "../splitter";
|
|
8
6
|
|
|
9
7
|
import { columnResizeCursor } from "../../cursor";
|
|
10
8
|
|
|
11
|
-
const { DRAG_EVENT_TYPE } = eventTypes;
|
|
12
|
-
|
|
13
9
|
class VerticalSplitter extends Splitter {
|
|
14
10
|
mouseOverHandler(event, element) {
|
|
15
11
|
const disabled = this.isDisabled();
|
|
@@ -19,65 +15,32 @@ class VerticalSplitter extends Splitter {
|
|
|
19
15
|
}
|
|
20
16
|
}
|
|
21
17
|
|
|
22
|
-
|
|
23
|
-
const
|
|
24
|
-
mouseLeft = pageX, ///
|
|
25
|
-
disabled = this.isDisabled();
|
|
26
|
-
|
|
27
|
-
if (!disabled) {
|
|
28
|
-
const dragging = this.isDragging();
|
|
29
|
-
|
|
30
|
-
if (dragging) {
|
|
31
|
-
const direction = this.getDirection(),
|
|
32
|
-
sizeableElement = this.getSizeableElement();
|
|
33
|
-
|
|
34
|
-
const previousMouseLeft = this.getPreviousMouseLeft(),
|
|
35
|
-
previousSizeableElementWidth = this.getPreviousSizeableElementWidth(),
|
|
36
|
-
relativeMouseLeft = mouseLeft - previousMouseLeft;
|
|
37
|
-
|
|
38
|
-
let sizeableElementWidth = previousSizeableElementWidth - direction * relativeMouseLeft;
|
|
39
|
-
|
|
40
|
-
const width = sizeableElementWidth, ///
|
|
41
|
-
eventType = DRAG_EVENT_TYPE;
|
|
42
|
-
|
|
43
|
-
sizeableElement.setWidth(width);
|
|
44
|
-
|
|
45
|
-
sizeableElementWidth = sizeableElement.getWidth(); ///
|
|
46
|
-
|
|
47
|
-
this.callHandlers(eventType, sizeableElementWidth);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
mouseDownHandler(event, element) {
|
|
53
|
-
const { pageX } = event,
|
|
54
|
-
mouseLeft = pageX, ///
|
|
55
|
-
disabled = this.isDisabled();
|
|
18
|
+
startDragHandler(element) {
|
|
19
|
+
const disabled = this.isDisabled();
|
|
56
20
|
|
|
57
21
|
if (!disabled) {
|
|
58
|
-
const
|
|
59
|
-
sizeableElement = this.getSizeableElement(),
|
|
60
|
-
previousMouseLeft = mouseLeft, ///
|
|
22
|
+
const sizeableElement = this.getSizeableElement(),
|
|
61
23
|
sizeableElementWidth = sizeableElement.getWidth(),
|
|
62
24
|
previousSizeableElementWidth = sizeableElementWidth; ///
|
|
63
25
|
|
|
64
|
-
this.setPreviousMouseLeft(previousMouseLeft);
|
|
65
|
-
|
|
66
26
|
this.setPreviousSizeableElementWidth(previousSizeableElementWidth);
|
|
67
27
|
|
|
68
28
|
columnResizeCursor();
|
|
69
|
-
|
|
70
|
-
if (!dragging) {
|
|
71
|
-
this.startDrag();
|
|
72
|
-
}
|
|
73
29
|
}
|
|
74
30
|
}
|
|
75
31
|
|
|
76
|
-
|
|
77
|
-
const
|
|
78
|
-
|
|
32
|
+
dragHandler(relativeMouseTop, relativeMouseLeft) {
|
|
33
|
+
const disabled = this.isDisabled();
|
|
34
|
+
|
|
35
|
+
if (!disabled) {
|
|
36
|
+
const direction = this.getDirection(),
|
|
37
|
+
sizeableElement = this.getSizeableElement(),
|
|
38
|
+
previousSizeableElementWidth = this.getPreviousSizeableElementWidth(),
|
|
39
|
+
sizeableElementWidth = previousSizeableElementWidth - direction * relativeMouseLeft,
|
|
40
|
+
width = sizeableElementWidth; ///
|
|
79
41
|
|
|
80
|
-
|
|
42
|
+
sizeableElement.setWidth(width);
|
|
43
|
+
}
|
|
81
44
|
}
|
|
82
45
|
|
|
83
46
|
getPreviousSizeableElementWidth() {
|
|
@@ -87,12 +50,6 @@ class VerticalSplitter extends Splitter {
|
|
|
87
50
|
return previousSizeableElementWidth;
|
|
88
51
|
}
|
|
89
52
|
|
|
90
|
-
setPreviousMouseLeft(previousMouseLeft) {
|
|
91
|
-
this.updateState({
|
|
92
|
-
previousMouseLeft
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
|
|
96
53
|
setPreviousSizeableElementWidth(previousSizeableElementWidth) {
|
|
97
54
|
this.updateState({
|
|
98
55
|
previousSizeableElementWidth
|
|
@@ -100,11 +57,9 @@ class VerticalSplitter extends Splitter {
|
|
|
100
57
|
}
|
|
101
58
|
|
|
102
59
|
setInitialState() {
|
|
103
|
-
const
|
|
104
|
-
previousSizeableElementWidth = null;
|
|
60
|
+
const previousSizeableElementWidth = null;
|
|
105
61
|
|
|
106
62
|
this.setState({
|
|
107
|
-
previousMouseLeft,
|
|
108
63
|
previousSizeableElementWidth
|
|
109
64
|
});
|
|
110
65
|
}
|
package/src/div/splitter.js
CHANGED
|
@@ -2,117 +2,35 @@
|
|
|
2
2
|
|
|
3
3
|
import withStyle from "easy-with-style"; ///
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { Element } from "easy";
|
|
6
|
+
import { dragMixins } from "easy-drag-and-drop";
|
|
6
7
|
|
|
7
8
|
import SizeableDiv from "../div/sizeable";
|
|
8
9
|
import SizeableSection from "../section/sizeable";
|
|
9
10
|
|
|
10
11
|
import { resetCursor } from "../cursor";
|
|
11
|
-
import { ESCAPE_KEY_CODE } from "../constants";
|
|
12
|
-
import { ESCAPE_KEY_STOPS_DRAGGING_OPTION } from "../options";
|
|
13
|
-
|
|
14
|
-
const { BLUR_EVENT_TYPE, DRAG_EVENT_TYPE, MOUSEUP_EVENT_TYPE, STOP_DRAG_EVENT_TYPE, START_DRAG_EVENT_TYPE } = eventTypes;
|
|
15
12
|
|
|
16
13
|
class SplitterDiv extends Element {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
this.options = options;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
isOptionPresent(option) {
|
|
24
|
-
const optionPresent = !!this.options[option];
|
|
25
|
-
|
|
26
|
-
return optionPresent;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
setOptions(options) {
|
|
30
|
-
this.options = options;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
setOption(option) {
|
|
34
|
-
this.options[option] = true;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
unsetOption(option) {
|
|
38
|
-
delete(this.options[option]);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
onDrag(dragHandler, element) {
|
|
42
|
-
const eventType = DRAG_EVENT_TYPE,
|
|
43
|
-
handler = dragHandler; ///
|
|
44
|
-
|
|
45
|
-
this.addEventListener(eventType, handler, element);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
offDrag(dragHandler, element) {
|
|
49
|
-
const eventType = DRAG_EVENT_TYPE,
|
|
50
|
-
handler = dragHandler; ///
|
|
51
|
-
|
|
52
|
-
this.removeEventListener(eventType, handler, element);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
onStopDrag(stopDragHandler, element) {
|
|
56
|
-
const eventType = STOP_DRAG_EVENT_TYPE,
|
|
57
|
-
handler = stopDragHandler; ///
|
|
58
|
-
|
|
59
|
-
this.addEventListener(eventType, handler, element);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
offStopDrag(stopDragHandler, element) {
|
|
63
|
-
const eventType = STOP_DRAG_EVENT_TYPE,
|
|
64
|
-
handler = stopDragHandler; ///
|
|
65
|
-
|
|
66
|
-
this.removeEventListener(eventType, handler, element);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
onStartDrag(stopDragHandler, element) {
|
|
70
|
-
const eventType = START_DRAG_EVENT_TYPE,
|
|
71
|
-
handler = stopDragHandler; ///
|
|
72
|
-
|
|
73
|
-
this.addEventListener(eventType, handler, element);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
offStartDrag(stopDragHandler, element) {
|
|
77
|
-
const eventType = START_DRAG_EVENT_TYPE,
|
|
78
|
-
handler = stopDragHandler; ///
|
|
79
|
-
|
|
80
|
-
this.removeEventListener(eventType, handler, element);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
callHandlers(eventType, ...remainingArguments) {
|
|
84
|
-
const eventListeners = this.findEventListeners(eventType);
|
|
85
|
-
|
|
86
|
-
eventListeners.forEach((eventListener) => {
|
|
87
|
-
const { handler, element: handlerElement } = eventListener,
|
|
88
|
-
element = this; ///
|
|
14
|
+
mouseOutHandler(event, element) {
|
|
15
|
+
const disabled = this.isDisabled();
|
|
89
16
|
|
|
90
|
-
|
|
91
|
-
|
|
17
|
+
if (!disabled) {
|
|
18
|
+
resetCursor();
|
|
19
|
+
}
|
|
92
20
|
}
|
|
93
21
|
|
|
94
|
-
|
|
95
|
-
this.
|
|
96
|
-
}
|
|
22
|
+
stopDragHandler(dropElement, aborted, element, done) {
|
|
23
|
+
const disabled = this.isDisabled();
|
|
97
24
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
25
|
+
if (!disabled) {
|
|
26
|
+
resetCursor();
|
|
27
|
+
}
|
|
101
28
|
|
|
102
|
-
|
|
103
|
-
const disabled = this.hasClass("disabled");
|
|
104
|
-
|
|
105
|
-
return disabled;
|
|
29
|
+
done();
|
|
106
30
|
}
|
|
107
31
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
return dragging;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
getDirection() {
|
|
115
|
-
let direction;
|
|
32
|
+
getSizeableElement() {
|
|
33
|
+
let sizeableElement;
|
|
116
34
|
|
|
117
35
|
const nextSiblingElement = this.getNextSiblingElement(),
|
|
118
36
|
previousSiblingElement = this.getPreviousSiblingElement(),
|
|
@@ -120,18 +38,18 @@ class SplitterDiv extends Element {
|
|
|
120
38
|
previousSiblingElementSizeableElement = isElementSizeableElement(previousSiblingElement);
|
|
121
39
|
|
|
122
40
|
if (nextSiblingElementSizeableElement) {
|
|
123
|
-
|
|
41
|
+
sizeableElement = nextSiblingElement; ///
|
|
124
42
|
}
|
|
125
43
|
|
|
126
44
|
if (previousSiblingElementSizeableElement) {
|
|
127
|
-
|
|
45
|
+
sizeableElement = previousSiblingElement; ///
|
|
128
46
|
}
|
|
129
47
|
|
|
130
|
-
return
|
|
48
|
+
return sizeableElement;
|
|
131
49
|
}
|
|
132
50
|
|
|
133
|
-
|
|
134
|
-
let
|
|
51
|
+
getDirection() {
|
|
52
|
+
let direction;
|
|
135
53
|
|
|
136
54
|
const nextSiblingElement = this.getNextSiblingElement(),
|
|
137
55
|
previousSiblingElement = this.getPreviousSiblingElement(),
|
|
@@ -139,122 +57,56 @@ class SplitterDiv extends Element {
|
|
|
139
57
|
previousSiblingElementSizeableElement = isElementSizeableElement(previousSiblingElement);
|
|
140
58
|
|
|
141
59
|
if (nextSiblingElementSizeableElement) {
|
|
142
|
-
|
|
60
|
+
direction = +1;
|
|
143
61
|
}
|
|
144
62
|
|
|
145
63
|
if (previousSiblingElementSizeableElement) {
|
|
146
|
-
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
return sizeableElement;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
startDrag() {
|
|
153
|
-
const eventType = START_DRAG_EVENT_TYPE,
|
|
154
|
-
escapeKeyStopsDraggingOptionPresent = this.isOptionPresent(ESCAPE_KEY_STOPS_DRAGGING_OPTION);
|
|
155
|
-
|
|
156
|
-
if (escapeKeyStopsDraggingOptionPresent) {
|
|
157
|
-
window.onKeyDown(this.keyDownHandler, this);
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
this.addClass("dragging");
|
|
161
|
-
|
|
162
|
-
this.callHandlers(eventType)
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
stopDrag() {
|
|
166
|
-
const eventType = STOP_DRAG_EVENT_TYPE,
|
|
167
|
-
escapeKeyStopsDraggingOptionPresent = this.isOptionPresent(ESCAPE_KEY_STOPS_DRAGGING_OPTION);
|
|
168
|
-
|
|
169
|
-
if (escapeKeyStopsDraggingOptionPresent) {
|
|
170
|
-
window.offKeyDown(this.keyDownHandler, this);
|
|
64
|
+
direction = -1;
|
|
171
65
|
}
|
|
172
66
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
this.callHandlers(eventType);
|
|
67
|
+
return direction;
|
|
176
68
|
}
|
|
177
69
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
if (!disabled) {
|
|
182
|
-
const dragging = this.isDragging();
|
|
183
|
-
|
|
184
|
-
if (dragging) {
|
|
185
|
-
this.stopDrag();
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
resetCursor();
|
|
189
|
-
}
|
|
70
|
+
enable() {
|
|
71
|
+
this.removeClass("disabled");
|
|
190
72
|
}
|
|
191
73
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
if (!disabled) {
|
|
196
|
-
const dragging = this.isDragging();
|
|
197
|
-
|
|
198
|
-
if (!dragging) {
|
|
199
|
-
resetCursor();
|
|
200
|
-
}
|
|
201
|
-
}
|
|
74
|
+
disable() {
|
|
75
|
+
this.addClass("disabled");
|
|
202
76
|
}
|
|
203
77
|
|
|
204
|
-
|
|
205
|
-
const
|
|
206
|
-
|
|
207
|
-
if (keyCode === ESCAPE_KEY_CODE) {
|
|
208
|
-
const dragging = this.isDragging();
|
|
209
|
-
|
|
210
|
-
if (dragging) {
|
|
211
|
-
this.stopDrag();
|
|
212
|
-
}
|
|
78
|
+
isDisabled() {
|
|
79
|
+
const disabled = this.hasClass("disabled");
|
|
213
80
|
|
|
214
|
-
|
|
215
|
-
}
|
|
81
|
+
return disabled;
|
|
216
82
|
}
|
|
217
83
|
|
|
218
84
|
didMount() {
|
|
219
|
-
|
|
220
|
-
dragHandler = onDrag, ///
|
|
221
|
-
stopDragHandler = onStopDrag, ///
|
|
222
|
-
startDragHandler = onStartDrag; ///
|
|
223
|
-
|
|
224
|
-
(disabled === true) ? ///
|
|
225
|
-
this.disable() :
|
|
226
|
-
this.enable();
|
|
85
|
+
this.enableDrag();
|
|
227
86
|
|
|
228
|
-
|
|
229
|
-
stopDragHandler && this.onStopDrag(stopDragHandler);
|
|
230
|
-
startDragHandler && this.onStartDrag(startDragHandler);
|
|
87
|
+
this.onDrag(this.dragHandler, this);
|
|
231
88
|
|
|
232
|
-
|
|
89
|
+
this.onStopDrag(this.stopDragHandler, this);
|
|
233
90
|
|
|
234
|
-
|
|
91
|
+
this.onStartDrag(this.startDragHandler, this);
|
|
235
92
|
|
|
236
|
-
this.onMouseDown(this.mouseDownHandler, this);
|
|
237
93
|
this.onMouseOver(this.mouseOverHandler, this);
|
|
94
|
+
|
|
238
95
|
this.onMouseOut(this.mouseOutHandler, this);
|
|
239
96
|
}
|
|
240
97
|
|
|
241
98
|
willUnmount() {
|
|
242
|
-
|
|
243
|
-
dragHandler = onDrag, ///
|
|
244
|
-
stopDragHandler = onStopDrag, ///
|
|
245
|
-
startDragHandler = onStartDrag; ///
|
|
99
|
+
this.offMouseOut(this.mouseOutHandler, this);
|
|
246
100
|
|
|
247
|
-
|
|
248
|
-
stopDragHandler && this.offStopDrag(stopDragHandler);
|
|
249
|
-
startDragHandler && this.offStartDrag(startDragHandler);
|
|
101
|
+
this.offMouseOver(this.mouseOverHandler, this);
|
|
250
102
|
|
|
251
|
-
|
|
103
|
+
this.offStartDrag(this.startDragHandler, this);
|
|
252
104
|
|
|
253
|
-
|
|
105
|
+
this.offStopDrag(this.stopDragHandler, this);
|
|
254
106
|
|
|
255
|
-
this.
|
|
256
|
-
|
|
257
|
-
this.
|
|
107
|
+
this.offDrag(this.dragHandler, this);
|
|
108
|
+
|
|
109
|
+
this.disableDrag();
|
|
258
110
|
}
|
|
259
111
|
|
|
260
112
|
initialise() {
|
|
@@ -263,26 +115,26 @@ class SplitterDiv extends Element {
|
|
|
263
115
|
|
|
264
116
|
static tagName = "div";
|
|
265
117
|
|
|
266
|
-
static defaultProperties = {
|
|
267
|
-
className: "splitter"
|
|
268
|
-
};
|
|
269
|
-
|
|
270
118
|
static ignoredProperties = [
|
|
271
119
|
"onDrag",
|
|
272
|
-
"options",
|
|
273
120
|
"disabled",
|
|
274
121
|
"onStopDrag",
|
|
275
122
|
"onStartDrag"
|
|
276
123
|
];
|
|
277
124
|
|
|
125
|
+
static defaultProperties = {
|
|
126
|
+
className: "splitter"
|
|
127
|
+
};
|
|
128
|
+
|
|
278
129
|
static fromClass(Class, properties) {
|
|
279
|
-
const
|
|
280
|
-
splitterDiv = Element.fromClass(Class, properties, options);
|
|
130
|
+
const splitterDiv = Element.fromClass(Class, properties);
|
|
281
131
|
|
|
282
132
|
return splitterDiv;
|
|
283
133
|
}
|
|
284
134
|
}
|
|
285
135
|
|
|
136
|
+
Object.assign(SplitterDiv.prototype, dragMixins);
|
|
137
|
+
|
|
286
138
|
export default withStyle(SplitterDiv)`
|
|
287
139
|
|
|
288
140
|
flex-shrink: 0;
|
|
@@ -5,25 +5,6 @@ import withStyle from "easy-with-style"; ///
|
|
|
5
5
|
import { HorizontalSplitterDiv } from "../../../../index"; ///
|
|
6
6
|
|
|
7
7
|
class MainHorizontalSplitterDiv extends HorizontalSplitterDiv {
|
|
8
|
-
dragHandler(sizeableDivHeight) {
|
|
9
|
-
const { bottomLeftDiv } = this.properties,
|
|
10
|
-
height = sizeableDivHeight; ///
|
|
11
|
-
|
|
12
|
-
bottomLeftDiv.setHeight(height);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
didMount() {
|
|
16
|
-
super.didMount();
|
|
17
|
-
|
|
18
|
-
this.onDrag(this.dragHandler, this);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
willUnmount() {
|
|
22
|
-
this.offDrag(this.dragHandler, this);
|
|
23
|
-
|
|
24
|
-
super.willUnmount();
|
|
25
|
-
}
|
|
26
|
-
|
|
27
8
|
static defaultProperties = {
|
|
28
9
|
className: "main"
|
|
29
10
|
};
|