athena-ui-js 2.4.0 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +32 -2
- package/docs/styling.md +1 -1
- package/package.json +4 -1
- package/src/athena-ui.js +1 -1
- package/src/libs/config/config.js +1 -1
- package/src/libs/core/i18n.js +2 -0
- package/src/libs/hephaestus/chartGenerator/chartGenerator.js +70 -28
- package/src/libs/hephaestus/codeGenerator/codeEditor.js +1037 -0
- package/src/libs/hephaestus/codeGenerator/codeGenerator.js +286 -0
- package/src/libs/hephaestus/dialogGenerator/dialogGenerator.js +5 -2
- package/src/libs/hephaestus/formGenerator/formBuilder.js +86 -5
- package/src/libs/hephaestus/tableGenerator/tableGenerator.js +5 -1
- package/src/libs/hephaestus/widgetGrid/widgetGrid.js +870 -0
- package/src/res/themes/default/style.css +4 -0
- package/types/athena-ui.d.ts +103 -103
- package/types/code.d.ts +4 -4
- package/types/libs/config/config.d.ts +3 -3
- package/types/libs/core/codeDiff.d.ts +32 -32
- package/types/libs/core/codeLanguages.d.ts +58 -58
- package/types/libs/hephaestus/chartGenerator/chartGenerator.d.ts +117 -95
- package/types/libs/hephaestus/codeGenerator/codeEditor.d.ts +60 -60
- package/types/libs/hephaestus/codeGenerator/codeGenerator.d.ts +99 -99
- package/types/libs/hephaestus/dialogGenerator/dialogGenerator.d.ts +122 -120
- package/types/libs/hephaestus/formGenerator/authForms.d.ts +130 -122
- package/types/libs/hephaestus/formGenerator/formBuilder.d.ts +128 -113
- package/types/libs/hephaestus/tableGenerator/tableGenerator.d.ts +129 -123
|
@@ -1,120 +1,122 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Opens a dialog and resolves with the value of the button that was used,
|
|
3
|
-
* or with `null` when it was dismissed (Esc, the close button, a click on the backdrop).
|
|
4
|
-
*
|
|
5
|
-
* @param {object} options
|
|
6
|
-
* @param {string} [options.title]
|
|
7
|
-
* @param {string|Node|Array} [options.content] text is inserted as text, never as HTML
|
|
8
|
-
* @param {{text: string, value?: *, variant?: string, autofocus?: boolean}[]} [options.buttons]
|
|
9
|
-
* @param {boolean} [options.dismissible=true]
|
|
10
|
-
* @param {(value) => (boolean|Promise<boolean>)} [options.beforeClose] return false to keep the dialog open
|
|
11
|
-
* @param {"small"|"medium"|"large"|"full"} [options.size="medium"] width of the dialog (360 / 480 / 720 px / the whole window)
|
|
12
|
-
* @param {string} [options.class] extra CSS class(es) of the dialog element
|
|
13
|
-
* @returns {Promise<*> & {element: HTMLDialogElement, backdrop: HTMLDialogElement, close: (value?) => Promise<void>}}
|
|
14
|
-
* resolves with the pressed button's value; the promise also carries the handle of the open dialog
|
|
15
|
-
*/
|
|
16
|
-
export function showDialog(options?: {
|
|
17
|
-
title?: string;
|
|
18
|
-
content?: string | Node | any[];
|
|
19
|
-
buttons?: {
|
|
20
|
-
text: string;
|
|
21
|
-
value?: any;
|
|
22
|
-
variant?: string;
|
|
23
|
-
autofocus?: boolean;
|
|
24
|
-
}[];
|
|
25
|
-
dismissible?: boolean;
|
|
26
|
-
beforeClose?: (value: any) => (boolean | Promise<boolean>);
|
|
27
|
-
size?: "small" | "medium" | "large" | "full";
|
|
28
|
-
class?: string;
|
|
29
|
-
}): Promise<any> & {
|
|
30
|
-
element: HTMLDialogElement;
|
|
31
|
-
backdrop: HTMLDialogElement;
|
|
32
|
-
close: (value?: any) => Promise<void>;
|
|
33
|
-
};
|
|
34
|
-
/** Message with an OK button. Resolves when it is closed. */
|
|
35
|
-
export function alertDialog(message: any, { title, okText }?: {
|
|
36
|
-
okText?: any;
|
|
37
|
-
}): Promise<void>;
|
|
38
|
-
/** Question with confirm and cancel buttons. Resolves with true / false. See showConfirm for `typeToConfirm`. */
|
|
39
|
-
export function confirmDialog(message: any, options?: {}): Promise<boolean> & {
|
|
40
|
-
element: HTMLElement;
|
|
41
|
-
close: Function;
|
|
42
|
-
};
|
|
43
|
-
/**
|
|
44
|
-
* Asks for a confirmation. Resolves with true when confirmed, false when cancelled or dismissed.
|
|
45
|
-
*
|
|
46
|
-
* @param {object} options
|
|
47
|
-
* @param {string} [options.title]
|
|
48
|
-
* @param {string|Node|Array} options.message
|
|
49
|
-
* @param {string} [options.confirmText]
|
|
50
|
-
* @param {string} [options.cancelText]
|
|
51
|
-
* @param {boolean} [options.danger=false] red confirm button
|
|
52
|
-
* @param {string} [options.typeToConfirm] the person has to type exactly this text before the dialog confirms
|
|
53
|
-
* (for things that cannot be undone: the name of what is deleted)
|
|
54
|
-
* @param {"small"|"medium"|"large"|"full"} [options.size]
|
|
55
|
-
* @returns {Promise<boolean> & {element: HTMLElement, close: Function}}
|
|
56
|
-
*/
|
|
57
|
-
export function showConfirm({ title, message, confirmText, cancelText, danger, typeToConfirm, size }?: {
|
|
58
|
-
title?: string;
|
|
59
|
-
message: string | Node | any[];
|
|
60
|
-
confirmText?: string;
|
|
61
|
-
cancelText?: string;
|
|
62
|
-
danger?: boolean;
|
|
63
|
-
typeToConfirm?: string;
|
|
64
|
-
size?: "small" | "medium" | "large" | "full";
|
|
65
|
-
}): Promise<boolean> & {
|
|
66
|
-
element: HTMLElement;
|
|
67
|
-
close: Function;
|
|
68
|
-
};
|
|
69
|
-
/**
|
|
70
|
-
* A dialog that holds a form (see generateForm): validation, Enter submits, the button shows a spinner while it saves.
|
|
71
|
-
* `onSubmit(values, form)` saves. When it throws (or rejects) the message is shown in the dialog and the dialog stays open;
|
|
72
|
-
* `form.setErrors({ field: "message" })` marks single fields, for example with errors of the server. When it returns, the dialog closes.
|
|
73
|
-
*
|
|
74
|
-
* @param {object} options
|
|
75
|
-
* @param {string} [options.title]
|
|
76
|
-
* @param {string} [options.intro] text above the fields
|
|
77
|
-
* @param {string|Node|Array} [options.content] nodes above the fields
|
|
78
|
-
* @param {object[]} options.fields field definitions, see generateField
|
|
79
|
-
* @param {string} [options.submitText]
|
|
80
|
-
* @param {string} [options.cancelText]
|
|
81
|
-
* @param {boolean} [options.danger=false] red submit button
|
|
82
|
-
* @param {"small"|"medium"|"large"|"full"} [options.size]
|
|
83
|
-
* @param {
|
|
84
|
-
* @param {(form: object) => void}
|
|
85
|
-
* @
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
*
|
|
107
|
-
*
|
|
108
|
-
* @param {string}
|
|
109
|
-
* @param {
|
|
110
|
-
* @param {string} [options.
|
|
111
|
-
* @param {string} [options.
|
|
112
|
-
* @param {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Opens a dialog and resolves with the value of the button that was used,
|
|
3
|
+
* or with `null` when it was dismissed (Esc, the close button, a click on the backdrop).
|
|
4
|
+
*
|
|
5
|
+
* @param {object} options
|
|
6
|
+
* @param {string} [options.title]
|
|
7
|
+
* @param {string|Node|Array} [options.content] text is inserted as text, never as HTML
|
|
8
|
+
* @param {{text: string, value?: *, variant?: string, autofocus?: boolean}[]} [options.buttons]
|
|
9
|
+
* @param {boolean} [options.dismissible=true]
|
|
10
|
+
* @param {(value) => (boolean|Promise<boolean>)} [options.beforeClose] return false to keep the dialog open
|
|
11
|
+
* @param {"small"|"medium"|"large"|"full"} [options.size="medium"] width of the dialog (360 / 480 / 720 px / the whole window)
|
|
12
|
+
* @param {string} [options.class] extra CSS class(es) of the dialog element
|
|
13
|
+
* @returns {Promise<*> & {element: HTMLDialogElement, backdrop: HTMLDialogElement, close: (value?) => Promise<void>}}
|
|
14
|
+
* resolves with the pressed button's value; the promise also carries the handle of the open dialog
|
|
15
|
+
*/
|
|
16
|
+
export function showDialog(options?: {
|
|
17
|
+
title?: string;
|
|
18
|
+
content?: string | Node | any[];
|
|
19
|
+
buttons?: {
|
|
20
|
+
text: string;
|
|
21
|
+
value?: any;
|
|
22
|
+
variant?: string;
|
|
23
|
+
autofocus?: boolean;
|
|
24
|
+
}[];
|
|
25
|
+
dismissible?: boolean;
|
|
26
|
+
beforeClose?: (value: any) => (boolean | Promise<boolean>);
|
|
27
|
+
size?: "small" | "medium" | "large" | "full";
|
|
28
|
+
class?: string;
|
|
29
|
+
}): Promise<any> & {
|
|
30
|
+
element: HTMLDialogElement;
|
|
31
|
+
backdrop: HTMLDialogElement;
|
|
32
|
+
close: (value?: any) => Promise<void>;
|
|
33
|
+
};
|
|
34
|
+
/** Message with an OK button. Resolves when it is closed. */
|
|
35
|
+
export function alertDialog(message: any, { title, okText }?: {
|
|
36
|
+
okText?: any;
|
|
37
|
+
}): Promise<void>;
|
|
38
|
+
/** Question with confirm and cancel buttons. Resolves with true / false. See showConfirm for `typeToConfirm`. */
|
|
39
|
+
export function confirmDialog(message: any, options?: {}): Promise<boolean> & {
|
|
40
|
+
element: HTMLElement;
|
|
41
|
+
close: Function;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Asks for a confirmation. Resolves with true when confirmed, false when cancelled or dismissed.
|
|
45
|
+
*
|
|
46
|
+
* @param {object} options
|
|
47
|
+
* @param {string} [options.title]
|
|
48
|
+
* @param {string|Node|Array} options.message
|
|
49
|
+
* @param {string} [options.confirmText]
|
|
50
|
+
* @param {string} [options.cancelText]
|
|
51
|
+
* @param {boolean} [options.danger=false] red confirm button
|
|
52
|
+
* @param {string} [options.typeToConfirm] the person has to type exactly this text before the dialog confirms
|
|
53
|
+
* (for things that cannot be undone: the name of what is deleted)
|
|
54
|
+
* @param {"small"|"medium"|"large"|"full"} [options.size]
|
|
55
|
+
* @returns {Promise<boolean> & {element: HTMLElement, close: Function}}
|
|
56
|
+
*/
|
|
57
|
+
export function showConfirm({ title, message, confirmText, cancelText, danger, typeToConfirm, size }?: {
|
|
58
|
+
title?: string;
|
|
59
|
+
message: string | Node | any[];
|
|
60
|
+
confirmText?: string;
|
|
61
|
+
cancelText?: string;
|
|
62
|
+
danger?: boolean;
|
|
63
|
+
typeToConfirm?: string;
|
|
64
|
+
size?: "small" | "medium" | "large" | "full";
|
|
65
|
+
}): Promise<boolean> & {
|
|
66
|
+
element: HTMLElement;
|
|
67
|
+
close: Function;
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* A dialog that holds a form (see generateForm): validation, Enter submits, the button shows a spinner while it saves.
|
|
71
|
+
* `onSubmit(values, form)` saves. When it throws (or rejects) the message is shown in the dialog and the dialog stays open;
|
|
72
|
+
* `form.setErrors({ field: "message" })` marks single fields, for example with errors of the server. When it returns, the dialog closes.
|
|
73
|
+
*
|
|
74
|
+
* @param {object} options
|
|
75
|
+
* @param {string} [options.title]
|
|
76
|
+
* @param {string} [options.intro] text above the fields
|
|
77
|
+
* @param {string|Node|Array} [options.content] nodes above the fields
|
|
78
|
+
* @param {object[]} options.fields field definitions, see generateField
|
|
79
|
+
* @param {string} [options.submitText]
|
|
80
|
+
* @param {string} [options.cancelText]
|
|
81
|
+
* @param {boolean} [options.danger=false] red submit button
|
|
82
|
+
* @param {"small"|"medium"|"large"|"full"} [options.size]
|
|
83
|
+
* @param {boolean} [options.nested=false] a field called "soa.host" is `values.soa.host` (see generateForm, which also explains `show`, `label`, `send`, `trim` and `empty` of a field)
|
|
84
|
+
* @param {(values: object, form: object) => (void|Promise)} options.onSubmit
|
|
85
|
+
* @param {(form: object) => void} [options.onReady] called with the form once it is built
|
|
86
|
+
* @returns {Promise<boolean> & {element: HTMLElement, form: object, close: Function}} resolves with true when it was saved, false when dismissed
|
|
87
|
+
*/
|
|
88
|
+
export function showFormDialog({ title, intro, content, fields, submitText, cancelText, danger, size, nested, onSubmit, onReady }?: {
|
|
89
|
+
title?: string;
|
|
90
|
+
intro?: string;
|
|
91
|
+
content?: string | Node | any[];
|
|
92
|
+
fields: object[];
|
|
93
|
+
submitText?: string;
|
|
94
|
+
cancelText?: string;
|
|
95
|
+
danger?: boolean;
|
|
96
|
+
size?: "small" | "medium" | "large" | "full";
|
|
97
|
+
nested?: boolean;
|
|
98
|
+
onSubmit: (values: object, form: object) => (void | Promise<any>);
|
|
99
|
+
onReady?: (form: object) => void;
|
|
100
|
+
}): Promise<boolean> & {
|
|
101
|
+
element: HTMLElement;
|
|
102
|
+
form: object;
|
|
103
|
+
close: Function;
|
|
104
|
+
};
|
|
105
|
+
/**
|
|
106
|
+
* Asks for a text value. Resolves with the entered text, or null when cancelled.
|
|
107
|
+
*
|
|
108
|
+
* @param {string} message
|
|
109
|
+
* @param {object} [options]
|
|
110
|
+
* @param {string} [options.title]
|
|
111
|
+
* @param {string} [options.value] initial value
|
|
112
|
+
* @param {string} [options.placeholder]
|
|
113
|
+
* @param {string} [options.type="text"] input type
|
|
114
|
+
* @param {(value: string) => string} [options.validate] returns an error text, or "" when valid
|
|
115
|
+
*/
|
|
116
|
+
export function promptDialog(message: string, { title, value, placeholder, type, validate, okText, cancelText }?: {
|
|
117
|
+
title?: string;
|
|
118
|
+
value?: string;
|
|
119
|
+
placeholder?: string;
|
|
120
|
+
type?: string;
|
|
121
|
+
validate?: (value: string) => string;
|
|
122
|
+
}): Promise<any>;
|
|
@@ -1,122 +1,130 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A sign in form: username (or email), password, and optionally "Remember me".
|
|
3
|
-
*
|
|
4
|
-
* @param {object} options
|
|
5
|
-
* @param {string|Element} [options.parent]
|
|
6
|
-
* @param {(values: {username: string, password: string, remember?: boolean}, form: object) => (void|Promise)} options.onSubmit
|
|
7
|
-
* @param {boolean} [options.remember=false] shows "Remember me"
|
|
8
|
-
* @param {"username"|"email"} [options.identifier="username"] what the first field asks for
|
|
9
|
-
* @param {string} [options.submitText]
|
|
10
|
-
*/
|
|
11
|
-
export function generateSignInForm(options?: {
|
|
12
|
-
parent?: string | Element;
|
|
13
|
-
onSubmit: (values: {
|
|
14
|
-
username: string;
|
|
15
|
-
password: string;
|
|
16
|
-
remember?: boolean;
|
|
17
|
-
}, form: object) => (void | Promise<any>);
|
|
18
|
-
remember?: boolean;
|
|
19
|
-
identifier?: "username" | "email";
|
|
20
|
-
submitText?: string;
|
|
21
|
-
}): {
|
|
22
|
-
element: HTMLFormElement;
|
|
23
|
-
fields: {
|
|
24
|
-
[x: string]: any;
|
|
25
|
-
};
|
|
26
|
-
getValues: Function;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
* @param {
|
|
40
|
-
*
|
|
41
|
-
* @param {
|
|
42
|
-
*
|
|
43
|
-
* @param {
|
|
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
|
-
|
|
1
|
+
/**
|
|
2
|
+
* A sign in form: username (or email), password, and optionally "Remember me".
|
|
3
|
+
*
|
|
4
|
+
* @param {object} options
|
|
5
|
+
* @param {string|Element} [options.parent]
|
|
6
|
+
* @param {(values: {username: string, password: string, remember?: boolean}, form: object) => (void|Promise)} options.onSubmit
|
|
7
|
+
* @param {boolean} [options.remember=false] shows "Remember me"
|
|
8
|
+
* @param {"username"|"email"} [options.identifier="username"] what the first field asks for
|
|
9
|
+
* @param {string} [options.submitText]
|
|
10
|
+
*/
|
|
11
|
+
export function generateSignInForm(options?: {
|
|
12
|
+
parent?: string | Element;
|
|
13
|
+
onSubmit: (values: {
|
|
14
|
+
username: string;
|
|
15
|
+
password: string;
|
|
16
|
+
remember?: boolean;
|
|
17
|
+
}, form: object) => (void | Promise<any>);
|
|
18
|
+
remember?: boolean;
|
|
19
|
+
identifier?: "username" | "email";
|
|
20
|
+
submitText?: string;
|
|
21
|
+
}): {
|
|
22
|
+
element: HTMLFormElement;
|
|
23
|
+
fields: {
|
|
24
|
+
[x: string]: any;
|
|
25
|
+
};
|
|
26
|
+
getValues: Function;
|
|
27
|
+
getRawValues: Function;
|
|
28
|
+
setValues: Function;
|
|
29
|
+
setErrors: Function;
|
|
30
|
+
validate: Function;
|
|
31
|
+
reset: Function;
|
|
32
|
+
setMessage: Function;
|
|
33
|
+
arrange: Function;
|
|
34
|
+
submitButton: object;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* A registration form: username, email, password and its confirmation.
|
|
38
|
+
*
|
|
39
|
+
* @param {object} options
|
|
40
|
+
* @param {string|Element} [options.parent]
|
|
41
|
+
* @param {(values: {username: string, email: string, password: string}, form: object) => (void|Promise)} options.onSubmit
|
|
42
|
+
* the confirmation is checked here and not sent
|
|
43
|
+
* @param {number} [options.passwordMinLength=8]
|
|
44
|
+
* @param {boolean} [options.username=true] false leaves the username out (sign in with the email)
|
|
45
|
+
* @param {string} [options.submitText]
|
|
46
|
+
*/
|
|
47
|
+
export function generateSignUpForm(options?: {
|
|
48
|
+
parent?: string | Element;
|
|
49
|
+
onSubmit: (values: {
|
|
50
|
+
username: string;
|
|
51
|
+
email: string;
|
|
52
|
+
password: string;
|
|
53
|
+
}, form: object) => (void | Promise<any>);
|
|
54
|
+
passwordMinLength?: number;
|
|
55
|
+
username?: boolean;
|
|
56
|
+
submitText?: string;
|
|
57
|
+
}): {
|
|
58
|
+
element: HTMLFormElement;
|
|
59
|
+
fields: {
|
|
60
|
+
[x: string]: any;
|
|
61
|
+
};
|
|
62
|
+
getValues: Function;
|
|
63
|
+
getRawValues: Function;
|
|
64
|
+
setValues: Function;
|
|
65
|
+
setErrors: Function;
|
|
66
|
+
validate: Function;
|
|
67
|
+
reset: Function;
|
|
68
|
+
setMessage: Function;
|
|
69
|
+
arrange: Function;
|
|
70
|
+
submitButton: object;
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* Asks for the email address to send a reset link to.
|
|
74
|
+
*
|
|
75
|
+
* @param {object} options
|
|
76
|
+
* @param {string|Element} [options.parent]
|
|
77
|
+
* @param {(values: {email: string}, form: object) => (void|Promise)} options.onSubmit
|
|
78
|
+
*/
|
|
79
|
+
export function generatePasswordResetForm(options?: {
|
|
80
|
+
parent?: string | Element;
|
|
81
|
+
onSubmit: (values: {
|
|
82
|
+
email: string;
|
|
83
|
+
}, form: object) => (void | Promise<any>);
|
|
84
|
+
}): {
|
|
85
|
+
element: HTMLFormElement;
|
|
86
|
+
fields: {
|
|
87
|
+
[x: string]: any;
|
|
88
|
+
};
|
|
89
|
+
getValues: Function;
|
|
90
|
+
getRawValues: Function;
|
|
91
|
+
setValues: Function;
|
|
92
|
+
setErrors: Function;
|
|
93
|
+
validate: Function;
|
|
94
|
+
reset: Function;
|
|
95
|
+
setMessage: Function;
|
|
96
|
+
arrange: Function;
|
|
97
|
+
submitButton: object;
|
|
98
|
+
};
|
|
99
|
+
/**
|
|
100
|
+
* Change of the password of the person who is signed in: the current one, the new one and its confirmation.
|
|
101
|
+
*
|
|
102
|
+
* @param {object} options
|
|
103
|
+
* @param {string|Element} [options.parent]
|
|
104
|
+
* @param {(values: {currentPassword: string, newPassword: string}, form: object) => (void|Promise)} options.onSubmit
|
|
105
|
+
* @param {number} [options.passwordMinLength=8]
|
|
106
|
+
* @param {string} [options.username] when given, a hidden username field helps the password manager to update the right entry
|
|
107
|
+
*/
|
|
108
|
+
export function generatePasswordChangeForm(options?: {
|
|
109
|
+
parent?: string | Element;
|
|
110
|
+
onSubmit: (values: {
|
|
111
|
+
currentPassword: string;
|
|
112
|
+
newPassword: string;
|
|
113
|
+
}, form: object) => (void | Promise<any>);
|
|
114
|
+
passwordMinLength?: number;
|
|
115
|
+
username?: string;
|
|
116
|
+
}): {
|
|
117
|
+
element: HTMLFormElement;
|
|
118
|
+
fields: {
|
|
119
|
+
[x: string]: any;
|
|
120
|
+
};
|
|
121
|
+
getValues: Function;
|
|
122
|
+
getRawValues: Function;
|
|
123
|
+
setValues: Function;
|
|
124
|
+
setErrors: Function;
|
|
125
|
+
validate: Function;
|
|
126
|
+
reset: Function;
|
|
127
|
+
setMessage: Function;
|
|
128
|
+
arrange: Function;
|
|
129
|
+
submitButton: object;
|
|
130
|
+
};
|