From 1482c75967719edbe001e9c2cf74de72f7c72c8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E6=99=93=E9=9D=99?= <17600756968@163.com> Date: Fri, 29 Jan 2021 22:03:24 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=87=AA=E5=AE=9A=E4=B9=89?= =?UTF-8?q?=E8=A1=A8=E5=A4=B4=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/apolloTable/component/index.tsx | 17 ++++++++--------- .../apolloTable/component/operate/index.tsx | 15 +++++++++------ 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/components/apolloTable/component/index.tsx b/components/apolloTable/component/index.tsx index 1df35f7..2e40c18 100644 --- a/components/apolloTable/component/index.tsx +++ b/components/apolloTable/component/index.tsx @@ -133,10 +133,9 @@ class AirTable extends React.Component { nextState.columns = nextProps.columns; } const operateConfig = nextProps.operateConfig; - const nextGroupConfig: any = - operateConfig && - operateConfig.menusGroup && - operateConfig.menusGroup.find((item: any) => { + const nextGroupConfig: any = operateConfig + && operateConfig.menusGroup + && operateConfig.menusGroup.find((item: any) => { return item.type === 'group'; }); if (nextGroupConfig && JSON.stringify(groupConfig) !== JSON.stringify(nextGroupConfig.value)) { @@ -214,18 +213,18 @@ class AirTable extends React.Component { cachedFeAttr, renderFirstLeft, leftMargin, + selfClass, } = this.props; - const sortConfig = - operateConfig && - operateConfig.menusGroup && - operateConfig.menusGroup.find((item: any) => { + const sortConfig = operateConfig + && operateConfig.menusGroup + && operateConfig.menusGroup.find((item: any) => { return item.type === 'sort'; }); const memDataSource = memoizeData(groupConfig, dataSource); return (
- {operateConfig && } + {operateConfig && }
{tableOperateConfig && (
diff --git a/components/apolloTable/component/operate/index.tsx b/components/apolloTable/component/operate/index.tsx index d629527..57cb7bd 100644 --- a/components/apolloTable/component/operate/index.tsx +++ b/components/apolloTable/component/operate/index.tsx @@ -1,5 +1,6 @@ import React, { Component } from 'react'; import { Button } from 'antd'; +import classname from 'classnames'; import Hide from '../hide'; import Filter from '../filter'; import Sort from '../sort'; @@ -10,6 +11,7 @@ import s from './index.less'; import { OperateConfigProps, ColumnProps } from '../interface'; interface Props { + selfClass?: string; operateConfig?: OperateConfigProps; columns: ColumnProps[]; } @@ -39,7 +41,9 @@ export default class Operate extends Component { }; renderBtn = (btn: any) => { - const { render, label, onClick, type, ghost, icon } = btn; + const { + render, label, onClick, type, ghost, icon, + } = btn; if (typeof render === 'function') { return render(btn); } @@ -52,12 +56,11 @@ export default class Operate extends Component { }; render() { - const { operateConfig, columns } = this.props; + const { operateConfig, columns, selfClass } = this.props; const { menusGroup, buttonsGroup, renderCustomNode, showCondition }: any = operateConfig || {}; - const filter: any = - menusGroup && - menusGroup.find((item: any) => { + const filter: any = menusGroup + && menusGroup.find((item: any) => { return item.type === 'filter'; }); return ( @@ -65,7 +68,7 @@ export default class Operate extends Component { {renderCustomNode && typeof renderCustomNode === 'function' ? renderCustomNode() : null}
{menusGroup && ( -
+
{menusGroup.map((item: any, i: number) => { return (
-- 2.21.0