| | |
| | | |
| | | const SettingComponent = asyncComponent(() => import('../tabsetting')) |
| | | const TabLabelComponent = asyncComponent(() => import('../tablabelform')) |
| | | const TabComponents = asyncComponent(() => import('../tabcomponents')) |
| | | |
| | | const { TabPane } = Tabs |
| | | const { confirm } = Modal |
| | | |
| | | class antvBarLineChart extends Component { |
| | | static propTpyes = { |
| | | config: PropTypes.object, |
| | | menu: PropTypes.object, |
| | | tabs: PropTypes.object, |
| | | updateConfig: PropTypes.func, |
| | | } |
| | |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | const { tabs, config } = this.props |
| | | const { tabs } = this.props |
| | | |
| | | if (tabs.isNew) { |
| | | let name = '' |
| | | let i = 1 |
| | | |
| | | while (!name) { |
| | | let _name = '标签页' + i |
| | | if (config.components.filter(com => com.setting && com.setting.name === _name).length === 0) { |
| | | name = _name |
| | | } |
| | | i++ |
| | | } |
| | | |
| | | let _tabs = { |
| | | uuid: tabs.uuid, |
| | | type: tabs.type, |
| | | floor: tabs.floor, |
| | | subtype: tabs.subtype, |
| | | setting: {span: 12, position: 'top', tabStyle: 'line', name}, |
| | | setting: {span: 12, position: 'top', tabStyle: 'line', name: tabs.name}, |
| | | subtabs: [{ |
| | | uuid: Utils.getuuid(), |
| | | label: 'Tab 1', |
| | | icon: '', |
| | | subcomponents: [], |
| | | components: [], |
| | | }, { |
| | | uuid: Utils.getuuid(), |
| | | label: 'Tab 2', |
| | | icon: '', |
| | | subcomponents: [], |
| | | components: [], |
| | | }, { |
| | | uuid: Utils.getuuid(), |
| | | label: 'Tab 3', |
| | | icon: '', |
| | | subcomponents: [], |
| | | components: [], |
| | | }] |
| | | } |
| | | this.setState({ |
| | |
| | | } |
| | | } |
| | | |
| | | componentDidMount () { } |
| | | |
| | | UNSAFE_componentWillReceiveProps (nextProps) { |
| | | if (!is(fromJS(this.props.plot), fromJS(nextProps.plot))) { |
| | | |
| | | } |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | | return !is(fromJS(this.props), fromJS(nextProps)) || !is(fromJS(this.state), fromJS(nextState)) |
| | | return !is(fromJS(this.state), fromJS(nextState)) |
| | | } |
| | | |
| | | updateComponent = (component) => { |
| | | |
| | | this.setState({ |
| | | tabs: component |
| | | }) |
| | | this.props.updateConfig(component) |
| | | } |
| | | |
| | | updateTabComponent = (tab) => { |
| | | let tabs = fromJS(this.state.tabs).toJS() |
| | | |
| | | tabs.subtabs = tabs.subtabs.map(t => { |
| | | if (t.uuid === tab.uuid) { |
| | | return tab |
| | | } else { |
| | | return t |
| | | } |
| | | }) |
| | | |
| | | this.setState({tabs}) |
| | | this.props.updateConfig(tabs) |
| | | } |
| | | |
| | | tabAdd = (e) => { |
| | |
| | | uuid: '', |
| | | label: '', |
| | | icon: '', |
| | | subcomponents: [] |
| | | components: [] |
| | | }, |
| | | labelvisible: true |
| | | }) |
| | |
| | | } |
| | | |
| | | render() { |
| | | const { menu } = this.props |
| | | const { tabs, dict, labelvisible, editab } = this.state |
| | | |
| | | return ( |
| | |
| | | <span>{tab.icon ? <Icon type={tab.icon} /> : null}{tab.label}</span> |
| | | </Popover> |
| | | } key={tab.uuid}> |
| | | Content of Tab Pane {tab.label} |
| | | {/* Content of Tab Pane {tab.label} */} |
| | | <TabComponents menu={menu} config={tab} handleList={this.updateTabComponent} deleteCard={this.deleteCard} /> |
| | | </TabPane> |
| | | ))} |
| | | <TabPane className="tab-add" disabled tab={<Icon onClick={this.tabAdd} type="plus" />} key="add"></TabPane> |