@visns-studio/visns-components 1.6.2 → 1.6.3

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.
@@ -104,7 +104,6 @@ const DataGrid = forwardRef(
104
104
  setFilterData,
105
105
  setTotal,
106
106
  style,
107
- minHeight = 550,
108
107
  tableFilters,
109
108
  historySearch,
110
109
  historyUrl,
@@ -159,11 +158,12 @@ const DataGrid = forwardRef(
159
158
  setFilterData([params.filterValue]);
160
159
  }
161
160
 
162
- if (setTotal) {
163
- sqlResult.then((res) => {
161
+ sqlResult.then((res) => {
162
+ if (setTotal) {
164
163
  setTotal(res.count);
165
- });
166
- }
164
+ }
165
+ setDataCount(res.count);
166
+ });
167
167
 
168
168
  return sqlResult;
169
169
  },
@@ -1542,7 +1542,6 @@ const DataGrid = forwardRef(
1542
1542
 
1543
1543
  useEffect(() => {
1544
1544
  if (setFilterData) {
1545
- console.info(filterValue);
1546
1545
  setFilterData(filterValue);
1547
1546
  }
1548
1547
  }, [filterValue]);
@@ -1625,19 +1624,46 @@ const DataGrid = forwardRef(
1625
1624
 
1626
1625
  // Data Grid Styling
1627
1626
  const [windowHeight, setWindowHeight] = useState(window.innerHeight);
1628
- const gridStyle = {
1627
+ const [dataCount, setDataCount] = useState(0);
1628
+ const [gridStyle, setGridStyle] = useState({
1629
1629
  minHeight:
1630
- minHeight !== 550
1631
- ? minHeight
1632
- : windowHeight * 0.7 > 550
1633
- ? windowHeight * 0.7
1634
- : 550,
1630
+ dataCount > 5
1631
+ ? dataCount > 8
1632
+ ? windowHeight * 0.7 > 550
1633
+ ? windowHeight * 0.7
1634
+ : 550
1635
+ : 450
1636
+ : 400,
1635
1637
  boxShadow: "none",
1636
- };
1638
+ });
1637
1639
  const headerProps = {
1638
1640
  style: style ? style : {},
1639
1641
  };
1640
1642
 
1643
+ useEffect(() => {
1644
+ setGridStyle((prevState) => ({
1645
+ ...prevState,
1646
+ minHeight:
1647
+ dataCount > 5
1648
+ ? dataCount > 8
1649
+ ? windowHeight * 0.7 > 550
1650
+ ? windowHeight * 0.7
1651
+ : 550
1652
+ : 450
1653
+ : 400,
1654
+ }));
1655
+
1656
+ console.info(
1657
+ dataCount > 5
1658
+ ? dataCount > 8
1659
+ ? windowHeight * 0.7 > 550
1660
+ ? windowHeight * 0.7
1661
+ : 550
1662
+ : 450
1663
+ : 400
1664
+ );
1665
+ }, [dataCount]);
1666
+
1641
1667
  useEffect(() => {
1642
1668
  const handleResize = () => {
1643
1669
  setWindowHeight(window.innerHeight);
package/package.json CHANGED
@@ -35,7 +35,7 @@
35
35
  "react-dom": "^17.0.1"
36
36
  },
37
37
  "name": "@visns-studio/visns-components",
38
- "version": "1.6.2",
38
+ "version": "1.6.3",
39
39
  "description": "Various packages to assist in the development of our Custom Applications.",
40
40
  "main": "index.js",
41
41
  "devDependencies": {},