Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

inline edit table name and fields #295

Open
brauliodiez opened this issue Feb 10, 2024 · 1 comment
Open

inline edit table name and fields #295

brauliodiez opened this issue Feb 10, 2024 · 1 comment
Assignees

Comments

@brauliodiez
Copy link
Member

When the user clicks on the canvas (table name or fields), allow inline editing:

  • Table name: show an input on top and let the user edit.
  • Table field name: show an input on top and let the user edit.
  • Table field type: show a combo on top and let the user edit.
  • Table field NN: show a checkbox.

This needs functional discussion and check layout, maybe it only can be done when the user has certain zoom level, if it's too small we have no room for that.

@brauliodiez
Copy link
Member Author

Some tips:

  • Only enable inline editing when zoom has a reasonable value (there are another issue to limit the zoom between 5 factors).

  • Study whether to use "Foreign object" to put an input or a combo on top.

  • Maybe we can evaluate whether to make the whole field row editable.

Some idea:

// TableCellComponent.tsx
const TableCellComponent: React.FC<TableCellProps> = ({ cell, isEditing, onEdit, onBlur, zoomLevel }) => {
  const inputWidth = 100 / zoomLevel; // Adjust the width based on the zoom level

  return (
    <g>
      {isEditing ? (
        <foreignObject x={/* Calculate position based on zoom and other factors */} y={/* Calculate position based on zoom and other factors */} width={`${inputWidth}%`} height="20">
          <input
            type="text"
            value={cell.value}
            onChange={(e) => onEdit(e.target.value)}
            onBlur={onBlur}
          />
        </foreignObject>
      ) : (
        <text onClick={onEdit}>{cell.value}</text>
      )}
    </g>
  );
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: In Review
Development

No branches or pull requests

2 participants