From 4ecc9f42acc3b9927a240dc2dbf818ef8df67af0 Mon Sep 17 00:00:00 2001 From: GitStart <1501599+gitstart@users.noreply.github.com> Date: Fri, 14 Oct 2022 18:25:40 +0800 Subject: [PATCH] Last Table Column Not Centered (#56047) Co-authored-by: gitstart Co-authored-by: gitstart Co-authored-by: Nitesh Singh Co-authored-by: Thiago Nascimbeni Co-authored-by: Rubens Rafael <70234898+RubensRafael@users.noreply.github.com> Co-authored-by: RubensRafael Co-authored-by: Rafael Toledo <87545086+Toledodev@users.noreply.github.com> Co-authored-by: Matheus Muniz <87545749+matheusmuniz03@users.noreply.github.com> Co-authored-by: Matheus Muniz Co-authored-by: Matheus Benini Ferreira <88898100+MatheusBeniniF@users.noreply.github.com> Co-authored-by: Murilo Amaral <87545137+MuriloAmarals@users.noreply.github.com> Co-authored-by: gitstart Co-authored-by: gitstart Co-authored-by: Nitesh Singh Co-authored-by: Thiago Nascimbeni Co-authored-by: Rubens Rafael <70234898+RubensRafael@users.noreply.github.com> Co-authored-by: RubensRafael Co-authored-by: Rafael Toledo <87545086+Toledodev@users.noreply.github.com> Co-authored-by: Matheus Muniz <87545749+matheusmuniz03@users.noreply.github.com> Co-authored-by: Matheus Muniz Co-authored-by: Matheus Benini Ferreira <88898100+MatheusBeniniF@users.noreply.github.com> Co-authored-by: Murilo Amaral <87545137+MuriloAmarals@users.noreply.github.com> --- packages/grafana-ui/src/components/Table/TableCell.tsx | 5 ----- packages/grafana-ui/src/components/Table/styles.ts | 5 ----- 2 files changed, 10 deletions(-) diff --git a/packages/grafana-ui/src/components/Table/TableCell.tsx b/packages/grafana-ui/src/components/Table/TableCell.tsx index 7177142c122..b0c622288eb 100644 --- a/packages/grafana-ui/src/components/Table/TableCell.tsx +++ b/packages/grafana-ui/src/components/Table/TableCell.tsx @@ -28,11 +28,6 @@ export const TableCell: FC = ({ cell, tableStyles, onCellFilterAdded, col let innerWidth = ((cell.column.width as number) ?? 24) - tableStyles.cellPadding * 2; - // last child sometimes have extra padding if there is a non overlay scrollbar - if (columnIndex === columnCount - 1) { - innerWidth -= tableStyles.lastChildExtraPadding; - } - return cell.render('Cell', { field, tableStyles, diff --git a/packages/grafana-ui/src/components/Table/styles.ts b/packages/grafana-ui/src/components/Table/styles.ts index 7ee588594f1..50c17b669f7 100644 --- a/packages/grafana-ui/src/components/Table/styles.ts +++ b/packages/grafana-ui/src/components/Table/styles.ts @@ -2,8 +2,6 @@ import { css, CSSObject } from '@emotion/css'; import { GrafanaTheme2 } from '@grafana/data'; -import { getScrollbarWidth } from '../../utils'; - export const getTableStyles = (theme: GrafanaTheme2) => { const { colors } = theme; const headerBg = theme.colors.background.secondary; @@ -14,7 +12,6 @@ export const getTableStyles = (theme: GrafanaTheme2) => { const bodyFontSize = 14; const cellHeight = cellPadding * 2 + bodyFontSize * lineHeight; const rowHoverBg = theme.colors.emphasize(theme.colors.background.primary, 0.03); - const lastChildExtraPadding = Math.max(getScrollbarWidth(), cellPadding); const buildCellContainerStyle = (color?: string, background?: string, overflowOnHover?: boolean) => { const cellActionsOverflow: CSSObject = { @@ -50,7 +47,6 @@ export const getTableStyles = (theme: GrafanaTheme2) => { &:last-child:not(:only-child) { border-right: none; - padding-right: ${lastChildExtraPadding}px; } &:hover { @@ -98,7 +94,6 @@ export const getTableStyles = (theme: GrafanaTheme2) => { cellHeight, buildCellContainerStyle, cellPadding, - lastChildExtraPadding, cellHeightInner: bodyFontSize * lineHeight, rowHeight: cellHeight + 2, table: css`