@smartnet360/svelte-components 0.0.46 → 0.0.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.
@@ -46,20 +46,31 @@ export function expandLayoutForCells(baseLayout, data, stylingConfig) {
46
46
  }
47
47
  /**
48
48
  * Expand a single KPI into multiple KPIs (one per cell)
49
- * Now uses createStyledKPI to apply band colors and sector line styles
49
+ * If stylingConfig is provided: creates styled KPIs with band colors and sector line styles
50
+ * If stylingConfig is undefined: returns base KPIs as-is for Chart component default behavior
50
51
  *
51
52
  * @param baseKPIs - Array of base KPIs from layout
52
53
  * @param cells - Array of [cellName, record] tuples
53
54
  * @param stylingConfig - Optional cell styling configuration
54
- * @returns Expanded array of KPIs with cell-specific styling
55
+ * @returns Expanded array of KPIs (styled or default)
55
56
  */
56
57
  function expandKPIs(baseKPIs, cells, stylingConfig) {
57
58
  const expandedKPIs = [];
58
59
  baseKPIs.forEach((baseKPI) => {
59
60
  cells.forEach(([cellName, record]) => {
60
- // Use createStyledKPI to apply band color and sector line style
61
- const styledKPI = createStyledKPI(baseKPI.rawName, record, baseKPI.unit, stylingConfig);
62
- expandedKPIs.push(styledKPI);
61
+ if (stylingConfig) {
62
+ // Apply custom styling (band colors, sector line styles)
63
+ const styledKPI = createStyledKPI(baseKPI.rawName, record, baseKPI.unit, stylingConfig);
64
+ expandedKPIs.push(styledKPI);
65
+ }
66
+ else {
67
+ // Use Chart component default behavior: keep base KPI name
68
+ // Just update rawName to reference the pivoted column
69
+ expandedKPIs.push({
70
+ ...baseKPI,
71
+ rawName: `${baseKPI.rawName}_${cellName}`
72
+ });
73
+ }
63
74
  });
64
75
  });
65
76
  return expandedKPIs;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smartnet360/svelte-components",
3
- "version": "0.0.46",
3
+ "version": "0.0.47",
4
4
  "scripts": {
5
5
  "dev": "vite dev",
6
6
  "build": "vite build && npm run prepack",