@equinor/echo-framework 4.2.0 → 4.3.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 (69) hide show
  1. package/index.cjs.js +2 -2
  2. package/package.json +8 -8
  3. package/src/index.d.ts +3 -3
  4. package/src/lib/components/prepview/panels/objects/objects.logic.d.ts +7 -0
  5. package/src/lib/components/prepview/panels/objects/objects.utils.d.ts +14 -0
  6. package/src/lib/components/prepview/panels/objects/selectionActionBarMultiple/AddSelectionListWithSameNameDialog.d.ts +8 -0
  7. package/src/lib/components/prepview/panels/objects/selectionActionBarMultiple/SelectionActionBarMultiple.d.ts +9 -0
  8. package/src/lib/components/prepview/panels/objects/selectionActionBarMultiple/logic/selectionActionBarMultiple.colors.d.ts +2 -0
  9. package/src/lib/components/prepview/panels/objects/selectionActionBarMultiple/logic/selectionActionBarMultiple.constants.d.ts +1 -0
  10. package/src/lib/components/prepview/panels/objects/selectionActionBarMultiple/logic/selectionActionBarMultiple.orchestration.d.ts +10 -0
  11. package/src/lib/components/prepview/panels/objects/selectionActionBarMultiple/logic/selectionActionBarMultiple.utils.d.ts +3 -0
  12. package/src/lib/components/prepview/panels/tagDocumentRefs/HorizontalDocumentGroups.d.ts +1 -1
  13. package/src/lib/feature/globalSelection/components/selectionActionBar/SelectionActionBar.d.ts +12 -0
  14. package/src/lib/feature/globalSelection/components/selectionActionBar/SelectionActionBarMenuItem.d.ts +12 -0
  15. package/src/lib/feature/globalSelection/globalSelection.api.d.ts +3 -2
  16. package/src/lib/feature/globalSelection/globalSelectionColorService.d.ts +3 -3
  17. package/src/lib/feature/globalSelection/globalSelectionColorService.types.d.ts +1 -0
  18. package/src/lib/feature/globalSelection/hooks/useSelectionAction.d.ts +2 -2
  19. package/src/lib/feature/globalSelection/index.d.ts +2 -2
  20. package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/actions/addItems.action.d.ts +5 -4
  21. package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/actions/removeAllItemsById.action.d.ts +1 -1
  22. package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/actions/removeItemsById.action.d.ts +1 -1
  23. package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/actions/selectionTree.action.types.d.ts +5 -4
  24. package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/selectionTree.store.d.ts +11 -11
  25. package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/selectionTree.store.types.d.ts +4 -3
  26. package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/selectionTree.store.utils.d.ts +9 -7
  27. package/src/lib/feature/legend/components/BasicLegendRenderer.d.ts +1 -1
  28. package/src/lib/feature/legend/components/LegendSelectorContainer.d.ts +17 -0
  29. package/src/lib/feature/legend/components/pdfMarkers/subComponents/ItemMarkerPopoverContainer.d.ts +9 -0
  30. package/src/lib/feature/legend/components/popover/LegendPopoverContent.d.ts +9 -26
  31. package/src/lib/feature/legend/components/popover/LegendPopoverContent.logic.d.ts +12 -6
  32. package/src/lib/feature/legend/hooks/useGroupedMarkers.utils.d.ts +0 -4
  33. package/src/lib/feature/legend/hooks/useLegendMarker/useLegendMarker.utils.d.ts +1 -1
  34. package/src/lib/feature/legend/hooks/useLegendUniqueBadges.d.ts +1 -3
  35. package/src/lib/feature/legend/hooks/useLegendUniqueMarkers.d.ts +1 -3
  36. package/src/lib/feature/legend/index.d.ts +8 -5
  37. package/src/lib/feature/legend/legendStrategies/notificationStrategy/api/notificationsLegend.api.d.ts +7 -0
  38. package/src/lib/feature/legend/legendStrategies/notificationStrategy/components/NotificationPopover.d.ts +8 -0
  39. package/src/lib/feature/legend/legendStrategies/notificationStrategy/hooks/useNotificationMarkers.d.ts +6 -0
  40. package/src/lib/feature/legend/legendStrategies/notificationStrategy/hooks/useNotificationsByTagIds.d.ts +14 -0
  41. package/src/lib/feature/legend/legendStrategies/notificationStrategy/logic/getNotificationPopover.d.ts +12 -0
  42. package/src/lib/feature/legend/legendStrategies/notificationStrategy/logic/notificationLegend.logic.d.ts +12 -0
  43. package/src/lib/feature/legend/legendStrategies/notificationStrategy/notificationStrategy.types.d.ts +5 -0
  44. package/src/lib/feature/legend/legendStrategies/notificationStrategy/optionConfigs/notificationBadgeLegendOptionConfig.d.ts +6 -0
  45. package/src/lib/feature/legend/legendStrategies/notificationStrategy/optionConfigs/notificationMarkerLegendOptionConfig.d.ts +4 -0
  46. package/src/lib/feature/legend/legendStrategies/notificationStrategy/testing/createTestNotification.d.ts +2 -0
  47. package/src/lib/feature/legend/legendStrategies/notificationStrategy/utils/getColorForNotificationLegendStatus.d.ts +7 -0
  48. package/src/lib/feature/legend/legendStrategies/notificationStrategy/utils/getNotificationTitlesByPropertyName.d.ts +2 -0
  49. package/src/lib/feature/legend/legendStrategies/notificationStrategy/utils/notificationLegend.utils.d.ts +12 -0
  50. package/src/lib/feature/legend/logic/getColorForLegendStatus.d.ts +5 -0
  51. package/src/lib/feature/legend/logic/normalizeBadges.d.ts +25 -12
  52. package/src/lib/feature/legend/logic/propertyAccessor.utils.d.ts +36 -0
  53. package/src/lib/feature/legend/stores/initializeLegendInStores.d.ts +3 -4
  54. package/src/lib/feature/legend/stores/legendDataStore/legendStore.d.ts +0 -1
  55. package/src/lib/feature/legend/stores/legendUIStore/legendUIStore.types.d.ts +5 -5
  56. package/src/lib/feature/legend/types/legendStrategy.type.d.ts +6 -6
  57. package/src/lib/feature/legend/types/legendType.d.ts +26 -19
  58. package/src/lib/hooks/useOpenPdfFile.d.ts +12 -0
  59. package/src/lib/hooks/useScreenValues.d.ts +2 -2
  60. package/src/lib/services/dataLayerPanel/dataLayerPanel.store.d.ts +2 -0
  61. package/src/lib/feature/globalSelection/components/SelectionActionBar/SelectionFeedbackDisplay.d.ts +0 -7
  62. package/src/lib/feature/globalSelection/components/SelectionActionBar/selectionFeedback.types.d.ts +0 -1
  63. package/src/lib/feature/globalSelection/components/SelectionActionBar.d.ts +0 -7
  64. package/src/lib/feature/globalSelection/components/SelectionMenuTrigger/SelectionGroupMenuItem.d.ts +0 -9
  65. package/src/lib/feature/globalSelection/components/SelectionMenuTrigger/SelectionMenuTrigger.d.ts +0 -12
  66. package/src/lib/feature/legend/components/legendTextSelector/LegendTextSelector.d.ts +0 -20
  67. package/src/lib/feature/legend/legendStrategies/workOrderStrategy/components/WorkOrderPopoverPrimaryRow.d.ts +0 -15
  68. package/src/lib/feature/legend/legendStrategies/workOrderStrategy/components/WorkOrderPopoverThirdRow.d.ts +0 -16
  69. /package/src/lib/feature/globalSelection/components/{RemoveSelectionItemsConfirmDialog.d.ts → selectionActionBar/RemoveSelectionItemsConfirmDialog.d.ts} +0 -0
