@equinor/echo-framework 1.1.0 → 1.2.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 (73) hide show
  1. package/index.cjs.js +8 -8
  2. package/package.json +6 -6
  3. package/src/index.d.ts +2 -2
  4. package/src/lib/components/fullScreenButtons/index.d.ts +0 -2
  5. package/src/lib/components/panel/useCalculateLegendHeight.d.ts +1 -0
  6. package/src/lib/components/prepview/panels/tagInformation/TagInformation.d.ts +1 -1
  7. package/src/lib/coreApplication/EchoContentPanels.d.ts +1 -5
  8. package/src/lib/feature/equipment/components/equipmentItemHeader/showEquipmentIn3dButton.d.ts +1 -1
  9. package/src/lib/feature/globalSelection/globalSelection.api.d.ts +30 -4
  10. package/src/lib/feature/globalSelection/globalSelection.internal.d.ts +3 -2
  11. package/src/lib/feature/globalSelection/globalSelectionColorService.d.ts +57 -0
  12. package/src/lib/feature/globalSelection/globalSelectionColorService.types.d.ts +3 -0
  13. package/src/lib/feature/globalSelection/globalSelectionStore/actions/addEquipmentsToSelection.action.d.ts +1 -0
  14. package/src/lib/feature/globalSelection/globalSelectionStore/actions/addItemsToSelectionFactory.d.ts +1 -0
  15. package/src/lib/feature/globalSelection/globalSelectionStore/actions/addMeasuringPointsToSelection.action.d.ts +1 -0
  16. package/src/lib/feature/globalSelection/globalSelectionStore/actions/addTagsToSelection.action.d.ts +1 -0
  17. package/src/lib/feature/globalSelection/globalSelectionStore/actions/addWorkOrdersToSelection.action.d.ts +1 -0
  18. package/src/lib/feature/globalSelection/globalSelectionStore/globalSelectionStore.repository.d.ts +2 -2
  19. package/src/lib/feature/globalSelection/globalSelectionStore/globalSelectionStore.types.d.ts +7 -5
  20. package/src/lib/feature/globalSelection/globalSelectionStore/globalSelectionStore.utils.d.ts +24 -4
  21. package/src/lib/feature/globalSelection/globalSelectionStore/globalSelectionStoreHelpers.d.ts +12 -2
  22. package/src/lib/feature/globalSelection/hooks/useGlobalSelectionLists.d.ts +0 -2
  23. package/src/lib/feature/globalSelection/index.d.ts +7 -2
  24. package/src/lib/feature/globalSelection/selectionMenu/hooks/useFetchSelectionHistory.d.ts +5 -0
  25. package/src/lib/feature/globalSelection/selectionMenu/hooks/useGlobalSelectionGroups.d.ts +24 -1
  26. package/src/lib/feature/globalSelection/selectionMenu/hooks/useSelectionColorFrequency.d.ts +18 -0
  27. package/src/lib/feature/globalSelection/selectionMenu/invalidateHistorySelectionQuery.d.ts +1 -0
  28. package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/actions/addItems.action.d.ts +16 -0
  29. package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/actions/addItemsToSelectionTreeFactory.d.ts +1 -1
  30. package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/actions/common.action.types.d.ts +5 -0
  31. package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/actions/createGroup.action.d.ts +20 -0
  32. package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/actions/moveItems.action.d.ts +31 -0
  33. package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/actions/removeGroupById.action.d.ts +21 -0
  34. package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/actions/removeItemsById.action.d.ts +24 -0
  35. package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/actions/selectionTree.action.types.d.ts +14 -15
  36. package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/actions/setVisibility.action.d.ts +21 -0
  37. package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/api/selectionTree.api.d.ts +16 -5
  38. package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/api/selectionTree.equipment.d.ts +5 -0
  39. package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/colorConflictHandling/SelectionColorConflictDialog.d.ts +11 -0
  40. package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/colorConflictHandling/selectionColorConflict.store.d.ts +27 -0
  41. package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/persist/devOnlySimulateOffline.d.ts +7 -0
  42. package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/persist/diskId.type.d.ts +2 -0
  43. package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/persist/persistError.d.ts +5 -0
  44. package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/persist/selectionTree.diskBackup.d.ts +45 -0
  45. package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/persist/selectionTree.diskBackupStatus.d.ts +19 -0
  46. package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/persist/selectionTree.load.d.ts +8 -0
  47. package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/persist/selectionTree.load.utils.d.ts +54 -0
  48. package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/persist/selectionTree.save.d.ts +1 -0
  49. package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/persist/selectionTreeLoader.service.d.ts +42 -0
  50. package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/{useSelectionTreeAutoSave.d.ts → persist/useSelectionTreeAutoSave.d.ts} +2 -0
  51. package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/selectionTree.api.types.d.ts +14 -3
  52. package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/selectionTree.store.d.ts +15 -0
  53. package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/selectionTree.store.types.d.ts +16 -3
  54. package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/selectionTree.store.utils.d.ts +64 -2
  55. package/src/lib/feature/legacyLegend/legend.d.ts +1 -0
  56. package/src/lib/feature/legend/components/legendTextSelector/LegendTextSelector.d.ts +21 -0
  57. package/src/lib/feature/legend/components/popover/LegendPopoverContent.d.ts +4 -0
  58. package/src/lib/feature/legend/components/popover/LegendPopoverContent.logic.d.ts +1 -1
  59. package/src/lib/feature/legend/index.d.ts +6 -0
  60. package/src/lib/feature/legend/types/legendMarkerBadge.type.d.ts +9 -2
  61. package/src/lib/feature/legend/types/legendStrategy.type.d.ts +1 -0
  62. package/src/lib/feature/legend/types/legendType.d.ts +1 -0
  63. package/src/lib/services/api/api-plants.d.ts +4 -0
  64. package/src/lib/services/echoViewService/loadEchoViewIdAndSelectionIdFromUrl.d.ts +5 -4
  65. package/src/lib/types/dataAccess/dataAccessLinks.d.ts +1 -0
  66. package/src/lib/utils/startup.d.ts +1 -0
  67. package/src/lib/components/fullScreenButtons/FullScreenChip.d.ts +0 -7
  68. package/src/lib/components/fullScreenButtons/FullScreenModeChip.d.ts +0 -14
  69. package/src/lib/feature/globalSelection/selectionMenu/hooks/useGlobalSelectionColorsSortedByFrequency.d.ts +0 -10
  70. package/src/lib/feature/globalSelection/selectionMenu/hooks/useMoveSelectionTreeItems.d.ts +0 -10
  71. package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/selectionTree.store.repository.d.ts +0 -5
  72. /package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/{currentSelectionId.repository.d.ts → persist/currentSelectionId.repository.d.ts} +0 -0
  73. /package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/{legacyPersistedSelection.d.ts → persist/legacyPersistedSelection.d.ts} +0 -0
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@equinor/echo-framework",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "peerDependencies": {
5
- "@equinor/echo-base": ">= 1.0.0 < 2.0.0",
6
- "@equinor/echo-components": ">= 1.0.0 < 2.0.0",
7
- "@equinor/echo-core": ">= 1.0.0 < 2.0.0",
8
- "@equinor/echo-search": ">= 1.0.0 < 2.0.0",
9
- "@equinor/echo-utils": ">= 1.1.0 < 2.0.0",
5
+ "@equinor/echo-base": ">= 1.2.0 < 2.0.0",
6
+ "@equinor/echo-components": ">= 1.2.0 < 2.0.0",
7
+ "@equinor/echo-core": ">= 1.2.0 < 2.0.0",
8
+ "@equinor/echo-search": ">= 1.2.0 < 2.0.0",
9
+ "@equinor/echo-utils": ">= 1.2.0 < 2.0.0",
10
10
  "@equinor/eds-core-react": "0.43.0",
