@equinor/echo-framework 4.2.0 → 4.3.0-beta-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.
Files changed (52) hide show
  1. package/{47deeba42768c5d1.svg → 063009f06499d102.svg} +8 -8
  2. package/README.md +48 -48
  3. package/{1bd97dd2170d0f64.svg → f4c85313e79b1662.svg} +850 -850
  4. package/index.cjs.js +2 -2
  5. package/index.d.ts +2 -2
  6. package/package.json +8 -8
  7. package/src/index.d.ts +3 -3
  8. package/src/lib/components/prepview/panels/tagDocumentRefs/HorizontalDocumentGroups.d.ts +1 -1
  9. package/src/lib/feature/globalSelection/components/SelectionActionBar/SelectionActionBarMenuItem.d.ts +12 -0
  10. package/src/lib/feature/globalSelection/components/SelectionActionBar.d.ts +5 -0
  11. package/src/lib/feature/globalSelection/hooks/useSelectionAction.d.ts +2 -2
  12. package/src/lib/feature/legend/components/BasicLegendRenderer.d.ts +1 -1
  13. package/src/lib/feature/legend/components/LegendSelectorContainer.d.ts +17 -0
  14. package/src/lib/feature/legend/components/pdfMarkers/subComponents/ItemMarkerPopoverContainer.d.ts +9 -0
  15. package/src/lib/feature/legend/components/popover/LegendPopoverContent.d.ts +9 -26
  16. package/src/lib/feature/legend/components/popover/LegendPopoverContent.logic.d.ts +12 -6
  17. package/src/lib/feature/legend/hooks/useGroupedMarkers.utils.d.ts +0 -4
  18. package/src/lib/feature/legend/hooks/useLegendMarker/useLegendMarker.utils.d.ts +1 -1
  19. package/src/lib/feature/legend/hooks/useLegendUniqueBadges.d.ts +1 -3
  20. package/src/lib/feature/legend/hooks/useLegendUniqueMarkers.d.ts +1 -3
  21. package/src/lib/feature/legend/index.d.ts +8 -5
  22. package/src/lib/feature/legend/legendStrategies/notificationStrategy/api/notificationsLegend.api.d.ts +7 -0
  23. package/src/lib/feature/legend/legendStrategies/notificationStrategy/components/NotificationPopover.d.ts +8 -0
  24. package/src/lib/feature/legend/legendStrategies/notificationStrategy/hooks/useNotificationMarkers.d.ts +6 -0
  25. package/src/lib/feature/legend/legendStrategies/notificationStrategy/hooks/useNotificationsByTagIds.d.ts +14 -0
  26. package/src/lib/feature/legend/legendStrategies/notificationStrategy/logic/getNotificationPopover.d.ts +12 -0
  27. package/src/lib/feature/legend/legendStrategies/notificationStrategy/logic/notificationLegend.logic.d.ts +12 -0
  28. package/src/lib/feature/legend/legendStrategies/notificationStrategy/notificationStrategy.types.d.ts +5 -0
  29. package/src/lib/feature/legend/legendStrategies/notificationStrategy/optionConfigs/notificationBadgeLegendOptionConfig.d.ts +6 -0
  30. package/src/lib/feature/legend/legendStrategies/notificationStrategy/optionConfigs/notificationMarkerLegendOptionConfig.d.ts +4 -0
  31. package/src/lib/feature/legend/legendStrategies/notificationStrategy/testing/createTestNotification.d.ts +2 -0
  32. package/src/lib/feature/legend/legendStrategies/notificationStrategy/utils/getColorForNotificationLegendStatus.d.ts +7 -0
  33. package/src/lib/feature/legend/legendStrategies/notificationStrategy/utils/getNotificationTitlesByPropertyName.d.ts +2 -0
  34. package/src/lib/feature/legend/legendStrategies/notificationStrategy/utils/notificationLegend.utils.d.ts +12 -0
  35. package/src/lib/feature/legend/logic/getColorForLegendStatus.d.ts +5 -0
  36. package/src/lib/feature/legend/logic/normalizeBadges.d.ts +25 -12
  37. package/src/lib/feature/legend/logic/propertyAccessor.utils.d.ts +36 -0
  38. package/src/lib/feature/legend/stores/initializeLegendInStores.d.ts +3 -4
  39. package/src/lib/feature/legend/stores/legendDataStore/legendStore.d.ts +0 -1
  40. package/src/lib/feature/legend/stores/legendUIStore/legendUIStore.types.d.ts +5 -5
  41. package/src/lib/feature/legend/types/legendStrategy.type.d.ts +6 -6
  42. package/src/lib/feature/legend/types/legendType.d.ts +26 -19
  43. package/src/lib/hooks/useOpenPdfFile.d.ts +12 -0
  44. package/src/lib/hooks/useScreenValues.d.ts +2 -2
  45. package/src/lib/services/dataLayerPanel/dataLayerPanel.store.d.ts +2 -0
  46. package/src/lib/feature/globalSelection/components/SelectionActionBar/SelectionFeedbackDisplay.d.ts +0 -7
  47. package/src/lib/feature/globalSelection/components/SelectionActionBar/selectionFeedback.types.d.ts +0 -1
  48. package/src/lib/feature/globalSelection/components/SelectionMenuTrigger/SelectionGroupMenuItem.d.ts +0 -9
  49. package/src/lib/feature/globalSelection/components/SelectionMenuTrigger/SelectionMenuTrigger.d.ts +0 -12
  50. package/src/lib/feature/legend/components/legendTextSelector/LegendTextSelector.d.ts +0 -20
  51. package/src/lib/feature/legend/legendStrategies/workOrderStrategy/components/WorkOrderPopoverPrimaryRow.d.ts +0 -15
  52. package/src/lib/feature/legend/legendStrategies/workOrderStrategy/components/WorkOrderPopoverThirdRow.d.ts +0 -16
