@omniumretail/component-library 1.3.40 → 1.3.41
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.
|
@@ -24894,68 +24894,72 @@ const ResponsiveTable = (props) => {
|
|
|
24894
24894
|
if (disableCellSelection) return;
|
|
24895
24895
|
const rowKey = record[rowKeyValue];
|
|
24896
24896
|
const originalCellContent = record[columnKey];
|
|
24897
|
-
|
|
24898
|
-
|
|
24899
|
-
|
|
24900
|
-
|
|
24901
|
-
|
|
24902
|
-
|
|
24903
|
-
|
|
24904
|
-
|
|
24905
|
-
);
|
|
24906
|
-
} else {
|
|
24907
|
-
const cellData = {
|
|
24908
|
-
rowKey,
|
|
24909
|
-
columnKey,
|
|
24910
|
-
value: {
|
|
24911
|
-
type: "X",
|
|
24912
|
-
color: selectedCellColor || "grey"
|
|
24913
|
-
},
|
|
24914
|
-
rowData: record
|
|
24915
|
-
};
|
|
24916
|
-
const maxSelection = maxCellSelection || 2;
|
|
24917
|
-
if (cellSelectionMode === "single") {
|
|
24918
|
-
newSelectedCells = [cellData];
|
|
24919
|
-
} else if (selectedCells.length >= maxSelection) {
|
|
24920
|
-
newSelectedCells = [...selectedCells.slice(1), cellData];
|
|
24921
|
-
} else {
|
|
24922
|
-
newSelectedCells = [...selectedCells, cellData];
|
|
24923
|
-
}
|
|
24924
|
-
}
|
|
24925
|
-
setSelectedCells(newSelectedCells);
|
|
24926
|
-
onCellsSelected?.(newSelectedCells);
|
|
24927
|
-
} else {
|
|
24897
|
+
console.log("🔍 CLICK DEBUG:", {
|
|
24898
|
+
rowKey,
|
|
24899
|
+
columnKey,
|
|
24900
|
+
originalCellContent,
|
|
24901
|
+
selectedCells: selectedCells.length
|
|
24902
|
+
});
|
|
24903
|
+
if (useOrderedCellSelection) ;
|
|
24904
|
+
else {
|
|
24928
24905
|
const cellIndex = selectedCells.findIndex(
|
|
24929
24906
|
(cell) => cell.rowKey === rowKey && cell.columnKey === columnKey
|
|
24930
24907
|
);
|
|
24931
24908
|
const isSelected = cellIndex >= 0;
|
|
24932
24909
|
const hasBackendSD = originalCellContent?.type === "S" || originalCellContent?.type === "D";
|
|
24933
24910
|
const hasBackendContent = originalCellContent?.type && !hasBackendSD;
|
|
24911
|
+
console.log("🔍 STATE:", { cellIndex, isSelected, hasBackendSD, hasBackendContent });
|
|
24934
24912
|
let newSelectedCells;
|
|
24935
24913
|
if (isSelected) {
|
|
24936
|
-
|
|
24937
|
-
|
|
24938
|
-
|
|
24939
|
-
|
|
24940
|
-
|
|
24941
|
-
|
|
24942
|
-
|
|
24943
|
-
|
|
24944
|
-
|
|
24945
|
-
|
|
24946
|
-
|
|
24947
|
-
|
|
24948
|
-
|
|
24949
|
-
columnKey,
|
|
24950
|
-
value: templateEditMode ? { type: currentTemplateType, color: currentTemplateColor } : { type: "X", color: selectedCellColor || "grey" },
|
|
24951
|
-
rowData: record
|
|
24952
|
-
};
|
|
24953
|
-
if (cellSelectionMode === "single") {
|
|
24954
|
-
newSelectedCells = [newCell];
|
|
24914
|
+
const selectedCell = selectedCells[cellIndex];
|
|
24915
|
+
const selectedType = selectedCell?.value?.type;
|
|
24916
|
+
console.log("✅ IS SELECTED:", { selectedType });
|
|
24917
|
+
if (selectedType !== null) {
|
|
24918
|
+
if (hasBackendContent) {
|
|
24919
|
+
newSelectedCells = selectedCells.map(
|
|
24920
|
+
(cell, idx) => idx === cellIndex ? { ...cell, value: { type: null, color: null } } : cell
|
|
24921
|
+
);
|
|
24922
|
+
console.log("➡️ Marked as empty");
|
|
24923
|
+
} else {
|
|
24924
|
+
newSelectedCells = selectedCells.filter((_, index) => index !== cellIndex);
|
|
24925
|
+
console.log("➡️ Removed");
|
|
24926
|
+
}
|
|
24955
24927
|
} else {
|
|
24928
|
+
newSelectedCells = selectedCells.map(
|
|
24929
|
+
(cell, idx) => idx === cellIndex ? {
|
|
24930
|
+
...cell,
|
|
24931
|
+
value: templateEditMode ? { type: currentTemplateType, color: currentTemplateColor } : { type: "X", color: selectedCellColor || "grey" }
|
|
24932
|
+
} : cell
|
|
24933
|
+
);
|
|
24934
|
+
console.log("➡️ Added new type to empty");
|
|
24935
|
+
}
|
|
24936
|
+
} else {
|
|
24937
|
+
console.log("❌ NOT SELECTED");
|
|
24938
|
+
if (hasBackendContent) {
|
|
24939
|
+
const newCell = {
|
|
24940
|
+
rowKey,
|
|
24941
|
+
columnKey,
|
|
24942
|
+
value: { type: null, color: null },
|
|
24943
|
+
rowData: record
|
|
24944
|
+
};
|
|
24956
24945
|
newSelectedCells = [...selectedCells, newCell];
|
|
24946
|
+
console.log("➡️ Adding as empty (backend content)");
|
|
24947
|
+
} else {
|
|
24948
|
+
const newCell = {
|
|
24949
|
+
rowKey,
|
|
24950
|
+
columnKey,
|
|
24951
|
+
value: templateEditMode ? { type: currentTemplateType, color: currentTemplateColor } : { type: "X", color: selectedCellColor || "grey" },
|
|
24952
|
+
rowData: record
|
|
24953
|
+
};
|
|
24954
|
+
if (cellSelectionMode === "single") {
|
|
24955
|
+
newSelectedCells = [newCell];
|
|
24956
|
+
} else {
|
|
24957
|
+
newSelectedCells = [...selectedCells, newCell];
|
|
24958
|
+
}
|
|
24959
|
+
console.log("➡️ Adding new type (empty cell)");
|
|
24957
24960
|
}
|
|
24958
24961
|
}
|
|
24962
|
+
console.log("📤 NEW STATE:", newSelectedCells.length);
|
|
24959
24963
|
setSelectedCells(newSelectedCells);
|
|
24960
24964
|
onCellsSelected?.(newSelectedCells);
|
|
24961
24965
|
}
|
|
@@ -25100,11 +25104,9 @@ const ResponsiveTable = (props) => {
|
|
|
25100
25104
|
if (isSelected2) {
|
|
25101
25105
|
const selectedCell = selectedCells[cellIndex2];
|
|
25102
25106
|
const cellType = selectedCell?.value?.type;
|
|
25103
|
-
if (cellType === null) {
|
|
25104
|
-
return null;
|
|
25105
|
-
}
|
|
25106
25107
|
return {
|
|
25107
25108
|
type: cellType,
|
|
25109
|
+
// ⚡ Pode ser null!
|
|
25108
25110
|
color: selectedCell?.value?.color,
|
|
25109
25111
|
isFromSelection: true
|
|
25110
25112
|
};
|
|
@@ -25120,13 +25122,16 @@ const ResponsiveTable = (props) => {
|
|
|
25120
25122
|
};
|
|
25121
25123
|
const topLayer = getTopLayerContent();
|
|
25122
25124
|
const getBackgroundColor = () => {
|
|
25125
|
+
if (topLayer?.isFromSelection && topLayer.type === null) {
|
|
25126
|
+
return void 0;
|
|
25127
|
+
}
|
|
25123
25128
|
if (hasBackendSD) {
|
|
25124
25129
|
return originalCellContent2.color;
|
|
25125
25130
|
}
|
|
25126
|
-
if (topLayer && (topLayer.type === "F" || topLayer.type === "S" || topLayer.type === "D")) {
|
|
25131
|
+
if (topLayer?.isFromSelection && (topLayer.type === "F" || topLayer.type === "S" || topLayer.type === "D")) {
|
|
25127
25132
|
return topLayer.color;
|
|
25128
25133
|
}
|
|
25129
|
-
if (originalCellContent2?.type === "F"
|
|
25134
|
+
if (!topLayer?.isFromSelection && originalCellContent2?.type && (originalCellContent2.type === "F" || originalCellContent2.type === "S" || originalCellContent2.type === "D")) {
|
|
25130
25135
|
return originalCellContent2.color;
|
|
25131
25136
|
}
|
|
25132
25137
|
return void 0;
|
|
@@ -25155,6 +25160,9 @@ const ResponsiveTable = (props) => {
|
|
|
25155
25160
|
if (isSelectable2) {
|
|
25156
25161
|
const cellContent = (() => {
|
|
25157
25162
|
if (templateEditMode) {
|
|
25163
|
+
if (topLayer && topLayer.type === null) {
|
|
25164
|
+
return null;
|
|
25165
|
+
}
|
|
25158
25166
|
if (topLayer) {
|
|
25159
25167
|
return /* @__PURE__ */ jsx(Tag, { color: topLayer.color, style: { margin: -4, cursor: "pointer" }, children: topLayer.type });
|
|
25160
25168
|
}
|