@bino-bi/bn-template-engine 1.0.0-alpha.5 → 1.0.0-alpha.7
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-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-9721a5bb.entry.js +1 -0
- package/dist/bn-template-engine/p-9a564f8f.entry.js +1 -0
- package/dist/bn-template-engine/p-9cee22fa.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-Dnkv5rt8.js +1 -0
- package/dist/bn-template-engine/p-bdd2b243.entry.js +1 -0
- package/dist/bn-template-engine/p-f27995c9.entry.js +1 -0
- package/dist/bn-template-engine/p-f6ecb265.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 +9099 -0
- package/dist/cjs/bn-card.cjs.entry.js +3 -4
- package/dist/cjs/bn-chart-time.cjs.entry.js +55 -24
- 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 +156 -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/withInheritedProps-BH2KNER3.js +157 -0
- package/dist/cjs/{withStyled-CS1Yp4sv.js → withStyled-9tG024gQ.js} +62 -9
- package/dist/collection/components/bn-chart-structure/bn-chart-structure.js +46 -10
- package/dist/collection/components/bn-chart-time/bn-chart-time.js +44 -8
- package/dist/collection/components/bn-layout-card/bn-layout-card.css +1 -0
- package/dist/collection/components/bn-layout-card/bn-layout-card.js +193 -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/components/bn-table/bn-table.js +59 -13
- package/dist/collection/utils/parentDimensions.js +38 -6
- package/dist/collection/utils/withInheritedProps.js +152 -0
- package/dist/components/bn-chart-structure.js +1 -1
- package/dist/components/bn-chart-time.js +1 -1
- package/dist/components/bn-layout-card.js +1 -1
- package/dist/components/bn-layout-page.js +1 -1
- package/dist/components/bn-table.js +1 -1
- package/dist/components/scaling.js +1 -1
- package/dist/components/withInheritedProps.js +1 -0
- 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 +9082 -0
- package/dist/esm/bn-card.entry.js +4 -5
- package/dist/esm/bn-chart-time.entry.js +52 -21
- 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 +157 -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/withInheritedProps-BlXDxhHK.js +154 -0
- package/dist/esm/{withStyled--qQWquTH.js → withStyled-CE3_3taP.js} +57 -5
- package/dist/types/components/bn-chart-structure/bn-chart-structure.d.ts +1 -0
- package/dist/types/components/bn-chart-time/bn-chart-time.d.ts +1 -0
- package/dist/types/components/bn-layout-card/bn-layout-card.d.ts +147 -0
- package/dist/types/components/bn-layout-page/bn-layout-page.d.ts +154 -0
- package/dist/types/components/bn-table/bn-table.d.ts +1 -0
- package/dist/types/components.d.ts +168 -0
- package/dist/types/utils/parentDimensions.d.ts +6 -1
- package/dist/types/utils/withInheritedProps.d.ts +38 -0
- 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,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var withHasError = require('./withHasError-B8gHkfV2.js');
|
|
4
4
|
|
|
5
5
|
/** Lifecycle state of a tracked component instance. */
|
|
6
6
|
var ComponentStatus;
|
|
@@ -88,21 +88,21 @@ var ComponentRegister;
|
|
|
88
88
|
*/
|
|
89
89
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
90
90
|
const withComponentStatus = (component) => {
|
|
91
|
-
const uuid =
|
|
91
|
+
const uuid = withHasError.generateUUID();
|
|
92
92
|
const connectedCallback = component["connectedCallback"];
|
|
93
93
|
component["connectedCallback"] = () => {
|
|
94
94
|
ComponentRegister.updateStatus(uuid, ComponentStatus.RUNNING);
|
|
95
|
-
|
|
95
|
+
withHasError.runIfExisits(connectedCallback, component);
|
|
96
96
|
};
|
|
97
97
|
const componentWillRender = component["componentWillRender"];
|
|
98
98
|
component["componentWillRender"] = () => {
|
|
99
99
|
ComponentRegister.updateStatus(uuid, ComponentStatus.RUNNING);
|
|
100
|
-
|
|
100
|
+
withHasError.runIfExisits(componentWillRender, component);
|
|
101
101
|
};
|
|
102
102
|
const componentDidRender = component["componentDidRender"];
|
|
103
103
|
component["componentDidRender"] = () => {
|
|
104
104
|
ComponentRegister.updateStatus(uuid, ComponentStatus.SUCCESSFUL);
|
|
105
|
-
|
|
105
|
+
withHasError.runIfExisits(componentDidRender, component);
|
|
106
106
|
};
|
|
107
107
|
};
|
|
108
108
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var index = require('./index-Cjw0q6gP.js');
|
|
4
4
|
var contextProtocol = require('./context-protocol-DRQWrwsA.js');
|
|
5
|
-
var
|
|
5
|
+
var withHasError = require('./withHasError-B8gHkfV2.js');
|
|
6
6
|
|
|
7
7
|
const isObject = (obj) => {
|
|
8
8
|
if (typeof obj === 'object' && obj !== null) {
|
|
@@ -110,14 +110,14 @@ const withComponentStyle = (component) => {
|
|
|
110
110
|
index.forceUpdate(index.getElement(component));
|
|
111
111
|
}
|
|
112
112
|
});
|
|
113
|
-
|
|
113
|
+
withHasError.runIfExisits(connectedCallback, component);
|
|
114
114
|
};
|
|
115
115
|
const disconnectedCallback = component["disconnectedCallback"];
|
|
116
116
|
component["disconnectedCallback"] = () => {
|
|
117
117
|
observer.disconnect();
|
|
118
|
-
|
|
118
|
+
withHasError.runIfExisits(subscription);
|
|
119
119
|
contextProtocol.clearStoresCache(index.getElement(component));
|
|
120
|
-
|
|
120
|
+
withHasError.runIfExisits(disconnectedCallback, component);
|
|
121
121
|
};
|
|
122
122
|
const componentStyle = (q) => {
|
|
123
123
|
return q(style);
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var index = require('./index-Cjw0q6gP.js');
|
|
4
|
+
|
|
3
5
|
/** Concatenates name parts with spaces, skipping falsy segments. */
|
|
4
6
|
/**
|
|
5
7
|
* Safely invokes `fn` if it is a function; otherwise does nothing.
|
|
@@ -81,6 +83,72 @@ const ref = (value, onChange) => {
|
|
|
81
83
|
};
|
|
82
84
|
};
|
|
83
85
|
|
|
86
|
+
const urlAlphabet =
|
|
87
|
+
'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict';
|
|
88
|
+
|
|
89
|
+
/* @ts-self-types="./index.d.ts" */
|
|
90
|
+
let nanoid = (size = 21) => {
|
|
91
|
+
let id = '';
|
|
92
|
+
let bytes = crypto.getRandomValues(new Uint8Array((size |= 0)));
|
|
93
|
+
while (size--) {
|
|
94
|
+
id += urlAlphabet[bytes[size] & 63];
|
|
95
|
+
}
|
|
96
|
+
return id
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Mixin that provides an {@link ErrorDispatcher} for managing validation
|
|
101
|
+
* errors and warnings on a component.
|
|
102
|
+
*
|
|
103
|
+
* Errors are stored internally via a reactive {@link ref}. On every change,
|
|
104
|
+
* the host element's `has-error` attribute is updated with a JSON-serialized
|
|
105
|
+
* array of {@link ErrorItem}s (or removed when empty). This allows external
|
|
106
|
+
* CSS selectors and parent components to detect error states declaratively.
|
|
107
|
+
*
|
|
108
|
+
* @param component - The Stencil component instance
|
|
109
|
+
* @returns An {@link ErrorDispatcher} for adding, replacing, and removing errors
|
|
110
|
+
*/
|
|
111
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
112
|
+
const withHasError = (component) => {
|
|
113
|
+
const { set, modify } = ref([], (items) => {
|
|
114
|
+
const elm = index.getElement(component);
|
|
115
|
+
if (items.length === 0) {
|
|
116
|
+
elm.removeAttribute("has-error");
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
elm.setAttribute("has-error", JSON.stringify(items));
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
return {
|
|
123
|
+
clear: () => {
|
|
124
|
+
set([]);
|
|
125
|
+
},
|
|
126
|
+
replace: (errors) => {
|
|
127
|
+
set(errors.map((item) => {
|
|
128
|
+
if (!item.id) {
|
|
129
|
+
item.id = nanoid();
|
|
130
|
+
}
|
|
131
|
+
return item;
|
|
132
|
+
}));
|
|
133
|
+
},
|
|
134
|
+
add: (error) => {
|
|
135
|
+
if (!error.id)
|
|
136
|
+
error.id = nanoid();
|
|
137
|
+
modify((current) => [...current, error]);
|
|
138
|
+
return error.id;
|
|
139
|
+
},
|
|
140
|
+
addOrReplace: (error) => {
|
|
141
|
+
if (error.id === undefined)
|
|
142
|
+
throw "missing";
|
|
143
|
+
modify((current) => [...current.filter((item) => item.id !== error.id), error]);
|
|
144
|
+
return error.id;
|
|
145
|
+
},
|
|
146
|
+
remove: (id) => {
|
|
147
|
+
modify((current) => current.filter((item) => item.id !== id));
|
|
148
|
+
},
|
|
149
|
+
};
|
|
150
|
+
};
|
|
151
|
+
|
|
84
152
|
exports.generateUUID = generateUUID;
|
|
85
|
-
exports.ref = ref;
|
|
86
153
|
exports.runIfExisits = runIfExisits;
|
|
154
|
+
exports.withHasError = withHasError;
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var index = require('./index-Cjw0q6gP.js');
|
|
4
|
+
var withHasError = require('./withHasError-B8gHkfV2.js');
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Reserved prop values that activate inheritance from ancestor layout
|
|
8
|
+
* components (`bn-layout-card` or `bn-layout-page`).
|
|
9
|
+
*/
|
|
10
|
+
const INHERITED_CLOSEST = "inherited-closest";
|
|
11
|
+
const INHERITED_PAGE = "inherited-page";
|
|
12
|
+
/** Tags that qualify as inheritance ancestors. */
|
|
13
|
+
const ANCESTOR_CARD = "bn-layout-card";
|
|
14
|
+
const ANCESTOR_PAGE = "bn-layout-page";
|
|
15
|
+
/**
|
|
16
|
+
* Returns `true` when `value` is one of the recognised inheritance keywords.
|
|
17
|
+
*/
|
|
18
|
+
function isInheritedValue(value) {
|
|
19
|
+
return value === INHERITED_CLOSEST || value === INHERITED_PAGE;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Walks up the DOM tree (crossing shadow boundaries) to find the nearest
|
|
23
|
+
* ancestor layout component.
|
|
24
|
+
*
|
|
25
|
+
* - `"inherited-closest"` matches the first `bn-layout-card` or `bn-layout-page`.
|
|
26
|
+
* - `"inherited-page"` skips cards and matches only `bn-layout-page`.
|
|
27
|
+
*
|
|
28
|
+
* Uses the same traversal pattern as `findContextElement` in
|
|
29
|
+
* `context-protocol.ts`.
|
|
30
|
+
*/
|
|
31
|
+
function findAncestor(element, mode) {
|
|
32
|
+
let current = element.parentNode;
|
|
33
|
+
while (current) {
|
|
34
|
+
if (current instanceof HTMLElement) {
|
|
35
|
+
const tag = current.nodeName.toLowerCase();
|
|
36
|
+
if (mode === INHERITED_PAGE) {
|
|
37
|
+
if (tag === ANCESTOR_PAGE)
|
|
38
|
+
return current;
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
if (tag === ANCESTOR_CARD || tag === ANCESTOR_PAGE)
|
|
42
|
+
return current;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
if (current.parentNode) {
|
|
46
|
+
current = current.parentNode;
|
|
47
|
+
}
|
|
48
|
+
else if (current instanceof ShadowRoot) {
|
|
49
|
+
current = current.host;
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
break;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return undefined;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Mixin that enables property inheritance from ancestor layout components.
|
|
59
|
+
*
|
|
60
|
+
* When a component sets a prop to `"inherited-closest"` or `"inherited-page"`,
|
|
61
|
+
* this mixin resolves the actual value by walking up the DOM to find the
|
|
62
|
+
* nearest `bn-layout-card` / `bn-layout-page` and reading the corresponding
|
|
63
|
+
* HTML attribute. A `MutationObserver` watches the ancestor for attribute
|
|
64
|
+
* changes, triggering a re-render when inherited values update.
|
|
65
|
+
*
|
|
66
|
+
* Follows the same decorator-style pattern as `withComponentStyle`.
|
|
67
|
+
*
|
|
68
|
+
* @param component The Stencil component instance
|
|
69
|
+
* @param mappings Array of prop-to-attribute mappings
|
|
70
|
+
* @returns A resolver function used inside `prepare*()` methods
|
|
71
|
+
*/
|
|
72
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
73
|
+
const withInheritedProps = (component, mappings) => {
|
|
74
|
+
/** Resolved values keyed by propName. */
|
|
75
|
+
const resolved = new Map();
|
|
76
|
+
/** Observer watching the ancestor element's attributes. */
|
|
77
|
+
let observer = null;
|
|
78
|
+
/** The ancestor element currently being observed. */
|
|
79
|
+
let ancestorEl;
|
|
80
|
+
/**
|
|
81
|
+
* For each mapping whose prop is an inheritance keyword, walk the DOM once
|
|
82
|
+
* and read the corresponding attribute from the ancestor.
|
|
83
|
+
*/
|
|
84
|
+
const resolveAll = () => {
|
|
85
|
+
const element = index.getElement(component);
|
|
86
|
+
resolved.clear();
|
|
87
|
+
// Determine which attrs to watch on which ancestor
|
|
88
|
+
const attrsToWatch = [];
|
|
89
|
+
for (const mapping of mappings) {
|
|
90
|
+
const value = component[mapping.propName];
|
|
91
|
+
if (typeof value !== "string" || !isInheritedValue(value))
|
|
92
|
+
continue;
|
|
93
|
+
// Find ancestor (re-use the first one found for the same mode)
|
|
94
|
+
if (!ancestorEl) {
|
|
95
|
+
ancestorEl = findAncestor(element, value);
|
|
96
|
+
}
|
|
97
|
+
if (!ancestorEl)
|
|
98
|
+
continue;
|
|
99
|
+
const attrValue = ancestorEl.getAttribute(mapping.ancestorAttr);
|
|
100
|
+
if (attrValue != null) {
|
|
101
|
+
resolved.set(mapping.propName, attrValue);
|
|
102
|
+
}
|
|
103
|
+
attrsToWatch.push(mapping.ancestorAttr);
|
|
104
|
+
}
|
|
105
|
+
// Set up MutationObserver on the ancestor
|
|
106
|
+
if (ancestorEl && attrsToWatch.length > 0) {
|
|
107
|
+
observer = new MutationObserver(() => {
|
|
108
|
+
// Re-read all inherited attributes from the ancestor
|
|
109
|
+
for (const mapping of mappings) {
|
|
110
|
+
if (!isInheritedValue(component[mapping.propName]))
|
|
111
|
+
continue;
|
|
112
|
+
const attrValue = ancestorEl.getAttribute(mapping.ancestorAttr);
|
|
113
|
+
if (attrValue != null) {
|
|
114
|
+
resolved.set(mapping.propName, attrValue);
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
resolved.delete(mapping.propName);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
index.forceUpdate(component);
|
|
121
|
+
});
|
|
122
|
+
observer.observe(ancestorEl, {
|
|
123
|
+
attributes: true,
|
|
124
|
+
attributeFilter: attrsToWatch,
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
const connectedCallback = component["connectedCallback"];
|
|
129
|
+
component["connectedCallback"] = () => {
|
|
130
|
+
resolveAll();
|
|
131
|
+
withHasError.runIfExisits(connectedCallback, component);
|
|
132
|
+
};
|
|
133
|
+
const disconnectedCallback = component["disconnectedCallback"];
|
|
134
|
+
component["disconnectedCallback"] = () => {
|
|
135
|
+
if (observer) {
|
|
136
|
+
observer.disconnect();
|
|
137
|
+
observer = null;
|
|
138
|
+
}
|
|
139
|
+
ancestorEl = undefined;
|
|
140
|
+
resolved.clear();
|
|
141
|
+
withHasError.runIfExisits(disconnectedCallback, component);
|
|
142
|
+
};
|
|
143
|
+
/**
|
|
144
|
+
* Resolver: returns the inherited value for the given prop, or `undefined`
|
|
145
|
+
* when the prop is not using inheritance (so the caller falls through to
|
|
146
|
+
* its normal logic).
|
|
147
|
+
*/
|
|
148
|
+
const resolve = (propName, currentValue) => {
|
|
149
|
+
if (!isInheritedValue(currentValue))
|
|
150
|
+
return undefined;
|
|
151
|
+
return resolved.get(propName);
|
|
152
|
+
};
|
|
153
|
+
return resolve;
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
exports.isInheritedValue = isInheritedValue;
|
|
157
|
+
exports.withInheritedProps = withInheritedProps;
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var Order = require('./Order-iG11HI4R.js');
|
|
5
|
-
var DateStringFactory = require('./DateStringFactory-CSKvbS8K.js');
|
|
3
|
+
var Order = require('./Order-BGx39pS5.js');
|
|
6
4
|
var index = require('./index-Cjw0q6gP.js');
|
|
7
|
-
var
|
|
5
|
+
var withHasError = require('./withHasError-B8gHkfV2.js');
|
|
8
6
|
|
|
9
7
|
/**
|
|
10
8
|
* Prop validators for Stencil @Watch handlers.
|
|
@@ -116,10 +114,10 @@ function isValidDate(value) {
|
|
|
116
114
|
return Number.isInteger(newDate);
|
|
117
115
|
}
|
|
118
116
|
function isValidDateLink(value) {
|
|
119
|
-
return (value === null || value === void 0 ? void 0 : value.toUpperCase()) in
|
|
117
|
+
return (value === null || value === void 0 ? void 0 : value.toUpperCase()) in Order.DateLink;
|
|
120
118
|
}
|
|
121
119
|
function isValidDateFormat(value) {
|
|
122
|
-
return (value === null || value === void 0 ? void 0 : value.toUpperCase()) in
|
|
120
|
+
return (value === null || value === void 0 ? void 0 : value.toUpperCase()) in Order.DateDistance;
|
|
123
121
|
}
|
|
124
122
|
function isValidAxisLabelsMode(value) {
|
|
125
123
|
return (value === null || value === void 0 ? void 0 : value.toUpperCase()) in Order.AxisLabelsMode;
|
|
@@ -265,6 +263,60 @@ class StyleSheet {
|
|
|
265
263
|
}
|
|
266
264
|
const styleSheet = new StyleSheet();
|
|
267
265
|
|
|
266
|
+
/* eslint-disable */
|
|
267
|
+
// Inspired by https://github.com/garycourt/murmurhash-js
|
|
268
|
+
// Ported from https://github.com/aappleby/smhasher/blob/61a0530f28277f2e850bfc39600ce61d02b518de/src/MurmurHash2.cpp#L37-L86
|
|
269
|
+
function murmur2(str) {
|
|
270
|
+
// 'm' and 'r' are mixing constants generated offline.
|
|
271
|
+
// They're not really 'magic', they just happen to work well.
|
|
272
|
+
// const m = 0x5bd1e995;
|
|
273
|
+
// const r = 24;
|
|
274
|
+
// Initialize the hash
|
|
275
|
+
var h = 0; // Mix 4 bytes at a time into the hash
|
|
276
|
+
|
|
277
|
+
var k,
|
|
278
|
+
i = 0,
|
|
279
|
+
len = str.length;
|
|
280
|
+
|
|
281
|
+
for (; len >= 4; ++i, len -= 4) {
|
|
282
|
+
k = str.charCodeAt(i) & 0xff | (str.charCodeAt(++i) & 0xff) << 8 | (str.charCodeAt(++i) & 0xff) << 16 | (str.charCodeAt(++i) & 0xff) << 24;
|
|
283
|
+
k =
|
|
284
|
+
/* Math.imul(k, m): */
|
|
285
|
+
(k & 0xffff) * 0x5bd1e995 + ((k >>> 16) * 0xe995 << 16);
|
|
286
|
+
k ^=
|
|
287
|
+
/* k >>> r: */
|
|
288
|
+
k >>> 24;
|
|
289
|
+
h =
|
|
290
|
+
/* Math.imul(k, m): */
|
|
291
|
+
(k & 0xffff) * 0x5bd1e995 + ((k >>> 16) * 0xe995 << 16) ^
|
|
292
|
+
/* Math.imul(h, m): */
|
|
293
|
+
(h & 0xffff) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16);
|
|
294
|
+
} // Handle the last few bytes of the input array
|
|
295
|
+
|
|
296
|
+
|
|
297
|
+
switch (len) {
|
|
298
|
+
case 3:
|
|
299
|
+
h ^= (str.charCodeAt(i + 2) & 0xff) << 16;
|
|
300
|
+
|
|
301
|
+
case 2:
|
|
302
|
+
h ^= (str.charCodeAt(i + 1) & 0xff) << 8;
|
|
303
|
+
|
|
304
|
+
case 1:
|
|
305
|
+
h ^= str.charCodeAt(i) & 0xff;
|
|
306
|
+
h =
|
|
307
|
+
/* Math.imul(h, m): */
|
|
308
|
+
(h & 0xffff) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16);
|
|
309
|
+
} // Do a few final mixes of the hash to ensure the last few
|
|
310
|
+
// bytes are well-incorporated.
|
|
311
|
+
|
|
312
|
+
|
|
313
|
+
h ^= h >>> 13;
|
|
314
|
+
h =
|
|
315
|
+
/* Math.imul(h, m): */
|
|
316
|
+
(h & 0xffff) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16);
|
|
317
|
+
return ((h ^ h >>> 15) >>> 0).toString(36);
|
|
318
|
+
}
|
|
319
|
+
|
|
268
320
|
const transofrmToUnitString = (value) => {
|
|
269
321
|
if (isValidNumber(value)) {
|
|
270
322
|
return `${value}px`;
|
|
@@ -344,7 +396,7 @@ const attributes = {
|
|
|
344
396
|
};
|
|
345
397
|
const attributesNames = Object.keys(attributes);
|
|
346
398
|
function getClassName(attr, value) {
|
|
347
|
-
const valueKey =
|
|
399
|
+
const valueKey = murmur2(value);
|
|
348
400
|
return `bn-c-${attr.className}_${valueKey}`;
|
|
349
401
|
}
|
|
350
402
|
function getStyle(attr, className, value) {
|
|
@@ -433,12 +485,12 @@ const withStyled = (component) => {
|
|
|
433
485
|
else {
|
|
434
486
|
throw new Error(`Can't find element field in component ${undefined}`);
|
|
435
487
|
}
|
|
436
|
-
|
|
488
|
+
withHasError.runIfExisits(cstrConnectedCallback, component);
|
|
437
489
|
};
|
|
438
490
|
component["disconnectedCallback"] = () => {
|
|
439
491
|
// MutationObserver has no per-element unobserve — the shared observer
|
|
440
492
|
// automatically stops firing for elements removed from the DOM.
|
|
441
|
-
|
|
493
|
+
withHasError.runIfExisits(cstrDisconnectedCallback, component);
|
|
442
494
|
};
|
|
443
495
|
};
|
|
444
496
|
|
|
@@ -458,6 +510,7 @@ exports.isValidMeasureScale = isValidMeasureScale;
|
|
|
458
510
|
exports.isValidMeasureType = isValidMeasureType;
|
|
459
511
|
exports.isValidNumber = isValidNumber;
|
|
460
512
|
exports.isValidTableType = isValidTableType;
|
|
513
|
+
exports.murmur2 = murmur2;
|
|
461
514
|
exports.validateColumnThereOfJsonStr = validateColumnThereOfJsonStr;
|
|
462
515
|
exports.validateMeasureList = validateMeasureList;
|
|
463
516
|
exports.validateOrderList = validateOrderList;
|
|
@@ -7,6 +7,7 @@ import { globalLabelKeys } from "../../stores/internationalization";
|
|
|
7
7
|
import { withStyled } from "../../utils/styled/withStyled";
|
|
8
8
|
import withComponentStyle from "../../utils/withComponentStyle";
|
|
9
9
|
import withHasError from "../../utils/withHasError";
|
|
10
|
+
import withInheritedProps, { isInheritedValue } from "../../utils/withInheritedProps";
|
|
10
11
|
import { getParentDimensions } from "../../utils/parentDimensions";
|
|
11
12
|
import { parseScaling } from "../../utils/scaling";
|
|
12
13
|
import { AggregationLevel, StackBy, StackMode, StackOrder } from "../../utils/constants";
|
|
@@ -23,8 +24,12 @@ import { OrderColumn, OrderDirection } from "../../utils/model/Order";
|
|
|
23
24
|
*/
|
|
24
25
|
export class Chart {
|
|
25
26
|
validateScenario(newValue) {
|
|
26
|
-
const invalidScenarios = validateScenarioList(newValue);
|
|
27
27
|
const errId = "ERR_scenarios";
|
|
28
|
+
if (isInheritedValue(newValue)) {
|
|
29
|
+
this.errors.remove(errId);
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
const invalidScenarios = validateScenarioList(newValue);
|
|
28
33
|
if (invalidScenarios.length > 0) {
|
|
29
34
|
this.errors.addOrReplace({
|
|
30
35
|
id: errId,
|
|
@@ -38,6 +43,10 @@ export class Chart {
|
|
|
38
43
|
}
|
|
39
44
|
validateVariances(newValue) {
|
|
40
45
|
const errIdVar = "ERR_variances";
|
|
46
|
+
if (isInheritedValue(newValue)) {
|
|
47
|
+
this.errors.remove(errIdVar);
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
41
50
|
const invalidVariances = validateVariancesList(newValue);
|
|
42
51
|
if (invalidVariances.length > 0) {
|
|
43
52
|
this.errors.addOrReplace({
|
|
@@ -90,8 +99,12 @@ export class Chart {
|
|
|
90
99
|
}
|
|
91
100
|
}
|
|
92
101
|
validateOrderList(newValue) {
|
|
93
|
-
const invalidElements = validateOrderList(newValue);
|
|
94
102
|
const errId = "ERR_order";
|
|
103
|
+
if (isInheritedValue(newValue)) {
|
|
104
|
+
this.errors.remove(errId);
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
const invalidElements = validateOrderList(newValue);
|
|
95
108
|
if (invalidElements.length > 0) {
|
|
96
109
|
this.errors.addOrReplace({
|
|
97
110
|
id: errId,
|
|
@@ -105,6 +118,10 @@ export class Chart {
|
|
|
105
118
|
}
|
|
106
119
|
validateOrderDirection(newValue) {
|
|
107
120
|
const errId = "ERR_orderDirection";
|
|
121
|
+
if (isInheritedValue(newValue)) {
|
|
122
|
+
this.errors.remove(errId);
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
108
125
|
if (!isValidDirection(newValue)) {
|
|
109
126
|
this.errors.addOrReplace({
|
|
110
127
|
id: errId,
|
|
@@ -310,6 +327,12 @@ export class Chart {
|
|
|
310
327
|
this.errors = withHasError(this);
|
|
311
328
|
this.componentStyle = withComponentStyle(this);
|
|
312
329
|
this.t = withTranslation(this).t;
|
|
330
|
+
this.resolveInherited = withInheritedProps(this, [
|
|
331
|
+
{ propName: "scenarios", ancestorAttr: "title-scenarios" },
|
|
332
|
+
{ propName: "variances", ancestorAttr: "title-variances" },
|
|
333
|
+
{ propName: "order", ancestorAttr: "title-order" },
|
|
334
|
+
{ propName: "orderDirection", ancestorAttr: "title-order-direction" },
|
|
335
|
+
]);
|
|
313
336
|
}
|
|
314
337
|
componentWillLoad() {
|
|
315
338
|
this.validateScenario(this.scenarios);
|
|
@@ -410,6 +433,11 @@ export class Chart {
|
|
|
410
433
|
}
|
|
411
434
|
prepareScenarios() {
|
|
412
435
|
var _a, _b, _c, _d;
|
|
436
|
+
const inherited = this.resolveInherited("scenarios", this.scenarios);
|
|
437
|
+
if (inherited !== undefined) {
|
|
438
|
+
this.errors.remove("AUTO_scenarios");
|
|
439
|
+
return inherited.split(",").map((entry) => entry.trim());
|
|
440
|
+
}
|
|
413
441
|
const isAuto = ((_a = this.scenarios) === null || _a === void 0 ? void 0 : _a.trim().toLowerCase()) === "auto";
|
|
414
442
|
if (isBlankInput(this.scenarios) || isAuto) {
|
|
415
443
|
if (((_c = (_b = this.datasetMeta) === null || _b === void 0 ? void 0 : _b.availableScenarios) === null || _c === void 0 ? void 0 : _c.length) > 0) {
|
|
@@ -432,6 +460,10 @@ export class Chart {
|
|
|
432
460
|
}
|
|
433
461
|
prepareVariances() {
|
|
434
462
|
var _a;
|
|
463
|
+
const inherited = this.resolveInherited("variances", this.variances);
|
|
464
|
+
if (inherited !== undefined) {
|
|
465
|
+
return inherited.split(",").map((entry) => entry.trim());
|
|
466
|
+
}
|
|
435
467
|
if (isBlankInput(this.variances)) {
|
|
436
468
|
return [];
|
|
437
469
|
}
|
|
@@ -500,11 +532,15 @@ export class Chart {
|
|
|
500
532
|
return AggregationLevel[(_c = this.level) === null || _c === void 0 ? void 0 : _c.toUpperCase()];
|
|
501
533
|
}
|
|
502
534
|
prepareOrder() {
|
|
503
|
-
var _a
|
|
504
|
-
const
|
|
535
|
+
var _a;
|
|
536
|
+
const inheritedOrder = this.resolveInherited("order", this.order);
|
|
537
|
+
const inheritedDirection = this.resolveInherited("orderDirection", this.orderDirection);
|
|
538
|
+
const effectiveOrder = inheritedOrder !== null && inheritedOrder !== void 0 ? inheritedOrder : this.order;
|
|
539
|
+
const effectiveDirection = inheritedDirection !== null && inheritedDirection !== void 0 ? inheritedDirection : this.orderDirection;
|
|
540
|
+
const isAuto = (effectiveOrder === null || effectiveOrder === void 0 ? void 0 : effectiveOrder.trim().toLowerCase()) === "auto";
|
|
505
541
|
let orderStr;
|
|
506
|
-
if (isBlankInput(
|
|
507
|
-
if ((
|
|
542
|
+
if (isBlankInput(effectiveOrder) || isAuto) {
|
|
543
|
+
if ((_a = this.datasetMeta) === null || _a === void 0 ? void 0 : _a.suggestedOrder) {
|
|
508
544
|
if (!isAuto) {
|
|
509
545
|
this.errors.addOrReplace({
|
|
510
546
|
id: "AUTO_order",
|
|
@@ -518,16 +554,16 @@ export class Chart {
|
|
|
518
554
|
orderStr = this.datasetMeta.suggestedOrder;
|
|
519
555
|
}
|
|
520
556
|
else {
|
|
521
|
-
orderStr =
|
|
557
|
+
orderStr = effectiveOrder;
|
|
522
558
|
}
|
|
523
559
|
}
|
|
524
560
|
else {
|
|
525
561
|
this.errors.remove("AUTO_order");
|
|
526
|
-
orderStr =
|
|
562
|
+
orderStr = effectiveOrder;
|
|
527
563
|
}
|
|
528
564
|
const tableOrder = {
|
|
529
565
|
hierarchy: orderStr === null || orderStr === void 0 ? void 0 : orderStr.split(",").map((entry) => OrderColumn[entry === null || entry === void 0 ? void 0 : entry.toUpperCase()]),
|
|
530
|
-
direction: OrderDirection[
|
|
566
|
+
direction: OrderDirection[effectiveDirection === null || effectiveDirection === void 0 ? void 0 : effectiveDirection.toUpperCase()],
|
|
531
567
|
};
|
|
532
568
|
return tableOrder;
|
|
533
569
|
}
|
|
@@ -715,7 +751,7 @@ export class Chart {
|
|
|
715
751
|
scenariosArray = [...scenariosArray, ...variancesArray];
|
|
716
752
|
}
|
|
717
753
|
const fontStyles = this.getFontStyles();
|
|
718
|
-
return (h(Host, { key: '
|
|
754
|
+
return (h(Host, { key: '528b1d9607de916cb2ed06a2f2bac2acdc85da30', style: fontStyles }, h("div", { key: 'e5454756d03fc081e843dee241c52695212da4e3', class: "container" }, scenariosArray.map(this.chartTemplate))));
|
|
719
755
|
}
|
|
720
756
|
static get is() { return "bn-chart-structure"; }
|
|
721
757
|
static get encapsulation() { return "shadow"; }
|