sccoreui 5.9.93 → 5.9.95

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.
@@ -126,8 +126,10 @@ function ParentForGrid(props) {
126
126
  if (!(props === null || props === void 0 ? void 0 : props.getRowData)) {
127
127
  return emptyResponse; // If callback function to get row data is not provided
128
128
  }
129
- gridRef.current.api.showLoadingOverlay();
130
- const response = yield props.getRowData(startRow, endRow, currentFeatures);
129
+ if (props.rowModelType !== constants_1.ROWMODELTYPE.SERVER_SIDE) {
130
+ gridRef.current.api.showLoadingOverlay();
131
+ }
132
+ const response = yield (props === null || props === void 0 ? void 0 : props.getRowData(startRow, endRow, currentFeatures));
131
133
  setGridData(Object.assign(Object.assign({}, gridData), { rowData: [] }));
132
134
  // Clear selected checkbox
133
135
  // setFeatureDetails((prev: any) => ({ ...prev, checkBoxSelection: initialCheckBoxData }));
@@ -190,6 +192,29 @@ function ParentForGrid(props) {
190
192
  };
191
193
  params.api.setGridOption("datasource", dataSource);
192
194
  }
195
+ else if (props.rowModelType === constants_1.ROWMODELTYPE.SERVER_SIDE) {
196
+ const dataSource = {
197
+ getRows: (params) => tslib_1.__awaiter(this, void 0, void 0, function* () {
198
+ const startRow = params.request.startRow;
199
+ const endRow = params.request.endRow;
200
+ console.log("[Datasource] - rows requested by grid: ", params.request);
201
+ // get data for request from our fake server
202
+ const response = yield getData(startRow, endRow, currentFeatures);
203
+ // simulating real server call with a 500ms delay
204
+ setTimeout(() => {
205
+ var _a;
206
+ if (((_a = response.rowData) === null || _a === void 0 ? void 0 : _a.length) > 0) {
207
+ // supply rows for requested block to grid
208
+ params.success({ rowData: response.rowData });
209
+ }
210
+ else {
211
+ params.fail();
212
+ }
213
+ }, 500);
214
+ }),
215
+ };
216
+ params.api.setGridOption("serverSideDatasource", dataSource);
217
+ }
193
218
  });
194
219
  // Options that grid should have
195
220
  const gridOptions = {
@@ -219,7 +244,8 @@ function ParentForGrid(props) {
219
244
  noRowsOverlayComponent: props === null || props === void 0 ? void 0 : props.noRowsOverlayComponent,
220
245
  loadingOverlayComponent: loading_component_1.default,
221
246
  suppressCellFocus: true,
222
- suppressPropertyNamesCheck: true // Suppress warnings,
247
+ suppressPropertyNamesCheck: true,
248
+ suppressServerSideFullWidthLoadingRow: true
223
249
  };
224
250
  // Fucntion to call the grid
225
251
  const callGrid = (featureDetails) => {
@@ -250,36 +276,44 @@ function ParentForGrid(props) {
250
276
  }
251
277
  }, [featureDetails]);
252
278
  // Update gridData.columnData whenever props.columnData changes
