mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-02 03:59:01 +08:00
Merge branch '1.x-stable'
This commit is contained in:
commit
6dad2b2987
@ -59,11 +59,15 @@ export default class Affix extends React.Component<AffixProps, any> {
|
||||
super(props);
|
||||
this.state = {
|
||||
affixStyle: null,
|
||||
placeholderStyle: null,
|
||||
};
|
||||
}
|
||||
|
||||
setAffixStyle(affixStyle) {
|
||||
setAffixStyle(e, affixStyle) {
|
||||
const originalAffixStyle = this.state.affixStyle;
|
||||
if (e.type === 'scroll' && originalAffixStyle && affixStyle) {
|
||||
return;
|
||||
}
|
||||
if (shallowequal(affixStyle, originalAffixStyle)) {
|
||||
return;
|
||||
}
|
||||
@ -76,7 +80,18 @@ export default class Affix extends React.Component<AffixProps, any> {
|
||||
});
|
||||
}
|
||||
|
||||
handleScroll = () => {
|
||||
setPlaceholderStyle(e, placeholderStyle) {
|
||||
const originalPlaceholderStyle = this.state.placeholderStyle;
|
||||
if (e.type === 'resize') {
|
||||
return;
|
||||
}
|
||||
if (shallowequal(placeholderStyle, originalPlaceholderStyle)) {
|
||||
return;
|
||||
}
|
||||
this.setState({ placeholderStyle });
|
||||
}
|
||||
|
||||
handleScroll = (e) => {
|
||||
let { offsetTop, offsetBottom, offset } = this.props;
|
||||
|
||||
// Backwards support
|
||||
@ -99,23 +114,32 @@ export default class Affix extends React.Component<AffixProps, any> {
|
||||
|
||||
if (scrollTop > elemOffset.top - offsetTop && offsetMode.top) {
|
||||
// Fixed Top
|
||||
this.setAffixStyle({
|
||||
this.setAffixStyle(e, {
|
||||
position: 'fixed',
|
||||
top: offsetTop,
|
||||
left: elemOffset.left,
|
||||
width: ReactDOM.findDOMNode(this).offsetWidth,
|
||||
});
|
||||
this.setPlaceholderStyle(e, {
|
||||
width: ReactDOM.findDOMNode(this).offsetWidth,
|
||||
height: ReactDOM.findDOMNode(this).offsetHeight,
|
||||
});
|
||||
} else if (scrollTop < elemOffset.top + elemSize.height + offsetBottom - window.innerHeight &&
|
||||
offsetMode.bottom) {
|
||||
// Fixed Bottom
|
||||
this.setAffixStyle({
|
||||
this.setAffixStyle(e, {
|
||||
position: 'fixed',
|
||||
bottom: offsetBottom,
|
||||
left: elemOffset.left,
|
||||
width: ReactDOM.findDOMNode(this).offsetWidth,
|
||||
});
|
||||
this.setPlaceholderStyle(e, {
|
||||
width: ReactDOM.findDOMNode(this).offsetWidth,
|
||||
height: ReactDOM.findDOMNode(this).offsetHeight,
|
||||
});
|
||||
} else {
|
||||
this.setAffixStyle(null);
|
||||
this.setAffixStyle(e, null);
|
||||
this.setPlaceholderStyle(e, null);
|
||||
}
|
||||
}
|
||||
|
||||
@ -144,7 +168,7 @@ export default class Affix extends React.Component<AffixProps, any> {
|
||||
delete props.offsetBottom;
|
||||
|
||||
return (
|
||||
<div {...props}>
|
||||
<div {...props} style={this.state.placeholderStyle}>
|
||||
<div className={className} ref="fixedNode" style={this.state.affixStyle}>
|
||||
{this.props.children}
|
||||
</div>
|
||||
|
@ -18,6 +18,8 @@
|
||||
cursor: pointer;
|
||||
vertical-align: middle;
|
||||
font-size: @font-size-base;
|
||||
background-color: #fff;
|
||||
border-radius: @border-radius-base;
|
||||
|
||||
&-disabled {
|
||||
cursor: not-allowed;
|
||||
|
@ -162,8 +162,8 @@ export default class FormItem extends React.Component {
|
||||
}
|
||||
|
||||
return props.label ? (
|
||||
<Col {...labelCol}>
|
||||
<label htmlFor={props.id || this.getId()} className={className} key="label">
|
||||
<Col {...labelCol} key="label" className={`${props.prefixCls}-item-label`}>
|
||||
<label htmlFor={props.id || this.getId()} className={className}>
|
||||
{label}
|
||||
</label>
|
||||
</Col>
|
||||
|
@ -80,7 +80,7 @@ input[type="checkbox"] {
|
||||
margin-bottom: @form-item-margin-bottom - @font-size-base * @line-height-base - 3;
|
||||
}
|
||||
|
||||
> div:first-child {
|
||||
&-label {
|
||||
text-align: right;
|
||||
vertical-align: middle;
|
||||
padding: 7px 0;
|
||||
|
@ -157,7 +157,7 @@ export default class Input extends Component {
|
||||
});
|
||||
|
||||
if ('value' in props) {
|
||||
props.value = fixControlledValue(props.value);
|
||||
otherProps.value = fixControlledValue(props.value);
|
||||
// Input elements must be either controlled or uncontrolled,
|
||||
// specify either the value prop, or the defaultValue prop, but not both.
|
||||
delete otherProps.defaultValue;
|
||||
|
@ -214,6 +214,12 @@
|
||||
table {
|
||||
border: 0;
|
||||
}
|
||||
.@{table-prefix-cls}-fixed-left {
|
||||
border-right: 1px solid @border-color-split;
|
||||
}
|
||||
.@{table-prefix-cls}-fixed-right {
|
||||
border-left: 1px solid @border-color-split;
|
||||
}
|
||||
}
|
||||
|
||||
th {
|
||||
@ -341,7 +347,7 @@
|
||||
width: 17px;
|
||||
height: 17px;
|
||||
text-align: center;
|
||||
line-height: 15px;
|
||||
line-height: 14px;
|
||||
border: 1px solid @border-color-split;
|
||||
user-select: none;
|
||||
background: #fff;
|
||||
@ -422,8 +428,8 @@
|
||||
}
|
||||
}
|
||||
|
||||
&-fixed-left &-fixed,
|
||||
&-fixed-right &-fixed {
|
||||
&-fixed-header &-fixed-left &-body-outer &-fixed,
|
||||
&-fixed-header &-fixed-right &-body-outer &-fixed {
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
|
@ -76,7 +76,7 @@
|
||||
"devDependencies": {
|
||||
"antd-tools": "^0.9.0",
|
||||
"babel-eslint": "^6.0.2",
|
||||
"babel-jest": "^12.0.2",
|
||||
"babel-jest": "^13.2.2",
|
||||
"babel-plugin-antd": "^0.4.0",
|
||||
"bisheng": "^0.7.1",
|
||||
"bisheng-plugin-antd": "0.1.0",
|
||||
@ -86,7 +86,7 @@
|
||||
"dora-plugin-upload": "^0.3.1",
|
||||
"enquire.js": "^2.1.1",
|
||||
"es6-shim": "^0.35.0",
|
||||
"eslint": "^2.2.0",
|
||||
"eslint": "^3.0.1",
|
||||
"eslint-config-airbnb": "^9.0.1",
|
||||
"eslint-plugin-babel": "^3.0.0",
|
||||
"eslint-plugin-import": "^1.6.1",
|
||||
@ -97,7 +97,7 @@
|
||||
"history": "^2.0.1",
|
||||
"intl": "^1.2.2",
|
||||
"intl-locales-supported": "^1.0.0",
|
||||
"jest-cli": "^12.0.2",
|
||||
"jest-cli": "^13.2.3",
|
||||
"jsonml-to-react-component": "~0.2.0",
|
||||
"jsonml.js": "^0.1.0",
|
||||
"jsonp": "^0.2.0",
|
||||
|
@ -6,6 +6,7 @@ import path from 'path';
|
||||
describe('antd dist files', function() {
|
||||
const distFilesExisted = fs.existsSync(path.join(process.cwd(), 'dist', 'antd.js'));
|
||||
if (!distFilesExisted) {
|
||||
it('empty test case placeholder', () => {});
|
||||
return;
|
||||
} else {
|
||||
jest.unmock('../dist/antd');
|
||||
|
@ -21,7 +21,7 @@ describe('Popover', function() {
|
||||
);
|
||||
|
||||
const popup = popover.getPopupDomNode();
|
||||
expect(popup).not.toBe(undefined);
|
||||
expect(popup).not.toBe(null);
|
||||
expect(popup.className).toContain('ant-popover-placement-top');
|
||||
expect(popup.innerHTML).toMatch(/<div class="ant-popover-title".*?>code<\/div>/);
|
||||
expect(popup.innerHTML).toMatch(/<div class="ant-popover-inner-content".*?>console\.log\('hello world'\)<\/div>/);
|
||||
|
Loading…
Reference in New Issue
Block a user