mirror of
https://github.com/inventree/InvenTree.git
synced 2026-09-27 14:16:02 +00:00
Add user option to rotate table column headers (#12837)
* Add user option to rotate table column headers (#12558) Wide column titles (e.g. "Temperature coefficient [±ppm/°C]") take a lot of horizontal space for narrow data. Add a ROTATE_TABLE_HEADERS user setting (Display Options) which renders table header titles vertically via a scoped CSS class, following the implementation sketch from the issue discussion. * Format ROTATE_TABLE_HEADERS description per ruff-format * add missing doc place * Document ROTATE_TABLE_HEADERS setting in user settings docs * docs: add changelog entry for rotated table headers option --------- Co-authored-by: Matthias Mair <code@mjmair.com>
This commit is contained in:
co-authored by
Matthias Mair
parent
27f89d25a3
commit
9181097194
@@ -205,6 +205,12 @@ USER_SETTINGS: dict[str, InvenTreeSettingsKeyType] = {
|
||||
'default': False,
|
||||
'validator': bool,
|
||||
},
|
||||
'ROTATE_TABLE_HEADERS': {
|
||||
'name': _('Rotated Table Headers'),
|
||||
'description': _('Display table column headers with rotated (vertical) text'),
|
||||
'default': False,
|
||||
'validator': bool,
|
||||
},
|
||||
'SHOW_SPOTLIGHT': {
|
||||
'name': _('Show Spotlight'),
|
||||
'description': _('Enable spotlight navigation functionality'),
|
||||
|
||||
@@ -120,6 +120,10 @@ export function InvenTreeTableInternal<T extends Record<string, any>>({
|
||||
return userSettings.isSet('STICKY_TABLE_HEADER');
|
||||
}, [userSettings]);
|
||||
|
||||
const rotateTableHeaders = useMemo(() => {
|
||||
return userSettings.isSet('ROTATE_TABLE_HEADERS');
|
||||
}, [userSettings]);
|
||||
|
||||
const tableSearchParams = useMemo(() => {
|
||||
return searchParams
|
||||
? excludeDetailNavigationParams(searchParams)
|
||||
@@ -1031,6 +1035,9 @@ export function InvenTreeTableInternal<T extends Record<string, any>>({
|
||||
<Boundary label={`InvenTreeTable-${cacheKey}`}>
|
||||
<Box pos='relative'>
|
||||
<DataTable
|
||||
className={
|
||||
rotateTableHeaders ? 'rotate-table-headers' : undefined
|
||||
}
|
||||
style={{
|
||||
stickyHeader: stickyTableHeader ? 'top' : undefined
|
||||
}}
|
||||
|
||||
@@ -55,6 +55,7 @@ export default function UserSettings() {
|
||||
'ICONS_IN_NAVBAR',
|
||||
'STICKY_HEADER',
|
||||
'STICKY_TABLE_HEADER',
|
||||
'ROTATE_TABLE_HEADERS',
|
||||
'ENABLE_PREVIEW_PANEL',
|
||||
'SHOW_SPOTLIGHT',
|
||||
'BARCODE_IN_FORM_FIELDS',
|
||||
|
||||
@@ -35,3 +35,15 @@
|
||||
.mantine-datatable-resize-locked {
|
||||
width: 100% !important;
|
||||
}
|
||||
|
||||
/* Vertically rotated table column headers (user setting: ROTATE_TABLE_HEADERS) */
|
||||
.rotate-table-headers thead th {
|
||||
vertical-align: bottom;
|
||||
min-width: 2.5rem;
|
||||
}
|
||||
|
||||
.rotate-table-headers thead th .mantine-datatable-header-cell-sortable-text {
|
||||
writing-mode: vertical-rl;
|
||||
transform: rotate(180deg);
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user