reburn-ui 0.3.13 → 0.3.15
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.
|
@@ -13,6 +13,8 @@
|
|
|
13
13
|
}
|
|
14
14
|
</script>
|
|
15
15
|
|
|
16
|
+
<!-- TODO: fix types -->
|
|
17
|
+
|
|
16
18
|
<script lang="ts" generics="T extends ChartData">
|
|
17
19
|
import { CreateFloating, type UpdatePositionProps } from '../../components/Floating/CreateFloating.svelte.js';
|
|
18
20
|
import { Paper, Portal } from '../../components/index.js';
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
<script lang="ts" module>
|
|
2
|
-
import { getChartContext } from '../ChartRoot/ChartContext.svelte.js';
|
|
3
2
|
import type { ChartData, ChartSeries } from '../types.js';
|
|
4
3
|
|
|
5
4
|
export interface ChartTooltipDataProps<T extends ChartData, K extends keyof T> {
|
|
@@ -11,17 +10,17 @@
|
|
|
11
10
|
<script lang="ts" generics="T extends ChartData, K extends keyof T">
|
|
12
11
|
let { series, element }: ChartTooltipDataProps<T, K> = $props();
|
|
13
12
|
|
|
14
|
-
const ctx = getChartContext();
|
|
15
|
-
|
|
16
13
|
function defaultFormatLabel(d: number) {
|
|
17
14
|
return d.toString();
|
|
18
15
|
}
|
|
19
16
|
|
|
20
|
-
const data = series.accessor?.(element[series.name]) || element[series.name];
|
|
17
|
+
const data = $derived(series.accessor?.(element[series.name]) || element[series.name]);
|
|
21
18
|
|
|
22
19
|
const formatLabel = series.formatLabel || defaultFormatLabel;
|
|
23
20
|
|
|
24
|
-
const formatted =
|
|
21
|
+
const formatted = $derived(
|
|
22
|
+
Array.isArray(data) ? data.sort((a, b) => b - a).map((item) => formatLabel(item as number)) : formatLabel(data as number)
|
|
23
|
+
);
|
|
25
24
|
</script>
|
|
26
25
|
|
|
27
26
|
<div class="item">
|