sccoreui 6.2.27 → 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.
@@ -244,8 +244,16 @@ const updateRecords = (rowData, featureDetails, gridData) => {
244
244
  else {
245
245
  // Update included records: add or remove the current rowData
246
246
  newIncludedRecords = (includedRecords === null || includedRecords === void 0 ? void 0 : includedRecords.includes(rowData))
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))
248
- : [...includedRecords, rowData];
247
+ ? includedRecords === null || includedRecords === void 0 ? void 0 : includedRecords.filter((item) => {
248
+ if ((item === null || item === void 0 ? void 0 : item.id) !== (rowData === null || rowData === void 0 ? void 0 : rowData.id)) {
249
+ return item;
250
+ }
251
+ else {
252
+ rowData.isSelected = false; // Set isSelected to false if removing the row
253
+ return false; // Exclude this item from the new array
254
+ }
255
+ })
256
+ : [...includedRecords, rowData]; // Add rowData if it's not already included
249
257
  // Check if all records are included; reset if so
250
258
  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)) {
251
259
  return {
@@ -357,7 +365,7 @@ const handleCheckedState = (params, featureDetails, gridData, setFeatureDetails,
357
365
  : [...newIncludedRecords, group];
358
366
  }
359
367
  });
360
- updateCheckboxData(newIncludedRecords, newExcludedRecords, gridData, featureDetails, setFeatureDetails);
368
+ updateCheckboxData(newIncludedRecords, newExcludedRecords, gridData, featureDetails, setFeatureDetails, allBoxChecked);
361
369
  // const isParent = determineParentGroupState(parentGroupData, newIncludedRecords, newExcludedRecords, allBoxChecked, groupData);
362
370
  handleGroupSelection(params, setSelectedGroup, groupingColumns, newIncludedRecords, newExcludedRecords, parentGroupData, allBoxChecked);
363
371
  };
@@ -385,20 +393,26 @@ const handleUncheckedState = (params, featureDetails, gridData, setFeatureDetail
385
393
  : [...newIncludedRecords, group];
386
394
  }
387
395
  });
388
- updateCheckboxData(newIncludedRecords, newExcludedRecords, gridData, featureDetails, setFeatureDetails);
396
+ updateCheckboxData(newIncludedRecords, newExcludedRecords, gridData, featureDetails, setFeatureDetails, allBoxChecked);
389
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)));
390
398
  const isParent = determineParentGroupState(parentGroupData, newIncludedRecords, newExcludedRecords, allBoxChecked);
391
399
  handleGroupDeselection(params, setSelectedGroup, groupingColumns, isParent, isEveryParentGroupInclude);
392
400
  };
393
401
  exports.handleUncheckedState = handleUncheckedState;
394
402
  // Utility function to update checkbox data in the state
395
- const updateCheckboxData = (newIncludedRecords, newExcludedRecords, gridData, featureDetails, setFeatureDetails) => {
396
- 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) || ((newIncludedRecords === null || newIncludedRecords === void 0 ? void 0 : newIncludedRecords.length) === 0 && (newExcludedRecords === null || newExcludedRecords === void 0 ? void 0 : newExcludedRecords.length) === 0)) {
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) {
398
412
  setFeatureDetails(Object.assign(Object.assign({}, featureDetails), { checkBoxSelection: Object.assign(Object.assign({}, featureDetails.checkBoxSelection), { excludedRecords: [], includedRecords: [], isIndeterminate: false, allBoxChecked: true }) }));
399
413
  }
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)) {
401
- setFeatureDetails(Object.assign(Object.assign({}, featureDetails), { checkBoxSelection: exports.initialCheckBoxData }));
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 }) }));
402
416
  }
403
417
  else {
404
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, shouldRenderOnRight: (_f = props === null || props === void 0 ? void 0 : props.conditionsToDisplay) === null || _f === void 0 ? void 0 : _f.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 }))] })) })));
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: false }), props.rowGroupHeaderComponent ?
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
  };
@@ -489,7 +489,7 @@ const FormulaComponent = (props) => {
489
489
  switch (optiontype) {
490
490
  case "INCREASE_BY_VALUE":
491
491
  case "DECREASE_BY_VALUE": {
492
- return ((0, jsx_runtime_1.jsx)(inputnumber_1.InputNumber, Object.assign({ useGrouping: false, min: 0, minFractionDigits: 2, maxFractionDigits: 2 }, props === null || props === void 0 ? void 0 : props.field, { onChange: (e) => (props === null || props === void 0 ? void 0 : props.onChange) && (props === null || props === void 0 ? void 0 : props.onChange(e)), placeholder: "Enter Number", value: props === null || props === void 0 ? void 0 : props.inputValue, className: "border-none w-6", inputClassName: "border-none focus:shadow-none" })));
492
+ return ((0, jsx_runtime_1.jsx)(inputnumber_1.InputNumber, Object.assign({ useGrouping: false, min: 0, minFractionDigits: 2, maxFractionDigits: 2, maxLength: props === null || props === void 0 ? void 0 : props.maxLength }, props === null || props === void 0 ? void 0 : props.field, { onValueChange: (e) => (props === null || props === void 0 ? void 0 : props.onChange) && (props === null || props === void 0 ? void 0 : props.onChange(e)), placeholder: "Enter Number", value: props === null || props === void 0 ? void 0 : props.inputValue, className: "border-none w-6", inputClassName: "border-none focus:shadow-none" })));
493
493
  }
494
494
  case "INCREASE_BY_PERCENTAGE":
495
495
  case "DECREASE_BY_PERCENTAGE": {
@@ -328,5 +328,6 @@ export interface FormulaTemplateTypes {
328
328
  optionLabel?: string;
329
329
  menuClassName?: string;
330
330
  field?: any;
331
+ maxLength?: number;
331
332
  }
332
333
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sccoreui",
3
- "version": "6.2.27",
3
+ "version": "6.2.29",
4
4
  "description": "ui-sccore",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",