authscape 1.0.257 → 1.0.259
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 +31 -18
- package/package.json +4 -1
- package/src/components/EditableDatagrid.js +20 -9
- package/src/components/RichTextEditor.js +2 -4
package/index.js
CHANGED
|
@@ -974,6 +974,8 @@ 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,
|
|
977
979
|
_ref$onCellEdited = _ref.onCellEdited,
|
|
978
980
|
onCellEdited = _ref$onCellEdited === void 0 ? null : _ref$onCellEdited,
|
|
979
981
|
_ref$sx = _ref.sx,
|
|
@@ -1010,28 +1012,43 @@ var EditableDatagrid = function EditableDatagrid(_ref) {
|
|
|
1010
1012
|
while (1) switch (_context.prev = _context.next) {
|
|
1011
1013
|
case 0:
|
|
1012
1014
|
if (!(url != null)) {
|
|
1013
|
-
_context.next =
|
|
1015
|
+
_context.next = 16;
|
|
1014
1016
|
break;
|
|
1015
1017
|
}
|
|
1016
|
-
|
|
1018
|
+
response = null;
|
|
1019
|
+
if (!(params == null)) {
|
|
1020
|
+
_context.next = 8;
|
|
1021
|
+
break;
|
|
1022
|
+
}
|
|
1023
|
+
_context.next = 5;
|
|
1017
1024
|
return apiService().post(url, {
|
|
1018
1025
|
offset: offset,
|
|
1019
1026
|
length: pageSize
|
|
1020
1027
|
});
|
|
1021
|
-
case
|
|
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:
|
|
1022
1038
|
response = _context.sent;
|
|
1039
|
+
case 13:
|
|
1023
1040
|
if (response != null && response.status == 200) {
|
|
1024
1041
|
setTotalRows(response.data.recordsTotal);
|
|
1025
1042
|
setRows(response.data.data);
|
|
1026
1043
|
}
|
|
1027
|
-
_context.next =
|
|
1044
|
+
_context.next = 17;
|
|
1028
1045
|
break;
|
|
1029
|
-
case
|
|
1046
|
+
case 16:
|
|
1030
1047
|
if (rows != null) {
|
|
1031
1048
|
setTotalRows(eRows.length);
|
|
1032
1049
|
setRows(eRows);
|
|
1033
1050
|
}
|
|
1034
|
-
case
|
|
1051
|
+
case 17:
|
|
1035
1052
|
case "end":
|
|
1036
1053
|
return _context.stop();
|
|
1037
1054
|
}
|
|
@@ -1043,12 +1060,12 @@ var EditableDatagrid = function EditableDatagrid(_ref) {
|
|
|
1043
1060
|
}();
|
|
1044
1061
|
var handleCellEditCommit = _react["default"].useCallback(function () {
|
|
1045
1062
|
return /*#__PURE__*/function () {
|
|
1046
|
-
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(
|
|
1063
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(dataParams) {
|
|
1047
1064
|
var id, field, value, editedRow;
|
|
1048
1065
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
1049
1066
|
while (1) switch (_context2.prev = _context2.next) {
|
|
1050
1067
|
case 0:
|
|
1051
|
-
id =
|
|
1068
|
+
id = dataParams.id, field = dataParams.field, value = dataParams.value;
|
|
1052
1069
|
editedRow = {
|
|
1053
1070
|
id: id,
|
|
1054
1071
|
field: field,
|
|
@@ -1086,9 +1103,9 @@ var EditableDatagrid = function EditableDatagrid(_ref) {
|
|
|
1086
1103
|
rowsPerPageOptions: rowsPerPage,
|
|
1087
1104
|
disableSelectionOnClick: true,
|
|
1088
1105
|
onCellEditCommit: handleCellEditCommit(),
|
|
1089
|
-
isCellEditable: function isCellEditable(
|
|
1106
|
+
isCellEditable: function isCellEditable(data) {
|
|
1090
1107
|
if (_isCellEditable != null) {
|
|
1091
|
-
_isCellEditable(
|
|
1108
|
+
_isCellEditable(data);
|
|
1092
1109
|
}
|
|
1093
1110
|
return true;
|
|
1094
1111
|
}
|
|
@@ -2538,8 +2555,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
2538
2555
|
value: true
|
|
2539
2556
|
});
|
|
2540
2557
|
exports.RichTextEditor = void 0;
|
|
2558
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
2541
2559
|
var _draftJs = require("draft-js");
|
|
2542
|
-
var _react = require("react");
|
|
2543
2560
|
var _draftjsToHtml = _interopRequireDefault(require("draftjs-to-html"));
|
|
2544
2561
|
var _dynamic = _interopRequireDefault(require("next/dynamic"));
|
|
2545
2562
|
var _material = require("@mui/material");
|
|
@@ -2572,10 +2589,6 @@ var RichTextEditor = function RichTextEditor(_ref) {
|
|
|
2572
2589
|
_useState2 = _slicedToArray(_useState, 2),
|
|
2573
2590
|
editorState = _useState2[0],
|
|
2574
2591
|
setEditorState = _useState2[1];
|
|
2575
|
-
var _useState3 = (0, _react.useState)(),
|
|
2576
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
2577
|
-
text = _useState4[0],
|
|
2578
|
-
setText = _useState4[1];
|
|
2579
2592
|
var onEditorStateChange = function onEditorStateChange(editorState) {
|
|
2580
2593
|
setEditorState(editorState);
|
|
2581
2594
|
};
|
|
@@ -2589,7 +2602,7 @@ var RichTextEditor = function RichTextEditor(_ref) {
|
|
|
2589
2602
|
}
|
|
2590
2603
|
}
|
|
2591
2604
|
}, [html]);
|
|
2592
|
-
return /*#__PURE__*/
|
|
2605
|
+
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(Editor, {
|
|
2593
2606
|
editorState: editorState,
|
|
2594
2607
|
toolbarClassName: "toolbarClassName",
|
|
2595
2608
|
wrapperClassName: "wrapperClassName",
|
|
@@ -2612,11 +2625,11 @@ var RichTextEditor = function RichTextEditor(_ref) {
|
|
|
2612
2625
|
// { text: "HONEYDEW", value: "honeydew", url: "honeydew" }
|
|
2613
2626
|
// ]
|
|
2614
2627
|
// }}
|
|
2615
|
-
}), /*#__PURE__*/
|
|
2628
|
+
}), /*#__PURE__*/_react["default"].createElement("hr", null), /*#__PURE__*/_react["default"].createElement(_material.Box, {
|
|
2616
2629
|
sx: {
|
|
2617
2630
|
textAlign: "right"
|
|
2618
2631
|
}
|
|
2619
|
-
}, /*#__PURE__*/
|
|
2632
|
+
}, /*#__PURE__*/_react["default"].createElement(_material.Button, {
|
|
2620
2633
|
variant: "contained",
|
|
2621
2634
|
onClick: /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
2622
2635
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "authscape",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.259",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -32,6 +32,8 @@
|
|
|
32
32
|
"@stripe/react-stripe-js": "^1.9.0",
|
|
33
33
|
"@stripe/stripe-js": "^1.32.0",
|
|
34
34
|
"axios": "^0.27.2",
|
|
35
|
+
"draft-js": "^0.11.7",
|
|
36
|
+
"draftjs-to-html": "^0.9.1",
|
|
35
37
|
"eslint-config-next": "^13.3.2",
|
|
36
38
|
"ga-4-react": "^0.1.281",
|
|
37
39
|
"html2canvas": "^1.4.1",
|
|
@@ -43,6 +45,7 @@
|
|
|
43
45
|
"react-color": "^2.19.3",
|
|
44
46
|
"react-cool-onclickoutside": "^1.7.0",
|
|
45
47
|
"react-data-table-component": "^7.5.2",
|
|
48
|
+
"react-draft-wysiwyg": "^1.15.0",
|
|
46
49
|
"react-hook-form": "^7.44.2",
|
|
47
50
|
"react-toastify": "^9.1.3",
|
|
48
51
|
"use-places-autocomplete": "^4.0.0"
|
|
@@ -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}) => {
|
|
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}) => {
|
|
6
6
|
|
|
7
7
|
const [rows, setRows] = useState([]);
|
|
8
8
|
const [totalRows, setTotalRows] = useState(0);
|
|
@@ -22,11 +22,22 @@ 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
|
+
}
|
|
30
41
|
|
|
31
42
|
if (response != null && response.status == 200)
|
|
32
43
|
{
|
|
@@ -41,9 +52,9 @@ export const EditableDatagrid = ({loadedUser, url = null, eRows = null, columns,
|
|
|
41
52
|
}
|
|
42
53
|
}
|
|
43
54
|
|
|
44
|
-
const handleCellEditCommit = React.useCallback(() => async (
|
|
55
|
+
const handleCellEditCommit = React.useCallback(() => async (dataParams) => {
|
|
45
56
|
|
|
46
|
-
const { id, field, value } =
|
|
57
|
+
const { id, field, value } = dataParams;
|
|
47
58
|
const editedRow = { id, field, value };
|
|
48
59
|
|
|
49
60
|
onCellEdited(editedRow);
|
|
@@ -66,11 +77,11 @@ export const EditableDatagrid = ({loadedUser, url = null, eRows = null, columns,
|
|
|
66
77
|
rowsPerPageOptions={rowsPerPage}
|
|
67
78
|
disableSelectionOnClick={true}
|
|
68
79
|
onCellEditCommit={handleCellEditCommit()}
|
|
69
|
-
isCellEditable={(
|
|
80
|
+
isCellEditable={(data) => {
|
|
70
81
|
|
|
71
82
|
if (isCellEditable != null)
|
|
72
83
|
{
|
|
73
|
-
isCellEditable(
|
|
84
|
+
isCellEditable(data);
|
|
74
85
|
}
|
|
75
86
|
return true;
|
|
76
87
|
}}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import React, { useState, useEffect } from "react";
|
|
2
|
+
import { convertToRaw, EditorState, ContentState, convertFromHTML } from "draft-js";
|
|
3
3
|
import draftToHtml from "draftjs-to-html";
|
|
4
4
|
import dynamic from 'next/dynamic';
|
|
5
5
|
import { Box, Button } from "@mui/material";
|
|
6
|
-
import { convertFromHTML } from 'draft-js';
|
|
7
6
|
|
|
8
7
|
const Editor = dynamic(
|
|
9
8
|
() => import('react-draft-wysiwyg').then(mod => mod.Editor),
|
|
@@ -13,7 +12,6 @@ const Editor = dynamic(
|
|
|
13
12
|
export const RichTextEditor = ({html, onSave}) => {
|
|
14
13
|
|
|
15
14
|
const [editorState, setEditorState] = useState(EditorState.createEmpty());
|
|
16
|
-
const [text, setText] = useState();
|
|
17
15
|
const onEditorStateChange = function (editorState) {
|
|
18
16
|
setEditorState(editorState);
|
|
19
17
|
};
|