@fluentui/react-charting 5.23.95 → 5.23.97

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.
Files changed (38) hide show
  1. package/CHANGELOG.json +55 -1
  2. package/CHANGELOG.md +24 -2
  3. package/dist/react-charting.d.ts +8 -2
  4. package/dist/react-charting.js +1 -1
  5. package/dist/react-charting.min.js +1 -1
  6. package/etc/react-charting.api.md +8 -2
  7. package/lib/components/ChartTable/ChartTable.base.js +2 -2
  8. package/lib/components/ChartTable/ChartTable.base.js.map +1 -1
  9. package/lib/components/ChartTable/ChartTable.types.d.ts +9 -2
  10. package/lib/components/ChartTable/ChartTable.types.js.map +1 -1
  11. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +0 -1
  12. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +154 -35
  13. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  14. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.d.ts +1 -0
  15. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js +40 -24
  16. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js.map +1 -1
  17. package/lib-amd/components/ChartTable/ChartTable.base.js +2 -2
  18. package/lib-amd/components/ChartTable/ChartTable.base.js.map +1 -1
  19. package/lib-amd/components/ChartTable/ChartTable.types.d.ts +9 -2
  20. package/lib-amd/components/ChartTable/ChartTable.types.js.map +1 -1
  21. package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +0 -1
  22. package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js +161 -44
  23. package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  24. package/lib-amd/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.d.ts +1 -0
  25. package/lib-amd/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js +39 -24
  26. package/lib-amd/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js.map +1 -1
  27. package/lib-commonjs/components/ChartTable/ChartTable.base.js +2 -2
  28. package/lib-commonjs/components/ChartTable/ChartTable.base.js.map +1 -1
  29. package/lib-commonjs/components/ChartTable/ChartTable.types.d.ts +9 -2
  30. package/lib-commonjs/components/ChartTable/ChartTable.types.js.map +1 -1
  31. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +0 -1
  32. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +161 -43
  33. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  34. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.d.ts +1 -0
  35. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js +39 -23
  36. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js.map +1 -1
  37. package/package.json +2 -2
  38. package/src/components/ChartTable/ChartTable.types.ts +3 -2
