@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
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div>
|
|
3
|
-
<
|
|
3
|
+
<qas-input ref="input" v-bind="attributes" v-model="currentValue" :unmasked-value="false" @update:model-value="updateModelValue">
|
|
4
4
|
<template #append>
|
|
5
5
|
<q-icon v-if="!timeOnly" class="cursor-pointer" name="o_event">
|
|
6
6
|
<q-popup-proxy ref="dateProxy" transition-hide="scale" transition-show="scale">
|
|
7
|
-
<q-date v-model="currentValue" v-bind="
|
|
7
|
+
<q-date v-model="currentValue" v-bind="dateProps" :mask="maskDate" @update:model-value="updateModelValue" />
|
|
8
8
|
</q-popup-proxy>
|
|
9
9
|
</q-icon>
|
|
10
10
|
|
|
11
11
|
<q-icon v-if="!dateOnly" class="cursor-pointer q-ml-md" name="o_access_time">
|
|
12
12
|
<q-popup-proxy ref="timeProxy" transition-hide="scale" transition-show="scale">
|
|
13
|
-
<q-time v-model="currentValue" v-bind="
|
|
13
|
+
<q-time v-model="currentValue" v-bind="timeProps" format24h :mask="maskDate" @update:model-value="updateModelValue" />
|
|
14
14
|
</q-popup-proxy>
|
|
15
15
|
</q-icon>
|
|
16
16
|
</template>
|
|
17
|
-
</
|
|
17
|
+
</qas-input>
|
|
18
18
|
</div>
|
|
19
19
|
</template>
|
|
20
20
|
|
|
@@ -23,6 +23,10 @@ import { date } from 'quasar'
|
|
|
23
23
|
import { date as dateFn } from '../../helpers/filters'
|
|
24
24
|
|
|
25
25
|
export default {
|
|
26
|
+
name: 'QasDateTimeInput',
|
|
27
|
+
|
|
28
|
+
inheritAttrs: false,
|
|
29
|
+
|
|
26
30
|
props: {
|
|
27
31
|
dateMask: {
|
|
28
32
|
default: 'DD/MM/YYYY',
|
|
@@ -33,7 +37,7 @@ export default {
|
|
|
33
37
|
type: Boolean
|
|
34
38
|
},
|
|
35
39
|
|
|
36
|
-
|
|
40
|
+
dateProps: {
|
|
37
41
|
default: () => ({}),
|
|
38
42
|
type: Object
|
|
39
43
|
},
|
|
@@ -51,17 +55,19 @@ export default {
|
|
|
51
55
|
type: Boolean
|
|
52
56
|
},
|
|
53
57
|
|
|
54
|
-
|
|
58
|
+
timeProps: {
|
|
55
59
|
default: () => ({}),
|
|
56
60
|
type: Object
|
|
57
61
|
},
|
|
58
62
|
|
|
59
|
-
|
|
63
|
+
modelValue: {
|
|
60
64
|
default: '',
|
|
61
65
|
type: String
|
|
62
66
|
}
|
|
63
67
|
},
|
|
64
68
|
|
|
69
|
+
emits: ['update:modelValue'],
|
|
70
|
+
|
|
65
71
|
data () {
|
|
66
72
|
return {
|
|
67
73
|
currentValue: '',
|
|
@@ -71,21 +77,11 @@ export default {
|
|
|
71
77
|
|
|
72
78
|
computed: {
|
|
73
79
|
attributes () {
|
|
74
|
-
const {
|
|
80
|
+
const { modelValue, ...attributes } = this.$attrs
|
|
75
81
|
|
|
76
82
|
return {
|
|
77
83
|
...attributes,
|
|
78
|
-
mask: this.mask
|
|
79
|
-
value: this.currentValue
|
|
80
|
-
}
|
|
81
|
-
},
|
|
82
|
-
|
|
83
|
-
events () {
|
|
84
|
-
const { input, ...events } = this.$listeners
|
|
85
|
-
|
|
86
|
-
return {
|
|
87
|
-
...events,
|
|
88
|
-
input: this.input
|
|
84
|
+
mask: this.mask
|
|
89
85
|
}
|
|
90
86
|
},
|
|
91
87
|
|
|
@@ -121,11 +117,7 @@ export default {
|
|
|
121
117
|
},
|
|
122
118
|
|
|
123
119
|
created () {
|
|
124
|
-
this.currentValue = this.toMask(this.
|
|
125
|
-
},
|
|
126
|
-
|
|
127
|
-
mounted () {
|
|
128
|
-
this.$emit('mounted', this)
|
|
120
|
+
this.currentValue = this.toMask(this.modelValue)
|
|
129
121
|
},
|
|
130
122
|
|
|
131
123
|
methods: {
|
|
@@ -137,13 +129,13 @@ export default {
|
|
|
137
129
|
this.inputElement.focus()
|
|
138
130
|
},
|
|
139
131
|
|
|
140
|
-
|
|
132
|
+
updateModelValue (value) {
|
|
141
133
|
this.currentValue = value
|
|
142
134
|
const valueLength = value.replace(/_/g, '').length
|
|
143
135
|
|
|
144
136
|
if (value === '' || valueLength === this.mask.length) {
|
|
145
137
|
this.lastValue = this.timeOnly ? value : this.toISOString(value)
|
|
146
|
-
this.$emit('
|
|
138
|
+
this.$emit('update:modelValue', this.lastValue)
|
|
147
139
|
}
|
|
148
140
|
|
|
149
141
|
if (this.dateOnly) {
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
type: component
|
|
2
|
+
|
|
3
|
+
mixins:
|
|
4
|
+
- '@bildvitta/quasar-ui-asteroid/dist/api/QasInput.json'
|
|
5
|
+
|
|
6
|
+
meta:
|
|
7
|
+
desc: Componente de input data e hora, implementa o "QasInput".
|
|
8
|
+
|
|
9
|
+
props:
|
|
10
|
+
date-mask:
|
|
11
|
+
desc: Máscara do componente de input de data.
|
|
12
|
+
default: DD/MM/YYYY
|
|
13
|
+
type: String
|
|
14
|
+
|
|
15
|
+
date-only:
|
|
16
|
+
desc: Habilita o componente para usar somente data.
|
|
17
|
+
type: Boolean
|
|
18
|
+
|
|
19
|
+
date-props:
|
|
20
|
+
desc: Propriedades do QDate (https://quasar.dev/vue-components/date#introduction).
|
|
21
|
+
default: {}
|
|
22
|
+
type: Object
|
|
23
|
+
|
|
24
|
+
gmt:
|
|
25
|
+
desc: Utilizado para se usar junto da prop "date-only" ou "time-only", caso "gmt" for "true", o model sempre vai ser retornado no padrão ISO 8601, independente ser apenas um campo somente de data ou hora.
|
|
26
|
+
type: Boolean
|
|
27
|
+
|
|
28
|
+
time-mask:
|
|
29
|
+
desc: Máscara do componente de input de hora.
|
|
30
|
+
default: HH:mm
|
|
31
|
+
type: String
|
|
32
|
+
|
|
33
|
+
time-only:
|
|
34
|
+
desc: Habilita o componente para usar somente hora.
|
|
35
|
+
type: Boolean
|
|
36
|
+
|
|
37
|
+
time-props:
|
|
38
|
+
desc: Propriedades do QTime (https://quasar.dev/vue-components/time#introduction).
|
|
39
|
+
default: {}
|
|
40
|
+
type: Object
|
|
41
|
+
|
|
42
|
+
model-value:
|
|
43
|
+
desc: Model do componente, usado para v-model.
|
|
44
|
+
default: ''
|
|
45
|
+
type: String
|
|
46
|
+
model: true
|
|
47
|
+
|
|
48
|
+
events:
|
|
49
|
+
'@update:model-value -> function (value)':
|
|
50
|
+
desc: Dispara toda vez que o model é atualizado, também utilizado para v-model.
|
|
51
|
+
params:
|
|
52
|
+
value:
|
|
53
|
+
desc: Novo valor do v-model
|
|
54
|
+
type: String
|
|
@@ -1,18 +1,23 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<component :is="tag" v-bind="$attrs"
|
|
3
|
-
<
|
|
4
|
-
|
|
2
|
+
<component :is="tag" v-bind="$attrs" @click="openConfirmDialog">
|
|
3
|
+
<template v-for="(_, name) in $slots" #[name]="context">
|
|
4
|
+
<slot :name="name" v-bind="context || {}" />
|
|
5
|
+
</template>
|
|
5
6
|
</component>
|
|
7
|
+
|
|
8
|
+
<qas-dialog v-model="showDialog" v-bind="defaultDialogProps" />
|
|
6
9
|
</template>
|
|
7
10
|
|
|
8
11
|
<script>
|
|
9
12
|
import { Loading } from 'quasar'
|
|
10
13
|
import { NotifyError, NotifySuccess } from '../../plugins'
|
|
11
14
|
|
|
12
|
-
import QasBtn from '../btn/QasBtn'
|
|
13
|
-
import QasDialog from '../dialog/QasDialog'
|
|
15
|
+
import QasBtn from '../btn/QasBtn.vue'
|
|
16
|
+
import QasDialog from '../dialog/QasDialog.vue'
|
|
14
17
|
|
|
15
18
|
export default {
|
|
19
|
+
name: 'QasDelete',
|
|
20
|
+
|
|
16
21
|
components: {
|
|
17
22
|
QasBtn,
|
|
18
23
|
QasDialog
|
|
@@ -24,7 +29,7 @@ export default {
|
|
|
24
29
|
type: [Number, String]
|
|
25
30
|
},
|
|
26
31
|
|
|
27
|
-
|
|
32
|
+
dialogProps: {
|
|
28
33
|
default: () => ({}),
|
|
29
34
|
type: Object
|
|
30
35
|
},
|
|
@@ -42,9 +47,19 @@ export default {
|
|
|
42
47
|
url: {
|
|
43
48
|
default: '',
|
|
44
49
|
type: String
|
|
50
|
+
},
|
|
51
|
+
|
|
52
|
+
deleting: {
|
|
53
|
+
type: Boolean
|
|
45
54
|
}
|
|
46
55
|
},
|
|
47
56
|
|
|
57
|
+
emits: [
|
|
58
|
+
'success',
|
|
59
|
+
'error',
|
|
60
|
+
'update:deleting'
|
|
61
|
+
],
|
|
62
|
+
|
|
48
63
|
data () {
|
|
49
64
|
return {
|
|
50
65
|
showDialog: false
|
|
@@ -52,7 +67,7 @@ export default {
|
|
|
52
67
|
},
|
|
53
68
|
|
|
54
69
|
computed: {
|
|
55
|
-
|
|
70
|
+
defaultDialogProps () {
|
|
56
71
|
return {
|
|
57
72
|
card: {
|
|
58
73
|
title: 'Confirmar',
|
|
@@ -60,42 +75,54 @@ export default {
|
|
|
60
75
|
},
|
|
61
76
|
|
|
62
77
|
ok: {
|
|
63
|
-
|
|
64
|
-
|
|
78
|
+
label: 'Excluir',
|
|
79
|
+
onClick: this.destroy
|
|
65
80
|
},
|
|
66
81
|
|
|
67
|
-
...this.
|
|
82
|
+
...this.dialogProps
|
|
68
83
|
}
|
|
69
84
|
},
|
|
70
85
|
|
|
71
|
-
events () {
|
|
72
|
-
const { click, ...events } = this.$listeners
|
|
73
|
-
return { click: this.confirm, ...events }
|
|
74
|
-
},
|
|
75
|
-
|
|
76
86
|
id () {
|
|
77
87
|
return this.customId || this.$route.params.id
|
|
78
88
|
}
|
|
79
89
|
},
|
|
80
90
|
|
|
81
91
|
methods: {
|
|
82
|
-
|
|
92
|
+
openConfirmDialog () {
|
|
83
93
|
this.showDialog = true
|
|
84
94
|
},
|
|
85
95
|
|
|
86
96
|
async destroy () {
|
|
87
97
|
Loading.show()
|
|
98
|
+
this.$emit('update:deleting', true)
|
|
88
99
|
|
|
89
100
|
try {
|
|
90
101
|
await this.$store.dispatch(`${this.entity}/destroy`, { id: this.id, url: this.url })
|
|
91
102
|
NotifySuccess('Item deletado com sucesso!')
|
|
103
|
+
this.createDeleteSuccessEvent()
|
|
92
104
|
this.$emit('success')
|
|
93
105
|
} catch (error) {
|
|
94
106
|
NotifyError('Ops! Não foi possível deletar o item.')
|
|
95
107
|
this.$emit('error', error)
|
|
96
108
|
} finally {
|
|
97
109
|
Loading.hide()
|
|
110
|
+
this.$emit('update:deleting', false)
|
|
98
111
|
}
|
|
112
|
+
},
|
|
113
|
+
|
|
114
|
+
createDeleteSuccessEvent () {
|
|
115
|
+
const event = new CustomEvent('delete-success', {
|
|
116
|
+
bubbles: false,
|
|
117
|
+
cancelable: false,
|
|
118
|
+
detail: {
|
|
119
|
+
entity: this.entity,
|
|
120
|
+
url: this.url,
|
|
121
|
+
id: this.id
|
|
122
|
+
}
|
|
123
|
+
})
|
|
124
|
+
|
|
125
|
+
window.dispatchEvent(event)
|
|
99
126
|
}
|
|
100
127
|
}
|
|
101
128
|
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
type: component
|
|
2
|
+
|
|
3
|
+
meta:
|
|
4
|
+
desc: Componente para C.R.U.D. responsável por deletar (Delete).
|
|
5
|
+
|
|
6
|
+
props:
|
|
7
|
+
entity:
|
|
8
|
+
desc: Entidade da store, por exemplo se tiver que trabalhar com modulo de usuários, teremos o model "users" na store, que vai ser nossa "entity".
|
|
9
|
+
required: true
|
|
10
|
+
type: String
|
|
11
|
+
|
|
12
|
+
custom-id:
|
|
13
|
+
desc: Por padrão, o componente vai pegar o "id" que vem como parâmetro na url, caso queira que o id seja diferente da url, use esta prop.
|
|
14
|
+
type: String
|
|
15
|
+
examples: ['my-custom-id']
|
|
16
|
+
|
|
17
|
+
dialog-props:
|
|
18
|
+
desc: Props para ser repassada para o componente "QasDialog"
|
|
19
|
+
default: {}
|
|
20
|
+
type: Object
|
|
21
|
+
|
|
22
|
+
url:
|
|
23
|
+
desc: Envia como parâmetro para a action "fetchSingle" do modulo correspondente a "entity".
|
|
24
|
+
type: String
|
|
25
|
+
|
|
26
|
+
tag:
|
|
27
|
+
desc: Tag do componente.
|
|
28
|
+
default: qas-btn
|
|
29
|
+
type: String
|
|
30
|
+
examples: [q-item]
|
|
31
|
+
|
|
32
|
+
deleting:
|
|
33
|
+
desc: Model para saber se está deletando.
|
|
34
|
+
type: Boolean
|
|
35
|
+
examples: [v-model:deleting="isDeleting"]
|
|
36
|
+
model: true
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
slots:
|
|
40
|
+
default:
|
|
41
|
+
desc: 'Slot para acessar dentro do componente.'
|
|
42
|
+
|
|
43
|
+
events:
|
|
44
|
+
'@success -> function()':
|
|
45
|
+
desc: Dispara quando o componente deleta com sucesso.
|
|
46
|
+
|
|
47
|
+
'@error -> function(value)':
|
|
48
|
+
desc: Dispara quando acontece algum erro na hora de deletar.
|
|
49
|
+
params:
|
|
50
|
+
value:
|
|
51
|
+
desc: Erro retornado.
|
|
52
|
+
type: Object
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<q-dialog ref="dialog"
|
|
2
|
+
<q-dialog ref="dialog" :persistent="persistent" v-bind="dialogProps" @update:model-value="updateModelValue">
|
|
3
3
|
<q-card v-bind="cardProps" class="q-pa-sm" :style="style">
|
|
4
4
|
<q-card-section>
|
|
5
5
|
<slot name="header">
|
|
6
|
-
<div class="
|
|
6
|
+
<div class="justify-between row">
|
|
7
|
+
<div class="text-bold text-h6">{{ card.title }}</div>
|
|
8
|
+
<qas-btn v-if="useCloseIcon" v-close-popup dense flat icon="o_close" rounded />
|
|
9
|
+
</div>
|
|
7
10
|
</slot>
|
|
8
11
|
</q-card-section>
|
|
9
12
|
|
|
@@ -17,14 +20,15 @@
|
|
|
17
20
|
|
|
18
21
|
<q-card-section>
|
|
19
22
|
<slot name="actions">
|
|
20
|
-
<qas-
|
|
23
|
+
<qas-actions v-bind="actionsProps">
|
|
21
24
|
<template #primary>
|
|
22
|
-
<qas-btn v-if="ok" v-close-popup="!useForm" class="full-width" v-bind="defaultOk
|
|
25
|
+
<qas-btn v-if="ok" v-close-popup="!useForm" class="full-width" v-bind="defaultOk" @click="submitHandler" />
|
|
23
26
|
</template>
|
|
27
|
+
|
|
24
28
|
<template #secondary>
|
|
25
|
-
<qas-btn v-if="cancel" v-close-popup class="full-width" v-bind="defaultCancel
|
|
29
|
+
<qas-btn v-if="cancel" v-close-popup class="full-width" v-bind="defaultCancel" />
|
|
26
30
|
</template>
|
|
27
|
-
</qas-
|
|
31
|
+
</qas-actions>
|
|
28
32
|
</slot>
|
|
29
33
|
</q-card-section>
|
|
30
34
|
</q-card>
|
|
@@ -33,23 +37,29 @@
|
|
|
33
37
|
|
|
34
38
|
<script>
|
|
35
39
|
import QasBtn from '../btn/QasBtn.vue'
|
|
36
|
-
import
|
|
40
|
+
import QasActions from '../actions/QasActions.vue'
|
|
41
|
+
|
|
42
|
+
import screenMixin from '../../mixins/screen'
|
|
37
43
|
|
|
38
44
|
export default {
|
|
45
|
+
name: 'QasDialog',
|
|
46
|
+
|
|
39
47
|
components: {
|
|
40
48
|
QasBtn,
|
|
41
|
-
|
|
49
|
+
QasActions
|
|
42
50
|
},
|
|
43
51
|
|
|
52
|
+
mixins: [screenMixin],
|
|
53
|
+
|
|
44
54
|
props: {
|
|
45
|
-
|
|
55
|
+
actionsProps: {
|
|
46
56
|
default: () => ({}),
|
|
47
57
|
type: Object
|
|
48
58
|
},
|
|
49
59
|
|
|
50
60
|
cancel: {
|
|
51
61
|
default: () => ({}),
|
|
52
|
-
type: [
|
|
62
|
+
type: [Object, Boolean]
|
|
53
63
|
},
|
|
54
64
|
|
|
55
65
|
card: {
|
|
@@ -74,7 +84,7 @@ export default {
|
|
|
74
84
|
|
|
75
85
|
ok: {
|
|
76
86
|
default: () => ({}),
|
|
77
|
-
type: [
|
|
87
|
+
type: [Object, Boolean]
|
|
78
88
|
},
|
|
79
89
|
|
|
80
90
|
persistent: {
|
|
@@ -86,91 +96,77 @@ export default {
|
|
|
86
96
|
type: Boolean
|
|
87
97
|
},
|
|
88
98
|
|
|
89
|
-
|
|
99
|
+
modelValue: {
|
|
90
100
|
type: Boolean
|
|
91
|
-
}
|
|
92
|
-
},
|
|
101
|
+
},
|
|
93
102
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
show: null,
|
|
101
|
-
toggle: null
|
|
102
|
-
}
|
|
103
|
+
usePlugin: {
|
|
104
|
+
type: Boolean
|
|
105
|
+
},
|
|
106
|
+
|
|
107
|
+
useCloseIcon: {
|
|
108
|
+
type: Boolean
|
|
103
109
|
}
|
|
104
110
|
},
|
|
105
111
|
|
|
112
|
+
emits: [
|
|
113
|
+
'update:modelValue',
|
|
114
|
+
'validate'
|
|
115
|
+
],
|
|
116
|
+
|
|
106
117
|
computed: {
|
|
107
118
|
defaultCancel () {
|
|
108
119
|
return {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
label: 'Cancelar',
|
|
113
|
-
outline: true,
|
|
114
|
-
...this.cancel?.props
|
|
115
|
-
}
|
|
120
|
+
label: 'Cancelar',
|
|
121
|
+
outline: true,
|
|
122
|
+
...this.cancel
|
|
116
123
|
}
|
|
117
124
|
},
|
|
118
125
|
|
|
119
|
-
defaultDialogMethods () {
|
|
120
|
-
return this.dialogMethods
|
|
121
|
-
},
|
|
122
|
-
|
|
123
126
|
defaultOk () {
|
|
124
127
|
return {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
label: 'Ok',
|
|
129
|
-
type: this.ok?.props.type || this.useForm ? 'submit' : 'button',
|
|
130
|
-
...this.ok?.props
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
},
|
|
134
|
-
|
|
135
|
-
isSmallScreen () {
|
|
136
|
-
return this.$q.screen.xs
|
|
137
|
-
},
|
|
138
|
-
|
|
139
|
-
model: {
|
|
140
|
-
get () {
|
|
141
|
-
return this.value
|
|
142
|
-
},
|
|
143
|
-
|
|
144
|
-
set (value) {
|
|
145
|
-
return this.$emit('input', value)
|
|
128
|
+
label: 'Ok',
|
|
129
|
+
type: this.ok?.type || this.useForm ? 'submit' : 'button',
|
|
130
|
+
...this.ok
|
|
146
131
|
}
|
|
147
132
|
},
|
|
148
133
|
|
|
149
134
|
style () {
|
|
150
135
|
return {
|
|
151
|
-
maxWidth: this.maxWidth || (this.
|
|
152
|
-
minWidth: this.minWidth || (this.
|
|
136
|
+
maxWidth: this.maxWidth || (this.mx_isSmall ? '' : '600px'),
|
|
137
|
+
minWidth: this.minWidth || (this.mx_isSmall ? '' : '400px')
|
|
153
138
|
}
|
|
154
139
|
},
|
|
155
140
|
|
|
156
141
|
componentTag () {
|
|
157
142
|
return this.useForm ? 'q-form' : 'div'
|
|
158
|
-
}
|
|
159
|
-
},
|
|
143
|
+
},
|
|
160
144
|
|
|
161
|
-
|
|
162
|
-
|
|
145
|
+
dialogProps () {
|
|
146
|
+
return {
|
|
147
|
+
...(!this.usePlugin && { modelValue: this.modelValue }),
|
|
148
|
+
...this.$attrs
|
|
149
|
+
}
|
|
150
|
+
}
|
|
163
151
|
},
|
|
164
152
|
|
|
165
153
|
methods: {
|
|
166
|
-
setDialogMethods () {
|
|
167
|
-
for (const key in this.dialogMethods) {
|
|
168
|
-
this.dialogMethods[key] = this.$refs.dialog[key]
|
|
169
|
-
}
|
|
170
|
-
},
|
|
171
|
-
|
|
172
154
|
async submitHandler () {
|
|
173
155
|
this.useForm && this.$emit('validate', await this.$refs.form.validate())
|
|
156
|
+
},
|
|
157
|
+
|
|
158
|
+
// metodo para funcionar como plugin
|
|
159
|
+
show () {
|
|
160
|
+
this.$refs.dialog.show()
|
|
161
|
+
},
|
|
162
|
+
|
|
163
|
+
// metodo para funcionar como plugin
|
|
164
|
+
hide () {
|
|
165
|
+
this.$refs.dialog.hide()
|
|
166
|
+
},
|
|
167
|
+
|
|
168
|
+
updateModelValue (value) {
|
|
169
|
+
this.$emit('update:modelValue', value)
|
|
174
170
|
}
|
|
175
171
|
}
|
|
176
172
|
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
type: component
|
|
2
|
+
|
|
3
|
+
meta:
|
|
4
|
+
desc: Componente de dialog.
|
|
5
|
+
|
|
6
|
+
props:
|
|
7
|
+
actions-props:
|
|
8
|
+
desc: Props repassadas para o "QasActions".
|
|
9
|
+
default: {}
|
|
10
|
+
type: Object
|
|
11
|
+
|
|
12
|
+
cancel:
|
|
13
|
+
desc: Props para o botão de cancelar, pode ser objeto com as propriedades ou um boolean, caso for "false", remove o botão de cancelar.
|
|
14
|
+
default: "{ label: 'Cancelar', outline: true }"
|
|
15
|
+
type: [Object, Boolean]
|
|
16
|
+
examples: ["{ label: 'Meu botão de cancelar', onClick: () => alert('fui clicado!') }"]
|
|
17
|
+
|
|
18
|
+
card:
|
|
19
|
+
desc: Objeto contendo as informações para serem exibidas dentro do dialog como "title" e "description".
|
|
20
|
+
default: {}
|
|
21
|
+
type: Object
|
|
22
|
+
examples: ["{ title: 'Meu título', description: 'Minha descrição' }"]
|
|
23
|
+
|
|
24
|
+
card-props:
|
|
25
|
+
desc: Props repassadas para o componente "<q-card />".
|
|
26
|
+
default: {}
|
|
27
|
+
type: Object
|
|
28
|
+
|
|
29
|
+
max-width:
|
|
30
|
+
desc: Tamanho máximo do dialog.
|
|
31
|
+
type: String
|
|
32
|
+
|
|
33
|
+
min-width:
|
|
34
|
+
desc: Tamanho mínimo do dialog.
|
|
35
|
+
type: String
|
|
36
|
+
|
|
37
|
+
ok:
|
|
38
|
+
desc: Props para o botão de confirmar (ok), pode ser objeto com as propriedades ou um boolean, caso for "false", remove o botão de confirmar.
|
|
39
|
+
default: "{ label: 'Ok', outline: type: this.ok?.type || this.useForm ? 'submit' : 'button' }"
|
|
40
|
+
debugger: true
|
|
41
|
+
type: [Object, Boolean]
|
|
42
|
+
examples: ["{ label: 'Meu botão de confirmar', onClick: () => alert('fui clicado!') }"]
|
|
43
|
+
|
|
44
|
+
persistent:
|
|
45
|
+
desc: Define se o dialog vai fechar ou não após clicar fora do dialog.
|
|
46
|
+
default: true
|
|
47
|
+
type: Object
|
|
48
|
+
|
|
49
|
+
use-form:
|
|
50
|
+
desc: Define se a tag onde fica a descrição no dialog vai ser um "<q-form />" ou "<div />".
|
|
51
|
+
type: Boolean
|
|
52
|
+
|
|
53
|
+
model-value:
|
|
54
|
+
desc: Model do componente, abre ou fecha o dialog.
|
|
55
|
+
type: Boolean
|
|
56
|
+
examples: [v-model="value"]
|
|
57
|
+
model: true
|
|
58
|
+
|
|
59
|
+
use-close-icon:
|
|
60
|
+
desc: Define se vai ter ou não Ícone de fechar o dialog.
|
|
61
|
+
type: Boolean
|
|
62
|
+
|
|
63
|
+
slots:
|
|
64
|
+
header:
|
|
65
|
+
desc: Slot para o título.
|
|
66
|
+
|
|
67
|
+
description:
|
|
68
|
+
desc: Slot para descrição.
|
|
69
|
+
|
|
70
|
+
actions:
|
|
71
|
+
desc: Slot para ações (botões por exemplo).
|
|
72
|
+
|
|
73
|
+
events:
|
|
74
|
+
'@update:model-value -> function (value)':
|
|
75
|
+
desc: Dispara toda vez que o model é atualizado, também utilizado para v-model.
|
|
76
|
+
params:
|
|
77
|
+
value:
|
|
78
|
+
desc: Novo valor do v-model
|
|
79
|
+
type: Boolean
|
|
80
|
+
|
|
81
|
+
'@validate: -> function (value)':
|
|
82
|
+
desc: Dispara se a prop "useForm" for "true" e após um submit.
|
|
83
|
+
params:
|
|
84
|
+
value:
|
|
85
|
+
desc: Retorna se os campos passou ou não na validação
|
|
86
|
+
type: Boolean
|