@@ -1,5 +1,5 @@
1
1
  import { Marker } from './legendMarkerBadge.type';
2
- import { LegendDataId, LegendId, LegendOptionConfig } from './legendType';
2
+ import { LegendBadgeOptionConfig, LegendDataId, LegendId, LegendMarkerOptionConfig } from './legendType';
3
3
  /**
4
4
  * A general interface for the legend strategy. This enables us to automatically render all the legend ui parts: the ui with selectable options, the markers & the badges.
5
5
  * The specific implementation (like tagStrategy, equipmentStrategy, etc) will implement this, and inject it with legendFacade.injectLegendStrategy.
@@ -12,21 +12,21 @@ export interface LegendStrategy {
12
12
  /**
13
13
  * Marker options that is selectable by the user.
14
14
  */
15
- markerOptions?: ReadonlyArray<LegendOptionConfig>;
15
+ markerOptions?: ReadonlyArray<LegendMarkerOptionConfig>;
16
16
  /**
17
17
  * Badge options that is selectable by the user.
18
+ * Each badge option can have enableDisplayOptions: true to show display options (id, count, displayName).
19
+ * The displayOption property controls how the badge text is rendered.
18
20
  */
19
- badgeOptions?: ReadonlyArray<LegendOptionConfig>;
20
- getBadgeTextOptions?: (selectedBadgeOption: LegendOptionConfig) => ReadonlyArray<string> | undefined;
21
+ badgeOptions?: ReadonlyArray<LegendBadgeOptionConfig>;
21
22
  /**
22
23
  * Returns 1 marker with badges for each incoming itemId. The viewport will make them unique when needed, and
23
24
  * also split into groups based on (global) selection tree
24
25
  *
25
26
  * @param itemIds - The legend data IDs to create markers for
26
- * @param isViewport - Optional use this for rendering different markers/badges in viewport compared to legendRenderer. For example equipmentLegend, where we render part-type name in legendRenderer, but id in viewport.
27
27
  * @returns Array of markers with badges, 1 marker with badges for each incoming itemId
28
28
  */
