@equinor/echo-framework 0.21.6 → 0.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@equinor/echo-framework",
3
- "version": "0.21.6",
3
+ "version": "0.22.0",
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",
package/src/index.d.ts CHANGED
@@ -25,7 +25,6 @@ export * from './lib/feature/measuringPoint/index';
25
25
  export * from './lib/feature/measuringPoint/types/measuringPoint';
26
26
  export * from './lib/feature/openItemsIn3d';
27
27
  export { createEcho3dInternalLink } from './lib/feature/openItemsIn3d/logic/createEcho3dInternalLink';
28
- export { OpenIn3dSelectedItemsMenu } from './lib/feature/openItemsIn3d/OpenIn3dSelectedItemsMenu';
29
28
  export { WorkOrderContent } from './lib/feature/workOrder/WorkOrderContent';
30
29
  export { RegisteredHookName } from './lib/hooks/hookLibrary';
31
30
  export { useCloseActiveTopMenuAtBreakPoint } from './lib/hooks/useCloseActiveTopMenuAtBreakPoint';
@@ -59,7 +59,15 @@ export declare const globalSelectionApi: Readonly<{
59
59
  */
60
60
  listById: (args: {
61
61
  groupId: import("dist/libs/echo-utils/src").Guid;
62
- categoryId?: GlobalSelectionCategoryId;
62
+ categoryId? /**
63
+ * Removes all items by their IDs, from all groups, from the state.
64
+ *
65
+ * If the given item ids are in more than one group, then a confirmation dialog will be shown to confirm the action.
66
+ *
67
+ * @param {Object} args - The arguments object.
68
+ * @param {GlobalSelectionTypes.ItemId[]} args.itemIds - The array of item IDs to remove.
69
+ * @returns {void}
70
+ */: GlobalSelectionCategoryId;
63
71
  }) => void;
64
72
  }>;
65
73
  add: Readonly<{
@@ -98,9 +106,8 @@ export declare const globalSelectionApi: Readonly<{
98
106
  *
99
107
  */
100
108
  addItems: (args: {
101
- groupId?: import("dist/libs/echo-utils/src").Guid;
102
109
  itemIds: GlobalSelectionTypes.ItemId[];
103
- }) => void;
110
+ } & import("./selectionMenu/selectionTreeStore/actions/selectionTree.action.types").AddByLabel) => void;
104
111
  }>;
105
112
  search: {
106
113
  /**
@@ -20,7 +20,7 @@ export declare const initialEquipmentList: GlobalSelectionTypes.EquipmentList;
20
20
  *
21
21
  * For accessing and using global selection features, use the globalSelectionApi from echo-framework.
22
22
  */
23
- export declare const useGlobalSelectionStore: import("zustand").UseBoundStore<Omit<Omit<Omit<import("zustand").StoreApi<GlobalSelectionStore>, "setState"> & {
23
+ export declare const useGlobalSelectionStore: import("zustand").UseBoundStore<Omit<Omit<Omit<Omit<import("zustand").StoreApi<GlobalSelectionStore>, "setState"> & {
24
24
  setState<A extends string | {
25
25
  type: string;
26
26
  }>(partial: GlobalSelectionStore | Partial<GlobalSelectionStore> | ((state: GlobalSelectionStore) => GlobalSelectionStore | Partial<GlobalSelectionStore>), replace?: boolean | undefined, action?: A | undefined): void;
@@ -32,6 +32,16 @@ export declare const useGlobalSelectionStore: import("zustand").UseBoundStore<Om
32
32
  fireImmediately?: boolean;
33
33
  } | undefined): () => void;
34
34
  };
