-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into feat/user-actions
- Loading branch information
Showing
10 changed files
with
153 additions
and
143 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
135 changes: 0 additions & 135 deletions
135
src/app/shared/components/template/components/layout/popup.ts
This file was deleted.
Oops, something went wrong.
21 changes: 21 additions & 0 deletions
21
src/app/shared/components/template/components/layout/popup/popup.component.html
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,21 @@ | ||
<div | ||
class="popup-backdrop" | ||
(click)="dismissOnBackdrop($event)" | ||
[attr.data-fullscreen]="props.fullscreen ? true : null" | ||
> | ||
<div class="popup-container"> | ||
<div (click)="dismiss()" class="close-button" fill="clear" *ngIf="props.showCloseButton"> | ||
<ion-icon slot="icon-only" name="close"></ion-icon> | ||
</div> | ||
<div class="popup-content" [attr.data-fullscreen]="props.fullscreen ? true : null"> | ||
<plh-template-container | ||
class="template-container" | ||
[name]="props.name" | ||
[templatename]="props.templatename" | ||
[parent]="props.parent" | ||
[row]="props.row" | ||
(emittedValue)="handleEmittedValue($event)" | ||
></plh-template-container> | ||
</div> | ||
</div> | ||
</div> |
58 changes: 58 additions & 0 deletions
58
src/app/shared/components/template/components/layout/popup/popup.component.scss
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,58 @@ | ||
.popup-backdrop { | ||
height: 100vh; | ||
width: 100%; | ||
background: rgba(0, 0, 0, 0.6); | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: center; | ||
.popup-container { | ||
position: relative; | ||
width: var(--content-max-width); | ||
padding: 0 2rem; | ||
margin: auto; | ||
margin-top: var(--ion-safe-area-top, 0); | ||
margin-bottom: var(--ion-safe-area-bottom, 0); | ||
} | ||
&[data-fullscreen] { | ||
background: white; | ||
.popup-container { | ||
height: var(--safe-area-height); | ||
} | ||
} | ||
.popup-content { | ||
margin: 30px auto; | ||
max-height: calc(var(--safe-area-height) - 60px); | ||
background: white; | ||
border-radius: 20px; | ||
padding: 20px; | ||
overflow: auto; | ||
} | ||
.popup-content[data-fullscreen] { | ||
width: 100%; | ||
height: 100%; | ||
max-height: 100vh; | ||
border-radius: 0; | ||
margin: 0; | ||
} | ||
.popup-content::-webkit-scrollbar { | ||
display: none; | ||
} | ||
.close-button { | ||
position: absolute; | ||
top: 16px; | ||
right: 22px; | ||
background: white; | ||
width: 40px; | ||
height: 40px; | ||
border-radius: 100%; | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
justify-content: center; | ||
border: 1px solid var(--ion-color-primary); | ||
font-size: 24px; | ||
z-index: 1; | ||
box-shadow: var(--ion-default-box-shadow); | ||
color: var(--ion-color-primary); | ||
} | ||
} |
56 changes: 56 additions & 0 deletions
56
src/app/shared/components/template/components/layout/popup/popup.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 |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import { Component, Input } from "@angular/core"; | ||
import { ModalController } from "@ionic/angular"; | ||
import { FlowTypes, ITemplateContainerProps } from "../../../models"; | ||
import { TemplateContainerComponent } from "../../../template-container.component"; | ||
|
||
@Component({ | ||
templateUrl: "./popup.component.html", | ||
styleUrl: "./popup.component.scss", | ||
}) | ||
/** | ||
* When opening a template as a popup, provide a minimal interface and load | ||
* the template directly as a regular template-container element | ||
*/ | ||
export class TemplatePopupComponent { | ||
@Input() props: ITemplatePopupComponentProps; | ||
|
||
constructor(private modalCtrl: ModalController) {} | ||
|
||
/** | ||
* When templates emit completed/uncompleted value from standalone popup close the popup | ||
* NOTE - we do not want to respond to non-standalone templates as this is done through template nav-actions | ||
* */ | ||
handleEmittedValue(value: { emit_value: string; emit_data: any }) { | ||
const { emit_value } = value; | ||
if (this.props.dismissOnEmit) { | ||
if (["completed", "uncompleted"].includes(emit_value)) { | ||
this.dismiss(value); | ||
} | ||
} | ||
} | ||
|
||
dismissOnBackdrop(e: MouseEvent) { | ||
const el = e.target as HTMLElement; | ||
if (el.classList.contains("popup-backdrop")) { | ||
this.dismiss(); | ||
} | ||
} | ||
|
||
dismiss(value?: { emit_value: string; emit_data: any }) { | ||
this.modalCtrl.dismiss(value); | ||
} | ||
} | ||
|
||
export interface ITemplatePopupComponentProps extends ITemplateContainerProps { | ||
name: string; | ||
templatename: string; | ||
parent?: TemplateContainerComponent; | ||
row?: FlowTypes.TemplateRow; | ||
showCloseButton?: boolean; | ||
/** Dismiss popup when completed or uncompleted is emitted from child template */ | ||
dismissOnEmit?: boolean; | ||
/** Wait for template to be self-dismissed before returning (default: True) */ | ||
waitForDismiss?: boolean; | ||
/** Display fullscreen overlayed on top of all other app content */ | ||
fullscreen?: boolean; | ||
} |
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