sccoreui 6.2.28 → 6.2.29
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.
|
@@ -365,7 +365,7 @@ const handleCheckedState = (params, featureDetails, gridData, setFeatureDetails,
|
|
|
365
365
|
: [...newIncludedRecords, group];
|
|
366
366
|
}
|
|
367
367
|
});
|
|
368
|
-
updateCheckboxData(newIncludedRecords, newExcludedRecords, gridData, featureDetails, setFeatureDetails);
|
|
368
|
+
updateCheckboxData(newIncludedRecords, newExcludedRecords, gridData, featureDetails, setFeatureDetails, allBoxChecked);
|
|
369
369
|
// const isParent = determineParentGroupState(parentGroupData, newIncludedRecords, newExcludedRecords, allBoxChecked, groupData);
|
|
370
370
|
handleGroupSelection(params, setSelectedGroup, groupingColumns, newIncludedRecords, newExcludedRecords, parentGroupData, allBoxChecked);
|
|
371
371
|
};
|
|
@@ -393,20 +393,26 @@ const handleUncheckedState = (params, featureDetails, gridData, setFeatureDetail
|
|
|
393
393
|
: [...newIncludedRecords, group];
|
|
394
394
|
}
|
|
395
395
|
});
|
|
396
|
-
updateCheckboxData(newIncludedRecords, newExcludedRecords, gridData, featureDetails, setFeatureDetails);
|
|
396
|
+
updateCheckboxData(newIncludedRecords, newExcludedRecords, gridData, featureDetails, setFeatureDetails, allBoxChecked);
|
|
397
397
|
const isEveryParentGroupInclude = 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)));
|
|
398
398
|
const isParent = determineParentGroupState(parentGroupData, newIncludedRecords, newExcludedRecords, allBoxChecked);
|
|
399
399
|
handleGroupDeselection(params, setSelectedGroup, groupingColumns, isParent, isEveryParentGroupInclude);
|
|
400
400
|
};
|
|
401
401
|
exports.handleUncheckedState = handleUncheckedState;
|
|
402
402
|
// Utility function to update checkbox data in the state
|
|
403
|
-
const updateCheckboxData = (newIncludedRecords, newExcludedRecords, gridData, featureDetails, setFeatureDetails) => {
|
|
404
|
-
var _a, _b;
|
|
405
|
-
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)
|
|
403
|
+
const updateCheckboxData = (newIncludedRecords, newExcludedRecords, gridData, featureDetails, setFeatureDetails, allBoxChecked) => {
|
|
404
|
+
var _a, _b, _c, _d;
|
|
405
|
+
if ((newIncludedRecords === null || newIncludedRecords === void 0 ? void 0 : newIncludedRecords.length) === 0 && ((_a = gridData === null || gridData === void 0 ? void 0 : gridData.rowData) === null || _a === void 0 ? void 0 : _a.length) === 0 && !allBoxChecked) {
|
|
406
|
+
setFeatureDetails(Object.assign(Object.assign({}, featureDetails), { checkBoxSelection: Object.assign(Object.assign({}, featureDetails.checkBoxSelection), { excludedRecords: [], includedRecords: [], isIndeterminate: false, allBoxChecked: false }) }));
|
|
407
|
+
}
|
|
408
|
+
else 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) && (newIncludedRecords === null || newIncludedRecords === void 0 ? void 0 : newIncludedRecords.length) > 0) {
|
|
409
|
+
setFeatureDetails(Object.assign(Object.assign({}, featureDetails), { checkBoxSelection: Object.assign(Object.assign({}, featureDetails.checkBoxSelection), { excludedRecords: [], includedRecords: [], isIndeterminate: false, allBoxChecked: true }) }));
|
|
410
|
+
}
|
|
411
|
+
else if ((newExcludedRecords === null || newExcludedRecords === void 0 ? void 0 : newExcludedRecords.length) === 0 && ((_c = gridData === null || gridData === void 0 ? void 0 : gridData.rowData) === null || _c === void 0 ? void 0 : _c.length) === 0 && allBoxChecked) {
|
|
406
412
|
setFeatureDetails(Object.assign(Object.assign({}, featureDetails), { checkBoxSelection: Object.assign(Object.assign({}, featureDetails.checkBoxSelection), { excludedRecords: [], includedRecords: [], isIndeterminate: false, allBoxChecked: true }) }));
|
|
407
413
|
}
|
|
408
|
-
else if ((newExcludedRecords === null || newExcludedRecords === void 0 ? void 0 : newExcludedRecords.length) === ((
|
|
409
|
-
setFeatureDetails(Object.assign(Object.assign({}, featureDetails), { checkBoxSelection:
|
|
414
|
+
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) && (newExcludedRecords === null || newExcludedRecords === void 0 ? void 0 : newExcludedRecords.length) > 0) {
|
|
415
|
+
setFeatureDetails(Object.assign(Object.assign({}, featureDetails), { checkBoxSelection: Object.assign(Object.assign({}, featureDetails.checkBoxSelection), { excludedRecords: [], includedRecords: [], isIndeterminate: false, allBoxChecked: false }) }));
|
|
410
416
|
}
|
|
411
417
|
else {
|
|
412
418
|
setFeatureDetails(Object.assign(Object.assign({}, featureDetails), { checkBoxSelection: Object.assign(Object.assign({}, featureDetails.checkBoxSelection), { excludedRecords: newExcludedRecords, includedRecords: newIncludedRecords, isIndeterminate: featureDetails.checkBoxSelection.allBoxChecked
|
|
@@ -98,13 +98,16 @@ function ParentForGrid(props) {
|
|
|
98
98
|
console.log("feature details", featureDetails === null || featureDetails === void 0 ? void 0 : featureDetails.checkBoxSelection);
|
|
99
99
|
// JSX for rendering checkbox in header
|
|
100
100
|
const headerCheckBoxRenderer = (headerDisplayName, HeaderComponent) => {
|
|
101
|
-
var _a, _b, _c, _d, _e, _f;
|
|
101
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
102
102
|
return ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: `flex align-items-center justify-content-between ${((_a = props === null || props === void 0 ? void 0 : props.conditionsToDisplay) === null || _a === void 0 ? void 0 : _a.displayCheckboxOnRight)
|
|
103
103
|
? "w-full pd-r-2"
|
|
104
104
|
: ""}` }, { children: ((_b = props === null || props === void 0 ? void 0 : props.conditionsToDisplay) === null || _b === void 0 ? void 0 : _b.displayCheckboxOnRight) ? ((0, jsx_runtime_1.jsxs)("div", Object.assign({ className: `flex align-items-center justify-content-between w-full ` }, { children: [HeaderComponent ? ((0, jsx_runtime_1.jsxs)("div", Object.assign({ className: " mr-auto" }, { children: [" ", (0, jsx_runtime_1.jsx)(HeaderComponent, {}), " "] }))) : ((0, jsx_runtime_1.jsx)("span", { children: headerDisplayName })), (0, jsx_runtime_1.jsx)(grid_checkbox_1.default, { checked: featureDetails.checkBoxSelection.allBoxChecked, onChange: () => handleHeaderCheckbox(props), isIndeterminate: featureDetails.checkBoxSelection.isIndeterminate &&
|
|
105
105
|
(((_d = (_c = featureDetails.checkBoxSelection) === null || _c === void 0 ? void 0 : _c.excludedRecords) === null || _d === void 0 ? void 0 : _d.length) > 0
|
|
106
106
|
? true
|
|
107
|
-
: false), shouldRenderOnRight: (_e = props === null || props === void 0 ? void 0 : props.conditionsToDisplay) === null || _e === void 0 ? void 0 : _e.displayCheckboxOnRight })] }))) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(grid_checkbox_1.default, { checked: featureDetails.checkBoxSelection.allBoxChecked, onChange: () => handleHeaderCheckbox(props), isIndeterminate: featureDetails.checkBoxSelection.isIndeterminate
|
|
107
|
+
: false), shouldRenderOnRight: (_e = props === null || props === void 0 ? void 0 : props.conditionsToDisplay) === null || _e === void 0 ? void 0 : _e.displayCheckboxOnRight })] }))) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(grid_checkbox_1.default, { checked: featureDetails.checkBoxSelection.allBoxChecked, onChange: () => handleHeaderCheckbox(props), isIndeterminate: featureDetails.checkBoxSelection.isIndeterminate &&
|
|
108
|
+
(((_g = (_f = featureDetails.checkBoxSelection) === null || _f === void 0 ? void 0 : _f.excludedRecords) === null || _g === void 0 ? void 0 : _g.length) > 0
|
|
109
|
+
? true
|
|
110
|
+
: false), shouldRenderOnRight: (_h = props === null || props === void 0 ? void 0 : props.conditionsToDisplay) === null || _h === void 0 ? void 0 : _h.displayCheckboxOnRight }), HeaderComponent ? ((0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "px-3" }, { children: [" ", (0, jsx_runtime_1.jsx)(HeaderComponent, {}), " "] }))) : ((0, jsx_runtime_1.jsx)("span", { children: headerDisplayName }))] })) })));
|
|
108
111
|
};
|
|
109
112
|
// JSX for rendering checkbox in cells
|
|
110
113
|
const cellCheckBoxRenderer = (params) => {
|
|
@@ -220,7 +223,7 @@ function ParentForGrid(props) {
|
|
|
220
223
|
var _a;
|
|
221
224
|
// Custom component for specific group header/parent
|
|
222
225
|
const GroupHeaderRenderer = (params) => {
|
|
223
|
-
var _a, _b, _c, _d;
|
|
226
|
+
var _a, _b, _c, _d, _e, _f;
|
|
224
227
|
const Wrapper = () => {
|
|
225
228
|
return (0, jsx_runtime_1.jsx)(utilComponents_1.GroupHeader, { params: params });
|
|
226
229
|
};
|
|
@@ -240,8 +243,8 @@ function ParentForGrid(props) {
|
|
|
240
243
|
// To display checkbox on right
|
|
241
244
|
return ((0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "flex align-items-center justify-content-between" }, { children: [(0, jsx_runtime_1.jsx)(group_checkbox_1.default, { checked: (selectedGroup === null || selectedGroup === void 0 ? void 0 : selectedGroup.includes((_b = params === null || params === void 0 ? void 0 : params.node) === null || _b === void 0 ? void 0 : _b.id)) ||
|
|
242
245
|
(((_c = featureDetails === null || featureDetails === void 0 ? void 0 : featureDetails.checkBoxSelection) === null || _c === void 0 ? void 0 : _c.allBoxChecked) &&
|
|
243
|
-
!((_d = featureDetails === null || featureDetails === void 0 ? void 0 : featureDetails.checkBoxSelection) === null || _d === void 0 ? void 0 : _d.isIndeterminate)), onChange: (e) => onChange(e, params), isIndeterminate: false, shouldRenderOnRight:
|
|
244
|
-
(0, jsx_runtime_1.jsx)(HeaderComponent, { params: params }) : params.node.field] })));
|
|
246
|
+
!((_d = featureDetails === null || featureDetails === void 0 ? void 0 : featureDetails.checkBoxSelection) === null || _d === void 0 ? void 0 : _d.isIndeterminate)), onChange: (e) => onChange(e, params), isIndeterminate: false, shouldRenderOnRight: (_e = props === null || props === void 0 ? void 0 : props.conditionsToDisplay) === null || _e === void 0 ? void 0 : _e.displayCheckboxOnRight }), props.rowGroupHeaderComponent ?
|
|
247
|
+
(0, jsx_runtime_1.jsx)(HeaderComponent, { params: params }) : (_f = params === null || params === void 0 ? void 0 : params.node) === null || _f === void 0 ? void 0 : _f.field] })));
|
|
245
248
|
}
|
|
246
249
|
return (0, jsx_runtime_1.jsx)(Wrapper, {});
|
|
247
250
|
};
|