35
+ }, "persist"> & {
36
+ persist: {
37
+ setOptions: (options: Partial<import("zustand/middleware").PersistOptions<GlobalSelectionStore, GlobalSelectionStore>>) => void;
38
+ clearStorage: () => void;
39
+ rehydrate: () => Promise<void> | void;
40
+ hasHydrated: () => boolean;
41
+ onHydrate: (fn: (state: GlobalSelectionStore) => void) => () => void;
42
+ onFinishHydration: (fn: (state: GlobalSelectionStore) => void) => () => void;
43
+ getOptions: () => Partial<import("zustand/middleware").PersistOptions<GlobalSelectionStore, GlobalSelectionStore>>;
44
+ };
35
45
  }, "setState"> & {
36
46
  setState(nextStateOrUpdater: GlobalSelectionStore | Partial<GlobalSelectionStore> | ((state: import("immer").WritableDraft<GlobalSelectionStore>) => void), shouldReplace?: boolean | undefined, action?: string | {
37
47
  type: string;
@@ -0,0 +1,8 @@
1
+ import { PersistOptions } from 'zustand/middleware';
2
+ import { GlobalSelectionStore } from './globalSelectionStore.types';
3
+ declare function loadAndPopulateStoreMetadata(store: GlobalSelectionStore): Promise<void>;
4
+ export declare const globalSelectionRepository: {
5
+ loadAndPopulateStoreMetadata: typeof loadAndPopulateStoreMetadata;
6
+ persistOptions: PersistOptions<GlobalSelectionStore, GlobalSelectionStore>;
7
+ };
8
+ export {};
@@ -21,17 +21,21 @@ type GlobalSelectionList<T extends GlobalSelectionItemType> = {
21
21
  export type GlobalSelectionObject = {
22
22
  [K in GlobalSelectionItemType]: GlobalSelectionList<K>;
23
23
  };
24
+ export interface GlobalSelectionStoreData {
25
+ lists: GlobalSelectionObject;
26
+ }
24
27
  export type SelectionItemSystemStatus = 'isLoading' | 'notFound' | 'loadedSuccessfully';
28
+ export interface GlobalSelectionMetaData {
29
+ color: string;
30
+ isHiddenByUser: boolean;
31
+ errorStatus?: string;
32
+ systemStatus: SelectionItemSystemStatus;
33
+ }
25
34
  type GlobalSelectionGenericItem<T extends GlobalSelectionItemType> = {
26
35
  id: GlobalSelectionTypes.ItemId;
27
36
  type: T;
28
37
  data: GlobalSelectionTypes.ItemTypeToDataMap[T];
29
- metaData: {
30
- color: string;
31
- isHiddenByUser: boolean;
32
- errorStatus?: string;
33
- systemStatus: SelectionItemSystemStatus;
34
- };
38
+ metaData: GlobalSelectionMetaData;
35
39
  };
36
40
  type EquipmentGlobalSelectionList = GlobalSelectionTypes.List<GlobalSelectionItemType.Equipment>;
37
41
  type WorkOrderGlobalSelectionList = GlobalSelectionTypes.List<GlobalSelectionItemType.WorkOrder>;
@@ -41,8 +45,7 @@ interface ItemErrorStatusUpdates {
41
45
  itemId: GlobalSelectionTypes.ItemId;
42
46
  errorStatus: string;
43
47
  }
44
- export interface GlobalSelectionStore {
45
- lists: GlobalSelectionObject;
48
+ export interface GlobalSelectionStore extends GlobalSelectionStoreData {
46
49
  addWorkOrdersToSelection: (args: {
47
50
  workOrderIds: GlobalSelectionTypes.WorkOrderId[];
48
51
  }) => Promise<GlobalSelectionAddItemResult<ResultArray<WorkOrderData>[]>>;
@@ -56,6 +59,10 @@ export interface GlobalSelectionStore {
56
59
  itemIds: Readonly<Readonly<GlobalSelectionTypes.ItemId>>[];
57
60
  isVisible: boolean;
58
61
  }) => void;
62
+ setItemMetaData: (args: ReadonlyArray<{
63
+ itemId: GlobalSelectionTypes.ItemId;
64
+ metaData: Partial<GlobalSelectionMetaData>;
65
+ }>) => void;
59
66
  resetItemErrorStatuses: () => void;
60
67
  resetState: () => void;
61
68
  setErrorStatusForItems: (args: {
@@ -1,15 +1,14 @@
1
1
  import { GlobalSelectionTypes } from '../../../globalSelectionStore/globalSelectionStore.types';
2
+ import { SelectionBase } from '../selectionTree.store.types';
3
+ export type AddByLabel = SelectionBase | {
4
+ label?: undefined;
5
+ subLabel?: undefined;
6
+ };
2
7
  export type AddItemArgs<ItemIdType extends GlobalSelectionTypes.ItemId> = {
3
8
  itemIds: Readonly<ItemIdType[]>;
4
9
  replaceItems?: boolean;
5
10
  getActionResult?: boolean;
6
- } & ({
7
- label: string;
8
- subLabel: string;
9
- } | {
10
- label?: undefined;
11
- subLabel?: undefined;
12
- });
11
+ } & AddByLabel;
13
12
  export type AddItemsResponse<FetchResponseType> = {
14
13
  fetchResults: FetchResponseType;
15
14
  actionResult: SelectionTreeActionResult;
@@ -1,5 +1,5 @@
1
1
  import { SelectionTreeStore } from './selectionTree.store.types';
2
- export declare const useSelectionTreeStore: import("zustand").UseBoundStore<Omit<Omit<Omit<import("zustand").StoreApi<SelectionTreeStore>, "setState"> & {
2
+ export declare const useSelectionTreeStore: import("zustand").UseBoundStore<Omit<Omit<Omit<Omit<import("zustand").StoreApi<SelectionTreeStore>, "setState"> & {
3
3
  setState<A extends string | {
4
4
  type: string;
5
5
  }>(partial: SelectionTreeStore | Partial<SelectionTreeStore> | ((state: SelectionTreeStore) => SelectionTreeStore | Partial<SelectionTreeStore>), replace?: boolean | undefined, action?: A | undefined): void;
@@ -11,6 +11,16 @@ export declare const useSelectionTreeStore: import("zustand").UseBoundStore<Omit
11
11
  fireImmediately?: boolean;
12
12
  } | undefined): () => void;
13
13
  };
14
+ }, "persist"> & {
15
+ persist: {
16
+ setOptions: (options: Partial<import("zustand/middleware").PersistOptions<SelectionTreeStore, SelectionTreeStore>>) => void;
17
+ clearStorage: () => void;
18
+ rehydrate: () => Promise<void> | void;
19
+ hasHydrated: () => boolean;
20
+ onHydrate: (fn: (state: SelectionTreeStore) => void) => () => void;
21
+ onFinishHydration: (fn: (state: SelectionTreeStore) => void) => () => void;
22
+ getOptions: () => Partial<import("zustand/middleware").PersistOptions<SelectionTreeStore, SelectionTreeStore>>;
23
+ };
14
24
  }, "setState"> & {
15
25
  setState(nextStateOrUpdater: SelectionTreeStore | Partial<SelectionTreeStore> | ((state: import("immer").WritableDraft<SelectionTreeStore>) => void), shouldReplace?: boolean | undefined, action?: string | {
16
26
  type: string;
@@ -0,0 +1,8 @@
1
+ import { PersistOptions } from 'zustand/middleware';
2
+ import { SelectionTreeStore } from './selectionTree.store.types';
3
+ declare function loadAndPopulateStore(store: SelectionTreeStore): Promise<void>;
4
+ export declare const selectionTreeRepository: {
5
+ loadAndPopulateStore: typeof loadAndPopulateStore;
6
+ persistOptions: PersistOptions<SelectionTreeStore, SelectionTreeStore>;
7
+ };
8
+ export {};
@@ -1,7 +1,7 @@
1
1
  import { ResultArray, TagSummaryDto } from '@equinor/echo-search';
2
2
  import { Guid } from '@equinor/echo-utils';
3
3
  import { GlobalSelectionItemType, GlobalSelectionTypes } from '../../globalSelectionStore/globalSelectionStore.types';
4
- import { AddItemArgs, AddItemsResponse, SelectionTreeActionResult } from './actions/selectionTree.action.types';
4
+ import { AddByLabel, AddItemArgs, AddItemsResponse, SelectionTreeActionResult } from './actions/selectionTree.action.types';
5
5
  export type SelectionItemTypeToItemIdMap = {
6
6
  [GlobalSelectionItemType.Tag]: GlobalSelectionTypes.TagId;
7
7
  [GlobalSelectionItemType.WorkOrder]: GlobalSelectionTypes.WorkOrderId;
@@ -21,18 +21,31 @@ export type SelectionTreeItem<T extends GlobalSelectionItemType> = {
21
21
  id: SelectionItemTypeToItemIdMap[T];
22
22
  type: T;
23
23
  };
24
- interface SelectionBase {
24
+ export interface SelectionBase {
25
25
  label: string;
26
- subLabel?: string;
26
+ subLabel: string;
27
27
  }
28
- export interface SelectionCategory extends SelectionBase {
28
+ export interface SelectionCategory {
29
29
  id: GlobalSelectionCategoryId;
30
+ label: string;
30
31
  items: Map<GlobalSelectionTypes.ItemIdString, SelectionTreeItem<GlobalSelectionItemType>>;
31
32
  }
33
+ export interface PersistedSelectionCategory {
34
+ id: GlobalSelectionCategoryId;
35
+ label: string;
36
+ items: SelectionTreeItem<GlobalSelectionItemType>[];
37
+ }
32
38
  export interface SelectionGroup extends SelectionBase {
33
39
  id: Guid;
34
40
  categories: SelectionCategory[];
35
41
  }
42
+ export interface PersistedSelectionGroup extends SelectionBase {
43
+ id: Guid;
44
+ categories: PersistedSelectionCategory[];
45
+ }
46
+ export interface SelectionTreeData {
47
+ groups: SelectionGroup[];
48
+ }
36
49
  export interface SelectionTreeStore {
37
50
  groups: SelectionGroup[];
38
51
  addTags: <T extends boolean | undefined = undefined>(args: AddItemArgs<GlobalSelectionTypes.TagId> & {
@@ -40,9 +53,8 @@ export interface SelectionTreeStore {
40
53
  }) => Promise<AddTagsReturnType<T>>;
41
54
  addWorkOrders: (args: AddItemArgs<GlobalSelectionTypes.WorkOrderId>) => void;
42
55
  addItems: (args: {
43
- groupId?: Guid;
44
56
  itemIds: GlobalSelectionTypes.ItemId[];
45
- }) => void;
57
+ } & AddByLabel) => void;
46
58
  createGroup: (args: {
47
59
  label: string;
48
60
  subLabel: string;
@@ -75,4 +87,3 @@ export declare namespace SelectionTreeTypes {
75
87
  type ActionResult = SelectionTreeActionResult;
76
88
  }
77
89
  export type AddTagsReturnType<T extends boolean | undefined = undefined> = T extends true ? AddItemsResponse<ResultArray<TagSummaryDto>[]> : ResultArray<TagSummaryDto>[];
78
- export {};
@@ -1,4 +1,4 @@
1
1
  import { LegendStrategy } from '../types/legendStrategy.type';
2
2
  import { LegendState } from '../types/legendType';
3
- export declare function injectLegendStrategy(strategy: LegendStrategy, properties: Partial<LegendState>): void;
3
+ export declare function injectLegendStrategy(strategy: LegendStrategy, initialValues: Partial<LegendState>): void;
4
4
  export declare function getLegendStrategy(strategyTypeName: string): LegendStrategy;
@@ -0,0 +1,6 @@
1
+ import { Badge, Marker } from '../types/legendMarkerBadge.type';
2
+ import { LegendId } from '../types/legendType';
3
+ export declare function isHiddenMarker(marker: Marker, hiddenMarkers: ReadonlyArray<string>): boolean;
4
+ export declare function setHiddenMarker(marker: Marker, isHidden: boolean, legendId: LegendId): void;
5
+ export declare function isHiddenBadge(badge: Badge, hiddenBadges: ReadonlyArray<string>): boolean;
6
+ export declare function setHiddenBadge(badge: Badge, isHidden: boolean, legendId: LegendId): void;
@@ -1,4 +1,3 @@
1
1
  export { tagIdPlantIdToPlantTagPairs } from './logic/convertToPlantTagPairs';
2
2
  export type { Plant3dInfo, PlantAndTagForOpenIn3d } from './logic/openItemsIn3d.utils';
3
- export { OpenIn3dSelectedItemsMenu } from './OpenIn3dSelectedItemsMenu';
4
3
  export { OpenItemsIn3dDialog } from './openItemsIn3dDialog';
@@ -1,8 +0,0 @@
1
- import React from 'react';
2
- interface OpenIn3dSelectedItemsMenuProps {
3
- onOpenIn3dButtonClick: () => void;
4
- children?: React.ReactNode;
5
- disabled?: boolean;
6
- }
7
- export declare const OpenIn3dSelectedItemsMenu: React.FC<OpenIn3dSelectedItemsMenuProps>;
8
- export {};
@@ -1,7 +0,0 @@
1
- import React from 'react';
2
- interface OpenIn3dMenuProps {
3
- onOpenIn3dButtonClick: () => void;
4
- disabled: boolean;
5
- }
6
- export declare const OpenIn3dMenu: React.FC<OpenIn3dMenuProps>;
7
- export {};