@bino-bi/bn-template-engine 1.0.0-alpha.4 → 1.0.0-alpha.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (166) hide show
  1. package/dist/bn-template-engine/bn-template-engine.esm.js +1 -1
  2. package/dist/bn-template-engine/p-06946f44.entry.js +1 -0
  3. package/dist/bn-template-engine/p-0fabe296.entry.js +1 -0
  4. package/dist/bn-template-engine/p-1164c0b0.entry.js +1 -0
  5. package/dist/bn-template-engine/p-355abdf0.entry.js +1 -0
  6. package/dist/bn-template-engine/p-79KuA4Ox.js +1 -0
  7. package/dist/bn-template-engine/p-859cc06d.entry.js +1 -0
  8. package/dist/bn-template-engine/p-8acec99e.entry.js +1 -0
  9. package/dist/bn-template-engine/p-8f490c45.entry.js +1 -0
  10. package/dist/bn-template-engine/p-98cf512f.entry.js +1 -0
  11. package/dist/bn-template-engine/p-9a564f8f.entry.js +1 -0
  12. package/dist/bn-template-engine/{p-CL1RYuNU.js → p-B0lsgVuN.js} +1 -1
  13. package/dist/bn-template-engine/p-B7p8beYH.js +1 -0
  14. package/dist/bn-template-engine/p-BDh7GfC5.js +1 -0
  15. package/dist/bn-template-engine/p-BoMtoHJB.js +1 -0
  16. package/dist/bn-template-engine/p-Bs8BqBsb.js +1 -0
  17. package/dist/bn-template-engine/p-CYjZRKdI.js +1 -0
  18. package/dist/bn-template-engine/{p-P7pGJBgc.js → p-DG-1MR_T.js} +1 -1
  19. package/dist/bn-template-engine/p-bdd2b243.entry.js +1 -0
  20. package/dist/bn-template-engine/p-e6b24f15.entry.js +1 -0
  21. package/dist/bn-template-engine/p-f27995c9.entry.js +1 -0
  22. package/dist/bn-template-engine/{p-Bnhh02CF.js → p-sRO-lj7X.js} +1 -1
  23. package/dist/bn-template-engine/p-tzFCK9qn.js +1 -0
  24. package/dist/cjs/{Order-iG11HI4R.js → Order-BGx39pS5.js} +448 -0
  25. package/dist/cjs/{alasql.min-C_nHTuEQ.js → SVGVariancesStyleGroup-BqAdPYtL.js} +8228 -3
  26. package/dist/cjs/bn-asset_16.cjs.entry.js +9018 -0
  27. package/dist/cjs/bn-card.cjs.entry.js +3 -4
  28. package/dist/cjs/bn-chart-time.cjs.entry.js +11 -16
  29. package/dist/cjs/bn-grid.cjs.entry.js +5 -8
  30. package/dist/cjs/bn-image.cjs.entry.js +5 -8
  31. package/dist/cjs/bn-internationalization.cjs.entry.js +3 -4
  32. package/dist/cjs/bn-layout-card.cjs.entry.js +125 -6
  33. package/dist/cjs/bn-template-engine.cjs.js +1 -1
  34. package/dist/cjs/bn-template.cjs.entry.js +2 -3
  35. package/dist/cjs/bn-text.cjs.entry.js +7 -11
  36. package/dist/cjs/bn-tree.cjs.entry.js +5 -8
  37. package/dist/cjs/{formatter-DIJL_crx.js → formatter-4XCS0d2B.js} +8 -2
  38. package/dist/cjs/ibcs-chart-time.cjs.entry.js +37 -42
  39. package/dist/cjs/loader.cjs.js +1 -1
  40. package/dist/cjs/{scaling-9Tz595RQ.js → scaling-BidPsO53.js} +115 -12
  41. package/dist/cjs/{withBodyObserver-CKpSD8UT.js → withBodyObserver-C6gLgq_e.js} +3 -3
  42. package/dist/cjs/{withComponentStatus-Bw70BhO0.js → withComponentStatus-_x4LQZ0N.js} +5 -5
  43. package/dist/cjs/{withComponentStyle-aIbTCtfj.js → withComponentStyle-ClSJfCku.js} +4 -4
  44. package/dist/cjs/{utils-CwHIVbbL.js → withHasError-B8gHkfV2.js} +69 -1
  45. package/dist/cjs/{withStyled-CS1Yp4sv.js → withStyled-9tG024gQ.js} +62 -9
  46. package/dist/collection/components/bn-chart-structure/utils/elements/Label.js +11 -0
  47. package/dist/collection/components/bn-chart-structure/utils/elements/StackedBar.js +5 -2
  48. package/dist/collection/components/bn-layout-card/bn-layout-card.css +1 -0
  49. package/dist/collection/components/bn-layout-card/bn-layout-card.js +162 -27
  50. package/dist/collection/components/bn-layout-page/bn-layout-page.css +1 -0
  51. package/dist/collection/components/bn-layout-page/bn-layout-page.js +151 -33
  52. package/dist/collection/components/bn-table/bn-table.js +12 -10
  53. package/dist/collection/components/bn-table/ibcs-table.js +2 -2
  54. package/dist/collection/utils/parentDimensions.js +38 -6
  55. package/dist/components/bn-layout-card.js +1 -1
  56. package/dist/components/bn-layout-page.js +1 -1
  57. package/dist/components/bn-table.js +1 -1
  58. package/dist/components/ibcs-chart-structure2.js +1 -1
  59. package/dist/components/ibcs-table2.js +1 -1
  60. package/dist/components/scaling.js +1 -1
  61. package/dist/esm/{Order-Bnhh02CF.js → Order-sRO-lj7X.js} +448 -1
  62. package/dist/esm/{alasql.min-CWu4NkIt.js → SVGVariancesStyleGroup-DOIT-zvI.js} +8212 -2
  63. package/dist/esm/bn-asset_16.entry.js +9001 -0
  64. package/dist/esm/bn-card.entry.js +4 -5
  65. package/dist/esm/bn-chart-time.entry.js +8 -13
  66. package/dist/esm/bn-grid.entry.js +6 -9
  67. package/dist/esm/bn-image.entry.js +6 -9
  68. package/dist/esm/bn-internationalization.entry.js +4 -5
  69. package/dist/esm/bn-layout-card.entry.js +126 -7
  70. package/dist/esm/bn-template-engine.js +1 -1
  71. package/dist/esm/bn-template.entry.js +2 -3
  72. package/dist/esm/bn-text.entry.js +7 -11
  73. package/dist/esm/bn-tree.entry.js +6 -9
  74. package/dist/esm/{context-protocol-BHnQsVsr.js → context-protocol-2peaD4y8.js} +1 -1
  75. package/dist/esm/editor-companion.entry.js +1 -1
  76. package/dist/esm/{formatter-DTMEZ6d8.js → formatter-BDh7GfC5.js} +6 -2
  77. package/dist/esm/ibcs-chart-time.entry.js +3 -8
  78. package/dist/esm/loader.js +1 -1
  79. package/dist/esm/{scaling-Cehc74IE.js → scaling-BOcjT8M0.js} +112 -10
  80. package/dist/esm/{withBodyObserver-FQ8NwCIz.js → withBodyObserver-DczL5ia8.js} +1 -1
  81. package/dist/esm/{withComponentStatus-DWjDYtZ7.js → withComponentStatus-DodoSXe-.js} +1 -1
  82. package/dist/esm/{withComponentStyle-9uP_hcDq.js → withComponentStyle-D3VWOsto.js} +2 -2
  83. package/dist/esm/{utils-DvvwfRQG.js → withHasError-B3QX2emi.js} +69 -1
  84. package/dist/esm/{withStyled--qQWquTH.js → withStyled-CE3_3taP.js} +57 -5
  85. package/dist/types/components/bn-chart-structure/utils/elements/Label.d.ts +2 -0
  86. package/dist/types/components/bn-layout-card/bn-layout-card.d.ts +139 -0
  87. package/dist/types/components/bn-layout-page/bn-layout-page.d.ts +154 -0
  88. package/dist/types/components/bn-table/bn-table.d.ts +7 -5
  89. package/dist/types/components.d.ts +170 -2
  90. package/dist/types/utils/parentDimensions.d.ts +6 -1
  91. package/package.json +1 -1
  92. package/dist/bn-template-engine/p-1265d8d3.entry.js +0 -1
  93. package/dist/bn-template-engine/p-15516dac.entry.js +0 -1
  94. package/dist/bn-template-engine/p-1c716641.entry.js +0 -1
  95. package/dist/bn-template-engine/p-1jFf17Vj.js +0 -1
  96. package/dist/bn-template-engine/p-27cc8dc0.entry.js +0 -1
  97. package/dist/bn-template-engine/p-4426d484.entry.js +0 -1
  98. package/dist/bn-template-engine/p-51f8dc9e.entry.js +0 -1
  99. package/dist/bn-template-engine/p-53d4e690.entry.js +0 -1
  100. package/dist/bn-template-engine/p-5KQYRQLK.js +0 -1
  101. package/dist/bn-template-engine/p-745f4596.entry.js +0 -1
  102. package/dist/bn-template-engine/p-75e97c87.entry.js +0 -1
  103. package/dist/bn-template-engine/p-7a560278.entry.js +0 -1
  104. package/dist/bn-template-engine/p-7ea7c325.entry.js +0 -1
  105. package/dist/bn-template-engine/p-945cc95d.entry.js +0 -1
  106. package/dist/bn-template-engine/p-BFTU3MAI.js +0 -1
  107. package/dist/bn-template-engine/p-BYBpC0EO.js +0 -1
  108. package/dist/bn-template-engine/p-BYmPQYxx.js +0 -1
  109. package/dist/bn-template-engine/p-BfXY5dsy.js +0 -1
  110. package/dist/bn-template-engine/p-BgnHJQ9Q.js +0 -1
  111. package/dist/bn-template-engine/p-Bhd_WSML.js +0 -1
  112. package/dist/bn-template-engine/p-Bka-Z6jo.js +0 -1
  113. package/dist/bn-template-engine/p-C7dQL8CS.js +0 -1
  114. package/dist/bn-template-engine/p-CYwd_ZNM.js +0 -1
  115. package/dist/bn-template-engine/p-ChlK-T9I.js +0 -1
  116. package/dist/bn-template-engine/p-DHezf8pZ.js +0 -1
  117. package/dist/bn-template-engine/p-DlppAFq9.js +0 -1
  118. package/dist/bn-template-engine/p-DvDDgmcV.js +0 -1
  119. package/dist/bn-template-engine/p-DvvwfRQG.js +0 -1
  120. package/dist/bn-template-engine/p-b34eaf86.entry.js +0 -1
  121. package/dist/bn-template-engine/p-bdb8b44c.entry.js +0 -1
  122. package/dist/bn-template-engine/p-c44fcb8e.entry.js +0 -1
  123. package/dist/bn-template-engine/p-c7e1a49b.entry.js +0 -1
  124. package/dist/bn-template-engine/p-d9003041.entry.js +0 -1
  125. package/dist/bn-template-engine/p-daa7ffa3.entry.js +0 -1
  126. package/dist/bn-template-engine/p-e084f50a.entry.js +0 -1
  127. package/dist/bn-template-engine/p-eaba6658.entry.js +0 -1
  128. package/dist/bn-template-engine/p-u8igQLRZ.js +0 -1
  129. package/dist/cjs/DataFormatDigits-DKcOeLNK.js +0 -142
  130. package/dist/cjs/DateStringFactory-CSKvbS8K.js +0 -452
  131. package/dist/cjs/SVGVariancesStyleGroup-K-Tw6lOD.js +0 -7960
  132. package/dist/cjs/_commonjsHelpers-BJu3ubxk.js +0 -10
  133. package/dist/cjs/bn-asset.cjs.entry.js +0 -42
  134. package/dist/cjs/bn-body_4.cjs.entry.js +0 -748
  135. package/dist/cjs/bn-chart-structure_5.cjs.entry.js +0 -3934
  136. package/dist/cjs/bn-component-style.cjs.entry.js +0 -44
  137. package/dist/cjs/bn-dataset.cjs.entry.js +0 -306
  138. package/dist/cjs/bn-layout-page.cjs.entry.js +0 -143
  139. package/dist/cjs/bn-message.cjs.entry.js +0 -52
  140. package/dist/cjs/bn-table.cjs.entry.js +0 -979
  141. package/dist/cjs/contentDecoder-JxOldq1e.js +0 -419
  142. package/dist/cjs/emotion-hash.esm-nbbEQ0Dn.js +0 -57
  143. package/dist/cjs/ibcs-table.cjs.entry.js +0 -2276
  144. package/dist/cjs/ibcsRuleSet-DgUoXOfd.js +0 -136
  145. package/dist/cjs/index-Dm85hG6t.js +0 -65
  146. package/dist/cjs/withHasError-D7ue5vAv.js +0 -72
  147. package/dist/cjs/withTranslation-rwgyITqe.js +0 -77
  148. package/dist/esm/DataFormatDigits-oSZ1hBKE.js +0 -137
  149. package/dist/esm/DateStringFactory-CSGz6TDk.js +0 -450
  150. package/dist/esm/SVGVariancesStyleGroup-CqTjrZYg.js +0 -7950
  151. package/dist/esm/_commonjsHelpers-BFTU3MAI.js +0 -7
  152. package/dist/esm/bn-asset.entry.js +0 -40
  153. package/dist/esm/bn-body_4.entry.js +0 -743
  154. package/dist/esm/bn-chart-structure_5.entry.js +0 -3928
  155. package/dist/esm/bn-component-style.entry.js +0 -42
  156. package/dist/esm/bn-dataset.entry.js +0 -304
  157. package/dist/esm/bn-layout-page.entry.js +0 -141
  158. package/dist/esm/bn-message.entry.js +0 -50
  159. package/dist/esm/bn-table.entry.js +0 -977
  160. package/dist/esm/contentDecoder-oMmxz6nJ.js +0 -416
  161. package/dist/esm/emotion-hash.esm-BYBpC0EO.js +0 -55
  162. package/dist/esm/ibcs-table.entry.js +0 -2274
  163. package/dist/esm/ibcsRuleSet-K4ytuA1f.js +0 -133
  164. package/dist/esm/index-DHezf8pZ.js +0 -65
  165. package/dist/esm/withHasError-FyY5mQ_3.js +0 -70
  166. package/dist/esm/withTranslation-BqD0Kp7b.js +0 -75
