@bino-bi/bn-template-engine 1.0.0-alpha.5 → 1.0.0-alpha.6

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 (157) hide show
  1. package/dist/bn-template-engine/bn-template-engine.esm.js +1 -1
  2. package/dist/bn-template-engine/p-06946f44.entry.js +1 -0
  3. package/dist/bn-template-engine/p-0fabe296.entry.js +1 -0
  4. package/dist/bn-template-engine/p-1164c0b0.entry.js +1 -0
  5. package/dist/bn-template-engine/p-355abdf0.entry.js +1 -0
  6. package/dist/bn-template-engine/p-79KuA4Ox.js +1 -0
  7. package/dist/bn-template-engine/p-859cc06d.entry.js +1 -0
  8. package/dist/bn-template-engine/p-8acec99e.entry.js +1 -0
  9. package/dist/bn-template-engine/p-8f490c45.entry.js +1 -0
  10. package/dist/bn-template-engine/p-98cf512f.entry.js +1 -0
  11. package/dist/bn-template-engine/p-9a564f8f.entry.js +1 -0
  12. package/dist/bn-template-engine/{p-CL1RYuNU.js → p-B0lsgVuN.js} +1 -1
  13. package/dist/bn-template-engine/p-B7p8beYH.js +1 -0
  14. package/dist/bn-template-engine/p-BDh7GfC5.js +1 -0
  15. package/dist/bn-template-engine/p-BoMtoHJB.js +1 -0
  16. package/dist/bn-template-engine/p-Bs8BqBsb.js +1 -0
  17. package/dist/bn-template-engine/p-CYjZRKdI.js +1 -0
  18. package/dist/bn-template-engine/{p-P7pGJBgc.js → p-DG-1MR_T.js} +1 -1
  19. package/dist/bn-template-engine/p-bdd2b243.entry.js +1 -0
  20. package/dist/bn-template-engine/p-e6b24f15.entry.js +1 -0
  21. package/dist/bn-template-engine/p-f27995c9.entry.js +1 -0
  22. package/dist/bn-template-engine/{p-Bnhh02CF.js → p-sRO-lj7X.js} +1 -1
  23. package/dist/bn-template-engine/p-tzFCK9qn.js +1 -0
  24. package/dist/cjs/{Order-iG11HI4R.js → Order-BGx39pS5.js} +448 -0
  25. package/dist/cjs/{alasql.min-C_nHTuEQ.js → SVGVariancesStyleGroup-BqAdPYtL.js} +8228 -3
  26. package/dist/cjs/bn-asset_16.cjs.entry.js +9018 -0
  27. package/dist/cjs/bn-card.cjs.entry.js +3 -4
  28. package/dist/cjs/bn-chart-time.cjs.entry.js +11 -16
  29. package/dist/cjs/bn-grid.cjs.entry.js +5 -8
  30. package/dist/cjs/bn-image.cjs.entry.js +5 -8
  31. package/dist/cjs/bn-internationalization.cjs.entry.js +3 -4
  32. package/dist/cjs/bn-layout-card.cjs.entry.js +125 -6
  33. package/dist/cjs/bn-template-engine.cjs.js +1 -1
  34. package/dist/cjs/bn-template.cjs.entry.js +2 -3
  35. package/dist/cjs/bn-text.cjs.entry.js +7 -11
  36. package/dist/cjs/bn-tree.cjs.entry.js +5 -8
  37. package/dist/cjs/{formatter-DIJL_crx.js → formatter-4XCS0d2B.js} +8 -2
  38. package/dist/cjs/ibcs-chart-time.cjs.entry.js +37 -42
  39. package/dist/cjs/loader.cjs.js +1 -1
  40. package/dist/cjs/{scaling-9Tz595RQ.js → scaling-BidPsO53.js} +115 -12
  41. package/dist/cjs/{withBodyObserver-CKpSD8UT.js → withBodyObserver-C6gLgq_e.js} +3 -3
  42. package/dist/cjs/{withComponentStatus-Bw70BhO0.js → withComponentStatus-_x4LQZ0N.js} +5 -5
  43. package/dist/cjs/{withComponentStyle-aIbTCtfj.js → withComponentStyle-ClSJfCku.js} +4 -4
  44. package/dist/cjs/{utils-CwHIVbbL.js → withHasError-B8gHkfV2.js} +69 -1
  45. package/dist/cjs/{withStyled-CS1Yp4sv.js → withStyled-9tG024gQ.js} +62 -9
  46. package/dist/collection/components/bn-layout-card/bn-layout-card.css +1 -0
  47. package/dist/collection/components/bn-layout-card/bn-layout-card.js +162 -27
  48. package/dist/collection/components/bn-layout-page/bn-layout-page.css +1 -0
  49. package/dist/collection/components/bn-layout-page/bn-layout-page.js +151 -33
  50. package/dist/collection/utils/parentDimensions.js +38 -6
  51. package/dist/components/bn-layout-card.js +1 -1
  52. package/dist/components/bn-layout-page.js +1 -1
  53. package/dist/components/scaling.js +1 -1
  54. package/dist/esm/{Order-Bnhh02CF.js → Order-sRO-lj7X.js} +448 -1
  55. package/dist/esm/{alasql.min-CWu4NkIt.js → SVGVariancesStyleGroup-DOIT-zvI.js} +8212 -2
  56. package/dist/esm/bn-asset_16.entry.js +9001 -0
  57. package/dist/esm/bn-card.entry.js +4 -5
  58. package/dist/esm/bn-chart-time.entry.js +8 -13
  59. package/dist/esm/bn-grid.entry.js +6 -9
  60. package/dist/esm/bn-image.entry.js +6 -9
  61. package/dist/esm/bn-internationalization.entry.js +4 -5
  62. package/dist/esm/bn-layout-card.entry.js +126 -7
  63. package/dist/esm/bn-template-engine.js +1 -1
  64. package/dist/esm/bn-template.entry.js +2 -3
  65. package/dist/esm/bn-text.entry.js +7 -11
  66. package/dist/esm/bn-tree.entry.js +6 -9
  67. package/dist/esm/{context-protocol-BHnQsVsr.js → context-protocol-2peaD4y8.js} +1 -1
  68. package/dist/esm/editor-companion.entry.js +1 -1
  69. package/dist/esm/{formatter-DTMEZ6d8.js → formatter-BDh7GfC5.js} +6 -2
  70. package/dist/esm/ibcs-chart-time.entry.js +3 -8
  71. package/dist/esm/loader.js +1 -1
  72. package/dist/esm/{scaling-Cehc74IE.js → scaling-BOcjT8M0.js} +112 -10
  73. package/dist/esm/{withBodyObserver-FQ8NwCIz.js → withBodyObserver-DczL5ia8.js} +1 -1
  74. package/dist/esm/{withComponentStatus-DWjDYtZ7.js → withComponentStatus-DodoSXe-.js} +1 -1
  75. package/dist/esm/{withComponentStyle-9uP_hcDq.js → withComponentStyle-D3VWOsto.js} +2 -2
  76. package/dist/esm/{utils-DvvwfRQG.js → withHasError-B3QX2emi.js} +69 -1
  77. package/dist/esm/{withStyled--qQWquTH.js → withStyled-CE3_3taP.js} +57 -5
  78. package/dist/types/components/bn-layout-card/bn-layout-card.d.ts +139 -0
  79. package/dist/types/components/bn-layout-page/bn-layout-page.d.ts +154 -0
  80. package/dist/types/components.d.ts +168 -0
  81. package/dist/types/utils/parentDimensions.d.ts +6 -1
  82. package/package.json +1 -1
  83. package/dist/bn-template-engine/p-1265d8d3.entry.js +0 -1
  84. package/dist/bn-template-engine/p-15516dac.entry.js +0 -1
  85. package/dist/bn-template-engine/p-1c716641.entry.js +0 -1
  86. package/dist/bn-template-engine/p-1jFf17Vj.js +0 -1
  87. package/dist/bn-template-engine/p-27cc8dc0.entry.js +0 -1
  88. package/dist/bn-template-engine/p-3b4c7425.entry.js +0 -1
  89. package/dist/bn-template-engine/p-4426d484.entry.js +0 -1
  90. package/dist/bn-template-engine/p-51f8dc9e.entry.js +0 -1
  91. package/dist/bn-template-engine/p-53d4e690.entry.js +0 -1
  92. package/dist/bn-template-engine/p-5KQYRQLK.js +0 -1
  93. package/dist/bn-template-engine/p-7337e03d.entry.js +0 -1
  94. package/dist/bn-template-engine/p-75e97c87.entry.js +0 -1
  95. package/dist/bn-template-engine/p-7a560278.entry.js +0 -1
  96. package/dist/bn-template-engine/p-BFTU3MAI.js +0 -1
  97. package/dist/bn-template-engine/p-BYBpC0EO.js +0 -1
  98. package/dist/bn-template-engine/p-BYmPQYxx.js +0 -1
  99. package/dist/bn-template-engine/p-BfXY5dsy.js +0 -1
  100. package/dist/bn-template-engine/p-BgnHJQ9Q.js +0 -1
  101. package/dist/bn-template-engine/p-Bhd_WSML.js +0 -1
  102. package/dist/bn-template-engine/p-Bka-Z6jo.js +0 -1
  103. package/dist/bn-template-engine/p-C7dQL8CS.js +0 -1
  104. package/dist/bn-template-engine/p-CYwd_ZNM.js +0 -1
  105. package/dist/bn-template-engine/p-ChlK-T9I.js +0 -1
  106. package/dist/bn-template-engine/p-DHezf8pZ.js +0 -1
  107. package/dist/bn-template-engine/p-DlppAFq9.js +0 -1
  108. package/dist/bn-template-engine/p-DvDDgmcV.js +0 -1
  109. package/dist/bn-template-engine/p-DvvwfRQG.js +0 -1
  110. package/dist/bn-template-engine/p-abc0067c.entry.js +0 -1
  111. package/dist/bn-template-engine/p-b34eaf86.entry.js +0 -1
  112. package/dist/bn-template-engine/p-bdb8b44c.entry.js +0 -1
  113. package/dist/bn-template-engine/p-c44fcb8e.entry.js +0 -1
  114. package/dist/bn-template-engine/p-c7e1a49b.entry.js +0 -1
  115. package/dist/bn-template-engine/p-d9003041.entry.js +0 -1
  116. package/dist/bn-template-engine/p-daa7ffa3.entry.js +0 -1
  117. package/dist/bn-template-engine/p-e084f50a.entry.js +0 -1
  118. package/dist/bn-template-engine/p-eaba6658.entry.js +0 -1
  119. package/dist/bn-template-engine/p-u8igQLRZ.js +0 -1
  120. package/dist/cjs/DataFormatDigits-DKcOeLNK.js +0 -142
  121. package/dist/cjs/DateStringFactory-CSKvbS8K.js +0 -452
  122. package/dist/cjs/SVGVariancesStyleGroup-K-Tw6lOD.js +0 -7960
  123. package/dist/cjs/_commonjsHelpers-BJu3ubxk.js +0 -10
  124. package/dist/cjs/bn-asset.cjs.entry.js +0 -42
  125. package/dist/cjs/bn-body_4.cjs.entry.js +0 -748
  126. package/dist/cjs/bn-chart-structure_5.cjs.entry.js +0 -3948
  127. package/dist/cjs/bn-component-style.cjs.entry.js +0 -44
  128. package/dist/cjs/bn-dataset.cjs.entry.js +0 -306
  129. package/dist/cjs/bn-layout-page.cjs.entry.js +0 -143
  130. package/dist/cjs/bn-message.cjs.entry.js +0 -52
  131. package/dist/cjs/bn-table.cjs.entry.js +0 -981
  132. package/dist/cjs/contentDecoder-JxOldq1e.js +0 -419
  133. package/dist/cjs/emotion-hash.esm-nbbEQ0Dn.js +0 -57
  134. package/dist/cjs/ibcs-table.cjs.entry.js +0 -2276
  135. package/dist/cjs/ibcsRuleSet-DgUoXOfd.js +0 -136
  136. package/dist/cjs/index-Dm85hG6t.js +0 -65
  137. package/dist/cjs/withHasError-D7ue5vAv.js +0 -72
  138. package/dist/cjs/withTranslation-rwgyITqe.js +0 -77
  139. package/dist/esm/DataFormatDigits-oSZ1hBKE.js +0 -137
  140. package/dist/esm/DateStringFactory-CSGz6TDk.js +0 -450
  141. package/dist/esm/SVGVariancesStyleGroup-CqTjrZYg.js +0 -7950
  142. package/dist/esm/_commonjsHelpers-BFTU3MAI.js +0 -7
  143. package/dist/esm/bn-asset.entry.js +0 -40
  144. package/dist/esm/bn-body_4.entry.js +0 -743
  145. package/dist/esm/bn-chart-structure_5.entry.js +0 -3942
  146. package/dist/esm/bn-component-style.entry.js +0 -42
  147. package/dist/esm/bn-dataset.entry.js +0 -304
  148. package/dist/esm/bn-layout-page.entry.js +0 -141
  149. package/dist/esm/bn-message.entry.js +0 -50
  150. package/dist/esm/bn-table.entry.js +0 -979
  151. package/dist/esm/contentDecoder-oMmxz6nJ.js +0 -416
  152. package/dist/esm/emotion-hash.esm-BYBpC0EO.js +0 -55
  153. package/dist/esm/ibcs-table.entry.js +0 -2274
  154. package/dist/esm/ibcsRuleSet-K4ytuA1f.js +0 -133
  155. package/dist/esm/index-DHezf8pZ.js +0 -65
  156. package/dist/esm/withHasError-FyY5mQ_3.js +0 -70
  157. package/dist/esm/withTranslation-BqD0Kp7b.js +0 -75
