@equinor/echo-framework 0.19.1-beta-0 → 0.19.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@equinor/echo-framework",
3
- "version": "0.19.1-beta-0",
3
+ "version": "0.19.1",
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",
@@ -22,4 +22,4 @@
22
22
  },
23
23
  "main": "./index.cjs.js",
24
24
  "type": "commonjs"
25
- }
25
+ }
package/src/index.d.ts CHANGED
@@ -4,11 +4,18 @@ import { getLegendStatusColor } from './lib/feature/legend/utils/legendUtils';
4
4
  import './lib/globalStyles.css';
5
5
  import { getPlantsInfo, getTagDetails } from './lib/services/api';
6
6
  export * from './lib/components';
7
+ export { OpenIn3dDialogs } from './lib/components/openIn3d/OpenIn3dDialogs';
8
+ export { OpenIn3dWarningDialog } from './lib/components/openIn3d/OpenIn3dWarningDialog';
9
+ export { PlantNoSelectionDialog } from './lib/components/openIn3d/PlantNoSelectionDialog';
10
+ export { SelectedItemsMenu } from './lib/components/openIn3d/SelectedItemsMenu';
7
11
  export { PrepviewButton } from './lib/components/prepviewButton/prepviewButton';
8
12
  export { RequestProCoSysAccess } from './lib/components/requestAccess/RequestProCoSysAccess';
9
13
  export { RequestSapAccess } from './lib/components/requestAccess/RequestSapAccess';
14
+ export { WorkOrderListItem } from './lib/components/workOrderListItem';
10
15
  export * from './lib/coreApplication';
11
16
  export * from './lib/feature/equipment/index';
17
+ export * from './lib/feature/globalSelection';
18
+ export type { GlobalSelectionItem, OptimizedWorkOrderDto } from './lib/feature/globalSelection/globalSelectionStore/globalSelectionStore.types';
12
19
  export * from './lib/feature/legend/index';
13
20
  export { getLatestMeasurementDate, sortMeasuringPointsByMeasurementDate } from './lib/feature/measuringPoint/components/measuringPoints.utils';
14
21
  export * from './lib/feature/measuringPoint/index';
@@ -18,7 +25,6 @@ export { useIsCompactLayout } from './lib/hooks/useIsCompactLayout';
18
25
  export { useIsFullScreenModeEnabled } from './lib/hooks/useIsFullScreenModeEnabled';
19
26
  export { useScreenOrientation } from './lib/hooks/useScreenOrientation';
20
27
  export { useScreenValues } from './lib/hooks/useScreenValues';
21
- export * from './lib/services/activeSelectionStore';
22
28
  export { getPlantsCachedOrApi, getPlantsFromApi } from './lib/services/api/api-plants';
23
29
  export { RegisteredComponentName } from './lib/services/componentRegistry/componentRegistry';
24
30
  export * from './lib/services/eventHubActions';
@@ -12,9 +12,6 @@ export * from './labelledValueGrid';
12
12
  export * from './lazyLoading';
13
13
  export * from './listItemAdditionalInfoRow/listItemAdditionalInfoRow';
14
14
  export * from './mediator';
15
- export { OpenIn3dWarningDialog } from './openIn3d/OpenIn3dWarningDialog';
16
- export { PlantNoSelectionDialog } from './openIn3d/PlantNoSelectionDialog';
17
- export { SelectedItemsMenu } from './openIn3d/SelectedItemsMenu';
18
15
  export * from './pageMenu';
19
16
  export * from './panel';
20
17
  export * from './panelButton';
@@ -28,3 +25,4 @@ export * from './searchMenu';
28
25
  export * from './spinner/spinner';
29
26
  export * from './tagNumber';
30
27
  export * from './toaster';
