@bildvitta/quasar-ui-asteroid 2.16.0 → 3.0.0-alpha.2
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 +8 -4
- 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 -59
- 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
|
@@ -9,10 +9,17 @@
|
|
|
9
9
|
</template>
|
|
10
10
|
|
|
11
11
|
<script>
|
|
12
|
-
import {
|
|
12
|
+
import { markRaw } from 'vue'
|
|
13
|
+
import { Loading, extend } from 'quasar'
|
|
13
14
|
import { NotifyError } from '../../plugins'
|
|
14
15
|
|
|
15
16
|
export default {
|
|
17
|
+
name: 'QasDialogRouter',
|
|
18
|
+
|
|
19
|
+
emits: ['error', 'hide'],
|
|
20
|
+
|
|
21
|
+
expose: ['show', 'hide'],
|
|
22
|
+
|
|
16
23
|
data () {
|
|
17
24
|
return {
|
|
18
25
|
component: null,
|
|
@@ -39,7 +46,7 @@ export default {
|
|
|
39
46
|
},
|
|
40
47
|
|
|
41
48
|
resolveRoute (path) {
|
|
42
|
-
return this.$router.resolve(path)
|
|
49
|
+
return this.$router.resolve(path)
|
|
43
50
|
},
|
|
44
51
|
|
|
45
52
|
async show (route) {
|
|
@@ -52,9 +59,12 @@ export default {
|
|
|
52
59
|
|
|
53
60
|
try {
|
|
54
61
|
Loading.show()
|
|
55
|
-
const component = [...this.route.matched].pop().components.default
|
|
56
62
|
|
|
57
|
-
|
|
63
|
+
const component = markRaw(
|
|
64
|
+
extend(true, {}, [...this.route.matched].pop().components.default)
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
if (typeof component.value !== 'function') {
|
|
58
68
|
this.component = component
|
|
59
69
|
this.$refs.dialog.show()
|
|
60
70
|
} else {
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
type: component
|
|
2
|
+
|
|
3
|
+
meta:
|
|
4
|
+
desc: Componente que abre uma pagina dentro de um "QasDialog", porém se você recarregar a pagina, ela é iniciada na pagina que foi carregada inicialmente dentro do QasDialog.
|
|
5
|
+
|
|
6
|
+
events:
|
|
7
|
+
error:
|
|
8
|
+
desc: Dispara caso não consiga carregar o componente.
|
|
9
|
+
params:
|
|
10
|
+
error:
|
|
11
|
+
desc: Erro retornado.
|
|
12
|
+
type: Object
|
|
13
|
+
|
|
14
|
+
hide:
|
|
15
|
+
desc: Dispara quando o QasDialog é fechado.
|
|
16
|
+
|
|
17
|
+
methods:
|
|
18
|
+
'@show (route) => undefined':
|
|
19
|
+
desc: Função para abrir o a pagina dentro do dialog.
|
|
20
|
+
route:
|
|
21
|
+
value:
|
|
22
|
+
desc: Objeto de roda, igual usado dentro do $router.push(route) por exemplo.
|
|
23
|
+
type: Object
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div>
|
|
3
|
-
<component :is="component.is" v-bind="component" :data-cy="field.name" :value="formattedValue"
|
|
4
|
-
<
|
|
5
|
-
|
|
6
|
-
<slot :name="key" v-bind="scope" />
|
|
3
|
+
<component :is="component.is" v-bind="component" :data-cy="field.name" :model-value="formattedValue" @update:model-value="updateModel">
|
|
4
|
+
<template v-for="(_, name) in $slots" #[name]="context">
|
|
5
|
+
<slot :name="name" v-bind="context || {}" />
|
|
7
6
|
</template>
|
|
8
7
|
</component>
|
|
9
8
|
</div>
|
|
@@ -47,9 +46,16 @@ export default {
|
|
|
47
46
|
default: () => ({}),
|
|
48
47
|
required: true,
|
|
49
48
|
type: Object
|
|
49
|
+
},
|
|
50
|
+
|
|
51
|
+
modelValue: {
|
|
52
|
+
default: undefined,
|
|
53
|
+
type: [Object, Array, String, Number, Boolean]
|
|
50
54
|
}
|
|
51
55
|
},
|
|
52
56
|
|
|
57
|
+
emits: ['update:modelValue'],
|
|
58
|
+
|
|
53
59
|
computed: {
|
|
54
60
|
component () {
|
|
55
61
|
const {
|
|
@@ -72,7 +78,7 @@ export default {
|
|
|
72
78
|
maxFiles,
|
|
73
79
|
searchable,
|
|
74
80
|
gmt
|
|
75
|
-
} = this.
|
|
81
|
+
} = this.formattedField
|
|
76
82
|
|
|
77
83
|
// Default error attributes for Quasar.
|
|
78
84
|
const error = {
|
|
@@ -115,10 +121,10 @@ export default {
|
|
|
115
121
|
// Profiles
|
|
116
122
|
const profiles = {
|
|
117
123
|
default: { is: 'qas-input', ...input, mask },
|
|
118
|
-
textarea: { is: '
|
|
119
|
-
number: { is: '
|
|
124
|
+
textarea: { is: 'qas-input', type, ...input },
|
|
125
|
+
number: { is: 'qas-input', type: 'number', ...input },
|
|
120
126
|
hidden: { is: 'input', name, type },
|
|
121
|
-
email: { is: '
|
|
127
|
+
email: { is: 'qas-input', type, ...input },
|
|
122
128
|
password: { is: 'qas-password-input', type, pattern, hideStrengthChecker: !pattern, ...input },
|
|
123
129
|
|
|
124
130
|
decimal: { ...numericInput, mode: 'decimal' },
|
|
@@ -148,13 +154,8 @@ export default {
|
|
|
148
154
|
return Array.isArray(this.error) ? this.error.join(' ') : this.error
|
|
149
155
|
},
|
|
150
156
|
|
|
151
|
-
events () {
|
|
152
|
-
const { input, ...events } = this.$listeners
|
|
153
|
-
return events
|
|
154
|
-
},
|
|
155
|
-
|
|
156
157
|
// This computed will change the key name when the server sends different key.
|
|
157
|
-
|
|
158
|
+
formattedField () {
|
|
158
159
|
const field = {}
|
|
159
160
|
|
|
160
161
|
for (const key in this.field) {
|
|
@@ -165,17 +166,15 @@ export default {
|
|
|
165
166
|
},
|
|
166
167
|
|
|
167
168
|
formattedValue () {
|
|
168
|
-
const { value } = this.$attrs
|
|
169
|
-
|
|
170
169
|
if (!this.isBoolean) {
|
|
171
|
-
return
|
|
170
|
+
return this.modelValue
|
|
172
171
|
}
|
|
173
172
|
|
|
174
173
|
if (this.isEmptyValue) {
|
|
175
|
-
return !!
|
|
174
|
+
return !!this.modelValue
|
|
176
175
|
}
|
|
177
176
|
|
|
178
|
-
return JSON.parse(
|
|
177
|
+
return JSON.parse(this.modelValue)
|
|
179
178
|
},
|
|
180
179
|
|
|
181
180
|
hasError () {
|
|
@@ -187,13 +186,11 @@ export default {
|
|
|
187
186
|
},
|
|
188
187
|
|
|
189
188
|
isEmptyValue () {
|
|
190
|
-
const { value } = this.$attrs
|
|
191
|
-
|
|
192
189
|
if (!this.isBoolean) {
|
|
193
190
|
return false
|
|
194
191
|
}
|
|
195
192
|
|
|
196
|
-
return !this.
|
|
193
|
+
return !this.modelValue && (this.modelValue === undefined || typeof this.modelValue === 'string')
|
|
197
194
|
},
|
|
198
195
|
|
|
199
196
|
isNumberType () {
|
|
@@ -202,8 +199,8 @@ export default {
|
|
|
202
199
|
},
|
|
203
200
|
|
|
204
201
|
methods: {
|
|
205
|
-
|
|
206
|
-
this.$emit('
|
|
202
|
+
updateModel (value) {
|
|
203
|
+
this.$emit('update:modelValue', this.isNumberType ? Number(value) : value)
|
|
207
204
|
}
|
|
208
205
|
}
|
|
209
206
|
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
type: component
|
|
2
|
+
|
|
3
|
+
meta:
|
|
4
|
+
desc: Componente para criação de campos dinâmicos.
|
|
5
|
+
|
|
6
|
+
props:
|
|
7
|
+
error:
|
|
8
|
+
desc: Array ou String contendo a mensagem de erro.
|
|
9
|
+
type: [Array, String]
|
|
10
|
+
|
|
11
|
+
field:
|
|
12
|
+
desc: Field contendo informações necessárias para a criação do campo correspondente.
|
|
13
|
+
default: {}
|
|
14
|
+
required: true
|
|
15
|
+
type: Object
|
|
16
|
+
examples: ["{ name: 'email', type: 'email', label: 'E-mail' }"]
|
|
17
|
+
|
|
18
|
+
model-value:
|
|
19
|
+
desc: Model do componente, usado para o v-model.
|
|
20
|
+
default: undefined
|
|
21
|
+
type: [Object, Array, String, Number, Boolean]
|
|
22
|
+
examples: [v-model="value"]
|
|
23
|
+
model: true
|
|
24
|
+
|
|
25
|
+
events:
|
|
26
|
+
'@update:model-value -> function(value)':
|
|
27
|
+
desc: Dispara quando o model-value altera, também usado para v-model.
|
|
28
|
+
params:
|
|
29
|
+
value:
|
|
30
|
+
desc: Novo valor do model.
|
|
31
|
+
type: [Object, Array, String, Number, Boolean]
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<div v-if="showFilters" class="q-gutter-x-md row">
|
|
4
4
|
<div v-if="showSearch" class="col">
|
|
5
5
|
<slot :filter="filter" name="search">
|
|
6
|
-
<q-form v-if="
|
|
6
|
+
<q-form v-if="useSearch" @submit.prevent="filter()">
|
|
7
7
|
<q-input v-model="search" :debounce="debounce" dense :placeholder="searchPlaceholder" type="search">
|
|
8
8
|
<template #append>
|
|
9
9
|
<q-btn v-if="hasSearch" icon="o_clear" unelevated @click="clearSearch" />
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
</div>
|
|
16
16
|
|
|
17
17
|
<slot v-if="showFilterButton" :filter="filter" name="filter-button">
|
|
18
|
-
<q-btn v-if="
|
|
18
|
+
<q-btn v-if="useFilterButton" :color="filterButtonColor" flat icon="o_filter_list" :label="filterButtonLabel">
|
|
19
19
|
<q-menu @before-show="fetchFilters">
|
|
20
20
|
<div v-if="isFetching" class="q-pa-xl text-center">
|
|
21
21
|
<q-spinner color="grey" size="2em" />
|
|
@@ -40,29 +40,32 @@
|
|
|
40
40
|
</slot>
|
|
41
41
|
</div>
|
|
42
42
|
|
|
43
|
-
<div v-if="
|
|
43
|
+
<div v-if="useChip && hasActiveFilters" class="q-mt-md">
|
|
44
44
|
<q-chip v-for="(filterItem, key) in activeFilters" :key="key" color="grey-4" dense removable size="md" text-color="grey-8" @remove="removeFilter(filterItem)">{{ filterItem.label }} = "{{ getChipValue(filterItem.value) }}"</q-chip>
|
|
45
45
|
</div>
|
|
46
46
|
|
|
47
|
-
<slot :context="
|
|
47
|
+
<slot :context="mx_context" :filter="filter" :filters="activeFilters" :remove-filter="removeFilter" />
|
|
48
48
|
</section>
|
|
49
49
|
</template>
|
|
50
50
|
|
|
51
51
|
<script>
|
|
52
|
-
import QasField from '../field/QasField'
|
|
52
|
+
import QasField from '../field/QasField.vue'
|
|
53
53
|
|
|
54
54
|
import { camelize, camelizeKeys } from 'humps'
|
|
55
|
-
import { humanize, parseValue } from '../../helpers/filters'
|
|
56
|
-
import contextMixin from '../../mixins/context'
|
|
55
|
+
import { humanize, parseValue } from '../../helpers/filters.js'
|
|
56
|
+
import contextMixin from '../../mixins/context.js'
|
|
57
57
|
|
|
58
58
|
export default {
|
|
59
|
+
name: 'QasFilters',
|
|
60
|
+
|
|
59
61
|
components: {
|
|
60
62
|
QasField
|
|
61
63
|
},
|
|
62
64
|
|
|
63
65
|
mixins: [contextMixin],
|
|
66
|
+
|
|
64
67
|
props: {
|
|
65
|
-
|
|
68
|
+
useChip: {
|
|
66
69
|
default: true,
|
|
67
70
|
type: Boolean
|
|
68
71
|
},
|
|
@@ -72,17 +75,17 @@ export default {
|
|
|
72
75
|
type: String
|
|
73
76
|
},
|
|
74
77
|
|
|
75
|
-
|
|
76
|
-
default:
|
|
78
|
+
useFilterButton: {
|
|
79
|
+
default: true,
|
|
77
80
|
type: Boolean
|
|
78
81
|
},
|
|
79
82
|
|
|
80
|
-
|
|
81
|
-
default:
|
|
83
|
+
useSearch: {
|
|
84
|
+
default: true,
|
|
82
85
|
type: Boolean
|
|
83
86
|
},
|
|
84
87
|
|
|
85
|
-
|
|
88
|
+
useSearchOnType: {
|
|
86
89
|
default: true,
|
|
87
90
|
type: Boolean
|
|
88
91
|
},
|
|
@@ -98,6 +101,8 @@ export default {
|
|
|
98
101
|
}
|
|
99
102
|
},
|
|
100
103
|
|
|
104
|
+
emits: ['fetch-success', 'fetch-error'],
|
|
105
|
+
|
|
101
106
|
data () {
|
|
102
107
|
return {
|
|
103
108
|
filters: {},
|
|
@@ -116,7 +121,7 @@ export default {
|
|
|
116
121
|
const activeFilters = {}
|
|
117
122
|
|
|
118
123
|
const fields = Object.keys(this.fields)
|
|
119
|
-
const filters = camelizeKeys(this.
|
|
124
|
+
const filters = camelizeKeys(this.mx_context.filters)
|
|
120
125
|
|
|
121
126
|
for (const key in filters) {
|
|
122
127
|
const hasField = fields.includes(key)
|
|
@@ -133,7 +138,7 @@ export default {
|
|
|
133
138
|
},
|
|
134
139
|
|
|
135
140
|
debounce () {
|
|
136
|
-
return this.
|
|
141
|
+
return this.useSearchOnType ? '500' : ''
|
|
137
142
|
},
|
|
138
143
|
|
|
139
144
|
fields () {
|
|
@@ -161,22 +166,24 @@ export default {
|
|
|
161
166
|
},
|
|
162
167
|
|
|
163
168
|
showFilterButton () {
|
|
164
|
-
return !!this.$
|
|
169
|
+
return !!this.$slots.filterButton || this.useFilterButton
|
|
165
170
|
},
|
|
166
171
|
|
|
167
172
|
showFilters () {
|
|
168
|
-
return this.
|
|
173
|
+
return this.useFilterButton || this.showSearch
|
|
169
174
|
},
|
|
170
175
|
|
|
171
176
|
showSearch () {
|
|
172
|
-
return !!this.$
|
|
177
|
+
return !!this.$slots.search || this.useSearch
|
|
173
178
|
}
|
|
174
179
|
},
|
|
175
180
|
|
|
176
181
|
watch: {
|
|
177
|
-
$route () {
|
|
178
|
-
|
|
179
|
-
|
|
182
|
+
$route (to, from) {
|
|
183
|
+
if (to.name === from.name) {
|
|
184
|
+
this.fetchFilters()
|
|
185
|
+
this.updateValues()
|
|
186
|
+
}
|
|
180
187
|
},
|
|
181
188
|
|
|
182
189
|
search () {
|
|
@@ -193,7 +200,7 @@ export default {
|
|
|
193
200
|
|
|
194
201
|
methods: {
|
|
195
202
|
clearFilters () {
|
|
196
|
-
const { filters, ...query } = this.
|
|
203
|
+
const { filters, ...query } = this.mx_context
|
|
197
204
|
|
|
198
205
|
if (this.hasFields) {
|
|
199
206
|
const fields = Object.keys(this.fields)
|
|
@@ -220,7 +227,7 @@ export default {
|
|
|
220
227
|
},
|
|
221
228
|
|
|
222
229
|
async fetchFilters () {
|
|
223
|
-
if (this.hasFields || this.
|
|
230
|
+
if (this.hasFields || !this.useFilterButton) {
|
|
224
231
|
return null
|
|
225
232
|
}
|
|
226
233
|
|
|
@@ -239,7 +246,7 @@ export default {
|
|
|
239
246
|
},
|
|
240
247
|
|
|
241
248
|
filter (external) {
|
|
242
|
-
const { filters, page, ...context } = this.
|
|
249
|
+
const { filters, page, ...context } = this.mx_context
|
|
243
250
|
|
|
244
251
|
const query = {
|
|
245
252
|
...filters,
|
|
@@ -266,11 +273,11 @@ export default {
|
|
|
266
273
|
},
|
|
267
274
|
|
|
268
275
|
updateValues () {
|
|
269
|
-
const { filters, search } = this.
|
|
276
|
+
const { filters, search } = this.mx_context
|
|
270
277
|
this.search = search || ''
|
|
271
278
|
|
|
272
279
|
for (const key in filters) {
|
|
273
|
-
this
|
|
280
|
+
this.filters[key] = parseValue(this.normalizeValues(filters[key], this.fields[key]?.multiple))
|
|
274
281
|
}
|
|
275
282
|
},
|
|
276
283
|
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
type: component
|
|
2
|
+
|
|
3
|
+
meta:
|
|
4
|
+
desc: Componente para criação de filtros dinâmicos.
|
|
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
|
+
use-badges:
|
|
13
|
+
desc: Habilita ou não os "chips" mostrando os filtros ativos.
|
|
14
|
+
default: true
|
|
15
|
+
type: Boolean
|
|
16
|
+
|
|
17
|
+
use-filter-button:
|
|
18
|
+
desc: Habilita ou não o botão com menu na lateral esquerda.
|
|
19
|
+
default: true
|
|
20
|
+
type: Boolean
|
|
21
|
+
|
|
22
|
+
use-search:
|
|
23
|
+
desc: Habilita ou não o campo text de busca.
|
|
24
|
+
default: true
|
|
25
|
+
type: Boolean
|
|
26
|
+
|
|
27
|
+
use-search-on-type:
|
|
28
|
+
desc: Habilita ou não o filtro de busca sempre que o usuário digita.
|
|
29
|
+
default: true
|
|
30
|
+
type: Boolean
|
|
31
|
+
|
|
32
|
+
search-placeholder:
|
|
33
|
+
desc: Placeholder do campo de busca.
|
|
34
|
+
default: Pesquisar...
|
|
35
|
+
type: String
|
|
36
|
+
|
|
37
|
+
url:
|
|
38
|
+
desc: Envia como parâmetro para a action "fetchFilters" do modulo correspondente a "entity".
|
|
39
|
+
type: String
|
|
40
|
+
|
|
41
|
+
slots:
|
|
42
|
+
search:
|
|
43
|
+
desc: Slot para seção do campo de busca.
|
|
44
|
+
scope:
|
|
45
|
+
filter:
|
|
46
|
+
desc: função usada para fazer o filtro
|
|
47
|
+
type: Function
|
|
48
|
+
|
|
49
|
+
filter-button:
|
|
50
|
+
desc: Slot para seção do botão do menu lateral.
|
|
51
|
+
scope:
|
|
52
|
+
filter:
|
|
53
|
+
desc: função usada para fazer o filtro
|
|
54
|
+
type: Function
|
|
55
|
+
|
|
56
|
+
default:
|
|
57
|
+
desc: Slot para acessar o final do componente.
|
|
58
|
+
scope:
|
|
59
|
+
filter:
|
|
60
|
+
desc: Função usada para fazer o filtro
|
|
61
|
+
type: Function
|
|
62
|
+
|
|
63
|
+
filters:
|
|
64
|
+
desc: Objeto que retorna os filtros ativos
|
|
65
|
+
default: {}
|
|
66
|
+
type: Object
|
|
67
|
+
|
|
68
|
+
remove-filter:
|
|
69
|
+
desc: Função usada para remover os filtro
|
|
70
|
+
type: Function
|
|
71
|
+
examples: ["removeFilter({ name: '[nome-do-filtro]' })"]
|
|
72
|
+
|
|
73
|
+
context:
|
|
74
|
+
desc: Contexto referente a query da url.
|
|
75
|
+
default: { filters: {}, page: 1 }
|
|
76
|
+
type: Object
|
|
77
|
+
|
|
78
|
+
events:
|
|
79
|
+
'@fetch-success -> function(value)':
|
|
80
|
+
desc: Dispara quando a action "fetchFilters" é executada com sucesso.
|
|
81
|
+
params:
|
|
82
|
+
value:
|
|
83
|
+
desc: Retorna todos os dados "cru" respondido pelo fetch.
|
|
84
|
+
type: Object
|
|
85
|
+
|
|
86
|
+
'@fetch-error -> function(value)':
|
|
87
|
+
desc: Dispara quando a action "fetchFilters" cai em uma exceção.
|
|
88
|
+
params:
|
|
89
|
+
value:
|
|
90
|
+
desc: Retorna todos os dados "cru" respondido na exceção do fetch.
|
|
91
|
+
type: Object
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div>
|
|
3
|
-
<div :class="
|
|
4
|
-
<div v-for="(field, key) in groupedFields.visible" :key="key" :class="
|
|
3
|
+
<div :class="mx_classes">
|
|
4
|
+
<div v-for="(field, key) in groupedFields.visible" :key="key" :class="mx_getFieldClass(key)">
|
|
5
5
|
<slot :field="field" :name="`field-${field.name}`">
|
|
6
|
-
<qas-field v-bind="fieldsProps[field.name]" :error="errors[key]" :field="field" :value="
|
|
6
|
+
<qas-field v-bind="fieldsProps[field.name]" :error="errors[key]" :field="field" :model-value="modelValue[field.name]" @update:model-value="updateModelValue(field.name, $event)" />
|
|
7
7
|
</slot>
|
|
8
8
|
</div>
|
|
9
9
|
</div>
|
|
10
10
|
|
|
11
11
|
<div v-for="(field, key) in groupedFields.hidden" :key="key">
|
|
12
12
|
<slot :field="field" :name="`field-${field.name}`">
|
|
13
|
-
<qas-field v-bind="fieldsProps[field.name]" :field="field" :value="
|
|
13
|
+
<qas-field v-bind="fieldsProps[field.name]" :field="field" :model-value="modelValue[field.name]" @update:model-value="updateModelValue(field.name, $event)" />
|
|
14
14
|
</slot>
|
|
15
15
|
</div>
|
|
16
16
|
</div>
|
|
@@ -18,10 +18,11 @@
|
|
|
18
18
|
|
|
19
19
|
<script>
|
|
20
20
|
import generatorMixin from '../../mixins/generator'
|
|
21
|
-
|
|
22
|
-
import QasField from '../field/QasField'
|
|
21
|
+
import QasField from '../field/QasField.vue'
|
|
23
22
|
|
|
24
23
|
export default {
|
|
24
|
+
name: 'QasFormGenerator',
|
|
25
|
+
|
|
25
26
|
components: {
|
|
26
27
|
QasField
|
|
27
28
|
},
|
|
@@ -34,11 +35,6 @@ export default {
|
|
|
34
35
|
type: Object
|
|
35
36
|
},
|
|
36
37
|
|
|
37
|
-
fieldsEvents: {
|
|
38
|
-
default: () => ({}),
|
|
39
|
-
type: Object
|
|
40
|
-
},
|
|
41
|
-
|
|
42
38
|
fieldsProps: {
|
|
43
39
|
default: () => ({}),
|
|
44
40
|
type: Object
|
|
@@ -49,13 +45,15 @@ export default {
|
|
|
49
45
|
type: Array
|
|
50
46
|
},
|
|
51
47
|
|
|
52
|
-
|
|
48
|
+
modelValue: {
|
|
53
49
|
default: () => ({}),
|
|
54
50
|
required: true,
|
|
55
51
|
type: Object
|
|
56
52
|
}
|
|
57
53
|
},
|
|
58
54
|
|
|
55
|
+
emits: ['update:modelValue'],
|
|
56
|
+
|
|
59
57
|
computed: {
|
|
60
58
|
groupedFields () {
|
|
61
59
|
const fields = { hidden: {}, visible: {} }
|
|
@@ -80,11 +78,11 @@ export default {
|
|
|
80
78
|
},
|
|
81
79
|
|
|
82
80
|
methods: {
|
|
83
|
-
|
|
84
|
-
const models = { ...this.
|
|
81
|
+
updateModelValue (key, value) {
|
|
82
|
+
const models = { ...this.modelValue }
|
|
85
83
|
models[key] = value
|
|
86
84
|
|
|
87
|
-
this.$emit('
|
|
85
|
+
this.$emit('update:modelValue', models)
|
|
88
86
|
}
|
|
89
87
|
}
|
|
90
88
|
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
type: component
|
|
2
|
+
|
|
3
|
+
meta:
|
|
4
|
+
desc: Componente para criação de múltiplos campos dinâmicos a partir do componente `QasField`.
|
|
5
|
+
|
|
6
|
+
props:
|
|
7
|
+
error:
|
|
8
|
+
desc: Objeto contendo propriedades contendo a mensagem de erro.
|
|
9
|
+
default: {}
|
|
10
|
+
type: Object
|
|
11
|
+
|
|
12
|
+
fields:
|
|
13
|
+
desc: Lista de field contendo informações necessárias para a criação do campo correspondente.
|
|
14
|
+
default: {}
|
|
15
|
+
type: Object
|
|
16
|
+
examples: ["{ email: { name: 'email', type: 'email', label: 'E-mail' } }"]
|
|
17
|
+
|
|
18
|
+
fields-props:
|
|
19
|
+
desc: Propriedade para repassar propriedades para cada campo individualmente.
|
|
20
|
+
default: {}
|
|
21
|
+
type: Object
|
|
22
|
+
examples: ["{ name: { dense: true, onClick: () => alert('Estou sendo clicado') } }"]
|
|
23
|
+
|
|
24
|
+
order:
|
|
25
|
+
desc: Altera ordem dos campos.
|
|
26
|
+
default: []
|
|
27
|
+
type: Array
|
|
28
|
+
|
|
29
|
+
model-value:
|
|
30
|
+
desc: Model do componente, usado para o v-model.
|
|
31
|
+
required: true
|
|
32
|
+
default: {}
|
|
33
|
+
type: Object
|
|
34
|
+
examples: [v-model="value"]
|
|
35
|
+
model: true
|
|
36
|
+
|
|
37
|
+
columns:
|
|
38
|
+
desc: Colunas do grid de cada campo.
|
|
39
|
+
default: col-6
|
|
40
|
+
type: [Array, String, Object]
|
|
41
|
+
examples: ["{ name: { sm: 6, md: 12 } }", "[{ sm: 6, md: 12 }]"]
|
|
42
|
+
|
|
43
|
+
gutter:
|
|
44
|
+
desc: Espaçamento entre colunas.
|
|
45
|
+
default: md
|
|
46
|
+
type: String
|
|
47
|
+
examples: [xs, sm, md, lg, xl]
|
|
48
|
+
|
|
49
|
+
slots:
|
|
50
|
+
'field-[nome-da-chave]':
|
|
51
|
+
desc: Acessa o slot de um campo especifico.
|
|
52
|
+
scope:
|
|
53
|
+
field:
|
|
54
|
+
desc: Payload do campo atual.
|
|
55
|
+
default: {}
|
|
56
|
+
type: Object
|
|
57
|
+
|
|
58
|
+
events:
|
|
59
|
+
'@update:model-value -> function(value)':
|
|
60
|
+
desc: Dispara quando o model-value altera, também usado para v-model.
|
|
61
|
+
params:
|
|
62
|
+
value:
|
|
63
|
+
desc: Novo valor do model.
|
|
64
|
+
type: Object
|