Skip to content

Commit a9d6024

Browse files
committed
fix: drag icon postition
1 parent 59e49ae commit a9d6024

File tree

3 files changed

+118
-111
lines changed

3 files changed

+118
-111
lines changed

src/components/Tree/Tree.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,7 @@ export default {
498498
}
499499

500500
const iconPosition = dropNode.$el
501-
.querySelector('.icon')
501+
.querySelector('.expand_box')
502502
.getBoundingClientRect()
503503
const dropIndicator = this.$refs.dropIndicator
504504
if (dropType === 'before') {

src/components/Tree/TreeNodeContent.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ export default {
7474
const { $scopedSlots: { expandIcon: expandIconSlot }, lazy } = this.tree
7575
const { node, toggleFold, visibleExpand } = this
7676
const { data: { expanded, isLeaf }, children } = node
77-
return (children && children.length) || (lazy && !isLeaf) ? expandIconSlot ? <div style={{ display: visibleExpand }}>{expandIconSlot({ expanded, node, toggleFold })}</div> : (<span class={['icon', expanded ? 'rotate180-enter icon-expand' : 'rotate180-leave icon-unexpand']} onClick={() => toggleFold(node)} ></span>) : null
77+
return <div class="expand_box" style={{ display: visibleExpand }}>{(children && children.length) || (lazy && !isLeaf) ? expandIconSlot ? expandIconSlot({ expanded, node, toggleFold }) : (<span class={['icon', expanded ? 'rotate180-enter icon-expand' : 'rotate180-leave icon-unexpand']} onClick={() => toggleFold(node)} ></span>) : null}</div>
7878
},
7979
renderCheckbox () {
8080
const { node, handleClickCheckBox, selectToggle } = this
Lines changed: 116 additions & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -1,151 +1,156 @@
1-
@transition-time : .2s;
1+
@transition-time: 0.2s;
22
@primary-color: #409eff;
3-
@background-color-base: #F1F3F5;
4-
@normal-color: #1F2E4D;
3+
@background-color-base: #f1f3f5;
4+
@normal-color: #1f2e4d;
55
@unimportance-color: #b7beca;
6-
@border-radius-small : 3px;
6+
@border-radius-small: 3px;
77

88
.motion-common() {
9-
animation-duration: .3s;
10-
animation-fill-mode: both;
9+
animation-duration: 0.3s;
10+
animation-fill-mode: both;
1111
}
1212

1313
.move-motion(@className, @keyframeName) {
14-
.make-motion(@className, @keyframeName);
15-
.@{className}-enter-active {
16-
animation-timing-function: ease-in-out;
17-
}
18-
.@{className}-leave-active {
19-
animation-timing-function: ease-in-out;
20-
}
14+
.make-motion(@className, @keyframeName);
15+
.@{className}-enter-active {
16+
animation-timing-function: ease-in-out;
17+
}
18+
.@{className}-leave-active {
19+
animation-timing-function: ease-in-out;
20+
}
2121
}
2222

2323
.make-motion(@className, @keyframeName) {
24-
.@{className}-enter-active {
25-
.motion-common();
26-
animation-play-state: paused;
27-
}
28-
.@{className}-leave-active {
29-
.motion-common();
30-
animation-play-state: paused;
31-
}
32-
.@{className}-enter-active {
33-
animation-name: ~"@{keyframeName}In";
34-
animation-play-state: running;
35-
}
36-
.@{className}-leave-active {
37-
animation-name: ~"@{keyframeName}Out";
38-
animation-play-state: running;
39-
}
24+
.@{className}-enter-active {
25+
.motion-common();
26+
animation-play-state: paused;
27+
}
28+
.@{className}-leave-active {
29+
.motion-common();
30+
animation-play-state: paused;
31+
}
32+
.@{className}-enter-active {
33+
animation-name: ~"@{keyframeName}In";
34+
animation-play-state: running;
35+
}
36+
.@{className}-leave-active {
37+
animation-name: ~"@{keyframeName}Out";
38+
animation-play-state: running;
39+
}
4040
}
4141

4242
.move-motion(transition-drop, shTransitionDrop);
4343

4444
@keyframes shTransitionDropIn {
45-
0% {
46-
opacity: 0;
47-
transform: scaleY(0.8);
48-
}
49-
100% {
50-
opacity: 1;
51-
transform: scaleY(1);
52-
}
45+
0% {
46+
opacity: 0;
47+
transform: scaleY(0.8);
48+
}
49+
100% {
50+
opacity: 1;
51+
transform: scaleY(1);
52+
}
5353
}
5454

5555
@keyframes shTransitionDropOut {
56-
0% {
57-
opacity: 1;
58-
transform: scaleY(1);
59-
}
60-
100% {
61-
opacity: 0;
62-
transform: scaleY(0.8);
63-
}
56+
0% {
57+
opacity: 1;
58+
transform: scaleY(1);
59+
}
60+
100% {
61+
opacity: 0;
62+
transform: scaleY(0.8);
63+
}
6464
}
6565

6666
.rotate-motion(@className, @deg) {
67-
.transform {
68-
transform-origin: center;
69-
transition: @transition-time;
70-
}
71-
.@{className}-enter {
72-
transform: rotate(@deg);
73-
.transform;
74-
}
75-
.@{className}-leave {
76-
transform: rotate(0deg);
77-
.transform;
78-
}
67+
.transform {
68+
transform-origin: center;
69+
transition: @transition-time;
70+
}
71+
.@{className}-enter {
72+
transform: rotate(@deg);
73+
.transform;
74+
}
75+
.@{className}-leave {
76+
transform: rotate(0deg);
77+
.transform;
7978
}
80-
.rotate-motion(rotate90, 90deg);
81-
.rotate-motion(rotate180, 180deg);
79+
}
80+
.rotate-motion(rotate90, 90deg);
81+
.rotate-motion(rotate180, 180deg);
8282

8383
.vue-tree {
84-
user-select: none;
85-
position: relative;
86-
.drop-indicator {
87-
position: absolute;
88-
left: 0;
89-
right: 0;
90-
height: 1px;
91-
background-color: @primary-color;
92-
}
93-
.child-node {
84+
user-select: none;
85+
position: relative;
86+
.drop-indicator {
87+
position: absolute;
88+
left: 0;
89+
right: 0;
90+
height: 1px;
91+
background-color: @primary-color;
92+
}
93+
.child-node {
94+
padding-left: 22px;
95+
line-height: 28px;
96+
cursor: pointer;
97+
.node-content {
98+
width: 100%;
99+
position: relative;
100+
display: flex;
101+
align-items: center;
94102
padding-left: 22px;
95-
line-height: 28px;
96-
cursor: pointer;
97-
.node-content {
98-
width: 100%;
99-
position: relative;
100-
display: flex;
101-
align-items: center;
102-
padding-left: 22px;
103+
.expand_box {
104+
height: 100%;
105+
overflow: hidden;
106+
position: absolute;
107+
display: inline-block;
108+
left: 0px;
109+
font-size: 12px;
103110
.icon {
104-
position: absolute;
105-
display: inline-block;
106-
left: 0px;
107-
font-size: 12px;
108111
&-expand {
109112
color: @normal-color;
110113
}
111114
&-unexpand {
112115
color: @unimportance-color;
113116
}
114117
}
115-
.inner-wrap {
116-
padding-left: 2px;
117-
display: flex;
118-
align-items: center;
119-
border-radius: @border-radius-small;
120-
border: 1px solid transparent;
121-
}
122-
.drop-wrap {
123-
border-color: @primary-color;
124-
}
125-
.drop-inner {
126-
border-bottom: 1px solid @primary-color;
127-
}
128118
}
129-
.active-li {
130-
.inner-wrap {
131-
background: @background-color-base;
132-
}
119+
120+
.inner-wrap {
121+
padding-left: 2px;
122+
display: flex;
123+
align-items: center;
124+
border-radius: @border-radius-small;
125+
border: 1px solid transparent;
133126
}
134-
.inset {
135-
cursor: move;
127+
.drop-wrap {
128+
border-color: @primary-color;
136129
}
137-
.disabled {
138-
cursor: no-drop;
130+
.drop-inner {
131+
border-bottom: 1px solid @primary-color;
139132
}
140133
}
141-
.add-node {
142-
cursor: pointer;
134+
.active-li {
135+
.inner-wrap {
136+
background: @background-color-base;
137+
}
138+
}
139+
.inset {
140+
cursor: move;
141+
}
142+
.disabled {
143+
cursor: no-drop;
143144
}
145+
}
146+
.add-node {
147+
cursor: pointer;
148+
}
144149
.is-drop-inner > .node-content > .inner-wrap > .node-name {
145150
background-color: @primary-color;
146151
color: #fff;
147152
}
148-
}
153+
149154
.vue-checkbox {
150155
position: relative;
151156
width: 13px;
@@ -158,7 +163,8 @@
158163
left: 0;
159164
z-index: 3;
160165
margin: 0;
161-
background: transparent
166+
background: transparent;
167+
cursor: pointer;
162168
}
163169
&-indeterminate {
164170
box-sizing: border-box;
@@ -172,12 +178,13 @@
172178
border-radius: 3px;
173179
&:after {
174180
position: absolute;
175-
content: '';
181+
content: "";
176182
width: 100%;
177183
height: 2px;
178-
background: #fff;;
184+
background: #fff;
179185
top: 50%;
180186
left: 0;
181187
}
182188
}
183-
}
189+
}
190+
}

0 commit comments

Comments
 (0)