sccoreui 6.2.16 → 6.2.17
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 +23 -11
- package/dist/assets/svg/svg.js +38 -163
- package/dist/components/ag-grid/AgGrid.js +1 -1
- package/dist/components/ag-grid/advancedFeature/column-group.js +45 -100
- package/dist/components/ag-grid/advancedFeature/hide-column.js +2 -2
- package/dist/components/ag-grid/context-provider.js +3 -6
- package/dist/components/ag-grid/helper.js +70 -147
- package/dist/components/ag-grid/parent-for-grid.js +57 -54
- package/dist/components/ag-grid/utilComponents.js +1 -7
- package/dist/components/formula-template/FormulaCoponent.js +2 -2
- package/dist/components/multi-select-dropdown/multi-select-dropdown.js +2 -4
- package/dist/pages/aggrid/AgGrid.js +606 -0
- package/dist/pages/aggrid/BulkAction.js +7 -0
- package/dist/pages/aggrid/RowGroupTrail.js +114 -0
- package/dist/pages/aggrid/fakeServer.js +95 -0
- package/dist/pages/aggrid/id-cell.js +9 -0
- package/dist/pages/aggrid/interface.js +2 -0
- package/dist/pages/avatar/avatar.js +338 -0
- package/dist/pages/badges/badge.js +73 -0
- package/dist/pages/breadcrumb/breadcrumb.js +14 -0
- package/dist/pages/button/button.js +10 -0
- package/dist/pages/button-group/button-group.js +10 -0
- package/dist/pages/chart/chart.js +257 -0
- package/dist/pages/checkbox/checkbox.js +26 -0
- package/dist/pages/checkbox-group/checkbox-group-component.js +21 -0
- package/dist/pages/color-picker/color-picker.js +13 -0
- package/dist/pages/content-dividers/content-dividers.js +11 -0
- package/dist/pages/custom-color-picker/custom-color-picker.js +12 -0
- package/dist/pages/custom-multiselect/CustomMultiSelect.js +37 -0
- package/dist/pages/date-picker/date-picker.js +20 -0
- package/dist/pages/dropdown/dropdown-component.js +39 -0
- package/dist/pages/file-upload/file-upload.js +34 -0
- package/dist/pages/flex.js +15 -0
- package/dist/pages/formulaTemplate/formulaTemplate.js +154 -0
- package/dist/pages/frolaTextEditor/froala-text-editor.js +12 -0
- package/dist/pages/home.js +49 -0
- package/dist/pages/input/input-text.js +112 -0
- package/dist/pages/list-box-dropdown/listboxdropdown.js +55 -0
- package/dist/pages/loader-indicator/loader-indicator.js +10 -0
- package/dist/pages/mega-mennu/mega-menu.js +84 -0
- package/dist/pages/multi-select-dropdown/multi-select-dropdown.js +51 -0
- package/dist/pages/not-found/not-found.js +10 -0
- package/dist/pages/paginator/pagination.js +122 -0
- package/dist/pages/progress-bar/progress-bar.js +27 -0
- package/dist/pages/progress-steps/progress-steps.js +24 -0
- package/dist/pages/radio-button/radio-button-component.js +11 -0
- package/dist/pages/shadows/shadows.js +7 -0
- package/dist/pages/slideout-menus/slideout-menus.js +104 -0
- package/dist/pages/sliders/slider.js +39 -0
- package/dist/pages/tabels/table-data.js +2193 -0
- package/dist/pages/tabels/table.js +98 -0
- package/dist/pages/tabs/tabs.js +9 -0
- package/dist/pages/tags/tags.js +70 -0
- package/dist/pages/toast/toast.js +47 -0
- package/dist/pages/toggle/toggle.js +10 -0
- package/dist/pages/tooltip/tooltip.js +13 -0
- package/dist/pages/treeDropdownSelect/treedropdowselect.js +34 -0
- package/dist/pages/types/type.js +2 -0
- package/dist/types/components/ag-grid/Types.d.ts +0 -3
- package/dist/types/components/ag-grid/context-provider.d.ts +0 -2
- package/dist/types/components/ag-grid/helper.d.ts +3 -4
- package/dist/types/components/ag-grid/utilComponents.d.ts +0 -1
- package/dist/types/pages/aggrid/AgGrid.d.ts +2 -0
- package/dist/types/pages/aggrid/BulkAction.d.ts +2 -0
- package/dist/types/pages/aggrid/RowGroupTrail.d.ts +4 -0
- package/dist/types/pages/aggrid/fakeServer.d.ts +7 -0
- package/dist/types/pages/aggrid/id-cell.d.ts +2 -0
- package/dist/types/pages/aggrid/interface.d.ts +12 -0
- package/dist/types/pages/avatar/avatar.d.ts +2 -0
- package/dist/types/pages/badges/badge.d.ts +3 -0
- package/dist/types/pages/breadcrumb/breadcrumb.d.ts +2 -0
- package/dist/types/pages/button/button.d.ts +2 -0
- package/dist/types/pages/button-group/button-group.d.ts +2 -0
- package/dist/types/pages/chart/chart.d.ts +2 -0
- package/dist/types/pages/checkbox/checkbox.d.ts +2 -0
- package/dist/types/pages/checkbox-group/checkbox-group-component.d.ts +3 -0
- package/dist/types/pages/color-picker/color-picker.d.ts +2 -0
- package/dist/types/pages/content-dividers/content-dividers.d.ts +2 -0
- package/dist/types/pages/custom-color-picker/custom-color-picker.d.ts +2 -0
- package/dist/types/pages/custom-multiselect/CustomMultiSelect.d.ts +2 -0
- package/dist/types/pages/date-picker/date-picker.d.ts +2 -0
- package/dist/types/pages/dropdown/dropdown-component.d.ts +2 -0
- package/dist/types/pages/file-upload/file-upload.d.ts +3 -0
- package/dist/types/pages/flex.d.ts +2 -0
- package/dist/types/pages/formulaTemplate/formulaTemplate.d.ts +2 -0
- package/dist/types/pages/frolaTextEditor/froala-text-editor.d.ts +2 -0
- package/dist/types/pages/home.d.ts +2 -0
- package/dist/types/pages/input/input-text.d.ts +3 -0
- package/dist/types/pages/list-box-dropdown/listboxdropdown.d.ts +2 -0
- package/dist/types/pages/loader-indicator/loader-indicator.d.ts +3 -0
- package/dist/types/pages/mega-mennu/mega-menu.d.ts +2 -0
- package/dist/types/pages/multi-select-dropdown/multi-select-dropdown.d.ts +2 -0
- package/dist/types/pages/not-found/not-found.d.ts +2 -0
- package/dist/types/pages/paginator/pagination.d.ts +2 -0
- package/dist/types/pages/progress-bar/progress-bar.d.ts +3 -0
- package/dist/types/pages/progress-steps/progress-steps.d.ts +2 -0
- package/dist/types/pages/radio-button/radio-button-component.d.ts +2 -0
- package/dist/types/pages/shadows/shadows.d.ts +2 -0
- package/dist/types/pages/slideout-menus/slideout-menus.d.ts +2 -0
- package/dist/types/pages/sliders/slider.d.ts +1 -0
- package/dist/types/pages/tabels/table-data.d.ts +3 -0
- package/dist/types/pages/tabels/table.d.ts +2 -0
- package/dist/types/pages/tabs/tabs.d.ts +3 -0
- package/dist/types/pages/tags/tags.d.ts +3 -0
- package/dist/types/pages/toast/toast.d.ts +2 -0
- package/dist/types/pages/toggle/toggle.d.ts +2 -0
- package/dist/types/pages/tooltip/tooltip.d.ts +2 -0
- package/dist/types/pages/treeDropdownSelect/treedropdowselect.d.ts +2 -0
- package/dist/types/pages/types/type.d.ts +64 -0
- package/package.json +1 -1
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
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;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
5
|
const constants_1 = require("./constants");
|
|
7
6
|
// initial checkbox data
|
|
8
7
|
exports.initialCheckBoxData = {
|
|
@@ -172,11 +171,11 @@ const mergeArrays = (currentUpdatedRows, updatedRecords) => {
|
|
|
172
171
|
// Convert map back to array
|
|
173
172
|
return Array.from(mergedMap.values());
|
|
174
173
|
};
|
|
175
|
-
const autoGroupColumnDef = (isTreeEnable, headerName, groupField, GroupHeaderComponent, headerCheckboxRenderer, enableCheckboxForGroupHeader, displayGroupCount,
|
|
174
|
+
const autoGroupColumnDef = (isTreeEnable, headerName, groupField, GroupHeaderComponent, headerCheckboxRenderer, enableCheckboxForGroupHeader, displayGroupCount, ChildRendererForGroup, HeaderRendererForGroup) => {
|
|
176
175
|
if (isTreeEnable) {
|
|
177
176
|
return {
|
|
178
177
|
headerName: headerName ? headerName : "Group",
|
|
179
|
-
minWidth:
|
|
178
|
+
minWidth: 300,
|
|
180
179
|
// cellRenderer:(params)=> params.data?.name ,
|
|
181
180
|
cellRendererParams: {
|
|
182
181
|
suppressCount: true,
|
|
@@ -190,7 +189,6 @@ const autoGroupColumnDef = (isTreeEnable, headerName, groupField, GroupHeaderCom
|
|
|
190
189
|
? () => headerCheckboxRenderer("", GroupHeaderComponent)
|
|
191
190
|
: GroupHeaderComponent,
|
|
192
191
|
cellRenderer: "agGroupCellRenderer",
|
|
193
|
-
minWidth: rowGroupColumnWidth || 300,
|
|
194
192
|
cellRendererParams: (params) => {
|
|
195
193
|
var _a;
|
|
196
194
|
// Render custom component for all group childs
|
|
@@ -221,7 +219,7 @@ exports.autoGroupColumnDef = autoGroupColumnDef;
|
|
|
221
219
|
// This function determines how to update `includedRecords` and `excludedRecords`
|
|
222
220
|
// depending on whether all checkboxes are checked or not (`allBoxChecked` state)
|
|
223
221
|
const updateRecords = (rowData, featureDetails, gridData) => {
|
|
224
|
-
var _a, _b, _c;
|
|
222
|
+
var _a, _b, _c, _d;
|
|
225
223
|
const { excludedRecords, includedRecords, allBoxChecked } = featureDetails.checkBoxSelection;
|
|
226
224
|
let newExcludedRecords = [...excludedRecords];
|
|
227
225
|
let newIncludedRecords = [...includedRecords];
|
|
@@ -229,15 +227,24 @@ const updateRecords = (rowData, featureDetails, gridData) => {
|
|
|
229
227
|
if (allBoxChecked) {
|
|
230
228
|
// Update excluded records: add or remove the current rowData
|
|
231
229
|
newExcludedRecords = (excludedRecords === null || excludedRecords === void 0 ? void 0 : excludedRecords.includes(rowData))
|
|
232
|
-
? excludedRecords === null || excludedRecords === void 0 ? void 0 : excludedRecords.filter((item) =>
|
|
230
|
+
? excludedRecords === null || excludedRecords === void 0 ? void 0 : excludedRecords.filter((item) => item !== rowData)
|
|
233
231
|
: [...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
|
+
}
|
|
234
241
|
// Check if all records are excluded; reset if so
|
|
235
|
-
if ((newExcludedRecords === null || newExcludedRecords === void 0 ? void 0 : newExcludedRecords.length) === ((
|
|
242
|
+
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)) {
|
|
236
243
|
return exports.initialCheckBoxData;
|
|
237
244
|
}
|
|
238
245
|
// Otherwise, update the excluded records and indeterminate state
|
|
239
246
|
else {
|
|
240
|
-
return Object.assign(Object.assign({}, featureDetails === null || featureDetails === void 0 ? void 0 : featureDetails.checkBoxSelection), { excludedRecords: newExcludedRecords, isIndeterminate: (
|
|
247
|
+
return Object.assign(Object.assign({}, featureDetails === null || featureDetails === void 0 ? void 0 : featureDetails.checkBoxSelection), { excludedRecords: newExcludedRecords, isIndeterminate: !(excludedRecords === null || excludedRecords === void 0 ? void 0 : excludedRecords.includes(rowData)) });
|
|
241
248
|
}
|
|
242
249
|
}
|
|
243
250
|
// When not all checkboxes are checked
|
|
@@ -247,7 +254,7 @@ const updateRecords = (rowData, featureDetails, gridData) => {
|
|
|
247
254
|
? 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))
|
|
248
255
|
: [...includedRecords, rowData];
|
|
249
256
|
// Check if all records are included; reset if so
|
|
250
|
-
if ((newIncludedRecords === null || newIncludedRecords === void 0 ? void 0 : newIncludedRecords.length) === ((
|
|
257
|
+
if ((newIncludedRecords === null || newIncludedRecords === void 0 ? void 0 : newIncludedRecords.length) === ((_c = gridData === null || gridData === void 0 ? void 0 : gridData.rowData) === null || _c === void 0 ? void 0 : _c.length)) {
|
|
251
258
|
return {
|
|
252
259
|
excludedRecords: [],
|
|
253
260
|
includedRecords: [],
|
|
@@ -256,7 +263,7 @@ const updateRecords = (rowData, featureDetails, gridData) => {
|
|
|
256
263
|
};
|
|
257
264
|
}
|
|
258
265
|
// Check if all records are excluded; reset if so
|
|
259
|
-
else if ((newExcludedRecords === null || newExcludedRecords === void 0 ? void 0 : newExcludedRecords.length) === ((
|
|
266
|
+
else if ((newExcludedRecords === null || newExcludedRecords === void 0 ? void 0 : newExcludedRecords.length) === ((_d = gridData === null || gridData === void 0 ? void 0 : gridData.rowData) === null || _d === void 0 ? void 0 : _d.length)) {
|
|
260
267
|
return exports.initialCheckBoxData;
|
|
261
268
|
}
|
|
262
269
|
// Otherwise, update the included records
|
|
@@ -268,15 +275,15 @@ const updateRecords = (rowData, featureDetails, gridData) => {
|
|
|
268
275
|
exports.updateRecords = updateRecords;
|
|
269
276
|
// Utility function to determine conditions for updating group states
|
|
270
277
|
// Based on various flags and states, determines whether to add or remove group IDs
|
|
271
|
-
const determineConditions = (isChecked, allBoxChecked, isEveryParentGroupInclude,
|
|
278
|
+
const determineConditions = (isChecked, allBoxChecked, isEveryParentGroupInclude, isEveryParentGroupExcluded, isEverySuperParentGroupExcluded) => ({
|
|
272
279
|
addParent: (!allBoxChecked && isChecked && isEveryParentGroupInclude) ||
|
|
273
|
-
(allBoxChecked && isChecked && !
|
|
274
|
-
addSuperParent: (!allBoxChecked && isChecked &&
|
|
275
|
-
(allBoxChecked && isChecked && !
|
|
280
|
+
(allBoxChecked && isChecked && !isEveryParentGroupExcluded),
|
|
281
|
+
addSuperParent: (!allBoxChecked && isChecked && isEveryParentGroupInclude) ||
|
|
282
|
+
(allBoxChecked && isChecked && !isEverySuperParentGroupExcluded),
|
|
276
283
|
removeParent: (!allBoxChecked && !isChecked && !isEveryParentGroupInclude) ||
|
|
277
|
-
(allBoxChecked && !isChecked &&
|
|
278
|
-
removeSuperParent: (!allBoxChecked && !isChecked && !
|
|
279
|
-
(allBoxChecked && !isChecked &&
|
|
284
|
+
(allBoxChecked && !isChecked && isEveryParentGroupExcluded),
|
|
285
|
+
removeSuperParent: (!allBoxChecked && !isChecked && !isEveryParentGroupInclude) ||
|
|
286
|
+
(allBoxChecked && !isChecked && isEverySuperParentGroupExcluded),
|
|
280
287
|
});
|
|
281
288
|
exports.determineConditions = determineConditions;
|
|
282
289
|
// Function to update the selected groups in the state
|
|
@@ -304,9 +311,8 @@ const updateGroupState = (groupingColumns, parentId, superParentId, conditions,
|
|
|
304
311
|
if (groupingColumns === 2) {
|
|
305
312
|
if (addSuperParent)
|
|
306
313
|
updateSelectedGroup(superParentId, true, setSelectedGroup); // Add super parent group ID
|
|
307
|
-
if (addParent)
|
|
308
|
-
updateSelectedGroup(parentId, true, setSelectedGroup);
|
|
309
|
-
} // Add parent group ID
|
|
314
|
+
if (addParent)
|
|
315
|
+
updateSelectedGroup(parentId, true, setSelectedGroup); // Add parent group ID
|
|
310
316
|
if (removeSuperParent)
|
|
311
317
|
updateSelectedGroup(superParentId, false, setSelectedGroup); // Remove super parent group ID
|
|
312
318
|
if (removeParent)
|
|
@@ -314,12 +320,10 @@ const updateGroupState = (groupingColumns, parentId, superParentId, conditions,
|
|
|
314
320
|
}
|
|
315
321
|
// Handle logic when there is 1 grouping column
|
|
316
322
|
else if (groupingColumns === 1) {
|
|
317
|
-
if (addParent)
|
|
318
|
-
updateSelectedGroup(parentId, true, setSelectedGroup); //
|
|
319
|
-
|
|
320
|
-
if (removeParent) {
|
|
323
|
+
if (addParent)
|
|
324
|
+
updateSelectedGroup(parentId, true, setSelectedGroup); // Add parent group ID
|
|
325
|
+
if (removeParent)
|
|
321
326
|
updateSelectedGroup(parentId, false, setSelectedGroup); // Remove parent group ID
|
|
322
|
-
}
|
|
323
327
|
}
|
|
324
328
|
};
|
|
325
329
|
exports.updateGroupState = updateGroupState;
|
|
@@ -337,14 +341,13 @@ const handleCheckedState = (params, featureDetails, gridData, setFeatureDetails,
|
|
|
337
341
|
const { groupData, parentGroupData } = gatherGroupData(params);
|
|
338
342
|
let newExcludedRecords = [...excludedRecords];
|
|
339
343
|
let newIncludedRecords = [...includedRecords];
|
|
340
|
-
// newExcludedRecords.filter((item) => item?.id !== group.id)
|
|
341
344
|
// Update records based on the checkbox state
|
|
342
345
|
groupData.forEach((group) => {
|
|
343
346
|
var _a, _b;
|
|
344
347
|
if (allBoxChecked) {
|
|
345
348
|
newExcludedRecords = (newExcludedRecords === null || newExcludedRecords === void 0 ? void 0 : newExcludedRecords.includes(group))
|
|
346
|
-
? newExcludedRecords.filter((item) =>
|
|
347
|
-
: newExcludedRecords;
|
|
349
|
+
? newExcludedRecords.filter((item) => item !== group)
|
|
350
|
+
: [...newExcludedRecords, group];
|
|
348
351
|
}
|
|
349
352
|
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) {
|
|
350
353
|
newIncludedRecords = newIncludedRecords.includes(group)
|
|
@@ -353,13 +356,17 @@ const handleCheckedState = (params, featureDetails, gridData, setFeatureDetails,
|
|
|
353
356
|
}
|
|
354
357
|
else {
|
|
355
358
|
newIncludedRecords = newIncludedRecords.includes(group)
|
|
356
|
-
? newIncludedRecords
|
|
359
|
+
? newIncludedRecords.filter((item) => {
|
|
360
|
+
if (item.id !== group.id)
|
|
361
|
+
group.isSelected = false;
|
|
362
|
+
return item.id !== group.id;
|
|
363
|
+
})
|
|
357
364
|
: [...newIncludedRecords, group];
|
|
358
365
|
}
|
|
359
366
|
});
|
|
360
367
|
updateCheckboxData(newIncludedRecords, newExcludedRecords, gridData, featureDetails, setFeatureDetails);
|
|
361
|
-
|
|
362
|
-
handleGroupSelection(params, setSelectedGroup, groupingColumns,
|
|
368
|
+
const isParent = determineParentGroupState(parentGroupData, newIncludedRecords, newExcludedRecords, allBoxChecked);
|
|
369
|
+
handleGroupSelection(params, setSelectedGroup, groupingColumns, isParent);
|
|
363
370
|
};
|
|
364
371
|
exports.handleCheckedState = handleCheckedState;
|
|
365
372
|
// Utility function to handle unchecked state updates
|
|
@@ -394,16 +401,14 @@ exports.handleUncheckedState = handleUncheckedState;
|
|
|
394
401
|
// Utility function to update checkbox data in the state
|
|
395
402
|
const updateCheckboxData = (newIncludedRecords, newExcludedRecords, gridData, featureDetails, setFeatureDetails) => {
|
|
396
403
|
var _a, _b;
|
|
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)
|
|
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)) {
|
|
398
405
|
setFeatureDetails(Object.assign(Object.assign({}, featureDetails), { checkBoxSelection: Object.assign(Object.assign({}, featureDetails.checkBoxSelection), { excludedRecords: [], includedRecords: [], isIndeterminate: false, allBoxChecked: true }) }));
|
|
399
406
|
}
|
|
400
407
|
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)) {
|
|
401
408
|
setFeatureDetails(Object.assign(Object.assign({}, featureDetails), { checkBoxSelection: exports.initialCheckBoxData }));
|
|
402
409
|
}
|
|
403
410
|
else {
|
|
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 }) }));
|
|
411
|
+
setFeatureDetails(Object.assign(Object.assign({}, featureDetails), { checkBoxSelection: Object.assign(Object.assign({}, featureDetails.checkBoxSelection), { excludedRecords: newExcludedRecords, includedRecords: newIncludedRecords, isIndeterminate: featureDetails.checkBoxSelection.allBoxChecked ? true : featureDetails.checkBoxSelection.isIndeterminate }) }));
|
|
407
412
|
}
|
|
408
413
|
};
|
|
409
414
|
// Utility function to determine parent group inclusion or exclusion states
|
|
@@ -413,57 +418,45 @@ const determineParentGroupState = (parentGroupData, newIncludedRecords, newExclu
|
|
|
413
418
|
return allBoxChecked ? isAnyParentGroupExcluded : isAnyParentGroupInclude;
|
|
414
419
|
};
|
|
415
420
|
// Utility function to handle group selection logic for checked state
|
|
416
|
-
const handleGroupSelection = (params, setSelectedGroup, groupingColumns,
|
|
421
|
+
const handleGroupSelection = (params, setSelectedGroup, groupingColumns, isParent) => {
|
|
417
422
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
418
|
-
|
|
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) {
|
|
423
|
+
if (groupingColumns === 2 && !((_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) {
|
|
426
424
|
(_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) => {
|
|
427
425
|
setSelectedGroup((prev) => prev.includes(childNode.id) ? prev : [...prev, childNode.id]);
|
|
428
426
|
});
|
|
429
427
|
setSelectedGroup((prev) => prev.includes(params.node.id) ? prev : [...prev, params.node.id]);
|
|
430
428
|
}
|
|
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) {
|
|
429
|
+
else if (((_e = params === null || params === void 0 ? void 0 : params.node) === null || _e === void 0 ? void 0 : _e.leafGroup) && ((_f = params === null || params === void 0 ? void 0 : params.node) === null || _f === void 0 ? void 0 : _f.level) === 1 && isParent) {
|
|
434
430
|
setSelectedGroup((prev) => prev.includes(params.node.id) ? prev : [...prev, params.node.id]);
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
});
|
|
442
|
-
}
|
|
431
|
+
setSelectedGroup((prev) => {
|
|
432
|
+
var _a, _b, _c, _d;
|
|
433
|
+
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)
|
|
434
|
+
? prev
|
|
435
|
+
: [...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];
|
|
436
|
+
});
|
|
443
437
|
}
|
|
444
|
-
else if (((_g = params === null || params === void 0 ? void 0 : params.node) === null || _g === void 0 ? void 0 : _g.leafGroup) &&
|
|
445
|
-
((
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
438
|
+
else if (((_g = params === null || params === void 0 ? void 0 : params.node) === null || _g === void 0 ? void 0 : _g.leafGroup) && ((_h = params === null || params === void 0 ? void 0 : params.node) === null || _h === void 0 ? void 0 : _h.level) === 1 && !isParent) {
|
|
439
|
+
setSelectedGroup((prev) => {
|
|
440
|
+
var _a, _b, _c, _d;
|
|
441
|
+
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)
|
|
442
|
+
? prev
|
|
443
|
+
: [...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];
|
|
444
|
+
});
|
|
445
|
+
setSelectedGroup((prev) => {
|
|
446
|
+
var _a, _b;
|
|
447
|
+
return prev.includes((_a = params === null || params === void 0 ? void 0 : params.node) === null || _a === void 0 ? void 0 : _a.id)
|
|
448
|
+
? prev
|
|
449
|
+
: [...prev, (_b = params === null || params === void 0 ? void 0 : params.node) === null || _b === void 0 ? void 0 : _b.id];
|
|
450
|
+
});
|
|
456
451
|
}
|
|
457
452
|
else {
|
|
458
|
-
setSelectedGroup((prev) => { var _a
|
|
453
|
+
setSelectedGroup((prev) => { var _a; return prev.includes(params.node.id) ? prev : [...prev, (_a = params === null || params === void 0 ? void 0 : params.node) === null || _a === void 0 ? void 0 : _a.id]; });
|
|
459
454
|
}
|
|
460
455
|
};
|
|
461
456
|
// Utility function to handle group deselection logic for unchecked state
|
|
462
457
|
const handleGroupDeselection = (params, setSelectedGroup, groupingColumns, isParent, isEveryParentGroupInclude) => {
|
|
463
458
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
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) {
|
|
459
|
+
if (groupingColumns === 2 && !((_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) {
|
|
467
460
|
(_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) => {
|
|
468
461
|
setSelectedGroup((prev) => prev === null || prev === void 0 ? void 0 : prev.filter((id) => id !== (childNode === null || childNode === void 0 ? void 0 : childNode.id)));
|
|
469
462
|
});
|
|
@@ -487,9 +480,7 @@ const handleGroupDeselection = (params, setSelectedGroup, groupingColumns, isPar
|
|
|
487
480
|
return prev;
|
|
488
481
|
});
|
|
489
482
|
}
|
|
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) {
|
|
483
|
+
else if (((_g = params === null || params === void 0 ? void 0 : params.node) === null || _g === void 0 ? void 0 : _g.leafGroup) && ((_h = params === null || params === void 0 ? void 0 : params.node) === null || _h === void 0 ? void 0 : _h.level) === 1 && !isParent) {
|
|
493
484
|
setSelectedGroup((prev) => {
|
|
494
485
|
if (prev === null || prev === void 0 ? void 0 : prev.includes(params.node.id)) {
|
|
495
486
|
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); });
|
|
@@ -549,80 +540,12 @@ const handleCheckboxClick = (e, params, featureDetails, gridData, setFeatureDeta
|
|
|
549
540
|
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);
|
|
550
541
|
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);
|
|
551
542
|
// Determine if all or any parent groups are included/excluded
|
|
552
|
-
const isEveryParentGroupInclude = parentGroupData === null || parentGroupData === void 0 ? void 0 : parentGroupData.every((parent) => {
|
|
553
|
-
|
|
554
|
-
|
|
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
|
-
});
|
|
543
|
+
const isEveryParentGroupInclude = parentGroupData === null || parentGroupData === void 0 ? void 0 : parentGroupData.every((parent) => { var _a; 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)); });
|
|
544
|
+
const isEveryParentGroupExcluded = parentGroupData === null || parentGroupData === void 0 ? void 0 : parentGroupData.every((parent) => { var _a; 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)); });
|
|
545
|
+
const isEverySuperParentGroupExcluded = superParentData === null || superParentData === void 0 ? void 0 : superParentData.every((parent) => { var _a; 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)); });
|
|
578
546
|
// Determine the conditions to update group state
|
|
579
|
-
const conditions = (0, exports.determineConditions)(isChecked, updatedCheckBoxData.allBoxChecked, isEveryParentGroupInclude,
|
|
547
|
+
const conditions = (0, exports.determineConditions)(isChecked, updatedCheckBoxData.allBoxChecked, isEveryParentGroupInclude, isEveryParentGroupExcluded, isEverySuperParentGroupExcluded);
|
|
580
548
|
// Update group state based on determined conditions
|
|
581
549
|
(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);
|
|
582
550
|
};
|
|
583
551
|
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;
|