@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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@equinor/echo-framework",
3
- "version": "0.22.0-beta-0",
3
+ "version": "0.22.0",
4
4
  "peerDependencies": {
5
5
  "@equinor/echo-base": ">= 0.7.0 < 0.8.0",
6
6
  "@equinor/echo-components": ">= 0.12.0 < 0.13.0",
package/src/index.d.ts CHANGED
@@ -12,17 +12,19 @@ export { fetchEquipmentFromApi } from './lib/feature/equipment/api/api-equipment
12
12
  export * from './lib/feature/equipment/index';
13
13
  export * from './lib/feature/globalSelection';
14
14
  export { SelectionActionBar } from './lib/feature/globalSelection/components/SelectionActionBar';
15
- export type { OptimizedWorkOrderDto } from './lib/feature/globalSelection/globalSelectionStore/globalSelectionStore.types';
16
15
  export { PanTo3DButton } from './lib/feature/globalSelection/panToEcho3d/panTo3DButton';
17
16
  export { useIsAllIGlobalSelectionItemsHidden } from './lib/feature/globalSelection/selectionMenu/hooks/useIsAllIGlobalSelectionItemsHidden';
18
17
  export { GlobalSelectionCategoryId, SelectionMenuDefaultListIds } from './lib/feature/globalSelection/selectionMenu/selectionTreeStore/selectionTree.store.types';
19
18
  export * from './lib/feature/legacyLegend/index';
19
+ export { PositionalLegendMarkers } from './lib/feature/legend/components/pdfMarkers/PositionalLegendMarkers';
20
+ export * from './lib/feature/legend/index';
21
+ export { subscribeToLegendDataChanged } from './lib/feature/legend/legendUpdater';
22
+ export type { LegendDataId, LegendEquipmentId, LegendState, LegendTagId } from './lib/feature/legend/types/legendType';
20
23
  export { getLatestMeasurementDate, sortMeasuringPointsByMeasurementDate } from './lib/feature/measuringPoint/components/measuringPoints.utils';
21
24
  export * from './lib/feature/measuringPoint/index';
22
25
  export * from './lib/feature/measuringPoint/types/measuringPoint';
23
26
  export * from './lib/feature/openItemsIn3d';
24
27
  export { createEcho3dInternalLink } from './lib/feature/openItemsIn3d/logic/createEcho3dInternalLink';
25
- export { OpenIn3dSelectedItemsMenu } from './lib/feature/openItemsIn3d/OpenIn3dSelectedItemsMenu';
26
28
  export { WorkOrderContent } from './lib/feature/workOrder/WorkOrderContent';
27
29
  export { RegisteredHookName } from './lib/hooks/hookLibrary';
28
30
  export { useCloseActiveTopMenuAtBreakPoint } from './lib/hooks/useCloseActiveTopMenuAtBreakPoint';
@@ -1,7 +1,8 @@
1
1
  import React from 'react';
2
2
  interface CorePanelsProps {
3
3
  children: React.ReactNode;
4
- Legend?: React.FC;
4
+ Legend: React.FC | null | undefined;
5
+ isOnboardingCompleted: boolean;
5
6
  }
6
7
  export declare const EchoContent: React.FC<CorePanelsProps>;
7
8
  export {};
@@ -28,6 +28,8 @@ export interface Equipment {
28
28
  readonly tagId: string | undefined;
29
29
  readonly tagPlantId: string | undefined;
30
30
  readonly userStatusIds: string[];
31
+ readonly partType?: string;
32
+ readonly partTypeText?: string;
31
33
  }
32
34
  export declare enum EquipmentCategoryId {
33
35
  L = "L",
@@ -1,7 +1,7 @@
1
- import { GlobalSelectionTypes, OptimizedWorkOrderDto } from '../globalSelectionStore/globalSelectionStore.types';
1
+ import { GlobalSelectionTypes } from '../globalSelectionStore/globalSelectionStore.types';
2
2
  import { GlobalSelectionCategoryId } from '../selectionMenu/selectionTreeStore/selectionTree.store.types';
3
3
  export interface SelectionActionBarProps {
4
- itemId: GlobalSelectionTypes.TagId | OptimizedWorkOrderDto;
4
+ itemId: GlobalSelectionTypes.ItemId;
5
5
  categoryId: GlobalSelectionCategoryId;
6
6
  }
7
7
  export declare const SelectionActionBar: React.FC<SelectionActionBarProps>;
@@ -1,7 +1,7 @@
1
1
  import { GlobalSelectionTypes } from './globalSelectionStore/globalSelectionStore.types';
2
- import { AddTagsArgs } from './selectionMenu/selectionTreeStore/actions/addTag.action.types';
2
+ import { AddItemArgs } from './selectionMenu/selectionTreeStore/actions/selectionTree.action.types';
3
3
  import { AddTagsReturnType, GlobalSelectionCategoryId, SelectionTreeTypes } from './selectionMenu/selectionTreeStore/selectionTree.store.types';
4
- type AddTagsType = <T extends boolean | undefined = undefined>(args: AddTagsArgs & {
4
+ type AddTagsType = <T extends boolean | undefined = undefined>(args: AddItemArgs<GlobalSelectionTypes.TagId> & {
5
5
  getActionResult?: T;
6
6
  }) => Promise<AddTagsReturnType<T>>;
7
7
  export declare const globalSelectionApi: Readonly<{
@@ -59,7 +59,15 @@ export declare const globalSelectionApi: Readonly<{
59
59
  */
60
60
  listById: (args: {
61
61
  groupId: import("dist/libs/echo-utils/src").Guid;
62
- categoryId?: GlobalSelectionCategoryId;
62
+ categoryId? /**
63
+ * Removes all items by their IDs, from all groups, from the state.
64
+ *
65
+ * If the given item ids are in more than one group, then a confirmation dialog will be shown to confirm the action.
66
+ *
67
+ * @param {Object} args - The arguments object.
68
+ * @param {GlobalSelectionTypes.ItemId[]} args.itemIds - The array of item IDs to remove.
69
+ * @returns {void}
70
+ */: GlobalSelectionCategoryId;
63
71
  }) => void;
64
72
  }>;
65
73
  add: Readonly<{
@@ -67,7 +75,7 @@ export declare const globalSelectionApi: Readonly<{
67
75
  * Adds tags to a selection and updates the state accordingly.
68
76
  * Creates a group if label and sublabel are passed and the group doesn't exist.
69
77
  *
70
- * @param {AddTagsArgs} args - The arguments for adding tags.
78
+ * @param {AddItemArgs} args - The arguments for adding tags.
71
79
  * @param {Array<string>} args.itemIds - The IDs of the items to add tags to.
72
80
  * @param {boolean} [args.replaceItems=false] - Whether to replace existing items with the new tags.
73
81
  * @param {boolean} [args.getActionResult] - Optional, temporary. Will be removed. When passed the function will return with the actionResult as well.
@@ -86,32 +94,20 @@ export declare const globalSelectionApi: Readonly<{
86
94
  *
87
95
  * @param {Object} args - The arguments for adding work orders.
88
96
  * @param {Guid} args.groupId - Optional. The ID of the list to which the work orders should be added. If not provided, it will be added to the "Local Selection".
89
- * @param {Readonly<Readonly<OptimizedWorkOrderDto>[]>} args.items - An array of OptimizedWorkOrderDto objects representing the work orders to be added.
97
+ * @param {Readonly<Readonly<GlobalSelectionTypes.WorkOrderId>[]>} args.items - An array of WorkOrderId objects representing the work orders to be added.
90
98
  */
91
- workOrders: (args: {
92
- groupId?: import("dist/libs/echo-utils/src").Guid;
93
- items: Readonly<Readonly<import("./globalSelectionStore/globalSelectionStore.types").OptimizedWorkOrderDto>[]>;
94
- }) => void;
99
+ workOrders: (args: AddItemArgs<GlobalSelectionTypes.WorkOrderId>) => void;
95
100
  /**
96
101
  * Adds items to a specified list in the selection menu panel.
97
102
  *
98
103
  * @param {Object} args - The arguments for adding items.
99
104
  * @param {Guid} args.groupId - Optional. The ID of the list to which the items should be added. If not provided, the default list ID is used.
100
- * @param {GlobalSelectionTypes.TagId | OptimizedWorkOrderDto)[]} args.itemIds - ItemIds to be added. Only tags or work orders can be added for now.
105
+ * @param {GlobalSelectionTypes.ItemId[]} args.itemIds - ItemIds to be added. Only tags or work orders can be added for now.
101
106
  *
102
107
  */
103
108
  addItems: (args: {
104
- groupId? /**
105
- * Removes items from a specified list in the selection menu panel by their IDs.
106
- *
107
- * @param {Object} args - The arguments for removing items.
108
- * @param {Readonly<GlobalSelectionTypes.ItemId[]>} args.itemIds - An array of item IDs representing the items to be removed.
109
- * @param {Guid} args.groupId - Optional. The ID of the list where the subList of the items are located.
110
- * Local selection will be used by default.
111
- * @param {GlobalSelectionCategoryId} args.category - The ID of the list where the items to be removed are located.
112
- */: import("dist/libs/echo-utils/src").Guid;
113
- itemIds: (GlobalSelectionTypes.TagId | import("./globalSelectionStore/globalSelectionStore.types").OptimizedWorkOrderDto)[];
114
- }) => void;
109
+ itemIds: GlobalSelectionTypes.ItemId[];
110
+ } & import("./selectionMenu/selectionTreeStore/actions/selectionTree.action.types").AddByLabel) => void;
115
111
  }>;
116
112
  search: {
117
113
  /**
@@ -0,0 +1,18 @@
1
+ import { ResultArray } from '@equinor/echo-search';
2
+ import { StoreApi } from 'zustand';
3
+ import { GlobalSelectionItemType, GlobalSelectionItemTypeToDataMap, GlobalSelectionStore, GlobalSelectionTypes } from '../globalSelectionStore.types';
4
+ type FetchFunction<T, U> = (itemIds: Readonly<U[]>) => Promise<ResultArray<T>[]>;
5
+ type NullItemGenerator<T, U> = (itemId: U) => T;
6
+ type ItemIdTypeMap = {
7
+ [GlobalSelectionItemType.WorkOrder]: GlobalSelectionTypes.WorkOrderId;
8
+ [GlobalSelectionItemType.Tag]: GlobalSelectionTypes.TagId;
9
+ [GlobalSelectionItemType.Equipment]: GlobalSelectionTypes.EquipmentId;
10
+ };
11
+ type SetFunction = (set: (state: GlobalSelectionStore) => void, shouldReplace?: boolean | undefined, action?: string) => void;
12
+ export declare function addItemsToSelection<T extends GlobalSelectionItemType>(set: SetFunction, get: StoreApi<GlobalSelectionStore>['getState'], args: {
13
+ itemIds: ItemIdTypeMap[T][];
14
+ }, itemType: T, fetchFunction: FetchFunction<GlobalSelectionItemTypeToDataMap[T], ItemIdTypeMap[T]>, nullItemGenerator: NullItemGenerator<GlobalSelectionItemTypeToDataMap[T], ItemIdTypeMap[T]>): Promise<{
15
+ fetchResult: ResultArray<GlobalSelectionItemTypeToDataMap[T]>[];
16
+ actionResult: GlobalSelectionTypes.ActionResult;
17
+ }>;
18
+ export {};
@@ -0,0 +1,4 @@
1
+ import { WorkOrderData } from '@equinor/echo-search';
2
+ import { GlobalSelectionTypes } from './globalSelectionStore.types';
3
+ export declare function createNullTagSummaryDb(itemId: GlobalSelectionTypes.TagId): GlobalSelectionTypes.TagDto;
4
+ export declare function createNullWorkOrderData(itemId: GlobalSelectionTypes.WorkOrderId): WorkOrderData;
@@ -1,8 +1,7 @@
1
- import { WritableDraft } from 'immer';
2
- import { GlobalSelectionItemType, GlobalSelectionTypes } from './globalSelectionStore.types';
3
- export declare const initialWorkOrderList: WritableDraft<GlobalSelectionTypes.WorkOrderList>;
4
- export declare const initialTagList: WritableDraft<GlobalSelectionTypes.TagList>;
5
- export declare const initialEquipmentList: WritableDraft<GlobalSelectionTypes.EquipmentList>;
1
+ import { GlobalSelectionStore, GlobalSelectionTypes } from './globalSelectionStore.types';
2
+ export declare const initialWorkOrderList: GlobalSelectionTypes.WorkOrderList;
3
+ export declare const initialTagList: GlobalSelectionTypes.TagList;
4
+ export declare const initialEquipmentList: GlobalSelectionTypes.EquipmentList;
6
5
  /**
7
6
  * The single source of truth for items stored in Global Selection.
8
7
  * Each item is stored here once, does not store item grouping in any way.
@@ -21,29 +20,33 @@ export declare const initialEquipmentList: WritableDraft<GlobalSelectionTypes.Eq
21
20
  *
22
21
  * For accessing and using global selection features, use the globalSelectionApi from echo-framework.
23
22
  */
24
- export declare const useGlobalSelectionStore: import("zustand").UseBoundStore<Omit<Omit<Omit<import("zustand").StoreApi<import("./globalSelectionStore.types").GlobalSelectionStore>, "setState"> & {
23
+ export declare const useGlobalSelectionStore: import("zustand").UseBoundStore<Omit<Omit<Omit<Omit<import("zustand").StoreApi<GlobalSelectionStore>, "setState"> & {
25
24
  setState<A extends string | {
26
25
  type: string;
27
- }>(partial: import("./globalSelectionStore.types").GlobalSelectionStore | Partial<import("./globalSelectionStore.types").GlobalSelectionStore> | ((state: import("./globalSelectionStore.types").GlobalSelectionStore) => import("./globalSelectionStore.types").GlobalSelectionStore | Partial<import("./globalSelectionStore.types").GlobalSelectionStore>), replace?: boolean | undefined, action?: A | undefined): void;
26
+ }>(partial: GlobalSelectionStore | Partial<GlobalSelectionStore> | ((state: GlobalSelectionStore) => GlobalSelectionStore | Partial<GlobalSelectionStore>), replace?: boolean | undefined, action?: A | undefined): void;
28
27
  }, "subscribe"> & {
29
28
  subscribe: {
30
- (listener: (selectedState: import("./globalSelectionStore.types").GlobalSelectionStore, previousSelectedState: import("./globalSelectionStore.types").GlobalSelectionStore) => void): () => void;
31
- <U>(selector: (state: import("./globalSelectionStore.types").GlobalSelectionStore) => U, listener: (selectedState: U, previousSelectedState: U) => void, options?: {
29
+ (listener: (selectedState: GlobalSelectionStore, previousSelectedState: GlobalSelectionStore) => void): () => void;
30
+ <U>(selector: (state: GlobalSelectionStore) => U, listener: (selectedState: U, previousSelectedState: U) => void, options?: {
32
31
  equalityFn?: ((a: U, b: U) => boolean) | undefined;
33
32
  fireImmediately?: boolean;
34
33
  } | undefined): () => void;
35
34
  };
35
+ }, "persist"> & {
36
+ persist: {
37
+ setOptions: (options: Partial<import("zustand/middleware").PersistOptions<GlobalSelectionStore, GlobalSelectionStore>>) => void;
38
+ clearStorage: () => void;
39
+ rehydrate: () => Promise<void> | void;
40
+ hasHydrated: () => boolean;
41
+ onHydrate: (fn: (state: GlobalSelectionStore) => void) => () => void;
42
+ onFinishHydration: (fn: (state: GlobalSelectionStore) => void) => () => void;
43
+ getOptions: () => Partial<import("zustand/middleware").PersistOptions<GlobalSelectionStore, GlobalSelectionStore>>;
44
+ };
36
45
  }, "setState"> & {
37
- setState(nextStateOrUpdater: import("./globalSelectionStore.types").GlobalSelectionStore | Partial<import("./globalSelectionStore.types").GlobalSelectionStore> | ((state: WritableDraft<import("./globalSelectionStore.types").GlobalSelectionStore>) => void), shouldReplace?: boolean | undefined, action?: string | {
46
+ setState(nextStateOrUpdater: GlobalSelectionStore | Partial<GlobalSelectionStore> | ((state: import("immer").WritableDraft<GlobalSelectionStore>) => void), shouldReplace?: boolean | undefined, action?: string | {
38
47
  type: string;
39
48
  } | undefined): void;
40
49
  }>;
41
- /**
42
- * Determine if a given selection type has any items being loaded.
43
- * @param {GlobalSelectionItemType} selectionType - A specific type from GlobalSelectionItemType for the list to check.
44
- * @returns {boolean} - Returns true if there are any items being loaded in the specified selection type.
45
- */
46
- export declare function useIsGlobalSelectionListLoading<K extends GlobalSelectionItemType>(selectionType: K): boolean;
47
50
  /**
48
51
  * Get a snapshot of the current global selection store state.
49
52
  *
@@ -0,0 +1,8 @@
1
+ import { PersistOptions } from 'zustand/middleware';
2
+ import { GlobalSelectionStore } from './globalSelectionStore.types';
3
+ declare function loadAndPopulateStoreMetadata(store: GlobalSelectionStore): Promise<void>;
4
+ export declare const globalSelectionRepository: {
5
+ loadAndPopulateStoreMetadata: typeof loadAndPopulateStoreMetadata;
6
+ persistOptions: PersistOptions<GlobalSelectionStore, GlobalSelectionStore>;
7
+ };
8
+ export {};
@@ -1,36 +1,41 @@
1
- import { ResultArray, TagSummaryDto } from '@equinor/echo-search';
1
+ import { ResultArray, TagSummaryDto, WorkOrderData } from '@equinor/echo-search';
2
+ import { Brand } from '@equinor/echo-utils';
2
3
  import { Equipment } from '../../equipment';
3
4
  export declare enum GlobalSelectionItemType {
4
5
  WorkOrder = "WorkOrder",
5
6
  Tag = "Tag",
6
7
  Equipment = "Equipment"
7
8
  }
8
- interface GlobalSelectionItemTypeToDataMap {
9
- WorkOrder: OptimizedWorkOrderDto;
10
- Tag: TagSummaryDto;
9
+ type GlobalSelectionTagDto = TagSummaryDto;
10
+ type GlobalSelectionWorkOrderDto = WorkOrderData;
11
+ export interface GlobalSelectionItemTypeToDataMap {
12
+ WorkOrder: GlobalSelectionWorkOrderDto;
13
+ Tag: GlobalSelectionTagDto;
11
14
  Equipment: Equipment;
12
15
  }
13
16
  type GlobalSelectionList<T extends GlobalSelectionItemType> = {
14
17
  label: string;
15
18
  type: T;
16
- items: GlobalSelectionTypes.GenericItem<T>[];
17
- itemsBeingLoaded: GlobalSelectionTypes.ItemId[];
19
+ items: Map<GlobalSelectionTypes.ItemIdString, GlobalSelectionTypes.GenericItem<T>>;
18
20
  };
19
21
  export type GlobalSelectionObject = {
20
22
  [K in GlobalSelectionItemType]: GlobalSelectionList<K>;
21
23
  };
22
- /**
23
- * @deprecated We plan to make this private in the future: Use the public GlobalSelectionTypes namespace to access this type.
24
- */
25
- export type GlobalSelectionGenericItem<T extends GlobalSelectionItemType> = {
24
+ export interface GlobalSelectionStoreData {
25
+ lists: GlobalSelectionObject;
26
+ }
27
+ export type SelectionItemSystemStatus = 'isLoading' | 'notFound' | 'loadedSuccessfully';
28
+ export interface GlobalSelectionMetaData {
29
+ color: string;
30
+ isHiddenByUser: boolean;
31
+ errorStatus?: string;
32
+ systemStatus: SelectionItemSystemStatus;
33
+ }
34
+ type GlobalSelectionGenericItem<T extends GlobalSelectionItemType> = {
26
35
  id: GlobalSelectionTypes.ItemId;
27
36
  type: T;
28
37
  data: GlobalSelectionTypes.ItemTypeToDataMap[T];
29
- metaData: {
30
- color: string;
31
- isHiddenByUser: boolean;
32
- errorStatus?: string;
33
- };
38
+ metaData: GlobalSelectionMetaData;
34
39
  };
35
40
  type EquipmentGlobalSelectionList = GlobalSelectionTypes.List<GlobalSelectionItemType.Equipment>;
36
41
  type WorkOrderGlobalSelectionList = GlobalSelectionTypes.List<GlobalSelectionItemType.WorkOrder>;
@@ -40,14 +45,13 @@ interface ItemErrorStatusUpdates {
40
45
  itemId: GlobalSelectionTypes.ItemId;
41
46
  errorStatus: string;
42
47
  }
43
- export interface GlobalSelectionStore {
44
- lists: GlobalSelectionObject;
48
+ export interface GlobalSelectionStore extends GlobalSelectionStoreData {
45
49
  addWorkOrdersToSelection: (args: {
46
- workOrders: Readonly<OptimizedWorkOrderDto[]>;
47
- }) => void;
50
+ workOrderIds: GlobalSelectionTypes.WorkOrderId[];
51
+ }) => Promise<GlobalSelectionAddItemResult<ResultArray<WorkOrderData>[]>>;
48
52
  addTagsToSelection: (args: {
49
- tagIds: Readonly<GlobalSelectionTypes.TagId[]>;
50
- }) => Promise<AddTagActionResult>;
53
+ tagIds: GlobalSelectionTypes.TagId[];
54
+ }) => Promise<GlobalSelectionAddItemResult<ResultArray<TagSummaryDto>[]>>;
51
55
  removeItemsFromSelection: (args: {
52
56
  itemIds: ReadonlyArray<GlobalSelectionTypes.ItemId>;
53
57
  }) => void;
@@ -55,6 +59,10 @@ export interface GlobalSelectionStore {
55
59
  itemIds: Readonly<Readonly<GlobalSelectionTypes.ItemId>>[];
56
60
  isVisible: boolean;
57
61
  }) => void;
62
+ setItemMetaData: (args: ReadonlyArray<{
63
+ itemId: GlobalSelectionTypes.ItemId;
64
+ metaData: Partial<GlobalSelectionMetaData>;
65
+ }>) => void;
58
66
  resetItemErrorStatuses: () => void;
59
67
  resetState: () => void;
60
68
  setErrorStatusForItems: (args: {
@@ -65,15 +73,18 @@ export interface GlobalSelectionStore {
65
73
  }) => void;
66
74
  }
67
75
  type GlobalSelectionActionResult = 'NoChanges' | 'ItemsAdded';
68
- type AddTagActionResult = {
69
- fetchResult: ResultArray<TagSummaryDto>[];
76
+ export type GlobalSelectionAddItemResult<DataType> = {
77
+ fetchResult: DataType;
70
78
  actionResult: GlobalSelectionActionResult;
71
79
  };
72
80
  export declare namespace GlobalSelectionTypes {
73
- type WorkOrderId = Pick<OptimizedWorkOrderDto, 'workOrderId'>;
81
+ type WorkOrderId = Pick<GlobalSelectionWorkOrderDto, 'workOrderId'>;
74
82
  type EquipmentId = Pick<Equipment, 'equipmentId'>;
75
83
  type TagId = Pick<TagSummaryDto, 'tagNo' | 'instCode'>;
76
84
  type ItemId = WorkOrderId | EquipmentId | TagId;
85
+ type ItemIdString = Brand<string, 'ItemIdString'>;
86
+ type TagDto = GlobalSelectionTagDto;
87
+ type WorkOrderDto = GlobalSelectionWorkOrderDto;
77
88
  type EquipmentItem = GlobalSelectionGenericItem<GlobalSelectionItemType.Equipment>;
78
89
  type WorkOrderItem = GlobalSelectionGenericItem<GlobalSelectionItemType.WorkOrder>;
79
90
  type TagItem = GlobalSelectionGenericItem<GlobalSelectionItemType.Tag>;
@@ -88,37 +99,8 @@ export declare namespace GlobalSelectionTypes {
88
99
  type EquipmentList = EquipmentGlobalSelectionList;
89
100
  type ListUnion = GlobalSelectionListUnion;
90
101
  type ItemTypeToDataMap = GlobalSelectionItemTypeToDataMap;
91
- type AddTagResult = AddTagActionResult;
92
- }
93
- export interface OptimizedWorkOrderDto {
94
- workOrderId: string;
95
- tagId: string | undefined;
96
- tagPlantId: string;
97
- workCenterId?: string;
98
- workCenterPlantId: string;
99
- plannerGroupId: string;
100
- workOrderTypeId: string;
101
- revisionCodeId: string;
102
- systemId?: string;
103
- isOpen: boolean;
104
- hasStatusTECO: boolean;
105
- hasStatusRDOP: boolean;
106
- hasStatusCANC: boolean;
107
- hasStatusSTRT: boolean;
108
- hasStatusRDEX: boolean;
109
- hasStatusPREP: boolean;
110
- hasStatusPRCO: boolean;
111
- title: string;
112
- plantId: string;
113
- planningPlantId: string;
114
- sortField: string;
115
- locationId: string;
116
- revisionId: string;
117
- basicStartDateTime?: string | null;
118
- basicEndDateTime?: string | null;
119
- createdDateTime?: string | null;
120
- _links: {
121
- related: string;
122
- };
102
+ type AddTagResult = GlobalSelectionAddItemResult<ResultArray<TagSummaryDto>[]>;
103
+ type ActionResult = GlobalSelectionActionResult;
104
+ type ItemSystemStatus = SelectionItemSystemStatus;
123
105
  }
124
106
  export {};
@@ -1,6 +1,4 @@
1
1
  import { GlobalSelectionItemType, GlobalSelectionTypes } from './globalSelectionStore.types';
2
- export declare function toGlobalSelectionItem<T extends GlobalSelectionTypes.ItemTypeToDataMap[K], K extends GlobalSelectionItemType>(item: T, type: K): GlobalSelectionTypes.GenericItem<K>;
3
- export declare function toGlobalSelectionItems<T extends GlobalSelectionTypes.ItemTypeToDataMap[K], K extends GlobalSelectionItemType>(items: T[], type: K): GlobalSelectionTypes.GenericItem<K>[];
4
2
  declare function idsEqual(itemA: GlobalSelectionTypes.ItemId, itemB: GlobalSelectionTypes.ItemId): boolean;
5
3
  declare function isWorkOrderId(itemId: GlobalSelectionTypes.ItemId): itemId is GlobalSelectionTypes.WorkOrderId;
6
4
  declare function isEquipmentId(itemId: GlobalSelectionTypes.ItemId): itemId is GlobalSelectionTypes.EquipmentId;
@@ -31,7 +29,8 @@ declare function mapToId(item: GlobalSelectionTypes.WorkOrderId): GlobalSelectio
31
29
  declare function mapToId(item: GlobalSelectionTypes.EquipmentId): GlobalSelectionTypes.EquipmentId;
32
30
  declare function mapToId(item: GlobalSelectionTypes.TagId): GlobalSelectionTypes.TagId;
33
31
  declare function mapToId(item: GlobalSelectionTypes.ItemId): GlobalSelectionTypes.ItemId;
34
- declare function itemIdToString(itemId: GlobalSelectionTypes.ItemId): string;
32
+ declare function itemIdToString(itemId: GlobalSelectionTypes.ItemId): GlobalSelectionTypes.ItemIdString;
33
+ export declare function mapIdToItemType(itemId: GlobalSelectionTypes.ItemId): GlobalSelectionItemType;
35
34
  /**
36
35
  * A utility object that provides various functions for handling global selections.
37
36
  *
@@ -49,6 +48,7 @@ export declare const globalSelectionUtils: Readonly<{
49
48
  isTagId: typeof isTagId;
50
49
  idsEqual: typeof idsEqual;
51
50
  mapToId: typeof mapToId;
51
+ mapIdToItemType: typeof mapIdToItemType;
52
52
  itemIdToString: typeof itemIdToString;
53
53
  }>;
54
54
  export {};
@@ -1,4 +1,5 @@
1
1
  import { PlantAndTagForOpenIn3d } from '../../openItemsIn3d/logic/openItemsIn3d.utils';
2
+ import { GlobalSelectionItemType, GlobalSelectionTypes, SelectionItemSystemStatus } from './globalSelectionStore.types';
2
3
  /**
3
4
  * Converts global selection items to plant tag pairs.
4
5
  *
@@ -12,3 +13,15 @@ import { PlantAndTagForOpenIn3d } from '../../openItemsIn3d/logic/openItemsIn3d.
12
13
  * @returns {Promise<PlantAndTagForOpenIn3d[]>} A promise that resolves to an array of plant tag pairs.
13
14
  */
14
15
  export declare function convertGlobalSelectionItemsToPlantTagPairs(): Promise<PlantAndTagForOpenIn3d[]>;
16
+ export declare function toGlobalSelectionItem<T extends GlobalSelectionTypes.ItemTypeToDataMap[K], K extends GlobalSelectionItemType>(item: T, type: K, systemStatus: SelectionItemSystemStatus): GlobalSelectionTypes.GenericItem<K>;
17
+ export declare function toGlobalSelectionItems<T extends GlobalSelectionTypes.ItemTypeToDataMap[K], K extends GlobalSelectionItemType>(items: T[], type: K, systemStatus: SelectionItemSystemStatus): GlobalSelectionTypes.GenericItem<K>[];
18
+ export declare function finalizeLoadStateByItemType<T extends GlobalSelectionItemType>(args: {
19
+ itemType: GlobalSelectionItemType;
20
+ state: GlobalSelectionTypes.Store;
21
+ itemDataToStore: GlobalSelectionTypes.ItemTypeToDataMap[T][];
22
+ }): void;
23
+ export declare function setNotFoundStatusByItemIds(args: {
24
+ itemType: GlobalSelectionItemType;
25
+ state: GlobalSelectionTypes.Store;
26
+ notFoundItemIds: GlobalSelectionTypes.ItemId[];
27
+ }): void;
@@ -0,0 +1,2 @@
1
+ import { GlobalSelectionItemType, GlobalSelectionTypes } from '../globalSelectionStore/globalSelectionStore.types';
2
+ export declare function useGlobalSelectionByItemId<T extends GlobalSelectionItemType>(itemType: T, itemId: GlobalSelectionTypes.ItemId): GlobalSelectionTypes.GenericItem<T> | undefined;
@@ -0,0 +1,7 @@
1
+ import { GlobalSelectionItemType, GlobalSelectionTypes } from '../globalSelectionStore/globalSelectionStore.types';
2
+ /**
3
+ *
4
+ * @param {GlobalSelectionItemType} itemType
5
+ * @returns Array of given item types stored in global selection.
6
+ */
7
+ export declare function useGlobalSelectionItemsByType<T extends GlobalSelectionItemType>(itemType: T): GlobalSelectionTypes.GenericItem<T>[];
@@ -1,19 +1,8 @@
1
1
  /**
2
2
  * Hook for returning all lists stored in the global selection.
3
3
  */
4
- export declare function useGlobalSelectionLists(): ({
4
+ export declare function useGlobalSelectionLists(): {
5
5
  label: string;
6
- type: import("..").GlobalSelectionItemType.WorkOrder;
7
- items: import("..").GlobalSelectionTypes.GenericItem<import("..").GlobalSelectionItemType.WorkOrder>[];
8
- itemsBeingLoaded: import("..").GlobalSelectionTypes.ItemId[];
9
- } | {
10
- label: string;
11
- type: import("..").GlobalSelectionItemType.Tag;
12
- items: import("..").GlobalSelectionTypes.GenericItem<import("..").GlobalSelectionItemType.Tag>[];
13
- itemsBeingLoaded: import("..").GlobalSelectionTypes.ItemId[];
14
- } | {
15
- label: string;
16
- type: import("..").GlobalSelectionItemType.Equipment;
17
- items: import("..").GlobalSelectionTypes.GenericItem<import("..").GlobalSelectionItemType.Equipment>[];
18
- itemsBeingLoaded: import("..").GlobalSelectionTypes.ItemId[];
19
- })[];
6
+ type: import("..").GlobalSelectionItemType;
7
+ items: (import("..").GlobalSelectionTypes.GenericItem<import("..").GlobalSelectionItemType.WorkOrder> | import("..").GlobalSelectionTypes.GenericItem<import("..").GlobalSelectionItemType.Tag> | import("..").GlobalSelectionTypes.GenericItem<import("..").GlobalSelectionItemType.Equipment>)[];
8
+ }[];
@@ -1,13 +1,15 @@
1
+ export { RemoveSelectionItemsConfirmDialog } from './components/RemoveSelectionItemsConfirmDialog';
1
2
  export { globalSelectionApi } from './globalSelection.api';
2
3
  export * from './globalSelectionStore/globalSelectionStore.types';
3
4
  export { globalSelectionUtils } from './globalSelectionStore/globalSelectionStore.utils';
4
5
  export { convertGlobalSelectionItemsToPlantTagPairs } from './globalSelectionStore/globalSelectionStoreHelpers';
6
+ export { useGlobalSelectionByItemId } from './hooks/useGlobalSelectionByItemId';
5
7
  export { useGlobalSelectionItems } from './hooks/useGlobalSelectionItems';
8
+ export { useGlobalSelectionItemsByType } from './hooks/useGlobalSelectionItemsByType';
6
9
  export { useGlobalSelectionLists } from './hooks/useGlobalSelectionLists';
7
10
  export { useGlobalSelectionTags } from './hooks/useGlobalSelectionTags';
8
11
  export { useGlobalSelectionWorkOrders } from './hooks/useGlobalSelectionWorkOrders';
9
12
  export { useSelectionCategoriesByGroupId } from './hooks/useSelectionCategoriesByGroupId';
10
13
  export { OpenGlobalSelectionIn3DButton } from './OpenGlobalSelectionIn3DButton';
11
14
  export { useSelectionMenuGroups } from './selectionMenu/hooks/useSelectionMenuGroups';
12
- export { RemoveSelectionItemsConfirmDialog } from './components/RemoveSelectionItemsConfirmDialog';
13
15
  export * from './selectionMenu/selectionTreeStore/selectionTree.store.types';
@@ -1,5 +1,5 @@
1
1
  import { Guid } from '@equinor/echo-utils';
2
- interface useIsAllIGlobalSelectionItemsHiddenArgs {
2
+ interface UseIsAllIGlobalSelectionItemsHiddenArgs {
3
3
  groupId: Guid;
4
4
  categoryId?: string;
5
5
  }
@@ -15,5 +15,5 @@ interface useIsAllIGlobalSelectionItemsHiddenArgs {
15
15
  *
16
16
  * The hook returns `true` if all items in the list are hidden by the user, and `false` otherwise.
17
17
  */
18
- export declare const useIsAllIGlobalSelectionItemsHidden: (args: useIsAllIGlobalSelectionItemsHiddenArgs) => boolean;
18
+ export declare const useIsAllIGlobalSelectionItemsHidden: (args: UseIsAllIGlobalSelectionItemsHiddenArgs) => boolean;
19
19
  export {};
@@ -0,0 +1,13 @@
1
+ import { ResultArray, TagSummaryDto } from '@equinor/echo-search';
2
+ import { StoreApi } from 'zustand';
3
+ import { GlobalSelectionTypes } from '../../../globalSelectionStore/globalSelectionStore.types';
4
+ import { SelectionTreeStore } from '../selectionTree.store.types';
5
+ import { AddItemArgs, AddItemsResponse } from './selectionTree.action.types';
6
+ type SetFunction = (set: (state: SelectionTreeStore) => void, shouldReplace?: boolean | undefined, action?: string) => void;
7
+ export declare function addTagsAction(set: SetFunction, get: StoreApi<SelectionTreeStore>['getState'], args: AddItemArgs<GlobalSelectionTypes.TagId> & {
8
+ getActionResult: true;
9
+ }): Promise<AddItemsResponse<ResultArray<TagSummaryDto>[]>>;
10
+ export declare function addTagsAction(set: SetFunction, get: StoreApi<SelectionTreeStore>['getState'], args: AddItemArgs<GlobalSelectionTypes.TagId> & {
11
+ getActionResult?: false;
12
+ }): Promise<ResultArray<TagSummaryDto>[]>;
13
+ export {};
@@ -0,0 +1,6 @@
1
+ import { WorkOrderData } from '@equinor/echo-search';
2
+ import { GlobalSelectionTypes } from '../../../globalSelectionStore/globalSelectionStore.types';
3
+ export declare const addWorkOrdersAction: (set: (set: (state: import("../selectionTree.store.types").SelectionTreeStore) => void, shouldReplace?: boolean | undefined, action?: string) => void, get: import("zustand").StoreApi<import("../selectionTree.store.types").SelectionTreeStore>["getState"], args: import("./selectionTree.action.types").AddItemArgs<GlobalSelectionTypes.WorkOrderId>) => Promise<import("./selectionTree.action.types").AddItemsResponse<import("@equinor/echo-search").ResultArray<unknown>[]> | {
4
+ fetchResults: import("@equinor/echo-search").ResultArray<WorkOrderData>[][];
5
+ actionResult: string;
6
+ }>;
@@ -0,0 +1,16 @@
1
+ import { ResultArray } from '@equinor/echo-search';
2
+ import { StoreApi } from 'zustand';
3
+ import { GlobalSelectionAddItemResult, GlobalSelectionItemType, GlobalSelectionTypes } from '../../../globalSelectionStore/globalSelectionStore.types';
4
+ import { GlobalSelectionCategoryId, SelectionTreeStore } from '../selectionTree.store.types';
5
+ import { AddItemArgs, AddItemsResponse } from './selectionTree.action.types';
6
+ type SetFunction = (set: (state: SelectionTreeStore) => void, shouldReplace?: boolean | undefined, action?: string) => void;
7
+ export declare function addItemsActionFactory<G_ItemId extends GlobalSelectionTypes.ItemId, G_ResponseData>(args: {
8
+ addItemToGlobalSelection: (uniqueNewItems: G_ItemId[]) => Promise<GlobalSelectionAddItemResult<ResultArray<G_ResponseData>[]>>;
9
+ itemType: GlobalSelectionItemType;
10
+ itemCategory: GlobalSelectionCategoryId;
11
+ categoryOrderIndex: number;
12
+ }): (set: SetFunction, get: StoreApi<SelectionTreeStore>["getState"], args: AddItemArgs<G_ItemId>) => Promise<AddItemsResponse<ResultArray<unknown>[]> | {
13
+ fetchResults: ResultArray<G_ResponseData>[][];
14
+ actionResult: string;
15
+ }>;
16
+ export {};
@@ -1,7 +1,6 @@
1
- import { WritableDraft } from 'immer';
2
1
  import { GlobalSelectionTypes } from '../../../globalSelectionStore/globalSelectionStore.types';
3
2
  import { SelectionTreeStore } from '../selectionTree.store.types';
4
- type SetFunction = (set: (state: WritableDraft<SelectionTreeStore>) => void, shouldReplace?: boolean | undefined, action?: string) => void;
3
+ type SetFunction = (set: (state: SelectionTreeStore) => void, shouldReplace?: boolean | undefined, action?: string) => void;
5
4
  /**
6
5
  * Removes all items by their IDs, from all groups, from the state.
7
6
  *
@@ -1,18 +1,16 @@
1
- import { ResultArray, TagSummaryDto } from '@equinor/echo-search';
2
1
  import { GlobalSelectionTypes } from '../../../globalSelectionStore/globalSelectionStore.types';
3
- export type AddTagsArgs = {
4
- itemIds: Readonly<GlobalSelectionTypes.TagId[]>;
5
- replaceItems?: boolean;
6
- getActionResult?: boolean;
7
- } & ({
8
- label: string;
9
- subLabel: string;
10
- } | {
2
+ import { SelectionBase } from '../selectionTree.store.types';
3
+ export type AddByLabel = SelectionBase | {
11
4
  label?: undefined;
12
5
  subLabel?: undefined;
13
- });
14
- export type AddTagsResponse = {
15
- fetchResults: ResultArray<TagSummaryDto>[];
6
+ };
7
+ export type AddItemArgs<ItemIdType extends GlobalSelectionTypes.ItemId> = {
8
+ itemIds: Readonly<ItemIdType[]>;
9
+ replaceItems?: boolean;
10
+ getActionResult?: boolean;
11
+ } & AddByLabel;
12
+ export type AddItemsResponse<FetchResponseType> = {
13
+ fetchResults: FetchResponseType;
16
14
  actionResult: SelectionTreeActionResult;
17
15
  };
18
16
  export type SelectionTreeActionResult = 'ItemsUpdated' | 'ItemsAdded' | 'NewGroupCreated' | 'NoChanges';
@@ -1,5 +1,5 @@
1
1
  import { SelectionTreeStore } from './selectionTree.store.types';
2
- export declare const useSelectionTreeStore: import("zustand").UseBoundStore<Omit<Omit<Omit<import("zustand").StoreApi<SelectionTreeStore>, "setState"> & {
2
+ export declare const useSelectionTreeStore: import("zustand").UseBoundStore<Omit<Omit<Omit<Omit<import("zustand").StoreApi<SelectionTreeStore>, "setState"> & {
3
3
  setState<A extends string | {
4
4
  type: string;
5
5
  }>(partial: SelectionTreeStore | Partial<SelectionTreeStore> | ((state: SelectionTreeStore) => SelectionTreeStore | Partial<SelectionTreeStore>), replace?: boolean | undefined, action?: A | undefined): void;
@@ -11,6 +11,16 @@ export declare const useSelectionTreeStore: import("zustand").UseBoundStore<Omit
11
11
  fireImmediately?: boolean;
12
12
  } | undefined): () => void;
13
13
  };
14
+ }, "persist"> & {
15
+ persist: {
16
+ setOptions: (options: Partial<import("zustand/middleware").PersistOptions<SelectionTreeStore, SelectionTreeStore>>) => void;
17
+ clearStorage: () => void;
18
+ rehydrate: () => Promise<void> | void;
19
+ hasHydrated: () => boolean;
20
+ onHydrate: (fn: (state: SelectionTreeStore) => void) => () => void;
21
+ onFinishHydration: (fn: (state: SelectionTreeStore) => void) => () => void;
22
+ getOptions: () => Partial<import("zustand/middleware").PersistOptions<SelectionTreeStore, SelectionTreeStore>>;
23
+ };
14
24
  }, "setState"> & {
15
25
  setState(nextStateOrUpdater: SelectionTreeStore | Partial<SelectionTreeStore> | ((state: import("immer").WritableDraft<SelectionTreeStore>) => void), shouldReplace?: boolean | undefined, action?: string | {
16
26
  type: string;
@@ -0,0 +1,8 @@
1
+ import { PersistOptions } from 'zustand/middleware';
2
+ import { SelectionTreeStore } from './selectionTree.store.types';
3
+ declare function loadAndPopulateStore(store: SelectionTreeStore): Promise<void>;
4
+ export declare const selectionTreeRepository: {
5
+ loadAndPopulateStore: typeof loadAndPopulateStore;
6
+ persistOptions: PersistOptions<SelectionTreeStore, SelectionTreeStore>;
7
+ };
8
+ export {};