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

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 (315) hide show
  1. package/package.json +1 -1
  2. package/src/assets/sounds/nave-notification.mp3 +0 -0
  3. package/src/asteroid.js +4 -4
  4. package/src/components/actions/QasActions.vue +81 -81
  5. package/src/components/actions/QasActions.yml +34 -34
  6. package/src/components/actions-menu/QasActionsMenu.vue +251 -251
  7. package/src/components/actions-menu/QasActionsMenu.yml +89 -89
  8. package/src/components/actions-menu/composables/use-delete.js +30 -30
  9. package/src/components/actions-menu/composables/use-double-split-actions.js +42 -42
  10. package/src/components/actions-menu/composables/use-options-actions.js +27 -27
  11. package/src/components/actions-menu/composables/use-single-action.js +17 -17
  12. package/src/components/actions-menu/composables/use-single-split-actions.js +35 -35
  13. package/src/components/actions-menu/composables/use-tooltips.js +43 -43
  14. package/src/components/actions-menu/utils/get-label.js +3 -3
  15. package/src/components/actions-menu/utils/set-click-handler.js +6 -6
  16. package/src/components/alert/QasAlert.test.js +43 -43
  17. package/src/components/alert/QasAlert.vue +110 -110
  18. package/src/components/alert/QasAlert.yml +39 -39
  19. package/src/components/app-bar/QasAppBar.vue +119 -119
  20. package/src/components/app-bar/QasAppBar.yml +44 -44
  21. package/src/components/app-menu/QasAppMenu.vue +392 -392
  22. package/src/components/app-menu/QasAppMenu.yml +73 -73
  23. package/src/components/app-menu/composables/use-app-menu-dropdown.js +71 -71
  24. package/src/components/app-menu/composables/use-app-user.js +49 -49
  25. package/src/components/app-menu/composables/use-development-badge.js +23 -23
  26. package/src/components/app-menu/private/PvAppMenuDropdown.vue +71 -71
  27. package/src/components/app-menu/private/PvAppMenuHelpChat.vue +222 -222
  28. package/src/components/app-user/QasAppUser.vue +281 -281
  29. package/src/components/app-user/QasAppUser.yml +56 -56
  30. package/src/components/avatar/QasAvatar.vue +95 -95
  31. package/src/components/avatar/QasAvatar.yml +38 -38
  32. package/src/components/avatar/enums/AvatarColors.js +10 -10
  33. package/src/components/badge/QasBadge.vue +87 -87
  34. package/src/components/badge/QasBadge.yml +55 -55
  35. package/src/components/board-generator/QasBoardGenerator.vue +712 -712
  36. package/src/components/board-generator/QasBoardGenerator.yml +167 -167
  37. package/src/components/box/QasBox.vue +51 -51
  38. package/src/components/box/QasBox.yml +29 -29
  39. package/src/components/breakline/QasBreakline.vue +38 -38
  40. package/src/components/breakline/QasBreakline.yml +25 -25
  41. package/src/components/btn/QasBtn.vue +148 -148
  42. package/src/components/btn/QasBtn.yml +48 -48
  43. package/src/components/btn-dropdown/QasBtnDropdown.vue +146 -146
  44. package/src/components/btn-dropdown/QasBtnDropdown.yml +59 -59
  45. package/src/components/card/QasCard.vue +132 -132
  46. package/src/components/card/QasCard.yml +44 -44
  47. package/src/components/card-image/QasCardImage.vue +95 -95
  48. package/src/components/card-image/QasCardImage.yml +48 -48
  49. package/src/components/chart-view/QasChartView.vue +441 -441
  50. package/src/components/chart-view/QasChartView.yml +109 -109
  51. package/src/components/chart-view/config/charts/bar.js +45 -45
  52. package/src/components/chart-view/config/charts/doughnut.js +43 -43
  53. package/src/components/chart-view/config/charts/index.js +9 -9
  54. package/src/components/chart-view/config/charts/line.js +57 -57
  55. package/src/components/chart-view/config/defaults/colors.js +19 -19
  56. package/src/components/chart-view/config/defaults/font.js +5 -5
  57. package/src/components/chart-view/config/defaults/index.js +2 -2
  58. package/src/components/chart-view/config/index.js +3 -3
  59. package/src/components/chart-view/config/plugins/index.js +3 -3
  60. package/src/components/chart-view/config/plugins/legend.js +9 -9
  61. package/src/components/chart-view/config/plugins/tooltip.js +15 -15
  62. package/src/components/chart-view/config/plugins/zoom.js +31 -31
  63. package/src/components/checkbox/QasCheckbox.vue +150 -150
  64. package/src/components/checkbox/QasCheckbox.yml +36 -36
  65. package/src/components/copy/QasCopy.vue +46 -46
  66. package/src/components/copy/QasCopy.yml +23 -23
  67. package/src/components/date/QasDate.vue +600 -600
  68. package/src/components/date/QasDate.yml +69 -69
  69. package/src/components/date/enums/DateMaskOptions.js +6 -6
  70. package/src/components/date-time-input/QasDateTimeInput.vue +269 -269
  71. package/src/components/date-time-input/QasDateTimeInput.yml +64 -64
  72. package/src/components/debugger/QasDebugger.vue +31 -31
  73. package/src/components/debugger/QasDebugger.yml +10 -10
  74. package/src/components/delete/QasDelete.vue +100 -100
  75. package/src/components/delete/QasDelete.yml +60 -60
  76. package/src/components/dialog/QasDialog.vue +217 -217
  77. package/src/components/dialog/QasDialog.yml +117 -117
  78. package/src/components/dialog/composables/use-cancel.js +40 -40
  79. package/src/components/dialog/composables/use-dynamic-components.js +86 -86
  80. package/src/components/dialog/composables/use-ok.js +45 -45
  81. package/src/components/dialog-router/QasDialogRouter.vue +86 -86
  82. package/src/components/dialog-router/QasDialogRouter.yml +23 -23
  83. package/src/components/drawer/QasDrawer.vue +118 -118
  84. package/src/components/drawer/QasDrawer.yml +58 -58
  85. package/src/components/empty-result-text/QasEmptyResultText.vue +18 -18
  86. package/src/components/empty-result-text/QasEmptyResultText.yml +14 -14
  87. package/src/components/expansion-item/QasExpansionItem.vue +291 -291
  88. package/src/components/expansion-item/QasExpansionItem.yml +76 -76
  89. package/src/components/field/QasField.vue +220 -220
  90. package/src/components/field/QasField.yml +36 -36
  91. package/src/components/filters/QasFilters.vue +472 -472
  92. package/src/components/filters/QasFilters.yml +171 -171
  93. package/src/components/filters/private/PvFiltersButton.vue +101 -101
  94. package/src/components/form-generator/QasFormGenerator.vue +274 -274
  95. package/src/components/form-generator/QasFormGenerator.yml +109 -109
  96. package/src/components/form-view/QasFormView.vue +484 -484
  97. package/src/components/form-view/QasFormView.yml +253 -253
  98. package/src/components/gallery/QasGallery.vue +243 -243
  99. package/src/components/gallery/QasGallery.yml +188 -188
  100. package/src/components/gallery/composables/use-delete.js +54 -54
  101. package/src/components/gallery/private/PvGalleryCarouselDialog.vue +92 -92
  102. package/src/components/gallery/private/PvGalleryDeleteDialog.vue +54 -54
  103. package/src/components/gallery-card/QasGalleryCard.vue +153 -153
  104. package/src/components/gallery-card/QasGalleryCard.yml +61 -61
  105. package/src/components/grabbable/QasGrabbable.vue +185 -185
  106. package/src/components/grabbable/QasGrabbable.yml +26 -26
  107. package/src/components/grid-generator/QasGridGenerator.vue +210 -210
  108. package/src/components/grid-generator/QasGridGenerator.yml +127 -127
  109. package/src/components/grid-item/QasGridItem.vue +89 -89
  110. package/src/components/grid-item/QasGridItem.yml +22 -22
  111. package/src/components/header/QasHeader.vue +152 -152
  112. package/src/components/header/QasHeader.yml +50 -50
  113. package/src/components/infinite-scroll/QasInfiniteScroll.vue +168 -168
  114. package/src/components/infinite-scroll/QasInfiniteScroll.yml +78 -78
  115. package/src/components/info/QasInfo.vue +155 -155
  116. package/src/components/info/QasInfo.yml +34 -34
  117. package/src/components/input/QasInput.vue +252 -252
  118. package/src/components/input/QasInput.yml +65 -65
  119. package/src/components/label/QasLabel.vue +61 -61
  120. package/src/components/label/QasLabel.yml +44 -44
  121. package/src/components/layout/QasLayout.vue +101 -101
  122. package/src/components/layout/QasLayout.yml +46 -46
  123. package/src/components/layout/private/PvLayoutNotificationCard.vue +86 -86
  124. package/src/components/layout/private/PvLayoutNotificationsDrawer.vue +140 -140
  125. package/src/components/list-items/QasListItems.vue +125 -125
  126. package/src/components/list-items/QasListItems.yml +71 -71
  127. package/src/components/list-view/QasListView.vue +302 -302
  128. package/src/components/list-view/QasListView.yml +169 -169
  129. package/src/components/map/QasMap.vue +75 -75
  130. package/src/components/map/QasMap.yml +33 -33
  131. package/src/components/nested-fields/QasNestedFields.vue +584 -584
  132. package/src/components/nested-fields/QasNestedFields.yml +296 -296
  133. package/src/components/numeric-input/QasNumericInput.vue +206 -206
  134. package/src/components/numeric-input/QasNumericInput.yml +85 -85
  135. package/src/components/option-group/QasOptionGroup.vue +54 -54
  136. package/src/components/option-group/QasOptionGroup.yml +30 -30
  137. package/src/components/page-header/QasPageHeader.vue +143 -143
  138. package/src/components/page-header/QasPageHeader.yml +42 -42
  139. package/src/components/pagination/QasPagination.vue +71 -71
  140. package/src/components/pagination/QasPagination.yml +4 -4
  141. package/src/components/password-input/QasPasswordInput.vue +110 -110
  142. package/src/components/password-input/QasPasswordInput.yml +111 -111
  143. package/src/components/password-strength-checker/QasPasswordStrengthChecker.vue +71 -71
  144. package/src/components/password-strength-checker/QasPasswordStrengthChecker.yml +103 -103
  145. package/src/components/profile/QasProfile.vue +98 -98
  146. package/src/components/profile/QasProfile.yml +60 -60
  147. package/src/components/radio/QasRadio.vue +62 -62
  148. package/src/components/radio/QasRadio.yml +11 -11
  149. package/src/components/resizer/QasResizer.vue +90 -90
  150. package/src/components/resizer/QasResizer.yml +24 -24
  151. package/src/components/search-box/QasSearchBox.vue +294 -294
  152. package/src/components/search-box/QasSearchBox.yml +154 -154
  153. package/src/components/search-input/QasSearchInput.vue +106 -106
  154. package/src/components/search-input/QasSearchInput.yml +48 -48
  155. package/src/components/select/QasSelect.vue +514 -514
  156. package/src/components/select/QasSelect.yml +157 -157
  157. package/src/components/select-list/QasSelectList.vue +238 -238
  158. package/src/components/select-list/QasSelectList.yml +108 -108
  159. package/src/components/select-list/private/PvSelectListCheckbox.vue +31 -31
  160. package/src/components/select-list-dialog/QasSelectListDialog.vue +395 -395
  161. package/src/components/select-list-dialog/QasSelectListDialog.yml +108 -108
  162. package/src/components/signature-pad/QasSignaturePad.vue +122 -122
  163. package/src/components/signature-pad/QasSignaturePad.yml +53 -53
  164. package/src/components/signature-uploader/QasSignatureUploader.vue +164 -164
  165. package/src/components/signature-uploader/QasSignatureUploader.yml +37 -37
  166. package/src/components/single-view/QasSingleView.vue +175 -175
  167. package/src/components/single-view/QasSingleView.yml +131 -131
  168. package/src/components/sortable/QasSortable.vue +151 -151
  169. package/src/components/sortable/QasSortable.yml +65 -65
  170. package/src/components/status/QasStatus.test.js +11 -11
  171. package/src/components/status/QasStatus.vue +29 -29
  172. package/src/components/status/QasStatus.yml +10 -10
  173. package/src/components/stepper/QasStepper.vue +152 -152
  174. package/src/components/stepper/QasStepper.yml +35 -35
  175. package/src/components/stepper-form-view/QasStepperFormView.vue +84 -84
  176. package/src/components/stepper-form-view/QasStepperFormView.yml +58 -58
  177. package/src/components/table-generator/QasTableGenerator.vue +416 -416
  178. package/src/components/table-generator/QasTableGenerator.yml +94 -94
  179. package/src/components/tabs-generator/QasTabsGenerator.vue +196 -196
  180. package/src/components/tabs-generator/QasTabsGenerator.yml +53 -53
  181. package/src/components/text-truncate/QasTextTruncate.vue +274 -274
  182. package/src/components/text-truncate/QasTextTruncate.yml +60 -60
  183. package/src/components/timeline/QasTimeline.vue +140 -140
  184. package/src/components/timeline/QasTimeline.yml +36 -36
  185. package/src/components/toggle/QasToggle.vue +14 -14
  186. package/src/components/toggle/QasToggle.yml +5 -5
  187. package/src/components/toggle-visibility/QasToggleVisibility.vue +79 -79
  188. package/src/components/toggle-visibility/QasToggleVisibility.yml +30 -30
  189. package/src/components/transfer/QasTransfer.vue +239 -239
  190. package/src/components/transfer/QasTransfer.yml +60 -60
  191. package/src/components/tree-generator/QasTreeForm.vue +62 -62
  192. package/src/components/tree-generator/QasTreeGenerator.vue +488 -488
  193. package/src/components/tree-generator/QasTreeGenerator.yml +81 -81
  194. package/src/components/uploader/QasUploader.vue +645 -645
  195. package/src/components/uploader/QasUploader.yml +192 -192
  196. package/src/components/uploader/private/PvUploaderGalleryCard.vue +357 -357
  197. package/src/components/welcome/QasWelcome.vue +125 -125
  198. package/src/components/welcome/QasWelcome.yml +23 -23
  199. package/src/components/welcome/private/PvWelcomeShortcutCard.vue +58 -58
  200. package/src/components/whatsapp-link/QasWhatsappLink.vue +34 -34
  201. package/src/components/whatsapp-link/QasWhatsappLink.yml +18 -18
  202. package/src/composables/index.js +8 -8
  203. package/src/composables/private/index.js +3 -3
  204. package/src/composables/private/use-generator.js +174 -174
  205. package/src/composables/private/use-toggle-visibility.js +48 -48
  206. package/src/composables/private/use-view.js +186 -186
  207. package/src/composables/use-context.js +15 -15
  208. package/src/composables/use-form.js +32 -32
  209. package/src/composables/use-history.js +46 -46
  210. package/src/composables/use-notifications.js +128 -114
  211. package/src/composables/use-query-cache.js +60 -60
  212. package/src/composables/use-screen.js +42 -42
  213. package/src/css/base/font-face.scss +28 -28
  214. package/src/css/base/index.scss +1 -1
  215. package/src/css/components/base.scss +12 -12
  216. package/src/css/components/button.scss +116 -116
  217. package/src/css/components/checkbox.scss +14 -14
  218. package/src/css/components/editor.scss +7 -7
  219. package/src/css/components/field.scss +88 -88
  220. package/src/css/components/index.scss +10 -10
  221. package/src/css/components/item.scss +52 -52
  222. package/src/css/components/radio.scss +18 -18
  223. package/src/css/components/scrollbar.scss +20 -20
  224. package/src/css/components/tabs.scss +3 -3
  225. package/src/css/components/toggle.scss +13 -13
  226. package/src/css/mixins/index.scss +3 -3
  227. package/src/css/mixins/set-brand.scss +15 -15
  228. package/src/css/mixins/set-button.scss +26 -26
  229. package/src/css/mixins/set-typography.scss +8 -8
  230. package/src/css/plugins/index.scss +2 -2
  231. package/src/css/plugins/loading.scss +5 -5
  232. package/src/css/plugins/notify.scss +100 -100
  233. package/src/css/utils/background.scss +34 -34
  234. package/src/css/utils/border-radius.scss +29 -29
  235. package/src/css/utils/border.scss +42 -42
  236. package/src/css/utils/container.scss +36 -36
  237. package/src/css/utils/fonts.scss +5 -5
  238. package/src/css/utils/index.scss +10 -10
  239. package/src/css/utils/line-height.scss +19 -19
  240. package/src/css/utils/opacity.scss +5 -5
  241. package/src/css/utils/scroll.scss +21 -21
  242. package/src/css/utils/text.scss +15 -15
  243. package/src/css/utils/unset.scss +8 -8
  244. package/src/css/variables/button.scss +4 -4
  245. package/src/css/variables/index.scss +6 -6
  246. package/src/css/variables/scrollbar.scss +11 -11
  247. package/src/css/variables/separator.scss +2 -2
  248. package/src/css/variables/shadow.scss +3 -3
  249. package/src/css/variables/spacing.scss +98 -98
  250. package/src/css/variables/typography.scss +149 -149
  251. package/src/directives/Test.js +13 -13
  252. package/src/enums/Align.js +7 -7
  253. package/src/enums/Spacing.js +98 -98
  254. package/src/enums/Status.js +33 -33
  255. package/src/helpers/add-counter-suffix.js +3 -3
  256. package/src/helpers/base-64-to-blob.js +21 -21
  257. package/src/helpers/camelize-fields-name.js +15 -15
  258. package/src/helpers/construct-object.js +29 -29
  259. package/src/helpers/copy-to-clipboard.js +15 -15
  260. package/src/helpers/destroy-nested-children-by-key.js +33 -33
  261. package/src/helpers/download-file.js +21 -21
  262. package/src/helpers/filter-list-by-handle.js +31 -31
  263. package/src/helpers/filter-object-to-array.js +29 -29
  264. package/src/helpers/filter-object.js +34 -34
  265. package/src/helpers/filters.js +163 -163
  266. package/src/helpers/find-children-by-key.js +14 -14
  267. package/src/helpers/get-greatest-common-divisor.js +16 -16
  268. package/src/helpers/get-normalized-options.js +20 -20
  269. package/src/helpers/get-placeholder.js +19 -19
  270. package/src/helpers/get-required-label.js +3 -3
  271. package/src/helpers/get-slot-children-text.js +15 -15
  272. package/src/helpers/handle-process.js +13 -13
  273. package/src/helpers/images.js +28 -28
  274. package/src/helpers/index.js +25 -25
  275. package/src/helpers/is-empty.js +3 -3
  276. package/src/helpers/is-local-development.js +3 -3
  277. package/src/helpers/private/gutter-validator.js +15 -15
  278. package/src/helpers/private/has-parent-by-class-name.js +15 -15
  279. package/src/helpers/promise-handler.js +40 -40
  280. package/src/helpers/rules.js +7 -7
  281. package/src/helpers/set-scroll-on-grab.js +128 -128
  282. package/src/index.cjs.js +1 -1
  283. package/src/index.esm.js +4 -4
  284. package/src/index.scss +38 -38
  285. package/src/index.umd.js +2 -2
  286. package/src/mixins/context.js +8 -8
  287. package/src/mixins/delete.js +48 -48
  288. package/src/mixins/dialog-router.js +17 -17
  289. package/src/mixins/form.js +11 -11
  290. package/src/mixins/generator.js +94 -94
  291. package/src/mixins/index.js +17 -17
  292. package/src/mixins/password.js +86 -86
  293. package/src/mixins/search-filter.js +354 -354
  294. package/src/mixins/view.js +156 -156
  295. package/src/pages/ErrorComponent.vue +74 -74
  296. package/src/pages/Forbidden.vue +29 -29
  297. package/src/pages/NotFound.vue +29 -29
  298. package/src/pages/ServerError.vue +29 -29
  299. package/src/pages/Unauthorized.vue +29 -29
  300. package/src/plugins/delete/Delete.js +107 -107
  301. package/src/plugins/delete/Delete.yml +75 -75
  302. package/src/plugins/dialog/Dialog.js +14 -14
  303. package/src/plugins/dialog/Dialog.yml +10 -10
  304. package/src/plugins/index.js +13 -13
  305. package/src/plugins/notify-error/NotifyError.js +13 -13
  306. package/src/plugins/notify-error/NotifyError.yml +11 -11
  307. package/src/plugins/notify-success/NotifySuccess.js +13 -13
  308. package/src/plugins/notify-success/NotifySuccess.yml +11 -11
  309. package/src/plugins/screen/Screen.js +35 -35
  310. package/src/plugins/screen/Screen.yml +16 -16
  311. package/src/shared/date-config.js +26 -26
  312. package/src/shared/fuse-config.js +4 -4
  313. package/src/shared/notify-config.js +7 -7
  314. package/src/vue-plugin/third-party-component-handler.js +29 -29
  315. package/src/vue-plugin.js +282 -282
