Merge branch 'release' into 'master'

Release

See merge request theappsmith/internal-tools-client!50
This commit is contained in:
Abhinav Jha 2019-10-04 12:44:10 +00:00
commit 0ba06d2747
3 changed files with 16 additions and 12 deletions

View File

@ -26,7 +26,7 @@ export type Theme = {
export const theme: Theme = {
radii: [0, 4, 8, 10, 20, 50],
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],
colors: {
primary: Colors.GREEN,

View File

@ -51,8 +51,9 @@ const deleteControlIcon = ControlIcons.DELETE_CONTROL({
type DraggableComponentProps = WidgetProps & ContainerProps;
export const ResizingContext: Context<{
export const RnDContext: Context<{
setIsResizing?: Function;
isDragging?: boolean;
}> = createContext({});
const DraggableComponent = (props: DraggableComponentProps) => {
@ -70,13 +71,16 @@ const DraggableComponent = (props: DraggableComponentProps) => {
collect: (monitor: DragSourceMonitor) => ({
isDragging: monitor.isDragging(),
}),
canDrag: () => {
return !isResizing && !!isFocused && isFocused === props.widgetId;
},
});
return (
<ResizingContext.Provider value={{ setIsResizing }}>
<RnDContext.Provider value={{ setIsResizing, isDragging }}>
<DragPreviewImage src={blankImage} connect={preview} />
<DraggableWrapper
ref={preview}
ref={drag}
onClick={(e: any) => {
if (setFocus) {
setFocus(props.widgetId);
@ -108,7 +112,7 @@ const DraggableComponent = (props: DraggableComponentProps) => {
</DeleteControl>
{props.children}
</DraggableWrapper>
</ResizingContext.Provider>
</RnDContext.Provider>
);
};

View File

@ -4,7 +4,7 @@ import { Rnd } from "react-rnd";
import { XYCoord } from "react-dnd";
import { WidgetProps, WidgetOperations } from "../widgets/BaseWidget";
import { ContainerProps, ParentBoundsContext } from "./ContainerComponent";
import { ResizingContext } from "./DraggableComponent";
import { RnDContext } from "./DraggableComponent";
import { WidgetFunctionsContext } from "../pages/Editor";
export type ResizableComponentProps = WidgetProps & ContainerProps;
@ -37,7 +37,7 @@ const ResizableContainer = styled(Rnd)`
`;
export const ResizableComponent = (props: ResizableComponentProps) => {
const { setIsResizing } = useContext(ResizingContext);
const { setIsResizing, isDragging } = useContext(RnDContext);
const { boundingParent } = useContext(ParentBoundsContext);
const { updateWidget } = useContext(WidgetFunctionsContext);
let bounds = "body";
@ -89,13 +89,13 @@ export const ResizableComponent = (props: ResizableComponentProps) => {
resizeGrid={[props.parentColumnSpace, props.parentRowSpace]}
bounds={bounds}
enableResizing={{
top: true,
right: true,
bottom: true,
left: true,
top: true && !isDragging,
right: true && !isDragging,
bottom: true && !isDragging,
left: true && !isDragging,
topRight: false,
topLeft: false,
bottomRight: true,
bottomRight: true && !isDragging,
bottomLeft: false,
}}
>