@lemon-fe/kits 1.0.0-15 → 1.0.0-18
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.
|
@@ -8,7 +8,7 @@ export declare type PathType = string | (string | number)[];
|
|
|
8
8
|
export declare type ValidateRule<T> = Pick<RuleItem, 'required' | 'message' | 'pattern' | 'min' | 'max' | 'len' | 'type'> & {
|
|
9
9
|
validator?: (rule: any, val: any, record: T) => void | Promise<void>;
|
|
10
10
|
};
|
|
11
|
-
export declare type EditableRender<T> = (val:
|
|
11
|
+
export declare type EditableRender<T, K = any> = (val: K, record: T, index: number, params: {
|
|
12
12
|
context: any;
|
|
13
13
|
ref: RefObject<{
|
|
14
14
|
select?: () => void;
|
|
@@ -16,7 +16,7 @@ export declare type EditableRender<T> = (val: any, record: T, index: number, par
|
|
|
16
16
|
blur?: () => void;
|
|
17
17
|
}>;
|
|
18
18
|
onChange: (val: Partial<T>, action?: 'stop' | 'next') => void;
|
|
19
|
-
} & ICellEditorParams) => ReactNode;
|
|
19
|
+
} & ICellEditorParams<T, K>) => ReactNode;
|
|
20
20
|
export interface ColumnType<TData> extends Omit<ColDef<TData>, 'editable'> {
|
|
21
21
|
title?: ReactNode | ((params: IHeaderParams) => ReactNode);
|
|
22
22
|
dataIndex?: PathType;
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import { TreeProps } from '
|
|
3
|
-
import type { DataNode, EventDataNode } from 'rc-tree/lib/interface';
|
|
4
|
-
import { TabsProps } from 'antd';
|
|
2
|
+
import { type TabsProps, type TreeProps } from 'antd';
|
|
5
3
|
import type { TreeData, OperationType } from './typings';
|
|
6
4
|
interface Props<KeyType> extends Omit<TreeProps, 'onSelect' | 'selectedKeys' | 'defaultSelectedKeys' | 'defaultExpandAll' | 'defaultExpandedKeys' | 'prefixCls'> {
|
|
7
5
|
data?: TreeData<KeyType>[];
|
|
@@ -10,13 +8,7 @@ interface Props<KeyType> extends Omit<TreeProps, 'onSelect' | 'selectedKeys' | '
|
|
|
10
8
|
header?: ReactNode;
|
|
11
9
|
footer?: ReactNode;
|
|
12
10
|
operation?: OperationType<KeyType>;
|
|
13
|
-
onSelect?: (node: TreeData<KeyType>, info:
|
|
14
|
-
event: 'select';
|
|
15
|
-
selected: boolean;
|
|
16
|
-
node: EventDataNode<DataNode>;
|
|
17
|
-
selectedNodes: DataNode[];
|
|
18
|
-
nativeEvent: MouseEvent;
|
|
19
|
-
}) => void;
|
|
11
|
+
onSelect?: (node: TreeData<KeyType>, info: Parameters<Exclude<TreeProps['onSelect'], undefined>>[1]) => void;
|
|
20
12
|
selectedKeys?: KeyType[];
|
|
21
13
|
defaultSelectedKeys?: KeyType[];
|
|
22
14
|
defaultExpandAll?: boolean;
|
|
@@ -29,8 +29,7 @@ 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 Tree from '
|
|
33
|
-
import { Input, Tabs } from 'antd';
|
|
32
|
+
import { Input, Tabs, Tree } from 'antd';
|
|
34
33
|
import { PREFIX_CLS } from "../../constants";
|
|
35
34
|
import TreeNodeTitle from "./TreeNodeTitle";
|
|
36
35
|
import Icons from "../Icons";
|
|
@@ -149,8 +148,7 @@ export default function SiderTree(props) {
|
|
|
149
148
|
src: empty
|
|
150
149
|
}), /*#__PURE__*/React.createElement("div", null, "\u6682\u65E0\u6570\u636E")) : /*#__PURE__*/React.createElement(Tree, _extends({
|
|
151
150
|
treeData: tree,
|
|
152
|
-
|
|
153
|
-
itemHeight: 40,
|
|
151
|
+
itemHeight: 28,
|
|
154
152
|
showLine: true,
|
|
155
153
|
onSelect: function onSelect(selectedKeys, info) {
|
|
156
154
|
if (_onSelect) {
|
|
@@ -8,15 +8,6 @@
|
|
|
8
8
|
box-sizing: border-box;
|
|
9
9
|
height: 100%;
|
|
10
10
|
padding: @space-v 0;
|
|
11
|
-
|
|
12
|
-
.@{prefixCls}-tree-list-scrollbar {
|
|
13
|
-
display: block !important;
|
|
14
|
-
right: -16px !important;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
.@{prefixCls}-tree-list-scrollbar-thumb {
|
|
18
|
-
background: #ddd !important;
|
|
19
|
-
}
|
|
20
11
|
}
|
|
21
12
|
|
|
22
13
|
&-menu-popover {
|
|
@@ -66,134 +57,126 @@
|
|
|
66
57
|
|
|
67
58
|
&-body {
|
|
68
59
|
min-height: 0;
|
|
69
|
-
padding: 0 @space-h;
|
|
70
60
|
overflow: auto;
|
|
71
|
-
|
|
72
61
|
.scrollBar(8px);
|
|
73
|
-
}
|
|
74
62
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
63
|
+
.@{ant-prefix}-tree {
|
|
64
|
+
&-list-holder-inner {
|
|
65
|
+
align-items: stretch;
|
|
66
|
+
}
|
|
78
67
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
68
|
+
&-list {
|
|
69
|
+
padding: 0 @space-h;
|
|
70
|
+
}
|
|
82
71
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
}
|
|
72
|
+
&-list-scrollbar-thumb {
|
|
73
|
+
background: #ddd !important;
|
|
74
|
+
}
|
|
87
75
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
76
|
+
&-treenode {
|
|
77
|
+
display: flex;
|
|
78
|
+
align-items: center;
|
|
79
|
+
height: @treeNodeHeight;
|
|
80
|
+
padding-bottom: 0;
|
|
81
|
+
}
|
|
93
82
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
83
|
+
&-indent {
|
|
84
|
+
align-self: stretch;
|
|
85
|
+
white-space: nowrap;
|
|
86
|
+
user-select: none;
|
|
98
87
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
88
|
+
&-unit {
|
|
89
|
+
display: inline-block;
|
|
90
|
+
width: @indentWidth;
|
|
91
|
+
vertical-align: top;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
105
94
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
95
|
+
&-node-content-wrapper {
|
|
96
|
+
display: flex;
|
|
97
|
+
flex: 1;
|
|
98
|
+
align-items: center;
|
|
99
|
+
min-width: 0;
|
|
100
|
+
padding: 0;
|
|
101
|
+
}
|
|
109
102
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
103
|
+
&-switcher {
|
|
104
|
+
position: relative;
|
|
105
|
+
display: flex;
|
|
106
|
+
flex: none;
|
|
107
|
+
justify-content: center;
|
|
108
|
+
align-items: center;
|
|
109
|
+
width: @indentWidth;
|
|
110
|
+
height: @treeNodeHeight;
|
|
111
|
+
margin: 0;
|
|
112
|
+
cursor: pointer;
|
|
113
|
+
user-select: none;
|
|
119
114
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
width: @indentWidth;
|
|
126
|
-
margin: 0;
|
|
127
|
-
line-height: @treeNodeHeight;
|
|
128
|
-
text-align: center;
|
|
129
|
-
cursor: pointer;
|
|
130
|
-
user-select: none;
|
|
115
|
+
& svg {
|
|
116
|
+
width: 13px;
|
|
117
|
+
height: 13px;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
131
120
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
121
|
+
&-title {
|
|
122
|
+
display: flex;
|
|
123
|
+
flex: 1;
|
|
124
|
+
align-items: center;
|
|
125
|
+
justify-content: space-between;
|
|
126
|
+
min-width: 56px;
|
|
127
|
+
padding: 0 8px;
|
|
128
|
+
border-radius: 4px;
|
|
129
|
+
cursor: pointer;
|
|
130
|
+
transition: background-color 0.2s;
|
|
131
|
+
}
|
|
136
132
|
|
|
137
|
-
|
|
138
|
-
|
|
133
|
+
&-node-selected {
|
|
134
|
+
color: @primary-color;
|
|
135
|
+
background: .primary(0.1) [] !important;
|
|
136
|
+
}
|
|
139
137
|
}
|
|
140
138
|
}
|
|
141
139
|
|
|
142
|
-
&-
|
|
143
|
-
display:
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
140
|
+
&-title-content {
|
|
141
|
+
display: block;
|
|
142
|
+
height: @treeNodeHeight;
|
|
143
|
+
overflow: hidden;
|
|
144
|
+
line-height: @treeNodeHeight;
|
|
145
|
+
white-space: nowrap;
|
|
146
|
+
text-overflow: ellipsis;
|
|
147
147
|
}
|
|
148
148
|
|
|
149
|
-
&-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
149
|
+
&-title-operators {
|
|
150
|
+
&-item {
|
|
151
|
+
width: 20px;
|
|
152
|
+
height: 20px;
|
|
153
|
+
margin-left: 4px;
|
|
154
|
+
line-height: 1;
|
|
155
|
+
text-align: center;
|
|
156
|
+
border-radius: 4px;
|
|
153
157
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
align-items: center;
|
|
158
|
-
justify-content: space-between;
|
|
159
|
-
min-width: 56px;
|
|
160
|
-
padding: 0 8px;
|
|
161
|
-
border-radius: 4px;
|
|
162
|
-
cursor: pointer;
|
|
163
|
-
transition: background-color 0.2s;
|
|
164
|
-
|
|
165
|
-
&:hover {
|
|
166
|
-
background-color: #ededed;
|
|
167
|
-
}
|
|
158
|
+
& svg {
|
|
159
|
+
vertical-align: middle;
|
|
160
|
+
}
|
|
168
161
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
line-height: @treeNodeHeight;
|
|
174
|
-
white-space: nowrap;
|
|
175
|
-
text-overflow: ellipsis;
|
|
162
|
+
&-active,
|
|
163
|
+
&:hover {
|
|
164
|
+
background: #d7d7d7;
|
|
165
|
+
}
|
|
176
166
|
}
|
|
167
|
+
}
|
|
177
168
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
height: 20px;
|
|
182
|
-
margin-left: 4px;
|
|
183
|
-
line-height: 1;
|
|
184
|
-
text-align: center;
|
|
185
|
-
border-radius: 4px;
|
|
169
|
+
&-header + &-body {
|
|
170
|
+
margin-top: 12px;
|
|
171
|
+
}
|
|
186
172
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
173
|
+
&-header + .@{ant-prefix}-tabs {
|
|
174
|
+
margin-top: 8px;
|
|
175
|
+
}
|
|
190
176
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
}
|
|
177
|
+
&-footer {
|
|
178
|
+
margin-top: 12px;
|
|
179
|
+
padding: 0 12px;
|
|
197
180
|
}
|
|
198
181
|
|
|
199
182
|
&-empty {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { DataNode } from 'antd/es/tree';
|
|
2
2
|
import type { ReactNode } from 'react';
|
|
3
3
|
|
|
4
|
-
export interface TreeData<T> extends Pick<
|
|
4
|
+
export interface TreeData<T = string | number> extends Pick<DataNode, 'icon'> {
|
|
5
5
|
key: T;
|
|
6
6
|
title: string | number;
|
|
7
7
|
parent?: T;
|
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-18",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"start": "dumi dev",
|
|
6
6
|
"docs:build": "dumi build",
|
|
@@ -47,7 +47,6 @@
|
|
|
47
47
|
"lodash": "^4.17.0",
|
|
48
48
|
"moment": "^2.29.4",
|
|
49
49
|
"rc-resize-observer": "^1.0.0",
|
|
50
|
-
"rc-tree": "^5.7.0",
|
|
51
50
|
"react-color": "^2.19.3",
|
|
52
51
|
"react-gcolor-picker": "^1.2.4",
|
|
53
52
|
"react-resizable": "^3.0.4",
|