@omniumretail/component-library 1.3.47 → 1.3.49

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,73 @@ 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
+ if (originalCellContent?.secondaryType) {
25202
25231
  return /* @__PURE__ */ jsx(
25203
25232
  Tag,
25204
25233
  {
25205
- color: type?.color,
25234
+ color: originalCellContent.secondaryColor,
25206
25235
  style: { margin: -4, cursor: "not-allowed" },
25207
- children: type?.type
25236
+ children: originalCellContent.secondaryType
25208
25237
  }
25209
25238
  );
25210
25239
  }
25211
- if (isSelected && selectedCells[cellIndex]?.value?.type === null && hasF) {
25240
+ const fWasRemoved = isSelected && selectedCells[cellIndex]?.value?.type === null && originalCellContent?.type === "F";
25241
+ if (fWasRemoved) {
25212
25242
  return null;
25213
25243
  }
25214
- const fFromSelection = isSelected && selectedCells[cellIndex]?.value?.type === "F";
25215
- if (fFromSelection || hasF) {
25216
- if (hasS || hasD) {
25244
+ if (isSelected && selectedCells[cellIndex]?.value?.type === "F") {
25245
+ if (originalCellContent?.type === "S" || originalCellContent?.type === "D") {
25217
25246
  return null;
25218
25247
  }
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" });
25248
+ return /* @__PURE__ */ jsx(
25249
+ Tag,
25250
+ {
25251
+ color: selectedCells[cellIndex].value.color,
25252
+ style: { margin: -4, cursor: "pointer" },
25253
+ children: "F"
25254
+ }
25255
+ );
25256
+ }
25257
+ if (originalCellContent?.type) {
25258
+ return /* @__PURE__ */ jsx(
25259
+ Tag,
25260
+ {
25261
+ color: originalCellContent.color,
25262
+ style: { margin: -4, cursor: "pointer" },
25263
+ children: originalCellContent.type
25264
+ }
25265
+ );
25221
25266
  }
25222
25267
  return null;
25223
25268
  }
25224
25269
  if (templateEditMode) {
25225
- const wasRemoved = isSelected && selectedCells[cellIndex]?.value?.type === null && (hasI || hasL);
25270
+ const wasRemoved = isSelected && selectedCells[cellIndex]?.value?.type === null && (originalCellContent?.type === "I" || originalCellContent?.type === "L");
25226
25271
  if (wasRemoved) {
25272
+ if (originalCellContent?.type === "S" || originalCellContent?.type === "D" || originalCellContent?.type === "F") {
25273
+ return /* @__PURE__ */ jsx(
25274
+ Tag,
25275
+ {
25276
+ color: originalCellContent.color,
25277
+ style: { margin: -4, cursor: "pointer" },
25278
+ children: originalCellContent.type
25279
+ }
25280
+ );
25281
+ }
25227
25282
  return null;
25228
25283
  }
25229
25284
  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 });
25285
+ const selectedCell = selectedCells[cellIndex];
25286
+ return /* @__PURE__ */ jsx(Tag, { color: selectedCell.value.color, style: { margin: -4, cursor: "pointer" }, children: selectedCell.value.type });
25231
25287
  }
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 });
25288
+ if (originalCellContent?.type) {
25289
+ return /* @__PURE__ */ jsx(
25290
+ Tag,
25291
+ {
25292
+ color: originalCellContent.color,
25293
+ style: { margin: -4, cursor: "pointer" },
25294
+ children: originalCellContent.type
25295
+ }
25296
+ );
25235
25297
  }
25236
25298
  return null;
25237
25299
  }
@@ -25239,11 +25301,17 @@ const ResponsiveTable = (props) => {
25239
25301
  const selectedCell = selectedCells[cellIndex];
25240
25302
  const cellColor = selectedCell?.value?.color || selectedCellColor;
25241
25303
  const cellType = selectedCell?.value?.type || "X";
25242
- return /* @__PURE__ */ jsx(Tag, { color: cellColor, style: { margin: -4, cursor: "pointer" }, children: cellType });
25304
+ return /* @__PURE__ */ jsx(
25305
+ Tag,
25306
+ {
25307
+ color: cellColor,
25308
+ style: { margin: -4, cursor: "pointer" },
25309
+ children: cellType
25310
+ }
25311
+ );
25243
25312
  }
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 });
25313
+ if (originalCellContent?.type) {
25314
+ return /* @__PURE__ */ jsx(Tag, { color: originalCellContent.color, style: { margin: -4, cursor: "pointer" }, children: originalCellContent.type });
25247
25315
  }
25248
25316
  return null;
25249
25317
  })();
@@ -25264,7 +25332,7 @@ const ResponsiveTable = (props) => {
25264
25332
  isSelected && styles$7.uniformSelection
25265
25333
  ),
25266
25334
  style: {
25267
- cursor: disableCellSelection ? "not-allowed" : "pointer",
25335
+ cursor: disableCellSelection ? "not-allowed" : void 0,
25268
25336
  backgroundColor: cellBackgroundColor,
25269
25337
  padding: cellBackgroundColor ? "4px" : void 0
25270
25338
  },