@bino-bi/bn-template-engine 1.0.0-next.45 → 1.0.0-next.46

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 (169) hide show
  1. package/dist/bn-template-engine/bn-template-engine.esm.js +1 -1
  2. package/dist/bn-template-engine/{p-8b28c9bd.entry.js → p-16623e0f.entry.js} +1 -1
  3. package/dist/bn-template-engine/p-17970e07.entry.js +1 -0
  4. package/dist/bn-template-engine/{p-48871742.entry.js → p-21930d0a.entry.js} +1 -1
  5. package/dist/bn-template-engine/{p-5a64f90f.entry.js → p-46c46067.entry.js} +1 -1
  6. package/dist/bn-template-engine/p-9caa7f46.entry.js +1 -0
  7. package/dist/bn-template-engine/p-B0MEAsAS.js +1 -0
  8. package/dist/bn-template-engine/{p-qpZjVnX5.js → p-BA-fydUt.js} +1 -1
  9. package/dist/bn-template-engine/p-BEGt_7Hr.js +1 -0
  10. package/dist/bn-template-engine/p-BRO1oW7m.js +1 -0
  11. package/dist/bn-template-engine/{p-DVE0-sOv.js → p-BnzIfgCq.js} +1 -1
  12. package/dist/bn-template-engine/{p-b0dfc113.entry.js → p-b0d528f2.entry.js} +1 -1
  13. package/dist/cjs/bn-annotation-layer_30.cjs.entry.js +608 -83
  14. package/dist/cjs/bn-grid.cjs.entry.js +161 -34
  15. package/dist/cjs/bn-image.cjs.entry.js +2 -2
  16. package/dist/cjs/bn-internationalization.cjs.entry.js +2 -2
  17. package/dist/cjs/bn-ruleset.cjs.entry.js +2 -2
  18. package/dist/cjs/bn-template-engine.cjs.js +1 -1
  19. package/dist/cjs/bn-text.cjs.entry.js +3 -3
  20. package/dist/cjs/loader.cjs.js +1 -1
  21. package/dist/cjs/{localFrame-U3Qs0psw.js → localFrame-C27GGom1.js} +1 -1
  22. package/dist/cjs/{withBodyObserver-S-FGHpAX.js → withBodyObserver-B78wzw3f.js} +1 -1
  23. package/dist/cjs/{withHasError-BkBrsCpI.js → withHasError-0hW3-4mr.js} +11 -5
  24. package/dist/cjs/{withStyled-BZb6snOx.js → withStyled-D0hrcfE_.js} +25 -1
  25. package/dist/cjs/{withTranslation-1qTs5Fi7.js → withTranslation-B4WipL_5.js} +2 -2
  26. package/dist/collection/components/bn-annotation-layer/bn-annotation-layer.js +33 -2
  27. package/dist/collection/components/bn-chart-structure/bn-chart-structure.js +112 -16
  28. package/dist/collection/components/bn-chart-structure/utils/StructureChart.js +1 -1
  29. package/dist/collection/components/bn-chart-structure/utils/elements/Needle.js +3 -3
  30. package/dist/collection/components/bn-chart-time/bn-chart-time-renderer/bn-chart-time-renderer.js +113 -3
  31. package/dist/collection/components/bn-chart-time/bn-chart-time.js +261 -22
  32. package/dist/collection/components/bn-chart-time/utils/TimeChart.js +221 -12
  33. package/dist/collection/components/bn-chart-time/utils/elements/Axis.js +9 -1
  34. package/dist/collection/components/bn-chart-time/utils/elements/Column.js +10 -4
  35. package/dist/collection/components/bn-chart-time/utils/elements/Needle.js +9 -3
  36. package/dist/collection/components/bn-chart-time/utils/factories/ScenarioFactory.js +2 -2
  37. package/dist/collection/components/bn-chart-time/utils/model/DataPoint.js +9 -6
  38. package/dist/collection/components/bn-chart-time/utils/model/TimeChartComponentConfig.js +15 -0
  39. package/dist/collection/components/bn-grid/bn-grid.js +118 -24
  40. package/dist/collection/components/bn-grid/utils/cellLayout.js +55 -9
  41. package/dist/collection/components/bn-layout-card/bn-layout-card.js +4 -2
  42. package/dist/collection/components/bn-layout-page/bn-layout-page.js +23 -1
  43. package/dist/collection/components/bn-title/bn-title-renderer/bn-title-renderer.css +10 -0
  44. package/dist/collection/components/bn-title/bn-title-renderer/bn-title-renderer.js +23 -1
  45. package/dist/collection/components/bn-title/bn-title.js +40 -2
  46. package/dist/collection/stores/componentStyles.js +9 -3
  47. package/dist/collection/stores/internationalization.js +2 -2
  48. package/dist/collection/utils/DateStringFactory.js +19 -0
  49. package/dist/collection/utils/model/DataFormatDigits.js +4 -2
  50. package/dist/collection/utils/model/VarianceScenario.js +13 -0
  51. package/dist/collection/utils/validate.js +4 -0
  52. package/dist/components/bn-annotation-layer.js +1 -1
  53. package/dist/components/bn-annotation-list.js +1 -1
  54. package/dist/components/bn-asset.js +1 -1
  55. package/dist/components/bn-body.js +1 -1
  56. package/dist/components/bn-card.js +1 -1
  57. package/dist/components/bn-chart-bubble-renderer.js +1 -1
  58. package/dist/components/bn-chart-bubble.js +1 -1
  59. package/dist/components/bn-chart-bullet-renderer.js +1 -1
  60. package/dist/components/bn-chart-bullet.js +1 -1
  61. package/dist/components/bn-chart-scatter-renderer.js +1 -1
  62. package/dist/components/bn-chart-scatter.js +1 -1
  63. package/dist/components/bn-chart-structure-renderer.js +1 -1
  64. package/dist/components/bn-chart-structure.js +1 -1
  65. package/dist/components/bn-chart-time-renderer.js +1 -1
  66. package/dist/components/bn-chart-time.js +1 -1
  67. package/dist/components/bn-component-style.js +1 -1
  68. package/dist/components/bn-context.js +1 -1
  69. package/dist/components/bn-dataset.js +1 -1
  70. package/dist/components/bn-datasource.js +1 -1
  71. package/dist/components/bn-footer.js +1 -1
  72. package/dist/components/bn-grid.js +1 -1
  73. package/dist/components/bn-image.js +1 -1
  74. package/dist/components/bn-internationalization.js +1 -1
  75. package/dist/components/bn-layout-card.js +1 -1
  76. package/dist/components/bn-layout-page.js +1 -1
  77. package/dist/components/bn-message.js +1 -1
  78. package/dist/components/bn-page.js +1 -1
  79. package/dist/components/bn-ruleset.js +1 -1
  80. package/dist/components/bn-scaling-group.js +1 -1
  81. package/dist/components/bn-table-renderer.js +1 -1
  82. package/dist/components/bn-table.js +1 -1
  83. package/dist/components/bn-text.js +1 -1
  84. package/dist/components/bn-title-renderer.js +1 -1
  85. package/dist/components/bn-title.js +1 -1
  86. package/dist/components/bn-tree.js +1 -1
  87. package/dist/components/p-9X5fVJqR.js +1 -0
  88. package/dist/components/p-B5GRtTLX.js +1 -0
  89. package/dist/components/{p-DJUffGeB.js → p-BKA15uoz.js} +1 -1
  90. package/dist/components/p-BKLq0Pbv.js +1 -0
  91. package/dist/components/p-BKTBdrEA.js +1 -0
  92. package/dist/components/p-Bd8cQiLx.js +1 -0
  93. package/dist/components/{p-CvEdUq8i.js → p-Be0Q3bvf.js} +1 -1
  94. package/dist/components/{p-xIWChKGS.js → p-Bj3RWsEx.js} +1 -1
  95. package/dist/components/{p-B4L069XF.js → p-BoBamuPt.js} +1 -1
  96. package/dist/components/{p-DaOm9YwQ.js → p-BrJZUp-K.js} +1 -1
  97. package/dist/components/{p-CyfGkLMh.js → p-BuWNCnvR.js} +1 -1
  98. package/dist/components/{p-M2k_I8lv.js → p-CFVoK5Rb.js} +1 -1
  99. package/dist/components/{p-fKJx8WtW.js → p-CgJB5mCu.js} +1 -1
  100. package/dist/components/p-Cxx0YNnl.js +1 -0
  101. package/dist/components/p-D9F5IBFT.js +1 -0
  102. package/dist/components/{p-BfUdaxZ9.js → p-DQFahsnV.js} +1 -1
  103. package/dist/components/p-DROj8gke.js +1 -0
  104. package/dist/components/p-D_Sbhd0L.js +1 -0
  105. package/dist/components/{p-Cel0a6ma.js → p-DbWh9W5D.js} +1 -1
  106. package/dist/components/{p-2eicD9rF.js → p-DkCeSWKR.js} +1 -1
  107. package/dist/components/{p-7ieJFBUk.js → p-DoOSXntC.js} +1 -1
  108. package/dist/components/p-Dxj_pf8s.js +1 -0
  109. package/dist/components/{p-DQl2K2Xl.js → p-DzYhS_9s.js} +1 -1
  110. package/dist/components/{p-B2bvM2Ig.js → p-EQNS13GN.js} +1 -1
  111. package/dist/components/{p-Y9bth2Y_.js → p-G56USTsQ.js} +1 -1
  112. package/dist/components/p-OgFFKehL.js +1 -0
  113. package/dist/components/{p-C2ycO60j.js → p-kvYRImZT.js} +1 -1
  114. package/dist/components/{p-Chuj-LpI.js → p-rEdNIgD8.js} +1 -1
  115. package/dist/components/{p-DwuXVo2h.js → p-uCpFBDF5.js} +1 -1
  116. package/dist/esm/bn-annotation-layer_30.entry.js +608 -83
  117. package/dist/esm/bn-grid.entry.js +161 -34
  118. package/dist/esm/bn-image.entry.js +2 -2
  119. package/dist/esm/bn-internationalization.entry.js +2 -2
  120. package/dist/esm/bn-ruleset.entry.js +2 -2
  121. package/dist/esm/bn-template-engine.js +1 -1
  122. package/dist/esm/bn-text.entry.js +3 -3
  123. package/dist/esm/loader.js +1 -1
  124. package/dist/esm/{localFrame-BNWPPaQa.js → localFrame-CEZ7-hBs.js} +1 -1
  125. package/dist/esm/{withBodyObserver-AHQAUV85.js → withBodyObserver-D9yIMxdr.js} +1 -1
  126. package/dist/esm/{withHasError-B6Lvj9Cq.js → withHasError-UGtkLrYT.js} +11 -5
  127. package/dist/esm/{withStyled-CzzXg64f.js → withStyled-BlMqEIfr.js} +25 -2
  128. package/dist/esm/{withTranslation-C1gL7wSU.js → withTranslation-Bc3bjHTb.js} +2 -2
  129. package/dist/schemas/theme.schema.json +18 -0
  130. package/dist/types/components/bn-annotation-layer/bn-annotation-layer.d.ts +11 -0
  131. package/dist/types/components/bn-chart-structure/bn-chart-structure.d.ts +16 -0
  132. package/dist/types/components/bn-chart-structure/utils/elements/Needle.d.ts +2 -1
  133. package/dist/types/components/bn-chart-time/bn-chart-time-renderer/bn-chart-time-renderer.d.ts +8 -0
  134. package/dist/types/components/bn-chart-time/bn-chart-time.d.ts +46 -1
  135. package/dist/types/components/bn-chart-time/utils/TimeChart.d.ts +37 -0
  136. package/dist/types/components/bn-chart-time/utils/elements/Axis.d.ts +2 -0
  137. package/dist/types/components/bn-chart-time/utils/elements/Needle.d.ts +2 -1
  138. package/dist/types/components/bn-chart-time/utils/factories/ScenarioFactory.d.ts +1 -1
  139. package/dist/types/components/bn-chart-time/utils/model/DataPoint.d.ts +6 -1
  140. package/dist/types/components/bn-chart-time/utils/model/TimeChartComponentConfig.d.ts +6 -0
  141. package/dist/types/components/bn-grid/bn-grid.d.ts +23 -0
  142. package/dist/types/components/bn-grid/utils/cellLayout.d.ts +39 -3
  143. package/dist/types/components/bn-layout-card/bn-layout-card.d.ts +3 -1
  144. package/dist/types/components/bn-layout-page/bn-layout-page.d.ts +9 -0
  145. package/dist/types/components/bn-title/bn-title-renderer/bn-title-renderer.d.ts +2 -0
  146. package/dist/types/components/bn-title/bn-title.d.ts +10 -0
  147. package/dist/types/components.d.ts +173 -6
  148. package/dist/types/stores/componentStyles.d.ts +8 -0
  149. package/dist/types/utils/DateStringFactory.d.ts +4 -0
  150. package/dist/types/utils/layoutState/types.d.ts +3 -0
  151. package/dist/types/utils/model/VarianceScenario.d.ts +2 -0
  152. package/dist/types/utils/validate.d.ts +2 -0
  153. package/package.json +1 -1
  154. package/dist/bn-template-engine/p-1b002bd5.entry.js +0 -1
  155. package/dist/bn-template-engine/p-750b2c82.entry.js +0 -1
  156. package/dist/bn-template-engine/p-D0tNATZq.js +0 -1
  157. package/dist/bn-template-engine/p-DF9sfwBN.js +0 -1
  158. package/dist/bn-template-engine/p-EcC0qLtU.js +0 -1
  159. package/dist/components/p-1B_s8oPY.js +0 -1
  160. package/dist/components/p-AwH1w8Mu.js +0 -1
  161. package/dist/components/p-BiSytXUy.js +0 -1
  162. package/dist/components/p-C3gYq-HU.js +0 -1
  163. package/dist/components/p-CEf5X8MZ.js +0 -1
  164. package/dist/components/p-CniN8ALm.js +0 -1
  165. package/dist/components/p-D40Am1Ap.js +0 -1
  166. package/dist/components/p-DDvWTgk1.js +0 -1
  167. package/dist/components/p-DjPWZfry.js +0 -1
  168. package/dist/components/p-DnDL1pPc.js +0 -1
  169. package/dist/components/p-sLbQ7yZ1.js +0 -1
