@bino-bi/bn-template-engine 1.0.0-alpha.7 → 1.0.0-alpha.8

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 (107) hide show
  1. package/dist/bn-template-engine/bn-template-engine.esm.js +1 -1
  2. package/dist/bn-template-engine/p-0d41c5d8.entry.js +1 -0
  3. package/dist/bn-template-engine/p-67538176.entry.js +1 -0
  4. package/dist/bn-template-engine/p-825a07a8.entry.js +1 -0
  5. package/dist/bn-template-engine/p-916296a5.entry.js +1 -0
  6. package/dist/bn-template-engine/{p-1164c0b0.entry.js → p-96006b06.entry.js} +1 -1
  7. package/dist/bn-template-engine/p-B4JfKvVT.js +1 -0
  8. package/dist/bn-template-engine/{p-JNHhIe7t.js → p-B_d-jp99.js} +1 -1
  9. package/dist/bn-template-engine/p-Ck-NYtot.js +1 -0
  10. package/dist/bn-template-engine/p-CnDq0oVa.js +1 -0
  11. package/dist/bn-template-engine/p-DSXNgKLa.js +1 -0
  12. package/dist/bn-template-engine/p-bc711fb0.entry.js +1 -0
  13. package/dist/bn-template-engine/p-e6f646b1.entry.js +1 -0
  14. package/dist/bn-template-engine/p-f41d9242.entry.js +1 -0
  15. package/dist/bn-template-engine/{p-B0lsgVuN.js → p-gFbbuhtl.js} +1 -1
  16. package/dist/cjs/{SVGVariancesStyleGroup-BqAdPYtL.js → bn-asset_20.cjs.entry.js} +21948 -6938
  17. package/dist/cjs/bn-grid.cjs.entry.js +6 -9
  18. package/dist/cjs/bn-image.cjs.entry.js +6 -9
  19. package/dist/cjs/bn-internationalization.cjs.entry.js +5 -6
  20. package/dist/cjs/bn-template-engine.cjs.js +2 -2
  21. package/dist/cjs/bn-template.cjs.entry.js +3 -4
  22. package/dist/cjs/bn-text.cjs.entry.js +7 -10
  23. package/dist/cjs/bn-tree.cjs.entry.js +6 -9
  24. package/dist/cjs/{context-protocol-DRQWrwsA.js → context-protocol-ohYzcb5F.js} +1 -1
  25. package/dist/cjs/editor-companion.cjs.entry.js +2 -2
  26. package/dist/cjs/{index-Cjw0q6gP.js → index-CDKG4xmO.js} +1 -0
  27. package/dist/cjs/loader.cjs.js +2 -2
  28. package/dist/cjs/{scaling-BidPsO53.js → scaling-CIAClQR5.js} +3 -3
  29. package/dist/cjs/{withBodyObserver-C6gLgq_e.js → withBodyObserver-D7BKWN2N.js} +2 -2
  30. package/dist/cjs/{withHasError-B8gHkfV2.js → withHasError-Cl2gTQzA.js} +106 -2
  31. package/dist/cjs/{Order-BGx39pS5.js → withStyled-qd94SSb4.js} +648 -6
  32. package/dist/collection/components/bn-chart-structure/bn-chart-structure.js +20 -4
  33. package/dist/collection/components/bn-chart-time/bn-chart-time.js +20 -4
  34. package/dist/collection/components/bn-layout-card/bn-layout-card.js +12 -6
  35. package/dist/collection/components/bn-layout-page/bn-layout-page.js +12 -7
  36. package/dist/collection/components/bn-table/bn-table.js +25 -7
  37. package/dist/collection/components/bn-table/ibcs-table.js +68 -3
  38. package/dist/components/bn-chart-structure.js +1 -1
  39. package/dist/components/bn-chart-time.js +1 -1
  40. package/dist/components/bn-layout-card.js +1 -1
  41. package/dist/components/bn-layout-page.js +1 -1
  42. package/dist/components/bn-table.js +1 -1
  43. package/dist/components/ibcs-table2.js +1 -1
  44. package/dist/esm/{SVGVariancesStyleGroup-DOIT-zvI.js → bn-asset_20.entry.js} +22048 -7042
  45. package/dist/esm/bn-grid.entry.js +4 -7
  46. package/dist/esm/bn-image.entry.js +4 -7
  47. package/dist/esm/bn-internationalization.entry.js +4 -5
  48. package/dist/esm/bn-template-engine.js +3 -3
  49. package/dist/esm/bn-template.entry.js +2 -3
  50. package/dist/esm/bn-text.entry.js +5 -8
  51. package/dist/esm/bn-tree.entry.js +4 -7
  52. package/dist/esm/{context-protocol-2peaD4y8.js → context-protocol-DdbSplvE.js} +2 -2
  53. package/dist/esm/editor-companion.entry.js +2 -2
  54. package/dist/esm/{index-JNHhIe7t.js → index-B_d-jp99.js} +1 -1
  55. package/dist/esm/loader.js +3 -3
  56. package/dist/esm/{scaling-BOcjT8M0.js → scaling-DGKKkuL9.js} +4 -4
  57. package/dist/esm/{withBodyObserver-DczL5ia8.js → withBodyObserver-AFk2wwHT.js} +2 -2
  58. package/dist/esm/{withHasError-B3QX2emi.js → withHasError-DW_vMDUp.js} +106 -2
  59. package/dist/esm/{Order-sRO-lj7X.js → withStyled-BIkqU2w4.js} +616 -1
  60. package/dist/types/components/bn-chart-structure/bn-chart-structure.d.ts +1 -0
  61. package/dist/types/components/bn-chart-time/bn-chart-time.d.ts +1 -0
  62. package/dist/types/components/bn-layout-card/bn-layout-card.d.ts +8 -2
  63. package/dist/types/components/bn-layout-page/bn-layout-page.d.ts +8 -3
  64. package/dist/types/components/bn-table/ibcs-table.d.ts +19 -0
  65. package/dist/types/components.d.ts +8 -8
  66. package/package.json +1 -1
  67. package/dist/bn-template-engine/p-0fabe296.entry.js +0 -1
  68. package/dist/bn-template-engine/p-355abdf0.entry.js +0 -1
  69. package/dist/bn-template-engine/p-79KuA4Ox.js +0 -1
  70. package/dist/bn-template-engine/p-859cc06d.entry.js +0 -1
  71. package/dist/bn-template-engine/p-8acec99e.entry.js +0 -1
  72. package/dist/bn-template-engine/p-8f490c45.entry.js +0 -1
  73. package/dist/bn-template-engine/p-9721a5bb.entry.js +0 -1
  74. package/dist/bn-template-engine/p-9a564f8f.entry.js +0 -1
  75. package/dist/bn-template-engine/p-9cee22fa.entry.js +0 -1
  76. package/dist/bn-template-engine/p-B7p8beYH.js +0 -1
  77. package/dist/bn-template-engine/p-BDh7GfC5.js +0 -1
  78. package/dist/bn-template-engine/p-BoMtoHJB.js +0 -1
  79. package/dist/bn-template-engine/p-Bs8BqBsb.js +0 -1
  80. package/dist/bn-template-engine/p-CYjZRKdI.js +0 -1
  81. package/dist/bn-template-engine/p-DG-1MR_T.js +0 -1
  82. package/dist/bn-template-engine/p-Dnkv5rt8.js +0 -1
  83. package/dist/bn-template-engine/p-bdd2b243.entry.js +0 -1
  84. package/dist/bn-template-engine/p-f27995c9.entry.js +0 -1
  85. package/dist/bn-template-engine/p-f6ecb265.entry.js +0 -1
  86. package/dist/bn-template-engine/p-sRO-lj7X.js +0 -1
  87. package/dist/bn-template-engine/p-tzFCK9qn.js +0 -1
  88. package/dist/cjs/bn-asset_16.cjs.entry.js +0 -9099
  89. package/dist/cjs/bn-card.cjs.entry.js +0 -36
  90. package/dist/cjs/bn-chart-time.cjs.entry.js +0 -1031
  91. package/dist/cjs/bn-layout-card.cjs.entry.js +0 -279
  92. package/dist/cjs/formatter-4XCS0d2B.js +0 -221
  93. package/dist/cjs/ibcs-chart-time.cjs.entry.js +0 -4137
  94. package/dist/cjs/withComponentStatus-_x4LQZ0N.js +0 -109
  95. package/dist/cjs/withComponentStyle-ClSJfCku.js +0 -128
  96. package/dist/cjs/withInheritedProps-BH2KNER3.js +0 -157
  97. package/dist/cjs/withStyled-9tG024gQ.js +0 -522
  98. package/dist/esm/bn-asset_16.entry.js +0 -9082
  99. package/dist/esm/bn-card.entry.js +0 -34
  100. package/dist/esm/bn-chart-time.entry.js +0 -1029
  101. package/dist/esm/bn-layout-card.entry.js +0 -277
  102. package/dist/esm/formatter-BDh7GfC5.js +0 -215
  103. package/dist/esm/ibcs-chart-time.entry.js +0 -4135
  104. package/dist/esm/withComponentStatus-DodoSXe-.js +0 -107
  105. package/dist/esm/withComponentStyle-D3VWOsto.js +0 -126
  106. package/dist/esm/withInheritedProps-BlXDxhHK.js +0 -154
  107. package/dist/esm/withStyled-CE3_3taP.js +0 -495
