@bino-bi/bn-template-engine 1.0.0-alpha.4 → 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 (166) 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-chart-structure/utils/elements/Label.js +11 -0
  47. package/dist/collection/components/bn-chart-structure/utils/elements/StackedBar.js +5 -2
  48. package/dist/collection/components/bn-layout-card/bn-layout-card.css +1 -0
  49. package/dist/collection/components/bn-layout-card/bn-layout-card.js +162 -27
  50. package/dist/collection/components/bn-layout-page/bn-layout-page.css +1 -0
  51. package/dist/collection/components/bn-layout-page/bn-layout-page.js +151 -33
  52. package/dist/collection/components/bn-table/bn-table.js +12 -10
  53. package/dist/collection/components/bn-table/ibcs-table.js +2 -2
  54. package/dist/collection/utils/parentDimensions.js +38 -6
  55. package/dist/components/bn-layout-card.js +1 -1
  56. package/dist/components/bn-layout-page.js +1 -1
  57. package/dist/components/bn-table.js +1 -1
  58. package/dist/components/ibcs-chart-structure2.js +1 -1
  59. package/dist/components/ibcs-table2.js +1 -1
  60. package/dist/components/scaling.js +1 -1
  61. package/dist/esm/{Order-Bnhh02CF.js → Order-sRO-lj7X.js} +448 -1
  62. package/dist/esm/{alasql.min-CWu4NkIt.js → SVGVariancesStyleGroup-DOIT-zvI.js} +8212 -2
  63. package/dist/esm/bn-asset_16.entry.js +9001 -0
  64. package/dist/esm/bn-card.entry.js +4 -5
  65. package/dist/esm/bn-chart-time.entry.js +8 -13
  66. package/dist/esm/bn-grid.entry.js +6 -9
  67. package/dist/esm/bn-image.entry.js +6 -9
  68. package/dist/esm/bn-internationalization.entry.js +4 -5
  69. package/dist/esm/bn-layout-card.entry.js +126 -7
  70. package/dist/esm/bn-template-engine.js +1 -1
  71. package/dist/esm/bn-template.entry.js +2 -3
  72. package/dist/esm/bn-text.entry.js +7 -11
  73. package/dist/esm/bn-tree.entry.js +6 -9
  74. package/dist/esm/{context-protocol-BHnQsVsr.js → context-protocol-2peaD4y8.js} +1 -1
  75. package/dist/esm/editor-companion.entry.js +1 -1
  76. package/dist/esm/{formatter-DTMEZ6d8.js → formatter-BDh7GfC5.js} +6 -2
  77. package/dist/esm/ibcs-chart-time.entry.js +3 -8
  78. package/dist/esm/loader.js +1 -1
  79. package/dist/esm/{scaling-Cehc74IE.js → scaling-BOcjT8M0.js} +112 -10
  80. package/dist/esm/{withBodyObserver-FQ8NwCIz.js → withBodyObserver-DczL5ia8.js} +1 -1
  81. package/dist/esm/{withComponentStatus-DWjDYtZ7.js → withComponentStatus-DodoSXe-.js} +1 -1
  82. package/dist/esm/{withComponentStyle-9uP_hcDq.js → withComponentStyle-D3VWOsto.js} +2 -2
  83. package/dist/esm/{utils-DvvwfRQG.js → withHasError-B3QX2emi.js} +69 -1
  84. package/dist/esm/{withStyled--qQWquTH.js → withStyled-CE3_3taP.js} +57 -5
  85. package/dist/types/components/bn-chart-structure/utils/elements/Label.d.ts +2 -0
  86. package/dist/types/components/bn-layout-card/bn-layout-card.d.ts +139 -0
  87. package/dist/types/components/bn-layout-page/bn-layout-page.d.ts +154 -0
  88. package/dist/types/components/bn-table/bn-table.d.ts +7 -5
  89. package/dist/types/components.d.ts +170 -2
  90. package/dist/types/utils/parentDimensions.d.ts +6 -1
  91. package/package.json +1 -1
  92. package/dist/bn-template-engine/p-1265d8d3.entry.js +0 -1
  93. package/dist/bn-template-engine/p-15516dac.entry.js +0 -1
  94. package/dist/bn-template-engine/p-1c716641.entry.js +0 -1
  95. package/dist/bn-template-engine/p-1jFf17Vj.js +0 -1
  96. package/dist/bn-template-engine/p-27cc8dc0.entry.js +0 -1
  97. package/dist/bn-template-engine/p-4426d484.entry.js +0 -1
  98. package/dist/bn-template-engine/p-51f8dc9e.entry.js +0 -1
  99. package/dist/bn-template-engine/p-53d4e690.entry.js +0 -1
  100. package/dist/bn-template-engine/p-5KQYRQLK.js +0 -1
  101. package/dist/bn-template-engine/p-745f4596.entry.js +0 -1
  102. package/dist/bn-template-engine/p-75e97c87.entry.js +0 -1
  103. package/dist/bn-template-engine/p-7a560278.entry.js +0 -1
  104. package/dist/bn-template-engine/p-7ea7c325.entry.js +0 -1
  105. package/dist/bn-template-engine/p-945cc95d.entry.js +0 -1
  106. package/dist/bn-template-engine/p-BFTU3MAI.js +0 -1
  107. package/dist/bn-template-engine/p-BYBpC0EO.js +0 -1
  108. package/dist/bn-template-engine/p-BYmPQYxx.js +0 -1
  109. package/dist/bn-template-engine/p-BfXY5dsy.js +0 -1
  110. package/dist/bn-template-engine/p-BgnHJQ9Q.js +0 -1
  111. package/dist/bn-template-engine/p-Bhd_WSML.js +0 -1
  112. package/dist/bn-template-engine/p-Bka-Z6jo.js +0 -1
  113. package/dist/bn-template-engine/p-C7dQL8CS.js +0 -1
  114. package/dist/bn-template-engine/p-CYwd_ZNM.js +0 -1
  115. package/dist/bn-template-engine/p-ChlK-T9I.js +0 -1
  116. package/dist/bn-template-engine/p-DHezf8pZ.js +0 -1
  117. package/dist/bn-template-engine/p-DlppAFq9.js +0 -1
  118. package/dist/bn-template-engine/p-DvDDgmcV.js +0 -1
  119. package/dist/bn-template-engine/p-DvvwfRQG.js +0 -1
  120. package/dist/bn-template-engine/p-b34eaf86.entry.js +0 -1
  121. package/dist/bn-template-engine/p-bdb8b44c.entry.js +0 -1
  122. package/dist/bn-template-engine/p-c44fcb8e.entry.js +0 -1
  123. package/dist/bn-template-engine/p-c7e1a49b.entry.js +0 -1
  124. package/dist/bn-template-engine/p-d9003041.entry.js +0 -1
  125. package/dist/bn-template-engine/p-daa7ffa3.entry.js +0 -1
  126. package/dist/bn-template-engine/p-e084f50a.entry.js +0 -1
  127. package/dist/bn-template-engine/p-eaba6658.entry.js +0 -1
  128. package/dist/bn-template-engine/p-u8igQLRZ.js +0 -1
  129. package/dist/cjs/DataFormatDigits-DKcOeLNK.js +0 -142
  130. package/dist/cjs/DateStringFactory-CSKvbS8K.js +0 -452
  131. package/dist/cjs/SVGVariancesStyleGroup-K-Tw6lOD.js +0 -7960
  132. package/dist/cjs/_commonjsHelpers-BJu3ubxk.js +0 -10
  133. package/dist/cjs/bn-asset.cjs.entry.js +0 -42
  134. package/dist/cjs/bn-body_4.cjs.entry.js +0 -748
  135. package/dist/cjs/bn-chart-structure_5.cjs.entry.js +0 -3934
  136. package/dist/cjs/bn-component-style.cjs.entry.js +0 -44
  137. package/dist/cjs/bn-dataset.cjs.entry.js +0 -306
  138. package/dist/cjs/bn-layout-page.cjs.entry.js +0 -143
  139. package/dist/cjs/bn-message.cjs.entry.js +0 -52
  140. package/dist/cjs/bn-table.cjs.entry.js +0 -979
  141. package/dist/cjs/contentDecoder-JxOldq1e.js +0 -419
  142. package/dist/cjs/emotion-hash.esm-nbbEQ0Dn.js +0 -57
  143. package/dist/cjs/ibcs-table.cjs.entry.js +0 -2276
  144. package/dist/cjs/ibcsRuleSet-DgUoXOfd.js +0 -136
  145. package/dist/cjs/index-Dm85hG6t.js +0 -65
  146. package/dist/cjs/withHasError-D7ue5vAv.js +0 -72
  147. package/dist/cjs/withTranslation-rwgyITqe.js +0 -77
  148. package/dist/esm/DataFormatDigits-oSZ1hBKE.js +0 -137
  149. package/dist/esm/DateStringFactory-CSGz6TDk.js +0 -450
  150. package/dist/esm/SVGVariancesStyleGroup-CqTjrZYg.js +0 -7950
  151. package/dist/esm/_commonjsHelpers-BFTU3MAI.js +0 -7
  152. package/dist/esm/bn-asset.entry.js +0 -40
  153. package/dist/esm/bn-body_4.entry.js +0 -743
  154. package/dist/esm/bn-chart-structure_5.entry.js +0 -3928
  155. package/dist/esm/bn-component-style.entry.js +0 -42
  156. package/dist/esm/bn-dataset.entry.js +0 -304
  157. package/dist/esm/bn-layout-page.entry.js +0 -141
  158. package/dist/esm/bn-message.entry.js +0 -50
  159. package/dist/esm/bn-table.entry.js +0 -977
  160. package/dist/esm/contentDecoder-oMmxz6nJ.js +0 -416
  161. package/dist/esm/emotion-hash.esm-BYBpC0EO.js +0 -55
  162. package/dist/esm/ibcs-table.entry.js +0 -2274
  163. package/dist/esm/ibcsRuleSet-K4ytuA1f.js +0 -133
  164. package/dist/esm/index-DHezf8pZ.js +0 -65
  165. package/dist/esm/withHasError-FyY5mQ_3.js +0 -70
  166. package/dist/esm/withTranslation-BqD0Kp7b.js +0 -75
