1
+ import classNames from 'classnames' ;
2
+ import PropTypes from '../_util/vue-types' ;
3
+ import {
4
+ initDefaultProps ,
5
+ getOptionProps ,
6
+ hasProp ,
7
+ getComponentFromProp ,
8
+ getListeners ,
9
+ } from '../_util/props-util' ;
10
+ import BaseMixin from '../_util/BaseMixin' ;
11
+ import isNumeric from '../_util/isNumeric' ;
12
+ import { ConfigConsumerProps } from '../config-provider' ;
13
+ import Icon from '../icon' ;
14
+
1
15
// matchMedia polyfill for
2
16
// https://github.com/WickyNilliams/enquire.js/issues/82
3
17
if ( typeof window !== 'undefined' ) {
@@ -12,27 +26,13 @@ if (typeof window !== 'undefined') {
12
26
window . matchMedia = window . matchMedia || matchMediaPolyfill ;
13
27
}
14
28
15
- import classNames from 'classnames' ;
16
- import PropTypes from '../_util/vue-types' ;
17
- import Icon from '../icon' ;
18
- import {
19
- initDefaultProps ,
20
- getOptionProps ,
21
- hasProp ,
22
- getComponentFromProp ,
23
- getListeners ,
24
- } from '../_util/props-util' ;
25
- import BaseMixin from '../_util/BaseMixin' ;
26
- import isNumeric from '../_util/isNumeric' ;
27
- import { ConfigConsumerProps } from '../config-provider' ;
28
-
29
- const dimensionMap = {
30
- xs : '480px' ,
31
- sm : '576px' ,
32
- md : '768px' ,
33
- lg : '992px' ,
34
- xl : '1200px' ,
35
- xxl : '1600px' ,
29
+ const dimensionMaxMap = {
30
+ xs : '479.98px' ,
31
+ sm : '575.98px' ,
32
+ md : '767.98px' ,
33
+ lg : '991.98px' ,
34
+ xl : '1199.98px' ,
35
+ xxl : '1599.98px' ,
36
36
} ;
37
37
38
38
// export type CollapseType = 'clickTrigger' | 'responsive';
@@ -44,6 +44,7 @@ export const SiderProps = {
44
44
defaultCollapsed : PropTypes . bool ,
45
45
reverseArrow : PropTypes . bool ,
46
46
// onCollapse?: (collapsed: boolean, type: CollapseType) => void;
47
+ zeroWidthTriggerStyle : PropTypes . object ,
47
48
trigger : PropTypes . any ,
48
49
width : PropTypes . oneOfType ( [ PropTypes . number , PropTypes . string ] ) ,
49
50
collapsedWidth : PropTypes . oneOfType ( [ PropTypes . number , PropTypes . string ] ) ,
@@ -91,8 +92,8 @@ export default {
91
92
matchMedia = window . matchMedia ;
92
93
}
93
94
const props = getOptionProps ( this ) ;
94
- if ( matchMedia && props . breakpoint && props . breakpoint in dimensionMap ) {
95
- this . mql = matchMedia ( `(max-width: ${ dimensionMap [ props . breakpoint ] } )` ) ;
95
+ if ( matchMedia && props . breakpoint && props . breakpoint in dimensionMaxMap ) {
96
+ this . mql = matchMedia ( `(max-width: ${ dimensionMaxMap [ props . breakpoint ] } )` ) ;
96
97
}
97
98
let sCollapsed ;
98
99
if ( 'collapsed' in props ) {
@@ -187,6 +188,7 @@ export default {
187
188
reverseArrow,
188
189
width,
189
190
collapsedWidth,
191
+ zeroWidthTriggerStyle,
190
192
} = getOptionProps ( this ) ;
191
193
const getPrefixCls = this . configProvider . getPrefixCls ;
192
194
const prefixCls = getPrefixCls ( 'layout-sider' , customizePrefixCls ) ;
@@ -203,6 +205,7 @@ export default {
203
205
class = { `${ prefixCls } -zero-width-trigger ${ prefixCls } -zero-width-trigger-${
204
206
reverseArrow ? 'right' : 'left'
205
207
} `}
208
+ style = { zeroWidthTriggerStyle }
206
209
>
207
210
< Icon type = "bars" />
208
211
</ span >
@@ -240,10 +243,10 @@ export default {
240
243
style : divStyle ,
241
244
} ;
242
245
return (
243
- < div { ...divProps } >
246
+ < aside { ...divProps } >
244
247
< div class = { `${ prefixCls } -children` } > { this . $slots . default } </ div >
245
248
{ collapsible || ( this . below && zeroWidthTrigger ) ? triggerDom : null }
246
- </ div >
249
+ </ aside >
247
250
) ;
248
251
} ,
249
252
} ;
0 commit comments