@bino-bi/bn-template-engine 1.0.0-alpha.7 → 1.0.0-alpha.8

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.
Files changed (107) hide show
  1. package/dist/bn-template-engine/bn-template-engine.esm.js +1 -1
  2. package/dist/bn-template-engine/p-0d41c5d8.entry.js +1 -0
  3. package/dist/bn-template-engine/p-67538176.entry.js +1 -0
  4. package/dist/bn-template-engine/p-825a07a8.entry.js +1 -0
  5. package/dist/bn-template-engine/p-916296a5.entry.js +1 -0
  6. package/dist/bn-template-engine/{p-1164c0b0.entry.js → p-96006b06.entry.js} +1 -1
  7. package/dist/bn-template-engine/p-B4JfKvVT.js +1 -0
  8. package/dist/bn-template-engine/{p-JNHhIe7t.js → p-B_d-jp99.js} +1 -1
  9. package/dist/bn-template-engine/p-Ck-NYtot.js +1 -0
  10. package/dist/bn-template-engine/p-CnDq0oVa.js +1 -0
  11. package/dist/bn-template-engine/p-DSXNgKLa.js +1 -0
  12. package/dist/bn-template-engine/p-bc711fb0.entry.js +1 -0
  13. package/dist/bn-template-engine/p-e6f646b1.entry.js +1 -0
  14. package/dist/bn-template-engine/p-f41d9242.entry.js +1 -0
  15. package/dist/bn-template-engine/{p-B0lsgVuN.js → p-gFbbuhtl.js} +1 -1
  16. package/dist/cjs/{SVGVariancesStyleGroup-BqAdPYtL.js → bn-asset_20.cjs.entry.js} +21948 -6938
  17. package/dist/cjs/bn-grid.cjs.entry.js +6 -9
  18. package/dist/cjs/bn-image.cjs.entry.js +6 -9
  19. package/dist/cjs/bn-internationalization.cjs.entry.js +5 -6
  20. package/dist/cjs/bn-template-engine.cjs.js +2 -2
  21. package/dist/cjs/bn-template.cjs.entry.js +3 -4
  22. package/dist/cjs/bn-text.cjs.entry.js +7 -10
  23. package/dist/cjs/bn-tree.cjs.entry.js +6 -9
  24. package/dist/cjs/{context-protocol-DRQWrwsA.js → context-protocol-ohYzcb5F.js} +1 -1
  25. package/dist/cjs/editor-companion.cjs.entry.js +2 -2
  26. package/dist/cjs/{index-Cjw0q6gP.js → index-CDKG4xmO.js} +1 -0
  27. package/dist/cjs/loader.cjs.js +2 -2
  28. package/dist/cjs/{scaling-BidPsO53.js → scaling-CIAClQR5.js} +3 -3
  29. package/dist/cjs/{withBodyObserver-C6gLgq_e.js → withBodyObserver-D7BKWN2N.js} +2 -2
  30. package/dist/cjs/{withHasError-B8gHkfV2.js → withHasError-Cl2gTQzA.js} +106 -2
  31. package/dist/cjs/{Order-BGx39pS5.js → withStyled-qd94SSb4.js} +648 -6
  32. package/dist/collection/components/bn-chart-structure/bn-chart-structure.js +20 -4
  33. package/dist/collection/components/bn-chart-time/bn-chart-time.js +20 -4
  34. package/dist/collection/components/bn-layout-card/bn-layout-card.js +12 -6
  35. package/dist/collection/components/bn-layout-page/bn-layout-page.js +12 -7
  36. package/dist/collection/components/bn-table/bn-table.js +25 -7
  37. package/dist/collection/components/bn-table/ibcs-table.js +68 -3
  38. package/dist/components/bn-chart-structure.js +1 -1
  39. package/dist/components/bn-chart-time.js +1 -1
  40. package/dist/components/bn-layout-card.js +1 -1
  41. package/dist/components/bn-layout-page.js +1 -1
  42. package/dist/components/bn-table.js +1 -1
  43. package/dist/components/ibcs-table2.js +1 -1
  44. package/dist/esm/{SVGVariancesStyleGroup-DOIT-zvI.js → bn-asset_20.entry.js} +22048 -7042
  45. package/dist/esm/bn-grid.entry.js +4 -7
  46. package/dist/esm/bn-image.entry.js +4 -7
  47. package/dist/esm/bn-internationalization.entry.js +4 -5
  48. package/dist/esm/bn-template-engine.js +3 -3
  49. package/dist/esm/bn-template.entry.js +2 -3
  50. package/dist/esm/bn-text.entry.js +5 -8
  51. package/dist/esm/bn-tree.entry.js +4 -7
  52. package/dist/esm/{context-protocol-2peaD4y8.js → context-protocol-DdbSplvE.js} +2 -2
  53. package/dist/esm/editor-companion.entry.js +2 -2
  54. package/dist/esm/{index-JNHhIe7t.js → index-B_d-jp99.js} +1 -1
  55. package/dist/esm/loader.js +3 -3
  56. package/dist/esm/{scaling-BOcjT8M0.js → scaling-DGKKkuL9.js} +4 -4
  57. package/dist/esm/{withBodyObserver-DczL5ia8.js → withBodyObserver-AFk2wwHT.js} +2 -2
  58. package/dist/esm/{withHasError-B3QX2emi.js → withHasError-DW_vMDUp.js} +106 -2
  59. package/dist/esm/{Order-sRO-lj7X.js → withStyled-BIkqU2w4.js} +616 -1
  60. package/dist/types/components/bn-chart-structure/bn-chart-structure.d.ts +1 -0
  61. package/dist/types/components/bn-chart-time/bn-chart-time.d.ts +1 -0
  62. package/dist/types/components/bn-layout-card/bn-layout-card.d.ts +8 -2
  63. package/dist/types/components/bn-layout-page/bn-layout-page.d.ts +8 -3
  64. package/dist/types/components/bn-table/ibcs-table.d.ts +19 -0
  65. package/dist/types/components.d.ts +8 -8
  66. package/package.json +1 -1
  67. package/dist/bn-template-engine/p-0fabe296.entry.js +0 -1
  68. package/dist/bn-template-engine/p-355abdf0.entry.js +0 -1
  69. package/dist/bn-template-engine/p-79KuA4Ox.js +0 -1
  70. package/dist/bn-template-engine/p-859cc06d.entry.js +0 -1
  71. package/dist/bn-template-engine/p-8acec99e.entry.js +0 -1
  72. package/dist/bn-template-engine/p-8f490c45.entry.js +0 -1
  73. package/dist/bn-template-engine/p-9721a5bb.entry.js +0 -1
  74. package/dist/bn-template-engine/p-9a564f8f.entry.js +0 -1
  75. package/dist/bn-template-engine/p-9cee22fa.entry.js +0 -1
  76. package/dist/bn-template-engine/p-B7p8beYH.js +0 -1
  77. package/dist/bn-template-engine/p-BDh7GfC5.js +0 -1
  78. package/dist/bn-template-engine/p-BoMtoHJB.js +0 -1
  79. package/dist/bn-template-engine/p-Bs8BqBsb.js +0 -1
  80. package/dist/bn-template-engine/p-CYjZRKdI.js +0 -1
  81. package/dist/bn-template-engine/p-DG-1MR_T.js +0 -1
  82. package/dist/bn-template-engine/p-Dnkv5rt8.js +0 -1
  83. package/dist/bn-template-engine/p-bdd2b243.entry.js +0 -1
  84. package/dist/bn-template-engine/p-f27995c9.entry.js +0 -1
  85. package/dist/bn-template-engine/p-f6ecb265.entry.js +0 -1
  86. package/dist/bn-template-engine/p-sRO-lj7X.js +0 -1
  87. package/dist/bn-template-engine/p-tzFCK9qn.js +0 -1
  88. package/dist/cjs/bn-asset_16.cjs.entry.js +0 -9099
  89. package/dist/cjs/bn-card.cjs.entry.js +0 -36
  90. package/dist/cjs/bn-chart-time.cjs.entry.js +0 -1031
  91. package/dist/cjs/bn-layout-card.cjs.entry.js +0 -279
  92. package/dist/cjs/formatter-4XCS0d2B.js +0 -221
  93. package/dist/cjs/ibcs-chart-time.cjs.entry.js +0 -4137
  94. package/dist/cjs/withComponentStatus-_x4LQZ0N.js +0 -109
  95. package/dist/cjs/withComponentStyle-ClSJfCku.js +0 -128
  96. package/dist/cjs/withInheritedProps-BH2KNER3.js +0 -157
  97. package/dist/cjs/withStyled-9tG024gQ.js +0 -522
  98. package/dist/esm/bn-asset_16.entry.js +0 -9082
  99. package/dist/esm/bn-card.entry.js +0 -34
  100. package/dist/esm/bn-chart-time.entry.js +0 -1029
  101. package/dist/esm/bn-layout-card.entry.js +0 -277
  102. package/dist/esm/formatter-BDh7GfC5.js +0 -215
  103. package/dist/esm/ibcs-chart-time.entry.js +0 -4135
  104. package/dist/esm/withComponentStatus-DodoSXe-.js +0 -107
  105. package/dist/esm/withComponentStyle-D3VWOsto.js +0 -126
  106. package/dist/esm/withInheritedProps-BlXDxhHK.js +0 -154
  107. package/dist/esm/withStyled-CE3_3taP.js +0 -495