@@ -2,22 +2,25 @@ import './legendStrategies/notificationStrategy/notificationStrategy';
2
2
  import './legendStrategies/workOrderStrategy/WorkOrderLegend';
3
3
  export { getBadgeChips, getMarkerChips } from './components/basicLegendRenderer.logic';
4
4
  export { LegendList } from './components/LegendList';
5
- export { LegendTextSelector } from './components/legendTextSelector/LegendTextSelector';
5
+ export { LegendSelectorContainer } from './components/LegendSelectorContainer';
6
6
  export { PositionalItem } from './components/pdfMarkers/PositionalItem';
7
7
  export { MultipleMarkersByLegends } from './components/pdfMarkers/subComponents/MultipleMarkersByLegends';
8
8
  export { LegendPopoverContent } from './components/popover/LegendPopoverContent';
9
- export type { LegendPopoverContentProps, LegendPopoverTertiaryLabels } from './components/popover/LegendPopoverContent';
9
+ export type { LegendPopoverContentProps } from './components/popover/LegendPopoverContent';
10
10
  export { trackEventNewLegendAccordionToggled, trackEventNewLegendSelectedBadgeOptionChanged, trackEventNewLegendSelectedMarkerOptionChanged } from './legendAnalytics';
11
11
  export { legendFacade } from './legendFacade';
