Skip to content

Commit 6d4248d

Browse files
committed
fix: drag treenode style
1 parent d442db0 commit 6d4248d

File tree

1 file changed

+61
-13
lines changed

1 file changed

+61
-13
lines changed

components/tree/style/mixin.less

+61-13
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
@import '../../style/mixins/index';
22

33
@tree-prefix-cls: ~'@{ant-prefix}-tree';
4-
@tree-node-prefix-cls: ~'@{tree-prefix-cls}-treenode';
54
@select-tree-prefix-cls: ~'@{ant-prefix}-select-tree';
65
@tree-motion: ~'@{ant-prefix}-motion-collapse';
76
@tree-node-padding: (@padding-xs / 2);
@@ -13,6 +12,7 @@
1312
display: inline-block;
1413
font-size: 10px;
1514
vertical-align: baseline;
15+
1616
svg {
1717
transition: transform 0.3s;
1818
}
@@ -28,6 +28,7 @@
2828
background-color: @primary-color;
2929
border-radius: 1px;
3030
pointer-events: none;
31+
3132
&::after {
3233
position: absolute;
3334
top: -3px;
@@ -66,6 +67,26 @@
6667
.@{custom-tree-prefix-cls}-node-content-wrapper {
6768
flex: auto;
6869
}
70+
71+
// >>> Drag
72+
.@{custom-tree-node-prefix-cls}.dragging {
73+
position: relative;
74+
75+
&::after {
76+
position: absolute;
77+
top: 0;
78+
right: 0;
79+
bottom: @tree-node-padding;
80+
left: 0;
81+
border: 1px solid @primary-color;
82+
opacity: 0;
83+
animation: ant-tree-node-fx-do-not-use 0.3s;
84+
animation-play-state: running;
85+
animation-fill-mode: forwards;
86+
content: '';
87+
pointer-events: none;
88+
}
89+
}
6990
}
7091
}
7192

@@ -110,6 +131,19 @@
110131
}
111132
}
112133

134+
// >>> Drag Handler
135+
&-draggable-icon {
136+
width: @tree-title-height;
137+
line-height: @tree-title-height;
138+
text-align: center;
139+
opacity: 0.2;
140+
transition: opacity @animation-duration-slow;
141+
142+
.@{custom-tree-node-prefix-cls}:hover & {
143+
opacity: 0.45;
144+
}
145+
}
146+
113147
// >>> Switcher
114148
&-switcher {
115149
.antTreeSwitcherIcon();
@@ -145,19 +179,21 @@
145179
display: inline-block;
146180
width: 100%;
147181
height: 100%;
182+
// https://github.com/ant-design/ant-design/issues/31884
148183
&::before {
149184
position: absolute;
150185
top: 0;
186+
right: 12px;
151187
bottom: -@tree-node-padding;
152188
margin-left: -1px;
153-
border-left: 1px solid @normal-color;
189+
border-right: 1px solid @normal-color;
154190
content: ' ';
155191
}
192+
156193
&::after {
157194
position: absolute;
158195
width: @tree-title-height - 14px;
159196
height: @tree-title-height - 10px;
160-
margin-left: -1px;
161197
border-bottom: 1px solid @normal-color;
162198
content: ' ';
163199
}
@@ -200,6 +236,7 @@
200236
line-height: @tree-title-height;
201237
text-align: center;
202238
vertical-align: top;
239+
203240
&:empty {
204241
display: none;
205242
}
@@ -212,7 +249,7 @@
212249
}
213250

214251
// ==================== Draggable =====================
215-
&-node-content-wrapper[draggable='true'] {
252+
&-node-content-wrapper {
216253
line-height: @tree-title-height;
217254
user-select: none;
218255

@@ -255,20 +292,31 @@
255292
background: @component-background;
256293

257294
&-line-icon {
258-
vertical-align: -0.225em;
295+
// https://github.com/ant-design/ant-design/issues/32813
296+
vertical-align: -0.15em;
259297
}
260298
}
261299
}
262-
}
263300

264-
.@{tree-node-prefix-cls}-leaf-last {
265-
.@{tree-prefix-cls}-switcher {
266-
&-leaf-line {
267-
&::before {
268-
top: auto !important;
269-
bottom: auto !important;
270-
height: @tree-title-height - 10px !important;
301+
.@{custom-tree-node-prefix-cls}-leaf-last {
302+
.@{custom-tree-prefix-cls}-switcher {
303+
&-leaf-line {
304+
&::before {
305+
top: auto !important;
306+
bottom: auto !important;
307+
height: @tree-title-height - 10px !important;
308+
}
271309
}
272310
}
273311
}
274312
}
313+
314+
@keyframes ant-tree-node-fx-do-not-use {
315+
0% {
316+
opacity: 0;
317+
}
318+
319+
100% {
320+
opacity: 1;
321+
}
322+
}

0 commit comments

Comments
 (0)