sccoreui 5.7.8 → 5.7.10
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.
|
@@ -5,11 +5,13 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const AgGrid_1 = tslib_1.__importDefault(require("./AgGrid"));
|
|
7
7
|
const advanced_feature_1 = tslib_1.__importDefault(require("./advancedFeature/advanced-feature"));
|
|
8
|
+
const error_ui_1 = tslib_1.__importDefault(require("./error-ui"));
|
|
8
9
|
function ParentForGrid(props) {
|
|
9
10
|
const [gridData] = (0, react_1.useState)({
|
|
10
11
|
rowData: props === null || props === void 0 ? void 0 : props.rowData,
|
|
11
12
|
columnData: props === null || props === void 0 ? void 0 : props.columnData,
|
|
12
13
|
});
|
|
14
|
+
console.log(props, 'pros in parent');
|
|
13
15
|
const [style] = (0, react_1.useState)(props.style);
|
|
14
16
|
const [api, setApi] = (0, react_1.useState)(null);
|
|
15
17
|
const [gridReadyEvent, setGridReadyEvent] = (0, react_1.useState)();
|
|
@@ -34,11 +36,14 @@ function ParentForGrid(props) {
|
|
|
34
36
|
}, []);
|
|
35
37
|
// Callback to products for getting data
|
|
36
38
|
const getData = (startRow, endRow) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
39
|
+
console.log(startRow, endRow, featureDetails, 'params sending to product');
|
|
37
40
|
const response = (yield props.getRowData(startRow, endRow, featureDetails)) || [];
|
|
41
|
+
console.log(response, 'response from call back');
|
|
38
42
|
return response.rowData;
|
|
39
43
|
});
|
|
40
44
|
// Gets call onLoad,scroll and whenever any featureDetails changed
|
|
41
45
|
const onGridReady = (params) => {
|
|
46
|
+
console.log('calling on grid ready');
|
|
42
47
|
setApi(params.api);
|
|
43
48
|
setGridReadyEvent(params);
|
|
44
49
|
console.log(params, "the Params");
|
|
@@ -47,7 +52,8 @@ function ParentForGrid(props) {
|
|
|
47
52
|
const startRow = params.startRow;
|
|
48
53
|
const endRow = params.endRow;
|
|
49
54
|
const result = yield getData(startRow, endRow);
|
|
50
|
-
|
|
55
|
+
console.log(result, 'result from callback');
|
|
56
|
+
if ((result === null || result === void 0 ? void 0 : result.length) > 0) {
|
|
51
57
|
params.successCallback(result, -1);
|
|
52
58
|
}
|
|
53
59
|
else {
|
|
@@ -70,7 +76,7 @@ function ParentForGrid(props) {
|
|
|
70
76
|
// Options that grid should have
|
|
71
77
|
const gridOptions = {
|
|
72
78
|
columnDefs: gridData.columnData,
|
|
73
|
-
rowData: gridData.rowData,
|
|
79
|
+
// rowData: gridData.rowData, // Passing row data
|
|
74
80
|
defaultColDef: defaultColDef,
|
|
75
81
|
enableRangeSelection: true,
|
|
76
82
|
suppressMenuHide: false,
|
|
@@ -89,6 +95,8 @@ function ParentForGrid(props) {
|
|
|
89
95
|
callGrid();
|
|
90
96
|
}
|
|
91
97
|
}, [featureDetails.searchedText]);
|
|
92
|
-
|
|
98
|
+
console.log(gridData, 'grid data');
|
|
99
|
+
console.log(featureDetails, 'feature details');
|
|
100
|
+
return ((0, jsx_runtime_1.jsx)(error_ui_1.default, { children: (0, jsx_runtime_1.jsxs)("div", Object.assign({ style: { height: style.height, width: style.width } }, { children: [(0, jsx_runtime_1.jsx)(advanced_feature_1.default, { featureDetails: featureDetails, setFeatureDetails: setFeatureDetails, columnData: gridData.columnData, props: props, callGrid: callGrid }), (0, jsx_runtime_1.jsx)(AgGrid_1.default, { style: style, gridOptions: gridOptions, onGridReady: onGridReady })] })) }));
|
|
93
101
|
}
|
|
94
102
|
exports.default = ParentForGrid;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
function ErrorBoundary({ children }) {
|
|
6
|
+
const [hasError, setHasError] = (0, react_1.useState)(false);
|
|
7
|
+
(0, react_1.useEffect)(() => {
|
|
8
|
+
const errorHandler = (error, errorInfo) => {
|
|
9
|
+
setHasError(true);
|
|
10
|
+
// You can log the error here
|
|
11
|
+
console.error(error, errorInfo, 'error details');
|
|
12
|
+
};
|
|
13
|
+
// Add the error handler to the window object
|
|
14
|
+
window.addEventListener('error', errorHandler);
|
|
15
|
+
// Clean up the error handler
|
|
16
|
+
return () => {
|
|
17
|
+
window.removeEventListener('error', errorHandler);
|
|
18
|
+
};
|
|
19
|
+
}, []);
|
|
20
|
+
if (hasError) {
|
|
21
|
+
console.log(hasError, 'error occured');
|
|
22
|
+
// Fallback UI for when an error occurs
|
|
23
|
+
return (0, jsx_runtime_1.jsx)("div", { children: " Something went wrong" });
|
|
24
|
+
}
|
|
25
|
+
return children;
|
|
26
|
+
}
|
|
27
|
+
exports.default = ErrorBoundary;
|