authscape 1.0.259 → 1.0.261

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 CHANGED
@@ -974,8 +974,6 @@ var EditableDatagrid = function EditableDatagrid(_ref) {
974
974
  columns = _ref.columns,
975
975
  _ref$isCellEditable = _ref.isCellEditable,
976
976
  _isCellEditable = _ref$isCellEditable === void 0 ? null : _ref$isCellEditable,
977
- _ref$params = _ref.params,
978
- params = _ref$params === void 0 ? null : _ref$params,
979
977
  _ref$onCellEdited = _ref.onCellEdited,
980
978
  onCellEdited = _ref$onCellEdited === void 0 ? null : _ref$onCellEdited,
981
979
  _ref$sx = _ref.sx,
@@ -987,7 +985,11 @@ var EditableDatagrid = function EditableDatagrid(_ref) {
987
985
  _ref$rowsPerPage = _ref.rowsPerPage,
988
986
  rowsPerPage = _ref$rowsPerPage === void 0 ? [25, 50, 100] : _ref$rowsPerPage,
989
987
  _ref$rowHeight = _ref.rowHeight,
990
- rowHeight = _ref$rowHeight === void 0 ? 70 : _ref$rowHeight;
988
+ rowHeight = _ref$rowHeight === void 0 ? 70 : _ref$rowHeight,
989
+ _ref$key = _ref.key,
990
+ key = _ref$key === void 0 ? null : _ref$key,
991
+ _ref$onRowClick = _ref.onRowClick,
992
+ onRowClick = _ref$onRowClick === void 0 ? null : _ref$onRowClick;
991
993
  var _useState = (0, _react.useState)([]),
992
994
  _useState2 = _slicedToArray(_useState, 2),
993
995
  rows = _useState2[0],
@@ -1012,43 +1014,28 @@ var EditableDatagrid = function EditableDatagrid(_ref) {
1012
1014
  while (1) switch (_context.prev = _context.next) {
1013
1015
  case 0:
1014
1016
  if (!(url != null)) {
1015
- _context.next = 16;
1017
+ _context.next = 7;
1016
1018
  break;
1017
1019
  }
1018
- response = null;
1019
- if (!(params == null)) {
1020
- _context.next = 8;
1021
- break;
1022
- }
1023
- _context.next = 5;
1020
+ _context.next = 3;
1024
1021
  return apiService().post(url, {
1025
1022
  offset: offset,
1026
1023
  length: pageSize
1027
1024
  });
1028
- case 5:
1029
- response = _context.sent;
1030
- _context.next = 13;
1031
- break;
1032
- case 8:
1033
- params.offset = offset;
1034
- params.length = pageSize;
1035
- _context.next = 12;
1036
- return apiService().post(url, params);
1037
- case 12:
1025
+ case 3:
1038
1026
  response = _context.sent;
1039
- case 13:
1040
1027
  if (response != null && response.status == 200) {
1041
1028
  setTotalRows(response.data.recordsTotal);
1042
1029
  setRows(response.data.data);
1043
1030
  }
1044
- _context.next = 17;
1031
+ _context.next = 8;
1045
1032
  break;
1046
- case 16:
1033
+ case 7:
1047
1034
  if (rows != null) {
1048
1035
  setTotalRows(eRows.length);
1049
1036
  setRows(eRows);
1050
1037
  }
1051
- case 17:
1038
+ case 8:
1052
1039
  case "end":
1053
1040
  return _context.stop();
1054
1041
  }
@@ -1060,12 +1047,12 @@ var EditableDatagrid = function EditableDatagrid(_ref) {
1060
1047
  }();
1061
1048
  var handleCellEditCommit = _react["default"].useCallback(function () {
1062
1049
  return /*#__PURE__*/function () {
1063
- var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(dataParams) {
1050
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(params) {
1064
1051
  var id, field, value, editedRow;
1065
1052
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
1066
1053
  while (1) switch (_context2.prev = _context2.next) {
1067
1054
  case 0:
1068
- id = dataParams.id, field = dataParams.field, value = dataParams.value;
1055
+ id = params.id, field = params.field, value = params.value;
1069
1056
  editedRow = {
1070
1057
  id: id,
1071
1058
  field: field,
@@ -1090,8 +1077,10 @@ var EditableDatagrid = function EditableDatagrid(_ref) {
1090
1077
  }, /*#__PURE__*/_react["default"].createElement(_xDataGrid.DataGrid, {
1091
1078
  rows: rows,
1092
1079
  sx: sx,
1080
+ key: key,
1093
1081
  columns: columns,
1094
1082
  rowCount: totalRows,
1083
+ onRowClick: onRowClick,
1095
1084
  paginationMode: "server",
1096
1085
  getRowHeight: function getRowHeight() {
1097
1086
  return rowHeight;
@@ -1103,9 +1092,9 @@ var EditableDatagrid = function EditableDatagrid(_ref) {
1103
1092
  rowsPerPageOptions: rowsPerPage,
1104
1093
  disableSelectionOnClick: true,
1105
1094
  onCellEditCommit: handleCellEditCommit(),
1106
- isCellEditable: function isCellEditable(data) {
1095
+ isCellEditable: function isCellEditable(params) {
1107
1096
  if (_isCellEditable != null) {
1108
- _isCellEditable(data);
1097
+ _isCellEditable(params);
1109
1098
  }
1110
1099
  return true;
1111
1100
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "authscape",
3
- "version": "1.0.259",
3
+ "version": "1.0.261",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -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, params = null, onCellEdited = null, sx = {}, height="50vh", pageSize = 50, rowsPerPage = [25, 50, 100], rowHeight = 70}) => {
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, key = null, onRowClick = null}) => {
6
6
 
7
7
  const [rows, setRows] = useState([]);
8
8
  const [totalRows, setTotalRows] = useState(0);
@@ -22,22 +22,11 @@ export const EditableDatagrid = ({loadedUser, url = null, eRows = null, columns,
22
22
 
23
23
  if (url != null)
24
24
  {
25
- let response = null;
26
- if (params == null)
25
+ let response = await apiService().post(url,
27
26
  {
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
- }
27
+ offset: offset,
28
+ length: pageSize
29
+ });
41
30
 
42
31
  if (response != null && response.status == 200)
43
32
  {
@@ -52,9 +41,9 @@ export const EditableDatagrid = ({loadedUser, url = null, eRows = null, columns,
52
41
  }
53
42
  }
54
43
 
55
- const handleCellEditCommit = React.useCallback(() => async (dataParams) => {
44
+ const handleCellEditCommit = React.useCallback(() => async (params) => {
56
45
 
57
- const { id, field, value } = dataParams;
46
+ const { id, field, value } = params;
58
47
  const editedRow = { id, field, value };
59
48
 
60
49
  onCellEdited(editedRow);
@@ -66,8 +55,10 @@ export const EditableDatagrid = ({loadedUser, url = null, eRows = null, columns,
66
55
  <DataGrid
67
56
  rows={rows}
68
57
  sx={sx}
58
+ key={key}
69
59
  columns={columns}
70
60
  rowCount={totalRows}
61
+ onRowClick={onRowClick}
71
62
  paginationMode="server"
72
63
  getRowHeight={() => {
73
64
  return rowHeight;
@@ -77,11 +68,11 @@ export const EditableDatagrid = ({loadedUser, url = null, eRows = null, columns,
77
68
  rowsPerPageOptions={rowsPerPage}
78
69
  disableSelectionOnClick={true}
79
70
  onCellEditCommit={handleCellEditCommit()}
80
- isCellEditable={(data) => {
71
+ isCellEditable={(params) => {
81
72
 
82
73
  if (isCellEditable != null)
83
74
  {
84
- isCellEditable(data);
75
+ isCellEditable(params);
85
76
  }
86
77
  return true;
87
78
  }}