@@ -1,136 +0,0 @@
1
- 'use strict';
2
-
3
- var Order = require('./Order-iG11HI4R.js');
4
- var formatter = require('./formatter-DIJL_crx.js');
5
-
6
- class StringAdapter {
7
- adapt(data) {
8
- return Order.AdapterUtils.adaptDefaultString(data);
9
- }
10
- default() {
11
- return "";
12
- }
13
- }
14
-
15
- /**
16
- * IBCS rule set defining scenario→style mappings per IBCS notation standard v1.2.
17
- *
18
- * Color indices encode IBCS visual encoding:
19
- * - 10 = AC: solid dark fill
20
- * - 20 = PP: light gray fill
21
- * - 30 = FC: hatched pattern fill
22
- * - 50 = PL: outlined (no fill)
23
- *
24
- * Sort indices determine column display order: PP(100s) < PL(200s) < FC(300s) < AC(400s).
25
- * Variance columns add +1000 (absolute) or +2000 (relative) to the base sort index.
26
- * Within each group, variant number (1-4) adds multiples of 10.
27
- */
28
- class IBCSRuleSet {
29
- constructor() {
30
- // defines scenario sortIndex an colour PP, PL, FC, AC,
31
- this._dateFormat = {
32
- year: "YYYY",
33
- quarter: "Q[Q] YYYY",
34
- month: "MMM YYYY",
35
- locale: "[KW]WW YYYY",
36
- day: "DD.MM.YYYY",
37
- };
38
- this._dateLinkFormat = {
39
- avg: "Ø[DATE]",
40
- interval: "[DATE]..[DATE]",
41
- start: ".[DATE]",
42
- end: "[DATE].",
43
- ytd: "_[DATE]",
44
- ytg: "[DATE]_",
45
- cum: "[DATE]_[DATE]",
46
- mat: "~[DATE]",
47
- none: "[DATE]",
48
- };
49
- this._scenarioMap = new Map();
50
- this._fallBackScenario = {
51
- name: "Series",
52
- group: "Series",
53
- colorIndex: 10,
54
- sortIndex: 120,
55
- };
56
- this.createScenarioMapEntry("ac", "AC", 10, 400);
57
- this.createScenarioMapEntry("fc", "FC", 30, 300);
58
- this.createScenarioMapEntry("pl", "PL", 50, 200);
59
- this.createScenarioMapEntry("bu", "BU", 50, 200);
60
- this.createScenarioMapEntry("pp", "PP", 20, 100);
61
- this.createScenarioMapEntry("py", "PY", 20, 100);
62
- this.createScenarioMapEntry("dac", "dAC", 10, 1400);
63
- this.createScenarioMapEntry("dfc", "dFC", 30, 1300);
64
- this.createScenarioMapEntry("dpl", "dPL", 50, 1200);
65
- this.createScenarioMapEntry("dbu", "dBU", 50, 1200);
66
- this.createScenarioMapEntry("dpp", "dPP", 20, 1100);
67
- this.createScenarioMapEntry("dpy", "dPY", 20, 1100);
68
- this.createScenarioMapEntry("drac", "drAC", 10, 2400);
69
- this.createScenarioMapEntry("drfc", "drFC", 30, 2300);
70
- this.createScenarioMapEntry("drpl", "drPL", 50, 2200);
71
- this.createScenarioMapEntry("drbu", "drBU", 50, 2200);
72
- this.createScenarioMapEntry("drpp", "drPP", 20, 2100);
73
- this.createScenarioMapEntry("drpy", "drPY", 20, 2100);
74
- }
75
- createScenarioMapEntry(key, name, colorIndex, sortIndex) {
76
- const range = [1, 2, 3, 4];
77
- const _group = name;
78
- const _colorIndex = colorIndex;
79
- range.forEach((element) => {
80
- const _key = key + element;
81
- const _name = name + element;
82
- const _sortIndex = sortIndex + element * 10;
83
- this._scenarioMap.set(_key, { name: _name, group: _group, colorIndex: _colorIndex, sortIndex: _sortIndex });
84
- });
85
- }
86
- getScenario(scenarioName) {
87
- if (this._scenarioMap.has(scenarioName)) {
88
- return this._scenarioMap.get(scenarioName);
89
- }
90
- else {
91
- return this._fallBackScenario;
92
- }
93
- }
94
- getScenarioGroup(scenarioName) {
95
- if (this._scenarioMap.has(scenarioName)) {
96
- return this._scenarioMap.get(scenarioName).name;
97
- }
98
- else {
99
- return this._fallBackScenario.name;
100
- }
101
- }
102
- getScenarioColorIndex(scenarioName) {
103
- if (this._scenarioMap.has(scenarioName)) {
104
- return this._scenarioMap.get(scenarioName).colorIndex;
105
- }
106
- else {
107
- return this._fallBackScenario.colorIndex;
108
- }
109
- }
110
- getScenarioSorIndex(scenarioName) {
111
- const normalizedScenario = this.normalizeVarianceScenario(scenarioName);
112
- if (this._scenarioMap.has(normalizedScenario)) {
113
- return this._scenarioMap.get(normalizedScenario).sortIndex;
114
- }
115
- else {
116
- return this._fallBackScenario.sortIndex;
117
- }
118
- }
119
- /**
120
- * Strips the base scenario from a variance column name, returning type+delta for sort index lookup.
121
- * Example: `"dac1_pl1_pos"` → `"dpl1"`, `"drac1_pl1_neg"` → `"drpl1"`
122
- */
123
- normalizeVarianceScenario(scenario) {
124
- if (scenario === null || scenario === undefined) {
125
- return "";
126
- }
127
- const scenarios = new formatter.VarianceScenario(scenario);
128
- if (!scenarios.isValid) {
129
- return scenario;
130
- }
131
- return scenarios.type + scenarios.delta;
132
- }
133
- }
134
-
135
- exports.IBCSRuleSet = IBCSRuleSet;
136
- exports.StringAdapter = StringAdapter;
@@ -1,65 +0,0 @@
1
- 'use strict';
2
-
3
- /** Sentinel value indicating all groups should be included. */
4
- var GroupSelection;
5
- (function (GroupSelection) {
6
- GroupSelection[GroupSelection["ALL"] = -1] = "ALL";
7
- })(GroupSelection || (GroupSelection = {}));
8
- /**
9
- * Tracks whether a factory's output is current or needs recalculation.
10
- * Used to avoid redundant re-rendering when underlying data has not changed.
11
- */
12
- exports.FactoryState = void 0;
13
- (function (FactoryState) {
14
- /** Output matches the current input data. */
15
- FactoryState[FactoryState["UP_TO_DATE"] = 0] = "UP_TO_DATE";
16
- /** Input data has changed; output needs to be regenerated. */
17
- FactoryState[FactoryState["DIRTY"] = 1] = "DIRTY";
18
- })(exports.FactoryState || (exports.FactoryState = {}));
19
- /**
20
- * Table aggregation modes controlling how rows are grouped and totalled.
21
- *
22
- * - `LIST` -- Flat list with no aggregation.
23
- * - `SUM` -- Grouped rows with sum totals per group and a grand total.
24
- * - `SUMNOTOTAL` -- Grouped rows with group sums but no grand total row.
25
- * - `OPT` -- Operation-aware aggregation (respects the +/- operation field).
26
- * - `OPTNOTOTAL` -- Operation-aware aggregation without a grand total row.
27
- */
28
- exports.TableType = void 0;
29
- (function (TableType) {
30
- TableType["LIST"] = "list";
31
- TableType["SUM"] = "sum";
32
- TableType["SUMNOTOTAL"] = "sumnototal";
33
- TableType["OPT"] = "opt";
34
- TableType["OPTNOTOTAL"] = "optnototal";
35
- })(exports.TableType || (exports.TableType = {}));
36
- exports.OrderDirection = void 0;
37
- (function (OrderDirection) {
38
- OrderDirection["ASC"] = "asc";
39
- OrderDirection["DESC"] = "desc";
40
- })(exports.OrderDirection || (exports.OrderDirection = {}));
41
- /**
42
- * Discriminator for rendered table rows, controlling visual styling and behavior.
43
- *
44
- * - `HEADER` -- Column header row.
45
- * - `GROUPHEAD` -- Group title row (rendered when `grouped` is true).
46
- * - `SEPERATORLINE` -- Visual divider between groups.
47
- * - `SUM` -- Grand total row.
48
- * - `GROUPSUM` -- Sub-total row for a single group.
49
- * - `DRILLELEMENT` -- "Thereof" drill-down sub-row.
50
- * - `STANDARD` -- Normal data row.
51
- * - `PARTELEMENT` -- "Part of" percentage row.
52
- * - `ENTRY` -- Generic entry row.
53
- */
54
- exports.TableRowType = void 0;
55
- (function (TableRowType) {
56
- TableRowType["HEADER"] = "HEADER";
57
- TableRowType["GROUPHEAD"] = "GROUPHEAD";
58
- TableRowType["SEPERATORLINE"] = "SEPERATORLINE";
59
- TableRowType["SUM"] = "SUM";
60
- TableRowType["GROUPSUM"] = "GROUP_SUM";
61
- TableRowType["DRILLELEMENT"] = "DRILLELEMENT";
62
- TableRowType["STANDARD"] = "STANDARD";
63
- TableRowType["PARTELEMENT"] = "PARTELEMENT";
64
- TableRowType["ENTRY"] = "ENTRY";
65
- })(exports.TableRowType || (exports.TableRowType = {}));
@@ -1,72 +0,0 @@
1
- 'use strict';
2
-
3
- var index = require('./index-Cjw0q6gP.js');
4
- var utils = require('./utils-CwHIVbbL.js');
5
-
6
- const urlAlphabet =
7
- 'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict';
8
-
9
- /* @ts-self-types="./index.d.ts" */
10
- let nanoid = (size = 21) => {
11
- let id = '';
12
- let bytes = crypto.getRandomValues(new Uint8Array((size |= 0)));
13
- while (size--) {
14
- id += urlAlphabet[bytes[size] & 63];
15
- }
16
- return id
17
- };
18
-
19
- /**
20
- * Mixin that provides an {@link ErrorDispatcher} for managing validation
21
- * errors and warnings on a component.
22
- *
23
- * Errors are stored internally via a reactive {@link ref}. On every change,
24
- * the host element's `has-error` attribute is updated with a JSON-serialized
25
- * array of {@link ErrorItem}s (or removed when empty). This allows external
26
- * CSS selectors and parent components to detect error states declaratively.
27
- *
28
- * @param component - The Stencil component instance
29
- * @returns An {@link ErrorDispatcher} for adding, replacing, and removing errors
30
- */
31
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
32
- const withHasError = (component) => {
33
- const { set, modify } = utils.ref([], (items) => {
34
- const elm = index.getElement(component);
35
- if (items.length === 0) {
36
- elm.removeAttribute("has-error");
37
- }
38
- else {
39
- elm.setAttribute("has-error", JSON.stringify(items));
40
- }
41
- });
42
- return {
43
- clear: () => {
44
- set([]);
45
- },
46
- replace: (errors) => {
47
- set(errors.map((item) => {
48
- if (!item.id) {
49
- item.id = nanoid();
50
- }
51
- return item;
52
- }));
53
- },
54
- add: (error) => {
55
- if (!error.id)
56
- error.id = nanoid();
57
- modify((current) => [...current, error]);
58
- return error.id;
59
- },
60
- addOrReplace: (error) => {
61
- if (error.id === undefined)
62
- throw "missing";
63
- modify((current) => [...current.filter((item) => item.id !== error.id), error]);
64
- return error.id;
65
- },
66
- remove: (id) => {
67
- modify((current) => current.filter((item) => item.id !== id));
68
- },
69
- };
70
- };
71
-
72
- exports.withHasError = withHasError;
@@ -1,77 +0,0 @@
1
- 'use strict';
2
-
3
- var contextProtocol = require('./context-protocol-DRQWrwsA.js');
4
- var index = require('./index-Cjw0q6gP.js');
5
- var utils = require('./utils-CwHIVbbL.js');
6
-
7
- /**
8
- * Mixin that provides i18n translation support to a Stencil component.
9
- *
10
- * Returns an object with a `t(key, data?)` function for looking up translated strings.
11
- *
12
- * **Key resolution shortcuts:**
13
- * - A key starting with `.` (e.g. `.label`) is expanded to `<component-tag>.label`,
14
- * allowing components to reference their own translations concisely.
15
- * - If the key is not found in the component's namespace, the `_system` namespace
16
- * is used as a fallback.
17
- *
18
- * **Mustache-style interpolation:** `{{variable}}` placeholders in translation
19
- * templates are replaced with values from the optional `data` object.
20
- *
21
- * The mixin observes the `namespace` attribute on the host element and re-renders
22
- * the component when the locale store updates for the active namespace.
23
- *
24
- * @param component - The Stencil component instance
25
- * @returns Object containing the `t` translation function
26
- */
27
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
28
- const withTranslation = (component) => {
29
- let subscription;
30
- let namespace = undefined;
31
- let stores;
32
- const observer = new MutationObserver((mutations) => {
33
- mutations.forEach((mutation) => {
34
- if (mutation.attributeName === "namespace") {
35
- namespace = index.getElement(component).getAttribute("namespace");
36
- index.forceUpdate(component);
37
- }
38
- });
39
- });
40
- const connectedCallback = component["connectedCallback"];
41
- component["connectedCallback"] = () => {
42
- const element = index.getElement(component);
43
- stores = contextProtocol.getStores(element);
44
- observer.observe(element, { attributes: true, attributeFilter: ["namespace"] });
45
- namespace = index.getElement(component).getAttribute("namespace");
46
- subscription = stores.internationalization.on("set", (key, _value) => {
47
- if (key === namespace) {
48
- index.forceUpdate(component);
49
- }
50
- });
51
- utils.runIfExisits(connectedCallback, component);
52
- };
53
- const disconnectedCallback = component["disconnectedCallback"];
54
- component["disconnectedCallback"] = () => {
55
- observer.disconnect();
56
- utils.runIfExisits(subscription);
57
- contextProtocol.clearStoresCache(index.getElement(component));
58
- utils.runIfExisits(disconnectedCallback, component);
59
- };
60
- const t = (key, data) => {
61
- var _a, _b;
62
- if (key.startsWith(".")) {
63
- key = index.getElement(component).localName + key;
64
- }
65
- const locales = stores.internationalization.state;
66
- const locale = stores.context.state.locale;
67
- let currentNamespace = namespace;
68
- if (((_b = (_a = locales[currentNamespace]) === null || _a === void 0 ? void 0 : _a[locale]) === null || _b === void 0 ? void 0 : _b[key]) == null) {
69
- currentNamespace = "_system";
70
- }
71
- const tpl = locales[currentNamespace][locale][key];
72
- return tpl.replace(/{{([\s\S]+?)}}/g, (_, k) => { var _a; return (_a = data === null || data === void 0 ? void 0 : data[k.trim()]) !== null && _a !== void 0 ? _a : ""; });
73
- };
74
- return { t };
75
- };
76
-
77
- exports.withTranslation = withTranslation;
@@ -1,137 +0,0 @@
1
- import { a as alasql } from './alasql.min-CWu4NkIt.js';
2
- import { g as CompareUtil } from './Order-Bnhh02CF.js';
3
-
4
- /** SI metric prefix for number scaling (e.g. prefix="M", value=1000000 divides displayed values by one million). */
5
- class SiPrefix {
6
- constructor(prefix = "", value = 1) {
7
- this.prefix = prefix;
8
- this.value = value;
9
- }
10
- }
11
-
12
- /**
13
- * SI prefix lookup table mapping prefix symbols to their numeric multipliers.
14
- * Used by {@link DataAnalyzer.calculateMeasureScale} to convert a prefix string
15
- * (e.g. `"M"` for mega) into the corresponding divisor for display scaling.
16
- *
17
- * Covers the full SI range from yocto (10^-24) to yotta (10^24).
18
- * Note: `"my"` is used instead of `"μ"` (micro) for ASCII compatibility.
19
- */
20
- var NumeralFigure;
21
- (function (NumeralFigure) {
22
- NumeralFigure[NumeralFigure["Y"] = 1e+24] = "Y";
23
- NumeralFigure[NumeralFigure["Z"] = 1e+21] = "Z";
24
- NumeralFigure[NumeralFigure["E"] = 1000000000000000000] = "E";
25
- NumeralFigure[NumeralFigure["P"] = 1000000000000000] = "P";
26
- NumeralFigure[NumeralFigure["T"] = 1000000000000] = "T";
27
- NumeralFigure[NumeralFigure["G"] = 1000000000] = "G";
28
- NumeralFigure[NumeralFigure["M"] = 1000000] = "M";
29
- NumeralFigure[NumeralFigure["k"] = 1000] = "k";
30
- NumeralFigure[NumeralFigure["h"] = 100] = "h";
31
- NumeralFigure[NumeralFigure["da"] = 10] = "da";
32
- NumeralFigure[NumeralFigure["d"] = 0.1] = "d";
33
- NumeralFigure[NumeralFigure["c"] = 0.01] = "c";
34
- NumeralFigure[NumeralFigure["m"] = 0.001] = "m";
35
- NumeralFigure[NumeralFigure["my"] = 0.000001] = "my";
36
- NumeralFigure[NumeralFigure["n"] = 1e-9] = "n";
37
- NumeralFigure[NumeralFigure["p"] = 1e-12] = "p";
38
- NumeralFigure[NumeralFigure["f"] = 1e-15] = "f";
39
- NumeralFigure[NumeralFigure["a"] = 1e-18] = "a";
40
- NumeralFigure[NumeralFigure["z"] = 1e-21] = "z";
41
- NumeralFigure[NumeralFigure["y"] = 1e-24] = "y";
42
- })(NumeralFigure || (NumeralFigure = {}));
43
- /**
44
- * Analyzes dataset values to determine the appropriate SI prefix for display scaling.
45
- */
46
- class DataAnalyzer {
47
- /**
48
- * Determines the appropriate SI prefix for scaling displayed values.
49
- *
50
- * Modes:
51
- * - `"_"` (underscore): no scaling, returns identity prefix
52
- * - Explicit prefix (e.g. `"k"`, `"M"`): direct lookup in NumeralFigure enum
53
- * - `"GREATEST"` (default) / `"LEAST"`: auto-detect from the MAX or MIN of
54
- * absolute base scenario values. Only 3-character scenario names (e.g. `ac1`)
55
- * are considered; variance columns are excluded.
56
- * - `null` with data: defaults to GREATEST auto-detection
57
- */
58
- static calculateMeasureScale(data, scenarios, mode) {
59
- var _a;
60
- if (mode === "_") {
61
- return new SiPrefix();
62
- }
63
- if (mode != null) {
64
- if ([...this.unitsLeast, ...this.unitsGreat].includes(mode)) {
65
- return this.lookupPrefix(mode);
66
- }
67
- }
68
- if (scenarios.length === 0) {
69
- return new SiPrefix();
70
- }
71
- // filtering wordlenght == 3, so variances are not considered
72
- const queryMax = `SELECT MAX(GREATEST(${scenarios
73
- .filter((word) => word.length === 3)
74
- .map((x) => "ABS(" + x + ")")
75
- .toString()})) as prefixvalue
76
- FROM ?`;
77
- const queryMin = `SELECT MIN(LEAST(${scenarios
78
- .filter((word) => word.length === 3)
79
- .map((x) => "ABS(" + x + ")")
80
- .toString()})) as prefixvalue
81
- FROM ?`;
82
- let query = queryMax;
83
- if ((mode === null || mode === void 0 ? void 0 : mode.toUpperCase()) === "LEAST") {
84
- query = queryMin;
85
- }
86
- const result = alasql(query, [data]);
87
- const num = (_a = result[0]) === null || _a === void 0 ? void 0 : _a.prefixvalue;
88
- return this.determinePrefix(Math.abs(num));
89
- }
90
- /** Maps an absolute numeric value to the best-fitting SI prefix based on digit count. */
91
- static determinePrefix(num) {
92
- if (num >= 1000) {
93
- const floor = Math.floor(Math.floor(Math.abs(num)).toString().length / 3);
94
- const value = +Math.pow(1000, floor);
95
- return new SiPrefix(this.unitsGreat[floor - 1], value);
96
- }
97
- if (num <= 0.001) {
98
- const floor = Math.floor(Math.abs(num).toString().length / 3);
99
- const value = +(1 / Math.pow(1000, floor));
100
- return new SiPrefix(this.unitsLeast[floor - 1], value);
101
- }
102
- return new SiPrefix();
103
- }
104
- /** Looks up an explicit SI prefix string in the NumeralFigure enum. */
105
- static lookupPrefix(mode) {
106
- return new SiPrefix(mode, NumeralFigure[mode]);
107
- }
108
- }
109
- /** SI prefixes for large numbers, ordered by magnitude (k=10^3 .. Y=10^24). */
110
- DataAnalyzer.unitsGreat = ["k", "M", "G", "T", "P", "E", "Z", "Y"];
111
- /** SI prefixes for small numbers, ordered by magnitude (m=10^-3 .. y=10^-24). */
112
- DataAnalyzer.unitsLeast = ["m", "my", "n", "p", "P", "f", "a", "z", "y"];
113
-
114
- /** Decimal precision configuration: separate digit counts for percent columns vs absolute (decimal) columns. */
115
- class DataFormatDigits {
116
- constructor(percent = 2, decimal = 1) {
117
- this.percent = percent;
118
- this.decimal = decimal;
119
- }
120
- }
121
- class DataFormatDigitsAdapter {
122
- adapt(data) {
123
- const prefix = new DataFormatDigits();
124
- if (CompareUtil.isNumber(data.percent)) {
125
- prefix.percent = data.percent;
126
- }
127
- if (CompareUtil.isNumber(data.decimal)) {
128
- prefix.decimal = data.decimal;
129
- }
130
- return prefix;
131
- }
132
- default() {
133
- return new DataFormatDigits();
134
- }
135
- }
136
-
137
- export { DataAnalyzer as D, SiPrefix as S, DataFormatDigits as a, DataFormatDigitsAdapter as b };