-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2414 from kirbydesign/release/v6.2.0
Release version 6.2
- Loading branch information
Showing
24 changed files
with
1,600 additions
and
7,421 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
26 changes: 24 additions & 2 deletions
26
libs/designsystem/src/lib/components/modal/footer/modal-footer.component.ts
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,39 @@ | ||
import { ChangeDetectionStrategy, Component, HostBinding, Input } from '@angular/core'; | ||
import { | ||
AfterViewInit, | ||
ChangeDetectionStrategy, | ||
Component, | ||
ElementRef, | ||
HostBinding, | ||
Input, | ||
OnDestroy, | ||
Optional, | ||
} from '@angular/core'; | ||
|
||
import { | ||
ModalElementComponent, | ||
ModalElementsAdvertiser, | ||
ModalElementType, | ||
} from '../services/modal.interfaces'; | ||
|
||
@Component({ | ||
selector: 'kirby-modal-footer', | ||
templateUrl: './modal-footer.component.html', | ||
styleUrls: ['./modal-footer.component.scss'], | ||
changeDetection: ChangeDetectionStrategy.OnPush, | ||
}) | ||
export class ModalFooterComponent { | ||
export class ModalFooterComponent extends ModalElementComponent { | ||
@HostBinding('class.snap-to-keyboard') | ||
@Input() | ||
snapToKeyboard = false; | ||
|
||
@HostBinding('class') | ||
@Input() | ||
type: 'inline' | 'fixed' = 'fixed'; | ||
|
||
constructor( | ||
elementRef: ElementRef<HTMLElement>, | ||
@Optional() modalElementsAdvertiser: ModalElementsAdvertiser | ||
) { | ||
super(ModalElementType.FOOTER, elementRef, modalElementsAdvertiser); | ||
} | ||
} |
87 changes: 87 additions & 0 deletions
87
libs/designsystem/src/lib/components/modal/modal-wrapper/modal-elements-mover.delegate.ts
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
import { ElementRef, Renderer2 } from '@angular/core'; | ||
|
||
/* | ||
The ModalWrapperComponent class was growing large. | ||
Hence the functions responsible for moving modal elements around | ||
has been encapsulated in this class. | ||
*/ | ||
|
||
export class ModalElementsMoverDelegate { | ||
constructor(private renderer: Renderer2, private elementRef: ElementRef<HTMLElement>) {} | ||
|
||
public addFooter(footerElementRef: ElementRef<HTMLElement>) { | ||
// Move the footer next to ion-content | ||
this.moveChild(footerElementRef, this.elementRef); | ||
} | ||
|
||
public removeFooter(footerElementRef: ElementRef<HTMLElement>) { | ||
this.removeChild(footerElementRef); | ||
} | ||
|
||
public addPageProgress( | ||
pageProgressElementRef: ElementRef<HTMLElement>, | ||
ionToolbarElement: ElementRef<HTMLIonToolbarElement> | ||
) { | ||
this.moveChild(pageProgressElementRef, ionToolbarElement); | ||
} | ||
|
||
public removePageProgress(pageProgressElementRef: ElementRef<HTMLElement>) { | ||
this.removeChild(pageProgressElementRef); | ||
} | ||
|
||
/* | ||
contentTitleElement & ionTitleElement has to be passed | ||
as arguments to the method; not part of the constructor, as they | ||
might reference completely different elements between calls. | ||
For example in a multi-page routed modal where the elements are destroyed | ||
and recreated. | ||
*/ | ||
public addTitle( | ||
titleElementRef: ElementRef<HTMLElement>, | ||
contentTitleElement: ElementRef<HTMLElement>, | ||
hasCollapsibleTitle: boolean, | ||
ionTitleElement: ElementRef<HTMLIonTitleElement> | ||
) { | ||
this.moveChild(titleElementRef, ionTitleElement); | ||
// If title is collapsible append it to content area; required by ionic implementation. | ||
if (hasCollapsibleTitle) { | ||
const titleElementClone = titleElementRef.nativeElement.cloneNode(true) as HTMLElement; | ||
this.moveChild(new ElementRef(titleElementClone), contentTitleElement); | ||
} | ||
} | ||
|
||
public removeTitle( | ||
titleElementRef: ElementRef<HTMLElement>, | ||
hasCollapsibleTitle: boolean, | ||
contentTitleElement: ElementRef<HTMLElement> | ||
) { | ||
this.removeChild(titleElementRef); | ||
if (hasCollapsibleTitle) { | ||
const kirbyPageTitleElement: HTMLElement = | ||
contentTitleElement.nativeElement.querySelector('kirby-page-title'); | ||
this.removeChild(new ElementRef(kirbyPageTitleElement)); | ||
} | ||
} | ||
|
||
private moveChild( | ||
childElementRef: ElementRef<HTMLElement>, | ||
newParentElementRef: ElementRef<HTMLElement> | ||
) { | ||
const child = childElementRef.nativeElement; | ||
const newParent = newParentElementRef.nativeElement; | ||
this.renderer.removeChild(child.parentElement, child); | ||
this.renderer.appendChild(newParent, child); | ||
} | ||
|
||
private removeChild( | ||
childElementRef: ElementRef<HTMLElement>, | ||
parentElement?: HTMLElement | ElementRef<HTMLElement> | ||
) { | ||
const child = childElementRef.nativeElement; | ||
if (!!child) { | ||
this.renderer.removeChild(parentElement || child.parentElement, child); | ||
} | ||
} | ||
} |
Oops, something went wrong.