@bino-bi/bn-template-engine 1.0.0-next.32 → 1.0.0-next.34

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 (112) hide show
  1. package/dist/bn-template-engine/bn-template-engine.esm.js +1 -1
  2. package/dist/bn-template-engine/p-66ed6259.entry.js +1 -0
  3. package/dist/bn-template-engine/p-789bfd06.entry.js +1 -0
  4. package/dist/bn-template-engine/{p-BTbeDWM9.js → p-CAvWZ3a5.js} +1 -1
  5. package/dist/bn-template-engine/p-_SKPuKfK.js +1 -0
  6. package/dist/bn-template-engine/p-dc12ff1b.entry.js +1 -0
  7. package/dist/bn-template-engine/p-dec6837c.entry.js +1 -0
  8. package/dist/cjs/bn-annotation-layer_30.cjs.entry.js +76 -28
  9. package/dist/cjs/bn-grid.cjs.entry.js +52 -15
  10. package/dist/cjs/bn-image.cjs.entry.js +1 -1
  11. package/dist/cjs/bn-text.cjs.entry.js +2 -2
  12. package/dist/cjs/{withStyled-Ds3e64Nz.js → withStyled-eHD8Yt2K.js} +6 -1
  13. package/dist/cjs/{withTranslation-Cjvvs3gL.js → withTranslation-yJ-j0lsu.js} +1 -1
  14. package/dist/collection/components/bn-chart-structure/bn-chart-structure.js +2 -2
  15. package/dist/collection/components/bn-chart-structure/utils/model/DataPoint.js +5 -2
  16. package/dist/collection/components/bn-chart-time/bn-chart-time.js +2 -2
  17. package/dist/collection/components/bn-chart-time/utils/model/DataPoint.js +5 -2
  18. package/dist/collection/components/bn-grid/bn-grid.js +51 -14
  19. package/dist/collection/components/bn-layout-card/bn-layout-card.css +8 -0
  20. package/dist/collection/components/bn-layout-card/bn-layout-card.js +2 -2
  21. package/dist/collection/components/bn-layout-page/bn-layout-page.js +2 -2
  22. package/dist/collection/components/bn-table/bn-table-renderer/bn-table-renderer.js +1 -1
  23. package/dist/collection/components/bn-table/bn-table.js +2 -2
  24. package/dist/collection/components/bn-table/utils/factories/tableDataSetFactory.js +23 -6
  25. package/dist/collection/components/bn-table/utils/helper/DataQuery.js +15 -6
  26. package/dist/collection/components/bn-title/bn-title.js +2 -2
  27. package/dist/collection/utils/constants.js +5 -0
  28. package/dist/collection/utils/model/VarianceScenario.js +21 -2
  29. package/dist/collection/utils/xy/VarianceMeasure.js +1 -1
  30. package/dist/components/bn-chart-bubble-renderer.js +1 -1
  31. package/dist/components/bn-chart-bubble.js +1 -1
  32. package/dist/components/bn-chart-bullet-renderer.js +1 -1
  33. package/dist/components/bn-chart-bullet.js +1 -1
  34. package/dist/components/bn-chart-scatter-renderer.js +1 -1
  35. package/dist/components/bn-chart-scatter.js +1 -1
  36. package/dist/components/bn-chart-structure-renderer.js +1 -1
  37. package/dist/components/bn-chart-structure.js +1 -1
  38. package/dist/components/bn-chart-time-renderer.js +1 -1
  39. package/dist/components/bn-chart-time.js +1 -1
  40. package/dist/components/bn-grid.js +1 -1
  41. package/dist/components/bn-image.js +1 -1
  42. package/dist/components/bn-layout-card.js +1 -1
  43. package/dist/components/bn-layout-page.js +1 -1
  44. package/dist/components/bn-page.js +1 -1
  45. package/dist/components/bn-table-renderer.js +1 -1
  46. package/dist/components/bn-table.js +1 -1
  47. package/dist/components/bn-text.js +1 -1
  48. package/dist/components/bn-title-renderer.js +1 -1
  49. package/dist/components/bn-title.js +1 -1
  50. package/dist/components/bn-tree.js +1 -1
  51. package/dist/components/{p-0gehv1XG.js → p-4BanAktr.js} +1 -1
  52. package/dist/components/{p-BoUkFdpu.js → p-B3F_c9GB.js} +1 -1
  53. package/dist/components/{p-CtBM3KFY.js → p-B4pmO5QQ.js} +1 -1
  54. package/dist/components/{p-DyO09Jk6.js → p-B7UDMyar.js} +1 -1
  55. package/dist/components/{p-CxPSvrcF.js → p-BNWZoAip.js} +1 -1
  56. package/dist/components/p-BT2WH_CP.js +1 -0
  57. package/dist/components/{p-BPJsmv3o.js → p-BVnYDfb8.js} +1 -1
  58. package/dist/components/p-BWRE5w0i.js +1 -0
  59. package/dist/components/{p-DPLcGhVt.js → p-BXt0ers2.js} +1 -1
  60. package/dist/components/{p-BpCL2bfw.js → p-BldMZbAf.js} +1 -1
  61. package/dist/components/p-BtH2oezK.js +1 -0
  62. package/dist/components/{p-CMM8vtHW.js → p-C-oNdJj9.js} +1 -1
  63. package/dist/components/{p-D5-dYgK_.js → p-CJtE8Pyr.js} +1 -1
  64. package/dist/components/p-CLkpoHdg.js +1 -0
  65. package/dist/components/{p-z56_ZQ42.js → p-CPC9Vkmg.js} +1 -1
  66. package/dist/components/p-CYqHwYgQ.js +1 -0
  67. package/dist/components/{p-DYG9FH_u.js → p-CYv_8LrR.js} +1 -1
  68. package/dist/components/p-Ckl1aEvn.js +1 -0
  69. package/dist/components/p-D5LDmR4u.js +1 -0
  70. package/dist/components/{p-COqIkH1M.js → p-DHAoxu6M.js} +1 -1
  71. package/dist/components/{p-DdGnuNtc.js → p-DLLljAll.js} +1 -1
  72. package/dist/components/p-DdG2Ylar.js +1 -0
  73. package/dist/components/{p-LZ9lAY8T.js → p-Dn3DJxQQ.js} +1 -1
  74. package/dist/components/{p-BohXdw3-.js → p-GrpYAVHb.js} +1 -1
  75. package/dist/components/p-M6hn0BuZ.js +1 -0
  76. package/dist/components/{p-Dlb4ncGF.js → p-VIw66ez1.js} +1 -1
  77. package/dist/components/p-nHZ8466v.js +1 -0
  78. package/dist/esm/bn-annotation-layer_30.entry.js +76 -28
  79. package/dist/esm/bn-grid.entry.js +52 -15
  80. package/dist/esm/bn-image.entry.js +1 -1
  81. package/dist/esm/bn-text.entry.js +2 -2
  82. package/dist/esm/{withStyled-B-cbWCe2.js → withStyled-Cxua0iTP.js} +6 -1
  83. package/dist/esm/{withTranslation-_8q-7Y9C.js → withTranslation-BeAbw2--.js} +1 -1
  84. package/dist/types/components/bn-chart-structure/bn-chart-structure.d.ts +1 -0
  85. package/dist/types/components/bn-chart-time/bn-chart-time.d.ts +4 -1
  86. package/dist/types/components/bn-grid/bn-grid.d.ts +6 -2
  87. package/dist/types/components/bn-layout-card/bn-layout-card.d.ts +4 -3
  88. package/dist/types/components/bn-layout-page/bn-layout-page.d.ts +4 -3
  89. package/dist/types/components/bn-table/bn-table.d.ts +4 -1
  90. package/dist/types/components/bn-table/utils/elements/Cell.d.ts +2 -0
  91. package/dist/types/components/bn-table/utils/factories/tableDataSetFactory.d.ts +4 -0
  92. package/dist/types/components/bn-table/utils/helper/DataQuery.d.ts +3 -3
  93. package/dist/types/components/bn-title/bn-title.d.ts +1 -1
  94. package/dist/types/components.d.ts +12 -12
  95. package/dist/types/utils/constants.d.ts +6 -1
  96. package/dist/types/utils/model/VarianceScenario.d.ts +13 -1
  97. package/package.json +1 -1
  98. package/dist/bn-template-engine/p-225cd474.entry.js +0 -1
  99. package/dist/bn-template-engine/p-58b10778.entry.js +0 -1
  100. package/dist/bn-template-engine/p-9f3cbc5f.entry.js +0 -1
  101. package/dist/bn-template-engine/p-BjR3nkhl.js +0 -1
  102. package/dist/bn-template-engine/p-ce39e111.entry.js +0 -1
  103. package/dist/components/p-B2jqpOF9.js +0 -1
  104. package/dist/components/p-BQMKgvEC.js +0 -1
  105. package/dist/components/p-BpsXOtoW.js +0 -1
  106. package/dist/components/p-CDoSPw-I.js +0 -1
  107. package/dist/components/p-CujsXn-l.js +0 -1
  108. package/dist/components/p-D4FY_yoG.js +0 -1
  109. package/dist/components/p-oJjMz8JF.js +0 -1
  110. package/dist/components/p-xpguaboj.js +0 -1
  111. package/dist/components/p-yH-XxIy9.js +0 -1
  112. package/dist/components/p-zf8cTH63.js +0 -1
