mig-schema-table 3.0.99 → 3.0.100
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -5,16 +5,14 @@ const ColumnResizers = ({ columnWidths, setColumnWidths, tableBodyHeight, }) =>
|
|
|
5
5
|
const [dragColumnIndex, setDragColumnIndex] = React.useState(-1);
|
|
6
6
|
const [dragStartX, setDragStartX] = React.useState(0);
|
|
7
7
|
const setColumnDelta = React.useCallback((columnDelta) => {
|
|
8
|
-
if (!columnWidths) {
|
|
9
|
-
throw new Error("Missing column widths?");
|
|
10
|
-
}
|
|
11
8
|
const newColumnWidths = columnWidths.map((columnWidth, columnWidthIndex) => {
|
|
12
9
|
if (columnWidthIndex === dragColumnIndex) {
|
|
13
10
|
return Math.max(columnWidth + columnDelta, MINIMUM_COLUMN_WIDTH);
|
|
14
11
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
// Do not allow oversized tables?
|
|
13
|
+
// if (columnWidthIndex - 1 === dragColumnIndex) {
|
|
14
|
+
// return Math.max(columnWidth - columnDelta, MINIMUM_COLUMN_WIDTH);
|
|
15
|
+
// }
|
|
18
16
|
return columnWidth;
|
|
19
17
|
});
|
|
20
18
|
setColumnWidths(newColumnWidths);
|
|
@@ -35,7 +33,7 @@ const ColumnResizers = ({ columnWidths, setColumnWidths, tableBodyHeight, }) =>
|
|
|
35
33
|
if (columnIndex === dragColumnIndex) {
|
|
36
34
|
classNames.push("schema-table__column_resizer--dragged");
|
|
37
35
|
}
|
|
38
|
-
return
|
|
36
|
+
return (_jsx("div", { style: { left: pointer, bottom: tableBodyHeight }, className: classNames.join(" "), draggable: "true", "data-column-index": columnIndex, onDragStart: onDragStart, onDragEnd: onDragEnd }, columnIndex));
|
|
39
37
|
}) }));
|
|
40
38
|
};
|
|
41
39
|
export default ColumnResizers;
|
|
@@ -23,6 +23,7 @@ import ThMenu from "./ThMenu";
|
|
|
23
23
|
import { saveAs } from "file-saver";
|
|
24
24
|
import { unparse } from "papaparse";
|
|
25
25
|
import ColumnResizers from "./ColumnResizers";
|
|
26
|
+
import { sum } from "lodash";
|
|
26
27
|
const startOfTheWorldDate = new Date("1000-01-01 00:00:00Z");
|
|
27
28
|
const numberFormatter = new Intl.NumberFormat("nl-NL");
|
|
28
29
|
const currencyFormatter = new Intl.NumberFormat("nl-NL", {
|
|
@@ -498,7 +499,7 @@ function SchemaTable({ Heading = VariableSizeList, checkedIndexes, config, custo
|
|
|
498
499
|
}
|
|
499
500
|
}, [isDirty, searchQuery, onSearchEnter, refreshData]);
|
|
500
501
|
const getRowHeight = React.useCallback(() => rowHeight, [rowHeight]);
|
|
501
|
-
const rowWidth =
|
|
502
|
+
const rowWidth = React.useMemo(() => sum(columnWidths), [columnWidths]);
|
|
502
503
|
const rowCount = React.useMemo(() => (sortedRenderData ? sortedRenderData.length : 0), [sortedRenderData]);
|
|
503
504
|
const tableBodyHeight = React.useMemo(() => {
|
|
504
505
|
const rowsHeight = rowHeight * rowCount;
|