sccoreui 6.1.7 → 6.1.8
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.
- package/dist/components/ag-grid/advancedFeature/new-filter/table-filter.js +0 -1
- package/dist/components/ag-grid/helper.js +46 -28
- package/dist/components/ag-grid/parent-for-grid.js +17 -19
- package/dist/types/components/ag-grid/Types.d.ts +6 -0
- package/dist/types/components/ag-grid/helper.d.ts +1 -1
- package/package.json +1 -1
|
@@ -136,7 +136,6 @@ const TableFilter = () => {
|
|
|
136
136
|
});
|
|
137
137
|
setAllFieldsFilled(isAllFieldsFilled && enbleApply);
|
|
138
138
|
}, [conditionsArray, enbleApply]);
|
|
139
|
-
console.log(isOverlayOpened, globalFilters.length, 'toggle property');
|
|
140
139
|
return ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("div", Object.assign({ className: `cursor-pointer filter-btn-grid font-semibold hover:bg-primary-50 sc_icon_hover flex align-items-center gap-2 border-round-lg ${isOverlayOpened ||
|
|
141
140
|
(globalFilters === null || globalFilters === void 0 ? void 0 : globalFilters.filter((each) => each.isActive).length) >= 1
|
|
142
141
|
? "bg-primary-50"
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.fillOperation = exports.sortColumns = exports.parseIfNeeded = exports.applyDefaultFilters = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
4
5
|
const applyDefaultFilters = (defaultFilters) => {
|
|
5
|
-
console.log(defaultFilters, 'deafult filters');
|
|
6
6
|
const filters = defaultFilters === null || defaultFilters === void 0 ? void 0 : defaultFilters.map((item) => {
|
|
7
7
|
const obj = {
|
|
8
8
|
logicalOperator: item === null || item === void 0 ? void 0 : item.logicalOperator,
|
|
@@ -44,43 +44,61 @@ const sortColumns = (columns) => {
|
|
|
44
44
|
return sortedColumns;
|
|
45
45
|
};
|
|
46
46
|
exports.sortColumns = sortColumns;
|
|
47
|
-
|
|
47
|
+
// Fill data in grid through drag
|
|
48
|
+
const fillOperation = (params, api, callBack, parentRowData) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
48
49
|
const { finalRange } = params;
|
|
49
50
|
const { startRow, endRow, columns, startColumn } = finalRange;
|
|
50
51
|
const columnDetails = columns[0].colDef;
|
|
51
52
|
const selectedColumn = (startColumn === null || startColumn === void 0 ? void 0 : startColumn.userProvidedColDef) || columnDetails;
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
53
|
+
const handleError = () => {
|
|
54
|
+
alert("Sorry, cannot update for now");
|
|
55
|
+
};
|
|
56
|
+
const rangeDetails = {
|
|
57
|
+
parentRowData: parentRowData,
|
|
58
|
+
selectedColumn: selectedColumn,
|
|
59
|
+
childIds: getChildRowIds(startRow.rowIndex, endRow.rowIndex, api, parentRowData.id)
|
|
60
|
+
};
|
|
61
|
+
if (!callBack) {
|
|
62
|
+
return handleError();
|
|
59
63
|
}
|
|
60
|
-
|
|
64
|
+
// Get updated rows
|
|
65
|
+
const getResponse = yield callBack(rangeDetails);
|
|
66
|
+
// Throw error if not success
|
|
67
|
+
if (!getResponse.isSuccess)
|
|
68
|
+
return handleError();
|
|
61
69
|
// Collect all selected rows
|
|
62
|
-
|
|
63
|
-
|
|
70
|
+
for (let i = startRow.rowIndex; i <= endRow.rowIndex; i++) {
|
|
71
|
+
// Get the row node
|
|
64
72
|
const rowNode = api.getDisplayedRowAtIndex(i);
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
rowData
|
|
69
|
-
if (rowData &&
|
|
70
|
-
|
|
73
|
+
if (!rowNode)
|
|
74
|
+
continue; // Skip if rowNode is undefined
|
|
75
|
+
const rowData = rowNode === null || rowNode === void 0 ? void 0 : rowNode.data;
|
|
76
|
+
// Check if rowData exists and update the field
|
|
77
|
+
if (rowData && rowNode.id !== parentRowData.id) {
|
|
78
|
+
rowData[columnDetails === null || columnDetails === void 0 ? void 0 : columnDetails.field] = parentRowData[columnDetails === null || columnDetails === void 0 ? void 0 : columnDetails.field];
|
|
79
|
+
// Apply transaction to update the row
|
|
80
|
+
api.applyTransaction({ update: [rowData] });
|
|
71
81
|
}
|
|
72
|
-
// Reflect the change in the row node directly
|
|
73
|
-
rowNode.setDataValue(columnDetails.field, rowData[columnDetails.field]);
|
|
74
82
|
}
|
|
75
83
|
// Refresh the cells to show the updated data
|
|
76
84
|
api.refreshCells({ force: true });
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
if (
|
|
83
|
-
|
|
85
|
+
});
|
|
86
|
+
exports.fillOperation = fillOperation;
|
|
87
|
+
// Give child ids for fill update
|
|
88
|
+
const getChildRowIds = (startIndex, endIndex, api, parentId) => {
|
|
89
|
+
const ids = [];
|
|
90
|
+
if (!(startIndex >= 0) || !(endIndex > 0)) {
|
|
91
|
+
return [];
|
|
84
92
|
}
|
|
93
|
+
for (let i = startIndex; i <= endIndex; i++) {
|
|
94
|
+
// Get the row node
|
|
95
|
+
const rowNode = api.getDisplayedRowAtIndex(i);
|
|
96
|
+
if (!rowNode)
|
|
97
|
+
continue; // Skip if rowNode is undefined
|
|
98
|
+
const rowData = rowNode === null || rowNode === void 0 ? void 0 : rowNode.data;
|
|
99
|
+
if (rowData.id && rowData.id !== parentId) {
|
|
100
|
+
ids.push(rowData.id);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
return ids;
|
|
85
104
|
};
|
|
86
|
-
exports.fillOperation = fillOperation;
|
|
@@ -12,7 +12,7 @@ const constants_1 = require("./constants");
|
|
|
12
12
|
const loading_component_1 = tslib_1.__importDefault(require("./loading-component"));
|
|
13
13
|
const helper_1 = require("./helper");
|
|
14
14
|
function ParentForGrid(props) {
|
|
15
|
-
var _a, _b, _c, _d, _e;
|
|
15
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
16
16
|
const [gridData, setGridData] = (0, react_1.useState)({
|
|
17
17
|
rowData: [],
|
|
18
18
|
columnData: (0, helper_1.sortColumns)(props === null || props === void 0 ? void 0 : props.columnData)
|
|
@@ -23,7 +23,7 @@ function ParentForGrid(props) {
|
|
|
23
23
|
const [totalRecords, setTotalRecords] = (0, react_1.useState)(0);
|
|
24
24
|
const [gridReadyEvent, setGridReadyEvent] = (0, react_1.useState)();
|
|
25
25
|
const [defaultSelectedRows, setDefaultSelectedRows] = (0, react_1.useState)([]);
|
|
26
|
-
const [
|
|
26
|
+
const [initalDragRowData, setInitialDragRowData] = (0, react_1.useState)();
|
|
27
27
|
const [defaultFilters, setDefaultFilters] = (0, react_1.useState)((props === null || props === void 0 ? void 0 : props.defaultFilters) || []);
|
|
28
28
|
const [emptyResponse] = (0, react_1.useState)({
|
|
29
29
|
totalRecords: 0,
|
|
@@ -178,11 +178,11 @@ function ParentForGrid(props) {
|
|
|
178
178
|
else if (props.rowModelType === constants_1.ROWMODELTYPE.INFINITE) {
|
|
179
179
|
const dataSource = {
|
|
180
180
|
getRows: (params) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
181
|
-
var
|
|
181
|
+
var _h;
|
|
182
182
|
const startRow = params.startRow;
|
|
183
183
|
const endRow = params.endRow;
|
|
184
184
|
const result = yield getData(startRow, endRow, currentFeatures);
|
|
185
|
-
if (((
|
|
185
|
+
if (((_h = result === null || result === void 0 ? void 0 : result.rowData) === null || _h === void 0 ? void 0 : _h.length) > 0) {
|
|
186
186
|
gridRef.current.api.hideOverlay();
|
|
187
187
|
params.successCallback(result === null || result === void 0 ? void 0 : result.rowData, result === null || result === void 0 ? void 0 : result.actualEndRow);
|
|
188
188
|
}
|
|
@@ -198,7 +198,7 @@ function ParentForGrid(props) {
|
|
|
198
198
|
else if (props.rowModelType === constants_1.ROWMODELTYPE.SERVER_SIDE) {
|
|
199
199
|
const dataSource = {
|
|
200
200
|
getRows: (params) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
201
|
-
var
|
|
201
|
+
var _j;
|
|
202
202
|
const startRow = params.request.startRow;
|
|
203
203
|
const endRow = params.request.endRow;
|
|
204
204
|
// Scroll should not exit MAX_RECORDS_TO_LOAD
|
|
@@ -214,7 +214,7 @@ function ParentForGrid(props) {
|
|
|
214
214
|
// get data for request from our fake server
|
|
215
215
|
const response = yield getData(startRow, endRow, currentFeatures, params === null || params === void 0 ? void 0 : params.request);
|
|
216
216
|
// simulating real server call with a 500ms delay
|
|
217
|
-
if (((
|
|
217
|
+
if (((_j = response.rowData) === null || _j === void 0 ? void 0 : _j.length) > 0) {
|
|
218
218
|
setGridData(Object.assign(Object.assign({}, gridData), { rowData: response.rowData }));
|
|
219
219
|
gridRef.current.api.hideOverlay();
|
|
220
220
|
// supply rows for requested block to grid
|
|
@@ -233,16 +233,15 @@ function ParentForGrid(props) {
|
|
|
233
233
|
params.api.setGridOption("serverSideDatasource", dataSource);
|
|
234
234
|
}
|
|
235
235
|
});
|
|
236
|
+
const getRowId = (prams) => prams.data.id;
|
|
236
237
|
// Get the direction of selected range
|
|
237
238
|
const onCellMouseDown = (event) => {
|
|
238
|
-
|
|
239
|
+
setInitialDragRowData(event.node.data);
|
|
239
240
|
};
|
|
240
241
|
// Update cell from front end and give a call back to products
|
|
241
242
|
const wrapperToFillOpertation = (params) => {
|
|
242
|
-
(0, helper_1.fillOperation)(params, api,
|
|
243
|
+
(0, helper_1.fillOperation)(params, api, props === null || props === void 0 ? void 0 : props.updateCell, initalDragRowData);
|
|
243
244
|
};
|
|
244
|
-
// Give unique id for rows to grid
|
|
245
|
-
const getRowId = (prams) => prams.data.id;
|
|
246
245
|
// Options that grid should have
|
|
247
246
|
const gridOptions = {
|
|
248
247
|
columnDefs: gridData.columnData.map((column) => {
|
|
@@ -258,7 +257,6 @@ function ParentForGrid(props) {
|
|
|
258
257
|
}
|
|
259
258
|
}),
|
|
260
259
|
defaultColDef: defaultColDef,
|
|
261
|
-
// enableRangeSelection: true, // Enabling range selection
|
|
262
260
|
suppressMenuHide: false,
|
|
263
261
|
rowSelection: "multiple",
|
|
264
262
|
suppressRowClickSelection: true,
|
|
@@ -273,11 +271,11 @@ function ParentForGrid(props) {
|
|
|
273
271
|
suppressCellFocus: true,
|
|
274
272
|
suppressPropertyNamesCheck: true,
|
|
275
273
|
suppressServerSideFullWidthLoadingRow: true,
|
|
276
|
-
enableRangeSelection:
|
|
277
|
-
enableFillHandle:
|
|
274
|
+
enableRangeSelection: (_a = props === null || props === void 0 ? void 0 : props.conditionsToDisplay) === null || _a === void 0 ? void 0 : _a.enableFillHandle,
|
|
275
|
+
enableFillHandle: (_b = props === null || props === void 0 ? void 0 : props.conditionsToDisplay) === null || _b === void 0 ? void 0 : _b.enableFillHandle,
|
|
278
276
|
onFillEnd: wrapperToFillOpertation,
|
|
279
277
|
onCellMouseDown: onCellMouseDown,
|
|
280
|
-
getRowId: getRowId
|
|
278
|
+
getRowId: getRowId // Assing ids for grid to identify uniquely in server side
|
|
281
279
|
};
|
|
282
280
|
// Fucntion to call the grid
|
|
283
281
|
const callGrid = (featureDetails) => {
|
|
@@ -355,11 +353,11 @@ function ParentForGrid(props) {
|
|
|
355
353
|
initialFeature,
|
|
356
354
|
defaultFilters,
|
|
357
355
|
createView: props === null || props === void 0 ? void 0 : props.createView,
|
|
358
|
-
enableViewCreate: (
|
|
359
|
-
filterModelText: (
|
|
360
|
-
sortModelText: (
|
|
361
|
-
recordDetailModelText: (
|
|
362
|
-
sidePanelText: (
|
|
356
|
+
enableViewCreate: (_c = props === null || props === void 0 ? void 0 : props.conditionsToDisplay) === null || _c === void 0 ? void 0 : _c.enableViewCreate,
|
|
357
|
+
filterModelText: (_d = props === null || props === void 0 ? void 0 : props.dynamicText) === null || _d === void 0 ? void 0 : _d.filterModelText,
|
|
358
|
+
sortModelText: (_e = props === null || props === void 0 ? void 0 : props.dynamicText) === null || _e === void 0 ? void 0 : _e.sortModelText,
|
|
359
|
+
recordDetailModelText: (_f = props === null || props === void 0 ? void 0 : props.dynamicText) === null || _f === void 0 ? void 0 : _f.recordDetailModelText,
|
|
360
|
+
sidePanelText: (_g = props === null || props === void 0 ? void 0 : props.dynamicText) === null || _g === void 0 ? void 0 : _g.sidePanelText,
|
|
363
361
|
sortOptions: (props === null || props === void 0 ? void 0 : props.sortOptions) ? props.sortOptions : constants_1.COLUMN_SORT_OPTIONS,
|
|
364
362
|
filterConditions: props === null || props === void 0 ? void 0 : props.filterConditions,
|
|
365
363
|
clearFilters: props === null || props === void 0 ? void 0 : props.clearFilters,
|
|
@@ -93,6 +93,7 @@ export interface ConditionsToDisplay {
|
|
|
93
93
|
displayBulkAction?: boolean;
|
|
94
94
|
enableViewCreate?: boolean;
|
|
95
95
|
displaySidePanel?: boolean;
|
|
96
|
+
enableFillHandle?: boolean;
|
|
96
97
|
}
|
|
97
98
|
export interface PropsFromProduct {
|
|
98
99
|
columnData: ColumnDef[];
|
|
@@ -179,4 +180,9 @@ export interface CallGridOnHide {
|
|
|
179
180
|
toUpdateView: boolean;
|
|
180
181
|
reorderedColumns: ColumnDef[];
|
|
181
182
|
}
|
|
183
|
+
export interface RangeDetails {
|
|
184
|
+
parentRowData: any;
|
|
185
|
+
selectedColumn: ColumnDef;
|
|
186
|
+
childIds: string | number[];
|
|
187
|
+
}
|
|
182
188
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export declare const applyDefaultFilters: (defaultFilters: any) => any;
|
|
2
2
|
export declare const parseIfNeeded: (value: any) => any;
|
|
3
3
|
export declare const sortColumns: (columns: any) => any;
|
|
4
|
-
export declare const fillOperation: (params: any, api: any,
|
|
4
|
+
export declare const fillOperation: (params: any, api: any, callBack: any, parentRowData: any) => Promise<void>;
|