How to use the react-mosaic-component.updateTree 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 / panels / PanelList / index.js View on Github external
const node = getNodeAtPath(mosaicLayout, path);
    const before = position === "left" || position === "top";
    const [first, second] = before ? [newNode, node] : [node, newNode];
    const direction = position === "left" || position === "right" ? "row" : "column";
    const updates = [
      {
        path,
        spec: {
          $set: { first, second, direction },
        },
      },
    ];
    if (config.panelConfig) {
      savePanelConfig({ id: newNode, config: config.panelConfig, defaultConfig: {} });
    }
    const newLayout = updateTree(mosaicLayout, updates);
    changePanelLayout(newLayout);
  };