From ed17e064ce086ce08652e515a722b11776f6ec52 Mon Sep 17 00:00:00 2001 From: Alex Andreev Date: Fri, 18 Feb 2022 15:05:10 +0300 Subject: [PATCH] Respect hidden columns Signed-off-by: Alex Andreev --- .../item-object-list/placeholder.module.scss | 7 ++++++- .../components/item-object-list/placeholder.tsx | 14 +++++++++++--- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/renderer/components/item-object-list/placeholder.module.scss b/src/renderer/components/item-object-list/placeholder.module.scss index 95ebc029fb..25c8f8c942 100644 --- a/src/renderer/components/item-object-list/placeholder.module.scss +++ b/src/renderer/components/item-object-list/placeholder.module.scss @@ -18,12 +18,17 @@ &.actionColumn { flex: 0 0 55px; + + .line { + width: 100%; + } } } } .line { - width: 100%; + width: 90%; + max-width: 290px; height: 0px; padding: 3px; border-radius: 4px; diff --git a/src/renderer/components/item-object-list/placeholder.tsx b/src/renderer/components/item-object-list/placeholder.tsx index 0dbeb62c80..e78c70166a 100644 --- a/src/renderer/components/item-object-list/placeholder.tsx +++ b/src/renderer/components/item-object-list/placeholder.tsx @@ -7,13 +7,15 @@ import styles from "./placeholder.module.scss"; import React from "react"; import type { TableCellProps } from "../table"; +import { UserStore } from "../../../common/user-store"; interface Props { renderTableHeader: TableCellProps[]; showExtraColumn?: boolean; + tableId: string; } -export function Placeholder({ renderTableHeader, showExtraColumn = true }: Props) { +export function Placeholder({ renderTableHeader, showExtraColumn = true, tableId }: Props) { const linesNumber = 3; function renderLines() { @@ -28,9 +30,15 @@ export function Placeholder({ renderTableHeader, showExtraColumn = true }: Props return React.Children.toArray(lines); } + function showColumn({ id: columnId, showWithColumn }: TableCellProps): boolean { + return !UserStore.getInstance().isTableColumnHidden(tableId, columnId, showWithColumn); + } + + const filteredColumns = renderTableHeader.filter(showColumn); + return ( -
- {renderTableHeader.map((cellProps) => { +