@@ -5,7 +5,7 @@ import { withStyled } from "../../utils/styled/withStyled";
5
5
  import withComponentStyle from "../../utils/withComponentStyle";
6
6
  import withHasError from "../../utils/withHasError";
7
7
  import { parseGridConfig, getSlotName, validateHeadersJson } from "./utils/GridConfig";
8
- import { ALIGN, baselineOffsets, CELL_SIZES, HORIZONTAL_ALIGNS, JUSTIFY, parseCaptions, sameOffsets, VERTICAL_ALIGNS, } from "./utils/cellLayout";
8
+ import { ALIGN, baselineOffsets, CELL_SIZES, HORIZONTAL_ALIGNS, JUSTIFY, parseCaptions, parseSpan, placeCells, sameOffsets, VERTICAL_ALIGNS, } from "./utils/cellLayout";
9
9
  /** Elements in a slot that show nothing, so they are not what a cell aligns on. */
10
10
  const CONFIG_ELEMENTS = new Set([
11
11
  "bn-asset",
@@ -27,6 +27,8 @@ const FRAME_OFFSET_PROPERTIES = {
27
27
  left: "--bn-baseline-offset-left",
28
28
  right: "--bn-baseline-offset-right",
29
29
  };
30
+ /** Attributes of a slotted child that shape its cell. */
31
+ const CELL_ATTRIBUTES = ["row-span", "column-span", "cell-background"];
30
32
  /** A pass that keeps changing the offsets stops after this many: a component whose baseline follows its width could chase it. */
31
33
  const MAX_ADJUSTMENTS = 5;
32
34
  /**
@@ -36,6 +38,18 @@ const MAX_ADJUSTMENTS = 5;
36
38
  * Supports configurable borders, title, and header visibility. Cells can
37
39
  * have equal sizes, a caption, and aligned content; `baseline` lines up the
38
40
  * axes of charts (and the header of tables) in a row or column.
41
+ *
42
+ * The slotted child of a cell can carry `row-span` and `column-span` (whole
43
+ * numbers, default 1): its cell then also takes the positions right of it and
44
+ * below it, and those positions get no cell. `cell-background` on the child
45
+ * is the background colour of its cell.
46
+ *
47
+ * @example
48
+ * <bn-grid row-headers='["a","b"]' column-headers='["x","y"]'>
49
+ * <div slot="0-0" row-span="2" cell-background="#f2f2f2">...</div>
50
+ * <div slot="0-1">...</div>
51
+ * <div slot="1-1">...</div>
52
+ * </bn-grid>
39
53
  */
40
54
  export class Grid {
41
55
  validateRowHeaders(newValue) {
@@ -105,6 +119,10 @@ export class Grid {
105
119
  this.captions = {};
106
120
  /** Per slot: how far the baseline pass moved the content. */
107
121
  this.offsets = {};
122
+ /** Per slot: span and background from the slotted child. Only cells that set one of them. */
123
+ this.cellAttributes = {};
124
+ /** The data cells of the last render, row by row. */
125
+ this.placed = [];
108
126
  /** Per slot: the frame around its component, from the last baseline pass. */
109
127
  this.frames = new Map();
110
128
  this.observed = new WeakSet();
@@ -213,15 +231,21 @@ export class Grid {
213
231
  this.observed = new WeakSet();
214
232
  this.resizeObserver = new ResizeObserver(this.schedule);
215
233
  // a child can be added, moved to another slot or replaced, in a morphing preview for example
216
- this.mutationObserver = new MutationObserver(this.schedule);
234
+ this.mutationObserver = new MutationObserver(() => {
235
+ this.readCellAttributes();
236
+ this.checkCoveredSlots();
237
+ this.schedule();
238
+ });
217
239
  this.mutationObserver.observe(this.element, {
218
240
  childList: true,
219
241
  subtree: true,
220
242
  attributes: true,
221
- attributeFilter: ["slot"],
243
+ attributeFilter: ["slot", ...CELL_ATTRIBUTES],
222
244
  });
223
245
  // a caption in a late web font changes its height
224
246
  (_a = document.fonts) === null || _a === void 0 ? void 0 : _a.addEventListener("loadingdone", this.schedule);
247
+ // a change made while the grid was detached reached no observer
248
+ this.readCellAttributes();
225
249
  }
226
250
  disconnectedCallback() {
227
251
  var _a, _b, _c;
@@ -250,6 +274,68 @@ export class Grid {
250
274
  });
251
275
  return fallback;
252
276
  }
277
+ /** Reads the span and the background of every cell from its slotted child. */
278
+ readCellAttributes() {
279
+ const next = {};
280
+ const invalid = [];
281
+ for (const child of Array.from(this.element.children)) {
282
+ const slot = child.getAttribute("slot");
283
+ if (slot === null)
284
+ continue;
285
+ const span = (attribute) => {
286
+ const value = parseSpan(child.getAttribute(attribute));
287
+ if (value === undefined)
288
+ invalid.push(`${attribute} of slot "${slot}"`);
289
+ return value !== null && value !== void 0 ? value : 1;
290
+ };
291
+ const cell = { rowSpan: span("row-span"), columnSpan: span("column-span") };
292
+ const background = child.getAttribute("cell-background");
293
+ if (background)
294
+ cell.background = background;
295
+ if (cell.rowSpan > 1 || cell.columnSpan > 1 || cell.background)
296
+ next[slot] = cell;
297
+ }
298
+ if (invalid.length > 0) {
299
+ this.errors.addOrReplace({
300
+ id: "ERR_cellSpan",
301
+ type: "error",
302
+ message: `${invalid.join(", ")}: not a whole number from 1.`,
303
+ });
304
+ }
305
+ else {
306
+ this.errors.remove("ERR_cellSpan");
307
+ }
308
+ if (JSON.stringify(next) !== JSON.stringify(this.cellAttributes))
309
+ this.cellAttributes = next;
310
+ }
311
+ /** Places the data cells. */
312
+ placeDataCells() {
313
+ const { rows, columns } = this.gridConfig;
314
+ const slotAt = (row, column) => getSlotName(rows[row], columns[column]);
315
+ const { cells } = placeCells(rows.length, columns.length, (row, column) => this.cellAttributes[slotAt(row, column)]);
316
+ this.placed = cells.map((cell) => (Object.assign(Object.assign({}, cell), { slot: slotAt(cell.row, cell.column) })));
317
+ this.checkCoveredSlots();
318
+ }
319
+ /** Warns about a child in a position that a span covers. A new child changes no state, so the observer calls this too. */
320
+ checkCoveredSlots() {
321
+ var _a;
322
+ const { rows, columns } = (_a = this.gridConfig) !== null && _a !== void 0 ? _a : { rows: [], columns: [] };
323
+ const slotAt = (row, column) => getSlotName(rows[row], columns[column]);
324
+ const { covered } = placeCells(rows.length, columns.length, (row, column) => this.cellAttributes[slotAt(row, column)]);
325
+ const slotted = new Set(Array.from(this.element.children).map((child) => child.getAttribute("slot")));
326
+ const hidden = covered.filter(({ row, column }) => slotted.has(slotAt(row, column)));
327
+ if (hidden.length > 0) {
328
+ const list = hidden.map(({ row, column, by }) => `"${slotAt(row, column)}" (covered by "${slotAt(by.row, by.column)}")`);
329
+ this.errors.addOrReplace({
330
+ id: "WARN_cellSpan",
331
+ type: "warning",
332
+ message: `a span covers the slot ${list.join(", ")}: its content is not shown.`,
333
+ });
334
+ }
335
+ else {
336
+ this.errors.remove("WARN_cellSpan");
337
+ }
338
+ }
253
339
  isBaselineMode() {
254
340
  return this.resolvedVertical === "baseline" || this.resolvedHorizontal === "baseline";
255
341
  }
@@ -283,8 +369,7 @@ export class Grid {
283
369
  const run = ++this.run;
284
370
  if (!this.element.isConnected || !this.isBaselineMode())
285
371
  return;
286
- const { rows, columns } = this.gridConfig;
287
- const slots = rows.flatMap((row, rowIndex) => columns.map((column, columnIndex) => ({ slot: getSlotName(row, column), row: rowIndex, column: columnIndex })));
372
+ const slots = this.placed;
288
373
  const contents = slots.map(({ slot }) => this.contentIn(slot));
289
374
  const visuals = contents.map((content) => content.visual);
290
375
  await Promise.all(visuals.map((visual) => { var _a; return (_a = visual === null || visual === void 0 ? void 0 : visual.componentOnReady) === null || _a === void 0 ? void 0 : _a.call(visual); }));
@@ -303,16 +388,22 @@ export class Grid {
303
388
  });
304
389
  this.frames = new Map();
305
390
  contents.forEach(({ frame }, index) => frame && this.frames.set(slots[index].slot, frame));
306
- const cells = slots.map(({ slot, row, column }, index) => {
391
+ const cells = slots.map(({ slot, row, column, rowSpan, columnSpan }, index) => {
307
392
  const visual = visuals[index];
308
393
  const baseline = baselines[index];
309
394
  // what is drawn now, not what is in the state: a render can still be pending
310
395
  const cardFrame = contents[index].frame;
311
396
  const holder = cardFrame !== null && cardFrame !== void 0 ? cardFrame : wrappers.get(slot);
312
397
  const applied = (property) => parseFloat((holder === null || holder === void 0 ? void 0 : holder.style.getPropertyValue(property)) || "0") || 0;
313
- const cell = cardFrame
314
- ? { slot, row, column, top: applied(FRAME_OFFSET_PROPERTIES.top), left: applied(FRAME_OFFSET_PROPERTIES.left) }
315
- : { slot, row, column, top: applied("padding-top"), left: applied("margin-left") };
398
+ const cell = {
399
+ slot,
400
+ row,
401
+ column,
402
+ rowSpan,
403
+ columnSpan,
404
+ top: applied(cardFrame ? FRAME_OFFSET_PROPERTIES.top : "padding-top"),
405
+ left: applied(cardFrame ? FRAME_OFFSET_PROPERTIES.left : "margin-left"),
406
+ };
316
407
  if (visual) {
317
408
  const box = frame.toLocal(visual.getBoundingClientRect());
318
409
  if (baseline.y !== undefined)
@@ -389,7 +480,7 @@ export class Grid {
389
480
  title: this.chartTitle || undefined,
390
481
  rowCount: rows.length,
391
482
  columnCount: columns.length,
392
- cellCount: rows.length * columns.length,
483
+ cellCount: this.placed.length,
393
484
  },
394
485
  diagnostics: readDiagnostics(this.element),
395
486
  };
@@ -423,17 +514,11 @@ export class Grid {
423
514
  rect: measure(header, origins),
424
515
  });
425
516
  });
426
- // Data cells render row-major (see renderDataCells), so index i maps to
427
- // row i / columns.length, column i % columns.length.
517
+ // Data cells render in the order of this.placed (see renderDataCells).
428
518
  container.querySelectorAll(".grid-cell").forEach((cell, index) => {
429
519
  var _a, _b, _c, _d;
430
- push({
431
- kind: "gridCell",
432
- rowId: columns.length > 0 ? (_a = rows[Math.floor(index / columns.length)]) === null || _a === void 0 ? void 0 : _a.id : undefined,
433
- columnId: columns.length > 0 ? (_b = columns[index % columns.length]) === null || _b === void 0 ? void 0 : _b.id : undefined,
434
- slot: (_d = (_c = cell.querySelector("slot")) === null || _c === void 0 ? void 0 : _c.getAttribute("name")) !== null && _d !== void 0 ? _d : undefined,
435
- rect: measure(cell, origins),
436
- });
520
+ const placed = this.placed[index];
521
+ push(Object.assign(Object.assign(Object.assign({ kind: "gridCell", rowId: placed ? (_a = rows[placed.row]) === null || _a === void 0 ? void 0 : _a.id : undefined, columnId: placed ? (_b = columns[placed.column]) === null || _b === void 0 ? void 0 : _b.id : undefined, slot: (_d = (_c = cell.querySelector("slot")) === null || _c === void 0 ? void 0 : _c.getAttribute("name")) !== null && _d !== void 0 ? _d : undefined }, ((placed === null || placed === void 0 ? void 0 : placed.rowSpan) > 1 ? { rowSpan: placed.rowSpan } : {})), ((placed === null || placed === void 0 ? void 0 : placed.columnSpan) > 1 ? { columnSpan: placed.columnSpan } : {})), { rect: measure(cell, origins) }));
437
522
  });
438
523
  container.querySelectorAll(".grid-caption").forEach((caption) => {
439
524
  var _a, _b, _c, _d;
@@ -461,6 +546,10 @@ export class Grid {
461
546
  this.validateCellVerticalAlign(this.cellVerticalAlign);
462
547
  this.validateCellHorizontalAlign(this.cellHorizontalAlign);
463
548
  this.validateCellCaptions(this.cellCaptions);
549
+ this.readCellAttributes();
550
+ }
551
+ componentWillRender() {
552
+ this.placeDataCells();
464
553
  }
465
554
  updateGridConfig() {
466
555
  this.gridConfig = parseGridConfig(this.rowHeaders, this.columnHeaders);
@@ -539,6 +628,7 @@ export class Grid {
539
628
  const startCol = this.shouldShowRowHeaders() ? 2 : 1;
540
629
  const startRow = (this.chartTitle ? 1 : 0) + (this.shouldShowColumnHeaders() ? 1 : 0) + 1;
541
630
  const cells = [];
631
+ const track = (start, span) => (span > 1 ? `${start} / span ${span}` : String(start));
542
632
  if (this.gridConfig.rows.length > 0 && this.gridConfig.columns.length > 0) {
543
633
  this.gridConfig.rows.forEach((row, rowIndex) => {
544
634
  // Render row header for this row
@@ -553,11 +643,14 @@ export class Grid {
553
643
  } }, row.label));
554
644
  }
555
645
  // Render data cells for this row
556
- this.gridConfig.columns.forEach((col, colIndex) => {
557
- const slotName = getSlotName(row, col);
646
+ const placed = this.placed.filter((cell) => cell.row === rowIndex);
647
+ placed.forEach(({ slot: slotName, column: colIndex, rowSpan, columnSpan }) => {
648
+ var _a, _b;
558
649
  const isNotFirstCol = colIndex > 0;
559
650
  const isNotFirstRow = rowIndex > 0;
560
- cells.push(h("div", { key: `cell-${slotName}`, class: "grid-cell", "data-bn-fit-content": "", style: Object.assign({ "grid-column": String(startCol + colIndex), "grid-row": String(startRow + rowIndex), "border-left": isNotFirstCol ? borderStyle : "none", "border-top": isNotFirstRow ? borderStyle : "none", "padding-left": isNotFirstCol ? `${style.cellPadding + 4}px` : "0", "padding-top": isNotFirstRow ? `${style.cellPadding + 4}px` : "0" }, this.cellAlignStyle()) }, this.renderCellContent(slotName, style)));
651
+ // the cell of the child wins over the style
652
+ const background = (_b = (_a = this.cellAttributes[slotName]) === null || _a === void 0 ? void 0 : _a.background) !== null && _b !== void 0 ? _b : (style.cellBackground && style.cellBackground !== "transparent" ? style.cellBackground : undefined);
653
+ cells.push(h("div", { key: `cell-${slotName}`, class: "grid-cell", "data-bn-fit-content": "", style: Object.assign(Object.assign({ "grid-column": track(startCol + colIndex, columnSpan), "grid-row": track(startRow + rowIndex, rowSpan), "border-left": isNotFirstCol ? borderStyle : "none", "border-top": isNotFirstRow ? borderStyle : "none", "padding-left": isNotFirstCol ? `${style.cellPadding + 4}px` : "0", "padding-top": isNotFirstRow ? `${style.cellPadding + 4}px` : "0" }, this.cellAlignStyle()), (background ? { "background-color": background } : {})) }, this.renderCellContent(slotName, style)));
561
654
  });
562
655
  });
563
656
  }
@@ -639,7 +732,7 @@ export class Grid {
639
732
  // would only be as wide as their content, and charts measure that width.
640
733
  const fill = this.resolvedWidth === "equal";
641
734
  const gridContainerStyle = Object.assign(Object.assign({ display: fill ? "grid" : "inline-grid" }, (fill ? { width: "100%" } : {})), { "grid-template-columns": this.getGridTemplateColumns(), "grid-template-rows": this.getGridTemplateRows(), gap: this.cellGap });
642
- return (h(Host, { key: 'df0d9a7bacea1a58c3280db1c8bff5d79c21fd9b', style: fill ? Object.assign(Object.assign({}, this.getFontStyles()), { display: "block" }) : this.getFontStyles() }, h("div", { key: '63007962f57a49273ad2670d17bcc0035532f303', class: "grid-container", style: gridContainerStyle }, this.renderTitle(), this.renderColumnHeaders(), this.renderDataCells()), h("slot", { key: '877653c214c2c888079753b6ab2a0e8a8daab59e' })));
735
+ return (h(Host, { key: '97d858fb6f5704dfd46638c8e5c6a74927e702e0', style: fill ? Object.assign(Object.assign({}, this.getFontStyles()), { display: "block" }) : this.getFontStyles() }, h("div", { key: '1e218eac5865574fcb4572d1aaea60f1d87d8948', class: "grid-container", style: gridContainerStyle }, this.renderTitle(), this.renderColumnHeaders(), this.renderDataCells()), h("slot", { key: 'aabefa01213c69c0303f1df06f5575973253677e' })));
643
736
  }
644
737
  static get is() { return "bn-grid"; }
645
738
  static get encapsulation() { return "shadow"; }
@@ -963,7 +1056,8 @@ export class Grid {
963
1056
  "resolvedVertical": {},
964
1057
  "resolvedHorizontal": {},
965
1058
  "captions": {},
966
- "offsets": {}
1059
+ "offsets": {},
1060
+ "cellAttributes": {}
967
1061
  };
968
1062
  }
969
1063
  static get methods() {
@@ -1,6 +1,6 @@
1
1
  /**
2
- * Cell size and alignment for bn-grid: the accepted values, their CSS, and
3
- * the offsets that line up the baselines of the components in a row or column.
2
+ * Cell size, span and alignment for bn-grid: the accepted values, their CSS,
3
+ * and the offsets that line up the baselines of the components in a row or column.
4
4
  */
5
5
  export const CELL_SIZES = ["auto", "equal"];
6
6
  export const VERTICAL_ALIGNS = ["top", "center", "bottom", "baseline"];
@@ -44,21 +44,67 @@ export function parseCaptions(json) {
44
44
  }
45
45
  return captions;
46
46
  }
47
+ /** The value of `row-span` or `column-span`: a whole number from 1. `undefined` when invalid. */
48
+ export function parseSpan(value) {
49
+ if (value === null || value.trim() === "")
50
+ return 1;
51
+ const span = Number(value);
52
+ return Number.isInteger(span) && span >= 1 ? span : undefined;
53
+ }
54
+ /**
55
+ * The data cells of a grid, row by row. A cell with a span also takes the
56
+ * positions right of it and below it, and those get no cell of their own. A
57
+ * span ends at the edge of the grid, and before a position that is taken.
58
+ */
59
+ export function placeCells(rowCount, columnCount, spanOf) {
60
+ var _a, _b;
61
+ const owner = Array.from({ length: rowCount }, () => Array(columnCount));
62
+ const cells = [];
63
+ const covered = [];
64
+ for (let row = 0; row < rowCount; row++) {
65
+ for (let column = 0; column < columnCount; column++) {
66
+ const by = owner[row][column];
67
+ if (by) {
68
+ covered.push({ row, column, by });
69
+ continue;
70
+ }
71
+ const span = spanOf(row, column);
72
+ const rowSpan = Math.min((_a = span === null || span === void 0 ? void 0 : span.rowSpan) !== null && _a !== void 0 ? _a : 1, rowCount - row);
73
+ let columnSpan = 1;
74
+ const wanted = Math.min((_b = span === null || span === void 0 ? void 0 : span.columnSpan) !== null && _b !== void 0 ? _b : 1, columnCount - column);
75
+ // a taken position in this row is taken by a cell from above, so the rows below need no check
76
+ while (columnSpan < wanted && !owner[row][column + columnSpan])
77
+ columnSpan++;
78
+ const cell = { row, column, rowSpan, columnSpan };
79
+ for (let r = row; r < row + rowSpan; r++) {
80
+ for (let c = column; c < column + columnSpan; c++)
81
+ owner[r][c] = cell;
82
+ }
83
+ cells.push(cell);
84
+ }
85
+ }
86
+ return { cells, covered };
87
+ }
47
88
  const round2 = (value) => Math.round(value * 100) / 100;
48
89
  /**
49
90
  * Offsets that put every baseline of a row on the lowest one, and every
50
91
  * baseline of a column on the rightmost one. A cell without a baseline on an
51
- * axis goes to the bottom (vertical) or stays left (horizontal).
92
+ * axis goes to the bottom (vertical) or stays left (horizontal). A cell over
93
+ * several rows is left out of the rows and stays at the top; a cell over
94
+ * several columns is left out of the columns and stays left.
52
95
  */
53
96
  export function baselineOffsets(cells, vertical, horizontal) {
54
97
  const offsets = {};
55
98
  for (const cell of cells)
56
99
  offsets[cell.slot] = {};
57
- const line = (key, value, applied, set) => {
58
- var _a;
100
+ const line = (key, span, value, applied, set) => {
101
+ var _a, _b;
59
102
  const groups = new Map();
60
- for (const cell of cells)
61
- groups.set(cell[key], [...((_a = groups.get(cell[key])) !== null && _a !== void 0 ? _a : []), cell]);
103
+ for (const cell of cells) {
104
+ if (((_a = cell[span]) !== null && _a !== void 0 ? _a : 1) > 1)
105
+ continue;
106
+ groups.set(cell[key], [...((_b = groups.get(cell[key])) !== null && _b !== void 0 ? _b : []), cell]);
107
+ }
62
108
  for (const group of groups.values()) {
63
109
  // where each baseline would be without an offset
64
110
  const natural = group.map((cell) => {
@@ -73,7 +119,7 @@ export function baselineOffsets(cells, vertical, horizontal) {
73
119
  }
74
120
  };
75
121
  if (vertical) {
76
- line("row", (cell) => cell.y, (cell) => cell.top, (offset, pad) => {
122
+ line("row", "rowSpan", (cell) => cell.y, (cell) => cell.top, (offset, pad) => {
77
123
  if (pad === undefined)
78
124
  offset.bottom = true;
79
125
  else
@@ -81,7 +127,7 @@ export function baselineOffsets(cells, vertical, horizontal) {
81
127
  });
82
128
  }
83
129
  if (horizontal) {
84
- line("column", (cell) => cell.x, (cell) => cell.left, (offset, pad, largest) => {
130
+ line("column", "columnSpan", (cell) => cell.x, (cell) => cell.left, (offset, pad, largest) => {
85
131
  if (pad !== undefined)
86
132
  offset.left = pad;
87
133
  const right = round2(largest - (pad !== null && pad !== void 0 ? pad : 0));
@@ -1,6 +1,7 @@
1
1
  import { h, Fragment } from "@stencil/core";
2
2
  import { getStores } from "../../context/context-protocol";
3
3
  import withComponentStatus from "../../utils/withComponentStatus";
4
+ import withComponentStyle from "../../utils/withComponentStyle";
4
5
  import withHasError from "../../utils/withHasError";
5
6
  import withInheritedProps from "../../utils/withInheritedProps";
6
7
  import { CUSTOM_TEMPLATE, templateAreas, templateColumns, templateProblem, templateRows, templateSlotNames, } from "../../utils/layoutTemplate";
@@ -118,6 +119,7 @@ export class LayoutCard {
118
119
  this.cardShowBorder = true;
119
120
  withComponentStatus(this);
120
121
  this.errors = withHasError(this);
122
+ this.componentStyle = withComponentStyle(this);
121
123
  this.resolveInherited = withInheritedProps(this, [
122
124
  { propName: "titleScenarios", ancestorAttr: "title-scenarios" },
123
125
  { propName: "titleVariances", ancestorAttr: "title-variances" },
@@ -221,7 +223,7 @@ export class LayoutCard {
221
223
  var _a;
222
224
  const style = this.getLayoutStyle();
223
225
  const arrOfSlots = this.extractSlotNames(style["grid-template-areas"]);
224
- return (h("bn-card", { key: 'f9d135554b1ab8a8bee9bb4f7084e465e495e180', styles: this.styles, "selected-style": this.selectedStyle, class: this.setCardClass() }, h("div", { key: '54766941aa09df561453f620bd2ecd16f9fd3526', class: "cardtitle" }, h("bn-title", { key: 'ce2dc7bd84943a6b97068441d9da85a150271227', "i18n-namespace": (_a = this.i18nNamespace) !== null && _a !== void 0 ? _a : this.titleNamespace, ruleset: this.titleProp("ruleset"), "business-unit": this.titleBusinessUnit, scenarios: this.titleProp("titleScenarios"), variances: this.titleProp("titleVariances"), order: this.titleProp("titleOrder"), "order-direction": this.titleProp("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: 'b692bf5149c7c34288b612b7179779030ef2031c' }, h("div", { key: '2650ddbbae89f6e63fdeba3f65513446eb22a96f', style: style, "data-bn-fit-content": this.cardFitToContent ? String(this.getRowCount(this.cardLayout)) : null }, this.getSlots(arrOfSlots))), h("bn-footer", { key: 'd924118be1d48c4f80b8e6d39f90aa1e2b3a1ff2', text: this.footerText, "page-number": "0", "display-page-number": "false" })));
226
+ return (h("bn-card", { key: '3db479047905de01ac517491f2d68a9bd0a3a576', styles: this.styles, "selected-style": this.selectedStyle, class: this.setCardClass() }, h("div", { key: 'fd9948acd84ce55badf87a7e03d733d1e75a1bea', class: "cardtitle" }, h("bn-title", { key: '21200c96fb03d403fa616b093d753ea4b746c6f2', "i18n-namespace": (_a = this.i18nNamespace) !== null && _a !== void 0 ? _a : this.titleNamespace, ruleset: this.titleProp("ruleset"), "title-font-size": this.componentStyle(($) => { var _a; return (_a = $ === null || $ === void 0 ? void 0 : $["bn-layout-card"]) === null || _a === void 0 ? void 0 : _a.titleFontSize; }), "business-unit": this.titleBusinessUnit, scenarios: this.titleProp("titleScenarios"), variances: this.titleProp("titleVariances"), order: this.titleProp("titleOrder"), "order-direction": this.titleProp("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: 'c5b1957822ff216d33084154afdf6deb3e4426cc' }, h("div", { key: 'bc17f6f73825894641f775137eaefd5059a25cf6', style: style, "data-bn-fit-content": this.cardFitToContent ? String(this.getRowCount(this.cardLayout)) : null }, this.getSlots(arrOfSlots))), h("bn-footer", { key: 'cfbeba76eaf11358e92002d309cafae19d2525e2', text: this.footerText, "page-number": "0", "display-page-number": "false" })));
225
227
  }
226
228
  static get is() { return "bn-layout-card"; }
227
229
  static get encapsulation() { return "shadow"; }
@@ -268,7 +270,7 @@ export class LayoutCard {
268
270
  "optional": true,
269
271
  "docs": {
270
272
  "tags": [],
271
- "text": "Name of a registered component style (see `bn-component-style`) passed\nthrough to the inner `<bn-card>` element as its `selected-style`\nattribute."
273
+ "text": "Name of a registered component style (see `bn-component-style`) passed\nthrough to the inner `<bn-card>` element as its `selected-style`\nattribute. Its section `bn-layout-card` sets the font size of the title\n(`titleFontSize`, in px)."
272
274
  },
273
275
  "getter": false,
274
276
  "setter": false,
@@ -230,7 +230,7 @@ export class LayoutPage {
230
230
  const style = this.getLayoutStyle();
231
231
  const arrOfSlots = this.extractSlotNames(style["grid-template-areas"]);
232
232
  const rotation = this.rotation();
233
- return (h(Host, { key: '290e6e8250c5f8bf53352886a810eeedd7548e57', style: rotation === null || rotation === void 0 ? void 0 : rotation.host }, h("bn-page", { key: '71b472107af79e9581e2097aae33c6b2808decbf', styles: this.styles, "selected-style": this.selectedStyle, format: this.pageFormat, orientation: this.pageOrientation, style: rotation === null || rotation === void 0 ? void 0 : rotation.page }, h("bn-message", { key: '99ac5c760476f95ff296077736849e6ddfd85120', text: this.messageText, image: this.messageImage }), h("bn-title", { key: '3af5ee4a7be905676a927397ff19cf062b291fb6', "i18n-namespace": (_a = this.i18nNamespace) !== null && _a !== void 0 ? _a : this.titleNamespace, ruleset: this.ruleset, "business-unit": this.titleBusinessUnit, scenarios: this.titleScenarios, variances: this.titleVariances, order: this.titleOrder, "order-direction": this.titleOrderDirection, measures: this.titleMeasures, "date-start": this.titleDateStart, "date-end": this.titleDateEnd, "date-format": this.titleDateFormat, "date-link": this.titleDateLink }), h("bn-body", { key: 'c91e9c708934499b855fe9e321bebb7aed31ab7c' }, h("div", { key: '92d01a4bad8ae401e570fcee4a9bbdac42b31d81', style: style, "data-bn-fit-content": this.pageFitToContent ? String(this.getRowCount(this.pageLayout)) : null }, this.getSlots(arrOfSlots)), h("slot", { key: 'ac227c5985b827e91d139396915e3a104e44710b', name: "annotations" })), h("bn-footer", { key: '41dfc75b74a158a0e7cdb05456b03ae62cf6d6db', text: this.footerText, "page-number": this.pageNumber, "display-page-number": this.footerDisplayPageNumber }))));
233
+ return (h(Host, { key: '2ec4b279578c40e0aa56ec89ede269abb4d2951b', style: rotation === null || rotation === void 0 ? void 0 : rotation.host }, h("bn-page", { key: 'fae96a429fad331f28fdf69e5036e6857db866c6', styles: this.styles, "selected-style": this.selectedStyle, format: this.pageFormat, orientation: this.pageOrientation, style: rotation === null || rotation === void 0 ? void 0 : rotation.page }, h("bn-message", { key: '17e10377a10a257417acc50460cc2a66e1010abd', text: this.messageText, image: this.messageImage }), h("bn-title", { key: '3149bfdb60c2782c65a3c956fe15d291b2748327', "i18n-namespace": (_a = this.i18nNamespace) !== null && _a !== void 0 ? _a : this.titleNamespace, ruleset: this.ruleset, "title-id": this.titleId, "business-unit": this.titleBusinessUnit, scenarios: this.titleScenarios, variances: this.titleVariances, order: this.titleOrder, "order-direction": this.titleOrderDirection, measures: this.titleMeasures, "date-start": this.titleDateStart, "date-end": this.titleDateEnd, "date-format": this.titleDateFormat, "date-link": this.titleDateLink }), h("bn-body", { key: '8ef72077b8656469db320af429a1226453866558' }, h("div", { key: '99b22034f2c6edbe7e25e1a3cb6873f2af287178', style: style, "data-bn-fit-content": this.pageFitToContent ? String(this.getRowCount(this.pageLayout)) : null }, this.getSlots(arrOfSlots)), h("slot", { key: '918b8f2c8991d801a0033748f37250500cf2d2e9', name: "annotations" })), h("bn-footer", { key: 'a77e27405f7fbc68c90a95c563628ddc2d708e02', text: this.footerText, "page-number": this.pageNumber, "display-page-number": this.footerDisplayPageNumber }))));
234
234
  }
235
235
  static get is() { return "bn-layout-page"; }
236
236
  static get encapsulation() { return "shadow"; }
@@ -349,6 +349,28 @@ export class LayoutPage {
349
349
  "attribute": "message-image",
350
350
  "defaultValue": "\"\""
351
351
  },
352
+ "titleId": {
353
+ "type": "string",
354
+ "mutable": false,
355
+ "complexType": {
356
+ "original": "string",
357
+ "resolved": "string",
358
+ "references": {}
359
+ },
360
+ "required": false,
361
+ "optional": true,
362
+ "docs": {
363
+ "tags": [{
364
+ "name": "example",
365
+ "text": "<bn-layout-page title-id=\"13A\"></bn-layout-page>"
366
+ }],
367
+ "text": "Short id of the page, a template number like `13A`. Shown at the top\nright of the title, on the level of its first line, in the font of the\ntitle and not bold. If empty, nothing is shown."
368
+ },
369
+ "getter": false,
370
+ "setter": false,
371
+ "reflect": false,
372
+ "attribute": "title-id"
373
+ },
352
374
  "titleBusinessUnit": {
353
375
  "type": "string",
354
376
  "mutable": false,
@@ -9,6 +9,16 @@
9
9
  font-weight: bold;
10
10
  }
11
11
 
12
+ .with-id {
13
+ display: flow-root;
14
+ }
15
+
16
+ .title-id {
17
+ float: right;
18
+ margin-left: 1em;
19
+ font-weight: normal;
20
+ }
21
+
12
22
  div {
13
23
  background-color: var(--bn-font-background, white);
14
24
  color: var(--bn-font-color, black);
@@ -38,7 +38,7 @@ export class BnTitleRenderer {
38
38
  withComponentStatus(this);
39
39
  }
40
40
  render() {
41
- return (h("div", { key: 'ecc33a660538732ceea3e4620afabfcb8ffbce95' }, h("div", { key: 'cb1c3b074817a4c0647419fdc0f2b94c113ebc09', innerHTML: sanitizeHtml(this.title.unit) }), h("div", { key: '92b6ef66f67d33bd3bff6a760d1fc1bee605105d' }, this.title.measures.map((measure, index) => (h("span", null, this.isFirstElement(index) ? this.title.i18n.get("SEPARATOR_WS") : "", h("span", { class: "measure" }, measure.name), " ", measure.unit ? this.title.i18n.get("in") : "", " ", measure.unit)))), h("div", { key: '74cc33e0e63592e5422b3c0e5c7a52715210c486' }, this.title.dimension)));
41
+ return (h("div", { key: 'd32015c18f77cc23ace9a26d8bb0820acdce543a', class: this.titleId ? "with-id" : undefined }, this.titleId ? h("div", { class: "title-id" }, this.titleId) : null, h("div", { key: 'c3151be4218ff1720402865ffa4b972c974fea67', innerHTML: sanitizeHtml(this.title.unit) }), h("div", { key: '0a03e44bd5ec8d0177801bce8d1cf938a24daabb' }, this.title.measures.map((measure, index) => (h("span", null, this.isFirstElement(index) ? this.title.i18n.get("SEPARATOR_WS") : "", h("span", { class: "measure" }, measure.name), " ", measure.unit ? this.title.i18n.get("in") : "", " ", measure.unit)))), h("div", { key: 'ab32e07b35e1cc02ec26137ce392946c8f94ac73' }, this.title.dimension)));
42
42
  }
43
43
  componentWillLoad() {
44
44
  const config = this.prepareConfig();
@@ -339,6 +339,28 @@ export class BnTitleRenderer {
339
339
  },
340
340
  "getter": false,
341
341
  "setter": false
342
+ },
343
+ "titleId": {
344
+ "type": "string",
345
+ "mutable": false,
346
+ "complexType": {
347
+ "original": "string",
348
+ "resolved": "string",
349
+ "references": {}
350
+ },
351
+ "required": false,
352
+ "optional": true,
353
+ "docs": {
354
+ "tags": [{
355
+ "name": "internal",
356
+ "text": undefined
357
+ }],
358
+ "text": ""
359
+ },
360
+ "getter": false,
361
+ "setter": false,
362
+ "reflect": false,
363
+ "attribute": "title-id"
342
364
  }
343
365
  };
344
366
  }
@@ -299,7 +299,7 @@ export class Title {
299
299
  var _a, _b, _c, _d;
300
300
  return ({
301
301
  "--bn-font-family": ((_a = $["global"]) === null || _a === void 0 ? void 0 : _a["fontFamily"]) || "'Noto Sans', sans-serif",
302
- "--bn-font-size": `${((_b = $["global"]) === null || _b === void 0 ? void 0 : _b["fontSizePx"]) || 13.3333}px`,
302
+ "--bn-font-size": `${this.titleFontSize > 0 ? this.titleFontSize : ((_b = $["global"]) === null || _b === void 0 ? void 0 : _b["fontSizePx"]) || 13.3333}px`,
303
303
  "--bn-font-color": ((_c = $["global"]) === null || _c === void 0 ? void 0 : _c["fontColor"]) || "#000000",
304
304
  "--bn-font-background": ((_d = $["global"]) === null || _d === void 0 ? void 0 : _d["fontBackgroundColor"]) || "#ffffff",
305
305
  });
@@ -307,7 +307,7 @@ export class Title {
307
307
  }
308
308
  render() {
309
309
  const fontStyles = this.getFontStyles();
310
- return (h(Host, { key: '3fab16c08a9023801ce8d6cf2bea9a87945fd1d0', style: fontStyles }, h("bn-title-renderer", { key: '056569256646abf17f0aaf4151f5add7065439a4', businessUnit: this.prepareBusinessUnit(), scenarios: this.prepareScenarios(), measures: this.prepareMeasures(), timeperiod: this.prepareTitleTimePeriod(), order: this.prepareTitleOrder(), i18n: this.prepareI18n(), "i18n-mode": this.prepareI18nMode(), locale: this.prepareLocale(), ruleSetConfig: this.ruleSetConfig() })));
310
+ return (h(Host, { key: '2f19926cf90c8e8738c335088f6d814be7221f05', style: fontStyles }, h("bn-title-renderer", { key: '85c4a3985352920a9eddfa166479fbde7d114971', businessUnit: this.prepareBusinessUnit(), scenarios: this.prepareScenarios(), measures: this.prepareMeasures(), timeperiod: this.prepareTitleTimePeriod(), order: this.prepareTitleOrder(), i18n: this.prepareI18n(), "i18n-mode": this.prepareI18nMode(), locale: this.prepareLocale(), ruleSetConfig: this.ruleSetConfig(), titleId: this.titleId || undefined })));
311
311
  }
312
312
  static get is() { return "bn-title"; }
313
313
  static get encapsulation() { return "shadow"; }
@@ -380,6 +380,44 @@ export class Title {
380
380
  "reflect": true,
381
381
  "attribute": "ruleset"
382
382
  },
383
+ "titleFontSize": {
384
+ "type": "number",
385
+ "mutable": false,
386
+ "complexType": {
387
+ "original": "number",
388
+ "resolved": "number",
389
+ "references": {}
390
+ },
391
+ "required": false,
392
+ "optional": true,
393
+ "docs": {
394
+ "tags": [],
395
+ "text": "Font size of the title in px. Without it the title has the font size of\nthe style (`global.fontSizePx`)."
396
+ },
397
+ "getter": false,
398
+ "setter": false,
399
+ "reflect": false,
400
+ "attribute": "title-font-size"
401
+ },
402
+ "titleId": {
403
+ "type": "string",
404
+ "mutable": false,
405
+ "complexType": {
406
+ "original": "string",
407
+ "resolved": "string",
408
+ "references": {}
409
+ },
410
+ "required": false,
411
+ "optional": true,
412
+ "docs": {
413
+ "tags": [],
414
+ "text": "Short id of the report, a template number like `13A`. Shown at the top\nright, on the level of the first title line. Without it nothing is shown."
415
+ },
416
+ "getter": false,
417
+ "setter": false,
418
+ "reflect": false,
419
+ "attribute": "title-id"
420
+ },
383
421
  "businessUnit": {
384
422
  "type": "string",
385
423
  "mutable": false,
@@ -171,18 +171,23 @@ export const SYSTEM_STYLE_DEFAULTS = {
171
171
  borderColor: "#A6A6A6",
172
172
  borderWidth: 1,
173
173
  cellPadding: 4,
174
+ cellBackground: "transparent",
174
175
  captionFontSize: 12,
175
176
  captionFontWeight: "bold",
176
177
  captionColor: "#000000",
177
178
  captionGap: 2,
178
179
  },
180
+ "bn-layout-card": {},
179
181
  "bn-annotation": {
180
182
  color: "#0070c0",
181
183
  colors: { negative: "#ff0000", positive: "#008f96" },
182
184
  },
183
185
  };
184
- /** `bn-text` keys. All are optional, so the defaults do not list them. */
185
- const TEXT_STYLE_KEYS = ["fontFamily", "fontSizePx", "fontColor", "fontBackgroundColor", "leading"];
186
+ /** Keys that are optional, so the defaults do not list them. */
187
+ const OPTIONAL_KEYS = {
188
+ "bn-text": ["fontFamily", "fontSizePx", "fontColor", "fontBackgroundColor", "leading"],
189
+ "bn-layout-card": ["titleFontSize"],
190
+ };
186
191
  // The keys of these groups are checked too. The style groups (`axisStyles.ac`, ...) are not: their keys differ per scenario.
187
192
  const CHECKED_GROUPS = ["scaleFactors", "padding"];
188
193
  const isPlainObject = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
@@ -192,6 +197,7 @@ const isPlainObject = (value) => value !== null && typeof value === "object" &&
192
197
  * when the style is applied, so a typo would otherwise go unnoticed.
193
198
  */
194
199
  export function unknownStyleKeys(style) {
200
+ var _a;
195
201
  const unknown = [];
196
202
  if (!isPlainObject(style)) {
197
203
  return unknown;
@@ -205,7 +211,7 @@ export function unknownStyleKeys(style) {
205
211
  if (!isPlainObject(value)) {
206
212
  continue;
207
213
  }
208
- const sectionKeys = section === "bn-text" ? TEXT_STYLE_KEYS : Object.keys(defaults[section]);
214
+ const sectionKeys = [...Object.keys(defaults[section]), ...((_a = OPTIONAL_KEYS[section]) !== null && _a !== void 0 ? _a : [])];
209
215
  for (const [key, group] of Object.entries(value)) {
210
216
  if (!sectionKeys.includes(key)) {
211
217
  unknown.push(`${section}.${key}`);
@@ -109,7 +109,7 @@ const de = flattenObject({
109
109
  CONNECTOR_WS: " und ",
110
110
  in: "in",
111
111
  },
112
- "bn-chart-time": { "no-data": "Keine Daten" },
112
+ "bn-chart-time": { "no-data": "Keine Daten", "date-format-short-year": "yy" },
113
113
  "bn-chart-structure": { "no-data": "Keine Daten", REST: "REST" },
114
114
  "bn-chart-scatter": Object.assign(Object.assign({}, xyChartKeysDe), { "xy-iso-domain": "Iso-Linien benötigen einen strikt positiven Wertebereich auf beiden Achsen; übersprungen." }),
115
115
  "bn-chart-bubble": Object.assign(Object.assign({}, xyChartKeysDe), { legend: Object.assign(Object.assign({}, xyChartKeysDe.legend), { size: "Größe", compare: "Szenarien" }), "xy-compare-variance": "compareWith kann nicht mit Varianz-Kennzahlen auf den Achsen kombiniert werden.", "bubble-size-negative": "{{count}} Blase(n) mit negativem Größenwert ausgeschlossen.", "bubble-share-range": "{{count}} Anteilswert(e) außerhalb [0,1] wurden begrenzt.", "bubble-scale-group-unknown": "size.group '{{group}}' verweist auf keine bn-scaling-group im Kontext.", "bubble-scale-overflow": "{{count}} gruppenskalierte Blase(n) überschreiten das Panel; in Originalgröße gezeichnet." }),
@@ -169,7 +169,7 @@ const en = flattenObject({
169
169
  CONNECTOR_WS: " and ",
170
170
  in: "in",
171
171
  },
172
- "bn-chart-time": { "no-data": "No Data" },
172
+ "bn-chart-time": { "no-data": "No Data", "date-format-short-year": "yy" },
173
173
  "bn-chart-structure": { "no-data": "No Data", REST: "REST" },
174
174
  "bn-chart-scatter": Object.assign(Object.assign({}, xyChartKeysEn), { "xy-iso-domain": "Iso-lines need a strictly positive domain on both axes; skipped." }),
175
175
  "bn-chart-bubble": Object.assign(Object.assign({}, xyChartKeysEn), { legend: Object.assign(Object.assign({}, xyChartKeysEn.legend), { size: "Size", compare: "Scenarios" }), "xy-compare-variance": "compareWith cannot be combined with variance measures on the axes.", "bubble-size-negative": "{{count}} bubble(s) with a negative size value excluded.", "bubble-share-range": "{{count}} share value(s) outside [0,1] were clamped.", "bubble-scale-group-unknown": "size.group '{{group}}' names no bn-scaling-group in scope.", "bubble-scale-overflow": "{{count}} group-scaled bubble(s) exceed the panel; rendered true-size." }),