@@ -1,743 +0,0 @@
1
- import { r as registerInstance, h, H as Host, g as getElement, d as getAssetPath } from './index-JNHhIe7t.js';
2
- import { w as withComponentStatus } from './withComponentStatus-DWjDYtZ7.js';
3
- import { w as withComponentStyle } from './withComponentStyle-9uP_hcDq.js';
4
- import { w as withHasError } from './withHasError-FyY5mQ_3.js';
5
- import { w as withStyled, v as validateScenarioList, a as validateVariancesList, d as validateOrderList, e as isValidDirection, u as validateMeasureList, x as isValidDate, l as isBlankInput, f as isValidDateFormat, y as isValidDateLink } from './withStyled--qQWquTH.js';
6
- import { I as I18nMode, O as OrderDirection, D as DateTime, g as CompareUtil, f as AdapterUtils, l as OrderAdapter } from './Order-Bnhh02CF.js';
7
- import { w as withTranslation } from './withTranslation-BqD0Kp7b.js';
8
- import { a as globalLabelKeys } from './context-protocol-BHnQsVsr.js';
9
- import { a as DateLink, D as DateDistance, b as DateStringFactory } from './DateStringFactory-CSGz6TDk.js';
10
- import { F as Formatter } from './formatter-DTMEZ6d8.js';
11
- import { I as IBCSRuleSet, S as StringAdapter } from './ibcsRuleSet-K4ytuA1f.js';
12
- import './utils-DvvwfRQG.js';
13
- import './emotion-hash.esm-BYBpC0EO.js';
14
- import './_commonjsHelpers-BFTU3MAI.js';
15
-
16
- const bnBodyCss = () => `:host{flex:1;position:relative;overflow:hidden;display:block;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);color:var(--bn-font-color, #000000)}`;
17
-
18
- const Body = class {
19
- constructor(hostRef) {
20
- registerInstance(this, hostRef);
21
- withComponentStatus(this);
22
- this.errors = withHasError(this);
23
- this.componentStyle = withComponentStyle(this);
24
- }
25
- getFontStyles() {
26
- return this.componentStyle(($) => {
27
- var _a, _b, _c, _d;
28
- return ({
29
- "--bn-font-family": ((_a = $["global"]) === null || _a === void 0 ? void 0 : _a["fontFamily"]) || "'Noto Sans', sans-serif",
30
- "--bn-font-size": `${((_b = $["global"]) === null || _b === void 0 ? void 0 : _b["fontSizePx"]) || 13.3333}px`,
31
- "--bn-font-color": ((_c = $["global"]) === null || _c === void 0 ? void 0 : _c["fontColor"]) || "#000000",
32
- "--bn-font-background": ((_d = $["global"]) === null || _d === void 0 ? void 0 : _d["fontBackgroundColor"]) || "#ffffff",
33
- });
34
- });
35
- }
36
- render() {
37
- return (h(Host, { key: 'f43978af1c6658c6fa165093c3ada6b5f3b5986d', style: this.getFontStyles() }, h("slot", { key: 'b9c97432089676fc373b1d5ee59573ef5681a5c5' })));
38
- }
39
- get element() { return getElement(this); }
40
- };
41
- Body.style = bnBodyCss();
42
-
43
- const bnFooterCss = () => `:host{padding:0.2em 0.5em;display:flex;flex-direction:row;justify-content:space-between;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);color:var(--bn-font-color, #000000)}:host(#container-page-footer){box-sizing:border-box;-webkit-box-sizing:border-box;border-top:0.1em solid #ddd}div#footer-text{font-size:0.6em;display:inline}div#code{flex:1;display:inline;text-align:right;padding-right:1em}div#page-number{font-size:0.6em;display:inline}.image{z-index:2;background-color:transparent;border:transparent;height:1.2em;width:auto}`;
44
-
45
- const Footer = class {
46
- constructor(hostRef) {
47
- registerInstance(this, hostRef);
48
- /**
49
- * Pagenumber value.
50
- * Is displayed if displayPageNumber == true
51
- */
52
- this.pageNumber = null;
53
- /**
54
- * Toggle if pagenumer label is displayed
55
- */
56
- this.displayPageNumber = true;
57
- withComponentStatus(this);
58
- this.errors = withHasError(this);
59
- this.componentStyle = withComponentStyle(this);
60
- }
61
- getFontStyles() {
62
- return this.componentStyle(($) => {
63
- var _a, _b, _c, _d;
64
- return ({
65
- "--bn-font-family": ((_a = $["global"]) === null || _a === void 0 ? void 0 : _a["fontFamily"]) || "'Noto Sans', sans-serif",
66
- "--bn-font-size": `${((_b = $["global"]) === null || _b === void 0 ? void 0 : _b["fontSizePx"]) || 13.3333}px`,
67
- "--bn-font-color": ((_c = $["global"]) === null || _c === void 0 ? void 0 : _c["fontColor"]) || "#000000",
68
- "--bn-font-background": ((_d = $["global"]) === null || _d === void 0 ? void 0 : _d["fontBackgroundColor"]) || "#ffffff",
69
- });
70
- });
71
- }
72
- isValidHttpUrl(string) {
73
- let url;
74
- try {
75
- url = new URL(string);
76
- }
77
- catch (_) {
78
- return false;
79
- }
80
- return url.protocol === "http:" || url.protocol === "https:";
81
- }
82
- prepareAssetUrl(imgUrl) {
83
- if (this.isValidHttpUrl(imgUrl)) {
84
- return imgUrl;
85
- }
86
- return `./assets/${imgUrl}.png`;
87
- }
88
- render() {
89
- return (h(Host, { key: 'c445ca8c8abde56b46564932a6fcd079aa1e640d', id: this.displayPageNumber || this.text || this.code ? "container-page-footer" : "container", style: this.getFontStyles() }, h("div", { key: '2e5829597d228c78acbbbf130bfc440092456cb4', id: "footer-text" }, this.text != null ? h("span", { class: "note" }, this.text) : ""), h("div", { key: 'a2c98bf85fc41fa0aebc35fded0528cd8ba4948f', id: "code" }, this.code != null ? h("img", { class: "image", src: getAssetPath(`${this.prepareAssetUrl(this.code)}`) }) : ""), h("div", { key: 'e879c6ed16996d8b505d64426e2253f3057863f5', id: "page-number" }, this.displayPageNumber ? h("span", { class: "page" }, this.pageNumber) : "")));
90
- }
91
- static get assetsDirs() { return ["assets"]; }
92
- get element() { return getElement(this); }
93
- };
94
- Footer.style = bnFooterCss();
95
-
96
- const bnTitleCss = () => `:host{padding:0.5em;margin-bottom:0.5em;box-sizing:border-box;-webkit-box-sizing:border-box;width:100%;display:block;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);color:var(--bn-font-color, #000000)}`;
97
-
98
- const Title$1 = class Title {
99
- constructor(hostRef) {
100
- registerInstance(this, hostRef);
101
- /** Name of the business unit displayed in card header. If empty string (`''` or `null`) the business unit row is omitted */
102
- this.businessUnit = "";
103
- /** List of the primary scenarios on which the order direction are applied.
104
- * <br /><br />
105
- * If order is set to a scenario it has also exists in scenariolist.<br />
106
- * If order is empty string (`''` or `null`) the order arrow is omitted
107
- * <br /><br />
108
- * values:<br /> ``` category // categoryindex // rowgroup // rowgroup // rowgroupindex // ac // fc // py // pl // null ```
109
- */
110
- this.order = "category";
111
- /** Sets sorting order directon
112
- * <br /><br />
113
- * values:<br /> ``` asc // desc ```
114
- */
115
- this.orderDirection = "asc";
116
- /** Date format
117
- * <br /><br />
118
- * values:<br /> ``` year // quarter // month // week // day // hour // auto // none ```
119
- * <br /><br />
120
- *
121
- * detail:<br />
122
- * ```year: "YYYY"```<br />
123
- * ```quarter: "Q[Q] YYYY"```<br />
124
- * ```month: "MMM YYYY"```<br />
125
- * ```week: "[KW]WW YYYY"```<br />
126
- * ```day: "DD.MM.YYYY"```<br />
127
- * ```time: "DD.MM.YYYY HH:mm:ss"```<br />
128
- * ```none: "DD.MM.YYYY"```<br />
129
- *
130
- */
131
- this.dateFormat = "none";
132
- /** Format in which the start and end date are linked.
133
- * <br /><br />
134
- * If empty string (`''` or `null`) the date row is omitted
135
- * <br /><br />
136
- * values:<br /> ``` avg // interval // cum // start // end // ytd // ytg // cum // mat // none // null```
137
- * <br /><br />
138
- *
139
- * detail:<br />
140
- * ```avg: "Ø[DATE]"```<br />
141
- * ```interval: "[DATE]..[DATE2]"```<br />
142
- * ```start: ".[DATE]"```<br />
143
- * ```end: "[DATE]."```<br />
144
- * ```ytd: "_[DATE]"```<br />
145
- * ```ytg: "[DATE]_"```<br />
146
- * ```cum: "[DATE]_[DATE2]"```<br />
147
- * ```mat: "~[DATE]"```<br />
148
- * ```none: "[DATE]"```<br />
149
- *
150
- */
151
- this.dateLink = "none";
152
- withStyled(this);
153
- withComponentStatus(this);
154
- this.t = withTranslation(this).t;
155
- this.errors = withHasError(this);
156
- this.componentStyle = withComponentStyle(this);
157
- }
158
- validateScenario(newValue) {
159
- const errId = "ERR_scenarios";
160
- const invalidScenarios = validateScenarioList(newValue);
161
- if (invalidScenarios.length > 0) {
162
- this.errors.addOrReplace({
163
- id: errId,
164
- type: "warning",
165
- message: "scenarios: invalid value(s) '" + (invalidScenarios === null || invalidScenarios === void 0 ? void 0 : invalidScenarios.toString()) + "' are not supported.",
166
- });
167
- }
168
- else {
169
- this.errors.remove(errId);
170
- }
171
- }
172
- validateVariances(newValue) {
173
- const errId = "ERR_variances";
174
- const invalidVariances = validateVariancesList(newValue);
175
- if (invalidVariances.length > 0) {
176
- this.errors.addOrReplace({
177
- id: errId,
178
- type: "warning",
179
- message: "variances: invalid value(s) '" + (invalidVariances === null || invalidVariances === void 0 ? void 0 : invalidVariances.toString()) + "' are not supported.",
180
- });
181
- }
182
- else {
183
- this.errors.remove(errId);
184
- }
185
- }
186
- validateOrder(newValue) {
187
- const invalidElements = validateOrderList(newValue);
188
- const errId = "ERR_order";
189
- if (invalidElements.length > 0) {
190
- this.errors.addOrReplace({
191
- id: errId,
192
- type: "warning",
193
- message: "order: invalid value(s) '" + (invalidElements === null || invalidElements === void 0 ? void 0 : invalidElements.toString()) + "' are not supported.",
194
- });
195
- }
196
- else {
197
- this.errors.remove(errId);
198
- }
199
- }
200
- validateOrderDirection(newValue) {
201
- const errId = "ERR_orderDirection";
202
- if (!isValidDirection(newValue)) {
203
- this.errors.addOrReplace({
204
- id: errId,
205
- type: "warning",
206
- message: "orderDirection: invalid value '" + (newValue === null || newValue === void 0 ? void 0 : newValue.toString()) + "' is not supported.",
207
- });
208
- }
209
- else {
210
- this.errors.remove(errId);
211
- }
212
- }
213
- validateMeasures(newValue) {
214
- const errId = "ERR_measures";
215
- const invalidMeasures = validateMeasureList(newValue);
216
- if (invalidMeasures.length > 0) {
217
- this.errors.addOrReplace({
218
- id: errId,
219
- type: "warning",
220
- message: "measures: invalid value(s) '" +
221
- (invalidMeasures === null || invalidMeasures === void 0 ? void 0 : invalidMeasures.toString()) +
222
- '\' are not supported. Valid format example: [{"name": "Bruttoumsatz", "unit": "mEUR"}]',
223
- });
224
- }
225
- else {
226
- this.errors.remove(errId);
227
- }
228
- }
229
- validateDateStart(newValue) {
230
- const errId = "ERR_dateStart";
231
- if (!isValidDate(newValue) && !isBlankInput(newValue)) {
232
- this.errors.addOrReplace({
233
- id: errId,
234
- type: "warning",
235
- message: "dateStart: invalid value '" + (newValue === null || newValue === void 0 ? void 0 : newValue.toString()) + "' is not supported.",
236
- });
237
- }
238
- else {
239
- this.errors.remove(errId);
240
- }
241
- }
242
- validateDateEnd(newValue) {
243
- const errId = "ERR_dateEnd";
244
- if (!isValidDate(newValue) && !isBlankInput(newValue)) {
245
- this.errors.addOrReplace({
246
- id: errId,
247
- type: "warning",
248
- message: "dateStart: invalid value '" + (newValue === null || newValue === void 0 ? void 0 : newValue.toString()) + "' is not supported.",
249
- });
250
- }
251
- else {
252
- this.errors.remove(errId);
253
- }
254
- }
255
- validateDateFormat(newValue) {
256
- const errId = "ERR_dateFormat";
257
- if (!isValidDateFormat(newValue) && !isBlankInput(newValue)) {
258
- this.errors.addOrReplace({
259
- id: errId,
260
- type: "warning",
261
- message: "dateFormat: invalid value '" + (newValue === null || newValue === void 0 ? void 0 : newValue.toString()) + "' is not supported.",
262
- });
263
- }
264
- else {
265
- this.errors.remove(errId);
266
- }
267
- }
268
- validateDateLink(newValue) {
269
- const errId = "ERR_dateLink";
270
- if (!isValidDateLink(newValue) && !isBlankInput(newValue)) {
271
- this.errors.addOrReplace({
272
- id: errId,
273
- type: "warning",
274
- message: "dateLink: invalid value '" + (newValue === null || newValue === void 0 ? void 0 : newValue.toString()) + "' is not supported.",
275
- });
276
- }
277
- else {
278
- this.errors.remove(errId);
279
- }
280
- }
281
- componentWillLoad() {
282
- this.validateScenario(this.scenarios);
283
- this.validateVariances(this.variances);
284
- this.validateMeasures(this.measures);
285
- this.validateDateStart(this.dateStart);
286
- this.validateDateEnd(this.dateEnd);
287
- this.validateDateFormat(this.dateFormat);
288
- this.validateDateLink(this.dateLink);
289
- this.validateOrderDirection(this.orderDirection);
290
- this.validateOrder(this.order);
291
- }
292
- prepareI18n() {
293
- const i18nMetaLabelsLocal = ["SEPERATOR_WS", "in", "CONNECTOR_WS"];
294
- const i18nMetaLabelsGlobal = globalLabelKeys;
295
- // system
296
- const i18nMapSystemLocal = new Map(i18nMetaLabelsLocal.map((key) => [key, this.t(".".concat(key))]));
297
- const i18nMapSystemGlobal = new Map(i18nMetaLabelsGlobal.map((key) => [key, this.t("global.".concat(key))]));
298
- //let i18nMapCustom =
299
- return new Map([...i18nMapSystemGlobal.entries(), ...i18nMapSystemLocal.entries()]);
300
- }
301
- prepareI18nMode() {
302
- return I18nMode.META;
303
- }
304
- prepareTitleOrder() {
305
- var _a;
306
- if (isBlankInput(this.order) || isBlankInput(this.orderDirection)) {
307
- return null;
308
- }
309
- return {
310
- hierarchy: this.order.split(",").map((entry) => entry.trim()),
311
- direction: OrderDirection[(_a = this.orderDirection) === null || _a === void 0 ? void 0 : _a.toUpperCase()],
312
- };
313
- }
314
- prepareTitleTimePeriod() {
315
- var _a, _b;
316
- if (isBlankInput(this.dateStart) && isBlankInput(this.dateEnd)) {
317
- return null;
318
- }
319
- if (isBlankInput(this.dateLink)) {
320
- return null;
321
- }
322
- return {
323
- start: DateTime.fromISO(this.dateStart),
324
- end: DateTime.fromISO(this.dateEnd),
325
- format: DateDistance[(_a = this.dateFormat) === null || _a === void 0 ? void 0 : _a.toUpperCase()],
326
- link: DateLink[(_b = this.dateLink) === null || _b === void 0 ? void 0 : _b.toUpperCase()],
327
- };
328
- }
329
- prepareMeasures() {
330
- if (isBlankInput(this.measures)) {
331
- return [];
332
- }
333
- return JSON.parse(this.measures);
334
- }
335
- prepareScenarios() {
336
- var _a, _b, _c, _d;
337
- if (isBlankInput(this.scenarios) && isBlankInput(this.variances)) {
338
- return [];
339
- }
340
- let scenarios = [];
341
- if (((_a = this.scenarios) === null || _a === void 0 ? void 0 : _a.trim().length) > 0) {
342
- scenarios = scenarios.concat((_b = this.scenarios) === null || _b === void 0 ? void 0 : _b.split(","));
343
- }
344
- if (((_c = this.variances) === null || _c === void 0 ? void 0 : _c.trim().length) > 0) {
345
- scenarios = scenarios.concat((_d = this.variances) === null || _d === void 0 ? void 0 : _d.split(","));
346
- }
347
- return scenarios.map((entry) => entry.trim());
348
- }
349
- prepareBusinessUnit() {
350
- if (isBlankInput(this.businessUnit) || this.businessUnit === "null") {
351
- return null;
352
- }
353
- return this.businessUnit;
354
- }
355
- getFontStyles() {
356
- return this.componentStyle(($) => {
357
- var _a, _b, _c, _d;
358
- return ({
359
- "--bn-font-family": ((_a = $["global"]) === null || _a === void 0 ? void 0 : _a["fontFamily"]) || "'Noto Sans', sans-serif",
360
- "--bn-font-size": `${((_b = $["global"]) === null || _b === void 0 ? void 0 : _b["fontSizePx"]) || 13.3333}px`,
361
- "--bn-font-color": ((_c = $["global"]) === null || _c === void 0 ? void 0 : _c["fontColor"]) || "#000000",
362
- "--bn-font-background": ((_d = $["global"]) === null || _d === void 0 ? void 0 : _d["fontBackgroundColor"]) || "#ffffff",
363
- });
364
- });
365
- }
366
- render() {
367
- const fontStyles = this.getFontStyles();
368
- return (h(Host, { key: '029abd8096c5274f94123da2dc1c1e88e76be922', style: fontStyles }, h("ibcs-title", { key: 'c8b128a6ea36d44d8a0730898b35fa3f944e23ae', businessUnit: this.prepareBusinessUnit(), scenarios: this.prepareScenarios(), measures: this.prepareMeasures(), timeperiod: this.prepareTitleTimePeriod(), order: this.prepareTitleOrder(), i18n: this.prepareI18n(), "i18n-mode": this.prepareI18nMode() })));
369
- }
370
- get element() { return getElement(this); }
371
- static get watchers() { return {
372
- "scenarios": [{
373
- "validateScenario": 0
374
- }],
375
- "variances": [{
376
- "validateVariances": 0
377
- }],
378
- "order": [{
379
- "validateOrder": 0
380
- }],
381
- "orderDirection": [{
382
- "validateOrderDirection": 0
383
- }],
384
- "measures": [{
385
- "validateMeasures": 0
386
- }],
387
- "dateStart": [{
388
- "validateDateStart": 0
389
- }],
390
- "dateEnd": [{
391
- "validateDateEnd": 0
392
- }],
393
- "dateFormat": [{
394
- "validateDateFormat": 0
395
- }],
396
- "dateLink": [{
397
- "validateDateLink": 0
398
- }]
399
- }; }
400
- };
401
- Title$1.style = bnTitleCss();
402
-
403
- class TitleDataSetFactory {
404
- constructor() { }
405
- /**
406
- * Creates measures, adds i18n to each element
407
- * @param measures
408
- * @param i18n
409
- * @param i18nMode
410
- */
411
- createMeasures(measures, i18n, i18nMode) {
412
- if (this.allMeasuresUseSameUnit(measures)) {
413
- const amountOfMeasures = measures.length;
414
- let measureName = "";
415
- let unit = "";
416
- for (let i = 0; i < amountOfMeasures; i++) {
417
- let separator = "";
418
- if (i > 0) {
419
- separator = i18n.get("SEPERATOR_WS");
420
- }
421
- if (amountOfMeasures > 1 && i === amountOfMeasures - 1) {
422
- separator = i18n.get("CONNECTOR_WS");
423
- }
424
- if (i18nMode === I18nMode.ALL) {
425
- measureName =
426
- (i18n.get(measureName) || measureName) + separator + (i18n.get(measures[i].name) || measures[i].name);
427
- unit = i18n.get(measures[i].unit) || measures[i].unit;
428
- }
429
- else {
430
- measureName = measureName + separator + measures[i].name;
431
- unit = measures[i].unit;
432
- }
433
- }
434
- return [
435
- {
436
- name: measureName,
437
- unit: unit,
438
- },
439
- ];
440
- }
441
- else {
442
- return measures;
443
- }
444
- }
445
- /**
446
- * Creates Dimension String,
447
- * concat of translated scenarios, time and order
448
- *
449
- * @param scenarios
450
- * @param time
451
- * @param order
452
- * @param i18n
453
- */
454
- createDimension(scenarios, time, order, i18n, spanLimit) {
455
- let formatedTime = "";
456
- if (time !== undefined) {
457
- formatedTime = new DateStringFactory().getDateLinkString(time.start, time.end, time.link, time.format, spanLimit);
458
- }
459
- const formatedScenarios = scenarios
460
- .map((scenario) => {
461
- let orderString = "";
462
- if (order != null && order.hierarchy != null) {
463
- if (order.hierarchy.find((x) => x === scenario)) {
464
- if (order.direction === "asc") {
465
- orderString = i18n.get("ORDER_asc");
466
- }
467
- else {
468
- orderString = i18n.get("ORDER_desc");
469
- }
470
- }
471
- }
472
- return "".concat(" ", Formatter.translateScenarioLabel(scenario, i18n), orderString);
473
- })
474
- .toString();
475
- return formatedTime + formatedScenarios;
476
- }
477
- allMeasuresUseSameUnit(measures) {
478
- const units = new Map();
479
- measures.forEach(function (entry) {
480
- units.set(entry.unit, true);
481
- });
482
- const hasOneUnit = units.size === 1;
483
- return hasOneUnit;
484
- }
485
- }
486
-
487
- class TitleConfig {
488
- constructor() {
489
- this.businessunit = "";
490
- this.measures = [];
491
- this.scenarios = [];
492
- this.i18nMode = I18nMode.ALL;
493
- this.intervalSpanLimit = 32;
494
- }
495
- }
496
- class TitleConifgAdapter {
497
- constructor(measureEntryAdapter, timePeriodAdapter, orderAdapter, stringAdapter) {
498
- this.measureEntryAdapter = measureEntryAdapter;
499
- this.timePeriodAdapter = timePeriodAdapter;
500
- this.orderAdapter = orderAdapter;
501
- this.stringAdapter = stringAdapter;
502
- }
503
- adapt(data) {
504
- const config = new TitleConfig();
505
- if (CompareUtil.isString(data.businessunit)) {
506
- config.businessunit = data.businessunit;
507
- }
508
- if (CompareUtil.isArray(data.measures)) {
509
- config.measures = AdapterUtils.adaptArray(data.measures, this.measureEntryAdapter);
510
- }
511
- if (CompareUtil.isArray(data.scenarios)) {
512
- config.scenarios = AdapterUtils.adaptArray(data.scenarios, this.stringAdapter);
513
- }
514
- if (CompareUtil.isExisting(data.timeperiod)) {
515
- config.timeperiod = this.timePeriodAdapter.adapt(data.timeperiod);
516
- }
517
- if (CompareUtil.isNumber(data.intervalSpanLimit)) {
518
- config.intervalSpanLimit = data.intervalSpanLimit;
519
- }
520
- if (CompareUtil.isExisting(data.i18nMode)) {
521
- config.i18nMode = data.i18nMode;
522
- }
523
- if (CompareUtil.isExisting(data.order)) {
524
- config.order = this.orderAdapter.adapt(data.order);
525
- }
526
- return config;
527
- }
528
- default() {
529
- return new TitleConfig();
530
- }
531
- }
532
-
533
- var FactoryState;
534
- (function (FactoryState) {
535
- FactoryState[FactoryState["UP_TO_DATE"] = 0] = "UP_TO_DATE";
536
- FactoryState[FactoryState["DIRTY"] = 1] = "DIRTY";
537
- })(FactoryState || (FactoryState = {}));
538
- class Title {
539
- constructor(ruleSet) {
540
- this.i18n = new Map();
541
- this.unit = "";
542
- this.measures = [];
543
- this.dimension = "";
544
- this.config = new TitleConfig();
545
- this.state = FactoryState.DIRTY;
546
- this.ruleSet = ruleSet || new IBCSRuleSet();
547
- this.dataSetFactory = new TitleDataSetFactory();
548
- this.state = FactoryState.DIRTY;
549
- this.setI18n(new Map());
550
- }
551
- /**
552
- * Set Localisation Map
553
- * @param i18n
554
- */
555
- setI18n(i18n) {
556
- this.state = FactoryState.DIRTY; // mark dataSet for update
557
- const defaultI18n = new Map([
558
- ["SEPERATOR_WS", ", "],
559
- ["in", "in"],
560
- ["ORDER_asc", "↑"],
561
- ["ORDER_desc", "↓"],
562
- ["ac1", "AC"],
563
- ["pp1", "PY"],
564
- ["fc1", "FC"],
565
- ["pl1", "PL"],
566
- ["ac2", "AC2"],
567
- ["pp2", "PY2"],
568
- ["fc2", "FC2"],
569
- ["pl2", "PL2"],
570
- ["ac3", "AC3"],
571
- ["pp3", "PY3"],
572
- ["fc3", "FC3"],
573
- ["pp3", "PL3"],
574
- ["ac4", "AC4"],
575
- ["py4", "PY4"],
576
- ["fc4", "FC4"],
577
- ["pp4", "PL4"],
578
- ["category", " "],
579
- ["operation", " "],
580
- ["there_of", "davon"],
581
- ["part_of", "in % von"],
582
- ["ibcssymbol_delta_ac", "Δ{%}"],
583
- ["ibcssymbol_delta_generic", "Δ({%})"],
584
- ["ibcssymbol_delta_ac_relative", "Δ{%}%"],
585
- ["ibcssymbol_delta_generic_relative", "Δ({%})%"],
586
- ["SUM_TOTAL", "❖"],
587
- ["CONNECTOR_WS", " und "],
588
- ]);
589
- this.i18n = new Map([...defaultI18n, ...(i18n || new Map())]);
590
- }
591
- /**
592
- * Generates and Returns the DataSet based,
593
- * data and config.
594
- * if data or config have not been changed since last run
595
- * the dataSet will not be regenerated.
596
- */
597
- update() {
598
- if (FactoryState.DIRTY === this.state) {
599
- this.unit = this.config.businessunit;
600
- this.measures = this.dataSetFactory.createMeasures(this.config.measures, this.i18n, this.config.i18nMode);
601
- this.dimension = this.dataSetFactory.createDimension(this.config.scenarios, this.config.timeperiod, this.config.order, this.i18n, this.config.intervalSpanLimit);
602
- this.state = FactoryState.UP_TO_DATE;
603
- }
604
- return this;
605
- }
606
- setConfig(config) {
607
- this.config = this.initConfig(config);
608
- }
609
- initConfig(config) {
610
- this.state = FactoryState.DIRTY;
611
- const tmpConfig = config;
612
- // this.checkConfigIfValidElseSetDefaultOrder(config.order);
613
- // sorting scenario order based on Ruleset
614
- const self = this;
615
- config.scenarios.sort((n1, n2) => {
616
- return self.ruleSet.getScenarioSorIndex(n1) - self.ruleSet.getScenarioSorIndex(n2);
617
- });
618
- return tmpConfig;
619
- }
620
- }
621
-
622
- //import { IAdapter } from "../../../../utils/helper/IAdapter";
623
- // import { CompareUtil } from "../../../../utils/helper/CompareUtil";
624
- class MeasureEntry {
625
- constructor(name = "", unit = "") {
626
- this.name = name;
627
- this.unit = unit;
628
- }
629
- }
630
- class MeasureEntryAdapter {
631
- construnctor() { }
632
- adapt(data) {
633
- const entry = new MeasureEntry();
634
- if (CompareUtil.isString(data.name)) {
635
- entry.name = data.name;
636
- }
637
- if (CompareUtil.isString(data.unit)) {
638
- entry.unit = data.unit;
639
- }
640
- return entry;
641
- }
642
- default() {
643
- return new MeasureEntry("", "");
644
- }
645
- }
646
-
647
- class TimePeriod {
648
- constructor(start = DateTime.now(), end = DateTime.now(), format = DateDistance.AUTO, link = DateLink.AUTO) {
649
- this.start = start;
650
- this.end = end;
651
- this.format = format;
652
- this.link = link;
653
- }
654
- }
655
- class TimePeriodAdapter {
656
- construnctor() { }
657
- adapt(data) {
658
- const entry = new TimePeriod();
659
- if (CompareUtil.isDate(data.start)) {
660
- entry.start = data.start;
661
- }
662
- if (CompareUtil.isDate(data.end)) {
663
- entry.end = data.end;
664
- }
665
- if (CompareUtil.isExisting(data.format)) {
666
- entry.format = data.format;
667
- }
668
- if (CompareUtil.isExisting(data.link)) {
669
- entry.link = data.link;
670
- }
671
- return entry;
672
- }
673
- default() {
674
- return new TimePeriod();
675
- }
676
- }
677
-
678
- const ibcsTitleCss = () => `:host{display:block;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);color:var(--bn-font-color, #000000)}.measure{font-weight:bold}div{background-color:var(--bn-font-background, white);color:var(--bn-font-color, black)}`;
679
-
680
- const IbcsTitle = class {
681
- constructor(hostRef) {
682
- registerInstance(this, hostRef);
683
- // sample fuer die chrome dev console:
684
- // document.querySelector("ibcs-title").setBusinessUnit("Sven")
685
- // document.querySelector("ibcs-title").setProps({businessUnit: "Lalal"})
686
- this.businessUnit = "";
687
- this.scenarios = [];
688
- this.measures = [];
689
- this.intervalSpanLimit = 28;
690
- this.order = {
691
- hierarchy: [],
692
- direction: OrderDirection.ASC,
693
- };
694
- this.i18n = new Map(); // I18nMode;
695
- this.i18nMode = I18nMode.ALL;
696
- this.title = new Title(new IBCSRuleSet());
697
- }
698
- // so
699
- async setBusinessUnit(businessUnit) {
700
- this.businessUnit = businessUnit;
701
- }
702
- // oder so
703
- async setProps(data) {
704
- Object.keys(data).forEach((key) => {
705
- //@ts-ignore
706
- this[key] = data[key];
707
- });
708
- }
709
- render() {
710
- return (h("div", { key: '08439c867ae47a9ee17ef8280801896a823c8826' }, h("div", { key: 'bb5b7325de2ae2f2e0bdba8d7f7f36511835efa9' }, this.title.unit), h("div", { key: '3edb730c95280ca0c47db70e32dd8e471747d989' }, this.title.measures.map((measure, index) => (h("span", null, this.isFirstElement(index) ? this.title.i18n.get("SEPERATOR_WS") : "", h("span", { class: "measure" }, measure.name), " ", measure.unit ? this.title.i18n.get("in") : "", " ", measure.unit)))), h("div", { key: '3bae51f2fddef6b2195d1c24915512b6255c9a75' }, this.title.dimension)));
711
- }
712
- componentWillLoad() {
713
- const config = this.prepareConfig();
714
- this.title = new Title(new IBCSRuleSet());
715
- this.title.setI18n(this.i18n);
716
- this.title.setConfig(config);
717
- }
718
- componentWillUpdate() {
719
- const config = this.prepareConfig();
720
- this.title.setI18n(this.i18n);
721
- this.title.setConfig(config);
722
- }
723
- componentWillRender() {
724
- this.title.update();
725
- }
726
- isFirstElement(index) {
727
- return index !== 0;
728
- }
729
- prepareConfig() {
730
- return new TitleConifgAdapter(new MeasureEntryAdapter(), new TimePeriodAdapter(), new OrderAdapter(new StringAdapter()), new StringAdapter()).adapt({
731
- businessunit: this.businessUnit,
732
- measures: this.measures,
733
- scenarios: this.scenarios,
734
- timeperiod: this.timeperiod,
735
- intervalSpanLimit: this.intervalSpanLimit,
736
- i18nMode: this.i18nMode,
737
- order: this.order,
738
- });
739
- }
740
- };
741
- IbcsTitle.style = ibcsTitleCss();
742
-
743
- export { Body as bn_body, Footer as bn_footer, Title$1 as bn_title, IbcsTitle as ibcs_title };