athena-ui-js 2.0.0 → 2.0.1
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 +28 -4
- package/package.json +5 -2
- package/src/athena-ui.js +1 -1
- package/src/libs/config/config.js +1 -1
- package/src/libs/hephaestus/chartGenerator/chartGenerator.js +26 -2
- package/types/athena-ui.d.ts +96 -96
- package/types/chart.d.ts +1 -1
- package/types/classic.d.ts +1 -1
- package/types/components.d.ts +1 -1
- package/types/controls.d.ts +3 -3
- package/types/csv.d.ts +1 -1
- package/types/dialog.d.ts +2 -2
- package/types/dom.d.ts +1 -1
- package/types/feedback.d.ts +1 -1
- package/types/format.d.ts +1 -1
- package/types/forms.d.ts +2 -2
- package/types/i18n.d.ts +1 -1
- package/types/inputs.d.ts +4 -4
- package/types/libs/config/config.d.ts +3 -3
- package/types/libs/config/hooks.d.ts +8 -8
- package/types/libs/core/combobox.d.ts +10 -10
- package/types/libs/core/controls.d.ts +28 -28
- package/types/libs/core/cookies.d.ts +27 -27
- package/types/libs/core/csv.d.ts +12 -12
- package/types/libs/core/dateRange.d.ts +72 -72
- package/types/libs/core/dom.d.ts +65 -65
- package/types/libs/core/elementGenerator.d.ts +30 -30
- package/types/libs/core/errors.d.ts +29 -29
- package/types/libs/core/focus.d.ts +6 -6
- package/types/libs/core/format.d.ts +21 -21
- package/types/libs/core/hungarianControls.d.ts +2 -2
- package/types/libs/core/i18n.d.ts +17 -17
- package/types/libs/core/pagination.d.ts +5 -5
- package/types/libs/core/sanitize.d.ts +6 -6
- package/types/libs/core/tableMath.d.ts +26 -26
- package/types/libs/core/theme.d.ts +39 -39
- package/types/libs/core/validation.d.ts +56 -56
- package/types/libs/hephaestus/LayoutGenerator/basicLayoutGenerator.d.ts +10 -10
- package/types/libs/hephaestus/LayoutGenerator/footerContentGenerator.d.ts +4 -4
- package/types/libs/hephaestus/LayoutGenerator/headerContentGenerator.d.ts +20 -20
- package/types/libs/hephaestus/LayoutGenerator/wrapperContentGenerator.d.ts +1 -1
- package/types/libs/hephaestus/MenuGenerator/basicMenuGenerator.d.ts +14 -14
- package/types/libs/hephaestus/MenuGenerator/menuGenerator.d.ts +65 -65
- package/types/libs/hephaestus/auth/authState.d.ts +26 -26
- package/types/libs/hephaestus/auth/session.d.ts +26 -26
- package/types/libs/hephaestus/chartGenerator/chartGenerator.d.ts +2 -0
- package/types/libs/hephaestus/componentGenerator/componentGenerator.d.ts +222 -222
- package/types/libs/hephaestus/componentGenerator/themePicker.d.ts +24 -24
- package/types/libs/hephaestus/dialogGenerator/dialogGenerator.d.ts +120 -120
- package/types/libs/hephaestus/feedbackGenerator/feedbackGenerator.d.ts +86 -86
- package/types/libs/hephaestus/formGenerator/authForms.d.ts +122 -122
- package/types/libs/hephaestus/formGenerator/changePasswordFormGenerator.d.ts +6 -6
- package/types/libs/hephaestus/formGenerator/formBuilder.d.ts +113 -113
- package/types/libs/hephaestus/formGenerator/formUtils.d.ts +8 -8
- package/types/libs/hephaestus/formGenerator/loginFormGenerator.d.ts +11 -11
- package/types/libs/hephaestus/formGenerator/lostPasswordFormGenerator.d.ts +4 -4
- package/types/libs/hephaestus/formGenerator/registrationFormGenerator.d.ts +7 -7
- package/types/libs/hephaestus/hephaestus.d.ts +3 -3
- package/types/libs/hephaestus/inputGenerator/dropZoneGenerator.d.ts +48 -48
- package/types/libs/hephaestus/inputGenerator/inputGenerator.d.ts +185 -185
- package/types/libs/hephaestus/inputGenerator/richTextGenerator.d.ts +49 -49
- package/types/libs/hephaestus/modalGenerator/modalGenerator.d.ts +2 -2
- package/types/libs/hephaestus/navigationGenerator/navigationGenerator.d.ts +150 -150
- package/types/libs/hephaestus/router/matchRoute.d.ts +12 -12
- package/types/libs/hephaestus/router/router.d.ts +67 -67
- package/types/libs/hephaestus/tableGenerator/tableGenerator.d.ts +120 -120
- package/types/menu.d.ts +1 -1
- package/types/navigation.d.ts +1 -1
- package/types/res/themes/themes.d.ts +7 -7
- package/types/router.d.ts +1 -1
- package/types/sanitize.d.ts +1 -1
- package/types/session.d.ts +3 -3
- package/types/table.d.ts +1 -1
- package/types/testing.d.ts +27 -27
- package/types/theme.d.ts +2 -2
- package/types/validation.d.ts +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export function getChangePasswordFormData(): {
|
|
2
|
-
currentPassword: any;
|
|
3
|
-
newPassword: any;
|
|
4
|
-
};
|
|
5
|
-
export function validateChangePasswordForm(): string;
|
|
6
|
-
export function generateChangePasswordForm(parent?: string): void;
|
|
1
|
+
export function getChangePasswordFormData(): {
|
|
2
|
+
currentPassword: any;
|
|
3
|
+
newPassword: any;
|
|
4
|
+
};
|
|
5
|
+
export function validateChangePasswordForm(): string;
|
|
6
|
+
export function generateChangePasswordForm(parent?: string): void;
|
|
@@ -1,113 +1,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
|
-
* @returns {{element: HTMLFormElement, fields: Object<string, object>, getValues: Function, setValues: Function,
|
|
91
|
-
* setErrors: Function, validate: Function, reset: Function, setMessage: Function, submitButton: object}}
|
|
92
|
-
*/
|
|
93
|
-
export function generateForm(options?: {
|
|
94
|
-
parent?: string | Element;
|
|
95
|
-
id?: string;
|
|
96
|
-
fields: object[];
|
|
97
|
-
submitText?: string;
|
|
98
|
-
resetText?: string | false;
|
|
99
|
-
onSubmit?: (values: object, form: object) => (void | Promise<any>);
|
|
100
|
-
onChange?: (values: object, field: object) => void;
|
|
101
|
-
}): {
|
|
102
|
-
element: HTMLFormElement;
|
|
103
|
-
fields: {
|
|
104
|
-
[x: string]: object;
|
|
105
|
-
};
|
|
106
|
-
getValues: Function;
|
|
107
|
-
setValues: Function;
|
|
108
|
-
setErrors: Function;
|
|
109
|
-
validate: Function;
|
|
110
|
-
reset: Function;
|
|
111
|
-
setMessage: Function;
|
|
112
|
-
submitButton: object;
|
|
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
|
+
* @returns {{element: HTMLFormElement, fields: Object<string, object>, getValues: Function, setValues: Function,
|
|
91
|
+
* setErrors: Function, validate: Function, reset: Function, setMessage: Function, submitButton: object}}
|
|
92
|
+
*/
|
|
93
|
+
export function generateForm(options?: {
|
|
94
|
+
parent?: string | Element;
|
|
95
|
+
id?: string;
|
|
96
|
+
fields: object[];
|
|
97
|
+
submitText?: string;
|
|
98
|
+
resetText?: string | false;
|
|
99
|
+
onSubmit?: (values: object, form: object) => (void | Promise<any>);
|
|
100
|
+
onChange?: (values: object, field: object) => void;
|
|
101
|
+
}): {
|
|
102
|
+
element: HTMLFormElement;
|
|
103
|
+
fields: {
|
|
104
|
+
[x: string]: object;
|
|
105
|
+
};
|
|
106
|
+
getValues: Function;
|
|
107
|
+
setValues: Function;
|
|
108
|
+
setErrors: Function;
|
|
109
|
+
validate: Function;
|
|
110
|
+
reset: Function;
|
|
111
|
+
setMessage: Function;
|
|
112
|
+
submitButton: object;
|
|
113
|
+
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export function generateFormDiv(formId: any, className: any, parent?: string): HTMLElement;
|
|
2
|
-
export function generateRow(formId: any, name: any): string;
|
|
3
|
-
export function generateField(formId: any, name: any, label: any, inputType: any): void;
|
|
4
|
-
export function generateButton(formId: any, name: any, text: any, onclick: any): void;
|
|
5
|
-
export function generateMessage(formId: any): void;
|
|
6
|
-
export function showMessage(formId: any, text: any, isError?: boolean): void;
|
|
7
|
-
export function readControl(formId: any, name: any): any;
|
|
8
|
-
export { EMAIL_PATTERN } from "../../core/validation.js";
|
|
1
|
+
export function generateFormDiv(formId: any, className: any, parent?: string): HTMLElement;
|
|
2
|
+
export function generateRow(formId: any, name: any): string;
|
|
3
|
+
export function generateField(formId: any, name: any, label: any, inputType: any): void;
|
|
4
|
+
export function generateButton(formId: any, name: any, text: any, onclick: any): void;
|
|
5
|
+
export function generateMessage(formId: any): void;
|
|
6
|
+
export function showMessage(formId: any, text: any, isError?: boolean): void;
|
|
7
|
+
export function readControl(formId: any, name: any): any;
|
|
8
|
+
export { EMAIL_PATTERN } from "../../core/validation.js";
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export function getLoginFormData(): {
|
|
2
|
-
username: any;
|
|
3
|
-
password: any;
|
|
4
|
-
};
|
|
5
|
-
export function generateLoginForm(): void;
|
|
6
|
-
export function generateFormDiv(): void;
|
|
7
|
-
export function generateFormElements(): void;
|
|
8
|
-
export function generateUsernameElements(): void;
|
|
9
|
-
export function generatePasswordElements(): void;
|
|
10
|
-
export function generateRememberElement(): void;
|
|
11
|
-
export function generateSubmitElement(): void;
|
|
1
|
+
export function getLoginFormData(): {
|
|
2
|
+
username: any;
|
|
3
|
+
password: any;
|
|
4
|
+
};
|
|
5
|
+
export function generateLoginForm(): void;
|
|
6
|
+
export function generateFormDiv(): void;
|
|
7
|
+
export function generateFormElements(): void;
|
|
8
|
+
export function generateUsernameElements(): void;
|
|
9
|
+
export function generatePasswordElements(): void;
|
|
10
|
+
export function generateRememberElement(): void;
|
|
11
|
+
export function generateSubmitElement(): void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export function getLostPasswordFormData(): {
|
|
2
|
-
email: any;
|
|
3
|
-
};
|
|
4
|
-
export function generateLostPasswordForm(parent?: string): void;
|
|
1
|
+
export function getLostPasswordFormData(): {
|
|
2
|
+
email: any;
|
|
3
|
+
};
|
|
4
|
+
export function generateLostPasswordForm(parent?: string): void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export function getRegistrationFormData(): {
|
|
2
|
-
username: any;
|
|
3
|
-
email: any;
|
|
4
|
-
password: any;
|
|
5
|
-
};
|
|
6
|
-
export function validateRegistrationForm(): string;
|
|
7
|
-
export function generateRegistrationForm(parent?: string): void;
|
|
1
|
+
export function getRegistrationFormData(): {
|
|
2
|
+
username: any;
|
|
3
|
+
email: any;
|
|
4
|
+
password: any;
|
|
5
|
+
};
|
|
6
|
+
export function validateRegistrationForm(): string;
|
|
7
|
+
export function generateRegistrationForm(parent?: string): void;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export function loadScript(src: any): any;
|
|
2
|
-
export function resolveTheme(selected: any): any;
|
|
3
|
-
export function loadTheme(selected: any): Promise<any>;
|
|
1
|
+
export function loadScript(src: any): any;
|
|
2
|
+
export function resolveTheme(selected: any): any;
|
|
3
|
+
export function loadTheme(selected: any): Promise<any>;
|
|
@@ -1,48 +1,48 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Generates a drag-and-drop area. Files dropped on it (or picked with the browser dialog after a click / Enter / Space)
|
|
3
|
-
* are checked against `accept`, `maxSize` and `maxFiles`; the valid ones are passed to `onDrop`, the rest to `onReject`.
|
|
4
|
-
* Nothing is read or sent: what to do with the files is up to the caller (generateFileUpload builds on this).
|
|
5
|
-
*
|
|
6
|
-
* @param {object} options
|
|
7
|
-
* @param {string|Element} [options.parent]
|
|
8
|
-
* @param {string} [options.id]
|
|
9
|
-
* @param {string} [options.class]
|
|
10
|
-
* @param {*} [options.content] text, Node, array or function; the default is the localized "Drop files here" text
|
|
11
|
-
* @param {string} [options.accept] like ".png,image/*"
|
|
12
|
-
* @param {boolean} [options.multiple=true]
|
|
13
|
-
* @param {number} [options.maxSize] bytes per file
|
|
14
|
-
* @param {number} [options.maxFiles] files accepted per drop
|
|
15
|
-
* @param {boolean} [options.clickable=true] click / Enter / Space opens the file dialog
|
|
16
|
-
* @param {boolean} [options.disabled=false]
|
|
17
|
-
* @param {(files: File[]) => void} [options.onDrop] valid files
|
|
18
|
-
* @param {(rejected: {file: File, reason: string}[]) => void} [options.onReject]
|
|
19
|
-
* @param {(over: boolean) => void} [options.onDragChange] a drag entered / left the area
|
|
20
|
-
* @returns {{element: HTMLElement, input: HTMLInputElement, handleFiles: (files: Iterable<File>) => void,
|
|
21
|
-
* setDisabled: (disabled: boolean) => void, open: () => void}}
|
|
22
|
-
*/
|
|
23
|
-
export function createDropZone(options?: {
|
|
24
|
-
parent?: string | Element;
|
|
25
|
-
id?: string;
|
|
26
|
-
class?: string;
|
|
27
|
-
content?: any;
|
|
28
|
-
accept?: string;
|
|
29
|
-
multiple?: boolean;
|
|
30
|
-
maxSize?: number;
|
|
31
|
-
maxFiles?: number;
|
|
32
|
-
clickable?: boolean;
|
|
33
|
-
disabled?: boolean;
|
|
34
|
-
onDrop?: (files: File[]) => void;
|
|
35
|
-
onReject?: (rejected: {
|
|
36
|
-
file: File;
|
|
37
|
-
reason: string;
|
|
38
|
-
}[]) => void;
|
|
39
|
-
onDragChange?: (over: boolean) => void;
|
|
40
|
-
}): {
|
|
41
|
-
element: HTMLElement;
|
|
42
|
-
input: HTMLInputElement;
|
|
43
|
-
handleFiles: (files: Iterable<File>) => void;
|
|
44
|
-
setDisabled: (disabled: boolean) => void;
|
|
45
|
-
open: () => void;
|
|
46
|
-
};
|
|
47
|
-
/** Generates a drag-and-drop area into `parent`, see createDropZone. */
|
|
48
|
-
export function generateDropZone(options?: {}): any;
|
|
1
|
+
/**
|
|
2
|
+
* Generates a drag-and-drop area. Files dropped on it (or picked with the browser dialog after a click / Enter / Space)
|
|
3
|
+
* are checked against `accept`, `maxSize` and `maxFiles`; the valid ones are passed to `onDrop`, the rest to `onReject`.
|
|
4
|
+
* Nothing is read or sent: what to do with the files is up to the caller (generateFileUpload builds on this).
|
|
5
|
+
*
|
|
6
|
+
* @param {object} options
|
|
7
|
+
* @param {string|Element} [options.parent]
|
|
8
|
+
* @param {string} [options.id]
|
|
9
|
+
* @param {string} [options.class]
|
|
10
|
+
* @param {*} [options.content] text, Node, array or function; the default is the localized "Drop files here" text
|
|
11
|
+
* @param {string} [options.accept] like ".png,image/*"
|
|
12
|
+
* @param {boolean} [options.multiple=true]
|
|
13
|
+
* @param {number} [options.maxSize] bytes per file
|
|
14
|
+
* @param {number} [options.maxFiles] files accepted per drop
|
|
15
|
+
* @param {boolean} [options.clickable=true] click / Enter / Space opens the file dialog
|
|
16
|
+
* @param {boolean} [options.disabled=false]
|
|
17
|
+
* @param {(files: File[]) => void} [options.onDrop] valid files
|
|
18
|
+
* @param {(rejected: {file: File, reason: string}[]) => void} [options.onReject]
|
|
19
|
+
* @param {(over: boolean) => void} [options.onDragChange] a drag entered / left the area
|
|
20
|
+
* @returns {{element: HTMLElement, input: HTMLInputElement, handleFiles: (files: Iterable<File>) => void,
|
|
21
|
+
* setDisabled: (disabled: boolean) => void, open: () => void}}
|
|
22
|
+
*/
|
|
23
|
+
export function createDropZone(options?: {
|
|
24
|
+
parent?: string | Element;
|
|
25
|
+
id?: string;
|
|
26
|
+
class?: string;
|
|
27
|
+
content?: any;
|
|
28
|
+
accept?: string;
|
|
29
|
+
multiple?: boolean;
|
|
30
|
+
maxSize?: number;
|
|
31
|
+
maxFiles?: number;
|
|
32
|
+
clickable?: boolean;
|
|
33
|
+
disabled?: boolean;
|
|
34
|
+
onDrop?: (files: File[]) => void;
|
|
35
|
+
onReject?: (rejected: {
|
|
36
|
+
file: File;
|
|
37
|
+
reason: string;
|
|
38
|
+
}[]) => void;
|
|
39
|
+
onDragChange?: (over: boolean) => void;
|
|
40
|
+
}): {
|
|
41
|
+
element: HTMLElement;
|
|
42
|
+
input: HTMLInputElement;
|
|
43
|
+
handleFiles: (files: Iterable<File>) => void;
|
|
44
|
+
setDisabled: (disabled: boolean) => void;
|
|
45
|
+
open: () => void;
|
|
46
|
+
};
|
|
47
|
+
/** Generates a drag-and-drop area into `parent`, see createDropZone. */
|
|
48
|
+
export function generateDropZone(options?: {}): any;
|