@osrd-project/ui-charts 0.0.74 → 0.0.76
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.esm.js +584 -381
- package/dist/index.esm.js.map +1 -1
- package/dist/manchette/components/Manchette.d.ts +4 -3
- package/dist/manchette/components/Waypoint.d.ts +2 -2
- package/dist/manchette/hooks/useManchetteWithSpaceTimeChart.d.ts +11 -1
- package/dist/manchette/index.d.ts +3 -2
- package/dist/manchette/types.d.ts +0 -5
- package/dist/manchette/utils/helpers.d.ts +1 -5
- package/dist/manchette/utils/index.d.ts +3 -2
- package/dist/spaceTimeChart/lib/types.d.ts +4 -6
- package/dist/spaceTimeChart/utils/scales.d.ts +5 -0
- package/dist/theme.css +1678 -2653
- package/dist/theme.css.map +1 -1
- package/dist/trackOccupancyDiagram/components/TrackOccupancyCanvas.d.ts +10 -2
- package/dist/trackOccupancyDiagram/components/TrackOccupancyManchette.d.ts +5 -3
- package/dist/trackOccupancyDiagram/components/TrackOccupancyStandalone.d.ts +10 -0
- package/dist/trackOccupancyDiagram/components/consts.d.ts +3 -1
- package/dist/trackOccupancyDiagram/components/helpers/drawElements/drawOccupancyZones.d.ts +13 -14
- package/dist/trackOccupancyDiagram/components/helpers/drawElements/drawOccupancyZonesTexts.d.ts +2 -2
- package/dist/trackOccupancyDiagram/components/helpers/drawElements/drawTracks.d.ts +7 -15
- package/dist/trackOccupancyDiagram/components/layers/OccupancyZonesLayer.d.ts +7 -9
- package/dist/trackOccupancyDiagram/components/layers/TracksLayer.d.ts +6 -3
- package/dist/trackOccupancyDiagram/components/types.d.ts +8 -17
- package/dist/trackOccupancyDiagram/index.d.ts +3 -0
- package/package.json +8 -8
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { InteractiveWaypoint
|
|
2
|
+
import type { InteractiveWaypoint } from '../types';
|
|
3
3
|
export type ManchetteProps = {
|
|
4
4
|
contents: (InteractiveWaypoint | React.ReactNode)[];
|
|
5
|
-
|
|
5
|
+
activeWaypointId?: string;
|
|
6
|
+
activeWaypointRef?: React.RefObject<HTMLDivElement>;
|
|
6
7
|
zoomYIn: () => void;
|
|
7
8
|
zoomYOut: () => void;
|
|
8
9
|
resetZoom: () => void;
|
|
@@ -12,5 +13,5 @@ export type ManchetteProps = {
|
|
|
12
13
|
isProportional?: boolean;
|
|
13
14
|
toggleMode: () => void;
|
|
14
15
|
};
|
|
15
|
-
declare const Manchette: ({ zoomYIn, zoomYOut, resetZoom, yZoom, contents,
|
|
16
|
+
declare const Manchette: ({ zoomYIn, zoomYOut, resetZoom, yZoom, contents, activeWaypointId, activeWaypointRef, isProportional, toggleMode, children, height, }: ManchetteProps) => React.JSX.Element;
|
|
16
17
|
export default Manchette;
|
|
@@ -2,9 +2,9 @@ import React from 'react';
|
|
|
2
2
|
import { type InteractiveWaypoint } from '../types';
|
|
3
3
|
type WaypointProps = {
|
|
4
4
|
waypoint: InteractiveWaypoint;
|
|
5
|
-
|
|
5
|
+
waypointRef?: React.RefObject<HTMLDivElement>;
|
|
6
6
|
isActive: boolean;
|
|
7
7
|
isMenuActive?: boolean;
|
|
8
8
|
};
|
|
9
|
-
declare const Waypoint: ({ waypoint: { name, secondaryCode, id, position, onClick },
|
|
9
|
+
declare const Waypoint: ({ waypoint: { name, secondaryCode, id, position, onClick }, waypointRef, isActive, isMenuActive, }: WaypointProps) => React.JSX.Element;
|
|
10
10
|
export default Waypoint;
|
|
@@ -48,14 +48,24 @@ export type SplitPoint = {
|
|
|
48
48
|
/** a React node to render the split point, manchette side */
|
|
49
49
|
manchetteNode?: ReactNode;
|
|
50
50
|
};
|
|
51
|
-
|
|
51
|
+
export type ManchetteWithSpaceTimeChartOptions = {
|
|
52
|
+
displayTimeCaptions: boolean;
|
|
53
|
+
enableTimePan: boolean;
|
|
54
|
+
enableSpacePan: boolean;
|
|
55
|
+
enableTimeZoom: boolean;
|
|
56
|
+
};
|
|
57
|
+
export declare const DEFAULT_MANCHETTE_WITH_SPACE_TIME_CHART_OPTIONS: ManchetteWithSpaceTimeChartOptions;
|
|
58
|
+
declare const useManchetteWithSpaceTimeChart: ({ waypoints, manchetteWithSpaceTimeChartRef, height, spaceTimeChartRef, defaultTimeOrigin, defaultSpaceOrigin, defaultXOffset, verticalPadding, splitPoints, options, }: {
|
|
52
59
|
waypoints: Waypoint[];
|
|
53
60
|
manchetteWithSpaceTimeChartRef: React.RefObject<HTMLDivElement>;
|
|
54
61
|
height?: number;
|
|
55
62
|
spaceTimeChartRef?: React.RefObject<HTMLDivElement>;
|
|
56
63
|
defaultTimeOrigin?: number;
|
|
57
64
|
defaultSpaceOrigin?: number;
|
|
65
|
+
defaultXOffset?: number;
|
|
66
|
+
verticalPadding?: number;
|
|
58
67
|
splitPoints?: SplitPoint[];
|
|
68
|
+
options?: Partial<ManchetteWithSpaceTimeChartOptions>;
|
|
59
69
|
}) => {
|
|
60
70
|
manchetteProps: ManchetteProps;
|
|
61
71
|
spaceTimeChartProps: SpaceTimeChartProps;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import '@osrd-project/ui-core/dist/theme.css';
|
|
2
2
|
import './styles/main.css';
|
|
3
3
|
import './consts';
|
|
4
|
+
export { default as WaypointComponent } from './components/Waypoint';
|
|
4
5
|
export { default as Manchette, type ManchetteProps } from './components/Manchette';
|
|
5
6
|
export { default as ManchetteWithSpaceTimeChart, type ManchetteWithSpaceTimeChartProps, } from './components/ManchetteWithSpaceTimeChart';
|
|
6
7
|
export { DEFAULT_ZOOM_MS_PER_PX } from './consts';
|
|
7
8
|
export { default as useManchetteWithSpaceTimeChart } from './hooks/useManchetteWithSpaceTimeChart';
|
|
8
9
|
export { default as usePaths } from './hooks/usePaths';
|
|
9
|
-
export type {
|
|
10
|
-
export { positionMmToKm } from './utils';
|
|
10
|
+
export type { Waypoint, ProjectPathTrainResult, InteractiveWaypoint } from './types';
|
|
11
|
+
export { positionMmToKm, positionKmToMm } from './utils';
|
|
11
12
|
export { timeScaleToZoomValue, isInteractiveWaypoint } from './utils/helpers';
|
|
@@ -10,11 +10,6 @@ export type InteractiveWaypoint = Waypoint & {
|
|
|
10
10
|
styles?: CSSProperties;
|
|
11
11
|
onClick?: (waypointId: string) => void;
|
|
12
12
|
};
|
|
13
|
-
export type WaypointMenuData = {
|
|
14
|
-
menu: React.ReactNode;
|
|
15
|
-
activeWaypointId?: string;
|
|
16
|
-
manchetteWrapperRef: React.RefObject<HTMLDivElement>;
|
|
17
|
-
};
|
|
18
13
|
export type ProjectPathTrainResult = {
|
|
19
14
|
id: string;
|
|
20
15
|
name: string;
|
|
@@ -29,11 +29,7 @@ export declare const selectWaypointsToDisplay: (waypoints: Waypoint[], { height,
|
|
|
29
29
|
* km (isProportional): { coefficient: gives a scale in meter/pixel }
|
|
30
30
|
* linear: { size: height in pixel } (each point distributed evenly along the height of manchette.)
|
|
31
31
|
*/
|
|
32
|
-
export declare const getScales: (waypoints: Waypoint[], { isProportional, yZoom }: WaypointsOptions, minZoomMillimeterPerPx: number, maxZoomMillimeterPerPx: number) => {
|
|
33
|
-
from: number;
|
|
34
|
-
to: number;
|
|
35
|
-
size: number;
|
|
36
|
-
}[] | ({
|
|
32
|
+
export declare const getScales: (waypoints: Waypoint[], { isProportional, yZoom, height }: WaypointsOptions, minZoomMillimeterPerPx: number, maxZoomMillimeterPerPx: number) => ({
|
|
37
33
|
coefficient: number;
|
|
38
34
|
size?: undefined;
|
|
39
35
|
from: number;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
export declare const getHeightWithoutLastWaypoint: (height: number) => number;
|
|
2
2
|
export declare const positionMmToKm: (position: number) => number;
|
|
3
|
+
export declare const positionKmToMm: (position: number) => number;
|
|
3
4
|
export declare const msToS: (time: number) => number;
|
|
4
|
-
export declare const calcTotalDistance:
|
|
5
|
+
export declare const calcTotalDistance: (ops: {
|
|
5
6
|
position: number;
|
|
6
|
-
}
|
|
7
|
+
}[]) => number;
|
|
7
8
|
type Point = {
|
|
8
9
|
x: number;
|
|
9
10
|
y: number;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { type HTMLProps, type ReactNode } from 'react';
|
|
2
|
-
import type { Track, OccupancyZone } from '../../trackOccupancyDiagram/components/types';
|
|
3
2
|
export type Point = {
|
|
4
3
|
x: number;
|
|
5
4
|
y: number;
|
|
@@ -61,7 +60,7 @@ export type PixelToTime = (x: number) => number;
|
|
|
61
60
|
export type PixelToSpace = (y: number) => number;
|
|
62
61
|
export type PointToData = (point: Point) => DataPoint;
|
|
63
62
|
export type DataToPoint = (data: DataPoint) => Point;
|
|
64
|
-
export declare const PICKING_LAYERS: readonly ["paths"];
|
|
63
|
+
export declare const PICKING_LAYERS: readonly ["paths", "overlay"];
|
|
65
64
|
export type PickingLayerType = (typeof PICKING_LAYERS)[number];
|
|
66
65
|
export declare const LAYERS: readonly ["background", "graduations", "paths", "overlay", "captions"];
|
|
67
66
|
export type LayerType = (typeof LAYERS)[number];
|
|
@@ -143,6 +142,7 @@ export type SpaceTimeChartProps = {
|
|
|
143
142
|
yOffset?: number;
|
|
144
143
|
swapAxis?: boolean;
|
|
145
144
|
enableSnapping?: boolean;
|
|
145
|
+
hideTimeCaptions?: boolean;
|
|
146
146
|
hideGrid?: boolean;
|
|
147
147
|
hidePathsLabels?: boolean;
|
|
148
148
|
hideDates?: boolean;
|
|
@@ -184,8 +184,6 @@ export type SpaceTimeChartProps = {
|
|
|
184
184
|
export type SpaceTimeChartContextType = {
|
|
185
185
|
width: number;
|
|
186
186
|
height: number;
|
|
187
|
-
trackOccupancyWidth?: number;
|
|
188
|
-
trackOccupancyHeight?: number;
|
|
189
187
|
timeAxis: Axis;
|
|
190
188
|
spaceAxis: Axis;
|
|
191
189
|
swapAxis: boolean;
|
|
@@ -199,6 +197,7 @@ export type SpaceTimeChartContextType = {
|
|
|
199
197
|
timeScale: number;
|
|
200
198
|
spaceOrigin: number;
|
|
201
199
|
spaceScaleTree: NormalizedScaleTree;
|
|
200
|
+
flatSteps: Set<number>;
|
|
202
201
|
getTimePixel: TimeToPixel;
|
|
203
202
|
getSpacePixel: SpaceToPixel;
|
|
204
203
|
getPoint: DataToPoint;
|
|
@@ -206,11 +205,10 @@ export type SpaceTimeChartContextType = {
|
|
|
206
205
|
getSpace: PixelToSpace;
|
|
207
206
|
getData: PointToData;
|
|
208
207
|
operationalPoints: OperationalPoint[];
|
|
209
|
-
tracks?: Track[];
|
|
210
|
-
occupancyZones?: OccupancyZone[];
|
|
211
208
|
theme: SpaceTimeChartTheme;
|
|
212
209
|
captionSize: number;
|
|
213
210
|
enableSnapping: boolean;
|
|
211
|
+
hideTimeCaptions: boolean;
|
|
214
212
|
hideGrid: boolean;
|
|
215
213
|
hidePathsLabels: boolean;
|
|
216
214
|
hideDates: boolean;
|
|
@@ -7,6 +7,11 @@ import { type NormalizedScaleTree, type NormalizedScale, type SpaceScale, type S
|
|
|
7
7
|
* purpose.
|
|
8
8
|
*/
|
|
9
9
|
export declare function spaceScalesToBinaryTree(spaceOrigin: number, spaceScales: SpaceScale[], skipSiblingReferences?: boolean): NormalizedScaleTree;
|
|
10
|
+
/**
|
|
11
|
+
* This function takes a sequence of SpaceScales, identifies the flat steps (i.e. the scales that do
|
|
12
|
+
* not increase the position), and returns them in a set.
|
|
13
|
+
*/
|
|
14
|
+
export declare function getFlatSteps(spaceScales: SpaceScale[]): Set<number>;
|
|
10
15
|
/**
|
|
11
16
|
* This function takes a NormalizedScaleTree and a position, and returns the leaf node from the
|
|
12
17
|
* tree that contains that position.
|