@bino-bi/bn-template-engine 1.0.0-next.38 → 1.0.0-next.40
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/dist/bn-template-engine/bn-template-engine.esm.js +1 -1
- package/dist/bn-template-engine/{p-9a61f59d.entry.js → p-8b28c9bd.entry.js} +1 -1
- package/dist/bn-template-engine/{p-DyupX-Z-.js → p-BjozxTTW.js} +1 -1
- package/dist/bn-template-engine/p-EcC0qLtU.js +1 -0
- package/dist/bn-template-engine/{p-eea538f1.entry.js → p-a4b76176.entry.js} +1 -1
- package/dist/bn-template-engine/p-aa0fd797.entry.js +1 -0
- package/dist/bn-template-engine/{p-93b8387f.entry.js → p-ce764078.entry.js} +1 -1
- package/dist/cjs/bn-annotation-layer_30.cjs.entry.js +1067 -515
- package/dist/cjs/bn-grid.cjs.entry.js +1 -1
- package/dist/cjs/bn-image.cjs.entry.js +1 -1
- package/dist/cjs/bn-template-engine.cjs.js +1 -1
- package/dist/cjs/bn-text.cjs.entry.js +2 -2
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{withStyled-DfE0aW7D.js → withStyled-BZb6snOx.js} +74 -0
- package/dist/cjs/{withTranslation-0gkn9xoC.js → withTranslation-FxXGUB3H.js} +1 -1
- package/dist/collection/components/bn-chart-structure/utils/StructureChart.js +4 -1
- package/dist/collection/components/bn-chart-structure/utils/elements/Label.js +3 -1
- package/dist/collection/components/bn-chart-time/utils/elements/Label.js +3 -1
- package/dist/collection/components/bn-table/bn-table-renderer/bn-table-renderer.css +22 -1
- package/dist/collection/components/bn-table/bn-table-renderer/bn-table-renderer.js +192 -12
- package/dist/collection/components/bn-table/bn-table.js +222 -8
- package/dist/collection/components/bn-table/utils/Table.js +33 -2
- package/dist/collection/components/bn-table/utils/elements/Cell.js +10 -1
- package/dist/collection/components/bn-table/utils/elements/CellBarChart.js +25 -10
- package/dist/collection/components/bn-table/utils/elements/WaterfallBar.js +50 -12
- package/dist/collection/components/bn-table/utils/factories/tableDataSetFactory.js +59 -21
- package/dist/collection/components/bn-table/utils/helper/DataQuery.js +63 -2
- package/dist/collection/components/bn-table/utils/helper/IntervalColumns.js +30 -6
- package/dist/collection/components/bn-table/utils/helper/WaterfallCalculator.js +123 -11
- package/dist/collection/components/bn-table/utils/helper/barColumnGeometry.js +57 -9
- package/dist/collection/components/bn-table/utils/model/TableComponentConfig.js +21 -1
- package/dist/collection/components/bn-table/utils/model/index.js +6 -0
- package/dist/collection/utils/layoutState/baseline.js +6 -5
- package/dist/collection/utils/validate.js +4 -0
- package/dist/components/bn-chart-bubble-renderer.js +1 -1
- package/dist/components/bn-chart-bubble.js +1 -1
- package/dist/components/bn-chart-bullet-renderer.js +1 -1
- package/dist/components/bn-chart-bullet.js +1 -1
- package/dist/components/bn-chart-scatter-renderer.js +1 -1
- package/dist/components/bn-chart-scatter.js +1 -1
- package/dist/components/bn-chart-structure-renderer.js +1 -1
- package/dist/components/bn-chart-structure.js +1 -1
- package/dist/components/bn-chart-time-renderer.js +1 -1
- package/dist/components/bn-chart-time.js +1 -1
- package/dist/components/bn-grid.js +1 -1
- package/dist/components/bn-image.js +1 -1
- package/dist/components/bn-layout-card.js +1 -1
- package/dist/components/bn-layout-page.js +1 -1
- package/dist/components/bn-page.js +1 -1
- package/dist/components/bn-table-renderer.js +1 -1
- package/dist/components/bn-table.js +1 -1
- package/dist/components/bn-text.js +1 -1
- package/dist/components/bn-title.js +1 -1
- package/dist/components/bn-tree.js +1 -1
- package/dist/components/p-1B_s8oPY.js +1 -0
- package/dist/components/{p-BqUB56k1.js → p-B4L069XF.js} +1 -1
- package/dist/components/p-BC4MwlnX.js +1 -0
- package/dist/components/p-BZXiWkDS.js +1 -0
- package/dist/components/p-BiSytXUy.js +1 -0
- package/dist/components/p-Bn7J1pgl.js +1 -0
- package/dist/components/{p-BmOWXYHF.js → p-CEf5X8MZ.js} +1 -1
- package/dist/components/{p-BhEdmPjm.js → p-CUSAlS2o.js} +1 -1
- package/dist/components/p-ChaSU4fh.js +1 -0
- package/dist/components/p-CvEdUq8i.js +1 -0
- package/dist/components/{p-OquycEMA.js → p-D40Am1Ap.js} +1 -1
- package/dist/components/{p-CQVAHG6w.js → p-DM4Up10X.js} +1 -1
- package/dist/components/{p-Bo_R7f_T.js → p-DwuXVo2h.js} +1 -1
- package/dist/components/{p-t4xPltK2.js → p-XFZYX7DZ.js} +1 -1
- package/dist/components/{p-DTmqMQpw.js → p-Y9bth2Y_.js} +1 -1
- package/dist/components/{p-C_6KHDYv.js → p-chnyMHJT.js} +1 -1
- package/dist/components/{p-BU_53KVT.js → p-xIWChKGS.js} +1 -1
- package/dist/esm/bn-annotation-layer_30.entry.js +1037 -485
- package/dist/esm/bn-grid.entry.js +1 -1
- package/dist/esm/bn-image.entry.js +1 -1
- package/dist/esm/bn-template-engine.js +1 -1
- package/dist/esm/bn-text.entry.js +2 -2
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{withStyled-CIoJ86RM.js → withStyled-CzzXg64f.js} +77 -4
- package/dist/esm/{withTranslation-BX9T3dfm.js → withTranslation-Daq2JXkv.js} +1 -1
- package/dist/types/components/bn-table/bn-table-renderer/bn-table-renderer.d.ts +22 -1
- package/dist/types/components/bn-table/bn-table.d.ts +72 -1
- package/dist/types/components/bn-table/utils/Table.d.ts +11 -1
- package/dist/types/components/bn-table/utils/elements/Cell.d.ts +3 -0
- package/dist/types/components/bn-table/utils/elements/CellBarChart.d.ts +26 -0
- package/dist/types/components/bn-table/utils/elements/WaterfallBar.d.ts +22 -2
- package/dist/types/components/bn-table/utils/factories/tableDataSetFactory.d.ts +7 -4
- package/dist/types/components/bn-table/utils/helper/DataQuery.d.ts +13 -0
- package/dist/types/components/bn-table/utils/helper/IntervalColumns.d.ts +7 -0
- package/dist/types/components/bn-table/utils/helper/WaterfallCalculator.d.ts +30 -2
- package/dist/types/components/bn-table/utils/helper/barColumnGeometry.d.ts +24 -4
- package/dist/types/components/bn-table/utils/model/TableComponentConfig.d.ts +9 -1
- package/dist/types/components/bn-table/utils/model/index.d.ts +5 -0
- package/dist/types/components.d.ts +66 -6
- package/dist/types/utils/layoutState/baseline.d.ts +4 -2
- package/dist/types/utils/validate.d.ts +1 -0
- package/package.json +1 -1
- package/dist/bn-template-engine/p-BVU4bIsi.js +0 -1
- package/dist/bn-template-engine/p-e15ccc4a.entry.js +0 -1
- package/dist/components/p--HIZm_2v.js +0 -1
- package/dist/components/p-C-KX1_tw.js +0 -1
- package/dist/components/p-DCPLGEs_.js +0 -1
- package/dist/components/p-DT04Cka0.js +0 -1
- package/dist/components/p-Dm6EAaJ9.js +0 -1
- package/dist/components/p-sar8m7th.js +0 -1
- package/dist/components/p-tkB96Ena.js +0 -1
|
@@ -1,5 +1,54 @@
|
|
|
1
1
|
import { TableRowType, TableType } from "../model";
|
|
2
2
|
import { QueryColumnNames } from "../../../../utils/model";
|
|
3
|
+
import { VarianceScenario } from "../../../../utils/model/VarianceScenario";
|
|
4
|
+
function sameCoordinate(a, b) {
|
|
5
|
+
return Math.abs(a - b) <= 1e-9 * Math.max(1, Math.abs(a), Math.abs(b));
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Sets the connectors of a variance walk in print order. A null unit is a printed row
|
|
9
|
+
* without a bar. Two rows are joined only where the walk goes on: a group that restarts
|
|
10
|
+
* at zero gets no line from the sum row above it.
|
|
11
|
+
*/
|
|
12
|
+
function connectWalk(units, thereofAbove) {
|
|
13
|
+
const add = (bar, at, part) => {
|
|
14
|
+
var _a;
|
|
15
|
+
bar.connectors = [...((_a = bar.connectors) !== null && _a !== void 0 ? _a : []), { at, part }];
|
|
16
|
+
};
|
|
17
|
+
const link = (from, between, to, at) => {
|
|
18
|
+
add(from, at, "bottom");
|
|
19
|
+
between.forEach((bar) => add(bar, at, "through"));
|
|
20
|
+
add(to, at, "top");
|
|
21
|
+
};
|
|
22
|
+
let previous = null;
|
|
23
|
+
for (const unit of units) {
|
|
24
|
+
if (unit === null) {
|
|
25
|
+
previous = null;
|
|
26
|
+
continue;
|
|
27
|
+
}
|
|
28
|
+
const { main, children } = unit;
|
|
29
|
+
const entry = main.kind === "anchor" ? main.end : main.start;
|
|
30
|
+
if (previous && !unit.gapAbove && sameCoordinate(previous.main.end, entry)) {
|
|
31
|
+
// the line runs beside the thereof rows printed between the two rows
|
|
32
|
+
link(previous.main, thereofAbove ? children : previous.children, main, entry);
|
|
33
|
+
}
|
|
34
|
+
if (!unit.gapAbove && !unit.gapBelow) {
|
|
35
|
+
children.forEach((child, index) => {
|
|
36
|
+
if (index > 0)
|
|
37
|
+
link(children[index - 1], [], child, child.start);
|
|
38
|
+
});
|
|
39
|
+
if (children.length > 0) {
|
|
40
|
+
const last = children[children.length - 1];
|
|
41
|
+
if (!thereofAbove) {
|
|
42
|
+
link(main, [], children[0], main.start);
|
|
43
|
+
}
|
|
44
|
+
else if (sameCoordinate(last.end, main.end)) {
|
|
45
|
+
link(last, [], main, main.end);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
previous = unit.gapBelow ? null : unit;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
3
52
|
/**
|
|
4
53
|
* Waterfall geometry per raw result row and column, keyed by row identity
|
|
5
54
|
* (the factory iterates the same row objects the calculator walked).
|
|
@@ -7,6 +56,7 @@ import { QueryColumnNames } from "../../../../utils/model";
|
|
|
7
56
|
export class WaterfallResult {
|
|
8
57
|
constructor() {
|
|
9
58
|
this.geometry = new Map();
|
|
59
|
+
this.columns = new Set();
|
|
10
60
|
}
|
|
11
61
|
set(row, column, data) {
|
|
12
62
|
let columns = this.geometry.get(row);
|
|
@@ -15,11 +65,16 @@ export class WaterfallResult {
|
|
|
15
65
|
this.geometry.set(row, columns);
|
|
16
66
|
}
|
|
17
67
|
columns.set(column, data);
|
|
68
|
+
this.columns.add(column);
|
|
18
69
|
}
|
|
19
70
|
get(row, column) {
|
|
20
71
|
var _a;
|
|
21
72
|
return (_a = this.geometry.get(row)) === null || _a === void 0 ? void 0 : _a.get(column);
|
|
22
73
|
}
|
|
74
|
+
/** True when the column has waterfall bars, also for a row of it that got none. */
|
|
75
|
+
has(column) {
|
|
76
|
+
return this.columns.has(column);
|
|
77
|
+
}
|
|
23
78
|
}
|
|
24
79
|
/** True when the result contains grouping structure (sum, subtotal, or drill rows). */
|
|
25
80
|
export function hasGroupingStructure(queryData) {
|
|
@@ -36,12 +91,25 @@ export function hasGroupingStructure(queryData) {
|
|
|
36
91
|
}
|
|
37
92
|
return false;
|
|
38
93
|
}
|
|
94
|
+
/**
|
|
95
|
+
* Alias of the signed sum of a bar column on the generated REST row of an OPT table. The
|
|
96
|
+
* row prints the unsigned sum of the rows it folds, the walk needs the signed one.
|
|
97
|
+
*/
|
|
98
|
+
export function restSignedAlias(column) {
|
|
99
|
+
return `${column}__signed`;
|
|
100
|
+
}
|
|
101
|
+
/** Sign of an OPT entry row; the generated REST row has `restOperation` in place of `operation`. */
|
|
102
|
+
function operationSign(row) {
|
|
103
|
+
var _a;
|
|
104
|
+
return ((_a = row[QueryColumnNames.OPERATION]) !== null && _a !== void 0 ? _a : row.restOperation) === "-" ? -1 : 1;
|
|
105
|
+
}
|
|
39
106
|
/**
|
|
40
107
|
* Signed waterfall contribution of a row for one column.
|
|
41
108
|
*
|
|
42
109
|
* Non-OPT table types aggregate `SUM(scn * transformOperator(operation))`, so ENTRY
|
|
43
110
|
* values arrive already signed. OPT types aggregate plain `SUM(scn)` with the sign
|
|
44
|
-
* carried in the visible operation column, so the sign is applied here.
|
|
111
|
+
* carried in the visible operation column, so the sign is applied here. A REST row that
|
|
112
|
+
* folds "+" and "-" rows has no single sign, it brings its signed sum. Sum rows are
|
|
45
113
|
* fully signed in both modes.
|
|
46
114
|
*/
|
|
47
115
|
function signedValue(row, column, tableType) {
|
|
@@ -54,8 +122,9 @@ function signedValue(row, column, tableType) {
|
|
|
54
122
|
return null;
|
|
55
123
|
}
|
|
56
124
|
const isOpt = tableType === TableType.OPT || tableType === TableType.OPTNOTOTAL;
|
|
57
|
-
if (isOpt && row[QueryColumnNames.TYPE] === TableRowType.ENTRY
|
|
58
|
-
|
|
125
|
+
if (isOpt && row[QueryColumnNames.TYPE] === TableRowType.ENTRY) {
|
|
126
|
+
const signed = row[restSignedAlias(column)];
|
|
127
|
+
return typeof signed === "number" ? signed : operationSign(row) * value;
|
|
59
128
|
}
|
|
60
129
|
return value;
|
|
61
130
|
}
|
|
@@ -64,6 +133,7 @@ function signedValue(row, column, tableType) {
|
|
|
64
133
|
* segmented query result once per column in display order.
|
|
65
134
|
*
|
|
66
135
|
* - ENTRY rows (incl. REST) cascade from the running total by their signed value.
|
|
136
|
+
* The REST row of an OPT table takes the sign of `restOperation`, or its signed sum.
|
|
67
137
|
* - SUM / GROUP_SUM rows anchor at zero. A SUM row resets the running total to its
|
|
68
138
|
* value, a GROUP_SUM row resets it to zero.
|
|
69
139
|
* - DRILLELEMENT (thereof) rows form a sub-cascade from their parent bar's start in
|
|
@@ -73,53 +143,92 @@ function signedValue(row, column, tableType) {
|
|
|
73
143
|
* `createPartOfDrillRows`, not literally the parent row's value.
|
|
74
144
|
* - GROUPHEAD rows get no bar and restart the running total at zero: every row group
|
|
75
145
|
* is its own cascade that ends at its GROUP_SUM.
|
|
146
|
+
* - With `runningSum` a GROUP_SUM row holds the result of all groups so far, so the
|
|
147
|
+
* cascade goes on from its value and no GROUPHEAD restarts it.
|
|
76
148
|
* - NaN rows get no bar; a NaN parent orphans its drill children.
|
|
77
149
|
*
|
|
150
|
+
* An absolute variance column walks the same way with three differences: a thereof row
|
|
151
|
+
* steps by its signed value times the operation sign of its parent, so its siblings can
|
|
152
|
+
* go both ways and leave the parent bar; a partof row gets no bar; and the bars carry
|
|
153
|
+
* connectors to the rows printed above and below.
|
|
154
|
+
*
|
|
78
155
|
* @param queryData - Segmented result rows from DataQuery.execute().
|
|
79
|
-
* @param columns - Plain scenario
|
|
156
|
+
* @param columns - Plain scenario (ac1..pl4) or absolute variance column keys; no `##` composite keys.
|
|
80
157
|
* @param tableType - Table aggregation mode, needed for OPT sign handling.
|
|
158
|
+
* @param runningSum - True when the GROUP_SUM rows are running results.
|
|
159
|
+
* @param thereofAbove - True when thereof rows are printed above their parent; only the connectors depend on it.
|
|
81
160
|
*/
|
|
82
|
-
export function computeWaterfall(queryData, columns, tableType) {
|
|
161
|
+
export function computeWaterfall(queryData, columns, tableType, runningSum = false, thereofAbove = false) {
|
|
83
162
|
const result = new WaterfallResult();
|
|
163
|
+
const isOpt = tableType === TableType.OPT || tableType === TableType.OPTNOTOTAL;
|
|
84
164
|
for (const column of columns) {
|
|
165
|
+
const variance = new VarianceScenario(column).isValid;
|
|
85
166
|
let running = 0;
|
|
86
167
|
let lastParent;
|
|
87
168
|
let subCursor = 0;
|
|
88
169
|
const emitted = [];
|
|
170
|
+
const units = [];
|
|
171
|
+
let unit = null;
|
|
89
172
|
const emit = (row, data) => {
|
|
90
173
|
emitted.push(data);
|
|
91
174
|
result.set(row, column, data);
|
|
175
|
+
return data;
|
|
176
|
+
};
|
|
177
|
+
const startUnit = (main) => {
|
|
178
|
+
unit = main && { main, children: [], gapAbove: false, gapBelow: false };
|
|
179
|
+
units.push(unit);
|
|
92
180
|
};
|
|
93
181
|
for (const groupData of queryData) {
|
|
94
182
|
for (const row of groupData) {
|
|
95
183
|
const type = row[QueryColumnNames.TYPE];
|
|
96
184
|
if (type === TableRowType.GROUPHEAD) {
|
|
97
185
|
// a group sum only totals its own rows, so the cascade must not carry over
|
|
98
|
-
|
|
186
|
+
if (!runningSum) {
|
|
187
|
+
running = 0;
|
|
188
|
+
}
|
|
99
189
|
lastParent = undefined;
|
|
190
|
+
startUnit(null);
|
|
100
191
|
continue;
|
|
101
192
|
}
|
|
102
193
|
const value = signedValue(row, column, tableType);
|
|
103
194
|
if (type === TableRowType.ENTRY) {
|
|
104
195
|
if (value === null) {
|
|
105
196
|
lastParent = undefined;
|
|
197
|
+
startUnit(null);
|
|
106
198
|
continue;
|
|
107
199
|
}
|
|
108
|
-
emit(row, { start: running, end: running + value, min: 0, max: 0, kind: "cascade" });
|
|
109
|
-
|
|
200
|
+
startUnit(emit(row, { start: running, end: running + value, min: 0, max: 0, kind: "cascade" }));
|
|
201
|
+
// thereof values of an OPT table are unsigned like the entries, so they take the sign of the parent
|
|
202
|
+
const sign = isOpt ? operationSign(row) : 1;
|
|
203
|
+
lastParent = { start: running, end: running + value, sign };
|
|
110
204
|
subCursor = lastParent.start;
|
|
111
205
|
running += value;
|
|
112
206
|
}
|
|
113
207
|
else if (type === TableRowType.SUM || type === TableRowType.GROUPSUM) {
|
|
114
208
|
if (value === null) {
|
|
115
209
|
lastParent = undefined;
|
|
210
|
+
startUnit(null);
|
|
116
211
|
continue;
|
|
117
212
|
}
|
|
118
|
-
emit(row, { start: 0, end: value, min: 0, max: 0, kind: "anchor" });
|
|
119
|
-
lastParent = { start: 0, end: value };
|
|
213
|
+
startUnit(emit(row, { start: 0, end: value, min: 0, max: 0, kind: "anchor" }));
|
|
214
|
+
lastParent = { start: 0, end: value, sign: 1 };
|
|
120
215
|
subCursor = 0;
|
|
121
216
|
// a group sum closes its group (there may be no GROUPHEAD row when the title is hidden)
|
|
122
|
-
running = type === TableRowType.GROUPSUM ? 0 : value;
|
|
217
|
+
running = type === TableRowType.GROUPSUM && !runningSum ? 0 : value;
|
|
218
|
+
}
|
|
219
|
+
else if (variance && (type === TableRowType.DRILLELEMENT || type === TableRowType.PARTELEMENT)) {
|
|
220
|
+
if (type === TableRowType.DRILLELEMENT && value !== null && lastParent !== undefined && unit) {
|
|
221
|
+
const end = subCursor + lastParent.sign * value;
|
|
222
|
+
unit.children.push(emit(row, { start: subCursor, end, min: 0, max: 0, kind: "thereof" }));
|
|
223
|
+
subCursor = end;
|
|
224
|
+
}
|
|
225
|
+
else if (unit) {
|
|
226
|
+
// only thereof rows move above the parent
|
|
227
|
+
if (thereofAbove && type === TableRowType.DRILLELEMENT)
|
|
228
|
+
unit.gapAbove = true;
|
|
229
|
+
else
|
|
230
|
+
unit.gapBelow = true;
|
|
231
|
+
}
|
|
123
232
|
}
|
|
124
233
|
else if (type === TableRowType.DRILLELEMENT) {
|
|
125
234
|
if (value === null || lastParent === undefined) {
|
|
@@ -156,6 +265,9 @@ export function computeWaterfall(queryData, columns, tableType) {
|
|
|
156
265
|
}
|
|
157
266
|
}
|
|
158
267
|
}
|
|
268
|
+
if (variance) {
|
|
269
|
+
connectWalk(units, thereofAbove);
|
|
270
|
+
}
|
|
159
271
|
// All rows of a column share one coordinate system including zero
|
|
160
272
|
let min = 0;
|
|
161
273
|
let max = 0;
|
|
@@ -82,24 +82,27 @@ function labelMeasureContext() {
|
|
|
82
82
|
}
|
|
83
83
|
return measureContext;
|
|
84
84
|
}
|
|
85
|
+
/** Bold digits of a font can be wider than the regular ones the glyph table lists. */
|
|
86
|
+
const BOLD_WIDTH_MARGIN = 1.08;
|
|
85
87
|
/**
|
|
86
88
|
* Rendered width of a value label in px, measured with the font the SVG text uses. Falls
|
|
87
89
|
* back to estimateLabelWidth where no canvas can measure.
|
|
88
90
|
*/
|
|
89
|
-
export function labelWidth(text, fontSize, fontFamily, italic) {
|
|
91
|
+
export function labelWidth(text, fontSize, fontFamily, italic, bold = false) {
|
|
92
|
+
const estimate = () => estimateLabelWidth(text, fontSize) * (bold ? BOLD_WIDTH_MARGIN : 1);
|
|
90
93
|
const ctx = labelMeasureContext();
|
|
91
94
|
if (ctx) {
|
|
92
95
|
// the canvas ignores a font it cannot parse and keeps the last one: the sentinel shows that
|
|
93
96
|
ctx.font = FONT_SENTINEL;
|
|
94
97
|
const sentinel = ctx.font;
|
|
95
|
-
ctx.font = `${italic ? "italic " : ""}${fontSize}px ${fontFamily}`;
|
|
98
|
+
ctx.font = `${italic ? "italic " : ""}${bold ? "bold " : ""}${fontSize}px ${fontFamily}`;
|
|
96
99
|
if (ctx.font === sentinel)
|
|
97
|
-
return
|
|
100
|
+
return estimate();
|
|
98
101
|
const width = ctx.measureText(text).width;
|
|
99
102
|
if (Number.isFinite(width) && (width > 0 || text === ""))
|
|
100
103
|
return width + MEASURE_PAD * fontSize;
|
|
101
104
|
}
|
|
102
|
-
return
|
|
105
|
+
return estimate();
|
|
103
106
|
}
|
|
104
107
|
/** The SVG fills the cell's content box: the requested column width minus the cell padding. */
|
|
105
108
|
function contentWidth(widthEm, emPx) {
|
|
@@ -215,13 +218,58 @@ export function relativePinGeometry(widthEm, emPx, labels, headSize, reach) {
|
|
|
215
218
|
labelGap,
|
|
216
219
|
};
|
|
217
220
|
}
|
|
218
|
-
|
|
221
|
+
/**
|
|
222
|
+
* Without `column` both sides get the fixed gutter. With it each side gets the room its
|
|
223
|
+
* labels need beyond the bar area at the scale of the bars. The bar area keeps at least
|
|
224
|
+
* half the width: only gutters that need more shrink, and a side that fits the fixed
|
|
225
|
+
* gutter keeps its room then.
|
|
226
|
+
*/
|
|
227
|
+
export function waterfallGeometry(widthEm, emPx, column) {
|
|
219
228
|
const totalWidth = contentWidth(widthEm, emPx);
|
|
220
|
-
const
|
|
229
|
+
const labelGap = LABEL_GAP_EM * emPx;
|
|
230
|
+
const fixed = Math.min(BAR_LABEL_EM * emPx, totalWidth / 4);
|
|
231
|
+
let left = fixed;
|
|
232
|
+
let right = fixed;
|
|
233
|
+
const range = column ? column.max - column.min : 0;
|
|
234
|
+
if (column && range > 0) {
|
|
235
|
+
// what the labels of one side stick out of the bar area at the given scale
|
|
236
|
+
const room = (pointsLeft, pxPerUnit) => Math.max(0, ...column.labels
|
|
237
|
+
.filter((label) => label.pointsLeft === pointsLeft)
|
|
238
|
+
.map((label) => label.width + labelGap - (pointsLeft ? label.end - column.min : column.max - label.end) * pxPerUnit));
|
|
239
|
+
left = room(true, 0);
|
|
240
|
+
right = room(false, 0);
|
|
241
|
+
const budget = totalWidth / 2;
|
|
242
|
+
// a label needs less room the further its bar ends from the edge; a smaller gutter only widens the scale.
|
|
243
|
+
// One pass is enough for gutters that fit; more passes only while they take more than half the width.
|
|
244
|
+
for (let pass = 0; pass < 8; pass++) {
|
|
245
|
+
const pxPerUnit = Math.max(0, totalWidth - left - right) / range;
|
|
246
|
+
const nextLeft = Math.min(left, room(true, pxPerUnit));
|
|
247
|
+
const nextRight = Math.min(right, room(false, pxPerUnit));
|
|
248
|
+
const settled = nextLeft + nextRight <= budget || (nextLeft === left && nextRight === right);
|
|
249
|
+
left = nextLeft;
|
|
250
|
+
right = nextRight;
|
|
251
|
+
if (settled)
|
|
252
|
+
break;
|
|
253
|
+
}
|
|
254
|
+
if (left + right > budget) {
|
|
255
|
+
if (Math.min(left, right) > fixed) {
|
|
256
|
+
const shrink = budget / (left + right);
|
|
257
|
+
left *= shrink;
|
|
258
|
+
right *= shrink;
|
|
259
|
+
}
|
|
260
|
+
else if (left <= right) {
|
|
261
|
+
right = budget - left;
|
|
262
|
+
}
|
|
263
|
+
else {
|
|
264
|
+
left = budget - right;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
}
|
|
221
268
|
return {
|
|
222
269
|
totalWidth,
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
270
|
+
labelAreaLeft: left,
|
|
271
|
+
labelAreaRight: right,
|
|
272
|
+
barAreaWidth: totalWidth - left - right,
|
|
273
|
+
labelGap,
|
|
226
274
|
};
|
|
227
275
|
}
|
|
@@ -5,7 +5,7 @@ import { CompareUtil } from "../../../../utils/helper/CompareUtil";
|
|
|
5
5
|
import { StringAdapter } from "../../../../utils/helper/StringAdapter";
|
|
6
6
|
import { OrderAdapter } from "../../../../utils/model/Order";
|
|
7
7
|
import { SiPrefix } from "../../../../utils/model/SiPrefix";
|
|
8
|
-
import { TableType } from "./index";
|
|
8
|
+
import { TableType, ThereofPosition } from "./index";
|
|
9
9
|
/**
|
|
10
10
|
* Configuration for an IBCS table component.
|
|
11
11
|
*
|
|
@@ -30,8 +30,14 @@ export class TableComponentConfig {
|
|
|
30
30
|
/** When true, rows are visually grouped by rowGroup. */
|
|
31
31
|
this.grouped = false;
|
|
32
32
|
this.showGroupTitle = true;
|
|
33
|
+
/** When true, each group sum row holds the running result of all groups up to its own (see bn-table `runningSum` prop). */
|
|
34
|
+
this.runningSum = false;
|
|
35
|
+
/** When true, absolute variance bar columns are drawn as a waterfall (see bn-table `varianceWaterfall` prop). */
|
|
36
|
+
this.varianceWaterfall = false;
|
|
33
37
|
/** Drill-down sub-row definitions -- "thereof" breakdowns within a category. */
|
|
34
38
|
this.thereOf = [];
|
|
39
|
+
/** Thereof rows below or above their parent row (see bn-table `thereofPosition` prop). */
|
|
40
|
+
this.thereOfPosition = ThereofPosition.BELOW;
|
|
35
41
|
/** Column-level drill-down using `##` separator in category names. */
|
|
36
42
|
this.categoryThereOf = new Map();
|
|
37
43
|
/** Percentage-of-total sub-row definitions. */
|
|
@@ -59,6 +65,8 @@ export class TableComponentConfig {
|
|
|
59
65
|
this.barColumns = [];
|
|
60
66
|
/** Interval column grouping: "none", "setname" or a DateDistance value (see bn-table `interval` prop). */
|
|
61
67
|
this.interval = "none";
|
|
68
|
+
/** Number of interval groups left of the row header block (see bn-table `categoryIntervalPosition` prop). */
|
|
69
|
+
this.categoryIntervalPosition = 0;
|
|
62
70
|
/** Locale used for interval bucket labels. */
|
|
63
71
|
this.locale = "de";
|
|
64
72
|
}
|
|
@@ -94,6 +102,15 @@ export class TableComponentConfigAdapter {
|
|
|
94
102
|
if (CompareUtil.isBoolean(data.showGroupTitle)) {
|
|
95
103
|
config.showGroupTitle = data.showGroupTitle;
|
|
96
104
|
}
|
|
105
|
+
if (CompareUtil.isBoolean(data.runningSum)) {
|
|
106
|
+
config.runningSum = data.runningSum;
|
|
107
|
+
}
|
|
108
|
+
if (CompareUtil.isBoolean(data.varianceWaterfall)) {
|
|
109
|
+
config.varianceWaterfall = data.varianceWaterfall;
|
|
110
|
+
}
|
|
111
|
+
if (data.thereOfPosition === ThereofPosition.ABOVE) {
|
|
112
|
+
config.thereOfPosition = ThereofPosition.ABOVE;
|
|
113
|
+
}
|
|
97
114
|
if (CompareUtil.isBoolean(data.showMeasureScale)) {
|
|
98
115
|
config.showMeasureScale = data.showMeasureScale;
|
|
99
116
|
}
|
|
@@ -142,6 +159,9 @@ export class TableComponentConfigAdapter {
|
|
|
142
159
|
if (CompareUtil.isString(data.interval)) {
|
|
143
160
|
config.interval = data.interval;
|
|
144
161
|
}
|
|
162
|
+
if (CompareUtil.isNumber(data.categoryIntervalPosition)) {
|
|
163
|
+
config.categoryIntervalPosition = data.categoryIntervalPosition;
|
|
164
|
+
}
|
|
145
165
|
if (CompareUtil.isString(data.locale)) {
|
|
146
166
|
config.locale = data.locale;
|
|
147
167
|
}
|
|
@@ -31,6 +31,12 @@ export var TableType;
|
|
|
31
31
|
TableType["OPT"] = "opt";
|
|
32
32
|
TableType["OPTNOTOTAL"] = "optnototal";
|
|
33
33
|
})(TableType || (TableType = {}));
|
|
34
|
+
/** Where thereof rows stand: below their parent row, or above it like the components of a subtotal. */
|
|
35
|
+
export var ThereofPosition;
|
|
36
|
+
(function (ThereofPosition) {
|
|
37
|
+
ThereofPosition["BELOW"] = "below";
|
|
38
|
+
ThereofPosition["ABOVE"] = "above";
|
|
39
|
+
})(ThereofPosition || (ThereofPosition = {}));
|
|
34
40
|
export var OrderDirection;
|
|
35
41
|
(function (OrderDirection) {
|
|
36
42
|
OrderDirection["ASC"] = "asc";
|
|
@@ -39,8 +39,10 @@ export function readChartBaseline(host, innerTag) {
|
|
|
39
39
|
}
|
|
40
40
|
/**
|
|
41
41
|
* Baseline of a rendered `<table>`, in the layout px of `host`: y is the
|
|
42
|
-
* bottom of the header, x the left edge of the first value column
|
|
43
|
-
*
|
|
42
|
+
* bottom of the header, x the left edge of the first value column of the last
|
|
43
|
+
* header row, else of the first body row. That is the first cell that is not
|
|
44
|
+
* the operation or the category column. Interval groups can stand left of the
|
|
45
|
+
* category column, then it is the first cell of the row.
|
|
44
46
|
*/
|
|
45
47
|
export function readTableBaseline(table, host) {
|
|
46
48
|
var _a;
|
|
@@ -56,10 +58,9 @@ export function readTableBaseline(table, host) {
|
|
|
56
58
|
const rows = (section) => section ? Array.from(section.children).filter((child) => child.localName === "tr") : [];
|
|
57
59
|
const headerRows = rows(thead);
|
|
58
60
|
const row = (_a = headerRows[headerRows.length - 1]) !== null && _a !== void 0 ? _a : rows(table.querySelector("tbody"))[0];
|
|
59
|
-
// an operation column can come before the category column (table type opt)
|
|
60
61
|
const cells = row ? Array.from(row.children) : [];
|
|
61
|
-
const
|
|
62
|
-
const valueCell = cells
|
|
62
|
+
const isRowHeader = (cell) => cell.classList.contains("category") || cell.classList.contains("operation");
|
|
63
|
+
const valueCell = cells.some(isRowHeader) ? cells.find((cell) => !isRowHeader(cell)) : cells[1];
|
|
63
64
|
if (valueCell) {
|
|
64
65
|
baseline.x = round2(frame.toLocal(valueCell.getBoundingClientRect()).x);
|
|
65
66
|
}
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* without crashing the component.
|
|
7
7
|
*/
|
|
8
8
|
import { AggregationLevel, AxisLabelsMode, DataFormat, I18nMode, MeasureType, Scenarios, Sentiments, TableBarColumnWidth, TableCategoryWidth, TableType, } from "./constants";
|
|
9
|
+
import { ThereofPosition } from "../components/bn-table/utils/model";
|
|
9
10
|
import { isValidAttributeExpression } from "../components/bn-table/utils/model/TableAttribute";
|
|
10
11
|
import { DateDistance, DateLink } from "./DateStringFactory";
|
|
11
12
|
import { OrderColumn, OrderDirection, parseOrderToken } from "./model/Order";
|
|
@@ -200,6 +201,9 @@ export function isValidTableType(value) {
|
|
|
200
201
|
}
|
|
201
202
|
return (value === null || value === void 0 ? void 0 : value.toUpperCase()) in TableType;
|
|
202
203
|
}
|
|
204
|
+
export function isValidThereofPosition(value) {
|
|
205
|
+
return (value === null || value === void 0 ? void 0 : value.toUpperCase()) in ThereofPosition;
|
|
206
|
+
}
|
|
203
207
|
export function validateThereOfJsonStr(value) {
|
|
204
208
|
if (isBlankInput(value)) {
|
|
205
209
|
return [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{B as o,d as
|
|
1
|
+
import{B as o,d as p}from"./p-DM4Up10X.js";const s=o,r=p;export{s as BnChartBubbleRenderer,r as defineCustomElement}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as t,H as e,w as i,f as s,h as a,a as r,t as n}from"./p-D6YGOYV1.js";import{h as l,a as o}from"./p-DDvWTgk1.js";import{o as h}from"./p-DaOm9YwQ.js";import{c}from"./p-sar8m7th.js";import{a as d}from"./p-t4xPltK2.js";import{g as u}from"./p-DD1zlev_.js";import{c as p}from"./p-D2Epww9R.js";import{o as v}from"./p-B6kka9sT.js";import{p as m}from"./p-Xb6Ilq8u.js";import{i as f,h as b,j as y}from"./p-DT04Cka0.js";import{w as g}from"./p-Dq9dG0Kr.js";import{w as x}from"./p-DjPWZfry.js";import{w}from"./p-DJUffGeB.js";import{w as _}from"./p-4vVbchX2.js";import{w as S}from"./p-OquycEMA.js";import{w as j}from"./p-DQl2K2Xl.js";import{w as R}from"./p-BU_53KVT.js";import{w as L}from"./p-Bo_R7f_T.js";import{r as $,s as E}from"./p-BXXjh6We.js";import{t as z,a as A,b as W,c as N,d as k,e as D,p as O}from"./p-9mUU4itF.js";import{s as F}from"./p-DakXa7Dp.js";import{d as C}from"./p-CQVAHG6w.js";const G={rowGroup:0,category:1,subCategory:2},M=["ac","pp","fc","pl"],T=t(class extends e{validateFilter(t){const e="ERR_filter";l(t)?this.errors.addOrReplace({id:e,type:"error",message:"filter: double backticks are not allowed."}):this.errors.remove(e)}validateX(t){this.validateMeasureSpec("x",t,!0,(t=>z(t)))}validateY(t){this.validateMeasureSpec("y",t,!0,(t=>z(t)))}validateSize(t){this.validateMeasureSpec("size",t,!0,(t=>A(t))),this.validateSizeScaling()}validateShare(t){this.validateMeasureSpec("share",t,!1,(t=>W(t)))}validateCompareWith(t){const e="WARN_compareWith";f(t)||M.includes(t.trim().toLowerCase())?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`compare-with: invalid value '${t}' - expected ${M.join("/")}; ignored.`})}validateLevel(t){const e="WARN_level",i=["auto","category","subcategory"];f(t)||i.includes(t.trim().toLowerCase())?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`level: invalid value '${t}' - expected ${i.join("/")}; using 'auto'.`})}validateSeriesLevel(t){const e="WARN_seriesLevel",i=["auto","rowgroup","category","none"];f(t)||i.includes(t.trim().toLowerCase())?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`series-level: invalid value '${t}' - expected ${i.join("/")}; using 'auto'.`})}validateFacet(t){this.validateObjectSpec("facet",t,(t=>N(t)))}validateLabels(t){this.validateObjectSpec("labels",t,(t=>k(t,this.labelDefaults())))}validateLegend(t){this.validateObjectSpec("legend",t,(t=>D(t)))}validateAspect(t){const e="WARN_aspect";f(t)||null!==this.parseAspect(t)?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`aspect: invalid value '${t}' - expected "w:h" (e.g. "16:9"); using the default.`})}validateLimit(t){const e="WARN_limit";b(t)&&Number(t)>=0?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`limit: invalid value '${t}' - expected a non-negative integer; using 0.`})}validateScale(t){const e="WARN_scale";if(f(t))return void this.errors.remove(e);const{mode:i,factor:s}=m(t);"factor"===i&&(void 0===s||s<=0)?this.errors.addOrReplace({id:e,type:"warning",message:`scale: invalid value '${t}' - expected none/auto or a positive number.`}):this.errors.remove(e)}constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.datasetName="",this.dataVersion=0,this.datasetMeta=null,this.appliedScaleFactor=1,this.layoutObserver=null,this.activeErrors=new Set,this.pixelPerUnitGroupMap=new Map,this.chartTitle="",this.filter="",this.share="",this.compareWith="",this.level="auto",this.seriesLevel="auto",this.facet="",this.labels="",this.legend="",this.aspect="16:9",this.limit=0,this._autoScaleGuard=!1,this._lastObservedWidth=0,this.translateForInner=(t,e)=>this.t(t,e),L(this),g(this),w(this,(t=>{this.datasetName=(null==t?void 0:t.startsWith("$"))?t.substring(1):t||"",this.dataVersion=this.dataVersion+1}),((t,e)=>{this.datasetMeta=e})),this.errors=_(this),j(this),this.componentStyle=x(this),this.ruleSetConfig=S(this),this.t=R(this).t}componentWillLoad(){this.validateFilter(this.filter),this.validateX(this.x),this.validateY(this.y),this.validateSize(this.size),this.validateShare(this.share),this.validateCompareWith(this.compareWith),this.validateLevel(this.level),this.validateSeriesLevel(this.seriesLevel),this.validateFacet(this.facet),this.validateLabels(this.labels),this.validateLegend(this.legend),this.validateAspect(this.aspect),this.validateLimit(this.limit),this.validateScale(this.scale)}componentDidRender(){F(this.element,"bn-chart-bubble-renderer");const{mode:t}=m(this.scale);if("auto"!==t&&"empty"!==t)return this._autoScaleGuard=!1,void this.checkOverflow();if(this._autoScaleGuard)return this._autoScaleGuard=!1,void this.checkOverflow();const e=this.element,{width:s}=u(e);if(s<=0)return void this.checkOverflow();this._lastObservedWidth=s;const a=this.componentStyle((t=>{var e;return(null===(e=t.global)||void 0===e?void 0:e.fontSizePx)||13.3333})),r=e.scrollWidth,n=this.appliedScaleFactor;if(!Number.isFinite(r)||r<=s+1)return this.errors.remove("AUTO_scale"),void this.checkOverflow();const l=Math.max(.3,n*(s-1)/r);Math.abs(l-n)<.01||(e.style.setProperty("--bn-font-size",a*l+"px"),"empty"===t?this.errors.addOrReplace({id:"AUTO_scale",type:"warning",message:"Auto-scaled chart by factor "+l.toFixed(3)}):this.errors.remove("AUTO_scale"),this._autoScaleGuard=!0,i((()=>{this.appliedScaleFactor=l}))),this.checkOverflow()}checkOverflow(){p(this.element,"bn-chart-bubble-renderer",this.errors)}componentDidLoad(){this.layoutObserver=v(this.element,(()=>{if(this._autoScaleGuard)return;const{width:t}=u(this.element);t>0&&Math.abs(t-this._lastObservedWidth)>2?(this._lastObservedWidth=t,s(this)):this.checkOverflow()})),requestAnimationFrame((()=>{requestAnimationFrame((()=>{if(this._autoScaleGuard)return;const{width:t}=u(this.element);this._lastObservedWidth=t,s(this)}))}))}disconnectedCallback(){var t;null===(t=this.layoutObserver)||void 0===t||t.disconnect(),this.layoutObserver=null}labelDefaults(){return{points:"all",values:!0,max:12}}setBlockingError(t,e){null===e?(this.errors.remove(t),this.activeErrors.delete(t)):(this.errors.addOrReplace({id:t,type:"error",message:e}),this.activeErrors.add(t))}hasBlockingErrors(){return this.activeErrors.size>0}validateSizeScaling(){var t;const e=null===(t=this.prepareSize())||void 0===t?void 0:t.group;this.setBlockingError("ERR_xy_scale_group",void 0===e||this.pixelPerUnitGroupMap.has(e)?null:this.t(".bubble-scale-group-unknown",{group:e}))}validateMeasureSpec(t,e,i,s){var a;const r="ERR_xy_json_"+t,n="ERR_xy_measure_"+t,l="WARN_xy_fields_"+t,{data:o,parseError:h}=O(e,"measure");if(h)return this.setBlockingError(r,this.t(".xy-prop-json",{prop:t})),this.setBlockingError(n,null),void this.errors.remove(l);if(this.setBlockingError(r,null),null===o)return this.setBlockingError(n,i?this.t(".xy-measure-invalid",{prop:t,measure:""}):null),void this.errors.remove(l);const c=null!==(a=o.measure)&&void 0!==a?a:"";y(c)?this.setBlockingError(n,null):this.setBlockingError(n,this.t(".xy-measure-invalid",{prop:t,measure:c})),this.reportSpecIssues(l,t,s(o))}validateObjectSpec(t,e,i){const s="ERR_xy_json_"+t,a="WARN_xy_fields_"+t,{data:r,parseError:n}=O(e,null);if(n)return this.setBlockingError(s,this.t(".xy-prop-json",{prop:t})),void this.errors.remove(a);this.setBlockingError(s,null),null!==r?this.reportSpecIssues(a,t,i(r)):this.errors.remove(a)}reportSpecIssues(t,e,i){const s=[];null!==i&&i.invalidFields.length>0&&s.push("invalid: "+i.invalidFields.join(", ")),null!==i&&i.unknownKeys.length>0&&s.push("unknown: "+i.unknownKeys.join(", ")),s.length>0?this.errors.addOrReplace({id:t,type:"warning",message:`${e}: ignored sub-fields (${s.join("; ")}).`}):this.errors.remove(t)}prepareAxis(t,e){const{data:i,parseError:s}=O(e,"measure");if(s||null===i)return null;const{config:a}=z(i);return null!==a&&y(a.measure)?(void 0!==a.min&&void 0!==a.max&&a.min>=a.max?(this.errors.addOrReplace({id:"WARN_xy_domain_"+t,type:"warning",message:t+": min must be smaller than max; the override is ignored."}),a.min=void 0,a.max=void 0):this.errors.remove("WARN_xy_domain_"+t),a):null}prepareSize(){const{data:t,parseError:e}=O(this.size,"measure");if(e||null===t)return null;const{config:i}=A(t);return null!==i&&y(i.measure)?i:null}prepareShare(){const{data:t,parseError:e}=O(this.share,"measure");if(e||null===t)return null;const{config:i}=W(t);return null!==i&&y(i.measure)?i:null}prepareCompareFamily(){var t;const e=null===(t=this.compareWith)||void 0===t?void 0:t.trim().toLowerCase();return M.includes(e)?e:null}prepareLabels(){const t=this.labelDefaults(),{data:e,parseError:i}=O(this.labels,null);return i||null===e?{points:t.points,values:t.values,max:t.max}:k(e,t).config}prepareLegend(){const{data:t,parseError:e}=O(this.legend,null);return e||null===t?{show:!0,position:"right"}:D(t).config}prepareFacet(){const{data:t,parseError:e}=O(this.facet,null);return e||null===t?null:N(t).config}preparePointLevel(){var t,e;const i=null===(t=this.level)||void 0===t?void 0:t.trim().toLowerCase();if("category"===i)return"category";if("subcategory"===i)return"subCategory";const s=null===(e=this.datasetMeta)||void 0===e?void 0:e.suggestedLevel;return"rowGroup"===s||"category"===s||"subCategory"===s?s:"category"}prepareSeriesLevel(t){var e;const i=null===(e=this.seriesLevel)||void 0===e?void 0:e.trim().toLowerCase();return"none"===i?null:"rowgroup"===i?"rowGroup":"category"===i||"subCategory"===t?"category":"category"===t?"rowGroup":null}validateCrossProp(t,e){const i=new Set;let s=!1;for(const e of t){if(void 0===e)continue;const t=$(e);null!==t&&("scenario"===t.kind?i.add(E(t.slot)):s=!0)}this.setBlockingError("ERR_xy_family",i.size>1?this.t(".xy-family-mixed",{families:[...i].join(", ")}):null);const a=this.prepareCompareFamily();this.setBlockingError("ERR_xy_compare_variance",null!==a&&s?this.t(".xy-compare-variance"):null),this.setBlockingError("ERR_xy_compare_family",null!==a&&1===i.size&&i.has(a)?`compare-with: '${a}' is already the primary scenario family.`:null);const r=this.preparePointLevel(),n=this.prepareSeriesLevel(r),l=null!==e?"rowgroup"===e.level?"rowGroup":"category":null;let o=null;if(null!==n&&G[n]>=G[r]&&(o=`series '${n}' vs point '${r}'`),null!==l){const t=null!=n?n:r;G[l]>=G[t]&&(o=`facet '${l}' vs '${t}'`)}this.setBlockingError("ERR_xy_level_order",null!==o?this.t(".xy-level-order",{detail:o}):null)}parseAspect(t){const e=/^\s*(\d+(?:\.\d+)?)\s*:\s*(\d+(?:\.\d+)?)\s*$/.exec(null!=t?t:"");if(null===e)return null;const i=Number(e[1]),s=Number(e[2]);return i<=0||s<=0?null:i/s}prepareAspect(){var t;return null!==(t=this.parseAspect(this.aspect))&&void 0!==t?t:16/9}prepareLimit(){const t=Math.floor(Number(this.limit)||0);return t>0?t:0}prepareSizeAreaPerUnit(){var t;const e=null===(t=this.prepareSize())||void 0===t?void 0:t.group;if(void 0===e||!this.pixelPerUnitGroupMap.has(e))return 0;const i=this.pixelPerUnitGroupMap.get(e);if(!(i>0))return 0;const s=this.getEffectiveFontPx();return s*s/i}i18nLocalKeys(){return["no-data","axis.in","legend.title","legend.size","legend.compare"]}prepareI18n(){const t=new Map(this.i18nLocalKeys().map((t=>[t,this.t(".".concat(t))]))),e=new Map(o.map((t=>[t,this.t("global.".concat(t))])));return new Map([...e.entries(),...t.entries()])}prepareStyle(){const t=this.getEffectiveScaleFactor();return this.componentStyle((e=>{const i=e.global.fontSizePx*t;return{scaleFactors:e["bn-chart-bubble"].scaleFactors,fontStyles:{font:`${i}px ${e.global.fontFamily}`,size:i,color:e.global.fontColor,background:e.global.fontBackgroundColor,leading:1.8},axisStyles:e["bn-chart-bubble"].axisStyles,seriesColors:e["bn-chart-bubble"].seriesColors,padding:e["bn-chart-bubble"].padding}}))}async getBaseline(){return d(this.element,"bn-chart-bubble-renderer")}async getLayoutState(t){var e;const i=null!==(e=null==t?void 0:t.detail)&&void 0!==e?e:"summary",s=h(this.element),a=this.getEffectiveScaleFactor(),r=Number.isFinite(a)&&a>0?a:1,n=this.componentStyle((t=>{var e;return(null===(e=t.global)||void 0===e?void 0:e.fontSizePx)||13.3333}))*r;return c(this.element,"bn-chart-bubble-renderer",this.chartTitle||void 0,{fontSizePx:n,appliedScaleFactor:r},s,i)}getEffectiveScaleFactor(){const{mode:t,factor:e}=m(this.scale);return"factor"===t?e:"auto"===t||"empty"===t?this.appliedScaleFactor:1}getEffectiveFontPx(){return this.componentStyle((t=>{var e;return(null===(e=t.global)||void 0===e?void 0:e.fontSizePx)||13.3333}))*this.getEffectiveScaleFactor()}getFontStyles(){const t=this.getEffectiveScaleFactor();return this.componentStyle((e=>{var i,s,a,r;const n=(null===(i=e.global)||void 0===i?void 0:i.fontSizePx)||13.3333;return{"--bn-font-family":(null===(s=e.global)||void 0===s?void 0:s.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":n*t+"px","--bn-font-color":(null===(a=e.global)||void 0===a?void 0:a.fontColor)||"#000000","--bn-font-background":(null===(r=e.global)||void 0===r?void 0:r.fontBackgroundColor)||"#ffffff"}}))}getDataStructure(){const t={};for(const e of["ac","pp","fc","pl"])for(const i of[1,2,3,4])t[`${e}${i}`]={type:"number",isOptional:!0,description:""};const e={x:this.prepareAxis("x",this.x),y:this.prepareAxis("y",this.y),size:this.prepareSize(),share:this.prepareShare()};for(const[i,s]of Object.entries(e)){if(null===s)continue;const e=$(s.measure);null!==e&&("scenario"===e.kind?t[e.slot].description=`${i}: ${void 0!==s.label?s.label:s.measure}`:(t[e.measure.base].description=`${i}: ${s.measure} (base)`,t[e.measure.delta].description=`${i}: ${s.measure} (delta)`))}const i=this.prepareCompareFamily();if(null!==i)for(const[s,a]of Object.entries(e)){if(null===a||"share"===s)continue;const e=$(a.measure);if(null!==e&&"scenario"===e.kind){const a=i+e.slot.replace(/^[a-z]+/,"");""===t[a].description&&(t[a].description=s+": compareWith")}}return{IBubbleChartDataRow:Object.assign({operation:{type:"string",isOptional:!1,description:""},rowGroup:{type:"string",isOptional:!0,description:""},rowGroupIndex:{type:"number",isOptional:!0,description:""},category:{type:"string",isOptional:!1,description:""},categoryIndex:{type:"number",isOptional:!1,description:""},subCategory:{type:"string",isOptional:!0,description:""},subCategoryIndex:{type:"number",isOptional:!0,description:""}},t)}}chartTemplate(){const t=this.prepareAxis("x",this.x),e=this.prepareAxis("y",this.y),i=this.prepareSize(),s=this.prepareShare(),r=this.prepareFacet();if(this.validateCrossProp([null==t?void 0:t.measure,null==e?void 0:e.measure,null==i?void 0:i.measure,null==s?void 0:s.measure],r),this.validateSizeScaling(),this.hasBlockingErrors()||null===t||null===e||null===i)return null;const n=this.preparePointLevel(),l=this.prepareI18n(),o=this.prepareStyle(),h=u(this.element).width;return a("bn-chart-bubble-renderer",{tableName:this.datasetName,dataVersion:this.dataVersion,chartTitle:this.chartTitle,x:t,y:e,size:i,share:s,compareFamily:this.prepareCompareFamily(),labels:this.prepareLabels(),legend:this.prepareLegend(),facet:r,pointLevel:n,seriesLevel:this.prepareSeriesLevel(n),aspect:this.prepareAspect(),limit:this.prepareLimit(),filter:this.filter,sizeAreaPerUnit:this.prepareSizeAreaPerUnit(),styles:o,i18n:l,containerWidth:h,ruleSetConfig:this.ruleSetConfig(),errors:this.errors,translator:this.translateForInner})}render(){return a(r,{key:"2b15b5b4fc32db48b951e82ecc87f25b0afcc9f8",style:this.getFontStyles()},a("div",{key:"210d8622e1785b8c882f9c9a2fa2072af0e857b6",class:"container"},this.chartTemplate()))}get element(){return this}static get watchers(){return{filter:[{validateFilter:0}],x:[{validateX:0}],y:[{validateY:0}],size:[{validateSize:0}],share:[{validateShare:0}],compareWith:[{validateCompareWith:0}],level:[{validateLevel:0}],seriesLevel:[{validateSeriesLevel:0}],facet:[{validateFacet:0}],labels:[{validateLabels:0}],legend:[{validateLegend:0}],aspect:[{validateAspect:0}],limit:[{validateLimit:0}],scale:[{validateScale:0}]}}static get style(){return':host(.no-data){display:block;box-sizing:border-box;width:100%;height:100%}:host(.no-data)>div{float:none;width:100%;height:100%}:host(.no-data) .no-data~.no-data{display:none}.empty-state{box-sizing:border-box;display:flex;align-items:center;justify-content:center;float:none;width:100%;height:100%;min-height:3em;margin:0;padding:0.5em;overflow:hidden;border:0.1em dashed #ddd;color:#808080;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);font-style:normal;text-align:center}:host{display:inline-block;position:relative;overflow:hidden;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);color:var(--bn-font-color, #000000)}.container{display:flex;flex-direction:column}'}},[1,"bn-chart-bubble",{datasets:[513],selectedStyle:[513,"selected-style"],i18nNamespace:[513,"i18n-namespace"],ruleset:[513],chartTitle:[1,"chart-title"],filter:[1],x:[1],y:[1],size:[1],share:[1],compareWith:[1,"compare-with"],level:[1],seriesLevel:[1,"series-level"],facet:[1],labels:[1],legend:[1],aspect:[1],limit:[2],scale:[1],datasetName:[32],dataVersion:[32],datasetMeta:[32],appliedScaleFactor:[32],getBaseline:[64],getLayoutState:[64]},void 0,{filter:[{validateFilter:0}],x:[{validateX:0}],y:[{validateY:0}],size:[{validateSize:0}],share:[{validateShare:0}],compareWith:[{validateCompareWith:0}],level:[{validateLevel:0}],seriesLevel:[{validateSeriesLevel:0}],facet:[{validateFacet:0}],labels:[{validateLabels:0}],legend:[{validateLegend:0}],aspect:[{validateAspect:0}],limit:[{validateLimit:0}],scale:[{validateScale:0}]}]),B=T,U=function(){"undefined"!=typeof customElements&&["bn-chart-bubble","bn-chart-bubble-renderer"].forEach((t=>{switch(t){case"bn-chart-bubble":customElements.get(n(t))||customElements.define(n(t),T);break;case"bn-chart-bubble-renderer":customElements.get(n(t))||C()}}))};export{B as BnChartBubble,U as defineCustomElement}
|
|
1
|
+
import{p as t,H as e,w as i,f as s,h as a,a as r,t as n}from"./p-D6YGOYV1.js";import{h as l,a as o}from"./p-DDvWTgk1.js";import{o as h}from"./p-DaOm9YwQ.js";import{c}from"./p-ChaSU4fh.js";import{a as d}from"./p-XFZYX7DZ.js";import{g as u}from"./p-DD1zlev_.js";import{c as p}from"./p-D2Epww9R.js";import{o as v}from"./p-B6kka9sT.js";import{p as m}from"./p-Xb6Ilq8u.js";import{i as f,h as b,j as y}from"./p-BiSytXUy.js";import{w as g}from"./p-Dq9dG0Kr.js";import{w as x}from"./p-DjPWZfry.js";import{w}from"./p-DJUffGeB.js";import{w as _}from"./p-4vVbchX2.js";import{w as S}from"./p-D40Am1Ap.js";import{w as j}from"./p-DQl2K2Xl.js";import{w as L}from"./p-xIWChKGS.js";import{w as R}from"./p-DwuXVo2h.js";import{r as $,s as z}from"./p-BXXjh6We.js";import{t as A,a as E,b as W,c as D,d as N,e as k,p as F}from"./p-9mUU4itF.js";import{s as O}from"./p-DakXa7Dp.js";import{d as C}from"./p-DM4Up10X.js";const X={rowGroup:0,category:1,subCategory:2},G=["ac","pp","fc","pl"],M=t(class extends e{validateFilter(t){const e="ERR_filter";l(t)?this.errors.addOrReplace({id:e,type:"error",message:"filter: double backticks are not allowed."}):this.errors.remove(e)}validateX(t){this.validateMeasureSpec("x",t,!0,(t=>A(t)))}validateY(t){this.validateMeasureSpec("y",t,!0,(t=>A(t)))}validateSize(t){this.validateMeasureSpec("size",t,!0,(t=>E(t))),this.validateSizeScaling()}validateShare(t){this.validateMeasureSpec("share",t,!1,(t=>W(t)))}validateCompareWith(t){const e="WARN_compareWith";f(t)||G.includes(t.trim().toLowerCase())?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`compare-with: invalid value '${t}' - expected ${G.join("/")}; ignored.`})}validateLevel(t){const e="WARN_level",i=["auto","category","subcategory"];f(t)||i.includes(t.trim().toLowerCase())?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`level: invalid value '${t}' - expected ${i.join("/")}; using 'auto'.`})}validateSeriesLevel(t){const e="WARN_seriesLevel",i=["auto","rowgroup","category","none"];f(t)||i.includes(t.trim().toLowerCase())?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`series-level: invalid value '${t}' - expected ${i.join("/")}; using 'auto'.`})}validateFacet(t){this.validateObjectSpec("facet",t,(t=>D(t)))}validateLabels(t){this.validateObjectSpec("labels",t,(t=>N(t,this.labelDefaults())))}validateLegend(t){this.validateObjectSpec("legend",t,(t=>k(t)))}validateAspect(t){const e="WARN_aspect";f(t)||null!==this.parseAspect(t)?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`aspect: invalid value '${t}' - expected "w:h" (e.g. "16:9"); using the default.`})}validateLimit(t){const e="WARN_limit";b(t)&&Number(t)>=0?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`limit: invalid value '${t}' - expected a non-negative integer; using 0.`})}validateScale(t){const e="WARN_scale";if(f(t))return void this.errors.remove(e);const{mode:i,factor:s}=m(t);"factor"===i&&(void 0===s||s<=0)?this.errors.addOrReplace({id:e,type:"warning",message:`scale: invalid value '${t}' - expected none/auto or a positive number.`}):this.errors.remove(e)}constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.datasetName="",this.dataVersion=0,this.datasetMeta=null,this.appliedScaleFactor=1,this.layoutObserver=null,this.activeErrors=new Set,this.pixelPerUnitGroupMap=new Map,this.chartTitle="",this.filter="",this.share="",this.compareWith="",this.level="auto",this.seriesLevel="auto",this.facet="",this.labels="",this.legend="",this.aspect="16:9",this.limit=0,this._autoScaleGuard=!1,this._lastObservedWidth=0,this.translateForInner=(t,e)=>this.t(t,e),R(this),g(this),w(this,(t=>{this.datasetName=(null==t?void 0:t.startsWith("$"))?t.substring(1):t||"",this.dataVersion=this.dataVersion+1}),((t,e)=>{this.datasetMeta=e})),this.errors=_(this),j(this),this.componentStyle=x(this),this.ruleSetConfig=S(this),this.t=L(this).t}componentWillLoad(){this.validateFilter(this.filter),this.validateX(this.x),this.validateY(this.y),this.validateSize(this.size),this.validateShare(this.share),this.validateCompareWith(this.compareWith),this.validateLevel(this.level),this.validateSeriesLevel(this.seriesLevel),this.validateFacet(this.facet),this.validateLabels(this.labels),this.validateLegend(this.legend),this.validateAspect(this.aspect),this.validateLimit(this.limit),this.validateScale(this.scale)}componentDidRender(){O(this.element,"bn-chart-bubble-renderer");const{mode:t}=m(this.scale);if("auto"!==t&&"empty"!==t)return this._autoScaleGuard=!1,void this.checkOverflow();if(this._autoScaleGuard)return this._autoScaleGuard=!1,void this.checkOverflow();const e=this.element,{width:s}=u(e);if(s<=0)return void this.checkOverflow();this._lastObservedWidth=s;const a=this.componentStyle((t=>{var e;return(null===(e=t.global)||void 0===e?void 0:e.fontSizePx)||13.3333})),r=e.scrollWidth,n=this.appliedScaleFactor;if(!Number.isFinite(r)||r<=s+1)return this.errors.remove("AUTO_scale"),void this.checkOverflow();const l=Math.max(.3,n*(s-1)/r);Math.abs(l-n)<.01||(e.style.setProperty("--bn-font-size",a*l+"px"),"empty"===t?this.errors.addOrReplace({id:"AUTO_scale",type:"warning",message:"Auto-scaled chart by factor "+l.toFixed(3)}):this.errors.remove("AUTO_scale"),this._autoScaleGuard=!0,i((()=>{this.appliedScaleFactor=l}))),this.checkOverflow()}checkOverflow(){p(this.element,"bn-chart-bubble-renderer",this.errors)}componentDidLoad(){this.layoutObserver=v(this.element,(()=>{if(this._autoScaleGuard)return;const{width:t}=u(this.element);t>0&&Math.abs(t-this._lastObservedWidth)>2?(this._lastObservedWidth=t,s(this)):this.checkOverflow()})),requestAnimationFrame((()=>{requestAnimationFrame((()=>{if(this._autoScaleGuard)return;const{width:t}=u(this.element);this._lastObservedWidth=t,s(this)}))}))}disconnectedCallback(){var t;null===(t=this.layoutObserver)||void 0===t||t.disconnect(),this.layoutObserver=null}labelDefaults(){return{points:"all",values:!0,max:12}}setBlockingError(t,e){null===e?(this.errors.remove(t),this.activeErrors.delete(t)):(this.errors.addOrReplace({id:t,type:"error",message:e}),this.activeErrors.add(t))}hasBlockingErrors(){return this.activeErrors.size>0}validateSizeScaling(){var t;const e=null===(t=this.prepareSize())||void 0===t?void 0:t.group;this.setBlockingError("ERR_xy_scale_group",void 0===e||this.pixelPerUnitGroupMap.has(e)?null:this.t(".bubble-scale-group-unknown",{group:e}))}validateMeasureSpec(t,e,i,s){var a;const r="ERR_xy_json_"+t,n="ERR_xy_measure_"+t,l="WARN_xy_fields_"+t,{data:o,parseError:h}=F(e,"measure");if(h)return this.setBlockingError(r,this.t(".xy-prop-json",{prop:t})),this.setBlockingError(n,null),void this.errors.remove(l);if(this.setBlockingError(r,null),null===o)return this.setBlockingError(n,i?this.t(".xy-measure-invalid",{prop:t,measure:""}):null),void this.errors.remove(l);const c=null!==(a=o.measure)&&void 0!==a?a:"";y(c)?this.setBlockingError(n,null):this.setBlockingError(n,this.t(".xy-measure-invalid",{prop:t,measure:c})),this.reportSpecIssues(l,t,s(o))}validateObjectSpec(t,e,i){const s="ERR_xy_json_"+t,a="WARN_xy_fields_"+t,{data:r,parseError:n}=F(e,null);if(n)return this.setBlockingError(s,this.t(".xy-prop-json",{prop:t})),void this.errors.remove(a);this.setBlockingError(s,null),null!==r?this.reportSpecIssues(a,t,i(r)):this.errors.remove(a)}reportSpecIssues(t,e,i){const s=[];null!==i&&i.invalidFields.length>0&&s.push("invalid: "+i.invalidFields.join(", ")),null!==i&&i.unknownKeys.length>0&&s.push("unknown: "+i.unknownKeys.join(", ")),s.length>0?this.errors.addOrReplace({id:t,type:"warning",message:`${e}: ignored sub-fields (${s.join("; ")}).`}):this.errors.remove(t)}prepareAxis(t,e){const{data:i,parseError:s}=F(e,"measure");if(s||null===i)return null;const{config:a}=A(i);return null!==a&&y(a.measure)?(void 0!==a.min&&void 0!==a.max&&a.min>=a.max?(this.errors.addOrReplace({id:"WARN_xy_domain_"+t,type:"warning",message:t+": min must be smaller than max; the override is ignored."}),a.min=void 0,a.max=void 0):this.errors.remove("WARN_xy_domain_"+t),a):null}prepareSize(){const{data:t,parseError:e}=F(this.size,"measure");if(e||null===t)return null;const{config:i}=E(t);return null!==i&&y(i.measure)?i:null}prepareShare(){const{data:t,parseError:e}=F(this.share,"measure");if(e||null===t)return null;const{config:i}=W(t);return null!==i&&y(i.measure)?i:null}prepareCompareFamily(){var t;const e=null===(t=this.compareWith)||void 0===t?void 0:t.trim().toLowerCase();return G.includes(e)?e:null}prepareLabels(){const t=this.labelDefaults(),{data:e,parseError:i}=F(this.labels,null);return i||null===e?{points:t.points,values:t.values,max:t.max}:N(e,t).config}prepareLegend(){const{data:t,parseError:e}=F(this.legend,null);return e||null===t?{show:!0,position:"right"}:k(t).config}prepareFacet(){const{data:t,parseError:e}=F(this.facet,null);return e||null===t?null:D(t).config}preparePointLevel(){var t,e;const i=null===(t=this.level)||void 0===t?void 0:t.trim().toLowerCase();if("category"===i)return"category";if("subcategory"===i)return"subCategory";const s=null===(e=this.datasetMeta)||void 0===e?void 0:e.suggestedLevel;return"rowGroup"===s||"category"===s||"subCategory"===s?s:"category"}prepareSeriesLevel(t){var e;const i=null===(e=this.seriesLevel)||void 0===e?void 0:e.trim().toLowerCase();return"none"===i?null:"rowgroup"===i?"rowGroup":"category"===i||"subCategory"===t?"category":"category"===t?"rowGroup":null}validateCrossProp(t,e){const i=new Set;let s=!1;for(const e of t){if(void 0===e)continue;const t=$(e);null!==t&&("scenario"===t.kind?i.add(z(t.slot)):s=!0)}this.setBlockingError("ERR_xy_family",i.size>1?this.t(".xy-family-mixed",{families:[...i].join(", ")}):null);const a=this.prepareCompareFamily();this.setBlockingError("ERR_xy_compare_variance",null!==a&&s?this.t(".xy-compare-variance"):null),this.setBlockingError("ERR_xy_compare_family",null!==a&&1===i.size&&i.has(a)?`compare-with: '${a}' is already the primary scenario family.`:null);const r=this.preparePointLevel(),n=this.prepareSeriesLevel(r),l=null!==e?"rowgroup"===e.level?"rowGroup":"category":null;let o=null;if(null!==n&&X[n]>=X[r]&&(o=`series '${n}' vs point '${r}'`),null!==l){const t=null!=n?n:r;X[l]>=X[t]&&(o=`facet '${l}' vs '${t}'`)}this.setBlockingError("ERR_xy_level_order",null!==o?this.t(".xy-level-order",{detail:o}):null)}parseAspect(t){const e=/^\s*(\d+(?:\.\d+)?)\s*:\s*(\d+(?:\.\d+)?)\s*$/.exec(null!=t?t:"");if(null===e)return null;const i=Number(e[1]),s=Number(e[2]);return i<=0||s<=0?null:i/s}prepareAspect(){var t;return null!==(t=this.parseAspect(this.aspect))&&void 0!==t?t:16/9}prepareLimit(){const t=Math.floor(Number(this.limit)||0);return t>0?t:0}prepareSizeAreaPerUnit(){var t;const e=null===(t=this.prepareSize())||void 0===t?void 0:t.group;if(void 0===e||!this.pixelPerUnitGroupMap.has(e))return 0;const i=this.pixelPerUnitGroupMap.get(e);if(!(i>0))return 0;const s=this.getEffectiveFontPx();return s*s/i}i18nLocalKeys(){return["no-data","axis.in","legend.title","legend.size","legend.compare"]}prepareI18n(){const t=new Map(this.i18nLocalKeys().map((t=>[t,this.t(".".concat(t))]))),e=new Map(o.map((t=>[t,this.t("global.".concat(t))])));return new Map([...e.entries(),...t.entries()])}prepareStyle(){const t=this.getEffectiveScaleFactor();return this.componentStyle((e=>{const i=e.global.fontSizePx*t;return{scaleFactors:e["bn-chart-bubble"].scaleFactors,fontStyles:{font:`${i}px ${e.global.fontFamily}`,size:i,color:e.global.fontColor,background:e.global.fontBackgroundColor,leading:1.8},axisStyles:e["bn-chart-bubble"].axisStyles,seriesColors:e["bn-chart-bubble"].seriesColors,padding:e["bn-chart-bubble"].padding}}))}async getBaseline(){return d(this.element,"bn-chart-bubble-renderer")}async getLayoutState(t){var e;const i=null!==(e=null==t?void 0:t.detail)&&void 0!==e?e:"summary",s=h(this.element),a=this.getEffectiveScaleFactor(),r=Number.isFinite(a)&&a>0?a:1,n=this.componentStyle((t=>{var e;return(null===(e=t.global)||void 0===e?void 0:e.fontSizePx)||13.3333}))*r;return c(this.element,"bn-chart-bubble-renderer",this.chartTitle||void 0,{fontSizePx:n,appliedScaleFactor:r},s,i)}getEffectiveScaleFactor(){const{mode:t,factor:e}=m(this.scale);return"factor"===t?e:"auto"===t||"empty"===t?this.appliedScaleFactor:1}getEffectiveFontPx(){return this.componentStyle((t=>{var e;return(null===(e=t.global)||void 0===e?void 0:e.fontSizePx)||13.3333}))*this.getEffectiveScaleFactor()}getFontStyles(){const t=this.getEffectiveScaleFactor();return this.componentStyle((e=>{var i,s,a,r;const n=(null===(i=e.global)||void 0===i?void 0:i.fontSizePx)||13.3333;return{"--bn-font-family":(null===(s=e.global)||void 0===s?void 0:s.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":n*t+"px","--bn-font-color":(null===(a=e.global)||void 0===a?void 0:a.fontColor)||"#000000","--bn-font-background":(null===(r=e.global)||void 0===r?void 0:r.fontBackgroundColor)||"#ffffff"}}))}getDataStructure(){const t={};for(const e of["ac","pp","fc","pl"])for(const i of[1,2,3,4])t[`${e}${i}`]={type:"number",isOptional:!0,description:""};const e={x:this.prepareAxis("x",this.x),y:this.prepareAxis("y",this.y),size:this.prepareSize(),share:this.prepareShare()};for(const[i,s]of Object.entries(e)){if(null===s)continue;const e=$(s.measure);null!==e&&("scenario"===e.kind?t[e.slot].description=`${i}: ${void 0!==s.label?s.label:s.measure}`:(t[e.measure.base].description=`${i}: ${s.measure} (base)`,t[e.measure.delta].description=`${i}: ${s.measure} (delta)`))}const i=this.prepareCompareFamily();if(null!==i)for(const[s,a]of Object.entries(e)){if(null===a||"share"===s)continue;const e=$(a.measure);if(null!==e&&"scenario"===e.kind){const a=i+e.slot.replace(/^[a-z]+/,"");""===t[a].description&&(t[a].description=s+": compareWith")}}return{IBubbleChartDataRow:Object.assign({operation:{type:"string",isOptional:!1,description:""},rowGroup:{type:"string",isOptional:!0,description:""},rowGroupIndex:{type:"number",isOptional:!0,description:""},category:{type:"string",isOptional:!1,description:""},categoryIndex:{type:"number",isOptional:!1,description:""},subCategory:{type:"string",isOptional:!0,description:""},subCategoryIndex:{type:"number",isOptional:!0,description:""}},t)}}chartTemplate(){const t=this.prepareAxis("x",this.x),e=this.prepareAxis("y",this.y),i=this.prepareSize(),s=this.prepareShare(),r=this.prepareFacet();if(this.validateCrossProp([null==t?void 0:t.measure,null==e?void 0:e.measure,null==i?void 0:i.measure,null==s?void 0:s.measure],r),this.validateSizeScaling(),this.hasBlockingErrors()||null===t||null===e||null===i)return null;const n=this.preparePointLevel(),l=this.prepareI18n(),o=this.prepareStyle(),h=u(this.element).width;return a("bn-chart-bubble-renderer",{tableName:this.datasetName,dataVersion:this.dataVersion,chartTitle:this.chartTitle,x:t,y:e,size:i,share:s,compareFamily:this.prepareCompareFamily(),labels:this.prepareLabels(),legend:this.prepareLegend(),facet:r,pointLevel:n,seriesLevel:this.prepareSeriesLevel(n),aspect:this.prepareAspect(),limit:this.prepareLimit(),filter:this.filter,sizeAreaPerUnit:this.prepareSizeAreaPerUnit(),styles:o,i18n:l,containerWidth:h,ruleSetConfig:this.ruleSetConfig(),errors:this.errors,translator:this.translateForInner})}render(){return a(r,{key:"2b15b5b4fc32db48b951e82ecc87f25b0afcc9f8",style:this.getFontStyles()},a("div",{key:"210d8622e1785b8c882f9c9a2fa2072af0e857b6",class:"container"},this.chartTemplate()))}get element(){return this}static get watchers(){return{filter:[{validateFilter:0}],x:[{validateX:0}],y:[{validateY:0}],size:[{validateSize:0}],share:[{validateShare:0}],compareWith:[{validateCompareWith:0}],level:[{validateLevel:0}],seriesLevel:[{validateSeriesLevel:0}],facet:[{validateFacet:0}],labels:[{validateLabels:0}],legend:[{validateLegend:0}],aspect:[{validateAspect:0}],limit:[{validateLimit:0}],scale:[{validateScale:0}]}}static get style(){return':host(.no-data){display:block;box-sizing:border-box;width:100%;height:100%}:host(.no-data)>div{float:none;width:100%;height:100%}:host(.no-data) .no-data~.no-data{display:none}.empty-state{box-sizing:border-box;display:flex;align-items:center;justify-content:center;float:none;width:100%;height:100%;min-height:3em;margin:0;padding:0.5em;overflow:hidden;border:0.1em dashed #ddd;color:#808080;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);font-style:normal;text-align:center}:host{display:inline-block;position:relative;overflow:hidden;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);color:var(--bn-font-color, #000000)}.container{display:flex;flex-direction:column}'}},[1,"bn-chart-bubble",{datasets:[513],selectedStyle:[513,"selected-style"],i18nNamespace:[513,"i18n-namespace"],ruleset:[513],chartTitle:[1,"chart-title"],filter:[1],x:[1],y:[1],size:[1],share:[1],compareWith:[1,"compare-with"],level:[1],seriesLevel:[1,"series-level"],facet:[1],labels:[1],legend:[1],aspect:[1],limit:[2],scale:[1],datasetName:[32],dataVersion:[32],datasetMeta:[32],appliedScaleFactor:[32],getBaseline:[64],getLayoutState:[64]},void 0,{filter:[{validateFilter:0}],x:[{validateX:0}],y:[{validateY:0}],size:[{validateSize:0}],share:[{validateShare:0}],compareWith:[{validateCompareWith:0}],level:[{validateLevel:0}],seriesLevel:[{validateSeriesLevel:0}],facet:[{validateFacet:0}],labels:[{validateLabels:0}],legend:[{validateLegend:0}],aspect:[{validateAspect:0}],limit:[{validateLimit:0}],scale:[{validateScale:0}]}]),U=M,B=function(){"undefined"!=typeof customElements&&["bn-chart-bubble","bn-chart-bubble-renderer"].forEach((t=>{switch(t){case"bn-chart-bubble":customElements.get(n(t))||customElements.define(n(t),M);break;case"bn-chart-bubble-renderer":customElements.get(n(t))||C()}}))};export{U as BnChartBubble,B as defineCustomElement}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{B as o,d as s}from"./p-
|
|
1
|
+
import{B as o,d as s}from"./p-chnyMHJT.js";const p=o,r=s;export{p as BnChartBulletRenderer,r as defineCustomElement}
|