athena-ui-js 2.4.1 → 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 +10 -2
- package/docs/styling.md +123 -123
- package/package.json +1 -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/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/res/themes/default/style.css +4 -0
- package/types/libs/config/config.d.ts +3 -3
- package/types/libs/hephaestus/chartGenerator/chartGenerator.d.ts +117 -95
- 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,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
|
+
};
|
|
@@ -1,113 +1,128 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Generates a button.
|
|
3
|
-
*
|
|
4
|
-
* @param {object} options
|
|
5
|
-
* @param {string|Element} [options.parent] id or element, defaults to the body
|
|
6
|
-
* @param {string} [options.id]
|
|
7
|
-
* @param {string} [options.text]
|
|
8
|
-
* @param {"primary"|"secondary"|"danger"|"link"} [options.variant="primary"]
|
|
9
|
-
* @param {"button"|"submit"|"reset"} [options.type="button"]
|
|
10
|
-
* @param {"small"|"large"} [options.size]
|
|
11
|
-
* @param {boolean} [options.disabled]
|
|
12
|
-
* @param {boolean} [options.loading] shows a spinner and blocks clicks
|
|
13
|
-
* @param {(event: Event) => void} [options.onclick]
|
|
14
|
-
* @returns {{element: HTMLButtonElement, setLoading: Function, setDisabled: Function, setText: Function}}
|
|
15
|
-
*/
|
|
16
|
-
export function generateButton(options?: {
|
|
17
|
-
parent?: string | Element;
|
|
18
|
-
id?: string;
|
|
19
|
-
text?: string;
|
|
20
|
-
variant?: "primary" | "secondary" | "danger" | "link";
|
|
21
|
-
type?: "button" | "submit" | "reset";
|
|
22
|
-
size?: "small" | "large";
|
|
23
|
-
disabled?: boolean;
|
|
24
|
-
loading?: boolean;
|
|
25
|
-
onclick?: (event: Event) => void;
|
|
26
|
-
}): {
|
|
27
|
-
element: HTMLButtonElement;
|
|
28
|
-
setLoading: Function;
|
|
29
|
-
setDisabled: Function;
|
|
30
|
-
setText: Function;
|
|
31
|
-
};
|
|
32
|
-
/**
|
|
33
|
-
* Generates one labelled form field with help text and an error line.
|
|
34
|
-
*
|
|
35
|
-
* @param {object} options
|
|
36
|
-
* @param {string} options.name key of the field in the form values
|
|
37
|
-
* @param {"text"|"password"|"email"|"number"|"date"|"datetime-local"|"time"|"url"|"tel"|"search"|"color"|"range"|"file"|"hidden"|"textarea"|"select"|"checkbox"|"switch"|"radio"|"checkboxes"|"autocomplete"|"multiselect"|"daterange"|"richtext"|"wysiwyg"} [options.type="text"]
|
|
38
|
-
* @param {string} [options.label]
|
|
39
|
-
* @param {string} [options.help] help text under the control
|
|
40
|
-
* @param {*} [options.value] initial value (boolean for checkbox / switch, array for checkboxes / multiple select)
|
|
41
|
-
* @param {(string|{value: string, text?: string, disabled?: boolean})[]} [options.options] choices of select / radio / checkboxes
|
|
42
|
-
* @param {boolean} [options.multiple] select / file: allow several values
|
|
43
|
-
* @param {string} [options.placeholder]
|
|
44
|
-
* @param {number} [options.rows] textarea rows
|
|
45
|
-
* @param {object} [options.rules] validation rules, see validateValue. They can also be given directly
|
|
46
|
-
* (required, email, minLength, ...)
|
|
47
|
-
* @param {(value, field) => void} [options.onChange]
|
|
48
|
-
* @param {() => object} [options.getValues] all form values (set by generateForm, used by `match`)
|
|
49
|
-
* @returns {{element: HTMLElement, name: string, getValue: Function, setValue: Function, validate: Function,
|
|
50
|
-
* setError: Function, focus: Function}}
|
|
51
|
-
*/
|
|
52
|
-
export function generateField(options?: {
|
|
53
|
-
name: string;
|
|
54
|
-
type?: "text" | "password" | "email" | "number" | "date" | "datetime-local" | "time" | "url" | "tel" | "search" | "color" | "range" | "file" | "hidden" | "textarea" | "select" | "checkbox" | "switch" | "radio" | "checkboxes" | "autocomplete" | "multiselect" | "daterange" | "richtext" | "wysiwyg";
|
|
55
|
-
label?: string;
|
|
56
|
-
help?: string;
|
|
57
|
-
value?: any;
|
|
58
|
-
options?: (string | {
|
|
59
|
-
value: string;
|
|
60
|
-
text?: string;
|
|
61
|
-
disabled?: boolean;
|
|
62
|
-
})[];
|
|
63
|
-
multiple?: boolean;
|
|
64
|
-
placeholder?: string;
|
|
65
|
-
rows?: number;
|
|
66
|
-
rules?: object;
|
|
67
|
-
onChange?: (value: any, field: any) => void;
|
|
68
|
-
getValues?: () => object;
|
|
69
|
-
}): {
|
|
70
|
-
element: HTMLElement;
|
|
71
|
-
name: string;
|
|
72
|
-
getValue: Function;
|
|
73
|
-
setValue: Function;
|
|
74
|
-
validate: Function;
|
|
75
|
-
setError: Function;
|
|
76
|
-
focus: Function;
|
|
77
|
-
};
|
|
78
|
-
/**
|
|
79
|
-
* Generates a form from a list of field definitions.
|
|
80
|
-
*
|
|
81
|
-
* @param {object} options
|
|
82
|
-
* @param {string|Element} [options.parent]
|
|
83
|
-
* @param {string} [options.id]
|
|
84
|
-
* @param {object[]} options.fields field definitions, see generateField
|
|
85
|
-
* @param {string} [options.submitText]
|
|
86
|
-
* @param {string|false} [options.resetText] adds a reset button when set
|
|
87
|
-
* @param {(values: object, form: object) => (void|Promise)} [options.onSubmit] called with the values when every
|
|
88
|
-
* field is valid. A returned promise keeps the submit button busy; a rejection is shown as form message.
|
|
89
|
-
* @param {(values: object, field: object) => void} [options.onChange]
|
|
90
|
-
* @
|
|
91
|
-
*
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Generates a button.
|
|
3
|
+
*
|
|
4
|
+
* @param {object} options
|
|
5
|
+
* @param {string|Element} [options.parent] id or element, defaults to the body
|
|
6
|
+
* @param {string} [options.id]
|
|
7
|
+
* @param {string} [options.text]
|
|
8
|
+
* @param {"primary"|"secondary"|"danger"|"link"} [options.variant="primary"]
|
|
9
|
+
* @param {"button"|"submit"|"reset"} [options.type="button"]
|
|
10
|
+
* @param {"small"|"large"} [options.size]
|
|
11
|
+
* @param {boolean} [options.disabled]
|
|
12
|
+
* @param {boolean} [options.loading] shows a spinner and blocks clicks
|
|
13
|
+
* @param {(event: Event) => void} [options.onclick]
|
|
14
|
+
* @returns {{element: HTMLButtonElement, setLoading: Function, setDisabled: Function, setText: Function}}
|
|
15
|
+
*/
|
|
16
|
+
export function generateButton(options?: {
|
|
17
|
+
parent?: string | Element;
|
|
18
|
+
id?: string;
|
|
19
|
+
text?: string;
|
|
20
|
+
variant?: "primary" | "secondary" | "danger" | "link";
|
|
21
|
+
type?: "button" | "submit" | "reset";
|
|
22
|
+
size?: "small" | "large";
|
|
23
|
+
disabled?: boolean;
|
|
24
|
+
loading?: boolean;
|
|
25
|
+
onclick?: (event: Event) => void;
|
|
26
|
+
}): {
|
|
27
|
+
element: HTMLButtonElement;
|
|
28
|
+
setLoading: Function;
|
|
29
|
+
setDisabled: Function;
|
|
30
|
+
setText: Function;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Generates one labelled form field with help text and an error line.
|
|
34
|
+
*
|
|
35
|
+
* @param {object} options
|
|
36
|
+
* @param {string} options.name key of the field in the form values
|
|
37
|
+
* @param {"text"|"password"|"email"|"number"|"date"|"datetime-local"|"time"|"url"|"tel"|"search"|"color"|"range"|"file"|"hidden"|"textarea"|"select"|"checkbox"|"switch"|"radio"|"checkboxes"|"autocomplete"|"multiselect"|"daterange"|"richtext"|"wysiwyg"} [options.type="text"]
|
|
38
|
+
* @param {string} [options.label]
|
|
39
|
+
* @param {string} [options.help] help text under the control
|
|
40
|
+
* @param {*} [options.value] initial value (boolean for checkbox / switch, array for checkboxes / multiple select)
|
|
41
|
+
* @param {(string|{value: string, text?: string, disabled?: boolean})[]} [options.options] choices of select / radio / checkboxes
|
|
42
|
+
* @param {boolean} [options.multiple] select / file: allow several values
|
|
43
|
+
* @param {string} [options.placeholder]
|
|
44
|
+
* @param {number} [options.rows] textarea rows
|
|
45
|
+
* @param {object} [options.rules] validation rules, see validateValue. They can also be given directly
|
|
46
|
+
* (required, email, minLength, ...)
|
|
47
|
+
* @param {(value, field) => void} [options.onChange]
|
|
48
|
+
* @param {() => object} [options.getValues] all form values (set by generateForm, used by `match`)
|
|
49
|
+
* @returns {{element: HTMLElement, name: string, getValue: Function, setValue: Function, validate: Function,
|
|
50
|
+
* setError: Function, focus: Function}}
|
|
51
|
+
*/
|
|
52
|
+
export function generateField(options?: {
|
|
53
|
+
name: string;
|
|
54
|
+
type?: "text" | "password" | "email" | "number" | "date" | "datetime-local" | "time" | "url" | "tel" | "search" | "color" | "range" | "file" | "hidden" | "textarea" | "select" | "checkbox" | "switch" | "radio" | "checkboxes" | "autocomplete" | "multiselect" | "daterange" | "richtext" | "wysiwyg";
|
|
55
|
+
label?: string;
|
|
56
|
+
help?: string;
|
|
57
|
+
value?: any;
|
|
58
|
+
options?: (string | {
|
|
59
|
+
value: string;
|
|
60
|
+
text?: string;
|
|
61
|
+
disabled?: boolean;
|
|
62
|
+
})[];
|
|
63
|
+
multiple?: boolean;
|
|
64
|
+
placeholder?: string;
|
|
65
|
+
rows?: number;
|
|
66
|
+
rules?: object;
|
|
67
|
+
onChange?: (value: any, field: any) => void;
|
|
68
|
+
getValues?: () => object;
|
|
69
|
+
}): {
|
|
70
|
+
element: HTMLElement;
|
|
71
|
+
name: string;
|
|
72
|
+
getValue: Function;
|
|
73
|
+
setValue: Function;
|
|
74
|
+
validate: Function;
|
|
75
|
+
setError: Function;
|
|
76
|
+
focus: Function;
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* Generates a form from a list of field definitions.
|
|
80
|
+
*
|
|
81
|
+
* @param {object} options
|
|
82
|
+
* @param {string|Element} [options.parent]
|
|
83
|
+
* @param {string} [options.id]
|
|
84
|
+
* @param {object[]} options.fields field definitions, see generateField
|
|
85
|
+
* @param {string} [options.submitText]
|
|
86
|
+
* @param {string|false} [options.resetText] adds a reset button when set
|
|
87
|
+
* @param {(values: object, form: object) => (void|Promise)} [options.onSubmit] called with the values when every
|
|
88
|
+
* field is valid. A returned promise keeps the submit button busy; a rejection is shown as form message.
|
|
89
|
+
* @param {(values: object, field: object) => void} [options.onChange]
|
|
90
|
+
* @param {boolean} [options.nested=false] a field called "soa.host" is the key `host` of the object `soa` in the values
|
|
91
|
+
*
|
|
92
|
+
* Field definitions can also have these, which only generateForm reads:
|
|
93
|
+
* - `show: (values) => boolean`: the field is shown while it returns true. A field that is not shown is not validated and not in the values.
|
|
94
|
+
* - `label: (values) => string`: a label that follows the other fields (`values` are the raw values of every field)
|
|
95
|
+
* - `send: false`: the field is validated but not in the values (the second field of "type the password again")
|
|
96
|
+
* - `trim: true`: a text value is trimmed
|
|
97
|
+
* - `empty: "omit"|"null"|"empty"`: what an empty value (an empty text, a number that is not a number) becomes: left out, null, or "".
|
|
98
|
+
* Without it the value stays as it is.
|
|
99
|
+
*
|
|
100
|
+
* A rejection of `onSubmit` with a `details` object ({ "soa.host": "Not a name" }) puts the messages at their fields; what has no field, and the message
|
|
101
|
+
* of the error when no field shows one, go to the message of the form.
|
|
102
|
+
* @returns {{element: HTMLFormElement, fields: Object<string, object>, getValues: Function, getRawValues: Function, setValues: Function,
|
|
103
|
+
* setErrors: Function, validate: Function, reset: Function, setMessage: Function, arrange: Function, submitButton: object}}
|
|
104
|
+
*/
|
|
105
|
+
export function generateForm(options?: {
|
|
106
|
+
parent?: string | Element;
|
|
107
|
+
id?: string;
|
|
108
|
+
fields: object[];
|
|
109
|
+
submitText?: string;
|
|
110
|
+
resetText?: string | false;
|
|
111
|
+
onSubmit?: (values: object, form: object) => (void | Promise<any>);
|
|
112
|
+
onChange?: (values: object, field: object) => void;
|
|
113
|
+
nested?: boolean;
|
|
114
|
+
}): {
|
|
115
|
+
element: HTMLFormElement;
|
|
116
|
+
fields: {
|
|
117
|
+
[x: string]: object;
|
|
118
|
+
};
|
|
119
|
+
getValues: Function;
|
|
120
|
+
getRawValues: Function;
|
|
121
|
+
setValues: Function;
|
|
122
|
+
setErrors: Function;
|
|
123
|
+
validate: Function;
|
|
124
|
+
reset: Function;
|
|
125
|
+
setMessage: Function;
|
|
126
|
+
arrange: Function;
|
|
127
|
+
submitButton: object;
|
|
128
|
+
};
|