mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-02 03:48:13 +08:00
fix: 修复table中combineNum不生效 (#5003)
This commit is contained in:
parent
ee90a557a4
commit
2635eb9114
@ -920,8 +920,7 @@ export const TableStore = iRendererStore
|
||||
: 0);
|
||||
|
||||
const keys: Array<string> = [];
|
||||
const len = columns.length;
|
||||
for (let i = 0; i < len; i++) {
|
||||
for (let i = 0; i < maxCount; i++) {
|
||||
const column = columns[i];
|
||||
|
||||
// maxCount 可能比实际配置的 columns 还有多。
|
||||
|
@ -323,8 +323,7 @@ test('Renderer:table combineNum', () => {
|
||||
{
|
||||
type: 'table',
|
||||
source: '$rows',
|
||||
className: 'm-b-none',
|
||||
combineNum: 3,
|
||||
combineNum: 1,
|
||||
columnsTogglable: false,
|
||||
columns: [
|
||||
{
|
||||
|
@ -2784,7 +2784,7 @@ exports[`Renderer:table combineNum 1`] = `
|
||||
class="cxd-Service"
|
||||
>
|
||||
<div
|
||||
class="cxd-Table m-b-none"
|
||||
class="cxd-Table"
|
||||
>
|
||||
<div
|
||||
class="cxd-Table-contentWrap"
|
||||
@ -3005,7 +3005,6 @@ exports[`Renderer:table combineNum 1`] = `
|
||||
>
|
||||
<td
|
||||
class=""
|
||||
rowspan="3"
|
||||
>
|
||||
<span
|
||||
class="cxd-PlainField"
|
||||
@ -3048,7 +3047,15 @@ exports[`Renderer:table combineNum 1`] = `
|
||||
>
|
||||
<td
|
||||
class=""
|
||||
rowspan="2"
|
||||
>
|
||||
<span
|
||||
class="cxd-PlainField"
|
||||
>
|
||||
AOL browser (AOL desktop)
|
||||
</span>
|
||||
</td>
|
||||
<td
|
||||
class=""
|
||||
>
|
||||
<span
|
||||
class="cxd-PlainField"
|
||||
@ -3080,6 +3087,24 @@ exports[`Renderer:table combineNum 1`] = `
|
||||
data-id="5"
|
||||
data-index="4"
|
||||
>
|
||||
<td
|
||||
class=""
|
||||
>
|
||||
<span
|
||||
class="cxd-PlainField"
|
||||
>
|
||||
AOL browser (AOL desktop)
|
||||
</span>
|
||||
</td>
|
||||
<td
|
||||
class=""
|
||||
>
|
||||
<span
|
||||
class="cxd-PlainField"
|
||||
>
|
||||
Win 98
|
||||
</span>
|
||||
</td>
|
||||
<td
|
||||
class=""
|
||||
>
|
||||
@ -3116,7 +3141,6 @@ exports[`Renderer:table combineNum 1`] = `
|
||||
</td>
|
||||
<td
|
||||
class=""
|
||||
rowspan="2"
|
||||
>
|
||||
<span
|
||||
class="cxd-PlainField"
|
||||
@ -3126,7 +3150,6 @@ exports[`Renderer:table combineNum 1`] = `
|
||||
</td>
|
||||
<td
|
||||
class=""
|
||||
rowspan="2"
|
||||
>
|
||||
<span
|
||||
class="cxd-PlainField"
|
||||
@ -3158,6 +3181,24 @@ exports[`Renderer:table combineNum 1`] = `
|
||||
data-id="7"
|
||||
data-index="6"
|
||||
>
|
||||
<td
|
||||
class=""
|
||||
>
|
||||
<span
|
||||
class="cxd-PlainField"
|
||||
>
|
||||
Firefox 1.0
|
||||
</span>
|
||||
</td>
|
||||
<td
|
||||
class=""
|
||||
>
|
||||
<span
|
||||
class="cxd-PlainField"
|
||||
>
|
||||
Win 98+ / OSX.2+
|
||||
</span>
|
||||
</td>
|
||||
<td
|
||||
class=""
|
||||
>
|
||||
@ -3184,7 +3225,6 @@ exports[`Renderer:table combineNum 1`] = `
|
||||
>
|
||||
<td
|
||||
class=""
|
||||
rowspan="3"
|
||||
>
|
||||
<span
|
||||
class="cxd-PlainField"
|
||||
@ -3194,7 +3234,6 @@ exports[`Renderer:table combineNum 1`] = `
|
||||
</td>
|
||||
<td
|
||||
class=""
|
||||
rowspan="3"
|
||||
>
|
||||
<span
|
||||
class="cxd-PlainField"
|
||||
@ -3204,7 +3243,6 @@ exports[`Renderer:table combineNum 1`] = `
|
||||
</td>
|
||||
<td
|
||||
class=""
|
||||
rowspan="3"
|
||||
>
|
||||
<span
|
||||
class="cxd-PlainField"
|
||||
@ -3227,6 +3265,33 @@ exports[`Renderer:table combineNum 1`] = `
|
||||
data-id="9"
|
||||
data-index="8"
|
||||
>
|
||||
<td
|
||||
class=""
|
||||
>
|
||||
<span
|
||||
class="cxd-PlainField"
|
||||
>
|
||||
Firefox 2.0
|
||||
</span>
|
||||
</td>
|
||||
<td
|
||||
class=""
|
||||
>
|
||||
<span
|
||||
class="cxd-PlainField"
|
||||
>
|
||||
Win 98+ / OSX.2+
|
||||
</span>
|
||||
</td>
|
||||
<td
|
||||
class=""
|
||||
>
|
||||
<span
|
||||
class="cxd-PlainField"
|
||||
>
|
||||
5
|
||||
</span>
|
||||
</td>
|
||||
<td
|
||||
class=""
|
||||
>
|
||||
@ -3242,6 +3307,33 @@ exports[`Renderer:table combineNum 1`] = `
|
||||
data-id="10"
|
||||
data-index="9"
|
||||
>
|
||||
<td
|
||||
class=""
|
||||
>
|
||||
<span
|
||||
class="cxd-PlainField"
|
||||
>
|
||||
Firefox 2.0
|
||||
</span>
|
||||
</td>
|
||||
<td
|
||||
class=""
|
||||
>
|
||||
<span
|
||||
class="cxd-PlainField"
|
||||
>
|
||||
Win 98+ / OSX.2+
|
||||
</span>
|
||||
</td>
|
||||
<td
|
||||
class=""
|
||||
>
|
||||
<span
|
||||
class="cxd-PlainField"
|
||||
>
|
||||
5
|
||||
</span>
|
||||
</td>
|
||||
<td
|
||||
class=""
|
||||
>
|
||||
|
@ -226,7 +226,7 @@ export class TableContent extends React.Component<TableContentProps> {
|
||||
dispatchEvent,
|
||||
onEvent
|
||||
}}
|
||||
></TableBody>
|
||||
/>
|
||||
)}
|
||||
</table>
|
||||
</div>
|
||||
|
@ -2198,11 +2198,9 @@ export default class Table extends React.Component<TableProps, object> {
|
||||
const columnsGroup = store.columnGroup;
|
||||
return (
|
||||
<table
|
||||
className={cx(
|
||||
'Table-table',
|
||||
store.combineNum > 0 ? 'Table-table--withCombine' : '',
|
||||
tableClassName
|
||||
)}
|
||||
className={cx('Table-table', tableClassName, {
|
||||
'Table-table--withCombine': store.combineNum > 0
|
||||
})}
|
||||
>
|
||||
<thead>
|
||||
{columnsGroup.length ? (
|
||||
@ -2249,10 +2247,9 @@ export default class Table extends React.Component<TableProps, object> {
|
||||
</tbody>
|
||||
) : (
|
||||
<TableBody
|
||||
tableClassName={cx(
|
||||
store.combineNum > 0 ? 'Table-table--withCombine' : '',
|
||||
tableClassName
|
||||
)}
|
||||
tableClassName={cx(tableClassName, {
|
||||
'Table-table--withCombine': store.combineNum > 0
|
||||
})}
|
||||
itemAction={itemAction}
|
||||
classnames={cx}
|
||||
render={render}
|
||||
@ -2702,8 +2699,10 @@ export default class Table extends React.Component<TableProps, object> {
|
||||
<>
|
||||
<TableContent
|
||||
tableClassName={cx(
|
||||
store.combineNum > 0 ? 'Table-table--withCombine' : '',
|
||||
{'Table-table--checkOnItemClick': checkOnItemClick},
|
||||
{
|
||||
'Table-table--checkOnItemClick': checkOnItemClick,
|
||||
'Table-table--withCombine': store.combineNum > 0
|
||||
},
|
||||
tableClassName
|
||||
)}
|
||||
className={tableContentClassName}
|
||||
@ -2795,11 +2794,9 @@ export default class Table extends React.Component<TableProps, object> {
|
||||
const heading = this.renderHeading();
|
||||
const header = this.renderHeader();
|
||||
const footer = this.renderFooter();
|
||||
const tableClassName = cx(
|
||||
'Table-table',
|
||||
store.combineNum > 0 ? 'Table-table--withCombine' : '',
|
||||
this.props.tableClassName
|
||||
);
|
||||
const tableClassName = cx('Table-table', this.props.tableClassName, {
|
||||
'Table-table--withCombine': store.combineNum > 0
|
||||
});
|
||||
|
||||
return (
|
||||
<div
|
||||
|
Loading…
Reference in New Issue
Block a user