Skip to content

Commit 45ff670

Browse files
committed
feat: update layout
1 parent 6b6bacc commit 45ff670

File tree

7 files changed

+207
-199
lines changed

7 files changed

+207
-199
lines changed

build/config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module.exports = {
22
dev: {
3-
componentName: 'input-number', // dev components
3+
componentName: 'layout', // dev components
44
},
55
};

components/layout/Sider.jsx

Lines changed: 28 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
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+
115
// matchMedia polyfill for
216
// https://github.com/WickyNilliams/enquire.js/issues/82
317
if (typeof window !== 'undefined') {
@@ -12,27 +26,13 @@ if (typeof window !== 'undefined') {
1226
window.matchMedia = window.matchMedia || matchMediaPolyfill;
1327
}
1428

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',
3636
};
3737

3838
// export type CollapseType = 'clickTrigger' | 'responsive';
@@ -44,6 +44,7 @@ export const SiderProps = {
4444
defaultCollapsed: PropTypes.bool,
4545
reverseArrow: PropTypes.bool,
4646
// onCollapse?: (collapsed: boolean, type: CollapseType) => void;
47+
zeroWidthTriggerStyle: PropTypes.object,
4748
trigger: PropTypes.any,
4849
width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
4950
collapsedWidth: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
@@ -91,8 +92,8 @@ export default {
9192
matchMedia = window.matchMedia;
9293
}
9394
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]})`);
9697
}
9798
let sCollapsed;
9899
if ('collapsed' in props) {
@@ -187,6 +188,7 @@ export default {
187188
reverseArrow,
188189
width,
189190
collapsedWidth,
191+
zeroWidthTriggerStyle,
190192
} = getOptionProps(this);
191193
const getPrefixCls = this.configProvider.getPrefixCls;
192194
const prefixCls = getPrefixCls('layout-sider', customizePrefixCls);
@@ -203,6 +205,7 @@ export default {
203205
class={`${prefixCls}-zero-width-trigger ${prefixCls}-zero-width-trigger-${
204206
reverseArrow ? 'right' : 'left'
205207
}`}
208+
style={zeroWidthTriggerStyle}
206209
>
207210
<Icon type="bars" />
208211
</span>
@@ -240,10 +243,10 @@ export default {
240243
style: divStyle,
241244
};
242245
return (
243-
<div {...divProps}>
246+
<aside {...divProps}>
244247
<div class={`${prefixCls}-children`}>{this.$slots.default}</div>
245248
{collapsible || (this.below && zeroWidthTrigger) ? triggerDom : null}
246-
</div>
249+
</aside>
247250
);
248251
},
249252
};

0 commit comments

Comments
 (0)