sccoreui 5.8.1 → 5.8.2
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.
|
@@ -8,6 +8,7 @@ const advanced_feature_1 = tslib_1.__importDefault(require("./advancedFeature/ad
|
|
|
8
8
|
const grid_checkbox_1 = tslib_1.__importDefault(require("./grid-checkbox"));
|
|
9
9
|
const MyProvider_1 = tslib_1.__importDefault(require("./MyProvider"));
|
|
10
10
|
const error_ui_1 = tslib_1.__importDefault(require("./error-ui"));
|
|
11
|
+
const constants_1 = require("./constants");
|
|
11
12
|
function ParentForGrid(props) {
|
|
12
13
|
const [gridData, setGridData] = (0, react_1.useState)({
|
|
13
14
|
rowData: [],
|
|
@@ -107,7 +108,7 @@ function ParentForGrid(props) {
|
|
|
107
108
|
return emptyResponse;
|
|
108
109
|
});
|
|
109
110
|
// Gets call onLoad,scroll and whenever any featureDetails changed
|
|
110
|
-
const onGridReady = (params, updatedFeatures) => {
|
|
111
|
+
const onGridReady = (params, updatedFeatures) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
111
112
|
setIsLoading(true);
|
|
112
113
|
setApi(params.api);
|
|
113
114
|
setGridReadyEvent(params);
|
|
@@ -115,23 +116,31 @@ function ParentForGrid(props) {
|
|
|
115
116
|
if (!updatedFeatures) {
|
|
116
117
|
currentFeatures = featureDetails;
|
|
117
118
|
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
params.
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
119
|
+
if (props.rowModelType === constants_1.ROWMODELTYPE.CLIENT_SIDE) {
|
|
120
|
+
const result = yield getData(0, 0, currentFeatures);
|
|
121
|
+
if (result.rowData) {
|
|
122
|
+
params.api.applyTransaction({ add: result.rowData });
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
else if (props.rowModelType === constants_1.ROWMODELTYPE.INFINITE) {
|
|
126
|
+
const dataSource = {
|
|
127
|
+
getRows: (params) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
128
|
+
var _c;
|
|
129
|
+
const startRow = params.startRow;
|
|
130
|
+
const endRow = params.endRow;
|
|
131
|
+
const result = yield getData(startRow, endRow, currentFeatures);
|
|
132
|
+
if (((_c = result === null || result === void 0 ? void 0 : result.rowData) === null || _c === void 0 ? void 0 : _c.length) > 0) {
|
|
133
|
+
params.successCallback(result === null || result === void 0 ? void 0 : result.rowData, result === null || result === void 0 ? void 0 : result.actualEndRow);
|
|
134
|
+
}
|
|
135
|
+
else {
|
|
136
|
+
params.failCallback();
|
|
137
|
+
}
|
|
138
|
+
}),
|
|
139
|
+
};
|
|
140
|
+
params.api.setGridOption("datasource", dataSource);
|
|
141
|
+
}
|
|
133
142
|
setIsLoading(false);
|
|
134
|
-
};
|
|
143
|
+
});
|
|
135
144
|
// Get values when cell edited
|
|
136
145
|
const getEditedColumn = (params) => {
|
|
137
146
|
var _a;
|
|
@@ -161,7 +170,7 @@ function ParentForGrid(props) {
|
|
|
161
170
|
rowSelection: "multiple",
|
|
162
171
|
suppressRowClickSelection: true,
|
|
163
172
|
rowHeight: 60,
|
|
164
|
-
rowModelType:
|
|
173
|
+
rowModelType: props.rowModelType, // Infinite scroll
|
|
165
174
|
};
|
|
166
175
|
// Fucntion to call the grid
|
|
167
176
|
const callGrid = (featureDetails) => {
|
|
@@ -182,13 +191,13 @@ function ParentForGrid(props) {
|
|
|
182
191
|
unselectedCheckboxData: [],
|
|
183
192
|
});
|
|
184
193
|
}, [featureDetails]);
|
|
185
|
-
|
|
194
|
+
console.log(isLoading, 'is loading state');
|
|
195
|
+
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(error_ui_1.default, { children: (0, jsx_runtime_1.jsx)("div", Object.assign({ style: { height: style.height, width: style.width } }, { children: (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)(MyProvider_1.default, Object.assign({ value: {
|
|
186
196
|
featureDetails,
|
|
187
197
|
setFeatureDetails,
|
|
188
198
|
gridData,
|
|
189
199
|
callGrid,
|
|
190
200
|
totalRecords
|
|
191
|
-
} }, { children: (0, jsx_runtime_1.jsx)(advanced_feature_1.default, { props: props }) })), (0, jsx_runtime_1.jsx)(AgGrid_1.default, { style: style, gridOptions: gridOptions, onGridReady: onGridReady })] }))
|
|
192
|
-
) })) }) }));
|
|
201
|
+
} }, { children: (0, jsx_runtime_1.jsx)(advanced_feature_1.default, { props: props }) })), (0, jsx_runtime_1.jsx)(AgGrid_1.default, { style: style, gridOptions: gridOptions, onGridReady: onGridReady })] }) })) }) }));
|
|
193
202
|
}
|
|
194
203
|
exports.default = ParentForGrid;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.conditionsList = exports.COLUMN_SORT_OPTIONS = void 0;
|
|
3
|
+
exports.ROWMODELTYPE = exports.conditionsList = exports.COLUMN_SORT_OPTIONS = void 0;
|
|
4
4
|
const Types_1 = require("./Types");
|
|
5
5
|
exports.COLUMN_SORT_OPTIONS = [
|
|
6
6
|
{ id: 1, label: "Low - High", sortId: 1, dataType: Types_1.ATTRIBUTEDATATYPES.INTEGER },
|
|
@@ -37,3 +37,8 @@ exports.conditionsList = [
|
|
|
37
37
|
{ name: "is equal to all of", datatypes: ["boolean"], code: "24" },
|
|
38
38
|
{ name: "is equal to any of", datatypes: ["string"], code: "25" }
|
|
39
39
|
];
|
|
40
|
+
exports.ROWMODELTYPE = {
|
|
41
|
+
INFINITE: "infinite",
|
|
42
|
+
SERVER_SIDE: "serverSide",
|
|
43
|
+
CLIENT_SIDE: "clientSide",
|
|
44
|
+
};
|