@testgorilla/tgo-ui 11.22.3 → 12.0.1

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 (225) hide show
  1. package/fesm2022/testgorilla-tgo-ui-components-accordion.mjs +335 -229
  2. package/fesm2022/testgorilla-tgo-ui-components-accordion.mjs.map +1 -1
  3. package/fesm2022/testgorilla-tgo-ui-components-ai-audio-circle.mjs +547 -465
  4. package/fesm2022/testgorilla-tgo-ui-components-ai-audio-circle.mjs.map +1 -1
  5. package/fesm2022/testgorilla-tgo-ui-components-ai-caveat.mjs +160 -75
  6. package/fesm2022/testgorilla-tgo-ui-components-ai-caveat.mjs.map +1 -1
  7. package/fesm2022/testgorilla-tgo-ui-components-ai-feedback.mjs +678 -278
  8. package/fesm2022/testgorilla-tgo-ui-components-ai-feedback.mjs.map +1 -1
  9. package/fesm2022/testgorilla-tgo-ui-components-alert-banner.mjs +337 -274
  10. package/fesm2022/testgorilla-tgo-ui-components-alert-banner.mjs.map +1 -1
  11. package/fesm2022/testgorilla-tgo-ui-components-audio-waveform.mjs +351 -192
  12. package/fesm2022/testgorilla-tgo-ui-components-audio-waveform.mjs.map +1 -1
  13. package/fesm2022/testgorilla-tgo-ui-components-autocomplete-v2.mjs +1950 -960
  14. package/fesm2022/testgorilla-tgo-ui-components-autocomplete-v2.mjs.map +1 -1
  15. package/fesm2022/testgorilla-tgo-ui-components-autocomplete.mjs +1206 -1044
  16. package/fesm2022/testgorilla-tgo-ui-components-autocomplete.mjs.map +1 -1
  17. package/fesm2022/testgorilla-tgo-ui-components-avatar.mjs +328 -182
  18. package/fesm2022/testgorilla-tgo-ui-components-avatar.mjs.map +1 -1
  19. package/fesm2022/testgorilla-tgo-ui-components-badge.mjs +383 -203
  20. package/fesm2022/testgorilla-tgo-ui-components-badge.mjs.map +1 -1
  21. package/fesm2022/testgorilla-tgo-ui-components-breadcrumb.mjs +553 -261
  22. package/fesm2022/testgorilla-tgo-ui-components-breadcrumb.mjs.map +1 -1
  23. package/fesm2022/testgorilla-tgo-ui-components-button.mjs +709 -739
  24. package/fesm2022/testgorilla-tgo-ui-components-button.mjs.map +1 -1
  25. package/fesm2022/testgorilla-tgo-ui-components-card.mjs +219 -184
  26. package/fesm2022/testgorilla-tgo-ui-components-card.mjs.map +1 -1
  27. package/fesm2022/testgorilla-tgo-ui-components-checkbox.mjs +515 -458
  28. package/fesm2022/testgorilla-tgo-ui-components-checkbox.mjs.map +1 -1
  29. package/fesm2022/testgorilla-tgo-ui-components-checklist.mjs +423 -162
  30. package/fesm2022/testgorilla-tgo-ui-components-checklist.mjs.map +1 -1
  31. package/fesm2022/testgorilla-tgo-ui-components-core.mjs +10784 -10996
  32. package/fesm2022/testgorilla-tgo-ui-components-core.mjs.map +1 -1
  33. package/fesm2022/testgorilla-tgo-ui-components-datepicker.mjs +810 -533
  34. package/fesm2022/testgorilla-tgo-ui-components-datepicker.mjs.map +1 -1
  35. package/fesm2022/testgorilla-tgo-ui-components-device-control.mjs +473 -116
  36. package/fesm2022/testgorilla-tgo-ui-components-device-control.mjs.map +1 -1
  37. package/fesm2022/testgorilla-tgo-ui-components-dialog.mjs +1149 -540
  38. package/fesm2022/testgorilla-tgo-ui-components-dialog.mjs.map +1 -1
  39. package/fesm2022/testgorilla-tgo-ui-components-divider.mjs +148 -84
  40. package/fesm2022/testgorilla-tgo-ui-components-divider.mjs.map +1 -1
  41. package/fesm2022/testgorilla-tgo-ui-components-donut-chart.mjs +239 -142
  42. package/fesm2022/testgorilla-tgo-ui-components-donut-chart.mjs.map +1 -1
  43. package/fesm2022/testgorilla-tgo-ui-components-dropdown.mjs +599 -467
  44. package/fesm2022/testgorilla-tgo-ui-components-dropdown.mjs.map +1 -1
  45. package/fesm2022/testgorilla-tgo-ui-components-elevation-shadow.mjs +126 -70
  46. package/fesm2022/testgorilla-tgo-ui-components-elevation-shadow.mjs.map +1 -1
  47. package/fesm2022/testgorilla-tgo-ui-components-empty-state.mjs +324 -329
  48. package/fesm2022/testgorilla-tgo-ui-components-empty-state.mjs.map +1 -1
  49. package/fesm2022/testgorilla-tgo-ui-components-field.mjs +969 -648
  50. package/fesm2022/testgorilla-tgo-ui-components-field.mjs.map +1 -1
  51. package/fesm2022/testgorilla-tgo-ui-components-file-upload.mjs +553 -419
  52. package/fesm2022/testgorilla-tgo-ui-components-file-upload.mjs.map +1 -1
  53. package/fesm2022/testgorilla-tgo-ui-components-filter-button.mjs +847 -452
  54. package/fesm2022/testgorilla-tgo-ui-components-filter-button.mjs.map +1 -1
  55. package/fesm2022/testgorilla-tgo-ui-components-gaussian-chart.mjs +398 -302
  56. package/fesm2022/testgorilla-tgo-ui-components-gaussian-chart.mjs.map +1 -1
  57. package/fesm2022/testgorilla-tgo-ui-components-icon-label.mjs +162 -95
  58. package/fesm2022/testgorilla-tgo-ui-components-icon-label.mjs.map +1 -1
  59. package/fesm2022/testgorilla-tgo-ui-components-icon.mjs +1825 -1795
  60. package/fesm2022/testgorilla-tgo-ui-components-icon.mjs.map +1 -1
  61. package/fesm2022/testgorilla-tgo-ui-components-infinite-scroll-table.mjs +1018 -672
  62. package/fesm2022/testgorilla-tgo-ui-components-infinite-scroll-table.mjs.map +1 -1
  63. package/fesm2022/testgorilla-tgo-ui-components-inline-field.mjs +758 -368
  64. package/fesm2022/testgorilla-tgo-ui-components-inline-field.mjs.map +1 -1
  65. package/fesm2022/testgorilla-tgo-ui-components-logo.mjs +204 -212
  66. package/fesm2022/testgorilla-tgo-ui-components-logo.mjs.map +1 -1
  67. package/fesm2022/testgorilla-tgo-ui-components-media-card.mjs +183 -48
  68. package/fesm2022/testgorilla-tgo-ui-components-media-card.mjs.map +1 -1
  69. package/fesm2022/testgorilla-tgo-ui-components-media-dialog.mjs +243 -79
  70. package/fesm2022/testgorilla-tgo-ui-components-media-dialog.mjs.map +1 -1
  71. package/fesm2022/testgorilla-tgo-ui-components-multi-input.mjs +751 -361
  72. package/fesm2022/testgorilla-tgo-ui-components-multi-input.mjs.map +1 -1
  73. package/fesm2022/testgorilla-tgo-ui-components-navbar.mjs +1122 -385
  74. package/fesm2022/testgorilla-tgo-ui-components-navbar.mjs.map +1 -1
  75. package/fesm2022/testgorilla-tgo-ui-components-overflow-menu.mjs +689 -413
  76. package/fesm2022/testgorilla-tgo-ui-components-overflow-menu.mjs.map +1 -1
  77. package/fesm2022/testgorilla-tgo-ui-components-page-header.mjs +227 -92
  78. package/fesm2022/testgorilla-tgo-ui-components-page-header.mjs.map +1 -1
  79. package/fesm2022/testgorilla-tgo-ui-components-paginator.mjs +174 -113
  80. package/fesm2022/testgorilla-tgo-ui-components-paginator.mjs.map +1 -1
  81. package/fesm2022/testgorilla-tgo-ui-components-password-criteria.mjs +367 -165
  82. package/fesm2022/testgorilla-tgo-ui-components-password-criteria.mjs.map +1 -1
  83. package/fesm2022/testgorilla-tgo-ui-components-password-strength.mjs +253 -118
  84. package/fesm2022/testgorilla-tgo-ui-components-password-strength.mjs.map +1 -1
  85. package/fesm2022/testgorilla-tgo-ui-components-phone-input.mjs +730 -444
  86. package/fesm2022/testgorilla-tgo-ui-components-phone-input.mjs.map +1 -1
  87. package/fesm2022/testgorilla-tgo-ui-components-popover.mjs +533 -221
  88. package/fesm2022/testgorilla-tgo-ui-components-popover.mjs.map +1 -1
  89. package/fesm2022/testgorilla-tgo-ui-components-popup-tip.mjs +274 -76
  90. package/fesm2022/testgorilla-tgo-ui-components-popup-tip.mjs.map +1 -1
  91. package/fesm2022/testgorilla-tgo-ui-components-progress-bar.mjs +184 -124
  92. package/fesm2022/testgorilla-tgo-ui-components-progress-bar.mjs.map +1 -1
  93. package/fesm2022/testgorilla-tgo-ui-components-prompt.mjs +1223 -574
  94. package/fesm2022/testgorilla-tgo-ui-components-prompt.mjs.map +1 -1
  95. package/fesm2022/testgorilla-tgo-ui-components-radial-progress.mjs +249 -160
  96. package/fesm2022/testgorilla-tgo-ui-components-radial-progress.mjs.map +1 -1
  97. package/fesm2022/testgorilla-tgo-ui-components-radio-button.mjs +447 -439
  98. package/fesm2022/testgorilla-tgo-ui-components-radio-button.mjs.map +1 -1
  99. package/fesm2022/testgorilla-tgo-ui-components-rating.mjs +226 -150
  100. package/fesm2022/testgorilla-tgo-ui-components-rating.mjs.map +1 -1
  101. package/fesm2022/testgorilla-tgo-ui-components-scale-table.mjs +255 -67
  102. package/fesm2022/testgorilla-tgo-ui-components-scale-table.mjs.map +1 -1
  103. package/fesm2022/testgorilla-tgo-ui-components-scale.mjs +205 -162
  104. package/fesm2022/testgorilla-tgo-ui-components-scale.mjs.map +1 -1
  105. package/fesm2022/testgorilla-tgo-ui-components-segmented-bar.mjs +245 -153
  106. package/fesm2022/testgorilla-tgo-ui-components-segmented-bar.mjs.map +1 -1
  107. package/fesm2022/testgorilla-tgo-ui-components-segmented-button.mjs +274 -140
  108. package/fesm2022/testgorilla-tgo-ui-components-segmented-button.mjs.map +1 -1
  109. package/fesm2022/testgorilla-tgo-ui-components-segmented-toggle.mjs +319 -147
  110. package/fesm2022/testgorilla-tgo-ui-components-segmented-toggle.mjs.map +1 -1
  111. package/fesm2022/testgorilla-tgo-ui-components-selectable-card.mjs +286 -84
  112. package/fesm2022/testgorilla-tgo-ui-components-selectable-card.mjs.map +1 -1
  113. package/fesm2022/testgorilla-tgo-ui-components-side-navigation.mjs +660 -208
  114. package/fesm2022/testgorilla-tgo-ui-components-side-navigation.mjs.map +1 -1
  115. package/fesm2022/testgorilla-tgo-ui-components-side-panel.mjs +579 -320
  116. package/fesm2022/testgorilla-tgo-ui-components-side-panel.mjs.map +1 -1
  117. package/fesm2022/testgorilla-tgo-ui-components-side-sheet.mjs +419 -200
  118. package/fesm2022/testgorilla-tgo-ui-components-side-sheet.mjs.map +1 -1
  119. package/fesm2022/testgorilla-tgo-ui-components-skeleton.mjs +132 -80
  120. package/fesm2022/testgorilla-tgo-ui-components-skeleton.mjs.map +1 -1
  121. package/fesm2022/testgorilla-tgo-ui-components-slider.mjs +741 -390
  122. package/fesm2022/testgorilla-tgo-ui-components-slider.mjs.map +1 -1
  123. package/fesm2022/testgorilla-tgo-ui-components-snackbar.mjs +455 -329
  124. package/fesm2022/testgorilla-tgo-ui-components-snackbar.mjs.map +1 -1
  125. package/fesm2022/testgorilla-tgo-ui-components-spider-chart.mjs +543 -514
  126. package/fesm2022/testgorilla-tgo-ui-components-spider-chart.mjs.map +1 -1
  127. package/fesm2022/testgorilla-tgo-ui-components-spinner.mjs +193 -104
  128. package/fesm2022/testgorilla-tgo-ui-components-spinner.mjs.map +1 -1
  129. package/fesm2022/testgorilla-tgo-ui-components-stepper.mjs +760 -524
  130. package/fesm2022/testgorilla-tgo-ui-components-stepper.mjs.map +1 -1
  131. package/fesm2022/testgorilla-tgo-ui-components-table.mjs +714 -415
  132. package/fesm2022/testgorilla-tgo-ui-components-table.mjs.map +1 -1
  133. package/fesm2022/testgorilla-tgo-ui-components-tabs.mjs +847 -438
  134. package/fesm2022/testgorilla-tgo-ui-components-tabs.mjs.map +1 -1
  135. package/fesm2022/testgorilla-tgo-ui-components-tag.mjs +535 -275
  136. package/fesm2022/testgorilla-tgo-ui-components-tag.mjs.map +1 -1
  137. package/fesm2022/testgorilla-tgo-ui-components-toggle.mjs +316 -246
  138. package/fesm2022/testgorilla-tgo-ui-components-toggle.mjs.map +1 -1
  139. package/fesm2022/testgorilla-tgo-ui-components-tooltip.mjs +404 -284
  140. package/fesm2022/testgorilla-tgo-ui-components-tooltip.mjs.map +1 -1
  141. package/fesm2022/testgorilla-tgo-ui-components-universal-skills.mjs +664 -383
  142. package/fesm2022/testgorilla-tgo-ui-components-universal-skills.mjs.map +1 -1
  143. package/fesm2022/testgorilla-tgo-ui-components-validation-error.mjs +201 -112
  144. package/fesm2022/testgorilla-tgo-ui-components-validation-error.mjs.map +1 -1
  145. package/fesm2022/testgorilla-tgo-ui-components-write-with-ai.mjs +1014 -458
  146. package/fesm2022/testgorilla-tgo-ui-components-write-with-ai.mjs.map +1 -1
  147. package/fesm2022/testgorilla-tgo-ui.mjs +147 -155
  148. package/fesm2022/testgorilla-tgo-ui.mjs.map +1 -1
  149. package/mcp/catalog.json +1 -1
  150. package/package.json +16 -17
  151. package/projects/tgo-canopy-ui/theme/_palette.scss +23 -18
  152. package/types/testgorilla-tgo-ui-components-accordion.d.ts +214 -158
  153. package/types/testgorilla-tgo-ui-components-ai-audio-circle.d.ts +93 -69
  154. package/types/testgorilla-tgo-ui-components-ai-caveat.d.ts +37 -34
  155. package/types/testgorilla-tgo-ui-components-ai-feedback.d.ts +126 -86
  156. package/types/testgorilla-tgo-ui-components-alert-banner.d.ts +260 -185
  157. package/types/testgorilla-tgo-ui-components-audio-waveform.d.ts +96 -67
  158. package/types/testgorilla-tgo-ui-components-autocomplete-v2.d.ts +455 -256
  159. package/types/testgorilla-tgo-ui-components-autocomplete.d.ts +545 -390
  160. package/types/testgorilla-tgo-ui-components-avatar.d.ts +128 -102
  161. package/types/testgorilla-tgo-ui-components-badge.d.ts +191 -139
  162. package/types/testgorilla-tgo-ui-components-breadcrumb.d.ts +100 -62
  163. package/types/testgorilla-tgo-ui-components-button.d.ts +479 -340
  164. package/types/testgorilla-tgo-ui-components-card.d.ts +153 -114
  165. package/types/testgorilla-tgo-ui-components-checkbox.d.ts +299 -223
  166. package/types/testgorilla-tgo-ui-components-checklist.d.ts +149 -97
  167. package/types/testgorilla-tgo-ui-components-core.d.ts +307 -295
  168. package/types/testgorilla-tgo-ui-components-datepicker.d.ts +404 -299
  169. package/types/testgorilla-tgo-ui-components-device-control.d.ts +151 -81
  170. package/types/testgorilla-tgo-ui-components-dialog.d.ts +442 -329
  171. package/types/testgorilla-tgo-ui-components-divider.d.ts +64 -51
  172. package/types/testgorilla-tgo-ui-components-donut-chart.d.ts +41 -37
  173. package/types/testgorilla-tgo-ui-components-dropdown.d.ts +335 -241
  174. package/types/testgorilla-tgo-ui-components-elevation-shadow.d.ts +48 -43
  175. package/types/testgorilla-tgo-ui-components-empty-state.d.ts +317 -215
  176. package/types/testgorilla-tgo-ui-components-field.d.ts +559 -388
  177. package/types/testgorilla-tgo-ui-components-file-upload.d.ts +230 -168
  178. package/types/testgorilla-tgo-ui-components-filter-button.d.ts +263 -206
  179. package/types/testgorilla-tgo-ui-components-gaussian-chart.d.ts +107 -94
  180. package/types/testgorilla-tgo-ui-components-icon-label.d.ts +84 -61
  181. package/types/testgorilla-tgo-ui-components-icon.d.ts +137 -110
  182. package/types/testgorilla-tgo-ui-components-infinite-scroll-table.d.ts +429 -303
  183. package/types/testgorilla-tgo-ui-components-inline-field.d.ts +338 -254
  184. package/types/testgorilla-tgo-ui-components-logo.d.ts +119 -101
  185. package/types/testgorilla-tgo-ui-components-media-card.d.ts +51 -35
  186. package/types/testgorilla-tgo-ui-components-media-dialog.d.ts +40 -45
  187. package/types/testgorilla-tgo-ui-components-multi-input.d.ts +283 -194
  188. package/types/testgorilla-tgo-ui-components-navbar.d.ts +326 -208
  189. package/types/testgorilla-tgo-ui-components-overflow-menu.d.ts +276 -204
  190. package/types/testgorilla-tgo-ui-components-page-header.d.ts +67 -50
  191. package/types/testgorilla-tgo-ui-components-paginator.d.ts +103 -70
  192. package/types/testgorilla-tgo-ui-components-password-criteria.d.ts +67 -58
  193. package/types/testgorilla-tgo-ui-components-password-strength.d.ts +66 -57
  194. package/types/testgorilla-tgo-ui-components-phone-input.d.ts +217 -175
  195. package/types/testgorilla-tgo-ui-components-popover.d.ts +94 -53
  196. package/types/testgorilla-tgo-ui-components-popup-tip.d.ts +81 -44
  197. package/types/testgorilla-tgo-ui-components-progress-bar.d.ts +115 -84
  198. package/types/testgorilla-tgo-ui-components-prompt.d.ts +315 -219
  199. package/types/testgorilla-tgo-ui-components-radial-progress.d.ts +146 -107
  200. package/types/testgorilla-tgo-ui-components-radio-button.d.ts +296 -219
  201. package/types/testgorilla-tgo-ui-components-rating.d.ts +134 -95
  202. package/types/testgorilla-tgo-ui-components-scale-table.d.ts +67 -47
  203. package/types/testgorilla-tgo-ui-components-scale.d.ts +91 -66
  204. package/types/testgorilla-tgo-ui-components-segmented-bar.d.ts +118 -89
  205. package/types/testgorilla-tgo-ui-components-segmented-button.d.ts +107 -80
  206. package/types/testgorilla-tgo-ui-components-segmented-toggle.d.ts +138 -105
  207. package/types/testgorilla-tgo-ui-components-selectable-card.d.ts +90 -56
  208. package/types/testgorilla-tgo-ui-components-side-navigation.d.ts +183 -107
  209. package/types/testgorilla-tgo-ui-components-side-panel.d.ts +156 -145
  210. package/types/testgorilla-tgo-ui-components-side-sheet.d.ts +98 -89
  211. package/types/testgorilla-tgo-ui-components-skeleton.d.ts +50 -33
  212. package/types/testgorilla-tgo-ui-components-slider.d.ts +278 -198
  213. package/types/testgorilla-tgo-ui-components-snackbar.d.ts +211 -159
  214. package/types/testgorilla-tgo-ui-components-spider-chart.d.ts +140 -121
  215. package/types/testgorilla-tgo-ui-components-spinner.d.ts +93 -72
  216. package/types/testgorilla-tgo-ui-components-stepper.d.ts +480 -338
  217. package/types/testgorilla-tgo-ui-components-table.d.ts +280 -233
  218. package/types/testgorilla-tgo-ui-components-tabs.d.ts +282 -183
  219. package/types/testgorilla-tgo-ui-components-tag.d.ts +266 -193
  220. package/types/testgorilla-tgo-ui-components-toggle.d.ts +180 -132
  221. package/types/testgorilla-tgo-ui-components-tooltip.d.ts +142 -105
  222. package/types/testgorilla-tgo-ui-components-universal-skills.d.ts +165 -144
  223. package/types/testgorilla-tgo-ui-components-validation-error.d.ts +70 -51
  224. package/types/testgorilla-tgo-ui-components-write-with-ai.d.ts +210 -133
  225. package/types/testgorilla-tgo-ui.d.ts +52 -45
