@omniumretail/component-library 1.3.41 → 1.3.42
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,12 +24894,7 @@ const ResponsiveTable = (props) => {
|
|
|
24894
24894
|
if (disableCellSelection) return;
|
|
24895
24895
|
const rowKey = record[rowKeyValue];
|
|
24896
24896
|
const originalCellContent = record[columnKey];
|
|
24897
|
-
console.log("🔍 CLICK DEBUG:", {
|
|
24898
|
-
rowKey,
|
|
24899
|
-
columnKey,
|
|
24900
|
-
originalCellContent,
|
|
24901
|
-
selectedCells: selectedCells.length
|
|
24902
|
-
});
|
|
24897
|
+
console.log("🔍 CLICK DEBUG:", { rowKey, columnKey, originalCellContent, selectedCells: selectedCells.length, templateEditMode });
|
|
24903
24898
|
if (useOrderedCellSelection) ;
|
|
24904
24899
|
else {
|
|
24905
24900
|
const cellIndex = selectedCells.findIndex(
|
|
@@ -24908,34 +24903,45 @@ const ResponsiveTable = (props) => {
|
|
|
24908
24903
|
const isSelected = cellIndex >= 0;
|
|
24909
24904
|
const hasBackendSD = originalCellContent?.type === "S" || originalCellContent?.type === "D";
|
|
24910
24905
|
const hasBackendContent = originalCellContent?.type && !hasBackendSD;
|
|
24911
|
-
|
|
24906
|
+
const hasBackendBackground = hasBackendSD || originalCellContent?.type === "F";
|
|
24907
|
+
const hasBlockedContent = originalCellContent?.type === "I" || originalCellContent?.type === "L";
|
|
24908
|
+
console.log("🔍 STATE:", { cellIndex, isSelected, hasBackendSD, hasBackendContent, templateEditMode });
|
|
24909
|
+
if (!templateEditMode && hasBlockedContent) {
|
|
24910
|
+
console.log("🚫 BLOCKED: I/L not clickable in user mode");
|
|
24911
|
+
return;
|
|
24912
|
+
}
|
|
24912
24913
|
let newSelectedCells;
|
|
24913
24914
|
if (isSelected) {
|
|
24914
24915
|
const selectedCell = selectedCells[cellIndex];
|
|
24915
24916
|
const selectedType = selectedCell?.value?.type;
|
|
24916
24917
|
console.log("✅ IS SELECTED:", { selectedType });
|
|
24917
|
-
if (
|
|
24918
|
-
if (
|
|
24918
|
+
if (templateEditMode) {
|
|
24919
|
+
if (selectedType !== null) {
|
|
24920
|
+
if (hasBackendContent) {
|
|
24921
|
+
newSelectedCells = selectedCells.map(
|
|
24922
|
+
(cell, idx) => idx === cellIndex ? { ...cell, value: { type: null, color: null } } : cell
|
|
24923
|
+
);
|
|
24924
|
+
console.log("➡️ Marked as empty (template mode)");
|
|
24925
|
+
} else {
|
|
24926
|
+
newSelectedCells = selectedCells.filter((_, index) => index !== cellIndex);
|
|
24927
|
+
console.log("➡️ Removed (template mode)");
|
|
24928
|
+
}
|
|
24929
|
+
} else {
|
|
24919
24930
|
newSelectedCells = selectedCells.map(
|
|
24920
|
-
(cell, idx) => idx === cellIndex ? {
|
|
24931
|
+
(cell, idx) => idx === cellIndex ? {
|
|
24932
|
+
...cell,
|
|
24933
|
+
value: { type: currentTemplateType, color: currentTemplateColor }
|
|
24934
|
+
} : cell
|
|
24921
24935
|
);
|
|
24922
|
-
console.log("➡️
|
|
24923
|
-
} else {
|
|
24924
|
-
newSelectedCells = selectedCells.filter((_, index) => index !== cellIndex);
|
|
24925
|
-
console.log("➡️ Removed");
|
|
24936
|
+
console.log("➡️ Added new type to empty (template mode)");
|
|
24926
24937
|
}
|
|
24927
24938
|
} else {
|
|
24928
|
-
newSelectedCells = selectedCells.
|
|
24929
|
-
|
|
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");
|
|
24939
|
+
newSelectedCells = selectedCells.filter((_, index) => index !== cellIndex);
|
|
24940
|
+
console.log("➡️ Removed (user mode)");
|
|
24935
24941
|
}
|
|
24936
24942
|
} else {
|
|
24937
24943
|
console.log("❌ NOT SELECTED");
|
|
24938
|
-
if (hasBackendContent) {
|
|
24944
|
+
if (templateEditMode && hasBackendContent) {
|
|
24939
24945
|
const newCell = {
|
|
24940
24946
|
rowKey,
|
|
24941
24947
|
columnKey,
|
|
@@ -24943,7 +24949,20 @@ const ResponsiveTable = (props) => {
|
|
|
24943
24949
|
rowData: record
|
|
24944
24950
|
};
|
|
24945
24951
|
newSelectedCells = [...selectedCells, newCell];
|
|
24946
|
-
console.log("➡️ Adding as empty (backend content)");
|
|
24952
|
+
console.log("➡️ Adding as empty (template mode, backend content)");
|
|
24953
|
+
} else if (!templateEditMode && (hasBackendBackground || !originalCellContent?.type)) {
|
|
24954
|
+
const newCell = {
|
|
24955
|
+
rowKey,
|
|
24956
|
+
columnKey,
|
|
24957
|
+
value: { type: "X", color: selectedCellColor || "grey" },
|
|
24958
|
+
rowData: record
|
|
24959
|
+
};
|
|
24960
|
+
if (cellSelectionMode === "single") {
|
|
24961
|
+
newSelectedCells = [newCell];
|
|
24962
|
+
} else {
|
|
24963
|
+
newSelectedCells = [...selectedCells, newCell];
|
|
24964
|
+
}
|
|
24965
|
+
console.log("➡️ Adding X (user mode, empty or background)");
|
|
24947
24966
|
} else {
|
|
24948
24967
|
const newCell = {
|
|
24949
24968
|
rowKey,
|
|
@@ -25091,18 +25110,13 @@ const ResponsiveTable = (props) => {
|
|
|
25091
25110
|
);
|
|
25092
25111
|
}
|
|
25093
25112
|
if (!useOrderedCellSelection) {
|
|
25094
|
-
const
|
|
25095
|
-
const
|
|
25096
|
-
const
|
|
25097
|
-
const
|
|
25098
|
-
const cellIndex2 = selectedCells.findIndex(
|
|
25099
|
-
(cell) => cell.rowKey === record[rowKeyValue] && cell.columnKey === key
|
|
25100
|
-
);
|
|
25101
|
-
const isSelected2 = cellIndex2 !== -1;
|
|
25102
|
-
const hasBackendSD = originalCellContent2?.type === "S" || originalCellContent2?.type === "D";
|
|
25113
|
+
const isDisabled = originalCellContent?.disabled === true;
|
|
25114
|
+
const isReadonly = originalCellContent?.readonly === true;
|
|
25115
|
+
const hasBackendBackground = originalCellContent?.type === "S" || originalCellContent?.type === "D" || originalCellContent?.type === "F";
|
|
25116
|
+
const hasBlockedContent = originalCellContent?.type === "I" || originalCellContent?.type === "L";
|
|
25103
25117
|
const getTopLayerContent = () => {
|
|
25104
|
-
if (
|
|
25105
|
-
const selectedCell = selectedCells[
|
|
25118
|
+
if (isSelected) {
|
|
25119
|
+
const selectedCell = selectedCells[cellIndex];
|
|
25106
25120
|
const cellType = selectedCell?.value?.type;
|
|
25107
25121
|
return {
|
|
25108
25122
|
type: cellType,
|
|
@@ -25111,10 +25125,10 @@ const ResponsiveTable = (props) => {
|
|
|
25111
25125
|
isFromSelection: true
|
|
25112
25126
|
};
|
|
25113
25127
|
}
|
|
25114
|
-
if (
|
|
25128
|
+
if (originalCellContent?.type && !hasBackendBackground) {
|
|
25115
25129
|
return {
|
|
25116
|
-
type:
|
|
25117
|
-
color:
|
|
25130
|
+
type: originalCellContent.type,
|
|
25131
|
+
color: originalCellContent.color,
|
|
25118
25132
|
isFromSelection: false
|
|
25119
25133
|
};
|
|
25120
25134
|
}
|
|
@@ -25125,21 +25139,18 @@ const ResponsiveTable = (props) => {
|
|
|
25125
25139
|
if (topLayer?.isFromSelection && topLayer.type === null) {
|
|
25126
25140
|
return void 0;
|
|
25127
25141
|
}
|
|
25128
|
-
if (
|
|
25129
|
-
return
|
|
25142
|
+
if (hasBackendBackground) {
|
|
25143
|
+
return originalCellContent.color;
|
|
25130
25144
|
}
|
|
25131
25145
|
if (topLayer?.isFromSelection && (topLayer.type === "F" || topLayer.type === "S" || topLayer.type === "D")) {
|
|
25132
25146
|
return topLayer.color;
|
|
25133
25147
|
}
|
|
25134
|
-
if (!topLayer?.isFromSelection && originalCellContent2?.type && (originalCellContent2.type === "F" || originalCellContent2.type === "S" || originalCellContent2.type === "D")) {
|
|
25135
|
-
return originalCellContent2.color;
|
|
25136
|
-
}
|
|
25137
25148
|
return void 0;
|
|
25138
25149
|
};
|
|
25139
25150
|
const cellBackgroundColor = getBackgroundColor();
|
|
25140
25151
|
if (isDisabled) {
|
|
25141
|
-
if (
|
|
25142
|
-
return /* @__PURE__ */ jsx(Tag, { color:
|
|
25152
|
+
if (originalCellContent?.type === "I" || originalCellContent?.type === "L" || isReadonly) {
|
|
25153
|
+
return /* @__PURE__ */ jsx(Tag, { color: originalCellContent.color, style: { margin: -4, cursor: "not-allowed" }, children: originalCellContent.type });
|
|
25143
25154
|
} else {
|
|
25144
25155
|
return /* @__PURE__ */ jsx(
|
|
25145
25156
|
"div",
|
|
@@ -25157,7 +25168,7 @@ const ResponsiveTable = (props) => {
|
|
|
25157
25168
|
);
|
|
25158
25169
|
}
|
|
25159
25170
|
}
|
|
25160
|
-
if (
|
|
25171
|
+
if (isSelectable) {
|
|
25161
25172
|
const cellContent = (() => {
|
|
25162
25173
|
if (templateEditMode) {
|
|
25163
25174
|
if (topLayer && topLayer.type === null) {
|
|
@@ -25166,13 +25177,13 @@ const ResponsiveTable = (props) => {
|
|
|
25166
25177
|
if (topLayer) {
|
|
25167
25178
|
return /* @__PURE__ */ jsx(Tag, { color: topLayer.color, style: { margin: -4, cursor: "pointer" }, children: topLayer.type });
|
|
25168
25179
|
}
|
|
25169
|
-
if (
|
|
25170
|
-
return /* @__PURE__ */ jsx(Tag, { color:
|
|
25180
|
+
if (hasBackendBackground) {
|
|
25181
|
+
return /* @__PURE__ */ jsx(Tag, { color: originalCellContent.color, style: { margin: -4, cursor: "pointer" }, children: originalCellContent.type });
|
|
25171
25182
|
}
|
|
25172
25183
|
return null;
|
|
25173
25184
|
}
|
|
25174
|
-
if (
|
|
25175
|
-
const selectedCell = selectedCells[
|
|
25185
|
+
if (isSelected) {
|
|
25186
|
+
const selectedCell = selectedCells[cellIndex];
|
|
25176
25187
|
const cellColor = selectedCell?.value?.color || selectedCellColor;
|
|
25177
25188
|
const cellType = selectedCell?.value?.type || "X";
|
|
25178
25189
|
const isLicenseType = cellType === "L";
|
|
@@ -25186,8 +25197,11 @@ const ResponsiveTable = (props) => {
|
|
|
25186
25197
|
}
|
|
25187
25198
|
);
|
|
25188
25199
|
}
|
|
25189
|
-
if (
|
|
25190
|
-
return /* @__PURE__ */ jsx(Tag, { color:
|
|
25200
|
+
if (hasBackendBackground) {
|
|
25201
|
+
return /* @__PURE__ */ jsx(Tag, { color: originalCellContent.color, style: { margin: -4, cursor: "pointer" }, children: originalCellContent.type });
|
|
25202
|
+
}
|
|
25203
|
+
if (hasBlockedContent) {
|
|
25204
|
+
return /* @__PURE__ */ jsx(Tag, { color: originalCellContent.color, style: { margin: -4, cursor: "not-allowed" }, children: originalCellContent.type });
|
|
25191
25205
|
}
|
|
25192
25206
|
return null;
|
|
25193
25207
|
})();
|
|
@@ -25197,15 +25211,15 @@ const ResponsiveTable = (props) => {
|
|
|
25197
25211
|
onClick: (e) => {
|
|
25198
25212
|
e.stopPropagation();
|
|
25199
25213
|
if (disableCellSelection) return;
|
|
25200
|
-
if (!templateEditMode &&
|
|
25214
|
+
if (!templateEditMode && isSelected && selectedCells[cellIndex]?.value?.type === "L") {
|
|
25201
25215
|
return;
|
|
25202
25216
|
}
|
|
25203
25217
|
handleCellClick(record, key);
|
|
25204
25218
|
},
|
|
25205
25219
|
className: classNames(
|
|
25206
25220
|
styles$7.selectableCell,
|
|
25207
|
-
|
|
25208
|
-
|
|
25221
|
+
isSelected && styles$7.selected,
|
|
25222
|
+
isSelected && styles$7.uniformSelection
|
|
25209
25223
|
),
|
|
25210
25224
|
style: {
|
|
25211
25225
|
cursor: disableCellSelection ? "not-allowed" : void 0,
|