@omniumretail/component-library 1.3.47 → 1.3.48

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.
@@ -25151,32 +25151,62 @@ const ResponsiveTable = (props) => {
25151
25151
  if (!useOrderedCellSelection) {
25152
25152
  const isDisabled = originalCellContent?.disabled === true;
25153
25153
  const isReadonly = originalCellContent?.readonly === true;
25154
- const allTypes = originalCellContent?.types || [];
25155
- const hasS = allTypes.some((t22) => t22.type === "S");
25156
- const hasD = allTypes.some((t22) => t22.type === "D");
25157
- const hasF = allTypes.some((t22) => t22.type === "F");
25158
- const hasI = allTypes.some((t22) => t22.type === "I");
25159
- const hasL = allTypes.some((t22) => t22.type === "L");
25160
- const getType = (typeChar) => allTypes.find((t22) => t22.type === typeChar);
25154
+ const hasBackendSD = originalCellContent?.type === "S" || originalCellContent?.type === "D";
25155
+ let hasBackendBackground;
25156
+ if (calendarMode) {
25157
+ hasBackendBackground = hasBackendSD;
25158
+ } else {
25159
+ hasBackendBackground = hasBackendSD || originalCellContent?.type === "F";
25160
+ }
25161
+ !calendarMode && templateEditMode && originalCellContent?.type === "F" || !templateEditMode && !calendarMode && (originalCellContent?.type === "I" || originalCellContent?.type === "L");
25162
+ const getTopLayerContent = () => {
25163
+ if (isSelected) {
25164
+ const selectedCell = selectedCells[cellIndex];
25165
+ const cellType = selectedCell?.value?.type;
25166
+ return {
25167
+ type: cellType,
25168
+ color: selectedCell?.value?.color,
25169
+ isFromSelection: true
25170
+ };
25171
+ }
25172
+ if (originalCellContent?.type && !hasBackendBackground) {
25173
+ return {
25174
+ type: originalCellContent.type,
25175
+ color: originalCellContent.color,
25176
+ isFromSelection: false
25177
+ };
25178
+ }
25179
+ return null;
25180
+ };
25181
+ getTopLayerContent();
25161
25182
  const getBackgroundColor = () => {
25162
- if (isSelected && selectedCells[cellIndex]?.value?.type === null && hasF) {
25163
- if (hasD) return getType("D")?.color;
25164
- if (hasS) return getType("S")?.color;
25183
+ if (isSelected && selectedCells[cellIndex]?.value?.type === null && originalCellContent?.type === "F") {
25184
+ if (originalCellContent?.type === "D") {
25185
+ return void 0;
25186
+ }
25165
25187
  return void 0;
25166
25188
  }
25167
- if (isSelected && selectedCells[cellIndex]?.value?.type === "F") {
25168
- return selectedCells[cellIndex].value.color;
25189
+ if (isSelected) {
25190
+ const selectedCell = selectedCells[cellIndex];
25191
+ if (selectedCell?.value?.type === "F") {
25192
+ return selectedCell.value.color;
25193
+ }
25194
+ }
25195
+ if (originalCellContent?.type === "F") {
25196
+ return originalCellContent.color;
25197
+ }
25198
+ if (originalCellContent?.type === "D") {
25199
+ return originalCellContent.color;
25200
+ }
25201
+ if (originalCellContent?.type === "S") {
25202
+ return originalCellContent.color;
25169
25203
  }
25170
- if (hasF) return getType("F")?.color;
25171
- if (hasD) return getType("D")?.color;
25172
- if (hasS) return getType("S")?.color;
25173
25204
  return void 0;
25174
25205
  };
25175
25206
  const cellBackgroundColor = getBackgroundColor();
25176
25207
  if (isDisabled) {
25177
- if (hasI || hasL || isReadonly) {
25178
- const type = hasI ? getType("I") : getType("L");
25179
- return /* @__PURE__ */ jsx(Tag, { color: type?.color, style: { margin: -4, cursor: "not-allowed" }, children: type?.type });
25208
+ if (originalCellContent?.type === "I" || originalCellContent?.type === "L" || isReadonly) {
25209
+ return /* @__PURE__ */ jsx(Tag, { color: originalCellContent.color, style: { margin: -4, cursor: "not-allowed" }, children: originalCellContent.type });
25180
25210
  } else {
25181
25211
  return /* @__PURE__ */ jsx(
25182
25212
  "div",
@@ -25197,41 +25227,70 @@ const ResponsiveTable = (props) => {
25197
25227
  if (isSelectable) {
25198
25228
  const cellContent = (() => {
25199
25229
  if (calendarMode) {
25200
- if (hasI || hasL) {
25201
- const type = hasI ? getType("I") : getType("L");
25230
+ const fWasRemoved = isSelected && selectedCells[cellIndex]?.value?.type === null && originalCellContent?.type === "F";
25231
+ if (fWasRemoved) {
25232
+ return null;
25233
+ }
25234
+ if (isSelected && selectedCells[cellIndex]?.value?.type === "F") {
25235
+ if (originalCellContent?.type === "I" || originalCellContent?.type === "L") {
25236
+ return /* @__PURE__ */ jsx(
25237
+ Tag,
25238
+ {
25239
+ color: originalCellContent.color,
25240
+ style: { margin: -4, cursor: "pointer" },
25241
+ children: originalCellContent.type
25242
+ }
25243
+ );
25244
+ }
25202
25245
  return /* @__PURE__ */ jsx(
25203
25246
  Tag,
25204
25247
  {
25205
- color: type?.color,
25206
- style: { margin: -4, cursor: "not-allowed" },
25207
- children: type?.type
25248
+ color: selectedCells[cellIndex].value.color,
25249
+ style: { margin: -4, cursor: "pointer" },
25250
+ children: "F"
25208
25251
  }
25209
25252
  );
25210
25253
  }
25211
- if (isSelected && selectedCells[cellIndex]?.value?.type === null && hasF) {
25212
- return null;
25213
- }
25214
- const fFromSelection = isSelected && selectedCells[cellIndex]?.value?.type === "F";
25215
- if (fFromSelection || hasF) {
25216
- if (hasS || hasD) {
25217
- return null;
25218
- }
25219
- const fColor = fFromSelection ? selectedCells[cellIndex].value.color : getType("F")?.color;
25220
- return /* @__PURE__ */ jsx(Tag, { color: fColor, style: { margin: -4, cursor: "pointer" }, children: "F" });
25254
+ if (originalCellContent?.type) {
25255
+ return /* @__PURE__ */ jsx(
25256
+ Tag,
25257
+ {
25258
+ color: originalCellContent.color,
25259
+ style: { margin: -4, cursor: "pointer" },
25260
+ children: originalCellContent.type
25261
+ }
25262
+ );
25221
25263
  }
25222
25264
  return null;
25223
25265
  }
25224
25266
  if (templateEditMode) {
25225
- const wasRemoved = isSelected && selectedCells[cellIndex]?.value?.type === null && (hasI || hasL);
25267
+ const wasRemoved = isSelected && selectedCells[cellIndex]?.value?.type === null && (originalCellContent?.type === "I" || originalCellContent?.type === "L");
25226
25268
  if (wasRemoved) {
25269
+ if (originalCellContent?.type === "S" || originalCellContent?.type === "D" || originalCellContent?.type === "F") {
25270
+ return /* @__PURE__ */ jsx(
25271
+ Tag,
25272
+ {
25273
+ color: originalCellContent.color,
25274
+ style: { margin: -4, cursor: "pointer" },
25275
+ children: originalCellContent.type
25276
+ }
25277
+ );
25278
+ }
25227
25279
  return null;
25228
25280
  }
25229
25281
  if (isSelected && (selectedCells[cellIndex]?.value?.type === "I" || selectedCells[cellIndex]?.value?.type === "L")) {
25230
- return /* @__PURE__ */ jsx(Tag, { color: selectedCells[cellIndex].value.color, style: { margin: -4, cursor: "pointer" }, children: selectedCells[cellIndex].value.type });
25282
+ const selectedCell = selectedCells[cellIndex];
25283
+ return /* @__PURE__ */ jsx(Tag, { color: selectedCell.value.color, style: { margin: -4, cursor: "pointer" }, children: selectedCell.value.type });
25231
25284
  }
25232
- if (hasI || hasL) {
25233
- const type = hasI ? getType("I") : getType("L");
25234
- return /* @__PURE__ */ jsx(Tag, { color: type?.color, style: { margin: -4, cursor: "pointer" }, children: type?.type });
25285
+ if (originalCellContent?.type) {
25286
+ return /* @__PURE__ */ jsx(
25287
+ Tag,
25288
+ {
25289
+ color: originalCellContent.color,
25290
+ style: { margin: -4, cursor: "pointer" },
25291
+ children: originalCellContent.type
25292
+ }
25293
+ );
25235
25294
  }
25236
25295
  return null;
25237
25296
  }
@@ -25239,11 +25298,17 @@ const ResponsiveTable = (props) => {
25239
25298
  const selectedCell = selectedCells[cellIndex];
25240
25299
  const cellColor = selectedCell?.value?.color || selectedCellColor;
25241
25300
  const cellType = selectedCell?.value?.type || "X";
25242
- return /* @__PURE__ */ jsx(Tag, { color: cellColor, style: { margin: -4, cursor: "pointer" }, children: cellType });
25301
+ return /* @__PURE__ */ jsx(
25302
+ Tag,
25303
+ {
25304
+ color: cellColor,
25305
+ style: { margin: -4, cursor: "pointer" },
25306
+ children: cellType
25307
+ }
25308
+ );
25243
25309
  }
25244
- if (allTypes.length > 0) {
25245
- const type = getType("I") || getType("L") || getType("F") || allTypes[0];
25246
- return /* @__PURE__ */ jsx(Tag, { color: type?.color, style: { margin: -4, cursor: "pointer" }, children: type?.type });
25310
+ if (originalCellContent?.type) {
25311
+ return /* @__PURE__ */ jsx(Tag, { color: originalCellContent.color, style: { margin: -4, cursor: "pointer" }, children: originalCellContent.type });
25247
25312
  }
25248
25313
  return null;
25249
25314
  })();
@@ -25264,7 +25329,7 @@ const ResponsiveTable = (props) => {
25264
25329
  isSelected && styles$7.uniformSelection
25265
25330
  ),
25266
25331
  style: {
25267
- cursor: disableCellSelection ? "not-allowed" : "pointer",
25332
+ cursor: disableCellSelection ? "not-allowed" : void 0,
25268
25333
  backgroundColor: cellBackgroundColor,
25269
25334
  padding: cellBackgroundColor ? "4px" : void 0
25270
25335
  },