@@ -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 utils = require('./utils-CwHIVbbL.js');
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
- utils.runIfExisits(connectedCallback, component);
113
+ withHasError.runIfExisits(connectedCallback, component);
114
114
  };
115
115
  const disconnectedCallback = component["disconnectedCallback"];
116
116
  component["disconnectedCallback"] = () => {
117
117
  observer.disconnect();
118
- utils.runIfExisits(subscription);
118
+ withHasError.runIfExisits(subscription);
119
119
  contextProtocol.clearStoresCache(index.getElement(component));
120
- utils.runIfExisits(disconnectedCallback, component);
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;
@@ -1,10 +1,8 @@
1
1
  'use strict';
2
2
 
3
- var emotionHash_esm = require('./emotion-hash.esm-nbbEQ0Dn.js');
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 utils = require('./utils-CwHIVbbL.js');
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 DateStringFactory.DateLink;
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 DateStringFactory.DateDistance;
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 = emotionHash_esm.murmur2(value);
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
- utils.runIfExisits(cstrConnectedCallback, component);
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
- utils.runIfExisits(cstrDisconnectedCallback, component);
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;
@@ -30,6 +30,7 @@ export class Label {
30
30
  constructor(parent, xPosition, yPosition, groupPrefix, value, styles, verticalHookLocation, horizontalHookLocation) {
31
31
  this.group = null;
32
32
  this.segmentFillColor = null;
33
+ this.maxWidth = null;
33
34
  this.ID_SCENARIOLABEL = "Label";
34
35
  this.CSS_CATEGORIES = "categories";
35
36
  this.x = xPosition;
@@ -57,6 +58,10 @@ export class Label {
57
58
  this.segmentFillColor = color;
58
59
  return this;
59
60
  }
61
+ setMaxWidth(width) {
62
+ this.maxWidth = width;
63
+ return this;
64
+ }
60
65
  updateGroup(newGroup) {
61
66
  this.group = newGroup;
62
67
  return this;
@@ -65,6 +70,7 @@ export class Label {
65
70
  return prefix + "_" + groupPrefix + "_" + this.ID_SCENARIOLABEL;
66
71
  }
67
72
  draw(dataFormatDigits = { percent: 2, decimal: 1 }, measureScale = new SiPrefix()) {
73
+ var _a;
68
74
  if (this.isEmpty()) {
69
75
  return this;
70
76
  }
@@ -102,6 +108,11 @@ export class Label {
102
108
  text.move(this.x, this.y);
103
109
  const boxWidth = text.bbox().w;
104
110
  const boxHeight = text.bbox().h;
111
+ if (this.maxWidth != null && boxWidth > this.maxWidth) {
112
+ (_a = this.group) === null || _a === void 0 ? void 0 : _a.remove();
113
+ this.group = null;
114
+ return this;
115
+ }
105
116
  if (this.horizontalHookLocation === HookLocation.Right) {
106
117
  labelAnchor = "end";
107
118
  text.move(text.x() - text.length(), text.y());
@@ -50,20 +50,23 @@ export class StackedBar {
50
50
  const strokeStyle = { color: fillColor, width: 0.5 };
51
51
  this.barGroup.rect(Math.max(segmentLength, 0.5), barWidth).fill(fillStyle).stroke(strokeStyle).cy(yPos).x(xPos);
52
52
  // Draw segment value label centered on bar if wide enough
53
- const MIN_SEGMENT_WIDTH_FOR_LABEL = 30;
54
- if (segmentLength >= MIN_SEGMENT_WIDTH_FOR_LABEL) {
53
+ const LABEL_PADDING = 6;
54
+ const availableWidth = segmentLength - LABEL_PADDING;
55
+ if (availableWidth > 0) {
55
56
  const labelX = xPos + segmentLength / 2;
56
57
  if (this.stackMode === StackMode.RELATIVE || this.stackMode === StackMode.ABSOLUTE_RELATIVE) {
57
58
  const pct = this.totalValue !== 0 ? (value / this.totalValue) * 100 : 0;
58
59
  const labelValue = pct.toFixed(dataFormatDigits.percent) + "%";
59
60
  new Label(this.group, labelX, yPos, "STACK_SEG", labelValue, this.styles, HookLocation.Center, HookLocation.Center)
60
61
  .setSegmentFill(fillColor)
62
+ .setMaxWidth(availableWidth)
61
63
  .draw();
62
64
  }
63
65
  else {
64
66
  // Pass raw numeric value — Label.draw() formats with measureScale
65
67
  new Label(this.group, labelX, yPos, "STACK_SEG", value, this.styles, HookLocation.Center, HookLocation.Center)
66
68
  .setSegmentFill(fillColor)
69
+ .setMaxWidth(availableWidth)
67
70
  .draw(dataFormatDigits, measureScale);
68
71
  }
69
72
  }
@@ -3,6 +3,7 @@
3
3
  color: var(--bn-font-color, black);
4
4
  font-family: var(--bn-font-family, "Noto Sans", sans-serif);
5
5
  font-size: var(--bn-font-size, 13.3333px);
6
+ display: block;
6
7
  flex-direction: column;
7
8
  overflow: hidden;
8
9
  float: left;
@@ -3,18 +3,111 @@ import { getStores } from "../../context/context-protocol";
3
3
  import withHasError from "../../utils/withHasError";
4
4
  export class LayoutCard {
5
5
  constructor() {
6
+ /**
7
+ * URL or asset name of the image displayed next to the card title.
8
+ * The value is resolved via the scoped assets store: if it matches a
9
+ * registered asset name, the stored URL is used; otherwise the raw value
10
+ * is treated as a URL. The deprecated `asset:` prefix is still supported
11
+ * for backward compatibility.
12
+ * <br /><br />
13
+ * If empty, the title image is omitted.
14
+ *
15
+ * @example
16
+ * <bn-layout-card title-image="company_logo"></bn-layout-card>
17
+ */
6
18
  this.titleImage = "";
19
+ /**
20
+ * Name of the business unit displayed in the title header row.
21
+ * If empty, the business unit row is omitted.
22
+ *
23
+ * @example
24
+ * <bn-layout-card title-business-unit="Sales"></bn-layout-card>
25
+ */
7
26
  this.titleBusinessUnit = "";
27
+ /**
28
+ * Primary column on which the order direction is applied.
29
+ * <br /><br />
30
+ * values:<br />
31
+ * ```category // categoryindex // rowgroup // rowgroupindex // ac // fc // py // pl```
32
+ */
8
33
  this.titleOrder = "category";
34
+ /**
35
+ * Sorting order direction for the column specified by `titleOrder`.
36
+ * <br /><br />
37
+ * values:<br />
38
+ * ```asc // desc```
39
+ */
9
40
  this.titleOrderDirection = "asc";
41
+ /**
42
+ * Date display format used in the title row.
43
+ * <br /><br />
44
+ * values:<br />
45
+ * ```year // quarter // month // week // day // time // auto // none```
46
+ * <br /><br />
47
+ * `year`: YYYY, `quarter`: Q[Q] YYYY, `month`: MMM YYYY,
48
+ * `week`: [KW]WW YYYY, `day`: DD.MM.YYYY, `time`: DD.MM.YYYY HH:mm:ss,
49
+ * `auto`: automatic detection, `none`: DD.MM.YYYY.
50
+ */
10
51
  this.titleDateFormat = "none";
52
+ /**
53
+ * Format in which the start and end dates are linked in the title.
54
+ * If set to `none` a plain date is shown.
55
+ * <br /><br />
56
+ * values:<br />
57
+ * ```avg // interval // cum // start // end // ytd // ytg // mat // none```
58
+ * <br /><br />
59
+ * `avg`: Ø[DATE], `interval`: [DATE]..[DATE2], `start`: .[DATE],
60
+ * `end`: [DATE]., `ytd`: _[DATE], `ytg`: [DATE]_, `cum`: [DATE]_[DATE2],
61
+ * `mat`: ~[DATE], `none`: [DATE].
62
+ */
11
63
  this.titleDateLink = "none";
64
+ /**
65
+ * Namespace used for title translations via the internationalization store.
66
+ */
12
67
  this.titleNamespace = "_system";
68
+ /**
69
+ * Text displayed in the card footer. If empty, the footer text is omitted.
70
+ */
13
71
  this.footerText = "";
72
+ /**
73
+ * Layout mode that controls how child components are arranged inside
74
+ * the card body using CSS Grid.
75
+ * <br /><br />
76
+ * values:<br />
77
+ * ```full // split-vertical // split-horizontal // 2x2 // 3x3 // 4x4 // 1-over-2 // 1-over-3 // 2-over-1 // 3-over-1 // custom-template```
78
+ * <br /><br />
79
+ * `full`: single slot. `split-vertical`: two side-by-side slots.
80
+ * `split-horizontal`: two stacked slots. `NxN`: equal grid.
81
+ * `1-over-2`: one full-width slot on top, two below. `custom-template`:
82
+ * uses the `cardCustomTemplate` CSS grid-template-areas string.
83
+ *
84
+ * @example
85
+ * <bn-layout-card card-layout="split-horizontal"></bn-layout-card>
86
+ */
14
87
  this.cardLayout = "full";
88
+ /**
89
+ * CSS `grid-template-areas` string used when `cardLayout` is set to
90
+ * `custom-template`. Each quoted row defines a grid row; letters map to
91
+ * slot indices in order of first appearance.
92
+ *
93
+ * @example
94
+ * <bn-layout-card card-layout="custom-template"
95
+ * card-custom-template='"a a" "b c"'></bn-layout-card>
96
+ */
15
97
  this.cardCustomTemplate = '"a b" "c d"';
98
+ /**
99
+ * Gap between grid cells in pixels.
100
+ */
16
101
  this.cardGridGap = "0";
102
+ /**
103
+ * When `true`, the card shrinks to fit its content (`fit-content`)
104
+ * for both width and height. When `false`, the card stretches to
105
+ * fill its parent (`100%`).
106
+ */
17
107
  this.cardFitToContent = true;
108
+ /**
109
+ * Whether to display a visible border around the card.
110
+ */
18
111
  this.cardShowBorder = true;
19
112
  this.templateMap = new Map([
20
113
  ["split-vertical", '"a b"'],
@@ -49,13 +142,41 @@ export class LayoutCard {
49
142
  gap: this.cardGridGap + "px",
50
143
  };
51
144
  }
145
+ calculatePercentages(input) {
146
+ const items = input.trim().split(/\s+/);
147
+ const count = items.length;
148
+ if (count === 0)
149
+ return "100%";
150
+ const percentage = (100 / count).toFixed(0) + "%";
151
+ return Array(count).fill(percentage).join(" ");
152
+ }
153
+ getGridTemplateColumns(name) {
154
+ const template = this.getTemplatePattern(name);
155
+ const pattern = /"[\w\d\s.]+"/g;
156
+ const matches = template.match(pattern);
157
+ if (!matches || matches.length === 0)
158
+ return "100%";
159
+ return this.calculatePercentages(matches[0]);
160
+ }
161
+ getGridTemplateRows(name) {
162
+ const template = this.getTemplatePattern(name);
163
+ const pattern = /"[\w\d\s.]+"/g;
164
+ const matches = template.match(pattern);
165
+ const rowCount = matches ? matches.length : 1;
166
+ if (this.cardFitToContent) {
167
+ return Array(rowCount).fill("auto").join(" ");
168
+ }
169
+ return Array(rowCount).fill("1fr").join(" ");
170
+ }
52
171
  getLayoutStyle() {
53
- return Object.assign(Object.assign({}, this.getCommonStyles()), { "grid-template-areas": this.getTemplatePattern(this.cardLayout) });
172
+ return Object.assign(Object.assign({}, this.getCommonStyles()), { "grid-template-areas": this.getTemplatePattern(this.cardLayout), "grid-template-columns": this.getGridTemplateColumns(this.cardLayout), "grid-template-rows": this.getGridTemplateRows(this.cardLayout) });
54
173
  }
55
174
  createDivAreaStyles(elements) {
56
175
  return elements.map((x) => ({
176
+ width: "100%",
57
177
  overflow: "hidden",
58
178
  "grid-area": x,
179
+ height: "100%",
59
180
  }));
60
181
  }
61
182
  getSlots(slotNames) {
@@ -75,7 +196,6 @@ export class LayoutCard {
75
196
  return Array.from(new Set(words));
76
197
  }
77
198
  getTemplatePattern(name) {
78
- console.warn("getTemplatePattern", { name: name });
79
199
  if (this.templateMap.has(name) === false && name !== "custom-template") {
80
200
  return '"a"';
81
201
  }
@@ -113,7 +233,7 @@ export class LayoutCard {
113
233
  const arrOfSlots = this.extractSlotNames(style["grid-template-areas"]);
114
234
  return (
115
235
  // @ts-ignore
116
- h("bn-card", { key: 'cdc04f3414fa80148fc8be40cbaf0cac1035fca1', styles: this.styles, class: this.setCardClass() }, h("div", { key: '3374b14ec8a8a73de58f866b0c6a691ee0b8d2ae', class: "cardtitle" }, h("bn-title", { key: '23a6f991ad6b1a8b74066943b108f3666ae0c863', 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 }), this.titleImage != null && this.titleImage !== "" ? (h("img", { class: "image", src: this.prepareTitleImage(this.titleImage) })) : ("")), h("bn-body", { key: '06d86283489ea2db12d448b1d4b72b540ad352f8' }, h("div", { key: '659cfb06f4d756ffd4e1d08910c66a0751d71f9d', style: style }, this.getSlots(arrOfSlots))), h("bn-footer", { key: '8aa67fdf3bcbb465c7861f83f6371bc7f73ae75e', text: this.footerText, "page-number": 0, "display-page-number": "false" })));
236
+ h("bn-card", { key: 'e920b128510046289f0960c19abb1eadb2751204', styles: this.styles, class: this.setCardClass() }, h("div", { key: 'de7b2ed78aade1a7c2d0a8a69cd1f7b47eef2414', class: "cardtitle" }, h("bn-title", { key: '72fd36fe7e0bc2d628825b69114b81e04669143d', 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 }), this.titleImage != null && this.titleImage !== "" ? (h("img", { class: "image", src: this.prepareTitleImage(this.titleImage) })) : ("")), h("bn-body", { key: '1d3a6da80bcaab5ab2d9442edd548bc408f10563' }, h("div", { key: 'e24cfa54735c0b401e34825a8da7327555c120c5', style: style }, this.getSlots(arrOfSlots))), h("bn-footer", { key: 'c2307c5dcb8058d49465fbafa7d5aaa6e5dc4488', text: this.footerText, "page-number": 0, "display-page-number": "false" })));
117
237
  }
118
238
  static get is() { return "bn-layout-card"; }
119
239
  static get encapsulation() { return "shadow"; }
@@ -141,7 +261,7 @@ export class LayoutCard {
141
261
  "optional": true,
142
262
  "docs": {
143
263
  "tags": [],
144
- "text": ""
264
+ "text": "JSON string of component-style overrides passed through to the inner\n`<bn-card>` element. Typically set via a `ComponentStyle` manifest\nrather than directly on the component."
145
265
  },
146
266
  "getter": false,
147
267
  "setter": false,
@@ -159,8 +279,11 @@ export class LayoutCard {
159
279
  "required": false,
160
280
  "optional": false,
161
281
  "docs": {
162
- "tags": [],
163
- "text": ""
282
+ "tags": [{
283
+ "name": "example",
284
+ "text": "<bn-layout-card title-image=\"company_logo\"></bn-layout-card>"
285
+ }],
286
+ "text": "URL or asset name of the image displayed next to the card title.\nThe value is resolved via the scoped assets store: if it matches a\nregistered asset name, the stored URL is used; otherwise the raw value\nis treated as a URL. The deprecated `asset:` prefix is still supported\nfor backward compatibility.\n<br /><br />\nIf empty, the title image is omitted."
164
287
  },
165
288
  "getter": false,
166
289
  "setter": false,
@@ -179,8 +302,11 @@ export class LayoutCard {
179
302
  "required": false,
180
303
  "optional": false,
181
304
  "docs": {
182
- "tags": [],
183
- "text": ""
305
+ "tags": [{
306
+ "name": "example",
307
+ "text": "<bn-layout-card title-business-unit=\"Sales\"></bn-layout-card>"
308
+ }],
309
+ "text": "Name of the business unit displayed in the title header row.\nIf empty, the business unit row is omitted."
184
310
  },
185
311
  "getter": false,
186
312
  "setter": false,
@@ -200,7 +326,7 @@ export class LayoutCard {
200
326
  "optional": true,
201
327
  "docs": {
202
328
  "tags": [],
203
- "text": ""
329
+ "text": "List of scenarios displayed in the title header.\n<br /><br />\nComma-separated string or omitted. If empty, the scenarios row is omitted.\n<br /><br />\nvalues:<br />\n```ac // fc // py // pl```"
204
330
  },
205
331
  "getter": false,
206
332
  "setter": false,
@@ -219,7 +345,7 @@ export class LayoutCard {
219
345
  "optional": true,
220
346
  "docs": {
221
347
  "tags": [],
222
- "text": ""
348
+ "text": "List of variances calculated from the given scenarios.\nThe scenarios used in the variances must also be defined in\nthe `titleScenarios` property. The variance is defined as\n(ScenarioA \u2212 ScenarioB). The pos/neg/neu postfix defines\nwhich direction is considered \"good\".\n<br /><br />\nIf empty, variance indicators are hidden.\n<br /><br />\npattern:<br />\n```d<scenarioB>_<scenarioA>_[pos/neg/neu]```"
223
349
  },
224
350
  "getter": false,
225
351
  "setter": false,
@@ -238,7 +364,7 @@ export class LayoutCard {
238
364
  "optional": false,
239
365
  "docs": {
240
366
  "tags": [],
241
- "text": ""
367
+ "text": "Primary column on which the order direction is applied.\n<br /><br />\nvalues:<br />\n```category // categoryindex // rowgroup // rowgroupindex // ac // fc // py // pl```"
242
368
  },
243
369
  "getter": false,
244
370
  "setter": false,
@@ -258,7 +384,7 @@ export class LayoutCard {
258
384
  "optional": false,
259
385
  "docs": {
260
386
  "tags": [],
261
- "text": ""
387
+ "text": "Sorting order direction for the column specified by `titleOrder`.\n<br /><br />\nvalues:<br />\n```asc // desc```"
262
388
  },
263
389
  "getter": false,
264
390
  "setter": false,
@@ -277,8 +403,11 @@ export class LayoutCard {
277
403
  "required": false,
278
404
  "optional": true,
279
405
  "docs": {
280
- "tags": [],
281
- "text": ""
406
+ "tags": [{
407
+ "name": "example",
408
+ "text": "<bn-layout-card title-measures='[{\"name\":\"Revenue\",\"unit\":\"mEUR\"}]'></bn-layout-card>"
409
+ }],
410
+ "text": "Array of measure objects with `name` and `unit` displayed in the title.\nPassed as a JSON string. If all units are the same, redundant units are\nreduced and names concatenated. If empty, the measure row is omitted."
282
411
  },
283
412
  "getter": false,
284
413
  "setter": false,
@@ -297,7 +426,7 @@ export class LayoutCard {
297
426
  "optional": true,
298
427
  "docs": {
299
428
  "tags": [],
300
- "text": ""
429
+ "text": "Start date displayed in the title date row.\nAccepts `yyyy-MM-dd` (e.g. `2024-01-01`) or ISO 8601 datetime\n(e.g. `2024-01-01T14:30:00Z`)."
301
430
  },
302
431
  "getter": false,
303
432
  "setter": false,
@@ -316,7 +445,7 @@ export class LayoutCard {
316
445
  "optional": true,
317
446
  "docs": {
318
447
  "tags": [],
319
- "text": ""
448
+ "text": "End date displayed in the title date row.\nAccepts `yyyy-MM-dd` (e.g. `2024-12-31`) or ISO 8601 datetime\n(e.g. `2024-12-31T23:59:59Z`)."
320
449
  },
321
450
  "getter": false,
322
451
  "setter": false,
@@ -335,7 +464,7 @@ export class LayoutCard {
335
464
  "optional": false,
336
465
  "docs": {
337
466
  "tags": [],
338
- "text": ""
467
+ "text": "Date display format used in the title row.\n<br /><br />\nvalues:<br />\n```year // quarter // month // week // day // time // auto // none```\n<br /><br />\n`year`: YYYY, `quarter`: Q[Q] YYYY, `month`: MMM YYYY,\n`week`: [KW]WW YYYY, `day`: DD.MM.YYYY, `time`: DD.MM.YYYY HH:mm:ss,\n`auto`: automatic detection, `none`: DD.MM.YYYY."
339
468
  },
340
469
  "getter": false,
341
470
  "setter": false,
@@ -355,7 +484,7 @@ export class LayoutCard {
355
484
  "optional": false,
356
485
  "docs": {
357
486
  "tags": [],
358
- "text": ""
487
+ "text": "Format in which the start and end dates are linked in the title.\nIf set to `none` a plain date is shown.\n<br /><br />\nvalues:<br />\n```avg // interval // cum // start // end // ytd // ytg // mat // none```\n<br /><br />\n`avg`: \u00D8[DATE], `interval`: [DATE]..[DATE2], `start`: .[DATE],\n`end`: [DATE]., `ytd`: _[DATE], `ytg`: [DATE]_, `cum`: [DATE]_[DATE2],\n`mat`: ~[DATE], `none`: [DATE]."
359
488
  },
360
489
  "getter": false,
361
490
  "setter": false,
@@ -375,7 +504,7 @@ export class LayoutCard {
375
504
  "optional": false,
376
505
  "docs": {
377
506
  "tags": [],
378
- "text": ""
507
+ "text": "Namespace used for title translations via the internationalization store."
379
508
  },
380
509
  "getter": false,
381
510
  "setter": false,
@@ -395,7 +524,7 @@ export class LayoutCard {
395
524
  "optional": true,
396
525
  "docs": {
397
526
  "tags": [],
398
- "text": ""
527
+ "text": "Text displayed in the card footer. If empty, the footer text is omitted."
399
528
  },
400
529
  "getter": false,
401
530
  "setter": false,
@@ -414,8 +543,11 @@ export class LayoutCard {
414
543
  "required": false,
415
544
  "optional": false,
416
545
  "docs": {
417
- "tags": [],
418
- "text": ""
546
+ "tags": [{
547
+ "name": "example",
548
+ "text": "<bn-layout-card card-layout=\"split-horizontal\"></bn-layout-card>"
549
+ }],
550
+ "text": "Layout mode that controls how child components are arranged inside\nthe card body using CSS Grid.\n<br /><br />\nvalues:<br />\n```full // split-vertical // split-horizontal // 2x2 // 3x3 // 4x4 // 1-over-2 // 1-over-3 // 2-over-1 // 3-over-1 // custom-template```\n<br /><br />\n`full`: single slot. `split-vertical`: two side-by-side slots.\n`split-horizontal`: two stacked slots. `NxN`: equal grid.\n`1-over-2`: one full-width slot on top, two below. `custom-template`:\nuses the `cardCustomTemplate` CSS grid-template-areas string."
419
551
  },
420
552
  "getter": false,
421
553
  "setter": false,
@@ -434,8 +566,11 @@ export class LayoutCard {
434
566
  "required": false,
435
567
  "optional": false,
436
568
  "docs": {
437
- "tags": [],
438
- "text": ""
569
+ "tags": [{
570
+ "name": "example",
571
+ "text": "<bn-layout-card card-layout=\"custom-template\"\n card-custom-template='\"a a\" \"b c\"'></bn-layout-card>"
572
+ }],
573
+ "text": "CSS `grid-template-areas` string used when `cardLayout` is set to\n`custom-template`. Each quoted row defines a grid row; letters map to\nslot indices in order of first appearance."
439
574
  },
440
575
  "getter": false,
441
576
  "setter": false,
@@ -455,7 +590,7 @@ export class LayoutCard {
455
590
  "optional": false,
456
591
  "docs": {
457
592
  "tags": [],
458
- "text": ""
593
+ "text": "Gap between grid cells in pixels."
459
594
  },
460
595
  "getter": false,
461
596
  "setter": false,
@@ -475,7 +610,7 @@ export class LayoutCard {
475
610
  "optional": false,
476
611
  "docs": {
477
612
  "tags": [],
478
- "text": ""
613
+ "text": "When `true`, the card shrinks to fit its content (`fit-content`)\nfor both width and height. When `false`, the card stretches to\nfill its parent (`100%`)."
479
614
  },
480
615
  "getter": false,
481
616
  "setter": false,
@@ -495,7 +630,7 @@ export class LayoutCard {
495
630
  "optional": false,
496
631
  "docs": {
497
632
  "tags": [],
498
- "text": ""
633
+ "text": "Whether to display a visible border around the card."
499
634
  },
500
635
  "getter": false,
501
636
  "setter": false,