-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: UI Component Range Calendar #930
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
docs/sidebar.json should be updated to link to relevant page (alphabetical order).
I think we've missed that for some of your previous components as well though.
@dsmmcken |
separate PR, but this PR should include it's entry. |
plugins/ui/DESIGN.md
Outdated
default_value={"start": local_start, "end": local_end} | ||
) | ||
|
||
# simple range calendar that takes list view items directly and is controlled |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you mean to say "list view items" here, or is this a copy / paste artifact?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. That was a copy / paste artifact. Updated.
plugins/ui/docs/sidebar.json
Outdated
"label": "range_calendar", | ||
"path": "components/range_slider.md" | ||
}, | ||
{ | ||
"label": "range_slider", | ||
"path": "components/range_calendar.md" | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that doesn't look right, label and paths are swapped
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
...otherProps | ||
} = useRangeCalendarProps(props); | ||
|
||
const [value, onChange] = useDebouncedOnChange<RangeValue<DateValue> | null>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to make the component always controlled. If the default_value
prop is updated, it changes the value.
e.g.
from deephaven import ui
@ui.component
def example():
default_value, set_default_value = ui.use_state({"start": "2020-02-03", "end": "2020-02-08"})
return ui.range_calendar(
aria_label="Date range (uncontrolled)",
default_value=default_value,
), ui.button('Update default', on_press=lambda _: set_default_value({"start": "2020-02-09", "end": "2020-02-20"}))
my_example = example()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
|
||
it('handles a CalendarDateTime', () => { | ||
const date = new CalendarDateTime(2021, 3, 4, 5, 6, 7); | ||
expect(dateValuetoIsoString(date)).toEqual('2021-03-04T05:06:07Z'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the sequential numbering. Makes it easy to see the relationship of the input / output.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All looks good except there may be a bug with the default_value
being controlled instead of uncontrolled.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Co-authored-by: margaretkennedy <82049573+margaretkennedy@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
approving docs.
closes #904
closes #854