@@ -1,484 +1,484 @@
1
- <template>
2
- <div class="qas-form-view" :class="mx_componentClass">
3
- <header v-if="mx_hasHeaderSlot">
4
- <slot name="header" />
5
- </header>
6
-
7
- <q-form ref="form" v-bind="defaultFormProps">
8
- <slot v-if="mx_canShowFetchErrorSlot" name="fetch-error" />
9
-
10
- <slot v-else />
11
-
12
- <slot v-if="useActions" name="actions">
13
- <qas-actions>
14
- <template v-if="useSubmitButton" #primary>
15
- <qas-btn class="qas-form-view__btn" :data-cy="`form-view-submit-btn-${entity}`" :disable="disable" :label="submitButtonLabel" :loading="isSubmitting" type="submit" variant="primary" />
16
- </template>
17
-
18
- <template v-if="hasCancelButton" #secondary>
19
- <qas-btn v-close-popup class="qas-form-view__btn" :data-cy="`form-view-cancel-btn-${entity}`" :disable="isSubmitting" :label="cancelButtonLabel" type="button" variant="secondary" @click="cancel" />
20
- </template>
21
- </qas-actions>
22
- </slot>
23
- </q-form>
24
-
25
- <footer v-if="mx_hasFooterSlot">
26
- <slot name="footer" />
27
- </footer>
28
-
29
- <qas-dialog v-model="showDialog" v-bind="defaultDialogProps" />
30
-
31
- <q-inner-loading :showing="mx_isFetching">
32
- <q-spinner color="grey" size="3em" />
33
- </q-inner-loading>
34
- </div>
35
- </template>
36
-
37
- <script>
38
- import QasBtn from '../btn/QasBtn.vue'
39
- import QasDialog from '../dialog/QasDialog.vue'
40
-
41
- import { NotifyError, NotifySuccess } from '../../plugins'
42
- import { useHistory } from '../../composables'
43
- import { viewMixin } from '../../mixins'
44
-
45
- import debug from 'debug'
46
- import { extend } from 'quasar'
47
- import { getAction } from '@bildvitta/store-adapter'
48
- import { isEqualWith } from 'lodash-es'
49
- import { onBeforeRouteLeave } from 'vue-router'
50
-
51
- const log = debug('asteroid-ui:qas-form-view')
52
-
53
- export default {
54
- name: 'QasFormView',
55
-
56
- components: {
57
- QasBtn,
58
- QasDialog
59
- },
60
-
61
- mixins: [viewMixin],
62
-
63
- props: {
64
- beforeSubmit: {
65
- default: null,
66
- type: Function
67
- },
68
-
69
- cancelButtonLabel: {
70
- default: 'Voltar',
71
- type: String
72
- },
73
-
74
- cancelRoute: {
75
- default: '',
76
- type: [Boolean, Object, String, Function]
77
- },
78
-
79
- customId: {
80
- default: '',
81
- type: [Number, String]
82
- },
83
-
84
- disable: {
85
- type: Boolean
86
- },
87
-
88
- formProps: {
89
- type: Object,
90
- default: () => ({})
91
- },
92
-
93
- mode: {
94
- default: 'create',
95
- type: String
96
- },
97
-
98
- route: {
99
- default: () => ({}),
100
- type: Object
101
- },
102
-
103
- useDialogOnUnsavedChanges: {
104
- default: true,
105
- type: Boolean
106
- },
107
-
108
- ignoreKeysInUnsavedChanges: {
109
- default: () => [],
110
- type: Array
111
- },
112
-
113
- submitButtonLabel: {
114
- default: 'Salvar',
115
- type: String
116
- },
117
-
118
- modelValue: {
119
- default: () => ({}),
120
- type: Object
121
- },
122
-
123
- submitting: {
124
- type: Boolean
125
- },
126
-
127
- useActions: {
128
- default: true,
129
- type: Boolean
130
- },
131
-
132
- useCancelButton: {
133
- default: true,
134
- type: Boolean
135
- },
136
-
137
- useNotifySuccess: {
138
- type: Boolean,
139
- default: true
140
- },
141
-
142
- useSubmitButton: {
143
- default: true,
144
- type: Boolean
145
- }
146
- },
147
-
148
- emits: [
149
- 'submit-success',
150
- 'submit-error',
151
- 'fetch-success',
152
- 'fetch-error',
153
- 'update:modelValue',
154
- 'update:submitting',
155
- 'update:errors'
156
- ],
157
-
158
- data () {
159
- return {
160
- cachedResult: {},
161
- isSubmitting: false,
162
- showDialog: false,
163
- ignoreRouterGuard: false,
164
-
165
- defaultDialogProps: {
166
- card: {
167
- description: 'Você está deixando a página e suas alterações serão perdidas. Tem certeza que deseja sair sem salvar?'
168
- },
169
-
170
- ok: { label: 'Continuar editando' },
171
-
172
- cancel: { label: 'Sair' }
173
- }
174
- }
175
- },
176
-
177
- computed: {
178
- fetchURL () {
179
- return this.url ? (`${this.url}/${this.isCreateMode ? 'new' : 'edit'}`) : ''
180
- },
181
-
182
- hasCancelButton () {
183
- return !(typeof this.cancelRoute === 'boolean' && !this.cancelRoute) && this.useCancelButton
184
- },
185
-
186
- id () {
187
- return this.customId || this.resolvedRoute.params.id
188
- },
189
-
190
- isCreateMode () {
191
- return this.mode === 'create'
192
- },
193
-
194
- resolvedRoute () {
195
- if (this.route && Object.keys(this.route).length) {
196
- return this.route
197
- }
198
-
199
- return this.$route
200
- },
201
-
202
- defaultNotifyMessages () {
203
- return {
204
- validationError: 'Não conseguimos salvar as informações. Por favor, revise os campos e tente novamente.',
205
- error: 'Não conseguimos salvar as informações. Por favor, tente novamente em alguns minutos.',
206
- success: 'Informações salvas com sucesso.'
207
- }
208
- },
209
-
210
- defaultFormProps () {
211
- return {
212
- ...this.formProps,
213
-
214
- onSubmit: event => {
215
- this.submitHandler(event)
216
- this.formProps?.onSubmit?.(event)
217
- }
218
- }
219
- }
220
- },
221
-
222
- watch: {
223
- isSubmitting (value) {
224
- this.$emit('update:submitting', value)
225
- },
226
-
227
- '$route.path' () {
228
- this.ignoreRouterGuard = false
229
- }
230
- },
231
-
232
- created () {
233
- this.useDialogOnUnsavedChanges && onBeforeRouteLeave(this.beforeRouteLeave)
234
-
235
- window.addEventListener('delete-success', this.setIgnoreRouterGuard)
236
-
237
- this.mx_fetchHandler({ form: true, id: this.id, url: this.fetchURL }, this.fetchSingle)
238
- },
239
-
240
- onUnmounted () {
241
- window.removeEventListener('delete-success', this.setIgnoreRouterGuard)
242
- },
243
-
244
- methods: {
245
- beforeRouteLeave (to, from, next) {
246
- const clonedModelValue = extend(true, {}, this.modelValue)
247
- const clonedCachedResult = extend(true, {}, this.cachedResult)
248
-
249
- /**
250
- * Se a propriedade "useDialogOnUnsavedChanges" for false ou a variável
251
- * "ignoreRouterGuard" for true, então **não** iremos checar se o usuário
252
- * alterou algum campo antes de sair da pagina, senão iremos validar pela função isEqualWith
253
- * e mostrar um dialog antes do usuário sair da página.
254
- */
255
- if (
256
- !this.useDialogOnUnsavedChanges ||
257
- this.ignoreRouterGuard ||
258
- isEqualWith(
259
- clonedModelValue,
260
- clonedCachedResult,
261
- this.handleIgnoreKeysInUnsavedChanges
262
- )
263
- ) {
264
- return next()
265
- }
266
-
267
- this.handleDialog(() => {
268
- this.ignoreRouterGuard = true
269
- next()
270
- })
271
- },
272
-
273
- cancel () {
274
- this.handleCancelRoute()
275
- },
276
-
277
- async fetchSingle (externalPayload = {}) {
278
- this.mx_isFetching = true
279
-
280
- try {
281
- const payload = {
282
- form: true,
283
- id: this.id,
284
- url: this.fetchURL,
285
- ...externalPayload
286
- }
287
-
288
- const response = await getAction.call(this, {
289
- entity: this.entity,
290
- key: 'fetchSingle',
291
- payload
292
- })
293
-
294
- const { errors, fields, metadata, result } = response.data
295
-
296
- const modelValue = { ...this.getModelsByFields(fields), ...this.modelValue }
297
-
298
- this.mx_setErrors(errors)
299
- this.mx_setFields(fields)
300
- this.mx_setMetadata(metadata)
301
-
302
- this.mx_updateModels({
303
- errors,
304
- fields: this.mx_fields,
305
- metadata
306
- })
307
-
308
- result && Object.assign(modelValue, result)
309
-
310
- if (this.useDialogOnUnsavedChanges) {
311
- this.cachedResult = extend(true, {}, result || modelValue)
312
- }
313
-
314
- this.$emit('update:modelValue', modelValue)
315
- this.$emit('fetch-success', response, this.modelValue)
316
-
317
- log(`[${this.entity}]:fetchSingle:success`, { response, modelValue })
318
- } catch (error) {
319
- this.mx_fetchError(error)
320
- this.$emit('fetch-error', error)
321
-
322
- log(`[${this.entity}]:fetchSingle:error`, error)
323
- } finally {
324
- this.mx_isFetching = false
325
- }
326
- },
327
-
328
- getModelsByFields (fields) {
329
- const models = {}
330
-
331
- for (const field in fields) {
332
- models[field] = fields[field].default
333
- }
334
-
335
- return models
336
- },
337
-
338
- handleCancelRoute () {
339
- if (typeof this.cancelRoute === 'function') {
340
- return this.cancelRoute()
341
- }
342
-
343
- if (this.cancelRoute && ['string', 'object'].includes(typeof this.cancelRoute)) {
344
- return this.$router.push(this.cancelRoute)
345
- }
346
-
347
- const [, path] = this.$route.path.split('/')
348
- const resolvedPath = this.$router.resolve(`/${path}`)
349
-
350
- this.$router.push(resolvedPath)
351
- },
352
-
353
- handleDialog (next) {
354
- this.openDialog()
355
-
356
- const { addRoute } = useHistory()
357
-
358
- this.defaultDialogProps.ok.onClick = () => addRoute(this.$route)
359
-
360
- this.defaultDialogProps.cancel.onClick = next
361
- },
362
-
363
- openDialog () {
364
- this.showDialog = true
365
- },
366
-
367
- // ignora chaves na hora de validar quando usuário está saindo da página
368
- handleIgnoreKeysInUnsavedChanges (firstValue, secondValue) {
369
- if (!this.ignoreKeysInUnsavedChanges.length) return
370
-
371
- this.ignoreKeysInUnsavedChanges.forEach(key => {
372
- if (firstValue) delete firstValue[key]
373
-
374
- if (secondValue) delete secondValue[key]
375
- })
376
- },
377
-
378
- /**
379
- * Se existe a propriedade com callback "beforeSubmit", então o controle de quando e como chamar o método "submit"
380
- * está sendo controlado fora do QasFormView, se não existir a propriedade "beforeSubmit", então o controle do método
381
- * submit é feito pelo próprio QasFormView, chamado pelo evento @submit.
382
- */
383
- submitHandler (event) {
384
- if (event) {
385
- event.preventDefault()
386
- }
387
-
388
- const hasBeforeSubmit = typeof this.beforeSubmit === 'function'
389
-
390
- if (hasBeforeSubmit) {
391
- return this.beforeSubmit({
392
- payload: { id: this.id, payload: this.modelValue, url: this.url },
393
- resolve: payload => this.submit(payload)
394
- })
395
- }
396
-
397
- this.submit()
398
- },
399
-
400
- async submit (externalPayload = {}) {
401
- if (this.disable) return null
402
-
403
- this.isSubmitting = true
404
-
405
- try {
406
- const payload = {
407
- id: this.id,
408
- payload: this.modelValue,
409
- url: this.url,
410
- ...externalPayload
411
- }
412
-
413
- const response = await getAction.call(this, {
414
- entity: this.entity,
415
- key: this.mode,
416
- payload
417
- })
418
-
419
- const modelValue = { ...this.modelValue, ...response.data.result }
420
-
421
- if (this.useDialogOnUnsavedChanges) {
422
- this.cachedResult = extend(true, {}, modelValue)
423
- }
424
-
425
- this.mx_setErrors()
426
- this.$emit('update:errors', this.mx_errors)
427
-
428
- this.$emit('update:modelValue', modelValue)
429
- this.$emit('submit-success', response, this.modelValue)
430
-
431
- this.createSubmitSuccessEvent({ ...payload, entity: this.entity })
432
-
433
- if (this.useNotifySuccess) {
434
- NotifySuccess(response.data.status.text || this.defaultNotifyMessages.success)
435
- }
436
-
437
- log(`[${this.entity}]:submit:success`, { response, modelValue })
438
- } catch (error) {
439
- const errors = error?.response?.data?.errors
440
- const message = error?.response?.data?.status?.text
441
- const hasFieldError = !!Object.keys(errors || {})?.length
442
-
443
- const defaultMessage = hasFieldError
444
- ? this.defaultNotifyMessages.validationError
445
- : this.defaultNotifyMessages.error
446
-
447
- this.mx_setErrors(errors)
448
- this.$emit('update:errors', this.mx_errors)
449
-
450
- NotifyError(message || defaultMessage)
451
-
452
- this.$emit('submit-error', error)
453
-
454
- log(`[${this.entity}]:submit:error`, error)
455
- } finally {
456
- this.isSubmitting = false
457
- }
458
- },
459
-
460
- createSubmitSuccessEvent (detail = {}) {
461
- const event = new CustomEvent('submit-success', {
462
- bubbles: false,
463
- cancelable: false,
464
- detail
465
- })
466
-
467
- window.dispatchEvent(event)
468
- },
469
-
470
- setIgnoreRouterGuard ({ detail: { id, entity } }) {
471
- this.ignoreRouterGuard = this.id === id && this.entity === entity
472
- }
473
- }
474
- }
475
- </script>
476
-
477
- <style lang="scss">
478
- .qas-form-view {
479
- &__btn {
480
- min-width: 132px;
481
- width: 100%;
482
- }
483
- }
484
- </style>
1
+ <template>
2
+ <div class="qas-form-view" :class="mx_componentClass">
3
+ <header v-if="mx_hasHeaderSlot">
4
+ <slot name="header" />
5
+ </header>
6
+
7
+ <q-form ref="form" v-bind="defaultFormProps">
8
+ <slot v-if="mx_canShowFetchErrorSlot" name="fetch-error" />
9
+
10
+ <slot v-else />
11
+
12
+ <slot v-if="useActions" name="actions">
13
+ <qas-actions>
14
+ <template v-if="useSubmitButton" #primary>
15
+ <qas-btn class="qas-form-view__btn" :data-cy="`form-view-submit-btn-${entity}`" :disable="disable" :label="submitButtonLabel" :loading="isSubmitting" type="submit" variant="primary" />
16
+ </template>
17
+
18
+ <template v-if="hasCancelButton" #secondary>
19
+ <qas-btn v-close-popup class="qas-form-view__btn" :data-cy="`form-view-cancel-btn-${entity}`" :disable="isSubmitting" :label="cancelButtonLabel" type="button" variant="secondary" @click="cancel" />
20
+ </template>
21
+ </qas-actions>
22
+ </slot>
23
+ </q-form>
24
+
25
+ <footer v-if="mx_hasFooterSlot">
26
+ <slot name="footer" />
27
+ </footer>
28
+
29
+ <qas-dialog v-model="showDialog" v-bind="defaultDialogProps" />
30
+
31
+ <q-inner-loading :showing="mx_isFetching">
32
+ <q-spinner color="grey" size="3em" />
33
+ </q-inner-loading>
34
+ </div>
35
+ </template>
36
+
37
+ <script>
38
+ import QasBtn from '../btn/QasBtn.vue'
39
+ import QasDialog from '../dialog/QasDialog.vue'
40
+
41
+ import { NotifyError, NotifySuccess } from '../../plugins'
42
+ import { useHistory } from '../../composables'
43
+ import { viewMixin } from '../../mixins'
44
+
45
+ import debug from 'debug'
46
+ import { extend } from 'quasar'
47
+ import { getAction } from '@bildvitta/store-adapter'
48
+ import { isEqualWith } from 'lodash-es'
49
+ import { onBeforeRouteLeave } from 'vue-router'
50
+
51
+ const log = debug('asteroid-ui:qas-form-view')
52
+
53
+ export default {
54
+ name: 'QasFormView',
55
+
56
+ components: {
57
+ QasBtn,
58
+ QasDialog
59
+ },
60
+
61
+ mixins: [viewMixin],
62
+
63
+ props: {
64
+ beforeSubmit: {
65
+ default: null,
66
+ type: Function
67
+ },
68
+
69
+ cancelButtonLabel: {
70
+ default: 'Voltar',
71
+ type: String
72
+ },
73
+
74
+ cancelRoute: {
75
+ default: '',
76
+ type: [Boolean, Object, String, Function]
77
+ },
78
+
79
+ customId: {
80
+ default: '',
81
+ type: [Number, String]
82
+ },
83
+
84
+ disable: {
85
+ type: Boolean
86
+ },
87
+
88
+ formProps: {
89
+ type: Object,
90
+ default: () => ({})
91
+ },
92
+
93
+ mode: {
94
+ default: 'create',
95
+ type: String
96
+ },
97
+
98
+ route: {
99
+ default: () => ({}),
100
+ type: Object
101
+ },
102
+
103
+ useDialogOnUnsavedChanges: {
104
+ default: true,
105
+ type: Boolean
106
+ },
107
+
108
+ ignoreKeysInUnsavedChanges: {
109
+ default: () => [],
110
+ type: Array
111
+ },
112
+
113
+ submitButtonLabel: {
114
+ default: 'Salvar',
115
+ type: String
116
+ },
117
+
118
+ modelValue: {
119
+ default: () => ({}),
120
+ type: Object
121
+ },
122
+
123
+ submitting: {
124
+ type: Boolean
125
+ },
126
+
127
+ useActions: {
128
+ default: true,
129
+ type: Boolean
130
+ },
131
+
132
+ useCancelButton: {
133
+ default: true,
134
+ type: Boolean
135
+ },
136
+
137
+ useNotifySuccess: {
138
+ type: Boolean,
139
+ default: true
140
+ },
141
+
142
+ useSubmitButton: {
143
+ default: true,
144
+ type: Boolean
145
+ }
146
+ },
147
+
148
+ emits: [
149
+ 'submit-success',
150
+ 'submit-error',
151
+ 'fetch-success',
152
+ 'fetch-error',
153
+ 'update:modelValue',
154
+ 'update:submitting',
155
+ 'update:errors'
156
+ ],
157
+
158
+ data () {
159
+ return {
160
+ cachedResult: {},
161
+ isSubmitting: false,
162
+ showDialog: false,
163
+ ignoreRouterGuard: false,
164
+
165
+ defaultDialogProps: {
166
+ card: {
167
+ description: 'Você está deixando a página e suas alterações serão perdidas. Tem certeza que deseja sair sem salvar?'
168
+ },
169
+
170
+ ok: { label: 'Continuar editando' },
171
+
172
+ cancel: { label: 'Sair' }
173
+ }
174
+ }
175
+ },
176
+
177
+ computed: {
178
+ fetchURL () {
179
+ return this.url ? (`${this.url}/${this.isCreateMode ? 'new' : 'edit'}`) : ''
180
+ },
181
+
182
+ hasCancelButton () {
183
+ return !(typeof this.cancelRoute === 'boolean' && !this.cancelRoute) && this.useCancelButton
184
+ },
185
+
186
+ id () {
187
+ return this.customId || this.resolvedRoute.params.id
188
+ },
189
+
190
+ isCreateMode () {
191
+ return this.mode === 'create'
192
+ },
193
+
194
+ resolvedRoute () {
195
+ if (this.route && Object.keys(this.route).length) {
196
+ return this.route
197
+ }
198
+
199
+ return this.$route
200
+ },
201
+
202
+ defaultNotifyMessages () {
203
+ return {
204
+ validationError: 'Não conseguimos salvar as informações. Por favor, revise os campos e tente novamente.',
205
+ error: 'Não conseguimos salvar as informações. Por favor, tente novamente em alguns minutos.',
206
+ success: 'Informações salvas com sucesso.'
207
+ }
208
+ },
209
+
210
+ defaultFormProps () {
211
+ return {
212
+ ...this.formProps,
213
+
214
+ onSubmit: event => {
215
+ this.submitHandler(event)
216
+ this.formProps?.onSubmit?.(event)
217
+ }
218
+ }
219
+ }
220
+ },
221
+
222
+ watch: {
223
+ isSubmitting (value) {
224
+ this.$emit('update:submitting', value)
225
+ },
226
+
227
+ '$route.path' () {
228
+ this.ignoreRouterGuard = false
229
+ }
230
+ },
231
+
232
+ created () {
233
+ this.useDialogOnUnsavedChanges && onBeforeRouteLeave(this.beforeRouteLeave)
234
+
235
+ window.addEventListener('delete-success', this.setIgnoreRouterGuard)
236
+
237
+ this.mx_fetchHandler({ form: true, id: this.id, url: this.fetchURL }, this.fetchSingle)
238
+ },
239
+
240
+ onUnmounted () {
241
+ window.removeEventListener('delete-success', this.setIgnoreRouterGuard)
242
+ },
243
+
244
+ methods: {
245
+ beforeRouteLeave (to, from, next) {
246
+ const clonedModelValue = extend(true, {}, this.modelValue)
247
+ const clonedCachedResult = extend(true, {}, this.cachedResult)
248
+
249
+ /**
250
+ * Se a propriedade "useDialogOnUnsavedChanges" for false ou a variável
251
+ * "ignoreRouterGuard" for true, então **não** iremos checar se o usuário
252
+ * alterou algum campo antes de sair da pagina, senão iremos validar pela função isEqualWith
253
+ * e mostrar um dialog antes do usuário sair da página.
254
+ */
255
+ if (
256
+ !this.useDialogOnUnsavedChanges ||
257
+ this.ignoreRouterGuard ||
258
+ isEqualWith(
259
+ clonedModelValue,
260
+ clonedCachedResult,
261
+ this.handleIgnoreKeysInUnsavedChanges
262
+ )
263
+ ) {
264
+ return next()
265
+ }
266
+
267
+ this.handleDialog(() => {
268
+ this.ignoreRouterGuard = true
269
+ next()
270
+ })
271
+ },
272
+
273
+ cancel () {
274
+ this.handleCancelRoute()
275
+ },
276
+
277
+ async fetchSingle (externalPayload = {}) {
278
+ this.mx_isFetching = true
279
+
280
+ try {
281
+ const payload = {
282
+ form: true,
283
+ id: this.id,
284
+ url: this.fetchURL,
285
+ ...externalPayload
286
+ }
287
+
288
+ const response = await getAction.call(this, {
289
+ entity: this.entity,
290
+ key: 'fetchSingle',
291
+ payload
292
+ })
293
+
294
+ const { errors, fields, metadata, result } = response.data
295
+
296
+ const modelValue = { ...this.getModelsByFields(fields), ...this.modelValue }
297
+
298
+ this.mx_setErrors(errors)
299
+ this.mx_setFields(fields)
300
+ this.mx_setMetadata(metadata)
301
+
302
+ this.mx_updateModels({
303
+ errors,
304
+ fields: this.mx_fields,
305
+ metadata
306
+ })
307
+
308
+ result && Object.assign(modelValue, result)
309
+
310
+ if (this.useDialogOnUnsavedChanges) {
311
+ this.cachedResult = extend(true, {}, result || modelValue)
312
+ }
313
+
314
+ this.$emit('update:modelValue', modelValue)
315
+ this.$emit('fetch-success', response, this.modelValue)
316
+
317
+ log(`[${this.entity}]:fetchSingle:success`, { response, modelValue })
318
+ } catch (error) {
319
+ this.mx_fetchError(error)
320
+ this.$emit('fetch-error', error)
321
+
322
+ log(`[${this.entity}]:fetchSingle:error`, error)
323
+ } finally {
324
+ this.mx_isFetching = false
325
+ }
326
+ },
327
+
328
+ getModelsByFields (fields) {
329
+ const models = {}
330
+
331
+ for (const field in fields) {
332
+ models[field] = fields[field].default
333
+ }
334
+
335
+ return models
336
+ },
337
+
338
+ handleCancelRoute () {
339
+ if (typeof this.cancelRoute === 'function') {
340
+ return this.cancelRoute()
341
+ }
342
+
343
+ if (this.cancelRoute && ['string', 'object'].includes(typeof this.cancelRoute)) {
344
+ return this.$router.push(this.cancelRoute)
345
+ }
346
+
347
+ const [, path] = this.$route.path.split('/')
348
+ const resolvedPath = this.$router.resolve(`/${path}`)
349
+
350
+ this.$router.push(resolvedPath)
351
+ },
352
+
353
+ handleDialog (next) {
354
+ this.openDialog()
355
+
356
+ const { addRoute } = useHistory()
357
+
358
+ this.defaultDialogProps.ok.onClick = () => addRoute(this.$route)
359
+
360
+ this.defaultDialogProps.cancel.onClick = next
361
+ },
362
+
363
+ openDialog () {
364
+ this.showDialog = true
365
+ },
366
+
367
+ // ignora chaves na hora de validar quando usuário está saindo da página
368
+ handleIgnoreKeysInUnsavedChanges (firstValue, secondValue) {
369
+ if (!this.ignoreKeysInUnsavedChanges.length) return
370
+
371
+ this.ignoreKeysInUnsavedChanges.forEach(key => {
372
+ if (firstValue) delete firstValue[key]
373
+
374
+ if (secondValue) delete secondValue[key]
375
+ })
376
+ },
377
+
378
+ /**
379
+ * Se existe a propriedade com callback "beforeSubmit", então o controle de quando e como chamar o método "submit"
380
+ * está sendo controlado fora do QasFormView, se não existir a propriedade "beforeSubmit", então o controle do método
381
+ * submit é feito pelo próprio QasFormView, chamado pelo evento @submit.
382
+ */
383
+ submitHandler (event) {
384
+ if (event) {
385
+ event.preventDefault()
386
+ }
387
+
388
+ const hasBeforeSubmit = typeof this.beforeSubmit === 'function'
389
+
390
+ if (hasBeforeSubmit) {
391
+ return this.beforeSubmit({
392
+ payload: { id: this.id, payload: this.modelValue, url: this.url },
393
+ resolve: payload => this.submit(payload)
394
+ })
395
+ }
396
+
397
+ this.submit()
398
+ },
399
+
400
+ async submit (externalPayload = {}) {
401
+ if (this.disable) return null
402
+
403
+ this.isSubmitting = true
404
+
405
+ try {
406
+ const payload = {
407
+ id: this.id,
408
+ payload: this.modelValue,
409
+ url: this.url,
410
+ ...externalPayload
411
+ }
412
+
413
+ const response = await getAction.call(this, {
414
+ entity: this.entity,
415
+ key: this.mode,
416
+ payload
417
+ })
418
+
419
+ const modelValue = { ...this.modelValue, ...response.data.result }
420
+
421
+ if (this.useDialogOnUnsavedChanges) {
422
+ this.cachedResult = extend(true, {}, modelValue)
423
+ }
424
+
425
+ this.mx_setErrors()
426
+ this.$emit('update:errors', this.mx_errors)
427
+
428
+ this.$emit('update:modelValue', modelValue)
429
+ this.$emit('submit-success', response, this.modelValue)
430
+
431
+ this.createSubmitSuccessEvent({ ...payload, entity: this.entity })
432
+
433
+ if (this.useNotifySuccess) {
434
+ NotifySuccess(response.data.status.text || this.defaultNotifyMessages.success)
435
+ }
436
+
437
+ log(`[${this.entity}]:submit:success`, { response, modelValue })
438
+ } catch (error) {
439
+ const errors = error?.response?.data?.errors
440
+ const message = error?.response?.data?.status?.text
441
+ const hasFieldError = !!Object.keys(errors || {})?.length
442
+
443
+ const defaultMessage = hasFieldError
444
+ ? this.defaultNotifyMessages.validationError
445
+ : this.defaultNotifyMessages.error
446
+
447
+ this.mx_setErrors(errors)
448
+ this.$emit('update:errors', this.mx_errors)
449
+
450
+ NotifyError(message || defaultMessage)
451
+
452
+ this.$emit('submit-error', error)
453
+
454
+ log(`[${this.entity}]:submit:error`, error)
455
+ } finally {
456
+ this.isSubmitting = false
457
+ }
458
+ },
459
+
460
+ createSubmitSuccessEvent (detail = {}) {
461
+ const event = new CustomEvent('submit-success', {
462
+ bubbles: false,
463
+ cancelable: false,
464
+ detail
465
+ })
466
+
467
+ window.dispatchEvent(event)
468
+ },
469
+
470
+ setIgnoreRouterGuard ({ detail: { id, entity } }) {
471
+ this.ignoreRouterGuard = this.id === id && this.entity === entity
472
+ }
473
+ }
474
+ }
475
+ </script>
476
+
477
+ <style lang="scss">
478
+ .qas-form-view {
479
+ &__btn {
480
+ min-width: 132px;
481
+ width: 100%;
482
+ }
483
+ }
484
+ </style>