@lemon-fe/components 0.1.144 → 0.1.145

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.
@@ -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(false),
25
+ var _useState = useState(242),
24
26
  _useState2 = _slicedToArray(_useState, 2),
25
- collapsed = _useState2[0],
26
- setCollapsed = _useState2[1];
27
- return /*#__PURE__*/React.createElement("div", {
28
- className: classNames("".concat(prefixCls, "-left"), _defineProperty({}, "".concat(prefixCls, "-left-collapsed"), collapsed))
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,
@@ -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
- &::after {
58
- position: absolute;
59
- top: 0;
60
- right: 0;
61
- width: 1px;
62
- height: 100%;
63
- background-color: #e6e6e6;
64
- content: '';
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.144",
3
+ "version": "0.1.145",
4
4
  "description": "> TODO: description",
5
5
  "author": "鲁盛杰 <lusj@cnlemon.net>",
6
6
  "homepage": "",