@bino-bi/bn-template-engine 1.0.0-next.19 → 1.0.0-next.21
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-7bdc0e28.entry.js → p-28d5c266.entry.js} +1 -1
- package/dist/bn-template-engine/{p-2e6dc267.entry.js → p-2d3ea756.entry.js} +1 -1
- package/dist/bn-template-engine/{p-9879c9b2.entry.js → p-2fba7c99.entry.js} +1 -1
- package/dist/bn-template-engine/{p-eca8e2e2.entry.js → p-6077155f.entry.js} +1 -1
- package/dist/bn-template-engine/{p-74c5a95d.entry.js → p-687032d5.entry.js} +1 -1
- package/dist/bn-template-engine/{p-22d0fb7a.entry.js → p-6c7f0076.entry.js} +1 -1
- package/dist/bn-template-engine/{p-Dg9OcXAO.js → p-6lOdN-fB.js} +1 -1
- package/dist/bn-template-engine/{p-83c71b16.entry.js → p-7e9dbc93.entry.js} +1 -1
- package/dist/bn-template-engine/{p-b25455a7.entry.js → p-99477a27.entry.js} +1 -1
- package/dist/bn-template-engine/p-A8xyE4b1.js +1 -0
- package/dist/bn-template-engine/p-BgIpdpfH.js +1 -0
- package/dist/bn-template-engine/p-BpWWgN6k.js +1 -0
- package/dist/bn-template-engine/{p-Bdfxd_Ke.js → p-C5uvAEKI.js} +1 -1
- package/dist/bn-template-engine/p-C8Q0lsaU.js +1 -0
- package/dist/bn-template-engine/{p-DY7YYmpa.js → p-C9i1Xsib.js} +1 -1
- package/dist/bn-template-engine/{p-BWKdb9ym.js → p-CJThzFZm.js} +1 -1
- package/dist/bn-template-engine/{p-rdqTC0_5.js → p-CYE0I1Mx.js} +1 -1
- package/dist/bn-template-engine/{p-X6CxL6W-.js → p-DwYUTvvI.js} +1 -1
- package/dist/bn-template-engine/{p-19bbac66.entry.js → p-a1380d7c.entry.js} +1 -1
- package/dist/bn-template-engine/{p-485d23d7.entry.js → p-a4ea9a79.entry.js} +1 -1
- package/dist/bn-template-engine/p-b5274369.entry.js +1 -0
- package/dist/bn-template-engine/{p-e96da91f.entry.js → p-b9e94127.entry.js} +1 -1
- package/dist/bn-template-engine/p-ba912130.entry.js +1 -0
- package/dist/bn-template-engine/{p-f9dfd120.entry.js → p-de29986f.entry.js} +1 -1
- package/dist/bn-template-engine/{p-BZV1b5VH.js → p-eEfqksk-.js} +1 -1
- package/dist/bn-template-engine/{p-aakBGfzL.js → p-fFtEvsY-.js} +1 -1
- package/dist/cjs/{AxisConfig-VnVelfSV.js → AxisConfig-D7CAyPLO.js} +1 -1
- package/dist/cjs/{LabelCollisionManager-nfD5P__k.js → LabelCollisionManager-DkdQ9Xdg.js} +2 -2
- package/dist/cjs/{Order-DobBozQC.js → Order-IPfAP0q8.js} +1 -1
- package/dist/cjs/{SVGStyle-BQOmGWLX.js → SVGStyle-BD8jApd4.js} +2 -2
- package/dist/cjs/{SVGVariancesStyleGroup-DCGfHrqh.js → SVGVariancesStyleGroup-BaWzR951.js} +1 -1
- package/dist/cjs/{VarianceMeasure-NY9yhiNV.js → VarianceMeasure-BBWTgv2e.js} +1 -1
- package/dist/cjs/{XYChartDataRow-B7OKrAcC.js → XYChartDataRow-BoR0CTfl.js} +4 -4
- package/dist/cjs/bn-asset_21.cjs.entry.js +93 -35
- package/dist/cjs/bn-chart-bubble.cjs.entry.js +8 -8
- package/dist/cjs/bn-chart-bullet.cjs.entry.js +7 -7
- package/dist/cjs/bn-chart-scatter.cjs.entry.js +7 -7
- package/dist/cjs/bn-grid.cjs.entry.js +5 -5
- package/dist/cjs/bn-image.cjs.entry.js +4 -4
- package/dist/cjs/bn-internationalization.cjs.entry.js +1 -1
- package/dist/cjs/bn-ruleset.cjs.entry.js +1 -1
- package/dist/cjs/bn-template-engine.cjs.js +1 -1
- package/dist/cjs/bn-text.cjs.entry.js +5 -5
- package/dist/cjs/bn-tree.cjs.entry.js +4 -4
- package/dist/cjs/{context-protocol-BDrMkhc4.js → context-protocol-BBhT9B52.js} +9 -3
- package/dist/cjs/editor-companion.cjs.entry.js +1 -1
- package/dist/cjs/ibcs-chart-bubble.cjs.entry.js +5 -5
- package/dist/cjs/ibcs-chart-bullet.cjs.entry.js +5 -5
- package/dist/cjs/ibcs-chart-scatter.cjs.entry.js +5 -5
- package/dist/cjs/{layoutObserver-o03YUfn_.js → layoutObserver-DUYYkDMQ.js} +3 -3
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{scaling-DKZyjWj5.js → scaling-BIJQ2NV1.js} +4 -2
- package/dist/cjs/{withScalingGroup-BmcRlWBs.js → withScalingGroup-D5clRvRe.js} +1 -1
- package/dist/cjs/{withStyled-CRiC9fzc.js → withStyled-Cm9dWQhu.js} +34 -3
- package/dist/collection/components/bn-chart-structure/bn-chart-structure.js +2 -2
- package/dist/collection/components/bn-chart-structure/ibcs-chart-structure.js +1 -1
- package/dist/collection/components/bn-chart-structure/utils/StructureChart.js +19 -2
- package/dist/collection/components/bn-chart-time/bn-chart-time.js +2 -2
- package/dist/collection/components/bn-chart-time/ibcs-chart-time.js +3 -1
- package/dist/collection/components/bn-chart-time/utils/TimeChart.js +19 -1
- package/dist/collection/components/bn-chart-time/utils/model/TimeChartComponentConfig.js +5 -0
- package/dist/collection/components/bn-context/bn-context.js +20 -1
- package/dist/collection/components/bn-grid/bn-grid.js +20 -1
- package/dist/collection/components/bn-layout-card/bn-layout-card.js +3 -3
- package/dist/collection/components/bn-layout-page/bn-layout-page.js +3 -3
- package/dist/collection/components/bn-table/bn-table.js +2 -2
- package/dist/collection/components/bn-table/ibcs-table.js +1 -1
- package/dist/collection/components/bn-table/utils/Table.js +0 -1
- package/dist/collection/components/bn-table/utils/factories/tableDataSetFactory.js +3 -1
- package/dist/collection/components/bn-title/bn-title.js +5 -1
- package/dist/collection/components/bn-title/ibcs-title/ibcs-title.js +25 -2
- package/dist/collection/components/bn-title/ibcs-title/utils/Title.js +4 -4
- package/dist/collection/components/bn-title/ibcs-title/utils/factories/TitleDataSetFactory.js +6 -2
- package/dist/collection/components/bn-title/ibcs-title/utils/model/TitleConfig.js +5 -0
- package/dist/collection/components/bn-tree/bn-tree.js +19 -0
- package/dist/collection/stores/internationalization.js +9 -3
- package/dist/collection/utils/DateStringFactory.js +31 -0
- package/dist/collection/utils/withTranslation.js +3 -1
- package/dist/components/DateStringFactory.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-context.js +1 -1
- package/dist/components/bn-grid.js +1 -1
- package/dist/components/bn-layout-card.js +1 -1
- package/dist/components/bn-layout-page.js +1 -1
- package/dist/components/bn-table.js +1 -1
- package/dist/components/bn-title2.js +1 -1
- package/dist/components/bn-tree.js +1 -1
- package/dist/components/context-protocol.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/ibcs-title2.js +1 -1
- package/dist/esm/{AxisConfig-C_zWCKlL.js → AxisConfig-ByIP5J-9.js} +1 -1
- package/dist/esm/{LabelCollisionManager-8swVQHKA.js → LabelCollisionManager-DaNiDiM9.js} +2 -2
- package/dist/esm/{Order-BPeWfygb.js → Order-BQeJE_yi.js} +1 -1
- package/dist/esm/{SVGStyle-BxEDw9zh.js → SVGStyle-BwBlY3Km.js} +2 -2
- package/dist/esm/{SVGVariancesStyleGroup-DRQYvSDD.js → SVGVariancesStyleGroup-BpGW4CvN.js} +1 -1
- package/dist/esm/{VarianceMeasure-DnwNKspZ.js → VarianceMeasure-CE3N8Bea.js} +1 -1
- package/dist/esm/{XYChartDataRow-DeV4r-Wm.js → XYChartDataRow-DeMI1JKU.js} +4 -4
- package/dist/esm/bn-asset_21.entry.js +93 -35
- package/dist/esm/bn-chart-bubble.entry.js +8 -8
- package/dist/esm/bn-chart-bullet.entry.js +7 -7
- package/dist/esm/bn-chart-scatter.entry.js +7 -7
- package/dist/esm/bn-grid.entry.js +5 -5
- package/dist/esm/bn-image.entry.js +4 -4
- package/dist/esm/bn-internationalization.entry.js +1 -1
- package/dist/esm/bn-ruleset.entry.js +1 -1
- package/dist/esm/bn-template-engine.js +1 -1
- package/dist/esm/bn-text.entry.js +5 -5
- package/dist/esm/bn-tree.entry.js +4 -4
- package/dist/esm/{context-protocol-1Yj1uKvh.js → context-protocol-d8MHrEo8.js} +9 -3
- package/dist/esm/editor-companion.entry.js +1 -1
- package/dist/esm/ibcs-chart-bubble.entry.js +5 -5
- package/dist/esm/ibcs-chart-bullet.entry.js +5 -5
- package/dist/esm/ibcs-chart-scatter.entry.js +5 -5
- package/dist/esm/{layoutObserver-BG5dOBYH.js → layoutObserver-BJBEyhNf.js} +3 -3
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{scaling-CeSRcRl1.js → scaling-BGnpSN1j.js} +4 -2
- package/dist/esm/{withScalingGroup-Br70pAv9.js → withScalingGroup-CC3UcvC5.js} +1 -1
- package/dist/esm/{withStyled-Br2DGTPs.js → withStyled-2l5Tx3cf.js} +34 -3
- package/dist/types/components/bn-chart-structure/utils/StructureChart.d.ts +5 -0
- package/dist/types/components/bn-chart-time/utils/TimeChart.d.ts +5 -0
- package/dist/types/components/bn-chart-time/utils/model/TimeChartComponentConfig.d.ts +2 -0
- package/dist/types/components/bn-context/bn-context.d.ts +8 -0
- package/dist/types/components/bn-grid/bn-grid.d.ts +8 -0
- package/dist/types/components/bn-layout-card/bn-layout-card.d.ts +4 -0
- package/dist/types/components/bn-layout-page/bn-layout-page.d.ts +4 -0
- package/dist/types/components/bn-title/bn-title.d.ts +1 -0
- package/dist/types/components/bn-title/ibcs-title/ibcs-title.d.ts +2 -0
- package/dist/types/components/bn-title/ibcs-title/utils/factories/TitleDataSetFactory.d.ts +3 -1
- package/dist/types/components/bn-title/ibcs-title/utils/model/TitleConfig.d.ts +2 -0
- package/dist/types/components/bn-tree/bn-tree.d.ts +8 -0
- package/dist/types/components.d.ts +42 -4
- package/dist/types/utils/DateStringFactory.d.ts +19 -0
- package/dist/types/utils/withTranslation.d.ts +3 -1
- package/package.json +1 -1
- package/dist/bn-template-engine/p-209351c9.entry.js +0 -1
- package/dist/bn-template-engine/p-90806e7a.entry.js +0 -1
- package/dist/bn-template-engine/p-BqhIhYr1.js +0 -1
- package/dist/bn-template-engine/p-C0Pwqx-O.js +0 -1
- package/dist/bn-template-engine/p-CiudZRQr.js +0 -1
- package/dist/bn-template-engine/p-DTuaq8Pj.js +0 -1
|
@@ -468,6 +468,25 @@ export class ChartTree {
|
|
|
468
468
|
"attribute": "edge-style",
|
|
469
469
|
"defaultValue": "\"orthogonal\""
|
|
470
470
|
},
|
|
471
|
+
"i18nNamespace": {
|
|
472
|
+
"type": "string",
|
|
473
|
+
"mutable": false,
|
|
474
|
+
"complexType": {
|
|
475
|
+
"original": "string",
|
|
476
|
+
"resolved": "string",
|
|
477
|
+
"references": {}
|
|
478
|
+
},
|
|
479
|
+
"required": false,
|
|
480
|
+
"optional": false,
|
|
481
|
+
"docs": {
|
|
482
|
+
"tags": [],
|
|
483
|
+
"text": "I18n namespace inherited by this tree's children (their own namespace\nwins). Resolved at runtime from the `i18n-namespace` attribute by the\nnearest ancestor lookup in `withTranslation`; the tree renders no\ntranslated text itself. Declared so the attribute is part of the typed\npublic API rather than a bare DOM attribute."
|
|
484
|
+
},
|
|
485
|
+
"getter": false,
|
|
486
|
+
"setter": false,
|
|
487
|
+
"reflect": true,
|
|
488
|
+
"attribute": "i18n-namespace"
|
|
489
|
+
},
|
|
471
490
|
"showOperators": {
|
|
472
491
|
"type": "string",
|
|
473
492
|
"mutable": false,
|
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
* **Token pattern**: Variance symbols use `{%}` as a placeholder for the
|
|
9
9
|
* scenario abbreviation. For example, `"Δ{%}"` becomes `"ΔPY"` when the
|
|
10
10
|
* comparison scenario is "PY". The `{%}` replacement is performed at render
|
|
11
|
-
* time by
|
|
11
|
+
* time by `Formatter.translateScenarioLabel` — not by `withTranslation`,
|
|
12
|
+
* which only interpolates `{{mustache}}` placeholders.
|
|
12
13
|
*
|
|
13
14
|
* @module stores/internationalization
|
|
14
15
|
*/
|
|
@@ -108,7 +109,8 @@ const de = flattenObject({
|
|
|
108
109
|
CONNECTOR_WS: " und ",
|
|
109
110
|
in: "in",
|
|
110
111
|
},
|
|
111
|
-
"bn-chart": {},
|
|
112
|
+
"bn-chart-time": { "no-data": "==Keine Daten==" },
|
|
113
|
+
"bn-chart-structure": { "no-data": "==Keine Daten==", REST: "REST" },
|
|
112
114
|
"bn-chart-scatter": Object.assign(Object.assign({}, xyChartKeysDe), { "xy-iso-domain": "Iso-Linien benötigen einen strikt positiven Wertebereich auf beiden Achsen; übersprungen." }),
|
|
113
115
|
"bn-chart-bubble": Object.assign(Object.assign({}, xyChartKeysDe), { legend: Object.assign(Object.assign({}, xyChartKeysDe.legend), { size: "Größe", compare: "Szenarien" }), "xy-compare-variance": "compareWith kann nicht mit Varianz-Kennzahlen auf den Achsen kombiniert werden.", "bubble-size-negative": "{{count}} Blase(n) mit negativem Größenwert ausgeschlossen.", "bubble-share-range": "{{count}} Anteilswert(e) außerhalb [0,1] wurden begrenzt.", "bubble-scale-group-unknown": "size.group '{{group}}' verweist auf keine bn-scaling-group im Kontext.", "bubble-scale-overflow": "{{count}} gruppenskalierte Blase(n) überschreiten das Panel; in Originalgröße gezeichnet." }),
|
|
114
116
|
"bn-chart-bullet": {
|
|
@@ -133,6 +135,7 @@ const de = flattenObject({
|
|
|
133
135
|
part_of: "in % von",
|
|
134
136
|
SUM_TOTAL: "❖",
|
|
135
137
|
REST: "REST",
|
|
138
|
+
"no-data": "==Keine Daten==",
|
|
136
139
|
},
|
|
137
140
|
});
|
|
138
141
|
const en = flattenObject({
|
|
@@ -165,7 +168,8 @@ const en = flattenObject({
|
|
|
165
168
|
CONNECTOR_WS: " and ",
|
|
166
169
|
in: "in",
|
|
167
170
|
},
|
|
168
|
-
"bn-chart": {},
|
|
171
|
+
"bn-chart-time": { "no-data": "==No Data==" },
|
|
172
|
+
"bn-chart-structure": { "no-data": "==No Data==", REST: "REST" },
|
|
169
173
|
"bn-chart-scatter": Object.assign(Object.assign({}, xyChartKeysEn), { "xy-iso-domain": "Iso-lines need a strictly positive domain on both axes; skipped." }),
|
|
170
174
|
"bn-chart-bubble": Object.assign(Object.assign({}, xyChartKeysEn), { legend: Object.assign(Object.assign({}, xyChartKeysEn.legend), { size: "Size", compare: "Scenarios" }), "xy-compare-variance": "compareWith cannot be combined with variance measures on the axes.", "bubble-size-negative": "{{count}} bubble(s) with a negative size value excluded.", "bubble-share-range": "{{count}} share value(s) outside [0,1] were clamped.", "bubble-scale-group-unknown": "size.group '{{group}}' names no bn-scaling-group in scope.", "bubble-scale-overflow": "{{count}} group-scaled bubble(s) exceed the panel; rendered true-size." }),
|
|
171
175
|
"bn-chart-bullet": {
|
|
@@ -183,12 +187,14 @@ const en = flattenObject({
|
|
|
183
187
|
"bullet-ranges-invalid": "ranges: expected up to 2 ascending positive fractions of the target ({{detail}}).",
|
|
184
188
|
},
|
|
185
189
|
"bn-table": {
|
|
190
|
+
in: "in",
|
|
186
191
|
category: " ",
|
|
187
192
|
operation: " ",
|
|
188
193
|
there_of: "there of",
|
|
189
194
|
part_of: "in % of",
|
|
190
195
|
SUM_TOTAL: "❖",
|
|
191
196
|
REST: "REST",
|
|
197
|
+
"no-data": "==No Data==",
|
|
192
198
|
},
|
|
193
199
|
});
|
|
194
200
|
const BN_INTERNATIONALIZATION_KEYS = Object.keys(de || {});
|
|
@@ -74,6 +74,9 @@ export class DateStringFactory {
|
|
|
74
74
|
none: "[DATE]",
|
|
75
75
|
};
|
|
76
76
|
this.locale = "de";
|
|
77
|
+
/** Set once a caller supplies an explicit map, so `setLocale` stops overwriting it. */
|
|
78
|
+
this.dateFormatPinned = false;
|
|
79
|
+
this.dateFormatShortPinned = false;
|
|
77
80
|
this.dateFormat = this._dateFormat;
|
|
78
81
|
this.dateLinkFormat = this._dateLinkFormat;
|
|
79
82
|
this.dateFormatShort = this._dateFormatShort;
|
|
@@ -83,12 +86,25 @@ export class DateStringFactory {
|
|
|
83
86
|
}
|
|
84
87
|
setDateFormat(dateFormat) {
|
|
85
88
|
this.dateFormat = dateFormat;
|
|
89
|
+
this.dateFormatPinned = true;
|
|
86
90
|
}
|
|
87
91
|
setDateFormatShort(dateFormatShort) {
|
|
88
92
|
this.dateFormatShort = dateFormatShort;
|
|
93
|
+
this.dateFormatShortPinned = true;
|
|
89
94
|
}
|
|
95
|
+
/**
|
|
96
|
+
* Selects the locale used for Luxon's localized tokens and swaps in the
|
|
97
|
+
* locale's pattern overrides. An explicit `setDateFormat` /
|
|
98
|
+
* `setDateFormatShort` always wins, whatever the call order.
|
|
99
|
+
*/
|
|
90
100
|
setLocale(locale) {
|
|
91
101
|
this.locale = locale;
|
|
102
|
+
if (!this.dateFormatPinned) {
|
|
103
|
+
this.dateFormat = Object.assign(Object.assign({}, this._dateFormat), (DateStringFactory.LOCALE_DATE_FORMAT[locale] || {}));
|
|
104
|
+
}
|
|
105
|
+
if (!this.dateFormatShortPinned) {
|
|
106
|
+
this.dateFormatShort = Object.assign(Object.assign({}, this._dateFormatShort), (DateStringFactory.LOCALE_DATE_FORMAT_SHORT[locale] || {}));
|
|
107
|
+
}
|
|
92
108
|
}
|
|
93
109
|
/**
|
|
94
110
|
* Converts date string based on dateFormatMap and the selected Type
|
|
@@ -445,3 +461,18 @@ export class DateStringFactory {
|
|
|
445
461
|
}
|
|
446
462
|
}
|
|
447
463
|
}
|
|
464
|
+
/**
|
|
465
|
+
* Per-locale overrides for the patterns whose literals are language-specific.
|
|
466
|
+
*
|
|
467
|
+
* The base maps above are German (`KW` = Kalenderwoche, `dd.MM.yyyy`); a
|
|
468
|
+
* locale listed here replaces only the entries it names. Locales that are not
|
|
469
|
+
* listed keep the base patterns, so adding a bundle never silently reformats
|
|
470
|
+
* existing reports. Luxon's `LLL` (month) and `q` (quarter) tokens are already
|
|
471
|
+
* locale-aware through `setLocale`, so they need no override.
|
|
472
|
+
*/
|
|
473
|
+
DateStringFactory.LOCALE_DATE_FORMAT = {
|
|
474
|
+
en: { week: "'W'WW yyyy", day: "MM/dd/yyyy", fallback: "MM/dd/yyyy" },
|
|
475
|
+
};
|
|
476
|
+
DateStringFactory.LOCALE_DATE_FORMAT_SHORT = {
|
|
477
|
+
en: { week: "'W'WW", fallback: "MM/dd/yyyy" },
|
|
478
|
+
};
|
|
@@ -25,7 +25,9 @@ import { findAncestorWithAttr } from "./withInheritedProps";
|
|
|
25
25
|
* the key itself is returned.
|
|
26
26
|
*
|
|
27
27
|
* **Mustache-style interpolation:** `{{variable}}` placeholders in translation
|
|
28
|
-
* templates are replaced with values from the optional `data` object.
|
|
28
|
+
* templates are replaced with values from the optional `data` object. The
|
|
29
|
+
* separate `{%}` scenario token used by the variance symbols is substituted
|
|
30
|
+
* later, by `Formatter.translateScenarioLabel`.
|
|
29
31
|
*
|
|
30
32
|
* @param component - The Stencil component instance
|
|
31
33
|
* @returns Object containing the `t` translation function
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{D as t}from"./luxon.js";var e,s;!function(t){t.YEAR="year",t.QUARTER="quarter",t.MONTH="month",t.WEEK="week",t.DAY="day",t.HOUR="hour",t.MINUTE="minute",t.SECOND="second",t.MILLISECOND="millisecond",t.NONE="fallback",t.AUTO="auto"}(e||(e={})),function(t){t.AVG="avg",t.INTERVAL="interval",t.START="start",t.END="end",t.YTD="ytd",t.YTG="ytg",t.CUM="cum",t.MAT="mat",t.NONE="none",t.AUTO="auto"}(s||(s={}));class r{constructor(){this._dateFormat={year:"yyyy",quarter:"q'Q' yyyy",month:"LLL yyyy",week:"'KW'WW yyyy",day:"dd.MM.yyyy",hour:"TT",minute:"TT",second:"TT",millisecond:"TT:SSS",fallback:"dd.MM.yyyy"},this._dateFormatShort={year:"yy",quarter:"q'Q'",month:"LLL",week:"'KW'WW",day:"dd",hour:"hh'h'",minute:"mm'm'",second:"ss's'",millisecond:"SSS'ms'",fallback:"dd.MM.yyyy"},this._dateLinkFormat={avg:"Ø[LINK]",interval:"[DATE]..[DATE2]",start:".[DATE]",end:"[DATE].",ytd:"_[DATE]",ytg:"[DATE]_",cum:"[DATE]_[DATE2]",mat:"~[DATE]",none:"[DATE]"},this.locale="de",this.dateFormat=this._dateFormat,this.dateLinkFormat=this._dateLinkFormat,this.dateFormatShort=this._dateFormatShort}setDateLinkFormat(t){this.dateLinkFormat=t}setDateFormat(t){this.dateFormat=t}setDateFormatShort(t){this.dateFormatShort=t}setLocale(t){this.locale=t}getDateString(t,e){return t.setLocale(this.locale).toFormat(this.dateFormat[e]||this.dateFormat.fallback)}getSmartDateString(t,s){switch(s){case e.DAY:return this.getFormatedDayDate(t);case e.MONTH:return this.getFormatedMonthDate(t);case e.QUARTER:return this.getFormatedQuarterDate(t);case e.WEEK:return this.getFormatedWeekDate(t);case e.HOUR:return this.getFormatedHourDate(t);case e.MINUTE:return this.getFormatedMinuteDate(t);case e.SECOND:return this.getFormatedSecondDate(t);case e.MILLISECOND:return this.getFormatedMilliSecondDate(t);default:return this.getDateString(t,s)}}calculateDistanceType(s,r,i=32){if(null==r)return e.DAY;const a="number"==typeof s?t.fromMillis(s):s,n="number"==typeof r?t.fromMillis(r):r;return 0===n.diff(a).as("milliseconds")?e.DAY:n.diff(a).as("milliseconds")<i?e.MILLISECOND:n.diff(a).as("seconds")<i?e.SECOND:n.diff(a).as("minutes")<i?e.MINUTE:n.diff(a).as("hours")<i?e.HOUR:n.diff(a).as("days")<i?e.DAY:n.diff(a).as("weeks")<i?e.WEEK:n.diff(a).as("months")<i?e.MONTH:n.diff(a).as("quarters")<i?e.QUARTER:e.YEAR}datesBetween(t,e,s,r){const i=this.convertDateDistanceToMomentunitOfTime(s),a=t.startOf(i),n=e.endOf(i);let h=n.diff(a).as(i);const u=[];h>=r&&(h=r);let
|
|
1
|
+
import{D as t}from"./luxon.js";var e,s;!function(t){t.YEAR="year",t.QUARTER="quarter",t.MONTH="month",t.WEEK="week",t.DAY="day",t.HOUR="hour",t.MINUTE="minute",t.SECOND="second",t.MILLISECOND="millisecond",t.NONE="fallback",t.AUTO="auto"}(e||(e={})),function(t){t.AVG="avg",t.INTERVAL="interval",t.START="start",t.END="end",t.YTD="ytd",t.YTG="ytg",t.CUM="cum",t.MAT="mat",t.NONE="none",t.AUTO="auto"}(s||(s={}));class r{constructor(){this._dateFormat={year:"yyyy",quarter:"q'Q' yyyy",month:"LLL yyyy",week:"'KW'WW yyyy",day:"dd.MM.yyyy",hour:"TT",minute:"TT",second:"TT",millisecond:"TT:SSS",fallback:"dd.MM.yyyy"},this._dateFormatShort={year:"yy",quarter:"q'Q'",month:"LLL",week:"'KW'WW",day:"dd",hour:"hh'h'",minute:"mm'm'",second:"ss's'",millisecond:"SSS'ms'",fallback:"dd.MM.yyyy"},this._dateLinkFormat={avg:"Ø[LINK]",interval:"[DATE]..[DATE2]",start:".[DATE]",end:"[DATE].",ytd:"_[DATE]",ytg:"[DATE]_",cum:"[DATE]_[DATE2]",mat:"~[DATE]",none:"[DATE]"},this.locale="de",this.dateFormatPinned=!1,this.dateFormatShortPinned=!1,this.dateFormat=this._dateFormat,this.dateLinkFormat=this._dateLinkFormat,this.dateFormatShort=this._dateFormatShort}setDateLinkFormat(t){this.dateLinkFormat=t}setDateFormat(t){this.dateFormat=t,this.dateFormatPinned=!0}setDateFormatShort(t){this.dateFormatShort=t,this.dateFormatShortPinned=!0}setLocale(t){this.locale=t,this.dateFormatPinned||(this.dateFormat=Object.assign(Object.assign({},this._dateFormat),r.LOCALE_DATE_FORMAT[t]||{})),this.dateFormatShortPinned||(this.dateFormatShort=Object.assign(Object.assign({},this._dateFormatShort),r.LOCALE_DATE_FORMAT_SHORT[t]||{}))}getDateString(t,e){return t.setLocale(this.locale).toFormat(this.dateFormat[e]||this.dateFormat.fallback)}getSmartDateString(t,s){switch(s){case e.DAY:return this.getFormatedDayDate(t);case e.MONTH:return this.getFormatedMonthDate(t);case e.QUARTER:return this.getFormatedQuarterDate(t);case e.WEEK:return this.getFormatedWeekDate(t);case e.HOUR:return this.getFormatedHourDate(t);case e.MINUTE:return this.getFormatedMinuteDate(t);case e.SECOND:return this.getFormatedSecondDate(t);case e.MILLISECOND:return this.getFormatedMilliSecondDate(t);default:return this.getDateString(t,s)}}calculateDistanceType(s,r,i=32){if(null==r)return e.DAY;const a="number"==typeof s?t.fromMillis(s):s,n="number"==typeof r?t.fromMillis(r):r;return 0===n.diff(a).as("milliseconds")?e.DAY:n.diff(a).as("milliseconds")<i?e.MILLISECOND:n.diff(a).as("seconds")<i?e.SECOND:n.diff(a).as("minutes")<i?e.MINUTE:n.diff(a).as("hours")<i?e.HOUR:n.diff(a).as("days")<i?e.DAY:n.diff(a).as("weeks")<i?e.WEEK:n.diff(a).as("months")<i?e.MONTH:n.diff(a).as("quarters")<i?e.QUARTER:e.YEAR}datesBetween(t,e,s,r){const i=this.convertDateDistanceToMomentunitOfTime(s),a=t.startOf(i),n=e.endOf(i);let h=n.diff(a).as(i);const u=[];h>=r&&(h=r);let c=a;do{u.push(c),c=c.plus(this.createDiratonLike(i,1))}while(c<=n&&u.length<h);return u}getDateLinkString(r,i,a,n,h){if(null==r&&null==i)return"";if(null==r&&a!==s.END&&a!==s.YTD)return"";if(null==i&&(s.INTERVAL===a||s.CUM===a||s.END===a||s.YTD===a))return"";const u=r||t.now(),c=i;n===e.AUTO&&(n=this.calculateDistanceType(u,c,h));let o=this.getDateString(u,n),y="",l=s.NONE;return null!=c&&(y=this.getDateString(c,n),l=s.INTERVAL,o===y&&a===s.INTERVAL&&(a=s.NONE),o===y&&a===s.AVG&&(l=s.NONE),s.END!==a&&s.YTD!==a||(o=y),(a===s.INTERVAL||a===s.CUM||s.AVG)&&(n===e.QUARTER?u.quarter===c.quarter&&u.year===c.year?y=y.replace(" "+c.year,""):u.year===c.year&&(o=o.replace(" "+u.year,"")):n===e.MONTH?u.month===c.month&&u.year===c.year?y=y.replace(" "+c.year,""):u.year===c.year&&(o=o.replace(" "+u.year,"")):n===e.WEEK&&(u.weekNumber===c.weekNumber&&u.year===c.year?y=y.replace(" "+c.year,""):u.year===c.year&&(o=o.replace(" "+u.year,""))))),this.dateLinkFormat[a].replace("[LINK]",this.dateLinkFormat[l]).replace("[DATE]",o).replace("[DATE2]",y)}getShortDateString(t,e){return t.setLocale(this.locale).toFormat(this.dateFormatShort[e]||this.dateFormatShort.fallback)}getFormatedDayDate(t){let e=this.dateFormatShort.day;return this.isFirstInMonth(t)&&(e+=" "+this.dateFormatShort.month),this.isJanuary(t)&&(e+=" "+this.dateFormatShort.year),t.setLocale(this.locale).toFormat(e)}getFormatedMonthDate(t){let e=this.dateFormatShort.month;return this.isJanuary(t)&&(e+=" "+this.dateFormatShort.year),t.setLocale(this.locale).toFormat(e)}getFormatedQuarterDate(t){let e=this.dateFormatShort.quarter;return this.isFirstQuarter(t)&&(e+=" "+this.dateFormatShort.year),t.setLocale(this.locale).toFormat(e)}getFormatedWeekDate(t){let e=this.dateFormatShort.week;return this.isFirstWeek(t)&&(e+=" "+this.dateFormatShort.year),t.setLocale(this.locale).toFormat(e)}getFormatedHourDate(t){let e=this.dateFormatShort.hour;return this.isFirstHour(t)&&(e+=" "+this.dateFormatShort.day),t.setLocale(this.locale).toFormat(e)}getFormatedMinuteDate(t){let e=this.dateFormatShort.minute;return this.isFirstMinute(t)&&(e=this.dateFormatShort.hour+":"+e),t.setLocale(this.locale).toFormat(e)}getFormatedSecondDate(t){let e=this.dateFormatShort.second;return this.isFirstSecond(t)&&(e=this.dateFormatShort.minute+":"+e),t.setLocale(this.locale).toFormat(e)}getFormatedMilliSecondDate(t){let e=this.dateFormatShort.millisecond;return this.isFirstMilliSecond(t)&&(e=this.dateFormatShort.second+":"+e),t.setLocale(this.locale).toFormat(e)}isFirstInMonth(t){return 1===t.day}isJanuary(t){return 1===t.month}isFirstQuarter(t){return 1===t.quarter}isFirstWeek(t){return 1===t.weekNumber}isFirstHour(t){return 0===t.hour}isFirstMinute(t){return 0===t.minute}isFirstSecond(t){return 0===t.second}isFirstMilliSecond(t){return 0===t.millisecond}convertDateDistanceToMomentunitOfTime(t){let s;switch(t){case e.YEAR:s="year";break;case e.MONTH:s="month";break;case e.QUARTER:s="quarter";break;case e.WEEK:s="week";break;case e.DAY:s="day";break;case e.HOUR:s="hour";break;case e.MINUTE:s="minute";break;case e.SECOND:s="second";break;case e.MILLISECOND:s="millisecond";break;default:s="day"}return s}createDiratonLike(t,e){switch(t){case"year":return{years:e};case"month":return{months:e};case"quarter":return{quarters:e};case"week":return{weeks:e};case"day":default:return{days:e};case"hour":return{hours:e};case"minute":return{minutes:e};case"second":return{seconds:e};case"millisecond":return{milliseconds:e}}}}r.LOCALE_DATE_FORMAT={en:{week:"'W'WW yyyy",day:"MM/dd/yyyy",fallback:"MM/dd/yyyy"}},r.LOCALE_DATE_FORMAT_SHORT={en:{week:"'W'WW",fallback:"MM/dd/yyyy"}};export{s as D,e as a,r as b}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{proxyCustomElement as t,HTMLElement as i,writeTask as e,forceUpdate as s,h as a,Host as r,transformTag as n}from"@stencil/core/internal/client";import{v as o,a as l,k as c,l as h,b as d,c as p,h as u,m as v,n as m,o as g,i as f}from"./validate.js";import{w as y,g as b,p as S}from"./withDataset.js";import{w,a as O}from"./withHasError.js";import{i as _,w as k,a as R}from"./withTranslation.js";import{w as x}from"./withScalingGroup.js";import{a as A}from"./context-protocol.js";import{w as T}from"./withStyled.js";import{w as N}from"./withComponentStyle.js";import{w as U}from"./withRuleSet.js";import{o as E}from"./layoutObserver.js";import{A as M,e as C,f as L,g as D}from"./CompareUtil.js";import{O as W,a as j}from"./Order.js";import{d as P}from"./ibcs-chart-structure2.js";const z=t(class extends i{validateScenario(t){const i="ERR_scenarios";if(_(t))return void this.errors.remove(i);const e=o(t);e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"scenarios: invalid value(s) '"+JSON.stringify(e)+"' are not supported."}):this.errors.remove(i)}validateVariances(t){const i="ERR_variances";if(_(t))return void this.errors.remove(i);const e=l(t);e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"variances: invalid value(s) '"+JSON.stringify(e)+"' are not supported."}):this.errors.remove(i)}validateUnitScaling(t){const i="ERR_unitScaling";"auto"===(null==t?void 0:(""+t).trim().toLowerCase())||c(t)||this.pixelPerUnitGroupMap.has(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"unitScaling: invalid value(s) '"+t+"' are not supported."})}validatePercentageScaling(t){const i="ERR_percentageScaling";"auto"===(null==t?void 0:(""+t).trim().toLowerCase())||c(t)||this.pixelPerUnitGroupMap.has(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"percentageScaling: invalid value(s) '"+t+"' are not supported."})}validateLevel(t){const i="ERR_level";h(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"level: invalid value(s) '"+t+"' are not supported."})}validateOrderList(t){const i="ERR_order";if(_(t))return void this.errors.remove(i);const e=d(t);e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"order: invalid value(s) '"+JSON.stringify(e)+"' are not supported."}):this.errors.remove(i)}validateOrderDirection(t){const i="ERR_orderDirection";_(t)||p(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"orderDirection: invalid value '"+(null==t?void 0:""+t)+"' is not supported."})}validateLimit(t){const i="ERR_limit";u(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"limit: invalid value '"+(null==t?void 0:""+t)+"' is not supported."})}validateShowCategories(t){const i="ERR_showCategories";v(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"showCategories: invalid value(s) '"+(null==t?void 0:""+t)+"' are not supported."})}validateMeasureScale(t){const i="ERR_measureScale";m(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"measureScale: invalid value '"+(null==t?void 0:""+t)+"' is not supported."})}validateShowMeasureScale(t){const i="ERR_grouped";v(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"showMeasureScale: invalid value(s) '"+(null==t?void 0:""+t)+"' are not supported."})}validateStack(t){const i="ERR_stack",e=g(t);e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:e.join("; ")}):this.errors.remove(i)}validateScaling(t){if(null==t||""===t||"none"===t||"auto"===t)return void this.errors.remove("ERR_scale");const i=Number(t);isNaN(i)||i<=0?this.errors.addOrReplace({id:"ERR_scale",type:"warning",message:`Invalid scale value: "${t}". Use "none", "auto", or a positive number.`}):this.errors.remove("ERR_scale")}constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.datasetName="",this.dataVersion=0,this.datasetMeta=null,this.appliedScaleFactor=1,this.layoutObserver=null,this._lastScaledParentHeight=0,this.chartTitle="",this.filter="",this.limit=0,this.showCategories="true",this.measureScale="greatest",this.showMeasureScale="false",this.measureUnit="",this.stack="",this.pixelPerUnitGroupMap=new Map,this._autoScaleGuard=!1,T(this),w(this),y(this,(t=>{this.datasetName=(null==t?void 0:t.startsWith("$"))?t.substring(1):t||"",this.dataVersion=this.dataVersion+1}),((t,i)=>{this.datasetMeta=i})),this.chartTemplate=this.chartTemplate.bind(this),this.errors=O(this),x(this),this.componentStyle=N(this),this.ruleSetConfig=U(this),this.t=k(this).t,this.resolveInherited=R(this,[{propName:"scenarios",ancestorAttr:"title-scenarios"},{propName:"variances",ancestorAttr:"title-variances"},{propName:"order",ancestorAttr:"title-order"},{propName:"orderDirection",ancestorAttr:"title-order-direction"}])}componentWillLoad(){this.validateScenario(this.scenarios),this.validateVariances(this.variances),this.validateUnitScaling(this.unitScaling),this.validateLevel(this.level),this.validateOrderDirection(this.orderDirection),this.validateOrderList(this.order),this.validateShowCategories(this.showCategories),this.validateMeasureScale(this.measureScale),this.validateShowMeasureScale(this.showMeasureScale),this.validateStack(this.stack),this.validateScaling(this.scale)}componentDidRender(){const{mode:t}=S(this.scale);if("auto"!==t&&"empty"!==t)return this._autoScaleGuard=!1,void this.checkWidthOverflow();if(this._autoScaleGuard)return this._autoScaleGuard=!1,void this.checkWidthOverflow();const i=this.element,{height:s}=b(i);if(s<=0)return void this.checkWidthOverflow();this._lastScaledParentHeight=s;const a=this.componentStyle((t=>{var i;return(null===(i=t.global)||void 0===i?void 0:i.fontSizePx)||13.3333})),r=i.scrollHeight,n=this.appliedScaleFactor;if(r<=s+1)return this.errors.remove("AUTO_scale"),void this.checkWidthOverflow();const o=Math.max(.3,n*(s-1)/r);Math.abs(o-n)<.01||(i.style.setProperty("--bn-font-size",a*o+"px"),"empty"===t?this.errors.addOrReplace({id:"AUTO_scale",type:"warning",message:"Auto-scaled chart by factor "+o.toFixed(3)}):this.errors.remove("AUTO_scale"),this._autoScaleGuard=!0,e((()=>{this.appliedScaleFactor=o}))),this.checkWidthOverflow()}componentDidLoad(){this.layoutObserver=E(this.element,(()=>{if(this._autoScaleGuard)return;const{height:t}=b(this.element);t>0&&Math.abs(t-this._lastScaledParentHeight)>2&&(this._lastScaledParentHeight=t,s(this))})),requestAnimationFrame((()=>{requestAnimationFrame((()=>{if(this._autoScaleGuard)return;const{height:t}=b(this.element);this._lastScaledParentHeight=t,s(this)}))}))}disconnectedCallback(){var t;null===(t=this.layoutObserver)||void 0===t||t.disconnect(),this.layoutObserver=null}checkWidthOverflow(){var t;const i="WARN_overflow",e=((null!==(t=this.unitScaling)&&void 0!==t?t:"")+"").trim().toLowerCase();if(""===e||"auto"===e)return void this.errors.remove(i);const s=b(this.element);s.width>0&&this.element.scrollWidth>s.width+1?this.errors.addOrReplace({id:i,type:"error",message:`Chart exceeds available width (${this.element.scrollWidth}px > ${Math.round(s.width)}px). Reduce unit-scaling or set to "auto".`}):this.errors.remove(i)}prepareDimension(){const t=b(this.element),i=this.prepareVariances();return this.canvasWidthSegmented=t.width/(1+i.length),{width:this.canvasWidthSegmented,height:t.height}}prepareScenarios(){var t,i,e,s;const a=this.resolveInherited("scenarios",this.scenarios);if(void 0!==a)return this.errors.remove("AUTO_scenarios"),a.split(",").map((t=>t.trim()));const r="auto"===(null===(t=this.scenarios)||void 0===t?void 0:t.trim().toLowerCase());return f(this.scenarios)||r?(null===(e=null===(i=this.datasetMeta)||void 0===i?void 0:i.availableScenarios)||void 0===e?void 0:e.length)>0?(r?this.errors.remove("AUTO_scenarios"):this.errors.addOrReplace({id:"AUTO_scenarios",type:"warning",message:"scenarios: not set, auto-detected: "+this.datasetMeta.availableScenarios.join(",")}),this.datasetMeta.availableScenarios):[]:(this.errors.remove("AUTO_scenarios"),null===(s=this.scenarios)||void 0===s?void 0:s.split(",").map((t=>t.trim())))}prepareVariances(){var t;const i=this.resolveInherited("variances",this.variances);return void 0!==i?i.split(",").map((t=>t.trim())):f(this.variances)?[]:null===(t=this.variances)||void 0===t?void 0:t.split(",").map((t=>t.trim()))}prepareHideCategories(t){return t>=1||"true"!==this.showCategories}prepareI18n(){const t=A,i=new Map([].map((t=>[t,this.t(".".concat(t))]))),e=new Map(t.map((t=>[t,this.t("global.".concat(t))])));return new Map([...e.entries(),...i.entries()])}preparePixelPerUnit(){var t;if(this.pixelPerUnitGroupMap.has(this.unitScaling))return this.errors.remove("AUTO_unitScaling"),this.pixelPerUnitGroupMap.get(this.unitScaling);if("auto"===(null===(t=this.unitScaling)||void 0===t?void 0:(""+t).trim().toLowerCase()))return this.errors.remove("AUTO_unitScaling"),0;const i=Number(this.unitScaling);return!isNaN(i)&&i>0?(this.errors.remove("AUTO_unitScaling"),i):(this.errors.addOrReplace({id:"AUTO_unitScaling",type:"warning",message:"unit-scaling: not set, auto-calculated to fit available space."}),0)}preparePixelPerPercentage(){var t;if(this.pixelPerUnitGroupMap.has(this.percentageScaling))return this.pixelPerUnitGroupMap.get(this.percentageScaling);if("auto"===(null===(t=this.percentageScaling)||void 0===t?void 0:(""+t).trim().toLowerCase()))return this.errors.remove("AUTO_percentageScaling"),0;const i=Number(this.percentageScaling);return!isNaN(i)&&i>0?(this.errors.remove("AUTO_percentageScaling"),100*i):(this.errors.addOrReplace({id:"AUTO_percentageScaling",type:"warning",message:"percentage-scaling: not set, auto-calculated to fit available space."}),0)}prepareLevel(){var t,i,e;const s="auto"===(null===(t=this.level)||void 0===t?void 0:t.trim().toLowerCase());return f(this.level)||s?(null===(i=this.datasetMeta)||void 0===i?void 0:i.suggestedLevel)?(s?this.errors.remove("AUTO_level"):this.errors.addOrReplace({id:"AUTO_level",type:"warning",message:"level: not set, auto-detected: "+this.datasetMeta.suggestedLevel}),M[this.datasetMeta.suggestedLevel.toUpperCase()]):void 0:(this.errors.remove("AUTO_level"),M[null===(e=this.level)||void 0===e?void 0:e.toUpperCase()])}prepareOrder(){var t;const i=this.resolveInherited("order",this.order),e=this.resolveInherited("orderDirection",this.orderDirection),s=null!=i?i:this.order,a=null!=e?e:this.orderDirection,r="auto"===(null==s?void 0:s.trim().toLowerCase());let n;return f(s)||r?(null===(t=this.datasetMeta)||void 0===t?void 0:t.suggestedOrder)?(r?this.errors.remove("AUTO_order"):this.errors.addOrReplace({id:"AUTO_order",type:"warning",message:"order: not set, auto-detected: "+this.datasetMeta.suggestedOrder}),n=this.datasetMeta.suggestedOrder):n=s:(this.errors.remove("AUTO_order"),n=s),{hierarchy:null==n?void 0:n.split(",").map((t=>j[null==t?void 0:t.toUpperCase()])),direction:W[null==a?void 0:a.toUpperCase()]}}prepareStyle(){const t=this.getEffectiveScaleFactor();return this.componentStyle((i=>{const e=i.global.fontSizePx*t;return{scaleFactors:{scenarioOffset:i["bn-chart-structure"].scaleFactors.scenarioOffset,scenarioLabelToBar:i["bn-chart-structure"].scaleFactors.scenarioLabelToBar,labelToBar:i["bn-chart-structure"].scaleFactors.labelToBar,labelToAxis:i["bn-chart-structure"].scaleFactors.labelToAxis,needleWidth:i["bn-chart-structure"].scaleFactors.needleWidth,needleHeadWidth:i["bn-chart-structure"].scaleFactors.needleHeadWidth,barWidth:i["bn-chart-structure"].scaleFactors.barWidth,varianceAxisLineWidth:i["bn-chart-structure"].scaleFactors.varianceAxisLineWidth,axisLineWidth:i["bn-chart-structure"].scaleFactors.axisLineWidth,auxiliaryLineWidth:i["bn-chart-structure"].scaleFactors.auxiliaryLineWidth,scenarioLineWidth:i["bn-chart-structure"].scaleFactors.scenarioLineWidth,markerWidth:i["bn-chart-structure"].scaleFactors.markerWidth,markerOffset:i["bn-chart-structure"].scaleFactors.markerOffset,categoryWidth:i["bn-chart-structure"].scaleFactors.categoryWidth,axisTickLength:i["bn-chart-structure"].scaleFactors.axisTickLength},fontStyles:{font:`${e}px ${i.global.fontFamily}`,size:e,color:i.global.fontColor,background:i.global.fontBackgroundColor,leading:1.8},axisStyles:i["bn-chart-structure"].axisStyles,barStyles:i["bn-chart-structure"].barStyles,varianceStyles:i["bn-chart-structure"].varianceStyles,padding:i["bn-chart-structure"].padding,pattern:null}}))}prepareChartTitle(t){return t>=1?"":this.chartTitle}prepareStackConfig(){if(f(this.stack))return this.errors.remove("WARN_stack_dimensions_scenarios"),null;try{const t=JSON.parse(this.stack),i=t.by,e="WARN_stack_dimensions_scenarios";if(i===C.DIMENSIONS){const t=this.prepareScenarios();t.length>1?this.errors.addOrReplace({id:e,type:"warning",message:`stack by dimensions: only the first scenario "${t[0]}" is used, the rest (${t.slice(1).join(", ")}) are discarded.`}):this.errors.remove(e)}else this.errors.remove(e);return{by:i,mode:t.mode||D.ABSOLUTE,order:t.order||L.DATASET}}catch(t){return this.errors.remove("WARN_stack_dimensions_scenarios"),null}}prepareFilter(){return 0===this.filter.length?"":this.filter}prepareLimit(){return Math.floor(Number(this.limit)||0)}getDataStructure(){return{IStructureChartDataRow:{operation:{type:"string",isOptional:!1,description:""},rowGroup:{type:"string",isOptional:!1,description:""},rowGroupIndex:{type:"number",isOptional:!1,description:""},category:{type:"string",isOptional:!1,description:""},categoryIndex:{type:"number",isOptional:!1,description:""},subCategory:{type:"string",isOptional:!1,description:""},subCategoryIndex:{type:"number",isOptional:!1,description:""},columnGroup:{type:"string",isOptional:!1,description:""},columnGroupIndex:{type:"number",isOptional:!1,description:""},columnSubGroup:{type:"string",isOptional:!1,description:""},columnSubGroupIndex:{type:"number",isOptional:!1,description:""},ac1:{type:"number",isOptional:!1,description:""},ac2:{type:"number",isOptional:!1,description:""},ac3:{type:"number",isOptional:!1,description:""},ac4:{type:"number",isOptional:!1,description:""},pp1:{type:"number",isOptional:!1,description:""},pp2:{type:"number",isOptional:!1,description:""},pp3:{type:"number",isOptional:!1,description:""},pp4:{type:"number",isOptional:!1,description:""},fc1:{type:"number",isOptional:!1,description:""},fc2:{type:"number",isOptional:!1,description:""},fc3:{type:"number",isOptional:!1,description:""},fc4:{type:"number",isOptional:!1,description:""},pl1:{type:"number",isOptional:!1,description:""},pl2:{type:"number",isOptional:!1,description:""},pl3:{type:"number",isOptional:!1,description:""},pl4:{type:"number",isOptional:!1,description:""}}}}prepareMeasureScale(){return f(this.measureScale)?"GREATEST":["_","k","M","G","T","P","E","Z","Y","m","μ","n","p","P","f","a","z","y"].includes(this.measureScale.trim())||"LEAST"===this.measureScale.trim().toUpperCase()?this.measureScale.trim():"GREATEST"}prepareShowMeasureScale(t){return 0===t&&"true"===this.showMeasureScale}prepareMeasureUnit(){return""===this.measureUnit||null==this.measureUnit?"":this.measureUnit}chartTemplate(t,i){const e=this.getEffectiveScaleFactor(),s=this.preparePixelPerUnit(),r=this.preparePixelPerPercentage(),n=this.prepareStackConfig(),o=this.prepareScenarios(),l=(null==n?void 0:n.by)===C.DIMENSIONS?o.slice(0,1):o;return a("ibcs-chart-structure",{tableName:this.datasetName,dataVersion:this.dataVersion,chartTitle:this.prepareChartTitle(i),scenarios:l,variances:[t],hideCategories:this.prepareHideCategories(i),pixelPerUnit:s>0?s*e:0,pixelPerPercentage:r>0?r*e:0,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(i),stackConfig:n,parentDimensions:this.prepareDimension(),ruleSetConfig:this.ruleSetConfig()})}getEffectiveScaleFactor(){const{mode:t,factor:i}=S(this.scale);return"factor"===t?i:"auto"===t||"empty"===t?this.appliedScaleFactor:1}getFontStyles(){const t=this.getEffectiveScaleFactor();return this.componentStyle((i=>{var e,s,a,r;const n=(null===(e=i.global)||void 0===e?void 0:e.fontSizePx)||13.3333;return{"--bn-font-family":(null===(s=i.global)||void 0===s?void 0:s.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":n*t+"px","--bn-font-color":(null===(a=i.global)||void 0===a?void 0:a.fontColor)||"#000000","--bn-font-background":(null===(r=i.global)||void 0===r?void 0:r.fontBackgroundColor)||"#ffffff"}}))}render(){let t=[""];const i=this.prepareVariances();i.length>0&&(t=[...t,...i]);const e=this.getFontStyles();return a(r,{key:"dd704d2ab46ee7a34213eab0188671e3df4ca592",style:e},a("div",{key:"71c53b1dbd77e68a46e63fdf252cd11efb6a79a6",class:"container"},t.map(this.chartTemplate)))}get element(){return this}static get watchers(){return{scenarios:[{validateScenario:0}],variances:[{validateVariances:0}],unitScaling:[{validateUnitScaling:0}],percentageScaling:[{validatePercentageScaling:0}],level:[{validateLevel:0}],order:[{validateOrderList:0}],orderDirection:[{validateOrderDirection:0}],limit:[{validateLimit:0}],showCategories:[{validateShowCategories:0}],measureScale:[{validateMeasureScale:0}],showMeasureScale:[{validateShowMeasureScale:0}],stack:[{validateStack:0}],scale:[{validateScaling:0}]}}static get style(){return':host{display:inline-block;position:relative;overflow:hidden}.container{display:flex;flex-direction:row}.background-image{display:flex;flex-wrap:wrap;justify-content:flex-end}.categories{text-align:right;font-size:var(--bn-font-size, 1em);font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);color:var(--bn-font-color, black)}.label-bg{fill:var(--bn-font-background, white);opacity:0.7}.label-text{text-align:right;font-size:var(--bn-font-size, 1em);font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);color:var(--bn-font-color, black)}.axis-title{text-align:center;font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);color:var(--bn-font-color, black)}.axis-ac{stroke:black;stroke-width:0.1em}.axis-pp{stroke:grey;stroke-width:0.1em}.axis-fc{stroke:black;stroke-dasharray:2;stroke-width:0.1em}.axis-pl{stroke:white;stroke-width:0.1em;outline-offset:0em;outline:0.1em solid black}canvas{image-rendering:-moz-crisp-edges;image-rendering:-webkit-crisp-edges;image-rendering:pixelated;image-rendering:crisp-edges}.measure{font-weight:bold}span{display:inline-block}.hidePatternContainer{height:0;width:0}div{float:left}.warning{font-size:0.8em;font-style:italic}.footer{margin:0.2em;font-size:0.6em}.footer-hide{margin:0.2em;font-size:0.6em;opacity:0}'}},[1,"bn-chart-structure",{chartTitle:[1,"chart-title"],ruleset:[513],filter:[1],scenarios:[1],variances:[1],unitScaling:[8,"unit-scaling"],percentageScaling:[8,"percentage-scaling"],level:[1],order:[1],orderDirection:[1,"order-direction"],limit:[2],showCategories:[1,"show-categories"],measureScale:[1,"measure-scale"],showMeasureScale:[1,"show-measure-scale"],measureUnit:[1,"measure-unit"],stack:[1],scale:[1],datasetName:[32],dataVersion:[32],datasetMeta:[32],appliedScaleFactor:[32]},void 0,{scenarios:[{validateScenario:0}],variances:[{validateVariances:0}],unitScaling:[{validateUnitScaling:0}],percentageScaling:[{validatePercentageScaling:0}],level:[{validateLevel:0}],order:[{validateOrderList:0}],orderDirection:[{validateOrderDirection:0}],limit:[{validateLimit:0}],showCategories:[{validateShowCategories:0}],measureScale:[{validateMeasureScale:0}],showMeasureScale:[{validateShowMeasureScale:0}],stack:[{validateStack:0}],scale:[{validateScaling:0}]}]),G=z,H=function(){"undefined"!=typeof customElements&&["bn-chart-structure","ibcs-chart-structure"].forEach((t=>{switch(t){case"bn-chart-structure":customElements.get(n(t))||customElements.define(n(t),z);break;case"ibcs-chart-structure":customElements.get(n(t))||P()}}))};export{G as BnChartStructure,H as defineCustomElement}
|
|
1
|
+
import{proxyCustomElement as t,HTMLElement as i,writeTask as e,forceUpdate as s,h as a,Host as r,transformTag as n}from"@stencil/core/internal/client";import{v as o,a as l,k as c,l as h,b as d,c as p,h as u,m as v,n as m,o as g,i as f}from"./validate.js";import{w as y,g as S,p as b}from"./withDataset.js";import{w,a as O}from"./withHasError.js";import{i as _,w as k,a as R}from"./withTranslation.js";import{w as x}from"./withScalingGroup.js";import{a as A}from"./context-protocol.js";import{w as T}from"./withStyled.js";import{w as N}from"./withComponentStyle.js";import{w as U}from"./withRuleSet.js";import{o as E}from"./layoutObserver.js";import{A as M,e as C,f as L,g as D}from"./CompareUtil.js";import{O as W,a as j}from"./Order.js";import{d as P}from"./ibcs-chart-structure2.js";const z=t(class extends i{validateScenario(t){const i="ERR_scenarios";if(_(t))return void this.errors.remove(i);const e=o(t);e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"scenarios: invalid value(s) '"+JSON.stringify(e)+"' are not supported."}):this.errors.remove(i)}validateVariances(t){const i="ERR_variances";if(_(t))return void this.errors.remove(i);const e=l(t);e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"variances: invalid value(s) '"+JSON.stringify(e)+"' are not supported."}):this.errors.remove(i)}validateUnitScaling(t){const i="ERR_unitScaling";"auto"===(null==t?void 0:(""+t).trim().toLowerCase())||c(t)||this.pixelPerUnitGroupMap.has(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"unitScaling: invalid value(s) '"+t+"' are not supported."})}validatePercentageScaling(t){const i="ERR_percentageScaling";"auto"===(null==t?void 0:(""+t).trim().toLowerCase())||c(t)||this.pixelPerUnitGroupMap.has(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"percentageScaling: invalid value(s) '"+t+"' are not supported."})}validateLevel(t){const i="ERR_level";h(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"level: invalid value(s) '"+t+"' are not supported."})}validateOrderList(t){const i="ERR_order";if(_(t))return void this.errors.remove(i);const e=d(t);e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"order: invalid value(s) '"+JSON.stringify(e)+"' are not supported."}):this.errors.remove(i)}validateOrderDirection(t){const i="ERR_orderDirection";_(t)||p(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"orderDirection: invalid value '"+(null==t?void 0:""+t)+"' is not supported."})}validateLimit(t){const i="ERR_limit";u(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"limit: invalid value '"+(null==t?void 0:""+t)+"' is not supported."})}validateShowCategories(t){const i="ERR_showCategories";v(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"showCategories: invalid value(s) '"+(null==t?void 0:""+t)+"' are not supported."})}validateMeasureScale(t){const i="ERR_measureScale";m(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"measureScale: invalid value '"+(null==t?void 0:""+t)+"' is not supported."})}validateShowMeasureScale(t){const i="ERR_grouped";v(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"showMeasureScale: invalid value(s) '"+(null==t?void 0:""+t)+"' are not supported."})}validateStack(t){const i="ERR_stack",e=g(t);e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:e.join("; ")}):this.errors.remove(i)}validateScaling(t){if(null==t||""===t||"none"===t||"auto"===t)return void this.errors.remove("ERR_scale");const i=Number(t);isNaN(i)||i<=0?this.errors.addOrReplace({id:"ERR_scale",type:"warning",message:`Invalid scale value: "${t}". Use "none", "auto", or a positive number.`}):this.errors.remove("ERR_scale")}constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.datasetName="",this.dataVersion=0,this.datasetMeta=null,this.appliedScaleFactor=1,this.layoutObserver=null,this._lastScaledParentHeight=0,this.chartTitle="",this.filter="",this.limit=0,this.showCategories="true",this.measureScale="greatest",this.showMeasureScale="false",this.measureUnit="",this.stack="",this.pixelPerUnitGroupMap=new Map,this._autoScaleGuard=!1,T(this),w(this),y(this,(t=>{this.datasetName=(null==t?void 0:t.startsWith("$"))?t.substring(1):t||"",this.dataVersion=this.dataVersion+1}),((t,i)=>{this.datasetMeta=i})),this.chartTemplate=this.chartTemplate.bind(this),this.errors=O(this),x(this),this.componentStyle=N(this),this.ruleSetConfig=U(this),this.t=k(this).t,this.resolveInherited=R(this,[{propName:"scenarios",ancestorAttr:"title-scenarios"},{propName:"variances",ancestorAttr:"title-variances"},{propName:"order",ancestorAttr:"title-order"},{propName:"orderDirection",ancestorAttr:"title-order-direction"}])}componentWillLoad(){this.validateScenario(this.scenarios),this.validateVariances(this.variances),this.validateUnitScaling(this.unitScaling),this.validateLevel(this.level),this.validateOrderDirection(this.orderDirection),this.validateOrderList(this.order),this.validateShowCategories(this.showCategories),this.validateMeasureScale(this.measureScale),this.validateShowMeasureScale(this.showMeasureScale),this.validateStack(this.stack),this.validateScaling(this.scale)}componentDidRender(){const{mode:t}=b(this.scale);if("auto"!==t&&"empty"!==t)return this._autoScaleGuard=!1,void this.checkWidthOverflow();if(this._autoScaleGuard)return this._autoScaleGuard=!1,void this.checkWidthOverflow();const i=this.element,{height:s}=S(i);if(s<=0)return void this.checkWidthOverflow();this._lastScaledParentHeight=s;const a=this.componentStyle((t=>{var i;return(null===(i=t.global)||void 0===i?void 0:i.fontSizePx)||13.3333})),r=i.scrollHeight,n=this.appliedScaleFactor;if(r<=s+1)return this.errors.remove("AUTO_scale"),void this.checkWidthOverflow();const o=Math.max(.3,n*(s-1)/r);Math.abs(o-n)<.01||(i.style.setProperty("--bn-font-size",a*o+"px"),"empty"===t?this.errors.addOrReplace({id:"AUTO_scale",type:"warning",message:"Auto-scaled chart by factor "+o.toFixed(3)}):this.errors.remove("AUTO_scale"),this._autoScaleGuard=!0,e((()=>{this.appliedScaleFactor=o}))),this.checkWidthOverflow()}componentDidLoad(){this.layoutObserver=E(this.element,(()=>{if(this._autoScaleGuard)return;const{height:t}=S(this.element);t>0&&Math.abs(t-this._lastScaledParentHeight)>2&&(this._lastScaledParentHeight=t,s(this))})),requestAnimationFrame((()=>{requestAnimationFrame((()=>{if(this._autoScaleGuard)return;const{height:t}=S(this.element);this._lastScaledParentHeight=t,s(this)}))}))}disconnectedCallback(){var t;null===(t=this.layoutObserver)||void 0===t||t.disconnect(),this.layoutObserver=null}checkWidthOverflow(){var t;const i="WARN_overflow",e=((null!==(t=this.unitScaling)&&void 0!==t?t:"")+"").trim().toLowerCase();if(""===e||"auto"===e)return void this.errors.remove(i);const s=S(this.element);s.width>0&&this.element.scrollWidth>s.width+1?this.errors.addOrReplace({id:i,type:"error",message:`Chart exceeds available width (${this.element.scrollWidth}px > ${Math.round(s.width)}px). Reduce unit-scaling or set to "auto".`}):this.errors.remove(i)}prepareDimension(){const t=S(this.element),i=this.prepareVariances();return this.canvasWidthSegmented=t.width/(1+i.length),{width:this.canvasWidthSegmented,height:t.height}}prepareScenarios(){var t,i,e,s;const a=this.resolveInherited("scenarios",this.scenarios);if(void 0!==a)return this.errors.remove("AUTO_scenarios"),a.split(",").map((t=>t.trim()));const r="auto"===(null===(t=this.scenarios)||void 0===t?void 0:t.trim().toLowerCase());return f(this.scenarios)||r?(null===(e=null===(i=this.datasetMeta)||void 0===i?void 0:i.availableScenarios)||void 0===e?void 0:e.length)>0?(r?this.errors.remove("AUTO_scenarios"):this.errors.addOrReplace({id:"AUTO_scenarios",type:"warning",message:"scenarios: not set, auto-detected: "+this.datasetMeta.availableScenarios.join(",")}),this.datasetMeta.availableScenarios):[]:(this.errors.remove("AUTO_scenarios"),null===(s=this.scenarios)||void 0===s?void 0:s.split(",").map((t=>t.trim())))}prepareVariances(){var t;const i=this.resolveInherited("variances",this.variances);return void 0!==i?i.split(",").map((t=>t.trim())):f(this.variances)?[]:null===(t=this.variances)||void 0===t?void 0:t.split(",").map((t=>t.trim()))}prepareHideCategories(t){return t>=1||"true"!==this.showCategories}prepareI18n(){const t=A,i=new Map(["no-data","REST"].map((t=>[t,this.t(".".concat(t))]))),e=new Map(t.map((t=>[t,this.t("global.".concat(t))])));return new Map([...e.entries(),...i.entries()])}preparePixelPerUnit(){var t;if(this.pixelPerUnitGroupMap.has(this.unitScaling))return this.errors.remove("AUTO_unitScaling"),this.pixelPerUnitGroupMap.get(this.unitScaling);if("auto"===(null===(t=this.unitScaling)||void 0===t?void 0:(""+t).trim().toLowerCase()))return this.errors.remove("AUTO_unitScaling"),0;const i=Number(this.unitScaling);return!isNaN(i)&&i>0?(this.errors.remove("AUTO_unitScaling"),i):(this.errors.addOrReplace({id:"AUTO_unitScaling",type:"warning",message:"unit-scaling: not set, auto-calculated to fit available space."}),0)}preparePixelPerPercentage(){var t;if(this.pixelPerUnitGroupMap.has(this.percentageScaling))return this.pixelPerUnitGroupMap.get(this.percentageScaling);if("auto"===(null===(t=this.percentageScaling)||void 0===t?void 0:(""+t).trim().toLowerCase()))return this.errors.remove("AUTO_percentageScaling"),0;const i=Number(this.percentageScaling);return!isNaN(i)&&i>0?(this.errors.remove("AUTO_percentageScaling"),100*i):(this.errors.addOrReplace({id:"AUTO_percentageScaling",type:"warning",message:"percentage-scaling: not set, auto-calculated to fit available space."}),0)}prepareLevel(){var t,i,e;const s="auto"===(null===(t=this.level)||void 0===t?void 0:t.trim().toLowerCase());return f(this.level)||s?(null===(i=this.datasetMeta)||void 0===i?void 0:i.suggestedLevel)?(s?this.errors.remove("AUTO_level"):this.errors.addOrReplace({id:"AUTO_level",type:"warning",message:"level: not set, auto-detected: "+this.datasetMeta.suggestedLevel}),M[this.datasetMeta.suggestedLevel.toUpperCase()]):void 0:(this.errors.remove("AUTO_level"),M[null===(e=this.level)||void 0===e?void 0:e.toUpperCase()])}prepareOrder(){var t;const i=this.resolveInherited("order",this.order),e=this.resolveInherited("orderDirection",this.orderDirection),s=null!=i?i:this.order,a=null!=e?e:this.orderDirection,r="auto"===(null==s?void 0:s.trim().toLowerCase());let n;return f(s)||r?(null===(t=this.datasetMeta)||void 0===t?void 0:t.suggestedOrder)?(r?this.errors.remove("AUTO_order"):this.errors.addOrReplace({id:"AUTO_order",type:"warning",message:"order: not set, auto-detected: "+this.datasetMeta.suggestedOrder}),n=this.datasetMeta.suggestedOrder):n=s:(this.errors.remove("AUTO_order"),n=s),{hierarchy:null==n?void 0:n.split(",").map((t=>j[null==t?void 0:t.toUpperCase()])),direction:W[null==a?void 0:a.toUpperCase()]}}prepareStyle(){const t=this.getEffectiveScaleFactor();return this.componentStyle((i=>{const e=i.global.fontSizePx*t;return{scaleFactors:{scenarioOffset:i["bn-chart-structure"].scaleFactors.scenarioOffset,scenarioLabelToBar:i["bn-chart-structure"].scaleFactors.scenarioLabelToBar,labelToBar:i["bn-chart-structure"].scaleFactors.labelToBar,labelToAxis:i["bn-chart-structure"].scaleFactors.labelToAxis,needleWidth:i["bn-chart-structure"].scaleFactors.needleWidth,needleHeadWidth:i["bn-chart-structure"].scaleFactors.needleHeadWidth,barWidth:i["bn-chart-structure"].scaleFactors.barWidth,varianceAxisLineWidth:i["bn-chart-structure"].scaleFactors.varianceAxisLineWidth,axisLineWidth:i["bn-chart-structure"].scaleFactors.axisLineWidth,auxiliaryLineWidth:i["bn-chart-structure"].scaleFactors.auxiliaryLineWidth,scenarioLineWidth:i["bn-chart-structure"].scaleFactors.scenarioLineWidth,markerWidth:i["bn-chart-structure"].scaleFactors.markerWidth,markerOffset:i["bn-chart-structure"].scaleFactors.markerOffset,categoryWidth:i["bn-chart-structure"].scaleFactors.categoryWidth,axisTickLength:i["bn-chart-structure"].scaleFactors.axisTickLength},fontStyles:{font:`${e}px ${i.global.fontFamily}`,size:e,color:i.global.fontColor,background:i.global.fontBackgroundColor,leading:1.8},axisStyles:i["bn-chart-structure"].axisStyles,barStyles:i["bn-chart-structure"].barStyles,varianceStyles:i["bn-chart-structure"].varianceStyles,padding:i["bn-chart-structure"].padding,pattern:null}}))}prepareChartTitle(t){return t>=1?"":this.chartTitle}prepareStackConfig(){if(f(this.stack))return this.errors.remove("WARN_stack_dimensions_scenarios"),null;try{const t=JSON.parse(this.stack),i=t.by,e="WARN_stack_dimensions_scenarios";if(i===C.DIMENSIONS){const t=this.prepareScenarios();t.length>1?this.errors.addOrReplace({id:e,type:"warning",message:`stack by dimensions: only the first scenario "${t[0]}" is used, the rest (${t.slice(1).join(", ")}) are discarded.`}):this.errors.remove(e)}else this.errors.remove(e);return{by:i,mode:t.mode||D.ABSOLUTE,order:t.order||L.DATASET}}catch(t){return this.errors.remove("WARN_stack_dimensions_scenarios"),null}}prepareFilter(){return 0===this.filter.length?"":this.filter}prepareLimit(){return Math.floor(Number(this.limit)||0)}getDataStructure(){return{IStructureChartDataRow:{operation:{type:"string",isOptional:!1,description:""},rowGroup:{type:"string",isOptional:!1,description:""},rowGroupIndex:{type:"number",isOptional:!1,description:""},category:{type:"string",isOptional:!1,description:""},categoryIndex:{type:"number",isOptional:!1,description:""},subCategory:{type:"string",isOptional:!1,description:""},subCategoryIndex:{type:"number",isOptional:!1,description:""},columnGroup:{type:"string",isOptional:!1,description:""},columnGroupIndex:{type:"number",isOptional:!1,description:""},columnSubGroup:{type:"string",isOptional:!1,description:""},columnSubGroupIndex:{type:"number",isOptional:!1,description:""},ac1:{type:"number",isOptional:!1,description:""},ac2:{type:"number",isOptional:!1,description:""},ac3:{type:"number",isOptional:!1,description:""},ac4:{type:"number",isOptional:!1,description:""},pp1:{type:"number",isOptional:!1,description:""},pp2:{type:"number",isOptional:!1,description:""},pp3:{type:"number",isOptional:!1,description:""},pp4:{type:"number",isOptional:!1,description:""},fc1:{type:"number",isOptional:!1,description:""},fc2:{type:"number",isOptional:!1,description:""},fc3:{type:"number",isOptional:!1,description:""},fc4:{type:"number",isOptional:!1,description:""},pl1:{type:"number",isOptional:!1,description:""},pl2:{type:"number",isOptional:!1,description:""},pl3:{type:"number",isOptional:!1,description:""},pl4:{type:"number",isOptional:!1,description:""}}}}prepareMeasureScale(){return f(this.measureScale)?"GREATEST":["_","k","M","G","T","P","E","Z","Y","m","μ","n","p","P","f","a","z","y"].includes(this.measureScale.trim())||"LEAST"===this.measureScale.trim().toUpperCase()?this.measureScale.trim():"GREATEST"}prepareShowMeasureScale(t){return 0===t&&"true"===this.showMeasureScale}prepareMeasureUnit(){return""===this.measureUnit||null==this.measureUnit?"":this.measureUnit}chartTemplate(t,i){const e=this.getEffectiveScaleFactor(),s=this.preparePixelPerUnit(),r=this.preparePixelPerPercentage(),n=this.prepareStackConfig(),o=this.prepareScenarios(),l=(null==n?void 0:n.by)===C.DIMENSIONS?o.slice(0,1):o;return a("ibcs-chart-structure",{tableName:this.datasetName,dataVersion:this.dataVersion,chartTitle:this.prepareChartTitle(i),scenarios:l,variances:[t],hideCategories:this.prepareHideCategories(i),pixelPerUnit:s>0?s*e:0,pixelPerPercentage:r>0?r*e:0,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(i),stackConfig:n,parentDimensions:this.prepareDimension(),ruleSetConfig:this.ruleSetConfig()})}getEffectiveScaleFactor(){const{mode:t,factor:i}=b(this.scale);return"factor"===t?i:"auto"===t||"empty"===t?this.appliedScaleFactor:1}getFontStyles(){const t=this.getEffectiveScaleFactor();return this.componentStyle((i=>{var e,s,a,r;const n=(null===(e=i.global)||void 0===e?void 0:e.fontSizePx)||13.3333;return{"--bn-font-family":(null===(s=i.global)||void 0===s?void 0:s.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":n*t+"px","--bn-font-color":(null===(a=i.global)||void 0===a?void 0:a.fontColor)||"#000000","--bn-font-background":(null===(r=i.global)||void 0===r?void 0:r.fontBackgroundColor)||"#ffffff"}}))}render(){let t=[""];const i=this.prepareVariances();i.length>0&&(t=[...t,...i]);const e=this.getFontStyles();return a(r,{key:"472aabc33cfbf293c44cd93537e91c42cdc9e0d7",style:e},a("div",{key:"d48365a9ef3a48df6cd42807f7375414dd6714ef",class:"container"},t.map(this.chartTemplate)))}get element(){return this}static get watchers(){return{scenarios:[{validateScenario:0}],variances:[{validateVariances:0}],unitScaling:[{validateUnitScaling:0}],percentageScaling:[{validatePercentageScaling:0}],level:[{validateLevel:0}],order:[{validateOrderList:0}],orderDirection:[{validateOrderDirection:0}],limit:[{validateLimit:0}],showCategories:[{validateShowCategories:0}],measureScale:[{validateMeasureScale:0}],showMeasureScale:[{validateShowMeasureScale:0}],stack:[{validateStack:0}],scale:[{validateScaling:0}]}}static get style(){return':host{display:inline-block;position:relative;overflow:hidden}.container{display:flex;flex-direction:row}.background-image{display:flex;flex-wrap:wrap;justify-content:flex-end}.categories{text-align:right;font-size:var(--bn-font-size, 1em);font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);color:var(--bn-font-color, black)}.label-bg{fill:var(--bn-font-background, white);opacity:0.7}.label-text{text-align:right;font-size:var(--bn-font-size, 1em);font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);color:var(--bn-font-color, black)}.axis-title{text-align:center;font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);color:var(--bn-font-color, black)}.axis-ac{stroke:black;stroke-width:0.1em}.axis-pp{stroke:grey;stroke-width:0.1em}.axis-fc{stroke:black;stroke-dasharray:2;stroke-width:0.1em}.axis-pl{stroke:white;stroke-width:0.1em;outline-offset:0em;outline:0.1em solid black}canvas{image-rendering:-moz-crisp-edges;image-rendering:-webkit-crisp-edges;image-rendering:pixelated;image-rendering:crisp-edges}.measure{font-weight:bold}span{display:inline-block}.hidePatternContainer{height:0;width:0}div{float:left}.warning{font-size:0.8em;font-style:italic}.footer{margin:0.2em;font-size:0.6em}.footer-hide{margin:0.2em;font-size:0.6em;opacity:0}'}},[1,"bn-chart-structure",{chartTitle:[1,"chart-title"],ruleset:[513],filter:[1],scenarios:[1],variances:[1],unitScaling:[8,"unit-scaling"],percentageScaling:[8,"percentage-scaling"],level:[1],order:[1],orderDirection:[1,"order-direction"],limit:[2],showCategories:[1,"show-categories"],measureScale:[1,"measure-scale"],showMeasureScale:[1,"show-measure-scale"],measureUnit:[1,"measure-unit"],stack:[1],scale:[1],datasetName:[32],dataVersion:[32],datasetMeta:[32],appliedScaleFactor:[32]},void 0,{scenarios:[{validateScenario:0}],variances:[{validateVariances:0}],unitScaling:[{validateUnitScaling:0}],percentageScaling:[{validatePercentageScaling:0}],level:[{validateLevel:0}],order:[{validateOrderList:0}],orderDirection:[{validateOrderDirection:0}],limit:[{validateLimit:0}],showCategories:[{validateShowCategories:0}],measureScale:[{validateMeasureScale:0}],showMeasureScale:[{validateShowMeasureScale:0}],stack:[{validateStack:0}],scale:[{validateScaling:0}]}]),G=z,H=function(){"undefined"!=typeof customElements&&["bn-chart-structure","ibcs-chart-structure"].forEach((t=>{switch(t){case"bn-chart-structure":customElements.get(n(t))||customElements.define(n(t),z);break;case"ibcs-chart-structure":customElements.get(n(t))||P()}}))};export{G as BnChartStructure,H as defineCustomElement}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{proxyCustomElement as t,HTMLElement as i,writeTask as e,forceUpdate as s,h as a,Host as r,transformTag as n}from"@stencil/core/internal/client";import{v as o,a as l,k as h,h as d,l as c,b as u,c as p,f as v,o as m,p as g,m as y,n as f,i as S}from"./validate.js";import{w,g as b,p as O}from"./withDataset.js";import{w as M,a as _}from"./withHasError.js";import{i as x,w as R,a as A}from"./withTranslation.js";import{w as L}from"./withScalingGroup.js";import{a as T}from"./context-protocol.js";import{w as E}from"./withStyled.js";import{w as U}from"./withComponentStyle.js";import{w as C}from"./withRuleSet.js";import{o as k}from"./layoutObserver.js";import{O as I,a as N}from"./Order.js";import{F as W}from"./formatter.js";import{b as D,e as F,f as j,g as P,h as G}from"./CompareUtil.js";import{a as B}from"./DateStringFactory.js";import{d as V}from"./ibcs-chart-time2.js";var $;!function(t){t.ROWGROUP="rowGroup",t.ROWGROUPINDEX="rowGroupIndex",t.CATEGORY="category",t.CATEGORYINDEX="categoryIndex",t.SUBCATEGORY="subCategory",t.SUBCATEGORYINDEX="subCategoryIndex"}($||($={}));const z=t(class extends i{validateScenario(t){const i="ERR_scenarios";if(x(t))return void this.errors.remove(i);const e=o(t);e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"scenarios: invalid value(s) '"+JSON.stringify(e)+"' are not supported."}):this.errors.remove(i)}validateVariances(t){const i="ERR_variances";if(x(t))return void this.errors.remove(i);const e=l(t);e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"variances: invalid value(s) '"+JSON.stringify(e)+"' are not supported."}):this.errors.remove(i)}validateLeftSync(t){const i="ERR_syncSpaceLeft";h(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"syncSpaceLeft: invalid value(s) '"+t+"' are not supported."})}validateLimit(t){const i="ERR_limit";d(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"limit: invalid value '"+(null==t?void 0:""+t)+"' is not supported."})}validateUnitScaling(t){const i="ERR_unitScaling";"auto"===(null==t?void 0:(""+t).trim().toLowerCase())||h(t)||this.pixelPerUnitGroupMap.has(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"unitScaling: invalid value(s) '"+t+"' are not supported."})}validatePercentageScaling(t){const i="ERR_percentageScaling";"auto"===(null==t?void 0:(""+t).trim().toLowerCase())||h(t)||this.pixelPerUnitGroupMap.has(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"percentageScaling: invalid value(s) '"+t+"' are not supported."})}validateLevel(t){const i="ERR_level";c(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"level: invalid value(s) '"+t+"' are not supported."})}validateOrderList(t){const i="ERR_order";if(x(t))return void this.errors.remove(i);const e=u(t);e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"order: invalid value(s) '"+JSON.stringify(e)+"' are not supported."}):this.errors.remove(i)}validateOrderDirection(t){const i="ERR_orderDirection";x(t)||p(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"orderDirection: invalid value '"+(null==t?void 0:""+t)+"' is not supported."})}validateDateInterval(t){const i="ERR_dateInterval";v(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"dateInterval: invalid value '"+(null==t?void 0:""+t)+"' is not supported."})}validateChartMode(t){const i="ERR_chartMode";["bar","line","auto"].includes(null==t?void 0:t.toLowerCase())?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"chartMode: invalid value '"+(null==t?void 0:""+t)+"' is not supported. Valid values are: bar, line, auto."})}validateMaxBars(t){const i="ERR_maxBars";!d(t)||t<1?this.errors.addOrReplace({id:i,type:"warning",message:"maxBars: invalid value '"+(null==t?void 0:""+t)+"' is not supported. Must be a positive integer."}):this.errors.remove(i)}validateStack(t){const i="ERR_stack",e=m(t);e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:e.join("; ")}):this.errors.remove(i)}validateScaling(t){if(null==t||""===t||"none"===t||"auto"===t)return void this.errors.remove("ERR_scale");const i=Number(t);isNaN(i)||i<=0?this.errors.addOrReplace({id:"ERR_scale",type:"warning",message:`Invalid scale value: "${t}". Use "none", "auto", or a positive number.`}):this.errors.remove("ERR_scale")}validateAxisLabelsMode(t){const i="ERR_axisLabelsMode";g(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"axisLabelsMode: invalid value '"+(null==t?void 0:""+t)+"' is not supported."})}validateLineFullWidth(t){const i="ERR_lineFullWidth";y(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"lineFullWidth: invalid value(s) '"+(null==t?void 0:""+t)+"' are not supported."})}validateShowCategories(t){const i="ERR_showCategories";y(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"showCategories: invalid value(s) '"+(null==t?void 0:""+t)+"' are not supported."})}validateMeasureScale(t){const i="ERR_measureScale";f(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"measureScale: invalid value '"+(null==t?void 0:""+t)+"' is not supported."})}validateShowMeasureScale(t){const i="ERR_grouped";y(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"showMeasureScale: invalid value(s) '"+(null==t?void 0:""+t)+"' are not supported."})}validateShowOverlayAvg(t){const i="ERR_grouped";y(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"showOverlayAvg: invalid value(s) '"+(null==t?void 0:""+t)+"' are not supported."})}validateShowOverlayMedian(t){const i="ERR_grouped";y(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"showOverlayMedian: invalid value(s) '"+(null==t?void 0:""+t)+"' are not supported."})}constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.datasetName="",this.dataVersion=0,this.datasetMeta=null,this.appliedScaleFactor=1,this.layoutObserver=null,this.chartTitle="",this.filter="",this.syncSpaceLeft=-1,this.limit=0,this.chartMode="bar",this.maxBars=28,this.stack="",this.intervalSpanLimit=28,this.lineFullWidth="true",this.showCategories="true",this.measureScale="greatest",this.showMeasureScale="false",this.showOverlayAvg="true",this.showOverlayMedian="false",this.measureUnit="",this.pixelPerUnitGroupMap=new Map,this._autoScaleGuard=!1,this._lastObservedWidth=0,this._settleTimer=null,this._lastAppliedHeight=0,E(this),M(this),w(this,(t=>{this.datasetName=(null==t?void 0:t.startsWith("$"))?t.substring(1):t||"",this.dataVersion=this.dataVersion+1}),((t,i)=>{this.datasetMeta=i})),this.chartTemplate=this.chartTemplate.bind(this),this.errors=_(this),L(this),this.componentStyle=U(this),this.ruleSetConfig=C(this),this.t=R(this).t,this.resolveInherited=A(this,[{propName:"scenarios",ancestorAttr:"title-scenarios"},{propName:"variances",ancestorAttr:"title-variances"},{propName:"order",ancestorAttr:"title-order"},{propName:"orderDirection",ancestorAttr:"title-order-direction"}])}componentWillLoad(){this.validateScenario(this.scenarios),this.validateVariances(this.variances),this.validateUnitScaling(this.unitScaling),this.validateLimit(this.limit),this.validateLevel(this.level),this.validateOrderDirection(this.orderDirection),this.validateOrderList(this.order),this.validateLeftSync(this.syncSpaceLeft),this.validateDateInterval(this.dateInterval),this.validateAxisLabelsMode(this.axisLabelsMode),this.validateLineFullWidth(this.lineFullWidth),this.validateShowCategories(this.showCategories),this.validateMeasureScale(this.measureScale),this.validateShowMeasureScale(this.showMeasureScale),this.validateShowOverlayAvg(this.showOverlayAvg),this.validateShowOverlayMedian(this.showOverlayMedian),this.validateChartMode(this.chartMode),this.validateMaxBars(this.maxBars),this.validateStack(this.stack),this.validateScaling(this.scale)}componentDidRender(){const{mode:t}=O(this.scale);if("auto"!==t&&"empty"!==t){this._autoScaleGuard=!1;const t=b(this.element),i="WARN_overflow";return void(t.width>0&&this.element.scrollWidth>t.width+1?this.errors.addOrReplace({id:i,type:"warning",message:"Chart exceeds available space and will be cut off. Check unit-scaling value."}):this.errors.remove(i))}if(this._autoScaleGuard)return void(this._autoScaleGuard=!1);const i=this.element,{width:s}=b(i);if(s<=0)return;this._lastObservedWidth=s;const a=this.componentStyle((t=>{var i;return(null===(i=t.global)||void 0===i?void 0:i.fontSizePx)||13.3333})),r=i.scrollWidth,n=this.appliedScaleFactor;if(r<=s+1)return void this.errors.remove("AUTO_scale");const o=Math.max(.3,n*(s-1)/r);Math.abs(o-n)<.01||(i.style.setProperty("--bn-font-size",a*o+"px"),"empty"===t?this.errors.addOrReplace({id:"AUTO_scale",type:"warning",message:"Auto-scaled chart by factor "+o.toFixed(3)}):this.errors.remove("AUTO_scale"),this._autoScaleGuard=!0,e((()=>{this.appliedScaleFactor=o})))}componentDidLoad(){this.layoutObserver=k(this.element,(()=>{if(this._autoScaleGuard)return;const{width:t}=b(this.element);t>0&&Math.abs(t-this._lastObservedWidth)>2&&(this._lastObservedWidth=t,s(this))})),requestAnimationFrame((()=>{requestAnimationFrame((()=>{if(this._autoScaleGuard)return;const{width:t}=b(this.element);this._lastObservedWidth=t,s(this)}))})),this.settleParentHeight()}settleParentHeight(){const t=[150,400,1e3,2500],i=()=>{if(this._settleTimer=null,!this.element.isConnected)return;const{height:e}=b(this.element);e>0&&Math.abs(e-this._lastAppliedHeight)>8&&!this._autoScaleGuard&&s(this);const a=t.shift();void 0!==a&&(this._settleTimer=setTimeout(i,a))};this._settleTimer=setTimeout(i,t.shift())}disconnectedCallback(){var t;null===(t=this.layoutObserver)||void 0===t||t.disconnect(),this.layoutObserver=null,null!=this._settleTimer&&(clearTimeout(this._settleTimer),this._settleTimer=null)}prepareDimension(){const t=b(this.element),i=this.prepareScenarios(),e=this.prepareVariances();return this.canvasWidthSegmented=t.width/(i.length+e.length||1),this._lastAppliedHeight=t.height,{width:this.canvasWidthSegmented,height:t.height}}prepareScenarios(){var t,i,e,s;const a=this.resolveInherited("scenarios",this.scenarios);if(void 0!==a)return this.errors.remove("AUTO_scenarios"),a.split(",").map((t=>t.trim()));const r="auto"===(null===(t=this.scenarios)||void 0===t?void 0:t.trim().toLowerCase());return S(this.scenarios)||r?(null===(e=null===(i=this.datasetMeta)||void 0===i?void 0:i.availableScenarios)||void 0===e?void 0:e.length)>0?(r?this.errors.remove("AUTO_scenarios"):this.errors.addOrReplace({id:"AUTO_scenarios",type:"warning",message:"scenarios: not set, auto-detected: "+this.datasetMeta.availableScenarios.join(",")}),this.datasetMeta.availableScenarios):[]:(this.errors.remove("AUTO_scenarios"),null===(s=this.scenarios)||void 0===s?void 0:s.split(",").map((t=>t.trim())))}prepareAvg(){return"true"===this.showOverlayAvg}prepareMedian(){return"true"===this.showOverlayMedian}prepareVariances(){var t;const i=this.resolveInherited("variances",this.variances);return void 0!==i?i.split(",").map((t=>t.trim())):S(this.variances)?[]:null===(t=this.variances)||void 0===t?void 0:t.split(",").map((t=>t.trim()))}prepareHideAxisLabels(t){return t>=1||"true"!==this.showCategories}prepareI18n(){const t=T,i=new Map([].map((t=>[t,this.t(".".concat(t))]))),e=new Map(t.map((t=>[t,this.t("global.".concat(t))])));return new Map([...e.entries(),...i.entries()])}preparePixelPerUnit(){var t;if(this.pixelPerUnitGroupMap.has(this.unitScaling))return this.errors.remove("AUTO_unitScaling"),this.pixelPerUnitGroupMap.get(this.unitScaling);if("auto"===(null===(t=this.unitScaling)||void 0===t?void 0:(""+t).trim().toLowerCase()))return this.errors.remove("AUTO_unitScaling"),0;const i=Number(this.unitScaling);return!isNaN(i)&&i>0?(this.errors.remove("AUTO_unitScaling"),i):(this.errors.addOrReplace({id:"AUTO_unitScaling",type:"warning",message:"unit-scaling: not set, auto-calculated to fit available space."}),0)}preparePixelPerPercentage(){var t;if(this.pixelPerUnitGroupMap.has(this.percentageScaling))return this.pixelPerUnitGroupMap.get(this.percentageScaling);if("auto"===(null===(t=this.percentageScaling)||void 0===t?void 0:(""+t).trim().toLowerCase()))return this.errors.remove("AUTO_percentageScaling"),0;const i=Number(this.percentageScaling);return!isNaN(i)&&i>0?(this.errors.remove("AUTO_percentageScaling"),100*i):(this.errors.addOrReplace({id:"AUTO_percentageScaling",type:"warning",message:"percentage-scaling: not set, auto-calculated to fit available space."}),0)}prepareLevel(){var t,i,e;const s="auto"===(null===(t=this.level)||void 0===t?void 0:t.trim().toLowerCase());return S(this.level)||s?(null===(i=this.datasetMeta)||void 0===i?void 0:i.suggestedLevel)?(s?this.errors.remove("AUTO_level"):this.errors.addOrReplace({id:"AUTO_level",type:"warning",message:"level: not set, auto-detected: "+this.datasetMeta.suggestedLevel}),$[this.datasetMeta.suggestedLevel.toUpperCase()]):void 0:(this.errors.remove("AUTO_level"),$[null===(e=this.level)||void 0===e?void 0:e.toUpperCase()])}prepareOrder(){var t,i,e;const s=this.resolveInherited("order",this.order),a=this.resolveInherited("orderDirection",this.orderDirection),r=null!=s?s:this.order,n=null!=a?a:this.orderDirection;let o=(S(this.level)||"auto"===(null===(t=this.level)||void 0===t?void 0:t.trim().toLowerCase()))&&(null===(i=this.datasetMeta)||void 0===i?void 0:i.suggestedLevel)?this.datasetMeta.suggestedLevel:this.level;const l="auto"===(null==r?void 0:r.trim().toLowerCase());return S(r)||l?(null===(e=this.datasetMeta)||void 0===e?void 0:e.suggestedLevel)&&(l?this.errors.remove("AUTO_order"):this.errors.addOrReplace({id:"AUTO_order",type:"warning",message:"order: not set, auto-detected: "+o})):(this.errors.remove("AUTO_order"),"levelindex"===(null==r?void 0:r.toLocaleLowerCase())&&(o+="Index")),{hierarchy:[N[null==o?void 0:o.toUpperCase()]],direction:I[null==n?void 0:n.toUpperCase()]}}prepareStyle(){const t=this.getEffectiveScaleFactor();return this.componentStyle((i=>{const e=i.global.fontSizePx*t;return{scaleFactors:{scenarioOffset:i["bn-chart-time"].scaleFactors.scenarioOffset,scenarioLabelToColumn:i["bn-chart-time"].scaleFactors.scenarioLabelToColumn,labelToColumn:.3,labelToColum:i["bn-chart-time"].scaleFactors.labelToColum,labelToAxis:i["bn-chart-time"].scaleFactors.labelToAxis,needleWidth:i["bn-chart-time"].scaleFactors.needleWidth,needleHeadWidth:i["bn-chart-time"].scaleFactors.needleHeadWidth,columnWidth:i["bn-chart-time"].scaleFactors.columnWidth,varianceAxisLineWidth:i["bn-chart-time"].scaleFactors.varianceAxisLineWidth,axisLineWidth:i["bn-chart-time"].scaleFactors.axisLineWidth,auxiliaryLineWidth:i["bn-chart-time"].scaleFactors.auxiliaryLineWidth,scenarioLineWidth:i["bn-chart-time"].scaleFactors.scenarioLineWidth,markerWidth:i["bn-chart-time"].scaleFactors.markerWidth,markerOffset:i["bn-chart-time"].scaleFactors.markerOffset,categoryWidth:i["bn-chart-time"].scaleFactors.categoryWidth,axisTickLength:i["bn-chart-time"].scaleFactors.axisTickLength},fontStyles:{font:`${e}px ${i.global.fontFamily}`,size:e,color:i.global.fontColor,background:i.global.fontBackgroundColor,leading:1.8},axisStyles:i["bn-chart-time"].axisStyles,barStyles:i["bn-chart-time"].barStyles,varianceStyles:i["bn-chart-time"].varianceStyles,stackColors:i["bn-chart-time"].stackColors,padding:i["bn-chart-time"].padding,pattern:null}}))}prepareLeftSideOffset(t,i){return this.syncSpaceLeft>-1?this.syncSpaceLeft:W.getMaxWidthOfArrayItems([...this.prepareVariances(),...this.prepareScenarios(),this.chartTitle],t,i)}prepareChartTitle(t){return t>=1?"":this.chartTitle}prepareLimit(){return Math.floor(Number(this.limit)||0)}prepareDateInterval(){var t,i,e;const s="auto"===(null===(t=this.dateInterval)||void 0===t?void 0:t.trim().toLowerCase());return S(this.dateInterval)||s?(null===(i=this.datasetMeta)||void 0===i?void 0:i.suggestedDateInterval)?(s?this.errors.remove("AUTO_dateInterval"):this.errors.addOrReplace({id:"AUTO_dateInterval",type:"warning",message:"dateInterval: not set, auto-detected: "+this.datasetMeta.suggestedDateInterval}),B[this.datasetMeta.suggestedDateInterval.toUpperCase()]):s?B.AUTO:void 0:(this.errors.remove("AUTO_dateInterval"),B[null===(e=this.dateInterval)||void 0===e?void 0:e.toUpperCase()])}prepareIntervalSpanLimit(){return this.intervalSpanLimit}prepareAxisLabelsMode(){var t;return D[null===(t=this.axisLabelsMode)||void 0===t?void 0:t.toUpperCase()]}prepareFilter(){return 0===this.filter.length?"":this.filter}getDataStructure(){return{ITimeChartDataRow:{setName:{type:"string",isOptional:!1,description:""},date:{type:"string",isOptional:!1,description:""},operation:{type:"string",isOptional:!1,description:""},rowGroup:{type:"string",isOptional:!1,description:""},rowGroupIndex:{type:"number",isOptional:!1,description:""},category:{type:"string",isOptional:!1,description:""},categoryIndex:{type:"number",isOptional:!1,description:""},subCategory:{type:"string",isOptional:!1,description:""},subCategoryIndex:{type:"number",isOptional:!1,description:""},columnGroup:{type:"string",isOptional:!1,description:""},columnGroupIndex:{type:"number",isOptional:!1,description:""},columnSubGroup:{type:"string",isOptional:!1,description:""},columnSubGroupIndex:{type:"number",isOptional:!1,description:""},ac1:{type:"number",isOptional:!1,description:""},ac2:{type:"number",isOptional:!1,description:""},ac3:{type:"number",isOptional:!1,description:""},ac4:{type:"number",isOptional:!1,description:""},pp1:{type:"number",isOptional:!1,description:""},pp2:{type:"number",isOptional:!1,description:""},pp3:{type:"number",isOptional:!1,description:""},pp4:{type:"number",isOptional:!1,description:""},fc1:{type:"number",isOptional:!1,description:""},fc2:{type:"number",isOptional:!1,description:""},fc3:{type:"number",isOptional:!1,description:""},fc4:{type:"number",isOptional:!1,description:""},pl1:{type:"number",isOptional:!1,description:""},pl2:{type:"number",isOptional:!1,description:""},pl3:{type:"number",isOptional:!1,description:""},pl4:{type:"number",isOptional:!1,description:""}}}}prepareMeasureScale(){return S(this.measureScale)?"GREATEST":["_","k","M","G","T","P","E","Z","Y","m","μ","n","p","P","f","a","z","y"].includes(this.measureScale.trim())||"LEAST"===this.measureScale.trim().toUpperCase()?this.measureScale.trim():"GREATEST"}prepareShowMeasureScale(t){return 0===t&&"true"===this.showMeasureScale}prepareMeasureUnit(){return""===this.measureUnit||null==this.measureUnit?"":this.measureUnit}prepareStackConfig(){if(S(this.stack))return this.errors.remove("WARN_stack_dimensions_scenarios"),null;try{const t=JSON.parse(this.stack),i=t.by,e="WARN_stack_dimensions_scenarios";if(i===F.DIMENSIONS){const t=this.prepareScenarios();t.length>1?this.errors.addOrReplace({id:e,type:"warning",message:`stack by dimensions: only the first scenario "${t[0]}" is used, the rest (${t.slice(1).join(", ")}) are discarded.`}):this.errors.remove(e)}else this.errors.remove(e);return{by:i,mode:t.mode||P.ABSOLUTE,order:t.order||j.DATASET}}catch(t){return this.errors.remove("WARN_stack_dimensions_scenarios"),null}}prepareLineFullWidth(){return"true"===this.lineFullWidth}prepareChartMode(){var t;const i=null===(t=this.chartMode)||void 0===t?void 0:t.toLowerCase();return"line"===i?G.LINE:"auto"===i?G.AUTO:G.BAR}prepareMaxBars(){return Math.floor(Number(this.maxBars)||28)}chartTemplate(t,i){const e=this.prepareI18n(),s=this.prepareStyle(),r=b(this.element).width,n=this.getEffectiveScaleFactor(),o=this.preparePixelPerUnit(),l=this.preparePixelPerPercentage(),h=this.prepareStackConfig(),d=this.prepareScenarios(),c=(null==h?void 0:h.by)===F.DIMENSIONS?d.slice(0,1):d;return a("ibcs-chart-time",{tableName:this.datasetName,dataVersion:this.dataVersion,chartTitle:this.prepareChartTitle(i),scenarios:c,variances:[t],hideAxisLabels:this.prepareHideAxisLabels(i),pixelPerUnit:o>0?o*n:0,pixelPerPercentage:l>0?l*n:0,limit:this.prepareLimit(),leftSideOffsetForHorizontalSync:this.prepareLeftSideOffset(e,s),styles:s,i18n:e,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(i),chartMode:this.prepareChartMode(),maxBars:this.prepareMaxBars(),stackConfig:h,lineFullWidth:this.prepareLineFullWidth(),containerWidth:r,parentDimensions:this.prepareDimension(),ruleSetConfig:this.ruleSetConfig()})}getEffectiveScaleFactor(){const{mode:t,factor:i}=O(this.scale);return"factor"===t?i:"auto"===t||"empty"===t?this.appliedScaleFactor:1}getFontStyles(){const t=this.getEffectiveScaleFactor();return this.componentStyle((i=>{var e,s,a,r;const n=(null===(e=i.global)||void 0===e?void 0:e.fontSizePx)||13.3333;return{"--bn-font-family":(null===(s=i.global)||void 0===s?void 0:s.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":n*t+"px","--bn-font-color":(null===(a=i.global)||void 0===a?void 0:a.fontColor)||"#000000","--bn-font-background":(null===(r=i.global)||void 0===r?void 0:r.fontBackgroundColor)||"#ffffff"}}))}render(){let t=[""];const i=this.prepareVariances();i.length>0&&(t=[...t,...i]);const e=this.getFontStyles();return a(r,{key:"df8b91008f6f0d178bd3df91eb99a338f1734f27",style:e},a("div",{key:"094f47f7f698b8cd87096066ae608b67c1258d71",class:"container"},t.map(this.chartTemplate)))}get element(){return this}static get watchers(){return{scenarios:[{validateScenario:0}],variances:[{validateVariances:0}],syncSpaceLeft:[{validateLeftSync:0}],limit:[{validateLimit:0}],unitScaling:[{validateUnitScaling:0}],percentageScaling:[{validatePercentageScaling:0}],level:[{validateLevel:0}],order:[{validateOrderList:0}],orderDirection:[{validateOrderDirection:0}],dateInterval:[{validateDateInterval:0}],chartMode:[{validateChartMode:0}],maxBars:[{validateMaxBars:0}],stack:[{validateStack:0}],scale:[{validateScaling:0}],axisLabelsMode:[{validateAxisLabelsMode:0}],lineFullWidth:[{validateLineFullWidth:0}],showCategories:[{validateShowCategories:0}],measureScale:[{validateMeasureScale:0}],showMeasureScale:[{validateShowMeasureScale:0}],showOverlayAvg:[{validateShowOverlayAvg:0}],showOverlayMedian:[{validateShowOverlayMedian:0}]}}static get style(){return":host{display:inline-block;position:relative;overflow:hidden}.container{display:flex;flex-direction:column-reverse}.background-image{display:flex;flex-wrap:wrap;justify-content:flex-end}"}},[1,"bn-chart-time",{ruleset:[513],chartTitle:[1,"chart-title"],filter:[1],scenarios:[1],variances:[1],syncSpaceLeft:[2,"sync-space-left"],limit:[2],unitScaling:[8,"unit-scaling"],percentageScaling:[8,"percentage-scaling"],level:[1],order:[1],orderDirection:[1,"order-direction"],dateInterval:[1,"date-interval"],chartMode:[1,"chart-mode"],maxBars:[2,"max-bars"],stack:[1],scale:[1],intervalSpanLimit:[2,"interval-span-limit"],axisLabelsMode:[1,"axis-labels-mode"],lineFullWidth:[1,"line-full-width"],showCategories:[1,"show-categories"],measureScale:[1,"measure-scale"],showMeasureScale:[1,"show-measure-scale"],showOverlayAvg:[1,"show-overlay-avg"],showOverlayMedian:[1,"show-overlay-median"],measureUnit:[1,"measure-unit"],datasetName:[32],dataVersion:[32],datasetMeta:[32],appliedScaleFactor:[32]},void 0,{scenarios:[{validateScenario:0}],variances:[{validateVariances:0}],syncSpaceLeft:[{validateLeftSync:0}],limit:[{validateLimit:0}],unitScaling:[{validateUnitScaling:0}],percentageScaling:[{validatePercentageScaling:0}],level:[{validateLevel:0}],order:[{validateOrderList:0}],orderDirection:[{validateOrderDirection:0}],dateInterval:[{validateDateInterval:0}],chartMode:[{validateChartMode:0}],maxBars:[{validateMaxBars:0}],stack:[{validateStack:0}],scale:[{validateScaling:0}],axisLabelsMode:[{validateAxisLabelsMode:0}],lineFullWidth:[{validateLineFullWidth:0}],showCategories:[{validateShowCategories:0}],measureScale:[{validateMeasureScale:0}],showMeasureScale:[{validateShowMeasureScale:0}],showOverlayAvg:[{validateShowOverlayAvg:0}],showOverlayMedian:[{validateShowOverlayMedian:0}]}]),H=z,J=function(){"undefined"!=typeof customElements&&["bn-chart-time","ibcs-chart-time"].forEach((t=>{switch(t){case"bn-chart-time":customElements.get(n(t))||customElements.define(n(t),z);break;case"ibcs-chart-time":customElements.get(n(t))||V()}}))};export{H as BnChartTime,J as defineCustomElement}
|
|
1
|
+
import{proxyCustomElement as t,HTMLElement as i,writeTask as e,forceUpdate as s,h as a,Host as r,transformTag as n}from"@stencil/core/internal/client";import{v as o,a as l,k as h,h as d,l as c,b as u,c as p,f as v,o as m,p as g,m as y,n as f,i as S}from"./validate.js";import{w,g as b,p as O}from"./withDataset.js";import{w as M,a as _}from"./withHasError.js";import{i as x,w as R,a as A}from"./withTranslation.js";import{w as L}from"./withScalingGroup.js";import{a as T}from"./context-protocol.js";import{w as E}from"./withStyled.js";import{w as U}from"./withComponentStyle.js";import{w as C}from"./withRuleSet.js";import{o as k}from"./layoutObserver.js";import{O as I,a as N}from"./Order.js";import{F as W}from"./formatter.js";import{b as D,e as F,f as j,g as P,h as G}from"./CompareUtil.js";import{a as B}from"./DateStringFactory.js";import{d as V}from"./ibcs-chart-time2.js";var $;!function(t){t.ROWGROUP="rowGroup",t.ROWGROUPINDEX="rowGroupIndex",t.CATEGORY="category",t.CATEGORYINDEX="categoryIndex",t.SUBCATEGORY="subCategory",t.SUBCATEGORYINDEX="subCategoryIndex"}($||($={}));const z=t(class extends i{validateScenario(t){const i="ERR_scenarios";if(x(t))return void this.errors.remove(i);const e=o(t);e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"scenarios: invalid value(s) '"+JSON.stringify(e)+"' are not supported."}):this.errors.remove(i)}validateVariances(t){const i="ERR_variances";if(x(t))return void this.errors.remove(i);const e=l(t);e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"variances: invalid value(s) '"+JSON.stringify(e)+"' are not supported."}):this.errors.remove(i)}validateLeftSync(t){const i="ERR_syncSpaceLeft";h(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"syncSpaceLeft: invalid value(s) '"+t+"' are not supported."})}validateLimit(t){const i="ERR_limit";d(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"limit: invalid value '"+(null==t?void 0:""+t)+"' is not supported."})}validateUnitScaling(t){const i="ERR_unitScaling";"auto"===(null==t?void 0:(""+t).trim().toLowerCase())||h(t)||this.pixelPerUnitGroupMap.has(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"unitScaling: invalid value(s) '"+t+"' are not supported."})}validatePercentageScaling(t){const i="ERR_percentageScaling";"auto"===(null==t?void 0:(""+t).trim().toLowerCase())||h(t)||this.pixelPerUnitGroupMap.has(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"percentageScaling: invalid value(s) '"+t+"' are not supported."})}validateLevel(t){const i="ERR_level";c(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"level: invalid value(s) '"+t+"' are not supported."})}validateOrderList(t){const i="ERR_order";if(x(t))return void this.errors.remove(i);const e=u(t);e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"order: invalid value(s) '"+JSON.stringify(e)+"' are not supported."}):this.errors.remove(i)}validateOrderDirection(t){const i="ERR_orderDirection";x(t)||p(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"orderDirection: invalid value '"+(null==t?void 0:""+t)+"' is not supported."})}validateDateInterval(t){const i="ERR_dateInterval";v(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"dateInterval: invalid value '"+(null==t?void 0:""+t)+"' is not supported."})}validateChartMode(t){const i="ERR_chartMode";["bar","line","auto"].includes(null==t?void 0:t.toLowerCase())?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"chartMode: invalid value '"+(null==t?void 0:""+t)+"' is not supported. Valid values are: bar, line, auto."})}validateMaxBars(t){const i="ERR_maxBars";!d(t)||t<1?this.errors.addOrReplace({id:i,type:"warning",message:"maxBars: invalid value '"+(null==t?void 0:""+t)+"' is not supported. Must be a positive integer."}):this.errors.remove(i)}validateStack(t){const i="ERR_stack",e=m(t);e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:e.join("; ")}):this.errors.remove(i)}validateScaling(t){if(null==t||""===t||"none"===t||"auto"===t)return void this.errors.remove("ERR_scale");const i=Number(t);isNaN(i)||i<=0?this.errors.addOrReplace({id:"ERR_scale",type:"warning",message:`Invalid scale value: "${t}". Use "none", "auto", or a positive number.`}):this.errors.remove("ERR_scale")}validateAxisLabelsMode(t){const i="ERR_axisLabelsMode";g(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"axisLabelsMode: invalid value '"+(null==t?void 0:""+t)+"' is not supported."})}validateLineFullWidth(t){const i="ERR_lineFullWidth";y(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"lineFullWidth: invalid value(s) '"+(null==t?void 0:""+t)+"' are not supported."})}validateShowCategories(t){const i="ERR_showCategories";y(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"showCategories: invalid value(s) '"+(null==t?void 0:""+t)+"' are not supported."})}validateMeasureScale(t){const i="ERR_measureScale";f(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"measureScale: invalid value '"+(null==t?void 0:""+t)+"' is not supported."})}validateShowMeasureScale(t){const i="ERR_grouped";y(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"showMeasureScale: invalid value(s) '"+(null==t?void 0:""+t)+"' are not supported."})}validateShowOverlayAvg(t){const i="ERR_grouped";y(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"showOverlayAvg: invalid value(s) '"+(null==t?void 0:""+t)+"' are not supported."})}validateShowOverlayMedian(t){const i="ERR_grouped";y(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"showOverlayMedian: invalid value(s) '"+(null==t?void 0:""+t)+"' are not supported."})}constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.datasetName="",this.dataVersion=0,this.datasetMeta=null,this.appliedScaleFactor=1,this.layoutObserver=null,this.chartTitle="",this.filter="",this.syncSpaceLeft=-1,this.limit=0,this.chartMode="bar",this.maxBars=28,this.stack="",this.intervalSpanLimit=28,this.lineFullWidth="true",this.showCategories="true",this.measureScale="greatest",this.showMeasureScale="false",this.showOverlayAvg="true",this.showOverlayMedian="false",this.measureUnit="",this.pixelPerUnitGroupMap=new Map,this._autoScaleGuard=!1,this._lastObservedWidth=0,this._settleTimer=null,this._lastAppliedHeight=0,E(this),M(this),w(this,(t=>{this.datasetName=(null==t?void 0:t.startsWith("$"))?t.substring(1):t||"",this.dataVersion=this.dataVersion+1}),((t,i)=>{this.datasetMeta=i})),this.chartTemplate=this.chartTemplate.bind(this),this.errors=_(this),L(this),this.componentStyle=U(this),this.ruleSetConfig=C(this),this.t=R(this).t,this.resolveInherited=A(this,[{propName:"scenarios",ancestorAttr:"title-scenarios"},{propName:"variances",ancestorAttr:"title-variances"},{propName:"order",ancestorAttr:"title-order"},{propName:"orderDirection",ancestorAttr:"title-order-direction"}])}componentWillLoad(){this.validateScenario(this.scenarios),this.validateVariances(this.variances),this.validateUnitScaling(this.unitScaling),this.validateLimit(this.limit),this.validateLevel(this.level),this.validateOrderDirection(this.orderDirection),this.validateOrderList(this.order),this.validateLeftSync(this.syncSpaceLeft),this.validateDateInterval(this.dateInterval),this.validateAxisLabelsMode(this.axisLabelsMode),this.validateLineFullWidth(this.lineFullWidth),this.validateShowCategories(this.showCategories),this.validateMeasureScale(this.measureScale),this.validateShowMeasureScale(this.showMeasureScale),this.validateShowOverlayAvg(this.showOverlayAvg),this.validateShowOverlayMedian(this.showOverlayMedian),this.validateChartMode(this.chartMode),this.validateMaxBars(this.maxBars),this.validateStack(this.stack),this.validateScaling(this.scale)}componentDidRender(){const{mode:t}=O(this.scale);if("auto"!==t&&"empty"!==t){this._autoScaleGuard=!1;const t=b(this.element),i="WARN_overflow";return void(t.width>0&&this.element.scrollWidth>t.width+1?this.errors.addOrReplace({id:i,type:"warning",message:"Chart exceeds available space and will be cut off. Check unit-scaling value."}):this.errors.remove(i))}if(this._autoScaleGuard)return void(this._autoScaleGuard=!1);const i=this.element,{width:s}=b(i);if(s<=0)return;this._lastObservedWidth=s;const a=this.componentStyle((t=>{var i;return(null===(i=t.global)||void 0===i?void 0:i.fontSizePx)||13.3333})),r=i.scrollWidth,n=this.appliedScaleFactor;if(r<=s+1)return void this.errors.remove("AUTO_scale");const o=Math.max(.3,n*(s-1)/r);Math.abs(o-n)<.01||(i.style.setProperty("--bn-font-size",a*o+"px"),"empty"===t?this.errors.addOrReplace({id:"AUTO_scale",type:"warning",message:"Auto-scaled chart by factor "+o.toFixed(3)}):this.errors.remove("AUTO_scale"),this._autoScaleGuard=!0,e((()=>{this.appliedScaleFactor=o})))}componentDidLoad(){this.layoutObserver=k(this.element,(()=>{if(this._autoScaleGuard)return;const{width:t}=b(this.element);t>0&&Math.abs(t-this._lastObservedWidth)>2&&(this._lastObservedWidth=t,s(this))})),requestAnimationFrame((()=>{requestAnimationFrame((()=>{if(this._autoScaleGuard)return;const{width:t}=b(this.element);this._lastObservedWidth=t,s(this)}))})),this.settleParentHeight()}settleParentHeight(){const t=[150,400,1e3,2500],i=()=>{if(this._settleTimer=null,!this.element.isConnected)return;const{height:e}=b(this.element);e>0&&Math.abs(e-this._lastAppliedHeight)>8&&!this._autoScaleGuard&&s(this);const a=t.shift();void 0!==a&&(this._settleTimer=setTimeout(i,a))};this._settleTimer=setTimeout(i,t.shift())}disconnectedCallback(){var t;null===(t=this.layoutObserver)||void 0===t||t.disconnect(),this.layoutObserver=null,null!=this._settleTimer&&(clearTimeout(this._settleTimer),this._settleTimer=null)}prepareDimension(){const t=b(this.element),i=this.prepareScenarios(),e=this.prepareVariances();return this.canvasWidthSegmented=t.width/(i.length+e.length||1),this._lastAppliedHeight=t.height,{width:this.canvasWidthSegmented,height:t.height}}prepareScenarios(){var t,i,e,s;const a=this.resolveInherited("scenarios",this.scenarios);if(void 0!==a)return this.errors.remove("AUTO_scenarios"),a.split(",").map((t=>t.trim()));const r="auto"===(null===(t=this.scenarios)||void 0===t?void 0:t.trim().toLowerCase());return S(this.scenarios)||r?(null===(e=null===(i=this.datasetMeta)||void 0===i?void 0:i.availableScenarios)||void 0===e?void 0:e.length)>0?(r?this.errors.remove("AUTO_scenarios"):this.errors.addOrReplace({id:"AUTO_scenarios",type:"warning",message:"scenarios: not set, auto-detected: "+this.datasetMeta.availableScenarios.join(",")}),this.datasetMeta.availableScenarios):[]:(this.errors.remove("AUTO_scenarios"),null===(s=this.scenarios)||void 0===s?void 0:s.split(",").map((t=>t.trim())))}prepareAvg(){return"true"===this.showOverlayAvg}prepareMedian(){return"true"===this.showOverlayMedian}prepareVariances(){var t;const i=this.resolveInherited("variances",this.variances);return void 0!==i?i.split(",").map((t=>t.trim())):S(this.variances)?[]:null===(t=this.variances)||void 0===t?void 0:t.split(",").map((t=>t.trim()))}prepareHideAxisLabels(t){return t>=1||"true"!==this.showCategories}prepareI18n(){const t=T,i=new Map(["no-data"].map((t=>[t,this.t(".".concat(t))]))),e=new Map(t.map((t=>[t,this.t("global.".concat(t))])));return new Map([...e.entries(),...i.entries()])}preparePixelPerUnit(){var t;if(this.pixelPerUnitGroupMap.has(this.unitScaling))return this.errors.remove("AUTO_unitScaling"),this.pixelPerUnitGroupMap.get(this.unitScaling);if("auto"===(null===(t=this.unitScaling)||void 0===t?void 0:(""+t).trim().toLowerCase()))return this.errors.remove("AUTO_unitScaling"),0;const i=Number(this.unitScaling);return!isNaN(i)&&i>0?(this.errors.remove("AUTO_unitScaling"),i):(this.errors.addOrReplace({id:"AUTO_unitScaling",type:"warning",message:"unit-scaling: not set, auto-calculated to fit available space."}),0)}preparePixelPerPercentage(){var t;if(this.pixelPerUnitGroupMap.has(this.percentageScaling))return this.pixelPerUnitGroupMap.get(this.percentageScaling);if("auto"===(null===(t=this.percentageScaling)||void 0===t?void 0:(""+t).trim().toLowerCase()))return this.errors.remove("AUTO_percentageScaling"),0;const i=Number(this.percentageScaling);return!isNaN(i)&&i>0?(this.errors.remove("AUTO_percentageScaling"),100*i):(this.errors.addOrReplace({id:"AUTO_percentageScaling",type:"warning",message:"percentage-scaling: not set, auto-calculated to fit available space."}),0)}prepareLevel(){var t,i,e;const s="auto"===(null===(t=this.level)||void 0===t?void 0:t.trim().toLowerCase());return S(this.level)||s?(null===(i=this.datasetMeta)||void 0===i?void 0:i.suggestedLevel)?(s?this.errors.remove("AUTO_level"):this.errors.addOrReplace({id:"AUTO_level",type:"warning",message:"level: not set, auto-detected: "+this.datasetMeta.suggestedLevel}),$[this.datasetMeta.suggestedLevel.toUpperCase()]):void 0:(this.errors.remove("AUTO_level"),$[null===(e=this.level)||void 0===e?void 0:e.toUpperCase()])}prepareOrder(){var t,i,e;const s=this.resolveInherited("order",this.order),a=this.resolveInherited("orderDirection",this.orderDirection),r=null!=s?s:this.order,n=null!=a?a:this.orderDirection;let o=(S(this.level)||"auto"===(null===(t=this.level)||void 0===t?void 0:t.trim().toLowerCase()))&&(null===(i=this.datasetMeta)||void 0===i?void 0:i.suggestedLevel)?this.datasetMeta.suggestedLevel:this.level;const l="auto"===(null==r?void 0:r.trim().toLowerCase());return S(r)||l?(null===(e=this.datasetMeta)||void 0===e?void 0:e.suggestedLevel)&&(l?this.errors.remove("AUTO_order"):this.errors.addOrReplace({id:"AUTO_order",type:"warning",message:"order: not set, auto-detected: "+o})):(this.errors.remove("AUTO_order"),"levelindex"===(null==r?void 0:r.toLocaleLowerCase())&&(o+="Index")),{hierarchy:[N[null==o?void 0:o.toUpperCase()]],direction:I[null==n?void 0:n.toUpperCase()]}}prepareStyle(){const t=this.getEffectiveScaleFactor();return this.componentStyle((i=>{const e=i.global.fontSizePx*t;return{scaleFactors:{scenarioOffset:i["bn-chart-time"].scaleFactors.scenarioOffset,scenarioLabelToColumn:i["bn-chart-time"].scaleFactors.scenarioLabelToColumn,labelToColumn:.3,labelToColum:i["bn-chart-time"].scaleFactors.labelToColum,labelToAxis:i["bn-chart-time"].scaleFactors.labelToAxis,needleWidth:i["bn-chart-time"].scaleFactors.needleWidth,needleHeadWidth:i["bn-chart-time"].scaleFactors.needleHeadWidth,columnWidth:i["bn-chart-time"].scaleFactors.columnWidth,varianceAxisLineWidth:i["bn-chart-time"].scaleFactors.varianceAxisLineWidth,axisLineWidth:i["bn-chart-time"].scaleFactors.axisLineWidth,auxiliaryLineWidth:i["bn-chart-time"].scaleFactors.auxiliaryLineWidth,scenarioLineWidth:i["bn-chart-time"].scaleFactors.scenarioLineWidth,markerWidth:i["bn-chart-time"].scaleFactors.markerWidth,markerOffset:i["bn-chart-time"].scaleFactors.markerOffset,categoryWidth:i["bn-chart-time"].scaleFactors.categoryWidth,axisTickLength:i["bn-chart-time"].scaleFactors.axisTickLength},fontStyles:{font:`${e}px ${i.global.fontFamily}`,size:e,color:i.global.fontColor,background:i.global.fontBackgroundColor,leading:1.8},axisStyles:i["bn-chart-time"].axisStyles,barStyles:i["bn-chart-time"].barStyles,varianceStyles:i["bn-chart-time"].varianceStyles,stackColors:i["bn-chart-time"].stackColors,padding:i["bn-chart-time"].padding,pattern:null}}))}prepareLeftSideOffset(t,i){return this.syncSpaceLeft>-1?this.syncSpaceLeft:W.getMaxWidthOfArrayItems([...this.prepareVariances(),...this.prepareScenarios(),this.chartTitle],t,i)}prepareChartTitle(t){return t>=1?"":this.chartTitle}prepareLimit(){return Math.floor(Number(this.limit)||0)}prepareDateInterval(){var t,i,e;const s="auto"===(null===(t=this.dateInterval)||void 0===t?void 0:t.trim().toLowerCase());return S(this.dateInterval)||s?(null===(i=this.datasetMeta)||void 0===i?void 0:i.suggestedDateInterval)?(s?this.errors.remove("AUTO_dateInterval"):this.errors.addOrReplace({id:"AUTO_dateInterval",type:"warning",message:"dateInterval: not set, auto-detected: "+this.datasetMeta.suggestedDateInterval}),B[this.datasetMeta.suggestedDateInterval.toUpperCase()]):s?B.AUTO:void 0:(this.errors.remove("AUTO_dateInterval"),B[null===(e=this.dateInterval)||void 0===e?void 0:e.toUpperCase()])}prepareIntervalSpanLimit(){return this.intervalSpanLimit}prepareAxisLabelsMode(){var t;return D[null===(t=this.axisLabelsMode)||void 0===t?void 0:t.toUpperCase()]}prepareFilter(){return 0===this.filter.length?"":this.filter}getDataStructure(){return{ITimeChartDataRow:{setName:{type:"string",isOptional:!1,description:""},date:{type:"string",isOptional:!1,description:""},operation:{type:"string",isOptional:!1,description:""},rowGroup:{type:"string",isOptional:!1,description:""},rowGroupIndex:{type:"number",isOptional:!1,description:""},category:{type:"string",isOptional:!1,description:""},categoryIndex:{type:"number",isOptional:!1,description:""},subCategory:{type:"string",isOptional:!1,description:""},subCategoryIndex:{type:"number",isOptional:!1,description:""},columnGroup:{type:"string",isOptional:!1,description:""},columnGroupIndex:{type:"number",isOptional:!1,description:""},columnSubGroup:{type:"string",isOptional:!1,description:""},columnSubGroupIndex:{type:"number",isOptional:!1,description:""},ac1:{type:"number",isOptional:!1,description:""},ac2:{type:"number",isOptional:!1,description:""},ac3:{type:"number",isOptional:!1,description:""},ac4:{type:"number",isOptional:!1,description:""},pp1:{type:"number",isOptional:!1,description:""},pp2:{type:"number",isOptional:!1,description:""},pp3:{type:"number",isOptional:!1,description:""},pp4:{type:"number",isOptional:!1,description:""},fc1:{type:"number",isOptional:!1,description:""},fc2:{type:"number",isOptional:!1,description:""},fc3:{type:"number",isOptional:!1,description:""},fc4:{type:"number",isOptional:!1,description:""},pl1:{type:"number",isOptional:!1,description:""},pl2:{type:"number",isOptional:!1,description:""},pl3:{type:"number",isOptional:!1,description:""},pl4:{type:"number",isOptional:!1,description:""}}}}prepareMeasureScale(){return S(this.measureScale)?"GREATEST":["_","k","M","G","T","P","E","Z","Y","m","μ","n","p","P","f","a","z","y"].includes(this.measureScale.trim())||"LEAST"===this.measureScale.trim().toUpperCase()?this.measureScale.trim():"GREATEST"}prepareShowMeasureScale(t){return 0===t&&"true"===this.showMeasureScale}prepareMeasureUnit(){return""===this.measureUnit||null==this.measureUnit?"":this.measureUnit}prepareStackConfig(){if(S(this.stack))return this.errors.remove("WARN_stack_dimensions_scenarios"),null;try{const t=JSON.parse(this.stack),i=t.by,e="WARN_stack_dimensions_scenarios";if(i===F.DIMENSIONS){const t=this.prepareScenarios();t.length>1?this.errors.addOrReplace({id:e,type:"warning",message:`stack by dimensions: only the first scenario "${t[0]}" is used, the rest (${t.slice(1).join(", ")}) are discarded.`}):this.errors.remove(e)}else this.errors.remove(e);return{by:i,mode:t.mode||P.ABSOLUTE,order:t.order||j.DATASET}}catch(t){return this.errors.remove("WARN_stack_dimensions_scenarios"),null}}prepareLineFullWidth(){return"true"===this.lineFullWidth}prepareChartMode(){var t;const i=null===(t=this.chartMode)||void 0===t?void 0:t.toLowerCase();return"line"===i?G.LINE:"auto"===i?G.AUTO:G.BAR}prepareMaxBars(){return Math.floor(Number(this.maxBars)||28)}chartTemplate(t,i){const e=this.prepareI18n(),s=this.prepareStyle(),r=b(this.element).width,n=this.getEffectiveScaleFactor(),o=this.preparePixelPerUnit(),l=this.preparePixelPerPercentage(),h=this.prepareStackConfig(),d=this.prepareScenarios(),c=(null==h?void 0:h.by)===F.DIMENSIONS?d.slice(0,1):d;return a("ibcs-chart-time",{tableName:this.datasetName,dataVersion:this.dataVersion,chartTitle:this.prepareChartTitle(i),scenarios:c,variances:[t],hideAxisLabels:this.prepareHideAxisLabels(i),pixelPerUnit:o>0?o*n:0,pixelPerPercentage:l>0?l*n:0,limit:this.prepareLimit(),leftSideOffsetForHorizontalSync:this.prepareLeftSideOffset(e,s),styles:s,i18n:e,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(i),chartMode:this.prepareChartMode(),maxBars:this.prepareMaxBars(),stackConfig:h,lineFullWidth:this.prepareLineFullWidth(),containerWidth:r,parentDimensions:this.prepareDimension(),ruleSetConfig:this.ruleSetConfig()})}getEffectiveScaleFactor(){const{mode:t,factor:i}=O(this.scale);return"factor"===t?i:"auto"===t||"empty"===t?this.appliedScaleFactor:1}getFontStyles(){const t=this.getEffectiveScaleFactor();return this.componentStyle((i=>{var e,s,a,r;const n=(null===(e=i.global)||void 0===e?void 0:e.fontSizePx)||13.3333;return{"--bn-font-family":(null===(s=i.global)||void 0===s?void 0:s.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":n*t+"px","--bn-font-color":(null===(a=i.global)||void 0===a?void 0:a.fontColor)||"#000000","--bn-font-background":(null===(r=i.global)||void 0===r?void 0:r.fontBackgroundColor)||"#ffffff"}}))}render(){let t=[""];const i=this.prepareVariances();i.length>0&&(t=[...t,...i]);const e=this.getFontStyles();return a(r,{key:"104f7786a091dd6826e780981c6f9304727294d7",style:e},a("div",{key:"b8730bc1ecfe26feb450881e97de7ef407163a21",class:"container"},t.map(this.chartTemplate)))}get element(){return this}static get watchers(){return{scenarios:[{validateScenario:0}],variances:[{validateVariances:0}],syncSpaceLeft:[{validateLeftSync:0}],limit:[{validateLimit:0}],unitScaling:[{validateUnitScaling:0}],percentageScaling:[{validatePercentageScaling:0}],level:[{validateLevel:0}],order:[{validateOrderList:0}],orderDirection:[{validateOrderDirection:0}],dateInterval:[{validateDateInterval:0}],chartMode:[{validateChartMode:0}],maxBars:[{validateMaxBars:0}],stack:[{validateStack:0}],scale:[{validateScaling:0}],axisLabelsMode:[{validateAxisLabelsMode:0}],lineFullWidth:[{validateLineFullWidth:0}],showCategories:[{validateShowCategories:0}],measureScale:[{validateMeasureScale:0}],showMeasureScale:[{validateShowMeasureScale:0}],showOverlayAvg:[{validateShowOverlayAvg:0}],showOverlayMedian:[{validateShowOverlayMedian:0}]}}static get style(){return":host{display:inline-block;position:relative;overflow:hidden}.container{display:flex;flex-direction:column-reverse}.background-image{display:flex;flex-wrap:wrap;justify-content:flex-end}"}},[1,"bn-chart-time",{ruleset:[513],chartTitle:[1,"chart-title"],filter:[1],scenarios:[1],variances:[1],syncSpaceLeft:[2,"sync-space-left"],limit:[2],unitScaling:[8,"unit-scaling"],percentageScaling:[8,"percentage-scaling"],level:[1],order:[1],orderDirection:[1,"order-direction"],dateInterval:[1,"date-interval"],chartMode:[1,"chart-mode"],maxBars:[2,"max-bars"],stack:[1],scale:[1],intervalSpanLimit:[2,"interval-span-limit"],axisLabelsMode:[1,"axis-labels-mode"],lineFullWidth:[1,"line-full-width"],showCategories:[1,"show-categories"],measureScale:[1,"measure-scale"],showMeasureScale:[1,"show-measure-scale"],showOverlayAvg:[1,"show-overlay-avg"],showOverlayMedian:[1,"show-overlay-median"],measureUnit:[1,"measure-unit"],datasetName:[32],dataVersion:[32],datasetMeta:[32],appliedScaleFactor:[32]},void 0,{scenarios:[{validateScenario:0}],variances:[{validateVariances:0}],syncSpaceLeft:[{validateLeftSync:0}],limit:[{validateLimit:0}],unitScaling:[{validateUnitScaling:0}],percentageScaling:[{validatePercentageScaling:0}],level:[{validateLevel:0}],order:[{validateOrderList:0}],orderDirection:[{validateOrderDirection:0}],dateInterval:[{validateDateInterval:0}],chartMode:[{validateChartMode:0}],maxBars:[{validateMaxBars:0}],stack:[{validateStack:0}],scale:[{validateScaling:0}],axisLabelsMode:[{validateAxisLabelsMode:0}],lineFullWidth:[{validateLineFullWidth:0}],showCategories:[{validateShowCategories:0}],measureScale:[{validateMeasureScale:0}],showMeasureScale:[{validateShowMeasureScale:0}],showOverlayAvg:[{validateShowOverlayAvg:0}],showOverlayMedian:[{validateShowOverlayMedian:0}]}]),H=z,J=function(){"undefined"!=typeof customElements&&["bn-chart-time","ibcs-chart-time"].forEach((t=>{switch(t){case"bn-chart-time":customElements.get(n(t))||customElements.define(n(t),z);break;case"ibcs-chart-time":customElements.get(n(t))||V()}}))};export{H as BnChartTime,J as defineCustomElement}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{proxyCustomElement as e,HTMLElement as t,h as o,Host as n,transformTag as s}from"@stencil/core/internal/client";import{b as c}from"./context-protocol.js";import{w as
|
|
1
|
+
import{proxyCustomElement as e,HTMLElement as t,h as o,Host as n,transformTag as s}from"@stencil/core/internal/client";import{b as c}from"./context-protocol.js";import{w as a,a as i}from"./withHasError.js";const l=e(class extends t{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow(),this.currentPageUpdate=void 0,a(this),this.errors=i(this)}setLocale(e){this.stores.context.state.locale=e}connectedCallback(){this.stores=c(this.element),this.locale&&(this.stores.context.state.locale=this.locale),this.currentPageUpdate=setTimeout((()=>{this.element.querySelectorAll("bn-page, bn-layout-page").forEach(((e,t)=>{if("bn-layout-page"===e.localName)e.setAttribute("page-number",""+(t+1));else{const o=e.querySelector("bn-footer");o&&o.setAttribute("page-number",""+(t+1))}}))}),250)}disconnectedCallback(){this.currentPageUpdate&&clearTimeout(this.currentPageUpdate)}componentWillLoad(){}componentDidLoad(){}componentShouldUpdate(){}componentWillRender(){}componentDidRender(){}componentWillUpdate(){}componentDidUpdate(){}render(){return o(n,{key:"3c27b95cb769f4871f06453c73faa2a15dd04aa6"},o("slot",{key:"4965ab0122454b1b84d463146e949e432adbd06c"}))}get element(){return this}static get watchers(){return{locale:[{setLocale:0}]}}static get style(){return":host{display:block}"}},[257,"bn-context",{locale:[1],i18nNamespace:[513,"i18n-namespace"]},void 0,{locale:[{setLocale:0}]}]),r=l,d=function(){"undefined"!=typeof customElements&&["bn-context"].forEach((e=>{"bn-context"===e&&(customElements.get(s(e))||customElements.define(s(e),l))}))};export{r as BnContext,d as defineCustomElement}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{proxyCustomElement as e,HTMLElement as t,h as s,Host as r,transformTag as i}from"@stencil/core/internal/client";import{m as o}from"./validate.js";import{w as n,a}from"./withHasError.js";import{w as
|
|
1
|
+
import{proxyCustomElement as e,HTMLElement as t,h as s,Host as r,transformTag as i}from"@stencil/core/internal/client";import{m as o}from"./validate.js";import{w as n,a as d}from"./withHasError.js";import{w as a}from"./withStyled.js";import{w as l}from"./withComponentStyle.js";function h(e){if(!e||""===e.trim()||"[]"===e)return[];try{const t=JSON.parse(e);return Array.isArray(t)?t.map(((e,t)=>{var s,r,i;return"string"==typeof e?{label:e,id:t+""}:"object"==typeof e&&null!==e?{label:null!==(r=null!==(s=e.label)&&void 0!==s?s:e.name)&&void 0!==r?r:t+"",id:null!==(i=e.id)&&void 0!==i?i:t+""}:{label:e+"",id:t+""}})):[]}catch(e){return console.error("parseHeaders: failed to parse JSON",e),[]}}function u(e){if(!e||""===e.trim()||"[]"===e)return[];try{const t=JSON.parse(e);if(!Array.isArray(t))return["Headers must be an array"];const s=[],r=new Set;return t.forEach(((e,t)=>{"object"==typeof e&&null!==e&&void 0!==e.id&&("string"!=typeof e.id?s.push(`Header[${t}]: 'id' must be a string`):r.has(e.id)?s.push(`Header[${t}]: duplicate id '${e.id}'`):r.add(e.id),void 0!==e.label&&"string"!=typeof e.label&&s.push(`Header[${t}]: 'label' must be a string`))})),s}catch(e){return console.error("validateHeadersJson: failed to parse JSON",e),["Invalid JSON structure"]}}const c=e(class extends t{validateRowHeaders(e){const t="ERR_rowHeaders",s=u(e);s.length>0?this.errors.addOrReplace({id:t,type:"error",message:"row-headers: "+s.join("; ")}):this.errors.remove(t),this.updateGridConfig()}validateColumnHeaders(e){const t="ERR_columnHeaders",s=u(e);s.length>0?this.errors.addOrReplace({id:t,type:"error",message:"column-headers: "+s.join("; ")}):this.errors.remove(t),this.updateGridConfig()}validateShowRowHeaders(e){const t="ERR_showRowHeaders";o(e)?this.errors.remove(t):this.errors.addOrReplace({id:t,type:"warning",message:`show-row-headers: invalid value '${e}', must be 'true' or 'false'`})}validateShowColumnHeaders(e){const t="ERR_showColumnHeaders";o(e)?this.errors.remove(t):this.errors.addOrReplace({id:t,type:"warning",message:`show-column-headers: invalid value '${e}', must be 'true' or 'false'`})}validateShowBorders(e){const t="ERR_showBorders";o(e)?this.errors.remove(t):this.errors.addOrReplace({id:t,type:"warning",message:`show-borders: invalid value '${e}', must be 'true' or 'false'`})}constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow(),this.gridConfig={rows:[],columns:[]},this.chartTitle="",this.rowHeaders="[]",this.columnHeaders="[]",this.showRowHeaders="true",this.showColumnHeaders="true",this.showBorders="true",this.rowHeaderWidth="auto",this.cellGap="0px",a(this),n(this),this.errors=d(this),this.componentStyle=l(this)}getGridStyle(){return this.componentStyle((e=>e["bn-grid"]))}componentWillLoad(){this.validateRowHeaders(this.rowHeaders),this.validateColumnHeaders(this.columnHeaders),this.validateShowRowHeaders(this.showRowHeaders),this.validateShowColumnHeaders(this.showColumnHeaders),this.validateShowBorders(this.showBorders)}updateGridConfig(){this.gridConfig=function(e,t){return{rows:h(e),columns:h(t)}}(this.rowHeaders,this.columnHeaders)}shouldShowRowHeaders(){return"true"===this.showRowHeaders&&this.gridConfig.rows.length>0}shouldShowColumnHeaders(){return"true"===this.showColumnHeaders&&this.gridConfig.columns.length>0}shouldShowBorders(){return"true"===this.showBorders}getGridTemplateColumns(){const e=[];this.shouldShowRowHeaders()&&e.push(this.rowHeaderWidth);const t=this.gridConfig.columns.length||1;for(let s=0;s<t;s++)e.push("auto");return e.join(" ")}getGridTemplateRows(){const e=[];this.chartTitle&&e.push("auto"),this.shouldShowColumnHeaders()&&e.push("auto");const t=this.gridConfig.rows.length||1;for(let s=0;s<t;s++)e.push("auto");return e.join(" ")}renderTitle(){if(!this.chartTitle)return null;const e=(this.shouldShowRowHeaders()?1:0)+this.gridConfig.columns.length;return s("div",{class:"grid-title",style:{"grid-column":"1 / span "+e,"grid-row":"1"}},this.chartTitle)}renderColumnHeaders(){if(!this.shouldShowColumnHeaders())return null;const e=this.getGridStyle(),t=this.shouldShowBorders()?`${e.borderWidth}px solid ${e.borderColor}`:"none",r=this.shouldShowRowHeaders()?2:1,i=this.chartTitle?2:1;return this.gridConfig.columns.map(((o,n)=>{const d=n>0;return s("div",{key:"col-header-"+o.id,class:"grid-header grid-header-col",style:{"grid-column":r+n+"","grid-row":i+"","border-left":d?t:"none",padding:e.cellPadding+"px","padding-left":d?e.cellPadding+4+"px":e.cellPadding+"px"}},o.label)}))}renderDataCells(){const e=this.getGridStyle(),t=this.shouldShowBorders()?`${e.borderWidth}px solid ${e.borderColor}`:"none",r=this.shouldShowRowHeaders()?2:1,i=(this.chartTitle?1:0)+(this.shouldShowColumnHeaders()?1:0)+1,o=[];return this.gridConfig.rows.length>0&&this.gridConfig.columns.length>0&&this.gridConfig.rows.forEach(((n,d)=>{if(this.shouldShowRowHeaders()){const r=d>0;o.push(s("div",{key:"row-header-"+n.id,class:"grid-header grid-header-row",style:{"grid-column":"1","grid-row":i+d+"","border-top":r?t:"none",padding:e.cellPadding+"px","padding-top":r?e.cellPadding+4+"px":e.cellPadding+"px"}},n.label))}this.gridConfig.columns.forEach(((a,l)=>{const h=function(e,t){return`${e.id}-${t.id}`}(n,a),u=l>0,c=d>0;o.push(s("div",{key:"cell-"+h,class:"grid-cell",style:{"grid-column":r+l+"","grid-row":i+d+"","border-left":u?t:"none","border-top":c?t:"none","padding-left":u?e.cellPadding+4+"px":"0","padding-top":c?e.cellPadding+4+"px":"0"}},s("slot",{name:h})))}))})),o}getFontStyles(){return this.componentStyle((e=>{var t,s,r,i;return{"--bn-font-family":(null===(t=e.global)||void 0===t?void 0:t.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":((null===(s=e.global)||void 0===s?void 0:s.fontSizePx)||13.3333)+"px","--bn-font-color":(null===(r=e.global)||void 0===r?void 0:r.fontColor)||"#000000","--bn-font-background":(null===(i=e.global)||void 0===i?void 0:i.fontBackgroundColor)||"#ffffff"}}))}render(){const e={display:"inline-grid","grid-template-columns":this.getGridTemplateColumns(),"grid-template-rows":this.getGridTemplateRows(),gap:this.cellGap};return s(r,{key:"9522911b83a725994d62b657469bfcdbcae4a795",style:this.getFontStyles()},s("div",{key:"c3d4fe8e552c31b0e10ca930a784867e1f711d01",class:"grid-container",style:e},this.renderTitle(),this.renderColumnHeaders(),this.renderDataCells()),s("slot",{key:"9772d659471df1d3588a1372fedd09d6b3bb459d"}))}get element(){return this}static get watchers(){return{rowHeaders:[{validateRowHeaders:0}],columnHeaders:[{validateColumnHeaders:0}],showRowHeaders:[{validateShowRowHeaders:0}],showColumnHeaders:[{validateShowColumnHeaders:0}],showBorders:[{validateShowBorders:0}]}}static get style(){return':host{display:inline-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)}.grid-container{display:inline-grid;box-sizing:border-box}.grid-title{font-weight:normal;padding-bottom:8px}.grid-header{display:flex;align-items:flex-end;box-sizing:border-box}.grid-header-row{justify-content:flex-end;padding-right:8px}.grid-header-col{white-space:nowrap;justify-content:flex-start}.grid-cell{position:relative;box-sizing:border-box}'}},[257,"bn-grid",{chartTitle:[1,"chart-title"],rowHeaders:[1,"row-headers"],columnHeaders:[1,"column-headers"],showRowHeaders:[1,"show-row-headers"],showColumnHeaders:[1,"show-column-headers"],i18nNamespace:[513,"i18n-namespace"],showBorders:[1,"show-borders"],rowHeaderWidth:[1,"row-header-width"],cellGap:[1,"cell-gap"],gridConfig:[32]},void 0,{rowHeaders:[{validateRowHeaders:0}],columnHeaders:[{validateColumnHeaders:0}],showRowHeaders:[{validateShowRowHeaders:0}],showColumnHeaders:[{validateShowColumnHeaders:0}],showBorders:[{validateShowBorders:0}]}]),w=c,m=function(){"undefined"!=typeof customElements&&["bn-grid"].forEach((e=>{"bn-grid"===e&&(customElements.get(i(e))||customElements.define(i(e),c))}))};export{w as BnGrid,m as defineCustomElement}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{proxyCustomElement as t,HTMLElement as e,h as i,Fragment as r,transformTag as s}from"@stencil/core/internal/client";import{g as a}from"./context-protocol.js";import{a as o}from"./withHasError.js";import{a as n}from"./withTranslation.js";import{d as
|
|
1
|
+
import{proxyCustomElement as t,HTMLElement as e,h as i,Fragment as r,transformTag as s}from"@stencil/core/internal/client";import{g as a}from"./context-protocol.js";import{a as o}from"./withHasError.js";import{a as n}from"./withTranslation.js";import{d as l}from"./bn-body2.js";import{d as c}from"./bn-card2.js";import{d}from"./bn-footer2.js";import{d as h}from"./bn-title2.js";import{d as m}from"./ibcs-title2.js";const b=t(class extends e{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.titleImage="",this.titleBusinessUnit="",this.titleOrder="category",this.titleOrderDirection="asc",this.titleDateFormat="none",this.titleDateLink="none",this.footerText="",this.cardLayout="full",this.cardCustomTemplate='"a b" "c d"',this.cardGridGap="0",this.cardFitToContent=!1,this.cardShowBorder=!0,this.templateMap=new Map([["split-vertical",'"a b"'],["split-horizontal",'"a" "b"'],["2x2",'"a b" "c d"'],["3x3",'"a b c" "d e f" "g h i"'],["4x4",'"a b c d" "e f g h" "i j k l" "m n o p"'],["1-over-2",'"a a" "b c"'],["2-over-1",'"a b" "c c"'],["1-over-3",'"a a a " "b c d"'],["3-over-1",'"a b c" "d d d"'],["custom-template",'"a b" "c c c"'],["gold3",'"a c" "b c"'],["gold4",'"a b c c" "d d c c"']]),this.errors=o(this),this.resolveInherited=n(this,[{propName:"titleScenarios",ancestorAttr:"title-scenarios"},{propName:"titleVariances",ancestorAttr:"title-variances"},{propName:"titleOrder",ancestorAttr:"title-order"},{propName:"titleOrderDirection",ancestorAttr:"title-order-direction"},{propName:"ruleset",ancestorAttr:"ruleset"}])}connectedCallback(){this.stores=a(this.element),this.reflectInheritedAttrs()}getCommonStyles(){let t="100%";return!0===this.cardFitToContent&&(t="fit-content"),{display:"grid",height:t,width:"100%",gap:this.cardGridGap+"px"}}calculateFractions(t){const e=t.trim().split(/\s+/).length;return 0===e?"minmax(0, 1fr)":Array(e).fill("minmax(0, 1fr)").join(" ")}getGridTemplateColumns(t){const e=this.getTemplatePattern(t).match(/"[\w\d\s.]+"/g);return e&&0!==e.length?this.calculateFractions(e[0]):"minmax(0, 1fr)"}getRowCount(t){const e=this.getTemplatePattern(t).match(/"[\w\d\s.]+"/g);return e?e.length:1}getGridTemplateRows(t){const e=this.getRowCount(t);return this.cardFitToContent?Array(e).fill("auto").join(" "):Array(e).fill("minmax(0, 1fr)").join(" ")}getLayoutStyle(){return Object.assign(Object.assign({},this.getCommonStyles()),{"grid-template-areas":this.getTemplatePattern(this.cardLayout),"grid-template-columns":this.getGridTemplateColumns(this.cardLayout),"grid-template-rows":this.getGridTemplateRows(this.cardLayout)})}createDivAreaStyles(t){return t.map((t=>({display:"flex",overflow:"hidden","grid-area":t})))}getSlots(t){const e=this.createDivAreaStyles(t);return i(r,null,e.map(((t,e)=>i("div",{style:t},i("slot",{name:"card-slot-"+e})))))}extractSlotNames(t){if(null==t)return[];const e=t.match(/\b\w+\b/g);return e?Array.from(new Set(e)):[]}getTemplatePattern(t){return!1===this.templateMap.has(t)&&"custom-template"!==t?'"a"':"custom-template"===t?this.cardCustomTemplate:this.templateMap.get(t)}async getNumberOfSlot(t){const e=this.getTemplatePattern(t);return this.extractSlotNames(e).length}componentDidUpdate(){}setCardClass(){return!0===this.cardShowBorder?"card_box border":"card_box"}reflectInheritedAttrs(){const t=[{prop:"titleScenarios",attr:"title-scenarios"},{prop:"titleVariances",attr:"title-variances"},{prop:"titleOrder",attr:"title-order"},{prop:"titleOrderDirection",attr:"title-order-direction"},{prop:"ruleset",attr:"ruleset"}];for(const{prop:e,attr:i}of t){const t=this.resolveInherited(e,this[e]);void 0!==t&&this.element.setAttribute(i,t)}}prepareTitleImage(t){if(null==t||""===t)return"";const e=this.stores.assets.state;return t.startsWith("asset:")?e[t.substring(6)]:e[t]||t}render(){var t,e,r,s,a,o;const n=this.getLayoutStyle(),l=this.extractSlotNames(n["grid-template-areas"]);return i("bn-card",{key:"2aa7bd3e3beb1a6b6b0dc0b06c7d7eda324299a0",styles:this.styles,"selected-style":this.selectedStyle,class:this.setCardClass()},i("div",{key:"65fe54ff342691b7f2b7df747af88499ffdbebc0",class:"cardtitle"},i("bn-title",{key:"be70a8c4e5cef0be0fb264fe74dc3732c2a42939","i18n-namespace":null!==(t=this.i18nNamespace)&&void 0!==t?t:this.titleNamespace,ruleset:null!==(e=this.resolveInherited("ruleset",this.ruleset))&&void 0!==e?e:this.ruleset,"business-unit":this.titleBusinessUnit,scenarios:null!==(r=this.resolveInherited("titleScenarios",this.titleScenarios))&&void 0!==r?r:this.titleScenarios,variances:null!==(s=this.resolveInherited("titleVariances",this.titleVariances))&&void 0!==s?s:this.titleVariances,order:null!==(a=this.resolveInherited("titleOrder",this.titleOrder))&&void 0!==a?a:this.titleOrder,"order-direction":null!==(o=this.resolveInherited("titleOrderDirection",this.titleOrderDirection))&&void 0!==o?o:this.titleOrderDirection,measures:this.titleMeasures,"date-start":this.titleDateStart,"date-end":this.titleDateEnd,"date-format":this.titleDateFormat,"date-link":this.titleDateLink}),null!=this.titleImage&&""!==this.titleImage?i("img",{class:"image",src:this.prepareTitleImage(this.titleImage)}):""),i("bn-body",{key:"5875c3e62ca38095588f13907936974259816215"},i("div",{key:"c845d5f8c130f2dd0ae48fc4c2301a55842f001a",style:n,"data-bn-fit-content":this.cardFitToContent?this.getRowCount(this.cardLayout)+"":null},this.getSlots(l))),i("bn-footer",{key:"388596894d04dc2f93d6d71b9f8a0348fb46195f",text:this.footerText,"page-number":0,"display-page-number":"false"}))}get element(){return this}static get style(){return':host{background:var(--bn-font-background, white);color:var(--bn-font-color, black);font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);display:flex;flex-direction:column;width:100%;height:100%;overflow:hidden}.cardtitle{display:inline-flex}::slotted(*){flex:1 1 auto;min-width:0}.image{margin-right:0.5em;margin-top:0.5em;z-index:2;background-color:transparent;border:transparent;height:4em;width:auto;display:inline}'}},[257,"bn-layout-card",{styles:[1],selectedStyle:[1,"selected-style"],ruleset:[1],titleImage:[1,"title-image"],titleBusinessUnit:[1,"title-business-unit"],titleScenarios:[1,"title-scenarios"],titleVariances:[1,"title-variances"],titleOrder:[1,"title-order"],titleOrderDirection:[1,"title-order-direction"],titleMeasures:[1,"title-measures"],titleDateStart:[1,"title-date-start"],titleDateEnd:[1,"title-date-end"],titleDateFormat:[1,"title-date-format"],titleDateLink:[1,"title-date-link"],titleNamespace:[1,"title-namespace"],i18nNamespace:[513,"i18n-namespace"],footerText:[1,"footer-text"],cardLayout:[1,"card-layout"],cardCustomTemplate:[1,"card-custom-template"],cardGridGap:[1,"card-grid-gap"],cardFitToContent:[4,"card-fit-to-content"],cardShowBorder:[4,"card-show-border"],getNumberOfSlot:[64]}]),u=b,p=function(){"undefined"!=typeof customElements&&["bn-layout-card","bn-body","bn-card","bn-footer","bn-title","ibcs-title"].forEach((t=>{switch(t){case"bn-layout-card":customElements.get(s(t))||customElements.define(s(t),b);break;case"bn-body":customElements.get(s(t))||l();break;case"bn-card":customElements.get(s(t))||c();break;case"bn-footer":customElements.get(s(t))||d();break;case"bn-title":customElements.get(s(t))||h();break;case"ibcs-title":customElements.get(s(t))||m()}}))};export{u as BnLayoutCard,p as defineCustomElement}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{proxyCustomElement as t,HTMLElement as e,h as s,Fragment as a,transformTag as i}from"@stencil/core/internal/client";import{a as r}from"./withHasError.js";import{d as n}from"./bn-body2.js";import{d as o}from"./bn-footer2.js";import{d as l}from"./bn-message2.js";import{d as c}from"./bn-page2.js";import{d as m}from"./bn-title2.js";import{d
|
|
1
|
+
import{proxyCustomElement as t,HTMLElement as e,h as s,Fragment as a,transformTag as i}from"@stencil/core/internal/client";import{a as r}from"./withHasError.js";import{d as n}from"./bn-body2.js";import{d as o}from"./bn-footer2.js";import{d as l}from"./bn-message2.js";import{d as c}from"./bn-page2.js";import{d as m}from"./bn-title2.js";import{d}from"./ibcs-title2.js";const b=t(class extends e{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.messageText="",this.messageImage="",this.titleBusinessUnit="",this.titleOrder="category",this.titleOrderDirection="asc",this.titleDateFormat="none",this.titleDateLink="none",this.footerDisplayPageNumber=!0,this.pageLayout="full",this.pageCustomTemplate='"a b" "c d"',this.pageGridGap="0",this.pageFitToContent=!1,this.templateMap=new Map([["split-vertical",'"a b"'],["split-horizontal",'"a" "b"'],["2x2",'"a b" "c d"'],["3x3",'"a b c" "d e f" "g h i"'],["4x4",'"a b c d" "e f g h" "i j k l" "m n o p"'],["1-over-2",'"a a" "b c"'],["2-over-1",'"a b" "c c"'],["1-over-3",'"a a a " "b c d"'],["3-over-1",'"a b c" "d d d"'],["custom-template",'"a b" "c c c"'],["gold3",'"a c" "b c"'],["gold4",'"a b c c" "d d c c"']]),this.errors=r(this)}getCommonStyles(){let t="100%";return!0===this.pageFitToContent&&(t="fit-content"),{display:"grid",height:t,width:"100%",gap:this.pageGridGap+"px"}}getRowCount(t){const e=this.getTemplateAreas(t).match(/"[\w\d\s.]+"/g);return e?e.length:1}getGridTemplateRows(t){const e=this.getRowCount(t);return this.pageFitToContent?Array(e).fill("auto").join(" "):Array(e).fill("minmax(0, 1fr)").join(" ")}getLayoutStyle(){return Object.assign(Object.assign({},this.getCommonStyles()),{"grid-template-areas":this.getTemplateAreas(this.pageLayout),"grid-template-columns":this.getGridTemplateColumns(this.pageLayout),"grid-template-rows":this.getGridTemplateRows(this.pageLayout)})}createDivAreaStyles(t){return t.map((t=>({display:"flex",overflow:"hidden","grid-area":t})))}getSlots(t){const e=this.createDivAreaStyles(t);return s(a,null,e.map(((t,e)=>s("div",{style:t},s("slot",{name:"slot-"+e})))))}extractSlotNames(t){if(null==t)return[];const e=t.match(/\b\w+\b/g);return e?Array.from(new Set(e)):[]}getTemplateAreas(t){return!1===this.templateMap.has(t)&&"custom-template"!==t?'"a"':"custom-template"===t?this.pageCustomTemplate:this.templateMap.get(t)}calculateFractions(t){const e=t.trim().split(/\s+/).length;return 0===e?"minmax(0, 1fr)":Array(e).fill("minmax(0, 1fr)").join(" ")}getGridTemplateColumns(t){if(!1===this.templateMap.has(t)&&"custom-template"!==t)return"1fr";let e;e="custom-template"===t?this.pageCustomTemplate:this.templateMap.get(t);const s=e.match(/"[\w\d\s.]+"/g);return this.calculateFractions(s[0])}async getNumberOfSlot(t){const e=this.getTemplateAreas(t);return this.extractSlotNames(e).length}componentDidUpdate(){const t=this.element.closest("bn-context").getAttribute("render-orientation");if(t&&t!==this.pageOrientation){const t=this.element.shadowRoot.querySelector("bn-page"),e=this.element.closest("bn-layout-page");e&&t&&(t.style.transform="rotate(-90deg) translate(-100%)",t.style.transformOrigin="top left",e.style.width=t.clientHeight+"px",e.style.height=t.clientWidth+"px")}}render(){var t;const e=this.getLayoutStyle(),a=this.extractSlotNames(e["grid-template-areas"]);return s("bn-page",{key:"6ce75e58dfb8ccab0686d8f34cc6f7830fd42db7",styles:this.styles,"selected-style":this.selectedStyle,format:this.pageFormat,orientation:this.pageOrientation},s("bn-message",{key:"0b7f297afe281b0df05691485a93ba6c3d8abbae",text:this.messageText,image:this.messageImage}),s("bn-title",{key:"b02de31fa8f7e03c38e12cd45ec7f02e2d986d70","i18n-namespace":null!==(t=this.i18nNamespace)&&void 0!==t?t:this.titleNamespace,ruleset:this.ruleset,"business-unit":this.titleBusinessUnit,scenarios:this.titleScenarios,variances:this.titleVariances,order:this.titleOrder,"order-direction":this.titleOrderDirection,measures:this.titleMeasures,"date-start":this.titleDateStart,"date-end":this.titleDateEnd,"date-format":this.titleDateFormat,"date-link":this.titleDateLink}),s("bn-body",{key:"8d43429effcb755ee69665820120838c60b8b9d1"},s("div",{key:"f2d61818b1272551c73bf174f91f61904799a780",style:e,"data-bn-fit-content":this.pageFitToContent?this.getRowCount(this.pageLayout)+"":null},this.getSlots(a))),s("bn-footer",{key:"8d6a6d76c7bef823ee7063586e87084654705771",text:this.footerText,"page-number":this.pageNumber,"display-page-number":this.footerDisplayPageNumber}))}get element(){return this}static get style(){return':host{background:var(--bn-font-background, white);color:var(--bn-font-color, black);font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);display:block;overflow:hidden}::slotted(*){flex:1 1 auto;min-width:0}'}},[257,"bn-layout-page",{styles:[1],selectedStyle:[1,"selected-style"],ruleset:[1],messageText:[1,"message-text"],messageImage:[1,"message-image"],titleBusinessUnit:[1,"title-business-unit"],titleScenarios:[1,"title-scenarios"],titleVariances:[1,"title-variances"],titleOrder:[1,"title-order"],titleOrderDirection:[1,"title-order-direction"],titleMeasures:[1,"title-measures"],titleDateStart:[1,"title-date-start"],titleDateEnd:[1,"title-date-end"],titleDateFormat:[1,"title-date-format"],titleDateLink:[1,"title-date-link"],titleNamespace:[1,"title-namespace"],i18nNamespace:[513,"i18n-namespace"],pageFormat:[1,"page-format"],pageOrientation:[1,"page-orientation"],pageNumber:[1,"page-number"],footerText:[1,"footer-text"],footerDisplayPageNumber:[4,"footer-display-page-number"],pageLayout:[1,"page-layout"],pageCustomTemplate:[1,"page-custom-template"],pageGridGap:[1,"page-grid-gap"],pageFitToContent:[4,"page-fit-to-content"],getNumberOfSlot:[64]}]),h=b,p=function(){"undefined"!=typeof customElements&&["bn-layout-page","bn-body","bn-footer","bn-message","bn-page","bn-title","ibcs-title"].forEach((t=>{switch(t){case"bn-layout-page":customElements.get(i(t))||customElements.define(i(t),b);break;case"bn-body":customElements.get(i(t))||n();break;case"bn-footer":customElements.get(i(t))||o();break;case"bn-message":customElements.get(i(t))||l();break;case"bn-page":customElements.get(i(t))||c();break;case"bn-title":customElements.get(i(t))||m();break;case"ibcs-title":customElements.get(i(t))||d()}}))};export{h as BnLayoutPage,p as defineCustomElement}
|