@communitiesuk/svelte-component-library 0.1.19-beta.35 → 0.1.19-beta.36
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.
|
@@ -100,6 +100,7 @@
|
|
|
100
100
|
niceTicks = true,
|
|
101
101
|
ticksDomain = $bindable([[]]),
|
|
102
102
|
axisDomain = $bindable([[]]),
|
|
103
|
+
getChartDomain = undefined,
|
|
103
104
|
} = $props();
|
|
104
105
|
|
|
105
106
|
let xTickFirst = $derived(ticksDomain.length ? ticksDomain[0] : 0);
|
|
@@ -111,6 +112,10 @@
|
|
|
111
112
|
polarity === "standard" ? [domainMin, domainMax] : [domainMax, domainMin],
|
|
112
113
|
);
|
|
113
114
|
|
|
115
|
+
$effect(() => {
|
|
116
|
+
getChartDomain?.(chartDomain);
|
|
117
|
+
});
|
|
118
|
+
|
|
114
119
|
const segmentScale = $derived(
|
|
115
120
|
scaleLinear().domain([0, nSegments]).range([domainMin, domainMax]),
|
|
116
121
|
);
|
|
@@ -58,6 +58,7 @@ declare const PositionChart: import("svelte").Component<{
|
|
|
58
58
|
niceTicks?: boolean;
|
|
59
59
|
ticksDomain?: any[];
|
|
60
60
|
axisDomain?: any[];
|
|
61
|
+
getChartDomain?: any;
|
|
61
62
|
}, {}, "chartWidth" | "axisDomain" | "activeMarkerId" | "ticksDomain">;
|
|
62
63
|
type $$ComponentProps = {
|
|
63
64
|
value?: any;
|
|
@@ -114,4 +115,5 @@ type $$ComponentProps = {
|
|
|
114
115
|
niceTicks?: boolean;
|
|
115
116
|
ticksDomain?: any[];
|
|
116
117
|
axisDomain?: any[];
|
|
118
|
+
getChartDomain?: any;
|
|
117
119
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script>
|
|
2
|
-
import Button from "
|
|
2
|
+
import { Button } from "@communitiesuk/svelte-component-library";
|
|
3
3
|
|
|
4
4
|
let {
|
|
5
5
|
data = [],
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
key: column,
|
|
44
44
|
isUnique: keyIsUnique,
|
|
45
45
|
dataType: columnDataType,
|
|
46
|
-
id: metadata[column]
|
|
46
|
+
id: metadata?.[column]?.order ?? 0,
|
|
47
47
|
});
|
|
48
48
|
}
|
|
49
49
|
|
|
@@ -184,8 +184,8 @@
|
|
|
184
184
|
<th
|
|
185
185
|
scope="col"
|
|
186
186
|
class={`govuk-table__header ${column.dataType === "number" ? "govuk-table__header--numeric" : ""}`}
|
|
187
|
-
title={metadata[column.key]?.explainer}
|
|
188
|
-
style={metadata[column.key]?.width
|
|
187
|
+
title={metadata?.[column.key]?.explainer}
|
|
188
|
+
style={metadata?.[column.key]?.width
|
|
189
189
|
? `min-width: ${metadata[column.key].width}`
|
|
190
190
|
: undefined}
|
|
191
191
|
aria-sort={sortState.column !== column.key ||
|
|
@@ -197,7 +197,7 @@
|
|
|
197
197
|
>
|
|
198
198
|
<div class="header">
|
|
199
199
|
<Button
|
|
200
|
-
textContent={metadata[column.key]?.shortLabel ?? column.key}
|
|
200
|
+
textContent={metadata?.[column.key]?.shortLabel ?? column.key}
|
|
201
201
|
buttonType={"table header"}
|
|
202
202
|
direction={sortState.column === column.key
|
|
203
203
|
? sortState.order
|
|
@@ -219,7 +219,7 @@
|
|
|
219
219
|
<td
|
|
220
220
|
class="govuk-table__cell govuk-table__cell--numeric"
|
|
221
221
|
style={`background-color: ${
|
|
222
|
-
metadata[column.key]?.direction === "Higher is better"
|
|
222
|
+
metadata?.[column.key]?.direction === "Higher is better"
|
|
223
223
|
? normToColor(row[column.key + "__normalised"])
|
|
224
224
|
: normToColorReverse(row[column.key + "__normalised"])
|
|
225
225
|
}`}
|