@bildvitta/quasar-ui-asteroid 3.14.0-beta.0 → 3.14.0-beta.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/package.json +1 -1
- package/src/components/actions-menu/QasActionsMenu.vue +16 -14
- package/src/components/alert/QasAlert.vue +1 -1
- package/src/components/app-bar/QasAppBar.vue +5 -5
- package/src/components/app-menu/QasAppMenu.vue +8 -8
- package/src/components/app-menu/private/PvAppMenuDropdown.vue +1 -1
- package/src/components/app-user/QasAppUser.vue +10 -10
- package/src/components/avatar/QasAvatar.vue +2 -2
- package/src/components/breakline/QasBreakline.vue +5 -6
- package/src/components/btn-dropdown/QasBtnDropdown.vue +74 -95
- package/src/components/card/QasCard.vue +55 -73
- package/src/components/chart-view/QasChartView.vue +37 -9
- package/src/components/chart-view/QasChartView.yml +6 -0
- package/src/components/checkbox-group/QasCheckboxGroup.vue +81 -92
- package/src/components/copy/QasCopy.vue +20 -27
- package/src/components/date/QasDate.vue +316 -355
- package/src/components/date/QasDate.yml +0 -5
- package/src/components/date/enums/DateMaskOptions.js +6 -0
- package/src/components/date-time-input/QasDateTimeInput.vue +198 -209
- package/src/components/debugger/QasDebugger.vue +20 -12
- package/src/components/delete/QasDelete.vue +70 -80
- package/src/components/dialog/QasDialog.vue +7 -7
- package/src/components/dialog/composables/use-cancel.js +3 -3
- package/src/components/dialog/composables/use-dynamic-components.js +4 -4
- package/src/components/dialog/composables/use-ok.js +3 -3
- package/src/components/dialog-router/QasDialogRouter.vue +68 -67
- package/src/components/empty-result-text/QasEmptyResultText.vue +8 -10
- package/src/components/form-generator/QasFormGenerator.vue +2 -2
- package/src/components/gallery/QasGallery.vue +175 -196
- package/src/components/gallery/composables/use-delete.js +54 -0
- package/src/components/gallery/private/PvGalleryCarouselDialog.vue +48 -55
- package/src/components/gallery/private/PvGalleryDeleteDialog.vue +41 -50
- package/src/components/gallery-card/QasGalleryCard.vue +90 -103
- package/src/components/grid-generator/QasGridGenerator.vue +2 -2
- package/src/components/header-actions/QasHeaderActions.vue +35 -50
- package/src/components/header-actions/QasHeaderActions.yml +1 -1
- package/src/components/infinite-scroll/QasInfiniteScroll.vue +2 -2
- package/src/components/label/QasLabel.vue +42 -54
- package/src/components/list-items/QasListItems.vue +32 -41
- package/src/components/map/QasMap.vue +44 -46
- package/src/components/numeric-input/QasNumericInput.vue +2 -2
- package/src/components/page-header/QasPageHeader.vue +74 -87
- package/src/components/pagination/QasPagination.vue +21 -21
- package/src/components/select-list-dialog/QasSelectListDialog.vue +4 -2
- package/src/components/tabs-generator/QasTabsGenerator.vue +55 -63
- package/src/components/timeline/QasTimeline.vue +1 -1
- package/src/components/uploader/private/PvUploaderGalleryCard.vue +1 -1
- package/src/components/whatsapp-link/QasWhatsappLink.vue +34 -0
- package/src/components/whatsapp-link/QasWhatsappLink.yml +18 -0
- package/src/composables/private/use-generator.js +0 -8
- package/src/vue-plugin.js +7 -1
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<qas-box class="qas-list-items">
|
|
3
3
|
<q-list separator>
|
|
4
|
-
<q-item v-for="(item, index) in list" :key="index" v-ripple :clickable="useClickableItem" @click="onClick({ item, index }, true)">
|
|
4
|
+
<q-item v-for="(item, index) in props.list" :key="index" v-ripple :clickable="props.useClickableItem" @click="onClick({ item, index }, true)">
|
|
5
5
|
<slot :index="index" :item="item" name="item">
|
|
6
6
|
<q-item-section>
|
|
7
7
|
<slot :index="index" :item="item" name="item-section" />
|
|
8
8
|
</q-item-section>
|
|
9
9
|
|
|
10
|
-
<q-item-section v-if="useSectionActions" side>
|
|
10
|
+
<q-item-section v-if="props.useSectionActions" side>
|
|
11
11
|
<slot :index="index" :item="item" name="item-section-side">
|
|
12
|
-
<qas-btn color="primary" :icon="icon" variant="tertiary" @click="onClick({ item, index })" />
|
|
12
|
+
<qas-btn color="primary" :icon="props.icon" variant="tertiary" @click="onClick({ item, index })" />
|
|
13
13
|
</slot>
|
|
14
14
|
</q-item-section>
|
|
15
15
|
</slot>
|
|
@@ -18,54 +18,45 @@
|
|
|
18
18
|
</qas-box>
|
|
19
19
|
</template>
|
|
20
20
|
|
|
21
|
-
<script>
|
|
22
|
-
import QasBtn from '../btn/QasBtn.vue'
|
|
21
|
+
<script setup>
|
|
23
22
|
import QasBox from '../box/QasBox.vue'
|
|
23
|
+
import QasBtn from '../btn/QasBtn.vue'
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
name: 'QasListItems',
|
|
25
|
+
defineOptions({ name: 'QasListItems' })
|
|
27
26
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
const props = defineProps({
|
|
28
|
+
icon: {
|
|
29
|
+
type: String,
|
|
30
|
+
default: 'sym_r_chevron_right'
|
|
31
31
|
},
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
},
|
|
38
|
-
|
|
39
|
-
list: {
|
|
40
|
-
default: () => [],
|
|
41
|
-
type: Array
|
|
42
|
-
},
|
|
43
|
-
|
|
44
|
-
useClickableItem: {
|
|
45
|
-
type: Boolean
|
|
46
|
-
},
|
|
33
|
+
list: {
|
|
34
|
+
default: () => [],
|
|
35
|
+
type: Array
|
|
36
|
+
},
|
|
47
37
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
type: Boolean
|
|
51
|
-
}
|
|
38
|
+
useClickableItem: {
|
|
39
|
+
type: Boolean
|
|
52
40
|
},
|
|
53
41
|
|
|
54
|
-
|
|
42
|
+
useSectionActions: {
|
|
43
|
+
default: true,
|
|
44
|
+
type: Boolean
|
|
45
|
+
}
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
const emit = defineEmits(['click-item'])
|
|
55
49
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
) return
|
|
50
|
+
function onClick ({ item, index }, fromItem) {
|
|
51
|
+
/**
|
|
52
|
+
* se o click veio do q-item e "useClickableItem" for "false", ou
|
|
53
|
+
* se o click não veio do q-item e "useClickableItem" for "true", então retorna sem emitir.
|
|
54
|
+
*/
|
|
55
|
+
if (
|
|
56
|
+
(fromItem && !props.useClickableItem) || (!fromItem && props.useClickableItem)
|
|
57
|
+
) return
|
|
65
58
|
|
|
66
|
-
|
|
67
|
-
}
|
|
68
|
-
}
|
|
59
|
+
emit('click-item', { item, index })
|
|
69
60
|
}
|
|
70
61
|
</script>
|
|
71
62
|
|
|
@@ -1,69 +1,67 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="qas-map">
|
|
3
|
-
<g-map-map :center="centerPosition" class="qas-map__draw" :zoom="zoom">
|
|
4
|
-
<g-map-marker v-for="(marker, index) in markers" :key="index" :draggable="marker.draggable" :icon="marker.icon" :position="marker.position" @dragend="updatePosition" @mouseout="closePopup" @mouseover="openPopup(marker, index)">
|
|
3
|
+
<g-map-map :center="props.centerPosition" class="qas-map__draw" :zoom="props.zoom">
|
|
4
|
+
<g-map-marker v-for="(marker, index) in props.markers" :key="index" :draggable="marker.draggable" :icon="marker.icon" :position="marker.position" @dragend="updatePosition" @mouseout="closePopup" @mouseover="openPopup(marker, index)">
|
|
5
5
|
<g-map-info-window :opened="canShowPopup(index)">
|
|
6
|
-
<div class="text-weight-bold">
|
|
7
|
-
|
|
6
|
+
<div class="text-weight-bold">
|
|
7
|
+
{{ marker.title }}
|
|
8
|
+
</div>
|
|
9
|
+
|
|
10
|
+
<div>
|
|
11
|
+
{{ marker.description }}
|
|
12
|
+
</div>
|
|
8
13
|
</g-map-info-window>
|
|
9
14
|
</g-map-marker>
|
|
10
15
|
</g-map-map>
|
|
11
16
|
</div>
|
|
12
17
|
</template>
|
|
13
18
|
|
|
14
|
-
<script>
|
|
15
|
-
|
|
16
|
-
name: 'QasMap',
|
|
19
|
+
<script setup>
|
|
20
|
+
import { ref } from 'vue'
|
|
17
21
|
|
|
18
|
-
|
|
19
|
-
centerPosition: {
|
|
20
|
-
type: Object,
|
|
21
|
-
default: () => ({})
|
|
22
|
-
},
|
|
22
|
+
defineOptions({ name: 'QasMap' })
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
24
|
+
const props = defineProps({
|
|
25
|
+
centerPosition: {
|
|
26
|
+
type: Object,
|
|
27
|
+
default: () => ({})
|
|
28
|
+
},
|
|
28
29
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
markers: {
|
|
31
|
+
type: Array,
|
|
32
|
+
default: () => []
|
|
33
|
+
},
|
|
33
34
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
zoom: {
|
|
36
|
+
type: Number,
|
|
37
|
+
default: 17
|
|
37
38
|
},
|
|
38
39
|
|
|
39
|
-
|
|
40
|
+
usePopup: {
|
|
41
|
+
type: Boolean
|
|
42
|
+
}
|
|
43
|
+
})
|
|
40
44
|
|
|
41
|
-
|
|
42
|
-
return {
|
|
43
|
-
isPopupDisplayed: false,
|
|
44
|
-
currentPlace: null,
|
|
45
|
-
indexMarker: null
|
|
46
|
-
}
|
|
47
|
-
},
|
|
45
|
+
const emit = defineEmits(['update-position'])
|
|
48
46
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
this.indexMarker = index
|
|
52
|
-
this.isPopupDisplayed = !!(title || description)
|
|
53
|
-
},
|
|
47
|
+
const isPopupDisplayed = ref(false)
|
|
48
|
+
const indexMarker = ref(null)
|
|
54
49
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
50
|
+
function canShowPopup (index) {
|
|
51
|
+
return isPopupDisplayed.value && props.usePopup && index === indexMarker.value
|
|
52
|
+
}
|
|
58
53
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
54
|
+
function closePopup () {
|
|
55
|
+
isPopupDisplayed.value = false
|
|
56
|
+
}
|
|
62
57
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
58
|
+
function openPopup ({ title, description }, index) {
|
|
59
|
+
indexMarker.value = index
|
|
60
|
+
isPopupDisplayed.value = !!(title || description)
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function updatePosition (mouseEvent) {
|
|
64
|
+
emit('update-position', mouseEvent.latLng.toJSON())
|
|
67
65
|
}
|
|
68
66
|
</script>
|
|
69
67
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<q-field :label="formattedLabel" :model-value="modelValue" outlined>
|
|
3
|
-
<template #control="{ floatingLabel, id }">
|
|
4
|
-
<input v-show="floatingLabel" :id="id" ref="input" class="q-field__input" inputmode="numeric" @blur="emitValue" @click="setSelect" @input="emitUpdateModel($event.target.value)">
|
|
3
|
+
<template #control="{ floatingLabel, id, editable }">
|
|
4
|
+
<input v-show="floatingLabel" :id="id" ref="input" class="q-field__input" :disabled="!editable" inputmode="numeric" @blur="emitValue" @click="setSelect" @input="emitUpdateModel($event.target.value)">
|
|
5
5
|
</template>
|
|
6
6
|
</q-field>
|
|
7
7
|
</template>
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
<div>
|
|
3
3
|
<q-toolbar class="justify-between q-mb-lg q-px-none qas-page-header">
|
|
4
4
|
<div class="ellipsis">
|
|
5
|
-
<q-toolbar-title v-if="title" class="text-h3">
|
|
6
|
-
{{ title }}
|
|
5
|
+
<q-toolbar-title v-if="props.title" class="text-h3">
|
|
6
|
+
{{ props.title }}
|
|
7
7
|
</q-toolbar-title>
|
|
8
8
|
|
|
9
|
-
<q-breadcrumbs v-if="useBreadcrumbs" class="text-caption" gutter="xs" separator-color="grey-8">
|
|
10
|
-
<q-breadcrumbs-el v-if="useHomeIcon" class="qas-page-header__breadcrumbs-el text-grey-8" icon="sym_r_home" :to="homeRoute" />
|
|
9
|
+
<q-breadcrumbs v-if="props.useBreadcrumbs" class="text-caption" gutter="xs" separator-color="grey-8">
|
|
10
|
+
<q-breadcrumbs-el v-if="props.useHomeIcon" class="qas-page-header__breadcrumbs-el text-grey-8" icon="sym_r_home" :to="homeRoute" />
|
|
11
11
|
|
|
12
12
|
<q-breadcrumbs-el v-for="(item, index) in normalizedBreadcrumbs" :key="index" class="ellipsis inline-block qas-page-header__breadcrumbs-el" :label="item.label" :to="item.route" />
|
|
13
13
|
</q-breadcrumbs>
|
|
@@ -18,115 +18,102 @@
|
|
|
18
18
|
|
|
19
19
|
<div>
|
|
20
20
|
<slot name="bottom">
|
|
21
|
-
<qas-header-actions v-if="hasHeaderActions" v-bind="headerActionsProps" />
|
|
21
|
+
<qas-header-actions v-if="hasHeaderActions" v-bind="props.headerActionsProps" />
|
|
22
22
|
</slot>
|
|
23
23
|
</div>
|
|
24
24
|
</div>
|
|
25
25
|
</template>
|
|
26
26
|
|
|
27
|
-
<script>
|
|
27
|
+
<script setup>
|
|
28
28
|
import QasHeaderActions from '../header-actions/QasHeaderActions.vue'
|
|
29
29
|
|
|
30
30
|
import { castArray } from 'lodash-es'
|
|
31
|
-
import {
|
|
31
|
+
import { computed } from 'vue'
|
|
32
|
+
import { useMeta } from 'quasar'
|
|
33
|
+
import { useRouter } from 'vue-router'
|
|
32
34
|
|
|
33
|
-
|
|
34
|
-
name: 'QasPageHeader',
|
|
35
|
+
defineOptions({ name: 'QasPageHeader' })
|
|
35
36
|
|
|
36
|
-
|
|
37
|
-
|
|
37
|
+
const props = defineProps({
|
|
38
|
+
breadcrumbs: {
|
|
39
|
+
default: '',
|
|
40
|
+
type: [Array, String]
|
|
38
41
|
},
|
|
39
42
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
title: this.title
|
|
44
|
-
}
|
|
45
|
-
})
|
|
46
|
-
],
|
|
47
|
-
|
|
48
|
-
props: {
|
|
49
|
-
breadcrumbs: {
|
|
50
|
-
default: '',
|
|
51
|
-
type: [Array, String]
|
|
52
|
-
},
|
|
53
|
-
|
|
54
|
-
headerActionsProps: {
|
|
55
|
-
default: () => ({}),
|
|
56
|
-
type: Object
|
|
57
|
-
},
|
|
58
|
-
|
|
59
|
-
root: {
|
|
60
|
-
default: '',
|
|
61
|
-
type: [Object, String]
|
|
62
|
-
},
|
|
63
|
-
|
|
64
|
-
title: {
|
|
65
|
-
default: '',
|
|
66
|
-
type: String
|
|
67
|
-
},
|
|
68
|
-
|
|
69
|
-
useBreadcrumbs: {
|
|
70
|
-
default: true,
|
|
71
|
-
type: Boolean
|
|
72
|
-
},
|
|
73
|
-
|
|
74
|
-
useHomeIcon: {
|
|
75
|
-
default: true,
|
|
76
|
-
type: Boolean
|
|
77
|
-
}
|
|
43
|
+
headerActionsProps: {
|
|
44
|
+
default: () => ({}),
|
|
45
|
+
type: Object
|
|
78
46
|
},
|
|
79
47
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
48
|
+
root: {
|
|
49
|
+
default: '',
|
|
50
|
+
type: [Object, String]
|
|
51
|
+
},
|
|
84
52
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
53
|
+
title: {
|
|
54
|
+
default: '',
|
|
55
|
+
type: String
|
|
56
|
+
},
|
|
89
57
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
58
|
+
useBreadcrumbs: {
|
|
59
|
+
default: true,
|
|
60
|
+
type: Boolean
|
|
61
|
+
},
|
|
93
62
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
63
|
+
useHomeIcon: {
|
|
64
|
+
default: true,
|
|
65
|
+
type: Boolean
|
|
66
|
+
}
|
|
67
|
+
})
|
|
97
68
|
|
|
98
|
-
|
|
99
|
-
const breadcrumbsSize = this.transformedBreadcrumbs.length
|
|
69
|
+
const router = useRouter()
|
|
100
70
|
|
|
101
|
-
|
|
71
|
+
// meta tag
|
|
72
|
+
useMeta(() => ({ title: props.title }))
|
|
102
73
|
|
|
103
|
-
|
|
104
|
-
|
|
74
|
+
// computed
|
|
75
|
+
const transformedBreadcrumbs = computed(() => {
|
|
76
|
+
const list = [...castArray(props.breadcrumbs || props.title)]
|
|
105
77
|
|
|
106
|
-
|
|
107
|
-
...this.transformedBreadcrumbs.at(-2),
|
|
108
|
-
label: '...'
|
|
109
|
-
}
|
|
78
|
+
props.root && list.unshift(props.root)
|
|
110
79
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
last
|
|
116
|
-
]
|
|
117
|
-
},
|
|
80
|
+
return list.map(item => {
|
|
81
|
+
if (item && typeof item === 'string') {
|
|
82
|
+
return { label: item }
|
|
83
|
+
}
|
|
118
84
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
}
|
|
85
|
+
if (!item.route && item.routeName) {
|
|
86
|
+
item.route = { name: item.routeName }
|
|
87
|
+
}
|
|
122
88
|
|
|
123
|
-
|
|
124
|
-
|
|
89
|
+
return item
|
|
90
|
+
})
|
|
91
|
+
})
|
|
125
92
|
|
|
126
|
-
|
|
127
|
-
|
|
93
|
+
const normalizedBreadcrumbs = computed(() => {
|
|
94
|
+
const breadcrumbsSize = transformedBreadcrumbs.value.length
|
|
95
|
+
|
|
96
|
+
if (breadcrumbsSize < 5) return transformedBreadcrumbs.value
|
|
97
|
+
|
|
98
|
+
const [first, second] = transformedBreadcrumbs.value
|
|
99
|
+
const last = transformedBreadcrumbs.value.at(-1)
|
|
100
|
+
|
|
101
|
+
const beforeLast = {
|
|
102
|
+
...transformedBreadcrumbs.value.at(-2),
|
|
103
|
+
label: '...'
|
|
128
104
|
}
|
|
129
|
-
|
|
105
|
+
|
|
106
|
+
return [
|
|
107
|
+
first,
|
|
108
|
+
second,
|
|
109
|
+
beforeLast,
|
|
110
|
+
last
|
|
111
|
+
]
|
|
112
|
+
})
|
|
113
|
+
|
|
114
|
+
const hasHeaderActions = computed(() => !!Object.keys(props.headerActionsProps).length)
|
|
115
|
+
|
|
116
|
+
const homeRoute = computed(() => router.hasRoute('Root') ? { name: 'Root' } : '/')
|
|
130
117
|
</script>
|
|
131
118
|
|
|
132
119
|
<style lang="scss">
|
|
@@ -2,31 +2,31 @@
|
|
|
2
2
|
<q-pagination v-bind="defaultProps" />
|
|
3
3
|
</template>
|
|
4
4
|
|
|
5
|
-
<script>
|
|
6
|
-
|
|
7
|
-
name: 'QasPagination',
|
|
5
|
+
<script setup>
|
|
6
|
+
import { computed, useAttrs } from 'vue'
|
|
8
7
|
|
|
9
|
-
|
|
10
|
-
defaultProps () {
|
|
11
|
-
const { modelValue, ...attributes } = this.$attrs
|
|
8
|
+
defineOptions({ name: 'QasPagination' })
|
|
12
9
|
|
|
13
|
-
|
|
14
|
-
activeColor: 'primary',
|
|
15
|
-
activeDesign: 'flat',
|
|
16
|
-
boundaryNumbers: true,
|
|
17
|
-
class: 'qas-pagination',
|
|
18
|
-
color: 'grey-8',
|
|
19
|
-
directionLinks: true,
|
|
20
|
-
iconNext: 'sym_r_chevron_right',
|
|
21
|
-
iconPrev: 'sym_r_chevron_left',
|
|
22
|
-
maxPages: 3,
|
|
23
|
-
modelValue,
|
|
10
|
+
const attrs = useAttrs()
|
|
24
11
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
12
|
+
const defaultProps = computed(() => {
|
|
13
|
+
const { modelValue, ...attributes } = attrs
|
|
14
|
+
|
|
15
|
+
return {
|
|
16
|
+
activeColor: 'primary',
|
|
17
|
+
activeDesign: 'flat',
|
|
18
|
+
boundaryNumbers: true,
|
|
19
|
+
class: 'qas-pagination',
|
|
20
|
+
color: 'grey-8',
|
|
21
|
+
directionLinks: true,
|
|
22
|
+
iconNext: 'sym_r_chevron_right',
|
|
23
|
+
iconPrev: 'sym_r_chevron_left',
|
|
24
|
+
maxPages: 3,
|
|
25
|
+
modelValue,
|
|
26
|
+
|
|
27
|
+
...attributes
|
|
28
28
|
}
|
|
29
|
-
}
|
|
29
|
+
})
|
|
30
30
|
</script>
|
|
31
31
|
|
|
32
32
|
<style lang="scss">
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
v-bind="defaultDialogProps"
|
|
56
56
|
v-model="showDialog"
|
|
57
57
|
>
|
|
58
|
-
<template v-for="(_, name) in
|
|
58
|
+
<template v-for="(_, name) in slots" #[name]="context">
|
|
59
59
|
<slot :name="`dialog-${name}`" v-bind="context || {}" />
|
|
60
60
|
</template>
|
|
61
61
|
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
</template>
|
|
77
77
|
|
|
78
78
|
<script setup>
|
|
79
|
-
import { computed, ref, watch } from 'vue'
|
|
79
|
+
import { computed, ref, watch, useSlots } from 'vue'
|
|
80
80
|
|
|
81
81
|
defineOptions({ name: 'QasSelectListDialog' })
|
|
82
82
|
|
|
@@ -141,6 +141,8 @@ const props = defineProps({
|
|
|
141
141
|
|
|
142
142
|
const emit = defineEmits(['add', 'remove', 'update:modelValue'])
|
|
143
143
|
|
|
144
|
+
const slots = useSlots()
|
|
145
|
+
|
|
144
146
|
const hasError = computed(() => Array.isArray(props.error) ? !!props.error.length : !!props.error)
|
|
145
147
|
const errorMessage = computed(() => Array.isArray(props.error) ? props.error.join(' ') : props.error)
|
|
146
148
|
|
|
@@ -18,92 +18,84 @@
|
|
|
18
18
|
</div>
|
|
19
19
|
</template>
|
|
20
20
|
|
|
21
|
-
<script>
|
|
21
|
+
<script setup>
|
|
22
22
|
import QasStatus from '../status/QasStatus.vue'
|
|
23
23
|
|
|
24
|
+
import { computed } from 'vue'
|
|
24
25
|
import { extend } from 'quasar'
|
|
25
26
|
|
|
26
|
-
|
|
27
|
-
name: 'QasTabsGenerator',
|
|
27
|
+
defineOptions({ name: 'QasTabsGenerator' })
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
const props = defineProps({
|
|
30
|
+
counters: {
|
|
31
|
+
default: () => ({}),
|
|
32
|
+
type: Object
|
|
31
33
|
},
|
|
32
34
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
type: Object
|
|
37
|
-
},
|
|
38
|
-
|
|
39
|
-
modelValue: {
|
|
40
|
-
default: '',
|
|
41
|
-
type: [String, Number]
|
|
42
|
-
},
|
|
43
|
-
|
|
44
|
-
tabs: {
|
|
45
|
-
default: () => ({}),
|
|
46
|
-
required: true,
|
|
47
|
-
type: [Object, Array]
|
|
48
|
-
},
|
|
49
|
-
|
|
50
|
-
useRouteTab: {
|
|
51
|
-
type: Boolean
|
|
52
|
-
}
|
|
35
|
+
modelValue: {
|
|
36
|
+
default: '',
|
|
37
|
+
type: [String, Number]
|
|
53
38
|
},
|
|
54
39
|
|
|
55
|
-
|
|
40
|
+
tabs: {
|
|
41
|
+
default: () => ({}),
|
|
42
|
+
required: true,
|
|
43
|
+
type: [Object, Array]
|
|
44
|
+
},
|
|
56
45
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
46
|
+
useRouteTab: {
|
|
47
|
+
type: Boolean
|
|
48
|
+
}
|
|
49
|
+
})
|
|
60
50
|
|
|
61
|
-
|
|
62
|
-
if (typeof tabs[key] === 'string') {
|
|
63
|
-
tabs[key] = { label: tabs[key], value: key }
|
|
64
|
-
}
|
|
65
|
-
}
|
|
51
|
+
const emit = defineEmits(['update:modelValue'])
|
|
66
52
|
|
|
67
|
-
|
|
68
|
-
|
|
53
|
+
// computed
|
|
54
|
+
const model = computed({
|
|
55
|
+
get () {
|
|
56
|
+
return props.modelValue
|
|
57
|
+
},
|
|
69
58
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
59
|
+
set (value) {
|
|
60
|
+
const currentTab = Array.isArray(props.tabs)
|
|
61
|
+
? props.tabs.find(tab => tab?.value === value)
|
|
62
|
+
: formattedTabs.value[value]
|
|
74
63
|
|
|
75
|
-
|
|
76
|
-
const currentTab = Array.isArray(this.tabs)
|
|
77
|
-
? this.tabs.find(tab => tab?.value === value)
|
|
78
|
-
: this.formattedTabs[value]
|
|
64
|
+
if (currentTab?.disabled) return
|
|
79
65
|
|
|
80
|
-
|
|
66
|
+
emit('update:modelValue', value)
|
|
67
|
+
}
|
|
68
|
+
})
|
|
81
69
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
},
|
|
70
|
+
const formattedTabs = computed(() => {
|
|
71
|
+
const tabs = extend(true, {}, props.tabs)
|
|
85
72
|
|
|
86
|
-
|
|
87
|
-
|
|
73
|
+
for (const key in tabs) {
|
|
74
|
+
if (typeof tabs[key] === 'string') {
|
|
75
|
+
tabs[key] = { label: tabs[key], value: key }
|
|
88
76
|
}
|
|
89
|
-
}
|
|
77
|
+
}
|
|
90
78
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
const normalizedCount = this.counters[value] || counter
|
|
79
|
+
return tabs
|
|
80
|
+
})
|
|
94
81
|
|
|
95
|
-
|
|
82
|
+
const tabComponent = computed(() => props.useRouteTab ? 'q-route-tab' : 'q-tab')
|
|
96
83
|
|
|
97
|
-
|
|
84
|
+
// functions
|
|
85
|
+
function getFormattedLabel ({ label, counter, value }) {
|
|
86
|
+
const normalizedCount = props.counters[value] || counter
|
|
98
87
|
|
|
99
|
-
|
|
100
|
-
},
|
|
88
|
+
if (!normalizedCount) return label
|
|
101
89
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
90
|
+
const countString = String(normalizedCount)
|
|
91
|
+
|
|
92
|
+
return `${label} (${countString.padStart(2, '0')})`
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function getTabProps (tab) {
|
|
96
|
+
const { icon, label, ...payload } = tab
|
|
97
|
+
|
|
98
|
+
return payload
|
|
107
99
|
}
|
|
108
100
|
</script>
|
|
109
101
|
|