@ironsource/shared-ui 2.1.12-rc.2 → 2.1.12-rc.20

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 (183) hide show
  1. package/ButtonDropdownTrigger.vue_vue_type_style_index_0_scoped_0123c361_lang.css +1 -0
  2. package/ButtonFilterDropdownTrigger.vue_vue_type_style_index_0_scoped_0198fee8_lang.css +1 -0
  3. package/ButtonV4.vue_vue_type_style_index_0_scoped_d7948c77_lang.css +1 -0
  4. package/Chart.vue_vue_type_style_index_0_scoped_64205c96_lang.css +1 -0
  5. package/ChartHeader.vue_vue_type_style_index_0_scoped_da34b108_lang.css +1 -0
  6. package/ChartHeaderTrend.vue_vue_type_style_index_0_scoped_79dc2883_lang.css +1 -0
  7. package/ChartLegend.vue_vue_type_style_index_0_scoped_fd9e4ea2_lang.css +1 -0
  8. package/ChartPlane.vue_vue_type_style_index_0_scoped_903fc6ae_lang.css +1 -0
  9. package/ChartTooltip.vue_vue_type_style_index_0_scoped_e53c6287_lang.css +1 -0
  10. package/ConditionalDropdown.vue_vue_type_style_index_0_scoped_8d5521da_lang.css +1 -0
  11. package/DataGrid.vue_vue_type_style_index_0_scoped_86ea5d2a_lang.css +1 -0
  12. package/DateRangeV4.vue_vue_type_style_index_0_scoped_a849128a_lang.css +1 -0
  13. package/DialogV4.vue_vue_type_style_index_0_scoped_eb226e31_lang.css +1 -0
  14. package/DropdownV4.vue_vue_type_style_index_0_scoped_08cb822e_lang.css +1 -0
  15. package/FieldLabel.vue_vue_type_style_index_0_scoped_921d4087_lang.css +1 -0
  16. package/FormRow.vue_vue_type_style_index_0_scoped_2d5a3057_lang.css +1 -0
  17. package/IconButtonDropdownTrigger.vue_vue_type_style_index_0_scoped_99e51ecc_lang.css +1 -0
  18. package/OptionV4.vue_vue_type_style_index_0_scoped_9cdf3a94_lang.css +1 -0
  19. package/SettingsHeader.vue_vue_type_style_index_0_scoped_01f78cd7_lang.css +1 -0
  20. package/SubHeader.vue_vue_type_style_index_0_scoped_e6008b6c_lang.css +1 -0
  21. package/Tooltip.vue_vue_type_style_index_0_scoped_20630944_lang.css +1 -0
  22. package/TooltipHeader.vue_vue_type_style_index_0_scoped_3b15c693_lang.css +1 -0
  23. package/TooltipV4.vue_vue_type_style_index_0_scoped_bcb40ed4_lang.css +1 -0
  24. package/TreeDropdown.vue_vue_type_style_index_0_scoped_4ba9e4bd_lang.css +1 -0
  25. package/components/appIcon/index.d.ts +3 -3
  26. package/components/banner/Banner.vue.d.ts +3 -3
  27. package/components/banner/index.d.ts +7 -7
  28. package/components/button/common/consts.d.ts +1 -0
  29. package/components/button/v3/Button.vue.d.ts +3 -3
  30. package/components/button/v3/ButtonBase.vue.d.ts +3 -3
  31. package/components/button/v3/IconButton.vue.d.ts +3 -3
  32. package/components/button/v3/index.d.ts +14 -14
  33. package/components/button/v4/ButtonV4.vue.d.ts +4 -3
  34. package/components/button/v4/ButtonV4.vue.js +3 -3
  35. package/components/button/v4/ButtonV4.vue2.js +1 -1
  36. package/components/chart/Chart.vue.d.ts +149 -38
  37. package/components/chart/Chart.vue.js +3 -3
  38. package/components/chart/Chart.vue2.js +145 -297
  39. package/components/chart/ChartHeader.vue.d.ts +45 -11
  40. package/components/chart/ChartHeader.vue.js +3 -3
  41. package/components/chart/ChartHeader.vue2.js +64 -53
  42. package/components/chart/ChartHeaderTrend.vue.d.ts +48 -0
  43. package/components/chart/ChartHeaderTrend.vue.js +7 -0
  44. package/components/chart/ChartHeaderTrend.vue2.js +95 -0
  45. package/components/chart/ChartLegend.vue.d.ts +24 -0
  46. package/components/chart/ChartLegend.vue.js +3 -3
  47. package/components/chart/ChartLegend.vue2.js +82 -63
  48. package/components/chart/ChartPlane.vue.d.ts +221 -0
  49. package/components/chart/ChartPlane.vue.js +7 -0
  50. package/components/chart/ChartPlane.vue2.js +368 -0
  51. package/components/chart/ChartStoryArgs.d.ts +179 -0
  52. package/components/chart/ChartTooltip.vue.d.ts +22 -2
  53. package/components/chart/ChartTooltip.vue.js +2 -2
  54. package/components/chart/ChartTooltip.vue2.js +50 -55
  55. package/components/chart/LegendSorting.vue.d.ts +37 -0
  56. package/components/chart/LegendSorting.vue.js +45 -0
  57. package/components/chart/LegendSorting.vue2.js +4 -0
  58. package/components/chart/SettingsHeader.vue.d.ts +1 -0
  59. package/components/chart/SettingsHeader.vue.js +3 -3
  60. package/components/chart/SettingsHeader.vue2.js +17 -16
  61. package/components/chart/SubHeader.vue.d.ts +52 -0
  62. package/components/chart/SubHeader.vue.js +7 -0
  63. package/components/chart/SubHeader.vue2.js +61 -0
  64. package/components/chart/TooltipHeader.vue.d.ts +50 -0
  65. package/components/chart/TooltipHeader.vue.js +7 -0
  66. package/components/chart/TooltipHeader.vue2.js +69 -0
  67. package/components/chart/colorPalette.d.ts +4 -0
  68. package/components/chart/colorPalette.js +54 -0
  69. package/components/chart/composables/useChartHeight.d.ts +5 -0
  70. package/components/chart/composables/useChartHeight.js +24 -0
  71. package/components/chart/composables/useColorsMap.d.ts +10 -0
  72. package/components/chart/composables/useColorsMap.js +46 -0
  73. package/components/chart/composables/useTooltipPosition.d.ts +1 -1
  74. package/components/chart/composables/useTooltipPosition.js +11 -15
  75. package/components/chart/consts.d.ts +29 -7
  76. package/components/chart/consts.js +41 -21
  77. package/components/chart/index.d.ts +515 -118
  78. package/components/chart/mockData.d.ts +44 -5
  79. package/components/chart/types.d.ts +37 -6
  80. package/components/chart/types.js +5 -2
  81. package/components/chart/utils/formatNumber.d.ts +0 -1
  82. package/components/chart/utils/highlightUtils.d.ts +3 -0
  83. package/components/chart/utils/highlightUtils.js +18 -0
  84. package/components/chart/utils/utils.d.ts +3 -2
  85. package/components/chart/utils/utils.js +23 -8
  86. package/components/checkbox/v3/Checkbox.vue.d.ts +3 -3
  87. package/components/checkbox/v3/index.d.ts +7 -7
  88. package/components/dateRange/v4/DateRangeV4.vue.js +2 -2
  89. package/components/dateRange/v4/DateRangeV4.vue2.js +1 -1
  90. package/components/dialog/v4/DialogV4.vue.d.ts +4 -3
  91. package/components/dialog/v4/DialogV4.vue.js +4 -4
  92. package/components/dialog/v4/DialogV4.vue2.js +1 -1
  93. package/components/dialog/v4/index.d.ts +7 -7
  94. package/components/dropdown/common/Dropdown.common.js +92 -85
  95. package/components/dropdown/v4/ButtonDropdownTrigger.vue.js +2 -2
  96. package/components/dropdown/v4/ButtonDropdownTrigger.vue2.js +1 -1
  97. package/components/dropdown/v4/ButtonFilterDropdownTrigger.vue.js +2 -2
  98. package/components/dropdown/v4/ButtonFilterDropdownTrigger.vue2.js +1 -1
  99. package/components/dropdown/v4/ConditionalDropdown.vue.js +3 -3
  100. package/components/dropdown/v4/ConditionalDropdown.vue2.js +76 -76
  101. package/components/dropdown/v4/DropdownV4.vue.d.ts +8 -0
  102. package/components/dropdown/v4/DropdownV4.vue.js +4 -4
  103. package/components/dropdown/v4/DropdownV4.vue2.js +105 -95
  104. package/components/dropdown/v4/IconButtonDropdownTrigger.vue.d.ts +11 -0
  105. package/components/dropdown/v4/IconButtonDropdownTrigger.vue.js +4 -4
  106. package/components/dropdown/v4/IconButtonDropdownTrigger.vue2.js +12 -10
  107. package/components/dropdown/v4/OptionV4.vue.d.ts +8 -0
  108. package/components/dropdown/v4/OptionV4.vue.js +3 -3
  109. package/components/dropdown/v4/OptionV4.vue2.js +91 -69
  110. package/components/dropdown/v4/TreeDropdown.vue.js +2 -2
  111. package/components/dropdown/v4/TreeDropdown.vue2.js +68 -73
  112. package/components/dropdown/v4/index.d.ts +64 -2
  113. package/components/emptyState/v4/EmptyStateV4.vue.d.ts +3 -3
  114. package/components/emptyState/v4/index.d.ts +7 -7
  115. package/components/forms/FormRow.vue.d.ts +9 -2
  116. package/components/forms/FormRow.vue.js +3 -3
  117. package/components/forms/FormRow.vue2.js +25 -14
  118. package/components/forms/index.d.ts +25 -5
  119. package/components/search/v3/index.d.ts +3 -3
  120. package/components/shared/FieldLabel.vue.d.ts +19 -7
  121. package/components/shared/FieldLabel.vue.js +3 -3
  122. package/components/shared/FieldLabel.vue2.js +50 -37
  123. package/components/table/v4/DataGrid.vue.d.ts +4 -3
  124. package/components/table/v4/DataGrid.vue.js +4 -4
  125. package/components/table/v4/DataGrid.vue2.js +151 -142
  126. package/components/table/v4/MultipleDataGrid.vue.d.ts +3 -3
  127. package/components/table/v4/index.d.ts +15 -14
  128. package/components/tabs/v3/Tabs.vue.d.ts +3 -3
  129. package/components/tabs/v3/index.d.ts +7 -7
  130. package/components/tooltip/common/Tooltip.types.d.ts +1 -0
  131. package/components/tooltip/v3/Tooltip.vue.d.ts +4 -4
  132. package/components/tooltip/v3/Tooltip.vue.js +2 -2
  133. package/components/tooltip/v3/Tooltip.vue2.js +1 -1
  134. package/components/tooltip/v3/index.d.ts +7 -7
  135. package/components/tooltip/v4/TooltipV4.vue.d.ts +4 -4
  136. package/components/tooltip/v4/TooltipV4.vue.js +2 -2
  137. package/components/tooltip/v4/TooltipV4.vue2.js +1 -1
  138. package/components/tooltip/v4/index.d.ts +7 -7
  139. package/components/typography/Text.vue.d.ts +3 -3
  140. package/components/typography/index.d.ts +7 -7
  141. package/composables/useFormValidation.d.ts +1 -0
  142. package/composables/useFormValidation.js +32 -27
  143. package/composables/useFullPageHeight.d.ts +10 -0
  144. package/composables/useFullPageHeight.js +15 -0
  145. package/consts/common.d.ts +1 -0
  146. package/consts/common.js +4 -0
  147. package/consts/regex.d.ts +1 -0
  148. package/consts/regex.js +2 -1
  149. package/index.d.ts +211 -81
  150. package/index.js +106 -100
  151. package/package.json +1 -1
  152. package/testids/index.d.ts +2 -1
  153. package/testids/index.js +10 -10
  154. package/utils/formatNumbers.d.ts +1 -1
  155. package/utils/formatNumbers.js +19 -6
  156. package/utils/index.js +7 -0
  157. package/utils/text.d.ts +3 -0
  158. package/utils/text.js +24 -5
  159. package/utils/totals.d.ts +5 -0
  160. package/utils/totals.js +9 -0
  161. package/utils/utils.d.ts +1 -0
  162. package/utils/utils.js +4 -0
  163. package/ButtonDropdownTrigger.vue_vue_type_style_index_0_scoped_604dfc6f_lang.css +0 -1
  164. package/ButtonFilterDropdownTrigger.vue_vue_type_style_index_0_scoped_ea1c4589_lang.css +0 -1
  165. package/ButtonV4.vue_vue_type_style_index_0_scoped_bdfce3aa_lang.css +0 -1
  166. package/Chart.vue_vue_type_style_index_0_scoped_a641383a_lang.css +0 -1
  167. package/ChartHeader.vue_vue_type_style_index_0_scoped_b8213498_lang.css +0 -1
  168. package/ChartLegend.vue_vue_type_style_index_0_scoped_4fe1c7d1_lang.css +0 -1
  169. package/ChartTooltip.vue_vue_type_style_index_0_scoped_6744325c_lang.css +0 -1
  170. package/ConditionalDropdown.vue_vue_type_style_index_0_scoped_3a2aeea3_lang.css +0 -1
  171. package/DataGrid.vue_vue_type_style_index_0_scoped_020072b0_lang.css +0 -1
  172. package/DateRangeV4.vue_vue_type_style_index_0_scoped_8a2714eb_lang.css +0 -1
  173. package/DialogV4.vue_vue_type_style_index_0_scoped_37da643b_lang.css +0 -1
  174. package/DropdownV4.vue_vue_type_style_index_0_scoped_d154c5da_lang.css +0 -1
  175. package/FieldLabel.vue_vue_type_style_index_0_scoped_96ee1c98_lang.css +0 -1
  176. package/FormRow.vue_vue_type_style_index_0_scoped_fc3897fd_lang.css +0 -1
  177. package/IconButtonDropdownTrigger.vue_vue_type_style_index_0_scoped_59fb505a_lang.css +0 -1
  178. package/OptionV4.vue_vue_type_style_index_0_scoped_1e8837dc_lang.css +0 -1
  179. package/SettingsHeader.vue_vue_type_style_index_0_scoped_9b6cd9d9_lang.css +0 -1
  180. package/Tooltip.vue_vue_type_style_index_0_scoped_9020a179_lang.css +0 -1
  181. package/TooltipV4.vue_vue_type_style_index_0_scoped_66eab856_lang.css +0 -1
  182. package/TreeDropdown.vue_vue_type_style_index_0_scoped_b883d1fa_lang.css +0 -1
  183. package/components/chart/utils/formatNumber.js +0 -11
