@omniumretail/component-library 1.3.18 → 1.3.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.
|
@@ -24860,7 +24860,8 @@ const ResponsiveTable = (props) => {
|
|
|
24860
24860
|
renderSelectedCell,
|
|
24861
24861
|
useOrderedCellSelection = true,
|
|
24862
24862
|
initialSelectedCells,
|
|
24863
|
-
selectedCellColor
|
|
24863
|
+
selectedCellColor,
|
|
24864
|
+
initialCellKeys
|
|
24864
24865
|
} = props;
|
|
24865
24866
|
const [customFilters, setCustomFilters] = useState([]);
|
|
24866
24867
|
const [customColumns, setCustomColumns] = useState([]);
|
|
@@ -24889,21 +24890,26 @@ const ResponsiveTable = (props) => {
|
|
|
24889
24890
|
};
|
|
24890
24891
|
const handleCellClick = (record, columnKey, value) => {
|
|
24891
24892
|
if (!enableCellSelection || !selectableColumns?.includes(columnKey)) return;
|
|
24892
|
-
const
|
|
24893
|
-
|
|
24894
|
-
columnKey,
|
|
24895
|
-
value,
|
|
24896
|
-
rowData: record
|
|
24897
|
-
};
|
|
24893
|
+
const cellKey = `${record[rowKeyValue]}-${columnKey}`;
|
|
24894
|
+
initialCellKeys?.has(cellKey);
|
|
24898
24895
|
const isAlreadySelected = selectedCells.some(
|
|
24899
|
-
(cell) => cell.rowKey ===
|
|
24896
|
+
(cell) => cell.rowKey === record[rowKeyValue] && cell.columnKey === columnKey
|
|
24900
24897
|
);
|
|
24901
24898
|
let newSelectedCells;
|
|
24902
24899
|
if (isAlreadySelected) {
|
|
24903
24900
|
newSelectedCells = selectedCells.filter(
|
|
24904
|
-
(cell) => !(cell.rowKey ===
|
|
24901
|
+
(cell) => !(cell.rowKey === record[rowKeyValue] && cell.columnKey === columnKey)
|
|
24905
24902
|
);
|
|
24906
24903
|
} else {
|
|
24904
|
+
const cellData = {
|
|
24905
|
+
rowKey: record[rowKeyValue],
|
|
24906
|
+
columnKey,
|
|
24907
|
+
value: {
|
|
24908
|
+
type: "X",
|
|
24909
|
+
color: selectedCellColor || "grey"
|
|
24910
|
+
},
|
|
24911
|
+
rowData: record
|
|
24912
|
+
};
|
|
24907
24913
|
const maxSelection = maxCellSelection || 2;
|
|
24908
24914
|
if (cellSelectionMode === "single") {
|
|
24909
24915
|
newSelectedCells = [cellData];
|
|
@@ -25035,7 +25041,7 @@ const ResponsiveTable = (props) => {
|
|
|
25035
25041
|
{
|
|
25036
25042
|
onClick: (e) => {
|
|
25037
25043
|
e.stopPropagation();
|
|
25038
|
-
handleCellClick(record, key
|
|
25044
|
+
handleCellClick(record, key);
|
|
25039
25045
|
},
|
|
25040
25046
|
className: classNames(styles$7.selectableCell, styles$7.selected),
|
|
25041
25047
|
children: renderSelectedCell(cellData, cellIndex, selectedCells.length)
|
|
@@ -25075,7 +25081,8 @@ const ResponsiveTable = (props) => {
|
|
|
25075
25081
|
if (isSelected2) {
|
|
25076
25082
|
const selectedCell = selectedCells[cellIndex2];
|
|
25077
25083
|
const cellColor = selectedCell?.value?.color || selectedCellColor;
|
|
25078
|
-
|
|
25084
|
+
const cellType = selectedCell?.value?.type || "X";
|
|
25085
|
+
return /* @__PURE__ */ jsx(Tag, { color: cellColor, style: { margin: -4 }, children: cellType });
|
|
25079
25086
|
}
|
|
25080
25087
|
if (originalCellContent2) {
|
|
25081
25088
|
return /* @__PURE__ */ jsx(Tag, { color: originalCellContent2.color, style: { margin: -4 }, children: originalCellContent2.type });
|
|
@@ -25087,7 +25094,7 @@ const ResponsiveTable = (props) => {
|
|
|
25087
25094
|
{
|
|
25088
25095
|
onClick: (e) => {
|
|
25089
25096
|
e.stopPropagation();
|
|
25090
|
-
handleCellClick(record, key
|
|
25097
|
+
handleCellClick(record, key);
|
|
25091
25098
|
},
|
|
25092
25099
|
className: classNames(
|
|
25093
25100
|
styles$7.selectableCell,
|
|
@@ -25125,7 +25132,7 @@ const ResponsiveTable = (props) => {
|
|
|
25125
25132
|
{
|
|
25126
25133
|
onClick: (e) => {
|
|
25127
25134
|
e.stopPropagation();
|
|
25128
|
-
handleCellClick(record, key
|
|
25135
|
+
handleCellClick(record, key);
|
|
25129
25136
|
},
|
|
25130
25137
|
className: classNames(styles$7.selectableCell, {
|
|
25131
25138
|
[styles$7.selected]: isSelected
|
|
@@ -25143,7 +25150,7 @@ const ResponsiveTable = (props) => {
|
|
|
25143
25150
|
{
|
|
25144
25151
|
onClick: (e) => {
|
|
25145
25152
|
e.stopPropagation();
|
|
25146
|
-
handleCellClick(record, key
|
|
25153
|
+
handleCellClick(record, key);
|
|
25147
25154
|
},
|
|
25148
25155
|
className: styles$7.selectableCell,
|
|
25149
25156
|
children: originalCellContent
|