@equinor/echo-framework 0.21.4-beta-0 → 0.21.4
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 +2 -2
- package/src/index.d.ts +4 -1
- package/src/lib/feature/equipment/types/equipment.d.ts +2 -0
- package/src/lib/feature/globalSelection/components/SelectionActionBar.d.ts +2 -2
- package/src/lib/feature/globalSelection/globalSelection.api.d.ts +8 -19
- package/src/lib/feature/globalSelection/globalSelectionStore/actions/addItemsToSelection.action.d.ts +19 -0
- package/src/lib/feature/globalSelection/globalSelectionStore/globalSelectionNullItems.d.ts +4 -0
- package/src/lib/feature/globalSelection/globalSelectionStore/globalSelectionStore.d.ts +6 -12
- package/src/lib/feature/globalSelection/globalSelectionStore/globalSelectionStore.types.d.ts +24 -47
- package/src/lib/feature/globalSelection/globalSelectionStore/globalSelectionStore.utils.d.ts +2 -2
- package/src/lib/feature/globalSelection/globalSelectionStore/globalSelectionStoreHelpers.d.ts +14 -0
- package/src/lib/feature/globalSelection/hooks/useGlobalSelectionItemsByType.d.ts +7 -0
- package/src/lib/feature/globalSelection/index.d.ts +2 -1
- package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/actions/{addTag.action.d.ts → addTags.action.d.ts} +5 -4
- package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/actions/addWorkOrders.action.d.ts +6 -0
- package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/actions/createAddItemsFactory.d.ts +17 -0
- package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/actions/{addTag.action.types.d.ts → selectionTree.action.types.d.ts} +4 -5
- package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/selectionTree.store.types.d.ts +16 -24
- package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/selectionTree.store.utils.d.ts +3 -3
- package/src/lib/feature/legend/components/BasicLegendRenderer.d.ts +7 -0
- package/src/lib/feature/legend/components/LegendList.d.ts +5 -0
- package/src/lib/feature/legend/components/basicLegendRenderer.logic.d.ts +5 -0
- package/src/lib/feature/legend/components/pdfMarkers/PositionalItem.d.ts +14 -0
- package/src/lib/feature/legend/components/pdfMarkers/PositionalLegendMarkers.d.ts +24 -0
- package/src/lib/feature/legend/components/pdfMarkers/subComponents/LegendColoredMarkerIcon.d.ts +11 -0
- package/src/lib/feature/legend/components/pdfMarkers/subComponents/LegendMarkersRendererWithPopover.d.ts +16 -0
- package/src/lib/feature/legend/components/pdfMarkers/subComponents/MultipleMarkersByLegends.d.ts +39 -0
- package/src/lib/feature/legend/components/pdfMarkers/subComponents/iconPositionTransform.d.ts +18 -0
- package/src/lib/feature/legend/hooks/useLegendMarkers.d.ts +19 -0
- package/src/lib/feature/legend/index.d.ts +8 -0
- package/src/lib/feature/legend/legendFacade.d.ts +52 -0
- package/src/lib/feature/legend/legendStore.d.ts +52 -0
- package/src/lib/feature/legend/legendStrategies/legendCollections.d.ts +4 -0
- package/src/lib/feature/legend/legendStrategies/workOrderStrategy/WorkOrderLegend.d.ts +1 -0
- package/src/lib/feature/legend/legendUpdater.d.ts +2 -0
- package/src/lib/feature/legend/legendVisibleDataStore.d.ts +71 -0
- package/src/lib/feature/legend/types/legendMarkerBadge.type.d.ts +11 -0
- package/src/lib/feature/legend/types/legendStrategy.type.d.ts +37 -0
- package/src/lib/feature/legend/types/legendType.d.ts +26 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { LegendDataId } from '../../../types/legendType';
|
|
3
|
+
interface LegendPositionItem {
|
|
4
|
+
itemId: LegendDataId;
|
|
5
|
+
positionString: string;
|
|
6
|
+
hasPointer: boolean;
|
|
7
|
+
popoverOffset: string;
|
|
8
|
+
}
|
|
9
|
+
interface LegendMarkersRendererWithPopoverProps {
|
|
10
|
+
positionItems: ReadonlyArray<LegendPositionItem>;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Renders all the position items, with markers for each legends. And has 1 popover which is the last active item clicked.
|
|
14
|
+
*/
|
|
15
|
+
export declare const LegendMarkersRendererWithPopover: React.FC<LegendMarkersRendererWithPopoverProps>;
|
|
16
|
+
export {};
|
package/src/lib/feature/legend/components/pdfMarkers/subComponents/MultipleMarkersByLegends.d.ts
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { LegendDataId, LegendId } from '../../../types/legendType';
|
|
3
|
+
interface MultipleMarkersByLegendsProps {
|
|
4
|
+
itemId: LegendDataId;
|
|
5
|
+
/**
|
|
6
|
+
* Flag to indicate if the marker should have a pointer, currently in lower right corner.
|
|
7
|
+
*/
|
|
8
|
+
hasPointer: boolean;
|
|
9
|
+
popoverOffset: string;
|
|
10
|
+
setOpenItem: (value: PopoverContent | undefined) => void;
|
|
11
|
+
/**
|
|
12
|
+
* We use active for the icon. So several icons might be active if they have the same tagNo on the PDF, but only 1 of them is open.
|
|
13
|
+
*/
|
|
14
|
+
activeItem: ActiveItem | undefined;
|
|
15
|
+
}
|
|
16
|
+
export interface PopoverContent {
|
|
17
|
+
elements: ReadonlyArray<JSX.Element>;
|
|
18
|
+
popoverOffset: string;
|
|
19
|
+
activeItem: ActiveItem;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* We use active for the icon. Several icons might be active if they have the same tagNo on the PDF, but only 1 of them is open.
|
|
23
|
+
*/
|
|
24
|
+
interface ActiveItem {
|
|
25
|
+
itemId: LegendDataId;
|
|
26
|
+
legendId: LegendId;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Renders 1 marker for each legend.
|
|
30
|
+
*
|
|
31
|
+
* @param {LegendDataId} itemId - The ID of the legend item.
|
|
32
|
+
* @param {boolean} hasPointer - Flag to indicate if the marker should have a pointer, currently in lower right corner.
|
|
33
|
+
* @param {string} popoverOffset - The offset for the popover.
|
|
34
|
+
* @param {(value: PopoverContent | undefined) => void} setOpenItem - Callback function to handle opening the popover.
|
|
35
|
+
* @param {ActiveItem | undefined} activeItem - We use active for the icon. Several icons might be active if they have the same tagNo on the PDF, but only 1 of them is open.
|
|
36
|
+
*/
|
|
37
|
+
export declare const MultipleMarkersByLegendsComponent: React.FC<MultipleMarkersByLegendsProps>;
|
|
38
|
+
export declare const MultipleMarkersByLegends: React.NamedExoticComponent<MultipleMarkersByLegendsProps>;
|
|
39
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Point } from '@equinor/echo-utils';
|
|
2
|
+
export declare const calculateIconScale: (currentPageScale: number) => number;
|
|
3
|
+
export declare function calculatePopoverStyling(args: {
|
|
4
|
+
pdfZoom: number;
|
|
5
|
+
hasPointer: boolean;
|
|
6
|
+
position: Point;
|
|
7
|
+
pdfRotation: number;
|
|
8
|
+
currentPageScale: number;
|
|
9
|
+
markerHeight: number;
|
|
10
|
+
}): string;
|
|
11
|
+
export declare function iconPositionTransform(args: {
|
|
12
|
+
position: Point;
|
|
13
|
+
pdfRotation: number;
|
|
14
|
+
currentPageScale: number;
|
|
15
|
+
isMobileDevice: boolean;
|
|
16
|
+
pdfZoom: number;
|
|
17
|
+
hasPointer: boolean;
|
|
18
|
+
}): string;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Badge, Marker } from '../types/legendMarkerBadge.type';
|
|
2
|
+
import { LegendDataId, LegendId } from '../types/legendType';
|
|
3
|
+
/**
|
|
4
|
+
* Returns the marker for the given legendId and itemId.
|
|
5
|
+
*/
|
|
6
|
+
export declare function useLegendMarker(args: {
|
|
7
|
+
legendId: LegendId;
|
|
8
|
+
itemId: LegendDataId;
|
|
9
|
+
}): Marker | undefined;
|
|
10
|
+
/**
|
|
11
|
+
* Returns all unique markers for the given legendId, determined by unique markerKey (title + color).
|
|
12
|
+
*/
|
|
13
|
+
export declare function useLegendUniqueMarkers(args: {
|
|
14
|
+
legendId: LegendId;
|
|
15
|
+
}): ReadonlyArray<Marker>;
|
|
16
|
+
/**
|
|
17
|
+
* Returns all unique badges for the given legendId, determined by unique title + color.
|
|
18
|
+
*/
|
|
19
|
+
export declare function useLegendUniqueBadges(legendId: LegendId): ReadonlyArray<Badge>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import './legendStrategies/workOrderStrategy/WorkOrderLegend';
|
|
2
|
+
export { LegendList } from './components/LegendList';
|
|
3
|
+
export { PositionalItem } from './components/pdfMarkers/PositionalItem';
|
|
4
|
+
export { MultipleMarkersByLegends } from './components/pdfMarkers/subComponents/MultipleMarkersByLegends';
|
|
5
|
+
export { legendFacade } from './legendFacade';
|
|
6
|
+
export type { Badge, Marker } from './types/legendMarkerBadge.type';
|
|
7
|
+
export type { LegendStrategy } from './types/legendStrategy.type';
|
|
8
|
+
export type { LegendId } from './types/legendType';
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { legendSnapShot, useAllLegends, useLegendById } from './legendStore';
|
|
2
|
+
import { getLegendStrategy, injectLegendStrategy } from './legendStrategies/legendCollections';
|
|
3
|
+
import { createLegendId } from './types/legendType';
|
|
4
|
+
/**
|
|
5
|
+
* Public facade for the legend.
|
|
6
|
+
*/
|
|
7
|
+
export declare const legendFacade: Readonly<{
|
|
8
|
+
strategy: {
|
|
9
|
+
inject: typeof injectLegendStrategy;
|
|
10
|
+
get: typeof getLegendStrategy;
|
|
11
|
+
};
|
|
12
|
+
storeSnapshot: typeof legendSnapShot;
|
|
13
|
+
legend: {
|
|
14
|
+
createId: typeof createLegendId;
|
|
15
|
+
knownLegendIds: {
|
|
16
|
+
equipmentLegendId: import("./types/legendType").LegendId;
|
|
17
|
+
tagLegendId: import("./types/legendType").LegendId;
|
|
18
|
+
workOrderLegendId: import("./types/legendType").LegendId;
|
|
19
|
+
};
|
|
20
|
+
useBy: typeof useLegendById;
|
|
21
|
+
useAll: typeof useAllLegends;
|
|
22
|
+
};
|
|
23
|
+
visibleData: {
|
|
24
|
+
getBy: <T extends keyof {
|
|
25
|
+
Tag: import("./types/legendType").LegendTagId;
|
|
26
|
+
Equipment: import("./types/legendType").LegendEquipmentId;
|
|
27
|
+
}>(type: T) => {
|
|
28
|
+
Tag: import("./types/legendType").LegendTagId;
|
|
29
|
+
Equipment: import("./types/legendType").LegendEquipmentId;
|
|
30
|
+
}[T][];
|
|
31
|
+
getAll: () => import("./types/legendType").LegendDataId[];
|
|
32
|
+
useByType: <T extends keyof {
|
|
33
|
+
Tag: import("./types/legendType").LegendTagId;
|
|
34
|
+
Equipment: import("./types/legendType").LegendEquipmentId;
|
|
35
|
+
}>(type: T) => {
|
|
36
|
+
Tag: import("./types/legendType").LegendTagId;
|
|
37
|
+
Equipment: import("./types/legendType").LegendEquipmentId;
|
|
38
|
+
}[T][];
|
|
39
|
+
useAddWithAutoRemove: () => <T extends keyof {
|
|
40
|
+
Tag: import("./types/legendType").LegendTagId;
|
|
41
|
+
Equipment: import("./types/legendType").LegendEquipmentId;
|
|
42
|
+
}>(args: {
|
|
43
|
+
type: T;
|
|
44
|
+
key: string;
|
|
45
|
+
items: {
|
|
46
|
+
Tag: import("./types/legendType").LegendTagId;
|
|
47
|
+
Equipment: import("./types/legendType").LegendEquipmentId;
|
|
48
|
+
}[T][];
|
|
49
|
+
removePreviousItems?: boolean;
|
|
50
|
+
}) => void;
|
|
51
|
+
};
|
|
52
|
+
}>;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { PersistOptions } from 'zustand/middleware';
|
|
2
|
+
import { LegendId, LegendState } from './types/legendType';
|
|
3
|
+
type LegendsDictionary = Record<LegendId, LegendState>;
|
|
4
|
+
interface LegendStoreData {
|
|
5
|
+
legends: LegendsDictionary;
|
|
6
|
+
}
|
|
7
|
+
interface LegendStoreActions {
|
|
8
|
+
updateLegend: (legendId: LegendId, updates: Partial<LegendState>) => void;
|
|
9
|
+
setHiddenMarker: (args: {
|
|
10
|
+
legendId: LegendId;
|
|
11
|
+
marker: string;
|
|
12
|
+
isHidden: boolean;
|
|
13
|
+
}) => void;
|
|
14
|
+
setHiddenBadge: (args: {
|
|
15
|
+
legendId: LegendId;
|
|
16
|
+
badge: string;
|
|
17
|
+
isHidden: boolean;
|
|
18
|
+
}) => void;
|
|
19
|
+
getLegendById: (legendId: LegendId) => LegendState | undefined;
|
|
20
|
+
}
|
|
21
|
+
type LegendStore = LegendStoreData & LegendStoreActions;
|
|
22
|
+
export declare const useLegendStore: import("zustand").UseBoundStore<Omit<Omit<Omit<Omit<import("zustand").StoreApi<LegendStore>, "setState"> & {
|
|
23
|
+
setState<A extends string | {
|
|
24
|
+
type: string;
|
|
25
|
+
}>(partial: LegendStore | Partial<LegendStore> | ((state: LegendStore) => LegendStore | Partial<LegendStore>), replace?: boolean | undefined, action?: A | undefined): void;
|
|
26
|
+
}, "subscribe"> & {
|
|
27
|
+
subscribe: {
|
|
28
|
+
(listener: (selectedState: LegendStore, previousSelectedState: LegendStore) => void): () => void;
|
|
29
|
+
<U>(selector: (state: LegendStore) => U, listener: (selectedState: U, previousSelectedState: U) => void, options?: {
|
|
30
|
+
equalityFn?: ((a: U, b: U) => boolean) | undefined;
|
|
31
|
+
fireImmediately?: boolean;
|
|
32
|
+
} | undefined): () => void;
|
|
33
|
+
};
|
|
34
|
+
}, "persist"> & {
|
|
35
|
+
persist: {
|
|
36
|
+
setOptions: (options: Partial<PersistOptions<LegendStore, LegendStore>>) => void;
|
|
37
|
+
clearStorage: () => void;
|
|
38
|
+
rehydrate: () => Promise<void> | void;
|
|
39
|
+
hasHydrated: () => boolean;
|
|
40
|
+
onHydrate: (fn: (state: LegendStore) => void) => () => void;
|
|
41
|
+
onFinishHydration: (fn: (state: LegendStore) => void) => () => void;
|
|
42
|
+
getOptions: () => Partial<PersistOptions<LegendStore, LegendStore>>;
|
|
43
|
+
};
|
|
44
|
+
}, "setState"> & {
|
|
45
|
+
setState(nextStateOrUpdater: LegendStore | Partial<LegendStore> | ((state: import("immer").WritableDraft<LegendStore>) => void), shouldReplace?: boolean | undefined, action?: string | {
|
|
46
|
+
type: string;
|
|
47
|
+
} | undefined): void;
|
|
48
|
+
}>;
|
|
49
|
+
export declare function useLegendById(legendId: LegendId): LegendState;
|
|
50
|
+
export declare function useAllLegends(): LegendState[];
|
|
51
|
+
export declare function legendSnapShot(): LegendStore;
|
|
52
|
+
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { LegendStrategy } from '../types/legendStrategy.type';
|
|
2
|
+
import { LegendState } from '../types/legendType';
|
|
3
|
+
export declare function injectLegendStrategy(strategy: LegendStrategy, properties: Partial<LegendState>): void;
|
|
4
|
+
export declare function getLegendStrategy(strategyTypeName: string): LegendStrategy;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { LegendDataId, LegendEquipmentId, LegendTagId } from './types/legendType';
|
|
2
|
+
/**
|
|
3
|
+
* Maps (string) keyword to the data type.
|
|
4
|
+
* We don't have any other sources so far, pdf has TagNo and EquipmentId (ecm)
|
|
5
|
+
*/
|
|
6
|
+
type KnownDataTypes = {
|
|
7
|
+
Tag: LegendTagId;
|
|
8
|
+
Equipment: LegendEquipmentId;
|
|
9
|
+
};
|
|
10
|
+
type KnownDataTypeKeys = keyof KnownDataTypes;
|
|
11
|
+
type ResolvedDataType<T extends KnownDataTypeKeys> = KnownDataTypes[T];
|
|
12
|
+
/**
|
|
13
|
+
* Data structure:
|
|
14
|
+
* Data
|
|
15
|
+
* - Tag
|
|
16
|
+
* - key1: [data1, data2, ...]
|
|
17
|
+
* - key2: [data1, data2, ...]
|
|
18
|
+
* - Equipment
|
|
19
|
+
* - key1: [data1, data2, ...]
|
|
20
|
+
* ...
|
|
21
|
+
*/
|
|
22
|
+
interface LegendVisibleData {
|
|
23
|
+
data: LegendVisibleDataState;
|
|
24
|
+
}
|
|
25
|
+
type LegendVisibleDataState = {
|
|
26
|
+
[K in KnownDataTypeKeys]: {
|
|
27
|
+
[key: string]: ResolvedDataType<K>[];
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
interface LegendVisibleDataStoreActions {
|
|
31
|
+
addData: <T extends KnownDataTypeKeys>(type: T, key: string, value: ResolvedDataType<T>[]) => void;
|
|
32
|
+
removeData: (key: string) => void;
|
|
33
|
+
getData: <T extends KnownDataTypeKeys>(type: T) => ResolvedDataType<T>[];
|
|
34
|
+
useDataByType: <T extends KnownDataTypeKeys>(type: T) => ResolvedDataType<T>[];
|
|
35
|
+
getAll(): LegendDataId[];
|
|
36
|
+
}
|
|
37
|
+
type LegendVisibleDataStore = LegendVisibleData & LegendVisibleDataStoreActions;
|
|
38
|
+
export declare const useLegendVisibleDataStore: import("zustand").UseBoundStore<Omit<Omit<Omit<import("zustand").StoreApi<LegendVisibleDataStore>, "setState"> & {
|
|
39
|
+
setState<A extends string | {
|
|
40
|
+
type: string;
|
|
41
|
+
}>(partial: LegendVisibleDataStore | Partial<LegendVisibleDataStore> | ((state: LegendVisibleDataStore) => LegendVisibleDataStore | Partial<LegendVisibleDataStore>), replace?: boolean | undefined, action?: A | undefined): void;
|
|
42
|
+
}, "subscribe"> & {
|
|
43
|
+
subscribe: {
|
|
44
|
+
(listener: (selectedState: LegendVisibleDataStore, previousSelectedState: LegendVisibleDataStore) => void): () => void;
|
|
45
|
+
<U>(selector: (state: LegendVisibleDataStore) => U, listener: (selectedState: U, previousSelectedState: U) => void, options?: {
|
|
46
|
+
equalityFn?: ((a: U, b: U) => boolean) | undefined;
|
|
47
|
+
fireImmediately?: boolean;
|
|
48
|
+
} | undefined): () => void;
|
|
49
|
+
};
|
|
50
|
+
}, "setState"> & {
|
|
51
|
+
setState(nextStateOrUpdater: LegendVisibleDataStore | Partial<LegendVisibleDataStore> | ((state: import("immer").WritableDraft<LegendVisibleDataStore>) => void), shouldReplace?: boolean | undefined, action?: string | {
|
|
52
|
+
type: string;
|
|
53
|
+
} | undefined): void;
|
|
54
|
+
}>;
|
|
55
|
+
/**
|
|
56
|
+
* Visible items are all items on screen that should be affected by the legend.
|
|
57
|
+
* @returns A function for adding visible items by type and key, which is automatically removed when the component unmounts.
|
|
58
|
+
*/
|
|
59
|
+
declare function useAddWithAutoRemove(): <T extends KnownDataTypeKeys>(args: {
|
|
60
|
+
type: T;
|
|
61
|
+
key: string;
|
|
62
|
+
items: ResolvedDataType<T>[];
|
|
63
|
+
removePreviousItems?: boolean;
|
|
64
|
+
}) => void;
|
|
65
|
+
export declare const visibleData: {
|
|
66
|
+
getBy: <T extends KnownDataTypeKeys>(type: T) => ResolvedDataType<T>[];
|
|
67
|
+
getAll: () => LegendDataId[];
|
|
68
|
+
useByType: <T extends KnownDataTypeKeys>(type: T) => ResolvedDataType<T>[];
|
|
69
|
+
useAddWithAutoRemove: typeof useAddWithAutoRemove;
|
|
70
|
+
};
|
|
71
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface Marker {
|
|
2
|
+
getTitle: () => string;
|
|
3
|
+
getColor: () => string;
|
|
4
|
+
getIcon: () => string;
|
|
5
|
+
badges: Badge[];
|
|
6
|
+
}
|
|
7
|
+
export declare function markerKey(marker: Marker): string;
|
|
8
|
+
export interface Badge {
|
|
9
|
+
getColor: () => string;
|
|
10
|
+
getTitle: () => string;
|
|
11
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Marker } from './legendMarkerBadge.type';
|
|
2
|
+
import { LegendDataId, LegendId } from './legendType';
|
|
3
|
+
/**
|
|
4
|
+
* A general interface for the legend strategy. This enables us to automatically render all the legend ui parts: the ui with selectable options, the markers & the badges.
|
|
5
|
+
* The specific implementation (like tagStrategy, equipmentStrategy, etc) will implement this, and inject it with legendFacade.injectLegendStrategy.
|
|
6
|
+
*/
|
|
7
|
+
export interface LegendStrategy {
|
|
8
|
+
/**
|
|
9
|
+
* A unique identifier for the legend. Use a friendly UI name since it's displayed in legend component.
|
|
10
|
+
*/
|
|
11
|
+
legendId: LegendId;
|
|
12
|
+
/**
|
|
13
|
+
* not implemented yet TODO #155599 - Data Service
|
|
14
|
+
* Idea is to notify the legend that it should batch fetch data for the given visibleItemIds, and we will automatically show loading status in UI.
|
|
15
|
+
*/
|
|
16
|
+
fetchData?: (visibleItemIds: ReadonlyArray<LegendDataId>) => Promise<void>;
|
|
17
|
+
/**
|
|
18
|
+
* Marker options that is selectable by the user.
|
|
19
|
+
*/
|
|
20
|
+
markerOptions?: ReadonlyArray<string>;
|
|
21
|
+
/**
|
|
22
|
+
* Badge options that is selectable by the user.
|
|
23
|
+
*/
|
|
24
|
+
badgeOptions?: ReadonlyArray<string>;
|
|
25
|
+
/**
|
|
26
|
+
* Returns ONE marker per itemId.
|
|
27
|
+
*/
|
|
28
|
+
useMarkers: (itemIds: ReadonlyArray<LegendDataId>) => ReadonlyArray<Marker>;
|
|
29
|
+
/**
|
|
30
|
+
* Returns the paginable popover content for the given itemId. One tagId can for example have multiple work-orders.
|
|
31
|
+
*/
|
|
32
|
+
popoverContent: (itemId: LegendDataId) => React.JSX.Element | ReadonlyArray<React.JSX.Element>;
|
|
33
|
+
/**
|
|
34
|
+
* Returns the custom legend component for the legend, if this is omitted the default basicLegendRenderer will be used
|
|
35
|
+
*/
|
|
36
|
+
customLegendComponent?: () => React.JSX.Element;
|
|
37
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Brand } from '@equinor/echo-utils';
|
|
2
|
+
import { GlobalSelectionTypes } from '../../globalSelection';
|
|
3
|
+
type TemporaryLegendIdsForTesting = 'Fake Tag Legend' | 'Work Orders with Custom UI';
|
|
4
|
+
export type KnownLegendIds = 'Equipment' | TemporaryLegendIdsForTesting;
|
|
5
|
+
export type LegendId = KnownLegendIds | Brand<string, 'LegendId'>;
|
|
6
|
+
export declare function createLegendId(id: string): LegendId;
|
|
7
|
+
export declare const knownLegendIds: {
|
|
8
|
+
equipmentLegendId: LegendId;
|
|
9
|
+
tagLegendId: LegendId;
|
|
10
|
+
workOrderLegendId: LegendId;
|
|
11
|
+
};
|
|
12
|
+
export interface LegendState {
|
|
13
|
+
legendId: LegendId;
|
|
14
|
+
isEnabled: boolean;
|
|
15
|
+
isLoading: boolean;
|
|
16
|
+
hiddenMarkers: string[];
|
|
17
|
+
hiddenBadges: string[];
|
|
18
|
+
selectedMarkerOption: string;
|
|
19
|
+
selectedBadgeOption: string;
|
|
20
|
+
isExpanded: boolean;
|
|
21
|
+
}
|
|
22
|
+
export type LegendTagId = GlobalSelectionTypes.TagId;
|
|
23
|
+
export type LegendEquipmentId = GlobalSelectionTypes.EquipmentId;
|
|
24
|
+
export type LegendWorkOrderId = GlobalSelectionTypes.WorkOrderId;
|
|
25
|
+
export type LegendDataId = LegendTagId | LegendEquipmentId | LegendWorkOrderId;
|
|
26
|
+
export {};
|