Skip to content

Commit e5023b3

Browse files
committed
feat: add height property to CalculationModal
1 parent b5664bf commit e5023b3

3 files changed

Lines changed: 15 additions & 1 deletion

File tree

src/components/DataDimension/Calculation/CalculationModal.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ const CalculationModal = ({
4848
onClose,
4949
onDelete,
5050
displayNameProp,
51+
height,
5152
}) => {
5253
const { show: showError } = useAlert((error) => error, { critical: true })
5354
const mutationParams = { onError: (error) => showError(error) }
@@ -311,6 +312,7 @@ const CalculationModal = ({
311312
<DataElementSelector
312313
displayNameProp={displayNameProp}
313314
onDoubleClick={addItem}
315+
height={height}
314316
/>
315317
<MathOperatorSelector onDoubleClick={addItem} />
316318
</div>
@@ -484,6 +486,7 @@ CalculationModal.propTypes = {
484486
id: PropTypes.string,
485487
name: PropTypes.string,
486488
}),
489+
height: PropTypes.string,
487490
}
488491

489492
export default CalculationModal

src/components/DataDimension/Calculation/DataElementSelector.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ import {
2323
import DataElementOption from './DataElementOption.js'
2424
import styles from './styles/DataElementSelector.style.js'
2525

26+
const SCROLLBOX_HEIGHT = 337
27+
2628
const getOptions = () => ({
2729
[TOTALS]: i18n.t('Totals only'),
2830
[DETAIL]: i18n.t('Details only'),
@@ -123,7 +125,11 @@ DisaggregationSelector.propTypes = {
123125
onChange: PropTypes.func.isRequired,
124126
}
125127

126-
const DataElementSelector = ({ displayNameProp, onDoubleClick }) => {
128+
const DataElementSelector = ({
129+
displayNameProp,
130+
onDoubleClick,
131+
height = SCROLLBOX_HEIGHT,
132+
}) => {
127133
const dataEngine = useDataEngine()
128134

129135
const [searchTerm, setSearchTerm] = useState('')
@@ -271,6 +277,7 @@ const DataElementSelector = ({ displayNameProp, onDoubleClick }) => {
271277
<div
272278
className="dimension-list-scrollbox"
273279
ref={rootRef}
280+
style={{ height }}
274281
onScroll={() => {
275282
if (isSorting) {
276283
rootRef.current.scrollTo({
@@ -319,6 +326,7 @@ const DataElementSelector = ({ displayNameProp, onDoubleClick }) => {
319326
DataElementSelector.propTypes = {
320327
displayNameProp: PropTypes.string.isRequired,
321328
onDoubleClick: PropTypes.func.isRequired,
329+
height: PropTypes.string,
322330
}
323331

324332
export default DataElementSelector

src/components/DataDimension/ItemSelector/ItemSelector.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ const ItemSelector = ({
137137
isOptionViewMode,
138138
supportsEDI,
139139
height = TRANSFER_HEIGHT,
140+
heightCalculation,
140141
}) => {
141142
const [state, setState] = useState({
142143
searchTerm: '',
@@ -452,6 +453,7 @@ const ItemSelector = ({
452453
onClose={() => setCurrentCalculation()}
453454
onDelete={onDeleteCalculation}
454455
displayNameProp={displayNameProp}
456+
height={heightCalculation}
455457
/>
456458
)}
457459
<style jsx>{styles}</style>
@@ -466,6 +468,7 @@ ItemSelector.propTypes = {
466468
dataTest: PropTypes.string,
467469
dataTypes: PropTypes.array,
468470
height: PropTypes.string,
471+
heightCalculation: PropTypes.string,
469472
infoBoxMessage: PropTypes.string,
470473
infoDataItem: PropTypes.object,
471474
isOptionViewMode: PropTypes.bool,

0 commit comments

Comments
 (0)