@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.
- package/package.json +1 -1
- package/src/asteroid.js +4 -4
- package/src/components/actions/QasActions.vue +81 -81
- package/src/components/actions/QasActions.yml +34 -34
- package/src/components/actions-menu/QasActionsMenu.vue +251 -251
- package/src/components/actions-menu/QasActionsMenu.yml +89 -89
- package/src/components/actions-menu/composables/use-delete.js +30 -30
- package/src/components/actions-menu/composables/use-double-split-actions.js +42 -42
- package/src/components/actions-menu/composables/use-options-actions.js +27 -27
- package/src/components/actions-menu/composables/use-single-action.js +17 -17
- package/src/components/actions-menu/composables/use-single-split-actions.js +35 -35
- package/src/components/actions-menu/composables/use-tooltips.js +43 -43
- package/src/components/actions-menu/utils/get-label.js +3 -3
- package/src/components/actions-menu/utils/set-click-handler.js +6 -6
- package/src/components/alert/QasAlert.test.js +43 -43
- package/src/components/alert/QasAlert.vue +110 -110
- package/src/components/alert/QasAlert.yml +39 -39
- package/src/components/app-bar/QasAppBar.vue +119 -119
- package/src/components/app-bar/QasAppBar.yml +44 -44
- package/src/components/app-menu/QasAppMenu.vue +392 -392
- package/src/components/app-menu/QasAppMenu.yml +73 -73
- package/src/components/app-menu/composables/use-app-menu-dropdown.js +71 -71
- package/src/components/app-menu/composables/use-app-user.js +49 -49
- package/src/components/app-menu/composables/use-development-badge.js +23 -23
- package/src/components/app-menu/private/PvAppMenuDropdown.vue +71 -71
- package/src/components/app-menu/private/PvAppMenuHelpChat.vue +222 -222
- package/src/components/app-user/QasAppUser.vue +281 -281
- package/src/components/app-user/QasAppUser.yml +56 -56
- package/src/components/avatar/QasAvatar.vue +95 -95
- package/src/components/avatar/QasAvatar.yml +38 -38
- package/src/components/avatar/enums/AvatarColors.js +10 -10
- package/src/components/badge/QasBadge.vue +87 -87
- package/src/components/badge/QasBadge.yml +55 -55
- package/src/components/board-generator/QasBoardGenerator.vue +712 -712
- package/src/components/board-generator/QasBoardGenerator.yml +167 -167
- package/src/components/box/QasBox.vue +51 -51
- package/src/components/box/QasBox.yml +29 -29
- package/src/components/breakline/QasBreakline.vue +38 -38
- package/src/components/breakline/QasBreakline.yml +25 -25
- package/src/components/btn/QasBtn.vue +148 -148
- package/src/components/btn/QasBtn.yml +48 -48
- package/src/components/btn-dropdown/QasBtnDropdown.vue +146 -146
- package/src/components/btn-dropdown/QasBtnDropdown.yml +59 -59
- package/src/components/card/QasCard.vue +132 -132
- package/src/components/card/QasCard.yml +44 -44
- package/src/components/card-image/QasCardImage.vue +95 -95
- package/src/components/card-image/QasCardImage.yml +48 -48
- package/src/components/chart-view/QasChartView.vue +441 -441
- package/src/components/chart-view/QasChartView.yml +109 -109
- package/src/components/chart-view/config/charts/bar.js +45 -45
- package/src/components/chart-view/config/charts/doughnut.js +43 -43
- package/src/components/chart-view/config/charts/index.js +9 -9
- package/src/components/chart-view/config/charts/line.js +57 -57
- package/src/components/chart-view/config/defaults/colors.js +19 -19
- package/src/components/chart-view/config/defaults/font.js +5 -5
- package/src/components/chart-view/config/defaults/index.js +2 -2
- package/src/components/chart-view/config/index.js +3 -3
- package/src/components/chart-view/config/plugins/index.js +3 -3
- package/src/components/chart-view/config/plugins/legend.js +9 -9
- package/src/components/chart-view/config/plugins/tooltip.js +15 -15
- package/src/components/chart-view/config/plugins/zoom.js +31 -31
- package/src/components/checkbox/QasCheckbox.vue +150 -150
- package/src/components/checkbox/QasCheckbox.yml +36 -36
- package/src/components/copy/QasCopy.vue +46 -46
- package/src/components/copy/QasCopy.yml +23 -23
- package/src/components/date/QasDate.vue +600 -600
- package/src/components/date/QasDate.yml +69 -69
- package/src/components/date/enums/DateMaskOptions.js +6 -6
- package/src/components/date-time-input/QasDateTimeInput.vue +269 -269
- package/src/components/date-time-input/QasDateTimeInput.yml +64 -64
- package/src/components/debugger/QasDebugger.vue +31 -31
- package/src/components/debugger/QasDebugger.yml +10 -10
- package/src/components/delete/QasDelete.vue +100 -100
- package/src/components/delete/QasDelete.yml +60 -60
- package/src/components/dialog/QasDialog.vue +217 -217
- package/src/components/dialog/QasDialog.yml +117 -117
- package/src/components/dialog/composables/use-cancel.js +40 -40
- package/src/components/dialog/composables/use-dynamic-components.js +86 -86
- package/src/components/dialog/composables/use-ok.js +45 -45
- package/src/components/dialog-router/QasDialogRouter.vue +86 -86
- package/src/components/dialog-router/QasDialogRouter.yml +23 -23
- package/src/components/drawer/QasDrawer.vue +118 -118
- package/src/components/drawer/QasDrawer.yml +58 -58
- package/src/components/empty-result-text/QasEmptyResultText.vue +18 -18
- package/src/components/empty-result-text/QasEmptyResultText.yml +14 -14
- package/src/components/expansion-item/QasExpansionItem.vue +291 -291
- package/src/components/expansion-item/QasExpansionItem.yml +76 -76
- package/src/components/field/QasField.vue +220 -220
- package/src/components/field/QasField.yml +36 -36
- package/src/components/filters/QasFilters.vue +472 -472
- package/src/components/filters/QasFilters.yml +171 -171
- package/src/components/filters/private/PvFiltersButton.vue +101 -101
- package/src/components/form-generator/QasFormGenerator.vue +274 -274
- package/src/components/form-generator/QasFormGenerator.yml +109 -109
- package/src/components/form-view/QasFormView.vue +484 -484
- package/src/components/form-view/QasFormView.yml +253 -253
- package/src/components/gallery/QasGallery.vue +243 -243
- package/src/components/gallery/QasGallery.yml +188 -188
- package/src/components/gallery/composables/use-delete.js +54 -54
- package/src/components/gallery/private/PvGalleryCarouselDialog.vue +92 -92
- package/src/components/gallery/private/PvGalleryDeleteDialog.vue +54 -54
- package/src/components/gallery-card/QasGalleryCard.vue +153 -153
- package/src/components/gallery-card/QasGalleryCard.yml +61 -61
- package/src/components/grabbable/QasGrabbable.vue +185 -185
- package/src/components/grabbable/QasGrabbable.yml +26 -26
- package/src/components/grid-generator/QasGridGenerator.vue +210 -210
- package/src/components/grid-generator/QasGridGenerator.yml +127 -127
- package/src/components/grid-item/QasGridItem.vue +89 -89
- package/src/components/grid-item/QasGridItem.yml +22 -22
- package/src/components/header/QasHeader.vue +152 -152
- package/src/components/header/QasHeader.yml +50 -50
- package/src/components/infinite-scroll/QasInfiniteScroll.vue +168 -168
- package/src/components/infinite-scroll/QasInfiniteScroll.yml +78 -78
- package/src/components/info/QasInfo.vue +155 -155
- package/src/components/info/QasInfo.yml +34 -34
- package/src/components/input/QasInput.vue +252 -252
- package/src/components/input/QasInput.yml +65 -65
- package/src/components/label/QasLabel.vue +61 -61
- package/src/components/label/QasLabel.yml +44 -44
- package/src/components/layout/QasLayout.vue +101 -101
- package/src/components/layout/QasLayout.yml +46 -46
- package/src/components/layout/private/PvLayoutNotificationCard.vue +86 -86
- package/src/components/layout/private/PvLayoutNotificationsDrawer.vue +140 -140
- package/src/components/list-items/QasListItems.vue +125 -125
- package/src/components/list-items/QasListItems.yml +71 -71
- package/src/components/list-view/QasListView.vue +302 -302
- package/src/components/list-view/QasListView.yml +169 -169
- package/src/components/map/QasMap.vue +75 -75
- package/src/components/map/QasMap.yml +33 -33
- package/src/components/nested-fields/QasNestedFields.vue +584 -584
- package/src/components/nested-fields/QasNestedFields.yml +296 -296
- package/src/components/numeric-input/QasNumericInput.vue +206 -206
- package/src/components/numeric-input/QasNumericInput.yml +85 -85
- package/src/components/option-group/QasOptionGroup.vue +54 -54
- package/src/components/option-group/QasOptionGroup.yml +30 -30
- package/src/components/page-header/QasPageHeader.vue +143 -143
- package/src/components/page-header/QasPageHeader.yml +42 -42
- package/src/components/pagination/QasPagination.vue +71 -71
- package/src/components/pagination/QasPagination.yml +4 -4
- package/src/components/password-input/QasPasswordInput.vue +110 -110
- package/src/components/password-input/QasPasswordInput.yml +111 -111
- package/src/components/password-strength-checker/QasPasswordStrengthChecker.vue +71 -71
- package/src/components/password-strength-checker/QasPasswordStrengthChecker.yml +103 -103
- package/src/components/profile/QasProfile.vue +98 -98
- package/src/components/profile/QasProfile.yml +60 -60
- package/src/components/radio/QasRadio.vue +62 -62
- package/src/components/radio/QasRadio.yml +11 -11
- package/src/components/resizer/QasResizer.vue +90 -90
- package/src/components/resizer/QasResizer.yml +24 -24
- package/src/components/search-box/QasSearchBox.vue +294 -294
- package/src/components/search-box/QasSearchBox.yml +154 -154
- package/src/components/search-input/QasSearchInput.vue +106 -106
- package/src/components/search-input/QasSearchInput.yml +48 -48
- package/src/components/select/QasSelect.vue +514 -514
- package/src/components/select/QasSelect.yml +157 -157
- package/src/components/select-list/QasSelectList.vue +238 -238
- package/src/components/select-list/QasSelectList.yml +108 -108
- package/src/components/select-list/private/PvSelectListCheckbox.vue +31 -31
- package/src/components/select-list-dialog/QasSelectListDialog.vue +395 -395
- package/src/components/select-list-dialog/QasSelectListDialog.yml +108 -108
- package/src/components/signature-pad/QasSignaturePad.vue +122 -122
- package/src/components/signature-pad/QasSignaturePad.yml +53 -53
- package/src/components/signature-uploader/QasSignatureUploader.vue +164 -164
- package/src/components/signature-uploader/QasSignatureUploader.yml +37 -37
- package/src/components/single-view/QasSingleView.vue +175 -175
- package/src/components/single-view/QasSingleView.yml +131 -131
- package/src/components/sortable/QasSortable.vue +151 -151
- package/src/components/sortable/QasSortable.yml +65 -65
- package/src/components/status/QasStatus.test.js +11 -11
- package/src/components/status/QasStatus.vue +29 -29
- package/src/components/status/QasStatus.yml +10 -10
- package/src/components/stepper/QasStepper.vue +199 -152
- package/src/components/stepper/QasStepper.yml +35 -35
- package/src/components/stepper-form-view/QasStepperFormView.vue +86 -84
- package/src/components/stepper-form-view/QasStepperFormView.yml +58 -58
- package/src/components/table-generator/QasTableGenerator.vue +416 -416
- package/src/components/table-generator/QasTableGenerator.yml +94 -94
- package/src/components/tabs-generator/QasTabsGenerator.vue +196 -196
- package/src/components/tabs-generator/QasTabsGenerator.yml +53 -53
- package/src/components/text-truncate/QasTextTruncate.vue +274 -274
- package/src/components/text-truncate/QasTextTruncate.yml +60 -60
- package/src/components/timeline/QasTimeline.vue +140 -140
- package/src/components/timeline/QasTimeline.yml +36 -36
- package/src/components/toggle/QasToggle.vue +14 -14
- package/src/components/toggle/QasToggle.yml +5 -5
- package/src/components/toggle-visibility/QasToggleVisibility.vue +79 -79
- package/src/components/toggle-visibility/QasToggleVisibility.yml +30 -30
- package/src/components/transfer/QasTransfer.vue +239 -239
- package/src/components/transfer/QasTransfer.yml +60 -60
- package/src/components/tree-generator/QasTreeForm.vue +62 -62
- package/src/components/tree-generator/QasTreeGenerator.vue +488 -488
- package/src/components/tree-generator/QasTreeGenerator.yml +81 -81
- package/src/components/uploader/QasUploader.vue +691 -645
- package/src/components/uploader/QasUploader.yml +206 -192
- package/src/components/uploader/private/PvUploaderGalleryCard.vue +357 -357
- package/src/components/welcome/QasWelcome.vue +125 -125
- package/src/components/welcome/QasWelcome.yml +23 -23
- package/src/components/welcome/private/PvWelcomeShortcutCard.vue +58 -58
- package/src/components/whatsapp-link/QasWhatsappLink.vue +34 -34
- package/src/components/whatsapp-link/QasWhatsappLink.yml +18 -18
- package/src/composables/index.js +8 -8
- package/src/composables/private/index.js +3 -3
- package/src/composables/private/use-generator.js +174 -174
- package/src/composables/private/use-toggle-visibility.js +48 -48
- package/src/composables/private/use-view.js +186 -186
- package/src/composables/use-context.js +15 -15
- package/src/composables/use-form.js +32 -32
- package/src/composables/use-history.js +46 -46
- package/src/composables/use-notifications.js +128 -128
- package/src/composables/use-query-cache.js +60 -60
- package/src/composables/use-screen.js +42 -42
- package/src/css/base/font-face.scss +28 -28
- package/src/css/base/index.scss +1 -1
- package/src/css/components/base.scss +12 -12
- package/src/css/components/button.scss +116 -116
- package/src/css/components/checkbox.scss +14 -14
- package/src/css/components/editor.scss +7 -7
- package/src/css/components/field.scss +88 -88
- package/src/css/components/index.scss +10 -10
- package/src/css/components/item.scss +52 -52
- package/src/css/components/radio.scss +18 -18
- package/src/css/components/scrollbar.scss +20 -20
- package/src/css/components/tabs.scss +3 -3
- package/src/css/components/toggle.scss +13 -13
- package/src/css/mixins/index.scss +3 -3
- package/src/css/mixins/set-brand.scss +15 -15
- package/src/css/mixins/set-button.scss +26 -26
- package/src/css/mixins/set-typography.scss +8 -8
- package/src/css/plugins/index.scss +2 -2
- package/src/css/plugins/loading.scss +5 -5
- package/src/css/plugins/notify.scss +100 -100
- package/src/css/utils/background.scss +34 -34
- package/src/css/utils/border-radius.scss +29 -29
- package/src/css/utils/border.scss +42 -42
- package/src/css/utils/container.scss +36 -36
- package/src/css/utils/fonts.scss +5 -5
- package/src/css/utils/index.scss +10 -10
- package/src/css/utils/line-height.scss +19 -19
- package/src/css/utils/opacity.scss +5 -5
- package/src/css/utils/scroll.scss +21 -21
- package/src/css/utils/text.scss +15 -15
- package/src/css/utils/unset.scss +8 -8
- package/src/css/variables/button.scss +4 -4
- package/src/css/variables/index.scss +6 -6
- package/src/css/variables/scrollbar.scss +11 -11
- package/src/css/variables/separator.scss +2 -2
- package/src/css/variables/shadow.scss +3 -3
- package/src/css/variables/spacing.scss +98 -98
- package/src/css/variables/typography.scss +149 -149
- package/src/directives/Test.js +13 -13
- package/src/enums/Align.js +7 -7
- package/src/enums/Spacing.js +98 -98
- package/src/enums/Status.js +33 -33
- package/src/helpers/add-counter-suffix.js +3 -3
- package/src/helpers/base-64-to-blob.js +21 -21
- package/src/helpers/camelize-fields-name.js +15 -15
- package/src/helpers/construct-object.js +29 -29
- package/src/helpers/copy-to-clipboard.js +15 -15
- package/src/helpers/destroy-nested-children-by-key.js +33 -33
- package/src/helpers/download-file.js +21 -21
- package/src/helpers/filter-list-by-handle.js +31 -31
- package/src/helpers/filter-object-to-array.js +29 -29
- package/src/helpers/filter-object.js +34 -34
- package/src/helpers/filters.js +163 -163
- package/src/helpers/find-children-by-key.js +14 -14
- package/src/helpers/get-greatest-common-divisor.js +16 -16
- package/src/helpers/get-normalized-options.js +20 -20
- package/src/helpers/get-placeholder.js +19 -19
- package/src/helpers/get-required-label.js +3 -3
- package/src/helpers/get-slot-children-text.js +15 -15
- package/src/helpers/handle-process.js +13 -13
- package/src/helpers/images.js +28 -28
- package/src/helpers/index.js +25 -25
- package/src/helpers/is-empty.js +3 -3
- package/src/helpers/is-local-development.js +3 -3
- package/src/helpers/private/gutter-validator.js +15 -15
- package/src/helpers/private/has-parent-by-class-name.js +15 -15
- package/src/helpers/promise-handler.js +40 -40
- package/src/helpers/rules.js +7 -7
- package/src/helpers/set-scroll-on-grab.js +128 -128
- package/src/index.cjs.js +1 -1
- package/src/index.esm.js +4 -4
- package/src/index.scss +38 -38
- package/src/index.umd.js +2 -2
- package/src/mixins/context.js +8 -8
- package/src/mixins/delete.js +48 -48
- package/src/mixins/dialog-router.js +17 -17
- package/src/mixins/form.js +11 -11
- package/src/mixins/generator.js +94 -94
- package/src/mixins/index.js +17 -17
- package/src/mixins/password.js +86 -86
- package/src/mixins/search-filter.js +354 -354
- package/src/mixins/view.js +156 -156
- package/src/pages/ErrorComponent.vue +74 -74
- package/src/pages/Forbidden.vue +29 -29
- package/src/pages/NotFound.vue +29 -29
- package/src/pages/ServerError.vue +29 -29
- package/src/pages/Unauthorized.vue +29 -29
- package/src/plugins/delete/Delete.js +107 -107
- package/src/plugins/delete/Delete.yml +75 -75
- package/src/plugins/dialog/Dialog.js +14 -14
- package/src/plugins/dialog/Dialog.yml +10 -10
- package/src/plugins/index.js +13 -13
- package/src/plugins/notify-error/NotifyError.js +13 -13
- package/src/plugins/notify-error/NotifyError.yml +11 -11
- package/src/plugins/notify-success/NotifySuccess.js +13 -13
- package/src/plugins/notify-success/NotifySuccess.yml +11 -11
- package/src/plugins/screen/Screen.js +35 -35
- package/src/plugins/screen/Screen.yml +16 -16
- package/src/shared/date-config.js +26 -26
- package/src/shared/fuse-config.js +4 -4
- package/src/shared/notify-config.js +7 -7
- package/src/vue-plugin/third-party-component-handler.js +29 -29
- package/src/vue-plugin.js +282 -282
|
@@ -1,645 +1,691 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="qas-uploader">
|
|
3
|
-
<q-uploader ref="uploader" auto-upload class="bg-transparent" :class="uploaderClasses" v-bind="attributes" :factory="factory" flat :max-files="maxFiles" method="PUT" @factory-failed="factoryFailed" @uploaded="uploaded" @uploading="updateUploading(true)">
|
|
4
|
-
<template #header="scope">
|
|
5
|
-
<slot name="header" :scope="scope">
|
|
6
|
-
<
|
|
7
|
-
<
|
|
8
|
-
<
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
</template>
|
|
37
|
-
</q-uploader>
|
|
38
|
-
|
|
39
|
-
<slot :context="self" name="custom-upload" />
|
|
40
|
-
</div>
|
|
41
|
-
</template>
|
|
42
|
-
|
|
43
|
-
<script>
|
|
44
|
-
import PvUploaderGalleryCard from './private/PvUploaderGalleryCard.vue'
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
import {
|
|
48
|
-
import {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
'image/
|
|
77
|
-
'image/
|
|
78
|
-
'image/
|
|
79
|
-
'image/
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
},
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
return this
|
|
304
|
-
},
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
return this
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
this.
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
this
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
const
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
return
|
|
433
|
-
},
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
},
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
},
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
return
|
|
478
|
-
},
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
return
|
|
482
|
-
},
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
if (file.
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
const
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
this.$emit('update:
|
|
590
|
-
},
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
this
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
this.
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
this
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
this.$
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<div class="qas-uploader">
|
|
3
|
+
<q-uploader ref="uploader" auto-upload class="bg-transparent" :class="uploaderClasses" v-bind="attributes" :factory="factory" flat :max-files="maxFiles" method="PUT" @factory-failed="factoryFailed" @uploaded="uploaded" @uploading="updateUploading(true)">
|
|
4
|
+
<template #header="scope">
|
|
5
|
+
<slot name="header" :scope="scope">
|
|
6
|
+
<qas-header class="q-mb-none" v-bind="getHeaderProps(scope)">
|
|
7
|
+
<template #description>
|
|
8
|
+
<div :class="headerDescriptionClasses">
|
|
9
|
+
{{ headerProps.description }}
|
|
10
|
+
</div>
|
|
11
|
+
</template>
|
|
12
|
+
|
|
13
|
+
<template v-for="(_, name) in $slots" #[getHeaderSlotName(name)]="context">
|
|
14
|
+
<slot :name v-bind="context" />
|
|
15
|
+
</template>
|
|
16
|
+
</qas-header>
|
|
17
|
+
|
|
18
|
+
<div v-if="errorMessage" class="q-mt-xs text-caption text-negative">
|
|
19
|
+
{{ errorMessage }}
|
|
20
|
+
</div>
|
|
21
|
+
|
|
22
|
+
<!-- ------------------------------------ tags hidden -------------------------------------- -->
|
|
23
|
+
<input ref="hiddenInput" :accept="attributes.accept" class="qas-uploader__input" :multiple="isMultiple" type="file">
|
|
24
|
+
<qas-btn ref="buttonCleanFiles" class="hidden" @click="scope.removeUploadedFiles" />
|
|
25
|
+
</slot>
|
|
26
|
+
</template>
|
|
27
|
+
|
|
28
|
+
<template #list="scope">
|
|
29
|
+
<div v-if="hasGalleryCardSection(getFilesList(scope.files, scope))" class="q-col-gutter-lg row">
|
|
30
|
+
<div v-for="(file, key, index) in getFilesList(scope.files, scope)" :key="index" :class="columnClasses">
|
|
31
|
+
<pv-uploader-gallery-card v-bind="getUploaderGalleryCardProps({ key, scope, file, index })" />
|
|
32
|
+
</div>
|
|
33
|
+
</div>
|
|
34
|
+
|
|
35
|
+
<qas-empty-result-text v-else />
|
|
36
|
+
</template>
|
|
37
|
+
</q-uploader>
|
|
38
|
+
|
|
39
|
+
<slot :context="self" name="custom-upload" />
|
|
40
|
+
</div>
|
|
41
|
+
</template>
|
|
42
|
+
|
|
43
|
+
<script>
|
|
44
|
+
import PvUploaderGalleryCard from './private/PvUploaderGalleryCard.vue'
|
|
45
|
+
import QasHeader from '../header/QasHeader.vue'
|
|
46
|
+
|
|
47
|
+
import { uid, extend } from 'quasar'
|
|
48
|
+
import { NotifyError } from '../../plugins'
|
|
49
|
+
import { getImageSize, getResizeDimensions } from '../../helpers/images.js'
|
|
50
|
+
|
|
51
|
+
import Pica from 'pica'
|
|
52
|
+
|
|
53
|
+
export default {
|
|
54
|
+
name: 'QasUploader',
|
|
55
|
+
|
|
56
|
+
components: {
|
|
57
|
+
PvUploaderGalleryCard,
|
|
58
|
+
QasHeader
|
|
59
|
+
},
|
|
60
|
+
|
|
61
|
+
inheritAttrs: false,
|
|
62
|
+
|
|
63
|
+
props: {
|
|
64
|
+
addButtonFn: {
|
|
65
|
+
type: Function,
|
|
66
|
+
default: undefined
|
|
67
|
+
},
|
|
68
|
+
|
|
69
|
+
addButtonLabel: {
|
|
70
|
+
default: 'Adicionar',
|
|
71
|
+
type: String
|
|
72
|
+
},
|
|
73
|
+
|
|
74
|
+
acceptResizeTypes: {
|
|
75
|
+
default: () => [
|
|
76
|
+
'image/jpeg',
|
|
77
|
+
'image/png',
|
|
78
|
+
'image/gif',
|
|
79
|
+
'image/bmp',
|
|
80
|
+
'image/webp',
|
|
81
|
+
'image/jpg'
|
|
82
|
+
],
|
|
83
|
+
type: Array
|
|
84
|
+
},
|
|
85
|
+
|
|
86
|
+
columns: {
|
|
87
|
+
type: Object,
|
|
88
|
+
default: () => ({})
|
|
89
|
+
},
|
|
90
|
+
|
|
91
|
+
dialogProps: {
|
|
92
|
+
type: Object,
|
|
93
|
+
default: () => ({})
|
|
94
|
+
},
|
|
95
|
+
|
|
96
|
+
entity: {
|
|
97
|
+
required: true,
|
|
98
|
+
type: String
|
|
99
|
+
},
|
|
100
|
+
|
|
101
|
+
error: {
|
|
102
|
+
type: Boolean
|
|
103
|
+
},
|
|
104
|
+
|
|
105
|
+
errorMessage: {
|
|
106
|
+
default: '',
|
|
107
|
+
type: String
|
|
108
|
+
},
|
|
109
|
+
|
|
110
|
+
fields: {
|
|
111
|
+
default: () => ({}),
|
|
112
|
+
type: Object
|
|
113
|
+
},
|
|
114
|
+
|
|
115
|
+
formGeneratorProps: {
|
|
116
|
+
default: () => ({}),
|
|
117
|
+
type: Object
|
|
118
|
+
},
|
|
119
|
+
|
|
120
|
+
galleryCardProps: {
|
|
121
|
+
type: [Object, Function],
|
|
122
|
+
default: () => ({})
|
|
123
|
+
},
|
|
124
|
+
|
|
125
|
+
gridGeneratorProps: {
|
|
126
|
+
default: () => ({}),
|
|
127
|
+
type: Object
|
|
128
|
+
},
|
|
129
|
+
|
|
130
|
+
headerProps: {
|
|
131
|
+
type: Object,
|
|
132
|
+
default: () => ({})
|
|
133
|
+
},
|
|
134
|
+
|
|
135
|
+
label: {
|
|
136
|
+
type: String,
|
|
137
|
+
default: ''
|
|
138
|
+
},
|
|
139
|
+
|
|
140
|
+
maxFiles: {
|
|
141
|
+
default: undefined,
|
|
142
|
+
type: Number
|
|
143
|
+
},
|
|
144
|
+
|
|
145
|
+
modelValue: {
|
|
146
|
+
default: '',
|
|
147
|
+
type: [String, Array, Object]
|
|
148
|
+
},
|
|
149
|
+
|
|
150
|
+
picaResizeOptions: {
|
|
151
|
+
default: () => ({}),
|
|
152
|
+
type: Object
|
|
153
|
+
},
|
|
154
|
+
|
|
155
|
+
readonly: {
|
|
156
|
+
type: Boolean
|
|
157
|
+
},
|
|
158
|
+
|
|
159
|
+
sizeLimit: {
|
|
160
|
+
default: 1280,
|
|
161
|
+
type: Number
|
|
162
|
+
},
|
|
163
|
+
|
|
164
|
+
uploadCredentialsParams: {
|
|
165
|
+
type: Object,
|
|
166
|
+
default: () => ({})
|
|
167
|
+
},
|
|
168
|
+
|
|
169
|
+
uploading: {
|
|
170
|
+
type: Boolean
|
|
171
|
+
},
|
|
172
|
+
|
|
173
|
+
useDownload: {
|
|
174
|
+
default: true,
|
|
175
|
+
type: Boolean
|
|
176
|
+
},
|
|
177
|
+
|
|
178
|
+
useObjectModel: {
|
|
179
|
+
type: Boolean
|
|
180
|
+
},
|
|
181
|
+
|
|
182
|
+
useResize: {
|
|
183
|
+
default: true,
|
|
184
|
+
type: Boolean
|
|
185
|
+
},
|
|
186
|
+
|
|
187
|
+
useUrlPath: {
|
|
188
|
+
type: Boolean,
|
|
189
|
+
default: true
|
|
190
|
+
}
|
|
191
|
+
},
|
|
192
|
+
|
|
193
|
+
emits: ['update:modelValue', 'update:uploading'],
|
|
194
|
+
|
|
195
|
+
data () {
|
|
196
|
+
return {
|
|
197
|
+
hasError: false,
|
|
198
|
+
hiddenInputElement: null,
|
|
199
|
+
savedFiles: {},
|
|
200
|
+
uploader: null
|
|
201
|
+
}
|
|
202
|
+
},
|
|
203
|
+
|
|
204
|
+
computed: {
|
|
205
|
+
attributes () {
|
|
206
|
+
return this.$attrs
|
|
207
|
+
},
|
|
208
|
+
|
|
209
|
+
headerDescriptionClasses () {
|
|
210
|
+
return {
|
|
211
|
+
'text-negative': this.error
|
|
212
|
+
}
|
|
213
|
+
},
|
|
214
|
+
|
|
215
|
+
columnClasses () {
|
|
216
|
+
const irregularClasses = ['col']
|
|
217
|
+
const columns = this.defaultColumns
|
|
218
|
+
|
|
219
|
+
const classes = []
|
|
220
|
+
|
|
221
|
+
const profiles = {
|
|
222
|
+
col: 'col',
|
|
223
|
+
xs: 'col-xs',
|
|
224
|
+
sm: 'col-sm',
|
|
225
|
+
md: 'col-md',
|
|
226
|
+
lg: 'col-lg',
|
|
227
|
+
xl: 'col-xl'
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
for (const key in columns) {
|
|
231
|
+
const column = columns[key]
|
|
232
|
+
|
|
233
|
+
if (irregularClasses.includes(column)) {
|
|
234
|
+
classes.push(profiles[key])
|
|
235
|
+
continue
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
classes.push(`${profiles[key]}-${column}`)
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
return classes
|
|
242
|
+
},
|
|
243
|
+
|
|
244
|
+
defaultColumns () {
|
|
245
|
+
return {
|
|
246
|
+
...(this.isMultiple ? { col: 12, sm: 6, md: 4, lg: 3 } : { col: 12, sm: 6 }),
|
|
247
|
+
...this.columns
|
|
248
|
+
}
|
|
249
|
+
},
|
|
250
|
+
|
|
251
|
+
defaultPicaResizeOptions () {
|
|
252
|
+
return {
|
|
253
|
+
unsharpAmount: 160,
|
|
254
|
+
unsharpRadius: 0.6,
|
|
255
|
+
unsharpThreshold: 1,
|
|
256
|
+
...this.picaResizeOptions
|
|
257
|
+
}
|
|
258
|
+
},
|
|
259
|
+
|
|
260
|
+
defaultUploaderGalleryCardProps () {
|
|
261
|
+
const {
|
|
262
|
+
fields,
|
|
263
|
+
formGeneratorProps,
|
|
264
|
+
galleryCardProps,
|
|
265
|
+
gridGeneratorProps,
|
|
266
|
+
useDownload,
|
|
267
|
+
useObjectModel,
|
|
268
|
+
dialogProps
|
|
269
|
+
} = this.$props
|
|
270
|
+
|
|
271
|
+
return {
|
|
272
|
+
dialogProps,
|
|
273
|
+
fields,
|
|
274
|
+
formGeneratorProps,
|
|
275
|
+
galleryCardProps,
|
|
276
|
+
gridGeneratorProps,
|
|
277
|
+
useDownload,
|
|
278
|
+
useObjectModel,
|
|
279
|
+
|
|
280
|
+
useMultiple: this.isMultiple
|
|
281
|
+
}
|
|
282
|
+
},
|
|
283
|
+
|
|
284
|
+
hasAddFile () {
|
|
285
|
+
if (this.readonly) return
|
|
286
|
+
|
|
287
|
+
const modelLength = this.useObjectModel
|
|
288
|
+
? Object.keys(this.modelValue).length
|
|
289
|
+
: this.modelValue?.length
|
|
290
|
+
|
|
291
|
+
return this.maxFiles && this.isMultiple ? modelLength < this.maxFiles : true
|
|
292
|
+
},
|
|
293
|
+
|
|
294
|
+
hasCustomUpload () {
|
|
295
|
+
return this.$slots['custom-upload']
|
|
296
|
+
},
|
|
297
|
+
|
|
298
|
+
hasHeaderSlot () {
|
|
299
|
+
return this.$slots.header
|
|
300
|
+
},
|
|
301
|
+
|
|
302
|
+
isMultiple () {
|
|
303
|
+
return this.$attrs.multiple || this.$attrs.multiple === ''
|
|
304
|
+
},
|
|
305
|
+
|
|
306
|
+
self () {
|
|
307
|
+
return this
|
|
308
|
+
},
|
|
309
|
+
|
|
310
|
+
uploaderClasses () {
|
|
311
|
+
return this.hasCustomUpload ? 'hidden' : 'fit'
|
|
312
|
+
}
|
|
313
|
+
},
|
|
314
|
+
|
|
315
|
+
mounted () {
|
|
316
|
+
this.hiddenInputElement = this.$refs.hiddenInput
|
|
317
|
+
this.uploader = this.$refs.uploader
|
|
318
|
+
|
|
319
|
+
this.hiddenInputElement?.addEventListener?.('change', this.addFiles)
|
|
320
|
+
|
|
321
|
+
if (this.useObjectModel) {
|
|
322
|
+
window.addEventListener('submit-success', this.handleSubmitSuccess)
|
|
323
|
+
}
|
|
324
|
+
},
|
|
325
|
+
|
|
326
|
+
unmounted () {
|
|
327
|
+
this.hiddenInputElement?.removeEventListener?.('change', this.addFiles)
|
|
328
|
+
|
|
329
|
+
if (this.useObjectModel) {
|
|
330
|
+
window.removeEventListener('submit-success', this.handleSubmitSuccess)
|
|
331
|
+
}
|
|
332
|
+
},
|
|
333
|
+
|
|
334
|
+
methods: {
|
|
335
|
+
async addFiles () {
|
|
336
|
+
const filesList = Array.from(this.hiddenInputElement.files)
|
|
337
|
+
const processedFiles = []
|
|
338
|
+
|
|
339
|
+
this.$refs.hiddenInput.value = ''
|
|
340
|
+
|
|
341
|
+
filesList.forEach(file => processedFiles.push(this.resizeImage(file)))
|
|
342
|
+
|
|
343
|
+
this.uploader.addFiles(await Promise.all(processedFiles))
|
|
344
|
+
},
|
|
345
|
+
|
|
346
|
+
dispatchUpload () {
|
|
347
|
+
this.$refs.buttonCleanFiles.$el.click()
|
|
348
|
+
this.hiddenInputElement.click()
|
|
349
|
+
},
|
|
350
|
+
|
|
351
|
+
async factory ([file]) {
|
|
352
|
+
if (!this.isMultiple && !this.hasHeaderSlot) {
|
|
353
|
+
this.$refs.buttonCleanFiles.$el.click()
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
const name = `${uid()}.${file.name.split('.').pop()}`
|
|
357
|
+
const { endpoint } = await this.fetchCredentials(name) || {}
|
|
358
|
+
|
|
359
|
+
if (!endpoint) return
|
|
360
|
+
|
|
361
|
+
return {
|
|
362
|
+
headers: [
|
|
363
|
+
{ name: 'Content-Type', value: file.type || 'image/jpeg' },
|
|
364
|
+
{ name: 'Content-Disposition', value: 'Attachment' }
|
|
365
|
+
],
|
|
366
|
+
sendRaw: true,
|
|
367
|
+
url: endpoint
|
|
368
|
+
}
|
|
369
|
+
},
|
|
370
|
+
|
|
371
|
+
factoryFailed () {
|
|
372
|
+
this.hasError = true
|
|
373
|
+
|
|
374
|
+
this.updateUploading(false)
|
|
375
|
+
|
|
376
|
+
NotifyError('Falha ao carregar arquivo.')
|
|
377
|
+
},
|
|
378
|
+
|
|
379
|
+
async fetchCredentials (filename) {
|
|
380
|
+
try {
|
|
381
|
+
const { data } = await this.$axios.post('/upload-credentials/', {
|
|
382
|
+
entity: this.entity,
|
|
383
|
+
filename,
|
|
384
|
+
...this.uploadCredentialsParams
|
|
385
|
+
})
|
|
386
|
+
|
|
387
|
+
return data
|
|
388
|
+
} catch {}
|
|
389
|
+
},
|
|
390
|
+
|
|
391
|
+
getFilesList (uploadedFiles) {
|
|
392
|
+
uploadedFiles = uploadedFiles.map((file, indexToDelete) => {
|
|
393
|
+
return {
|
|
394
|
+
isUploaded: true,
|
|
395
|
+
url: file.xhr ? this.getURLValue(file.xhr) : '',
|
|
396
|
+
name: file.name,
|
|
397
|
+
indexToDelete,
|
|
398
|
+
isFailed: this.isFailed(file)
|
|
399
|
+
}
|
|
400
|
+
})
|
|
401
|
+
|
|
402
|
+
const pathsList = Array.isArray(this.modelValue)
|
|
403
|
+
? this.modelValue
|
|
404
|
+
: (this.modelValue ? [this.modelValue] : [])
|
|
405
|
+
|
|
406
|
+
const mergedList = [...pathsList, ...uploadedFiles]
|
|
407
|
+
const files = {}
|
|
408
|
+
|
|
409
|
+
mergedList.forEach(file => {
|
|
410
|
+
if (this.useObjectModel && file.uuid) {
|
|
411
|
+
files[file.uuid] = file
|
|
412
|
+
return
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
if (file.isFailed) {
|
|
416
|
+
files[file.name] = file
|
|
417
|
+
return
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
if (typeof file === 'string') {
|
|
421
|
+
const fileName = this.getFileName(file)
|
|
422
|
+
files[fileName] = { url: file, isUploaded: false, name: fileName }
|
|
423
|
+
return
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
if (file.url) {
|
|
427
|
+
const fileName = this.getFileName(file.url)
|
|
428
|
+
files[fileName] = file
|
|
429
|
+
}
|
|
430
|
+
})
|
|
431
|
+
|
|
432
|
+
return files
|
|
433
|
+
},
|
|
434
|
+
|
|
435
|
+
getFileName (value) {
|
|
436
|
+
return value.split('/').pop()
|
|
437
|
+
},
|
|
438
|
+
|
|
439
|
+
/**
|
|
440
|
+
* Caso useUrlPath seja true, retorna de responseURL, senão tenta retornar o response
|
|
441
|
+
* que pode ser um base64, caso não tenha o response, retorna a responseURL.
|
|
442
|
+
*/
|
|
443
|
+
getURLValue (xhr) {
|
|
444
|
+
const responseURL = xhr.responseURL.split('?').shift()
|
|
445
|
+
|
|
446
|
+
return this.useUrlPath ? responseURL : (xhr.response || responseURL)
|
|
447
|
+
},
|
|
448
|
+
|
|
449
|
+
getModelValue (index) {
|
|
450
|
+
if (!this.useObjectModel) return {}
|
|
451
|
+
|
|
452
|
+
return this.isMultiple ? this.modelValue[index] || {} : this.modelValue
|
|
453
|
+
},
|
|
454
|
+
|
|
455
|
+
getUploaderGalleryCardProps ({ index, key, file, scope }) {
|
|
456
|
+
const modelValue = this.getModelValue(index)
|
|
457
|
+
|
|
458
|
+
return {
|
|
459
|
+
...this.defaultUploaderGalleryCardProps,
|
|
460
|
+
|
|
461
|
+
currentModelValue: modelValue,
|
|
462
|
+
file,
|
|
463
|
+
fileKey: key,
|
|
464
|
+
savedFiles: this.savedFiles,
|
|
465
|
+
|
|
466
|
+
// eventos
|
|
467
|
+
onRemove: () => this.removeFile(key, scope, file),
|
|
468
|
+
onUpdateModel: value => this.updateModelValue({ index, payload: value })
|
|
469
|
+
}
|
|
470
|
+
},
|
|
471
|
+
|
|
472
|
+
handleSubmitSuccess ({ detail: { entity } }) {
|
|
473
|
+
if (entity === this.entity) this.setSavedFiles()
|
|
474
|
+
},
|
|
475
|
+
|
|
476
|
+
hasGalleryCardSection (files) {
|
|
477
|
+
return Object.keys(files).length
|
|
478
|
+
},
|
|
479
|
+
|
|
480
|
+
isFailed (file) {
|
|
481
|
+
return file.__status === 'failed'
|
|
482
|
+
},
|
|
483
|
+
|
|
484
|
+
onAddButtonClick (scope) {
|
|
485
|
+
return this.addButtonFn ? this.addButtonFn(scope) : this.$refs.hiddenInput.click()
|
|
486
|
+
},
|
|
487
|
+
|
|
488
|
+
removeFile (key, scope, file) {
|
|
489
|
+
if (file.isUploaded) {
|
|
490
|
+
scope.removeFile(scope.files[file.indexToDelete])
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
if (file.isFailed) return
|
|
494
|
+
|
|
495
|
+
if (!this.isMultiple) {
|
|
496
|
+
return this.$emit('update:modelValue', this.useObjectModel ? {} : '')
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
const clonedValue = extend(true, [], this.modelValue)
|
|
500
|
+
|
|
501
|
+
const numberIndex = this.modelValue.findIndex(file => {
|
|
502
|
+
if (this.useObjectModel) {
|
|
503
|
+
return file.uuid === key || file.url.includes(key)
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
return this.getFileName(file) === key
|
|
507
|
+
})
|
|
508
|
+
|
|
509
|
+
clonedValue.splice(numberIndex, 1)
|
|
510
|
+
|
|
511
|
+
this.$emit('update:modelValue', clonedValue)
|
|
512
|
+
},
|
|
513
|
+
|
|
514
|
+
// Função para redimensionar imagens
|
|
515
|
+
async resizeImage (file) {
|
|
516
|
+
const { type } = file
|
|
517
|
+
|
|
518
|
+
if (!this.acceptResizeTypes.includes(type) || !this.useResize) return file
|
|
519
|
+
|
|
520
|
+
try {
|
|
521
|
+
const image = new Image()
|
|
522
|
+
const canvas = document.createElement('canvas')
|
|
523
|
+
|
|
524
|
+
image.src = URL.createObjectURL(file)
|
|
525
|
+
|
|
526
|
+
// Retorna largura e altura da original da imagem
|
|
527
|
+
const { width, height } = await getImageSize(image)
|
|
528
|
+
|
|
529
|
+
// Tamanho da imagem menor que o tamanho limite, sendo assim, não faz o resize
|
|
530
|
+
if (width <= this.sizeLimit) {
|
|
531
|
+
return file
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
// Retorna os novos tamanhos redimensionados
|
|
535
|
+
const resizedDimensions = getResizeDimensions(this.sizeLimit, width, height)
|
|
536
|
+
|
|
537
|
+
canvas.width = resizedDimensions.width
|
|
538
|
+
canvas.height = resizedDimensions.height
|
|
539
|
+
|
|
540
|
+
// Resolve problemas com cors
|
|
541
|
+
image.crossOrigin = ''
|
|
542
|
+
|
|
543
|
+
image.width = width
|
|
544
|
+
image.height = height
|
|
545
|
+
|
|
546
|
+
const pica = Pica()
|
|
547
|
+
const resizedImage = await pica.resize(image, canvas, this.defaultPicaResizeOptions)
|
|
548
|
+
const blob = await pica.toBlob(resizedImage, type, 0.90)
|
|
549
|
+
|
|
550
|
+
const newFile = new File([blob], file.name, { type })
|
|
551
|
+
|
|
552
|
+
return newFile
|
|
553
|
+
} catch {
|
|
554
|
+
// Caso não consiga redimensionar retorna o arquivo original
|
|
555
|
+
return file
|
|
556
|
+
}
|
|
557
|
+
},
|
|
558
|
+
|
|
559
|
+
setSavedFiles () {
|
|
560
|
+
if (this.isMultiple) {
|
|
561
|
+
this.modelValue.forEach(model => {
|
|
562
|
+
const fileName = this.getFileName(model.url)
|
|
563
|
+
|
|
564
|
+
this.savedFiles[fileName] = true
|
|
565
|
+
})
|
|
566
|
+
|
|
567
|
+
return
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
const fileName = this.getFileName(this.modelValue.url)
|
|
571
|
+
|
|
572
|
+
this.savedFiles[fileName] = true
|
|
573
|
+
},
|
|
574
|
+
|
|
575
|
+
updateModelValue ({ index, payload = {} }) {
|
|
576
|
+
if (!this.useObjectModel) return
|
|
577
|
+
|
|
578
|
+
if (this.isMultiple) {
|
|
579
|
+
const modelValue = [...this.modelValue]
|
|
580
|
+
const value = modelValue[index]
|
|
581
|
+
|
|
582
|
+
modelValue[index] = { ...value, ...payload }
|
|
583
|
+
|
|
584
|
+
this.$emit('update:modelValue', modelValue)
|
|
585
|
+
|
|
586
|
+
return
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
this.$emit('update:modelValue', { ...this.modelValue, ...payload })
|
|
590
|
+
},
|
|
591
|
+
|
|
592
|
+
updateUploading (uploading) {
|
|
593
|
+
this.$emit('update:uploading', uploading)
|
|
594
|
+
},
|
|
595
|
+
|
|
596
|
+
uploaded (response) {
|
|
597
|
+
this.hasError = false
|
|
598
|
+
|
|
599
|
+
const fullPath = this.getURLValue(response.xhr)
|
|
600
|
+
|
|
601
|
+
const objectValue = {
|
|
602
|
+
format: response.files[0].type,
|
|
603
|
+
url: fullPath,
|
|
604
|
+
name: response.files[0].name
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
const model = this.useObjectModel ? objectValue : fullPath
|
|
608
|
+
|
|
609
|
+
this.$emit('update:modelValue', this.isMultiple ? [...this.modelValue, model] : model || '')
|
|
610
|
+
|
|
611
|
+
this.updateUploading(false)
|
|
612
|
+
},
|
|
613
|
+
|
|
614
|
+
reset () {
|
|
615
|
+
this.$refs.uploader.reset()
|
|
616
|
+
|
|
617
|
+
const emptyModel = this.isMultiple ? [] : this.useObjectModel ? {} : ''
|
|
618
|
+
|
|
619
|
+
this.$emit('update:modelValue', emptyModel)
|
|
620
|
+
},
|
|
621
|
+
|
|
622
|
+
getHeaderSlotName (name) {
|
|
623
|
+
return name.replace('header-', '')
|
|
624
|
+
},
|
|
625
|
+
|
|
626
|
+
getHeaderProps (scope) {
|
|
627
|
+
const { labelProps, actionsMenuProps, ...othersHeaderProps } = this.headerProps
|
|
628
|
+
|
|
629
|
+
const { list, ...othersActionsMenuProps } = actionsMenuProps || {}
|
|
630
|
+
|
|
631
|
+
return {
|
|
632
|
+
spacing: 'lg',
|
|
633
|
+
|
|
634
|
+
labelProps: {
|
|
635
|
+
label: this.label,
|
|
636
|
+
|
|
637
|
+
margin: 'none',
|
|
638
|
+
|
|
639
|
+
...labelProps,
|
|
640
|
+
|
|
641
|
+
...(this.error && { color: 'negative' })
|
|
642
|
+
},
|
|
643
|
+
|
|
644
|
+
...(this.hasAddFile && {
|
|
645
|
+
actionsMenuProps: {
|
|
646
|
+
list: {
|
|
647
|
+
add: {
|
|
648
|
+
icon: 'sym_r_add',
|
|
649
|
+
label: this.addButtonLabel,
|
|
650
|
+
handler: () => this.onAddButtonClick(scope)
|
|
651
|
+
},
|
|
652
|
+
|
|
653
|
+
...list
|
|
654
|
+
},
|
|
655
|
+
|
|
656
|
+
...othersActionsMenuProps
|
|
657
|
+
}
|
|
658
|
+
}),
|
|
659
|
+
|
|
660
|
+
...othersHeaderProps
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
</script>
|
|
666
|
+
|
|
667
|
+
<style lang="scss">
|
|
668
|
+
.qas-uploader {
|
|
669
|
+
&__input {
|
|
670
|
+
display: none;
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
.q-uploader {
|
|
674
|
+
max-height: 100%;
|
|
675
|
+
|
|
676
|
+
&__header {
|
|
677
|
+
background-color: transparent;
|
|
678
|
+
color: $grey-10;
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
&__list {
|
|
682
|
+
min-height: 0;
|
|
683
|
+
padding: 0;
|
|
684
|
+
|
|
685
|
+
&.scroll {
|
|
686
|
+
overflow: unset;
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
</style>
|