diff --git a/web/src/components/TableEditorDialog.tsx b/web/src/components/TableEditorDialog.tsx index 630377245..e414557c3 100644 --- a/web/src/components/TableEditorDialog.tsx +++ b/web/src/components/TableEditorDialog.tsx @@ -199,176 +199,187 @@ const TableEditorDialog = ({ open, onOpenChange, initialData, onConfirm }: Table
{/* Scrollable table area */}
- - {/* ============ STICKY HEADER ============ */} - - {/* Mask row: solid background that hides content scrolling behind the header */} - - + {/* Clip wrapper: ensures blue highlight lines don't extend beyond the table */} +
+
-
+ {/* ============ STICKY HEADER ============ */} + + {/* Mask row: solid background that hides content scrolling behind the header */} + + - {/* Header row */} - - {/* Row-number spacer */} - + {/* Row-number spacer */} + - ))} - - {/* Add column at end */} - - - - - {/* ============ DATA ROWS ============ */} - - {rows.map((row, rowIdx) => ( - - - {/* Row number — with insert-row zone on top border */} - - {/* Data cells */} - {row.map((cell, col) => ( - - ))} - - {/* Row delete button */} - - - - ))} - -
+
+ {/* Header row */} +
- {headers.map((header, col) => ( - - {/* ---- Insert-column zone (between col-1 and col) ---- */} - {col > 0 && ( -
insertColumnAt(col)} - > - {/* Blue vertical line through the entire table */} + {headers.map((header, col) => ( +
+ {/* ---- Insert-column zone (between col-1 and col) ---- */} + {col > 0 && (
- {/* + button */} - - - - - Insert column - -
- )} - - {/* Header cell — bg covers input + sort + delete */} -
- setInputRef(`-1:${col}`, el)} - style={{ fontFamily: MONO_FONT }} - className="flex-1 min-w-0 px-2 py-1.5 font-semibold text-xs uppercase tracking-wide bg-transparent focus:outline-none focus:ring-1 focus:ring-primary/40" - value={header} - onChange={(e) => updateHeader(col, e.target.value)} - onKeyDown={(e) => handleKeyDown(e, -1, col)} - placeholder={`Col ${col + 1}`} - /> - - - - - Sort column - - {colCount > 1 && ( - - - - - Remove column - - )} -
-
- - - - - Add column - -
- {rowIdx > 0 && ( -
insertRowAt(rowIdx)} + className="group/cins absolute -left-4 top-0 bottom-0 w-8 z-30 cursor-pointer" + onClick={() => insertColumnAt(col)} > - {/* Blue horizontal line extending across the full table */} + {/* Blue vertical line through the entire table */}
- {/* + button at intersection of row border and first-column border */} + {/* + button — absolutely centered on the column border */} - Insert row + Insert column
)} - {rowIdx + 1} -
+ {/* Header cell — bg covers input + sort + delete */} +
setInputRef(`${rowIdx}:${col}`, el)} + ref={(el) => setInputRef(`-1:${col}`, el)} style={{ fontFamily: MONO_FONT }} - className="w-full px-2 py-1.5 text-sm bg-transparent border border-border focus:outline-none focus:ring-1 focus:ring-primary/40" - value={cell} - onChange={(e) => updateCell(rowIdx, col, e.target.value)} - onKeyDown={(e) => handleKeyDown(e, rowIdx, col)} + className="flex-1 min-w-0 px-2 py-1.5 font-semibold text-xs uppercase tracking-wide bg-transparent focus:outline-none focus:ring-1 focus:ring-primary/40" + value={header} + onChange={(e) => updateHeader(col, e.target.value)} + onKeyDown={(e) => handleKeyDown(e, -1, col)} + placeholder={`Col ${col + 1}`} /> -
- {rowCount > 1 && ( - Remove row + Sort column - )} -
+ {colCount > 1 && ( + + + + + Remove column + + )} +
+ + ))} + + {/* Add column at end */} + + + + + + Add column + + + + + + {/* ============ DATA ROWS ============ */} + + {rows.map((row, rowIdx) => ( + + + {/* Row number — with insert-row zone on top border */} + + {rowIdx > 0 && ( +
insertRowAt(rowIdx)} + > + {/* Blue horizontal line extending across the table */} +
+ {/* + button at intersection of row border and first-column border */} + + + + + Insert row + +
+ )} + {rowIdx + 1} + + + {/* Data cells */} + {row.map((cell, col) => ( + + setInputRef(`${rowIdx}:${col}`, el)} + style={{ fontFamily: MONO_FONT }} + className="w-full px-2 py-1.5 text-sm bg-transparent border border-border focus:outline-none focus:ring-1 focus:ring-primary/40" + value={cell} + onChange={(e) => updateCell(rowIdx, col, e.target.value)} + onKeyDown={(e) => handleKeyDown(e, rowIdx, col)} + /> + + ))} + + {/* Row delete button */} + + {rowCount > 1 && ( + + + + + Remove row + + )} + + + + ))} + + +
+ + {/* Add row button below the table */} +
+ +
{/* ============ FOOTER ============ */} @@ -381,6 +392,10 @@ const TableEditorDialog = ({ open, onOpenChange, initialData, onConfirm }: Table Add row +