@visns-studio/visns-components 1.6.5 → 1.6.6
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.
|
@@ -153,7 +153,7 @@ const DataGrid = ({
|
|
|
153
153
|
const [filterDataSource, setFilterDataSource] = useState([]);
|
|
154
154
|
const [filterValue, setFilterValue] = useState([]);
|
|
155
155
|
const [gridColumns, setGridColumns] = useState([]);
|
|
156
|
-
const limit = ajaxSetting.take || 10;
|
|
156
|
+
const [limit, setLimit] = useState(ajaxSetting.take || 10);
|
|
157
157
|
const [search, setSearch] = useState("");
|
|
158
158
|
const sortInfo =
|
|
159
159
|
ajaxSetting.sortBy && ajaxSetting.sort
|
|
@@ -1322,15 +1322,17 @@ const DataGrid = ({
|
|
|
1322
1322
|
: 400,
|
|
1323
1323
|
}));
|
|
1324
1324
|
|
|
1325
|
-
|
|
1325
|
+
let dgHeight =
|
|
1326
1326
|
dataCount > 5
|
|
1327
1327
|
? dataCount > 8
|
|
1328
1328
|
? windowHeight * 0.7 > 550
|
|
1329
1329
|
? windowHeight * 0.7
|
|
1330
1330
|
: 550
|
|
1331
1331
|
: 450
|
|
1332
|
-
: 400
|
|
1333
|
-
|
|
1332
|
+
: 400;
|
|
1333
|
+
|
|
1334
|
+
let rowCount = Math.floor((dgHeight - 100) / 40);
|
|
1335
|
+
setLimit(rowCount);
|
|
1334
1336
|
}, [dataCount]);
|
|
1335
1337
|
|
|
1336
1338
|
useEffect(() => {
|
|
@@ -1385,7 +1387,6 @@ const DataGrid = ({
|
|
|
1385
1387
|
columns={gridColumns}
|
|
1386
1388
|
dataSource={data}
|
|
1387
1389
|
filterValue={filterValue}
|
|
1388
|
-
defaultLimit={limit}
|
|
1389
1390
|
defaultSortInfo={sortInfo}
|
|
1390
1391
|
enableColumnAutosize={false}
|
|
1391
1392
|
enableColumnFilterContextMenu={false}
|
|
@@ -1395,8 +1396,10 @@ const DataGrid = ({
|
|
|
1395
1396
|
/\//g,
|
|
1396
1397
|
"-"
|
|
1397
1398
|
)}`}
|
|
1399
|
+
limit={limit}
|
|
1398
1400
|
minRowHeight={40}
|
|
1399
1401
|
onFilterValueChange={setFilterValue}
|
|
1402
|
+
onLimitChange={setLimit}
|
|
1400
1403
|
onRenderRow={onRenderRow}
|
|
1401
1404
|
pagination
|
|
1402
1405
|
renderColumnContextMenu={renderColumnContextMenu}
|
|
@@ -172,7 +172,7 @@ const DataGrid = forwardRef(
|
|
|
172
172
|
const [filterDataSource, setFilterDataSource] = useState([]);
|
|
173
173
|
const [filterValue, setFilterValue] = useState([]);
|
|
174
174
|
const [gridColumns, setGridColumns] = useState([]);
|
|
175
|
-
const limit = ajaxSetting.take || 10;
|
|
175
|
+
const [limit, setLimit] = useState(ajaxSetting.take || 10);
|
|
176
176
|
const [search, setSearch] = useState("");
|
|
177
177
|
const sortInfo =
|
|
178
178
|
ajaxSetting.sortBy && ajaxSetting.sort
|
|
@@ -1653,15 +1653,17 @@ const DataGrid = forwardRef(
|
|
|
1653
1653
|
: 400,
|
|
1654
1654
|
}));
|
|
1655
1655
|
|
|
1656
|
-
|
|
1656
|
+
let dgHeight =
|
|
1657
1657
|
dataCount > 5
|
|
1658
1658
|
? dataCount > 8
|
|
1659
1659
|
? windowHeight * 0.7 > 550
|
|
1660
1660
|
? windowHeight * 0.7
|
|
1661
1661
|
: 550
|
|
1662
1662
|
: 450
|
|
1663
|
-
: 400
|
|
1664
|
-
|
|
1663
|
+
: 400;
|
|
1664
|
+
|
|
1665
|
+
let rowCount = Math.floor((dgHeight - 100) / 40);
|
|
1666
|
+
setLimit(rowCount);
|
|
1665
1667
|
}, [dataCount]);
|
|
1666
1668
|
|
|
1667
1669
|
useEffect(() => {
|
|
@@ -1685,7 +1687,7 @@ const DataGrid = forwardRef(
|
|
|
1685
1687
|
columns={gridColumns}
|
|
1686
1688
|
dataSource={data}
|
|
1687
1689
|
filterValue={filterValue}
|
|
1688
|
-
|
|
1690
|
+
limit={limit}
|
|
1689
1691
|
defaultSortInfo={sortInfo}
|
|
1690
1692
|
enableColumnAutosize={false}
|
|
1691
1693
|
enableColumnFilterContextMenu={false}
|
|
@@ -1697,6 +1699,7 @@ const DataGrid = forwardRef(
|
|
|
1697
1699
|
)}`}
|
|
1698
1700
|
minRowHeight={40}
|
|
1699
1701
|
onFilterValueChange={setFilterValue}
|
|
1702
|
+
onLimitChange={setLimit}
|
|
1700
1703
|
onRenderRow={onRenderRow}
|
|
1701
1704
|
pagination
|
|
1702
1705
|
renderColumnContextMenu={renderColumnContextMenu}
|
|
@@ -583,6 +583,8 @@ function Form(props) {
|
|
|
583
583
|
? result.data
|
|
584
584
|
: result;
|
|
585
585
|
|
|
586
|
+
console.info(result);
|
|
587
|
+
|
|
586
588
|
Object.keys(formData).forEach((item) => {
|
|
587
589
|
let tempRes = "";
|
|
588
590
|
let tempResKey = "";
|
|
@@ -655,9 +657,20 @@ function Form(props) {
|
|
|
655
657
|
tempObj !== undefined &&
|
|
656
658
|
tempObj !== null
|
|
657
659
|
) {
|
|
660
|
+
let labelValue;
|
|
661
|
+
|
|
662
|
+
if (Array.isArray(field.relationName)) {
|
|
663
|
+
labelValue = field.relationName.map(
|
|
664
|
+
(name) => `${tempObj[name]} `
|
|
665
|
+
);
|
|
666
|
+
} else {
|
|
667
|
+
labelValue =
|
|
668
|
+
tempObj[field.relationName];
|
|
669
|
+
}
|
|
670
|
+
|
|
658
671
|
tempRes = {
|
|
659
672
|
value: tempObj.id,
|
|
660
|
-
label:
|
|
673
|
+
label: labelValue,
|
|
661
674
|
};
|
|
662
675
|
}
|
|
663
676
|
|
|
@@ -709,14 +722,23 @@ function Form(props) {
|
|
|
709
722
|
}
|
|
710
723
|
}
|
|
711
724
|
|
|
725
|
+
let labelValue;
|
|
726
|
+
|
|
727
|
+
if (Array.isArray(field.relationName)) {
|
|
728
|
+
labelValue = field.relationName.map(
|
|
729
|
+
(name) => `${tempObj[name]} `
|
|
730
|
+
);
|
|
731
|
+
} else {
|
|
732
|
+
labelValue =
|
|
733
|
+
tempObj[field.relationName];
|
|
734
|
+
}
|
|
735
|
+
|
|
712
736
|
tempRes =
|
|
713
737
|
tempObj !== undefined &&
|
|
714
738
|
tempObj !== null
|
|
715
739
|
? {
|
|
716
740
|
value: tempObj.id,
|
|
717
|
-
label:
|
|
718
|
-
field.relationName
|
|
719
|
-
],
|
|
741
|
+
label: labelValue,
|
|
720
742
|
}
|
|
721
743
|
: {};
|
|
722
744
|
|
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.6",
|
|
38
38
|
"description": "Various packages to assist in the development of our Custom Applications.",
|
|
39
39
|
"main": "index.js",
|
|
40
40
|
"devDependencies": {},
|