29
- useMarkers: (itemIds: ReadonlyArray<LegendDataId>, isViewport?: boolean) => ReadonlyArray<Marker>;
29
+ useMarkers: (itemIds: ReadonlyArray<LegendDataId>) => ReadonlyArray<Marker>;
30
30
  /**
31
31
  * Returns popover content that supports pagination for the given legendDataId.
32
32
  * One legendDataId can have multiple items associated with it, for example a tag can have multiple work orders.
@@ -1,3 +1,4 @@
1
+ import type { NotificationDto } from '@equinor/echo-search';
1
2
  import { Brand } from '@equinor/echo-utils';
2
3
  import { GlobalSelectionTypes } from '../../globalSelection';
3
4
  export type KnownLegendIds = 'Equipment Legend' | 'Tag Legend' | 'Work Order Legend' | 'Notification Legend';
@@ -9,20 +10,17 @@ export declare const knownLegendIds: {
9
10
  workOrderLegendId: LegendId;
10
11
  notificationLegendId: LegendId;
11
12
  };
12
- export interface LegendState {
13
+ export interface LegendState<MarkerOptionType = string, BadgeOptionType = string> {
13
14
  readonly legendId: LegendId;
14
15
  readonly isEnabled: boolean;
15
16
  readonly isLoading: boolean;
16
- readonly selectedMarkerOption: LegendOptionConfig;
17
- readonly selectedBadgeOption: LegendOptionConfig;
18
- readonly selectedBadgeTextOptions: Record<string, string>;
17
+ readonly selectedMarkerOption: LegendMarkerOptionConfig<MarkerOptionType>;
18
+ readonly selectedBadgeOption: LegendBadgeOptionConfig<BadgeOptionType>;
19
19
  }
20
20
  export type LegendTagId = GlobalSelectionTypes.TagId;
21
21
  export type LegendEquipmentId = GlobalSelectionTypes.EquipmentId;
22
22
  export type LegendWorkOrderId = GlobalSelectionTypes.WorkOrderId;
23
- export type LegendNotificationId = {
24
- testId: string;
25
- };
23
+ export type LegendNotificationId = Pick<NotificationDto, 'maintenanceRecordId'>;
26
24
  /**
27
25
  * Union of LegendDataId types that correspond to global selection item IDs.
28
26
  * These can be safely used with globalSelectionUtils.
@@ -32,18 +30,27 @@ export type LegendNotificationId = {
32
30
  * 2. Go to legendDataId.utils.ts and update selectionGuards (this will cause a compile error until you add a guard for the new type)
33
31
  */
34
32
  export type GlobalSelectionLegendDataId = LegendTagId | LegendEquipmentId | LegendWorkOrderId;
35
- type NonGlobalSelectionLegendDataId = LegendNotificationId;
33
+ export type NonGlobalSelectionLegendDataId = LegendNotificationId;
36
34
  export type LegendDataId = GlobalSelectionLegendDataId | NonGlobalSelectionLegendDataId;
