@@ -16,17 +16,13 @@ const props = withDefaults(defineProps<SplitPanelProps>(), {
16
16
sizeUnit: ' %' ,
17
17
direction: ' ltr' ,
18
18
collapsible: false ,
19
- transitionDuration: ' 0 ' ,
19
+ transitionDuration: 0 ,
20
20
transitionTimingFunctionCollapse: ' cubic-bezier(0.4, 0, 0.6, 1)' ,
21
21
transitionTimingFunctionExpand: ' cubic-bezier(0, 0, 0.2, 1)' ,
22
22
snapPoints : () => [],
23
23
snapThreshold: 12 ,
24
24
});
25
25
26
- const emits = defineEmits <{
27
- transitionend: [event : TransitionEvent ];
28
- }>();
29
-
30
26
/** Size of the primary panel in either percentages or pixels as defined by the sizeUnit property */
31
27
const size = defineModel <number >(' size' , { default: 50 });
32
28
@@ -100,7 +96,17 @@ useResize(sizePercentage, {
100
96
primary : () => props .primary ,
101
97
});
102
98
103
- const { onTransitionEnd, collapseTransitionState, toggle, expand, collapse } = useCollapse (collapsed , sizePercentage , emits );
99
+ const {
100
+ collapseTransitionState,
101
+ toggle,
102
+ expand,
103
+ collapse,
104
+ transitionDurationCss,
105
+ } = useCollapse (
106
+ collapsed ,
107
+ sizePercentage ,
108
+ { transitionDuration : () => props .transitionDuration },
109
+ );
104
110
105
111
defineExpose ({ collapse , expand , toggle });
106
112
</script >
@@ -111,11 +117,9 @@ defineExpose({ collapse, expand, toggle });
111
117
class =" sp-root"
112
118
:class =" [
113
119
`sp-${orientation}`,
114
- `sp-${collapseTransitionState}`,
115
- { 'sp-collapsed': collapsed, 'sp-dragging': isDragging },
120
+ { 'sp-collapsed': collapsed, 'sp-dragging': isDragging, [`sp-${collapseTransitionState}`]: collapseTransitionState },
116
121
]"
117
122
data-testid =" root"
118
- @transitionend =" onTransitionEnd"
119
123
>
120
124
<div class =" sp-start" :class =" ui?.start" data-testid =" start" >
121
125
<slot name =" start" />
@@ -148,18 +152,34 @@ defineExpose({ collapse, expand, toggle });
148
152
.sp-root {
149
153
display : grid ;
150
154
155
+ &.sp-collapsing {
156
+ transition-duration : v-bind(transitionDurationCss);
157
+ transition-timing-function : v-bind(transitionTimingFunctionCollapse);
158
+ }
159
+
160
+ &.sp-expanding {
161
+ transition-duration : v-bind(transitionDurationCss);
162
+ transition-timing-function : v-bind(transitionTimingFunctionExpand);
163
+ }
164
+
151
165
&.sp-horizontal {
152
- transition-property : grid-template-columns;
153
166
grid-template-columns : v-bind(gridTemplate);
154
167
168
+ &.sp-collapsing , &.sp-expanding {
169
+ transition-property : grid-template-columns;
170
+ }
171
+
155
172
&.sp-dragging {
156
173
cursor : ew-resize ;
157
174
}
158
175
}
159
176
160
177
&.sp-vertical {
161
178
grid-template-rows : v-bind(gridTemplate);
162
- transition-property : grid-template-rows;
179
+
180
+ &.sp-collapsing , &.sp-expanding {
181
+ transition-property : grid-template-rows;
182
+ }
163
183
164
184
&.sp-dragging {
165
185
cursor : ns-resize ;
@@ -169,16 +189,6 @@ defineExpose({ collapse, expand, toggle });
169
189
&.sp-dragging {
170
190
user-select : none ;
171
191
}
172
-
173
- &.sp-collapsing {
174
- transition-duration : v-bind(transitionDuration);
175
- transition-timing-function : v-bind(transitionTimingFunctionCollapse);
176
- }
177
-
178
- &.sp-expanding {
179
- transition-duration : v-bind(transitionDuration);
180
- transition-timing-function : v-bind(transitionTimingFunctionExpand);
181
- }
182
192
}
183
193
184
194
.sp-start , .sp-end {
0 commit comments