diff --git a/angular/src/directives/proxies-list.ts b/angular/src/directives/proxies-list.ts index 77ae2f4ab7..87cdd457d1 100644 --- a/angular/src/directives/proxies-list.ts +++ b/angular/src/directives/proxies-list.ts @@ -4,6 +4,8 @@ import * as d from './proxies'; export const DIRECTIVES = [ d.IonAccordion, d.IonAccordionGroup, + d.IonActionSheet, + d.IonAlert, d.IonApp, d.IonAvatar, d.IonBackButton, @@ -44,6 +46,7 @@ export const DIRECTIVES = [ d.IonLabel, d.IonList, d.IonListHeader, + d.IonLoading, d.IonMenu, d.IonMenuButton, d.IonMenuToggle, @@ -74,6 +77,7 @@ export const DIRECTIVES = [ d.IonTextarea, d.IonThumbnail, d.IonTitle, + d.IonToast, d.IonToggle, d.IonToolbar ]; diff --git a/angular/src/directives/proxies.ts b/angular/src/directives/proxies.ts index 2fc119daa9..64e4fc76b5 100644 --- a/angular/src/directives/proxies.ts +++ b/angular/src/directives/proxies.ts @@ -59,6 +59,128 @@ export class IonAccordionGroup { } } +import type { OverlayEventDetail as IActionSheetOverlayEventDetail } from '@ionic/core'; +export declare interface IonActionSheet extends Components.IonActionSheet { + /** + * Emitted after the action sheet has presented. + */ + ionActionSheetDidPresent: EventEmitter>; + /** + * Emitted before the action sheet has presented. + */ + ionActionSheetWillPresent: EventEmitter>; + /** + * Emitted before the action sheet has dismissed. + */ + ionActionSheetWillDismiss: EventEmitter>; + /** + * Emitted after the action sheet has dismissed. + */ + ionActionSheetDidDismiss: EventEmitter>; + /** + * Emitted after the action sheet has presented. +Shorthand for ionActionSheetWillDismiss. + */ + didPresent: EventEmitter>; + /** + * Emitted before the action sheet has presented. +Shorthand for ionActionSheetWillPresent. + */ + willPresent: EventEmitter>; + /** + * Emitted before the action sheet has dismissed. +Shorthand for ionActionSheetWillDismiss. + */ + willDismiss: EventEmitter>; + /** + * Emitted after the action sheet has dismissed. +Shorthand for ionActionSheetDidDismiss. + */ + didDismiss: EventEmitter>; + +} + +@ProxyCmp({ + defineCustomElementFn: undefined, + inputs: ['animated', 'backdropDismiss', 'buttons', 'cssClass', 'enterAnimation', 'header', 'htmlAttributes', 'isOpen', 'keyboardClose', 'leaveAnimation', 'mode', 'subHeader', 'translucent', 'trigger'], + methods: ['present', 'dismiss', 'onDidDismiss', 'onWillDismiss'] +}) +@Component({ + selector: 'ion-action-sheet', + changeDetection: ChangeDetectionStrategy.OnPush, + template: '', + inputs: ['animated', 'backdropDismiss', 'buttons', 'cssClass', 'enterAnimation', 'header', 'htmlAttributes', 'isOpen', 'keyboardClose', 'leaveAnimation', 'mode', 'subHeader', 'translucent', 'trigger'] +}) +export class IonActionSheet { + protected el: HTMLElement; + constructor(c: ChangeDetectorRef, r: ElementRef, protected z: NgZone) { + c.detach(); + this.el = r.nativeElement; + proxyOutputs(this, this.el, ['ionActionSheetDidPresent', 'ionActionSheetWillPresent', 'ionActionSheetWillDismiss', 'ionActionSheetDidDismiss', 'didPresent', 'willPresent', 'willDismiss', 'didDismiss']); + } +} + +import type { OverlayEventDetail as IAlertOverlayEventDetail } from '@ionic/core'; +export declare interface IonAlert extends Components.IonAlert { + /** + * Emitted after the alert has presented. + */ + ionAlertDidPresent: EventEmitter>; + /** + * Emitted before the alert has presented. + */ + ionAlertWillPresent: EventEmitter>; + /** + * Emitted before the alert has dismissed. + */ + ionAlertWillDismiss: EventEmitter>; + /** + * Emitted after the alert has dismissed. + */ + ionAlertDidDismiss: EventEmitter>; + /** + * Emitted after the alert has presented. +Shorthand for ionAlertWillDismiss. + */ + didPresent: EventEmitter>; + /** + * Emitted before the alert has presented. +Shorthand for ionAlertWillPresent. + */ + willPresent: EventEmitter>; + /** + * Emitted before the alert has dismissed. +Shorthand for ionAlertWillDismiss. + */ + willDismiss: EventEmitter>; + /** + * Emitted after the alert has dismissed. +Shorthand for ionAlertDidDismiss. + */ + didDismiss: EventEmitter>; + +} + +@ProxyCmp({ + defineCustomElementFn: undefined, + inputs: ['animated', 'backdropDismiss', 'buttons', 'cssClass', 'enterAnimation', 'header', 'htmlAttributes', 'inputs', 'isOpen', 'keyboardClose', 'leaveAnimation', 'message', 'mode', 'subHeader', 'translucent', 'trigger'], + methods: ['present', 'dismiss', 'onDidDismiss', 'onWillDismiss'] +}) +@Component({ + selector: 'ion-alert', + changeDetection: ChangeDetectionStrategy.OnPush, + template: '', + inputs: ['animated', 'backdropDismiss', 'buttons', 'cssClass', 'enterAnimation', 'header', 'htmlAttributes', 'inputs', 'isOpen', 'keyboardClose', 'leaveAnimation', 'message', 'mode', 'subHeader', 'translucent', 'trigger'] +}) +export class IonAlert { + protected el: HTMLElement; + constructor(c: ChangeDetectorRef, r: ElementRef, protected z: NgZone) { + c.detach(); + this.el = r.nativeElement; + proxyOutputs(this, this.el, ['ionAlertDidPresent', 'ionAlertWillPresent', 'ionAlertWillDismiss', 'ionAlertDidDismiss', 'didPresent', 'willPresent', 'willDismiss', 'didDismiss']); + } +} + export declare interface IonApp extends Components.IonApp {} @@ -1077,6 +1199,67 @@ export class IonListHeader { } } +import type { OverlayEventDetail as ILoadingOverlayEventDetail } from '@ionic/core'; +export declare interface IonLoading extends Components.IonLoading { + /** + * Emitted after the loading has presented. + */ + ionLoadingDidPresent: EventEmitter>; + /** + * Emitted before the loading has presented. + */ + ionLoadingWillPresent: EventEmitter>; + /** + * Emitted before the loading has dismissed. + */ + ionLoadingWillDismiss: EventEmitter>; + /** + * Emitted after the loading has dismissed. + */ + ionLoadingDidDismiss: EventEmitter>; + /** + * Emitted after the loading indicator has presented. +Shorthand for ionLoadingWillDismiss. + */ + didPresent: EventEmitter>; + /** + * Emitted before the loading indicator has presented. +Shorthand for ionLoadingWillPresent. + */ + willPresent: EventEmitter>; + /** + * Emitted before the loading indicator has dismissed. +Shorthand for ionLoadingWillDismiss. + */ + willDismiss: EventEmitter>; + /** + * Emitted after the loading indicator has dismissed. +Shorthand for ionLoadingDidDismiss. + */ + didDismiss: EventEmitter>; + +} + +@ProxyCmp({ + defineCustomElementFn: undefined, + inputs: ['animated', 'backdropDismiss', 'cssClass', 'duration', 'enterAnimation', 'htmlAttributes', 'isOpen', 'keyboardClose', 'leaveAnimation', 'message', 'mode', 'showBackdrop', 'spinner', 'translucent', 'trigger'], + methods: ['present', 'dismiss', 'onDidDismiss', 'onWillDismiss'] +}) +@Component({ + selector: 'ion-loading', + changeDetection: ChangeDetectionStrategy.OnPush, + template: '', + inputs: ['animated', 'backdropDismiss', 'cssClass', 'duration', 'enterAnimation', 'htmlAttributes', 'isOpen', 'keyboardClose', 'leaveAnimation', 'message', 'mode', 'showBackdrop', 'spinner', 'translucent', 'trigger'] +}) +export class IonLoading { + protected el: HTMLElement; + constructor(c: ChangeDetectorRef, r: ElementRef, protected z: NgZone) { + c.detach(); + this.el = r.nativeElement; + proxyOutputs(this, this.el, ['ionLoadingDidPresent', 'ionLoadingWillPresent', 'ionLoadingWillDismiss', 'ionLoadingDidDismiss', 'didPresent', 'willPresent', 'willDismiss', 'didDismiss']); + } +} + export declare interface IonMenu extends Components.IonMenu { /** @@ -1922,6 +2105,67 @@ export class IonTitle { } } +import type { OverlayEventDetail as IToastOverlayEventDetail } from '@ionic/core'; +export declare interface IonToast extends Components.IonToast { + /** + * Emitted after the toast has presented. + */ + ionToastDidPresent: EventEmitter>; + /** + * Emitted before the toast has presented. + */ + ionToastWillPresent: EventEmitter>; + /** + * Emitted before the toast has dismissed. + */ + ionToastWillDismiss: EventEmitter>; + /** + * Emitted after the toast has dismissed. + */ + ionToastDidDismiss: EventEmitter>; + /** + * Emitted after the toast has presented. +Shorthand for ionToastWillDismiss. + */ + didPresent: EventEmitter>; + /** + * Emitted before the toast has presented. +Shorthand for ionToastWillPresent. + */ + willPresent: EventEmitter>; + /** + * Emitted before the toast has dismissed. +Shorthand for ionToastWillDismiss. + */ + willDismiss: EventEmitter>; + /** + * Emitted after the toast has dismissed. +Shorthand for ionToastDidDismiss. + */ + didDismiss: EventEmitter>; + +} + +@ProxyCmp({ + defineCustomElementFn: undefined, + inputs: ['animated', 'buttons', 'color', 'cssClass', 'duration', 'enterAnimation', 'header', 'htmlAttributes', 'icon', 'isOpen', 'keyboardClose', 'leaveAnimation', 'message', 'mode', 'position', 'translucent', 'trigger'], + methods: ['present', 'dismiss', 'onDidDismiss', 'onWillDismiss'] +}) +@Component({ + selector: 'ion-toast', + changeDetection: ChangeDetectionStrategy.OnPush, + template: '', + inputs: ['animated', 'buttons', 'color', 'cssClass', 'duration', 'enterAnimation', 'header', 'htmlAttributes', 'icon', 'isOpen', 'keyboardClose', 'leaveAnimation', 'message', 'mode', 'position', 'translucent', 'trigger'] +}) +export class IonToast { + protected el: HTMLElement; + constructor(c: ChangeDetectorRef, r: ElementRef, protected z: NgZone) { + c.detach(); + this.el = r.nativeElement; + proxyOutputs(this, this.el, ['ionToastDidPresent', 'ionToastWillPresent', 'ionToastWillDismiss', 'ionToastDidDismiss', 'didPresent', 'willPresent', 'willDismiss', 'didDismiss']); + } +} + import type { ToggleChangeEventDetail as IToggleToggleChangeEventDetail } from '@ionic/core'; export declare interface IonToggle extends Components.IonToggle { /** diff --git a/angular/test/base/e2e/src/inline-overlays.spec.ts b/angular/test/base/e2e/src/inline-overlays.spec.ts new file mode 100644 index 0000000000..febc6d82a2 --- /dev/null +++ b/angular/test/base/e2e/src/inline-overlays.spec.ts @@ -0,0 +1,53 @@ +describe('Overlays: Inline', () => { + beforeEach(() => { + cy.visit('/overlays-inline'); + }); + + describe('Alert', () => { + it('should be visible when presenting', () => { + cy.get('ion-alert').should('not.be.visible'); + + cy.get('#open-alert').click(); + cy.get('ion-alert').should('be.visible'); + + cy.get('ion-alert ion-backdrop').click({ force: true }); + cy.get('ion-alert').should('not.be.visible'); + }); + }); + + describe('Action Sheet', () => { + it('should be visible when presenting', () => { + cy.get('ion-action-sheet').should('not.be.visible'); + + cy.get('#open-action-sheet').click(); + cy.get('ion-action-sheet').should('be.visible'); + + cy.get('ion-action-sheet ion-backdrop').click({ force: true }); + cy.get('ion-action-sheet').should('not.be.visible'); + }); + }); + + describe('Loading', () => { + it('should be visible when presenting', () => { + cy.get('ion-loading').should('not.be.visible'); + + cy.get('#open-loading').click(); + cy.get('ion-loading').should('be.visible'); + + cy.get('ion-loading ion-backdrop').click({ force: true }); + cy.get('ion-loading').should('not.be.visible'); + }); + }); + + describe('Toast', () => { + it('should be visible when presenting', () => { + cy.get('ion-toast').should('not.be.visible'); + + cy.get('#open-toast').click(); + cy.get('ion-toast').shadow().find('.toast-wrapper').should('be.visible'); + + cy.get('ion-toast').shadow().find('.toast-button').click(); + cy.get('ion-toast').should('not.be.visible'); + }); + }); +}); diff --git a/angular/test/base/src/app/app-routing.module.ts b/angular/test/base/src/app/app-routing.module.ts index b6efd0f479..38e065fdae 100644 --- a/angular/test/base/src/app/app-routing.module.ts +++ b/angular/test/base/src/app/app-routing.module.ts @@ -32,6 +32,7 @@ const routes: Routes = [ { path: 'modal-inline', loadChildren: () => import('./modal-inline').then(m => m.ModalInlineModule) }, { path: 'view-child', component: ViewChildComponent }, { path: 'keep-contents-mounted', loadChildren: () => import('./keep-contents-mounted').then(m => m.OverlayAutoMountModule) }, + { path: 'overlays-inline', loadChildren: () => import('./overlays-inline').then(m => m.OverlaysInlineModule) }, { path: 'popover-inline', loadChildren: () => import('./popover-inline').then(m => m.PopoverInlineModule) }, { path: 'providers', component: ProvidersComponent }, { path: 'router-link', component: RouterLinkComponent }, diff --git a/angular/test/base/src/app/overlays-inline/index.ts b/angular/test/base/src/app/overlays-inline/index.ts new file mode 100644 index 0000000000..373b461405 --- /dev/null +++ b/angular/test/base/src/app/overlays-inline/index.ts @@ -0,0 +1 @@ +export * from './overlays-inline.module'; diff --git a/angular/test/base/src/app/overlays-inline/overlays-inline-routing.module.ts b/angular/test/base/src/app/overlays-inline/overlays-inline-routing.module.ts new file mode 100644 index 0000000000..d0dc7b8810 --- /dev/null +++ b/angular/test/base/src/app/overlays-inline/overlays-inline-routing.module.ts @@ -0,0 +1,14 @@ +import { NgModule } from "@angular/core"; +import { RouterModule } from "@angular/router"; +import { OverlaysInlineComponent } from "./overlays-inline.component"; + +@NgModule({ + imports: [RouterModule.forChild([ + { + path: '', + component: OverlaysInlineComponent + } + ])], + exports: [RouterModule] +}) +export class OverlaysInlineRoutingModule { } diff --git a/angular/test/base/src/app/overlays-inline/overlays-inline.component.html b/angular/test/base/src/app/overlays-inline/overlays-inline.component.html new file mode 100644 index 0000000000..68eef635c2 --- /dev/null +++ b/angular/test/base/src/app/overlays-inline/overlays-inline.component.html @@ -0,0 +1,33 @@ + + Open Alert + Open Action Sheet + Open Loading + Open Toast + + + + + + + + + + + diff --git a/angular/test/base/src/app/overlays-inline/overlays-inline.component.ts b/angular/test/base/src/app/overlays-inline/overlays-inline.component.ts new file mode 100644 index 0000000000..a787aca1e9 --- /dev/null +++ b/angular/test/base/src/app/overlays-inline/overlays-inline.component.ts @@ -0,0 +1,10 @@ +import { Component } from "@angular/core"; + +/** + * Validates that inline overlays will will display correctly. + */ +@Component({ + selector: 'app-overlays-inline', + templateUrl: 'overlays-inline.component.html' +}) +export class OverlaysInlineComponent {} diff --git a/angular/test/base/src/app/overlays-inline/overlays-inline.module.ts b/angular/test/base/src/app/overlays-inline/overlays-inline.module.ts new file mode 100644 index 0000000000..366e6d21a9 --- /dev/null +++ b/angular/test/base/src/app/overlays-inline/overlays-inline.module.ts @@ -0,0 +1,11 @@ +import { CommonModule } from "@angular/common"; +import { NgModule } from "@angular/core"; +import { IonicModule } from "@ionic/angular"; +import { OverlaysInlineRoutingModule } from "./overlays-inline-routing.module"; +import { OverlaysInlineComponent } from "./overlays-inline.component"; + +@NgModule({ + imports: [CommonModule, IonicModule, OverlaysInlineRoutingModule], + declarations: [OverlaysInlineComponent], +}) +export class OverlaysInlineModule { } diff --git a/core/stencil.config.ts b/core/stencil.config.ts index 315a364f74..1f6f615b79 100644 --- a/core/stencil.config.ts +++ b/core/stencil.config.ts @@ -183,14 +183,9 @@ export const config: Config = { directivesArrayFile: '../angular/src/directives/proxies-list.ts', excludeComponents: [ // overlays - 'ion-action-sheet', - 'ion-alert', - 'ion-loading', 'ion-modal', 'ion-picker', 'ion-popover', - 'ion-toast', - 'ion-toast', // navigation 'ion-router',