@gooddata/sdk-code-convertors 11.43.0-alpha.1 → 11.43.0-alpha.3
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/configs/table.d.ts +66 -0
- package/esm/configs/table.d.ts.map +1 -1
- package/esm/configs/table.js +89 -0
- package/esm/sdk-code-convertors.d.ts +66 -0
- package/package.json +6 -6
package/esm/configs/table.d.ts
CHANGED
|
@@ -27,6 +27,39 @@ export type TableConfigProperties = {
|
|
|
27
27
|
};
|
|
28
28
|
pageSize: number;
|
|
29
29
|
grandTotalsPosition: "pinnedBottom" | "pinnedTop" | "bottom" | "top";
|
|
30
|
+
conditionalFormatting: {
|
|
31
|
+
version?: string;
|
|
32
|
+
enabled: boolean;
|
|
33
|
+
rules: Array<{
|
|
34
|
+
id: string;
|
|
35
|
+
target: {
|
|
36
|
+
kind: "measure";
|
|
37
|
+
measureIdentifier: string;
|
|
38
|
+
} | {
|
|
39
|
+
kind: "attribute";
|
|
40
|
+
attributeIdentifier: string;
|
|
41
|
+
};
|
|
42
|
+
conditions: Array<{
|
|
43
|
+
id: string;
|
|
44
|
+
operator: string;
|
|
45
|
+
value: {
|
|
46
|
+
kind: "none";
|
|
47
|
+
} | {
|
|
48
|
+
kind: "literal";
|
|
49
|
+
value: string | number;
|
|
50
|
+
} | {
|
|
51
|
+
kind: "literalRange";
|
|
52
|
+
from: number;
|
|
53
|
+
to: number;
|
|
54
|
+
};
|
|
55
|
+
format: {
|
|
56
|
+
color?: string;
|
|
57
|
+
backgroundColor?: string;
|
|
58
|
+
scope: "cell" | "row";
|
|
59
|
+
};
|
|
60
|
+
}>;
|
|
61
|
+
}>;
|
|
62
|
+
};
|
|
30
63
|
};
|
|
31
64
|
/** @internal */
|
|
32
65
|
export declare const TABLE_DEFAULTS: ConfigDefaults<TableConfigProperties>;
|
|
@@ -102,6 +135,39 @@ export declare function tableSave(fields: Visualisation["query"]["fields"] | und
|
|
|
102
135
|
} | undefined;
|
|
103
136
|
pageSize: number | undefined;
|
|
104
137
|
grandTotalsPosition: "bottom" | "pinnedBottom" | "pinnedTop" | "top" | undefined;
|
|
138
|
+
conditionalFormatting: {
|
|
139
|
+
version?: string | undefined;
|
|
140
|
+
enabled: boolean;
|
|
141
|
+
rules: {
|
|
142
|
+
id: string;
|
|
143
|
+
target: {
|
|
144
|
+
kind: "measure";
|
|
145
|
+
measureIdentifier: string;
|
|
146
|
+
} | {
|
|
147
|
+
kind: "attribute";
|
|
148
|
+
attributeIdentifier: string;
|
|
149
|
+
};
|
|
150
|
+
conditions: {
|
|
151
|
+
id: string;
|
|
152
|
+
operator: string;
|
|
153
|
+
value: {
|
|
154
|
+
kind: "none";
|
|
155
|
+
} | {
|
|
156
|
+
kind: "literal";
|
|
157
|
+
value: string | number;
|
|
158
|
+
} | {
|
|
159
|
+
kind: "literalRange";
|
|
160
|
+
from: number;
|
|
161
|
+
to: number;
|
|
162
|
+
};
|
|
163
|
+
format: {
|
|
164
|
+
color?: string | undefined;
|
|
165
|
+
backgroundColor?: string | undefined;
|
|
166
|
+
scope: "cell" | "row";
|
|
167
|
+
};
|
|
168
|
+
}[];
|
|
169
|
+
}[];
|
|
170
|
+
} | undefined;
|
|
105
171
|
} | undefined;
|
|
106
172
|
/**
|
|
107
173
|
* @internal
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../src/configs/table.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAInE,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,eAAe,EAAE,MAAM,YAAY,CAAC;AACtE,OAAO,EACH,KAAK,cAAc,EACnB,KAAK,mBAAmB,EAI3B,MAAM,YAAY,CAAC;AAEpB,gBAAgB;AAChB,MAAM,MAAM,qBAAqB,GAAG;IAChC,YAAY,EAAE,KAAK,CAAC,eAAe,CAAC,CAAC;IACrC,qBAAqB,EAAE,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IAAI,EAAE,MAAM,CAAC;oBAAC,EAAE,EAAE,MAAM,CAAA;iBAAE,CAAC;gBACzD,MAAM,EAAE;oBAAE,KAAK,CAAC,EAAE,MAAM,CAAC;oBAAC,eAAe,CAAC,EAAE,MAAM,CAAC;oBAAC,KAAK,EAAE,MAAM,GAAG,KAAK,CAAA;iBAAE,CAAC;aAC/E,CAAC,CAAC;SACN,CAAC,CAAC;KACN,CAAC;CACL,CAAC;AAoOF,gBAAgB;AAChB,eAAO,MAAM,cAAc,uCAAW,CAAC;AAEvC,gBAAgB;AAChB,wBAAgB,SAAS,CAAC,KAAK,EAAE,mBAAmB,CAAC,qBAAqB,CAAC,kEAsE1E;AAED,gBAAgB;AAChB,wBAAgB,SAAS,CACrB,MAAM,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,GAAG,SAAS,EACpD,MAAM,EAAE,aAAa,CAAC,QAAQ,CAAC,GAAG,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAoC9C;AAED;;;GAGG;AACH,MAAM,WAAW,YAAY;IACzB,IAAI,EAAE,OAAO,SAAS,CAAC;IACvB,IAAI,EAAE,OAAO,SAAS,CAAC;IACvB,QAAQ,EAAE,cAAc,CAAC,qBAAqB,CAAC,CAAC;CACnD;AAED;;;GAGG;AACH,eAAO,MAAM,KAAK,EAAE,YAInB,CAAC"}
|
package/esm/configs/table.js
CHANGED
|
@@ -22,6 +22,7 @@ const DEFAULTS = {
|
|
|
22
22
|
pageSize: 100,
|
|
23
23
|
enableAccessibility: false,
|
|
24
24
|
grandTotalsPosition: "pinnedBottom",
|
|
25
|
+
conditionalFormatting: { enabled: false, rules: [] },
|
|
25
26
|
};
|
|
26
27
|
function loadTextWrapping(value) {
|
|
27
28
|
if (!value) {
|
|
@@ -79,6 +80,89 @@ function saveTextWrapping(value) {
|
|
|
79
80
|
})),
|
|
80
81
|
};
|
|
81
82
|
}
|
|
83
|
+
// internal -> YAML (condensed authoring form)
|
|
84
|
+
function loadConditionalFormattingValue(value) {
|
|
85
|
+
if (value.kind === "literal") {
|
|
86
|
+
return { value: value.value };
|
|
87
|
+
}
|
|
88
|
+
if (value.kind === "literalRange") {
|
|
89
|
+
return { value: { from: value.from, to: value.to } };
|
|
90
|
+
}
|
|
91
|
+
return {};
|
|
92
|
+
}
|
|
93
|
+
function loadConditionalFormattingCondition(condition) {
|
|
94
|
+
return {
|
|
95
|
+
id: condition.id,
|
|
96
|
+
operator: condition.operator.toLowerCase(),
|
|
97
|
+
...loadConditionalFormattingValue(condition.value),
|
|
98
|
+
format: {
|
|
99
|
+
...(condition.format.color ? { text: condition.format.color } : {}),
|
|
100
|
+
...(condition.format.backgroundColor ? { fill: condition.format.backgroundColor } : {}),
|
|
101
|
+
scope: condition.format.scope,
|
|
102
|
+
},
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
function loadConditionalFormattingRule(rule) {
|
|
106
|
+
return {
|
|
107
|
+
id: rule.id,
|
|
108
|
+
target: rule.target.kind === "measure"
|
|
109
|
+
? { measure: rule.target.measureIdentifier }
|
|
110
|
+
: { attribute: rule.target.attributeIdentifier },
|
|
111
|
+
conditions: rule.conditions.map(loadConditionalFormattingCondition),
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
function loadConditionalFormatting(value) {
|
|
115
|
+
if (!value || (value.rules.length === 0 && !value.enabled)) {
|
|
116
|
+
return undefined;
|
|
117
|
+
}
|
|
118
|
+
return {
|
|
119
|
+
...(value.version ? { version: value.version } : {}),
|
|
120
|
+
enabled: value.enabled,
|
|
121
|
+
rules: value.rules.map(loadConditionalFormattingRule),
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
// YAML -> internal
|
|
125
|
+
function saveConditionalFormattingValue(value) {
|
|
126
|
+
if (value === null || value === undefined) {
|
|
127
|
+
return { kind: "none" };
|
|
128
|
+
}
|
|
129
|
+
// Only a {from,to} object is a range; guard "from" so a stray object can't crash the conversion.
|
|
130
|
+
if (typeof value === "object" && "from" in value) {
|
|
131
|
+
return { kind: "literalRange", from: value.from, to: value.to };
|
|
132
|
+
}
|
|
133
|
+
return { kind: "literal", value };
|
|
134
|
+
}
|
|
135
|
+
function saveConditionalFormattingRule(rule) {
|
|
136
|
+
return {
|
|
137
|
+
id: rule.id,
|
|
138
|
+
target: rule.target.measure === undefined
|
|
139
|
+
? { kind: "attribute", attributeIdentifier: rule.target.attribute ?? "" }
|
|
140
|
+
: { kind: "measure", measureIdentifier: rule.target.measure },
|
|
141
|
+
conditions: rule.conditions.map((condition) => ({
|
|
142
|
+
id: condition.id,
|
|
143
|
+
operator: condition.operator.toUpperCase(),
|
|
144
|
+
value: saveConditionalFormattingValue(condition.value),
|
|
145
|
+
format: {
|
|
146
|
+
...(condition.format.text ? { color: condition.format.text } : {}),
|
|
147
|
+
...(condition.format.fill ? { backgroundColor: condition.format.fill } : {}),
|
|
148
|
+
scope: condition.format.scope,
|
|
149
|
+
},
|
|
150
|
+
})),
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
function saveConditionalFormatting(value) {
|
|
154
|
+
const rules = value?.rules ?? [];
|
|
155
|
+
// Same drop condition as loadConditionalFormatting: drop only the fully-empty default so the
|
|
156
|
+
// config round-trips symmetrically (an enabled-but-ruleless config is preserved on both sides).
|
|
157
|
+
if (!value || (rules.length === 0 && !value.enabled)) {
|
|
158
|
+
return undefined;
|
|
159
|
+
}
|
|
160
|
+
return {
|
|
161
|
+
...(value.version ? { version: value.version } : {}),
|
|
162
|
+
enabled: value.enabled ?? false,
|
|
163
|
+
rules: rules.map(saveConditionalFormattingRule),
|
|
164
|
+
};
|
|
165
|
+
}
|
|
82
166
|
/** @internal */
|
|
83
167
|
export const TABLE_DEFAULTS = DEFAULTS;
|
|
84
168
|
/** @internal */
|
|
@@ -144,6 +228,10 @@ export function tableLoad(props) {
|
|
|
144
228
|
const val = value;
|
|
145
229
|
return [["grand_totals_position", getValueOrDefault(val, DEFAULTS.grandTotalsPosition)]];
|
|
146
230
|
}
|
|
231
|
+
case "conditionalFormatting": {
|
|
232
|
+
const val = value;
|
|
233
|
+
return [["conditional_formatting", loadConditionalFormatting(val)]];
|
|
234
|
+
}
|
|
147
235
|
default:
|
|
148
236
|
return [];
|
|
149
237
|
}
|
|
@@ -168,6 +256,7 @@ export function tableSave(fields, config) {
|
|
|
168
256
|
pagination: savePagination(config.pagination),
|
|
169
257
|
pageSize: getValueOrDefault(config.page_size, DEFAULTS.pageSize, "number"),
|
|
170
258
|
grandTotalsPosition: getValueOrDefault(config.grand_totals_position, DEFAULTS.grandTotalsPosition),
|
|
259
|
+
conditionalFormatting: saveConditionalFormatting(config.conditional_formatting),
|
|
171
260
|
});
|
|
172
261
|
}
|
|
173
262
|
/**
|
|
@@ -3347,6 +3347,39 @@ export declare type TableConfigProperties = {
|
|
|
3347
3347
|
};
|
|
3348
3348
|
pageSize: number;
|
|
3349
3349
|
grandTotalsPosition: "pinnedBottom" | "pinnedTop" | "bottom" | "top";
|
|
3350
|
+
conditionalFormatting: {
|
|
3351
|
+
version?: string;
|
|
3352
|
+
enabled: boolean;
|
|
3353
|
+
rules: Array<{
|
|
3354
|
+
id: string;
|
|
3355
|
+
target: {
|
|
3356
|
+
kind: "measure";
|
|
3357
|
+
measureIdentifier: string;
|
|
3358
|
+
} | {
|
|
3359
|
+
kind: "attribute";
|
|
3360
|
+
attributeIdentifier: string;
|
|
3361
|
+
};
|
|
3362
|
+
conditions: Array<{
|
|
3363
|
+
id: string;
|
|
3364
|
+
operator: string;
|
|
3365
|
+
value: {
|
|
3366
|
+
kind: "none";
|
|
3367
|
+
} | {
|
|
3368
|
+
kind: "literal";
|
|
3369
|
+
value: string | number;
|
|
3370
|
+
} | {
|
|
3371
|
+
kind: "literalRange";
|
|
3372
|
+
from: number;
|
|
3373
|
+
to: number;
|
|
3374
|
+
};
|
|
3375
|
+
format: {
|
|
3376
|
+
color?: string;
|
|
3377
|
+
backgroundColor?: string;
|
|
3378
|
+
scope: "cell" | "row";
|
|
3379
|
+
};
|
|
3380
|
+
}>;
|
|
3381
|
+
}>;
|
|
3382
|
+
};
|
|
3350
3383
|
};
|
|
3351
3384
|
|
|
3352
3385
|
/** @internal */
|
|
@@ -3422,6 +3455,39 @@ export declare function tableSave(fields: Visualisation["query"]["fields"] | und
|
|
|
3422
3455
|
} | undefined;
|
|
3423
3456
|
pageSize: number | undefined;
|
|
3424
3457
|
grandTotalsPosition: "bottom" | "pinnedBottom" | "pinnedTop" | "top" | undefined;
|
|
3458
|
+
conditionalFormatting: {
|
|
3459
|
+
version?: string | undefined;
|
|
3460
|
+
enabled: boolean;
|
|
3461
|
+
rules: {
|
|
3462
|
+
id: string;
|
|
3463
|
+
target: {
|
|
3464
|
+
kind: "measure";
|
|
3465
|
+
measureIdentifier: string;
|
|
3466
|
+
} | {
|
|
3467
|
+
kind: "attribute";
|
|
3468
|
+
attributeIdentifier: string;
|
|
3469
|
+
};
|
|
3470
|
+
conditions: {
|
|
3471
|
+
id: string;
|
|
3472
|
+
operator: string;
|
|
3473
|
+
value: {
|
|
3474
|
+
kind: "none";
|
|
3475
|
+
} | {
|
|
3476
|
+
kind: "literal";
|
|
3477
|
+
value: string | number;
|
|
3478
|
+
} | {
|
|
3479
|
+
kind: "literalRange";
|
|
3480
|
+
from: number;
|
|
3481
|
+
to: number;
|
|
3482
|
+
};
|
|
3483
|
+
format: {
|
|
3484
|
+
color?: string | undefined;
|
|
3485
|
+
backgroundColor?: string | undefined;
|
|
3486
|
+
scope: "cell" | "row";
|
|
3487
|
+
};
|
|
3488
|
+
}[];
|
|
3489
|
+
}[];
|
|
3490
|
+
} | undefined;
|
|
3425
3491
|
} | undefined;
|
|
3426
3492
|
|
|
3427
3493
|
/** @public */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gooddata/sdk-code-convertors",
|
|
3
|
-
"version": "11.43.0-alpha.
|
|
3
|
+
"version": "11.43.0-alpha.3",
|
|
4
4
|
"description": "GoodData AAC declarative converters",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "GoodData",
|
|
@@ -26,9 +26,9 @@
|
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"uuid": "11.1.1",
|
|
28
28
|
"yaml": "2.8.3",
|
|
29
|
-
"@gooddata/api-client-tiger": "11.43.0-alpha.
|
|
30
|
-
"@gooddata/sdk-
|
|
31
|
-
"@gooddata/sdk-
|
|
29
|
+
"@gooddata/api-client-tiger": "11.43.0-alpha.3",
|
|
30
|
+
"@gooddata/sdk-code-schemas": "11.43.0-alpha.3",
|
|
31
|
+
"@gooddata/sdk-model": "11.43.0-alpha.3"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@microsoft/api-extractor": "^7.55.2",
|
|
@@ -50,8 +50,8 @@
|
|
|
50
50
|
"oxlint-tsgolint": "0.15.0",
|
|
51
51
|
"typescript": "5.9.3",
|
|
52
52
|
"vitest": "4.1.8",
|
|
53
|
-
"@gooddata/eslint-config": "11.43.0-alpha.
|
|
54
|
-
"@gooddata/oxlint-config": "11.43.0-alpha.
|
|
53
|
+
"@gooddata/eslint-config": "11.43.0-alpha.3",
|
|
54
|
+
"@gooddata/oxlint-config": "11.43.0-alpha.3"
|
|
55
55
|
},
|
|
56
56
|
"scripts": {
|
|
57
57
|
"_phase:build": "npm run build",
|