@ocelescope/filter 0.2.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +49 -17
- package/package.json +20 -20
package/dist/index.js
CHANGED
|
@@ -18,11 +18,23 @@ const customFetch$1 = async (config, options) => customFetch(config, options);
|
|
|
18
18
|
//#endregion
|
|
19
19
|
//#region src/api/base.ts
|
|
20
20
|
/**
|
|
21
|
-
* Generated by orval v8.
|
|
21
|
+
* Generated by orval v8.22.0 🍺
|
|
22
22
|
* Do not edit manually.
|
|
23
23
|
* Filter
|
|
24
24
|
* OpenAPI spec version: 1.0
|
|
25
25
|
*/
|
|
26
|
+
const withQueryKey = (query, queryKey) => {
|
|
27
|
+
const result = { queryKey };
|
|
28
|
+
for (const key of Object.keys(query)) {
|
|
29
|
+
if (key === "queryKey") continue;
|
|
30
|
+
Object.defineProperty(result, key, {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
configurable: true,
|
|
33
|
+
get: () => query[key]
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
return result;
|
|
37
|
+
};
|
|
26
38
|
/**
|
|
27
39
|
* @summary Getfilter
|
|
28
40
|
*/
|
|
@@ -43,7 +55,7 @@ const getGetFilterQueryOptions = (ocelId, options) => {
|
|
|
43
55
|
return {
|
|
44
56
|
queryKey,
|
|
45
57
|
queryFn,
|
|
46
|
-
enabled:
|
|
58
|
+
enabled: ocelId !== null && ocelId !== void 0,
|
|
47
59
|
staleTime: 3e5,
|
|
48
60
|
...queryOptions
|
|
49
61
|
};
|
|
@@ -53,10 +65,8 @@ const getGetFilterQueryOptions = (ocelId, options) => {
|
|
|
53
65
|
*/
|
|
54
66
|
function useGetFilter(ocelId, options, queryClient) {
|
|
55
67
|
const queryOptions = getGetFilterQueryOptions(ocelId, options);
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
queryKey: queryOptions.queryKey
|
|
59
|
-
};
|
|
68
|
+
const query = useQuery(queryOptions, queryClient);
|
|
69
|
+
return withQueryKey(query, queryOptions.queryKey);
|
|
60
70
|
}
|
|
61
71
|
/**
|
|
62
72
|
* @summary Setfilter
|
|
@@ -598,16 +608,32 @@ const TimeGraph = memo(({ timeInfo, startDate, endDate }) => {
|
|
|
598
608
|
});
|
|
599
609
|
});
|
|
600
610
|
const TimeFrameSlider = ({ timeInfo, startTime, endTime, onChange }) => {
|
|
601
|
-
const
|
|
602
|
-
const
|
|
611
|
+
const distribution = timeInfo.date_distribution;
|
|
612
|
+
const lastIndex = distribution.length - 1;
|
|
613
|
+
const startIndex = useMemo(() => {
|
|
614
|
+
const index = distribution.findIndex(({ end_timestamp }) => dayjs_default(startTime).isBefore(end_timestamp));
|
|
615
|
+
return index === -1 ? Math.max(lastIndex, 0) : index;
|
|
616
|
+
}, [
|
|
617
|
+
startTime,
|
|
618
|
+
distribution,
|
|
619
|
+
lastIndex
|
|
620
|
+
]);
|
|
621
|
+
const endIndex = useMemo(() => {
|
|
622
|
+
const index = distribution.findLastIndex(({ start_timestamp }) => dayjs_default(endTime).isAfter(start_timestamp));
|
|
623
|
+
return index === -1 ? 0 : index;
|
|
624
|
+
}, [endTime, distribution]);
|
|
625
|
+
if (lastIndex < 0) return null;
|
|
603
626
|
return /* @__PURE__ */ jsx(RangeSlider, {
|
|
604
627
|
min: 0,
|
|
605
|
-
max:
|
|
628
|
+
max: lastIndex,
|
|
606
629
|
minRange: 0,
|
|
607
630
|
value: [startIndex, endIndex],
|
|
608
|
-
label: (value) =>
|
|
631
|
+
label: (value) => {
|
|
632
|
+
const bucket = distribution[value];
|
|
633
|
+
return bucket ? dayjs_default(bucket.start_timestamp).format("YYYY-MM-DD HH:mm") : null;
|
|
634
|
+
},
|
|
609
635
|
onChange: ([start, end]) => {
|
|
610
|
-
onChange([start === startIndex ? startTime :
|
|
636
|
+
onChange([start === startIndex ? startTime : distribution[start]?.start_timestamp ?? startTime, distribution[end]?.end_timestamp ?? endTime]);
|
|
611
637
|
}
|
|
612
638
|
});
|
|
613
639
|
};
|
|
@@ -696,7 +722,8 @@ const assignUniqueColors = (strings) => {
|
|
|
696
722
|
const uniqueStrings = Array.from(new Set(strings));
|
|
697
723
|
const colorMap = {};
|
|
698
724
|
uniqueStrings.forEach((str, index) => {
|
|
699
|
-
|
|
725
|
+
const hsl = `hsl(${index * 360 / numStrings}, 70%, 50%)`;
|
|
726
|
+
colorMap[str] = hsl;
|
|
700
727
|
});
|
|
701
728
|
return colorMap;
|
|
702
729
|
};
|
|
@@ -704,13 +731,18 @@ const BarChartSelect = memo(({ values, selected, onSelect }) => {
|
|
|
704
731
|
const colorMap = useMemo(() => {
|
|
705
732
|
return assignUniqueColors(Array.from(new Set(values.map(({ key }) => key))));
|
|
706
733
|
}, [values]);
|
|
734
|
+
const data = useMemo(() => [...values].sort((a, b) => b.value - a.value).map(({ value, key }) => ({
|
|
735
|
+
key,
|
|
736
|
+
value,
|
|
737
|
+
color: selected.includes(key) ? colorMap[key] : "rgba(128, 128, 128, 0.3)"
|
|
738
|
+
})), [
|
|
739
|
+
values,
|
|
740
|
+
selected,
|
|
741
|
+
colorMap
|
|
742
|
+
]);
|
|
707
743
|
return /* @__PURE__ */ jsx(BarChart, {
|
|
708
744
|
h: 30 * values.length,
|
|
709
|
-
data
|
|
710
|
-
key,
|
|
711
|
-
value,
|
|
712
|
-
color: selected.includes(key) ? colorMap[key] : "rgba(128, 128, 128, 0.3)"
|
|
713
|
-
})),
|
|
745
|
+
data,
|
|
714
746
|
minBarSize: 30,
|
|
715
747
|
tooltipProps: { content: ({ label }) => /* @__PURE__ */ jsx(Paper, {
|
|
716
748
|
px: "md",
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ocelescope/filter",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.6.0",
|
|
5
5
|
"description": "A module for basic filtering of OCELs",
|
|
6
6
|
"author": "Görkem-Emre Öztürk <goerkem.oeztuerk@rwth-aachen.de>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -28,35 +28,35 @@
|
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
30
30
|
"@dagrejs/dagre": "^3.0.0",
|
|
31
|
-
"@mantine/charts": "^9.4.
|
|
32
|
-
"@mantine/core": "^9.4.
|
|
33
|
-
"@mantine/dates": "^9.4.
|
|
34
|
-
"@mantine/hooks": "^9.4.
|
|
35
|
-
"@mantine/notifications": "^9.4.
|
|
31
|
+
"@mantine/charts": "^9.4.2",
|
|
32
|
+
"@mantine/core": "^9.4.2",
|
|
33
|
+
"@mantine/dates": "^9.4.2",
|
|
34
|
+
"@mantine/hooks": "^9.4.2",
|
|
35
|
+
"@mantine/notifications": "^9.4.2",
|
|
36
36
|
"@tanstack/react-query": "^5.90.21",
|
|
37
|
-
"axios": "^1.18.
|
|
37
|
+
"axios": "^1.18.1",
|
|
38
38
|
"dayjs": "^1.11.19",
|
|
39
39
|
"lucide-react": "^1.0.0",
|
|
40
|
-
"mantine-datatable": "^9.
|
|
41
|
-
"
|
|
42
|
-
"
|
|
40
|
+
"mantine-datatable": "^9.4.0",
|
|
41
|
+
"next": "^16.2.10",
|
|
42
|
+
"object-hash": "^3.0.0",
|
|
43
|
+
"react": "^19.2.7",
|
|
44
|
+
"react-dom": "^19.2.7",
|
|
43
45
|
"react-hook-form": "^7.71.2",
|
|
44
46
|
"recharts": "^3.2.1",
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"@ocelescope/
|
|
48
|
-
"@ocelescope/core": "^0.1.2",
|
|
49
|
-
"@ocelescope/api-base": "^0.2.0"
|
|
47
|
+
"@ocelescope/api-base": "^0.6.0",
|
|
48
|
+
"@ocelescope/api-client": "^0.6.0",
|
|
49
|
+
"@ocelescope/core": "^0.6.0"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@mantine/notifications": "^9.4.
|
|
53
|
-
"@types/node": "^
|
|
52
|
+
"@mantine/notifications": "^9.4.2",
|
|
53
|
+
"@types/node": "^26.1.1",
|
|
54
54
|
"@types/object-hash": "^3.0.6",
|
|
55
|
-
"@types/react": "^19.2.
|
|
55
|
+
"@types/react": "^19.2.17",
|
|
56
56
|
"@types/react-dom": "^19.2.3",
|
|
57
|
-
"tsdown": "^0.22.
|
|
57
|
+
"tsdown": "^0.22.12",
|
|
58
58
|
"typescript": "^5.9.3",
|
|
59
|
-
"@ocelescope/api-config": "^0.
|
|
59
|
+
"@ocelescope/api-config": "^0.6.0"
|
|
60
60
|
},
|
|
61
61
|
"scripts": {
|
|
62
62
|
"build": "orval && tsdown",
|