@bildvitta/quasar-ui-asteroid 3.17.0-beta.21 → 3.17.0-beta.22

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 (314) hide show
  1. package/package.json +1 -1
  2. package/src/asteroid.js +4 -4
  3. package/src/components/actions/QasActions.vue +81 -81
  4. package/src/components/actions/QasActions.yml +34 -34
  5. package/src/components/actions-menu/QasActionsMenu.vue +251 -251
  6. package/src/components/actions-menu/QasActionsMenu.yml +89 -89
  7. package/src/components/actions-menu/composables/use-delete.js +30 -30
  8. package/src/components/actions-menu/composables/use-double-split-actions.js +42 -42
  9. package/src/components/actions-menu/composables/use-options-actions.js +27 -27
  10. package/src/components/actions-menu/composables/use-single-action.js +17 -17
  11. package/src/components/actions-menu/composables/use-single-split-actions.js +35 -35
  12. package/src/components/actions-menu/composables/use-tooltips.js +43 -43
  13. package/src/components/actions-menu/utils/get-label.js +3 -3
  14. package/src/components/actions-menu/utils/set-click-handler.js +6 -6
  15. package/src/components/alert/QasAlert.test.js +43 -43
  16. package/src/components/alert/QasAlert.vue +110 -110
  17. package/src/components/alert/QasAlert.yml +39 -39
  18. package/src/components/app-bar/QasAppBar.vue +119 -119
  19. package/src/components/app-bar/QasAppBar.yml +44 -44
  20. package/src/components/app-menu/QasAppMenu.vue +392 -392
  21. package/src/components/app-menu/QasAppMenu.yml +73 -73
  22. package/src/components/app-menu/composables/use-app-menu-dropdown.js +71 -71
  23. package/src/components/app-menu/composables/use-app-user.js +49 -49
  24. package/src/components/app-menu/composables/use-development-badge.js +23 -23
  25. package/src/components/app-menu/private/PvAppMenuDropdown.vue +71 -71
  26. package/src/components/app-menu/private/PvAppMenuHelpChat.vue +222 -222
  27. package/src/components/app-user/QasAppUser.vue +281 -281
  28. package/src/components/app-user/QasAppUser.yml +56 -56
  29. package/src/components/avatar/QasAvatar.vue +95 -95
  30. package/src/components/avatar/QasAvatar.yml +38 -38
  31. package/src/components/avatar/enums/AvatarColors.js +10 -10
  32. package/src/components/badge/QasBadge.vue +87 -87
  33. package/src/components/badge/QasBadge.yml +55 -55
  34. package/src/components/board-generator/QasBoardGenerator.vue +712 -712
  35. package/src/components/board-generator/QasBoardGenerator.yml +167 -167
  36. package/src/components/box/QasBox.vue +51 -51
  37. package/src/components/box/QasBox.yml +29 -29
  38. package/src/components/breakline/QasBreakline.vue +38 -38
  39. package/src/components/breakline/QasBreakline.yml +25 -25
  40. package/src/components/btn/QasBtn.vue +148 -148
  41. package/src/components/btn/QasBtn.yml +48 -48
  42. package/src/components/btn-dropdown/QasBtnDropdown.vue +146 -146
  43. package/src/components/btn-dropdown/QasBtnDropdown.yml +59 -59
  44. package/src/components/card/QasCard.vue +132 -132
  45. package/src/components/card/QasCard.yml +44 -44
  46. package/src/components/card-image/QasCardImage.vue +95 -95
  47. package/src/components/card-image/QasCardImage.yml +48 -48
  48. package/src/components/chart-view/QasChartView.vue +441 -441
  49. package/src/components/chart-view/QasChartView.yml +109 -109
  50. package/src/components/chart-view/config/charts/bar.js +45 -45
  51. package/src/components/chart-view/config/charts/doughnut.js +43 -43
  52. package/src/components/chart-view/config/charts/index.js +9 -9
  53. package/src/components/chart-view/config/charts/line.js +57 -57
  54. package/src/components/chart-view/config/defaults/colors.js +19 -19
  55. package/src/components/chart-view/config/defaults/font.js +5 -5
  56. package/src/components/chart-view/config/defaults/index.js +2 -2
  57. package/src/components/chart-view/config/index.js +3 -3
  58. package/src/components/chart-view/config/plugins/index.js +3 -3
  59. package/src/components/chart-view/config/plugins/legend.js +9 -9
  60. package/src/components/chart-view/config/plugins/tooltip.js +15 -15
  61. package/src/components/chart-view/config/plugins/zoom.js +31 -31
  62. package/src/components/checkbox/QasCheckbox.vue +150 -150
  63. package/src/components/checkbox/QasCheckbox.yml +36 -36
  64. package/src/components/copy/QasCopy.vue +46 -46
  65. package/src/components/copy/QasCopy.yml +23 -23
  66. package/src/components/date/QasDate.vue +600 -600
  67. package/src/components/date/QasDate.yml +69 -69
  68. package/src/components/date/enums/DateMaskOptions.js +6 -6
  69. package/src/components/date-time-input/QasDateTimeInput.vue +269 -269
  70. package/src/components/date-time-input/QasDateTimeInput.yml +64 -64
  71. package/src/components/debugger/QasDebugger.vue +31 -31
  72. package/src/components/debugger/QasDebugger.yml +10 -10
  73. package/src/components/delete/QasDelete.vue +100 -100
  74. package/src/components/delete/QasDelete.yml +60 -60
  75. package/src/components/dialog/QasDialog.vue +217 -217
  76. package/src/components/dialog/QasDialog.yml +117 -117
  77. package/src/components/dialog/composables/use-cancel.js +40 -40
  78. package/src/components/dialog/composables/use-dynamic-components.js +86 -86
  79. package/src/components/dialog/composables/use-ok.js +45 -45
  80. package/src/components/dialog-router/QasDialogRouter.vue +86 -86
  81. package/src/components/dialog-router/QasDialogRouter.yml +23 -23
  82. package/src/components/drawer/QasDrawer.vue +118 -118
  83. package/src/components/drawer/QasDrawer.yml +58 -58
  84. package/src/components/empty-result-text/QasEmptyResultText.vue +18 -18
  85. package/src/components/empty-result-text/QasEmptyResultText.yml +14 -14
  86. package/src/components/expansion-item/QasExpansionItem.vue +291 -291
  87. package/src/components/expansion-item/QasExpansionItem.yml +76 -76
  88. package/src/components/field/QasField.vue +220 -220
  89. package/src/components/field/QasField.yml +36 -36
  90. package/src/components/filters/QasFilters.vue +472 -472
  91. package/src/components/filters/QasFilters.yml +171 -171
  92. package/src/components/filters/private/PvFiltersButton.vue +101 -101
  93. package/src/components/form-generator/QasFormGenerator.vue +274 -274
  94. package/src/components/form-generator/QasFormGenerator.yml +109 -109
  95. package/src/components/form-view/QasFormView.vue +484 -484
  96. package/src/components/form-view/QasFormView.yml +253 -253
  97. package/src/components/gallery/QasGallery.vue +243 -243
  98. package/src/components/gallery/QasGallery.yml +188 -188
  99. package/src/components/gallery/composables/use-delete.js +54 -54
  100. package/src/components/gallery/private/PvGalleryCarouselDialog.vue +92 -92
  101. package/src/components/gallery/private/PvGalleryDeleteDialog.vue +54 -54
  102. package/src/components/gallery-card/QasGalleryCard.vue +153 -153
  103. package/src/components/gallery-card/QasGalleryCard.yml +61 -61
  104. package/src/components/grabbable/QasGrabbable.vue +185 -185
  105. package/src/components/grabbable/QasGrabbable.yml +26 -26
  106. package/src/components/grid-generator/QasGridGenerator.vue +210 -210
  107. package/src/components/grid-generator/QasGridGenerator.yml +127 -127
  108. package/src/components/grid-item/QasGridItem.vue +89 -89
  109. package/src/components/grid-item/QasGridItem.yml +22 -22
  110. package/src/components/header/QasHeader.vue +152 -152
  111. package/src/components/header/QasHeader.yml +50 -50
  112. package/src/components/infinite-scroll/QasInfiniteScroll.vue +168 -168
  113. package/src/components/infinite-scroll/QasInfiniteScroll.yml +78 -78
  114. package/src/components/info/QasInfo.vue +155 -155
  115. package/src/components/info/QasInfo.yml +34 -34
  116. package/src/components/input/QasInput.vue +252 -252
  117. package/src/components/input/QasInput.yml +65 -65
  118. package/src/components/label/QasLabel.vue +61 -61
  119. package/src/components/label/QasLabel.yml +44 -44
  120. package/src/components/layout/QasLayout.vue +101 -101
  121. package/src/components/layout/QasLayout.yml +46 -46
  122. package/src/components/layout/private/PvLayoutNotificationCard.vue +86 -86
  123. package/src/components/layout/private/PvLayoutNotificationsDrawer.vue +140 -140
  124. package/src/components/list-items/QasListItems.vue +125 -125
  125. package/src/components/list-items/QasListItems.yml +71 -71
  126. package/src/components/list-view/QasListView.vue +302 -302
  127. package/src/components/list-view/QasListView.yml +169 -169
  128. package/src/components/map/QasMap.vue +75 -75
  129. package/src/components/map/QasMap.yml +33 -33
  130. package/src/components/nested-fields/QasNestedFields.vue +584 -584
  131. package/src/components/nested-fields/QasNestedFields.yml +296 -296
  132. package/src/components/numeric-input/QasNumericInput.vue +206 -206
  133. package/src/components/numeric-input/QasNumericInput.yml +85 -85
  134. package/src/components/option-group/QasOptionGroup.vue +54 -54
  135. package/src/components/option-group/QasOptionGroup.yml +30 -30
  136. package/src/components/page-header/QasPageHeader.vue +143 -143
  137. package/src/components/page-header/QasPageHeader.yml +42 -42
  138. package/src/components/pagination/QasPagination.vue +71 -71
  139. package/src/components/pagination/QasPagination.yml +4 -4
  140. package/src/components/password-input/QasPasswordInput.vue +110 -110
  141. package/src/components/password-input/QasPasswordInput.yml +111 -111
  142. package/src/components/password-strength-checker/QasPasswordStrengthChecker.vue +71 -71
  143. package/src/components/password-strength-checker/QasPasswordStrengthChecker.yml +103 -103
  144. package/src/components/profile/QasProfile.vue +98 -98
  145. package/src/components/profile/QasProfile.yml +60 -60
  146. package/src/components/radio/QasRadio.vue +62 -62
  147. package/src/components/radio/QasRadio.yml +11 -11
  148. package/src/components/resizer/QasResizer.vue +90 -90
  149. package/src/components/resizer/QasResizer.yml +24 -24
  150. package/src/components/search-box/QasSearchBox.vue +294 -294
  151. package/src/components/search-box/QasSearchBox.yml +154 -154
  152. package/src/components/search-input/QasSearchInput.vue +106 -106
  153. package/src/components/search-input/QasSearchInput.yml +48 -48
  154. package/src/components/select/QasSelect.vue +514 -514
  155. package/src/components/select/QasSelect.yml +157 -157
  156. package/src/components/select-list/QasSelectList.vue +238 -238
  157. package/src/components/select-list/QasSelectList.yml +108 -108
  158. package/src/components/select-list/private/PvSelectListCheckbox.vue +31 -31
  159. package/src/components/select-list-dialog/QasSelectListDialog.vue +395 -395
  160. package/src/components/select-list-dialog/QasSelectListDialog.yml +108 -108
  161. package/src/components/signature-pad/QasSignaturePad.vue +122 -122
  162. package/src/components/signature-pad/QasSignaturePad.yml +53 -53
  163. package/src/components/signature-uploader/QasSignatureUploader.vue +164 -164
  164. package/src/components/signature-uploader/QasSignatureUploader.yml +37 -37
  165. package/src/components/single-view/QasSingleView.vue +175 -175
  166. package/src/components/single-view/QasSingleView.yml +131 -131
  167. package/src/components/sortable/QasSortable.vue +151 -151
  168. package/src/components/sortable/QasSortable.yml +65 -65
  169. package/src/components/status/QasStatus.test.js +11 -11
  170. package/src/components/status/QasStatus.vue +29 -29
  171. package/src/components/status/QasStatus.yml +10 -10
  172. package/src/components/stepper/QasStepper.vue +199 -152
  173. package/src/components/stepper/QasStepper.yml +35 -35
  174. package/src/components/stepper-form-view/QasStepperFormView.vue +86 -84
  175. package/src/components/stepper-form-view/QasStepperFormView.yml +58 -58
  176. package/src/components/table-generator/QasTableGenerator.vue +416 -416
  177. package/src/components/table-generator/QasTableGenerator.yml +94 -94
  178. package/src/components/tabs-generator/QasTabsGenerator.vue +196 -196
  179. package/src/components/tabs-generator/QasTabsGenerator.yml +53 -53
  180. package/src/components/text-truncate/QasTextTruncate.vue +274 -274
  181. package/src/components/text-truncate/QasTextTruncate.yml +60 -60
  182. package/src/components/timeline/QasTimeline.vue +140 -140
  183. package/src/components/timeline/QasTimeline.yml +36 -36
  184. package/src/components/toggle/QasToggle.vue +14 -14
  185. package/src/components/toggle/QasToggle.yml +5 -5
  186. package/src/components/toggle-visibility/QasToggleVisibility.vue +79 -79
  187. package/src/components/toggle-visibility/QasToggleVisibility.yml +30 -30
  188. package/src/components/transfer/QasTransfer.vue +239 -239
  189. package/src/components/transfer/QasTransfer.yml +60 -60
  190. package/src/components/tree-generator/QasTreeForm.vue +62 -62
  191. package/src/components/tree-generator/QasTreeGenerator.vue +488 -488
  192. package/src/components/tree-generator/QasTreeGenerator.yml +81 -81
  193. package/src/components/uploader/QasUploader.vue +691 -645
  194. package/src/components/uploader/QasUploader.yml +206 -192
  195. package/src/components/uploader/private/PvUploaderGalleryCard.vue +357 -357
  196. package/src/components/welcome/QasWelcome.vue +125 -125
  197. package/src/components/welcome/QasWelcome.yml +23 -23
  198. package/src/components/welcome/private/PvWelcomeShortcutCard.vue +58 -58
  199. package/src/components/whatsapp-link/QasWhatsappLink.vue +34 -34
  200. package/src/components/whatsapp-link/QasWhatsappLink.yml +18 -18
  201. package/src/composables/index.js +8 -8
  202. package/src/composables/private/index.js +3 -3
  203. package/src/composables/private/use-generator.js +174 -174
  204. package/src/composables/private/use-toggle-visibility.js +48 -48
  205. package/src/composables/private/use-view.js +186 -186
  206. package/src/composables/use-context.js +15 -15
  207. package/src/composables/use-form.js +32 -32
  208. package/src/composables/use-history.js +46 -46
  209. package/src/composables/use-notifications.js +128 -128
  210. package/src/composables/use-query-cache.js +60 -60
  211. package/src/composables/use-screen.js +42 -42
  212. package/src/css/base/font-face.scss +28 -28
  213. package/src/css/base/index.scss +1 -1
  214. package/src/css/components/base.scss +12 -12
  215. package/src/css/components/button.scss +116 -116
  216. package/src/css/components/checkbox.scss +14 -14
  217. package/src/css/components/editor.scss +7 -7
  218. package/src/css/components/field.scss +88 -88
  219. package/src/css/components/index.scss +10 -10
  220. package/src/css/components/item.scss +52 -52
  221. package/src/css/components/radio.scss +18 -18
  222. package/src/css/components/scrollbar.scss +20 -20
  223. package/src/css/components/tabs.scss +3 -3
  224. package/src/css/components/toggle.scss +13 -13
  225. package/src/css/mixins/index.scss +3 -3
  226. package/src/css/mixins/set-brand.scss +15 -15
  227. package/src/css/mixins/set-button.scss +26 -26
  228. package/src/css/mixins/set-typography.scss +8 -8
  229. package/src/css/plugins/index.scss +2 -2
  230. package/src/css/plugins/loading.scss +5 -5
  231. package/src/css/plugins/notify.scss +100 -100
  232. package/src/css/utils/background.scss +34 -34
  233. package/src/css/utils/border-radius.scss +29 -29
  234. package/src/css/utils/border.scss +42 -42
  235. package/src/css/utils/container.scss +36 -36
  236. package/src/css/utils/fonts.scss +5 -5
  237. package/src/css/utils/index.scss +10 -10
  238. package/src/css/utils/line-height.scss +19 -19
  239. package/src/css/utils/opacity.scss +5 -5
  240. package/src/css/utils/scroll.scss +21 -21
  241. package/src/css/utils/text.scss +15 -15
  242. package/src/css/utils/unset.scss +8 -8
  243. package/src/css/variables/button.scss +4 -4
  244. package/src/css/variables/index.scss +6 -6
  245. package/src/css/variables/scrollbar.scss +11 -11
  246. package/src/css/variables/separator.scss +2 -2
  247. package/src/css/variables/shadow.scss +3 -3
  248. package/src/css/variables/spacing.scss +98 -98
  249. package/src/css/variables/typography.scss +149 -149
  250. package/src/directives/Test.js +13 -13
  251. package/src/enums/Align.js +7 -7
  252. package/src/enums/Spacing.js +98 -98
  253. package/src/enums/Status.js +33 -33
  254. package/src/helpers/add-counter-suffix.js +3 -3
  255. package/src/helpers/base-64-to-blob.js +21 -21
  256. package/src/helpers/camelize-fields-name.js +15 -15
  257. package/src/helpers/construct-object.js +29 -29
  258. package/src/helpers/copy-to-clipboard.js +15 -15
  259. package/src/helpers/destroy-nested-children-by-key.js +33 -33
  260. package/src/helpers/download-file.js +21 -21
  261. package/src/helpers/filter-list-by-handle.js +31 -31
  262. package/src/helpers/filter-object-to-array.js +29 -29
  263. package/src/helpers/filter-object.js +34 -34
  264. package/src/helpers/filters.js +163 -163
  265. package/src/helpers/find-children-by-key.js +14 -14
  266. package/src/helpers/get-greatest-common-divisor.js +16 -16
  267. package/src/helpers/get-normalized-options.js +20 -20
  268. package/src/helpers/get-placeholder.js +19 -19
  269. package/src/helpers/get-required-label.js +3 -3
  270. package/src/helpers/get-slot-children-text.js +15 -15
  271. package/src/helpers/handle-process.js +13 -13
  272. package/src/helpers/images.js +28 -28
  273. package/src/helpers/index.js +25 -25
  274. package/src/helpers/is-empty.js +3 -3
  275. package/src/helpers/is-local-development.js +3 -3
  276. package/src/helpers/private/gutter-validator.js +15 -15
  277. package/src/helpers/private/has-parent-by-class-name.js +15 -15
  278. package/src/helpers/promise-handler.js +40 -40
  279. package/src/helpers/rules.js +7 -7
  280. package/src/helpers/set-scroll-on-grab.js +128 -128
  281. package/src/index.cjs.js +1 -1
  282. package/src/index.esm.js +4 -4
  283. package/src/index.scss +38 -38
  284. package/src/index.umd.js +2 -2
  285. package/src/mixins/context.js +8 -8
  286. package/src/mixins/delete.js +48 -48
  287. package/src/mixins/dialog-router.js +17 -17
  288. package/src/mixins/form.js +11 -11
  289. package/src/mixins/generator.js +94 -94
  290. package/src/mixins/index.js +17 -17
  291. package/src/mixins/password.js +86 -86
  292. package/src/mixins/search-filter.js +354 -354
  293. package/src/mixins/view.js +156 -156
  294. package/src/pages/ErrorComponent.vue +74 -74
  295. package/src/pages/Forbidden.vue +29 -29
  296. package/src/pages/NotFound.vue +29 -29
  297. package/src/pages/ServerError.vue +29 -29
  298. package/src/pages/Unauthorized.vue +29 -29
  299. package/src/plugins/delete/Delete.js +107 -107
  300. package/src/plugins/delete/Delete.yml +75 -75
  301. package/src/plugins/dialog/Dialog.js +14 -14
  302. package/src/plugins/dialog/Dialog.yml +10 -10
  303. package/src/plugins/index.js +13 -13
  304. package/src/plugins/notify-error/NotifyError.js +13 -13
  305. package/src/plugins/notify-error/NotifyError.yml +11 -11
  306. package/src/plugins/notify-success/NotifySuccess.js +13 -13
  307. package/src/plugins/notify-success/NotifySuccess.yml +11 -11
  308. package/src/plugins/screen/Screen.js +35 -35
  309. package/src/plugins/screen/Screen.yml +16 -16
  310. package/src/shared/date-config.js +26 -26
  311. package/src/shared/fuse-config.js +4 -4
  312. package/src/shared/notify-config.js +7 -7
  313. package/src/vue-plugin/third-party-component-handler.js +29 -29
  314. package/src/vue-plugin.js +282 -282