@@ -1,144 +1,241 @@
1
- import * as i0 from '@angular/core';
2
- import { input, computed, ChangeDetectionStrategy, Component, NgModule } from '@angular/core';
3
- import DataLabelsPlugin from 'chartjs-plugin-datalabels';
4
- import { BaseChartDirective } from 'ng2-charts';
5
- import { Chart, registerables } from 'chart.js';
6
-
7
- class DonutChartComponent {
8
- constructor() {
9
- this.donutChartData = input(...(ngDevMode ? [undefined, { debugName: "donutChartData" }] : /* istanbul ignore next */ []));
10
- this.applicationTheme = input('light', ...(ngDevMode ? [{ debugName: "applicationTheme" }] : /* istanbul ignore next */ []));
11
- this.chartData = computed(() => {
12
- const data = this.donutChartData();
13
- return data
14
- ? {
15
- labels: data.labels,
16
- datasets: [
17
- {
18
- data: data.data,
19
- backgroundColor: data.backgroundColor,
20
- borderWidth: 0,
21
- },
22
- ],
23
- }
24
- : { labels: [], datasets: [] };
25
- }, ...(ngDevMode ? [{ debugName: "chartData" }] : /* istanbul ignore next */ []));
26
- // Plugin to display the total in the center
27
- this.centerTextPlugin = {
28
- id: 'centerText',
29
- beforeDraw: chart => {
30
- const { ctx, chartArea: { width, height }, } = chart;
31
- const total = chart.data.datasets[0].data.reduce((a, b) => a + b, 0);
32
- const padding = 32;
33
- ctx.save();
34
- ctx.font = 'bold 14px ModernGothic';
35
- ctx.fillStyle = '#242424';
36
- ctx.textAlign = 'center';
37
- ctx.textBaseline = 'middle';
38
- ctx.fillText(total.toString(), (width + padding) / 2, (height + padding) / 2);
39
- ctx.restore();
40
- },
41
- };
42
- // Plugin to draw lines from the donut segments to the labels
43
- this.labelLinePlugin = {
44
- id: 'labelLinePlugin',
45
- afterDatasetDraw: chart => {
46
- const { ctx, data } = chart;
47
- const meta = chart.getDatasetMeta(0);
48
- const radialOffset = 10; // length of the radial segment (elbow)
49
- const horizontalLength = 20; // new length of the horizontal segment
50
- const fontSize = 14;
51
- ctx.save();
52
- ctx.strokeStyle = '#666';
53
- ctx.lineWidth = 1;
54
- ctx.font = `${fontSize}px ModernGothic`;
55
- ctx.fillStyle = '#242424';
56
- meta.data.forEach((arc, index) => {
57
- const angle = (arc.startAngle + arc.endAngle) / 2;
58
- const radius = arc.outerRadius;
59
- const centerX = arc.x;
60
- const centerY = arc.y;
61
- // Start point: outer edge of the arc
62
- const startX = centerX + Math.cos(angle) * radius;
63
- const startY = centerY + Math.sin(angle) * radius;
64
- // Elbow: short line outward
65
- const midX = centerX + Math.cos(angle) * (radius + radialOffset);
66
- const midY = centerY + Math.sin(angle) * (radius + radialOffset);
67
- // Extended horizontal line
68
- const direction = Math.cos(angle) >= 0 ? 1 : -1;
69
- const endX = midX + direction * horizontalLength;
70
- const endY = midY;
71
- // Draw line with elbow
72
- ctx.beginPath();
73
- ctx.moveTo(startX, startY);
74
- ctx.lineTo(midX, midY);
75
- ctx.lineTo(endX, endY);
76
- ctx.stroke();
77
- // Draw value at the end
78
- const value = data.datasets[0].data?.[index] ?? '';
79
- const textX = endX + direction * 5;
80
- ctx.textAlign = direction > 0 ? 'left' : 'right';
81
- ctx.textBaseline = 'middle';
82
- ctx.fillText(String(value), textX, endY);
83
- });
84
- ctx.restore();
85
- },
86
- };
87
- this.donutChartPlugins = [DataLabelsPlugin, this.centerTextPlugin, this.labelLinePlugin];
88
- this.donutChartOptions = {
89
- responsive: true,
90
- cutout: '65%',
91
- aspectRatio: 2,
92
- layout: {
93
- padding: 16,
94
- },
95
- plugins: {
96
- legend: {
97
- onClick: () => null, // Disable legend click events
98
- position: 'right',
99
- labels: {
100
- font: {
101
- family: 'ModernGothic',
102
- size: 14,
103
- },
104
- boxWidth: 14,
105
- padding: 20,
106
- },
107
- },
108
- tooltip: {
109
- enabled: false,
110
- },
111
- datalabels: {
112
- display: false,
113
- },
114
- },
115
- };
116
- }
117
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: DonutChartComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
118
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.25", type: DonutChartComponent, isStandalone: true, selector: "ui-donut-chart", inputs: { donutChartData: { classPropertyName: "donutChartData", publicName: "donutChartData", isSignal: true, isRequired: false, transformFunction: null }, applicationTheme: { classPropertyName: "applicationTheme", publicName: "applicationTheme", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<div style=\"height: 200px\">\n <canvas baseChart [data]=\"chartData()\" type=\"doughnut\" [options]=\"donutChartOptions\" [plugins]=\"donutChartPlugins\">\n </canvas>\n</div>\n", styles: [""], dependencies: [{ kind: "directive", type: BaseChartDirective, selector: "canvas[baseChart]", inputs: ["type", "legend", "data", "options", "plugins", "labels", "datasets"], outputs: ["chartClick", "chartHover"], exportAs: ["base-chart"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
119
- }
120
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: DonutChartComponent, decorators: [{
121
- type: Component,
122
- args: [{ selector: 'ui-donut-chart', changeDetection: ChangeDetectionStrategy.OnPush, imports: [BaseChartDirective], template: "<div style=\"height: 200px\">\n <canvas baseChart [data]=\"chartData()\" type=\"doughnut\" [options]=\"donutChartOptions\" [plugins]=\"donutChartPlugins\">\n </canvas>\n</div>\n" }]
123
- }], propDecorators: { donutChartData: [{ type: i0.Input, args: [{ isSignal: true, alias: "donutChartData", required: false }] }], applicationTheme: [{ type: i0.Input, args: [{ isSignal: true, alias: "applicationTheme", required: false }] }] } });
124
-
1
+ import * as i0 from "@angular/core";
2
+ import { ChangeDetectionStrategy, Component, NgModule, computed, input } from "@angular/core";
3
+ import DataLabelsPlugin from "chartjs-plugin-datalabels";
4
+ import { BaseChartDirective } from "ng2-charts";
5
+ import { Chart, registerables } from "chart.js";
6
+ var DonutChartComponent = class DonutChartComponent {
7
+ constructor() {
8
+ this.donutChartData = input(...ngDevMode ? [void 0, { debugName: "donutChartData" }] : /* istanbul ignore next */ []);
9
+ this.applicationTheme = input("light", ...ngDevMode ? [{ debugName: "applicationTheme" }] : /* istanbul ignore next */ []);
10
+ this.chartData = computed(() => {
11
+ const data = this.donutChartData();
12
+ return data ? {
13
+ labels: data.labels,
14
+ datasets: [{
15
+ data: data.data,
16
+ backgroundColor: data.backgroundColor,
17
+ borderWidth: 0
18
+ }]
19
+ } : {
20
+ labels: [],
21
+ datasets: []
22
+ };
23
+ }, ...ngDevMode ? [{ debugName: "chartData" }] : /* istanbul ignore next */ []);
24
+ this.centerTextPlugin = {
25
+ id: "centerText",
26
+ beforeDraw: (chart) => {
27
+ const { ctx, chartArea: { width, height } } = chart;
28
+ const total = chart.data.datasets[0].data.reduce((a, b) => a + b, 0);
29
+ const padding = 32;
30
+ ctx.save();
31
+ ctx.font = "bold 14px ModernGothic";
32
+ ctx.fillStyle = "#242424";
33
+ ctx.textAlign = "center";
34
+ ctx.textBaseline = "middle";
35
+ ctx.fillText(total.toString(), (width + padding) / 2, (height + padding) / 2);
36
+ ctx.restore();
37
+ }
38
+ };
39
+ this.labelLinePlugin = {
40
+ id: "labelLinePlugin",
41
+ afterDatasetDraw: (chart) => {
42
+ const { ctx, data } = chart;
43
+ const meta = chart.getDatasetMeta(0);
44
+ const radialOffset = 10;
45
+ const horizontalLength = 20;
46
+ const fontSize = 14;
47
+ ctx.save();
48
+ ctx.strokeStyle = "#666";
49
+ ctx.lineWidth = 1;
50
+ ctx.font = `${fontSize}px ModernGothic`;
51
+ ctx.fillStyle = "#242424";
52
+ meta.data.forEach((arc, index) => {
53
+ const angle = (arc.startAngle + arc.endAngle) / 2;
54
+ const radius = arc.outerRadius;
55
+ const centerX = arc.x;
56
+ const centerY = arc.y;
57
+ const startX = centerX + Math.cos(angle) * radius;
58
+ const startY = centerY + Math.sin(angle) * radius;
59
+ const midX = centerX + Math.cos(angle) * (radius + radialOffset);
60
+ const midY = centerY + Math.sin(angle) * (radius + radialOffset);
61
+ const direction = Math.cos(angle) >= 0 ? 1 : -1;
62
+ const endX = midX + direction * horizontalLength;
63
+ const endY = midY;
64
+ ctx.beginPath();
65
+ ctx.moveTo(startX, startY);
66
+ ctx.lineTo(midX, midY);
67
+ ctx.lineTo(endX, endY);
68
+ ctx.stroke();
69
+ const value = data.datasets[0].data?.[index] ?? "";
70
+ const textX = endX + direction * 5;
71
+ ctx.textAlign = direction > 0 ? "left" : "right";
72
+ ctx.textBaseline = "middle";
73
+ ctx.fillText(String(value), textX, endY);
74
+ });
75
+ ctx.restore();
76
+ }
77
+ };
78
+ this.donutChartPlugins = [
79
+ DataLabelsPlugin,
80
+ this.centerTextPlugin,
81
+ this.labelLinePlugin
82
+ ];
83
+ this.donutChartOptions = {
84
+ responsive: true,
85
+ cutout: "65%",
86
+ aspectRatio: 2,
87
+ layout: { padding: 16 },
88
+ plugins: {
89
+ legend: {
90
+ onClick: () => null,
91
+ position: "right",
92
+ labels: {
93
+ font: {
94
+ family: "ModernGothic",
95
+ size: 14
96
+ },
97
+ boxWidth: 14,
98
+ padding: 20
99
+ }
100
+ },
101
+ tooltip: { enabled: false },
102
+ datalabels: { display: false }
103
+ }
104
+ };
105
+ }
106
+ static {
107
+ this.ɵfac = i0.ɵɵngDeclareFactory({
108
+ minVersion: "12.0.0",
109
+ version: "22.2.4",
110
+ ngImport: i0,
111
+ type: DonutChartComponent,
112
+ deps: [],
113
+ target: i0.ɵɵFactoryTarget.Component
114
+ });
115
+ }
116
+ static {
117
+ this.ɵcmp = i0.ɵɵngDeclareComponent({
118
+ minVersion: "17.1.0",
119
+ version: "22.2.4",
120
+ type: DonutChartComponent,
121
+ isStandalone: true,
122
+ selector: "ui-donut-chart",
123
+ inputs: {
124
+ donutChartData: {
125
+ classPropertyName: "donutChartData",
126
+ publicName: "donutChartData",
127
+ isSignal: true,
128
+ isRequired: false,
129
+ transformFunction: null
130
+ },
131
+ applicationTheme: {
132
+ classPropertyName: "applicationTheme",
133
+ publicName: "applicationTheme",
134
+ isSignal: true,
135
+ isRequired: false,
136
+ transformFunction: null
137
+ }
138
+ },
139
+ ngImport: i0,
140
+ template: "<div style=\"height: 200px\">\n <canvas baseChart [data]=\"chartData()\" type=\"doughnut\" [options]=\"donutChartOptions\" [plugins]=\"donutChartPlugins\">\n </canvas>\n</div>\n",
141
+ styles: [""],
142
+ dependencies: [{
143
+ kind: "directive",
144
+ type: BaseChartDirective,
145
+ selector: "canvas[baseChart]",
146
+ inputs: [
147
+ "type",
148
+ "legend",
149
+ "data",
150
+ "options",
151
+ "plugins",
152
+ "labels",
153
+ "datasets"
154
+ ],
155
+ outputs: ["chartClick", "chartHover"],
156
+ exportAs: ["base-chart"]
157
+ }],
158
+ changeDetection: i0.ChangeDetectionStrategy.OnPush
159
+ });
160
+ }
161
+ };
162
+ i0.ɵɵngDeclareClassMetadata({
163
+ minVersion: "12.0.0",
164
+ version: "22.2.4",
165
+ ngImport: i0,
166
+ type: DonutChartComponent,
167
+ decorators: [{
168
+ type: Component,
169
+ args: [{
170
+ selector: "ui-donut-chart",
171
+ changeDetection: ChangeDetectionStrategy.OnPush,
172
+ imports: [BaseChartDirective],
173
+ template: "<div style=\"height: 200px\">\n <canvas baseChart [data]=\"chartData()\" type=\"doughnut\" [options]=\"donutChartOptions\" [plugins]=\"donutChartPlugins\">\n </canvas>\n</div>\n"
174
+ }]
175
+ }],
176
+ propDecorators: {
177
+ donutChartData: [{
178
+ type: i0.Input,
179
+ args: [{
180
+ isSignal: true,
181
+ alias: "donutChartData",
182
+ required: false
183
+ }]
184
+ }],
185
+ applicationTheme: [{
186
+ type: i0.Input,
187
+ args: [{
188
+ isSignal: true,
189
+ alias: "applicationTheme",
190
+ required: false
191
+ }]
192
+ }]
193
+ }
194
+ });
125
195
  Chart.register(...registerables);
126
- class DonutChartComponentModule {
127
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: DonutChartComponentModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
128
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.2.25", ngImport: i0, type: DonutChartComponentModule, imports: [BaseChartDirective, DonutChartComponent], exports: [DonutChartComponent] }); }
129
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: DonutChartComponentModule }); }
130
- }
131
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: DonutChartComponentModule, decorators: [{
132
- type: NgModule,
133
- args: [{
134
- exports: [DonutChartComponent],
135
- imports: [BaseChartDirective, DonutChartComponent],
136
- }]
137
- }] });
138
-
139
- /**
140
- * Generated bundle index. Do not edit.
141
- */
142
-
196
+ var DonutChartComponentModule = class DonutChartComponentModule {
197
+ static {
198
+ this.ɵfac = i0.ɵɵngDeclareFactory({
199
+ minVersion: "12.0.0",
200
+ version: "22.2.4",
201
+ ngImport: i0,
202
+ type: DonutChartComponentModule,
203
+ deps: [],
204
+ target: i0.ɵɵFactoryTarget.NgModule
205
+ });
206
+ }
207
+ static {
208
+ this.ɵmod = i0.ɵɵngDeclareNgModule({
209
+ minVersion: "14.0.0",
210
+ version: "22.2.4",
211
+ ngImport: i0,
212
+ type: DonutChartComponentModule,
213
+ imports: [BaseChartDirective, DonutChartComponent],
214
+ exports: [DonutChartComponent]
215
+ });
216
+ }
217
+ static {
218
+ this.ɵinj = i0.ɵɵngDeclareInjector({
219
+ minVersion: "12.0.0",
220
+ version: "22.2.4",
221
+ ngImport: i0,
222
+ type: DonutChartComponentModule
223
+ });
224
+ }
225
+ };
226
+ i0.ɵɵngDeclareClassMetadata({
227
+ minVersion: "12.0.0",
228
+ version: "22.2.4",
229
+ ngImport: i0,
230
+ type: DonutChartComponentModule,
231
+ decorators: [{
232
+ type: NgModule,
233
+ args: [{
234
+ exports: [DonutChartComponent],
235
+ imports: [BaseChartDirective, DonutChartComponent]
236
+ }]
237
+ }]
238
+ });
143
239
  export { DonutChartComponent, DonutChartComponentModule };
