sccoreui 6.2.12 → 6.2.14
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.
|
@@ -172,11 +172,11 @@ const mergeArrays = (currentUpdatedRows, updatedRecords) => {
|
|
|
172
172
|
// Convert map back to array
|
|
173
173
|
return Array.from(mergedMap.values());
|
|
174
174
|
};
|
|
175
|
-
const autoGroupColumnDef = (isTreeEnable, headerName, groupField, GroupHeaderComponent, headerCheckboxRenderer, enableCheckboxForGroupHeader, displayGroupCount, ChildRendererForGroup, HeaderRendererForGroup) => {
|
|
175
|
+
const autoGroupColumnDef = (isTreeEnable, headerName, groupField, GroupHeaderComponent, headerCheckboxRenderer, enableCheckboxForGroupHeader, displayGroupCount, rowGroupColumnWidth, ChildRendererForGroup, HeaderRendererForGroup) => {
|
|
176
176
|
if (isTreeEnable) {
|
|
177
177
|
return {
|
|
178
178
|
headerName: headerName ? headerName : "Group",
|
|
179
|
-
minWidth: 300,
|
|
179
|
+
minWidth: rowGroupColumnWidth || 300,
|
|
180
180
|
// cellRenderer:(params)=> params.data?.name ,
|
|
181
181
|
cellRendererParams: {
|
|
182
182
|
suppressCount: true,
|
|
@@ -190,7 +190,7 @@ const autoGroupColumnDef = (isTreeEnable, headerName, groupField, GroupHeaderCom
|
|
|
190
190
|
? () => headerCheckboxRenderer("", GroupHeaderComponent)
|
|
191
191
|
: GroupHeaderComponent,
|
|
192
192
|
cellRenderer: "agGroupCellRenderer",
|
|
193
|
-
minWidth:
|
|
193
|
+
minWidth: rowGroupColumnWidth || 300,
|
|
194
194
|
cellRendererParams: (params) => {
|
|
195
195
|
var _a;
|
|
196
196
|
// Render custom component for all group childs
|
|
@@ -14,13 +14,13 @@ const context_provider_1 = tslib_1.__importDefault(require("./context-provider")
|
|
|
14
14
|
const group_checkbox_1 = tslib_1.__importDefault(require("./group-checkbox"));
|
|
15
15
|
const utilComponents_1 = require("./utilComponents");
|
|
16
16
|
function ParentForGrid(props) {
|
|
17
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
17
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
18
18
|
const [gridData, setGridData] = (0, react_1.useState)({
|
|
19
19
|
rowData: [],
|
|
20
20
|
columnData: (0, helper_1.sortColumns)(props === null || props === void 0 ? void 0 : props.columnData),
|
|
21
21
|
});
|
|
22
22
|
let maxLength = 0;
|
|
23
|
-
const [style] =
|
|
23
|
+
// const [style] = useState<Style>(props.style);
|
|
24
24
|
const [api, setApi] = (0, react_1.useState)(null);
|
|
25
25
|
const [totalRecords, setTotalRecords] = (0, react_1.useState)(0);
|
|
26
26
|
const [gridReadyEvent, setGridReadyEvent] = (0, react_1.useState)();
|
|
@@ -142,7 +142,7 @@ function ParentForGrid(props) {
|
|
|
142
142
|
});
|
|
143
143
|
// Gets call onLoad,scroll and whenever any featureDetails changed
|
|
144
144
|
const onGridReady = (params, updatedFeatures) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
145
|
-
var
|
|
145
|
+
var _p, _q;
|
|
146
146
|
setApi(params.api);
|
|
147
147
|
setGridReadyEvent(params);
|
|
148
148
|
let currentFeatures = updatedFeatures;
|
|
@@ -155,21 +155,21 @@ function ParentForGrid(props) {
|
|
|
155
155
|
if (result.rowData) {
|
|
156
156
|
setGridData(Object.assign(Object.assign({}, gridData), { rowData: result.rowData }));
|
|
157
157
|
gridRef.current.api.hideOverlay();
|
|
158
|
-
(
|
|
158
|
+
(_p = params === null || params === void 0 ? void 0 : params.api) === null || _p === void 0 ? void 0 : _p.applyTransaction({ add: result.rowData });
|
|
159
159
|
}
|
|
160
160
|
else {
|
|
161
|
-
(
|
|
161
|
+
(_q = params === null || params === void 0 ? void 0 : params.api) === null || _q === void 0 ? void 0 : _q.applyTransaction({ add: [] });
|
|
162
162
|
}
|
|
163
163
|
}
|
|
164
164
|
else if (props.rowModelType === constants_1.ROWMODELTYPE.SERVER_SIDE) {
|
|
165
165
|
const dataSource = {
|
|
166
166
|
getRows: (params) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
167
|
-
var
|
|
167
|
+
var _r, _s, _t;
|
|
168
168
|
const startRow = params.request.startRow;
|
|
169
169
|
const endRow = params.request.endRow;
|
|
170
170
|
// Scroll should not exit MAX_RECORDS_TO_LOAD
|
|
171
171
|
if (endRow > maxLength && maxLength > 0) {
|
|
172
|
-
(
|
|
172
|
+
(_r = gridRef === null || gridRef === void 0 ? void 0 : gridRef.current.api) === null || _r === void 0 ? void 0 : _r.hideOverlay();
|
|
173
173
|
// supply rows for requested block to grid
|
|
174
174
|
params.success({
|
|
175
175
|
rowData: gridData.rowData,
|
|
@@ -180,7 +180,7 @@ function ParentForGrid(props) {
|
|
|
180
180
|
// get data for request from our fake server
|
|
181
181
|
const response = yield getData(startRow, endRow, currentFeatures, params);
|
|
182
182
|
// simulating real server call with a 500ms delay
|
|
183
|
-
if (((
|
|
183
|
+
if (((_s = response.rowData) === null || _s === void 0 ? void 0 : _s.length) > 0) {
|
|
184
184
|
setGridData(Object.assign(Object.assign({}, gridData), { rowData: response.rowData }));
|
|
185
185
|
gridRef.current.api.hideOverlay();
|
|
186
186
|
// supply rows for requested block to grid
|
|
@@ -190,7 +190,7 @@ function ParentForGrid(props) {
|
|
|
190
190
|
else {
|
|
191
191
|
// params.fail();
|
|
192
192
|
const gridRows = startRow >= constants_1.BLOCK_SIZE ? gridData.rowData : [];
|
|
193
|
-
if (!((
|
|
193
|
+
if (!((_t = params === null || params === void 0 ? void 0 : params.parentNode) === null || _t === void 0 ? void 0 : _t.id))
|
|
194
194
|
gridRef.current.api.showNoRowsOverlay();
|
|
195
195
|
params.success({ rowData: gridRows });
|
|
196
196
|
return;
|
|
@@ -273,8 +273,8 @@ function ParentForGrid(props) {
|
|
|
273
273
|
props === null || props === void 0 ? void 0 : props.groupField, // Group field
|
|
274
274
|
GridHeaderComponent, // Header component
|
|
275
275
|
headerCheckBoxRenderer, //
|
|
276
|
-
props === null || props === void 0 ? void 0 : props.enableCheckboxForGroupHeader, props.conditionsToDisplay.displayGroupCount,
|
|
277
|
-
);
|
|
276
|
+
props === null || props === void 0 ? void 0 : props.enableCheckboxForGroupHeader, props.conditionsToDisplay.displayGroupCount, parseInt(props === null || props === void 0 ? void 0 : props.rowGroupColumnWidth), // for grouped column width
|
|
277
|
+
cellRendererConditionally, GroupHeaderRenderer);
|
|
278
278
|
}
|
|
279
279
|
else {
|
|
280
280
|
return (0, helper_1.autoGroupColumnDef)((props === null || props === void 0 ? void 0 : props.enableTree) ? true : false, // If tree enable
|
|
@@ -282,8 +282,8 @@ function ParentForGrid(props) {
|
|
|
282
282
|
props === null || props === void 0 ? void 0 : props.groupField, // Group field
|
|
283
283
|
GridHeaderComponent, // Header component
|
|
284
284
|
headerCheckBoxRenderer, //
|
|
285
|
-
props === null || props === void 0 ? void 0 : props.enableCheckboxForGroupHeader, props.conditionsToDisplay.displayGroupCount,
|
|
286
|
-
);
|
|
285
|
+
props === null || props === void 0 ? void 0 : props.enableCheckboxForGroupHeader, props.conditionsToDisplay.displayGroupCount, parseInt(props === null || props === void 0 ? void 0 : props.rowGroupColumnWidth), // for grouped column width
|
|
286
|
+
GroupHeaderRenderer);
|
|
287
287
|
}
|
|
288
288
|
};
|
|
289
289
|
(0, react_1.useEffect)(() => {
|
|
@@ -294,13 +294,9 @@ function ParentForGrid(props) {
|
|
|
294
294
|
setIntialColumns(deepCopyOfColumns);
|
|
295
295
|
}
|
|
296
296
|
}, [intialColumns]);
|
|
297
|
-
|
|
298
|
-
// width: props?.style?.width, // Full width
|
|
299
|
-
// ...(totalRecords > 6 && { height: props?.style?.height }), // Set height only if records > 6
|
|
300
|
-
// };
|
|
297
|
+
const gridStyle = Object.assign({ width: (_c = props === null || props === void 0 ? void 0 : props.style) === null || _c === void 0 ? void 0 : _c.width }, (totalRecords > 6 && { height: (_d = props === null || props === void 0 ? void 0 : props.style) === null || _d === void 0 ? void 0 : _d.height }));
|
|
301
298
|
// Options that grid should have
|
|
302
|
-
const gridOptions = {
|
|
303
|
-
columnDefs: (_c = gridData === null || gridData === void 0 ? void 0 : gridData.columnData) === null || _c === void 0 ? void 0 : _c.map((column) => {
|
|
299
|
+
const gridOptions = Object.assign({ columnDefs: (_e = gridData === null || gridData === void 0 ? void 0 : gridData.columnData) === null || _e === void 0 ? void 0 : _e.map((column) => {
|
|
304
300
|
var _a, _b;
|
|
305
301
|
if ((column === null || column === void 0 ? void 0 : column.enableChildCheckbox) && (column === null || column === void 0 ? void 0 : column.enableHeaderCheckbox)) {
|
|
306
302
|
return Object.assign(Object.assign({}, column), { headerComponent: (params) => headerCheckBoxRenderer(params === null || params === void 0 ? void 0 : params.displayName, (column === null || column === void 0 ? void 0 : column.headerComponent) && ""), cellRenderer: (params) => (0, utilComponents_1.dataCellRenderer)(params, column, props), cellRendererParams: {
|
|
@@ -311,39 +307,8 @@ function ParentForGrid(props) {
|
|
|
311
307
|
else {
|
|
312
308
|
return Object.assign(Object.assign({}, column), { headerName: (_b = column === null || column === void 0 ? void 0 : column.headerName) === null || _b === void 0 ? void 0 : _b.toUpperCase() });
|
|
313
309
|
}
|
|
314
|
-
}),
|
|
315
|
-
|
|
316
|
-
// Manage column grouping and use valueFormatter to handle display of '--'
|
|
317
|
-
autoGroupColumnDef: Object.assign(Object.assign({}, manageColumnGrouping()), { valueFormatter: (params) => {
|
|
318
|
-
// Replace '--' with an empty string or a custom placeholder
|
|
319
|
-
return (params === null || params === void 0 ? void 0 : params.value) === '--' ? '' : params === null || params === void 0 ? void 0 : params.value;
|
|
320
|
-
} }),
|
|
321
|
-
treeData: (props === null || props === void 0 ? void 0 : props.enableTree) ? props === null || props === void 0 ? void 0 : props.enableTree : false,
|
|
322
|
-
getDataPath: (props === null || props === void 0 ? void 0 : props.enableTree) ? getDataPath : null,
|
|
323
|
-
defaultColDef: defaultColDef,
|
|
324
|
-
suppressMenuHide: false,
|
|
325
|
-
rowSelection: "multiple",
|
|
326
|
-
suppressRowClickSelection: true,
|
|
327
|
-
headerHeight: props === null || props === void 0 ? void 0 : props.columnHeaderHeight,
|
|
328
|
-
rowHeight: constants_1.ROW_HEIGHT,
|
|
329
|
-
rowModelType: props.rowModelType,
|
|
330
|
-
pinnedTopRowData: props === null || props === void 0 ? void 0 : props.pinnedTopRowData,
|
|
331
|
-
cacheBlockSize: constants_1.BLOCK_SIZE,
|
|
332
|
-
maxBlocksInCache: constants_1.MAX_BLOCKS,
|
|
333
|
-
blockLoadDebounceMillis: constants_1.DEBOUNCE_INTERVAL,
|
|
334
|
-
noRowsOverlayComponent: props === null || props === void 0 ? void 0 : props.noRowsOverlayComponent,
|
|
335
|
-
loadingOverlayComponent: loading_component_1.default,
|
|
336
|
-
suppressCellFocus: true,
|
|
337
|
-
suppressPropertyNamesCheck: true,
|
|
338
|
-
suppressServerSideFullWidthLoadingRow: true,
|
|
339
|
-
enableRangeSelection: (_d = props === null || props === void 0 ? void 0 : props.conditionsToDisplay) === null || _d === void 0 ? void 0 : _d.enableFillHandle,
|
|
340
|
-
enableFillHandle: (_e = props === null || props === void 0 ? void 0 : props.conditionsToDisplay) === null || _e === void 0 ? void 0 : _e.enableFillHandle,
|
|
341
|
-
onFillEnd: wrapperToFillOpertation,
|
|
342
|
-
fillOperation: myOpertaion,
|
|
343
|
-
getRowId: getRowId,
|
|
344
|
-
fillHandleDirection: "y",
|
|
345
|
-
// ...(totalRecords > 6 && { domLayout: 'autoHeight' }) // for auto height based on table content
|
|
346
|
-
};
|
|
310
|
+
}), autoGroupColumnDef: manageColumnGrouping(), treeData: (props === null || props === void 0 ? void 0 : props.enableTree) ? props === null || props === void 0 ? void 0 : props.enableTree : false, getDataPath: (props === null || props === void 0 ? void 0 : props.enableTree) ? getDataPath : null, defaultColDef: defaultColDef, suppressMenuHide: false, rowSelection: "multiple", suppressRowClickSelection: true, headerHeight: props === null || props === void 0 ? void 0 : props.columnHeaderHeight, rowHeight: constants_1.ROW_HEIGHT, rowModelType: props.rowModelType, pinnedTopRowData: props === null || props === void 0 ? void 0 : props.pinnedTopRowData, cacheBlockSize: constants_1.BLOCK_SIZE, maxBlocksInCache: constants_1.MAX_BLOCKS, blockLoadDebounceMillis: constants_1.DEBOUNCE_INTERVAL, noRowsOverlayComponent: props === null || props === void 0 ? void 0 : props.noRowsOverlayComponent, loadingOverlayComponent: loading_component_1.default, suppressCellFocus: true, suppressPropertyNamesCheck: true, suppressServerSideFullWidthLoadingRow: true, enableRangeSelection: (_f = props === null || props === void 0 ? void 0 : props.conditionsToDisplay) === null || _f === void 0 ? void 0 : _f.enableFillHandle, enableFillHandle: (_g = props === null || props === void 0 ? void 0 : props.conditionsToDisplay) === null || _g === void 0 ? void 0 : _g.enableFillHandle, onFillEnd: wrapperToFillOpertation, fillOperation: myOpertaion, getRowId: getRowId, fillHandleDirection: "y" }, (totalRecords < 6 ? { domLayout: 'autoHeight' } : { domLayout: undefined }) // for auto height based on table content
|
|
311
|
+
);
|
|
347
312
|
// Fucntion to call the grid
|
|
348
313
|
const callGrid = (featureDetails) => {
|
|
349
314
|
onGridReady(gridReadyEvent, featureDetails);
|
|
@@ -401,7 +366,7 @@ function ParentForGrid(props) {
|
|
|
401
366
|
setFeatureDetails(Object.assign(Object.assign({}, featureDetails), { checkBoxSelection: initialCheckBoxData }));
|
|
402
367
|
}
|
|
403
368
|
}, [props === null || props === void 0 ? void 0 : props.emptyCheckboxStatus]);
|
|
404
|
-
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:
|
|
369
|
+
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: gridStyle === null || gridStyle === void 0 ? void 0 : gridStyle.height, width: gridStyle === null || gridStyle === void 0 ? void 0 : gridStyle.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: {
|
|
405
370
|
featureDetails,
|
|
406
371
|
setFeatureDetails,
|
|
407
372
|
gridData,
|
|
@@ -410,11 +375,11 @@ function ParentForGrid(props) {
|
|
|
410
375
|
initialFeature,
|
|
411
376
|
defaultFilters,
|
|
412
377
|
createView: props === null || props === void 0 ? void 0 : props.createView,
|
|
413
|
-
enableViewCreate: (
|
|
414
|
-
filterModelText: (
|
|
415
|
-
sortModelText: (
|
|
416
|
-
recordDetailModelText: (
|
|
417
|
-
sidePanelText: (
|
|
378
|
+
enableViewCreate: (_h = props === null || props === void 0 ? void 0 : props.conditionsToDisplay) === null || _h === void 0 ? void 0 : _h.enableViewCreate,
|
|
379
|
+
filterModelText: (_j = props === null || props === void 0 ? void 0 : props.dynamicText) === null || _j === void 0 ? void 0 : _j.filterModelText,
|
|
380
|
+
sortModelText: (_k = props === null || props === void 0 ? void 0 : props.dynamicText) === null || _k === void 0 ? void 0 : _k.sortModelText,
|
|
381
|
+
recordDetailModelText: (_l = props === null || props === void 0 ? void 0 : props.dynamicText) === null || _l === void 0 ? void 0 : _l.recordDetailModelText,
|
|
382
|
+
sidePanelText: (_m = props === null || props === void 0 ? void 0 : props.dynamicText) === null || _m === void 0 ? void 0 : _m.sidePanelText,
|
|
418
383
|
sortOptions: (props === null || props === void 0 ? void 0 : props.sortOptions)
|
|
419
384
|
? props.sortOptions
|
|
420
385
|
: constants_1.COLUMN_SORT_OPTIONS,
|
|
@@ -430,6 +395,6 @@ function ParentForGrid(props) {
|
|
|
430
395
|
initialCheckBoxData: initialCheckBoxData,
|
|
431
396
|
intialColumns,
|
|
432
397
|
setIntialColumns
|
|
433
|
-
} }, { children: ((
|
|
398
|
+
} }, { children: ((_o = props === null || props === void 0 ? void 0 : props.conditionsToDisplay) === null || _o === void 0 ? void 0 : _o.displayFeaturesHeader) && ((0, jsx_runtime_1.jsx)(advanced_feature_1.default, { props: props })) })), (0, jsx_runtime_1.jsx)(AgGrid_1.default, { style: gridStyle, gridOptions: gridOptions, onGridReady: onGridReady, gridRef: gridRef })] }) })) }) }));
|
|
434
399
|
}
|
|
435
400
|
exports.default = ParentForGrid;
|
|
@@ -143,6 +143,7 @@ export interface PropsFromProduct {
|
|
|
143
143
|
AdvancedFilter?: React.FC;
|
|
144
144
|
removeCallBack?: (featureDetails: Features) => void;
|
|
145
145
|
rowGroupHeaderComponent: React.FC;
|
|
146
|
+
rowGroupColumnWidth: string | number;
|
|
146
147
|
}
|
|
147
148
|
export interface ResoponseFromCallback {
|
|
148
149
|
totalRecords: number;
|
|
@@ -7,7 +7,7 @@ export declare const sortColumns: (columns: any) => any;
|
|
|
7
7
|
export declare const getCheckedStatus: (row: any, featureDetails: any, GRID_CHECKBOX_STATUS: any, setFeatureDetails: any) => any;
|
|
8
8
|
export declare const updateCells: (updatedRowData: any, setUpdateRowData: any, api: any) => void;
|
|
9
9
|
export declare const fillOperation: (params: any, api: any, editedRecords: any, setEditedRecords: any) => Promise<void>;
|
|
10
|
-
export declare const autoGroupColumnDef: (isTreeEnable: boolean, headerName: string, groupField: string, GroupHeaderComponent: React.FC, headerCheckboxRenderer: React.FC, enableCheckboxForGroupHeader: boolean, displayGroupCount: boolean, ChildRendererForGroup?: React.FC, HeaderRendererForGroup?: React.FC) => {
|
|
10
|
+
export declare const autoGroupColumnDef: (isTreeEnable: boolean, headerName: string, groupField: string, GroupHeaderComponent: React.FC, headerCheckboxRenderer: React.FC, enableCheckboxForGroupHeader: boolean, displayGroupCount: boolean, rowGroupColumnWidth: number, ChildRendererForGroup?: React.FC, HeaderRendererForGroup?: React.FC) => {
|
|
11
11
|
headerName: string;
|
|
12
12
|
minWidth: number;
|
|
13
13
|
cellRendererParams: {
|