athena-ui-js 2.6.0 → 2.7.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 +25 -1
- package/docs/migration-2.0.md +17 -0
- package/docs/styling.md +1 -1
- package/package.json +1 -1
- package/src/athena-ui.js +1 -1
- package/src/libs/config/config.js +1 -1
- package/src/libs/hephaestus/chartGenerator/chartGenerator.js +4 -1
- package/src/libs/hephaestus/componentGenerator/themePicker.js +78 -73
- package/src/libs/hephaestus/formGenerator/formBuilder.js +8 -3
- package/src/libs/hephaestus/widgetGrid/widgetGrid.js +943 -870
- package/src/res/themes/default/style.css +13 -0
- package/types/libs/config/config.d.ts +3 -3
- package/types/libs/hephaestus/chartGenerator/chartGenerator.d.ts +1 -1
- package/types/libs/hephaestus/componentGenerator/themePicker.d.ts +2 -0
- package/types/libs/hephaestus/formGenerator/formBuilder.d.ts +2 -0
- package/types/libs/hephaestus/widgetGrid/widgetGrid.d.ts +15 -2
|
@@ -1241,6 +1241,7 @@ dialog.dialog::backdrop {
|
|
|
1241
1241
|
.athena-chart {
|
|
1242
1242
|
max-width: 100%;
|
|
1243
1243
|
height: auto;
|
|
1244
|
+
vertical-align: top; /* an inline svg sits on the baseline and leaves a gap under it: a widget would scroll by a pixel */
|
|
1244
1245
|
font-family: sans-serif;
|
|
1245
1246
|
}
|
|
1246
1247
|
|
|
@@ -1640,6 +1641,16 @@ dialog.dialog::backdrop {
|
|
|
1640
1641
|
background: var(--athena-bg);
|
|
1641
1642
|
}
|
|
1642
1643
|
|
|
1644
|
+
.theme-preview-both {
|
|
1645
|
+
display: grid;
|
|
1646
|
+
grid-template-columns: 1fr 1fr;
|
|
1647
|
+
}
|
|
1648
|
+
|
|
1649
|
+
.theme-preview-half {
|
|
1650
|
+
display: block;
|
|
1651
|
+
background: var(--athena-bg);
|
|
1652
|
+
}
|
|
1653
|
+
|
|
1643
1654
|
.theme-preview-bar {
|
|
1644
1655
|
display: block;
|
|
1645
1656
|
height: 10px;
|
|
@@ -2156,6 +2167,7 @@ dialog.dialog::backdrop {
|
|
|
2156
2167
|
}
|
|
2157
2168
|
|
|
2158
2169
|
.page-description {
|
|
2170
|
+
max-width: 70ch; /* a long sentence would take the whole row and push the actions to a row of their own */
|
|
2159
2171
|
margin: 4px 0 0;
|
|
2160
2172
|
color: var(--athena-muted);
|
|
2161
2173
|
}
|
|
@@ -2163,6 +2175,7 @@ dialog.dialog::backdrop {
|
|
|
2163
2175
|
.page-actions {
|
|
2164
2176
|
display: flex;
|
|
2165
2177
|
flex-wrap: wrap;
|
|
2178
|
+
align-items: flex-end; /* a button next to a field with a label stands on the line of the field */
|
|
2166
2179
|
gap: var(--athena-space-2);
|
|
2167
2180
|
}
|
|
2168
2181
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export function applyConfig(...sources: any[]): {
|
|
2
|
-
version: "2.
|
|
2
|
+
version: "2.7.0";
|
|
3
3
|
container_class: "container";
|
|
4
4
|
header_class: "header-container";
|
|
5
5
|
header_menu_class: "header-menu menu";
|
|
@@ -32,7 +32,7 @@ export function applyConfig(...sources: any[]): {
|
|
|
32
32
|
export function withBorder(className: any): any;
|
|
33
33
|
export const BORDERED_CLASS: "default-cointainer-bordered";
|
|
34
34
|
export const defaults: Readonly<{
|
|
35
|
-
version: "2.
|
|
35
|
+
version: "2.7.0";
|
|
36
36
|
container_class: "container";
|
|
37
37
|
header_class: "header-container";
|
|
38
38
|
header_menu_class: "header-menu menu";
|
|
@@ -64,7 +64,7 @@ export const defaults: Readonly<{
|
|
|
64
64
|
}>;
|
|
65
65
|
export default config;
|
|
66
66
|
declare namespace config {
|
|
67
|
-
let version: "2.
|
|
67
|
+
let version: "2.7.0";
|
|
68
68
|
let container_class: "container";
|
|
69
69
|
let header_class: "header-container";
|
|
70
70
|
let header_menu_class: "header-menu menu";
|
|
@@ -45,7 +45,7 @@ export function decimate(indices: any, values: any, buckets: any): any;
|
|
|
45
45
|
* time in milliseconds, or the options of Intl.DateTimeFormat (default: `{ dateStyle: "medium", timeStyle: "medium" }`, for example "Nov 19, 2026, 6:15:09 PM")
|
|
46
46
|
* @param {boolean} [options.points=true] line and area charts: false never draws the dots, however few the points are (the tooltip still follows the pointer and the keyboard)
|
|
47
47
|
* @param {(value: number) => string} [options.tickFormat] how the numbers of the value axis are written, when they should not be written like the values (a chart of whole numbers has ticks of 0.2)
|
|
48
|
-
* @param {{top?: number, right?: number, bottom?: number, left?: number}} [options.margin] room around the plot in px (default 40, 20, 50, 55): a chart without a title and a legend does not need the top
|
|
48
|
+
* @param {{top?: number, right?: number, bottom?: number, left?: number}} [options.margin] room around the plot in px (default 40, 20, 50, 55; with a legend the bottom is at least 48): a chart without a title and a legend does not need the top
|
|
49
49
|
* @param {boolean} [options.responsive=false] the chart is as wide as its parent and follows it when it changes (`height` stays); `width` is only the first guess
|
|
50
50
|
* @returns {(SVGElement & {element: SVGElement, update: (options?: object) => SVGElement, destroy: () => void,
|
|
51
51
|
* zoom: (from: number, to: number) => void, resetZoom: () => void, getZoom: () => ({from: number, to: number}|null),
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
* @param {ReturnType<import("../../core/theme.js").createThemeManager>} options.manager
|
|
9
9
|
* @param {string} [options.themeLabel] legend of the theme group (default: translated "Theme")
|
|
10
10
|
* @param {string} [options.modeLabel] legend of the mode group (default: translated "Mode")
|
|
11
|
+
* @param {"current"|"both"} [options.previewModes="current"] "current": one picture, in the mode that is in use. "both": the light and the dark picture side by side, so a person sees what each mode of a theme looks like
|
|
11
12
|
* @param {string} [options.class]
|
|
12
13
|
* @returns {{element: HTMLElement, update: Function, destroy: Function}}
|
|
13
14
|
*/
|
|
@@ -16,6 +17,7 @@ export function generateThemePicker(options?: {
|
|
|
16
17
|
manager: ReturnType<typeof import("../../core/theme.js").createThemeManager>;
|
|
17
18
|
themeLabel?: string;
|
|
18
19
|
modeLabel?: string;
|
|
20
|
+
previewModes?: "current" | "both";
|
|
19
21
|
class?: string;
|
|
20
22
|
}): {
|
|
21
23
|
element: HTMLElement;
|
|
@@ -45,6 +45,7 @@ export function generateButton(options?: {
|
|
|
45
45
|
* @param {object} [options.rules] validation rules, see validateValue. They can also be given directly
|
|
46
46
|
* (required, email, minLength, ...)
|
|
47
47
|
* @param {(value, field) => void} [options.onChange]
|
|
48
|
+
* @param {boolean} [options.hideLabel=false] the label is there for screen readers and the browser only (a select in a header, a compact filter): it is hidden visually, not removed
|
|
48
49
|
* @param {() => object} [options.getValues] all form values (set by generateForm, used by `match`)
|
|
49
50
|
* @returns {{element: HTMLElement, name: string, getValue: Function, setValue: Function, validate: Function,
|
|
50
51
|
* setError: Function, focus: Function}}
|
|
@@ -65,6 +66,7 @@ export function generateField(options?: {
|
|
|
65
66
|
rows?: number;
|
|
66
67
|
rules?: object;
|
|
67
68
|
onChange?: (value: any, field: any) => void;
|
|
69
|
+
hideLabel?: boolean;
|
|
68
70
|
getValues?: () => object;
|
|
69
71
|
}): {
|
|
70
72
|
element: HTMLElement;
|
|
@@ -21,7 +21,8 @@
|
|
|
21
21
|
* @property {HTMLElement} element the body of the widget: build into it
|
|
22
22
|
* @property {object} config the current config (read it again in update())
|
|
23
23
|
* @property {string} title
|
|
24
|
-
* @property {{width: number, height: number}} size
|
|
24
|
+
* @property {{width: number, height: number}} size the box of the body, as it is now
|
|
25
|
+
* @property {{width: number, height: number}} contentSize what is left inside the padding of the body: the room a chart or a table has
|
|
25
26
|
* @property {(title: string) => void} setTitle
|
|
26
27
|
*/
|
|
27
28
|
export function registerWidget(type: string, definition: {
|
|
@@ -72,8 +73,9 @@ export function getWidgetTypes(): any[];
|
|
|
72
73
|
* @param {boolean} [options.animate=true] widgets slide to their new places (never under reduced motion)
|
|
73
74
|
* @param {string} [options.label] accessible name of the dashboard
|
|
74
75
|
* @param {number} [options.maxWidgets=200]
|
|
76
|
+
* @param {number} [options.changeDelay=0] ms to wait after a change before onChange is called (a drag is many steps: one call after the last); 0 calls it at once. `flush()` calls it now
|
|
75
77
|
* @param {(layout: object, reason: string) => void} [options.onChange] called after a change made by the person or by add/remove/...: "move", "resize", "add", "remove", "duplicate", "settings", "lock", "undo", "redo"
|
|
76
|
-
* @returns the handle: { element, addWidget, removeWidget, duplicateWidget, configureWidget, updateWidget, getWidget, getWidgets, lockWidget, setEditable, isEditable,
|
|
78
|
+
* @returns the handle: { element, addWidget, addWidgetWithSettings, flush, removeWidget, duplicateWidget, configureWidget, updateWidget, getWidget, getWidgets, lockWidget, setEditable, isEditable,
|
|
77
79
|
* getLayout, setLayout, undo, redo, canUndo, canRedo, getBreakpoint, destroy }
|
|
78
80
|
*/
|
|
79
81
|
export function createWidgetGrid(options?: {
|
|
@@ -92,6 +94,7 @@ export function createWidgetGrid(options?: {
|
|
|
92
94
|
animate?: boolean;
|
|
93
95
|
label?: string;
|
|
94
96
|
maxWidgets?: number;
|
|
97
|
+
changeDelay?: number;
|
|
95
98
|
onChange?: (layout: object, reason: string) => void;
|
|
96
99
|
}): any;
|
|
97
100
|
/**
|
|
@@ -109,9 +112,19 @@ export type WidgetContext = {
|
|
|
109
112
|
*/
|
|
110
113
|
config: object;
|
|
111
114
|
title: string;
|
|
115
|
+
/**
|
|
116
|
+
* the box of the body, as it is now
|
|
117
|
+
*/
|
|
112
118
|
size: {
|
|
113
119
|
width: number;
|
|
114
120
|
height: number;
|
|
115
121
|
};
|
|
122
|
+
/**
|
|
123
|
+
* what is left inside the padding of the body: the room a chart or a table has
|
|
124
|
+
*/
|
|
125
|
+
contentSize: {
|
|
126
|
+
width: number;
|
|
127
|
+
height: number;
|
|
128
|
+
};
|
|
116
129
|
setTitle: (title: string) => void;
|
|
117
130
|
};
|