37
- export interface LegendOptionConfig<T = string> {
38
- propertyName: T;
39
- /**
40
- * The idea with this is to use it with general rules for strategies US.
41
- * Indicates whether the propertyName corresponds to a field in an object structure.
42
- * When true, propertyName refers to an actual field in a data object.
43
- * When false, propertyName is just a string identifier not tied to object fields.
44
- * Comment it in when it is needed.
45
- */
46
- displayName: string;
47
- showChipsInViewportOnly?: boolean;
35
+ /**
36
+ * Base configuration for legend options (markers and badges).
37
+ */
38
+ interface LegendOptionConfigBase<T = string> {
39
+ readonly propertyName: T;
40
+ readonly displayName: string;
41
+ readonly showChipsInViewportOnly?: boolean;
42
+ }
43
+ export type LegendMarkerOptionConfig<T = string> = LegendOptionConfigBase<T>;
44
+ /**
45
+ * Configuration for badge options. Badges can have display options to control
46
+ * how badge text is rendered (displayName, id, or count).
47
+ */
48
+ export interface LegendBadgeOptionConfig<T = string> extends LegendOptionConfigBase<T> {
49
+ readonly enableDisplayOptions?: boolean;
50
+ readonly displayOption?: LegendOptionDisplayOption;
48
51
  }
52
+ export type LegendOptionConfig<T = string> = LegendMarkerOptionConfig<T> | LegendBadgeOptionConfig<T>;
53
+ export declare const ID_MODE_KEYWORD = "id";
54
+ export declare const COUNT_MODE_KEYWORD = "count";
55
+ export type LegendOptionDisplayOption = 'displayName' | typeof ID_MODE_KEYWORD | typeof COUNT_MODE_KEYWORD;
49
56
  export {};
@@ -1,3 +1,9 @@
1
+ /**
2
+ * Hook that returns a callback to open a standard PDF file in the viewer.
3
+ * Navigates to `/viewer` with `docNo`, `fileId`, and `revNo` as query params.
4
+ *
5
+ * @returns A callback that accepts `{ instCode, docNo, fileId, revNo, tagNo? }` and navigates to the viewer.
6
+ */
1
7
  export declare function useOpenPdfFile(): (args: {
2
8
  instCode: string;
3
9
  docNo: string;
@@ -5,6 +11,12 @@ export declare function useOpenPdfFile(): (args: {
5
11
  revNo: string;
6
12
  tagNo?: string;
7
13
  }) => void;
14
+ /**
15
+ * Hook that returns a callback to open a loop file (external URL) in the viewer.
16
+ * Navigates to `/viewer` with `fileUrl` as query param instead of `fileId`.
17
+ *
18
+ * @returns A callback that accepts `{ instCode, fileUrl, tagNo? }` and navigates to the viewer.
19
+ */
8
20
  export declare function useOpenPdfFileUrl(): (args: {
9
21
  instCode: string;
10
22
  fileUrl: string;
@@ -6,8 +6,8 @@ import { ScreenOrientation } from '../types/hookLibrary';
6
6
  * @returns {ScreenOrientation} response.screenOrientation
7
7
  */
8
8
  type DeviceValues = {
9
- isScreenMobileSize: boolean;
10
- screenOrientation: ScreenOrientation;
9
+ readonly isScreenMobileSize: boolean;
10
+ readonly screenOrientation: ScreenOrientation;
11
11
  };
12
12
  export declare function useScreenValues(): DeviceValues;
13
13
  export {};
@@ -30,6 +30,7 @@ interface DataLayerPanelActions {
30
30
  toggleEquipmentsFromSelectionVisible: () => void;
31
31
  setEquipmentsForEcm: () => void;
32
32
  toggleIocAnnotations: () => void;
33
+ toggleNotifications: () => void;
33
34
  setIsDataFromStidAnnoDetails: (value: boolean) => void;
34
35
  }
35
36
  export type DataLayerPanelStore = DataLayerPanelState & DataLayerPanelActions;
@@ -74,6 +75,7 @@ export declare const useDataLayerPanelStore: import("zustand").UseBoundStore<Omi
74
75
  toggleEquipmentsFromSelectionVisible: () => void;
75
76
  setEquipmentsForEcm: () => void;
76
77
  toggleIocAnnotations: () => void;
78
+ toggleNotifications: () => void;
77
79
  setIsDataFromStidAnnoDetails: (value: boolean) => void;
78
80
  }) => void), shouldReplace?: boolean | undefined, action?: string | {
79
81
  type: string;
@@ -1,7 +0,0 @@
1
- import type { SelectionFeedbackType } from './selectionFeedback.types';
2
- interface SelectionFeedbackDisplayProps {
3
- readonly feedbackType: SelectionFeedbackType;
4
- readonly className?: string;
5
- }
6
- export declare const SelectionFeedbackDisplay: React.FC<SelectionFeedbackDisplayProps>;
7
- export {};
@@ -1 +0,0 @@
1
- export type SelectionFeedbackType = 'added' | 'removed' | 'addError' | 'removeError' | 'colorChanged' | 'colorChangeError';
@@ -1,9 +0,0 @@
1
- import { Guid } from '@equinor/echo-utils';
2
- import { SelectionGroup } from '../../selectionMenu/selectionTreeStore/selectionTree.store.types';
3
- interface SelectionGroupMenuItemProps {
4
- readonly group: SelectionGroup;
5
- readonly isItemInGroup: boolean;
6
- readonly onSelectionChanged: (groupId: Guid) => void;
7
- }
8
- export declare const SelectionGroupMenuItem: (props: SelectionGroupMenuItemProps) => import("react/jsx-runtime").JSX.Element;
9
- export {};
@@ -1,12 +0,0 @@
1
- import { Guid } from '@equinor/echo-utils';
2
- import { GlobalSelectionTypes } from '../../globalSelectionStore/globalSelectionStore.types';
3
- interface SelectionMenuTriggerProps {
4
- readonly itemId: GlobalSelectionTypes.ItemId;
5
- readonly onAddToSelection: (groupId: Guid) => void;
6
- readonly onRemoveFromSelection: (groupId: Guid) => void;
7
- readonly partOfListsText?: string;
8
- readonly isError?: boolean;
9
- readonly isLoading?: boolean;
10
- }
11
- export declare const SelectionMenuTrigger: (props: SelectionMenuTriggerProps) => import("react/jsx-runtime").JSX.Element;
12
- export {};
@@ -1,20 +0,0 @@
1
- interface LegendTextSelectorProps<T extends string> {
2
- options: ReadonlyArray<T>;
3
- selectedOption: T;
4
- onOptionSelected?: (option: T, e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
5
- }
6
- /**
7
- * LegendTextSelector renders a group of selectable buttons for legend text options.
8
- *
9
- * Displays each option as a button, highlights the currently selected option, and calls the `onSelect` callback when a different option is chosen.
10
- * Uses Echo UI components and compact density for consistent styling.
11
- *
12
- * @component
13
- * @param {object} props - Component props
14
- * @param {ReadonlyArray<string>} props.options - List of selectable options.
15
- * @param {string} props.selectedOption - The currently selected option.
16
- * @param {(option: string) => void} [props.onOptionSelected] - Callback invoked when a new option is selected.
17
- * @returns {JSX.Element | null} The rendered button group, or null if no options are provided.
18
- */
19
- export declare const LegendTextSelector: <T extends string>(props: LegendTextSelectorProps<T>) => import("react/jsx-runtime").JSX.Element | null;
20
- export {};
@@ -1,15 +0,0 @@
1
- /**
2
- * Renders the primary (first) row of the Work Order popover.
3
- *
4
- * Displays the work order number, an active/completed status label, and (if present)
5
- * a list of unique notification type identifiers resolved for the work order.
6
- *
7
- * @param props \- Component props.
8
- * @param props.workOrderId \- Work order identifier used for display and for fetching related objects.
9
- * @param props.isActive \- Whether the work order is active \(`true`\) or completed \(`false`\).
10
- * @returns A React element containing the primary row content.
11
- */
12
- export declare const WorkOrderPopoverPrimaryRow: ({ workOrderId, isActive }: {
13
- workOrderId: string;
14
- isActive: boolean;
15
- }) => import("react/jsx-runtime").JSX.Element;
@@ -1,16 +0,0 @@
1
- /**
2
- * Renders the 3rd row in the Work Order popover (plant, work center, and finish date).
3
- *
4
- * @param props \- Component props.
5
- * @param props.plantNo \- The plant identifier/number to display.
6
- * @param props.workCenter \- The work center identifier to display.
7
- * @param props.basicFinishDateTime \- Optional planned/basic finish date/time for the work order.
8
- * @param props.basicFinishDateStatus \- Optional status label associated with the finish date (e.g. overdue, upcoming).
9
- * @returns A React element containing the 3rd row content.
10
- */
11
- export declare const WorkOrderPopoverThirdRow: ({ plantNo, workCenter, basicFinishDateTime, basicFinishDateStatus }: {
12
- plantNo: string;
13
- workCenter: string;
14
- basicFinishDateTime: Date | undefined;
15
- basicFinishDateStatus: string | undefined;
16
- }) => import("react/jsx-runtime").JSX.Element;