athena-ui-js 2.0.0 → 2.1.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.
Files changed (83) hide show
  1. package/README.md +47 -5
  2. package/docs/migration-2.0.md +1 -1
  3. package/docs/styling.md +3 -1
  4. package/package.json +5 -2
  5. package/src/athena-ui.js +1 -1
  6. package/src/libs/config/config.js +1 -1
  7. package/src/libs/core/popover.js +96 -0
  8. package/src/libs/hephaestus/chartGenerator/chartGenerator.js +26 -2
  9. package/src/libs/hephaestus/componentGenerator/componentGenerator.js +26 -2
  10. package/src/libs/hephaestus/navigationGenerator/navigationGenerator.js +45 -9
  11. package/src/res/themes/default/style.css +32 -0
  12. package/types/athena-ui.d.ts +96 -96
  13. package/types/chart.d.ts +1 -1
  14. package/types/classic.d.ts +1 -1
  15. package/types/components.d.ts +1 -1
  16. package/types/controls.d.ts +3 -3
  17. package/types/csv.d.ts +1 -1
  18. package/types/dialog.d.ts +2 -2
  19. package/types/dom.d.ts +1 -1
  20. package/types/feedback.d.ts +1 -1
  21. package/types/format.d.ts +1 -1
  22. package/types/forms.d.ts +2 -2
  23. package/types/i18n.d.ts +1 -1
  24. package/types/inputs.d.ts +4 -4
  25. package/types/libs/config/config.d.ts +3 -3
  26. package/types/libs/config/hooks.d.ts +8 -8
  27. package/types/libs/core/combobox.d.ts +10 -10
  28. package/types/libs/core/controls.d.ts +28 -28
  29. package/types/libs/core/cookies.d.ts +27 -27
  30. package/types/libs/core/csv.d.ts +12 -12
  31. package/types/libs/core/dateRange.d.ts +72 -72
  32. package/types/libs/core/dom.d.ts +65 -65
  33. package/types/libs/core/elementGenerator.d.ts +30 -30
  34. package/types/libs/core/errors.d.ts +29 -29
  35. package/types/libs/core/focus.d.ts +6 -6
  36. package/types/libs/core/format.d.ts +21 -21
  37. package/types/libs/core/hungarianControls.d.ts +2 -2
  38. package/types/libs/core/i18n.d.ts +17 -17
  39. package/types/libs/core/pagination.d.ts +5 -5
  40. package/types/libs/core/popover.d.ts +36 -0
  41. package/types/libs/core/sanitize.d.ts +6 -6
  42. package/types/libs/core/tableMath.d.ts +26 -26
  43. package/types/libs/core/theme.d.ts +39 -39
  44. package/types/libs/core/validation.d.ts +56 -56
  45. package/types/libs/hephaestus/LayoutGenerator/basicLayoutGenerator.d.ts +10 -10
  46. package/types/libs/hephaestus/LayoutGenerator/footerContentGenerator.d.ts +4 -4
  47. package/types/libs/hephaestus/LayoutGenerator/headerContentGenerator.d.ts +20 -20
  48. package/types/libs/hephaestus/LayoutGenerator/wrapperContentGenerator.d.ts +1 -1
  49. package/types/libs/hephaestus/MenuGenerator/basicMenuGenerator.d.ts +14 -14
  50. package/types/libs/hephaestus/MenuGenerator/menuGenerator.d.ts +65 -65
  51. package/types/libs/hephaestus/auth/authState.d.ts +26 -26
  52. package/types/libs/hephaestus/auth/session.d.ts +26 -26
  53. package/types/libs/hephaestus/chartGenerator/chartGenerator.d.ts +93 -91
  54. package/types/libs/hephaestus/componentGenerator/componentGenerator.d.ts +3 -1
  55. package/types/libs/hephaestus/componentGenerator/themePicker.d.ts +24 -24
  56. package/types/libs/hephaestus/dialogGenerator/dialogGenerator.d.ts +120 -120
  57. package/types/libs/hephaestus/feedbackGenerator/feedbackGenerator.d.ts +86 -86
  58. package/types/libs/hephaestus/formGenerator/authForms.d.ts +122 -122
  59. package/types/libs/hephaestus/formGenerator/changePasswordFormGenerator.d.ts +6 -6
  60. package/types/libs/hephaestus/formGenerator/formBuilder.d.ts +113 -113
  61. package/types/libs/hephaestus/formGenerator/formUtils.d.ts +8 -8
  62. package/types/libs/hephaestus/formGenerator/loginFormGenerator.d.ts +11 -11
  63. package/types/libs/hephaestus/formGenerator/lostPasswordFormGenerator.d.ts +4 -4
  64. package/types/libs/hephaestus/formGenerator/registrationFormGenerator.d.ts +7 -7
  65. package/types/libs/hephaestus/hephaestus.d.ts +3 -3
  66. package/types/libs/hephaestus/inputGenerator/dropZoneGenerator.d.ts +48 -48
  67. package/types/libs/hephaestus/inputGenerator/inputGenerator.d.ts +185 -185
  68. package/types/libs/hephaestus/inputGenerator/richTextGenerator.d.ts +49 -49
  69. package/types/libs/hephaestus/modalGenerator/modalGenerator.d.ts +2 -2
  70. package/types/libs/hephaestus/navigationGenerator/navigationGenerator.d.ts +4 -1
  71. package/types/libs/hephaestus/router/matchRoute.d.ts +12 -12
  72. package/types/libs/hephaestus/router/router.d.ts +67 -67
  73. package/types/libs/hephaestus/tableGenerator/tableGenerator.d.ts +120 -120
  74. package/types/menu.d.ts +1 -1
  75. package/types/navigation.d.ts +1 -1
  76. package/types/res/themes/themes.d.ts +7 -7
  77. package/types/router.d.ts +1 -1
  78. package/types/sanitize.d.ts +1 -1
  79. package/types/session.d.ts +3 -3
  80. package/types/table.d.ts +1 -1
  81. package/types/testing.d.ts +27 -27
  82. package/types/theme.d.ts +2 -2
  83. package/types/validation.d.ts +1 -1
