feat: add editingAlign to EditableTable

This commit is contained in:
Sérgio Salgado 2021-02-17 19:20:33 +00:00 committed by Josh Harvey
parent 7be120ef3a
commit b88423145c
2 changed files with 14 additions and 5 deletions

View file

@ -127,6 +127,7 @@ const ECol = ({ editing, focus, config, extraPaddingRight, extraPadding }) => {
bold,
width,
textAlign,
editingAlign = textAlign,
suffix,
SuffixComponent = TL2,
textStyle = it => {},
@ -135,20 +136,24 @@ const ECol = ({ editing, focus, config, extraPaddingRight, extraPadding }) => {
} = config
const { values } = useFormikContext()
const classes = useStyles({ textAlign, size })
const isEditing = editing && editable
const isField = !bypassField
const classes = useStyles({
textAlign: isEditing ? editingAlign : textAlign,
size
})
const innerProps = {
fullWidth: true,
autoFocus: focus,
size,
bold,
textAlign,
textAlign: isEditing ? editingAlign : textAlign,
...inputProps
}
const isEditing = editing && editable
const isField = !bypassField
return (
<Td
className={{

View file

@ -155,6 +155,7 @@ const mainFields = currency => [
display: 'Cash-in',
width: 169,
size: 'lg',
editingAlign: 'right',
input: NumberInput,
suffix: '%',
inputProps: {
@ -167,6 +168,7 @@ const mainFields = currency => [
display: 'Cash-out',
width: 169,
size: 'lg',
editingAlign: 'right',
input: NumberInput,
suffix: '%',
inputProps: {
@ -180,6 +182,7 @@ const mainFields = currency => [
size: 'lg',
doubleHeader: 'Cash-in only',
textAlign: 'center',
editingAlign: 'right',
input: NumberInput,
suffix: currency,
inputProps: {
@ -193,6 +196,7 @@ const mainFields = currency => [
size: 'lg',
doubleHeader: 'Cash-in only',
textAlign: 'center',
editingAlign: 'right',
input: NumberInput,
suffix: currency,
inputProps: {