@ocelescope/resources 0.10.1 → 0.11.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.d.ts +0 -8
- package/dist/index.js +54 -85
- package/package.json +13 -13
package/dist/index.d.ts
CHANGED
|
@@ -1,18 +1,13 @@
|
|
|
1
1
|
import { Select } from "@mantine/core";
|
|
2
2
|
import { GetResourceResponse } from "@ocelescope/api-base";
|
|
3
3
|
import { ComponentProps } from "react";
|
|
4
|
-
//#region src/components/ResourceModal/ResourceModal.d.ts
|
|
5
4
|
export declare const ResourceModal: React.FC<{
|
|
6
5
|
id: string;
|
|
7
6
|
onClose: () => void;
|
|
8
7
|
}>;
|
|
9
|
-
//#endregion
|
|
10
|
-
//#region src/components/ResourceSelect/ResourceSelect.d.ts
|
|
11
8
|
export declare const ResourceSelect: React.FC<Omit<ComponentProps<typeof Select<string>>, "data"> & {
|
|
12
9
|
type?: string;
|
|
13
10
|
}>;
|
|
14
|
-
//#endregion
|
|
15
|
-
//#region src/types/index.d.ts
|
|
16
11
|
type RequireType<T> = T extends {
|
|
17
12
|
type?: infer L;
|
|
18
13
|
} ? Omit<T, "type"> & {
|
|
@@ -23,8 +18,6 @@ type VisualizationsTypes = NonNullable<VisualizationsType["type"]>;
|
|
|
23
18
|
type VisualizationByType<T extends VisualizationsTypes> = Extract<VisualizationsType, {
|
|
24
19
|
type: T;
|
|
25
20
|
}>;
|
|
26
|
-
//#endregion
|
|
27
|
-
//#region src/components/ResourceView/index.d.ts
|
|
28
21
|
type ExtraMenuItem = {
|
|
29
22
|
icon: React.ReactNode;
|
|
30
23
|
label: string;
|
|
@@ -40,5 +33,4 @@ export declare const ResourceViewer: React.FC<{
|
|
|
40
33
|
id: string;
|
|
41
34
|
isPreview?: boolean;
|
|
42
35
|
}>;
|
|
43
|
-
//#endregion
|
|
44
36
|
export type { VisualizationsType };
|
package/dist/index.js
CHANGED
|
@@ -14,12 +14,12 @@ import ELK from "elkjs/lib/elk.bundled.js";
|
|
|
14
14
|
import { DataTable } from "mantine-datatable";
|
|
15
15
|
import dayjs from "dayjs";
|
|
16
16
|
import isBetween from "dayjs/plugin/isBetween.js";
|
|
17
|
-
|
|
17
|
+
// src/components/ResourceView/Viewers/R4pm.tsx
|
|
18
18
|
const r4pmViewer = (pick) => dynamic(async () => {
|
|
19
|
-
const [components, {
|
|
19
|
+
const [components, { wasmViz }] = await Promise.all([import("@r4pm/components"), import("@r4pm/components/viz/wasm")]);
|
|
20
20
|
const { ViewerConfigProvider } = components;
|
|
21
21
|
const Viewer = pick(components);
|
|
22
|
-
const viewerConfig = {
|
|
22
|
+
const viewerConfig = { viz: wasmViz };
|
|
23
23
|
return (props) => /* @__PURE__ */ jsx(ViewerConfigProvider, {
|
|
24
24
|
value: viewerConfig,
|
|
25
25
|
children: /* @__PURE__ */ jsx(Viewer, { ...props })
|
|
@@ -37,8 +37,7 @@ const R4pmViewerContainer = ({ filename, children }) => /* @__PURE__ */ jsx(Box,
|
|
|
37
37
|
children
|
|
38
38
|
})
|
|
39
39
|
});
|
|
40
|
-
|
|
41
|
-
//#region src/components/ResourceView/Viewers/DFG.tsx
|
|
40
|
+
// src/components/ResourceView/Viewers/DFG.tsx
|
|
42
41
|
const R4pmDfg = r4pmViewer((c) => c.DFGViewer);
|
|
43
42
|
const R4pmOcdfg = r4pmViewer((c) => c.OCDFGViewer);
|
|
44
43
|
const toR4pmDfg = ({ activities, directly_follows_relations, start_activities, end_activities }) => ({
|
|
@@ -58,20 +57,17 @@ const DFGViewer = ({ visualization }) => {
|
|
|
58
57
|
});
|
|
59
58
|
};
|
|
60
59
|
const OCDFGViewer = ({ visualization }) => {
|
|
61
|
-
const ocdfg = useMemo(() => ({
|
|
62
|
-
object_type_to_dfg: Object.fromEntries(Object.entries(visualization.object_type_to_dfg ?? {}).map(([objectType, dfg]) => [objectType, toR4pmDfg(dfg)])),
|
|
63
|
-
object_counts: visualization.object_counts ?? {}
|
|
64
|
-
}), [visualization]);
|
|
60
|
+
const ocdfg = useMemo(() => ({ object_type_to_dfg: Object.fromEntries(Object.entries(visualization.object_type_to_dfg ?? {}).map(([objectType, dfg]) => [objectType, toR4pmDfg(dfg)])) }), [visualization]);
|
|
65
61
|
return /* @__PURE__ */ jsx(R4pmViewerContainer, {
|
|
66
62
|
filename: "oc-dfg",
|
|
67
63
|
children: /* @__PURE__ */ jsx(R4pmOcdfg, {
|
|
68
64
|
actions: [],
|
|
69
|
-
data: ocdfg
|
|
65
|
+
data: ocdfg,
|
|
66
|
+
objectCounts: visualization.object_counts
|
|
70
67
|
})
|
|
71
68
|
});
|
|
72
69
|
};
|
|
73
|
-
|
|
74
|
-
//#region src/components/ResourceView/Viewers/SVG.tsx
|
|
70
|
+
// src/components/ResourceView/Viewers/SVG.tsx
|
|
75
71
|
const { saveAs: saveAs$2 } = FileSaver;
|
|
76
72
|
const SvgPanWrapper = ({ children, onDownload }) => {
|
|
77
73
|
return /* @__PURE__ */ jsx(Box, {
|
|
@@ -143,8 +139,7 @@ const SvgViewer = ({ visualization, isPreview }) => {
|
|
|
143
139
|
children: content
|
|
144
140
|
});
|
|
145
141
|
};
|
|
146
|
-
|
|
147
|
-
//#region src/components/ResourceView/Viewers/Dot.tsx
|
|
142
|
+
// src/components/ResourceView/Viewers/Dot.tsx
|
|
148
143
|
const { saveAs: saveAs$1 } = FileSaver;
|
|
149
144
|
const DotToSvgViewer = ({ isPreview, visualization }) => {
|
|
150
145
|
const [svg, setSvg] = useState(null);
|
|
@@ -216,8 +211,7 @@ const DotToSvgViewer = ({ isPreview, visualization }) => {
|
|
|
216
211
|
children: content
|
|
217
212
|
});
|
|
218
213
|
};
|
|
219
|
-
|
|
220
|
-
//#region src/components/ResourceView/Viewers/GraphFlow/GraphControls.tsx
|
|
214
|
+
// src/components/ResourceView/Viewers/GraphFlow/GraphControls.tsx
|
|
221
215
|
const GraphControls = ({ onFitView, onDownloadPng, onDownloadSvg, onDownloadPdf, menuItems, isPreview }) => {
|
|
222
216
|
if (isPreview) return null;
|
|
223
217
|
return /* @__PURE__ */ jsxs(Controls, {
|
|
@@ -261,8 +255,7 @@ const GraphControls = ({ onFitView, onDownloadPng, onDownloadSvg, onDownloadPdf,
|
|
|
261
255
|
]
|
|
262
256
|
});
|
|
263
257
|
};
|
|
264
|
-
|
|
265
|
-
//#region src/components/ResourceView/Viewers/GraphFlow/utils/bounds.ts
|
|
258
|
+
// src/components/ResourceView/Viewers/GraphFlow/utils/bounds.ts
|
|
266
259
|
function nodeBoundsFromData(nodes) {
|
|
267
260
|
if (nodes.length === 0) return {
|
|
268
261
|
x: 0,
|
|
@@ -387,8 +380,7 @@ function getContentBounds(nodes, viewportEl, getNodesBounds) {
|
|
|
387
380
|
}
|
|
388
381
|
return combined;
|
|
389
382
|
}
|
|
390
|
-
|
|
391
|
-
//#region src/components/ResourceView/Viewers/GraphFlow/utils/download.ts
|
|
383
|
+
// src/components/ResourceView/Viewers/GraphFlow/utils/download.ts
|
|
392
384
|
const { saveAs } = FileSaver;
|
|
393
385
|
const MAX_PX = 2048;
|
|
394
386
|
const EXPORT_PADDING = .05;
|
|
@@ -452,8 +444,7 @@ async function downloadPdf(container, nodes, getNodesBounds) {
|
|
|
452
444
|
pdf.addImage(dataUrl, "PNG", 0, 0, imageWidth, imageHeight);
|
|
453
445
|
pdf.save("graph.pdf");
|
|
454
446
|
}
|
|
455
|
-
|
|
456
|
-
//#region src/components/ResourceView/Viewers/GraphFlow/hooks/useGraphExport.ts
|
|
447
|
+
// src/components/ResourceView/Viewers/GraphFlow/hooks/useGraphExport.ts
|
|
457
448
|
const useGraphExport = (wrapperRef) => {
|
|
458
449
|
const { getNodes, getNodesBounds } = useReactFlow();
|
|
459
450
|
return {
|
|
@@ -483,8 +474,7 @@ const useGraphExport = (wrapperRef) => {
|
|
|
483
474
|
])
|
|
484
475
|
};
|
|
485
476
|
};
|
|
486
|
-
|
|
487
|
-
//#region src/components/ResourceView/Viewers/GraphFlow/model/types.ts
|
|
477
|
+
// src/components/ResourceView/Viewers/GraphFlow/model/types.ts
|
|
488
478
|
var GraphError = class extends Error {
|
|
489
479
|
details;
|
|
490
480
|
constructor(message, details) {
|
|
@@ -502,8 +492,7 @@ const DEFAULT_COLORS = {
|
|
|
502
492
|
text: "#1a1a1a"
|
|
503
493
|
};
|
|
504
494
|
const FIT_VIEW_PADDING = .15;
|
|
505
|
-
|
|
506
|
-
//#region src/components/ResourceView/Viewers/GraphFlow/layout/elk.ts
|
|
495
|
+
// src/components/ResourceView/Viewers/GraphFlow/layout/elk.ts
|
|
507
496
|
const EDGE_ROUTINGS = /* @__PURE__ */ new Set([
|
|
508
497
|
"SPLINES",
|
|
509
498
|
"ORTHOGONAL",
|
|
@@ -653,8 +642,7 @@ var ElkEngine = class ElkEngine {
|
|
|
653
642
|
return routes;
|
|
654
643
|
}
|
|
655
644
|
};
|
|
656
|
-
|
|
657
|
-
//#region src/components/ResourceView/Viewers/GraphFlow/layout/graphviz.ts
|
|
645
|
+
// src/components/ResourceView/Viewers/GraphFlow/layout/graphviz.ts
|
|
658
646
|
const GRAPHVIZ_DPI = 72;
|
|
659
647
|
const parsePoint = (value) => {
|
|
660
648
|
if (!value) return null;
|
|
@@ -822,8 +810,7 @@ var GraphvizEngine = class GraphvizEngine {
|
|
|
822
810
|
return Object.entries(ranks).map(([rank, ids]) => `{ rank=${["source", "sink"].includes(rank) ? rank : "same"}; ${(ids ?? []).join(" ")} }`);
|
|
823
811
|
}
|
|
824
812
|
};
|
|
825
|
-
|
|
826
|
-
//#region src/components/ResourceView/Viewers/GraphFlow/layout/engine.ts
|
|
813
|
+
// src/components/ResourceView/Viewers/GraphFlow/layout/engine.ts
|
|
827
814
|
const selectEngine = (visualization) => {
|
|
828
815
|
const config = visualization.layout_config;
|
|
829
816
|
switch (config?.type) {
|
|
@@ -839,8 +826,7 @@ const selectEngine = (visualization) => {
|
|
|
839
826
|
default: throw new GraphError("Invalid graph layout config.", ["Expected an ELK or Graphviz layout config from the backend."]);
|
|
840
827
|
}
|
|
841
828
|
};
|
|
842
|
-
|
|
843
|
-
//#region src/components/ResourceView/Viewers/GraphFlow/model/buildModel.ts
|
|
829
|
+
// src/components/ResourceView/Viewers/GraphFlow/model/buildModel.ts
|
|
844
830
|
const requireNodeId = (node, index) => {
|
|
845
831
|
if (!node.id) throw new GraphError("Invalid graph node.", [`Node at index ${index} is missing an id.`]);
|
|
846
832
|
return {
|
|
@@ -859,8 +845,7 @@ const buildGraphModel = (visualization) => ({
|
|
|
859
845
|
nodes: (visualization.nodes ?? []).map(requireNodeId),
|
|
860
846
|
edges: (visualization.edges ?? []).map(requireEdgeId)
|
|
861
847
|
});
|
|
862
|
-
|
|
863
|
-
//#region src/components/ResourceView/Viewers/GraphFlow/render/routeToPath.ts
|
|
848
|
+
// src/components/ResourceView/Viewers/GraphFlow/render/routeToPath.ts
|
|
864
849
|
const buildPolylinePath = (points) => {
|
|
865
850
|
if (points.length < 2) return null;
|
|
866
851
|
return points.map((point, index) => `${index === 0 ? "M" : "L"} ${point.x},${point.y}`).join(" ");
|
|
@@ -905,8 +890,7 @@ const straightEdgeLayout = (source, target) => ({
|
|
|
905
890
|
endPoint: target,
|
|
906
891
|
labelPosition: midpoint(source, target)
|
|
907
892
|
});
|
|
908
|
-
|
|
909
|
-
//#region src/components/ResourceView/Viewers/GraphFlow/render/project.ts
|
|
893
|
+
// src/components/ResourceView/Viewers/GraphFlow/render/project.ts
|
|
910
894
|
const projectToRenderModel = (model, layout) => {
|
|
911
895
|
const centers = nodeCenters(model.nodes, layout.positions);
|
|
912
896
|
return {
|
|
@@ -966,8 +950,7 @@ const routeToEdgeLayout = (route) => {
|
|
|
966
950
|
labelPosition: route.labelPosition
|
|
967
951
|
};
|
|
968
952
|
};
|
|
969
|
-
|
|
970
|
-
//#region src/components/ResourceView/Viewers/GraphFlow/hooks/useGraphLayout.ts
|
|
953
|
+
// src/components/ResourceView/Viewers/GraphFlow/hooks/useGraphLayout.ts
|
|
971
954
|
const prepare = (visualization) => {
|
|
972
955
|
try {
|
|
973
956
|
return {
|
|
@@ -1029,8 +1012,7 @@ const useGraphLayout = (visualization) => {
|
|
|
1029
1012
|
onNodesChange
|
|
1030
1013
|
};
|
|
1031
1014
|
};
|
|
1032
|
-
|
|
1033
|
-
//#region src/components/ResourceView/Viewers/GraphFlow/render/edgeArrows.tsx
|
|
1015
|
+
// src/components/ResourceView/Viewers/GraphFlow/render/edgeArrows.tsx
|
|
1034
1016
|
const colorToId = (color) => color.replace(/[^a-zA-Z0-9]/g, "");
|
|
1035
1017
|
const ArrowMarker = ({ id, type, color, isStart }) => {
|
|
1036
1018
|
if (!type) return null;
|
|
@@ -1197,8 +1179,7 @@ const getMarkerIds = ({ color, startArrow, endArrow }) => {
|
|
|
1197
1179
|
endMarkerId: endArrow ? `arrow-end-${endArrow}-${colorKey}` : null
|
|
1198
1180
|
};
|
|
1199
1181
|
};
|
|
1200
|
-
|
|
1201
|
-
//#region src/components/ResourceView/Viewers/GraphFlow/render/annotation.tsx
|
|
1182
|
+
// src/components/ResourceView/Viewers/GraphFlow/render/annotation.tsx
|
|
1202
1183
|
const AnnotationBadge = () => /* @__PURE__ */ jsx(Badge, {
|
|
1203
1184
|
size: "xs",
|
|
1204
1185
|
variant: "filled",
|
|
@@ -1258,8 +1239,7 @@ const NodeAnnotation = ({ annotation }) => {
|
|
|
1258
1239
|
})]
|
|
1259
1240
|
});
|
|
1260
1241
|
};
|
|
1261
|
-
|
|
1262
|
-
//#region src/components/ResourceView/Viewers/GraphFlow/render/edgeLabels.tsx
|
|
1242
|
+
// src/components/ResourceView/Viewers/GraphFlow/render/edgeLabels.tsx
|
|
1263
1243
|
const EdgeLabel = ({ color, label, hasAnnotation, x, y }) => /* @__PURE__ */ jsx(EdgeLabelRenderer, { children: /* @__PURE__ */ jsxs("div", {
|
|
1264
1244
|
style: {
|
|
1265
1245
|
position: "absolute",
|
|
@@ -1313,8 +1293,7 @@ const endLabelPositions = (start, end) => {
|
|
|
1313
1293
|
}
|
|
1314
1294
|
};
|
|
1315
1295
|
};
|
|
1316
|
-
|
|
1317
|
-
//#region src/components/ResourceView/Viewers/GraphFlow/render/Edge.tsx
|
|
1296
|
+
// src/components/ResourceView/Viewers/GraphFlow/render/Edge.tsx
|
|
1318
1297
|
const centerOf = ({ sourceX, sourceY, targetX, targetY }) => ({
|
|
1319
1298
|
x: (sourceX + targetX) / 2,
|
|
1320
1299
|
y: (sourceY + targetY) / 2
|
|
@@ -1428,8 +1407,7 @@ const GraphFlowEdge = memo((props) => {
|
|
|
1428
1407
|
] });
|
|
1429
1408
|
});
|
|
1430
1409
|
GraphFlowEdge.displayName = "GraphFlowEdge";
|
|
1431
|
-
|
|
1432
|
-
//#region src/components/ResourceView/Viewers/GraphFlow/render/nodeShapes.tsx
|
|
1410
|
+
// src/components/ResourceView/Viewers/GraphFlow/render/nodeShapes.tsx
|
|
1433
1411
|
const InnerSymbol = ({ symbol, color }) => {
|
|
1434
1412
|
if (symbol === "triangle") return /* @__PURE__ */ jsx("div", { style: {
|
|
1435
1413
|
width: 0,
|
|
@@ -1559,8 +1537,7 @@ const BoxShape = ({ shape, color, borderColor, doubleBorder, innerSymbol, width,
|
|
|
1559
1537
|
} })]
|
|
1560
1538
|
});
|
|
1561
1539
|
};
|
|
1562
|
-
|
|
1563
|
-
//#region src/components/ResourceView/Viewers/GraphFlow/render/Node.tsx
|
|
1540
|
+
// src/components/ResourceView/Viewers/GraphFlow/render/Node.tsx
|
|
1564
1541
|
const HIDDEN_HANDLE_STYLE = {
|
|
1565
1542
|
opacity: 0,
|
|
1566
1543
|
pointerEvents: "none"
|
|
@@ -1656,8 +1633,7 @@ const GraphFlowNode = memo(({ data }) => {
|
|
|
1656
1633
|
});
|
|
1657
1634
|
});
|
|
1658
1635
|
GraphFlowNode.displayName = "GraphFlowNode";
|
|
1659
|
-
|
|
1660
|
-
//#region src/components/ResourceView/Viewers/GraphFlow/index.tsx
|
|
1636
|
+
// src/components/ResourceView/Viewers/GraphFlow/index.tsx
|
|
1661
1637
|
const nodeTypes = { node: GraphFlowNode };
|
|
1662
1638
|
const edgeTypes = { graphflow: GraphFlowEdge };
|
|
1663
1639
|
const GraphFlowCanvas = ({ visualization, isPreview, menuItems }) => {
|
|
@@ -1735,8 +1711,7 @@ const GraphFlowCanvas = ({ visualization, isPreview, menuItems }) => {
|
|
|
1735
1711
|
})] });
|
|
1736
1712
|
};
|
|
1737
1713
|
const GraphFlow = (props) => /* @__PURE__ */ jsx(ReactFlowProvider, { children: /* @__PURE__ */ jsx(GraphFlowCanvas, { ...props }) });
|
|
1738
|
-
|
|
1739
|
-
//#region src/components/ResourceView/Viewers/Graph.tsx
|
|
1714
|
+
// src/components/ResourceView/Viewers/Graph.tsx
|
|
1740
1715
|
const GraphViewer = (props) => /* @__PURE__ */ jsx(Box, {
|
|
1741
1716
|
h: "100%",
|
|
1742
1717
|
w: "100%",
|
|
@@ -1744,8 +1719,7 @@ const GraphViewer = (props) => /* @__PURE__ */ jsx(Box, {
|
|
|
1744
1719
|
style: { overflow: "hidden" },
|
|
1745
1720
|
children: /* @__PURE__ */ jsx(GraphFlow, { ...props })
|
|
1746
1721
|
});
|
|
1747
|
-
|
|
1748
|
-
//#region src/components/ResourceView/Viewers/PetriNet.tsx
|
|
1722
|
+
// src/components/ResourceView/Viewers/PetriNet.tsx
|
|
1749
1723
|
const R4pmOcpn = r4pmViewer((c) => c.ObjectCentricPetriNetViewer);
|
|
1750
1724
|
const R4pmPetriNet = r4pmViewer((c) => c.PetriNetViewer);
|
|
1751
1725
|
const toR4pmPetriNet = (visualization) => ({
|
|
@@ -1759,22 +1733,24 @@ const toR4pmPetriNet = (visualization) => ({
|
|
|
1759
1733
|
final_marking: visualization.final_marking ?? null
|
|
1760
1734
|
});
|
|
1761
1735
|
const OCPetriNetViewer = ({ visualization }) => {
|
|
1762
|
-
const ocpnData = useMemo(() => {
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
}
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
}
|
|
1777
|
-
|
|
1736
|
+
const ocpnData = useMemo(() => ({
|
|
1737
|
+
places: (visualization.places ?? []).map(({ id, object_type }) => ({
|
|
1738
|
+
name: id,
|
|
1739
|
+
object_type
|
|
1740
|
+
})),
|
|
1741
|
+
transitions: (visualization.transitions ?? []).map(({ id, label }) => ({
|
|
1742
|
+
name: id,
|
|
1743
|
+
label
|
|
1744
|
+
})),
|
|
1745
|
+
arcs: visualization.arcs.map(({ source, target, weight, variable }) => ({
|
|
1746
|
+
source,
|
|
1747
|
+
target,
|
|
1748
|
+
type: variable ? "variable" : "normal",
|
|
1749
|
+
...weight != null && { weight }
|
|
1750
|
+
})),
|
|
1751
|
+
initial_marking: visualization.initial_marking ?? {},
|
|
1752
|
+
final_marking: visualization.final_marking ?? {}
|
|
1753
|
+
}), [visualization]);
|
|
1778
1754
|
return /* @__PURE__ */ jsx(R4pmViewerContainer, {
|
|
1779
1755
|
filename: "oc-petri-net",
|
|
1780
1756
|
children: /* @__PURE__ */ jsx(R4pmOcpn, { data: ocpnData })
|
|
@@ -1787,8 +1763,7 @@ const PetriNetViewer = ({ visualization }) => {
|
|
|
1787
1763
|
children: /* @__PURE__ */ jsx(R4pmPetriNet, { data: petriNet })
|
|
1788
1764
|
});
|
|
1789
1765
|
};
|
|
1790
|
-
|
|
1791
|
-
//#region src/components/ResourceView/Viewers/Plotly.tsx
|
|
1766
|
+
// src/components/ResourceView/Viewers/Plotly.tsx
|
|
1792
1767
|
const Plot = dynamic(() => import("react-plotly.js"), { ssr: false });
|
|
1793
1768
|
const PlotlyViewer = ({ visualization, isPreview }) => {
|
|
1794
1769
|
const { data, layout } = visualization.data;
|
|
@@ -1813,14 +1788,12 @@ const PlotlyViewer = ({ visualization, isPreview }) => {
|
|
|
1813
1788
|
}
|
|
1814
1789
|
});
|
|
1815
1790
|
};
|
|
1816
|
-
|
|
1817
|
-
//#region src/util/dayjs.ts
|
|
1791
|
+
// src/util/dayjs.ts
|
|
1818
1792
|
dayjs.extend(isBetween);
|
|
1819
1793
|
var dayjs_default = dayjs;
|
|
1820
1794
|
const formatDateTime = (dateString) => dayjs(dateString).format("YYYY-MM-DD HH:mm");
|
|
1821
1795
|
const formatDate = (dateString) => dayjs(dateString).format("YYYY-MM-DD");
|
|
1822
|
-
|
|
1823
|
-
//#region src/components/ResourceView/Viewers/Table.tsx
|
|
1796
|
+
// src/components/ResourceView/Viewers/Table.tsx
|
|
1824
1797
|
const formatCell = (value, dataType) => {
|
|
1825
1798
|
if (value == null) return "";
|
|
1826
1799
|
switch (dataType) {
|
|
@@ -1873,8 +1846,7 @@ const TableView = ({ visualization }) => {
|
|
|
1873
1846
|
...paginationProps
|
|
1874
1847
|
});
|
|
1875
1848
|
};
|
|
1876
|
-
|
|
1877
|
-
//#region src/components/ResourceView/index.tsx
|
|
1849
|
+
// src/components/ResourceView/index.tsx
|
|
1878
1850
|
const visualizationMap = {
|
|
1879
1851
|
table: TableView,
|
|
1880
1852
|
svg: SvgViewer,
|
|
@@ -1917,8 +1889,7 @@ const ResourceViewer = ({ id, isPreview = false }) => {
|
|
|
1917
1889
|
isPreview
|
|
1918
1890
|
});
|
|
1919
1891
|
};
|
|
1920
|
-
|
|
1921
|
-
//#region src/components/ResourceModal/ResourceModal.tsx
|
|
1892
|
+
// src/components/ResourceModal/ResourceModal.tsx
|
|
1922
1893
|
const ResourceModal = ({ id, onClose }) => {
|
|
1923
1894
|
const { data } = useResource(id, { query: { enabled: !!id } });
|
|
1924
1895
|
return data?.resource.id && /* @__PURE__ */ jsx(Modal, {
|
|
@@ -1959,8 +1930,7 @@ const ResourceModal = ({ id, onClose }) => {
|
|
|
1959
1930
|
})
|
|
1960
1931
|
});
|
|
1961
1932
|
};
|
|
1962
|
-
|
|
1963
|
-
//#region src/components/ResourceSelect/ResourceSelect.tsx
|
|
1933
|
+
// src/components/ResourceSelect/ResourceSelect.tsx
|
|
1964
1934
|
const ResourceSelect = ({ type, value, ...props }) => {
|
|
1965
1935
|
const { data: resources = [] } = useResources({ schema_hash: type ?? null });
|
|
1966
1936
|
return /* @__PURE__ */ jsx(Select, {
|
|
@@ -1971,5 +1941,4 @@ const ResourceSelect = ({ type, value, ...props }) => {
|
|
|
1971
1941
|
}))
|
|
1972
1942
|
});
|
|
1973
1943
|
};
|
|
1974
|
-
//#endregion
|
|
1975
1944
|
export { ResourceModal, ResourceSelect, ResourceViewer, Visualization };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ocelescope/resources",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.11.0",
|
|
5
5
|
"description": "Ocelescope resources: helpers and UI components for rendering and exporting data.",
|
|
6
6
|
"author": "Görkem-Emre Öztürk <goerkem.oeztuerk@rwth-aachen.de>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -28,29 +28,29 @@
|
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
30
30
|
"@floating-ui/react": "^0.27.18",
|
|
31
|
-
"@hpcc-js/wasm-graphviz": "^1.
|
|
32
|
-
"@mantine/core": "^9.
|
|
33
|
-
"@ocelescope/api-base": "^0.
|
|
34
|
-
"@r4pm/components": "^0.
|
|
35
|
-
"@xyflow/react": "^12.
|
|
31
|
+
"@hpcc-js/wasm-graphviz": "^1.30.0",
|
|
32
|
+
"@mantine/core": "^9.7.4",
|
|
33
|
+
"@ocelescope/api-base": "^0.11.0",
|
|
34
|
+
"@r4pm/components": "^0.4.0",
|
|
35
|
+
"@xyflow/react": "^12.12.0",
|
|
36
36
|
"dayjs": "^1.11.23",
|
|
37
37
|
"elkjs": "^0.12.0",
|
|
38
38
|
"file-saver": "^2.0.5",
|
|
39
|
-
"lucide-react": "^1.
|
|
39
|
+
"lucide-react": "^1.63.0",
|
|
40
40
|
"mantine-datatable": "^9.4.0",
|
|
41
|
-
"next": "16.3
|
|
42
|
-
"react": "^19.3.
|
|
43
|
-
"react-dom": "^19.3.
|
|
41
|
+
"next": "16.4.3",
|
|
42
|
+
"react": "^19.3.1",
|
|
43
|
+
"react-dom": "^19.3.1",
|
|
44
44
|
"react-plotly.js": "^4.0.0",
|
|
45
45
|
"react-zoom-pan-pinch": "^4.0.0"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@tsdown/css": "^0.23.
|
|
48
|
+
"@tsdown/css": "^0.23.3",
|
|
49
49
|
"@types/file-saver": "^2.0.7",
|
|
50
|
-
"@types/node": "^26.6.
|
|
50
|
+
"@types/node": "^26.6.5",
|
|
51
51
|
"@types/react": "^19.3.0",
|
|
52
52
|
"@types/react-dom": "^19.3.0",
|
|
53
|
-
"tsdown": "^0.23.
|
|
53
|
+
"tsdown": "^0.23.3",
|
|
54
54
|
"typescript": "^6.0.3"
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|