@@ -1,5 +1,130 @@
1
1
  'use strict';
2
2
 
3
+ var index = require('./index-CDKG4xmO.js');
4
+ var contextProtocol = require('./context-protocol-ohYzcb5F.js');
5
+ var withHasError = require('./withHasError-Cl2gTQzA.js');
6
+
7
+ const isObject = (obj) => {
8
+ if (typeof obj === 'object' && obj !== null) {
9
+ if (typeof Object.getPrototypeOf === 'function') {
10
+ const prototype = Object.getPrototypeOf(obj);
11
+ return prototype === Object.prototype || prototype === null;
12
+ }
13
+ return Object.prototype.toString.call(obj) === '[object Object]';
14
+ }
15
+ return false;
16
+ };
17
+ const overwriteMerge = (_, currArr) => currArr;
18
+ const combineMerge = (prevArr, currArr) => {
19
+ return [...new Set([...prevArr, ...currArr])];
20
+ };
21
+ const getMergeFn = (type) => {
22
+ switch (type) {
23
+ case 'overwrite':
24
+ return overwriteMerge;
25
+ case 'combine':
26
+ default:
27
+ return combineMerge;
28
+ }
29
+ };
30
+
31
+ const withDefaultOptions = (options) => {
32
+ return {
33
+ arrayMergeType: 'combine',
34
+ arrayMerge: getMergeFn(options ? options.arrayMergeType : 'combine'),
35
+ ...options,
36
+ };
37
+ };
38
+ const merge = (objects, options) => {
39
+ const opts = withDefaultOptions(options);
40
+ return objects.reduce((prev, curr) => {
41
+ Object.keys(curr).forEach((key) => {
42
+ if (Array.isArray(prev[key]) && Array.isArray(curr[key])) {
43
+ if (opts && opts.arrayMerge) {
44
+ prev[key] = opts.arrayMerge(prev[key], curr[key]);
45
+ }
46
+ }
47
+ else if (isObject(prev[key]) && isObject(curr[key])) {
48
+ prev[key] = merge([prev[key], curr[key]], opts);
49
+ }
50
+ else {
51
+ prev[key] = curr[key];
52
+ }
53
+ });
54
+ return prev;
55
+ }, {});
56
+ };
57
+
58
+ /**
59
+ * Mixin that provides themed styling to a Stencil component using a
60
+ * three-layer merge strategy.
61
+ *
62
+ * The effective style is computed by deep-merging three layers in order:
63
+ * 1. `_system` -- built-in defaults (lowest priority)
64
+ * 2. `_default` -- user-defined global overrides
65
+ * 3. The value of the host element's `selected-style` attribute (highest priority)
66
+ *
67
+ * A MutationObserver watches `selected-style` and the store subscription
68
+ * reacts to updates in the componentStyles store, triggering a re-merge
69
+ * and forced re-render on changes.
70
+ *
71
+ * @param component - The Stencil component instance
72
+ * @returns A query function `componentStyle(<selector>)` that provides type-safe
73
+ * access to the merged style object, e.g. `componentStyle(s => s.table.headerBg)`
74
+ */
75
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
76
+ const withComponentStyle = (component) => {
77
+ let subscription;
78
+ let stores;
79
+ let selectedStyle;
80
+ let style;
81
+ const updateStyle = () => {
82
+ const state = stores.componentStyles.state;
83
+ style = merge([
84
+ state["_system"] || {},
85
+ state["_default"] || {},
86
+ state[selectedStyle] || {},
87
+ ]);
88
+ };
89
+ const observer = new MutationObserver((mutations) => {
90
+ mutations.forEach((mutation) => {
91
+ if (mutation.attributeName === "selected-style") {
92
+ selectedStyle = index.getElement(component).getAttribute("selected-style");
93
+ updateStyle();
94
+ index.forceUpdate(component);
95
+ }
96
+ });
97
+ });
98
+ const connectedCallback = component["connectedCallback"];
99
+ component["connectedCallback"] = () => {
100
+ const element = index.getElement(component);
101
+ stores = contextProtocol.getStores(element);
102
+ style = stores.componentStyles.state["_system"];
103
+ observer.observe(element, { attributes: true, attributeFilter: ["selected-style"] });
104
+ selectedStyle = index.getElement(component).getAttribute("selected-style");
105
+ updateStyle();
106
+ subscription = stores.componentStyles.on("set", (key) => {
107
+ if (key === selectedStyle) {
108
+ selectedStyle = index.getElement(component).getAttribute("selected-style");
109
+ updateStyle();
110
+ index.forceUpdate(index.getElement(component));
111
+ }
112
+ });
113
+ withHasError.runIfExisits(connectedCallback, component);
114
+ };
115
+ const disconnectedCallback = component["disconnectedCallback"];
116
+ component["disconnectedCallback"] = () => {
117
+ observer.disconnect();
118
+ withHasError.runIfExisits(subscription);
119
+ contextProtocol.clearStoresCache(index.getElement(component));
120
+ withHasError.runIfExisits(disconnectedCallback, component);
121
+ };
122
+ const componentStyle = (q) => {
123
+ return q(style);
124
+ };
125
+ return componentStyle;
126
+ };
127
+
3
128
  /** Controls which parts of a component are translated: ALL=labels+data, META=labels only. */
