easy-layout 5.0.104 → 5.1.1
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 +1167 -476
- 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 +44 -221
- package/lib/example/div/sizeable/bottom.js +2 -2
- package/lib/example/div/sizeable/left.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 +4 -3
- 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 +43 -199
- package/src/example/div/sizeable/bottom.js +1 -1
- package/src/example/div/sizeable/left.js +2 -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.
|
|
4
|
+
"version": "5.1.1",
|
|
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.",
|
|
@@ -10,8 +10,9 @@
|
|
|
10
10
|
"url": "https://github.com/djalbat/easy-layout"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"easy": "^13.0.
|
|
14
|
-
"easy-
|
|
13
|
+
"easy": "^13.0.41",
|
|
14
|
+
"easy-drag-and-drop": "^1.2.52",
|
|
15
|
+
"easy-with-style": "^3.0.128"
|
|
15
16
|
},
|
|
16
17
|
"devDependencies": {
|
|
17
18
|
"@swc/core": "^1.2.50",
|
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,27 @@
|
|
|
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; ///
|
|
89
|
-
|
|
90
|
-
handler.call(handlerElement, ...remainingArguments, element);
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
enable() {
|
|
95
|
-
this.removeClass("disabled");
|
|
14
|
+
mouseOutHandler(event, element) {
|
|
15
|
+
resetCursor();
|
|
96
16
|
}
|
|
97
17
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
}
|
|
18
|
+
stopDragHandler(dropElement, aborted, element, done) {
|
|
19
|
+
resetCursor();
|
|
101
20
|
|
|
102
|
-
|
|
103
|
-
const disabled = this.hasClass("disabled");
|
|
104
|
-
|
|
105
|
-
return disabled;
|
|
21
|
+
done();
|
|
106
22
|
}
|
|
107
23
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
return dragging;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
getDirection() {
|
|
115
|
-
let direction;
|
|
24
|
+
getSizeableElement() {
|
|
25
|
+
let sizeableElement;
|
|
116
26
|
|
|
117
27
|
const nextSiblingElement = this.getNextSiblingElement(),
|
|
118
28
|
previousSiblingElement = this.getPreviousSiblingElement(),
|
|
@@ -120,18 +30,18 @@ class SplitterDiv extends Element {
|
|
|
120
30
|
previousSiblingElementSizeableElement = isElementSizeableElement(previousSiblingElement);
|
|
121
31
|
|
|
122
32
|
if (nextSiblingElementSizeableElement) {
|
|
123
|
-
|
|
33
|
+
sizeableElement = nextSiblingElement; ///
|
|
124
34
|
}
|
|
125
35
|
|
|
126
36
|
if (previousSiblingElementSizeableElement) {
|
|
127
|
-
|
|
37
|
+
sizeableElement = previousSiblingElement; ///
|
|
128
38
|
}
|
|
129
39
|
|
|
130
|
-
return
|
|
40
|
+
return sizeableElement;
|
|
131
41
|
}
|
|
132
42
|
|
|
133
|
-
|
|
134
|
-
let
|
|
43
|
+
getDirection() {
|
|
44
|
+
let direction;
|
|
135
45
|
|
|
136
46
|
const nextSiblingElement = this.getNextSiblingElement(),
|
|
137
47
|
previousSiblingElement = this.getPreviousSiblingElement(),
|
|
@@ -139,122 +49,56 @@ class SplitterDiv extends Element {
|
|
|
139
49
|
previousSiblingElementSizeableElement = isElementSizeableElement(previousSiblingElement);
|
|
140
50
|
|
|
141
51
|
if (nextSiblingElementSizeableElement) {
|
|
142
|
-
|
|
52
|
+
direction = +1;
|
|
143
53
|
}
|
|
144
54
|
|
|
145
55
|
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);
|
|
56
|
+
direction = -1;
|
|
171
57
|
}
|
|
172
58
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
this.callHandlers(eventType);
|
|
59
|
+
return direction;
|
|
176
60
|
}
|
|
177
61
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
if (!disabled) {
|
|
182
|
-
const dragging = this.isDragging();
|
|
183
|
-
|
|
184
|
-
if (dragging) {
|
|
185
|
-
this.stopDrag();
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
resetCursor();
|
|
189
|
-
}
|
|
62
|
+
enable() {
|
|
63
|
+
this.removeClass("disabled");
|
|
190
64
|
}
|
|
191
65
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
if (!disabled) {
|
|
196
|
-
const dragging = this.isDragging();
|
|
197
|
-
|
|
198
|
-
if (!dragging) {
|
|
199
|
-
resetCursor();
|
|
200
|
-
}
|
|
201
|
-
}
|
|
66
|
+
disable() {
|
|
67
|
+
this.addClass("disabled");
|
|
202
68
|
}
|
|
203
69
|
|
|
204
|
-
|
|
205
|
-
const
|
|
206
|
-
|
|
207
|
-
if (keyCode === ESCAPE_KEY_CODE) {
|
|
208
|
-
const dragging = this.isDragging();
|
|
209
|
-
|
|
210
|
-
if (dragging) {
|
|
211
|
-
this.stopDrag();
|
|
212
|
-
}
|
|
70
|
+
isDisabled() {
|
|
71
|
+
const disabled = this.hasClass("disabled");
|
|
213
72
|
|
|
214
|
-
|
|
215
|
-
}
|
|
73
|
+
return disabled;
|
|
216
74
|
}
|
|
217
75
|
|
|
218
76
|
didMount() {
|
|
219
|
-
|
|
220
|
-
dragHandler = onDrag, ///
|
|
221
|
-
stopDragHandler = onStopDrag, ///
|
|
222
|
-
startDragHandler = onStartDrag; ///
|
|
77
|
+
this.enableDrag();
|
|
223
78
|
|
|
224
|
-
(
|
|
225
|
-
this.disable() :
|
|
226
|
-
this.enable();
|
|
79
|
+
this.onDrag(this.dragHandler, this);
|
|
227
80
|
|
|
228
|
-
|
|
229
|
-
stopDragHandler && this.onStopDrag(stopDragHandler);
|
|
230
|
-
startDragHandler && this.onStartDrag(startDragHandler);
|
|
81
|
+
this.onStopDrag(this.stopDragHandler, this);
|
|
231
82
|
|
|
232
|
-
|
|
83
|
+
this.onStartDrag(this.startDragHandler, this);
|
|
233
84
|
|
|
234
|
-
window.onMouseMove(this.mouseMoveHandler, this);
|
|
235
|
-
|
|
236
|
-
this.onMouseDown(this.mouseDownHandler, this);
|
|
237
85
|
this.onMouseOver(this.mouseOverHandler, this);
|
|
86
|
+
|
|
238
87
|
this.onMouseOut(this.mouseOutHandler, this);
|
|
239
88
|
}
|
|
240
89
|
|
|
241
90
|
willUnmount() {
|
|
242
|
-
|
|
243
|
-
dragHandler = onDrag, ///
|
|
244
|
-
stopDragHandler = onStopDrag, ///
|
|
245
|
-
startDragHandler = onStartDrag; ///
|
|
91
|
+
this.offMouseOut(this.mouseOutHandler, this);
|
|
246
92
|
|
|
247
|
-
|
|
248
|
-
stopDragHandler && this.offStopDrag(stopDragHandler);
|
|
249
|
-
startDragHandler && this.offStartDrag(startDragHandler);
|
|
93
|
+
this.offMouseOver(this.mouseOverHandler, this);
|
|
250
94
|
|
|
251
|
-
|
|
95
|
+
this.offStartDrag(this.startDragHandler, this);
|
|
252
96
|
|
|
253
|
-
|
|
97
|
+
this.offStopDrag(this.stopDragHandler, this);
|
|
254
98
|
|
|
255
|
-
this.
|
|
256
|
-
|
|
257
|
-
this.
|
|
99
|
+
this.offDrag(this.dragHandler, this);
|
|
100
|
+
|
|
101
|
+
this.disableDrag();
|
|
258
102
|
}
|
|
259
103
|
|
|
260
104
|
initialise() {
|
|
@@ -263,26 +107,26 @@ class SplitterDiv extends Element {
|
|
|
263
107
|
|
|
264
108
|
static tagName = "div";
|
|
265
109
|
|
|
266
|
-
static defaultProperties = {
|
|
267
|
-
className: "splitter"
|
|
268
|
-
};
|
|
269
|
-
|
|
270
110
|
static ignoredProperties = [
|
|
271
111
|
"onDrag",
|
|
272
|
-
"options",
|
|
273
112
|
"disabled",
|
|
274
113
|
"onStopDrag",
|
|
275
114
|
"onStartDrag"
|
|
276
115
|
];
|
|
277
116
|
|
|
117
|
+
static defaultProperties = {
|
|
118
|
+
className: "splitter"
|
|
119
|
+
};
|
|
120
|
+
|
|
278
121
|
static fromClass(Class, properties) {
|
|
279
|
-
const
|
|
280
|
-
splitterDiv = Element.fromClass(Class, properties, options);
|
|
122
|
+
const splitterDiv = Element.fromClass(Class, properties);
|
|
281
123
|
|
|
282
124
|
return splitterDiv;
|
|
283
125
|
}
|
|
284
126
|
}
|
|
285
127
|
|
|
128
|
+
Object.assign(SplitterDiv.prototype, dragMixins);
|
|
129
|
+
|
|
286
130
|
export default withStyle(SplitterDiv)`
|
|
287
131
|
|
|
288
132
|
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
|
};
|