From 18e61d77815961d4f7b7f3a9db25c3a725dbc238 Mon Sep 17 00:00:00 2001 From: mertsincan Date: Tue, 10 Mar 2020 13:17:04 +0300 Subject: [PATCH] Fixed #1079 - Change the type of the 'header' property on TabPanel --- src/components/tabview/TabView.d.ts | 2 +- src/components/tabview/TabView.js | 22 +++++++++++----------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/components/tabview/TabView.d.ts b/src/components/tabview/TabView.d.ts index 35aa4f045a..d82de677d1 100644 --- a/src/components/tabview/TabView.d.ts +++ b/src/components/tabview/TabView.d.ts @@ -1,7 +1,7 @@ import * as React from 'react'; interface TabPanelProps { - header?: string; + header?: any; leftIcon?: string; rightIcon?: string; disabled?: boolean; diff --git a/src/components/tabview/TabView.js b/src/components/tabview/TabView.js index f29925ee3a..62a2b6dc1b 100644 --- a/src/components/tabview/TabView.js +++ b/src/components/tabview/TabView.js @@ -4,7 +4,7 @@ import classNames from 'classnames'; import UniqueComponentId from '../utils/UniqueComponentId'; export class TabPanel extends Component { - + static defaultProps = { header: null, leftIcon: null, @@ -17,7 +17,7 @@ export class TabPanel extends Component { } static propTypes = { - header: PropTypes.string, + header: PropTypes.any, leftIcon: PropTypes.string, rightIcon: PropTypes.string, disabled: PropTypes.bool, @@ -26,7 +26,7 @@ export class TabPanel extends Component { contentStyle: PropTypes.object, contentClassName: PropTypes.string }; - + } export class TabView extends Component { @@ -48,7 +48,7 @@ export class TabView extends Component { renderActiveOnly: PropTypes.bool, onTabChange: PropTypes.func }; - + constructor(props) { super(props); if (!this.props.onTabChange) { @@ -65,7 +65,7 @@ export class TabView extends Component { return (activeIndex === index); } - + onTabHeaderClick(event, tab, index) { if (!tab.props.disabled) { if (this.props.onTabChange) { @@ -80,7 +80,7 @@ export class TabView extends Component { event.preventDefault(); } - + renderTabHeader(tab, index) { const selected = this.isSelected(index); const className = classNames(tab.props.headerClassName, 'p-unselectable-text', {'p-tabview-selected p-highlight': selected, 'p-disabled': tab.props.disabled}); @@ -105,17 +105,17 @@ export class TabView extends Component { }) ); } - + renderNavigator() { const headers = this.renderTabHeaders(); - + return ( ); } - + renderContent() { const contents = React.Children.map(this.props.children, (tab, index) => { if (!this.props.renderActiveOnly || this.isSelected(index)) { @@ -148,7 +148,7 @@ export class TabView extends Component { const className = classNames('p-tabview p-component p-tabview-top', this.props.className) const navigator = this.renderNavigator(); const content = this.renderContent(); - + return (
{navigator} @@ -156,4 +156,4 @@ export class TabView extends Component {
); } -} \ No newline at end of file +}