@omniumretail/component-library 1.2.98 → 1.3.0

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.
@@ -24856,7 +24856,9 @@ const ResponsiveTable = (props) => {
24856
24856
  maxCellSelection,
24857
24857
  cellSelectionMode,
24858
24858
  cleanCellSelection,
24859
- cellSelectionStyle
24859
+ cellSelectionStyle,
24860
+ renderSelectedCell,
24861
+ useOrderedCellSelection = true
24860
24862
  } = props;
24861
24863
  const [customFilters, setCustomFilters] = useState([]);
24862
24864
  const [customColumns, setCustomColumns] = useState([]);
@@ -25019,40 +25021,91 @@ const ResponsiveTable = (props) => {
25019
25021
  );
25020
25022
  const isSelected = cellIndex !== -1;
25021
25023
  if (isSelectable) {
25022
- const isFirstCell = cellIndex === 0;
25023
- const isSecondCell = cellIndex === 1;
25024
- let cellStyle = {};
25025
- let icon2 = null;
25026
- if (isFirstCell) {
25027
- cellStyle = {
25028
- backgroundColor: finalCellStyle.firstCell.backgroundColor,
25029
- borderColor: finalCellStyle.firstCell.borderColor,
25030
- color: finalCellStyle.firstCell.textColor
25024
+ if (renderSelectedCell && isSelected) {
25025
+ const cellData = {
25026
+ rowKey: record[rowKeyValue],
25027
+ columnKey: key,
25028
+ value,
25029
+ rowData: record
25031
25030
  };
25032
- icon2 = /* @__PURE__ */ jsx(ArrowRightOutlined, { style: { color: finalCellStyle.firstCell.iconColor, fontSize: "14px" } });
25033
- } else if (isSecondCell) {
25034
- cellStyle = {
25035
- backgroundColor: finalCellStyle.secondCell.backgroundColor,
25036
- borderColor: finalCellStyle.secondCell.borderColor,
25037
- color: finalCellStyle.secondCell.textColor
25038
- };
25039
- icon2 = /* @__PURE__ */ jsx(ArrowLeftOutlined, { style: { color: finalCellStyle.secondCell.iconColor, fontSize: "14px" } });
25031
+ return /* @__PURE__ */ jsx(
25032
+ "div",
25033
+ {
25034
+ onClick: (e) => {
25035
+ e.stopPropagation();
25036
+ handleCellClick(record, key, value);
25037
+ },
25038
+ className: classNames(styles$7.selectableCell, styles$7.selected),
25039
+ children: renderSelectedCell(cellData, cellIndex, selectedCells.length)
25040
+ }
25041
+ );
25040
25042
  }
25041
- return /* @__PURE__ */ jsxs(
25043
+ if (!useOrderedCellSelection && isSelected) {
25044
+ const { value: cellValue, type, color } = typeof value === "object" ? value : { value, type: "", color: "" };
25045
+ return /* @__PURE__ */ jsx(
25046
+ "div",
25047
+ {
25048
+ onClick: (e) => {
25049
+ e.stopPropagation();
25050
+ handleCellClick(record, key, cellValue);
25051
+ },
25052
+ className: classNames(
25053
+ styles$7.selectableCell,
25054
+ isSelected && styles$7.selected,
25055
+ isSelected && styles$7.uniformSelection
25056
+ ),
25057
+ style: { backgroundColor: isSelected ? color : void 0 },
25058
+ children: type ? /* @__PURE__ */ jsx(Tag, { color, children: type }) : cellValue
25059
+ }
25060
+ );
25061
+ }
25062
+ if (useOrderedCellSelection) {
25063
+ const isFirstCell = cellIndex === 0;
25064
+ const isSecondCell = cellIndex === 1;
25065
+ let cellStyle = {};
25066
+ let icon2 = null;
25067
+ if (isFirstCell) {
25068
+ cellStyle = {
25069
+ backgroundColor: finalCellStyle.firstCell.backgroundColor,
25070
+ borderColor: finalCellStyle.firstCell.borderColor,
25071
+ color: finalCellStyle.firstCell.textColor
25072
+ };
25073
+ icon2 = /* @__PURE__ */ jsx(ArrowRightOutlined, { style: { color: finalCellStyle.firstCell.iconColor, fontSize: "14px" } });
25074
+ } else if (isSecondCell) {
25075
+ cellStyle = {
25076
+ backgroundColor: finalCellStyle.secondCell.backgroundColor,
25077
+ borderColor: finalCellStyle.secondCell.borderColor,
25078
+ color: finalCellStyle.secondCell.textColor
25079
+ };
25080
+ icon2 = /* @__PURE__ */ jsx(ArrowLeftOutlined, { style: { color: finalCellStyle.secondCell.iconColor, fontSize: "14px" } });
25081
+ }
25082
+ return /* @__PURE__ */ jsxs(
25083
+ "div",
25084
+ {
25085
+ onClick: (e) => {
25086
+ e.stopPropagation();
25087
+ handleCellClick(record, key, value);
25088
+ },
25089
+ className: classNames(styles$7.selectableCell, {
25090
+ [styles$7.selected]: isSelected
25091
+ }),
25092
+ style: isSelected ? cellStyle : {},
25093
+ children: [
25094
+ value,
25095
+ isSelected && icon2
25096
+ ]
25097
+ }
25098
+ );
25099
+ }
25100
+ return /* @__PURE__ */ jsx(
25042
25101
  "div",
25043
25102
  {
25044
25103
  onClick: (e) => {
25045
25104
  e.stopPropagation();
25046
25105
  handleCellClick(record, key, value);
25047
25106
  },
25048
- className: classNames(styles$7.selectableCell, {
25049
- [styles$7.selected]: isSelected
25050
- }),
25051
- style: isSelected ? cellStyle : {},
25052
- children: [
25053
- value,
25054
- isSelected && icon2
25055
- ]
25107
+ className: styles$7.selectableCell,
25108
+ children: value
25056
25109
  }
25057
25110
  );
25058
25111
  }