Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Grid with hideHeaders:true omits extraneous header border #3435

Merged
merged 5 commits into from
Aug 3, 2023
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
### 🐞 Bug Fixes

* Fixed bug where `manuallySized` was not being set properly on column state
* Grid header bottom border still rendering when hiding grid headers fix.

### 📚 Libraries

Expand Down
4 changes: 4 additions & 0 deletions cmp/ag-grid/AgGrid.scss
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@
color: var(--xh-grid-header-text-color);
}
}
&--hide-headers .ag-header {
border-bottom-width: 0;
min-height: 0 !important;
}

//------------------------
// Core Row Classes
Expand Down
27 changes: 18 additions & 9 deletions cmp/ag-grid/AgGrid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,24 @@
*
* Copyright © 2023 Extremely Heavy Industries Inc.
*/
import {placeholder, frame} from '@xh/hoist/cmp/layout';
import {frame, placeholder} from '@xh/hoist/cmp/layout';
import {
createElement,
hoistCmp,
HoistModel,
HoistProps,
LayoutProps,
lookup,
useLocalModel,
uses,
hoistCmp,
createElement,
XH,
lookup,
HoistProps
XH
} from '@xh/hoist/core';
import {AgGridReact, GridOptions} from '@xh/hoist/kit/ag-grid';
import {splitLayoutProps} from '@xh/hoist/utils/react';
import classNames from 'classnames';
import {isNil} from 'lodash';
import './AgGrid.scss';
import {AgGridModel} from './AgGridModel';
import {AgGridReact, GridOptions} from '@xh/hoist/kit/ag-grid';

export interface AgGridProps extends HoistProps<AgGridModel>, GridOptions, LayoutProps {}

Expand Down Expand Up @@ -63,7 +63,15 @@ export const [AgGrid, agGrid] = hoistCmp.withFactory<AgGridProps>({
}

const [layoutProps, agGridProps] = splitLayoutProps(props),
{sizingMode, showHover, rowBorders, stripeRows, cellBorders, showCellFocus} = model,
{
sizingMode,
showHover,
rowBorders,
stripeRows,
cellBorders,
showCellFocus,
hideHeaders
} = model,
{darkTheme, isDesktop} = XH;

const impl = useLocalModel(AgGridLocalModel);
Expand All @@ -78,7 +86,8 @@ export const [AgGrid, agGrid] = hoistCmp.withFactory<AgGridProps>({
stripeRows ? 'xh-ag-grid--stripe-rows' : 'xh-ag-grid--no-stripe-rows',
cellBorders ? 'xh-ag-grid--cell-borders' : 'xh-ag-grid--no-cell-borders',
showCellFocus ? 'xh-ag-grid--show-cell-focus' : 'xh-ag-grid--no-cell-focus',
isDesktop && showHover ? 'xh-ag-grid--show-hover' : 'xh-ag-grid--no-hover'
isDesktop && showHover ? 'xh-ag-grid--show-hover' : 'xh-ag-grid--no-hover',
hideHeaders ? 'xh-ag-grid--hide-headers' : null
),
...layoutProps,
item: createElement(AgGridReact, {
Expand Down