@equinor/echo-framework 0.22.0-beta-0 → 0.22.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 (54) hide show
  1. package/index.cjs.js +14 -1
  2. package/package.json +1 -1
  3. package/src/index.d.ts +4 -2
  4. package/src/lib/coreApplication/EchoContent.d.ts +2 -1
  5. package/src/lib/feature/equipment/types/equipment.d.ts +2 -0
  6. package/src/lib/feature/globalSelection/components/SelectionActionBar.d.ts +2 -2
  7. package/src/lib/feature/globalSelection/globalSelection.api.d.ts +17 -21
  8. package/src/lib/feature/globalSelection/globalSelectionStore/actions/addItemsToSelection.action.d.ts +18 -0
  9. package/src/lib/feature/globalSelection/globalSelectionStore/globalSelectionNullItems.d.ts +4 -0
  10. package/src/lib/feature/globalSelection/globalSelectionStore/globalSelectionStore.d.ts +19 -16
  11. package/src/lib/feature/globalSelection/globalSelectionStore/globalSelectionStore.repository.d.ts +8 -0
  12. package/src/lib/feature/globalSelection/globalSelectionStore/globalSelectionStore.types.d.ts +38 -56
  13. package/src/lib/feature/globalSelection/globalSelectionStore/globalSelectionStore.utils.d.ts +3 -3
  14. package/src/lib/feature/globalSelection/globalSelectionStore/globalSelectionStoreHelpers.d.ts +13 -0
  15. package/src/lib/feature/globalSelection/hooks/useGlobalSelectionByItemId.d.ts +2 -0
  16. package/src/lib/feature/globalSelection/hooks/useGlobalSelectionItemsByType.d.ts +7 -0
  17. package/src/lib/feature/globalSelection/hooks/useGlobalSelectionLists.d.ts +4 -15
  18. package/src/lib/feature/globalSelection/index.d.ts +3 -1
  19. package/src/lib/feature/globalSelection/selectionMenu/hooks/useIsAllIGlobalSelectionItemsHidden.d.ts +2 -2
  20. package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/actions/addTags.action.d.ts +13 -0
  21. package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/actions/addWorkOrders.action.d.ts +6 -0
  22. package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/actions/createAddItemsFactory.d.ts +16 -0
  23. package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/actions/removeAllItemsById.action.d.ts +1 -2
  24. package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/actions/{addTag.action.types.d.ts → selectionTree.action.types.d.ts} +10 -12
  25. package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/selectionTree.store.d.ts +11 -1
  26. package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/selectionTree.store.repository.d.ts +8 -0
  27. package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/selectionTree.store.types.d.ts +32 -29
  28. package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/selectionTree.store.utils.d.ts +4 -5
  29. package/src/lib/feature/legend/components/BasicLegendRenderer.d.ts +7 -0
  30. package/src/lib/feature/legend/components/LegendList.d.ts +5 -0
  31. package/src/lib/feature/legend/components/basicLegendRenderer.logic.d.ts +5 -0
  32. package/src/lib/feature/legend/components/pdfMarkers/PositionalItem.d.ts +14 -0
  33. package/src/lib/feature/legend/components/pdfMarkers/PositionalLegendMarkers.d.ts +24 -0
  34. package/src/lib/feature/legend/components/pdfMarkers/subComponents/LegendColoredMarkerIcon.d.ts +11 -0
  35. package/src/lib/feature/legend/components/pdfMarkers/subComponents/LegendMarkersRendererWithPopover.d.ts +16 -0
  36. package/src/lib/feature/legend/components/pdfMarkers/subComponents/MultipleMarkersByLegends.d.ts +39 -0
  37. package/src/lib/feature/legend/components/pdfMarkers/subComponents/iconPositionTransform.d.ts +18 -0
  38. package/src/lib/feature/legend/hooks/useLegendMarkers.d.ts +19 -0
  39. package/src/lib/feature/legend/index.d.ts +8 -0
  40. package/src/lib/feature/legend/legendFacade.d.ts +52 -0
  41. package/src/lib/feature/legend/legendStore.d.ts +52 -0
  42. package/src/lib/feature/legend/legendStrategies/legendCollections.d.ts +4 -0
  43. package/src/lib/feature/legend/legendStrategies/workOrderStrategy/WorkOrderLegend.d.ts +1 -0
  44. package/src/lib/feature/legend/legendUpdater.d.ts +2 -0
  45. package/src/lib/feature/legend/legendVisibleDataStore.d.ts +71 -0
  46. package/src/lib/feature/legend/logic/hiddenLegendChips.logic.d.ts +6 -0
  47. package/src/lib/feature/legend/types/legendMarkerBadge.type.d.ts +11 -0
  48. package/src/lib/feature/legend/types/legendStrategy.type.d.ts +37 -0
  49. package/src/lib/feature/legend/types/legendType.d.ts +26 -0
  50. package/src/lib/feature/openItemsIn3d/index.d.ts +0 -1
  51. package/src/lib/types/eventTypes/plantEvent.d.ts +5 -0
  52. package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/actions/addTag.action.d.ts +0 -13
  53. package/src/lib/feature/openItemsIn3d/OpenIn3dSelectedItemsMenu.d.ts +0 -8
  54. package/src/lib/feature/openItemsIn3d/openIn3dMenu.d.ts +0 -7
