@omniumretail/component-library 1.3.45 → 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,83 +25197,41 @@ const ResponsiveTable = (props) => {
25227
25197
  if (isSelectable) {
25228
25198
  const cellContent = (() => {
25229
25199
  if (calendarMode) {
25230
- if (isSelected && (selectedCells[cellIndex]?.value?.type === "I" || selectedCells[cellIndex]?.value?.type === "L")) {
25200
+ if (hasI || hasL) {
25201
+ const type = hasI ? getType("I") : getType("L");
25231
25202
  return /* @__PURE__ */ jsx(
25232
25203
  Tag,
25233
25204
  {
25234
- color: selectedCells[cellIndex].value.color,
25235
- style: { margin: -4, cursor: "pointer" },
25236
- children: selectedCells[cellIndex].value.type
25205
+ color: type?.color,
25206
+ style: { margin: -4, cursor: "not-allowed" },
25207
+ children: type?.type
25237
25208
  }
25238
25209
  );
25239
25210
  }
25240
- const fWasRemoved = isSelected && selectedCells[cellIndex]?.value?.type === null && originalCellContent?.type === "F";
25241
- if (fWasRemoved) {
25211
+ if (isSelected && selectedCells[cellIndex]?.value?.type === null && hasF) {
25242
25212
  return null;
25243
25213
  }
25244
- if (isSelected && selectedCells[cellIndex]?.value?.type === "F") {
25245
- if (originalCellContent?.type === "S" || originalCellContent?.type === "D") {
25214
+ const fFromSelection = isSelected && selectedCells[cellIndex]?.value?.type === "F";
25215
+ if (fFromSelection || hasF) {
25216
+ if (hasS || hasD) {
25246
25217
  return null;
25247
25218
  }
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 === "I" || originalCellContent?.type === "L") {
25258
- return /* @__PURE__ */ jsx(
25259
- Tag,
25260
- {
25261
- color: originalCellContent.color,
25262
- style: { margin: -4, cursor: "not-allowed" },
25263
- children: originalCellContent.type
25264
- }
25265
- );
25266
- }
25267
- if (originalCellContent?.type === "F") {
25268
- return /* @__PURE__ */ jsx(
25269
- Tag,
25270
- {
25271
- color: originalCellContent.color,
25272
- style: { margin: -4, cursor: "pointer" },
25273
- children: "F"
25274
- }
25275
- );
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" });
25276
25221
  }
25277
25222
  return null;
25278
25223
  }
25279
25224
  if (templateEditMode) {
25280
- 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);
25281
25226
  if (wasRemoved) {
25282
- if (originalCellContent?.type === "S" || originalCellContent?.type === "D" || originalCellContent?.type === "F") {
25283
- return /* @__PURE__ */ jsx(
25284
- Tag,
25285
- {
25286
- color: originalCellContent.color,
25287
- style: { margin: -4, cursor: "pointer" },
25288
- children: originalCellContent.type
25289
- }
25290
- );
25291
- }
25292
25227
  return null;
25293
25228
  }
25294
25229
  if (isSelected && (selectedCells[cellIndex]?.value?.type === "I" || selectedCells[cellIndex]?.value?.type === "L")) {
25295
- const selectedCell = selectedCells[cellIndex];
25296
- 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 });
25297
25231
  }
25298
- if (originalCellContent?.type) {
25299
- return /* @__PURE__ */ jsx(
25300
- Tag,
25301
- {
25302
- color: originalCellContent.color,
25303
- style: { margin: -4, cursor: "pointer" },
25304
- children: originalCellContent.type
25305
- }
25306
- );
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 });
25307
25235
  }
25308
25236
  return null;
25309
25237
  }
@@ -25311,17 +25239,11 @@ const ResponsiveTable = (props) => {
25311
25239
  const selectedCell = selectedCells[cellIndex];
25312
25240
  const cellColor = selectedCell?.value?.color || selectedCellColor;
25313
25241
  const cellType = selectedCell?.value?.type || "X";
25314
- return /* @__PURE__ */ jsx(
25315
- Tag,
25316
- {
25317
- color: cellColor,
25318
- style: { margin: -4, cursor: "pointer" },
25319
- children: cellType
25320
- }
25321
- );
25242
+ return /* @__PURE__ */ jsx(Tag, { color: cellColor, style: { margin: -4, cursor: "pointer" }, children: cellType });
25322
25243
  }
25323
- if (originalCellContent?.type) {
25324
- 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 });
25325
25247
  }
25326
25248
  return null;
25327
25249
  })();
@@ -25342,7 +25264,7 @@ const ResponsiveTable = (props) => {
25342
25264
  isSelected && styles$7.uniformSelection
25343
25265
  ),
25344
25266
  style: {
25345
- cursor: disableCellSelection ? "not-allowed" : void 0,
25267
+ cursor: disableCellSelection ? "not-allowed" : "pointer",
25346
25268
  backgroundColor: cellBackgroundColor,
25347
25269
  padding: cellBackgroundColor ? "4px" : void 0
25348
25270
  },