12
12
  export { getLegendStrategy } from './legendStrategies/legendCollections';
13
13
  export { legendSnapShot } from './stores/legendDataStore/legendStore';
14
14
  export type { Badge, Marker } from './types/legendMarkerBadge.type';
15
15
  export type { LegendStrategy } from './types/legendStrategy.type';
16
- export type { LegendId, LegendOptionConfig } from './types/legendType';
16
+ export type { LegendBadgeOptionConfig, LegendId, LegendMarkerOptionConfig, LegendOptionConfig, LegendOptionDisplayOption } from './types/legendType';
17
17
  export { useLegendUniqueBadges } from './hooks/useLegendUniqueBadges';
18
18
  export { useLegendUniqueMarkers } from './hooks/useLegendUniqueMarkers';
19
19
  export { useOpenWorkOrdersByTagNos } from './hooks/useWorkOrdersByTagNos';
20
20
  export { useWorkOrdersByTagsQuery } from './hooks/useWorkOrdersByTagsQuery';
21
- export { COUNT_MODE_KEYWORD } from './logic/normalizeBadges';
22
- export { useLegendVisibleDataStore } from './stores/legendVisibleDataStore/legendVisibleDataStore';
21
+ export { isCountMode, isIdMode, normalizeBadges } from './logic/normalizeBadges';
22
+ export { getColorForLegendStatus } from './logic/getColorForLegendStatus';
23
+ export { createArrayAccessor, createCountAccessor, createDateAccessor, createStringAccessor, getPropertyValues, toSingleTitle } from './logic/propertyAccessor.utils';
24
+ export type { PropertyAccessor } from './logic/propertyAccessor.utils';
23
25
  export { useLegendUIStore } from './stores/legendUIStore/legendUIStore';
