feat(datetime): add additional options for vertical scroll, range selection, and new month/year view#31255
Draft
OS-susmitabhowmik wants to merge 11 commits into
Draft
feat(datetime): add additional options for vertical scroll, range selection, and new month/year view#31255OS-susmitabhowmik wants to merge 11 commits into
OS-susmitabhowmik wants to merge 11 commits into
Conversation
…and monthYearPickerView="grid" Introduces three new opt-in props to ion-datetime: selectionMode="range" - First tap sets the range start; second tap commits the range and emits ionChange with a two-element ISO array [start, end] - Second tap before first auto-swaps if needed so start is always earlier - Third tap resets and starts a new range - Deprecates the `multiple` boolean in favour of selectionMode="multiple" - Range state (isRangeStart, isInRange, isRangeEnd) flows through getCalendarDayState() and is exposed as CSS classes on day buttons and ::before pseudo-element track on their wrapper cells monthNavigation="scroll" - Replaces the horizontal 3-month swipe window with a free-scrolling vertical list of ~13 months (+-6 from the working month, clamped to min/max) - Each month card renders its own heading and days-of-week row inline - A debounced scroll listener updates workingParts and the visually- hidden aria-live region as the user scrolls - Arrow buttons are hidden in this mode (display: none) monthYearPickerView="grid" - Replaces the wheel picker overlay with a month name grid (3 col x 4 row) and a paginated year grid (4 col x 6 row, 24 years per page) - Year pages are navigated with prev/next arrow buttons; the page resets to the one containing the working year each time the picker opens - Also applied to month/month-year/year presentations which previously hardcoded the wheel picker regardless of the prop Adds unit tests for the new range state logic and E2E test files with index.html pages for all three features.
Remove destructured { page } from test callbacks in the three new
datetime E2E test files where page was declared but never referenced
in the test body, resolving TypeScript "declared but its value is never
read" errors that were breaking the build.
Fix four issues found via CI:
- selectionMode="range": first click was falling through to confirm()
and emitting ionChange with a partial { start } range. Add an early
return so ionChange only fires after the second click when both start
and end are committed.
- month-navigation scroll mode tests: .calendar-month-year is not
rendered in scroll mode (minimal header only); switch programmatic
nextMonth/prevMonth tests to use .calendar-month-year-announce.
- month-year-grid month cell selector: the year grid element carries
both month-year-grid and month-year-grid-years classes, so
.month-year-grid .month-year-grid-cell was matching year cells too
(19 instead of 12). Switch all month-cell locators to
[aria-label="Select month"] .month-year-grid-cell.
- month-year-grid year cells test: toHaveCount(expect.any(Number)) is
not valid Playwright API; replace with a plain count assertion.
…le object in multiple mode
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue number: resolves internal
What is the current behavior?
What is the new behavior?
This PR is a proof of concept for adding the following features to the
ion-datetimecomponent:Does this introduce a breaking change?
Other information