@@ -1,7 +1,7 @@
1
- define(["require", "exports", "tslib", "d3-array", "d3-scale", "../../utilities/colors", "../GaugeChart/index", "../../utilities/utilities", "@fluentui/chart-utilities", "d3-time-format", "d3-shape", "./PlotlyColorAdapter"], function (require, exports, tslib_1, d3_array_1, d3_scale_1, colors_1, index_1, utilities_1, chart_utilities_1, d3_time_format_1, d3_shape_1, PlotlyColorAdapter_1) {
1
+ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../../utilities/colors", "../GaugeChart/index", "../../utilities/utilities", "@fluentui/chart-utilities", "d3-time-format", "d3-shape", "./PlotlyColorAdapter"], function (require, exports, tslib_1, d3_array_1, d3_scale_1, d3_format_1, colors_1, index_1, utilities_1, chart_utilities_1, d3_time_format_1, d3_shape_1, PlotlyColorAdapter_1) {
2
2
  "use strict";
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.getValidXYRanges = exports.getNumberAtIndexOrDefault = exports.isInvalidValue = exports.findArrayAttributes = exports.projectPolarToCartesian = exports.transformPlotlyJsonToChartTableProps = exports.transformPlotlyJsonToGaugeProps = exports.transformPlotlyJsonToSankeyProps = exports.transformPlotlyJsonToHeatmapProps = exports.transformPlotlyJsonToHorizontalBarWithAxisProps = exports.transformPlotlyJsonToScatterChartProps = exports.transformPlotlyJsonToVBCProps = exports.transformPlotlyJsonToGVBCProps = exports.transformPlotlyJsonToVSBCProps = exports.transformPlotlyJsonToDonutProps = exports._getGaugeAxisColor = exports.correctYearMonth = exports.isMonthArray = void 0;
4
+ exports.getValidXYRanges = exports.getNumberAtIndexOrDefault = exports.findArrayAttributes = exports.projectPolarToCartesian = exports.transformPlotlyJsonToChartTableProps = exports.transformPlotlyJsonToGaugeProps = exports.transformPlotlyJsonToSankeyProps = exports.transformPlotlyJsonToHeatmapProps = exports.transformPlotlyJsonToHorizontalBarWithAxisProps = exports.transformPlotlyJsonToScatterChartProps = exports.transformPlotlyJsonToVBCProps = exports.transformPlotlyJsonToGVBCProps = exports.transformPlotlyJsonToVSBCProps = exports.transformPlotlyJsonToDonutProps = exports._getGaugeAxisColor = exports.correctYearMonth = exports.isMonthArray = void 0;
5
5
  var dashOptions = {
6
6
  dot: {
7
7
  strokeDasharray: '1, 5',
@@ -147,14 +147,16 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "../../utilities/
147
147
  };
148
148
  exports._getGaugeAxisColor = _getGaugeAxisColor;
149
149
  var transformPlotlyJsonToDonutProps = function (input, colorMap, colorwayType, isDarkTheme) {
150
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
150
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
151
151
  var firstData = input.data[0];
152
152
  // extract colors for each series only once
153
- var colors = (0, PlotlyColorAdapter_1.extractColor)((_c = (_b = (_a = input.layout) === null || _a === void 0 ? void 0 : _a.template) === null || _b === void 0 ? void 0 : _b.layout) === null || _c === void 0 ? void 0 : _c.colorway, colorwayType, (_d = firstData === null || firstData === void 0 ? void 0 : firstData.marker) === null || _d === void 0 ? void 0 : _d.colors, colorMap, isDarkTheme);
153
+ // use piecolorway if available
154
+ // otherwise, default to colorway from template
155
+ var colors = (0, PlotlyColorAdapter_1.extractColor)((_b = (_a = input.layout) === null || _a === void 0 ? void 0 : _a.piecolorway) !== null && _b !== void 0 ? _b : (_e = (_d = (_c = input.layout) === null || _c === void 0 ? void 0 : _c.template) === null || _d === void 0 ? void 0 : _d.layout) === null || _e === void 0 ? void 0 : _e.colorway, colorwayType, (_g = (_f = input.layout) === null || _f === void 0 ? void 0 : _f.piecolorway) !== null && _g !== void 0 ? _g : (_h = firstData === null || firstData === void 0 ? void 0 : firstData.marker) === null || _h === void 0 ? void 0 : _h.colors, colorMap, isDarkTheme);
154
156
  var mapLegendToDataPoint = {};
155
- (_e = firstData.labels) === null || _e === void 0 ? void 0 : _e.forEach(function (label, index) {
157
+ (_j = firstData.labels) === null || _j === void 0 ? void 0 : _j.forEach(function (label, index) {
156
158
  var value = (0, exports.getNumberAtIndexOrDefault)(firstData.values, index);
157
- if ((0, exports.isInvalidValue)(value) || value < 0) {
159
+ if ((0, chart_utilities_1.isInvalidValue)(value) || value < 0) {
158
160
  return;
159
161
  }
160
162
  var legend = "".concat(label);
@@ -171,8 +173,8 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "../../utilities/
171
173
  mapLegendToDataPoint[legend].data += value;
172
174
  }
173
175
  });
174
- var width = (_g = (_f = input.layout) === null || _f === void 0 ? void 0 : _f.width) !== null && _g !== void 0 ? _g : 440;
175
- var height = (_j = (_h = input.layout) === null || _h === void 0 ? void 0 : _h.height) !== null && _j !== void 0 ? _j : 220;
176
+ var width = (_l = (_k = input.layout) === null || _k === void 0 ? void 0 : _k.width) !== null && _l !== void 0 ? _l : 440;
177
+ var height = (_o = (_m = input.layout) === null || _m === void 0 ? void 0 : _m.height) !== null && _o !== void 0 ? _o : 220;
176
178
  var hideLabels = firstData.textinfo
177
179
  ? !['value', 'percent', 'label+percent'].includes(firstData.textinfo)
178
180
  : false;
@@ -187,8 +189,8 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "../../utilities/
187
189
  chartTitle: chartTitle,
188
190
  chartData: Object.values(mapLegendToDataPoint),
189
191
  },
190
- hideLegend: ((_k = input.layout) === null || _k === void 0 ? void 0 : _k.showlegend) === false ? true : false,
191
- width: (_l = input.layout) === null || _l === void 0 ? void 0 : _l.width,
192
+ hideLegend: ((_p = input.layout) === null || _p === void 0 ? void 0 : _p.showlegend) === false ? true : false,
193
+ width: (_q = input.layout) === null || _q === void 0 ? void 0 : _q.width,
192
194
  height: height,
193
195
  innerRadius: innerRadius,
194
196
  hideLabels: hideLabels,
@@ -262,18 +264,41 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "../../utilities/
262
264
  return tslib_1.__assign(tslib_1.__assign({ data: Object.values(mapXToDataPoints), width: (_a = input.layout) === null || _a === void 0 ? void 0 : _a.width, height: (_c = (_b = input.layout) === null || _b === void 0 ? void 0 : _b.height) !== null && _c !== void 0 ? _c : 350, barWidth: 'auto', yMaxValue: yMaxValue, yMinValue: yMinValue, chartTitle: chartTitle, xAxisTitle: xAxisTitle, yAxisTitle: yAxisTitle, mode: 'plotly' }, secondaryYAxisValues), { hideTickOverlap: true, hideLegend: hideLegend, roundCorners: true, supportNegativeData: true, barGapMax: 2 });
263
265
  };
264
266
  exports.transformPlotlyJsonToVSBCProps = transformPlotlyJsonToVSBCProps;
267
+ var createColorScale = function (colorscale, domain) {
268
+ var dMin = domain[0], dMax = domain[1];
269
+ // Normalize colorscale domain to actual data domain
270
+ var scaleDomain = colorscale.map(function (_a) {
271
+ var pos = _a[0];
272
+ return dMin + pos * (dMax - dMin);
273
+ });
274
+ var scaleColors = colorscale.map(function (item) { return item[1]; });
275
+ return (0, d3_scale_1.scaleLinear)().domain(scaleDomain).range(scaleColors);
276
+ };
265
277
  var transformPlotlyJsonToGVBCProps = function (input, colorMap, colorwayType, isDarkTheme) {
266
278
  var _a, _b, _c;
267
279
  var mapXToDataPoints = {};
268
280
  var secondaryYAxisValues = getSecondaryYAxisValues(input.data, input.layout, 0, 0);
269
281
  var _d = getLegendProps(input.data, input.layout), legends = _d.legends, hideLegend = _d.hideLegend;
282
+ var colorScale = undefined;
270
283
  input.data.forEach(function (series, index1) {
271
- var _a, _b, _c, _d, _e;
284
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
285
+ if (((_c = (_b = (_a = input.layout) === null || _a === void 0 ? void 0 : _a.coloraxis) === null || _b === void 0 ? void 0 : _b.colorscale) === null || _c === void 0 ? void 0 : _c.length) &&
286
+ (0, chart_utilities_1.isArrayOrTypedArray)((_d = series.marker) === null || _d === void 0 ? void 0 : _d.color) &&
287
+ ((_e = series.marker) === null || _e === void 0 ? void 0 : _e.color).length > 0 &&
288
+ typeof ((_g = (_f = series.marker) === null || _f === void 0 ? void 0 : _f.color) === null || _g === void 0 ? void 0 : _g[0]) === 'number') {
289
+ var scale = input.layout.coloraxis.colorscale;
290
+ var colorValues = (_h = series.marker) === null || _h === void 0 ? void 0 : _h.color;
291
+ var _t = [
292
+ (_k = (_j = input.layout.coloraxis) === null || _j === void 0 ? void 0 : _j.cmin) !== null && _k !== void 0 ? _k : Math.min.apply(Math, colorValues),
293
+ (_m = (_l = input.layout.coloraxis) === null || _l === void 0 ? void 0 : _l.cmax) !== null && _m !== void 0 ? _m : Math.max.apply(Math, colorValues),
294
+ ], dMin = _t[0], dMax = _t[1];
295
+ colorScale = createColorScale(scale, [dMin, dMax]);
296
+ }
272
297
  // extract colors for each series only once
273
- var extractedColors = (0, PlotlyColorAdapter_1.extractColor)((_c = (_b = (_a = input.layout) === null || _a === void 0 ? void 0 : _a.template) === null || _b === void 0 ? void 0 : _b.layout) === null || _c === void 0 ? void 0 : _c.colorway, colorwayType, (_d = series.marker) === null || _d === void 0 ? void 0 : _d.color, colorMap, isDarkTheme);
274
- (_e = series.x) === null || _e === void 0 ? void 0 : _e.forEach(function (x, xIndex) {
275
- var _a;
276
- if ((0, exports.isInvalidValue)(x) || (0, exports.isInvalidValue)((_a = series.y) === null || _a === void 0 ? void 0 : _a[xIndex])) {
298
+ var extractedColors = (0, PlotlyColorAdapter_1.extractColor)((_q = (_p = (_o = input.layout) === null || _o === void 0 ? void 0 : _o.template) === null || _p === void 0 ? void 0 : _p.layout) === null || _q === void 0 ? void 0 : _q.colorway, colorwayType, (_r = series.marker) === null || _r === void 0 ? void 0 : _r.color, colorMap, isDarkTheme);
299
+ (_s = series.x) === null || _s === void 0 ? void 0 : _s.forEach(function (x, xIndex) {
300
+ var _a, _b, _c, _d;
301
+ if ((0, chart_utilities_1.isInvalidValue)(x) || (0, chart_utilities_1.isInvalidValue)((_a = series.y) === null || _a === void 0 ? void 0 : _a[xIndex])) {
277
302
  return;
278
303
  }
279
304
  if (!mapXToDataPoints[x]) {
@@ -281,8 +306,10 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "../../utilities/
281
306
  }
282
307
  if (series.type === 'bar') {
283
308
  var legend = legends[index1];
284
- // resolve color for each legend's bars from the extracted colors
285
- var color = (0, PlotlyColorAdapter_1.resolveColor)(extractedColors, index1, legend, colorMap, isDarkTheme);
309
+ // resolve color for each legend's bars from the colorscale or extracted colors
310
+ var color = colorScale
311
+ ? colorScale((0, chart_utilities_1.isArrayOrTypedArray)((_b = series.marker) === null || _b === void 0 ? void 0 : _b.color) ? (_d = (_c = series.marker) === null || _c === void 0 ? void 0 : _c.color) === null || _d === void 0 ? void 0 : _d[xIndex] : 0)
312
+ : (0, PlotlyColorAdapter_1.resolveColor)(extractedColors, index1, legend, colorMap, isDarkTheme);
286
313
  mapXToDataPoints[x].series.push({
287
314
  key: legend,
288
315
  data: series.y[xIndex],
@@ -313,7 +340,7 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "../../utilities/
313
340
  var yValues = [];
314
341
  series.x.forEach(function (xVal, index) {
315
342
  var yVal = (0, exports.getNumberAtIndexOrDefault)(series.y, index);
316
- if ((0, exports.isInvalidValue)(xVal) || (0, exports.isInvalidValue)(yVal)) {
343
+ if ((0, chart_utilities_1.isInvalidValue)(xVal) || (0, chart_utilities_1.isInvalidValue)(yVal)) {
317
344
  return;
318
345
  }
319
346
  xValues.push(xVal);
@@ -444,7 +471,7 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "../../utilities/
444
471
  return series.y
445
472
  .map(function (yValue, i) {
446
473
  var _a;
447
- if ((0, exports.isInvalidValue)((_a = series.x) === null || _a === void 0 ? void 0 : _a[i]) || (0, exports.isInvalidValue)(yValue)) {
474
+ if ((0, chart_utilities_1.isInvalidValue)((_a = series.x) === null || _a === void 0 ? void 0 : _a[i]) || (0, chart_utilities_1.isInvalidValue)(yValue)) {
448
475
  return null;
449
476
  }
450
477
  return {
@@ -502,7 +529,7 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "../../utilities/
502
529
  (_a = firstData.x) === null || _a === void 0 ? void 0 : _a.forEach(function (xVal, index) {
503
530
  var _a;
504
531
  var zVal = (0, exports.getNumberAtIndexOrDefault)(firstData.z, index);
505
- if ((0, exports.isInvalidValue)(xVal) || (0, exports.isInvalidValue)((_a = firstData.y) === null || _a === void 0 ? void 0 : _a[index]) || (0, exports.isInvalidValue)(zVal)) {
532
+ if ((0, chart_utilities_1.isInvalidValue)(xVal) || (0, chart_utilities_1.isInvalidValue)((_a = firstData.y) === null || _a === void 0 ? void 0 : _a[index]) || (0, chart_utilities_1.isInvalidValue)(zVal)) {
506
533
  return;
507
534
  }
508
535
  xValues_1.push(xVal);
@@ -626,7 +653,7 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "../../utilities/
626
653
  var validLinks = ((_a = link === null || link === void 0 ? void 0 : link.value) !== null && _a !== void 0 ? _a : [])
627
654
  .map(function (val, index) {
628
655
  var _a, _b;
629
- if ((0, exports.isInvalidValue)(val) || (0, exports.isInvalidValue)((_a = link === null || link === void 0 ? void 0 : link.source) === null || _a === void 0 ? void 0 : _a[index]) || (0, exports.isInvalidValue)((_b = link === null || link === void 0 ? void 0 : link.target) === null || _b === void 0 ? void 0 : _b[index])) {
656
+ if ((0, chart_utilities_1.isInvalidValue)(val) || (0, chart_utilities_1.isInvalidValue)((_a = link === null || link === void 0 ? void 0 : link.source) === null || _a === void 0 ? void 0 : _a[index]) || (0, chart_utilities_1.isInvalidValue)((_b = link === null || link === void 0 ? void 0 : link.target) === null || _b === void 0 ? void 0 : _b[index])) {
630
657
  return null;
631
658
  }
632
659
  return {
@@ -745,37 +772,132 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "../../utilities/
745
772
  .replace(/\$[^$]*\$/g, '$')
746
773
  .trim();
747
774
  };
775
+ var formatValue = function (value, colIndex, cells) {
776
+ if (value === null || typeof value === 'boolean') {
777
+ return value;
778
+ }
779
+ var formatStr = Array.isArray(cells.format) ? cells.format[colIndex] : cells.format;
780
+ var prefix = Array.isArray(cells.prefix) ? cells.prefix[colIndex] : cells.prefix;
781
+ var suffix = Array.isArray(cells.suffix) ? cells.suffix[colIndex] : cells.suffix;
782
+ var formatted = value;
783
+ if (typeof value === 'number') {
784
+ if (typeof formatStr === 'string') {
785
+ try {
786
+ formatted = (0, d3_format_1.format)(formatStr)(value);
787
+ }
788
+ catch (_a) {
789
+ formatted = (0, utilities_1.formatValueLimitWidth)(value);
790
+ }
791
+ }
792
+ else {
793
+ formatted = (0, utilities_1.formatValueLimitWidth)(value);
794
+ }
795
+ }
796
+ return "".concat(prefix !== null && prefix !== void 0 ? prefix : '').concat(formatted).concat(suffix !== null && suffix !== void 0 ? suffix : '');
797
+ };
748
798
  var transformPlotlyJsonToChartTableProps = function (input, colorMap, isDarkTheme) {
749
- var _a, _b, _c, _d, _e, _f, _g, _h;
799
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
750
800
  var tableData = input.data[0];
751
- var normalizeHeaders = function (values) {
752
- // Case: values is array of arrays
753
- if (Array.isArray(values[0])) {
754
- return values.map(function (row) {
801
+ var normalizeHeaders = function (values, header) {
802
+ var cleanedValues = Array.isArray(values[0])
803
+ ? values.map(function (row) {
755
804
  return row
756
805
  .map(function (cell) { return cleanText(cell); })
757
806
  .filter(Boolean)
758
807
  .join(' ');
759
- });
760
- }
761
- // Case: values is 1d array
762
- return values.map(function (cell) { return cleanText(cell); });
808
+ })
809
+ : values.map(function (cell) { return cleanText(cell); });
810
+ return cleanedValues.map(function (value, colIndex) {
811
+ var _a, _b, _c;
812
+ var fontColorRaw = (_a = header === null || header === void 0 ? void 0 : header.font) === null || _a === void 0 ? void 0 : _a.color;
813
+ var fontColor;
814
+ if (Array.isArray(fontColorRaw)) {
815
+ var colorEntry = fontColorRaw[colIndex];
816
+ if (Array.isArray(colorEntry)) {
817
+ fontColor = typeof colorEntry[0] === 'string' ? colorEntry[0] : undefined;
818
+ }
819
+ else if (typeof colorEntry === 'string') {
820
+ fontColor = colorEntry;
821
+ }
822
+ }
823
+ else if (typeof fontColorRaw === 'string') {
824
+ fontColor = fontColorRaw;
825
+ }
826
+ var fontSizeRaw = (_b = header === null || header === void 0 ? void 0 : header.font) === null || _b === void 0 ? void 0 : _b.size;
827
+ var fontSize;
828
+ if (Array.isArray(fontSizeRaw)) {
829
+ fontSize = Array.isArray(fontSizeRaw[0]) ? fontSizeRaw[0][colIndex] : fontSizeRaw[colIndex];
830
+ }
831
+ else if (typeof fontSizeRaw === 'number') {
832
+ fontSize = fontSizeRaw;
833
+ }
834
+ var updatedColIndex = colIndex >= 1 ? 1 : 0;
835
+ var fillColorRaw = (_c = header === null || header === void 0 ? void 0 : header.fill) === null || _c === void 0 ? void 0 : _c.color;
836
+ var backgroundColor = Array.isArray(fillColorRaw) ? fillColorRaw[updatedColIndex] : fillColorRaw;
837
+ var textAlignRaw = header === null || header === void 0 ? void 0 : header.align;
838
+ var textAlign = Array.isArray(textAlignRaw) ? textAlignRaw[colIndex] : textAlignRaw;
839
+ var style = tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({}, (typeof fontColor === 'string' ? { color: fontColor } : {})), (typeof fontSize === 'number' ? { fontSize: fontSize } : {})), (typeof backgroundColor === 'string' ? { backgroundColor: backgroundColor } : {})), (textAlign ? { textAlign: textAlign } : {}));
840
+ return { value: value, style: style };
841
+ });
763
842
  };
764
843
  var columns = (_b = (_a = tableData.cells) === null || _a === void 0 ? void 0 : _a.values) !== null && _b !== void 0 ? _b : [];
844
+ var cells = tableData.cells.font ? tableData.cells : (_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[0].cells;
765
845
  var rows = columns[0].map(function (_, rowIndex) {
766
- return columns.map(function (col) {
767
- var cell = col[rowIndex];
768
- return typeof cell === 'string' ? cleanText(cell) : cell;
846
+ return columns.map(function (col, colIndex) {
847
+ var _a, _b, _c;
848
+ var cellValue = col[rowIndex];
849
+ var cleanValue = typeof cellValue === 'string' ? cleanText(cellValue) : cellValue;
850
+ var formattedValue = typeof cleanValue === 'string' || typeof cleanValue === 'number'
851
+ ? formatValue(cleanValue, colIndex, cells)
852
+ : cleanValue;
853
+ var rawFontColor = (_a = cells === null || cells === void 0 ? void 0 : cells.font) === null || _a === void 0 ? void 0 : _a.color;
854
+ var fontColor;
855
+ if (Array.isArray(rawFontColor)) {
856
+ var entry = rawFontColor[colIndex];
857
+ var colorValue = Array.isArray(entry) ? entry[rowIndex] : entry;
858
+ fontColor = typeof colorValue === 'string' ? colorValue : undefined;
859
+ }
860
+ else if (typeof rawFontColor === 'string') {
861
+ fontColor = rawFontColor;
862
+ }
863
+ var rawFontSize = (_b = cells === null || cells === void 0 ? void 0 : cells.font) === null || _b === void 0 ? void 0 : _b.size;
864
+ var fontSize;
865
+ if (Array.isArray(rawFontSize)) {
866
+ var entry = rawFontSize[colIndex];
867
+ var fontSizeValue = Array.isArray(entry) ? entry[rowIndex] : entry;
868
+ fontSize = typeof fontSizeValue === 'number' ? fontSizeValue : undefined;
869
+ }
870
+ else if (typeof rawFontSize === 'number') {
871
+ fontSize = rawFontSize;
872
+ }
873
+ var updatedColIndex = colIndex >= 1 ? 1 : 0;
874
+ var rawBackgroundColor = (_c = cells === null || cells === void 0 ? void 0 : cells.fill) === null || _c === void 0 ? void 0 : _c.color;
875
+ var backgroundColor;
876
+ if (Array.isArray(rawBackgroundColor)) {
877
+ var entry = rawBackgroundColor[updatedColIndex];
878
+ var colorValue = Array.isArray(entry) ? entry[rowIndex] : entry;
879
+ backgroundColor = typeof colorValue === 'string' ? colorValue : undefined;
880
+ }
881
+ else if (typeof rawBackgroundColor === 'string') {
882
+ backgroundColor = rawBackgroundColor;
883
+ }
884
+ var rawTextAlign = Array.isArray(cells === null || cells === void 0 ? void 0 : cells.align) ? cells.align[colIndex] : cells === null || cells === void 0 ? void 0 : cells.align;
885
+ var textAlign = rawTextAlign;
886
+ var style = tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({}, (fontColor ? { color: fontColor } : {})), (typeof fontSize === 'number' ? { fontSize: fontSize } : {})), (backgroundColor ? { backgroundColor: backgroundColor } : {})), (textAlign ? { textAlign: textAlign } : {}));
887
+ return {
888
+ value: formattedValue,
889
+ style: style,
890
+ };
769
891
  });
770
892
  });
771
893
  var styles = {
772
- root: tslib_1.__assign({}, (((_d = (_c = input.layout) === null || _c === void 0 ? void 0 : _c.font) === null || _d === void 0 ? void 0 : _d.size) ? { fontSize: input.layout.font.size } : {})),
894
+ root: tslib_1.__assign({}, (((_g = (_f = input.layout) === null || _f === void 0 ? void 0 : _f.font) === null || _g === void 0 ? void 0 : _g.size) ? { fontSize: input.layout.font.size } : {})),
773
895
  };
774
896
  return {
775
- headers: normalizeHeaders((_f = (_e = tableData.header) === null || _e === void 0 ? void 0 : _e.values) !== null && _f !== void 0 ? _f : []),
897
+ headers: normalizeHeaders((_j = (_h = tableData.header) === null || _h === void 0 ? void 0 : _h.values) !== null && _j !== void 0 ? _j : [], ((_k = tableData.header) === null || _k === void 0 ? void 0 : _k.font) ? tableData.header : (_o = (_m = (_l = input.layout) === null || _l === void 0 ? void 0 : _l.template) === null || _m === void 0 ? void 0 : _m.data) === null || _o === void 0 ? void 0 : _o.table[0].header),
776
898
  rows: rows,
777
- width: (_g = input.layout) === null || _g === void 0 ? void 0 : _g.width,
778
- height: (_h = input.layout) === null || _h === void 0 ? void 0 : _h.height,
899
+ width: (_p = input.layout) === null || _p === void 0 ? void 0 : _p.width,
900
+ height: (_q = input.layout) === null || _q === void 0 ? void 0 : _q.height,
779
901
  styles: styles,
780
902
  };
781
903
  };
@@ -788,7 +910,7 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "../../utilities/
788
910
  series.x = [];
789
911
  series.y = [];
790
912
  for (var ptindex = 0; ptindex < ((_b = (_a = series.r) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0); ptindex++) {
791
- if ((0, exports.isInvalidValue)((_c = series.theta) === null || _c === void 0 ? void 0 : _c[ptindex]) || (0, exports.isInvalidValue)((_d = series.r) === null || _d === void 0 ? void 0 : _d[ptindex])) {
913
+ if ((0, chart_utilities_1.isInvalidValue)((_c = series.theta) === null || _c === void 0 ? void 0 : _c[ptindex]) || (0, chart_utilities_1.isInvalidValue)((_d = series.r) === null || _d === void 0 ? void 0 : _d[ptindex])) {
792
914
  continue;
793
915
  }
794
916
  var thetaRad = (series.theta[ptindex] * Math.PI) / 180;
@@ -994,11 +1116,6 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "../../utilities/
994
1116
  hideLegend: (layout === null || layout === void 0 ? void 0 : layout.showlegend) === false || ((layout === null || layout === void 0 ? void 0 : layout.showlegend) !== true && legends.length < 2) ? true : hideLegends,
995
1117
  };
996
1118
  };
997
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
998
- var isInvalidValue = function (value) {
999
- return typeof value === 'undefined' || value === null || (typeof value === 'number' && !isFinite(value));
1000
- };
1001
- exports.isInvalidValue = isInvalidValue;
1002
1119
  var getNumberAtIndexOrDefault = function (data, index) {
1003
1120
  if ((0, chart_utilities_1.isArrayOrTypedArray)(data)) {
1004
1121
  if (typeof data[index] !== 'number' || !isFinite(data[index])) {
@@ -1017,7 +1134,7 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "../../utilities/
1017
1134
  var start = 0;
1018
1135
  var end = 0;
1019
1136
  for (; end < series.x.length; end++) {
1020
- if ((0, exports.isInvalidValue)(series.x[end]) || (0, exports.isInvalidValue)(series.y[end])) {
1137
+ if ((0, chart_utilities_1.isInvalidValue)(series.x[end]) || (0, chart_utilities_1.isInvalidValue)(series.y[end])) {
1021
1138
  if (end - start > 0) {
1022
1139
  ranges.push([start, end]);
1023
1140
  }