@@ -1,277 +0,0 @@
1
- import { r as registerInstance, h, F as Fragment, g as getElement } from './index-JNHhIe7t.js';
2
- import { a as getStores } from './context-protocol-2peaD4y8.js';
3
- import { w as withHasError } from './withHasError-B3QX2emi.js';
4
- import { w as withInheritedProps } from './withInheritedProps-BlXDxhHK.js';
5
-
6
- const bnLayoutCardCss = () => `: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;flex-direction:column;overflow:hidden;float:left;clear:left}.cardtitle{display:inline-flex}.image{margin-right:0.5em;margin-top:0.5em;z-index:2;background-color:transparent;border:transparent;height:4em;width:auto;display:inline}`;
7
-
8
- const LayoutCard = class {
9
- constructor(hostRef) {
10
- registerInstance(this, hostRef);
11
- /**
12
- * URL or asset name of the image displayed next to the card title.
13
- * The value is resolved via the scoped assets store: if it matches a
14
- * registered asset name, the stored URL is used; otherwise the raw value
15
- * is treated as a URL. The deprecated `asset:` prefix is still supported
16
- * for backward compatibility.
17
- * <br /><br />
18
- * If empty, the title image is omitted.
19
- *
20
- * @example
21
- * <bn-layout-card title-image="company_logo"></bn-layout-card>
22
- */
23
- this.titleImage = "";
24
- /**
25
- * Name of the business unit displayed in the title header row.
26
- * If empty, the business unit row is omitted.
27
- *
28
- * @example
29
- * <bn-layout-card title-business-unit="Sales"></bn-layout-card>
30
- */
31
- this.titleBusinessUnit = "";
32
- /**
33
- * Primary column on which the order direction is applied.
34
- * <br /><br />
35
- * values:<br />
36
- * ```category // categoryindex // rowgroup // rowgroupindex // ac // fc // py // pl```
37
- */
38
- this.titleOrder = "category";
39
- /**
40
- * Sorting order direction for the column specified by `titleOrder`.
41
- * <br /><br />
42
- * values:<br />
43
- * ```asc // desc```
44
- */
45
- this.titleOrderDirection = "asc";
46
- /**
47
- * Date display format used in the title row.
48
- * <br /><br />
49
- * values:<br />
50
- * ```year // quarter // month // week // day // time // auto // none```
51
- * <br /><br />
52
- * `year`: YYYY, `quarter`: Q[Q] YYYY, `month`: MMM YYYY,
53
- * `week`: [KW]WW YYYY, `day`: DD.MM.YYYY, `time`: DD.MM.YYYY HH:mm:ss,
54
- * `auto`: automatic detection, `none`: DD.MM.YYYY.
55
- */
56
- this.titleDateFormat = "none";
57
- /**
58
- * Format in which the start and end dates are linked in the title.
59
- * If set to `none` a plain date is shown.
60
- * <br /><br />
61
- * values:<br />
62
- * ```avg // interval // cum // start // end // ytd // ytg // mat // none```
63
- * <br /><br />
64
- * `avg`: Ø[DATE], `interval`: [DATE]..[DATE2], `start`: .[DATE],
65
- * `end`: [DATE]., `ytd`: _[DATE], `ytg`: [DATE]_, `cum`: [DATE]_[DATE2],
66
- * `mat`: ~[DATE], `none`: [DATE].
67
- */
68
- this.titleDateLink = "none";
69
- /**
70
- * Namespace used for title translations via the internationalization store.
71
- */
72
- this.titleNamespace = "_system";
73
- /**
74
- * Text displayed in the card footer. If empty, the footer text is omitted.
75
- */
76
- this.footerText = "";
77
- /**
78
- * Layout mode that controls how child components are arranged inside
79
- * the card body using CSS Grid.
80
- * <br /><br />
81
- * values:<br />
82
- * ```full // split-vertical // split-horizontal // 2x2 // 3x3 // 4x4 // 1-over-2 // 1-over-3 // 2-over-1 // 3-over-1 // custom-template```
83
- * <br /><br />
84
- * `full`: single slot. `split-vertical`: two side-by-side slots.
85
- * `split-horizontal`: two stacked slots. `NxN`: equal grid.
86
- * `1-over-2`: one full-width slot on top, two below. `custom-template`:
87
- * uses the `cardCustomTemplate` CSS grid-template-areas string.
88
- *
89
- * @example
90
- * <bn-layout-card card-layout="split-horizontal"></bn-layout-card>
91
- */
92
- this.cardLayout = "full";
93
- /**
94
- * CSS `grid-template-areas` string used when `cardLayout` is set to
95
- * `custom-template`. Each quoted row defines a grid row; letters map to
96
- * slot indices in order of first appearance.
97
- *
98
- * @example
99
- * <bn-layout-card card-layout="custom-template"
100
- * card-custom-template='"a a" "b c"'></bn-layout-card>
101
- */
102
- this.cardCustomTemplate = '"a b" "c d"';
103
- /**
104
- * Gap between grid cells in pixels.
105
- */
106
- this.cardGridGap = "0";
107
- /**
108
- * When `true`, the card shrinks to fit its content (`fit-content`)
109
- * for both width and height. When `false`, the card stretches to
110
- * fill its parent (`100%`).
111
- */
112
- this.cardFitToContent = true;
113
- /**
114
- * Whether to display a visible border around the card.
115
- */
116
- this.cardShowBorder = true;
117
- this.templateMap = new Map([
118
- ["split-vertical", '"a b"'],
119
- ["split-horizontal", '"a" "b"'],
120
- ["2x2", '"a b" "c d"'],
121
- ["3x3", '"a b c" "d e f" "g h i"'],
122
- ["4x4", '"a b c d" "e f g h" "i j k l" "m n o p"'],
123
- ["1-over-2", '"a a" "b c"'],
124
- ["2-over-1", '"a b" "c c"'],
125
- ["1-over-3", '"a a a " "b c d"'],
126
- ["3-over-1", '"a b c" "d d d"'],
127
- ["custom-template", '"a b" "c c c"'],
128
- ["gold3", '"a c" "b c"'],
129
- ["gold4", '"a b c c" "d d c c"'],
130
- ]);
131
- this.errors = withHasError(this);
132
- this.resolveInherited = withInheritedProps(this, [
133
- { propName: "titleScenarios", ancestorAttr: "title-scenarios" },
134
- { propName: "titleVariances", ancestorAttr: "title-variances" },
135
- { propName: "titleOrder", ancestorAttr: "title-order" },
136
- { propName: "titleOrderDirection", ancestorAttr: "title-order-direction" },
137
- ]);
138
- }
139
- connectedCallback() {
140
- this.stores = getStores(this.element);
141
- // Reflect resolved inherited values to host attributes so child vis
142
- // components can read them during their own DOM traversal.
143
- this.reflectInheritedAttrs();
144
- }
145
- getCommonStyles() {
146
- let height = "100%";
147
- let width = "100%";
148
- if (this.cardFitToContent === true) {
149
- width = "fit-content";
150
- height = "fit-content";
151
- }
152
- return {
153
- display: "grid",
154
- height: height,
155
- width: width,
156
- gap: this.cardGridGap + "px",
157
- };
158
- }
159
- calculatePercentages(input) {
160
- const items = input.trim().split(/\s+/);
161
- const count = items.length;
162
- if (count === 0)
163
- return "100%";
164
- const percentage = (100 / count).toFixed(0) + "%";
165
- return Array(count).fill(percentage).join(" ");
166
- }
167
- getGridTemplateColumns(name) {
168
- const template = this.getTemplatePattern(name);
169
- const pattern = /"[\w\d\s.]+"/g;
170
- const matches = template.match(pattern);
171
- if (!matches || matches.length === 0)
172
- return "100%";
173
- return this.calculatePercentages(matches[0]);
174
- }
175
- getGridTemplateRows(name) {
176
- const template = this.getTemplatePattern(name);
177
- const pattern = /"[\w\d\s.]+"/g;
178
- const matches = template.match(pattern);
179
- const rowCount = matches ? matches.length : 1;
180
- if (this.cardFitToContent) {
181
- return Array(rowCount).fill("auto").join(" ");
182
- }
183
- return Array(rowCount).fill("1fr").join(" ");
184
- }
185
- getLayoutStyle() {
186
- 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) });
187
- }
188
- createDivAreaStyles(elements) {
189
- return elements.map((x) => ({
190
- width: "100%",
191
- overflow: "hidden",
192
- "grid-area": x,
193
- height: "100%",
194
- }));
195
- }
196
- getSlots(slotNames) {
197
- const items = this.createDivAreaStyles(slotNames);
198
- return (h(Fragment, null, items.map((value, index) => {
199
- return (h("div", { style: value }, h("slot", { name: "card-slot-" + index })));
200
- })));
201
- }
202
- extractSlotNames(styleElement) {
203
- if (styleElement == null) {
204
- return [];
205
- }
206
- const words = styleElement.match(/\b\w+\b/g);
207
- if (!words) {
208
- return [];
209
- }
210
- return Array.from(new Set(words));
211
- }
212
- getTemplatePattern(name) {
213
- if (this.templateMap.has(name) === false && name !== "custom-template") {
214
- return '"a"';
215
- }
216
- if (name === "custom-template") {
217
- return this.cardCustomTemplate;
218
- }
219
- return this.templateMap.get(name);
220
- }
221
- async getNumberOfSlot(name) {
222
- const template = this.getTemplatePattern(name);
223
- return this.extractSlotNames(template).length;
224
- }
225
- componentDidUpdate() {
226
- // workaround for the render rotation issue
227
- }
228
- setCardClass() {
229
- if (this.cardShowBorder === true) {
230
- return "card_box border";
231
- }
232
- return "card_box";
233
- }
234
- /**
235
- * When the card itself inherits a title prop from a page, write the
236
- * resolved value back to the host element's attribute so that child
237
- * vis components (bn-table, bn-chart-*) performing their own DOM walk
238
- * read the actual value instead of the literal "inherited-page" keyword.
239
- */
240
- reflectInheritedAttrs() {
241
- const mappings = [
242
- { prop: "titleScenarios", attr: "title-scenarios" },
243
- { prop: "titleVariances", attr: "title-variances" },
244
- { prop: "titleOrder", attr: "title-order" },
245
- { prop: "titleOrderDirection", attr: "title-order-direction" },
246
- ];
247
- for (const { prop, attr } of mappings) {
248
- const resolved = this.resolveInherited(prop, this[prop]);
249
- if (resolved !== undefined) {
250
- this.element.setAttribute(attr, resolved);
251
- }
252
- }
253
- }
254
- prepareTitleImage(value) {
255
- if (value == null || value === "") {
256
- return "";
257
- }
258
- const assetsState = this.stores.assets.state;
259
- // for backward compatibility deprecated "asset:" prefix
260
- if (value.startsWith("asset:")) {
261
- return assetsState[value.substring(6)];
262
- }
263
- return assetsState[value] || value;
264
- }
265
- render() {
266
- var _a, _b, _c, _d;
267
- const style = this.getLayoutStyle();
268
- const arrOfSlots = this.extractSlotNames(style["grid-template-areas"]);
269
- return (
270
- // @ts-ignore
271
- h("bn-card", { key: '1dfcca605e2780bdfbb0108a5f34ff1259ecd666', styles: this.styles, class: this.setCardClass() }, h("div", { key: '7bdf2d4d7ddc82af78fe932a2af866b3b17d8b4d', class: "cardtitle" }, h("bn-title", { key: '799fa36d7368bbc2bc446f01fa3a46c8e363dcd0', namespace: this.titleNamespace, "business-unit": this.titleBusinessUnit, scenarios: (_a = this.resolveInherited("titleScenarios", this.titleScenarios)) !== null && _a !== void 0 ? _a : this.titleScenarios, variances: (_b = this.resolveInherited("titleVariances", this.titleVariances)) !== null && _b !== void 0 ? _b : this.titleVariances, order: (_c = this.resolveInherited("titleOrder", this.titleOrder)) !== null && _c !== void 0 ? _c : this.titleOrder, "order-direction": (_d = this.resolveInherited("titleOrderDirection", this.titleOrderDirection)) !== null && _d !== void 0 ? _d : this.titleOrderDirection, measures: this.titleMeasures, "date-start": this.titleDateStart, "date-end": this.titleDateEnd, "date-format": this.titleDateFormat, "date-link": this.titleDateLink }), this.titleImage != null && this.titleImage !== "" ? (h("img", { class: "image", src: this.prepareTitleImage(this.titleImage) })) : ("")), h("bn-body", { key: '9743d34c350907dfe0561444cd548d5884224f3a' }, h("div", { key: 'a622ae652dfefaac4a86d1f71a05fe776a811430', style: style }, this.getSlots(arrOfSlots))), h("bn-footer", { key: 'ebffcd673c94d7666fe6b46216792784f3dfb988', text: this.footerText, "page-number": 0, "display-page-number": "false" })));
272
- }
273
- get element() { return getElement(this); }
274
- };
275
- LayoutCard.style = bnLayoutCardCss();
276
-
277
- export { LayoutCard as bn_layout_card };
@@ -1,215 +0,0 @@
1
- var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
2
-
3
- function getDefaultExportFromCjs (x) {
4
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
5
- }
6
-
7
- /**
8
- * Parses an IBCS variance column name into its constituent parts.
9
- *
10
- * Naming convention: `d{base}_{delta}_{sentiment}` for absolute variance,
11
- * `dr{base}_{delta}_{sentiment}` for relative (%) variance.
12
- *
13
- * Example: `"dac1_pl1_pos"` → type="d", base="ac1" (minuend), delta="pl1" (subtrahend), direction="pos"
14
- */
15
- class VarianceScenario {
16
- constructor(scenario) {
17
- /** `"d"` for absolute variance, `"dr"` for relative (percentage) variance */
18
- this.type = "";
19
- /** Minuend scenario (the value subtracted from), e.g. `"ac1"` */
20
- this.base = "";
21
- /** Subtrahend scenario (the value subtracted), e.g. `"pl1"` */
22
- this.delta = "";
23
- /** Sentiment direction: `"pos"` (favorable), `"neg"` (unfavorable), `"neu"` (neutral) */
24
- this.direction = "";
25
- this.isValid = false;
26
- /** Capture groups: [1]=type (d|dr), [2]=base scenario, [3]=delta scenario, [4]=sentiment */
27
- const scenarioTestRegex = /(d|dr)(pl\d|ac\d|fc\d|pp\d)_(pl\d|ac\d|fc\d|pp\d)_(pos|neg|neu)/;
28
- if (scenarioTestRegex.test(scenario)) {
29
- const tokens = scenarioTestRegex.exec(scenario);
30
- if (tokens != null) {
31
- this.type = String(tokens[1]);
32
- this.base = String(tokens[2]);
33
- this.delta = String(tokens[3]);
34
- this.direction = String(tokens[4]);
35
- this.isValid = true;
36
- }
37
- }
38
- }
39
- }
40
-
41
- var QueryColumnNames;
42
- (function (QueryColumnNames) {
43
- QueryColumnNames["OPERATION"] = "operation";
44
- QueryColumnNames["ROWGROUP"] = "rowGroup";
45
- QueryColumnNames["ROWGROUPINDEX"] = "rowGroupIndex";
46
- QueryColumnNames["CURRENTROW"] = "currentRow";
47
- QueryColumnNames["CATEGORY"] = "category";
48
- QueryColumnNames["CATEGORYINDEX"] = "categoryIndex";
49
- QueryColumnNames["SUBCATEGORY"] = "subCategory";
50
- QueryColumnNames["SUBCATEGORYINDEX"] = "subCategoryIndex";
51
- QueryColumnNames["COLUMNGROUP"] = "columnGroup";
52
- QueryColumnNames["COLUMNGROUPINDEX"] = "columnIndex";
53
- QueryColumnNames["COLUMNSUBGROUP"] = "columnSubGroup";
54
- QueryColumnNames["COLUMNSUBGROUPINDEX"] = "columnSubGroupIndex";
55
- QueryColumnNames["AC1"] = "ac1";
56
- QueryColumnNames["AC2"] = "ac2";
57
- QueryColumnNames["AC3"] = "ac3";
58
- QueryColumnNames["AC4"] = "ac4";
59
- QueryColumnNames["PP1"] = "pp1";
60
- QueryColumnNames["PP2"] = "pp2";
61
- QueryColumnNames["PP3"] = "pp3";
62
- QueryColumnNames["PP4"] = "pp4";
63
- QueryColumnNames["FC1"] = "fc1";
64
- QueryColumnNames["FC2"] = "fc2";
65
- QueryColumnNames["FC3"] = "fc3";
66
- QueryColumnNames["FC4"] = "fc4";
67
- QueryColumnNames["PL1"] = "pl1";
68
- QueryColumnNames["PL2"] = "pl2";
69
- QueryColumnNames["PL3"] = "pl3";
70
- QueryColumnNames["PL4"] = "pl4";
71
- QueryColumnNames["TOTALROWCOUNT"] = "totalRowCnt";
72
- QueryColumnNames["ROWNR"] = "rowNr";
73
- QueryColumnNames["TYPE"] = "type";
74
- })(QueryColumnNames || (QueryColumnNames = {}));
75
-
76
- var lib = {};
77
-
78
- var hasRequiredLib;
79
-
80
- function requireLib () {
81
- if (hasRequiredLib) return lib;
82
- hasRequiredLib = 1;
83
- function createDummyElement(text, options) {
84
- var element = document.createElement('div');
85
- var textNode = document.createTextNode(text);
86
- element.appendChild(textNode);
87
- element.style.fontFamily = options.font;
88
- element.style.fontSize = options.fontSize;
89
- element.style.fontWeight = options.fontWeight;
90
- element.style.position = 'absolute';
91
- element.style.visibility = 'hidden';
92
- element.style.left = '-999px';
93
- element.style.top = '-999px';
94
- element.style.width = options.width;
95
- element.style.height = 'auto';
96
- document.body.appendChild(element);
97
- return element;
98
- }
99
- function destroyElement(element) {
100
- element.parentNode.removeChild(element);
101
- }
102
- var cache = {};
103
- Object.defineProperty(lib, "__esModule", { value: true });
104
- lib.default = function (text, options) {
105
- if (options === void 0) { options = {}; }
106
- var cacheKey = JSON.stringify({ text: text, options: options });
107
- if (cache[cacheKey]) {
108
- return cache[cacheKey];
109
- }
110
- options.font = options.font || 'Times';
111
- options.fontSize = options.fontSize || '16px';
112
- options.fontWeight = options.fontWeight || 'normal';
113
- options.width = options.width || 'auto';
114
- var element = createDummyElement(text, options);
115
- var size = {
116
- width: element.offsetWidth,
117
- height: element.offsetHeight,
118
- };
119
- destroyElement(element);
120
- cache[cacheKey] = size;
121
- return size;
122
- };
123
-
124
- return lib;
125
- }
126
-
127
- var libExports = requireLib();
128
- var CalculateSize = /*@__PURE__*/getDefaultExportFromCjs(libExports);
129
-
130
- /**
131
- * Number and label formatting utilities following ISO 80000-1 conventions.
132
- */
133
- class Formatter {
134
- /**
135
- * Formats a number for display following ISO 80000-1 conventions.
136
- *
137
- * Pipeline: divide by scale factor -> format via de-DE locale -> strip whitespace
138
- * before `%` -> replace group separator with `postfixSeperator` -> replace decimal
139
- * separator with `tsdDelimiter`.
140
- *
141
- * @param scale Divisor applied before formatting (e.g. 1000 for "k" SI prefix).
142
- */
143
- static number(value, type = "decimal", digits = 1, digitsMin = 0, scale = 1) {
144
- const scaledValue = value / scale;
145
- return scaledValue
146
- .toLocaleString("de-DE", {
147
- style: type,
148
- useGrouping: true,
149
- maximumFractionDigits: digits,
150
- minimumFractionDigits: digitsMin,
151
- })
152
- .replace(/\s+(%)/g, "$1")
153
- .replace(/\s/g, this.postfixSeperator)
154
- .replace(/\./g, this.tsdDelimiter);
155
- }
156
- /**
157
- * Translates a technical scenario identifier into a human-readable IBCS label.
158
- *
159
- * Uses IBCS symbol conventions from the i18n map:
160
- * - AC-base absolute variance: `ibcssymbol_delta_ac` -- renders as e.g. `Delta{scenarioName}`
161
- * - AC-base relative variance: `ibcssymbol_delta_ac_relative` -- renders as e.g. `Delta(scenarioName)`
162
- * - Non-AC absolute variance: `ibcssymbol_delta_generic`
163
- * - Non-AC relative variance: `ibcssymbol_delta_generic_relative`
164
- *
165
- * The `{%}` placeholder in the i18n token is replaced with the translated scenario name(s).
166
- * Non-variance scenarios are looked up directly in the i18n map.
167
- */
168
- static translateScenarioLabel(scenario, i18n) {
169
- if (scenario === null || scenario === undefined) {
170
- return "";
171
- }
172
- const scenarios = new VarianceScenario(scenario);
173
- if (!scenarios.isValid) {
174
- return `${i18n.get(scenario) || scenario}`;
175
- }
176
- let token;
177
- let scenarioLabel;
178
- if (QueryColumnNames.AC1 === scenarios.base) {
179
- if (scenarios.type === "dr") {
180
- token = i18n.get("ibcssymbol_delta_ac" + "_relative");
181
- }
182
- else {
183
- token = i18n.get("ibcssymbol_delta_ac" + "");
184
- }
185
- scenarioLabel = i18n.get(scenarios.delta) || scenarios.delta;
186
- }
187
- else {
188
- if (scenarios.type === "dr") {
189
- token = i18n.get("ibcssymbol_delta_generic" + "_relative");
190
- }
191
- else {
192
- token = i18n.get("ibcssymbol_delta_generic" + "");
193
- }
194
- scenarioLabel = `${i18n.get(scenarios.base) || scenarios.base} - ${i18n.get(scenarios.delta) || scenarios.delta}`;
195
- }
196
- if (token === undefined) {
197
- token = "{%}";
198
- }
199
- return `${token.replace("{%}", scenarioLabel)}`;
200
- }
201
- static getMaxWidthOfArrayItems(scenarios, i18n, style) {
202
- return CalculateSize(scenarios
203
- .map((scenario) => Formatter.translateScenarioLabel(scenario, i18n))
204
- .reduce((a, b) => (a.length < b.length ? b : a), ""), {
205
- font: style.fontStyles.font,
206
- fontSize: style.fontStyles.size + "px",
207
- }).width;
208
- }
209
- }
210
- /** Replacement character for the thousands group separator (default de-DE uses period). */
211
- Formatter.tsdDelimiter = ".";
212
- /** Replacement character for the decimal separator (default de-DE uses comma). */
213
- Formatter.postfixSeperator = ",";
214
-
215
- export { CalculateSize as C, Formatter as F, QueryColumnNames as Q, VarianceScenario as V, commonjsGlobal as c, getDefaultExportFromCjs as g };