@equinor/echo-framework 2.2.2 → 2.2.3
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/index.cjs.js +1 -1
- package/package.json +6 -6
- package/src/index.d.ts +3 -2
- package/src/lib/feature/legend/components/BasicLegendRenderer.d.ts +0 -1
- package/src/lib/feature/legend/components/LegendRendererWrapper.d.ts +6 -0
- package/src/lib/feature/legend/components/basicLegendRenderer.logic.d.ts +2 -2
- package/src/lib/feature/legend/components/pdfMarkers/subComponents/LegendMarkersRenderer.d.ts +2 -0
- package/src/lib/feature/legend/components/pdfMarkers/subComponents/MultipleMarkersByLegends.d.ts +1 -1
- package/src/lib/feature/legend/components/pdfMarkers/subComponents/hooks/usePopoverHandler.d.ts +1 -1
- package/src/lib/feature/legend/components/pdfMarkers/subComponents/hooks/usePopoverHandler.types.d.ts +2 -2
- package/src/lib/feature/legend/components/popover/LegendPopoverContent.logic.d.ts +3 -2
- package/src/lib/feature/legend/components/selectionLegend/{useAllGroupedMarkersForLegends.d.ts → hooks/useAllGroupedMarkersForLegends.d.ts} +2 -1
- package/src/lib/feature/legend/hooks/useGroupedMarkers.d.ts +2 -2
- package/src/lib/feature/legend/hooks/useLegendMarker/useLegendMarker.d.ts +1 -0
- package/src/lib/feature/legend/index.d.ts +4 -2
- package/src/lib/feature/legend/legendFacade.d.ts +44 -35
- package/src/lib/feature/legend/legendStrategies/workOrderStrategy/WorkOrderLegend.d.ts +1 -1
- package/src/lib/feature/legend/stores/initializeLegendInStores.d.ts +2 -0
- package/src/lib/feature/legend/{legendStore.d.ts → stores/legendDataStore/legendStore.d.ts} +48 -13
- package/src/lib/feature/legend/stores/legendUIStore/legendUIStore.d.ts +32 -0
- package/src/lib/feature/legend/stores/legendUIStore/legendUIStore.types.d.ts +25 -0
- package/src/lib/feature/legend/{legendVisibleDataAsTagsStore.logic.d.ts → stores/legendVisibleDataAsTagsStore/legendVisibleDataAsTagsStore.logic.d.ts} +1 -1
- package/src/lib/feature/legend/{legendVisibleDataStore.d.ts → stores/legendVisibleDataStore/legendVisibleDataStore.d.ts} +1 -1
- package/src/lib/feature/legend/types/legendType.d.ts +7 -13
- /package/src/lib/feature/legend/{legendVisibleDataAsTagsStore.d.ts → stores/legendVisibleDataAsTagsStore/legendVisibleDataAsTagsStore.d.ts} +0 -0
- /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.
|
|
3
|
+
"version": "2.2.3",
|
|
4
4
|
"peerDependencies": {
|
|
5
|
-
"@equinor/echo-base": ">= 2.2.
|
|
6
|
-
"@equinor/echo-components": ">= 2.2.
|
|
7
|
-
"@equinor/echo-core": ">= 2.2.
|
|
8
|
-
"@equinor/echo-search": ">= 2.2.
|
|
9
|
-
"@equinor/echo-utils": ">= 2.2.
|
|
5
|
+
"@equinor/echo-base": ">= 2.2.3 < 3.0.0",
|
|
6
|
+
"@equinor/echo-components": ">= 2.2.3 < 3.0.0",
|
|
7
|
+
"@equinor/echo-core": ">= 2.2.3 < 3.0.0",
|
|
8
|
+
"@equinor/echo-search": ">= 2.2.3 < 3.0.0",
|
|
9
|
+
"@equinor/echo-utils": ">= 2.2.3 < 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
|
|
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';
|
|
@@ -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[];
|
package/src/lib/feature/legend/components/pdfMarkers/subComponents/LegendMarkersRenderer.d.ts
CHANGED
|
@@ -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>;
|
package/src/lib/feature/legend/components/pdfMarkers/subComponents/MultipleMarkersByLegends.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ interface MultipleMarkersByLegendsProps {
|
|
|
6
6
|
onOpenPopover: RequestPopoverHandler;
|
|
7
7
|
onClosePopover: () => void;
|
|
8
8
|
currentPopover?: PopoverContent;
|
|
9
|
-
|
|
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 {};
|
package/src/lib/feature/legend/components/pdfMarkers/subComponents/hooks/usePopoverHandler.d.ts
CHANGED
|
@@ -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,
|
|
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,
|
|
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
|
-
|
|
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,
|
|
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,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("
|
|
5
|
+
export declare const useAllGroupedMarkersForLegends: () => import("../../pdfMarkers/utils/splitMarkerByBadgeSelectionGroup.types").GroupedMarker[] | undefined;
|
|
@@ -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
|
|
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
|
-
|
|
15
|
+
hiddenMarkers?: string[];
|
|
16
16
|
}) => GroupedMarker[] | undefined;
|
|
@@ -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 {
|
|
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
|
-
|
|
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
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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
|
-
|
|
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;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PersistOptions } from 'zustand/middleware';
|
|
2
|
-
import { LegendId, LegendState } from '
|
|
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'
|
|
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
|
-
|
|
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,32 @@
|
|
|
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;
|
|
@@ -0,0 +1,25 @@
|
|
|
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 LegendUIStoreValues = {
|
|
9
|
+
legends: LegendUIDictionary;
|
|
10
|
+
};
|
|
11
|
+
export interface LegendUIStoreActions {
|
|
12
|
+
toggleAccordion: (legendId: LegendId, newValue: boolean) => void;
|
|
13
|
+
setHiddenMarker: (args: {
|
|
14
|
+
legendId: LegendId;
|
|
15
|
+
marker: string;
|
|
16
|
+
isHidden: boolean;
|
|
17
|
+
}) => void;
|
|
18
|
+
setHiddenBadge: (args: {
|
|
19
|
+
legendId: LegendId;
|
|
20
|
+
badge: string;
|
|
21
|
+
isHidden: boolean;
|
|
22
|
+
}) => void;
|
|
23
|
+
initializeLegendInStore: (legendId: LegendId) => void;
|
|
24
|
+
}
|
|
25
|
+
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 '
|
|
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
|
|
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
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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 {};
|
|
File without changes
|