@equinor/echo-framework 0.21.4 → 0.21.6

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 (18) hide show
  1. package/index.cjs.js +1 -1
  2. package/package.json +1 -1
  3. package/src/lib/coreApplication/EchoContent.d.ts +1 -0
  4. package/src/lib/feature/globalSelection/globalSelectionStore/actions/addItemsToSelection.action.d.ts +1 -2
  5. package/src/lib/feature/globalSelection/globalSelectionStore/globalSelectionStore.d.ts +4 -5
  6. package/src/lib/feature/globalSelection/globalSelectionStore/globalSelectionStore.types.d.ts +3 -5
  7. package/src/lib/feature/globalSelection/globalSelectionStore/globalSelectionStore.utils.d.ts +1 -1
  8. package/src/lib/feature/globalSelection/globalSelectionStore/globalSelectionStoreHelpers.d.ts +4 -5
  9. package/src/lib/feature/globalSelection/hooks/useGlobalSelectionByItemId.d.ts +2 -0
  10. package/src/lib/feature/globalSelection/hooks/useGlobalSelectionLists.d.ts +4 -15
  11. package/src/lib/feature/globalSelection/index.d.ts +1 -0
  12. package/src/lib/feature/globalSelection/selectionMenu/hooks/useIsAllIGlobalSelectionItemsHidden.d.ts +2 -2
  13. package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/actions/addTags.action.d.ts +1 -2
  14. package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/actions/addWorkOrders.action.d.ts +1 -1
  15. package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/actions/createAddItemsFactory.d.ts +1 -2
  16. package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/actions/removeAllItemsById.action.d.ts +1 -2
  17. package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/selectionTree.store.types.d.ts +2 -2
  18. package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/selectionTree.store.utils.d.ts +2 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@equinor/echo-framework",
