Add field selection to the diagramming package

XMLWordPrintableJSON

    • 3
    • Iteration I (Aug 11 - Aug 25)
    • Not Needed
    • Developer Tools

      To allow for Compass to show certain field details in the drawer with the field editing options we need to be able to select one or more fields. This ticket involves adding the handlers to the diagramming package to allow for a user to select one or more fields (when they have cmd held it'll add to the selection). Interface at the bottom and in the tech design. 

      We'll need to add a selection hook that keeps some state of what's already selected for the multi-select. Only fields from the same collection can be selected together, if it's a new collection, it's a new selection. The `onFieldClick` should fire alongside `onFieldSelectionChange` when clicking a new element.
      Here's how react flow does their selection, note there are a few other components involved as well: https://github.com/xyflow/xyflow/blob/main/packages/react/src/components/NodesSelection/index.tsx 

      Let's add a storybook that shows this behavior as well.

      https://docs.google.com/document/d/15Dn5FB3POEj9sYQrYIUajZySqFzlPfpcgjkPhzFqSFg/edit?tab=t.0#bookmark=id.omspwlk9yhpb 

      interface DiagramProps {
        /* ... Existing props. */
         
        onFieldClick: (
          event: ReactMouseEvent,
          params:

      {       field: NodeField;       nodeId: string;     }

        ) => void;
        onFieldSelectionChange: (
          event: ReactMouseEvent,
          params:

      {       fields: NodeField[];       nodeId: string;     }

        ) => void;

      }

            Assignee:
            Rhys Howell
            Reporter:
            Rhys Howell
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: