Merge branch 'release' into 'master'
Release See merge request theappsmith/internal-tools-client!50
This commit is contained in:
commit
0ba06d2747
|
|
@ -26,7 +26,7 @@ export type Theme = {
|
||||||
export const theme: Theme = {
|
export const theme: Theme = {
|
||||||
radii: [0, 4, 8, 10, 20, 50],
|
radii: [0, 4, 8, 10, 20, 50],
|
||||||
fontSizes: [0, 10, 12, 14, 16, 18, 24, 28, 32, 48, 64],
|
fontSizes: [0, 10, 12, 14, 16, 18, 24, 28, 32, 48, 64],
|
||||||
spaces: [0, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24],
|
spaces: [0, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 30],
|
||||||
fontWeights: [0, 400, 500, 700],
|
fontWeights: [0, 400, 500, 700],
|
||||||
colors: {
|
colors: {
|
||||||
primary: Colors.GREEN,
|
primary: Colors.GREEN,
|
||||||
|
|
|
||||||
|
|
@ -51,8 +51,9 @@ const deleteControlIcon = ControlIcons.DELETE_CONTROL({
|
||||||
|
|
||||||
type DraggableComponentProps = WidgetProps & ContainerProps;
|
type DraggableComponentProps = WidgetProps & ContainerProps;
|
||||||
|
|
||||||
export const ResizingContext: Context<{
|
export const RnDContext: Context<{
|
||||||
setIsResizing?: Function;
|
setIsResizing?: Function;
|
||||||
|
isDragging?: boolean;
|
||||||
}> = createContext({});
|
}> = createContext({});
|
||||||
|
|
||||||
const DraggableComponent = (props: DraggableComponentProps) => {
|
const DraggableComponent = (props: DraggableComponentProps) => {
|
||||||
|
|
@ -70,13 +71,16 @@ const DraggableComponent = (props: DraggableComponentProps) => {
|
||||||
collect: (monitor: DragSourceMonitor) => ({
|
collect: (monitor: DragSourceMonitor) => ({
|
||||||
isDragging: monitor.isDragging(),
|
isDragging: monitor.isDragging(),
|
||||||
}),
|
}),
|
||||||
|
canDrag: () => {
|
||||||
|
return !isResizing && !!isFocused && isFocused === props.widgetId;
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ResizingContext.Provider value={{ setIsResizing }}>
|
<RnDContext.Provider value={{ setIsResizing, isDragging }}>
|
||||||
<DragPreviewImage src={blankImage} connect={preview} />
|
<DragPreviewImage src={blankImage} connect={preview} />
|
||||||
<DraggableWrapper
|
<DraggableWrapper
|
||||||
ref={preview}
|
ref={drag}
|
||||||
onClick={(e: any) => {
|
onClick={(e: any) => {
|
||||||
if (setFocus) {
|
if (setFocus) {
|
||||||
setFocus(props.widgetId);
|
setFocus(props.widgetId);
|
||||||
|
|
@ -108,7 +112,7 @@ const DraggableComponent = (props: DraggableComponentProps) => {
|
||||||
</DeleteControl>
|
</DeleteControl>
|
||||||
{props.children}
|
{props.children}
|
||||||
</DraggableWrapper>
|
</DraggableWrapper>
|
||||||
</ResizingContext.Provider>
|
</RnDContext.Provider>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ import { Rnd } from "react-rnd";
|
||||||
import { XYCoord } from "react-dnd";
|
import { XYCoord } from "react-dnd";
|
||||||
import { WidgetProps, WidgetOperations } from "../widgets/BaseWidget";
|
import { WidgetProps, WidgetOperations } from "../widgets/BaseWidget";
|
||||||
import { ContainerProps, ParentBoundsContext } from "./ContainerComponent";
|
import { ContainerProps, ParentBoundsContext } from "./ContainerComponent";
|
||||||
import { ResizingContext } from "./DraggableComponent";
|
import { RnDContext } from "./DraggableComponent";
|
||||||
import { WidgetFunctionsContext } from "../pages/Editor";
|
import { WidgetFunctionsContext } from "../pages/Editor";
|
||||||
|
|
||||||
export type ResizableComponentProps = WidgetProps & ContainerProps;
|
export type ResizableComponentProps = WidgetProps & ContainerProps;
|
||||||
|
|
@ -37,7 +37,7 @@ const ResizableContainer = styled(Rnd)`
|
||||||
`;
|
`;
|
||||||
|
|
||||||
export const ResizableComponent = (props: ResizableComponentProps) => {
|
export const ResizableComponent = (props: ResizableComponentProps) => {
|
||||||
const { setIsResizing } = useContext(ResizingContext);
|
const { setIsResizing, isDragging } = useContext(RnDContext);
|
||||||
const { boundingParent } = useContext(ParentBoundsContext);
|
const { boundingParent } = useContext(ParentBoundsContext);
|
||||||
const { updateWidget } = useContext(WidgetFunctionsContext);
|
const { updateWidget } = useContext(WidgetFunctionsContext);
|
||||||
let bounds = "body";
|
let bounds = "body";
|
||||||
|
|
@ -89,13 +89,13 @@ export const ResizableComponent = (props: ResizableComponentProps) => {
|
||||||
resizeGrid={[props.parentColumnSpace, props.parentRowSpace]}
|
resizeGrid={[props.parentColumnSpace, props.parentRowSpace]}
|
||||||
bounds={bounds}
|
bounds={bounds}
|
||||||
enableResizing={{
|
enableResizing={{
|
||||||
top: true,
|
top: true && !isDragging,
|
||||||
right: true,
|
right: true && !isDragging,
|
||||||
bottom: true,
|
bottom: true && !isDragging,
|
||||||
left: true,
|
left: true && !isDragging,
|
||||||
topRight: false,
|
topRight: false,
|
||||||
topLeft: false,
|
topLeft: false,
|
||||||
bottomRight: true,
|
bottomRight: true && !isDragging,
|
||||||
bottomLeft: false,
|
bottomLeft: false,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user