@umriss-ui/calculation 0.4.8 → 0.5.1
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 +46 -0
- package/README.md +10 -4
- package/dist/index.d.ts +19 -4
- package/docs/llms-full.md +659 -69
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -11,6 +11,52 @@ under a heading "Changed" of its own, no matter which digit rose.
|
|
|
11
11
|
|
|
12
12
|
---
|
|
13
13
|
|
|
14
|
+
## 0.5.1 – Core 0.26.0 (Oct. 2026)
|
|
15
|
+
|
|
16
|
+
Needs `@umriss-ui/core` 0.26; the peer range moves to `^0.26.0`. Nothing else changes for a caller.
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## 0.5.0 – Every export explained (Oct. 2026)
|
|
21
|
+
|
|
22
|
+
The package explains itself where it is used: every export carries a comment,
|
|
23
|
+
every default a `@default` tag, and the demo lists all of it in an API index
|
|
24
|
+
(ADR-0044). What a calculation shows and does is unchanged. Needs
|
|
25
|
+
`@umriss-ui/core` 0.25; the peer range moves to `^0.25.0`.
|
|
26
|
+
|
|
27
|
+
### Added
|
|
28
|
+
|
|
29
|
+
- **The Calculation page says what a screen reader meets**: a section
|
|
30
|
+
Accessibility after Keyboard gives the sentence each line is read as, in
|
|
31
|
+
English and in German, the derivation button's name and state, the label
|
|
32
|
+
to pass and what forced colours and reduced motion change. Every other page
|
|
33
|
+
links the Calculation page's keys from a Keyboard section of its own. In
|
|
34
|
+
the demo, the Markdown twins and `docs/llms-full.md`; the calculation is
|
|
35
|
+
unchanged.
|
|
36
|
+
- **Every export carries a comment**: what a component or a type is for. The
|
|
37
|
+
editor shows it on hover, from the package's `.d.ts`. Nothing else changes.
|
|
38
|
+
- **A prop's default stands in a `@default` tag** where its comment used to say
|
|
39
|
+
it in words: the editor shows it on hover, and the props table in its Default
|
|
40
|
+
column. Nothing else changes.
|
|
41
|
+
- **`docs/llms-full.md` defines every type a props table names**: a type
|
|
42
|
+
without a table of its own (`MetricValues`, core's `Limit`) stands under
|
|
43
|
+
"Types on this page" of each page that names it, with its comment and its
|
|
44
|
+
members or its declaration.
|
|
45
|
+
- **`docs/llms-full.md` ends with the API index**: every export of the
|
|
46
|
+
package, grouped as components and types, alphabetical, each with its
|
|
47
|
+
comment and declaration or a link to the page and table where it stands, and
|
|
48
|
+
the pages that use it. It replaces the appendix "The rest of the API". The
|
|
49
|
+
same index is a page of the demo, at `/calculation/api/`.
|
|
50
|
+
|
|
51
|
+
### Fixed
|
|
52
|
+
|
|
53
|
+
- **`docs/llms-full.md` names the peer in its install line**:
|
|
54
|
+
`npm install @umriss-ui/calculation @umriss-ui/core`, read from the
|
|
55
|
+
manifest. It had named the calculation alone, and an install after it
|
|
56
|
+
lacked core.
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
14
60
|
## 0.4.8 – Core 0.24.0 (Oct. 2026)
|
|
15
61
|
|
|
16
62
|
Needs `@umriss-ui/core` 0.24; the peer range moves to `^0.24.0`. Nothing else changes for a caller.
|
package/README.md
CHANGED
|
@@ -130,12 +130,18 @@ and makes absent only its own metric.
|
|
|
130
130
|
|
|
131
131
|
## Documentation
|
|
132
132
|
|
|
133
|
-
The demo is the documentation:
|
|
134
|
-
|
|
133
|
+
The demo is the documentation:
|
|
134
|
+
<https://romanhaendler.github.io/umriss-ui/calculation/>, or locally
|
|
135
|
+
`pnpm dev:calculation` (port 4177). Every page shows running examples with
|
|
136
|
+
their source and the props table generated from `src/`, each prop linked to the
|
|
137
|
+
examples that show it; an API index lists every export, one search finds
|
|
138
|
+
across all five packages, and the header switches the examples to German. The
|
|
139
|
+
vocabulary — calculation, quantity, result, given, operator, operand,
|
|
135
140
|
derivation, reference — stands in `CONTEXT.md` under "Calculations".
|
|
136
141
|
|
|
137
142
|
For a coding agent the demo stands as one Markdown file inside the installed
|
|
138
143
|
package, `docs/llms-full.md`, pinned to that version: every page with its
|
|
139
|
-
examples' source, its props tables and why it is built as it is, and
|
|
140
|
-
|
|
144
|
+
examples' source, its props tables and why it is built as it is, and an index
|
|
145
|
+
of every export with its comment and its declaration. Each page also has a
|
|
146
|
+
Markdown twin online; for the latest version:
|
|
141
147
|
<https://romanhaendler.github.io/umriss-ui/calculation/llms.txt>.
|
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,12 @@ import { JSX } from 'react';
|
|
|
4
4
|
import { Limit } from '@umriss-ui/core';
|
|
5
5
|
import { ReactNode } from 'react';
|
|
6
6
|
|
|
7
|
+
/** A derivation the package works out itself and shows as a statement, from
|
|
8
|
+
the givens up to the result: one quantity as its child, written with
|
|
9
|
+
`Given`, the operators, `Chain` and `Ref`. Because it performs every
|
|
10
|
+
operation it shows, the number cannot disagree with the lines above it.
|
|
11
|
+
Every tree below the outermost statement starts folded and opens beneath
|
|
12
|
+
the row that is clicked. */
|
|
7
13
|
export declare function Calculation({ children, className, style, metrics, ...rest }: CalculationProps): JSX.Element;
|
|
8
14
|
|
|
9
15
|
/** `className` and `style` size and place the surface; every other attribute -
|
|
@@ -25,6 +31,8 @@ export declare interface CalculationProps extends Omit<HTMLAttributes<HTMLUListE
|
|
|
25
31
|
/** A calculation read top to bottom, as on paper. */
|
|
26
32
|
export declare const Chain: (props: ChainProps) => null;
|
|
27
33
|
|
|
34
|
+
/** The props of `Plus`, `Minus`, `Times` and `DividedBy`: a given written in
|
|
35
|
+
place - `label` and `value` - or a quantity as the child. */
|
|
28
36
|
export declare interface ChainOperandProps extends Omit<GivenProps, "label" | "value"> {
|
|
29
37
|
/** The operand's name, where the line is a given written in place. Left
|
|
30
38
|
out where the line holds a quantity as its child. */
|
|
@@ -39,6 +47,7 @@ export declare interface ChainOperandProps extends Omit<GivenProps, "label" | "v
|
|
|
39
47
|
children?: ReactNode;
|
|
40
48
|
}
|
|
41
49
|
|
|
50
|
+
/** The props of `Chain`. */
|
|
42
51
|
export declare interface ChainProps {
|
|
43
52
|
/** The operands, top to bottom: a first quantity with no operator, then
|
|
44
53
|
`Plus`, `Minus`, `Times` and `DividedBy` with their operands and
|
|
@@ -57,6 +66,8 @@ export declare const DividedBy: (props: ChainOperandProps) => null;
|
|
|
57
66
|
/** A number the calculation does not derive. */
|
|
58
67
|
export declare const Given: (props: GivenProps) => null;
|
|
59
68
|
|
|
69
|
+
/** The props of `Given`: a quantity's, with the number it starts from and
|
|
70
|
+
where and when that number came from. */
|
|
60
71
|
export declare interface GivenProps extends QuantityProps {
|
|
61
72
|
/** The number the calculation starts from. Absent (`null`, `undefined`,
|
|
62
73
|
not finite) makes every quantity that depends on it absent, with the
|
|
@@ -88,7 +99,8 @@ export declare interface Metric {
|
|
|
88
99
|
metric's name in the head. Never converted and never checked. */
|
|
89
100
|
unit?: string;
|
|
90
101
|
/** Fixed number of fraction digits as shown, for every quantity of this
|
|
91
|
-
metric.
|
|
102
|
+
metric.
|
|
103
|
+
@default a given as it was given, at most two for a derived number */
|
|
92
104
|
decimals?: number;
|
|
93
105
|
}
|
|
94
106
|
|
|
@@ -99,6 +111,8 @@ export declare type MetricValues = Readonly<Record<string, number | null>>;
|
|
|
99
111
|
/** Takes its operand from the value before it. */
|
|
100
112
|
export declare const Minus: (props: ChainOperandProps) => null;
|
|
101
113
|
|
|
114
|
+
/** The props of `Sum`, `Difference`, `Product` and `Quotient`: a quantity's,
|
|
115
|
+
with its operands as children. */
|
|
102
116
|
export declare interface OperatorProps extends QuantityProps {
|
|
103
117
|
/** The operands, in order: quantities, givens and references. */
|
|
104
118
|
children?: ReactNode;
|
|
@@ -125,9 +139,9 @@ export declare interface QuantityProps {
|
|
|
125
139
|
The quantity stays a ratio in every operation. */
|
|
126
140
|
format?: "percent";
|
|
127
141
|
/** Fixed number of fraction digits as shown. Rounding happens only in
|
|
128
|
-
presentation; every operation uses the full value.
|
|
129
|
-
for a percentage, at most two for a derived number,
|
|
130
|
-
was given
|
|
142
|
+
presentation; every operation uses the full value.
|
|
143
|
+
@default one digit for a percentage, at most two for a derived number, a
|
|
144
|
+
given as it was given */
|
|
131
145
|
decimals?: number;
|
|
132
146
|
/** The value this quantity is meant to reach - missed, never violated. */
|
|
133
147
|
target?: number;
|
|
@@ -147,6 +161,7 @@ export declare const Quotient: (props: OperatorProps) => null;
|
|
|
147
161
|
/** A quantity defined elsewhere in the calculation, standing as an operand. */
|
|
148
162
|
export declare const Ref: (props: RefProps) => null;
|
|
149
163
|
|
|
164
|
+
/** The props of `Ref`. */
|
|
150
165
|
export declare interface RefProps {
|
|
151
166
|
/** The `id` of the quantity this reference stands for. */
|
|
152
167
|
to: string;
|
package/docs/llms-full.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
# @umriss-ui/calculation 0.
|
|
1
|
+
# @umriss-ui/calculation 0.5.1
|
|
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 `
|
|
5
|
+
Install with `npm install @umriss-ui/calculation @umriss-ui/core`. This text is generated from the package's demo (https://romanhaendler.github.io/umriss-ui/calculation/): 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. The pages index stands in https://romanhaendler.github.io/umriss-ui/calculation/llms.txt.
|
|
6
6
|
|
|
7
7
|
## Scenarios
|
|
8
8
|
|
|
@@ -999,9 +999,13 @@ Show a figure together with how it came about (a derivation, a statement of acco
|
|
|
999
999
|
import { Calculation, Given, Difference, Quotient, Ref } from "@umriss-ui/calculation";
|
|
1000
1000
|
```
|
|
1001
1001
|
|
|
1002
|
+
```sh
|
|
1003
|
+
npm install @umriss-ui/calculation @umriss-ui/core
|
|
1004
|
+
```
|
|
1005
|
+
|
|
1002
1006
|
Demo page: https://romanhaendler.github.io/umriss-ui/calculation/installation/
|
|
1003
1007
|
|
|
1004
|
-
|
|
1008
|
+
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 18 or 19 is a peer as well and stays the application's own.
|
|
1005
1009
|
|
|
1006
1010
|
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.
|
|
1007
1011
|
|
|
@@ -1031,13 +1035,76 @@ export default function Availability() {
|
|
|
1031
1035
|
}
|
|
1032
1036
|
```
|
|
1033
1037
|
|
|
1038
|
+
#### Keyboard
|
|
1039
|
+
|
|
1040
|
+
The keys of [Calculation](#/calculation/keyboard-calculation) apply here.
|
|
1041
|
+
|
|
1042
|
+
#### Props on this page
|
|
1043
|
+
|
|
1044
|
+
From `CalculationProps` — the full table stands on [Calculation](#/calculation/type-CalculationProps).
|
|
1045
|
+
|
|
1046
|
+
| Prop | Type | Default | Description |
|
|
1047
|
+
|---|---|---|---|
|
|
1048
|
+
| [`children`](#/calculation/CalculationProps-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. |
|
|
1049
|
+
|
|
1050
|
+
From `OperatorProps` — the full table stands on [Tree](#/tree/type-OperatorProps).
|
|
1051
|
+
|
|
1052
|
+
| Prop | Type | Default | Description |
|
|
1053
|
+
|---|---|---|---|
|
|
1054
|
+
| [`children`](#/tree/OperatorProps-children) | `ReactNode` | — | The operands, in order: quantities, givens and references. |
|
|
1055
|
+
| [`label`](#/tree/OperatorProps-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`. |
|
|
1056
|
+
| [`id`](#/tree/OperatorProps-id) | `string` | — | Makes the quantity referable: `<Ref to>` stands for it elsewhere. Needed only for a quantity used more than once. From `QuantityProps`. |
|
|
1057
|
+
| [`unit`](#/tree/OperatorProps-unit) | `string` | — | A label written after the number - "min", "pcs", "€". Never converted and never checked; the calculation does no unit algebra. From `QuantityProps`. |
|
|
1058
|
+
| [`format`](#/tree/OperatorProps-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`. |
|
|
1059
|
+
| [`decimals`](#/tree/OperatorProps-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`. |
|
|
1060
|
+
| [`target`](#/tree/OperatorProps-target) | `number` | — | The value this quantity is meant to reach - missed, never violated. From `QuantityProps`. |
|
|
1061
|
+
|
|
1062
|
+
From `RefProps` — the full table stands on [Tree](#/tree/type-RefProps).
|
|
1063
|
+
|
|
1064
|
+
| Prop | Type | Default | Description |
|
|
1065
|
+
|---|---|---|---|
|
|
1066
|
+
| [`to`](#/tree/RefProps-to) *required* | `string` | — | The `id` of the quantity this reference stands for. |
|
|
1067
|
+
|
|
1068
|
+
From `ChainOperandProps` — the full table stands on [Chain](#/chain/type-ChainOperandProps).
|
|
1069
|
+
|
|
1070
|
+
| Prop | Type | Default | Description |
|
|
1071
|
+
|---|---|---|---|
|
|
1072
|
+
| [`id`](#/chain/ChainOperandProps-id) | `string` | — | Makes the quantity referable: `<Ref to>` stands for it elsewhere. Needed only for a quantity used more than once. From `QuantityProps`. |
|
|
1073
|
+
| [`unit`](#/chain/ChainOperandProps-unit) | `string` | — | A label written after the number - "min", "pcs", "€". Never converted and never checked; the calculation does no unit algebra. From `QuantityProps`. |
|
|
1074
|
+
| [`format`](#/chain/ChainOperandProps-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`. |
|
|
1075
|
+
| [`decimals`](#/chain/ChainOperandProps-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`. |
|
|
1076
|
+
| [`target`](#/chain/ChainOperandProps-target) | `number` | — | The value this quantity is meant to reach - missed, never violated. From `QuantityProps`. |
|
|
1077
|
+
|
|
1078
|
+
From `QuantityProps` — the full table stands on [Chain](#/chain/type-QuantityProps).
|
|
1079
|
+
|
|
1080
|
+
| Prop | Type | Default | Description |
|
|
1081
|
+
|---|---|---|---|
|
|
1082
|
+
| [`label`](#/chain/QuantityProps-label) *required* | `string` | — | What the quantity is called. It stands on its line, wherever it is an operand, and in the accessible sentence. |
|
|
1083
|
+
| [`id`](#/chain/QuantityProps-id) | `string` | — | Makes the quantity referable: `<Ref to>` stands for it elsewhere. Needed only for a quantity used more than once. |
|
|
1084
|
+
| [`unit`](#/chain/QuantityProps-unit) | `string` | — | A label written after the number - "min", "pcs", "€". Never converted and never checked; the calculation does no unit algebra. |
|
|
1085
|
+
| [`format`](#/chain/QuantityProps-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. |
|
|
1086
|
+
| [`decimals`](#/chain/QuantityProps-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. |
|
|
1087
|
+
| [`target`](#/chain/QuantityProps-target) | `number` | — | The value this quantity is meant to reach - missed, never violated. |
|
|
1088
|
+
|
|
1089
|
+
From `GivenProps` — the full table stands on [Given](#/given/type-GivenProps).
|
|
1090
|
+
|
|
1091
|
+
| Prop | Type | Default | Description |
|
|
1092
|
+
|---|---|---|---|
|
|
1093
|
+
| [`value`](#/given/GivenProps-value) *required* | `number \| null \| undefined \| `[`MetricValues`](#/given/type-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. |
|
|
1094
|
+
| [`label`](#/given/GivenProps-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`. |
|
|
1095
|
+
| [`id`](#/given/GivenProps-id) | `string` | — | Makes the quantity referable: `<Ref to>` stands for it elsewhere. Needed only for a quantity used more than once. From `QuantityProps`. |
|
|
1096
|
+
| [`unit`](#/given/GivenProps-unit) | `string` | — | A label written after the number - "min", "pcs", "€". Never converted and never checked; the calculation does no unit algebra. From `QuantityProps`. |
|
|
1097
|
+
| [`format`](#/given/GivenProps-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`. |
|
|
1098
|
+
| [`decimals`](#/given/GivenProps-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`. |
|
|
1099
|
+
| [`target`](#/given/GivenProps-target) | `number` | — | The value this quantity is meant to reach - missed, never violated. From `QuantityProps`. |
|
|
1100
|
+
|
|
1034
1101
|
## Writing a calculation
|
|
1035
1102
|
|
|
1036
1103
|
Two forms written as elements: a tree for a figure put together from factors, a chain for a sheet read top to bottom.
|
|
1037
1104
|
|
|
1038
1105
|
### Calculation
|
|
1039
1106
|
|
|
1040
|
-
Lets a reader follow and redo a figure: 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.
|
|
1107
|
+
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.
|
|
1041
1108
|
|
|
1042
1109
|
```ts
|
|
1043
1110
|
import { Calculation, Given, Sum, Product, Quotient, Ref, Chain, Plus, Interim } from "@umriss-ui/calculation";
|
|
@@ -1047,7 +1114,7 @@ Demo page: https://romanhaendler.github.io/umriss-ui/calculation/calculation/
|
|
|
1047
1114
|
|
|
1048
1115
|
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.
|
|
1049
1116
|
|
|
1050
|
-
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` – fails on the first render with a message saying which (ADR-0027).
|
|
1117
|
+
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` – 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)).
|
|
1051
1118
|
|
|
1052
1119
|
Every line is read as one sentence by a screen reader, and every derivation is a disclosure: its button says whether it shows or hides how the line is derived.
|
|
1053
1120
|
|
|
@@ -1323,23 +1390,31 @@ export default function Invoice() {
|
|
|
1323
1390
|
| `Tab` | Moves to the next line that can be opened. |
|
|
1324
1391
|
| `Enter or Space` | Opens or closes the derivation beneath the focused line. |
|
|
1325
1392
|
|
|
1393
|
+
#### Accessibility
|
|
1394
|
+
|
|
1395
|
+
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.
|
|
1396
|
+
|
|
1397
|
+
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/in-german) shows one). The labels are yours and are read as you write them.
|
|
1398
|
+
|
|
1399
|
+
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.
|
|
1400
|
+
|
|
1326
1401
|
#### API
|
|
1327
1402
|
|
|
1328
1403
|
##### `CalculationProps`
|
|
1329
1404
|
|
|
1330
1405
|
| Prop | Type | Default | Description |
|
|
1331
1406
|
|---|---|---|---|
|
|
1332
|
-
| `children`
|
|
1333
|
-
| `metrics` | `readonly Metric[]` | — | Several numbers per quantity, side by side - headcount and full-time equivalents of the same teams (ADR-0038). 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
|
|
1407
|
+
| `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/first-sum), [Write a tree](#/calculation/oee), [Write a chain](#/calculation/invoice) and 34 more |
|
|
1408
|
+
| `metrics` | `readonly `[`Metric`](#/metrics/type-Metric)`[]` | — | 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: [Headcount and full-time equivalents (Metrics)](#/metrics/two-teams), [A number one metric does not have (Metrics)](#/metrics/not-recorded), [Team, cost centre, business line (Metrics)](#/metrics/business-line) and 3 more |
|
|
1334
1409
|
|
|
1335
1410
|
Also takes every attribute of the rendered element – without `children`.
|
|
1336
1411
|
|
|
1337
1412
|
#### Known limits
|
|
1338
1413
|
|
|
1339
|
-
- 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).
|
|
1414
|
+
- 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)).
|
|
1340
1415
|
- No input: a calculation shows how a figure came about; changing a given is your application's form.
|
|
1341
1416
|
|
|
1342
|
-
What umriss deliberately does not build, and why: [ADR-0032](https://github.
|
|
1417
|
+
What umriss deliberately does not build, and why: [ADR-0032](https://romanhaendler.github.io/umriss-ui/what-umriss-ui-is-not/).
|
|
1343
1418
|
|
|
1344
1419
|
### Tree
|
|
1345
1420
|
|
|
@@ -1548,35 +1623,81 @@ export default function Limits() {
|
|
|
1548
1623
|
|
|
1549
1624
|
- A sheet read top to bottom, line by line → Chain
|
|
1550
1625
|
|
|
1626
|
+
#### Keyboard
|
|
1627
|
+
|
|
1628
|
+
The keys of [Calculation](#/calculation/keyboard-calculation) apply here.
|
|
1629
|
+
|
|
1551
1630
|
#### API
|
|
1552
1631
|
|
|
1553
1632
|
##### `OperatorProps`
|
|
1554
1633
|
|
|
1555
1634
|
| Prop | Type | Default | Description |
|
|
1556
1635
|
|---|---|---|---|
|
|
1557
|
-
| `children` | `ReactNode` | — | The operands, in order: quantities, givens and references
|
|
1558
|
-
| `label`
|
|
1559
|
-
| `id` | `string` | — | Makes the quantity referable: `<Ref to>` stands for it elsewhere. Needed only for a quantity used more than once. From `QuantityProps
|
|
1560
|
-
| `unit` | `string` | — | A label written after the number - "min", "pcs", "€". Never converted and never checked; the calculation does no unit algebra. From `QuantityProps
|
|
1561
|
-
| `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
|
|
1562
|
-
| `decimals` | `number` |
|
|
1563
|
-
| `target` | `number` | — | The value this quantity is meant to reach - missed, never violated. From `QuantityProps
|
|
1564
|
-
| `limits` | `readonly Limit[]` | — | Bounds the quantity is assessed against, through core's `assess()`. From `QuantityProps
|
|
1565
|
-
| `explanation` | `string` | — | A sentence of plain text beside the line: why the quantity is here, or what it means. From `QuantityProps
|
|
1566
|
-
| `aside` | `ReactNode` | — | Content of the caller's own beside the line - a sparkline, a link. It never takes part in the calculation. From `QuantityProps
|
|
1636
|
+
| `children` | `ReactNode` | — | The operands, in order: quantities, givens and references.<br>Shown in: [Show a share against a target](#/tree/share-with-target), [Take several amounts away](#/tree/difference-of-three), [Multiply quantities with units](#/tree/product-with-units) and 29 more |
|
|
1637
|
+
| `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/share-with-target), [Take several amounts away](#/tree/difference-of-three), [Multiply quantities with units](#/tree/product-with-units) and 34 more |
|
|
1638
|
+
| `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/used-twice), [The availability of a service (Installation)](#/installation/availability), [Write a tree (Calculation)](#/calculation/oee) and 9 more |
|
|
1639
|
+
| `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/share-with-target), [Take several amounts away](#/tree/difference-of-three), [Multiply quantities with units](#/tree/product-with-units) and 28 more |
|
|
1640
|
+
| `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/share-with-target), [Use a quantity twice](#/tree/used-twice), [Build operands from data](#/tree/from-data) and 16 more |
|
|
1641
|
+
| `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/product-with-units), [Build operands from data](#/tree/from-data), [Hold a figure to its limits](#/tree/limits) and 18 more |
|
|
1642
|
+
| `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/share-with-target), [The availability of a service (Installation)](#/installation/availability), [Write a tree (Calculation)](#/calculation/oee) and 5 more |
|
|
1643
|
+
| `limits` | `readonly `[`Limit`](#type-Limit)`[]` | — | Bounds the quantity is assessed against, through core's `assess()`. From `QuantityProps`.<br>Shown in: [Hold a figure to its limits](#/tree/limits), [Hold an interim to its limits (Chain)](#/chain/error-budget), [Say where a number came from (Given)](#/given/where-it-came-from) and 4 more |
|
|
1644
|
+
| `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/where-it-came-from), [A number one metric does not have (Metrics)](#/metrics/not-recorded), [Staff movement as a chain (Metrics)](#/metrics/staff-movement) and 1 more |
|
|
1645
|
+
| `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/where-it-came-from) |
|
|
1567
1646
|
|
|
1568
1647
|
##### `RefProps`
|
|
1569
1648
|
|
|
1570
1649
|
| Prop | Type | Default | Description |
|
|
1571
1650
|
|---|---|---|---|
|
|
1572
|
-
| `to`
|
|
1651
|
+
| `to` *required* | `string` | — | The `id` of the quantity this reference stands for.<br>Shown in: [Use a quantity twice](#/tree/used-twice), [The availability of a service (Installation)](#/installation/availability), [Write a tree (Calculation)](#/calculation/oee) and 9 more |
|
|
1652
|
+
|
|
1653
|
+
##### Types on this page
|
|
1654
|
+
|
|
1655
|
+
###### `Limit`
|
|
1656
|
+
|
|
1657
|
+
From `@umriss-ui/core`.
|
|
1658
|
+
|
|
1659
|
+
A bound: a value, a side, a severity.
|
|
1660
|
+
|
|
1661
|
+
No tolerance band as input. A band is derived - two limits of equal
|
|
1662
|
+
severity on opposite sides enclose one - and as an input type it would
|
|
1663
|
+
force a `null` on one edge in the one-sided case. One-sided is the common
|
|
1664
|
+
case, not the exception.
|
|
1665
|
+
|
|
1666
|
+
| Prop | Type | Default | Description |
|
|
1667
|
+
|---|---|---|---|
|
|
1668
|
+
| `value` *required* | `number` | — | <br>Shown in: [Hold a figure to its limits](#/tree/limits), [Hold an interim to its limits (Chain)](#/chain/error-budget), [Say where a number came from (Given)](#/given/where-it-came-from) and 2 more |
|
|
1669
|
+
| `side` *required* | [`Side`](#type-Side)<br>`"upper" \| "lower"` | — | <br>Shown in: [Hold a figure to its limits](#/tree/limits), [Hold an interim to its limits (Chain)](#/chain/error-budget), [Say where a number came from (Given)](#/given/where-it-came-from) and 2 more |
|
|
1670
|
+
| `severity` *required* | [`Severity`](#type-Severity)<br>`"warning" \| "alarm"` | — | <br>Shown in: [Hold a figure to its limits](#/tree/limits), [Hold an interim to its limits (Chain)](#/chain/error-budget), [Say where a number came from (Given)](#/given/where-it-came-from) and 2 more |
|
|
1671
|
+
|
|
1672
|
+
###### `Side`
|
|
1673
|
+
|
|
1674
|
+
From `@umriss-ui/core`.
|
|
1675
|
+
|
|
1676
|
+
Whether a limit is an upper or a lower bound.
|
|
1677
|
+
|
|
1678
|
+
```ts
|
|
1679
|
+
type Side = "upper" | "lower";
|
|
1680
|
+
```
|
|
1681
|
+
|
|
1682
|
+
###### `Severity`
|
|
1683
|
+
|
|
1684
|
+
From `@umriss-ui/core`.
|
|
1685
|
+
|
|
1686
|
+
How seriously a violation weighs: one severity that advises and one that
|
|
1687
|
+
calls for action. Exactly two - whoever offers five gets five colours on
|
|
1688
|
+
the screen, and five colours are noise. For a third distinction one sets a
|
|
1689
|
+
second limit.
|
|
1690
|
+
|
|
1691
|
+
```ts
|
|
1692
|
+
type Severity = "warning" | "alarm";
|
|
1693
|
+
```
|
|
1573
1694
|
|
|
1574
1695
|
#### Known limits
|
|
1575
1696
|
|
|
1576
1697
|
- Four operators and nothing else – no powers, roots or functions; compute those before and hand them in as givens.
|
|
1577
1698
|
- A unit is a label and is never converted or checked; the calculation does no unit algebra.
|
|
1578
1699
|
|
|
1579
|
-
What umriss deliberately does not build, and why: [ADR-0032](https://github.
|
|
1700
|
+
What umriss deliberately does not build, and why: [ADR-0032](https://romanhaendler.github.io/umriss-ui/what-umriss-ui-is-not/).
|
|
1580
1701
|
|
|
1581
1702
|
### Chain
|
|
1582
1703
|
|
|
@@ -1590,7 +1711,7 @@ Demo page: https://romanhaendler.github.io/umriss-ui/calculation/chain/
|
|
|
1590
1711
|
|
|
1591
1712
|
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.
|
|
1592
1713
|
|
|
1593
|
-
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).
|
|
1714
|
+
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)).
|
|
1594
1715
|
|
|
1595
1716
|
#### Examples
|
|
1596
1717
|
|
|
@@ -1808,52 +1929,123 @@ export default function ErrorBudget() {
|
|
|
1808
1929
|
|
|
1809
1930
|
- A figure made of factors, folded to its formula → Tree
|
|
1810
1931
|
|
|
1932
|
+
#### Keyboard
|
|
1933
|
+
|
|
1934
|
+
The keys of [Calculation](#/calculation/keyboard-calculation) apply here.
|
|
1935
|
+
|
|
1811
1936
|
#### API
|
|
1812
1937
|
|
|
1813
1938
|
##### `ChainProps`
|
|
1814
1939
|
|
|
1815
1940
|
| Prop | Type | Default | Description |
|
|
1816
1941
|
|---|---|---|---|
|
|
1817
|
-
| `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
|
|
1942
|
+
| `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/net-weight), [Mix additions and deductions](#/chain/tour-cost), [Multiply between two interims](#/chain/mark-up-and-vat) and 10 more |
|
|
1818
1943
|
|
|
1819
1944
|
##### `ChainOperandProps`
|
|
1820
1945
|
|
|
1821
1946
|
| Prop | Type | Default | Description |
|
|
1822
1947
|
|---|---|---|---|
|
|
1823
|
-
| `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
|
|
1824
|
-
| `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
|
|
1825
|
-
| `children` | `ReactNode` | — | Instead of `label` and `value`: exactly one quantity - a tree, a `<Ref>` or a `<Chain
|
|
1826
|
-
| `source` | `string` | — | Where the number came from: a system, a report, a person. From `GivenProps
|
|
1827
|
-
| `asOf` | `Date \| number` | — | When the number was true - not when it was fetched. From `GivenProps
|
|
1828
|
-
| `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
|
|
1829
|
-
| `id` | `string` | — | Makes the quantity referable: `<Ref to>` stands for it elsewhere. Needed only for a quantity used more than once. From `QuantityProps
|
|
1830
|
-
| `unit` | `string` | — | A label written after the number - "min", "pcs", "€". Never converted and never checked; the calculation does no unit algebra. From `QuantityProps
|
|
1831
|
-
| `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
|
|
1832
|
-
| `decimals` | `number` |
|
|
1833
|
-
| `target` | `number` | — | The value this quantity is meant to reach - missed, never violated. From `QuantityProps
|
|
1834
|
-
| `limits` | `readonly Limit[]` | — | Bounds the quantity is assessed against, through core's `assess()`. From `QuantityProps
|
|
1835
|
-
| `explanation` | `string` | — | A sentence of plain text beside the line: why the quantity is here, or what it means. From `QuantityProps
|
|
1836
|
-
| `aside` | `ReactNode` | — | Content of the caller's own beside the line - a sparkline, a link. It never takes part in the calculation. From `QuantityProps
|
|
1948
|
+
| `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/net-weight), [Mix additions and deductions](#/chain/tour-cost), [Multiply between two interims](#/chain/mark-up-and-vat) and 7 more |
|
|
1949
|
+
| `value` | `number \| null \| `[`MetricValues`](#type-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/net-weight), [Mix additions and deductions](#/chain/tour-cost), [Multiply between two interims](#/chain/mark-up-and-vat) and 7 more |
|
|
1950
|
+
| `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/payslip), [Write a chain (Calculation)](#/calculation/invoice), [Read in German (Given)](#/given/in-german) and 3 more |
|
|
1951
|
+
| `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/where-it-came-from), [State when a number was true (Given)](#/given/as-of), [Staff movement as a chain (Metrics)](#/metrics/staff-movement) and 7 more |
|
|
1952
|
+
| `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/where-it-came-from), [State when a number was true (Given)](#/given/as-of), [The cost per stop of a day's tours (Worked examples)](#/worked-examples/cost-per-tour) |
|
|
1953
|
+
| `ages` | [`FreshnessAges`](#type-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/where-it-came-from), [The cost per stop of a day's tours (Worked examples)](#/worked-examples/cost-per-tour) |
|
|
1954
|
+
| `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/payslip), [Put a chain inside a tree](#/chain/chain-in-a-tree), [The availability of a service (Installation)](#/installation/availability) and 9 more |
|
|
1955
|
+
| `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/net-weight), [Mix additions and deductions](#/chain/tour-cost), [Multiply between two interims](#/chain/mark-up-and-vat) and 28 more |
|
|
1956
|
+
| `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/payslip), [Put a chain inside a tree](#/chain/chain-in-a-tree), [Hold an interim to its limits](#/chain/error-budget) and 16 more |
|
|
1957
|
+
| `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/net-weight), [Mix additions and deductions](#/chain/tour-cost), [Multiply between two interims](#/chain/mark-up-and-vat) and 18 more |
|
|
1958
|
+
| `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/chain-in-a-tree), [The availability of a service (Installation)](#/installation/availability), [Write a tree (Calculation)](#/calculation/oee) and 5 more |
|
|
1959
|
+
| `limits` | `readonly `[`Limit`](#type-Limit)`[]` | — | Bounds the quantity is assessed against, through core's `assess()`. From `QuantityProps`.<br>Shown in: [Hold an interim to its limits](#/chain/error-budget), [Hold a figure to its limits (Tree)](#/tree/limits), [Say where a number came from (Given)](#/given/where-it-came-from) and 4 more |
|
|
1960
|
+
| `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/where-it-came-from), [A number one metric does not have (Metrics)](#/metrics/not-recorded), [Staff movement as a chain (Metrics)](#/metrics/staff-movement) and 1 more |
|
|
1961
|
+
| `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/where-it-came-from) |
|
|
1837
1962
|
|
|
1838
1963
|
##### `QuantityProps`
|
|
1839
1964
|
|
|
1840
1965
|
| Prop | Type | Default | Description |
|
|
1841
1966
|
|---|---|---|---|
|
|
1842
|
-
| `label`
|
|
1843
|
-
| `id` | `string` | — | Makes the quantity referable: `<Ref to>` stands for it elsewhere. Needed only for a quantity used more than once
|
|
1844
|
-
| `unit` | `string` | — | A label written after the number - "min", "pcs", "€". Never converted and never checked; the calculation does no unit algebra
|
|
1845
|
-
| `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
|
|
1846
|
-
| `decimals` | `number` |
|
|
1847
|
-
| `target` | `number` | — | The value this quantity is meant to reach - missed, never violated
|
|
1848
|
-
| `limits` | `readonly Limit[]` | — | Bounds the quantity is assessed against, through core's `assess()
|
|
1849
|
-
| `explanation` | `string` | — | A sentence of plain text beside the line: why the quantity is here, or what it means
|
|
1850
|
-
| `aside` | `ReactNode` | — | Content of the caller's own beside the line - a sparkline, a link. It never takes part in the calculation
|
|
1967
|
+
| `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/net-weight), [Mix additions and deductions](#/chain/tour-cost), [Multiply between two interims](#/chain/mark-up-and-vat) and 34 more |
|
|
1968
|
+
| `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/payslip), [Put a chain inside a tree](#/chain/chain-in-a-tree), [The availability of a service (Installation)](#/installation/availability) and 9 more |
|
|
1969
|
+
| `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/net-weight), [Mix additions and deductions](#/chain/tour-cost), [Multiply between two interims](#/chain/mark-up-and-vat) and 28 more |
|
|
1970
|
+
| `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/payslip), [Put a chain inside a tree](#/chain/chain-in-a-tree), [Hold an interim to its limits](#/chain/error-budget) and 16 more |
|
|
1971
|
+
| `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/net-weight), [Mix additions and deductions](#/chain/tour-cost), [Multiply between two interims](#/chain/mark-up-and-vat) and 18 more |
|
|
1972
|
+
| `target` | `number` | — | The value this quantity is meant to reach - missed, never violated.<br>Shown in: [Put a chain inside a tree](#/chain/chain-in-a-tree), [The availability of a service (Installation)](#/installation/availability), [Write a tree (Calculation)](#/calculation/oee) and 5 more |
|
|
1973
|
+
| `limits` | `readonly `[`Limit`](#type-Limit)`[]` | — | Bounds the quantity is assessed against, through core's `assess()`.<br>Shown in: [Hold an interim to its limits](#/chain/error-budget), [Hold a figure to its limits (Tree)](#/tree/limits), [Say where a number came from (Given)](#/given/where-it-came-from) and 4 more |
|
|
1974
|
+
| `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/where-it-came-from), [A number one metric does not have (Metrics)](#/metrics/not-recorded), [Staff movement as a chain (Metrics)](#/metrics/staff-movement) and 1 more |
|
|
1975
|
+
| `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/where-it-came-from) |
|
|
1976
|
+
|
|
1977
|
+
##### Types on this page
|
|
1978
|
+
|
|
1979
|
+
###### `MetricValues`
|
|
1980
|
+
|
|
1981
|
+
A given's numbers where the calculation has metrics: one per metric id,
|
|
1982
|
+
`null` where the number is absent.
|
|
1983
|
+
|
|
1984
|
+
```ts
|
|
1985
|
+
type MetricValues = Readonly<Record<string, number | null>>;
|
|
1986
|
+
```
|
|
1987
|
+
|
|
1988
|
+
###### `FreshnessAges`
|
|
1989
|
+
|
|
1990
|
+
From `@umriss-ui/core`.
|
|
1991
|
+
|
|
1992
|
+
The two ages at which a value changes its state, in milliseconds. Both
|
|
1993
|
+
bounds belong to the older state: exactly five minutes old is already
|
|
1994
|
+
`stale`.
|
|
1995
|
+
|
|
1996
|
+
`alt <= lost` is the sensible order. Stated the other way round, the
|
|
1997
|
+
harder statement still wins - the middle state simply falls away.
|
|
1998
|
+
|
|
1999
|
+
| Prop | Type | Default | Description |
|
|
2000
|
+
|---|---|---|---|
|
|
2001
|
+
| `stale` *required* | `number` | — | From this age on the value counts as stale, but keeps its verdict. |
|
|
2002
|
+
| `lost` *required* | `number` | — | From this age on the connection counts as disconnected. |
|
|
2003
|
+
|
|
2004
|
+
###### `Limit`
|
|
2005
|
+
|
|
2006
|
+
From `@umriss-ui/core`.
|
|
2007
|
+
|
|
2008
|
+
A bound: a value, a side, a severity.
|
|
2009
|
+
|
|
2010
|
+
No tolerance band as input. A band is derived - two limits of equal
|
|
2011
|
+
severity on opposite sides enclose one - and as an input type it would
|
|
2012
|
+
force a `null` on one edge in the one-sided case. One-sided is the common
|
|
2013
|
+
case, not the exception.
|
|
2014
|
+
|
|
2015
|
+
| Prop | Type | Default | Description |
|
|
2016
|
+
|---|---|---|---|
|
|
2017
|
+
| `value` *required* | `number` | — | <br>Shown in: [Hold an interim to its limits](#/chain/error-budget), [Hold a figure to its limits (Tree)](#/tree/limits), [Say where a number came from (Given)](#/given/where-it-came-from) and 2 more |
|
|
2018
|
+
| `side` *required* | [`Side`](#type-Side)<br>`"upper" \| "lower"` | — | <br>Shown in: [Hold an interim to its limits](#/chain/error-budget), [Hold a figure to its limits (Tree)](#/tree/limits), [Say where a number came from (Given)](#/given/where-it-came-from) and 2 more |
|
|
2019
|
+
| `severity` *required* | [`Severity`](#type-Severity)<br>`"warning" \| "alarm"` | — | <br>Shown in: [Hold an interim to its limits](#/chain/error-budget), [Hold a figure to its limits (Tree)](#/tree/limits), [Say where a number came from (Given)](#/given/where-it-came-from) and 2 more |
|
|
2020
|
+
|
|
2021
|
+
###### `Side`
|
|
2022
|
+
|
|
2023
|
+
From `@umriss-ui/core`.
|
|
2024
|
+
|
|
2025
|
+
Whether a limit is an upper or a lower bound.
|
|
2026
|
+
|
|
2027
|
+
```ts
|
|
2028
|
+
type Side = "upper" | "lower";
|
|
2029
|
+
```
|
|
2030
|
+
|
|
2031
|
+
###### `Severity`
|
|
2032
|
+
|
|
2033
|
+
From `@umriss-ui/core`.
|
|
2034
|
+
|
|
2035
|
+
How seriously a violation weighs: one severity that advises and one that
|
|
2036
|
+
calls for action. Exactly two - whoever offers five gets five colours on
|
|
2037
|
+
the screen, and five colours are noise. For a third distinction one sets a
|
|
2038
|
+
second limit.
|
|
2039
|
+
|
|
2040
|
+
```ts
|
|
2041
|
+
type Severity = "warning" | "alarm";
|
|
2042
|
+
```
|
|
1851
2043
|
|
|
1852
2044
|
#### Known limits
|
|
1853
2045
|
|
|
1854
2046
|
- A chain in view does not fold; as an operand of a tree it folds to its last interim.
|
|
1855
2047
|
|
|
1856
|
-
What umriss deliberately does not build, and why: [ADR-0032](https://github.
|
|
2048
|
+
What umriss deliberately does not build, and why: [ADR-0032](https://romanhaendler.github.io/umriss-ui/what-umriss-ui-is-not/).
|
|
1857
2049
|
|
|
1858
2050
|
### Given
|
|
1859
2051
|
|
|
@@ -1867,7 +2059,7 @@ Demo page: https://romanhaendler.github.io/umriss-ui/calculation/given/
|
|
|
1867
2059
|
|
|
1868
2060
|
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.
|
|
1869
2061
|
|
|
1870
|
-
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).
|
|
2062
|
+
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)).
|
|
1871
2063
|
|
|
1872
2064
|
#### Examples
|
|
1873
2065
|
|
|
@@ -1923,7 +2115,7 @@ export default function AsOf() {
|
|
|
1923
2115
|
|
|
1924
2116
|
##### Read in German
|
|
1925
2117
|
|
|
1926
|
-
Operator words, reasons and number formats come from core's `LanguageProvider` (ADR-0019); your labels stay as you write them.
|
|
2118
|
+
Operator words, reasons and number formats come from core's `LanguageProvider` ([ADR-0019](https://github.com/romanhaendler/umriss-ui/blob/main/docs/adr/0019-two-wordings-ship-english-is-the-default.md)); your labels stay as you write them.
|
|
1927
2119
|
|
|
1928
2120
|
```tsx
|
|
1929
2121
|
import { LanguageProvider } from "@umriss-ui/core";
|
|
@@ -1950,25 +2142,96 @@ export default function InGerman() {
|
|
|
1950
2142
|
}
|
|
1951
2143
|
```
|
|
1952
2144
|
|
|
2145
|
+
#### Keyboard
|
|
2146
|
+
|
|
2147
|
+
The keys of [Calculation](#/calculation/keyboard-calculation) apply here.
|
|
2148
|
+
|
|
1953
2149
|
#### API
|
|
1954
2150
|
|
|
1955
2151
|
##### `GivenProps`
|
|
1956
2152
|
|
|
1957
2153
|
| Prop | Type | Default | Description |
|
|
1958
2154
|
|---|---|---|---|
|
|
1959
|
-
| `value`
|
|
1960
|
-
| `source` | `string` | — | Where the number came from: a system, a report, a person
|
|
1961
|
-
| `asOf` | `Date \| number` | — | When the number was true - not when it was fetched
|
|
1962
|
-
| `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
|
|
1963
|
-
| `label`
|
|
1964
|
-
| `id` | `string` | — | Makes the quantity referable: `<Ref to>` stands for it elsewhere. Needed only for a quantity used more than once. From `QuantityProps
|
|
1965
|
-
| `unit` | `string` | — | A label written after the number - "min", "pcs", "€". Never converted and never checked; the calculation does no unit algebra. From `QuantityProps
|
|
1966
|
-
| `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
|
|
1967
|
-
| `decimals` | `number` |
|
|
1968
|
-
| `target` | `number` | — | The value this quantity is meant to reach - missed, never violated. From `QuantityProps
|
|
1969
|
-
| `limits` | `readonly Limit[]` | — | Bounds the quantity is assessed against, through core's `assess()`. From `QuantityProps
|
|
1970
|
-
| `explanation` | `string` | — | A sentence of plain text beside the line: why the quantity is here, or what it means. From `QuantityProps
|
|
1971
|
-
| `aside` | `ReactNode` | — | Content of the caller's own beside the line - a sparkline, a link. It never takes part in the calculation. From `QuantityProps
|
|
2155
|
+
| `value` *required* | `number \| null \| undefined \| `[`MetricValues`](#type-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/where-it-came-from), [State when a number was true](#/given/as-of), [Read in German](#/given/in-german) and 34 more |
|
|
2156
|
+
| `source` | `string` | — | Where the number came from: a system, a report, a person.<br>Shown in: [Say where a number came from](#/given/where-it-came-from), [State when a number was true](#/given/as-of), [Staff movement as a chain (Metrics)](#/metrics/staff-movement) and 7 more |
|
|
2157
|
+
| `asOf` | `Date \| number` | — | When the number was true - not when it was fetched.<br>Shown in: [Say where a number came from](#/given/where-it-came-from), [State when a number was true](#/given/as-of), [The cost per stop of a day's tours (Worked examples)](#/worked-examples/cost-per-tour) |
|
|
2158
|
+
| `ages` | [`FreshnessAges`](#type-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/where-it-came-from), [The cost per stop of a day's tours (Worked examples)](#/worked-examples/cost-per-tour) |
|
|
2159
|
+
| `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/where-it-came-from), [State when a number was true](#/given/as-of), [Read in German](#/given/in-german) and 34 more |
|
|
2160
|
+
| `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/in-german), [The availability of a service (Installation)](#/installation/availability), [Write a tree (Calculation)](#/calculation/oee) and 9 more |
|
|
2161
|
+
| `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/where-it-came-from), [State when a number was true](#/given/as-of), [Read in German](#/given/in-german) and 28 more |
|
|
2162
|
+
| `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/where-it-came-from), [Read in German](#/given/in-german), [The availability of a service (Installation)](#/installation/availability) and 16 more |
|
|
2163
|
+
| `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/where-it-came-from), [State when a number was true](#/given/as-of), [Read in German](#/given/in-german) and 18 more |
|
|
2164
|
+
| `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/availability), [Write a tree (Calculation)](#/calculation/oee), [Show a share against a target (Tree)](#/tree/share-with-target) and 5 more |
|
|
2165
|
+
| `limits` | `readonly `[`Limit`](#type-Limit)`[]` | — | Bounds the quantity is assessed against, through core's `assess()`. From `QuantityProps`.<br>Shown in: [Say where a number came from](#/given/where-it-came-from), [Hold a figure to its limits (Tree)](#/tree/limits), [Hold an interim to its limits (Chain)](#/chain/error-budget) and 4 more |
|
|
2166
|
+
| `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/where-it-came-from), [A number one metric does not have (Metrics)](#/metrics/not-recorded), [Staff movement as a chain (Metrics)](#/metrics/staff-movement) and 1 more |
|
|
2167
|
+
| `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/where-it-came-from) |
|
|
2168
|
+
|
|
2169
|
+
##### Types on this page
|
|
2170
|
+
|
|
2171
|
+
###### `MetricValues`
|
|
2172
|
+
|
|
2173
|
+
A given's numbers where the calculation has metrics: one per metric id,
|
|
2174
|
+
`null` where the number is absent.
|
|
2175
|
+
|
|
2176
|
+
```ts
|
|
2177
|
+
type MetricValues = Readonly<Record<string, number | null>>;
|
|
2178
|
+
```
|
|
2179
|
+
|
|
2180
|
+
###### `FreshnessAges`
|
|
2181
|
+
|
|
2182
|
+
From `@umriss-ui/core`.
|
|
2183
|
+
|
|
2184
|
+
The two ages at which a value changes its state, in milliseconds. Both
|
|
2185
|
+
bounds belong to the older state: exactly five minutes old is already
|
|
2186
|
+
`stale`.
|
|
2187
|
+
|
|
2188
|
+
`alt <= lost` is the sensible order. Stated the other way round, the
|
|
2189
|
+
harder statement still wins - the middle state simply falls away.
|
|
2190
|
+
|
|
2191
|
+
| Prop | Type | Default | Description |
|
|
2192
|
+
|---|---|---|---|
|
|
2193
|
+
| `stale` *required* | `number` | — | From this age on the value counts as stale, but keeps its verdict. |
|
|
2194
|
+
| `lost` *required* | `number` | — | From this age on the connection counts as disconnected. |
|
|
2195
|
+
|
|
2196
|
+
###### `Limit`
|
|
2197
|
+
|
|
2198
|
+
From `@umriss-ui/core`.
|
|
2199
|
+
|
|
2200
|
+
A bound: a value, a side, a severity.
|
|
2201
|
+
|
|
2202
|
+
No tolerance band as input. A band is derived - two limits of equal
|
|
2203
|
+
severity on opposite sides enclose one - and as an input type it would
|
|
2204
|
+
force a `null` on one edge in the one-sided case. One-sided is the common
|
|
2205
|
+
case, not the exception.
|
|
2206
|
+
|
|
2207
|
+
| Prop | Type | Default | Description |
|
|
2208
|
+
|---|---|---|---|
|
|
2209
|
+
| `value` *required* | `number` | — | <br>Shown in: [Say where a number came from](#/given/where-it-came-from), [Hold a figure to its limits (Tree)](#/tree/limits), [Hold an interim to its limits (Chain)](#/chain/error-budget) and 2 more |
|
|
2210
|
+
| `side` *required* | [`Side`](#type-Side)<br>`"upper" \| "lower"` | — | <br>Shown in: [Say where a number came from](#/given/where-it-came-from), [Hold a figure to its limits (Tree)](#/tree/limits), [Hold an interim to its limits (Chain)](#/chain/error-budget) and 2 more |
|
|
2211
|
+
| `severity` *required* | [`Severity`](#type-Severity)<br>`"warning" \| "alarm"` | — | <br>Shown in: [Say where a number came from](#/given/where-it-came-from), [Hold a figure to its limits (Tree)](#/tree/limits), [Hold an interim to its limits (Chain)](#/chain/error-budget) and 2 more |
|
|
2212
|
+
|
|
2213
|
+
###### `Side`
|
|
2214
|
+
|
|
2215
|
+
From `@umriss-ui/core`.
|
|
2216
|
+
|
|
2217
|
+
Whether a limit is an upper or a lower bound.
|
|
2218
|
+
|
|
2219
|
+
```ts
|
|
2220
|
+
type Side = "upper" | "lower";
|
|
2221
|
+
```
|
|
2222
|
+
|
|
2223
|
+
###### `Severity`
|
|
2224
|
+
|
|
2225
|
+
From `@umriss-ui/core`.
|
|
2226
|
+
|
|
2227
|
+
How seriously a violation weighs: one severity that advises and one that
|
|
2228
|
+
calls for action. Exactly two - whoever offers five gets five colours on
|
|
2229
|
+
the screen, and five colours are noise. For a third distinction one sets a
|
|
2230
|
+
second limit.
|
|
2231
|
+
|
|
2232
|
+
```ts
|
|
2233
|
+
type Severity = "warning" | "alarm";
|
|
2234
|
+
```
|
|
1972
2235
|
|
|
1973
2236
|
### Metrics
|
|
1974
2237
|
|
|
@@ -1980,7 +2243,7 @@ import { Calculation, Given, Sum, Chain, Plus, Minus, Interim } from "@umriss-ui
|
|
|
1980
2243
|
|
|
1981
2244
|
Demo page: https://romanhaendler.github.io/umriss-ui/calculation/metrics/
|
|
1982
2245
|
|
|
1983
|
-
`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).
|
|
2246
|
+
`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)).
|
|
1984
2247
|
|
|
1985
2248
|
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.
|
|
1986
2249
|
|
|
@@ -2416,16 +2679,20 @@ export default function WholeCompany() {
|
|
|
2416
2679
|
- A ratio across two metrics, such as FTE per head → a calculation of its own, a `Quotient` of two givens
|
|
2417
2680
|
- Many figures per row, sorted and filtered → `Table` from @umriss-ui/table
|
|
2418
2681
|
|
|
2682
|
+
#### Keyboard
|
|
2683
|
+
|
|
2684
|
+
The keys of [Calculation](#/calculation/keyboard-calculation) apply here.
|
|
2685
|
+
|
|
2419
2686
|
#### API
|
|
2420
2687
|
|
|
2421
2688
|
##### `Metric`
|
|
2422
2689
|
|
|
2423
2690
|
| Prop | Type | Default | Description |
|
|
2424
2691
|
|---|---|---|---|
|
|
2425
|
-
| `id`
|
|
2426
|
-
| `label`
|
|
2427
|
-
| `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
|
|
2428
|
-
| `decimals` | `number` |
|
|
2692
|
+
| `id` *required* | `string` | — | The key of this metric's number in every `value` object.<br>Shown in: [Headcount and full-time equivalents](#/metrics/two-teams), [A number one metric does not have](#/metrics/not-recorded), [Team, cost centre, business line](#/metrics/business-line) and 3 more |
|
|
2693
|
+
| `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/two-teams), [A number one metric does not have](#/metrics/not-recorded), [Team, cost centre, business line](#/metrics/business-line) and 3 more |
|
|
2694
|
+
| `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/two-teams), [A number one metric does not have](#/metrics/not-recorded), [Team, cost centre, business line](#/metrics/business-line) and 3 more |
|
|
2695
|
+
| `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/two-teams), [A number one metric does not have](#/metrics/not-recorded), [Team, cost centre, business line](#/metrics/business-line) and 3 more |
|
|
2429
2696
|
|
|
2430
2697
|
#### Known limits
|
|
2431
2698
|
|
|
@@ -2433,7 +2700,7 @@ export default function WholeCompany() {
|
|
|
2433
2700
|
- 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`.
|
|
2434
2701
|
- No target or limits with metrics: an assessment per cell is not there yet.
|
|
2435
2702
|
|
|
2436
|
-
What umriss deliberately does not build, and why: [ADR-0032](https://github.
|
|
2703
|
+
What umriss deliberately does not build, and why: [ADR-0032](https://romanhaendler.github.io/umriss-ui/what-umriss-ui-is-not/).
|
|
2437
2704
|
|
|
2438
2705
|
## In practice
|
|
2439
2706
|
|
|
@@ -2567,6 +2834,72 @@ export default function LimitInside() {
|
|
|
2567
2834
|
}
|
|
2568
2835
|
```
|
|
2569
2836
|
|
|
2837
|
+
#### Keyboard
|
|
2838
|
+
|
|
2839
|
+
The keys of [Calculation](#/calculation/keyboard-calculation) apply here.
|
|
2840
|
+
|
|
2841
|
+
#### Props on this page
|
|
2842
|
+
|
|
2843
|
+
From `CalculationProps` — the full table stands on [Calculation](#/calculation/type-CalculationProps).
|
|
2844
|
+
|
|
2845
|
+
| Prop | Type | Default | Description |
|
|
2846
|
+
|---|---|---|---|
|
|
2847
|
+
| [`children`](#/calculation/CalculationProps-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. |
|
|
2848
|
+
|
|
2849
|
+
From `OperatorProps` — the full table stands on [Tree](#/tree/type-OperatorProps).
|
|
2850
|
+
|
|
2851
|
+
| Prop | Type | Default | Description |
|
|
2852
|
+
|---|---|---|---|
|
|
2853
|
+
| [`children`](#/tree/OperatorProps-children) | `ReactNode` | — | The operands, in order: quantities, givens and references. |
|
|
2854
|
+
| [`label`](#/tree/OperatorProps-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`. |
|
|
2855
|
+
| [`unit`](#/tree/OperatorProps-unit) | `string` | — | A label written after the number - "min", "pcs", "€". Never converted and never checked; the calculation does no unit algebra. From `QuantityProps`. |
|
|
2856
|
+
| [`format`](#/tree/OperatorProps-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`. |
|
|
2857
|
+
| [`decimals`](#/tree/OperatorProps-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`. |
|
|
2858
|
+
| [`target`](#/tree/OperatorProps-target) | `number` | — | The value this quantity is meant to reach - missed, never violated. From `QuantityProps`. |
|
|
2859
|
+
| [`limits`](#/tree/OperatorProps-limits) | `readonly `[`Limit`](#/tree/type-Limit)`[]` | — | Bounds the quantity is assessed against, through core's `assess()`. From `QuantityProps`. |
|
|
2860
|
+
|
|
2861
|
+
From `ChainProps` — the full table stands on [Chain](#/chain/type-ChainProps).
|
|
2862
|
+
|
|
2863
|
+
| Prop | Type | Default | Description |
|
|
2864
|
+
|---|---|---|---|
|
|
2865
|
+
| [`children`](#/chain/ChainProps-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. |
|
|
2866
|
+
|
|
2867
|
+
From `ChainOperandProps` — the full table stands on [Chain](#/chain/type-ChainOperandProps).
|
|
2868
|
+
|
|
2869
|
+
| Prop | Type | Default | Description |
|
|
2870
|
+
|---|---|---|---|
|
|
2871
|
+
| [`children`](#/chain/ChainOperandProps-children) | `ReactNode` | — | Instead of `label` and `value`: exactly one quantity - a tree, a `<Ref>` or a `<Chain>`. |
|
|
2872
|
+
| [`source`](#/chain/ChainOperandProps-source) | `string` | — | Where the number came from: a system, a report, a person. From `GivenProps`. |
|
|
2873
|
+
| [`unit`](#/chain/ChainOperandProps-unit) | `string` | — | A label written after the number - "min", "pcs", "€". Never converted and never checked; the calculation does no unit algebra. From `QuantityProps`. |
|
|
2874
|
+
| [`format`](#/chain/ChainOperandProps-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`. |
|
|
2875
|
+
| [`decimals`](#/chain/ChainOperandProps-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`. |
|
|
2876
|
+
| [`target`](#/chain/ChainOperandProps-target) | `number` | — | The value this quantity is meant to reach - missed, never violated. From `QuantityProps`. |
|
|
2877
|
+
| [`limits`](#/chain/ChainOperandProps-limits) | `readonly `[`Limit`](#/chain/type-Limit)`[]` | — | Bounds the quantity is assessed against, through core's `assess()`. From `QuantityProps`. |
|
|
2878
|
+
|
|
2879
|
+
From `QuantityProps` — the full table stands on [Chain](#/chain/type-QuantityProps).
|
|
2880
|
+
|
|
2881
|
+
| Prop | Type | Default | Description |
|
|
2882
|
+
|---|---|---|---|
|
|
2883
|
+
| [`label`](#/chain/QuantityProps-label) *required* | `string` | — | What the quantity is called. It stands on its line, wherever it is an operand, and in the accessible sentence. |
|
|
2884
|
+
| [`unit`](#/chain/QuantityProps-unit) | `string` | — | A label written after the number - "min", "pcs", "€". Never converted and never checked; the calculation does no unit algebra. |
|
|
2885
|
+
| [`format`](#/chain/QuantityProps-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. |
|
|
2886
|
+
| [`decimals`](#/chain/QuantityProps-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. |
|
|
2887
|
+
| [`target`](#/chain/QuantityProps-target) | `number` | — | The value this quantity is meant to reach - missed, never violated. |
|
|
2888
|
+
| [`limits`](#/chain/QuantityProps-limits) | `readonly `[`Limit`](#/chain/type-Limit)`[]` | — | Bounds the quantity is assessed against, through core's `assess()`. |
|
|
2889
|
+
|
|
2890
|
+
From `GivenProps` — the full table stands on [Given](#/given/type-GivenProps).
|
|
2891
|
+
|
|
2892
|
+
| Prop | Type | Default | Description |
|
|
2893
|
+
|---|---|---|---|
|
|
2894
|
+
| [`value`](#/given/GivenProps-value) *required* | `number \| null \| undefined \| `[`MetricValues`](#/given/type-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. |
|
|
2895
|
+
| [`source`](#/given/GivenProps-source) | `string` | — | Where the number came from: a system, a report, a person. |
|
|
2896
|
+
| [`label`](#/given/GivenProps-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`. |
|
|
2897
|
+
| [`unit`](#/given/GivenProps-unit) | `string` | — | A label written after the number - "min", "pcs", "€". Never converted and never checked; the calculation does no unit algebra. From `QuantityProps`. |
|
|
2898
|
+
| [`format`](#/given/GivenProps-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`. |
|
|
2899
|
+
| [`decimals`](#/given/GivenProps-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`. |
|
|
2900
|
+
| [`target`](#/given/GivenProps-target) | `number` | — | The value this quantity is meant to reach - missed, never violated. From `QuantityProps`. |
|
|
2901
|
+
| [`limits`](#/given/GivenProps-limits) | `readonly `[`Limit`](#/given/type-Limit)`[]` | — | Bounds the quantity is assessed against, through core's `assess()`. From `QuantityProps`. |
|
|
2902
|
+
|
|
2570
2903
|
### Worked examples
|
|
2571
2904
|
|
|
2572
2905
|
Whole figures as a screen shows them: the cost per stop of a day's tours, invoices with discount and VAT, and the equipment effectiveness of a hall, each built from data.
|
|
@@ -2730,6 +3063,10 @@ const ELECTRIC = TOURS.filter((tour) => typeOf(tour.vehicle) === "e-van");
|
|
|
2730
3063
|
const STOPS = TOURS.reduce((sum, tour) => sum + tour.stops.length, 0);
|
|
2731
3064
|
|
|
2732
3065
|
const AGES = { stale: 24 * 3_600_000, lost: 14 * 24 * 3_600_000 };
|
|
3066
|
+
/* The price was read on Saturday at 06:00, seen from Tuesday 10:30; its
|
|
3067
|
+
freshness counts from page load, the tours keep their Tuesday. */
|
|
3068
|
+
const LOADED = Date.now();
|
|
3069
|
+
const DIESEL_READ = LOADED - (at(10, 30) - new Date(2026, 2, 14, 6, 0).getTime());
|
|
2733
3070
|
|
|
2734
3071
|
export default function CostPerTour() {
|
|
2735
3072
|
return (
|
|
@@ -2759,7 +3096,7 @@ export default function CostPerTour() {
|
|
|
2759
3096
|
unit="€/l"
|
|
2760
3097
|
decimals={2}
|
|
2761
3098
|
source="Fuel card, weekly price"
|
|
2762
|
-
asOf={
|
|
3099
|
+
asOf={DIESEL_READ}
|
|
2763
3100
|
ages={AGES}
|
|
2764
3101
|
/>
|
|
2765
3102
|
</Product>
|
|
@@ -3012,3 +3349,256 @@ export default function HallOee() {
|
|
|
3012
3349
|
);
|
|
3013
3350
|
}
|
|
3014
3351
|
```
|
|
3352
|
+
|
|
3353
|
+
#### Keyboard
|
|
3354
|
+
|
|
3355
|
+
The keys of [Calculation](#/calculation/keyboard-calculation) apply here.
|
|
3356
|
+
|
|
3357
|
+
#### Props on this page
|
|
3358
|
+
|
|
3359
|
+
From `CalculationProps` — the full table stands on [Calculation](#/calculation/type-CalculationProps).
|
|
3360
|
+
|
|
3361
|
+
| Prop | Type | Default | Description |
|
|
3362
|
+
|---|---|---|---|
|
|
3363
|
+
| [`children`](#/calculation/CalculationProps-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. |
|
|
3364
|
+
|
|
3365
|
+
From `OperatorProps` — the full table stands on [Tree](#/tree/type-OperatorProps).
|
|
3366
|
+
|
|
3367
|
+
| Prop | Type | Default | Description |
|
|
3368
|
+
|---|---|---|---|
|
|
3369
|
+
| [`children`](#/tree/OperatorProps-children) | `ReactNode` | — | The operands, in order: quantities, givens and references. |
|
|
3370
|
+
| [`label`](#/tree/OperatorProps-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`. |
|
|
3371
|
+
| [`id`](#/tree/OperatorProps-id) | `string` | — | Makes the quantity referable: `<Ref to>` stands for it elsewhere. Needed only for a quantity used more than once. From `QuantityProps`. |
|
|
3372
|
+
| [`unit`](#/tree/OperatorProps-unit) | `string` | — | A label written after the number - "min", "pcs", "€". Never converted and never checked; the calculation does no unit algebra. From `QuantityProps`. |
|
|
3373
|
+
| [`format`](#/tree/OperatorProps-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`. |
|
|
3374
|
+
| [`decimals`](#/tree/OperatorProps-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`. |
|
|
3375
|
+
| [`target`](#/tree/OperatorProps-target) | `number` | — | The value this quantity is meant to reach - missed, never violated. From `QuantityProps`. |
|
|
3376
|
+
| [`limits`](#/tree/OperatorProps-limits) | `readonly `[`Limit`](#/tree/type-Limit)`[]` | — | Bounds the quantity is assessed against, through core's `assess()`. From `QuantityProps`. |
|
|
3377
|
+
|
|
3378
|
+
From `RefProps` — the full table stands on [Tree](#/tree/type-RefProps).
|
|
3379
|
+
|
|
3380
|
+
| Prop | Type | Default | Description |
|
|
3381
|
+
|---|---|---|---|
|
|
3382
|
+
| [`to`](#/tree/RefProps-to) *required* | `string` | — | The `id` of the quantity this reference stands for. |
|
|
3383
|
+
|
|
3384
|
+
From `ChainProps` — the full table stands on [Chain](#/chain/type-ChainProps).
|
|
3385
|
+
|
|
3386
|
+
| Prop | Type | Default | Description |
|
|
3387
|
+
|---|---|---|---|
|
|
3388
|
+
| [`children`](#/chain/ChainProps-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. |
|
|
3389
|
+
|
|
3390
|
+
From `ChainOperandProps` — the full table stands on [Chain](#/chain/type-ChainOperandProps).
|
|
3391
|
+
|
|
3392
|
+
| Prop | Type | Default | Description |
|
|
3393
|
+
|---|---|---|---|
|
|
3394
|
+
| [`label`](#/chain/ChainOperandProps-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. |
|
|
3395
|
+
| [`value`](#/chain/ChainOperandProps-value) | `number \| null \| `[`MetricValues`](#/chain/type-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`. |
|
|
3396
|
+
| [`children`](#/chain/ChainOperandProps-children) | `ReactNode` | — | Instead of `label` and `value`: exactly one quantity - a tree, a `<Ref>` or a `<Chain>`. |
|
|
3397
|
+
| [`source`](#/chain/ChainOperandProps-source) | `string` | — | Where the number came from: a system, a report, a person. From `GivenProps`. |
|
|
3398
|
+
| [`asOf`](#/chain/ChainOperandProps-asOf) | `Date \| number` | — | When the number was true - not when it was fetched. From `GivenProps`. |
|
|
3399
|
+
| [`ages`](#/chain/ChainOperandProps-ages) | [`FreshnessAges`](#/chain/type-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`. |
|
|
3400
|
+
| [`id`](#/chain/ChainOperandProps-id) | `string` | — | Makes the quantity referable: `<Ref to>` stands for it elsewhere. Needed only for a quantity used more than once. From `QuantityProps`. |
|
|
3401
|
+
| [`unit`](#/chain/ChainOperandProps-unit) | `string` | — | A label written after the number - "min", "pcs", "€". Never converted and never checked; the calculation does no unit algebra. From `QuantityProps`. |
|
|
3402
|
+
| [`format`](#/chain/ChainOperandProps-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`. |
|
|
3403
|
+
| [`decimals`](#/chain/ChainOperandProps-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`. |
|
|
3404
|
+
| [`target`](#/chain/ChainOperandProps-target) | `number` | — | The value this quantity is meant to reach - missed, never violated. From `QuantityProps`. |
|
|
3405
|
+
| [`limits`](#/chain/ChainOperandProps-limits) | `readonly `[`Limit`](#/chain/type-Limit)`[]` | — | Bounds the quantity is assessed against, through core's `assess()`. From `QuantityProps`. |
|
|
3406
|
+
|
|
3407
|
+
From `QuantityProps` — the full table stands on [Chain](#/chain/type-QuantityProps).
|
|
3408
|
+
|
|
3409
|
+
| Prop | Type | Default | Description |
|
|
3410
|
+
|---|---|---|---|
|
|
3411
|
+
| [`label`](#/chain/QuantityProps-label) *required* | `string` | — | What the quantity is called. It stands on its line, wherever it is an operand, and in the accessible sentence. |
|
|
3412
|
+
| [`id`](#/chain/QuantityProps-id) | `string` | — | Makes the quantity referable: `<Ref to>` stands for it elsewhere. Needed only for a quantity used more than once. |
|
|
3413
|
+
| [`unit`](#/chain/QuantityProps-unit) | `string` | — | A label written after the number - "min", "pcs", "€". Never converted and never checked; the calculation does no unit algebra. |
|
|
3414
|
+
| [`format`](#/chain/QuantityProps-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. |
|
|
3415
|
+
| [`decimals`](#/chain/QuantityProps-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. |
|
|
3416
|
+
| [`target`](#/chain/QuantityProps-target) | `number` | — | The value this quantity is meant to reach - missed, never violated. |
|
|
3417
|
+
| [`limits`](#/chain/QuantityProps-limits) | `readonly `[`Limit`](#/chain/type-Limit)`[]` | — | Bounds the quantity is assessed against, through core's `assess()`. |
|
|
3418
|
+
|
|
3419
|
+
From `GivenProps` — the full table stands on [Given](#/given/type-GivenProps).
|
|
3420
|
+
|
|
3421
|
+
| Prop | Type | Default | Description |
|
|
3422
|
+
|---|---|---|---|
|
|
3423
|
+
| [`value`](#/given/GivenProps-value) *required* | `number \| null \| undefined \| `[`MetricValues`](#/given/type-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. |
|
|
3424
|
+
| [`source`](#/given/GivenProps-source) | `string` | — | Where the number came from: a system, a report, a person. |
|
|
3425
|
+
| [`asOf`](#/given/GivenProps-asOf) | `Date \| number` | — | When the number was true - not when it was fetched. |
|
|
3426
|
+
| [`ages`](#/given/GivenProps-ages) | [`FreshnessAges`](#/given/type-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. |
|
|
3427
|
+
| [`label`](#/given/GivenProps-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`. |
|
|
3428
|
+
| [`id`](#/given/GivenProps-id) | `string` | — | Makes the quantity referable: `<Ref to>` stands for it elsewhere. Needed only for a quantity used more than once. From `QuantityProps`. |
|
|
3429
|
+
| [`unit`](#/given/GivenProps-unit) | `string` | — | A label written after the number - "min", "pcs", "€". Never converted and never checked; the calculation does no unit algebra. From `QuantityProps`. |
|
|
3430
|
+
| [`format`](#/given/GivenProps-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`. |
|
|
3431
|
+
| [`decimals`](#/given/GivenProps-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`. |
|
|
3432
|
+
| [`target`](#/given/GivenProps-target) | `number` | — | The value this quantity is meant to reach - missed, never violated. From `QuantityProps`. |
|
|
3433
|
+
| [`limits`](#/given/GivenProps-limits) | `readonly `[`Limit`](#/given/type-Limit)`[]` | — | Bounds the quantity is assessed against, through core's `assess()`. From `QuantityProps`. |
|
|
3434
|
+
|
|
3435
|
+
## API index
|
|
3436
|
+
|
|
3437
|
+
Every name the package exports, in one place.
|
|
3438
|
+
|
|
3439
|
+
### API index
|
|
3440
|
+
|
|
3441
|
+
Everything `@umriss-ui/calculation` exports, with its signature. A component's props stand on its own page.
|
|
3442
|
+
|
|
3443
|
+
Demo page: https://romanhaendler.github.io/umriss-ui/calculation/api/
|
|
3444
|
+
|
|
3445
|
+
#### Components
|
|
3446
|
+
|
|
3447
|
+
##### `Calculation`
|
|
3448
|
+
|
|
3449
|
+
[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.
|
|
3450
|
+
|
|
3451
|
+
Used on [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).
|
|
3452
|
+
|
|
3453
|
+
##### `Chain`
|
|
3454
|
+
|
|
3455
|
+
[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.
|
|
3456
|
+
|
|
3457
|
+
Used on [Calculation](#/calculation), [Chain](#/chain), [Given](#/given), [Metrics](#/metrics), [What can go wrong](#/what-can-go-wrong) and [Worked examples](#/worked-examples).
|
|
3458
|
+
|
|
3459
|
+
##### `Difference`
|
|
3460
|
+
|
|
3461
|
+
The first operand minus every other: a − b − c.
|
|
3462
|
+
|
|
3463
|
+
```ts
|
|
3464
|
+
const Difference: (props: OperatorProps) => null;
|
|
3465
|
+
```
|
|
3466
|
+
|
|
3467
|
+
Used on [Scenarios](#/), [Installation](#/installation), [Calculation](#/calculation), [Tree](#/tree) and [Worked examples](#/worked-examples).
|
|
3468
|
+
|
|
3469
|
+
##### `DividedBy`
|
|
3470
|
+
|
|
3471
|
+
Divides the named value before it by its operand.
|
|
3472
|
+
|
|
3473
|
+
```ts
|
|
3474
|
+
const DividedBy: (props: ChainOperandProps) => null;
|
|
3475
|
+
```
|
|
3476
|
+
|
|
3477
|
+
Used on [Chain](#/chain), [Metrics](#/metrics) and [Worked examples](#/worked-examples).
|
|
3478
|
+
|
|
3479
|
+
##### `Given`
|
|
3480
|
+
|
|
3481
|
+
[Given](#/given) – The numbers a calculation starts from (inputs, leaves): where they came from, when they were true, and whether they are still fresh.
|
|
3482
|
+
|
|
3483
|
+
Used on [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).
|
|
3484
|
+
|
|
3485
|
+
##### `Interim`
|
|
3486
|
+
|
|
3487
|
+
Names the value of a chain where it stands.
|
|
3488
|
+
|
|
3489
|
+
```ts
|
|
3490
|
+
const Interim: (props: QuantityProps) => null;
|
|
3491
|
+
```
|
|
3492
|
+
|
|
3493
|
+
Used on [Calculation](#/calculation), [Chain](#/chain), [Given](#/given), [Metrics](#/metrics), [What can go wrong](#/what-can-go-wrong) and [Worked examples](#/worked-examples).
|
|
3494
|
+
|
|
3495
|
+
##### `Minus`
|
|
3496
|
+
|
|
3497
|
+
Takes its operand from the value before it.
|
|
3498
|
+
|
|
3499
|
+
```ts
|
|
3500
|
+
const Minus: (props: ChainOperandProps) => null;
|
|
3501
|
+
```
|
|
3502
|
+
|
|
3503
|
+
Used on [Calculation](#/calculation), [Chain](#/chain), [Given](#/given) and [Metrics](#/metrics).
|
|
3504
|
+
|
|
3505
|
+
##### `Plus`
|
|
3506
|
+
|
|
3507
|
+
Adds its operand to the value before it.
|
|
3508
|
+
|
|
3509
|
+
```ts
|
|
3510
|
+
const Plus: (props: ChainOperandProps) => null;
|
|
3511
|
+
```
|
|
3512
|
+
|
|
3513
|
+
Used on [Calculation](#/calculation), [Chain](#/chain), [Metrics](#/metrics), [What can go wrong](#/what-can-go-wrong) and [Worked examples](#/worked-examples).
|
|
3514
|
+
|
|
3515
|
+
##### `Product`
|
|
3516
|
+
|
|
3517
|
+
The product of two or more operands.
|
|
3518
|
+
|
|
3519
|
+
```ts
|
|
3520
|
+
const Product: (props: OperatorProps) => null;
|
|
3521
|
+
```
|
|
3522
|
+
|
|
3523
|
+
Used on [Scenarios](#/), [Calculation](#/calculation), [Tree](#/tree), [Chain](#/chain), [Given](#/given), [Metrics](#/metrics), [What can go wrong](#/what-can-go-wrong) and [Worked examples](#/worked-examples).
|
|
3524
|
+
|
|
3525
|
+
##### `Quotient`
|
|
3526
|
+
|
|
3527
|
+
Exactly two operands: the first divided by the second.
|
|
3528
|
+
|
|
3529
|
+
```ts
|
|
3530
|
+
const Quotient: (props: OperatorProps) => null;
|
|
3531
|
+
```
|
|
3532
|
+
|
|
3533
|
+
Used on [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).
|
|
3534
|
+
|
|
3535
|
+
##### `Ref`
|
|
3536
|
+
|
|
3537
|
+
[Tree](#/tree) – A quantity defined elsewhere in the calculation, standing as an operand.
|
|
3538
|
+
|
|
3539
|
+
Used on [Scenarios](#/), [Installation](#/installation), [Calculation](#/calculation), [Tree](#/tree), [Chain](#/chain), [Given](#/given) and [Worked examples](#/worked-examples).
|
|
3540
|
+
|
|
3541
|
+
##### `Sum`
|
|
3542
|
+
|
|
3543
|
+
The sum of two or more operands.
|
|
3544
|
+
|
|
3545
|
+
```ts
|
|
3546
|
+
const Sum: (props: OperatorProps) => null;
|
|
3547
|
+
```
|
|
3548
|
+
|
|
3549
|
+
Used on [Scenarios](#/), [Calculation](#/calculation), [Tree](#/tree), [Chain](#/chain), [Metrics](#/metrics), [What can go wrong](#/what-can-go-wrong) and [Worked examples](#/worked-examples).
|
|
3550
|
+
|
|
3551
|
+
##### `Times`
|
|
3552
|
+
|
|
3553
|
+
Multiplies the named value before it by its operand.
|
|
3554
|
+
|
|
3555
|
+
```ts
|
|
3556
|
+
const Times: (props: ChainOperandProps) => null;
|
|
3557
|
+
```
|
|
3558
|
+
|
|
3559
|
+
Used on [Chain](#/chain) and [Metrics](#/metrics).
|
|
3560
|
+
|
|
3561
|
+
#### Types
|
|
3562
|
+
|
|
3563
|
+
##### `CalculationProps`
|
|
3564
|
+
|
|
3565
|
+
Its table stands on [Calculation](#/calculation/type-CalculationProps).
|
|
3566
|
+
|
|
3567
|
+
##### `ChainOperandProps`
|
|
3568
|
+
|
|
3569
|
+
Its table stands on [Chain](#/chain/type-ChainOperandProps).
|
|
3570
|
+
|
|
3571
|
+
##### `ChainProps`
|
|
3572
|
+
|
|
3573
|
+
Its table stands on [Chain](#/chain/type-ChainProps).
|
|
3574
|
+
|
|
3575
|
+
##### `GivenProps`
|
|
3576
|
+
|
|
3577
|
+
Its table stands on [Given](#/given/type-GivenProps).
|
|
3578
|
+
|
|
3579
|
+
##### `Metric`
|
|
3580
|
+
|
|
3581
|
+
Its table stands on [Metrics](#/metrics/type-Metric).
|
|
3582
|
+
|
|
3583
|
+
Used on [Metrics](#/metrics).
|
|
3584
|
+
|
|
3585
|
+
##### `MetricValues`
|
|
3586
|
+
|
|
3587
|
+
A given's numbers where the calculation has metrics: one per metric id,
|
|
3588
|
+
`null` where the number is absent.
|
|
3589
|
+
|
|
3590
|
+
```ts
|
|
3591
|
+
type MetricValues = Readonly<Record<string, number | null>>;
|
|
3592
|
+
```
|
|
3593
|
+
|
|
3594
|
+
##### `OperatorProps`
|
|
3595
|
+
|
|
3596
|
+
Its table stands on [Tree](#/tree/type-OperatorProps).
|
|
3597
|
+
|
|
3598
|
+
##### `QuantityProps`
|
|
3599
|
+
|
|
3600
|
+
Its table stands on [Chain](#/chain/type-QuantityProps).
|
|
3601
|
+
|
|
3602
|
+
##### `RefProps`
|
|
3603
|
+
|
|
3604
|
+
Its table stands on [Tree](#/tree/type-RefProps).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umriss-ui/calculation",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"description": "React calculation view for data-dense applications - a derivation written as it is shown, evaluated by the library, folded and read line by line.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Roman Händler",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"peerDependencies": {
|
|
48
48
|
"react": ">=18",
|
|
49
49
|
"react-dom": ">=18",
|
|
50
|
-
"@umriss-ui/core": "^0.
|
|
50
|
+
"@umriss-ui/core": "^0.26.0"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@fontsource/geist-mono": "^5.3.0",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"typescript": "^5.6.3",
|
|
62
62
|
"vite": "^6.0.0",
|
|
63
63
|
"vite-plugin-dts": "^4.3.0",
|
|
64
|
-
"@umriss-ui/core": "0.
|
|
64
|
+
"@umriss-ui/core": "0.26.0",
|
|
65
65
|
"@umriss-ui/demo": "0.0.0"
|
|
66
66
|
},
|
|
67
67
|
"scripts": {
|