-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvue-modal-dialogs.d.ts
152 lines (129 loc) · 4 KB
/
vue-modal-dialogs.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
import Vue, { ComponentOptions } from 'vue'
import { VueConstructor, Vue as _Vue, ExtendedVue } from 'vue/types/vue'
export as namespace ModelDialogs
export interface DialogPromise<ReturnType> extends Promise<ReturnType> {
close (data: ReturnType): void,
error (reason: any): void,
transition (): Promise<ReturnType>,
getInstance<T extends DialogComponent<ReturnType>> (): Promise<T>
}
export declare class DialogComponent<ReturnType> extends Vue {
/** The arguments array passed into the dialog function */
readonly arguments: any[]
/** Resolve the promise and close the dialog */
$close (data: ReturnType): void
/** Reject the promise and close the dialog */
$error (reason: any): void
}
export interface DialogComponentConstructor<ReturnType> {
new (): DialogComponent<ReturnType>
}
export type NormalComponent<ReturnType, PropsDef> = (
DialogComponentConstructor<ReturnType> |
VueConstructor
)
export type ESModuleComponent<ReturnType, PropsDef> = (
NormalComponent<ReturnType, PropsDef> |
{ default: NormalComponent<ReturnType, PropsDef> }
)
export type AsyncComponent<ReturnType, PropsDef> = Promise<ESModuleComponent<ReturnType, PropsDef>>
export type Component<ReturnType, PropsDef> = (
ESModuleComponent<ReturnType, PropsDef> |
AsyncComponent<ReturnType, PropsDef>
)
/** Options to build a dialog function */
export interface DialogOptions<ReturnType, PropsDef> {
/** A Vue component that will be the 'dialog component' */
component: Component<ReturnType, PropsDef>,
/** An array that maps the argument list to props */
props: string[],
/** The wrapper that the dialog will be added into */
wrapper: string[]
}
export interface DialogFunction<ReturnType = any, PropsDef extends object = {}> {
(data?: Partial<PropsDef>): DialogPromise<ReturnType>
(...args: any[]): DialogPromise<ReturnType>
}
export declare function create<
PropsDef extends object = {},
ReturnType = any
> (
options: DialogOptions<ReturnType, PropsDef>
): DialogFunction<ReturnType, PropsDef>
export declare function create<
PropsDef extends object = {},
ReturnType = any
> (
component: Component<ReturnType, PropsDef>
): (data?: Partial<PropsDef>) => DialogPromise<ReturnType>
export declare function create<
Arg1 = any,
ReturnType = any,
PropsDef extends object = {}
> (
component: Component<ReturnType, PropsDef>,
prop1: string
): (arg1: Arg1) => DialogPromise<ReturnType>
export declare function create<
Arg1 = any,
Arg2 = any,
ReturnType = any,
PropsDef extends object = {}
> (
component: Component<ReturnType, PropsDef>,
prop1: string,
prop2: string
): (arg1: Arg1, arg2: Arg2) => DialogPromise<ReturnType>
export declare function create<
Arg1 = any,
Arg2 = any,
Arg3 = any,
ReturnType = any,
PropsDef extends object = {}
> (
component: Component<ReturnType, PropsDef>,
prop1: string,
prop2: string,
prop3: string
): (arg1: Arg1, arg2: Arg2, arg3: Arg3) => DialogPromise<ReturnType>
export declare function create<
Arg1 = any,
Arg2 = any,
Arg3 = any,
Arg4 = any,
ReturnType = any,
PropsDef extends object = {}
> (
component: Component<ReturnType, PropsDef>,
prop1: string,
prop2: string,
prop3: string,
prop4: string
): (arg1: Arg1, arg2: Arg2, arg3: Arg3, arg4: Arg4) => DialogPromise<ReturnType>
export declare function create<
Arg1 = any,
Arg2 = any,
Arg3 = any,
Arg4 = any,
Arg5 = any,
ReturnType = any,
PropsDef extends object = {}
> (
component: Component<ReturnType, PropsDef>,
prop1: string,
prop2: string,
prop3: string,
prop4: string,
prop5: string
): (arg1: Arg1, arg2: Arg2, arg3: Arg3, arg4: Arg4, arg5: Arg5) => DialogPromise<ReturnType>
export declare function create<
PropsDef extends object = {},
ReturnType = any
> (
component: Component<ReturnType, PropsDef>,
...props: string[]
): DialogFunction<ReturnType, PropsDef>
/** Dialogs wrapper component */
export declare const DialogsWrapper: ExtendedVue<Vue, {}, {}, {}, {}>
/** Install `vue-modal-dialogs` into Vue */
export function install (vue: typeof _Vue): void