144
- //# sourceMappingURL=testgorilla-tgo-ui-components-donut-chart.mjs.map
240
+
241
+ //# sourceMappingURL=testgorilla-tgo-ui-components-donut-chart.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"testgorilla-tgo-ui-components-donut-chart.mjs","sources":["../../../components/donut-chart/donut-chart.component.ts","../../../components/donut-chart/donut-chart.component.html","../../../components/donut-chart/donut-chart.component.module.ts","../../../components/donut-chart/testgorilla-tgo-ui-components-donut-chart.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, computed, input } from '@angular/core';\nimport { ArcElement, ChartOptions, Plugin } from 'chart.js';\nimport DataLabelsPlugin from 'chartjs-plugin-datalabels';\nimport { BaseChartDirective } from 'ng2-charts';\n\nimport { ApplicationTheme } from '@testgorilla/tgo-ui/components/core';\n\nimport { DonutChartData } from './donut-chart.component.model';\n\n@Component({\n selector: 'ui-donut-chart',\n changeDetection: ChangeDetectionStrategy.OnPush,\n templateUrl: './donut-chart.component.html',\n styleUrls: ['./donut-chart.component.scss'],\n imports: [BaseChartDirective],\n})\nexport class DonutChartComponent {\n donutChartData = input<DonutChartData>();\n applicationTheme = input<ApplicationTheme>('light');\n\n readonly chartData = computed(() => {\n const data = this.donutChartData();\n return data\n ? {\n labels: data.labels,\n datasets: [\n {\n data: data.data,\n backgroundColor: data.backgroundColor,\n borderWidth: 0,\n },\n ],\n }\n : { labels: [], datasets: [] };\n });\n\n // Plugin to display the total in the center\n centerTextPlugin: Plugin<'doughnut'> = {\n id: 'centerText',\n beforeDraw: chart => {\n const {\n ctx,\n chartArea: { width, height },\n } = chart;\n const total = chart.data.datasets[0].data.reduce((a: number, b: number) => a + b, 0);\n const padding = 32;\n ctx.save();\n ctx.font = 'bold 14px ModernGothic';\n ctx.fillStyle = '#242424';\n ctx.textAlign = 'center';\n ctx.textBaseline = 'middle';\n ctx.fillText(total.toString(), (width + padding) / 2, (height + padding) / 2);\n ctx.restore();\n },\n };\n\n // Plugin to draw lines from the donut segments to the labels\n labelLinePlugin: Plugin<'doughnut'> = {\n id: 'labelLinePlugin',\n afterDatasetDraw: chart => {\n const { ctx, data } = chart;\n const meta = chart.getDatasetMeta(0);\n const radialOffset = 10; // length of the radial segment (elbow)\n const horizontalLength = 20; // new length of the horizontal segment\n const fontSize = 14;\n\n ctx.save();\n ctx.strokeStyle = '#666';\n ctx.lineWidth = 1;\n ctx.font = `${fontSize}px ModernGothic`;\n ctx.fillStyle = '#242424';\n\n (meta.data as ArcElement[]).forEach((arc, index) => {\n const angle = (arc.startAngle + arc.endAngle) / 2;\n const radius = arc.outerRadius;\n const centerX = arc.x;\n const centerY = arc.y;\n\n // Start point: outer edge of the arc\n const startX = centerX + Math.cos(angle) * radius;\n const startY = centerY + Math.sin(angle) * radius;\n\n // Elbow: short line outward\n const midX = centerX + Math.cos(angle) * (radius + radialOffset);\n const midY = centerY + Math.sin(angle) * (radius + radialOffset);\n\n // Extended horizontal line\n const direction = Math.cos(angle) >= 0 ? 1 : -1;\n const endX = midX + direction * horizontalLength;\n const endY = midY;\n\n // Draw line with elbow\n ctx.beginPath();\n ctx.moveTo(startX, startY);\n ctx.lineTo(midX, midY);\n ctx.lineTo(endX, endY);\n ctx.stroke();\n\n // Draw value at the end\n const value = data.datasets[0].data?.[index] ?? '';\n const textX = endX + direction * 5;\n ctx.textAlign = direction > 0 ? 'left' : 'right';\n ctx.textBaseline = 'middle';\n ctx.fillText(String(value), textX, endY);\n });\n\n ctx.restore();\n },\n };\n\n public donutChartPlugins: Plugin<'doughnut'>[] = [DataLabelsPlugin, this.centerTextPlugin, this.labelLinePlugin];\n\n public donutChartOptions: ChartOptions<'doughnut'> = {\n responsive: true,\n cutout: '65%',\n aspectRatio: 2,\n layout: {\n padding: 16,\n },\n plugins: {\n legend: {\n onClick: () => null, // Disable legend click events\n position: 'right',\n labels: {\n font: {\n family: 'ModernGothic',\n size: 14,\n },\n boxWidth: 14,\n padding: 20,\n },\n },\n tooltip: {\n enabled: false,\n },\n datalabels: {\n display: false,\n },\n },\n };\n}\n","<div style=\"height: 200px\">\n <canvas baseChart [data]=\"chartData()\" type=\"doughnut\" [options]=\"donutChartOptions\" [plugins]=\"donutChartPlugins\">\n </canvas>\n</div>\n","import { NgModule } from '@angular/core';\nimport { Chart, registerables } from 'chart.js';\nimport { BaseChartDirective } from 'ng2-charts';\n\nimport { DonutChartComponent } from './donut-chart.component';\n\nChart.register(...registerables);\n\n@NgModule({\n exports: [DonutChartComponent],\n imports: [BaseChartDirective, DonutChartComponent],\n})\nexport class Donut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mBAAmB,CAAA,EAAA,CAAA,CAAA;gHAGlB,yBAAyB,EAAA,CAAA,CAAA;;4FAAzB,yBAAyB,EAAA,UAAA,EAAA,CAAA;kBAJrC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;oBACR,OAAO,EAAE,CAAC,mBAAmB,CAAC;AAC9B,oBAAA,OAAO,EAAE,CAAC,kBAAkB,EAAE,mBAAmB,CAAC;AACnD,iBAAA;;;ACXD;;AAEG;;"}
1
+ {"version":3,"file":"testgorilla-tgo-ui-components-donut-chart.mjs","names":[],"sources":["../../../components/donut-chart/donut-chart.component.ts","../../../components/donut-chart/donut-chart.component.html","../../../components/donut-chart/donut-chart.component.module.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, computed, input } from '@angular/core';\nimport { ArcElement, ChartOptions, Plugin } from 'chart.js';\nimport DataLabelsPlugin from 'chartjs-plugin-datalabels';\nimport { BaseChartDirective } from 'ng2-charts';\n\nimport { ApplicationTheme } from '@testgorilla/tgo-ui/components/core';\n\nimport { DonutChartData } from './donut-chart.component.model';\n\n@Component({\n selector: 'ui-donut-chart',\n changeDetection: ChangeDetectionStrategy.OnPush,\n templateUrl: './donut-chart.component.html',\n styleUrls: ['./donut-chart.component.scss'],\n imports: [BaseChartDirective],\n})\nexport class DonutChartComponent {\n donutChartData = input<DonutChartData>();\n applicationTheme = input<ApplicationTheme>('light');\n\n readonly chartData = computed(() => {\n const data = this.donutChartData();\n return data\n ? {\n labels: data.labels,\n datasets: [\n {\n data: data.data,\n backgroundColor: data.backgroundColor,\n borderWidth: 0,\n },\n ],\n }\n : { labels: [], datasets: [] };\n });\n\n // Plugin to display the total in the center\n centerTextPlugin: Plugin<'doughnut'> = {\n id: 'centerText',\n beforeDraw: chart => {\n const {\n ctx,\n chartArea: { width, height },\n } = chart;\n const total = chart.data.datasets[0].data.reduce((a: number, b: number) => a + b, 0);\n const padding = 32;\n ctx.save();\n ctx.font = 'bold 14px ModernGothic';\n ctx.fillStyle = '#242424';\n ctx.textAlign = 'center';\n ctx.textBaseline = 'middle';\n ctx.fillText(total.toString(), (width + padding) / 2, (height + padding) / 2);\n ctx.restore();\n },\n };\n\n // Plugin to draw lines from the donut segments to the labels\n labelLinePlugin: Plugin<'doughnut'> = {\n id: 'labelLinePlugin',\n afterDatasetDraw: chart => {\n const { ctx, data } = chart;\n const meta = chart.getDatasetMeta(0);\n const radialOffset = 10; // length of the radial segment (elbow)\n const horizontalLength = 20; // new length of the horizontal segment\n const fontSize = 14;\n\n ctx.save();\n ctx.strokeStyle = '#666';\n ctx.lineWidth = 1;\n ctx.font = `${fontSize}px ModernGothic`;\n ctx.fillStyle = '#242424';\n\n (meta.data as ArcElement[]).forEach((arc, index) => {\n const angle = (arc.startAngle + arc.endAngle) / 2;\n const radius = arc.outerRadius;\n const centerX = arc.x;\n const centerY = arc.y;\n\n // Start point: outer edge of the arc\n const startX = centerX + Math.cos(angle) * radius;\n const startY = centerY + Math.sin(angle) * radius;\n\n // Elbow: short line outward\n const midX = centerX + Math.cos(angle) * (radius + radialOffset);\n const midY = centerY + Math.sin(angle) * (radius + radialOffset);\n\n // Extended horizontal line\n const direction = Math.cos(angle) >= 0 ? 1 : -1;\n const endX = midX + direction * horizontalLength;\n const endY = midY;\n\n // Draw line with elbow\n ctx.beginPath();\n ctx.moveTo(startX, startY);\n ctx.lineTo(midX, midY);\n ctx.lineTo(endX, endY);\n ctx.stroke();\n\n // Draw value at the end\n const value = data.datasets[0].data?.[index] ?? '';\n const textX = endX + direction * 5;\n ctx.textAlign = direction > 0 ? 'left' : 'right';\n ctx.textBaseline = 'middle';\n ctx.fillText(String(value), textX, endY);\n });\n\n ctx.restore();\n },\n };\n\n public donutChartPlugins: Plugin<'doughnut'>[] = [DataLabelsPlugin, this.centerTextPlugin, this.labelLinePlugin];\n\n public donutChartOptions: ChartOptions<'doughnut'> = {\n responsive: true,\n cutout: '65%',\n aspectRatio: 2,\n layout: {\n padding: 16,\n },\n plugins: {\n legend: {\n onClick: () => null, // Disable legend click events\n position: 'right',\n labels: {\n font: {\n family: 'ModernGothic',\n size: 14,\n },\n boxWidth: 14,\n padding: 20,\n },\n },\n tooltip: {\n enabled: false,\n },\n datalabels: {\n display: false,\n },\n },\n };\n}\n","<div style=\"height: 200px\">\n <canvas baseChart [data]=\"chartData()\" type=\"doughnut\" [options]=\"donutChartOptions\" [plugins]=\"donutChartPlugins\">\n </canvas>\n</div>\n","import { NgModule } from '@angular/core';\nimport { Chart, registerables } from 'chart.js';\nimport { BaseChartDirective } from 'ng2-charts';\n\nimport { DonutChartComponent } from './donut-chart.component';\n\nChart.register(...registerables);\n\n@NgModule({\n exports: [DonutChartComponent],\n imports: [BaseChartDirective, DonutChartComponent],\n})\nexport class DonutChartComponentModule {}\n"],"mappings":";;;;;AAgBA,IAAa,sBAAb,MAAa,oBAAmB;CAPhC,cAAA;EAQE,KAAA,iBAAiB,MAAuB,GAAA,YAAA,CAAA,QAAA,EAAA,WAAA,iBAAA,CAAA,+BAAA,CAAA,CAAA;EACxC,KAAA,mBAAmB,MAAwB,SAAQ,GAAA,YAAA,CAAA,EAAA,WAAA,mBAAA,CAAA,+BAAA,CAAA,CAAA;EAE1C,KAAA,YAAY,eAAc;GACjC,MAAM,OAAO,KAAK,eAAc;GAChC,OAAO,OACH;IACE,QAAQ,KAAK;IACb,UAAU,CACR;KACE,MAAM,KAAK;KACX,iBAAiB,KAAK;KACtB,aAAa;IACd,CACF;GACF,IACD;IAAE,QAAQ,CAAA;IAAI,UAAU,CAAA;GAAE;EAChC,GAAE,GAAA,YAAA,CAAA,EAAA,WAAA,YAAA,CAAA,+BAAA,CAAA,CAAA;EAGF,KAAA,mBAAuC;GACrC,IAAI;GACJ,aAAY,UAAQ;IAClB,MAAM,EACJ,KACA,WAAW,EAAE,OAAO,aAClB;IACJ,MAAM,QAAQ,MAAM,KAAK,SAAS,EAAE,CAAC,KAAK,QAAQ,GAAW,MAAc,IAAI,GAAG,CAAC;IACnF,MAAM,UAAU;IAChB,IAAI,K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