* In progress fixes for auto height perf * Revert collapse logic * Revert changes * Remove console logs, and fix tests * Fix scenario where container widgets don't collapse * Bring back hidden widgets * fix: Overlapping of widgets while reflowing other widgets (#18460) * fix: api url z-index to show it above response panel (#18200) * chore: Switched to sequential checks instead of a parallel one for RTS check (#18440) fix: Switched to sequential checks instead of a parallel one * chore: Added size limit check for the message before sending the data to segment (#18453) * fix: Allowing multi form to json switching and eliminating json to form sw… (#18192) * Allowing multi form to json switching and eliminating json to form switching unless form data is cleared * Fix failing jest test case Co-authored-by: Aishwarya UR <aishwarya@appsmith.com> * add missed width and height limits instead of incrementing depth by 1 Co-authored-by: Aman Agarwal <aman@appsmith.com> Co-authored-by: Nidhi <nidhi@appsmith.com> Co-authored-by: Anagh Hegde <anagh@appsmith.com> Co-authored-by: Ayangade Adeoluwa <37867493+Irongade@users.noreply.github.com> Co-authored-by: Aishwarya UR <aishwarya@appsmith.com> * fix: auto height with limits deselect widget (#18455) * fix: api url z-index to show it above response panel (#18200) * chore: Switched to sequential checks instead of a parallel one for RTS check (#18440) fix: Switched to sequential checks instead of a parallel one * chore: Added size limit check for the message before sending the data to segment (#18453) * fix: Allowing multi form to json switching and eliminating json to form sw… (#18192) * Allowing multi form to json switching and eliminating json to form switching unless form data is cleared * Fix failing jest test case Co-authored-by: Aishwarya UR <aishwarya@appsmith.com> * refactor overlay and handles state into ui reducer and added a check for is limits changing in the widgets editor as well * added helpful comments at relevant places Co-authored-by: Aman Agarwal <aman@appsmith.com> Co-authored-by: Nidhi <nidhi@appsmith.com> Co-authored-by: Anagh Hegde <anagh@appsmith.com> Co-authored-by: Ayangade Adeoluwa <37867493+Irongade@users.noreply.github.com> Co-authored-by: Aishwarya UR <aishwarya@appsmith.com> Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com> * changes the label on limit handles collision to height * fix: issues related to tabs widget in auto height (#18468) * Fix issues related to tabs widget in auto height * Fix issue where preview mode canvas did not scroll * Fix scroll issues with fixed containers * Fix issue where tabs widget computed the canvas height incorrectly * Re-compute in case of tabs widget * fix: widgets increase spacing (#18462) * Change how the spacing works when widgets push or pull widgets below * Fix type issues in test file * Fix tests to reflect changes * Add comment to describe why we're generating distanceToNearestAbove Co-authored-by: rahulramesha <71900764+rahulramesha@users.noreply.github.com> Co-authored-by: Aman Agarwal <aman@appsmith.com> Co-authored-by: Nidhi <nidhi@appsmith.com> Co-authored-by: Anagh Hegde <anagh@appsmith.com> Co-authored-by: Ayangade Adeoluwa <37867493+Irongade@users.noreply.github.com> Co-authored-by: Aishwarya UR <aishwarya@appsmith.com> Co-authored-by: ankurrsinghal <ankur@appsmith.com> Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
52 lines
1.6 KiB
TypeScript
52 lines
1.6 KiB
TypeScript
import { GridDefaults } from "constants/WidgetConstants";
|
|
import React, { ReactNode } from "react";
|
|
import useWidgetConfig from "utils/hooks/useWidgetConfig";
|
|
import { DynamicHeight } from "utils/WidgetFeatures";
|
|
import { WidgetProps } from "widgets/BaseWidget";
|
|
import {
|
|
getWidgetMaxAutoHeight,
|
|
getWidgetMinAutoHeight,
|
|
} from "widgets/WidgetUtils";
|
|
import AutoHeightContainer from "./AutoHeightContainer";
|
|
|
|
export type AutoHeightWrapperProps = {
|
|
widgetProps: WidgetProps;
|
|
children: ReactNode;
|
|
onUpdateDynamicHeight: (height: number) => void;
|
|
};
|
|
|
|
function AutoHeightContainerWrapper(props: AutoHeightWrapperProps) {
|
|
const { children, widgetProps } = props;
|
|
const isCanvas = useWidgetConfig(widgetProps.type, "isCanvas");
|
|
// eslint-disable-next-line react/jsx-no-useless-fragment
|
|
if (isCanvas) return <>{children}</>;
|
|
|
|
const onHeightUpdate = (height: number) => {
|
|
props.onUpdateDynamicHeight(height);
|
|
};
|
|
|
|
const maxDynamicHeight = getWidgetMaxAutoHeight(widgetProps);
|
|
const minDynamicHeight = getWidgetMinAutoHeight(widgetProps);
|
|
|
|
const widgetHeightInPixels =
|
|
(widgetProps.bottomRow - widgetProps.topRow) *
|
|
GridDefaults.DEFAULT_GRID_ROW_HEIGHT;
|
|
const isAutoHeightWithLimits =
|
|
widgetProps.dynamicHeight === DynamicHeight.AUTO_HEIGHT_WITH_LIMITS;
|
|
|
|
return (
|
|
<AutoHeightContainer
|
|
isAutoHeightWithLimits={isAutoHeightWithLimits}
|
|
maxDynamicHeight={maxDynamicHeight}
|
|
minDynamicHeight={minDynamicHeight}
|
|
onHeightUpdate={onHeightUpdate}
|
|
widgetHeightInPixels={widgetHeightInPixels}
|
|
widgetProps={widgetProps}
|
|
>
|
|
{children}
|
|
</AutoHeightContainer>
|
|
);
|
|
}
|
|
|
|
export default AutoHeightContainerWrapper;
|