@ocelescope/core 0.7.0 → 0.8.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/README.md +61 -14
- package/dist/ActivityPicker-DbrGeiC_.js +18 -0
- package/dist/AreaChart-DoD3LM50.js +36 -0
- package/dist/BarChart-Cixo5Okd.js +69 -0
- package/dist/EventAttributePicker-Cf2vVKv5.js +27 -0
- package/dist/LineChart-CVz-dkJI.js +64 -0
- package/dist/NamePicker-Be-qmr1x.js +43 -0
- package/dist/ObjectAttributePicker-CL43EsYt.js +27 -0
- package/dist/ObjectTypePicker-CKmszS0y.js +18 -0
- package/dist/OcelChart-DvGTjJXo.js +41 -0
- package/dist/PieChart-DBiASngC.js +62 -0
- package/dist/Plot-CxHHyXot.js +75 -0
- package/dist/ScatterChart-jIQOjQes.js +36 -0
- package/dist/SqlChart-bwDArK2l.js +101 -0
- package/dist/SunburstChart-D6FhYBHI.js +73 -0
- package/dist/cartesian-5TPNWjl_.js +41 -0
- package/dist/index.d.ts +478 -39
- package/dist/index.js +182 -85
- package/dist/rolldown-runtime-D7D4PA-g.js +13 -0
- package/dist/series-BBXVjHHY.js +32 -0
- package/dist/style.css +46576 -1
- package/dist/useCurrentOCEL-BeBa7K0g.js +34 -0
- package/dist/useOcelId-BSU0-Srk.js +6 -0
- package/dist/useOcelQuery-D1QM-Zgv.js +34 -0
- package/package.json +21 -17
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { useGetOcels } from "@ocelescope/api-base";
|
|
2
|
+
import { useEffect } from "react";
|
|
3
|
+
import { env } from "@ocelescope/api-client";
|
|
4
|
+
import { create } from "zustand";
|
|
5
|
+
import { persist } from "zustand/middleware";
|
|
6
|
+
//#region src/store/currentOcelStore.ts
|
|
7
|
+
const useCurrentOcelStore = create()(persist((set) => ({
|
|
8
|
+
ocelId: null,
|
|
9
|
+
setOcel: (id) => set({ ocelId: id }),
|
|
10
|
+
clearOcel: () => set({ ocelId: null })
|
|
11
|
+
}), { name: env.current_ocel_id }));
|
|
12
|
+
//#endregion
|
|
13
|
+
//#region src/hooks/useCurrentOCEL.ts
|
|
14
|
+
const useCurrentOcel = () => {
|
|
15
|
+
const { data: ocels = [], isSuccess } = useGetOcels();
|
|
16
|
+
const { ocelId, setOcel, clearOcel } = useCurrentOcelStore();
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
if (!isSuccess) return;
|
|
19
|
+
if (ocelId && !ocels?.some(({ id }) => id === ocelId)) clearOcel();
|
|
20
|
+
if (!ocelId && ocels[0]) setOcel(ocels[0].id);
|
|
21
|
+
}, [
|
|
22
|
+
clearOcel,
|
|
23
|
+
setOcel,
|
|
24
|
+
ocels,
|
|
25
|
+
ocelId,
|
|
26
|
+
isSuccess
|
|
27
|
+
]);
|
|
28
|
+
return {
|
|
29
|
+
id: ocelId,
|
|
30
|
+
setCurrentOcel: setOcel
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
//#endregion
|
|
34
|
+
export { useCurrentOcel as t };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { t as useCurrentOcel } from "./useCurrentOCEL-BeBa7K0g.js";
|
|
2
|
+
//#region src/components/pickers/internal/useOcelId.ts
|
|
3
|
+
/** The OCEL a picker reads: the one it was given, else the selected one. */
|
|
4
|
+
const useOcelId = (ocelId) => ocelId ?? useCurrentOcel().id;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { useOcelId as t };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { t as useCurrentOcel } from "./useCurrentOCEL-BeBa7K0g.js";
|
|
2
|
+
import { useRunSqlQuery } from "@ocelescope/api-base";
|
|
3
|
+
import { useMemo } from "react";
|
|
4
|
+
//#region src/hooks/useOcelQuery.ts
|
|
5
|
+
/**
|
|
6
|
+
* Run SQL against the current OCEL.
|
|
7
|
+
*
|
|
8
|
+
* `OcelChart` draws with this; use it directly when a module wants the rows
|
|
9
|
+
* themselves - a list of activities to choose from, a count to show in a
|
|
10
|
+
* heading.
|
|
11
|
+
*/
|
|
12
|
+
const useOcelQuery = ({ sql, parameters, ocelVersion = "filtered", enabled = true }) => {
|
|
13
|
+
const { id: ocelId } = useCurrentOcel();
|
|
14
|
+
const request = useMemo(() => ({
|
|
15
|
+
sql,
|
|
16
|
+
parameters: parameters ?? []
|
|
17
|
+
}), [sql, parameters]);
|
|
18
|
+
const query = useRunSqlQuery(ocelId, request, { ocel_version: ocelVersion }, { query: { enabled: enabled && ocelId != null } });
|
|
19
|
+
return {
|
|
20
|
+
...query,
|
|
21
|
+
ocelId,
|
|
22
|
+
error: sqlError(query.error)
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* DuckDB's complaint, not Axios': "Referenced column not found" is the part
|
|
27
|
+
* someone writing SQL can act on.
|
|
28
|
+
*/
|
|
29
|
+
const sqlError = (error) => {
|
|
30
|
+
const detail = error?.response?.data?.detail;
|
|
31
|
+
return detail ? new Error(detail) : error;
|
|
32
|
+
};
|
|
33
|
+
//#endregion
|
|
34
|
+
export { useOcelQuery as t };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ocelescope/core",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.8.0",
|
|
5
5
|
"description": "Core React component and style library for Ocelescope (Mantine + React Query).",
|
|
6
6
|
"author": "Görkem-Emre Öztürk <goerkem.oeztuerk@rwth-aachen.de>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -33,34 +33,38 @@
|
|
|
33
33
|
"@mantine/hooks": "^9.5.1",
|
|
34
34
|
"@mantine/notifications": "^9.5.1",
|
|
35
35
|
"@marko19907/string-to-color": "^1.0.2",
|
|
36
|
+
"@ocelescope/api-base": "^0.8.0",
|
|
37
|
+
"@ocelescope/api-client": "^0.8.0",
|
|
38
|
+
"@ocelescope/resources": "^0.8.0",
|
|
36
39
|
"@tanstack/react-query": "^5.90.21",
|
|
37
40
|
"@tanstack/react-query-devtools": "^5.91.3",
|
|
41
|
+
"@r4pm/components": "^0.3.2",
|
|
38
42
|
"clsx": "^2.1.1",
|
|
39
43
|
"content-disposition-attachment": "^0.3.1",
|
|
40
|
-
"dayjs": "^1.11.
|
|
44
|
+
"dayjs": "^1.11.23",
|
|
41
45
|
"file-saver": "^2.0.5",
|
|
42
46
|
"lucide-react": "^1.0.0",
|
|
43
47
|
"mantine-datatable": "^9.4.0",
|
|
44
|
-
"next": "16.3.
|
|
45
|
-
"qs": "^6.
|
|
46
|
-
"react": "^19.
|
|
47
|
-
"react-dom": "^19.
|
|
48
|
-
"zod": "^4.
|
|
49
|
-
"zustand": "^5.0.
|
|
50
|
-
"@ocelescope/api-base": "^0.7.0",
|
|
51
|
-
"@ocelescope/api-client": "^0.7.0",
|
|
52
|
-
"@ocelescope/resources": "^0.7.0"
|
|
48
|
+
"next": "16.3.2",
|
|
49
|
+
"qs": "^6.16.0",
|
|
50
|
+
"react": "^19.3.0",
|
|
51
|
+
"react-dom": "^19.3.0",
|
|
52
|
+
"zod": "^4.6.5",
|
|
53
|
+
"zustand": "^5.0.15"
|
|
53
54
|
},
|
|
54
55
|
"devDependencies": {
|
|
56
|
+
"@mantine/charts": "^9.5.1",
|
|
57
|
+
"@mantine/dates": "^9.5.1",
|
|
55
58
|
"@mantine/notifications": "^9.5.1",
|
|
56
|
-
"@tsdown/css": "^0.
|
|
59
|
+
"@tsdown/css": "^0.23.0",
|
|
57
60
|
"@types/file-saver": "^2.0.7",
|
|
58
|
-
"@types/node": "^26.
|
|
61
|
+
"@types/node": "^26.6.1",
|
|
59
62
|
"@types/qs": "^6.15.1",
|
|
60
|
-
"@types/react": "^19.
|
|
61
|
-
"@types/react-dom": "^19.
|
|
62
|
-
"
|
|
63
|
-
"
|
|
63
|
+
"@types/react": "^19.3.0",
|
|
64
|
+
"@types/react-dom": "^19.3.0",
|
|
65
|
+
"@xyflow/react": "^12.11.3",
|
|
66
|
+
"qs": "^6.16.0",
|
|
67
|
+
"tsdown": "^0.23.0",
|
|
64
68
|
"typescript": "^6.0.3"
|
|
65
69
|
},
|
|
66
70
|
"scripts": {
|