@equinor/echo-framework 2.0.1 → 2.2.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/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@equinor/echo-framework",
3
- "version": "2.0.1",
3
+ "version": "2.2.0",
4
4
  "peerDependencies": {
5
- "@equinor/echo-base": ">= 2.0.1 < 3.0.0",
6
- "@equinor/echo-components": ">= 2.0.1 < 3.0.0",
7
- "@equinor/echo-core": ">= 2.0.1 < 3.0.0",
8
- "@equinor/echo-search": ">= 2.0.1 < 3.0.0",
9
- "@equinor/echo-utils": ">= 2.0.1 < 3.0.0",
5
+ "@equinor/echo-base": ">= 2.2.0 < 3.0.0",
6
+ "@equinor/echo-components": ">= 2.2.0 < 3.0.0",
7
+ "@equinor/echo-core": ">= 2.2.0 < 3.0.0",
8
+ "@equinor/echo-search": ">= 2.2.0 < 3.0.0",
9
+ "@equinor/echo-utils": ">= 2.2.0 < 3.0.0",
10
10
  "@equinor/eds-core-react": "0.49.0",
11
11
  "@equinor/eds-icons": "0.22.0",
12
12
  "react": ">= 17.0.2",
package/src/index.d.ts CHANGED
@@ -43,13 +43,14 @@ export { useIsFullScreenModeEnabled } from './lib/hooks/useIsFullScreenModeEnabl
43
43
  export { useOpenPrepview } from './lib/hooks/useOpenPrepview';
44
44
  export { useScreenOrientation } from './lib/hooks/useScreenOrientation';
45
45
  export { useScreenValues } from './lib/hooks/useScreenValues';
46
+ export { useSelectionGroupLabelsPerItem } from './lib/hooks/useSelectionGroupLabelsPerItem';
46
47
  export { getMeasurementsFromMaintenanceDataApi } from './lib/services/api/api-measuringPoints';
47
48
  export { getPlantsCachedOrApi, getPlantsFromApi } from './lib/services/api/api-plants';
48
49
  export { RegisteredComponentName } from './lib/services/componentRegistry/componentRegistry';
49
50
  export * from './lib/services/dataLayerPanel';
50
51
  export { EchoViewInspectionToolMode } from './lib/services/echoViewService/echoView.type';
51
52
  export type { EchoView, EchoViewEcmPdfInspectionToolConfig, EchoViewSyncSettings } from './lib/services/echoViewService/echoView.type';
52
- export { echoViewService, setEchoView } from './lib/services/echoViewService/echoViewService';
53
+ export { echoViewService, echoViewServiceAPI, setEchoView, clearEchoView } from './lib/services/echoViewService/echoViewService';
53
54
  export * from './lib/services/eventHubActions';
54
55
  export * from './lib/services/leftPanelNavigation';
55
56
  export * from './lib/services/locationService/locationService';
@@ -127,6 +128,7 @@ declare const EchoFramework: Readonly<{
127
128
  isScreenMobileSize: boolean;
128
129
  screenOrientation: import("./lib/types/hookLibrary").ScreenOrientation;
129
130
  };
131
+ useSelectionGroupLabelsPerItem: () => Map<string, string[]>;
130
132
  useTabTitle(): void;
131
133
  useTagDetails({ instCode, tagNo }: {
132
134
  tagNo: string;
@@ -13,7 +13,3 @@ export interface EchoUiState {
13
13
  updateModuleName: (newModuleName: string) => void;
14
14
  }
15
15
  export declare const useEchoUserInterfaceStore: zustand.UseBoundStore<zustand.StoreApi<EchoUiState>>;
16
- /**
17
- * @deprecated useEchoUiContext() is deprecated, please use useEchoUserInterfaceStore() instead.
18
- */
19
- export declare const useEchoUiContext: any;
@@ -8,5 +8,6 @@ export * from './usePlantAvailableIn3d';
8
8
  export * from './usePlantAvailableIn3dWeb';
9
9
  export * from './useScreenOrientation';
10
10
  export * from './useScreenValues';
11
+ export * from './useSelectionGroupLabelsPerItem';
11
12
  export * from './useTabTitle';
12
13
  export * from './useTagDetails';
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Custom hook that creates a mapping between selection items and their associated group labels.
3
+ *
4
+ * This hook is primarily used in 3D Web for determining which selection groups
5
+ * contain specific items. It's particularly useful for Legend components that need to display
6
+ * which lists/groups items belong to and their associated colors.
7
+ *
8
+ * @returns {Map<string, string[]>} A Map where:
9
+ * - Key: Item ID as a string (converted using globalSelectionUtils.itemIdToString)
10
+ * - Value: Array of group labels that the item belongs to
11
+ *
12
+ * @example
13
+ * ```typescript
14
+ * const itemGroupLabels = useSelectionGroupLabelsPerItem();
15
+ * const groupsForItem = itemGroupLabels.get('item-123');
16
+ * // Returns: ['Group A', 'Group B'] if item-123 belongs to both groups
17
+ * ```
18
+ */
19
+ export declare const useSelectionGroupLabelsPerItem: () => Map<string, string[]>;
@@ -1,4 +1,73 @@
1
1
  import { EchoView } from './echoView.type';
2
+ /**
3
+ * @internal
4
+ * Sets the EchoView instance. This function is primarily intended for internal framework use and testing.
5
+ *
6
+ * @param echoView - The EchoView instance to set
7
+ */
2
8
  export declare function setEchoView(echoView: EchoView): void;
9
+ /**
10
+ * @internal
11
+ * Sets the EchoView instance. This function is primarily intended for internal framework use and testing.
12
+ *
13
+ * Clears the current echo view instance and resets access keys.
14
+ *
15
+ * This function performs cleanup by setting the echo view instance to undefined
16
+ * and clearing the first access keys array. This is typically called when
17
+ * reinitializing or shutting down the echo view system.
18
+ */
3
19
  export declare function clearEchoView(): void;
20
+ /**
21
+ * @deprecated Use echoViewServiceAPI.get instead.
22
+ *
23
+ * Gets the current EchoView instance.
24
+ *
25
+ * @returns The current EchoView instance if available, undefined otherwise
26
+ */
4
27
  export declare function echoViewService(): EchoView | undefined;
28
+ /**
29
+ * Marks that an application has accessed the echoViewService data for the first time in the current session.
30
+ * Remote apps can use this to track whether they have already loaded data from echoViewService
31
+ * or if this is their first access after navigation.
32
+ *
33
+ * @param appKey - The unique identifier for the application (e.g., 'echo3d')
34
+ */
35
+ declare function markFirstAccessByKey(appKey: string): void;
36
+ /**
37
+ * Checks if an application has accessed the echoViewService data before in the current session.
38
+ * Allows remote apps to differentiate between their first data access and subsequent accesses.
39
+ *
40
+ * @param appKey - The unique identifier for the application to check
41
+ * @returns `true` if the application has accessed the data before, `false` otherwise
42
+ */
43
+ declare function hasBeenAccessedByKey(appKey: string): boolean;
44
+ /**
45
+ * EchoView Service API
46
+ *
47
+ * Provides methods to manage the EchoView instance and track application data access.
48
+ *
49
+ * @example
50
+ * ```typescript
51
+ * // Set the EchoView instance
52
+ * echoViewServiceAPI.set(myEchoView);
53
+ *
54
+ * // Get the current instance
55
+ * const view = echoViewServiceAPI.get();
56
+ *
57
+ * // Track first access
58
+ * if (!echoViewServiceAPI.hasBeenAccessedByKey('echo3d')) {
59
+ * // First time accessing data
60
+ * loadInitialData();
61
+ * echoViewServiceAPI.markFirstAccessByKey('echo3d');
62
+ * }
63
+ * ```
64
+ */
65
+ export declare const echoViewServiceAPI: Readonly<{
66
+ /** Gets the current EchoView instance */
67
+ get: () => EchoView | undefined;
68
+ /** Marks that an application has accessed the echoViewService data for the first time */
69
+ markFirstAccessByKey: typeof markFirstAccessByKey;
70
+ /** Checks if an application has accessed the echoViewService data before in the current session */
71
+ hasBeenAccessedByKey: typeof hasBeenAccessedByKey;
72
+ }>;
73
+ export {};