@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,23 +1,23 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<component :is="
|
|
3
|
-
<header v-if="
|
|
4
|
-
<slot :errors="
|
|
2
|
+
<component :is="mx_componentTag">
|
|
3
|
+
<header v-if="mx_hasHeaderSlot">
|
|
4
|
+
<slot :errors="mx_errors" :fields="mx_fields" :metadata="mx_metadata" name="header" :result="result" />
|
|
5
5
|
</header>
|
|
6
6
|
|
|
7
7
|
<template v-if="hasResult">
|
|
8
|
-
<slot :errors="
|
|
8
|
+
<slot :errors="mx_errors" :fields="mx_fields" :metadata="mx_metadata" :result="result" />
|
|
9
9
|
</template>
|
|
10
10
|
|
|
11
|
-
<div v-else-if="!
|
|
11
|
+
<div v-else-if="!mx_isFetching" class="q-my-xl text-center">
|
|
12
12
|
<q-icon class="q-mb-sm text-center" color="grey-6" name="o_search" size="38px" />
|
|
13
13
|
<div class="text-grey-6">Nenhum item encontrado.</div>
|
|
14
14
|
</div>
|
|
15
15
|
|
|
16
|
-
<footer v-if="
|
|
16
|
+
<footer v-if="mx_hasFooterSlot">
|
|
17
17
|
<slot name="footer" />
|
|
18
18
|
</footer>
|
|
19
19
|
|
|
20
|
-
<q-inner-loading :showing="
|
|
20
|
+
<q-inner-loading :showing="mx_isFetching">
|
|
21
21
|
<q-spinner color="grey" size="3em" />
|
|
22
22
|
</q-inner-loading>
|
|
23
23
|
</component>
|
|
@@ -27,6 +27,8 @@
|
|
|
27
27
|
import viewMixin from '../../mixins/view'
|
|
28
28
|
|
|
29
29
|
export default {
|
|
30
|
+
name: 'QasSingleView',
|
|
31
|
+
|
|
30
32
|
mixins: [viewMixin],
|
|
31
33
|
|
|
32
34
|
props: {
|
|
@@ -35,12 +37,18 @@ export default {
|
|
|
35
37
|
type: [Number, String]
|
|
36
38
|
},
|
|
37
39
|
|
|
38
|
-
|
|
40
|
+
modelValue: {
|
|
39
41
|
default: () => ({}),
|
|
40
42
|
type: Object
|
|
41
43
|
}
|
|
42
44
|
},
|
|
43
45
|
|
|
46
|
+
emits: [
|
|
47
|
+
'update:modelValue',
|
|
48
|
+
'fetch-success',
|
|
49
|
+
'fetch-error'
|
|
50
|
+
],
|
|
51
|
+
|
|
44
52
|
computed: {
|
|
45
53
|
hasResult () {
|
|
46
54
|
return !!this.result
|
|
@@ -56,12 +64,12 @@ export default {
|
|
|
56
64
|
},
|
|
57
65
|
|
|
58
66
|
watch: {
|
|
59
|
-
$route () {
|
|
60
|
-
this.fetchSingle()
|
|
67
|
+
$route (to, from) {
|
|
68
|
+
to.name === from.name && this.fetchSingle()
|
|
61
69
|
},
|
|
62
70
|
|
|
63
71
|
result (value) {
|
|
64
|
-
this.$emit('
|
|
72
|
+
this.$emit('update:modelValue', value)
|
|
65
73
|
}
|
|
66
74
|
},
|
|
67
75
|
|
|
@@ -71,22 +79,28 @@ export default {
|
|
|
71
79
|
|
|
72
80
|
methods: {
|
|
73
81
|
async fetchSingle () {
|
|
74
|
-
this.
|
|
82
|
+
this.mx_isFetching = true
|
|
75
83
|
|
|
76
84
|
try {
|
|
77
85
|
const response = await this.$store.dispatch(`${this.entity}/fetchSingle`, { id: this.id, url: this.url })
|
|
78
86
|
const { errors, fields, metadata } = response.data
|
|
79
87
|
|
|
80
|
-
this.
|
|
81
|
-
this.
|
|
82
|
-
this.
|
|
88
|
+
this.mx_setErrors(errors)
|
|
89
|
+
this.mx_setFields(fields)
|
|
90
|
+
this.mx_setMetadata(metadata)
|
|
91
|
+
|
|
92
|
+
this.mx_updateModels({
|
|
93
|
+
errors: errors,
|
|
94
|
+
fields: this.mx_fields,
|
|
95
|
+
metadata: metadata
|
|
96
|
+
})
|
|
83
97
|
|
|
84
98
|
this.$emit('fetch-success', response)
|
|
85
99
|
} catch (error) {
|
|
86
|
-
this.
|
|
100
|
+
this.mx_fetchError(error)
|
|
87
101
|
this.$emit('fetch-error', error)
|
|
88
102
|
} finally {
|
|
89
|
-
this.
|
|
103
|
+
this.mx_isFetching = false
|
|
90
104
|
}
|
|
91
105
|
}
|
|
92
106
|
}
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<component :is="tag" ref="
|
|
3
|
-
<slot
|
|
2
|
+
<component :is="tag" ref="sortableItems">
|
|
3
|
+
<slot />
|
|
4
4
|
</component>
|
|
5
5
|
</template>
|
|
6
6
|
|
|
7
7
|
<script>
|
|
8
|
-
import {
|
|
9
|
-
import { Loading } from 'quasar'
|
|
10
|
-
import { NotifyError } from '../../plugins'
|
|
8
|
+
import { Loading, extend } from 'quasar'
|
|
11
9
|
import Sortable from 'sortablejs'
|
|
12
10
|
|
|
13
|
-
|
|
11
|
+
import { NotifyError } from '../../plugins'
|
|
14
12
|
|
|
15
13
|
export default {
|
|
14
|
+
name: 'QasSortable',
|
|
15
|
+
|
|
16
16
|
props: {
|
|
17
17
|
entity: {
|
|
18
18
|
default: '',
|
|
19
19
|
type: String
|
|
20
20
|
},
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
sortableOptions: {
|
|
23
23
|
default: () => ({ animation: 500 }),
|
|
24
24
|
type: Object
|
|
25
25
|
},
|
|
@@ -37,39 +37,51 @@ export default {
|
|
|
37
37
|
url: {
|
|
38
38
|
default: '',
|
|
39
39
|
type: String
|
|
40
|
+
},
|
|
41
|
+
|
|
42
|
+
sorted: {
|
|
43
|
+
default: () => [],
|
|
44
|
+
type: Array
|
|
40
45
|
}
|
|
41
46
|
},
|
|
42
47
|
|
|
48
|
+
emits: [
|
|
49
|
+
'update:sorted',
|
|
50
|
+
'sort',
|
|
51
|
+
'success'
|
|
52
|
+
],
|
|
53
|
+
|
|
43
54
|
data () {
|
|
44
55
|
return {
|
|
45
|
-
|
|
56
|
+
sortable: null,
|
|
57
|
+
sortedList: null
|
|
46
58
|
}
|
|
47
59
|
},
|
|
48
60
|
|
|
49
61
|
computed: {
|
|
50
62
|
identifiers () {
|
|
51
|
-
return this.
|
|
63
|
+
return this.sortedList.map(({ id }) => id)
|
|
52
64
|
}
|
|
53
65
|
},
|
|
54
66
|
|
|
55
67
|
watch: {
|
|
56
|
-
|
|
57
|
-
sortable.options = { ...sortable.options, ...value }
|
|
68
|
+
sortableOptions (value) {
|
|
69
|
+
this.sortable.options = { ...this.sortable.options, ...value }
|
|
58
70
|
},
|
|
59
71
|
|
|
60
72
|
results (value) {
|
|
61
|
-
this.
|
|
62
|
-
sortable.sort(sortable.toArray())
|
|
73
|
+
this.setSortedValue(value)
|
|
74
|
+
this.sortable.sort(this.sortable.toArray())
|
|
63
75
|
}
|
|
64
76
|
},
|
|
65
77
|
|
|
66
78
|
created () {
|
|
67
|
-
this.
|
|
79
|
+
this.setSortedValue()
|
|
68
80
|
},
|
|
69
81
|
|
|
70
|
-
mounted () {
|
|
71
|
-
sortable = new Sortable(this.$refs.
|
|
72
|
-
...this.
|
|
82
|
+
async mounted () {
|
|
83
|
+
this.sortable = new Sortable(this.$refs.sortableItems, {
|
|
84
|
+
...this.sortableOptions,
|
|
73
85
|
|
|
74
86
|
onUpdate: event => {
|
|
75
87
|
this.updateOrder(event)
|
|
@@ -78,18 +90,19 @@ export default {
|
|
|
78
90
|
})
|
|
79
91
|
},
|
|
80
92
|
|
|
81
|
-
|
|
82
|
-
sortable.destroy()
|
|
93
|
+
unmounted () {
|
|
94
|
+
this.sortable.destroy()
|
|
83
95
|
},
|
|
84
96
|
|
|
85
97
|
methods: {
|
|
86
|
-
|
|
98
|
+
setError (error) {
|
|
87
99
|
const { response } = error
|
|
88
|
-
const exception =
|
|
100
|
+
const exception = response?.data?.exception || error.message
|
|
89
101
|
|
|
90
102
|
NotifyError('Ops! Erro ao ordernar itens.', exception)
|
|
91
103
|
},
|
|
92
104
|
|
|
105
|
+
// TODO precisa testar este metodo quando tivermos uma API para teste.
|
|
93
106
|
async replace () {
|
|
94
107
|
Loading.show()
|
|
95
108
|
|
|
@@ -101,21 +114,26 @@ export default {
|
|
|
101
114
|
|
|
102
115
|
this.$emit('success', response)
|
|
103
116
|
} catch (error) {
|
|
104
|
-
this.
|
|
117
|
+
this.setError(error)
|
|
105
118
|
} finally {
|
|
106
119
|
Loading.hide()
|
|
107
120
|
}
|
|
108
121
|
},
|
|
109
122
|
|
|
110
|
-
updateOrder ({
|
|
111
|
-
const deleted = this.
|
|
112
|
-
this.
|
|
123
|
+
updateOrder ({ newIndex, oldIndex }) {
|
|
124
|
+
const deleted = this.sortedList.splice(oldIndex, 1)
|
|
125
|
+
this.sortedList.splice(newIndex, 0, deleted[0])
|
|
113
126
|
|
|
114
127
|
this.replace()
|
|
115
128
|
},
|
|
116
129
|
|
|
117
|
-
|
|
118
|
-
this.
|
|
130
|
+
setSortedValue (value) {
|
|
131
|
+
this.sortedList = extend(true, [], value || this.results)
|
|
132
|
+
this.updateSortedModel()
|
|
133
|
+
},
|
|
134
|
+
|
|
135
|
+
updateSortedModel () {
|
|
136
|
+
return this.$emit('update:sorted', this.sortedList)
|
|
119
137
|
}
|
|
120
138
|
}
|
|
121
139
|
}
|
|
@@ -1,22 +1,27 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
<
|
|
4
|
-
<
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
<
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
2
|
+
<qas-box class="q-mb-xl q-px-lg q-py-md">
|
|
3
|
+
<q-table ref="table" class="bg-transparent qas-table-generator" :class="tableClass" v-bind="attributes">
|
|
4
|
+
<template v-for="(_, name) in $slots" #[name]="context">
|
|
5
|
+
<slot v-if="hasBodySlot" name="body" :props="context" />
|
|
6
|
+
|
|
7
|
+
<q-td v-else :key="name">
|
|
8
|
+
<slot :name="name" v-bind="context || {}" />
|
|
9
|
+
</q-td>
|
|
10
|
+
</template>
|
|
11
|
+
</q-table>
|
|
12
|
+
</qas-box>
|
|
11
13
|
</template>
|
|
12
14
|
|
|
13
15
|
<script>
|
|
14
16
|
import { extend } from 'quasar'
|
|
15
17
|
import { humanize } from '../../helpers/filters'
|
|
16
|
-
import
|
|
18
|
+
import { scrollOnGrab } from '../../helpers'
|
|
19
|
+
import screenMixin from '../../mixins/screen'
|
|
17
20
|
|
|
18
21
|
export default {
|
|
19
|
-
|
|
22
|
+
name: 'QasTableGenerator',
|
|
23
|
+
|
|
24
|
+
mixins: [screenMixin],
|
|
20
25
|
|
|
21
26
|
props: {
|
|
22
27
|
columns: {
|
|
@@ -29,11 +34,6 @@ export default {
|
|
|
29
34
|
type: [Array, Object]
|
|
30
35
|
},
|
|
31
36
|
|
|
32
|
-
order: {
|
|
33
|
-
default: () => [],
|
|
34
|
-
type: Array
|
|
35
|
-
},
|
|
36
|
-
|
|
37
37
|
results: {
|
|
38
38
|
default: () => [],
|
|
39
39
|
required: true,
|
|
@@ -43,6 +43,23 @@ export default {
|
|
|
43
43
|
rowKey: {
|
|
44
44
|
default: 'name',
|
|
45
45
|
type: String
|
|
46
|
+
},
|
|
47
|
+
|
|
48
|
+
emptyResultText: {
|
|
49
|
+
default: '-',
|
|
50
|
+
type: String
|
|
51
|
+
},
|
|
52
|
+
|
|
53
|
+
useScrollOnGrab: {
|
|
54
|
+
type: Boolean,
|
|
55
|
+
default: true
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
|
|
59
|
+
data () {
|
|
60
|
+
return {
|
|
61
|
+
scrollableElement: null,
|
|
62
|
+
scrollOnGrab: {}
|
|
46
63
|
}
|
|
47
64
|
},
|
|
48
65
|
|
|
@@ -50,7 +67,7 @@ export default {
|
|
|
50
67
|
attributes () {
|
|
51
68
|
const attributes = {
|
|
52
69
|
columns: this.columnsByFields,
|
|
53
|
-
|
|
70
|
+
rows: this.resultsByFields,
|
|
54
71
|
flat: true,
|
|
55
72
|
hideBottom: true,
|
|
56
73
|
pagination: { rowsPerPage: 0 },
|
|
@@ -101,7 +118,7 @@ export default {
|
|
|
101
118
|
},
|
|
102
119
|
|
|
103
120
|
hasBodySlot () {
|
|
104
|
-
return !!(this.$slots.body
|
|
121
|
+
return !!(this.$slots.body)
|
|
105
122
|
},
|
|
106
123
|
|
|
107
124
|
hasFields () {
|
|
@@ -114,7 +131,7 @@ export default {
|
|
|
114
131
|
return results.map((result, index) => {
|
|
115
132
|
for (const key in result) {
|
|
116
133
|
result.default = this.results[index]
|
|
117
|
-
result[key] = humanize(this.fields[key], result[key])
|
|
134
|
+
result[key] = humanize(this.fields[key], result[key]) || this.emptyResultText
|
|
118
135
|
}
|
|
119
136
|
|
|
120
137
|
return result
|
|
@@ -125,15 +142,71 @@ export default {
|
|
|
125
142
|
return this.results.length
|
|
126
143
|
},
|
|
127
144
|
|
|
128
|
-
|
|
129
|
-
return this
|
|
145
|
+
tableClass () {
|
|
146
|
+
return this.mx_isSmall && 'qas-table-generator--mobile'
|
|
147
|
+
},
|
|
148
|
+
|
|
149
|
+
hasScrollOnGrab () {
|
|
150
|
+
return !!Object.keys(this.scrollOnGrab).length
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
|
|
154
|
+
mounted () {
|
|
155
|
+
if (this.useScrollOnGrab) return
|
|
156
|
+
|
|
157
|
+
this.handleScrollOnGrab()
|
|
158
|
+
window.addEventListener('resize', this.handleScrollOnGrab)
|
|
159
|
+
},
|
|
160
|
+
|
|
161
|
+
onUnmounted () {
|
|
162
|
+
this.hasScrollOnGrab && this.scrollOnGrab.destroyEvents()
|
|
163
|
+
|
|
164
|
+
window.removeEventListener('resize', this.handleScrollOnGrab)
|
|
165
|
+
},
|
|
166
|
+
|
|
167
|
+
methods: {
|
|
168
|
+
setScrollOnGrab () {
|
|
169
|
+
if (this.hasScrollOnGrab) return
|
|
170
|
+
|
|
171
|
+
const element = this.$refs.table.$el.querySelector('.q-table__middle.scroll')
|
|
172
|
+
|
|
173
|
+
this.scrollOnGrab = scrollOnGrab(element)
|
|
174
|
+
},
|
|
175
|
+
|
|
176
|
+
getTableElement () {
|
|
177
|
+
return this.$refs.table.$el.querySelector('table')
|
|
178
|
+
},
|
|
179
|
+
|
|
180
|
+
getFullTableWidth () {
|
|
181
|
+
const tableElemet = this.getTableElement()
|
|
182
|
+
|
|
183
|
+
return tableElemet.getBoundingClientRect().width
|
|
184
|
+
},
|
|
185
|
+
|
|
186
|
+
getContainerTableWidth () {
|
|
187
|
+
const containerElement = this.$refs.table.$el.querySelector('.q-table__middle')
|
|
188
|
+
|
|
189
|
+
return containerElement.getBoundingClientRect().width
|
|
190
|
+
},
|
|
191
|
+
|
|
192
|
+
handleScrollOnGrab () {
|
|
193
|
+
const fullTableWidth = this.getFullTableWidth()
|
|
194
|
+
const containerTableWidth = this.getContainerTableWidth()
|
|
195
|
+
|
|
196
|
+
if (fullTableWidth > containerTableWidth) {
|
|
197
|
+
this.setScrollOnGrab()
|
|
198
|
+
} else if (this.hasScrollOnGrab) {
|
|
199
|
+
this.scrollOnGrab.destroyEvents()
|
|
200
|
+
this.scrollOnGrab.element.style.cursor = 'auto'
|
|
201
|
+
this.scrollOnGrab = {}
|
|
202
|
+
}
|
|
130
203
|
}
|
|
131
204
|
}
|
|
132
205
|
}
|
|
133
206
|
</script>
|
|
134
207
|
|
|
135
208
|
<style lang="scss">
|
|
136
|
-
.qas-table {
|
|
209
|
+
.qas-table-generator {
|
|
137
210
|
.q-table th {
|
|
138
211
|
font-weight: bold;
|
|
139
212
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<q-tabs v-model="
|
|
2
|
+
<q-tabs v-model="model" :active-color="activeColor" :indicator-color="indicatorColor" outside-arrows>
|
|
3
3
|
<slot v-for="(tab, key) in formattedTabs" :item="tab" :name="`tab-${tab.value}`">
|
|
4
|
-
<q-tab :key="key" v-bind="tab" :class="
|
|
4
|
+
<q-tab :key="key" v-bind="tab" :class="tabClass" :label="tab.label" :name="key">
|
|
5
5
|
<slot :item="tab" :name="`tab-after-${tab.value}`">
|
|
6
|
-
<q-badge v-if="counters[key]"
|
|
6
|
+
<q-badge v-if="counters[key]" :label="counters[key]" v-bind="defaultCounterProps" />
|
|
7
7
|
</slot>
|
|
8
8
|
</q-tab>
|
|
9
9
|
</slot>
|
|
@@ -14,20 +14,17 @@
|
|
|
14
14
|
import { extend } from 'quasar'
|
|
15
15
|
|
|
16
16
|
export default {
|
|
17
|
+
name: 'QasTabsGenerator',
|
|
18
|
+
|
|
17
19
|
props: {
|
|
18
20
|
activeColor: {
|
|
19
21
|
default: 'primary',
|
|
20
22
|
type: String
|
|
21
23
|
},
|
|
22
24
|
|
|
23
|
-
|
|
24
|
-
default:
|
|
25
|
-
type:
|
|
26
|
-
},
|
|
27
|
-
|
|
28
|
-
colorClass: {
|
|
29
|
-
default: 'text-primary',
|
|
30
|
-
type: String
|
|
25
|
+
counterProps: {
|
|
26
|
+
default: () => ({}),
|
|
27
|
+
type: Object
|
|
31
28
|
},
|
|
32
29
|
|
|
33
30
|
counters: {
|
|
@@ -40,26 +37,31 @@ export default {
|
|
|
40
37
|
type: String
|
|
41
38
|
},
|
|
42
39
|
|
|
43
|
-
|
|
44
|
-
default:
|
|
45
|
-
type:
|
|
46
|
-
required: true
|
|
40
|
+
modelValue: {
|
|
41
|
+
default: '',
|
|
42
|
+
type: String
|
|
47
43
|
},
|
|
48
44
|
|
|
49
|
-
|
|
50
|
-
default: '',
|
|
45
|
+
tabClass: {
|
|
46
|
+
default: 'text-primary',
|
|
51
47
|
type: String
|
|
48
|
+
},
|
|
49
|
+
|
|
50
|
+
tabs: {
|
|
51
|
+
default: () => ({}),
|
|
52
|
+
required: true,
|
|
53
|
+
type: Object
|
|
52
54
|
}
|
|
53
55
|
},
|
|
54
56
|
|
|
55
|
-
|
|
56
|
-
currentTab: {
|
|
57
|
-
get () {
|
|
58
|
-
return this.value
|
|
59
|
-
},
|
|
57
|
+
emits: ['update:modelValue'],
|
|
60
58
|
|
|
61
|
-
|
|
62
|
-
|
|
59
|
+
computed: {
|
|
60
|
+
defaultCounterProps () {
|
|
61
|
+
return {
|
|
62
|
+
color: 'negative',
|
|
63
|
+
floating: true,
|
|
64
|
+
...this.counterProps
|
|
63
65
|
}
|
|
64
66
|
},
|
|
65
67
|
|
|
@@ -73,6 +75,16 @@ export default {
|
|
|
73
75
|
}
|
|
74
76
|
|
|
75
77
|
return tabs
|
|
78
|
+
},
|
|
79
|
+
|
|
80
|
+
model: {
|
|
81
|
+
get () {
|
|
82
|
+
return this.modelValue
|
|
83
|
+
},
|
|
84
|
+
|
|
85
|
+
set (value) {
|
|
86
|
+
this.$emit('update:modelValue', value)
|
|
87
|
+
}
|
|
76
88
|
}
|
|
77
89
|
}
|
|
78
90
|
}
|
|
@@ -4,15 +4,10 @@
|
|
|
4
4
|
<div ref="truncate" :class="truncateTextClass">
|
|
5
5
|
<slot>{{ text }}</slot>
|
|
6
6
|
</div>
|
|
7
|
-
<div v-if="
|
|
7
|
+
<div v-if="isTruncated" class="cursor-pointer text-primary" @click="toggleDialog">{{ seeMoreLabel }}</div>
|
|
8
8
|
</div>
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
<div class="row" :class="headerClass">
|
|
12
|
-
<div v-if="dialogTitle" class="text-bold text-subtitle1">{{ dialogTitle }}</div>
|
|
13
|
-
<qas-btn v-close-popup dense flat icon="close" rounded />
|
|
14
|
-
</div>
|
|
15
|
-
</template>
|
|
9
|
+
|
|
10
|
+
<qas-dialog v-model="showDialog" v-bind="defaultDialogProps">
|
|
16
11
|
<template #description>
|
|
17
12
|
<slot>
|
|
18
13
|
<div>{{ text }}</div>
|
|
@@ -23,20 +18,20 @@
|
|
|
23
18
|
</template>
|
|
24
19
|
|
|
25
20
|
<script>
|
|
26
|
-
import
|
|
27
|
-
import QasDialog from '../dialog/QasDialog'
|
|
28
|
-
import QasBtn from '../btn/QasBtn'
|
|
21
|
+
import screenMixin from '../../mixins/screen'
|
|
22
|
+
import QasDialog from '../dialog/QasDialog.vue'
|
|
29
23
|
|
|
30
24
|
export default {
|
|
25
|
+
name: 'QasTextTruncate',
|
|
26
|
+
|
|
31
27
|
components: {
|
|
32
|
-
QasDialog
|
|
33
|
-
QasBtn
|
|
28
|
+
QasDialog
|
|
34
29
|
},
|
|
35
30
|
|
|
36
|
-
mixins: [
|
|
31
|
+
mixins: [screenMixin],
|
|
37
32
|
|
|
38
33
|
props: {
|
|
39
|
-
|
|
34
|
+
dialogProps: {
|
|
40
35
|
type: Object,
|
|
41
36
|
default: () => ({
|
|
42
37
|
persistent: false
|
|
@@ -74,15 +69,28 @@ export default {
|
|
|
74
69
|
|
|
75
70
|
computed: {
|
|
76
71
|
truncateTextClass () {
|
|
77
|
-
return (this.
|
|
72
|
+
return (this.isTruncated || this.mx_isSmall) && 'ellipsis q-pr-sm'
|
|
78
73
|
},
|
|
79
74
|
|
|
80
|
-
|
|
75
|
+
isTruncated () {
|
|
81
76
|
return this.textWidth > this.maxPossibleWidth
|
|
82
77
|
},
|
|
83
78
|
|
|
84
79
|
headerClass () {
|
|
85
80
|
return this.dialogTitle ? 'justify-between' : 'justify-end'
|
|
81
|
+
},
|
|
82
|
+
|
|
83
|
+
defaultDialogProps () {
|
|
84
|
+
return {
|
|
85
|
+
cancel: false,
|
|
86
|
+
ok: false,
|
|
87
|
+
useCloseIcon: true,
|
|
88
|
+
...this.dialogProps,
|
|
89
|
+
card: {
|
|
90
|
+
title: this.dialogTitle,
|
|
91
|
+
description: this.text
|
|
92
|
+
}
|
|
93
|
+
}
|
|
86
94
|
}
|
|
87
95
|
},
|
|
88
96
|
|