@umriss-ui/calculation 0.41.0 → 0.42.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +31 -3
- package/README.md +18 -11
- package/dist/calculation.client.js +403 -0
- package/dist/calculation.css +1 -1
- package/dist/calculation.js +19 -558
- package/dist/calculation.model-DU6T1D09.js +168 -0
- package/dist/index.d.ts +1 -1
- package/docs/llms-full.md +274 -294
- package/package.json +8 -7
package/docs/llms-full.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
# @umriss-ui/calculation 0.
|
|
1
|
+
# @umriss-ui/calculation 0.42.0
|
|
2
2
|
|
|
3
3
|
> React calculation view for data-dense applications - a derivation written as it is shown, evaluated by the library, folded and read line by line.
|
|
4
4
|
|
|
5
|
-
Install with `npm install @umriss-ui/calculation @umriss-ui/core`. This text is generated from the package's demo
|
|
5
|
+
Install with `npm install @umriss-ui/calculation @umriss-ui/core`. This text is generated from the package's demo: every page with its import line, its examples - the source exactly as it runs, with the package name where the demo imports its own source - its props tables generated from the code, and what it deliberately does not do.
|
|
6
6
|
|
|
7
7
|
## Scenarios
|
|
8
8
|
|
|
@@ -1003,13 +1003,11 @@ import { Calculation, Given, Difference, Quotient, Ref } from "@umriss-ui/calcul
|
|
|
1003
1003
|
npm install @umriss-ui/calculation @umriss-ui/core
|
|
1004
1004
|
```
|
|
1005
1005
|
|
|
1006
|
-
Demo page: https://romanhaendler.github.io/umriss-ui/calculation/installation/
|
|
1007
|
-
|
|
1008
1006
|
The command brings the core package along, a peer dependency: it gives the calculation its formats, its wording and the assessment of targets and limits. React 19 or newer is a peer as well and stays the application's own.
|
|
1009
1007
|
|
|
1010
1008
|
The stylesheet loads itself: the package imports it and marks CSS as a side effect, so a bundler keeps it. `@umriss-ui/calculation/styles.css` stays exported for setups that link stylesheets by hand.
|
|
1011
1009
|
|
|
1012
|
-
You write the figure as elements and hand in only the givens; the calculation performs every operation it shows, so the screen cannot disagree with the number. Start with [Calculation](
|
|
1010
|
+
You write the figure as elements and hand in only the givens; the calculation performs every operation it shows, so the screen cannot disagree with the number. Start with [Calculation](#calculation).
|
|
1013
1011
|
|
|
1014
1012
|
#### Examples
|
|
1015
1013
|
|
|
@@ -1037,66 +1035,66 @@ export default function Availability() {
|
|
|
1037
1035
|
|
|
1038
1036
|
#### Keyboard
|
|
1039
1037
|
|
|
1040
|
-
The keys of [Calculation](
|
|
1038
|
+
The keys of [Calculation](#calculation) apply here.
|
|
1041
1039
|
|
|
1042
1040
|
#### Props on this page
|
|
1043
1041
|
|
|
1044
|
-
From `CalculationProps` — the full table stands on [Calculation](
|
|
1042
|
+
From `CalculationProps` — the full table stands on [Calculation](#calculation).
|
|
1045
1043
|
|
|
1046
1044
|
| Prop | Type | Default | Description |
|
|
1047
1045
|
|---|---|---|---|
|
|
1048
|
-
| [`children`](
|
|
1046
|
+
| [`children`](#calculation) *required* | `ReactNode` | — | The result: exactly one quantity - a tree (`<Sum>`, `<Difference>`, `<Product>`, `<Quotient>` with their operands, `<Given>` as leaves) or a `<Chain>`, the two mixing freely; `<Ref>` for a quantity defined elsewhere. |
|
|
1049
1047
|
|
|
1050
|
-
From `OperatorProps` — the full table stands on [Tree](
|
|
1048
|
+
From `OperatorProps` — the full table stands on [Tree](#tree).
|
|
1051
1049
|
|
|
1052
1050
|
| Prop | Type | Default | Description |
|
|
1053
1051
|
|---|---|---|---|
|
|
1054
|
-
| [`children`](
|
|
1055
|
-
| [`label`](
|
|
1056
|
-
| [`id`](
|
|
1057
|
-
| [`unit`](
|
|
1058
|
-
| [`format`](
|
|
1059
|
-
| [`decimals`](
|
|
1060
|
-
| [`target`](
|
|
1052
|
+
| [`children`](#tree) | `ReactNode` | — | The operands, in order: quantities, givens and references. |
|
|
1053
|
+
| [`label`](#tree) *required* | `string` | — | What the quantity is called. It stands on its line, wherever it is an operand, and in the accessible sentence. From `QuantityProps`. |
|
|
1054
|
+
| [`id`](#tree) | `string` | — | Makes the quantity referable: `<Ref to>` stands for it elsewhere. Needed only for a quantity used more than once. From `QuantityProps`. |
|
|
1055
|
+
| [`unit`](#tree) | `string` | — | A label written after the number - "min", "pcs", "€". Never converted and never checked; the calculation does no unit algebra. From `QuantityProps`. |
|
|
1056
|
+
| [`format`](#tree) | `"percent"` | — | `percent` presents a plain ratio as per cent: 0.916 is shown as 91.6 %. The quantity stays a ratio in every operation. From `QuantityProps`. |
|
|
1057
|
+
| [`decimals`](#tree) | `number` | one digit for a percentage, at most two for a derived number, a given as it was given | Fixed number of fraction digits as shown. Rounding happens only in presentation; every operation uses the full value. From `QuantityProps`. |
|
|
1058
|
+
| [`target`](#tree) | `number` | — | The value this quantity is meant to reach - missed, never violated. From `QuantityProps`. |
|
|
1061
1059
|
|
|
1062
|
-
From `RefProps` — the full table stands on [Tree](
|
|
1060
|
+
From `RefProps` — the full table stands on [Tree](#tree).
|
|
1063
1061
|
|
|
1064
1062
|
| Prop | Type | Default | Description |
|
|
1065
1063
|
|---|---|---|---|
|
|
1066
|
-
| [`to`](
|
|
1064
|
+
| [`to`](#tree) *required* | `string` | — | The `id` of the quantity this reference stands for. |
|
|
1067
1065
|
|
|
1068
|
-
From `ChainOperandProps` — the full table stands on [Chain](
|
|
1066
|
+
From `ChainOperandProps` — the full table stands on [Chain](#chain).
|
|
1069
1067
|
|
|
1070
1068
|
| Prop | Type | Default | Description |
|
|
1071
1069
|
|---|---|---|---|
|
|
1072
|
-
| [`id`](
|
|
1073
|
-
| [`unit`](
|
|
1074
|
-
| [`format`](
|
|
1075
|
-
| [`decimals`](
|
|
1076
|
-
| [`target`](
|
|
1070
|
+
| [`id`](#chain) | `string` | — | Makes the quantity referable: `<Ref to>` stands for it elsewhere. Needed only for a quantity used more than once. From `QuantityProps`. |
|
|
1071
|
+
| [`unit`](#chain) | `string` | — | A label written after the number - "min", "pcs", "€". Never converted and never checked; the calculation does no unit algebra. From `QuantityProps`. |
|
|
1072
|
+
| [`format`](#chain) | `"percent"` | — | `percent` presents a plain ratio as per cent: 0.916 is shown as 91.6 %. The quantity stays a ratio in every operation. From `QuantityProps`. |
|
|
1073
|
+
| [`decimals`](#chain) | `number` | one digit for a percentage, at most two for a derived number, a given as it was given | Fixed number of fraction digits as shown. Rounding happens only in presentation; every operation uses the full value. From `QuantityProps`. |
|
|
1074
|
+
| [`target`](#chain) | `number` | — | The value this quantity is meant to reach - missed, never violated. From `QuantityProps`. |
|
|
1077
1075
|
|
|
1078
|
-
From `QuantityProps` — the full table stands on [Chain](
|
|
1076
|
+
From `QuantityProps` — the full table stands on [Chain](#chain).
|
|
1079
1077
|
|
|
1080
1078
|
| Prop | Type | Default | Description |
|
|
1081
1079
|
|---|---|---|---|
|
|
1082
|
-
| [`label`](
|
|
1083
|
-
| [`id`](
|
|
1084
|
-
| [`unit`](
|
|
1085
|
-
| [`format`](
|
|
1086
|
-
| [`decimals`](
|
|
1087
|
-
| [`target`](
|
|
1080
|
+
| [`label`](#chain) *required* | `string` | — | What the quantity is called. It stands on its line, wherever it is an operand, and in the accessible sentence. |
|
|
1081
|
+
| [`id`](#chain) | `string` | — | Makes the quantity referable: `<Ref to>` stands for it elsewhere. Needed only for a quantity used more than once. |
|
|
1082
|
+
| [`unit`](#chain) | `string` | — | A label written after the number - "min", "pcs", "€". Never converted and never checked; the calculation does no unit algebra. |
|
|
1083
|
+
| [`format`](#chain) | `"percent"` | — | `percent` presents a plain ratio as per cent: 0.916 is shown as 91.6 %. The quantity stays a ratio in every operation. |
|
|
1084
|
+
| [`decimals`](#chain) | `number` | one digit for a percentage, at most two for a derived number, a given as it was given | Fixed number of fraction digits as shown. Rounding happens only in presentation; every operation uses the full value. |
|
|
1085
|
+
| [`target`](#chain) | `number` | — | The value this quantity is meant to reach - missed, never violated. |
|
|
1088
1086
|
|
|
1089
|
-
From `GivenProps` — the full table stands on [Given](
|
|
1087
|
+
From `GivenProps` — the full table stands on [Given](#given).
|
|
1090
1088
|
|
|
1091
1089
|
| Prop | Type | Default | Description |
|
|
1092
1090
|
|---|---|---|---|
|
|
1093
|
-
| [`value`](
|
|
1094
|
-
| [`label`](
|
|
1095
|
-
| [`id`](
|
|
1096
|
-
| [`unit`](
|
|
1097
|
-
| [`format`](
|
|
1098
|
-
| [`decimals`](
|
|
1099
|
-
| [`target`](
|
|
1091
|
+
| [`value`](#given) *required* | `number \| null \| undefined \| `[`MetricValues`](#given) | — | The number the calculation starts from. Absent (`null`, `undefined`, not finite) makes every quantity that depends on it absent, with the reason - never zero. Where the calculation has `metrics`, an object with a number for each metric id instead; absence then stays in its metric. |
|
|
1092
|
+
| [`label`](#given) *required* | `string` | — | What the quantity is called. It stands on its line, wherever it is an operand, and in the accessible sentence. From `QuantityProps`. |
|
|
1093
|
+
| [`id`](#given) | `string` | — | Makes the quantity referable: `<Ref to>` stands for it elsewhere. Needed only for a quantity used more than once. From `QuantityProps`. |
|
|
1094
|
+
| [`unit`](#given) | `string` | — | A label written after the number - "min", "pcs", "€". Never converted and never checked; the calculation does no unit algebra. From `QuantityProps`. |
|
|
1095
|
+
| [`format`](#given) | `"percent"` | — | `percent` presents a plain ratio as per cent: 0.916 is shown as 91.6 %. The quantity stays a ratio in every operation. From `QuantityProps`. |
|
|
1096
|
+
| [`decimals`](#given) | `number` | one digit for a percentage, at most two for a derived number, a given as it was given | Fixed number of fraction digits as shown. Rounding happens only in presentation; every operation uses the full value. From `QuantityProps`. |
|
|
1097
|
+
| [`target`](#given) | `number` | — | The value this quantity is meant to reach - missed, never violated. From `QuantityProps`. |
|
|
1100
1098
|
|
|
1101
1099
|
## Writing a calculation
|
|
1102
1100
|
|
|
@@ -1110,8 +1108,6 @@ Lets a reader follow and redo a figure (also called a KPI tree or calculation tr
|
|
|
1110
1108
|
import { Calculation, Given, Sum, Product, Quotient, Ref, Chain, Plus, Interim } from "@umriss-ui/calculation";
|
|
1111
1109
|
```
|
|
1112
1110
|
|
|
1113
|
-
Demo page: https://romanhaendler.github.io/umriss-ui/calculation/calculation/
|
|
1114
|
-
|
|
1115
1111
|
There is no prop for a result. Every derived number is computed with the operator its line names, at full precision; only the screen rounds.
|
|
1116
1112
|
|
|
1117
1113
|
The nesting is the fold structure and the child order is the operand order. What TypeScript cannot check – a `Ref` to nothing, a circle through references, a wrong operand count, a duplicate id, a component of your own wrapping `Given`, `emphasis` or `rule` on the Result – fails on the first render with a message saying which ([ADR-0027](https://github.com/romanhaendler/umriss-ui/blob/main/docs/adr/0027-a-calculation-is-written-as-it-is-shown.md)). `emphasis` and `rule` set any other line apart without CSS ([ADR-0049](https://github.com/romanhaendler/umriss-ui/blob/main/docs/adr/0049-a-sum-takes-rows-from-data.md)).
|
|
@@ -1550,7 +1546,7 @@ export default function Density() {
|
|
|
1550
1546
|
|
|
1551
1547
|
The calculation is a nested list: every line an item, every derivation a list inside it. A screen reader reads each line as one sentence - "Availability equals Run time divided by Planned production time, equals 412 min divided by 450 min, equals 91.6 percent, above target 90 percent" - and the drawn operator, label and figures are hidden from it. A line that opens is a button named "Show how Availability is derived", or "Hide …" while open, with `aria-expanded`; opening it moves no focus and announces nothing beyond that state.
|
|
1552
1548
|
|
|
1553
|
-
The sentence's words are core's wording, so under `@umriss-ui/core/wording/de` the same line reads "Verfügbarkeit gleich Laufzeit geteilt durch Planbelegungszeit, gleich 412 min geteilt durch 450 min, gleich 91,6 Prozent, über Ziel 90 Prozent" and its button "Herleitung von Verfügbarkeit zeigen" ([Given](
|
|
1549
|
+
The sentence's words are core's wording, so under `@umriss-ui/core/wording/de` the same line reads "Verfügbarkeit gleich Laufzeit geteilt durch Planbelegungszeit, gleich 412 min geteilt durch 450 min, gleich 91,6 Prozent, über Ziel 90 Prozent" and its button "Herleitung von Verfügbarkeit zeigen" ([Given](#given) shows one). The labels are yours and are read as you write them.
|
|
1554
1550
|
|
|
1555
1551
|
Name the calculation with `aria-label`, which lands on the list; without it a reader meets an unnamed list. Under forced colours the band that couples a line with its operands is drawn as an outline in the system's selection colour; with reduced motion a derivation opens without its movement.
|
|
1556
1552
|
|
|
@@ -1560,9 +1556,9 @@ Name the calculation with `aria-label`, which lands on the list; without it a re
|
|
|
1560
1556
|
|
|
1561
1557
|
| Prop | Type | Default | Description |
|
|
1562
1558
|
|---|---|---|---|
|
|
1563
|
-
| `children` *required* | `ReactNode` | — | The result: exactly one quantity - a tree (`<Sum>`, `<Difference>`, `<Product>`, `<Quotient>` with their operands, `<Given>` as leaves) or a `<Chain>`, the two mixing freely; `<Ref>` for a quantity defined elsewhere.<br>Shown in: [Two numbers and a sum](
|
|
1564
|
-
| `metrics` | `readonly `[`Metric`](
|
|
1565
|
-
| `density` | `"regular" \| "compact"` | the density of the `UmrissProvider`, else `"regular"` | `"compact"` sets the lines as close as a compact table's rows: smaller type and less room above and below, under a finger still tall enough to tap. Columns, folding and wording stay as they are.<br>Shown in: [Density](
|
|
1559
|
+
| `children` *required* | `ReactNode` | — | The result: exactly one quantity - a tree (`<Sum>`, `<Difference>`, `<Product>`, `<Quotient>` with their operands, `<Given>` as leaves) or a `<Chain>`, the two mixing freely; `<Ref>` for a quantity defined elsewhere.<br>Shown in: [Two numbers and a sum](#calculation), [Write a tree](#calculation), [Write a chain](#calculation) and 50 more |
|
|
1560
|
+
| `metrics` | `readonly `[`Metric`](#metrics)`[]` | — | Several numbers per quantity, side by side - headcount and full-time equivalents of the same teams ([ADR-0038](https://github.com/romanhaendler/umriss-ui/blob/main/docs/adr/0038-a-calculation-can-carry-several-metrics.md)). Every `value` is then an object with a number for each metric id; unit and places are the metric's. A calculation with metrics only adds and subtracts, and assesses no target or limits.<br>Shown in: [Rows of both signs with metrics (Rows from data)](#rows-from-data), [Headcount and full-time equivalents (Metrics)](#metrics), [A number one metric does not have (Metrics)](#metrics) and 5 more |
|
|
1561
|
+
| `density` | `"regular" \| "compact"` | the density of the `UmrissProvider`, else `"regular"` | `"compact"` sets the lines as close as a compact table's rows: smaller type and less room above and below, under a finger still tall enough to tap. Columns, folding and wording stay as they are.<br>Shown in: [Density](#calculation), [A dense staff report (Metrics)](#metrics) |
|
|
1566
1562
|
|
|
1567
1563
|
Also takes every attribute of the rendered element – without `children`.
|
|
1568
1564
|
|
|
@@ -1571,7 +1567,7 @@ Also takes every attribute of the rendered element – without `children`.
|
|
|
1571
1567
|
- No result, formula text or operator of your own: a written-out operation the library did not perform could say something the number does not ([ADR-0027](https://github.com/romanhaendler/umriss-ui/blob/main/docs/adr/0027-a-calculation-is-written-as-it-is-shown.md)).
|
|
1572
1568
|
- No input: a calculation shows how a figure came about; changing a given is your application's form.
|
|
1573
1569
|
|
|
1574
|
-
What umriss deliberately does not build, and why: [ADR-0032](https://
|
|
1570
|
+
What umriss deliberately does not build, and why: [ADR-0032](https://github.com/romanhaendler/umriss-ui/blob/calculation-v0.42.0/docs/adr/0032-what-umriss-is-not.md).
|
|
1575
1571
|
|
|
1576
1572
|
### Tree
|
|
1577
1573
|
|
|
@@ -1581,9 +1577,7 @@ Sum, difference, product and quotient, each holding its operands: the form for a
|
|
|
1581
1577
|
import { Sum, Difference, Product, Quotient, Ref } from "@umriss-ui/calculation";
|
|
1582
1578
|
```
|
|
1583
1579
|
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
`Product` and `Difference` (a − b − c) take two or more operands, `Quotient` exactly two, and `Sum` any number – rows from data, one or none included (see [Rows from data](#/rows-from-data)). A quantity used twice is defined once with an `id` and stands elsewhere as a `Ref`, which shows its name and number but never its derivation again.
|
|
1580
|
+
`Product` and `Difference` (a − b − c) take two or more operands, `Quotient` exactly two, and `Sum` any number – rows from data, one or none included (see [Rows from data](#rows-from-data)). A quantity used twice is defined once with an `id` and stands elsewhere as a `Ref`, which shows its name and number but never its derivation again.
|
|
1587
1581
|
|
|
1588
1582
|
#### Examples
|
|
1589
1583
|
|
|
@@ -1782,7 +1776,7 @@ export default function Limits() {
|
|
|
1782
1776
|
|
|
1783
1777
|
#### Keyboard
|
|
1784
1778
|
|
|
1785
|
-
The keys of [Calculation](
|
|
1779
|
+
The keys of [Calculation](#calculation) apply here.
|
|
1786
1780
|
|
|
1787
1781
|
#### API
|
|
1788
1782
|
|
|
@@ -1790,24 +1784,24 @@ The keys of [Calculation](#/calculation/keyboard-calculation) apply here.
|
|
|
1790
1784
|
|
|
1791
1785
|
| Prop | Type | Default | Description |
|
|
1792
1786
|
|---|---|---|---|
|
|
1793
|
-
| `children` | `ReactNode` | — | The operands, in order: quantities, givens and references.<br>Shown in: [Show a share against a target](
|
|
1794
|
-
| `label` *required* | `string` | — | What the quantity is called. It stands on its line, wherever it is an operand, and in the accessible sentence. From `QuantityProps`.<br>Shown in: [Show a share against a target](
|
|
1795
|
-
| `id` | `string` | — | Makes the quantity referable: `<Ref to>` stands for it elsewhere. Needed only for a quantity used more than once. From `QuantityProps`.<br>Shown in: [Use a quantity twice](
|
|
1796
|
-
| `unit` | `string` | — | A label written after the number - "min", "pcs", "€". Never converted and never checked; the calculation does no unit algebra. From `QuantityProps`.<br>Shown in: [Show a share against a target](
|
|
1797
|
-
| `format` | `"percent"` | — | `percent` presents a plain ratio as per cent: 0.916 is shown as 91.6 %. The quantity stays a ratio in every operation. From `QuantityProps`.<br>Shown in: [Show a share against a target](
|
|
1798
|
-
| `decimals` | `number` | one digit for a percentage, at most two for a derived number, a given as it was given | Fixed number of fraction digits as shown. Rounding happens only in presentation; every operation uses the full value. From `QuantityProps`.<br>Shown in: [Multiply quantities with units](
|
|
1799
|
-
| `target` | `number` | — | The value this quantity is meant to reach - missed, never violated. From `QuantityProps`.<br>Shown in: [Show a share against a target](
|
|
1800
|
-
| `limits` | `readonly
|
|
1801
|
-
| `explanation` | `string` | — | A sentence of plain text beside the line: why the quantity is here, or what it means. From `QuantityProps`.<br>Shown in: [Say where a number came from (Given)](
|
|
1802
|
-
| `aside` | `ReactNode` | — | Content of the caller's own beside the line - a sparkline, a link. It never takes part in the calculation. From `QuantityProps`.<br>Shown in: [Say where a number came from (Given)](
|
|
1803
|
-
| `emphasis` | `"strong" \| "muted"` | — | How much the line stands out among the others ([ADR-0049](https://github.com/romanhaendler/umriss-ui/blob/main/docs/adr/0049-a-sum-takes-rows-from-data.md)): `strong` to be read first, `muted` to recede - a muted line still counts in full. Not on the Result, which is already the heaviest line. From `QuantityProps`.<br>Shown in: [A stronger line (Calculation)](
|
|
1804
|
-
| `rule` | `"above"` | — | `above` rules the line off from the ones before it, where a section starts that is not an interim. Not on the Result. From `QuantityProps`.<br>Shown in: [A rule above (Calculation)](
|
|
1787
|
+
| `children` | `ReactNode` | — | The operands, in order: quantities, givens and references.<br>Shown in: [Show a share against a target](#tree), [Take several amounts away](#tree), [Multiply quantities with units](#tree) and 42 more |
|
|
1788
|
+
| `label` *required* | `string` | — | What the quantity is called. It stands on its line, wherever it is an operand, and in the accessible sentence. From `QuantityProps`.<br>Shown in: [Show a share against a target](#tree), [Take several amounts away](#tree), [Multiply quantities with units](#tree) and 50 more |
|
|
1789
|
+
| `id` | `string` | — | Makes the quantity referable: `<Ref to>` stands for it elsewhere. Needed only for a quantity used more than once. From `QuantityProps`.<br>Shown in: [Use a quantity twice](#tree), [The availability of a service (Installation)](#installation), [Write a tree (Calculation)](#calculation) and 10 more |
|
|
1790
|
+
| `unit` | `string` | — | A label written after the number - "min", "pcs", "€". Never converted and never checked; the calculation does no unit algebra. From `QuantityProps`.<br>Shown in: [Show a share against a target](#tree), [Take several amounts away](#tree), [Multiply quantities with units](#tree) and 42 more |
|
|
1791
|
+
| `format` | `"percent"` | — | `percent` presents a plain ratio as per cent: 0.916 is shown as 91.6 %. The quantity stays a ratio in every operation. From `QuantityProps`.<br>Shown in: [Show a share against a target](#tree), [Use a quantity twice](#tree), [Build operands from data](#tree) and 17 more |
|
|
1792
|
+
| `decimals` | `number` | one digit for a percentage, at most two for a derived number, a given as it was given | Fixed number of fraction digits as shown. Rounding happens only in presentation; every operation uses the full value. From `QuantityProps`.<br>Shown in: [Multiply quantities with units](#tree), [Build operands from data](#tree), [Hold a figure to its limits](#tree) and 29 more |
|
|
1793
|
+
| `target` | `number` | — | The value this quantity is meant to reach - missed, never violated. From `QuantityProps`.<br>Shown in: [Show a share against a target](#tree), [The availability of a service (Installation)](#installation), [Write a tree (Calculation)](#calculation) and 6 more |
|
|
1794
|
+
| `limits` | `readonly ``Limit``[]` | — | Bounds the quantity is assessed against, through core's `assess()`. From `QuantityProps`.<br>Shown in: [Hold a figure to its limits](#tree), [Density (Calculation)](#calculation), [Hold an interim to its limits (Chain)](#chain) and 5 more |
|
|
1795
|
+
| `explanation` | `string` | — | A sentence of plain text beside the line: why the quantity is here, or what it means. From `QuantityProps`.<br>Shown in: [Say where a number came from (Given)](#given), [A number one metric does not have (Metrics)](#metrics), [Staff movement as a chain (Metrics)](#metrics) and 2 more |
|
|
1796
|
+
| `aside` | `ReactNode` | — | Content of the caller's own beside the line - a sparkline, a link. It never takes part in the calculation. From `QuantityProps`.<br>Shown in: [Say where a number came from (Given)](#given) |
|
|
1797
|
+
| `emphasis` | `"strong" \| "muted"` | — | How much the line stands out among the others ([ADR-0049](https://github.com/romanhaendler/umriss-ui/blob/main/docs/adr/0049-a-sum-takes-rows-from-data.md)): `strong` to be read first, `muted` to recede - a muted line still counts in full. Not on the Result, which is already the heaviest line. From `QuantityProps`.<br>Shown in: [A stronger line (Calculation)](#calculation), [A quieter line (Calculation)](#calculation), [Emphasis inside a group (Calculation)](#calculation) |
|
|
1798
|
+
| `rule` | `"above"` | — | `above` rules the line off from the ones before it, where a section starts that is not an interim. Not on the Result. From `QuantityProps`.<br>Shown in: [A rule above (Calculation)](#calculation), [Emphasis inside a group (Calculation)](#calculation) |
|
|
1805
1799
|
|
|
1806
1800
|
##### `RefProps`
|
|
1807
1801
|
|
|
1808
1802
|
| Prop | Type | Default | Description |
|
|
1809
1803
|
|---|---|---|---|
|
|
1810
|
-
| `to` *required* | `string` | — | The `id` of the quantity this reference stands for.<br>Shown in: [Use a quantity twice](
|
|
1804
|
+
| `to` *required* | `string` | — | The `id` of the quantity this reference stands for.<br>Shown in: [Use a quantity twice](#tree), [The availability of a service (Installation)](#installation), [Write a tree (Calculation)](#calculation) and 10 more |
|
|
1811
1805
|
|
|
1812
1806
|
##### Types on this page
|
|
1813
1807
|
|
|
@@ -1823,9 +1817,9 @@ force a `null` on one edge in the one-sided case.
|
|
|
1823
1817
|
|
|
1824
1818
|
| Prop | Type | Default | Description |
|
|
1825
1819
|
|---|---|---|---|
|
|
1826
|
-
| `value` *required* | `number` | — | <br>Shown in: [Hold a figure to its limits](
|
|
1827
|
-
| `side` *required* |
|
|
1828
|
-
| `severity` *required* |
|
|
1820
|
+
| `value` *required* | `number` | — | <br>Shown in: [Hold a figure to its limits](#tree), [Density (Calculation)](#calculation), [Hold an interim to its limits (Chain)](#chain) and 3 more |
|
|
1821
|
+
| `side` *required* | `Side`<br>`"upper" \| "lower"` | — | <br>Shown in: [Hold a figure to its limits](#tree), [Density (Calculation)](#calculation), [Hold an interim to its limits (Chain)](#chain) and 3 more |
|
|
1822
|
+
| `severity` *required* | `Severity`<br>`"warning" \| "alarm"` | — | <br>Shown in: [Hold a figure to its limits](#tree), [Density (Calculation)](#calculation), [Hold an interim to its limits (Chain)](#chain) and 3 more |
|
|
1829
1823
|
|
|
1830
1824
|
###### `Side`
|
|
1831
1825
|
|
|
@@ -1854,7 +1848,7 @@ type Severity = "warning" | "alarm";
|
|
|
1854
1848
|
- Four operators and nothing else – no powers, roots or functions; compute those before and hand them in as givens.
|
|
1855
1849
|
- A unit is a label and is never converted or checked; the calculation does no unit algebra.
|
|
1856
1850
|
|
|
1857
|
-
What umriss deliberately does not build, and why: [ADR-0032](https://
|
|
1851
|
+
What umriss deliberately does not build, and why: [ADR-0032](https://github.com/romanhaendler/umriss-ui/blob/calculation-v0.42.0/docs/adr/0032-what-umriss-is-not.md).
|
|
1858
1852
|
|
|
1859
1853
|
### Chain
|
|
1860
1854
|
|
|
@@ -1864,8 +1858,6 @@ A sheet read top to bottom (a running calculation): each line worked into the va
|
|
|
1864
1858
|
import { Chain, Plus, Minus, Times, DividedBy, Interim } from "@umriss-ui/calculation";
|
|
1865
1859
|
```
|
|
1866
1860
|
|
|
1867
|
-
Demo page: https://romanhaendler.github.io/umriss-ui/calculation/chain/
|
|
1868
|
-
|
|
1869
1861
|
A chain has no precedence: every line works into the value before it, strictly in order. So `Times` and `DividedBy` stand alone between two named values; anything else fails on the first render.
|
|
1870
1862
|
|
|
1871
1863
|
A chain in view stands open – it is the working itself. What should show only on request goes into one line as a tree, which folds. Only an `Interim` shows the running value ([ADR-0028](https://github.com/romanhaendler/umriss-ui/blob/main/docs/adr/0028-a-calculation-is-a-tree-or-a-chain.md)).
|
|
@@ -2088,7 +2080,7 @@ export default function ErrorBudget() {
|
|
|
2088
2080
|
|
|
2089
2081
|
#### Keyboard
|
|
2090
2082
|
|
|
2091
|
-
The keys of [Calculation](
|
|
2083
|
+
The keys of [Calculation](#calculation) apply here.
|
|
2092
2084
|
|
|
2093
2085
|
#### API
|
|
2094
2086
|
|
|
@@ -2096,44 +2088,44 @@ The keys of [Calculation](#/calculation/keyboard-calculation) apply here.
|
|
|
2096
2088
|
|
|
2097
2089
|
| Prop | Type | Default | Description |
|
|
2098
2090
|
|---|---|---|---|
|
|
2099
|
-
| `children` | `ReactNode` | — | The operands, top to bottom: a first quantity with no operator, then `Plus`, `Minus`, `Times` and `DividedBy` with their operands and `Interim`s naming the value where they stand. The last line is an `Interim`; a `Times` or `DividedBy` stands alone between two named values.<br>Shown in: [Take amounts away from a first quantity](
|
|
2091
|
+
| `children` | `ReactNode` | — | The operands, top to bottom: a first quantity with no operator, then `Plus`, `Minus`, `Times` and `DividedBy` with their operands and `Interim`s naming the value where they stand. The last line is an `Interim`; a `Times` or `DividedBy` stands alone between two named values.<br>Shown in: [Take amounts away from a first quantity](#chain), [Mix additions and deductions](#chain), [Multiply between two interims](#chain) and 22 more |
|
|
2100
2092
|
|
|
2101
2093
|
##### `ChainOperandProps`
|
|
2102
2094
|
|
|
2103
2095
|
| Prop | Type | Default | Description |
|
|
2104
2096
|
|---|---|---|---|
|
|
2105
|
-
| `label` | `string` | — | The operand's name, where the line is a given written in place. Left out where the line holds a quantity as its child.<br>Shown in: [Take amounts away from a first quantity](
|
|
2106
|
-
| `value` | `number \| null \|
|
|
2107
|
-
| `children` | `ReactNode` | — | Instead of `label` and `value`: exactly one quantity - a tree, a `<Ref>` or a `<Chain>`.<br>Shown in: [Fold a group of lines into one](
|
|
2108
|
-
| `source` | `string` | — | Where the number came from: a system, a report, a person. From `GivenProps`.<br>Shown in: [Say where a number came from (Given)](
|
|
2109
|
-
| `asOf` | `Date \| number` | — | When the number was true - not when it was fetched. From `GivenProps`.<br>Shown in: [Say where a number came from (Given)](
|
|
2110
|
-
| `ages` |
|
|
2111
|
-
| `id` | `string` | — | Makes the quantity referable: `<Ref to>` stands for it elsewhere. Needed only for a quantity used more than once. From `QuantityProps`.<br>Shown in: [Fold a group of lines into one](
|
|
2112
|
-
| `unit` | `string` | — | A label written after the number - "min", "pcs", "€". Never converted and never checked; the calculation does no unit algebra. From `QuantityProps`.<br>Shown in: [Take amounts away from a first quantity](
|
|
2113
|
-
| `format` | `"percent"` | — | `percent` presents a plain ratio as per cent: 0.916 is shown as 91.6 %. The quantity stays a ratio in every operation. From `QuantityProps`.<br>Shown in: [Fold a group of lines into one](
|
|
2114
|
-
| `decimals` | `number` | one digit for a percentage, at most two for a derived number, a given as it was given | Fixed number of fraction digits as shown. Rounding happens only in presentation; every operation uses the full value. From `QuantityProps`.<br>Shown in: [Take amounts away from a first quantity](
|
|
2115
|
-
| `target` | `number` | — | The value this quantity is meant to reach - missed, never violated. From `QuantityProps`.<br>Shown in: [Put a chain inside a tree](
|
|
2116
|
-
| `limits` | `readonly
|
|
2117
|
-
| `explanation` | `string` | — | A sentence of plain text beside the line: why the quantity is here, or what it means. From `QuantityProps`.<br>Shown in: [Say where a number came from (Given)](
|
|
2118
|
-
| `aside` | `ReactNode` | — | Content of the caller's own beside the line - a sparkline, a link. It never takes part in the calculation. From `QuantityProps`.<br>Shown in: [Say where a number came from (Given)](
|
|
2119
|
-
| `emphasis` | `"strong" \| "muted"` | — | How much the line stands out among the others ([ADR-0049](https://github.com/romanhaendler/umriss-ui/blob/main/docs/adr/0049-a-sum-takes-rows-from-data.md)): `strong` to be read first, `muted` to recede - a muted line still counts in full. Not on the Result, which is already the heaviest line. From `QuantityProps`.<br>Shown in: [A stronger line (Calculation)](
|
|
2120
|
-
| `rule` | `"above"` | — | `above` rules the line off from the ones before it, where a section starts that is not an interim. Not on the Result. From `QuantityProps`.<br>Shown in: [A rule above (Calculation)](
|
|
2097
|
+
| `label` | `string` | — | The operand's name, where the line is a given written in place. Left out where the line holds a quantity as its child.<br>Shown in: [Take amounts away from a first quantity](#chain), [Mix additions and deductions](#chain), [Multiply between two interims](#chain) and 17 more |
|
|
2098
|
+
| `value` | `number \| null \| ``MetricValues` | — | The operand's number, where the line is a given written in place. Absent as for a `Given`: the line and every interim after it are absent, with the reason. With `metrics`, an object by metric id, as on a `Given`.<br>Shown in: [Take amounts away from a first quantity](#chain), [Mix additions and deductions](#chain), [Multiply between two interims](#chain) and 17 more |
|
|
2099
|
+
| `children` | `ReactNode` | — | Instead of `label` and `value`: exactly one quantity - a tree, a `<Ref>` or a `<Chain>`.<br>Shown in: [Fold a group of lines into one](#chain), [Write a chain (Calculation)](#calculation), [Emphasis inside a group (Calculation)](#calculation) and 12 more |
|
|
2100
|
+
| `source` | `string` | — | Where the number came from: a system, a report, a person. From `GivenProps`.<br>Shown in: [Say where a number came from (Given)](#given), [State when a number was true (Given)](#given), [Staff movement as a chain (Metrics)](#metrics) and 8 more |
|
|
2101
|
+
| `asOf` | `Date \| number` | — | When the number was true - not when it was fetched. From `GivenProps`.<br>Shown in: [Say where a number came from (Given)](#given), [State when a number was true (Given)](#given), [The cost per stop of a day's tours (Worked examples)](#worked-examples) |
|
|
2102
|
+
| `ages` | `FreshnessAges` | — | The ages at which `asOf` turns stale and lost. With both, the given carries a freshness through core; with `asOf` alone, only the time. From `GivenProps`.<br>Shown in: [Say where a number came from (Given)](#given), [The cost per stop of a day's tours (Worked examples)](#worked-examples) |
|
|
2103
|
+
| `id` | `string` | — | Makes the quantity referable: `<Ref to>` stands for it elsewhere. Needed only for a quantity used more than once. From `QuantityProps`.<br>Shown in: [Fold a group of lines into one](#chain), [Put a chain inside a tree](#chain), [The availability of a service (Installation)](#installation) and 10 more |
|
|
2104
|
+
| `unit` | `string` | — | A label written after the number - "min", "pcs", "€". Never converted and never checked; the calculation does no unit algebra. From `QuantityProps`.<br>Shown in: [Take amounts away from a first quantity](#chain), [Mix additions and deductions](#chain), [Multiply between two interims](#chain) and 42 more |
|
|
2105
|
+
| `format` | `"percent"` | — | `percent` presents a plain ratio as per cent: 0.916 is shown as 91.6 %. The quantity stays a ratio in every operation. From `QuantityProps`.<br>Shown in: [Fold a group of lines into one](#chain), [Put a chain inside a tree](#chain), [Hold an interim to its limits](#chain) and 17 more |
|
|
2106
|
+
| `decimals` | `number` | one digit for a percentage, at most two for a derived number, a given as it was given | Fixed number of fraction digits as shown. Rounding happens only in presentation; every operation uses the full value. From `QuantityProps`.<br>Shown in: [Take amounts away from a first quantity](#chain), [Mix additions and deductions](#chain), [Multiply between two interims](#chain) and 29 more |
|
|
2107
|
+
| `target` | `number` | — | The value this quantity is meant to reach - missed, never violated. From `QuantityProps`.<br>Shown in: [Put a chain inside a tree](#chain), [The availability of a service (Installation)](#installation), [Write a tree (Calculation)](#calculation) and 6 more |
|
|
2108
|
+
| `limits` | `readonly ``Limit``[]` | — | Bounds the quantity is assessed against, through core's `assess()`. From `QuantityProps`.<br>Shown in: [Hold an interim to its limits](#chain), [Density (Calculation)](#calculation), [Hold a figure to its limits (Tree)](#tree) and 5 more |
|
|
2109
|
+
| `explanation` | `string` | — | A sentence of plain text beside the line: why the quantity is here, or what it means. From `QuantityProps`.<br>Shown in: [Say where a number came from (Given)](#given), [A number one metric does not have (Metrics)](#metrics), [Staff movement as a chain (Metrics)](#metrics) and 2 more |
|
|
2110
|
+
| `aside` | `ReactNode` | — | Content of the caller's own beside the line - a sparkline, a link. It never takes part in the calculation. From `QuantityProps`.<br>Shown in: [Say where a number came from (Given)](#given) |
|
|
2111
|
+
| `emphasis` | `"strong" \| "muted"` | — | How much the line stands out among the others ([ADR-0049](https://github.com/romanhaendler/umriss-ui/blob/main/docs/adr/0049-a-sum-takes-rows-from-data.md)): `strong` to be read first, `muted` to recede - a muted line still counts in full. Not on the Result, which is already the heaviest line. From `QuantityProps`.<br>Shown in: [A stronger line (Calculation)](#calculation), [A quieter line (Calculation)](#calculation), [Emphasis inside a group (Calculation)](#calculation) |
|
|
2112
|
+
| `rule` | `"above"` | — | `above` rules the line off from the ones before it, where a section starts that is not an interim. Not on the Result. From `QuantityProps`.<br>Shown in: [A rule above (Calculation)](#calculation), [Emphasis inside a group (Calculation)](#calculation) |
|
|
2121
2113
|
|
|
2122
2114
|
##### `QuantityProps`
|
|
2123
2115
|
|
|
2124
2116
|
| Prop | Type | Default | Description |
|
|
2125
2117
|
|---|---|---|---|
|
|
2126
|
-
| `label` *required* | `string` | — | What the quantity is called. It stands on its line, wherever it is an operand, and in the accessible sentence.<br>Shown in: [Take amounts away from a first quantity](
|
|
2127
|
-
| `id` | `string` | — | Makes the quantity referable: `<Ref to>` stands for it elsewhere. Needed only for a quantity used more than once.<br>Shown in: [Fold a group of lines into one](
|
|
2128
|
-
| `unit` | `string` | — | A label written after the number - "min", "pcs", "€". Never converted and never checked; the calculation does no unit algebra.<br>Shown in: [Take amounts away from a first quantity](
|
|
2129
|
-
| `format` | `"percent"` | — | `percent` presents a plain ratio as per cent: 0.916 is shown as 91.6 %. The quantity stays a ratio in every operation.<br>Shown in: [Fold a group of lines into one](
|
|
2130
|
-
| `decimals` | `number` | one digit for a percentage, at most two for a derived number, a given as it was given | Fixed number of fraction digits as shown. Rounding happens only in presentation; every operation uses the full value.<br>Shown in: [Take amounts away from a first quantity](
|
|
2131
|
-
| `target` | `number` | — | The value this quantity is meant to reach - missed, never violated.<br>Shown in: [Put a chain inside a tree](
|
|
2132
|
-
| `limits` | `readonly
|
|
2133
|
-
| `explanation` | `string` | — | A sentence of plain text beside the line: why the quantity is here, or what it means.<br>Shown in: [Say where a number came from (Given)](
|
|
2134
|
-
| `aside` | `ReactNode` | — | Content of the caller's own beside the line - a sparkline, a link. It never takes part in the calculation.<br>Shown in: [Say where a number came from (Given)](
|
|
2135
|
-
| `emphasis` | `"strong" \| "muted"` | — | How much the line stands out among the others ([ADR-0049](https://github.com/romanhaendler/umriss-ui/blob/main/docs/adr/0049-a-sum-takes-rows-from-data.md)): `strong` to be read first, `muted` to recede - a muted line still counts in full. Not on the Result, which is already the heaviest line.<br>Shown in: [A stronger line (Calculation)](
|
|
2136
|
-
| `rule` | `"above"` | — | `above` rules the line off from the ones before it, where a section starts that is not an interim. Not on the Result.<br>Shown in: [A rule above (Calculation)](
|
|
2118
|
+
| `label` *required* | `string` | — | What the quantity is called. It stands on its line, wherever it is an operand, and in the accessible sentence.<br>Shown in: [Take amounts away from a first quantity](#chain), [Mix additions and deductions](#chain), [Multiply between two interims](#chain) and 50 more |
|
|
2119
|
+
| `id` | `string` | — | Makes the quantity referable: `<Ref to>` stands for it elsewhere. Needed only for a quantity used more than once.<br>Shown in: [Fold a group of lines into one](#chain), [Put a chain inside a tree](#chain), [The availability of a service (Installation)](#installation) and 10 more |
|
|
2120
|
+
| `unit` | `string` | — | A label written after the number - "min", "pcs", "€". Never converted and never checked; the calculation does no unit algebra.<br>Shown in: [Take amounts away from a first quantity](#chain), [Mix additions and deductions](#chain), [Multiply between two interims](#chain) and 42 more |
|
|
2121
|
+
| `format` | `"percent"` | — | `percent` presents a plain ratio as per cent: 0.916 is shown as 91.6 %. The quantity stays a ratio in every operation.<br>Shown in: [Fold a group of lines into one](#chain), [Put a chain inside a tree](#chain), [Hold an interim to its limits](#chain) and 17 more |
|
|
2122
|
+
| `decimals` | `number` | one digit for a percentage, at most two for a derived number, a given as it was given | Fixed number of fraction digits as shown. Rounding happens only in presentation; every operation uses the full value.<br>Shown in: [Take amounts away from a first quantity](#chain), [Mix additions and deductions](#chain), [Multiply between two interims](#chain) and 29 more |
|
|
2123
|
+
| `target` | `number` | — | The value this quantity is meant to reach - missed, never violated.<br>Shown in: [Put a chain inside a tree](#chain), [The availability of a service (Installation)](#installation), [Write a tree (Calculation)](#calculation) and 6 more |
|
|
2124
|
+
| `limits` | `readonly ``Limit``[]` | — | Bounds the quantity is assessed against, through core's `assess()`.<br>Shown in: [Hold an interim to its limits](#chain), [Density (Calculation)](#calculation), [Hold a figure to its limits (Tree)](#tree) and 5 more |
|
|
2125
|
+
| `explanation` | `string` | — | A sentence of plain text beside the line: why the quantity is here, or what it means.<br>Shown in: [Say where a number came from (Given)](#given), [A number one metric does not have (Metrics)](#metrics), [Staff movement as a chain (Metrics)](#metrics) and 2 more |
|
|
2126
|
+
| `aside` | `ReactNode` | — | Content of the caller's own beside the line - a sparkline, a link. It never takes part in the calculation.<br>Shown in: [Say where a number came from (Given)](#given) |
|
|
2127
|
+
| `emphasis` | `"strong" \| "muted"` | — | How much the line stands out among the others ([ADR-0049](https://github.com/romanhaendler/umriss-ui/blob/main/docs/adr/0049-a-sum-takes-rows-from-data.md)): `strong` to be read first, `muted` to recede - a muted line still counts in full. Not on the Result, which is already the heaviest line.<br>Shown in: [A stronger line (Calculation)](#calculation), [A quieter line (Calculation)](#calculation), [Emphasis inside a group (Calculation)](#calculation) |
|
|
2128
|
+
| `rule` | `"above"` | — | `above` rules the line off from the ones before it, where a section starts that is not an interim. Not on the Result.<br>Shown in: [A rule above (Calculation)](#calculation), [Emphasis inside a group (Calculation)](#calculation) |
|
|
2137
2129
|
|
|
2138
2130
|
##### Types on this page
|
|
2139
2131
|
|
|
@@ -2174,9 +2166,9 @@ force a `null` on one edge in the one-sided case.
|
|
|
2174
2166
|
|
|
2175
2167
|
| Prop | Type | Default | Description |
|
|
2176
2168
|
|---|---|---|---|
|
|
2177
|
-
| `value` *required* | `number` | — | <br>Shown in: [Hold an interim to its limits](
|
|
2178
|
-
| `side` *required* |
|
|
2179
|
-
| `severity` *required* |
|
|
2169
|
+
| `value` *required* | `number` | — | <br>Shown in: [Hold an interim to its limits](#chain), [Density (Calculation)](#calculation), [Hold a figure to its limits (Tree)](#tree) and 3 more |
|
|
2170
|
+
| `side` *required* | `Side`<br>`"upper" \| "lower"` | — | <br>Shown in: [Hold an interim to its limits](#chain), [Density (Calculation)](#calculation), [Hold a figure to its limits (Tree)](#tree) and 3 more |
|
|
2171
|
+
| `severity` *required* | `Severity`<br>`"warning" \| "alarm"` | — | <br>Shown in: [Hold an interim to its limits](#chain), [Density (Calculation)](#calculation), [Hold a figure to its limits (Tree)](#tree) and 3 more |
|
|
2180
2172
|
|
|
2181
2173
|
###### `Side`
|
|
2182
2174
|
|
|
@@ -2204,7 +2196,7 @@ type Severity = "warning" | "alarm";
|
|
|
2204
2196
|
|
|
2205
2197
|
- A chain in view does not fold; as an operand of a tree it folds to its last interim.
|
|
2206
2198
|
|
|
2207
|
-
What umriss deliberately does not build, and why: [ADR-0032](https://
|
|
2199
|
+
What umriss deliberately does not build, and why: [ADR-0032](https://github.com/romanhaendler/umriss-ui/blob/calculation-v0.42.0/docs/adr/0032-what-umriss-is-not.md).
|
|
2208
2200
|
|
|
2209
2201
|
### Rows from data
|
|
2210
2202
|
|
|
@@ -2214,8 +2206,6 @@ Rows that come from data (line items, corrections, allowances), however many the
|
|
|
2214
2206
|
import { Sum, Plus, Minus } from "@umriss-ui/calculation";
|
|
2215
2207
|
```
|
|
2216
2208
|
|
|
2217
|
-
Demo page: https://romanhaendler.github.io/umriss-ui/calculation/rows-from-data/
|
|
2218
|
-
|
|
2219
2209
|
A `Sum` takes the rows of an array as they come: many, one, or none. With one it still folds and opens onto that one; with none it is worth zero, has nothing to open, and says "no entries" where its formula would stand. The line keeps its place either way, so the statement does not change shape with the data ([ADR-0049](https://github.com/romanhaendler/umriss-ui/blob/main/docs/adr/0049-a-sum-takes-rows-from-data.md)).
|
|
2220
2210
|
|
|
2221
2211
|
Rows of both signs go into the sum as they come. A line that adds or takes away shows its contribution: the direction as its operator, the number without a sign – "− Overpaid travel 120.00", never "+ -120.00". The quantity itself keeps its sign where its derivation closes, as an interim, as the result and wherever it is referenced. A factor keeps its sign; a line worth zero or missing keeps the operator it is written with.
|
|
@@ -2566,87 +2556,87 @@ export default function RowsOfBothSignsWithMetrics() {
|
|
|
2566
2556
|
|
|
2567
2557
|
#### Keyboard
|
|
2568
2558
|
|
|
2569
|
-
The keys of [Calculation](
|
|
2559
|
+
The keys of [Calculation](#calculation) apply here.
|
|
2570
2560
|
|
|
2571
2561
|
#### Props on this page
|
|
2572
2562
|
|
|
2573
|
-
From `CalculationProps` — the full table stands on [Calculation](
|
|
2563
|
+
From `CalculationProps` — the full table stands on [Calculation](#calculation).
|
|
2574
2564
|
|
|
2575
2565
|
| Prop | Type | Default | Description |
|
|
2576
2566
|
|---|---|---|---|
|
|
2577
|
-
| [`children`](
|
|
2578
|
-
| [`metrics`](
|
|
2567
|
+
| [`children`](#calculation) *required* | `ReactNode` | — | The result: exactly one quantity - a tree (`<Sum>`, `<Difference>`, `<Product>`, `<Quotient>` with their operands, `<Given>` as leaves) or a `<Chain>`, the two mixing freely; `<Ref>` for a quantity defined elsewhere. |
|
|
2568
|
+
| [`metrics`](#calculation) | `readonly `[`Metric`](#metrics)`[]` | — | Several numbers per quantity, side by side - headcount and full-time equivalents of the same teams ([ADR-0038](https://github.com/romanhaendler/umriss-ui/blob/main/docs/adr/0038-a-calculation-can-carry-several-metrics.md)). Every `value` is then an object with a number for each metric id; unit and places are the metric's. A calculation with metrics only adds and subtracts, and assesses no target or limits. |
|
|
2579
2569
|
|
|
2580
|
-
From `OperatorProps` — the full table stands on [Tree](
|
|
2570
|
+
From `OperatorProps` — the full table stands on [Tree](#tree).
|
|
2581
2571
|
|
|
2582
2572
|
| Prop | Type | Default | Description |
|
|
2583
2573
|
|---|---|---|---|
|
|
2584
|
-
| [`children`](
|
|
2585
|
-
| [`label`](
|
|
2586
|
-
| [`id`](
|
|
2587
|
-
| [`unit`](
|
|
2588
|
-
| [`format`](
|
|
2589
|
-
| [`decimals`](
|
|
2574
|
+
| [`children`](#tree) | `ReactNode` | — | The operands, in order: quantities, givens and references. |
|
|
2575
|
+
| [`label`](#tree) *required* | `string` | — | What the quantity is called. It stands on its line, wherever it is an operand, and in the accessible sentence. From `QuantityProps`. |
|
|
2576
|
+
| [`id`](#tree) | `string` | — | Makes the quantity referable: `<Ref to>` stands for it elsewhere. Needed only for a quantity used more than once. From `QuantityProps`. |
|
|
2577
|
+
| [`unit`](#tree) | `string` | — | A label written after the number - "min", "pcs", "€". Never converted and never checked; the calculation does no unit algebra. From `QuantityProps`. |
|
|
2578
|
+
| [`format`](#tree) | `"percent"` | — | `percent` presents a plain ratio as per cent: 0.916 is shown as 91.6 %. The quantity stays a ratio in every operation. From `QuantityProps`. |
|
|
2579
|
+
| [`decimals`](#tree) | `number` | one digit for a percentage, at most two for a derived number, a given as it was given | Fixed number of fraction digits as shown. Rounding happens only in presentation; every operation uses the full value. From `QuantityProps`. |
|
|
2590
2580
|
|
|
2591
|
-
From `RefProps` — the full table stands on [Tree](
|
|
2581
|
+
From `RefProps` — the full table stands on [Tree](#tree).
|
|
2592
2582
|
|
|
2593
2583
|
| Prop | Type | Default | Description |
|
|
2594
2584
|
|---|---|---|---|
|
|
2595
|
-
| [`to`](
|
|
2585
|
+
| [`to`](#tree) *required* | `string` | — | The `id` of the quantity this reference stands for. |
|
|
2596
2586
|
|
|
2597
|
-
From `ChainProps` — the full table stands on [Chain](
|
|
2587
|
+
From `ChainProps` — the full table stands on [Chain](#chain).
|
|
2598
2588
|
|
|
2599
2589
|
| Prop | Type | Default | Description |
|
|
2600
2590
|
|---|---|---|---|
|
|
2601
|
-
| [`children`](
|
|
2591
|
+
| [`children`](#chain) | `ReactNode` | — | The operands, top to bottom: a first quantity with no operator, then `Plus`, `Minus`, `Times` and `DividedBy` with their operands and `Interim`s naming the value where they stand. The last line is an `Interim`; a `Times` or `DividedBy` stands alone between two named values. |
|
|
2602
2592
|
|
|
2603
|
-
From `ChainOperandProps` — the full table stands on [Chain](
|
|
2593
|
+
From `ChainOperandProps` — the full table stands on [Chain](#chain).
|
|
2604
2594
|
|
|
2605
2595
|
| Prop | Type | Default | Description |
|
|
2606
2596
|
|---|---|---|---|
|
|
2607
|
-
| [`label`](
|
|
2608
|
-
| [`value`](
|
|
2609
|
-
| [`children`](
|
|
2610
|
-
| [`id`](
|
|
2611
|
-
| [`unit`](
|
|
2612
|
-
| [`format`](
|
|
2613
|
-
| [`decimals`](
|
|
2597
|
+
| [`label`](#chain) | `string` | — | The operand's name, where the line is a given written in place. Left out where the line holds a quantity as its child. |
|
|
2598
|
+
| [`value`](#chain) | `number \| null \| `[`MetricValues`](#chain) | — | The operand's number, where the line is a given written in place. Absent as for a `Given`: the line and every interim after it are absent, with the reason. With `metrics`, an object by metric id, as on a `Given`. |
|
|
2599
|
+
| [`children`](#chain) | `ReactNode` | — | Instead of `label` and `value`: exactly one quantity - a tree, a `<Ref>` or a `<Chain>`. |
|
|
2600
|
+
| [`id`](#chain) | `string` | — | Makes the quantity referable: `<Ref to>` stands for it elsewhere. Needed only for a quantity used more than once. From `QuantityProps`. |
|
|
2601
|
+
| [`unit`](#chain) | `string` | — | A label written after the number - "min", "pcs", "€". Never converted and never checked; the calculation does no unit algebra. From `QuantityProps`. |
|
|
2602
|
+
| [`format`](#chain) | `"percent"` | — | `percent` presents a plain ratio as per cent: 0.916 is shown as 91.6 %. The quantity stays a ratio in every operation. From `QuantityProps`. |
|
|
2603
|
+
| [`decimals`](#chain) | `number` | one digit for a percentage, at most two for a derived number, a given as it was given | Fixed number of fraction digits as shown. Rounding happens only in presentation; every operation uses the full value. From `QuantityProps`. |
|
|
2614
2604
|
|
|
2615
|
-
From `QuantityProps` — the full table stands on [Chain](
|
|
2605
|
+
From `QuantityProps` — the full table stands on [Chain](#chain).
|
|
2616
2606
|
|
|
2617
2607
|
| Prop | Type | Default | Description |
|
|
2618
2608
|
|---|---|---|---|
|
|
2619
|
-
| [`label`](
|
|
2620
|
-
| [`id`](
|
|
2621
|
-
| [`unit`](
|
|
2622
|
-
| [`format`](
|
|
2623
|
-
| [`decimals`](
|
|
2609
|
+
| [`label`](#chain) *required* | `string` | — | What the quantity is called. It stands on its line, wherever it is an operand, and in the accessible sentence. |
|
|
2610
|
+
| [`id`](#chain) | `string` | — | Makes the quantity referable: `<Ref to>` stands for it elsewhere. Needed only for a quantity used more than once. |
|
|
2611
|
+
| [`unit`](#chain) | `string` | — | A label written after the number - "min", "pcs", "€". Never converted and never checked; the calculation does no unit algebra. |
|
|
2612
|
+
| [`format`](#chain) | `"percent"` | — | `percent` presents a plain ratio as per cent: 0.916 is shown as 91.6 %. The quantity stays a ratio in every operation. |
|
|
2613
|
+
| [`decimals`](#chain) | `number` | one digit for a percentage, at most two for a derived number, a given as it was given | Fixed number of fraction digits as shown. Rounding happens only in presentation; every operation uses the full value. |
|
|
2624
2614
|
|
|
2625
|
-
From `GivenProps` — the full table stands on [Given](
|
|
2615
|
+
From `GivenProps` — the full table stands on [Given](#given).
|
|
2626
2616
|
|
|
2627
2617
|
| Prop | Type | Default | Description |
|
|
2628
2618
|
|---|---|---|---|
|
|
2629
|
-
| [`value`](
|
|
2630
|
-
| [`label`](
|
|
2631
|
-
| [`id`](
|
|
2632
|
-
| [`unit`](
|
|
2633
|
-
| [`format`](
|
|
2634
|
-
| [`decimals`](
|
|
2619
|
+
| [`value`](#given) *required* | `number \| null \| undefined \| `[`MetricValues`](#given) | — | The number the calculation starts from. Absent (`null`, `undefined`, not finite) makes every quantity that depends on it absent, with the reason - never zero. Where the calculation has `metrics`, an object with a number for each metric id instead; absence then stays in its metric. |
|
|
2620
|
+
| [`label`](#given) *required* | `string` | — | What the quantity is called. It stands on its line, wherever it is an operand, and in the accessible sentence. From `QuantityProps`. |
|
|
2621
|
+
| [`id`](#given) | `string` | — | Makes the quantity referable: `<Ref to>` stands for it elsewhere. Needed only for a quantity used more than once. From `QuantityProps`. |
|
|
2622
|
+
| [`unit`](#given) | `string` | — | A label written after the number - "min", "pcs", "€". Never converted and never checked; the calculation does no unit algebra. From `QuantityProps`. |
|
|
2623
|
+
| [`format`](#given) | `"percent"` | — | `percent` presents a plain ratio as per cent: 0.916 is shown as 91.6 %. The quantity stays a ratio in every operation. From `QuantityProps`. |
|
|
2624
|
+
| [`decimals`](#given) | `number` | one digit for a percentage, at most two for a derived number, a given as it was given | Fixed number of fraction digits as shown. Rounding happens only in presentation; every operation uses the full value. From `QuantityProps`. |
|
|
2635
2625
|
|
|
2636
|
-
From `Metric` — the full table stands on [Metrics](
|
|
2626
|
+
From `Metric` — the full table stands on [Metrics](#metrics).
|
|
2637
2627
|
|
|
2638
2628
|
| Prop | Type | Default | Description |
|
|
2639
2629
|
|---|---|---|---|
|
|
2640
|
-
| [`id`](
|
|
2641
|
-
| [`label`](
|
|
2642
|
-
| [`unit`](
|
|
2643
|
-
| [`decimals`](
|
|
2630
|
+
| [`id`](#metrics) *required* | `string` | — | The key of this metric's number in every `value` object. |
|
|
2631
|
+
| [`label`](#metrics) *required* | `string` | — | The metric's name, in the head above its column and in each row's sentence. |
|
|
2632
|
+
| [`unit`](#metrics) | `string` | — | A label written after the number where a result closes, and beneath the metric's name in the head. Never converted and never checked. |
|
|
2633
|
+
| [`decimals`](#metrics) | `number` | a given as it was given, at most two for a derived number | Fixed number of fraction digits as shown, for every quantity of this metric. |
|
|
2644
2634
|
|
|
2645
2635
|
#### Known limits
|
|
2646
2636
|
|
|
2647
2637
|
- Only a sum takes any count: an empty product, a difference of one and a quotient of anything but two still fail on the first render.
|
|
2648
2638
|
|
|
2649
|
-
What umriss deliberately does not build, and why: [ADR-0032](https://
|
|
2639
|
+
What umriss deliberately does not build, and why: [ADR-0032](https://github.com/romanhaendler/umriss-ui/blob/calculation-v0.42.0/docs/adr/0032-what-umriss-is-not.md).
|
|
2650
2640
|
|
|
2651
2641
|
### Given
|
|
2652
2642
|
|
|
@@ -2656,8 +2646,6 @@ The numbers a calculation starts from (inputs, leaves): where they came from, wh
|
|
|
2656
2646
|
import { Given } from "@umriss-ui/calculation";
|
|
2657
2647
|
```
|
|
2658
2648
|
|
|
2659
|
-
Demo page: https://romanhaendler.github.io/umriss-ui/calculation/given/
|
|
2660
|
-
|
|
2661
2649
|
A given with `asOf` and `ages` carries a freshness through core, as a `Stat` does – beside the number, never instead of its verdict. There are no default ages.
|
|
2662
2650
|
|
|
2663
2651
|
The operator words, the reasons for absence and the number formats are core's wording; German comes from `@umriss-ui/core/wording/de` ([ADR-0019](https://github.com/romanhaendler/umriss-ui/blob/main/docs/adr/0019-two-wordings-ship-english-is-the-default.md)).
|
|
@@ -2745,7 +2733,7 @@ export default function InGerman() {
|
|
|
2745
2733
|
|
|
2746
2734
|
#### Keyboard
|
|
2747
2735
|
|
|
2748
|
-
The keys of [Calculation](
|
|
2736
|
+
The keys of [Calculation](#calculation) apply here.
|
|
2749
2737
|
|
|
2750
2738
|
#### API
|
|
2751
2739
|
|
|
@@ -2753,21 +2741,21 @@ The keys of [Calculation](#/calculation/keyboard-calculation) apply here.
|
|
|
2753
2741
|
|
|
2754
2742
|
| Prop | Type | Default | Description |
|
|
2755
2743
|
|---|---|---|---|
|
|
2756
|
-
| `value` *required* | `number \| null \| undefined \|
|
|
2757
|
-
| `source` | `string` | — | Where the number came from: a system, a report, a person.<br>Shown in: [Say where a number came from](
|
|
2758
|
-
| `asOf` | `Date \| number` | — | When the number was true - not when it was fetched.<br>Shown in: [Say where a number came from](
|
|
2759
|
-
| `ages` |
|
|
2760
|
-
| `label` *required* | `string` | — | What the quantity is called. It stands on its line, wherever it is an operand, and in the accessible sentence. From `QuantityProps`.<br>Shown in: [Say where a number came from](
|
|
2761
|
-
| `id` | `string` | — | Makes the quantity referable: `<Ref to>` stands for it elsewhere. Needed only for a quantity used more than once. From `QuantityProps`.<br>Shown in: [Read in German](
|
|
2762
|
-
| `unit` | `string` | — | A label written after the number - "min", "pcs", "€". Never converted and never checked; the calculation does no unit algebra. From `QuantityProps`.<br>Shown in: [Say where a number came from](
|
|
2763
|
-
| `format` | `"percent"` | — | `percent` presents a plain ratio as per cent: 0.916 is shown as 91.6 %. The quantity stays a ratio in every operation. From `QuantityProps`.<br>Shown in: [Say where a number came from](
|
|
2764
|
-
| `decimals` | `number` | one digit for a percentage, at most two for a derived number, a given as it was given | Fixed number of fraction digits as shown. Rounding happens only in presentation; every operation uses the full value. From `QuantityProps`.<br>Shown in: [Say where a number came from](
|
|
2765
|
-
| `target` | `number` | — | The value this quantity is meant to reach - missed, never violated. From `QuantityProps`.<br>Shown in: [The availability of a service (Installation)](
|
|
2766
|
-
| `limits` | `readonly
|
|
2767
|
-
| `explanation` | `string` | — | A sentence of plain text beside the line: why the quantity is here, or what it means. From `QuantityProps`.<br>Shown in: [Say where a number came from](
|
|
2768
|
-
| `aside` | `ReactNode` | — | Content of the caller's own beside the line - a sparkline, a link. It never takes part in the calculation. From `QuantityProps`.<br>Shown in: [Say where a number came from](
|
|
2769
|
-
| `emphasis` | `"strong" \| "muted"` | — | How much the line stands out among the others ([ADR-0049](https://github.com/romanhaendler/umriss-ui/blob/main/docs/adr/0049-a-sum-takes-rows-from-data.md)): `strong` to be read first, `muted` to recede - a muted line still counts in full. Not on the Result, which is already the heaviest line. From `QuantityProps`.<br>Shown in: [A stronger line (Calculation)](
|
|
2770
|
-
| `rule` | `"above"` | — | `above` rules the line off from the ones before it, where a section starts that is not an interim. Not on the Result. From `QuantityProps`.<br>Shown in: [A rule above (Calculation)](
|
|
2744
|
+
| `value` *required* | `number \| null \| undefined \| ``MetricValues` | — | The number the calculation starts from. Absent (`null`, `undefined`, not finite) makes every quantity that depends on it absent, with the reason - never zero. Where the calculation has `metrics`, an object with a number for each metric id instead; absence then stays in its metric.<br>Shown in: [Say where a number came from](#given), [State when a number was true](#given), [Read in German](#given) and 50 more |
|
|
2745
|
+
| `source` | `string` | — | Where the number came from: a system, a report, a person.<br>Shown in: [Say where a number came from](#given), [State when a number was true](#given), [Staff movement as a chain (Metrics)](#metrics) and 8 more |
|
|
2746
|
+
| `asOf` | `Date \| number` | — | When the number was true - not when it was fetched.<br>Shown in: [Say where a number came from](#given), [State when a number was true](#given), [The cost per stop of a day's tours (Worked examples)](#worked-examples) |
|
|
2747
|
+
| `ages` | `FreshnessAges` | — | The ages at which `asOf` turns stale and lost. With both, the given carries a freshness through core; with `asOf` alone, only the time.<br>Shown in: [Say where a number came from](#given), [The cost per stop of a day's tours (Worked examples)](#worked-examples) |
|
|
2748
|
+
| `label` *required* | `string` | — | What the quantity is called. It stands on its line, wherever it is an operand, and in the accessible sentence. From `QuantityProps`.<br>Shown in: [Say where a number came from](#given), [State when a number was true](#given), [Read in German](#given) and 50 more |
|
|
2749
|
+
| `id` | `string` | — | Makes the quantity referable: `<Ref to>` stands for it elsewhere. Needed only for a quantity used more than once. From `QuantityProps`.<br>Shown in: [Read in German](#given), [The availability of a service (Installation)](#installation), [Write a tree (Calculation)](#calculation) and 10 more |
|
|
2750
|
+
| `unit` | `string` | — | A label written after the number - "min", "pcs", "€". Never converted and never checked; the calculation does no unit algebra. From `QuantityProps`.<br>Shown in: [Say where a number came from](#given), [State when a number was true](#given), [Read in German](#given) and 42 more |
|
|
2751
|
+
| `format` | `"percent"` | — | `percent` presents a plain ratio as per cent: 0.916 is shown as 91.6 %. The quantity stays a ratio in every operation. From `QuantityProps`.<br>Shown in: [Say where a number came from](#given), [Read in German](#given), [The availability of a service (Installation)](#installation) and 17 more |
|
|
2752
|
+
| `decimals` | `number` | one digit for a percentage, at most two for a derived number, a given as it was given | Fixed number of fraction digits as shown. Rounding happens only in presentation; every operation uses the full value. From `QuantityProps`.<br>Shown in: [Say where a number came from](#given), [State when a number was true](#given), [Read in German](#given) and 29 more |
|
|
2753
|
+
| `target` | `number` | — | The value this quantity is meant to reach - missed, never violated. From `QuantityProps`.<br>Shown in: [The availability of a service (Installation)](#installation), [Write a tree (Calculation)](#calculation), [Density (Calculation)](#calculation) and 6 more |
|
|
2754
|
+
| `limits` | `readonly ``Limit``[]` | — | Bounds the quantity is assessed against, through core's `assess()`. From `QuantityProps`.<br>Shown in: [Say where a number came from](#given), [Density (Calculation)](#calculation), [Hold a figure to its limits (Tree)](#tree) and 5 more |
|
|
2755
|
+
| `explanation` | `string` | — | A sentence of plain text beside the line: why the quantity is here, or what it means. From `QuantityProps`.<br>Shown in: [Say where a number came from](#given), [A number one metric does not have (Metrics)](#metrics), [Staff movement as a chain (Metrics)](#metrics) and 2 more |
|
|
2756
|
+
| `aside` | `ReactNode` | — | Content of the caller's own beside the line - a sparkline, a link. It never takes part in the calculation. From `QuantityProps`.<br>Shown in: [Say where a number came from](#given) |
|
|
2757
|
+
| `emphasis` | `"strong" \| "muted"` | — | How much the line stands out among the others ([ADR-0049](https://github.com/romanhaendler/umriss-ui/blob/main/docs/adr/0049-a-sum-takes-rows-from-data.md)): `strong` to be read first, `muted` to recede - a muted line still counts in full. Not on the Result, which is already the heaviest line. From `QuantityProps`.<br>Shown in: [A stronger line (Calculation)](#calculation), [A quieter line (Calculation)](#calculation), [Emphasis inside a group (Calculation)](#calculation) |
|
|
2758
|
+
| `rule` | `"above"` | — | `above` rules the line off from the ones before it, where a section starts that is not an interim. Not on the Result. From `QuantityProps`.<br>Shown in: [A rule above (Calculation)](#calculation), [Emphasis inside a group (Calculation)](#calculation) |
|
|
2771
2759
|
|
|
2772
2760
|
##### Types on this page
|
|
2773
2761
|
|
|
@@ -2808,9 +2796,9 @@ force a `null` on one edge in the one-sided case.
|
|
|
2808
2796
|
|
|
2809
2797
|
| Prop | Type | Default | Description |
|
|
2810
2798
|
|---|---|---|---|
|
|
2811
|
-
| `value` *required* | `number` | — | <br>Shown in: [Say where a number came from](
|
|
2812
|
-
| `side` *required* |
|
|
2813
|
-
| `severity` *required* |
|
|
2799
|
+
| `value` *required* | `number` | — | <br>Shown in: [Say where a number came from](#given), [Density (Calculation)](#calculation), [Hold a figure to its limits (Tree)](#tree) and 3 more |
|
|
2800
|
+
| `side` *required* | `Side`<br>`"upper" \| "lower"` | — | <br>Shown in: [Say where a number came from](#given), [Density (Calculation)](#calculation), [Hold a figure to its limits (Tree)](#tree) and 3 more |
|
|
2801
|
+
| `severity` *required* | `Severity`<br>`"warning" \| "alarm"` | — | <br>Shown in: [Say where a number came from](#given), [Density (Calculation)](#calculation), [Hold a figure to its limits (Tree)](#tree) and 3 more |
|
|
2814
2802
|
|
|
2815
2803
|
###### `Side`
|
|
2816
2804
|
|
|
@@ -2842,8 +2830,6 @@ Several numbers on every line, side by side (columns, measures): headcount and f
|
|
|
2842
2830
|
import { Calculation, Given, Sum, Chain, Plus, Minus, Interim } from "@umriss-ui/calculation";
|
|
2843
2831
|
```
|
|
2844
2832
|
|
|
2845
|
-
Demo page: https://romanhaendler.github.io/umriss-ui/calculation/metrics/
|
|
2846
|
-
|
|
2847
2833
|
`metrics` on the calculation names each metric once, with its unit and places; every `value` is then an object with a number for each metric id. Each metric is worked on its own - nothing ever takes numbers from two of them ([ADR-0038](https://github.com/romanhaendler/umriss-ui/blob/main/docs/adr/0038-a-calculation-can-carry-several-metrics.md)).
|
|
2848
2834
|
|
|
2849
2835
|
The head names each metric above its column. The unit stands again only where a result closes: the Result, an interim, the line that closes an open derivation.
|
|
@@ -3317,7 +3303,7 @@ export default function CompactReport() {
|
|
|
3317
3303
|
|
|
3318
3304
|
#### Keyboard
|
|
3319
3305
|
|
|
3320
|
-
The keys of [Calculation](
|
|
3306
|
+
The keys of [Calculation](#calculation) apply here.
|
|
3321
3307
|
|
|
3322
3308
|
#### API
|
|
3323
3309
|
|
|
@@ -3325,10 +3311,10 @@ The keys of [Calculation](#/calculation/keyboard-calculation) apply here.
|
|
|
3325
3311
|
|
|
3326
3312
|
| Prop | Type | Default | Description |
|
|
3327
3313
|
|---|---|---|---|
|
|
3328
|
-
| `id` *required* | `string` | — | The key of this metric's number in every `value` object.<br>Shown in: [Headcount and full-time equivalents](
|
|
3329
|
-
| `label` *required* | `string` | — | The metric's name, in the head above its column and in each row's sentence.<br>Shown in: [Headcount and full-time equivalents](
|
|
3330
|
-
| `unit` | `string` | — | A label written after the number where a result closes, and beneath the metric's name in the head. Never converted and never checked.<br>Shown in: [Headcount and full-time equivalents](
|
|
3331
|
-
| `decimals` | `number` | a given as it was given, at most two for a derived number | Fixed number of fraction digits as shown, for every quantity of this metric.<br>Shown in: [Headcount and full-time equivalents](
|
|
3314
|
+
| `id` *required* | `string` | — | The key of this metric's number in every `value` object.<br>Shown in: [Headcount and full-time equivalents](#metrics), [A number one metric does not have](#metrics), [Team, cost centre, business line](#metrics) and 5 more |
|
|
3315
|
+
| `label` *required* | `string` | — | The metric's name, in the head above its column and in each row's sentence.<br>Shown in: [Headcount and full-time equivalents](#metrics), [A number one metric does not have](#metrics), [Team, cost centre, business line](#metrics) and 5 more |
|
|
3316
|
+
| `unit` | `string` | — | A label written after the number where a result closes, and beneath the metric's name in the head. Never converted and never checked.<br>Shown in: [Headcount and full-time equivalents](#metrics), [A number one metric does not have](#metrics), [Team, cost centre, business line](#metrics) and 5 more |
|
|
3317
|
+
| `decimals` | `number` | a given as it was given, at most two for a derived number | Fixed number of fraction digits as shown, for every quantity of this metric.<br>Shown in: [Headcount and full-time equivalents](#metrics), [A number one metric does not have](#metrics), [Team, cost centre, business line](#metrics) and 5 more |
|
|
3332
3318
|
|
|
3333
3319
|
#### Known limits
|
|
3334
3320
|
|
|
@@ -3336,7 +3322,7 @@ The keys of [Calculation](#/calculation/keyboard-calculation) apply here.
|
|
|
3336
3322
|
- Unit, format and places belong to the metric; on a quantity they fail on the first render, and so does a missing or unknown metric key in a `value`.
|
|
3337
3323
|
- No target or limits with metrics: an assessment per cell is not there yet.
|
|
3338
3324
|
|
|
3339
|
-
What umriss deliberately does not build, and why: [ADR-0032](https://
|
|
3325
|
+
What umriss deliberately does not build, and why: [ADR-0032](https://github.com/romanhaendler/umriss-ui/blob/calculation-v0.42.0/docs/adr/0032-what-umriss-is-not.md).
|
|
3340
3326
|
|
|
3341
3327
|
## In practice
|
|
3342
3328
|
|
|
@@ -3350,8 +3336,6 @@ A number not there yet, a division by zero, rounded figures that do not add up,
|
|
|
3350
3336
|
import { Calculation } from "@umriss-ui/calculation";
|
|
3351
3337
|
```
|
|
3352
3338
|
|
|
3353
|
-
Demo page: https://romanhaendler.github.io/umriss-ui/calculation/what-can-go-wrong/
|
|
3354
|
-
|
|
3355
3339
|
An absent given is never zero: every quantity that depends on it is absent too, with the reason, up to the result. A quotient by zero is absent with its own reason.
|
|
3356
3340
|
|
|
3357
3341
|
#### Examples
|
|
@@ -3472,69 +3456,69 @@ export default function LimitInside() {
|
|
|
3472
3456
|
|
|
3473
3457
|
#### Keyboard
|
|
3474
3458
|
|
|
3475
|
-
The keys of [Calculation](
|
|
3459
|
+
The keys of [Calculation](#calculation) apply here.
|
|
3476
3460
|
|
|
3477
3461
|
#### Props on this page
|
|
3478
3462
|
|
|
3479
|
-
From `CalculationProps` — the full table stands on [Calculation](
|
|
3463
|
+
From `CalculationProps` — the full table stands on [Calculation](#calculation).
|
|
3480
3464
|
|
|
3481
3465
|
| Prop | Type | Default | Description |
|
|
3482
3466
|
|---|---|---|---|
|
|
3483
|
-
| [`children`](
|
|
3467
|
+
| [`children`](#calculation) *required* | `ReactNode` | — | The result: exactly one quantity - a tree (`<Sum>`, `<Difference>`, `<Product>`, `<Quotient>` with their operands, `<Given>` as leaves) or a `<Chain>`, the two mixing freely; `<Ref>` for a quantity defined elsewhere. |
|
|
3484
3468
|
|
|
3485
|
-
From `OperatorProps` — the full table stands on [Tree](
|
|
3469
|
+
From `OperatorProps` — the full table stands on [Tree](#tree).
|
|
3486
3470
|
|
|
3487
3471
|
| Prop | Type | Default | Description |
|
|
3488
3472
|
|---|---|---|---|
|
|
3489
|
-
| [`children`](
|
|
3490
|
-
| [`label`](
|
|
3491
|
-
| [`unit`](
|
|
3492
|
-
| [`format`](
|
|
3493
|
-
| [`decimals`](
|
|
3494
|
-
| [`target`](
|
|
3495
|
-
| [`limits`](
|
|
3473
|
+
| [`children`](#tree) | `ReactNode` | — | The operands, in order: quantities, givens and references. |
|
|
3474
|
+
| [`label`](#tree) *required* | `string` | — | What the quantity is called. It stands on its line, wherever it is an operand, and in the accessible sentence. From `QuantityProps`. |
|
|
3475
|
+
| [`unit`](#tree) | `string` | — | A label written after the number - "min", "pcs", "€". Never converted and never checked; the calculation does no unit algebra. From `QuantityProps`. |
|
|
3476
|
+
| [`format`](#tree) | `"percent"` | — | `percent` presents a plain ratio as per cent: 0.916 is shown as 91.6 %. The quantity stays a ratio in every operation. From `QuantityProps`. |
|
|
3477
|
+
| [`decimals`](#tree) | `number` | one digit for a percentage, at most two for a derived number, a given as it was given | Fixed number of fraction digits as shown. Rounding happens only in presentation; every operation uses the full value. From `QuantityProps`. |
|
|
3478
|
+
| [`target`](#tree) | `number` | — | The value this quantity is meant to reach - missed, never violated. From `QuantityProps`. |
|
|
3479
|
+
| [`limits`](#tree) | `readonly `[`Limit`](#tree)`[]` | — | Bounds the quantity is assessed against, through core's `assess()`. From `QuantityProps`. |
|
|
3496
3480
|
|
|
3497
|
-
From `ChainProps` — the full table stands on [Chain](
|
|
3481
|
+
From `ChainProps` — the full table stands on [Chain](#chain).
|
|
3498
3482
|
|
|
3499
3483
|
| Prop | Type | Default | Description |
|
|
3500
3484
|
|---|---|---|---|
|
|
3501
|
-
| [`children`](
|
|
3485
|
+
| [`children`](#chain) | `ReactNode` | — | The operands, top to bottom: a first quantity with no operator, then `Plus`, `Minus`, `Times` and `DividedBy` with their operands and `Interim`s naming the value where they stand. The last line is an `Interim`; a `Times` or `DividedBy` stands alone between two named values. |
|
|
3502
3486
|
|
|
3503
|
-
From `ChainOperandProps` — the full table stands on [Chain](
|
|
3487
|
+
From `ChainOperandProps` — the full table stands on [Chain](#chain).
|
|
3504
3488
|
|
|
3505
3489
|
| Prop | Type | Default | Description |
|
|
3506
3490
|
|---|---|---|---|
|
|
3507
|
-
| [`children`](
|
|
3508
|
-
| [`source`](
|
|
3509
|
-
| [`unit`](
|
|
3510
|
-
| [`format`](
|
|
3511
|
-
| [`decimals`](
|
|
3512
|
-
| [`target`](
|
|
3513
|
-
| [`limits`](
|
|
3491
|
+
| [`children`](#chain) | `ReactNode` | — | Instead of `label` and `value`: exactly one quantity - a tree, a `<Ref>` or a `<Chain>`. |
|
|
3492
|
+
| [`source`](#chain) | `string` | — | Where the number came from: a system, a report, a person. From `GivenProps`. |
|
|
3493
|
+
| [`unit`](#chain) | `string` | — | A label written after the number - "min", "pcs", "€". Never converted and never checked; the calculation does no unit algebra. From `QuantityProps`. |
|
|
3494
|
+
| [`format`](#chain) | `"percent"` | — | `percent` presents a plain ratio as per cent: 0.916 is shown as 91.6 %. The quantity stays a ratio in every operation. From `QuantityProps`. |
|
|
3495
|
+
| [`decimals`](#chain) | `number` | one digit for a percentage, at most two for a derived number, a given as it was given | Fixed number of fraction digits as shown. Rounding happens only in presentation; every operation uses the full value. From `QuantityProps`. |
|
|
3496
|
+
| [`target`](#chain) | `number` | — | The value this quantity is meant to reach - missed, never violated. From `QuantityProps`. |
|
|
3497
|
+
| [`limits`](#chain) | `readonly `[`Limit`](#chain)`[]` | — | Bounds the quantity is assessed against, through core's `assess()`. From `QuantityProps`. |
|
|
3514
3498
|
|
|
3515
|
-
From `QuantityProps` — the full table stands on [Chain](
|
|
3499
|
+
From `QuantityProps` — the full table stands on [Chain](#chain).
|
|
3516
3500
|
|
|
3517
3501
|
| Prop | Type | Default | Description |
|
|
3518
3502
|
|---|---|---|---|
|
|
3519
|
-
| [`label`](
|
|
3520
|
-
| [`unit`](
|
|
3521
|
-
| [`format`](
|
|
3522
|
-
| [`decimals`](
|
|
3523
|
-
| [`target`](
|
|
3524
|
-
| [`limits`](
|
|
3503
|
+
| [`label`](#chain) *required* | `string` | — | What the quantity is called. It stands on its line, wherever it is an operand, and in the accessible sentence. |
|
|
3504
|
+
| [`unit`](#chain) | `string` | — | A label written after the number - "min", "pcs", "€". Never converted and never checked; the calculation does no unit algebra. |
|
|
3505
|
+
| [`format`](#chain) | `"percent"` | — | `percent` presents a plain ratio as per cent: 0.916 is shown as 91.6 %. The quantity stays a ratio in every operation. |
|
|
3506
|
+
| [`decimals`](#chain) | `number` | one digit for a percentage, at most two for a derived number, a given as it was given | Fixed number of fraction digits as shown. Rounding happens only in presentation; every operation uses the full value. |
|
|
3507
|
+
| [`target`](#chain) | `number` | — | The value this quantity is meant to reach - missed, never violated. |
|
|
3508
|
+
| [`limits`](#chain) | `readonly `[`Limit`](#chain)`[]` | — | Bounds the quantity is assessed against, through core's `assess()`. |
|
|
3525
3509
|
|
|
3526
|
-
From `GivenProps` — the full table stands on [Given](
|
|
3510
|
+
From `GivenProps` — the full table stands on [Given](#given).
|
|
3527
3511
|
|
|
3528
3512
|
| Prop | Type | Default | Description |
|
|
3529
3513
|
|---|---|---|---|
|
|
3530
|
-
| [`value`](
|
|
3531
|
-
| [`source`](
|
|
3532
|
-
| [`label`](
|
|
3533
|
-
| [`unit`](
|
|
3534
|
-
| [`format`](
|
|
3535
|
-
| [`decimals`](
|
|
3536
|
-
| [`target`](
|
|
3537
|
-
| [`limits`](
|
|
3514
|
+
| [`value`](#given) *required* | `number \| null \| undefined \| `[`MetricValues`](#given) | — | The number the calculation starts from. Absent (`null`, `undefined`, not finite) makes every quantity that depends on it absent, with the reason - never zero. Where the calculation has `metrics`, an object with a number for each metric id instead; absence then stays in its metric. |
|
|
3515
|
+
| [`source`](#given) | `string` | — | Where the number came from: a system, a report, a person. |
|
|
3516
|
+
| [`label`](#given) *required* | `string` | — | What the quantity is called. It stands on its line, wherever it is an operand, and in the accessible sentence. From `QuantityProps`. |
|
|
3517
|
+
| [`unit`](#given) | `string` | — | A label written after the number - "min", "pcs", "€". Never converted and never checked; the calculation does no unit algebra. From `QuantityProps`. |
|
|
3518
|
+
| [`format`](#given) | `"percent"` | — | `percent` presents a plain ratio as per cent: 0.916 is shown as 91.6 %. The quantity stays a ratio in every operation. From `QuantityProps`. |
|
|
3519
|
+
| [`decimals`](#given) | `number` | one digit for a percentage, at most two for a derived number, a given as it was given | Fixed number of fraction digits as shown. Rounding happens only in presentation; every operation uses the full value. From `QuantityProps`. |
|
|
3520
|
+
| [`target`](#given) | `number` | — | The value this quantity is meant to reach - missed, never violated. From `QuantityProps`. |
|
|
3521
|
+
| [`limits`](#given) | `readonly `[`Limit`](#given)`[]` | — | Bounds the quantity is assessed against, through core's `assess()`. From `QuantityProps`. |
|
|
3538
3522
|
|
|
3539
3523
|
### Worked examples
|
|
3540
3524
|
|
|
@@ -3544,8 +3528,6 @@ Whole figures as a screen shows them: the cost per stop of a day's tours, invoic
|
|
|
3544
3528
|
import { Calculation, Chain, Given, Ref } from "@umriss-ui/calculation";
|
|
3545
3529
|
```
|
|
3546
3530
|
|
|
3547
|
-
Demo page: https://romanhaendler.github.io/umriss-ui/calculation/worked-examples/
|
|
3548
|
-
|
|
3549
3531
|
#### Examples
|
|
3550
3532
|
|
|
3551
3533
|
##### The cost per stop of a day's tours
|
|
@@ -3988,85 +3970,85 @@ export default function HallOee() {
|
|
|
3988
3970
|
|
|
3989
3971
|
#### Keyboard
|
|
3990
3972
|
|
|
3991
|
-
The keys of [Calculation](
|
|
3973
|
+
The keys of [Calculation](#calculation) apply here.
|
|
3992
3974
|
|
|
3993
3975
|
#### Props on this page
|
|
3994
3976
|
|
|
3995
|
-
From `CalculationProps` — the full table stands on [Calculation](
|
|
3977
|
+
From `CalculationProps` — the full table stands on [Calculation](#calculation).
|
|
3996
3978
|
|
|
3997
3979
|
| Prop | Type | Default | Description |
|
|
3998
3980
|
|---|---|---|---|
|
|
3999
|
-
| [`children`](
|
|
3981
|
+
| [`children`](#calculation) *required* | `ReactNode` | — | The result: exactly one quantity - a tree (`<Sum>`, `<Difference>`, `<Product>`, `<Quotient>` with their operands, `<Given>` as leaves) or a `<Chain>`, the two mixing freely; `<Ref>` for a quantity defined elsewhere. |
|
|
4000
3982
|
|
|
4001
|
-
From `OperatorProps` — the full table stands on [Tree](
|
|
3983
|
+
From `OperatorProps` — the full table stands on [Tree](#tree).
|
|
4002
3984
|
|
|
4003
3985
|
| Prop | Type | Default | Description |
|
|
4004
3986
|
|---|---|---|---|
|
|
4005
|
-
| [`children`](
|
|
4006
|
-
| [`label`](
|
|
4007
|
-
| [`id`](
|
|
4008
|
-
| [`unit`](
|
|
4009
|
-
| [`format`](
|
|
4010
|
-
| [`decimals`](
|
|
4011
|
-
| [`target`](
|
|
4012
|
-
| [`limits`](
|
|
3987
|
+
| [`children`](#tree) | `ReactNode` | — | The operands, in order: quantities, givens and references. |
|
|
3988
|
+
| [`label`](#tree) *required* | `string` | — | What the quantity is called. It stands on its line, wherever it is an operand, and in the accessible sentence. From `QuantityProps`. |
|
|
3989
|
+
| [`id`](#tree) | `string` | — | Makes the quantity referable: `<Ref to>` stands for it elsewhere. Needed only for a quantity used more than once. From `QuantityProps`. |
|
|
3990
|
+
| [`unit`](#tree) | `string` | — | A label written after the number - "min", "pcs", "€". Never converted and never checked; the calculation does no unit algebra. From `QuantityProps`. |
|
|
3991
|
+
| [`format`](#tree) | `"percent"` | — | `percent` presents a plain ratio as per cent: 0.916 is shown as 91.6 %. The quantity stays a ratio in every operation. From `QuantityProps`. |
|
|
3992
|
+
| [`decimals`](#tree) | `number` | one digit for a percentage, at most two for a derived number, a given as it was given | Fixed number of fraction digits as shown. Rounding happens only in presentation; every operation uses the full value. From `QuantityProps`. |
|
|
3993
|
+
| [`target`](#tree) | `number` | — | The value this quantity is meant to reach - missed, never violated. From `QuantityProps`. |
|
|
3994
|
+
| [`limits`](#tree) | `readonly `[`Limit`](#tree)`[]` | — | Bounds the quantity is assessed against, through core's `assess()`. From `QuantityProps`. |
|
|
4013
3995
|
|
|
4014
|
-
From `RefProps` — the full table stands on [Tree](
|
|
3996
|
+
From `RefProps` — the full table stands on [Tree](#tree).
|
|
4015
3997
|
|
|
4016
3998
|
| Prop | Type | Default | Description |
|
|
4017
3999
|
|---|---|---|---|
|
|
4018
|
-
| [`to`](
|
|
4000
|
+
| [`to`](#tree) *required* | `string` | — | The `id` of the quantity this reference stands for. |
|
|
4019
4001
|
|
|
4020
|
-
From `ChainProps` — the full table stands on [Chain](
|
|
4002
|
+
From `ChainProps` — the full table stands on [Chain](#chain).
|
|
4021
4003
|
|
|
4022
4004
|
| Prop | Type | Default | Description |
|
|
4023
4005
|
|---|---|---|---|
|
|
4024
|
-
| [`children`](
|
|
4006
|
+
| [`children`](#chain) | `ReactNode` | — | The operands, top to bottom: a first quantity with no operator, then `Plus`, `Minus`, `Times` and `DividedBy` with their operands and `Interim`s naming the value where they stand. The last line is an `Interim`; a `Times` or `DividedBy` stands alone between two named values. |
|
|
4025
4007
|
|
|
4026
|
-
From `ChainOperandProps` — the full table stands on [Chain](
|
|
4008
|
+
From `ChainOperandProps` — the full table stands on [Chain](#chain).
|
|
4027
4009
|
|
|
4028
4010
|
| Prop | Type | Default | Description |
|
|
4029
4011
|
|---|---|---|---|
|
|
4030
|
-
| [`label`](
|
|
4031
|
-
| [`value`](
|
|
4032
|
-
| [`children`](
|
|
4033
|
-
| [`source`](
|
|
4034
|
-
| [`asOf`](
|
|
4035
|
-
| [`ages`](
|
|
4036
|
-
| [`id`](
|
|
4037
|
-
| [`unit`](
|
|
4038
|
-
| [`format`](
|
|
4039
|
-
| [`decimals`](
|
|
4040
|
-
| [`target`](
|
|
4041
|
-
| [`limits`](
|
|
4042
|
-
|
|
4043
|
-
From `QuantityProps` — the full table stands on [Chain](
|
|
4012
|
+
| [`label`](#chain) | `string` | — | The operand's name, where the line is a given written in place. Left out where the line holds a quantity as its child. |
|
|
4013
|
+
| [`value`](#chain) | `number \| null \| `[`MetricValues`](#chain) | — | The operand's number, where the line is a given written in place. Absent as for a `Given`: the line and every interim after it are absent, with the reason. With `metrics`, an object by metric id, as on a `Given`. |
|
|
4014
|
+
| [`children`](#chain) | `ReactNode` | — | Instead of `label` and `value`: exactly one quantity - a tree, a `<Ref>` or a `<Chain>`. |
|
|
4015
|
+
| [`source`](#chain) | `string` | — | Where the number came from: a system, a report, a person. From `GivenProps`. |
|
|
4016
|
+
| [`asOf`](#chain) | `Date \| number` | — | When the number was true - not when it was fetched. From `GivenProps`. |
|
|
4017
|
+
| [`ages`](#chain) | [`FreshnessAges`](#chain) | — | The ages at which `asOf` turns stale and lost. With both, the given carries a freshness through core; with `asOf` alone, only the time. From `GivenProps`. |
|
|
4018
|
+
| [`id`](#chain) | `string` | — | Makes the quantity referable: `<Ref to>` stands for it elsewhere. Needed only for a quantity used more than once. From `QuantityProps`. |
|
|
4019
|
+
| [`unit`](#chain) | `string` | — | A label written after the number - "min", "pcs", "€". Never converted and never checked; the calculation does no unit algebra. From `QuantityProps`. |
|
|
4020
|
+
| [`format`](#chain) | `"percent"` | — | `percent` presents a plain ratio as per cent: 0.916 is shown as 91.6 %. The quantity stays a ratio in every operation. From `QuantityProps`. |
|
|
4021
|
+
| [`decimals`](#chain) | `number` | one digit for a percentage, at most two for a derived number, a given as it was given | Fixed number of fraction digits as shown. Rounding happens only in presentation; every operation uses the full value. From `QuantityProps`. |
|
|
4022
|
+
| [`target`](#chain) | `number` | — | The value this quantity is meant to reach - missed, never violated. From `QuantityProps`. |
|
|
4023
|
+
| [`limits`](#chain) | `readonly `[`Limit`](#chain)`[]` | — | Bounds the quantity is assessed against, through core's `assess()`. From `QuantityProps`. |
|
|
4024
|
+
|
|
4025
|
+
From `QuantityProps` — the full table stands on [Chain](#chain).
|
|
4044
4026
|
|
|
4045
4027
|
| Prop | Type | Default | Description |
|
|
4046
4028
|
|---|---|---|---|
|
|
4047
|
-
| [`label`](
|
|
4048
|
-
| [`id`](
|
|
4049
|
-
| [`unit`](
|
|
4050
|
-
| [`format`](
|
|
4051
|
-
| [`decimals`](
|
|
4052
|
-
| [`target`](
|
|
4053
|
-
| [`limits`](
|
|
4029
|
+
| [`label`](#chain) *required* | `string` | — | What the quantity is called. It stands on its line, wherever it is an operand, and in the accessible sentence. |
|
|
4030
|
+
| [`id`](#chain) | `string` | — | Makes the quantity referable: `<Ref to>` stands for it elsewhere. Needed only for a quantity used more than once. |
|
|
4031
|
+
| [`unit`](#chain) | `string` | — | A label written after the number - "min", "pcs", "€". Never converted and never checked; the calculation does no unit algebra. |
|
|
4032
|
+
| [`format`](#chain) | `"percent"` | — | `percent` presents a plain ratio as per cent: 0.916 is shown as 91.6 %. The quantity stays a ratio in every operation. |
|
|
4033
|
+
| [`decimals`](#chain) | `number` | one digit for a percentage, at most two for a derived number, a given as it was given | Fixed number of fraction digits as shown. Rounding happens only in presentation; every operation uses the full value. |
|
|
4034
|
+
| [`target`](#chain) | `number` | — | The value this quantity is meant to reach - missed, never violated. |
|
|
4035
|
+
| [`limits`](#chain) | `readonly `[`Limit`](#chain)`[]` | — | Bounds the quantity is assessed against, through core's `assess()`. |
|
|
4054
4036
|
|
|
4055
|
-
From `GivenProps` — the full table stands on [Given](
|
|
4037
|
+
From `GivenProps` — the full table stands on [Given](#given).
|
|
4056
4038
|
|
|
4057
4039
|
| Prop | Type | Default | Description |
|
|
4058
4040
|
|---|---|---|---|
|
|
4059
|
-
| [`value`](
|
|
4060
|
-
| [`source`](
|
|
4061
|
-
| [`asOf`](
|
|
4062
|
-
| [`ages`](
|
|
4063
|
-
| [`label`](
|
|
4064
|
-
| [`id`](
|
|
4065
|
-
| [`unit`](
|
|
4066
|
-
| [`format`](
|
|
4067
|
-
| [`decimals`](
|
|
4068
|
-
| [`target`](
|
|
4069
|
-
| [`limits`](
|
|
4041
|
+
| [`value`](#given) *required* | `number \| null \| undefined \| `[`MetricValues`](#given) | — | The number the calculation starts from. Absent (`null`, `undefined`, not finite) makes every quantity that depends on it absent, with the reason - never zero. Where the calculation has `metrics`, an object with a number for each metric id instead; absence then stays in its metric. |
|
|
4042
|
+
| [`source`](#given) | `string` | — | Where the number came from: a system, a report, a person. |
|
|
4043
|
+
| [`asOf`](#given) | `Date \| number` | — | When the number was true - not when it was fetched. |
|
|
4044
|
+
| [`ages`](#given) | [`FreshnessAges`](#given) | — | The ages at which `asOf` turns stale and lost. With both, the given carries a freshness through core; with `asOf` alone, only the time. |
|
|
4045
|
+
| [`label`](#given) *required* | `string` | — | What the quantity is called. It stands on its line, wherever it is an operand, and in the accessible sentence. From `QuantityProps`. |
|
|
4046
|
+
| [`id`](#given) | `string` | — | Makes the quantity referable: `<Ref to>` stands for it elsewhere. Needed only for a quantity used more than once. From `QuantityProps`. |
|
|
4047
|
+
| [`unit`](#given) | `string` | — | A label written after the number - "min", "pcs", "€". Never converted and never checked; the calculation does no unit algebra. From `QuantityProps`. |
|
|
4048
|
+
| [`format`](#given) | `"percent"` | — | `percent` presents a plain ratio as per cent: 0.916 is shown as 91.6 %. The quantity stays a ratio in every operation. From `QuantityProps`. |
|
|
4049
|
+
| [`decimals`](#given) | `number` | one digit for a percentage, at most two for a derived number, a given as it was given | Fixed number of fraction digits as shown. Rounding happens only in presentation; every operation uses the full value. From `QuantityProps`. |
|
|
4050
|
+
| [`target`](#given) | `number` | — | The value this quantity is meant to reach - missed, never violated. From `QuantityProps`. |
|
|
4051
|
+
| [`limits`](#given) | `readonly `[`Limit`](#given)`[]` | — | Bounds the quantity is assessed against, through core's `assess()`. From `QuantityProps`. |
|
|
4070
4052
|
|
|
4071
4053
|
## API index
|
|
4072
4054
|
|
|
@@ -4076,21 +4058,19 @@ Every name the package exports, in one place.
|
|
|
4076
4058
|
|
|
4077
4059
|
Everything `@umriss-ui/calculation` exports, with its signature. A component's props stand on its own page.
|
|
4078
4060
|
|
|
4079
|
-
Demo page: https://romanhaendler.github.io/umriss-ui/calculation/api/
|
|
4080
|
-
|
|
4081
4061
|
#### Components
|
|
4082
4062
|
|
|
4083
4063
|
##### `Calculation`
|
|
4084
4064
|
|
|
4085
|
-
[Calculation](
|
|
4065
|
+
[Calculation](#calculation) – Lets a reader follow and redo a figure (also called a KPI tree or calculation tree): each line a quantity with its operator, derived lines folded until opened beneath themselves. Reach for it where a number on the screen gets questioned: a cost, an availability, an invoice total.
|
|
4086
4066
|
|
|
4087
|
-
Used on [Scenarios](
|
|
4067
|
+
Used on [Scenarios](#scenarios), [Installation](#installation), [Calculation](#calculation), [Tree](#tree), [Chain](#chain), [Rows from data](#rows-from-data), [Given](#given), [Metrics](#metrics), [What can go wrong](#what-can-go-wrong) and [Worked examples](#worked-examples).
|
|
4088
4068
|
|
|
4089
4069
|
##### `Chain`
|
|
4090
4070
|
|
|
4091
|
-
[Chain](
|
|
4071
|
+
[Chain](#chain) – A sheet read top to bottom (a running calculation): each line worked into the value before it, and interims naming the value where they stand. Reach for it for invoices, budgets and cost sheets.
|
|
4092
4072
|
|
|
4093
|
-
Used on [Calculation](
|
|
4073
|
+
Used on [Calculation](#calculation), [Chain](#chain), [Rows from data](#rows-from-data), [Given](#given), [Metrics](#metrics), [What can go wrong](#what-can-go-wrong) and [Worked examples](#worked-examples).
|
|
4094
4074
|
|
|
4095
4075
|
##### `Difference`
|
|
4096
4076
|
|
|
@@ -4100,7 +4080,7 @@ The first operand minus every other: a − b − c.
|
|
|
4100
4080
|
const Difference: (props: OperatorProps) => null;
|
|
4101
4081
|
```
|
|
4102
4082
|
|
|
4103
|
-
Used on [Scenarios](
|
|
4083
|
+
Used on [Scenarios](#scenarios), [Installation](#installation), [Calculation](#calculation), [Tree](#tree), [Rows from data](#rows-from-data) and [Worked examples](#worked-examples).
|
|
4104
4084
|
|
|
4105
4085
|
##### `DividedBy`
|
|
4106
4086
|
|
|
@@ -4110,13 +4090,13 @@ Divides the named value before it by its operand.
|
|
|
4110
4090
|
const DividedBy: (props: ChainOperandProps) => null;
|
|
4111
4091
|
```
|
|
4112
4092
|
|
|
4113
|
-
Used on [Chain](
|
|
4093
|
+
Used on [Chain](#chain), [Metrics](#metrics) and [Worked examples](#worked-examples).
|
|
4114
4094
|
|
|
4115
4095
|
##### `Given`
|
|
4116
4096
|
|
|
4117
|
-
[Given](
|
|
4097
|
+
[Given](#given) – The numbers a calculation starts from (inputs, leaves): where they came from, when they were true, and whether they are still fresh.
|
|
4118
4098
|
|
|
4119
|
-
Used on [Scenarios](
|
|
4099
|
+
Used on [Scenarios](#scenarios), [Installation](#installation), [Calculation](#calculation), [Tree](#tree), [Chain](#chain), [Rows from data](#rows-from-data), [Given](#given), [Metrics](#metrics), [What can go wrong](#what-can-go-wrong) and [Worked examples](#worked-examples).
|
|
4120
4100
|
|
|
4121
4101
|
##### `Interim`
|
|
4122
4102
|
|
|
@@ -4126,7 +4106,7 @@ Names the value of a chain where it stands.
|
|
|
4126
4106
|
const Interim: (props: QuantityProps) => null;
|
|
4127
4107
|
```
|
|
4128
4108
|
|
|
4129
|
-
Used on [Calculation](
|
|
4109
|
+
Used on [Calculation](#calculation), [Chain](#chain), [Rows from data](#rows-from-data), [Given](#given), [Metrics](#metrics), [What can go wrong](#what-can-go-wrong) and [Worked examples](#worked-examples).
|
|
4130
4110
|
|
|
4131
4111
|
##### `Minus`
|
|
4132
4112
|
|
|
@@ -4136,7 +4116,7 @@ Takes its operand from the value before it.
|
|
|
4136
4116
|
const Minus: (props: ChainOperandProps) => null;
|
|
4137
4117
|
```
|
|
4138
4118
|
|
|
4139
|
-
Used on [Calculation](
|
|
4119
|
+
Used on [Calculation](#calculation), [Chain](#chain), [Rows from data](#rows-from-data), [Given](#given) and [Metrics](#metrics).
|
|
4140
4120
|
|
|
4141
4121
|
##### `Plus`
|
|
4142
4122
|
|
|
@@ -4146,7 +4126,7 @@ Adds its operand to the value before it.
|
|
|
4146
4126
|
const Plus: (props: ChainOperandProps) => null;
|
|
4147
4127
|
```
|
|
4148
4128
|
|
|
4149
|
-
Used on [Calculation](
|
|
4129
|
+
Used on [Calculation](#calculation), [Chain](#chain), [Rows from data](#rows-from-data), [Metrics](#metrics), [What can go wrong](#what-can-go-wrong) and [Worked examples](#worked-examples).
|
|
4150
4130
|
|
|
4151
4131
|
##### `Product`
|
|
4152
4132
|
|
|
@@ -4156,7 +4136,7 @@ The product of two or more operands.
|
|
|
4156
4136
|
const Product: (props: OperatorProps) => null;
|
|
4157
4137
|
```
|
|
4158
4138
|
|
|
4159
|
-
Used on [Scenarios](
|
|
4139
|
+
Used on [Scenarios](#scenarios), [Calculation](#calculation), [Tree](#tree), [Chain](#chain), [Rows from data](#rows-from-data), [Given](#given), [Metrics](#metrics), [What can go wrong](#what-can-go-wrong) and [Worked examples](#worked-examples).
|
|
4160
4140
|
|
|
4161
4141
|
##### `Quotient`
|
|
4162
4142
|
|
|
@@ -4166,13 +4146,13 @@ Exactly two operands: the first divided by the second.
|
|
|
4166
4146
|
const Quotient: (props: OperatorProps) => null;
|
|
4167
4147
|
```
|
|
4168
4148
|
|
|
4169
|
-
Used on [Scenarios](
|
|
4149
|
+
Used on [Scenarios](#scenarios), [Installation](#installation), [Calculation](#calculation), [Tree](#tree), [Chain](#chain), [Given](#given), [Metrics](#metrics), [What can go wrong](#what-can-go-wrong) and [Worked examples](#worked-examples).
|
|
4170
4150
|
|
|
4171
4151
|
##### `Ref`
|
|
4172
4152
|
|
|
4173
|
-
[Tree](
|
|
4153
|
+
[Tree](#tree) – A quantity defined elsewhere in the calculation, standing as an operand.
|
|
4174
4154
|
|
|
4175
|
-
Used on [Scenarios](
|
|
4155
|
+
Used on [Scenarios](#scenarios), [Installation](#installation), [Calculation](#calculation), [Tree](#tree), [Chain](#chain), [Rows from data](#rows-from-data), [Given](#given) and [Worked examples](#worked-examples).
|
|
4176
4156
|
|
|
4177
4157
|
##### `Sum`
|
|
4178
4158
|
|
|
@@ -4183,7 +4163,7 @@ included. The sum of none is zero, and its line says it has no entries.
|
|
|
4183
4163
|
const Sum: (props: OperatorProps) => null;
|
|
4184
4164
|
```
|
|
4185
4165
|
|
|
4186
|
-
Used on [Scenarios](
|
|
4166
|
+
Used on [Scenarios](#scenarios), [Calculation](#calculation), [Tree](#tree), [Chain](#chain), [Rows from data](#rows-from-data), [Metrics](#metrics), [What can go wrong](#what-can-go-wrong) and [Worked examples](#worked-examples).
|
|
4187
4167
|
|
|
4188
4168
|
##### `Times`
|
|
4189
4169
|
|
|
@@ -4193,31 +4173,31 @@ Multiplies the named value before it by its operand.
|
|
|
4193
4173
|
const Times: (props: ChainOperandProps) => null;
|
|
4194
4174
|
```
|
|
4195
4175
|
|
|
4196
|
-
Used on [Calculation](
|
|
4176
|
+
Used on [Calculation](#calculation), [Chain](#chain) and [Metrics](#metrics).
|
|
4197
4177
|
|
|
4198
4178
|
#### Types
|
|
4199
4179
|
|
|
4200
4180
|
##### `CalculationProps`
|
|
4201
4181
|
|
|
4202
|
-
Its table stands on [Calculation](
|
|
4182
|
+
Its table stands on [Calculation](#calculation).
|
|
4203
4183
|
|
|
4204
4184
|
##### `ChainOperandProps`
|
|
4205
4185
|
|
|
4206
|
-
Its table stands on [Chain](
|
|
4186
|
+
Its table stands on [Chain](#chain).
|
|
4207
4187
|
|
|
4208
4188
|
##### `ChainProps`
|
|
4209
4189
|
|
|
4210
|
-
Its table stands on [Chain](
|
|
4190
|
+
Its table stands on [Chain](#chain).
|
|
4211
4191
|
|
|
4212
4192
|
##### `GivenProps`
|
|
4213
4193
|
|
|
4214
|
-
Its table stands on [Given](
|
|
4194
|
+
Its table stands on [Given](#given).
|
|
4215
4195
|
|
|
4216
4196
|
##### `Metric`
|
|
4217
4197
|
|
|
4218
|
-
Its table stands on [Metrics](
|
|
4198
|
+
Its table stands on [Metrics](#metrics).
|
|
4219
4199
|
|
|
4220
|
-
Used on [Rows from data](
|
|
4200
|
+
Used on [Rows from data](#rows-from-data) and [Metrics](#metrics).
|
|
4221
4201
|
|
|
4222
4202
|
##### `MetricValues`
|
|
4223
4203
|
|
|
@@ -4230,12 +4210,12 @@ type MetricValues = Readonly<Record<string, number | null>>;
|
|
|
4230
4210
|
|
|
4231
4211
|
##### `OperatorProps`
|
|
4232
4212
|
|
|
4233
|
-
Its table stands on [Tree](
|
|
4213
|
+
Its table stands on [Tree](#tree).
|
|
4234
4214
|
|
|
4235
4215
|
##### `QuantityProps`
|
|
4236
4216
|
|
|
4237
|
-
Its table stands on [Chain](
|
|
4217
|
+
Its table stands on [Chain](#chain).
|
|
4238
4218
|
|
|
4239
4219
|
##### `RefProps`
|
|
4240
4220
|
|
|
4241
|
-
Its table stands on [Tree](
|
|
4221
|
+
Its table stands on [Tree](#tree).
|