@fluentui/react-charting 5.24.27 → 5.24.29

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.
@@ -1068,6 +1068,17 @@ var formatValue = function (value, colIndex, cells) {
1068
1068
  }
1069
1069
  return "".concat(prefix !== null && prefix !== void 0 ? prefix : '').concat(formatted).concat(suffix !== null && suffix !== void 0 ? suffix : '');
1070
1070
  };
1071
+ function resolveCellStyle(raw, rowIndex, colIndex) {
1072
+ var _a, _b;
1073
+ if (Array.isArray(raw)) {
1074
+ var rowEntry = (_a = raw[colIndex]) !== null && _a !== void 0 ? _a : raw[0];
1075
+ if (Array.isArray(rowEntry)) {
1076
+ return (_b = rowEntry[rowIndex]) !== null && _b !== void 0 ? _b : rowEntry[0];
1077
+ }
1078
+ return rowEntry;
1079
+ }
1080
+ return raw;
1081
+ }
1071
1082
  export var transformPlotlyJsonToChartTableProps = function (input, isMultiPlot, colorMap, colorwayType, isDarkTheme) {
1072
1083
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
1073
1084
  var tableData = input.data[0];
@@ -1081,41 +1092,13 @@ export var transformPlotlyJsonToChartTableProps = function (input, isMultiPlot,
1081
1092
  })
1082
1093
  : values.map(function (cell) { return cleanText(cell); });
1083
1094
  return cleanedValues.map(function (value, colIndex) {
1084
- var _a, _b, _c, _d, _e, _f, _g, _h;
1085
- var fontColorRaw = (_a = header === null || header === void 0 ? void 0 : header.font) === null || _a === void 0 ? void 0 : _a.color;
1086
- var fontColor;
1087
- if (Array.isArray(fontColorRaw)) {
1088
- var colorEntry = (_b = fontColorRaw[colIndex]) !== null && _b !== void 0 ? _b : fontColorRaw[0];
1089
- if (Array.isArray(colorEntry)) {
1090
- fontColor = typeof colorEntry[0] === 'string' ? colorEntry[0] : undefined;
1091
- }
1092
- else if (typeof colorEntry === 'string') {
1093
- fontColor = colorEntry;
1094
- }
1095
- }
1096
- else if (typeof fontColorRaw === 'string') {
1097
- fontColor = fontColorRaw;
1098
- }
1099
- var fontSizeRaw = (_c = header === null || header === void 0 ? void 0 : header.font) === null || _c === void 0 ? void 0 : _c.size;
1100
- var fontSize;
1101
- if (Array.isArray(fontSizeRaw)) {
1102
- var fontSizeEntry = (_d = fontSizeRaw[colIndex]) !== null && _d !== void 0 ? _d : fontSizeRaw[0];
1103
- fontSize = Array.isArray(fontSizeRaw[0])
1104
- ? (_e = fontSizeRaw[0][colIndex]) !== null && _e !== void 0 ? _e : fontSizeRaw[0][0]
1105
- : typeof fontSizeEntry === 'number'
1106
- ? fontSizeEntry
1107
- : undefined;
1108
- }
1109
- else if (typeof fontSizeRaw === 'number') {
1110
- fontSize = fontSizeRaw;
1111
- }
1112
- var updatedColIndex = colIndex >= 1 ? 1 : 0;
1113
- var fillColorRaw = (_f = header === null || header === void 0 ? void 0 : header.fill) === null || _f === void 0 ? void 0 : _f.color;
1114
- var backgroundColor = Array.isArray(fillColorRaw)
1115
- ? (_g = fillColorRaw[updatedColIndex]) !== null && _g !== void 0 ? _g : fillColorRaw[0]
1116
- : fillColorRaw;
1117
- var textAlignRaw = header === null || header === void 0 ? void 0 : header.align;
1118
- var textAlign = Array.isArray(textAlignRaw) ? (_h = textAlignRaw[colIndex]) !== null && _h !== void 0 ? _h : textAlignRaw[0] : textAlignRaw;
1095
+ var _a, _b, _c;
1096
+ //headers are at first row only
1097
+ var rowIndex = 0;
1098
+ var fontColor = resolveCellStyle((_a = header === null || header === void 0 ? void 0 : header.font) === null || _a === void 0 ? void 0 : _a.color, rowIndex, colIndex);
1099
+ var fontSize = resolveCellStyle((_b = header === null || header === void 0 ? void 0 : header.font) === null || _b === void 0 ? void 0 : _b.size, rowIndex, colIndex);
1100
+ var backgroundColor = resolveCellStyle((_c = header === null || header === void 0 ? void 0 : header.fill) === null || _c === void 0 ? void 0 : _c.color, rowIndex, colIndex);
1101
+ var textAlign = resolveCellStyle(header === null || header === void 0 ? void 0 : header.align, rowIndex, colIndex);
1119
1102
  var style = __assign(__assign(__assign(__assign({}, (typeof fontColor === 'string' ? { color: fontColor } : {})), (typeof fontSize === 'number' ? { fontSize: fontSize } : {})), (typeof backgroundColor === 'string' ? { backgroundColor: backgroundColor } : {})), (textAlign ? { textAlign: textAlign } : {}));
1120
1103
  return { value: value, style: style };
1121
1104
  });
