Date and Time zoom support - #13964
Conversation
- 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
left a comment
There was a problem hiding this comment.
Could we also write cypress tests for high zoom?
| @@ -0,0 +1,12 @@ | |||
| enum DateHighZoomInputsMode { | |||
| _hzActiveCalType?: `${CalendarType}`; | ||
|
|
||
| override get _shouldWatchZoom(): boolean { | ||
| return true; |
There was a problem hiding this comment.
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: |
| } | ||
|
|
||
| .ui5-dhzi-root { | ||
| padding: 0.5rem; |
There was a problem hiding this comment.
could we think of more descriptive class names?
| width: 100%; | ||
| --_ui5_calendar_width: 100%; | ||
| --_ui5_calendar_height: auto; | ||
| } |
There was a problem hiding this comment.
overriding css variables here is not a good practise.
|
|
||
| onExitDOM() { | ||
| super.onExitDOM(); | ||
| ResizeHandler.deregister(document.body, this._handleResizeBound); |
There was a problem hiding this comment.
Same logic should be applied also for super.onExitDOM();
| value={this._hzDatePickerValue} | ||
| formatPattern={this._formatPattern} | ||
| primaryCalendarType={this.primaryCalendarType} | ||
| secondaryCalendarType={this.secondaryCalendarType} |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
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")}`; |
There was a problem hiding this comment.
toIso is duplicated, could we extract the logic?
No description provided.