@equinor/echo-framework 0.21.0-beta-2 → 0.21.1-beta-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/{47deeba42768c5d1.svg → 063009f06499d102.svg} +8 -8
- package/README.md +28 -28
- package/{1bd97dd2170d0f64.svg → f4c85313e79b1662.svg} +850 -850
- package/index.cjs.d.ts +2 -2
- package/index.cjs.js +1 -1
- package/package.json +2 -2
- package/src/index.d.ts +3 -4
- package/src/lib/components/prepview/api/api.d.ts +1 -0
- package/src/lib/components/prepview/context/PrepviewContext.d.ts +1 -1
- package/src/lib/components/prepview/panels/attachments/AttachmentItem.d.ts +1 -1
- package/src/lib/components/prepview/types/shared.d.ts +1 -0
- package/src/lib/feature/globalSelection/components/SelectionActionBar.d.ts +2 -1
- package/src/lib/feature/globalSelection/globalSelection.api.d.ts +88 -105
- package/src/lib/feature/globalSelection/globalSelectionStore/globalSelectionStore.types.d.ts +7 -1
- package/src/lib/feature/globalSelection/globalSelectionStore/globalSelectionStore.utils.d.ts +1 -1
- package/src/lib/feature/globalSelection/hooks/useSelectionCategoriesByGroupId.d.ts +11 -0
- package/src/lib/feature/globalSelection/index.d.ts +4 -1
- package/src/lib/feature/globalSelection/selectionMenu/hooks/{useAllItemsHiddenByUser.d.ts → useIsAllIGlobalSelectionItemsHidden.d.ts} +9 -2
- package/src/lib/feature/globalSelection/selectionMenu/hooks/useSelectionMenuGroups.d.ts +7 -0
- package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/actions/addTag.action.d.ts +13 -0
- package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/actions/addTag.action.types.d.ts +18 -0
- package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/initialData.d.ts +10 -0
- package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/selectionTree.store.d.ts +22 -0
- package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/selectionTree.store.types.d.ts +83 -0
- package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/selectionTree.store.utils.d.ts +70 -0
- package/src/lib/feature/legacyLegend/legend.d.ts +5 -3
- package/src/lib/hooks/useCommPackSearch.d.ts +2 -0
- package/src/lib/hooks/useMcPackSearch.d.ts +2 -0
- package/src/lib/utils/mediaTypeUtils.d.ts +2 -0
- package/src/lib/feature/globalSelection/selectionMenu/hooks/useSelectionMenuLists.d.ts +0 -7
- package/src/lib/feature/globalSelection/selectionMenu/selectionMenuStore/selectionMenu.store.d.ts +0 -28
- package/src/lib/feature/globalSelection/selectionMenu/selectionMenuStore/selectionMenu.store.types.d.ts +0 -56
- package/src/lib/feature/globalSelection/selectionMenu/selectionMenuStore/selectionMenu.store.utils.d.ts +0 -56
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@equinor/echo-framework",
|
|
3
|
-
"version": "0.21.
|
|
3
|
+
"version": "0.21.1-beta-0",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"@equinor/echo-base": ">= 0.7.0 < 0.8.0",
|
|
6
|
-
"@equinor/echo-components": "0.12.0
|
|
6
|
+
"@equinor/echo-components": ">= 0.12.0 < 0.13.0",
|
|
7
7
|
"@equinor/echo-core": ">= 0.9.0 < 0.10.0",
|
|
8
8
|
"@equinor/echo-search": ">= 0.15.0 < 0.16.0",
|
|
9
9
|
"@equinor/echo-utils": ">= 0.4.0 < 0.5.0",
|
package/src/index.d.ts
CHANGED
|
@@ -14,10 +14,8 @@ export * from './lib/feature/globalSelection';
|
|
|
14
14
|
export { SelectionActionBar } from './lib/feature/globalSelection/components/SelectionActionBar';
|
|
15
15
|
export type { OptimizedWorkOrderDto } from './lib/feature/globalSelection/globalSelectionStore/globalSelectionStore.types';
|
|
16
16
|
export { PanTo3DButton } from './lib/feature/globalSelection/panToEcho3d/panTo3DButton';
|
|
17
|
-
export {
|
|
18
|
-
export {
|
|
19
|
-
export { SelectionMenuDefaultListIds } from './lib/feature/globalSelection/selectionMenu/selectionMenuStore/selectionMenu.store';
|
|
20
|
-
export type { SelectionMenuList } from './lib/feature/globalSelection/selectionMenu/selectionMenuStore/selectionMenu.store.types';
|
|
17
|
+
export { useIsAllIGlobalSelectionItemsHidden } from './lib/feature/globalSelection/selectionMenu/hooks/useIsAllIGlobalSelectionItemsHidden';
|
|
18
|
+
export { GlobalSelectionCategoryId, SelectionMenuDefaultListIds } from './lib/feature/globalSelection/selectionMenu/selectionTreeStore/selectionTree.store.types';
|
|
21
19
|
export * from './lib/feature/legacyLegend/index';
|
|
22
20
|
export { getLatestMeasurementDate, sortMeasuringPointsByMeasurementDate } from './lib/feature/measuringPoint/components/measuringPoints.utils';
|
|
23
21
|
export * from './lib/feature/measuringPoint/index';
|
|
@@ -54,6 +52,7 @@ export { PingableSources } from './lib/types/pingableSources';
|
|
|
54
52
|
export { SearchItemDetailsType as searchItemDetailsType } from './lib/types/searchItemDetailsType';
|
|
55
53
|
export * from './lib/utils';
|
|
56
54
|
export { getPdmsPlantCodeForTag } from './lib/utils/getPdmsPlantCodeForTag';
|
|
55
|
+
export { isImage, isVideo } from './lib/utils/mediaTypeUtils';
|
|
57
56
|
export { convertPathNameToReadableString } from './lib/utils/moduleNameUtils';
|
|
58
57
|
export * from './lib/utils/startup';
|
|
59
58
|
export declare const registerEchopediaComponent: ({ name, component }: {
|
|
@@ -8,6 +8,7 @@ export declare function getPunchDetails(instCode: string, punchId: string): Prom
|
|
|
8
8
|
export declare function getTagInformation(itemId: string, isWorkOrder?: boolean): Promise<PrepviewTagInformation>;
|
|
9
9
|
export declare function getAttachments(itemId: string, isWorkOrder?: boolean): Promise<PrepviewAttachment[]>;
|
|
10
10
|
export declare function getAttachmentFile(type: string, id: string, attachment: PrepviewAttachment, isWorkOrder?: boolean): Promise<Blob>;
|
|
11
|
+
export declare function getAttachmentFileUrl(type: string, id: string, attachment: PrepviewAttachment, isWorkOrder?: boolean): Promise<Blob>;
|
|
11
12
|
export declare function getDocuments(itemId: string, isWorkOrder?: boolean): Promise<PrepviewDocumentGroup[]>;
|
|
12
13
|
export declare function getHistory(itemId: string, isWorkOrder?: boolean): Promise<PrepviewHistory>;
|
|
13
14
|
export declare function getSafetyCards(itemId: string, isWorkOrder?: boolean): Promise<PrepviewSafety[]>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { SideSheetOrientation } from '@equinor/echo-components';
|
|
3
|
+
import { SEBadgeType, SNBadgeType, WoBadgeType } from '../colors';
|
|
3
4
|
import { Coordinates, HistoricNotificationItem, HistoricPunchItem, HistoricWorkOrderItem, ItemTypes, WorkOrderEquipment } from '../types';
|
|
4
5
|
import { WorkItemType } from '../utils';
|
|
5
|
-
import { SEBadgeType, SNBadgeType, WoBadgeType } from '../colors';
|
|
6
6
|
interface PrepviewContext {
|
|
7
7
|
orientation: SideSheetOrientation;
|
|
8
8
|
tagClicked: (tagId: string, instCode: string) => void;
|
|
@@ -4,5 +4,5 @@ interface AttachmentItemProps {
|
|
|
4
4
|
recordId: string;
|
|
5
5
|
attachment: PrepviewAttachment;
|
|
6
6
|
}
|
|
7
|
-
declare function AttachmentItem({ recordType, recordId, attachment
|
|
7
|
+
declare function AttachmentItem({ recordType, recordId, attachment }: AttachmentItemProps): import("react/jsx-runtime").JSX.Element;
|
|
8
8
|
export { AttachmentItem };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { GlobalSelectionTypes, OptimizedWorkOrderDto } from '../globalSelectionStore/globalSelectionStore.types';
|
|
2
|
+
import { GlobalSelectionCategoryId } from '../selectionMenu/selectionTreeStore/selectionTree.store.types';
|
|
2
3
|
export interface SelectionActionBarProps {
|
|
3
4
|
itemId: GlobalSelectionTypes.TagId | OptimizedWorkOrderDto;
|
|
4
|
-
|
|
5
|
+
categoryId: GlobalSelectionCategoryId;
|
|
5
6
|
}
|
|
6
7
|
export declare const SelectionActionBar: React.FC<SelectionActionBarProps>;
|
|
@@ -1,33 +1,8 @@
|
|
|
1
|
-
import { ResultValue, TagSummaryDto } from '@equinor/echo-search';
|
|
2
1
|
import { GlobalSelectionTypes } from './globalSelectionStore/globalSelectionStore.types';
|
|
3
|
-
|
|
4
|
-
* A frozen object that provides various API methods for managing global selections.
|
|
5
|
-
*
|
|
6
|
-
* @constant
|
|
7
|
-
* @namespace globalSelectionApi
|
|
8
|
-
*
|
|
9
|
-
* @property {Function} removeItemsByListId - Removes items by their list ID.
|
|
10
|
-
*
|
|
11
|
-
* @property {Object} add - Contains methods for adding items.
|
|
12
|
-
* @property {Function} add.tags - Adds tags to the selection.
|
|
13
|
-
* @property {Function} add.workOrders - Adds work orders to the selection.
|
|
14
|
-
*
|
|
15
|
-
* @property {Object} search - Contains methods for searching items.
|
|
16
|
-
* @property {Function} search.isItemIdInList - Checks if an item ID is in the list.
|
|
17
|
-
* @property {Function} search.isItemIdInTheSelection - Checks if an item ID is in the selection.
|
|
18
|
-
* @property {Function} search.findListById - Finds a selection list by its ID.
|
|
19
|
-
*
|
|
20
|
-
* @property {Object} visibility - Contains methods for setting visibility.
|
|
21
|
-
* @property {Function} visibility.setByItemIds - Sets visibility by item IDs.
|
|
22
|
-
* @property {Function} visibility.setByListId - Sets visibility by list ID.
|
|
23
|
-
*
|
|
24
|
-
* @property {Object} errorStatus - Contains methods for managing error statuses.
|
|
25
|
-
* @property {Function} errorStatus.setByItemIds - Sets error status for items by their IDs.
|
|
26
|
-
* @property {Function} errorStatus.removeByItemIds - Removes error status for items by their IDs.
|
|
27
|
-
* @property {Function} errorStatus.reset - Resets item error statuses.
|
|
28
|
-
*/
|
|
2
|
+
import { GlobalSelectionCategoryId, SelectionTreeTypes } from './selectionMenu/selectionTreeStore/selectionTree.store.types';
|
|
29
3
|
export declare const globalSelectionApi: Readonly<{
|
|
30
4
|
/**
|
|
5
|
+
* @deprecated Use globalSelectionApi.remove.itemsById() instead
|
|
31
6
|
* Removes items from a specified list in the selection menu panel by their IDs.
|
|
32
7
|
*
|
|
33
8
|
* @param {Object} args - The arguments for removing items.
|
|
@@ -41,61 +16,91 @@ export declare const globalSelectionApi: Readonly<{
|
|
|
41
16
|
listId: string;
|
|
42
17
|
itemIds: GlobalSelectionTypes.ItemId[];
|
|
43
18
|
}) => void;
|
|
44
|
-
|
|
19
|
+
remove: Readonly<{
|
|
20
|
+
/**
|
|
21
|
+
* Removes items from a specified list in the selection menu panel by their IDs.
|
|
22
|
+
*
|
|
23
|
+
* @param {Object} args - The arguments for removing items.
|
|
24
|
+
* @param {Readonly<GlobalSelectionTypes.ItemId[]>} args.itemIds - An array of item IDs representing the items to be removed.
|
|
25
|
+
* @param {Guid} args.groupId - Optional. The ID of the list where the subList of the items are located.
|
|
26
|
+
* Local selection will be used by default.
|
|
27
|
+
* @param {GlobalSelectionCategoryId} args.category - The ID of the list where the items to be removed are located.
|
|
28
|
+
*/
|
|
29
|
+
itemsById: (args: {
|
|
30
|
+
groupId?: import("dist/libs/echo-utils/src").Guid;
|
|
31
|
+
categoryId: GlobalSelectionCategoryId;
|
|
32
|
+
itemIds: GlobalSelectionTypes.ItemId[];
|
|
33
|
+
}) => void;
|
|
45
34
|
/**
|
|
46
|
-
*
|
|
35
|
+
* Removes a group or category by ID from the selection store.
|
|
47
36
|
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
* @param {Readonly<Readonly<TagSummaryDto>[]>} args.items - An array of TagSummaryDto objects representing the tags to be added.
|
|
37
|
+
* If a categoryId is provided, it removes all items from the specified category within the group.
|
|
38
|
+
* If no categoryId is provided, it removes the entire group and all its items.
|
|
51
39
|
*
|
|
52
|
-
* @
|
|
53
|
-
*
|
|
40
|
+
* @param {Object} args - The function arguments.
|
|
41
|
+
* @param {Guid} args.groupId - The ID of the group to remove.
|
|
42
|
+
* @param {GlobalSelectionCategoryId} [args.categoryId] - The ID of the category to remove (optional).
|
|
54
43
|
*/
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}) =>
|
|
44
|
+
listById: (args: {
|
|
45
|
+
groupId: import("dist/libs/echo-utils/src").Guid;
|
|
46
|
+
categoryId?: GlobalSelectionCategoryId;
|
|
47
|
+
}) => void;
|
|
48
|
+
}>;
|
|
49
|
+
add: Readonly<{
|
|
50
|
+
/**
|
|
51
|
+
* Adds tags to a selection and updates the state accordingly.
|
|
52
|
+
* Creates a group if label and sublabel are passed and the group doesn't exist.
|
|
53
|
+
*
|
|
54
|
+
* @param {AddTagsArgs} args - The arguments for adding tags.
|
|
55
|
+
* @param {Array<string>} args.itemIds - The IDs of the items to add tags to.
|
|
56
|
+
* @param {boolean} [args.replaceItems=false] - Whether to replace existing items with the new tags.
|
|
57
|
+
* @param {boolean} [args.getActionResult] - Optional, temporary. Will be removed. When passed the function will return with the actionResult as well.
|
|
58
|
+
* Otherwise it just returns with ResultArray<TagSummaryDto>[]>.
|
|
59
|
+
* @returns {Promise<AddTagsResponse>} response The response of the add tags action.
|
|
60
|
+
* @returns {Array<Object>} response.tagFetchResults - The results of the tag fetch operation.
|
|
61
|
+
* @returns {string} response.actionResult - The result of the action, if 'getActionResult' is set to true. It can be the following:
|
|
62
|
+
* - 'NoChanges': No new tags were added.
|
|
63
|
+
* - 'NewGroupCreated': A new group was created.
|
|
64
|
+
* - 'ItemsUpdated': Existing items were replaced with new tags.
|
|
65
|
+
* - 'ItemsAdded': New tags were added to the existing items.
|
|
66
|
+
*/
|
|
67
|
+
tags: <T extends boolean | undefined>(args: import("./selectionMenu/selectionTreeStore/actions/addTag.action.types").AddTagsArgs & {
|
|
68
|
+
getActionResult?: T;
|
|
69
|
+
}) => Promise<import("./selectionMenu/selectionTreeStore/selectionTree.store.types").AddTagsReturnType<T>>;
|
|
59
70
|
/**
|
|
60
71
|
* Adds work orders to a specified list in the selection menu panel.
|
|
61
72
|
*
|
|
62
73
|
* @param {Object} args - The arguments for adding work orders.
|
|
63
|
-
* @param {
|
|
74
|
+
* @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".
|
|
64
75
|
* @param {Readonly<Readonly<OptimizedWorkOrderDto>[]>} args.items - An array of OptimizedWorkOrderDto objects representing the work orders to be added.
|
|
65
|
-
*
|
|
66
|
-
* @example
|
|
67
|
-
* addWorkOrders({ listId: '456', items: [{ id: 'wo1', name: 'Work Order 1' }, { id: 'wo2', name: 'Work Order 2' }] });
|
|
68
76
|
*/
|
|
69
77
|
workOrders: (args: {
|
|
70
|
-
|
|
78
|
+
groupId?: import("dist/libs/echo-utils/src").Guid;
|
|
71
79
|
items: Readonly<Readonly<import("./globalSelectionStore/globalSelectionStore.types").OptimizedWorkOrderDto>[]>;
|
|
72
80
|
}) => void;
|
|
73
81
|
/**
|
|
74
82
|
* Adds items to a specified list in the selection menu panel.
|
|
75
83
|
*
|
|
76
84
|
* @param {Object} args - The arguments for adding items.
|
|
77
|
-
* @param {
|
|
85
|
+
* @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.
|
|
78
86
|
* @param {GlobalSelectionTypes.TagId | OptimizedWorkOrderDto)[]} args.itemIds - ItemIds to be added. Only tags or work orders can be added for now.
|
|
79
87
|
*
|
|
80
88
|
*/
|
|
81
89
|
addItems: (args: {
|
|
82
|
-
|
|
90
|
+
groupId? /**
|
|
91
|
+
* Removes a group or category by ID from the selection store.
|
|
92
|
+
*
|
|
93
|
+
* If a categoryId is provided, it removes all items from the specified category within the group.
|
|
94
|
+
* If no categoryId is provided, it removes the entire group and all its items.
|
|
95
|
+
*
|
|
96
|
+
* @param {Object} args - The function arguments.
|
|
97
|
+
* @param {Guid} args.groupId - The ID of the group to remove.
|
|
98
|
+
* @param {GlobalSelectionCategoryId} [args.categoryId] - The ID of the category to remove (optional).
|
|
99
|
+
*/: import("dist/libs/echo-utils/src").Guid;
|
|
83
100
|
itemIds: (GlobalSelectionTypes.TagId | import("./globalSelectionStore/globalSelectionStore.types").OptimizedWorkOrderDto)[];
|
|
84
101
|
}) => void;
|
|
85
102
|
}>;
|
|
86
|
-
search:
|
|
87
|
-
/**
|
|
88
|
-
* Checks if a given item ID is present in a specified list.
|
|
89
|
-
*
|
|
90
|
-
* @param args - An object containing the item ID and the list ID.
|
|
91
|
-
* @param {GlobalSelectionTypes.ItemId} args.itemId - The ID of the item to check for.
|
|
92
|
-
* @param {string} args.listId - The ID of the list to search within.
|
|
93
|
-
* @returns {boolean} A boolean indicating whether the item ID is found in the list.
|
|
94
|
-
*/
|
|
95
|
-
isItemIdInList: (args: {
|
|
96
|
-
itemId: GlobalSelectionTypes.ItemId;
|
|
97
|
-
listId: string;
|
|
98
|
-
}) => boolean;
|
|
103
|
+
search: {
|
|
99
104
|
/**
|
|
100
105
|
* Checks if a given item ID is present in the selection lists.
|
|
101
106
|
*
|
|
@@ -106,33 +111,27 @@ export declare const globalSelectionApi: Readonly<{
|
|
|
106
111
|
isItemIdInTheSelection: (args: {
|
|
107
112
|
itemId: GlobalSelectionTypes.ItemId;
|
|
108
113
|
}) => boolean;
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
* @param args - The arguments object.
|
|
114
|
-
* @param {string} args.listId - The ID of the selection list to find.
|
|
115
|
-
* @returns {SelectionMenuList | undefined} The selection menu list with the specified ID, or `undefined` if not found.
|
|
116
|
-
*/
|
|
117
|
-
findListById: (listId: string) => import("./selectionMenu/selectionMenuStore/selectionMenu.store.types").SelectionMenuList | undefined;
|
|
118
|
-
}>;
|
|
114
|
+
findGroupByLabel: (args: {
|
|
115
|
+
label: string;
|
|
116
|
+
}) => import("dist/libs/echo-utils/src").Guid | undefined;
|
|
117
|
+
};
|
|
119
118
|
visibility: Readonly<{
|
|
120
119
|
setByItemIds: (args: {
|
|
121
120
|
itemIds: Readonly<Readonly<GlobalSelectionTypes.ItemId>>[];
|
|
122
121
|
isVisible: boolean;
|
|
123
122
|
}) => void;
|
|
124
123
|
/**
|
|
125
|
-
* Sets the visibility of items in a specified list in
|
|
124
|
+
* Sets the visibility of items in a specified list in global selection.
|
|
126
125
|
*
|
|
127
126
|
* @param {Object} args - The arguments for setting visibility.
|
|
128
|
-
* @param {
|
|
127
|
+
* @param {Guid} args.groupId - The ID of the group for which the visibility should be set.
|
|
128
|
+
* @param {GlobalSelectionCategoryId} args.categoryId - Optional. The ID of the category for which the visibility should be set.
|
|
129
|
+
* If not passed, every item's visibility in the given group will be set.
|
|
129
130
|
* @param {boolean} args.isVisible - The visibility state to set for the items in the list.
|
|
130
|
-
*
|
|
131
|
-
* @example
|
|
132
|
-
* setVisibilityByListId({ listId: '123', isVisible: true });
|
|
133
131
|
*/
|
|
134
|
-
|
|
135
|
-
|
|
132
|
+
setById: (args: {
|
|
133
|
+
groupId: import("dist/libs/echo-utils/src").Guid;
|
|
134
|
+
categoryId?: GlobalSelectionCategoryId;
|
|
136
135
|
isVisible: boolean;
|
|
137
136
|
}) => void;
|
|
138
137
|
}>;
|
|
@@ -174,38 +173,22 @@ export declare const globalSelectionApi: Readonly<{
|
|
|
174
173
|
*/
|
|
175
174
|
reset: () => void;
|
|
176
175
|
}>;
|
|
176
|
+
utils: Readonly<{
|
|
177
|
+
/**
|
|
178
|
+
* Calculates the total number of items in the selection.
|
|
179
|
+
* Each instance of the same item is counted separately.
|
|
180
|
+
*
|
|
181
|
+
* @param {SelectionTreeTypes.Group[]} [groups] - Optional list of groups to calculate the total number of items for. If not provided, the current state of the selection tree store is used.
|
|
182
|
+
* @returns {number} The total number of items in all categories of the given groups.
|
|
183
|
+
*/
|
|
184
|
+
numberOfItemsInSelection: (groups?: SelectionTreeTypes.Group[]) => number;
|
|
185
|
+
}>;
|
|
177
186
|
/**
|
|
178
187
|
* Removes all items from the selection menu panel.
|
|
179
188
|
*/
|
|
180
189
|
clearSelection: () => void;
|
|
190
|
+
createGroup: (args: {
|
|
191
|
+
label: string;
|
|
192
|
+
subLabel: string;
|
|
193
|
+
}) => import("dist/libs/echo-utils/src").Guid;
|
|
181
194
|
}>;
|
|
182
|
-
interface UseGlobalSelectionStore {
|
|
183
|
-
addTagToSelection: (tagId: GlobalSelectionTypes.TagId) => Promise<ResultValue<TagSummaryDto>>;
|
|
184
|
-
removeItemFromSelection: (tagId: GlobalSelectionTypes.TagId) => void;
|
|
185
|
-
}
|
|
186
|
-
interface GlobalSelectionState {
|
|
187
|
-
resetItemErrorStatuses: typeof globalSelectionApi.errorStatus.reset;
|
|
188
|
-
setErrorStatusForItems: typeof globalSelectionApi.errorStatus.setByItemIds;
|
|
189
|
-
}
|
|
190
|
-
interface UseGlobalSelectionStoreFunction extends UseGlobalSelectionStore {
|
|
191
|
-
(): UseGlobalSelectionStore;
|
|
192
|
-
getState: () => GlobalSelectionState;
|
|
193
|
-
}
|
|
194
|
-
/**
|
|
195
|
-
* @deprecated Do not use this! Will be removed soon.
|
|
196
|
-
* Only made for 3D team to maintain some legacy API they are using.
|
|
197
|
-
* Please use globalSelectionApi instead (find the new functions to call below)
|
|
198
|
-
*
|
|
199
|
-
* Old --> New
|
|
200
|
-
* ---------------------------------------------
|
|
201
|
-
* addTagToSelection() --> globalSelectionApi.add.tags()
|
|
202
|
-
* - Now returns with ResultArray instead of Result: Promise<ResultArray<TagSummaryDto>[]>
|
|
203
|
-
* removeItemFromSelection() --> globalSelectionApi.removeItemsByListId()
|
|
204
|
-
* - Now a listId is required as well.
|
|
205
|
-
* - Use SelectionMenuDefaultListIds.TagList from echo-framework for removing item from the default tag list.
|
|
206
|
-
*
|
|
207
|
-
* resetItemErrorStatuses() --> globalSelectionApi.errorStatus.reset()
|
|
208
|
-
* setErrorStatusForItems() --> globalSelectionApi.errorStatus.setByItemIds()
|
|
209
|
-
*/
|
|
210
|
-
export declare const useGlobalSelectionStore: UseGlobalSelectionStoreFunction;
|
|
211
|
-
export {};
|
package/src/lib/feature/globalSelection/globalSelectionStore/globalSelectionStore.types.d.ts
CHANGED
|
@@ -47,7 +47,7 @@ export interface GlobalSelectionStore {
|
|
|
47
47
|
}) => void;
|
|
48
48
|
addTagsToSelection: (args: {
|
|
49
49
|
tagIds: Readonly<GlobalSelectionTypes.TagId[]>;
|
|
50
|
-
}) => Promise<
|
|
50
|
+
}) => Promise<AddTagActionResult>;
|
|
51
51
|
removeItemsFromSelection: (args: {
|
|
52
52
|
itemIds: ReadonlyArray<GlobalSelectionTypes.ItemId>;
|
|
53
53
|
}) => void;
|
|
@@ -64,6 +64,11 @@ export interface GlobalSelectionStore {
|
|
|
64
64
|
itemIds: Readonly<GlobalSelectionTypes.ItemId[]>;
|
|
65
65
|
}) => void;
|
|
66
66
|
}
|
|
67
|
+
type GlobalSelectionActionResult = 'NoChanges' | 'ItemsAdded';
|
|
68
|
+
type AddTagActionResult = {
|
|
69
|
+
fetchResult: ResultArray<TagSummaryDto>[];
|
|
70
|
+
actionResult: GlobalSelectionActionResult;
|
|
71
|
+
};
|
|
67
72
|
export declare namespace GlobalSelectionTypes {
|
|
68
73
|
type WorkOrderId = Pick<OptimizedWorkOrderDto, 'workOrderId'>;
|
|
69
74
|
type EquipmentId = Pick<Equipment, 'equipmentId'>;
|
|
@@ -83,6 +88,7 @@ export declare namespace GlobalSelectionTypes {
|
|
|
83
88
|
type EquipmentList = EquipmentGlobalSelectionList;
|
|
84
89
|
type ListUnion = GlobalSelectionListUnion;
|
|
85
90
|
type ItemTypeToDataMap = GlobalSelectionItemTypeToDataMap;
|
|
91
|
+
type AddTagResult = AddTagActionResult;
|
|
86
92
|
}
|
|
87
93
|
export interface OptimizedWorkOrderDto {
|
|
88
94
|
workOrderId: string;
|
package/src/lib/feature/globalSelection/globalSelectionStore/globalSelectionStore.utils.d.ts
CHANGED
|
@@ -31,7 +31,7 @@ declare function mapToId(item: GlobalSelectionTypes.WorkOrderId): GlobalSelectio
|
|
|
31
31
|
declare function mapToId(item: GlobalSelectionTypes.EquipmentId): GlobalSelectionTypes.EquipmentId;
|
|
32
32
|
declare function mapToId(item: GlobalSelectionTypes.TagId): GlobalSelectionTypes.TagId;
|
|
33
33
|
declare function mapToId(item: GlobalSelectionTypes.ItemId): GlobalSelectionTypes.ItemId;
|
|
34
|
-
declare function itemIdToString(itemId:
|
|
34
|
+
declare function itemIdToString(itemId: GlobalSelectionTypes.ItemId): string;
|
|
35
35
|
/**
|
|
36
36
|
* A utility object that provides various functions for handling global selections.
|
|
37
37
|
*
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Guid } from '@equinor/echo-utils';
|
|
2
|
+
import { SelectionTreeTypes } from '../selectionMenu/selectionTreeStore/selectionTree.store.types';
|
|
3
|
+
/**
|
|
4
|
+
* Custom hook to get the selection categories by group ID from the global selection tree hiearchy.
|
|
5
|
+
*
|
|
6
|
+
* This hook retrieves the categories for a given group ID from the selection tree store.
|
|
7
|
+
*
|
|
8
|
+
* @param {Guid} groupId - The ID of the group to get categories for.
|
|
9
|
+
* @returns {SelectionTreeTypes.Category[] | undefined} The categories for the given group ID, or undefined if not found.
|
|
10
|
+
*/
|
|
11
|
+
export declare function useSelectionCategoriesByGroupId(groupId: Guid): SelectionTreeTypes.Category[] | undefined;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { globalSelectionApi
|
|
1
|
+
export { globalSelectionApi } from './globalSelection.api';
|
|
2
2
|
export * from './globalSelectionStore/globalSelectionStore.types';
|
|
3
3
|
export { globalSelectionUtils } from './globalSelectionStore/globalSelectionStore.utils';
|
|
4
4
|
export { convertGlobalSelectionItemsToPlantTagPairs } from './globalSelectionStore/globalSelectionStoreHelpers';
|
|
@@ -6,4 +6,7 @@ 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 { useSelectionCategoriesByGroupId } from './hooks/useSelectionCategoriesByGroupId';
|
|
9
10
|
export { OpenGlobalSelectionIn3DButton } from './OpenGlobalSelectionIn3DButton';
|
|
11
|
+
export { useSelectionMenuGroups } from './selectionMenu/hooks/useSelectionMenuGroups';
|
|
12
|
+
export * from './selectionMenu/selectionTreeStore/selectionTree.store.types';
|
|
@@ -1,7 +1,13 @@
|
|
|
1
|
+
import { Guid } from '@equinor/echo-utils';
|
|
2
|
+
interface useIsAllIGlobalSelectionItemsHiddenArgs {
|
|
3
|
+
groupId: Guid;
|
|
4
|
+
categoryId?: string;
|
|
5
|
+
}
|
|
1
6
|
/**
|
|
2
7
|
* Custom hook to determine if all items in a selection list are hidden by the user.
|
|
3
8
|
*
|
|
4
|
-
* @param {
|
|
9
|
+
* @param {Guid} groupId - The ID of the list group.
|
|
10
|
+
* @param {string} [categoryId] - The ID of the category, inside the given list group.
|
|
5
11
|
* @returns {boolean} - A boolean indicating whether all items in the list are hidden by the user.
|
|
6
12
|
*
|
|
7
13
|
* This hook uses the `useGlobalSelectionLists` hook to get the current global selection state and
|
|
@@ -9,4 +15,5 @@
|
|
|
9
15
|
*
|
|
10
16
|
* The hook returns `true` if all items in the list are hidden by the user, and `false` otherwise.
|
|
11
17
|
*/
|
|
12
|
-
export declare const
|
|
18
|
+
export declare const useIsAllIGlobalSelectionItemsHidden: (args: useIsAllIGlobalSelectionItemsHiddenArgs) => boolean;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { SelectionTreeTypes } from '../selectionTreeStore/selectionTree.store.types';
|
|
2
|
+
/**
|
|
3
|
+
* Custom hook to get the selection menu lists from the selection menu store, displayed in the left selection panel.
|
|
4
|
+
*
|
|
5
|
+
* @returns {SelectionTreeTypes.Group[]} - An array of selection menu lists.
|
|
6
|
+
*/
|
|
7
|
+
export declare function useSelectionMenuGroups(): SelectionTreeTypes.Group[];
|
package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/actions/addTag.action.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ResultArray, TagSummaryDto } from '@equinor/echo-search';
|
|
2
|
+
import { WritableDraft } from 'immer';
|
|
3
|
+
import { StoreApi } from 'zustand';
|
|
4
|
+
import { SelectionTreeStore } from '../selectionTree.store.types';
|
|
5
|
+
import { AddTagsArgs, AddTagsResponse } from './addTag.action.types';
|
|
6
|
+
type SetFunction = (set: (state: WritableDraft<SelectionTreeStore>) => void, shouldReplace?: boolean | undefined, action?: string) => void;
|
|
7
|
+
export declare function addTagsAction(set: SetFunction, get: StoreApi<SelectionTreeStore>['getState'], args: AddTagsArgs & {
|
|
8
|
+
getActionResult: true;
|
|
9
|
+
}): Promise<AddTagsResponse>;
|
|
10
|
+
export declare function addTagsAction(set: SetFunction, get: StoreApi<SelectionTreeStore>['getState'], args: AddTagsArgs & {
|
|
11
|
+
getActionResult?: false;
|
|
12
|
+
}): Promise<ResultArray<TagSummaryDto>[]>;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ResultArray, TagSummaryDto } from '@equinor/echo-search';
|
|
2
|
+
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
|
+
} | {
|
|
11
|
+
label?: undefined;
|
|
12
|
+
subLabel?: undefined;
|
|
13
|
+
});
|
|
14
|
+
export type AddTagsResponse = {
|
|
15
|
+
fetchResults: ResultArray<TagSummaryDto>[];
|
|
16
|
+
actionResult: SelectionTreeActionResult;
|
|
17
|
+
};
|
|
18
|
+
export type SelectionTreeActionResult = 'ItemsUpdated' | 'ItemsAdded' | 'NewGroupCreated' | 'NoChanges';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { SelectionCategory, SelectionGroup } from './selectionTree.store.types';
|
|
2
|
+
export declare const selectionTreeInitialData: Readonly<{
|
|
3
|
+
localSelectionGroup: SelectionGroup;
|
|
4
|
+
categoryOrder: {
|
|
5
|
+
tagIndex: number;
|
|
6
|
+
workOrderIndex: number;
|
|
7
|
+
};
|
|
8
|
+
localSelectionGroupIndex: 0;
|
|
9
|
+
getInitialCategories: () => SelectionCategory[];
|
|
10
|
+
}>;
|
package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/selectionTree.store.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { SelectionTreeStore } from './selectionTree.store.types';
|
|
2
|
+
export declare const useSelectionTreeStore: import("zustand").UseBoundStore<Omit<Omit<Omit<import("zustand").StoreApi<SelectionTreeStore>, "setState"> & {
|
|
3
|
+
setState<A extends string | {
|
|
4
|
+
type: string;
|
|
5
|
+
}>(partial: SelectionTreeStore | Partial<SelectionTreeStore> | ((state: SelectionTreeStore) => SelectionTreeStore | Partial<SelectionTreeStore>), replace?: boolean | undefined, action?: A | undefined): void;
|
|
6
|
+
}, "subscribe"> & {
|
|
7
|
+
subscribe: {
|
|
8
|
+
(listener: (selectedState: SelectionTreeStore, previousSelectedState: SelectionTreeStore) => void): () => void;
|
|
9
|
+
<U>(selector: (state: SelectionTreeStore) => U, listener: (selectedState: U, previousSelectedState: U) => void, options?: {
|
|
10
|
+
equalityFn?: ((a: U, b: U) => boolean) | undefined;
|
|
11
|
+
fireImmediately?: boolean;
|
|
12
|
+
} | undefined): () => void;
|
|
13
|
+
};
|
|
14
|
+
}, "setState"> & {
|
|
15
|
+
setState(nextStateOrUpdater: SelectionTreeStore | Partial<SelectionTreeStore> | ((state: import("immer").WritableDraft<SelectionTreeStore>) => void), shouldReplace?: boolean | undefined, action?: string | {
|
|
16
|
+
type: string;
|
|
17
|
+
} | undefined): void;
|
|
18
|
+
}>;
|
|
19
|
+
/**
|
|
20
|
+
* Get a snapshot of the current selection tree store state.
|
|
21
|
+
*/
|
|
22
|
+
export declare function getSelectionTreeStoreSnapshot(): SelectionTreeStore;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { ResultArray, TagSummaryDto } from '@equinor/echo-search';
|
|
2
|
+
import { Guid } from '@equinor/echo-utils';
|
|
3
|
+
import { GlobalSelectionItemType, GlobalSelectionTypes, OptimizedWorkOrderDto } from '../../globalSelectionStore/globalSelectionStore.types';
|
|
4
|
+
import { AddTagsArgs, AddTagsResponse, SelectionTreeActionResult } from './actions/addTag.action.types';
|
|
5
|
+
type SelectionItem = SelectionMenuTag | SelectionMenuWorkOrder | SelectionMenuEquipment;
|
|
6
|
+
export declare enum GlobalSelectionCategoryId {
|
|
7
|
+
Tags = "DEFAULT_TAG_LIST_ID",
|
|
8
|
+
WorkOrders = "DEFAULT_WORK_ORDER_LIST_ID"
|
|
9
|
+
}
|
|
10
|
+
export declare const globalSelectionDefaultGroupId: Guid;
|
|
11
|
+
/** @deprecated Use GlobalSelectionCategoryId instead */
|
|
12
|
+
export declare enum SelectionMenuDefaultListIds {
|
|
13
|
+
TagList = "DEFAULT_TAG_LIST_ID",
|
|
14
|
+
WorkOrderList = "DEFAULT_WORK_ORDER_LIST_ID"
|
|
15
|
+
}
|
|
16
|
+
export interface SelectionMenuTag {
|
|
17
|
+
id: GlobalSelectionTypes.TagId;
|
|
18
|
+
type: GlobalSelectionItemType.Tag;
|
|
19
|
+
}
|
|
20
|
+
export interface SelectionMenuWorkOrder {
|
|
21
|
+
id: GlobalSelectionTypes.WorkOrderId;
|
|
22
|
+
type: GlobalSelectionItemType.WorkOrder;
|
|
23
|
+
}
|
|
24
|
+
export interface SelectionMenuEquipment {
|
|
25
|
+
id: GlobalSelectionTypes.EquipmentId;
|
|
26
|
+
type: GlobalSelectionItemType.Equipment;
|
|
27
|
+
}
|
|
28
|
+
interface SelectionBase {
|
|
29
|
+
label: string;
|
|
30
|
+
subLabel?: string;
|
|
31
|
+
}
|
|
32
|
+
export interface SelectionCategory extends SelectionBase {
|
|
33
|
+
id: GlobalSelectionCategoryId;
|
|
34
|
+
items: SelectionItem[];
|
|
35
|
+
}
|
|
36
|
+
export interface SelectionGroup extends SelectionBase {
|
|
37
|
+
id: Guid;
|
|
38
|
+
categories: SelectionCategory[];
|
|
39
|
+
}
|
|
40
|
+
export interface SelectionTreeStore {
|
|
41
|
+
groups: SelectionGroup[];
|
|
42
|
+
addTags: <T extends boolean | undefined>(args: AddTagsArgs & {
|
|
43
|
+
getActionResult?: T;
|
|
44
|
+
}) => Promise<AddTagsReturnType<T>>;
|
|
45
|
+
addWorkOrders: (args: {
|
|
46
|
+
groupId?: Guid;
|
|
47
|
+
items: Readonly<Readonly<OptimizedWorkOrderDto>[]>;
|
|
48
|
+
}) => void;
|
|
49
|
+
addItems: (args: {
|
|
50
|
+
groupId?: Guid;
|
|
51
|
+
itemIds: (GlobalSelectionTypes.TagId | OptimizedWorkOrderDto)[];
|
|
52
|
+
}) => void;
|
|
53
|
+
createGroup: (args: {
|
|
54
|
+
label: string;
|
|
55
|
+
subLabel: string;
|
|
56
|
+
}) => Guid;
|
|
57
|
+
removeGroupById: (args: {
|
|
58
|
+
groupId: Guid;
|
|
59
|
+
categoryId?: GlobalSelectionCategoryId;
|
|
60
|
+
}) => void;
|
|
61
|
+
findGroupIdByLabel: (args: {
|
|
62
|
+
label: string;
|
|
63
|
+
}) => Guid | undefined;
|
|
64
|
+
removeItemsById: (args: {
|
|
65
|
+
groupId?: Guid;
|
|
66
|
+
categoryId: GlobalSelectionCategoryId;
|
|
67
|
+
itemIds: GlobalSelectionTypes.ItemId[];
|
|
68
|
+
}) => void;
|
|
69
|
+
setVisibilityById: (args: {
|
|
70
|
+
groupId: Guid;
|
|
71
|
+
categoryId?: GlobalSelectionCategoryId;
|
|
72
|
+
isVisible: boolean;
|
|
73
|
+
}) => void;
|
|
74
|
+
resetState: () => void;
|
|
75
|
+
}
|
|
76
|
+
export declare namespace SelectionTreeTypes {
|
|
77
|
+
type Category = SelectionCategory;
|
|
78
|
+
type Group = SelectionGroup;
|
|
79
|
+
type Item = SelectionItem;
|
|
80
|
+
type ActionResult = SelectionTreeActionResult;
|
|
81
|
+
}
|
|
82
|
+
export type AddTagsReturnType<T extends boolean | undefined> = T extends true ? Promise<AddTagsResponse> : Promise<ResultArray<TagSummaryDto>[]>;
|
|
83
|
+
export {};
|