Skip to content

Commit fe6eead

Browse files
committed
Dialog types
1 parent dbfcdc5 commit fe6eead

2 files changed

Lines changed: 62 additions & 0 deletions

File tree

plugins/plaster.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/// <reference path="../types/index.d.ts" />
2+
13
(function() {
24

35
var plaster_action;

types/index.d.ts

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
interface DialogFormElement {
2+
label: string
3+
type: string
4+
nocolon?: boolean
5+
readonly?: boolean
6+
value?: any
7+
placeholder?: string
8+
text?: string
9+
colorpicker?: any
10+
min?: number
11+
max?: number
12+
step?: number
13+
height?: number
14+
options: object
15+
}
16+
interface DialogOptions {
17+
title: string
18+
id: string
19+
/**
20+
* Array of HTML object strings for each line of content in the dialog.
21+
*/
22+
lines: string[]
23+
/**
24+
* If false, the confirm button of the dialog is disabled
25+
*/
26+
confirmEnabled?: boolean
27+
/**
28+
* If false, the cancel button of the dialog is disabled
29+
*/
30+
cancelEnabled?: boolean
31+
/**
32+
* Function to execute when the user confirms the dialog
33+
*/
34+
onConfirm?: (formResult: object) => void
35+
/**
36+
* Function to execute when the user cancels the dialog
37+
*/
38+
onCancel?: () => void
39+
/**
40+
* Creates a form in the dialog
41+
*/
42+
form?: {
43+
[formElement: string]: string | DialogFormElement
44+
}
45+
}
46+
47+
class Dialog {
48+
constructor (options: DialogOptions)
49+
show: () => Dialog
50+
hide: () => Dialog
51+
/**
52+
* Triggers the confirm event of the dialog.
53+
*/
54+
confirm: () => void
55+
/**
56+
* Triggers the cancel event of the dialog.
57+
*/
58+
cancel: () => void
59+
60+
}

0 commit comments

Comments
 (0)