26
+ export { useLegendVisibleDataStore } from './stores/legendVisibleDataStore/legendVisibleDataStore';
@@ -0,0 +1,7 @@
1
+ import { NotificationDto } from '@equinor/echo-search';
2
+ export declare function createFunctionalLocationList(tagNos: ReadonlyArray<string>, plantNo: string): ReadonlyArray<string>;
3
+ export interface RequestTagsNotifications {
4
+ readonly tagNos: ReadonlyArray<string>;
5
+ readonly instCode: string;
6
+ }
7
+ export declare function getOpenNotificationsForTagsApi({ instCode, tagNos }: RequestTagsNotifications): Promise<ReadonlyArray<NotificationDto>>;
@@ -0,0 +1,8 @@
1
+ import type { NotificationItemCardData } from '@equinor/echo-components';
2
+ import { type LegendDataId } from '../../../types/legendType';
3
+ interface NotificationPopoverProps {
4
+ legendDataId: LegendDataId;
5
+ notification: NotificationItemCardData;
6
+ }
7
+ export declare const NotificationPopover: (props: NotificationPopoverProps) => import("react/jsx-runtime").JSX.Element;
8
+ export {};
@@ -0,0 +1,6 @@
1
+ import type { Marker } from '../../../types/legendMarkerBadge.type';
2
+ import { type LegendDataId } from '../../../types/legendType';
3
+ /**
4
+ * Orchestrates fetching notifications for the given tag IDs and transforms them into markers for the notification legend.
5
+ */
6
+ export declare const useNotificationMarkers: (itemIds: ReadonlyArray<LegendDataId>) => ReadonlyArray<Marker>;
@@ -0,0 +1,14 @@
1
+ import { TagNo, type NotificationDto } from '@equinor/echo-search';
2
+ import { type LegendTagId } from '../../../types/legendType';
3
+ export interface TagNotificationGroup {
4
+ readonly tagId: TagNo;
5
+ readonly notifications: ReadonlyArray<NotificationDto>;
6
+ }
7
+ interface UseNotificationsByTagIdsResult {
8
+ readonly data: ReadonlyArray<TagNotificationGroup>;
9
+ readonly error: Error | undefined;
10
+ readonly isFetching: boolean;
11
+ }
12
+ export declare const useNotificationsByTagIds: (enabled: boolean, tagIds: ReadonlyArray<LegendTagId>) => UseNotificationsByTagIdsResult;
13
+ export declare const groupNotificationsByTagId: (notifications: ReadonlyArray<NotificationDto>) => ReadonlyArray<TagNotificationGroup>;
14
+ export {};
@@ -0,0 +1,12 @@
1
+ import { type NotificationItemCardData } from '@equinor/echo-components';
2
+ import type { NotificationDetails } from '@equinor/echo-search';
3
+ import { Explicit } from '@equinor/echo-utils';
4
+ import { type LegendDataId, type LegendNotificationId } from '../../../types/legendType';
5
+ /**
6
+ * Notification is not a selection-based legend, so the dataId is not directly tied to global selection item IDs.
7
+ * Instead, we define a specific type for notification legend data IDs (LegendNotificationId) and use a type guard (isNotificationDataId) to identify them.
8
+ * This allows us to safely handle notification data IDs without relying on global selection structures.
9
+ */
10
+ export declare const isNotificationDataId: (dataId: LegendDataId) => dataId is LegendNotificationId;
11
+ export declare const getPopoverContent: (_legendDataId: LegendDataId, itemIds: ReadonlyArray<LegendDataId>) => Promise<JSX.Element[]>;
12
+ export declare const mapNotificationToNotificationItemCard: (notification: NotificationDetails) => Explicit<NotificationItemCardData>;
@@ -0,0 +1,12 @@
1
+ import { NotificationDto } from '@equinor/echo-search';
2
+ import type { Badge, Marker } from '../../../types/legendMarkerBadge.type';
3
+ import type { LegendBadgeOptionConfig, LegendMarkerOptionConfig } from '../../../types/legendType';
4
+ interface CreateMarkerFromNotificationsArgs {
5
+ readonly notifications: ReadonlyArray<NotificationDto>;
6
+ readonly selectedMarkerOption: LegendMarkerOptionConfig;
7
+ readonly selectedBadgeOption: LegendBadgeOptionConfig;
8
+ }
9
+ export declare const createMarkerFromNotifications: ({ notifications, selectedMarkerOption, selectedBadgeOption }: CreateMarkerFromNotificationsArgs) => Marker;
10
+ export declare const createMarkerTitle: (notifications: ReadonlyArray<NotificationDto>, selectedMarkerOption: LegendMarkerOptionConfig) => string;
11
+ export declare const createBadges: (notifications: ReadonlyArray<NotificationDto>, selectedBadgeOption: LegendBadgeOptionConfig) => ReadonlyArray<Badge>;
12
+ export {};
@@ -0,0 +1,5 @@
1
+ import type { LegendStatus } from '../../../legacyLegend/legend';
2
+ import type { NotificationBadgeOptions } from './optionConfigs/notificationBadgeLegendOptionConfig';
3
+ import type { NotificationMarkerOptions } from './optionConfigs/notificationMarkerLegendOptionConfig';
4
+ export type AllNotificationPropertyOptions = NotificationMarkerOptions | NotificationBadgeOptions;
5
+ export type EndDateStatusText = 'Expired' | '0-7 days' | '8 days - 1 month' | '1-3 months' | '3-6 months' | '6-12 months' | '> 1 year' | LegendStatus.Unknown;
@@ -0,0 +1,6 @@
1
+ import { NotificationDto } from '@equinor/echo-search';
2
+ import { LegendBadgeOptionConfig } from '../../../types/legendType';
3
+ type KeysFromNotificationDto = Pick<NotificationDto, 'maintenanceRecordId' | 'recordTypeId'>;
4
+ export type NotificationBadgeOptions = keyof KeysFromNotificationDto | 'count';
5
+ export declare const NOTIFICATION_LEGEND_BADGE_OPTIONS: ReadonlyArray<LegendBadgeOptionConfig<NotificationBadgeOptions>>;
6
+ export {};
@@ -0,0 +1,4 @@
1
+ import { NotificationDto } from '@equinor/echo-search';
2
+ import { type LegendMarkerOptionConfig } from '../../../types/legendType';
3
+ export type NotificationMarkerOptions = keyof Pick<NotificationDto, 'activeStatusIds' | 'requiredEndDateTime' | 'recordTypeId'>;
4
+ export declare const NOTIFICATION_LEGEND_MARKER_OPTIONS: ReadonlyArray<LegendMarkerOptionConfig<NotificationMarkerOptions>>;
@@ -0,0 +1,2 @@
1
+ import type { NotificationDto } from '@equinor/echo-search';
2
+ export declare const createTestNotification: (overrides?: Partial<NotificationDto>) => NotificationDto;
@@ -0,0 +1,7 @@
1
+ import type { LegendOptionConfig } from '../../../types/legendType';
2
+ /**
3
+ * Determines the appropriate color for a notification legend item based on its title and the selected property.
4
+ * It uses a predefined color mapping for specific notification properties,
5
+ * and falls back to a general status color if no specific mapping is found.
6
+ */
7
+ export declare const getColorForNotificationLegendStatus: (title: string, selectedProperty: LegendOptionConfig) => string;
@@ -0,0 +1,2 @@
1
+ import { NotificationDto } from '@equinor/echo-search';
2
+ export declare function getNotificationTitlesByPropertyName(propertyName: string, notification: NotificationDto, notifications: ReadonlyArray<NotificationDto>): ReadonlyArray<string>;
@@ -0,0 +1,12 @@
1
+ import { NotificationDto } from '@equinor/echo-search';
2
+ import type { EndDateStatusText } from '../notificationStrategy.types';
3
+ /**
4
+ * Determines the appropriate icon name for a marker based on the record types of the provided notifications.
5
+ * If there are multiple record types or no notifications, it returns a generic icon.
6
+ * Otherwise, it returns a specific icon based on the record type.
7
+ */
8
+ export declare const getIconForMarker: (notifications: ReadonlyArray<NotificationDto>) => string;
9
+ /**
10
+ * Returns user-friendly end date status text based on the required end date of a notification.
11
+ */
12
+ export declare function getEndDateStatusText(date: Date | undefined): EndDateStatusText;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Wrapper for pre-existing legend status colors, to avoid importing legacy utils into new legend code.
3
+ * Also handles new 'Unknown' and 'Multiple' statuses correctly, which legacy utils do not.
4
+ */
5
+ export declare const getColorForLegendStatus: (status: string) => string;
@@ -1,17 +1,19 @@
1
1
  import { Badge } from '../types/legendMarkerBadge.type';
