diff --git a/src/components/PricingView.tsx b/src/components/PricingView.tsx
index 9175f65..403da9f 100644
--- a/src/components/PricingView.tsx
+++ b/src/components/PricingView.tsx
@@ -858,11 +858,16 @@ export function PricingView({ data, headers, onSaveRow, onCaptureState, onEdit,
return isNaN(n) ? String(val) : n.toFixed(2);
};
- const formatUnits = (val: any) => {
+ const formatPlainValue = (val: any) => {
if (val === undefined || val === null || val === '') return '—';
return String(val);
};
+ const getEditableCellValue = (val: any) => {
+ if (val === undefined || val === null) return '';
+ return String(val);
+ };
+
const unitBadge = (val: any, label: string) => {
const n = Number(val);
if (!val || n === 0) return (
@@ -2188,31 +2193,239 @@ export function PricingView({ data, headers, onSaveRow, onCaptureState, onEdit,
{/* Units columns */}
- {unitOuterBadge(row[unitsOuterIdx])}
+ {(() => {
+ const isEditing = editingCell?.rowIndex === dataIndex && editingCell?.colIndex === unitsOuterIdx;
+ const isSaving = savingCell?.rowIndex === dataIndex && savingCell?.colIndex === unitsOuterIdx;
+ const value = getEditableCellValue(row[unitsOuterIdx]);
+ return isEditing ? (
+ setEditingCell(prev => prev ? { ...prev, value: e.target.value } : null)}
+ onKeyDown={handleKeyDown}
+ onBlur={commitEdit}
+ className="w-full bg-slate-900 border border-blue-500 rounded px-2 py-1 text-sm text-white focus:outline-none focus:ring-1 focus:ring-blue-500"
+ />
+ ) : (
+
+ );
+ })()}
|
- {row[COLUMNS.OUTER_W] ?? '-'}
+ {(() => {
+ const isEditing = editingCell?.rowIndex === dataIndex && editingCell?.colIndex === COLUMNS.OUTER_W;
+ const isSaving = savingCell?.rowIndex === dataIndex && savingCell?.colIndex === COLUMNS.OUTER_W;
+ const value = getEditableCellValue(row[COLUMNS.OUTER_W]);
+ return isEditing ? (
+ setEditingCell(prev => prev ? { ...prev, value: e.target.value } : null)}
+ onKeyDown={handleKeyDown}
+ onBlur={commitEdit}
+ className="w-full bg-slate-900 border border-blue-500 rounded px-2 py-1 text-sm text-white focus:outline-none focus:ring-1 focus:ring-blue-500"
+ />
+ ) : (
+
+ );
+ })()}
|
- {row[COLUMNS.OUTER_L] ?? '-'}
+ {(() => {
+ const isEditing = editingCell?.rowIndex === dataIndex && editingCell?.colIndex === COLUMNS.OUTER_L;
+ const isSaving = savingCell?.rowIndex === dataIndex && savingCell?.colIndex === COLUMNS.OUTER_L;
+ const value = getEditableCellValue(row[COLUMNS.OUTER_L]);
+ return isEditing ? (
+ setEditingCell(prev => prev ? { ...prev, value: e.target.value } : null)}
+ onKeyDown={handleKeyDown}
+ onBlur={commitEdit}
+ className="w-full bg-slate-900 border border-blue-500 rounded px-2 py-1 text-sm text-white focus:outline-none focus:ring-1 focus:ring-blue-500"
+ />
+ ) : (
+
+ );
+ })()}
|
- {row[COLUMNS.OUTER_H] ?? '-'}
+ {(() => {
+ const isEditing = editingCell?.rowIndex === dataIndex && editingCell?.colIndex === COLUMNS.OUTER_H;
+ const isSaving = savingCell?.rowIndex === dataIndex && savingCell?.colIndex === COLUMNS.OUTER_H;
+ const value = getEditableCellValue(row[COLUMNS.OUTER_H]);
+ return isEditing ? (
+ setEditingCell(prev => prev ? { ...prev, value: e.target.value } : null)}
+ onKeyDown={handleKeyDown}
+ onBlur={commitEdit}
+ className="w-full bg-slate-900 border border-blue-500 rounded px-2 py-1 text-sm text-white focus:outline-none focus:ring-1 focus:ring-blue-500"
+ />
+ ) : (
+
+ );
+ })()}
|
{/* Container units columns */}
{containerCols.map(col => {
const colKey = `con_${col.index}`;
+ const isEditing = editingCell?.rowIndex === dataIndex && editingCell?.colIndex === col.index;
+ const isSaving = savingCell?.rowIndex === dataIndex && savingCell?.colIndex === col.index;
+ const value = getEditableCellValue(row[col.index]);
return (
- {unitBadge(row[col.index], col.name)}
- |
+ {isEditing ? (
+ setEditingCell(prev => prev ? { ...prev, value: e.target.value } : null)}
+ onKeyDown={handleKeyDown}
+ onBlur={commitEdit}
+ className="w-full bg-slate-900 border border-blue-500 rounded px-2 py-1 text-sm text-white focus:outline-none focus:ring-1 focus:ring-blue-500"
+ />
+ ) : (
+
+ )}
+
);
})}
{/* MOQ cell */}
- {row[COLUMNS.MOQ] !== undefined && row[COLUMNS.MOQ] !== null ? row[COLUMNS.MOQ] : '-'}
+ {(() => {
+ const isEditing = editingCell?.rowIndex === dataIndex && editingCell?.colIndex === COLUMNS.MOQ;
+ const isSaving = savingCell?.rowIndex === dataIndex && savingCell?.colIndex === COLUMNS.MOQ;
+ const value = getEditableCellValue(row[COLUMNS.MOQ]);
+ return isEditing ? (
+ setEditingCell(prev => prev ? { ...prev, value: e.target.value } : null)}
+ onKeyDown={handleKeyDown}
+ onBlur={commitEdit}
+ className="w-full bg-slate-900 border border-blue-500 rounded px-2 py-1 text-sm text-white focus:outline-none focus:ring-1 focus:ring-blue-500"
+ />
+ ) : (
+
+ );
+ })()}
|
{/* Issues column (weight only) */}
@@ -2334,7 +2547,7 @@ export function PricingView({ data, headers, onSaveRow, onCaptureState, onEdit,
Showing {paginatedRows.length} of {sortedRows.length} products {totalPages > 1 && `(${currentPage}/${totalPages})`}
{pricingEditableCols.length > 0 && (
- <> · Click any price cell to edit inline>
+ <> · Click editable price / units / MOQ cells to edit inline>
)}
{dragSelectedRows.size > 0 && (