279
+ // useEffect(() => {
280
+ // setGridData((prevGridData) => {
281
+ // const updatedColumns = sortColumns(props?.columnData)
282
+ // .filter(newCol => newCol.id) // Ensure only columns with an `id` are processed
283
+ // .map((newCol) => {
284
+ // const existingCol = prevGridData.columnData.find((col) => col.id === newCol.id);
285
+ // if (existingCol) {
286
+ // return {
287
+ // ...existingCol,
288
+ // ...newCol,
289
+ // };
290
+ // }
291
+ // return newCol;
292
+ // });
293
+ // return {
294
+ // ...prevGridData,
295
+ // columnData: updatedColumns,
296
+ // };
297
+ // });
298
+ // }, [props?.columnData]);
253
299
  (0, react_1.useEffect)(() => {
254
- setGridData((prevGridData) => {
255
- const updatedColumns = (0, helper_1.sortColumns)(props === null || props === void 0 ? void 0 : props.columnData)
256
- .filter(newCol => newCol.id) // Ensure only columns with an `id` are processed
257
- .map((newCol) => {
258
- const existingCol = prevGridData.columnData.find((col) => col.id === newCol.id);
259
- if (existingCol) {
260
- return Object.assign(Object.assign({}, existingCol), newCol);
300
+ var _a;
301
+ const existingColumns = (_a = gridRef === null || gridRef === void 0 ? void 0 : gridRef.current.api) === null || _a === void 0 ? void 0 : _a.getColumnDefs();
302
+ if (!(props === null || props === void 0 ? void 0 : props.columnData) || !existingColumns)
303
+ return;
304
+ const columnFromProps = (0, helper_1.sortColumns)(props === null || props === void 0 ? void 0 : props.columnData);
305
+ const updatedColumnDefs = existingColumns.map((colDef) => {
306
+ columnFromProps.find((col) => {
307
+ if (col.id === colDef.id) {
308
+ colDef.hide = col.hide;
309
+ colDef.seq = col === null || col === void 0 ? void 0 : col.seq;
261
310
  }
262
- return newCol;
263
311
  });
264
- return Object.assign(Object.assign({}, prevGridData), { columnData: updatedColumns });
312
+ return colDef;
265
313
  });
314
+ const reOrderedColumns = updatedColumnDefs.sort((a, b) => a.seq - b.seq);
315
+ gridRef.current.api.setGridOption("columnDefs", reOrderedColumns);
266
316
  }, [props === null || props === void 0 ? void 0 : props.columnData]);
267
- // useEffect(()=>{
268
- // const existingColumns:any = gridRef?.current!.api?.getColumnDefs();
269
- // if(!props?.columnData || !existingColumns) return
270
- // const columnFromProps:ColumnDef[] = sortColumns(props?.columnData)
271
- // const updatedColumnDefs = existingColumns.map((colDef) => {
272
- // columnFromProps.find((col: ColumnDef) => {
273
- // if (col.id === colDef.id) {
274
- // colDef.hide = col.hide;
275
- // colDef.seq = col?.seq
276
- // }
277
- // });
278
- // return colDef;
279
- // });
280
- // const reOrderedColumns = updatedColumnDefs.sort((a,b)=>a.seq-b.seq)
281
- // gridRef.current!.api.setGridOption("columnDefs",reOrderedColumns);
282
- // },[props?.columnData])
283
317
  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 }, className: "ag-grid-container border-1 border-gray-200 border-round" }, { children: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(context_provider_1.default, Object.assign({ value: {
284
318
  featureDetails,
285
319
  setFeatureDetails,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sccoreui",
3
- "version": "5.9.93",
3
+ "version": "5.9.95",
4
4
  "description": "ui-sccore",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -29,11 +29,6 @@
29
29
  "sass": "^1.62.1"
30
30
  },
31
31
  "dependencies": {
32
- "@ag-grid-community/client-side-row-model": "^31.2.1",
33
- "@ag-grid-community/infinite-row-model": "^31.2.1",
34
- "@ag-grid-community/react": "^31.2.1",
35
- "@ag-grid-enterprise/core": "^31.2.1",
36
- "@ag-grid-enterprise/range-selection": "^31.2.1",
37
32
  "@babel/plugin-proposal-private-property-in-object": "^7.21.11",
38
33
  "ag-grid-react": "^31.2.1",
39
34
  "axios": "^1.6.8",
@@ -45,15 +40,42 @@
45
40
  "primeicons": "^6.0.1",
46
41
  "primereact": "^9.5.0",
47
42
  "quill": "^1.3.7",
48
- "react": "^18.2.0",
49
43
  "react-color": "^2.19.3",
50
- "react-dom": "^18.2.0",
51
44
  "react-froala-wysiwyg": "^4.1.2",
52
45
  "react-phone-number-input": "^3.3.6",
53
46
  "react-router-dom": "^6.12.0",
54
47
  "react-scripts": "^5.0.1",
55
48
  "typescript": "^4.9.5",
56
- "yup": "^1.3.2"
49
+ "yup": "^1.3.2",
50
+ "react": "18",
51
+ "react-dom": "18",
52
+ "@types/react": "18",
53
+ "@types/react-dom": "18",
54
+ "@ag-grid-community/react": "^31.3.2",
55
+ "@ag-grid-community/core": "^31.3.2",
56
+ "@ag-grid-community/styles": "^31.3.2",
57
+ "@ag-grid-community/client-side-row-model": "^31.3.2",
58
+ "@ag-grid-community/infinite-row-model": "^31.3.2",
59
+ "@ag-grid-community/csv-export": "^31.3.2",
60
+ "@ag-grid-enterprise/core": "^31.3.2",
61
+ "@ag-grid-enterprise/charts-enterprise": "^31.3.2",
62
+ "@ag-grid-enterprise/sparklines": "^31.3.2",
63
+ "@ag-grid-enterprise/clipboard": "^31.3.2",
64
+ "@ag-grid-enterprise/column-tool-panel": "^31.3.2",
65
+ "@ag-grid-enterprise/excel-export": "^31.3.2",
66
+ "@ag-grid-enterprise/filter-tool-panel": "^31.3.2",
67
+ "@ag-grid-enterprise/master-detail": "^31.3.2",
68
+ "@ag-grid-enterprise/menu": "^31.3.2",
69
+ "@ag-grid-enterprise/range-selection": "^31.3.2",
70
+ "@ag-grid-enterprise/rich-select": "^31.3.2",
71
+ "@ag-grid-enterprise/row-grouping": "^31.3.2",
72
+ "@ag-grid-enterprise/server-side-row-model": "^31.3.2",
73
+ "@ag-grid-enterprise/set-filter": "^31.3.2",
74
+ "@ag-grid-enterprise/multi-filter": "^31.3.2",
75
+ "@ag-grid-enterprise/advanced-filter": "^31.3.2",
76
+ "@ag-grid-enterprise/side-bar": "^31.3.2",
77
+ "@ag-grid-enterprise/status-bar": "^31.3.2",
78
+ "@ag-grid-enterprise/viewport-row-model": "^31.3.2"
57
79
  },
58
80
  "browserslist": {
59
81
  "production": [