@gooddata/sdk-ui-vis-commons 10.26.0 → 10.27.0-alpha.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.
|
@@ -21,5 +21,5 @@ export interface ILegendDetailOptions {
|
|
|
21
21
|
/**
|
|
22
22
|
* @internal
|
|
23
23
|
*/
|
|
24
|
-
export declare function getLegendDetails(legendPosition: PositionType, responsive: boolean | "autoPositionWithPopup", options: ILegendDetailOptions): ILegendDetails | null;
|
|
24
|
+
export declare function getLegendDetails(legendPosition: PositionType, responsive: boolean | "autoPositionWithPopup", options: ILegendDetailOptions, respectLegendPosition?: boolean): ILegendDetails | null;
|
|
25
25
|
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/legend/PopUpLegend/helpers.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/legend/PopUpLegend/helpers.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAyE3C;;GAEG;AACH,MAAM,WAAW,cAAc;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,YAAY,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,OAAO,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACjC,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAC5B,cAAc,EAAE,YAAY,EAC5B,UAAU,EAAE,OAAO,GAAG,uBAAuB,EAC7C,OAAO,EAAE,oBAAoB,EAC7B,qBAAqB,CAAC,EAAE,OAAO,GAChC,cAAc,GAAG,IAAI,CAevB"}
|
|
@@ -2,31 +2,38 @@ import { TOP, RIGHT, BOTTOM } from "../PositionTypes.js";
|
|
|
2
2
|
const LEGEND_WIDTH_BREAKPOINT = 610;
|
|
3
3
|
const LEGEND_HEIGHT_BREAKPOINT_SM = 194;
|
|
4
4
|
const LEGEND_HEIGHT_BREAKPOINT_ML = 274;
|
|
5
|
-
function getLegendDetailsForAutoResponsive(legendPosition, contentRect, legendLabel) {
|
|
5
|
+
function getLegendDetailsForAutoResponsive(legendPosition, contentRect, legendLabel, respectLegendPosition) {
|
|
6
6
|
const width = contentRect?.client?.width;
|
|
7
7
|
const height = contentRect?.client?.height;
|
|
8
8
|
if (!width || !height) {
|
|
9
9
|
return null;
|
|
10
10
|
}
|
|
11
11
|
const name = legendLabel ? { name: legendLabel } : {};
|
|
12
|
+
const isLegendTopBottom = legendPosition === "top" || legendPosition === "bottom";
|
|
13
|
+
const maxRowsForTopBottom = height < LEGEND_HEIGHT_BREAKPOINT_ML ? 1 : 2;
|
|
14
|
+
const legendDetailsWithoutSizePositionChanges = {
|
|
15
|
+
...name,
|
|
16
|
+
position: legendPosition,
|
|
17
|
+
renderPopUp: isLegendTopBottom,
|
|
18
|
+
maxRows: isLegendTopBottom ? maxRowsForTopBottom : undefined,
|
|
19
|
+
};
|
|
20
|
+
// In case when position is different than auto and respectLegendPosition flag is true,
|
|
21
|
+
// we use legend details without position changes based on sizing.
|
|
22
|
+
const shouldRespectLegendPosition = respectLegendPosition && legendPosition !== "auto";
|
|
23
|
+
if (shouldRespectLegendPosition) {
|
|
24
|
+
return legendDetailsWithoutSizePositionChanges;
|
|
25
|
+
}
|
|
12
26
|
// Decision logic: https://gooddata.invisionapp.com/console/share/KJ2A59MOAQ/548340571
|
|
13
27
|
if (width < LEGEND_WIDTH_BREAKPOINT) {
|
|
14
28
|
const maxRowsForTop = height < LEGEND_HEIGHT_BREAKPOINT_ML ? 1 : 2;
|
|
15
29
|
return { ...name, position: TOP, renderPopUp: true, maxRows: maxRowsForTop };
|
|
16
30
|
}
|
|
17
31
|
else {
|
|
18
|
-
const isLegendTopBottom = legendPosition === "top" || legendPosition === "bottom";
|
|
19
32
|
if (height < LEGEND_HEIGHT_BREAKPOINT_SM) {
|
|
20
33
|
return { ...name, position: RIGHT, renderPopUp: false };
|
|
21
34
|
}
|
|
22
35
|
else {
|
|
23
|
-
|
|
24
|
-
return {
|
|
25
|
-
...name,
|
|
26
|
-
position: legendPosition,
|
|
27
|
-
renderPopUp: isLegendTopBottom,
|
|
28
|
-
maxRows: isLegendTopBottom ? maxRowsForTopBottom : undefined,
|
|
29
|
-
};
|
|
36
|
+
return legendDetailsWithoutSizePositionChanges;
|
|
30
37
|
}
|
|
31
38
|
}
|
|
32
39
|
}
|
|
@@ -49,10 +56,10 @@ function getLegendDetailsForStandard(legendPosition, responsive, showFluidLegend
|
|
|
49
56
|
/**
|
|
50
57
|
* @internal
|
|
51
58
|
*/
|
|
52
|
-
export function getLegendDetails(legendPosition, responsive, options) {
|
|
59
|
+
export function getLegendDetails(legendPosition, responsive, options, respectLegendPosition) {
|
|
53
60
|
if (responsive !== "autoPositionWithPopup") {
|
|
54
61
|
return getLegendDetailsForStandard(legendPosition, responsive, options.showFluidLegend, options.isHeatmap);
|
|
55
62
|
}
|
|
56
|
-
return getLegendDetailsForAutoResponsive(legendPosition, options.contentRect, options.legendLabel);
|
|
63
|
+
return getLegendDetailsForAutoResponsive(legendPosition, options.contentRect, options.legendLabel, respectLegendPosition);
|
|
57
64
|
}
|
|
58
65
|
//# sourceMappingURL=helpers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../src/legend/PopUpLeg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,EAAE,KAAK;KACrB,CAAC;AACN,CAAC;AAsBD;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAC5B,cAA4B,EAC5B,UAA6C,EAC7C,OAA6B,EAC7B,qBAA+B;IAE/B,IAAI,UAAU,KAAK,uBAAuB,EAAE,CAAC;QACzC,OAAO,2BAA2B,CAC9B,cAAc,EACd,UAAU,EACV,OAAO,CAAC,eAAe,EACvB,OAAO,CAAC,SAAS,CACpB,CAAC;IACN,CAAC;IACD,OAAO,iCAAiC,CACpC,cAAc,EACd,OAAO,CAAC,WAAW,EACnB,OAAO,CAAC,WAAW,EACnB,qBAAqB,CACxB,CAAC;AACN,CAAC"}
|
|
@@ -156,7 +156,7 @@ export declare const getHeadlineResponsiveClassName: (width: number | undefined,
|
|
|
156
156
|
/**
|
|
157
157
|
* @internal
|
|
158
158
|
*/
|
|
159
|
-
export declare function getLegendDetails(legendPosition: PositionType, responsive: boolean | "autoPositionWithPopup", options: ILegendDetailOptions): ILegendDetails | null;
|
|
159
|
+
export declare function getLegendDetails(legendPosition: PositionType, responsive: boolean | "autoPositionWithPopup", options: ILegendDetailOptions, respectLegendPosition?: boolean): ILegendDetails | null;
|
|
160
160
|
|
|
161
161
|
/**
|
|
162
162
|
* Source:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gooddata/sdk-ui-vis-commons",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.27.0-alpha.1",
|
|
4
4
|
"description": "GoodData.UI SDK - common functionality for different types of visualizations",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -36,11 +36,11 @@
|
|
|
36
36
|
"react-intl": "^6.4.1",
|
|
37
37
|
"react-measure": "^2.5.2",
|
|
38
38
|
"tslib": "^2.5.0",
|
|
39
|
-
"@gooddata/sdk-backend-spi": "10.
|
|
40
|
-
"@gooddata/sdk-
|
|
41
|
-
"@gooddata/sdk-
|
|
42
|
-
"@gooddata/sdk-ui
|
|
43
|
-
"@gooddata/sdk-ui-theme-provider": "10.
|
|
39
|
+
"@gooddata/sdk-backend-spi": "10.27.0-alpha.1",
|
|
40
|
+
"@gooddata/sdk-ui-kit": "10.27.0-alpha.1",
|
|
41
|
+
"@gooddata/sdk-model": "10.27.0-alpha.1",
|
|
42
|
+
"@gooddata/sdk-ui": "10.27.0-alpha.1",
|
|
43
|
+
"@gooddata/sdk-ui-theme-provider": "10.27.0-alpha.1"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
46
46
|
"react": "^16.10.0 || ^17.0.0 || ^18.0.0",
|
|
@@ -85,8 +85,8 @@
|
|
|
85
85
|
"typescript": "5.3.3",
|
|
86
86
|
"vitest": "3.0.8",
|
|
87
87
|
"vitest-dom": "0.1.1",
|
|
88
|
-
"@gooddata/reference-workspace": "10.
|
|
89
|
-
"@gooddata/sdk-backend-mockingbird": "10.
|
|
88
|
+
"@gooddata/reference-workspace": "10.27.0-alpha.1",
|
|
89
|
+
"@gooddata/sdk-backend-mockingbird": "10.27.0-alpha.1"
|
|
90
90
|
},
|
|
91
91
|
"scripts": {
|
|
92
92
|
"clean": "rm -rf ci dist esm coverage styles/css *.log tsconfig.tsbuildinfo",
|