mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-17 18:54:11 +08:00
refactor(overlay): using TS 2.8 utils
This commit is contained in:
2
core/src/components.d.ts
vendored
2
core/src/components.d.ts
vendored
@ -358,6 +358,7 @@ declare global {
|
||||
* The main message to be displayed in the alert.
|
||||
*/
|
||||
'message': string;
|
||||
'mode': Mode;
|
||||
/**
|
||||
* Returns a promise that resolves when the alert did dismiss. It also accepts a callback that is called in the same circustances. ``` const {data, role} = await alert.onDidDismiss(); ```
|
||||
*/
|
||||
@ -438,6 +439,7 @@ declare global {
|
||||
* The main message to be displayed in the alert.
|
||||
*/
|
||||
'message'?: string;
|
||||
'mode'?: Mode;
|
||||
/**
|
||||
* Emitted after the alert has dismissed.
|
||||
*/
|
||||
|
@ -28,7 +28,7 @@ export class Alert implements OverlayInterface {
|
||||
animation?: Animation;
|
||||
|
||||
color!: string;
|
||||
mode!: Mode;
|
||||
@Prop() mode!: Mode;
|
||||
|
||||
@Element() el!: HTMLStencilElement;
|
||||
|
||||
|
@ -87,6 +87,11 @@ string
|
||||
The main message to be displayed in the alert.
|
||||
|
||||
|
||||
#### mode
|
||||
|
||||
string
|
||||
|
||||
|
||||
#### overlayId
|
||||
|
||||
number
|
||||
@ -177,6 +182,11 @@ string
|
||||
The main message to be displayed in the alert.
|
||||
|
||||
|
||||
#### mode
|
||||
|
||||
string
|
||||
|
||||
|
||||
#### overlay-id
|
||||
|
||||
number
|
||||
|
@ -3,14 +3,7 @@ import { Animation, AnimationBuilder, Config, Mode } from '../interface';
|
||||
|
||||
let lastId = 1;
|
||||
|
||||
/**
|
||||
* Convert an interface where all the properties are optional to mandatory.
|
||||
*/
|
||||
export type Requires<K extends string> = {
|
||||
[P in K]: any;
|
||||
};
|
||||
|
||||
export function createOverlay<T extends HTMLIonOverlayElement & Requires<keyof B>, B>
|
||||
export function createOverlay<T extends HTMLIonOverlayElement & Required<B>, B>
|
||||
(element: T, opts: B): Promise<T> {
|
||||
// convert the passed in overlay options into props
|
||||
// that get passed down into the new overlay
|
||||
|
Reference in New Issue
Block a user