@bildvitta/quasar-ui-asteroid 2.17.0 → 3.0.0-alpha.3
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/dist/api/QasActions.json +40 -0
- package/dist/api/QasActionsMenu.json +64 -0
- package/dist/api/QasAlert.json +40 -0
- package/dist/api/QasAppBar.json +52 -0
- package/dist/api/QasAppMenu.json +38 -0
- package/dist/api/QasAvatar.json +44 -0
- package/dist/api/QasBox.json +16 -0
- package/dist/api/QasBreakline.json +32 -0
- package/dist/api/QasBtn.json +16 -0
- package/dist/api/QasCard.json +52 -0
- package/dist/api/QasCheckboxGroup.json +38 -0
- package/dist/api/QasCopy.json +29 -0
- package/dist/api/QasDateTimeInput.json +60 -0
- package/dist/api/QasDebugger.json +13 -0
- package/dist/api/QasDelete.json +64 -0
- package/dist/api/QasDialog.json +109 -0
- package/dist/api/QasDialogRouter.json +31 -0
- package/dist/api/QasField.json +56 -0
- package/dist/api/QasFilters.json +111 -0
- package/dist/api/QasFormGenerator.json +92 -0
- package/dist/api/QasFormView.json +228 -0
- package/dist/api/QasGallery.json +54 -0
- package/dist/api/QasGridGenerator.json +108 -0
- package/dist/api/QasInput.json +40 -0
- package/dist/api/QasLabel.json +40 -0
- package/dist/api/QasLayout.json +47 -0
- package/dist/api/QasListItems.json +72 -0
- package/dist/api/QasListView.json +161 -0
- package/dist/api/QasMap.json +41 -0
- package/dist/api/QasNestedFields.json +223 -0
- package/dist/api/QasNumericInput.json +68 -0
- package/dist/api/QasPageHeader.json +36 -0
- package/dist/api/QasPasswordInput.json +121 -0
- package/dist/api/QasPasswordStrengthChecker.json +126 -0
- package/dist/api/QasProfile.json +74 -0
- package/dist/api/QasResizer.json +34 -0
- package/dist/api/QasSearchBox.json +91 -0
- package/dist/api/QasSelect.json +88 -0
- package/dist/api/QasSelectList.json +134 -0
- package/dist/api/QasSignaturePad.json +63 -0
- package/dist/api/QasSignatureUploader.json +41 -0
- package/dist/api/QasSingleView.json +147 -0
- package/dist/api/QasSortable.json +80 -0
- package/dist/api/QasTableGenerator.json +56 -0
- package/dist/api/QasTabsGenerator.json +90 -0
- package/dist/api/QasTextTruncate.json +38 -0
- package/dist/api/QasTransfer.json +70 -0
- package/dist/api/QasUploader.json +143 -0
- package/dist/asteroid.cjs.css +1 -0
- package/dist/asteroid.cjs.js +9307 -0
- package/dist/asteroid.cjs.min.js +6 -0
- package/dist/asteroid.esm.css +1 -0
- package/dist/asteroid.esm.js +9298 -0
- package/dist/asteroid.esm.min.js +6 -0
- package/dist/asteroid.umd.css +1 -0
- package/dist/asteroid.umd.js +9301 -0
- package/dist/asteroid.umd.min.js +6 -0
- package/dist/vetur/asteroid-attributes.json +1178 -0
- package/dist/vetur/asteroid-tags.json +535 -0
- package/package.json +41 -56
- package/src/assets/logo-modular.svg +1 -1
- package/src/asteroid.js +1 -0
- package/src/components/actions/QasActions.vue +45 -0
- package/src/components/actions/QasActions.yml +24 -0
- package/src/components/actions-menu/QasActionsMenu.vue +41 -14
- package/src/components/actions-menu/QasActionsMenu.yml +63 -0
- package/src/components/alert/QasAlert.vue +90 -0
- package/src/components/alert/QasAlert.yml +33 -0
- package/src/components/app-bar/QasAppBar.vue +16 -13
- package/src/components/app-bar/QasAppBar.yml +51 -0
- package/src/components/app-menu/QasAppMenu.vue +10 -12
- package/src/components/app-menu/QasAppMenu.yml +32 -0
- package/src/components/avatar/QasAvatar.vue +17 -9
- package/src/components/avatar/QasAvatar.yml +38 -0
- package/src/components/box/QasBox.vue +12 -4
- package/src/components/box/QasBox.yml +13 -0
- package/src/components/breakline/QasBreakline.vue +37 -0
- package/src/components/breakline/QasBreakline.yml +25 -0
- package/src/components/btn/QasBtn.vue +27 -24
- package/src/components/btn/QasBtn.yml +13 -0
- package/src/components/card/QasCard.vue +32 -33
- package/src/components/card/QasCard.yml +42 -0
- package/src/components/checkbox-group/QasCheckboxGroup.vue +50 -17
- package/src/components/checkbox-group/QasCheckboxGroup.yml +30 -0
- package/src/components/copy/QasCopy.vue +22 -11
- package/src/components/copy/QasCopy.yml +20 -0
- package/src/components/date-time-input/QasDateTimeInput.vue +18 -26
- package/src/components/date-time-input/QasDateTimeInput.yml +54 -0
- package/src/components/debugger/QasDebugger.vue +2 -0
- package/src/components/debugger/QasDebugger.yml +10 -0
- package/src/components/delete/QasDelete.vue +43 -16
- package/src/components/delete/QasDelete.yml +52 -0
- package/src/components/dialog/QasDialog.vue +63 -67
- package/src/components/dialog/QasDialog.yml +86 -0
- package/src/components/dialog-router/QasDialogRouter.vue +14 -4
- package/src/components/dialog-router/QasDialogRouter.yml +23 -0
- package/src/components/field/QasField.vue +21 -24
- package/src/components/field/QasField.yml +31 -0
- package/src/components/filters/QasFilters.vue +33 -26
- package/src/components/filters/QasFilters.yml +91 -0
- package/src/components/form-generator/QasFormGenerator.vue +13 -15
- package/src/components/form-generator/QasFormGenerator.yml +64 -0
- package/src/components/form-view/QasFormView.vue +129 -69
- package/src/components/form-view/QasFormView.yml +179 -0
- package/src/components/gallery/QasGallery.vue +47 -30
- package/src/components/gallery/QasGallery.yml +51 -0
- package/src/components/grid-generator/QasGridGenerator.vue +15 -7
- package/src/components/grid-generator/QasGridGenerator.yml +73 -0
- package/src/components/index.js +0 -0
- package/src/components/input/QasInput.vue +43 -36
- package/src/components/input/QasInput.yml +32 -0
- package/src/components/label/QasLabel.vue +14 -15
- package/src/components/label/QasLabel.yml +28 -0
- package/src/components/layout/QasLayout.vue +13 -21
- package/src/components/layout/QasLayout.yml +38 -0
- package/src/components/list-items/QasListItems.vue +15 -12
- package/src/components/list-items/QasListItems.yml +57 -0
- package/src/components/list-view/QasListView.vue +57 -31
- package/src/components/list-view/QasListView.yml +132 -0
- package/src/components/map/QasMap.vue +15 -31
- package/src/components/map/QasMap.yml +33 -0
- package/src/components/nested-fields/QasNestedFields.vue +57 -47
- package/src/components/nested-fields/QasNestedFields.yml +180 -0
- package/src/components/numeric-input/QasNumericInput.vue +31 -22
- package/src/components/numeric-input/QasNumericInput.yml +51 -0
- package/src/components/page-header/QasPageHeader.vue +20 -11
- package/src/components/page-header/QasPageHeader.yml +24 -0
- package/src/components/password-input/QasPasswordInput.vue +24 -21
- package/src/components/password-input/QasPasswordInput.yml +103 -0
- package/src/components/password-strength-checker/QasPasswordStrengthChecker.vue +51 -34
- package/src/components/password-strength-checker/QasPasswordStrengthChecker.yml +103 -0
- package/src/components/profile/QasProfile.vue +15 -13
- package/src/components/profile/QasProfile.yml +60 -0
- package/src/components/resizer/QasResizer.vue +3 -3
- package/src/components/resizer/QasResizer.yml +23 -0
- package/src/components/search-box/QasSearchBox.vue +50 -21
- package/src/components/search-box/QasSearchBox.yml +76 -0
- package/src/components/select/QasSelect.vue +51 -50
- package/src/components/select/QasSelect.yml +62 -0
- package/src/components/select-list/QasSelectList.vue +72 -53
- package/src/components/select-list/QasSelectList.yml +116 -0
- package/src/components/signature-pad/QasSignaturePad.vue +60 -40
- package/src/components/signature-pad/QasSignaturePad.yml +53 -0
- package/src/components/signature-uploader/QasSignatureUploader.vue +19 -17
- package/src/components/signature-uploader/QasSignatureUploader.yml +36 -0
- package/src/components/single-view/QasSingleView.vue +41 -22
- package/src/components/single-view/QasSingleView.yml +116 -0
- package/src/components/sortable/QasSortable.vue +51 -30
- package/src/components/sortable/QasSortable.yml +65 -0
- package/src/components/table-generator/QasTableGenerator.vue +112 -21
- package/src/components/table-generator/QasTableGenerator.yml +46 -0
- package/src/components/tabs-generator/QasTabsGenerator.vue +37 -25
- package/src/components/tabs-generator/QasTabsGenerator.yml +67 -0
- package/src/components/text-truncate/QasTextTruncate.vue +25 -17
- package/src/components/text-truncate/QasTextTruncate.yml +32 -0
- package/src/components/transfer/QasTransfer.vue +48 -49
- package/src/components/transfer/QasTransfer.yml +59 -0
- package/src/components/uploader/QasUploader.vue +169 -48
- package/src/components/uploader/QasUploader.yml +117 -0
- package/src/css/background.scss +1 -1
- package/src/css/border.scss +7 -6
- package/src/css/design-system.scss +0 -43
- package/src/css/fonts.scss +2 -28
- package/src/css/opacity.scss +0 -4
- package/src/css/set-brand.scss +15 -0
- package/src/css/transitions.scss +1 -1
- package/src/helpers/add-counter-suffix.js +3 -0
- package/src/helpers/{base64ToBlob.js → base-64-to-blob.js} +0 -0
- package/src/helpers/{constructObject.js → construct-object.js} +0 -0
- package/src/helpers/filter-object.js +8 -6
- package/src/helpers/filters.js +7 -9
- package/src/helpers/{greatestCommonDivisor.js → get-greatest-common-divisor.js} +0 -0
- package/src/helpers/get-slot-children-text.js +15 -0
- package/src/helpers/images.js +28 -0
- package/src/helpers/index.js +11 -61
- package/src/helpers/{isLocalDevelopment.js → is-local-development.js} +0 -0
- package/src/helpers/set-scroll-on-grab.js +61 -0
- package/src/index.cjs.js +1 -0
- package/src/index.esm.js +4 -0
- package/src/index.scss +19 -21
- package/src/index.umd.js +2 -0
- package/src/mixins/context.js +1 -1
- package/src/mixins/dialog-router.js +17 -0
- package/src/mixins/form.js +4 -12
- package/src/mixins/generator.js +14 -14
- package/src/mixins/index.js +2 -8
- package/src/mixins/password.js +73 -11
- package/src/mixins/screen.js +8 -6
- package/src/mixins/view.js +62 -22
- package/src/plugins/dialog/Dialog.js +14 -0
- package/src/plugins/dialog/Dialog.yml +10 -0
- package/src/plugins/index.js +4 -2
- package/src/plugins/{NotifyError.js → notify-error/NotifyError.js} +0 -0
- package/src/plugins/notify-error/NotifyError.yml +11 -0
- package/src/plugins/{NotifySuccess.js → notify-success/NotifySuccess.js} +3 -3
- package/src/plugins/notify-success/NotifySuccess.yml +11 -0
- package/src/store/history.js +43 -0
- package/src/store/index.js +1 -0
- package/src/vue-plugin.js +185 -0
- package/.babelrc +0 -12
- package/.storybook/main.js +0 -35
- package/.storybook/preview.js +0 -26
- package/debug.log +0 -1
- package/index.js +0 -4
- package/jest-setup.js +0 -1
- package/jest.config.json +0 -22
- package/postcss.config.js +0 -5
- package/src/components/Introduction.stories.mdx +0 -12
- package/src/components/actions-menu/QasActionsMenu.stories.js +0 -73
- package/src/components/app-bar/QasAppBar.stories.js +0 -84
- package/src/components/app-menu/QasAppMenu.stories.js +0 -66
- package/src/components/apps-menu/QasAppsMenu.spec.js +0 -58
- package/src/components/apps-menu/QasAppsMenu.stories.js +0 -54
- package/src/components/apps-menu/QasAppsMenu.vue +0 -48
- package/src/components/avatar/QasAvatar.spec.js +0 -14
- package/src/components/avatar/QasAvatar.stories.js +0 -52
- package/src/components/box/QasBox.spec.js +0 -18
- package/src/components/box/QasBox.stories.js +0 -35
- package/src/components/break-line/QasBreakLine.stories.js +0 -57
- package/src/components/break-line/QasBreakLine.vue +0 -52
- package/src/components/btn/QasBtn.stories.js +0 -45
- package/src/components/btn-actions/QasBtnActions.stories.js +0 -77
- package/src/components/btn-actions/QasBtnActions.vue +0 -54
- package/src/components/card/QasCard.stories.js +0 -126
- package/src/components/checkbox-group/QasCheckboxGroup.stories.js +0 -59
- package/src/components/copy/QasCopy.stories.js +0 -41
- package/src/components/date-time-input/QasDateTimeInput.stories.js +0 -67
- package/src/components/debugger/QasDebugger.stories.js +0 -33
- package/src/components/delete/QasDelete.stories.js +0 -80
- package/src/components/dialog/QasDialog.stories.js +0 -139
- package/src/components/dialog-router/QasDialogRouter.stories.js +0 -38
- package/src/components/field/QasField.stories.js +0 -181
- package/src/components/filters/QasFilters.stories.js +0 -121
- package/src/components/form-generator/QasFormGenerator.stories.js +0 -115
- package/src/components/form-view/QasFormView.stories.js +0 -236
- package/src/components/gallery/QasGallery.stories.js +0 -91
- package/src/components/grid-generator/QasGridGenerator.stories.js +0 -142
- package/src/components/input/QasInput.stories.js +0 -78
- package/src/components/label/QasLabel.stories.js +0 -60
- package/src/components/layout/QasLayout.stories.js +0 -104
- package/src/components/list-items/QasListItems.stories.js +0 -135
- package/src/components/list-view/QasListView.stories.js +0 -168
- package/src/components/map/QasMap.stories.js +0 -75
- package/src/components/nested-fields/QasNestedFields.stories.js +0 -255
- package/src/components/numeric-input/QasNumericInput.stories.js +0 -92
- package/src/components/page-header/QasPageHeader.stories.js +0 -61
- package/src/components/password-input/QasPasswordInput.stories.js +0 -76
- package/src/components/password-strength-checker/QasPasswordStrengthChecker.stories.js +0 -54
- package/src/components/profile/QasProfile.stories.js +0 -131
- package/src/components/resizer/QasResizer.stories.js +0 -43
- package/src/components/search-box/QasSearchBox.stories.js +0 -111
- package/src/components/select/QasSelect.stories.js +0 -113
- package/src/components/select-list/QasSelectList.stories.js +0 -153
- package/src/components/signature-pad/QasSignaturePad.stories.js +0 -51
- package/src/components/signature-uploader/QasSignatureUploader.stories.js +0 -69
- package/src/components/single-view/QasSingleView.stories.js +0 -130
- package/src/components/sortable/QasSortable.stories.js +0 -80
- package/src/components/table-generator/QasTableGenerator.stories.js +0 -120
- package/src/components/tabs-generator/QasTabsGenerator.stories.js +0 -145
- package/src/components/text-truncate/QasTextTruncate.stories.js +0 -55
- package/src/components/tip/QasTip.stories.js +0 -57
- package/src/components/tip/QasTip.vue +0 -68
- package/src/components/tooltip/QasTooltip.stories.js +0 -63
- package/src/components/tooltip/QasTooltip.vue +0 -81
- package/src/components/transfer/QasTransfer.stories.js +0 -118
- package/src/components/uploader/QasCustomUploader.vue +0 -120
- package/src/components/uploader/QasUploader.stories.js +0 -139
- package/src/directives/Test.js +0 -13
- package/src/helpers/historyHandler.js +0 -52
- package/src/helpers/label.js +0 -3
- package/src/index.js +0 -249
- package/src/mixins/map-markers.js +0 -26
- package/src/mixins/unsaved-changes.js +0 -24
- package/src/mixins/uploader.js +0 -30
- package/src/mocks/json/user.json +0 -27
- package/src/mocks/json/users-new.json +0 -23
- package/src/mocks/json/users.json +0 -97
- package/src/mocks/storeModule.js +0 -71
- package/src/pages/Forbidden.vue +0 -6
- package/src/pages/NotFound.vue +0 -6
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
type: component
|
|
2
|
+
|
|
3
|
+
mixins:
|
|
4
|
+
- '@bildvitta/quasar-ui-asteroid/dist/api/QasSearchBox.json'
|
|
5
|
+
|
|
6
|
+
meta:
|
|
7
|
+
desc: Componente para selecionar dentro de uma lista com pesquisa utilizando o `QasSearchBox`.
|
|
8
|
+
|
|
9
|
+
props:
|
|
10
|
+
delete-only:
|
|
11
|
+
desc: Caso o "modelValue" tenha valor, ele remove tudo na lista que não esteja dentro do modelValue.
|
|
12
|
+
type: Boolean
|
|
13
|
+
|
|
14
|
+
fuse-options:
|
|
15
|
+
desc: Propriedade que será repassada para o "QasSearchBox".
|
|
16
|
+
default: "{ keys: ['label'] }"
|
|
17
|
+
type: Object
|
|
18
|
+
|
|
19
|
+
list:
|
|
20
|
+
desc: Lista que será feita a seleção e pesquisa.
|
|
21
|
+
default: []
|
|
22
|
+
type: Array
|
|
23
|
+
|
|
24
|
+
model-value:
|
|
25
|
+
desc: Model do componente, que será controlado tudo que foi selecionado.
|
|
26
|
+
default: []
|
|
27
|
+
type: Array
|
|
28
|
+
examples: [v-model="value"]
|
|
29
|
+
model: true
|
|
30
|
+
|
|
31
|
+
to:
|
|
32
|
+
desc: 'Configuração do vue-router para enviar no $route.push({ ...to, params: {...} }).'
|
|
33
|
+
default: Pesquisar
|
|
34
|
+
type: String
|
|
35
|
+
|
|
36
|
+
redirect-key:
|
|
37
|
+
desc: Controla qual propriedade será a chave primaria para fazer o redirecionamento.
|
|
38
|
+
default: uuid
|
|
39
|
+
type: String
|
|
40
|
+
|
|
41
|
+
param-key:
|
|
42
|
+
desc: Controla qual parâmetro será enviado para rota.
|
|
43
|
+
default: id
|
|
44
|
+
type: String
|
|
45
|
+
|
|
46
|
+
slots:
|
|
47
|
+
item:
|
|
48
|
+
desc: Acesso dentro do "<q-item />.
|
|
49
|
+
scope:
|
|
50
|
+
item:
|
|
51
|
+
desc: Item atual da lista
|
|
52
|
+
type: Object
|
|
53
|
+
|
|
54
|
+
add:
|
|
55
|
+
desc: Função para adicionar um item ao model
|
|
56
|
+
type: Function
|
|
57
|
+
|
|
58
|
+
handleClick:
|
|
59
|
+
desc: Função que controla o model adiciona ou remove do model
|
|
60
|
+
type: Function
|
|
61
|
+
|
|
62
|
+
remove:
|
|
63
|
+
desc: Função para remover um item do model
|
|
64
|
+
type: Function
|
|
65
|
+
|
|
66
|
+
updateModel:
|
|
67
|
+
desc: Função para atualizar o v-model
|
|
68
|
+
type: Function
|
|
69
|
+
|
|
70
|
+
item-action:
|
|
71
|
+
desc: Acesso dentro do "<q-item-section avatar />".
|
|
72
|
+
scope:
|
|
73
|
+
item:
|
|
74
|
+
desc: Item atual da lista
|
|
75
|
+
type: Object
|
|
76
|
+
|
|
77
|
+
add:
|
|
78
|
+
desc: Função para adicionar um item ao model
|
|
79
|
+
type: Function
|
|
80
|
+
|
|
81
|
+
handleClick:
|
|
82
|
+
desc: Função que controla o model adiciona ou remove do model
|
|
83
|
+
type: Function
|
|
84
|
+
|
|
85
|
+
remove:
|
|
86
|
+
desc: Função para remover um item do model
|
|
87
|
+
type: Function
|
|
88
|
+
|
|
89
|
+
updateModel:
|
|
90
|
+
desc: Função para atualizar o v-model
|
|
91
|
+
type: Function
|
|
92
|
+
|
|
93
|
+
events:
|
|
94
|
+
'@added -> function(item)':
|
|
95
|
+
desc: Dispara toda vez que um item é adicionado no v-model.
|
|
96
|
+
params:
|
|
97
|
+
item:
|
|
98
|
+
desc: Item adicionado
|
|
99
|
+
type: String
|
|
100
|
+
|
|
101
|
+
'@removed -> function (item, index)':
|
|
102
|
+
desc: Dispara toda vez que um item é removido do v-model.
|
|
103
|
+
params:
|
|
104
|
+
item:
|
|
105
|
+
desc: Valor removido.
|
|
106
|
+
type: String
|
|
107
|
+
index:
|
|
108
|
+
desc: Index do item removido.
|
|
109
|
+
type: Number
|
|
110
|
+
|
|
111
|
+
'@update:model-value -> function (value)':
|
|
112
|
+
desc: Dispara toda vez que o campo de busca é alterado, também utilizado para v-model.
|
|
113
|
+
params:
|
|
114
|
+
value:
|
|
115
|
+
desc: Novo valor do v-model
|
|
116
|
+
type: String
|
|
@@ -1,25 +1,31 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div ref="signatureContainer" class="qas-signature-pad relative-position">
|
|
3
3
|
<canvas :id="canvasId" :ref="$attrs.ref" class="qas-signature-pad__canvas rounded-borders vertical-bottom" :height="height" />
|
|
4
|
-
<
|
|
4
|
+
<qas-btn v-if="!empty" class="absolute-bottom-right q-mb-sm q-mr-sm" color="primary" dense icon="o_delete" round @click="clearSignature" />
|
|
5
|
+
</div>
|
|
6
|
+
|
|
7
|
+
<div>
|
|
8
|
+
<slot :clear-signature="clearSignature" :get-signature-data="getSignatureData" />
|
|
5
9
|
</div>
|
|
6
10
|
</template>
|
|
7
11
|
|
|
8
12
|
<script>
|
|
9
|
-
import SignaturePad from 'signature_pad'
|
|
10
13
|
import { uid } from 'quasar'
|
|
11
|
-
import { isEqual } from 'lodash'
|
|
14
|
+
import { isEqual } from 'lodash-es'
|
|
15
|
+
import SignaturePad from 'signature_pad'
|
|
12
16
|
|
|
17
|
+
import QasBtn from '../btn/QasBtn.vue'
|
|
13
18
|
export default {
|
|
14
|
-
|
|
15
|
-
options: {
|
|
16
|
-
default: () => ({}),
|
|
17
|
-
type: Object
|
|
18
|
-
},
|
|
19
|
+
name: 'QasSignaturePad',
|
|
19
20
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
components: {
|
|
22
|
+
QasBtn
|
|
23
|
+
},
|
|
24
|
+
|
|
25
|
+
props: {
|
|
26
|
+
empty: {
|
|
27
|
+
type: Boolean,
|
|
28
|
+
default: true
|
|
23
29
|
},
|
|
24
30
|
|
|
25
31
|
height: {
|
|
@@ -27,62 +33,81 @@ export default {
|
|
|
27
33
|
type: String
|
|
28
34
|
},
|
|
29
35
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
36
|
+
signatureOptions: {
|
|
37
|
+
default: () => ({}),
|
|
38
|
+
type: Object
|
|
39
|
+
},
|
|
40
|
+
|
|
41
|
+
type: {
|
|
42
|
+
default: 'image/png',
|
|
43
|
+
type: String
|
|
33
44
|
}
|
|
34
45
|
},
|
|
35
46
|
|
|
47
|
+
emits: ['update:empty'],
|
|
48
|
+
|
|
49
|
+
expose: ['clearSignature', 'getSignatureData'],
|
|
50
|
+
|
|
36
51
|
data () {
|
|
37
52
|
return {
|
|
53
|
+
canvasId: uid(),
|
|
54
|
+
hasEndStrokeEvent: false,
|
|
38
55
|
signaturePad: null,
|
|
39
|
-
|
|
56
|
+
SignaturePad: null
|
|
40
57
|
}
|
|
41
58
|
},
|
|
42
59
|
|
|
43
60
|
watch: {
|
|
44
|
-
|
|
61
|
+
async signatureOptions (newValue, oldValue) {
|
|
45
62
|
if (isEqual(newValue, oldValue)) return
|
|
46
63
|
|
|
47
|
-
this.setupSignaturePad()
|
|
48
|
-
this.
|
|
64
|
+
await this.setupSignaturePad()
|
|
65
|
+
this.updateEmptyModel()
|
|
49
66
|
}
|
|
50
67
|
},
|
|
51
68
|
|
|
52
|
-
destroyed () {
|
|
53
|
-
window.removeEventListener('resize', this.setCanvasWidth)
|
|
54
|
-
},
|
|
55
|
-
|
|
56
69
|
mounted () {
|
|
57
70
|
window.addEventListener('resize', this.setCanvasWidth)
|
|
58
71
|
this.setCanvasWidth()
|
|
72
|
+
|
|
59
73
|
this.setupSignaturePad()
|
|
60
74
|
},
|
|
61
75
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
this.clearSignature()
|
|
67
|
-
},
|
|
68
|
-
|
|
69
|
-
saveSignature () {
|
|
70
|
-
return this.signaturePad.toDataURL(this.type)
|
|
71
|
-
},
|
|
76
|
+
unmounted () {
|
|
77
|
+
window.removeEventListener('resize', this.setCanvasWidth)
|
|
78
|
+
this.signaturePad.off()
|
|
79
|
+
},
|
|
72
80
|
|
|
81
|
+
methods: {
|
|
73
82
|
clearSignature () {
|
|
74
83
|
this.signaturePad.clear()
|
|
75
|
-
this.
|
|
84
|
+
this.updateEmptyModel()
|
|
76
85
|
},
|
|
77
86
|
|
|
78
|
-
|
|
79
|
-
|
|
87
|
+
getSignatureData () {
|
|
88
|
+
return this.signaturePad.toDataURL(this.type)
|
|
80
89
|
},
|
|
81
90
|
|
|
82
91
|
setCanvasWidth () {
|
|
83
92
|
const signatureContainer = this.$refs.signatureContainer
|
|
84
93
|
const canvasElement = signatureContainer.querySelector('canvas')
|
|
85
94
|
canvasElement.setAttribute('width', signatureContainer.offsetWidth)
|
|
95
|
+
},
|
|
96
|
+
|
|
97
|
+
setupSignaturePad () {
|
|
98
|
+
const canvasElement = document.getElementById(this.canvasId)
|
|
99
|
+
this.signaturePad = new SignaturePad(canvasElement, this.signatureOptions)
|
|
100
|
+
|
|
101
|
+
if (!this.hasEndStrokeEvent) {
|
|
102
|
+
this.signaturePad.addEventListener('endStroke', this.updateEmptyModel)
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
this.hasEndStrokeEvent = true
|
|
106
|
+
this.clearSignature()
|
|
107
|
+
},
|
|
108
|
+
|
|
109
|
+
updateEmptyModel () {
|
|
110
|
+
this.$emit('update:empty', this.signaturePad.isEmpty())
|
|
86
111
|
}
|
|
87
112
|
}
|
|
88
113
|
}
|
|
@@ -90,11 +115,6 @@ export default {
|
|
|
90
115
|
|
|
91
116
|
<style lang="scss">
|
|
92
117
|
.qas-signature-pad {
|
|
93
|
-
&__clear {
|
|
94
|
-
bottom: 0;
|
|
95
|
-
right: 0;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
118
|
&__canvas {
|
|
99
119
|
border: 1px solid $grey-3;
|
|
100
120
|
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
type: component
|
|
2
|
+
|
|
3
|
+
meta:
|
|
4
|
+
desc: Componente para assinatura que gera uma imagem.
|
|
5
|
+
|
|
6
|
+
props:
|
|
7
|
+
empty:
|
|
8
|
+
desc: Model que retorna se a tela está vazio ou não.
|
|
9
|
+
default: true
|
|
10
|
+
type: Boolean
|
|
11
|
+
model: true
|
|
12
|
+
|
|
13
|
+
height:
|
|
14
|
+
desc: Altura da área da assinatura.
|
|
15
|
+
default: {}
|
|
16
|
+
type: Object
|
|
17
|
+
|
|
18
|
+
signature_options:
|
|
19
|
+
desc: Opções da biblioteca signature_pad (https://github.com/szimek/signature_pad#options).
|
|
20
|
+
default: {}
|
|
21
|
+
type: Object
|
|
22
|
+
|
|
23
|
+
type:
|
|
24
|
+
desc: Tipo da imagem gerada.
|
|
25
|
+
default: image/png
|
|
26
|
+
type: String
|
|
27
|
+
|
|
28
|
+
slots:
|
|
29
|
+
default:
|
|
30
|
+
desc: Usado para conseguir recuperar as função internas do componente.
|
|
31
|
+
scope:
|
|
32
|
+
'clearSignature () => undefined':
|
|
33
|
+
desc: Limpa a assinatura.
|
|
34
|
+
type: Function
|
|
35
|
+
|
|
36
|
+
'getSignatureData () => String':
|
|
37
|
+
desc: 'Obtém a assinatura em formato de imagem com "tipo" de acordo com o que foi passado para o componente (ex: "image/png"). Utiliza o HTMLCanvasElement.toDataURL()'
|
|
38
|
+
type: Function
|
|
39
|
+
|
|
40
|
+
events:
|
|
41
|
+
'@update:empty -> function(value)':
|
|
42
|
+
desc: Dispara toda vez que para de desenhar na tela, usado para v-model:empty.
|
|
43
|
+
params:
|
|
44
|
+
value:
|
|
45
|
+
desc: Novo valor do model.
|
|
46
|
+
type: Boolean
|
|
47
|
+
|
|
48
|
+
methods:
|
|
49
|
+
'clearSignature () => undefined':
|
|
50
|
+
desc: Limpa a assinatura.
|
|
51
|
+
|
|
52
|
+
'getSignatureData () => String':
|
|
53
|
+
desc: 'Obtém a assinatura em formato de imagem com "tipo" de acordo com o que foi passado para o componente (ex: "image/png"). Utiliza o HTMLCanvasElement.toDataURL()'
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div>
|
|
3
|
-
<qas-uploader ref="uploader" v-model="
|
|
3
|
+
<qas-uploader ref="uploader" v-model="model" :label="uploadLabel" :readonly="readonly" :use-resize="false" v-bind="$attrs">
|
|
4
4
|
<template #header="{ scope }">
|
|
5
|
-
<div class="cursor-pointer flex flex-center full-width justify-between no-border no-wrap q-gutter-xs text-white transparent" :class="
|
|
5
|
+
<div class="cursor-pointer flex flex-center full-width justify-between no-border no-wrap q-gutter-xs text-white transparent" :class="headerClass" @click="openDialog">
|
|
6
6
|
<div class="col column items-start justify-center">
|
|
7
|
-
<div v-if="
|
|
7
|
+
<div v-if="uploadLabel" class="q-uploader__title">{{ uploadLabel }}</div>
|
|
8
8
|
</div>
|
|
9
9
|
|
|
10
10
|
<q-btn v-if="!readonly" dense flat icon="o_add" round @click="openDialog" />
|
|
@@ -21,11 +21,11 @@
|
|
|
21
21
|
</template>
|
|
22
22
|
|
|
23
23
|
<template #description>
|
|
24
|
-
<qas-signature-pad ref="signaturePadModal"
|
|
24
|
+
<qas-signature-pad ref="signaturePadModal" v-model:empty="isEmpty" height="250" />
|
|
25
25
|
</template>
|
|
26
26
|
|
|
27
27
|
<template #actions>
|
|
28
|
-
<q-btn class="full-width" color="primary" :disable="isEmpty" label="Salvar" no-caps @click="
|
|
28
|
+
<q-btn class="full-width" color="primary" :disable="isEmpty" label="Salvar" no-caps @click="getSignatureData" />
|
|
29
29
|
<q-btn class="full-width q-mt-sm" color="primary" flat label="Cancelar" no-caps @click="closeSignature" />
|
|
30
30
|
</template>
|
|
31
31
|
</qas-dialog>
|
|
@@ -40,6 +40,8 @@ import { base64ToBlob } from '../../helpers'
|
|
|
40
40
|
import { NotifyError } from '../../plugins'
|
|
41
41
|
|
|
42
42
|
export default {
|
|
43
|
+
name: 'QasSignatureUploader',
|
|
44
|
+
|
|
43
45
|
components: {
|
|
44
46
|
QasDialog,
|
|
45
47
|
QasUploader,
|
|
@@ -48,7 +50,7 @@ export default {
|
|
|
48
50
|
|
|
49
51
|
props: {
|
|
50
52
|
uploadLabel: {
|
|
51
|
-
default: '
|
|
53
|
+
default: '',
|
|
52
54
|
type: String
|
|
53
55
|
},
|
|
54
56
|
|
|
@@ -57,7 +59,7 @@ export default {
|
|
|
57
59
|
type: String
|
|
58
60
|
},
|
|
59
61
|
|
|
60
|
-
|
|
62
|
+
modelValue: {
|
|
61
63
|
default: '',
|
|
62
64
|
type: String
|
|
63
65
|
},
|
|
@@ -72,6 +74,8 @@ export default {
|
|
|
72
74
|
}
|
|
73
75
|
},
|
|
74
76
|
|
|
77
|
+
emits: ['update:modelValue'],
|
|
78
|
+
|
|
75
79
|
data () {
|
|
76
80
|
return {
|
|
77
81
|
isOpenedDialog: false,
|
|
@@ -81,24 +85,22 @@ export default {
|
|
|
81
85
|
},
|
|
82
86
|
|
|
83
87
|
computed: {
|
|
84
|
-
|
|
88
|
+
model: {
|
|
85
89
|
get () {
|
|
86
|
-
return this.
|
|
90
|
+
return this.modelValue
|
|
87
91
|
},
|
|
88
92
|
|
|
89
93
|
set (value) {
|
|
90
|
-
this.$emit('
|
|
94
|
+
this.$emit('update:modelValue', value)
|
|
91
95
|
}
|
|
92
96
|
},
|
|
93
97
|
|
|
94
|
-
|
|
98
|
+
headerClass () {
|
|
95
99
|
return `q-pa-${this.readonly ? 'md' : 'sm'}`
|
|
96
100
|
}
|
|
97
101
|
},
|
|
98
102
|
|
|
99
103
|
methods: {
|
|
100
|
-
base64ToBlob,
|
|
101
|
-
|
|
102
104
|
NotifyError,
|
|
103
105
|
|
|
104
106
|
openDialog () {
|
|
@@ -107,9 +109,9 @@ export default {
|
|
|
107
109
|
this.isOpenedDialog = true
|
|
108
110
|
},
|
|
109
111
|
|
|
110
|
-
|
|
112
|
+
getSignatureData () {
|
|
111
113
|
this.$refs.buttonCleanFiles.$el.click()
|
|
112
|
-
this.base64 = this.$refs.signaturePadModal.
|
|
114
|
+
this.base64 = this.$refs.signaturePadModal.getSignatureData()
|
|
113
115
|
this.$refs.forceUpload.$el.click()
|
|
114
116
|
this.closeSignature()
|
|
115
117
|
},
|
|
@@ -120,7 +122,7 @@ export default {
|
|
|
120
122
|
|
|
121
123
|
removeSignature () {
|
|
122
124
|
this.$refs.buttonCleanFiles.$el.click()
|
|
123
|
-
this.$emit('
|
|
125
|
+
this.$emit('update:modelValue')
|
|
124
126
|
},
|
|
125
127
|
|
|
126
128
|
upload (scope) {
|
|
@@ -131,7 +133,7 @@ export default {
|
|
|
131
133
|
const file = new File([blob], `${fileName}.${extension}`, { type: this.type })
|
|
132
134
|
|
|
133
135
|
scope.addFiles([file])
|
|
134
|
-
} catch
|
|
136
|
+
} catch {
|
|
135
137
|
NotifyError('Ops! Erro ao enviar sua assinatura.')
|
|
136
138
|
}
|
|
137
139
|
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
type: component
|
|
2
|
+
|
|
3
|
+
meta:
|
|
4
|
+
desc: Componente que implementa o "QasUploader" e "QasSignaturePad" para fazer upload de assinatura.
|
|
5
|
+
|
|
6
|
+
props:
|
|
7
|
+
upload-label:
|
|
8
|
+
desc: Rótulo do uploader.
|
|
9
|
+
type: String
|
|
10
|
+
|
|
11
|
+
signature-label:
|
|
12
|
+
desc: Rótulo do componente de assinatura.
|
|
13
|
+
default: {}
|
|
14
|
+
type: Object
|
|
15
|
+
|
|
16
|
+
model-value:
|
|
17
|
+
desc: Model do componente, retorna url da imagem upada, usando para v-model.
|
|
18
|
+
type: String
|
|
19
|
+
|
|
20
|
+
type:
|
|
21
|
+
desc: Tipo da imagem gerada.
|
|
22
|
+
default: image/png
|
|
23
|
+
type: String
|
|
24
|
+
|
|
25
|
+
readonly:
|
|
26
|
+
desc: Controla se o componente vai ser apenas para visualização ou pode também fazer upload.
|
|
27
|
+
default: image/png
|
|
28
|
+
type: String
|
|
29
|
+
|
|
30
|
+
events:
|
|
31
|
+
'@update:model-value -> function(value)':
|
|
32
|
+
desc: Dispara toda vez que o acontece um novo upload, usado para v-model.
|
|
33
|
+
params:
|
|
34
|
+
value:
|
|
35
|
+
desc: Novo valor do model.
|
|
36
|
+
type: String
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<component :is="
|
|
3
|
-
<header v-if="
|
|
4
|
-
<slot
|
|
2
|
+
<component :is="mx_componentTag" :class="mx_componentClass">
|
|
3
|
+
<header v-if="mx_hasHeaderSlot">
|
|
4
|
+
<slot name="header" />
|
|
5
5
|
</header>
|
|
6
6
|
|
|
7
7
|
<template v-if="hasResult">
|
|
8
|
-
<slot
|
|
8
|
+
<slot />
|
|
9
9
|
</template>
|
|
10
10
|
|
|
11
|
-
<div v-else-if="!
|
|
11
|
+
<div v-else-if="!mx_isFetching" class="q-my-xl text-center">
|
|
12
12
|
<q-icon class="q-mb-sm text-center" color="grey-6" name="o_search" size="38px" />
|
|
13
13
|
<div class="text-grey-6">Nenhum item encontrado.</div>
|
|
14
14
|
</div>
|
|
15
15
|
|
|
16
|
-
<footer v-if="
|
|
16
|
+
<footer v-if="mx_hasFooterSlot">
|
|
17
17
|
<slot name="footer" />
|
|
18
18
|
</footer>
|
|
19
19
|
|
|
20
|
-
<q-inner-loading :showing="
|
|
20
|
+
<q-inner-loading :showing="mx_isFetching">
|
|
21
21
|
<q-spinner color="grey" size="3em" />
|
|
22
22
|
</q-inner-loading>
|
|
23
23
|
</component>
|
|
@@ -25,8 +25,11 @@
|
|
|
25
25
|
|
|
26
26
|
<script>
|
|
27
27
|
import viewMixin from '../../mixins/view'
|
|
28
|
+
import { markRaw } from 'vue'
|
|
28
29
|
|
|
29
30
|
export default {
|
|
31
|
+
name: 'QasSingleView',
|
|
32
|
+
|
|
30
33
|
mixins: [viewMixin],
|
|
31
34
|
|
|
32
35
|
props: {
|
|
@@ -35,33 +38,39 @@ export default {
|
|
|
35
38
|
type: [Number, String]
|
|
36
39
|
},
|
|
37
40
|
|
|
38
|
-
|
|
41
|
+
result: {
|
|
39
42
|
default: () => ({}),
|
|
40
43
|
type: Object
|
|
41
44
|
}
|
|
42
45
|
},
|
|
43
46
|
|
|
47
|
+
emits: [
|
|
48
|
+
'update:result',
|
|
49
|
+
'fetch-success',
|
|
50
|
+
'fetch-error'
|
|
51
|
+
],
|
|
52
|
+
|
|
44
53
|
computed: {
|
|
45
54
|
hasResult () {
|
|
46
|
-
return !!this.
|
|
55
|
+
return !!this.resultModel
|
|
47
56
|
},
|
|
48
57
|
|
|
49
58
|
id () {
|
|
50
59
|
return this.customId || this.$route.params.id
|
|
51
60
|
},
|
|
52
61
|
|
|
53
|
-
|
|
62
|
+
resultModel () {
|
|
54
63
|
return this.$store.getters[`${this.entity}/byId`](this.id) || {}
|
|
55
64
|
}
|
|
56
65
|
},
|
|
57
66
|
|
|
58
67
|
watch: {
|
|
59
|
-
$route () {
|
|
60
|
-
this.fetchSingle()
|
|
68
|
+
$route (to, from) {
|
|
69
|
+
to.name === from.name && this.fetchSingle()
|
|
61
70
|
},
|
|
62
71
|
|
|
63
|
-
|
|
64
|
-
this.$emit('
|
|
72
|
+
resultModel (value) {
|
|
73
|
+
this.$emit('update:result', markRaw({ ...value }))
|
|
65
74
|
}
|
|
66
75
|
},
|
|
67
76
|
|
|
@@ -70,23 +79,33 @@ export default {
|
|
|
70
79
|
},
|
|
71
80
|
|
|
72
81
|
methods: {
|
|
73
|
-
async fetchSingle () {
|
|
74
|
-
this.
|
|
82
|
+
async fetchSingle (params = {}) {
|
|
83
|
+
this.mx_isFetching = true
|
|
75
84
|
|
|
76
85
|
try {
|
|
77
|
-
const response = await this.$store.dispatch(
|
|
86
|
+
const response = await this.$store.dispatch(
|
|
87
|
+
`${this.entity}/fetchSingle`,
|
|
88
|
+
{ id: this.id, url: this.url, params }
|
|
89
|
+
)
|
|
90
|
+
|
|
78
91
|
const { errors, fields, metadata } = response.data
|
|
79
92
|
|
|
80
|
-
this.
|
|
81
|
-
this.
|
|
82
|
-
this.
|
|
93
|
+
this.mx_setErrors(errors)
|
|
94
|
+
this.mx_setFields(fields)
|
|
95
|
+
this.mx_setMetadata(metadata)
|
|
96
|
+
|
|
97
|
+
this.mx_updateModels({
|
|
98
|
+
errors: this.mx_errors,
|
|
99
|
+
fields: this.mx_fields,
|
|
100
|
+
metadata: this.mx_metadata
|
|
101
|
+
})
|
|
83
102
|
|
|
84
103
|
this.$emit('fetch-success', response)
|
|
85
104
|
} catch (error) {
|
|
86
|
-
this.
|
|
105
|
+
this.mx_fetchError(error)
|
|
87
106
|
this.$emit('fetch-error', error)
|
|
88
107
|
} finally {
|
|
89
|
-
this.
|
|
108
|
+
this.mx_isFetching = false
|
|
90
109
|
}
|
|
91
110
|
}
|
|
92
111
|
}
|