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.
Files changed (76) hide show
  1. package/README.md +28 -4
  2. package/package.json +5 -2
  3. package/src/athena-ui.js +1 -1
  4. package/src/libs/config/config.js +1 -1
  5. package/src/libs/hephaestus/chartGenerator/chartGenerator.js +26 -2
  6. package/types/athena-ui.d.ts +96 -96
  7. package/types/chart.d.ts +1 -1
  8. package/types/classic.d.ts +1 -1
  9. package/types/components.d.ts +1 -1
  10. package/types/controls.d.ts +3 -3
  11. package/types/csv.d.ts +1 -1
  12. package/types/dialog.d.ts +2 -2
  13. package/types/dom.d.ts +1 -1
  14. package/types/feedback.d.ts +1 -1
  15. package/types/format.d.ts +1 -1
  16. package/types/forms.d.ts +2 -2
  17. package/types/i18n.d.ts +1 -1
  18. package/types/inputs.d.ts +4 -4
  19. package/types/libs/config/config.d.ts +3 -3
  20. package/types/libs/config/hooks.d.ts +8 -8
  21. package/types/libs/core/combobox.d.ts +10 -10
  22. package/types/libs/core/controls.d.ts +28 -28
  23. package/types/libs/core/cookies.d.ts +27 -27
  24. package/types/libs/core/csv.d.ts +12 -12
  25. package/types/libs/core/dateRange.d.ts +72 -72
  26. package/types/libs/core/dom.d.ts +65 -65
  27. package/types/libs/core/elementGenerator.d.ts +30 -30
  28. package/types/libs/core/errors.d.ts +29 -29
  29. package/types/libs/core/focus.d.ts +6 -6
  30. package/types/libs/core/format.d.ts +21 -21
  31. package/types/libs/core/hungarianControls.d.ts +2 -2
  32. package/types/libs/core/i18n.d.ts +17 -17
  33. package/types/libs/core/pagination.d.ts +5 -5
  34. package/types/libs/core/sanitize.d.ts +6 -6
  35. package/types/libs/core/tableMath.d.ts +26 -26
  36. package/types/libs/core/theme.d.ts +39 -39
  37. package/types/libs/core/validation.d.ts +56 -56
  38. package/types/libs/hephaestus/LayoutGenerator/basicLayoutGenerator.d.ts +10 -10
  39. package/types/libs/hephaestus/LayoutGenerator/footerContentGenerator.d.ts +4 -4
  40. package/types/libs/hephaestus/LayoutGenerator/headerContentGenerator.d.ts +20 -20
  41. package/types/libs/hephaestus/LayoutGenerator/wrapperContentGenerator.d.ts +1 -1
  42. package/types/libs/hephaestus/MenuGenerator/basicMenuGenerator.d.ts +14 -14
  43. package/types/libs/hephaestus/MenuGenerator/menuGenerator.d.ts +65 -65
  44. package/types/libs/hephaestus/auth/authState.d.ts +26 -26
  45. package/types/libs/hephaestus/auth/session.d.ts +26 -26
  46. package/types/libs/hephaestus/chartGenerator/chartGenerator.d.ts +2 -0
  47. package/types/libs/hephaestus/componentGenerator/componentGenerator.d.ts +222 -222
  48. package/types/libs/hephaestus/componentGenerator/themePicker.d.ts +24 -24
  49. package/types/libs/hephaestus/dialogGenerator/dialogGenerator.d.ts +120 -120
  50. package/types/libs/hephaestus/feedbackGenerator/feedbackGenerator.d.ts +86 -86
  51. package/types/libs/hephaestus/formGenerator/authForms.d.ts +122 -122
  52. package/types/libs/hephaestus/formGenerator/changePasswordFormGenerator.d.ts +6 -6
  53. package/types/libs/hephaestus/formGenerator/formBuilder.d.ts +113 -113
  54. package/types/libs/hephaestus/formGenerator/formUtils.d.ts +8 -8
  55. package/types/libs/hephaestus/formGenerator/loginFormGenerator.d.ts +11 -11
  56. package/types/libs/hephaestus/formGenerator/lostPasswordFormGenerator.d.ts +4 -4
  57. package/types/libs/hephaestus/formGenerator/registrationFormGenerator.d.ts +7 -7
  58. package/types/libs/hephaestus/hephaestus.d.ts +3 -3
  59. package/types/libs/hephaestus/inputGenerator/dropZoneGenerator.d.ts +48 -48
  60. package/types/libs/hephaestus/inputGenerator/inputGenerator.d.ts +185 -185
  61. package/types/libs/hephaestus/inputGenerator/richTextGenerator.d.ts +49 -49
  62. package/types/libs/hephaestus/modalGenerator/modalGenerator.d.ts +2 -2
  63. package/types/libs/hephaestus/navigationGenerator/navigationGenerator.d.ts +150 -150
  64. package/types/libs/hephaestus/router/matchRoute.d.ts +12 -12
  65. package/types/libs/hephaestus/router/router.d.ts +67 -67
  66. package/types/libs/hephaestus/tableGenerator/tableGenerator.d.ts +120 -120
  67. package/types/menu.d.ts +1 -1
  68. package/types/navigation.d.ts +1 -1
  69. package/types/res/themes/themes.d.ts +7 -7
  70. package/types/router.d.ts +1 -1
  71. package/types/sanitize.d.ts +1 -1
  72. package/types/session.d.ts +3 -3
  73. package/types/table.d.ts +1 -1
  74. package/types/testing.d.ts +27 -27
  75. package/types/theme.d.ts +2 -2
  76. package/types/validation.d.ts +1 -1
