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