Skip to content
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

Merged
merged 17 commits into from
Oct 11, 2024

Conversation

dgodinez-dh
Copy link
Contributor

closes #904
closes #854

@dgodinez-dh dgodinez-dh requested review from a team, bmingles and jnumainville and removed request for a team October 9, 2024 13:56
Copy link
Contributor

@dsmmcken dsmmcken left a 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.

@dgodinez-dh
Copy link
Contributor Author

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
Yes, I didn't realize we needed to add these. I think several components are missing (calendar, date_field, time_field). Do you want me to add these all in this PR?

@dsmmcken
Copy link
Contributor

dsmmcken commented Oct 9, 2024

Do you want me to add these all in this PR?

separate PR, but this PR should include it's entry.

plugins/ui/DESIGN.md Outdated Show resolved Hide resolved
default_value={"start": local_start, "end": local_end}
)

# simple range calendar that takes list view items directly and is controlled
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Comment on lines 81 to 87
"label": "range_calendar",
"path": "components/range_slider.md"
},
{
"label": "range_slider",
"path": "components/range_calendar.md"
},
Copy link
Contributor

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

Copy link
Contributor Author

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>(
Copy link
Contributor

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()

Copy link
Contributor Author

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');
Copy link
Contributor

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.

Copy link
Contributor

@bmingles bmingles left a 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.

bmingles
bmingles previously approved these changes Oct 9, 2024
Copy link
Contributor

@bmingles bmingles left a 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>
Copy link
Contributor

@dsmmcken dsmmcken left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

approving docs.

@dgodinez-dh dgodinez-dh merged commit fde198c into deephaven:main Oct 11, 2024
17 checks passed
@dgodinez-dh dgodinez-dh deleted the dag_RangeCalendar branch October 22, 2024 12:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ui.range_calendar docs: ui.range_calandar
5 participants