@symply.io/basic-components 1.6.11-alpha.1 → 1.6.11-alpha.2

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.
@@ -27,6 +27,8 @@ import TableCell from "@mui/material/TableCell";
27
27
  import TableBodyRow from "./TableBodyRow";
28
28
  function TBody(props) {
29
29
  var rows = props.rows, columns = props.columns, virtualRows = props.virtualRows, _a = props.noDataText, noDataText = _a === void 0 ? "No Data!" : _a, rest = __rest(props, ["rows", "columns", "virtualRows", "noDataText"]);
30
- return (_jsx(TableBody, { children: virtualRows.length > 0 ? (virtualRows.map(function (row) { return (_jsx(TableBodyRow, __assign({ rowIndex: row.index, row: rows[row.index], rows: rows, columns: columns }, rest), "DataTable_".concat(row.key || row.index))); })) : (_jsx(TableRow, { children: _jsx(TableCell, __assign({ colSpan: columns.length, align: "center" }, { children: noDataText })) })) }));
30
+ return (_jsx(TableBody, { children: virtualRows.length > 0 ? (virtualRows.map(function (virtualRow) {
31
+ return (_jsx(TableBodyRow, __assign({ rowIndex: virtualRow.index, virtualRow: virtualRow, rows: rows, columns: columns }, rest), "DataTable_".concat(virtualRow.key || virtualRow.index)));
32
+ })) : (_jsx(TableRow, { children: _jsx(TableCell, __assign({ colSpan: columns.length, align: "center" }, { children: noDataText })) })) }));
31
33
  }
32
34
  export default TBody;
@@ -16,10 +16,11 @@ import TableCell from "@mui/material/TableCell";
16
16
  import useMediaQuery from "@mui/material/useMediaQuery";
17
17
  import useTheme from "@mui/material/styles/useTheme";
18
18
  function TableBodyRow(props) {
19
- var row = props.row, rows = props.rows, columns = props.columns, rowIndex = props.rowIndex, leftShadowVisible = props.leftShadowVisible, rightShadowVisible = props.rightShadowVisible, onRowClick = props.onRowClick, onContextMenu = props.onContextMenu, onCustomizeRowBgColor = props.onCustomizeRowBgColor;
19
+ var rows = props.rows, columns = props.columns, rowIndex = props.rowIndex, virtualRow = props.virtualRow, leftShadowVisible = props.leftShadowVisible, rightShadowVisible = props.rightShadowVisible, onRowClick = props.onRowClick, onContextMenu = props.onContextMenu, onCustomizeRowBgColor = props.onCustomizeRowBgColor;
20
20
  var _a = useState(), rowEl = _a[0], setRowEl = _a[1];
21
21
  var theme = useTheme();
22
22
  var isUpMd = useMediaQuery(theme.breakpoints.up("md"));
23
+ var row = useMemo(function () { return rows[virtualRow.index]; }, [rows, virtualRow]);
23
24
  var _b = useMemo(function () {
24
25
  if (isUpMd) {
25
26
  var left = columns.filter(function (c) { return c.fixable === "left"; });
@@ -44,6 +45,7 @@ function TableBodyRow(props) {
44
45
  }, [row, columns, onCustomizeRowBgColor]), normal = _c.normal, hover = _c.hover;
45
46
  return (_jsxs(TableRow, __assign({ sx: {
46
47
  backgroundColor: normal,
48
+ transform: "translateY(".concat(virtualRow.start - rowIndex * virtualRow.size, "px)"),
47
49
  "&:hover": {
48
50
  cursor: onRowClick ? "pointer" : "default",
49
51
  backgroundColor: onRowClick ? hover : normal,
@@ -27,7 +27,7 @@ function DataTable(props) {
27
27
  var rowVirtualizer = useVirtualizer({
28
28
  count: rows.length,
29
29
  getScrollElement: function () { return tableRef.current; },
30
- estimateSize: function () { return (dense ? 48 : 64); },
30
+ estimateSize: function () { return (dense ? 48 : 72); },
31
31
  measureElement: typeof window !== "undefined" &&
32
32
  navigator.userAgent.indexOf("Firefox") === -1
33
33
  ? function (element) { return element === null || element === void 0 ? void 0 : element.getBoundingClientRect().height; }
@@ -74,8 +74,8 @@ export declare type TableBodyProps<RowProps extends KvProps, ExtendedProps exten
74
74
  }) => CustomRowBgColor;
75
75
  };
76
76
  export declare type TableBodyRowProps<RowProps extends KvProps, ExtendedProps extends KvProps> = Omit<TableBodyProps<RowProps, ExtendedProps>, "noDataText" | "virtualRows"> & {
77
- row: RowProps;
78
77
  rowIndex: number;
78
+ virtualRow: VirtualItem;
79
79
  };
80
80
  export declare type TableFooterProps<RowProps extends KvProps, ExtendedProps extends KvProps> = {
81
81
  footers?: Array<TableFooterCellProps<RowProps, ExtendedProps>>;
@@ -85,7 +85,7 @@ export declare type TableFooterProps<RowProps extends KvProps, ExtendedProps ext
85
85
  leftShadowVisible?: boolean;
86
86
  rightShadowVisible?: boolean;
87
87
  };
88
- export declare type DataTableProps<RowProps extends KvProps, ExtendedProps extends KvProps> = Omit<TableHeaderProps<RowProps, ExtendedProps>, "leftShadowVisible" | "rightShadowVisible" | "noData"> & Omit<TableBodyProps<RowProps, ExtendedProps>, "leftShadowVisible" | "rightShadowVisible"> & Omit<TableFooterProps<RowProps, ExtendedProps>, "leftShadowVisible" | "rightShadowVisible" | "noData"> & {
88
+ export declare type DataTableProps<RowProps extends KvProps, ExtendedProps extends KvProps> = Omit<TableHeaderProps<RowProps, ExtendedProps>, "leftShadowVisible" | "rightShadowVisible" | "noData"> & Omit<TableBodyProps<RowProps, ExtendedProps>, "leftShadowVisible" | "rightShadowVisible" | "virtualRows"> & Omit<TableFooterProps<RowProps, ExtendedProps>, "leftShadowVisible" | "rightShadowVisible" | "noData"> & {
89
89
  dense?: boolean;
90
90
  primaryColor?: CSSProperties["color"];
91
91
  secondaryColor?: CSSProperties["color"];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@symply.io/basic-components",
3
- "version": "1.6.11-alpha.1",
3
+ "version": "1.6.11-alpha.2",
4
4
  "description": "Basic and reusable components for all frontend of Symply apps",
5
5
  "keywords": [
6
6
  "react",