Skip to content

Commit

Permalink
Merge pull request #3 from opsramp/51374-add-no-defined-ranges-option
Browse files Browse the repository at this point in the history
51374 add no defined ranges option
  • Loading branch information
opsrampjoe authored Apr 19, 2021
2 parents e538ad2 + 4313630 commit ca25404
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 9 deletions.
27 changes: 27 additions & 0 deletions demo/src/components/Main.js
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,33 @@ export default class Main extends Component {
</div>
</Section>

<Section title="DateRangePicker - 2 month with no Defined Ranges">
<div>
<input
type="text"
readOnly
value={formatDateDisplay(this.state.dateRangePicker.selection.startDate)}
/>
<input
type="text"
readOnly
value={formatDateDisplay(this.state.dateRangePicker.selection.endDate)}
/>
</div>
<div>
<DateRangePicker
onChange={this.handleRangeChange.bind(this, 'dateRangePicker')}
showSelectionPreview={true}
moveRangeOnFirstSelection={false}
className={'PreviewArea'}
months={2}
ranges={[this.state.dateRangePicker.selection]}
direction="horizontal"
showDefinedRange={false}
/>
</div>
</Section>

<Section title="DateRangePicker - Vertical Infinite">
<div>
<input
Expand Down
20 changes: 11 additions & 9 deletions src/components/DateRangePicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,17 @@ class DateRangePicker extends Component {
const { focusedRange } = this.state;
return (
<div className={classnames(this.styles.dateRangePickerWrapper, this.props.className)}>
<DefinedRange
focusedRange={focusedRange}
onPreviewChange={value => this.dateRange.updatePreview(value)}
{...this.props}
range={this.props.ranges[focusedRange[0]]}
className={undefined}
onChange={specialHandleChange}
label={this.props.label}
/>
{ this.props.showDefinedRange !== false ? (
<DefinedRange
focusedRange={focusedRange}
onPreviewChange={value => this.dateRange.updatePreview(value)}
{...this.props}
range={this.props.ranges[focusedRange[0]]}
className={undefined}
onChange={specialHandleChange}
label={this.props.label}
/>
) : null}
<DateRange
onRangeFocusChange={focusedRange => this.setState({ focusedRange })}
focusedRange={focusedRange}
Expand Down

0 comments on commit ca25404

Please sign in to comment.