@dexteel/mesf-core 7.0.2 → 7.1.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.
Files changed (30) hide show
  1. package/.release-please-manifest.json +1 -1
  2. package/CHANGELOG.md +8 -0
  3. package/dist/components/navigation/Header.d.ts +2 -1
  4. package/dist/components/navigation/Navigation.d.ts +2 -1
  5. package/dist/index.esm.js +4589 -588
  6. package/dist/index.esm.js.map +1 -1
  7. package/dist/pages/trendings-v2/TrendingsPageV2.d.ts +15 -0
  8. package/dist/pages/trendings-v2/components/chart/components/ColorPickerV2.d.ts +7 -0
  9. package/dist/pages/trendings-v2/components/chart/components/DraggableLineControlV2.d.ts +26 -0
  10. package/dist/pages/trendings-v2/components/chart/components/TagFolderCustomNodeV2.d.ts +20 -0
  11. package/dist/pages/trendings-v2/components/chart/components/TagSearchInput.d.ts +10 -0
  12. package/dist/pages/trendings-v2/components/chart/components/TagsTreeModalV2.d.ts +9 -0
  13. package/dist/pages/trendings-v2/components/chart/components/modals/LoadViewModalV2.d.ts +7 -0
  14. package/dist/pages/trendings-v2/components/chart/components/modals/SaveUpdateDeleteViewModalV2.d.ts +10 -0
  15. package/dist/pages/trendings-v2/components/chart/context/TrendingContextV2.d.ts +50 -0
  16. package/dist/pages/trendings-v2/components/chart/hooks/useCursorData.d.ts +6 -0
  17. package/dist/pages/trendings-v2/components/chart/hooks/useSeriesMinMax.d.ts +12 -0
  18. package/dist/pages/trendings-v2/components/chart/hooks/useTagSearch.d.ts +30 -0
  19. package/dist/pages/trendings-v2/components/chart/models/TrendingModelsV2.d.ts +104 -0
  20. package/dist/pages/trendings-v2/components/chart/repository/TrendingRepositoryV2.d.ts +1 -0
  21. package/dist/pages/trendings-v2/components/chart/sections/HeaderSectionV2.d.ts +10 -0
  22. package/dist/pages/trendings-v2/components/chart/sections/TagsTableV2.d.ts +2 -0
  23. package/dist/pages/trendings-v2/components/chart/sections/TrendingChartV2.d.ts +12 -0
  24. package/dist/pages/trendings-v2/components/chart/utils/calculateDateFromPeriod.d.ts +21 -0
  25. package/dist/pages/trendings-v2/components/chart/utils/calculateScales.d.ts +8 -0
  26. package/dist/pages/trendings-v2/components/chart/utils/coordinateConversion.d.ts +43 -0
  27. package/dist/pages/trendings-v2/components/chart/utils/formatEChartsData.d.ts +9 -0
  28. package/dist/pages/trendings-v2/components/chart/utils/tagSeparation.d.ts +13 -0
  29. package/dist/pages/trendings-v2/index.d.ts +3 -0
  30. package/package.json +3 -1
