Skip to content

Date and Time zoom support - #13964

Draft
Todor-ads wants to merge 6 commits into
mainfrom
date_time_zoom
Draft

Date and Time zoom support#13964
Todor-ads wants to merge 6 commits into
mainfrom
date_time_zoom

Conversation

@Todor-ads

Copy link
Copy Markdown
Contributor

No description provided.

- DateComponentBase: _highZoom property, _isHighZoom(), zoom watch lifecycle
- TimePicker: same zoom detection (standalone, no shared base)
- DateHighZoomInputs: new internal component with Year/Month/Day selects,
  YearPicker dialog, validate(), syncStartDate/EndDate(), full public API
- YearPicker: _showHeader, _rowSize, _pageSize properties; CalendarHeader
  CSS included for standalone use
- DatePicker: _highZoom integration — DateHighZoomInputs replaces Calendar
  in popover content, OK/Cancel footer, input click handling at zoom
…r improvements

- DatePicker: _hzOkEnabled (disabled until valid), _hzActiveCalType toggle,
  secondary calendar type icon button in header, _onHzFocusIn to open picker
- DateHighZoomInputs: minDate/maxDate as ISO strings, _parseISO without TZ issues,
  _gregYear/Month/Day source-of-truth for calendar type conversion,
  _applyCalendarTypeToDisplay using Intl.DateTimeFormat, Intl-based month names
- YearPicker: _rowSize, _pageSize, _showHeader properties; CalendarHeader CSS included;
  CSS item width driven by --_ui5_yp_item_width custom property
- TimePicker: showHeader includes _highZoom, _togglePicker syncs _highZoom,
  _handleInputClick opens picker at zoom, _onHzFocusIn handler,
  _onZoomChange reopens picker on resize
- TimePickerTemplate: icon hidden at zoom, onFocusIn uses _onHzFocusIn
- TimePickerPopoverTemplate: TimeSelectionInputs with _showLabels at zoom
- TimeSelectionInputs: _showLabels property, Hz label getters, Label import
- TimeSelectionInputsTemplate: labeled layout with Hours/Minutes/Seconds labels,
  separators between inputs
- TimeSelectionInputs.css: --labeled flex-wrap layout, separator centering
- i18n: TIMEPICKER_HZ_HOURS/MINUTES/SECONDS keys
At 200% zoom (viewport ≤ 320px), ui5-calendar renders a DatePicker
input instead of the full calendar grid. Zoom watching is wired via
super.onEnterDOM/onExitDOM (DateComponentBase infrastructure).

@GDamyanov GDamyanov left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could we also write cypress tests for high zoom?

@@ -0,0 +1,12 @@
enum DateHighZoomInputsMode {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Missing JSDoc

_hzActiveCalType?: `${CalendarType}`;

override get _shouldWatchZoom(): boolean {
return true;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do we need this in desktop devices?


DATEPICKER_RANGE_UNDERFLOW=Enter a date higher than the minimum value of {0}.

DATEPICKER_HZ_YEAR_LABEL=Year:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Redundant changes.

}

.ui5-dhzi-root {
padding: 0.5rem;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

could we think of more descriptive class names?

width: 100%;
--_ui5_calendar_width: 100%;
--_ui5_calendar_height: auto;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

overriding css variables here is not a good practise.


onExitDOM() {
super.onExitDOM();
ResizeHandler.deregister(document.body, this._handleResizeBound);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Same logic should be applied also for super.onExitDOM();

value={this._hzDatePickerValue}
formatPattern={this._formatPattern}
primaryCalendarType={this.primaryCalendarType}
secondaryCalendarType={this.secondaryCalendarType}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We should use the private getters for calendarTypes which comes from DateComponentBase

import slimArowRight from "@ui5/webcomponents-icons/dist/slim-arrow-right.js";

export interface CalendarHeaderHost {
_previousButtonDisabled: boolean;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could we extract this interface in other file since it is used in other places. Also it will be good to split all the properties into other interfaces

}

_isHighZoom(): boolean {
return isHighZoom();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do we need this property since we have _highZoom

function defaultContent(this: DatePicker) {
if (this._highZoom) {
const toISO = (cd: CalendarDateLocale) =>
`${String(cd.getYear()).padStart(4, "0")}-${String(cd.getMonth() + 1).padStart(2, "0")}-${String(cd.getDate()).padStart(2, "0")}`;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

toIso is duplicated, could we extract the logic?

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.

2 participants