@@ -1,441 +1,441 @@
1
- <template>
2
- <component :is="parentComponent.is" v-bind="parentComponent.props">
3
- <qas-header v-if="hasHeader" v-bind="headerProps">
4
- <template #right>
5
- <qas-filters v-bind="chartFiltersProps" />
6
- </template>
7
- </qas-header>
8
-
9
- <div v-bind="parentComponentProps">
10
- <component :is="chartComponent.is" v-if="showChart" v-bind="chartComponent.props" />
11
-
12
- <div v-else-if="!isFetching">
13
- <slot name="empty-results">
14
- <qas-empty-result-text />
15
- </slot>
16
- </div>
17
-
18
- <q-inner-loading :showing="isFetching">
19
- <q-spinner color="grey" size="3em" />
20
- </q-inner-loading>
21
- </div>
22
- </component>
23
- </template>
24
-
25
- <script>
26
- // Importações do chart.js
27
- import {
28
- Chart as ChartJS,
29
- Title,
30
- Tooltip,
31
- Legend,
32
- CategoryScale,
33
- LinearScale,
34
- BarElement,
35
- LineElement,
36
- PointElement,
37
- ArcElement
38
- } from 'chart.js'
39
- import { Bar as BarChart, Doughnut as DoughnutChart, Line as LineChart } from 'vue-chartjs'
40
-
41
- // Configurações padrões
42
- import { charts, colors as defaultColors, font } from './config'
43
-
44
- // Plugins
45
- import zoomPlugin from 'chartjs-plugin-zoom'
46
- import chartDataLabels from 'chartjs-plugin-datalabels'
47
-
48
- // Outras importações
49
- import { extend } from 'quasar'
50
- import { filterListByHandle } from '../../helpers'
51
- import { getAction } from '@bildvitta/store-adapter'
52
-
53
- const ChartTypes = {
54
- Bar: 'bar',
55
- Doughnut: 'doughnut',
56
- Line: 'line'
57
- }
58
-
59
- export default {
60
- name: 'QasChartView',
61
-
62
- components: {
63
- BarChart,
64
- DoughnutChart,
65
- LineChart
66
- },
67
-
68
- props: {
69
- beforeFetch: {
70
- default: null,
71
- type: Function
72
- },
73
-
74
- boxProps: {
75
- default: () => ({}),
76
- type: Object
77
- },
78
-
79
- colorsList: {
80
- type: Array,
81
- default: () => []
82
- },
83
-
84
- entity: {
85
- required: true,
86
- type: String
87
- },
88
-
89
- fetching: {
90
- type: Boolean
91
- },
92
-
93
- filtersProps: {
94
- default: () => ({}),
95
- type: Object
96
- },
97
-
98
- height: {
99
- default: '380px',
100
- type: String
101
- },
102
-
103
- maxDoughnutSlices: {
104
- default: 15,
105
- type: Number
106
- },
107
-
108
- options: {
109
- default: () => ({}),
110
- type: Object
111
- },
112
-
113
- subtitle: {
114
- default: '',
115
- type: String
116
- },
117
-
118
- title: {
119
- default: '',
120
- type: String
121
- },
122
-
123
- type: {
124
- default: ChartTypes.Bar,
125
- type: String,
126
- validator: value => Object.values(ChartTypes).includes(value)
127
- },
128
-
129
- url: {
130
- default: '',
131
- type: String
132
- },
133
-
134
- useBox: {
135
- type: Boolean,
136
- default: true
137
- },
138
-
139
- useFilterButton: {
140
- type: Boolean
141
- }
142
- },
143
-
144
- emits: [
145
- 'fetch-error',
146
- 'fetch-success',
147
- 'update:fetching'
148
- ],
149
-
150
- data () {
151
- return {
152
- cancelBeforeFetch: false,
153
- data: [],
154
- filters: {},
155
- isFetched: false,
156
- isFetching: false
157
- }
158
- },
159
-
160
- computed: {
161
- chartData () {
162
- if (!this.data.length) {
163
- return {
164
- labels: [],
165
- datasets: []
166
- }
167
- }
168
-
169
- const [dataset] = this.data
170
- const labels = this.getXAxisData(dataset.data.map(item => item.x))
171
- const colors = this.colorsList.length ? this.colorsList : defaultColors
172
-
173
- const datasets = this.data.map(({ label, data }, index) => {
174
- const backgroundColor = this.isDoughnut ? colors : colors.at(index)
175
- const borderColor = this.isDoughnut ? 'white' : colors.at(index)
176
- const yAxisData = []
177
- const xAxisData = []
178
-
179
- for (const dataKey in data) {
180
- const item = data[dataKey]
181
-
182
- if (item) {
183
- yAxisData.push(item.y)
184
- xAxisData.push(item.tooltip)
185
- }
186
- }
187
-
188
- return {
189
- backgroundColor,
190
- borderColor,
191
- data: this.getYAxisData(yAxisData),
192
- label,
193
- tooltips: this.getXAxisData(xAxisData)
194
- }
195
- })
196
-
197
- return {
198
- datasets,
199
- labels
200
- }
201
- },
202
-
203
- chartFiltersProps () {
204
- const { entity, useFilterButton, url } = this
205
-
206
- return {
207
- class: 'q-mb-xs',
208
- entity,
209
- url,
210
- useChip: false,
211
- useFilterButton,
212
- useSearch: false,
213
- useSpacing: false,
214
- useUpdateRoute: false,
215
-
216
- ...this.filtersProps,
217
-
218
- 'onUpdate:currentFilters': filters => {
219
- this.filters = filters
220
- this.filtersProps['onUpdate:currentFilters']?.(filters)
221
- }
222
- }
223
- },
224
-
225
- chartOptions () {
226
- const { options, type } = this
227
-
228
- return extend(true, charts[type], options)
229
- },
230
-
231
- chartPlugins () {
232
- return filterListByHandle([
233
- {
234
- handle: this.isDoughnut,
235
- item: chartDataLabels
236
- },
237
- {
238
- handle: this.isBar || this.isLine,
239
- item: zoomPlugin
240
- }
241
- ])
242
- },
243
-
244
- chartType () {
245
- const components = {
246
- bar: 'BarChart',
247
- doughnut: 'DoughnutChart',
248
- line: 'LineChart'
249
- }
250
-
251
- return components[this.type]
252
- },
253
-
254
- chartComponent () {
255
- return {
256
- is: this.chartType,
257
- props: {
258
- data: this.chartData,
259
- options: this.chartOptions,
260
- plugins: this.chartPlugins
261
- }
262
- }
263
- },
264
-
265
- parentComponentProps () {
266
- const hasMinHeight = this.isFetching || this.hasDataSets
267
-
268
- return {
269
- class: 'relative-position',
270
- style: `min-height: ${hasMinHeight ? this.height : 'auto'}`
271
- }
272
- },
273
-
274
- hasDataSets () {
275
- return !!this.chartData?.datasets.filter(dataset => dataset.data.length)?.length
276
- },
277
-
278
- hasHeader () {
279
- return this.title || this.subtitle || this.useFilterButton
280
- },
281
-
282
- isBar () {
283
- return this.type === 'bar'
284
- },
285
-
286
- isDoughnut () {
287
- return this.type === 'doughnut'
288
- },
289
-
290
- isLine () {
291
- return this.type === 'line'
292
- },
293
-
294
- showChart () {
295
- return this.isFetched && this.hasDataSets
296
- },
297
-
298
- defaultChartItems () {
299
- return [
300
- CategoryScale,
301
- LinearScale,
302
- PointElement,
303
- Title,
304
- Tooltip,
305
- Legend
306
- ]
307
- },
308
-
309
- elementsChartItems () {
310
- return {
311
- bar: [BarElement],
312
- doughnut: [ArcElement],
313
- line: [LineElement]
314
- }
315
- },
316
-
317
- headerProps () {
318
- return {
319
- alignColumns: 'end',
320
- description: this.subtitle,
321
- labelProps: {
322
- label: this.title
323
- }
324
- }
325
- },
326
-
327
- parentComponent () {
328
- return {
329
- is: this.useBox ? 'qas-box' : 'div',
330
-
331
- props: {
332
- ...(this.useBox && { ...this.boxProps })
333
- }
334
- }
335
- }
336
- },
337
-
338
- watch: {
339
- filters () {
340
- this.handleFetchData()
341
- },
342
-
343
- isFetching (value) {
344
- this.$emit('update:fetching', value)
345
- }
346
- },
347
-
348
- created () {
349
- this.registerChartJS()
350
- this.handleFetchData()
351
- },
352
-
353
- beforeUnmount () {
354
- this.unregisterChartJS()
355
- },
356
-
357
- methods: {
358
- handleFetchData () {
359
- const hasBeforeFetch = typeof this.beforeFetch === 'function'
360
- const payload = {
361
- url: this.url,
362
- filters: this.filters
363
- }
364
-
365
- if (hasBeforeFetch && !this.cancelBeforeFetch) {
366
- return this.beforeFetch({
367
- payload,
368
- resolve: this.fetchData,
369
- done: () => {
370
- this.cancelBeforeFetch = true
371
- }
372
- })
373
- }
374
-
375
- this.fetchData(payload)
376
- },
377
-
378
- async fetchData (payload = {}) {
379
- try {
380
- this.isFetching = true
381
-
382
- const response = await getAction.call(this, {
383
- entity: this.entity,
384
- key: 'fetchList',
385
- payload
386
- })
387
-
388
- const { results } = response.data
389
- this.data = results
390
-
391
- this.$emit('fetch-success', response)
392
- } catch (error) {
393
- this.$qas.error('Ops… Não conseguimos acessar as informações. Por favor, tente novamente em alguns minutos.')
394
-
395
- this.$emit('fetch-error', error)
396
- } finally {
397
- this.isFetching = false
398
- this.isFetched = true
399
- }
400
- },
401
-
402
- getXAxisData (data = []) {
403
- if (this.isDoughnut && data.length > this.maxDoughnutSlices) {
404
- data = data.slice(0, this.maxDoughnutSlices - 1)
405
- data.push('Outros')
406
- }
407
-
408
- return data
409
- },
410
-
411
- getYAxisData (data = []) {
412
- if (this.isDoughnut && data.length > this.maxDoughnutSlices) {
413
- const otherSlicesValues = data
414
- .slice(this.maxDoughnutSlices - 1)
415
- .reduce((accumulator, currentValue) => accumulator + currentValue, 0)
416
-
417
- data = data.slice(0, this.maxDoughnutSlices - 1)
418
- data.push(otherSlicesValues)
419
- }
420
-
421
- return data
422
- },
423
-
424
- registerChartJS () {
425
- ChartJS.register(
426
- ...this.defaultChartItems,
427
- ...this.elementsChartItems[this.type]
428
- )
429
-
430
- ChartJS.defaults.font = font
431
- },
432
-
433
- unregisterChartJS () {
434
- ChartJS.unregister(
435
- ...this.defaultChartItems,
436
- ...this.elementsChartItems[this.type]
437
- )
438
- }
439
- }
440
- }
441
- </script>
1
+ <template>
2
+ <component :is="parentComponent.is" v-bind="parentComponent.props">
3
+ <qas-header v-if="hasHeader" v-bind="headerProps">
4
+ <template #right>
5
+ <qas-filters v-bind="chartFiltersProps" />
6
+ </template>
7
+ </qas-header>
8
+
9
+ <div v-bind="parentComponentProps">
10
+ <component :is="chartComponent.is" v-if="showChart" v-bind="chartComponent.props" />
11
+
12
+ <div v-else-if="!isFetching">
13
+ <slot name="empty-results">
14
+ <qas-empty-result-text />
15
+ </slot>
16
+ </div>
17
+
18
+ <q-inner-loading :showing="isFetching">
19
+ <q-spinner color="grey" size="3em" />
20
+ </q-inner-loading>
21
+ </div>
22
+ </component>
23
+ </template>
24
+
25
+ <script>
26
+ // Importações do chart.js
27
+ import {
28
+ Chart as ChartJS,
29
+ Title,
30
+ Tooltip,
31
+ Legend,
32
+ CategoryScale,
33
+ LinearScale,
34
+ BarElement,
35
+ LineElement,
36
+ PointElement,
37
+ ArcElement
38
+ } from 'chart.js'
39
+ import { Bar as BarChart, Doughnut as DoughnutChart, Line as LineChart } from 'vue-chartjs'
40
+
41
+ // Configurações padrões
42
+ import { charts, colors as defaultColors, font } from './config'
43
+
44
+ // Plugins
45
+ import zoomPlugin from 'chartjs-plugin-zoom'
46
+ import chartDataLabels from 'chartjs-plugin-datalabels'
47
+
48
+ // Outras importações
49
+ import { extend } from 'quasar'
50
+ import { filterListByHandle } from '../../helpers'
51
+ import { getAction } from '@bildvitta/store-adapter'
52
+
53
+ const ChartTypes = {
54
+ Bar: 'bar',
55
+ Doughnut: 'doughnut',
56
+ Line: 'line'
57
+ }
58
+
59
+ export default {
60
+ name: 'QasChartView',
61
+
62
+ components: {
63
+ BarChart,
64
+ DoughnutChart,
65
+ LineChart
66
+ },
67
+
68
+ props: {
69
+ beforeFetch: {
70
+ default: null,
71
+ type: Function
72
+ },
73
+
74
+ boxProps: {
75
+ default: () => ({}),
76
+ type: Object
77
+ },
78
+
79
+ colorsList: {
80
+ type: Array,
81
+ default: () => []
82
+ },
83
+
84
+ entity: {
85
+ required: true,
86
+ type: String
87
+ },
88
+
89
+ fetching: {
90
+ type: Boolean
91
+ },
92
+
93
+ filtersProps: {
94
+ default: () => ({}),
95
+ type: Object
96
+ },
97
+
98
+ height: {
99
+ default: '380px',
100
+ type: String
101
+ },
102
+
103
+ maxDoughnutSlices: {
104
+ default: 15,
105
+ type: Number
106
+ },
107
+
108
+ options: {
109
+ default: () => ({}),
110
+ type: Object
111
+ },
112
+
113
+ subtitle: {
114
+ default: '',
115
+ type: String
116
+ },
117
+
118
+ title: {
119
+ default: '',
120
+ type: String
121
+ },
122
+
123
+ type: {
124
+ default: ChartTypes.Bar,
125
+ type: String,
126
+ validator: value => Object.values(ChartTypes).includes(value)
127
+ },
128
+
129
+ url: {
130
+ default: '',
131
+ type: String
132
+ },
133
+
134
+ useBox: {
135
+ type: Boolean,
136
+ default: true
137
+ },
138
+
139
+ useFilterButton: {
140
+ type: Boolean
141
+ }
142
+ },
143
+
144
+ emits: [
145
+ 'fetch-error',
146
+ 'fetch-success',
147
+ 'update:fetching'
148
+ ],
149
+
150
+ data () {
151
+ return {
152
+ cancelBeforeFetch: false,
153
+ data: [],
154
+ filters: {},
155
+ isFetched: false,
156
+ isFetching: false
157
+ }
158
+ },
159
+
160
+ computed: {
161
+ chartData () {
162
+ if (!this.data.length) {
163
+ return {
164
+ labels: [],
165
+ datasets: []
166
+ }
167
+ }
168
+
169
+ const [dataset] = this.data
170
+ const labels = this.getXAxisData(dataset.data.map(item => item.x))
171
+ const colors = this.colorsList.length ? this.colorsList : defaultColors
172
+
173
+ const datasets = this.data.map(({ label, data }, index) => {
174
+ const backgroundColor = this.isDoughnut ? colors : colors.at(index)
175
+ const borderColor = this.isDoughnut ? 'white' : colors.at(index)
176
+ const yAxisData = []
177
+ const xAxisData = []
178
+
179
+ for (const dataKey in data) {
180
+ const item = data[dataKey]
181
+
182
+ if (item) {
183
+ yAxisData.push(item.y)
184
+ xAxisData.push(item.tooltip)
185
+ }
186
+ }
187
+
188
+ return {
189
+ backgroundColor,
190
+ borderColor,
191
+ data: this.getYAxisData(yAxisData),
192
+ label,
193
+ tooltips: this.getXAxisData(xAxisData)
194
+ }
195
+ })
196
+
197
+ return {
198
+ datasets,
199
+ labels
200
+ }
201
+ },
202
+
203
+ chartFiltersProps () {
204
+ const { entity, useFilterButton, url } = this
205
+
206
+ return {
207
+ class: 'q-mb-xs',
208
+ entity,
209
+ url,
210
+ useChip: false,
211
+ useFilterButton,
212
+ useSearch: false,
213
+ useSpacing: false,
214
+ useUpdateRoute: false,
215
+
216
+ ...this.filtersProps,
217
+
218
+ 'onUpdate:currentFilters': filters => {
219
+ this.filters = filters
220
+ this.filtersProps['onUpdate:currentFilters']?.(filters)
221
+ }
222
+ }
223
+ },
224
+
225
+ chartOptions () {
226
+ const { options, type } = this
227
+
228
+ return extend(true, charts[type], options)
229
+ },
230
+
231
+ chartPlugins () {
232
+ return filterListByHandle([
233
+ {
234
+ handle: this.isDoughnut,
235
+ item: chartDataLabels
236
+ },
237
+ {
238
+ handle: this.isBar || this.isLine,
239
+ item: zoomPlugin
240
+ }
241
+ ])
242
+ },
243
+
244
+ chartType () {
245
+ const components = {
246
+ bar: 'BarChart',
247
+ doughnut: 'DoughnutChart',
248
+ line: 'LineChart'
249
+ }
250
+
251
+ return components[this.type]
252
+ },
253
+
254
+ chartComponent () {
255
+ return {
256
+ is: this.chartType,
257
+ props: {
258
+ data: this.chartData,
259
+ options: this.chartOptions,
260
+ plugins: this.chartPlugins
261
+ }
262
+ }
263
+ },
264
+
265
+ parentComponentProps () {
266
+ const hasMinHeight = this.isFetching || this.hasDataSets
267
+
268
+ return {
269
+ class: 'relative-position',
270
+ style: `min-height: ${hasMinHeight ? this.height : 'auto'}`
271
+ }
272
+ },
273
+
274
+ hasDataSets () {
275
+ return !!this.chartData?.datasets.filter(dataset => dataset.data.length)?.length
276
+ },
277
+
278
+ hasHeader () {
279
+ return this.title || this.subtitle || this.useFilterButton
280
+ },
281
+
282
+ isBar () {
283
+ return this.type === 'bar'
284
+ },
285
+
286
+ isDoughnut () {
287
+ return this.type === 'doughnut'
288
+ },
289
+
290
+ isLine () {
291
+ return this.type === 'line'
292
+ },
293
+
294
+ showChart () {
295
+ return this.isFetched && this.hasDataSets
296
+ },
297
+
298
+ defaultChartItems () {
299
+ return [
300
+ CategoryScale,
301
+ LinearScale,
302
+ PointElement,
303
+ Title,
304
+ Tooltip,
305
+ Legend
306
+ ]
307
+ },
308
+
309
+ elementsChartItems () {
310
+ return {
311
+ bar: [BarElement],
312
+ doughnut: [ArcElement],
313
+ line: [LineElement]
314
+ }
315
+ },
316
+
317
+ headerProps () {
318
+ return {
319
+ alignColumns: 'end',
320
+ description: this.subtitle,
321
+ labelProps: {
322
+ label: this.title
323
+ }
324
+ }
325
+ },
326
+
327
+ parentComponent () {
328
+ return {
329
+ is: this.useBox ? 'qas-box' : 'div',
330
+
331
+ props: {
332
+ ...(this.useBox && { ...this.boxProps })
333
+ }
334
+ }
335
+ }
336
+ },
337
+
338
+ watch: {
339
+ filters () {
340
+ this.handleFetchData()
341
+ },
342
+
343
+ isFetching (value) {
344
+ this.$emit('update:fetching', value)
345
+ }
346
+ },
347
+
348
+ created () {
349
+ this.registerChartJS()
350
+ this.handleFetchData()
351
+ },
352
+
353
+ beforeUnmount () {
354
+ this.unregisterChartJS()
355
+ },
356
+
357
+ methods: {
358
+ handleFetchData () {
359
+ const hasBeforeFetch = typeof this.beforeFetch === 'function'
360
+ const payload = {
361
+ url: this.url,
362
+ filters: this.filters
363
+ }
364
+
365
+ if (hasBeforeFetch && !this.cancelBeforeFetch) {
366
+ return this.beforeFetch({
367
+ payload,
368
+ resolve: this.fetchData,
369
+ done: () => {
370
+ this.cancelBeforeFetch = true
371
+ }
372
+ })
373
+ }
374
+
375
+ this.fetchData(payload)
376
+ },
377
+
378
+ async fetchData (payload = {}) {
379
+ try {
380
+ this.isFetching = true
381
+
382
+ const response = await getAction.call(this, {
383
+ entity: this.entity,
384
+ key: 'fetchList',
385
+ payload
386
+ })
387
+
388
+ const { results } = response.data
389
+ this.data = results
390
+
391
+ this.$emit('fetch-success', response)
392
+ } catch (error) {
393
+ this.$qas.error('Ops… Não conseguimos acessar as informações. Por favor, tente novamente em alguns minutos.')
394
+
395
+ this.$emit('fetch-error', error)
396
+ } finally {
397
+ this.isFetching = false
398
+ this.isFetched = true
399
+ }
400
+ },
401
+
402
+ getXAxisData (data = []) {
403
+ if (this.isDoughnut && data.length > this.maxDoughnutSlices) {
404
+ data = data.slice(0, this.maxDoughnutSlices - 1)
405
+ data.push('Outros')
406
+ }
407
+
408
+ return data
409
+ },
410
+
411
+ getYAxisData (data = []) {
412
+ if (this.isDoughnut && data.length > this.maxDoughnutSlices) {
413
+ const otherSlicesValues = data
414
+ .slice(this.maxDoughnutSlices - 1)
415
+ .reduce((accumulator, currentValue) => accumulator + currentValue, 0)
416
+
417
+ data = data.slice(0, this.maxDoughnutSlices - 1)
418
+ data.push(otherSlicesValues)
419
+ }
420
+
421
+ return data
422
+ },
423
+
424
+ registerChartJS () {
425
+ ChartJS.register(
426
+ ...this.defaultChartItems,
427
+ ...this.elementsChartItems[this.type]
428
+ )
429
+
430
+ ChartJS.defaults.font = font
431
+ },
432
+
433
+ unregisterChartJS () {
434
+ ChartJS.unregister(
435
+ ...this.defaultChartItems,
436
+ ...this.elementsChartItems[this.type]
437
+ )
438
+ }
439
+ }
440
+ }
441
+ </script>