@mintplayer/ng-spark 22.33.0 → 22.35.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/fesm2022/mintplayer-ng-spark-auth-account.mjs +576 -2
- package/fesm2022/mintplayer-ng-spark-auth-account.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-spark-auth-core.mjs +24 -0
- package/fesm2022/mintplayer-ng-spark-auth-core.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-spark-auth-models.mjs +4 -1
- package/fesm2022/mintplayer-ng-spark-auth-models.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-spark-auth-register.mjs +18 -5
- package/fesm2022/mintplayer-ng-spark-auth-register.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-spark-auth-routes.mjs +22 -1
- package/fesm2022/mintplayer-ng-spark-auth-routes.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-spark-dashboards.mjs +726 -0
- package/fesm2022/mintplayer-ng-spark-dashboards.mjs.map +1 -0
- package/fesm2022/mintplayer-ng-spark-panels.mjs +9 -1
- package/fesm2022/mintplayer-ng-spark-panels.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-spark-po-detail.mjs +10 -3
- package/fesm2022/mintplayer-ng-spark-po-detail.mjs.map +1 -1
- package/package.json +5 -1
- package/types/mintplayer-ng-spark-auth-account.d.ts +56 -1
- package/types/mintplayer-ng-spark-auth-core.d.ts +11 -1
- package/types/mintplayer-ng-spark-auth-models.d.ts +96 -1
- package/types/mintplayer-ng-spark-auth-register.d.ts +13 -0
- package/types/mintplayer-ng-spark-auth-routes.d.ts +15 -0
- package/types/mintplayer-ng-spark-dashboards.d.ts +226 -0
- package/types/mintplayer-ng-spark-panels.d.ts +16 -0
- package/types/mintplayer-ng-spark-po-detail.d.ts +3 -0
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
import { SparkAttributeColumnRenderer, SparkAttributeDetailRenderer, SparkAttributeRendererRegistration } from "@mintplayer/ng-spark/renderers";
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
import { Provider, Type } from "@angular/core";
|
|
4
|
+
import { Color } from "@mintplayer/ng-bootstrap";
|
|
5
|
+
import { SparkLanguageService } from "@mintplayer/ng-spark/services";
|
|
6
|
+
import { EntityAttributeDefinition, PersistentObject, TranslatedString } from "@mintplayer/ng-spark/models";
|
|
7
|
+
import { SparkDetailContext } from "@mintplayer/ng-spark/panels";
|
|
8
|
+
/** How a dashboard value is written: a plain number, bytes (binary units), a percentage, a date, or as is. */
|
|
9
|
+
export type SparkDashboardFormat = 'number' | 'bytes' | 'percent' | 'date' | 'datetime' | 'text';
|
|
10
|
+
/** A finite number from a wire value (a number or a numeric string), else null. */
|
|
11
|
+
export declare function toSparkNumber(value: unknown): number | null;
|
|
12
|
+
/** 1536 → "1.5 KB": binary units, one decimal from KB up; "—" for no value. */
|
|
13
|
+
export declare function formatSparkBytes(bytes: number | null | undefined, locale?: string): string;
|
|
14
|
+
/**
|
|
15
|
+
* A value as a dashboard writes it: "—" for none; numbers by `format` (`decimals` places for `number`/`percent`,
|
|
16
|
+
* default 0); dates in the viewer's locale; anything else as text.
|
|
17
|
+
*/
|
|
18
|
+
export declare function formatSparkDashboardValue(value: unknown, format: SparkDashboardFormat | undefined, locale?: string, decimals?: number): string;
|
|
19
|
+
/** The colour a threshold gives a value: `danger` at or past `danger`, `warning` at or past `warning`, else none. */
|
|
20
|
+
export declare function sparkThresholdColor(value: number | null, thresholds: {
|
|
21
|
+
warning?: number;
|
|
22
|
+
danger?: number;
|
|
23
|
+
direction?: 'above' | 'below';
|
|
24
|
+
}): 'warning' | 'danger' | null;
|
|
25
|
+
/** `rendererOptions` of the `spark-stat` renderer. Every member is optional. */
|
|
26
|
+
export interface SparkStatOptions {
|
|
27
|
+
/** How the value is written. Default `'number'`. */
|
|
28
|
+
format?: SparkDashboardFormat;
|
|
29
|
+
/** Decimals for `number` (default 0) and `percent` (default 1). */
|
|
30
|
+
decimals?: number;
|
|
31
|
+
/** Text after the value, e.g. `' sites'`. Default none. */
|
|
32
|
+
suffix?: string;
|
|
33
|
+
/** The value turns amber at or past this. */
|
|
34
|
+
warning?: number;
|
|
35
|
+
/** The value turns red at or past this. */
|
|
36
|
+
danger?: number;
|
|
37
|
+
/** `'above'` (default): high is bad, as for disk use. `'below'`: low is bad, as for free space. */
|
|
38
|
+
direction?: 'above' | 'below';
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* The `spark-stat` renderer: one figure, large on a detail page (a dashboard tile) and plain in a grid cell,
|
|
42
|
+
* coloured amber or red once it passes the model's `warning` / `danger` threshold. No value draws a muted dash.
|
|
43
|
+
*/
|
|
44
|
+
export declare class SparkStatComponent implements SparkAttributeColumnRenderer, SparkAttributeDetailRenderer {
|
|
45
|
+
private readonly locale;
|
|
46
|
+
readonly value: import("@angular/core").InputSignal<any>;
|
|
47
|
+
readonly options: import("@angular/core").InputSignal<Record<string, any> | undefined>;
|
|
48
|
+
private readonly settings;
|
|
49
|
+
protected readonly text: import("@angular/core").Signal<string>;
|
|
50
|
+
protected readonly color: import("@angular/core").Signal<"warning" | "danger" | null>;
|
|
51
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SparkStatComponent, never>;
|
|
52
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<SparkStatComponent, "spark-stat", never, {
|
|
53
|
+
"value": {
|
|
54
|
+
"alias": "value";
|
|
55
|
+
"required": false;
|
|
56
|
+
"isSignal": true;
|
|
57
|
+
};
|
|
58
|
+
"options": {
|
|
59
|
+
"alias": "options";
|
|
60
|
+
"required": false;
|
|
61
|
+
"isSignal": true;
|
|
62
|
+
};
|
|
63
|
+
}, {}, never, never, true, never>;
|
|
64
|
+
}
|
|
65
|
+
/** `rendererOptions` of the `spark-meter` renderer. Every member is optional. */
|
|
66
|
+
export interface SparkMeterOptions {
|
|
67
|
+
/** The ceiling when the value is a plain number (a value `{ value, max }` brings its own). Default 100. */
|
|
68
|
+
max?: number;
|
|
69
|
+
/** How the value and the ceiling are written. Default `'number'`. */
|
|
70
|
+
format?: SparkDashboardFormat;
|
|
71
|
+
/** Amber from this share of the ceiling, in percent. Default 75. */
|
|
72
|
+
warning?: number;
|
|
73
|
+
/** Red from this share of the ceiling, in percent. Default 90. */
|
|
74
|
+
danger?: number;
|
|
75
|
+
/** The meter's accessible name. Default `'Usage'`. */
|
|
76
|
+
label?: string;
|
|
77
|
+
}
|
|
78
|
+
interface MeterView {
|
|
79
|
+
value: number;
|
|
80
|
+
max: number;
|
|
81
|
+
/** The share of the ceiling, in percent (0–100), one decimal. */
|
|
82
|
+
share: number;
|
|
83
|
+
color: Color;
|
|
84
|
+
text: string;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* The `spark-meter` renderer: how much of something is used, as a bar coloured by its share (green, amber from 75 %,
|
|
88
|
+
* red from 90 % by default) with "used of total (share)" next to it. The value is a number against the `max` option, or
|
|
89
|
+
* `{ value, max }` from the server (the dashboards package's `DashboardValues.Meter`), e.g. disk bytes used of the total.
|
|
90
|
+
* No value, or no ceiling, draws a muted dash.
|
|
91
|
+
*/
|
|
92
|
+
export declare class SparkMeterComponent implements SparkAttributeColumnRenderer, SparkAttributeDetailRenderer {
|
|
93
|
+
private readonly locale;
|
|
94
|
+
readonly value: import("@angular/core").InputSignal<any>;
|
|
95
|
+
readonly options: import("@angular/core").InputSignal<Record<string, any> | undefined>;
|
|
96
|
+
private readonly settings;
|
|
97
|
+
protected readonly label: import("@angular/core").Signal<string>;
|
|
98
|
+
protected readonly view: import("@angular/core").Signal<MeterView | null>;
|
|
99
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SparkMeterComponent, never>;
|
|
100
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<SparkMeterComponent, "spark-meter", never, {
|
|
101
|
+
"value": {
|
|
102
|
+
"alias": "value";
|
|
103
|
+
"required": false;
|
|
104
|
+
"isSignal": true;
|
|
105
|
+
};
|
|
106
|
+
"options": {
|
|
107
|
+
"alias": "options";
|
|
108
|
+
"required": false;
|
|
109
|
+
"isSignal": true;
|
|
110
|
+
};
|
|
111
|
+
}, {}, never, never, true, never>;
|
|
112
|
+
}
|
|
113
|
+
/** One column of a `spark-dashboard-table`. */
|
|
114
|
+
export interface SparkDashboardTableColumn {
|
|
115
|
+
/** The row field. For a value that is a dictionary, its rows are `{ key, value }`. */
|
|
116
|
+
key: string;
|
|
117
|
+
/** A translation key for the header (`translations.json`), shown as is when it has no translation. Default `key`. */
|
|
118
|
+
label?: string;
|
|
119
|
+
/** How the cells are written. Numbers and bytes are right-aligned. Default: as is. */
|
|
120
|
+
format?: SparkDashboardFormat | 'boolean';
|
|
121
|
+
/** Translate each cell as `{translate}{value}` (e.g. `'seoUi.runStatus.'`), falling back to the value. */
|
|
122
|
+
translate?: string;
|
|
123
|
+
}
|
|
124
|
+
/** `rendererOptions` of the `spark-dashboard-table` renderer. */
|
|
125
|
+
export interface SparkDashboardTableOptions {
|
|
126
|
+
/** The columns, in order. Default: the first row's fields. */
|
|
127
|
+
columns?: SparkDashboardTableColumn[];
|
|
128
|
+
/** A translation key shown when there are no rows. Default `'dashboards.empty'`. */
|
|
129
|
+
empty?: string;
|
|
130
|
+
}
|
|
131
|
+
interface TableCell {
|
|
132
|
+
text: string;
|
|
133
|
+
check: boolean;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* The `spark-dashboard-table` renderer (detail pages): a dashboard value that is a list of rows, such as the
|
|
137
|
+
* RavenDB statistics' collections (D12: tables are JSON attributes). A dictionary (`{ "Completed": 3 }`) reads as
|
|
138
|
+
* rows `{ key, value }`.
|
|
139
|
+
*/
|
|
140
|
+
export declare class SparkDashboardTableComponent implements SparkAttributeDetailRenderer {
|
|
141
|
+
private readonly locale;
|
|
142
|
+
protected readonly lang: SparkLanguageService;
|
|
143
|
+
readonly value: import("@angular/core").InputSignal<any>;
|
|
144
|
+
readonly options: import("@angular/core").InputSignal<Record<string, any> | undefined>;
|
|
145
|
+
protected readonly settings: import("@angular/core").Signal<SparkDashboardTableOptions>;
|
|
146
|
+
protected readonly rows: import("@angular/core").Signal<Record<string, unknown>[]>;
|
|
147
|
+
protected readonly columns: import("@angular/core").Signal<SparkDashboardTableColumn[]>;
|
|
148
|
+
protected readonly cells: import("@angular/core").Signal<TableCell[][]>;
|
|
149
|
+
protected header(column: SparkDashboardTableColumn): string;
|
|
150
|
+
protected isNumeric(column: SparkDashboardTableColumn | undefined): boolean;
|
|
151
|
+
private cell;
|
|
152
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SparkDashboardTableComponent, never>;
|
|
153
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<SparkDashboardTableComponent, "spark-dashboard-table", never, {
|
|
154
|
+
"value": {
|
|
155
|
+
"alias": "value";
|
|
156
|
+
"required": false;
|
|
157
|
+
"isSignal": true;
|
|
158
|
+
};
|
|
159
|
+
"options": {
|
|
160
|
+
"alias": "options";
|
|
161
|
+
"required": false;
|
|
162
|
+
"isSignal": true;
|
|
163
|
+
};
|
|
164
|
+
}, {}, never, never, true, never>;
|
|
165
|
+
}
|
|
166
|
+
/** The rows of a table value: a list of objects as is, a dictionary as `{ key, value }` rows, anything else none. */
|
|
167
|
+
export declare function toSparkTableRows(value: unknown): Record<string, unknown>[];
|
|
168
|
+
/** The `metadata` key a dashboard carries (the dashboards package's `SparkDashboardActions.MetadataKey`). */
|
|
169
|
+
export declare const SPARK_DASHBOARD_METADATA_KEY = "dashboard";
|
|
170
|
+
/** Whether `item` is a dashboard: the server marks one with `metadata.dashboard`. */
|
|
171
|
+
export declare function isSparkDashboard(item: PersistentObject | null | undefined): boolean;
|
|
172
|
+
interface DashboardTile {
|
|
173
|
+
attribute: EntityAttributeDefinition;
|
|
174
|
+
/** Columns spanned: 1, 2, or the whole row. */
|
|
175
|
+
span: 1 | 2 | 'row';
|
|
176
|
+
component: Type<any> | null;
|
|
177
|
+
inputs: Record<string, any>;
|
|
178
|
+
/** The value as text, for an attribute without a detail renderer. */
|
|
179
|
+
text: string;
|
|
180
|
+
}
|
|
181
|
+
interface DashboardSection {
|
|
182
|
+
id: string;
|
|
183
|
+
name: string | null;
|
|
184
|
+
label?: TranslatedString;
|
|
185
|
+
tiles: DashboardTile[];
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* The dashboard tile layout (D12): replaces a dashboard's attribute cards on the routed detail page
|
|
189
|
+
* (`SPARK_DETAIL_LAYOUTS`, registered by `provideSparkDashboards()`). Each group of the model is a section, each
|
|
190
|
+
* attribute a tile: its label above its detail renderer (`spark-stat`, `spark-meter`, `spark-trend`,
|
|
191
|
+
* `spark-dashboard-table`, …) or its plain value. `columnSpan` 2 takes two columns, 3 and more (and a table without one) the
|
|
192
|
+
* whole row. An attribute the caller may not read is not on the object and has no tile. The page follows the object
|
|
193
|
+
* over `/spark/live` like any live type, so the tiles change in place.
|
|
194
|
+
*/
|
|
195
|
+
export declare class SparkDashboardComponent {
|
|
196
|
+
private readonly locale;
|
|
197
|
+
private readonly renderers;
|
|
198
|
+
readonly context: import("@angular/core").InputSignal<SparkDetailContext>;
|
|
199
|
+
protected readonly sections: import("@angular/core").Signal<DashboardSection[]>;
|
|
200
|
+
/** When the server read the values, in the viewer's locale. */
|
|
201
|
+
protected readonly generatedAt: import("@angular/core").Signal<string | null>;
|
|
202
|
+
private tile;
|
|
203
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SparkDashboardComponent, never>;
|
|
204
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<SparkDashboardComponent, "spark-dashboard", never, {
|
|
205
|
+
"context": {
|
|
206
|
+
"alias": "context";
|
|
207
|
+
"required": true;
|
|
208
|
+
"isSignal": true;
|
|
209
|
+
};
|
|
210
|
+
}, {}, never, never, true, never>;
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* The dashboard renderers under their model names. Renderers are one list, so add these to the app's own in its
|
|
214
|
+
* single `provideSparkAttributeRenderers` (or `provideSparkScoreRenderers`, which `spark-trend` comes from) call:
|
|
215
|
+
*
|
|
216
|
+
* @example
|
|
217
|
+
* provideSparkScoreRenderers([...appRenderers, ...sparkDashboardRenderers]),
|
|
218
|
+
* provideSparkDashboards(),
|
|
219
|
+
*/
|
|
220
|
+
export declare const sparkDashboardRenderers: readonly SparkAttributeRendererRegistration[];
|
|
221
|
+
/**
|
|
222
|
+
* Draws every dashboard (an object the server marks with `metadata.dashboard`, the dashboards package's live virtual
|
|
223
|
+
* types) with the tile layout instead of the attribute cards, on the routed detail page. The renderers are registered
|
|
224
|
+
* separately: see {@link sparkDashboardRenderers}.
|
|
225
|
+
*/
|
|
226
|
+
export declare function provideSparkDashboards(): Provider[];
|
|
@@ -119,6 +119,22 @@ export interface SparkQueryRowAction {
|
|
|
119
119
|
export declare const SPARK_QUERY_ROW_ACTIONS: InjectionToken<SparkQueryRowAction[]>;
|
|
120
120
|
/** Registers grid row actions (multi — every call adds). */
|
|
121
121
|
export declare function provideSparkQueryRowActions(...actions: SparkQueryRowAction[]): Provider[];
|
|
122
|
+
/**
|
|
123
|
+
* A layout that draws a detail page's attributes in place of the tabs and cards (#504), for objects it
|
|
124
|
+
* `matches`: Dashboards' tile layout for objects carrying `metadata.dashboard`. It must declare
|
|
125
|
+
* `context = input.required<SparkDetailContext>()`. The action bar, sub-queries, the extra content
|
|
126
|
+
* template and the detail panels stay; the first matching layout wins.
|
|
127
|
+
*/
|
|
128
|
+
export interface SparkDetailLayout {
|
|
129
|
+
id: string;
|
|
130
|
+
component: Type<unknown>;
|
|
131
|
+
/** Whether this layout draws `item`. Called on every change of the object, so keep it cheap. */
|
|
132
|
+
matches(item: PersistentObject, entityType: EntityType): boolean;
|
|
133
|
+
}
|
|
134
|
+
/** Multi-provider: layouts that replace the attribute cards of the routed detail page for the objects they match. */
|
|
135
|
+
export declare const SPARK_DETAIL_LAYOUTS: InjectionToken<SparkDetailLayout[]>;
|
|
136
|
+
/** Registers detail layouts (multi — every call adds). */
|
|
137
|
+
export declare function provideSparkDetailLayouts(...layouts: SparkDetailLayout[]): Provider[];
|
|
122
138
|
/** Multi-provider: panels under the attributes of the routed detail page. */
|
|
123
139
|
export declare const SPARK_DETAIL_PANELS: InjectionToken<SparkDetailPanel[]>;
|
|
124
140
|
/** Multi-provider: extra buttons in the routed detail page's action bar. */
|
|
@@ -23,6 +23,7 @@ export declare class SparkPoDetailComponent {
|
|
|
23
23
|
*/
|
|
24
24
|
protected readonly detailPanels: import("@mintplayer/ng-spark/panels").SparkDetailPanel[];
|
|
25
25
|
protected readonly detailActions: import("@mintplayer/ng-spark/panels").SparkDetailAction[];
|
|
26
|
+
private readonly detailLayouts;
|
|
26
27
|
showCustomActions: import("@angular/core").InputSignal<boolean>;
|
|
27
28
|
extraActionsTemplate: import("@angular/core").InputSignal<TemplateRef<void> | null>;
|
|
28
29
|
extraContentTemplate: import("@angular/core").InputSignal<TemplateRef<{
|
|
@@ -86,6 +87,8 @@ export declare class SparkPoDetailComponent {
|
|
|
86
87
|
protected readonly isDeletedView: import("@angular/core").Signal<boolean>;
|
|
87
88
|
/** What every add-on panel and action receives; rebuilt whenever the object or rights change. */
|
|
88
89
|
protected readonly detailContext: import("@angular/core").Signal<SparkDetailContext | null>;
|
|
90
|
+
/** The registered layout that draws this object's attributes instead of the tabs (#504), if one matches. */
|
|
91
|
+
protected readonly detailLayout: import("@angular/core").Signal<import("@mintplayer/ng-spark/panels").SparkDetailLayout | null>;
|
|
89
92
|
/**
|
|
90
93
|
* The actions actually offered for the object on screen.
|
|
91
94
|
*
|