Skip to content

Commit

Permalink
fix(Checkbox): allow pass title to label
Browse files Browse the repository at this point in the history
* fix(Checkbox): allow pass title to label
* fix(Tab): compatiable with 0.x Tab.TabPane
* temp(Tab): remove redundant
* temp(Tab): add deprecated log
  • Loading branch information
wwsun authored Feb 10, 2020
1 parent c921c89 commit fd36f8c
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
3 changes: 3 additions & 0 deletions src/checkbox/checkbox.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,9 @@ class Checkbox extends UIState {

const others = obj.pickOthers(Checkbox.propTypes, otherProps);
const othersData = obj.pickAttrsWith(others, 'data-');
if (otherProps.title) {
othersData.title = otherProps.title;
}

let childInput = (
<input
Expand Down
10 changes: 10 additions & 0 deletions src/tab/index.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
import ConfigProvider from '../config-provider';
import Tab from './tab';
import Item from './tabs/tab-item';

Tab.Item = Item;

Tab.TabPane = ConfigProvider.config(Item, {
transform: (props, deprecated) => {
deprecated('Tab.TabPane', 'Tab.Item', 'Tab');
return props;
},
});

export default ConfigProvider.config(Tab, {
transform: /* istanbul ignore next */ (props, deprecated) => {
Expand Down
3 changes: 0 additions & 3 deletions src/tab/tab.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import classnames from 'classnames';
import { KEYCODE, obj } from '../util';
import TabNav from './tabs/nav';
import TabContent from './tabs/content';
import TabItem from './tabs/tab-item';
import { toArray } from './tabs/utils';

const noop = () => {};
Expand Down Expand Up @@ -323,5 +322,3 @@ export default class Tab extends Component {
);
}
}

Tab.Item = TabItem;
1 change: 1 addition & 0 deletions src/tab/tabs/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export function toArray(children) {
ret.push(
React.cloneElement(child, {
key: child.key || index,
title: child.props.title || child.props.tab,
})
);
}
Expand Down

0 comments on commit fd36f8c

Please sign in to comment.