@@ -7,10 +7,8 @@ import {DragDirection, IDragMoveEventArgs, IDragStartEventArgs} from '../../dire
7
7
export const SPLITTER_INTERACTION_KEYS = new Set ( 'right down left up arrowright arrowdown arrowleft arrowup' . split ( ' ' ) ) ;
8
8
9
9
/**
10
- * Provides reference to `SplitBarComponent` component.
11
- * Represents the draggable gripper that visually separates panes and allows for changing their sizes.
12
- * @export
13
- * @class SplitBarComponent
10
+ * @hidden @internal
11
+ * Represents the draggable bar that visually separates panes and allows for changing their sizes.
14
12
*/
15
13
@Component ( {
16
14
selector : 'igx-splitter-bar' ,
@@ -24,15 +22,13 @@ export class IgxSplitBarComponent {
24
22
public cssClass = 'igx-splitter-bar-host' ;
25
23
26
24
/**
27
- * Sets/gets `IgxSplitBarComponent` orientation.
28
- * @type SplitterType
25
+ * Gets/Sets the orientation.
29
26
*/
30
27
@Input ( )
31
- public type : SplitterType = SplitterType . Vertical ;
28
+ public type : SplitterType = SplitterType . Horizontal ;
32
29
33
30
/**
34
- * Sets/gets `IgxSplitBarComponent` element order.
35
- * @type SplitterType
31
+ * Sets/gets the element order.
36
32
*/
37
33
@HostBinding ( 'style.order' )
38
34
@Input ( )
@@ -43,7 +39,29 @@ export class IgxSplitBarComponent {
43
39
* @internal
44
40
*/
45
41
@HostBinding ( 'attr.tabindex' )
46
- public tabindex = 0 ;
42
+ public get tabindex ( ) {
43
+ return this . resizeDisallowed ? null : 0 ;
44
+ }
45
+
46
+ /**
47
+ * @hidden
48
+ * @internal
49
+ */
50
+ @HostBinding ( 'attr.aria-orientation' )
51
+ public get orientation ( ) {
52
+ return this . type === SplitterType . Horizontal ? 'horizontal' : 'vertical' ;
53
+ }
54
+
55
+ /**
56
+ * @hidden
57
+ * @internal
58
+ */
59
+ public get cursor ( ) {
60
+ if ( this . resizeDisallowed ) {
61
+ return '' ;
62
+ }
63
+ return this . type === SplitterType . Horizontal ? 'col-resize' : 'row-resize' ;
64
+ }
47
65
48
66
/**
49
67
* Sets/gets the `SplitPaneComponent` associated with the current `SplitBarComponent`.
@@ -60,35 +78,26 @@ export class IgxSplitBarComponent {
60
78
61
79
/**
62
80
* An event that is emitted whenever we start dragging the current `SplitBarComponent`.
63
- * @memberof SplitBarComponent
64
81
*/
65
82
@Output ( )
66
83
public moveStart = new EventEmitter < IgxSplitterPaneComponent > ( ) ;
67
84
68
85
/**
69
86
* An event that is emitted while we are dragging the current `SplitBarComponent`.
70
- * @memberof SplitBarComponent
71
87
*/
72
88
@Output ( )
73
89
public moving = new EventEmitter < number > ( ) ;
74
90
75
- /**
76
- * An event that is emitted when collapsing the pane
77
- */
78
- @Output ( )
79
- public togglePane = new EventEmitter < IgxSplitterPaneComponent > ( ) ;
80
91
/**
81
92
* A temporary holder for the pointer coordinates.
82
- * @private
83
- * @memberof SplitBarComponent
84
93
*/
85
94
private startPoint ! : number ;
86
95
87
96
/**
88
97
* @hidden @internal
89
98
*/
90
99
public get prevButtonHidden ( ) {
91
- return this . siblings [ 0 ] . hidden && ! this . siblings [ 1 ] . hidden ;
100
+ return this . siblings [ 0 ] . collapsed && ! this . siblings [ 1 ] . collapsed ;
92
101
}
93
102
94
103
/**
@@ -175,9 +184,12 @@ export class IgxSplitBarComponent {
175
184
* @hidden @internal
176
185
*/
177
186
public get nextButtonHidden ( ) {
178
- return this . siblings [ 1 ] . hidden && ! this . siblings [ 0 ] . hidden ;
187
+ return this . siblings [ 1 ] . collapsed && ! this . siblings [ 0 ] . collapsed ;
179
188
}
180
189
190
+ /**
191
+ * @hidden @internal
192
+ */
181
193
public onDragStart ( event : IDragStartEventArgs ) {
182
194
if ( this . resizeDisallowed ) {
183
195
event . cancel = true ;
@@ -187,6 +199,9 @@ export class IgxSplitBarComponent {
187
199
this . moveStart . emit ( this . pane ) ;
188
200
}
189
201
202
+ /**
203
+ * @hidden @internal
204
+ */
190
205
public onDragMove ( event : IDragMoveEventArgs ) {
191
206
const isHorizontal = this . type === SplitterType . Horizontal ;
192
207
const curr = isHorizontal ? event . pageX : event . pageY ;
@@ -200,20 +215,23 @@ export class IgxSplitBarComponent {
200
215
201
216
protected get resizeDisallowed ( ) {
202
217
const relatedTabs = this . siblings ;
203
- return ! ! relatedTabs . find ( x => x . resizable === false || x . hidden === true ) ;
218
+ return ! ! relatedTabs . find ( x => x . resizable === false || x . collapsed === true ) ;
204
219
}
205
220
221
+ /**
222
+ * @hidden @internal
223
+ */
206
224
public onCollapsing ( next : boolean ) {
207
225
const prevSibling = this . siblings [ 0 ] ;
208
226
const nextSibling = this . siblings [ 1 ] ;
209
227
let target ;
210
228
if ( next ) {
211
229
// if next is clicked when prev pane is hidden, show prev pane, else hide next pane.
212
- target = prevSibling . hidden ? prevSibling : nextSibling ;
230
+ target = prevSibling . collapsed ? prevSibling : nextSibling ;
213
231
} else {
214
232
// if prev is clicked when next pane is hidden, show next pane, else hide prev pane.
215
- target = nextSibling . hidden ? nextSibling : prevSibling ;
233
+ target = nextSibling . collapsed ? nextSibling : prevSibling ;
216
234
}
217
- this . togglePane . emit ( target ) ;
235
+ target . toggle ( ) ;
218
236
}
219
237
}
0 commit comments