@aloudata/aloudata-design 1.9.16 → 1.10.0
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/dist/Button/style/type.less +1 -1
- package/dist/Checkbox/style/index.less +35 -9
- package/dist/ConfigProvider/getUserList.d.ts +13 -1
- package/dist/ConfigProvider/getUserList.js +5 -0
- package/dist/Icon/components/AlertTriangleDuotone.d.ts +3 -2
- package/dist/Icon/components/AlertTriangleDuotone.js +3 -3
- package/dist/Icon/components/CancelCircleDuotone.d.ts +3 -2
- package/dist/Icon/components/CancelCircleDuotone.js +4 -4
- package/dist/Icon/components/CheckCircleDuotone.d.ts +3 -2
- package/dist/Icon/components/CheckCircleDuotone.js +4 -4
- package/dist/Icon/components/ChevronDownLine.d.ts +3 -2
- package/dist/Icon/components/ChevronDownLine.js +3 -3
- package/dist/Icon/components/ChevronLeftLine.d.ts +3 -2
- package/dist/Icon/components/ChevronLeftLine.js +3 -3
- package/dist/Icon/components/ChevronRightLine.d.ts +3 -2
- package/dist/Icon/components/ChevronRightLine.js +3 -3
- package/dist/Icon/components/CloseLLine.d.ts +3 -2
- package/dist/Icon/components/CloseLLine.js +4 -4
- package/dist/Icon/components/CloseMLine.d.ts +3 -2
- package/dist/Icon/components/CloseMLine.js +3 -3
- package/dist/Icon/components/DragLine.d.ts +11 -0
- package/dist/Icon/components/DragLine.js +35 -0
- package/dist/Icon/components/EyeOffLine.d.ts +3 -2
- package/dist/Icon/components/EyeOffLine.js +3 -3
- package/dist/Icon/components/EyeOnLine.d.ts +3 -2
- package/dist/Icon/components/EyeOnLine.js +3 -3
- package/dist/Icon/components/FoldDownFill.d.ts +3 -2
- package/dist/Icon/components/FoldDownFill.js +4 -4
- package/dist/Icon/components/FoldUpFill.d.ts +3 -2
- package/dist/Icon/components/FoldUpFill.js +4 -4
- package/dist/Icon/components/InfoCircleDuotone.d.ts +3 -2
- package/dist/Icon/components/InfoCircleDuotone.js +3 -3
- package/dist/Icon/components/InfoCircleLine.d.ts +3 -2
- package/dist/Icon/components/InfoCircleLine.js +3 -3
- package/dist/Icon/components/LoadingLine.d.ts +3 -2
- package/dist/Icon/components/LoadingLine.js +3 -3
- package/dist/Icon/components/MoreVerticalLine.d.ts +3 -2
- package/dist/Icon/components/MoreVerticalLine.js +3 -3
- package/dist/Icon/components/SearchLine.d.ts +3 -2
- package/dist/Icon/components/SearchLine.js +3 -3
- package/dist/Icon/index.d.ts +1 -0
- package/dist/Icon/index.js +1 -0
- package/dist/Icon/svg/drag-line.svg +5 -0
- package/dist/MemberPicker/components/MemberSelection.d.ts +1 -1
- package/dist/MemberPicker/components/MemberSelection.js +8 -3
- package/dist/MemberPicker/components/MultipleOption.d.ts +5 -2
- package/dist/MemberPicker/components/MultipleOption.js +20 -5
- package/dist/MemberPicker/components/NickLabel.d.ts +3 -3
- package/dist/MemberPicker/components/NickLabel.js +6 -6
- package/dist/MemberPicker/components/Panel.d.ts +7 -4
- package/dist/MemberPicker/components/Panel.js +70 -20
- package/dist/MemberPicker/components/PanelWrapper.d.ts +14 -0
- package/dist/MemberPicker/components/PanelWrapper.js +126 -0
- package/dist/MemberPicker/components/SelectedMemberTags.d.ts +3 -2
- package/dist/MemberPicker/components/SelectedMemberTags.js +8 -5
- package/dist/MemberPicker/components/SelectorFooter.js +1 -1
- package/dist/MemberPicker/components/SingleOption.d.ts +3 -2
- package/dist/MemberPicker/components/SingleOption.js +7 -4
- package/dist/MemberPicker/components/UserGroupSelection.d.ts +14 -0
- package/dist/MemberPicker/components/UserGroupSelection.js +130 -0
- package/dist/MemberPicker/index.d.ts +2 -0
- package/dist/MemberPicker/index.js +28 -17
- package/dist/MemberPicker/interface.d.ts +11 -5
- package/dist/MemberPicker/interface.js +6 -1
- package/dist/MemberPicker/style/index.less +18 -3
- package/dist/MemberPicker/utils/getUsersWithUserId.d.ts +4 -0
- package/dist/MemberPicker/utils/getUsersWithUserId.js +23 -2
- package/dist/MemberPicker/utils/index.d.ts +6 -0
- package/dist/MemberPicker/utils/index.js +16 -0
- package/dist/Modal/index.js +1 -1
- package/dist/Radio/style/index.less +1 -1
- package/dist/ScrollArea/index.d.ts +1 -0
- package/dist/ScrollArea/index.js +6 -3
- package/dist/Table/components/Cell.d.ts +7 -0
- package/dist/Table/components/Cell.js +20 -0
- package/dist/Table/components/Header.d.ts +6 -0
- package/dist/Table/components/Header.js +19 -0
- package/dist/{AldTable → Table}/helper.d.ts +9 -2
- package/dist/Table/helper.js +121 -0
- package/dist/Table/hooks/useScroll.d.ts +26 -0
- package/dist/Table/hooks/useScroll.js +57 -0
- package/dist/Table/index.d.ts +3 -1
- package/dist/Table/index.js +176 -1
- package/dist/Table/style/index.less +106 -203
- package/dist/{AldTable → Table}/types.d.ts +5 -4
- package/dist/Tree/DirectoryTree.d.ts +20 -0
- package/dist/Tree/DirectoryTree.js +175 -0
- package/dist/Tree/Tree.d.ts +136 -0
- package/dist/Tree/Tree.js +130 -0
- package/dist/Tree/demo/basic/index.js +3 -2
- package/dist/Tree/demo/drag/index.d.ts +3 -0
- package/dist/Tree/demo/drag/index.js +52 -0
- package/dist/Tree/index.d.ts +19 -13
- package/dist/Tree/index.js +7 -17
- package/dist/Tree/style/checkbox.less +226 -0
- package/dist/Tree/style/directory.less +68 -0
- package/dist/Tree/style/index.less +68 -29
- package/dist/Tree/style/mixin.less +333 -0
- package/dist/Tree/style/reset.less +11 -0
- package/dist/Tree/style/rtl.less +68 -0
- package/dist/Tree/style/var.less +42 -0
- package/dist/Tree/utils/dictUtil.d.ts +9 -0
- package/dist/Tree/utils/dictUtil.js +74 -0
- package/dist/Tree/utils/dropIndicator.d.ts +9 -0
- package/dist/Tree/utils/dropIndicator.js +35 -0
- package/dist/Tree/utils/iconUtil.d.ts +5 -0
- package/dist/Tree/utils/iconUtil.js +63 -0
- package/dist/_utils/motion.d.ts +8 -0
- package/dist/_utils/motion.js +52 -0
- package/dist/_utils/reactNode.d.ts +8 -0
- package/dist/_utils/reactNode.js +15 -0
- package/dist/_utils/type.d.ts +9 -0
- package/dist/_utils/type.js +20 -0
- package/dist/index.d.ts +11 -13
- package/dist/index.js +6 -7
- package/dist/style/color/bezierEasing.less +110 -0
- package/dist/style/color/colorPalette.less +84 -0
- package/dist/style/color/colors.less +162 -0
- package/dist/style/color/tinyColor.less +1184 -0
- package/dist/style/core/index.less +2 -0
- package/dist/style/core/motion/fade.less +34 -0
- package/dist/style/core/motion/move.less +129 -0
- package/dist/style/core/motion/other.less +48 -0
- package/dist/style/core/motion/slide.less +131 -0
- package/dist/style/core/motion/zoom.less +179 -0
- package/dist/style/core/motion.less +22 -0
- package/dist/style/index.less +2 -0
- package/dist/style/mixins/index.less +1 -0
- package/dist/style/mixins/motion.less +33 -0
- package/dist/style/themes/default/default.less +24 -0
- package/dist/style/themes/default/index.less +1 -0
- package/package.json +2 -2
- package/dist/AldTable/helper.js +0 -109
- package/dist/AldTable/index.d.ts +0 -4
- package/dist/AldTable/index.js +0 -146
- package/dist/AldTable/style/index.d.ts +0 -2
- package/dist/AldTable/style/index.js +0 -2
- package/dist/AldTable/style/index.less +0 -135
- package/dist/Table/Table.d.ts +0 -6
- package/dist/Table/Table.js +0 -360
- package/dist/Table/components/Empty/index.d.ts +0 -3
- package/dist/Table/components/Empty/index.js +0 -14
- package/dist/Table/components/Loading/index.d.ts +0 -3
- package/dist/Table/components/Loading/index.js +0 -12
- package/dist/Table/components/TableBodyRowList/index.d.ts +0 -13
- package/dist/Table/components/TableBodyRowList/index.js +0 -75
- package/dist/Table/components/TableHead/index.d.ts +0 -23
- package/dist/Table/components/TableHead/index.js +0 -229
- package/dist/Table/constant.d.ts +0 -0
- package/dist/Table/constant.js +0 -0
- package/dist/Table/hooks/useFrame.d.ts +0 -7
- package/dist/Table/hooks/useFrame.js +0 -75
- package/dist/Table/interface.d.ts +0 -42
- package/dist/Table/interface.js +0 -1
- package/dist/Table/react-table-config.d.ts +0 -122
- package/dist/Table/style/variable.less +0 -4
- package/dist/Table/utils.d.ts +0 -15
- package/dist/Table/utils.js +0 -122
- /package/dist/{AldTable → Table}/types.js +0 -0
|
@@ -1,252 +1,155 @@
|
|
|
1
|
-
/* stylelint-disable property-no-unknown */
|
|
2
|
-
|
|
3
1
|
@import '../../style/index.less';
|
|
4
|
-
@import '../../
|
|
5
|
-
@import '../../
|
|
6
|
-
@import '
|
|
2
|
+
@import '../../Pagination/style/index.less';
|
|
3
|
+
@import '../../Spin/style/index.less';
|
|
4
|
+
@import '../../ScrollArea/style/index.less';
|
|
7
5
|
|
|
8
|
-
.ald-table {
|
|
6
|
+
.ald-table-container {
|
|
7
|
+
position: relative;
|
|
9
8
|
display: flex;
|
|
10
9
|
flex-direction: column;
|
|
11
10
|
width: 100%;
|
|
12
|
-
|
|
11
|
+
}
|
|
13
12
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
.ald-table-main {
|
|
14
|
+
width: 100%;
|
|
15
|
+
color: #171717;
|
|
16
|
+
font-size: 13px;
|
|
17
|
+
line-height: 20px;
|
|
18
|
+
background: #fff;
|
|
17
19
|
|
|
18
|
-
|
|
20
|
+
.ald-table-content {
|
|
19
21
|
display: flex;
|
|
20
|
-
flex: 1;
|
|
21
22
|
flex-direction: column;
|
|
22
|
-
|
|
23
|
+
border-spacing: 0;
|
|
23
24
|
}
|
|
24
25
|
|
|
25
|
-
|
|
26
|
-
|
|
26
|
+
.ald-table-resizer {
|
|
27
|
+
position: absolute;
|
|
28
|
+
right: 0;
|
|
29
|
+
top: 0;
|
|
27
30
|
height: 100%;
|
|
28
|
-
|
|
31
|
+
width: 5px;
|
|
32
|
+
cursor: col-resize;
|
|
33
|
+
user-select: none;
|
|
34
|
+
touch-action: none;
|
|
35
|
+
|
|
36
|
+
&::after {
|
|
37
|
+
content: '';
|
|
38
|
+
display: block;
|
|
39
|
+
height: 20px;
|
|
40
|
+
width: 2px;
|
|
41
|
+
position: absolute;
|
|
42
|
+
top: 50%;
|
|
43
|
+
right: -1px;
|
|
44
|
+
transform: translateY(-50%);
|
|
45
|
+
background-color: #e8e8e8;
|
|
46
|
+
}
|
|
29
47
|
}
|
|
30
48
|
|
|
31
|
-
|
|
32
|
-
display: flex;
|
|
33
|
-
width: 100%;
|
|
49
|
+
.ald-table-overflow-x {
|
|
34
50
|
overflow-x: hidden;
|
|
35
51
|
}
|
|
36
52
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
height: unset;
|
|
40
|
-
color: inherit;
|
|
41
|
-
text-align: left;
|
|
42
|
-
word-break: break-all;
|
|
43
|
-
border-bottom: 1px solid @BG80;
|
|
44
|
-
|
|
45
|
-
&-content {
|
|
46
|
-
flex: 1;
|
|
47
|
-
}
|
|
53
|
+
.ald-table-tr {
|
|
54
|
+
display: flex;
|
|
48
55
|
}
|
|
49
56
|
|
|
50
|
-
|
|
51
|
-
|
|
57
|
+
.ald-table-th,
|
|
58
|
+
.ald-table-td {
|
|
59
|
+
position: relative;
|
|
60
|
+
border-bottom: 1px solid #e8e8e8;
|
|
61
|
+
flex: 0 0 auto;
|
|
62
|
+
}
|
|
52
63
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
white-space: nowrap;
|
|
57
|
-
text-overflow: ellipsis;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
64
|
+
.ald-table-th {
|
|
65
|
+
border-bottom: 1px solid #e8e8e8;
|
|
66
|
+
background-color: #fff;
|
|
60
67
|
}
|
|
61
68
|
|
|
62
|
-
|
|
63
|
-
|
|
69
|
+
.ald-table-th-default {
|
|
70
|
+
font-weight: 500;
|
|
71
|
+
padding: 6px 12px;
|
|
64
72
|
overflow: hidden;
|
|
65
|
-
font-size: 13px;
|
|
66
|
-
font-weight: 600;
|
|
67
|
-
background-color: @BG80;
|
|
68
|
-
mix-blend-mode: multiply;
|
|
69
|
-
user-select: none;
|
|
70
|
-
|
|
71
|
-
.ald-table-row {
|
|
72
|
-
min-width: 9999px; // 防止拖动时的闪动
|
|
73
|
-
height: @table-head-row-height;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
.ald-table-cell {
|
|
77
|
-
position: relative;
|
|
78
|
-
padding: 6px 16px;
|
|
79
|
-
color: @NL0;
|
|
80
|
-
line-height: 20px;
|
|
81
|
-
height: 100%;
|
|
82
|
-
|
|
83
|
-
.ald-table-cell-content {
|
|
84
|
-
overflow: hidden;
|
|
85
|
-
white-space: nowrap;
|
|
86
|
-
text-overflow: ellipsis;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
.ald-table-bar {
|
|
90
|
-
position: absolute;
|
|
91
|
-
top: 50%;
|
|
92
|
-
right: -12px;
|
|
93
|
-
z-index: 1;
|
|
94
|
-
display: inline-block;
|
|
95
|
-
width: 12px;
|
|
96
|
-
height: 1em;
|
|
97
|
-
transform: translateY(-50%);
|
|
98
|
-
touch-action: none;
|
|
99
|
-
|
|
100
|
-
&::after {
|
|
101
|
-
display: block;
|
|
102
|
-
width: 1px;
|
|
103
|
-
height: 100%;
|
|
104
|
-
background-color: @BG70;
|
|
105
|
-
mix-blend-mode: multiply;
|
|
106
|
-
content: '';
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
&:last-child {
|
|
111
|
-
.ald-table-bar {
|
|
112
|
-
display: none;
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
73
|
}
|
|
117
74
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
75
|
+
.ald-table-td-default {
|
|
76
|
+
padding: 0 12px;
|
|
77
|
+
display: flex;
|
|
78
|
+
align-items: center;
|
|
79
|
+
height: 100%;
|
|
121
80
|
font-size: 13px;
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
display: flex;
|
|
125
|
-
justify-content: center;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
.ald-table-row {
|
|
129
|
-
height: @table-body-row-height;
|
|
130
|
-
|
|
131
|
-
.ald-table-cell {
|
|
132
|
-
display: flex;
|
|
133
|
-
flex-shrink: 0;
|
|
134
|
-
box-sizing: border-box;
|
|
135
|
-
flex-grow: 0;
|
|
136
|
-
align-items: center;
|
|
137
|
-
padding-left: 16px;
|
|
138
|
-
color: @NL0;
|
|
139
|
-
|
|
140
|
-
.ald-table-cell-container {
|
|
141
|
-
width: 100%;
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
&:hover {
|
|
146
|
-
background-color: @NL97;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
&-selected {
|
|
150
|
-
background-color: @B98;
|
|
151
|
-
|
|
152
|
-
&:hover {
|
|
153
|
-
background-color: @B98;
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
}
|
|
81
|
+
min-height: 48px;
|
|
82
|
+
overflow: hidden;
|
|
157
83
|
}
|
|
158
84
|
|
|
159
|
-
|
|
85
|
+
.ald-table-td-ellipsis-content {
|
|
160
86
|
overflow: hidden;
|
|
87
|
+
text-overflow: ellipsis;
|
|
88
|
+
white-space: nowrap;
|
|
161
89
|
}
|
|
162
90
|
|
|
163
|
-
|
|
164
|
-
|
|
91
|
+
.ald-table-sticky {
|
|
92
|
+
position: sticky;
|
|
93
|
+
top: 0;
|
|
94
|
+
// 需要大于 Spin 的 z-index,Spin 的 z-index 为4
|
|
95
|
+
z-index: 5;
|
|
165
96
|
}
|
|
166
97
|
|
|
167
|
-
|
|
168
|
-
height:
|
|
169
|
-
|
|
170
|
-
line-height: @table-body-row-height;
|
|
171
|
-
text-align: center;
|
|
98
|
+
.ald-table-body {
|
|
99
|
+
min-height: 200px;
|
|
100
|
+
overflow: auto;
|
|
172
101
|
|
|
173
|
-
|
|
174
|
-
|
|
102
|
+
.ald-table-tr:hover {
|
|
103
|
+
.ald-table-td {
|
|
104
|
+
background-color: #f4f4f4;
|
|
105
|
+
}
|
|
175
106
|
}
|
|
176
107
|
}
|
|
108
|
+
}
|
|
177
109
|
|
|
178
|
-
|
|
179
|
-
|
|
110
|
+
.ald-table-align {
|
|
111
|
+
&-left {
|
|
112
|
+
text-align: left;
|
|
113
|
+
justify-content: left;
|
|
180
114
|
}
|
|
181
115
|
|
|
182
|
-
&-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
align-items: center;
|
|
186
|
-
justify-content: center;
|
|
187
|
-
padding-top: 84px;
|
|
188
|
-
padding-bottom: 84px;
|
|
189
|
-
}
|
|
116
|
+
&-right {
|
|
117
|
+
text-align: right;
|
|
118
|
+
justify-content: right;
|
|
190
119
|
}
|
|
191
120
|
|
|
192
|
-
&-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
justify-content: space-between;
|
|
196
|
-
margin-bottom: 24px;
|
|
197
|
-
|
|
198
|
-
&-left {
|
|
199
|
-
color: @NL0;
|
|
200
|
-
font-weight: 600;
|
|
201
|
-
font-size: 13px;
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
&-right {
|
|
205
|
-
display: flex;
|
|
206
|
-
align-items: center;
|
|
207
|
-
justify-content: flex-end;
|
|
208
|
-
height: 28px;
|
|
209
|
-
color: @NL0;
|
|
210
|
-
font-size: 13px;
|
|
211
|
-
}
|
|
121
|
+
&-center {
|
|
122
|
+
text-align: center;
|
|
123
|
+
justify-content: center;
|
|
212
124
|
}
|
|
125
|
+
}
|
|
213
126
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
127
|
+
.ald-table-pagination {
|
|
128
|
+
margin-top: 18px;
|
|
129
|
+
display: flex;
|
|
130
|
+
justify-content: end;
|
|
131
|
+
}
|
|
218
132
|
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
133
|
+
.ald-table-loading {
|
|
134
|
+
position: absolute;
|
|
135
|
+
top: 50%;
|
|
136
|
+
left: 50%;
|
|
137
|
+
transform: translate(-50%, -50%);
|
|
223
138
|
|
|
224
|
-
.ald-table-
|
|
225
|
-
|
|
139
|
+
.ald-table-loading-inner {
|
|
140
|
+
width: 100%;
|
|
226
141
|
}
|
|
142
|
+
}
|
|
227
143
|
|
|
228
|
-
|
|
229
|
-
|
|
144
|
+
.ald-table-overflow-hidden {
|
|
145
|
+
overflow: hidden;
|
|
146
|
+
height: 100%;
|
|
147
|
+
}
|
|
230
148
|
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
&-thead {
|
|
240
|
-
&::-webkit-scrollbar {
|
|
241
|
-
display: none;
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
&-tbody {
|
|
246
|
-
overflow: initial;
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
}
|
|
149
|
+
.ald-table-body-scroll {
|
|
150
|
+
overflow: auto;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.ald-table-empty {
|
|
154
|
+
margin-top: 80px;
|
|
252
155
|
}
|
|
@@ -9,14 +9,15 @@ export interface ITableProps<TDataItem extends object> {
|
|
|
9
9
|
offsetHeader: number;
|
|
10
10
|
};
|
|
11
11
|
loading?: boolean;
|
|
12
|
-
scroll?:
|
|
13
|
-
x?: number | string;
|
|
14
|
-
y?: number | string;
|
|
15
|
-
};
|
|
12
|
+
scroll?: IScroll;
|
|
16
13
|
pagination?: IPaginationProps;
|
|
17
14
|
empty?: React.ReactNode;
|
|
18
15
|
rowClassName?: (record: TDataItem, index: number) => string;
|
|
19
16
|
}
|
|
17
|
+
export interface IScroll {
|
|
18
|
+
x?: number | string;
|
|
19
|
+
y?: number | string;
|
|
20
|
+
}
|
|
20
21
|
export interface ITableColumn<TDataItem = unknown> {
|
|
21
22
|
title: string | React.ReactNode;
|
|
22
23
|
dataIndex?: string;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type RcTree from 'rc-tree';
|
|
2
|
+
import type { BasicDataNode } from 'rc-tree';
|
|
3
|
+
import type { DataNode, Key } from 'rc-tree/lib/interface';
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import type { TreeProps } from './Tree';
|
|
6
|
+
export type ExpandAction = false | 'click' | 'doubleClick';
|
|
7
|
+
export interface DirectoryTreeProps<T extends BasicDataNode = DataNode> extends TreeProps<T> {
|
|
8
|
+
expandAction?: ExpandAction;
|
|
9
|
+
}
|
|
10
|
+
type DirectoryTreeCompoundedComponent = (<T extends BasicDataNode | DataNode = DataNode>(props: React.PropsWithChildren<DirectoryTreeProps<T>> & {
|
|
11
|
+
ref?: React.Ref<RcTree>;
|
|
12
|
+
}) => React.ReactElement) & {
|
|
13
|
+
displayName?: string;
|
|
14
|
+
};
|
|
15
|
+
export interface DirectoryTreeState {
|
|
16
|
+
expandedKeys?: Key[];
|
|
17
|
+
selectedKeys?: Key[];
|
|
18
|
+
}
|
|
19
|
+
declare const ForwardDirectoryTree: DirectoryTreeCompoundedComponent;
|
|
20
|
+
export default ForwardDirectoryTree;
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
+
var _excluded = ["defaultExpandAll", "defaultExpandParent", "defaultExpandedKeys"],
|
|
3
|
+
_excluded2 = ["prefixCls", "className", "showIcon", "expandAction"];
|
|
4
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
5
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
6
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
7
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
8
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
9
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
10
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
11
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
12
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
13
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
14
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
15
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
16
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
17
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
18
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
19
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
20
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
21
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
22
|
+
import FileOutlined from '@ant-design/icons/FileOutlined';
|
|
23
|
+
import FolderOpenOutlined from '@ant-design/icons/FolderOpenOutlined';
|
|
24
|
+
import FolderOutlined from '@ant-design/icons/FolderOutlined';
|
|
25
|
+
import classNames from 'classnames';
|
|
26
|
+
import { conductExpandParent } from 'rc-tree/lib/util';
|
|
27
|
+
import { convertDataToEntities, convertTreeToData } from 'rc-tree/lib/utils/treeUtil';
|
|
28
|
+
import * as React from 'react';
|
|
29
|
+
import { ConfigContext } from "../ConfigProvider";
|
|
30
|
+
import Tree from "./Tree";
|
|
31
|
+
import { calcRangeKeys, convertDirectoryKeysToNodes } from "./utils/dictUtil";
|
|
32
|
+
function getIcon(props) {
|
|
33
|
+
var isLeaf = props.isLeaf,
|
|
34
|
+
expanded = props.expanded;
|
|
35
|
+
if (isLeaf) {
|
|
36
|
+
return /*#__PURE__*/React.createElement(FileOutlined, null);
|
|
37
|
+
}
|
|
38
|
+
return expanded ? /*#__PURE__*/React.createElement(FolderOpenOutlined, null) : /*#__PURE__*/React.createElement(FolderOutlined, null);
|
|
39
|
+
}
|
|
40
|
+
function getTreeData(_ref) {
|
|
41
|
+
var treeData = _ref.treeData,
|
|
42
|
+
children = _ref.children;
|
|
43
|
+
return treeData || convertTreeToData(children);
|
|
44
|
+
}
|
|
45
|
+
var DirectoryTree = function DirectoryTree(_ref2, ref) {
|
|
46
|
+
var defaultExpandAll = _ref2.defaultExpandAll,
|
|
47
|
+
defaultExpandParent = _ref2.defaultExpandParent,
|
|
48
|
+
defaultExpandedKeys = _ref2.defaultExpandedKeys,
|
|
49
|
+
props = _objectWithoutProperties(_ref2, _excluded);
|
|
50
|
+
// Shift click usage
|
|
51
|
+
var lastSelectedKey = React.useRef();
|
|
52
|
+
var cachedSelectedKeys = React.useRef();
|
|
53
|
+
var getInitExpandedKeys = function getInitExpandedKeys() {
|
|
54
|
+
var _convertDataToEntitie = convertDataToEntities(getTreeData(props)),
|
|
55
|
+
keyEntities = _convertDataToEntitie.keyEntities;
|
|
56
|
+
var initExpandedKeys;
|
|
57
|
+
|
|
58
|
+
// Expanded keys
|
|
59
|
+
if (defaultExpandAll) {
|
|
60
|
+
initExpandedKeys = Object.keys(keyEntities);
|
|
61
|
+
} else if (defaultExpandParent) {
|
|
62
|
+
initExpandedKeys = conductExpandParent(props.expandedKeys || defaultExpandedKeys || [], keyEntities);
|
|
63
|
+
} else {
|
|
64
|
+
initExpandedKeys = props.expandedKeys || defaultExpandedKeys;
|
|
65
|
+
}
|
|
66
|
+
return initExpandedKeys;
|
|
67
|
+
};
|
|
68
|
+
var _React$useState = React.useState(props.selectedKeys || props.defaultSelectedKeys || []),
|
|
69
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
70
|
+
selectedKeys = _React$useState2[0],
|
|
71
|
+
setSelectedKeys = _React$useState2[1];
|
|
72
|
+
var _React$useState3 = React.useState(function () {
|
|
73
|
+
return getInitExpandedKeys();
|
|
74
|
+
}),
|
|
75
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
76
|
+
expandedKeys = _React$useState4[0],
|
|
77
|
+
setExpandedKeys = _React$useState4[1];
|
|
78
|
+
React.useEffect(function () {
|
|
79
|
+
if ('selectedKeys' in props) {
|
|
80
|
+
setSelectedKeys(props.selectedKeys);
|
|
81
|
+
}
|
|
82
|
+
}, [props.selectedKeys, props]);
|
|
83
|
+
React.useEffect(function () {
|
|
84
|
+
if ('expandedKeys' in props) {
|
|
85
|
+
setExpandedKeys(props.expandedKeys);
|
|
86
|
+
}
|
|
87
|
+
}, [props.expandedKeys, props]);
|
|
88
|
+
var onExpand = function onExpand(keys, info) {
|
|
89
|
+
var _props$onExpand;
|
|
90
|
+
if (!('expandedKeys' in props)) {
|
|
91
|
+
setExpandedKeys(keys);
|
|
92
|
+
}
|
|
93
|
+
// Call origin function
|
|
94
|
+
return (_props$onExpand = props.onExpand) === null || _props$onExpand === void 0 ? void 0 : _props$onExpand.call(props, keys, info);
|
|
95
|
+
};
|
|
96
|
+
var onSelect = function onSelect(keys, event) {
|
|
97
|
+
var _props$onSelect;
|
|
98
|
+
var multiple = props.multiple;
|
|
99
|
+
var node = event.node,
|
|
100
|
+
nativeEvent = event.nativeEvent;
|
|
101
|
+
var _node$key = node.key,
|
|
102
|
+
key = _node$key === void 0 ? '' : _node$key;
|
|
103
|
+
var treeData = getTreeData(props);
|
|
104
|
+
// const newState: DirectoryTreeState = {};
|
|
105
|
+
|
|
106
|
+
// We need wrap this event since some value is not same
|
|
107
|
+
var newEvent = _objectSpread(_objectSpread({}, event), {}, {
|
|
108
|
+
selected: true // Directory selected always true
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
// Windows / Mac single pick
|
|
112
|
+
var ctrlPick = (nativeEvent === null || nativeEvent === void 0 ? void 0 : nativeEvent.ctrlKey) || (nativeEvent === null || nativeEvent === void 0 ? void 0 : nativeEvent.metaKey);
|
|
113
|
+
var shiftPick = nativeEvent === null || nativeEvent === void 0 ? void 0 : nativeEvent.shiftKey;
|
|
114
|
+
|
|
115
|
+
// Generate new selected keys
|
|
116
|
+
var newSelectedKeys;
|
|
117
|
+
if (multiple && ctrlPick) {
|
|
118
|
+
// Control click
|
|
119
|
+
newSelectedKeys = keys;
|
|
120
|
+
lastSelectedKey.current = key;
|
|
121
|
+
cachedSelectedKeys.current = newSelectedKeys;
|
|
122
|
+
newEvent.selectedNodes = convertDirectoryKeysToNodes(treeData, newSelectedKeys);
|
|
123
|
+
} else if (multiple && shiftPick) {
|
|
124
|
+
// Shift click
|
|
125
|
+
newSelectedKeys = Array.from(new Set([].concat(_toConsumableArray(cachedSelectedKeys.current || []), _toConsumableArray(calcRangeKeys({
|
|
126
|
+
treeData: treeData,
|
|
127
|
+
expandedKeys: expandedKeys,
|
|
128
|
+
startKey: key,
|
|
129
|
+
endKey: lastSelectedKey.current
|
|
130
|
+
})))));
|
|
131
|
+
newEvent.selectedNodes = convertDirectoryKeysToNodes(treeData, newSelectedKeys);
|
|
132
|
+
} else {
|
|
133
|
+
// Single click
|
|
134
|
+
newSelectedKeys = [key];
|
|
135
|
+
lastSelectedKey.current = key;
|
|
136
|
+
cachedSelectedKeys.current = newSelectedKeys;
|
|
137
|
+
newEvent.selectedNodes = convertDirectoryKeysToNodes(treeData, newSelectedKeys);
|
|
138
|
+
}
|
|
139
|
+
(_props$onSelect = props.onSelect) === null || _props$onSelect === void 0 ? void 0 : _props$onSelect.call(props, newSelectedKeys, newEvent);
|
|
140
|
+
if (!('selectedKeys' in props)) {
|
|
141
|
+
setSelectedKeys(newSelectedKeys);
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
var _React$useContext = React.useContext(ConfigContext),
|
|
145
|
+
getPrefixCls = _React$useContext.getPrefixCls,
|
|
146
|
+
direction = _React$useContext.direction;
|
|
147
|
+
var customizePrefixCls = props.prefixCls,
|
|
148
|
+
className = props.className,
|
|
149
|
+
_props$showIcon = props.showIcon,
|
|
150
|
+
showIcon = _props$showIcon === void 0 ? true : _props$showIcon,
|
|
151
|
+
_props$expandAction = props.expandAction,
|
|
152
|
+
expandAction = _props$expandAction === void 0 ? 'click' : _props$expandAction,
|
|
153
|
+
otherProps = _objectWithoutProperties(props, _excluded2);
|
|
154
|
+
var prefixCls = getPrefixCls('tree', customizePrefixCls);
|
|
155
|
+
var connectClassName = classNames("".concat(prefixCls, "-directory"), _defineProperty({}, "".concat(prefixCls, "-directory-rtl"), direction === 'rtl'), className);
|
|
156
|
+
return /*#__PURE__*/React.createElement(Tree, _extends({
|
|
157
|
+
icon: getIcon,
|
|
158
|
+
ref: ref,
|
|
159
|
+
blockNode: true
|
|
160
|
+
}, otherProps, {
|
|
161
|
+
showIcon: showIcon,
|
|
162
|
+
expandAction: expandAction,
|
|
163
|
+
prefixCls: prefixCls,
|
|
164
|
+
className: connectClassName,
|
|
165
|
+
expandedKeys: expandedKeys,
|
|
166
|
+
selectedKeys: selectedKeys,
|
|
167
|
+
onSelect: onSelect,
|
|
168
|
+
onExpand: onExpand
|
|
169
|
+
}));
|
|
170
|
+
};
|
|
171
|
+
var ForwardDirectoryTree = /*#__PURE__*/React.forwardRef(DirectoryTree);
|
|
172
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
173
|
+
ForwardDirectoryTree.displayName = 'DirectoryTree';
|
|
174
|
+
}
|
|
175
|
+
export default ForwardDirectoryTree;
|