@bino-bi/bn-template-engine 1.0.0-next.36 → 1.0.0-next.38
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-2dcdac86.entry.js → p-e15ccc4a.entry.js} +1 -1
- package/dist/cjs/bn-annotation-layer_30.cjs.entry.js +221 -53
- package/dist/collection/components/bn-table/bn-table-renderer/bn-table-renderer.js +55 -15
- package/dist/collection/components/bn-table/bn-table.js +5 -2
- package/dist/collection/components/bn-table/utils/elements/CellBarChart.js +25 -15
- package/dist/collection/components/bn-table/utils/elements/WaterfallBar.js +2 -2
- package/dist/collection/components/bn-table/utils/helper/DataQuery.js +24 -10
- package/dist/collection/components/bn-table/utils/helper/WaterfallCalculator.js +9 -3
- package/dist/collection/components/bn-table/utils/helper/barColumnGeometry.js +105 -10
- package/dist/components/bn-table-renderer.js +1 -1
- package/dist/components/bn-table.js +1 -1
- package/dist/components/p--HIZm_2v.js +1 -0
- package/dist/esm/bn-annotation-layer_30.entry.js +221 -53
- package/dist/types/components/bn-table/bn-table-renderer/bn-table-renderer.d.ts +5 -0
- package/dist/types/components/bn-table/bn-table.d.ts +3 -0
- package/dist/types/components/bn-table/utils/elements/CellBarChart.d.ts +7 -2
- package/dist/types/components/bn-table/utils/helper/DataQuery.d.ts +1 -0
- package/dist/types/components/bn-table/utils/helper/WaterfallCalculator.d.ts +5 -2
- package/dist/types/components/bn-table/utils/helper/barColumnGeometry.d.ts +31 -8
- package/dist/types/components.d.ts +2 -2
- package/package.json +1 -1
- package/dist/components/p-CLilvhjH.js +0 -1
|
@@ -26917,6 +26917,9 @@ const Table$1 = class Table {
|
|
|
26917
26917
|
* inside each group, the groups keep their rowgroupindex order. With a variance or `@`, rows without data
|
|
26918
26918
|
* (and a relative variance with a zero reference) sort last.
|
|
26919
26919
|
* <br /><br />
|
|
26920
|
+
* A data row with the category `REST` is the rest row of its group: sorted by a scenario or variance it stays
|
|
26921
|
+
* the last row of the group. Its label comes from the `REST` translation.
|
|
26922
|
+
* <br /><br />
|
|
26920
26923
|
* When set to ```auto```, order is detected from the dataset silently.
|
|
26921
26924
|
*/
|
|
26922
26925
|
this.order = "category";
|
|
@@ -28046,7 +28049,7 @@ const Table$1 = class Table {
|
|
|
28046
28049
|
render() {
|
|
28047
28050
|
const fontStyles = this.getFontStyles();
|
|
28048
28051
|
const effectiveFactor = this.getEffectiveScaleFactor();
|
|
28049
|
-
return (h(Host, { key: '
|
|
28052
|
+
return (h(Host, { key: '42974a4931f678c35e5c740bf6d630966368fb4b', style: fontStyles }, h("div", { key: '2c8f99a8bd155e2c93e55e9542090d04afe22a31' }, h("bn-table-renderer", { key: 'cae9e83bf297e730f12a8a390cbf279413c40b54', tableName: this.datasetName, dataVersion: this.dataVersion, sumTitle: this.prepareSumTitle(), scenarios: this.prepareScenarios(), scenariosDataFormat: this.prepareDataFormat(), grouped: this.prepareGrouped(), limit: this.prepareLimit(), showGroupTitle: this.prepareShowGroupTitle(), thereof: this.prepareThereOf(), partof: this.preparePartOf(), order: this.prepareOrder(), categorythereof: this.prepareColumnThereOf(), attributeColumns: this.prepareAttributes(), type: this.prepareTableType(), categoryWidth: this.prepareCategoryWidth(), dataFormatDigits: this.prepareDataFormatDigits(), i18n: this.prepareI18n(), i18nMode: this.prepareI18nMode(), measureScale: this.prepareMeasureScale(), measureType: this.prepareMeasureType(), measureUnit: this.prepareMeasureUnit(), showMeasureScale: this.prepareShowMeasureScale(), filter: this.prepareFilter(), barColumns: this.prepareBarColumns(), interval: this.prepareInterval(), barColumnMaxWidth: this.prepareBarColumnWidth(), unitScaling: this.prepareUnitScaling(), percentageScaling: this.preparePercentageScaling(), reportAutoScaling: this.handleAutoScalingReport, errors: this.errors, scaleFactor: effectiveFactor, ruleSetConfig: this.ruleSetConfig(), selectedStyle: this.selectedStyle }))));
|
|
28050
28053
|
}
|
|
28051
28054
|
get element() { return getElement(this); }
|
|
28052
28055
|
static get watchers() { return {
|
|
@@ -28351,6 +28354,43 @@ function estimateLabelWidth(text, fontSize) {
|
|
|
28351
28354
|
}
|
|
28352
28355
|
return em * fontSize * LABEL_WIDTH_MARGIN;
|
|
28353
28356
|
}
|
|
28357
|
+
/** Safety pad on a measured label, in label font size: covers subpixel rounding only. */
|
|
28358
|
+
const MEASURE_PAD = 0.15;
|
|
28359
|
+
const FONT_SENTINEL = "1px __bn_font_sentinel__";
|
|
28360
|
+
let measureContext;
|
|
28361
|
+
/** One shared 2D context; null where the document has no canvas (spec tests, mock-doc). */
|
|
28362
|
+
function labelMeasureContext() {
|
|
28363
|
+
var _a, _b, _c;
|
|
28364
|
+
if (measureContext === undefined) {
|
|
28365
|
+
try {
|
|
28366
|
+
measureContext =
|
|
28367
|
+
typeof document === "undefined" ? null : ((_c = (_b = (_a = document.createElement("canvas")).getContext) === null || _b === void 0 ? void 0 : _b.call(_a, "2d")) !== null && _c !== void 0 ? _c : null);
|
|
28368
|
+
}
|
|
28369
|
+
catch (_d) {
|
|
28370
|
+
measureContext = null;
|
|
28371
|
+
}
|
|
28372
|
+
}
|
|
28373
|
+
return measureContext;
|
|
28374
|
+
}
|
|
28375
|
+
/**
|
|
28376
|
+
* Rendered width of a value label in px, measured with the font the SVG text uses. Falls
|
|
28377
|
+
* back to estimateLabelWidth where no canvas can measure.
|
|
28378
|
+
*/
|
|
28379
|
+
function labelWidth(text, fontSize, fontFamily, italic) {
|
|
28380
|
+
const ctx = labelMeasureContext();
|
|
28381
|
+
if (ctx) {
|
|
28382
|
+
// the canvas ignores a font it cannot parse and keeps the last one: the sentinel shows that
|
|
28383
|
+
ctx.font = FONT_SENTINEL;
|
|
28384
|
+
const sentinel = ctx.font;
|
|
28385
|
+
ctx.font = `${italic ? "italic " : ""}${fontSize}px ${fontFamily}`;
|
|
28386
|
+
if (ctx.font === sentinel)
|
|
28387
|
+
return estimateLabelWidth(text, fontSize);
|
|
28388
|
+
const width = ctx.measureText(text).width;
|
|
28389
|
+
if (Number.isFinite(width) && (width > 0 || text === ""))
|
|
28390
|
+
return width + MEASURE_PAD * fontSize;
|
|
28391
|
+
}
|
|
28392
|
+
return estimateLabelWidth(text, fontSize);
|
|
28393
|
+
}
|
|
28354
28394
|
/** The SVG fills the cell's content box: the requested column width minus the cell padding. */
|
|
28355
28395
|
function contentWidth(widthEm, emPx) {
|
|
28356
28396
|
return Math.max(0, (widthEm - BAR_CELL_PADDING_EM) * emPx);
|
|
@@ -28384,28 +28424,86 @@ function pinLabelsFit(widthEm, emPx, labels, headSize) {
|
|
|
28384
28424
|
const { sides, neg, pos } = sideNeeds(labels, headSize / 2, LABEL_GAP_EM * emPx);
|
|
28385
28425
|
return neg + pos + sides * minExtent(totalWidth, emPx, sides) <= totalWidth + 1e-6;
|
|
28386
28426
|
}
|
|
28387
|
-
function
|
|
28388
|
-
const totalWidth = contentWidth(widthEm, emPx);
|
|
28389
|
-
const labelGap = LABEL_GAP_EM * emPx;
|
|
28390
|
-
// a variance bar starts at the outer edge of the thick axis
|
|
28391
|
-
const { extent: maxBarWidth, axisX } = splitSides(totalWidth, labels, (VARIANCE_AXIS_EM * emPx) / 2, labelGap);
|
|
28392
|
-
const breakGap = Math.min(BREAK_GAP_EM * emPx, maxBarWidth * 0.2);
|
|
28427
|
+
function barSide(maxBarWidth, breakGap) {
|
|
28393
28428
|
const overdriveZoneWidth = maxBarWidth * OVERDRIVE_FRACTION;
|
|
28394
28429
|
return {
|
|
28395
|
-
totalWidth,
|
|
28396
28430
|
maxBarWidth,
|
|
28397
|
-
axisX,
|
|
28398
28431
|
breakGap,
|
|
28399
28432
|
overdriveZoneWidth,
|
|
28400
28433
|
cutWidth: Math.max(0, maxBarWidth - breakGap - overdriveZoneWidth),
|
|
28434
|
+
};
|
|
28435
|
+
}
|
|
28436
|
+
/**
|
|
28437
|
+
* `sideMax` is the largest absolute value per side of the axis. With it, the bar room is
|
|
28438
|
+
* split so the uncut bar length of each side is in that ratio: the axis sits where the
|
|
28439
|
+
* values need it, at any scale. Without it, both sides get the same extent.
|
|
28440
|
+
*/
|
|
28441
|
+
function absoluteBarGeometry(widthEm, emPx, labels, sideMax) {
|
|
28442
|
+
var _a, _b;
|
|
28443
|
+
const totalWidth = contentWidth(widthEm, emPx);
|
|
28444
|
+
const labelGap = LABEL_GAP_EM * emPx;
|
|
28445
|
+
// a variance bar starts at the outer edge of the thick axis
|
|
28446
|
+
const { extent, axisX } = splitSides(totalWidth, labels, (VARIANCE_AXIS_EM * emPx) / 2, labelGap);
|
|
28447
|
+
const breakGap = Math.min(BREAK_GAP_EM * emPx, extent * 0.2);
|
|
28448
|
+
const hasNeg = labels.neg !== undefined;
|
|
28449
|
+
const hasPos = labels.pos !== undefined || !hasNeg;
|
|
28450
|
+
let neg = hasNeg ? extent : 0;
|
|
28451
|
+
const maxNeg = Math.max(0, (_a = sideMax === null || sideMax === void 0 ? void 0 : sideMax.neg) !== null && _a !== void 0 ? _a : 0);
|
|
28452
|
+
const maxPos = Math.max(0, (_b = sideMax === null || sideMax === void 0 ? void 0 : sideMax.pos) !== null && _b !== void 0 ? _b : 0);
|
|
28453
|
+
if (hasNeg && hasPos && maxNeg + maxPos > 0) {
|
|
28454
|
+
// every side keeps its break gap and overdrive stub, only the uncut length follows the values
|
|
28455
|
+
const uncut = 2 * extent * (1 - OVERDRIVE_FRACTION) - 2 * breakGap;
|
|
28456
|
+
neg = (breakGap + (uncut * maxNeg) / (maxNeg + maxPos)) / (1 - OVERDRIVE_FRACTION);
|
|
28457
|
+
}
|
|
28458
|
+
const pos = hasPos ? (hasNeg ? 2 * extent - neg : extent) : 0;
|
|
28459
|
+
return {
|
|
28460
|
+
totalWidth,
|
|
28461
|
+
neg: barSide(neg, breakGap),
|
|
28462
|
+
pos: barSide(pos, breakGap),
|
|
28463
|
+
axisX: hasNeg ? axisX - extent + neg : 0,
|
|
28401
28464
|
labelGap,
|
|
28402
28465
|
};
|
|
28403
28466
|
}
|
|
28404
|
-
|
|
28467
|
+
/**
|
|
28468
|
+
* `reach` is the length in px the longest pin of each side wants at the column's scale.
|
|
28469
|
+
* With it, the pin room is split by what each side needs, so a side with shorter pins
|
|
28470
|
+
* gives its room to the other; room left after both is shared equally. Without it, both
|
|
28471
|
+
* sides get the same extent.
|
|
28472
|
+
*/
|
|
28473
|
+
function relativePinGeometry(widthEm, emPx, labels, headSize, reach) {
|
|
28474
|
+
var _a, _b;
|
|
28405
28475
|
const totalWidth = contentWidth(widthEm, emPx);
|
|
28406
28476
|
const labelGap = LABEL_GAP_EM * emPx;
|
|
28407
28477
|
const { extent, axisX } = splitSides(totalWidth, labels, headSize / 2, labelGap);
|
|
28408
|
-
|
|
28478
|
+
const hasNeg = labels.neg !== undefined;
|
|
28479
|
+
const hasPos = labels.pos !== undefined || !hasNeg;
|
|
28480
|
+
let neg = hasNeg ? extent : 0;
|
|
28481
|
+
let pos = hasPos ? extent : 0;
|
|
28482
|
+
if (reach && hasNeg && hasPos) {
|
|
28483
|
+
const room = 2 * extent;
|
|
28484
|
+
const wantNeg = Math.max(0, (_a = reach.neg) !== null && _a !== void 0 ? _a : 0);
|
|
28485
|
+
const wantPos = Math.max(0, (_b = reach.pos) !== null && _b !== void 0 ? _b : 0);
|
|
28486
|
+
if (wantNeg + wantPos <= room + 1e-6) {
|
|
28487
|
+
neg = wantNeg + (room - wantNeg - wantPos) / 2;
|
|
28488
|
+
pos = room - neg;
|
|
28489
|
+
}
|
|
28490
|
+
else if (wantNeg < extent) {
|
|
28491
|
+
neg = wantNeg;
|
|
28492
|
+
pos = room - neg;
|
|
28493
|
+
}
|
|
28494
|
+
else if (wantPos < extent) {
|
|
28495
|
+
pos = wantPos;
|
|
28496
|
+
neg = room - pos;
|
|
28497
|
+
}
|
|
28498
|
+
}
|
|
28499
|
+
return {
|
|
28500
|
+
totalWidth,
|
|
28501
|
+
maxPinLength: Math.max(neg, pos),
|
|
28502
|
+
negPinLength: neg,
|
|
28503
|
+
posPinLength: pos,
|
|
28504
|
+
axisX: hasNeg ? axisX - extent + neg : 0,
|
|
28505
|
+
labelGap,
|
|
28506
|
+
};
|
|
28409
28507
|
}
|
|
28410
28508
|
function waterfallGeometry(widthEm, emPx) {
|
|
28411
28509
|
const totalWidth = contentWidth(widthEm, emPx);
|
|
@@ -28469,9 +28567,10 @@ const PatternDefs = ({ styles }) => {
|
|
|
28469
28567
|
/** Longest relative label that keeps all percent digits; a longer one drops digits so its gutter does not eat the pins. */
|
|
28470
28568
|
const PIN_LABEL_CHARS = 7;
|
|
28471
28569
|
/**
|
|
28472
|
-
* Formats a
|
|
28570
|
+
* Formats a bar or pin label. An absolute value with `decimalDigits` prints like a number
|
|
28571
|
+
* cell, without them it takes an SI suffix.
|
|
28473
28572
|
*/
|
|
28474
|
-
function formatValue(value, isRelative, measureScale = 1, locale, percentDigits = 0, percentSign = true) {
|
|
28573
|
+
function formatValue(value, isRelative, measureScale = 1, locale, percentDigits = 0, percentSign = true, decimalDigits) {
|
|
28475
28574
|
// IBCS prints a value that rounds to zero without a sign
|
|
28476
28575
|
const signed = (text, zero) => (value > 0 && text !== zero ? "+" : "") + text;
|
|
28477
28576
|
if (isRelative) {
|
|
@@ -28489,6 +28588,10 @@ function formatValue(value, isRelative, measureScale = 1, locale, percentDigits
|
|
|
28489
28588
|
}
|
|
28490
28589
|
// Absolute variance - apply measure scale and use SI prefixes
|
|
28491
28590
|
const scaledValue = value / measureScale;
|
|
28591
|
+
if (decimalDigits !== undefined) {
|
|
28592
|
+
const number = (v) => Formatter.number(v, "decimal", decimalDigits, decimalDigits, 1, locale);
|
|
28593
|
+
return signed(number(scaledValue), number(0));
|
|
28594
|
+
}
|
|
28492
28595
|
const absValue = Math.abs(scaledValue);
|
|
28493
28596
|
let unit = 1;
|
|
28494
28597
|
let suffix = "";
|
|
@@ -28671,25 +28774,28 @@ function renderZigzagBreak(breakX, breakGap, yTop, barHeight, s) {
|
|
|
28671
28774
|
* exactly `columnWidthEm` em - see barColumnGeometry.ts.
|
|
28672
28775
|
*/
|
|
28673
28776
|
const AbsoluteVarianceBar = (props) => {
|
|
28674
|
-
const { value, scenario, columnStats, height, isPositiveGood, formattedValue, measureScale, locale, columnWidthEm = 10, labelWidths, styles = DEFAULT_STYLES, } = props;
|
|
28777
|
+
const { value, scenario, columnStats, height, isPositiveGood, formattedValue, measureScale, locale, decimalDigits, columnWidthEm = 10, labelWidths, sideMax, styles = DEFAULT_STYLES, } = props;
|
|
28675
28778
|
const s = styles.scaleFactor;
|
|
28676
28779
|
const fs = styles.fontSize;
|
|
28677
|
-
const displayValue = formattedValue || formatValue(value, false, measureScale, locale);
|
|
28678
|
-
const sides = labelWidths !== null && labelWidths !== void 0 ? labelWidths : ownLabelWidths(columnStats,
|
|
28679
|
-
const
|
|
28780
|
+
const displayValue = formattedValue || formatValue(value, false, measureScale, locale, 0, true, decimalDigits);
|
|
28781
|
+
const sides = labelWidths !== null && labelWidths !== void 0 ? labelWidths : ownLabelWidths(columnStats, labelWidth(displayValue, fs, styles.fontFamily, false));
|
|
28782
|
+
const isPositive = value > 0 || (value === 0 && zeroOnPositiveSide(sides));
|
|
28783
|
+
const { neg = Math.max(0, -columnStats.min), pos = Math.max(0, columnStats.max) } = sideMax !== null && sideMax !== void 0 ? sideMax : {};
|
|
28784
|
+
const geometry = absoluteBarGeometry(columnWidthEm, styles.emPx, sides, { neg, pos });
|
|
28785
|
+
const { totalWidth, axisX, labelGap } = geometry;
|
|
28786
|
+
const { breakGap, overdriveZoneWidth, cutWidth } = isPositive ? geometry.pos : geometry.neg;
|
|
28680
28787
|
// Direct unit scaling via fontSize
|
|
28681
28788
|
const scaledWidth = Math.abs(value) * styles.unitScaling * fs;
|
|
28682
28789
|
// auto scaling puts the largest bar on the cut, float rounding must not turn it into an overdrive bar
|
|
28683
28790
|
const isExtreme = scaledWidth - cutWidth > 1e-6;
|
|
28684
28791
|
// Compute proportional overdrive width across the column
|
|
28685
|
-
const maxScaledWidth =
|
|
28792
|
+
const maxScaledWidth = (isPositive ? pos : neg) * styles.unitScaling * fs;
|
|
28686
28793
|
const maxOverflow = Math.max(0, maxScaledWidth - cutWidth);
|
|
28687
28794
|
const overflowAmount = Math.max(0, scaledWidth - cutWidth);
|
|
28688
28795
|
const overdriveWidth = maxOverflow > 0 ? (overflowAmount / maxOverflow) * overdriveZoneWidth : 0;
|
|
28689
28796
|
const padding = 2 * s;
|
|
28690
28797
|
const barHeight = height - padding * 2;
|
|
28691
28798
|
const barY = padding;
|
|
28692
|
-
const isPositive = value > 0 || (value === 0 && zeroOnPositiveSide(sides));
|
|
28693
28799
|
// Get style based on column type (scenario vs variance)
|
|
28694
28800
|
const look = getVarianceLook(scenario, styles);
|
|
28695
28801
|
const sentimentStyle = getBarStyle(scenario, value, isPositiveGood, styles);
|
|
@@ -28733,21 +28839,23 @@ const AbsoluteVarianceBar = (props) => {
|
|
|
28733
28839
|
*/
|
|
28734
28840
|
const RelativeVariancePin = (props) => {
|
|
28735
28841
|
var _a, _b;
|
|
28736
|
-
const { value, scenario, columnStats, height, isPositiveGood, formattedValue, measureScale, locale, percentDigits, percentSign, columnWidthEm = 10, labelWidths, styles = DEFAULT_STYLES, } = props;
|
|
28842
|
+
const { value, scenario, columnStats, height, isPositiveGood, formattedValue, measureScale, locale, percentDigits, percentSign, columnWidthEm = 10, labelWidths, sideMax, styles = DEFAULT_STYLES, } = props;
|
|
28737
28843
|
const s = styles.scaleFactor;
|
|
28738
28844
|
const fs = styles.fontSize;
|
|
28739
28845
|
const headSize = PIN_HEAD_SIZE * s;
|
|
28846
|
+
const pinPx = 100 * styles.percentageScaling * fs;
|
|
28740
28847
|
const displayValue = formattedValue || formatValue(value, true, measureScale, locale, percentDigits, percentSign);
|
|
28741
|
-
const sides = labelWidths !== null && labelWidths !== void 0 ? labelWidths : ownLabelWidths(columnStats,
|
|
28742
|
-
const {
|
|
28848
|
+
const sides = labelWidths !== null && labelWidths !== void 0 ? labelWidths : ownLabelWidths(columnStats, labelWidth(displayValue, fs, styles.fontFamily, true));
|
|
28849
|
+
const { neg = Math.max(0, -columnStats.min), pos = Math.max(0, columnStats.max) } = sideMax !== null && sideMax !== void 0 ? sideMax : {};
|
|
28850
|
+
const { totalWidth, negPinLength, posPinLength, axisX, labelGap } = relativePinGeometry(columnWidthEm, styles.emPx, sides, headSize, { neg: neg * pinPx, pos: pos * pinPx });
|
|
28743
28851
|
const centerY = height / 2;
|
|
28744
28852
|
// Direct unit scaling via fontSize
|
|
28745
|
-
const
|
|
28746
|
-
const
|
|
28853
|
+
const scaledLength = Math.abs(value) * pinPx;
|
|
28854
|
+
const isPositive = value > 0 || (value === 0 && zeroOnPositiveSide(sides));
|
|
28855
|
+
const maxPinLength = isPositive ? posPinLength : negPinLength;
|
|
28747
28856
|
// auto scaling puts the longest pin on the limit, float rounding must not cut it
|
|
28748
28857
|
const isExtreme = scaledLength - maxPinLength > 1e-6;
|
|
28749
28858
|
const pinLength = Math.min(scaledLength, maxPinLength);
|
|
28750
|
-
const isPositive = value > 0 || (value === 0 && zeroOnPositiveSide(sides));
|
|
28751
28859
|
const direction = isPositive ? 1 : -1;
|
|
28752
28860
|
const pinEndX = axisX + direction * pinLength;
|
|
28753
28861
|
// Get style based on column type (scenario vs variance)
|
|
@@ -28795,7 +28903,7 @@ const CellBarChart = (props) => {
|
|
|
28795
28903
|
* guides marking their parent bar's extent.
|
|
28796
28904
|
*/
|
|
28797
28905
|
const WaterfallBar = (props) => {
|
|
28798
|
-
const { value, scenario, height, measureScale, locale, columnWidthEm = 10, styles = DEFAULT_STYLES, waterfall, } = props;
|
|
28906
|
+
const { value, scenario, height, measureScale, locale, decimalDigits, columnWidthEm = 10, styles = DEFAULT_STYLES, waterfall, } = props;
|
|
28799
28907
|
const s = styles.scaleFactor;
|
|
28800
28908
|
const fs = styles.fontSize;
|
|
28801
28909
|
const range = waterfall.max - waterfall.min;
|
|
@@ -28817,7 +28925,7 @@ const WaterfallBar = (props) => {
|
|
|
28817
28925
|
const fillValue = getBarFill(barStyle, getScenarioType(scenario));
|
|
28818
28926
|
const { stroke: barStroke, strokeWidth: barStrokeWidth } = getBarStroke(barStyle);
|
|
28819
28927
|
// Scenario values carry no variance sentiment - labels are unsigned per IBCS
|
|
28820
|
-
const displayValue = formatValue(value, waterfall.kind === "partof", measureScale, locale).replace(/^\+/, "");
|
|
28928
|
+
const displayValue = formatValue(value, waterfall.kind === "partof", measureScale, locale, 0, true, decimalDigits).replace(/^\+/, "");
|
|
28821
28929
|
const pointsLeft = endX < startX;
|
|
28822
28930
|
const labelX = pointsLeft ? barX - labelGap : barX + barWidth + labelGap;
|
|
28823
28931
|
const labelAnchor = pointsLeft ? "end" : "start";
|
|
@@ -29092,7 +29200,8 @@ class DataQuery {
|
|
|
29092
29200
|
/** Generates a GROUPHEAD row used as a visual header when row grouping is active. */
|
|
29093
29201
|
createGroupHeaderRow(rowGroupEntry, querys) {
|
|
29094
29202
|
// Generates GroupHeader Row
|
|
29095
|
-
|
|
29203
|
+
// Without a title the group sum row alone closes the group; only a list has no sum row and keeps the head as gap
|
|
29204
|
+
if (true === this.config.grouped && (this.config.showGroupTitle || !this.hasGroupSum())) {
|
|
29096
29205
|
const rowGroup = this.bind(String(rowGroupEntry.rowGroup));
|
|
29097
29206
|
const title = rowGroupEntry.rowGroup === "" ? this.bind(BLANK_BUCKET_LABEL) : rowGroup;
|
|
29098
29207
|
const groupTitle = this.config.showGroupTitle ? `,${title} as ${QueryColumnNames.CATEGORY}` : "";
|
|
@@ -29104,14 +29213,16 @@ class DataQuery {
|
|
|
29104
29213
|
GROUP BY '1'`);
|
|
29105
29214
|
}
|
|
29106
29215
|
}
|
|
29216
|
+
hasGroupSum() {
|
|
29217
|
+
return (TableType.SUM === this.config.type ||
|
|
29218
|
+
TableType.SUMNOTOTAL === this.config.type ||
|
|
29219
|
+
TableType.OPT === this.config.type ||
|
|
29220
|
+
TableType.OPTNOTOTAL === this.config.type);
|
|
29221
|
+
}
|
|
29107
29222
|
/** Generates a GROUP_SUM row that aggregates all entries within a single row group. */
|
|
29108
29223
|
createGroupSumRow(querys, groupSumQuery, rowGroupEntry, scenariosSUMQuery, queryWhereSection, order) {
|
|
29109
29224
|
// Generates SUM Row; sumsup all rows of group
|
|
29110
|
-
if (true === this.config.grouped &&
|
|
29111
|
-
(TableType.SUM === this.config.type ||
|
|
29112
|
-
TableType.SUMNOTOTAL === this.config.type ||
|
|
29113
|
-
TableType.OPT === this.config.type ||
|
|
29114
|
-
TableType.OPTNOTOTAL === this.config.type)) {
|
|
29225
|
+
if (true === this.config.grouped && this.hasGroupSum()) {
|
|
29115
29226
|
const rowGroup = this.bind(String(rowGroupEntry.rowGroup));
|
|
29116
29227
|
querys.push(`SELECT ${querys.length} as ${QueryColumnNames.ROWGROUPINDEX},
|
|
29117
29228
|
'=' as ${QueryColumnNames.OPERATION},
|
|
@@ -29419,17 +29530,19 @@ class DataQuery {
|
|
|
29419
29530
|
const entryRowsRaw = exec(`SELECT ${groups.select()}, __interval ${scenarios.length > 0 ? ",".concat(scenarios) : ""}
|
|
29420
29531
|
FROM ${bucketSource}
|
|
29421
29532
|
GROUP BY ${groups}, __interval`);
|
|
29533
|
+
// only the generated REST row has restRowGroup; a data row with the category REST keeps its own values
|
|
29534
|
+
const isGeneratedRest = (row) => row.type === "ENTRY" && row.restRowGroup != null;
|
|
29422
29535
|
// REST rows first: the math needs the raw (not yet finalized) entry aliases
|
|
29423
29536
|
if (this.config.limit > 0) {
|
|
29424
29537
|
for (let segmentIndex = 0; segmentIndex < res.length; segmentIndex++) {
|
|
29425
|
-
const restRow = res[segmentIndex].find(
|
|
29538
|
+
const restRow = res[segmentIndex].find(isGeneratedRest);
|
|
29426
29539
|
if (!restRow) {
|
|
29427
29540
|
continue;
|
|
29428
29541
|
}
|
|
29429
29542
|
// nearest preceding segment holding the displayed ENTRY rows
|
|
29430
29543
|
let entrySegment;
|
|
29431
29544
|
for (let i = segmentIndex - 1; i >= 0 && !entrySegment; i--) {
|
|
29432
|
-
const candidate = res[i].filter((row) => row.type === "ENTRY" && row
|
|
29545
|
+
const candidate = res[i].filter((row) => row.type === "ENTRY" && !isGeneratedRest(row));
|
|
29433
29546
|
if (candidate.length > 0) {
|
|
29434
29547
|
entrySegment = candidate;
|
|
29435
29548
|
}
|
|
@@ -29467,7 +29580,7 @@ class DataQuery {
|
|
|
29467
29580
|
finalizeBucketRow(entryRow);
|
|
29468
29581
|
for (const segment of res) {
|
|
29469
29582
|
for (const row of segment) {
|
|
29470
|
-
if (row.type !== "ENTRY" || row
|
|
29583
|
+
if (row.type !== "ENTRY" || isGeneratedRest(row) || row.category !== entryRow.category) {
|
|
29471
29584
|
continue;
|
|
29472
29585
|
}
|
|
29473
29586
|
if (this.config.grouped && row.rowGroup !== entryRow.rowGroup) {
|
|
@@ -29741,11 +29854,20 @@ class DataQuery {
|
|
|
29741
29854
|
}
|
|
29742
29855
|
});
|
|
29743
29856
|
this.sortSelect = [...sortKeys.values()].map((key) => `, ${key}`).join("");
|
|
29857
|
+
// a data row with the reserved category REST stays last in its group when the rows are sorted by value
|
|
29858
|
+
const sortsByValue = orderComponent.hierarchy.some((column) => {
|
|
29859
|
+
var _a;
|
|
29860
|
+
const kind = (_a = parseOrderToken(column)) === null || _a === void 0 ? void 0 : _a.kind;
|
|
29861
|
+
return kind === "scenario" || kind === "variance";
|
|
29862
|
+
});
|
|
29863
|
+
if (sortsByValue) {
|
|
29864
|
+
this.sortSelect += `, CASE WHEN ${QueryColumnNames.CATEGORY} = 'REST' THEN 1 ELSE 0 END as __sortrest`;
|
|
29865
|
+
}
|
|
29744
29866
|
// rows without a value sort last in both directions
|
|
29745
29867
|
const orderBy = (column, i, direction) => sortKeys.has(i) ? `__sortnull${i} asc, __sort${i} ${direction}` : `${column} ${direction}`;
|
|
29746
29868
|
const base = orderComponent.hierarchy.map((column, i) => orderBy(column, i, orderComponent.direction)).toString();
|
|
29747
29869
|
const inverted = orderComponent.hierarchy.map((column, i) => orderBy(column, i, inverse)).toString();
|
|
29748
|
-
return [base, inverted];
|
|
29870
|
+
return sortsByValue ? [`__sortrest asc, ${base}`, `__sortrest desc, ${inverted}`] : [base, inverted];
|
|
29749
29871
|
}
|
|
29750
29872
|
/**
|
|
29751
29873
|
* Sort key `__sort<i>` of a scenario or variance order token, as printed in an entry cell
|
|
@@ -30088,13 +30210,16 @@ function signedValue(row, column, tableType) {
|
|
|
30088
30210
|
* segmented query result once per column in display order.
|
|
30089
30211
|
*
|
|
30090
30212
|
* - ENTRY rows (incl. REST) cascade from the running total by their signed value.
|
|
30091
|
-
* - SUM / GROUP_SUM rows anchor at zero
|
|
30213
|
+
* - SUM / GROUP_SUM rows anchor at zero. A SUM row resets the running total to its
|
|
30214
|
+
* value, a GROUP_SUM row resets it to zero.
|
|
30092
30215
|
* - DRILLELEMENT (thereof) rows form a sub-cascade from their parent bar's start in
|
|
30093
30216
|
* the parent's direction; the running total is untouched.
|
|
30094
30217
|
* - PARTELEMENT (partof) rows cascade a `share * parent width` segment the same way.
|
|
30095
30218
|
* Note: the share denominator is the group sum (or SUM_TOTAL when ungrouped) per
|
|
30096
30219
|
* `createPartOfDrillRows`, not literally the parent row's value.
|
|
30097
|
-
* - GROUPHEAD
|
|
30220
|
+
* - GROUPHEAD rows get no bar and restart the running total at zero: every row group
|
|
30221
|
+
* is its own cascade that ends at its GROUP_SUM.
|
|
30222
|
+
* - NaN rows get no bar; a NaN parent orphans its drill children.
|
|
30098
30223
|
*
|
|
30099
30224
|
* @param queryData - Segmented result rows from DataQuery.execute().
|
|
30100
30225
|
* @param columns - Plain scenario column keys (ac1..pl4); no `##` composite keys.
|
|
@@ -30115,6 +30240,8 @@ function computeWaterfall(queryData, columns, tableType) {
|
|
|
30115
30240
|
for (const row of groupData) {
|
|
30116
30241
|
const type = row[QueryColumnNames.TYPE];
|
|
30117
30242
|
if (type === TableRowType.GROUPHEAD) {
|
|
30243
|
+
// a group sum only totals its own rows, so the cascade must not carry over
|
|
30244
|
+
running = 0;
|
|
30118
30245
|
lastParent = undefined;
|
|
30119
30246
|
continue;
|
|
30120
30247
|
}
|
|
@@ -30137,7 +30264,8 @@ function computeWaterfall(queryData, columns, tableType) {
|
|
|
30137
30264
|
emit(row, { start: 0, end: value, min: 0, max: 0, kind: "anchor" });
|
|
30138
30265
|
lastParent = { start: 0, end: value };
|
|
30139
30266
|
subCursor = 0;
|
|
30140
|
-
|
|
30267
|
+
// a group sum closes its group (there may be no GROUPHEAD row when the title is hidden)
|
|
30268
|
+
running = type === TableRowType.GROUPSUM ? 0 : value;
|
|
30141
30269
|
}
|
|
30142
30270
|
else if (type === TableRowType.DRILLELEMENT) {
|
|
30143
30271
|
if (value === null || lastParent === undefined) {
|
|
@@ -31263,9 +31391,22 @@ const BnTableRenderer = class {
|
|
|
31263
31391
|
this.scaleFactor = 1;
|
|
31264
31392
|
this.componentDataFormatDigits = new DataFormatDigits();
|
|
31265
31393
|
this.barColumnLayouts = new Map();
|
|
31394
|
+
// labels measured in the fallback font are too narrow or too wide once the web font is there: lay out again
|
|
31395
|
+
this.relayout = () => {
|
|
31396
|
+
if (this.barColumnLayouts.size > 0)
|
|
31397
|
+
forceUpdate(this);
|
|
31398
|
+
};
|
|
31266
31399
|
withComponentStatus(this);
|
|
31267
31400
|
this.componentStyle = withComponentStyle(this);
|
|
31268
31401
|
}
|
|
31402
|
+
connectedCallback() {
|
|
31403
|
+
var _a;
|
|
31404
|
+
(_a = document.fonts) === null || _a === void 0 ? void 0 : _a.addEventListener("loadingdone", this.relayout);
|
|
31405
|
+
}
|
|
31406
|
+
disconnectedCallback() {
|
|
31407
|
+
var _a;
|
|
31408
|
+
(_a = document.fonts) === null || _a === void 0 ? void 0 : _a.removeEventListener("loadingdone", this.relayout);
|
|
31409
|
+
}
|
|
31269
31410
|
/**
|
|
31270
31411
|
* Collects the table's layout-state contribution: header/body regions,
|
|
31271
31412
|
* counts, and - with `detail: "full"` - per-cell geometry paired with the
|
|
@@ -31384,13 +31525,15 @@ const BnTableRenderer = class {
|
|
|
31384
31525
|
}
|
|
31385
31526
|
const locale = (_d = (_c = (_b = this.stores) === null || _b === void 0 ? void 0 : _b.context) === null || _c === void 0 ? void 0 : _c.state) === null || _d === void 0 ? void 0 : _d.locale;
|
|
31386
31527
|
return (h("table", null, h("thead", null, this.table.getHeader().map((row) => (h("tr", { class: row.cssStyle }, row.getCells().map((cell) => (h("th", { colSpan: cell.colSpan, class: cell.cssStyle }, cell.getAsHeaderList().map((line, i, arr) => (h("span", null, i === arr.length - 1 ? (h("span", { class: line === " " ? "table-footer" : "" }, line, cell.drawPrefix(), " ")) : (h("span", null, line, cell.drawPrefix(), h("br", null))))))))))))), h("tbody", null, this.table.getBody().map((row) => (h("tr", Object.assign({ class: row.cssStyle }, dataPointAttributes(row.key, "element")), row === null || row === void 0 ? void 0 : row.getCells().map((cell) => {
|
|
31387
|
-
var _a, _b, _c, _d;
|
|
31528
|
+
var _a, _b, _c, _d, _e;
|
|
31388
31529
|
return (h("td", Object.assign({ colSpan: cell.colSpan, class: cell.type ? `${cell.cssStyle} ${cell.type}` : cell.cssStyle }, (row.key && cell.value != null && cell.value !== "" && cell.value !== "-"
|
|
31389
31530
|
? dataPointAttributes(Object.assign(Object.assign({}, row.key), { date: cell.date, scenario: cell.key }), "element")
|
|
31390
31531
|
: {})), cell.prefix != null ? (h("span", { class: cell.cssStyle + " " + cell.prefixStyle }, cell.drawPrefix())) : (""), cell.isBarChart &&
|
|
31391
31532
|
cell.columnStats &&
|
|
31392
31533
|
cell.value !== NOT_AVAILABLE &&
|
|
31393
|
-
|
|
31534
|
+
// an untitled group head is only a gap between list groups, a bar cell would print "-" in it
|
|
31535
|
+
(this.showGroupTitle || row.type !== TableRowType.HEADER) &&
|
|
31536
|
+
(cell.waterfall !== undefined || row.type !== TableRowType.SUM) ? (cell.waterfall !== undefined ? (h(WaterfallBar, { value: cell.value, scenario: cell.key, columnStats: cell.columnStats, height: 18 * this.scaleFactor, isRelative: false, isPositiveGood: cell.direction === "pos", measureScale: cell.measureScale, locale: locale, decimalDigits: barLabelDigits(cell, this.componentDataFormatDigits), columnWidthEm: this.barColumnMaxWidth, styles: this.barChartStyles, waterfall: cell.waterfall })) : (h(CellBarChart, { value: cell.value, scenario: cell.key, columnStats: cell.columnStats, height: 18 * this.scaleFactor, isRelative: cell.key.startsWith("dr"), isPositiveGood: cell.direction === "pos", measureScale: barLabelMeasureScale(cell), locale: locale, decimalDigits: barLabelDigits(cell, this.componentDataFormatDigits), percentDigits: (_b = (_a = this.barColumnLayouts.get(cell.key)) === null || _a === void 0 ? void 0 : _a.percentDigits) !== null && _b !== void 0 ? _b : this.componentDataFormatDigits.percent, percentSign: (_c = this.barColumnLayouts.get(cell.key)) === null || _c === void 0 ? void 0 : _c.percentSign, columnWidthEm: this.barColumnMaxWidth, labelWidths: (_d = this.barColumnLayouts.get(cell.key)) === null || _d === void 0 ? void 0 : _d.labels, sideMax: (_e = this.barColumnLayouts.get(cell.key)) === null || _e === void 0 ? void 0 : _e.sideMax, styles: this.barChartStyles }))) : (cell.draw(this.componentDataFormatDigits, locale))));
|
|
31394
31537
|
})))))));
|
|
31395
31538
|
};
|
|
31396
31539
|
return h(Host, { class: { "no-data": ((_a = this.table) === null || _a === void 0 ? void 0 : _a.hasNoData()) === true } }, helper());
|
|
@@ -31491,7 +31634,7 @@ const BnTableRenderer = class {
|
|
|
31491
31634
|
});
|
|
31492
31635
|
}
|
|
31493
31636
|
return this.componentStyle(($) => {
|
|
31494
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1
|
|
31637
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1;
|
|
31495
31638
|
const varianceStyles = (_a = $["bn-chart-time"]) === null || _a === void 0 ? void 0 : _a["varianceStyles"];
|
|
31496
31639
|
const barStyles = (_b = $["bn-chart-time"]) === null || _b === void 0 ? void 0 : _b["barStyles"];
|
|
31497
31640
|
// Default variance styles with fillpattern
|
|
@@ -31545,13 +31688,17 @@ const BnTableRenderer = class {
|
|
|
31545
31688
|
fontColor: ((_z = $["global"]) === null || _z === void 0 ? void 0 : _z["fontColor"]) || "#000000",
|
|
31546
31689
|
fontSize: (((_0 = $["global"]) === null || _0 === void 0 ? void 0 : _0["fontSizePx"]) || 13.3333) * BAR_LABEL_FONT_RATIO * this.scaleFactor,
|
|
31547
31690
|
emPx: (((_1 = $["global"]) === null || _1 === void 0 ? void 0 : _1["fontSizePx"]) || 13.3333) * this.scaleFactor,
|
|
31548
|
-
fontFamily: (
|
|
31691
|
+
fontFamily: this.labelFontFamily(),
|
|
31549
31692
|
unitScaling: resolvedUnit,
|
|
31550
31693
|
percentageScaling: resolvedPercent,
|
|
31551
31694
|
scaleFactor: this.scaleFactor,
|
|
31552
31695
|
};
|
|
31553
31696
|
});
|
|
31554
31697
|
}
|
|
31698
|
+
/** Font family of the bar and pin labels, also used to measure them. */
|
|
31699
|
+
labelFontFamily() {
|
|
31700
|
+
return this.componentStyle(($) => { var _a; return ((_a = $["global"]) === null || _a === void 0 ? void 0 : _a["fontFamily"]) || "'Noto Sans', sans-serif"; });
|
|
31701
|
+
}
|
|
31555
31702
|
/** The table's true em in px - the unit `.category-wN` and the bar columns share. */
|
|
31556
31703
|
emPx() {
|
|
31557
31704
|
return this.componentStyle(($) => { var _a; return ((_a = $["global"]) === null || _a === void 0 ? void 0 : _a["fontSizePx"]) || 13.3333; }) * this.scaleFactor;
|
|
@@ -31562,14 +31709,21 @@ const BnTableRenderer = class {
|
|
|
31562
31709
|
* One scaling for all columns, so it is the smallest that fits every column.
|
|
31563
31710
|
*/
|
|
31564
31711
|
autoUnitScaling() {
|
|
31712
|
+
var _a;
|
|
31565
31713
|
const emPx = this.emPx();
|
|
31566
31714
|
const fs = emPx * BAR_LABEL_FONT_RATIO;
|
|
31567
31715
|
let scaling = Infinity;
|
|
31568
|
-
for (const { isRelative, absMax, labels } of this.barColumnLayouts.values()) {
|
|
31716
|
+
for (const { isRelative, absMax, labels, sideMax } of this.barColumnLayouts.values()) {
|
|
31569
31717
|
if (isRelative || absMax <= 0)
|
|
31570
31718
|
continue;
|
|
31571
|
-
const
|
|
31572
|
-
|
|
31719
|
+
const geometry = absoluteBarGeometry(this.barColumnMaxWidth, emPx, labels, sideMax);
|
|
31720
|
+
for (const side of ["neg", "pos"]) {
|
|
31721
|
+
const max = (_a = sideMax[side]) !== null && _a !== void 0 ? _a : 0;
|
|
31722
|
+
if (max <= 0)
|
|
31723
|
+
continue;
|
|
31724
|
+
const { maxBarWidth, cutWidth } = geometry[side];
|
|
31725
|
+
scaling = Math.min(scaling, Math.min(maxBarWidth * 0.8, cutWidth) / (max * fs));
|
|
31726
|
+
}
|
|
31573
31727
|
}
|
|
31574
31728
|
return Number.isFinite(scaling) && fs > 0 ? scaling : 0.01;
|
|
31575
31729
|
}
|
|
@@ -31578,15 +31732,18 @@ const BnTableRenderer = class {
|
|
|
31578
31732
|
* its label exactly fill the column. One scaling for all columns, the smallest that fits.
|
|
31579
31733
|
*/
|
|
31580
31734
|
autoPercentageScaling() {
|
|
31735
|
+
var _a, _b;
|
|
31581
31736
|
const emPx = this.emPx();
|
|
31582
31737
|
const fs = emPx * BAR_LABEL_FONT_RATIO;
|
|
31583
31738
|
let scaling = Infinity;
|
|
31584
|
-
for (const { isRelative, absMax, labels } of this.barColumnLayouts.values()) {
|
|
31739
|
+
for (const { isRelative, absMax, labels, sideMax } of this.barColumnLayouts.values()) {
|
|
31585
31740
|
if (!isRelative || absMax <= 0)
|
|
31586
31741
|
continue;
|
|
31587
31742
|
const headSize = PIN_HEAD_SIZE * this.scaleFactor;
|
|
31588
|
-
|
|
31589
|
-
|
|
31743
|
+
// the longest pins of both sides share the room, each side takes what its pins need
|
|
31744
|
+
const { negPinLength, posPinLength } = relativePinGeometry(this.barColumnMaxWidth, emPx, labels, headSize);
|
|
31745
|
+
const percent = (((_a = sideMax.neg) !== null && _a !== void 0 ? _a : 0) + ((_b = sideMax.pos) !== null && _b !== void 0 ? _b : 0)) * 100;
|
|
31746
|
+
scaling = Math.min(scaling, (negPinLength + posPinLength) / (percent * fs));
|
|
31590
31747
|
}
|
|
31591
31748
|
return Number.isFinite(scaling) && fs > 0 ? scaling : 0.5;
|
|
31592
31749
|
}
|
|
@@ -31617,6 +31774,7 @@ const BnTableRenderer = class {
|
|
|
31617
31774
|
const fs = emPx * BAR_LABEL_FONT_RATIO;
|
|
31618
31775
|
const headSize = PIN_HEAD_SIZE * this.scaleFactor;
|
|
31619
31776
|
const locale = (_d = (_c = (_b = this.stores) === null || _b === void 0 ? void 0 : _b.context) === null || _c === void 0 ? void 0 : _c.state) === null || _d === void 0 ? void 0 : _d.locale;
|
|
31777
|
+
const fontFamily = this.labelFontFamily();
|
|
31620
31778
|
for (const [key, cells] of cellsByKey) {
|
|
31621
31779
|
const isRelative = key.startsWith("dr");
|
|
31622
31780
|
const values = cells.map((cell) => cell.value);
|
|
@@ -31630,8 +31788,8 @@ const BnTableRenderer = class {
|
|
|
31630
31788
|
for (const cell of cells) {
|
|
31631
31789
|
const value = cell.value;
|
|
31632
31790
|
const side = value > 0 || (value === 0 && zeroPositive) ? "pos" : "neg";
|
|
31633
|
-
const text = formatValue(value, isRelative, barLabelMeasureScale(cell), locale, percentDigits, percentSign);
|
|
31634
|
-
labels[side] = Math.max((_a = labels[side]) !== null && _a !== void 0 ? _a : 0,
|
|
31791
|
+
const text = formatValue(value, isRelative, barLabelMeasureScale(cell), locale, percentDigits, percentSign, barLabelDigits(cell, this.componentDataFormatDigits));
|
|
31792
|
+
labels[side] = Math.max((_a = labels[side]) !== null && _a !== void 0 ? _a : 0, labelWidth(text, fs, fontFamily, isRelative));
|
|
31635
31793
|
}
|
|
31636
31794
|
return labels;
|
|
31637
31795
|
};
|
|
@@ -31649,7 +31807,11 @@ const BnTableRenderer = class {
|
|
|
31649
31807
|
labels = measure(percentDigits, percentSign);
|
|
31650
31808
|
}
|
|
31651
31809
|
const absMax = Math.max(...values.map(Math.abs)) * (isRelative ? 100 : 1);
|
|
31652
|
-
|
|
31810
|
+
const sideMax = {
|
|
31811
|
+
neg: labels.neg === undefined ? undefined : Math.max(0, ...values.map((value) => -value)),
|
|
31812
|
+
pos: labels.pos === undefined ? undefined : Math.max(0, ...values),
|
|
31813
|
+
};
|
|
31814
|
+
layouts.set(key, { isRelative, absMax, labels, sideMax, percentDigits, percentSign });
|
|
31653
31815
|
}
|
|
31654
31816
|
return layouts;
|
|
31655
31817
|
}
|
|
@@ -31659,6 +31821,12 @@ const BnTableRenderer = class {
|
|
|
31659
31821
|
function barLabelMeasureScale(cell) {
|
|
31660
31822
|
return cell.type === "percentpoint" ? 0.01 : cell.measureScale;
|
|
31661
31823
|
}
|
|
31824
|
+
/** Fraction digits of the number cells of the column, so an absolute bar label prints like them. */
|
|
31825
|
+
function barLabelDigits(cell, digits) {
|
|
31826
|
+
if (cell.type === "percentpoint")
|
|
31827
|
+
return digits.percent;
|
|
31828
|
+
return cell.type === "decimal" ? digits.decimal : undefined;
|
|
31829
|
+
}
|
|
31662
31830
|
BnTableRenderer.style = bnTableRendererCss();
|
|
31663
31831
|
|
|
31664
31832
|
const bnTitleCss = () => `:host{padding:0.5em;margin-bottom:0.5em;box-sizing:border-box;-webkit-box-sizing:border-box;width:100%;display:block;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);color:var(--bn-font-color, #000000)}`;
|
|
@@ -131,6 +131,9 @@ export declare class BnTableRenderer {
|
|
|
131
131
|
private barColumnLayouts;
|
|
132
132
|
private stores;
|
|
133
133
|
constructor();
|
|
134
|
+
private readonly relayout;
|
|
135
|
+
connectedCallback(): void;
|
|
136
|
+
disconnectedCallback(): void;
|
|
134
137
|
/**
|
|
135
138
|
* Collects the table's layout-state contribution: header/body regions,
|
|
136
139
|
* counts, and - with `detail: "full"` - per-cell geometry paired with the
|
|
@@ -149,6 +152,8 @@ export declare class BnTableRenderer {
|
|
|
149
152
|
* Scenario styles (ac, pp, fc, pl) use barStyles for IBCS-compliant grayscale coloring.
|
|
150
153
|
*/
|
|
151
154
|
private prepareBarChartStyles;
|
|
155
|
+
/** Font family of the bar and pin labels, also used to measure them. */
|
|
156
|
+
private labelFontFamily;
|
|
152
157
|
/** The table's true em in px - the unit `.category-wN` and the bar columns share. */
|
|
153
158
|
private emPx;
|
|
154
159
|
/**
|
|
@@ -327,6 +327,9 @@ export declare class Table {
|
|
|
327
327
|
* inside each group, the groups keep their rowgroupindex order. With a variance or `@`, rows without data
|
|
328
328
|
* (and a relative variance with a zero reference) sort last.
|
|
329
329
|
* <br /><br />
|
|
330
|
+
* A data row with the category `REST` is the rest row of its group: sorted by a scenario or variance it stays
|
|
331
|
+
* the last row of the group. Its label comes from the `REST` translation.
|
|
332
|
+
* <br /><br />
|
|
330
333
|
* When set to ```auto```, order is detected from the dataset silently.
|
|
331
334
|
*/
|
|
332
335
|
order: string;
|
|
@@ -43,12 +43,16 @@ export interface CellBarChartProps {
|
|
|
43
43
|
measureScale?: number;
|
|
44
44
|
locale?: string;
|
|
45
45
|
percentDigits?: number;
|
|
46
|
+
/** Fraction digits of an absolute label, as in the number cells; without it the label takes an SI suffix. */
|
|
47
|
+
decimalDigits?: number;
|
|
46
48
|
/** False drops the % of a relative label, for a column too narrow for it. */
|
|
47
49
|
percentSign?: boolean;
|
|
48
50
|
/** Total column width in table em - see barColumnGeometry.ts. */
|
|
49
51
|
columnWidthEm?: number;
|
|
50
52
|
/** Widest label per side over the drawn cells of the column; without it only this cell's label counts. */
|
|
51
53
|
labelWidths?: SideLabels;
|
|
54
|
+
/** Largest absolute drawn value per side over the column; without it the column statistics count. */
|
|
55
|
+
sideMax?: SideLabels;
|
|
52
56
|
styles?: CellBarChartStyles;
|
|
53
57
|
}
|
|
54
58
|
export declare const DEFAULT_STYLES: CellBarChartStyles;
|
|
@@ -60,9 +64,10 @@ export declare const PatternDefs: FunctionalComponent<{
|
|
|
60
64
|
styles: CellBarChartStyles;
|
|
61
65
|
}>;
|
|
62
66
|
/**
|
|
63
|
-
* Formats a
|
|
67
|
+
* Formats a bar or pin label. An absolute value with `decimalDigits` prints like a number
|
|
68
|
+
* cell, without them it takes an SI suffix.
|
|
64
69
|
*/
|
|
65
|
-
export declare function formatValue(value: number, isRelative: boolean, measureScale?: number, locale?: string, percentDigits?: number, percentSign?: boolean): string;
|
|
70
|
+
export declare function formatValue(value: number, isRelative: boolean, measureScale?: number, locale?: string, percentDigits?: number, percentSign?: boolean, decimalDigits?: number): string;
|
|
66
71
|
/**
|
|
67
72
|
* Gets the scenario type from the column name (ac, pp, fc, pl).
|
|
68
73
|
*/
|
|
@@ -66,6 +66,7 @@ export declare class DataQuery {
|
|
|
66
66
|
private createDataRow;
|
|
67
67
|
/** Generates a GROUPHEAD row used as a visual header when row grouping is active. */
|
|
68
68
|
private createGroupHeaderRow;
|
|
69
|
+
private hasGroupSum;
|
|
69
70
|
/** Generates a GROUP_SUM row that aggregates all entries within a single row group. */
|
|
70
71
|
private createGroupSumRow;
|
|
71
72
|
/** Generates a total SUM row across all groups (only for SUM / OPT table types). */
|