2
+ import { type LegendOptionDisplayOption } from '../types/legendType';
2
3
  /**
3
- * Keyword used to identify count mode in badge text options. This changes
4
- * the way we normalize badges.
4
+ * Determines if count mode should be enabled based on badge text option.
5
+ *
6
+ * @param badgeDisplayOption - Badge text configuration option from legend state
7
+ * @returns Whether count mode should be enabled
5
8
  */
6
- export declare const COUNT_MODE_KEYWORD = "Count";
9
+ export declare function isCountMode(badgeDisplayOption?: LegendOptionDisplayOption): boolean;
7
10
  /**
8
- * Determines if count mode should be enabled based on badge text options.
9
- * Count mode is enabled when any option value exactly equals 'Count'.
11
+ * Determines if ID mode should be enabled based on badge display option.
10
12
  *
11
- * @param badgeTextOptions - Badge text configuration options from legend state
12
- * @returns Whether count mode should be enabled
13
+ * @param badgeDisplayOption - Badge text configuration option from legend state
14
+ * @returns Whether ID mode should be enabled
13
15
  */
14
- export declare function isCountMode(badgeTextOptions: Record<string, string> | undefined): boolean;
16
+ export declare function isIdMode(badgeDisplayOption?: LegendOptionDisplayOption): boolean;
15
17
  /**
16
18
  * Creates badges with count displayed as title.
17
19
  * Takes all badges (including duplicates) and unique badges, and returns unique badges
@@ -23,11 +25,22 @@ export declare function isCountMode(badgeTextOptions: Record<string, string> | u
23
25
  */
