@omniumretail/component-library 1.3.34 → 1.3.36
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,43 +24894,15 @@ const ResponsiveTable = (props) => {
|
|
|
24894
24894
|
if (disableCellSelection) return;
|
|
24895
24895
|
const rowKey = record[rowKeyValue];
|
|
24896
24896
|
const originalCellContent = record[columnKey];
|
|
24897
|
-
|
|
24897
|
+
const cellIndex = selectedCells.findIndex(
|
|
24898
|
+
(cell) => cell.rowKey === rowKey && cell.columnKey === columnKey
|
|
24899
|
+
);
|
|
24900
|
+
const hasSelectionOnTop = cellIndex >= 0;
|
|
24901
|
+
if (templateEditMode && !hasSelectionOnTop && originalCellContent?.type && (originalCellContent.type === "S" || originalCellContent.type === "D")) {
|
|
24898
24902
|
return;
|
|
24899
24903
|
}
|
|
24900
|
-
if (useOrderedCellSelection)
|
|
24901
|
-
|
|
24902
|
-
(cell) => cell.rowKey === rowKey && cell.columnKey === columnKey
|
|
24903
|
-
);
|
|
24904
|
-
let newSelectedCells;
|
|
24905
|
-
if (isAlreadySelected) {
|
|
24906
|
-
newSelectedCells = selectedCells.filter(
|
|
24907
|
-
(cell) => !(cell.rowKey === rowKey && cell.columnKey === columnKey)
|
|
24908
|
-
);
|
|
24909
|
-
} else {
|
|
24910
|
-
const cellData = {
|
|
24911
|
-
rowKey,
|
|
24912
|
-
columnKey,
|
|
24913
|
-
value: {
|
|
24914
|
-
type: "X",
|
|
24915
|
-
color: selectedCellColor || "grey"
|
|
24916
|
-
},
|
|
24917
|
-
rowData: record
|
|
24918
|
-
};
|
|
24919
|
-
const maxSelection = maxCellSelection || 2;
|
|
24920
|
-
if (cellSelectionMode === "single") {
|
|
24921
|
-
newSelectedCells = [cellData];
|
|
24922
|
-
} else if (selectedCells.length >= maxSelection) {
|
|
24923
|
-
newSelectedCells = [...selectedCells.slice(1), cellData];
|
|
24924
|
-
} else {
|
|
24925
|
-
newSelectedCells = [...selectedCells, cellData];
|
|
24926
|
-
}
|
|
24927
|
-
}
|
|
24928
|
-
setSelectedCells(newSelectedCells);
|
|
24929
|
-
onCellsSelected?.(newSelectedCells);
|
|
24930
|
-
} else {
|
|
24931
|
-
const cellIndex = selectedCells.findIndex(
|
|
24932
|
-
(cell) => cell.rowKey === rowKey && cell.columnKey === columnKey
|
|
24933
|
-
);
|
|
24904
|
+
if (useOrderedCellSelection) ;
|
|
24905
|
+
else {
|
|
24934
24906
|
let newSelectedCells;
|
|
24935
24907
|
if (cellIndex >= 0) {
|
|
24936
24908
|
newSelectedCells = selectedCells.filter((_, index) => index !== cellIndex);
|
|
@@ -25082,10 +25054,11 @@ const ResponsiveTable = (props) => {
|
|
|
25082
25054
|
const originalCellContent2 = record[key];
|
|
25083
25055
|
const isDisabled = originalCellContent2?.disabled === true;
|
|
25084
25056
|
const isReadonly = originalCellContent2?.readonly === true;
|
|
25085
|
-
const isFixedTemplate = templateEditMode && originalCellContent2?.type && (originalCellContent2.type === "S" || originalCellContent2.type === "D");
|
|
25086
25057
|
const cellIndex2 = selectedCells.findIndex(
|
|
25087
25058
|
(cell) => cell.rowKey === record[rowKeyValue] && cell.columnKey === key
|
|
25088
25059
|
);
|
|
25060
|
+
const isSelected2 = cellIndex2 !== -1;
|
|
25061
|
+
const isFixedTemplate = templateEditMode && originalCellContent2?.type && (originalCellContent2.type === "S" || originalCellContent2.type === "D") && !isSelected2;
|
|
25089
25062
|
const getBackgroundColor = () => {
|
|
25090
25063
|
if (templateEditMode && isSelected2) {
|
|
25091
25064
|
const selectedCell = selectedCells[cellIndex2];
|
|
@@ -25095,8 +25068,10 @@ const ResponsiveTable = (props) => {
|
|
|
25095
25068
|
}
|
|
25096
25069
|
return void 0;
|
|
25097
25070
|
}
|
|
25098
|
-
if (templateEditMode && !isSelected2) {
|
|
25099
|
-
return
|
|
25071
|
+
if (templateEditMode && !isSelected2 && originalCellContent2?.type) {
|
|
25072
|
+
if (originalCellContent2.type === "F") return originalCellContent2.color;
|
|
25073
|
+
if (originalCellContent2.type === "S") return originalCellContent2.color;
|
|
25074
|
+
if (originalCellContent2.type === "D") return originalCellContent2.color;
|
|
25100
25075
|
}
|
|
25101
25076
|
if (!templateEditMode && originalCellContent2?.type) {
|
|
25102
25077
|
if (originalCellContent2.type === "F") return originalCellContent2.color;
|
|
@@ -25106,7 +25081,6 @@ const ResponsiveTable = (props) => {
|
|
|
25106
25081
|
return void 0;
|
|
25107
25082
|
};
|
|
25108
25083
|
const cellBackgroundColor = getBackgroundColor();
|
|
25109
|
-
const isSelected2 = cellIndex2 !== -1;
|
|
25110
25084
|
if (isDisabled) {
|
|
25111
25085
|
if (originalCellContent2?.type === "I" || originalCellContent2?.type === "L" || isReadonly) {
|
|
25112
25086
|
return /* @__PURE__ */ jsx(Tag, { color: originalCellContent2.color, style: { margin: -4, cursor: "not-allowed" }, children: originalCellContent2.type });
|