authscape 1.0.260 → 1.0.262
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.
- package/index.js +26 -6
- package/package.json +1 -1
- package/src/components/EditableDatagrid.js +18 -6
package/index.js
CHANGED
|
@@ -976,6 +976,8 @@ var EditableDatagrid = function EditableDatagrid(_ref) {
|
|
|
976
976
|
_isCellEditable = _ref$isCellEditable === void 0 ? null : _ref$isCellEditable,
|
|
977
977
|
_ref$onCellEdited = _ref.onCellEdited,
|
|
978
978
|
onCellEdited = _ref$onCellEdited === void 0 ? null : _ref$onCellEdited,
|
|
979
|
+
_ref$params = _ref.params,
|
|
980
|
+
params = _ref$params === void 0 ? null : _ref$params,
|
|
979
981
|
_ref$sx = _ref.sx,
|
|
980
982
|
sx = _ref$sx === void 0 ? {} : _ref$sx,
|
|
981
983
|
_ref$height = _ref.height,
|
|
@@ -986,6 +988,8 @@ var EditableDatagrid = function EditableDatagrid(_ref) {
|
|
|
986
988
|
rowsPerPage = _ref$rowsPerPage === void 0 ? [25, 50, 100] : _ref$rowsPerPage,
|
|
987
989
|
_ref$rowHeight = _ref.rowHeight,
|
|
988
990
|
rowHeight = _ref$rowHeight === void 0 ? 70 : _ref$rowHeight,
|
|
991
|
+
_ref$key = _ref.key,
|
|
992
|
+
key = _ref$key === void 0 ? null : _ref$key,
|
|
989
993
|
_ref$onRowClick = _ref.onRowClick,
|
|
990
994
|
onRowClick = _ref$onRowClick === void 0 ? null : _ref$onRowClick;
|
|
991
995
|
var _useState = (0, _react.useState)([]),
|
|
@@ -1012,28 +1016,43 @@ var EditableDatagrid = function EditableDatagrid(_ref) {
|
|
|
1012
1016
|
while (1) switch (_context.prev = _context.next) {
|
|
1013
1017
|
case 0:
|
|
1014
1018
|
if (!(url != null)) {
|
|
1015
|
-
_context.next =
|
|
1019
|
+
_context.next = 16;
|
|
1016
1020
|
break;
|
|
1017
1021
|
}
|
|
1018
|
-
|
|
1022
|
+
response = null;
|
|
1023
|
+
if (!(params == null)) {
|
|
1024
|
+
_context.next = 8;
|
|
1025
|
+
break;
|
|
1026
|
+
}
|
|
1027
|
+
_context.next = 5;
|
|
1019
1028
|
return apiService().post(url, {
|
|
1020
1029
|
offset: offset,
|
|
1021
1030
|
length: pageSize
|
|
1022
1031
|
});
|
|
1023
|
-
case
|
|
1032
|
+
case 5:
|
|
1024
1033
|
response = _context.sent;
|
|
1034
|
+
_context.next = 13;
|
|
1035
|
+
break;
|
|
1036
|
+
case 8:
|
|
1037
|
+
params.offset = offset;
|
|
1038
|
+
params.length = pageSize;
|
|
1039
|
+
_context.next = 12;
|
|
1040
|
+
return apiService().post(url, params);
|
|
1041
|
+
case 12:
|
|
1042
|
+
response = _context.sent;
|
|
1043
|
+
case 13:
|
|
1025
1044
|
if (response != null && response.status == 200) {
|
|
1026
1045
|
setTotalRows(response.data.recordsTotal);
|
|
1027
1046
|
setRows(response.data.data);
|
|
1028
1047
|
}
|
|
1029
|
-
_context.next =
|
|
1048
|
+
_context.next = 17;
|
|
1030
1049
|
break;
|
|
1031
|
-
case
|
|
1050
|
+
case 16:
|
|
1032
1051
|
if (rows != null) {
|
|
1033
1052
|
setTotalRows(eRows.length);
|
|
1034
1053
|
setRows(eRows);
|
|
1035
1054
|
}
|
|
1036
|
-
case
|
|
1055
|
+
case 17:
|
|
1037
1056
|
case "end":
|
|
1038
1057
|
return _context.stop();
|
|
1039
1058
|
}
|
|
@@ -1075,6 +1094,7 @@ var EditableDatagrid = function EditableDatagrid(_ref) {
|
|
|
1075
1094
|
}, /*#__PURE__*/_react["default"].createElement(_xDataGrid.DataGrid, {
|
|
1076
1095
|
rows: rows,
|
|
1077
1096
|
sx: sx,
|
|
1097
|
+
key: key,
|
|
1078
1098
|
columns: columns,
|
|
1079
1099
|
rowCount: totalRows,
|
|
1080
1100
|
onRowClick: onRowClick,
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@ import React, {useEffect, useState} from 'react';
|
|
|
2
2
|
import { DataGrid, GridActionsCellItem } from "@mui/x-data-grid";
|
|
3
3
|
import { Box } from '@mui/material';
|
|
4
4
|
|
|
5
|
-
export const EditableDatagrid = ({loadedUser, url = null, eRows = null, columns, isCellEditable = null, onCellEdited = null, sx = {}, height="50vh", pageSize = 50, rowsPerPage = [25, 50, 100], rowHeight = 70, onRowClick = null}) => {
|
|
5
|
+
export const EditableDatagrid = ({loadedUser, url = null, eRows = null, columns, isCellEditable = null, onCellEdited = null, params = null, sx = {}, height="50vh", pageSize = 50, rowsPerPage = [25, 50, 100], rowHeight = 70, key = null, onRowClick = null}) => {
|
|
6
6
|
|
|
7
7
|
const [rows, setRows] = useState([]);
|
|
8
8
|
const [totalRows, setTotalRows] = useState(0);
|
|
@@ -22,11 +22,23 @@ export const EditableDatagrid = ({loadedUser, url = null, eRows = null, columns,
|
|
|
22
22
|
|
|
23
23
|
if (url != null)
|
|
24
24
|
{
|
|
25
|
-
let response =
|
|
25
|
+
let response = null;
|
|
26
|
+
if (params == null)
|
|
26
27
|
{
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
response = await apiService().post(url,
|
|
29
|
+
{
|
|
30
|
+
offset: offset,
|
|
31
|
+
length: pageSize
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
else
|
|
35
|
+
{
|
|
36
|
+
params.offset = offset;
|
|
37
|
+
params.length = pageSize;
|
|
38
|
+
|
|
39
|
+
response = await apiService().post(url, params);
|
|
40
|
+
}
|
|
41
|
+
|
|
30
42
|
|
|
31
43
|
if (response != null && response.status == 200)
|
|
32
44
|
{
|
|
@@ -55,6 +67,7 @@ export const EditableDatagrid = ({loadedUser, url = null, eRows = null, columns,
|
|
|
55
67
|
<DataGrid
|
|
56
68
|
rows={rows}
|
|
57
69
|
sx={sx}
|
|
70
|
+
key={key}
|
|
58
71
|
columns={columns}
|
|
59
72
|
rowCount={totalRows}
|
|
60
73
|
onRowClick={onRowClick}
|
|
@@ -63,7 +76,6 @@ export const EditableDatagrid = ({loadedUser, url = null, eRows = null, columns,
|
|
|
63
76
|
return rowHeight;
|
|
64
77
|
}}
|
|
65
78
|
pageSize={pageSize}
|
|
66
|
-
|
|
67
79
|
onPageChange={(newPage) => setOffset(newPage)}
|
|
68
80
|
rowsPerPageOptions={rowsPerPage}
|
|
69
81
|
disableSelectionOnClick={true}
|