24
26
  export declare function createBadgesWithCount(allBadges: ReadonlyArray<Badge>, uniqueBadges: ReadonlyArray<Badge>): Badge[];
25
27
  /**
26
- * Normalizes badges for display by removing duplicates and optionally applying count mode.
27
- * Count mode is determined from the badge text options configuration.
28
+ * Creates badges with their item's ID displayed as title.
29
+ * Each badge's title is replaced with the primary identifier from its itemId.
30
+ *
31
+ * @param badges - Array of badges to transform
32
+ * @returns Array of badges with item ID as title
33
+ */
34
+ export declare function createBadgesWithId(badges: ReadonlyArray<Badge>): Badge[];
35
+ /**
36
+ * Normalizes badges for display by removing duplicates and applying display mode transformations.
37
+ * Supports three display modes:
38
+ * - 'displayName' (default): Shows the original badge title
39
+ * - 'id': Shows the item's primary identifier (tagNo, equipmentId, workOrderId)
40
+ * - 'count': Shows the count of badges with the same title
28
41
  *
29
42
  * @param badges - Array of badges to normalize
30
- * @param badgeTextOptions - Badge text configuration options from legend state
43
+ * @param badgeDisplayOption - Badge display option from legend state ('displayName' | 'id' | 'count')
31
44
  * @returns Normalized array of badges
32
45
  */
33
- export declare function normalizeBadges(badges: ReadonlyArray<Badge>, badgeTextOptions: Record<string, string> | undefined): Badge[];
46
+ export declare function normalizeBadges(badges: ReadonlyArray<Badge>, badgeDisplayOption?: LegendOptionDisplayOption): Badge[];
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Property accessor function type that returns all values as an array.
3
+ * Takes an item and optional context (like a collection) and returns string values.
4
+ */
5
+ export type PropertyAccessor<TItem, TContext = ReadonlyArray<TItem>> = (item: TItem, context: TContext) => ReadonlyArray<string>;
6
+ /**
7
+ * Creates an accessor that extracts a string property value as a single-element array.
8
+ * Returns empty array if the value is empty or not a string.
9
+ */
10
+ export declare function createStringAccessor<TItem>(property: keyof TItem): PropertyAccessor<TItem, ReadonlyArray<TItem>>;
11
+ /**
12
+ * Creates an accessor that returns all elements from an array property.
13
+ * Returns empty array if the property is not an array.
14
+ */
15
+ export declare function createArrayAccessor<TItem>(property: keyof TItem): PropertyAccessor<TItem, ReadonlyArray<TItem>>;
16
+ /**
17
+ * Creates an accessor that converts a Date property to ISO string as a single-element array.
18
+ * Returns empty array if the value is not a Date.
19
+ */
20
+ export declare function createDateAccessor<TItem>(property: keyof TItem): PropertyAccessor<TItem, ReadonlyArray<TItem>>;
21
+ /**
22
+ * Creates a count accessor that returns the size of the context collection.
23
+ */
24
+ export declare function createCountAccessor<TItem>(): PropertyAccessor<TItem, ReadonlyArray<TItem>>;
25
+ /**
26
+ * Looks up property values using a map of accessors.
27
+ * Returns empty array if the property is not found in the accessor map.
28
+ */
29
+ export declare function getPropertyValues<TItem, TContext = ReadonlyArray<TItem>>(item: TItem, propertyName: string, context: TContext, accessors: Readonly<Record<string, PropertyAccessor<TItem, TContext>>>): ReadonlyArray<string>;
30
+ /**
31
+ * Normalizes an array of values to a single display title:
32
+ * - Empty array → "Unknown"
33
+ * - Single unique value → that value
34
+ * - Multiple unique values → "Multiple"
35
+ */
36
+ export declare function toSingleTitle(values: ReadonlyArray<string>): string;
@@ -1,10 +1,9 @@
1
1
  import type { LegendStrategy } from '../types/legendStrategy.type';