@@ -1,120 +1,120 @@
1
- /**
2
- * Generates a table (optional filter box, sortable headers, pagination, row selection, inline
3
- * editing, resizable columns, virtual scrolling, CSV export) and appends it to its parent.
4
- *
5
- * @param {object} options
6
- * @param {string|Element} [options.parent] id or element, defaults to "wrapper"
7
- * @param {string} [options.id] id of the table wrapper (default: "table")
8
- * @param {string} [options.class] extra CSS class of the table
9
- * @param {string} [options.caption]
10
- * @param {{key: string, label?: string, width?: number, sortable?: boolean, editable?: boolean, format?: (value, row) => string}[]} options.columns
11
- * @param {object[]} [options.rows] row objects, read by column key
12
- * @param {boolean} [options.sortable=true] click on a header sorts by it
13
- * @param {boolean} [options.filter=false] show a text filter above the table
14
- * @param {number} [options.pageSize=0] rows per page, 0 disables pagination
15
- * @param {boolean} [options.selectable=false] checkbox column; the header checkbox selects every filtered row
16
- * @param {boolean} [options.resizableColumns=false] drag the edge of a header (or use the arrow keys on it) to resize;
17
- * double click resets the width
18
- * @param {{height?: number, rowHeight?: number, overscan?: number}|boolean} [options.virtual] render only the rows
19
- * in view, for lists of thousands of rows. Rows have a fixed height (default 36 px) and the table scrolls
20
- * inside `height` (default 400 px). Replaces pagination.
21
- * @param {(key: string, width: number) => void} [options.onColumnResize]
22
- * @param {(rows: object[]) => void} [options.onSelectionChange]
23
- * @param {(row: object, key: string, value, oldValue) => (boolean|void)} [options.onEdit] called after an edit
24
- * of an `editable` column (double click, or Enter / F2 on the focused cell). Return false to reject it.
25
- * @param {(row: object) => void} [options.onRowClick]
26
- * @param {string} [options.emptyText]
27
- * @param {(row: object, column: object) => (string|string[]|null|undefined)} [options.cellClass] CSS class(es) for a cell
28
- * @param {(row: object) => (string|string[]|null|undefined)} [options.rowClass] CSS class(es) for a row
29
- * @param {boolean} [options.focusableRows=false] rows are reachable with Tab and, with `onRowClick`, opened with Enter and Space
30
- * @param {(row: object) => string} [options.rowLabel] aria-label of a focusable row
31
- * @param {"normal"|"compact"} [options.density="normal"]
32
- * @param {boolean} [options.wrap] true lets long text wrap, false keeps one line with an ellipsis (default: wrap, except in virtual tables)
33
- * @param {(query: {page: number, pageSize: number, cursor: *, sort: ({key: string, descending: boolean}|null), filter: string}) =>
34
- * Promise<{rows: object[], total?: number, nextCursor?: *}>} [options.dataSource] load the rows from a server instead of
35
- * keeping them all in the browser. Sorting, the filter box and the pager call it again. Answer with `total` for numbered pages
36
- * (`page` is 0-based), or with `nextCursor` for a "Load more" button (`cursor` is what the last answer gave, undefined for the
37
- * first request; the rows are appended). A failed request shows the error with a Retry button.
38
- * Together with `virtual` the list scrolls like one of `total` rows (every answer must carry `total`): the rows in view are asked for
39
- * in chunks of `chunkSize` (`page` is the chunk number), rows that have not arrived yet show a placeholder, and sorting or the filter
40
- * start again from the top.
41
- * @param {number} [options.chunkSize=50] rows per request of a data source with `virtual`
42
- * @param {number} [options.filterDelay=300] ms to wait after typing before the data source is asked
43
- * @param {{label: string, onclick: (row: object) => void, danger?: boolean, hidden?: (row: object) => boolean, ariaLabel?: (row: object) => string}[]} [options.rowActions]
44
- * a column of buttons at the end of every row
45
- * Column extras: `render(row, value)` returns text or a Node (built by the caller, so safe by construction), `align`
46
- * ("left" | "center" | "right"), `title` (false switches the tooltip with the full text off).
47
- * @returns {{element: HTMLElement, update: Function, destroy: Function, setRows: Function, getSelected: () => object[], clearSelection: Function,
48
- * getColumnWidths: () => Object<string, number>, toCsv: () => string, exportCsv: (filename?: string) => void}}
49
- */
50
- export function generateTable(options?: {
51
- parent?: string | Element;
52
- id?: string;
53
- class?: string;
54
- caption?: string;
55
- columns: {
56
- key: string;
57
- label?: string;
58
- width?: number;
59
- sortable?: boolean;
60
- editable?: boolean;
61
- format?: (value: any, row: any) => string;
62
- }[];
63
- rows?: object[];
64
- sortable?: boolean;
65
- filter?: boolean;
66
- pageSize?: number;
67
- selectable?: boolean;
68
- resizableColumns?: boolean;
69
- virtual?: {
70
- height?: number;
71
- rowHeight?: number;
72
- overscan?: number;
73
- } | boolean;
74
- onColumnResize?: (key: string, width: number) => void;
75
- onSelectionChange?: (rows: object[]) => void;
76
- onEdit?: (row: object, key: string, value: any, oldValue: any) => (boolean | void);
77
- onRowClick?: (row: object) => void;
78
- emptyText?: string;
79
- cellClass?: (row: object, column: object) => (string | string[] | null | undefined);
80
- rowClass?: (row: object) => (string | string[] | null | undefined);
81
- focusableRows?: boolean;
82
- rowLabel?: (row: object) => string;
83
- density?: "normal" | "compact";
84
- wrap?: boolean;
85
- dataSource?: (query: {
86
- page: number;
87
- pageSize: number;
88
- cursor: any;
89
- sort: ({
90
- key: string;
91
- descending: boolean;
92
- } | null);
93
- filter: string;
94
- }) => Promise<{
95
- rows: object[];
96
- total?: number;
97
- nextCursor?: any;
98
- }>;
99
- chunkSize?: number;
100
- filterDelay?: number;
101
- rowActions?: {
102
- label: string;
103
- onclick: (row: object) => void;
104
- danger?: boolean;
105
- hidden?: (row: object) => boolean;
106
- ariaLabel?: (row: object) => string;
107
- }[];
108
- }): {
109
- element: HTMLElement;
110
- update: Function;
111
- destroy: Function;
112
- setRows: Function;
113
- getSelected: () => object[];
114
- clearSelection: Function;
115
- getColumnWidths: () => {
116
- [x: string]: number;
117
- };
118
- toCsv: () => string;
119
- exportCsv: (filename?: string) => void;
120
- };
1
+ /**
2
+ * Generates a table (optional filter box, sortable headers, pagination, row selection, inline
3
+ * editing, resizable columns, virtual scrolling, CSV export) and appends it to its parent.
4
+ *
5
+ * @param {object} options
6
+ * @param {string|Element} [options.parent] id or element, defaults to "wrapper"
7
+ * @param {string} [options.id] id of the table wrapper (default: "table")
8
+ * @param {string} [options.class] extra CSS class of the table
9
+ * @param {string} [options.caption]
10
+ * @param {{key: string, label?: string, width?: number, sortable?: boolean, editable?: boolean, format?: (value, row) => string}[]} options.columns
11
+ * @param {object[]} [options.rows] row objects, read by column key
12
+ * @param {boolean} [options.sortable=true] click on a header sorts by it
13
+ * @param {boolean} [options.filter=false] show a text filter above the table
14
+ * @param {number} [options.pageSize=0] rows per page, 0 disables pagination
15
+ * @param {boolean} [options.selectable=false] checkbox column; the header checkbox selects every filtered row
16
+ * @param {boolean} [options.resizableColumns=false] drag the edge of a header (or use the arrow keys on it) to resize;
17
+ * double click resets the width
18
+ * @param {{height?: number, rowHeight?: number, overscan?: number}|boolean} [options.virtual] render only the rows
19
+ * in view, for lists of thousands of rows. Rows have a fixed height (default 36 px) and the table scrolls
20
+ * inside `height` (default 400 px). Replaces pagination.
21
+ * @param {(key: string, width: number) => void} [options.onColumnResize]
22
+ * @param {(rows: object[]) => void} [options.onSelectionChange]
23
+ * @param {(row: object, key: string, value, oldValue) => (boolean|void)} [options.onEdit] called after an edit
24
+ * of an `editable` column (double click, or Enter / F2 on the focused cell). Return false to reject it.
25
+ * @param {(row: object) => void} [options.onRowClick]
26
+ * @param {string} [options.emptyText]
27
+ * @param {(row: object, column: object) => (string|string[]|null|undefined)} [options.cellClass] CSS class(es) for a cell
28
+ * @param {(row: object) => (string|string[]|null|undefined)} [options.rowClass] CSS class(es) for a row
29
+ * @param {boolean} [options.focusableRows=false] rows are reachable with Tab and, with `onRowClick`, opened with Enter and Space
30
+ * @param {(row: object) => string} [options.rowLabel] aria-label of a focusable row
31
+ * @param {"normal"|"compact"} [options.density="normal"]
32
+ * @param {boolean} [options.wrap] true lets long text wrap, false keeps one line with an ellipsis (default: wrap, except in virtual tables)
33
+ * @param {(query: {page: number, pageSize: number, cursor: *, sort: ({key: string, descending: boolean}|null), filter: string}) =>
34
+ * Promise<{rows: object[], total?: number, nextCursor?: *}>} [options.dataSource] load the rows from a server instead of
35
+ * keeping them all in the browser. Sorting, the filter box and the pager call it again. Answer with `total` for numbered pages
36
+ * (`page` is 0-based), or with `nextCursor` for a "Load more" button (`cursor` is what the last answer gave, undefined for the
37
+ * first request; the rows are appended). A failed request shows the error with a Retry button.
38
+ * Together with `virtual` the list scrolls like one of `total` rows (every answer must carry `total`): the rows in view are asked for
39
+ * in chunks of `chunkSize` (`page` is the chunk number), rows that have not arrived yet show a placeholder, and sorting or the filter
40
+ * start again from the top.
41
+ * @param {number} [options.chunkSize=50] rows per request of a data source with `virtual`
42
+ * @param {number} [options.filterDelay=300] ms to wait after typing before the data source is asked
43
+ * @param {{label: string, onclick: (row: object) => void, danger?: boolean, hidden?: (row: object) => boolean, ariaLabel?: (row: object) => string}[]} [options.rowActions]
44
+ * a column of buttons at the end of every row
45
+ * Column extras: `render(row, value)` returns text or a Node (built by the caller, so safe by construction), `align`
46
+ * ("left" | "center" | "right"), `title` (false switches the tooltip with the full text off).
47
+ * @returns {{element: HTMLElement, update: Function, destroy: Function, setRows: Function, getSelected: () => object[], clearSelection: Function,
48
+ * getColumnWidths: () => Object<string, number>, toCsv: () => string, exportCsv: (filename?: string) => void}}
49
+ */
50
+ export function generateTable(options?: {
51
+ parent?: string | Element;
52
+ id?: string;
53
+ class?: string;
54
+ caption?: string;
55
+ columns: {
56
+ key: string;
57
+ label?: string;
58
+ width?: number;
59
+ sortable?: boolean;
60
+ editable?: boolean;
61
+ format?: (value: any, row: any) => string;
62
+ }[];
63
+ rows?: object[];
64
+ sortable?: boolean;
65
+ filter?: boolean;
66
+ pageSize?: number;
67
+ selectable?: boolean;
68
+ resizableColumns?: boolean;
69
+ virtual?: {
70
+ height?: number;
71
+ rowHeight?: number;
72
+ overscan?: number;
73
+ } | boolean;
74
+ onColumnResize?: (key: string, width: number) => void;
75
+ onSelectionChange?: (rows: object[]) => void;
76
+ onEdit?: (row: object, key: string, value: any, oldValue: any) => (boolean | void);
77
+ onRowClick?: (row: object) => void;
78
+ emptyText?: string;
79
+ cellClass?: (row: object, column: object) => (string | string[] | null | undefined);
80
+ rowClass?: (row: object) => (string | string[] | null | undefined);
81
+ focusableRows?: boolean;
82
+ rowLabel?: (row: object) => string;
83
+ density?: "normal" | "compact";
84
+ wrap?: boolean;
85
+ dataSource?: (query: {
86
+ page: number;
87
+ pageSize: number;
88
+ cursor: any;
89
+ sort: ({
90
+ key: string;
91
+ descending: boolean;
92
+ } | null);
93
+ filter: string;
94
+ }) => Promise<{
95
+ rows: object[];
96
+ total?: number;
97
+ nextCursor?: any;
98
+ }>;
99
+ chunkSize?: number;
100
+ filterDelay?: number;
101
+ rowActions?: {
102
+ label: string;
103
+ onclick: (row: object) => void;
104
+ danger?: boolean;
105
+ hidden?: (row: object) => boolean;
106
+ ariaLabel?: (row: object) => string;
107
+ }[];
108
+ }): {
109
+ element: HTMLElement;
110
+ update: Function;
111
+ destroy: Function;
112
+ setRows: Function;
113
+ getSelected: () => object[];
114
+ clearSelection: Function;
115
+ getColumnWidths: () => {
116
+ [x: string]: number;
117
+ };
118
+ toCsv: () => string;
119
+ exportCsv: (filename?: string) => void;
120
+ };
package/types/menu.d.ts CHANGED
@@ -1 +1 @@
1
- export * from "./libs/hephaestus/MenuGenerator/menuGenerator.js";
1
+ export * from "./libs/hephaestus/MenuGenerator/menuGenerator.js";
@@ -1 +1 @@
1
- export * from "./libs/hephaestus/navigationGenerator/navigationGenerator.js";
1
+ export * from "./libs/hephaestus/navigationGenerator/navigationGenerator.js";
@@ -1,7 +1,7 @@
1
- declare const _default: {
2
- id: number;
3
- name: string;
4
- href: string;
5
- description: string;
6
- }[];
7
- export default _default;
1
+ declare const _default: {
2
+ id: number;
3
+ name: string;
4
+ href: string;
5
+ description: string;
6
+ }[];
7
+ export default _default;
package/types/router.d.ts CHANGED
@@ -1 +1 @@
1
- export * from "./libs/hephaestus/router/router.js";
1
+ export * from "./libs/hephaestus/router/router.js";
@@ -1 +1 @@
1
- export * from "./libs/core/sanitize.js";
1
+ export * from "./libs/core/sanitize.js";
@@ -1,3 +1,3 @@
1
- export * from "./libs/hephaestus/auth/session.js";
2
- export * from "./libs/hephaestus/auth/authState.js";
3
- export * from "./libs/core/cookies.js";
1
+ export * from "./libs/hephaestus/auth/session.js";
2
+ export * from "./libs/hephaestus/auth/authState.js";
3
+ export * from "./libs/core/cookies.js";
package/types/table.d.ts CHANGED
@@ -1 +1 @@
1
- export * from "./libs/hephaestus/tableGenerator/tableGenerator.js";
1
+ export * from "./libs/hephaestus/tableGenerator/tableGenerator.js";
@@ -1,27 +1,27 @@
1
- /**
2
- * Makes a jsdom window the global one, so Athena components can run in Node.
3
- * The components create their events from the element's own window, so no global Event is needed for them,
4
- * but code written without that care (and tests) can still use `new Event(...)`.
5
- *
6
- * @param {new (html?: string, options?: object) => {window: object}} JSDOM the JSDOM class of jsdom
7
- * @param {string} [html] page to start with
8
- * @param {object} [options] passed to JSDOM (default: url "http://localhost/", pretendToBeVisual so animation frames work)
9
- * @returns {{window: object, document: Document, uninstall: () => void}}
10
- */
11
- export function installDom(JSDOM: new (html?: string, options?: object) => {
12
- window: object;
13
- }, html?: string, options?: object): {
14
- window: object;
15
- document: Document;
16
- uninstall: () => void;
17
- };
18
- /**
19
- * Waits until `condition()` returns something truthy, and returns that value.
20
- * Throws after `timeout` ms, naming `message`, so a test fails with a reason instead of hanging.
21
- */
22
- export function until(condition: any, { timeout, interval, message }?: {
23
- timeout?: number;
24
- interval?: number;
25
- message?: string;
26
- }): Promise<any>;
27
- export function tick(ms?: number): Promise<any>;
1
+ /**
2
+ * Makes a jsdom window the global one, so Athena components can run in Node.
3
+ * The components create their events from the element's own window, so no global Event is needed for them,
4
+ * but code written without that care (and tests) can still use `new Event(...)`.
5
+ *
6
+ * @param {new (html?: string, options?: object) => {window: object}} JSDOM the JSDOM class of jsdom
7
+ * @param {string} [html] page to start with
8
+ * @param {object} [options] passed to JSDOM (default: url "http://localhost/", pretendToBeVisual so animation frames work)
9
+ * @returns {{window: object, document: Document, uninstall: () => void}}
10
+ */
11
+ export function installDom(JSDOM: new (html?: string, options?: object) => {
12
+ window: object;
13
+ }, html?: string, options?: object): {
14
+ window: object;
15
+ document: Document;
16
+ uninstall: () => void;
17
+ };
18
+ /**
19
+ * Waits until `condition()` returns something truthy, and returns that value.
20
+ * Throws after `timeout` ms, naming `message`, so a test fails with a reason instead of hanging.
21
+ */
22
+ export function until(condition: any, { timeout, interval, message }?: {
23
+ timeout?: number;
24
+ interval?: number;
25
+ message?: string;
26
+ }): Promise<any>;
27
+ export function tick(ms?: number): Promise<any>;
package/types/theme.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export * from "./libs/core/theme.js";
2
- export * from "./libs/hephaestus/componentGenerator/themePicker.js";
1
+ export * from "./libs/core/theme.js";
2
+ export * from "./libs/hephaestus/componentGenerator/themePicker.js";
@@ -1 +1 @@
1
- export * from "./libs/core/validation.js";
1
+ export * from "./libs/core/validation.js";