@gooddata/sdk-ui-dashboard 10.14.0-alpha.1 → 10.14.0-alpha.4
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/NOTICE +1919 -3
- 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 +17 -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,199 @@
|
|
|
1
|
+
// (C) 2020-2024 GoodData Corporation
|
|
2
|
+
import { isInsightWidget, isKpiWidget, isRichTextWidget, isVisualizationSwitcherWidget, } from "@gooddata/sdk-model";
|
|
3
|
+
import { WIDGET_DROPZONE_SIZE_INFO_DEFAULT } from "@gooddata/sdk-ui-ext";
|
|
4
|
+
import React, { useRef } from "react";
|
|
5
|
+
import cx from "classnames";
|
|
6
|
+
import { isCustomWidget, selectEnableWidgetCustomHeight, selectInsightsMap, selectIsInEditMode, selectSettings, uiActions, useDashboardDispatch, useDashboardSelector, selectWidgetsOverlayState, selectWidgetsModification, selectSectionModification, selectIsExport, useWidgetSelection, } from "../../model/index.js";
|
|
7
|
+
import { isAnyPlaceholderWidget, isPlaceholderWidget } from "../../widgets/index.js";
|
|
8
|
+
import { getSizeInfo, calculateWidgetMinHeight } from "../../_staging/layout/sizing.js";
|
|
9
|
+
import { getLayoutCoordinates } from "../../_staging/layout/coordinates.js";
|
|
10
|
+
import { useDashboardComponentsContext } from "../dashboardContexts/index.js";
|
|
11
|
+
import { Hotspot, ResizeOverlay, useDashboardDrag, useResizeItemStatus, useWidgetDragEndHandler, WidthResizerHotspot, } from "../dragAndDrop/index.js";
|
|
12
|
+
import { DashboardWidget } from "../widget/index.js";
|
|
13
|
+
import { DEFAULT_COLUMN_CLIENT_WIDTH, DEFAULT_WIDTH_RESIZER_HEIGHT } from "./constants.js";
|
|
14
|
+
import { getDashboardLayoutItemHeightForRatioAndScreen, } from "./DefaultDashboardLayoutRenderer/index.js";
|
|
15
|
+
import { DashboardItemOverlay } from "./DashboardItemOverlay/DashboardItemOverlay.js";
|
|
16
|
+
import { getRefsForSection, getRefsForItem } from "./refs.js";
|
|
17
|
+
/**
|
|
18
|
+
* Tests in KD require widget index for css selectors.
|
|
19
|
+
* Widget index equals to the widget order in the layout.
|
|
20
|
+
* Also placeholders are ignored for this.
|
|
21
|
+
*/
|
|
22
|
+
function getWidgetIndex(item) {
|
|
23
|
+
const sectionIndex = item.section().index();
|
|
24
|
+
const isIgnoredForIndexes = (widget) => {
|
|
25
|
+
return !widget || isAnyPlaceholderWidget(widget);
|
|
26
|
+
};
|
|
27
|
+
let itemsInSectionsBefore = 0;
|
|
28
|
+
for (let i = 0; i < sectionIndex; i += 1) {
|
|
29
|
+
itemsInSectionsBefore +=
|
|
30
|
+
item
|
|
31
|
+
.section()
|
|
32
|
+
.layout()
|
|
33
|
+
.section(i)
|
|
34
|
+
?.items()
|
|
35
|
+
.filter((i) => !isIgnoredForIndexes(i.widget())).length ?? 0;
|
|
36
|
+
}
|
|
37
|
+
const ignoredWidgetsBeforeItemCount = item
|
|
38
|
+
.section()
|
|
39
|
+
.items()
|
|
40
|
+
.filter((i) => i.index() < item.index() && isIgnoredForIndexes(i.widget())).length;
|
|
41
|
+
return itemsInSectionsBefore + item.index() - ignoredWidgetsBeforeItemCount;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* @internal
|
|
45
|
+
*/
|
|
46
|
+
export const DashboardLayoutWidget = (props) => {
|
|
47
|
+
const { item, screen, DefaultWidgetRenderer, onDrill, onFiltersChange, onError, getLayoutDimensions } = props;
|
|
48
|
+
const dispatch = useDashboardDispatch();
|
|
49
|
+
const insights = useDashboardSelector(selectInsightsMap);
|
|
50
|
+
const settings = useDashboardSelector(selectSettings);
|
|
51
|
+
const isInEditMode = useDashboardSelector(selectIsInEditMode);
|
|
52
|
+
const isExport = useDashboardSelector(selectIsExport);
|
|
53
|
+
const enableWidgetCustomHeight = useDashboardSelector(selectEnableWidgetCustomHeight);
|
|
54
|
+
const handleDragEnd = useWidgetDragEndHandler();
|
|
55
|
+
// TODO: we should probably do something more meaningful when item has no widget; should that even
|
|
56
|
+
// be allowed? undefined widget will make things explode down the line away so..
|
|
57
|
+
const widget = item.widget();
|
|
58
|
+
const isCustom = isCustomWidget(widget);
|
|
59
|
+
const isDraggableWidgetType = !(isPlaceholderWidget(widget) || isCustom);
|
|
60
|
+
const { isSelected } = useWidgetSelection(widget.ref);
|
|
61
|
+
const isRichText = isRichTextWidget(widget);
|
|
62
|
+
const isRichTextWidgetInEditState = isSelected && isRichText;
|
|
63
|
+
const [{ isDragging }, dragRef] = useDashboardDrag({
|
|
64
|
+
dragItem: () => {
|
|
65
|
+
return createDraggableItem(item, insights, settings);
|
|
66
|
+
},
|
|
67
|
+
canDrag: isInEditMode && isDraggableWidgetType && !isRichTextWidgetInEditState,
|
|
68
|
+
dragStart: (item) => {
|
|
69
|
+
dispatch(uiActions.setDraggingWidgetSource(item));
|
|
70
|
+
},
|
|
71
|
+
dragEnd: handleDragEnd,
|
|
72
|
+
}, [item, insights, isInEditMode, isDraggableWidgetType, isRichTextWidgetInEditState]);
|
|
73
|
+
const { ErrorComponent, LoadingComponent } = useDashboardComponentsContext();
|
|
74
|
+
const currentSize = item.size()[screen];
|
|
75
|
+
const minHeight = calculateWidgetMinHeight(widget, currentSize, insights, settings);
|
|
76
|
+
const height = currentSize.heightAsRatio && !currentSize.gridHeight
|
|
77
|
+
? getDashboardLayoutItemHeightForRatioAndScreen(currentSize, screen)
|
|
78
|
+
: undefined;
|
|
79
|
+
const allowOverflow = !!currentSize.heightAsRatio;
|
|
80
|
+
const className = enableWidgetCustomHeight ? "custom-height" : undefined;
|
|
81
|
+
const index = getWidgetIndex(item);
|
|
82
|
+
const refs = getRefsForItem(item);
|
|
83
|
+
const sectionModifications = useDashboardSelector(selectSectionModification(getRefsForSection(item.section())));
|
|
84
|
+
const itemModifications = useDashboardSelector(selectWidgetsModification(refs));
|
|
85
|
+
const overlayShow = useDashboardSelector(selectWidgetsOverlayState(refs));
|
|
86
|
+
const { isActive, isResizingColumnOrRow, heightLimitReached, widthLimitReached } = useResizeItemStatus(widget.identifier);
|
|
87
|
+
const contentRef = useRef(null);
|
|
88
|
+
function getWidthInPx() {
|
|
89
|
+
return contentRef?.current
|
|
90
|
+
? contentRef.current.getBoundingClientRect().width
|
|
91
|
+
: DEFAULT_COLUMN_CLIENT_WIDTH;
|
|
92
|
+
}
|
|
93
|
+
function getHeightInPx() {
|
|
94
|
+
return contentRef?.current
|
|
95
|
+
? contentRef.current.getBoundingClientRect().height
|
|
96
|
+
: DEFAULT_WIDTH_RESIZER_HEIGHT;
|
|
97
|
+
}
|
|
98
|
+
function getGridColumnWidth() {
|
|
99
|
+
const columnWidthInGC = item.sizeForScreen(screen)?.gridWidth;
|
|
100
|
+
const columnWidthInPx = getWidthInPx();
|
|
101
|
+
return columnWidthInPx / columnWidthInGC;
|
|
102
|
+
}
|
|
103
|
+
const canShowHotspot = isInEditMode && !isDragging;
|
|
104
|
+
return (React.createElement(DefaultWidgetRenderer, { DefaultWidgetRenderer: DefaultWidgetRenderer, item: item, screen: screen, allowOverflow: allowOverflow, height: height, minHeight: minHeight, className: className, contentRef: contentRef, getLayoutDimensions: getLayoutDimensions },
|
|
105
|
+
React.createElement("div", { ref: dragRef, className: cx([
|
|
106
|
+
"dashboard-widget-draggable-wrapper",
|
|
107
|
+
{ "gd-custom-widget-export": isCustom && isExport },
|
|
108
|
+
]) },
|
|
109
|
+
React.createElement(DashboardWidget
|
|
110
|
+
// @ts-expect-error Don't expose index prop on public interface (we need it only for css class for KD tests)
|
|
111
|
+
, {
|
|
112
|
+
// @ts-expect-error Don't expose index prop on public interface (we need it only for css class for KD tests)
|
|
113
|
+
index: index, screen: screen, onDrill: onDrill, onError: onError, onFiltersChange: onFiltersChange, widget: widget, ErrorComponent: ErrorComponent, LoadingComponent: LoadingComponent })),
|
|
114
|
+
canShowHotspot && !isAnyPlaceholderWidget(widget) ? (React.createElement(React.Fragment, null,
|
|
115
|
+
React.createElement(ResizeOverlay, { isActive: isActive, isResizingColumnOrRow: isResizingColumnOrRow, reachedWidthLimit: widthLimitReached, reachedHeightLimit: heightLimitReached }),
|
|
116
|
+
!isCustomWidget(widget) ? (React.createElement(React.Fragment, null,
|
|
117
|
+
React.createElement(Hotspot, { dropZoneType: "prev", itemIndex: item.index(), sectionIndex: item.section().index(), isLastInSection: false }),
|
|
118
|
+
React.createElement(Hotspot, { dropZoneType: "next", itemIndex: item.index(), sectionIndex: item.section().index(), isLastInSection: item.isLast() }),
|
|
119
|
+
React.createElement(WidthResizerHotspot, { item: item, screen: screen, getGridColumnHeightInPx: getHeightInPx, getGridColumnWidth: getGridColumnWidth, getLayoutDimensions: getLayoutDimensions }))) : null)) : null,
|
|
120
|
+
React.createElement(DashboardItemOverlay, { type: "column", onHide: () => dispatch(uiActions.toggleWidgetsOverlay({
|
|
121
|
+
refs: [item.ref()],
|
|
122
|
+
visible: false,
|
|
123
|
+
})), render: Boolean(isInEditMode && overlayShow) && !sectionModifications.includes("insertedByPlugin"), modifications: itemModifications })));
|
|
124
|
+
};
|
|
125
|
+
function getFilledSize(itemSize, sizeInfo) {
|
|
126
|
+
return {
|
|
127
|
+
gridWidth: itemSize.xl?.gridWidth ||
|
|
128
|
+
sizeInfo?.width.default ||
|
|
129
|
+
WIDGET_DROPZONE_SIZE_INFO_DEFAULT.width.default,
|
|
130
|
+
gridHeight: itemSize.xl?.gridHeight ||
|
|
131
|
+
sizeInfo?.height.default ||
|
|
132
|
+
WIDGET_DROPZONE_SIZE_INFO_DEFAULT.height.default,
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
function createDraggableItem(item, insights, settings) {
|
|
136
|
+
const widget = item.widget();
|
|
137
|
+
const { sectionIndex, itemIndex } = getLayoutCoordinates(item);
|
|
138
|
+
const size = item.size();
|
|
139
|
+
const isOnlyItemInSection = item.section().items().count() === 1;
|
|
140
|
+
if (isKpiWidget(widget)) {
|
|
141
|
+
const sizeInfo = getSizeInfo(settings, "kpi", widget.kpi);
|
|
142
|
+
return {
|
|
143
|
+
type: "kpi",
|
|
144
|
+
kpi: widget.kpi,
|
|
145
|
+
title: widget.title,
|
|
146
|
+
sectionIndex,
|
|
147
|
+
itemIndex,
|
|
148
|
+
isOnlyItemInSection,
|
|
149
|
+
size: getFilledSize(size, sizeInfo),
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
else if (isInsightWidget(widget)) {
|
|
153
|
+
const insight = insights.get(widget.insight);
|
|
154
|
+
const sizeInfo = getSizeInfo(settings, "kpi", insight);
|
|
155
|
+
return {
|
|
156
|
+
type: "insight",
|
|
157
|
+
insight,
|
|
158
|
+
sectionIndex,
|
|
159
|
+
itemIndex,
|
|
160
|
+
title: widget.title,
|
|
161
|
+
isOnlyItemInSection,
|
|
162
|
+
size: getFilledSize(size, sizeInfo),
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
else if (isRichTextWidget(widget)) {
|
|
166
|
+
const sizeInfo = getSizeInfo(settings, "richText");
|
|
167
|
+
return {
|
|
168
|
+
type: "richText",
|
|
169
|
+
sectionIndex,
|
|
170
|
+
itemIndex,
|
|
171
|
+
title: widget.title,
|
|
172
|
+
isOnlyItemInSection,
|
|
173
|
+
size: getFilledSize(size, sizeInfo),
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
else if (isVisualizationSwitcherWidget(widget)) {
|
|
177
|
+
const sizeInfo = getSizeInfo(settings, "visualizationSwitcher");
|
|
178
|
+
return {
|
|
179
|
+
type: "visualizationSwitcher",
|
|
180
|
+
sectionIndex,
|
|
181
|
+
itemIndex,
|
|
182
|
+
title: widget.title,
|
|
183
|
+
isOnlyItemInSection,
|
|
184
|
+
size: getFilledSize(size, sizeInfo),
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
else {
|
|
188
|
+
return {
|
|
189
|
+
type: widget.type,
|
|
190
|
+
widget,
|
|
191
|
+
sectionIndex,
|
|
192
|
+
itemIndex,
|
|
193
|
+
title: "",
|
|
194
|
+
isOnlyItemInSection,
|
|
195
|
+
size: getFilledSize(size),
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
//# sourceMappingURL=DashboardLayoutWidget.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DashboardLayoutWidget.js","sourceRoot":"","sources":["../../../src/presentation/flexibleLayout/DashboardLayoutWidget.tsx"],"names":[],"mappings":"AAAA,qCAAqC;AACrC,OAAO,EAIH,eAAe,EACf,WAAW,EACX,gBAAgB,EAChB,6BAA6B,GAChC,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAA0B,iCAAiC,EAAE,MAAM,sBAAsB,CAAC;AACjG,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,EAEH,cAAc,EACd,8BAA8B,EAC9B,iBAAiB,EACjB,kBAAkB,EAClB,cAAc,EACd,SAAS,EACT,oBAAoB,EACpB,oBAAoB,EACpB,yBAAyB,EACzB,yBAAyB,EACzB,yBAAyB,EACzB,cAAc,EACd,kBAAkB,GACrB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AACrF,OAAO,EAAE,WAAW,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AACxF,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAE5E,OAAO,EAAE,6BAA6B,EAAE,MAAM,+BAA+B,CAAC;AAC9E,OAAO,EAGH,OAAO,EACP,aAAa,EACb,gBAAgB,EAChB,mBAAmB,EACnB,uBAAuB,EACvB,mBAAmB,GACtB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,eAAe,EAAyB,MAAM,oBAAoB,CAAC;AAC5E,OAAO,EAAE,2BAA2B,EAAE,4BAA4B,EAAE,MAAM,gBAAgB,CAAC;AAC3F,OAAO,EACH,6CAA6C,GAGhD,MAAM,2CAA2C,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,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,OAAO,CAAC,CAAC;QAEvD,OAAO;YACH,IAAI,EAAE,SAAS;YACf,OAAO;YACP,YAAY;YACZ,SAAS;YACT,KAAK,EAAE,MAAM,CAAC,KAAK;YACnB,mBAAmB;YACnB,IAAI,EAAE,aAAa,CAAC,IAAI,EAAE,QAAQ,CAAC;SACtC,CAAC;IACN,CAAC;SAAM,IAAI,gBAAgB,CAAC,MAAM,CAAC,EAAE,CAAC;QAClC,MAAM,QAAQ,GAAG,WAAW,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;QAEnD,OAAO;YACH,IAAI,EAAE,UAAU;YAChB,YAAY;YACZ,SAAS;YACT,KAAK,EAAE,MAAM,CAAC,KAAK;YACnB,mBAAmB;YACnB,IAAI,EAAE,aAAa,CAAC,IAAI,EAAE,QAAQ,CAAC;SACtC,CAAC;IACN,CAAC;SAAM,IAAI,6BAA6B,CAAC,MAAM,CAAC,EAAE,CAAC;QAC/C,MAAM,QAAQ,GAAG,WAAW,CAAC,QAAQ,EAAE,uBAAuB,CAAC,CAAC;QAEhE,OAAO;YACH,IAAI,EAAE,uBAAuB;YAC7B,YAAY;YACZ,SAAS;YACT,KAAK,EAAE,MAAM,CAAC,KAAK;YACnB,mBAAmB;YACnB,IAAI,EAAE,aAAa,CAAC,IAAI,EAAE,QAAQ,CAAC;SACtC,CAAC;IACN,CAAC;SAAM,CAAC;QACJ,OAAO;YACH,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,MAAM;YACN,YAAY;YACZ,SAAS;YACT,KAAK,EAAE,EAAE;YACT,mBAAmB;YACnB,IAAI,EAAE,aAAa,CAAC,IAAI,CAAC;SAC5B,CAAC;IACN,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { IDashboardLayoutRenderProps } from "./interfaces.js";
|
|
3
|
+
/**
|
|
4
|
+
* DashboardLayout is customizable component for rendering {@link IDashboardLayout}.
|
|
5
|
+
*
|
|
6
|
+
* @alpha
|
|
7
|
+
*/
|
|
8
|
+
export declare function DashboardLayout<TWidget>(props: IDashboardLayoutRenderProps<TWidget>): JSX.Element;
|
|
9
|
+
//# sourceMappingURL=DashboardLayout.d.ts.map
|
package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/DashboardLayout.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DashboardLayout.d.ts","sourceRoot":"","sources":["../../../../src/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/DashboardLayout.tsx"],"names":[],"mappings":";AAgBA,OAAO,EACH,2BAA2B,EAI9B,MAAM,iBAAiB,CAAC;AAoBzB;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,KAAK,EAAE,2BAA2B,CAAC,OAAO,CAAC,GAAG,GAAG,CAAC,OAAO,CAwGjG"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import cx from "classnames";
|
|
2
|
+
import isEqual from "lodash/isEqual.js";
|
|
3
|
+
import React, { useCallback, useMemo } from "react";
|
|
4
|
+
import { Container, ScreenClassProvider, ScreenClassRender, setConfiguration, } from "react-grid-system";
|
|
5
|
+
import { DashboardLayoutFacade } from "../../../_staging/dashboard/fluidLayout/facade/layout.js";
|
|
6
|
+
import { DASHBOARD_LAYOUT_GRID_CONFIGURATION } from "../../constants/index.js";
|
|
7
|
+
import { emptyDOMRect } from "../constants.js";
|
|
8
|
+
import { DashboardLayoutSection } from "./DashboardLayoutSection.js";
|
|
9
|
+
import { getLayoutWithoutGridHeights, getResizedItemPositions, unifyDashboardLayoutItemHeights, } from "./utils/sizing.js";
|
|
10
|
+
setConfiguration(DASHBOARD_LAYOUT_GRID_CONFIGURATION);
|
|
11
|
+
const removeHeights = (layout, enableCustomHeight) => {
|
|
12
|
+
if (enableCustomHeight) {
|
|
13
|
+
return layout;
|
|
14
|
+
}
|
|
15
|
+
return getLayoutWithoutGridHeights(layout);
|
|
16
|
+
};
|
|
17
|
+
const defaultSectionKeyGetter = ({ section }) => section.index().toString();
|
|
18
|
+
/**
|
|
19
|
+
* DashboardLayout is customizable component for rendering {@link IDashboardLayout}.
|
|
20
|
+
*
|
|
21
|
+
* @alpha
|
|
22
|
+
*/
|
|
23
|
+
export function DashboardLayout(props) {
|
|
24
|
+
const { layout, sectionKeyGetter = defaultSectionKeyGetter, sectionRenderer, sectionHeaderRenderer, itemKeyGetter, itemRenderer, widgetRenderer, gridRowRenderer, className, debug, onMouseLeave, enableCustomHeight, renderMode = "view", } = props;
|
|
25
|
+
const layoutRef = React.useRef(null);
|
|
26
|
+
const { layoutFacade, resizedItemPositions } = useMemo(() => {
|
|
27
|
+
const updatedLayout = removeHeights(layout, !!enableCustomHeight);
|
|
28
|
+
const layoutFacade = DashboardLayoutFacade.for(unifyDashboardLayoutItemHeights(updatedLayout));
|
|
29
|
+
const resizedItemPositions = getResizedItemPositions(layout, layoutFacade.raw());
|
|
30
|
+
return { layoutFacade, resizedItemPositions };
|
|
31
|
+
}, [layout, enableCustomHeight]);
|
|
32
|
+
const sectionRendererWrapped = useCallback((renderProps) => sectionRenderer ? (sectionRenderer({
|
|
33
|
+
...renderProps,
|
|
34
|
+
debug,
|
|
35
|
+
})) : (React.createElement(renderProps.DefaultSectionRenderer, { ...renderProps, debug: debug })), [debug, sectionRenderer]);
|
|
36
|
+
const getLayoutDimensions = useCallback(function () {
|
|
37
|
+
return layoutRef?.current ? layoutRef.current.getBoundingClientRect() : emptyDOMRect;
|
|
38
|
+
}, []);
|
|
39
|
+
const widgetRendererWrapped = useCallback((renderProps) => {
|
|
40
|
+
const isResizedByLayoutSizingStrategy = resizedItemPositions.some((position) => isEqual(position, [renderProps.item.section().index(), renderProps.item.index()]));
|
|
41
|
+
return widgetRenderer ? (widgetRenderer({
|
|
42
|
+
...renderProps,
|
|
43
|
+
isResizedByLayoutSizingStrategy,
|
|
44
|
+
debug,
|
|
45
|
+
getLayoutDimensions: getLayoutDimensions,
|
|
46
|
+
})) : (React.createElement(renderProps.DefaultWidgetRenderer, { ...renderProps, debug: debug, isResizedByLayoutSizingStrategy: isResizedByLayoutSizingStrategy, getLayoutDimensions: getLayoutDimensions }));
|
|
47
|
+
}, [debug, resizedItemPositions, widgetRenderer]);
|
|
48
|
+
return (React.createElement("div", { className: cx("gd-fluidlayout-container", "s-fluid-layout-container", "gd-dashboards", className), onMouseLeave: onMouseLeave, ref: layoutRef },
|
|
49
|
+
React.createElement(ScreenClassProvider, { useOwnWidth: false },
|
|
50
|
+
React.createElement(ScreenClassRender, { render: (screenClass) => {
|
|
51
|
+
const screen = screenClass;
|
|
52
|
+
return screen ? (React.createElement(Container, { fluid: true, className: "gd-fluidlayout-layout s-fluid-layout" }, layoutFacade.sections().map((section) => {
|
|
53
|
+
return (React.createElement(DashboardLayoutSection, { key: sectionKeyGetter({ section, screen }), section: section, sectionRenderer: sectionRendererWrapped, sectionHeaderRenderer: sectionHeaderRenderer, itemKeyGetter: itemKeyGetter, itemRenderer: itemRenderer, gridRowRenderer: gridRowRenderer, widgetRenderer: widgetRendererWrapped, screen: screen, renderMode: renderMode, getLayoutDimensions: getLayoutDimensions }));
|
|
54
|
+
}))) : null;
|
|
55
|
+
} }))));
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=DashboardLayout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DashboardLayout.js","sourceRoot":"","sources":["../../../../src/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/DashboardLayout.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,OAAO,MAAM,mBAAmB,CAAC;AACxC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACpD,OAAO,EACH,SAAS,EAET,mBAAmB,EACnB,iBAAiB,EACjB,gBAAgB,GACnB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,qBAAqB,EAAE,MAAM,0DAA0D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,mBAAmB,GAC1C,CACL,CAAC;IACN,CAAC,EACD,CAAC,KAAK,EAAE,oBAAoB,EAAE,cAAc,CAAC,CAChD,CAAC;IAEF,OAAO,CACH,6BACI,SAAS,EAAE,EAAE,CAAC,0BAA0B,EAAE,0BAA0B,EAAE,eAAe,EAAE,SAAS,CAAC,EACjG,YAAY,EAAE,YAAY,EAC1B,GAAG,EAAE,SAAS;QAEd,oBAAC,mBAAmB,IAAC,WAAW,EAAE,KAAK;YACnC,oBAAC,iBAAiB,IACd,MAAM,EAAE,CAAC,WAAwB,EAAE,EAAE;oBACjC,MAAM,MAAM,GAAG,WAAyB,CAAC;oBACzC,OAAO,MAAM,CAAC,CAAC,CAAC,CACZ,oBAAC,SAAS,IAAC,KAAK,EAAE,IAAI,EAAE,SAAS,EAAC,sCAAsC,IACnE,YAAY,CAAC,QAAQ,EAAE,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE;wBACrC,OAAO,CACH,oBAAC,sBAAsB,IACnB,GAAG,EAAE,gBAAgB,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,EAC1C,OAAO,EAAE,OAAO,EAChB,eAAe,EAAE,sBAAsB,EACvC,qBAAqB,EAAE,qBAAqB,EAC5C,aAAa,EAAE,aAAa,EAC5B,YAAY,EAAE,YAAY,EAC1B,eAAe,EAAE,eAAe,EAChC,cAAc,EAAE,qBAAqB,EACrC,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,UAAU,EACtB,mBAAmB,EAAE,mBAAmB,GAC1C,CACL,CAAC;oBACN,CAAC,CAAC,CACM,CACf,CAAC,CAAC,CAAC,IAAI,CAAC;gBACb,CAAC,GACH,CACgB,CACpB,CACT,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { IDashboardLayoutSectionHeaderRenderProps } from "./interfaces.js";
|
|
3
|
+
export declare function DashboardLayoutEditSectionHeaderRenderer(props: IDashboardLayoutSectionHeaderRenderProps<any>): JSX.Element | null;
|
|
4
|
+
//# sourceMappingURL=DashboardLayoutEditSectionHeaderRenderer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DashboardLayoutEditSectionHeaderRenderer.d.ts","sourceRoot":"","sources":["../../../../src/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/DashboardLayoutEditSectionHeaderRenderer.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAE,wCAAwC,EAAE,MAAM,iBAAiB,CAAC;AAS3E,wBAAgB,wCAAwC,CACpD,KAAK,EAAE,wCAAwC,CAAC,GAAG,CAAC,GACrD,GAAG,CAAC,OAAO,GAAG,IAAI,CAkCpB"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// (C) 2019-2024 GoodData Corporation
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { DashboardLayoutSectionHeader } from "./DashboardLayoutSectionHeader.js";
|
|
4
|
+
import { SectionHeaderEditable } from "./EditableHeader/SectionHeaderEditable.js";
|
|
5
|
+
import { emptyItemFacadeWithFullSize } from "./utils/emptyFacade.js";
|
|
6
|
+
import { SectionHotspot } from "../../dragAndDrop/index.js";
|
|
7
|
+
import { isInitialPlaceholderWidget } from "../../../widgets/index.js";
|
|
8
|
+
import { DashboardLayoutItemViewRenderer } from "./DashboardLayoutItemViewRenderer.js";
|
|
9
|
+
import { getRefsForSection } from "../refs.js";
|
|
10
|
+
import { selectIsSectionInsertedByPlugin, useDashboardSelector } from "../../../model/index.js";
|
|
11
|
+
export function DashboardLayoutEditSectionHeaderRenderer(props) {
|
|
12
|
+
const { section, screen } = props;
|
|
13
|
+
const sectionHeader = section.header();
|
|
14
|
+
const isInitialDropzone = section.index() === 0 && section.items().every((i) => isInitialPlaceholderWidget(i.widget()));
|
|
15
|
+
const refs = getRefsForSection(section);
|
|
16
|
+
const isEditingDisabled = useDashboardSelector(selectIsSectionInsertedByPlugin(refs));
|
|
17
|
+
return (React.createElement(DashboardLayoutItemViewRenderer, { DefaultItemRenderer: DashboardLayoutItemViewRenderer, item: emptyItemFacadeWithFullSize, screen: screen },
|
|
18
|
+
React.createElement(DashboardLayoutSectionHeader, { title: sectionHeader?.title, description: sectionHeader?.description, renderBeforeHeader: !isInitialDropzone && React.createElement(SectionHotspot, { index: section.index(), targetPosition: "above" }), renderHeader: !isInitialDropzone && !isEditingDisabled ? (React.createElement(SectionHeaderEditable, { title: sectionHeader?.title || "", description: sectionHeader?.description || "", index: section.index() })) : undefined })));
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=DashboardLayoutEditSectionHeaderRenderer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DashboardLayoutEditSectionHeaderRenderer.js","sourceRoot":"","sources":["../../../../src/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/DashboardLayoutEditSectionHeaderRenderer.tsx"],"names":[],"mappings":"AAAA,qCAAqC;AACrC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,4BAA4B,EAAE,MAAM,mCAAmC,CAAC;AAEjF,OAAO,EAAE,qBAAqB,EAAE,MAAM,2CAA2C,CAAC;AAClF,OAAO,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAC;AACvE,OAAO,EAAE,+BAA+B,EAAE,MAAM,sCAAsC,CAAC;AACvF,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAE,+BAA+B,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAEhG,MAAM,UAAU,wCAAwC,CACpD,KAAoD;IAEpD,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC;IAClC,MAAM,aAAa,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAEvC,MAAM,iBAAiB,GACnB,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,0BAA0B,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;IAElG,MAAM,IAAI,GAAG,iBAAiB,CAAC,OAAO,CAAC,CAAC;IACxC,MAAM,iBAAiB,GAAG,oBAAoB,CAAC,+BAA+B,CAAC,IAAI,CAAC,CAAC,CAAC;IAEtF,OAAO,CACH,oBAAC,+BAA+B,IAC5B,mBAAmB,EAAE,+BAA+B,EACpD,IAAI,EAAE,2BAA2B,EACjC,MAAM,EAAE,MAAM;QAEd,oBAAC,4BAA4B,IACzB,KAAK,EAAE,aAAa,EAAE,KAAK,EAC3B,WAAW,EAAE,aAAa,EAAE,WAAW,EACvC,kBAAkB,EACd,CAAC,iBAAiB,IAAI,oBAAC,cAAc,IAAC,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,EAAE,cAAc,EAAC,OAAO,GAAG,EAE3F,YAAY,EACR,CAAC,iBAAiB,IAAI,CAAC,iBAAiB,CAAC,CAAC,CAAC,CACvC,oBAAC,qBAAqB,IAClB,KAAK,EAAE,aAAa,EAAE,KAAK,IAAI,EAAE,EACjC,WAAW,EAAE,aAAa,EAAE,WAAW,IAAI,EAAE,EAC7C,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,GACxB,CACL,CAAC,CAAC,CAAC,SAAS,GAEnB,CAC4B,CACrC,CAAC;AACN,CAAC"}
|
package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/DashboardLayoutGridRow.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { ScreenSize } from "@gooddata/sdk-model";
|
|
3
|
+
import { RenderMode } from "../../../types.js";
|
|
4
|
+
import { IDashboardLayoutItemFacade, IDashboardLayoutSectionFacade } from "../../../_staging/dashboard/fluidLayout/facade/interfaces.js";
|
|
5
|
+
import { IDashboardLayoutGridRowRenderer, IDashboardLayoutItemKeyGetter, IDashboardLayoutItemRenderer, IDashboardLayoutWidgetRenderer } from "./interfaces.js";
|
|
6
|
+
/**
|
|
7
|
+
* @alpha
|
|
8
|
+
*/
|
|
9
|
+
export interface DashboardLayoutGridRowProps<TWidget> {
|
|
10
|
+
screen: ScreenSize;
|
|
11
|
+
section: IDashboardLayoutSectionFacade<TWidget>;
|
|
12
|
+
itemKeyGetter?: IDashboardLayoutItemKeyGetter<TWidget>;
|
|
13
|
+
itemRenderer?: IDashboardLayoutItemRenderer<TWidget>;
|
|
14
|
+
widgetRenderer: IDashboardLayoutWidgetRenderer<TWidget>;
|
|
15
|
+
gridRowRenderer?: IDashboardLayoutGridRowRenderer<TWidget>;
|
|
16
|
+
getLayoutDimensions: () => DOMRect;
|
|
17
|
+
items: IDashboardLayoutItemFacade<TWidget>[];
|
|
18
|
+
renderMode: RenderMode;
|
|
19
|
+
}
|
|
20
|
+
export declare function DashboardLayoutGridRow<TWidget>(props: DashboardLayoutGridRowProps<TWidget>): JSX.Element;
|
|
21
|
+
//# sourceMappingURL=DashboardLayoutGridRow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DashboardLayoutGridRow.d.ts","sourceRoot":"","sources":["../../../../src/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/DashboardLayoutGridRow.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAGjD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EACH,0BAA0B,EAC1B,6BAA6B,EAChC,MAAM,8DAA8D,CAAC;AAEtE,OAAO,EACH,+BAA+B,EAC/B,6BAA6B,EAC7B,4BAA4B,EAC5B,8BAA8B,EACjC,MAAM,iBAAiB,CAAC;AAEzB;;GAEG;AACH,MAAM,WAAW,2BAA2B,CAAC,OAAO;IAChD,MAAM,EAAE,UAAU,CAAC;IACnB,OAAO,EAAE,6BAA6B,CAAC,OAAO,CAAC,CAAC;IAChD,aAAa,CAAC,EAAE,6BAA6B,CAAC,OAAO,CAAC,CAAC;IACvD,YAAY,CAAC,EAAE,4BAA4B,CAAC,OAAO,CAAC,CAAC;IACrD,cAAc,EAAE,8BAA8B,CAAC,OAAO,CAAC,CAAC;IACxD,eAAe,CAAC,EAAE,+BAA+B,CAAC,OAAO,CAAC,CAAC;IAC3D,mBAAmB,EAAE,MAAM,OAAO,CAAC;IACnC,KAAK,EAAE,0BAA0B,CAAC,OAAO,CAAC,EAAE,CAAC;IAC7C,UAAU,EAAE,UAAU,CAAC;CAC1B;AAID,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,KAAK,EAAE,2BAA2B,CAAC,OAAO,CAAC,GAAG,GAAG,CAAC,OAAO,CAmCxG"}
|
package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/DashboardLayoutGridRow.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Row } from "react-grid-system";
|
|
3
|
+
import { DashboardLayoutItem } from "./DashboardLayoutItem.js";
|
|
4
|
+
const defaultItemKeyGetter = ({ item }) => item.index().toString();
|
|
5
|
+
export function DashboardLayoutGridRow(props) {
|
|
6
|
+
const { section, itemKeyGetter = defaultItemKeyGetter, gridRowRenderer, itemRenderer, widgetRenderer, screen, items, renderMode, } = props;
|
|
7
|
+
const rowItems = items.map((item) => (React.createElement(DashboardLayoutItem, { key: itemKeyGetter({ item, screen }), item: item, itemRenderer: itemRenderer, widgetRenderer: widgetRenderer, screen: screen })));
|
|
8
|
+
return (React.createElement(Row, { className: "gd-fluidlayout-row s-gd-fluid-layout-row" }, gridRowRenderer
|
|
9
|
+
? gridRowRenderer({
|
|
10
|
+
children: rowItems,
|
|
11
|
+
screen,
|
|
12
|
+
section,
|
|
13
|
+
items,
|
|
14
|
+
renderMode,
|
|
15
|
+
})
|
|
16
|
+
: rowItems));
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=DashboardLayoutGridRow.js.map
|
package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/DashboardLayoutGridRow.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DashboardLayoutGridRow.js","sourceRoot":"","sources":["../../../../src/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/DashboardLayoutGridRow.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAMxC,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAuB/D,MAAM,oBAAoB,GAA2C,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,QAAQ,EAAE,CAAC;AAE3G,MAAM,UAAU,sBAAsB,CAAU,KAA2C;IACvF,MAAM,EACF,OAAO,EACP,aAAa,GAAG,oBAAoB,EACpC,eAAe,EACf,YAAY,EACZ,cAAc,EACd,MAAM,EACN,KAAK,EACL,UAAU,GACb,GAAG,KAAK,CAAC;IAEV,MAAM,QAAQ,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CACjC,oBAAC,mBAAmB,IAChB,GAAG,EAAE,aAAa,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,EACpC,IAAI,EAAE,IAAI,EACV,YAAY,EAAE,YAAY,EAC1B,cAAc,EAAE,cAAc,EAC9B,MAAM,EAAE,MAAM,GAChB,CACL,CAAC,CAAC;IAEH,OAAO,CACH,oBAAC,GAAG,IAAC,SAAS,EAAC,0CAA0C,IACpD,eAAe;QACZ,CAAC,CAAC,eAAe,CAAC;YACZ,QAAQ,EAAE,QAAQ;YAClB,MAAM;YACN,OAAO;YACP,KAAK;YACL,UAAU;SACb,CAAC;QACJ,CAAC,CAAC,QAAQ,CACZ,CACT,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { DashboardLayoutGridRowProps } from "./DashboardLayoutGridRow.js";
|
|
3
|
+
import { IDashboardLayoutItemFacade } from "../../../_staging/dashboard/fluidLayout/facade/interfaces.js";
|
|
4
|
+
export declare function DashboardLayoutGridRowEdit<TWidget>(props: DashboardLayoutGridRowProps<TWidget> & {
|
|
5
|
+
itemsInRowsByIndex: [number, IDashboardLayoutItemFacade<TWidget>[]][];
|
|
6
|
+
}): JSX.Element;
|
|
7
|
+
//# sourceMappingURL=DashboardLayoutGridRowEdit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DashboardLayoutGridRowEdit.d.ts","sourceRoot":"","sources":["../../../../src/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/DashboardLayoutGridRowEdit.tsx"],"names":[],"mappings":";AAMA,OAAO,EAAE,2BAA2B,EAAE,MAAM,6BAA6B,CAAC;AAG1E,OAAO,EAAE,0BAA0B,EAAE,MAAM,8DAA8D,CAAC;AAI1G,wBAAgB,0BAA0B,CAAC,OAAO,EAC9C,KAAK,EAAE,2BAA2B,CAAC,OAAO,CAAC,GAAG;IAC1C,kBAAkB,EAAE,CAAC,MAAM,EAAE,0BAA0B,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,CAAC;CACzE,GACF,GAAG,CAAC,OAAO,CAiEb"}
|
package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/DashboardLayoutGridRowEdit.js
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// (C) 2007-2024 GoodData Corporation
|
|
2
|
+
import React, { useMemo } from "react";
|
|
3
|
+
import { Col, Row } from "react-grid-system";
|
|
4
|
+
import reverse from "lodash/fp/reverse.js";
|
|
5
|
+
import { HeightResizerHotspot, useIsDraggingWidget } from "../../dragAndDrop/index.js";
|
|
6
|
+
import { DashboardLayoutItem } from "./DashboardLayoutItem.js";
|
|
7
|
+
const defaultItemKeyGetter = ({ item }) => item.index().toString();
|
|
8
|
+
export function DashboardLayoutGridRowEdit(props) {
|
|
9
|
+
const { section, itemKeyGetter = defaultItemKeyGetter, gridRowRenderer, itemRenderer, widgetRenderer, getLayoutDimensions, screen, items, renderMode, itemsInRowsByIndex, } = props;
|
|
10
|
+
const isDraggingWidget = useIsDraggingWidget();
|
|
11
|
+
const rowItems = useMemo(() => items.map((item) => (React.createElement(DashboardLayoutItem, { key: itemKeyGetter({ item, screen }), item: item, itemRenderer: itemRenderer, widgetRenderer: widgetRenderer, screen: screen }))), [itemKeyGetter, itemRenderer, items, screen, widgetRenderer]);
|
|
12
|
+
const extendedRows = useMemo(() => isDraggingWidget
|
|
13
|
+
? rowItems
|
|
14
|
+
: reverse(itemsInRowsByIndex).reduce((acc, [index, itemsInRow]) => {
|
|
15
|
+
return splice(acc, index + 1, 0, React.createElement(Col, { xl: 12, key: `HeightResizerHotspot-${index}`, style: { minHeight: 0 } },
|
|
16
|
+
React.createElement(HeightResizerHotspot, { key: `HeightResizerHotspot-${index}`, screen: screen, getLayoutDimensions: getLayoutDimensions, section: section, items: itemsInRow })));
|
|
17
|
+
}, rowItems), [isDraggingWidget, rowItems, itemsInRowsByIndex, screen, getLayoutDimensions, section]);
|
|
18
|
+
return (React.createElement(Row, { className: "gd-fluidlayout-row s-gd-fluid-layout-row" }, gridRowRenderer
|
|
19
|
+
? gridRowRenderer({
|
|
20
|
+
children: extendedRows,
|
|
21
|
+
screen,
|
|
22
|
+
section,
|
|
23
|
+
items,
|
|
24
|
+
renderMode,
|
|
25
|
+
})
|
|
26
|
+
: extendedRows));
|
|
27
|
+
}
|
|
28
|
+
function splice(arr, start, deleteCount, ...addItem) {
|
|
29
|
+
const result = [];
|
|
30
|
+
if (start > 0) {
|
|
31
|
+
result.push(...arr.slice(0, start));
|
|
32
|
+
}
|
|
33
|
+
result.push(...addItem);
|
|
34
|
+
const len = result.length - addItem.length;
|
|
35
|
+
const count = deleteCount <= 0 ? len : len + deleteCount;
|
|
36
|
+
if (arr[count]) {
|
|
37
|
+
result.push(...arr.slice(count));
|
|
38
|
+
}
|
|
39
|
+
return result;
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=DashboardLayoutGridRowEdit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DashboardLayoutGridRowEdit.js","sourceRoot":"","sources":["../../../../src/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/DashboardLayoutGridRowEdit.tsx"],"names":[],"mappings":"AAAA,qCAAqC;AACrC,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,OAAO,MAAM,sBAAsB,CAAC;AAE3C,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAEvF,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAI/D,MAAM,oBAAoB,GAA2C,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,QAAQ,EAAE,CAAC;AAE3G,MAAM,UAAU,0BAA0B,CACtC,KAEC;IAED,MAAM,EACF,OAAO,EACP,aAAa,GAAG,oBAAoB,EACpC,eAAe,EACf,YAAY,EACZ,cAAc,EACd,mBAAmB,EACnB,MAAM,EACN,KAAK,EACL,UAAU,EACV,kBAAkB,GACrB,GAAG,KAAK,CAAC;IAEV,MAAM,gBAAgB,GAAG,mBAAmB,EAAE,CAAC;IAC/C,MAAM,QAAQ,GAAG,OAAO,CACpB,GAAG,EAAE,CACD,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAChB,oBAAC,mBAAmB,IAChB,GAAG,EAAE,aAAa,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC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M,MAAM,GAAG,EAAE,CAAC;IAClB,IAAI,KAAK,GAAG,CAAC,EAAE,CAAC;QACZ,MAAM,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;IACxC,CAAC;IACD,MAAM,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,CAAC;IACxB,MAAM,GAAG,GAAG,MAAM,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAC3C,MAAM,KAAK,GAAG,WAAW,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,WAAW,CAAC;IACzD,IAAI,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;QACb,MAAM,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;IACrC,CAAC;IACD,OAAO,MAAM,CAAC;AAClB,CAAC"}
|
package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/DashboardLayoutItem.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { ScreenSize } from "@gooddata/sdk-model";
|
|
3
|
+
import { IDashboardLayoutItemRenderer, IDashboardLayoutWidgetRenderer } from "./interfaces.js";
|
|
4
|
+
import { IDashboardLayoutItemFacade } from "../../../_staging/dashboard/fluidLayout/facade/interfaces.js";
|
|
5
|
+
/**
|
|
6
|
+
* @alpha
|
|
7
|
+
*/
|
|
8
|
+
export interface IDashboardLayoutItemProps<TWidget> {
|
|
9
|
+
item: IDashboardLayoutItemFacade<TWidget>;
|
|
10
|
+
screen: ScreenSize;
|
|
11
|
+
itemRenderer?: IDashboardLayoutItemRenderer<TWidget>;
|
|
12
|
+
widgetRenderer: IDashboardLayoutWidgetRenderer<TWidget>;
|
|
13
|
+
}
|
|
14
|
+
export declare function DashboardLayoutItem<TWidget>(props: IDashboardLayoutItemProps<TWidget>): JSX.Element;
|
|
15
|
+
//# sourceMappingURL=DashboardLayoutItem.d.ts.map
|
package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/DashboardLayoutItem.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DashboardLayoutItem.d.ts","sourceRoot":"","sources":["../../../../src/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/DashboardLayoutItem.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EACH,4BAA4B,EAC5B,8BAA8B,EAEjC,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,0BAA0B,EAAE,MAAM,8DAA8D,CAAC;AAI1G;;GAEG;AACH,MAAM,WAAW,yBAAyB,CAAC,OAAO;IAC9C,IAAI,EAAE,0BAA0B,CAAC,OAAO,CAAC,CAAC;IAC1C,MAAM,EAAE,UAAU,CAAC;IACnB,YAAY,CAAC,EAAE,4BAA4B,CAAC,OAAO,CAAC,CAAC;IACrD,cAAc,EAAE,8BAA8B,CAAC,OAAO,CAAC,CAAC;CAC3D;AAMD,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,KAAK,EAAE,yBAAyB,CAAC,OAAO,CAAC,GAAG,GAAG,CAAC,OAAO,CAcnG"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// (C) 2007-2024 GoodData Corporation
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { DashboardLayoutItemRenderer } from "./DashboardLayoutItemRenderer.js";
|
|
4
|
+
import { DashboardLayoutWidgetRenderer } from "./DashboardLayoutWidgetRenderer.js";
|
|
5
|
+
const defaultItemRenderer = (props) => (React.createElement(DashboardLayoutItemRenderer, { ...props }));
|
|
6
|
+
export function DashboardLayoutItem(props) {
|
|
7
|
+
const { item, itemRenderer = defaultItemRenderer, widgetRenderer, screen } = props;
|
|
8
|
+
const renderProps = {
|
|
9
|
+
item,
|
|
10
|
+
screen,
|
|
11
|
+
DefaultWidgetRenderer: DashboardLayoutWidgetRenderer,
|
|
12
|
+
};
|
|
13
|
+
return itemRenderer({
|
|
14
|
+
...props,
|
|
15
|
+
DefaultItemRenderer: DashboardLayoutItemRenderer,
|
|
16
|
+
children: widgetRenderer(renderProps),
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=DashboardLayoutItem.js.map
|
package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/DashboardLayoutItem.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DashboardLayoutItem.js","sourceRoot":"","sources":["../../../../src/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/DashboardLayoutItem.tsx"],"names":[],"mappings":"AAAA,qCAAqC;AAErC,OAAO,KAAK,MAAM,OAAO,CAAC;AAQ1B,OAAO,EAAE,2BAA2B,EAAE,MAAM,kCAAkC,CAAC;AAC/E,OAAO,EAAE,6BAA6B,EAAE,MAAM,oCAAoC,CAAC;AAYnF,MAAM,mBAAmB,GAA0C,CAAC,KAAK,EAAE,EAAE,CAAC,CAC1E,oBAAC,2BAA2B,OAAK,KAAK,GAAI,CAC7C,CAAC;AAEF,MAAM,UAAU,mBAAmB,CAAU,KAAyC;IAClF,MAAM,EAAE,IAAI,EAAE,YAAY,GAAG,mBAAmB,EAAE,cAAc,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC;IAEnF,MAAM,WAAW,GAAG;QAChB,IAAI;QACJ,MAAM;QACN,qBAAqB,EAAE,6BAA6B;KACT,CAAC;IAEhD,OAAO,YAAY,CAAC;QAChB,GAAG,KAAK;QACR,mBAAmB,EAAE,2BAA2B;QAChD,QAAQ,EAAE,cAAc,CAAC,WAAW,CAAC;KACxC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DashboardLayoutItemRenderer.d.ts","sourceRoot":"","sources":["../../../../src/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/DashboardLayoutItemRenderer.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,4BAA4B,EAAE,MAAM,iBAAiB,CAAC;AAsC/D;;GAEG;AACH,eAAO,MAAM,2BAA2B,uCAGG,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// (C) 2007-2024 GoodData Corporation
|
|
2
|
+
import cx from "classnames";
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { RowEndHotspot, WidgetDropZoneColumn, useIsDraggingCurrentItem } from "../../dragAndDrop/index.js";
|
|
5
|
+
import { DashboardLayoutItemViewRenderer } from "./DashboardLayoutItemViewRenderer.js";
|
|
6
|
+
import { renderModeAware } from "../../componentDefinition/index.js";
|
|
7
|
+
import { isCustomWidgetBase } from "../../../model/index.js";
|
|
8
|
+
function getLayoutCoordinates(item) {
|
|
9
|
+
return {
|
|
10
|
+
sectionIndex: item.section()?.index(),
|
|
11
|
+
itemIndex: item.index(),
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
const DashboardLayoutItemEditRenderer = (props) => {
|
|
15
|
+
const { item, screen, children } = props;
|
|
16
|
+
const { sectionIndex, itemIndex } = getLayoutCoordinates(item);
|
|
17
|
+
const isDraggingCurrentItem = useIsDraggingCurrentItem(sectionIndex, itemIndex);
|
|
18
|
+
const isCustomWidget = isCustomWidgetBase(item.widget());
|
|
19
|
+
return (React.createElement(React.Fragment, null,
|
|
20
|
+
isCustomWidget ? null : (React.createElement(WidgetDropZoneColumn, { screen: screen, sectionIndex: sectionIndex, itemIndex: itemIndex })),
|
|
21
|
+
React.createElement(DashboardLayoutItemViewRenderer, { ...props, className: cx({
|
|
22
|
+
"current-dragging-item": isDraggingCurrentItem,
|
|
23
|
+
}) }, children),
|
|
24
|
+
isCustomWidget ? null : React.createElement(RowEndHotspot, { item: item, screen: screen })));
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* @internal
|
|
28
|
+
*/
|
|
29
|
+
export const DashboardLayoutItemRenderer = renderModeAware({
|
|
30
|
+
view: DashboardLayoutItemViewRenderer,
|
|
31
|
+
edit: DashboardLayoutItemEditRenderer,
|
|
32
|
+
});
|
|
33
|
+
//# sourceMappingURL=DashboardLayoutItemRenderer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DashboardLayoutItemRenderer.js","sourceRoot":"","sources":["../../../../src/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/DashboardLayoutItemRenderer.tsx"],"names":[],"mappings":"AAAA,qCAAqC;AACrC,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAC3G,OAAO,EAAE,+BAA+B,EAAE,MAAM,sCAAsC,CAAC;AAEvF,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AACrE,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE7D,SAAS,oBAAoB,CAAC,IAAyC;IACnE,OAAO;QACH,YAAY,EAAE,IAAI,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE;QACrC,SAAS,EAAE,IAAI,CAAC,KAAK,EAAE;KAC1B,CAAC;AACN,CAAC;AAED,MAAM,+BAA+B,GAA0C,CAAC,KAAK,EAAE,EAAE;IACrF,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IAEzC,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,GAAG,oBAAoB,CAAC,IAAI,CAAC,CAAC;IAE/D,MAAM,qBAAqB,GAAG,wBAAwB,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC;IAEhF,MAAM,cAAc,GAAG,kBAAkB,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;IAEzD,OAAO,CACH;QACK,cAAc,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CACrB,oBAAC,oBAAoB,IAAC,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,YAAY,EAAE,SAAS,EAAE,SAAS,GAAI,CAC7F;QACD,oBAAC,+BAA+B,OACxB,KAAK,EACT,SAAS,EAAE,EAAE,CAAC;gBACV,uBAAuB,EAAE,qBAAqB;aACjD,CAAC,IAED,QAAQ,CACqB;QACjC,cAAc,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,oBAAC,aAAa,IAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,GAAI,CACvE,CACN,CAAC;AACN,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,eAAe,CAAwC;IAC9F,IAAI,EAAE,+BAA+B;IACrC,IAAI,EAAE,+BAA+B;CACxC,CAA0C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DashboardLayoutItemViewRenderer.d.ts","sourceRoot":"","sources":["../../../../src/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/DashboardLayoutItemViewRenderer.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,4BAA4B,EAAE,MAAM,iBAAiB,CAAC;AAK/D,eAAO,MAAM,+BAA+B,EAAE,4BAA4B,CAAC,OAAO,CAyCjF,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import cx from "classnames";
|
|
2
|
+
import isNil from "lodash/isNil.js";
|
|
3
|
+
import React, { useMemo } from "react";
|
|
4
|
+
import { Col } from "react-grid-system";
|
|
5
|
+
const isHiddenStyle = { height: 0, width: 0, overflow: "hidden", flex: 0 };
|
|
6
|
+
export const DashboardLayoutItemViewRenderer = (props) => {
|
|
7
|
+
const { item, screen, children, className, minHeight = 0, isHidden } = props;
|
|
8
|
+
const { size, ratio, width, height } = getSizeForItem(item, screen);
|
|
9
|
+
const style = useMemo(() => {
|
|
10
|
+
let computedStyle = {
|
|
11
|
+
minHeight,
|
|
12
|
+
};
|
|
13
|
+
if (isHidden) {
|
|
14
|
+
computedStyle = {
|
|
15
|
+
...computedStyle,
|
|
16
|
+
...isHiddenStyle,
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
return computedStyle;
|
|
20
|
+
}, [minHeight, isHidden]);
|
|
21
|
+
return (React.createElement(Col, { xl: size?.xl?.gridWidth, lg: size?.lg?.gridWidth, md: size?.md?.gridWidth, sm: size?.sm?.gridWidth, xs: size?.xs?.gridWidth, className: cx("gd-fluidlayout-column", "s-fluid-layout-column", `s-fluid-layout-screen-${screen}`, `s-fluid-layout-column-width-${width}`, {
|
|
22
|
+
[`s-fluid-layout-column-ratio-${ratio}`]: !isNil(ratio),
|
|
23
|
+
[`s-fluid-layout-column-height-${height}`]: !isNil(height),
|
|
24
|
+
}, className), style: style }, children));
|
|
25
|
+
};
|
|
26
|
+
function getSizeForItem(item, screen) {
|
|
27
|
+
const size = item.size();
|
|
28
|
+
const currentScreenSizeConfiguration = item.sizeForScreen(screen);
|
|
29
|
+
const ratio = currentScreenSizeConfiguration?.heightAsRatio;
|
|
30
|
+
const height = currentScreenSizeConfiguration?.gridHeight;
|
|
31
|
+
const width = currentScreenSizeConfiguration?.gridWidth;
|
|
32
|
+
return {
|
|
33
|
+
height,
|
|
34
|
+
width,
|
|
35
|
+
ratio,
|
|
36
|
+
size,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=DashboardLayoutItemViewRenderer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DashboardLayoutItemViewRenderer.js","sourceRoot":"","sources":["../../../../src/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/DashboardLayoutItemViewRenderer.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,KAAK,MAAM,iBAAiB,CAAC;AACpC,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAE,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