@bildvitta/quasar-ui-asteroid 2.14.0 → 3.0.0-alpha.1
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/QasBox.json +16 -0
- package/dist/api/QasBreakline.json +32 -0
- package/dist/api/QasBtn.json +15 -0
- package/dist/api/QasDebugger.json +13 -0
- package/dist/asteroid.cjs.css +1 -1
- package/dist/asteroid.cjs.js +6762 -1400
- package/dist/asteroid.cjs.min.js +2 -2
- package/dist/asteroid.esm.css +1 -1
- package/dist/asteroid.esm.js +6764 -1405
- package/dist/asteroid.esm.min.js +2 -2
- package/dist/asteroid.umd.css +1 -1
- package/dist/asteroid.umd.js +6760 -1405
- package/dist/asteroid.umd.min.js +2 -2
- package/dist/vetur/asteroid-attributes.json +16 -0
- package/dist/vetur/asteroid-tags.json +19 -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-menu/QasActionsMenu.vue +8 -19
- package/src/components/alert/QasAlert.vue +90 -0
- package/src/components/app-bar/QasAppBar.vue +16 -13
- package/src/components/app-menu/QasAppMenu.vue +10 -7
- package/src/components/avatar/QasAvatar.vue +7 -3
- 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 +12 -0
- package/src/components/card/QasCard.vue +29 -21
- package/src/components/checkbox-group/QasCheckboxGroup.vue +31 -17
- package/src/components/copy/QasCopy.vue +22 -11
- package/src/components/date-time-input/QasDateTimeInput.vue +16 -26
- package/src/components/debugger/QasDebugger.vue +2 -0
- package/src/components/debugger/QasDebugger.yml +10 -0
- package/src/components/delete/QasDelete.vue +28 -15
- package/src/components/dialog/QasDialog.vue +71 -67
- package/src/components/dialog-router/QasDialogRouter.vue +12 -4
- package/src/components/field/QasField.vue +16 -19
- package/src/components/filters/QasFilters.vue +31 -24
- package/src/components/form-generator/QasFormGenerator.vue +13 -15
- package/src/components/form-view/QasFormView.vue +117 -66
- package/src/components/gallery/QasGallery.vue +39 -26
- package/src/components/grid-generator/QasGridGenerator.vue +12 -6
- package/src/components/index.js +0 -0
- package/src/components/input/QasInput.vue +38 -36
- package/src/components/label/QasLabel.vue +14 -15
- package/src/components/layout/QasLayout.vue +13 -21
- package/src/components/list-items/QasListItems.vue +16 -8
- package/src/components/list-view/QasListView.vue +31 -28
- package/src/components/map/QasMap.vue +15 -25
- package/src/components/nested-fields/QasNestedFields.vue +39 -36
- package/src/components/numeric-input/QasNumericInput.vue +24 -21
- package/src/components/page-header/QasPageHeader.vue +19 -10
- package/src/components/password-input/QasPasswordInput.vue +20 -18
- package/src/components/password-strength-checker/QasPasswordStrengthChecker.vue +52 -31
- package/src/components/profile/QasProfile.vue +14 -12
- package/src/components/resizer/QasResizer.vue +1 -1
- package/src/components/search-box/QasSearchBox.vue +36 -20
- package/src/components/select/QasSelect.vue +41 -44
- package/src/components/select-list/QasSelectList.vue +64 -51
- package/src/components/signature-pad/QasSignaturePad.vue +57 -41
- package/src/components/signature-uploader/QasSignatureUploader.vue +15 -13
- package/src/components/single-view/QasSingleView.vue +31 -17
- package/src/components/sortable/QasSortable.vue +45 -27
- package/src/components/table-generator/QasTableGenerator.vue +95 -22
- package/src/components/tabs-generator/QasTabsGenerator.vue +36 -24
- package/src/components/text-truncate/QasTextTruncate.vue +25 -17
- package/src/components/transfer/QasTransfer.vue +57 -53
- package/src/components/uploader/QasUploader.vue +169 -48
- 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 +2 -3
- package/src/helpers/get-slot-children-text.js +15 -0
- package/src/helpers/{greatestCommonDivisor.js → greatest-common-divisor.js} +0 -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/scroll-on-grap.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 +57 -20
- package/src/plugins/Dialog.js +14 -0
- package/src/plugins/NotifySuccess.js +3 -3
- package/src/plugins/index.js +4 -2
- 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 -138
- 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 -130
- 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 -116
- 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 -121
- 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,43 +1,46 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<q-btn color="primary" no-caps unelevated v-bind="attributes">
|
|
3
|
+
<slot v-if="showLabel">{{ $attrs.label }}</slot>
|
|
4
|
+
|
|
5
|
+
<template v-for="(_, name) in slots" #[name]="context">
|
|
6
|
+
<slot :name="name" v-bind="context || {}" />
|
|
7
|
+
</template>
|
|
8
|
+
</q-btn>
|
|
9
|
+
</template>
|
|
10
|
+
|
|
1
11
|
<script>
|
|
2
|
-
import {
|
|
12
|
+
import { screenMixin } from '../../mixins'
|
|
3
13
|
|
|
4
14
|
export default {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
props: {
|
|
8
|
-
color: {
|
|
9
|
-
default: 'primary',
|
|
10
|
-
type: String
|
|
11
|
-
},
|
|
15
|
+
name: 'QasBtn',
|
|
12
16
|
|
|
13
|
-
|
|
14
|
-
hideMobileLabel: {
|
|
15
|
-
type: Boolean
|
|
16
|
-
},
|
|
17
|
+
mixins: [screenMixin],
|
|
17
18
|
|
|
18
|
-
|
|
19
|
-
default: true,
|
|
20
|
-
type: Boolean
|
|
21
|
-
},
|
|
19
|
+
inheritAttrs: false,
|
|
22
20
|
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
props: {
|
|
22
|
+
hideLabelOnSmallScreen: {
|
|
25
23
|
type: Boolean
|
|
26
24
|
}
|
|
27
25
|
},
|
|
28
26
|
|
|
29
27
|
computed: {
|
|
30
|
-
|
|
28
|
+
attributes () {
|
|
29
|
+
const { label, ...attributes } = this.$attrs
|
|
30
|
+
return attributes
|
|
31
|
+
},
|
|
32
|
+
|
|
31
33
|
hasLabel () {
|
|
32
|
-
return !!this.label
|
|
34
|
+
return !!(this.$attrs.label || this.$slots.default)
|
|
33
35
|
},
|
|
34
36
|
|
|
35
|
-
|
|
36
|
-
return this
|
|
37
|
+
showLabel () {
|
|
38
|
+
return this.hasLabel && !(this.hideLabelOnSmallScreen && this.mx_isSmall)
|
|
37
39
|
},
|
|
38
40
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
+
slots () {
|
|
42
|
+
const { default: _, ...slots } = this.$slots
|
|
43
|
+
return slots
|
|
41
44
|
}
|
|
42
45
|
}
|
|
43
46
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
type: component
|
|
2
|
+
|
|
3
|
+
mixins:
|
|
4
|
+
- quasar/dist/api/QBtn.json
|
|
5
|
+
|
|
6
|
+
meta:
|
|
7
|
+
desc: O mesmo botão do Quasar (QBtn), mas com o nosso estilo.
|
|
8
|
+
|
|
9
|
+
props:
|
|
10
|
+
hide-label-on-small-screen:
|
|
11
|
+
desc: Esconde o rótulo do botão quando o tamanho da tela for pequeno.
|
|
12
|
+
type: Boolean
|
|
@@ -7,8 +7,10 @@
|
|
|
7
7
|
<template #navigation-icon="{ active, btnProps, onClick }">
|
|
8
8
|
<qas-btn color="white" dense flat :icon="getNavigationIcon(active, btnProps)" round size="sm" @click="onClick" />
|
|
9
9
|
</template>
|
|
10
|
-
|
|
10
|
+
|
|
11
|
+
<q-carousel-slide v-for="(item, index) in imagesList" :key="index" class="bg-no-repeat" :class="bgImagePositionClass" :img-src="item" :name="index" />
|
|
11
12
|
</q-carousel>
|
|
13
|
+
|
|
12
14
|
<div class="absolute-top flex items-center q-pa-md">
|
|
13
15
|
<slot name="carousel-header" />
|
|
14
16
|
</div>
|
|
@@ -16,12 +18,12 @@
|
|
|
16
18
|
</div>
|
|
17
19
|
|
|
18
20
|
<q-card-section class="col-grow column justify-between w-full">
|
|
19
|
-
<div class="w-full" :class="
|
|
21
|
+
<div class="w-full" :class="gutterClass">
|
|
20
22
|
<slot />
|
|
21
23
|
</div>
|
|
22
24
|
</q-card-section>
|
|
23
25
|
|
|
24
|
-
<div v-if="
|
|
26
|
+
<div v-if="hasActionsSlot" class="border-primary-contrast border-top overflow-hidden row">
|
|
25
27
|
<slot name="actions" />
|
|
26
28
|
</div>
|
|
27
29
|
</q-card>
|
|
@@ -30,20 +32,26 @@
|
|
|
30
32
|
|
|
31
33
|
<script>
|
|
32
34
|
export default {
|
|
35
|
+
name: 'QasCard',
|
|
36
|
+
|
|
33
37
|
props: {
|
|
34
38
|
bgImagePosition: {
|
|
35
39
|
type: String,
|
|
36
40
|
default: 'center'
|
|
37
41
|
},
|
|
38
42
|
|
|
43
|
+
formMode: {
|
|
44
|
+
type: Boolean
|
|
45
|
+
},
|
|
46
|
+
|
|
39
47
|
gutter: {
|
|
40
48
|
type: String,
|
|
41
49
|
default: 'sm'
|
|
42
50
|
},
|
|
43
51
|
|
|
44
52
|
images: {
|
|
45
|
-
|
|
46
|
-
|
|
53
|
+
default: () => ([]),
|
|
54
|
+
type: Array
|
|
47
55
|
},
|
|
48
56
|
|
|
49
57
|
outlined: {
|
|
@@ -51,8 +59,8 @@ export default {
|
|
|
51
59
|
},
|
|
52
60
|
|
|
53
61
|
result: {
|
|
54
|
-
|
|
55
|
-
|
|
62
|
+
default: () => ({}),
|
|
63
|
+
type: Object
|
|
56
64
|
},
|
|
57
65
|
|
|
58
66
|
useHeader: {
|
|
@@ -67,32 +75,32 @@ export default {
|
|
|
67
75
|
},
|
|
68
76
|
|
|
69
77
|
computed: {
|
|
70
|
-
|
|
71
|
-
return
|
|
78
|
+
bgImagePositionClass () {
|
|
79
|
+
return `bg-position-${this.bgImagePosition}`
|
|
72
80
|
},
|
|
73
81
|
|
|
74
|
-
|
|
75
|
-
return this.
|
|
82
|
+
cardClasses () {
|
|
83
|
+
return this.formMode ? 'bg-white border-primary no-shadow' : 'box-shadow-1'
|
|
76
84
|
},
|
|
77
85
|
|
|
78
|
-
|
|
79
|
-
return this.
|
|
86
|
+
gutterClass () {
|
|
87
|
+
return `q-col-gutter-${this.gutter}`
|
|
80
88
|
},
|
|
81
89
|
|
|
82
|
-
|
|
83
|
-
return this.
|
|
90
|
+
hasActionsSlot () {
|
|
91
|
+
return !!this.$slots.actions
|
|
84
92
|
},
|
|
85
93
|
|
|
86
|
-
|
|
87
|
-
return
|
|
94
|
+
hasImages () {
|
|
95
|
+
return this.images.length > 1
|
|
88
96
|
},
|
|
89
97
|
|
|
90
|
-
|
|
91
|
-
return
|
|
98
|
+
imagesLength () {
|
|
99
|
+
return this.images?.length
|
|
92
100
|
},
|
|
93
101
|
|
|
94
|
-
|
|
95
|
-
return
|
|
102
|
+
imagesList () {
|
|
103
|
+
return this.imagesLength && this.images.slice(0, 3)
|
|
96
104
|
}
|
|
97
105
|
},
|
|
98
106
|
|
|
@@ -1,38 +1,36 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div>
|
|
3
3
|
<div v-for="(option, index) in options" :key="index">
|
|
4
|
-
<q-checkbox :class="
|
|
5
|
-
<q-option-group v-if="hasChildren(option)" class="q-ml-sm" inline :options="option.children" type="checkbox" :value="
|
|
4
|
+
<q-checkbox :class="getCheckboxClass(option)" :label="option.label" :model-value="getModelValue(option, index)" @update:model-value="updateCheckbox($event, option, index)" />
|
|
5
|
+
<q-option-group v-if="hasChildren(option)" class="q-ml-sm" inline :model-value="modelValue" :options="option.children" type="checkbox" @update:model-value="updateChildren($event, option, index)" />
|
|
6
6
|
</div>
|
|
7
7
|
</div>
|
|
8
8
|
</template>
|
|
9
9
|
|
|
10
10
|
<script>
|
|
11
11
|
export default {
|
|
12
|
+
name: 'QasCheckboxGroup',
|
|
13
|
+
|
|
12
14
|
props: {
|
|
13
15
|
options: {
|
|
14
16
|
default: () => [],
|
|
15
17
|
type: Array
|
|
16
18
|
},
|
|
17
19
|
|
|
18
|
-
|
|
20
|
+
modelValue: {
|
|
19
21
|
default: () => [],
|
|
20
22
|
type: Array
|
|
21
23
|
}
|
|
22
24
|
},
|
|
23
25
|
|
|
26
|
+
emits: ['update:modelValue'],
|
|
27
|
+
|
|
24
28
|
data () {
|
|
25
29
|
return {
|
|
26
30
|
group: {}
|
|
27
31
|
}
|
|
28
32
|
},
|
|
29
33
|
|
|
30
|
-
computed: {
|
|
31
|
-
titleClass () {
|
|
32
|
-
return ['text-weight-bold']
|
|
33
|
-
}
|
|
34
|
-
},
|
|
35
|
-
|
|
36
34
|
watch: {
|
|
37
35
|
options () {
|
|
38
36
|
this.handleParent()
|
|
@@ -48,7 +46,7 @@ export default {
|
|
|
48
46
|
for (const index in this.options) {
|
|
49
47
|
const option = this.options[index]
|
|
50
48
|
if (this.hasChildren(option)) {
|
|
51
|
-
this.setGroupIntersection(this.
|
|
49
|
+
this.setGroupIntersection(this.modelValue, option, index)
|
|
52
50
|
}
|
|
53
51
|
}
|
|
54
52
|
},
|
|
@@ -60,25 +58,41 @@ export default {
|
|
|
60
58
|
setGroupIntersection (value, option, index) {
|
|
61
59
|
const options = option.children.map(item => item.value)
|
|
62
60
|
const intersection = options.filter(item => value.includes(item))
|
|
63
|
-
|
|
61
|
+
|
|
62
|
+
this.group[index] = intersection.length ? (intersection.length === options.length ? true : null) : false
|
|
64
63
|
},
|
|
65
64
|
|
|
66
65
|
updateCheckbox (value, option, index) {
|
|
67
66
|
if (!this.hasChildren(option)) {
|
|
68
67
|
// Arrumar
|
|
69
|
-
return this
|
|
68
|
+
return this.updateModelValue(this.modelValue)
|
|
70
69
|
}
|
|
71
|
-
|
|
70
|
+
|
|
71
|
+
this.group[index] = value
|
|
72
72
|
const groupValues = option.children.map(item => item.value)
|
|
73
|
+
|
|
73
74
|
const updatedValue = value
|
|
74
|
-
? [...this.
|
|
75
|
-
: this.
|
|
76
|
-
|
|
75
|
+
? [...this.modelValue, ...groupValues]
|
|
76
|
+
: this.modelValue.filter(item => !groupValues.includes(item))
|
|
77
|
+
|
|
78
|
+
this.updateModelValue(updatedValue)
|
|
77
79
|
},
|
|
78
80
|
|
|
79
81
|
updateChildren (value, option, index) {
|
|
80
82
|
this.setGroupIntersection(value, option, index)
|
|
81
|
-
this
|
|
83
|
+
this.updateModelValue(value)
|
|
84
|
+
},
|
|
85
|
+
|
|
86
|
+
getCheckboxClass (option) {
|
|
87
|
+
return this.hasChildren(option) && 'text-weight-bold'
|
|
88
|
+
},
|
|
89
|
+
|
|
90
|
+
getModelValue (option, index) {
|
|
91
|
+
return this.hasChildren(option) ? this.group[index] : option.value
|
|
92
|
+
},
|
|
93
|
+
|
|
94
|
+
updateModelValue (value) {
|
|
95
|
+
this.$emit('update:modelValue', value)
|
|
82
96
|
}
|
|
83
97
|
}
|
|
84
98
|
}
|
|
@@ -1,42 +1,53 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<span>
|
|
3
|
-
<slot>{{
|
|
3
|
+
<slot>{{ text }}</slot>
|
|
4
4
|
|
|
5
|
-
<
|
|
5
|
+
<qas-btn class="q-ml-xs" color="grey-5" flat :icon="icon" :loading="isLoading" round :size="size" @click="copy">
|
|
6
6
|
<q-tooltip>Copiar</q-tooltip>
|
|
7
|
-
</
|
|
7
|
+
</qas-btn>
|
|
8
8
|
</span>
|
|
9
9
|
</template>
|
|
10
10
|
|
|
11
11
|
<script>
|
|
12
12
|
import { copyToClipboard } from 'quasar'
|
|
13
|
-
import { NotifyError, NotifySuccess } from '../../plugins'
|
|
14
13
|
|
|
15
14
|
export default {
|
|
15
|
+
name: 'QasCopy',
|
|
16
|
+
|
|
16
17
|
props: {
|
|
17
18
|
icon: {
|
|
18
19
|
default: 'o_file_copy',
|
|
19
20
|
type: String
|
|
20
21
|
},
|
|
21
22
|
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
size: {
|
|
24
|
+
default: 'xs',
|
|
24
25
|
type: String
|
|
25
26
|
},
|
|
26
27
|
|
|
27
|
-
|
|
28
|
-
|
|
28
|
+
text: {
|
|
29
|
+
required: true,
|
|
29
30
|
type: String
|
|
30
31
|
}
|
|
31
32
|
},
|
|
32
33
|
|
|
34
|
+
data () {
|
|
35
|
+
return {
|
|
36
|
+
isLoading: false
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
|
|
33
40
|
methods: {
|
|
34
41
|
async copy () {
|
|
42
|
+
this.isLoading = true
|
|
43
|
+
|
|
35
44
|
try {
|
|
36
|
-
await copyToClipboard(this.
|
|
37
|
-
|
|
45
|
+
await copyToClipboard(this.text)
|
|
46
|
+
this.$qas.success('Copiado!', this.text)
|
|
38
47
|
} catch (error) {
|
|
39
|
-
|
|
48
|
+
this.$qas.error('Não foi possível copiar.', this.text)
|
|
49
|
+
} finally {
|
|
50
|
+
setTimeout(() => { this.isLoading = false }, 500)
|
|
40
51
|
}
|
|
41
52
|
}
|
|
42
53
|
}
|
|
@@ -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,8 @@ import { date } from 'quasar'
|
|
|
23
23
|
import { date as dateFn } from '../../helpers/filters'
|
|
24
24
|
|
|
25
25
|
export default {
|
|
26
|
+
name: 'QasDateTimeInput',
|
|
27
|
+
|
|
26
28
|
props: {
|
|
27
29
|
dateMask: {
|
|
28
30
|
default: 'DD/MM/YYYY',
|
|
@@ -33,7 +35,7 @@ export default {
|
|
|
33
35
|
type: Boolean
|
|
34
36
|
},
|
|
35
37
|
|
|
36
|
-
|
|
38
|
+
dateProps: {
|
|
37
39
|
default: () => ({}),
|
|
38
40
|
type: Object
|
|
39
41
|
},
|
|
@@ -51,17 +53,19 @@ export default {
|
|
|
51
53
|
type: Boolean
|
|
52
54
|
},
|
|
53
55
|
|
|
54
|
-
|
|
56
|
+
timeProps: {
|
|
55
57
|
default: () => ({}),
|
|
56
58
|
type: Object
|
|
57
59
|
},
|
|
58
60
|
|
|
59
|
-
|
|
61
|
+
modelValue: {
|
|
60
62
|
default: '',
|
|
61
63
|
type: String
|
|
62
64
|
}
|
|
63
65
|
},
|
|
64
66
|
|
|
67
|
+
emits: ['update:modelValue'],
|
|
68
|
+
|
|
65
69
|
data () {
|
|
66
70
|
return {
|
|
67
71
|
currentValue: '',
|
|
@@ -71,21 +75,11 @@ export default {
|
|
|
71
75
|
|
|
72
76
|
computed: {
|
|
73
77
|
attributes () {
|
|
74
|
-
const {
|
|
78
|
+
const { modelValue, ...attributes } = this.$attrs
|
|
75
79
|
|
|
76
80
|
return {
|
|
77
81
|
...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
|
|
82
|
+
mask: this.mask
|
|
89
83
|
}
|
|
90
84
|
},
|
|
91
85
|
|
|
@@ -121,11 +115,7 @@ export default {
|
|
|
121
115
|
},
|
|
122
116
|
|
|
123
117
|
created () {
|
|
124
|
-
this.currentValue = this.toMask(this.
|
|
125
|
-
},
|
|
126
|
-
|
|
127
|
-
mounted () {
|
|
128
|
-
this.$emit('mounted', this)
|
|
118
|
+
this.currentValue = this.toMask(this.modelValue)
|
|
129
119
|
},
|
|
130
120
|
|
|
131
121
|
methods: {
|
|
@@ -137,13 +127,13 @@ export default {
|
|
|
137
127
|
this.inputElement.focus()
|
|
138
128
|
},
|
|
139
129
|
|
|
140
|
-
|
|
130
|
+
updateModelValue (value) {
|
|
141
131
|
this.currentValue = value
|
|
142
132
|
const valueLength = value.replace(/_/g, '').length
|
|
143
133
|
|
|
144
134
|
if (value === '' || valueLength === this.mask.length) {
|
|
145
135
|
this.lastValue = this.timeOnly ? value : this.toISOString(value)
|
|
146
|
-
this.$emit('
|
|
136
|
+
this.$emit('update:modelValue', this.lastValue)
|
|
147
137
|
}
|
|
148
138
|
|
|
149
139
|
if (this.dateOnly) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<component :is="tag"
|
|
2
|
+
<component :is="tag" @click="openConfirmDialog">
|
|
3
3
|
<slot />
|
|
4
|
-
<qas-dialog v-model="showDialog" v-bind="
|
|
4
|
+
<qas-dialog v-model="showDialog" v-bind="defaultDialogProps" />
|
|
5
5
|
</component>
|
|
6
6
|
</template>
|
|
7
7
|
|
|
@@ -9,10 +9,12 @@
|
|
|
9
9
|
import { Loading } from 'quasar'
|
|
10
10
|
import { NotifyError, NotifySuccess } from '../../plugins'
|
|
11
11
|
|
|
12
|
-
import QasBtn from '../btn/QasBtn'
|
|
13
|
-
import QasDialog from '../dialog/QasDialog'
|
|
12
|
+
import QasBtn from '../btn/QasBtn.vue'
|
|
13
|
+
import QasDialog from '../dialog/QasDialog.vue'
|
|
14
14
|
|
|
15
15
|
export default {
|
|
16
|
+
name: 'QasDelete',
|
|
17
|
+
|
|
16
18
|
components: {
|
|
17
19
|
QasBtn,
|
|
18
20
|
QasDialog
|
|
@@ -24,7 +26,7 @@ export default {
|
|
|
24
26
|
type: [Number, String]
|
|
25
27
|
},
|
|
26
28
|
|
|
27
|
-
|
|
29
|
+
dialogProps: {
|
|
28
30
|
default: () => ({}),
|
|
29
31
|
type: Object
|
|
30
32
|
},
|
|
@@ -45,6 +47,8 @@ export default {
|
|
|
45
47
|
}
|
|
46
48
|
},
|
|
47
49
|
|
|
50
|
+
emits: ['success', 'error'],
|
|
51
|
+
|
|
48
52
|
data () {
|
|
49
53
|
return {
|
|
50
54
|
showDialog: false
|
|
@@ -52,7 +56,7 @@ export default {
|
|
|
52
56
|
},
|
|
53
57
|
|
|
54
58
|
computed: {
|
|
55
|
-
|
|
59
|
+
defaultDialogProps () {
|
|
56
60
|
return {
|
|
57
61
|
card: {
|
|
58
62
|
title: 'Confirmar',
|
|
@@ -60,26 +64,20 @@ export default {
|
|
|
60
64
|
},
|
|
61
65
|
|
|
62
66
|
ok: {
|
|
63
|
-
|
|
64
|
-
props: { label: 'Excluir' }
|
|
67
|
+
props: { label: 'Excluir', onClick: this.destroy }
|
|
65
68
|
},
|
|
66
69
|
|
|
67
|
-
...this.
|
|
70
|
+
...this.dialogProps
|
|
68
71
|
}
|
|
69
72
|
},
|
|
70
73
|
|
|
71
|
-
events () {
|
|
72
|
-
const { click, ...events } = this.$listeners
|
|
73
|
-
return { click: this.confirm, ...events }
|
|
74
|
-
},
|
|
75
|
-
|
|
76
74
|
id () {
|
|
77
75
|
return this.customId || this.$route.params.id
|
|
78
76
|
}
|
|
79
77
|
},
|
|
80
78
|
|
|
81
79
|
methods: {
|
|
82
|
-
|
|
80
|
+
openConfirmDialog () {
|
|
83
81
|
this.showDialog = true
|
|
84
82
|
},
|
|
85
83
|
|
|
@@ -89,6 +87,7 @@ export default {
|
|
|
89
87
|
try {
|
|
90
88
|
await this.$store.dispatch(`${this.entity}/destroy`, { id: this.id, url: this.url })
|
|
91
89
|
NotifySuccess('Item deletado com sucesso!')
|
|
90
|
+
this.createDeleteSuccessEvent()
|
|
92
91
|
this.$emit('success')
|
|
93
92
|
} catch (error) {
|
|
94
93
|
NotifyError('Ops! Não foi possível deletar o item.')
|
|
@@ -96,6 +95,20 @@ export default {
|
|
|
96
95
|
} finally {
|
|
97
96
|
Loading.hide()
|
|
98
97
|
}
|
|
98
|
+
},
|
|
99
|
+
|
|
100
|
+
createDeleteSuccessEvent () {
|
|
101
|
+
const event = new CustomEvent('delete-success', {
|
|
102
|
+
bubbles: false,
|
|
103
|
+
cancelable: false,
|
|
104
|
+
detail: {
|
|
105
|
+
entity: this.entity,
|
|
106
|
+
url: this.url,
|
|
107
|
+
id: this.id
|
|
108
|
+
}
|
|
109
|
+
})
|
|
110
|
+
|
|
111
|
+
window.dispatchEvent(event)
|
|
99
112
|
}
|
|
100
113
|
}
|
|
101
114
|
}
|