@gooddata/sdk-ui-dashboard 10.14.0-alpha.2 → 10.14.0-alpha.5
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/__version.d.ts +1 -1
- package/esm/__version.js +1 -1
- package/esm/model/commandHandlers/dashboard/common/stateInitializers.d.ts.map +1 -1
- package/esm/model/commandHandlers/dashboard/common/stateInitializers.js +12 -4
- package/esm/model/commandHandlers/dashboard/common/stateInitializers.js.map +1 -1
- package/esm/model/commandHandlers/dashboard/resetDashboardHandler.d.ts.map +1 -1
- package/esm/model/commandHandlers/dashboard/resetDashboardHandler.js +3 -2
- package/esm/model/commandHandlers/dashboard/resetDashboardHandler.js.map +1 -1
- package/esm/model/store/config/configSelectors.d.ts +1 -1
- package/esm/model/store/config/configSelectors.d.ts.map +1 -1
- package/esm/model/store/config/configSelectors.js +1 -1
- package/esm/model/store/config/configSelectors.js.map +1 -1
- package/esm/model/store/index.d.ts +1 -1
- package/esm/model/store/index.d.ts.map +1 -1
- package/esm/model/store/index.js +1 -1
- package/esm/model/store/index.js.map +1 -1
- package/esm/presentation/flexibleLayout/DashboardItemOverlay/DashboardItemOverlay.d.ts +11 -0
- package/esm/presentation/flexibleLayout/DashboardItemOverlay/DashboardItemOverlay.d.ts.map +1 -0
- package/esm/presentation/flexibleLayout/DashboardItemOverlay/DashboardItemOverlay.js +53 -0
- package/esm/presentation/flexibleLayout/DashboardItemOverlay/DashboardItemOverlay.js.map +1 -0
- package/esm/presentation/flexibleLayout/DashboardItemOverlay/DashboardItemOverlayController.d.ts +8 -0
- package/esm/presentation/flexibleLayout/DashboardItemOverlay/DashboardItemOverlayController.d.ts.map +1 -0
- package/esm/presentation/flexibleLayout/DashboardItemOverlay/DashboardItemOverlayController.js +17 -0
- package/esm/presentation/flexibleLayout/DashboardItemOverlay/DashboardItemOverlayController.js.map +1 -0
- package/esm/presentation/flexibleLayout/DashboardLayoutWidget.d.ts +8 -0
- package/esm/presentation/flexibleLayout/DashboardLayoutWidget.d.ts.map +1 -0
- package/esm/presentation/flexibleLayout/DashboardLayoutWidget.js +199 -0
- package/esm/presentation/flexibleLayout/DashboardLayoutWidget.js.map +1 -0
- package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/DashboardLayout.d.ts +9 -0
- package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/DashboardLayout.d.ts.map +1 -0
- package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/DashboardLayout.js +57 -0
- package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/DashboardLayout.js.map +1 -0
- package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/DashboardLayoutEditSectionHeaderRenderer.d.ts +4 -0
- package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/DashboardLayoutEditSectionHeaderRenderer.d.ts.map +1 -0
- package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/DashboardLayoutEditSectionHeaderRenderer.js +20 -0
- package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/DashboardLayoutEditSectionHeaderRenderer.js.map +1 -0
- package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/DashboardLayoutGridRow.d.ts +21 -0
- package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/DashboardLayoutGridRow.d.ts.map +1 -0
- package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/DashboardLayoutGridRow.js +18 -0
- package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/DashboardLayoutGridRow.js.map +1 -0
- package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/DashboardLayoutGridRowEdit.d.ts +7 -0
- package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/DashboardLayoutGridRowEdit.d.ts.map +1 -0
- package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/DashboardLayoutGridRowEdit.js +41 -0
- package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/DashboardLayoutGridRowEdit.js.map +1 -0
- package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/DashboardLayoutItem.d.ts +15 -0
- package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/DashboardLayoutItem.d.ts.map +1 -0
- package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/DashboardLayoutItem.js +19 -0
- package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/DashboardLayoutItem.js.map +1 -0
- package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/DashboardLayoutItemRenderer.d.ts +6 -0
- package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/DashboardLayoutItemRenderer.d.ts.map +1 -0
- package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/DashboardLayoutItemRenderer.js +33 -0
- package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/DashboardLayoutItemRenderer.js.map +1 -0
- package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/DashboardLayoutItemViewRenderer.d.ts +3 -0
- package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/DashboardLayoutItemViewRenderer.d.ts.map +1 -0
- package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/DashboardLayoutItemViewRenderer.js +39 -0
- package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/DashboardLayoutItemViewRenderer.js.map +1 -0
- package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/DashboardLayoutSection.d.ts +24 -0
- package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/DashboardLayoutSection.d.ts.map +1 -0
- package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/DashboardLayoutSection.js +50 -0
- package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/DashboardLayoutSection.js.map +1 -0
- package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/DashboardLayoutSectionHeader.d.ts +24 -0
- package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/DashboardLayoutSectionHeader.d.ts.map +1 -0
- package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/DashboardLayoutSectionHeader.js +15 -0
- package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/DashboardLayoutSectionHeader.js.map +1 -0
- package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/DashboardLayoutSectionHeaderDescription.d.ts +9 -0
- package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/DashboardLayoutSectionHeaderDescription.d.ts.map +1 -0
- package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/DashboardLayoutSectionHeaderDescription.js +12 -0
- package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/DashboardLayoutSectionHeaderDescription.js.map +1 -0
- package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/DashboardLayoutSectionHeaderRenderer.d.ts +4 -0
- package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/DashboardLayoutSectionHeaderRenderer.d.ts.map +1 -0
- package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/DashboardLayoutSectionHeaderRenderer.js +12 -0
- package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/DashboardLayoutSectionHeaderRenderer.js.map +1 -0
- package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/DashboardLayoutSectionRenderer.d.ts +3 -0
- package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/DashboardLayoutSectionRenderer.d.ts.map +1 -0
- package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/DashboardLayoutSectionRenderer.js +13 -0
- package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/DashboardLayoutSectionRenderer.js.map +1 -0
- package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/DashboardLayoutWidgetRenderer.d.ts +4 -0
- package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/DashboardLayoutWidgetRenderer.d.ts.map +1 -0
- package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/DashboardLayoutWidgetRenderer.js +32 -0
- package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/DashboardLayoutWidgetRenderer.js.map +1 -0
- package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/EditableDashboardLayoutSectionRenderer.d.ts +3 -0
- package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/EditableDashboardLayoutSectionRenderer.d.ts.map +1 -0
- package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/EditableDashboardLayoutSectionRenderer.js +26 -0
- package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/EditableDashboardLayoutSectionRenderer.js.map +1 -0
- package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/EditableHeader/EditableLabelWithBubble.d.ts +16 -0
- package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/EditableHeader/EditableLabelWithBubble.d.ts.map +1 -0
- package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/EditableHeader/EditableLabelWithBubble.js +38 -0
- package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/EditableHeader/EditableLabelWithBubble.js.map +1 -0
- package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/EditableHeader/SectionHeaderEditable.d.ts +8 -0
- package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/EditableHeader/SectionHeaderEditable.d.ts.map +1 -0
- package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/EditableHeader/SectionHeaderEditable.js +66 -0
- package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/EditableHeader/SectionHeaderEditable.js.map +1 -0
- package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/EditableHeader/sectionHeaderHelper.d.ts +7 -0
- package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/EditableHeader/sectionHeaderHelper.d.ts.map +1 -0
- package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/EditableHeader/sectionHeaderHelper.js +18 -0
- package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/EditableHeader/sectionHeaderHelper.js.map +1 -0
- package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/RenderModeAwareDashboardLayoutSectionHeaderRenderer.d.ts +8 -0
- package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/RenderModeAwareDashboardLayoutSectionHeaderRenderer.d.ts.map +1 -0
- package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/RenderModeAwareDashboardLayoutSectionHeaderRenderer.js +14 -0
- package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/RenderModeAwareDashboardLayoutSectionHeaderRenderer.js.map +1 -0
- package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/RenderModeAwareDashboardLayoutSectionRenderer.d.ts +8 -0
- package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/RenderModeAwareDashboardLayoutSectionRenderer.d.ts.map +1 -0
- package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/RenderModeAwareDashboardLayoutSectionRenderer.js +14 -0
- package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/RenderModeAwareDashboardLayoutSectionRenderer.js.map +1 -0
- package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/index.d.ts +19 -0
- package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/index.d.ts.map +1 -0
- package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/index.js +14 -0
- package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/index.js.map +1 -0
- package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/interfaces.d.ts +337 -0
- package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/interfaces.d.ts.map +1 -0
- package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/interfaces.js +2 -0
- package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/interfaces.js.map +1 -0
- package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/utils/emptyFacade.d.ts +3 -0
- package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/utils/emptyFacade.d.ts.map +1 -0
- package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/utils/emptyFacade.js +31 -0
- package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/utils/emptyFacade.js.map +1 -0
- package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/utils/legacy.d.ts +7 -0
- package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/utils/legacy.d.ts.map +1 -0
- package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/utils/legacy.js +33 -0
- package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/utils/legacy.js.map +1 -0
- package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/utils/sizing.d.ts +43 -0
- package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/utils/sizing.d.ts.map +1 -0
- package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/utils/sizing.js +346 -0
- package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/utils/sizing.js.map +1 -0
- package/esm/presentation/flexibleLayout/DefaultDashboardLayoutUtils.d.ts +22 -0
- package/esm/presentation/flexibleLayout/DefaultDashboardLayoutUtils.d.ts.map +1 -0
- package/esm/presentation/flexibleLayout/DefaultDashboardLayoutUtils.js +96 -0
- package/esm/presentation/flexibleLayout/DefaultDashboardLayoutUtils.js.map +1 -0
- package/esm/presentation/flexibleLayout/DefaultFlexibleDashboardLayout.d.ts +7 -0
- package/esm/presentation/flexibleLayout/DefaultFlexibleDashboardLayout.d.ts.map +1 -0
- package/esm/presentation/flexibleLayout/DefaultFlexibleDashboardLayout.js +101 -0
- package/esm/presentation/flexibleLayout/DefaultFlexibleDashboardLayout.js.map +1 -0
- package/esm/presentation/flexibleLayout/EmptyDashboardError.d.ts +3 -0
- package/esm/presentation/flexibleLayout/EmptyDashboardError.d.ts.map +1 -0
- package/esm/presentation/flexibleLayout/EmptyDashboardError.js +10 -0
- package/esm/presentation/flexibleLayout/EmptyDashboardError.js.map +1 -0
- package/esm/presentation/flexibleLayout/EmptyDashboardLayout.d.ts +3 -0
- package/esm/presentation/flexibleLayout/EmptyDashboardLayout.d.ts.map +1 -0
- package/esm/presentation/flexibleLayout/EmptyDashboardLayout.js +9 -0
- package/esm/presentation/flexibleLayout/EmptyDashboardLayout.js.map +1 -0
- package/esm/presentation/flexibleLayout/constants.d.ts +4 -0
- package/esm/presentation/flexibleLayout/constants.d.ts.map +1 -0
- package/esm/presentation/flexibleLayout/constants.js +14 -0
- package/esm/presentation/flexibleLayout/constants.js.map +1 -0
- package/esm/presentation/flexibleLayout/index.d.ts +3 -0
- package/esm/presentation/flexibleLayout/index.d.ts.map +1 -0
- package/esm/presentation/flexibleLayout/index.js +4 -0
- package/esm/presentation/flexibleLayout/index.js.map +1 -0
- package/esm/presentation/flexibleLayout/refs.d.ts +5 -0
- package/esm/presentation/flexibleLayout/refs.d.ts.map +1 -0
- package/esm/presentation/flexibleLayout/refs.js +7 -0
- package/esm/presentation/flexibleLayout/refs.js.map +1 -0
- package/esm/presentation/flexibleLayout/types.d.ts +22 -0
- package/esm/presentation/flexibleLayout/types.d.ts.map +1 -0
- package/esm/presentation/flexibleLayout/types.js +2 -0
- package/esm/presentation/flexibleLayout/types.js.map +1 -0
- package/esm/presentation/layout/DefaultDashboardLayout.d.ts.map +1 -1
- package/esm/presentation/layout/DefaultDashboardLayout.js +16 -8
- package/esm/presentation/layout/DefaultDashboardLayout.js.map +1 -1
- package/esm/sdk-ui-dashboard.d.ts +7 -7
- package/package.json +15 -15
- package/styles/css/dashboard.css +324 -0
- package/styles/css/dashboard.css.map +1 -1
- package/styles/css/flexibleLayout.css +425 -0
- package/styles/css/flexibleLayout.css.map +1 -0
- package/styles/css/main.css +324 -0
- package/styles/css/main.css.map +1 -1
- package/styles/scss/dashboard.scss +1 -0
- package/styles/scss/flexibleLayout.scss +410 -0
|
@@ -0,0 +1,346 @@
|
|
|
1
|
+
// (C) 2019-2024 GoodData Corporation
|
|
2
|
+
import { isDashboardLayout, isWidget, isWidgetDefinition, } from "@gooddata/sdk-model";
|
|
3
|
+
import { fluidLayoutDescriptor } from "@gooddata/sdk-ui-ext";
|
|
4
|
+
import clamp from "lodash/clamp.js";
|
|
5
|
+
import flatten from "lodash/flatten.js";
|
|
6
|
+
import isEqual from "lodash/isEqual.js";
|
|
7
|
+
import isNil from "lodash/isNil.js";
|
|
8
|
+
import round from "lodash/round.js";
|
|
9
|
+
import { invariant } from "ts-invariant";
|
|
10
|
+
import { DASHBOARD_LAYOUT_GRID_COLUMNS_COUNT } from "../../../../_staging/dashboard/fluidLayout/index.js";
|
|
11
|
+
import { DashboardLayoutBuilder } from "../../../../_staging/dashboard/fluidLayout/builder/layout.js";
|
|
12
|
+
import { DashboardLayoutFacade } from "../../../../_staging/dashboard/fluidLayout/facade/layout.js";
|
|
13
|
+
import { getDashboardLayoutItemHeightForGrid, getSizeInfo, getDashboardLayoutWidgetMinGridWidth, getDashboardLayoutWidgetMinGridHeight, getDashboardLayoutWidgetMaxGridHeight, } from "../../../../_staging/layout/sizing.js";
|
|
14
|
+
import { ALL_SCREENS, DASHBOARD_LAYOUT_CONTAINER_WIDTHS, DASHBOARD_LAYOUT_MAX_HEIGHT_AS_RATIO_XS, } from "../../../constants/index.js";
|
|
15
|
+
export function unifyDashboardLayoutItemHeights(itemsOrLayout) {
|
|
16
|
+
if (isDashboardLayout(itemsOrLayout)) {
|
|
17
|
+
const updatedLayout = {
|
|
18
|
+
...itemsOrLayout,
|
|
19
|
+
sections: DashboardLayoutFacade.for(itemsOrLayout)
|
|
20
|
+
.sections()
|
|
21
|
+
.reduce((acc, section) => {
|
|
22
|
+
acc.push({
|
|
23
|
+
...section.raw(),
|
|
24
|
+
items: unifyDashboardLayoutItemHeights(section.items().raw()),
|
|
25
|
+
});
|
|
26
|
+
return acc;
|
|
27
|
+
}, []),
|
|
28
|
+
};
|
|
29
|
+
return updatedLayout;
|
|
30
|
+
}
|
|
31
|
+
const itemsWithSizeForAllScreens = itemsOrLayout.map((item) => ({
|
|
32
|
+
...item,
|
|
33
|
+
size: implicitLayoutItemSizeFromXlSize(item.size.xl),
|
|
34
|
+
}));
|
|
35
|
+
const itemsWithUnifiedHeightForAllScreens = ALL_SCREENS.reduce((acc, screen) => {
|
|
36
|
+
const itemsAsFutureGridRows = splitDashboardLayoutItemsAsRenderedGridRows(acc, screen);
|
|
37
|
+
return flatten(itemsAsFutureGridRows.map((futureGridRow) => unifyDashboardLayoutItemHeightsForScreen(futureGridRow, screen)));
|
|
38
|
+
}, itemsWithSizeForAllScreens);
|
|
39
|
+
return itemsWithUnifiedHeightForAllScreens;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Derive dashboard layout size for all screens from dashboard layout size defined for xl screen.
|
|
43
|
+
*
|
|
44
|
+
* @param xlSize - dashboard layout size for xl screen
|
|
45
|
+
*/
|
|
46
|
+
function implicitLayoutItemSizeFromXlSize(xlSize) {
|
|
47
|
+
const xlWidth = xlSize.gridWidth;
|
|
48
|
+
const xlHeight = xlSize.gridHeight;
|
|
49
|
+
const ratio = xlSize.heightAsRatio;
|
|
50
|
+
switch (xlWidth) {
|
|
51
|
+
case 0:
|
|
52
|
+
return dashboardLayoutItemSizeForAllScreens(0, 0, 0, 0, 0, 0, 0);
|
|
53
|
+
case 1:
|
|
54
|
+
return dashboardLayoutItemSizeForAllScreens(ratio, xlHeight, xlWidth, xlWidth, 2, 6, 12);
|
|
55
|
+
case 2:
|
|
56
|
+
return dashboardLayoutItemSizeForAllScreens(ratio, xlHeight, xlWidth, xlWidth, 4, 6, 12);
|
|
57
|
+
case 3:
|
|
58
|
+
case 4:
|
|
59
|
+
case 5:
|
|
60
|
+
case 6:
|
|
61
|
+
case 7:
|
|
62
|
+
case 8:
|
|
63
|
+
case 9:
|
|
64
|
+
return dashboardLayoutItemSizeForAllScreens(ratio, xlHeight, xlWidth, xlWidth, 6, 12, 12);
|
|
65
|
+
case 10:
|
|
66
|
+
return dashboardLayoutItemSizeForAllScreens(ratio, xlHeight, xlWidth, xlWidth, 12, 12, 12);
|
|
67
|
+
case 11:
|
|
68
|
+
return dashboardLayoutItemSizeForAllScreens(ratio, xlHeight, xlWidth, xlWidth, 12, 12, 12);
|
|
69
|
+
case 12:
|
|
70
|
+
return dashboardLayoutItemSizeForAllScreens(ratio, xlHeight, xlWidth, xlWidth, 12, 12, 12);
|
|
71
|
+
default:
|
|
72
|
+
invariant(false, `Unsupported xlWidth: ${xlWidth}`);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Create dashboard layout item size for all screens,
|
|
77
|
+
* with identical height, defined as ratio,
|
|
78
|
+
* but different width, defined as grid items count.
|
|
79
|
+
*
|
|
80
|
+
* @param heightAsRatio - height as ratio to the width, defined in percents
|
|
81
|
+
* @param gridHeight - height as number of grid rows
|
|
82
|
+
* @param xl - width as grid items count for xl screen
|
|
83
|
+
* @param lg - width as grid items count for lg screen
|
|
84
|
+
* @param md - width as grid items count for md screen
|
|
85
|
+
* @param sm - width as grid items count for sm screen
|
|
86
|
+
* @param xs - width as grid items count for xs screen
|
|
87
|
+
*/
|
|
88
|
+
function dashboardLayoutItemSizeForAllScreens(heightAsRatio, gridHeight, xl, lg, md, sm, xs) {
|
|
89
|
+
if (gridHeight) {
|
|
90
|
+
return {
|
|
91
|
+
xl: {
|
|
92
|
+
gridWidth: xl,
|
|
93
|
+
gridHeight,
|
|
94
|
+
},
|
|
95
|
+
lg: {
|
|
96
|
+
gridWidth: lg,
|
|
97
|
+
gridHeight,
|
|
98
|
+
},
|
|
99
|
+
md: {
|
|
100
|
+
gridWidth: md,
|
|
101
|
+
gridHeight,
|
|
102
|
+
},
|
|
103
|
+
sm: {
|
|
104
|
+
gridWidth: sm,
|
|
105
|
+
gridHeight,
|
|
106
|
+
},
|
|
107
|
+
xs: {
|
|
108
|
+
gridWidth: xs,
|
|
109
|
+
gridHeight,
|
|
110
|
+
},
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
return {
|
|
114
|
+
xl: {
|
|
115
|
+
gridWidth: xl,
|
|
116
|
+
heightAsRatio,
|
|
117
|
+
},
|
|
118
|
+
lg: {
|
|
119
|
+
gridWidth: lg,
|
|
120
|
+
heightAsRatio,
|
|
121
|
+
},
|
|
122
|
+
md: {
|
|
123
|
+
gridWidth: md,
|
|
124
|
+
heightAsRatio,
|
|
125
|
+
},
|
|
126
|
+
sm: {
|
|
127
|
+
gridWidth: sm,
|
|
128
|
+
heightAsRatio,
|
|
129
|
+
},
|
|
130
|
+
xs: {
|
|
131
|
+
gridWidth: xs,
|
|
132
|
+
heightAsRatio,
|
|
133
|
+
},
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Divide the items into a list representing the future rows of the grid.
|
|
138
|
+
* This is useful for performing item transformations, depending on how they really appear in the grid.
|
|
139
|
+
*
|
|
140
|
+
* @param items - dashboard layout items
|
|
141
|
+
* @param screen - responsive screen class
|
|
142
|
+
*/
|
|
143
|
+
export function splitDashboardLayoutItemsAsRenderedGridRows(items, screen) {
|
|
144
|
+
const renderedRows = [];
|
|
145
|
+
let currentRowWidth = 0;
|
|
146
|
+
let currentRow = [];
|
|
147
|
+
items.forEach((item) => {
|
|
148
|
+
const itemSize = item.size[screen];
|
|
149
|
+
if (isNil(itemSize)) {
|
|
150
|
+
throw Error("Item size for current screen is undefined");
|
|
151
|
+
}
|
|
152
|
+
if (currentRowWidth + itemSize.gridWidth > DASHBOARD_LAYOUT_GRID_COLUMNS_COUNT) {
|
|
153
|
+
renderedRows.push(currentRow);
|
|
154
|
+
currentRow = [];
|
|
155
|
+
currentRowWidth = 0;
|
|
156
|
+
}
|
|
157
|
+
currentRow.push(item);
|
|
158
|
+
currentRowWidth = currentRowWidth + itemSize.gridWidth;
|
|
159
|
+
});
|
|
160
|
+
if (currentRow.length > 0) {
|
|
161
|
+
renderedRows.push(currentRow);
|
|
162
|
+
}
|
|
163
|
+
return renderedRows;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Calculate dashboard layout item height for the provided screen.
|
|
167
|
+
* Result, if custom height is defined, is height of the item, defined
|
|
168
|
+
* as grid items count, multiplied by {@link GRID_ROW_HEIGHT_IN_PX} or width of the item,
|
|
169
|
+
* defined as grid items count, multiplied by height, defined as a ratio.
|
|
170
|
+
*
|
|
171
|
+
* @param item - dashboard layout item
|
|
172
|
+
* @param screen - responsive screen class
|
|
173
|
+
*/
|
|
174
|
+
function dashboardLayoutItemHeightForScreen(item, screen) {
|
|
175
|
+
const { gridWidth, gridHeight, heightAsRatio = 0 } = item.size?.[screen] ?? {};
|
|
176
|
+
if (!gridWidth) {
|
|
177
|
+
return 0;
|
|
178
|
+
}
|
|
179
|
+
if (gridHeight) {
|
|
180
|
+
return getDashboardLayoutItemHeightForGrid(gridHeight);
|
|
181
|
+
}
|
|
182
|
+
return gridWidth * heightAsRatio;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Unify dashboard layout items height, defined as ratio, for the provided screen.
|
|
186
|
+
* It overrides height of all items to the highest item height found for the provided screen.
|
|
187
|
+
*
|
|
188
|
+
* @param items - dashboard layout items
|
|
189
|
+
* @param screen - responsive screen class
|
|
190
|
+
*/
|
|
191
|
+
function unifyDashboardLayoutItemHeightsForScreen(items, screen) {
|
|
192
|
+
const heights = items.map((item) => dashboardLayoutItemHeightForScreen(item, screen));
|
|
193
|
+
const maxHeight = Math.max(0, ...heights);
|
|
194
|
+
if (maxHeight === 0) {
|
|
195
|
+
return items;
|
|
196
|
+
}
|
|
197
|
+
return items.map((item) => updateDashboardLayoutItemHeight(item, screen, maxHeight));
|
|
198
|
+
}
|
|
199
|
+
const updateDashboardLayoutItemHeight = (item, screen, maxHeight) => {
|
|
200
|
+
const itemSizeForCurrentScreen = item.size[screen];
|
|
201
|
+
const heightAsRatio = itemSizeForCurrentScreen?.gridWidth
|
|
202
|
+
? round(maxHeight / itemSizeForCurrentScreen.gridWidth, 2)
|
|
203
|
+
: 0;
|
|
204
|
+
let updatedColumn = item;
|
|
205
|
+
if (!itemSizeForCurrentScreen?.gridHeight &&
|
|
206
|
+
!isNil(itemSizeForCurrentScreen?.heightAsRatio) &&
|
|
207
|
+
itemSizeForCurrentScreen?.heightAsRatio !== heightAsRatio) {
|
|
208
|
+
if (isWidget(updatedColumn.widget) || isWidgetDefinition(updatedColumn.widget)) {
|
|
209
|
+
updatedColumn = {
|
|
210
|
+
...updatedColumn,
|
|
211
|
+
widget: {
|
|
212
|
+
...updatedColumn.widget,
|
|
213
|
+
},
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
updatedColumn = {
|
|
217
|
+
...updatedColumn,
|
|
218
|
+
size: {
|
|
219
|
+
...updatedColumn.size,
|
|
220
|
+
[screen]: {
|
|
221
|
+
...updatedColumn.size[screen],
|
|
222
|
+
heightAsRatio,
|
|
223
|
+
},
|
|
224
|
+
},
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
if (screen === "xs" && heightAsRatio > DASHBOARD_LAYOUT_MAX_HEIGHT_AS_RATIO_XS) {
|
|
228
|
+
updatedColumn = {
|
|
229
|
+
...updatedColumn,
|
|
230
|
+
size: {
|
|
231
|
+
...updatedColumn.size,
|
|
232
|
+
xs: {
|
|
233
|
+
...updatedColumn.size.xs,
|
|
234
|
+
heightAsRatio: DASHBOARD_LAYOUT_MAX_HEIGHT_AS_RATIO_XS,
|
|
235
|
+
},
|
|
236
|
+
},
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
return updatedColumn;
|
|
240
|
+
};
|
|
241
|
+
/**
|
|
242
|
+
*
|
|
243
|
+
* @internal
|
|
244
|
+
*/
|
|
245
|
+
export const getResizedItemPositions = (originalLayout, resizedLayout, positions = []) => {
|
|
246
|
+
const originalLayoutFacade = DashboardLayoutFacade.for(originalLayout);
|
|
247
|
+
return DashboardLayoutFacade.for(resizedLayout)
|
|
248
|
+
.sections()
|
|
249
|
+
.reduce((acc, section) => {
|
|
250
|
+
return section.items().reduce((acc, item) => {
|
|
251
|
+
const originalColumn = originalLayoutFacade
|
|
252
|
+
.sections()
|
|
253
|
+
.section(section.index())
|
|
254
|
+
.items()
|
|
255
|
+
.item(item.index());
|
|
256
|
+
// if this bombs there is something wrong with the layout
|
|
257
|
+
invariant(originalColumn);
|
|
258
|
+
const originalContent = originalColumn.widget();
|
|
259
|
+
const updatedContent = item.widget();
|
|
260
|
+
// Is nested layout?
|
|
261
|
+
if (isDashboardLayout(originalContent) && isDashboardLayout(updatedContent)) {
|
|
262
|
+
return getResizedItemPositions(originalContent, updatedContent, positions);
|
|
263
|
+
}
|
|
264
|
+
if (!isEqual(originalColumn.size(), item.size()) &&
|
|
265
|
+
(isWidget(updatedContent) || isWidgetDefinition(updatedContent))) {
|
|
266
|
+
acc.push([item.section().index(), item.index()]);
|
|
267
|
+
}
|
|
268
|
+
return acc;
|
|
269
|
+
}, acc);
|
|
270
|
+
}, positions);
|
|
271
|
+
};
|
|
272
|
+
export const getDashboardLayoutItemHeightForRatioAndScreen = (size, screen) => {
|
|
273
|
+
// TODO is this default ok?
|
|
274
|
+
const { gridWidth, heightAsRatio = 1 } = size;
|
|
275
|
+
const actualWidth = DASHBOARD_LAYOUT_CONTAINER_WIDTHS[screen];
|
|
276
|
+
const actualColumnUnitWidth = actualWidth / DASHBOARD_LAYOUT_GRID_COLUMNS_COUNT;
|
|
277
|
+
return actualColumnUnitWidth * gridWidth * (heightAsRatio / 100);
|
|
278
|
+
};
|
|
279
|
+
export function getDashboardLayoutItemMaxGridWidth(item, screen) {
|
|
280
|
+
let gridRowWidth = 0;
|
|
281
|
+
const sectionItems = item.section().items().all();
|
|
282
|
+
for (const sectionItem of sectionItems) {
|
|
283
|
+
const newWidth = sectionItem.sizeForScreen(screen).gridWidth + gridRowWidth;
|
|
284
|
+
if (newWidth <= DASHBOARD_LAYOUT_GRID_COLUMNS_COUNT) {
|
|
285
|
+
if (sectionItem.index() === item.index()) {
|
|
286
|
+
break;
|
|
287
|
+
}
|
|
288
|
+
gridRowWidth = newWidth;
|
|
289
|
+
}
|
|
290
|
+
else {
|
|
291
|
+
if (sectionItem.index() === item.index()) {
|
|
292
|
+
return DASHBOARD_LAYOUT_GRID_COLUMNS_COUNT;
|
|
293
|
+
}
|
|
294
|
+
// TODO is this default ok?
|
|
295
|
+
gridRowWidth = sectionItem.sizeForScreen(screen)?.gridWidth ?? 1;
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
return DASHBOARD_LAYOUT_GRID_COLUMNS_COUNT - gridRowWidth;
|
|
299
|
+
}
|
|
300
|
+
export function getDashboardLayoutWidgetDefaultGridWidth(settings, widgetType, widgetContent) {
|
|
301
|
+
const sizeInfo = getSizeInfo(settings, widgetType, widgetContent);
|
|
302
|
+
return sizeInfo.width.default;
|
|
303
|
+
}
|
|
304
|
+
export function getLayoutWithoutGridHeights(layout) {
|
|
305
|
+
const layoutBuilder = DashboardLayoutBuilder.for(layout);
|
|
306
|
+
return layoutBuilder
|
|
307
|
+
.modifySections((section) => section.modifyItems((itemBuilder, itemFacade) => {
|
|
308
|
+
const widget = itemFacade.widget();
|
|
309
|
+
if (isDashboardLayout(widget)) {
|
|
310
|
+
const updatedLayout = getLayoutWithoutGridHeights(widget);
|
|
311
|
+
return itemBuilder.widget(updatedLayout);
|
|
312
|
+
}
|
|
313
|
+
const itemWithoutGridHeight = removeGridHeightFromItemSize(itemFacade.raw());
|
|
314
|
+
return itemBuilder.setItem(itemWithoutGridHeight);
|
|
315
|
+
}))
|
|
316
|
+
.build();
|
|
317
|
+
}
|
|
318
|
+
function removeGridHeightFromItemSize(item) {
|
|
319
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
320
|
+
const { gridHeight, ...rest } = item.size.xl;
|
|
321
|
+
return {
|
|
322
|
+
...item,
|
|
323
|
+
size: {
|
|
324
|
+
...item.size,
|
|
325
|
+
xl: {
|
|
326
|
+
...rest,
|
|
327
|
+
},
|
|
328
|
+
},
|
|
329
|
+
};
|
|
330
|
+
}
|
|
331
|
+
/**
|
|
332
|
+
* @internal
|
|
333
|
+
*/
|
|
334
|
+
export function validateDashboardLayoutWidgetSize(currentWidth, currentHeight, widgetType, widgetContent, settings) {
|
|
335
|
+
const minWidth = getDashboardLayoutWidgetMinGridWidth(settings, widgetType, widgetContent);
|
|
336
|
+
const maxWidth = fluidLayoutDescriptor.gridColumnsCount;
|
|
337
|
+
const minHeight = getDashboardLayoutWidgetMinGridHeight(settings, widgetType, widgetContent);
|
|
338
|
+
const maxHeight = getDashboardLayoutWidgetMaxGridHeight(settings, widgetType, widgetContent);
|
|
339
|
+
const validWidth = currentWidth !== undefined ? clamp(currentWidth, minWidth, maxWidth) : currentWidth;
|
|
340
|
+
const validHeight = currentHeight !== undefined ? clamp(currentHeight, minHeight, maxHeight) : currentHeight;
|
|
341
|
+
return {
|
|
342
|
+
validWidth,
|
|
343
|
+
validHeight,
|
|
344
|
+
};
|
|
345
|
+
}
|
|
346
|
+
//# sourceMappingURL=sizing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sizing.js","sourceRoot":"","sources":["../../../../../src/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/utils/sizing.ts"],"names":[],"mappings":"AAAA,qCAAqC;AACrC,OAAO,EAOH,iBAAiB,EAEjB,QAAQ,EACR,kBAAkB,GAErB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,KAAK,MAAM,iBAAiB,CAAC;AACpC,OAAO,OAAO,MAAM,mBAAmB,CAAC;AACxC,OAAO,OAAO,MAAM,mBAAmB,CAAC;AACxC,O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Aa,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC;IAC7F,OAAO;QACH,UAAU;QACV,WAAW;KACd,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ObjRef, IInsight, IDashboardWidget, IDashboardLayoutItem } from "@gooddata/sdk-model";
|
|
2
|
+
import { LRUCache } from "lru-cache";
|
|
3
|
+
import { DashboardLayoutItemModifications } from "./DefaultDashboardLayoutRenderer/index.js";
|
|
4
|
+
/**
|
|
5
|
+
* We need to aggressively memoize the widget sanitization results in order to prevent expensive re-renders
|
|
6
|
+
* down the line - we need to keep the widgets referentially equal whenever they are not changed.
|
|
7
|
+
*/
|
|
8
|
+
export declare const getMemoizedWidgetSanitizer: <TWidget>(cache: LRUCache<string, IDashboardLayoutItem<TWidget>, unknown>) => (getInsightByRef: (insightRef: ObjRef) => IInsight | undefined, enableKDWidgetCustomHeight: boolean) => DashboardLayoutItemModifications<TWidget>;
|
|
9
|
+
/**
|
|
10
|
+
* Ensure that areObjRefsEqual() and other predicates will be working with uncontrolled user ref inputs
|
|
11
|
+
* in custom layout transformation and/or custom widget/item renderers.
|
|
12
|
+
*
|
|
13
|
+
* @internal
|
|
14
|
+
*/
|
|
15
|
+
export declare function polluteWidgetRefsWithBothIdAndUri<TWidget = IDashboardWidget>(getInsightByRef: (insightRef: ObjRef) => IInsight | undefined): DashboardLayoutItemModifications<TWidget>;
|
|
16
|
+
/**
|
|
17
|
+
* Ensure the insight widgets conform to their allowed sizes.
|
|
18
|
+
*
|
|
19
|
+
* @internal
|
|
20
|
+
*/
|
|
21
|
+
export declare function validateItemsSize<TWidget = IDashboardWidget>(getInsightByRef: (insightRef: ObjRef) => IInsight | undefined, enableKDWidgetCustomHeight: boolean): DashboardLayoutItemModifications<TWidget>;
|
|
22
|
+
//# sourceMappingURL=DefaultDashboardLayoutUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DefaultDashboardLayoutUtils.d.ts","sourceRoot":"","sources":["../../../src/presentation/flexibleLayout/DefaultDashboardLayoutUtils.ts"],"names":[],"mappings":"AACA,OAAO,EACH,MAAM,EACN,QAAQ,EAOR,gBAAgB,EAChB,oBAAoB,EACvB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAIrC,OAAO,EACH,gCAAgC,EAGnC,MAAM,2CAA2C,CAAC;AAEnD;;;GAGG;AACH,eAAO,MAAM,0BAA0B,+GAGD,MAAM,KAAK,QAAQ,GAAG,SAAS,8BACjC,OAAO,8CAmBtC,CAAC;AAEN;;;;;GAKG;AACH,wBAAgB,iCAAiC,CAAC,OAAO,GAAG,gBAAgB,EACxE,eAAe,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,QAAQ,GAAG,SAAS,GAC9D,gCAAgC,CAAC,OAAO,CAAC,CAgC3C;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,GAAG,gBAAgB,EACxD,eAAe,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,QAAQ,GAAG,SAAS,EAC7D,0BAA0B,EAAE,OAAO,GACpC,gCAAgC,CAAC,OAAO,CAAC,CAqC3C"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
// (C) 2020-2024 GoodData Corporation
|
|
2
|
+
import { insightId, insightUri, isWidget, widgetUri, widgetId, isInsightWidget, } from "@gooddata/sdk-model";
|
|
3
|
+
import stringify from "json-stable-stringify";
|
|
4
|
+
import flow from "lodash/flow.js";
|
|
5
|
+
import { validateDashboardLayoutWidgetSize, } from "./DefaultDashboardLayoutRenderer/index.js";
|
|
6
|
+
/**
|
|
7
|
+
* We need to aggressively memoize the widget sanitization results in order to prevent expensive re-renders
|
|
8
|
+
* down the line - we need to keep the widgets referentially equal whenever they are not changed.
|
|
9
|
+
*/
|
|
10
|
+
export const getMemoizedWidgetSanitizer = (cache) => (getInsightByRef, enableKDWidgetCustomHeight) => {
|
|
11
|
+
return (item) => {
|
|
12
|
+
const widget = item.facade().widget();
|
|
13
|
+
const insightAvailable = isInsightWidget(widget) && !!getInsightByRef(widget.insight);
|
|
14
|
+
// we need to check if the result was made with insight available or not, it might change the result
|
|
15
|
+
// of polluteWidgetRefsWithBothIdAndUri which touches the insight as well
|
|
16
|
+
const cacheKey = `${stringify(item.facade().raw(), { space: 0 })}__${insightAvailable}`;
|
|
17
|
+
if (!cache.has(cacheKey)) {
|
|
18
|
+
const resultBuilder = flow(polluteWidgetRefsWithBothIdAndUri(getInsightByRef), validateItemsSize(getInsightByRef, enableKDWidgetCustomHeight))(item);
|
|
19
|
+
cache.set(cacheKey, resultBuilder.build());
|
|
20
|
+
}
|
|
21
|
+
return item.setItem(cache.get(cacheKey));
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Ensure that areObjRefsEqual() and other predicates will be working with uncontrolled user ref inputs
|
|
26
|
+
* in custom layout transformation and/or custom widget/item renderers.
|
|
27
|
+
*
|
|
28
|
+
* @internal
|
|
29
|
+
*/
|
|
30
|
+
export function polluteWidgetRefsWithBothIdAndUri(getInsightByRef) {
|
|
31
|
+
return (item) => item.widget((c) => {
|
|
32
|
+
let updatedContent = c;
|
|
33
|
+
if (isWidget(updatedContent)) {
|
|
34
|
+
updatedContent = {
|
|
35
|
+
...updatedContent,
|
|
36
|
+
ref: {
|
|
37
|
+
...updatedContent.ref,
|
|
38
|
+
uri: widgetUri(updatedContent),
|
|
39
|
+
identifier: widgetId(updatedContent),
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
if (isInsightWidget(updatedContent)) {
|
|
44
|
+
const insight = getInsightByRef(updatedContent.insight);
|
|
45
|
+
// sometimes this seems to be called sooner than insights are loaded leading to invariant errors
|
|
46
|
+
// since the behavior is nearly impossible to replicate reliably, let's be defensive here
|
|
47
|
+
if (insight) {
|
|
48
|
+
updatedContent = {
|
|
49
|
+
...updatedContent,
|
|
50
|
+
insight: {
|
|
51
|
+
...updatedContent.insight,
|
|
52
|
+
uri: insightUri(insight),
|
|
53
|
+
identifier: insightId(insight),
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return updatedContent;
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Ensure the insight widgets conform to their allowed sizes.
|
|
63
|
+
*
|
|
64
|
+
* @internal
|
|
65
|
+
*/
|
|
66
|
+
export function validateItemsSize(getInsightByRef, enableKDWidgetCustomHeight) {
|
|
67
|
+
return (item) => {
|
|
68
|
+
const widget = item.facade().widget();
|
|
69
|
+
if (isInsightWidget(widget)) {
|
|
70
|
+
const insight = getInsightByRef(widget.insight);
|
|
71
|
+
const currentSize = item.facade().size().xl;
|
|
72
|
+
const { gridWidth: currentWidth, gridHeight: currentHeight } = currentSize;
|
|
73
|
+
if (!insight) {
|
|
74
|
+
return item.size({
|
|
75
|
+
xl: {
|
|
76
|
+
...currentSize,
|
|
77
|
+
},
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
const { validWidth, validHeight } = validateDashboardLayoutWidgetSize(currentWidth, currentHeight, "insight", insight, { enableKDWidgetCustomHeight });
|
|
81
|
+
if (currentWidth !== validWidth || currentHeight !== validHeight) {
|
|
82
|
+
const gridWidthProp = currentWidth !== validWidth ? { gridWidth: validWidth } : {};
|
|
83
|
+
const gridHeightProp = currentHeight !== validHeight ? { gridHeight: validHeight } : {};
|
|
84
|
+
return item.size({
|
|
85
|
+
xl: {
|
|
86
|
+
...currentSize,
|
|
87
|
+
...gridWidthProp,
|
|
88
|
+
...gridHeightProp,
|
|
89
|
+
},
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return item;
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
//# sourceMappingURL=DefaultDashboardLayoutUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DefaultDashboardLayoutUtils.js","sourceRoot":"","sources":["../../../src/presentation/flexibleLayout/DefaultDashboardLayoutUtils.ts"],"names":[],"mappings":"AAAA,qCAAqC;AACrC,OAAO,EAGH,SAAS,EACT,UAAU,EACV,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,eAAe,GAGlB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,SAAS,MAAM,uBAAuB,CAAC;AAC9C,OAAO,IAAI,MAAM,gBAAgB,CAAC;AAElC,OAAO,EAGH,iCAAiC,GACpC,MAAM,2CAA2C,CAAC;AAEnD;;;GAGG;AACH,MAAM,CAAC,MAAM,0BAA0B,GACnC,CAAU,KAAsD,EAAE,EAAE,CACpE,CACI,eAA6D,EAC7D,0BAAmC,EACM,EAAE;IAC3C,OAAO,CAAC,IAAI,EAAE,EAAE;QACZ,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,MAAM,EAAE,CAAC;QACtC,MAAM,gBAAgB,GAAG,eAAe,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,eAAe,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QACtF,oGAAoG;QACpG,yEAAyE;QACzE,MAAM,QAAQ,GAAG,GAAG,SAAS,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,KAAK,gBAAgB,EAAE,CAAC;QAExF,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC;YACvB,MAAM,aAAa,GAAyC,IAAI,CAC5D,iCAAiC,CAAC,eAAe,CAAC,EAClD,iBAAiB,CAAC,eAAe,EAAE,0BAA0B,CAAC,CACjE,CAAC,IAAI,CAAC,CAAC;YACR,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,aAAa,CAAC,KAAK,EAAE,CAAC,CAAC;QAC/C,CAAC;QAED,OAAO,IAAI,CAAC,OAAO,CAAC,K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MAAM,CAAC,OAAO,CAAC,CAAC;YAChD,MAAM,WAAW,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC;YAC5C,MAAM,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,aAAa,EAAE,GAAG,WAAW,CAAC;YAE3E,IAAI,CAAC,OAAO,EAAE,CAAC;gBACX,OAAO,IAAI,CAAC,IAAI,CAAC;oBACb,EAAE,EAAE;wBACA,GAAG,WAAW;qBACjB;iBACJ,CAAC,CAAC;YACP,CAAC;YAED,MAAM,EAAE,UAAU,EAAE,WAAW,EAAE,GAAG,iCAAiC,CACjE,YAAY,EACZ,aAAa,EACb,SAAS,EACT,OAAO,EACP,EAAE,0BAA0B,EAAE,CACjC,CAAC;YACF,IAAI,YAAY,KAAK,UAAU,IAAI,aAAa,KAAK,WAAW,EAAE,CAAC;gBAC/D,MAAM,aAAa,GAAG,YAAY,KAAK,UAAU,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;gBACnF,MAAM,cAAc,GAAG,aAAa,KAAK,WAAW,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;gBACxF,OAAO,IAAI,CAAC,IAAI,CAAC;oBACb,EAAE,EAAE;wBACA,GAAG,WAAW;wBACd,GAAG,aAAa;wBAChB,GAAG,cAAc;qBACpB;iBACJ,CAAC,CAAC;YACP,CAAC;QACL,CAAC;QACD,OAAO,IAAI,CAAC;IAChB,CAAC,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { IDashboardLayoutProps } from "./types.js";
|
|
3
|
+
/**
|
|
4
|
+
* @alpha
|
|
5
|
+
*/
|
|
6
|
+
export declare const DefaultFlexibleDashboardLayout: (props: IDashboardLayoutProps) => JSX.Element;
|
|
7
|
+
//# sourceMappingURL=DefaultFlexibleDashboardLayout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DefaultFlexibleDashboardLayout.d.ts","sourceRoot":"","sources":["../../../src/presentation/flexibleLayout/DefaultFlexibleDashboardLayout.tsx"],"names":[],"mappings":";AAyBA,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAoEnD;;GAEG;AACH,eAAO,MAAM,8BAA8B,UAAW,qBAAqB,KAAG,WA4E7E,CAAC"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
// (C) 2020-2024 GoodData Corporation
|
|
2
|
+
import React, { useCallback, useMemo } from "react";
|
|
3
|
+
import { objRefToString, isWidget, } from "@gooddata/sdk-model";
|
|
4
|
+
import { LRUCache } from "lru-cache";
|
|
5
|
+
import max from "lodash/max.js";
|
|
6
|
+
import { useDashboardSelector, selectIsExport, selectIsLayoutEmpty, selectLayout, selectInsightsMap, selectEnableWidgetCustomHeight, selectRenderMode, } from "../../model/index.js";
|
|
7
|
+
import { DashboardLayoutWidget } from "./DashboardLayoutWidget.js";
|
|
8
|
+
import { DashboardLayout, DashboardLayoutBuilder, } from "./DefaultDashboardLayoutRenderer/index.js";
|
|
9
|
+
import { renderModeAwareDashboardLayoutSectionRenderer } from "./DefaultDashboardLayoutRenderer/RenderModeAwareDashboardLayoutSectionRenderer.js";
|
|
10
|
+
import { renderModeAwareDashboardLayoutSectionHeaderRenderer } from "./DefaultDashboardLayoutRenderer/RenderModeAwareDashboardLayoutSectionHeaderRenderer.js";
|
|
11
|
+
import { getMemoizedWidgetSanitizer } from "./DefaultDashboardLayoutUtils.js";
|
|
12
|
+
import { SectionHotspot } from "../dragAndDrop/index.js";
|
|
13
|
+
import { isInitialPlaceholderWidget } from "../../widgets/index.js";
|
|
14
|
+
import { EmptyDashboardLayout } from "./EmptyDashboardLayout.js";
|
|
15
|
+
/**
|
|
16
|
+
* Get dashboard layout for exports.
|
|
17
|
+
* - Create new extra rows if current row has width of widgets greater than 12
|
|
18
|
+
*
|
|
19
|
+
* @internal
|
|
20
|
+
* @param layout - dashboard layout to modify
|
|
21
|
+
* @returns transformed layout
|
|
22
|
+
*/
|
|
23
|
+
function getDashboardLayoutForExport(layout) {
|
|
24
|
+
const dashLayout = DashboardLayoutBuilder.for(layout);
|
|
25
|
+
const layoutFacade = dashLayout.facade();
|
|
26
|
+
const sections = layoutFacade.sections();
|
|
27
|
+
const screenSplitSections = sections.map((section) => ({
|
|
28
|
+
items: section.items().asGridRows("xl"),
|
|
29
|
+
header: section.header(),
|
|
30
|
+
}));
|
|
31
|
+
dashLayout.removeSections();
|
|
32
|
+
screenSplitSections.forEach((wrappedSection) => {
|
|
33
|
+
wrappedSection.items.forEach((rowSection, index) => {
|
|
34
|
+
// Also ensure that all items in a section have equal grid height - the max one.
|
|
35
|
+
// This simulates non-export mode, where the flex-box stretches
|
|
36
|
+
// all the items in a row to the equal height.
|
|
37
|
+
// This is necessary as we have no control over the custom widgets heights.
|
|
38
|
+
const sectionItemsGridHeights = rowSection.map((item) => item.size().xl.gridHeight);
|
|
39
|
+
const maxGridHeight = max(sectionItemsGridHeights);
|
|
40
|
+
dashLayout.createSection((section) => {
|
|
41
|
+
rowSection.forEach((item) => {
|
|
42
|
+
if (index === 0) {
|
|
43
|
+
section.header(wrappedSection.header);
|
|
44
|
+
}
|
|
45
|
+
section.createItem({ ...item.size().xl, gridHeight: maxGridHeight }, (i) => i.widget(item.widget()));
|
|
46
|
+
});
|
|
47
|
+
return section;
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
return dashLayout.build();
|
|
52
|
+
}
|
|
53
|
+
const itemKeyGetter = (keyGetterProps) => {
|
|
54
|
+
const widget = keyGetterProps.item.widget();
|
|
55
|
+
if (isWidget(widget)) {
|
|
56
|
+
return objRefToString(widget.ref);
|
|
57
|
+
}
|
|
58
|
+
return keyGetterProps.item.index().toString();
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* @alpha
|
|
62
|
+
*/
|
|
63
|
+
export const DefaultFlexibleDashboardLayout = (props) => {
|
|
64
|
+
const { onFiltersChange, onDrill, onError } = props;
|
|
65
|
+
const layout = useDashboardSelector(selectLayout);
|
|
66
|
+
const isLayoutEmpty = useDashboardSelector(selectIsLayoutEmpty);
|
|
67
|
+
const enableWidgetCustomHeight = useDashboardSelector(selectEnableWidgetCustomHeight);
|
|
68
|
+
const insights = useDashboardSelector(selectInsightsMap);
|
|
69
|
+
const isExport = useDashboardSelector(selectIsExport);
|
|
70
|
+
const renderMode = useDashboardSelector(selectRenderMode);
|
|
71
|
+
const getInsightByRef = useCallback((insightRef) => {
|
|
72
|
+
return insights.get(insightRef);
|
|
73
|
+
}, [insights]);
|
|
74
|
+
const sanitizeWidgets = useMemo(() => {
|
|
75
|
+
// keep the cache local so that it is cleared when the dashboard changes for example and this component is remounted
|
|
76
|
+
const cache = new LRUCache({ max: 100 });
|
|
77
|
+
return getMemoizedWidgetSanitizer(cache);
|
|
78
|
+
}, []);
|
|
79
|
+
const transformedLayout = useMemo(() => {
|
|
80
|
+
if (isExport) {
|
|
81
|
+
return getDashboardLayoutForExport(layout);
|
|
82
|
+
}
|
|
83
|
+
return DashboardLayoutBuilder.for(layout)
|
|
84
|
+
.modifySections((section) => section.modifyItems(sanitizeWidgets(getInsightByRef, enableWidgetCustomHeight)))
|
|
85
|
+
.build();
|
|
86
|
+
}, [layout, isExport, getInsightByRef, enableWidgetCustomHeight, sanitizeWidgets]);
|
|
87
|
+
const widgetRenderer = useCallback((renderProps) => {
|
|
88
|
+
return (React.createElement(DashboardLayoutWidget, { onError: onError, onDrill: onDrill, onFiltersChange: onFiltersChange, ...renderProps }));
|
|
89
|
+
}, [onError, onDrill, onFiltersChange]);
|
|
90
|
+
if (isLayoutEmpty) {
|
|
91
|
+
return React.createElement(EmptyDashboardLayout, null);
|
|
92
|
+
}
|
|
93
|
+
// do not render the tailing section hotspot if there is only one section in the layout and it has only initial placeholders in it
|
|
94
|
+
const shouldRenderSectionHotspot = transformedLayout.sections.length > 1 ||
|
|
95
|
+
transformedLayout.sections[0].items.some((i) => !isInitialPlaceholderWidget(i.widget));
|
|
96
|
+
return (React.createElement(React.Fragment, null,
|
|
97
|
+
React.createElement(DashboardLayout, { className: isExport ? "export-mode" : "", layout: transformedLayout, itemKeyGetter: itemKeyGetter, widgetRenderer: widgetRenderer, enableCustomHeight: enableWidgetCustomHeight, sectionRenderer: renderModeAwareDashboardLayoutSectionRenderer, sectionHeaderRenderer: renderModeAwareDashboardLayoutSectionHeaderRenderer, renderMode: renderMode }),
|
|
98
|
+
"new layout",
|
|
99
|
+
!!shouldRenderSectionHotspot && (React.createElement(SectionHotspot, { index: transformedLayout.sections.length, targetPosition: "below" }))));
|
|
100
|
+
};
|
|
101
|
+
//# sourceMappingURL=DefaultFlexibleDashboardLayout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DefaultFlexibleDashboardLayout.js","sourceRoot":"","sources":["../../../src/presentation/flexibleLayout/DefaultFlexibleDashboardLayout.tsx"],"names":[],"mappings":"AAAA,qCAAqC;AACrC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACpD,OAAO,EAGH,cAAc,EACd,QAAQ,GAGX,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,GAAG,MAAM,eAAe,CAAC;AAEhC,OAAO,EACH,oBAAoB,EACpB,cAAc,EACd,mBAAmB,EACnB,YAAY,EAEZ,iBAAiB,EACjB,8BAA8B,EAC9B,gBAAgB,GACnB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAEnE,OAAO,EACH,eAAe,EACf,sBAAsB,GAGzB,MAAM,2CAA2C,CAAC;AACnD,OAAO,EAAE,6CAA6C,EAAE,MAAM,mFAAmF,CAAC;A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;IAEF,IAAI,aAAa,EAAE,CAAC;QAChB,OAAO,oBAAC,oBAAoB,OAAG,CAAC;IACpC,CAAC;IAED,kIAAkI;IAClI,MAAM,0BAA0B,GAC5B,iBAAiB,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC;QACrC,iBAAiB,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,0BAA0B,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;IAE3F,OAAO,CACH;QACI,oBAAC,eAAe,IACZ,SAAS,EAAE,QAAQ,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,EACxC,MAAM,EAAE,iBAAiB,EACzB,aAAa,EAAE,aAAa,EAC5B,cAAc,EAAE,cAAc,EAC9B,kBAAkB,EAAE,wBAAwB,EAC5C,eAAe,EAAE,6CAA6C,EAC9D,qBAAqB,EAAE,mDAAmD,EAC1E,UAAU,EAAE,UAAU,GACxB;QACD,YAAY;QACZ,CAAC,CAAC,0BAA0B,IAAI,CAC7B,oBAAC,cAAc,IAAC,KAAK,EAAE,iBAAiB,CAAC,QAAQ,CAAC,MAAM,EAAE,cAAc,EAAC,OAAO,GAAG,CACtF,CACF,CACN,CAAC;AACN,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EmptyDashboardError.d.ts","sourceRoot":"","sources":["../../../src/presentation/flexibleLayout/EmptyDashboardError.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,eAAO,MAAM,mBAAmB,EAAE,KAAK,CAAC,EAUvC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// (C) 2020-2024 GoodData Corporation
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { useIntl } from "react-intl";
|
|
4
|
+
import { useDashboardComponentsContext } from "../dashboardContexts/index.js";
|
|
5
|
+
export const EmptyDashboardError = () => {
|
|
6
|
+
const intl = useIntl();
|
|
7
|
+
const { ErrorComponent } = useDashboardComponentsContext();
|
|
8
|
+
return (React.createElement(ErrorComponent, { className: "s-layout-error", message: intl.formatMessage({ id: "dashboard.error.empty.heading" }), description: intl.formatMessage({ id: "dashboard.error.empty.text" }) }));
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=EmptyDashboardError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EmptyDashboardError.js","sourceRoot":"","sources":["../../../src/presentation/flexibleLayout/EmptyDashboardError.tsx"],"names":[],"mappings":"AAAA,qCAAqC;AACrC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,6BAA6B,EAAE,MAAM,+BAA+B,CAAC;AAE9E,MAAM,CAAC,MAAM,mBAAmB,GAAa,GAAG,EAAE;IAC9C,MAAM,IAAI,GAAG,OAAO,EAAE,CAAC;IACvB,MAAM,EAAE,cAAc,EAAE,GAAG,6BAA6B,EAAE,CAAC;IAC3D,OAAO,CACH,oBAAC,cAAc,IACX,SAAS,EAAC,gBAAgB,EAC1B,OAAO,EAAE,IAAI,CAAC,aAAa,CAAC,EAAE,EAAE,EAAE,+BAA+B,EAAE,CAAC,EACpE,WAAW,EAAE,IAAI,CAAC,aAAa,CAAC,EAAE,EAAE,EAAE,4BAA4B,EAAE,CAAC,GACvE,CACL,CAAC;AACN,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EmptyDashboardLayout.d.ts","sourceRoot":"","sources":["../../../src/presentation/flexibleLayout/EmptyDashboardLayout.ts"],"names":[],"mappings":";AAKA,eAAO,MAAM,oBAAoB,mCAG/B,CAAC"}
|