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.
- package/README.md +47 -5
- package/docs/migration-2.0.md +1 -1
- package/docs/styling.md +3 -1
- package/package.json +5 -2
- package/src/athena-ui.js +1 -1
- package/src/libs/config/config.js +1 -1
- package/src/libs/core/popover.js +96 -0
- package/src/libs/hephaestus/chartGenerator/chartGenerator.js +26 -2
- package/src/libs/hephaestus/componentGenerator/componentGenerator.js +26 -2
- package/src/libs/hephaestus/navigationGenerator/navigationGenerator.js +45 -9
- package/src/res/themes/default/style.css +32 -0
- 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/popover.d.ts +36 -0
- 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 +93 -91
- package/types/libs/hephaestus/componentGenerator/componentGenerator.d.ts +3 -1
- 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 +4 -1
- 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
|
@@ -89,7 +89,10 @@ export function generateAccordion(options?: {
|
|
|
89
89
|
toggle: (index: number, open?: boolean) => void;
|
|
90
90
|
};
|
|
91
91
|
/**
|
|
92
|
-
* Generates a button that opens a menu. Arrow keys move through the items, Esc closes it.
|
|
92
|
+
* Generates a button that opens a menu. Arrow keys move through the items, Esc closes it, and so does a click outside.
|
|
93
|
+
* The menu is a native popover (the `popover` attribute): it is drawn above everything, so no parent can cut it off, and the browser takes care of the
|
|
94
|
+
* light dismiss and of the focus. It is placed next to the button, below it, or above it when there is no room below. Browsers without the popover API
|
|
95
|
+
* get a plain menu that is shown and hidden with `hidden`.
|
|
93
96
|
*
|
|
94
97
|
* @param {object} options
|
|
95
98
|
* @param {string|Element} [options.parent]
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export function normalizePath(path: any): string;
|
|
2
|
-
export function parseQuery(search: any): {
|
|
3
|
-
[k: string]: string;
|
|
4
|
-
};
|
|
5
|
-
/**
|
|
6
|
-
* Matches a path against a pattern. `:name` segments capture a value, a trailing `*` matches the rest.
|
|
7
|
-
*
|
|
8
|
-
* @returns {Object<string, string>|null} the captured params, or null when the path does not match
|
|
9
|
-
*/
|
|
10
|
-
export function matchRoute(pattern: any, path: any): {
|
|
11
|
-
[x: string]: string;
|
|
12
|
-
} | null;
|
|
1
|
+
export function normalizePath(path: any): string;
|
|
2
|
+
export function parseQuery(search: any): {
|
|
3
|
+
[k: string]: string;
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* Matches a path against a pattern. `:name` segments capture a value, a trailing `*` matches the rest.
|
|
7
|
+
*
|
|
8
|
+
* @returns {Object<string, string>|null} the captured params, or null when the path does not match
|
|
9
|
+
*/
|
|
10
|
+
export function matchRoute(pattern: any, path: any): {
|
|
11
|
+
[x: string]: string;
|
|
12
|
+
} | null;
|
|
@@ -1,67 +1,67 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Creates a router that renders a page function into an outlet element.
|
|
3
|
-
*
|
|
4
|
-
* @param {object} options
|
|
5
|
-
* @param {Object<string, Function|{handler: Function, title?: string}>} options.routes path pattern -> page
|
|
6
|
-
* function. Patterns support `:param` segments and a trailing `*`. A page function is called with
|
|
7
|
-
* `{ path, params, query }` after the outlet was emptied, and may return a promise.
|
|
8
|
-
* @param {string} [options.outlet="wrapper"] id of the element the pages are rendered into
|
|
9
|
-
* @param {"hash"|"history"} [options.mode="hash"] "history" needs the server to answer every path with the page
|
|
10
|
-
* @param {(context) => void} [options.notFound] called when no route matches
|
|
11
|
-
* @param {(context) => (boolean|string|void|Promise)} [options.beforeEach] guard: return false to cancel,
|
|
12
|
-
* or a path to redirect to (login redirect)
|
|
13
|
-
* @param {(context) => void} [options.afterEach] same as onShown
|
|
14
|
-
* @param {(context, route) => void} [options.onRender] called after the outlet was emptied, before the page function runs
|
|
15
|
-
* @param {(context, route) => void} [options.onShown] called after the page function finished (and it was not replaced by a newer
|
|
16
|
-
* navigation): the place to set the title, move the focus to the content, scroll to the top
|
|
17
|
-
* @param {boolean} [options.focusContent=false] after a page is shown the outlet gets the focus (it is made focusable for that), so a
|
|
18
|
-
* screen reader starts reading the new page and the keyboard continues there
|
|
19
|
-
* @param {boolean} [options.scrollTop=false] scroll to the top after a page is shown
|
|
20
|
-
* @param {object} [options.auth] sign-in rules for routes, see the route options below
|
|
21
|
-
* @param {() => boolean} [options.auth.isSignedIn]
|
|
22
|
-
* @param {(role: string) => boolean} [options.auth.hasRole]
|
|
23
|
-
* @param {string} [options.auth.loginPath="/login"] where `auth: true` routes send a visitor who is not signed in (with `?next=<path>`)
|
|
24
|
-
* @param {string} [options.auth.homePath="/"] where `guestOnly` routes send a signed-in person
|
|
25
|
-
* @param {string} [options.auth.forbiddenPath] where a person without the role goes (default: homePath)
|
|
26
|
-
* @param {string} [options.titlePrefix] document title is `${titlePrefix}${route.title}`
|
|
27
|
-
*
|
|
28
|
-
* A route is a page function, or an object: `{ handler, title, auth: true, guestOnly: true, roles: ["admin"], guard(context) }`.
|
|
29
|
-
* `auth`, `guestOnly` and `roles` are checked with options.auth; `guard` is a function that gets the same context and returns
|
|
30
|
-
* false (stay where you are), a path (redirect) or anything else (go on); it runs after the rules.
|
|
31
|
-
* @returns {{start: Function, stop: Function, navigate: Function, current: Function, href: Function,
|
|
32
|
-
* onChange: (listener: (context) => void) => Function}}
|
|
33
|
-
* `onChange(listener)` is called with the context after every page that is shown (menus and breadcrumbs follow the router
|
|
34
|
-
* with it) and returns a function that stops it.
|
|
35
|
-
*/
|
|
36
|
-
export function createRouter(options?: {
|
|
37
|
-
routes: {
|
|
38
|
-
[x: string]: Function | {
|
|
39
|
-
handler: Function;
|
|
40
|
-
title?: string;
|
|
41
|
-
};
|
|
42
|
-
};
|
|
43
|
-
outlet?: string;
|
|
44
|
-
mode?: "hash" | "history";
|
|
45
|
-
notFound?: (context: any) => void;
|
|
46
|
-
beforeEach?: (context: any) => (boolean | string | void | Promise<any>);
|
|
47
|
-
afterEach?: (context: any) => void;
|
|
48
|
-
onRender?: (context: any, route: any) => void;
|
|
49
|
-
onShown?: (context: any, route: any) => void;
|
|
50
|
-
focusContent?: boolean;
|
|
51
|
-
scrollTop?: boolean;
|
|
52
|
-
auth?: {
|
|
53
|
-
isSignedIn?: () => boolean;
|
|
54
|
-
hasRole?: (role: string) => boolean;
|
|
55
|
-
loginPath?: string;
|
|
56
|
-
homePath?: string;
|
|
57
|
-
forbiddenPath?: string;
|
|
58
|
-
};
|
|
59
|
-
titlePrefix?: string;
|
|
60
|
-
}): {
|
|
61
|
-
start: Function;
|
|
62
|
-
stop: Function;
|
|
63
|
-
navigate: Function;
|
|
64
|
-
current: Function;
|
|
65
|
-
href: Function;
|
|
66
|
-
onChange: (listener: (context: any) => void) => Function;
|
|
67
|
-
};
|
|
1
|
+
/**
|
|
2
|
+
* Creates a router that renders a page function into an outlet element.
|
|
3
|
+
*
|
|
4
|
+
* @param {object} options
|
|
5
|
+
* @param {Object<string, Function|{handler: Function, title?: string}>} options.routes path pattern -> page
|
|
6
|
+
* function. Patterns support `:param` segments and a trailing `*`. A page function is called with
|
|
7
|
+
* `{ path, params, query }` after the outlet was emptied, and may return a promise.
|
|
8
|
+
* @param {string} [options.outlet="wrapper"] id of the element the pages are rendered into
|
|
9
|
+
* @param {"hash"|"history"} [options.mode="hash"] "history" needs the server to answer every path with the page
|
|
10
|
+
* @param {(context) => void} [options.notFound] called when no route matches
|
|
11
|
+
* @param {(context) => (boolean|string|void|Promise)} [options.beforeEach] guard: return false to cancel,
|
|
12
|
+
* or a path to redirect to (login redirect)
|
|
13
|
+
* @param {(context) => void} [options.afterEach] same as onShown
|
|
14
|
+
* @param {(context, route) => void} [options.onRender] called after the outlet was emptied, before the page function runs
|
|
15
|
+
* @param {(context, route) => void} [options.onShown] called after the page function finished (and it was not replaced by a newer
|
|
16
|
+
* navigation): the place to set the title, move the focus to the content, scroll to the top
|
|
17
|
+
* @param {boolean} [options.focusContent=false] after a page is shown the outlet gets the focus (it is made focusable for that), so a
|
|
18
|
+
* screen reader starts reading the new page and the keyboard continues there
|
|
19
|
+
* @param {boolean} [options.scrollTop=false] scroll to the top after a page is shown
|
|
20
|
+
* @param {object} [options.auth] sign-in rules for routes, see the route options below
|
|
21
|
+
* @param {() => boolean} [options.auth.isSignedIn]
|
|
22
|
+
* @param {(role: string) => boolean} [options.auth.hasRole]
|
|
23
|
+
* @param {string} [options.auth.loginPath="/login"] where `auth: true` routes send a visitor who is not signed in (with `?next=<path>`)
|
|
24
|
+
* @param {string} [options.auth.homePath="/"] where `guestOnly` routes send a signed-in person
|
|
25
|
+
* @param {string} [options.auth.forbiddenPath] where a person without the role goes (default: homePath)
|
|
26
|
+
* @param {string} [options.titlePrefix] document title is `${titlePrefix}${route.title}`
|
|
27
|
+
*
|
|
28
|
+
* A route is a page function, or an object: `{ handler, title, auth: true, guestOnly: true, roles: ["admin"], guard(context) }`.
|
|
29
|
+
* `auth`, `guestOnly` and `roles` are checked with options.auth; `guard` is a function that gets the same context and returns
|
|
30
|
+
* false (stay where you are), a path (redirect) or anything else (go on); it runs after the rules.
|
|
31
|
+
* @returns {{start: Function, stop: Function, navigate: Function, current: Function, href: Function,
|
|
32
|
+
* onChange: (listener: (context) => void) => Function}}
|
|
33
|
+
* `onChange(listener)` is called with the context after every page that is shown (menus and breadcrumbs follow the router
|
|
34
|
+
* with it) and returns a function that stops it.
|
|
35
|
+
*/
|
|
36
|
+
export function createRouter(options?: {
|
|
37
|
+
routes: {
|
|
38
|
+
[x: string]: Function | {
|
|
39
|
+
handler: Function;
|
|
40
|
+
title?: string;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
outlet?: string;
|
|
44
|
+
mode?: "hash" | "history";
|
|
45
|
+
notFound?: (context: any) => void;
|
|
46
|
+
beforeEach?: (context: any) => (boolean | string | void | Promise<any>);
|
|
47
|
+
afterEach?: (context: any) => void;
|
|
48
|
+
onRender?: (context: any, route: any) => void;
|
|
49
|
+
onShown?: (context: any, route: any) => void;
|
|
50
|
+
focusContent?: boolean;
|
|
51
|
+
scrollTop?: boolean;
|
|
52
|
+
auth?: {
|
|
53
|
+
isSignedIn?: () => boolean;
|
|
54
|
+
hasRole?: (role: string) => boolean;
|
|
55
|
+
loginPath?: string;
|
|
56
|
+
homePath?: string;
|
|
57
|
+
forbiddenPath?: string;
|
|
58
|
+
};
|
|
59
|
+
titlePrefix?: string;
|
|
60
|
+
}): {
|
|
61
|
+
start: Function;
|
|
62
|
+
stop: Function;
|
|
63
|
+
navigate: Function;
|
|
64
|
+
current: Function;
|
|
65
|
+
href: Function;
|
|
66
|
+
onChange: (listener: (context: any) => void) => Function;
|
|
67
|
+
};
|
|
@@ -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";
|
package/types/navigation.d.ts
CHANGED
|
@@ -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";
|
package/types/sanitize.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "./libs/core/sanitize.js";
|
|
1
|
+
export * from "./libs/core/sanitize.js";
|
package/types/session.d.ts
CHANGED
|
@@ -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";
|
package/types/testing.d.ts
CHANGED
|
@@ -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";
|
package/types/validation.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "./libs/core/validation.js";
|
|
1
|
+
export * from "./libs/core/validation.js";
|