@@ -0,0 +1,15 @@
1
+ import React from "react";
2
+ import type { ViewTagDataSet } from "./components/chart/models/TrendingModelsV2";
3
+ export declare const useSearchViews: ({ autoRefresh, }: {
4
+ autoRefresh?: boolean;
5
+ }) => import("@tanstack/react-query").UseQueryResult<import("../trendings/components/chart/models/TrendingModels").View[], unknown>;
6
+ export declare const useSearchViewTags: ({ viewId }: {
7
+ viewId: number | null;
8
+ }) => import("@tanstack/react-query").UseQueryResult<any[], unknown>;
9
+ export declare const useSearchSeries: ({ start, end, tagIds, autoRefresh, }: {
10
+ start: number;
11
+ end: number;
12
+ tagIds: number[];
13
+ autoRefresh?: boolean;
14
+ }) => import("@tanstack/react-query").UseQueryResult<ViewTagDataSet[][], Error>;
15
+ export declare const TrendingsPageV2: () => React.JSX.Element;
@@ -0,0 +1,7 @@
1
+ import React from "react";
2
+ interface ColorPickerV2Props {
3
+ color: string;
4
+ onColorChange: (newColor: string) => void;
5
+ }
6
+ export declare const ColorPickerV2: React.FC<ColorPickerV2Props>;
7
+ export {};
@@ -0,0 +1,26 @@
1
+ import React from "react";
2
+ import { ChartArea } from "../utils/coordinateConversion";
3
+ interface DraggableLineControlV2Props {
4
+ /** The chart's pixel boundaries */
5
+ chartArea: ChartArea;
6
+ /** Initial pixel X position for the cursor */
7
+ initialLeft: number;
8
+ /** Callback when drag ends with new pixel position */
9
+ onDragEnd: (newLeft: number) => void;
10
+ /** Optional: Callback during dragging for real-time updates */
11
+ onChange?: (newLeft: number) => void;
12
+ /** Color of the cursor line (e.g., 'red', 'blue', '#ff0000') */
13
+ color: string;
14
+ /** Optional: X position of the other cursor to prevent overlap */
15
+ otherLineCoord?: number;
16
+ /** Minimum spacing between cursors in pixels */
17
+ minSpacing?: number;
18
+ /** Optional: Timestamp to display at the bottom of the cursor */
19
+ timestamp?: number;
20
+ }
21
+ /**
22
+ * External draggable cursor control for the trending chart
23
+ * Renders a draggable pin handle with a vertical line that can be positioned over the chart
24
+ */
25
+ declare const DraggableLineControlV2: React.FC<DraggableLineControlV2Props>;
26
+ export default DraggableLineControlV2;
@@ -0,0 +1,20 @@
1
+ import { NodeModel, RenderParams } from "@minoru/react-dnd-treeview";
2
+ import React from "react";
3
+ import { TagFromTree } from "../../../../trendings/components/chart/models/TagsTree.model";
4
+ interface CustomNodeProps {
5
+ node: NodeModel<TagFromTree>;
6
+ setContextMenuOver: (data: NodeModel<TagFromTree>, e: React.MouseEvent<HTMLElement>) => void;
7
+ options: RenderParams;
8
+ openTagFolders: {
9
+ [TagId: string]: string | number;
10
+ [TagId: number]: string | number;
11
+ };
12
+ handleSelect: (node: NodeModel<TagFromTree>) => void;
13
+ setOpenTagFolders: React.Dispatch<React.SetStateAction<{
14
+ [TagId: string]: string | number;
15
+ [TagId: number]: string | number;
16
+ }>>;
17
+ isSelected: boolean;
18
+ }
19
+ export declare const TagFolderCustomNodeV2: React.FC<CustomNodeProps>;
20
+ export {};
@@ -0,0 +1,10 @@
1
+ import { NodeModel } from "@minoru/react-dnd-treeview";
2
+ import React from "react";
3
+ import { TagFromTree } from "../../../../trendings/components/chart/models/TagsTree.model";
4
+ import { TagSearchResult } from "../hooks/useTagSearch";
5
+ interface TagSearchInputProps {
6
+ tagNodes: NodeModel<TagFromTree>[];
7
+ onSearchResultClick: (result: TagSearchResult) => void;
8
+ }
9
+ export declare const TagSearchInput: React.FC<TagSearchInputProps>;
10
+ export {};
@@ -0,0 +1,9 @@
1
+ import React from "react";
2
+ import { TagFromTree } from "../../../../trendings/components/chart/models/TagsTree.model";
3
+ interface Props {
4
+ open: boolean;
5
+ handleClose: () => void;
6
+ onTagSelect: (selected: TagFromTree) => void;
7
+ }
8
+ export declare const TagsTreeModalV2: ({ open, handleClose, onTagSelect }: Props) => React.JSX.Element;
9
+ export {};
@@ -0,0 +1,7 @@
1
+ import React from "react";
2
+ interface Props {
3
+ open: boolean;
4
+ handleClose: () => void;
5
+ }
6
+ export declare const LoadViewModalV2: ({ open, handleClose }: Props) => React.JSX.Element;
7
+ export {};
@@ -0,0 +1,10 @@
1
+ import React from "react";
2
+ import type { View } from "../../models/TrendingModelsV2";
3
+ interface Props {
4
+ open: boolean;
5
+ mode: "create" | "update" | "delete";
6
+ handleClose: (shouldUpdate: boolean) => void;
7
+ view?: View | null;
8
+ }
9
+ export declare const SaveUpdateDeleteViewModalV2: ({ open, mode, handleClose, view, }: Props) => React.JSX.Element;
10
+ export {};
@@ -0,0 +1,50 @@
1
+ import React from "react";
2
+ import type { scopeType } from "../../../../trendings/components/chart/models/scopes.model";
3
+ import type { TagMinMax } from "../hooks/useSeriesMinMax";
4
+ import type { ChartConfig, CursorData, View, ViewTagsMap } from "../models/TrendingModelsV2";
5
+ interface TrendingState {
6
+ viewTags: ViewTagsMap;
7
+ viewSelected: View | null;
8
+ views: View[];
9
+ timeScopeStart: Date;
10
+ timeScopeEnd: Date;
11
+ scope: scopeType;
12
+ shouldRefetchSeries: boolean;
13
+ cursorData: CursorData | null;
14
+ chartConfig: ChartConfig;
15
+ seriesMinMax: TagMinMax;
16
+ highlightedSeries: string | null;
17
+ cursor1Time: number;
18
+ cursor2Time: number;
19
+ selectedCursor: "cursor1" | "cursor2" | null;
20
+ }
21
+ interface TrendingActions {
22
+ setViewTags: (viewTags: ViewTagsMap) => void;
23
+ setViewTagsAndRefetch: (viewTags: ViewTagsMap) => void;
24
+ setViewSelected: (view: View | null) => void;
25
+ setViews: (views: View[]) => void;
26
+ setTotalScope: (scope: {
27
+ start?: Date;
28
+ end?: Date;
29
+ scope?: scopeType;
30
+ graphPan?: boolean;
31
+ }) => void;
32
+ setCursorData: (data: CursorData | null) => void;
33
+ setChartConfig: (config: Partial<ChartConfig>) => void;
34
+ triggerSeriesRefetch: () => void;
35
+ setSeriesMinMax: (minMax: TagMinMax) => void;
36
+ highlightSeries: (seriesName: string | null) => void;
37
+ updateCursor1Time: (time: number) => void;
38
+ updateCursor2Time: (time: number) => void;
39
+ setSelectedCursor: (cursor: "cursor1" | "cursor2" | null) => void;
40
+ resetCursors: () => void;
41
+ }
42
+ interface TrendingContextValue {
43
+ state: TrendingState;
44
+ actions: TrendingActions;
45
+ }
46
+ export declare const TrendingProviderV2: React.FC<{
47
+ children: React.ReactNode;
48
+ }>;
49
+ export declare const useTrendingContextV2: () => TrendingContextValue;
50
+ export {};
@@ -0,0 +1,6 @@
1
+ import type { CursorData, ViewTagDataSet, ViewTagsMap } from "../models/TrendingModelsV2";
2
+ /**
3
+ * Hook to calculate cursor data (Y1, Y2, Y2-Y1, min/max between cursors)
4
+ * Uses "last value before cursor" strategy to avoid interpolation issues with sparse data
5
+ */
6
+ export declare const useCursorData: (cursor1Time: number, cursor2Time: number, series: ViewTagDataSet[][] | undefined, viewTags: ViewTagsMap) => CursorData | null;
@@ -0,0 +1,12 @@
1
+ import type { ViewTagDataSet } from "../models/TrendingModelsV2";
2
+ export interface TagMinMax {
3
+ [tagId: number]: {
4
+ min: number;
5
+ max: number;
6
+ };
7
+ }
8
+ /**
9
+ * Hook to calculate overall min/max values from series data
10
+ * This is optimized for performance by only calculating once per series data change
11
+ */
12
+ export declare const useSeriesMinMax: (series: ViewTagDataSet[][] | undefined, tagIds: number[]) => TagMinMax;
@@ -0,0 +1,30 @@
1
+ import { NodeModel } from "@minoru/react-dnd-treeview";
2
+ import React from "react";
3
+ import { TagFromTree } from "../../../../trendings/components/chart/models/TagsTree.model";
4
+ export interface TagSearchResult {
5
+ id: number;
6
+ name: string;
7
+ path: string;
8
+ isDroppable: boolean;
9
+ hasChildren: boolean;
10
+ tagTypeCode: string;
11
+ node: NodeModel<TagFromTree>;
12
+ }
13
+ interface UseTagSearchProps {
14
+ tagNodes: NodeModel<TagFromTree>[];
15
+ externalSearchTerm?: string;
16
+ onSearchTermChange?: (term: string) => void;
17
+ }
18
+ export declare const useTagSearch: ({ tagNodes, externalSearchTerm, onSearchTermChange, }: UseTagSearchProps) => {
19
+ searchTerm: string;
20
+ searchResults: TagSearchResult[];
21
+ showSearchResults: boolean;
22
+ focusedSearchIndex: number;
23
+ searchResultsRefs: React.MutableRefObject<(HTMLElement | null)[]>;
24
+ handleSearchChange: (event: React.ChangeEvent<HTMLInputElement>) => void;
25
+ handleKeyDown: (event: React.KeyboardEvent<HTMLDivElement>) => TagSearchResult | undefined;
26
+ scrollFocusedItemIntoView: (index: number) => void;
27
+ clearSearch: () => void;
28
+ triggerSearch: (term: string) => void;
29
+ };
30
+ export {};
@@ -0,0 +1,104 @@
1
+ export interface ViewTag {
2
+ TagId: number;
3
+ TagName: string;
4
+ Alias: string;
5
+ Color: string;
6
+ MinScale: number;
7
+ MaxScale: number;
8
+ IsVisible: boolean;
9
+ IsAutoScale: boolean;
10
+ Unit: string;
11
+ TagType: "A" | "D";
12
+ TagTypeCode?: string;
13
+ }
14
+ export interface View {
15
+ ViewId: number;
16
+ ViewName: string;
17
+ IsPublic: boolean;
18
+ CreatedBy?: string;
19
+ CreatedDate?: Date;
20
+ }
21
+ export interface ViewTagsMap {
22
+ [tagId: number]: {
23
+ viewTag: ViewTag;
24
+ order: number;
25
+ };
26
+ }
27
+ export interface EChartsDataPoint {
28
+ timestamp: number;
29
+ value: number | null;
30
+ }
31
+ export interface ViewTagDataSet {
32
+ timestamp: string | number;
33
+ value: number | null;
34
+ }
35
+ export interface CursorData {
36
+ x1: number;
37
+ x2: number;
38
+ tagValues: {
39
+ [tagId: number]: {
40
+ y1: number;
41
+ y2: number;
42
+ y2y1: number;
43
+ pmin: {
44
+ x: number;
45
+ y: number;
46
+ };
47
+ pmax: {
48
+ x: number;
49
+ y: number;
50
+ };
51
+ };
52
+ };
53
+ }
54
+ export interface ChartConfig {
55
+ showLegend: boolean;
56
+ showTooltip: boolean;
57
+ animation: boolean;
58
+ theme: "light" | "dark";
59
+ }
60
+ export interface CustomOptions {
61
+ showGridLines: boolean;
62
+ showSymbols: boolean;
63
+ smoothLines: boolean;
64
+ showLegend: boolean;
65
+ showTooltip: boolean;
66
+ combinedView: boolean;
67
+ showToolbox: boolean;
68
+ showYAxisNames: boolean;
69
+ }
70
+ export interface TagTableRow {
71
+ id: number;
72
+ visible: boolean;
73
+ type: "A" | "D";
74
+ alias: string;
75
+ tagName: string;
76
+ color: string;
77
+ minScale: number;
78
+ maxScale: number;
79
+ autoScale: boolean;
80
+ unit: string;
81
+ y1: number;
82
+ y2: number;
83
+ y2y1: number;
84
+ min: number;
85
+ max: number;
86
+ overallMin: number;
87
+ overallMax: number;
88
+ }
89
+ export interface TagFromTree {
90
+ Tagkey: number;
91
+ TagId: number;
92
+ TagName: string;
93
+ TagFolderId: number | null;
94
+ ParentTagFolderId: number | null;
95
+ TagFolderName: string | null;
96
+ IsFolder: boolean;
97
+ Color: string | null;
98
+ Alias: string | null;
99
+ MinScale: number | null;
100
+ MaxScale: number | null;
101
+ Unit: string | null;
102
+ TagTypeCode: string;
103
+ IsActive: boolean;
104
+ }
@@ -0,0 +1 @@
1
+ export { changeTagFolderToTag, deleteAllViewTagsFromView, deleteTagFolder, deleteView, deleteViewTag, getSeriesData, getTagsTree, getViews, getViewTags, saveTagDefaults, upsertTagFolder, upsertView, upsertViewTag, } from "../../../../trendings/components/chart/repository/TrendingRepository";
@@ -0,0 +1,10 @@
1
+ import { EChartsInstance } from "echarts-for-react";
2
+ import React from "react";
3
+ interface HeaderSectionProps {
4
+ autoRefresh: boolean;
5
+ setAutoRefresh: (value: boolean) => void;
6
+ setChartOptions?: (options: any) => void;
7
+ chartInstance: EChartsInstance | null;
8
+ }
9
+ export declare const HeaderSectionV2: React.FC<HeaderSectionProps>;
10
+ export {};
@@ -0,0 +1,2 @@
1
+ import React from "react";
2
+ export declare const TagsTableV2: React.FC;
@@ -0,0 +1,12 @@
1
+ import type { EChartsInstance } from "echarts-for-react";
2
+ import React from "react";
3
+ import type { CustomOptions, ViewTagDataSet } from "../models/TrendingModelsV2";
4
+ interface TrendingChartV2Props {
5
+ series?: ViewTagDataSet[][];
6
+ customOptions?: CustomOptions | null;
7
+ isLoading?: boolean;
8
+ onChartReady?: (chartInstance: EChartsInstance | null) => void;
9
+ dataLoadedTrigger?: number;
10
+ }
11
+ export declare const TrendingChartV2: React.FC<TrendingChartV2Props>;
12
+ export {};
@@ -0,0 +1,21 @@
1
+ import type { scopeType } from "../../../../trendings/components/chart/models/scopes.model";
2
+ /**
3
+ * Get the duration in milliseconds for a given scope/period
4
+ */
5
+ export declare const getScopeDuration: (scope: scopeType) => number | null;
6
+ /**
7
+ * Calculate the end date based on start date and period
8
+ */
9
+ export declare const calculateEndFromStart: (start: Date, scope: scopeType) => Date | null;
10
+ /**
11
+ * Calculate the start date based on end date and period
12
+ */
13
+ export declare const calculateStartFromEnd: (end: Date, scope: scopeType) => Date | null;
14
+ /**
15
+ * Calculate both start and end dates to maintain the period duration
16
+ * when one of them changes
17
+ */
18
+ export declare const calculateCounterpartDate: (changedDate: Date, changedField: "start" | "end", scope: scopeType) => {
19
+ start: Date;
20
+ end: Date;
21
+ } | null;
@@ -0,0 +1,8 @@
1
+ import type { ViewTag } from "../models/TrendingModelsV2";
2
+ /**
3
+ * Calculate min/max for Y-axis based on tag configuration
4
+ */
5
+ export declare const calculateYAxisBounds: (tag: ViewTag, dataMin?: number, dataMax?: number) => {
6
+ min?: number;
7
+ max?: number;
8
+ };
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Utility functions for converting between pixel coordinates and timestamps
3
+ * in the trending chart view
4
+ */
5
+ export interface ChartArea {
6
+ left: number;
7
+ right: number;
8
+ top: number;
9
+ bottom: number;
10
+ }
11
+ export interface TimeRange {
12
+ start: number;
13
+ end: number;
14
+ }
15
+ /**
16
+ * Convert a pixel X coordinate to a timestamp based on the current chart area and visible time range
17
+ * Uses linear interpolation to map pixel position to time
18
+ *
19
+ * @param pixelX - The X coordinate in pixels
20
+ * @param chartArea - The chart's pixel boundaries
21
+ * @param timeRange - The visible time range in milliseconds
22
+ * @returns The corresponding timestamp in milliseconds
23
+ */
24
+ export declare function pixelToTimestamp(pixelX: number, chartArea: ChartArea, timeRange: TimeRange): number;
25
+ /**
26
+ * Convert a timestamp to a pixel X coordinate based on the current chart area and visible time range
27
+ * Uses linear interpolation to map time to pixel position
28
+ *
29
+ * @param timestamp - The timestamp in milliseconds
30
+ * @param chartArea - The chart's pixel boundaries
31
+ * @param timeRange - The visible time range in milliseconds
32
+ * @returns The corresponding X coordinate in pixels
33
+ */
34
+ export declare function timestampToPixel(timestamp: number, chartArea: ChartArea, timeRange: TimeRange): number;
35
+ /**
36
+ * Initialize cursor positions at relative positions (e.g., 10% and 90%) of the time range
37
+ *
38
+ * @param timeRange - The visible time range in milliseconds
39
+ * @param percent1 - Position of first cursor as percentage (0-1)
40
+ * @param percent2 - Position of second cursor as percentage (0-1)
41
+ * @returns Tuple of [cursor1Timestamp, cursor2Timestamp]
42
+ */
43
+ export declare function initializeCursorTimestamps(timeRange: TimeRange, percent1?: number, percent2?: number): [number, number];
@@ -0,0 +1,9 @@
1
+ import type { EChartsDataPoint, ViewTagDataSet } from "../models/TrendingModelsV2";
2
+ /**
3
+ * Transforms API data to ECharts format
4
+ */
5
+ export declare const formatDataForECharts: (seriesData: ViewTagDataSet[]) => EChartsDataPoint[];
6
+ /**
7
+ * Converts ECharts data format to [timestamp, value] array format
8
+ */
9
+ export declare const toEChartsArrayFormat: (data: EChartsDataPoint[]) => [number, number | null][];
@@ -0,0 +1,13 @@
1
+ import type { ViewTag, ViewTagsMap } from "../models/TrendingModelsV2";
2
+ export interface SeparatedTags {
3
+ analogTags: ViewTag[];
4
+ digitalTags: ViewTag[];
5
+ }
6
+ /**
7
+ * Separates tags into analog and digital based on TagType
8
+ */
9
+ export declare const separateTagsByType: (viewTagsMap: ViewTagsMap) => SeparatedTags;
10
+ /**
11
+ * Checks if two analog tags should share the same Y-axis based on their scale ranges
12
+ */
13
+ export declare const shouldShareAxis: (tag1: ViewTag, tag2: ViewTag) => boolean;
@@ -0,0 +1,3 @@
1
+ import React from "react";
2
+ declare const TrendingsV2Index: () => React.JSX.Element;
3
+ export default TrendingsV2Index;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dexteel/mesf-core",
3
- "version": "7.0.2",
3
+ "version": "7.1.0",
4
4
  "author": "Dexteel Team",
5
5
  "module": "dist/index.esm.js",
6
6
  "typings": "dist/index.d.ts",
@@ -36,6 +36,8 @@
36
36
  "@types/node": "^12.20.46",
37
37
  "@types/react": "^18.3.26",
38
38
  "autoprefixer": "^10.4.2",
39
+ "echarts": "^6.0.0",
40
+ "echarts-for-react": "^3.0.4",
39
41
  "husky": "^9.1.4",
40
42
  "moment": "^2.29.3",
41
43
  "prop-types": "^15.8.1",