@@ -1126,45 +1109,16 @@ export var transformPlotlyJsonToChartTableProps = function (input, isMultiPlot,
1126
1109
  : (_g = (_f = (_e = (_d = (_c = input.layout) === null || _c === void 0 ? void 0 : _c.template) === null || _d === void 0 ? void 0 : _d.data) === null || _e === void 0 ? void 0 : _e.table) === null || _f === void 0 ? void 0 : _f[0]) === null || _g === void 0 ? void 0 : _g.cells;
1127
1110
  var rows = columns[0].map(function (_, rowIndex) {
1128
1111
  return columns.map(function (col, colIndex) {
1129
- var _a, _b, _c, _d, _e, _f, _g;
1112
+ var _a, _b, _c;
1130
1113
  var cellValue = col[rowIndex];
1131
1114
  var cleanValue = typeof cellValue === 'string' ? cleanText(cellValue) : cellValue;
1132
1115
  var formattedValue = typeof cleanValue === 'string' || typeof cleanValue === 'number'
1133
1116
  ? formatValue(cleanValue, colIndex, cells)
1134
1117
  : cleanValue;
1135
- var rawFontColor = (_a = cells === null || cells === void 0 ? void 0 : cells.font) === null || _a === void 0 ? void 0 : _a.color;
1136
- var fontColor;
1137
- if (Array.isArray(rawFontColor)) {
1138
- var entry = (_b = rawFontColor[colIndex]) !== null && _b !== void 0 ? _b : rawFontColor[0];
1139
- var colorValue = Array.isArray(entry) ? entry[rowIndex] : entry;
1140
- fontColor = typeof colorValue === 'string' ? colorValue : undefined;
1141
- }
1142
- else if (typeof rawFontColor === 'string') {
1143
- fontColor = rawFontColor;
1144
- }
1145
- var rawFontSize = (_c = cells === null || cells === void 0 ? void 0 : cells.font) === null || _c === void 0 ? void 0 : _c.size;
1146
- var fontSize;
1147
- if (Array.isArray(rawFontSize)) {
1148
- var entry = (_d = rawFontSize[colIndex]) !== null && _d !== void 0 ? _d : rawFontSize[0];
1149
- var fontSizeValue = Array.isArray(entry) ? entry[rowIndex] : entry;
1150
- fontSize = typeof fontSizeValue === 'number' ? fontSizeValue : undefined;
1151
- }
1152
- else if (typeof rawFontSize === 'number') {
1153
- fontSize = rawFontSize;
1154
- }
1155
- var updatedColIndex = colIndex >= 1 ? 1 : 0;
1156
- var rawBackgroundColor = (_e = cells === null || cells === void 0 ? void 0 : cells.fill) === null || _e === void 0 ? void 0 : _e.color;
1157
- var backgroundColor;
1158
- if (Array.isArray(rawBackgroundColor)) {
1159
- var entry = (_f = rawBackgroundColor[updatedColIndex]) !== null && _f !== void 0 ? _f : rawBackgroundColor[0];
1160
- var colorValue = Array.isArray(entry) ? entry[rowIndex] : entry;
1161
- backgroundColor = typeof colorValue === 'string' ? colorValue : undefined;
1162
- }
1163
- else if (typeof rawBackgroundColor === 'string') {
1164
- backgroundColor = rawBackgroundColor;
1165
- }
1166
- var rawTextAlign = Array.isArray(cells === null || cells === void 0 ? void 0 : cells.align) ? (_g = cells.align[colIndex]) !== null && _g !== void 0 ? _g : cells.align[0] : cells === null || cells === void 0 ? void 0 : cells.align;
1167
- var textAlign = rawTextAlign;
1118
+ var fontColor = resolveCellStyle((_a = cells === null || cells === void 0 ? void 0 : cells.font) === null || _a === void 0 ? void 0 : _a.color, rowIndex, colIndex);
1119
+ var fontSize = resolveCellStyle((_b = cells === null || cells === void 0 ? void 0 : cells.font) === null || _b === void 0 ? void 0 : _b.size, rowIndex, colIndex);
1120
+ var backgroundColor = resolveCellStyle((_c = cells === null || cells === void 0 ? void 0 : cells.fill) === null || _c === void 0 ? void 0 : _c.color, rowIndex, colIndex);
1121
+ var textAlign = resolveCellStyle(cells === null || cells === void 0 ? void 0 : cells.align, rowIndex, colIndex);
1168
1122
  var style = __assign(__assign(__assign(__assign({}, (fontColor ? { color: fontColor } : {})), (typeof fontSize === 'number' ? { fontSize: fontSize } : {})), (backgroundColor ? { backgroundColor: backgroundColor } : {})), (textAlign ? { textAlign: textAlign } : {}));
1169
1123
  return {
1170
1124
  value: formattedValue,