@equinor/echo-framework 2.4.0 → 2.4.2

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.4.0",
3
+ "version": "2.4.2",
4
4
  "peerDependencies": {
5
- "@equinor/echo-base": ">= 2.4.0 < 3.0.0",
6
- "@equinor/echo-components": ">= 2.4.0 < 3.0.0",
7
- "@equinor/echo-core": ">= 2.4.0 < 3.0.0",
8
- "@equinor/echo-search": ">= 2.4.0 < 3.0.0",
9
- "@equinor/echo-utils": ">= 2.4.0 < 3.0.0",
5
+ "@equinor/echo-base": ">= 2.4.2 < 3.0.0",
6
+ "@equinor/echo-components": ">= 2.4.2 < 3.0.0",
7
+ "@equinor/echo-core": ">= 2.4.2 < 3.0.0",
8
+ "@equinor/echo-search": ">= 2.4.2 < 3.0.0",
9
+ "@equinor/echo-utils": ">= 2.4.2 < 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
@@ -90,6 +90,7 @@ export declare const registerEchopediaComponent: ({ name, component }: {
90
90
  * Use named exports here.
91
91
  */
92
92
  export * from './lib/hooks';
93
+ export { useOpenWorkOrderDetails, type OpenWorkOrderFn } from './lib/hooks/useOpenWorkOrderDetails';
93
94
  /**
94
95
  * Don't add any more default exports here - it may cause some import issues in other packages
95
96
  * Let's stick to named imports
@@ -0,0 +1,38 @@
1
+ type WorkOrderArgs = {
2
+ workOrderId: string;
3
+ panelKey?: string;
4
+ keepLastNavigationItem?: boolean;
5
+ allowToggle?: boolean;
6
+ };
7
+ /**
8
+ * Custom React hook that provides a function to open a work order's details in a left panel.
9
+ *
10
+ * This hook manages the navigation state for work order details, ensuring that the correct panel is opened
11
+ * and populated with the appropriate content. If the work order is already open in the specified panel,
12
+ * it will close the panel instead.
13
+ *
14
+ * @returns {(args: WorkOrderArgs) => void} A callback function to open a work order's details panel.
15
+ * - `args.workOrderId` (string): The unique identifier of the work order to open.
16
+ * - `args.panelKey` (string, optional): The key of the panel to open the work order in. Defaults to `ECHO_CORE_SEARCH` if not provided.
17
+ * - `args.keepLastNavigationItem` (boolean, optional): Whether to keep the last navigation item in the panel.
18
+ * - `args.allowToggle` (boolean, optional): Whether toggling the panel is allowed.
19
+ *
20
+ * @example
21
+ * const openWorkOrder = useOpenWorkOrderDetails();
22
+ * openWorkOrder({ workOrderId: '123', panelKey: 'workOrderPanel' });
23
+ */
24
+ export declare function useOpenWorkOrderDetails(): OpenWorkOrderFn;
25
+ /**
26
+ * Opens a work order in the left panel navigation.
27
+ *
28
+ * If the specified work order is already open in the given panel, it will close the active panel.
29
+ * Otherwise, it sets the specified panel as active and adds the work order content to the left panel.
30
+ *
31
+ * @param args - The arguments required to open the work order.
32
+ * @param args.workOrderId - The unique identifier of the work order to open.
33
+ * @param args.panelKey - (Optional) The key of the panel to open the work order in. Defaults to `ECHO_CORE_SEARCH` if not provided.
34
+ * @param args.keepLastNavigationItem - (Optional) Whether to keep the last navigation item in the panel.
35
+ * @param args.allowToggle - (Optional) Whether toggling the panel is allowed.
36
+ */
37
+ export type OpenWorkOrderFn = (args: WorkOrderArgs) => void;
38
+ export {};
@@ -1,3 +1,4 @@
1
+ import { WritableDraft } from 'immer';
1
2
  export interface PanelUserSettings {
2
3
  isTagsVisible: boolean;
3
4
  isTagsFromDocumentVisible: boolean;
@@ -30,7 +31,7 @@ interface DataLayerPanelActions {
30
31
  toggleIocAnnotations: () => void;
31
32
  setIsDataFromStidAnnoDetails: (value: boolean) => void;
32
33
  }
33
- type DataLayerPanelStore = DataLayerPanelState & DataLayerPanelActions;
34
+ export type DataLayerPanelStore = DataLayerPanelState & DataLayerPanelActions;
34
35
  export declare const useDataLayerPanelStore: import("zustand").UseBoundStore<Omit<Omit<Omit<import("zustand").StoreApi<DataLayerPanelStore>, "setState"> & {
35
36
  setState<A extends string | {
36
37
  type: string;
@@ -77,4 +78,5 @@ export declare const useDataLayerPanelStore: import("zustand").UseBoundStore<Omi
77
78
  } | undefined): void;
78
79
  }>;
79
80
  export declare function dataLayerStoreSnapshot(): DataLayerPanelStore;
81
+ export declare const toggleLayerAndDisableAllOthers: (current: WritableDraft<DataLayerPanelStore>, layerToToggle: keyof PanelUserSettings) => void;
80
82
  export {};