28
+ export { WorkOrderListItem } from './workOrderListItem';
@@ -0,0 +1,14 @@
1
+ import React, { Dispatch, SetStateAction } from 'react';
2
+ interface OpenIn3dDialogsProps {
3
+ isOpenIn3dWarningDialogOpen: boolean;
4
+ isSelectPlantNoDialogOpen: boolean;
5
+ setIsOpenIn3dWarningDialogOpen: Dispatch<React.SetStateAction<boolean>>;
6
+ setIsSelectPlantNoDialogOpen: Dispatch<React.SetStateAction<boolean>>;
7
+ onOKButtonClicked: () => void;
8
+ uniquePlantNos: string[];
9
+ tagNoCounts: Record<string, number>;
10
+ selectedPlantNo: string | undefined;
11
+ setSelectedPlantNo: Dispatch<SetStateAction<string | undefined>>;
12
+ }
13
+ export declare const OpenIn3dDialogs: React.FC<OpenIn3dDialogsProps>;
14
+ export {};
@@ -1,8 +1,10 @@
1
1
  import React from 'react';
2
2
  import { ObjectsToSendTo3dTypes } from '../../utils';
3
3
  interface SelectedItemsProps {
4
- numberOfSelectedRows: number;
4
+ numberOfSelectedItems: number;
5
5
  onOpenIn3dButtonClick: (ObjectsToSendTo3d: ObjectsToSendTo3dTypes) => void;
6
+ children?: React.ReactNode;
6
7
  }
7
8
  export declare const SelectedItemsMenu: React.FC<SelectedItemsProps>;
9
+ export declare function getIsGlobalSelectionEnabled(): boolean;
8
10
  export {};
@@ -1,4 +1,4 @@
1
+ export { OpenIn3dDialogs } from './OpenIn3dDialogs';
1
2
  export { OpenIn3dWarningDialog } from './OpenIn3dWarningDialog';
2
3
  export { PlantNoSelectionDialog } from './PlantNoSelectionDialog';
3
4
  export { SelectedItemsMenu } from './SelectedItemsMenu';
4
- export { OpenIn3dMenu } from './openIn3dMenu';
@@ -2,6 +2,7 @@ import React from 'react';
2
2
  import { ObjectsToSendTo3dTypes } from '../../utils/openIn3d/tagLists';
3
3
  interface OpenIn3dMenuProps {
4
4
  onOpenIn3dButtonClick: (objectsToSendTo3d: ObjectsToSendTo3dTypes) => void;
5
+ disabled?: boolean;
5
6
  }
6
7
  export declare const OpenIn3dMenu: React.FC<OpenIn3dMenuProps>;