4
129
  exports.I18nMode = void 0;
5
130
  (function (I18nMode) {
@@ -19,7 +144,7 @@ exports.MeasureType = void 0;
19
144
  * - FC (forecast): projected future values
20
145
  * - PL (plan): budgeted/target values
21
146
  */
22
- exports.Scenarios = void 0;
147
+ var Scenarios;
23
148
  (function (Scenarios) {
24
149
  Scenarios["AC1"] = "ac1";
25
150
  Scenarios["AC2"] = "ac2";
@@ -37,19 +162,19 @@ exports.Scenarios = void 0;
37
162
  Scenarios["PL2"] = "pl2";
38
163
  Scenarios["PL3"] = "pl3";
39
164
  Scenarios["PL4"] = "pl4";
40
- })(exports.Scenarios || (exports.Scenarios = {}));
165
+ })(Scenarios || (Scenarios = {}));
41
166
  /**
42
167
  * Variance direction for IBCS traffic-light coloring.
43
168
  * - POS: favorable variance (green in IBCS)
44
169
  * - NEG: unfavorable variance (red in IBCS)
45
170
  * - NEU: neutral / no directional meaning
46
171
  */
47
- exports.Sentiments = void 0;
172
+ var Sentiments;
48
173
  (function (Sentiments) {
49
174
  Sentiments["POS"] = "pos";
50
175
  Sentiments["NEG"] = "neg";
51
176
  Sentiments["NEU"] = "neu";
52
- })(exports.Sentiments || (exports.Sentiments = {}));
177
+ })(Sentiments || (Sentiments = {}));
53
178
  /** Number display format: DECIMAL for absolute values, PERCENT for ratio columns. */
