@gooddata/sdk-model 11.62.0-alpha.2 → 11.62.0-alpha.4
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/dashboard/filterContext.d.ts +1 -1
- package/esm/dashboard/filterContext.d.ts.map +1 -1
- package/esm/dashboard/filterContext.js +2 -2
- package/esm/dashboard/filterConverters.d.ts.map +1 -1
- package/esm/dashboard/filterConverters.js +10 -2
- package/esm/execution/filter/factory.d.ts +35 -0
- package/esm/execution/filter/factory.d.ts.map +1 -1
- package/esm/execution/filter/factory.js +5 -11
- package/esm/execution/filter/index.d.ts +13 -0
- package/esm/execution/filter/index.d.ts.map +1 -1
- package/esm/execution/filter/index.js +2 -0
- package/esm/execution/objectFactoryNotation/index.d.ts.map +1 -1
- package/esm/execution/objectFactoryNotation/index.js +16 -5
- package/esm/genAI/chat.d.ts +3 -2
- package/esm/genAI/chat.d.ts.map +1 -1
- package/esm/index.d.ts +23 -12
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +20 -10
- package/esm/publisher/aliases.d.ts +580 -0
- package/esm/publisher/aliases.d.ts.map +1 -0
- package/esm/publisher/aliases.js +304 -0
- package/esm/publisher/v1/builtinPageLayouts.d.ts +45 -0
- package/esm/publisher/v1/builtinPageLayouts.d.ts.map +1 -0
- package/esm/publisher/{builtinPageLayouts.js → v1/builtinPageLayouts.js} +14 -14
- package/esm/publisher/{content.d.ts → v1/content.d.ts} +14 -14
- package/esm/publisher/v1/content.d.ts.map +1 -0
- package/esm/publisher/{content.js → v1/content.js} +1 -1
- package/esm/publisher/{document.d.ts → v1/document.d.ts} +21 -21
- package/esm/publisher/v1/document.d.ts.map +1 -0
- package/esm/publisher/v1/document.js +35 -0
- package/esm/publisher/v1/factory.d.ts +65 -0
- package/esm/publisher/v1/factory.d.ts.map +1 -0
- package/esm/publisher/{factory.js → v1/factory.js} +12 -12
- package/esm/publisher/{layout.d.ts → v1/layout.d.ts} +13 -13
- package/esm/publisher/v1/layout.d.ts.map +1 -0
- package/esm/publisher/{layout.js → v1/layout.js} +4 -4
- package/esm/publisher/{pageFormat.d.ts → v1/pageFormat.d.ts} +6 -6
- package/esm/publisher/v1/pageFormat.d.ts.map +1 -0
- package/esm/publisher/{pageFormat.js → v1/pageFormat.js} +6 -6
- package/esm/publisher/{pageLayout.d.ts → v1/pageLayout.d.ts} +27 -27
- package/esm/publisher/v1/pageLayout.d.ts.map +1 -0
- package/esm/publisher/{pageLayout.js → v1/pageLayout.js} +18 -18
- package/esm/publisher/{slot.d.ts → v1/slot.d.ts} +41 -41
- package/esm/publisher/v1/slot.d.ts.map +1 -0
- package/esm/publisher/v1/slot.js +90 -0
- package/esm/publisher/{styling.d.ts → v1/styling.d.ts} +36 -36
- package/esm/publisher/v1/styling.d.ts.map +1 -0
- package/esm/publisher/{styling.js → v1/styling.js} +14 -14
- package/esm/publisher/{variables.d.ts → v1/variables.d.ts} +10 -10
- package/esm/publisher/v1/variables.d.ts.map +1 -0
- package/esm/publisher/{variables.js → v1/variables.js} +4 -4
- package/esm/publisher/v2/checks.d.ts +58 -0
- package/esm/publisher/v2/checks.d.ts.map +1 -0
- package/esm/publisher/v2/checks.js +100 -0
- package/esm/publisher/v2/content.d.ts +154 -0
- package/esm/publisher/v2/content.d.ts.map +1 -0
- package/esm/publisher/v2/content.js +34 -0
- package/esm/publisher/v2/document.d.ts +116 -0
- package/esm/publisher/v2/document.d.ts.map +1 -0
- package/esm/publisher/v2/document.js +47 -0
- package/esm/publisher/v2/factory.d.ts +69 -0
- package/esm/publisher/v2/factory.d.ts.map +1 -0
- package/esm/publisher/v2/factory.js +80 -0
- package/esm/publisher/v2/layout.d.ts +48 -0
- package/esm/publisher/v2/layout.d.ts.map +1 -0
- package/esm/publisher/v2/layout.js +20 -0
- package/esm/publisher/v2/page.d.ts +67 -0
- package/esm/publisher/v2/page.d.ts.map +1 -0
- package/esm/publisher/v2/page.js +34 -0
- package/esm/publisher/v2/sections.d.ts +34 -0
- package/esm/publisher/v2/sections.d.ts.map +1 -0
- package/esm/publisher/v2/sections.js +40 -0
- package/esm/publisher/v2/structure.d.ts +5 -0
- package/esm/publisher/v2/structure.d.ts.map +1 -0
- package/esm/publisher/v2/structure.js +533 -0
- package/esm/publisher/v2/style.d.ts +323 -0
- package/esm/publisher/v2/style.d.ts.map +1 -0
- package/esm/publisher/v2/style.js +22 -0
- package/esm/publisher/v2/validation.d.ts +26 -0
- package/esm/publisher/v2/validation.d.ts.map +1 -0
- package/esm/publisher/v2/validation.js +157 -0
- package/esm/publisher/v2/widget.d.ts +295 -0
- package/esm/publisher/v2/widget.d.ts.map +1 -0
- package/esm/publisher/v2/widget.js +79 -0
- package/esm/sdk-model.d.ts +2426 -453
- package/esm/settings/settings.d.ts +31 -1
- package/esm/settings/settings.d.ts.map +1 -1
- package/package.json +4 -4
- package/esm/publisher/builtinPageLayouts.d.ts +0 -45
- package/esm/publisher/builtinPageLayouts.d.ts.map +0 -1
- package/esm/publisher/content.d.ts.map +0 -1
- package/esm/publisher/document.d.ts.map +0 -1
- package/esm/publisher/document.js +0 -35
- package/esm/publisher/factory.d.ts +0 -65
- package/esm/publisher/factory.d.ts.map +0 -1
- package/esm/publisher/layout.d.ts.map +0 -1
- package/esm/publisher/pageFormat.d.ts.map +0 -1
- package/esm/publisher/pageLayout.d.ts.map +0 -1
- package/esm/publisher/slot.d.ts.map +0 -1
- package/esm/publisher/slot.js +0 -87
- package/esm/publisher/styling.d.ts.map +0 -1
- package/esm/publisher/variables.d.ts.map +0 -1
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// (C) 2026 GoodData Corporation
|
|
2
|
+
import { isEmpty } from "lodash-es";
|
|
3
|
+
import { isObjRef } from "../../objRef/index.js";
|
|
4
|
+
/**
|
|
5
|
+
* Type-guard testing whether the provided object is an instance of {@link IPublisherDocumentTemplateDefinitionV1}.
|
|
6
|
+
*
|
|
7
|
+
* @alpha
|
|
8
|
+
*/
|
|
9
|
+
export function isPublisherDocumentTemplateDefinitionV1(obj) {
|
|
10
|
+
return !isEmpty(obj) && obj.type === "reportTemplate";
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Type-guard testing whether the provided object is an instance of {@link IPublisherDocumentTemplateV1}.
|
|
14
|
+
*
|
|
15
|
+
* @alpha
|
|
16
|
+
*/
|
|
17
|
+
export function isPublisherDocumentTemplateV1(obj) {
|
|
18
|
+
return (isPublisherDocumentTemplateDefinitionV1(obj) && isObjRef(obj.ref));
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Type-guard testing whether the provided object is an instance of {@link IPublisherDocumentDefinitionV1}.
|
|
22
|
+
*
|
|
23
|
+
* @alpha
|
|
24
|
+
*/
|
|
25
|
+
export function isPublisherDocumentDefinitionV1(obj) {
|
|
26
|
+
return !isEmpty(obj) && obj.type === "report";
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Type-guard testing whether the provided object is an instance of {@link IPublisherDocumentV1}.
|
|
30
|
+
*
|
|
31
|
+
* @alpha
|
|
32
|
+
*/
|
|
33
|
+
export function isPublisherDocumentV1(obj) {
|
|
34
|
+
return isPublisherDocumentDefinitionV1(obj) && isObjRef(obj.ref);
|
|
35
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { type IPublisherDocumentContentV1, type IPublisherDocumentPageV1 } from "./content.js";
|
|
2
|
+
import { type IPublisherDocumentDefinitionV1, type IPublisherDocumentTemplateDefinitionV1, type IPublisherDocumentTemplateV1, type IPublisherDocumentV1 } from "./document.js";
|
|
3
|
+
import { type IPublisherPageBodyV1, type IPublisherPageLayoutDefinitionV1, type IPublisherPageLayoutV1 } from "./pageLayout.js";
|
|
4
|
+
import { type PublisherDateStringV1 } from "./variables.js";
|
|
5
|
+
/**
|
|
6
|
+
* Creates a new page layout definition.
|
|
7
|
+
*
|
|
8
|
+
* @alpha
|
|
9
|
+
*/
|
|
10
|
+
export declare function newPublisherPageLayoutDefinitionV1(title: string, body: IPublisherPageBodyV1, modifications?: Partial<Omit<IPublisherPageLayoutDefinitionV1, "type" | "title" | "content">>): IPublisherPageLayoutDefinitionV1;
|
|
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 newPublisherDocumentPageFromLayoutV1(page: IPublisherPageLayoutV1 | IPublisherPageLayoutDefinitionV1, localIdentifier?: string): IPublisherDocumentPageV1;
|
|
22
|
+
/**
|
|
23
|
+
* Creates document content from page instances.
|
|
24
|
+
*
|
|
25
|
+
* @alpha
|
|
26
|
+
*/
|
|
27
|
+
export declare function newPublisherDocumentContentV1(pages: IPublisherDocumentPageV1[], modifications?: Partial<Omit<IPublisherDocumentContentV1, "version" | "pages">>): IPublisherDocumentContentV1;
|
|
28
|
+
/**
|
|
29
|
+
* Creates a new document template definition.
|
|
30
|
+
*
|
|
31
|
+
* @alpha
|
|
32
|
+
*/
|
|
33
|
+
export declare function newPublisherDocumentTemplateDefinitionV1(title: string, content: IPublisherDocumentContentV1, modifications?: Partial<Omit<IPublisherDocumentTemplateDefinitionV1, "type" | "title" | "content">>): IPublisherDocumentTemplateDefinitionV1;
|
|
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 newPublisherDocumentDefinitionFromTemplateV1(template: IPublisherDocumentTemplateV1 | IPublisherDocumentTemplateDefinitionV1, options: {
|
|
44
|
+
title: string;
|
|
45
|
+
periodStart: PublisherDateStringV1;
|
|
46
|
+
periodEnd: PublisherDateStringV1;
|
|
47
|
+
}, modifications?: Partial<Omit<IPublisherDocumentDefinitionV1, "type" | "title" | "periodStart" | "periodEnd" | "content">>): IPublisherDocumentDefinitionV1;
|
|
48
|
+
/**
|
|
49
|
+
* Creates an ad-hoc document definition not based on any template.
|
|
50
|
+
*
|
|
51
|
+
* @alpha
|
|
52
|
+
*/
|
|
53
|
+
export declare function newAdHocPublisherDocumentDefinitionV1(options: {
|
|
54
|
+
title: string;
|
|
55
|
+
periodStart: PublisherDateStringV1;
|
|
56
|
+
periodEnd: PublisherDateStringV1;
|
|
57
|
+
pages?: IPublisherDocumentPageV1[];
|
|
58
|
+
}, modifications?: Partial<Omit<IPublisherDocumentDefinitionV1, "type" | "title" | "periodStart" | "periodEnd" | "content">>): IPublisherDocumentDefinitionV1;
|
|
59
|
+
/**
|
|
60
|
+
* Convenience accessor for a document or template page by its localIdentifier.
|
|
61
|
+
*
|
|
62
|
+
* @alpha
|
|
63
|
+
*/
|
|
64
|
+
export declare function publisherDocumentPageV1(documentOrTemplate: IPublisherDocumentV1 | IPublisherDocumentDefinitionV1 | IPublisherDocumentTemplateV1 | IPublisherDocumentTemplateDefinitionV1, pageLocalIdentifier: string): IPublisherDocumentPageV1 | undefined;
|
|
65
|
+
//# sourceMappingURL=factory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../src/publisher/v1/factory.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,2BAA2B,EAAE,KAAK,wBAAwB,EAAE,MAAM,cAAc,CAAC;AAC/F,OAAO,EACH,KAAK,8BAA8B,EACnC,KAAK,sCAAsC,EAC3C,KAAK,4BAA4B,EACjC,KAAK,oBAAoB,EAC5B,MAAM,eAAe,CAAC;AAEvB,OAAO,EACH,KAAK,oBAAoB,EAEzB,KAAK,gCAAgC,EACrC,KAAK,sBAAsB,EAC9B,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EAAE,KAAK,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAyC5D;;;;GAIG;AACH,wBAAgB,kCAAkC,CAC9C,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,oBAAoB,EAC1B,aAAa,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,gCAAgC,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC,CAAC,GAC9F,gCAAgC,CAQlC;AAED;;;;;;;;;GASG;AACH,wBAAgB,oCAAoC,CAChD,IAAI,EAAE,sBAAsB,GAAG,gCAAgC,EAC/D,eAAe,GAAE,MAAyC,GAC3D,wBAAwB,CAY1B;AAED;;;;GAIG;AACH,wBAAgB,6BAA6B,CACzC,KAAK,EAAE,wBAAwB,EAAE,EACjC,aAAa,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,2BAA2B,EAAE,SAAS,GAAG,OAAO,CAAC,CAAC,GAChF,2BAA2B,CAM7B;AAED;;;;GAIG;AACH,wBAAgB,wCAAwC,CACpD,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,2BAA2B,EACpC,aAAa,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,sCAAsC,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC,CAAC,GACpG,sCAAsC,CAOxC;AAED;;;;;;;;GAQG;AACH,wBAAgB,4CAA4C,CACxD,QAAQ,EAAE,4BAA4B,GAAG,sCAAsC,EAC/E,OAAO,EAAE;IACL,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,qBAAqB,CAAC;IACnC,SAAS,EAAE,qBAAqB,CAAC;CACpC,EACD,aAAa,CAAC,EAAE,OAAO,CACnB,IAAI,CAAC,8BAA8B,EAAE,MAAM,GAAG,OAAO,GAAG,aAAa,GAAG,WAAW,GAAG,SAAS,CAAC,CACnG,GACF,8BAA8B,CAShC;AAED;;;;GAIG;AACH,wBAAgB,qCAAqC,CACjD,OAAO,EAAE;IACL,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,qBAAqB,CAAC;IACnC,SAAS,EAAE,qBAAqB,CAAC;IACjC,KAAK,CAAC,EAAE,wBAAwB,EAAE,CAAC;CACtC,EACD,aAAa,CAAC,EAAE,OAAO,CACnB,IAAI,CAAC,8BAA8B,EAAE,MAAM,GAAG,OAAO,GAAG,aAAa,GAAG,WAAW,GAAG,SAAS,CAAC,CACnG,GACF,8BAA8B,CAShC;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CACnC,kBAAkB,EACZ,oBAAoB,GACpB,8BAA8B,GAC9B,4BAA4B,GAC5B,sCAAsC,EAC5C,mBAAmB,EAAE,MAAM,GAC5B,wBAAwB,GAAG,SAAS,CAEtC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// (C) 2026 GoodData Corporation
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { isPublisherLayoutSectionV1 } from "./layout.js";
|
|
3
|
+
import { isPublisherImageBackgroundV1 } from "./styling.js";
|
|
4
4
|
function generatePublisherLocalId(prefix) {
|
|
5
5
|
const unique = typeof crypto !== "undefined" && typeof crypto.randomUUID === "function"
|
|
6
6
|
? crypto.randomUUID().replace(/-/g, "").slice(0, 12)
|
|
@@ -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 || !isPublisherImageBackgroundV1(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 (isPublisherLayoutSectionV1(node)) {
|
|
24
24
|
return {
|
|
25
25
|
...node,
|
|
26
26
|
...(node.style === undefined ? {} : { style: prefixBackgroundSlotId(node.style, prefix) }),
|
|
@@ -37,7 +37,7 @@ function prefixLayoutSlotIds(node, prefix) {
|
|
|
37
37
|
*
|
|
38
38
|
* @alpha
|
|
39
39
|
*/
|
|
40
|
-
export function
|
|
40
|
+
export function newPublisherPageLayoutDefinitionV1(title, body, modifications) {
|
|
41
41
|
const content = { version: "1", ...body };
|
|
42
42
|
return {
|
|
43
43
|
type: "reportPageLayout",
|
|
@@ -56,7 +56,7 @@ export function newPublisherPageLayoutDefinition(title, body, modifications) {
|
|
|
56
56
|
*
|
|
57
57
|
* @alpha
|
|
58
58
|
*/
|
|
59
|
-
export function
|
|
59
|
+
export function newPublisherDocumentPageFromLayoutV1(page, localIdentifier = generatePublisherLocalId("page")) {
|
|
60
60
|
const { version: _version, ...body } = deepClone(page.content);
|
|
61
61
|
return {
|
|
62
62
|
...body,
|
|
@@ -74,7 +74,7 @@ export function newPublisherDocumentPageFromLayout(page, localIdentifier = gener
|
|
|
74
74
|
*
|
|
75
75
|
* @alpha
|
|
76
76
|
*/
|
|
77
|
-
export function
|
|
77
|
+
export function newPublisherDocumentContentV1(pages, modifications) {
|
|
78
78
|
return {
|
|
79
79
|
version: "1",
|
|
80
80
|
pages,
|
|
@@ -86,7 +86,7 @@ export function newPublisherDocumentContent(pages, modifications) {
|
|
|
86
86
|
*
|
|
87
87
|
* @alpha
|
|
88
88
|
*/
|
|
89
|
-
export function
|
|
89
|
+
export function newPublisherDocumentTemplateDefinitionV1(title, content, modifications) {
|
|
90
90
|
return {
|
|
91
91
|
type: "reportTemplate",
|
|
92
92
|
title,
|
|
@@ -103,7 +103,7 @@ export function newPublisherDocumentTemplateDefinition(title, content, modificat
|
|
|
103
103
|
*
|
|
104
104
|
* @alpha
|
|
105
105
|
*/
|
|
106
|
-
export function
|
|
106
|
+
export function newPublisherDocumentDefinitionFromTemplateV1(template, options, modifications) {
|
|
107
107
|
return {
|
|
108
108
|
type: "report",
|
|
109
109
|
title: options.title,
|
|
@@ -118,13 +118,13 @@ export function newPublisherDocumentDefinitionFromTemplate(template, options, mo
|
|
|
118
118
|
*
|
|
119
119
|
* @alpha
|
|
120
120
|
*/
|
|
121
|
-
export function
|
|
121
|
+
export function newAdHocPublisherDocumentDefinitionV1(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: newPublisherDocumentContentV1(options.pages ?? []),
|
|
128
128
|
...modifications,
|
|
129
129
|
};
|
|
130
130
|
}
|
|
@@ -133,6 +133,6 @@ export function newAdHocPublisherDocumentDefinition(options, modifications) {
|
|
|
133
133
|
*
|
|
134
134
|
* @alpha
|
|
135
135
|
*/
|
|
136
|
-
export function
|
|
136
|
+
export function publisherDocumentPageV1(documentOrTemplate, pageLocalIdentifier) {
|
|
137
137
|
return documentOrTemplate.content.pages.find((page) => page.localIdentifier === pageLocalIdentifier);
|
|
138
138
|
}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type IPublisherBoxStyleV1 } from "./styling.js";
|
|
2
2
|
/**
|
|
3
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 IPublisherPageBodyV1.slots}.
|
|
6
6
|
*
|
|
7
7
|
* @alpha
|
|
8
8
|
*/
|
|
9
|
-
export type
|
|
9
|
+
export type PublisherPageLayoutNodeV1 = IPublisherLayoutSectionV1 | IPublisherLayoutSlotRefV1;
|
|
10
10
|
/**
|
|
11
11
|
* Fields common to all page layout nodes.
|
|
12
12
|
*
|
|
13
13
|
* @alpha
|
|
14
14
|
*/
|
|
15
|
-
export interface
|
|
15
|
+
export interface IPublisherLayoutNodeBaseV1 {
|
|
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 IPublisherLayoutNodeBase {
|
|
|
24
24
|
*
|
|
25
25
|
* @alpha
|
|
26
26
|
*/
|
|
27
|
-
export interface
|
|
27
|
+
export interface IPublisherLayoutSectionV1 extends IPublisherLayoutNodeBaseV1 {
|
|
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: PublisherPageLayoutNodeV1[];
|
|
34
34
|
/**
|
|
35
35
|
* Paint of this section's box. Never affects how children are laid out.
|
|
36
36
|
*/
|
|
37
|
-
style?:
|
|
37
|
+
style?: IPublisherBoxStyleV1;
|
|
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 IPublisherLayoutSlotRefV1 extends IPublisherLayoutNodeBaseV1 {
|
|
45
45
|
type: "slotRef";
|
|
46
46
|
/**
|
|
47
|
-
* Local identifier of a slot in {@link
|
|
47
|
+
* Local identifier of a slot in {@link IPublisherPageBodyV1.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 IPublisherLayoutSectionV1}.
|
|
54
54
|
*
|
|
55
55
|
* @alpha
|
|
56
56
|
*/
|
|
57
|
-
export declare function
|
|
57
|
+
export declare function isPublisherLayoutSectionV1(obj: unknown): obj is IPublisherLayoutSectionV1;
|
|
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 IPublisherLayoutSlotRefV1}.
|
|
60
60
|
*
|
|
61
61
|
* @alpha
|
|
62
62
|
*/
|
|
63
|
-
export declare function
|
|
63
|
+
export declare function isPublisherLayoutSlotRefV1(obj: unknown): obj is IPublisherLayoutSlotRefV1;
|
|
64
64
|
//# sourceMappingURL=layout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../../src/publisher/v1/layout.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAEzD;;;;;;GAMG;AACH,MAAM,MAAM,yBAAyB,GAAG,yBAAyB,GAAG,yBAAyB,CAAC;AAE9F;;;;GAIG;AACH,MAAM,WAAW,0BAA0B;IACvC;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;;GAIG;AACH,MAAM,WAAW,yBAA0B,SAAQ,0BAA0B;IACzE,IAAI,EAAE,SAAS,CAAC;IAEhB;;OAEG;IACH,SAAS,EAAE,KAAK,GAAG,QAAQ,CAAC;IAE5B,QAAQ,EAAE,yBAAyB,EAAE,CAAC;IAEtC;;OAEG;IACH,KAAK,CAAC,EAAE,oBAAoB,CAAC;CAChC;AAED;;;;GAIG;AACH,MAAM,WAAW,yBAA0B,SAAQ,0BAA0B;IACzE,IAAI,EAAE,SAAS,CAAC;IAEhB;;;OAGG;IACH,MAAM,EAAE,MAAM,CAAC;CAClB;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,yBAAyB,CAEzF;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,yBAAyB,CAEzF"}
|
|
@@ -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 IPublisherLayoutSectionV1}.
|
|
5
5
|
*
|
|
6
6
|
* @alpha
|
|
7
7
|
*/
|
|
8
|
-
export function
|
|
8
|
+
export function isPublisherLayoutSectionV1(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 IPublisherLayoutSlotRefV1}.
|
|
13
13
|
*
|
|
14
14
|
* @alpha
|
|
15
15
|
*/
|
|
16
|
-
export function
|
|
16
|
+
export function isPublisherLayoutSlotRefV1(obj) {
|
|
17
17
|
return !isEmpty(obj) && obj.type === "slotRef";
|
|
18
18
|
}
|
|
@@ -8,31 +8,31 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @alpha
|
|
10
10
|
*/
|
|
11
|
-
export type
|
|
11
|
+
export type PublisherPageFormatV1 = "widescreen" | "a4Portrait" | "letterPortrait";
|
|
12
12
|
/**
|
|
13
13
|
* Format assumed by a page that declares none, which keeps pages authored before formats existed
|
|
14
14
|
* on the shape they were designed for.
|
|
15
15
|
*
|
|
16
16
|
* @alpha
|
|
17
17
|
*/
|
|
18
|
-
export declare const
|
|
18
|
+
export declare const DefaultPublisherPageFormatV1: PublisherPageFormatV1;
|
|
19
19
|
/**
|
|
20
20
|
* List of built-in page format names.
|
|
21
21
|
*
|
|
22
22
|
* @alpha
|
|
23
23
|
*/
|
|
24
|
-
export declare const
|
|
24
|
+
export declare const PublisherPageFormatsV1: PublisherPageFormatV1[];
|
|
25
25
|
/**
|
|
26
26
|
* Width divided by height for each page format: 16:9 for a widescreen page, ISO A4 (210 x 297 mm) and
|
|
27
27
|
* US Letter (8.5 x 11 in) upright.
|
|
28
28
|
*
|
|
29
29
|
* @alpha
|
|
30
30
|
*/
|
|
31
|
-
export declare const
|
|
31
|
+
export declare const PublisherPageFormatAspectRatiosV1: Record<PublisherPageFormatV1, number>;
|
|
32
32
|
/**
|
|
33
|
-
* Type-guard testing whether the provided value is a {@link
|
|
33
|
+
* Type-guard testing whether the provided value is a {@link PublisherPageFormatV1}.
|
|
34
34
|
*
|
|
35
35
|
* @alpha
|
|
36
36
|
*/
|
|
37
|
-
export declare function
|
|
37
|
+
export declare function isPublisherPageFormatV1(value: unknown): value is PublisherPageFormatV1;
|
|
38
38
|
//# sourceMappingURL=pageFormat.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pageFormat.d.ts","sourceRoot":"","sources":["../../../src/publisher/v1/pageFormat.ts"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AACH,MAAM,MAAM,qBAAqB,GAAG,YAAY,GAAG,YAAY,GAAG,gBAAgB,CAAC;AAEnF;;;;;GAKG;AACH,eAAO,MAAM,4BAA4B,EAAE,qBAAoC,CAAC;AAEhF;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,EAAE,qBAAqB,EAAmD,CAAC;AAE9G;;;;;GAKG;AACH,eAAO,MAAM,iCAAiC,EAAE,MAAM,CAAC,qBAAqB,EAAE,MAAM,CAInF,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,qBAAqB,CAEtF"}
|
|
@@ -5,29 +5,29 @@
|
|
|
5
5
|
*
|
|
6
6
|
* @alpha
|
|
7
7
|
*/
|
|
8
|
-
export const
|
|
8
|
+
export const DefaultPublisherPageFormatV1 = "widescreen";
|
|
9
9
|
/**
|
|
10
10
|
* List of built-in page format names.
|
|
11
11
|
*
|
|
12
12
|
* @alpha
|
|
13
13
|
*/
|
|
14
|
-
export const
|
|
14
|
+
export const PublisherPageFormatsV1 = ["widescreen", "a4Portrait", "letterPortrait"];
|
|
15
15
|
/**
|
|
16
16
|
* Width divided by height for each page format: 16:9 for a widescreen page, ISO A4 (210 x 297 mm) and
|
|
17
17
|
* US Letter (8.5 x 11 in) upright.
|
|
18
18
|
*
|
|
19
19
|
* @alpha
|
|
20
20
|
*/
|
|
21
|
-
export const
|
|
21
|
+
export const PublisherPageFormatAspectRatiosV1 = {
|
|
22
22
|
widescreen: 16 / 9,
|
|
23
23
|
a4Portrait: 210 / 297,
|
|
24
24
|
letterPortrait: 8.5 / 11,
|
|
25
25
|
};
|
|
26
26
|
/**
|
|
27
|
-
* Type-guard testing whether the provided value is a {@link
|
|
27
|
+
* Type-guard testing whether the provided value is a {@link PublisherPageFormatV1}.
|
|
28
28
|
*
|
|
29
29
|
* @alpha
|
|
30
30
|
*/
|
|
31
|
-
export function
|
|
32
|
-
return typeof value === "string" &&
|
|
31
|
+
export function isPublisherPageFormatV1(value) {
|
|
32
|
+
return typeof value === "string" && PublisherPageFormatsV1.includes(value);
|
|
33
33
|
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { type IAuditableDates, type IAuditableUsers } from "
|
|
2
|
-
import { type FilterContextItem } from "
|
|
3
|
-
import { type ObjRef } from "
|
|
4
|
-
import { type
|
|
5
|
-
import { type
|
|
6
|
-
import { type
|
|
7
|
-
import { type
|
|
1
|
+
import { type IAuditableDates, type IAuditableUsers } from "../../base/metadata.js";
|
|
2
|
+
import { type FilterContextItem } from "../../dashboard/filterContext.js";
|
|
3
|
+
import { type ObjRef } from "../../objRef/index.js";
|
|
4
|
+
import { type PublisherPageLayoutNodeV1 } from "./layout.js";
|
|
5
|
+
import { type PublisherPageFormatV1 } from "./pageFormat.js";
|
|
6
|
+
import { type PublisherSlotV1 } from "./slot.js";
|
|
7
|
+
import { type IPublisherBoxStyleV1 } from "./styling.js";
|
|
8
8
|
/**
|
|
9
9
|
* Body of a document page: geometry (flex split tree) plus the slots it places.
|
|
10
10
|
*
|
|
11
11
|
* @remarks
|
|
12
|
-
* This is both the content of the standalone {@link
|
|
13
|
-
* embedded in template/document content ({@link
|
|
12
|
+
* This is both the content of the standalone {@link IPublisherPageLayoutV1} object and the shape
|
|
13
|
+
* embedded in template/document content ({@link IPublisherDocumentPageV1}).
|
|
14
14
|
*
|
|
15
15
|
* There is no header/footer chrome: page title, description, footer, page numbers and
|
|
16
16
|
* logos are ordinary slots in the layout tree (text slots with `{currentPageNumber}`/`{totalPages}`,
|
|
@@ -18,7 +18,7 @@ import { type IPublisherBoxStyle } from "./styling.js";
|
|
|
18
18
|
*
|
|
19
19
|
* @alpha
|
|
20
20
|
*/
|
|
21
|
-
export interface
|
|
21
|
+
export interface IPublisherPageBodyV1 {
|
|
22
22
|
/**
|
|
23
23
|
* Editor hint only (template galleries, default styling, AI context).
|
|
24
24
|
* Renderers must not branch layout logic on it — geometry always comes from `layout`.
|
|
@@ -26,21 +26,21 @@ export interface IPublisherPageBody {
|
|
|
26
26
|
kind?: "cover" | "section" | "content";
|
|
27
27
|
/**
|
|
28
28
|
* Page proportions the layout was authored for. Defaults to
|
|
29
|
-
* {@link
|
|
29
|
+
* {@link DefaultPublisherPageFormatV1}.
|
|
30
30
|
*/
|
|
31
|
-
format?:
|
|
31
|
+
format?: PublisherPageFormatV1;
|
|
32
32
|
/**
|
|
33
33
|
* Paint of the page itself, behind everything the layout places.
|
|
34
34
|
*/
|
|
35
|
-
style?:
|
|
35
|
+
style?: IPublisherBoxStyleV1;
|
|
36
36
|
/**
|
|
37
37
|
* Root of the page layout tree.
|
|
38
38
|
*/
|
|
39
|
-
layout:
|
|
39
|
+
layout: PublisherPageLayoutNodeV1;
|
|
40
40
|
/**
|
|
41
41
|
* All slots referenced by the layout, flat, keyed by localIdentifier.
|
|
42
42
|
*/
|
|
43
|
-
slots:
|
|
43
|
+
slots: PublisherSlotV1[];
|
|
44
44
|
/**
|
|
45
45
|
* Page-level filters: merged over content-level filters (a filter targeting the
|
|
46
46
|
* same object replaces the inherited one); slot filters apply on top.
|
|
@@ -52,7 +52,7 @@ export interface IPublisherPageBody {
|
|
|
52
52
|
*
|
|
53
53
|
* @alpha
|
|
54
54
|
*/
|
|
55
|
-
export interface
|
|
55
|
+
export interface IPublisherPageLayoutContentV1 extends IPublisherPageBodyV1 {
|
|
56
56
|
/**
|
|
57
57
|
* Content model version, for stored-content evolution.
|
|
58
58
|
*/
|
|
@@ -63,7 +63,7 @@ export interface IPublisherPageLayoutContent extends IPublisherPageBody {
|
|
|
63
63
|
*
|
|
64
64
|
* @alpha
|
|
65
65
|
*/
|
|
66
|
-
export interface
|
|
66
|
+
export interface IPublisherPageLayoutDefinitionV1 {
|
|
67
67
|
type: "reportPageLayout";
|
|
68
68
|
/**
|
|
69
69
|
* Present when updating an existing page.
|
|
@@ -72,14 +72,14 @@ export interface IPublisherPageLayoutDefinition {
|
|
|
72
72
|
title: string;
|
|
73
73
|
description?: string;
|
|
74
74
|
tags?: string[];
|
|
75
|
-
content:
|
|
75
|
+
content: IPublisherPageLayoutContentV1;
|
|
76
76
|
}
|
|
77
77
|
/**
|
|
78
78
|
* Reusable page layout metadata object.
|
|
79
79
|
*
|
|
80
80
|
* @alpha
|
|
81
81
|
*/
|
|
82
|
-
export interface
|
|
82
|
+
export interface IPublisherPageLayoutV1 extends IPublisherPageLayoutDefinitionV1, IAuditableDates, IAuditableUsers {
|
|
83
83
|
ref: ObjRef;
|
|
84
84
|
/**
|
|
85
85
|
* When true, the object comes from a parent workspace and is not editable
|
|
@@ -93,29 +93,29 @@ export interface IPublisherPageLayout extends IPublisherPageLayoutDefinition, IA
|
|
|
93
93
|
isBuiltIn?: boolean;
|
|
94
94
|
}
|
|
95
95
|
/**
|
|
96
|
-
* Type-guard testing whether the provided object is an instance of {@link
|
|
96
|
+
* Type-guard testing whether the provided object is an instance of {@link IPublisherPageLayoutDefinitionV1}.
|
|
97
97
|
*
|
|
98
98
|
* @alpha
|
|
99
99
|
*/
|
|
100
|
-
export declare function
|
|
100
|
+
export declare function isPublisherPageLayoutDefinitionV1(obj: unknown): obj is IPublisherPageLayoutDefinitionV1;
|
|
101
101
|
/**
|
|
102
|
-
* Type-guard testing whether the provided object is an instance of {@link
|
|
102
|
+
* Type-guard testing whether the provided object is an instance of {@link IPublisherPageLayoutV1}.
|
|
103
103
|
*
|
|
104
104
|
* @alpha
|
|
105
105
|
*/
|
|
106
|
-
export declare function
|
|
106
|
+
export declare function isPublisherPageLayoutV1(obj: unknown): obj is IPublisherPageLayoutV1;
|
|
107
107
|
/**
|
|
108
|
-
* Type-guard testing whether the provided object is an instance of {@link
|
|
108
|
+
* Type-guard testing whether the provided object is an instance of {@link IPublisherPageLayoutContentV1}.
|
|
109
109
|
*
|
|
110
110
|
* @alpha
|
|
111
111
|
*/
|
|
112
|
-
export declare function isPublisherPageLayoutContentV1(obj: unknown): obj is
|
|
112
|
+
export declare function isPublisherPageLayoutContentV1(obj: unknown): obj is IPublisherPageLayoutContentV1;
|
|
113
113
|
/**
|
|
114
114
|
* Validation issue found in a page body.
|
|
115
115
|
*
|
|
116
116
|
* @alpha
|
|
117
117
|
*/
|
|
118
|
-
export interface
|
|
118
|
+
export interface IPublisherPageBodyValidationIssueV1 {
|
|
119
119
|
severity: "error" | "warning";
|
|
120
120
|
message: string;
|
|
121
121
|
}
|
|
@@ -129,5 +129,5 @@ export interface IPublisherPageBodyValidationIssue {
|
|
|
129
129
|
*
|
|
130
130
|
* @alpha
|
|
131
131
|
*/
|
|
132
|
-
export declare function
|
|
132
|
+
export declare function validatePublisherPageBodyV1(body: IPublisherPageBodyV1): IPublisherPageBodyValidationIssueV1[];
|
|
133
133
|
//# sourceMappingURL=pageLayout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pageLayout.d.ts","sourceRoot":"","sources":["../../../src/publisher/v1/pageLayout.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,eAAe,EAAE,KAAK,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACpF,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAC1E,OAAO,EAAE,KAAK,MAAM,EAAY,MAAM,uBAAuB,CAAC;AAE9D,OAAO,EACH,KAAK,yBAAyB,EAGjC,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,KAAK,qBAAqB,EAA2B,MAAM,iBAAiB,CAAC;AACtF,OAAO,EAAE,KAAK,eAAe,EAAiD,MAAM,WAAW,CAAC;AAChG,OAAO,EAAE,KAAK,oBAAoB,EAAgC,MAAM,cAAc,CAAC;AAEvF;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,oBAAoB;IACjC;;;OAGG;IACH,IAAI,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,SAAS,CAAC;IAEvC;;;OAGG;IACH,MAAM,CAAC,EAAE,qBAAqB,CAAC;IAE/B;;OAEG;IACH,KAAK,CAAC,EAAE,oBAAoB,CAAC;IAE7B;;OAEG;IACH,MAAM,EAAE,yBAAyB,CAAC;IAElC;;OAEG;IACH,KAAK,EAAE,eAAe,EAAE,CAAC;IAEzB;;;OAGG;IACH,OAAO,CAAC,EAAE,iBAAiB,EAAE,CAAC;CACjC;AAED;;;;GAIG;AACH,MAAM,WAAW,6BAA8B,SAAQ,oBAAoB;IACvE;;OAEG;IACH,OAAO,EAAE,GAAG,CAAC;CAChB;AAED;;;;GAIG;AACH,MAAM,WAAW,gCAAgC;IAC7C,IAAI,EAAE,kBAAkB,CAAC;IAEzB;;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,6BAA6B,CAAC;CAC1C;AAED;;;;GAIG;AACH,MAAM,WAAW,sBACb,SAAQ,gCAAgC,EAAE,eAAe,EAAE,eAAe;IAC1E,GAAG,EAAE,MAAM,CAAC;IAEZ;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACvB;AAED;;;;GAIG;AACH,wBAAgB,iCAAiC,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,gCAAgC,CAEvG;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,sBAAsB,CAEnF;AAED;;;;GAIG;AACH,wBAAgB,8BAA8B,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,6BAA6B,CAOjG;AAED;;;;GAIG;AACH,MAAM,WAAW,mCAAmC;IAChD,QAAQ,EAAE,OAAO,GAAG,SAAS,CAAC;IAC9B,OAAO,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;;;GASG;AACH,wBAAgB,2BAA2B,CACvC,IAAI,EAAE,oBAAoB,GAC3B,mCAAmC,EAAE,CA+FvC"}
|
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
// (C) 2026 GoodData Corporation
|
|
2
2
|
import { isEmpty } from "lodash-es";
|
|
3
|
-
import { isObjRef } from "
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
3
|
+
import { isObjRef } from "../../objRef/index.js";
|
|
4
|
+
import { isPublisherLayoutSectionV1, isPublisherLayoutSlotRefV1, } from "./layout.js";
|
|
5
|
+
import { isPublisherPageFormatV1 } from "./pageFormat.js";
|
|
6
|
+
import { isPublisherImageSlotV1, isPublisherTextSlotV1 } from "./slot.js";
|
|
7
|
+
import { isPublisherImageBackgroundV1 } from "./styling.js";
|
|
8
8
|
/**
|
|
9
|
-
* Type-guard testing whether the provided object is an instance of {@link
|
|
9
|
+
* Type-guard testing whether the provided object is an instance of {@link IPublisherPageLayoutDefinitionV1}.
|
|
10
10
|
*
|
|
11
11
|
* @alpha
|
|
12
12
|
*/
|
|
13
|
-
export function
|
|
13
|
+
export function isPublisherPageLayoutDefinitionV1(obj) {
|
|
14
14
|
return !isEmpty(obj) && obj.type === "reportPageLayout";
|
|
15
15
|
}
|
|
16
16
|
/**
|
|
17
|
-
* Type-guard testing whether the provided object is an instance of {@link
|
|
17
|
+
* Type-guard testing whether the provided object is an instance of {@link IPublisherPageLayoutV1}.
|
|
18
18
|
*
|
|
19
19
|
* @alpha
|
|
20
20
|
*/
|
|
21
|
-
export function
|
|
22
|
-
return
|
|
21
|
+
export function isPublisherPageLayoutV1(obj) {
|
|
22
|
+
return isPublisherPageLayoutDefinitionV1(obj) && isObjRef(obj.ref);
|
|
23
23
|
}
|
|
24
24
|
/**
|
|
25
|
-
* Type-guard testing whether the provided object is an instance of {@link
|
|
25
|
+
* Type-guard testing whether the provided object is an instance of {@link IPublisherPageLayoutContentV1}.
|
|
26
26
|
*
|
|
27
27
|
* @alpha
|
|
28
28
|
*/
|
|
@@ -42,9 +42,9 @@ export function isPublisherPageLayoutContentV1(obj) {
|
|
|
42
42
|
*
|
|
43
43
|
* @alpha
|
|
44
44
|
*/
|
|
45
|
-
export function
|
|
45
|
+
export function validatePublisherPageBodyV1(body) {
|
|
46
46
|
const issues = [];
|
|
47
|
-
if (body.format !== undefined && !
|
|
47
|
+
if (body.format !== undefined && !isPublisherPageFormatV1(body.format)) {
|
|
48
48
|
issues.push({ severity: "error", message: `Unknown page format "${body.format}".` });
|
|
49
49
|
}
|
|
50
50
|
const checkLength = (name, value) => {
|
|
@@ -70,7 +70,7 @@ export function validatePublisherPageBody(body) {
|
|
|
70
70
|
const checkBoxStyle = (style, isDrawn) => {
|
|
71
71
|
checkLength("Border radius", style?.borderRadius);
|
|
72
72
|
checkLength("Padding", style?.padding);
|
|
73
|
-
if (!style?.background || !
|
|
73
|
+
if (!style?.background || !isPublisherImageBackgroundV1(style.background)) {
|
|
74
74
|
return;
|
|
75
75
|
}
|
|
76
76
|
const { slotId } = style.background;
|
|
@@ -82,7 +82,7 @@ export function validatePublisherPageBody(body) {
|
|
|
82
82
|
});
|
|
83
83
|
return;
|
|
84
84
|
}
|
|
85
|
-
if (!
|
|
85
|
+
if (!isPublisherImageSlotV1(slot)) {
|
|
86
86
|
issues.push({
|
|
87
87
|
severity: "error",
|
|
88
88
|
message: `Background references slot "${slotId}" which is not an image slot.`,
|
|
@@ -102,7 +102,7 @@ export function validatePublisherPageBody(body) {
|
|
|
102
102
|
message: `Layout node weight must be positive, got ${node.weight}.`,
|
|
103
103
|
});
|
|
104
104
|
}
|
|
105
|
-
if (
|
|
105
|
+
if (isPublisherLayoutSlotRefV1(node)) {
|
|
106
106
|
referencedIds.add(node.slotId);
|
|
107
107
|
if (!slotIds.has(node.slotId)) {
|
|
108
108
|
issues.push({
|
|
@@ -111,14 +111,14 @@ export function validatePublisherPageBody(body) {
|
|
|
111
111
|
});
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
|
-
else if (
|
|
114
|
+
else if (isPublisherLayoutSectionV1(node)) {
|
|
115
115
|
checkBoxStyle(node.style, true);
|
|
116
116
|
node.children.forEach(visit);
|
|
117
117
|
}
|
|
118
118
|
};
|
|
119
119
|
visit(body.layout);
|
|
120
120
|
// After the layout, so a slot the layout never places cannot vouch for the image it names.
|
|
121
|
-
for (const slot of body.slots.filter(
|
|
121
|
+
for (const slot of body.slots.filter(isPublisherTextSlotV1)) {
|
|
122
122
|
checkBoxStyle(slot.style, referencedIds.has(slot.localIdentifier));
|
|
123
123
|
}
|
|
124
124
|
for (const slotId of slotIds) {
|