@equinor/echo-framework 0.20.15 → 0.20.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/index.cjs.js +1 -1
  2. package/package.json +1 -1
  3. package/src/index.d.ts +12 -5
  4. package/src/lib/components/formattedLongText/formattedLongText.d.ts +6 -0
  5. package/src/lib/components/index.d.ts +2 -1
  6. package/src/lib/components/prepview/colors/ColorMapping.d.ts +1 -1
  7. package/src/lib/components/prepview/types/shared.d.ts +35 -13
  8. package/src/lib/components/prepview/types/workorder.d.ts +15 -0
  9. package/src/lib/components/prepview/workorder/pm15/equipment/equipmentHelper.d.ts +18 -0
  10. package/src/lib/coreApplication/EchoTopBar.d.ts +0 -1
  11. package/src/lib/feature/equipment/components/equipmentItemInfo/equipmentItemInfo.d.ts +1 -0
  12. package/src/lib/feature/equipment/components/equipmentTabs/MeasuringPointsForEquipmentItem.d.ts +3 -2
  13. package/src/lib/feature/equipment/components/equipmentTabs/MeasuringPointsForEquipmentItemList.d.ts +6 -0
  14. package/src/lib/feature/equipment/components/equipmentTabs/equipmentTabs.d.ts +3 -1
  15. package/src/lib/feature/equipment/hooks/useEquipmentWithMeasuringPoints.d.ts +1 -1
  16. package/src/lib/feature/globalSelection/globalSelection.api.d.ts +199 -0
  17. package/src/lib/feature/globalSelection/globalSelectionStore/globalSelectionStore.d.ts +33 -6
  18. package/src/lib/feature/globalSelection/globalSelectionStore/globalSelectionStore.types.d.ts +16 -66
  19. package/src/lib/feature/globalSelection/globalSelectionStore/globalSelectionStore.utils.d.ts +25 -1
  20. package/src/lib/feature/globalSelection/hooks/useGlobalSelectionLists.d.ts +16 -1
  21. package/src/lib/feature/globalSelection/hooks/useGlobalSelectionTags.d.ts +1 -1
  22. package/src/lib/feature/globalSelection/index.d.ts +1 -1
  23. package/src/lib/feature/globalSelection/selectionMenu/hooks/useAllItemsHiddenByUser.d.ts +12 -0
  24. package/src/lib/feature/globalSelection/selectionMenu/hooks/useSelectionMenuLists.d.ts +7 -0
  25. package/src/lib/feature/globalSelection/selectionMenu/selectionMenuStore/selectionMenu.store.d.ts +43 -0
  26. package/src/lib/feature/globalSelection/selectionMenu/selectionMenuStore/selectionMenu.store.types.d.ts +52 -0
  27. package/src/lib/feature/globalSelection/selectionMenu/selectionMenuStore/selectionMenu.store.utils.d.ts +56 -0
  28. package/src/lib/feature/hooks/useAddTagToLegendRegistry.d.ts +1 -1
  29. package/src/lib/feature/measuringPoint/components/measuringPointDetails/mediaItemView/NavigationButton.d.ts +8 -0
  30. package/src/lib/feature/measuringPoint/components/measuringPointDetails/mediaItemView/desktopMediaView.d.ts +10 -0
  31. package/src/lib/feature/measuringPoint/components/measuringPointDetails/mediaItemView/mediaViewUtils.d.ts +3 -0
  32. package/src/lib/feature/measuringPoint/components/measuringPointDetails/mediaItemView/mobileMediaView.d.ts +10 -0
  33. package/src/lib/feature/openItemsIn3d/OpenIn3dSelectedItemsMenu.d.ts +8 -0
  34. package/src/lib/feature/openItemsIn3d/index.d.ts +1 -1
  35. package/src/lib/feature/openItemsIn3d/logic/openItemsIn3d.utils.d.ts +0 -21
  36. package/src/lib/feature/openItemsIn3d/openIn3dMenu.d.ts +1 -2
  37. package/src/lib/services/locationService/locationService.d.ts +10 -0
  38. package/src/lib/services/stores/createSimpleStore.d.ts +29 -0
  39. package/src/lib/services/userSetting/index.d.ts +1 -0
  40. package/src/lib/services/userSetting/userSettingStore.d.ts +25 -0
  41. package/src/lib/types/eventTypes/legendEvent.d.ts +1 -1
  42. package/src/lib/types/hookLibrary.d.ts +1 -0
  43. package/src/lib/types/navigation/internalApplicationLinks.d.ts +2 -1
  44. package/src/lib/utils/openIn3d/index.d.ts +1 -1
  45. package/src/lib/utils/openIn3d/tagLists.d.ts +0 -5
  46. package/src/lib/feature/openItemsIn3d/SelectedItemsMenu.d.ts +0 -10
  47. /package/src/lib/feature/{legend → legacyLegend}/index.d.ts +0 -0
  48. /package/src/lib/feature/{legend → legacyLegend}/legend.d.ts +0 -0
  49. /package/src/lib/feature/{legend → legacyLegend}/utils/createChipStatusProps.d.ts +0 -0
  50. /package/src/lib/feature/{legend → legacyLegend}/utils/legendUtils.d.ts +0 -0
  51. /package/src/lib/feature/{legend → legacyLegend}/utils/statusHelper.d.ts +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@equinor/echo-framework",
