@equinor/echo-framework 0.20.11 → 0.20.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@equinor/echo-framework",
3
- "version": "0.20.11",
3
+ "version": "0.20.12",
4
4
  "peerDependencies": {
5
5
  "@equinor/echo-base": ">= 0.7.0 < 0.8.0",
6
6
  "@equinor/echo-components": ">= 0.11.0 < 0.12.0",
@@ -1,18 +1,18 @@
1
- import { GlobalSelectionStore } from './globalSelectionStore.types';
2
- export declare const useGlobalSelectionStore: import("zustand").UseBoundStore<Omit<Omit<Omit<import("zustand").StoreApi<GlobalSelectionStore>, "setState"> & {
1
+ import { GlobalSelectionTypes } from './globalSelectionStore.types';
2
+ export declare const useGlobalSelectionStore: import("zustand").UseBoundStore<Omit<Omit<Omit<import("zustand").StoreApi<import("./globalSelectionStore.types").GlobalSelectionStore>, "setState"> & {
3
3
  setState<A extends string | {
4
4
  type: string;
5
- }>(partial: GlobalSelectionStore | Partial<GlobalSelectionStore> | ((state: GlobalSelectionStore) => GlobalSelectionStore | Partial<GlobalSelectionStore>), replace?: boolean | undefined, action?: A | undefined): void;
5
+ }>(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;
6
6
  }, "subscribe"> & {
7
7
  subscribe: {
8
- (listener: (selectedState: GlobalSelectionStore, previousSelectedState: GlobalSelectionStore) => void): () => void;
9
- <U>(selector: (state: GlobalSelectionStore) => U, listener: (selectedState: U, previousSelectedState: U) => void, options?: {
8
+ (listener: (selectedState: import("./globalSelectionStore.types").GlobalSelectionStore, previousSelectedState: import("./globalSelectionStore.types").GlobalSelectionStore) => void): () => void;
9
+ <U>(selector: (state: import("./globalSelectionStore.types").GlobalSelectionStore) => U, listener: (selectedState: U, previousSelectedState: U) => void, options?: {
10
10
  equalityFn?: ((a: U, b: U) => boolean) | undefined;
11
11
  fireImmediately?: boolean;
12
12
  } | undefined): () => void;
13
13
  };
14
14
  }, "setState"> & {
15
- setState(nextStateOrUpdater: GlobalSelectionStore | Partial<GlobalSelectionStore> | ((state: import("immer").WritableDraft<GlobalSelectionStore>) => void), shouldReplace?: boolean | undefined, action?: string | {
15
+ setState(nextStateOrUpdater: import("./globalSelectionStore.types").GlobalSelectionStore | Partial<import("./globalSelectionStore.types").GlobalSelectionStore> | ((state: import("immer").WritableDraft<import("./globalSelectionStore.types").GlobalSelectionStore>) => void), shouldReplace?: boolean | undefined, action?: string | {
16
16
  type: string;
17
17
  } | undefined): void;
18
18
  }>;
@@ -25,4 +25,4 @@ export declare function useIsGlobalSelectionListLoading(listKey: string): boolea
25
25
  /**
26
26
  * Get a snapshot of the current global selection store state.
27
27
  */
28
- export declare function getGlobalSelectionStoreState(): GlobalSelectionStore;
28
+ export declare function getGlobalSelectionStoreState(): GlobalSelectionTypes.Store;
@@ -5,81 +5,133 @@ export declare enum GlobalSelectionItemType {
5
5
  Tag = "Tag",
6
6
  Equipment = "Equipment"
7
7
  }
8
+ /**
9
+ * @deprecated We plan to make this private in the future: Use the public GlobalSelectionTypes namespace to access this type.
10
+ */
8
11
  export interface GlobalSelectionItemTypeToDataMap {
9
12
  WorkOrder: OptimizedWorkOrderDto;
10
13
  Tag: TagSummaryDto;
11
14
  Equipment: Equipment;
12
15
  }
16
+ /**
17
+ * @deprecated We plan to make this private in the future: Use the public GlobalSelectionTypes namespace to access this type.
18
+ */
13
19
  export type GlobalSelectionList<T extends GlobalSelectionItemType> = {
14
20
  label: string;
15
21
  key: string;
16
22
  type: T;
17
- items: GlobalSelectionGenericItem<T>[];
18
- itemsBeingLoaded: string[];
23
+ items: GlobalSelectionTypes.GenericItem<T>[];
24
+ itemsBeingLoaded: GlobalSelectionTypes.ItemId[];
19
25
  };
26
+ /**
27
+ * @deprecated We plan to make this private in the future: Use the public GlobalSelectionTypes namespace to access this type.
28
+ */
20
29
  export type GlobalSelectionGenericItem<T extends GlobalSelectionItemType> = {
21
- id: string;
30
+ id: GlobalSelectionTypes.ItemId;
22
31
  type: T;
23
- data: GlobalSelectionItemTypeToDataMap[T];
32
+ data: GlobalSelectionTypes.ItemTypeToDataMap[T];
24
33
  metaData: {
25
34
  color: string;
26
35
  isHiddenByUser: boolean;
27
36
  errorStatus?: string;
28
37
  };
29
38
  };
30
- export type EquipmentGlobalSelectionListItem = GlobalSelectionGenericItem<GlobalSelectionItemType.Equipment>;
31
- export type WorkOrderGlobalSelectionListItem = GlobalSelectionGenericItem<GlobalSelectionItemType.WorkOrder>;
32
- export type TagGlobalSelectionListItem = GlobalSelectionGenericItem<GlobalSelectionItemType.Tag>;
39
+ export type EquipmentGlobalSelectionListItem = GlobalSelectionTypes.GenericItem<GlobalSelectionItemType.Equipment>;
40
+ /**
41
+ * @deprecated We plan to make this private in the future: Use the public GlobalSelectionTypes namespace to access this type.
42
+ */
43
+ export type WorkOrderGlobalSelectionListItem = GlobalSelectionTypes.GenericItem<GlobalSelectionItemType.WorkOrder>;
44
+ /**
45
+ * @deprecated We plan to make this private in the future: Use the public GlobalSelectionTypes namespace to access this type.
46
+ */
47
+ export type TagGlobalSelectionListItem = GlobalSelectionTypes.GenericItem<GlobalSelectionItemType.Tag>;
48
+ /**
49
+ * @deprecated We plan to make this private in the future: Use the public namespace, GlobalSelectionTypes.SelectionItem type instead.
50
+ */
33
51
  export type GlobalSelectionItem = WorkOrderGlobalSelectionListItem | TagGlobalSelectionListItem | EquipmentGlobalSelectionListItem;
34
- type EquipmentGlobalSelectionList = GlobalSelectionList<GlobalSelectionItemType.Equipment>;
35
- export type WorkOrderGlobalSelectionList = GlobalSelectionList<GlobalSelectionItemType.WorkOrder>;
36
- export type TagGlobalSelectionList = GlobalSelectionList<GlobalSelectionItemType.Tag>;
52
+ /**
53
+ * @deprecated We plan to make this private in the future: Use the public GlobalSelectionTypes namespace to access this type.
54
+ */
55
+ type EquipmentGlobalSelectionList = GlobalSelectionTypes.List<GlobalSelectionItemType.Equipment>;
56
+ /**
57
+ * @deprecated We plan to make this private in the future: Use the public GlobalSelectionTypes namespace to access this type.
58
+ */
59
+ export type WorkOrderGlobalSelectionList = GlobalSelectionTypes.List<GlobalSelectionItemType.WorkOrder>;
60
+ /**
61
+ * @deprecated We plan to make this private in the future: Use the public GlobalSelectionTypes namespace to access this type.
62
+ */
63
+ export type TagGlobalSelectionList = GlobalSelectionTypes.List<GlobalSelectionItemType.Tag>;
64
+ /**
65
+ * @deprecated We plan to make this private in the future: Use the public GlobalSelectionTypes namespace to access this type.
66
+ */
37
67
  export type GlobalSelectionListUnion = WorkOrderGlobalSelectionList | TagGlobalSelectionList | EquipmentGlobalSelectionList;
68
+ /**
69
+ * @deprecated We plan to make this private in the future: Use the public GlobalSelectionTypes namespace to access this type.
70
+ */
38
71
  export interface ItemErrorStatusUpdates {
39
- itemId: string;
72
+ itemId: GlobalSelectionTypes.ItemId;
40
73
  errorStatus: string;
41
74
  }
75
+ /**
76
+ * @deprecated We plan to make this private in the future: Use the public GlobalSelectionTypes namespace to access this type.
77
+ */
42
78
  export interface GlobalSelectionStore {
43
- lists: GlobalSelectionListUnion[];
79
+ lists: GlobalSelectionTypes.ListUnion[];
44
80
  addWorkOrdersToSelection: (args: {
45
81
  workOrders: Readonly<OptimizedWorkOrderDto[]>;
46
82
  }) => void;
47
- addTagToSelection: (args: {
48
- tagId: string;
49
- }) => Promise<ResultValue<TagSummaryDto>>;
83
+ addTagToSelection: (args: GlobalSelectionTypes.TagId) => Promise<ResultValue<TagSummaryDto>>;
50
84
  addTagsToSelection: (args: {
51
85
  tags: Readonly<TagSummaryDto[]>;
52
86
  }) => void;
53
- removeItemFromSelection: (args: {
54
- itemId: string;
55
- }) => void;
87
+ removeItemFromSelection: (itemId: Readonly<GlobalSelectionTypes.ItemId>) => void;
56
88
  setVisibilityList: (args: {
57
89
  listKey: string;
58
90
  isVisible: boolean;
59
91
  }) => void;
60
92
  setVisibility: (args: {
61
- itemId: string;
93
+ itemId: Readonly<GlobalSelectionTypes.ItemId>;
62
94
  isVisible: boolean;
63
95
  }) => void;
64
96
  /**
65
97
  *@deprecated This method is deprecated. Use `removeErrorStatusForItems` instead.
66
98
  */
67
99
  resetItemNotFoundStates: () => void;
100
+ resetItemErrorStatuses: () => void;
68
101
  resetState: () => void;
69
102
  setErrorStatusForItems: (args: {
70
- itemErrorStatuses: ItemErrorStatusUpdates[];
103
+ itemErrorStatuses: GlobalSelectionTypes.ItemErrorStatusUpdate[];
71
104
  }) => void;
72
105
  removeErrorStatusForItems: (args: {
73
- itemIds: string[];
106
+ itemIds: Readonly<GlobalSelectionTypes.ItemId[]>;
74
107
  }) => void;
75
108
  /**
76
109
  *@deprecated This method is deprecated. Use `setStatusForItems` instead.
77
110
  */
78
111
  setNotFoundItems: (args: {
79
- itemIds: string[];
112
+ itemIds: Readonly<GlobalSelectionTypes.ItemId[]>;
80
113
  }) => void;
81
114
  }
82
- export type OptimizedWorkOrderDto = {
115
+ export declare namespace GlobalSelectionTypes {
116
+ type WorkOrderId = Pick<OptimizedWorkOrderDto, 'workOrderId'>;
117
+ type EquipmentId = Pick<Equipment, 'equipmentId'>;
118
+ type TagId = Pick<TagSummaryDto, 'tagNo' | 'instCode'>;
119
+ type ItemId = WorkOrderId | EquipmentId | TagId;
120
+ type EquipmentItem = GlobalSelectionGenericItem<GlobalSelectionItemType.Equipment>;
121
+ type WorkOrderItem = GlobalSelectionGenericItem<GlobalSelectionItemType.WorkOrder>;
122
+ type TagItem = GlobalSelectionGenericItem<GlobalSelectionItemType.Tag>;
123
+ type List<T extends GlobalSelectionItemType> = GlobalSelectionList<T>;
124
+ type SelectionItem = EquipmentItem | WorkOrderItem | TagItem;
125
+ type GenericItem<T extends GlobalSelectionItemType> = GlobalSelectionGenericItem<T>;
126
+ type Store = GlobalSelectionStore;
127
+ type ItemErrorStatusUpdate = ItemErrorStatusUpdates;
128
+ type WorkOrderList = WorkOrderGlobalSelectionList;
129
+ type TagList = TagGlobalSelectionList;
130
+ type EquipmentList = EquipmentGlobalSelectionList;
131
+ type ListUnion = GlobalSelectionListUnion;
132
+ type ItemTypeToDataMap = GlobalSelectionItemTypeToDataMap;
133
+ }
134
+ export interface OptimizedWorkOrderDto {
83
135
  workOrderId: string;
84
136
  tagId: string | undefined;
85
137
  tagPlantId: string;
@@ -109,5 +161,5 @@ export type OptimizedWorkOrderDto = {
109
161
  _links: {
110
162
  related: string;
111
163
  };
112
- };
164
+ }
113
165
  export {};
@@ -1,6 +1,30 @@
1
- import { PlantAndTagForOpenIn3d } from '../../openItemsIn3d/logic/openItemsIn3d.utils';
2
- import { GlobalSelectionGenericItem, GlobalSelectionItemType, GlobalSelectionItemTypeToDataMap, GlobalSelectionListUnion, GlobalSelectionStore } from './globalSelectionStore.types';
3
- export declare function toGlobalSelectionItem<T extends GlobalSelectionItemTypeToDataMap[K], K extends GlobalSelectionItemType>(item: T, type: K, idSelector: (item: T) => string): GlobalSelectionGenericItem<K>;
4
- export declare function toGlobalSelectionItems<T extends GlobalSelectionItemTypeToDataMap[K], K extends GlobalSelectionItemType>(items: T[], type: K, idSelector: (item: T) => string): GlobalSelectionGenericItem<K>[];
5
- export declare function findGlobalSelectionListByKey(state: GlobalSelectionStore, key: string): GlobalSelectionListUnion | undefined;
6
- export declare function convertGlobalSelectionItemsToPlantTagPairs(): Promise<PlantAndTagForOpenIn3d[]>;
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
+ export declare function findGlobalSelectionListByKey(state: GlobalSelectionTypes.Store, key: string): GlobalSelectionTypes.ListUnion | undefined;
5
+ declare function idsEqual(itemA: GlobalSelectionTypes.ItemId, itemB: GlobalSelectionTypes.ItemId): boolean;
6
+ declare function isWorkOrderId(itemId: GlobalSelectionTypes.ItemId): itemId is GlobalSelectionTypes.WorkOrderId;
7
+ declare function isEquipmentId(itemId: GlobalSelectionTypes.ItemId): itemId is GlobalSelectionTypes.EquipmentId;
8
+ declare function isTagId(itemId: GlobalSelectionTypes.ItemId): itemId is GlobalSelectionTypes.TagId;
9
+ declare function mapToId(item: GlobalSelectionTypes.ItemId): GlobalSelectionTypes.ItemId;
10
+ declare function itemIdToString(itemId: Record<string, string | number>): string;
11
+ /**
12
+ * A utility object that provides various functions for handling global selections.
13
+ *
14
+ * @namespace globalSelectionUtils
15
+ * @property {Function} isWorkOrderId - Checks if the passed object is a global selection WorkOrderID.
16
+ * @property {Function} isEquipmentId - Checks if the passed object is a global selection EquipmentID.
17
+ * @property {Function} isTagId - Checks if the passed object is a global selection TagID.
18
+ * @property {Function} idsEqual - Compares two global selection item IDs for equality.
19
+ * @property {Function} mapToId - Maps an object to its global selection item ID.
20
+ * @property {Function} itemIdToString - Converts a global selection item id object to a string, each value is concatenated by a '-'
21
+ */
22
+ export declare const globalSelectionUtils: Readonly<{
23
+ isWorkOrderId: typeof isWorkOrderId;
24
+ isEquipmentId: typeof isEquipmentId;
25
+ isTagId: typeof isTagId;
26
+ idsEqual: typeof idsEqual;
27
+ mapToId: typeof mapToId;
28
+ itemIdToString: typeof itemIdToString;
29
+ }>;
30
+ export {};
@@ -1,10 +1,14 @@
1
- declare function allWorkOrders(): import("./globalSelectionStore.types").OptimizedWorkOrderDto[];
2
- declare function allTags(): import("dist/libs/echo-search/src").TagSummaryDto[];
3
- declare function allEquipments(): import("../../equipment").Equipment[];
4
- export declare const globalSelectionStoreHelpers: {
5
- allTags: typeof allTags;
6
- allEquipments: typeof allEquipments;
7
- allWorkOrders: typeof allWorkOrders;
8
- snapshot: () => import("./globalSelectionStore.types").GlobalSelectionStore;
9
- };
10
- export {};
1
+ import { PlantAndTagForOpenIn3d } from '../../openItemsIn3d/logic/openItemsIn3d.utils';
2
+ /**
3
+ * Converts global selection items to plant tag pairs.
4
+ *
5
+ * This function processes different types of global selection items (Tag, WorkOrder, Equipment)
6
+ * and converts them into an array of `PlantAndTagForOpenIn3d` objects. It ensures that all
7
+ * enum cases are handled by using a switch statement and the `assertUnreachable` function.
8
+ *
9
+ * The resulting array is then filtered to remove duplicates based on the combination of
10
+ * `instCode`, `pdmsPlantCode`, and `tagNo`.
11
+ *
12
+ * @returns {Promise<PlantAndTagForOpenIn3d[]>} A promise that resolves to an array of plant tag pairs.
13
+ */
14
+ export declare function convertGlobalSelectionItemsToPlantTagPairs(): Promise<PlantAndTagForOpenIn3d[]>;
@@ -1,2 +1,2 @@
1
- import { GlobalSelectionItem } from '../globalSelectionStore/globalSelectionStore.types';
2
- export declare const useGlobalSelectionItems: () => GlobalSelectionItem[];
1
+ import { GlobalSelectionTypes } from '../globalSelectionStore/globalSelectionStore.types';
2
+ export declare const useGlobalSelectionItems: () => GlobalSelectionTypes.SelectionItem[];
@@ -1,6 +1,6 @@
1
- import { TagGlobalSelectionListItem } from '../globalSelectionStore/globalSelectionStore.types';
1
+ import { GlobalSelectionTypes } from '../globalSelectionStore/globalSelectionStore.types';
2
2
  /**
3
3
  * Returns with the stored Tags from the global selection store
4
4
  * @returns {TagGlobalSelectionListItem[]} Array of Tags with some global selection meta data.
5
5
  */
6
- export declare function useGlobalSelectionTags(): TagGlobalSelectionListItem[];
6
+ export declare function useGlobalSelectionTags(): GlobalSelectionTypes.TagItem[];
@@ -1,6 +1,6 @@
1
- import { WorkOrderGlobalSelectionListItem } from '../globalSelectionStore/globalSelectionStore.types';
1
+ import { GlobalSelectionTypes } from '../globalSelectionStore/globalSelectionStore.types';
2
2
  /**
3
3
  * Returns with the stored Work Orders from the global selection store
4
- * @returns {WorkOrderGlobalSelectionListItem[]} Array of Work Orders
4
+ * @returns {GlobalSelectionTypes.WorkOrderItem[]} Array of Work Orders
5
5
  */
6
- export declare function useGlobalSelectionWorkOrders(): WorkOrderGlobalSelectionListItem[];
6
+ export declare function useGlobalSelectionWorkOrders(): GlobalSelectionTypes.WorkOrderItem[];
@@ -1,8 +1,9 @@
1
- export { OpenGlobalSelectionIn3DButton } from './OpenGlobalSelectionIn3DButton';
2
1
  export { getGlobalSelectionStoreState, useGlobalSelectionStore } from './globalSelectionStore/globalSelectionStore';
3
2
  export * from './globalSelectionStore/globalSelectionStore.types';
4
- export { convertGlobalSelectionItemsToPlantTagPairs } from './globalSelectionStore/globalSelectionStore.utils';
3
+ export { globalSelectionUtils } from './globalSelectionStore/globalSelectionStore.utils';
4
+ export { convertGlobalSelectionItemsToPlantTagPairs } from './globalSelectionStore/globalSelectionStoreHelpers';
5
5
  export { useGlobalSelectionItems } from './hooks/useGlobalSelectionItems';
6
6
  export { useGlobalSelectionLists } from './hooks/useGlobalSelectionLists';
7
7
  export { useGlobalSelectionTags } from './hooks/useGlobalSelectionTags';
8
8
  export { useGlobalSelectionWorkOrders } from './hooks/useGlobalSelectionWorkOrders';
9
+ export { OpenGlobalSelectionIn3DButton } from './OpenGlobalSelectionIn3DButton';
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
- import { GlobalSelectionItem } from '../globalSelectionStore/globalSelectionStore.types';
2
+ import { GlobalSelectionTypes } from '../globalSelectionStore/globalSelectionStore.types';
3
3
  interface PanTo3DButtonProps {
4
- item: GlobalSelectionItem;
4
+ item: GlobalSelectionTypes.SelectionItem;
5
5
  }
6
6
  export declare const PanTo3DButton: React.FC<PanTo3DButtonProps>;
7
7
  export {};
@@ -1,4 +1,4 @@
1
- import { GlobalSelectionItem } from '../globalSelectionStore/globalSelectionStore.types';
1
+ import { GlobalSelectionTypes } from '../globalSelectionStore/globalSelectionStore.types';
2
2
  export declare const usePanTo3dWeb: () => {
3
- panTo3D: (item: GlobalSelectionItem) => Promise<void>;
3
+ panTo3D: (item: GlobalSelectionTypes.SelectionItem) => Promise<void>;
4
4
  };
@@ -1,4 +1,4 @@
1
- export { workOrdersToPlantTagPairs } from './logic/convertToPlantTagPairs';
1
+ export { tagIdPlantIdToPlantTagPairs } from './logic/convertToPlantTagPairs';
2
2
  export type { Plant3dInfo, PlantAndTagForOpenIn3d } from './logic/openItemsIn3d.utils';
3
3
  export { OpenItemsIn3dDialog } from './openItemsIn3dDialog';
4
4
  export { SelectedItemsMenu } from './SelectedItemsMenu';
@@ -1,10 +1,10 @@
1
1
  import { PlantAndTagForOpenIn3d } from './openItemsIn3d.utils';
2
- export interface WorkOrderTag {
2
+ export interface TagIdPlantId {
3
3
  tagPlantId: string | undefined;
4
4
  tagId: string | undefined;
5
5
  }
6
- export declare function tagToPlantTagPairs(selectedWorkOrders: {
6
+ export declare function tagToPlantTagPairs(selectedWorkOrders: ReadonlyArray<{
7
7
  tagNo: string;
8
8
  instCode: string;
9
- }[]): Promise<PlantAndTagForOpenIn3d[]>;
10
- export declare function workOrdersToPlantTagPairs(selectedWorkOrders: WorkOrderTag[]): Promise<PlantAndTagForOpenIn3d[]>;
9
+ }>): Promise<PlantAndTagForOpenIn3d[]>;
10
+ export declare function tagIdPlantIdToPlantTagPairs(items: ReadonlyArray<TagIdPlantId>): Promise<PlantAndTagForOpenIn3d[]>;