feat(datetime): add calendar picker (#23416)

resolves #19423

BREAKING CHANGE: The `ion-datetime` component has been revamped to use a new calendar style. As a result, some APIs have been removed. See https://github.com/ionic-team/ionic-framework/blob/master/BREAKING.md for more details.
This commit is contained in:
Liam DeBeasi
2021-06-16 15:54:15 -04:00
committed by GitHub
parent c842dd88c9
commit 932d3ca62f
63 changed files with 6062 additions and 3385 deletions

View File

@ -331,7 +331,17 @@ export class Segment implements ComponentInterface {
const currentX = detail.currentX;
const previousY = rect.top + (rect.height / 2);
const nextEl = document.elementFromPoint(currentX, previousY) as HTMLIonSegmentButtonElement;
/**
* Segment can be used inside the shadow dom
* so doing document.elementFromPoint would never
* return a segment button in that instance.
* We use getRootNode to which will return the parent
* shadow root if used inside a shadow component and
* returns document otherwise.
*/
const root = this.el.getRootNode() as Document | ShadowRoot;
const nextEl = root.elementFromPoint(currentX, previousY) as HTMLIonSegmentButtonElement;
const decreaseIndex = isRTL ? currentX > (left + width) : currentX < left;
const increaseIndex = isRTL ? currentX < left : currentX > (left + width);