@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,42 +0,0 @@
1
- import { r as registerInstance, h, H as Host, g as getElement } from './index-JNHhIe7t.js';
2
- import { w as withBodyObserver } from './withBodyObserver-FQ8NwCIz.js';
3
- import { g as getStores } from './context-protocol-BHnQsVsr.js';
4
- import { w as withComponentStatus } from './withComponentStatus-DWjDYtZ7.js';
5
- import { w as withHasError } from './withHasError-FyY5mQ_3.js';
6
- import './utils-DvvwfRQG.js';
7
-
8
- const bnComponentStyleCss = () => `bn-component-style{display:none}`;
9
-
10
- const ComponentStyle = class {
11
- constructor(hostRef) {
12
- registerInstance(this, hostRef);
13
- this.name = "_default";
14
- withComponentStatus(this);
15
- this.errors = withHasError(this);
16
- withBodyObserver(this, (data) => {
17
- if (!this.stores)
18
- this.stores = getStores(this.element);
19
- try {
20
- const parsedData = JSON.parse(data);
21
- // @ts-ignore
22
- this.stores.componentStyles.set(this.name, parsedData);
23
- this.errors.remove("JSON_PARSE");
24
- }
25
- catch (e) {
26
- this.errors.addOrReplace({
27
- id: "JSON_PARSE",
28
- type: "error",
29
- message: `bn-component-style: Failed to parse JSON body — ${e.message}`,
30
- });
31
- console.error(e);
32
- }
33
- });
34
- }
35
- render() {
36
- return h(Host, { key: 'e9298c6ce5b0b51260165e78dcf19efdef0646f9' });
37
- }
38
- get element() { return getElement(this); }
39
- };
40
- ComponentStyle.style = bnComponentStyleCss();
41
-
42
- export { ComponentStyle as bn_component_style };
@@ -1,304 +0,0 @@
1
- import { g as getElement, r as registerInstance, h, H as Host } from './index-JNHhIe7t.js';
2
- import { g as getStores, c as clearStoresCache } from './context-protocol-BHnQsVsr.js';
3
- import { r as runIfExisits } from './utils-DvvwfRQG.js';
4
- import { w as withBodyObserver } from './withBodyObserver-FQ8NwCIz.js';
5
- import { a as alasql } from './alasql.min-CWu4NkIt.js';
6
- import { w as withComponentStatus } from './withComponentStatus-DWjDYtZ7.js';
7
- import { w as withHasError } from './withHasError-FyY5mQ_3.js';
8
- import { d as decodeCompressedContent, c as computeContentHash } from './contentDecoder-oMmxz6nJ.js';
9
- import './_commonjsHelpers-BFTU3MAI.js';
10
- import './emotion-hash.esm-BYBpC0EO.js';
11
-
12
- /**
13
- * Mixin that subscribes a Stencil component to raw datasources.
14
- *
15
- * This is the simpler counterpart of {@link withDataset} -- it reads directly from
16
- * the datasources store without going through bn-dataset query processing.
17
- * Primarily used by bn-dataset itself, which needs access to raw data before
18
- * producing a processed dataset.
19
- *
20
- * Watches the host element's `datasources` attribute via MutationObserver for
21
- * dynamic rebinding at runtime.
22
- *
23
- * @param component - The Stencil component instance
24
- * @param onUpdate - Callback invoked with `(name, data)` whenever a subscribed datasource changes
25
- */
26
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
27
- const withDatasource = (component, onUpdate) => {
28
- let subscription;
29
- let datasources = [];
30
- let stores;
31
- const observer = new MutationObserver((mutations) => {
32
- mutations.forEach((mutation) => {
33
- if (mutation.attributeName === "datasources") {
34
- datasources = (getElement(component).getAttribute("datasources") || "").split(",");
35
- datasources.forEach((name) => {
36
- // @ts-ignore
37
- onUpdate(name, stores.datasources.get(name));
38
- });
39
- }
40
- });
41
- });
42
- const connectedCallback = component["connectedCallback"];
43
- component["connectedCallback"] = () => {
44
- const element = getElement(component);
45
- stores = getStores(element);
46
- datasources = (element.getAttribute("datasources") || "").split(",");
47
- datasources.forEach((name) => {
48
- // @ts-ignore
49
- onUpdate(name, stores.datasources.get(name));
50
- });
51
- observer.observe(element, { attributes: true, attributeFilter: ["datasources"] });
52
- subscription = stores.datasources.on("set", (key, newVlaue) => {
53
- if (datasources.includes(key)) {
54
- onUpdate(key, newVlaue);
55
- }
56
- });
57
- runIfExisits(connectedCallback, component);
58
- };
59
- const disconnectedCallback = component["disconnectedCallback"];
60
- component["disconnectedCallback"] = () => {
61
- observer.disconnect();
62
- runIfExisits(subscription);
63
- clearStoresCache(getElement(component));
64
- runIfExisits(disconnectedCallback, component);
65
- };
66
- };
67
-
68
- /** All recognized IBCS scenario column keys: actual (ac1-4), previous period (pp1-4), forecast (fc1-4), plan (pl1-4). */
69
- const SCENARIO_KEYS = [
70
- "ac1",
71
- "ac2",
72
- "ac3",
73
- "ac4",
74
- "pp1",
75
- "pp2",
76
- "pp3",
77
- "pp4",
78
- "fc1",
79
- "fc2",
80
- "fc3",
81
- "fc4",
82
- "pl1",
83
- "pl2",
84
- "pl3",
85
- "pl4",
86
- ];
87
- /** Hierarchical dimension fields from coarsest (rowGroup) to finest (columnSubGroup). */
88
- const DIMENSION_FIELDS = ["rowGroup", "category", "subCategory", "columnGroup", "columnSubGroup"];
89
- function isNumericValue(val) {
90
- return typeof val === "number" && !isNaN(val) && isFinite(val);
91
- }
92
- /** Converts a Set of collected distinct values into a {@link DimensionMeta} summary. */
93
- function buildDimensionMeta(values) {
94
- const distinctValues = Array.from(values);
95
- return {
96
- distinctValues,
97
- count: distinctValues.length,
98
- hasData: distinctValues.length > 0,
99
- };
100
- }
101
- /**
102
- * Computes metadata for a dataset in a single O(n) pass over all rows.
103
- *
104
- * Collects:
105
- * - **Dimensions**: distinct values per dimension field (using Sets for deduplication)
106
- * - **Scenarios**: presence flag, min/max values for each scenario column
107
- * - **Date range**: min/max date strings and distinct date count
108
- * - **Suggested defaults**: `suggestedLevel` is the deepest populated dimension
109
- * (subCategory > category > rowGroup), `suggestedOrder` mirrors it,
110
- * and `suggestedDateInterval` is "auto" when date data exists.
111
- *
112
- * This function is called by bn-dataset whenever data changes and the result is
113
- * stored in the datasetsMeta store for consumption by visualization components.
114
- */
115
- function calculateDatasetMeta(data) {
116
- const dimensionSets = {};
117
- for (const field of DIMENSION_FIELDS) {
118
- dimensionSets[field] = new Set();
119
- }
120
- const scenarioStats = {};
121
- for (const key of SCENARIO_KEYS) {
122
- scenarioStats[key] = { hasData: false, min: null, max: null };
123
- }
124
- const dateSeen = new Set();
125
- let dateMin = null;
126
- let dateMax = null;
127
- const rows = Array.isArray(data) ? data : [];
128
- for (let i = 0; i < rows.length; i++) {
129
- const row = rows[i];
130
- if (row == null)
131
- continue;
132
- for (const field of DIMENSION_FIELDS) {
133
- const val = row[field];
134
- if (val != null && val !== "") {
135
- dimensionSets[field].add(String(val));
136
- }
137
- }
138
- for (const key of SCENARIO_KEYS) {
139
- const val = row[key];
140
- if (isNumericValue(val)) {
141
- const stat = scenarioStats[key];
142
- stat.hasData = true;
143
- if (stat.min === null || val < stat.min)
144
- stat.min = val;
145
- if (stat.max === null || val > stat.max)
146
- stat.max = val;
147
- }
148
- }
149
- const dateVal = row["date"];
150
- if (dateVal != null && dateVal !== "") {
151
- const dateStr = String(dateVal);
152
- dateSeen.add(dateStr);
153
- if (dateMin === null || dateStr < dateMin)
154
- dateMin = dateStr;
155
- if (dateMax === null || dateStr > dateMax)
156
- dateMax = dateStr;
157
- }
158
- }
159
- const scenarios = SCENARIO_KEYS.map((key) => ({
160
- key,
161
- hasData: scenarioStats[key].hasData,
162
- min: scenarioStats[key].min,
163
- max: scenarioStats[key].max,
164
- }));
165
- const availableScenarios = scenarios.filter((s) => s.hasData).map((s) => s.key);
166
- const rowGroup = buildDimensionMeta(dimensionSets["rowGroup"]);
167
- const category = buildDimensionMeta(dimensionSets["category"]);
168
- const subCategory = buildDimensionMeta(dimensionSets["subCategory"]);
169
- const columnGroup = buildDimensionMeta(dimensionSets["columnGroup"]);
170
- const columnSubGroup = buildDimensionMeta(dimensionSets["columnSubGroup"]);
171
- const dateRange = {
172
- min: dateMin,
173
- max: dateMax,
174
- hasData: dateSeen.size > 0,
175
- distinctCount: dateSeen.size,
176
- };
177
- let suggestedLevel = "category";
178
- if (subCategory.hasData) {
179
- suggestedLevel = "subCategory";
180
- }
181
- else if (category.hasData) {
182
- suggestedLevel = "category";
183
- }
184
- else if (rowGroup.hasData) {
185
- suggestedLevel = "rowGroup";
186
- }
187
- const suggestedOrder = suggestedLevel;
188
- const suggestedDateInterval = dateRange.hasData ? "auto" : null;
189
- return {
190
- rowCount: rows.length,
191
- scenarios,
192
- availableScenarios,
193
- rowGroup,
194
- category,
195
- subCategory,
196
- columnGroup,
197
- columnSubGroup,
198
- dateRange,
199
- suggestedLevel,
200
- suggestedOrder,
201
- suggestedDateInterval,
202
- calculatedAt: Date.now(),
203
- };
204
- }
205
-
206
- const bnDatasetCss = () => `bn-dataset{display:none}`;
207
-
208
- const Dataset = class {
209
- constructor(hostRef) {
210
- registerInstance(this, hostRef);
211
- /**
212
- * Commaseperated list of datasourcees
213
- * <br /><br />
214
- * example: <br />
215
- * ```source1,source2```
216
- *
217
- */
218
- this.datasources = "";
219
- /**
220
- * When true, bypasses the AlaSQL query engine and parses the body
221
- * content as raw JSON, writing it directly to the datasets store.
222
- */
223
- this.static = false;
224
- /**
225
- * When true (default), body content is plain text (SQL or JSON).
226
- * When false, body content is a compressed payload (`<hash>:<base64_gzip>`).
227
- */
228
- this.raw = true;
229
- this.lastBodyHash = null;
230
- withComponentStatus(this);
231
- this.errors = withHasError(this);
232
- // @ts-ignore
233
- this.database = new alasql.Database();
234
- withDatasource(this, (name, data) => {
235
- this.database.tables[name] = { data };
236
- this.executeQuery();
237
- });
238
- withBodyObserver(this, (data) => {
239
- let contentHash;
240
- let body;
241
- if (!this.raw && this.static) {
242
- try {
243
- const decoded = decodeCompressedContent(data);
244
- contentHash = decoded.hash;
245
- body = decoded.json;
246
- }
247
- catch (e) {
248
- console.error("Error decoding compressed dataset", e, String(data).slice(0, 200));
249
- return;
250
- }
251
- }
252
- else {
253
- contentHash = computeContentHash(data);
254
- body = data;
255
- }
256
- if (contentHash === this.lastBodyHash)
257
- return;
258
- this.lastBodyHash = contentHash;
259
- this.query = body;
260
- this.executeQuery();
261
- });
262
- }
263
- executeQuery() {
264
- if (!this.stores)
265
- this.stores = getStores(this.element);
266
- if (!!this.query && !!this.name) {
267
- let result;
268
- if (this.static) {
269
- try {
270
- result = JSON.parse(this.query);
271
- }
272
- catch (e) {
273
- console.error("Failed to parse static dataset", e);
274
- result = [];
275
- }
276
- }
277
- else {
278
- result = this.database.exec(this.query);
279
- }
280
- if (this.latestResult !== result) {
281
- this.latestResult = result;
282
- // @ts-ignore
283
- this.stores.datasets.set(this.name, result);
284
- // @ts-ignore
285
- this.stores.datasetsMeta.set(this.name, calculateDatasetMeta(result));
286
- }
287
- }
288
- }
289
- nameUpdated() {
290
- this.executeQuery();
291
- }
292
- render() {
293
- return h(Host, { key: '3e8b6fbc52b5b5cbe0ae88d7aa1d259f86d63e1b' });
294
- }
295
- get element() { return getElement(this); }
296
- static get watchers() { return {
297
- "name": [{
298
- "nameUpdated": 0
299
- }]
300
- }; }
301
- };
302
- Dataset.style = bnDatasetCss();
303
-
304
- export { Dataset as bn_dataset };
@@ -1,141 +0,0 @@
1
- import { r as registerInstance, h, F as Fragment, g as getElement } from './index-JNHhIe7t.js';
2
- import { w as withHasError } from './withHasError-FyY5mQ_3.js';
3
- import './utils-DvvwfRQG.js';
4
-
5
- const bnLayoutPageCss = () => `: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);flex-direction:column;overflow:hidden;float:left;clear:left}`;
6
-
7
- const LayoutPage = class {
8
- constructor(hostRef) {
9
- registerInstance(this, hostRef);
10
- this.messageText = "";
11
- this.messageImage = "";
12
- this.titleBusinessUnit = "";
13
- this.titleOrder = "category";
14
- this.titleOrderDirection = "asc";
15
- this.titleDateFormat = "none";
16
- this.titleDateLink = "none";
17
- this.titleNamespace = "_system";
18
- this.footerDisplayPageNumber = true;
19
- this.pageLayout = "full";
20
- this.pageCustomTemplate = '"a b" "c d"';
21
- this.pageGridGap = "0";
22
- this.pageFitToContent = true;
23
- this.templateMap = new Map([
24
- ["split-vertical", '"a b"'],
25
- ["split-horizontal", '"a" "b"'],
26
- ["2x2", '"a b" "c d"'],
27
- ["3x3", '"a b c" "d e f" "g h i"'],
28
- ["4x4", '"a b c d" "e f g h" "i j k l" "m n o p"'],
29
- ["1-over-2", '"a a" "b c"'],
30
- ["2-over-1", '"a b" "c c"'],
31
- ["1-over-3", '"a a a " "b c d"'],
32
- ["3-over-1", '"a b c" "d d d"'],
33
- ["custom-template", '"a b" "c c c"'],
34
- ["gold3", '"a c" "b c"'],
35
- ["gold4", '"a b c c" "d d c c"'],
36
- ]);
37
- this.errors = withHasError(this);
38
- }
39
- getCommonStyles() {
40
- let height = "100%";
41
- let width = "100%";
42
- if (this.pageFitToContent === true) {
43
- width = "fit-content";
44
- height = "fit-content";
45
- }
46
- return {
47
- display: "grid",
48
- height: height,
49
- width: width,
50
- gap: this.pageGridGap + "px",
51
- };
52
- }
53
- getLayoutStyle() {
54
- return Object.assign(Object.assign({}, this.getCommonStyles()), { "grid-template-areas": this.getTemplateAreas(this.pageLayout), "grid-template-columns": this.getGridTemplateColumns(this.pageLayout) });
55
- }
56
- createDivAreaStyles(elements) {
57
- return elements.map((x) => ({
58
- width: "100%",
59
- overflow: "hidden",
60
- "grid-area": x,
61
- height: "100%",
62
- }));
63
- }
64
- getSlots(slotNames) {
65
- const items = this.createDivAreaStyles(slotNames);
66
- return (h(Fragment, null, items.map((value, index) => {
67
- return (h("div", { style: value }, h("slot", { name: "slot-" + index })));
68
- })));
69
- }
70
- extractSlotNames(styleElement) {
71
- if (styleElement == null) {
72
- return [];
73
- }
74
- const words = styleElement.match(/\b\w+\b/g);
75
- if (!words) {
76
- return [];
77
- }
78
- return Array.from(new Set(words));
79
- }
80
- getTemplateAreas(name) {
81
- if (this.templateMap.has(name) === false && name !== "custom-template") {
82
- return '"a"';
83
- }
84
- if (name === "custom-template") {
85
- return this.pageCustomTemplate;
86
- }
87
- return this.templateMap.get(name);
88
- }
89
- calculatePercentages(input) {
90
- const items = input.trim().split(/\s+/);
91
- const count = items.length;
92
- if (count === 0)
93
- return "100%";
94
- const percentage = (100 / count).toFixed(0) + "%";
95
- return Array(count).fill(percentage).join(" ");
96
- }
97
- getGridTemplateColumns(name) {
98
- if (this.templateMap.has(name) === false && name !== "custom-template") {
99
- return "100%";
100
- }
101
- let template;
102
- const pattern = /"[\w\d\s.]+"/g;
103
- if (name === "custom-template") {
104
- template = this.pageCustomTemplate;
105
- }
106
- else {
107
- template = this.templateMap.get(name);
108
- }
109
- const matches = template.match(pattern);
110
- return this.calculatePercentages(matches[0]);
111
- }
112
- async getNumberOfSlot(name) {
113
- const template = this.getTemplateAreas(name);
114
- return this.extractSlotNames(template).length;
115
- }
116
- componentDidUpdate() {
117
- // workaround for the render rotation issue
118
- const renderOrientation = this.element.closest("bn-context").getAttribute("render-orientation");
119
- if (renderOrientation && renderOrientation !== this.pageOrientation) {
120
- const page = this.element.shadowRoot.querySelector("bn-page");
121
- const layout = this.element.closest("bn-layout-page");
122
- if (layout && page) {
123
- page.style.transform = "rotate(-90deg) translate(-100%)";
124
- page.style.transformOrigin = "top left";
125
- layout.style.width = `${page.clientHeight}px`;
126
- layout.style.height = `${page.clientWidth}px`;
127
- }
128
- }
129
- }
130
- render() {
131
- const style = this.getLayoutStyle();
132
- const arrOfSlots = this.extractSlotNames(style["grid-template-areas"]);
133
- return (
134
- // @ts-ignore
135
- h("bn-page", { key: '2f67c9b949ab18de247ea492c95b1e53e450fcca', styles: this.styles, format: this.pageFormat, orientation: this.pageOrientation }, h("bn-message", { key: '6fb865fe6cf9785c6a3932967d9969d5e0a4eda5', text: this.messageText, image: this.messageImage }), h("bn-title", { key: '3ba10325d834b364d0a68012f589ba5508877652', 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 }), h("bn-body", { key: '16bcb1e231d65b2f0e90c82d8e3ec1a84cc79c59' }, h("div", { key: '1408692a37d04686e5d9ad00bca7f1d24787b595', style: style }, this.getSlots(arrOfSlots))), h("bn-footer", { key: '83e924e38db44fb678490a8a4d12b264699fc3e2', text: this.footerText, "page-number": this.pageNumber, "display-page-number": this.footerDisplayPageNumber })));
136
- }
137
- get element() { return getElement(this); }
138
- };
139
- LayoutPage.style = bnLayoutPageCss();
140
-
141
- export { LayoutPage as bn_layout_page };
@@ -1,50 +0,0 @@
1
- import { r as registerInstance, h, H as Host, g as getElement } 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 { g as getStores } from './context-protocol-BHnQsVsr.js';
5
- import { w as withHasError } from './withHasError-FyY5mQ_3.js';
6
- import './utils-DvvwfRQG.js';
7
-
8
- const bnMessageCss = () => `: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-message){height:4.55em;box-sizing:border-box;-webkit-box-sizing:border-box;border-bottom:0.1em solid #ddd}div#message-text{font-size:1.4em;overflow:clip;display:inline}.image{z-index:2;background-color:transparent;border:transparent;height:4em;width:auto;display:inline}`;
9
-
10
- const Footer = class {
11
- constructor(hostRef) {
12
- registerInstance(this, hostRef);
13
- withComponentStatus(this);
14
- this.errors = withHasError(this);
15
- this.componentStyle = withComponentStyle(this);
16
- }
17
- connectedCallback() {
18
- this.stores = getStores(this.element);
19
- }
20
- getFontStyles() {
21
- return this.componentStyle(($) => {
22
- var _a, _b, _c, _d;
23
- return ({
24
- "--bn-font-family": ((_a = $["global"]) === null || _a === void 0 ? void 0 : _a["fontFamily"]) || "'Noto Sans', sans-serif",
25
- "--bn-font-size": `${((_b = $["global"]) === null || _b === void 0 ? void 0 : _b["fontSizePx"]) || 13.3333}px`,
26
- "--bn-font-color": ((_c = $["global"]) === null || _c === void 0 ? void 0 : _c["fontColor"]) || "#000000",
27
- "--bn-font-background": ((_d = $["global"]) === null || _d === void 0 ? void 0 : _d["fontBackgroundColor"]) || "#ffffff",
28
- });
29
- });
30
- }
31
- prepareAssetUrl(value) {
32
- if (value == null || value === "") {
33
- return "";
34
- }
35
- const assetsState = this.stores.assets.state;
36
- // for backward compatibility deprecated "asset:" prefix
37
- if (value.startsWith("asset:")) {
38
- return assetsState[value.substring(6)];
39
- }
40
- return assetsState[value] || value;
41
- }
42
- render() {
43
- return (h(Host, { key: 'bbe7f6098aa6f3a5495b36557b218a82ec2ccbca', id: this.text || this.image ? "container-page-message" : "container", style: this.getFontStyles() }, h("div", { key: 'd89297da5605b0ee1cc757b1771b6a48525a24e5', id: "message-text" }, this.text != null && this.text !== "" ? h("span", { class: "note" }, this.text) : ""), h("div", { key: '70bc74b0a8a5a39fdd2931cf86faada294142a26', id: "page-image" }, this.image != null && this.image !== "" ? h("img", { class: "image", src: this.prepareAssetUrl(this.image) }) : "")));
44
- }
45
- static get assetsDirs() { return ["assets"]; }
46
- get element() { return getElement(this); }
47
- };
48
- Footer.style = bnMessageCss();
49
-
50
- export { Footer as bn_message };