UNPKG

2.39 kBTypeScriptView Raw
1import _Vue from 'vue';
2
3export declare type ShDialogConfig = {
4 /**
5 * Dialog title
6 */
7 title?: string;
8
9 /**
10 * Message text
11 */
12 message: string;
13
14 /**
15 * Adds an icon on the left side depending on the <code>type</code> or <code>icon</code>
16 */
17 hasIcon?: boolean;
18
19 /**
20 * Icon name if <code>hasIcon</code>, optional
21 */
22 icon?: string;
23
24 /**
25 * Icon pack to use if <code>hasIcon</code>, optional
26 */
27 iconPack?: string;
28
29 /**
30 * Dialog\'s size, optional
31 */
32 size?: 'is-small' | 'is-medium' | 'is-large';
33
34 /**
35 * Custom animation (transition name)
36 */
37 animation?: string;
38
39 /**
40 * Text of the confirm button
41 */
42 confirmText?: string;
43
44 /**
45 * Text of the cancel button
46 */
47 cancelText?: string;
48
49 /**
50 * Can close dialog by clicking cancel button, pressing escape or clicking outside
51 */
52 canCancel?: boolean | Array<any>;
53
54 /**
55 * Callback function when the confirm button is clicked
56 */
57 onConfirm?: (value: string) => any;
58
59 /**
60 * Callback function when the dialog is canceled (cancel button is clicked / pressed escape / clicked outside)
61 */
62 onCancel?: () => any;
63
64 /**
65 * Type (color) of the confirm button (and the icon if <code>hasIcon</code>)
66 */
67 type?: any;
68
69 /**
70 * <code>clip</code> to remove the <code>&lt;body&gt;</code> scrollbar, <code>keep</code> to have a non scrollable scrollbar
71 * to avoid shifting background, but will set <code>&lt;body&gt;</code> to position fixed, might break some layouts
72 */
73 scroll?: 'clip' | 'keep';
74}
75
76type ShPromptDialogConfig = ShDialogConfig & {
77 /**
78 * Prompt only: input's attributes
79 */
80 inputAttrs?: any;
81};
82
83export declare const ShDialog: {
84 alert: (params: ShDialogConfig | string) => any;
85 confirm: (params: ShDialogConfig) => any;
86 prompt: (params: ShPromptDialogConfig) => any;
87}
88
89declare type ShModalConfig = {
90 content?: string;
91 component?: typeof _Vue;
92 parent?: _Vue;
93 props?: any;
94 events?: {
95 [index: string]: Function
96 };
97 width?: string | number;
98 hasModalCard?: boolean;
99 animation?: string;
100 canCancel?: boolean | Array<any>;
101 onCancel?: () => any;
102 scroll?: 'clip' | 'keep';
103}
104
105export declare const ShModalProgrammatic: {
106 open: (params: ShModalConfig | string) => any;
107}