import React from 'react'; import styles from './index.less'; import { CommonProps, CommonState } from './interface'; import Table from './Table'; class AirTable extends React.Component { static getDerivedStateFromProps(nextProps: CommonProps, prevState: CommonState) { const { prevProps } = prevState; let nextState: CommonState = { ...prevState, prevProps: nextProps, }; if (JSON.stringify(prevProps.dataSource) !== JSON.stringify(nextProps.dataSource)) { nextState.dataSource = nextProps.dataSource; } if (JSON.stringify(prevProps.columns) !== JSON.stringify(nextProps.columns)) { nextState.columns = nextProps.columns; } if (prevProps.tableId !== nextProps.tableId) { nextState.tableId = nextProps.tableId; } return nextState; } constructor(props: CommonProps) { super(props); const { columns, dataSource, tableId } = props; this.state = { prevProps: props, columns, dataSource, tableId, }; } onScroll = () => { const { onScroll } = this.props; if (typeof onScroll === 'function') { onScroll(); } }; render() { const { columns, dataSource, tableId } = this.state; const { rowStyle, rowClassName } = this.props; const operateConfig = {}; return (
); } } export default AirTable;