Skip to content
This repository has been archived by the owner on Jan 16, 2024. It is now read-only.

HierarchyTable layout fix #569

Merged
merged 1 commit into from
Jan 19, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/components/HierarchyTable/HierarchyTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -190,14 +190,15 @@ export const HierarchyTable: FunctionComponent<HierarchyTableProps> = props => {
}

const fields = hierarchyLevel ? hierarchyLevel.fields : props.meta.fields
const withHierarchyShift = fields.find(field => field.hierarchyShift === true)

// Уровни иерархии отбиваются отступом через пустую колонку с вычисляемой шириной
const indentColumn = {
title: '',
key: '_indentColumn',
dataIndex: null as string,
className: styles.selectColumn,
width: '50px',
width: withHierarchyShift ? `${50 + indentLevel * 20}px` : '50px',
render: (text: string, dataItem: AssociatedItem): React.ReactNode => {
return null
}
Expand All @@ -215,8 +216,9 @@ export const HierarchyTable: FunctionComponent<HierarchyTableProps> = props => {
title: item.title,
key: item.key,
dataIndex: item.key,
width: item.width,
className: cn({
[styles[`padding${indentLevel}`]]: fields[0].key === item.key && indentLevel,
[styles[`padding${indentLevel}`]]: fields[0].key === item.key && indentLevel && !item.width,
[styles.numberColumn]: fields[0].key === item.key
}),
render: (text: string, dataItem: any) => {
Expand Down