@ironsource/shared-ui 2.1.12-rc.16 → 2.1.12-rc.17

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 (46) hide show
  1. package/Chart.vue_vue_type_style_index_0_scoped_82f5b24e_lang.css +1 -0
  2. package/ChartHeader.vue_vue_type_style_index_0_scoped_da34b108_lang.css +1 -0
  3. package/ChartHeaderTrend.vue_vue_type_style_index_0_scoped_79dc2883_lang.css +1 -0
  4. package/ChartPlane.vue_vue_type_style_index_0_scoped_5c80d8cd_lang.css +1 -0
  5. package/ChartTooltip.vue_vue_type_style_index_0_scoped_9e521454_lang.css +1 -0
  6. package/SubHeader.vue_vue_type_style_index_0_scoped_e6008b6c_lang.css +1 -0
  7. package/TooltipHeader.vue_vue_type_style_index_0_scoped_9f6cf389_lang.css +1 -0
  8. package/components/chart/Chart.vue.d.ts +16 -6
  9. package/components/chart/Chart.vue.js +5 -5
  10. package/components/chart/Chart.vue2.js +76 -72
  11. package/components/chart/ChartHeader.vue.d.ts +7 -7
  12. package/components/chart/ChartHeader.vue.js +3 -3
  13. package/components/chart/ChartHeader.vue2.js +48 -79
  14. package/components/chart/ChartHeaderTrend.vue.d.ts +6 -5
  15. package/components/chart/ChartHeaderTrend.vue.js +3 -3
  16. package/components/chart/ChartHeaderTrend.vue2.js +15 -14
  17. package/components/chart/ChartPlane.vue.d.ts +17 -7
  18. package/components/chart/ChartPlane.vue.js +3 -3
  19. package/components/chart/ChartPlane.vue2.js +270 -258
  20. package/components/chart/ChartStoryArgs.d.ts +21 -2
  21. package/components/chart/ChartTooltip.vue.js +2 -2
  22. package/components/chart/ChartTooltip.vue2.js +2 -2
  23. package/components/chart/SubHeader.vue.d.ts +52 -0
  24. package/components/chart/SubHeader.vue.js +7 -0
  25. package/components/chart/SubHeader.vue2.js +61 -0
  26. package/components/chart/TooltipHeader.vue.js +7 -0
  27. package/components/chart/{components/TooltipHeader.vue2.js → TooltipHeader.vue2.js} +5 -5
  28. package/components/chart/colorPalette.d.ts +1 -1
  29. package/components/chart/colorPalette.js +23 -23
  30. package/components/chart/composables/useChartHeight.d.ts +1 -1
  31. package/components/chart/consts.d.ts +10 -11
  32. package/components/chart/consts.js +29 -30
  33. package/components/chart/index.d.ts +71 -32
  34. package/components/chart/types.d.ts +9 -0
  35. package/components/chart/types.js +4 -2
  36. package/components/chart/utils/highlightUtils.d.ts +1 -1
  37. package/index.js +12 -8
  38. package/package.json +1 -1
  39. package/Chart.vue_vue_type_style_index_0_scoped_4e9ce62f_lang.css +0 -1
  40. package/ChartHeader.vue_vue_type_style_index_0_scoped_1ff0e54f_lang.css +0 -1
  41. package/ChartHeaderTrend.vue_vue_type_style_index_0_scoped_21ce0774_lang.css +0 -1
  42. package/ChartPlane.vue_vue_type_style_index_0_scoped_64dcfb5d_lang.css +0 -1
  43. package/ChartTooltip.vue_vue_type_style_index_0_scoped_81cdfd5e_lang.css +0 -1
  44. package/TooltipHeader.vue_vue_type_style_index_0_scoped_40d98a66_lang.css +0 -1
  45. package/components/chart/components/TooltipHeader.vue.js +0 -7
  46. /package/components/chart/{components/TooltipHeader.vue.d.ts → TooltipHeader.vue.d.ts} +0 -0
