Feature: Elements should be draggable within container

This commit is contained in:
navaneeth 2021-05-10 11:09:22 +05:30
parent 1db2fb7083
commit 743190d46c
2 changed files with 25 additions and 4 deletions

View file

@ -1,8 +1,15 @@
import React from 'react';
import React, { useRef } from 'react';
import { SubCustomDragLayer } from '../SubCustomDragLayer';
import { SubContainer } from '../SubContainer';
export const Container = function Container({
id, width, height, component, onComponentClick
id,
component,
height,
containerProps,
width
}) {
const backgroundColor = component.definition.styles.backgroundColor.value;
const computedStyles = {
@ -11,5 +18,19 @@ export const Container = function Container({
height
};
return <div className="jet-container" onClick={() => onComponentClick(id, component)} style={computedStyles}></div>;
const parentRef = useRef(null);
return (
<div className="jet-container" ref={parentRef} onClick={() => containerProps.onComponentClick(id, component)} style={computedStyles}>
<SubContainer
parent={id}
{...containerProps}
parentRef={parentRef}
/>
<SubCustomDragLayer
snapToGrid={true}
parentRef={parentRef}
/>
</div>
);
};

View file

@ -92,7 +92,7 @@ export const EventSelector = ({
value={definition.options.model}
search={true}
onChange={(value) => {
eventOptionUpdated(param, 'model', value, extraData);
eventOptionUpdated(param, 'modal', value, extraData);
}}
filterOptions={fuzzySearch}
placeholder="Select.."