2
- import type { LegendOptionConfig } from '../types/legendType';
2
+ import type { LegendBadgeOptionConfig, LegendMarkerOptionConfig } from '../types/legendType';
3
3
  export interface InitialValues {
4
4
  readonly isEnabled?: boolean;
5
- readonly selectedMarkerOption?: LegendOptionConfig;
6
- readonly selectedBadgeOption?: LegendOptionConfig;
7
- readonly selectedBadgeTextOptions?: Record<string, string>;
5
+ readonly selectedMarkerOption?: LegendMarkerOptionConfig;
6
+ readonly selectedBadgeOption?: LegendBadgeOptionConfig;
8
7
  }
9
8
  /**
10
9
  * Ensures that a legend exists in all relevant stores. If the legend already exists,
@@ -11,7 +11,6 @@ export interface LegendStoreActions {
11
11
  setIsEnabled: (legendId: LegendId, isEnabled: boolean) => void;
12
12
  setSelectedMarkerOption: (legendId: LegendId, option: LegendState['selectedMarkerOption']) => void;
13
13
  setSelectedBadgeOption: (legendId: LegendId, option: LegendState['selectedBadgeOption']) => void;
14
- setSelectedBadgeTextOptions: (legendId: LegendId, options: LegendState['selectedBadgeTextOptions']) => void;
15
14
  }
16
15
  type LegendStore = LegendStoreData & LegendStoreActions;
17
16
  /**
@@ -1,7 +1,7 @@
1
- import type { SelectionFeedbackType } from '../../../globalSelection/components/SelectionActionBar/selectionFeedback.types';
1
+ import type { SelectionBarFeedbackType } from '@equinor/echo-components';
2
2
  import { MarkerId } from '../../components/pdfMarkers/utils/markerId.utils';
3
3
  import { LegendId } from '../../types/legendType';
4
- export type { SelectionFeedbackType };
4
+ export type { SelectionBarFeedbackType } from '@equinor/echo-components';
5
5
  export type LegendFeedbackVariant = 'error' | 'info' | 'warning';
6
6
  export interface LegendUIState {
7
7
  readonly accordionFeedback?: {
@@ -13,7 +13,7 @@ export interface LegendUIState {
13
13
  readonly hiddenBadges: string[];
14
14
  }
15
15
  export type LegendUIDictionary = Record<LegendId, LegendUIState>;
16
- export type MarkersOutsideSelectionVisibility = 'Show' | 'Ghost' | 'Hide';
16
+ export type MarkersOutsideSelectionVisibility = 'show' | 'ghost' | 'hide';
17
17
  export type LegendUIStoreValues = {
18
18
  readonly legends: LegendUIDictionary;
19
19
  readonly activePopover: {
@@ -21,7 +21,7 @@ export type LegendUIStoreValues = {
21
21
  readonly elements: ReadonlyArray<React.ReactElement>;
22
22
  readonly selectionFeedback?: {
23
23
  readonly isLoading: boolean;
24
- readonly feedbackType: SelectionFeedbackType | null;
24
+ readonly feedbackType: SelectionBarFeedbackType | null;
25
25
  };
26
26
  };
27
27
  readonly selectionLegend: {
@@ -54,7 +54,7 @@ export interface LegendUIStoreActions {
54
54
  setActivePopoverElements: (elements: ReadonlyArray<React.ReactElement>) => void;
55
55
  setPopoverSelectionFeedback: (feedback: {
56
56
  isLoading: boolean;
57
- feedbackType: SelectionFeedbackType | null;
57
+ feedbackType: SelectionBarFeedbackType | null;
58
58
  } | undefined) => void;
59
59
  setShouldDelayPopoverUpdate: (delay: boolean) => void;
60
60
  setAccordionFeedback: (legendId: LegendId, feedback: {
@@ -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,7 +0,0 @@
1
- import { GlobalSelectionTypes } from '../globalSelectionStore/globalSelectionStore.types';
2
- export interface SelectionActionBarProps {
3
- readonly itemId: GlobalSelectionTypes.ItemId;
4
- readonly className?: string;
5
- readonly showPopoverUpdateDelay?: boolean;
6
- }
7
- export declare const SelectionActionBar: React.FC<SelectionActionBarProps>;
@@ -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;