@omniumretail/component-library 1.3.46 → 1.3.47

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