mirror of
https://gitee.com/baidu/amis.git
synced 2024-11-30 02:58:05 +08:00
Table cell 直接支持 input-xxx
This commit is contained in:
parent
e005d64745
commit
f158aaac62
@ -874,7 +874,7 @@ export class FormItemWrap extends React.Component<FormItemProps> {
|
||||
return (
|
||||
<div
|
||||
data-role="form-item"
|
||||
className={cx(`Form-item Form-item--${formMode}`, className, {
|
||||
className={cx(`Form-item Form-item--normal`, className, {
|
||||
'is-error': model && !model.valid,
|
||||
[`is-required`]: required
|
||||
})}
|
||||
|
@ -54,11 +54,13 @@ export class TableCell extends React.Component<RendererProps> {
|
||||
className: innerClassName,
|
||||
type: (column && column.type) || 'plain'
|
||||
};
|
||||
delete schema.label;
|
||||
|
||||
let body = children
|
||||
? children
|
||||
: render('field', schema, {
|
||||
...rest,
|
||||
inputOnly: true,
|
||||
value,
|
||||
data
|
||||
});
|
||||
|
@ -31,6 +31,7 @@ export class TableRow extends React.Component<TableRowProps> {
|
||||
super(props);
|
||||
this.handleAction = this.handleAction.bind(this);
|
||||
this.handleQuickChange = this.handleQuickChange.bind(this);
|
||||
this.handleChange = this.handleChange.bind(this);
|
||||
this.handleClick = this.handleClick.bind(this);
|
||||
|
||||
const item = props.item;
|
||||
@ -100,6 +101,28 @@ export class TableRow extends React.Component<TableRowProps> {
|
||||
onQuickChange(item, values, saveImmediately, savePristine, resetOnFailed);
|
||||
}
|
||||
|
||||
handleChange(
|
||||
value: any,
|
||||
name: string,
|
||||
submit?: boolean,
|
||||
changePristine?: boolean
|
||||
) {
|
||||
if (!name) {
|
||||
return;
|
||||
}
|
||||
|
||||
const {item, onQuickChange} = this.props;
|
||||
|
||||
onQuickChange?.(
|
||||
item,
|
||||
{
|
||||
[name]: value
|
||||
},
|
||||
submit,
|
||||
changePristine
|
||||
);
|
||||
}
|
||||
|
||||
render() {
|
||||
const {
|
||||
itemClassName,
|
||||
@ -173,7 +196,8 @@ export class TableRow extends React.Component<TableRowProps> {
|
||||
colIndex: column.index,
|
||||
key: column.index,
|
||||
onAction: this.handleAction,
|
||||
onQuickChange: this.handleQuickChange
|
||||
onQuickChange: this.handleQuickChange,
|
||||
onChange: this.handleChange
|
||||
}
|
||||
)}
|
||||
</tr>
|
||||
@ -216,7 +240,8 @@ export class TableRow extends React.Component<TableRowProps> {
|
||||
colIndex: column.index,
|
||||
key: column.index,
|
||||
onAction: this.handleAction,
|
||||
onQuickChange: this.handleQuickChange
|
||||
onQuickChange: this.handleQuickChange,
|
||||
onChange: this.handleChange
|
||||
})
|
||||
)}
|
||||
</tr>
|
||||
|
Loading…
Reference in New Issue
Block a user