@lemon-fe/components 0.1.144 → 0.1.146
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/es/Layout/index.js +36 -6
- package/es/Layout/index.less +16 -12
- package/package.json +3 -3
package/es/Layout/index.js
CHANGED
|
@@ -14,18 +14,48 @@ import React, { useState } from 'react';
|
|
|
14
14
|
import classNames from 'classnames';
|
|
15
15
|
import { Spin, Tabs } from 'antd';
|
|
16
16
|
import { get } from 'lodash';
|
|
17
|
+
import { Resizable } from 'react-resizable';
|
|
17
18
|
import { PREFIX_CLS } from '../constants';
|
|
18
19
|
import { mapChildren } from '../utils';
|
|
19
20
|
var prefixCls = "".concat(PREFIX_CLS, "-layout");
|
|
20
21
|
function Sider(props) {
|
|
22
|
+
var _classNames;
|
|
21
23
|
var children = props.children,
|
|
22
24
|
onCollapse = props.onCollapse;
|
|
23
|
-
var _useState = useState(
|
|
25
|
+
var _useState = useState(242),
|
|
24
26
|
_useState2 = _slicedToArray(_useState, 2),
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
width = _useState2[0],
|
|
28
|
+
setWidth = _useState2[1];
|
|
29
|
+
var _useState3 = useState(false),
|
|
30
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
31
|
+
collapsed = _useState4[0],
|
|
32
|
+
setCollapsed = _useState4[1];
|
|
33
|
+
var _useState5 = useState(false),
|
|
34
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
35
|
+
dragging = _useState6[0],
|
|
36
|
+
setDragging = _useState6[1];
|
|
37
|
+
var viewWidth = collapsed ? 0 : width;
|
|
38
|
+
return /*#__PURE__*/React.createElement(Resizable, {
|
|
39
|
+
axis: "x",
|
|
40
|
+
width: width,
|
|
41
|
+
height: 0,
|
|
42
|
+
onResizeStart: function onResizeStart() {
|
|
43
|
+
setDragging(true);
|
|
44
|
+
},
|
|
45
|
+
onResizeStop: function onResizeStop() {
|
|
46
|
+
setDragging(false);
|
|
47
|
+
},
|
|
48
|
+
onResize: function onResize(_, data) {
|
|
49
|
+
setWidth(data.size.width);
|
|
50
|
+
},
|
|
51
|
+
handle: /*#__PURE__*/React.createElement("div", {
|
|
52
|
+
className: "".concat(prefixCls, "-left-resizable")
|
|
53
|
+
})
|
|
54
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
55
|
+
className: classNames("".concat(prefixCls, "-left"), (_classNames = {}, _defineProperty(_classNames, "".concat(prefixCls, "-left-collapsed"), collapsed), _defineProperty(_classNames, "".concat(prefixCls, "-left-resizing"), dragging), _classNames)),
|
|
56
|
+
style: {
|
|
57
|
+
width: viewWidth
|
|
58
|
+
}
|
|
29
59
|
}, /*#__PURE__*/React.createElement("div", {
|
|
30
60
|
className: "".concat(prefixCls, "-left-body")
|
|
31
61
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -78,7 +108,7 @@ function Sider(props) {
|
|
|
78
108
|
strokeLinejoin: "round",
|
|
79
109
|
strokeDasharray: "0,0",
|
|
80
110
|
transform: "translate(2.828427, 2.121320) rotate(-45.000000) translate(-2.828427, -2.121320) "
|
|
81
|
-
}))))))));
|
|
111
|
+
})))))))));
|
|
82
112
|
}
|
|
83
113
|
function Content(props) {
|
|
84
114
|
var left = props.left,
|
package/es/Layout/index.less
CHANGED
|
@@ -40,29 +40,33 @@
|
|
|
40
40
|
&-left {
|
|
41
41
|
position: relative;
|
|
42
42
|
|
|
43
|
+
&:not(&-resizing) {
|
|
44
|
+
transition: width 0.2s;
|
|
45
|
+
}
|
|
46
|
+
|
|
43
47
|
&-body {
|
|
44
|
-
width: 242px;
|
|
45
48
|
height: 100%;
|
|
46
49
|
overflow-x: hidden;
|
|
47
|
-
transition: width 0.2s;
|
|
48
50
|
}
|
|
49
51
|
|
|
50
52
|
&-content {
|
|
51
53
|
position: relative;
|
|
52
54
|
display: flex;
|
|
53
55
|
flex-direction: column;
|
|
54
|
-
width: 242px;
|
|
55
56
|
height: 100%;
|
|
57
|
+
}
|
|
56
58
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
59
|
+
&-resizable {
|
|
60
|
+
position: absolute;
|
|
61
|
+
top: 0;
|
|
62
|
+
right: -8px;
|
|
63
|
+
box-sizing: border-box;
|
|
64
|
+
width: 17px;
|
|
65
|
+
height: 100%;
|
|
66
|
+
padding: 0 8px;
|
|
67
|
+
background-color: #e6e6e6;
|
|
68
|
+
background-clip: content-box;
|
|
69
|
+
cursor: col-resize;
|
|
66
70
|
}
|
|
67
71
|
|
|
68
72
|
&-collapse {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lemon-fe/components",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.146",
|
|
4
4
|
"description": "> TODO: description",
|
|
5
5
|
"author": "鲁盛杰 <lusj@cnlemon.net>",
|
|
6
6
|
"homepage": "",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"registry": "https://registry.npmjs.org"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@lemon-fe/hooks": "^0.1.
|
|
19
|
+
"@lemon-fe/hooks": "^0.1.146",
|
|
20
20
|
"classnames": "^2.2.6",
|
|
21
21
|
"color-string": "^1.9.0",
|
|
22
22
|
"lodash": "^4.17.0",
|
|
@@ -39,5 +39,5 @@
|
|
|
39
39
|
"react": "^17.0.2",
|
|
40
40
|
"react-dom": "^17.0.2"
|
|
41
41
|
},
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "88632b58b09887447b008f24b5a59610aaf8e551"
|
|
43
43
|
}
|