@ui5/webcomponents 1.2.3 → 1.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,20 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [1.2.4](https://github.com/SAP/ui5-webcomponents/compare/v1.2.3...v1.2.4) (2022-03-30)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **ui5-card-header:** prevent events from action slot to trigger header's click event ([#4965](https://github.com/SAP/ui5-webcomponents/issues/4965)) ([f87d898](https://github.com/SAP/ui5-webcomponents/commit/f87d898)), closes [#4891](https://github.com/SAP/ui5-webcomponents/issues/4891)
12
+ * **ui5-date-picker:** adjust initial value formatting ([#4967](https://github.com/SAP/ui5-webcomponents/issues/4967)) ([3648b01](https://github.com/SAP/ui5-webcomponents/commit/3648b01)), closes [#4958](https://github.com/SAP/ui5-webcomponents/issues/4958) [#4958](https://github.com/SAP/ui5-webcomponents/issues/4958)
13
+ * **ui5-datetime-picker:** enable secondary calendar type ([#4970](https://github.com/SAP/ui5-webcomponents/issues/4970)) ([6bc84f7](https://github.com/SAP/ui5-webcomponents/commit/6bc84f7)), closes [#4959](https://github.com/SAP/ui5-webcomponents/issues/4959)
14
+ * **ui5-popover:** prevent arrow placement over popover's rounded corners ([#4960](https://github.com/SAP/ui5-webcomponents/issues/4960)) ([66604c3](https://github.com/SAP/ui5-webcomponents/commit/66604c3)), closes [#4599](https://github.com/SAP/ui5-webcomponents/issues/4599) [#4797](https://github.com/SAP/ui5-webcomponents/issues/4797)
15
+
16
+
17
+
18
+
19
+
6
20
  ## [1.2.3](https://github.com/SAP/ui5-webcomponents/compare/v1.2.2...v1.2.3) (2022-03-23)
7
21
 
8
22
 
@@ -472,7 +472,7 @@ class Breadcrumbs extends UI5Element {
472
472
  }
473
473
 
474
474
  get _currentLocationLabel() {
475
- return this.shadowRoot.querySelector(".ui5-breadcrumbs-current-location ui5-label");
475
+ return this.shadowRoot.querySelector(".ui5-breadcrumbs-current-location [ui5-label]");
476
476
  }
477
477
 
478
478
  get _isDropdownArrowFocused() {
@@ -499,7 +499,7 @@ class Breadcrumbs extends UI5Element {
499
499
  * @private
500
500
  */
501
501
  get _dropdownArrowLink() {
502
- return this.shadowRoot.querySelector(".ui5-breadcrumbs-dropdown-arrow-link-wrapper ui5-link");
502
+ return this.shadowRoot.querySelector(".ui5-breadcrumbs-dropdown-arrow-link-wrapper [ui5-link]");
503
503
  }
504
504
 
505
505
  /**
@@ -529,7 +529,7 @@ class Breadcrumbs extends UI5Element {
529
529
  * Getter for the list of links corresponding to the abstract breadcrumb items
530
530
  */
531
531
  get _links() {
532
- return Array.from(this.shadowRoot.querySelectorAll(".ui5-breadcrumbs-link-wrapper ui5-link"));
532
+ return Array.from(this.shadowRoot.querySelectorAll(".ui5-breadcrumbs-link-wrapper [ui5-link]"));
533
533
  }
534
534
 
535
535
  get _isOverflowEmpty() {
@@ -241,15 +241,16 @@ class CardHeader extends UI5Element {
241
241
  }
242
242
 
243
243
  _headerClick(event) {
244
- event.stopImmediatePropagation(); // prevents the native browser "click" event from firing
244
+ // prevents the native browser "click" event from firing
245
+ event.stopImmediatePropagation();
245
246
 
246
- if (this.interactive) {
247
+ if (this.interactive && event.target === event.currentTarget) {
247
248
  this.fireEvent("click");
248
249
  }
249
250
  }
250
251
 
251
252
  _headerKeydown(event) {
252
- if (!this.interactive) {
253
+ if (!this.interactive || event.target !== event.currentTarget) {
253
254
  return;
254
255
  }
255
256
 
@@ -269,7 +270,7 @@ class CardHeader extends UI5Element {
269
270
  }
270
271
 
271
272
  _headerKeyup(event) {
272
- if (!this.interactive) {
273
+ if (!this.interactive || event.target !== event.currentTarget) {
273
274
  return;
274
275
  }
275
276
 
@@ -415,7 +415,7 @@ class DatePicker extends DateComponentBase {
415
415
  console.warn(`In order for the "name" property to have effect, you should also: import "@ui5/webcomponents/dist/features/InputElementsFormSupport.js";`); // eslint-disable-line
416
416
  }
417
417
 
418
- this.value = this.normalizeValue(this.value);
418
+ this.value = this.normalizeValue(this.value) || this.value;
419
419
  this.liveValue = this.value;
420
420
  }
421
421
 
package/dist/Popover.js CHANGED
@@ -15,7 +15,7 @@ import browserScrollbarCSS from "./generated/themes/BrowserScrollbar.css.js";
15
15
  import PopupsCommonCss from "./generated/themes/PopupsCommon.css.js";
16
16
  import PopoverCss from "./generated/themes/Popover.css.js";
17
17
 
18
- const arrowSize = 8;
18
+ const ARROW_SIZE = 8;
19
19
 
20
20
  /**
21
21
  * @public
@@ -303,10 +303,6 @@ class Popover extends Popup {
303
303
  return 10; // px
304
304
  }
305
305
 
306
- static get ARROW_MARGIN() {
307
- return 6; // px
308
- }
309
-
310
306
  onAfterRendering() {
311
307
  if (!this.isOpen() && this.open) {
312
308
  const opener = document.getElementById(this.opener);
@@ -456,12 +452,8 @@ class Popover extends Popup {
456
452
  top = Math.max(top, this._top);
457
453
  }
458
454
 
459
- const isVertical = this.actualPlacementType === PopoverPlacementType.Top || this.actualPlacementType === PopoverPlacementType.Bottom;
460
- const borderRadius = Number.parseInt(window.getComputedStyle(this).getPropertyValue("border-radius"));
461
- const arrow = this._clampArrowPlacement(placement.arrow, isVertical, this._top, this._left, popoverSize, borderRadius);
462
-
463
- this.arrowTranslateX = arrow.x;
464
- this.arrowTranslateY = arrow.y;
455
+ this.arrowTranslateX = placement.arrow.x;
456
+ this.arrowTranslateY = placement.arrow.y;
465
457
 
466
458
  top = this._adjustForIOSKeyboard(top);
467
459
 
@@ -476,59 +468,6 @@ class Popover extends Popup {
476
468
  }
477
469
  }
478
470
 
479
- /**
480
- * Restricts the arrow's coordinates within the bounds of the popover.
481
- * @private
482
- * @param {{x: number, y: number}} arrow arrow's coordinates
483
- * @param {boolean} isVertical if the popover is placed vertically relative to the opener
484
- * @param {number} top popover's top
485
- * @param {number} left popover's left
486
- * @param {{width: number, height: number}} popoverSize popover's width and height
487
- * @param {number} borderRadius value of the border-radius property
488
- * @returns {{x: number, y: number}} Arrow's coordinates
489
- */
490
- _clampArrowPlacement({ x, y }, isVertical, top, left, { width, height }, borderRadius) {
491
- const maxY = this._getArrowRange(height, borderRadius);
492
- const maxX = this._getArrowRange(width, borderRadius);
493
-
494
- if (isVertical) {
495
- const popoverOnLeftBorderOffset = Popover.VIEWPORT_MARGIN - left;
496
- const popoverOnRightBorderOffset = left + width + Popover.VIEWPORT_MARGIN - document.documentElement.clientWidth;
497
-
498
- if (popoverOnLeftBorderOffset > 0) {
499
- x = Math.max(x - popoverOnLeftBorderOffset, -maxX);
500
- } else if (popoverOnRightBorderOffset > 0) {
501
- x = Math.min(x + popoverOnRightBorderOffset, maxX);
502
- }
503
- }
504
-
505
- if (!isVertical) {
506
- const popoverOnTopBorderOffset = Popover.VIEWPORT_MARGIN - top;
507
- const popoverOnBottomBorderOffset = top + height + Popover.VIEWPORT_MARGIN - document.documentElement.clientHeight;
508
- if (popoverOnTopBorderOffset > 0) {
509
- y = Math.max(y - popoverOnTopBorderOffset, -maxY);
510
- } else if (popoverOnBottomBorderOffset > 0) {
511
- y = Math.min(y + popoverOnBottomBorderOffset, maxY);
512
- }
513
- }
514
-
515
- return {
516
- x: Math.round(x),
517
- y: Math.round(y),
518
- };
519
- }
520
-
521
- /**
522
- * Returns the allowed range for the popover arrow based on its dimension.
523
- * @private
524
- * @param {number} dimension the height or width of the popover
525
- * @param {number} borderRadius border radius of the popover
526
- * @returns {number}
527
- */
528
- _getArrowRange(dimension, borderRadius) {
529
- return Math.floor((dimension / 2) - (borderRadius + Popover.ARROW_MARGIN));
530
- }
531
-
532
471
  /**
533
472
  * Adjust the desired top position to compensate for shift of the screen
534
473
  * caused by opened keyboard on iOS which affects all elements with position:fixed.
@@ -598,7 +537,7 @@ class Popover extends Popup {
598
537
  popoverSize.height = targetRect.height;
599
538
  }
600
539
 
601
- const arrowOffset = this.hideArrow ? 0 : arrowSize;
540
+ const arrowOffset = this.hideArrow ? 0 : ARROW_SIZE;
602
541
 
603
542
  // calc popover positions
604
543
  switch (placementType) {
@@ -666,7 +605,8 @@ class Popover extends Popup {
666
605
  this._top = Math.round(top);
667
606
  }
668
607
 
669
- const arrowPos = this.getArrowPosition(targetRect, popoverSize, left, top, isVertical);
608
+ const borderRadius = Number.parseInt(window.getComputedStyle(this).getPropertyValue("border-radius"));
609
+ const arrowPos = this.getArrowPosition(targetRect, popoverSize, left, top, isVertical, borderRadius);
670
610
 
671
611
  return {
672
612
  arrow: arrowPos,
@@ -680,33 +620,50 @@ class Popover extends Popup {
680
620
  * Calculates the position for the arrow.
681
621
  * @private
682
622
  * @param targetRect BoundingClientRect of the target element
683
- * @param popoverSize Width and height of the popover
623
+ * @param {{width: number, height: number}} popoverSize Width and height of the popover
684
624
  * @param left Left offset of the popover
685
625
  * @param top Top offset of the popover
686
- * @param isVertical if the popover is positioned vertically to the target element
626
+ * @param isVertical If the popover is positioned vertically to the target element
627
+ * @param {number} borderRadius Value of the border-radius property
687
628
  * @returns {{x: number, y: number}} Arrow's coordinates
688
629
  */
689
- getArrowPosition(targetRect, popoverSize, left, top, isVertical) {
630
+ getArrowPosition(targetRect, { width, height }, left, top, isVertical, borderRadius) {
690
631
  let arrowXCentered = this.horizontalAlign === PopoverHorizontalAlign.Center || this.horizontalAlign === PopoverHorizontalAlign.Stretch;
691
632
 
692
633
  if (this.horizontalAlign === PopoverHorizontalAlign.Right && left <= targetRect.left) {
693
634
  arrowXCentered = true;
694
635
  }
695
636
 
696
- if (this.horizontalAlign === PopoverHorizontalAlign.Left && left + popoverSize.width >= targetRect.left + targetRect.width) {
637
+ if (this.horizontalAlign === PopoverHorizontalAlign.Left && left + width >= targetRect.left + targetRect.width) {
697
638
  arrowXCentered = true;
698
639
  }
699
640
 
700
641
  let arrowTranslateX = 0;
701
642
  if (isVertical && arrowXCentered) {
702
- arrowTranslateX = targetRect.left + targetRect.width / 2 - left - popoverSize.width / 2;
643
+ arrowTranslateX = targetRect.left + targetRect.width / 2 - left - width / 2;
703
644
  }
704
645
 
705
646
  let arrowTranslateY = 0;
706
647
  if (!isVertical) {
707
- arrowTranslateY = targetRect.top + targetRect.height / 2 - top - popoverSize.height / 2;
648
+ arrowTranslateY = targetRect.top + targetRect.height / 2 - top - height / 2;
708
649
  }
709
650
 
651
+ // Restricts the arrow's translate value along each dimension,
652
+ // so that the arrow does not clip over the popover's rounded borders.
653
+ const safeRangeForArrowY = height / 2 - borderRadius - ARROW_SIZE / 2;
654
+ arrowTranslateY = clamp(
655
+ arrowTranslateY,
656
+ -safeRangeForArrowY,
657
+ safeRangeForArrowY,
658
+ );
659
+
660
+ const safeRangeForArrowX = width / 2 - borderRadius - ARROW_SIZE / 2;
661
+ arrowTranslateX = clamp(
662
+ arrowTranslateX,
663
+ -safeRangeForArrowX,
664
+ safeRangeForArrowX,
665
+ );
666
+
710
667
  return {
711
668
  x: Math.round(arrowTranslateX),
712
669
  y: Math.round(arrowTranslateY),
@@ -7,6 +7,7 @@ import getLocale from "@ui5/webcomponents-base/dist/locale/getLocale.js";
7
7
  import DateFormat from "@ui5/webcomponents-localization/dist/DateFormat.js";
8
8
  import getCachedLocaleDataInstance from "@ui5/webcomponents-localization/dist/getCachedLocaleDataInstance.js";
9
9
  import "@ui5/webcomponents-localization/dist/features/calendar/Gregorian.js"; // default calendar for bundling
10
+ import CalendarType from "@ui5/webcomponents-base/dist/types/CalendarType.js";
10
11
  import { fetchCldr } from "@ui5/webcomponents-base/dist/asset-registries/LocaleData.js";
11
12
  import {
12
13
  isLeft,
@@ -136,6 +137,10 @@ const metadata = {
136
137
  type: String,
137
138
  defaultValue: "hours",
138
139
  },
140
+
141
+ _calendarType: {
142
+ type: CalendarType,
143
+ },
139
144
  },
140
145
  events: /** @lends sap.ui.webcomponents.main.TimeSelection.prototype */ {
141
146
  /**
@@ -435,10 +440,12 @@ class TimeSelection extends UI5Element {
435
440
  let dateFormat;
436
441
  if (this._isPattern) {
437
442
  dateFormat = DateFormat.getInstance({
443
+ calendarType: this._calendarType,
438
444
  pattern: this._formatPattern,
439
445
  });
440
446
  } else {
441
447
  dateFormat = DateFormat.getInstance({
448
+ calendarType: this._calendarType,
442
449
  style: this._formatPattern,
443
450
  });
444
451
  }
@@ -1,7 +1,7 @@
1
1
  /* eslint no-unused-vars: 0 */
2
2
  import { html, svg, repeat, classMap, styleMap, ifDefined, unsafeHTML, scopeTag } from "@ui5/webcomponents-base/dist/renderer/LitRenderer.js";
3
3
 
4
- const block0 = (context, tags, suffix) => html`<${scopeTag("ui5-responsive-popover", tags, suffix)} id="${ifDefined(context._id)}-responsive-popover" allow-target-overlap placement-type="Bottom" horizontal-align="Left" ?disable-scrolling="${context._isIE}" hide-arrow ?_hide-header=${ifDefined(context._shouldHideHeader)} @keydown="${context._onkeydown}" @ui5-after-close="${ifDefined(context.onResponsivePopoverAfterClose)}">${ context.showHeader ? block1(context, tags, suffix) : undefined }<div class="ui5-dt-picker-content ${classMap(context.classes.picker)}"><${scopeTag("ui5-calendar", tags, suffix)} class="ui5-dt-cal ${classMap(context.classes.dateTimeView)}" id="${ifDefined(context._id)}-calendar" primary-calendar-type="${ifDefined(context._primaryCalendarType)}" format-pattern="${ifDefined(context._formatPattern)}" timestamp="${ifDefined(context._calendarTimestamp)}" .selectionMode="${ifDefined(context._calendarSelectionMode)}" .minDate="${ifDefined(context.minDate)}" .maxDate="${ifDefined(context.maxDate)}" @ui5-selected-dates-change="${ifDefined(context.onSelectedDatesChange)}" @ui5-show-month-press="${ifDefined(context.onHeaderShowMonthPress)}" @ui5-show-year-press="${ifDefined(context.onHeaderShowYearPress)}" ?hide-week-numbers="${context.hideWeekNumbers}" ._currentPicker="${ifDefined(context._calendarCurrentPicker)}">${ repeat(context._calendarSelectedDates, (item, index) => item._id || index, (item, index) => block3(item, index, context, tags, suffix)) }</${scopeTag("ui5-calendar", tags, suffix)}>${ !context.phone ? block4(context, tags, suffix) : undefined }<${scopeTag("ui5-time-selection", tags, suffix)} id="${ifDefined(context._id)}-time-sel" class="ui5-dt-time ${classMap(context.classes.dateTimeView)}" value="${ifDefined(context._timeSelectionValue)}" format-pattern="${ifDefined(context._formatPattern)}" ._currentSlider="${ifDefined(context._currentTimeSlider)}" @ui5-change="${ifDefined(context.onTimeSelectionChange)}" @ui5-slider-change="${ifDefined(context.onTimeSliderChange)}"></${scopeTag("ui5-time-selection", tags, suffix)}></div>${ context.showFooter ? block5(context, tags, suffix) : undefined }</${scopeTag("ui5-responsive-popover", tags, suffix)}> `;
4
+ const block0 = (context, tags, suffix) => html`<${scopeTag("ui5-responsive-popover", tags, suffix)} id="${ifDefined(context._id)}-responsive-popover" allow-target-overlap placement-type="Bottom" horizontal-align="Left" ?disable-scrolling="${context._isIE}" hide-arrow ?_hide-header=${ifDefined(context._shouldHideHeader)} @keydown="${context._onkeydown}" @ui5-after-close="${ifDefined(context.onResponsivePopoverAfterClose)}">${ context.showHeader ? block1(context, tags, suffix) : undefined }<div class="ui5-dt-picker-content ${classMap(context.classes.picker)}"><${scopeTag("ui5-calendar", tags, suffix)} class="ui5-dt-cal ${classMap(context.classes.dateTimeView)}" id="${ifDefined(context._id)}-calendar" primary-calendar-type="${ifDefined(context._primaryCalendarType)}" secondary-calendar-type="${ifDefined(context.secondaryCalendarType)}" format-pattern="${ifDefined(context._formatPattern)}" timestamp="${ifDefined(context._calendarTimestamp)}" .selectionMode="${ifDefined(context._calendarSelectionMode)}" .minDate="${ifDefined(context.minDate)}" .maxDate="${ifDefined(context.maxDate)}" @ui5-selected-dates-change="${ifDefined(context.onSelectedDatesChange)}" @ui5-show-month-press="${ifDefined(context.onHeaderShowMonthPress)}" @ui5-show-year-press="${ifDefined(context.onHeaderShowYearPress)}" ?hide-week-numbers="${context.hideWeekNumbers}" ._currentPicker="${ifDefined(context._calendarCurrentPicker)}">${ repeat(context._calendarSelectedDates, (item, index) => item._id || index, (item, index) => block3(item, index, context, tags, suffix)) }</${scopeTag("ui5-calendar", tags, suffix)}>${ !context.phone ? block4(context, tags, suffix) : undefined }<${scopeTag("ui5-time-selection", tags, suffix)} id="${ifDefined(context._id)}-time-sel" class="ui5-dt-time ${classMap(context.classes.dateTimeView)}" value="${ifDefined(context._timeSelectionValue)}" format-pattern="${ifDefined(context._formatPattern)}" ._currentSlider="${ifDefined(context._currentTimeSlider)}" ._calendarType="${ifDefined(context._primaryCalendarType)}" @ui5-change="${ifDefined(context.onTimeSelectionChange)}" @ui5-slider-change="${ifDefined(context.onTimeSliderChange)}"></${scopeTag("ui5-time-selection", tags, suffix)}></div>${ context.showFooter ? block5(context, tags, suffix) : undefined }</${scopeTag("ui5-responsive-popover", tags, suffix)}> `;
5
5
  const block1 = (context, tags, suffix) => html`${ context.phone ? block2(context, tags, suffix) : undefined }`;
6
6
  const block2 = (context, tags, suffix) => html`<div class="ui5-dt-picker-header"><${scopeTag("ui5-segmented-button", tags, suffix)} class="ui5-dt-picker-toggle-button"><${scopeTag("ui5-toggle-button", tags, suffix)} key="Date" ?pressed="${context.showDateView}" @click="${context._dateTimeSwitchChange}">${ifDefined(context.btnDateLabel)}</${scopeTag("ui5-toggle-button", tags, suffix)}><${scopeTag("ui5-toggle-button", tags, suffix)} key="Time" ?pressed="${context.showTimeView}" @click="${context._dateTimeSwitchChange}">${ifDefined(context.btnTimeLabel)}</${scopeTag("ui5-toggle-button", tags, suffix)}></${scopeTag("ui5-segmented-button", tags, suffix)}></div>`;
7
7
  const block3 = (item, index, context, tags, suffix) => html`<${scopeTag("ui5-date", tags, suffix)} value="${ifDefined(item)}"></${scopeTag("ui5-date", tags, suffix)}>`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ui5/webcomponents",
3
- "version": "1.2.3",
3
+ "version": "1.2.4",
4
4
  "description": "UI5 Web Components: webcomponents.main",
5
5
  "ui5": {
6
6
  "webComponentsPackage": true
@@ -42,14 +42,14 @@
42
42
  "directory": "packages/main"
43
43
  },
44
44
  "dependencies": {
45
- "@ui5/webcomponents-base": "1.2.3",
46
- "@ui5/webcomponents-icons": "1.2.3",
47
- "@ui5/webcomponents-ie11": "1.2.3",
48
- "@ui5/webcomponents-localization": "1.2.3",
49
- "@ui5/webcomponents-theming": "1.2.3"
45
+ "@ui5/webcomponents-base": "1.2.4",
46
+ "@ui5/webcomponents-icons": "1.2.4",
47
+ "@ui5/webcomponents-ie11": "1.2.4",
48
+ "@ui5/webcomponents-localization": "1.2.4",
49
+ "@ui5/webcomponents-theming": "1.2.4"
50
50
  },
51
51
  "devDependencies": {
52
- "@ui5/webcomponents-tools": "1.2.3",
52
+ "@ui5/webcomponents-tools": "1.2.4",
53
53
  "chromedriver": "99.0.0"
54
54
  }
55
- }
55
+ }
@@ -472,7 +472,7 @@ class Breadcrumbs extends UI5Element {
472
472
  }
473
473
 
474
474
  get _currentLocationLabel() {
475
- return this.shadowRoot.querySelector(".ui5-breadcrumbs-current-location ui5-label");
475
+ return this.shadowRoot.querySelector(".ui5-breadcrumbs-current-location [ui5-label]");
476
476
  }
477
477
 
478
478
  get _isDropdownArrowFocused() {
@@ -499,7 +499,7 @@ class Breadcrumbs extends UI5Element {
499
499
  * @private
500
500
  */
501
501
  get _dropdownArrowLink() {
502
- return this.shadowRoot.querySelector(".ui5-breadcrumbs-dropdown-arrow-link-wrapper ui5-link");
502
+ return this.shadowRoot.querySelector(".ui5-breadcrumbs-dropdown-arrow-link-wrapper [ui5-link]");
503
503
  }
504
504
 
505
505
  /**
@@ -529,7 +529,7 @@ class Breadcrumbs extends UI5Element {
529
529
  * Getter for the list of links corresponding to the abstract breadcrumb items
530
530
  */
531
531
  get _links() {
532
- return Array.from(this.shadowRoot.querySelectorAll(".ui5-breadcrumbs-link-wrapper ui5-link"));
532
+ return Array.from(this.shadowRoot.querySelectorAll(".ui5-breadcrumbs-link-wrapper [ui5-link]"));
533
533
  }
534
534
 
535
535
  get _isOverflowEmpty() {
@@ -35,7 +35,7 @@
35
35
  id="{{_id}}-status"
36
36
  part="status"
37
37
  class="ui5-card-header-status"
38
- dir="auto"
38
+ dir="auto"
39
39
  >{{status}}</span>
40
40
  {{/if}}
41
41
  </div>
package/src/CardHeader.js CHANGED
@@ -241,15 +241,16 @@ class CardHeader extends UI5Element {
241
241
  }
242
242
 
243
243
  _headerClick(event) {
244
- event.stopImmediatePropagation(); // prevents the native browser "click" event from firing
244
+ // prevents the native browser "click" event from firing
245
+ event.stopImmediatePropagation();
245
246
 
246
- if (this.interactive) {
247
+ if (this.interactive && event.target === event.currentTarget) {
247
248
  this.fireEvent("click");
248
249
  }
249
250
  }
250
251
 
251
252
  _headerKeydown(event) {
252
- if (!this.interactive) {
253
+ if (!this.interactive || event.target !== event.currentTarget) {
253
254
  return;
254
255
  }
255
256
 
@@ -269,7 +270,7 @@ class CardHeader extends UI5Element {
269
270
  }
270
271
 
271
272
  _headerKeyup(event) {
272
- if (!this.interactive) {
273
+ if (!this.interactive || event.target !== event.currentTarget) {
273
274
  return;
274
275
  }
275
276
 
package/src/DatePicker.js CHANGED
@@ -415,7 +415,7 @@ class DatePicker extends DateComponentBase {
415
415
  console.warn(`In order for the "name" property to have effect, you should also: import "@ui5/webcomponents/dist/features/InputElementsFormSupport.js";`); // eslint-disable-line
416
416
  }
417
417
 
418
- this.value = this.normalizeValue(this.value);
418
+ this.value = this.normalizeValue(this.value) || this.value;
419
419
  this.liveValue = this.value;
420
420
  }
421
421
 
@@ -18,6 +18,7 @@
18
18
  class="ui5-dt-cal {{classes.dateTimeView}}"
19
19
  id="{{_id}}-calendar"
20
20
  primary-calendar-type="{{_primaryCalendarType}}"
21
+ secondary-calendar-type="{{secondaryCalendarType}}"
21
22
  format-pattern="{{_formatPattern}}"
22
23
  timestamp="{{_calendarTimestamp}}"
23
24
  .selectionMode="{{_calendarSelectionMode}}"
@@ -44,6 +45,7 @@
44
45
  value="{{_timeSelectionValue}}"
45
46
  format-pattern="{{_formatPattern}}"
46
47
  ._currentSlider="{{_currentTimeSlider}}"
48
+ ._calendarType="{{_primaryCalendarType}}"
47
49
  @ui5-change="{{onTimeSelectionChange}}"
48
50
  @ui5-slider-change="{{onTimeSliderChange}}"
49
51
  ></ui5-time-selection>
package/src/Popover.js CHANGED
@@ -15,7 +15,7 @@ import browserScrollbarCSS from "./generated/themes/BrowserScrollbar.css.js";
15
15
  import PopupsCommonCss from "./generated/themes/PopupsCommon.css.js";
16
16
  import PopoverCss from "./generated/themes/Popover.css.js";
17
17
 
18
- const arrowSize = 8;
18
+ const ARROW_SIZE = 8;
19
19
 
20
20
  /**
21
21
  * @public
@@ -303,10 +303,6 @@ class Popover extends Popup {
303
303
  return 10; // px
304
304
  }
305
305
 
306
- static get ARROW_MARGIN() {
307
- return 6; // px
308
- }
309
-
310
306
  onAfterRendering() {
311
307
  if (!this.isOpen() && this.open) {
312
308
  const opener = document.getElementById(this.opener);
@@ -456,12 +452,8 @@ class Popover extends Popup {
456
452
  top = Math.max(top, this._top);
457
453
  }
458
454
 
459
- const isVertical = this.actualPlacementType === PopoverPlacementType.Top || this.actualPlacementType === PopoverPlacementType.Bottom;
460
- const borderRadius = Number.parseInt(window.getComputedStyle(this).getPropertyValue("border-radius"));
461
- const arrow = this._clampArrowPlacement(placement.arrow, isVertical, this._top, this._left, popoverSize, borderRadius);
462
-
463
- this.arrowTranslateX = arrow.x;
464
- this.arrowTranslateY = arrow.y;
455
+ this.arrowTranslateX = placement.arrow.x;
456
+ this.arrowTranslateY = placement.arrow.y;
465
457
 
466
458
  top = this._adjustForIOSKeyboard(top);
467
459
 
@@ -476,59 +468,6 @@ class Popover extends Popup {
476
468
  }
477
469
  }
478
470
 
479
- /**
480
- * Restricts the arrow's coordinates within the bounds of the popover.
481
- * @private
482
- * @param {{x: number, y: number}} arrow arrow's coordinates
483
- * @param {boolean} isVertical if the popover is placed vertically relative to the opener
484
- * @param {number} top popover's top
485
- * @param {number} left popover's left
486
- * @param {{width: number, height: number}} popoverSize popover's width and height
487
- * @param {number} borderRadius value of the border-radius property
488
- * @returns {{x: number, y: number}} Arrow's coordinates
489
- */
490
- _clampArrowPlacement({ x, y }, isVertical, top, left, { width, height }, borderRadius) {
491
- const maxY = this._getArrowRange(height, borderRadius);
492
- const maxX = this._getArrowRange(width, borderRadius);
493
-
494
- if (isVertical) {
495
- const popoverOnLeftBorderOffset = Popover.VIEWPORT_MARGIN - left;
496
- const popoverOnRightBorderOffset = left + width + Popover.VIEWPORT_MARGIN - document.documentElement.clientWidth;
497
-
498
- if (popoverOnLeftBorderOffset > 0) {
499
- x = Math.max(x - popoverOnLeftBorderOffset, -maxX);
500
- } else if (popoverOnRightBorderOffset > 0) {
501
- x = Math.min(x + popoverOnRightBorderOffset, maxX);
502
- }
503
- }
504
-
505
- if (!isVertical) {
506
- const popoverOnTopBorderOffset = Popover.VIEWPORT_MARGIN - top;
507
- const popoverOnBottomBorderOffset = top + height + Popover.VIEWPORT_MARGIN - document.documentElement.clientHeight;
508
- if (popoverOnTopBorderOffset > 0) {
509
- y = Math.max(y - popoverOnTopBorderOffset, -maxY);
510
- } else if (popoverOnBottomBorderOffset > 0) {
511
- y = Math.min(y + popoverOnBottomBorderOffset, maxY);
512
- }
513
- }
514
-
515
- return {
516
- x: Math.round(x),
517
- y: Math.round(y),
518
- };
519
- }
520
-
521
- /**
522
- * Returns the allowed range for the popover arrow based on its dimension.
523
- * @private
524
- * @param {number} dimension the height or width of the popover
525
- * @param {number} borderRadius border radius of the popover
526
- * @returns {number}
527
- */
528
- _getArrowRange(dimension, borderRadius) {
529
- return Math.floor((dimension / 2) - (borderRadius + Popover.ARROW_MARGIN));
530
- }
531
-
532
471
  /**
533
472
  * Adjust the desired top position to compensate for shift of the screen
534
473
  * caused by opened keyboard on iOS which affects all elements with position:fixed.
@@ -598,7 +537,7 @@ class Popover extends Popup {
598
537
  popoverSize.height = targetRect.height;
599
538
  }
600
539
 
601
- const arrowOffset = this.hideArrow ? 0 : arrowSize;
540
+ const arrowOffset = this.hideArrow ? 0 : ARROW_SIZE;
602
541
 
603
542
  // calc popover positions
604
543
  switch (placementType) {
@@ -666,7 +605,8 @@ class Popover extends Popup {
666
605
  this._top = Math.round(top);
667
606
  }
668
607
 
669
- const arrowPos = this.getArrowPosition(targetRect, popoverSize, left, top, isVertical);
608
+ const borderRadius = Number.parseInt(window.getComputedStyle(this).getPropertyValue("border-radius"));
609
+ const arrowPos = this.getArrowPosition(targetRect, popoverSize, left, top, isVertical, borderRadius);
670
610
 
671
611
  return {
672
612
  arrow: arrowPos,
@@ -680,33 +620,50 @@ class Popover extends Popup {
680
620
  * Calculates the position for the arrow.
681
621
  * @private
682
622
  * @param targetRect BoundingClientRect of the target element
683
- * @param popoverSize Width and height of the popover
623
+ * @param {{width: number, height: number}} popoverSize Width and height of the popover
684
624
  * @param left Left offset of the popover
685
625
  * @param top Top offset of the popover
686
- * @param isVertical if the popover is positioned vertically to the target element
626
+ * @param isVertical If the popover is positioned vertically to the target element
627
+ * @param {number} borderRadius Value of the border-radius property
687
628
  * @returns {{x: number, y: number}} Arrow's coordinates
688
629
  */
689
- getArrowPosition(targetRect, popoverSize, left, top, isVertical) {
630
+ getArrowPosition(targetRect, { width, height }, left, top, isVertical, borderRadius) {
690
631
  let arrowXCentered = this.horizontalAlign === PopoverHorizontalAlign.Center || this.horizontalAlign === PopoverHorizontalAlign.Stretch;
691
632
 
692
633
  if (this.horizontalAlign === PopoverHorizontalAlign.Right && left <= targetRect.left) {
693
634
  arrowXCentered = true;
694
635
  }
695
636
 
696
- if (this.horizontalAlign === PopoverHorizontalAlign.Left && left + popoverSize.width >= targetRect.left + targetRect.width) {
637
+ if (this.horizontalAlign === PopoverHorizontalAlign.Left && left + width >= targetRect.left + targetRect.width) {
697
638
  arrowXCentered = true;
698
639
  }
699
640
 
700
641
  let arrowTranslateX = 0;
701
642
  if (isVertical && arrowXCentered) {
702
- arrowTranslateX = targetRect.left + targetRect.width / 2 - left - popoverSize.width / 2;
643
+ arrowTranslateX = targetRect.left + targetRect.width / 2 - left - width / 2;
703
644
  }
704
645
 
705
646
  let arrowTranslateY = 0;
706
647
  if (!isVertical) {
707
- arrowTranslateY = targetRect.top + targetRect.height / 2 - top - popoverSize.height / 2;
648
+ arrowTranslateY = targetRect.top + targetRect.height / 2 - top - height / 2;
708
649
  }
709
650
 
651
+ // Restricts the arrow's translate value along each dimension,
652
+ // so that the arrow does not clip over the popover's rounded borders.
653
+ const safeRangeForArrowY = height / 2 - borderRadius - ARROW_SIZE / 2;
654
+ arrowTranslateY = clamp(
655
+ arrowTranslateY,
656
+ -safeRangeForArrowY,
657
+ safeRangeForArrowY,
658
+ );
659
+
660
+ const safeRangeForArrowX = width / 2 - borderRadius - ARROW_SIZE / 2;
661
+ arrowTranslateX = clamp(
662
+ arrowTranslateX,
663
+ -safeRangeForArrowX,
664
+ safeRangeForArrowX,
665
+ );
666
+
710
667
  return {
711
668
  x: Math.round(arrowTranslateX),
712
669
  y: Math.round(arrowTranslateY),
@@ -7,6 +7,7 @@ import getLocale from "@ui5/webcomponents-base/dist/locale/getLocale.js";
7
7
  import DateFormat from "@ui5/webcomponents-localization/dist/DateFormat.js";
8
8
  import getCachedLocaleDataInstance from "@ui5/webcomponents-localization/dist/getCachedLocaleDataInstance.js";
9
9
  import "@ui5/webcomponents-localization/dist/features/calendar/Gregorian.js"; // default calendar for bundling
10
+ import CalendarType from "@ui5/webcomponents-base/dist/types/CalendarType.js";
10
11
  import { fetchCldr } from "@ui5/webcomponents-base/dist/asset-registries/LocaleData.js";
11
12
  import {
12
13
  isLeft,
@@ -136,6 +137,10 @@ const metadata = {
136
137
  type: String,
137
138
  defaultValue: "hours",
138
139
  },
140
+
141
+ _calendarType: {
142
+ type: CalendarType,
143
+ },
139
144
  },
140
145
  events: /** @lends sap.ui.webcomponents.main.TimeSelection.prototype */ {
141
146
  /**
@@ -435,10 +440,12 @@ class TimeSelection extends UI5Element {
435
440
  let dateFormat;
436
441
  if (this._isPattern) {
437
442
  dateFormat = DateFormat.getInstance({
443
+ calendarType: this._calendarType,
438
444
  pattern: this._formatPattern,
439
445
  });
440
446
  } else {
441
447
  dateFormat = DateFormat.getInstance({
448
+ calendarType: this._calendarType,
442
449
  style: this._formatPattern,
443
450
  });
444
451
  }