@equinor/echo-framework 2.2.2 → 2.3.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 (38) hide show
  1. package/README.md +23 -3
  2. package/index.cjs.js +3 -3
  3. package/package.json +6 -6
  4. package/src/index.d.ts +4 -2
  5. package/src/lib/feature/globalSelection/hooks/useGlobalSelectionItemsByTypeAsMap.d.ts +7 -0
  6. package/src/lib/feature/globalSelection/index.d.ts +1 -0
  7. package/src/lib/feature/legend/components/BasicLegendRenderer.d.ts +0 -1
  8. package/src/lib/feature/legend/components/LegendRendererWrapper.d.ts +6 -0
  9. package/src/lib/feature/legend/components/basicLegendRenderer.logic.d.ts +2 -2
  10. package/src/lib/feature/legend/components/legendTextSelector/LegendTextSelector.d.ts +5 -6
  11. package/src/lib/feature/legend/components/pdfMarkers/subComponents/LegendColoredMarkerIcon.d.ts +2 -2
  12. package/src/lib/feature/legend/components/pdfMarkers/subComponents/LegendMarkersRenderer.d.ts +2 -0
  13. package/src/lib/feature/legend/components/pdfMarkers/subComponents/MultipleMarkersByLegends.d.ts +1 -1
  14. package/src/lib/feature/legend/components/pdfMarkers/subComponents/hooks/usePopoverHandler.d.ts +1 -1
  15. package/src/lib/feature/legend/components/pdfMarkers/subComponents/hooks/usePopoverHandler.types.d.ts +2 -2
  16. package/src/lib/feature/legend/components/popover/LegendPopoverContent.logic.d.ts +3 -2
  17. package/src/lib/feature/legend/components/selectionLegend/SelectionLegend.d.ts +1 -1
  18. package/src/lib/feature/legend/components/selectionLegend/components/SelectionLegendActions.d.ts +5 -0
  19. package/src/lib/feature/legend/components/selectionLegend/components/SelectionLegendOtherMarkers.d.ts +4 -0
  20. package/src/lib/feature/legend/components/selectionLegend/{useAllGroupedMarkersForLegends.d.ts → hooks/useAllGroupedMarkersForLegends.d.ts} +2 -1
  21. package/src/lib/feature/legend/components/selectionLegend/selectionLegend.utils.d.ts +9 -1
  22. package/src/lib/feature/legend/hooks/useGroupedMarkers.d.ts +2 -2
  23. package/src/lib/feature/legend/hooks/useLegendMarker/useLegendMarker.d.ts +1 -0
  24. package/src/lib/feature/legend/index.d.ts +4 -2
  25. package/src/lib/feature/legend/legendFacade.d.ts +44 -35
  26. package/src/lib/feature/legend/legendStrategies/workOrderStrategy/WorkOrderLegend.d.ts +1 -1
  27. package/src/lib/feature/legend/stores/initializeLegendInStores.d.ts +2 -0
  28. package/src/lib/feature/legend/{legendStore.d.ts → stores/legendDataStore/legendStore.d.ts} +48 -13
  29. package/src/lib/feature/legend/stores/legendUIStore/legendUIStore.d.ts +38 -0
  30. package/src/lib/feature/legend/stores/legendUIStore/legendUIStore.types.d.ts +32 -0
  31. package/src/lib/feature/legend/{legendVisibleDataAsTagsStore.logic.d.ts → stores/legendVisibleDataAsTagsStore/legendVisibleDataAsTagsStore.logic.d.ts} +1 -1
  32. package/src/lib/feature/legend/{legendVisibleDataStore.d.ts → stores/legendVisibleDataStore/legendVisibleDataStore.d.ts} +1 -1
  33. package/src/lib/feature/legend/types/legendType.d.ts +7 -13
  34. package/src/lib/services/dataLayerPanel/dataLayerPanel.store.d.ts +24 -19
  35. package/src/types/procosysProject.d.ts +20 -0
  36. package/src/lib/feature/legend/components/selectionLegend/hooks/useIsSelectionLegendVisible.d.ts +0 -6
  37. /package/src/lib/feature/legend/{legendVisibleDataAsTagsStore.d.ts → stores/legendVisibleDataAsTagsStore/legendVisibleDataAsTagsStore.d.ts} +0 -0
  38. /package/src/lib/feature/legend/{legendVisibleDataAsTagsStore.type.d.ts → stores/legendVisibleDataAsTagsStore/legendVisibleDataAsTagsStore.type.d.ts} +0 -0
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@equinor/echo-framework",
3
- "version": "2.2.2",
3
+ "version": "2.3.0",
4
4
  "peerDependencies": {
5
- "@equinor/echo-base": ">= 2.2.1 < 3.0.0",
6
- "@equinor/echo-components": ">= 2.2.2 < 3.0.0",
7
- "@equinor/echo-core": ">= 2.2.1 < 3.0.0",
8
- "@equinor/echo-search": ">= 2.2.2 < 3.0.0",
9
- "@equinor/echo-utils": ">= 2.2.2 < 3.0.0",
5
+ "@equinor/echo-base": ">= 2.3.0 < 3.0.0",
6
+ "@equinor/echo-components": ">= 2.3.0 < 3.0.0",
7
+ "@equinor/echo-core": ">= 2.3.0 < 3.0.0",
8
+ "@equinor/echo-search": ">= 2.3.0 < 3.0.0",
9
+ "@equinor/echo-utils": ">= 2.3.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
@@ -26,7 +26,8 @@ export * from './lib/feature/legacyLegend/index';
26
26
  export { PositionalLegendMarkers } from './lib/feature/legend/components/pdfMarkers/PositionalLegendMarkers';
27
27
  export { PopoverLoading } from './lib/feature/legend/components/pdfMarkers/subComponents/components/PopoverLoading';
28
28
  export * from './lib/feature/legend/index';
29
- export { legendVisibleTagsSubscribeToStore } from './lib/feature/legend/legendVisibleDataAsTagsStore';
29
+ export { legendVisibleTagsSubscribeToStore } from './lib/feature/legend/stores/legendVisibleDataAsTagsStore/legendVisibleDataAsTagsStore';
30
+ export { knownLegendIds } from './lib/feature/legend/types/legendType';
30
31
  export type { LegendDataId, LegendEquipmentId, LegendState, LegendTagId } from './lib/feature/legend/types/legendType';
31
32
  export { getLatestMeasurementDate, sortMeasuringPointsByMeasurementDate } from './lib/feature/measuringPoint/components/measuringPoints.utils';
32
33
  export * from './lib/feature/measuringPoint/index';
@@ -50,7 +51,7 @@ export { RegisteredComponentName } from './lib/services/componentRegistry/compon
50
51
  export * from './lib/services/dataLayerPanel';
51
52
  export { EchoViewInspectionToolMode } from './lib/services/echoViewService/echoView.type';
52
53
  export type { EchoView, EchoViewEcmPdfInspectionToolConfig, EchoViewSyncSettings } from './lib/services/echoViewService/echoView.type';
53
- export { echoViewService, echoViewServiceAPI, setEchoView, clearEchoView } from './lib/services/echoViewService/echoViewService';
54
+ export { clearEchoView, echoViewService, echoViewServiceAPI, setEchoView } from './lib/services/echoViewService/echoViewService';
54
55
  export * from './lib/services/eventHubActions';
55
56
  export * from './lib/services/leftPanelNavigation';
56
57
  export * from './lib/services/locationService/locationService';
@@ -76,6 +77,7 @@ export { getPdmsPlantCodeForTag } from './lib/utils/getPdmsPlantCodeForTag';
76
77
  export { isImage, isVideo } from './lib/utils/mediaTypeUtils';
77
78
  export { convertPathNameToReadableString } from './lib/utils/moduleNameUtils';
78
79
  export * from './lib/utils/startup';
80
+ export type { ProcosysProject } from './types/procosysProject';
79
81
  export declare const registerEchopediaComponent: ({ name, component }: {
80
82
  name: import("./lib/services/componentRegistry/componentRegistry").RegisteredComponentName;
81
83
  component: import("react").FunctionComponent<any>;
@@ -0,0 +1,7 @@
1
+ import { GlobalSelectionItemType, GlobalSelectionObject } from '../globalSelectionStore/globalSelectionStore.types';
2
+ /**
3
+ *
4
+ * @param {GlobalSelectionItemType} itemType
5
+ * @returns Map of given item types stored in global selection.
6
+ */
7
+ export declare function useGlobalSelectionItemsByTypeAsMap<T extends GlobalSelectionItemType>(itemType: T): GlobalSelectionObject[T];
@@ -5,6 +5,7 @@ export { useAreAllItemsVisible } from './hooks/useAreAllItemsVisible';
5
5
  export { useGlobalSelectionByItemId } from './hooks/useGlobalSelectionByItemId';
6
6
  export { useGlobalSelectionItems } from './hooks/useGlobalSelectionItems';
7
7
  export { useGlobalSelectionItemsByType } from './hooks/useGlobalSelectionItemsByType';
8
+ export { useGlobalSelectionItemsByTypeAsMap } from './hooks/useGlobalSelectionItemsByTypeAsMap';
8
9
  export { useGlobalSelectionLists } from './hooks/useGlobalSelectionLists';
9
10
  export { useGlobalSelectionTags } from './hooks/useGlobalSelectionTags';
10
11
  export { useGlobalSelectionWorkOrders } from './hooks/useGlobalSelectionWorkOrders';
@@ -1,7 +1,6 @@
1
1
  import { LegendId } from '../types/legendType';
2
2
  interface LegendSelectorMenuProps {
3
3
  legendId: LegendId;
4
- isExpanded?: boolean;
5
4
  }
6
5
  export declare const BasicLegendRenderer: import("react").NamedExoticComponent<LegendSelectorMenuProps>;
7
6
  export {};
@@ -0,0 +1,6 @@
1
+ import { LegendId } from '../types/legendType';
2
+ interface LegendWrapperProps {
3
+ legendId: LegendId;
4
+ }
5
+ export declare const LegendRendererWrapper: (props: LegendWrapperProps) => import("react/jsx-runtime").JSX.Element | null;
6
+ export {};
@@ -1,5 +1,5 @@
1
1
  import { LegendChipProps } from '@equinor/echo-components';
2
2
  import { Badge, Marker } from '../types/legendMarkerBadge.type';
3
3
  import { LegendState } from '../types/legendType';
4
- export declare const getMarkerChips: (markers: ReadonlyArray<Marker>, legend: LegendState) => LegendChipProps[];
5
- export declare const getBadgeChips: (badges: ReadonlyArray<Badge>, legend: LegendState) => LegendChipProps[];
4
+ export declare const getMarkerChips: (markers: ReadonlyArray<Marker>, legend: LegendState, hiddenMarkers: string[]) => LegendChipProps[];
5
+ export declare const getBadgeChips: (badges: ReadonlyArray<Badge>, legend: LegendState, hiddenBadges: string[]) => LegendChipProps[];
@@ -1,8 +1,7 @@
1
- import React from 'react';
2
- interface LegendTextSelectorProps {
3
- options: ReadonlyArray<string>;
4
- selectedOption: string;
5
- onOptionSelected?: (option: string) => void;
1
+ interface LegendTextSelectorProps<T extends string> {
2
+ options: ReadonlyArray<T>;
3
+ selectedOption: T;
4
+ onOptionSelected?: (option: T, e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
6
5
  }
7
6
  /**
8
7
  * LegendTextSelector renders a group of selectable buttons for legend text options.
@@ -17,5 +16,5 @@ interface LegendTextSelectorProps {
17
16
  * @param {(option: string) => void} [props.onOptionSelected] - Callback invoked when a new option is selected.
18
17
  * @returns {JSX.Element | null} The rendered button group, or null if no options are provided.
19
18
  */
20
- export declare const LegendTextSelector: React.FC<LegendTextSelectorProps>;
19
+ export declare const LegendTextSelector: <T extends string>(props: LegendTextSelectorProps<T>) => import("react/jsx-runtime").JSX.Element | null;
21
20
  export {};
@@ -1,12 +1,12 @@
1
1
  import { ItemMarkerSize } from '@equinor/echo-components';
2
2
  import React from 'react';
3
- import { Marker } from '../../../types/legendMarkerBadge.type';
3
+ import { GroupedMarker } from '../utils/splitMarkerByBadgeSelectionGroup.types';
4
4
  interface LegendColoredMarkerIconProps {
5
5
  hasPointer: boolean;
6
6
  isActive: boolean;
7
7
  onClick: () => void;
8
8
  hiddenBadges: string[];
9
- marker: Marker;
9
+ marker: GroupedMarker;
10
10
  }
11
11
  /**
12
12
  * Renders a colored marker icon with optional pointer and badges.
@@ -4,6 +4,8 @@ interface LegendPositionItem {
4
4
  itemId: LegendDataId;
5
5
  positionString: string;
6
6
  hasPointer: boolean;
7
+ /** Unique identifier that doesn't change on viewport changes */
8
+ uniqueIdentifier: string;
7
9
  }
8
10
  interface LegendMarkersRendererProps {
9
11
  positionItems: ReadonlyArray<LegendPositionItem>;
@@ -6,7 +6,7 @@ interface MultipleMarkersByLegendsProps {
6
6
  onOpenPopover: RequestPopoverHandler;
7
7
  onClosePopover: () => void;
8
8
  currentPopover?: PopoverContent;
9
- positionString: string;
9
+ uniqueIdentifier: string;
10
10
  }
11
11
  export declare const MultipleMarkersByLegends: import("react").MemoExoticComponent<(props: MultipleMarkersByLegendsProps) => import("react/jsx-runtime").JSX.Element>;
12
12
  export {};
@@ -2,6 +2,6 @@ import { LegendDataId, LegendId } from '../../../../types/legendType';
2
2
  import { PopoverContent } from './usePopoverHandler.types';
3
3
  export declare function usePopoverHandler(): {
4
4
  currentPopover: PopoverContent | undefined;
5
- handleOpenPopover: (itemId: LegendDataId, legendId: LegendId, positionString: string, fetchPopoverContent: () => Promise<ReadonlyArray<React.JSX.Element>>) => Promise<void>;
5
+ handleOpenPopover: (itemId: LegendDataId, legendId: LegendId, uniqueIdentifier: string, fetchPopoverContent: () => Promise<ReadonlyArray<React.JSX.Element>>) => Promise<void>;
6
6
  handleClosePopover: () => void;
7
7
  };
@@ -1,5 +1,5 @@
1
1
  import { LegendDataId, LegendId } from '../../../../types/legendType';
2
- export type RequestPopoverHandler = (itemId: LegendDataId, legendId: LegendId, positionString: string, fetchPopoverContent: () => Promise<ReadonlyArray<React.JSX.Element>>) => void;
2
+ export type RequestPopoverHandler = (itemId: LegendDataId, legendId: LegendId, uniqueIdentifier: string, fetchPopoverContent: () => Promise<ReadonlyArray<React.JSX.Element>>) => void;
3
3
  export interface PopoverContent {
4
4
  elements: ReadonlyArray<JSX.Element>;
5
5
  activeItem: ActiveItem;
@@ -10,5 +10,5 @@ export interface PopoverContent {
10
10
  export interface ActiveItem {
11
11
  itemId: LegendDataId;
12
12
  legendId: LegendId;
13
- positionString: string;
13
+ uniqueIdentifier: string;
14
14
  }
@@ -13,8 +13,9 @@ import { Marker } from './../../types/legendMarkerBadge.type';
13
13
  * @param {ReadonlyArray<string>} [params.excludedLegendTitles] - Optional array of titles to exclude from the chips (case-insensitive).
14
14
  * @returns {LegendChipProps[]} The filtered and mapped array of LegendChipProps for rendering.
15
15
  */
16
- export declare function getLegendChipsFromMarkers({ markers, legend, excludedLegendTitles }: {
16
+ export declare function getLegendChipsFromMarkers({ markers, legendSelectedBadgeOption, legendSelectedMarkerOption, excludedLegendTitles }: {
17
17
  markers: ReadonlyArray<Marker>;
18
- legend: LegendState;
19
18
  excludedLegendTitles?: ReadonlyArray<string>;
19
+ legendSelectedBadgeOption?: LegendState['selectedBadgeOption'];
20
+ legendSelectedMarkerOption?: LegendState['selectedMarkerOption'];
20
21
  }): LegendChipProps[];
@@ -1 +1 @@
1
- export declare const SelectionLegendRenderer: import("react").MemoExoticComponent<() => import("react/jsx-runtime").JSX.Element>;
1
+ export declare const SelectionLegendRenderer: import("react").MemoExoticComponent<() => import("react/jsx-runtime").JSX.Element | null>;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * SelectionLegendActions renders the action buttons for the Selection Legend.
3
+ * It provides options to toggle the visibility of highlights around selection group markers.
4
+ */
5
+ export declare const SelectionLegendActions: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Allows the user to select how to display markers that are not in any selection group.
3
+ */
4
+ export declare const SelectionLegendOtherMarkers: () => import("react/jsx-runtime").JSX.Element;
@@ -1,4 +1,5 @@
1
1
  /**
2
2
  * Returns all markers for all legends with grouping. Hidden markers are included.
3
+ * Only markers from enabled legends are returned.
3
4
  */
4
- export declare const useAllGroupedMarkersForLegends: () => import("../pdfMarkers/utils/splitMarkerByBadgeSelectionGroup.types").GroupedMarker[] | undefined;
5
+ export declare const useAllGroupedMarkersForLegends: () => import("../../pdfMarkers/utils/splitMarkerByBadgeSelectionGroup.types").GroupedMarker[] | undefined;
@@ -1,6 +1,6 @@
1
1
  import { Guid } from '@equinor/echo-utils';
2
2
  import { GlobalSelectionTypes, SelectionGroup } from '../../../globalSelection';
3
- import { GroupKey } from '../pdfMarkers/utils/splitMarkerByBadgeSelectionGroup.types';
3
+ import { GroupedMarker, GroupKey } from '../pdfMarkers/utils/splitMarkerByBadgeSelectionGroup.types';
4
4
  /**
5
5
  * TODO: Remove this flag when Selection Legend is stable and ready for production
6
6
  * Flag to enable/disable Selection Legend feature
@@ -32,3 +32,11 @@ export declare const getSelectionGroupMostUsedColor: (selectionGroup: SelectionG
32
32
  * @returns The standardized group key
33
33
  */
34
34
  export declare const createSelectionGroupKey: (groupId: Guid, color: string) => GroupKey;
35
+ /**
36
+ * Checks if a marker belongs to the "Not in Selection" group.
37
+ *
38
+ * @param marker - The marker to check.
39
+ *
40
+ * @returns True if the marker is in the "Not in Selection" group, false otherwise.
41
+ */
42
+ export declare const isMarkerOutsideSelection: (marker: GroupedMarker) => boolean;
@@ -6,11 +6,11 @@ import { LegendId } from '../types/legendType';
6
6
  * This also adds additional logic for counting badges where this is needed.
7
7
  * @param legendId
8
8
  * @param markers
9
- * @param includeHiddenMarkers If enabled hidden markers will also be returned
9
+ * @param hiddenMarkers If included hidden markers will be filtered out
10
10
  * @returns
11
11
  */
12
12
  export declare const useGroupedMarkers: (args: {
13
13
  legendId: LegendId;
14
14
  markers: Marker[];
15
- includeHiddenMarkers: boolean;
15
+ hiddenMarkers?: string[];
16
16
  }) => GroupedMarker[] | undefined;
@@ -3,6 +3,7 @@ import { LegendDataId, LegendId } from '../../types/legendType';
3
3
  export interface UseLegendMarkerProps {
4
4
  legendId: LegendId;
5
5
  itemIds: LegendDataId[];
6
+ hiddenMarkers: string[];
6
7
  }
7
8
  /**
8
9
  * Returns the visible markers for the given legendId and itemId.
@@ -7,12 +7,14 @@ export { MultipleMarkersByLegends } from './components/pdfMarkers/subComponents/
7
7
  export { LegendPopoverContent } from './components/popover/LegendPopoverContent';
8
8
  export type { LegendPopoverContentProps, LegendPopoverTertiaryLabels } from './components/popover/LegendPopoverContent';
9
9
  export { legendFacade } from './legendFacade';
10
- export { legendSnapShot } from './legendStore';
11
10
  export { getLegendStrategy } from './legendStrategies/legendCollections';
11
+ export { legendSnapShot } from './stores/legendDataStore/legendStore';
12
12
  export type { Badge, Marker } from './types/legendMarkerBadge.type';
13
13
  export type { LegendStrategy } from './types/legendStrategy.type';
14
14
  export type { LegendId, LegendOptionConfig } from './types/legendType';
15
- export { useLegendVisibleDataStore } from './../legend/legendVisibleDataStore';
16
15
  export { useLegendUniqueBadges } from './hooks/useLegendUniqueBadges';
17
16
  export { useLegendUniqueMarkers } from './hooks/useLegendUniqueMarkers';
18
17
  export { COUNT_MODE_KEYWORD } from './logic/normalizeBadges';
18
+ export { useLegendVisibleDataStore } from './stores/legendVisibleDataStore/legendVisibleDataStore';
19
+ export { isWorkOrderLegendFeatureEnabled } from './legendStrategies/workOrderStrategy/WorkOrderLegend';
20
+ export { useLegendUIStore } from './stores/legendUIStore/legendUIStore';
@@ -1,8 +1,9 @@
1
- import { legendSnapShot, useAllLegends, useLegendById } from './legendStore';
2
1
  import { getLegendStrategy, injectLegendStrategy } from './legendStrategies/legendCollections';
3
- import { visibleDataAsTagsSnapshot } from './legendVisibleDataAsTagsStore';
4
2
  import { isLegendDataIdEqualWithTag } from './logic/isLegendDataIdEqualWithTag';
5
- import { createLegendId } from './types/legendType';
3
+ import { legendExistsInLegendStore, legendSnapShot, useAllLegends, useLegendById } from './stores/legendDataStore/legendStore';
4
+ import { legendExistsInLegendUIStore, useLegendUIById } from './stores/legendUIStore/legendUIStore';
5
+ import { visibleDataAsTagsSnapshot } from './stores/legendVisibleDataAsTagsStore/legendVisibleDataAsTagsStore';
6
+ import { LegendId } from './types/legendType';
6
7
  /**
7
8
  * Public facade for the legend.
8
9
  */
@@ -11,26 +12,41 @@ export declare const legendFacade: Readonly<{
11
12
  inject: typeof injectLegendStrategy;
12
13
  get: typeof getLegendStrategy;
13
14
  };
14
- store: {
15
+ data: {
16
+ useAll: typeof useAllLegends;
17
+ useById: typeof useLegendById;
18
+ exists: typeof legendExistsInLegendStore;
19
+ snapshot: typeof legendSnapShot;
15
20
  subscribe: {
16
- (listener: (selectedState: import("./legendStore").LegendStoreData & import("./legendStore").LegendStoreActions, previousSelectedState: import("./legendStore").LegendStoreData & import("./legendStore").LegendStoreActions) => void): () => void;
17
- <U>(selector: (state: import("./legendStore").LegendStoreData & import("./legendStore").LegendStoreActions) => U, listener: (selectedState: U, previousSelectedState: U) => void, options?: {
21
+ (listener: (selectedState: import("./stores/legendDataStore/legendStore").LegendStoreData & import("./stores/legendDataStore/legendStore").LegendStoreActions, previousSelectedState: import("./stores/legendDataStore/legendStore").LegendStoreData & import("./stores/legendDataStore/legendStore").LegendStoreActions) => void): () => void;
22
+ <U>(selector: (state: import("./stores/legendDataStore/legendStore").LegendStoreData & import("./stores/legendDataStore/legendStore").LegendStoreActions) => U, listener: (selectedState: U, previousSelectedState: U) => void, options?: {
18
23
  equalityFn?: ((a: U, b: U) => boolean) | undefined;
19
24
  fireImmediately?: boolean;
20
25
  } | undefined): () => void;
21
26
  };
22
27
  };
23
- storeSnapshot: typeof legendSnapShot;
24
- legend: {
25
- createId: typeof createLegendId;
26
- knownLegendIds: {
27
- equipmentLegendId: import("./types/legendType").LegendId;
28
- tagLegendId: import("./types/legendType").LegendId;
29
- workOrderLegendId: import("./types/legendType").LegendId;
28
+ ui: {
29
+ useById: typeof useLegendUIById;
30
+ exists: typeof legendExistsInLegendUIStore;
31
+ accordion: {
32
+ toggle: (legendId: LegendId, newValue: boolean) => void;
33
+ };
34
+ markers: {
35
+ setHidden: (params: {
36
+ legendId: LegendId;
37
+ marker: string;
38
+ isHidden: boolean;
39
+ }) => void;
40
+ };
41
+ badges: {
42
+ setHidden: (params: {
43
+ legendId: LegendId;
44
+ badge: string;
45
+ isHidden: boolean;
46
+ }) => void;
30
47
  };
31
- useBy: typeof useLegendById;
32
- useAll: typeof useAllLegends;
33
48
  };
49
+ exists: (legendId: LegendId) => boolean;
34
50
  visibleData: {
35
51
  getBy: <T extends keyof {
36
52
  Tag: import("./types/legendType").LegendTagId;
@@ -60,46 +76,39 @@ export declare const legendFacade: Readonly<{
60
76
  removePreviousItems?: boolean;
61
77
  }) => void;
62
78
  subscribe: {
63
- (listener: (selectedState: import("./legendVisibleDataStore").LegendVisibleDataStore, previousSelectedState: import("./legendVisibleDataStore").LegendVisibleDataStore) => void): () => void;
64
- <U>(selector: (state: import("./legendVisibleDataStore").LegendVisibleDataStore) => U, listener: (selectedState: U, previousSelectedState: U) => void, options?: {
79
+ (listener: (selectedState: import("./stores/legendVisibleDataStore/legendVisibleDataStore").LegendVisibleDataStore, previousSelectedState: import("./stores/legendVisibleDataStore/legendVisibleDataStore").LegendVisibleDataStore) => void): () => void;
80
+ <U>(selector: (state: import("./stores/legendVisibleDataStore/legendVisibleDataStore").LegendVisibleDataStore) => U, listener: (selectedState: U, previousSelectedState: U) => void, options?: {
65
81
  equalityFn?: ((a: U, b: U) => boolean) | undefined;
66
82
  fireImmediately?: boolean;
67
83
  } | undefined): () => void;
68
84
  };
69
85
  };
70
86
  visibleDataAsTags: {
71
- useStore: import("zustand").UseBoundStore<Omit<Omit<Omit<import("zustand").StoreApi<import("./legendVisibleDataAsTagsStore").VisibleDataAsTagsStore>, "setState"> & {
87
+ useStore: import("zustand").UseBoundStore<Omit<Omit<Omit<import("zustand").StoreApi<import("./stores/legendVisibleDataAsTagsStore/legendVisibleDataAsTagsStore").VisibleDataAsTagsStore>, "setState"> & {
72
88
  setState<A extends string | {
73
89
  type: string;
74
- }>(partial: import("./legendVisibleDataAsTagsStore").VisibleDataAsTagsStore | Partial<import("./legendVisibleDataAsTagsStore").VisibleDataAsTagsStore> | ((state: import("./legendVisibleDataAsTagsStore").VisibleDataAsTagsStore) => import("./legendVisibleDataAsTagsStore").VisibleDataAsTagsStore | Partial<import("./legendVisibleDataAsTagsStore").VisibleDataAsTagsStore>), replace?: boolean | undefined, action?: A | undefined): void;
90
+ }>(partial: import("./stores/legendVisibleDataAsTagsStore/legendVisibleDataAsTagsStore").VisibleDataAsTagsStore | Partial<import("./stores/legendVisibleDataAsTagsStore/legendVisibleDataAsTagsStore").VisibleDataAsTagsStore> | ((state: import("./stores/legendVisibleDataAsTagsStore/legendVisibleDataAsTagsStore").VisibleDataAsTagsStore) => import("./stores/legendVisibleDataAsTagsStore/legendVisibleDataAsTagsStore").VisibleDataAsTagsStore | Partial<import("./stores/legendVisibleDataAsTagsStore/legendVisibleDataAsTagsStore").VisibleDataAsTagsStore>), replace?: boolean | undefined, action?: A | undefined): void;
75
91
  }, "subscribe"> & {
76
92
  subscribe: {
77
- (listener: (selectedState: import("./legendVisibleDataAsTagsStore").VisibleDataAsTagsStore, previousSelectedState: import("./legendVisibleDataAsTagsStore").VisibleDataAsTagsStore) => void): () => void;
78
- <U>(selector: (state: import("./legendVisibleDataAsTagsStore").VisibleDataAsTagsStore) => U, listener: (selectedState: U, previousSelectedState: U) => void, options?: {
93
+ (listener: (selectedState: import("./stores/legendVisibleDataAsTagsStore/legendVisibleDataAsTagsStore").VisibleDataAsTagsStore, previousSelectedState: import("./stores/legendVisibleDataAsTagsStore/legendVisibleDataAsTagsStore").VisibleDataAsTagsStore) => void): () => void;
94
+ <U>(selector: (state: import("./stores/legendVisibleDataAsTagsStore/legendVisibleDataAsTagsStore").VisibleDataAsTagsStore) => U, listener: (selectedState: U, previousSelectedState: U) => void, options?: {
79
95
  equalityFn?: ((a: U, b: U) => boolean) | undefined;
80
96
  fireImmediately?: boolean;
81
97
  } | undefined): () => void;
82
98
  };
83
99
  }, "setState"> & {
84
- setState(nextStateOrUpdater: import("./legendVisibleDataAsTagsStore").VisibleDataAsTagsStore | Partial<import("./legendVisibleDataAsTagsStore").VisibleDataAsTagsStore> | ((state: import("immer").WritableDraft<import("./legendVisibleDataAsTagsStore").VisibleDataAsTagsStore>) => void), shouldReplace?: boolean | undefined, action?: string | {
100
+ setState(nextStateOrUpdater: import("./stores/legendVisibleDataAsTagsStore/legendVisibleDataAsTagsStore").VisibleDataAsTagsStore | Partial<import("./stores/legendVisibleDataAsTagsStore/legendVisibleDataAsTagsStore").VisibleDataAsTagsStore> | ((state: import("immer").WritableDraft<import("./stores/legendVisibleDataAsTagsStore/legendVisibleDataAsTagsStore").VisibleDataAsTagsStore>) => void), shouldReplace?: boolean | undefined, action?: string | {
85
101
  type: string;
86
102
  } | undefined): void;
87
103
  }>;
88
- snapShot: typeof visibleDataAsTagsSnapshot;
104
+ snapshot: typeof visibleDataAsTagsSnapshot;
89
105
  };
90
106
  utils: {
91
107
  isLegendDataIdEqualWithTag: typeof isLegendDataIdEqualWithTag;
92
108
  };
109
+ knownLegendIds: {
110
+ equipmentLegendId: LegendId;
111
+ tagLegendId: LegendId;
112
+ workOrderLegendId: LegendId;
113
+ };
93
114
  }>;
94
- /**
95
- <PositionalLegendMarkers
96
- items={visibleItemsWithPosition}
97
- pdfRotation={pdfRotation}
98
- currentPageScale={currentPageScale}
99
- pdfZoom={pdfZoom}
100
- />
101
-
102
- */
103
- export type { LegendStoreActions, LegendStoreData } from './legendStore';
104
- export type { VisibleDataAsTagsStore } from './legendVisibleDataAsTagsStore';
105
- export type { LegendVisibleDataStore } from './legendVisibleDataStore';
@@ -1 +1 @@
1
- export {};
1
+ export declare const isWorkOrderLegendFeatureEnabled: () => boolean;
@@ -0,0 +1,2 @@
1
+ import { LegendId } from '../types/legendType';
2
+ export declare const initializeLegendInStores: (legendId: LegendId) => void;
@@ -1,5 +1,5 @@
1
1
  import { PersistOptions } from 'zustand/middleware';
2
- import { LegendId, LegendState } from './types/legendType';
2
+ import { LegendId, LegendState } from '../../types/legendType';
3
3
  type LegendsDictionary = Record<LegendId, LegendState>;
4
4
  export interface LegendStoreData {
5
5
  legends: LegendsDictionary;
@@ -8,20 +8,11 @@ export interface LegendStoreActions {
8
8
  updateLegend: (legendId: LegendId, updates: Partial<Omit<LegendState, 'isLoading'>>) => void;
9
9
  startLoading: (legendId: LegendId) => void;
10
10
  finishLoading: (legendId: LegendId) => void;
11
- setHiddenMarker: (args: {
12
- legendId: LegendId;
13
- marker: string;
14
- isHidden: boolean;
15
- }) => void;
16
- setHiddenBadge: (args: {
17
- legendId: LegendId;
18
- badge: string;
19
- isHidden: boolean;
20
- }) => void;
21
11
  getLegendById: (legendId: LegendId) => LegendState | undefined;
12
+ initializeLegendInStore: (legendId: LegendId) => void;
22
13
  }
23
14
  type LegendStore = LegendStoreData & LegendStoreActions;
24
- type PersistedLegendState = Omit<LegendState, 'isLoading' | 'hiddenMarkers' | 'hiddenBadges'>;
15
+ type PersistedLegendState = Omit<LegendState, 'isLoading'>;
25
16
  type PersistedLegendStoreData = {
26
17
  legends: Record<LegendId, PersistedLegendState>;
27
18
  };
@@ -52,8 +43,52 @@ export declare const useLegendStore: import("zustand").UseBoundStore<Omit<Omit<O
52
43
  type: string;
53
44
  } | undefined): void;
54
45
  }>;
55
- export declare function useLegendById(legendId: LegendId): LegendState;
46
+ /**
47
+ * Hook to access a legend by ID with optional property selection for optimized re-renders.
48
+ *
49
+ * @param legendId - The ID of the legend to access
50
+ * @param selector - Optional selector function to pick specific properties from the legend
51
+ *
52
+ * @example
53
+ * // Watch all properties (triggers re-render on any change):
54
+ * const legend = useLegendById('Tag Legend');
55
+ *
56
+ * @example
57
+ * // Watch only isEnabled (triggers re-render only when isEnabled changes):
58
+ * const isEnabled = useLegendById('Tag Legend', (legend) => legend?.isEnabled);
59
+ *
60
+ * @example
61
+ * // Watch multiple specific properties:
62
+ * const { isEnabled, isLoading } = useLegendById('Tag Legend', useShallow((legend) => ({
63
+ * isEnabled: legend?.isEnabled,
64
+ * isLoading: legend?.isLoading
65
+ * })));
66
+ */
67
+ export declare function useLegendById(legendId: LegendId): LegendState | undefined;
68
+ export declare function useLegendById<T>(legendId: LegendId, selector: (legend: LegendState | undefined) => T): T;
69
+ export declare function legendExistsInLegendStore(legendId: LegendId): boolean;
70
+ /**
71
+ * Hook to access all legends with optional property selection for optimized re-renders.
72
+ *
73
+ * @param selector - Optional selector function to transform the legends array
74
+ *
75
+ * @example
76
+ * // Watch all properties (triggers re-render on any change):
77
+ * const legends = useAllLegends();
78
+ *
79
+ * @example
80
+ * // Watch only specific properties with useShallow for optimal performance:
81
+ * import { useShallow } from 'zustand/react/shallow';
82
+ * const legendsMinimal = useAllLegends(
83
+ * useShallow((legends) => legends.map(l => ({ legendId: l.legendId, isEnabled: l.isEnabled })))
84
+ * );
85
+ *
86
+ * @example
87
+ * // Get only enabled legends:
88
+ * const enabledLegends = useAllLegends((legends) => legends.filter(l => l.isEnabled));
89
+ */
56
90
  export declare function useAllLegends(): LegendState[];
91
+ export declare function useAllLegends<T>(selector: (legends: LegendState[]) => T): T;
57
92
  export declare function legendSnapShot(): LegendStore;
58
93
  export declare const legendStoreSubscribe: {
59
94
  (listener: (selectedState: LegendStore, previousSelectedState: LegendStore) => void): () => void;
@@ -0,0 +1,38 @@
1
+ import { LegendId } from '../../types/legendType';
2
+ import { LegendUIState, LegendUIStore } from './legendUIStore.types';
3
+ /**
4
+ * Non-persisted store for managing UI state of legends, such as accordion expansion and hidden markers/badges.
5
+ */
6
+ export declare const useLegendUIStore: import("zustand").UseBoundStore<Omit<import("zustand").StoreApi<LegendUIStore>, "setState"> & {
7
+ setState(nextStateOrUpdater: LegendUIStore | Partial<LegendUIStore> | ((state: import("immer").WritableDraft<LegendUIStore>) => void), shouldReplace?: boolean | undefined): void;
8
+ }>;
9
+ /**
10
+ * Hook to access a legend by ID with optional property selection for optimized re-renders.
11
+ *
12
+ * @param legendId - The ID of the legend to access
13
+ * @param selector - Optional selector function to pick specific properties from the legend
14
+ *
15
+ * @example
16
+ * // Watch all properties (triggers re-render on any change):
17
+ * const legend = useLegendUIById('Tag Legend');
18
+ *
19
+ * @example
20
+ * // Watch only isAccordionExpanded (triggers re-render only when isAccordionExpanded changes):
21
+ * const isAccordionExpanded = useLegendUIById('Tag Legend', (legend) => legend?.isAccordionExpanded);
22
+ *
23
+ * @example
24
+ * // Watch multiple specific properties:
25
+ * const { isAccordionExpanded, hiddenMarkers } = useLegendUIById('Tag Legend', useShallow((legend) => ({
26
+ * isAccordionExpanded: legend?.isAccordionExpanded,
27
+ * hiddenMarkers: legend?.hiddenMarkers
28
+ * })));
29
+ */
30
+ export declare function useLegendUIById(legendId: LegendId): LegendUIState | undefined;
31
+ export declare function useLegendUIById<T>(legendId: LegendId, selector: (legend: LegendUIState | undefined) => T): T;
32
+ export declare function legendExistsInLegendUIStore(legendId: LegendId): boolean;
33
+ /**
34
+ * Helper function to toggle visibility of an item in an array.
35
+ * Adds the item if isHidden is true and it's not present, removes it if isHidden is false and it exists.
36
+ * @internal - Exported for testing purposes only
37
+ */
38
+ export declare function toggleItemInArray(array: string[], item: string, isHidden: boolean): void;
@@ -0,0 +1,32 @@
1
+ import { LegendId } from '../../types/legendType';
2
+ export interface LegendUIState {
3
+ readonly isAccordionExpanded: boolean;
4
+ readonly hiddenMarkers: string[];
5
+ readonly hiddenBadges: string[];
6
+ }
7
+ export type LegendUIDictionary = Record<LegendId, LegendUIState>;
8
+ export type MarkersOutsideSelectionVisibility = 'Show' | 'Ghost' | 'Hide';
9
+ export type LegendUIStoreValues = {
10
+ readonly legends: LegendUIDictionary;
11
+ readonly selectionLegend: {
12
+ readonly isHighlightVisible: boolean;
13
+ readonly markersOutsideSelectionVisibility: MarkersOutsideSelectionVisibility;
14
+ };
15
+ };
16
+ export interface LegendUIStoreActions {
17
+ toggleAccordion: (legendId: LegendId, newValue: boolean) => void;
18
+ setHiddenMarker: (args: {
19
+ legendId: LegendId;
20
+ marker: string;
21
+ isHidden: boolean;
22
+ }) => void;
23
+ setHiddenBadge: (args: {
24
+ legendId: LegendId;
25
+ badge: string;
26
+ isHidden: boolean;
27
+ }) => void;
28
+ setMarkersOutsideSelectionVisibility: (visibility: MarkersOutsideSelectionVisibility) => void;
29
+ initializeLegendInStore: (legendId: LegendId) => void;
30
+ setSelectionLegendIsHighlightVisible: (visible: boolean) => void;
31
+ }
32
+ export type LegendUIStore = LegendUIStoreValues & LegendUIStoreActions;
@@ -1,3 +1,3 @@
1
+ import { LegendEquipmentId } from '../../types/legendType';
1
2
  import { TagWithEquipmentId } from './legendVisibleDataAsTagsStore.type';
2
- import { LegendEquipmentId } from './types/legendType';
3
3
  export declare function fetchTagsByEquipment(equipmentIds: ReadonlyArray<LegendEquipmentId>, abortController: AbortController): Promise<TagWithEquipmentId[] | undefined>;
@@ -1,4 +1,4 @@
1
- import { LegendDataId, LegendEquipmentId, LegendTagId } from './types/legendType';
1
+ import { LegendDataId, LegendEquipmentId, LegendTagId } from '../../types/legendType';
2
2
  /**
3
3
  * Maps (string) keyword to the data type.
4
4
  * We don't have any other sources so far, pdf has TagNo and EquipmentId (ecm)
@@ -1,24 +1,19 @@
1
1
  import { Brand } from '@equinor/echo-utils';
2
2
  import { GlobalSelectionTypes } from '../../globalSelection';
3
- type TemporaryLegendIdsForTesting = 'Work Orders with Custom UI';
4
- export type KnownLegendIds = 'Equipment' | 'Tag Legend' | TemporaryLegendIdsForTesting;
3
+ export type KnownLegendIds = 'Equipment Legend' | 'Tag Legend' | 'Work Order Legend';
5
4
  export type LegendId = KnownLegendIds | Brand<string, 'LegendId'>;
6
- export declare function createLegendId(id: string): LegendId;
7
5
  export declare const knownLegendIds: {
8
6
  equipmentLegendId: LegendId;
9
7
  tagLegendId: LegendId;
10
8
  workOrderLegendId: LegendId;
11
9
  };
12
10
  export interface LegendState {
13
- legendId: LegendId;
14
- isEnabled: boolean;
15
- isLoading: boolean;
16
- hiddenMarkers: string[];
17
- hiddenBadges: string[];
18
- selectedMarkerOption: LegendOptionConfig;
19
- selectedBadgeOption: LegendOptionConfig;
20
- selectedBadgeTextOptions: Record<string, string>;
21
- isExpanded: boolean;
11
+ readonly legendId: LegendId;
12
+ readonly isEnabled: boolean;
13
+ readonly isLoading: boolean;
14
+ readonly selectedMarkerOption: LegendOptionConfig;
15
+ readonly selectedBadgeOption: LegendOptionConfig;
16
+ readonly selectedBadgeTextOptions: Record<string, string>;
22
17
  }
23
18
  export type LegendTagId = GlobalSelectionTypes.TagId;
24
19
  export type LegendEquipmentId = GlobalSelectionTypes.EquipmentId;
@@ -36,4 +31,3 @@ export interface LegendOptionConfig<T = string> {
36
31
  displayName: string;
37
32
  showChipsInViewportOnly?: boolean;
38
33
  }
39
- export {};