@gooddata/sdk-model 11.55.0-alpha.0 → 11.55.0-alpha.2
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/esm/execution/attribute/index.d.ts +11 -0
- package/esm/execution/attribute/index.d.ts.map +1 -1
- package/esm/execution/attribute/index.js +15 -1
- package/esm/index.d.ts +4 -2
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +4 -2
- package/esm/ldm/metadata/measure/index.d.ts +7 -0
- package/esm/ldm/metadata/measure/index.d.ts.map +1 -1
- package/esm/reports/builtinPageLayouts.d.ts +18 -0
- package/esm/reports/builtinPageLayouts.d.ts.map +1 -1
- package/esm/reports/builtinPageLayouts.js +210 -37
- package/esm/reports/factory.d.ts.map +1 -1
- package/esm/reports/factory.js +12 -0
- package/esm/reports/layout.d.ts +7 -2
- package/esm/reports/layout.d.ts.map +1 -1
- package/esm/reports/pageFormat.d.ts +38 -0
- package/esm/reports/pageFormat.d.ts.map +1 -0
- package/esm/reports/pageFormat.js +33 -0
- package/esm/reports/pageLayout.d.ts +16 -4
- package/esm/reports/pageLayout.d.ts.map +1 -1
- package/esm/reports/pageLayout.js +39 -5
- package/esm/reports/slot.d.ts +9 -0
- package/esm/reports/slot.d.ts.map +1 -1
- package/esm/reports/styling.d.ts +88 -0
- package/esm/reports/styling.d.ts.map +1 -0
- package/esm/reports/styling.js +18 -0
- package/esm/sdk-model.d.ts +210 -6
- package/esm/settings/settings.d.ts +5 -0
- package/esm/settings/settings.d.ts.map +1 -1
- package/package.json +6 -8
package/esm/reports/factory.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// (C) 2026 GoodData Corporation
|
|
2
2
|
import { isReportLayoutSection } from "./layout.js";
|
|
3
|
+
import { isReportImageBackground } from "./styling.js";
|
|
3
4
|
function generateReportLocalId(prefix) {
|
|
4
5
|
const unique = typeof crypto !== "undefined" && typeof crypto.randomUUID === "function"
|
|
5
6
|
? crypto.randomUUID().replace(/-/g, "").slice(0, 12)
|
|
@@ -9,10 +10,20 @@ function generateReportLocalId(prefix) {
|
|
|
9
10
|
function deepClone(value) {
|
|
10
11
|
return JSON.parse(JSON.stringify(value));
|
|
11
12
|
}
|
|
13
|
+
function prefixBackgroundSlotId(style, prefix) {
|
|
14
|
+
if (!style?.background || !isReportImageBackground(style.background)) {
|
|
15
|
+
return style;
|
|
16
|
+
}
|
|
17
|
+
return {
|
|
18
|
+
...style,
|
|
19
|
+
background: { ...style.background, slotId: `${prefix}_${style.background.slotId}` },
|
|
20
|
+
};
|
|
21
|
+
}
|
|
12
22
|
function prefixLayoutSlotIds(node, prefix) {
|
|
13
23
|
if (isReportLayoutSection(node)) {
|
|
14
24
|
return {
|
|
15
25
|
...node,
|
|
26
|
+
...(node.style === undefined ? {} : { style: prefixBackgroundSlotId(node.style, prefix) }),
|
|
16
27
|
children: node.children.map((child) => prefixLayoutSlotIds(child, prefix)),
|
|
17
28
|
};
|
|
18
29
|
}
|
|
@@ -50,6 +61,7 @@ export function newReportContentPageFromLayout(page, localIdentifier = generateR
|
|
|
50
61
|
return {
|
|
51
62
|
...body,
|
|
52
63
|
localIdentifier,
|
|
64
|
+
...(body.style === undefined ? {} : { style: prefixBackgroundSlotId(body.style, localIdentifier) }),
|
|
53
65
|
layout: prefixLayoutSlotIds(body.layout, localIdentifier),
|
|
54
66
|
slots: body.slots.map((slot) => ({
|
|
55
67
|
...slot,
|
package/esm/reports/layout.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { type IReportBoxStyle } from "./styling.js";
|
|
1
2
|
/**
|
|
2
3
|
* Node of a report page layout: a recursive row/column split tree (flexbox semantics)
|
|
3
|
-
* over a fixed page. Leaves assign their area to slots; the tree carries
|
|
4
|
-
* slot content lives in {@link IReportPageBody.slots}.
|
|
4
|
+
* over a fixed page. Leaves assign their area to slots; the tree carries geometry and
|
|
5
|
+
* box paint, slot content lives in {@link IReportPageBody.slots}.
|
|
5
6
|
*
|
|
6
7
|
* @alpha
|
|
7
8
|
*/
|
|
@@ -30,6 +31,10 @@ export interface IReportLayoutSection extends IReportLayoutNodeBase {
|
|
|
30
31
|
*/
|
|
31
32
|
direction: "row" | "column";
|
|
32
33
|
children: ReportPageLayoutNode[];
|
|
34
|
+
/**
|
|
35
|
+
* Paint of this section's box. Never affects how children are laid out.
|
|
36
|
+
*/
|
|
37
|
+
style?: IReportBoxStyle;
|
|
33
38
|
}
|
|
34
39
|
/**
|
|
35
40
|
* A leaf assigning its area to a slot. The slot fills the area completely.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../src/reports/layout.ts"],"names":[],"mappings":"AAIA;;;;;;GAMG;AACH,MAAM,MAAM,oBAAoB,GAAG,oBAAoB,GAAG,oBAAoB,CAAC;AAE/E;;;;GAIG;AACH,MAAM,WAAW,qBAAqB;IAClC;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;;GAIG;AACH,MAAM,WAAW,oBAAqB,SAAQ,qBAAqB;IAC/D,IAAI,EAAE,SAAS,CAAC;IAEhB;;OAEG;IACH,SAAS,EAAE,KAAK,GAAG,QAAQ,CAAC;IAE5B,QAAQ,EAAE,oBAAoB,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../src/reports/layout.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,cAAc,CAAC;AAEpD;;;;;;GAMG;AACH,MAAM,MAAM,oBAAoB,GAAG,oBAAoB,GAAG,oBAAoB,CAAC;AAE/E;;;;GAIG;AACH,MAAM,WAAW,qBAAqB;IAClC;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;;GAIG;AACH,MAAM,WAAW,oBAAqB,SAAQ,qBAAqB;IAC/D,IAAI,EAAE,SAAS,CAAC;IAEhB;;OAEG;IACH,SAAS,EAAE,KAAK,GAAG,QAAQ,CAAC;IAE5B,QAAQ,EAAE,oBAAoB,EAAE,CAAC;IAEjC;;OAEG;IACH,KAAK,CAAC,EAAE,eAAe,CAAC;CAC3B;AAED;;;;GAIG;AACH,MAAM,WAAW,oBAAqB,SAAQ,qBAAqB;IAC/D,IAAI,EAAE,SAAS,CAAC;IAEhB;;;OAGG;IACH,MAAM,EAAE,MAAM,CAAC;CAClB;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,oBAAoB,CAE/E;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,oBAAoB,CAE/E"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Page shape a report page layout is designed for.
|
|
3
|
+
*
|
|
4
|
+
* @remarks
|
|
5
|
+
* A layout's geometry only reads correctly at the proportions it was authored for: a row of three
|
|
6
|
+
* visualizations that works on a widescreen slide is unusably narrow on an upright page. The format
|
|
7
|
+
* is therefore a property of the page, not a choice made when rendering it.
|
|
8
|
+
*
|
|
9
|
+
* @alpha
|
|
10
|
+
*/
|
|
11
|
+
export type ReportPageFormat = "widescreen" | "a4Portrait" | "letterPortrait";
|
|
12
|
+
/**
|
|
13
|
+
* Format assumed by a page that declares none, which keeps pages authored before formats existed
|
|
14
|
+
* on the shape they were designed for.
|
|
15
|
+
*
|
|
16
|
+
* @alpha
|
|
17
|
+
*/
|
|
18
|
+
export declare const DefaultReportPageFormat: ReportPageFormat;
|
|
19
|
+
/**
|
|
20
|
+
* List of built-in report page format names.
|
|
21
|
+
*
|
|
22
|
+
* @alpha
|
|
23
|
+
*/
|
|
24
|
+
export declare const ReportPageFormats: ReportPageFormat[];
|
|
25
|
+
/**
|
|
26
|
+
* Width divided by height for each page format: 16:9 for a slide, ISO A4 (210 x 297 mm) and
|
|
27
|
+
* US Letter (8.5 x 11 in) upright.
|
|
28
|
+
*
|
|
29
|
+
* @alpha
|
|
30
|
+
*/
|
|
31
|
+
export declare const ReportPageFormatAspectRatios: Record<ReportPageFormat, number>;
|
|
32
|
+
/**
|
|
33
|
+
* Type-guard testing whether the provided value is a {@link ReportPageFormat}.
|
|
34
|
+
*
|
|
35
|
+
* @alpha
|
|
36
|
+
*/
|
|
37
|
+
export declare function isReportPageFormat(value: unknown): value is ReportPageFormat;
|
|
38
|
+
//# sourceMappingURL=pageFormat.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pageFormat.d.ts","sourceRoot":"","sources":["../../src/reports/pageFormat.ts"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AACH,MAAM,MAAM,gBAAgB,GAAG,YAAY,GAAG,YAAY,GAAG,gBAAgB,CAAC;AAE9E;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,EAAE,gBAA+B,CAAC;AAEtE;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,EAAE,gBAAgB,EAAmD,CAAC;AAEpG;;;;;GAKG;AACH,eAAO,MAAM,4BAA4B,EAAE,MAAM,CAAC,gBAAgB,EAAE,MAAM,CAIzE,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,gBAAgB,CAE5E"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// (C) 2026 GoodData Corporation
|
|
2
|
+
/**
|
|
3
|
+
* Format assumed by a page that declares none, which keeps pages authored before formats existed
|
|
4
|
+
* on the shape they were designed for.
|
|
5
|
+
*
|
|
6
|
+
* @alpha
|
|
7
|
+
*/
|
|
8
|
+
export const DefaultReportPageFormat = "widescreen";
|
|
9
|
+
/**
|
|
10
|
+
* List of built-in report page format names.
|
|
11
|
+
*
|
|
12
|
+
* @alpha
|
|
13
|
+
*/
|
|
14
|
+
export const ReportPageFormats = ["widescreen", "a4Portrait", "letterPortrait"];
|
|
15
|
+
/**
|
|
16
|
+
* Width divided by height for each page format: 16:9 for a slide, ISO A4 (210 x 297 mm) and
|
|
17
|
+
* US Letter (8.5 x 11 in) upright.
|
|
18
|
+
*
|
|
19
|
+
* @alpha
|
|
20
|
+
*/
|
|
21
|
+
export const ReportPageFormatAspectRatios = {
|
|
22
|
+
widescreen: 16 / 9,
|
|
23
|
+
a4Portrait: 210 / 297,
|
|
24
|
+
letterPortrait: 8.5 / 11,
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Type-guard testing whether the provided value is a {@link ReportPageFormat}.
|
|
28
|
+
*
|
|
29
|
+
* @alpha
|
|
30
|
+
*/
|
|
31
|
+
export function isReportPageFormat(value) {
|
|
32
|
+
return typeof value === "string" && ReportPageFormats.includes(value);
|
|
33
|
+
}
|
|
@@ -2,7 +2,9 @@ import { type IAuditableDates, type IAuditableUsers } from "../base/metadata.js"
|
|
|
2
2
|
import { type FilterContextItem } from "../dashboard/filterContext.js";
|
|
3
3
|
import { type ObjRef } from "../objRef/index.js";
|
|
4
4
|
import { type ReportPageLayoutNode } from "./layout.js";
|
|
5
|
+
import { type ReportPageFormat } from "./pageFormat.js";
|
|
5
6
|
import { type ReportSlot } from "./slot.js";
|
|
7
|
+
import { type IReportBoxStyle } from "./styling.js";
|
|
6
8
|
/**
|
|
7
9
|
* Body of a report page: geometry (flex split tree) plus the slots it places.
|
|
8
10
|
*
|
|
@@ -22,6 +24,15 @@ export interface IReportPageBody {
|
|
|
22
24
|
* Renderers must not branch layout logic on it — geometry always comes from `layout`.
|
|
23
25
|
*/
|
|
24
26
|
kind?: "cover" | "section" | "content";
|
|
27
|
+
/**
|
|
28
|
+
* Page proportions the layout was authored for. Defaults to
|
|
29
|
+
* {@link DefaultReportPageFormat}.
|
|
30
|
+
*/
|
|
31
|
+
format?: ReportPageFormat;
|
|
32
|
+
/**
|
|
33
|
+
* Paint of the page itself, behind everything the layout places.
|
|
34
|
+
*/
|
|
35
|
+
style?: IReportBoxStyle;
|
|
25
36
|
/**
|
|
26
37
|
* Root of the page layout tree.
|
|
27
38
|
*/
|
|
@@ -109,10 +120,11 @@ export interface IReportPageBodyValidationIssue {
|
|
|
109
120
|
message: string;
|
|
110
121
|
}
|
|
111
122
|
/**
|
|
112
|
-
* Validates the structural invariants of a page body
|
|
113
|
-
*
|
|
114
|
-
*
|
|
115
|
-
* they render as empty areas)
|
|
123
|
+
* Validates the structural invariants of a page body beyond what its types guarantee for content
|
|
124
|
+
* arriving from the wire: the page format is known, slot localIdentifiers are unique, layout
|
|
125
|
+
* weights are positive, every slot is placed (by the layout or as a background), every layout
|
|
126
|
+
* slotId resolves (unresolved ones are warnings — they render as empty areas), and background
|
|
127
|
+
* references resolve to image slots.
|
|
116
128
|
*
|
|
117
129
|
* @alpha
|
|
118
130
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pageLayout.d.ts","sourceRoot":"","sources":["../../src/reports/pageLayout.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,eAAe,EAAE,KAAK,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACjF,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAE,KAAK,MAAM,EAAY,MAAM,oBAAoB,CAAC;AAE3D,OAAO,EAAE,KAAK,oBAAoB,EAAgD,MAAM,aAAa,CAAC;AACtG,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"pageLayout.d.ts","sourceRoot":"","sources":["../../src/reports/pageLayout.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,eAAe,EAAE,KAAK,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACjF,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAE,KAAK,MAAM,EAAY,MAAM,oBAAoB,CAAC;AAE3D,OAAO,EAAE,KAAK,oBAAoB,EAAgD,MAAM,aAAa,CAAC;AACtG,OAAO,EAAE,KAAK,gBAAgB,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AgB,kBAAkB,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,iBAAiB,CAEzE;AAED;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,wBAAwB,CAOzF;AAED;;;;GAIG;AACH,MAAM,WAAW,8BAA8B;IAC3C,QAAQ,EAAE,OAAO,GAAG,SAAS,CAAC;IAC9B,OAAO,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,eAAe,GAAG,8BAA8B,EAAE,CA8E9F"}
|
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
import { isEmpty } from "lodash-es";
|
|
3
3
|
import { isObjRef } from "../objRef/index.js";
|
|
4
4
|
import { isReportLayoutSection, isReportLayoutSlotRef } from "./layout.js";
|
|
5
|
+
import { isReportPageFormat } from "./pageFormat.js";
|
|
6
|
+
import { isReportImageSlot } from "./slot.js";
|
|
7
|
+
import { isReportImageBackground } from "./styling.js";
|
|
5
8
|
/**
|
|
6
9
|
* Type-guard testing whether the provided object is an instance of {@link IReportPageLayoutDefinition}.
|
|
7
10
|
*
|
|
@@ -30,15 +33,19 @@ export function isReportPageLayoutContentV1(obj) {
|
|
|
30
33
|
Array.isArray(obj.slots));
|
|
31
34
|
}
|
|
32
35
|
/**
|
|
33
|
-
* Validates the structural invariants of a page body
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
* they render as empty areas)
|
|
36
|
+
* Validates the structural invariants of a page body beyond what its types guarantee for content
|
|
37
|
+
* arriving from the wire: the page format is known, slot localIdentifiers are unique, layout
|
|
38
|
+
* weights are positive, every slot is placed (by the layout or as a background), every layout
|
|
39
|
+
* slotId resolves (unresolved ones are warnings — they render as empty areas), and background
|
|
40
|
+
* references resolve to image slots.
|
|
37
41
|
*
|
|
38
42
|
* @alpha
|
|
39
43
|
*/
|
|
40
44
|
export function validateReportPageBody(body) {
|
|
41
45
|
const issues = [];
|
|
46
|
+
if (body.format !== undefined && !isReportPageFormat(body.format)) {
|
|
47
|
+
issues.push({ severity: "error", message: `Unknown page format "${body.format}".` });
|
|
48
|
+
}
|
|
42
49
|
const slotIds = new Set();
|
|
43
50
|
for (const slot of body.slots) {
|
|
44
51
|
if (slotIds.has(slot.localIdentifier)) {
|
|
@@ -49,6 +56,32 @@ export function validateReportPageBody(body) {
|
|
|
49
56
|
}
|
|
50
57
|
slotIds.add(slot.localIdentifier);
|
|
51
58
|
}
|
|
59
|
+
const slotsById = new Map(body.slots.map((slot) => [slot.localIdentifier, slot]));
|
|
60
|
+
const backgroundIds = new Set();
|
|
61
|
+
const checkBackground = (style) => {
|
|
62
|
+
if (!style?.background || !isReportImageBackground(style.background)) {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
const { slotId } = style.background;
|
|
66
|
+
const slot = slotsById.get(slotId);
|
|
67
|
+
if (slot === undefined) {
|
|
68
|
+
issues.push({
|
|
69
|
+
severity: "warning",
|
|
70
|
+
message: `Background references slot "${slotId}" which has no definition; no background renders.`,
|
|
71
|
+
});
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
if (!isReportImageSlot(slot)) {
|
|
75
|
+
issues.push({
|
|
76
|
+
severity: "error",
|
|
77
|
+
message: `Background references slot "${slotId}" which is not an image slot.`,
|
|
78
|
+
});
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
// Only a reference that actually renders counts as placing its slot.
|
|
82
|
+
backgroundIds.add(slotId);
|
|
83
|
+
};
|
|
84
|
+
checkBackground(body.style);
|
|
52
85
|
const referencedIds = new Set();
|
|
53
86
|
const visit = (node) => {
|
|
54
87
|
if (node.weight !== undefined && !(node.weight > 0)) {
|
|
@@ -67,12 +100,13 @@ export function validateReportPageBody(body) {
|
|
|
67
100
|
}
|
|
68
101
|
}
|
|
69
102
|
else if (isReportLayoutSection(node)) {
|
|
103
|
+
checkBackground(node.style);
|
|
70
104
|
node.children.forEach(visit);
|
|
71
105
|
}
|
|
72
106
|
};
|
|
73
107
|
visit(body.layout);
|
|
74
108
|
for (const slotId of slotIds) {
|
|
75
|
-
if (!referencedIds.has(slotId)) {
|
|
109
|
+
if (!referencedIds.has(slotId) && !backgroundIds.has(slotId)) {
|
|
76
110
|
issues.push({
|
|
77
111
|
severity: "warning",
|
|
78
112
|
message: `Slot "${slotId}" is not placed by the layout and never renders.`,
|
package/esm/reports/slot.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type FilterContextItem, type IDashboardFilterReference } from "../dashboard/filterContext.js";
|
|
2
2
|
import { type VisualizationProperties } from "../insight/index.js";
|
|
3
3
|
import { type ObjRef } from "../objRef/index.js";
|
|
4
|
+
import { type IReportImageStyle, type IReportTextStyle } from "./styling.js";
|
|
4
5
|
/**
|
|
5
6
|
* Metadata of a slot that is intentionally left unfilled in a report page or template.
|
|
6
7
|
*
|
|
@@ -134,6 +135,10 @@ export type ReportTextSource = IReportStaticTextSource | IReportAiTextSource;
|
|
|
134
135
|
export interface IReportTextSlot extends IReportSlotBase {
|
|
135
136
|
type: "text";
|
|
136
137
|
kind: ReportTextSlotKind;
|
|
138
|
+
/**
|
|
139
|
+
* Ink and placement overrides on top of the kind's defaults.
|
|
140
|
+
*/
|
|
141
|
+
style?: IReportTextStyle;
|
|
137
142
|
/**
|
|
138
143
|
* Undefined = declared-but-empty slot.
|
|
139
144
|
*/
|
|
@@ -173,6 +178,10 @@ export interface IReportImageSlot extends IReportSlotBase {
|
|
|
173
178
|
* How the image fills the slot area. Defaults to "contain".
|
|
174
179
|
*/
|
|
175
180
|
fit?: "contain" | "cover" | "fill";
|
|
181
|
+
/**
|
|
182
|
+
* Placement overrides for the drawn image; centered on both axes by default.
|
|
183
|
+
*/
|
|
184
|
+
style?: IReportImageStyle;
|
|
176
185
|
}
|
|
177
186
|
/**
|
|
178
187
|
* All slot types of report content version 1.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slot.d.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AAyB,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,wBAAwB,CAEvF;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,eAAe,CAErE;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,gBAAgB,CAEvE;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,UAAU,CAE5D"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where content sits inside the box that carries it, along one axis.
|
|
3
|
+
*
|
|
4
|
+
* @alpha
|
|
5
|
+
*/
|
|
6
|
+
export type ReportContentAlignment = "start" | "center" | "end";
|
|
7
|
+
/**
|
|
8
|
+
* Solid color painted behind a section's or page's content.
|
|
9
|
+
*
|
|
10
|
+
* @alpha
|
|
11
|
+
*/
|
|
12
|
+
export interface IReportColorBackground {
|
|
13
|
+
type: "color";
|
|
14
|
+
/**
|
|
15
|
+
* CSS color value. Absolute: report styling states brand colors directly and does not
|
|
16
|
+
* follow the workspace theme.
|
|
17
|
+
*/
|
|
18
|
+
color: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Image painted behind a section's or page's content.
|
|
22
|
+
*
|
|
23
|
+
* @alpha
|
|
24
|
+
*/
|
|
25
|
+
export interface IReportImageBackground {
|
|
26
|
+
type: "image";
|
|
27
|
+
/**
|
|
28
|
+
* Local identifier of an image slot in {@link IReportPageBody.slots}. Routing the image
|
|
29
|
+
* through a slot keeps it template-fillable and gives it the slot's placeholder metadata.
|
|
30
|
+
* A reference that is missing or resolves to a non-image slot paints no background.
|
|
31
|
+
*/
|
|
32
|
+
slotId: string;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* What a section or page paints behind its content.
|
|
36
|
+
*
|
|
37
|
+
* @alpha
|
|
38
|
+
*/
|
|
39
|
+
export type ReportBackground = IReportColorBackground | IReportImageBackground;
|
|
40
|
+
/**
|
|
41
|
+
* Paint of the box itself. Never affects the geometry of the box or its children —
|
|
42
|
+
* geometry always comes from layout weights.
|
|
43
|
+
*
|
|
44
|
+
* @alpha
|
|
45
|
+
*/
|
|
46
|
+
export interface IReportBoxStyle {
|
|
47
|
+
background?: ReportBackground;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Styling of the text a text slot owns.
|
|
51
|
+
*
|
|
52
|
+
* @remarks
|
|
53
|
+
* Overrides the ink and placement of the slot's {@link ReportTextSlotKind} defaults; the kind
|
|
54
|
+
* keeps owning semantic typography (size and weight).
|
|
55
|
+
*
|
|
56
|
+
* @alpha
|
|
57
|
+
*/
|
|
58
|
+
export interface IReportTextStyle {
|
|
59
|
+
/**
|
|
60
|
+
* CSS color value. Absolute, like {@link IReportColorBackground.color}.
|
|
61
|
+
*/
|
|
62
|
+
color?: string;
|
|
63
|
+
horizontalAlign?: ReportContentAlignment;
|
|
64
|
+
verticalAlign?: ReportContentAlignment;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Where the drawn image sits when it does not fill its box, and which part of it is kept when it
|
|
68
|
+
* is cropped to fill one.
|
|
69
|
+
*
|
|
70
|
+
* @alpha
|
|
71
|
+
*/
|
|
72
|
+
export interface IReportImageStyle {
|
|
73
|
+
horizontalAlign?: ReportContentAlignment;
|
|
74
|
+
verticalAlign?: ReportContentAlignment;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Type-guard testing whether the provided object is an instance of {@link IReportColorBackground}.
|
|
78
|
+
*
|
|
79
|
+
* @alpha
|
|
80
|
+
*/
|
|
81
|
+
export declare function isReportColorBackground(obj: unknown): obj is IReportColorBackground;
|
|
82
|
+
/**
|
|
83
|
+
* Type-guard testing whether the provided object is an instance of {@link IReportImageBackground}.
|
|
84
|
+
*
|
|
85
|
+
* @alpha
|
|
86
|
+
*/
|
|
87
|
+
export declare function isReportImageBackground(obj: unknown): obj is IReportImageBackground;
|
|
88
|
+
//# sourceMappingURL=styling.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styling.d.ts","sourceRoot":"","sources":["../../src/reports/styling.ts"],"names":[],"mappings":"AAIA;;;;GAIG;AACH,MAAM,MAAM,sBAAsB,GAAG,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAC;AAEhE;;;;GAIG;AACH,MAAM,WAAW,sBAAsB;IACnC,IAAI,EAAE,OAAO,CAAC;IAEd;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;CACjB;AAED;;;;GAIG;AACH,MAAM,WAAW,sBAAsB;IACnC,IAAI,EAAE,OAAO,CAAC;IAEd;;;;OAIG;IACH,MAAM,EAAE,MAAM,CAAC;CAClB;AAED;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,GAAG,sBAAsB,GAAG,sBAAsB,CAAC;AAE/E;;;;;GAKG;AACH,MAAM,WAAW,eAAe;IAC5B,UAAU,CAAC,EAAE,gBAAgB,CAAC;CACjC;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,gBAAgB;IAC7B;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,eAAe,CAAC,EAAE,sBAAsB,CAAC;IAEzC,aAAa,CAAC,EAAE,sBAAsB,CAAC;CAC1C;AAED;;;;;GAKG;AACH,MAAM,WAAW,iBAAiB;IAC9B,eAAe,CAAC,EAAE,sBAAsB,CAAC;IAEzC,aAAa,CAAC,EAAE,sBAAsB,CAAC;CAC1C;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,sBAAsB,CAEnF;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,sBAAsB,CAEnF"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// (C) 2026 GoodData Corporation
|
|
2
|
+
import { isEmpty } from "lodash-es";
|
|
3
|
+
/**
|
|
4
|
+
* Type-guard testing whether the provided object is an instance of {@link IReportColorBackground}.
|
|
5
|
+
*
|
|
6
|
+
* @alpha
|
|
7
|
+
*/
|
|
8
|
+
export function isReportColorBackground(obj) {
|
|
9
|
+
return !isEmpty(obj) && obj.type === "color";
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Type-guard testing whether the provided object is an instance of {@link IReportImageBackground}.
|
|
13
|
+
*
|
|
14
|
+
* @alpha
|
|
15
|
+
*/
|
|
16
|
+
export function isReportImageBackground(obj) {
|
|
17
|
+
return !isEmpty(obj) && obj.type === "image";
|
|
18
|
+
}
|