@@ -1,39 +1,43 @@
1
- import "../../ChartPlane.vue_vue_type_style_index_0_scoped_64dcfb5d_lang.css"; import { defineComponent as ot, useCssVars as lt, unref as d, computed as l, ref as k, onMounted as rt, watch as v, nextTick as it, openBlock as y, createElementBlock as nt, createElementVNode as T, createVNode as st, isRef as ct, createSlots as dt, withCtx as ut, renderSlot as pt, normalizeStyle as ft, createBlock as S, createCommentVNode as N } from "vue";
2
- import { Chart as P, ArcElement as ht, LineElement as mt, BarElement as vt, PointElement as yt, LineController as Tt, BarController as Ct, PieController as gt, ScatterController as bt, CategoryScale as kt, LinearScale as St, Filler as At, Tooltip as xt } from "chart.js";
3
- import { HoverVerticalLine as Et } from "./plugins/HoverVerticalLine.js";
4
- import { prepareTickLabel as Lt, formatValue as Rt, calcStepSize as Bt } from "./utils/utils.js";
5
- import { DEFAULT_TICK_COUNT as Dt, TOTALS_HELPER_KEY as F, BASE_COLOR_KEY as _, CHART_PADDING as A, POINT_BORDER_COLOR as Ot, TICK_LABEL_COLOR as K, TICK_LABEL_FONT as M, TICKS_EXTRA_PADDING as Ht, GRID_LINE_COLOR as z, HEADER_HEIGHT as wt, COMPACT_HEADER_HEIGHT as Vt, HOVER_AREA_TRANSPARENCY as It, HOVER_TRANSPARENCY as C } from "./consts.js";
6
- import { ChartType as s } from "./types.js";
7
- import { useTooltipPosition as Nt } from "./composables/useTooltipPosition.js";
8
- import Pt from "./ChartTooltip.vue.js";
9
- import { hexColorToRgba as u } from "../../utils/color.js";
10
- import { useChartValues as Ft } from "./composables/useChartValues.js";
11
- import _t from "./ChartHeader.vue.js";
12
- import { useMemoize as Kt, useVModel as Mt } from "@vueuse/core";
13
- import zt from "../emptyState/v4/EmptyStateV4.vue.js";
14
- import Ut from "./ChartLoader.vue.js";
15
- import { DEFAULT_CHART_COLOR as Gt } from "./colorPalette.js";
16
- import { TotalType as U, calculateTotal as Yt } from "../../utils/totals.js";
17
- import { isNullOrUndefined as $t } from "../../utils/utils.js";
18
- import { storeOriginalDatasetColors as Wt, restoreOriginalDatasetColors as Zt } from "./utils/highlightUtils.js";
19
- const Xt = {
1
+ import "../../ChartPlane.vue_vue_type_style_index_0_scoped_5c80d8cd_lang.css"; import { defineComponent as re, useCssVars as ie, unref as s, computed as l, ref as k, onMounted as ne, watch as T, nextTick as se, openBlock as p, createElementBlock as S, createVNode as ce, isRef as de, createSlots as ue, withCtx as pe, renderSlot as fe, createCommentVNode as A, createElementVNode as x, normalizeStyle as he, createBlock as L } from "vue";
2
+ import { Chart as F, ArcElement as me, LineElement as ve, BarElement as ye, PointElement as Te, LineController as Ce, BarController as ge, PieController as be, ScatterController as ke, CategoryScale as Se, LinearScale as Ae, Filler as xe, Tooltip as Le } from "chart.js";
3
+ import { HoverVerticalLine as Ee } from "./plugins/HoverVerticalLine.js";
4
+ import { prepareTickLabel as Re, formatValue as Be, calcStepSize as Oe } from "./utils/utils.js";
5
+ import { DEFAULT_TICK_COUNT as De, TOTALS_HELPER_KEY as _, BASE_COLOR_KEY as K, CHART_PADDING as E, POINT_BORDER_COLOR as He, TICK_LABEL_COLOR as M, TICK_LABEL_FONT as U, TICKS_EXTRA_PADDING as Ve, GRID_LINE_COLOR as z, HEADER_HEIGHT as we, COMPACT_HEADER_HEIGHT as Ie, HOVER_AREA_TRANSPARENCY as Ne, HOVER_TRANSPARENCY as C } from "./consts.js";
6
+ import { ChartType as c, TooltipOrder as G, TrendDirection as Pe } from "./types.js";
7
+ import { useTooltipPosition as Fe } from "./composables/useTooltipPosition.js";
8
+ import _e from "./ChartTooltip.vue.js";
9
+ import { hexColorToRgba as f } from "../../utils/color.js";
10
+ import { useChartValues as Ke } from "./composables/useChartValues.js";
11
+ import Me from "./ChartHeader.vue.js";
12
+ import { useMemoize as Ue, useVModel as ze } from "@vueuse/core";
13
+ import Ge from "../emptyState/v4/EmptyStateV4.vue.js";
14
+ import Ye from "./ChartLoader.vue.js";
15
+ import { DEFAULT_CHART_COLOR as $e } from "./colorPalette.js";
16
+ import { TotalType as Y, calculateTotal as We } from "../../utils/totals.js";
17
+ import { isNullOrUndefined as Ze } from "../../utils/utils.js";
18
+ import { storeOriginalDatasetColors as Xe, restoreOriginalDatasetColors as je } from "./utils/highlightUtils.js";
19
+ const qe = { class: "chart-plane-container" }, Je = {
20
20
  key: 0,
21
+ class: "header-wrapper"
22
+ }, Qe = {
23
+ key: 1,
21
24
  class: "chart-plane"
22
- }, jt = { class: "header-wrapper" }, qt = { class: "chart" }, ve = /* @__PURE__ */ ot({
25
+ }, et = { class: "chart" }, Ct = /* @__PURE__ */ re({
23
26
  __name: "ChartPlane",
24
27
  props: {
25
28
  dataSets: { default: () => [] },
26
29
  visibleIds: { default: () => [] },
27
30
  highlightedId: { default: null },
28
- chartType: { default: s.Line },
31
+ chartType: { default: c.Line },
29
32
  parsing: { default: void 0 },
30
33
  xAxisFormat: { default: "string" },
31
34
  yAxisFormat: { default: "number" },
32
- tickCount: { default: Dt },
35
+ tickCount: { default: De },
33
36
  truncateTickLabels: { type: Boolean, default: !0 },
34
37
  header: { default: "" },
35
38
  subheader: { default: "" },
36
39
  subheaderTooltip: { default: null },
40
+ keepSubheaderVisible: { type: Boolean, default: !1 },
37
41
  loading: { type: Boolean, default: !1 },
38
42
  noDataIcon: { default: "file-search" },
39
43
  noDataTitle: { default: "No data to display" },
@@ -43,73 +47,74 @@ const Xt = {
43
47
  height: { default: "100%" },
44
48
  compactHeader: { type: Boolean, default: !1 },
45
49
  tooltipRespectsTopEdge: { type: Boolean, default: !0 },
46
- tooltipTotalType: { default: U.Total },
47
- tooltipTotalCalcFn: { type: Function, default: Yt },
50
+ tooltipTotalType: { default: Y.Total },
51
+ tooltipTotalCalcFn: { type: Function, default: We },
52
+ tooltipOrder: { default: G.Legend },
48
53
  trendValue: { default: null },
49
- trendDirection: { default: "up" },
54
+ trendDirection: { default: Pe.UP },
50
55
  trendTooltip: { default: null },
51
56
  totalsChart: { type: Boolean, default: !1 },
52
57
  colorsMap: { default: () => ({}) }
53
58
  },
54
59
  emits: ["update:chartType"],
55
- setup(o, { emit: G }) {
60
+ setup(o, { emit: $ }) {
56
61
  const t = o;
57
- lt((e) => ({
58
- "2e8f327a": d(Q),
59
- f7b2eb36: o.height
62
+ ie((e) => ({
63
+ "1ae03326": s(te),
64
+ "42303d50": o.height
60
65
  }));
61
- const Y = Kt(Lt);
62
- P.register(
63
- ht,
64
- mt,
65
- vt,
66
- yt,
67
- Tt,
68
- Ct,
69
- gt,
70
- bt,
71
- kt,
72
- St,
73
- At,
74
- xt,
75
- Et
66
+ const W = Ue(Re);
67
+ F.register(
68
+ me,
69
+ ve,
70
+ ye,
71
+ Te,
72
+ Ce,
73
+ ge,
74
+ be,
75
+ ke,
76
+ Se,
77
+ Ae,
78
+ xe,
79
+ Le,
80
+ Ee
76
81
  );
77
- const g = Mt(t, "chartType", G), $ = l(
82
+ const g = ze(t, "chartType", $), Z = l(
78
83
  () => t.withAnimation ? "" : "none"
79
- ), f = k(null);
80
- let r = null;
81
- const x = l(() => t.dataSets.length === 0), E = l(() => !t.loading && !x.value), b = () => {
82
- f.value && (r && r.destroy(), r = new P(f.value, O.value));
83
- }, W = () => {
84
- r && (r.data.datasets = D.value, r.options = O.value.options, r.update($.value));
84
+ ), m = k(null);
85
+ let n = null;
86
+ const R = l(() => t.dataSets.length === 0), u = l(() => !t.loading && !R.value), b = () => {
87
+ m.value && (n && n.destroy(), n = new F(m.value, V.value));
88
+ }, X = () => {
89
+ n && (n.data.datasets = H.value, n.options = V.value.options, n.update(Z.value));
85
90
  };
86
- rt(b), v(() => t.chartType, b), v(E, async (e) => {
87
- e && (await it(), b());
88
- }), v([() => t.visibleIds, () => t.dataSets], W);
89
- const p = l(() => t.totalsChart), h = l(
90
- () => t.chartType === s.StackedLine || t.chartType === s.StackedBar || p.value
91
- ), L = l(
92
- () => t.chartType === s.Line || t.chartType === s.StackedLine
93
- ), R = l(() => p.value && !t.parsing.xAxisKey ? { ...t.parsing, xAxisKey: F } : t.parsing), Z = l(() => p.value ? t.dataSets.map((e) => ({
91
+ ne(b), T(() => t.chartType, b), T(u, async (e) => {
92
+ e && (await se(), b());
93
+ }), T([() => t.visibleIds, () => t.dataSets], X);
94
+ const h = l(() => t.totalsChart), v = l(
95
+ () => t.chartType === c.StackedLine || t.chartType === c.StackedBar || h.value
96
+ ), B = l(
97
+ () => t.chartType === c.Line || t.chartType === c.StackedLine
98
+ ), O = l(() => h.value && !t.parsing.xAxisKey ? { ...t.parsing, xAxisKey: _ } : t.parsing), j = l(() => h.value ? t.dataSets.map((e) => ({
94
99
  ...e,
95
- data: e.data.map((n) => ({
96
- ...n,
97
- [F]: e.label
100
+ data: e.data.map((i) => ({
101
+ ...i,
102
+ [_]: e.label
98
103
  }))
99
- })) : t.dataSets), m = l(
100
- () => Z.value.filter((e) => t.visibleIds.includes(e.id))
101
- ), X = (e) => t.colorsMap[e] || Gt, B = l(
102
- () => m.value.length && m.value.every(
104
+ })) : t.dataSets), y = l(
105
+ () => j.value.filter((e) => t.visibleIds.includes(e.id))
106
+ ), q = (e) => t.colorsMap[e] || $e, D = l(
107
+ () => y.value.length && y.value.every(
103
108
  (e) => e.data.length === 1
104
109
  )
105
- ), D = l(() => m.value.map((e, n) => {
106
- const a = X(e.id), i = h.value ? n !== 0 ? "-1" : "start" : void 0;
110
+ ), H = l(() => y.value.map((e, i) => {
111
+ const a = q(e.id), r = v.value ? i !== 0 ? "-1" : "start" : void 0;
107
112
  return {
108
113
  ...e,
109
- fill: i,
110
- backgroundColor: u(
114
+ fill: r,
115
+ backgroundColor: f(
111
116
  a,
112
- t.chartType === s.StackedLine ? 10 : 70
117
+ t.chartType === c.StackedLine ? 10 : 70
113
118
  ),
114
119
  borderColor: a,
115
120
  pointBackgroundColor: a,
@@ -119,227 +124,234 @@ const Xt = {
119
124
  // draw a bit outside the chart area
120
125
  icon: e.icon || null,
121
126
  iconType: e.iconType || "branded",
122
- [_]: a
127
+ [K]: a
123
128
  // store base color for later use
124
129
  };
125
- })), j = l(
126
- () => t.tooltipTotalType === U.Total ? "Total" : "Mean"
127
- ), O = l(
128
- () => ({
129
- type: t.chartType == s.Bar || t.chartType === s.StackedBar ? "bar" : "line",
130
- // Chart Data
131
- data: {
132
- datasets: D.value
130
+ })), J = l(
131
+ () => t.tooltipTotalType === Y.Total ? "Total" : "Mean"
132
+ ), V = l(() => ({
133
+ type: t.chartType == c.Bar || t.chartType === c.StackedBar ? "bar" : "line",
134
+ // Chart Data
135
+ data: {
136
+ datasets: H.value
137
+ },
138
+ // Chart Options
139
+ options: {
140
+ parsing: O.value,
141
+ interaction: {
142
+ intersect: !1,
143
+ mode: h.value ? "point" : "index",
144
+ axis: "x"
133
145
  },
134
- // Chart Options
135
- options: {
136
- parsing: R.value,
137
- interaction: {
138
- intersect: !1,
139
- mode: p.value ? "point" : "index",
140
- axis: "x"
141
- },
142
- // plugins
143
- plugins: {
144
- legend: { display: !1 },
145
- title: { display: !1 },
146
- hoverVerticalLine: L.value,
147
- // tooltip
148
- tooltip: {
149
- enabled: !1,
150
- position: "average",
151
- external: ({ tooltip: e }) => {
152
- c.value = { ...e };
153
- },
154
- callbacks: {
155
- footer: (e) => {
156
- const n = e.map((i) => i.parsed.y || 0), a = t.tooltipTotalCalcFn(
157
- n,
158
- t.tooltipTotalType
159
- );
160
- return [j.value, String(a)];
161
- }
146
+ // plugins
147
+ plugins: {
148
+ legend: { display: !1 },
149
+ title: { display: !1 },
150
+ hoverVerticalLine: B.value,
151
+ // tooltip
152
+ tooltip: {
153
+ enabled: !1,
154
+ position: "average",
155
+ external: ({ tooltip: e }) => {
156
+ d.value = { ...e };
157
+ },
158
+ callbacks: {
159
+ footer: (e) => {
160
+ const i = e.map((r) => r.parsed.y || 0), a = t.tooltipTotalCalcFn(
161
+ i,
162
+ t.tooltipTotalType
163
+ );
164
+ return [J.value, String(a)];
165
+ }
166
+ },
167
+ itemSort: (e, i) => {
168
+ if (t.tooltipOrder === G.YAxis) {
169
+ const a = e.parsed.y || 0, r = i.parsed.y || 0;
170
+ return a === r ? 0 : a > r ? -1 : 1;
162
171
  }
172
+ return 0;
163
173
  }
174
+ }
175
+ },
176
+ // chart layout
177
+ responsive: !0,
178
+ maintainAspectRatio: !1,
179
+ layout: {
180
+ padding: E
181
+ },
182
+ // basic styles
183
+ elements: {
184
+ line: {
185
+ borderWidth: 2,
186
+ tension: 0.3
164
187
  },
165
- // chart layout
166
- responsive: !0,
167
- maintainAspectRatio: !1,
168
- layout: {
169
- padding: A
188
+ point: {
189
+ radius: D.value ? 3 : 1,
190
+ hitRadius: 8,
191
+ borderWidth: 0,
192
+ hoverRadius: 4,
193
+ hoverBorderWidth: 2,
194
+ pointHoverBackgroundColor: He
170
195
  },
171
- // basic styles
172
- elements: {
173
- line: {
174
- borderWidth: 2,
175
- tension: 0.3
176
- },
177
- point: {
178
- radius: B.value ? 3 : 1,
179
- hitRadius: 8,
180
- borderWidth: 0,
181
- hoverRadius: 4,
182
- hoverBorderWidth: 2,
183
- pointHoverBackgroundColor: Ot
196
+ bar: {
197
+ borderRadius: 4
198
+ }
199
+ },
200
+ scales: {
201
+ // Horizontal Axis (X)
202
+ x: {
203
+ beginAtZero: !0,
204
+ offset: !B.value || D.value,
205
+ border: { display: !1 },
206
+ stacked: v.value,
207
+ // stack on top of each other
208
+ // ticks
209
+ ticks: {
210
+ color: M,
211
+ font: U,
212
+ padding: 4,
213
+ callback: function(e, i, a) {
214
+ const r = this.getLabelForValue(e), le = this.chart.width / a.length - (E.left + E.right + Ve);
215
+ return W({
216
+ label: r,
217
+ format: t.xAxisFormat,
218
+ availableSpace: le,
219
+ truncate: t.truncateTickLabels
220
+ });
221
+ }
184
222
  },
185
- bar: {
186
- borderRadius: 4
223
+ // grid lines
224
+ grid: {
225
+ color: z,
226
+ drawOnChartArea: !1,
227
+ drawTicks: !0,
228
+ drawBorder: !1,
229
+ tickLength: 7
187
230
  }
188
231
  },
189
- scales: {
190
- // Horizontal Axis (X)
191
- x: {
192
- beginAtZero: !0,
193
- offset: !L.value || B.value,
194
- border: { display: !1 },
195
- stacked: h.value,
196
- // stack on top of each other
197
- // ticks
198
- ticks: {
199
- color: K,
200
- font: M,
201
- padding: 4,
202
- callback: function(e, n, a) {
203
- const i = this.getLabelForValue(e), at = this.chart.width / a.length - (A.left + A.right + Ht);
204
- return Y({
205
- label: i,
206
- format: t.xAxisFormat,
207
- availableSpace: at,
208
- truncate: t.truncateTickLabels
209
- });
210
- }
211
- },
212
- // grid lines
213
- grid: {
214
- color: z,
215
- drawOnChartArea: !1,
216
- drawTicks: !0,
217
- drawBorder: !1,
218
- tickLength: 7
219
- }
232
+ // Vertical Axis (Y)
233
+ y: {
234
+ beginAtZero: !0,
235
+ border: { display: !1 },
236
+ // hide left borderline
237
+ stacked: v.value,
238
+ // stack on top of each other
239
+ // ticks
240
+ ticks: {
241
+ color: M,
242
+ font: U,
243
+ padding: 8,
244
+ stepSize: P.value,
245
+ min: N.value,
246
+ max: P.value * t.tickCount,
247
+ callback: (e) => Be(e, t.yAxisFormat)
220
248
  },
221
- // Vertical Axis (Y)
222
- y: {
223
- beginAtZero: !0,
224
- border: { display: !1 },
225
- // hide left borderline
226
- stacked: h.value,
227
- // stack on top of each other
228
- // ticks
229
- ticks: {
230
- color: K,
231
- font: M,
232
- padding: 8,
233
- stepSize: I.value,
234
- min: V.value,
235
- max: I.value * t.tickCount,
236
- callback: (e) => Rt(e, t.yAxisFormat)
237
- },
238
- // grid lines
239
- grid: {
240
- color: z,
241
- drawOnChartArea: !0,
242
- drawTicks: !1
243
- }
249
+ // grid lines
250
+ grid: {
251
+ color: z,
252
+ drawOnChartArea: !0,
253
+ drawTicks: !1
244
254
  }
245
255
  }
246
256
  }
247
- })
248
- ), H = k(null), c = k(null), { position: w } = Nt(
249
- f,
250
- H,
251
- c,
257
+ }
258
+ })), w = k(null), d = k(null), { position: I } = Fe(
259
+ m,
260
+ w,
261
+ d,
252
262
  t.tooltipRespectsTopEdge
253
- ), q = l(() => ({
254
- left: `${w.value.left}px`,
255
- top: `${w.value.top}px`,
256
- opacity: c.value?.opacity || 0
257
- })), { minValue: V, maxValue: J } = Ft({
258
- parsingConfig: R.value,
259
- dataSets: m,
260
- isStacked: h
261
- }), I = l(
262
- () => Bt(V.value, J.value, t.tickCount)
263
- ), Q = l(
264
- () => (t.compactHeader ? Vt : wt) + "px"
263
+ ), Q = l(() => ({
264
+ left: `${I.value.left}px`,
265
+ top: `${I.value.top}px`,
266
+ opacity: d.value?.opacity || 0
267
+ })), { minValue: N, maxValue: ee } = Ke({
268
+ parsingConfig: O.value,
269
+ dataSets: y,
270
+ isStacked: v
271
+ }), P = l(
272
+ () => Oe(N.value, ee.value, t.tickCount)
273
+ ), te = l(
274
+ () => (t.compactHeader ? Ie : we) + "px"
265
275
  );
266
- v(
276
+ T(
267
277
  () => t.highlightedId,
268
278
  (e) => {
269
- r && ($t(e) ? et() : tt(e), r.update());
279
+ n && (Ze(e) ? oe() : ae(e), n.update());
270
280
  }
271
281
  );
272
- const tt = (e) => {
273
- (r?.data.datasets || []).forEach((a) => {
274
- Wt(a);
275
- const i = a[_];
276
- a.id === e ? t.chartType === s.StackedLine && (a.backgroundColor = u(
277
- i,
278
- It
279
- )) : (a.backgroundColor = u(i, C), a.borderColor = u(i, C), a.pointBackgroundColor = u(i, C), a.pointHoverBorderColor = u(i, C));
282
+ const ae = (e) => {
283
+ (n?.data.datasets || []).forEach((a) => {
284
+ Xe(a);
285
+ const r = a[K];
286
+ a.id === e ? t.chartType === c.StackedLine && (a.backgroundColor = f(
287
+ r,
288
+ Ne
289
+ )) : (a.backgroundColor = f(r, C), a.borderColor = f(r, C), a.pointBackgroundColor = f(r, C), a.pointHoverBorderColor = f(r, C));
280
290
  });
281
- }, et = () => {
282
- (r?.data.datasets || []).forEach(Zt);
291
+ }, oe = () => {
292
+ (n?.data.datasets || []).forEach(je);
283
293
  };
284
- return (e, n) => d(E) ? (y(), nt("section", Xt, [
285
- T("div", jt, [
286
- st(_t, {
287
- "chart-type": d(g),
288
- "onUpdate:chart-type": n[0] || (n[0] = (a) => ct(g) ? g.value = a : null),
289
- "type-switcher": o.typeSwitcher,
290
- header: o.header,
294
+ return (e, i) => (p(), S("div", qe, [
295
+ s(u) || o.keepSubheaderVisible ? (p(), S("div", Je, [
296
+ ce(Me, {
297
+ "chart-type": s(g),
298
+ "onUpdate:chart-type": i[0] || (i[0] = (a) => de(g) ? g.value = a : null),
299
+ "type-switcher": s(u) ? o.typeSwitcher : !1,
300
+ header: s(u) ? o.header : null,
291
301
  subheader: o.subheader,
292
302
  "subheader-tooltip": o.subheaderTooltip,
293
303
  "trend-tooltip": o.trendTooltip,
294
304
  compact: o.compactHeader,
295
- "trend-value": o.trendValue,
305
+ "trend-value": s(u) ? o.trendValue : null,
296
306
  "trend-direction": o.trendDirection
297
- }, dt({ _: 2 }, [
307
+ }, ue({ _: 2 }, [
298
308
  e.$slots["subheader-tooltip"] ? {
299
309
  name: "subheader-tooltip",
300
- fn: ut(() => [
301
- pt(e.$slots, "subheader-tooltip", {}, void 0, !0)
310
+ fn: pe(() => [
311
+ fe(e.$slots, "subheader-tooltip", {}, void 0, !0)
302
312
  ]),
303
313
  key: "0"
304
314
  } : void 0
305
315
  ]), 1032, ["chart-type", "type-switcher", "header", "subheader", "subheader-tooltip", "trend-tooltip", "compact", "trend-value", "trend-direction"])
306
- ]),
307
- T("div", qt, [
308
- T("canvas", {
309
- ref_key: "chartRef",
310
- ref: f,
311
- class: "chart__canvas"
312
- }, null, 512),
313
- T("div", {
314
- ref_key: "tooltipRef",
315
- ref: H,
316
- class: "chart__tooltip",
317
- style: ft(d(q))
318
- }, [
319
- c.value ? (y(), S(Pt, {
320
- key: 0,
321
- "totals-chart": d(p),
322
- title: String(c.value.title),
323
- "data-points": c.value.dataPoints,
324
- "x-axis-format": o.xAxisFormat,
325
- "y-axis-format": o.yAxisFormat,
326
- "total-label": c.value.footer[0],
327
- "total-value": Number(c.value.footer[1])
328
- }, null, 8, ["totals-chart", "title", "data-points", "x-axis-format", "y-axis-format", "total-label", "total-value"])) : N("", !0)
329
- ], 4)
330
- ])
331
- ])) : o.loading ? (y(), S(Ut, {
332
- key: 1,
333
- class: "chart-loading"
334
- })) : d(x) ? (y(), S(d(zt), {
335
- key: 2,
336
- class: "chart-empty",
337
- title: o.noDataTitle,
338
- subtitle: o.noDataSubtitle,
339
- "icon-name": o.noDataIcon
340
- }, null, 8, ["title", "subtitle", "icon-name"])) : N("", !0);
316
+ ])) : A("", !0),
317
+ s(u) ? (p(), S("section", Qe, [
318
+ x("div", et, [
319
+ x("canvas", {
320
+ ref_key: "chartRef",
321
+ ref: m,
322
+ class: "chart__canvas"
323
+ }, null, 512),
324
+ x("div", {
325
+ ref_key: "tooltipRef",
326
+ ref: w,
327
+ class: "chart__tooltip",
328
+ style: he(s(Q))
329
+ }, [
330
+ d.value ? (p(), L(_e, {
331
+ key: 0,
332
+ "totals-chart": s(h),
333
+ title: String(d.value.title),
334
+ "data-points": d.value.dataPoints,
335
+ "x-axis-format": o.xAxisFormat,
336
+ "y-axis-format": o.yAxisFormat,
337
+ "total-label": d.value.footer?.[0],
338
+ "total-value": Number(d.value.footer?.[1])
339
+ }, null, 8, ["totals-chart", "title", "data-points", "x-axis-format", "y-axis-format", "total-label", "total-value"])) : A("", !0)
340
+ ], 4)
341
+ ])
342
+ ])) : o.loading ? (p(), L(Ye, {
343
+ key: 2,
344
+ class: "chart-loading"
345
+ })) : s(R) ? (p(), L(s(Ge), {
346
+ key: 3,
347
+ class: "chart-empty",
348
+ title: o.noDataTitle,
349
+ subtitle: o.noDataSubtitle,
350
+ "icon-name": o.noDataIcon
351
+ }, null, 8, ["title", "subtitle", "icon-name"])) : A("", !0)
352
+ ]));
341
353
  }
342
354
  });
343
355
  export {
344
- ve as default
356
+ Ct as default
345
357
  };