diff --git a/src/table/PrimaryTable.tsx b/src/table/PrimaryTable.tsx index e619a6b4f..750200896 100644 --- a/src/table/PrimaryTable.tsx +++ b/src/table/PrimaryTable.tsx @@ -1,4 +1,4 @@ -import React, { useRef, forwardRef, useImperativeHandle } from 'react'; +import React, { useRef, forwardRef, useImperativeHandle, useMemo } from 'react'; import get from 'lodash/get'; import classNames from 'classnames'; import BaseTable from './BaseTable'; @@ -171,13 +171,15 @@ const PrimaryTable = forwardRef((props, ref return arr; }; - const tColumns = (() => { + // 影响的因素有: columns、展开/收起行 + const tColumns = useMemo(() => { const cols = getColumns(columns); if (showExpandIconColumn) { cols.unshift(getExpandColumn()); } return cols; - })(); + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [columns, showExpandIconColumn]); const onInnerPageChange = (pageInfo: PageInfo, newData: Array) => { innerPagination.current = { ...innerPagination, ...pageInfo }; diff --git a/src/table/_example/base.jsx b/src/table/_example/base.jsx index dcbface2e..b4d79cbbb 100644 --- a/src/table/_example/base.jsx +++ b/src/table/_example/base.jsx @@ -29,7 +29,7 @@ const statusNameListMap = { export default function TableBasic() { const [stripe, setStripe] = useState(false); - const [bordered, setBordered] = useState(false); + const [bordered, setBordered] = useState(true); const [hover, setHover] = useState(false); const [tableLayout, setTableLayout] = useState(false); const [size, setSize] = useState('medium'); @@ -70,7 +70,6 @@ export default function TableBasic() { rowClassName={({ rowIndex }) => `${rowIndex}-class`} cellEmptyContent={'-'} resizable - bordered // 与pagination对齐 pagination={{ defaultCurrent: 2, diff --git a/test/snap/__snapshots__/csr.test.jsx.snap b/test/snap/__snapshots__/csr.test.jsx.snap index 2178b554a..54541e589 100644 --- a/test/snap/__snapshots__/csr.test.jsx.snap +++ b/test/snap/__snapshots__/csr.test.jsx.snap @@ -191106,10 +191106,10 @@ exports[`csr snapshot test > csr test src/table/_example/base.jsx 1`] = ` > csr test src/table/_example/base.jsx 1`] = ` > ssr test src/table/_example/affix.jsx 1`] = `"
ssr test src/table/_example/async-loading.jsx 1`] = `"
申请人
申请状态
签署方式
邮箱地址
申请时间
贾明
审批通过
电子签署
w.cezkdudy@lhll.au
2022-01-01
张三
审批失败
纸质签署
r.nmgw@peurezgn.sl
2022-02-01
王芳
审批过期
纸质签署
p.cumx@rampblpa.ru
2022-03-01
贾明
审批通过
电子签署
w.cezkdudy@lhll.au
2022-04-01
张三
审批失败
纸质签署
r.nmgw@peurezgn.sl
2022-01-01
loading...
"`; -exports[`ssr snapshot test > ssr test src/table/_example/base.jsx 1`] = `"
申请人
申请状态
签署方式
邮箱地址
申请时间
贾明
审批通过
电子签署
w.cezkdudy@lhll.au
2022-01-01
张三
审批失败
纸质签署
r.nmgw@peurezgn.sl
2022-02-01
王芳
审批过期
纸质签署
p.cumx@rampblpa.ru
2022-03-01
贾明
审批通过
电子签署
w.cezkdudy@lhll.au
2022-04-01
张三
审批失败
纸质签署
r.nmgw@peurezgn.sl
2022-01-01
王芳
审批过期
纸质签署
p.cumx@rampblpa.ru
2022-02-01
贾明
审批通过
电子签署
w.cezkdudy@lhll.au
2022-03-01
张三
审批失败
纸质签署
r.nmgw@peurezgn.sl
2022-04-01
王芳
审批过期
纸质签署
p.cumx@rampblpa.ru
2022-01-01
贾明
审批通过
电子签署
w.cezkdudy@lhll.au
2022-02-01
张三
审批失败
纸质签署
r.nmgw@peurezgn.sl
2022-03-01
王芳
审批过期
纸质签署
p.cumx@rampblpa.ru
2022-04-01
贾明
审批通过
电子签署
w.cezkdudy@lhll.au
2022-01-01
张三
审批失败
纸质签署
r.nmgw@peurezgn.sl
2022-02-01
王芳
审批过期
纸质签署
p.cumx@rampblpa.ru
2022-03-01
贾明
审批通过
电子签署
w.cezkdudy@lhll.au
2022-04-01
张三
审批失败
纸质签署
r.nmgw@peurezgn.sl
2022-01-01
王芳
审批过期
纸质签署
p.cumx@rampblpa.ru
2022-02-01
贾明
审批通过
电子签署
w.cezkdudy@lhll.au
2022-03-01
张三
审批失败
纸质签署
r.nmgw@peurezgn.sl
2022-04-01
王芳
审批过期
纸质签署
p.cumx@rampblpa.ru
2022-01-01
贾明
审批通过
电子签署
w.cezkdudy@lhll.au
2022-02-01
张三
审批失败
纸质签署
r.nmgw@peurezgn.sl
2022-03-01
王芳
审批过期
纸质签署
p.cumx@rampblpa.ru
2022-04-01
贾明
审批通过
电子签署
w.cezkdudy@lhll.au
2022-01-01
张三
审批失败
纸质签署
r.nmgw@peurezgn.sl
2022-02-01
王芳
审批过期
纸质签署
p.cumx@rampblpa.ru
2022-03-01
贾明
审批通过
电子签署
w.cezkdudy@lhll.au
2022-04-01
Total 28 items
please select
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
jump to
/ 6
"`; +exports[`ssr snapshot test > ssr test src/table/_example/base.jsx 1`] = `"
申请人
申请状态
签署方式
邮箱地址
申请时间
贾明
审批通过
电子签署
w.cezkdudy@lhll.au
2022-01-01
张三
审批失败
纸质签署
r.nmgw@peurezgn.sl
2022-02-01
王芳
审批过期
纸质签署
p.cumx@rampblpa.ru
2022-03-01
贾明
审批通过
电子签署
w.cezkdudy@lhll.au
2022-04-01
张三
审批失败
纸质签署
r.nmgw@peurezgn.sl
2022-01-01
王芳
审批过期
纸质签署
p.cumx@rampblpa.ru
2022-02-01
贾明
审批通过
电子签署
w.cezkdudy@lhll.au
2022-03-01
张三
审批失败
纸质签署
r.nmgw@peurezgn.sl
2022-04-01
王芳
审批过期
纸质签署
p.cumx@rampblpa.ru
2022-01-01
贾明
审批通过
电子签署
w.cezkdudy@lhll.au
2022-02-01
张三
审批失败
纸质签署
r.nmgw@peurezgn.sl
2022-03-01
王芳
审批过期
纸质签署
p.cumx@rampblpa.ru
2022-04-01
贾明
审批通过
电子签署
w.cezkdudy@lhll.au
2022-01-01
张三
审批失败
纸质签署
r.nmgw@peurezgn.sl
2022-02-01
王芳
审批过期
纸质签署
p.cumx@rampblpa.ru
2022-03-01
贾明
审批通过
电子签署
w.cezkdudy@lhll.au
2022-04-01
张三
审批失败
纸质签署
r.nmgw@peurezgn.sl
2022-01-01
王芳
审批过期
纸质签署
p.cumx@rampblpa.ru
2022-02-01
贾明
审批通过
电子签署
w.cezkdudy@lhll.au
2022-03-01
张三
审批失败
纸质签署
r.nmgw@peurezgn.sl
2022-04-01
王芳
审批过期
纸质签署
p.cumx@rampblpa.ru
2022-01-01
贾明
审批通过
电子签署
w.cezkdudy@lhll.au
2022-02-01
张三
审批失败
纸质签署
r.nmgw@peurezgn.sl
2022-03-01
王芳
审批过期
纸质签署
p.cumx@rampblpa.ru
2022-04-01
贾明
审批通过
电子签署
w.cezkdudy@lhll.au
2022-01-01
张三
审批失败
纸质签署
r.nmgw@peurezgn.sl
2022-02-01
王芳
审批过期
纸质签署
p.cumx@rampblpa.ru
2022-03-01
贾明
审批通过
电子签署
w.cezkdudy@lhll.au
2022-04-01
Total 28 items
please select
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
jump to
/ 6
"`; exports[`ssr snapshot test > ssr test src/table/_example/custom-cell.jsx 1`] = `"
申请人
审批状态
申请事项
邮箱地址
申请时间
贾明
审批通过
宣传物料制作费用
w.cezkdudy@lhll.au
2022-01-01
张三
审批失败
algolia 服务报销
r.nmgw@peurezgn.sl
2022-02-01
王芳
审批过期
相关周边制作费
p.cumx@rampblpa.ru
2022-03-01
贾明
审批通过
激励奖品快递费
w.cezkdudy@lhll.au
2022-04-01
张三
审批失败
宣传物料制作费用
r.nmgw@peurezgn.sl
2022-01-01
"`;