@@ -1151,7 +1151,7 @@ export class Chart {
1151
1151
  scenariosArray = [...scenariosArray, ...variancesArray];
1152
1152
  }
1153
1153
  const fontStyles = this.getFontStyles();
1154
- return (h(Host, { key: '959245cc54fe058c46e1c2ae07c454b52cf280bc', style: fontStyles }, h("div", { key: '8c2d94dd9192696388f2137a055aff013abfe0db', class: "container" }, scenariosArray.map(this.chartTemplate))));
1154
+ return (h(Host, { key: '37085b275bb92d716a31f79f15b9f2517f1c596b', style: fontStyles }, h("div", { key: '93e9eacc22334da1deed871db640d6fd4aafb153', class: "container" }, scenariosArray.map(this.chartTemplate))));
1155
1155
  }
1156
1156
  static get is() { return "bn-chart-time"; }
1157
1157
  static get encapsulation() { return "shadow"; }
@@ -1314,7 +1314,7 @@ export class Chart {
1314
1314
  "optional": false,
1315
1315
  "docs": {
1316
1316
  "tags": [],
1317
- "text": "List of Variance Map.\n<br /> <br />\n Variance chart can be added by seperating the scenarios\n of each chart with ```;```<br />\n The additonal variances which\n are calculated form the given scenarios.\n the scenarios used in the variances have also\n be defined in the *scenarios* property.\n<br /> <br />\n the variance is defiend as (Scenario A - ScenarioB)\n neu. neg and pos post fix defines which value is *good*\n a negative or a positive value.\n<br /> <br />\n if empty variance charts are hidden\n<br /> <br />\n each variance creates a chart\n<br /> <br />\n pattern:<br /> ```d<scenarioB>_<scenarioA>_[pos/neg/neu]```\n\n example: <br />```'dpp1_ac1_neg,dfc1_ac1_neg'```"
1317
+ "text": "List of Variance Map.\n<br /> <br />\n Variance chart can be added by seperating the scenarios\n of each chart with ```;```<br />\n The additonal variances which\n are calculated form the given scenarios.\n the scenarios used in the variances have also\n be defined in the *scenarios* property.\n<br /> <br />\n the variance is defiend as (Scenario A - ScenarioB)\n neu. neg and pos post fix defines which value is *good*\n a negative or a positive value.\n op and opinv are accepted for pages that share variances with\n tables. Chart values carry their operation sign, so op acts like pos\n and opinv like neg.\n<br /> <br />\n if empty variance charts are hidden\n<br /> <br />\n each variance creates a chart\n<br /> <br />\n pattern:<br /> ```d<scenarioB>_<scenarioA>_[pos/neg/neu/op/opinv]```\n\n example: <br />```'dpp1_ac1_neg,dfc1_ac1_neg'```"
1318
1318
  },
1319
1319
  "getter": false,
1320
1320
  "setter": false,
@@ -1,4 +1,5 @@
1
1
  import { Scenario } from "./index";
2
+ import { resolveSentiment } from "../../../../utils/model/VarianceScenario";
2
3
  /**
3
4
  * A single renderable data point in a time-series chart.
4
5
  *
@@ -14,10 +15,12 @@ export class DataPoint {
14
15
  this.value = value;
15
16
  this.scenario = scenario;
16
17
  this.pixelPerUnit = pixelPerUnit || 1;
17
- if (variance === "neg" || variance === Scenario.NEG) {
18
+ // chart values are signed by their operation, so op acts like pos and opinv like neg
19
+ const direction = typeof variance === "string" ? resolveSentiment(variance, null, true) : variance;
20
+ if (direction === "neg" || direction === Scenario.NEG) {
18
21
  this.variance = Scenario.NEG;
19
22
  }
20
- else if (variance === "pos" || variance === Scenario.POS) {
23
+ else if (direction === "pos" || direction === Scenario.POS) {
21
24
  this.variance = Scenario.POS;
22
25
  }
23
26
  else {
@@ -16,6 +16,17 @@ const CONFIG_ELEMENTS = new Set([
16
16
  "bn-ruleset",
17
17
  "bn-scaling-group",
18
18
  ]);
19
+ /**
20
+ * Frames around a component: a cell aligns on what is inside them, and moves
21
+ * the content inside the frame, so the title of the frame stays in place.
22
+ */
23
+ const FRAME_ELEMENTS = new Set(["bn-layout-card"]);
24
+ /** The CSS properties a frame reads to move its content, by offset side. */
25
+ const FRAME_OFFSET_PROPERTIES = {
26
+ top: "--bn-baseline-offset-top",
27
+ left: "--bn-baseline-offset-left",
28
+ right: "--bn-baseline-offset-right",
29
+ };
19
30
  /** A pass that keeps changing the offsets stops after this many: a component whose baseline follows its width could chase it. */
20
31
  const MAX_ADJUSTMENTS = 5;
21
32
  /**
@@ -94,6 +105,8 @@ export class Grid {
94
105
  this.captions = {};
95
106
  /** Per slot: how far the baseline pass moved the content. */
96
107
  this.offsets = {};
108
+ /** Per slot: the frame around its component, from the last baseline pass. */
109
+ this.frames = new Map();
97
110
  this.observed = new WeakSet();
98
111
  this.scheduled = false;
99
112
  this.run = 0;
@@ -175,6 +188,7 @@ export class Grid {
175
188
  this.run++;
176
189
  if (Object.keys(this.offsets).length > 0)
177
190
  this.offsets = {};
191
+ this.applyFrameOffsets();
178
192
  return;
179
193
  }
180
194
  if (this.scheduled)
@@ -239,16 +253,30 @@ export class Grid {
239
253
  isBaselineMode() {
240
254
  return this.resolvedVertical === "baseline" || this.resolvedHorizontal === "baseline";
241
255
  }
242
- /** The first visual component in a slot, or the slotted element itself. */
243
- visualIn(slot) {
244
- var _a;
256
+ /** The first visual component in a slot, or the slotted element itself, and the frame around it. */
257
+ contentIn(slot) {
245
258
  const slotted = Array.from(this.element.children).find((child) => child.getAttribute("slot") === slot);
246
259
  if (!slotted)
247
- return undefined;
248
- const isVisual = (el) => el.localName.startsWith("bn-") && !CONFIG_ELEMENTS.has(el.localName);
249
- if (isVisual(slotted))
250
- return slotted;
251
- return (_a = Array.from(slotted.querySelectorAll("*")).find(isVisual)) !== null && _a !== void 0 ? _a : undefined;
260
+ return {};
261
+ const all = [slotted, ...Array.from(slotted.querySelectorAll("*"))];
262
+ const visual = all.find((el) => el.localName.startsWith("bn-") && !CONFIG_ELEMENTS.has(el.localName) && !FRAME_ELEMENTS.has(el.localName));
263
+ const frame = visual
264
+ ? all.find((el) => FRAME_ELEMENTS.has(el.localName) && el.contains(visual))
265
+ : undefined;
266
+ return { visual, frame };
267
+ }
268
+ /** Writes the offsets of framed slots onto their frames, and removes them when a slot has none. */
269
+ applyFrameOffsets() {
270
+ this.frames.forEach((frame, slot) => {
271
+ const offset = this.offsets[slot];
272
+ Object.keys(FRAME_OFFSET_PROPERTIES).forEach((side) => {
273
+ const value = offset === null || offset === void 0 ? void 0 : offset[side];
274
+ if (value)
275
+ frame.style.setProperty(FRAME_OFFSET_PROPERTIES[side], `${value}px`);
276
+ else
277
+ frame.style.removeProperty(FRAME_OFFSET_PROPERTIES[side]);
278
+ });
279
+ });
252
280
  }
253
281
  async align() {
254
282
  var _a;
@@ -257,7 +285,8 @@ export class Grid {
257
285
  return;
258
286
  const { rows, columns } = this.gridConfig;
259
287
  const slots = rows.flatMap((row, rowIndex) => columns.map((column, columnIndex) => ({ slot: getSlotName(row, column), row: rowIndex, column: columnIndex })));
260
- const visuals = slots.map(({ slot }) => this.visualIn(slot));
288
+ const contents = slots.map(({ slot }) => this.contentIn(slot));
289
+ const visuals = contents.map((content) => content.visual);
261
290
  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); }));
262
291
  if (run !== this.run)
263
292
  return;
@@ -272,13 +301,18 @@ export class Grid {
272
301
  var _a;
273
302
  wrappers.set((_a = el.getAttribute("data-slot")) !== null && _a !== void 0 ? _a : "", el);
274
303
  });
