Skip to content

Commit

Permalink
change(render): of Popup with value only if we have value within Dott…
Browse files Browse the repository at this point in the history
…edTableChartView

- This avoids moving around and seeing popups such as Value: even though
  the cells were empty without any values
  • Loading branch information
ichim-david committed Jul 13, 2024
1 parent ab56e58 commit e462ef7
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 25 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@eeacms/volto-datablocks",
"version": "7.1.1",
"version": "7.2.0",
"description": "(EEA) Provides primitives for data connectivity to volto-plotlycharts and other blocks",
"main": "src/index.js",
"author": "European Environment Agency: IDM2 A-Team",
Expand Down
53 changes: 29 additions & 24 deletions src/components/manage/Blocks/DottedTableChart/View.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,31 +110,36 @@ const DottedTableChartView = (props) => {
padding: '0',
}}
>
<Popup
content={
// it might happen that the FormattedValue component returns empty string because of the input data
<>
Value:{' '}
<FormattedValue
textTemplate={text_template}
value={data_tree[col][row]}
specifier={specifier}
/>
</>
}
trigger={
<div
style={{
// hack from https://stackoverflow.com/a/3542470/258462
height: '100%',
{data_tree[col][row] ? (
<Popup
content={
// it might happen that the FormattedValue component returns empty string because of the input data
<>
Value:{' '}
<FormattedValue
textTemplate={text_template}
value={data_tree[col][row]}
specifier={specifier}
/>
</>
}
trigger={
<div
style={{
// hack from https://stackoverflow.com/a/3542470/258462
height: '100%',

padding: '0.78571429em', // value taken from SUIR's collections/table.less (possibly needs to be changed if compact table style is implemented in DottedTableChartView)
}}
>
{renderDots(data_tree[col][row], row_colors?.[row])}
</div>
}
/>
padding: '0.78571429em', // value taken from SUIR's collections/table.less (possibly needs to be changed if compact table style is implemented in DottedTableChartView)
}}
>
{renderDots(
data_tree[col][row],
row_colors?.[row],
)}
</div>
}
/>
) : null}
</Table.Cell>
))}
</Table.Row>
Expand Down

0 comments on commit e462ef7

Please sign in to comment.