Merged in feature/IO-3545-Production-Board-List-DND (pull request #2961)
feature/IO-3548-Bill-Modal-TabOrder
This commit is contained in:
@@ -92,6 +92,8 @@ export function ProductionListTable({ loading, data, refetch, bodyshop, technici
|
|||||||
|
|
||||||
const [activeId, setActiveId] = useState(null);
|
const [activeId, setActiveId] = useState(null);
|
||||||
|
|
||||||
|
const MIN_COL_WIDTH = 20;
|
||||||
|
|
||||||
const sensors = useSensors(
|
const sensors = useSensors(
|
||||||
useSensor(PointerSensor, {
|
useSensor(PointerSensor, {
|
||||||
activationConstraint: {
|
activationConstraint: {
|
||||||
@@ -144,6 +146,12 @@ export function ProductionListTable({ loading, data, refetch, bodyshop, technici
|
|||||||
const [state, setState] = useState(initialStateRef.current);
|
const [state, setState] = useState(initialStateRef.current);
|
||||||
const [columns, setColumns] = useState(initialColumnsRef.current);
|
const [columns, setColumns] = useState(initialColumnsRef.current);
|
||||||
|
|
||||||
|
const scrollX = useMemo(() => {
|
||||||
|
// keep scroll width aligned with the actual column widths so AntD doesn't clamp at a fixed floor
|
||||||
|
const sum = columns.reduce((acc, c) => acc + (c.width ?? 100), 0);
|
||||||
|
return Math.max(sum, 1);
|
||||||
|
}, [columns]);
|
||||||
|
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
const matchingColumnConfig = useMemo(() => {
|
const matchingColumnConfig = useMemo(() => {
|
||||||
@@ -243,15 +251,16 @@ export function ProductionListTable({ loading, data, refetch, bodyshop, technici
|
|||||||
|
|
||||||
// NEW: commit widths via rAF (less jank)
|
// NEW: commit widths via rAF (less jank)
|
||||||
const applyColumnWidth = useCallback((columnKey, width) => {
|
const applyColumnWidth = useCallback((columnKey, width) => {
|
||||||
|
const nextWidth = Math.max(MIN_COL_WIDTH, Math.round(width));
|
||||||
setColumns((prev) => {
|
setColumns((prev) => {
|
||||||
const idx = prev.findIndex((c) => c.key === columnKey);
|
const idx = prev.findIndex((c) => c.key === columnKey);
|
||||||
if (idx === -1) return prev;
|
if (idx === -1) return prev;
|
||||||
|
|
||||||
const currentWidth = prev[idx].width ?? 100;
|
const currentWidth = prev[idx].width ?? 100;
|
||||||
if (currentWidth === width) return prev;
|
if (currentWidth === nextWidth) return prev;
|
||||||
|
|
||||||
const next = prev.slice();
|
const next = prev.slice();
|
||||||
next[idx] = { ...next[idx], width };
|
next[idx] = { ...next[idx], width: nextWidth };
|
||||||
return next;
|
return next;
|
||||||
});
|
});
|
||||||
}, []);
|
}, []);
|
||||||
@@ -524,7 +533,7 @@ export function ProductionListTable({ loading, data, refetch, bodyshop, technici
|
|||||||
rowKey="id"
|
rowKey="id"
|
||||||
loading={loading}
|
loading={loading}
|
||||||
dataSource={dataSource}
|
dataSource={dataSource}
|
||||||
scroll={{ x: 1000 }}
|
scroll={{ x: scrollX }}
|
||||||
onChange={handleTableChange}
|
onChange={handleTableChange}
|
||||||
/>
|
/>
|
||||||
</SortableContext>
|
</SortableContext>
|
||||||
|
|||||||
Reference in New Issue
Block a user