304
+ this.frames = new Map();
305
+ contents.forEach(({ frame }, index) => frame && this.frames.set(slots[index].slot, frame));
275
306
  const cells = slots.map(({ slot, row, column }, index) => {
276
307
  const visual = visuals[index];
277
308
  const baseline = baselines[index];
278
309
  // what is drawn now, not what is in the state: a render can still be pending
279
- const wrapper = wrappers.get(slot);
280
- const applied = (property) => parseFloat((wrapper === null || wrapper === void 0 ? void 0 : wrapper.style.getPropertyValue(property)) || "0") || 0;
281
- const cell = { slot, row, column, top: applied("padding-top"), left: applied("margin-left") };
310
+ const cardFrame = contents[index].frame;
311
+ const holder = cardFrame !== null && cardFrame !== void 0 ? cardFrame : wrappers.get(slot);
312
+ 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") };
282
316
  if (visual) {
283
317
  const box = frame.toLocal(visual.getBoundingClientRect());
284
318
  if (baseline.y !== undefined)
@@ -301,6 +335,7 @@ export class Grid {
301
335
  }
302
336
  this.adjustments++;
303
337
  this.offsets = next;
338
+ this.applyFrameOffsets();
304
339
  // check once more after the new offsets are drawn; the status stays held until then
305
340
  this.schedule();
306
341
  }
@@ -545,6 +580,7 @@ export class Grid {
545
580
  * moves it onto the baseline. Without alignment the wrapper is a plain block.
546
581
  */
547
582
  renderCellContent(slotName, style) {
583
+ var _a;
548
584
  const text = this.captions[slotName];
549
585
  const caption = text !== undefined ? (h("div", { class: "grid-caption", style: {
550
586
  "font-size": `${style.captionFontSize}px`,
@@ -571,7 +607,8 @@ export class Grid {
571
607
  else if (this.resolvedVertical === "bottom") {
572
608
  wrapper["margin-top"] = "auto";
573
609
  }
574
- const offset = this.offsets[slotName];
610
+ // a frame moves its own content; the wrapper only moves a component without a frame
611
+ const offset = this.frames.has(slotName) ? { bottom: (_a = this.offsets[slotName]) === null || _a === void 0 ? void 0 : _a.bottom } : this.offsets[slotName];
575
612
  if (offset === null || offset === void 0 ? void 0 : offset.bottom)
576
613
  wrapper["margin-top"] = "auto";
577
614
  if (offset === null || offset === void 0 ? void 0 : offset.top)
@@ -602,7 +639,7 @@ export class Grid {
602
639
  // would only be as wide as their content, and charts measure that width.
603
640
  const fill = this.resolvedWidth === "equal";
604
641
  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 });
605
- return (h(Host, { key: '3fcfe5d215a02a65652c00e37a2873377b708043', style: fill ? Object.assign(Object.assign({}, this.getFontStyles()), { display: "block" }) : this.getFontStyles() }, h("div", { key: '55a2ae64a80a2f660601eaddbb5bd6e90e224796', class: "grid-container", style: gridContainerStyle }, this.renderTitle(), this.renderColumnHeaders(), this.renderDataCells()), h("slot", { key: '1c47b472d38b8e12a42e7f1609466681cdde98f3' })));
642
+ return (h(Host, { key: '643b4d675bac89c542618e7d6ec5f2c0ef8d6d6c', style: fill ? Object.assign(Object.assign({}, this.getFontStyles()), { display: "block" }) : this.getFontStyles() }, h("div", { key: '4bc671a6868b313c809f37aeb2f32ca30c7e9142', class: "grid-container", style: gridContainerStyle }, this.renderTitle(), this.renderColumnHeaders(), this.renderDataCells()), h("slot", { key: '5e66d95c65a0bad59d3816cf0009bb88fbe53f9c' })));
606
643
  }
607
644
  static get is() { return "bn-grid"; }
608
645
  static get encapsulation() { return "shadow"; }
@@ -1,4 +1,7 @@
1
1
  :host {
2
+ --bn-baseline-offset-top: 0px;
3
+ --bn-baseline-offset-left: 0px;
4
+ --bn-baseline-offset-right: 0px;
2
5
  background: var(--bn-font-background, white);
3
6
  color: var(--bn-font-color, black);
4
7
  font-family: var(--bn-font-family, "Noto Sans", sans-serif);
@@ -28,4 +31,9 @@
28
31
  height: 4em;
29
32
  width: auto;
30
33
  display: inline;
34
+ }
35
+
36
+ bn-body {
37
+ box-sizing: border-box;
38
+ padding: var(--bn-baseline-offset-top) var(--bn-baseline-offset-right) 0 var(--bn-baseline-offset-left);
31
39
  }
@@ -221,7 +221,7 @@ export class LayoutCard {
221
221
  var _a;
222
222
  const style = this.getLayoutStyle();
223
223
  const arrOfSlots = this.extractSlotNames(style["grid-template-areas"]);
224
- return (h("bn-card", { key: '867690c16715585ca9f879ac80e00c95cb37b577', styles: this.styles, "selected-style": this.selectedStyle, class: this.setCardClass() }, h("div", { key: 'c25c8e5aec46acebe38d6fac2a4516f41d25fe90', class: "cardtitle" }, h("bn-title", { key: '8a3da2a58cb7fb72fddcd838f27a1b231c2805e2', "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: 'c0616d184dce59190238ceb98ecd2828e65991af' }, h("div", { key: '42596bc88ddf38c2b820de17a69091df2e3c4227', style: style, "data-bn-fit-content": this.cardFitToContent ? String(this.getRowCount(this.cardLayout)) : null }, this.getSlots(arrOfSlots))), h("bn-footer", { key: 'ca29bc6d17eb385b3ded5fb46e0efe1ee228e405', text: this.footerText, "page-number": "0", "display-page-number": "false" })));
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" })));
225
225
  }
226
226
  static get is() { return "bn-layout-card"; }
227
227
  static get encapsulation() { return "shadow"; }
@@ -371,7 +371,7 @@ export class LayoutCard {
371
371
  "optional": true,
372
372
  "docs": {
373
373
  "tags": [],
374
- "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]```"
374
+ "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/op/opinv postfix defines\nwhich direction is considered \"good\". op follows the row operation\nin opt tables, opinv is its inverse.\n<br /><br />\nIf empty, variance indicators are hidden.\n<br /><br />\npattern:<br />\n```d<scenarioB>_<scenarioA>_[pos/neg/neu/op/opinv]```"
375
375
  },
376
376
  "getter": false,
377
377
  "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: 'a0553f8e1fcb8c16e5f1119adf3287f47431a032', style: rotation === null || rotation === void 0 ? void 0 : rotation.host }, h("bn-page", { key: 'f29c2a88180e49ebda60f858e82d3836be79c275', 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: '114f2a708fbd24a287870773450a7372417f966c', text: this.messageText, image: this.messageImage }), h("bn-title", { key: '0413e2645444d2410114bce588ab41aaf8c645ac', "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: '0ca2389cec30412f58995abc6ec5fb921895da8b' }, h("div", { key: 'a3718ddafecff39d38bf608b4e28f4bc04139c45', style: style, "data-bn-fit-content": this.pageFitToContent ? String(this.getRowCount(this.pageLayout)) : null }, this.getSlots(arrOfSlots)), h("slot", { key: '9e6a0d1077e33e95f4cba0398f62cf5579b52eb8', name: "annotations" })), h("bn-footer", { key: 'c19b05ac728b4a51e02c53903da2d436d72e19c5', text: this.footerText, "page-number": this.pageNumber, "display-page-number": this.footerDisplayPageNumber }))));
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 }))));
234
234
  }
235
235
  static get is() { return "bn-layout-page"; }
236
236
  static get encapsulation() { return "shadow"; }
@@ -403,7 +403,7 @@ export class LayoutPage {
403
403
  "optional": true,
404
404
  "docs": {
405
405
  "tags": [],
406
- "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]```"
406
+ "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/op/opinv postfix defines\nwhich direction is considered \"good\". op follows the row operation\nin opt tables, opinv is its inverse.\n<br /><br />\nIf empty, variance indicators are hidden.\n<br /><br />\npattern:<br />\n```d<scenarioB>_<scenarioA>_[pos/neg/neu/op/opinv]```"
407
407
  },
408
408
  "getter": false,
409
409
  "setter": false,
@@ -233,7 +233,7 @@ export class BnTableRenderer {
233
233
  : {})), cell.prefix != null ? (h("span", { class: cell.cssStyle + " " + cell.prefixStyle }, cell.drawPrefix())) : (""), cell.isBarChart &&
234
234
  cell.columnStats &&
235
235
  cell.value !== NOT_AVAILABLE &&
236
- (cell.waterfall !== undefined || row.type !== TableRowType.SUM) ? (cell.waterfall !== undefined ? (h(WaterfallBar, { value: cell.value, scenario: cell.key, columnStats: cell.columnStats, height: 18 * this.scaleFactor, isRelative: false, isPositiveGood: cell.key.endsWith("_pos"), measureScale: cell.measureScale, locale: locale, columnWidthEm: this.barColumnMaxWidth, styles: this.barChartStyles, waterfall: cell.waterfall })) : (h(CellBarChart, { value: cell.value, scenario: cell.key, columnStats: cell.columnStats, height: 18 * this.scaleFactor, isRelative: cell.key.startsWith("dr"), isPositiveGood: cell.key.endsWith("_pos"),
236
+ (cell.waterfall !== undefined || row.type !== TableRowType.SUM) ? (cell.waterfall !== undefined ? (h(WaterfallBar, { value: cell.value, scenario: cell.key, columnStats: cell.columnStats, height: 18 * this.scaleFactor, isRelative: false, isPositiveGood: cell.direction === "pos", measureScale: cell.measureScale, locale: locale, columnWidthEm: this.barColumnMaxWidth, styles: this.barChartStyles, waterfall: cell.waterfall })) : (h(CellBarChart, { value: cell.value, scenario: cell.key, columnStats: cell.columnStats, height: 18 * this.scaleFactor, isRelative: cell.key.startsWith("dr"), isPositiveGood: cell.direction === "pos",
237
237
  // percentage points: the fraction times 100, no measure scale
238
238
  measureScale: cell.type === "percentpoint" ? 0.01 : cell.measureScale, locale: locale, percentDigits: this.componentDataFormatDigits.percent, columnWidthEm: this.barColumnMaxWidth, styles: this.barChartStyles }))) : (cell.draw(this.componentDataFormatDigits, locale)))))))))));
