How to use the react-mosaic-component.MosaicDragType.WINDOW function in react-mosaic-component

To help you get started, we’ve selected a few react-mosaic-component examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cruise-automation / webviz / packages / webviz-core / src / components / PanelToolbar / MosaicDragHandle.js View on Github external
// HOC to integrate mosaic drag functionality into any other component
class MosaicDragHandle extends Component {
  static contextTypes = {
    mosaicWindowActions: PropTypes.any,
    mosaicActions: PropTypes.any,
    mosaicId: PropTypes.any,
  };

  render() {
    const { children, connectDragSource } = this.props;
    return connectDragSource(children);
  }
}

// connect the drag handle to react dnd
const ConnectedDragHandle = DragSource(MosaicDragType.WINDOW, dragSource, (connect, monitor) => ({
  connectDragSource: connect.dragSource(),
}))(MosaicDragHandle);

export default ConnectedDragHandle;
github cruise-automation / webviz / packages / webviz-core / src / panels / PanelList / index.js View on Github external
const { position, path } = dropResult;

    // dropping outside mosiac does nothing
    if (!position || !path) {
      return;
    }
    props.onDrop({
      panelType: props.panel.type,
      panelConfig: props.panel.panelConfig,
      position,
      path,
    });
  },
};
// boilerplate required by react-dnd
const DraggablePanelItem = DragSource(MosaicDragType.WINDOW, dragConfig, (connect, monitor) => {
  return {
    connectDragSource: connect.dragSource(),
  };
})(PanelItem);

type OwnProps = {|
  onPanelSelect: (panelType: string, panelConfig?: PanelConfig) => void,
  selectedPanelType?: string,
|};
type Props = {
  ...OwnProps,
  mosaicId: string,
  mosaicLayout: any, // this is the opaque mosiac layout config object
  changePanelLayout: (panelLayout: any) => void,
  savePanelConfig: (SaveConfigPayload) => void,
};