@equinor/echo-framework 2.2.0 → 2.2.2
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/index.cjs.js +3 -3
- package/package.json +11 -10
- package/src/lib/components/contextualAppLinks/index.d.ts +1 -1
- package/src/lib/feature/globalSelection/globalSelectionColorService.d.ts +1 -1
- package/src/lib/feature/globalSelection/index.d.ts +1 -0
- package/src/lib/feature/legend/components/pdfMarkers/subComponents/LegendColoredMarkerIcon.d.ts +24 -4
- package/src/lib/feature/legend/components/pdfMarkers/subComponents/MultipleMarkersByLegends.d.ts +3 -26
- package/src/lib/feature/legend/components/pdfMarkers/subComponents/MultipleMarkersBySingleLegend.d.ts +10 -0
- package/src/lib/feature/legend/components/pdfMarkers/subComponents/hooks/usePopoverHandler.d.ts +1 -1
- package/src/lib/feature/legend/components/pdfMarkers/subComponents/hooks/usePopoverHandler.types.d.ts +14 -0
- package/src/lib/feature/legend/components/pdfMarkers/utils/splitMarkerByBadgeSelectionGroup.d.ts +22 -0
- package/src/lib/feature/legend/components/pdfMarkers/utils/splitMarkerByBadgeSelectionGroup.types.d.ts +19 -0
- package/src/lib/feature/legend/components/selectionLegend/SelectionLegend.d.ts +1 -0
- package/src/lib/feature/legend/components/selectionLegend/SelectionLegendChip.d.ts +7 -0
- package/src/lib/feature/legend/components/selectionLegend/hooks/useIsSelectionLegendVisible.d.ts +6 -0
- package/src/lib/feature/legend/components/selectionLegend/selectionLegend.utils.d.ts +34 -0
- package/src/lib/feature/legend/components/selectionLegend/useAllGroupedMarkersForLegends.d.ts +4 -0
- package/src/lib/feature/legend/hooks/useGroupedMarkers.d.ts +16 -0
- package/src/lib/feature/legend/hooks/useLegendMarker/useLegendMarker.d.ts +10 -0
- package/src/lib/feature/legend/hooks/useLegendMarker/useLegendMarker.utils.d.ts +21 -0
- package/src/lib/feature/legend/hooks/useLegendUniqueBadges.d.ts +9 -0
- package/src/lib/feature/legend/hooks/useLegendUniqueMarkers.d.ts +9 -0
- package/src/lib/feature/legend/index.d.ts +3 -1
- package/src/lib/feature/legend/logic/normalizeBadges.d.ts +33 -0
- package/src/lib/feature/legend/types/legendMarkerBadge.type.d.ts +6 -6
- package/src/lib/feature/legend/types/legendStrategy.type.d.ts +7 -2
- package/src/lib/feature/legend/hooks/useLegendMarkers.d.ts +0 -19
- /package/src/lib/components/contextualAppLinks/{externalAppsMenu.d.ts → ExternalAppsMenu.d.ts} +0 -0
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@equinor/echo-framework",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.2",
|
|
4
4
|
"peerDependencies": {
|
|
5
|
-
"@equinor/echo-base": ">= 2.2.
|
|
6
|
-
"@equinor/echo-components": ">= 2.2.
|
|
7
|
-
"@equinor/echo-core": ">= 2.2.
|
|
8
|
-
"@equinor/echo-search": ">= 2.2.
|
|
9
|
-
"@equinor/echo-utils": ">= 2.2.
|
|
5
|
+
"@equinor/echo-base": ">= 2.2.1 < 3.0.0",
|
|
6
|
+
"@equinor/echo-components": ">= 2.2.2 < 3.0.0",
|
|
7
|
+
"@equinor/echo-core": ">= 2.2.1 < 3.0.0",
|
|
8
|
+
"@equinor/echo-search": ">= 2.2.2 < 3.0.0",
|
|
9
|
+
"@equinor/echo-utils": ">= 2.2.2 < 3.0.0",
|
|
10
10
|
"@equinor/eds-core-react": "0.49.0",
|
|
11
11
|
"@equinor/eds-icons": "0.22.0",
|
|
12
12
|
"react": ">= 17.0.2",
|
|
@@ -18,14 +18,15 @@
|
|
|
18
18
|
"lodash": "4.17.21",
|
|
19
19
|
"react-router-dom": "5.3.4",
|
|
20
20
|
"zustand": ">= 4.4.7 < 5",
|
|
21
|
-
"immer": "10.1.3"
|
|
21
|
+
"immer": "10.1.3",
|
|
22
|
+
"msw": "2.11.6"
|
|
22
23
|
},
|
|
23
24
|
"dependencies": {
|
|
24
25
|
"dexie": "4.2.1",
|
|
25
26
|
"mark.js": "8.11.1",
|
|
26
|
-
"ag-charts-community": "12.
|
|
27
|
-
"ag-charts-react": "12.
|
|
28
|
-
"ag-charts-enterprise": "12.
|
|
27
|
+
"ag-charts-community": "12.3.1",
|
|
28
|
+
"ag-charts-react": "12.3.1",
|
|
29
|
+
"ag-charts-enterprise": "12.3.1"
|
|
29
30
|
},
|
|
30
31
|
"main": "./index.cjs.js",
|
|
31
32
|
"type": "commonjs",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import LinksWrapper from './contextualAppLinks';
|
|
2
|
-
import { ExternalAppsMenu } from './
|
|
2
|
+
import { ExternalAppsMenu } from './ExternalAppsMenu';
|
|
3
3
|
import { AllExternalLinks } from './externalLinkButtons/allExternalLinks';
|
|
4
4
|
import { InternalAppLinks } from './internalAppLinks';
|
|
5
5
|
import { LinkButton } from './linkButton';
|
|
@@ -48,7 +48,7 @@ export { UNIFIED_COLOR_POOL };
|
|
|
48
48
|
* Returns the color associated with a given `GlobalSelectionItemType`.
|
|
49
49
|
*
|
|
50
50
|
* This function maps specific item types to their corresponding selection colors,
|
|
51
|
-
* as defined in the `echoPrimitives.
|
|
51
|
+
* as defined in the `echoPrimitives.miscSelectionSelectioncolor*` constants.
|
|
52
52
|
* If the provided `itemType` does not match any known type, a default color (`#FF6F00`) is returned.
|
|
53
53
|
*
|
|
54
54
|
* @param itemType - The type of the global selection item for which to retrieve the color.
|
|
@@ -8,6 +8,7 @@ export { useGlobalSelectionItemsByType } from './hooks/useGlobalSelectionItemsBy
|
|
|
8
8
|
export { useGlobalSelectionLists } from './hooks/useGlobalSelectionLists';
|
|
9
9
|
export { useGlobalSelectionTags } from './hooks/useGlobalSelectionTags';
|
|
10
10
|
export { useGlobalSelectionWorkOrders } from './hooks/useGlobalSelectionWorkOrders';
|
|
11
|
+
export { useIsInGlobalSelection } from './hooks/useIsInGlobalSelection';
|
|
11
12
|
export { useSelectionCategoriesByGroupId } from './hooks/useSelectionCategoriesByGroupId';
|
|
12
13
|
export { useCurrentSelectionId } from './selectionMenu/hooks/useCurrentSelectionId';
|
|
13
14
|
export { useFetchSelectionHistory } from './selectionMenu/hooks/useFetchSelectionHistory';
|
package/src/lib/feature/legend/components/pdfMarkers/subComponents/LegendColoredMarkerIcon.d.ts
CHANGED
|
@@ -1,13 +1,33 @@
|
|
|
1
1
|
import { ItemMarkerSize } from '@equinor/echo-components';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { Marker } from '../../../types/legendMarkerBadge.type';
|
|
4
4
|
interface LegendColoredMarkerIconProps {
|
|
5
|
-
legendId: LegendId;
|
|
6
|
-
itemId: LegendDataId;
|
|
7
5
|
hasPointer: boolean;
|
|
8
6
|
isActive: boolean;
|
|
9
7
|
onClick: () => void;
|
|
8
|
+
hiddenBadges: string[];
|
|
9
|
+
marker: Marker;
|
|
10
10
|
}
|
|
11
|
-
|
|
11
|
+
/**
|
|
12
|
+
* Renders a colored marker icon with optional pointer and badges.
|
|
13
|
+
*
|
|
14
|
+
* @param {boolean} hasPointer - Flag to indicate if the marker should have a pointer, currently in lower right corner.
|
|
15
|
+
* @param {boolean} isActive - Flag to indicate if the marker is active (selected).
|
|
16
|
+
* @param {() => void} onClick - Callback invoked when the marker is clicked.
|
|
17
|
+
* @param {string[]} hiddenBadges - Array of badge titles that should be hidden.
|
|
18
|
+
* @param {Marker} marker - The marker data to be rendered.
|
|
19
|
+
*
|
|
20
|
+
* @returns {JSX.Element | null} The rendered colored marker icon or null if no marker is provided.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* <LegendColoredMarkerIcon
|
|
24
|
+
* hasPointer={true}
|
|
25
|
+
* isActive={false}
|
|
26
|
+
* onClick={() => console.log('Marker clicked')}
|
|
27
|
+
* hiddenBadges={['Badge1', 'Badge2']}
|
|
28
|
+
* marker={markerData}
|
|
29
|
+
* />
|
|
30
|
+
*/
|
|
31
|
+
export declare const LegendColoredMarkerIcon: React.FC<LegendColoredMarkerIconProps>;
|
|
12
32
|
export declare const MARKER_ICON_WIDTH = ItemMarkerSize.Default;
|
|
13
33
|
export {};
|
package/src/lib/feature/legend/components/pdfMarkers/subComponents/MultipleMarkersByLegends.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import { LegendDataId } from '../../../types/legendType';
|
|
2
|
+
import { PopoverContent, RequestPopoverHandler } from './hooks/usePopoverHandler.types';
|
|
3
3
|
interface MultipleMarkersByLegendsProps {
|
|
4
4
|
itemId: LegendDataId;
|
|
5
5
|
hasPointer: boolean;
|
|
@@ -8,28 +8,5 @@ interface MultipleMarkersByLegendsProps {
|
|
|
8
8
|
currentPopover?: PopoverContent;
|
|
9
9
|
positionString: string;
|
|
10
10
|
}
|
|
11
|
-
export
|
|
12
|
-
export interface PopoverContent {
|
|
13
|
-
elements: ReadonlyArray<JSX.Element>;
|
|
14
|
-
activeItem: ActiveItem;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* We use active for the icon. Several icons might be active if they have the same tagNo on the PDF, but only 1 of them is open.
|
|
18
|
-
*/
|
|
19
|
-
interface ActiveItem {
|
|
20
|
-
itemId: LegendDataId;
|
|
21
|
-
legendId: LegendId;
|
|
22
|
-
positionString: string;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Renders 1 marker for each legend.
|
|
26
|
-
*
|
|
27
|
-
* @param {LegendDataId} itemId - The ID of the legend item.
|
|
28
|
-
* @param {boolean} hasPointer - Flag to indicate if the marker should have a pointer, currently in lower right corner.
|
|
29
|
-
* @param {RequestPopoverHandler} onOpenPopover - Callback invoked when a marker is clicked; fetchPopoverContent should be called to fetch/populate the popover.
|
|
30
|
-
* @param {() => void} onClosePopover - Callback invoked to close the popover
|
|
31
|
-
* @param {(value: PopoverContent | undefined) => void} setOpenItem - Callback function to handle opening the popover.
|
|
32
|
-
*/
|
|
33
|
-
export declare const MultipleMarkersByLegendsComponent: React.FC<MultipleMarkersByLegendsProps>;
|
|
34
|
-
export declare const MultipleMarkersByLegends: React.NamedExoticComponent<MultipleMarkersByLegendsProps>;
|
|
11
|
+
export declare const MultipleMarkersByLegends: import("react").MemoExoticComponent<(props: MultipleMarkersByLegendsProps) => import("react/jsx-runtime").JSX.Element>;
|
|
35
12
|
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { LegendDataId, LegendId } from '../../../types/legendType';
|
|
2
|
+
interface MultipleMarkersBySingleLegendComponentProps {
|
|
3
|
+
legendId: LegendId;
|
|
4
|
+
itemId: LegendDataId;
|
|
5
|
+
hasPointer: boolean;
|
|
6
|
+
isActive: boolean;
|
|
7
|
+
onClick: () => void;
|
|
8
|
+
}
|
|
9
|
+
export declare const MultipleMarkersBySingleLegend: import("react").MemoExoticComponent<(props: MultipleMarkersBySingleLegendComponentProps) => import("react/jsx-runtime").JSX.Element[] | null>;
|
|
10
|
+
export {};
|
package/src/lib/feature/legend/components/pdfMarkers/subComponents/hooks/usePopoverHandler.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LegendDataId, LegendId } from '../../../../types/legendType';
|
|
2
|
-
import { PopoverContent } from '
|
|
2
|
+
import { PopoverContent } from './usePopoverHandler.types';
|
|
3
3
|
export declare function usePopoverHandler(): {
|
|
4
4
|
currentPopover: PopoverContent | undefined;
|
|
5
5
|
handleOpenPopover: (itemId: LegendDataId, legendId: LegendId, positionString: string, fetchPopoverContent: () => Promise<ReadonlyArray<React.JSX.Element>>) => Promise<void>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { LegendDataId, LegendId } from '../../../../types/legendType';
|
|
2
|
+
export type RequestPopoverHandler = (itemId: LegendDataId, legendId: LegendId, positionString: string, fetchPopoverContent: () => Promise<ReadonlyArray<React.JSX.Element>>) => void;
|
|
3
|
+
export interface PopoverContent {
|
|
4
|
+
elements: ReadonlyArray<JSX.Element>;
|
|
5
|
+
activeItem: ActiveItem;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* We use active for the icon. Several icons might be active if they have the same tagNo on the PDF, but only 1 of them is open.
|
|
9
|
+
*/
|
|
10
|
+
export interface ActiveItem {
|
|
11
|
+
itemId: LegendDataId;
|
|
12
|
+
legendId: LegendId;
|
|
13
|
+
positionString: string;
|
|
14
|
+
}
|
package/src/lib/feature/legend/components/pdfMarkers/utils/splitMarkerByBadgeSelectionGroup.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { SelectionGroup } from '../../../../globalSelection';
|
|
2
|
+
import { Marker } from '../../../types/legendMarkerBadge.type';
|
|
3
|
+
import { GroupedMarker } from './splitMarkerByBadgeSelectionGroup.types';
|
|
4
|
+
/**
|
|
5
|
+
* Splits a marker into multiple variants based on badge selection groups.
|
|
6
|
+
*
|
|
7
|
+
* Each variant represents a selection group and contains only badges from that group.
|
|
8
|
+
*
|
|
9
|
+
* Example: Marker with 3 equipment badges at Tag1 position:
|
|
10
|
+
* - Badge A (in SelectionGroupRed)
|
|
11
|
+
* - Badge B (in SelectionGroupRed)
|
|
12
|
+
* - Badge C (in SelectionGroupBlue)
|
|
13
|
+
*
|
|
14
|
+
* Returns 2 marker variants:
|
|
15
|
+
* - Marker variant 1: Badges [A, B], red highlight
|
|
16
|
+
* - Marker variant 2: Badge [C], blue highlight
|
|
17
|
+
*
|
|
18
|
+
* @param marker - The marker to split by badge selection groups
|
|
19
|
+
* @param selectionGroups - Global selection groups
|
|
20
|
+
* @returns Array of marker variants (one per selection group found in badges)
|
|
21
|
+
*/
|
|
22
|
+
export declare function splitMarkerByBadgeSelectionGroup(selectionGroups: SelectionGroup[], marker?: Marker): GroupedMarker[];
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Guid } from '@equinor/echo-utils';
|
|
2
|
+
import { Badge, Marker } from '../../../types/legendMarkerBadge.type';
|
|
3
|
+
export interface GroupKey {
|
|
4
|
+
/** Helper to get the full string representation of the group key based on groupId and color */
|
|
5
|
+
toString: () => string;
|
|
6
|
+
groupId: Guid;
|
|
7
|
+
color: string;
|
|
8
|
+
}
|
|
9
|
+
export interface BadgeGroup {
|
|
10
|
+
groupKey: GroupKey;
|
|
11
|
+
highlightColor: string;
|
|
12
|
+
badges: Badge[];
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Markers that has been processed based on Selection Groups will have a group key.
|
|
16
|
+
*/
|
|
17
|
+
export interface GroupedMarker extends Marker {
|
|
18
|
+
getGroupKey: () => GroupKey;
|
|
19
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const SelectionLegendRenderer: import("react").MemoExoticComponent<() => import("react/jsx-runtime").JSX.Element>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
interface LegendItemProps {
|
|
2
|
+
label: string;
|
|
3
|
+
backgroundColor?: string;
|
|
4
|
+
onClick: (isDisabled: boolean) => void;
|
|
5
|
+
}
|
|
6
|
+
export declare const SelectionLegendChip: import("react").MemoExoticComponent<(props: LegendItemProps) => import("react/jsx-runtime").JSX.Element>;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Guid } from '@equinor/echo-utils';
|
|
2
|
+
import { GlobalSelectionTypes, SelectionGroup } from '../../../globalSelection';
|
|
3
|
+
import { GroupKey } from '../pdfMarkers/utils/splitMarkerByBadgeSelectionGroup.types';
|
|
4
|
+
/**
|
|
5
|
+
* TODO: Remove this flag when Selection Legend is stable and ready for production
|
|
6
|
+
* Flag to enable/disable Selection Legend feature
|
|
7
|
+
*/
|
|
8
|
+
export declare const isSelectionLegendEnabled: () => boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Key used for badges that don't belong to any selection group
|
|
11
|
+
*/
|
|
12
|
+
export declare const NOT_IN_SELECTION_GROUP_KEY: GroupKey;
|
|
13
|
+
/**
|
|
14
|
+
* Extracts all item IDs from selection group categories
|
|
15
|
+
*/
|
|
16
|
+
export declare const extractSelectionGroupItemIds: (selectionGroup: SelectionGroup) => GlobalSelectionTypes.ItemId[];
|
|
17
|
+
/**
|
|
18
|
+
* Gets the most frequently used color for a selection group
|
|
19
|
+
*/
|
|
20
|
+
export declare const getSelectionGroupMostUsedColor: (selectionGroup: SelectionGroup, allGroups: SelectionGroup[]) => string | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* Creates a standardized group key for a selection group.
|
|
23
|
+
* This key is used across the legend system to:
|
|
24
|
+
* - Identify marker variants split by selection groups (viewport)
|
|
25
|
+
* - Toggle visibility of selection groups (SelectionLegendRenderer)
|
|
26
|
+
* - Filter hidden selection groups (groupMarkersBySelection)
|
|
27
|
+
*
|
|
28
|
+
* Format as string: `group_${groupId}_${color}`
|
|
29
|
+
*
|
|
30
|
+
* @param groupId - The unique identifier of the selection group
|
|
31
|
+
* @param color - The highlight color for the group
|
|
32
|
+
* @returns The standardized group key
|
|
33
|
+
*/
|
|
34
|
+
export declare const createSelectionGroupKey: (groupId: Guid, color: string) => GroupKey;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { GroupedMarker } from '../components/pdfMarkers/utils/splitMarkerByBadgeSelectionGroup.types';
|
|
2
|
+
import { Marker } from '../types/legendMarkerBadge.type';
|
|
3
|
+
import { LegendId } from '../types/legendType';
|
|
4
|
+
/**
|
|
5
|
+
* Will process markers and group them based on groups in Selection.
|
|
6
|
+
* This also adds additional logic for counting badges where this is needed.
|
|
7
|
+
* @param legendId
|
|
8
|
+
* @param markers
|
|
9
|
+
* @param includeHiddenMarkers If enabled hidden markers will also be returned
|
|
10
|
+
* @returns
|
|
11
|
+
*/
|
|
12
|
+
export declare const useGroupedMarkers: (args: {
|
|
13
|
+
legendId: LegendId;
|
|
14
|
+
markers: Marker[];
|
|
15
|
+
includeHiddenMarkers: boolean;
|
|
16
|
+
}) => GroupedMarker[] | undefined;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Marker } from '../../types/legendMarkerBadge.type';
|
|
2
|
+
import { LegendDataId, LegendId } from '../../types/legendType';
|
|
3
|
+
export interface UseLegendMarkerProps {
|
|
4
|
+
legendId: LegendId;
|
|
5
|
+
itemIds: LegendDataId[];
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Returns the visible markers for the given legendId and itemId.
|
|
9
|
+
*/
|
|
10
|
+
export declare function useLegendMarker(props: UseLegendMarkerProps): Marker | undefined;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility functions for legend visible markers functionality.
|
|
3
|
+
*
|
|
4
|
+
* This module contains shared utilities, helper functions, and debugging tools
|
|
5
|
+
* used across the legend marker hooks.
|
|
6
|
+
*/
|
|
7
|
+
import { Marker } from '../../types/legendMarkerBadge.type';
|
|
8
|
+
import { LegendDataId, LegendId } from '../../types/legendType';
|
|
9
|
+
/**
|
|
10
|
+
* Development helper to track hook calls
|
|
11
|
+
*/
|
|
12
|
+
export declare const trackMarkerCallsInDevelopment: () => void;
|
|
13
|
+
/**
|
|
14
|
+
* Helper to get unique data from the legend visible data store
|
|
15
|
+
*/
|
|
16
|
+
export declare const useUniqueVisibleData: () => LegendDataId[];
|
|
17
|
+
/**
|
|
18
|
+
* Common logic for creating markers from data using strategy.
|
|
19
|
+
* Selection-based grouping is handled at the viewport rendering level.
|
|
20
|
+
*/
|
|
21
|
+
export declare const useCreateMarkers: (legendId: LegendId, data: LegendDataId[], isViewport?: boolean) => ReadonlyArray<Marker>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Badge } from '../types/legendMarkerBadge.type';
|
|
2
|
+
import { LegendId } from '../types/legendType';
|
|
3
|
+
/**
|
|
4
|
+
* Returns all unique badges for the given legendId, determined by unique title + color.
|
|
5
|
+
* This will also return markers that are not visible on screen.
|
|
6
|
+
*/
|
|
7
|
+
export declare function useLegendUniqueBadges(legendId: LegendId, options?: {
|
|
8
|
+
isViewport?: boolean;
|
|
9
|
+
}): ReadonlyArray<Badge>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Marker } from '../types/legendMarkerBadge.type';
|
|
2
|
+
import { LegendId } from '../types/legendType';
|
|
3
|
+
/**
|
|
4
|
+
* Returns all unique markers for the given legendId, determined by unique displayKey (title + color).
|
|
5
|
+
* This will also return markers that are not visible on screen.
|
|
6
|
+
*/
|
|
7
|
+
export declare function useLegendUniqueMarkers(legendId: LegendId, options?: {
|
|
8
|
+
isViewport?: boolean;
|
|
9
|
+
}): ReadonlyArray<Marker>;
|
|
@@ -13,4 +13,6 @@ export type { Badge, Marker } from './types/legendMarkerBadge.type';
|
|
|
13
13
|
export type { LegendStrategy } from './types/legendStrategy.type';
|
|
14
14
|
export type { LegendId, LegendOptionConfig } from './types/legendType';
|
|
15
15
|
export { useLegendVisibleDataStore } from './../legend/legendVisibleDataStore';
|
|
16
|
-
export { useLegendUniqueBadges
|
|
16
|
+
export { useLegendUniqueBadges } from './hooks/useLegendUniqueBadges';
|
|
17
|
+
export { useLegendUniqueMarkers } from './hooks/useLegendUniqueMarkers';
|
|
18
|
+
export { COUNT_MODE_KEYWORD } from './logic/normalizeBadges';
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Badge } from '../types/legendMarkerBadge.type';
|
|
2
|
+
/**
|
|
3
|
+
* Keyword used to identify count mode in badge text options. This changes
|
|
4
|
+
* the way we normalize badges.
|
|
5
|
+
*/
|
|
6
|
+
export declare const COUNT_MODE_KEYWORD = "Count";
|
|
7
|
+
/**
|
|
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'.
|
|
10
|
+
*
|
|
11
|
+
* @param badgeTextOptions - Badge text configuration options from legend state
|
|
12
|
+
* @returns Whether count mode should be enabled
|
|
13
|
+
*/
|
|
14
|
+
export declare function isCountMode(badgeTextOptions: Record<string, string> | undefined): boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Creates badges with count displayed as title.
|
|
17
|
+
* Takes all badges (including duplicates) and unique badges, and returns unique badges
|
|
18
|
+
* with their titles replaced by the count of how many times they appear.
|
|
19
|
+
*
|
|
20
|
+
* @param allBadges - All badges including duplicates
|
|
21
|
+
* @param uniqueBadges - Unique badges to be displayed
|
|
22
|
+
* @returns Array of badges with count as title
|
|
23
|
+
*/
|
|
24
|
+
export declare function createBadgesWithCount(allBadges: ReadonlyArray<Badge>, uniqueBadges: ReadonlyArray<Badge>): Badge[];
|
|
25
|
+
/**
|
|
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
|
+
*
|
|
29
|
+
* @param badges - Array of badges to normalize
|
|
30
|
+
* @param badgeTextOptions - Badge text configuration options from legend state
|
|
31
|
+
* @returns Normalized array of badges
|
|
32
|
+
*/
|
|
33
|
+
export declare function normalizeBadges(badges: ReadonlyArray<Badge>, badgeTextOptions: Record<string, string> | undefined): Badge[];
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
+
import { GlobalSelectionTypes } from '../../globalSelection';
|
|
1
2
|
export interface Marker {
|
|
2
3
|
getTitle: () => string;
|
|
3
4
|
getColor: () => string;
|
|
4
5
|
getIcon: () => string;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
getGroupKey: () => string;
|
|
9
|
-
badges: Badge[];
|
|
6
|
+
getDisplayKey: () => string;
|
|
7
|
+
getHighlightColor: () => string;
|
|
8
|
+
badges: ReadonlyArray<Badge>;
|
|
10
9
|
showAsPlainLabel?: boolean;
|
|
11
10
|
}
|
|
12
11
|
export interface Badge {
|
|
@@ -15,5 +14,6 @@ export interface Badge {
|
|
|
15
14
|
/**
|
|
16
15
|
* Returns a key that can be used for clustering or grouping badges together if they share the same key.
|
|
17
16
|
*/
|
|
18
|
-
|
|
17
|
+
getDisplayKey: () => string;
|
|
18
|
+
getItemId: () => GlobalSelectionTypes.ItemId;
|
|
19
19
|
}
|
|
@@ -19,9 +19,14 @@ export interface LegendStrategy {
|
|
|
19
19
|
badgeOptions?: ReadonlyArray<LegendOptionConfig>;
|
|
20
20
|
getBadgeTextOptions?: (selectedBadgeOption: LegendOptionConfig) => ReadonlyArray<string> | undefined;
|
|
21
21
|
/**
|
|
22
|
-
* Returns
|
|
22
|
+
* Returns 1 marker with badges for each incoming itemId. The viewport will make them unique when needed, and
|
|
23
|
+
* also split into groups based on (global) selection tree
|
|
24
|
+
*
|
|
25
|
+
* @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
|
+
* @returns Array of markers with badges, 1 marker with badges for each incoming itemId
|
|
23
28
|
*/
|
|
24
|
-
useMarkers: (itemIds: ReadonlyArray<LegendDataId
|
|
29
|
+
useMarkers: (itemIds: ReadonlyArray<LegendDataId>, isViewport?: boolean) => ReadonlyArray<Marker>;
|
|
25
30
|
/**
|
|
26
31
|
* Returns popover content that supports pagination for the given itemId.
|
|
27
32
|
*
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { Badge, Marker } from '../types/legendMarkerBadge.type';
|
|
2
|
-
import { LegendDataId, LegendId } from '../types/legendType';
|
|
3
|
-
/**
|
|
4
|
-
* Returns the marker for the given legendId and itemId.
|
|
5
|
-
*/
|
|
6
|
-
export declare function useLegendMarker(args: {
|
|
7
|
-
legendId: LegendId;
|
|
8
|
-
itemId: LegendDataId;
|
|
9
|
-
}): Marker | undefined;
|
|
10
|
-
/**
|
|
11
|
-
* Returns all unique markers for the given legendId, determined by unique markerKey (title + color).
|
|
12
|
-
*/
|
|
13
|
-
export declare function useLegendUniqueMarkers(args: {
|
|
14
|
-
legendId: LegendId;
|
|
15
|
-
}): ReadonlyArray<Marker>;
|
|
16
|
-
/**
|
|
17
|
-
* Returns all unique badges for the given legendId, determined by unique title + color.
|
|
18
|
-
*/
|
|
19
|
-
export declare function useLegendUniqueBadges(legendId: LegendId): ReadonlyArray<Badge>;
|
/package/src/lib/components/contextualAppLinks/{externalAppsMenu.d.ts → ExternalAppsMenu.d.ts}
RENAMED
|
File without changes
|