@bino-bi/bn-template-engine 1.0.0-next.21 → 1.0.0-next.22
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-99477a27.entry.js → p-445c76cd.entry.js} +1 -1
- package/dist/bn-template-engine/p-7d1083f6.entry.js +1 -0
- package/dist/bn-template-engine/{p-7e9dbc93.entry.js → p-91e5dddf.entry.js} +1 -1
- package/dist/bn-template-engine/{p-b9e94127.entry.js → p-93eaded3.entry.js} +1 -1
- package/dist/bn-template-engine/{p-BpWWgN6k.js → p-D1SJ10zl.js} +1 -1
- package/dist/bn-template-engine/p-D75i_YOP.js +1 -0
- package/dist/bn-template-engine/{p-A8xyE4b1.js → p-Da6p_F4J.js} +1 -1
- package/dist/bn-template-engine/{p-a1380d7c.entry.js → p-c3383557.entry.js} +1 -1
- package/dist/bn-template-engine/{p-ba912130.entry.js → p-cda4322a.entry.js} +1 -1
- package/dist/bn-template-engine/{p-6c7f0076.entry.js → p-e49f9170.entry.js} +1 -1
- package/dist/bn-template-engine/{p-6077155f.entry.js → p-f275b9fe.entry.js} +1 -1
- package/dist/cjs/bn-asset_21.cjs.entry.js +369 -122
- package/dist/cjs/bn-chart-bubble.cjs.entry.js +18 -8
- package/dist/cjs/bn-chart-bullet.cjs.entry.js +3 -3
- package/dist/cjs/bn-chart-scatter.cjs.entry.js +3 -3
- 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/bn-tree.cjs.entry.js +1 -1
- package/dist/cjs/{layoutObserver-DUYYkDMQ.js → layoutObserver-D8leSb4j.js} +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{scaling-BIJQ2NV1.js → scaling-B6_M_HWH.js} +82 -0
- package/dist/cjs/{withStyled-Cm9dWQhu.js → withStyled-DuwvaDMp.js} +3 -3
- package/dist/collection/components/bn-chart-bubble/bn-chart-bubble.js +15 -5
- package/dist/collection/components/bn-chart-structure/bn-chart-structure.js +81 -39
- package/dist/collection/components/bn-chart-structure/ibcs-chart-structure.js +34 -0
- package/dist/collection/components/bn-chart-time/bn-chart-time.js +80 -35
- package/dist/collection/components/bn-chart-time/ibcs-chart-time.js +34 -0
- package/dist/collection/components/bn-scaling-group/bn-scaling-group.js +76 -19
- package/dist/collection/components/bn-table/bn-table.js +111 -45
- package/dist/collection/components/bn-table/ibcs-table.js +37 -2
- package/dist/collection/components/bn-table/utils/elements/CellBarChart.js +2 -2
- package/dist/collection/utils/dataAnalyzer.js +17 -8
- package/dist/collection/utils/scaling.js +79 -0
- package/dist/collection/utils/validate.js +3 -3
- package/dist/components/DataFormatDigits.js +1 -1
- package/dist/components/bn-chart-bubble.js +1 -1
- package/dist/components/bn-chart-bullet.js +1 -1
- package/dist/components/bn-chart-scatter.js +1 -1
- package/dist/components/bn-chart-structure.js +1 -1
- package/dist/components/bn-chart-time.js +1 -1
- package/dist/components/bn-grid.js +1 -1
- package/dist/components/bn-scaling-group.js +1 -1
- package/dist/components/bn-table.js +1 -1
- package/dist/components/bn-text.js +1 -1
- package/dist/components/bn-tree.js +1 -1
- package/dist/components/ibcs-chart-structure2.js +1 -1
- package/dist/components/ibcs-chart-time2.js +1 -1
- package/dist/components/ibcs-table2.js +1 -1
- package/dist/components/scaling.js +1 -0
- package/dist/components/validate.js +1 -1
- package/dist/components/withDataset.js +1 -1
- package/dist/components/withStyled.js +1 -1
- package/dist/esm/bn-asset_21.entry.js +369 -122
- package/dist/esm/bn-chart-bubble.entry.js +18 -8
- package/dist/esm/bn-chart-bullet.entry.js +3 -3
- package/dist/esm/bn-chart-scatter.entry.js +3 -3
- 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/bn-tree.entry.js +1 -1
- package/dist/esm/{layoutObserver-BJBEyhNf.js → layoutObserver-DtZb2vdM.js} +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{scaling-BGnpSN1j.js → scaling-Bw8XyrFq.js} +80 -1
- package/dist/esm/{withStyled-2l5Tx3cf.js → withStyled-41rsCSM1.js} +3 -3
- package/dist/types/components/bn-chart-bubble/bn-chart-bubble.d.ts +5 -2
- package/dist/types/components/bn-chart-structure/bn-chart-structure.d.ts +33 -16
- package/dist/types/components/bn-chart-structure/ibcs-chart-structure.d.ts +8 -0
- package/dist/types/components/bn-chart-time/bn-chart-time.d.ts +35 -18
- package/dist/types/components/bn-chart-time/ibcs-chart-time.d.ts +8 -0
- package/dist/types/components/bn-scaling-group/bn-scaling-group.d.ts +28 -8
- package/dist/types/components/bn-table/bn-table.d.ts +37 -17
- package/dist/types/components/bn-table/ibcs-table.d.ts +8 -0
- package/dist/types/components.d.ts +85 -51
- package/dist/types/utils/dataAnalyzer.d.ts +5 -1
- package/dist/types/utils/scaling.d.ts +63 -0
- package/dist/types/utils/validate.d.ts +2 -2
- package/package.json +1 -1
- package/readme.md +2 -0
- package/dist/bn-template-engine/p-C9i1Xsib.js +0 -1
- package/dist/bn-template-engine/p-b5274369.entry.js +0 -1
|
@@ -2,10 +2,10 @@ import { r as registerInstance, h, H as Host, g as getElement, d as writeTask, f
|
|
|
2
2
|
import { w as withComponentStatus, a as withHasError, r as runIfExisits } from './withHasError-DW_vMDUp.js';
|
|
3
3
|
import { g as getStores, a as globalLabelKeys, e as getOrCreateStores, c as clearStoresCache, D as DateTime, b as buildFromExpr } from './context-protocol-d8MHrEo8.js';
|
|
4
4
|
import { w as withBodyObserver } from './withBodyObserver-IokS6fHD.js';
|
|
5
|
-
import { b as withComponentStyle, g as validateScenarioList, h as validateVariancesList,
|
|
6
|
-
import { i as isInheritedValue, w as withDataset, a as withTranslation,
|
|
5
|
+
import { b as withComponentStyle, g as validateScenarioList, h as validateVariancesList, j as isValidLevel, v as validateOrderList, d as isValidDirection, a as isValidInteger, e as isValidBoolean, k as isValidMeasureScale, l as validateStackConfig, w as withStyled, i as isBlankInput, f as isValidNumber, m as isValidDateFormat, n as isValidAxisLabelsMode, D as DateDistance, o as murmur2, p as DateStringFactory, q as validateBarColumnsList, r as isTableBarColumnWidth, s as isValidDataFormat, t as isValidTableType, u as validateThereOfJsonStr, x as validatePartOfJsonStr, y as isValidMeasureType, z as isTableCategoryWidth, A as validateColumnThereOfJsonStr, B as validateAttributesJsonStr, C as parseTableAttributeExpression, E as validateMeasureList, F as isValidDate, G as isValidDateLink, H as DateLink } from './withStyled-41rsCSM1.js';
|
|
6
|
+
import { i as isInheritedValue, r as resolveScalingValue, b as formatScalingValue, w as withDataset, a as withTranslation, c as withInheritedProps, g as getParentDimensions, p as parseScaling, d as parseScalingValue } from './scaling-Bw8XyrFq.js';
|
|
7
7
|
import { w as withScalingGroup } from './withScalingGroup-CC3UcvC5.js';
|
|
8
|
-
import { w as withRuleSet, o as observeParentResize } from './layoutObserver-
|
|
8
|
+
import { w as withRuleSet, o as observeParentResize } from './layoutObserver-DtZb2vdM.js';
|
|
9
9
|
import { A as AggregationLevel$1, f as StackBy, g as StackOrder, h as StackMode, c as AxisLabelsMode, i as ChartMode, D as DataFormat, I as I18nMode, e as TableCategoryWidth, M as MeasureType, B as BAR_COLUMN_WIDTH_EM, T as TableBarColumnWidth, C as CompareUtil, R as RELATIVE_STACK_UNITS, S as Scenarios } from './VarianceMeasure-CE3N8Bea.js';
|
|
10
10
|
import { O as OrderDirection$1, b as OrderColumn, A as AdapterUtils, c as OrderAdapter } from './Order-BQeJE_yi.js';
|
|
11
11
|
import { F as Formatter, S as Svg, I as IBCSRuleSet, C as CalculateSize, V as VarianceScenario, a as FontStyleAdapter, b as SVGStyleGroupAdapter, c as SVGStyleAdapter, P as PaddingAdapter, Q as QueryColumnNames } from './SVGStyle-BwBlY3Km.js';
|
|
@@ -140,8 +140,7 @@ const Chart$1 = class Chart {
|
|
|
140
140
|
}
|
|
141
141
|
validateUnitScaling(newValue) {
|
|
142
142
|
const errId = "ERR_unitScaling";
|
|
143
|
-
|
|
144
|
-
if (!isAuto && !isValidNumber(newValue) && !this.pixelPerUnitGroupMap.has(newValue)) {
|
|
143
|
+
if (resolveScalingValue(newValue, this.pixelPerUnitGroupMap).kind === "invalid") {
|
|
145
144
|
this.errors.addOrReplace({
|
|
146
145
|
id: errId,
|
|
147
146
|
type: "warning",
|
|
@@ -154,8 +153,7 @@ const Chart$1 = class Chart {
|
|
|
154
153
|
}
|
|
155
154
|
validatePercentageScaling(newValue) {
|
|
156
155
|
const errId = "ERR_percentageScaling";
|
|
157
|
-
|
|
158
|
-
if (!isAuto && !isValidNumber(newValue) && !this.pixelPerUnitGroupMap.has(newValue)) {
|
|
156
|
+
if (resolveScalingValue(newValue, this.pixelPerUnitGroupMap).kind === "invalid") {
|
|
159
157
|
this.errors.addOrReplace({
|
|
160
158
|
id: errId,
|
|
161
159
|
type: "warning",
|
|
@@ -403,6 +401,41 @@ const Chart$1 = class Chart {
|
|
|
403
401
|
this.stack = "";
|
|
404
402
|
this.pixelPerUnitGroupMap = new Map();
|
|
405
403
|
this._autoScaleGuard = false;
|
|
404
|
+
this.autoUnitWarningActive = false;
|
|
405
|
+
this.autoPctWarningActive = false;
|
|
406
|
+
/**
|
|
407
|
+
* Receives the auto-fitted values from the inner ibcs-chart-structure (px
|
|
408
|
+
* per unit / px per 1.0 fraction) and surfaces them in the AUTO_* warnings,
|
|
409
|
+
* converted back to the attribute's units-per-em form so users can copy
|
|
410
|
+
* them into a bn-scaling-group.
|
|
411
|
+
*/
|
|
412
|
+
this.handleAutoScalingReport = (report) => {
|
|
413
|
+
var _a, _b;
|
|
414
|
+
const changed = (next, last) => last === undefined || Math.abs(next - last) > Math.abs(next) * 1e-3;
|
|
415
|
+
const effFontPx = this.getEffectiveFontPx();
|
|
416
|
+
if (report.unit !== undefined && report.unit > 0 && this.autoUnitWarningActive) {
|
|
417
|
+
const unitsPerEm = effFontPx / report.unit;
|
|
418
|
+
if (changed(unitsPerEm, this.lastReportedUnitsPerEm)) {
|
|
419
|
+
this.lastReportedUnitsPerEm = unitsPerEm;
|
|
420
|
+
this.errors.addOrReplace({
|
|
421
|
+
id: "AUTO_unitScaling",
|
|
422
|
+
type: "warning",
|
|
423
|
+
message: `unit-scaling: ${Chart$1.describeScalingInput(String((_a = this.unitScaling) !== null && _a !== void 0 ? _a : "").trim())}, auto-fitted to 1 em ≈ ${formatScalingValue(unitsPerEm)} units.`,
|
|
424
|
+
});
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
if (report.percentage !== undefined && report.percentage > 0 && this.autoPctWarningActive) {
|
|
428
|
+
const ppPerEm = (100 * effFontPx) / report.percentage;
|
|
429
|
+
if (changed(ppPerEm, this.lastReportedPpPerEm)) {
|
|
430
|
+
this.lastReportedPpPerEm = ppPerEm;
|
|
431
|
+
this.errors.addOrReplace({
|
|
432
|
+
id: "AUTO_percentageScaling",
|
|
433
|
+
type: "warning",
|
|
434
|
+
message: `percentage-scaling: ${Chart$1.describeScalingInput(String((_b = this.percentageScaling) !== null && _b !== void 0 ? _b : "").trim())}, auto-fitted to 1 em ≈ ${formatScalingValue(ppPerEm)} percentage points.`,
|
|
435
|
+
});
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
};
|
|
406
439
|
withStyled(this);
|
|
407
440
|
withComponentStatus(this);
|
|
408
441
|
withDataset(this, (name, _data) => {
|
|
@@ -541,12 +574,9 @@ const Chart$1 = class Chart {
|
|
|
541
574
|
* Skipped for auto/unset unit-scaling since auto-fit handles width.
|
|
542
575
|
*/
|
|
543
576
|
checkWidthOverflow() {
|
|
544
|
-
var _a;
|
|
545
577
|
const errId = "WARN_overflow";
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
.toLowerCase();
|
|
549
|
-
if (us === "" || us === "auto") {
|
|
578
|
+
if (resolveScalingValue(this.unitScaling, this.pixelPerUnitGroupMap).kind !== "value") {
|
|
579
|
+
// Auto (explicit or fallback) fits the width by construction.
|
|
550
580
|
this.errors.remove(errId);
|
|
551
581
|
return;
|
|
552
582
|
}
|
|
@@ -555,7 +585,7 @@ const Chart$1 = class Chart {
|
|
|
555
585
|
this.errors.addOrReplace({
|
|
556
586
|
id: errId,
|
|
557
587
|
type: "error",
|
|
558
|
-
message: `Chart exceeds available width (${this.element.scrollWidth}px > ${Math.round(parent.width)}px).
|
|
588
|
+
message: `Chart exceeds available width (${this.element.scrollWidth}px > ${Math.round(parent.width)}px). Increase unit-scaling or set to "auto".`,
|
|
559
589
|
});
|
|
560
590
|
}
|
|
561
591
|
else {
|
|
@@ -617,48 +647,56 @@ const Chart$1 = class Chart {
|
|
|
617
647
|
const i18nMapGlobal = new Map(i18nMetaLabelsGlobal.map((key) => [key, this.t("global.".concat(key))]));
|
|
618
648
|
return new Map([...i18nMapGlobal.entries(), ...i18nMapLocal.entries()]);
|
|
619
649
|
}
|
|
650
|
+
/** "not set" for blank input, `invalid value "x"` otherwise — for AUTO_* messages. */
|
|
651
|
+
static describeScalingInput(raw) {
|
|
652
|
+
return raw === "" ? "not set" : `invalid value "${raw}"`;
|
|
653
|
+
}
|
|
620
654
|
preparePixelPerUnit() {
|
|
621
|
-
|
|
622
|
-
if (
|
|
655
|
+
const resolved = resolveScalingValue(this.unitScaling, this.pixelPerUnitGroupMap);
|
|
656
|
+
if (resolved.kind === "value") {
|
|
623
657
|
this.errors.remove("AUTO_unitScaling");
|
|
624
|
-
|
|
658
|
+
this.autoUnitWarningActive = false;
|
|
659
|
+
this.lastReportedUnitsPerEm = undefined;
|
|
660
|
+
// The attribute is data units per em; the inner chart expects px for one data unit.
|
|
661
|
+
return this.getEffectiveFontPx() / resolved.value;
|
|
625
662
|
}
|
|
626
663
|
// Explicit 'auto' → auto-calculate silently
|
|
627
|
-
if (
|
|
664
|
+
if (resolved.kind === "auto") {
|
|
628
665
|
this.errors.remove("AUTO_unitScaling");
|
|
666
|
+
this.autoUnitWarningActive = false;
|
|
667
|
+
this.lastReportedUnitsPerEm = undefined;
|
|
629
668
|
return 0;
|
|
630
669
|
}
|
|
631
|
-
const numeric = Number(this.unitScaling);
|
|
632
|
-
if (!isNaN(numeric) && numeric > 0) {
|
|
633
|
-
this.errors.remove("AUTO_unitScaling");
|
|
634
|
-
return numeric;
|
|
635
|
-
}
|
|
636
670
|
// Not set / invalid → auto-calculate with warning
|
|
671
|
+
this.autoUnitWarningActive = true;
|
|
637
672
|
this.errors.addOrReplace({
|
|
638
673
|
id: "AUTO_unitScaling",
|
|
639
674
|
type: "warning",
|
|
640
|
-
message: `unit-scaling:
|
|
675
|
+
message: `unit-scaling: ${Chart$1.describeScalingInput(resolved.raw)}, auto-calculated to fit available space.`,
|
|
641
676
|
});
|
|
642
677
|
return 0;
|
|
643
678
|
}
|
|
644
679
|
preparePixelPerPercentage() {
|
|
645
|
-
|
|
646
|
-
if (
|
|
647
|
-
return this.pixelPerUnitGroupMap.get(this.percentageScaling);
|
|
648
|
-
}
|
|
649
|
-
if (((_a = this.percentageScaling) === null || _a === void 0 ? void 0 : _a.toString().trim().toLowerCase()) === "auto") {
|
|
680
|
+
const resolved = resolveScalingValue(this.percentageScaling, this.pixelPerUnitGroupMap);
|
|
681
|
+
if (resolved.kind === "value") {
|
|
650
682
|
this.errors.remove("AUTO_percentageScaling");
|
|
651
|
-
|
|
683
|
+
this.autoPctWarningActive = false;
|
|
684
|
+
this.lastReportedPpPerEm = undefined;
|
|
685
|
+
// The attribute is percentage points per em; the inner chart expects
|
|
686
|
+
// px per 1.0 fraction (= per 100 percentage points).
|
|
687
|
+
return (100 * this.getEffectiveFontPx()) / resolved.value;
|
|
652
688
|
}
|
|
653
|
-
|
|
654
|
-
if (!isNaN(numeric) && numeric > 0) {
|
|
689
|
+
if (resolved.kind === "auto") {
|
|
655
690
|
this.errors.remove("AUTO_percentageScaling");
|
|
656
|
-
|
|
691
|
+
this.autoPctWarningActive = false;
|
|
692
|
+
this.lastReportedPpPerEm = undefined;
|
|
693
|
+
return 0;
|
|
657
694
|
}
|
|
695
|
+
this.autoPctWarningActive = true;
|
|
658
696
|
this.errors.addOrReplace({
|
|
659
697
|
id: "AUTO_percentageScaling",
|
|
660
698
|
type: "warning",
|
|
661
|
-
message: `percentage-scaling:
|
|
699
|
+
message: `percentage-scaling: ${Chart$1.describeScalingInput(resolved.raw)}, auto-calculated to fit available space.`,
|
|
662
700
|
});
|
|
663
701
|
return 0;
|
|
664
702
|
}
|
|
@@ -867,14 +905,13 @@ const Chart$1 = class Chart {
|
|
|
867
905
|
return this.measureUnit;
|
|
868
906
|
}
|
|
869
907
|
chartTemplate(localScenarioString, idx) {
|
|
870
|
-
const effectiveFactor = this.getEffectiveScaleFactor();
|
|
871
908
|
const ppu = this.preparePixelPerUnit();
|
|
872
909
|
const ppp = this.preparePixelPerPercentage();
|
|
873
910
|
const stackConfig = this.prepareStackConfig();
|
|
874
911
|
const scenarios = this.prepareScenarios();
|
|
875
912
|
// Dimension stacking uses only the first scenario
|
|
876
913
|
const effectiveScenarios = (stackConfig === null || stackConfig === void 0 ? void 0 : stackConfig.by) === StackBy.DIMENSIONS ? scenarios.slice(0, 1) : scenarios;
|
|
877
|
-
return (h("ibcs-chart-structure", { tableName: this.datasetName, dataVersion: this.dataVersion, chartTitle: this.prepareChartTitle(idx), scenarios: effectiveScenarios, variances: [localScenarioString], hideCategories: this.prepareHideCategories(idx), pixelPerUnit: ppu
|
|
914
|
+
return (h("ibcs-chart-structure", { tableName: this.datasetName, dataVersion: this.dataVersion, chartTitle: this.prepareChartTitle(idx), scenarios: effectiveScenarios, variances: [localScenarioString], hideCategories: this.prepareHideCategories(idx), pixelPerUnit: ppu, pixelPerPercentage: ppp, reportAutoScaling: this.handleAutoScalingReport, limit: this.prepareLimit(), styles: this.prepareStyle(), i18n: this.prepareI18n(), order: this.prepareOrder(), level: this.prepareLevel(), filter: this.prepareFilter(), "measure-scale": this.prepareMeasureScale(), "measure-unit": this.prepareMeasureUnit(), showMeasureScale: this.prepareShowMeasureScale(idx), stackConfig: stackConfig, parentDimensions: this.prepareDimension(), ruleSetConfig: this.ruleSetConfig() }));
|
|
878
915
|
}
|
|
879
916
|
getEffectiveScaleFactor() {
|
|
880
917
|
const { mode, factor } = parseScaling(this.scale);
|
|
@@ -884,6 +921,11 @@ const Chart$1 = class Chart {
|
|
|
884
921
|
return this.appliedScaleFactor;
|
|
885
922
|
return 1;
|
|
886
923
|
}
|
|
924
|
+
/** Effective font size in px: base font from the style store × effective scale factor. */
|
|
925
|
+
getEffectiveFontPx() {
|
|
926
|
+
const baseFontSize = this.componentStyle(($) => { var _a; return ((_a = $["global"]) === null || _a === void 0 ? void 0 : _a["fontSizePx"]) || 13.3333; });
|
|
927
|
+
return baseFontSize * this.getEffectiveScaleFactor();
|
|
928
|
+
}
|
|
887
929
|
getFontStyles() {
|
|
888
930
|
const effectiveFactor = this.getEffectiveScaleFactor();
|
|
889
931
|
return this.componentStyle(($) => {
|
|
@@ -904,7 +946,7 @@ const Chart$1 = class Chart {
|
|
|
904
946
|
scenariosArray = [...scenariosArray, ...variancesArray];
|
|
905
947
|
}
|
|
906
948
|
const fontStyles = this.getFontStyles();
|
|
907
|
-
return (h(Host, { key: '
|
|
949
|
+
return (h(Host, { key: '8050c526688b5094b630f9646fb0dd141a63beb2', style: fontStyles }, h("div", { key: '771c98ce06779536ac1b701a7cad40becc47738c', class: "container" }, scenariosArray.map(this.chartTemplate))));
|
|
908
950
|
}
|
|
909
951
|
get element() { return getElement(this); }
|
|
910
952
|
static get watchers() { return {
|
|
@@ -1027,8 +1069,7 @@ const Chart = class {
|
|
|
1027
1069
|
}
|
|
1028
1070
|
validateUnitScaling(newValue) {
|
|
1029
1071
|
const errId = "ERR_unitScaling";
|
|
1030
|
-
|
|
1031
|
-
if (!isAuto && !isValidNumber(newValue) && !this.pixelPerUnitGroupMap.has(newValue)) {
|
|
1072
|
+
if (resolveScalingValue(newValue, this.pixelPerUnitGroupMap).kind === "invalid") {
|
|
1032
1073
|
this.errors.addOrReplace({
|
|
1033
1074
|
id: errId,
|
|
1034
1075
|
type: "warning",
|
|
@@ -1041,8 +1082,7 @@ const Chart = class {
|
|
|
1041
1082
|
}
|
|
1042
1083
|
validatePercentageScaling(newValue) {
|
|
1043
1084
|
const errId = "ERR_percentageScaling";
|
|
1044
|
-
|
|
1045
|
-
if (!isAuto && !isValidNumber(newValue) && !this.pixelPerUnitGroupMap.has(newValue)) {
|
|
1085
|
+
if (resolveScalingValue(newValue, this.pixelPerUnitGroupMap).kind === "invalid") {
|
|
1046
1086
|
this.errors.addOrReplace({
|
|
1047
1087
|
id: errId,
|
|
1048
1088
|
type: "warning",
|
|
@@ -1367,7 +1407,7 @@ const Chart = class {
|
|
|
1367
1407
|
* original value.
|
|
1368
1408
|
* <br /><br />
|
|
1369
1409
|
* values: <br />
|
|
1370
|
-
* ```_ // k // M // G // T // P // E // Z // Y // m // μ // n // p //
|
|
1410
|
+
* ```_ // k // M // G // T // P // E // Z // Y // m // my (μ) // n // p // f // a // z // y // GREATEST // LEAST```
|
|
1371
1411
|
* <br /><br />
|
|
1372
1412
|
* SiPrefix overview:
|
|
1373
1413
|
* ``` "Y": 1E+24,```<br />
|
|
@@ -1380,7 +1420,7 @@ const Chart = class {
|
|
|
1380
1420
|
* ``` "k": 1000,```<br />
|
|
1381
1421
|
* <br />
|
|
1382
1422
|
* ``` "m": 0.001,```<br />
|
|
1383
|
-
* ``` "μ
|
|
1423
|
+
* ``` "my" (μ): 0.000001,```<br />
|
|
1384
1424
|
* ``` "n": 0.000000001,```<br />
|
|
1385
1425
|
* ``` "p": 0.000000000001,```<br />
|
|
1386
1426
|
* ``` "f": 0.000000000000001,```<br />
|
|
@@ -1415,6 +1455,41 @@ const Chart = class {
|
|
|
1415
1455
|
this._lastObservedWidth = 0;
|
|
1416
1456
|
this._settleTimer = null;
|
|
1417
1457
|
this._lastAppliedHeight = 0;
|
|
1458
|
+
this.autoUnitWarningActive = false;
|
|
1459
|
+
this.autoPctWarningActive = false;
|
|
1460
|
+
/**
|
|
1461
|
+
* Receives the auto-fitted values from the inner ibcs-chart-time (px per
|
|
1462
|
+
* unit / px per 1.0 fraction) and surfaces them in the AUTO_* warnings,
|
|
1463
|
+
* converted back to the attribute's units-per-em form so users can copy
|
|
1464
|
+
* them into a bn-scaling-group.
|
|
1465
|
+
*/
|
|
1466
|
+
this.handleAutoScalingReport = (report) => {
|
|
1467
|
+
var _a, _b;
|
|
1468
|
+
const changed = (next, last) => last === undefined || Math.abs(next - last) > Math.abs(next) * 1e-3;
|
|
1469
|
+
const effFontPx = this.getEffectiveFontPx();
|
|
1470
|
+
if (report.unit !== undefined && report.unit > 0 && this.autoUnitWarningActive) {
|
|
1471
|
+
const unitsPerEm = effFontPx / report.unit;
|
|
1472
|
+
if (changed(unitsPerEm, this.lastReportedUnitsPerEm)) {
|
|
1473
|
+
this.lastReportedUnitsPerEm = unitsPerEm;
|
|
1474
|
+
this.errors.addOrReplace({
|
|
1475
|
+
id: "AUTO_unitScaling",
|
|
1476
|
+
type: "warning",
|
|
1477
|
+
message: `unit-scaling: ${Chart.describeScalingInput(String((_a = this.unitScaling) !== null && _a !== void 0 ? _a : "").trim())}, auto-fitted to 1 em ≈ ${formatScalingValue(unitsPerEm)} units.`,
|
|
1478
|
+
});
|
|
1479
|
+
}
|
|
1480
|
+
}
|
|
1481
|
+
if (report.percentage !== undefined && report.percentage > 0 && this.autoPctWarningActive) {
|
|
1482
|
+
const ppPerEm = (100 * effFontPx) / report.percentage;
|
|
1483
|
+
if (changed(ppPerEm, this.lastReportedPpPerEm)) {
|
|
1484
|
+
this.lastReportedPpPerEm = ppPerEm;
|
|
1485
|
+
this.errors.addOrReplace({
|
|
1486
|
+
id: "AUTO_percentageScaling",
|
|
1487
|
+
type: "warning",
|
|
1488
|
+
message: `percentage-scaling: ${Chart.describeScalingInput(String((_b = this.percentageScaling) !== null && _b !== void 0 ? _b : "").trim())}, auto-fitted to 1 em ≈ ${formatScalingValue(ppPerEm)} percentage points.`,
|
|
1489
|
+
});
|
|
1490
|
+
}
|
|
1491
|
+
}
|
|
1492
|
+
};
|
|
1418
1493
|
withStyled(this);
|
|
1419
1494
|
withComponentStatus(this);
|
|
1420
1495
|
withDataset(this, (name, _data) => {
|
|
@@ -1648,48 +1723,56 @@ const Chart = class {
|
|
|
1648
1723
|
const i18nMapGlobal = new Map(i18nMetaLabelsGlobal.map((key) => [key, this.t("global.".concat(key))]));
|
|
1649
1724
|
return new Map([...i18nMapGlobal.entries(), ...i18nMapLocal.entries()]);
|
|
1650
1725
|
}
|
|
1726
|
+
/** "not set" for blank input, `invalid value "x"` otherwise — for AUTO_* messages. */
|
|
1727
|
+
static describeScalingInput(raw) {
|
|
1728
|
+
return raw === "" ? "not set" : `invalid value "${raw}"`;
|
|
1729
|
+
}
|
|
1651
1730
|
preparePixelPerUnit() {
|
|
1652
|
-
|
|
1653
|
-
if (
|
|
1731
|
+
const resolved = resolveScalingValue(this.unitScaling, this.pixelPerUnitGroupMap);
|
|
1732
|
+
if (resolved.kind === "value") {
|
|
1654
1733
|
this.errors.remove("AUTO_unitScaling");
|
|
1655
|
-
|
|
1734
|
+
this.autoUnitWarningActive = false;
|
|
1735
|
+
this.lastReportedUnitsPerEm = undefined;
|
|
1736
|
+
// The attribute is data units per em; the inner chart expects px for one data unit.
|
|
1737
|
+
return this.getEffectiveFontPx() / resolved.value;
|
|
1656
1738
|
}
|
|
1657
1739
|
// Explicit 'auto' → auto-calculate silently
|
|
1658
|
-
if (
|
|
1740
|
+
if (resolved.kind === "auto") {
|
|
1659
1741
|
this.errors.remove("AUTO_unitScaling");
|
|
1742
|
+
this.autoUnitWarningActive = false;
|
|
1743
|
+
this.lastReportedUnitsPerEm = undefined;
|
|
1660
1744
|
return 0;
|
|
1661
1745
|
}
|
|
1662
|
-
const numeric = Number(this.unitScaling);
|
|
1663
|
-
if (!isNaN(numeric) && numeric > 0) {
|
|
1664
|
-
this.errors.remove("AUTO_unitScaling");
|
|
1665
|
-
return numeric;
|
|
1666
|
-
}
|
|
1667
1746
|
// Not set / invalid → auto-calculate with warning
|
|
1747
|
+
this.autoUnitWarningActive = true;
|
|
1668
1748
|
this.errors.addOrReplace({
|
|
1669
1749
|
id: "AUTO_unitScaling",
|
|
1670
1750
|
type: "warning",
|
|
1671
|
-
message: `unit-scaling:
|
|
1751
|
+
message: `unit-scaling: ${Chart.describeScalingInput(resolved.raw)}, auto-calculated to fit available space.`,
|
|
1672
1752
|
});
|
|
1673
1753
|
return 0;
|
|
1674
1754
|
}
|
|
1675
1755
|
preparePixelPerPercentage() {
|
|
1676
|
-
|
|
1677
|
-
if (
|
|
1678
|
-
return this.pixelPerUnitGroupMap.get(this.percentageScaling);
|
|
1679
|
-
}
|
|
1680
|
-
if (((_a = this.percentageScaling) === null || _a === void 0 ? void 0 : _a.toString().trim().toLowerCase()) === "auto") {
|
|
1756
|
+
const resolved = resolveScalingValue(this.percentageScaling, this.pixelPerUnitGroupMap);
|
|
1757
|
+
if (resolved.kind === "value") {
|
|
1681
1758
|
this.errors.remove("AUTO_percentageScaling");
|
|
1682
|
-
|
|
1759
|
+
this.autoPctWarningActive = false;
|
|
1760
|
+
this.lastReportedPpPerEm = undefined;
|
|
1761
|
+
// The attribute is percentage points per em; the inner chart expects
|
|
1762
|
+
// px per 1.0 fraction (= per 100 percentage points).
|
|
1763
|
+
return (100 * this.getEffectiveFontPx()) / resolved.value;
|
|
1683
1764
|
}
|
|
1684
|
-
|
|
1685
|
-
if (!isNaN(numeric) && numeric > 0) {
|
|
1765
|
+
if (resolved.kind === "auto") {
|
|
1686
1766
|
this.errors.remove("AUTO_percentageScaling");
|
|
1687
|
-
|
|
1767
|
+
this.autoPctWarningActive = false;
|
|
1768
|
+
this.lastReportedPpPerEm = undefined;
|
|
1769
|
+
return 0;
|
|
1688
1770
|
}
|
|
1771
|
+
this.autoPctWarningActive = true;
|
|
1689
1772
|
this.errors.addOrReplace({
|
|
1690
1773
|
id: "AUTO_percentageScaling",
|
|
1691
1774
|
type: "warning",
|
|
1692
|
-
message: `percentage-scaling:
|
|
1775
|
+
message: `percentage-scaling: ${Chart.describeScalingInput(resolved.raw)}, auto-calculated to fit available space.`,
|
|
1693
1776
|
});
|
|
1694
1777
|
return 0;
|
|
1695
1778
|
}
|
|
@@ -1959,13 +2042,12 @@ const Chart = class {
|
|
|
1959
2042
|
const preparedI18n = this.prepareI18n();
|
|
1960
2043
|
const preparedStyle = this.prepareStyle();
|
|
1961
2044
|
const fullParentWidth = getParentDimensions(this.element).width;
|
|
1962
|
-
const effectiveFactor = this.getEffectiveScaleFactor();
|
|
1963
2045
|
const ppu = this.preparePixelPerUnit();
|
|
1964
2046
|
const ppp = this.preparePixelPerPercentage();
|
|
1965
2047
|
const stackConfig = this.prepareStackConfig();
|
|
1966
2048
|
const scenarios = this.prepareScenarios();
|
|
1967
2049
|
const effectiveScenarios = (stackConfig === null || stackConfig === void 0 ? void 0 : stackConfig.by) === StackBy.DIMENSIONS ? scenarios.slice(0, 1) : scenarios;
|
|
1968
|
-
return (h("ibcs-chart-time", { tableName: this.datasetName, dataVersion: this.dataVersion, chartTitle: this.prepareChartTitle(idx), scenarios: effectiveScenarios, variances: [localScenarioString], hideAxisLabels: this.prepareHideAxisLabels(idx), pixelPerUnit: ppu
|
|
2050
|
+
return (h("ibcs-chart-time", { tableName: this.datasetName, dataVersion: this.dataVersion, chartTitle: this.prepareChartTitle(idx), scenarios: effectiveScenarios, variances: [localScenarioString], hideAxisLabels: this.prepareHideAxisLabels(idx), pixelPerUnit: ppu, pixelPerPercentage: ppp, reportAutoScaling: this.handleAutoScalingReport, limit: this.prepareLimit(), leftSideOffsetForHorizontalSync: this.prepareLeftSideOffset(preparedI18n, preparedStyle), styles: preparedStyle, i18n: preparedI18n, order: this.prepareOrder(), level: this.prepareLevel(), dateInterval: this.prepareDateInterval(), intervalSpanLimit: this.prepareIntervalSpanLimit(), axisLabelsMode: this.prepareAxisLabelsMode(), filter: this.prepareFilter(), "measure-scale": this.prepareMeasureScale(), "measure-unit": this.prepareMeasureUnit(), showOverlayAvg: this.prepareAvg(), showOverlayMedian: this.prepareMedian(), showMeasureScale: this.prepareShowMeasureScale(idx), chartMode: this.prepareChartMode(), maxBars: this.prepareMaxBars(), stackConfig: stackConfig, lineFullWidth: this.prepareLineFullWidth(), containerWidth: fullParentWidth, parentDimensions: this.prepareDimension(), ruleSetConfig: this.ruleSetConfig() }));
|
|
1969
2051
|
}
|
|
1970
2052
|
getEffectiveScaleFactor() {
|
|
1971
2053
|
const { mode, factor } = parseScaling(this.scale);
|
|
@@ -1975,6 +2057,11 @@ const Chart = class {
|
|
|
1975
2057
|
return this.appliedScaleFactor;
|
|
1976
2058
|
return 1;
|
|
1977
2059
|
}
|
|
2060
|
+
/** Effective font size in px: base font from the style store × effective scale factor. */
|
|
2061
|
+
getEffectiveFontPx() {
|
|
2062
|
+
const baseFontSize = this.componentStyle(($) => { var _a; return ((_a = $["global"]) === null || _a === void 0 ? void 0 : _a["fontSizePx"]) || 13.3333; });
|
|
2063
|
+
return baseFontSize * this.getEffectiveScaleFactor();
|
|
2064
|
+
}
|
|
1978
2065
|
getFontStyles() {
|
|
1979
2066
|
const effectiveFactor = this.getEffectiveScaleFactor();
|
|
1980
2067
|
return this.componentStyle(($) => {
|
|
@@ -1995,7 +2082,7 @@ const Chart = class {
|
|
|
1995
2082
|
scenariosArray = [...scenariosArray, ...variancesArray];
|
|
1996
2083
|
}
|
|
1997
2084
|
const fontStyles = this.getFontStyles();
|
|
1998
|
-
return (h(Host, { key: '
|
|
2085
|
+
return (h(Host, { key: 'a8070cc2333500d65e991851af93f498bd007e74', style: fontStyles }, h("div", { key: 'f54fa6d3db57c652fc6f900be59243925a718aa2', class: "container" }, scenariosArray.map(this.chartTemplate))));
|
|
1999
2086
|
}
|
|
2000
2087
|
get element() { return getElement(this); }
|
|
2001
2088
|
static get watchers() { return {
|
|
@@ -3935,28 +4022,44 @@ const ScalingGroup = class {
|
|
|
3935
4022
|
this.stores = getStores(this.element);
|
|
3936
4023
|
this.pushToStore();
|
|
3937
4024
|
}
|
|
4025
|
+
disconnectedCallback() {
|
|
4026
|
+
this.removeEntryIfOurs(this.storedName);
|
|
4027
|
+
}
|
|
3938
4028
|
onNameChange(newName, oldName) {
|
|
3939
|
-
|
|
3940
|
-
|
|
3941
|
-
|
|
3942
|
-
const current = this.stores.scalingGroups.state[oldName];
|
|
3943
|
-
if (current === this.value) {
|
|
3944
|
-
// @ts-ignore – dynamic key
|
|
3945
|
-
this.stores.scalingGroups.set(oldName, undefined);
|
|
3946
|
-
}
|
|
4029
|
+
const trimmedOld = oldName === null || oldName === void 0 ? void 0 : oldName.toString().trim();
|
|
4030
|
+
if (trimmedOld && trimmedOld !== (newName === null || newName === void 0 ? void 0 : newName.toString().trim())) {
|
|
4031
|
+
this.removeEntryIfOurs(trimmedOld);
|
|
3947
4032
|
}
|
|
3948
4033
|
this.pushToStore();
|
|
3949
4034
|
}
|
|
3950
4035
|
onValueChange() {
|
|
3951
4036
|
this.pushToStore();
|
|
3952
4037
|
}
|
|
4038
|
+
/**
|
|
4039
|
+
* Removes the store entry for `name` — but only if it still holds the value
|
|
4040
|
+
* this element wrote (another bn-scaling-group with the same name may have
|
|
4041
|
+
* overwritten it).
|
|
4042
|
+
*/
|
|
4043
|
+
removeEntryIfOurs(name) {
|
|
4044
|
+
if (!name || !this.stores)
|
|
4045
|
+
return;
|
|
4046
|
+
if (this.storedName === name && this.stores.scalingGroups.state[name] === this.storedValue) {
|
|
4047
|
+
// @ts-ignore – dynamic key
|
|
4048
|
+
this.stores.scalingGroups.set(name, undefined);
|
|
4049
|
+
}
|
|
4050
|
+
if (this.storedName === name) {
|
|
4051
|
+
this.storedName = undefined;
|
|
4052
|
+
this.storedValue = undefined;
|
|
4053
|
+
}
|
|
4054
|
+
}
|
|
3953
4055
|
pushToStore() {
|
|
3954
4056
|
var _a;
|
|
3955
4057
|
if (!this.stores)
|
|
3956
4058
|
return;
|
|
3957
4059
|
const trimmedName = (_a = this.name) === null || _a === void 0 ? void 0 : _a.toString().trim();
|
|
4060
|
+
const nameParse = parseScalingValue(trimmedName);
|
|
3958
4061
|
// Validate: "auto" is reserved
|
|
3959
|
-
if (
|
|
4062
|
+
if (nameParse.kind === "auto") {
|
|
3960
4063
|
this.errors.addOrReplace({
|
|
3961
4064
|
id: "ERR_reserved_name",
|
|
3962
4065
|
type: "warning",
|
|
@@ -3974,11 +4077,49 @@ const ScalingGroup = class {
|
|
|
3974
4077
|
return;
|
|
3975
4078
|
}
|
|
3976
4079
|
this.errors.remove("ERR_empty_name");
|
|
4080
|
+
// Validate: a name that parses as a number/SI value would be ambiguous
|
|
4081
|
+
// with a literal scaling value at the referencing component.
|
|
4082
|
+
if (nameParse.kind === "number") {
|
|
4083
|
+
this.errors.addOrReplace({
|
|
4084
|
+
id: "ERR_numeric_name",
|
|
4085
|
+
type: "warning",
|
|
4086
|
+
message: `bn-scaling-group: name "${trimmedName}" is not allowed — it would be ambiguous with a numeric scaling value.`,
|
|
4087
|
+
});
|
|
4088
|
+
return;
|
|
4089
|
+
}
|
|
4090
|
+
this.errors.remove("ERR_numeric_name");
|
|
4091
|
+
const parsedValue = parseScalingValue(this.value);
|
|
4092
|
+
if (parsedValue.kind !== "number") {
|
|
4093
|
+
this.errors.addOrReplace({
|
|
4094
|
+
id: "ERR_invalid_value",
|
|
4095
|
+
type: "warning",
|
|
4096
|
+
message: `bn-scaling-group: invalid value "${this.value}" — must be a positive number, optionally with k/M/G/T suffix.`,
|
|
4097
|
+
});
|
|
4098
|
+
return;
|
|
4099
|
+
}
|
|
4100
|
+
this.errors.remove("ERR_invalid_value");
|
|
4101
|
+
const existing = this.stores.scalingGroups.state[trimmedName];
|
|
4102
|
+
const wroteExisting = this.storedName === trimmedName && this.storedValue === existing;
|
|
4103
|
+
if (existing !== undefined && existing !== parsedValue.value && !wroteExisting) {
|
|
4104
|
+
this.errors.addOrReplace({
|
|
4105
|
+
id: "WARN_duplicate_group",
|
|
4106
|
+
type: "warning",
|
|
4107
|
+
message: `bn-scaling-group: "${trimmedName}" is already registered with a different value (${formatScalingValue(existing)}); overwriting.`,
|
|
4108
|
+
});
|
|
4109
|
+
}
|
|
4110
|
+
else {
|
|
4111
|
+
this.errors.remove("WARN_duplicate_group");
|
|
4112
|
+
}
|
|
4113
|
+
if (this.storedName && this.storedName !== trimmedName) {
|
|
4114
|
+
this.removeEntryIfOurs(this.storedName);
|
|
4115
|
+
}
|
|
3977
4116
|
// @ts-ignore – dynamic key
|
|
3978
|
-
this.stores.scalingGroups.set(trimmedName,
|
|
4117
|
+
this.stores.scalingGroups.set(trimmedName, parsedValue.value);
|
|
4118
|
+
this.storedName = trimmedName;
|
|
4119
|
+
this.storedValue = parsedValue.value;
|
|
3979
4120
|
}
|
|
3980
4121
|
render() {
|
|
3981
|
-
return h(Host, { key: '
|
|
4122
|
+
return h(Host, { key: '7b125b03953f91d15c6c9df7ca178c9f33b054cc' });
|
|
3982
4123
|
}
|
|
3983
4124
|
get element() { return getElement(this); }
|
|
3984
4125
|
static get watchers() { return {
|
|
@@ -4247,31 +4388,40 @@ const Table$1 = class Table {
|
|
|
4247
4388
|
*/
|
|
4248
4389
|
this.barColumnWidth = "w10";
|
|
4249
4390
|
/**
|
|
4250
|
-
*
|
|
4251
|
-
*
|
|
4391
|
+
* Data units displayed per 1 em of bar length for absolute variance bar
|
|
4392
|
+
* charts (ΔPY) — map-scale semantics: a larger value means smaller bars.
|
|
4252
4393
|
* Bars exceeding barColumnWidth are shown with an arrow indicator.
|
|
4253
|
-
* <br /><br />
|
|
4254
|
-
* Accepts a number, `"auto"`, or a `<bn-scaling-group>` name for synchronized scaling.
|
|
4255
|
-
* <br /><br />
|
|
4256
|
-
* Default: 0.01
|
|
4257
4394
|
*
|
|
4258
|
-
*
|
|
4395
|
+
* | Value | Behavior |
|
|
4396
|
+
* |------------------|----------------------------------------------------------------|
|
|
4397
|
+
* | `"auto"` | Auto-fit the largest bar to the bar column width |
|
|
4398
|
+
* | `"250000"`, `"1M"` | Units per em; optional SI suffix `k`/`K`/`M`/`G`/`T` |
|
|
4399
|
+
* | group name | References a `<bn-scaling-group>` for synchronized scaling |
|
|
4400
|
+
* | invalid / unknown | Auto-fit + `AUTO_unitScaling` warning |
|
|
4401
|
+
*
|
|
4402
|
+
* Default: `"100"` (1 em of bar represents 100 units)
|
|
4403
|
+
*
|
|
4404
|
+
* @example unit-scaling="1M"
|
|
4259
4405
|
* @example unit-scaling="revenue-scale"
|
|
4260
4406
|
*/
|
|
4261
|
-
this.unitScaling =
|
|
4407
|
+
this.unitScaling = "100";
|
|
4262
4408
|
/**
|
|
4263
|
-
*
|
|
4264
|
-
*
|
|
4265
|
-
*
|
|
4266
|
-
*
|
|
4267
|
-
*
|
|
4268
|
-
*
|
|
4269
|
-
*
|
|
4409
|
+
* Percentage points displayed per 1 em of pin length for relative variance
|
|
4410
|
+
* pin charts (ΔPY%) — a larger value means shorter pins.
|
|
4411
|
+
*
|
|
4412
|
+
* | Value | Behavior |
|
|
4413
|
+
* |------------------|----------------------------------------------------------------|
|
|
4414
|
+
* | `"auto"` | Auto-fit the largest pin to the pin area |
|
|
4415
|
+
* | `"10"`, `"2.5"` | Percentage points per em; optional SI suffix `k`/`K`/`M`/`G`/`T` |
|
|
4416
|
+
* | group name | References a `<bn-scaling-group>` for synchronized scaling |
|
|
4417
|
+
* | invalid / unknown | Auto-fit + `AUTO_percentageScaling` warning |
|
|
4270
4418
|
*
|
|
4271
|
-
*
|
|
4419
|
+
* Default: `"2"` (a +2 % variance pin is 1 em long)
|
|
4420
|
+
*
|
|
4421
|
+
* @example percentage-scaling="10"
|
|
4272
4422
|
* @example percentage-scaling="pct-scale"
|
|
4273
4423
|
*/
|
|
4274
|
-
this.percentageScaling =
|
|
4424
|
+
this.percentageScaling = "2";
|
|
4275
4425
|
// Global scaling groups map - can be populated externally for shared scaling across components
|
|
4276
4426
|
this.pixelPerUnitGroupMap = new Map();
|
|
4277
4427
|
/**
|
|
@@ -4385,7 +4535,7 @@ const Table$1 = class Table {
|
|
|
4385
4535
|
* original value.
|
|
4386
4536
|
* <br /><br />
|
|
4387
4537
|
* values: <br />
|
|
4388
|
-
* ```_ // k // M // G // T // P // E // Z // Y // m // μ // n // p //
|
|
4538
|
+
* ```_ // k // M // G // T // P // E // Z // Y // m // my (μ) // n // p // f // a // z // y // GREATEST // LEAST```
|
|
4389
4539
|
* <br /><br />
|
|
4390
4540
|
* SiPrefix overview:
|
|
4391
4541
|
* ``` "Y": 1E+24,```<br />
|
|
@@ -4398,7 +4548,7 @@ const Table$1 = class Table {
|
|
|
4398
4548
|
* ``` "k": 1000,```<br />
|
|
4399
4549
|
* <br />
|
|
4400
4550
|
* ``` "m": 0.001,```<br />
|
|
4401
|
-
* ``` "μ
|
|
4551
|
+
* ``` "my" (μ): 0.000001,```<br />
|
|
4402
4552
|
* ``` "n": 0.000000001,```<br />
|
|
4403
4553
|
* ``` "p": 0.000000000001,```<br />
|
|
4404
4554
|
* ``` "f": 0.000000000000001,```<br />
|
|
@@ -4470,6 +4620,39 @@ const Table$1 = class Table {
|
|
|
4470
4620
|
*/
|
|
4471
4621
|
this.tableAttributes = "";
|
|
4472
4622
|
this._autoScaleGuard = false;
|
|
4623
|
+
this.autoUnitWarningActive = false;
|
|
4624
|
+
this.autoPctWarningActive = false;
|
|
4625
|
+
/**
|
|
4626
|
+
* Receives the auto-fitted scaling values from the inner ibcs-table
|
|
4627
|
+
* (em per unit / em per percentage point) and surfaces them in the AUTO_*
|
|
4628
|
+
* warnings, converted back to the attribute's units-per-em form so users
|
|
4629
|
+
* can copy them into a bn-scaling-group.
|
|
4630
|
+
*/
|
|
4631
|
+
this.handleAutoScalingReport = (report) => {
|
|
4632
|
+
const changed = (next, last) => last === undefined || Math.abs(next - last) > Math.abs(next) * 1e-3;
|
|
4633
|
+
if (report.unit !== undefined && report.unit > 0 && this.autoUnitWarningActive) {
|
|
4634
|
+
const unitsPerEm = 1 / report.unit;
|
|
4635
|
+
if (changed(unitsPerEm, this.lastReportedUnitsPerEm)) {
|
|
4636
|
+
this.lastReportedUnitsPerEm = unitsPerEm;
|
|
4637
|
+
this.errors.addOrReplace({
|
|
4638
|
+
id: "AUTO_unitScaling",
|
|
4639
|
+
type: "warning",
|
|
4640
|
+
message: `unit-scaling: invalid value "${this.unitScaling}" — auto-fitted to 1 em ≈ ${formatScalingValue(unitsPerEm)} units.`,
|
|
4641
|
+
});
|
|
4642
|
+
}
|
|
4643
|
+
}
|
|
4644
|
+
if (report.percentage !== undefined && report.percentage > 0 && this.autoPctWarningActive) {
|
|
4645
|
+
const ppPerEm = 1 / report.percentage;
|
|
4646
|
+
if (changed(ppPerEm, this.lastReportedPpPerEm)) {
|
|
4647
|
+
this.lastReportedPpPerEm = ppPerEm;
|
|
4648
|
+
this.errors.addOrReplace({
|
|
4649
|
+
id: "AUTO_percentageScaling",
|
|
4650
|
+
type: "warning",
|
|
4651
|
+
message: `percentage-scaling: invalid value "${this.percentageScaling}" — auto-fitted to 1 em ≈ ${formatScalingValue(ppPerEm)} percentage points.`,
|
|
4652
|
+
});
|
|
4653
|
+
}
|
|
4654
|
+
}
|
|
4655
|
+
};
|
|
4473
4656
|
withStyled(this);
|
|
4474
4657
|
withComponentStatus(this);
|
|
4475
4658
|
this.errors = withHasError(this);
|
|
@@ -4564,8 +4747,7 @@ const Table$1 = class Table {
|
|
|
4564
4747
|
}
|
|
4565
4748
|
validateUnitScaling(newValue) {
|
|
4566
4749
|
const errId = "ERR_unitScaling";
|
|
4567
|
-
|
|
4568
|
-
if (!isAuto && !isValidNumber(newValue) && !this.pixelPerUnitGroupMap.has(newValue)) {
|
|
4750
|
+
if (resolveScalingValue(newValue, this.pixelPerUnitGroupMap).kind === "invalid") {
|
|
4569
4751
|
this.errors.addOrReplace({
|
|
4570
4752
|
id: errId,
|
|
4571
4753
|
type: "warning",
|
|
@@ -4578,8 +4760,7 @@ const Table$1 = class Table {
|
|
|
4578
4760
|
}
|
|
4579
4761
|
validatePercentageScaling(newValue) {
|
|
4580
4762
|
const errId = "ERR_percentageScaling";
|
|
4581
|
-
|
|
4582
|
-
if (!isAuto && !isValidNumber(newValue) && !this.pixelPerUnitGroupMap.has(newValue)) {
|
|
4763
|
+
if (resolveScalingValue(newValue, this.pixelPerUnitGroupMap).kind === "invalid") {
|
|
4583
4764
|
this.errors.addOrReplace({
|
|
4584
4765
|
id: errId,
|
|
4585
4766
|
type: "warning",
|
|
@@ -5214,24 +5395,50 @@ const Table$1 = class Table {
|
|
|
5214
5395
|
return this.barColumns.split(",").map((col) => col.trim());
|
|
5215
5396
|
}
|
|
5216
5397
|
prepareUnitScaling() {
|
|
5217
|
-
|
|
5218
|
-
if (
|
|
5219
|
-
|
|
5398
|
+
const resolved = resolveScalingValue(this.unitScaling, this.pixelPerUnitGroupMap);
|
|
5399
|
+
if (resolved.kind === "value") {
|
|
5400
|
+
this.errors.remove("AUTO_unitScaling");
|
|
5401
|
+
this.autoUnitWarningActive = false;
|
|
5402
|
+
this.lastReportedUnitsPerEm = undefined;
|
|
5403
|
+
// Inner ibcs-table expects em per unit; the attribute is units per em.
|
|
5404
|
+
return 1 / resolved.value;
|
|
5220
5405
|
}
|
|
5221
|
-
if (
|
|
5406
|
+
if (resolved.kind === "auto") {
|
|
5407
|
+
this.errors.remove("AUTO_unitScaling");
|
|
5408
|
+
this.autoUnitWarningActive = false;
|
|
5409
|
+
this.lastReportedUnitsPerEm = undefined;
|
|
5222
5410
|
return 0;
|
|
5223
5411
|
}
|
|
5224
|
-
|
|
5412
|
+
this.autoUnitWarningActive = true;
|
|
5413
|
+
this.errors.addOrReplace({
|
|
5414
|
+
id: "AUTO_unitScaling",
|
|
5415
|
+
type: "warning",
|
|
5416
|
+
message: `unit-scaling: invalid value "${resolved.raw}" — auto-fitting to the bar column width.`,
|
|
5417
|
+
});
|
|
5418
|
+
return 0;
|
|
5225
5419
|
}
|
|
5226
5420
|
preparePercentageScaling() {
|
|
5227
|
-
|
|
5228
|
-
if (
|
|
5229
|
-
|
|
5421
|
+
const resolved = resolveScalingValue(this.percentageScaling, this.pixelPerUnitGroupMap);
|
|
5422
|
+
if (resolved.kind === "value") {
|
|
5423
|
+
this.errors.remove("AUTO_percentageScaling");
|
|
5424
|
+
this.autoPctWarningActive = false;
|
|
5425
|
+
this.lastReportedPpPerEm = undefined;
|
|
5426
|
+
// Inner ibcs-table expects em per percentage point.
|
|
5427
|
+
return 1 / resolved.value;
|
|
5230
5428
|
}
|
|
5231
|
-
if (
|
|
5429
|
+
if (resolved.kind === "auto") {
|
|
5430
|
+
this.errors.remove("AUTO_percentageScaling");
|
|
5431
|
+
this.autoPctWarningActive = false;
|
|
5432
|
+
this.lastReportedPpPerEm = undefined;
|
|
5232
5433
|
return 0;
|
|
5233
5434
|
}
|
|
5234
|
-
|
|
5435
|
+
this.autoPctWarningActive = true;
|
|
5436
|
+
this.errors.addOrReplace({
|
|
5437
|
+
id: "AUTO_percentageScaling",
|
|
5438
|
+
type: "warning",
|
|
5439
|
+
message: `percentage-scaling: invalid value "${resolved.raw}" — auto-fitting to the pin area.`,
|
|
5440
|
+
});
|
|
5441
|
+
return 0;
|
|
5235
5442
|
}
|
|
5236
5443
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5237
5444
|
getDataStructure() {
|
|
@@ -5294,7 +5501,7 @@ const Table$1 = class Table {
|
|
|
5294
5501
|
render() {
|
|
5295
5502
|
const fontStyles = this.getFontStyles();
|
|
5296
5503
|
const effectiveFactor = this.getEffectiveScaleFactor();
|
|
5297
|
-
return (h(Host, { key: '
|
|
5504
|
+
return (h(Host, { key: 'de215fb339b9b38a57da35da8dce380641cd9d35', style: fontStyles }, h("div", { key: '6628fdc73598c2f9bf313184ae62703b6587c35f' }, h("ibcs-table", { key: 'f9a93bdfdfef7861604ba3a880ade5e2cafdd6dc', 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, scaleFactor: effectiveFactor, ruleSetConfig: this.ruleSetConfig(), selectedStyle: this.selectedStyle }))));
|
|
5298
5505
|
}
|
|
5299
5506
|
get element() { return getElement(this); }
|
|
5300
5507
|
static get watchers() { return {
|
|
@@ -6113,6 +6320,10 @@ class DataAnalyzer {
|
|
|
6113
6320
|
if (mode === "_") {
|
|
6114
6321
|
return new SiPrefix();
|
|
6115
6322
|
}
|
|
6323
|
+
// Accept the Unicode micro sign as an alias for the ASCII "my" key.
|
|
6324
|
+
if (mode === "μ") {
|
|
6325
|
+
mode = "my";
|
|
6326
|
+
}
|
|
6116
6327
|
if (mode != null) {
|
|
6117
6328
|
if ([...this.unitsLeast, ...this.unitsGreat].includes(mode)) {
|
|
6118
6329
|
return this.lookupPrefix(mode);
|
|
@@ -6147,17 +6358,22 @@ class DataAnalyzer {
|
|
|
6147
6358
|
}
|
|
6148
6359
|
return this.determinePrefix(Math.abs(num));
|
|
6149
6360
|
}
|
|
6150
|
-
/**
|
|
6361
|
+
/**
|
|
6362
|
+
* Maps an absolute numeric value to the best-fitting SI prefix based on
|
|
6363
|
+
* its decimal magnitude. Values in (0.001, 1000) keep the identity prefix.
|
|
6364
|
+
* Magnitudes beyond the covered SI range clamp to the outermost prefix.
|
|
6365
|
+
*/
|
|
6151
6366
|
static determinePrefix(num) {
|
|
6367
|
+
if (!Number.isFinite(num) || num <= 0) {
|
|
6368
|
+
return new SiPrefix();
|
|
6369
|
+
}
|
|
6152
6370
|
if (num >= 1000) {
|
|
6153
|
-
const
|
|
6154
|
-
|
|
6155
|
-
return new SiPrefix(this.unitsGreat[floor - 1], value);
|
|
6371
|
+
const idx = Math.min(Math.floor(Math.log10(num) / 3), this.unitsGreat.length) - 1;
|
|
6372
|
+
return new SiPrefix(this.unitsGreat[idx], Math.pow(1000, idx + 1));
|
|
6156
6373
|
}
|
|
6157
6374
|
if (num <= 0.001) {
|
|
6158
|
-
const
|
|
6159
|
-
|
|
6160
|
-
return new SiPrefix(this.unitsLeast[floor - 1], value);
|
|
6375
|
+
const idx = Math.min(-Math.floor(Math.log10(num) / 3), this.unitsLeast.length) - 1;
|
|
6376
|
+
return new SiPrefix(this.unitsLeast[idx], Math.pow(1000, -(idx + 1)));
|
|
6161
6377
|
}
|
|
6162
6378
|
return new SiPrefix();
|
|
6163
6379
|
}
|
|
@@ -6169,7 +6385,7 @@ class DataAnalyzer {
|
|
|
6169
6385
|
/** SI prefixes for large numbers, ordered by magnitude (k=10^3 .. Y=10^24). */
|
|
6170
6386
|
DataAnalyzer.unitsGreat = ["k", "M", "G", "T", "P", "E", "Z", "Y"];
|
|
6171
6387
|
/** SI prefixes for small numbers, ordered by magnitude (m=10^-3 .. y=10^-24). */
|
|
6172
|
-
DataAnalyzer.unitsLeast = ["m", "my", "n", "p", "
|
|
6388
|
+
DataAnalyzer.unitsLeast = ["m", "my", "n", "p", "f", "a", "z", "y"];
|
|
6173
6389
|
|
|
6174
6390
|
class StringAdapter {
|
|
6175
6391
|
adapt(data) {
|
|
@@ -8853,6 +9069,13 @@ const IbcsChartStructure = class {
|
|
|
8853
9069
|
if (!autoUnit && !autoPercent) {
|
|
8854
9070
|
return; // Both explicit — nothing to auto-fit
|
|
8855
9071
|
}
|
|
9072
|
+
const reportResolved = () => {
|
|
9073
|
+
var _a;
|
|
9074
|
+
(_a = this.reportAutoScaling) === null || _a === void 0 ? void 0 : _a.call(this, {
|
|
9075
|
+
unit: autoUnit ? config.pixelPerUnit : undefined,
|
|
9076
|
+
percentage: autoPercent ? config.pixelPerPercentage : undefined,
|
|
9077
|
+
});
|
|
9078
|
+
};
|
|
8856
9079
|
const targetWidth = (_a = this.parentDimensions) === null || _a === void 0 ? void 0 : _a.width;
|
|
8857
9080
|
const db = this.getDb();
|
|
8858
9081
|
if (!targetWidth || targetWidth <= 0) {
|
|
@@ -8862,6 +9085,7 @@ const IbcsChartStructure = class {
|
|
|
8862
9085
|
config.pixelPerPercentage = 50;
|
|
8863
9086
|
this.chart = new StructureChart(new IBCSRuleSet(this.ruleSetConfig), db, this.tableName, config, styles);
|
|
8864
9087
|
this.chart.setI18n(this.i18n);
|
|
9088
|
+
reportResolved();
|
|
8865
9089
|
return;
|
|
8866
9090
|
}
|
|
8867
9091
|
// First pass: set auto values to 1 and measure total width + bar extent
|
|
@@ -8874,6 +9098,7 @@ const IbcsChartStructure = class {
|
|
|
8874
9098
|
this.chart.toString();
|
|
8875
9099
|
const svgWidth = this.chart.getAllocatedCanvasWidth();
|
|
8876
9100
|
if (svgWidth <= 0) {
|
|
9101
|
+
reportResolved();
|
|
8877
9102
|
return;
|
|
8878
9103
|
}
|
|
8879
9104
|
// Separate fixed parts (labels, padding, spacing) from variable part (bar extent).
|
|
@@ -8896,6 +9121,7 @@ const IbcsChartStructure = class {
|
|
|
8896
9121
|
// Second pass with the corrected scaling
|
|
8897
9122
|
this.chart = new StructureChart(new IBCSRuleSet(this.ruleSetConfig), db, this.tableName, config, styles);
|
|
8898
9123
|
this.chart.setI18n(this.i18n);
|
|
9124
|
+
reportResolved();
|
|
8899
9125
|
}
|
|
8900
9126
|
async componentWillRender() {
|
|
8901
9127
|
// return await (async () => {
|
|
@@ -12719,6 +12945,13 @@ const IbcsChartTime = class {
|
|
|
12719
12945
|
if (!autoUnit && !autoPercent) {
|
|
12720
12946
|
return; // Both explicit — nothing to auto-fit
|
|
12721
12947
|
}
|
|
12948
|
+
const reportResolved = () => {
|
|
12949
|
+
var _a;
|
|
12950
|
+
(_a = this.reportAutoScaling) === null || _a === void 0 ? void 0 : _a.call(this, {
|
|
12951
|
+
unit: autoUnit ? config.pixelPerUnit : undefined,
|
|
12952
|
+
percentage: autoPercent ? config.pixelPerPercentage : undefined,
|
|
12953
|
+
});
|
|
12954
|
+
};
|
|
12722
12955
|
const targetHeight = (_a = this.parentDimensions) === null || _a === void 0 ? void 0 : _a.height;
|
|
12723
12956
|
const availableWidth = this.containerWidth || 0;
|
|
12724
12957
|
if (!targetHeight || targetHeight <= 0) {
|
|
@@ -12728,6 +12961,7 @@ const IbcsChartTime = class {
|
|
|
12728
12961
|
config.pixelPerPercentage = 50;
|
|
12729
12962
|
this.chart = new TimeChart(new IBCSRuleSet(this.ruleSetConfig), this.getDb(), this.tableName, config, styles, availableWidth);
|
|
12730
12963
|
this.chart.setI18n(this.i18n);
|
|
12964
|
+
reportResolved();
|
|
12731
12965
|
return;
|
|
12732
12966
|
}
|
|
12733
12967
|
// First pass: set auto values to 1 and measure SVG height
|
|
@@ -12740,6 +12974,7 @@ const IbcsChartTime = class {
|
|
|
12740
12974
|
this.chart.toString();
|
|
12741
12975
|
const svgHeight = this.chart.getAllocatedCanvasHeight();
|
|
12742
12976
|
if (svgHeight <= 0) {
|
|
12977
|
+
reportResolved();
|
|
12743
12978
|
return;
|
|
12744
12979
|
}
|
|
12745
12980
|
// Scale so the chart fits in ~90% of the available height
|
|
@@ -12751,6 +12986,7 @@ const IbcsChartTime = class {
|
|
|
12751
12986
|
// Second pass with the corrected scaling
|
|
12752
12987
|
this.chart = new TimeChart(new IBCSRuleSet(this.ruleSetConfig), this.getDb(), this.tableName, config, styles, availableWidth);
|
|
12753
12988
|
this.chart.setI18n(this.i18n);
|
|
12989
|
+
reportResolved();
|
|
12754
12990
|
}
|
|
12755
12991
|
async componentWillRender() {
|
|
12756
12992
|
// return await (async () => {
|
|
@@ -12981,8 +13217,8 @@ const DEFAULT_STYLES = {
|
|
|
12981
13217
|
fontColor: "#000000",
|
|
12982
13218
|
fontSize: 11,
|
|
12983
13219
|
fontFamily: "'Noto Sans', sans-serif",
|
|
12984
|
-
unitScaling: 0.01, // Default:
|
|
12985
|
-
percentageScaling: 0.5, // Default:
|
|
13220
|
+
unitScaling: 0.01, // Default: 100 units per em of bar
|
|
13221
|
+
percentageScaling: 0.5, // Default: 2 percentage points per em of pin
|
|
12986
13222
|
scaleFactor: 1,
|
|
12987
13223
|
};
|
|
12988
13224
|
const AXIS_COLOR = "#666666";
|
|
@@ -15595,6 +15831,17 @@ const IbcsTable = class {
|
|
|
15595
15831
|
* Scenario styles (ac, pp, fc, pl) use barStyles for IBCS-compliant grayscale coloring.
|
|
15596
15832
|
*/
|
|
15597
15833
|
prepareBarChartStyles() {
|
|
15834
|
+
var _a;
|
|
15835
|
+
const autoUnit = !(this.unitScaling > 0);
|
|
15836
|
+
const autoPercent = !(this.percentageScaling > 0);
|
|
15837
|
+
const resolvedUnit = autoUnit ? this.autoUnitScaling() : this.unitScaling;
|
|
15838
|
+
const resolvedPercent = autoPercent ? this.autoPercentageScaling() : this.percentageScaling;
|
|
15839
|
+
if (autoUnit || autoPercent) {
|
|
15840
|
+
(_a = this.reportAutoScaling) === null || _a === void 0 ? void 0 : _a.call(this, {
|
|
15841
|
+
unit: autoUnit ? resolvedUnit : undefined,
|
|
15842
|
+
percentage: autoPercent ? resolvedPercent : undefined,
|
|
15843
|
+
});
|
|
15844
|
+
}
|
|
15598
15845
|
return this.componentStyle(($) => {
|
|
15599
15846
|
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;
|
|
15600
15847
|
const varianceStyles = (_a = $["bn-chart-time"]) === null || _a === void 0 ? void 0 : _a["varianceStyles"];
|
|
@@ -15651,8 +15898,8 @@ const IbcsTable = class {
|
|
|
15651
15898
|
fontColor: ((_z = $["global"]) === null || _z === void 0 ? void 0 : _z["fontColor"]) || "#000000",
|
|
15652
15899
|
fontSize: (((_0 = $["global"]) === null || _0 === void 0 ? void 0 : _0["fontSizePx"]) || 13.3333) * 0.85 * this.scaleFactor,
|
|
15653
15900
|
fontFamily: ((_1 = $["global"]) === null || _1 === void 0 ? void 0 : _1["fontFamily"]) || "'Noto Sans', sans-serif",
|
|
15654
|
-
unitScaling:
|
|
15655
|
-
percentageScaling:
|
|
15901
|
+
unitScaling: resolvedUnit,
|
|
15902
|
+
percentageScaling: resolvedPercent,
|
|
15656
15903
|
scaleFactor: this.scaleFactor,
|
|
15657
15904
|
};
|
|
15658
15905
|
});
|