Skip to content

Commit 9447ac3

Browse files
committed
adjust multivalued return in AxisRangeValue
1 parent fce716e commit 9447ac3

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

src/components/fields/AxisRangeValue.js

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,27 @@ import {UnconnectedDateTimePicker} from './DateTimePicker';
44
import PropTypes from 'prop-types';
55
import React, {Component} from 'react';
66
import {connectToContainer} from 'lib';
7+
import Info from './Info';
8+
import {MULTI_VALUED} from 'lib/constants';
79

810
export class UnconnectedAxisRangeValue extends Component {
911
render() {
10-
return this.props.multiValued ||
11-
(this.props.fullContainer && this.props.fullContainer.type === 'date') ? (
12-
<UnconnectedDateTimePicker {...this.props} />
13-
) : (
14-
<UnconnectedNumeric {...this.props} />
15-
);
12+
// only when all axes have the type date, can we output an UnconnectedDateTimePicker
13+
if (this.props.fullContainer && this.props.fullContainer.type === 'date') {
14+
return <UnconnectedDateTimePicker {...this.props} />;
15+
}
16+
// If its multivalued, it can be multivalued for different reasons:
17+
// - the range is different, but same type
18+
// - the type is different (i.e. date + number axes)
19+
// If we're in the case of a mixed axis type (i.e. date + number) case,
20+
// There's going to be a this.props.fullContainer.type, but it's going to be MULTIVALUED
21+
if (this.props.multiValued && this.props.fullContainer.type === MULTI_VALUED) {
22+
return <Info {...this.props} />;
23+
}
24+
25+
// For cases that the range is numeric, but does not have the same number
26+
// Or numeric and has the same number
27+
return <UnconnectedNumeric {...this.props} />;
1628
}
1729
}
1830

0 commit comments

Comments
 (0)