54
179
  exports.DataFormat = void 0;
55
180
  (function (DataFormat) {
@@ -64,14 +189,14 @@ exports.DataFormat = void 0;
64
189
  * - OPT: operation-aware aggregation — rows with operation="-" subtract from the group sum
65
190
  * - OPTNOTOTAL: operation-aware aggregation without a grand total
66
191
  */
67
- exports.TableType = void 0;
192
+ var TableType;
68
193
  (function (TableType) {
69
194
  TableType["LIST"] = "list";
70
195
  TableType["SUM"] = "sum";
71
196
  TableType["SUMNOTOTAL"] = "sumnototal";
72
197
  TableType["OPT"] = "opt";
73
198
  TableType["OPTNOTOTAL"] = "optnototal";
74
- })(exports.TableType || (exports.TableType = {}));
199
+ })(TableType || (TableType = {}));
75
200
  /** Width of the category label column as a percentage of the table width. INF = auto/infinite. */
76
201
  exports.TableCategoryWidth = void 0;
77
202
  (function (TableCategoryWidth) {
@@ -8885,9 +9010,526 @@ class OrderAdapter {
8885
9010
  }
8886
9011
  }
8887
9012
 
9013
+ /**
9014
+ * Prop validators for Stencil @Watch handlers.
9015
+ *
9016
+ * Each validator returns an array of invalid items; an empty array means the input is valid.
9017
+ * These are used in component @Watch methods to warn about malformed attribute values
9018
+ * without crashing the component.
9019
+ */
9020
+ /**
9021
+ * Checks whether a value is blank, null, undefined, or the string `"null"`.
9022
+ * The string `"null"` check handles serialized null values from HTML attributes,
9023
+ * which arrive as the literal string "null" rather than a JS null.
9024
+ */
9025
+ function isBlankInput(value) {
9026
+ return value === null || value === undefined || value === "" || value === "null";
9027
+ }
9028
+ /**
9029
+ * Validates a comma-separated list of scenario identifiers.
9030
+ * The special value `"auto"` is always valid. Base scenarios are validated against
9031
+ * the Scenarios enum; remaining invalid entries are passed to `validateVariancesList`
9032
+ * for variance format checking (e.g. `d_ac1_pl1_pos`).
9033
+ */
9034
+ function validateScenarioList(value) {
9035
+ if (isBlankInput(value)) {
9036
+ return [];
9037
+ }
9038
+ if (value.trim().toLowerCase() === "auto") {
9039
+ return [];
9040
+ }
9041
+ const invalidScenarios = value === null || value === void 0 ? void 0 : value.split(",").filter((element) => !(element.toUpperCase().trim() in Scenarios));
9042
+ return validateVariancesList(invalidScenarios.toString());
9043
+ }
9044
+ /**
9045
+ * Validates variance identifiers in the format `d_<base>_<delta>_<sentiment>` or
9046
+ * `dr_<base>_<delta>_<sentiment>`. Each component is checked against the Scenarios
9047
+ * and Sentiments enums. Returns items that fail validation.
9048
+ */
9049
+ function validateVariancesList(value) {
9050
+ if (isBlankInput(value)) {
9051
+ return [];
9052
+ }
9053
+ const invalidScenarios = value
9054
+ .replace(";", ",")
9055
+ .split(",")
9056
+ .filter((element) => {
9057
+ var _a, _b, _c;
9058
+ const splittedElement = element.split("_");
9059
+ const scenarioSubtrahend = (_a = splittedElement[0]) === null || _a === void 0 ? void 0 : _a.replace(/^dr|^d/, "").toUpperCase().trim();
9060
+ const scenarioMinuend = (_b = splittedElement[1]) === null || _b === void 0 ? void 0 : _b.toUpperCase().trim();
9061
+ const scenarioSentiment = (_c = splittedElement[2]) === null || _c === void 0 ? void 0 : _c.toUpperCase().trim();
9062
+ return (splittedElement.length !== 3 ||
9063
+ !(scenarioSubtrahend in Scenarios) ||
9064
+ !(scenarioMinuend in Scenarios) ||
9065
+ !(scenarioSentiment in Sentiments));
9066
+ });
9067
+ return invalidScenarios;
9068
+ }
9069
+ function validateOrderList(value) {
9070
+ if (isBlankInput(value)) {
9071
+ return [];
9072
+ }
9073
+ if (value.trim().toLowerCase() === "auto") {
9074
+ return [];
9075
+ }
9076
+ const invalidScenarios = value.split(",").filter((element) => !(element.toUpperCase() in exports.OrderColumn));
9077
+ return validateVariancesList(invalidScenarios.toString());
9078
+ }
9079
+ function isValidInteger(value) {
9080
+ if (isBlankInput(value)) {
9081
+ return false;
9082
+ }
9083
+ return Number.isInteger(Number(value));
9084
+ }
9085
+ function isValidNumber(value) {
9086
+ if (isBlankInput(value)) {
9087
+ return false;
9088
+ }
9089
+ return !Number.isNaN(Number(value));
9090
+ }
9091
+ function isValidDirection(value) {
9092
+ if (isBlankInput(value)) {
9093
+ return false;
9094
+ }
9095
+ return (value === null || value === void 0 ? void 0 : value.toUpperCase()) in exports.OrderDirection;
9096
+ }
9097
+ function isValidLevel(value) {
9098
+ if ((value === null || value === void 0 ? void 0 : value.toLowerCase()) === "auto") {
9099
+ return true;
9100
+ }
9101
+ return (value === null || value === void 0 ? void 0 : value.toUpperCase()) in exports.AggregationLevel;
9102
+ }
9103
+ function validateMeasureList(value) {
9104
+ if (isBlankInput(value)) {
9105
+ return [];
9106
+ }
9107
+ try {
9108
+ const newObj = JSON.parse(value);
9109
+ if (newObj instanceof Array) {
9110
+ return newObj.filter((elem) => !(elem.hasOwnProperty("name") && elem.hasOwnProperty("unit")));
9111
+ }
9112
+ }
9113
+ catch (e) {
9114
+ console.error("validateMeasureList: failed to parse JSON", e);
9115
+ }
9116
+ return ["Invalid JSON structure"];
9117
+ }
9118
+ function isValidDate(value) {
9119
+ const newDate = Date.parse(value);
9120
+ return Number.isInteger(newDate);
9121
+ }
9122
+ function isValidDateLink(value) {
9123
+ return (value === null || value === void 0 ? void 0 : value.toUpperCase()) in exports.DateLink;
9124
+ }
9125
+ function isValidDateFormat(value) {
9126
+ return (value === null || value === void 0 ? void 0 : value.toUpperCase()) in exports.DateDistance;
9127
+ }
9128
+ function isValidAxisLabelsMode(value) {
9129
+ return (value === null || value === void 0 ? void 0 : value.toUpperCase()) in exports.AxisLabelsMode;
9130
+ }
9131
+ function isValidDataFormat(value) {
9132
+ if (isBlankInput(value)) {
9133
+ return false;
9134
+ }
9135
+ return (value === null || value === void 0 ? void 0 : value.toUpperCase()) in exports.DataFormat;
9136
+ }
9137
+ function isValidBoolean(value) {
9138
+ if (isBlankInput(value)) {
9139
+ return false;
9140
+ }
9141
+ const validValues = ["true", "false", true, false];
9142
+ return validValues.some((elem) => elem === value);
9143
+ }
9144
+ function isValidTableType(value) {
9145
+ if (isBlankInput(value)) {
9146
+ return false;
9147
+ }
9148
+ return (value === null || value === void 0 ? void 0 : value.toUpperCase()) in TableType;
9149
+ }
9150
+ function validateThereOfJsonStr(value) {
9151
+ if (isBlankInput(value)) {
9152
+ return [];
9153
+ }
9154
+ try {
9155
+ const jsonObject = JSON.parse(value);
9156
+ if (jsonObject instanceof Array) {
9157
+ // return newObj.filter(elem => elem.hasOwnProperty('rowgroup') && elem.hasOwnProperty('category') && elem.hasOwnProperty('subcategory'))
9158
+ return jsonObject.filter((elem) => !(elem.hasOwnProperty("rowGroup") && elem.hasOwnProperty("category") && elem.hasOwnProperty("subCategory")));
9159
+ }
9160
+ }
9161
+ catch (err) {
9162
+ console.error("validateThereOfJsonStr: failed to parse JSON", err);
9163
+ }
9164
+ return ["Invalid JSON structure"];
9165
+ }
9166
+ function validatePartOfJsonStr(value) {
9167
+ if (isBlankInput(value)) {
9168
+ return [];
9169
+ }
9170
+ try {
9171
+ const jsonObject = JSON.parse(value);
9172
+ if (jsonObject instanceof Array) {
9173
+ // return newObj.filter(elem => elem.hasOwnProperty('rowgroup') && elem.hasOwnProperty('category') && elem.hasOwnProperty('subcategory'))
9174
+ return jsonObject.filter((elem) => !(elem.hasOwnProperty("rowGroup") && elem.hasOwnProperty("category")));
9175
+ }
9176
+ }
9177
+ catch (e) {
9178
+ console.error("validatePartOfJsonStr: failed to parse JSON", e);
9179
+ }
9180
+ return ["Invalid JSON structure"];
9181
+ }
9182
+ function isValidMeasureType(value) {
9183
+ return (value === null || value === void 0 ? void 0 : value.trim().toUpperCase()) in exports.MeasureType;
9184
+ }
9185
+ /**
9186
+ * Validates a measure-scale attribute value.
9187
+ * Accepted values: `"_"` (no scaling), SI prefix letters (k, M, G, T, P, E, Z, Y, m, etc.),
9188
+ * or auto-detection modes `"GREATEST"` / `"LEAST"`.
9189
+ */
9190
+ function isValidMeasureScale(value) {
9191
+ return (["_", "k", "M", "G", "T", "P", "E", "Z", "Y", "m", "μ", "n", "p", "P", "f", "a", "z", "y"].includes(value === null || value === void 0 ? void 0 : value.trim()) || ["GREATEST", "LEAST"].includes(value === null || value === void 0 ? void 0 : value.trim().toUpperCase()));
9192
+ }
9193
+ function isTableCategoryWidth(value) {
9194
+ return (value === null || value === void 0 ? void 0 : value.toUpperCase().trim()) in exports.TableCategoryWidth;
9195
+ }
9196
+ function isTableBarColumnWidth(value) {
9197
+ return (value === null || value === void 0 ? void 0 : value.toUpperCase().trim()) in exports.TableBarColumnWidth;
9198
+ }
9199
+ function validateColumnThereOfJsonStr(value) {
9200
+ if (isBlankInput(value)) {
9201
+ return [];
9202
+ }
9203
+ try {
9204
+ const jsonObject = JSON.parse(value);
9205
+ return jsonObject.filter((elem) => !(elem.hasOwnProperty("scenario") && elem.hasOwnProperty("name") && elem.hasOwnProperty("subGroups")));
9206
+ }
9207
+ catch (e) {
9208
+ console.error("validateColumnThereOfJsonStr: failed to parse JSON", e);
9209
+ }
9210
+ return ["Invalid JSON structure"];
9211
+ }
9212
+ function validateStackConfig(value) {
9213
+ if (isBlankInput(value)) {
9214
+ return [];
9215
+ }
9216
+ try {
9217
+ const config = JSON.parse(value);
9218
+ if (typeof config !== "object" || config === null || Array.isArray(config)) {
9219
+ return ["stack: must be a JSON object"];
9220
+ }
9221
+ const errors = [];
9222
+ if (!config.hasOwnProperty("by")) {
9223
+ errors.push("stack: 'by' is required");
9224
+ }
9225
+ else {
9226
+ const validBy = ["scenarios", "dimensions"];
9227
+ if (!validBy.includes(config.by)) {
9228
+ errors.push(`stack: 'by' must be one of: ${validBy.join(", ")}`);
9229
+ }
9230
+ }
9231
+ if (config.hasOwnProperty("mode")) {
9232
+ const validModes = ["absolute", "relative", "absolute-relative"];
9233
+ if (!validModes.includes(config.mode)) {
9234
+ errors.push(`stack: 'mode' must be one of: ${validModes.join(", ")}`);
9235
+ }
9236
+ }
9237
+ if (config.hasOwnProperty("order")) {
9238
+ const validOrders = ["asc", "desc", "dataset"];
9239
+ if (!validOrders.includes(config.order)) {
9240
+ errors.push(`stack: 'order' must be one of: ${validOrders.join(", ")}`);
9241
+ }
9242
+ }
9243
+ return errors;
9244
+ }
9245
+ catch (_e) {
9246
+ return ["stack: invalid JSON"];
9247
+ }
9248
+ }
9249
+
9250
+ class StyleSheet {
9251
+ constructor() {
9252
+ this.cache = new Map();
9253
+ this.tag = StyleSheet.makeStyleTag();
9254
+ }
9255
+ static makeStyleTag() {
9256
+ const tag = document.createElement("style");
9257
+ tag.type = "text/css";
9258
+ tag.setAttribute("data-bn-computed-style", "");
9259
+ tag.append(document.createTextNode(""));
9260
+ (document.head || document.querySelector("head")).append(tag);
9261
+ return tag;
9262
+ }
9263
+ apply(data) {
9264
+ data.forEach((value) => this.cache.set(value.className, value.style));
9265
+ this.tag.innerHTML = Array.from(this.cache.values())
9266
+ .map((value) => value)
9267
+ .join("\n");
9268
+ }
9269
+ }
9270
+ const styleSheet = new StyleSheet();
9271
+
9272
+ /* eslint-disable */
9273
+ // Inspired by https://github.com/garycourt/murmurhash-js
9274
+ // Ported from https://github.com/aappleby/smhasher/blob/61a0530f28277f2e850bfc39600ce61d02b518de/src/MurmurHash2.cpp#L37-L86
9275
+ function murmur2(str) {
9276
+ // 'm' and 'r' are mixing constants generated offline.
9277
+ // They're not really 'magic', they just happen to work well.
9278
+ // const m = 0x5bd1e995;
9279
+ // const r = 24;
9280
+ // Initialize the hash
9281
+ var h = 0; // Mix 4 bytes at a time into the hash
9282
+
9283
+ var k,
9284
+ i = 0,
9285
+ len = str.length;
9286
+
9287
+ for (; len >= 4; ++i, len -= 4) {
9288
+ k = str.charCodeAt(i) & 0xff | (str.charCodeAt(++i) & 0xff) << 8 | (str.charCodeAt(++i) & 0xff) << 16 | (str.charCodeAt(++i) & 0xff) << 24;
9289
+ k =
9290
+ /* Math.imul(k, m): */
9291
+ (k & 0xffff) * 0x5bd1e995 + ((k >>> 16) * 0xe995 << 16);
9292
+ k ^=
9293
+ /* k >>> r: */
9294
+ k >>> 24;
9295
+ h =
9296
+ /* Math.imul(k, m): */
9297
+ (k & 0xffff) * 0x5bd1e995 + ((k >>> 16) * 0xe995 << 16) ^
9298
+ /* Math.imul(h, m): */
9299
+ (h & 0xffff) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16);
9300
+ } // Handle the last few bytes of the input array
9301
+
9302
+
9303
+ switch (len) {
9304
+ case 3:
9305
+ h ^= (str.charCodeAt(i + 2) & 0xff) << 16;
9306
+
9307
+ case 2:
9308
+ h ^= (str.charCodeAt(i + 1) & 0xff) << 8;
9309
+
9310
+ case 1:
9311
+ h ^= str.charCodeAt(i) & 0xff;
9312
+ h =
9313
+ /* Math.imul(h, m): */
9314
+ (h & 0xffff) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16);
9315
+ } // Do a few final mixes of the hash to ensure the last few
9316
+ // bytes are well-incorporated.
9317
+
9318
+
9319
+ h ^= h >>> 13;
9320
+ h =
9321
+ /* Math.imul(h, m): */
9322
+ (h & 0xffff) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16);
9323
+ return ((h ^ h >>> 15) >>> 0).toString(36);
9324
+ }
9325
+
9326
+ const transofrmToUnitString = (value) => {
9327
+ if (isValidNumber(value)) {
9328
+ return `${value}px`;
9329
+ }
9330
+ else {
9331
+ return value;
9332
+ }
9333
+ };
9334
+ const width = {
9335
+ className: "w",
9336
+ cssName: "width",
9337
+ attrName: "width",
9338
+ transform: transofrmToUnitString,
9339
+ };
9340
+ const height = {
9341
+ className: "h",
9342
+ cssName: "height",
9343
+ attrName: "height",
9344
+ transform: transofrmToUnitString,
9345
+ };
9346
+ const position = {
9347
+ className: "pst",
9348
+ cssName: "position",
9349
+ attrName: "position",
9350
+ };
9351
+ const top = {
9352
+ className: "top",
9353
+ cssName: "top",
9354
+ attrName: "top",
9355
+ transform: transofrmToUnitString,
9356
+ };
9357
+ const right = {
9358
+ className: "rgt",
9359
+ cssName: "right",
9360
+ attrName: "right",
9361
+ transform: transofrmToUnitString,
9362
+ };
9363
+ const bottom = {
9364
+ className: "btm",
9365
+ cssName: "bottom",
9366
+ attrName: "bottom",
9367
+ transform: transofrmToUnitString,
9368
+ };
9369
+ const left = {
9370
+ className: "lft",
9371
+ cssName: "left",
9372
+ attrName: "left",
9373
+ transform: transofrmToUnitString,
9374
+ };
9375
+ const fontSize = {
9376
+ className: "fts",
9377
+ cssName: "font-size",
9378
+ attrName: "font-size",
9379
+ transform: transofrmToUnitString,
9380
+ };
9381
+ const gridColumn = {
9382
+ className: "gdc",
9383
+ cssName: "grid-column",
9384
+ attrName: "grid-column",
9385
+ };
9386
+ const gridRow = {
9387
+ className: "gdr",
9388
+ cssName: "grid-row",
9389
+ attrName: "grid-row",
9390
+ };
9391
+ const attributes = {
9392
+ width: width,
9393
+ height: height,
9394
+ position: position,
9395
+ top: top,
9396
+ right: right,
9397
+ bottom: bottom,
9398
+ left: left,
9399
+ "font-size": fontSize,
9400
+ "grid-column": gridColumn,
9401
+ "grid-row": gridRow,
9402
+ };
9403
+ const attributesNames = Object.keys(attributes);
9404
+ function getClassName(attr, value) {
9405
+ const valueKey = murmur2(value);
9406
+ return `bn-c-${attr.className}_${valueKey}`;
9407
+ }
9408
+ function getStyle(attr, className, value) {
9409
+ return `.${className} {${attr.cssName}: ${value};}`;
9410
+ }
9411
+ function getCSS(attr, value) {
9412
+ const className = getClassName(attr, value);
9413
+ const style = getStyle(attr, className, value);
9414
+ return { className, style };
9415
+ }
9416
+ const apply = (el) => {
9417
+ const map = new Map();
9418
+ //map.set("position", getCSS(attributes["position"], "absolute"))
9419
+ attributesNames.forEach((name) => {
9420
+ const value = el.getAttribute(name);
9421
+ if (value) {
9422
+ if (["top", "left", "right", "bottom"].includes(name)) {
9423
+ map.set("position", getCSS(attributes["position"], "absolute"));
9424
+ }
9425
+ const transform = attributes[name].transform ||
9426
+ function (v) {
9427
+ return v;
9428
+ };
9429
+ map.set(name, getCSS(attributes[name], transform(value)));
9430
+ }
9431
+ });
9432
+ return map;
9433
+ };
9434
+
9435
+ /**
9436
+ * Shared MutationObserver that watches for style-attribute changes on all
9437
+ * subscribed elements. When a monitored attribute changes, it re-applies the
9438
+ * Styletron CSS-in-JS stylesheet and updates the element's className,
9439
+ * preserving any non-`bn-c-` classes.
9440
+ */
9441
+ const observer = new MutationObserver((mutations) => {
9442
+ for (const mutation of mutations) {
9443
+ const el = mutation.target;
9444
+ const map = apply(el);
9445
+ styleSheet.apply(map);
9446
+ const classes = Array.from(map.values()).map((value) => value.className);
9447
+ el.className = el.className
9448
+ .split(" ")
9449
+ .filter((value) => !value.startsWith("bn-c-"))
9450
+ .concat(...classes)
9451
+ .join(" ");
9452
+ index.forceUpdate(el);
9453
+ }
9454
+ });
9455
+ /**
9456
+ * Registers an element with the Styletron observer: applies the initial
9457
+ * stylesheet, assigns generated `bn-c-*` class names, and begins watching
9458
+ * for attribute mutations that affect styling.
9459
+ */
9460
+ const subscribe = (el) => {
9461
+ const map = apply(el);
9462
+ styleSheet.apply(map);
9463
+ const classes = Array.from(map.values()).map((value) => value.className);
9464
+ el.className = el.className
9465
+ .split(" ")
9466
+ .filter((value) => !value.startsWith("bn-c-"))
9467
+ .concat(...classes)
9468
+ .join(" ");
9469
+ observer.observe(el, { attributes: true, attributeFilter: attributesNames, childList: false, subtree: false });
9470
+ };
9471
+ /**
9472
+ * Mixin that integrates Styletron CSS-in-JS styling into a Stencil component.
9473
+ *
9474
+ * On `connectedCallback`, it subscribes the host element to a shared
9475
+ * MutationObserver that watches for style-related attribute changes. When
9476
+ * attributes change, the Styletron stylesheet is re-applied and the element's
9477
+ * class list is updated with generated `bn-c-*` class names, followed by a
9478
+ * forced re-render.
9479
+ *
9480
+ * @param component - The Stencil component instance
9481
+ */
9482
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
9483
+ const withStyled = (component) => {
9484
+ const cstrConnectedCallback = component["connectedCallback"];
9485
+ const cstrDisconnectedCallback = component["disconnectedCallback"];
9486
+ component["connectedCallback"] = () => {
9487
+ const elm = index.getElement(component);
9488
+ if (elm) {
9489
+ subscribe(elm);
9490
+ }
9491
+ else {
9492
+ throw new Error(`Can't find element field in component ${undefined}`);
9493
+ }
9494
+ withHasError.runIfExisits(cstrConnectedCallback, component);
9495
+ };
9496
+ component["disconnectedCallback"] = () => {
9497
+ // MutationObserver has no per-element unobserve — the shared observer
9498
+ // automatically stops firing for elements removed from the DOM.
9499
+ withHasError.runIfExisits(cstrDisconnectedCallback, component);
9500
+ };
9501
+ };
9502
+
8888
9503
  exports.AdapterUtils = AdapterUtils;
