refactor(client): allow fixed layout table and action link class (#3246)

This commit is contained in:
Junyi 2023-12-22 15:00:54 +08:00 committed by GitHub
parent d570a2c704
commit 3e99ad1483
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View File

@ -1,11 +1,14 @@
import { observer } from '@formily/react'; import { observer } from '@formily/react';
import React from 'react'; import React from 'react';
import classnames from 'classnames';
import Action from './Action'; import Action from './Action';
import { ComposedAction } from './types'; import { ComposedAction } from './types';
export const ActionLink: ComposedAction = observer( export const ActionLink: ComposedAction = observer(
(props: any) => { (props: any) => {
return <Action {...props} component={props.component || 'a'} className={'nb-action-link'} />; return (
<Action {...props} component={props.component || 'a'} className={classnames('nb-action-link', props.className)} />
);
}, },
{ displayName: 'ActionLink' }, { displayName: 'ActionLink' },
); );

View File

@ -538,6 +538,7 @@ export const Table: any = observer(
ref={tableSizeRefCallback} ref={tableSizeRefCallback}
rowKey={rowKey ?? defaultRowKey} rowKey={rowKey ?? defaultRowKey}
dataSource={dataSource} dataSource={dataSource}
tableLayout="auto"
{...others} {...others}
{...restProps} {...restProps}
pagination={paginationProps} pagination={paginationProps}
@ -547,7 +548,6 @@ export const Table: any = observer(
}} }}
onRow={onRow} onRow={onRow}
rowClassName={(record) => (selectedRow.includes(record[rowKey]) ? highlightRow : '')} rowClassName={(record) => (selectedRow.includes(record[rowKey]) ? highlightRow : '')}
tableLayout={'auto'}
scroll={scroll} scroll={scroll}
columns={columns} columns={columns}
expandable={{ expandable={{