3
- "version": "0.20.15",
3
+ "version": "0.20.17",
4
4
  "peerDependencies": {
5
5
  "@equinor/echo-base": ">= 0.7.0 < 0.8.0",
6
6
  "@equinor/echo-components": ">= 0.11.0 < 0.12.0",
package/src/index.d.ts CHANGED
@@ -1,25 +1,29 @@
1
- import { getLegendStatusColor } from './lib/feature/legend/utils/legendUtils';
1
+ import { getLegendStatusColor } from './lib/feature/legacyLegend/utils/legendUtils';
2
2
  import './lib/globalStyles.css';
3
3
  import { getPlantsInfo, getTagDetails } from './lib/services/api';
4
4
  export * from './lib/components';
5
5
  export { PrepviewButton } from './lib/components/prepviewButton/prepviewButton';
6
+ export { useFetchPlantInfo } from './lib/components/requestAccess/hooks/fetchPlantInfo';
6
7
  export { RequestProCoSysAccess } from './lib/components/requestAccess/RequestProCoSysAccess';
7
8
  export { RequestSapAccess } from './lib/components/requestAccess/RequestSapAccess';
8
- export { useFetchPlantInfo } from './lib/components/requestAccess/hooks/fetchPlantInfo';
9
9
  export { WorkOrderListItem } from './lib/components/workOrderListItem';
10
10
  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 type { GlobalSelectionItem, OptimizedWorkOrderDto } from './lib/feature/globalSelection/globalSelectionStore/globalSelectionStore.types';
14
+ export type { OptimizedWorkOrderDto } from './lib/feature/globalSelection/globalSelectionStore/globalSelectionStore.types';
15
15
  export { PanTo3DButton } from './lib/feature/globalSelection/panToEcho3d/panTo3DButton';
16
- export * from './lib/feature/legend/index';
16
+ export { useAllItemsHiddenByUser } from './lib/feature/globalSelection/selectionMenu/hooks/useAllItemsHiddenByUser';
17
+ export { useSelectionMenuLists } from './lib/feature/globalSelection/selectionMenu/hooks/useSelectionMenuLists';
18
+ export { SelectionMenuDefaultListIds } from './lib/feature/globalSelection/selectionMenu/selectionMenuStore/selectionMenu.store';
19
+ export type { SelectionMenuList } from './lib/feature/globalSelection/selectionMenu/selectionMenuStore/selectionMenu.store.types';
20
+ export * from './lib/feature/legacyLegend/index';
17
21
  export { getLatestMeasurementDate, sortMeasuringPointsByMeasurementDate } from './lib/feature/measuringPoint/components/measuringPoints.utils';
18
22
  export * from './lib/feature/measuringPoint/index';
19
23
  export * from './lib/feature/measuringPoint/types/measuringPoint';
20
24
  export * from './lib/feature/openItemsIn3d';
21
- export { SelectedItemsMenu } from './lib/feature/openItemsIn3d/SelectedItemsMenu';
22
25
  export { createEcho3dInternalLink } from './lib/feature/openItemsIn3d/logic/createEcho3dInternalLink';
26
+ export { OpenIn3dSelectedItemsMenu } from './lib/feature/openItemsIn3d/OpenIn3dSelectedItemsMenu';
23
27
  export { WorkOrderContent } from './lib/feature/workOrder/WorkOrderContent';
24
28
  export { RegisteredHookName } from './lib/hooks/hookLibrary';
25
29
  export { useIsCompactLayout } from './lib/hooks/useIsCompactLayout';
@@ -31,6 +35,9 @@ export { RegisteredComponentName } from './lib/services/componentRegistry/compon
31
35
  export * from './lib/services/dataLayerPanel';
32
36
  export * from './lib/services/eventHubActions';
33
37
  export * from './lib/services/leftPanelNavigation';
38
+ export * from './lib/services/locationService/locationService';
39
+ export { createSimpleStore } from './lib/services/stores/createSimpleStore';
40
+ export * from './lib/services/userSetting';
34
41
  export * from './lib/types/api-echohub';
35
42
  export type { EchoHubPlant } from './lib/types/echoHubPlant';
36
43
  export * from './lib/types/eventTypes';
@@ -0,0 +1,6 @@
1
+ import { FC } from 'react';
2
+ interface FormattedLongTextProps {
3
+ readonly longText: string;
4
+ }
5
+ export declare const FormattedLongText: FC<FormattedLongTextProps>;
6
+ export {};
@@ -6,7 +6,9 @@ export * from './echoLogo';
6
6
  export * from './errorBoundary';
7
7
  export * from './externalLinkButton/externalLinkButton';
8
8
  export * from './footer';
9
+ export { FormattedLongText } from './formattedLongText/formattedLongText';
9
10
  export * from './fullScreenButtons';
11
+ export * from './infoLabel';
10
12
  export * from './labelledValueGrid';
11
13
  export * from './lazyLoading';
12
14
  export * from './listItemAdditionalInfoRow/listItemAdditionalInfoRow';
@@ -24,6 +26,5 @@ export * from './spinner/spinner';
24
26
  export * from './tagNumber';
25
27
  export * from './tagSearchDropDown';
26
28
  export * from './toaster';
27
- export * from './infoLabel';
28
29
  export * from './verticalTabsSplitView';
29
30
  export { WorkOrderListItem } from './workOrderListItem';
@@ -30,7 +30,7 @@ export declare function convertToFailureImpactId(failureImpact: string): "X" | "
30
30
  /**
31
31
  * Used to set colorMap on Work order visuals such as ListItems
32
32
  */
33
- export declare function getWorkOrderColorMap(currentBadgeOption: WoBadgeType | undefined, isActive: boolean, requiredEndDateStatus?: string, basicFinishDateStatus?: string): ColorMap | undefined;
33
+ export declare function getWorkOrderColorMap(currentBadgeOption: WoBadgeType | undefined, isActive: boolean, requiredEndDateStatus?: string, basicFinishDateStatus?: string, userStatus?: string): ColorMap | undefined;
34
34
  /**
35
35
  * Used to set colorMap on Equipment visuals such as ListItems
36
36
  */
@@ -99,25 +99,47 @@ export type HistoricWorkOrderItem = {
99
99
  isActive: boolean;
100
100
  requiredEndDateTime?: Date;
101
101
  requiredEndDateStatus?: string;
102
- maintenancePlanDate: Date;
103
- planningPlant: string;
104
- description: string;
105
- workCenterId: string;
106
- type: string;
107
- activeStatusIds: string;
108
- title: string;
109
- operationId?: string;
110
- mainWorkCenterId: string;
111
- createdDateTime: Date;
112
- changedDateTime: Date;
102
+ requiredEndDateStatusDescription?: string;
103
+ maintenancePlanDate?: Date;
104
+ planningPlant?: string;
105
+ planningPlantId?: string;
106
+ basicFinishDateTime?: Date;
107
+ basicFinishDateStatus?: string;
108
+ basicFinishDateStatusDescription?: string;
113
109
  earlyStartDate?: Date;
114
110
  earlyFinishDate?: Date;
115
- basicFinishDateStatus?: string;
116
- basicFinishDateTime?: Date;
111
+ createdDateTime: Date;
112
+ changedDateTime: Date;
113
+ description?: string;
114
+ title?: string;
115
+ workCenter?: string;
116
+ workCenterId?: string;
117
+ operationId?: string;
117
118
  sortField?: string;
118
119
  hasPrts?: boolean;
119
120
  recordTypeIds?: string[];
120
121
  hasB30Document?: boolean;
122
+ activeStatusIds?: string;
123
+ userStatus?: string;
124
+ tag?: {
125
+ functionalLocationId?: string;
126
+ tagId?: string;
127
+ plantId?: string;
128
+ categoryId?: string;
129
+ category?: string;
130
+ instCode?: string;
131
+ };
132
+ plannerGroupId?: string;
133
+ plantId?: string;
134
+ instCode?: string;
135
+ functionalLocationId?: string;
136
+ tagPlantId?: string;
137
+ tagId?: string;
138
+ tagCategory?: string;
139
+ tagCategoryId?: string;
140
+ mapLocationId?: string;
141
+ maintenancePlantId?: string;
142
+ maintenancePlant?: string;
121
143
  };
122
144
  export type PunchGroup = {
123
145
  type: string;
@@ -8,6 +8,7 @@ export type WorkOrderDetails = FetchStatus & {
8
8
  tagCategoryId: string;
9
9
  orderType: string;
10
10
  activeStatusIds: string;
11
+ userStatus: string;
11
12
  isActive: true;
12
13
  personResponsible: string;
13
14
  plannerGroupId: string;
@@ -84,9 +85,23 @@ export type WorkOrderEquipment = {
84
85
  maintenancePlantId: string;
85
86
  maintenancePlant: string;
86
87
  subseaPoolEquipmentGroup: string;
88
+ subseaPoolEquipmentGroupid: string;
87
89
  equipmentOnboard: boolean;
88
90
  mapLocation: MapLocationDto;
91
+ notificationStatus?: EquipmentStatus;
92
+ equipmentStatus?: EquipmentStatus;
93
+ certificateStatus?: EquipmentStatus;
89
94
  };
95
+ export type EquipmentStatus = {
96
+ severity: EquipmentStatusSeverity;
97
+ label: string;
98
+ };
99
+ export declare enum EquipmentStatusSeverity {
100
+ Ok = "Ok",
101
+ Warning = "Warning",
102
+ Error = "Error",
103
+ Unknown = "Unknown"
104
+ }
90
105
  export type MapLocationDto = {
91
106
  id?: string;
92
107
  position: Coordinates;
@@ -0,0 +1,18 @@
1
+ import { ColorMap } from "@equinor/echo-components";
2
+ import { EquipmentStatus } from "../../../types";
3
+ /**
4
+ * EquipmentTitleRow determines if the primary row of the Equipment ListItem shall have icons or not
5
+ */
6
+ interface EquipmentTitleRowProps {
7
+ equipmentId: string;
8
+ compact?: boolean;
9
+ notificationStatus?: EquipmentStatus;
10
+ equipmentStatus?: EquipmentStatus;
11
+ certificateStatus?: EquipmentStatus;
12
+ }
13
+ export declare function EquipmentTitleRow({ equipmentId, compact, notificationStatus, equipmentStatus, certificateStatus, }: EquipmentTitleRowProps): import("react/jsx-runtime").JSX.Element;
14
+ /**
15
+ * Used to display the visual for equipment items
16
+ */
17
+ export declare function displayEquipmentVisual(colorMap?: ColorMap, compact?: boolean): import("react/jsx-runtime").JSX.Element;
18
+ export {};
@@ -1,4 +1,3 @@
1
1
  import React from 'react';
2
- export declare const EchoTopBar: React.FC;
3
2
  declare const _default: React.NamedExoticComponent<{}>;
4
3
  export default _default;
@@ -3,6 +3,7 @@ import { Equipment } from '../../types/equipment';
3
3
  interface EquipmentItemInfoProps {
4
4
  equipment: Equipment;
5
5
  tagNo: string;
6
+ plantNo: string;
6
7
  }
7
8
  export declare const EquipmentItemInfo: React.FC<EquipmentItemInfoProps>;
8
9
  export {};
@@ -1,8 +1,9 @@
1
- export interface MeasuringPointsPanelProps {
1
+ interface MeasuringPointsPanelProps {
2
2
  equipmentId: string;
3
- onLoadUpdate?: (args: {
3
+ onLoadUpdate: (status: {
4
4
  isLoading: boolean;
5
5
  numberOfItemsLoaded?: number;
6
6
  }) => void;
7
7
  }
8
8
  export declare const MeasuringPointsForEquipmentItem: React.FC<MeasuringPointsPanelProps>;
9
+ export {};
@@ -0,0 +1,6 @@
1
+ import { MeasuringPointDto } from '../../../measuringPoint';
2
+ interface MeasuringPointListProps {
3
+ items: MeasuringPointDto[];
4
+ }
5
+ export declare const MeasuringPointsForEquipmentItemList: React.FC<MeasuringPointListProps>;
6
+ export {};
@@ -1,6 +1,8 @@
1
1
  import { Equipment } from '../../types/equipment';
2
- export interface EquipmentTabsProps {
2
+ interface EquipmentTabsProps {
3
3
  equipment: Equipment;
4
4
  tagNo: string;
5
+ plantNo: string;
5
6
  }
6
7
  export declare const EquipmentTabs: React.FC<EquipmentTabsProps>;
8
+ export {};
@@ -3,7 +3,7 @@ export declare function useEquipmentWithoutMeasuringPoints(equipmentId: string):
3
3
  status: 'error' | 'success' | 'pending';
4
4
  equipmentWithMeasuringPoints: EquipmentWithMeasuringPoints[];
5
5
  };
6
- export declare function useEquipmentWithMeasuringPoints(equipmentId: string): {
6
+ export declare function useEquipmentWithMeasuringPoints(equipmentId: string, isEnabledMeasuringPoints: boolean): {
7
7
  status: 'error' | 'success' | 'pending';
8
8
  equipmentWithMeasuringPoints: EquipmentWithMeasuringPoints[];
9
9
  };
@@ -0,0 +1,199 @@
1
+ import { ResultValue, TagSummaryDto } from '@equinor/echo-search';
2
+ 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
+ */
29
+ export declare const globalSelectionApi: Readonly<{
30
+ /**
31
+ * Removes items from a specified list in the selection menu panel by their IDs.
32
+ *
33
+ * @param {Object} args - The arguments for removing items.
34
+ * @param {string} args.listId - The ID of the list from which the items should be removed.
35
+ * @param {Readonly<GlobalSelectionTypes.ItemId[]>} args.itemIds - An array of item IDs representing the items to be removed.
36
+ *
37
+ * @example
38
+ * removeItemsByListId({ listId: '789', itemIds: ['item1', 'item2'] });
39
+ */
40
+ removeItemsByListId: (args: {
41
+ listId: string;
42
+ itemIds: GlobalSelectionTypes.ItemId[];
43
+ }) => void;
44
+ add: Readonly<{
45
+ /**
46
+ * Adds tags to a specified list in the selection menu panel.
47
+ *
48
+ * @param {Object} args - The arguments for adding tags.
49
+ * @param {string} args.listId - Optional - The ID of the list to which the tags should be added. If not provided, the default tag list ID is used.
50
+ * @param {Readonly<Readonly<TagSummaryDto>[]>} args.items - An array of TagSummaryDto objects representing the tags to be added.
51
+ *
52
+ * @example
53
+ * addTags({ listId: '123', items: [{ id: 'tag1', name: 'Tag 1' }, { id: 'tag2', name: 'Tag 2' }] });
54
+ */
55
+ tags: (args: {
56
+ listId?: string;
57
+ itemIds: Readonly<GlobalSelectionTypes.TagId[]>;
58
+ }) => Promise<import("@equinor/echo-search").ResultArray<TagSummaryDto>[]>;
59
+ /**
60
+ * Adds work orders to a specified list in the selection menu panel.
61
+ *
62
+ * @param {Object} args - The arguments for adding work orders.
63
+ * @param {string} args.listId - Optional. The ID of the list to which the work orders should be added. If not provided, the default work order list ID is used.
64
+ * @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
+ */
69
+ workOrders: (args: {
70
+ listId?: string;
71
+ items: Readonly<Readonly<import("./globalSelectionStore/globalSelectionStore.types").OptimizedWorkOrderDto>[]>;
72
+ }) => void;
73
+ }>;
74
+ search: Readonly<{
75
+ /**
76
+ * Checks if a given item ID is present in a specified list.
77
+ *
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
+ */
83
+ isItemIdInList: (args: {
84
+ itemId: GlobalSelectionTypes.ItemId;
85
+ listId: string;
86
+ }) => boolean;
87
+ /**
88
+ * Checks if a given item ID is present in the selection lists.
89
+ *
90
+ * @param args - An object containing the item ID to check.
91
+ * @param {GlobalSelectionTypes.ItemId} args.itemId - The item ID to check for presence in the selection lists.
92
+ * @returns {boolean} A boolean indicating whether the item ID is present in the selection lists.
93
+ */
94
+ isItemIdInTheSelection: (args: {
95
+ itemId: GlobalSelectionTypes.ItemId;
96
+ }) => boolean;
97
+ /**
98
+ * Finds a selection list by its ID from a given list of selection menu lists.
99
+ * If the list is not found at the top level, it searches within the sublists of each top-level list.
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
+ }>;
107
+ visibility: Readonly<{
108
+ setByItemIds: (args: {
109
+ itemIds: Readonly<Readonly<GlobalSelectionTypes.ItemId>>[];
110
+ isVisible: boolean;
111
+ }) => void;
112
+ /**
113
+ * Sets the visibility of items in a specified list in the selection menu store.
114
+ *
115
+ * @param {Object} args - The arguments for setting visibility.
116
+ * @param {string} args.listId - The ID of the list for which the visibility should be set.
117
+ * @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
+ */
122
+ setByListId: (args: {
123
+ listId: string;
124
+ isVisible: boolean;
125
+ }) => void;
126
+ }>;
127
+ errorStatus: Readonly<{
128
+ /**
129
+ * Sets the error status for specific items in the selection menu panel.
130
+ *
131
+ * @param {Object} args - The arguments for setting error statuses.
132
+ * @param {Readonly<GlobalSelectionTypes.ItemErrorStatusUpdate[]>} args.itemErrorStatuses - An array of objects representing the item IDs and their corresponding error statuses to be updated.
133
+ *
134
+ * @example
135
+ * setByItemIds({ itemErrorStatuses: [
136
+ * { itemId: { workOrderId: 'wo1' }, errorStatus: 'error' },
137
+ * { itemId: { tagNo: 'tag1', instCode: 'JAB' }, errorStatus: 'warning' }
138
+ * ] });
139
+ */
140
+ setByItemIds: (args: {
141
+ itemErrorStatuses: GlobalSelectionTypes.ItemErrorStatusUpdate[];
142
+ }) => void;
143
+ /**
144
+ * Removes the error status for specific items in the selection menu panel.
145
+ *
146
+ * @param {Object} args - The arguments for removing error statuses.
147
+ * @param {Readonly<GlobalSelectionTypes.ItemId[]>} args.itemIds - An array of item IDs representing the items for which the error statuses should be removed.
148
+ *
149
+ * @example
150
+ * removeByItemIds({
151
+ * itemIds: [
152
+ * { workOrderId: 'wo1' },
153
+ * { workOrderId: 'wo2' }
154
+ * ]
155
+ * });
156
+ */
157
+ removeByItemIds: (args: {
158
+ itemIds: Readonly<GlobalSelectionTypes.ItemId[]>;
159
+ }) => void;
160
+ /**
161
+ * Resets the error statuses for all items in the selection menu panel.
162
+ */
163
+ reset: () => void;
164
+ }>;
165
+ /**
166
+ * Removes all items from the selection menu panel.
167
+ */
168
+ clearSelection: () => void;
169
+ }>;
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 {};
@@ -1,4 +1,26 @@
1
- import { GlobalSelectionTypes } from './globalSelectionStore.types';
1
+ import { WritableDraft } from 'immer';
2
+ import { GlobalSelectionItemType, GlobalSelectionTypes } from './globalSelectionStore.types';
3
+ export declare const initialWorkOrderList: WritableDraft<GlobalSelectionTypes.WorkOrderList>;
4
+ export declare const initialTagList: WritableDraft<GlobalSelectionTypes.TagList>;
5
+ export declare const initialEquipmentList: WritableDraft<GlobalSelectionTypes.EquipmentList>;
6
+ /**
7
+ * The single source of truth for items stored in Global Selection.
8
+ * Each item is stored here once, does not store item grouping in any way.
9
+ * If you're interested in the item hierarchy, tree structure, use `useSelectionMenuStore` zustand store.
10
+ *
11
+ * With this said, this store is charge of:
12
+ * - storing items by type
13
+ * - controlling meta data used in the ui for each item, like:
14
+ * - visibility
15
+ * - color
16
+ * - error statuses
17
+ * - etc.
18
+ *
19
+ * You shouldn't use this store directly in any code.
20
+ * If you want to add, and remove items, use `useSelectionMenuStore` zustand store.
21
+ *
22
+ * For accessing and using global selection features, use the globalSelectionApi from echo-framework.
23
+ */
2
24
  export declare const useGlobalSelectionStore: import("zustand").UseBoundStore<Omit<Omit<Omit<import("zustand").StoreApi<import("./globalSelectionStore.types").GlobalSelectionStore>, "setState"> & {
3
25
  setState<A extends string | {
4
26
  type: string;
@@ -12,17 +34,22 @@ export declare const useGlobalSelectionStore: import("zustand").UseBoundStore<Om
12
34
  } | undefined): () => void;
13
35
  };
14
36
  }, "setState"> & {
15
- setState(nextStateOrUpdater: import("./globalSelectionStore.types").GlobalSelectionStore | Partial<import("./globalSelectionStore.types").GlobalSelectionStore> | ((state: import("immer").WritableDraft<import("./globalSelectionStore.types").GlobalSelectionStore>) => void), shouldReplace?: boolean | undefined, action?: string | {
37
+ setState(nextStateOrUpdater: import("./globalSelectionStore.types").GlobalSelectionStore | Partial<import("./globalSelectionStore.types").GlobalSelectionStore> | ((state: WritableDraft<import("./globalSelectionStore.types").GlobalSelectionStore>) => void), shouldReplace?: boolean | undefined, action?: string | {
16
38
  type: string;
17
39
  } | undefined): void;
18
40
  }>;
19
41
  /**
20
- * Determine if a given list has any items being loaded.
21
- * @param {string} listKey Global selection item list identifier
22
- * @returns {boolean}
42
+ * Determine if a given selection type has any items being loaded.
43
+ * @param {GlobalSelectionItemType} selectionType - A specific type from GlobalSelectionItemType for the list to check.
44
+ * @returns {boolean} - Returns true if there are any items being loaded in the specified selection type.
23
45
  */
24
- export declare function useIsGlobalSelectionListLoading(listKey: string): boolean;
46
+ export declare function useIsGlobalSelectionListLoading<K extends GlobalSelectionItemType>(selectionType: K): boolean;
25
47
  /**
26
48
  * Get a snapshot of the current global selection store state.
49
+ *
50
+ * You shouldn't use this store directly in any code.
51
+ * If you want to add, and remove items, use `useSelectionMenuStore` zustand store.
52
+ *
53
+ * For accessing and using global selection features, use the globalSelectionApi from echo-framework.
27
54
  */
28
55
  export declare function getGlobalSelectionStoreState(): GlobalSelectionTypes.Store;
@@ -1,28 +1,24 @@
1
- import { ResultValue, TagSummaryDto } from '@equinor/echo-search';
1
+ import { ResultArray, TagSummaryDto } from '@equinor/echo-search';
2
2
  import { Equipment } from '../../equipment';
3
3
  export declare enum GlobalSelectionItemType {
4
4
  WorkOrder = "WorkOrder",
5
5
  Tag = "Tag",
6
6
  Equipment = "Equipment"
7
7
  }
8
- /**
9
- * @deprecated We plan to make this private in the future: Use the public GlobalSelectionTypes namespace to access this type.
10
- */
11
- export interface GlobalSelectionItemTypeToDataMap {
8
+ interface GlobalSelectionItemTypeToDataMap {
12
9
  WorkOrder: OptimizedWorkOrderDto;
13
10
  Tag: TagSummaryDto;
14
11
  Equipment: Equipment;
15
12
  }
16
- /**
17
- * @deprecated We plan to make this private in the future: Use the public GlobalSelectionTypes namespace to access this type.
18
- */
19
- export type GlobalSelectionList<T extends GlobalSelectionItemType> = {
13
+ type GlobalSelectionList<T extends GlobalSelectionItemType> = {
20
14
  label: string;
21
- key: string;
22
15
  type: T;
23
16
  items: GlobalSelectionTypes.GenericItem<T>[];
24
17
  itemsBeingLoaded: GlobalSelectionTypes.ItemId[];
25
18
  };
19
+ export type GlobalSelectionObject = {
20
+ [K in GlobalSelectionItemType]: GlobalSelectionList<K>;
21
+ };
26
22
  /**
27
23
  * @deprecated We plan to make this private in the future: Use the public GlobalSelectionTypes namespace to access this type.
28
24
  */
@@ -36,70 +32,29 @@ export type GlobalSelectionGenericItem<T extends GlobalSelectionItemType> = {
36
32
  errorStatus?: string;
37
33
  };
38
34
  };
39
- export type EquipmentGlobalSelectionListItem = GlobalSelectionTypes.GenericItem<GlobalSelectionItemType.Equipment>;
40
- /**
41
- * @deprecated We plan to make this private in the future: Use the public GlobalSelectionTypes namespace to access this type.
42
- */
43
- export type WorkOrderGlobalSelectionListItem = GlobalSelectionTypes.GenericItem<GlobalSelectionItemType.WorkOrder>;
44
- /**
45
- * @deprecated We plan to make this private in the future: Use the public GlobalSelectionTypes namespace to access this type.
46
- */
47
- export type TagGlobalSelectionListItem = GlobalSelectionTypes.GenericItem<GlobalSelectionItemType.Tag>;
48
- /**
49
- * @deprecated We plan to make this private in the future: Use the public namespace, GlobalSelectionTypes.SelectionItem type instead.
50
- */
51
- export type GlobalSelectionItem = WorkOrderGlobalSelectionListItem | TagGlobalSelectionListItem | EquipmentGlobalSelectionListItem;
52
- /**
53
- * @deprecated We plan to make this private in the future: Use the public GlobalSelectionTypes namespace to access this type.
54
- */
55
35
  type EquipmentGlobalSelectionList = GlobalSelectionTypes.List<GlobalSelectionItemType.Equipment>;
56
- /**
57
- * @deprecated We plan to make this private in the future: Use the public GlobalSelectionTypes namespace to access this type.
58
- */
59
- export type WorkOrderGlobalSelectionList = GlobalSelectionTypes.List<GlobalSelectionItemType.WorkOrder>;
60
- /**
61
- * @deprecated We plan to make this private in the future: Use the public GlobalSelectionTypes namespace to access this type.
62
- */
63
- export type TagGlobalSelectionList = GlobalSelectionTypes.List<GlobalSelectionItemType.Tag>;
64
- /**
65
- * @deprecated We plan to make this private in the future: Use the public GlobalSelectionTypes namespace to access this type.
66
- */
67
- export type GlobalSelectionListUnion = WorkOrderGlobalSelectionList | TagGlobalSelectionList | EquipmentGlobalSelectionList;
68
- /**
69
- * @deprecated We plan to make this private in the future: Use the public GlobalSelectionTypes namespace to access this type.
70
- */
71
- export interface ItemErrorStatusUpdates {
36
+ type WorkOrderGlobalSelectionList = GlobalSelectionTypes.List<GlobalSelectionItemType.WorkOrder>;
37
+ type TagGlobalSelectionList = GlobalSelectionTypes.List<GlobalSelectionItemType.Tag>;
38
+ type GlobalSelectionListUnion = WorkOrderGlobalSelectionList | TagGlobalSelectionList | EquipmentGlobalSelectionList;
39
+ interface ItemErrorStatusUpdates {
72
40
  itemId: GlobalSelectionTypes.ItemId;
73
41
  errorStatus: string;
74
42
  }
75
- /**
76
- * @deprecated We plan to make this private in the future: Use the public GlobalSelectionTypes namespace to access this type.
77
- */
78
43
  export interface GlobalSelectionStore {
79
- lists: GlobalSelectionTypes.ListUnion[];
44
+ lists: GlobalSelectionObject;
80
45
  addWorkOrdersToSelection: (args: {
81
46
  workOrders: Readonly<OptimizedWorkOrderDto[]>;
82
47
  }) => void;
83
- addTagToSelection: (args: GlobalSelectionTypes.TagId) => Promise<ResultValue<TagSummaryDto>>;
84
48
  addTagsToSelection: (args: {
85
- tags: Readonly<TagSummaryDto[]>;
86
- }) => void;
87
- removeItemFromSelection: (itemId: Readonly<GlobalSelectionTypes.ItemId>) => void;
49
+ tagIds: Readonly<GlobalSelectionTypes.TagId[]>;
50
+ }) => Promise<ResultArray<TagSummaryDto>[]>;
88
51
  removeItemsFromSelection: (args: {
89
52
  itemIds: ReadonlyArray<GlobalSelectionTypes.ItemId>;
90
53
  }) => void;
91
- setVisibilityList: (args: {
92
- listKey: string;
54
+ setVisibilityByItemIds: (args: {
55
+ itemIds: Readonly<Readonly<GlobalSelectionTypes.ItemId>>[];
93
56
  isVisible: boolean;
94
57
  }) => void;
95
- setVisibility: (args: {
96
- itemId: Readonly<GlobalSelectionTypes.ItemId>;
97
- isVisible: boolean;
98
- }) => void;
99
- /**
100
- *@deprecated This method is deprecated. Use `removeErrorStatusForItems` instead.
101
- */
102
- resetItemNotFoundStates: () => void;
103
58
  resetItemErrorStatuses: () => void;
104
59
  resetState: () => void;
105
60
  setErrorStatusForItems: (args: {
@@ -108,12 +63,6 @@ export interface GlobalSelectionStore {
108
63
  removeErrorStatusForItems: (args: {
109
64
  itemIds: Readonly<GlobalSelectionTypes.ItemId[]>;
110
65
  }) => void;
111
- /**
112
- *@deprecated This method is deprecated. Use `setStatusForItems` instead.
113
- */
114
- setNotFoundItems: (args: {
115
- itemIds: Readonly<GlobalSelectionTypes.ItemId[]>;
116
- }) => void;
117
66
  }
118
67
  export declare namespace GlobalSelectionTypes {
119
68
  type WorkOrderId = Pick<OptimizedWorkOrderDto, 'workOrderId'>;
@@ -125,6 +74,7 @@ export declare namespace GlobalSelectionTypes {
125
74
  type TagItem = GlobalSelectionGenericItem<GlobalSelectionItemType.Tag>;
126
75
  type List<T extends GlobalSelectionItemType> = GlobalSelectionList<T>;
127
76
  type SelectionItem = EquipmentItem | WorkOrderItem | TagItem;
77
+ type SelectionItemList = EquipmentItem[] | WorkOrderItem[] | TagItem[];
128
78
  type GenericItem<T extends GlobalSelectionItemType> = GlobalSelectionGenericItem<T>;
129
79
  type Store = GlobalSelectionStore;
130
80
  type ItemErrorStatusUpdate = ItemErrorStatusUpdates;