@equinor/echo-framework 0.20.20 → 0.20.22
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 +1 -14
- package/package.json +1 -1
- package/src/index.d.ts +3 -4
- package/src/lib/feature/globalSelection/components/SelectionActionBar.d.ts +7 -0
- package/src/lib/feature/globalSelection/globalSelection.api.d.ts +82 -97
- package/src/lib/feature/globalSelection/globalSelectionStore/globalSelectionStore.utils.d.ts +1 -1
- package/src/lib/feature/globalSelection/hooks/useIsInGlobalSelection.d.ts +8 -0
- 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/selectionTree.store.d.ts +37 -0
- package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/selectionTree.store.types.d.ts +84 -0
- package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/selectionTree.store.utils.d.ts +53 -0
- package/src/lib/feature/legacyLegend/legend.d.ts +1 -1
- package/src/lib/feature/globalSelection/selectionMenu/hooks/useSelectionMenuLists.d.ts +0 -7
- package/src/lib/feature/globalSelection/selectionMenu/selectionMenuStore/selectionMenu.store.d.ts +0 -43
- package/src/lib/feature/globalSelection/selectionMenu/selectionMenuStore/selectionMenu.store.types.d.ts +0 -52
- package/src/lib/feature/globalSelection/selectionMenu/selectionMenuStore/selectionMenu.store.utils.d.ts +0 -56
package/package.json
CHANGED
package/src/index.d.ts
CHANGED
|
@@ -11,12 +11,11 @@ export * from './lib/coreApplication';
|
|
|
11
11
|
export { fetchEquipmentFromApi } from './lib/feature/equipment/api/api-equipmentWithMeasuringPoints';
|
|
12
12
|
export * from './lib/feature/equipment/index';
|
|
13
13
|
export * from './lib/feature/globalSelection';
|
|
14
|
+
export { SelectionActionBar } from './lib/feature/globalSelection/components/SelectionActionBar';
|
|
14
15
|
export type { OptimizedWorkOrderDto } from './lib/feature/globalSelection/globalSelectionStore/globalSelectionStore.types';
|
|
15
16
|
export { PanTo3DButton } from './lib/feature/globalSelection/panToEcho3d/panTo3DButton';
|
|
16
|
-
export {
|
|
17
|
-
export {
|
|
18
|
-
export { SelectionMenuDefaultListIds } from './lib/feature/globalSelection/selectionMenu/selectionMenuStore/selectionMenu.store';
|
|
19
|
-
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';
|
|
20
19
|
export * from './lib/feature/legacyLegend/index';
|
|
21
20
|
export { getLatestMeasurementDate, sortMeasuringPointsByMeasurementDate } from './lib/feature/measuringPoint/components/measuringPoints.utils';
|
|
22
21
|
export * from './lib/feature/measuringPoint/index';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { GlobalSelectionTypes, OptimizedWorkOrderDto } from '../globalSelectionStore/globalSelectionStore.types';
|
|
2
|
+
import { GlobalSelectionCategoryId } from '../selectionMenu/selectionTreeStore/selectionTree.store.types';
|
|
3
|
+
export interface SelectionActionBarProps {
|
|
4
|
+
itemId: GlobalSelectionTypes.TagId | OptimizedWorkOrderDto;
|
|
5
|
+
categoryId: GlobalSelectionCategoryId;
|
|
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,49 +16,81 @@ export declare const globalSelectionApi: Readonly<{
|
|
|
41
16
|
listId: string;
|
|
42
17
|
itemIds: GlobalSelectionTypes.ItemId[];
|
|
43
18
|
}) => void;
|
|
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;
|
|
34
|
+
/**
|
|
35
|
+
* Removes a group or category by ID from the selection store.
|
|
36
|
+
*
|
|
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.
|
|
39
|
+
*
|
|
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).
|
|
43
|
+
*/
|
|
44
|
+
listById: (args: {
|
|
45
|
+
groupId: import("dist/libs/echo-utils/src").Guid;
|
|
46
|
+
categoryId?: GlobalSelectionCategoryId;
|
|
47
|
+
}) => void;
|
|
48
|
+
}>;
|
|
44
49
|
add: Readonly<{
|
|
45
50
|
/**
|
|
46
51
|
* Adds tags to a specified list in the selection menu panel.
|
|
47
52
|
*
|
|
48
53
|
* @param {Object} args - The arguments for adding tags.
|
|
49
|
-
* @param {
|
|
50
|
-
* @param {Readonly<
|
|
51
|
-
*
|
|
52
|
-
* @example
|
|
53
|
-
* addTags({ listId: '123', items: [{ id: 'tag1', name: 'Tag 1' }, { id: 'tag2', name: 'Tag 2' }] });
|
|
54
|
+
* @param {Guid} args.groupId - Optional - The ID of the group to which the tags should be added. If not provided, it will be added to the "Local Selection".
|
|
55
|
+
* @param {Readonly<GlobalSelectionTypes.TagId[]>} args.itemIds - An array of TagId objects representing the tags to be added.
|
|
54
56
|
*/
|
|
55
57
|
tags: (args: {
|
|
56
|
-
|
|
58
|
+
groupId? /**
|
|
59
|
+
* Removes items from a specified list in the selection menu panel by their IDs.
|
|
60
|
+
*
|
|
61
|
+
* @param {Object} args - The arguments for removing items.
|
|
62
|
+
* @param {Readonly<GlobalSelectionTypes.ItemId[]>} args.itemIds - An array of item IDs representing the items to be removed.
|
|
63
|
+
* @param {Guid} args.groupId - Optional. The ID of the list where the subList of the items are located.
|
|
64
|
+
* Local selection will be used by default.
|
|
65
|
+
* @param {GlobalSelectionCategoryId} args.category - The ID of the list where the items to be removed are located.
|
|
66
|
+
*/: import("dist/libs/echo-utils/src").Guid;
|
|
57
67
|
itemIds: Readonly<GlobalSelectionTypes.TagId[]>;
|
|
58
|
-
}) => Promise<import("
|
|
68
|
+
}) => Promise<import("dist/libs/echo-search/src").ResultArray<import("dist/libs/echo-search/src").TagSummaryDto>[]>;
|
|
59
69
|
/**
|
|
60
70
|
* Adds work orders to a specified list in the selection menu panel.
|
|
61
71
|
*
|
|
62
72
|
* @param {Object} args - The arguments for adding work orders.
|
|
63
|
-
* @param {
|
|
73
|
+
* @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
74
|
* @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
75
|
*/
|
|
69
76
|
workOrders: (args: {
|
|
70
|
-
|
|
77
|
+
groupId?: import("dist/libs/echo-utils/src").Guid;
|
|
71
78
|
items: Readonly<Readonly<import("./globalSelectionStore/globalSelectionStore.types").OptimizedWorkOrderDto>[]>;
|
|
72
79
|
}) => void;
|
|
73
|
-
}>;
|
|
74
|
-
search: Readonly<{
|
|
75
80
|
/**
|
|
76
|
-
*
|
|
81
|
+
* Adds items to a specified list in the selection menu panel.
|
|
82
|
+
*
|
|
83
|
+
* @param {Object} args - The arguments for adding items.
|
|
84
|
+
* @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.
|
|
85
|
+
* @param {GlobalSelectionTypes.TagId | OptimizedWorkOrderDto)[]} args.itemIds - ItemIds to be added. Only tags or work orders can be added for now.
|
|
77
86
|
*
|
|
78
|
-
* @param args - An object containing the item ID and the list ID.
|
|
79
|
-
* @param {GlobalSelectionTypes.ItemId} args.itemId - The ID of the item to check for.
|
|
80
|
-
* @param {string} args.listId - The ID of the list to search within.
|
|
81
|
-
* @returns {boolean} A boolean indicating whether the item ID is found in the list.
|
|
82
87
|
*/
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
}) =>
|
|
88
|
+
addItems: (args: {
|
|
89
|
+
groupId?: import("dist/libs/echo-utils/src").Guid;
|
|
90
|
+
itemIds: (GlobalSelectionTypes.TagId | import("./globalSelectionStore/globalSelectionStore.types").OptimizedWorkOrderDto)[];
|
|
91
|
+
}) => void;
|
|
92
|
+
}>;
|
|
93
|
+
search: {
|
|
87
94
|
/**
|
|
88
95
|
* Checks if a given item ID is present in the selection lists.
|
|
89
96
|
*
|
|
@@ -94,33 +101,27 @@ export declare const globalSelectionApi: Readonly<{
|
|
|
94
101
|
isItemIdInTheSelection: (args: {
|
|
95
102
|
itemId: GlobalSelectionTypes.ItemId;
|
|
96
103
|
}) => boolean;
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
* @param args - The arguments object.
|
|
102
|
-
* @param {string} args.listId - The ID of the selection list to find.
|
|
103
|
-
* @returns {SelectionMenuList | undefined} The selection menu list with the specified ID, or `undefined` if not found.
|
|
104
|
-
*/
|
|
105
|
-
findListById: (listId: string) => import("./selectionMenu/selectionMenuStore/selectionMenu.store.types").SelectionMenuList | undefined;
|
|
106
|
-
}>;
|
|
104
|
+
findGroupByLabel: (args: {
|
|
105
|
+
label: string;
|
|
106
|
+
}) => import("dist/libs/echo-utils/src").Guid | undefined;
|
|
107
|
+
};
|
|
107
108
|
visibility: Readonly<{
|
|
108
109
|
setByItemIds: (args: {
|
|
109
110
|
itemIds: Readonly<Readonly<GlobalSelectionTypes.ItemId>>[];
|
|
110
111
|
isVisible: boolean;
|
|
111
112
|
}) => void;
|
|
112
113
|
/**
|
|
113
|
-
* Sets the visibility of items in a specified list in
|
|
114
|
+
* Sets the visibility of items in a specified list in global selection.
|
|
114
115
|
*
|
|
115
116
|
* @param {Object} args - The arguments for setting visibility.
|
|
116
|
-
* @param {
|
|
117
|
+
* @param {Guid} args.groupId - The ID of the group for which the visibility should be set.
|
|
118
|
+
* @param {GlobalSelectionCategoryId} args.categoryId - Optional. The ID of the category for which the visibility should be set.
|
|
119
|
+
* If not passed, every item's visibility in the given group will be set.
|
|
117
120
|
* @param {boolean} args.isVisible - The visibility state to set for the items in the list.
|
|
118
|
-
*
|
|
119
|
-
* @example
|
|
120
|
-
* setVisibilityByListId({ listId: '123', isVisible: true });
|
|
121
121
|
*/
|
|
122
|
-
|
|
123
|
-
|
|
122
|
+
setById: (args: {
|
|
123
|
+
groupId: import("dist/libs/echo-utils/src").Guid;
|
|
124
|
+
categoryId?: GlobalSelectionCategoryId;
|
|
124
125
|
isVisible: boolean;
|
|
125
126
|
}) => void;
|
|
126
127
|
}>;
|
|
@@ -162,38 +163,22 @@ export declare const globalSelectionApi: Readonly<{
|
|
|
162
163
|
*/
|
|
163
164
|
reset: () => void;
|
|
164
165
|
}>;
|
|
166
|
+
utils: Readonly<{
|
|
167
|
+
/**
|
|
168
|
+
* Calculates the total number of items in the selection.
|
|
169
|
+
* Each instance of the same item is counted separately.
|
|
170
|
+
*
|
|
171
|
+
* @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.
|
|
172
|
+
* @returns {number} The total number of items in all categories of the given groups.
|
|
173
|
+
*/
|
|
174
|
+
numberOfItemsInSelection: (groups?: SelectionTreeTypes.Group[]) => number;
|
|
175
|
+
}>;
|
|
165
176
|
/**
|
|
166
177
|
* Removes all items from the selection menu panel.
|
|
167
178
|
*/
|
|
168
179
|
clearSelection: () => void;
|
|
180
|
+
createGroup: (args: {
|
|
181
|
+
label: string;
|
|
182
|
+
subLabel?: string;
|
|
183
|
+
}) => import("dist/libs/echo-utils/src").Guid | undefined;
|
|
169
184
|
}>;
|
|
170
|
-
interface UseGlobalSelectionStore {
|
|
171
|
-
addTagToSelection: (tagId: GlobalSelectionTypes.TagId) => Promise<ResultValue<TagSummaryDto>>;
|
|
172
|
-
removeItemFromSelection: (tagId: GlobalSelectionTypes.TagId) => void;
|
|
173
|
-
}
|
|
174
|
-
interface GlobalSelectionState {
|
|
175
|
-
resetItemErrorStatuses: typeof globalSelectionApi.errorStatus.reset;
|
|
176
|
-
setErrorStatusForItems: typeof globalSelectionApi.errorStatus.setByItemIds;
|
|
177
|
-
}
|
|
178
|
-
interface UseGlobalSelectionStoreFunction extends UseGlobalSelectionStore {
|
|
179
|
-
(): UseGlobalSelectionStore;
|
|
180
|
-
getState: () => GlobalSelectionState;
|
|
181
|
-
}
|
|
182
|
-
/**
|
|
183
|
-
* @deprecated Do not use this! Will be removed soon.
|
|
184
|
-
* Only made for 3D team to maintain some legacy API they are using.
|
|
185
|
-
* Please use globalSelectionApi instead (find the new functions to call below)
|
|
186
|
-
*
|
|
187
|
-
* Old --> New
|
|
188
|
-
* ---------------------------------------------
|
|
189
|
-
* addTagToSelection() --> globalSelectionApi.add.tags()
|
|
190
|
-
* - Now returns with ResultArray instead of Result: Promise<ResultArray<TagSummaryDto>[]>
|
|
191
|
-
* removeItemFromSelection() --> globalSelectionApi.removeItemsByListId()
|
|
192
|
-
* - Now a listId is required as well.
|
|
193
|
-
* - Use SelectionMenuDefaultListIds.TagList from echo-framework for removing item from the default tag list.
|
|
194
|
-
*
|
|
195
|
-
* resetItemErrorStatuses() --> globalSelectionApi.errorStatus.reset()
|
|
196
|
-
* setErrorStatusForItems() --> globalSelectionApi.errorStatus.setByItemIds()
|
|
197
|
-
*/
|
|
198
|
-
export declare const useGlobalSelectionStore: UseGlobalSelectionStoreFunction;
|
|
199
|
-
export {};
|
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,8 @@
|
|
|
1
|
+
import { GlobalSelectionTypes } from '../globalSelectionStore/globalSelectionStore.types';
|
|
2
|
+
/**
|
|
3
|
+
* Hook to check if an item is in the global selection
|
|
4
|
+
* @param {GlobalSelectionTypes.ItemId} itemId - The itemId
|
|
5
|
+
* @param {GlobalSelectionItemType} itemType - The item type
|
|
6
|
+
* @returns {boolean} - True if the item is in global selection, false otherwise
|
|
7
|
+
*/
|
|
8
|
+
export declare function useIsInGlobalSelection(itemId: GlobalSelectionTypes.ItemId): boolean;
|
|
@@ -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/selectionTree.store.d.ts
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { SelectionTreeStore } from './selectionTree.store.types';
|
|
2
|
+
/**
|
|
3
|
+
* Store for the selection menu, in a left panel.
|
|
4
|
+
*
|
|
5
|
+
* Stores the hierachry, tree structure of the items in Global Selection.
|
|
6
|
+
* With this, it is in charge of:
|
|
7
|
+
* - tracking which item belongs to which list
|
|
8
|
+
* - adding items to global selection
|
|
9
|
+
* - remove items from global selection
|
|
10
|
+
* - update items (visibility, removal etc.) via list ids
|
|
11
|
+
* - maintaining the global selection store based on the changes in the items, in the selection menu panel
|
|
12
|
+
*
|
|
13
|
+
* You shouldn't use this store directly in any code, unless you have very special reason to do so.
|
|
14
|
+
*
|
|
15
|
+
* For accessing and using global selection features, use the globalSelectionApi from echo-framework.
|
|
16
|
+
*/
|
|
17
|
+
export declare const useSelectionTreeStore: import("zustand").UseBoundStore<Omit<Omit<Omit<import("zustand").StoreApi<SelectionTreeStore>, "setState"> & {
|
|
18
|
+
setState<A extends string | {
|
|
19
|
+
type: string;
|
|
20
|
+
}>(partial: SelectionTreeStore | Partial<SelectionTreeStore> | ((state: SelectionTreeStore) => SelectionTreeStore | Partial<SelectionTreeStore>), replace?: boolean | undefined, action?: A | undefined): void;
|
|
21
|
+
}, "subscribe"> & {
|
|
22
|
+
subscribe: {
|
|
23
|
+
(listener: (selectedState: SelectionTreeStore, previousSelectedState: SelectionTreeStore) => void): () => void;
|
|
24
|
+
<U>(selector: (state: SelectionTreeStore) => U, listener: (selectedState: U, previousSelectedState: U) => void, options?: {
|
|
25
|
+
equalityFn?: ((a: U, b: U) => boolean) | undefined;
|
|
26
|
+
fireImmediately?: boolean;
|
|
27
|
+
} | undefined): () => void;
|
|
28
|
+
};
|
|
29
|
+
}, "setState"> & {
|
|
30
|
+
setState(nextStateOrUpdater: SelectionTreeStore | Partial<SelectionTreeStore> | ((state: import("immer").WritableDraft<SelectionTreeStore>) => void), shouldReplace?: boolean | undefined, action?: string | {
|
|
31
|
+
type: string;
|
|
32
|
+
} | undefined): void;
|
|
33
|
+
}>;
|
|
34
|
+
/**
|
|
35
|
+
* Get a snapshot of the current selection tree store state.
|
|
36
|
+
*/
|
|
37
|
+
export declare function getSelectionTreeStoreSnapshot(): SelectionTreeStore;
|
|
@@ -0,0 +1,84 @@
|
|
|
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
|
+
type SelectionItem = SelectionItemTag | SelectionItemWorkOrder | SelectionItemEquipment;
|
|
5
|
+
export declare enum GlobalSelectionCategoryId {
|
|
6
|
+
Tags = "DEFAULT_TAG_LIST_ID",
|
|
7
|
+
WorkOrders = "DEFAULT_WORK_ORDER_LIST_ID"
|
|
8
|
+
}
|
|
9
|
+
export declare const globalSelectionDefaultGroupId: Guid;
|
|
10
|
+
/** @deprecated Use GlobalSelectionCategoryId instead */
|
|
11
|
+
export declare enum SelectionMenuDefaultListIds {
|
|
12
|
+
TagList = "DEFAULT_TAG_LIST_ID",
|
|
13
|
+
WorkOrderList = "DEFAULT_WORK_ORDER_LIST_ID"
|
|
14
|
+
}
|
|
15
|
+
interface SelectionItemTag {
|
|
16
|
+
id: GlobalSelectionTypes.TagId;
|
|
17
|
+
type: GlobalSelectionItemType.Tag;
|
|
18
|
+
}
|
|
19
|
+
interface SelectionItemWorkOrder {
|
|
20
|
+
id: GlobalSelectionTypes.WorkOrderId;
|
|
21
|
+
type: GlobalSelectionItemType.WorkOrder;
|
|
22
|
+
}
|
|
23
|
+
interface SelectionItemEquipment {
|
|
24
|
+
id: GlobalSelectionTypes.EquipmentId;
|
|
25
|
+
type: GlobalSelectionItemType.Equipment;
|
|
26
|
+
}
|
|
27
|
+
interface SelectionBase {
|
|
28
|
+
label: string;
|
|
29
|
+
subLabel?: string;
|
|
30
|
+
}
|
|
31
|
+
interface SelectionCategory extends SelectionBase {
|
|
32
|
+
id: GlobalSelectionCategoryId;
|
|
33
|
+
items: SelectionItem[];
|
|
34
|
+
}
|
|
35
|
+
interface SelectionGroup extends SelectionBase {
|
|
36
|
+
id: Guid;
|
|
37
|
+
categories: SelectionCategory[];
|
|
38
|
+
}
|
|
39
|
+
export interface SelectionTreeStore {
|
|
40
|
+
groups: SelectionGroup[];
|
|
41
|
+
addTags: (args: {
|
|
42
|
+
groupId?: Guid;
|
|
43
|
+
itemIds: Readonly<GlobalSelectionTypes.TagId[]>;
|
|
44
|
+
}) => Promise<ResultArray<TagSummaryDto>[]>;
|
|
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 | undefined;
|
|
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 TagItem = SelectionItemTag;
|
|
81
|
+
type WorkOrderItem = SelectionItemWorkOrder;
|
|
82
|
+
type EquipmentItem = SelectionItemEquipment;
|
|
83
|
+
}
|
|
84
|
+
export {};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { GlobalSelectionTypes } from '../../globalSelectionStore/globalSelectionStore.types';
|
|
2
|
+
import { SelectionTreeTypes } from './selectionTree.store.types';
|
|
3
|
+
/**
|
|
4
|
+
* Check if an item ID is present in the selection tree.
|
|
5
|
+
*
|
|
6
|
+
* This function checks if a given item ID is present in the selection tree within a specific group and category.
|
|
7
|
+
* If groupId or categoryId is not provided, it checks all groups and categories.
|
|
8
|
+
*
|
|
9
|
+
* @param {Object} args - The function arguments.
|
|
10
|
+
* @param {GlobalSelectionTypes.ItemId} args.itemId - The ID of the item to check.
|
|
11
|
+
* @param {string} [args.groupId] - The ID of the group to check within (optional).
|
|
12
|
+
* @param {string} [args.categoryId] - The ID of the category to check within (optional).
|
|
13
|
+
* @param {SelectionTreeTypes.Group[]} args.groups - The selection tree groups to check within.
|
|
14
|
+
* @returns {boolean} True if the item ID is present in the selection tree, false otherwise.
|
|
15
|
+
*/
|
|
16
|
+
export declare function isItemIdInSelectionTree(args: {
|
|
17
|
+
itemId: GlobalSelectionTypes.ItemId;
|
|
18
|
+
groupId?: string;
|
|
19
|
+
categoryId?: string;
|
|
20
|
+
groups: SelectionTreeTypes.Group[];
|
|
21
|
+
}): boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Find a selection category by group ID and optionally category ID.
|
|
24
|
+
*
|
|
25
|
+
* This function finds the group and optionally the category within the selection tree groups.
|
|
26
|
+
*
|
|
27
|
+
* @param {Object} args - The function arguments.
|
|
28
|
+
* @param {string} args.groupId - The ID of the group to search within.
|
|
29
|
+
* @param {string} [args.categoryId] - The ID of the category to search for (optional).
|
|
30
|
+
* @param {SelectionTreeTypes.Group[]} args.groups - The selection tree groups to search within.
|
|
31
|
+
* @returns {Object | undefined} The group and optionally the category, or undefined if not found.
|
|
32
|
+
*/
|
|
33
|
+
export declare function findSelectionCategoryById(args: {
|
|
34
|
+
groupId: string;
|
|
35
|
+
categoryId?: string;
|
|
36
|
+
groups: SelectionTreeTypes.Group[];
|
|
37
|
+
}): {
|
|
38
|
+
group: SelectionTreeTypes.Group;
|
|
39
|
+
category?: SelectionTreeTypes.Category;
|
|
40
|
+
} | undefined;
|
|
41
|
+
/**
|
|
42
|
+
* Retrieves an array of itemIds that were not found in the selection menu.
|
|
43
|
+
*
|
|
44
|
+
* @param {Object} args - The arguments containing the list and itemIds to check.
|
|
45
|
+
* @param {SelectionTreeTypes.Group[]} args.groups - The list of SelectionMenuList objects to search through.
|
|
46
|
+
* @param {GlobalSelectionTypes.ItemId[]} args.itemIds - An array of ItemId objects to check for presence in the list.
|
|
47
|
+
* @returns {GlobalSelectionTypes.ItemId[]} An array of itemId strings that correspond to counts of 0 in the selection menu.
|
|
48
|
+
* itemIds object values are concatenated via '-' char
|
|
49
|
+
*/
|
|
50
|
+
export declare function itemsNotFoundInSelectionTree(args: {
|
|
51
|
+
groups: SelectionTreeTypes.Group[];
|
|
52
|
+
itemIds: GlobalSelectionTypes.ItemId[];
|
|
53
|
+
}): GlobalSelectionTypes.ItemId[];
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { SelectionMenuList } from '../selectionMenuStore/selectionMenu.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 {SelectionMenuList[]} - An array of selection menu lists.
|
|
6
|
-
*/
|
|
7
|
-
export declare function useSelectionMenuLists(): SelectionMenuList[];
|
package/src/lib/feature/globalSelection/selectionMenu/selectionMenuStore/selectionMenu.store.d.ts
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { SelectionMenuStore } from './selectionMenu.store.types';
|
|
2
|
-
export declare enum SelectionMenuDefaultListIds {
|
|
3
|
-
TagList = "DEFAULT_TAG_LIST_ID",
|
|
4
|
-
WorkOrderList = "DEFAULT_WORK_ORDER_LIST_ID"
|
|
5
|
-
}
|
|
6
|
-
/**
|
|
7
|
-
* Store for the selection menu, in a left panel.
|
|
8
|
-
*
|
|
9
|
-
* Stores the hierachry, tree structure of the items in Global Selection.
|
|
10
|
-
* With this, it is in charge of:
|
|
11
|
-
* - tracking which item belongs to which list
|
|
12
|
-
* - adding items to global selection
|
|
13
|
-
* - remove items from global selection
|
|
14
|
-
* - update items (visibility, removal etc.) via list ids
|
|
15
|
-
* - maintaining the global selection store based on the changes in the items, in the selection menu panel
|
|
16
|
-
*
|
|
17
|
-
* You shouldn't use this store directly in any code, unless you have very special reason to do so.
|
|
18
|
-
*
|
|
19
|
-
* For accessing and using global selection features, use the globalSelectionApi from echo-framework.
|
|
20
|
-
*/
|
|
21
|
-
export declare const useSelectionMenuStore: import("zustand").UseBoundStore<Omit<Omit<Omit<import("zustand").StoreApi<SelectionMenuStore>, "setState"> & {
|
|
22
|
-
setState<A extends string | {
|
|
23
|
-
type: string;
|
|
24
|
-
}>(partial: SelectionMenuStore | Partial<SelectionMenuStore> | ((state: SelectionMenuStore) => SelectionMenuStore | Partial<SelectionMenuStore>), replace?: boolean | undefined, action?: A | undefined): void;
|
|
25
|
-
}, "subscribe"> & {
|
|
26
|
-
subscribe: {
|
|
27
|
-
(listener: (selectedState: SelectionMenuStore, previousSelectedState: SelectionMenuStore) => void): () => void;
|
|
28
|
-
<U>(selector: (state: SelectionMenuStore) => U, listener: (selectedState: U, previousSelectedState: U) => void, options?: {
|
|
29
|
-
equalityFn?: ((a: U, b: U) => boolean) | undefined;
|
|
30
|
-
fireImmediately?: boolean;
|
|
31
|
-
} | undefined): () => void;
|
|
32
|
-
};
|
|
33
|
-
}, "setState"> & {
|
|
34
|
-
setState(nextStateOrUpdater: SelectionMenuStore | Partial<SelectionMenuStore> | ((state: import("immer").WritableDraft<SelectionMenuStore>) => void), shouldReplace?: boolean | undefined, action?: string | {
|
|
35
|
-
type: string;
|
|
36
|
-
} | undefined): void;
|
|
37
|
-
}>;
|
|
38
|
-
/**
|
|
39
|
-
* Get a snapshot of the current selection menu store state.
|
|
40
|
-
*
|
|
41
|
-
* Selection menu: left panel, which holds items from global selection.
|
|
42
|
-
*/
|
|
43
|
-
export declare function getSelectionMenuStoreSnapshot(): SelectionMenuStore;
|
|
@@ -1,52 +0,0 @@
|
|
|
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 { SelectionMenuDefaultListIds } from './selectionMenu.store';
|
|
5
|
-
export type SelectionMenuItem = SelectionMenuTag | SelectionMenuWorkOrder | SelectionMenuEquipment;
|
|
6
|
-
export interface SelectionMenuTag {
|
|
7
|
-
id: GlobalSelectionTypes.TagId;
|
|
8
|
-
type: GlobalSelectionItemType.Tag;
|
|
9
|
-
}
|
|
10
|
-
export interface SelectionMenuWorkOrder {
|
|
11
|
-
id: GlobalSelectionTypes.WorkOrderId;
|
|
12
|
-
type: GlobalSelectionItemType.WorkOrder;
|
|
13
|
-
}
|
|
14
|
-
export interface SelectionMenuEquipment {
|
|
15
|
-
id: GlobalSelectionTypes.EquipmentId;
|
|
16
|
-
type: GlobalSelectionItemType.Equipment;
|
|
17
|
-
}
|
|
18
|
-
export type SelectionMenuList = SelectionMenuWithItems | SelectionMenuWithSubLists;
|
|
19
|
-
interface SelectionMenuBase {
|
|
20
|
-
id: Guid | SelectionMenuDefaultListIds;
|
|
21
|
-
label: string;
|
|
22
|
-
}
|
|
23
|
-
interface SelectionMenuWithItems extends SelectionMenuBase {
|
|
24
|
-
items: SelectionMenuItem[];
|
|
25
|
-
subLists?: never;
|
|
26
|
-
}
|
|
27
|
-
interface SelectionMenuWithSubLists extends SelectionMenuBase {
|
|
28
|
-
subLists: SelectionMenuWithItems[];
|
|
29
|
-
items?: never;
|
|
30
|
-
}
|
|
31
|
-
export interface SelectionMenuStore {
|
|
32
|
-
lists: SelectionMenuList[];
|
|
33
|
-
addTags: (args: {
|
|
34
|
-
listId?: string;
|
|
35
|
-
itemIds: Readonly<GlobalSelectionTypes.TagId[]>;
|
|
36
|
-
}) => Promise<ResultArray<TagSummaryDto>[]>;
|
|
37
|
-
addWorkOrders: (args: {
|
|
38
|
-
listId?: string;
|
|
39
|
-
items: Readonly<Readonly<OptimizedWorkOrderDto>[]>;
|
|
40
|
-
}) => void;
|
|
41
|
-
addList: (args: SelectionMenuList) => void;
|
|
42
|
-
removeItemsByListId: (args: {
|
|
43
|
-
listId: string;
|
|
44
|
-
itemIds: GlobalSelectionTypes.ItemId[];
|
|
45
|
-
}) => void;
|
|
46
|
-
setVisibilityByListId: (args: {
|
|
47
|
-
listId: string;
|
|
48
|
-
isVisible: boolean;
|
|
49
|
-
}) => void;
|
|
50
|
-
resetState: () => void;
|
|
51
|
-
}
|
|
52
|
-
export {};
|