@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
|
@@ -26919,6 +26919,9 @@ const Table$1 = class Table {
|
|
|
26919
26919
|
* inside each group, the groups keep their rowgroupindex order. With a variance or `@`, rows without data
|
|
26920
26920
|
* (and a relative variance with a zero reference) sort last.
|
|
26921
26921
|
* <br /><br />
|
|
26922
|
+
* A data row with the category `REST` is the rest row of its group: sorted by a scenario or variance it stays
|
|
26923
|
+
* the last row of the group. Its label comes from the `REST` translation.
|
|
26924
|
+
* <br /><br />
|
|
26922
26925
|
* When set to ```auto```, order is detected from the dataset silently.
|
|
26923
26926
|
*/
|
|
26924
26927
|
this.order = "category";
|
|
@@ -28048,7 +28051,7 @@ const Table$1 = class Table {
|
|
|
28048
28051
|
render() {
|
|
28049
28052
|
const fontStyles = this.getFontStyles();
|
|
28050
28053
|
const effectiveFactor = this.getEffectiveScaleFactor();
|
|
28051
|
-
return (index.h(index.Host, { key: '
|
|
28054
|
+
return (index.h(index.Host, { key: '42974a4931f678c35e5c740bf6d630966368fb4b', style: fontStyles }, index.h("div", { key: '2c8f99a8bd155e2c93e55e9542090d04afe22a31' }, index.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 }))));
|
|
28052
28055
|
}
|
|
28053
28056
|
get element() { return index.getElement(this); }
|
|
28054
28057
|
static get watchers() { return {
|
|
@@ -28353,6 +28356,43 @@ function estimateLabelWidth(text, fontSize) {
|
|
|
28353
28356
|
}
|
|
28354
28357
|
return em * fontSize * LABEL_WIDTH_MARGIN;
|
|
28355
28358
|
}
|
|
28359
|
+
/** Safety pad on a measured label, in label font size: covers subpixel rounding only. */
|
|
28360
|
+
const MEASURE_PAD = 0.15;
|
|
28361
|
+
const FONT_SENTINEL = "1px __bn_font_sentinel__";
|
|
28362
|
+
let measureContext;
|
|
28363
|
+
/** One shared 2D context; null where the document has no canvas (spec tests, mock-doc). */
|
|
28364
|
+
function labelMeasureContext() {
|
|
28365
|
+
var _a, _b, _c;
|
|
28366
|
+
if (measureContext === undefined) {
|
|
28367
|
+
try {
|
|
28368
|
+
measureContext =
|
|
28369
|
+
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);
|
|
28370
|
+
}
|
|
28371
|
+
catch (_d) {
|
|
28372
|
+
measureContext = null;
|
|
28373
|
+
}
|
|
28374
|
+
}
|
|
28375
|
+
return measureContext;
|
|
28376
|
+
}
|
|
28377
|
+
/**
|
|
28378
|
+
* Rendered width of a value label in px, measured with the font the SVG text uses. Falls
|
|
28379
|
+
* back to estimateLabelWidth where no canvas can measure.
|
|
28380
|
+
*/
|
|
28381
|
+
function labelWidth(text, fontSize, fontFamily, italic) {
|
|
28382
|
+
const ctx = labelMeasureContext();
|
|
28383
|
+
if (ctx) {
|
|
28384
|
+
// the canvas ignores a font it cannot parse and keeps the last one: the sentinel shows that
|
|
28385
|
+
ctx.font = FONT_SENTINEL;
|
|
28386
|
+
const sentinel = ctx.font;
|
|
28387
|
+
ctx.font = `${italic ? "italic " : ""}${fontSize}px ${fontFamily}`;
|
|
28388
|
+
if (ctx.font === sentinel)
|
|
28389
|
+
return estimateLabelWidth(text, fontSize);
|
|
28390
|
+
const width = ctx.measureText(text).width;
|
|
28391
|
+
if (Number.isFinite(width) && (width > 0 || text === ""))
|
|
28392
|
+
return width + MEASURE_PAD * fontSize;
|
|
28393
|
+
}
|
|
28394
|
+
return estimateLabelWidth(text, fontSize);
|
|
28395
|
+
}
|
|
28356
28396
|
/** The SVG fills the cell's content box: the requested column width minus the cell padding. */
|
|
28357
28397
|
function contentWidth(widthEm, emPx) {
|
|
28358
28398
|
return Math.max(0, (widthEm - BAR_CELL_PADDING_EM) * emPx);
|
|
@@ -28386,28 +28426,86 @@ function pinLabelsFit(widthEm, emPx, labels, headSize) {
|
|
|
28386
28426
|
const { sides, neg, pos } = sideNeeds(labels, headSize / 2, LABEL_GAP_EM * emPx);
|
|
28387
28427
|
return neg + pos + sides * minExtent(totalWidth, emPx, sides) <= totalWidth + 1e-6;
|
|
28388
28428
|
}
|
|
28389
|
-
function
|
|
28390
|
-
const totalWidth = contentWidth(widthEm, emPx);
|
|
28391
|
-
const labelGap = LABEL_GAP_EM * emPx;
|
|
28392
|
-
// a variance bar starts at the outer edge of the thick axis
|
|
28393
|
-
const { extent: maxBarWidth, axisX } = splitSides(totalWidth, labels, (VARIANCE_AXIS_EM * emPx) / 2, labelGap);
|
|
28394
|
-
const breakGap = Math.min(BREAK_GAP_EM * emPx, maxBarWidth * 0.2);
|
|
28429
|
+
function barSide(maxBarWidth, breakGap) {
|
|
28395
28430
|
const overdriveZoneWidth = maxBarWidth * OVERDRIVE_FRACTION;
|
|
28396
28431
|
return {
|
|
28397
|
-
totalWidth,
|
|
28398
28432
|
maxBarWidth,
|
|
28399
|
-
axisX,
|
|
28400
28433
|
breakGap,
|
|
28401
28434
|
overdriveZoneWidth,
|
|
28402
28435
|
cutWidth: Math.max(0, maxBarWidth - breakGap - overdriveZoneWidth),
|
|
28436
|
+
};
|
|
28437
|
+
}
|
|
28438
|
+
/**
|
|
28439
|
+
* `sideMax` is the largest absolute value per side of the axis. With it, the bar room is
|
|
28440
|
+
* split so the uncut bar length of each side is in that ratio: the axis sits where the
|
|
28441
|
+
* values need it, at any scale. Without it, both sides get the same extent.
|
|
28442
|
+
*/
|
|
28443
|
+
function absoluteBarGeometry(widthEm, emPx, labels, sideMax) {
|
|
28444
|
+
var _a, _b;
|
|
28445
|
+
const totalWidth = contentWidth(widthEm, emPx);
|
|
28446
|
+
const labelGap = LABEL_GAP_EM * emPx;
|
|
28447
|
+
// a variance bar starts at the outer edge of the thick axis
|
|
28448
|
+
const { extent, axisX } = splitSides(totalWidth, labels, (VARIANCE_AXIS_EM * emPx) / 2, labelGap);
|
|
28449
|
+
const breakGap = Math.min(BREAK_GAP_EM * emPx, extent * 0.2);
|
|
28450
|
+
const hasNeg = labels.neg !== undefined;
|
|
28451
|
+
const hasPos = labels.pos !== undefined || !hasNeg;
|
|
28452
|
+
let neg = hasNeg ? extent : 0;
|
|
28453
|
+
const maxNeg = Math.max(0, (_a = sideMax === null || sideMax === void 0 ? void 0 : sideMax.neg) !== null && _a !== void 0 ? _a : 0);
|
|
28454
|
+
const maxPos = Math.max(0, (_b = sideMax === null || sideMax === void 0 ? void 0 : sideMax.pos) !== null && _b !== void 0 ? _b : 0);
|
|
28455
|
+
if (hasNeg && hasPos && maxNeg + maxPos > 0) {
|
|
28456
|
+
// every side keeps its break gap and overdrive stub, only the uncut length follows the values
|
|
28457
|
+
const uncut = 2 * extent * (1 - OVERDRIVE_FRACTION) - 2 * breakGap;
|
|
28458
|
+
neg = (breakGap + (uncut * maxNeg) / (maxNeg + maxPos)) / (1 - OVERDRIVE_FRACTION);
|
|
28459
|
+
}
|
|
28460
|
+
const pos = hasPos ? (hasNeg ? 2 * extent - neg : extent) : 0;
|
|
28461
|
+
return {
|
|
28462
|
+
totalWidth,
|
|
28463
|
+
neg: barSide(neg, breakGap),
|
|
28464
|
+
pos: barSide(pos, breakGap),
|
|
28465
|
+
axisX: hasNeg ? axisX - extent + neg : 0,
|
|
28403
28466
|
labelGap,
|
|
28404
28467
|
};
|
|
28405
28468
|
}
|
|
28406
|
-
|
|
28469
|
+
/**
|
|
28470
|
+
* `reach` is the length in px the longest pin of each side wants at the column's scale.
|
|
28471
|
+
* With it, the pin room is split by what each side needs, so a side with shorter pins
|
|
28472
|
+
* gives its room to the other; room left after both is shared equally. Without it, both
|
|
28473
|
+
* sides get the same extent.
|
|
28474
|
+
*/
|
|
28475
|
+
function relativePinGeometry(widthEm, emPx, labels, headSize, reach) {
|
|
28476
|
+
var _a, _b;
|
|
28407
28477
|
const totalWidth = contentWidth(widthEm, emPx);
|
|
28408
28478
|
const labelGap = LABEL_GAP_EM * emPx;
|
|
28409
28479
|
const { extent, axisX } = splitSides(totalWidth, labels, headSize / 2, labelGap);
|
|
28410
|
-
|
|
28480
|
+
const hasNeg = labels.neg !== undefined;
|
|
28481
|
+
const hasPos = labels.pos !== undefined || !hasNeg;
|
|
28482
|
+
let neg = hasNeg ? extent : 0;
|
|
28483
|
+
let pos = hasPos ? extent : 0;
|
|
28484
|
+
if (reach && hasNeg && hasPos) {
|
|
28485
|
+
const room = 2 * extent;
|
|
28486
|
+
const wantNeg = Math.max(0, (_a = reach.neg) !== null && _a !== void 0 ? _a : 0);
|
|
28487
|
+
const wantPos = Math.max(0, (_b = reach.pos) !== null && _b !== void 0 ? _b : 0);
|
|
28488
|
+
if (wantNeg + wantPos <= room + 1e-6) {
|
|
28489
|
+
neg = wantNeg + (room - wantNeg - wantPos) / 2;
|
|
28490
|
+
pos = room - neg;
|
|
28491
|
+
}
|
|
28492
|
+
else if (wantNeg < extent) {
|
|
28493
|
+
neg = wantNeg;
|
|
28494
|
+
pos = room - neg;
|
|
28495
|
+
}
|
|
28496
|
+
else if (wantPos < extent) {
|
|
28497
|
+
pos = wantPos;
|
|
28498
|
+
neg = room - pos;
|
|
28499
|
+
}
|
|
28500
|
+
}
|
|
28501
|
+
return {
|
|
28502
|
+
totalWidth,
|
|
28503
|
+
maxPinLength: Math.max(neg, pos),
|
|
28504
|
+
negPinLength: neg,
|
|
28505
|
+
posPinLength: pos,
|
|
28506
|
+
axisX: hasNeg ? axisX - extent + neg : 0,
|
|
28507
|
+
labelGap,
|
|
28508
|
+
};
|
|
28411
28509
|
}
|
|
28412
28510
|
function waterfallGeometry(widthEm, emPx) {
|
|
28413
28511
|
const totalWidth = contentWidth(widthEm, emPx);
|
|
@@ -28471,9 +28569,10 @@ const PatternDefs = ({ styles }) => {
|
|
|
28471
28569
|
/** Longest relative label that keeps all percent digits; a longer one drops digits so its gutter does not eat the pins. */
|
|
28472
28570
|
const PIN_LABEL_CHARS = 7;
|
|
28473
28571
|
/**
|
|
28474
|
-
* Formats a
|
|
28572
|
+
* Formats a bar or pin label. An absolute value with `decimalDigits` prints like a number
|
|
28573
|
+
* cell, without them it takes an SI suffix.
|
|
28475
28574
|
*/
|
|
28476
|
-
function formatValue(value, isRelative, measureScale = 1, locale, percentDigits = 0, percentSign = true) {
|
|
28575
|
+
function formatValue(value, isRelative, measureScale = 1, locale, percentDigits = 0, percentSign = true, decimalDigits) {
|
|
28477
28576
|
// IBCS prints a value that rounds to zero without a sign
|
|
28478
28577
|
const signed = (text, zero) => (value > 0 && text !== zero ? "+" : "") + text;
|
|
28479
28578
|
if (isRelative) {
|
|
@@ -28491,6 +28590,10 @@ function formatValue(value, isRelative, measureScale = 1, locale, percentDigits
|
|
|
28491
28590
|
}
|
|
28492
28591
|
// Absolute variance - apply measure scale and use SI prefixes
|
|
28493
28592
|
const scaledValue = value / measureScale;
|
|
28593
|
+
if (decimalDigits !== undefined) {
|
|
28594
|
+
const number = (v) => Formatter.number(v, "decimal", decimalDigits, decimalDigits, 1, locale);
|
|
28595
|
+
return signed(number(scaledValue), number(0));
|
|
28596
|
+
}
|
|
28494
28597
|
const absValue = Math.abs(scaledValue);
|
|
28495
28598
|
let unit = 1;
|
|
28496
28599
|
let suffix = "";
|
|
@@ -28673,25 +28776,28 @@ function renderZigzagBreak(breakX, breakGap, yTop, barHeight, s) {
|
|
|
28673
28776
|
* exactly `columnWidthEm` em - see barColumnGeometry.ts.
|
|
28674
28777
|
*/
|
|
28675
28778
|
const AbsoluteVarianceBar = (props) => {
|
|
28676
|
-
const { value, scenario, columnStats, height, isPositiveGood, formattedValue, measureScale, locale, columnWidthEm = 10, labelWidths, styles = DEFAULT_STYLES, } = props;
|
|
28779
|
+
const { value, scenario, columnStats, height, isPositiveGood, formattedValue, measureScale, locale, decimalDigits, columnWidthEm = 10, labelWidths, sideMax, styles = DEFAULT_STYLES, } = props;
|
|
28677
28780
|
const s = styles.scaleFactor;
|
|
28678
28781
|
const fs = styles.fontSize;
|
|
28679
|
-
const displayValue = formattedValue || formatValue(value, false, measureScale, locale);
|
|
28680
|
-
const sides = labelWidths !== null && labelWidths !== void 0 ? labelWidths : ownLabelWidths(columnStats,
|
|
28681
|
-
const
|
|
28782
|
+
const displayValue = formattedValue || formatValue(value, false, measureScale, locale, 0, true, decimalDigits);
|
|
28783
|
+
const sides = labelWidths !== null && labelWidths !== void 0 ? labelWidths : ownLabelWidths(columnStats, labelWidth(displayValue, fs, styles.fontFamily, false));
|
|
28784
|
+
const isPositive = value > 0 || (value === 0 && zeroOnPositiveSide(sides));
|
|
28785
|
+
const { neg = Math.max(0, -columnStats.min), pos = Math.max(0, columnStats.max) } = sideMax !== null && sideMax !== void 0 ? sideMax : {};
|
|
28786
|
+
const geometry = absoluteBarGeometry(columnWidthEm, styles.emPx, sides, { neg, pos });
|
|
28787
|
+
const { totalWidth, axisX, labelGap } = geometry;
|
|
28788
|
+
const { breakGap, overdriveZoneWidth, cutWidth } = isPositive ? geometry.pos : geometry.neg;
|
|
28682
28789
|
// Direct unit scaling via fontSize
|
|
28683
28790
|
const scaledWidth = Math.abs(value) * styles.unitScaling * fs;
|
|
28684
28791
|
// auto scaling puts the largest bar on the cut, float rounding must not turn it into an overdrive bar
|
|
28685
28792
|
const isExtreme = scaledWidth - cutWidth > 1e-6;
|
|
28686
28793
|
// Compute proportional overdrive width across the column
|
|
28687
|
-
const maxScaledWidth =
|
|
28794
|
+
const maxScaledWidth = (isPositive ? pos : neg) * styles.unitScaling * fs;
|
|
28688
28795
|
const maxOverflow = Math.max(0, maxScaledWidth - cutWidth);
|
|
28689
28796
|
const overflowAmount = Math.max(0, scaledWidth - cutWidth);
|
|
28690
28797
|
const overdriveWidth = maxOverflow > 0 ? (overflowAmount / maxOverflow) * overdriveZoneWidth : 0;
|
|
28691
28798
|
const padding = 2 * s;
|
|
28692
28799
|
const barHeight = height - padding * 2;
|
|
28693
28800
|
const barY = padding;
|
|
28694
|
-
const isPositive = value > 0 || (value === 0 && zeroOnPositiveSide(sides));
|
|
28695
28801
|
// Get style based on column type (scenario vs variance)
|
|
28696
28802
|
const look = getVarianceLook(scenario, styles);
|
|
28697
28803
|
const sentimentStyle = getBarStyle(scenario, value, isPositiveGood, styles);
|
|
@@ -28735,21 +28841,23 @@ const AbsoluteVarianceBar = (props) => {
|
|
|
28735
28841
|
*/
|
|
28736
28842
|
const RelativeVariancePin = (props) => {
|
|
28737
28843
|
var _a, _b;
|
|
28738
|
-
const { value, scenario, columnStats, height, isPositiveGood, formattedValue, measureScale, locale, percentDigits, percentSign, columnWidthEm = 10, labelWidths, styles = DEFAULT_STYLES, } = props;
|
|
28844
|
+
const { value, scenario, columnStats, height, isPositiveGood, formattedValue, measureScale, locale, percentDigits, percentSign, columnWidthEm = 10, labelWidths, sideMax, styles = DEFAULT_STYLES, } = props;
|
|
28739
28845
|
const s = styles.scaleFactor;
|
|
28740
28846
|
const fs = styles.fontSize;
|
|
28741
28847
|
const headSize = PIN_HEAD_SIZE * s;
|
|
28848
|
+
const pinPx = 100 * styles.percentageScaling * fs;
|
|
28742
28849
|
const displayValue = formattedValue || formatValue(value, true, measureScale, locale, percentDigits, percentSign);
|
|
28743
|
-
const sides = labelWidths !== null && labelWidths !== void 0 ? labelWidths : ownLabelWidths(columnStats,
|
|
28744
|
-
const {
|
|
28850
|
+
const sides = labelWidths !== null && labelWidths !== void 0 ? labelWidths : ownLabelWidths(columnStats, labelWidth(displayValue, fs, styles.fontFamily, true));
|
|
28851
|
+
const { neg = Math.max(0, -columnStats.min), pos = Math.max(0, columnStats.max) } = sideMax !== null && sideMax !== void 0 ? sideMax : {};
|
|
28852
|
+
const { totalWidth, negPinLength, posPinLength, axisX, labelGap } = relativePinGeometry(columnWidthEm, styles.emPx, sides, headSize, { neg: neg * pinPx, pos: pos * pinPx });
|
|
28745
28853
|
const centerY = height / 2;
|
|
28746
28854
|
// Direct unit scaling via fontSize
|
|
28747
|
-
const
|
|
28748
|
-
const
|
|
28855
|
+
const scaledLength = Math.abs(value) * pinPx;
|
|
28856
|
+
const isPositive = value > 0 || (value === 0 && zeroOnPositiveSide(sides));
|
|
28857
|
+
const maxPinLength = isPositive ? posPinLength : negPinLength;
|
|
28749
28858
|
// auto scaling puts the longest pin on the limit, float rounding must not cut it
|
|
28750
28859
|
const isExtreme = scaledLength - maxPinLength > 1e-6;
|
|
28751
28860
|
const pinLength = Math.min(scaledLength, maxPinLength);
|
|
28752
|
-
const isPositive = value > 0 || (value === 0 && zeroOnPositiveSide(sides));
|
|
28753
28861
|
const direction = isPositive ? 1 : -1;
|
|
28754
28862
|
const pinEndX = axisX + direction * pinLength;
|
|
28755
28863
|
// Get style based on column type (scenario vs variance)
|
|
@@ -28797,7 +28905,7 @@ const CellBarChart = (props) => {
|
|
|
28797
28905
|
* guides marking their parent bar's extent.
|
|
28798
28906
|
*/
|
|
28799
28907
|
const WaterfallBar = (props) => {
|
|
28800
|
-
const { value, scenario, height, measureScale, locale, columnWidthEm = 10, styles = DEFAULT_STYLES, waterfall, } = props;
|
|
28908
|
+
const { value, scenario, height, measureScale, locale, decimalDigits, columnWidthEm = 10, styles = DEFAULT_STYLES, waterfall, } = props;
|
|
28801
28909
|
const s = styles.scaleFactor;
|
|
28802
28910
|
const fs = styles.fontSize;
|
|
28803
28911
|
const range = waterfall.max - waterfall.min;
|
|
@@ -28819,7 +28927,7 @@ const WaterfallBar = (props) => {
|
|
|
28819
28927
|
const fillValue = getBarFill(barStyle, getScenarioType(scenario));
|
|
28820
28928
|
const { stroke: barStroke, strokeWidth: barStrokeWidth } = getBarStroke(barStyle);
|
|
28821
28929
|
// Scenario values carry no variance sentiment - labels are unsigned per IBCS
|
|
28822
|
-
const displayValue = formatValue(value, waterfall.kind === "partof", measureScale, locale).replace(/^\+/, "");
|
|
28930
|
+
const displayValue = formatValue(value, waterfall.kind === "partof", measureScale, locale, 0, true, decimalDigits).replace(/^\+/, "");
|
|
28823
28931
|
const pointsLeft = endX < startX;
|
|
28824
28932
|
const labelX = pointsLeft ? barX - labelGap : barX + barWidth + labelGap;
|
|
28825
28933
|
const labelAnchor = pointsLeft ? "end" : "start";
|
|
@@ -29094,7 +29202,8 @@ class DataQuery {
|
|
|
29094
29202
|
/** Generates a GROUPHEAD row used as a visual header when row grouping is active. */
|
|
29095
29203
|
createGroupHeaderRow(rowGroupEntry, querys) {
|
|
29096
29204
|
// Generates GroupHeader Row
|
|
29097
|
-
|
|
29205
|
+
// Without a title the group sum row alone closes the group; only a list has no sum row and keeps the head as gap
|
|
29206
|
+
if (true === this.config.grouped && (this.config.showGroupTitle || !this.hasGroupSum())) {
|
|
29098
29207
|
const rowGroup = this.bind(String(rowGroupEntry.rowGroup));
|
|
29099
29208
|
const title = rowGroupEntry.rowGroup === "" ? this.bind(BLANK_BUCKET_LABEL) : rowGroup;
|
|
29100
29209
|
const groupTitle = this.config.showGroupTitle ? `,${title} as ${QueryColumnNames.CATEGORY}` : "";
|
|
@@ -29106,14 +29215,16 @@ class DataQuery {
|
|
|
29106
29215
|
GROUP BY '1'`);
|
|
29107
29216
|
}
|
|
29108
29217
|
}
|
|
29218
|
+
hasGroupSum() {
|
|
29219
|
+
return (TableType.SUM === this.config.type ||
|
|
29220
|
+
TableType.SUMNOTOTAL === this.config.type ||
|
|
29221
|
+
TableType.OPT === this.config.type ||
|
|
29222
|
+
TableType.OPTNOTOTAL === this.config.type);
|
|
29223
|
+
}
|
|
29109
29224
|
/** Generates a GROUP_SUM row that aggregates all entries within a single row group. */
|
|
29110
29225
|
createGroupSumRow(querys, groupSumQuery, rowGroupEntry, scenariosSUMQuery, queryWhereSection, order) {
|
|
29111
29226
|
// Generates SUM Row; sumsup all rows of group
|
|
29112
|
-
if (true === this.config.grouped &&
|
|
29113
|
-
(TableType.SUM === this.config.type ||
|
|
29114
|
-
TableType.SUMNOTOTAL === this.config.type ||
|
|
29115
|
-
TableType.OPT === this.config.type ||
|
|
29116
|
-
TableType.OPTNOTOTAL === this.config.type)) {
|
|
29227
|
+
if (true === this.config.grouped && this.hasGroupSum()) {
|
|
29117
29228
|
const rowGroup = this.bind(String(rowGroupEntry.rowGroup));
|
|
29118
29229
|
querys.push(`SELECT ${querys.length} as ${QueryColumnNames.ROWGROUPINDEX},
|
|
29119
29230
|
'=' as ${QueryColumnNames.OPERATION},
|
|
@@ -29421,17 +29532,19 @@ class DataQuery {
|
|
|
29421
29532
|
const entryRowsRaw = exec(`SELECT ${groups.select()}, __interval ${scenarios.length > 0 ? ",".concat(scenarios) : ""}
|
|
29422
29533
|
FROM ${bucketSource}
|
|
29423
29534
|
GROUP BY ${groups}, __interval`);
|
|
29535
|
+
// only the generated REST row has restRowGroup; a data row with the category REST keeps its own values
|
|
29536
|
+
const isGeneratedRest = (row) => row.type === "ENTRY" && row.restRowGroup != null;
|
|
29424
29537
|
// REST rows first: the math needs the raw (not yet finalized) entry aliases
|
|
29425
29538
|
if (this.config.limit > 0) {
|
|
29426
29539
|
for (let segmentIndex = 0; segmentIndex < res.length; segmentIndex++) {
|
|
29427
|
-
const restRow = res[segmentIndex].find(
|
|
29540
|
+
const restRow = res[segmentIndex].find(isGeneratedRest);
|
|
29428
29541
|
if (!restRow) {
|
|
29429
29542
|
continue;
|
|
29430
29543
|
}
|
|
29431
29544
|
// nearest preceding segment holding the displayed ENTRY rows
|
|
29432
29545
|
let entrySegment;
|
|
29433
29546
|
for (let i = segmentIndex - 1; i >= 0 && !entrySegment; i--) {
|
|
29434
|
-
const candidate = res[i].filter((row) => row.type === "ENTRY" && row
|
|
29547
|
+
const candidate = res[i].filter((row) => row.type === "ENTRY" && !isGeneratedRest(row));
|
|
29435
29548
|
if (candidate.length > 0) {
|
|
29436
29549
|
entrySegment = candidate;
|
|
29437
29550
|
}
|
|
@@ -29469,7 +29582,7 @@ class DataQuery {
|
|
|
29469
29582
|
finalizeBucketRow(entryRow);
|
|
29470
29583
|
for (const segment of res) {
|
|
29471
29584
|
for (const row of segment) {
|
|
29472
|
-
if (row.type !== "ENTRY" || row
|
|
29585
|
+
if (row.type !== "ENTRY" || isGeneratedRest(row) || row.category !== entryRow.category) {
|
|
29473
29586
|
continue;
|
|
29474
29587
|
}
|
|
29475
29588
|
if (this.config.grouped && row.rowGroup !== entryRow.rowGroup) {
|
|
@@ -29743,11 +29856,20 @@ class DataQuery {
|
|
|
29743
29856
|
}
|
|
29744
29857
|
});
|
|
29745
29858
|
this.sortSelect = [...sortKeys.values()].map((key) => `, ${key}`).join("");
|
|
29859
|
+
// a data row with the reserved category REST stays last in its group when the rows are sorted by value
|
|
29860
|
+
const sortsByValue = orderComponent.hierarchy.some((column) => {
|
|
29861
|
+
var _a;
|
|
29862
|
+
const kind = (_a = withStyled.parseOrderToken(column)) === null || _a === void 0 ? void 0 : _a.kind;
|
|
29863
|
+
return kind === "scenario" || kind === "variance";
|
|
29864
|
+
});
|
|
29865
|
+
if (sortsByValue) {
|
|
29866
|
+
this.sortSelect += `, CASE WHEN ${QueryColumnNames.CATEGORY} = 'REST' THEN 1 ELSE 0 END as __sortrest`;
|
|
29867
|
+
}
|
|
29746
29868
|
// rows without a value sort last in both directions
|
|
29747
29869
|
const orderBy = (column, i, direction) => sortKeys.has(i) ? `__sortnull${i} asc, __sort${i} ${direction}` : `${column} ${direction}`;
|
|
29748
29870
|
const base = orderComponent.hierarchy.map((column, i) => orderBy(column, i, orderComponent.direction)).toString();
|
|
29749
29871
|
const inverted = orderComponent.hierarchy.map((column, i) => orderBy(column, i, inverse)).toString();
|
|
29750
|
-
return [base, inverted];
|
|
29872
|
+
return sortsByValue ? [`__sortrest asc, ${base}`, `__sortrest desc, ${inverted}`] : [base, inverted];
|
|
29751
29873
|
}
|
|
29752
29874
|
/**
|
|
29753
29875
|
* Sort key `__sort<i>` of a scenario or variance order token, as printed in an entry cell
|
|
@@ -30090,13 +30212,16 @@ function signedValue(row, column, tableType) {
|
|
|
30090
30212
|
* segmented query result once per column in display order.
|
|
30091
30213
|
*
|
|
30092
30214
|
* - ENTRY rows (incl. REST) cascade from the running total by their signed value.
|
|
30093
|
-
* - SUM / GROUP_SUM rows anchor at zero
|
|
30215
|
+
* - SUM / GROUP_SUM rows anchor at zero. A SUM row resets the running total to its
|
|
30216
|
+
* value, a GROUP_SUM row resets it to zero.
|
|
30094
30217
|
* - DRILLELEMENT (thereof) rows form a sub-cascade from their parent bar's start in
|
|
30095
30218
|
* the parent's direction; the running total is untouched.
|
|
30096
30219
|
* - PARTELEMENT (partof) rows cascade a `share * parent width` segment the same way.
|
|
30097
30220
|
* Note: the share denominator is the group sum (or SUM_TOTAL when ungrouped) per
|
|
30098
30221
|
* `createPartOfDrillRows`, not literally the parent row's value.
|
|
30099
|
-
* - GROUPHEAD
|
|
30222
|
+
* - GROUPHEAD rows get no bar and restart the running total at zero: every row group
|
|
30223
|
+
* is its own cascade that ends at its GROUP_SUM.
|
|
30224
|
+
* - NaN rows get no bar; a NaN parent orphans its drill children.
|
|
30100
30225
|
*
|
|
30101
30226
|
* @param queryData - Segmented result rows from DataQuery.execute().
|
|
30102
30227
|
* @param columns - Plain scenario column keys (ac1..pl4); no `##` composite keys.
|
|
@@ -30117,6 +30242,8 @@ function computeWaterfall(queryData, columns, tableType) {
|
|
|
30117
30242
|
for (const row of groupData) {
|
|
30118
30243
|
const type = row[QueryColumnNames.TYPE];
|
|
30119
30244
|
if (type === TableRowType.GROUPHEAD) {
|
|
30245
|
+
// a group sum only totals its own rows, so the cascade must not carry over
|
|
30246
|
+
running = 0;
|
|
30120
30247
|
lastParent = undefined;
|
|
30121
30248
|
continue;
|
|
30122
30249
|
}
|
|
@@ -30139,7 +30266,8 @@ function computeWaterfall(queryData, columns, tableType) {
|
|
|
30139
30266
|
emit(row, { start: 0, end: value, min: 0, max: 0, kind: "anchor" });
|
|
30140
30267
|
lastParent = { start: 0, end: value };
|
|
30141
30268
|
subCursor = 0;
|
|
30142
|
-
|
|
30269
|
+
// a group sum closes its group (there may be no GROUPHEAD row when the title is hidden)
|
|
30270
|
+
running = type === TableRowType.GROUPSUM ? 0 : value;
|
|
30143
30271
|
}
|
|
30144
30272
|
else if (type === TableRowType.DRILLELEMENT) {
|
|
30145
30273
|
if (value === null || lastParent === undefined) {
|
|
@@ -31265,9 +31393,22 @@ const BnTableRenderer = class {
|
|
|
31265
31393
|
this.scaleFactor = 1;
|
|
31266
31394
|
this.componentDataFormatDigits = new DataFormatDigits();
|
|
31267
31395
|
this.barColumnLayouts = new Map();
|
|
31396
|
+
// labels measured in the fallback font are too narrow or too wide once the web font is there: lay out again
|
|
31397
|
+
this.relayout = () => {
|
|
31398
|
+
if (this.barColumnLayouts.size > 0)
|
|
31399
|
+
index.forceUpdate(this);
|
|
31400
|
+
};
|
|
31268
31401
|
withHasError.withComponentStatus(this);
|
|
31269
31402
|
this.componentStyle = withStyled.withComponentStyle(this);
|
|
31270
31403
|
}
|
|
31404
|
+
connectedCallback() {
|
|
31405
|
+
var _a;
|
|
31406
|
+
(_a = document.fonts) === null || _a === void 0 ? void 0 : _a.addEventListener("loadingdone", this.relayout);
|
|
31407
|
+
}
|
|
31408
|
+
disconnectedCallback() {
|
|
31409
|
+
var _a;
|
|
31410
|
+
(_a = document.fonts) === null || _a === void 0 ? void 0 : _a.removeEventListener("loadingdone", this.relayout);
|
|
31411
|
+
}
|
|
31271
31412
|
/**
|
|
31272
31413
|
* Collects the table's layout-state contribution: header/body regions,
|
|
31273
31414
|
* counts, and - with `detail: "full"` - per-cell geometry paired with the
|
|
@@ -31386,13 +31527,15 @@ const BnTableRenderer = class {
|
|
|
31386
31527
|
}
|
|
31387
31528
|
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;
|
|
31388
31529
|
return (index.h("table", null, index.h("thead", null, this.table.getHeader().map((row) => (index.h("tr", { class: row.cssStyle }, row.getCells().map((cell) => (index.h("th", { colSpan: cell.colSpan, class: cell.cssStyle }, cell.getAsHeaderList().map((line, i, arr) => (index.h("span", null, i === arr.length - 1 ? (index.h("span", { class: line === " " ? "table-footer" : "" }, line, cell.drawPrefix(), " ")) : (index.h("span", null, line, cell.drawPrefix(), index.h("br", null))))))))))))), index.h("tbody", null, this.table.getBody().map((row) => (index.h("tr", Object.assign({ class: row.cssStyle }, dataPointAttributes(row.key, "element")), row === null || row === void 0 ? void 0 : row.getCells().map((cell) => {
|
|
31389
|
-
var _a, _b, _c, _d;
|
|
31530
|
+
var _a, _b, _c, _d, _e;
|
|
31390
31531
|
return (index.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 !== "-"
|
|
31391
31532
|
? dataPointAttributes(Object.assign(Object.assign({}, row.key), { date: cell.date, scenario: cell.key }), "element")
|
|
31392
31533
|
: {})), cell.prefix != null ? (index.h("span", { class: cell.cssStyle + " " + cell.prefixStyle }, cell.drawPrefix())) : (""), cell.isBarChart &&
|
|
31393
31534
|
cell.columnStats &&
|
|
31394
31535
|
cell.value !== withStyled.NOT_AVAILABLE &&
|
|
31395
|
-
|
|
31536
|
+
// an untitled group head is only a gap between list groups, a bar cell would print "-" in it
|
|
31537
|
+
(this.showGroupTitle || row.type !== TableRowType.HEADER) &&
|
|
31538
|
+
(cell.waterfall !== undefined || row.type !== TableRowType.SUM) ? (cell.waterfall !== undefined ? (index.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 })) : (index.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))));
|
|
31396
31539
|
})))))));
|
|
31397
31540
|
};
|
|
31398
31541
|
return index.h(index.Host, { class: { "no-data": ((_a = this.table) === null || _a === void 0 ? void 0 : _a.hasNoData()) === true } }, helper());
|
|
@@ -31493,7 +31636,7 @@ const BnTableRenderer = class {
|
|
|
31493
31636
|
});
|
|
31494
31637
|
}
|
|
31495
31638
|
return this.componentStyle(($) => {
|
|
31496
|
-
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
|
|
31639
|
+
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;
|
|
31497
31640
|
const varianceStyles = (_a = $["bn-chart-time"]) === null || _a === void 0 ? void 0 : _a["varianceStyles"];
|
|
31498
31641
|
const barStyles = (_b = $["bn-chart-time"]) === null || _b === void 0 ? void 0 : _b["barStyles"];
|
|
31499
31642
|
// Default variance styles with fillpattern
|
|
@@ -31547,13 +31690,17 @@ const BnTableRenderer = class {
|
|
|
31547
31690
|
fontColor: ((_z = $["global"]) === null || _z === void 0 ? void 0 : _z["fontColor"]) || "#000000",
|
|
31548
31691
|
fontSize: (((_0 = $["global"]) === null || _0 === void 0 ? void 0 : _0["fontSizePx"]) || 13.3333) * BAR_LABEL_FONT_RATIO * this.scaleFactor,
|
|
31549
31692
|
emPx: (((_1 = $["global"]) === null || _1 === void 0 ? void 0 : _1["fontSizePx"]) || 13.3333) * this.scaleFactor,
|
|
31550
|
-
fontFamily: (
|
|
31693
|
+
fontFamily: this.labelFontFamily(),
|
|
31551
31694
|
unitScaling: resolvedUnit,
|
|
31552
31695
|
percentageScaling: resolvedPercent,
|
|
31553
31696
|
scaleFactor: this.scaleFactor,
|
|
31554
31697
|
};
|
|
31555
31698
|
});
|
|
31556
31699
|
}
|
|
31700
|
+
/** Font family of the bar and pin labels, also used to measure them. */
|
|
31701
|
+
labelFontFamily() {
|
|
31702
|
+
return this.componentStyle(($) => { var _a; return ((_a = $["global"]) === null || _a === void 0 ? void 0 : _a["fontFamily"]) || "'Noto Sans', sans-serif"; });
|
|
31703
|
+
}
|
|
31557
31704
|
/** The table's true em in px - the unit `.category-wN` and the bar columns share. */
|
|
31558
31705
|
emPx() {
|
|
31559
31706
|
return this.componentStyle(($) => { var _a; return ((_a = $["global"]) === null || _a === void 0 ? void 0 : _a["fontSizePx"]) || 13.3333; }) * this.scaleFactor;
|
|
@@ -31564,14 +31711,21 @@ const BnTableRenderer = class {
|
|
|
31564
31711
|
* One scaling for all columns, so it is the smallest that fits every column.
|
|
31565
31712
|
*/
|
|
31566
31713
|
autoUnitScaling() {
|
|
31714
|
+
var _a;
|
|
31567
31715
|
const emPx = this.emPx();
|
|
31568
31716
|
const fs = emPx * BAR_LABEL_FONT_RATIO;
|
|
31569
31717
|
let scaling = Infinity;
|
|
31570
|
-
for (const { isRelative, absMax, labels } of this.barColumnLayouts.values()) {
|
|
31718
|
+
for (const { isRelative, absMax, labels, sideMax } of this.barColumnLayouts.values()) {
|
|
31571
31719
|
if (isRelative || absMax <= 0)
|
|
31572
31720
|
continue;
|
|
31573
|
-
const
|
|
31574
|
-
|
|
31721
|
+
const geometry = absoluteBarGeometry(this.barColumnMaxWidth, emPx, labels, sideMax);
|
|
31722
|
+
for (const side of ["neg", "pos"]) {
|
|
31723
|
+
const max = (_a = sideMax[side]) !== null && _a !== void 0 ? _a : 0;
|
|
31724
|
+
if (max <= 0)
|
|
31725
|
+
continue;
|
|
31726
|
+
const { maxBarWidth, cutWidth } = geometry[side];
|
|
31727
|
+
scaling = Math.min(scaling, Math.min(maxBarWidth * 0.8, cutWidth) / (max * fs));
|
|
31728
|
+
}
|
|
31575
31729
|
}
|
|
31576
31730
|
return Number.isFinite(scaling) && fs > 0 ? scaling : 0.01;
|
|
31577
31731
|
}
|
|
@@ -31580,15 +31734,18 @@ const BnTableRenderer = class {
|
|
|
31580
31734
|
* its label exactly fill the column. One scaling for all columns, the smallest that fits.
|
|
31581
31735
|
*/
|
|
31582
31736
|
autoPercentageScaling() {
|
|
31737
|
+
var _a, _b;
|
|
31583
31738
|
const emPx = this.emPx();
|
|
31584
31739
|
const fs = emPx * BAR_LABEL_FONT_RATIO;
|
|
31585
31740
|
let scaling = Infinity;
|
|
31586
|
-
for (const { isRelative, absMax, labels } of this.barColumnLayouts.values()) {
|
|
31741
|
+
for (const { isRelative, absMax, labels, sideMax } of this.barColumnLayouts.values()) {
|
|
31587
31742
|
if (!isRelative || absMax <= 0)
|
|
31588
31743
|
continue;
|
|
31589
31744
|
const headSize = PIN_HEAD_SIZE * this.scaleFactor;
|
|
31590
|
-
|
|
31591
|
-
|
|
31745
|
+
// the longest pins of both sides share the room, each side takes what its pins need
|
|
31746
|
+
const { negPinLength, posPinLength } = relativePinGeometry(this.barColumnMaxWidth, emPx, labels, headSize);
|
|
31747
|
+
const percent = (((_a = sideMax.neg) !== null && _a !== void 0 ? _a : 0) + ((_b = sideMax.pos) !== null && _b !== void 0 ? _b : 0)) * 100;
|
|
31748
|
+
scaling = Math.min(scaling, (negPinLength + posPinLength) / (percent * fs));
|
|
31592
31749
|
}
|
|
31593
31750
|
return Number.isFinite(scaling) && fs > 0 ? scaling : 0.5;
|
|
31594
31751
|
}
|
|
@@ -31619,6 +31776,7 @@ const BnTableRenderer = class {
|
|
|
31619
31776
|
const fs = emPx * BAR_LABEL_FONT_RATIO;
|
|
31620
31777
|
const headSize = PIN_HEAD_SIZE * this.scaleFactor;
|
|
31621
31778
|
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;
|
|
31779
|
+
const fontFamily = this.labelFontFamily();
|
|
31622
31780
|
for (const [key, cells] of cellsByKey) {
|
|
31623
31781
|
const isRelative = key.startsWith("dr");
|
|
31624
31782
|
const values = cells.map((cell) => cell.value);
|
|
@@ -31632,8 +31790,8 @@ const BnTableRenderer = class {
|
|
|
31632
31790
|
for (const cell of cells) {
|
|
31633
31791
|
const value = cell.value;
|
|
31634
31792
|
const side = value > 0 || (value === 0 && zeroPositive) ? "pos" : "neg";
|
|
31635
|
-
const text = formatValue(value, isRelative, barLabelMeasureScale(cell), locale, percentDigits, percentSign);
|
|
31636
|
-
labels[side] = Math.max((_a = labels[side]) !== null && _a !== void 0 ? _a : 0,
|
|
31793
|
+
const text = formatValue(value, isRelative, barLabelMeasureScale(cell), locale, percentDigits, percentSign, barLabelDigits(cell, this.componentDataFormatDigits));
|
|
31794
|
+
labels[side] = Math.max((_a = labels[side]) !== null && _a !== void 0 ? _a : 0, labelWidth(text, fs, fontFamily, isRelative));
|
|
31637
31795
|
}
|
|
31638
31796
|
return labels;
|
|
31639
31797
|
};
|
|
@@ -31651,7 +31809,11 @@ const BnTableRenderer = class {
|
|
|
31651
31809
|
labels = measure(percentDigits, percentSign);
|
|
31652
31810
|
}
|
|
31653
31811
|
const absMax = Math.max(...values.map(Math.abs)) * (isRelative ? 100 : 1);
|
|
31654
|
-
|
|
31812
|
+
const sideMax = {
|
|
31813
|
+
neg: labels.neg === undefined ? undefined : Math.max(0, ...values.map((value) => -value)),
|
|
31814
|
+
pos: labels.pos === undefined ? undefined : Math.max(0, ...values),
|
|
31815
|
+
};
|
|
31816
|
+
layouts.set(key, { isRelative, absMax, labels, sideMax, percentDigits, percentSign });
|
|
31655
31817
|
}
|
|
31656
31818
|
return layouts;
|
|
31657
31819
|
}
|
|
@@ -31661,6 +31823,12 @@ const BnTableRenderer = class {
|
|
|
31661
31823
|
function barLabelMeasureScale(cell) {
|
|
31662
31824
|
return cell.type === "percentpoint" ? 0.01 : cell.measureScale;
|
|
31663
31825
|
}
|
|
31826
|
+
/** Fraction digits of the number cells of the column, so an absolute bar label prints like them. */
|
|
31827
|
+
function barLabelDigits(cell, digits) {
|
|
31828
|
+
if (cell.type === "percentpoint")
|
|
31829
|
+
return digits.percent;
|
|
31830
|
+
return cell.type === "decimal" ? digits.decimal : undefined;
|
|
31831
|
+
}
|
|
31664
31832
|
BnTableRenderer.style = bnTableRendererCss();
|
|
31665
31833
|
|
|
31666
31834
|
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)}`;
|