7
8
  export {};
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ import { ColorMap, WorkOrderDateType, WorkOrderItem } from '@equinor/echo-components';
3
+ export interface WorkOrderListItemProps {
4
+ workOrder: WorkOrderItem;
5
+ onCardClick?: () => void;
6
+ itemAction?: React.ReactNode;
7
+ isHeader?: boolean;
8
+ colorMap?: ColorMap;
9
+ iconName?: string;
10
+ workOrderDateType?: WorkOrderDateType;
11
+ className?: string;
12
+ }
13
+ declare function WorkOrderListItem(props: WorkOrderListItemProps): import("react/jsx-runtime").JSX.Element;
14
+ export { WorkOrderListItem };
@@ -0,0 +1 @@
1
+ export * from './WorkOrderListItem';
@@ -0,0 +1,176 @@
1
+ import { GlobalSelectionItemErrorStatuses, GlobalSelectionItemType, GlobalSelectionStore, OptimizedWorkOrderDto } from './globalSelectionStore.types';
2
+ export declare const useGlobalSelectionStore: import("zustand").UseBoundStore<Omit<Omit<Omit<import("zustand").StoreApi<GlobalSelectionStore>, "setState"> & {
3
+ setState<A extends string | {
4
+ type: string;
5
+ }>(partial: GlobalSelectionStore | Partial<GlobalSelectionStore> | ((state: GlobalSelectionStore) => GlobalSelectionStore | Partial<GlobalSelectionStore>), replace?: boolean | undefined, action?: A | undefined): void;
6
+ }, "subscribe"> & {
7
+ subscribe: {
8
+ (listener: (selectedState: GlobalSelectionStore, previousSelectedState: GlobalSelectionStore) => void): () => void;
9
+ <U>(selector: (state: GlobalSelectionStore) => U, listener: (selectedState: U, previousSelectedState: U) => void, options?: {
10
+ equalityFn?: ((a: U, b: U) => boolean) | undefined;
11
+ fireImmediately?: boolean | undefined;
12
+ } | undefined): () => void;
13
+ };
14
+ }, "setState"> & {
15
+ setState(nextStateOrUpdater: GlobalSelectionStore | Partial<GlobalSelectionStore> | ((state: {
16
+ lists: ({
17
+ label: string;
18
+ key: string;
19
+ type: GlobalSelectionItemType.WorkOrder;
20
+ items: {
21
+ id: string;
22
+ type: GlobalSelectionItemType.WorkOrder;
23
+ data: {
24
+ workOrderId: string;
25
+ tagId?: string | undefined;
26
+ tagPlantId: string;
27
+ workCenterId?: string | undefined;
28
+ workCenterPlantId: string;
29
+ plannerGroupId: string;
30
+ workOrderTypeId: string;
31
+ revisionCodeId: string;
32
+ systemId?: string | undefined;
33
+ isOpen: boolean;
34
+ hasStatusTECO: boolean;
35
+ hasStatusRDOP: boolean;
36
+ hasStatusCANC: boolean;
37
+ hasStatusSTRT: boolean;
38
+ hasStatusRDEX: boolean;
39
+ hasStatusPREP: boolean;
40
+ hasStatusPRCO: boolean;
41
+ title: string;
42
+ plantId: string;
43
+ planningPlantId: string;
44
+ sortField: string;
45
+ locationId: string;
46
+ revisionId: string;
47
+ basicStartDateTime?: string | null | undefined;
48
+ basicEndDateTime?: string | null | undefined;
49
+ createdDateTime?: string | null | undefined;
50
+ maintenanceRecord?: {
51
+ activeStatusIds: string;
52
+ completedDateTime?: string | null | undefined;
53
+ correctiveWorkOrderExist?: boolean | undefined;
54
+ correctiveWorkOrderId?: string | undefined;
55
+ createdDateTime: string;
56
+ detectionMethodGroupId?: string | undefined;
57
+ detectionMethodId?: string | undefined;
58
+ equipmentId: string;
59
+ failureEndDateTime?: string | null | undefined;
60
+ failureImpactId?: string | undefined;
61
+ failureMechanismGroupId?: string | undefined;
62
+ failureMechanismId?: string | undefined;
63
+ failureModeGroupId?: string | undefined;
64
+ failureModeId?: string | undefined;
65
+ failureStartDateTime?: string | null | undefined;
66
+ hasUnsafeFailureMode?: boolean | undefined;
67
+ isBreakdown?: boolean | undefined;
68
+ isOpen?: boolean | undefined;
69
+ locationId?: string | undefined;
70
+ maintenanceRecordTypeId?: string | undefined;
71
+ recordId: string;
72
+ requiredEndDate?: string | null | undefined;
73
+ systemId?: string | undefined;
74
+ tagId: string;
75
+ tagPlantId: string;
76
+ title: string;
77
+ unsafeFailureModeStatus?: string | null | undefined;
78
+ workCenterId?: string | undefined;
79
+ } | null | undefined;
80
+ _links: {
81
+ related: string;
82
+ };
83
+ };
84
+ metaData: {
85
+ color: string;
86
+ isHiddenByUser: boolean;
87
+ errorStatuses: GlobalSelectionItemErrorStatuses[];
88
+ };
89
+ }[];
90
+ } | {
91
+ label: string;
92
+ key: string;
93
+ type: GlobalSelectionItemType.Tag;
94
+ items: {
95
+ id: string;
96
+ type: GlobalSelectionItemType.Tag;
97
+ data: {
98
+ tagCategoryDescription: string;
99
+ tagCategory: number;
100
+ tagStatus: import("@equinor/echo-search").TagStatus;
101
+ tagType: string;
102
+ updatedDate: Date;
103
+ locationCode: string;
104
+ contrCode: string;
105
+ plantNo: string;
106
+ poNo: string;
107
+ xCoordinate?: number | undefined;
108
+ yCoordinate?: number | undefined;
109
+ zCoordinate?: number | undefined;
110
+ additionalFields: {
111
+ type: string;
112
+ value: string;
113
+ }[];
114
+ tagNo: string;
115
+ description: string;
116
+ projectCode: string;
117
+ system: string;
118
+ };
119
+ metaData: {
120
+ color: string;
121
+ isHiddenByUser: boolean;
122
+ errorStatuses: GlobalSelectionItemErrorStatuses[];
123
+ };
124
+ }[];
125
+ } | {
126
+ label: string;
127
+ key: string;
128
+ type: GlobalSelectionItemType.Equipment;
129
+ items: {
130
+ id: string;
131
+ type: GlobalSelectionItemType.Equipment;
132
+ data: {
133
+ equipmentId: string;
134
+ equipmentDescription: string;
135
+ maintenancePlantId: string;
136
+ functionalLocationId: string;
137
+ manufacturer: string;
138
+ materialNo: string;
139
+ modelNo: string;
140
+ partNo: string;
141
+ serialNo: string;
142
+ tagPlantId?: string | undefined;
143
+ tagId?: string | undefined;
144
+ locationId: string;
145
+ area?: string | undefined;
146
+ categoryId?: string | undefined;
147
+ activeStatusIds: string[];
148
+ systemStatusIds: string[];
149
+ userStatusIds: string[];
150
+ equipmentsStatus: string[];
151
+ changedDate?: string | undefined;
152
+ createdDate?: string | undefined;
153
+ e3DRef?: string | undefined;
154
+ };
155
+ metaData: {
156
+ color: string;
157
+ isHiddenByUser: boolean;
158
+ errorStatuses: GlobalSelectionItemErrorStatuses[];
159
+ };
160
+ }[];
161
+ })[];
162
+ addWorkOrderToSelection: (args: {
163
+ workOrder: OptimizedWorkOrderDto;
164
+ }) => void;
165
+ replaceWorkOrderSelection: (args: {
166
+ workOrders: OptimizedWorkOrderDto[];
167
+ }) => void;
168
+ setNotFoundItems: (args: {
169
+ itemIds: string[];
170
+ }) => void;
171
+ resetItemNotFoundStates: () => void;
172
+ resetState: () => void;
173
+ }) => void), shouldReplace?: boolean | undefined, action?: string | {
174
+ type: string;
175
+ } | undefined): void;
176
+ }>;
@@ -0,0 +1,117 @@
1
+ import { TagSummaryDto } from '@equinor/echo-search';
2
+ import { Equipment } from '../../equipment';
3
+ export declare enum GlobalSelectionItemType {
4
+ WorkOrder = "WorkOrder",
5
+ Tag = "Tag",
6
+ Equipment = "Equipment"
7
+ }
8
+ interface ItemTypeToDataMap {
9
+ 'WorkOrder': OptimizedWorkOrderDto;
10
+ 'Tag': TagSummaryDto;
11
+ 'Equipment': Equipment;
12
+ }
13
+ type GlobalSelectionList<T extends GlobalSelectionItemType> = {
14
+ label: string;
15
+ key: string;
16
+ type: T;
17
+ items: GlobalSelectionGenericItem<T>[];
18
+ };
19
+ export type GlobalSelectionGenericItem<T extends GlobalSelectionItemType> = {
20
+ id: string;
21
+ type: T;
22
+ data: ItemTypeToDataMap[T];
23
+ metaData: {
24
+ color: string;
25
+ isHiddenByUser: boolean;
26
+ errorStatuses: GlobalSelectionItemErrorStatuses[];
27
+ };
28
+ };
29
+ export type EquipmentGlobalSelectionListItem = GlobalSelectionGenericItem<GlobalSelectionItemType.Equipment>;
30
+ export type WorkOrderGlobalSelectionListItem = GlobalSelectionGenericItem<GlobalSelectionItemType.WorkOrder>;
31
+ export type TagGlobalSelectionListItem = GlobalSelectionGenericItem<GlobalSelectionItemType.Tag>;
32
+ export type GlobalSelectionItem = WorkOrderGlobalSelectionListItem | TagGlobalSelectionListItem | EquipmentGlobalSelectionListItem;
33
+ type EquipmentGlobalSelectionList = GlobalSelectionList<GlobalSelectionItemType.Equipment>;
34
+ export type WorkOrderGlobalSelectionList = GlobalSelectionList<GlobalSelectionItemType.WorkOrder>;
35
+ type TagGlobalSelectionList = GlobalSelectionList<GlobalSelectionItemType.Tag>;
36
+ type GlobalSelectionListUnion = WorkOrderGlobalSelectionList | TagGlobalSelectionList | EquipmentGlobalSelectionList;
37
+ export declare enum GlobalSelectionItemErrorStatuses {
38
+ NotFoundInActiveEchoModule = "NotFoundInActiveEchoModule",
39
+ UnableToDisplay = "UnableToDisplay"
40
+ }
41
+ export interface GlobalSelectionStore {
42
+ lists: GlobalSelectionListUnion[];
43
+ addWorkOrderToSelection: (args: {
44
+ workOrder: OptimizedWorkOrderDto;
45
+ }) => void;
46
+ replaceWorkOrderSelection: (args: {
47
+ workOrders: OptimizedWorkOrderDto[];
48
+ }) => void;
49
+ setNotFoundItems: (args: {
50
+ itemIds: string[];
51
+ }) => void;
52
+ resetItemNotFoundStates: () => void;
53
+ resetState: () => void;
54
+ }
55
+ export type OptimizedWorkOrderDto = {
56
+ workOrderId: string;
57
+ tagId?: string;
58
+ tagPlantId: string;
59
+ workCenterId?: string;
60
+ workCenterPlantId: string;
61
+ plannerGroupId: string;
62
+ workOrderTypeId: string;
63
+ revisionCodeId: string;
64
+ systemId?: string;
65
+ isOpen: boolean;
66
+ hasStatusTECO: boolean;
67
+ hasStatusRDOP: boolean;
68
+ hasStatusCANC: boolean;
69
+ hasStatusSTRT: boolean;
70
+ hasStatusRDEX: boolean;
71
+ hasStatusPREP: boolean;
72
+ hasStatusPRCO: boolean;
73
+ title: string;
74
+ plantId: string;
75
+ planningPlantId: string;
76
+ sortField: string;
77
+ locationId: string;
78
+ revisionId: string;
79
+ basicStartDateTime?: string | null;
80
+ basicEndDateTime?: string | null;
81
+ createdDateTime?: string | null;
82
+ maintenanceRecord?: WorkOrderMaintenanceRecord | null;
83
+ _links: {
84
+ related: string;
85
+ };
86
+ };
87
+ type WorkOrderMaintenanceRecord = {
88
+ activeStatusIds: string;
89
+ completedDateTime?: string | null;
90
+ correctiveWorkOrderExist?: boolean;
91
+ correctiveWorkOrderId?: string;
92
+ createdDateTime: string;
93
+ detectionMethodGroupId?: string;
94
+ detectionMethodId?: string;
95
+ equipmentId: string;
96
+ failureEndDateTime?: string | null;
97
+ failureImpactId?: string;
98
+ failureMechanismGroupId?: string;
99
+ failureMechanismId?: string;
100
+ failureModeGroupId?: string;
101
+ failureModeId?: string;
102
+ failureStartDateTime?: string | null;
103
+ hasUnsafeFailureMode?: boolean;
104
+ isBreakdown?: boolean;
105
+ isOpen?: boolean;
106
+ locationId?: string;
107
+ maintenanceRecordTypeId?: string;
108
+ recordId: string;
109
+ requiredEndDate?: string | null;
110
+ systemId?: string;
111
+ tagId: string;
112
+ tagPlantId: string;
113
+ title: string;
114
+ unsafeFailureModeStatus?: string | null;
115
+ workCenterId?: string;
116
+ };
117
+ export {};
@@ -0,0 +1,3 @@
1
+ import { GlobalSelectionItem } from './globalSelectionStore.types';
2
+ export declare function isGlobalSelectionItemNotFoundInActiveEchoModule(item: GlobalSelectionItem): boolean;
3
+ export declare function isGlobalSelectionItemNotAbleToDisplay(item: GlobalSelectionItem): boolean;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Hook for returning all lists stored in the global selection.
3
+ */
4
+ export declare function useGlobalSelectionLists(): (import("..").WorkOrderGlobalSelectionList | {
5
+ label: string;
6
+ key: string;
7
+ type: import("..").GlobalSelectionItemType.Tag;
8
+ items: import("..").GlobalSelectionGenericItem<import("..").GlobalSelectionItemType.Tag>[];
9
+ } | {
10
+ label: string;
11
+ key: string;
12
+ type: import("..").GlobalSelectionItemType.Equipment;
13
+ items: import("..").GlobalSelectionGenericItem<import("..").GlobalSelectionItemType.Equipment>[];
14
+ })[];
@@ -0,0 +1,6 @@
1
+ import { WorkOrderGlobalSelectionListItem } from '../globalSelectionStore/globalSelectionStore.types';
2
+ /**
3
+ * Returns with the stored Work Orders in the global selection
4
+ * @returns {Partial<WorkOrderDto>[]} Array of Work Orders
5
+ */
6
+ export declare function useGlobalSelectionWorkOrders(): WorkOrderGlobalSelectionListItem[];
@@ -0,0 +1,5 @@
1
+ export { useGlobalSelectionStore } from './globalSelectionStore/globalSelectionStore';
2
+ export * from './globalSelectionStore/globalSelectionStore.types';
3
+ export * from './globalSelectionStore/globalSelectionStore.utils';
4
+ export { useGlobalSelectionLists } from './hooks/useGlobalSelectionLists';
5
+ export { useGlobalSelectionWorkOrders } from './hooks/useGlobalSelectionWorkOrders';
@@ -1,10 +0,0 @@
1
- import { TagSummaryDto } from '@equinor/echo-search';
2
- import { UseQueryResult } from '@tanstack/react-query';
3
- /**
4
- * Get the tag summaries for those tags, which are part of the active selection.
5
- * Works with deep linking: if the selected instCode is different then the instCode in the URL
6
- * it will fetch the tag summaries from STID API.
7
- * Otherwise it will get it from echo-search.
8
- * @returns {UseQueryResult<TagSummaryDto[]>}
9
- */
10
- export declare function useActiveSelectedTagSummaries(): UseQueryResult<TagSummaryDto[]>;
@@ -1,27 +0,0 @@
1
- import * as zustand from 'zustand';
2
- export declare const useActiveSelectionStore: zustand.UseBoundStore<Omit<zustand.StoreApi<ActiveSelectionState>, "subscribe"> & {
3
- subscribe: {
4
- (listener: (selectedState: ActiveSelectionState, previousSelectedState: ActiveSelectionState) => void): () => void;
5
- <U>(selector: (state: ActiveSelectionState) => U, listener: (selectedState: U, previousSelectedState: U) => void, options?: {
6
- equalityFn?: ((a: U, b: U) => boolean) | undefined;
7
- fireImmediately?: boolean | undefined;
8
- } | undefined): () => void;
9
- };
10
- }>;
11
- export type ActiveSelectionItemType = 'tagNos' | 'workOrderIds' | 'measuringPointIds';
12
- export type ActiveSelectionItems = {
13
- [key in ActiveSelectionItemType]: string[];
14
- };
15
- export interface ActiveSelectionState {
16
- items: ActiveSelectionItems;
17
- userRequestAction: string | null;
18
- actions: ActiveSelectionActions;
19
- }
20
- interface ActiveSelectionActions {
21
- addToSelectionByType: (itemType: ActiveSelectionItemType, items: string[]) => void;
22
- removeFromSelectionByType: (itemType: ActiveSelectionItemType, items: string[]) => void;
23
- clearSelectionByType: (itemType: ActiveSelectionItemType) => void;
24
- clearSelectionForAllTypes: () => void;
25
- replaceSelection: (items: ActiveSelectionItems, action?: string) => void;
26
- }
27
- export {};
@@ -1,2 +0,0 @@
1
- export * from './activeSelectionData.hooks';
2
- export * from './activeSelectionStore';