Merge branch 'master' into feature

This commit is contained in:
陈帅 2018-12-13 22:48:08 +08:00
commit 30d65ef46e
2 changed files with 19 additions and 7 deletions

View File

@ -78,9 +78,11 @@ export default class Menu extends React.Component<MenuProps, MenuState> {
siderCollapsed: PropTypes.bool, siderCollapsed: PropTypes.bool,
collapsedWidth: PropTypes.oneOfType([PropTypes.number, PropTypes.string]), collapsedWidth: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
}; };
context: any; context: any;
switchingModeFromInline: boolean; switchingModeFromInline: boolean;
inlineOpenKeys: string[] = []; inlineOpenKeys: string[] = [];
constructor(props: MenuProps) { constructor(props: MenuProps) {
super(props); super(props);
@ -106,16 +108,19 @@ export default class Menu extends React.Component<MenuProps, MenuState> {
openKeys: openKeys || [], openKeys: openKeys || [],
}; };
} }
getChildContext() { getChildContext() {
return { return {
inlineCollapsed: this.getInlineCollapsed(), inlineCollapsed: this.getInlineCollapsed(),
antdMenuTheme: this.props.theme, antdMenuTheme: this.props.theme,
}; };
} }
componentWillReceiveProps(nextProps: MenuProps, nextContext: SiderContext) { componentWillReceiveProps(nextProps: MenuProps, nextContext: SiderContext) {
if (this.props.mode === 'inline' && nextProps.mode !== 'inline') { if (this.props.mode === 'inline' && nextProps.mode !== 'inline') {
this.switchingModeFromInline = true; this.switchingModeFromInline = true;
} }
if ('openKeys' in nextProps) { if ('openKeys' in nextProps) {
this.setState({ openKeys: nextProps.openKeys! }); this.setState({ openKeys: nextProps.openKeys! });
return; return;
@ -136,12 +141,14 @@ export default class Menu extends React.Component<MenuProps, MenuState> {
this.inlineOpenKeys = []; this.inlineOpenKeys = [];
} }
} }
restoreModeVerticalFromInline() { restoreModeVerticalFromInline() {
if (this.switchingModeFromInline) { if (this.switchingModeFromInline) {
this.switchingModeFromInline = false; this.switchingModeFromInline = false;
this.setState({}); this.setState({});
} }
} }
// Restore vertical mode when menu is collapsed responsively when mounted // Restore vertical mode when menu is collapsed responsively when mounted
// https://github.com/ant-design/ant-design/issues/13104 // https://github.com/ant-design/ant-design/issues/13104
// TODO: not a perfect solution, looking a new way to avoid setting switchingModeFromInline in this situation // TODO: not a perfect solution, looking a new way to avoid setting switchingModeFromInline in this situation
@ -185,6 +192,7 @@ export default class Menu extends React.Component<MenuProps, MenuState> {
this.setState({ openKeys }); this.setState({ openKeys });
} }
} }
getRealMenuMode() { getRealMenuMode() {
const inlineCollapsed = this.getInlineCollapsed(); const inlineCollapsed = this.getInlineCollapsed();
if (this.switchingModeFromInline && inlineCollapsed) { if (this.switchingModeFromInline && inlineCollapsed) {
@ -193,6 +201,7 @@ export default class Menu extends React.Component<MenuProps, MenuState> {
const { mode } = this.props; const { mode } = this.props;
return inlineCollapsed ? 'vertical' : mode; return inlineCollapsed ? 'vertical' : mode;
} }
getInlineCollapsed() { getInlineCollapsed() {
const { inlineCollapsed } = this.props; const { inlineCollapsed } = this.props;
if (this.context.siderCollapsed !== undefined) { if (this.context.siderCollapsed !== undefined) {
@ -200,6 +209,7 @@ export default class Menu extends React.Component<MenuProps, MenuState> {
} }
return inlineCollapsed; return inlineCollapsed;
} }
getMenuOpenAnimation(menuMode: MenuMode) { getMenuOpenAnimation(menuMode: MenuMode) {
const { openAnimation, openTransitionName } = this.props; const { openAnimation, openTransitionName } = this.props;
let menuOpenAnimation = openAnimation || openTransitionName; let menuOpenAnimation = openAnimation || openTransitionName;

View File

@ -41,7 +41,6 @@
@font-family : "Chinese Quote", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif, @font-family : "Chinese Quote", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif,
"Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
@code-family : "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace; @code-family : "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace;
@heading-color : fade(@black, 85%);
@text-color : fade(@black, 65%); @text-color : fade(@black, 65%);
@text-color-secondary : fade(@black, 45%); @text-color-secondary : fade(@black, 45%);
@text-color-inverse : @white; @text-color-inverse : @white;
@ -50,7 +49,6 @@
@text-color-dark : fade(@white, 85%); @text-color-dark : fade(@white, 85%);
@text-color-secondary-dark: fade(@white, 65%); @text-color-secondary-dark: fade(@white, 65%);
@font-variant-base : tabular-nums;
@font-size-base : 14px; @font-size-base : 14px;
@font-size-lg : @font-size-base + 2px; @font-size-lg : @font-size-base + 2px;
@font-size-sm : 12px; @font-size-sm : 12px;
@ -102,7 +100,7 @@
// Border color // Border color
@border-color-base : hsv(0, 0, 85%); // base border outline a component @border-color-base : hsv(0, 0, 85%); // base border outline a component
@border-color-split : hsv(0, 0, 91%); // split border inside a component @border-color-split : hsv(0, 0, 91%); // split border inside a component
@border-color-inverse : @white; @border-color-inverse: @white;
@border-width-base : 1px; // width of the border for a component @border-width-base : 1px; // width of the border for a component
@border-style-base : solid; // style of a components border @border-style-base : solid; // style of a components border
@ -120,8 +118,6 @@
@disabled-color-dark : fade(#fff, 35%); @disabled-color-dark : fade(#fff, 35%);
// Shadow // Shadow
@shadow-color-inverse : @component-background;
@shadow-1-up : 0 -2px 8px @shadow-color;
@shadow-1-down : 0 2px 8px @shadow-color; @shadow-1-down : 0 2px 8px @shadow-color;
@shadow-1-left : -2px 0 8px @shadow-color; @shadow-1-left : -2px 0 8px @shadow-color;
@shadow-1-right : 2px 0 8px @shadow-color; @shadow-1-right : 2px 0 8px @shadow-color;
@ -275,8 +271,8 @@
@input-color : @text-color; @input-color : @text-color;
@input-border-color : @border-color-base; @input-border-color : @border-color-base;
@input-bg : #fff; @input-bg : #fff;
@input-number-handler-active-bg : #f4f4f4; @input-number-handler-active-bg: #f4f4f4;
@input-addon-bg : @background-color-light; @input-addon-bg: @background-color-light;
@input-hover-border-color : @primary-color; @input-hover-border-color : @primary-color;
@input-disabled-bg : @disabled-bg; @input-disabled-bg : @disabled-bg;
@input-outline-offset : 0 0; @input-outline-offset : 0 0;
@ -288,6 +284,8 @@
//** Tooltip text color //** Tooltip text color
@tooltip-color: #fff; @tooltip-color: #fff;
//** Tooltip background color //** Tooltip background color
@tooltip-bg: rgba(0, 0, 0, 0.75);
//** Tooltip arrow width
@tooltip-arrow-width: 5px; @tooltip-arrow-width: 5px;
//** Tooltip distance with trigger //** Tooltip distance with trigger
@tooltip-distance: @tooltip-arrow-width - 1px + 4px; @tooltip-distance: @tooltip-arrow-width - 1px + 4px;
@ -403,6 +401,10 @@
@card-padding-wider: 32px; @card-padding-wider: 32px;
@card-actions-background: @background-color-light; @card-actions-background: @background-color-light;
@card-background: #cfd8dc; @card-background: #cfd8dc;
@card-shadow: 0 2px 8px rgba(0, 0, 0, 0.09);
// Comment
// ---
@comment-padding-base: 16px 0; @comment-padding-base: 16px 0;
@comment-nest-indent: 44px; @comment-nest-indent: 44px;
@comment-author-name-color: @text-color-secondary; @comment-author-name-color: @text-color-secondary;