@smartnet360/svelte-components 0.0.45 → 0.0.46

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.
@@ -133,13 +133,14 @@
133
133
 
134
134
  // Expand layout based on selected cells and chosen base layout
135
135
  let chartLayout = $derived.by(() => {
136
+ // Pass cellStyling - helper will decide per-section whether to use it
136
137
  const expanded = expandLayoutForCells(selectedBaseLayout, filteredData, cellStyling);
137
138
  log('📐 Chart Layout:', {
138
139
  layoutName: selectedBaseLayout.layoutName,
140
+ layoutDefaultColors: selectedBaseLayout.useDefaultChartColors ?? false,
139
141
  sectionsCount: expanded.sections.length,
140
142
  totalCharts: expanded.sections.reduce((sum, s) => sum + s.charts.length, 0),
141
- firstSection: expanded.sections[0],
142
- cellStylingEnabled: !!cellStyling
143
+ firstSection: expanded.sections[0]
143
144
  });
144
145
  return expanded;
145
146
  });
@@ -24,14 +24,23 @@ export function expandLayoutForCells(baseLayout, data, stylingConfig) {
24
24
  hoverMode: baseLayout.hoverMode, // Preserve hover mode from base layout
25
25
  coloredHover: baseLayout.coloredHover, // Preserve colored hover setting
26
26
  movingAverage: baseLayout.movingAverage, // Preserve moving average config
27
- sections: baseLayout.sections.map((section) => ({
28
- ...section,
29
- charts: section.charts.map((chart) => ({
30
- ...chart,
31
- yLeft: expandKPIs(chart.yLeft, cells, stylingConfig),
32
- yRight: expandKPIs(chart.yRight, cells, stylingConfig)
33
- }))
34
- }))
27
+ useDefaultChartColors: baseLayout.useDefaultChartColors, // Preserve layout-level default
28
+ sections: baseLayout.sections.map((section) => {
29
+ // Check per-section flag with fallback to layout-level, defaulting to false
30
+ const useDefaults = section.useDefaultChartColors ??
31
+ baseLayout.useDefaultChartColors ??
32
+ false;
33
+ // Decide styling for THIS section
34
+ const effectiveStyling = useDefaults ? undefined : stylingConfig;
35
+ return {
36
+ ...section,
37
+ charts: section.charts.map((chart) => ({
38
+ ...chart,
39
+ yLeft: expandKPIs(chart.yLeft, cells, effectiveStyling),
40
+ yRight: expandKPIs(chart.yRight, cells, effectiveStyling)
41
+ }))
42
+ };
43
+ })
35
44
  };
36
45
  return expandedLayout;
37
46
  }
@@ -33,6 +33,7 @@ export interface Section {
33
33
  charts: Chart[];
34
34
  grid?: ChartGrid;
35
35
  movingAverage?: MovingAverageConfig;
36
+ useDefaultChartColors?: boolean;
36
37
  }
37
38
  export type Mode = "tabs" | "scrollspy";
38
39
  export type HoverMode = 'x' | 'y' | 'closest' | 'x unified' | 'y unified' | false;
@@ -42,6 +43,7 @@ export interface Layout {
42
43
  movingAverage?: MovingAverageConfig;
43
44
  hoverMode?: HoverMode;
44
45
  coloredHover?: boolean;
46
+ useDefaultChartColors?: boolean;
45
47
  }
46
48
  export interface ChartMarker {
47
49
  date: string | Date;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smartnet360/svelte-components",
3
- "version": "0.0.45",
3
+ "version": "0.0.46",
4
4
  "scripts": {
5
5
  "dev": "vite dev",
6
6
  "build": "vite build && npm run prepack",