8889
9504
  exports.BAR_COLUMN_WIDTH_EM = BAR_COLUMN_WIDTH_EM;
8890
9505
  exports.CompareUtil = CompareUtil;
8891
9506
  exports.DateStringFactory = DateStringFactory;
8892
9507
  exports.DateTime = DateTime;
8893
9508
  exports.OrderAdapter = OrderAdapter;
9509
+ exports.isBlankInput = isBlankInput;
9510
+ exports.isTableBarColumnWidth = isTableBarColumnWidth;
9511
+ exports.isTableCategoryWidth = isTableCategoryWidth;
9512
+ exports.isValidAxisLabelsMode = isValidAxisLabelsMode;
9513
+ exports.isValidBoolean = isValidBoolean;
9514
+ exports.isValidDataFormat = isValidDataFormat;
9515
+ exports.isValidDate = isValidDate;
9516
+ exports.isValidDateFormat = isValidDateFormat;
9517
+ exports.isValidDateLink = isValidDateLink;
9518
+ exports.isValidDirection = isValidDirection;
9519
+ exports.isValidInteger = isValidInteger;
9520
+ exports.isValidLevel = isValidLevel;
9521
+ exports.isValidMeasureScale = isValidMeasureScale;
9522
+ exports.isValidMeasureType = isValidMeasureType;
9523
+ exports.isValidNumber = isValidNumber;
9524
+ exports.isValidTableType = isValidTableType;
9525
+ exports.murmur2 = murmur2;
9526
+ exports.validateColumnThereOfJsonStr = validateColumnThereOfJsonStr;
9527
+ exports.validateMeasureList = validateMeasureList;
9528
+ exports.validateOrderList = validateOrderList;
9529
+ exports.validatePartOfJsonStr = validatePartOfJsonStr;
9530
+ exports.validateScenarioList = validateScenarioList;
9531
+ exports.validateStackConfig = validateStackConfig;
9532
+ exports.validateThereOfJsonStr = validateThereOfJsonStr;
9533
+ exports.validateVariancesList = validateVariancesList;
9534
+ exports.withComponentStyle = withComponentStyle;
9535
+ exports.withStyled = withStyled;