Remove padding from EditableCell.

Add types into otherColumsParams.
This commit is contained in:
Фролов 2021-08-30 15:11:21 +05:00
parent 4118319b97
commit 7a7a4663c5
3 changed files with 10 additions and 5 deletions

View File

@ -28,7 +28,11 @@ export const EditableCell = ({
{inputNode}
</Form.Item>
return (<td>
const tdStyle = editing
? { padding:0 }
: null
return (<td style={tdStyle}>
{editing ? editor: children}
</td>)
}

View File

@ -30,7 +30,7 @@ export const EditableTable = ({
setData(tryAddKeys(dataSource))
},[dataSource])
const isEditing = (record) => record.key === editingKey
const isEditing = (record) => record?.key === editingKey
const edit = (record) => {
form.setFieldsValue({...record})

View File

@ -1,3 +1,4 @@
import { ReactNode } from 'react'
export { Table } from 'antd'
export { EditableTable } from './EditableTable'
export { DatePickerWrapper } from './DatePickerWrapper'
@ -27,7 +28,7 @@ interface columnPropsOther {
// редактируемая колонка
editable?: boolean
// react компонента редактора
input?: any
input?: ReactNode
// значение может быть пустым
isRequired?: boolean
// css класс для <FormItem/>, если требуется
@ -38,14 +39,14 @@ interface columnPropsOther {
initialValue?: string|number
}
export const makeColumn = (title:string, key:string, other?:columnPropsOther) => ({
export const makeColumn = (title:string | ReactNode, key:string, other?:columnPropsOther) => ({
title: title,
key: key,
dataIndex: key,
...other,
})
export const makeColumnsPlanFact = (title:string, key:string|string[], columsOther?:any|any[], gruopOther?:any) =>
export const makeColumnsPlanFact = (title:string | ReactNode, key:string|string[], columsOther?:any|any[], gruopOther?:any) =>
{
let keyPlanLocal = key
let keyFactLocal = key