chore: reformat code

This commit is contained in:
Rafael Taranto 2025-05-12 14:49:39 +01:00
parent 3d930aa73b
commit aedabcbdee
509 changed files with 6030 additions and 4266 deletions

View file

@ -5,7 +5,7 @@ import {
Td,
THead,
TDoubleLevelHead,
ThDoubleLevel
ThDoubleLevel,
} from 'src/components/fake-table/Table'
import { sentenceCase } from 'src/utils/string'
@ -24,11 +24,11 @@ const groupSecondHeader = elements => {
{
width: R.sum(R.map(R.prop('width'), group)),
elements: group,
name: doubleHeader(group[0])
}
]
name: doubleHeader(group[0]),
},
],
),
R.reduce(R.concat, [])
R.reduce(R.concat, []),
)
return R.all(R.pipe(doubleHeader, R.isNil), elements)
@ -47,7 +47,7 @@ const Header = () => {
enableToggle,
toggleWidth,
orderedBy,
DEFAULT_COL_SIZE
DEFAULT_COL_SIZE,
} = useContext(TableCtx)
const mapElement2 = (it, idx) => {
@ -66,11 +66,13 @@ const Header = () => {
const mapElement = (
{ name, display, width = DEFAULT_COL_SIZE, header, textAlign },
idx
idx,
) => {
const orderClasses = classnames({
'whitespace-nowrap':
R.isNil(header) && !R.isNil(orderedBy) && R.equals(name, orderedBy.code)
R.isNil(header) &&
!R.isNil(orderedBy) &&
R.equals(name, orderedBy.code),
})
const attachOrderedByToComplexHeader = header => {
@ -82,6 +84,7 @@ const Header = () => {
spanChild.props.children = R.append(' -', spanChild.props.children)
return cloneHeader
} catch (e) {
console.error(e)
return header
}
}

View file

@ -18,7 +18,7 @@ const NamespacedTable = ({
const innerData = R.map(it => ({
id: it,
...fromNamespace(it)(data)
...fromNamespace(it)(data),
}))(namespaces)
return (

View file

@ -35,7 +35,7 @@ const ActionCol = ({ disabled, editing }) => {
forceAdd,
clearError,
actionColSize,
error
error,
} = useContext(TableCtx)
const disableEdit = disabled || (disableRowEdit && disableRowEdit(values))
@ -136,10 +136,10 @@ const ECol = ({ editing, focus, config, extraPaddingRight, extraPadding }) => {
PrefixComponent = Label2,
suffix,
SuffixComponent = Label2,
textStyle = it => {},
isHidden = it => false,
textStyle = () => {},
isHidden = () => false,
view = it => it?.toString(),
inputProps = {}
inputProps = {},
} = config
const fields = names ?? [name]
@ -158,7 +158,7 @@ const ECol = ({ editing, focus, config, extraPaddingRight, extraPadding }) => {
size,
bold,
textAlign: isEditing ? editingAlign : textAlign,
...inputProps
...inputProps,
}
const newAlign = isEditing ? editingAlign : textAlign
@ -174,7 +174,7 @@ const ECol = ({ editing, focus, config, extraPaddingRight, extraPadding }) => {
className={{
[moduleStyles.extraPaddingRight]: extraPaddingRight,
[moduleStyles.extraPadding]: extraPadding,
'flex items-center': suffix || prefix
'flex items-center': suffix || prefix,
}}
width={width}
size={size}
@ -225,7 +225,7 @@ const groupStriped = elements => {
return R.insert(
index,
{ width, editable: false, view: () => <StripesSvg /> },
noStripe
noStripe,
)
}
@ -238,7 +238,7 @@ const ERow = ({ editing, disabled, lastOfGroup, newRow }) => {
error,
enableToggle,
rowSize,
stripeWhen
stripeWhen,
} = useContext(TableCtx)
const shouldStripe = !editing && stripeWhen && stripeWhen(values)
@ -255,11 +255,11 @@ const ERow = ({ editing, disabled, lastOfGroup, newRow }) => {
: -1
const elementToFocusIndex = innerElements.findIndex(
it => it.editable === undefined || it.editable
it => it.editable === undefined || it.editable,
)
const classNames = {
[moduleStyles.lastOfGroup]: lastOfGroup
[moduleStyles.lastOfGroup]: lastOfGroup,
}
const touchedErrors = R.pick(R.keys(touched), errors)

View file

@ -26,4 +26,4 @@
.fields {
display: flex;
flex-direction: column;
}
}

View file

@ -19,7 +19,7 @@ const DEFAULT_COL_SIZE = 100
const getWidth = R.compose(
R.reduce(R.add)(0),
R.map(it => it.width ?? DEFAULT_COL_SIZE)
R.map(it => it.width ?? DEFAULT_COL_SIZE),
)
const ETable = ({
@ -54,7 +54,7 @@ const ETable = ({
createText = 'Add override',
forceAdd = false,
tbodyWrapperClass,
orderedBy = null
orderedBy = null,
}) => {
const [editingId, setEditingId] = useState(null)
const [adding, setAdding] = useState(false)
@ -80,6 +80,7 @@ const ETable = ({
try {
await save({ [name]: list }, it)
} catch (err) {
console.error(err)
setSaving(false)
return
}
@ -152,7 +153,7 @@ const ETable = ({
stripeWhen,
forceAdd,
orderedBy,
DEFAULT_COL_SIZE
DEFAULT_COL_SIZE,
}
return (