@lemon-fe/kits 1.0.0-105 → 1.0.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/es/components/DataGrid/cell-editors/Number.js +1 -1
- package/es/components/Layout/index.d.ts +1 -1
- package/es/components/Layout/index.js +40 -7
- package/es/components/Layout/index.less +16 -16
- package/es/components/SiderTree/TreeNodeTitle.js +2 -2
- package/es/components/SiderTree/index.d.ts +2 -1
- package/es/components/SiderTree/index.js +34 -16
- package/es/components/SiderTree/index.less +2 -2
- package/package.json +2 -1
|
@@ -52,7 +52,7 @@ export default /*#__PURE__*/forwardRef(function NumberEditor(props, ref) {
|
|
|
52
52
|
setValue = _useState2[1];
|
|
53
53
|
|
|
54
54
|
var elm = useRef(null);
|
|
55
|
-
var dirty = useRef(
|
|
55
|
+
var dirty = useRef(!!props.charPress);
|
|
56
56
|
useEffect(function () {
|
|
57
57
|
if (elm.current === null) {
|
|
58
58
|
return;
|
|
@@ -24,6 +24,7 @@ import React, { useState } from 'react';
|
|
|
24
24
|
import classNames from 'classnames';
|
|
25
25
|
import { Spin, Tabs } from 'antd';
|
|
26
26
|
import { get } from 'lodash';
|
|
27
|
+
import { Resizable } from 'react-resizable';
|
|
27
28
|
import { mapChildren, prefixClassName } from "../utils";
|
|
28
29
|
var prefix = prefixClassName('layout');
|
|
29
30
|
|
|
@@ -32,16 +33,48 @@ var getKey = function getKey(tab) {
|
|
|
32
33
|
};
|
|
33
34
|
|
|
34
35
|
function Sider(props) {
|
|
36
|
+
var _classNames;
|
|
37
|
+
|
|
35
38
|
var children = props.children,
|
|
36
39
|
onCollapse = props.onCollapse;
|
|
37
40
|
|
|
38
|
-
var _useState = useState(
|
|
41
|
+
var _useState = useState(242),
|
|
39
42
|
_useState2 = _slicedToArray(_useState, 2),
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
width = _useState2[0],
|
|
44
|
+
setWidth = _useState2[1];
|
|
45
|
+
|
|
46
|
+
var _useState3 = useState(false),
|
|
47
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
48
|
+
collapsed = _useState4[0],
|
|
49
|
+
setCollapsed = _useState4[1];
|
|
50
|
+
|
|
51
|
+
var _useState5 = useState(false),
|
|
52
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
53
|
+
dragging = _useState6[0],
|
|
54
|
+
setDragging = _useState6[1];
|
|
55
|
+
|
|
56
|
+
var viewWidth = collapsed ? 0 : width;
|
|
57
|
+
return /*#__PURE__*/React.createElement(Resizable, {
|
|
58
|
+
axis: "x",
|
|
59
|
+
width: width,
|
|
60
|
+
height: 0,
|
|
61
|
+
onResizeStart: function onResizeStart() {
|
|
62
|
+
setDragging(true);
|
|
63
|
+
},
|
|
64
|
+
onResizeStop: function onResizeStop() {
|
|
65
|
+
setDragging(false);
|
|
66
|
+
},
|
|
67
|
+
onResize: function onResize(_, data) {
|
|
68
|
+
setWidth(data.size.width);
|
|
69
|
+
},
|
|
70
|
+
handle: /*#__PURE__*/React.createElement("div", {
|
|
71
|
+
className: prefix('left-resizable')
|
|
72
|
+
})
|
|
73
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
74
|
+
style: {
|
|
75
|
+
width: viewWidth
|
|
76
|
+
},
|
|
77
|
+
className: classNames(prefix('left'), (_classNames = {}, _defineProperty(_classNames, prefix("left-collapsed"), collapsed), _defineProperty(_classNames, prefix("left-resizing"), dragging), _classNames))
|
|
45
78
|
}, /*#__PURE__*/React.createElement("div", {
|
|
46
79
|
className: prefix("left-body")
|
|
47
80
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -94,7 +127,7 @@ function Sider(props) {
|
|
|
94
127
|
strokeLinejoin: "round",
|
|
95
128
|
strokeDasharray: "0,0",
|
|
96
129
|
transform: "translate(2.828427, 2.121320) rotate(-45.000000) translate(-2.828427, -2.121320) "
|
|
97
|
-
}))))))));
|
|
130
|
+
})))))))));
|
|
98
131
|
}
|
|
99
132
|
|
|
100
133
|
function Content(props) {
|
|
@@ -31,29 +31,33 @@
|
|
|
31
31
|
&-left {
|
|
32
32
|
position: relative;
|
|
33
33
|
|
|
34
|
+
&:not(&-resizing) {
|
|
35
|
+
transition: width 0.2s;
|
|
36
|
+
}
|
|
37
|
+
|
|
34
38
|
&-body {
|
|
35
|
-
width: 242px;
|
|
36
39
|
height: 100%;
|
|
37
40
|
overflow-x: hidden;
|
|
38
|
-
transition: width 0.2s;
|
|
39
41
|
}
|
|
40
42
|
|
|
41
43
|
&-content {
|
|
42
44
|
position: relative;
|
|
43
45
|
display: flex;
|
|
44
46
|
flex-direction: column;
|
|
45
|
-
width: 242px;
|
|
46
47
|
height: 100%;
|
|
48
|
+
}
|
|
47
49
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
50
|
+
&-resizable {
|
|
51
|
+
position: absolute;
|
|
52
|
+
top: 0;
|
|
53
|
+
right: -8px;
|
|
54
|
+
box-sizing: border-box;
|
|
55
|
+
width: 17px;
|
|
56
|
+
height: 100%;
|
|
57
|
+
padding: 0 8px;
|
|
58
|
+
background-color: #e6e6e6;
|
|
59
|
+
background-clip: content-box;
|
|
60
|
+
cursor: col-resize;
|
|
57
61
|
}
|
|
58
62
|
|
|
59
63
|
&-collapse {
|
|
@@ -82,10 +86,6 @@
|
|
|
82
86
|
}
|
|
83
87
|
}
|
|
84
88
|
|
|
85
|
-
&-collapsed &-body {
|
|
86
|
-
width: 0;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
89
|
&-collapsed &-collapse {
|
|
90
90
|
transform: rotateY(180deg);
|
|
91
91
|
}
|
|
@@ -76,7 +76,7 @@ export default function TreeNodeTitle(props) {
|
|
|
76
76
|
}, others || operation.onAdd ? /*#__PURE__*/React.createElement(Popover, {
|
|
77
77
|
overlayClassName: "".concat(prefixCls, "-menu-popover"),
|
|
78
78
|
placement: "bottomLeft",
|
|
79
|
-
|
|
79
|
+
open: visible,
|
|
80
80
|
trigger: "click",
|
|
81
81
|
content: /*#__PURE__*/React.createElement("div", {
|
|
82
82
|
onClick: function onClick() {
|
|
@@ -87,7 +87,7 @@ export default function TreeNodeTitle(props) {
|
|
|
87
87
|
return operation.onAdd(item);
|
|
88
88
|
}
|
|
89
89
|
}, "\u65B0\u589E")) : null, others),
|
|
90
|
-
|
|
90
|
+
onOpenChange: setVisible
|
|
91
91
|
}, /*#__PURE__*/React.createElement("div", {
|
|
92
92
|
className: classNames("".concat(prefixCls, "-title-operators-item"), _defineProperty({}, "".concat(prefixCls, "-title-operators-item-active"), visible)),
|
|
93
93
|
onClick: function onClick() {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
import { type TabsProps, type TreeProps } from 'antd';
|
|
3
3
|
import type { TreeData, OperationType } from './typings';
|
|
4
|
-
interface Props<KeyType> extends Omit<TreeProps, 'onSelect' | 'selectedKeys' | 'defaultSelectedKeys' | 'defaultExpandAll' | 'defaultExpandedKeys' | 'prefixCls'> {
|
|
4
|
+
interface Props<KeyType> extends Omit<TreeProps, 'onSelect' | 'selectedKeys' | 'defaultSelectedKeys' | 'defaultExpandAll' | 'defaultExpandedKeys' | 'prefixCls' | 'height'> {
|
|
5
5
|
data?: TreeData<KeyType>[];
|
|
6
6
|
showSearch?: boolean;
|
|
7
7
|
placeholder?: string;
|
|
@@ -15,6 +15,7 @@ interface Props<KeyType> extends Omit<TreeProps, 'onSelect' | 'selectedKeys' | '
|
|
|
15
15
|
defaultExpandAll?: boolean;
|
|
16
16
|
defaultExpandedKeys?: KeyType[];
|
|
17
17
|
active?: boolean;
|
|
18
|
+
height?: number | 'auto';
|
|
18
19
|
}
|
|
19
20
|
declare function SiderTreeTabs(props: {
|
|
20
21
|
tabs: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
var _excluded = ["tabs", "children"],
|
|
2
|
-
_excluded2 = ["data", "showSearch", "placeholder", "onSelect", "filterNode", "operation", "header", "footer"];
|
|
2
|
+
_excluded2 = ["data", "showSearch", "placeholder", "onSelect", "filterNode", "operation", "header", "footer", "height"];
|
|
3
3
|
|
|
4
4
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
5
5
|
|
|
@@ -29,11 +29,12 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
29
29
|
|
|
30
30
|
import React, { useMemo, useState } from 'react';
|
|
31
31
|
import { useDebounce } from '@lemon-fe/hooks';
|
|
32
|
+
import ResizeObserver from 'rc-resize-observer';
|
|
32
33
|
import { Input, Tabs, Tree } from 'antd';
|
|
33
34
|
import { PREFIX_CLS } from "../../constants";
|
|
34
35
|
import TreeNodeTitle from "./TreeNodeTitle";
|
|
35
36
|
import Icons from "../Icons";
|
|
36
|
-
import { mapChildren } from "../utils";
|
|
37
|
+
import { mapChildren, prefixClassName } from "../utils";
|
|
37
38
|
import empty from "./empty.png";
|
|
38
39
|
|
|
39
40
|
function SiderTreeTabs(props) {
|
|
@@ -57,6 +58,7 @@ function SiderTreeTabs(props) {
|
|
|
57
58
|
}));
|
|
58
59
|
}
|
|
59
60
|
|
|
61
|
+
var prefix = prefixClassName('tree');
|
|
60
62
|
export default function SiderTree(props) {
|
|
61
63
|
var _props$data = props.data,
|
|
62
64
|
mData = _props$data === void 0 ? [] : _props$data,
|
|
@@ -67,15 +69,19 @@ export default function SiderTree(props) {
|
|
|
67
69
|
operation = props.operation,
|
|
68
70
|
header = props.header,
|
|
69
71
|
footer = props.footer,
|
|
72
|
+
heightProp = props.height,
|
|
70
73
|
restProps = _objectWithoutProperties(props, _excluded2);
|
|
71
74
|
|
|
72
|
-
var prefixCls = "".concat(PREFIX_CLS, "-tree");
|
|
73
|
-
|
|
74
75
|
var _useState = useState(''),
|
|
75
76
|
_useState2 = _slicedToArray(_useState, 2),
|
|
76
77
|
keywords = _useState2[0],
|
|
77
78
|
setKeywords = _useState2[1];
|
|
78
79
|
|
|
80
|
+
var _useState3 = useState(heightProp !== 'auto' ? heightProp : 0),
|
|
81
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
82
|
+
height = _useState4[0],
|
|
83
|
+
setHeight = _useState4[1];
|
|
84
|
+
|
|
79
85
|
var tree = useMemo(function () {
|
|
80
86
|
var list = mData;
|
|
81
87
|
|
|
@@ -98,7 +104,7 @@ export default function SiderTree(props) {
|
|
|
98
104
|
title: /*#__PURE__*/React.createElement(TreeNodeTitle, {
|
|
99
105
|
operation: operation,
|
|
100
106
|
node: item,
|
|
101
|
-
prefixCls:
|
|
107
|
+
prefixCls: prefix()
|
|
102
108
|
})
|
|
103
109
|
}];
|
|
104
110
|
}));
|
|
@@ -141,25 +147,21 @@ export default function SiderTree(props) {
|
|
|
141
147
|
});
|
|
142
148
|
}
|
|
143
149
|
|
|
144
|
-
|
|
145
|
-
className:
|
|
146
|
-
}, !!mHeader && /*#__PURE__*/React.createElement("div", {
|
|
147
|
-
className: "".concat(prefixCls, "-header")
|
|
148
|
-
}, mHeader), /*#__PURE__*/React.createElement("div", {
|
|
149
|
-
className: "".concat(prefixCls, "-body")
|
|
150
|
-
}, tree.length <= 0 ? /*#__PURE__*/React.createElement("div", {
|
|
151
|
-
className: "".concat(prefixCls, "-empty")
|
|
150
|
+
var bodyContent = tree.length <= 0 ? /*#__PURE__*/React.createElement("div", {
|
|
151
|
+
className: prefix('empty')
|
|
152
152
|
}, /*#__PURE__*/React.createElement("img", {
|
|
153
153
|
src: empty
|
|
154
154
|
}), /*#__PURE__*/React.createElement("div", null, "\u6682\u65E0\u6570\u636E")) : /*#__PURE__*/React.createElement(Tree, _extends({
|
|
155
155
|
treeData: tree,
|
|
156
156
|
itemHeight: 28,
|
|
157
157
|
showLine: true,
|
|
158
|
-
|
|
158
|
+
height: height,
|
|
159
|
+
onSelect: function onSelect(_, info) {
|
|
159
160
|
if (_onSelect) {
|
|
160
161
|
_onSelect(info.node.data, info);
|
|
161
162
|
}
|
|
162
163
|
},
|
|
164
|
+
blockNode: true,
|
|
163
165
|
switcherIcon: function switcherIcon(_ref) {
|
|
164
166
|
var expanded = _ref.expanded,
|
|
165
167
|
isLeaf = _ref.isLeaf;
|
|
@@ -213,8 +215,24 @@ export default function SiderTree(props) {
|
|
|
213
215
|
d: "M7 3v7H6V3z"
|
|
214
216
|
})));
|
|
215
217
|
}
|
|
216
|
-
}, restProps))
|
|
217
|
-
|
|
218
|
+
}, restProps));
|
|
219
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
220
|
+
className: prefix('wrapper')
|
|
221
|
+
}, !!mHeader && /*#__PURE__*/React.createElement("div", {
|
|
222
|
+
className: prefix('header')
|
|
223
|
+
}, mHeader), heightProp === 'auto' ? /*#__PURE__*/React.createElement(ResizeObserver, {
|
|
224
|
+
onResize: function onResize(e) {
|
|
225
|
+
return setHeight(e.height);
|
|
226
|
+
}
|
|
227
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
228
|
+
className: prefix('body'),
|
|
229
|
+
style: {
|
|
230
|
+
flex: 1
|
|
231
|
+
}
|
|
232
|
+
}, bodyContent)) : /*#__PURE__*/React.createElement("div", {
|
|
233
|
+
className: prefix('body')
|
|
234
|
+
}, bodyContent), !!footer && /*#__PURE__*/React.createElement("div", {
|
|
235
|
+
className: prefix('footer')
|
|
218
236
|
}, footer));
|
|
219
237
|
}
|
|
220
238
|
SiderTree.Tabs = SiderTreeTabs;
|
|
@@ -74,7 +74,6 @@
|
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
&-treenode {
|
|
77
|
-
display: flex;
|
|
78
77
|
align-items: center;
|
|
79
78
|
height: @treeNodeHeight;
|
|
80
79
|
padding-bottom: 0;
|
|
@@ -98,14 +97,15 @@
|
|
|
98
97
|
align-items: center;
|
|
99
98
|
min-width: 0;
|
|
100
99
|
padding: 0;
|
|
100
|
+
overflow-x: hidden;
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
&-switcher {
|
|
104
104
|
position: relative;
|
|
105
105
|
display: flex;
|
|
106
106
|
flex: none;
|
|
107
|
-
justify-content: center;
|
|
108
107
|
align-items: center;
|
|
108
|
+
justify-content: center;
|
|
109
109
|
width: @indentWidth;
|
|
110
110
|
height: @treeNodeHeight;
|
|
111
111
|
margin: 0;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lemon-fe/kits",
|
|
3
|
-
"version": "1.0.0-
|
|
3
|
+
"version": "1.0.0-106",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"start": "dumi dev",
|
|
6
6
|
"docs:build": "dumi build",
|
|
@@ -73,6 +73,7 @@
|
|
|
73
73
|
"@types/react": "^18.0.18",
|
|
74
74
|
"@types/react-color": "^3.0.6",
|
|
75
75
|
"@types/react-dom": "^18.0.6",
|
|
76
|
+
"@types/react-resizable": "^3.0.4",
|
|
76
77
|
"@types/react-router": "^5.0.0",
|
|
77
78
|
"@types/react-router-dom": "^5.0.0",
|
|
78
79
|
"@types/shallowequal": "^1.1.1",
|