@equinor/echo-framework 5.0.0 → 6.1.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.
- package/index.cjs.js +2 -2
- package/package.json +6 -6
- package/src/lib/feature/globalSelection/coordinate/coordinate.clean.d.ts +6 -0
- package/src/lib/feature/globalSelection/coordinate/coordinate.logic.d.ts +3 -0
- package/src/lib/feature/globalSelection/coordinate/coordinate.types.d.ts +19 -0
- package/src/lib/feature/globalSelection/globalSelection.api.d.ts +32 -28
- package/src/lib/feature/globalSelection/globalSelectionStore/actions/setRelatedTo.action.d.ts +7 -0
- package/src/lib/feature/globalSelection/globalSelectionStore/globalSelectionStore.d.ts +242 -0
- package/src/lib/feature/globalSelection/globalSelectionStore/globalSelectionStore.mutableSelectionItem.d.ts +2 -1
- package/src/lib/feature/globalSelection/globalSelectionStore/globalSelectionStore.testHelpers.d.ts +5 -0
- package/src/lib/feature/globalSelection/globalSelectionStore/globalSelectionStore.types.d.ts +42 -5
- package/src/lib/feature/globalSelection/globalSelectionStore/globalSelectionStore.utils.d.ts +14 -12
- package/src/lib/feature/globalSelection/globalSelectionStore/globalSelectionStoreHelpers.d.ts +3 -1
- package/src/lib/feature/globalSelection/globalSelectionStore/itemIdTypeGuards.d.ts +3 -1
- package/src/lib/feature/globalSelection/globalSelectionStore/nullItems/createNullCoordinate.d.ts +3 -0
- package/src/lib/feature/globalSelection/hooks/useIsInGlobalSelection.d.ts +6 -1
- package/src/lib/feature/globalSelection/index.d.ts +2 -5
- package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/actions/addItems.action.d.ts +2 -2
- package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/actions/addItemsByType.action.d.ts +15 -0
- package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/initialData.d.ts +0 -6
- package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/persist/selectionTree.load.utils.d.ts +1 -1
- package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/selectionTree.api.types.d.ts +7 -1
- package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/selectionTree.store.d.ts +42 -5
- package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/selectionTree.store.types.d.ts +5 -10
- package/src/lib/feature/globalSelection/strategies/coordinateSelection.strategy.d.ts +3 -0
- package/src/lib/feature/globalSelection/strategies/selectionItemTypeStrategy.types.d.ts +2 -0
- package/src/lib/services/api/api-plantinfo.d.ts +1 -1
- package/src/lib/services/echoViewService/echoView.type.d.ts +0 -1
- package/src/lib/utils/plantInfo.d.ts +2 -2
- package/src/lib/feature/globalSelection/hooks/useGlobalSelectionTags.d.ts +0 -6
- package/src/lib/feature/globalSelection/hooks/useGlobalSelectionWorkOrders.d.ts +0 -6
- package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/actions/addEquipments.action.d.ts +0 -2
- package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/actions/addMeasuringPoints.action.d.ts +0 -2
- package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/actions/addTags.action.d.ts +0 -2
- package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/actions/addWorkOrders.action.d.ts +0 -2
- package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/persist/selectionTreeLoader.service.d.ts +0 -42
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@equinor/echo-framework",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.1.0",
|
|
4
4
|
"peerDependencies": {
|
|
5
|
-
"@equinor/echo-base": ">=
|
|
6
|
-
"@equinor/echo-components": ">=
|
|
7
|
-
"@equinor/echo-core": ">=
|
|
8
|
-
"@equinor/echo-search": ">=
|
|
9
|
-
"@equinor/echo-utils": ">=
|
|
5
|
+
"@equinor/echo-base": ">= 6.1.0 < 7.0.0",
|
|
6
|
+
"@equinor/echo-components": ">= 6.1.0 < 7.0.0",
|
|
7
|
+
"@equinor/echo-core": ">= 6.1.0 < 7.0.0",
|
|
8
|
+
"@equinor/echo-search": ">= 6.1.0 < 7.0.0",
|
|
9
|
+
"@equinor/echo-utils": ">= 6.1.0 < 7.0.0",
|
|
10
10
|
"@equinor/eds-core-react": "0.49.0",
|
|
11
11
|
"@equinor/eds-icons": "0.22.0",
|
|
12
12
|
"@equinor/eds-tokens": "2.1.0",
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { CoordinateId } from './coordinate.types';
|
|
2
|
+
/**
|
|
3
|
+
* Validates and coerces a CoordinateId from the API into a clean CoordinateId.
|
|
4
|
+
* Returns undefined if the data is invalid (e.g. NaN coordinates, missing fields).
|
|
5
|
+
*/
|
|
6
|
+
export declare function cleanCoordinateId(raw: CoordinateId): CoordinateId | undefined;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { PlantAndTagForOpenIn3d } from '../../openItemsIn3d/logic/openItemsIn3d.utils';
|
|
2
|
+
import type { CoordinateData } from './coordinate.types';
|
|
3
|
+
export declare function coordinatesToPlantTagPairs(coordinates: ReadonlyArray<CoordinateData>): ReadonlyArray<PlantAndTagForOpenIn3d>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface CoordinateId {
|
|
2
|
+
readonly x: number;
|
|
3
|
+
readonly y: number;
|
|
4
|
+
readonly z: number;
|
|
5
|
+
readonly name: string;
|
|
6
|
+
readonly description: string | undefined;
|
|
7
|
+
readonly instCode: string;
|
|
8
|
+
/** Echo 3D plantCode */
|
|
9
|
+
readonly plantCode: string;
|
|
10
|
+
/** Sap id */
|
|
11
|
+
readonly plantNo: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Coordinates have no additional data beyond their identifying fields,
|
|
15
|
+
* so `CoordinateData` and `CoordinateId` are intentionally the same shape.
|
|
16
|
+
* Kept as separate aliases to mirror the other selection item types
|
|
17
|
+
* (`*Id` vs `*Data`) and allow future divergence without a breaking rename.
|
|
18
|
+
*/
|
|
19
|
+
export type CoordinateData = CoordinateId;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import { GlobalSelectionTypes } from './globalSelectionStore/globalSelectionStore.types';
|
|
1
|
+
import { GlobalSelectionItemType, GlobalSelectionTypes, SelectionItemTypeToItemIdMap } from './globalSelectionStore/globalSelectionStore.types';
|
|
2
|
+
import { isPdmsTagInSelection } from './pdmsTag/pdmsTag.logic';
|
|
3
|
+
import { AddItemArgs } from './selectionMenu/selectionTreeStore/actions/selectionTree.action.types';
|
|
2
4
|
import { GlobalSelectionCategoryId, SelectionTreeTypes } from './selectionMenu/selectionTreeStore/selectionTree.store.types';
|
|
3
5
|
export declare const globalSelectionApi: Readonly<{
|
|
4
6
|
/**
|
|
@@ -75,31 +77,34 @@ export declare const globalSelectionApi: Readonly<{
|
|
|
75
77
|
* - 'ItemsUpdated': Existing items were replaced with new tags.
|
|
76
78
|
* - 'ItemsAdded': New tags were added to the existing items.
|
|
77
79
|
*/
|
|
78
|
-
tags: (args: import("./selectionMenu/selectionTreeStore/actions/selectionTree.action.types").AddItemArgs<GlobalSelectionTypes.TagId>) => import("./selectionMenu/selectionTreeStore/selectionTree.store.types").AddTagsReturnType;
|
|
79
80
|
/**
|
|
80
|
-
* Adds
|
|
81
|
+
* Adds items of the given type to a specified list in the selection menu panel.
|
|
82
|
+
* This is the primary generic method. Per-type aliases (`tags`, `workOrders`, etc.) delegate to this.
|
|
81
83
|
*
|
|
82
|
-
* @param {
|
|
83
|
-
* @param {
|
|
84
|
-
* @param {Readonly<Readonly<GlobalSelectionTypes.WorkOrderId>[]>} args.items - An array of WorkOrderId objects representing the work orders to be added.
|
|
84
|
+
* @param {GlobalSelectionItemType} itemType - The type of items to add.
|
|
85
|
+
* @param {AddItemArgs} args - The arguments for adding items.
|
|
85
86
|
*/
|
|
86
|
-
|
|
87
|
+
byType: <T extends GlobalSelectionItemType>(itemType: T, args: AddItemArgs<SelectionItemTypeToItemIdMap[T]>) => Promise<import("./selectionMenu/selectionTreeStore/actions/selectionTree.action.types").AddItemsResponse<T>>;
|
|
87
88
|
/**
|
|
88
|
-
*
|
|
89
|
-
*
|
|
90
|
-
* @param {Object} args - The arguments for adding equipments.
|
|
91
|
-
* @param {Guid} args.groupId - Optional. The ID of the list to which the items should be added. If not provided, it will be added to the "Local Selection".
|
|
92
|
-
* @param {Readonly<Readonly<GlobalSelectionTypes.EquipmentId>[]>} args.items - An array of EquipmentId objects representing the work orders to be added.
|
|
89
|
+
* @deprecated Use `globalSelectionApi.add.byType(GlobalSelectionItemType.Tag, args)` instead.
|
|
90
|
+
* Tracked for removal once Echo3DWeb migrates: #447925
|
|
93
91
|
*/
|
|
94
|
-
|
|
92
|
+
tags: (args: AddItemArgs<GlobalSelectionTypes.TagId>) => Promise<import("./selectionMenu/selectionTreeStore/actions/selectionTree.action.types").AddItemsResponse<GlobalSelectionItemType.Tag>>;
|
|
95
93
|
/**
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
94
|
+
* @deprecated Use `globalSelectionApi.add.byType(GlobalSelectionItemType.WorkOrder, args)` instead.
|
|
95
|
+
* Tracked for removal once Echo3DWeb migrates: #447925
|
|
96
|
+
*/
|
|
97
|
+
workOrders: (args: AddItemArgs<GlobalSelectionTypes.WorkOrderId>) => Promise<import("./selectionMenu/selectionTreeStore/actions/selectionTree.action.types").AddItemsResponse<GlobalSelectionItemType.WorkOrder>>;
|
|
98
|
+
/**
|
|
99
|
+
* @deprecated Use `globalSelectionApi.add.byType(GlobalSelectionItemType.Equipment, args)` instead.
|
|
100
|
+
* Tracked for removal once Echo3DWeb migrates: #447925
|
|
101
101
|
*/
|
|
102
|
-
|
|
102
|
+
equipments: (args: AddItemArgs<GlobalSelectionTypes.EquipmentId>) => Promise<import("./selectionMenu/selectionTreeStore/actions/selectionTree.action.types").AddItemsResponse<GlobalSelectionItemType.Equipment>>;
|
|
103
|
+
/**
|
|
104
|
+
* @deprecated Use `globalSelectionApi.add.byType(GlobalSelectionItemType.MeasuringPoint, args)` instead.
|
|
105
|
+
* Tracked for removal once Echo3DWeb migrates: #447925
|
|
106
|
+
*/
|
|
107
|
+
measuringPoints: (args: AddItemArgs<GlobalSelectionTypes.MeasuringPointId>) => Promise<import("./selectionMenu/selectionTreeStore/actions/selectionTree.action.types").AddItemsResponse<GlobalSelectionItemType.MeasuringPoint>>;
|
|
103
108
|
/**
|
|
104
109
|
* Adds items to a specified list in the selection menu panel.
|
|
105
110
|
*
|
|
@@ -128,11 +133,6 @@ export declare const globalSelectionApi: Readonly<{
|
|
|
128
133
|
findGroupByLabel: (args: {
|
|
129
134
|
label: string;
|
|
130
135
|
}) => import("@equinor/echo-utils").Guid | undefined;
|
|
131
|
-
/**
|
|
132
|
-
* Retrieves a tag item from the selection by tagNo and instCode.
|
|
133
|
-
* Returns undefined if the tag is not in the selection.
|
|
134
|
-
*/
|
|
135
|
-
getTag: typeof getTag;
|
|
136
136
|
};
|
|
137
137
|
/**
|
|
138
138
|
* Moves items, categories, or groups within the selection tree structure.
|
|
@@ -195,6 +195,10 @@ export declare const globalSelectionApi: Readonly<{
|
|
|
195
195
|
color: string;
|
|
196
196
|
}) => void;
|
|
197
197
|
}>;
|
|
198
|
+
setRelatedTo: (args: ReadonlyArray<{
|
|
199
|
+
readonly itemId: GlobalSelectionTypes.ItemId;
|
|
200
|
+
readonly relatedTo: ReadonlyArray<import("./globalSelectionStore/globalSelectionStore.types").RelatedToItem>;
|
|
201
|
+
}>) => void;
|
|
198
202
|
errorStatus: Readonly<{
|
|
199
203
|
/**
|
|
200
204
|
* Sets the error status for specific items in the selection menu panel.
|
|
@@ -242,6 +246,10 @@ export declare const globalSelectionApi: Readonly<{
|
|
|
242
246
|
* @returns {number} The total number of items in all categories of the given groups.
|
|
243
247
|
*/
|
|
244
248
|
numberOfItemsInSelection: (groups?: SelectionTreeTypes.Group[]) => number;
|
|
249
|
+
/**
|
|
250
|
+
* Checks if a tag (by tagNo + instCode) is in the selection and is a PDMS tag.
|
|
251
|
+
*/
|
|
252
|
+
isPdmsTagInSelection: typeof isPdmsTagInSelection;
|
|
245
253
|
}>;
|
|
246
254
|
/**
|
|
247
255
|
* Removes all items from the selection menu panel.
|
|
@@ -263,8 +271,4 @@ export declare const globalSelectionApi: Readonly<{
|
|
|
263
271
|
}>;
|
|
264
272
|
declare function getStoreTagIds(): GlobalSelectionTypes.TagId[];
|
|
265
273
|
declare function getStoreEquipmentIds(): GlobalSelectionTypes.EquipmentId[];
|
|
266
|
-
declare function getTag(args: {
|
|
267
|
-
readonly tagNo: string;
|
|
268
|
-
readonly instCode: string;
|
|
269
|
-
}): GlobalSelectionTypes.TagItem | undefined;
|
|
270
274
|
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { GlobalSelectionStore, GlobalSelectionTypes, RelatedToItem } from '../globalSelectionStore.types';
|
|
2
|
+
type SetFunction = (updater: (state: GlobalSelectionStore) => void, shouldReplace?: boolean, action?: string) => void;
|
|
3
|
+
export declare function setRelatedToAction(set: SetFunction, args: ReadonlyArray<{
|
|
4
|
+
readonly itemId: GlobalSelectionTypes.ItemId;
|
|
5
|
+
readonly relatedTo: ReadonlyArray<RelatedToItem>;
|
|
6
|
+
}>): void;
|
|
7
|
+
export {};
|
|
@@ -3,6 +3,7 @@ export declare const initialWorkOrderList: GlobalSelectionTypes.WorkOrderList;
|
|
|
3
3
|
export declare const initialTagList: GlobalSelectionTypes.TagList;
|
|
4
4
|
export declare const initialEquipmentList: GlobalSelectionTypes.EquipmentList;
|
|
5
5
|
export declare const initialMeasuringPointList: GlobalSelectionTypes.MeasuringPointList;
|
|
6
|
+
export declare const initialCoordinateList: GlobalSelectionTypes.CoordinateList;
|
|
6
7
|
/**
|
|
7
8
|
* The single source of truth for items stored in Global Selection.
|
|
8
9
|
* Each item is stored here once, does not store item grouping in any way.
|
|
@@ -54,6 +55,10 @@ export declare const useGlobalSelectionStore: import("zustand").UseBoundStore<Om
|
|
|
54
55
|
setAllItemsVisibility: (args: {
|
|
55
56
|
isVisible: boolean;
|
|
56
57
|
}) => void;
|
|
58
|
+
setRelatedTo: (args: ReadonlyArray<{
|
|
59
|
+
readonly itemId: GlobalSelectionTypes.ItemId;
|
|
60
|
+
readonly relatedTo: ReadonlyArray<import("./globalSelectionStore.types").RelatedToItem>;
|
|
61
|
+
}>) => void;
|
|
57
62
|
setItemMetaData: (args: ReadonlyArray<import("./globalSelectionStore.types").GlobalSelectionItemIdMetadata>) => void;
|
|
58
63
|
resetItemErrorStatuses: () => void;
|
|
59
64
|
getStoredItemIds: () => ReadonlyArray<GlobalSelectionTypes.ItemId>;
|
|
@@ -68,6 +73,15 @@ export declare const useGlobalSelectionStore: import("zustand").UseBoundStore<Om
|
|
|
68
73
|
WorkOrder: {
|
|
69
74
|
items: Map<GlobalSelectionTypes.ItemIdString, {
|
|
70
75
|
id: {
|
|
76
|
+
x: number;
|
|
77
|
+
y: number;
|
|
78
|
+
z: number;
|
|
79
|
+
name: string;
|
|
80
|
+
description: string | undefined;
|
|
81
|
+
instCode: string;
|
|
82
|
+
plantCode: string;
|
|
83
|
+
plantNo: string;
|
|
84
|
+
} | {
|
|
71
85
|
workOrderId: string;
|
|
72
86
|
} | {
|
|
73
87
|
instCode: string;
|
|
@@ -109,11 +123,51 @@ export declare const useGlobalSelectionStore: import("zustand").UseBoundStore<Om
|
|
|
109
123
|
errorStatus: string | undefined;
|
|
110
124
|
systemStatus: import("./globalSelectionStore.types").SelectionItemSystemStatus;
|
|
111
125
|
};
|
|
126
|
+
relatedTo?: {
|
|
127
|
+
id: {
|
|
128
|
+
x: number;
|
|
129
|
+
y: number;
|
|
130
|
+
z: number;
|
|
131
|
+
name: string;
|
|
132
|
+
description: string | undefined;
|
|
133
|
+
instCode: string;
|
|
134
|
+
plantCode: string;
|
|
135
|
+
plantNo: string;
|
|
136
|
+
} | {
|
|
137
|
+
workOrderId: string;
|
|
138
|
+
} | {
|
|
139
|
+
instCode: string;
|
|
140
|
+
tagNo: string;
|
|
141
|
+
} | {
|
|
142
|
+
internalTagType: import("..").PdmsInternalTagType;
|
|
143
|
+
plantNo: string;
|
|
144
|
+
plantCode: string;
|
|
145
|
+
instCode: string;
|
|
146
|
+
tagNo: string;
|
|
147
|
+
} | {
|
|
148
|
+
equipmentId: string;
|
|
149
|
+
} | {
|
|
150
|
+
measuringPointId: string;
|
|
151
|
+
} | {
|
|
152
|
+
key: string;
|
|
153
|
+
value: string;
|
|
154
|
+
};
|
|
155
|
+
type: import("./globalSelectionStore.types").RelatedToItemType;
|
|
156
|
+
}[] | undefined;
|
|
112
157
|
}>;
|
|
113
158
|
};
|
|
114
159
|
Tag: {
|
|
115
160
|
items: Map<GlobalSelectionTypes.ItemIdString, {
|
|
116
161
|
id: {
|
|
162
|
+
x: number;
|
|
163
|
+
y: number;
|
|
164
|
+
z: number;
|
|
165
|
+
name: string;
|
|
166
|
+
description: string | undefined;
|
|
167
|
+
instCode: string;
|
|
168
|
+
plantCode: string;
|
|
169
|
+
plantNo: string;
|
|
170
|
+
} | {
|
|
117
171
|
workOrderId: string;
|
|
118
172
|
} | {
|
|
119
173
|
instCode: string;
|
|
@@ -168,11 +222,51 @@ export declare const useGlobalSelectionStore: import("zustand").UseBoundStore<Om
|
|
|
168
222
|
errorStatus: string | undefined;
|
|
169
223
|
systemStatus: import("./globalSelectionStore.types").SelectionItemSystemStatus;
|
|
170
224
|
};
|
|
225
|
+
relatedTo?: {
|
|
226
|
+
id: {
|
|
227
|
+
x: number;
|
|
228
|
+
y: number;
|
|
229
|
+
z: number;
|
|
230
|
+
name: string;
|
|
231
|
+
description: string | undefined;
|
|
232
|
+
instCode: string;
|
|
233
|
+
plantCode: string;
|
|
234
|
+
plantNo: string;
|
|
235
|
+
} | {
|
|
236
|
+
workOrderId: string;
|
|
237
|
+
} | {
|
|
238
|
+
instCode: string;
|
|
239
|
+
tagNo: string;
|
|
240
|
+
} | {
|
|
241
|
+
internalTagType: import("..").PdmsInternalTagType;
|
|
242
|
+
plantNo: string;
|
|
243
|
+
plantCode: string;
|
|
244
|
+
instCode: string;
|
|
245
|
+
tagNo: string;
|
|
246
|
+
} | {
|
|
247
|
+
equipmentId: string;
|
|
248
|
+
} | {
|
|
249
|
+
measuringPointId: string;
|
|
250
|
+
} | {
|
|
251
|
+
key: string;
|
|
252
|
+
value: string;
|
|
253
|
+
};
|
|
254
|
+
type: import("./globalSelectionStore.types").RelatedToItemType;
|
|
255
|
+
}[] | undefined;
|
|
171
256
|
}>;
|
|
172
257
|
};
|
|
173
258
|
Equipment: {
|
|
174
259
|
items: Map<GlobalSelectionTypes.ItemIdString, {
|
|
175
260
|
id: {
|
|
261
|
+
x: number;
|
|
262
|
+
y: number;
|
|
263
|
+
z: number;
|
|
264
|
+
name: string;
|
|
265
|
+
description: string | undefined;
|
|
266
|
+
instCode: string;
|
|
267
|
+
plantCode: string;
|
|
268
|
+
plantNo: string;
|
|
269
|
+
} | {
|
|
176
270
|
workOrderId: string;
|
|
177
271
|
} | {
|
|
178
272
|
instCode: string;
|
|
@@ -212,11 +306,51 @@ export declare const useGlobalSelectionStore: import("zustand").UseBoundStore<Om
|
|
|
212
306
|
errorStatus: string | undefined;
|
|
213
307
|
systemStatus: import("./globalSelectionStore.types").SelectionItemSystemStatus;
|
|
214
308
|
};
|
|
309
|
+
relatedTo?: {
|
|
310
|
+
id: {
|
|
311
|
+
x: number;
|
|
312
|
+
y: number;
|
|
313
|
+
z: number;
|
|
314
|
+
name: string;
|
|
315
|
+
description: string | undefined;
|
|
316
|
+
instCode: string;
|
|
317
|
+
plantCode: string;
|
|
318
|
+
plantNo: string;
|
|
319
|
+
} | {
|
|
320
|
+
workOrderId: string;
|
|
321
|
+
} | {
|
|
322
|
+
instCode: string;
|
|
323
|
+
tagNo: string;
|
|
324
|
+
} | {
|
|
325
|
+
internalTagType: import("..").PdmsInternalTagType;
|
|
326
|
+
plantNo: string;
|
|
327
|
+
plantCode: string;
|
|
328
|
+
instCode: string;
|
|
329
|
+
tagNo: string;
|
|
330
|
+
} | {
|
|
331
|
+
equipmentId: string;
|
|
332
|
+
} | {
|
|
333
|
+
measuringPointId: string;
|
|
334
|
+
} | {
|
|
335
|
+
key: string;
|
|
336
|
+
value: string;
|
|
337
|
+
};
|
|
338
|
+
type: import("./globalSelectionStore.types").RelatedToItemType;
|
|
339
|
+
}[] | undefined;
|
|
215
340
|
}>;
|
|
216
341
|
};
|
|
217
342
|
MeasuringPoint: {
|
|
218
343
|
items: Map<GlobalSelectionTypes.ItemIdString, {
|
|
219
344
|
id: {
|
|
345
|
+
x: number;
|
|
346
|
+
y: number;
|
|
347
|
+
z: number;
|
|
348
|
+
name: string;
|
|
349
|
+
description: string | undefined;
|
|
350
|
+
instCode: string;
|
|
351
|
+
plantCode: string;
|
|
352
|
+
plantNo: string;
|
|
353
|
+
} | {
|
|
220
354
|
workOrderId: string;
|
|
221
355
|
} | {
|
|
222
356
|
instCode: string;
|
|
@@ -255,6 +389,114 @@ export declare const useGlobalSelectionStore: import("zustand").UseBoundStore<Om
|
|
|
255
389
|
errorStatus: string | undefined;
|
|
256
390
|
systemStatus: import("./globalSelectionStore.types").SelectionItemSystemStatus;
|
|
257
391
|
};
|
|
392
|
+
relatedTo?: {
|
|
393
|
+
id: {
|
|
394
|
+
x: number;
|
|
395
|
+
y: number;
|
|
396
|
+
z: number;
|
|
397
|
+
name: string;
|
|
398
|
+
description: string | undefined;
|
|
399
|
+
instCode: string;
|
|
400
|
+
plantCode: string;
|
|
401
|
+
plantNo: string;
|
|
402
|
+
} | {
|
|
403
|
+
workOrderId: string;
|
|
404
|
+
} | {
|
|
405
|
+
instCode: string;
|
|
406
|
+
tagNo: string;
|
|
407
|
+
} | {
|
|
408
|
+
internalTagType: import("..").PdmsInternalTagType;
|
|
409
|
+
plantNo: string;
|
|
410
|
+
plantCode: string;
|
|
411
|
+
instCode: string;
|
|
412
|
+
tagNo: string;
|
|
413
|
+
} | {
|
|
414
|
+
equipmentId: string;
|
|
415
|
+
} | {
|
|
416
|
+
measuringPointId: string;
|
|
417
|
+
} | {
|
|
418
|
+
key: string;
|
|
419
|
+
value: string;
|
|
420
|
+
};
|
|
421
|
+
type: import("./globalSelectionStore.types").RelatedToItemType;
|
|
422
|
+
}[] | undefined;
|
|
423
|
+
}>;
|
|
424
|
+
};
|
|
425
|
+
Coordinate: {
|
|
426
|
+
items: Map<GlobalSelectionTypes.ItemIdString, {
|
|
427
|
+
id: {
|
|
428
|
+
x: number;
|
|
429
|
+
y: number;
|
|
430
|
+
z: number;
|
|
431
|
+
name: string;
|
|
432
|
+
description: string | undefined;
|
|
433
|
+
instCode: string;
|
|
434
|
+
plantCode: string;
|
|
435
|
+
plantNo: string;
|
|
436
|
+
} | {
|
|
437
|
+
workOrderId: string;
|
|
438
|
+
} | {
|
|
439
|
+
instCode: string;
|
|
440
|
+
tagNo: string;
|
|
441
|
+
} | {
|
|
442
|
+
internalTagType: import("..").PdmsInternalTagType;
|
|
443
|
+
plantNo: string;
|
|
444
|
+
plantCode: string;
|
|
445
|
+
instCode: string;
|
|
446
|
+
tagNo: string;
|
|
447
|
+
} | {
|
|
448
|
+
equipmentId: string;
|
|
449
|
+
} | {
|
|
450
|
+
measuringPointId: string;
|
|
451
|
+
};
|
|
452
|
+
type: GlobalSelectionItemType.Coordinate;
|
|
453
|
+
data: {
|
|
454
|
+
x: number;
|
|
455
|
+
y: number;
|
|
456
|
+
z: number;
|
|
457
|
+
name: string;
|
|
458
|
+
description: string | undefined;
|
|
459
|
+
instCode: string;
|
|
460
|
+
plantCode: string;
|
|
461
|
+
plantNo: string;
|
|
462
|
+
};
|
|
463
|
+
metaData: {
|
|
464
|
+
color: string;
|
|
465
|
+
isHiddenByUser: boolean;
|
|
466
|
+
errorStatus: string | undefined;
|
|
467
|
+
systemStatus: import("./globalSelectionStore.types").SelectionItemSystemStatus;
|
|
468
|
+
};
|
|
469
|
+
relatedTo?: {
|
|
470
|
+
id: {
|
|
471
|
+
x: number;
|
|
472
|
+
y: number;
|
|
473
|
+
z: number;
|
|
474
|
+
name: string;
|
|
475
|
+
description: string | undefined;
|
|
476
|
+
instCode: string;
|
|
477
|
+
plantCode: string;
|
|
478
|
+
plantNo: string;
|
|
479
|
+
} | {
|
|
480
|
+
workOrderId: string;
|
|
481
|
+
} | {
|
|
482
|
+
instCode: string;
|
|
483
|
+
tagNo: string;
|
|
484
|
+
} | {
|
|
485
|
+
internalTagType: import("..").PdmsInternalTagType;
|
|
486
|
+
plantNo: string;
|
|
487
|
+
plantCode: string;
|
|
488
|
+
instCode: string;
|
|
489
|
+
tagNo: string;
|
|
490
|
+
} | {
|
|
491
|
+
equipmentId: string;
|
|
492
|
+
} | {
|
|
493
|
+
measuringPointId: string;
|
|
494
|
+
} | {
|
|
495
|
+
key: string;
|
|
496
|
+
value: string;
|
|
497
|
+
};
|
|
498
|
+
type: import("./globalSelectionStore.types").RelatedToItemType;
|
|
499
|
+
}[] | undefined;
|
|
258
500
|
}>;
|
|
259
501
|
};
|
|
260
502
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { GlobalSelectionItemType, GlobalSelectionMetaData, GlobalSelectionTypes } from './globalSelectionStore.types';
|
|
1
|
+
import { GlobalSelectionItemType, GlobalSelectionMetaData, GlobalSelectionTypes, RelatedToItem } from './globalSelectionStore.types';
|
|
2
2
|
/**
|
|
3
3
|
* This file defines mutable versions of selection items and lists for internal use in the global selection store.
|
|
4
4
|
* These types are used in Immer set() callbacks where the state is a mutable draft, allowing us to bypass
|
|
@@ -21,6 +21,7 @@ type MutableSelectionItem<T extends GlobalSelectionItemType> = {
|
|
|
21
21
|
type: T;
|
|
22
22
|
data: GlobalSelectionTypes.ItemTypeToDataMap[T];
|
|
23
23
|
metaData: Mutable<GlobalSelectionMetaData>;
|
|
24
|
+
relatedTo?: RelatedToItem[];
|
|
24
25
|
};
|
|
25
26
|
/**
|
|
26
27
|
* Mutable version of a selection list for store-internal Immer mutations.
|
package/src/lib/feature/globalSelection/globalSelectionStore/globalSelectionStore.types.d.ts
CHANGED
|
@@ -1,28 +1,54 @@
|
|
|
1
1
|
import type { EquipmentData, MeasuringPointData, ResultArray, TagSummaryDto, WorkOrderData } from '@equinor/echo-search';
|
|
2
2
|
import { Brand } from '@equinor/echo-utils';
|
|
3
|
+
import type { CoordinateData, CoordinateId as CoordinateId_Imported } from '../coordinate/coordinate.types';
|
|
3
4
|
import type { PdmsTagId, StidTagId } from '../pdmsTag/pdmsTag.types';
|
|
4
5
|
export declare enum GlobalSelectionItemType {
|
|
5
6
|
WorkOrder = "WorkOrder",
|
|
6
7
|
Tag = "Tag",
|
|
7
8
|
Equipment = "Equipment",
|
|
8
|
-
MeasuringPoint = "MeasuringPoint"
|
|
9
|
+
MeasuringPoint = "MeasuringPoint",
|
|
10
|
+
Coordinate = "Coordinate"
|
|
9
11
|
}
|
|
10
12
|
type GlobalSelectionTagDto = TagSummaryDto;
|
|
11
13
|
type GlobalSelectionWorkOrderDto = WorkOrderData;
|
|
12
14
|
type GlobalSelectionEquipmentDto = EquipmentData;
|
|
13
15
|
type GlobalSelectionMeasuringPointDto = MeasuringPointData;
|
|
16
|
+
type GlobalSelectionCoordinateDto = CoordinateData;
|
|
14
17
|
export type GlobalSelectionItemTypeToDataMap = {
|
|
15
18
|
[GlobalSelectionItemType.WorkOrder]: GlobalSelectionWorkOrderDto;
|
|
16
19
|
[GlobalSelectionItemType.Tag]: GlobalSelectionTagDto;
|
|
17
20
|
[GlobalSelectionItemType.Equipment]: GlobalSelectionEquipmentDto;
|
|
18
21
|
[GlobalSelectionItemType.MeasuringPoint]: GlobalSelectionMeasuringPointDto;
|
|
22
|
+
[GlobalSelectionItemType.Coordinate]: GlobalSelectionCoordinateDto;
|
|
19
23
|
};
|
|
20
24
|
export type SelectionItemTypeToItemIdMap = {
|
|
21
25
|
[GlobalSelectionItemType.WorkOrder]: GlobalSelectionTypes.WorkOrderId;
|
|
22
26
|
[GlobalSelectionItemType.Tag]: GlobalSelectionTypes.TagId;
|
|
23
27
|
[GlobalSelectionItemType.Equipment]: GlobalSelectionTypes.EquipmentId;
|
|
24
28
|
[GlobalSelectionItemType.MeasuringPoint]: GlobalSelectionTypes.MeasuringPointId;
|
|
29
|
+
[GlobalSelectionItemType.Coordinate]: GlobalSelectionTypes.CoordinateId;
|
|
25
30
|
};
|
|
31
|
+
/**
|
|
32
|
+
* CustomData is a flexible key-value pair type that can be used in the relatedTo field of selection tree items.
|
|
33
|
+
* It allows associating any arbitrary data with a selection item, as long as it follows the structure of having a string key and a string value.
|
|
34
|
+
* This is useful for scenarios where we want to link selection items to external systems or include additional metadata that doesn't fit into the predefined item types.
|
|
35
|
+
* Cannot be set as a top-level item in the global selection, it can only be used in relatedTo.
|
|
36
|
+
*/
|
|
37
|
+
export interface CustomDataId {
|
|
38
|
+
readonly key: string;
|
|
39
|
+
readonly value: string;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Types allowed in relatedTo: all top-level types + CustomData (which is relatedTo-only).
|
|
43
|
+
*/
|
|
44
|
+
export type RelatedToItemType = GlobalSelectionItemType | 'CustomData';
|
|
45
|
+
export type RelatedToItemTypeToIdMap = SelectionItemTypeToItemIdMap & {
|
|
46
|
+
readonly CustomData: CustomDataId;
|
|
47
|
+
};
|
|
48
|
+
export interface RelatedToItem {
|
|
49
|
+
readonly id: RelatedToItemTypeToIdMap[RelatedToItemType];
|
|
50
|
+
readonly type: RelatedToItemType;
|
|
51
|
+
}
|
|
26
52
|
type GlobalSelectionList<T extends GlobalSelectionItemType> = {
|
|
27
53
|
readonly items: Map<GlobalSelectionTypes.ItemIdString, GlobalSelectionGenericItem<T>>;
|
|
28
54
|
};
|
|
@@ -48,12 +74,14 @@ export type GlobalSelectionGenericItem<T extends GlobalSelectionItemType> = {
|
|
|
48
74
|
readonly type: T;
|
|
49
75
|
readonly data: GlobalSelectionTypes.ItemTypeToDataMap[T];
|
|
50
76
|
readonly metaData: GlobalSelectionMetaData;
|
|
77
|
+
readonly relatedTo?: RelatedToItem[];
|
|
51
78
|
};
|
|
52
79
|
type EquipmentGlobalSelectionList = GlobalSelectionTypes.List<GlobalSelectionItemType.Equipment>;
|
|
53
80
|
type WorkOrderGlobalSelectionList = GlobalSelectionTypes.List<GlobalSelectionItemType.WorkOrder>;
|
|
54
81
|
type TagGlobalSelectionList = GlobalSelectionTypes.List<GlobalSelectionItemType.Tag>;
|
|
55
82
|
type MeasuringPointGlobalSelectionList = GlobalSelectionTypes.List<GlobalSelectionItemType.MeasuringPoint>;
|
|
56
|
-
type
|
|
83
|
+
type CoordinateGlobalSelectionList = GlobalSelectionTypes.List<GlobalSelectionItemType.Coordinate>;
|
|
84
|
+
type GlobalSelectionListUnion = WorkOrderGlobalSelectionList | TagGlobalSelectionList | EquipmentGlobalSelectionList | MeasuringPointGlobalSelectionList | CoordinateGlobalSelectionList;
|
|
57
85
|
interface ItemErrorStatusUpdates {
|
|
58
86
|
readonly itemId: GlobalSelectionTypes.ItemId;
|
|
59
87
|
readonly errorStatus: string;
|
|
@@ -82,6 +110,10 @@ export interface GlobalSelectionStore extends GlobalSelectionStoreData {
|
|
|
82
110
|
setAllItemsVisibility: (args: {
|
|
83
111
|
isVisible: boolean;
|
|
84
112
|
}) => void;
|
|
113
|
+
setRelatedTo: (args: ReadonlyArray<{
|
|
114
|
+
readonly itemId: GlobalSelectionTypes.ItemId;
|
|
115
|
+
readonly relatedTo: ReadonlyArray<RelatedToItem>;
|
|
116
|
+
}>) => void;
|
|
85
117
|
setItemMetaData: (args: ReadonlyArray<GlobalSelectionItemIdMetadata>) => void;
|
|
86
118
|
resetItemErrorStatuses: () => void;
|
|
87
119
|
getStoredItemIds: () => ReadonlyArray<GlobalSelectionTypes.ItemId>;
|
|
@@ -109,7 +141,9 @@ export declare namespace GlobalSelectionTypes {
|
|
|
109
141
|
*/
|
|
110
142
|
type TagId = StidTagId | PdmsTagId;
|
|
111
143
|
type MeasuringPointId = Pick<GlobalSelectionMeasuringPointDto, 'measuringPointId'>;
|
|
112
|
-
type
|
|
144
|
+
type CoordinateId = CoordinateId_Imported;
|
|
145
|
+
type RelatedToItemId = WorkOrderId | EquipmentId | TagId | MeasuringPointId | CoordinateId | CustomDataId;
|
|
146
|
+
type ItemId = WorkOrderId | EquipmentId | TagId | MeasuringPointId | CoordinateId;
|
|
113
147
|
type ItemIdString = Brand<string, 'ItemIdString'>;
|
|
114
148
|
type TagDto = GlobalSelectionTagDto;
|
|
115
149
|
type WorkOrderDto = GlobalSelectionWorkOrderDto;
|
|
@@ -119,9 +153,10 @@ export declare namespace GlobalSelectionTypes {
|
|
|
119
153
|
type WorkOrderItem = GlobalSelectionGenericItem<GlobalSelectionItemType.WorkOrder>;
|
|
120
154
|
type TagItem = GlobalSelectionGenericItem<GlobalSelectionItemType.Tag>;
|
|
121
155
|
type MeasuringPointItem = GlobalSelectionGenericItem<GlobalSelectionItemType.MeasuringPoint>;
|
|
156
|
+
type CoordinateItem = GlobalSelectionGenericItem<GlobalSelectionItemType.Coordinate>;
|
|
122
157
|
type List<T extends GlobalSelectionItemType> = GlobalSelectionList<T>;
|
|
123
|
-
type SelectionItem = EquipmentItem | WorkOrderItem | TagItem | MeasuringPointItem;
|
|
124
|
-
type SelectionItemList = EquipmentItem[] | WorkOrderItem[] | TagItem[] | MeasuringPointItem[];
|
|
158
|
+
type SelectionItem = EquipmentItem | WorkOrderItem | TagItem | MeasuringPointItem | CoordinateItem;
|
|
159
|
+
type SelectionItemList = EquipmentItem[] | WorkOrderItem[] | TagItem[] | MeasuringPointItem[] | CoordinateItem[];
|
|
125
160
|
type GenericItem<T extends GlobalSelectionItemType> = GlobalSelectionGenericItem<T>;
|
|
126
161
|
type Store = GlobalSelectionStore;
|
|
127
162
|
type ItemErrorStatusUpdate = ItemErrorStatusUpdates;
|
|
@@ -129,11 +164,13 @@ export declare namespace GlobalSelectionTypes {
|
|
|
129
164
|
type TagList = TagGlobalSelectionList;
|
|
130
165
|
type EquipmentList = EquipmentGlobalSelectionList;
|
|
131
166
|
type MeasuringPointList = MeasuringPointGlobalSelectionList;
|
|
167
|
+
type CoordinateList = CoordinateGlobalSelectionList;
|
|
132
168
|
type ListUnion = GlobalSelectionListUnion;
|
|
133
169
|
type ItemTypeToDataMap = GlobalSelectionItemTypeToDataMap;
|
|
134
170
|
type AddTagResult = GlobalSelectionAddItemResult<ResultArray<TagSummaryDto>[]>;
|
|
135
171
|
type AddEquipmentsResult = GlobalSelectionAddItemResult<ResultArray<EquipmentData>[]>;
|
|
136
172
|
type AddMeasuringPointResult = GlobalSelectionAddItemResult<ResultArray<MeasuringPointData>[]>;
|
|
173
|
+
type AddCoordinateResult = GlobalSelectionAddItemResult<ResultArray<CoordinateData>[]>;
|
|
137
174
|
type ActionResult = GlobalSelectionActionResult;
|
|
138
175
|
type ItemSystemStatus = SelectionItemSystemStatus;
|
|
139
176
|
}
|