3
- "version": "0.21.4",
3
+ "version": "0.21.6",
4
4
  "peerDependencies": {
5
5
  "@equinor/echo-base": ">= 0.7.0 < 0.8.0",
6
6
  "@equinor/echo-components": ">= 0.12.0 < 0.13.0",
@@ -2,6 +2,7 @@ import React from 'react';
2
2
  interface CorePanelsProps {
3
3
  children: React.ReactNode;
4
4
  Legend: React.FC | null | undefined;
5
+ isOnboardingCompleted: boolean;
5
6
  }
6
7
  export declare const EchoContent: React.FC<CorePanelsProps>;
7
8
  export {};
@@ -1,5 +1,4 @@
1
1
  import { ResultArray } from '@equinor/echo-search';
2
- import { WritableDraft } from 'immer';
3
2
  import { StoreApi } from 'zustand';
4
3
  import { GlobalSelectionItemType, GlobalSelectionItemTypeToDataMap, GlobalSelectionStore, GlobalSelectionTypes } from '../globalSelectionStore.types';
5
4
  type FetchFunction<T, U> = (itemIds: Readonly<U[]>) => Promise<ResultArray<T>[]>;
@@ -9,7 +8,7 @@ type ItemIdTypeMap = {
9
8
  [GlobalSelectionItemType.Tag]: GlobalSelectionTypes.TagId;
10
9
  [GlobalSelectionItemType.Equipment]: GlobalSelectionTypes.EquipmentId;
11
10
  };
12
- type SetFunction = (set: (state: WritableDraft<GlobalSelectionStore>) => void, shouldReplace?: boolean | undefined, action?: string) => void;
11
+ type SetFunction = (set: (state: GlobalSelectionStore) => void, shouldReplace?: boolean | undefined, action?: string) => void;
13
12
  export declare function addItemsToSelection<T extends GlobalSelectionItemType>(set: SetFunction, get: StoreApi<GlobalSelectionStore>['getState'], args: {
14
13
  itemIds: ItemIdTypeMap[T][];
15
14
  }, itemType: T, fetchFunction: FetchFunction<GlobalSelectionItemTypeToDataMap[T], ItemIdTypeMap[T]>, nullItemGenerator: NullItemGenerator<GlobalSelectionItemTypeToDataMap[T], ItemIdTypeMap[T]>): Promise<{
@@ -1,8 +1,7 @@
1
- import { WritableDraft } from 'immer';
2
1
  import { GlobalSelectionStore, 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>;
2
+ export declare const initialWorkOrderList: GlobalSelectionTypes.WorkOrderList;
3
+ export declare const initialTagList: GlobalSelectionTypes.TagList;
4
+ export declare const initialEquipmentList: GlobalSelectionTypes.EquipmentList;
6
5
  /**
7
6
  * The single source of truth for items stored in Global Selection.
8
7
  * Each item is stored here once, does not store item grouping in any way.
@@ -34,7 +33,7 @@ export declare const useGlobalSelectionStore: import("zustand").UseBoundStore<Om
34
33
  } | undefined): () => void;
35
34
  };
36
35
  }, "setState"> & {
37
- setState(nextStateOrUpdater: GlobalSelectionStore | Partial<GlobalSelectionStore> | ((state: WritableDraft<GlobalSelectionStore>) => void), shouldReplace?: boolean | undefined, action?: string | {
36
+ setState(nextStateOrUpdater: GlobalSelectionStore | Partial<GlobalSelectionStore> | ((state: import("immer").WritableDraft<GlobalSelectionStore>) => void), shouldReplace?: boolean | undefined, action?: string | {
38
37
  type: string;
39
38
  } | undefined): void;
40
39
  }>;
@@ -1,13 +1,11 @@
1
1
  import { ResultArray, TagSummaryDto, WorkOrderData } from '@equinor/echo-search';
2
+ import { Brand } from '@equinor/echo-utils';
2
3
  import { Equipment } from '../../equipment';
3
4
  export declare enum GlobalSelectionItemType {
4
5
  WorkOrder = "WorkOrder",
5
6
  Tag = "Tag",
6
7
  Equipment = "Equipment"
7
8
  }
8
- export type DeepWritable<T> = {
9
- -readonly [P in keyof T]: DeepWritable<T[P]>;
10
- };
11
9
  type GlobalSelectionTagDto = TagSummaryDto;
12
10
  type GlobalSelectionWorkOrderDto = WorkOrderData;
13
11
  export interface GlobalSelectionItemTypeToDataMap {
@@ -18,8 +16,7 @@ export interface GlobalSelectionItemTypeToDataMap {
18
16
  type GlobalSelectionList<T extends GlobalSelectionItemType> = {
19
17
  label: string;
20
18
  type: T;
21
- items: GlobalSelectionTypes.GenericItem<T>[];
22
- itemsBeingLoaded: GlobalSelectionTypes.ItemId[];
19
+ items: Map<GlobalSelectionTypes.ItemIdString, GlobalSelectionTypes.GenericItem<T>>;
23
20
  };
24
21
  export type GlobalSelectionObject = {
25
22
  [K in GlobalSelectionItemType]: GlobalSelectionList<K>;
@@ -78,6 +75,7 @@ export declare namespace GlobalSelectionTypes {
78
75
  type EquipmentId = Pick<Equipment, 'equipmentId'>;
79
76
  type TagId = Pick<TagSummaryDto, 'tagNo' | 'instCode'>;
80
77
  type ItemId = WorkOrderId | EquipmentId | TagId;
78
+ type ItemIdString = Brand<string, 'ItemIdString'>;
81
79
  type TagDto = GlobalSelectionTagDto;
82
80
  type WorkOrderDto = GlobalSelectionWorkOrderDto;
83
81
  type EquipmentItem = GlobalSelectionGenericItem<GlobalSelectionItemType.Equipment>;
@@ -29,7 +29,7 @@ declare function mapToId(item: GlobalSelectionTypes.WorkOrderId): GlobalSelectio
29
29
  declare function mapToId(item: GlobalSelectionTypes.EquipmentId): GlobalSelectionTypes.EquipmentId;
30
30
  declare function mapToId(item: GlobalSelectionTypes.TagId): GlobalSelectionTypes.TagId;
31
31
  declare function mapToId(item: GlobalSelectionTypes.ItemId): GlobalSelectionTypes.ItemId;
32
- declare function itemIdToString(itemId: GlobalSelectionTypes.ItemId): string;
32
+ declare function itemIdToString(itemId: GlobalSelectionTypes.ItemId): GlobalSelectionTypes.ItemIdString;
33
33
  export declare function mapIdToItemType(itemId: GlobalSelectionTypes.ItemId): GlobalSelectionItemType;
34
34
  /**
35
35
  * A utility object that provides various functions for handling global selections.
@@ -1,6 +1,5 @@
1
- import { WritableDraft } from 'immer';
2
1
  import { PlantAndTagForOpenIn3d } from '../../openItemsIn3d/logic/openItemsIn3d.utils';
3
- import { DeepWritable, GlobalSelectionItemType, GlobalSelectionTypes, SelectionItemSystemStatus } from './globalSelectionStore.types';
2
+ import { GlobalSelectionItemType, GlobalSelectionTypes, SelectionItemSystemStatus } from './globalSelectionStore.types';
4
3
  /**
5
4
  * Converts global selection items to plant tag pairs.
6
5
  *
@@ -18,11 +17,11 @@ export declare function toGlobalSelectionItem<T extends GlobalSelectionTypes.Ite
18
17
  export declare function toGlobalSelectionItems<T extends GlobalSelectionTypes.ItemTypeToDataMap[K], K extends GlobalSelectionItemType>(items: T[], type: K, systemStatus: SelectionItemSystemStatus): GlobalSelectionTypes.GenericItem<K>[];
19
18
  export declare function finalizeLoadStateByItemType<T extends GlobalSelectionItemType>(args: {
20
19
  itemType: GlobalSelectionItemType;
21
- state: WritableDraft<GlobalSelectionTypes.Store>;
22
- itemDataToStore: DeepWritable<GlobalSelectionTypes.ItemTypeToDataMap[T]>[];
20
+ state: GlobalSelectionTypes.Store;
21
+ itemDataToStore: GlobalSelectionTypes.ItemTypeToDataMap[T][];
23
22
  }): void;
24
23
  export declare function setNotFoundStatusByItemIds(args: {
25
24
  itemType: GlobalSelectionItemType;
26
- state: WritableDraft<GlobalSelectionTypes.Store>;
25
+ state: GlobalSelectionTypes.Store;
27
26
  notFoundItemIds: GlobalSelectionTypes.ItemId[];
28
27
  }): void;
@@ -0,0 +1,2 @@
1
+ import { GlobalSelectionItemType, GlobalSelectionTypes } from '../globalSelectionStore/globalSelectionStore.types';
2
+ export declare function useGlobalSelectionByItemId<T extends GlobalSelectionItemType>(itemType: T, itemId: GlobalSelectionTypes.ItemId): GlobalSelectionTypes.GenericItem<T> | undefined;
@@ -1,19 +1,8 @@
1
1
  /**
2
2
  * Hook for returning all lists stored in the global selection.
3
3
  */
4
- export declare function useGlobalSelectionLists(): ({
4
+ export declare function useGlobalSelectionLists(): {
5
5
  label: string;
6
- type: import("..").GlobalSelectionItemType.WorkOrder;
7
- items: import("..").GlobalSelectionTypes.GenericItem<import("..").GlobalSelectionItemType.WorkOrder>[];
8
- itemsBeingLoaded: import("..").GlobalSelectionTypes.ItemId[];
9
- } | {
10
- label: string;
11
- type: import("..").GlobalSelectionItemType.Tag;
12
- items: import("..").GlobalSelectionTypes.GenericItem<import("..").GlobalSelectionItemType.Tag>[];
13
- itemsBeingLoaded: import("..").GlobalSelectionTypes.ItemId[];
14
- } | {
15
- label: string;
16
- type: import("..").GlobalSelectionItemType.Equipment;
17
- items: import("..").GlobalSelectionTypes.GenericItem<import("..").GlobalSelectionItemType.Equipment>[];
18
- itemsBeingLoaded: import("..").GlobalSelectionTypes.ItemId[];
19
- })[];
6
+ type: import("..").GlobalSelectionItemType;
7
+ items: (import("..").GlobalSelectionTypes.GenericItem<import("..").GlobalSelectionItemType.WorkOrder> | import("..").GlobalSelectionTypes.GenericItem<import("..").GlobalSelectionItemType.Tag> | import("..").GlobalSelectionTypes.GenericItem<import("..").GlobalSelectionItemType.Equipment>)[];
8
+ }[];
@@ -3,6 +3,7 @@ export { globalSelectionApi } from './globalSelection.api';
3
3
  export * from './globalSelectionStore/globalSelectionStore.types';
4
4
  export { globalSelectionUtils } from './globalSelectionStore/globalSelectionStore.utils';
5
5
  export { convertGlobalSelectionItemsToPlantTagPairs } from './globalSelectionStore/globalSelectionStoreHelpers';
6
+ export { useGlobalSelectionByItemId } from './hooks/useGlobalSelectionByItemId';
6
7
  export { useGlobalSelectionItems } from './hooks/useGlobalSelectionItems';
7
8
  export { useGlobalSelectionItemsByType } from './hooks/useGlobalSelectionItemsByType';
8
9
  export { useGlobalSelectionLists } from './hooks/useGlobalSelectionLists';
@@ -1,5 +1,5 @@
1
1
  import { Guid } from '@equinor/echo-utils';
2
- interface useIsAllIGlobalSelectionItemsHiddenArgs {
2
+ interface UseIsAllIGlobalSelectionItemsHiddenArgs {
3
3
  groupId: Guid;
4
4
  categoryId?: string;
5
5
  }
@@ -15,5 +15,5 @@ interface useIsAllIGlobalSelectionItemsHiddenArgs {
15
15
  *
16
16
  * The hook returns `true` if all items in the list are hidden by the user, and `false` otherwise.
17
17
  */
18
- export declare const useIsAllIGlobalSelectionItemsHidden: (args: useIsAllIGlobalSelectionItemsHiddenArgs) => boolean;
18
+ export declare const useIsAllIGlobalSelectionItemsHidden: (args: UseIsAllIGlobalSelectionItemsHiddenArgs) => boolean;
19
19
  export {};
@@ -1,10 +1,9 @@
1
1
  import { ResultArray, TagSummaryDto } from '@equinor/echo-search';
2
- import { WritableDraft } from 'immer';
3
2
  import { StoreApi } from 'zustand';
4
3
  import { GlobalSelectionTypes } from '../../../globalSelectionStore/globalSelectionStore.types';
5
4
  import { SelectionTreeStore } from '../selectionTree.store.types';
6
5
  import { AddItemArgs, AddItemsResponse } from './selectionTree.action.types';
7
- type SetFunction = (set: (state: WritableDraft<SelectionTreeStore>) => void, shouldReplace?: boolean | undefined, action?: string) => void;
6
+ type SetFunction = (set: (state: SelectionTreeStore) => void, shouldReplace?: boolean | undefined, action?: string) => void;
8
7
  export declare function addTagsAction(set: SetFunction, get: StoreApi<SelectionTreeStore>['getState'], args: AddItemArgs<GlobalSelectionTypes.TagId> & {
9
8
  getActionResult: true;
10
9
  }): Promise<AddItemsResponse<ResultArray<TagSummaryDto>[]>>;
@@ -1,6 +1,6 @@
1
1
  import { WorkOrderData } from '@equinor/echo-search';
2
2
  import { GlobalSelectionTypes } from '../../../globalSelectionStore/globalSelectionStore.types';
3
- export declare const addWorkOrdersAction: (set: (set: (state: import("immer").WritableDraft<import("../selectionTree.store.types").SelectionTreeStore>) => void, shouldReplace?: boolean | undefined, action?: string) => void, get: import("zustand").StoreApi<import("../selectionTree.store.types").SelectionTreeStore>["getState"], args: import("./selectionTree.action.types").AddItemArgs<GlobalSelectionTypes.WorkOrderId>) => Promise<import("./selectionTree.action.types").AddItemsResponse<import("@equinor/echo-search").ResultArray<unknown>[]> | {
3
+ export declare const addWorkOrdersAction: (set: (set: (state: import("../selectionTree.store.types").SelectionTreeStore) => void, shouldReplace?: boolean | undefined, action?: string) => void, get: import("zustand").StoreApi<import("../selectionTree.store.types").SelectionTreeStore>["getState"], args: import("./selectionTree.action.types").AddItemArgs<GlobalSelectionTypes.WorkOrderId>) => Promise<import("./selectionTree.action.types").AddItemsResponse<import("@equinor/echo-search").ResultArray<unknown>[]> | {
4
4
  fetchResults: import("@equinor/echo-search").ResultArray<WorkOrderData>[][];
5
5
  actionResult: string;
6
6
  }>;
@@ -1,10 +1,9 @@
1
1
  import { ResultArray } from '@equinor/echo-search';
2
- import { WritableDraft } from 'immer';
3
2
  import { StoreApi } from 'zustand';
4
3
  import { GlobalSelectionAddItemResult, GlobalSelectionItemType, GlobalSelectionTypes } from '../../../globalSelectionStore/globalSelectionStore.types';
5
4
  import { GlobalSelectionCategoryId, SelectionTreeStore } from '../selectionTree.store.types';
6
5
  import { AddItemArgs, AddItemsResponse } from './selectionTree.action.types';
7
- type SetFunction = (set: (state: WritableDraft<SelectionTreeStore>) => void, shouldReplace?: boolean | undefined, action?: string) => void;
6
+ type SetFunction = (set: (state: SelectionTreeStore) => void, shouldReplace?: boolean | undefined, action?: string) => void;
8
7
  export declare function addItemsActionFactory<G_ItemId extends GlobalSelectionTypes.ItemId, G_ResponseData>(args: {
9
8
  addItemToGlobalSelection: (uniqueNewItems: G_ItemId[]) => Promise<GlobalSelectionAddItemResult<ResultArray<G_ResponseData>[]>>;
10
9
  itemType: GlobalSelectionItemType;
@@ -1,7 +1,6 @@
1
- import { WritableDraft } from 'immer';
2
1
  import { GlobalSelectionTypes } from '../../../globalSelectionStore/globalSelectionStore.types';
3
2
  import { SelectionTreeStore } from '../selectionTree.store.types';
4
- type SetFunction = (set: (state: WritableDraft<SelectionTreeStore>) => void, shouldReplace?: boolean | undefined, action?: string) => void;
3
+ type SetFunction = (set: (state: SelectionTreeStore) => void, shouldReplace?: boolean | undefined, action?: string) => void;
5
4
  /**
6
5
  * Removes all items by their IDs, from all groups, from the state.
7
6
  *
@@ -17,7 +17,7 @@ export declare enum SelectionMenuDefaultListIds {
17
17
  TagList = "DEFAULT_TAG_LIST_ID",
18
18
  WorkOrderList = "DEFAULT_WORK_ORDER_LIST_ID"
19
19
  }
20
- type SelectionItem<T extends GlobalSelectionItemType> = {
20
+ export type SelectionTreeItem<T extends GlobalSelectionItemType> = {
21
21
  id: SelectionItemTypeToItemIdMap[T];
22
22
  type: T;
23
23
  };
@@ -27,7 +27,7 @@ interface SelectionBase {
27
27
  }
28
28
  export interface SelectionCategory extends SelectionBase {
29
29
  id: GlobalSelectionCategoryId;
30
- items: SelectionItem<GlobalSelectionItemType>[];
30
+ items: Map<GlobalSelectionTypes.ItemIdString, SelectionTreeItem<GlobalSelectionItemType>>;
31
31
  }
32
32
  export interface SelectionGroup extends SelectionBase {
33
33
  id: Guid;
@@ -1,5 +1,4 @@
1
1
  import { Guid } from '@equinor/echo-utils';
2
- import { WritableDraft } from 'immer';
3
2
  import { GlobalSelectionTypes } from '../../globalSelectionStore/globalSelectionStore.types';
4
3
  import { GlobalSelectionCategoryId, SelectionTreeTypes } from './selectionTree.store.types';
5
4
  /**
@@ -81,11 +80,11 @@ export declare function areItemsTheSameInGroup<ItemType extends GlobalSelectionT
81
80
  /**
82
81
  * Removes an empty group from the list of groups, except if it's the local (default) selection.
83
82
  *
84
- * @param {WritableDraft<SelectionTreeTypes.Group[]>} allGroups - The list of all groups.
83
+ * @param {SelectionTreeTypes.Group[]} allGroups - The list of all groups.
85
84
  * @param {SelectionTreeTypes.Group} targetGroup - The group to check and potentially remove.
86
85
  * @returns {void}
87
86
  */
88
- export declare function removeGroupIfEmpty(allGroups: WritableDraft<SelectionTreeTypes.Group[]>, targetGroup: SelectionTreeTypes.Group): void;
87
+ export declare function removeGroupIfEmpty(allGroups: SelectionTreeTypes.Group[], targetGroup: SelectionTreeTypes.Group): void;
89
88
  /**
90
89
  * Removes items from the global selection if they are not present in the tree store anymore.
91
90
  *