@visns-studio/visns-components 1.6.4 → 1.6.5
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.
|
@@ -139,7 +139,15 @@ const DataGrid = ({
|
|
|
139
139
|
const [dataReload, setDataReload] = useState(0);
|
|
140
140
|
const [dSearch, setDSearch] = useState("");
|
|
141
141
|
const data = useCallback(
|
|
142
|
-
(params) =>
|
|
142
|
+
(params) => {
|
|
143
|
+
const sqlResult = loadData(params, dSearch, ajaxSetting);
|
|
144
|
+
|
|
145
|
+
sqlResult.then((res) => {
|
|
146
|
+
setDataCount(res.count);
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
return sqlResult;
|
|
150
|
+
},
|
|
143
151
|
[ajaxSetting, dataReload, dSearch]
|
|
144
152
|
);
|
|
145
153
|
const [filterDataSource, setFilterDataSource] = useState([]);
|
|
@@ -1285,14 +1293,46 @@ const DataGrid = ({
|
|
|
1285
1293
|
|
|
1286
1294
|
// Data Grid Styling
|
|
1287
1295
|
const [windowHeight, setWindowHeight] = useState(window.innerHeight);
|
|
1288
|
-
const
|
|
1289
|
-
|
|
1296
|
+
const [dataCount, setDataCount] = useState(0);
|
|
1297
|
+
const [gridStyle, setGridStyle] = useState({
|
|
1298
|
+
minHeight:
|
|
1299
|
+
dataCount > 5
|
|
1300
|
+
? dataCount > 8
|
|
1301
|
+
? windowHeight * 0.7 > 550
|
|
1302
|
+
? windowHeight * 0.7
|
|
1303
|
+
: 550
|
|
1304
|
+
: 450
|
|
1305
|
+
: 400,
|
|
1290
1306
|
boxShadow: "none",
|
|
1291
|
-
};
|
|
1307
|
+
});
|
|
1292
1308
|
const headerProps = {
|
|
1293
1309
|
style: style ? style : {},
|
|
1294
1310
|
};
|
|
1295
1311
|
|
|
1312
|
+
useEffect(() => {
|
|
1313
|
+
setGridStyle((prevState) => ({
|
|
1314
|
+
...prevState,
|
|
1315
|
+
minHeight:
|
|
1316
|
+
dataCount > 5
|
|
1317
|
+
? dataCount > 8
|
|
1318
|
+
? windowHeight * 0.7 > 550
|
|
1319
|
+
? windowHeight * 0.7
|
|
1320
|
+
: 550
|
|
1321
|
+
: 450
|
|
1322
|
+
: 400,
|
|
1323
|
+
}));
|
|
1324
|
+
|
|
1325
|
+
console.info(
|
|
1326
|
+
dataCount > 5
|
|
1327
|
+
? dataCount > 8
|
|
1328
|
+
? windowHeight * 0.7 > 550
|
|
1329
|
+
? windowHeight * 0.7
|
|
1330
|
+
: 550
|
|
1331
|
+
: 450
|
|
1332
|
+
: 400
|
|
1333
|
+
);
|
|
1334
|
+
}, [dataCount]);
|
|
1335
|
+
|
|
1296
1336
|
useEffect(() => {
|
|
1297
1337
|
const handleResize = () => {
|
|
1298
1338
|
setWindowHeight(window.innerHeight);
|
package/package.json
CHANGED
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"react-dom": "^17.0.1"
|
|
35
35
|
},
|
|
36
36
|
"name": "@visns-studio/visns-components",
|
|
37
|
-
"version": "1.6.
|
|
37
|
+
"version": "1.6.5",
|
|
38
38
|
"description": "Various packages to assist in the development of our Custom Applications.",
|
|
39
39
|
"main": "index.js",
|
|
40
40
|
"devDependencies": {},
|