11
11
  "@equinor/eds-icons": "0.22.0",
12
12
  "react": ">= 17.0.2",
package/src/index.d.ts CHANGED
@@ -18,10 +18,10 @@ export * from './lib/feature/equipment/index';
18
18
  export * from './lib/feature/globalSelection';
19
19
  export { SelectionActionBar } from './lib/feature/globalSelection/components/SelectionActionBar';
20
20
  export { PanTo3DButton } from './lib/feature/globalSelection/panToEcho3d/panTo3DButton';
21
- export { useGlobalSelectionColorsSortedByFrequency } from './lib/feature/globalSelection/selectionMenu/hooks/useGlobalSelectionColorsSortedByFrequency';
22
21
  export { useIsAllIGlobalSelectionItemsHidden } from './lib/feature/globalSelection/selectionMenu/hooks/useIsAllIGlobalSelectionItemsHidden';
22
+ export { useSelectionColorFrequencyByIds } from './lib/feature/globalSelection/selectionMenu/hooks/useSelectionColorFrequency';
23
+ export { useSelectionTreeAutoSave } from './lib/feature/globalSelection/selectionMenu/selectionTreeStore/persist/useSelectionTreeAutoSave';
23
24
  export { GlobalSelectionCategoryId } from './lib/feature/globalSelection/selectionMenu/selectionTreeStore/selectionTree.store.types';
24
- export { useSelectionTreeAutoSave } from './lib/feature/globalSelection/selectionMenu/selectionTreeStore/useSelectionTreeAutoSave';
25
25
  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';
@@ -1,3 +1 @@
1
- export * from './FullScreenChip';
2
1
  export * from './FullScreenModeButton';
3
- export * from './FullScreenModeChip';
@@ -0,0 +1 @@
1
+ export declare const useCalculateLegendHeight: () => number;
@@ -6,5 +6,5 @@ interface Props {
6
6
  * TagInformationPanel
7
7
  * this panel requires the user to have maintenance access to show data.
8
8
  */
9
- declare function TagInformationPanel({ itemId, isWorkOrder }: Props): import("react/jsx-runtime").JSX.Element;
9
+ declare function TagInformationPanel({ itemId, isWorkOrder }: Readonly<Props>): import("react/jsx-runtime").JSX.Element;
10
10
  export { TagInformationPanel };
@@ -1,10 +1,6 @@
1
1
  import { Panel } from '@equinor/echo-core';
2
- /** Used in echo-client for creating a host application for echo modules in dev mode **/
2
+ /** These are not used in echopedia! Only used in echo-dev-host for creating a host application for echo modules in dev mode **/
3
3
  /**
4
4
  * Core Main menu panel registered at client startup
5
5
  */
6
6
  export declare const mainMenu: Panel;
7
- /**
8
- * Core Application search panel registered at client startup
9
- */
10
- export declare const searchPanel: Panel;
@@ -1,6 +1,6 @@
1
1
  import { EquipmentData } from '@equinor/echo-search';
2
2
  interface ShowEquipmentIn3DButtonArgs {
3
- equipmentProps: Pick<EquipmentData, 'equipmentId' | 'e3DRef' | 'tagId'>;
3
+ equipmentProps: Pick<EquipmentData, 'equipmentId' | 'e3DRef' | 'tagId' | 'tagPlantId'>;
4
4
  }
5
5
  export declare const ShowEquipmentIn3DButton: ({ equipmentProps }: ShowEquipmentIn3DButtonArgs) => import("react/jsx-runtime").JSX.Element;
6
6
  export {};
@@ -111,7 +111,7 @@ export declare const globalSelectionApi: Readonly<{
111
111
  addItems: (args: {
112
112
  itemIds: GlobalSelectionTypes.ItemId[];
113
113
  groupId?: import("@equinor/echo-utils").Guid;
114
- } & import("./selectionMenu/selectionTreeStore/actions/selectionTree.action.types").AddByGroupIdAndLabel) => Promise<void>;
114
+ }) => Promise<void>;
115
115
  }>;
