@gooddata/sdk-model 11.62.0-alpha.0 → 11.62.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/genAI/chat.d.ts +9 -9
- package/esm/genAI/chat.d.ts.map +1 -1
- package/esm/index.d.ts +12 -12
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +10 -10
- package/esm/publisher/builtinPageLayouts.d.ts +45 -0
- package/esm/publisher/builtinPageLayouts.d.ts.map +1 -0
- package/esm/{reports → publisher}/builtinPageLayouts.js +19 -19
- package/esm/{reports → publisher}/content.d.ts +20 -20
- package/esm/publisher/content.d.ts.map +1 -0
- package/esm/{reports → publisher}/content.js +2 -2
- package/esm/{reports/report.d.ts → publisher/document.d.ts} +28 -28
- package/esm/publisher/document.d.ts.map +1 -0
- package/esm/{reports/report.js → publisher/document.js} +10 -10
- package/esm/publisher/factory.d.ts +65 -0
- package/esm/publisher/factory.d.ts.map +1 -0
- package/esm/{reports → publisher}/factory.js +22 -22
- package/esm/{reports → publisher}/layout.d.ts +15 -15
- package/esm/publisher/layout.d.ts.map +1 -0
- package/esm/{reports → publisher}/layout.js +4 -4
- package/esm/publisher/pageFormat.d.ts +38 -0
- package/esm/publisher/pageFormat.d.ts.map +1 -0
- package/esm/publisher/pageFormat.js +33 -0
- package/esm/{reports → publisher}/pageLayout.d.ts +28 -28
- package/esm/publisher/pageLayout.d.ts.map +1 -0
- package/esm/{reports → publisher}/pageLayout.js +18 -18
- package/esm/{reports → publisher}/slot.d.ts +48 -48
- package/esm/publisher/slot.d.ts.map +1 -0
- package/esm/publisher/slot.js +87 -0
- package/esm/{reports → publisher}/styling.d.ts +39 -39
- package/esm/publisher/styling.d.ts.map +1 -0
- package/esm/publisher/styling.js +58 -0
- package/esm/publisher/variables.d.ts +72 -0
- package/esm/publisher/variables.d.ts.map +1 -0
- package/esm/{reports → publisher}/variables.js +7 -7
- package/esm/sdk-model.d.ts +889 -858
- package/esm/settings/settings.d.ts +13 -0
- package/esm/settings/settings.d.ts.map +1 -1
- package/esm/theme/index.d.ts +68 -51
- package/esm/theme/index.d.ts.map +1 -1
- package/package.json +3 -3
- package/esm/reports/builtinPageLayouts.d.ts +0 -45
- package/esm/reports/builtinPageLayouts.d.ts.map +0 -1
- package/esm/reports/content.d.ts.map +0 -1
- package/esm/reports/factory.d.ts +0 -65
- package/esm/reports/factory.d.ts.map +0 -1
- package/esm/reports/layout.d.ts.map +0 -1
- package/esm/reports/pageFormat.d.ts +0 -38
- package/esm/reports/pageFormat.d.ts.map +0 -1
- package/esm/reports/pageFormat.js +0 -33
- package/esm/reports/pageLayout.d.ts.map +0 -1
- package/esm/reports/report.d.ts.map +0 -1
- package/esm/reports/slot.d.ts.map +0 -1
- package/esm/reports/slot.js +0 -87
- package/esm/reports/styling.d.ts.map +0 -1
- package/esm/reports/styling.js +0 -58
- package/esm/reports/variables.d.ts +0 -72
- package/esm/reports/variables.d.ts.map +0 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { type IAuditableDates, type IAuditableUsers } from "../base/metadata.js";
|
|
2
2
|
import { type ObjRef } from "../objRef/index.js";
|
|
3
|
-
import { type
|
|
4
|
-
import { type
|
|
3
|
+
import { type IPublisherDocumentContent } from "./content.js";
|
|
4
|
+
import { type PublisherDateString } from "./variables.js";
|
|
5
5
|
/**
|
|
6
|
-
* Payload for creating or updating a
|
|
6
|
+
* Payload for creating or updating a document template.
|
|
7
7
|
*
|
|
8
8
|
* @alpha
|
|
9
9
|
*/
|
|
10
|
-
export interface
|
|
10
|
+
export interface IPublisherDocumentTemplateDefinition {
|
|
11
11
|
type: "reportTemplate";
|
|
12
12
|
/**
|
|
13
13
|
* Present when updating an existing template.
|
|
@@ -16,14 +16,14 @@ export interface IReportTemplateDefinition {
|
|
|
16
16
|
title: string;
|
|
17
17
|
description?: string;
|
|
18
18
|
tags?: string[];
|
|
19
|
-
content:
|
|
19
|
+
content: IPublisherDocumentContent;
|
|
20
20
|
}
|
|
21
21
|
/**
|
|
22
|
-
*
|
|
22
|
+
* Document template metadata object.
|
|
23
23
|
*
|
|
24
24
|
* @alpha
|
|
25
25
|
*/
|
|
26
|
-
export interface
|
|
26
|
+
export interface IPublisherDocumentTemplate extends IPublisherDocumentTemplateDefinition, IAuditableDates, IAuditableUsers {
|
|
27
27
|
ref: ObjRef;
|
|
28
28
|
/**
|
|
29
29
|
* When true, the object comes from a parent workspace and is not editable
|
|
@@ -32,11 +32,11 @@ export interface IReportTemplate extends IReportTemplateDefinition, IAuditableDa
|
|
|
32
32
|
isLocked?: boolean;
|
|
33
33
|
}
|
|
34
34
|
/**
|
|
35
|
-
* Fields shared by
|
|
35
|
+
* Fields shared by document definitions and persisted documents.
|
|
36
36
|
*
|
|
37
37
|
* @alpha
|
|
38
38
|
*/
|
|
39
|
-
export interface
|
|
39
|
+
export interface IPublisherDocumentBase {
|
|
40
40
|
title: string;
|
|
41
41
|
description?: string;
|
|
42
42
|
tags?: string[];
|
|
@@ -48,40 +48,40 @@ export interface IReportBase {
|
|
|
48
48
|
* visualization slot's dateDataSet (lowest precedence, per-slot opt-out via
|
|
49
49
|
* ignoreReportPeriod). Also available as `{periodStart}` in text.
|
|
50
50
|
*/
|
|
51
|
-
periodStart:
|
|
51
|
+
periodStart: PublisherDateString;
|
|
52
52
|
/**
|
|
53
53
|
* Reported period end, ISO 8601 date (YYYY-MM-DD), inclusive.
|
|
54
54
|
*/
|
|
55
|
-
periodEnd:
|
|
55
|
+
periodEnd: PublisherDateString;
|
|
56
56
|
/**
|
|
57
|
-
* Content of the
|
|
58
|
-
* and NO reference to the template is kept — the
|
|
57
|
+
* Content of the document. When created from a template the content is deep-copied
|
|
58
|
+
* and NO reference to the template is kept — the document stays frozen while pages
|
|
59
59
|
* and templates evolve.
|
|
60
60
|
*/
|
|
61
|
-
content:
|
|
61
|
+
content: IPublisherDocumentContent;
|
|
62
62
|
/**
|
|
63
63
|
* Values for variables declared in content.variables, keyed by variable name.
|
|
64
64
|
*/
|
|
65
65
|
variableValues?: Record<string, string>;
|
|
66
66
|
}
|
|
67
67
|
/**
|
|
68
|
-
* Payload for creating or updating a
|
|
68
|
+
* Payload for creating or updating a document.
|
|
69
69
|
*
|
|
70
70
|
* @alpha
|
|
71
71
|
*/
|
|
72
|
-
export interface
|
|
72
|
+
export interface IPublisherDocumentDefinition extends IPublisherDocumentBase {
|
|
73
73
|
type: "report";
|
|
74
74
|
/**
|
|
75
|
-
* Present when updating an existing
|
|
75
|
+
* Present when updating an existing document.
|
|
76
76
|
*/
|
|
77
77
|
ref?: ObjRef;
|
|
78
78
|
}
|
|
79
79
|
/**
|
|
80
|
-
*
|
|
80
|
+
* Document metadata object.
|
|
81
81
|
*
|
|
82
82
|
* @alpha
|
|
83
83
|
*/
|
|
84
|
-
export interface
|
|
84
|
+
export interface IPublisherDocument extends IPublisherDocumentDefinition, IAuditableDates, IAuditableUsers {
|
|
85
85
|
ref: ObjRef;
|
|
86
86
|
/**
|
|
87
87
|
* When true, the object comes from a parent workspace and is not editable
|
|
@@ -90,27 +90,27 @@ export interface IReport extends IReportDefinition, IAuditableDates, IAuditableU
|
|
|
90
90
|
isLocked?: boolean;
|
|
91
91
|
}
|
|
92
92
|
/**
|
|
93
|
-
* Type-guard testing whether the provided object is an instance of {@link
|
|
93
|
+
* Type-guard testing whether the provided object is an instance of {@link IPublisherDocumentTemplateDefinition}.
|
|
94
94
|
*
|
|
95
95
|
* @alpha
|
|
96
96
|
*/
|
|
97
|
-
export declare function
|
|
97
|
+
export declare function isPublisherDocumentTemplateDefinition(obj: unknown): obj is IPublisherDocumentTemplateDefinition;
|
|
98
98
|
/**
|
|
99
|
-
* Type-guard testing whether the provided object is an instance of {@link
|
|
99
|
+
* Type-guard testing whether the provided object is an instance of {@link IPublisherDocumentTemplate}.
|
|
100
100
|
*
|
|
101
101
|
* @alpha
|
|
102
102
|
*/
|
|
103
|
-
export declare function
|
|
103
|
+
export declare function isPublisherDocumentTemplate(obj: unknown): obj is IPublisherDocumentTemplate;
|
|
104
104
|
/**
|
|
105
|
-
* Type-guard testing whether the provided object is an instance of {@link
|
|
105
|
+
* Type-guard testing whether the provided object is an instance of {@link IPublisherDocumentDefinition}.
|
|
106
106
|
*
|
|
107
107
|
* @alpha
|
|
108
108
|
*/
|
|
109
|
-
export declare function
|
|
109
|
+
export declare function isPublisherDocumentDefinition(obj: unknown): obj is IPublisherDocumentDefinition;
|
|
110
110
|
/**
|
|
111
|
-
* Type-guard testing whether the provided object is an instance of {@link
|
|
111
|
+
* Type-guard testing whether the provided object is an instance of {@link IPublisherDocument}.
|
|
112
112
|
*
|
|
113
113
|
* @alpha
|
|
114
114
|
*/
|
|
115
|
-
export declare function
|
|
116
|
-
//# sourceMappingURL=
|
|
115
|
+
export declare function isPublisherDocument(obj: unknown): obj is IPublisherDocument;
|
|
116
|
+
//# sourceMappingURL=document.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"document.d.ts","sourceRoot":"","sources":["../../src/publisher/document.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,eAAe,EAAE,KAAK,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACjF,OAAO,EAAE,KAAK,MAAM,EAAY,MAAM,oBAAoB,CAAC;AAE3D,OAAO,EAAE,KAAK,yBAAyB,EAAE,MAAM,cAAc,CAAC;AAC9D,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAE1D;;;;GAIG;AACH,MAAM,WAAW,oCAAoC;IACjD,IAAI,EAAE,gBAAgB,CAAC;IAEvB;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb,KAAK,EAAE,MAAM,CAAC;IAEd,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAEhB,OAAO,EAAE,yBAAyB,CAAC;CACtC;AAED;;;;GAIG;AACH,MAAM,WAAW,0BACb,SAAQ,oCAAoC,E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es";
|
|
3
3
|
import { isObjRef } from "../objRef/index.js";
|
|
4
4
|
/**
|
|
5
|
-
* Type-guard testing whether the provided object is an instance of {@link
|
|
5
|
+
* Type-guard testing whether the provided object is an instance of {@link IPublisherDocumentTemplateDefinition}.
|
|
6
6
|
*
|
|
7
7
|
* @alpha
|
|
8
8
|
*/
|
|
9
|
-
export function
|
|
9
|
+
export function isPublisherDocumentTemplateDefinition(obj) {
|
|
10
10
|
return !isEmpty(obj) && obj.type === "reportTemplate";
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
|
-
* Type-guard testing whether the provided object is an instance of {@link
|
|
13
|
+
* Type-guard testing whether the provided object is an instance of {@link IPublisherDocumentTemplate}.
|
|
14
14
|
*
|
|
15
15
|
* @alpha
|
|
16
16
|
*/
|
|
17
|
-
export function
|
|
18
|
-
return
|
|
17
|
+
export function isPublisherDocumentTemplate(obj) {
|
|
18
|
+
return isPublisherDocumentTemplateDefinition(obj) && isObjRef(obj.ref);
|
|
19
19
|
}
|
|
20
20
|
/**
|
|
21
|
-
* Type-guard testing whether the provided object is an instance of {@link
|
|
21
|
+
* Type-guard testing whether the provided object is an instance of {@link IPublisherDocumentDefinition}.
|
|
22
22
|
*
|
|
23
23
|
* @alpha
|
|
24
24
|
*/
|
|
25
|
-
export function
|
|
25
|
+
export function isPublisherDocumentDefinition(obj) {
|
|
26
26
|
return !isEmpty(obj) && obj.type === "report";
|
|
27
27
|
}
|
|
28
28
|
/**
|
|
29
|
-
* Type-guard testing whether the provided object is an instance of {@link
|
|
29
|
+
* Type-guard testing whether the provided object is an instance of {@link IPublisherDocument}.
|
|
30
30
|
*
|
|
31
31
|
* @alpha
|
|
32
32
|
*/
|
|
33
|
-
export function
|
|
34
|
-
return
|
|
33
|
+
export function isPublisherDocument(obj) {
|
|
34
|
+
return isPublisherDocumentDefinition(obj) && isObjRef(obj.ref);
|
|
35
35
|
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { type IPublisherDocumentContent, type IPublisherDocumentPage } from "./content.js";
|
|
2
|
+
import { type IPublisherDocument, type IPublisherDocumentDefinition, type IPublisherDocumentTemplate, type IPublisherDocumentTemplateDefinition } from "./document.js";
|
|
3
|
+
import { type IPublisherPageBody, type IPublisherPageLayout, type IPublisherPageLayoutDefinition } from "./pageLayout.js";
|
|
4
|
+
import { type PublisherDateString } from "./variables.js";
|
|
5
|
+
/**
|
|
6
|
+
* Creates a new page layout definition.
|
|
7
|
+
*
|
|
8
|
+
* @alpha
|
|
9
|
+
*/
|
|
10
|
+
export declare function newPublisherPageLayoutDefinition(title: string, body: IPublisherPageBody, modifications?: Partial<Omit<IPublisherPageLayoutDefinition, "type" | "title" | "content">>): IPublisherPageLayoutDefinition;
|
|
11
|
+
/**
|
|
12
|
+
* Clones a page layout into a page instance embeddable in template/document content.
|
|
13
|
+
*
|
|
14
|
+
* @remarks
|
|
15
|
+
* The body is deep-copied and detached from the source page — no reference is kept.
|
|
16
|
+
* Slot localIdentifiers (and the layout slotIds pointing at them) are prefixed with the
|
|
17
|
+
* page-instance localIdentifier, so one page used repeatedly in the same content stays unique.
|
|
18
|
+
*
|
|
19
|
+
* @alpha
|
|
20
|
+
*/
|
|
21
|
+
export declare function newPublisherDocumentPageFromLayout(page: IPublisherPageLayout | IPublisherPageLayoutDefinition, localIdentifier?: string): IPublisherDocumentPage;
|
|
22
|
+
/**
|
|
23
|
+
* Creates document content from page instances.
|
|
24
|
+
*
|
|
25
|
+
* @alpha
|
|
26
|
+
*/
|
|
27
|
+
export declare function newPublisherDocumentContent(pages: IPublisherDocumentPage[], modifications?: Partial<Omit<IPublisherDocumentContent, "version" | "pages">>): IPublisherDocumentContent;
|
|
28
|
+
/**
|
|
29
|
+
* Creates a new document template definition.
|
|
30
|
+
*
|
|
31
|
+
* @alpha
|
|
32
|
+
*/
|
|
33
|
+
export declare function newPublisherDocumentTemplateDefinition(title: string, content: IPublisherDocumentContent, modifications?: Partial<Omit<IPublisherDocumentTemplateDefinition, "type" | "title" | "content">>): IPublisherDocumentTemplateDefinition;
|
|
34
|
+
/**
|
|
35
|
+
* Creates a document definition from a template.
|
|
36
|
+
*
|
|
37
|
+
* @remarks
|
|
38
|
+
* The template content is deep-copied; no reference to the template is kept, so the
|
|
39
|
+
* document stays frozen while the template evolves.
|
|
40
|
+
*
|
|
41
|
+
* @alpha
|
|
42
|
+
*/
|
|
43
|
+
export declare function newPublisherDocumentDefinitionFromTemplate(template: IPublisherDocumentTemplate | IPublisherDocumentTemplateDefinition, options: {
|
|
44
|
+
title: string;
|
|
45
|
+
periodStart: PublisherDateString;
|
|
46
|
+
periodEnd: PublisherDateString;
|
|
47
|
+
}, modifications?: Partial<Omit<IPublisherDocumentDefinition, "type" | "title" | "periodStart" | "periodEnd" | "content">>): IPublisherDocumentDefinition;
|
|
48
|
+
/**
|
|
49
|
+
* Creates an ad-hoc document definition not based on any template.
|
|
50
|
+
*
|
|
51
|
+
* @alpha
|
|
52
|
+
*/
|
|
53
|
+
export declare function newAdHocPublisherDocumentDefinition(options: {
|
|
54
|
+
title: string;
|
|
55
|
+
periodStart: PublisherDateString;
|
|
56
|
+
periodEnd: PublisherDateString;
|
|
57
|
+
pages?: IPublisherDocumentPage[];
|
|
58
|
+
}, modifications?: Partial<Omit<IPublisherDocumentDefinition, "type" | "title" | "periodStart" | "periodEnd" | "content">>): IPublisherDocumentDefinition;
|
|
59
|
+
/**
|
|
60
|
+
* Convenience accessor for a document or template page by its localIdentifier.
|
|
61
|
+
*
|
|
62
|
+
* @alpha
|
|
63
|
+
*/
|
|
64
|
+
export declare function publisherDocumentPage(documentOrTemplate: IPublisherDocument | IPublisherDocumentDefinition | IPublisherDocumentTemplate | IPublisherDocumentTemplateDefinition, pageLocalIdentifier: string): IPublisherDocumentPage | undefined;
|
|
65
|
+
//# sourceMappingURL=factory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../src/publisher/factory.ts"],"names":[],"mappings":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CAAC;IACd,WAAW,EAAE,mBAAmB,CAAC;IACjC,SAAS,EAAE,mBAAmB,CAAC;CAClC,EACD,aAAa,CAAC,EAAE,OAAO,CACnB,IAAI,CAAC,4BAA4B,EAAE,MAAM,GAAG,OAAO,GAAG,aAAa,GAAG,WAAW,GAAG,SAAS,CAAC,CACjG,GACF,4BAA4B,CAS9B;AAED;;;;GAIG;AACH,wBAAgB,mCAAmC,CAC/C,OAAO,EAAE;IACL,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,mBAAmB,CAAC;IACjC,SAAS,EAAE,mBAAmB,CAAC;IAC/B,KAAK,CAAC,EAAE,sBAAsB,EAAE,CAAC;CACpC,EACD,aAAa,CAAC,EAAE,OAAO,CACnB,IAAI,CAAC,4BAA4B,EAAE,MAAM,GAAG,OAAO,GAAG,aAAa,GAAG,WAAW,GAAG,SAAS,CAAC,CACjG,GACF,4BAA4B,CAS9B;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CACjC,kBAAkB,EACZ,kBAAkB,GAClB,4BAA4B,GAC5B,0BAA0B,GAC1B,oCAAoC,EAC1C,mBAAmB,EAAE,MAAM,GAC5B,sBAAsB,GAAG,SAAS,CAEpC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// (C) 2026 GoodData Corporation
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
function
|
|
2
|
+
import { isPublisherLayoutSection } from "./layout.js";
|
|
3
|
+
import { isPublisherImageBackground } from "./styling.js";
|
|
4
|
+
function generatePublisherLocalId(prefix) {
|
|
5
5
|
const unique = typeof crypto !== "undefined" && typeof crypto.randomUUID === "function"
|
|
6
6
|
? crypto.randomUUID().replace(/-/g, "").slice(0, 12)
|
|
7
7
|
: Math.random().toString(36).slice(2, 14);
|
|
@@ -11,7 +11,7 @@ function deepClone(value) {
|
|
|
11
11
|
return JSON.parse(JSON.stringify(value));
|
|
12
12
|
}
|
|
13
13
|
function prefixBackgroundSlotId(style, prefix) {
|
|
14
|
-
if (!style?.background || !
|
|
14
|
+
if (!style?.background || !isPublisherImageBackground(style.background)) {
|
|
15
15
|
return style;
|
|
16
16
|
}
|
|
17
17
|
return {
|
|
@@ -20,7 +20,7 @@ function prefixBackgroundSlotId(style, prefix) {
|
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
22
|
function prefixLayoutSlotIds(node, prefix) {
|
|
23
|
-
if (
|
|
23
|
+
if (isPublisherLayoutSection(node)) {
|
|
24
24
|
return {
|
|
25
25
|
...node,
|
|
26
26
|
...(node.style === undefined ? {} : { style: prefixBackgroundSlotId(node.style, prefix) }),
|
|
@@ -33,11 +33,11 @@ function prefixLayoutSlotIds(node, prefix) {
|
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
35
|
/**
|
|
36
|
-
* Creates a new
|
|
36
|
+
* Creates a new page layout definition.
|
|
37
37
|
*
|
|
38
38
|
* @alpha
|
|
39
39
|
*/
|
|
40
|
-
export function
|
|
40
|
+
export function newPublisherPageLayoutDefinition(title, body, modifications) {
|
|
41
41
|
const content = { version: "1", ...body };
|
|
42
42
|
return {
|
|
43
43
|
type: "reportPageLayout",
|
|
@@ -47,7 +47,7 @@ export function newReportPageLayoutDefinition(title, body, modifications) {
|
|
|
47
47
|
};
|
|
48
48
|
}
|
|
49
49
|
/**
|
|
50
|
-
* Clones a
|
|
50
|
+
* Clones a page layout into a page instance embeddable in template/document content.
|
|
51
51
|
*
|
|
52
52
|
* @remarks
|
|
53
53
|
* The body is deep-copied and detached from the source page — no reference is kept.
|
|
@@ -56,7 +56,7 @@ export function newReportPageLayoutDefinition(title, body, modifications) {
|
|
|
56
56
|
*
|
|
57
57
|
* @alpha
|
|
58
58
|
*/
|
|
59
|
-
export function
|
|
59
|
+
export function newPublisherDocumentPageFromLayout(page, localIdentifier = generatePublisherLocalId("page")) {
|
|
60
60
|
const { version: _version, ...body } = deepClone(page.content);
|
|
61
61
|
return {
|
|
62
62
|
...body,
|
|
@@ -70,11 +70,11 @@ export function newReportContentPageFromLayout(page, localIdentifier = generateR
|
|
|
70
70
|
};
|
|
71
71
|
}
|
|
72
72
|
/**
|
|
73
|
-
* Creates
|
|
73
|
+
* Creates document content from page instances.
|
|
74
74
|
*
|
|
75
75
|
* @alpha
|
|
76
76
|
*/
|
|
77
|
-
export function
|
|
77
|
+
export function newPublisherDocumentContent(pages, modifications) {
|
|
78
78
|
return {
|
|
79
79
|
version: "1",
|
|
80
80
|
pages,
|
|
@@ -82,11 +82,11 @@ export function newReportContent(pages, modifications) {
|
|
|
82
82
|
};
|
|
83
83
|
}
|
|
84
84
|
/**
|
|
85
|
-
* Creates a new
|
|
85
|
+
* Creates a new document template definition.
|
|
86
86
|
*
|
|
87
87
|
* @alpha
|
|
88
88
|
*/
|
|
89
|
-
export function
|
|
89
|
+
export function newPublisherDocumentTemplateDefinition(title, content, modifications) {
|
|
90
90
|
return {
|
|
91
91
|
type: "reportTemplate",
|
|
92
92
|
title,
|
|
@@ -95,15 +95,15 @@ export function newReportTemplateDefinition(title, content, modifications) {
|
|
|
95
95
|
};
|
|
96
96
|
}
|
|
97
97
|
/**
|
|
98
|
-
* Creates a
|
|
98
|
+
* Creates a document definition from a template.
|
|
99
99
|
*
|
|
100
100
|
* @remarks
|
|
101
101
|
* The template content is deep-copied; no reference to the template is kept, so the
|
|
102
|
-
*
|
|
102
|
+
* document stays frozen while the template evolves.
|
|
103
103
|
*
|
|
104
104
|
* @alpha
|
|
105
105
|
*/
|
|
106
|
-
export function
|
|
106
|
+
export function newPublisherDocumentDefinitionFromTemplate(template, options, modifications) {
|
|
107
107
|
return {
|
|
108
108
|
type: "report",
|
|
109
109
|
title: options.title,
|
|
@@ -114,25 +114,25 @@ export function newReportDefinitionFromTemplate(template, options, modifications
|
|
|
114
114
|
};
|
|
115
115
|
}
|
|
116
116
|
/**
|
|
117
|
-
* Creates an ad-hoc
|
|
117
|
+
* Creates an ad-hoc document definition not based on any template.
|
|
118
118
|
*
|
|
119
119
|
* @alpha
|
|
120
120
|
*/
|
|
121
|
-
export function
|
|
121
|
+
export function newAdHocPublisherDocumentDefinition(options, modifications) {
|
|
122
122
|
return {
|
|
123
123
|
type: "report",
|
|
124
124
|
title: options.title,
|
|
125
125
|
periodStart: options.periodStart,
|
|
126
126
|
periodEnd: options.periodEnd,
|
|
127
|
-
content:
|
|
127
|
+
content: newPublisherDocumentContent(options.pages ?? []),
|
|
128
128
|
...modifications,
|
|
129
129
|
};
|
|
130
130
|
}
|
|
131
131
|
/**
|
|
132
|
-
* Convenience accessor for a
|
|
132
|
+
* Convenience accessor for a document or template page by its localIdentifier.
|
|
133
133
|
*
|
|
134
134
|
* @alpha
|
|
135
135
|
*/
|
|
136
|
-
export function
|
|
137
|
-
return
|
|
136
|
+
export function publisherDocumentPage(documentOrTemplate, pageLocalIdentifier) {
|
|
137
|
+
return documentOrTemplate.content.pages.find((page) => page.localIdentifier === pageLocalIdentifier);
|
|
138
138
|
}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type IPublisherBoxStyle } from "./styling.js";
|
|
2
2
|
/**
|
|
3
|
-
* Node of a
|
|
3
|
+
* Node of a page layout: a recursive row/column split tree (flexbox semantics)
|
|
4
4
|
* over a fixed page. Leaves assign their area to slots; the tree carries geometry and
|
|
5
|
-
* box paint, slot content lives in {@link
|
|
5
|
+
* box paint, slot content lives in {@link IPublisherPageBody.slots}.
|
|
6
6
|
*
|
|
7
7
|
* @alpha
|
|
8
8
|
*/
|
|
9
|
-
export type
|
|
9
|
+
export type PublisherPageLayoutNode = IPublisherLayoutSection | IPublisherLayoutSlotRef;
|
|
10
10
|
/**
|
|
11
|
-
* Fields common to all
|
|
11
|
+
* Fields common to all page layout nodes.
|
|
12
12
|
*
|
|
13
13
|
* @alpha
|
|
14
14
|
*/
|
|
15
|
-
export interface
|
|
15
|
+
export interface IPublisherLayoutNodeBase {
|
|
16
16
|
/**
|
|
17
17
|
* Fractional weight of this node inside its parent (flex-grow semantics).
|
|
18
18
|
* Defaults to 1. Example: sibling weights [2, 1] render a 2/3 + 1/3 split.
|
|
@@ -24,41 +24,41 @@ export interface IReportLayoutNodeBase {
|
|
|
24
24
|
*
|
|
25
25
|
* @alpha
|
|
26
26
|
*/
|
|
27
|
-
export interface
|
|
27
|
+
export interface IPublisherLayoutSection extends IPublisherLayoutNodeBase {
|
|
28
28
|
type: "section";
|
|
29
29
|
/**
|
|
30
30
|
* "row" lays children out horizontally, "column" vertically.
|
|
31
31
|
*/
|
|
32
32
|
direction: "row" | "column";
|
|
33
|
-
children:
|
|
33
|
+
children: PublisherPageLayoutNode[];
|
|
34
34
|
/**
|
|
35
35
|
* Paint of this section's box. Never affects how children are laid out.
|
|
36
36
|
*/
|
|
37
|
-
style?:
|
|
37
|
+
style?: IPublisherBoxStyle;
|
|
38
38
|
}
|
|
39
39
|
/**
|
|
40
40
|
* A leaf assigning its area to a slot. The slot fills the area completely.
|
|
41
41
|
*
|
|
42
42
|
* @alpha
|
|
43
43
|
*/
|
|
44
|
-
export interface
|
|
44
|
+
export interface IPublisherLayoutSlotRef extends IPublisherLayoutNodeBase {
|
|
45
45
|
type: "slotRef";
|
|
46
46
|
/**
|
|
47
|
-
* Local identifier of a slot in {@link
|
|
47
|
+
* Local identifier of a slot in {@link IPublisherPageBody.slots}.
|
|
48
48
|
* A slotId with no matching slot renders as an empty area.
|
|
49
49
|
*/
|
|
50
50
|
slotId: string;
|
|
51
51
|
}
|
|
52
52
|
/**
|
|
53
|
-
* Type-guard testing whether the provided object is an instance of {@link
|
|
53
|
+
* Type-guard testing whether the provided object is an instance of {@link IPublisherLayoutSection}.
|
|
54
54
|
*
|
|
55
55
|
* @alpha
|
|
56
56
|
*/
|
|
57
|
-
export declare function
|
|
57
|
+
export declare function isPublisherLayoutSection(obj: unknown): obj is IPublisherLayoutSection;
|
|
58
58
|
/**
|
|
59
|
-
* Type-guard testing whether the provided object is an instance of {@link
|
|
59
|
+
* Type-guard testing whether the provided object is an instance of {@link IPublisherLayoutSlotRef}.
|
|
60
60
|
*
|
|
61
61
|
* @alpha
|
|
62
62
|
*/
|
|
63
|
-
export declare function
|
|
63
|
+
export declare function isPublisherLayoutSlotRef(obj: unknown): obj is IPublisherLayoutSlotRef;
|
|
64
64
|
//# sourceMappingURL=layout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../src/publisher/layout.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAEvD;;;;;;GAMG;AACH,MAAM,MAAM,uBAAuB,GAAG,uBAAuB,GAAG,uBAAuB,CAAC;AAExF;;;;GAIG;AACH,MAAM,WAAW,wBAAwB;IACrC;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;;GAIG;AACH,MAAM,WAAW,uBAAwB,SAAQ,wBAAwB;IACrE,IAAI,EAAE,SAAS,CAAC;IAEhB;;OAEG;IACH,SAAS,EAAE,KAAK,GAAG,QAAQ,CAAC;IAE5B,QAAQ,EAAE,uBAAuB,EAAE,CAAC;IAEpC;;OAEG;IACH,KAAK,CAAC,EAAE,kBAAkB,CAAC;CAC9B;AAED;;;;GAIG;AACH,MAAM,WAAW,uBAAwB,SAAQ,wBAAwB;IACrE,IAAI,EAAE,SAAS,CAAC;IAEhB;;;OAGG;IACH,MAAM,EAAE,MAAM,CAAC;CAClB;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,uBAAuB,CAErF;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,uBAAuB,CAErF"}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
// (C) 2026 GoodData Corporation
|
|
2
2
|
import { isEmpty } from "lodash-es";
|
|
3
3
|
/**
|
|
4
|
-
* Type-guard testing whether the provided object is an instance of {@link
|
|
4
|
+
* Type-guard testing whether the provided object is an instance of {@link IPublisherLayoutSection}.
|
|
5
5
|
*
|
|
6
6
|
* @alpha
|
|
7
7
|
*/
|
|
8
|
-
export function
|
|
8
|
+
export function isPublisherLayoutSection(obj) {
|
|
9
9
|
return !isEmpty(obj) && obj.type === "section";
|
|
10
10
|
}
|
|
11
11
|
/**
|
|
12
|
-
* Type-guard testing whether the provided object is an instance of {@link
|
|
12
|
+
* Type-guard testing whether the provided object is an instance of {@link IPublisherLayoutSlotRef}.
|
|
13
13
|
*
|
|
14
14
|
* @alpha
|
|
15
15
|
*/
|
|
16
|
-
export function
|
|
16
|
+
export function isPublisherLayoutSlotRef(obj) {
|
|
17
17
|
return !isEmpty(obj) && obj.type === "slotRef";
|
|
18
18
|
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Page shape a 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 page 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 PublisherPageFormat = "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 DefaultPublisherPageFormat: PublisherPageFormat;
|
|
19
|
+
/**
|
|
20
|
+
* List of built-in page format names.
|
|
21
|
+
*
|
|
22
|
+
* @alpha
|
|
23
|
+
*/
|
|
24
|
+
export declare const PublisherPageFormats: PublisherPageFormat[];
|
|
25
|
+
/**
|
|
26
|
+
* Width divided by height for each page format: 16:9 for a widescreen page, ISO A4 (210 x 297 mm) and
|
|
27
|
+
* US Letter (8.5 x 11 in) upright.
|
|
28
|
+
*
|
|
29
|
+
* @alpha
|
|
30
|
+
*/
|
|
31
|
+
export declare const PublisherPageFormatAspectRatios: Record<PublisherPageFormat, number>;
|
|
32
|
+
/**
|
|
33
|
+
* Type-guard testing whether the provided value is a {@link PublisherPageFormat}.
|
|
34
|
+
*
|
|
35
|
+
* @alpha
|
|
36
|
+
*/
|
|
37
|
+
export declare function isPublisherPageFormat(value: unknown): value is PublisherPageFormat;
|
|
38
|
+
//# sourceMappingURL=pageFormat.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pageFormat.d.ts","sourceRoot":"","sources":["../../src/publisher/pageFormat.ts"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AACH,MAAM,MAAM,mBAAmB,GAAG,YAAY,GAAG,YAAY,GAAG,gBAAgB,CAAC;AAEjF;;;;;GAKG;AACH,eAAO,MAAM,0BAA0B,EAAE,mBAAkC,CAAC;AAE5E;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,EAAE,mBAAmB,EAAmD,CAAC;AAE1G;;;;;GAKG;AACH,eAAO,MAAM,+BAA+B,EAAE,MAAM,CAAC,mBAAmB,EAAE,MAAM,CAI/E,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,mBAAmB,CAElF"}
|
|
@@ -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 DefaultPublisherPageFormat = "widescreen";
|
|
9
|
+
/**
|
|
10
|
+
* List of built-in page format names.
|
|
11
|
+
*
|
|
12
|
+
* @alpha
|
|
13
|
+
*/
|
|
14
|
+
export const PublisherPageFormats = ["widescreen", "a4Portrait", "letterPortrait"];
|
|
15
|
+
/**
|
|
16
|
+
* Width divided by height for each page format: 16:9 for a widescreen page, ISO A4 (210 x 297 mm) and
|
|
17
|
+
* US Letter (8.5 x 11 in) upright.
|
|
18
|
+
*
|
|
19
|
+
* @alpha
|
|
20
|
+
*/
|
|
21
|
+
export const PublisherPageFormatAspectRatios = {
|
|
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 PublisherPageFormat}.
|
|
28
|
+
*
|
|
29
|
+
* @alpha
|
|
30
|
+
*/
|
|
31
|
+
export function isPublisherPageFormat(value) {
|
|
32
|
+
return typeof value === "string" && PublisherPageFormats.includes(value);
|
|
33
|
+
}
|