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