116
116
  search: {
117
117
  /**
@@ -128,9 +128,35 @@ export declare const globalSelectionApi: Readonly<{
128
128
  label: string;
129
129
  }) => import("@equinor/echo-utils").Guid | undefined;
130
130
  };
131
+ /**
132
+ * Moves items, categories, or groups within the selection tree structure.
133
+ *
134
+ * Depending on the provided arguments, this function will:
135
+ * - Move a single item from one category/group to another.
136
+ * - Move an entire category from one group to another, optionally removing the source group if empty.
137
+ * - Move an entire group to another location, removing the original group.
138
+ *
139
+ * @param set - The state setter function used to update the selection tree.
140
+ * @param args - The arguments specifying the source and target locations for the move operation.
141
+ * - `sourceGroupId`: The ID of the group from which the item/category/group is moved.
142
+ * - `sourceCategoryId`: (Optional) The ID of the category from which the item is moved.
143
+ * - `sourceItemId`: (Optional) The ID of the item to move.
144
+ * - `targetGroupId`: The ID of the group to which the item/category/group is moved.
145
+ *
146
+ * @remarks
147
+ * - If `sourceItemId` is provided, `sourceCategoryId` must also be provided.
148
+ * - After moving a single item, the source group is not removed.
149
+ * - After moving a category or group, the source group may be removed if empty.
150
+ */
151
+ moveItems: (args: {
152
+ sourceGroupId: import("@equinor/echo-utils").Guid;
153
+ sourceCategoryId?: GlobalSelectionCategoryId;
154
+ sourceItemId?: GlobalSelectionTypes.ItemId;
155
+ targetGroupId: import("@equinor/echo-utils").Guid;
156
+ }) => void;
131
157
  visibility: Readonly<{
132
158
  setByItemIds: (args: {
133
- itemIds: Readonly<Readonly<GlobalSelectionTypes.ItemId>>[];
159
+ itemIds: ReadonlyArray<Readonly<GlobalSelectionTypes.ItemId>>;
134
160
  isVisible: boolean;
135
161
  }) => void;
136
162
  /**
@@ -159,7 +185,7 @@ export declare const globalSelectionApi: Readonly<{
159
185
  }>;
160
186
  color: Readonly<{
161
187
  setByItemIds: (args: {
162
- itemIds: Readonly<Readonly<GlobalSelectionTypes.ItemId>>[];
188
+ itemIds: ReadonlyArray<Readonly<GlobalSelectionTypes.ItemId>>;
163
189
  color: string;
164
190
  }) => void;
165
191
  }>;
@@ -224,7 +250,7 @@ export declare const globalSelectionApi: Readonly<{
224
250
  /**
225
251
  * Retrieves the unique IDs of all items stored in the selection menu panel.
226
252
  */
227
- getAll: () => Readonly<GlobalSelectionTypes.ItemId[]>;
253
+ getAll: () => ReadonlyArray<GlobalSelectionTypes.ItemId>;
228
254
  getTagIds: typeof getStoreTagIds;
229
255
  getEquipmentIds: typeof getStoreEquipmentIds;
230
256
  };
@@ -1,5 +1,5 @@
1
1
  import { Guid } from '@equinor/echo-utils';
2
- import { deleteSelectionId, fetchUserSelectionIds } from './selectionMenu/selectionTreeStore/api/selectionTree.api';
2
+ import { deleteSelectionId, fetchSelectionHistory, fetchUserSelectionIds } from './selectionMenu/selectionTreeStore/api/selectionTree.api';
3
3
  /**
4
4
  * Internal that should only be used by echopedia
5
5
  */
@@ -7,6 +7,7 @@ export declare const globalSelectionInternal: Readonly<{
7
7
  loadFromApi: typeof loadFromApi;
8
8
  deleteSelectionId: typeof deleteSelectionId;
9
9
  fetchUserSelectionIds: typeof fetchUserSelectionIds;
10
+ fetchSelectionHistory: typeof fetchSelectionHistory;
10
11
  }>;
11
- declare function loadFromApi(idToLoad: Guid): Promise<void>;
12
+ declare function loadFromApi(idToLoad: Guid): Promise<boolean>;
12
13
  export {};
@@ -0,0 +1,57 @@
1
+ import { GlobalSelectionItemType } from './globalSelectionStore/globalSelectionStore.types';
2
+ type ColorServiceState = {
3
+ /**
4
+ * Maps a color to the set of keys assigned to it.
5
+ */
6
+ colorToKeysMap: Map<string, Set<string>>;
7
+ /**
8
+ * Maps a key to its assigned color.
9
+ */
10
+ keyToColorMap: Map<string, string>;
11
+ /**
12
+ * Assigns a new, unused color to the given keys and tracks them.
13
+ * @param keys Array of string keys to assign the color to.
14
+ * @returns The assigned color.
15
+ */
16
+ assignNextAvailableColor: (keys: string[]) => string;
17
+ /**
18
+ * Releases the color assignment for the given keys.
19
+ * If a color has no keys left, it is considered unused.
20
+ * @param keys Array of string keys to release.
21
+ */
22
+ releaseColorByKeys: (keys: string[]) => void;
23
+ /**
24
+ * Returns all colors currently in use.
25
+ */
26
+ getUsedColors: () => string[];
27
+ /**
28
+ * Returns all colors not currently in use.
29
+ */
30
+ getUnusedColors: () => string[];
31
+ /**
32
+ * Returns the color assigned to the given key, or undefined if not assigned.
33
+ * @param key The key to look up.
34
+ */
35
+ getColorByKey: (key: string) => string | undefined;
36
+ /**
37
+ * Clears all color assignments.
38
+ */
39
+ reset: () => void;
40
+ };
41
+ export declare const useColorServiceStore: import("zustand").UseBoundStore<import("zustand").StoreApi<ColorServiceState>>;
42
+ export declare const SELECTION_COLOR_PICKER_COLORS: Readonly<string>[];
43
+ declare const UNIFIED_COLOR_POOL: string[];
44
+ export { UNIFIED_COLOR_POOL };
45
+ /**
46
+ * Should be only used in local selection context!
47
+ *
48
+ * Returns the color associated with a given `GlobalSelectionItemType`.
49
+ *
50
+ * This function maps specific item types to their corresponding selection colors,
51
+ * as defined in the `echoPrimitives.seletionColorsSelectioncolor*` constants.
52
+ * If the provided `itemType` does not match any known type, a default color (`#FF6F00`) is returned.
53
+ *
54
+ * @param itemType - The type of the global selection item for which to retrieve the color.
55
+ * @returns The color string associated with the specified item type.
56
+ */
57
+ export declare function getLocalSelectionColorByItemType(itemType: GlobalSelectionItemType): string;
@@ -0,0 +1,3 @@
1
+ import { Brand } from '@equinor/echo-utils';
2
+ export declare const SELECTION_PLACEHOLDER_COLOR = "#B0B0B0";
3
+ export type HexColor = Brand<string, 'ItemIdString'>;
@@ -1,5 +1,6 @@
1
1
  export declare const addEquipmentsToSelectionAction: (set: (set: (state: import("../globalSelectionStore.types").GlobalSelectionStore) => void, shouldReplace?: boolean | undefined, action?: string) => void, get: import("zustand").StoreApi<import("../globalSelectionStore.types").GlobalSelectionStore>["getState"], args: {
2
2
  itemIds: import("../globalSelectionStore.types").GlobalSelectionTypes.EquipmentId[];
3
+ color?: string;
3
4
  }) => Promise<{
4
5
  fetchResult: import("@equinor/echo-search").ResultArray<import("@equinor/echo-search").EquipmentData>[];
5
6
  actionResult: import("../globalSelectionStore.types").GlobalSelectionTypes.ActionResult;
@@ -13,6 +13,7 @@ export declare function addItemsToSelectionFactory<T extends GlobalSelectionItem
13
13
  nullItemGenerator: NullItemGenerator<GlobalSelectionItemTypeToDataMap[T], SelectionItemTypeToItemIdMap[T]>;
14
14
  }): (set: SetFunction, get: StoreApi<GlobalSelectionStore>["getState"], args: {
15
15
  itemIds: SelectionItemTypeToItemIdMap[T][];
16
+ color?: string;
16
17
  }) => Promise<{
17
18
  fetchResult: ResultArray<GlobalSelectionItemTypeToDataMap[T]>[];
18
19
  actionResult: GlobalSelectionTypes.ActionResult;
@@ -1,5 +1,6 @@
1
1
  export declare const addMeasuringPointsToSelectionAction: (set: (set: (state: import("../globalSelectionStore.types").GlobalSelectionStore) => void, shouldReplace?: boolean | undefined, action?: string) => void, get: import("zustand").StoreApi<import("../globalSelectionStore.types").GlobalSelectionStore>["getState"], args: {
2
2
  itemIds: import("../globalSelectionStore.types").GlobalSelectionTypes.MeasuringPointId[];
3
+ color?: string;
3
4
  }) => Promise<{
4
5
  fetchResult: import("@equinor/echo-search").ResultArray<import("@equinor/echo-search").MeasuringPointData>[];
5
6
  actionResult: import("../globalSelectionStore.types").GlobalSelectionTypes.ActionResult;
@@ -1,6 +1,7 @@
1
1
  import { GlobalSelectionTypes } from '../globalSelectionStore.types';
2
2
  export declare const addTagsToSelectionAction: (set: (set: (state: import("../globalSelectionStore.types").GlobalSelectionStore) => void, shouldReplace?: boolean | undefined, action?: string) => void, get: import("zustand").StoreApi<import("../globalSelectionStore.types").GlobalSelectionStore>["getState"], args: {
3
3
  itemIds: GlobalSelectionTypes.TagId[];
4
+ color?: string;
4
5
  }) => Promise<{
5
6
  fetchResult: import("@equinor/echo-search").ResultArray<import("@equinor/echo-search").TagSummaryDto>[];
6
7
  actionResult: GlobalSelectionTypes.ActionResult;
@@ -1,5 +1,6 @@
1
1
  export declare const addWorkOrdersToSelectionAction: (set: (set: (state: import("../globalSelectionStore.types").GlobalSelectionStore) => void, shouldReplace?: boolean | undefined, action?: string) => void, get: import("zustand").StoreApi<import("../globalSelectionStore.types").GlobalSelectionStore>["getState"], args: {
2
2
  itemIds: import("../globalSelectionStore.types").GlobalSelectionTypes.WorkOrderId[];
3
+ color?: string;
3
4
  }) => Promise<{
4
5
  fetchResult: import("@equinor/echo-search").ResultArray<import("@equinor/echo-search").WorkOrderData>[];
5
6
  actionResult: import("../globalSelectionStore.types").GlobalSelectionTypes.ActionResult;
@@ -1,7 +1,7 @@
1
1
  import { ApiSelectionGroup } from '../selectionMenu/selectionTreeStore/selectionTree.api.types';
2
2
  import { GlobalSelectionStore } from './globalSelectionStore.types';
3
- declare function loadAndPopulateStoreMetadataFromApi(store: GlobalSelectionStore, data: ApiSelectionGroup[]): Promise<void>;
3
+ declare function setStoreItemMetadataFromApiData(store: GlobalSelectionStore, data: ApiSelectionGroup[]): void;
4
4
  export declare const globalSelectionRepository: {
5
- loadAndPopulateStoreMetadataFromApi: typeof loadAndPopulateStoreMetadataFromApi;
5
+ setStoreItemMetadataFromApiData: typeof setStoreItemMetadataFromApiData;
6
6
  };
7
7
  export {};
@@ -23,8 +23,6 @@ export type SelectionItemTypeToItemIdMap = {
23
23
  [GlobalSelectionItemType.MeasuringPoint]: GlobalSelectionTypes.MeasuringPointId;
24
24
  };
25
25
  type GlobalSelectionList<T extends GlobalSelectionItemType> = {
26
- label: string;
27
- type: T;
28
26
  items: Map<GlobalSelectionTypes.ItemIdString, GlobalSelectionTypes.GenericItem<T>>;
29
27
  };
30
28
  export type GlobalSelectionObject = {
@@ -62,25 +60,29 @@ interface ItemErrorStatusUpdates {
62
60
  export interface GlobalSelectionStore extends GlobalSelectionStoreData {
63
61
  addWorkOrdersToSelection: (args: {
64
62
  workOrderIds: GlobalSelectionTypes.WorkOrderId[];
63
+ color?: string;
65
64
  }) => Promise<GlobalSelectionAddItemResult<ResultArray<WorkOrderData>[]>>;
66
65
  addTagsToSelection: (args: {
67
66
  tagIds: GlobalSelectionTypes.TagId[];
67
+ color?: string;
68
68
  }) => Promise<GlobalSelectionAddItemResult<ResultArray<TagSummaryDto>[]>>;
69
69
  addEquipmentsToSelection: (args: {
70
70
  equipmentIds: GlobalSelectionTypes.EquipmentId[];
71
+ color?: string;
71
72
  }) => Promise<GlobalSelectionAddItemResult<ResultArray<EquipmentData>[]>>;
72
73
  addMeasuringPointsToSelection: (args: {
73
74
  measuringPointIds: GlobalSelectionTypes.MeasuringPointId[];
75
+ color?: string;
74
76
  }) => Promise<GlobalSelectionAddItemResult<ResultArray<MeasuringPointData>[]>>;
75
77
  removeItemsFromSelection: (args: {
76
78
  itemIds: ReadonlyArray<GlobalSelectionTypes.ItemId>;
77
79
  }) => void;
78
80
  setColorByItemIds: (args: {
79
- itemIds: Readonly<Readonly<GlobalSelectionTypes.ItemId>>[];
81
+ itemIds: ReadonlyArray<Readonly<GlobalSelectionTypes.ItemId>>;
80
82
  color: string;
81
83
  }) => void;
82
84
  setVisibilityByItemIds: (args: {
83
- itemIds: Readonly<Readonly<GlobalSelectionTypes.ItemId>>[];
85
+ itemIds: ReadonlyArray<Readonly<GlobalSelectionTypes.ItemId>>;
84
86
  isVisible: boolean;
85
87
  }) => void;
86
88
  setAllItemsVisibility: (args: {
@@ -88,7 +90,7 @@ export interface GlobalSelectionStore extends GlobalSelectionStoreData {
88
90
  }) => void;
89
91
  setItemMetaData: (args: ReadonlyArray<GlobalSelectionItemIdMetadata>) => void;
90
92
  resetItemErrorStatuses: () => void;
91
- getStoredItemIds: () => Readonly<GlobalSelectionTypes.ItemId[]>;
93
+ getStoredItemIds: () => ReadonlyArray<GlobalSelectionTypes.ItemId>;
92
94
  resetState: () => void;
93
95
  setErrorStatusForItems: (args: {
94
96
  itemErrorStatuses: GlobalSelectionTypes.ItemErrorStatusUpdate[];
@@ -1,4 +1,5 @@
1
- import { GlobalSelectionItemType, GlobalSelectionTypes } from './globalSelectionStore.types';
1
+ import { ResultArray } from '@equinor/echo-search';
2
+ import { GlobalSelectionItemType, GlobalSelectionItemTypeToDataMap, GlobalSelectionTypes, SelectionItemTypeToItemIdMap } from './globalSelectionStore.types';
2
3
  declare function idsEqual(itemA: GlobalSelectionTypes.ItemId, itemB: GlobalSelectionTypes.ItemId): boolean;
3
4
  declare function isWorkOrderId(itemId: GlobalSelectionTypes.ItemId): itemId is GlobalSelectionTypes.WorkOrderId;
4
5
  declare function isEquipmentId(itemId: GlobalSelectionTypes.ItemId): itemId is GlobalSelectionTypes.EquipmentId;
@@ -34,7 +35,6 @@ declare function mapToId(item: GlobalSelectionTypes.MeasuringPointId): GlobalSel
34
35
  declare function mapToId(item: GlobalSelectionTypes.ItemId): GlobalSelectionTypes.ItemId;
35
36
  declare function itemIdToString(itemId: GlobalSelectionTypes.ItemId): GlobalSelectionTypes.ItemIdString;
36
37
  export declare function mapIdToItemType(itemId: GlobalSelectionTypes.ItemId): GlobalSelectionItemType;
37
- export declare function sortByFrequency(list: string[]): string[];
38
38
  /**
39
39
  * A utility object that provides various functions for handling global selections.
40
40
  *
@@ -45,7 +45,6 @@ export declare function sortByFrequency(list: string[]): string[];
45
45
  * @property {Function} idsEqual - Compares two global selection item IDs for equality.
46
46
  * @property {Function} mapToId - Maps an object to its global selection item ID.
47
47
  * @property {Function} itemIdToString - Converts a global selection item id object to a string, each value is concatenated by a '-'
48
- * @property {Function} sortByFrequency - Sorts and aggregates a list of strings.
49
48
  */
50
49
  export declare const globalSelectionUtils: Readonly<{
51
50
  isMeasuringPointId: typeof isMeasuringPointId;
@@ -56,6 +55,27 @@ export declare const globalSelectionUtils: Readonly<{
56
55
  mapToId: typeof mapToId;
57
56
  mapIdToItemType: typeof mapIdToItemType;
58
57
  itemIdToString: typeof itemIdToString;
59
- sortByFrequency: typeof sortByFrequency;
60
58
  }>;
59
+ /**
60
+ * Updates the global selection list in the store by processing the results of multiple fetch operations.
61
+ *
62
+ * This function handles three types of updates:
63
+ * - Successfully fetched items are added or updated in the list.
64
+ * - Items that resulted in errors during fetching are marked accordingly.
65
+ * - Items that were not found in the fetch responses are marked as not found.
66
+ *
67
+ * @template T - The type of the global selection item.
68
+ * @param state - The current global selection store state.
69
+ * @param itemType - The type of items being updated in the selection list.
70
+ * @param itemIds - The array of item IDs that were requested to be fetched.
71
+ * @param fetchResponse - An array of fetch responses, each containing the result and the item IDs used in that fetch.
72
+ *
73
+ * @remarks
74
+ * This utility function is intended to be used internally by the global selection store to batch process updates
75
+ * after fetching multiple items, ensuring the store reflects the latest state of each item (success, error, or not found).
76
+ */
77
+ export declare function batchUpdateGlobalSelectionList<T extends GlobalSelectionItemType>(state: GlobalSelectionTypes.Store, itemType: T, itemIds: SelectionItemTypeToItemIdMap[T][], fetchResponse: {
78
+ result: ResultArray<GlobalSelectionItemTypeToDataMap[T]>;
79
+ itemIdsUsed: SelectionItemTypeToItemIdMap[T][];
80
+ }[]): void;
61
81
  export {};
@@ -1,6 +1,16 @@
1
1
  import { GlobalSelectionItemType, GlobalSelectionTypes, SelectionItemSystemStatus } from './globalSelectionStore.types';
2
- export declare function toGlobalSelectionItem<T extends GlobalSelectionTypes.ItemTypeToDataMap[K], K extends GlobalSelectionItemType>(item: T, type: K, systemStatus: SelectionItemSystemStatus): GlobalSelectionTypes.GenericItem<K>;
3
- export declare function toGlobalSelectionItems<T extends GlobalSelectionTypes.ItemTypeToDataMap[K], K extends GlobalSelectionItemType>(items: T[], type: K, systemStatus: SelectionItemSystemStatus): GlobalSelectionTypes.GenericItem<K>[];
2
+ export declare function toGlobalSelectionItem<T extends GlobalSelectionTypes.ItemTypeToDataMap[K], K extends GlobalSelectionItemType>(args: {
3
+ item: T;
4
+ type: K;
5
+ systemStatus: SelectionItemSystemStatus;
6
+ color?: string;
7
+ }): GlobalSelectionTypes.GenericItem<K>;
8
+ export declare function toGlobalSelectionItems<T extends GlobalSelectionTypes.ItemTypeToDataMap[K], K extends GlobalSelectionItemType>(args: {
9
+ items: T[];
10
+ type: K;
11
+ systemStatus: SelectionItemSystemStatus;
12
+ color?: string;
13
+ }): GlobalSelectionTypes.GenericItem<K>[];
4
14
  export declare function setNotFoundStatusByItemIds(args: {
5
15
  itemType: GlobalSelectionItemType;
6
16
  state: GlobalSelectionTypes.Store;
@@ -2,7 +2,5 @@
2
2
  * Hook for returning all lists stored in the global selection.
3
3
  */
4
4
  export declare function useGlobalSelectionLists(): {
5
- label: string;
6
- type: import("..").GlobalSelectionItemType;
7
5
  items: (import("..").GlobalSelectionTypes.GenericItem<import("..").GlobalSelectionItemType.WorkOrder> | import("..").GlobalSelectionTypes.GenericItem<import("..").GlobalSelectionItemType.Tag> | import("..").GlobalSelectionTypes.GenericItem<import("..").GlobalSelectionItemType.Equipment> | import("..").GlobalSelectionTypes.GenericItem<import("..").GlobalSelectionItemType.MeasuringPoint>)[];
8
6
  }[];
@@ -10,11 +10,16 @@ export { useGlobalSelectionWorkOrders } from './hooks/useGlobalSelectionWorkOrde
10
10
  export { useSelectionCategoriesByGroupId } from './hooks/useSelectionCategoriesByGroupId';
11
11
  export { useCurrentSelectionId } from './selectionMenu/hooks/useCurrentSelectionId';
12
12
  export { useGlobalSelectionGroups } from './selectionMenu/hooks/useGlobalSelectionGroups';
13
- export { useMoveSelectionTreeItems } from './selectionMenu/hooks/useMoveSelectionTreeItems';
14
- export { loadEchoViewIdAndSelectionIdFromUrl } from '../../services/echoViewService/loadEchoViewIdAndSelectionIdFromUrl';
13
+ export { useMostUsedSelectionColorByIds } from './selectionMenu/hooks/useSelectionColorFrequency';
14
+ export { useFetchSelectionHistory } from './selectionMenu/hooks/useFetchSelectionHistory';
15
15
  export { RemoveSelectionItemsConfirmDialog } from './components/RemoveSelectionItemsConfirmDialog';
16
16
  export { globalSelectionApi } from './globalSelection.api';
17
17
  export { globalSelectionInternal } from './globalSelection.internal';
18
+ export { SELECTION_COLOR_PICKER_COLORS } from './globalSelectionColorService';
18
19
  export { globalSelectionUtils } from './globalSelectionStore/globalSelectionStore.utils';
19
20
  export { OpenGlobalSelectionIn3DButton } from './OpenGlobalSelectionIn3DButton';
20
21
  export { convertGlobalSelectionItemsToPlantTagPairs } from './OpenGlobalSelectionIn3DButton.utils';
22
+ export { saveEquipmentAsNewSelectionToApi } from './selectionMenu/selectionTreeStore/api/selectionTree.equipment';
23
+ export { invalidateHistorySelectionQuery } from './selectionMenu/invalidateHistorySelectionQuery';
24
+ export { SelectionColorConflictDialog } from './selectionMenu/selectionTreeStore/colorConflictHandling/SelectionColorConflictDialog';
25
+ export { simulatedSelectionTreeApiError } from './selectionMenu/selectionTreeStore/persist/devOnlySimulateOffline';
@@ -0,0 +1,5 @@
1
+ export declare const historySelectionQueryKey = "historySelection";
2
+ export declare const useFetchSelectionHistory: () => {
3
+ status: "error" | "success" | "pending";
4
+ data: import("../selectionTreeStore/selectionTree.api.types").ApiSelectionHistory[] | undefined;
5
+ };
@@ -1,7 +1,30 @@
1
+ import { GlobalSelectionItemType, GlobalSelectionTypes } from '../../globalSelectionStore/globalSelectionStore.types';
1
2
  import { SelectionTreeTypes } from '../selectionTreeStore/selectionTree.store.types';
2
3
  /**
3
4
  * Custom hook to get the selection menu lists from the selection menu store, displayed in the left selection panel.
4
5
  *
5
- * @returns {SelectionTreeTypes.Group[]} - An array of selection menu lists.
6
+ * Usage:
7
+ * - `useGlobalSelectionGroups()` or `useGlobalSelectionGroups({ withData: false })` returns groups with only item references (IDs).
8
+ * - `useGlobalSelectionGroups({ withData: true })` returns groups with full item data and metaData merged in.
9
+ *
10
+ * @param options Options object. If withData is true, returns groups with actual item data/metadata included, not just item ids.
11
+ * @returns An array of selection menu groups, either with only item references or with full item data, depending on options.
6
12
  */
7
13
  export declare function useGlobalSelectionGroups(): SelectionTreeTypes.Group[];
14
+ export declare function useGlobalSelectionGroups(options: {
15
+ withData: false;
16
+ }): SelectionTreeTypes.Group[];
17
+ export declare function useGlobalSelectionGroups(options: {
18
+ withData: true;
19
+ }): SelectionTreeGroupWithData[];
20
+ type SelectionTreeItemWithData<T extends GlobalSelectionItemType> = SelectionTreeTypes.Category['items'] extends Map<infer _, infer V> ? V & {
21
+ data?: GlobalSelectionTypes.ItemTypeToDataMap[T];
22
+ metaData?: GlobalSelectionTypes.GenericItem<T>['metaData'];
23
+ } : never;
24
+ type SelectionTreeCategoryWithData = Omit<SelectionTreeTypes.Category, 'items'> & {
25
+ items: Map<GlobalSelectionTypes.ItemIdString, SelectionTreeItemWithData<GlobalSelectionItemType>>;
26
+ };
27
+ type SelectionTreeGroupWithData = Omit<SelectionTreeTypes.Group, 'categories'> & {
28
+ categories: SelectionTreeCategoryWithData[];
29
+ };
30
+ export {};
@@ -0,0 +1,18 @@
1
+ import { GlobalSelectionTypes } from '../../globalSelectionStore/globalSelectionStore.types';
2
+ /**
3
+ * Returns an array of color strings sorted by their frequency of occurrence among the selected items.
4
+ *
5
+ * This hook retrieves the global selection items and filters them based on the provided item IDs,
6
+ * extracts their associated colors, and sorts the colors by frequency.
7
+ *
8
+ * @param itemIds - An array of item IDs to match against global selection items.
9
+ * @returns An array of color strings sorted by frequency, most frequent first.
10
+ */
11
+ export declare function useSelectionColorFrequencyByIds(itemIds: GlobalSelectionTypes.ItemId[]): string[];
12
+ /**
13
+ * Returns the most frequently used selection color from the provided item IDs.
14
+ *
15
+ * @param itemIds - An array of item IDs to analyze for color frequency.
16
+ * @returns The most used selection color as a string, or `undefined` if no colors are present.
17
+ */
18
+ export declare function useMostUsedSelectionColorByIds(itemIds: GlobalSelectionTypes.ItemId[]): string | undefined;
@@ -0,0 +1 @@
1
+ export declare const invalidateHistorySelectionQuery: () => Promise<void>;
@@ -0,0 +1,16 @@
1
+ import { Guid } from '@equinor/echo-utils';
2
+ import { GlobalSelectionTypes } from '../../../globalSelectionStore/globalSelectionStore.types';
3
+ import { SelectionTreeStore } from '../selectionTree.store.types';
4
+ /**
5
+ * Adds items to the selection tree store by categorizing them into tags, work orders,
6
+ * equipments, and measuring points, then dispatching the appropriate add actions for each type.
7
+ *
8
+ * @param get - A function that returns the current instance of the SelectionTreeStore.
9
+ * @param args - The arguments for adding items, including an array of item IDs and additional label arguments.
10
+ * @returns A promise that resolves when all items have been added to the store.
11
+ */
12
+ export declare function addItems(get: () => SelectionTreeStore, args: AddItemsActionArgs): Promise<void>;
13
+ export type AddItemsActionArgs = {
14
+ itemIds: GlobalSelectionTypes.ItemId[];
15
+ groupId?: Guid;
16
+ };
@@ -5,7 +5,7 @@ import { GlobalSelectionCategoryId, SelectionTreeStore } from '../selectionTree.
5
5
  import { AddItemArgs, AddItemsResponse } from './selectionTree.action.types';
6
6
  type SetFunction = (set: (state: SelectionTreeStore) => void, shouldReplace?: boolean | undefined, action?: string) => void;
7
7
  export declare function addItemsToSelectionTreeActionFactory<G_ItemType extends GlobalSelectionItemType>(args: {
8
- addItemToGlobalSelection: (uniqueNewItems: SelectionItemTypeToItemIdMap[G_ItemType][]) => Promise<GlobalSelectionAddItemResult<ResultArray<GlobalSelectionItemTypeToDataMap[G_ItemType]>[]>>;
8
+ addItemsToGlobalSelection: (uniqueNewItems: SelectionItemTypeToItemIdMap[G_ItemType][], color?: string) => Promise<GlobalSelectionAddItemResult<ResultArray<GlobalSelectionItemTypeToDataMap[G_ItemType]>[]>>;
9
9
  itemType: G_ItemType;
10
10
  itemCategory: GlobalSelectionCategoryId;
11
11
  categoryOrderIndex: number;
@@ -0,0 +1,5 @@
1
+ import { WritableDraft } from 'immer';
2
+ import { SelectionTreeStore } from '../selectionTree.store.types';
3
+ export type SetFunction = (nextStateOrUpdater: SelectionTreeStore | Partial<SelectionTreeStore> | ((state: WritableDraft<SelectionTreeStore>) => void), shouldReplace?: boolean | undefined, action?: string | {
4
+ type: string;
5
+ } | undefined) => void;
@@ -0,0 +1,20 @@
1
+ import { Guid } from '@equinor/echo-utils';
2
+ import { SelectionTreeStore } from '../selectionTree.store.types';
3
+ import { SetFunction } from './common.action.types';
4
+ /**
5
+ * Creates a new group in the selection tree store if a group with the specified label does not already exist.
6
+ * If a group with the given label exists, returns its groupId instead of creating a new group.
7
+ *
8
+ * @param get - A function that returns the current state of the selection tree store.
9
+ * @param set - A function to update the selection tree store state.
10
+ * @param args - An object containing:
11
+ * @param groupId - (Optional) The ID to assign to the new group. If not provided, a new GUID is generated.
12
+ * @param label - The label for the group. Used to check for existing groups.
13
+ * @param subLabel - The sub-label for the group.
14
+ * @returns The groupId of the newly created group, or the groupId of an existing group with the same label.
15
+ */
16
+ export declare function createGroup(get: () => SelectionTreeStore, set: SetFunction, args: {
17
+ groupId?: string;
18
+ label: string;
19
+ subLabel: string;
20
+ }): Guid;
@@ -0,0 +1,31 @@
1
+ import { Guid } from '@equinor/echo-utils';
2
+ import { GlobalSelectionTypes } from '../../../globalSelectionStore/globalSelectionStore.types';
3
+ import { GlobalSelectionCategoryId } from '../selectionTree.store.types';
4
+ import { SetFunction } from './common.action.types';
5
+ /**
6
+ * Moves items, categories, or groups within the selection tree structure.
7
+ *
8
+ * Depending on the provided arguments, this function will:
9
+ * - Move a single item from one category/group to another.
10
+ * - Move an entire category from one group to another, optionally removing the source group if empty.
11
+ * - Move an entire group to another location, removing the original group.
12
+ *
13
+ * @param set - The state setter function used to update the selection tree.
14
+ * @param args - The arguments specifying the source and target locations for the move operation.
15
+ * - `sourceGroupId`: The ID of the group from which the item/category/group is moved.
16
+ * - `sourceCategoryId`: (Optional) The ID of the category from which the item is moved.
17
+ * - `sourceItemId`: (Optional) The ID of the item to move.
18
+ * - `targetGroupId`: The ID of the group to which the item/category/group is moved.
19
+ *
20
+ * @remarks
21
+ * - If `sourceItemId` is provided, `sourceCategoryId` must also be provided.
22
+ * - After moving a single item, the source group is not removed.
23
+ * - After moving a category or group, the source group may be removed if empty.
24
+ */
25
+ export declare function moveItems(set: SetFunction, args: MoveSelectionArgs): void;
26
+ export type MoveSelectionArgs = {
27
+ sourceGroupId: Guid;
28
+ sourceCategoryId?: GlobalSelectionCategoryId;
29
+ sourceItemId?: GlobalSelectionTypes.ItemId;
30
+ targetGroupId: Guid;
31
+ };
@@ -0,0 +1,21 @@
1
+ import { Guid } from '@equinor/echo-utils';
2
+ import { GlobalSelectionCategoryId } from '../selectionTree.store.types';
3
+ import { SetFunction } from './common.action.types';
4
+ /**
5
+ * Removes a group or a category within a group from the global selection state.
6
+ *
7
+ * If a `categoryId` is provided, only the specified category within the group is cleared of its items.
8
+ * If no `categoryId` is provided, the entire group and all its categories are removed.
9
+ * All items associated with the removed group or category are also removed from the global selection.
10
+ *
11
+ * @param set - The state setter function used to update the selection tree store.
12
+ * @param args - The arguments specifying which group and optionally which category to remove.
13
+ * @param args.groupId - The ID of the group to remove.
14
+ * @param args.categoryId - (Optional) The ID of the category within the group to remove.
15
+ */
16
+ export declare function removeGroupById(set: SetFunction, args: RemoveGroupByIdArgs): void;
17
+ type RemoveGroupByIdArgs = {
18
+ groupId: Guid;
19
+ categoryId?: GlobalSelectionCategoryId;
20
+ };
21
+ export {};
@@ -0,0 +1,24 @@
1
+ import { Guid } from '@equinor/echo-utils';
2
+ import { GlobalSelectionTypes } from '../../../globalSelectionStore/globalSelectionStore.types';
3
+ import { GlobalSelectionCategoryId } from '../selectionTree.store.types';
4
+ import { SetFunction } from './common.action.types';
5
+ /**
6
+ * Removes items from a selection category by their IDs.
7
+ *
8
+ * This function locates the target category within the specified group and removes the provided item IDs.
9
+ * If the group becomes empty after removal, it is also removed from the selection state.
10
+ * Additionally, the items are removed from the global selection.
11
+ *
12
+ * @param set - The state setter function used to update the selection tree store.
13
+ * @param args - Arguments specifying the group ID, category ID, and the list of item IDs to remove.
14
+ * - groupId: The ID of the group containing the category (optional; defaults to local selection group).
15
+ * - categoryId: The ID of the category from which items will be removed.
16
+ * - itemIds: An array of item IDs to be removed from the category.
17
+ */
18
+ export declare function removeItemsById(set: SetFunction, args: RemoveItemsByIdArgs): void;
19
+ type RemoveItemsByIdArgs = {
20
+ groupId?: Guid;
21
+ categoryId: GlobalSelectionCategoryId;
22
+ itemIds: GlobalSelectionTypes.ItemId[];
23
+ };
24
+ export {};