sccoreui 6.2.17 → 6.2.19
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/App.scss +4 -0
- package/dist/components/ag-grid/AgGrid.js +1 -1
- package/dist/components/ag-grid/advancedFeature/column-group.js +100 -45
- package/dist/components/ag-grid/advancedFeature/hide-column.js +2 -2
- package/dist/components/ag-grid/context-provider.js +6 -3
- package/dist/components/ag-grid/helper.js +147 -70
- package/dist/components/ag-grid/parent-for-grid.js +54 -57
- package/dist/components/ag-grid/utilComponents.js +7 -1
- package/dist/components/formula-template/FormulaCoponent.js +2 -2
- package/dist/components/multi-select-dropdown/multi-select-dropdown.js +4 -2
- package/dist/types/components/ag-grid/Types.d.ts +3 -0
- package/dist/types/components/ag-grid/context-provider.d.ts +2 -0
- package/dist/types/components/ag-grid/helper.d.ts +4 -3
- package/dist/types/components/ag-grid/utilComponents.d.ts +1 -0
- package/package.json +1 -1
- package/dist/pages/aggrid/AgGrid.js +0 -606
- package/dist/pages/aggrid/BulkAction.js +0 -7
- package/dist/pages/aggrid/RowGroupTrail.js +0 -114
- package/dist/pages/aggrid/fakeServer.js +0 -95
- package/dist/pages/aggrid/id-cell.js +0 -9
- package/dist/pages/aggrid/interface.js +0 -2
- package/dist/pages/avatar/avatar.js +0 -338
- package/dist/pages/badges/badge.js +0 -73
- package/dist/pages/breadcrumb/breadcrumb.js +0 -14
- package/dist/pages/button/button.js +0 -10
- package/dist/pages/button-group/button-group.js +0 -10
- package/dist/pages/chart/chart.js +0 -257
- package/dist/pages/checkbox/checkbox.js +0 -26
- package/dist/pages/checkbox-group/checkbox-group-component.js +0 -21
- package/dist/pages/color-picker/color-picker.js +0 -13
- package/dist/pages/content-dividers/content-dividers.js +0 -11
- package/dist/pages/custom-color-picker/custom-color-picker.js +0 -12
- package/dist/pages/custom-multiselect/CustomMultiSelect.js +0 -37
- package/dist/pages/date-picker/date-picker.js +0 -20
- package/dist/pages/dropdown/dropdown-component.js +0 -39
- package/dist/pages/file-upload/file-upload.js +0 -34
- package/dist/pages/flex.js +0 -15
- package/dist/pages/formulaTemplate/formulaTemplate.js +0 -154
- package/dist/pages/frolaTextEditor/froala-text-editor.js +0 -12
- package/dist/pages/home.js +0 -49
- package/dist/pages/input/input-text.js +0 -112
- package/dist/pages/list-box-dropdown/listboxdropdown.js +0 -55
- package/dist/pages/loader-indicator/loader-indicator.js +0 -10
- package/dist/pages/mega-mennu/mega-menu.js +0 -84
- package/dist/pages/multi-select-dropdown/multi-select-dropdown.js +0 -51
- package/dist/pages/not-found/not-found.js +0 -10
- package/dist/pages/paginator/pagination.js +0 -122
- package/dist/pages/progress-bar/progress-bar.js +0 -27
- package/dist/pages/progress-steps/progress-steps.js +0 -24
- package/dist/pages/radio-button/radio-button-component.js +0 -11
- package/dist/pages/shadows/shadows.js +0 -7
- package/dist/pages/slideout-menus/slideout-menus.js +0 -104
- package/dist/pages/sliders/slider.js +0 -39
- package/dist/pages/tabels/table-data.js +0 -2193
- package/dist/pages/tabels/table.js +0 -98
- package/dist/pages/tabs/tabs.js +0 -9
- package/dist/pages/tags/tags.js +0 -70
- package/dist/pages/toast/toast.js +0 -47
- package/dist/pages/toggle/toggle.js +0 -10
- package/dist/pages/tooltip/tooltip.js +0 -13
- package/dist/pages/treeDropdownSelect/treedropdowselect.js +0 -34
- package/dist/pages/types/type.js +0 -2
- package/dist/types/pages/aggrid/AgGrid.d.ts +0 -2
- package/dist/types/pages/aggrid/BulkAction.d.ts +0 -2
- package/dist/types/pages/aggrid/RowGroupTrail.d.ts +0 -4
- package/dist/types/pages/aggrid/fakeServer.d.ts +0 -7
- package/dist/types/pages/aggrid/id-cell.d.ts +0 -2
- package/dist/types/pages/aggrid/interface.d.ts +0 -12
- package/dist/types/pages/avatar/avatar.d.ts +0 -2
- package/dist/types/pages/badges/badge.d.ts +0 -3
- package/dist/types/pages/breadcrumb/breadcrumb.d.ts +0 -2
- package/dist/types/pages/button/button.d.ts +0 -2
- package/dist/types/pages/button-group/button-group.d.ts +0 -2
- package/dist/types/pages/chart/chart.d.ts +0 -2
- package/dist/types/pages/checkbox/checkbox.d.ts +0 -2
- package/dist/types/pages/checkbox-group/checkbox-group-component.d.ts +0 -3
- package/dist/types/pages/color-picker/color-picker.d.ts +0 -2
- package/dist/types/pages/content-dividers/content-dividers.d.ts +0 -2
- package/dist/types/pages/custom-color-picker/custom-color-picker.d.ts +0 -2
- package/dist/types/pages/custom-multiselect/CustomMultiSelect.d.ts +0 -2
- package/dist/types/pages/date-picker/date-picker.d.ts +0 -2
- package/dist/types/pages/dropdown/dropdown-component.d.ts +0 -2
- package/dist/types/pages/file-upload/file-upload.d.ts +0 -3
- package/dist/types/pages/flex.d.ts +0 -2
- package/dist/types/pages/formulaTemplate/formulaTemplate.d.ts +0 -2
- package/dist/types/pages/frolaTextEditor/froala-text-editor.d.ts +0 -2
- package/dist/types/pages/home.d.ts +0 -2
- package/dist/types/pages/input/input-text.d.ts +0 -3
- package/dist/types/pages/list-box-dropdown/listboxdropdown.d.ts +0 -2
- package/dist/types/pages/loader-indicator/loader-indicator.d.ts +0 -3
- package/dist/types/pages/mega-mennu/mega-menu.d.ts +0 -2
- package/dist/types/pages/multi-select-dropdown/multi-select-dropdown.d.ts +0 -2
- package/dist/types/pages/not-found/not-found.d.ts +0 -2
- package/dist/types/pages/paginator/pagination.d.ts +0 -2
- package/dist/types/pages/progress-bar/progress-bar.d.ts +0 -3
- package/dist/types/pages/progress-steps/progress-steps.d.ts +0 -2
- package/dist/types/pages/radio-button/radio-button-component.d.ts +0 -2
- package/dist/types/pages/shadows/shadows.d.ts +0 -2
- package/dist/types/pages/slideout-menus/slideout-menus.d.ts +0 -2
- package/dist/types/pages/sliders/slider.d.ts +0 -1
- package/dist/types/pages/tabels/table-data.d.ts +0 -3
- package/dist/types/pages/tabels/table.d.ts +0 -2
- package/dist/types/pages/tabs/tabs.d.ts +0 -3
- package/dist/types/pages/tags/tags.d.ts +0 -3
- package/dist/types/pages/toast/toast.d.ts +0 -2
- package/dist/types/pages/toggle/toggle.d.ts +0 -2
- package/dist/types/pages/tooltip/tooltip.d.ts +0 -2
- package/dist/types/pages/treeDropdownSelect/treedropdowselect.d.ts +0 -2
- package/dist/types/pages/types/type.d.ts +0 -64
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.handleCheckboxClick = exports.getGroupIds = exports.handleUncheckedState = exports.handleCheckedState = exports.updateGroupState = exports.determineConditions = exports.updateRecords = exports.autoGroupColumnDef = exports.fillOperation = exports.updateCells = exports.getCheckedStatus = exports.sortColumns = exports.parseIfNeeded = exports.applyDefaultFilters = exports.initialCheckBoxData = void 0;
|
|
3
|
+
exports.deepClone = exports.handleCheckboxClick = exports.getGroupIds = exports.handleUncheckedState = exports.handleCheckedState = exports.updateGroupState = exports.determineConditions = exports.updateRecords = exports.autoGroupColumnDef = exports.fillOperation = exports.updateCells = exports.getCheckedStatus = exports.sortColumns = exports.parseIfNeeded = exports.applyDefaultFilters = exports.initialCheckBoxData = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
+
const react_1 = tslib_1.__importDefault(require("react"));
|
|
5
6
|
const constants_1 = require("./constants");
|
|
6
7
|
// initial checkbox data
|
|
7
8
|
exports.initialCheckBoxData = {
|
|
@@ -171,11 +172,11 @@ const mergeArrays = (currentUpdatedRows, updatedRecords) => {
|
|
|
171
172
|
// Convert map back to array
|
|
172
173
|
return Array.from(mergedMap.values());
|
|
173
174
|
};
|
|
174
|
-
const autoGroupColumnDef = (isTreeEnable, headerName, groupField, GroupHeaderComponent, headerCheckboxRenderer, enableCheckboxForGroupHeader, displayGroupCount, ChildRendererForGroup, HeaderRendererForGroup) => {
|
|
175
|
+
const autoGroupColumnDef = (isTreeEnable, headerName, groupField, GroupHeaderComponent, headerCheckboxRenderer, enableCheckboxForGroupHeader, displayGroupCount, rowGroupColumnWidth, ChildRendererForGroup, HeaderRendererForGroup) => {
|
|
175
176
|
if (isTreeEnable) {
|
|
176
177
|
return {
|
|
177
178
|
headerName: headerName ? headerName : "Group",
|
|
178
|
-
minWidth: 300,
|
|
179
|
+
minWidth: rowGroupColumnWidth || 300,
|
|
179
180
|
// cellRenderer:(params)=> params.data?.name ,
|
|
180
181
|
cellRendererParams: {
|
|
181
182
|
suppressCount: true,
|
|
@@ -189,6 +190,7 @@ const autoGroupColumnDef = (isTreeEnable, headerName, groupField, GroupHeaderCom
|
|
|
189
190
|
? () => headerCheckboxRenderer("", GroupHeaderComponent)
|
|
190
191
|
: GroupHeaderComponent,
|
|
191
192
|
cellRenderer: "agGroupCellRenderer",
|
|
193
|
+
minWidth: rowGroupColumnWidth || 300,
|
|
192
194
|
cellRendererParams: (params) => {
|
|
193
195
|
var _a;
|
|
194
196
|
// Render custom component for all group childs
|
|
@@ -219,7 +221,7 @@ exports.autoGroupColumnDef = autoGroupColumnDef;
|
|
|
219
221
|
// This function determines how to update `includedRecords` and `excludedRecords`
|
|
220
222
|
// depending on whether all checkboxes are checked or not (`allBoxChecked` state)
|
|
221
223
|
const updateRecords = (rowData, featureDetails, gridData) => {
|
|
222
|
-
var _a, _b, _c
|
|
224
|
+
var _a, _b, _c;
|
|
223
225
|
const { excludedRecords, includedRecords, allBoxChecked } = featureDetails.checkBoxSelection;
|
|
224
226
|
let newExcludedRecords = [...excludedRecords];
|
|
225
227
|
let newIncludedRecords = [...includedRecords];
|
|
@@ -227,24 +229,15 @@ const updateRecords = (rowData, featureDetails, gridData) => {
|
|
|
227
229
|
if (allBoxChecked) {
|
|
228
230
|
// Update excluded records: add or remove the current rowData
|
|
229
231
|
newExcludedRecords = (excludedRecords === null || excludedRecords === void 0 ? void 0 : excludedRecords.includes(rowData))
|
|
230
|
-
? excludedRecords === null || excludedRecords === void 0 ? void 0 : excludedRecords.filter((item) => item !== rowData)
|
|
232
|
+
? excludedRecords === null || excludedRecords === void 0 ? void 0 : excludedRecords.filter((item) => (item === null || item === void 0 ? void 0 : item.id) !== (rowData === null || rowData === void 0 ? void 0 : rowData.id))
|
|
231
233
|
: [...excludedRecords, rowData];
|
|
232
|
-
// Check if all records are included; reset if so
|
|
233
|
-
if ((newIncludedRecords === null || newIncludedRecords === void 0 ? void 0 : newIncludedRecords.length) === ((_a = gridData === null || gridData === void 0 ? void 0 : gridData.rowData) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
234
|
-
return {
|
|
235
|
-
excludedRecords: [],
|
|
236
|
-
includedRecords: [],
|
|
237
|
-
isIndeterminate: false,
|
|
238
|
-
allBoxChecked: true,
|
|
239
|
-
};
|
|
240
|
-
}
|
|
241
234
|
// Check if all records are excluded; reset if so
|
|
242
|
-
|
|
235
|
+
if ((newExcludedRecords === null || newExcludedRecords === void 0 ? void 0 : newExcludedRecords.length) === ((_a = gridData === null || gridData === void 0 ? void 0 : gridData.rowData) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
243
236
|
return exports.initialCheckBoxData;
|
|
244
237
|
}
|
|
245
238
|
// Otherwise, update the excluded records and indeterminate state
|
|
246
239
|
else {
|
|
247
|
-
return Object.assign(Object.assign({}, featureDetails === null || featureDetails === void 0 ? void 0 : featureDetails.checkBoxSelection), { excludedRecords: newExcludedRecords, isIndeterminate:
|
|
240
|
+
return Object.assign(Object.assign({}, featureDetails === null || featureDetails === void 0 ? void 0 : featureDetails.checkBoxSelection), { excludedRecords: newExcludedRecords, isIndeterminate: (newExcludedRecords === null || newExcludedRecords === void 0 ? void 0 : newExcludedRecords.length) > 0 });
|
|
248
241
|
}
|
|
249
242
|
}
|
|
250
243
|
// When not all checkboxes are checked
|
|
@@ -254,7 +247,7 @@ const updateRecords = (rowData, featureDetails, gridData) => {
|
|
|
254
247
|
? includedRecords === null || includedRecords === void 0 ? void 0 : includedRecords.filter((item) => (item === null || item === void 0 ? void 0 : item.id) !== (rowData === null || rowData === void 0 ? void 0 : rowData.id))
|
|
255
248
|
: [...includedRecords, rowData];
|
|
256
249
|
// Check if all records are included; reset if so
|
|
257
|
-
if ((newIncludedRecords === null || newIncludedRecords === void 0 ? void 0 : newIncludedRecords.length) === ((
|
|
250
|
+
if ((newIncludedRecords === null || newIncludedRecords === void 0 ? void 0 : newIncludedRecords.length) === ((_b = gridData === null || gridData === void 0 ? void 0 : gridData.rowData) === null || _b === void 0 ? void 0 : _b.length)) {
|
|
258
251
|
return {
|
|
259
252
|
excludedRecords: [],
|
|
260
253
|
includedRecords: [],
|
|
@@ -263,7 +256,7 @@ const updateRecords = (rowData, featureDetails, gridData) => {
|
|
|
263
256
|
};
|
|
264
257
|
}
|
|
265
258
|
// Check if all records are excluded; reset if so
|
|
266
|
-
else if ((newExcludedRecords === null || newExcludedRecords === void 0 ? void 0 : newExcludedRecords.length) === ((
|
|
259
|
+
else if ((newExcludedRecords === null || newExcludedRecords === void 0 ? void 0 : newExcludedRecords.length) === ((_c = gridData === null || gridData === void 0 ? void 0 : gridData.rowData) === null || _c === void 0 ? void 0 : _c.length)) {
|
|
267
260
|
return exports.initialCheckBoxData;
|
|
268
261
|
}
|
|
269
262
|
// Otherwise, update the included records
|
|
@@ -275,15 +268,15 @@ const updateRecords = (rowData, featureDetails, gridData) => {
|
|
|
275
268
|
exports.updateRecords = updateRecords;
|
|
276
269
|
// Utility function to determine conditions for updating group states
|
|
277
270
|
// Based on various flags and states, determines whether to add or remove group IDs
|
|
278
|
-
const determineConditions = (isChecked, allBoxChecked, isEveryParentGroupInclude,
|
|
271
|
+
const determineConditions = (isChecked, allBoxChecked, isEveryParentGroupInclude, isEverySuperParentGroupInclude, isSomeParentGroupExcluded, isSomeSuperParentGroupExcluded) => ({
|
|
279
272
|
addParent: (!allBoxChecked && isChecked && isEveryParentGroupInclude) ||
|
|
280
|
-
(allBoxChecked && isChecked && !
|
|
281
|
-
addSuperParent: (!allBoxChecked && isChecked &&
|
|
282
|
-
(allBoxChecked && isChecked && !
|
|
273
|
+
(allBoxChecked && isChecked && !isSomeParentGroupExcluded),
|
|
274
|
+
addSuperParent: (!allBoxChecked && isChecked && isEverySuperParentGroupInclude) ||
|
|
275
|
+
(allBoxChecked && isChecked && !isSomeSuperParentGroupExcluded),
|
|
283
276
|
removeParent: (!allBoxChecked && !isChecked && !isEveryParentGroupInclude) ||
|
|
284
|
-
(allBoxChecked && !isChecked &&
|
|
285
|
-
removeSuperParent: (!allBoxChecked && !isChecked && !
|
|
286
|
-
(allBoxChecked && !isChecked &&
|
|
277
|
+
(allBoxChecked && !isChecked && isSomeParentGroupExcluded),
|
|
278
|
+
removeSuperParent: (!allBoxChecked && !isChecked && !isEverySuperParentGroupInclude) ||
|
|
279
|
+
(allBoxChecked && !isChecked && isSomeSuperParentGroupExcluded),
|
|
287
280
|
});
|
|
288
281
|
exports.determineConditions = determineConditions;
|
|
289
282
|
// Function to update the selected groups in the state
|
|
@@ -311,8 +304,9 @@ const updateGroupState = (groupingColumns, parentId, superParentId, conditions,
|
|
|
311
304
|
if (groupingColumns === 2) {
|
|
312
305
|
if (addSuperParent)
|
|
313
306
|
updateSelectedGroup(superParentId, true, setSelectedGroup); // Add super parent group ID
|
|
314
|
-
if (addParent)
|
|
315
|
-
updateSelectedGroup(parentId, true, setSelectedGroup);
|
|
307
|
+
if (addParent) {
|
|
308
|
+
updateSelectedGroup(parentId, true, setSelectedGroup);
|
|
309
|
+
} // Add parent group ID
|
|
316
310
|
if (removeSuperParent)
|
|
317
311
|
updateSelectedGroup(superParentId, false, setSelectedGroup); // Remove super parent group ID
|
|
318
312
|
if (removeParent)
|
|
@@ -320,10 +314,12 @@ const updateGroupState = (groupingColumns, parentId, superParentId, conditions,
|
|
|
320
314
|
}
|
|
321
315
|
// Handle logic when there is 1 grouping column
|
|
322
316
|
else if (groupingColumns === 1) {
|
|
323
|
-
if (addParent)
|
|
324
|
-
updateSelectedGroup(parentId, true, setSelectedGroup); //
|
|
325
|
-
|
|
317
|
+
if (addParent) {
|
|
318
|
+
updateSelectedGroup(parentId, true, setSelectedGroup); // Add parent ID
|
|
319
|
+
}
|
|
320
|
+
if (removeParent) {
|
|
326
321
|
updateSelectedGroup(parentId, false, setSelectedGroup); // Remove parent group ID
|
|
322
|
+
}
|
|
327
323
|
}
|
|
328
324
|
};
|
|
329
325
|
exports.updateGroupState = updateGroupState;
|
|
@@ -341,13 +337,14 @@ const handleCheckedState = (params, featureDetails, gridData, setFeatureDetails,
|
|
|
341
337
|
const { groupData, parentGroupData } = gatherGroupData(params);
|
|
342
338
|
let newExcludedRecords = [...excludedRecords];
|
|
343
339
|
let newIncludedRecords = [...includedRecords];
|
|
340
|
+
// newExcludedRecords.filter((item) => item?.id !== group.id)
|
|
344
341
|
// Update records based on the checkbox state
|
|
345
342
|
groupData.forEach((group) => {
|
|
346
343
|
var _a, _b;
|
|
347
344
|
if (allBoxChecked) {
|
|
348
345
|
newExcludedRecords = (newExcludedRecords === null || newExcludedRecords === void 0 ? void 0 : newExcludedRecords.includes(group))
|
|
349
|
-
? newExcludedRecords.filter((item) => item !== group)
|
|
350
|
-
:
|
|
346
|
+
? newExcludedRecords.filter((item) => (item === null || item === void 0 ? void 0 : item.id) !== group.id)
|
|
347
|
+
: newExcludedRecords;
|
|
351
348
|
}
|
|
352
349
|
else if (!((_a = params === null || params === void 0 ? void 0 : params.node) === null || _a === void 0 ? void 0 : _a.leafGroup) && ((_b = params === null || params === void 0 ? void 0 : params.node) === null || _b === void 0 ? void 0 : _b.level) === 0) {
|
|
353
350
|
newIncludedRecords = newIncludedRecords.includes(group)
|
|
@@ -356,17 +353,13 @@ const handleCheckedState = (params, featureDetails, gridData, setFeatureDetails,
|
|
|
356
353
|
}
|
|
357
354
|
else {
|
|
358
355
|
newIncludedRecords = newIncludedRecords.includes(group)
|
|
359
|
-
? newIncludedRecords
|
|
360
|
-
if (item.id !== group.id)
|
|
361
|
-
group.isSelected = false;
|
|
362
|
-
return item.id !== group.id;
|
|
363
|
-
})
|
|
356
|
+
? newIncludedRecords
|
|
364
357
|
: [...newIncludedRecords, group];
|
|
365
358
|
}
|
|
366
359
|
});
|
|
367
360
|
updateCheckboxData(newIncludedRecords, newExcludedRecords, gridData, featureDetails, setFeatureDetails);
|
|
368
|
-
const isParent = determineParentGroupState(parentGroupData, newIncludedRecords, newExcludedRecords, allBoxChecked);
|
|
369
|
-
handleGroupSelection(params, setSelectedGroup, groupingColumns,
|
|
361
|
+
// const isParent = determineParentGroupState(parentGroupData, newIncludedRecords, newExcludedRecords, allBoxChecked, groupData);
|
|
362
|
+
handleGroupSelection(params, setSelectedGroup, groupingColumns, newIncludedRecords, newExcludedRecords, parentGroupData, allBoxChecked);
|
|
370
363
|
};
|
|
371
364
|
exports.handleCheckedState = handleCheckedState;
|
|
372
365
|
// Utility function to handle unchecked state updates
|
|
@@ -401,14 +394,16 @@ exports.handleUncheckedState = handleUncheckedState;
|
|
|
401
394
|
// Utility function to update checkbox data in the state
|
|
402
395
|
const updateCheckboxData = (newIncludedRecords, newExcludedRecords, gridData, featureDetails, setFeatureDetails) => {
|
|
403
396
|
var _a, _b;
|
|
404
|
-
if ((newIncludedRecords === null || newIncludedRecords === void 0 ? void 0 : newIncludedRecords.length) === ((_a = gridData === null || gridData === void 0 ? void 0 : gridData.rowData) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
397
|
+
if ((newIncludedRecords === null || newIncludedRecords === void 0 ? void 0 : newIncludedRecords.length) === ((_a = gridData === null || gridData === void 0 ? void 0 : gridData.rowData) === null || _a === void 0 ? void 0 : _a.length) || ((newIncludedRecords === null || newIncludedRecords === void 0 ? void 0 : newIncludedRecords.length) === 0 && (newExcludedRecords === null || newExcludedRecords === void 0 ? void 0 : newExcludedRecords.length) === 0)) {
|
|
405
398
|
setFeatureDetails(Object.assign(Object.assign({}, featureDetails), { checkBoxSelection: Object.assign(Object.assign({}, featureDetails.checkBoxSelection), { excludedRecords: [], includedRecords: [], isIndeterminate: false, allBoxChecked: true }) }));
|
|
406
399
|
}
|
|
407
400
|
else if ((newExcludedRecords === null || newExcludedRecords === void 0 ? void 0 : newExcludedRecords.length) === ((_b = gridData === null || gridData === void 0 ? void 0 : gridData.rowData) === null || _b === void 0 ? void 0 : _b.length)) {
|
|
408
401
|
setFeatureDetails(Object.assign(Object.assign({}, featureDetails), { checkBoxSelection: exports.initialCheckBoxData }));
|
|
409
402
|
}
|
|
410
403
|
else {
|
|
411
|
-
setFeatureDetails(Object.assign(Object.assign({}, featureDetails), { checkBoxSelection: Object.assign(Object.assign({}, featureDetails.checkBoxSelection), { excludedRecords: newExcludedRecords, includedRecords: newIncludedRecords, isIndeterminate: featureDetails.checkBoxSelection.allBoxChecked
|
|
404
|
+
setFeatureDetails(Object.assign(Object.assign({}, featureDetails), { checkBoxSelection: Object.assign(Object.assign({}, featureDetails.checkBoxSelection), { excludedRecords: newExcludedRecords, includedRecords: newIncludedRecords, isIndeterminate: featureDetails.checkBoxSelection.allBoxChecked
|
|
405
|
+
? true
|
|
406
|
+
: featureDetails.checkBoxSelection.isIndeterminate }) }));
|
|
412
407
|
}
|
|
413
408
|
};
|
|
414
409
|
// Utility function to determine parent group inclusion or exclusion states
|
|
@@ -418,45 +413,57 @@ const determineParentGroupState = (parentGroupData, newIncludedRecords, newExclu
|
|
|
418
413
|
return allBoxChecked ? isAnyParentGroupExcluded : isAnyParentGroupInclude;
|
|
419
414
|
};
|
|
420
415
|
// Utility function to handle group selection logic for checked state
|
|
421
|
-
const handleGroupSelection = (params, setSelectedGroup, groupingColumns,
|
|
416
|
+
const handleGroupSelection = (params, setSelectedGroup, groupingColumns, newIncludedRecords, newExcludedRecords, parentGroupData, allBoxChecked) => {
|
|
422
417
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
423
|
-
|
|
418
|
+
const isEverySuperParentGroupInclude = parentGroupData === null || parentGroupData === void 0 ? void 0 : parentGroupData.every((parent) => newIncludedRecords.some((included) => (included === null || included === void 0 ? void 0 : included.id) === (parent === null || parent === void 0 ? void 0 : parent.id)));
|
|
419
|
+
// const isAnyParentGroupInclude = groupData?.some((parent) =>
|
|
420
|
+
// newIncludedRecords.some((included) => included?.id === parent?.id)
|
|
421
|
+
// );
|
|
422
|
+
const isEverySuperParentGroupExcluded = parentGroupData === null || parentGroupData === void 0 ? void 0 : parentGroupData.every((parent) => newExcludedRecords.some((excluded) => (excluded === null || excluded === void 0 ? void 0 : excluded.id) === (parent === null || parent === void 0 ? void 0 : parent.id)));
|
|
423
|
+
if (groupingColumns === 2 &&
|
|
424
|
+
!((_a = params === null || params === void 0 ? void 0 : params.node) === null || _a === void 0 ? void 0 : _a.leafGroup) &&
|
|
425
|
+
((_b = params === null || params === void 0 ? void 0 : params.node) === null || _b === void 0 ? void 0 : _b.level) === 0) {
|
|
424
426
|
(_d = (_c = params === null || params === void 0 ? void 0 : params.node) === null || _c === void 0 ? void 0 : _c.childrenAfterGroup) === null || _d === void 0 ? void 0 : _d.forEach((childNode) => {
|
|
425
427
|
setSelectedGroup((prev) => prev.includes(childNode.id) ? prev : [...prev, childNode.id]);
|
|
426
428
|
});
|
|
427
429
|
setSelectedGroup((prev) => prev.includes(params.node.id) ? prev : [...prev, params.node.id]);
|
|
428
430
|
}
|
|
429
|
-
else if (((_e = params === null || params === void 0 ? void 0 : params.node) === null || _e === void 0 ? void 0 : _e.leafGroup) &&
|
|
431
|
+
else if (((_e = params === null || params === void 0 ? void 0 : params.node) === null || _e === void 0 ? void 0 : _e.leafGroup) &&
|
|
432
|
+
((_f = params === null || params === void 0 ? void 0 : params.node) === null || _f === void 0 ? void 0 : _f.level) === 1 &&
|
|
433
|
+
!allBoxChecked) {
|
|
430
434
|
setSelectedGroup((prev) => prev.includes(params.node.id) ? prev : [...prev, params.node.id]);
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
?
|
|
435
|
-
|
|
436
|
-
|
|
435
|
+
if (isEverySuperParentGroupInclude) {
|
|
436
|
+
setSelectedGroup((prev) => {
|
|
437
|
+
var _a, _b, _c, _d;
|
|
438
|
+
return prev.includes((_b = (_a = params === null || params === void 0 ? void 0 : params.node) === null || _a === void 0 ? void 0 : _a.parent) === null || _b === void 0 ? void 0 : _b.id)
|
|
439
|
+
? prev
|
|
440
|
+
: [...prev, (_d = (_c = params === null || params === void 0 ? void 0 : params.node) === null || _c === void 0 ? void 0 : _c.parent) === null || _d === void 0 ? void 0 : _d.id];
|
|
441
|
+
});
|
|
442
|
+
}
|
|
437
443
|
}
|
|
438
|
-
else if (((_g = params === null || params === void 0 ? void 0 : params.node) === null || _g === void 0 ? void 0 : _g.leafGroup) &&
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
});
|
|
444
|
+
else if (((_g = params === null || params === void 0 ? void 0 : params.node) === null || _g === void 0 ? void 0 : _g.leafGroup) &&
|
|
445
|
+
((_h = params === null || params === void 0 ? void 0 : params.node) === null || _h === void 0 ? void 0 : _h.level) === 1 &&
|
|
446
|
+
allBoxChecked) {
|
|
447
|
+
setSelectedGroup((prev) => prev.includes(params.node.id) ? prev : [...prev, params.node.id]);
|
|
448
|
+
if (isEverySuperParentGroupExcluded || (newExcludedRecords === null || newExcludedRecords === void 0 ? void 0 : newExcludedRecords.length) === 0) {
|
|
449
|
+
setSelectedGroup((prev) => {
|
|
450
|
+
var _a, _b, _c, _d;
|
|
451
|
+
return prev.includes((_b = (_a = params === null || params === void 0 ? void 0 : params.node) === null || _a === void 0 ? void 0 : _a.parent) === null || _b === void 0 ? void 0 : _b.id)
|
|
452
|
+
? prev
|
|
453
|
+
: [...prev, (_d = (_c = params === null || params === void 0 ? void 0 : params.node) === null || _c === void 0 ? void 0 : _c.parent) === null || _d === void 0 ? void 0 : _d.id];
|
|
454
|
+
});
|
|
455
|
+
}
|
|
451
456
|
}
|
|
452
457
|
else {
|
|
453
|
-
setSelectedGroup((prev) => { var _a; return prev.includes(params.node.id) ? prev : [...prev, (
|
|
458
|
+
setSelectedGroup((prev) => { var _a, _b; return prev.includes((_a = params === null || params === void 0 ? void 0 : params.node) === null || _a === void 0 ? void 0 : _a.id) ? prev : [...prev, (_b = params === null || params === void 0 ? void 0 : params.node) === null || _b === void 0 ? void 0 : _b.id]; });
|
|
454
459
|
}
|
|
455
460
|
};
|
|
456
461
|
// Utility function to handle group deselection logic for unchecked state
|
|
457
462
|
const handleGroupDeselection = (params, setSelectedGroup, groupingColumns, isParent, isEveryParentGroupInclude) => {
|
|
458
463
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
459
|
-
if (groupingColumns === 2 &&
|
|
464
|
+
if (groupingColumns === 2 &&
|
|
465
|
+
!((_a = params === null || params === void 0 ? void 0 : params.node) === null || _a === void 0 ? void 0 : _a.leafGroup) &&
|
|
466
|
+
((_b = params === null || params === void 0 ? void 0 : params.node) === null || _b === void 0 ? void 0 : _b.level) === 0) {
|
|
460
467
|
(_d = (_c = params === null || params === void 0 ? void 0 : params.node) === null || _c === void 0 ? void 0 : _c.childrenAfterGroup) === null || _d === void 0 ? void 0 : _d.forEach((childNode) => {
|
|
461
468
|
setSelectedGroup((prev) => prev === null || prev === void 0 ? void 0 : prev.filter((id) => id !== (childNode === null || childNode === void 0 ? void 0 : childNode.id)));
|
|
462
469
|
});
|
|
@@ -480,7 +487,9 @@ const handleGroupDeselection = (params, setSelectedGroup, groupingColumns, isPar
|
|
|
480
487
|
return prev;
|
|
481
488
|
});
|
|
482
489
|
}
|
|
483
|
-
else if (((_g = params === null || params === void 0 ? void 0 : params.node) === null || _g === void 0 ? void 0 : _g.leafGroup) &&
|
|
490
|
+
else if (((_g = params === null || params === void 0 ? void 0 : params.node) === null || _g === void 0 ? void 0 : _g.leafGroup) &&
|
|
491
|
+
((_h = params === null || params === void 0 ? void 0 : params.node) === null || _h === void 0 ? void 0 : _h.level) === 1 &&
|
|
492
|
+
!isParent) {
|
|
484
493
|
setSelectedGroup((prev) => {
|
|
485
494
|
if (prev === null || prev === void 0 ? void 0 : prev.includes(params.node.id)) {
|
|
486
495
|
return prev === null || prev === void 0 ? void 0 : prev.filter((id) => { var _a; return id !== ((_a = params === null || params === void 0 ? void 0 : params.node) === null || _a === void 0 ? void 0 : _a.id); });
|
|
@@ -540,12 +549,80 @@ const handleCheckboxClick = (e, params, featureDetails, gridData, setFeatureDeta
|
|
|
540
549
|
const parentGroupData = (_c = (_b = (_a = params === null || params === void 0 ? void 0 : params.node) === null || _a === void 0 ? void 0 : _a.parent) === null || _b === void 0 ? void 0 : _b.childrenAfterGroup) === null || _c === void 0 ? void 0 : _c.map((childNode) => childNode === null || childNode === void 0 ? void 0 : childNode.data);
|
|
541
550
|
const superParentData = (_g = (_f = (_e = (_d = params === null || params === void 0 ? void 0 : params.node) === null || _d === void 0 ? void 0 : _d.parent) === null || _e === void 0 ? void 0 : _e.parent) === null || _f === void 0 ? void 0 : _f.allLeafChildren) === null || _g === void 0 ? void 0 : _g.map((children) => children === null || children === void 0 ? void 0 : children.data);
|
|
542
551
|
// Determine if all or any parent groups are included/excluded
|
|
543
|
-
const isEveryParentGroupInclude = parentGroupData === null || parentGroupData === void 0 ? void 0 : parentGroupData.every((parent) => {
|
|
544
|
-
|
|
545
|
-
|
|
552
|
+
const isEveryParentGroupInclude = parentGroupData === null || parentGroupData === void 0 ? void 0 : parentGroupData.every((parent) => {
|
|
553
|
+
var _a;
|
|
554
|
+
return (_a = updatedCheckBoxData === null || updatedCheckBoxData === void 0 ? void 0 : updatedCheckBoxData.includedRecords) === null || _a === void 0 ? void 0 : _a.some((included) => (included === null || included === void 0 ? void 0 : included.id) === (parent === null || parent === void 0 ? void 0 : parent.id));
|
|
555
|
+
});
|
|
556
|
+
// const isEveryParentGroupExcluded = parentGroupData?.every((parent) =>
|
|
557
|
+
// updatedCheckBoxData?.excludedRecords?.some(
|
|
558
|
+
// (excluded) => excluded?.id === parent?.id
|
|
559
|
+
// )
|
|
560
|
+
// );
|
|
561
|
+
const isSomeParentGroupExcluded = parentGroupData === null || parentGroupData === void 0 ? void 0 : parentGroupData.some((parent) => {
|
|
562
|
+
var _a;
|
|
563
|
+
return (_a = updatedCheckBoxData === null || updatedCheckBoxData === void 0 ? void 0 : updatedCheckBoxData.excludedRecords) === null || _a === void 0 ? void 0 : _a.some((excluded) => (excluded === null || excluded === void 0 ? void 0 : excluded.id) === (parent === null || parent === void 0 ? void 0 : parent.id));
|
|
564
|
+
});
|
|
565
|
+
// const isEverySuperParentGroupExcluded = superParentData?.every((parent) =>
|
|
566
|
+
// updatedCheckBoxData?.excludedRecords?.some(
|
|
567
|
+
// (excluded) => excluded?.id === parent?.id
|
|
568
|
+
// )
|
|
569
|
+
// );
|
|
570
|
+
const isSomeSuperParentGroupExcluded = superParentData === null || superParentData === void 0 ? void 0 : superParentData.some((parent) => {
|
|
571
|
+
var _a;
|
|
572
|
+
return (_a = updatedCheckBoxData === null || updatedCheckBoxData === void 0 ? void 0 : updatedCheckBoxData.excludedRecords) === null || _a === void 0 ? void 0 : _a.some((excluded) => (excluded === null || excluded === void 0 ? void 0 : excluded.id) === (parent === null || parent === void 0 ? void 0 : parent.id));
|
|
573
|
+
});
|
|
574
|
+
const isEverySuperParentGroupInclude = superParentData === null || superParentData === void 0 ? void 0 : superParentData.every((parent) => {
|
|
575
|
+
var _a;
|
|
576
|
+
return (_a = updatedCheckBoxData === null || updatedCheckBoxData === void 0 ? void 0 : updatedCheckBoxData.includedRecords) === null || _a === void 0 ? void 0 : _a.some((included) => (included === null || included === void 0 ? void 0 : included.id) === (parent === null || parent === void 0 ? void 0 : parent.id));
|
|
577
|
+
});
|
|
546
578
|
// Determine the conditions to update group state
|
|
547
|
-
const conditions = (0, exports.determineConditions)(isChecked, updatedCheckBoxData.allBoxChecked, isEveryParentGroupInclude,
|
|
579
|
+
const conditions = (0, exports.determineConditions)(isChecked, updatedCheckBoxData.allBoxChecked, isEveryParentGroupInclude, isEverySuperParentGroupInclude, isSomeParentGroupExcluded, isSomeSuperParentGroupExcluded);
|
|
548
580
|
// Update group state based on determined conditions
|
|
549
581
|
(0, exports.updateGroupState)(groupingColumns, (_j = (_h = params === null || params === void 0 ? void 0 : params.node) === null || _h === void 0 ? void 0 : _h.parent) === null || _j === void 0 ? void 0 : _j.id, (_m = (_l = (_k = params === null || params === void 0 ? void 0 : params.node) === null || _k === void 0 ? void 0 : _k.parent) === null || _l === void 0 ? void 0 : _l.parent) === null || _m === void 0 ? void 0 : _m.id, conditions, setSelectedGroup);
|
|
550
582
|
};
|
|
551
583
|
exports.handleCheckboxClick = handleCheckboxClick;
|
|
584
|
+
const deepClone = (obj) => {
|
|
585
|
+
var _a, _b, _c;
|
|
586
|
+
// If the input is not an object or is null, return the value itself (primitive types are returned directly)
|
|
587
|
+
if (obj === null || typeof obj !== "object") {
|
|
588
|
+
return obj;
|
|
589
|
+
}
|
|
590
|
+
// Handle Date objects by creating a new Date instance with the same value
|
|
591
|
+
if (obj instanceof Date) {
|
|
592
|
+
return new Date(obj);
|
|
593
|
+
}
|
|
594
|
+
// Handle RegExp objects by creating a new RegExp instance with the same pattern and flags
|
|
595
|
+
if (obj instanceof RegExp) {
|
|
596
|
+
return new RegExp(obj);
|
|
597
|
+
}
|
|
598
|
+
// Handle React JSX elements
|
|
599
|
+
// If the object is a valid React element, clone it along with its props and children
|
|
600
|
+
if (react_1.default.isValidElement(obj)) {
|
|
601
|
+
const element = obj; // Explicitly assert type to ReactElement
|
|
602
|
+
// Recursively clone all child elements, if any
|
|
603
|
+
const clonedChildren = ((_a = element === null || element === void 0 ? void 0 : element.props) === null || _a === void 0 ? void 0 : _a.children)
|
|
604
|
+
? (_b = react_1.default.Children) === null || _b === void 0 ? void 0 : _b.map((_c = element === null || element === void 0 ? void 0 : element.props) === null || _c === void 0 ? void 0 : _c.children, (child) => (0, exports.deepClone)(child))
|
|
605
|
+
: undefined; // Set to undefined if no children exist
|
|
606
|
+
// Return a cloned React element with its props and recursively cloned children
|
|
607
|
+
return react_1.default.cloneElement(element, Object.assign({}, element === null || element === void 0 ? void 0 : element.props), // Spread the existing props
|
|
608
|
+
clonedChildren // Include cloned children
|
|
609
|
+
);
|
|
610
|
+
}
|
|
611
|
+
// Handle Arrays
|
|
612
|
+
// Recursively clone each element in the array
|
|
613
|
+
if (Array.isArray(obj)) {
|
|
614
|
+
return obj === null || obj === void 0 ? void 0 : obj.map(exports.deepClone);
|
|
615
|
+
}
|
|
616
|
+
// Handle Objects
|
|
617
|
+
// Recursively clone each property in the object
|
|
618
|
+
const clonedObj = {}; // Create a new empty object to hold cloned properties
|
|
619
|
+
for (const key in obj) {
|
|
620
|
+
// Use hasOwnProperty to avoid cloning inherited properties
|
|
621
|
+
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
622
|
+
clonedObj[key] = (0, exports.deepClone)(obj[key]); // Recursively clone each property
|
|
623
|
+
}
|
|
624
|
+
}
|
|
625
|
+
// Return the fully cloned object
|
|
626
|
+
return clonedObj;
|
|
627
|
+
};
|
|
628
|
+
exports.deepClone = deepClone;
|