import React, { FC } from 'react';
import { Empty } from 'antd-mobile';
import DataGrip, { DataGripConfig } from '../DataGrip';

interface Props {
  columnJson: any[];
  queryList: any[];
  condition: any;
  shouldLoad: boolean;
  actions: Array<any>;
  config?: XListConfig;
  [key: string]: any;
}
// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface XListConfig extends DataGripConfig {

}

const XList: FC<Props> = ({
  totalPage,
  actions,
  loadData,
  columnJson,
  queryList,
  condition,
  shouldLoad,
  config,
}) => {
  return (
    <>
      {columnJson?.length !== 0 ? (
        <>
          <div style={{ paddingTop: '3px' }}>
            {totalPage === 0 ? (
              <Empty description="暂无数据" />
            ) : (
              <DataGrip
                loadData={loadData}
                queryList={queryList}
                shouldLoad={shouldLoad}
                columnJson={columnJson}
                condition={condition}
                totalPage={totalPage}
                actions={actions}
                config={config}
              />
            )}
          </div>
        </>
      ) : (
        <></>
      )}
    </>
  );
};
XList.defaultProps = {
  conditionParams: {},
};

export default XList
