sccoreui 6.1.24 → 6.1.25
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.
|
@@ -79,12 +79,14 @@ const updateCells = (updatedRowData, setUpdateRowData, api) => {
|
|
|
79
79
|
};
|
|
80
80
|
exports.updateCells = updateCells;
|
|
81
81
|
// Fill data in grid through drag
|
|
82
|
-
const fillOperation = (params, api,
|
|
82
|
+
const fillOperation = (params, api, parentNode, editedRecords, setEditedRecords) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
83
|
+
var _a, _b;
|
|
83
84
|
const { finalRange } = params;
|
|
84
85
|
const { startRow, endRow, columns,
|
|
85
86
|
// startColumn
|
|
86
87
|
} = finalRange;
|
|
87
88
|
const columnDetails = columns[0].colDef;
|
|
89
|
+
const parentRowData = parentNode === null || parentNode === void 0 ? void 0 : parentNode.data;
|
|
88
90
|
// Get current updated rows
|
|
89
91
|
const currentUpdatedRows = [];
|
|
90
92
|
// Collect all selected rows
|
|
@@ -96,6 +98,9 @@ const fillOperation = (params, api, parentRowData, editedRecords, setEditedRecor
|
|
|
96
98
|
const rowData = rowNode === null || rowNode === void 0 ? void 0 : rowNode.data;
|
|
97
99
|
// Check if rowData exists and update the field
|
|
98
100
|
if (rowData && (rowNode.id != parentRowData.id)) {
|
|
101
|
+
// If Dragged cell is grouped only group headers should edit vice versa to child cells
|
|
102
|
+
if ((rowNode === null || rowNode === void 0 ? void 0 : rowNode.group) !== (parentNode === null || parentNode === void 0 ? void 0 : parentNode.group))
|
|
103
|
+
continue;
|
|
99
104
|
// if( rowData?.[columnDetails?.field] == EMPTY_RECORD || rowData?.type !== parentRowData?.type || !rowData?.[columnDetails?.field] ){
|
|
100
105
|
// continue
|
|
101
106
|
// }
|
|
@@ -104,8 +109,8 @@ const fillOperation = (params, api, parentRowData, editedRecords, setEditedRecor
|
|
|
104
109
|
row: rowData,
|
|
105
110
|
field: []
|
|
106
111
|
};
|
|
107
|
-
if (!schemaForEdit.field.includes(columnDetails === null || columnDetails === void 0 ? void 0 : columnDetails.field)) {
|
|
108
|
-
schemaForEdit.field.push(columnDetails === null || columnDetails === void 0 ? void 0 : columnDetails.field);
|
|
112
|
+
if (!((_a = schemaForEdit === null || schemaForEdit === void 0 ? void 0 : schemaForEdit.field) === null || _a === void 0 ? void 0 : _a.includes(columnDetails === null || columnDetails === void 0 ? void 0 : columnDetails.field))) {
|
|
113
|
+
(_b = schemaForEdit === null || schemaForEdit === void 0 ? void 0 : schemaForEdit.field) === null || _b === void 0 ? void 0 : _b.push(columnDetails === null || columnDetails === void 0 ? void 0 : columnDetails.field);
|
|
109
114
|
}
|
|
110
115
|
currentUpdatedRows.push(schemaForEdit);
|
|
111
116
|
// Update the row
|
|
@@ -166,30 +166,10 @@ function ParentForGrid(props) {
|
|
|
166
166
|
params.api.applyTransaction({ add: [] });
|
|
167
167
|
}
|
|
168
168
|
}
|
|
169
|
-
else if (props.rowModelType === constants_1.ROWMODELTYPE.INFINITE) {
|
|
170
|
-
const dataSource = {
|
|
171
|
-
getRows: (params) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
172
|
-
var _h;
|
|
173
|
-
const startRow = params.startRow;
|
|
174
|
-
const endRow = params.endRow;
|
|
175
|
-
const result = yield getData(startRow, endRow, currentFeatures);
|
|
176
|
-
if (((_h = result === null || result === void 0 ? void 0 : result.rowData) === null || _h === void 0 ? void 0 : _h.length) > 0) {
|
|
177
|
-
gridRef.current.api.hideOverlay();
|
|
178
|
-
params.successCallback(result === null || result === void 0 ? void 0 : result.rowData, result === null || result === void 0 ? void 0 : result.actualEndRow);
|
|
179
|
-
}
|
|
180
|
-
else {
|
|
181
|
-
params.successCallback([], 0);
|
|
182
|
-
gridRef.current.api.showNoRowsOverlay();
|
|
183
|
-
// params.failCallback();
|
|
184
|
-
}
|
|
185
|
-
}),
|
|
186
|
-
};
|
|
187
|
-
params.api.setGridOption("datasource", dataSource);
|
|
188
|
-
}
|
|
189
169
|
else if (props.rowModelType === constants_1.ROWMODELTYPE.SERVER_SIDE) {
|
|
190
170
|
const dataSource = {
|
|
191
171
|
getRows: (params) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
192
|
-
var
|
|
172
|
+
var _h, _j;
|
|
193
173
|
const startRow = params.request.startRow;
|
|
194
174
|
const endRow = params.request.endRow;
|
|
195
175
|
// Scroll should not exit MAX_RECORDS_TO_LOAD
|
|
@@ -205,7 +185,7 @@ function ParentForGrid(props) {
|
|
|
205
185
|
// get data for request from our fake server
|
|
206
186
|
const response = yield getData(startRow, endRow, currentFeatures, params);
|
|
207
187
|
// simulating real server call with a 500ms delay
|
|
208
|
-
if (((
|
|
188
|
+
if (((_h = response.rowData) === null || _h === void 0 ? void 0 : _h.length) > 0) {
|
|
209
189
|
setGridData(Object.assign(Object.assign({}, gridData), { rowData: response.rowData }));
|
|
210
190
|
gridRef.current.api.hideOverlay();
|
|
211
191
|
// supply rows for requested block to grid
|
|
@@ -215,7 +195,7 @@ function ParentForGrid(props) {
|
|
|
215
195
|
else {
|
|
216
196
|
// params.fail();
|
|
217
197
|
const gridRows = startRow >= constants_1.BLOCK_SIZE ? gridData.rowData : [];
|
|
218
|
-
if (!((
|
|
198
|
+
if (!((_j = params === null || params === void 0 ? void 0 : params.parentNode) === null || _j === void 0 ? void 0 : _j.id))
|
|
219
199
|
gridRef.current.api.showNoRowsOverlay();
|
|
220
200
|
params.success({ rowData: gridRows });
|
|
221
201
|
return;
|
|
@@ -225,35 +205,24 @@ function ParentForGrid(props) {
|
|
|
225
205
|
params.api.setGridOption("serverSideDatasource", dataSource);
|
|
226
206
|
}
|
|
227
207
|
});
|
|
208
|
+
// Specify unique id for every row for grid
|
|
228
209
|
const getRowId = (prams) => prams.data.id;
|
|
229
210
|
// Get the direction of selected range
|
|
230
211
|
const onCellMouseDown = (event) => {
|
|
231
212
|
if (event.colDef.suppressFillHandle)
|
|
232
213
|
return;
|
|
233
|
-
setInitialDragRowData(event.node
|
|
214
|
+
setInitialDragRowData(event.node);
|
|
234
215
|
};
|
|
235
216
|
// Update cell from front end and give a call back to products
|
|
236
217
|
const wrapperToFillOpertation = (params) => {
|
|
237
218
|
(0, helper_1.fillOperation)(params, api, initalDragRowData, props === null || props === void 0 ? void 0 : props.editedRecords, props === null || props === void 0 ? void 0 : props.setEditedRecords);
|
|
238
219
|
};
|
|
220
|
+
// Operation on fill handle
|
|
239
221
|
const myOpertaion = (fillOperationParams) => {
|
|
240
|
-
|
|
222
|
+
var _a, _b, _c;
|
|
223
|
+
return (_b = (_a = fillOperationParams === null || fillOperationParams === void 0 ? void 0 : fillOperationParams.rowNode) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b[(_c = fillOperationParams === null || fillOperationParams === void 0 ? void 0 : fillOperationParams.column) === null || _c === void 0 ? void 0 : _c.colId];
|
|
241
224
|
};
|
|
242
|
-
|
|
243
|
-
// let columnToReturn: ColumnDef[] = [];
|
|
244
|
-
// const returnRenderColumn = useCallback(() => {
|
|
245
|
-
// let columnToReturn: ColumnDef[] = [];
|
|
246
|
-
// gridData.columnData.filter((column) => {
|
|
247
|
-
// props.columnData.filter((pColumn) => {
|
|
248
|
-
// if (column.id === pColumn.id || column.field === pColumn.field) {
|
|
249
|
-
// columnToReturn.push(column);
|
|
250
|
-
// }
|
|
251
|
-
// });
|
|
252
|
-
// });
|
|
253
|
-
// // setGridData({...gridData,columnData:columnToReturn})
|
|
254
|
-
// setColumnToRender(columnToReturn);
|
|
255
|
-
// // return columnToReturn
|
|
256
|
-
// }, [props?.columnData]);
|
|
225
|
+
console.log(onCellMouseDown, wrapperToFillOpertation, myOpertaion);
|
|
257
226
|
// Options that grid should have
|
|
258
227
|
const gridOptions = {
|
|
259
228
|
columnDefs: gridData.columnData.map((column) => {
|
|
@@ -295,9 +264,6 @@ function ParentForGrid(props) {
|
|
|
295
264
|
const callGrid = (featureDetails) => {
|
|
296
265
|
onGridReady(gridReadyEvent, featureDetails);
|
|
297
266
|
};
|
|
298
|
-
// useEffect(()=>{
|
|
299
|
-
// returnRenderColumn()
|
|
300
|
-
// },[props?.columnData])
|
|
301
267
|
// Call Grid if something is searched
|
|
302
268
|
(0, react_1.useEffect)(() => {
|
|
303
269
|
if (api && gridReadyEvent) {
|
|
@@ -3,4 +3,4 @@ export declare const parseIfNeeded: (value: any) => any;
|
|
|
3
3
|
export declare const sortColumns: (columns: any) => any;
|
|
4
4
|
export declare const getCheckedStatus: (row: any, featureDetails: any, GRID_CHECKBOX_STATUS: any, setFeatureDetails: any) => any;
|
|
5
5
|
export declare const updateCells: (updatedRowData: any, setUpdateRowData: any, api: any) => void;
|
|
6
|
-
export declare const fillOperation: (params: any, api: any,
|
|
6
|
+
export declare const fillOperation: (params: any, api: any, parentNode: any, editedRecords: any, setEditedRecords: any) => Promise<void>;
|