Skip to content

Commit cc2bca7

Browse files
authored
feat(AnalyticalTable): introduce popinDisplay column option (#6619)
Closes #5972
1 parent 62eb7e0 commit cc2bca7

File tree

12 files changed

+404
-133
lines changed

12 files changed

+404
-133
lines changed

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

Lines changed: 137 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,19 @@ import type {
88
PopoverDomRef
99
} from '../..';
1010
import {
11-
Popover,
1211
AnalyticalTable,
1312
AnalyticalTableHooks,
13+
AnalyticalTablePopinDisplay,
1414
AnalyticalTableScaleWidthMode,
1515
AnalyticalTableSelectionBehavior,
1616
AnalyticalTableSelectionMode,
1717
AnalyticalTableSubComponentsBehavior,
1818
AnalyticalTableVisibleRowCountMode,
1919
Button,
2020
IndicationColor,
21-
Input
21+
Input,
22+
Popover,
23+
Text
2224
} from '../..';
2325
import { useManualRowSelect } from './pluginHooks/useManualRowSelect';
2426
import { useRowDisableSelection } from './pluginHooks/useRowDisableSelection';
@@ -1987,13 +1989,15 @@ describe('AnalyticalTable', () => {
19871989
['ltr', 'rtl'].forEach((dir) => {
19881990
cy.mount(<AnalyticalTable data={data} columns={columnsWithPopIn} dir={dir} />);
19891991
cy.viewport(801, 1024);
1990-
19911992
cy.findByText('Name').should('be.visible');
19921993
cy.findByText('Age').should('be.visible');
19931994
cy.findByText('Friend Name').should('be.visible');
19941995
cy.findByText('Custom original Header1').should('be.visible');
19951996
cy.findByText('Custom original Header2').should('be.visible');
19961997
cy.findByText('Custom Header').should('be.visible');
1998+
cy.findByText('Custom Header').should('be.visible');
1999+
cy.findByText('PopinDisplay Modes').should('be.visible').should('have.attr', 'ui5-text');
2000+
cy.findAllByTestId('popinCell').should('exist');
19972001
cy.contains('Custom Cell 2').should('be.visible');
19982002

19992003
cy.contains('Custom Header 1').should('not.exist');
@@ -2018,18 +2022,77 @@ describe('AnalyticalTable', () => {
20182022
cy.contains('Custom Header 2').should('be.visible');
20192023
cy.contains('pop-in content').should('exist');
20202024
cy.contains('C').should('exist');
2025+
cy.findAllByTestId('popinCell').should('exist');
2026+
cy.findAllByText('PopinDisplay Modes:').as('popinHeader').should('be.exist');
2027+
//popinDisplay: Block
2028+
cy.get('@popinHeader').parent().should('have.css', 'flex-direction', 'column');
20212029

20222030
cy.viewport(600, 1024);
20232031
cy.wait(200);
20242032
cy.contains('Age').should('not.exist');
20252033
cy.contains('40').should('not.exist');
2034+
2035+
cy.mount(
2036+
<AnalyticalTable
2037+
data={data}
2038+
columns={[
2039+
...columnsWithPopIn.slice(0, -1),
2040+
{
2041+
id: 'popinDisplay',
2042+
Header: 'PopinDisplay Modes',
2043+
responsivePopIn: true,
2044+
responsiveMinWidth: 801,
2045+
popinDisplay: AnalyticalTablePopinDisplay.Inline,
2046+
Cell: () => {
2047+
return (
2048+
<Text data-testid="popinCell" maxLines={1}>
2049+
Popin Cell
2050+
</Text>
2051+
);
2052+
}
2053+
}
2054+
]}
2055+
dir={dir}
2056+
/>
2057+
);
2058+
cy.findAllByText('PopinDisplay Modes:').as('popinHeader').should('be.exist');
2059+
//popinDisplay: Row
2060+
cy.get('@popinHeader').parent().should('have.css', 'flex-direction', 'row');
2061+
cy.findAllByTestId('popinCell').should('exist');
2062+
2063+
cy.mount(
2064+
<AnalyticalTable
2065+
data={data}
2066+
columns={[
2067+
...columnsWithPopIn.slice(0, -1),
2068+
{
2069+
id: 'popinDisplay',
2070+
Header: 'PopinDisplay Modes',
2071+
responsivePopIn: true,
2072+
responsiveMinWidth: 801,
2073+
popinDisplay: AnalyticalTablePopinDisplay.WithoutHeader,
2074+
Cell: () => {
2075+
return (
2076+
<Text data-testid="popinCell" maxLines={1}>
2077+
Popin Cell
2078+
</Text>
2079+
);
2080+
}
2081+
}
2082+
]}
2083+
dir={dir}
2084+
/>
2085+
);
2086+
//popinDisplay: WithoutHeader
2087+
cy.findAllByText('PopinDisplay Modes:').should('not.exist');
2088+
cy.findAllByTestId('popinCell').should('exist');
20262089
});
20272090
});
20282091

20292092
it('pop-in columns: adjustTableHeightOnPopIn ', () => {
20302093
document.body.style.margin = '0px';
20312094
cy.viewport(800, 2000);
2032-
cy.mount(<AnalyticalTable data={data} columns={columnsWithPopIn} adjustTableHeightOnPopIn />);
2095+
cy.mount(<AnalyticalTable data={data} columns={columnsWithPopIn} adjustTableHeightOnPopIn data-testid="table" />);
20332096

20342097
cy.findByText('Name').should('be.visible');
20352098
cy.findByText('Age').should('be.visible');
@@ -2041,12 +2104,68 @@ describe('AnalyticalTable', () => {
20412104
cy.findByText('Custom original Header2').should('not.exist');
20422105
cy.contains('Custom Header').should('be.visible');
20432106
cy.contains('Custom Cell 2').should('be.visible');
2107+
cy.findAllByTestId('popinCell').should('be.visible');
20442108

20452109
cy.contains('Custom Header 1').should('be.visible');
20462110
cy.contains('Custom Header 2').should('be.visible');
20472111
cy.contains('pop-in content').should('be.visible');
20482112

20492113
cy.contains('C').should('be.visible');
2114+
cy.findByTestId('table').should('have.css', 'height', '1764px');
2115+
2116+
cy.mount(
2117+
<AnalyticalTable
2118+
data={data}
2119+
columns={[
2120+
...columnsWithPopIn.slice(0, -1),
2121+
{
2122+
id: 'popinDisplay',
2123+
Header: 'PopinDisplay Modes',
2124+
responsivePopIn: true,
2125+
responsiveMinWidth: 801,
2126+
popinDisplay: AnalyticalTablePopinDisplay.Inline,
2127+
Cell: () => {
2128+
return (
2129+
<Text data-testid="popinCell" maxLines={1}>
2130+
Popin Cell
2131+
</Text>
2132+
);
2133+
}
2134+
}
2135+
]}
2136+
data-testid="table"
2137+
adjustTableHeightOnPopIn
2138+
/>
2139+
);
2140+
cy.findAllByTestId('popinCell').should('be.visible');
2141+
cy.findByTestId('table').should('have.css', 'height', '1684px');
2142+
2143+
cy.mount(
2144+
<AnalyticalTable
2145+
data={data}
2146+
columns={[
2147+
...columnsWithPopIn.slice(0, -1),
2148+
{
2149+
id: 'popinDisplay',
2150+
Header: 'PopinDisplay Modes',
2151+
responsivePopIn: true,
2152+
responsiveMinWidth: 801,
2153+
popinDisplay: AnalyticalTablePopinDisplay.WithoutHeader,
2154+
Cell: () => {
2155+
return (
2156+
<Text data-testid="popinCell" maxLines={1}>
2157+
Popin Cell
2158+
</Text>
2159+
);
2160+
}
2161+
}
2162+
]}
2163+
data-testid="table"
2164+
adjustTableHeightOnPopIn
2165+
/>
2166+
);
2167+
cy.findAllByTestId('popinCell').should('be.visible');
2168+
cy.findByTestId('table').should('have.css', 'height', '1684px');
20502169
});
20512170

20522171
it('plugin hook: useRowDisableSelection', () => {
@@ -3428,6 +3547,20 @@ const columnsWithPopIn = [
34283547
}
34293548
return 'original content';
34303549
}
3550+
},
3551+
{
3552+
id: 'popinDisplay',
3553+
Header: 'PopinDisplay Modes',
3554+
responsivePopIn: true,
3555+
responsiveMinWidth: 801,
3556+
popinDisplay: 'Block',
3557+
Cell: () => {
3558+
return (
3559+
<Text data-testid="popinCell" maxLines={1}>
3560+
Popin Cell
3561+
</Text>
3562+
);
3563+
}
34313564
}
34323565
];
34333566

0 commit comments

Comments
 (0)