@dynatrace/strato-geo 2.6.0 → 2.8.1
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/esm/map/components/ConnectionLayer/ConnectionLayerTooltip.js +9 -1
- package/esm/map/components/ConnectionLayer/ConnectionLayerTooltip.js.map +2 -2
- package/esm/map/components/ConnectionLayer/utils/parse-connection-data-to-geo-json.js +2 -0
- package/esm/map/components/ConnectionLayer/utils/parse-connection-data-to-geo-json.js.map +2 -2
- package/esm/map/components/ConnectionLayer/utils/restore-null-props.js +9 -0
- package/esm/map/components/ConnectionLayer/utils/restore-null-props.js.map +7 -0
- package/map/components/ConnectionLayer/ConnectionLayerTooltip.d.ts +7 -0
- package/map/components/ConnectionLayer/ConnectionLayerTooltip.js +9 -1
- package/map/components/ConnectionLayer/utils/parse-connection-data-to-geo-json.js +2 -0
- package/map/components/ConnectionLayer/utils/restore-null-props.d.ts +2 -0
- package/map/components/ConnectionLayer/utils/restore-null-props.js +28 -0
- package/package.json +6 -6
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
_ChartTooltip as ChartTooltip,
|
|
5
5
|
_useChartActionsMenu as useChartActionsMenu
|
|
6
6
|
} from "@dynatrace/strato-components-preview/charts";
|
|
7
|
+
import { restoreNullProps } from "./utils/restore-null-props.js";
|
|
7
8
|
import {
|
|
8
9
|
useMapTooltipPinnedState,
|
|
9
10
|
useMapTooltipState
|
|
@@ -16,8 +17,15 @@ const ConnectionLayerTooltip = (props) => {
|
|
|
16
17
|
updateSelectedItem,
|
|
17
18
|
onLeave
|
|
18
19
|
} = useChartActionsMenu();
|
|
19
|
-
const {
|
|
20
|
+
const {
|
|
21
|
+
hoveredLayerId,
|
|
22
|
+
position,
|
|
23
|
+
data: dataWithoutNullProps,
|
|
24
|
+
visible,
|
|
25
|
+
enabled
|
|
26
|
+
} = useMapTooltipState();
|
|
20
27
|
const pinned = useMapTooltipPinnedState();
|
|
28
|
+
const data = restoreNullProps(dataWithoutNullProps);
|
|
21
29
|
const connectionData = useRef(
|
|
22
30
|
null
|
|
23
31
|
);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/map/components/ConnectionLayer/ConnectionLayerTooltip.tsx"],
|
|
4
|
-
"sourcesContent": ["import { useRef } from 'react';\n\nimport {\n _ChartTooltip as ChartTooltip,\n _useChartActionsMenu as useChartActionsMenu,\n} from '@dynatrace/strato-components-preview/charts';\n\nimport {\n useMapTooltipPinnedState,\n useMapTooltipState,\n} from '../../store/selectors.js';\nimport type { Connection } from '../../types/connection-layer.js';\nimport type { Location } from '../../types/location.js';\nimport type {\n ConnectionLayerTooltipData,\n ConnectionLayerTooltipHandler,\n} from '../../types/tooltip.js';\n\
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import { useRef } from 'react';\n\nimport {\n _ChartTooltip as ChartTooltip,\n _useChartActionsMenu as useChartActionsMenu,\n} from '@dynatrace/strato-components-preview/charts';\n\nimport { restoreNullProps } from './utils/restore-null-props.js';\nimport {\n useMapTooltipPinnedState,\n useMapTooltipState,\n} from '../../store/selectors.js';\nimport type { Connection } from '../../types/connection-layer.js';\nimport type { Location } from '../../types/location.js';\nimport type {\n ConnectionLayerTooltipData,\n ConnectionLayerTooltipHandler,\n} from '../../types/tooltip.js';\n\nexport type ConnectionTooltipStatePayload = {\n path: Location[];\n __lineColor: string;\n __lineWidth: number;\n __nullValues: string[];\n};\n\nexport interface ConnectionLayerTooltipProps {\n layerId: string;\n tooltipTemplate?: ConnectionLayerTooltipHandler;\n}\n\nexport const ConnectionLayerTooltip = (props: ConnectionLayerTooltipProps) => {\n const { layerId, tooltipTemplate } = props;\n const {\n selectedItem: selectedItemId,\n actionsMenuRef,\n updateSelectedItem,\n onLeave,\n } = useChartActionsMenu();\n\n const {\n hoveredLayerId,\n position,\n data: dataWithoutNullProps,\n visible,\n enabled,\n } = useMapTooltipState<ConnectionTooltipStatePayload>();\n const pinned = useMapTooltipPinnedState();\n\n const data = restoreNullProps(dataWithoutNullProps);\n\n const connectionData = useRef<ConnectionLayerTooltipData<Connection> | null>(\n null,\n );\n\n const forceHideTooltip =\n !pinned && (hoveredLayerId !== layerId || !visible || !enabled);\n\n if (!tooltipTemplate || forceHideTooltip || !position) {\n return null;\n }\n\n if (!pinned && data?.[0]) {\n const { __lineColor: color, __lineWidth: thickness, ...rest } = data[0];\n\n connectionData.current = { color, thickness, data: rest };\n }\n\n return (\n <ChartTooltip\n position={position}\n pinned={pinned}\n onMouseLeave={onLeave}\n actionSelectionValue={{\n selectedItemId,\n actionsMenuRef,\n updateSelectedItem,\n }}\n >\n {connectionData.current ? tooltipTemplate(connectionData.current) : null}\n </ChartTooltip>\n );\n};\n\nConnectionLayerTooltip['displayName'] = 'ConnectionLayerTooltip';\n"],
|
|
5
|
+
"mappings": "AAqEI;AArEJ,SAAS,cAAc;AAEvB;AAAA,EACE,iBAAiB;AAAA,EACjB,wBAAwB;AAAA,OACnB;AAEP,SAAS,wBAAwB;AACjC;AAAA,EACE;AAAA,EACA;AAAA,OACK;AAoBA,MAAM,yBAAyB,CAAC,UAAuC;AAC5E,QAAM,EAAE,SAAS,gBAAgB,IAAI;AACrC,QAAM;AAAA,IACJ,cAAc;AAAA,IACd;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI,oBAAoB;AAExB,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA,MAAM;AAAA,IACN;AAAA,IACA;AAAA,EACF,IAAI,mBAAkD;AACtD,QAAM,SAAS,yBAAyB;AAExC,QAAM,OAAO,iBAAiB,oBAAoB;AAElD,QAAM,iBAAiB;AAAA,IACrB;AAAA,EACF;AAEA,QAAM,mBACJ,CAAC,WAAW,mBAAmB,WAAW,CAAC,WAAW,CAAC;AAEzD,MAAI,CAAC,mBAAmB,oBAAoB,CAAC,UAAU;AACrD,WAAO;AAAA,EACT;AAEA,MAAI,CAAC,UAAU,OAAO,CAAC,GAAG;AACxB,UAAM,EAAE,aAAa,OAAO,aAAa,WAAW,GAAG,KAAK,IAAI,KAAK,CAAC;AAEtE,mBAAe,UAAU,EAAE,OAAO,WAAW,MAAM,KAAK;AAAA,EAC1D;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA,cAAc;AAAA,MACd,sBAAsB;AAAA,QACpB;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAAA,MAEC,yBAAe,UAAU,gBAAgB,eAAe,OAAO,IAAI;AAAA;AAAA,EACtE;AAEJ;AAEA,uBAAuB,aAAa,IAAI;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -13,12 +13,14 @@ const getLineThickness = (thickness) => {
|
|
|
13
13
|
}
|
|
14
14
|
return thickness;
|
|
15
15
|
};
|
|
16
|
+
const getKeysWithNullValues = (obj) => Object.keys(obj).filter((key) => obj[key] === null);
|
|
16
17
|
const getFeatureProperties = (thickness, curve) => (properties, id) => {
|
|
17
18
|
const lineThickness = getLineThickness(thickness);
|
|
18
19
|
return {
|
|
19
20
|
...properties,
|
|
20
21
|
id,
|
|
21
22
|
__lineWidth: lineThickness,
|
|
23
|
+
__nullValues: getKeysWithNullValues(properties),
|
|
22
24
|
curve
|
|
23
25
|
};
|
|
24
26
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../src/map/components/ConnectionLayer/utils/parse-connection-data-to-geo-json.ts"],
|
|
4
|
-
"sourcesContent": ["import type GeoJSON from 'geojson';\n\nimport { _getCanvasColor as getCanvasColor } from '@dynatrace/strato-components-preview/charts';\n\nimport { getArcLineFeature } from './get-arc-line-feature.js';\nimport { getStraightLineFeature } from './get-straight-line-feature.js';\nimport { MAX_LINE_THICKNESS, MIN_LINE_THICKNESS } from '../../../constants.js';\nimport type {\n Connection,\n CurvedLine,\n FeatureProperties,\n} from '../../../types/connection-layer.js';\nimport type { Location } from '../../../types/location.js';\nimport { calculateHoveredColor } from '../../../utils/calculate-hovered-color.js';\nimport { defineColor } from '../../../utils/define-color.js';\n\nconst getLineThickness = (thickness: number): number => {\n if (thickness < MIN_LINE_THICKNESS) {\n return MIN_LINE_THICKNESS;\n }\n\n if (thickness > MAX_LINE_THICKNESS) {\n return MAX_LINE_THICKNESS;\n }\n\n return thickness;\n};\n\nconst getFeatureProperties =\n (thickness: number, curve?: CurvedLine) =>\n <T extends Connection>(\n properties: T,\n id: string,\n ): Omit<FeatureProperties, '__lineColor' | '__lineHoveredColor'> => {\n const lineThickness = getLineThickness(thickness);\n\n return {\n ...properties,\n id,\n __lineWidth: lineThickness,\n curve,\n };\n };\n\nconst getLineFeature = (\n path: Location[],\n featureProperties: FeatureProperties,\n): GeoJSON.Feature => {\n const isCurve = featureProperties.curve === 'smooth';\n\n if (isCurve) {\n return getArcLineFeature(path, featureProperties);\n }\n\n return getStraightLineFeature(path, featureProperties);\n};\n\nconst getFeatures = <T extends Connection>(\n data: T[],\n thickness: number,\n color: string | ((connection: T) => string),\n curve?: CurvedLine,\n): GeoJSON.Feature[] => {\n const getProperties = getFeatureProperties(thickness, curve);\n const features: GeoJSON.Feature[] = [];\n data.forEach((feature, index) => {\n if (feature.path.length >= 2) {\n const { path, ...properties } = feature;\n\n const featureProperties = {\n ...getProperties({ path, ...properties }, `connection-${index}`),\n ...getConnectionColor(feature, color),\n };\n\n features.push(getLineFeature(path, featureProperties));\n }\n });\n return features;\n};\n\nconst getConnectionColor = <T extends Connection>(\n connection: T,\n color: string | ((connection: T) => string),\n): Pick<FeatureProperties, '__lineColor' | '__lineHoveredColor'> => {\n const parsedColor = defineColor(color, connection);\n\n const canvasColor = getCanvasColor(parsedColor);\n const hoveredColor = calculateHoveredColor(canvasColor);\n\n return {\n __lineColor: canvasColor,\n __lineHoveredColor: hoveredColor,\n };\n};\n\nexport const parseConnectionDataToGeoJSON = <T extends Connection>(\n data: T[],\n thickness: number,\n color: string | ((connection: T) => string),\n curve?: CurvedLine,\n): GeoJSON.FeatureCollection => {\n return {\n type: 'FeatureCollection',\n\n features: getFeatures(data, thickness, color, curve),\n };\n};\n"],
|
|
5
|
-
"mappings": "AAEA,SAAS,mBAAmB,sBAAsB;AAElD,SAAS,yBAAyB;AAClC,SAAS,8BAA8B;AACvC,SAAS,oBAAoB,0BAA0B;AAOvD,SAAS,6BAA6B;AACtC,SAAS,mBAAmB;AAE5B,MAAM,mBAAmB,CAAC,cAA8B;AACtD,MAAI,YAAY,oBAAoB;AAClC,WAAO;AAAA,EACT;AAEA,MAAI,YAAY,oBAAoB;AAClC,WAAO;AAAA,EACT;AAEA,SAAO;AACT;AAEA,MAAM,uBACJ,CAAC,WAAmB,UACpB,CACE,YACA,OACkE;AAClE,QAAM,gBAAgB,iBAAiB,SAAS;AAEhD,SAAO;AAAA,IACL,GAAG;AAAA,IACH;AAAA,IACA,aAAa;AAAA,IACb;AAAA,EACF;AACF;AAEF,MAAM,iBAAiB,CACrB,MACA,sBACoB;AACpB,QAAM,UAAU,kBAAkB,UAAU;AAE5C,MAAI,SAAS;AACX,WAAO,kBAAkB,MAAM,iBAAiB;AAAA,EAClD;AAEA,SAAO,uBAAuB,MAAM,iBAAiB;AACvD;AAEA,MAAM,cAAc,CAClB,MACA,WACA,OACA,UACsB;AACtB,QAAM,gBAAgB,qBAAqB,WAAW,KAAK;AAC3D,QAAM,WAA8B,CAAC;AACrC,OAAK,QAAQ,CAAC,SAAS,UAAU;AAC/B,QAAI,QAAQ,KAAK,UAAU,GAAG;AAC5B,YAAM,EAAE,MAAM,GAAG,WAAW,IAAI;AAEhC,YAAM,oBAAoB;AAAA,QACxB,GAAG,cAAc,EAAE,MAAM,GAAG,WAAW,GAAG,cAAc,KAAK,EAAE;AAAA,QAC/D,GAAG,mBAAmB,SAAS,KAAK;AAAA,MACtC;AAEA,eAAS,KAAK,eAAe,MAAM,iBAAiB,CAAC;AAAA,IACvD;AAAA,EACF,CAAC;AACD,SAAO;AACT;AAEA,MAAM,qBAAqB,CACzB,YACA,UACkE;AAClE,QAAM,cAAc,YAAY,OAAO,UAAU;AAEjD,QAAM,cAAc,eAAe,WAAW;AAC9C,QAAM,eAAe,sBAAsB,WAAW;AAEtD,SAAO;AAAA,IACL,aAAa;AAAA,IACb,oBAAoB;AAAA,EACtB;AACF;AAEO,MAAM,+BAA+B,CAC1C,MACA,WACA,OACA,UAC8B;AAC9B,SAAO;AAAA,IACL,MAAM;AAAA,IAEN,UAAU,YAAY,MAAM,WAAW,OAAO,KAAK;AAAA,EACrD;AACF;",
|
|
4
|
+
"sourcesContent": ["import type GeoJSON from 'geojson';\n\nimport { _getCanvasColor as getCanvasColor } from '@dynatrace/strato-components-preview/charts';\n\nimport { getArcLineFeature } from './get-arc-line-feature.js';\nimport { getStraightLineFeature } from './get-straight-line-feature.js';\nimport { MAX_LINE_THICKNESS, MIN_LINE_THICKNESS } from '../../../constants.js';\nimport type {\n Connection,\n CurvedLine,\n FeatureProperties,\n} from '../../../types/connection-layer.js';\nimport type { Location } from '../../../types/location.js';\nimport { calculateHoveredColor } from '../../../utils/calculate-hovered-color.js';\nimport { defineColor } from '../../../utils/define-color.js';\n\nconst getLineThickness = (thickness: number): number => {\n if (thickness < MIN_LINE_THICKNESS) {\n return MIN_LINE_THICKNESS;\n }\n\n if (thickness > MAX_LINE_THICKNESS) {\n return MAX_LINE_THICKNESS;\n }\n\n return thickness;\n};\n\nconst getKeysWithNullValues = (obj: Record<string, unknown>): string[] =>\n Object.keys(obj).filter((key) => obj[key] === null);\n\nconst getFeatureProperties =\n (thickness: number, curve?: CurvedLine) =>\n <T extends Connection>(\n properties: T,\n id: string,\n ): Omit<FeatureProperties, '__lineColor' | '__lineHoveredColor'> => {\n const lineThickness = getLineThickness(thickness);\n\n return {\n ...properties,\n id,\n __lineWidth: lineThickness,\n __nullValues: getKeysWithNullValues(properties),\n curve,\n };\n };\n\nconst getLineFeature = (\n path: Location[],\n featureProperties: FeatureProperties,\n): GeoJSON.Feature => {\n const isCurve = featureProperties.curve === 'smooth';\n\n if (isCurve) {\n return getArcLineFeature(path, featureProperties);\n }\n\n return getStraightLineFeature(path, featureProperties);\n};\n\nconst getFeatures = <T extends Connection>(\n data: T[],\n thickness: number,\n color: string | ((connection: T) => string),\n curve?: CurvedLine,\n): GeoJSON.Feature[] => {\n const getProperties = getFeatureProperties(thickness, curve);\n const features: GeoJSON.Feature[] = [];\n data.forEach((feature, index) => {\n if (feature.path.length >= 2) {\n const { path, ...properties } = feature;\n\n const featureProperties = {\n ...getProperties({ path, ...properties }, `connection-${index}`),\n ...getConnectionColor(feature, color),\n };\n\n features.push(getLineFeature(path, featureProperties));\n }\n });\n return features;\n};\n\nconst getConnectionColor = <T extends Connection>(\n connection: T,\n color: string | ((connection: T) => string),\n): Pick<FeatureProperties, '__lineColor' | '__lineHoveredColor'> => {\n const parsedColor = defineColor(color, connection);\n\n const canvasColor = getCanvasColor(parsedColor);\n const hoveredColor = calculateHoveredColor(canvasColor);\n\n return {\n __lineColor: canvasColor,\n __lineHoveredColor: hoveredColor,\n };\n};\n\nexport const parseConnectionDataToGeoJSON = <T extends Connection>(\n data: T[],\n thickness: number,\n color: string | ((connection: T) => string),\n curve?: CurvedLine,\n): GeoJSON.FeatureCollection => {\n return {\n type: 'FeatureCollection',\n\n features: getFeatures(data, thickness, color, curve),\n };\n};\n"],
|
|
5
|
+
"mappings": "AAEA,SAAS,mBAAmB,sBAAsB;AAElD,SAAS,yBAAyB;AAClC,SAAS,8BAA8B;AACvC,SAAS,oBAAoB,0BAA0B;AAOvD,SAAS,6BAA6B;AACtC,SAAS,mBAAmB;AAE5B,MAAM,mBAAmB,CAAC,cAA8B;AACtD,MAAI,YAAY,oBAAoB;AAClC,WAAO;AAAA,EACT;AAEA,MAAI,YAAY,oBAAoB;AAClC,WAAO;AAAA,EACT;AAEA,SAAO;AACT;AAEA,MAAM,wBAAwB,CAAC,QAC7B,OAAO,KAAK,GAAG,EAAE,OAAO,CAAC,QAAQ,IAAI,GAAG,MAAM,IAAI;AAEpD,MAAM,uBACJ,CAAC,WAAmB,UACpB,CACE,YACA,OACkE;AAClE,QAAM,gBAAgB,iBAAiB,SAAS;AAEhD,SAAO;AAAA,IACL,GAAG;AAAA,IACH;AAAA,IACA,aAAa;AAAA,IACb,cAAc,sBAAsB,UAAU;AAAA,IAC9C;AAAA,EACF;AACF;AAEF,MAAM,iBAAiB,CACrB,MACA,sBACoB;AACpB,QAAM,UAAU,kBAAkB,UAAU;AAE5C,MAAI,SAAS;AACX,WAAO,kBAAkB,MAAM,iBAAiB;AAAA,EAClD;AAEA,SAAO,uBAAuB,MAAM,iBAAiB;AACvD;AAEA,MAAM,cAAc,CAClB,MACA,WACA,OACA,UACsB;AACtB,QAAM,gBAAgB,qBAAqB,WAAW,KAAK;AAC3D,QAAM,WAA8B,CAAC;AACrC,OAAK,QAAQ,CAAC,SAAS,UAAU;AAC/B,QAAI,QAAQ,KAAK,UAAU,GAAG;AAC5B,YAAM,EAAE,MAAM,GAAG,WAAW,IAAI;AAEhC,YAAM,oBAAoB;AAAA,QACxB,GAAG,cAAc,EAAE,MAAM,GAAG,WAAW,GAAG,cAAc,KAAK,EAAE;AAAA,QAC/D,GAAG,mBAAmB,SAAS,KAAK;AAAA,MACtC;AAEA,eAAS,KAAK,eAAe,MAAM,iBAAiB,CAAC;AAAA,IACvD;AAAA,EACF,CAAC;AACD,SAAO;AACT;AAEA,MAAM,qBAAqB,CACzB,YACA,UACkE;AAClE,QAAM,cAAc,YAAY,OAAO,UAAU;AAEjD,QAAM,cAAc,eAAe,WAAW;AAC9C,QAAM,eAAe,sBAAsB,WAAW;AAEtD,SAAO;AAAA,IACL,aAAa;AAAA,IACb,oBAAoB;AAAA,EACtB;AACF;AAEO,MAAM,+BAA+B,CAC1C,MACA,WACA,OACA,UAC8B;AAC9B,SAAO;AAAA,IACL,MAAM;AAAA,IAEN,UAAU,YAAY,MAAM,WAAW,OAAO,KAAK;AAAA,EACrD;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { merge } from "lodash-es";
|
|
2
|
+
const restoreNullProps = (data) => data?.map(({ __nullValues, ...rest }) => {
|
|
3
|
+
const nullProps = __nullValues?.map((prop) => ({ [prop]: null }));
|
|
4
|
+
return merge(rest, ...nullProps);
|
|
5
|
+
});
|
|
6
|
+
export {
|
|
7
|
+
restoreNullProps
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=restore-null-props.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../src/map/components/ConnectionLayer/utils/restore-null-props.ts"],
|
|
4
|
+
"sourcesContent": ["import { merge } from 'lodash-es';\n\nimport { ConnectionTooltipStatePayload } from '../ConnectionLayerTooltip.js';\n\nexport const restoreNullProps = (\n data: ConnectionTooltipStatePayload[] | undefined,\n): Omit<ConnectionTooltipStatePayload, '__nullValues'>[] | undefined =>\n data?.map(({ __nullValues, ...rest }) => {\n const nullProps = __nullValues?.map((prop) => ({ [prop]: null }));\n return merge(rest, ...nullProps);\n });\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,aAAa;AAIf,MAAM,mBAAmB,CAC9B,SAEA,MAAM,IAAI,CAAC,EAAE,cAAc,GAAG,KAAK,MAAM;AACvC,QAAM,YAAY,cAAc,IAAI,CAAC,UAAU,EAAE,CAAC,IAAI,GAAG,KAAK,EAAE;AAChE,SAAO,MAAM,MAAM,GAAG,SAAS;AACjC,CAAC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,4 +1,11 @@
|
|
|
1
|
+
import type { Location } from '../../types/location.js';
|
|
1
2
|
import type { ConnectionLayerTooltipHandler } from '../../types/tooltip.js';
|
|
3
|
+
export type ConnectionTooltipStatePayload = {
|
|
4
|
+
path: Location[];
|
|
5
|
+
__lineColor: string;
|
|
6
|
+
__lineWidth: number;
|
|
7
|
+
__nullValues: string[];
|
|
8
|
+
};
|
|
2
9
|
export interface ConnectionLayerTooltipProps {
|
|
3
10
|
layerId: string;
|
|
4
11
|
tooltipTemplate?: ConnectionLayerTooltipHandler;
|
|
@@ -24,6 +24,7 @@ module.exports = __toCommonJS(ConnectionLayerTooltip_exports);
|
|
|
24
24
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
25
25
|
var import_react = require("react");
|
|
26
26
|
var import_charts = require("@dynatrace/strato-components-preview/charts");
|
|
27
|
+
var import_restore_null_props = require("./utils/restore-null-props.js");
|
|
27
28
|
var import_selectors = require("../../store/selectors.js");
|
|
28
29
|
const ConnectionLayerTooltip = (props) => {
|
|
29
30
|
const { layerId, tooltipTemplate } = props;
|
|
@@ -33,8 +34,15 @@ const ConnectionLayerTooltip = (props) => {
|
|
|
33
34
|
updateSelectedItem,
|
|
34
35
|
onLeave
|
|
35
36
|
} = (0, import_charts._useChartActionsMenu)();
|
|
36
|
-
const {
|
|
37
|
+
const {
|
|
38
|
+
hoveredLayerId,
|
|
39
|
+
position,
|
|
40
|
+
data: dataWithoutNullProps,
|
|
41
|
+
visible,
|
|
42
|
+
enabled
|
|
43
|
+
} = (0, import_selectors.useMapTooltipState)();
|
|
37
44
|
const pinned = (0, import_selectors.useMapTooltipPinnedState)();
|
|
45
|
+
const data = (0, import_restore_null_props.restoreNullProps)(dataWithoutNullProps);
|
|
38
46
|
const connectionData = (0, import_react.useRef)(
|
|
39
47
|
null
|
|
40
48
|
);
|
|
@@ -36,12 +36,14 @@ const getLineThickness = (thickness) => {
|
|
|
36
36
|
}
|
|
37
37
|
return thickness;
|
|
38
38
|
};
|
|
39
|
+
const getKeysWithNullValues = (obj) => Object.keys(obj).filter((key) => obj[key] === null);
|
|
39
40
|
const getFeatureProperties = (thickness, curve) => (properties, id) => {
|
|
40
41
|
const lineThickness = getLineThickness(thickness);
|
|
41
42
|
return {
|
|
42
43
|
...properties,
|
|
43
44
|
id,
|
|
44
45
|
__lineWidth: lineThickness,
|
|
46
|
+
__nullValues: getKeysWithNullValues(properties),
|
|
45
47
|
curve
|
|
46
48
|
};
|
|
47
49
|
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var restore_null_props_exports = {};
|
|
20
|
+
__export(restore_null_props_exports, {
|
|
21
|
+
restoreNullProps: () => restoreNullProps
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(restore_null_props_exports);
|
|
24
|
+
var import_lodash_es = require("lodash");
|
|
25
|
+
const restoreNullProps = (data) => data?.map(({ __nullValues, ...rest }) => {
|
|
26
|
+
const nullProps = __nullValues?.map((prop) => ({ [prop]: null }));
|
|
27
|
+
return (0, import_lodash_es.merge)(rest, ...nullProps);
|
|
28
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynatrace/strato-geo",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.8.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"keywords": [
|
|
@@ -53,15 +53,15 @@
|
|
|
53
53
|
"peerDependencies": {
|
|
54
54
|
"@dynatrace-sdk/client-classic-environment-v2": "^3.7.3",
|
|
55
55
|
"@dynatrace-sdk/client-platform-management-service": "^1.7.0",
|
|
56
|
-
"@dynatrace-sdk/units": "^1.
|
|
56
|
+
"@dynatrace-sdk/units": "^1.3.1",
|
|
57
57
|
"react": "^18.0.0",
|
|
58
58
|
"react-dom": "^18.0.0",
|
|
59
59
|
"react-intl": "^6.0.8 || ^7.0.0",
|
|
60
60
|
"react-is": "^18.0.0",
|
|
61
|
-
"@dynatrace/strato-components": "^1.
|
|
62
|
-
"@dynatrace/strato-design-tokens": "^1.1.
|
|
63
|
-
"@dynatrace/strato-components-preview": "^2.
|
|
64
|
-
"@dynatrace/strato-icons": "^1.
|
|
61
|
+
"@dynatrace/strato-components": "^1.12.0",
|
|
62
|
+
"@dynatrace/strato-design-tokens": "^1.1.4",
|
|
63
|
+
"@dynatrace/strato-components-preview": "^2.8.1",
|
|
64
|
+
"@dynatrace/strato-icons": "^1.9.0"
|
|
65
65
|
},
|
|
66
66
|
"sideEffects": [
|
|
67
67
|
"./map/styles/react-mapgl-styles.css",
|