Skip to content

Commit c8c834e

Browse files
authored
fix(FilterBar): fix alignment of table cells in dialog (#3829)
1 parent 0fa305c commit c8c834e

File tree

3 files changed

+72
-7
lines changed

3 files changed

+72
-7
lines changed

packages/main/src/components/FilterBar/FilterBar.cy.tsx

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,4 +241,57 @@ describe('FilterBar.cy.tsx', () => {
241241
cy.findByTestId('variantManagement').should('not.exist');
242242
cy.findByTestId('SELECT');
243243
});
244+
245+
it.only('addCustomCSS', () => {
246+
cy.mount(
247+
<FilterBar>
248+
<FilterGroupItem label="INPUT">
249+
<Input placeholder="Placeholder" value="123123" data-testid="INPUT" />
250+
</FilterGroupItem>
251+
<FilterGroupItem label="SWITCH" active>
252+
<Switch checked={true} data-testid="SWITCH" />
253+
</FilterGroupItem>
254+
<FilterGroupItem label="SELECT" required>
255+
<Select data-testid="SELECT">
256+
<Option selected={true}>Option 1</Option>
257+
<Option>Option 2</Option>
258+
<Option>Option 3</Option>
259+
<Option>Option 4</Option>
260+
</Select>
261+
</FilterGroupItem>
262+
</FilterBar>
263+
);
264+
cy.findByText('Filters').click();
265+
cy.get('[accessible-name="Group View"]').click();
266+
267+
cy.get('[data-component-name="FilterBarDialogPanelTable"]')
268+
.shadow()
269+
.within(() => {
270+
// no header for tables within panel
271+
cy.get('thead').should('have.css', 'visibility', 'collapse');
272+
cy.get('thead').should('not.be.visible');
273+
// no border for table rows within panel - `getComputedStyle` returns the default value (`separate`) for `unset`
274+
cy.get('table').should('have.css', 'border-collapse', 'separate');
275+
// no bottom border for table within panel - `getComputedStyle` sets the border-width to 0 for `none`
276+
cy.get('.ui5-table-root').should('have.css', 'border-bottom', '0px none rgb(50, 54, 58)');
277+
// no select-all checkbox (header row is hidden)
278+
cy.get('thead th.ui5-table-select-all-column').should('not.be.visible');
279+
});
280+
281+
cy.get('[data-component-name="FilterBarDialogTable"]')
282+
.shadow()
283+
.within(() => {
284+
cy.get('thead').within(() => {
285+
// select-all checkbox is not displayed if no rows are defined
286+
cy.get('[ui5-checkbox]').should('not.exist');
287+
});
288+
});
289+
290+
cy.get('[data-component-name="FilterBarDialogTableRow"]')
291+
.shadow()
292+
.within(() => {
293+
// no navigated cell
294+
cy.get('.ui5-table-row-navigated').should('not.be.visible');
295+
});
296+
});
244297
});

packages/main/src/components/FilterBar/FilterDialog.tsx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,6 @@ addCustomCSSWithScoping(
7575
7676
:host([data-component-name="FilterBarDialogPanelTable"]) .ui5-table-root {
7777
border-bottom: none;
78-
}
79-
/* don't display select all checkbox */
80-
:host([data-component-name="FilterBarDialogPanelTable"]) thead th.ui5-table-select-all-column [ui5-checkbox],
81-
:host([data-component-name="FilterBarDialogTable"]) thead th.ui5-table-select-all-column [ui5-checkbox] {
82-
visibility: hidden;
8378
}
8479
`
8580
);

packages/main/src/components/FilterGroupItem/index.tsx

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,27 @@
1+
import circleTask2Icon from '@ui5/webcomponents-icons/dist/circle-task-2.js';
12
import clsx from 'clsx';
23
import React, { forwardRef, ReactElement } from 'react';
34
import { createUseStyles } from 'react-jss';
45
import { FlexBoxDirection } from '../../enums';
56
import { BusyIndicatorSize } from '../../enums/BusyIndicatorSize';
67
import { CommonProps } from '../../interfaces/CommonProps';
8+
import { addCustomCSSWithScoping } from '../../internal/addCustomCSSWithScoping';
79
import { Icon, TableCell, TableRow } from '../../webComponents';
810
import { BusyIndicator } from '../../webComponents/BusyIndicator';
911
import { Label } from '../../webComponents/Label';
1012
import { FlexBox } from '../FlexBox';
1113
import styles from './FilterGroupItem.jss';
1214

15+
addCustomCSSWithScoping(
16+
'ui5-table-row',
17+
`
18+
/* hide navigated cell */
19+
:host([data-component-name="FilterBarDialogTableRow"]) .ui5-table-row-navigated {
20+
width: 0;
21+
}
22+
`
23+
);
24+
1325
const useStyles = createUseStyles(styles, { name: 'FilterGroupItem' });
1426

1527
export interface FilterGroupItemPropTypes extends CommonProps {
@@ -92,7 +104,12 @@ export const FilterGroupItem = forwardRef<HTMLDivElement, FilterGroupItemPropTyp
92104
if (!inFB) {
93105
return (
94106
//todo: disable selection for required fields when it's possible, or the table is fully controllable (https://github.com/SAP/ui5-webcomponents/issues/5662)
95-
<TableRow data-react-key={props['data-react-key']} selected={selected} data-required={required}>
107+
<TableRow
108+
data-react-key={props['data-react-key']}
109+
selected={selected}
110+
data-required={required}
111+
data-component-name="FilterBarDialogTableRow"
112+
>
96113
<TableCell>
97114
<FlexBox direction={FlexBoxDirection.Column}>
98115
<Label className={classes.dialogCellLabel} title={labelTooltip ?? label} required={required}>
@@ -103,7 +120,7 @@ export const FilterGroupItem = forwardRef<HTMLDivElement, FilterGroupItemPropTyp
103120
</TableCell>
104121
{!withValues && (
105122
<TableCell className={classes.dialogActiveCell}>
106-
{active && <Icon name="circle-task-2" className={classes.dialogActiveIcon} />}
123+
{active && <Icon name={circleTask2Icon} className={classes.dialogActiveIcon} />}
107124
</TableCell>
108125
)}
109126
</TableRow>

0 commit comments

Comments
 (0)