@@ -0,0 +1,221 @@
1
+ import { ChartDataSet, ChartParsingConfig, ChartType, DateInterval, TooltipOrder, TrendDirection, ValueFormat } from './types';
2
+ import { TotalType } from '@/utils/totals';
3
+ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
4
+ dataSets: ChartDataSet[];
5
+ visibleIds: unknown[];
6
+ highlightedId?: string | number;
7
+ chartType?: ChartType;
8
+ parsing?: ChartParsingConfig;
9
+ xAxisFormat?: ValueFormat;
10
+ yAxisFormat?: ValueFormat;
11
+ xAxisDateInterval?: DateInterval;
12
+ tickCount?: number;
13
+ truncateTickLabels?: boolean;
14
+ header?: string;
15
+ subheader?: string;
16
+ subheaderTooltip?: {
17
+ header?: string;
18
+ text?: string;
19
+ };
20
+ keepSubheaderVisible?: boolean;
21
+ loading?: boolean;
22
+ empty?: boolean;
23
+ noDataIcon?: string;
24
+ noDataTitle?: string;
25
+ noDataSubtitle?: string;
26
+ withAnimation?: boolean;
27
+ typeSwitcher?: boolean;
28
+ height?: string;
29
+ compactHeader?: boolean;
30
+ tooltipRespectsTopEdge?: boolean;
31
+ tooltipTotalType?: TotalType;
32
+ tooltipTotalCalcFn?: (values: number[], totalType: TotalType) => number;
33
+ tooltipOrder?: TooltipOrder;
34
+ trendValue?: string | number;
35
+ trendDirection?: TrendDirection;
36
+ trendTooltip?: {
37
+ header?: string;
38
+ rangeCurrent?: string;
39
+ rangePrevious?: string;
40
+ };
41
+ totalsChart?: boolean;
42
+ colorsMap: Record<string, string>;
43
+ valueSuffix?: string;
44
+ valuePrefix?: string;
45
+ }>, {
46
+ chartType: ChartType;
47
+ dataSets: () => any[];
48
+ visibleIds: () => any[];
49
+ highlightedId: any;
50
+ xAxisFormat: string;
51
+ yAxisFormat: string;
52
+ xAxisDateInterval: DateInterval;
53
+ parsing: any;
54
+ tickCount: number;
55
+ truncateTickLabels: boolean;
56
+ header: string;
57
+ subheader: string;
58
+ subheaderTooltip: any;
59
+ keepSubheaderVisible: boolean;
60
+ loading: boolean;
61
+ empty: boolean;
62
+ noDataIcon: string;
63
+ noDataTitle: string;
64
+ noDataSubtitle: string;
65
+ withAnimation: boolean;
66
+ typeSwitcher: boolean;
67
+ height: string;
68
+ compactHeader: boolean;
69
+ tooltipRespectsTopEdge: boolean;
70
+ tooltipTotalType: TotalType;
71
+ tooltipTotalCalcFn: (values: number[], totalType: TotalType) => number;
72
+ tooltipOrder: TooltipOrder;
73
+ trendValue: any;
74
+ trendDirection: TrendDirection;
75
+ trendTooltip: any;
76
+ totalsChart: boolean;
77
+ colorsMap: () => {};
78
+ valueSuffix: string;
79
+ valuePrefix: string;
80
+ }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
81
+ "update:chartType": (chartType: ChartType) => void;
82
+ }, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
83
+ dataSets: ChartDataSet[];
84
+ visibleIds: unknown[];
85
+ highlightedId?: string | number;
86
+ chartType?: ChartType;
87
+ parsing?: ChartParsingConfig;
88
+ xAxisFormat?: ValueFormat;
89
+ yAxisFormat?: ValueFormat;
90
+ xAxisDateInterval?: DateInterval;
91
+ tickCount?: number;
92
+ truncateTickLabels?: boolean;
93
+ header?: string;
94
+ subheader?: string;
95
+ subheaderTooltip?: {
96
+ header?: string;
97
+ text?: string;
98
+ };
99
+ keepSubheaderVisible?: boolean;
100
+ loading?: boolean;
101
+ empty?: boolean;
102
+ noDataIcon?: string;
103
+ noDataTitle?: string;
104
+ noDataSubtitle?: string;
105
+ withAnimation?: boolean;
106
+ typeSwitcher?: boolean;
107
+ height?: string;
108
+ compactHeader?: boolean;
109
+ tooltipRespectsTopEdge?: boolean;
110
+ tooltipTotalType?: TotalType;
111
+ tooltipTotalCalcFn?: (values: number[], totalType: TotalType) => number;
112
+ tooltipOrder?: TooltipOrder;
113
+ trendValue?: string | number;
114
+ trendDirection?: TrendDirection;
115
+ trendTooltip?: {
116
+ header?: string;
117
+ rangeCurrent?: string;
118
+ rangePrevious?: string;
119
+ };
120
+ totalsChart?: boolean;
121
+ colorsMap: Record<string, string>;
122
+ valueSuffix?: string;
123
+ valuePrefix?: string;
124
+ }>, {
125
+ chartType: ChartType;
126
+ dataSets: () => any[];
127
+ visibleIds: () => any[];
128
+ highlightedId: any;
129
+ xAxisFormat: string;
130
+ yAxisFormat: string;
131
+ xAxisDateInterval: DateInterval;
132
+ parsing: any;
133
+ tickCount: number;
134
+ truncateTickLabels: boolean;
135
+ header: string;
136
+ subheader: string;
137
+ subheaderTooltip: any;
138
+ keepSubheaderVisible: boolean;
139
+ loading: boolean;
140
+ empty: boolean;
141
+ noDataIcon: string;
142
+ noDataTitle: string;
143
+ noDataSubtitle: string;
144
+ withAnimation: boolean;
145
+ typeSwitcher: boolean;
146
+ height: string;
147
+ compactHeader: boolean;
148
+ tooltipRespectsTopEdge: boolean;
149
+ tooltipTotalType: TotalType;
150
+ tooltipTotalCalcFn: (values: number[], totalType: TotalType) => number;
151
+ tooltipOrder: TooltipOrder;
152
+ trendValue: any;
153
+ trendDirection: TrendDirection;
154
+ trendTooltip: any;
155
+ totalsChart: boolean;
156
+ colorsMap: () => {};
157
+ valueSuffix: string;
158
+ valuePrefix: string;
159
+ }>>> & {
160
+ "onUpdate:chartType"?: (chartType: ChartType) => any;
161
+ }, {
162
+ header: string;
163
+ height: string;
164
+ loading: boolean;
165
+ visibleIds: unknown[];
166
+ highlightedId: string | number;
167
+ chartType: ChartType;
168
+ xAxisFormat: ValueFormat;
169
+ xAxisDateInterval: DateInterval;
170
+ totalsChart: boolean;
171
+ parsing: ChartParsingConfig;
172
+ yAxisFormat: ValueFormat;
173
+ valueSuffix: string;
174
+ valuePrefix: string;
175
+ dataSets: ChartDataSet[];
176
+ trendTooltip: any;
177
+ subheader: string;
178
+ subheaderTooltip: any;
179
+ typeSwitcher: boolean;
180
+ trendValue: string | number;
181
+ trendDirection: TrendDirection;
182
+ tickCount: number;
183
+ truncateTickLabels: boolean;
184
+ keepSubheaderVisible: boolean;
185
+ empty: boolean;
186
+ noDataIcon: string;
187
+ noDataTitle: string;
188
+ noDataSubtitle: string;
189
+ withAnimation: boolean;
190
+ compactHeader: boolean;
191
+ tooltipRespectsTopEdge: boolean;
192
+ tooltipTotalType: TotalType;
193
+ tooltipTotalCalcFn: (values: number[], totalType: TotalType) => number;
194
+ tooltipOrder: TooltipOrder;
195
+ colorsMap: Record<string, string>;
196
+ }>, {
197
+ "subheader-tooltip"?(_: {}): any;
198
+ }>;
199
+ export default _default;
200
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
201
+ type __VLS_TypePropsToRuntimeProps<T> = {
202
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
203
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
204
+ } : {
205
+ type: import('vue').PropType<T[K]>;
206
+ required: true;
207
+ };
208
+ };
209
+ type __VLS_WithDefaults<P, D> = {
210
+ [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
211
+ default: D[K];
212
+ }> : P[K];
213
+ };
214
+ type __VLS_Prettify<T> = {
215
+ [K in keyof T]: T[K];
216
+ } & {};
217
+ type __VLS_WithTemplateSlots<T, S> = T & {
218
+ new (): {
219
+ $slots: S;
220
+ };
221
+ };
@@ -0,0 +1,7 @@
1
+ import e from "./ChartPlane.vue2.js";
2
+ /* empty css */import o from "../../_virtual/_plugin-vue_export-helper.js";
3
+ // import "../../ChartPlane.vue_vue_type_style_index_0_scoped_903fc6ae_lang.css"; //*');
4
+ const s = /* @__PURE__ */ o(e, [["__scopeId", "data-v-903fc6ae"]]);
5
+ export {
6
+ s as default
7
+ };
@@ -0,0 +1,368 @@
1
+ import "../../ChartPlane.vue_vue_type_style_index_0_scoped_903fc6ae_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 f, createElementBlock as S, createVNode as ue, isRef as ce, createSlots as de, withCtx as pe, renderSlot as fe, createCommentVNode as A, createElementVNode as L, normalizeStyle as he, createBlock as E } from "vue";
2
+ import { Chart as N, ArcElement as me, LineElement as ve, BarElement as ye, PointElement as Te, LineController as Ce, BarController as be, PieController as ge, ScatterController as xe, CategoryScale as ke, LinearScale as Se, Filler as Ae, 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 De } from "./utils/utils.js";
5
+ import { DEFAULT_TICK_COUNT as Oe, TOTALS_HELPER_KEY as F, BASE_COLOR_KEY as K, CHART_PADDING as Ie, 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 Pe, HOVER_AREA_TRANSPARENCY as Ne, HOVER_TRANSPARENCY as C } from "./consts.js";
6
+ import { ChartType as u, DateInterval as Fe, TooltipOrder as Y, TrendDirection as Ke } from "./types.js";
7
+ import { useTooltipPosition as Me } from "./composables/useTooltipPosition.js";
8
+ import Ue from "./ChartTooltip.vue.js";
9
+ import { hexColorToRgba as h } from "../../utils/color.js";
10
+ import { useChartValues as ze } from "./composables/useChartValues.js";
11
+ import Ye from "./ChartHeader.vue.js";
12
+ import { useMemoize as _e, useVModel as Ge } from "@vueuse/core";
13
+ import $e from "../emptyState/v4/EmptyStateV4.vue.js";
14
+ import We from "./ChartLoader.vue.js";
15
+ import { DEFAULT_CHART_COLOR as Ze } from "./colorPalette.js";
16
+ import { TotalType as _, calculateTotal as Xe } from "../../utils/totals.js";
17
+ import { isNullOrUndefined as je } from "../../utils/utils.js";
18
+ import { storeOriginalDatasetColors as qe, restoreOriginalDatasetColors as Je } from "./utils/highlightUtils.js";
19
+ const Qe = { class: "chart-plane-container" }, et = {
20
+ key: 0,
21
+ class: "header-wrapper"
22
+ }, tt = {
23
+ key: 1,
24
+ class: "chart-plane"
25
+ }, at = { class: "chart" }, gt = /* @__PURE__ */ re({
26
+ __name: "ChartPlane",
27
+ props: {
28
+ dataSets: { default: () => [] },
29
+ visibleIds: { default: () => [] },
30
+ highlightedId: { default: null },
31
+ chartType: { default: u.Line },
32
+ parsing: { default: void 0 },
33
+ xAxisFormat: { default: "string" },
34
+ yAxisFormat: { default: "number" },
35
+ xAxisDateInterval: { default: Fe.DAILY },
36
+ tickCount: { default: Oe },
37
+ truncateTickLabels: { type: Boolean, default: !1 },
38
+ header: { default: "" },
39
+ subheader: { default: "" },
40
+ subheaderTooltip: { default: null },
41
+ keepSubheaderVisible: { type: Boolean, default: !1 },
42
+ loading: { type: Boolean, default: !1 },
43
+ empty: { type: Boolean, default: !1 },
44
+ noDataIcon: { default: "file-search" },
45
+ noDataTitle: { default: "No data to display" },
46
+ noDataSubtitle: { default: "Search again with different filters" },
47
+ withAnimation: { type: Boolean, default: !0 },
48
+ typeSwitcher: { type: Boolean, default: !0 },
49
+ height: { default: "100%" },
50
+ compactHeader: { type: Boolean, default: !1 },
51
+ tooltipRespectsTopEdge: { type: Boolean, default: !0 },
52
+ tooltipTotalType: { default: _.Total },
53
+ tooltipTotalCalcFn: { type: Function, default: Xe },
54
+ tooltipOrder: { default: Y.Legend },
55
+ trendValue: { default: null },
56
+ trendDirection: { default: Ke.UP },
57
+ trendTooltip: { default: null },
58
+ totalsChart: { type: Boolean, default: !1 },
59
+ colorsMap: { default: () => ({}) },
60
+ valueSuffix: { default: "" },
61
+ valuePrefix: { default: "" }
62
+ },
63
+ emits: ["update:chartType"],
64
+ setup(o, { emit: G }) {
65
+ const e = o;
66
+ ie((t) => ({
67
+ d271311a: s(ee),
68
+ "6c5bc85e": o.height
69
+ }));
70
+ const $ = _e(Re);
71
+ N.register(
72
+ me,
73
+ ve,
74
+ ye,
75
+ Te,
76
+ Ce,
77
+ be,
78
+ ge,
79
+ xe,
80
+ ke,
81
+ Se,
82
+ Ae,
83
+ Le,
84
+ Ee
85
+ );
86
+ const b = Ge(e, "chartType", G), W = l(
87
+ () => e.withAnimation ? "" : "none"
88
+ ), m = k(null);
89
+ let n = null;
90
+ const R = l(() => e.empty || e.dataSets.length === 0), d = l(() => !e.loading && !R.value), g = () => {
91
+ m.value && (n && n.destroy(), n = new N(m.value, I.value));
92
+ }, Z = () => {
93
+ n && (n.data.datasets = O.value, n.options = I.value.options, n.update(W.value));
94
+ };
95
+ ne(g), T(() => e.chartType, g), T(d, async (t) => {
96
+ t && (await se(), g());
97
+ }), T([() => e.visibleIds, () => e.dataSets], Z);
98
+ const p = l(() => e.totalsChart), v = l(
99
+ () => e.chartType === u.StackedLine || e.chartType === u.StackedBar || p.value
100
+ ), x = l(
101
+ () => e.chartType === u.Line || e.chartType === u.StackedLine
102
+ ), B = l(() => p.value && !e.parsing.xAxisKey ? { ...e.parsing, xAxisKey: F } : e.parsing), X = l(() => p.value ? e.dataSets.map((t) => ({
103
+ ...t,
104
+ data: t.data.map((i) => ({
105
+ ...i,
106
+ [F]: t.label
107
+ }))
108
+ })) : e.dataSets), y = l(
109
+ () => X.value.filter((t) => e.visibleIds.includes(t.id))
110
+ ), j = (t) => e.colorsMap[t] || Ze, D = l(
111
+ () => y.value.length && y.value.every(
112
+ (t) => t.data.length === 1
113
+ )
114
+ ), O = l(() => y.value.map((t, i) => {
115
+ const a = j(t.id), r = v.value ? i !== 0 ? "-1" : "start" : void 0;
116
+ return {
117
+ ...t,
118
+ fill: r,
119
+ backgroundColor: h(
120
+ a,
121
+ e.chartType === u.StackedLine ? 10 : 70
122
+ ),
123
+ borderColor: a,
124
+ pointBackgroundColor: a,
125
+ pointHoverBorderColor: a,
126
+ maxBarThickness: 50,
127
+ clip: 5,
128
+ // draw a bit outside the chart area
129
+ icon: t.icon || null,
130
+ iconType: t.iconType || "branded",
131
+ [K]: a
132
+ // store base color for later use
133
+ };
134
+ })), q = l(
135
+ () => e.tooltipTotalType === _.Total ? "Total" : "Mean"
136
+ ), I = l(() => ({
137
+ type: e.chartType == u.Bar || e.chartType === u.StackedBar ? "bar" : "line",
138
+ // Chart Data
139
+ data: {
140
+ datasets: O.value
141
+ },
142
+ // Chart Options
143
+ options: {
144
+ parsing: B.value,
145
+ interaction: {
146
+ intersect: !1,
147
+ mode: p.value ? "point" : "index",
148
+ axis: "x"
149
+ },
150
+ // plugins
151
+ plugins: {
152
+ legend: { display: !1 },
153
+ title: { display: !1 },
154
+ hoverVerticalLine: x.value,
155
+ // tooltip
156
+ tooltip: {
157
+ enabled: !1,
158
+ position: "average",
159
+ external: ({ tooltip: t }) => {
160
+ c.value = { ...t };
161
+ },
162
+ callbacks: {
163
+ footer: (t) => {
164
+ const i = t.map((r) => r.parsed.y || 0), a = e.tooltipTotalCalcFn(
165
+ i,
166
+ e.tooltipTotalType
167
+ );
168
+ return [q.value, String(a)];
169
+ }
170
+ },
171
+ itemSort: (t, i) => {
172
+ if (e.tooltipOrder === Y.YAxis) {
173
+ const a = t.parsed.y || 0, r = i.parsed.y || 0;
174
+ return a === r ? 0 : a > r ? -1 : 1;
175
+ }
176
+ return 0;
177
+ }
178
+ }
179
+ },
180
+ // chart layout
181
+ responsive: !0,
182
+ maintainAspectRatio: !1,
183
+ layout: {
184
+ padding: Ie
185
+ },
186
+ // basic styles
187
+ elements: {
188
+ line: {
189
+ borderWidth: 2,
190
+ tension: 0.3
191
+ },
192
+ point: {
193
+ radius: D.value ? 3 : 1,
194
+ hitRadius: 8,
195
+ borderWidth: 0,
196
+ hoverRadius: 4,
197
+ hoverBorderWidth: 2,
198
+ pointHoverBackgroundColor: He
199
+ },
200
+ bar: {
201
+ borderRadius: 4
202
+ }
203
+ },
204
+ scales: {
205
+ // Horizontal Axis (X)
206
+ x: {
207
+ beginAtZero: !0,
208
+ offset: !x.value || D.value,
209
+ border: { display: !1 },
210
+ stacked: v.value,
211
+ // stack on top of each other
212
+ // ticks
213
+ ticks: {
214
+ color: M,
215
+ font: U,
216
+ padding: 4,
217
+ maxRotation: 0,
218
+ autoSkip: !e.truncateTickLabels,
219
+ autoSkipPadding: 8,
220
+ callback: function(t, i, a) {
221
+ const r = this.getLabelForValue(t), oe = x.value && !p.value ? a.length - 1 : a.length, le = this.chart.scales?.x?.width / oe - Ve;
222
+ return $({
223
+ label: r,
224
+ format: e.xAxisFormat,
225
+ availableSpace: le,
226
+ truncate: e.truncateTickLabels
227
+ });
228
+ }
229
+ },
230
+ // grid lines
231
+ grid: {
232
+ color: z,
233
+ drawOnChartArea: !1,
234
+ drawTicks: !0,
235
+ drawBorder: !1,
236
+ tickLength: 7
237
+ }
238
+ },
239
+ // Vertical Axis (Y)
240
+ y: {
241
+ beginAtZero: !0,
242
+ border: { display: !1 },
243
+ // hide left borderline
244
+ stacked: v.value,
245
+ // stack on top of each other
246
+ // ticks
247
+ ticks: {
248
+ color: M,
249
+ font: U,
250
+ padding: 8,
251
+ stepSize: P.value,
252
+ min: w.value,
253
+ max: P.value * e.tickCount,
254
+ callback: (t) => Be(t, e.yAxisFormat)
255
+ },
256
+ // grid lines
257
+ grid: {
258
+ color: z,
259
+ drawOnChartArea: !0,
260
+ drawTicks: !1
261
+ }
262
+ }
263
+ }
264
+ }
265
+ })), H = k(null), c = k(null), { position: V } = Me(
266
+ m,
267
+ H,
268
+ c,
269
+ e.tooltipRespectsTopEdge
270
+ ), J = l(() => ({
271
+ left: `${V.value.left}px`,
272
+ top: `${V.value.top}px`,
273
+ opacity: c.value?.opacity || 0
274
+ })), { minValue: w, maxValue: Q } = ze({
275
+ parsingConfig: B.value,
276
+ dataSets: y,
277
+ isStacked: v
278
+ }), P = l(
279
+ () => De(w.value, Q.value, e.tickCount)
280
+ ), ee = l(
281
+ () => (e.compactHeader ? Pe : we) + "px"
282
+ );
283
+ T(
284
+ () => e.highlightedId,
285
+ (t) => {
286
+ n && (je(t) ? ae() : te(t), n.update());
287
+ }
288
+ );
289
+ const te = (t) => {
290
+ (n?.data.datasets || []).forEach((a) => {
291
+ qe(a);
292
+ const r = a[K];
293
+ a.id === t ? e.chartType === u.StackedLine && (a.backgroundColor = h(
294
+ r,
295
+ Ne
296
+ )) : (a.backgroundColor = h(r, C), a.borderColor = h(r, C), a.pointBackgroundColor = h(r, C), a.pointHoverBorderColor = h(r, C));
297
+ });
298
+ }, ae = () => {
299
+ (n?.data.datasets || []).forEach(Je);
300
+ };
301
+ return (t, i) => (f(), S("div", Qe, [
302
+ s(d) || o.keepSubheaderVisible ? (f(), S("div", et, [
303
+ ue(Ye, {
304
+ "chart-type": s(b),
305
+ "onUpdate:chart-type": i[0] || (i[0] = (a) => ce(b) ? b.value = a : null),
306
+ "type-switcher": s(d) ? o.typeSwitcher : !1,
307
+ header: s(d) ? o.header : null,
308
+ subheader: o.subheader,
309
+ "subheader-tooltip": o.subheaderTooltip,
310
+ "trend-tooltip": o.trendTooltip,
311
+ compact: o.compactHeader,
312
+ "trend-value": s(d) ? o.trendValue : null,
313
+ "trend-direction": o.trendDirection
314
+ }, de({ _: 2 }, [
315
+ t.$slots["subheader-tooltip"] ? {
316
+ name: "subheader-tooltip",
317
+ fn: pe(() => [
318
+ fe(t.$slots, "subheader-tooltip", {}, void 0, !0)
319
+ ]),
320
+ key: "0"
321
+ } : void 0
322
+ ]), 1032, ["chart-type", "type-switcher", "header", "subheader", "subheader-tooltip", "trend-tooltip", "compact", "trend-value", "trend-direction"])
323
+ ])) : A("", !0),
324
+ s(d) ? (f(), S("section", tt, [
325
+ L("div", at, [
326
+ L("canvas", {
327
+ ref_key: "chartRef",
328
+ ref: m,
329
+ class: "chart__canvas"
330
+ }, null, 512),
331
+ L("div", {
332
+ ref_key: "tooltipRef",
333
+ ref: H,
334
+ class: "chart__tooltip",
335
+ style: he(s(J))
336
+ }, [
337
+ c.value ? (f(), E(Ue, {
338
+ key: 0,
339
+ "totals-chart": s(p),
340
+ title: String(c.value.title),
341
+ "data-points": c.value.dataPoints,
342
+ "x-axis-format": o.xAxisFormat,
343
+ "y-axis-format": o.yAxisFormat,
344
+ "x-axis-date-interval": o.xAxisDateInterval,
345
+ "total-label": c.value.footer?.[0],
346
+ "total-value": Number(c.value.footer?.[1]),
347
+ "value-suffix": o.valueSuffix,
348
+ "value-prefix": o.valuePrefix
349
+ }, null, 8, ["totals-chart", "title", "data-points", "x-axis-format", "y-axis-format", "x-axis-date-interval", "total-label", "total-value", "value-suffix", "value-prefix"])) : A("", !0)
350
+ ], 4)
351
+ ])
352
+ ])) : o.loading ? (f(), E(We, {
353
+ key: 2,
354
+ class: "chart-loading"
355
+ })) : s(R) ? (f(), E(s($e), {
356
+ key: 3,
357
+ class: "chart-empty",
358
+ variant: null,
359
+ title: o.noDataTitle,
360
+ subtitle: o.noDataSubtitle,
361
+ "icon-name": o.noDataIcon
362
+ }, null, 8, ["title", "subtitle", "icon-name"])) : A("", !0)
363
+ ]));
364
+ }
365
+ });
366
+ export {
367
+ gt as default
368
+ };