mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-18 11:17:19 +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.
|
* The main message to be displayed in the alert.
|
||||||
*/
|
*/
|
||||||
'message': string;
|
'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(); ```
|
* 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.
|
* The main message to be displayed in the alert.
|
||||||
*/
|
*/
|
||||||
'message'?: string;
|
'message'?: string;
|
||||||
|
'mode'?: Mode;
|
||||||
/**
|
/**
|
||||||
* Emitted after the alert has dismissed.
|
* Emitted after the alert has dismissed.
|
||||||
*/
|
*/
|
||||||
|
@ -28,7 +28,7 @@ export class Alert implements OverlayInterface {
|
|||||||
animation?: Animation;
|
animation?: Animation;
|
||||||
|
|
||||||
color!: string;
|
color!: string;
|
||||||
mode!: Mode;
|
@Prop() mode!: Mode;
|
||||||
|
|
||||||
@Element() el!: HTMLStencilElement;
|
@Element() el!: HTMLStencilElement;
|
||||||
|
|
||||||
|
@ -87,6 +87,11 @@ string
|
|||||||
The main message to be displayed in the alert.
|
The main message to be displayed in the alert.
|
||||||
|
|
||||||
|
|
||||||
|
#### mode
|
||||||
|
|
||||||
|
string
|
||||||
|
|
||||||
|
|
||||||
#### overlayId
|
#### overlayId
|
||||||
|
|
||||||
number
|
number
|
||||||
@ -177,6 +182,11 @@ string
|
|||||||
The main message to be displayed in the alert.
|
The main message to be displayed in the alert.
|
||||||
|
|
||||||
|
|
||||||
|
#### mode
|
||||||
|
|
||||||
|
string
|
||||||
|
|
||||||
|
|
||||||
#### overlay-id
|
#### overlay-id
|
||||||
|
|
||||||
number
|
number
|
||||||
|
@ -3,14 +3,7 @@ import { Animation, AnimationBuilder, Config, Mode } from '../interface';
|
|||||||
|
|
||||||
let lastId = 1;
|
let lastId = 1;
|
||||||
|
|
||||||
/**
|
export function createOverlay<T extends HTMLIonOverlayElement & Required<B>, B>
|
||||||
* 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>
|
|
||||||
(element: T, opts: B): Promise<T> {
|
(element: T, opts: B): Promise<T> {
|
||||||
// convert the passed in overlay options into props
|
// convert the passed in overlay options into props
|
||||||
// that get passed down into the new overlay
|
// that get passed down into the new overlay
|
||||||
|
Reference in New Issue
Block a user