@@ -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;
@@ -1,185 +1,185 @@
1
- /**
2
- * Generates an input with suggestions. `options` is an array of strings / { value, text }, or a function
3
- * (query) => options | Promise<options> for remote data.
4
- *
5
- * @param {object} options
6
- * @param {string|Element} [options.parent]
7
- * @param {string} [options.label]
8
- * @param {Array|Function} options.options
9
- * @param {number} [options.minChars=1] characters needed before suggestions show
10
- * @param {boolean} [options.strict=false] only a value chosen from the list is accepted
11
- * @param {(item: {value, text}) => void} [options.onSelect]
12
- * @param {(value) => void} [options.onChange]
13
- * @returns {{element: HTMLElement, input: HTMLInputElement, getValue: Function, setValue: Function}}
14
- */
15
- export function generateAutocomplete(options?: {
16
- parent?: string | Element;
17
- label?: string;
18
- options: any[] | Function;
19
- minChars?: number;
20
- strict?: boolean;
21
- onSelect?: (item: {
22
- value: any;
23
- text: any;
24
- }) => void;
25
- onChange?: (value: any) => void;
26
- }): {
27
- element: HTMLElement;
28
- input: HTMLInputElement;
29
- getValue: Function;
30
- setValue: Function;
31
- };
32
- /**
33
- * Generates a multiple selection with chips. Same options as generateAutocomplete; getValue returns an array.
34
- */
35
- export function generateMultiSelect(options?: {}): any;
36
- /**
37
- * Generates a from / to date picker (the native pickers of the browser). The end date cannot be picked before
38
- * the start date, and validate() reports a reversed range typed by hand.
39
- *
40
- * @param {object} options
41
- * @param {string|Element} [options.parent]
42
- * @param {string} [options.label]
43
- * @param {string} [options.from] initial start, "2026-01-31"
44
- * @param {string} [options.to] initial end
45
- * @param {string} [options.min] earliest date
46
- * @param {string} [options.max] latest date
47
- * @param {(value: {from: string, to: string}) => void} [options.onChange]
48
- * @returns {{element: HTMLElement, getValue: () => {from: string, to: string}, setValue: Function, validate: () => string}}
49
- */
50
- export function generateDateRange(options?: {
51
- parent?: string | Element;
52
- label?: string;
53
- from?: string;
54
- to?: string;
55
- min?: string;
56
- max?: string;
57
- onChange?: (value: {
58
- from: string;
59
- to: string;
60
- }) => void;
61
- }): {
62
- element: HTMLElement;
63
- getValue: () => {
64
- from: string;
65
- to: string;
66
- };
67
- setValue: Function;
68
- validate: () => string;
69
- };
70
- /**
71
- * Generates a from / to range with date AND time (datetime-local inputs), and a list of presets: last 15 minutes, hour,
72
- * 24 hours, 7 days, 30 days, or "Custom". For log filters, charts and reports that need times, not whole days.
73
- * A preset moves with the clock: getRange() measures it from now when it is called.
74
- *
75
- * @param {object} options
76
- * @param {string|Element} [options.parent]
77
- * @param {string} [options.label]
78
- * @param {string} [options.from] initial start, "2026-01-31T08:00"
79
- * @param {string} [options.to] initial end
80
- * @param {string} [options.preset] id of the preset to start with ("15m", "1h", "24h", "7d", "30d")
81
- * @param {{id: string, label?: string, labelKey?: string, minutes: number}[]} [options.presets] your own list
82
- * @param {boolean} [options.seconds=false]
83
- * @param {string} [options.min]
84
- * @param {string} [options.max]
85
- * @param {(value: {from: string, to: string, preset: string}) => void} [options.onChange]
86
- * @returns {{element: HTMLElement, getValue: Function, getRange: () => ({from: Date|null, to: Date|null}), setValue: Function, validate: () => string}}
87
- */
88
- export function generateDateTimeRange(options?: {
89
- parent?: string | Element;
90
- label?: string;
91
- from?: string;
92
- to?: string;
93
- preset?: string;
94
- presets?: {
95
- id: string;
96
- label?: string;
97
- labelKey?: string;
98
- minutes: number;
99
- }[];
100
- seconds?: boolean;
101
- min?: string;
102
- max?: string;
103
- onChange?: (value: {
104
- from: string;
105
- to: string;
106
- preset: string;
107
- }) => void;
108
- }): {
109
- element: HTMLElement;
110
- getValue: Function;
111
- getRange: () => ({
112
- from: Date | null;
113
- to: Date | null;
114
- });
115
- setValue: Function;
116
- validate: () => string;
117
- };
118
- /**
119
- * Generates a drop zone with a file list and upload progress.
120
- *
121
- * @param {object} options
122
- * @param {string|Element} [options.parent]
123
- * @param {string} [options.accept] ".png,image/*"
124
- * @param {boolean} [options.multiple=true]
125
- * @param {number} [options.maxSize] bytes per file
126
- * @param {string} [options.url] upload endpoint (multipart POST). Without it the files are only collected.
127
- * @param {string} [options.fieldName="file"] name of the form field the file is sent as
128
- * @param {Object<string,string>} [options.headers]
129
- * @param {boolean} [options.autoUpload=true] upload as soon as files are added
130
- * @param {(files: File[]) => void} [options.onSelect]
131
- * @param {(file: File, percent: number) => void} [options.onProgress]
132
- * @param {(file: File, response: string) => void} [options.onComplete]
133
- * @param {(file: File, error: Error) => void} [options.onError]
134
- * @returns {{element: HTMLElement, getFiles: () => File[], upload: () => Promise<void>, clear: Function}}
135
- */
136
- export function generateFileUpload(options?: {
137
- parent?: string | Element;
138
- accept?: string;
139
- multiple?: boolean;
140
- maxSize?: number;
141
- url?: string;
142
- fieldName?: string;
143
- headers?: {
144
- [x: string]: string;
145
- };
146
- autoUpload?: boolean;
147
- onSelect?: (files: File[]) => void;
148
- onProgress?: (file: File, percent: number) => void;
149
- onComplete?: (file: File, response: string) => void;
150
- onError?: (file: File, error: Error) => void;
151
- }): {
152
- element: HTMLElement;
153
- getFiles: () => File[];
154
- upload: () => Promise<void>;
155
- clear: Function;
156
- };
157
- /**
158
- * Generates a multi step form (wizard).
159
- *
160
- * @param {object} options
161
- * @param {string|Element} [options.parent]
162
- * @param {{id?: string, title: string, content: *, validate?: () => (boolean|string|Promise<boolean|string>)}[]} options.steps
163
- * content is text, a Node, an array, or a function called once when the step is first shown.
164
- * `validate` runs before leaving the step forwards: false or an error text blocks it.
165
- * @param {() => void} [options.onFinish] called when Finish is pressed on the last step
166
- * @param {(index: number) => void} [options.onChange]
167
- * @returns {{element: HTMLElement, next: Function, back: Function, goTo: Function, getCurrent: Function}}
168
- */
169
- export function generateStepper(options?: {
170
- parent?: string | Element;
171
- steps: {
172
- id?: string;
173
- title: string;
174
- content: any;
175
- validate?: () => (boolean | string | Promise<boolean | string>);
176
- }[];
177
- onFinish?: () => void;
178
- onChange?: (index: number) => void;
179
- }): {
180
- element: HTMLElement;
181
- next: Function;
182
- back: Function;
183
- goTo: Function;
184
- getCurrent: Function;
185
- };
1
+ /**
2
+ * Generates an input with suggestions. `options` is an array of strings / { value, text }, or a function
3
+ * (query) => options | Promise<options> for remote data.
4
+ *
5
+ * @param {object} options
6
+ * @param {string|Element} [options.parent]
7
+ * @param {string} [options.label]
8
+ * @param {Array|Function} options.options
9
+ * @param {number} [options.minChars=1] characters needed before suggestions show
10
+ * @param {boolean} [options.strict=false] only a value chosen from the list is accepted
11
+ * @param {(item: {value, text}) => void} [options.onSelect]
12
+ * @param {(value) => void} [options.onChange]
13
+ * @returns {{element: HTMLElement, input: HTMLInputElement, getValue: Function, setValue: Function}}
14
+ */
15
+ export function generateAutocomplete(options?: {
16
+ parent?: string | Element;
17
+ label?: string;
18
+ options: any[] | Function;
19
+ minChars?: number;
20
+ strict?: boolean;
21
+ onSelect?: (item: {
22
+ value: any;
23
+ text: any;
24
+ }) => void;
25
+ onChange?: (value: any) => void;
26
+ }): {
27
+ element: HTMLElement;
28
+ input: HTMLInputElement;
29
+ getValue: Function;
30
+ setValue: Function;
31
+ };
32
+ /**
33
+ * Generates a multiple selection with chips. Same options as generateAutocomplete; getValue returns an array.
34
+ */
35
+ export function generateMultiSelect(options?: {}): any;
36
+ /**
37
+ * Generates a from / to date picker (the native pickers of the browser). The end date cannot be picked before
38
+ * the start date, and validate() reports a reversed range typed by hand.
39
+ *
40
+ * @param {object} options
41
+ * @param {string|Element} [options.parent]
42
+ * @param {string} [options.label]
43
+ * @param {string} [options.from] initial start, "2026-01-31"
44
+ * @param {string} [options.to] initial end
45
+ * @param {string} [options.min] earliest date
46
+ * @param {string} [options.max] latest date
47
+ * @param {(value: {from: string, to: string}) => void} [options.onChange]
48
+ * @returns {{element: HTMLElement, getValue: () => {from: string, to: string}, setValue: Function, validate: () => string}}
49
+ */
50
+ export function generateDateRange(options?: {
51
+ parent?: string | Element;
52
+ label?: string;
53
+ from?: string;
54
+ to?: string;
55
+ min?: string;
56
+ max?: string;
57
+ onChange?: (value: {
58
+ from: string;
59
+ to: string;
60
+ }) => void;
61
+ }): {
62
+ element: HTMLElement;
63
+ getValue: () => {
64
+ from: string;
65
+ to: string;
66
+ };
67
+ setValue: Function;
68
+ validate: () => string;
69
+ };
70
+ /**
71
+ * Generates a from / to range with date AND time (datetime-local inputs), and a list of presets: last 15 minutes, hour,
72
+ * 24 hours, 7 days, 30 days, or "Custom". For log filters, charts and reports that need times, not whole days.
73
+ * A preset moves with the clock: getRange() measures it from now when it is called.
74
+ *
75
+ * @param {object} options
76
+ * @param {string|Element} [options.parent]
77
+ * @param {string} [options.label]
78
+ * @param {string} [options.from] initial start, "2026-01-31T08:00"
79
+ * @param {string} [options.to] initial end
80
+ * @param {string} [options.preset] id of the preset to start with ("15m", "1h", "24h", "7d", "30d")
81
+ * @param {{id: string, label?: string, labelKey?: string, minutes: number}[]} [options.presets] your own list
82
+ * @param {boolean} [options.seconds=false]
83
+ * @param {string} [options.min]
84
+ * @param {string} [options.max]
85
+ * @param {(value: {from: string, to: string, preset: string}) => void} [options.onChange]
86
+ * @returns {{element: HTMLElement, getValue: Function, getRange: () => ({from: Date|null, to: Date|null}), setValue: Function, validate: () => string}}
87
+ */
88
+ export function generateDateTimeRange(options?: {
89
+ parent?: string | Element;
90
+ label?: string;
91
+ from?: string;
92
+ to?: string;
93
+ preset?: string;
94
+ presets?: {
95
+ id: string;
96
+ label?: string;
97
+ labelKey?: string;
98
+ minutes: number;
99
+ }[];
100
+ seconds?: boolean;
101
+ min?: string;
102
+ max?: string;
103
+ onChange?: (value: {
104
+ from: string;
105
+ to: string;
106
+ preset: string;
107
+ }) => void;
108
+ }): {
109
+ element: HTMLElement;
110
+ getValue: Function;
111
+ getRange: () => ({
112
+ from: Date | null;
113
+ to: Date | null;
114
+ });
115
+ setValue: Function;
116
+ validate: () => string;
117
+ };
118
+ /**
119
+ * Generates a drop zone with a file list and upload progress.
120
+ *
121
+ * @param {object} options
122
+ * @param {string|Element} [options.parent]
123
+ * @param {string} [options.accept] ".png,image/*"
124
+ * @param {boolean} [options.multiple=true]
125
+ * @param {number} [options.maxSize] bytes per file
126
+ * @param {string} [options.url] upload endpoint (multipart POST). Without it the files are only collected.
127
+ * @param {string} [options.fieldName="file"] name of the form field the file is sent as
128
+ * @param {Object<string,string>} [options.headers]
129
+ * @param {boolean} [options.autoUpload=true] upload as soon as files are added
130
+ * @param {(files: File[]) => void} [options.onSelect]
131
+ * @param {(file: File, percent: number) => void} [options.onProgress]
132
+ * @param {(file: File, response: string) => void} [options.onComplete]
133
+ * @param {(file: File, error: Error) => void} [options.onError]
134
+ * @returns {{element: HTMLElement, getFiles: () => File[], upload: () => Promise<void>, clear: Function}}
135
+ */
136
+ export function generateFileUpload(options?: {
137
+ parent?: string | Element;
138
+ accept?: string;
139
+ multiple?: boolean;
140
+ maxSize?: number;
141
+ url?: string;
142
+ fieldName?: string;
143
+ headers?: {
144
+ [x: string]: string;
145
+ };
146
+ autoUpload?: boolean;
147
+ onSelect?: (files: File[]) => void;
148
+ onProgress?: (file: File, percent: number) => void;
149
+ onComplete?: (file: File, response: string) => void;
150
+ onError?: (file: File, error: Error) => void;
151
+ }): {
152
+ element: HTMLElement;
153
+ getFiles: () => File[];
154
+ upload: () => Promise<void>;
155
+ clear: Function;
156
+ };
157
+ /**
158
+ * Generates a multi step form (wizard).
159
+ *
160
+ * @param {object} options
161
+ * @param {string|Element} [options.parent]
162
+ * @param {{id?: string, title: string, content: *, validate?: () => (boolean|string|Promise<boolean|string>)}[]} options.steps
163
+ * content is text, a Node, an array, or a function called once when the step is first shown.
164
+ * `validate` runs before leaving the step forwards: false or an error text blocks it.
165
+ * @param {() => void} [options.onFinish] called when Finish is pressed on the last step
166
+ * @param {(index: number) => void} [options.onChange]
167
+ * @returns {{element: HTMLElement, next: Function, back: Function, goTo: Function, getCurrent: Function}}
168
+ */
169
+ export function generateStepper(options?: {
170
+ parent?: string | Element;
171
+ steps: {
172
+ id?: string;
173
+ title: string;
174
+ content: any;
175
+ validate?: () => (boolean | string | Promise<boolean | string>);
176
+ }[];
177
+ onFinish?: () => void;
178
+ onChange?: (index: number) => void;
179
+ }): {
180
+ element: HTMLElement;
181
+ next: Function;
182
+ back: Function;
183
+ goTo: Function;
184
+ getCurrent: Function;
185
+ };
@@ -1,49 +1,49 @@
1
- /**
2
- * Generates a rich text editor. The content is HTML restricted to a safe set of tags (paragraphs, headings,
3
- * bold / italic / underline / strike, lists, quotes, code, links); everything else, including scripts, styles,
4
- * event attributes and `javascript:` links, is removed when the content is set, pasted and read.
5
- *
6
- * @param {object} options
7
- * @param {string|Element} [options.parent]
8
- * @param {string} [options.id]
9
- * @param {string} [options.label]
10
- * @param {string} [options.value] initial HTML
11
- * @param {string} [options.placeholder]
12
- * @param {string[]} [options.toolbar] button names (bold, italic, underline, strike, h2, h3, quote, ul, ol, link,
13
- * unlink, clear, undo, redo, source) and "|" separators. `source` switches between the visual editor and
14
- * the sanitized HTML source.
15
- * @param {number} [options.minHeight=140] px
16
- * @param {boolean} [options.disabled]
17
- * @param {(html: string) => void} [options.onChange]
18
- * @returns {{element: HTMLElement, editor: HTMLElement, getValue: () => string, setValue: (html: string) => void,
19
- * getText: () => string, focus: Function}}
20
- */
21
- export function createRichText(options?: {
22
- parent?: string | Element;
23
- id?: string;
24
- label?: string;
25
- value?: string;
26
- placeholder?: string;
27
- toolbar?: string[];
28
- minHeight?: number;
29
- disabled?: boolean;
30
- onChange?: (html: string) => void;
31
- }): {
32
- element: HTMLElement;
33
- editor: HTMLElement;
34
- getValue: () => string;
35
- setValue: (html: string) => void;
36
- getText: () => string;
37
- focus: Function;
38
- };
39
- /** Generates a labelled rich text editor, see createRichText. */
40
- export function generateRichText(options?: {}): any;
41
- export function createWysiwyg(options?: {}): {
42
- element: HTMLElement;
43
- editor: HTMLElement;
44
- getValue: () => string;
45
- setValue: (html: string) => void;
46
- getText: () => string;
47
- focus: Function;
48
- };
49
- export function generateWysiwyg(options?: {}): any;
1
+ /**
2
+ * Generates a rich text editor. The content is HTML restricted to a safe set of tags (paragraphs, headings,
3
+ * bold / italic / underline / strike, lists, quotes, code, links); everything else, including scripts, styles,
4
+ * event attributes and `javascript:` links, is removed when the content is set, pasted and read.
5
+ *
6
+ * @param {object} options
7
+ * @param {string|Element} [options.parent]
8
+ * @param {string} [options.id]
9
+ * @param {string} [options.label]
10
+ * @param {string} [options.value] initial HTML
11
+ * @param {string} [options.placeholder]
12
+ * @param {string[]} [options.toolbar] button names (bold, italic, underline, strike, h2, h3, quote, ul, ol, link,
13
+ * unlink, clear, undo, redo, source) and "|" separators. `source` switches between the visual editor and
14
+ * the sanitized HTML source.
15
+ * @param {number} [options.minHeight=140] px
16
+ * @param {boolean} [options.disabled]
17
+ * @param {(html: string) => void} [options.onChange]
18
+ * @returns {{element: HTMLElement, editor: HTMLElement, getValue: () => string, setValue: (html: string) => void,
19
+ * getText: () => string, focus: Function}}
20
+ */
21
+ export function createRichText(options?: {
22
+ parent?: string | Element;
23
+ id?: string;
24
+ label?: string;
25
+ value?: string;
26
+ placeholder?: string;
27
+ toolbar?: string[];
28
+ minHeight?: number;
29
+ disabled?: boolean;
30
+ onChange?: (html: string) => void;
31
+ }): {
32
+ element: HTMLElement;
33
+ editor: HTMLElement;
34
+ getValue: () => string;
35
+ setValue: (html: string) => void;
36
+ getText: () => string;
37
+ focus: Function;
38
+ };
39
+ /** Generates a labelled rich text editor, see createRichText. */
40
+ export function generateRichText(options?: {}): any;
41
+ export function createWysiwyg(options?: {}): {
42
+ element: HTMLElement;
43
+ editor: HTMLElement;
44
+ getValue: () => string;
45
+ setValue: (html: string) => void;
46
+ getText: () => string;
47
+ focus: Function;
48
+ };
49
+ export function generateWysiwyg(options?: {}): any;
@@ -1,2 +1,2 @@
1
- export function openModal(id?: string): void;
2
- export function closeModal(id?: string): void;
1
+ export function openModal(id?: string): void;
2
+ export function closeModal(id?: string): void;