239
239
  };
@@ -1330,7 +1330,7 @@ export class Table {
1330
1330
  render() {
1331
1331
  const fontStyles = this.getFontStyles();
1332
1332
  const effectiveFactor = this.getEffectiveScaleFactor();
1333
- return (h(Host, { key: '3110b347db709058dbdf329ac4fd0aaa8d72d2e2', style: fontStyles }, h("div", { key: 'e4dd33f91433c45b3ca185291f10286df88c0449' }, h("bn-table-renderer", { key: '02ad73dbe3c97320e97face0432ccf592c0265d0', tableName: this.datasetName, dataVersion: this.dataVersion, sumTitle: this.prepareSumTitle(), scenarios: this.prepareScenarios(), scenariosDataFormat: this.prepareDataFormat(), grouped: this.prepareGrouped(), limit: this.prepareLimit(), showGroupTitle: this.prepareShowGroupTitle(), thereof: this.prepareThereOf(), partof: this.preparePartOf(), order: this.prepareOrder(), categorythereof: this.prepareColumnThereOf(), attributeColumns: this.prepareAttributes(), type: this.prepareTableType(), categoryWidth: this.prepareCategoryWidth(), dataFormatDigits: this.prepareDataFormatDigits(), i18n: this.prepareI18n(), i18nMode: this.prepareI18nMode(), measureScale: this.prepareMeasureScale(), measureType: this.prepareMeasureType(), measureUnit: this.prepareMeasureUnit(), showMeasureScale: this.prepareShowMeasureScale(), filter: this.prepareFilter(), barColumns: this.prepareBarColumns(), interval: this.prepareInterval(), barColumnMaxWidth: this.prepareBarColumnWidth(), unitScaling: this.prepareUnitScaling(), percentageScaling: this.preparePercentageScaling(), reportAutoScaling: this.handleAutoScalingReport, errors: this.errors, scaleFactor: effectiveFactor, ruleSetConfig: this.ruleSetConfig(), selectedStyle: this.selectedStyle }))));
1333
+ return (h(Host, { key: '2c70b811354760fd12ac968f7ed3ace210b104a7', style: fontStyles }, h("div", { key: '992b077e5e627d067d1199d0ff8434d2216fa107' }, h("bn-table-renderer", { key: 'f765e647c7f3d303ba7297f54d9b3a387ed4c160', tableName: this.datasetName, dataVersion: this.dataVersion, sumTitle: this.prepareSumTitle(), scenarios: this.prepareScenarios(), scenariosDataFormat: this.prepareDataFormat(), grouped: this.prepareGrouped(), limit: this.prepareLimit(), showGroupTitle: this.prepareShowGroupTitle(), thereof: this.prepareThereOf(), partof: this.preparePartOf(), order: this.prepareOrder(), categorythereof: this.prepareColumnThereOf(), attributeColumns: this.prepareAttributes(), type: this.prepareTableType(), categoryWidth: this.prepareCategoryWidth(), dataFormatDigits: this.prepareDataFormatDigits(), i18n: this.prepareI18n(), i18nMode: this.prepareI18nMode(), measureScale: this.prepareMeasureScale(), measureType: this.prepareMeasureType(), measureUnit: this.prepareMeasureUnit(), showMeasureScale: this.prepareShowMeasureScale(), filter: this.prepareFilter(), barColumns: this.prepareBarColumns(), interval: this.prepareInterval(), barColumnMaxWidth: this.prepareBarColumnWidth(), unitScaling: this.prepareUnitScaling(), percentageScaling: this.preparePercentageScaling(), reportAutoScaling: this.handleAutoScalingReport, errors: this.errors, scaleFactor: effectiveFactor, ruleSetConfig: this.ruleSetConfig(), selectedStyle: this.selectedStyle }))));
1334
1334
  }
1335
1335
  static get is() { return "bn-table"; }
1336
1336
  static get encapsulation() { return "shadow"; }
@@ -1535,7 +1535,7 @@ export class Table {
1535
1535
  "optional": false,
1536
1536
  "docs": {
1537
1537
  "tags": [],
1538
- "text": "<br /> <br />\nList of Variances\nThe additonal variances which\nare calculated form the given scenarios.\nthe scenarios used in the variances have also\nbe defined in the *scenarios* property.\n<br /> <br />\nthe variance is defiend as (Scenario A - ScenarioB)\nneu. neg and pos post fix defines which value is *good*\na negative or a positive value.\n<br /> <br />\nif empty variance charts are hidden\n<br /> <br />\neach variance creates a chart\n<br /> <br />\npattern:<br /> ```d<scenarioB>_<scenarioA>_[pos/neg/neu]```"
1538
+ "text": "<br /> <br />\nList of Variances\nThe additonal variances which\nare calculated form the given scenarios.\nthe scenarios used in the variances have also\nbe defined in the *scenarios* property.\n<br /> <br />\nthe variance is defiend as (Scenario A - ScenarioB)\nneu. neg and pos post fix defines which value is *good*\na negative or a positive value.\nop follows the row operation: in an opt/optnototal table a \"-\" row\nacts like neg, \"+\" and sum rows act like pos (a rising cost is red).\nopinv is the inverse of op. In other table types op acts like pos.\n<br /> <br />\nif empty variance charts are hidden\n<br /> <br />\neach variance creates a chart\n<br /> <br />\npattern:<br /> ```d<scenarioB>_<scenarioA>_[pos/neg/neu/op/opinv]```"
1539
1539
  },
1540
1540
  "getter": false,
1541
1541
  "setter": false,
@@ -4,6 +4,7 @@ import { BLANK_BUCKET_LABEL, computeWaterfall, DataQuery, hasGroupingStructure,
4
4
  import { Formatter } from "../../../../utils";
5
5
  import { I18nMode, DataFormat, Scenarios } from "../../../../utils/constants";
6
6
  import { QueryColumnNames, VarianceScenario } from "../../../../utils/model";
7
+ import { resolveSentiment } from "../../../../utils/model/VarianceScenario";
7
8
  import { NOT_AVAILABLE } from "../../../../utils/relativeVariance";
8
9
  import { styleSlot } from "../../../../utils/ibcsRuleSet";
9
10
  import { pointDate } from "../../../../utils/layoutState/dataPoint";
@@ -27,6 +28,8 @@ export class TableDataSetFactory {
27
28
  this.hasBlankRowGroup = false;
28
29
  /** The interval columns stand for dates, so a cell of one has a date. */
29
30
  this.dateBuckets = false;
31
+ /** opt/optnototal tables show entry values without their operation sign. */
32
+ this.unsignedEntries = false;
30
33
  }
31
34
  /** The underline class of a scenario column: the one of the style slot its colorIndex selects. */
32
35
  underlineClass(type) {
@@ -158,6 +161,7 @@ export class TableDataSetFactory {
158
161
  let iGroupIndex = -1; // index used in detailRow JSON to count the current group
159
162
  const dataQuery = new DataQuery(config, i18n);
160
163
  this.dateBuckets = isDateInterval(config.interval);
164
+ this.unsignedEntries = TableType.OPT === config.type || TableType.OPTNOTOTAL === config.type;
161
165
  const queryData = dataQuery.execute(db, fromExpr); // collection of all query results
162
166
  this.hasBlankRowGroup = dataQuery.hasBlankRowGroup;
163
167
  // Calculate column statistics for bar columns
@@ -287,8 +291,10 @@ export class TableDataSetFactory {
287
291
  * @param columnStatsMap
288
292
  */
289
293
  createRow(i18nMode, i18n, scenariosUnitType, groupData, iGroupIndex, iRowIndex, categoryWidth, measureScale, barColumns, columnStatsMap, waterfallResult) {
290
- var _a;
294
+ var _a, _b, _c;
291
295
  const result = [];
296
+ // thereof and partof rows have no operation, they take the one of the row above
297
+ let operation;
292
298
  for (const rawDataRow of groupData) {
293
299
  iRowIndex += 1;
294
300
  // create next table row
@@ -297,11 +303,12 @@ export class TableDataSetFactory {
297
303
  const subCategory = rawDataRow[QueryColumnNames.SUBCATEGORY];
298
304
  const type = rawDataRow[QueryColumnNames.TYPE];
299
305
  const isSecondElement = rawDataRow[QueryColumnNames.ROWNR] >= 2;
306
+ operation = ((_b = (_a = rawDataRow.operation) !== null && _a !== void 0 ? _a : rawDataRow.restOperation) !== null && _b !== void 0 ? _b : operation);
300
307
  const detailsRow = this.createDetailRow(type, iRowIndex, iGroupIndex, groupData.length);
301
308
  detailsRow.key = this.rowKey(rawDataRow);
302
309
  for (const scenario of this.normalizedHeader) {
303
310
  const value = this.getRawDataRowElement(rawDataRow, scenario);
304
- const isBarChart = (_a = barColumns === null || barColumns === void 0 ? void 0 : barColumns.includes(scenario.type)) !== null && _a !== void 0 ? _a : false;
311
+ const isBarChart = (_c = barColumns === null || barColumns === void 0 ? void 0 : barColumns.includes(scenario.type)) !== null && _c !== void 0 ? _c : false;
305
312
  const columnStats = isBarChart ? columnStatsMap === null || columnStatsMap === void 0 ? void 0 : columnStatsMap.get(scenario.type) : undefined;
306
313
  // waterfall geometry only exists for plain scenario columns (no ## composites)
307
314
  const waterfall = isBarChart &&
@@ -310,9 +317,14 @@ export class TableDataSetFactory {
310
317
  scenario.name === scenario.type
311
318
  ? waterfallResult === null || waterfallResult === void 0 ? void 0 : waterfallResult.get(rawDataRow, scenario.type)
312
319
  : undefined;
313
- detailsRow.createElement(this.translateSumCellLabel(i18nMode, i18n, value, groupName, subCategory, type, scenario.type), scenario.type, this.createColumnType(scenario), this.setCellType(scenario.type, scenariosUnitType), this.translateCellPrefix(i18n, type, scenario.type), this.translateScenarioCSS(scenario.type, value), isSecondElement, categoryWidth, measureScale === null || measureScale === void 0 ? void 0 : measureScale.value, isBarChart, columnStats, 1, waterfall);
320
+ detailsRow.createElement(this.translateSumCellLabel(i18nMode, i18n, value, groupName, subCategory, type, scenario.type), scenario.type, this.createColumnType(scenario), this.setCellType(scenario.type, scenariosUnitType), this.translateCellPrefix(i18n, type, scenario.type), this.translateScenarioCSS(scenario.type, value, operation), isSecondElement, categoryWidth, measureScale === null || measureScale === void 0 ? void 0 : measureScale.value, isBarChart, columnStats, 1, waterfall);
321
+ const cell = detailsRow.elements[detailsRow.elements.length - 1];
314
322
  if (this.dateBuckets && scenario.bucket !== undefined) {
315
- detailsRow.elements[detailsRow.elements.length - 1].date = pointDate(scenario.bucket);
323
+ cell.date = pointDate(scenario.bucket);
324
+ }
325
+ const varianceScenario = new VarianceScenario(scenario.type);
326
+ if (varianceScenario.isValid) {
327
+ cell.direction = this.resolveDirection(varianceScenario, operation);
316
328
  }
317
329
  }
318
330
  result.push(detailsRow);
@@ -453,7 +465,7 @@ export class TableDataSetFactory {
453
465
  * @param scenario
454
466
  * @param value
455
467
  */
456
- translateScenarioCSS(scenario, value) {
468
+ translateScenarioCSS(scenario, value, operation) {
457
469
  if (this.attributesByAlias.has(scenario)) {
458
470
  return "attribute";
459
471
  }
@@ -463,10 +475,15 @@ export class TableDataSetFactory {
463
475
  prefix = "neg";
464
476
  }
465
477
  if (scenarios.isValid) {
466
- return prefix + "_" + scenarios.direction + (scenarios.type === "dr" ? " relative_variance" : "");
478
+ const direction = this.resolveDirection(scenarios, operation);
479
+ return prefix + "_" + direction + (scenarios.type === "dr" ? " relative_variance" : "");
467
480
  }
468
481
  return scenario;
469
482
  }
483
+ /** Sentiment of a variance on a row with the given operation: `op`/`opinv` become pos or neg. */
484
+ resolveDirection(scenarios, operation) {
485
+ return resolveSentiment(scenarios.direction, operation, !this.unsignedEntries);
486
+ }
470
487
  setCellType(scenario, scenariosUnitType) {
471
488
  if (scenario === "category") {
472
489
  return "";
@@ -200,7 +200,11 @@ export class DataQuery {
200
200
  const restScenarios = this.exctractScenarioNames(scenarios)
201
201
  .map((name) => `SUM(${name}) as ${name}`)
202
202
  .join(", ");
203
- querys.push(`SELECT ${QueryColumnNames.ROWNR}, 1 as ${QueryColumnNames.ROWGROUPINDEX} , 'ENTRY' as ${QueryColumnNames.TYPE}, 'NO_GROUP' as ${QueryColumnNames.ROWGROUP}, ${this.bind(String((_a = rowGroupEntry.rowGroup) !== null && _a !== void 0 ? _a : ""))} as restRowGroup, 'REST' as ${QueryColumnNames.CATEGORY} ${restScenarios.length > 0 ? ", " + restScenarios : ""} FROM` +
203
+ // a REST row of only "-" rows counts as "-" for the op sentiment; not named operation, so it stays hidden
204
+ const restOperation = TableType.OPT === this.config.type || TableType.OPTNOTOTAL === this.config.type
205
+ ? `, CASE WHEN MAX(transformOperator(operation)) = -1 THEN '-' ELSE '+' END as restOperation`
206
+ : "";
207
+ querys.push(`SELECT ${QueryColumnNames.ROWNR}, 1 as ${QueryColumnNames.ROWGROUPINDEX} , 'ENTRY' as ${QueryColumnNames.TYPE}, 'NO_GROUP' as ${QueryColumnNames.ROWGROUP}, ${this.bind(String((_a = rowGroupEntry.rowGroup) !== null && _a !== void 0 ? _a : ""))} as restRowGroup, 'REST' as ${QueryColumnNames.CATEGORY}${restOperation} ${restScenarios.length > 0 ? ", " + restScenarios : ""} FROM` +
204
208
  ` (SELECT ROWNUM() AS ${QueryColumnNames.ROWNR}, ${querys.length} as ${QueryColumnNames.ROWGROUPINDEX} , 'ENTRY' as ${QueryColumnNames.TYPE}, ${this.bind(String(rowGroupEntry.rowGroup || "NO_GROUP"))} as ${QueryColumnNames.ROWGROUP}, ${groups.select()} ${scenarios.length > 0 ? ",".concat(scenarios) : ""} FROM ${this.fromExpr} ${queryWhereSection} GROUP BY ${groups} ORDER BY ${order[0]})` +
205
209
  ` t WHERE t.rowNr > ${this.config.limit}`);
206
210
  }
@@ -757,9 +761,9 @@ export class DataQuery {
757
761
  /**
758
762
  * Translates a scenario identifier into a SQL aggregation expression.
759
763
  *
760
- * - **OPT/OPTNOTOTAL types**: Values are summed without `transformOperator` (the
761
- * operation sign is already baked into the data). Variance scenarios produce
762
- * `SUM(base - delta)`.
764
+ * - **OPT/OPTNOTOTAL types**: Entry rows are summed without `transformOperator`, they
765
+ * show unsigned values. Sum rows (`isSumRow`) apply the operation sign to scenarios,
766
+ * variances and the `dr_*` denominator alike.
763
767
  * - **Other types**: Each value is multiplied by `transformOperator(operation)` which
764
768
  * converts the `"+"` / `"-"` operation field into +1 / -1, so rows with negative
765
769
  * operation are subtracted from the aggregate.
@@ -771,11 +775,16 @@ export class DataQuery {
771
775
  const scenarios = new VarianceScenario(scenario);
772
776
  if (TableType.OPT === type || TableType.OPTNOTOTAL === type) {
773
777
  if (scenarios.isValid) {
778
+ // sum rows show signed scenario values, so their variances must be signed too
779
+ const sign = isSumRow ? " * transformOperator(operation)" : "";
780
+ const variance = isSumRow
781
+ ? `SUM((${scenarios.base} - ${scenarios.delta})${sign}) as ${scenario}`
782
+ : `SUM(${scenarios.base} - ${scenarios.delta}) as ${scenario}`;
774
783
  if (scenarios.type === "dr") {
775
- return `SUM(${scenarios.base} - ${scenarios.delta}) as ${scenario}, SUM(${scenarios.delta}) as dr_${scenarios.delta}`;
784
+ return `${variance}, SUM(${scenarios.delta}${sign}) as dr_${scenarios.delta}`;
776
785
  }
777
786
  else {
778
- return `SUM(${scenarios.base} - ${scenarios.delta}) as ${scenario}`;
787
+ return variance;
779
788
  }
780
789
  }
781
790
  if (isSumRow) {
@@ -307,7 +307,7 @@ export class Title {
307
307
  }
308
308
  render() {
309
309
  const fontStyles = this.getFontStyles();
310
- return (h(Host, { key: 'f7509ed1e738bade4d252ae05b14e2531f118cb4', style: fontStyles }, h("bn-title-renderer", { key: 'fb9dcca5c06a11c4d3d6237ce4ade4d42a62396b', 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: '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() })));
311
311
  }
312
312
  static get is() { return "bn-title"; }
313
313
  static get encapsulation() { return "shadow"; }
@@ -431,7 +431,7 @@ export class Title {
431
431
  "optional": false,
432
432
  "docs": {
433
433
  "tags": [],
434
- "text": "<br /> <br />\nList of Variances\nThe additonal variances which\nare calculated form the given scenarios.\nthe scenarios used in the variances have also\nbe defined in the *scenarios* property.\n<br /> <br />\nthe variance is defiend as (Scenario A - ScenarioB)\nneu. neg and pos post fix defines which value is *good*\na negative or a positive value.\n<br /> <br />\nif empty variance charts are hidden\n<br /> <br />\neach variance creates a chart\n<br /> <br />\npattern:<br /> ```d<scenarioB>_<scenarioA>_[pos/neg/neu]```"
434
+ "text": "<br /> <br />\nList of Variances\nThe additonal variances which\nare calculated form the given scenarios.\nthe scenarios used in the variances have also\nbe defined in the *scenarios* property.\n<br /> <br />\nthe variance is defiend as (Scenario A - ScenarioB)\nneu. neg and pos post fix defines which value is *good*\na negative or a positive value.\n<br /> <br />\nif empty variance charts are hidden\n<br /> <br />\neach variance creates a chart\n<br /> <br />\npattern:<br /> ```d<scenarioB>_<scenarioA>_[pos/neg/neu/op/opinv]```"
435
435
  },
436
436
  "getter": false,
437
437
  "setter": false,
@@ -41,12 +41,17 @@ export var Scenarios;
41
41
  * - POS: favorable variance (green in IBCS)
42
42
  * - NEG: unfavorable variance (red in IBCS)
43
43
  * - NEU: neutral / no directional meaning
44
+ * - OP: follows the row operation, like POS on "+" and "=" rows, like NEG on "-" rows
45
+ * (only in opt/optnototal tables, elsewhere the values are signed and OP equals POS)
46
+ * - OPINV: the inverse of OP
44
47
  */
45
48
  export var Sentiments;
46
49
  (function (Sentiments) {
47
50
  Sentiments["POS"] = "pos";
48
51
  Sentiments["NEG"] = "neg";
49
52
  Sentiments["NEU"] = "neu";
53
+ Sentiments["OP"] = "op";
54
+ Sentiments["OPINV"] = "opinv";
50
55
  })(Sentiments || (Sentiments = {}));
51
56
  /** Number display format: DECIMAL for absolute values, PERCENT for ratio columns. */
52
57
  export var DataFormat;
@@ -14,11 +14,15 @@ export class VarianceScenario {
14
14
  this.base = "";
15
15
  /** Subtrahend scenario (the value subtracted), e.g. `"pl1"` */
16
16
  this.delta = "";
17
- /** Sentiment direction: `"pos"` (favorable), `"neg"` (unfavorable), `"neu"` (neutral) */
17
+ /**
18
+ * Sentiment direction: `"pos"` (favorable), `"neg"` (unfavorable), `"neu"` (neutral),
19
+ * `"op"` (follows the row operation) or `"opinv"` (inverse of `"op"`). See {@link resolveSentiment}.
20
+ */
18
21
  this.direction = "";
19
22
  this.isValid = false;
20
23
  /** Capture groups: [1]=type (d|dr), [2]=base scenario, [3]=delta scenario, [4]=sentiment */
21
- const scenarioTestRegex = /(d|dr)(pl\d|ac\d|fc\d|pp\d)_(pl\d|ac\d|fc\d|pp\d)_(pos|neg|neu)/;
24
+ // not anchored on purpose, some callers pass a joined list; opinv must come before op
25
+ const scenarioTestRegex = /(d|dr)(pl\d|ac\d|fc\d|pp\d)_(pl\d|ac\d|fc\d|pp\d)_(pos|neg|neu|opinv|op)/;
22
26
  if (scenarioTestRegex.test(scenario)) {
23
27
  const tokens = scenarioTestRegex.exec(scenario);
24
28
  if (tokens != null) {
@@ -31,3 +35,18 @@ export class VarianceScenario {
31
35
  }
32
36
  }
33
37
  }
38
+ /**
39
+ * Resolves a variance sentiment to `"pos"`, `"neg"` or `"neu"` for one row.
40
+ *
41
+ * `"op"` colours by the contribution to the result: on a `"-"` row it acts like `"neg"`,
42
+ * on every other row (`"+"`, `"="`) like `"pos"`. `"opinv"` is the inverse.
43
+ * When the values are already signed by their operation (`signedValues`, e.g. sum/list
44
+ * tables and charts), `"op"` always acts like `"pos"` and `"opinv"` like `"neg"`.
45
+ */
46
+ export function resolveSentiment(direction, operation, signedValues) {
47
+ if (direction !== "op" && direction !== "opinv") {
48
+ return direction;
49
+ }
50
+ const subtracts = !signedValues && operation === "-";
51
+ return (direction === "op") !== subtracts ? "pos" : "neg";
52
+ }
@@ -10,7 +10,7 @@ import { relativeVariance } from "../relativeVariance";
10
10
  * pos/neg coloring. The regex is anchored, so partial matches inside a
11
11
  * longer token are rejected.
12
12
  */
13
- const VARIANCE_MEASURE_REGEX = /^(dr|d)((?:ac|pp|fc|pl)[1-4])_((?:ac|pp|fc|pl)[1-4])(?:_(pos|neg|neu))?$/;
13
+ const VARIANCE_MEASURE_REGEX = /^(dr|d)((?:ac|pp|fc|pl)[1-4])_((?:ac|pp|fc|pl)[1-4])(?:_(pos|neg|neu|op|opinv))?$/;
14
14
  export class VarianceMeasure {
15
15
  constructor(
16
16
  /** `"d"` = absolute, `"dr"` = relative (fraction of delta). */
@@ -1 +1 @@
1
- import{B as o,d as s}from"./p-z56_ZQ42.js";const p=o,r=s;export{p as BnChartBubbleRenderer,r as defineCustomElement}
1
+ import{B as o,d as s}from"./p-CPC9Vkmg.js";const m=o,p=s;export{m as BnChartBubbleRenderer,p as defineCustomElement}