@@ -1,8 +1,12 @@
1
1
  import { ResultArray, TagSummaryDto } from '@equinor/echo-search';
2
2
  import { Guid } from '@equinor/echo-utils';
3
- import { GlobalSelectionItemType, GlobalSelectionTypes, OptimizedWorkOrderDto } from '../../globalSelectionStore/globalSelectionStore.types';
4
- import { AddTagsArgs, AddTagsResponse, SelectionTreeActionResult } from './actions/addTag.action.types';
5
- type SelectionItem = SelectionMenuTag | SelectionMenuWorkOrder | SelectionMenuEquipment;
3
+ import { GlobalSelectionItemType, GlobalSelectionTypes } from '../../globalSelectionStore/globalSelectionStore.types';
4
+ import { AddByLabel, AddItemArgs, AddItemsResponse, SelectionTreeActionResult } from './actions/selectionTree.action.types';
5
+ export type SelectionItemTypeToItemIdMap = {
6
+ [GlobalSelectionItemType.Tag]: GlobalSelectionTypes.TagId;
7
+ [GlobalSelectionItemType.WorkOrder]: GlobalSelectionTypes.WorkOrderId;
8
+ [GlobalSelectionItemType.Equipment]: GlobalSelectionTypes.EquipmentId;
9
+ };
6
10
  export declare enum GlobalSelectionCategoryId {
7
11
  Tags = "DEFAULT_TAG_LIST_ID",
8
12
  WorkOrders = "DEFAULT_WORK_ORDER_LIST_ID"
@@ -13,43 +17,44 @@ export declare enum SelectionMenuDefaultListIds {
13
17
  TagList = "DEFAULT_TAG_LIST_ID",
14
18
  WorkOrderList = "DEFAULT_WORK_ORDER_LIST_ID"
15
19
  }
16
- export interface SelectionMenuTag {
17
- id: GlobalSelectionTypes.TagId;
18
- type: GlobalSelectionItemType.Tag;
19
- }
20
- export interface SelectionMenuWorkOrder {
21
- id: GlobalSelectionTypes.WorkOrderId;
22
- type: GlobalSelectionItemType.WorkOrder;
23
- }
24
- export interface SelectionMenuEquipment {
25
- id: GlobalSelectionTypes.EquipmentId;
26
- type: GlobalSelectionItemType.Equipment;
20
+ export type SelectionTreeItem<T extends GlobalSelectionItemType> = {
21
+ id: SelectionItemTypeToItemIdMap[T];
22
+ type: T;
23
+ };
24
+ export interface SelectionBase {
25
+ label: string;
26
+ subLabel: string;
27
27
  }
28
- interface SelectionBase {
28
+ export interface SelectionCategory {
29
+ id: GlobalSelectionCategoryId;
29
30
  label: string;
30
- subLabel?: string;
31
+ items: Map<GlobalSelectionTypes.ItemIdString, SelectionTreeItem<GlobalSelectionItemType>>;
31
32
  }
32
- export interface SelectionCategory extends SelectionBase {
33
+ export interface PersistedSelectionCategory {
33
34
  id: GlobalSelectionCategoryId;
34
- items: SelectionItem[];
35
+ label: string;
36
+ items: SelectionTreeItem<GlobalSelectionItemType>[];
35
37
  }
36
38
  export interface SelectionGroup extends SelectionBase {
37
39
  id: Guid;
38
40
  categories: SelectionCategory[];
39
41
  }
42
+ export interface PersistedSelectionGroup extends SelectionBase {
43
+ id: Guid;
44
+ categories: PersistedSelectionCategory[];
45
+ }
46
+ export interface SelectionTreeData {
47
+ groups: SelectionGroup[];
48
+ }
40
49
  export interface SelectionTreeStore {
41
50
  groups: SelectionGroup[];
42
- addTags: <T extends boolean | undefined = undefined>(args: AddTagsArgs & {
51
+ addTags: <T extends boolean | undefined = undefined>(args: AddItemArgs<GlobalSelectionTypes.TagId> & {
43
52
  getActionResult?: T;
44
53
  }) => Promise<AddTagsReturnType<T>>;
45
- addWorkOrders: (args: {
46
- groupId?: Guid;
47
- items: Readonly<Readonly<OptimizedWorkOrderDto>[]>;
48
- }) => void;
54
+ addWorkOrders: (args: AddItemArgs<GlobalSelectionTypes.WorkOrderId>) => void;
49
55
  addItems: (args: {
50
- groupId?: Guid;
51
- itemIds: (GlobalSelectionTypes.TagId | OptimizedWorkOrderDto)[];
52
- }) => void;
56
+ itemIds: GlobalSelectionTypes.ItemId[];
57
+ } & AddByLabel) => void;
53
58
  createGroup: (args: {
54
59
  label: string;
55
60
  subLabel: string;
@@ -79,8 +84,6 @@ export interface SelectionTreeStore {
79
84
  export declare namespace SelectionTreeTypes {
80
85
  type Category = SelectionCategory;
81
86
  type Group = SelectionGroup;
82
- type Item = SelectionItem;
83
87
  type ActionResult = SelectionTreeActionResult;
84
88
  }
85
- export type AddTagsReturnType<T extends boolean | undefined = undefined> = T extends true ? AddTagsResponse : ResultArray<TagSummaryDto>[];
86
- export {};
89
+ export type AddTagsReturnType<T extends boolean | undefined = undefined> = T extends true ? AddItemsResponse<ResultArray<TagSummaryDto>[]> : ResultArray<TagSummaryDto>[];
@@ -1,7 +1,6 @@
1
1
  import { Guid } from '@equinor/echo-utils';
2
2
  import { GlobalSelectionTypes } from '../../globalSelectionStore/globalSelectionStore.types';
3
3
  import { GlobalSelectionCategoryId, SelectionTreeTypes } from './selectionTree.store.types';
4
- import { WritableDraft } from 'immer';
5
4
  /**
6
5
  * Check if an item ID is present in the selection tree.
7
6
  *
@@ -72,8 +71,8 @@ export declare function getGroupIdsByItemIds(args: {
72
71
  label: string;
73
72
  subLabel?: string;
74
73
  }[];
75
- export declare function areItemsTheSameInGroup(args: {
76
- itemIds: GlobalSelectionTypes.TagId[];
74
+ export declare function areItemsTheSameInGroup<ItemType extends GlobalSelectionTypes.ItemId>(args: {
75
+ itemIds: ItemType[];
77
76
  groups: SelectionTreeTypes.Group[];
78
77
  groupId: Guid;
79
78
  categoryId: GlobalSelectionCategoryId;
@@ -81,11 +80,11 @@ export declare function areItemsTheSameInGroup(args: {
81
80
  /**
82
81
  * Removes an empty group from the list of groups, except if it's the local (default) selection.
83
82
  *
84
- * @param {WritableDraft<SelectionTreeTypes.Group[]>} allGroups - The list of all groups.
83
+ * @param {SelectionTreeTypes.Group[]} allGroups - The list of all groups.
85
84
  * @param {SelectionTreeTypes.Group} targetGroup - The group to check and potentially remove.
86
85
  * @returns {void}
87
86
  */
88
- export declare function removeGroupIfEmpty(allGroups: WritableDraft<SelectionTreeTypes.Group[]>, targetGroup: SelectionTreeTypes.Group): void;
87
+ export declare function removeGroupIfEmpty(allGroups: SelectionTreeTypes.Group[], targetGroup: SelectionTreeTypes.Group): void;
89
88
  /**
90
89
  * Removes items from the global selection if they are not present in the tree store anymore.
91
90
  *
@@ -0,0 +1,7 @@
1
+ import { LegendId } from '../types/legendType';
2
+ interface LegendSelectorMenuProps {
3
+ legendId: LegendId;
4
+ isExpanded?: boolean;
5
+ }
6
+ export declare const BasicLegendRenderer: import("react").NamedExoticComponent<LegendSelectorMenuProps>;
7
+ export {};
@@ -0,0 +1,5 @@
1
+ import { FC } from 'react';
2
+ /**
3
+ * This will render all legends in lower left, with customLegendComponent if available, otherwise BasicLegendRenderer.
4
+ */
5
+ export declare const LegendList: FC;
@@ -0,0 +1,5 @@
1
+ import { LegendChipProps } from '@equinor/echo-components';
2
+ import { Badge, Marker } from '../types/legendMarkerBadge.type';
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[];
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ interface PositionalItemProps {
3
+ /**
4
+ * This is the CSS position string, that will be used in --transform: var(--position);
5
+ */
6
+ position: string;
7
+ isOpen: boolean;
8
+ children: React.ReactNode;
9
+ }
10
+ /**
11
+ * An item that can be positioned anywhere in the absolute container.
12
+ */
13
+ export declare const PositionalItem: React.FC<PositionalItemProps>;
14
+ export {};
@@ -0,0 +1,24 @@
1
+ import { Point } from '@equinor/echo-utils';
2
+ import React from 'react';
3
+ import { LegendDataId } from '../../types/legendType';
4
+ interface LegendPositionItem {
5
+ itemId: LegendDataId;
6
+ position: Point;
7
+ hasPointer: boolean;
8
+ }
9
+ interface PositionalLegendMarkersProps {
10
+ items: ReadonlyArray<LegendPositionItem>;
11
+ pdfRotation: number;
12
+ currentPageScale: number;
13
+ pdfZoom: number;
14
+ }
15
+ /**
16
+ * Component that renders positional legend markers on a PDF or on other view.
17
+ *
18
+ * @param {ReadonlyArray<LegendPositionItem>} items - Array of position items.
19
+ * @param {number} pdfRotation - The rotation angle of the PDF.
20
+ * @param {number} currentPageScale - The current scale of the PDF page.
21
+ * @param {number} pdfZoom - The zoom level of the PDF.
22
+ */
23
+ export declare const PositionalLegendMarkers: React.FC<PositionalLegendMarkersProps>;
24
+ export {};
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import { LegendDataId, LegendId } from '../../../types/legendType';
3
+ interface LegendColoredMarkerIconProps {
4
+ legendId: LegendId;
5
+ itemId: LegendDataId;
6
+ hasPointer: boolean;
7
+ isActive: boolean;
8
+ onClick: () => void;
9
+ }
10
+ export declare const MemoizedLegendColoredMarkerIcon: React.NamedExoticComponent<LegendColoredMarkerIconProps>;
11
+ export {};
@@ -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 {};
@@ -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, initialValues: Partial<LegendState>): void;
4
+ export declare function getLegendStrategy(strategyTypeName: string): LegendStrategy;
@@ -0,0 +1,2 @@
1
+ export declare function subscribeToLegendDataChanged(): void;
2
+ export declare const sleep: (ms: number) => Promise<unknown>;
@@ -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,6 @@
1
+ import { Badge, Marker } from '../types/legendMarkerBadge.type';
2
+ import { LegendId } from '../types/legendType';
3
+ export declare function isHiddenMarker(marker: Marker, hiddenMarkers: ReadonlyArray<string>): boolean;
4
+ export declare function setHiddenMarker(marker: Marker, isHidden: boolean, legendId: LegendId): void;
5
+ export declare function isHiddenBadge(badge: Badge, hiddenBadges: ReadonlyArray<string>): boolean;
6
+ export declare function setHiddenBadge(badge: Badge, isHidden: boolean, legendId: LegendId): void;
@@ -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 {};
@@ -1,4 +1,3 @@
1
1
  export { tagIdPlantIdToPlantTagPairs } from './logic/convertToPlantTagPairs';
2
2
  export type { Plant3dInfo, PlantAndTagForOpenIn3d } from './logic/openItemsIn3d.utils';
3
- export { OpenIn3dSelectedItemsMenu } from './OpenIn3dSelectedItemsMenu';
4
3
  export { OpenItemsIn3dDialog } from './openItemsIn3dDialog';
@@ -4,3 +4,8 @@ export interface PlantEvent {
4
4
  stayOnPath?: boolean;
5
5
  alertUserPlantChanged?: boolean;
6
6
  }
7
+ export interface PlantSelectedToBeOpenedIn3DEvent {
8
+ instCode: string;
9
+ sapId: string | undefined;
10
+ pdmsPlantCode: string | undefined;
11
+ }
@@ -1,13 +0,0 @@
1
- import { ResultArray, TagSummaryDto } from '@equinor/echo-search';
2
- import { WritableDraft } from 'immer';
3
- import { StoreApi } from 'zustand';
4
- import { SelectionTreeStore } from '../selectionTree.store.types';
5
- import { AddTagsArgs, AddTagsResponse } from './addTag.action.types';
6
- type SetFunction = (set: (state: WritableDraft<SelectionTreeStore>) => void, shouldReplace?: boolean | undefined, action?: string) => void;
7
- export declare function addTagsAction(set: SetFunction, get: StoreApi<SelectionTreeStore>['getState'], args: AddTagsArgs & {
8
- getActionResult: true;
9
- }): Promise<AddTagsResponse>;
10
- export declare function addTagsAction(set: SetFunction, get: StoreApi<SelectionTreeStore>['getState'], args: AddTagsArgs & {
11
- getActionResult?: false;
12
- }): Promise<ResultArray<TagSummaryDto>[]>;
13
- export {};
@@ -1,8 +0,0 @@
1
- import React from 'react';
2
- interface OpenIn3dSelectedItemsMenuProps {
3
- onOpenIn3dButtonClick: () => void;
4
- children?: React.ReactNode;
5
- disabled?: boolean;
6
- }
7
- export declare const OpenIn3dSelectedItemsMenu: React.FC<OpenIn3dSelectedItemsMenuProps>;
8
- export {};
@@ -1,7 +0,0 @@
1
- import React from 'react';
2
- interface OpenIn3dMenuProps {
3
- onOpenIn3dButtonClick: () => void;
4
- disabled: boolean;
5
- }
6
- export declare const OpenIn3dMenu: React.FC<OpenIn3dMenuProps>;
7
- export {};