@bildvitta/quasar-ui-asteroid 2.11.1 → 2.12.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/components/{settings-menu/QasSettingsMenu.stories.js → actions-menu/QasActionsMenu.stories.js} +17 -9
- package/src/components/{settings-menu/QasSettingsMenu.vue → actions-menu/QasActionsMenu.vue} +24 -8
- package/src/components/app-menu/QasAppMenu.vue +1 -1
- package/src/components/filters/QasFilters.vue +23 -4
- package/src/helpers/filters.js +2 -0
- package/src/index.js +4 -4
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import
|
|
1
|
+
import QasActionsMenu from './QasActionsMenu.vue'
|
|
2
2
|
import { Notify } from 'quasar'
|
|
3
3
|
|
|
4
4
|
export default {
|
|
5
|
-
component:
|
|
6
|
-
title: 'Components/
|
|
5
|
+
component: QasActionsMenu,
|
|
6
|
+
title: 'Components/ActionsMenu',
|
|
7
7
|
|
|
8
8
|
parameters: {
|
|
9
9
|
docs: {
|
|
10
10
|
description: {
|
|
11
|
-
component: '
|
|
11
|
+
component: 'Actions menu.'
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
14
|
},
|
|
@@ -19,7 +19,15 @@ export default {
|
|
|
19
19
|
},
|
|
20
20
|
|
|
21
21
|
list: {
|
|
22
|
-
description: '
|
|
22
|
+
description: 'Actions list as an object containing `label`, `icon`, `props` and `handler` click event.'
|
|
23
|
+
},
|
|
24
|
+
|
|
25
|
+
hideLabel: {
|
|
26
|
+
description: 'Controls label visibility.'
|
|
27
|
+
},
|
|
28
|
+
|
|
29
|
+
icon: {
|
|
30
|
+
description: 'Icon button.'
|
|
23
31
|
},
|
|
24
32
|
|
|
25
33
|
// slots
|
|
@@ -41,23 +49,23 @@ export default {
|
|
|
41
49
|
}
|
|
42
50
|
|
|
43
51
|
const Template = (args, { argTypes }) => ({
|
|
44
|
-
components: {
|
|
52
|
+
components: { QasActionsMenu },
|
|
45
53
|
props: Object.keys(argTypes),
|
|
46
54
|
template:
|
|
47
|
-
'<qas-
|
|
55
|
+
'<qas-actions-menu v-bind="$props" />'
|
|
48
56
|
})
|
|
49
57
|
|
|
50
58
|
export const Default = Template.bind({})
|
|
51
59
|
Default.args = {
|
|
52
60
|
block: {
|
|
53
|
-
|
|
61
|
+
handler: () => Notify.create('Block clicked!'),
|
|
54
62
|
icon: 'o_locked',
|
|
55
63
|
label: 'Block'
|
|
56
64
|
},
|
|
57
65
|
|
|
58
66
|
list: {
|
|
59
67
|
delete: {
|
|
60
|
-
|
|
68
|
+
handler: () => Notify.create('Delete clicked!'),
|
|
61
69
|
icon: 'o_delete',
|
|
62
70
|
label: 'Delete'
|
|
63
71
|
}
|
package/src/components/{settings-menu/QasSettingsMenu.vue → actions-menu/QasActionsMenu.vue}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<qas-btn class="qas-
|
|
3
|
-
<q-menu class="qas-
|
|
4
|
-
<q-list class="qas-
|
|
2
|
+
<qas-btn class="qas-actions-menu" color="primary" v-bind="$attrs" hide-mobile-label :icon="icon" :label="labelValue" outline v-on="$listeners">
|
|
3
|
+
<q-menu class="qas-actions-menu__menu">
|
|
4
|
+
<q-list class="qas-actions-menu__list" separator>
|
|
5
5
|
<slot v-for="(item, key) in list" :item="item" :name="key">
|
|
6
6
|
<q-item :key="key" class="text-bold text-primary" clickable v-bind="item.props" @click="onClick(item)">
|
|
7
7
|
<q-item-section>
|
|
@@ -21,6 +21,8 @@
|
|
|
21
21
|
import QasBtn from '../btn/QasBtn'
|
|
22
22
|
|
|
23
23
|
export default {
|
|
24
|
+
name: 'QasActionsMenu',
|
|
25
|
+
|
|
24
26
|
components: {
|
|
25
27
|
QasBtn
|
|
26
28
|
},
|
|
@@ -34,23 +36,37 @@ export default {
|
|
|
34
36
|
list: {
|
|
35
37
|
default: () => ({}),
|
|
36
38
|
type: Object
|
|
39
|
+
},
|
|
40
|
+
|
|
41
|
+
hideLabel: {
|
|
42
|
+
type: Boolean
|
|
43
|
+
},
|
|
44
|
+
|
|
45
|
+
icon: {
|
|
46
|
+
default: 'o_settings',
|
|
47
|
+
type: String
|
|
37
48
|
}
|
|
38
49
|
},
|
|
39
50
|
|
|
40
51
|
methods: {
|
|
41
52
|
onClick (item) {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
item.handle(filtered)
|
|
53
|
+
if (typeof item.handler === 'function') {
|
|
54
|
+
const { handler, ...filtered } = item
|
|
55
|
+
item.handler(filtered)
|
|
46
56
|
}
|
|
47
57
|
}
|
|
58
|
+
},
|
|
59
|
+
|
|
60
|
+
computed: {
|
|
61
|
+
labelValue () {
|
|
62
|
+
return this.hideLabel ? '' : this.label
|
|
63
|
+
}
|
|
48
64
|
}
|
|
49
65
|
}
|
|
50
66
|
</script>
|
|
51
67
|
|
|
52
68
|
<style lang="scss">
|
|
53
|
-
.qas-
|
|
69
|
+
.qas-actions-menu {
|
|
54
70
|
&__list {
|
|
55
71
|
width: 265px;
|
|
56
72
|
z-index: 1;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<q-drawer v-model="model" content-class="bg-primary-contrast" :mini="miniMode" :width="230" @before-hide="beforeHide">
|
|
3
|
-
<q-list class="text-primary"
|
|
3
|
+
<q-list class="text-primary">
|
|
4
4
|
<div v-for="(header, index) in items" :key="index">
|
|
5
5
|
<q-expansion-item v-if="hasChildren(header)" :active-class="activeSecondaryItemClasses" :default-opened="shouldExpand(header)" expand-icon="o_keyboard_arrow_down" expand-separator :icon="header.icon" :label="header.label" :to="header.to">
|
|
6
6
|
<q-item v-for="(item, itemIndex) in header.children" :key="itemIndex" v-ripple :active-class="activeItemClasses" clickable :to="item.to">
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
</div>
|
|
42
42
|
|
|
43
43
|
<div v-if="badges && hasActiveFilters" class="q-mt-md">
|
|
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 }} = "{{ filterItem.value }}"</q-chip>
|
|
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
47
|
<slot :context="context" :filter="filter" :filters="activeFilters" :removeFilter="removeFilter" />
|
|
@@ -122,7 +122,7 @@ export default {
|
|
|
122
122
|
const hasField = fields.includes(key)
|
|
123
123
|
|
|
124
124
|
if (hasField) {
|
|
125
|
-
const value = humanize(this.fields[key], filters[key])
|
|
125
|
+
const value = humanize(this.fields[key], this.normalizeValues(filters[key], this.fields[key]?.multiple))
|
|
126
126
|
const { label, name } = this.fields[key]
|
|
127
127
|
|
|
128
128
|
activeFilters[key] = { label, name, value }
|
|
@@ -188,7 +188,7 @@ export default {
|
|
|
188
188
|
|
|
189
189
|
created () {
|
|
190
190
|
this.fetchFilters()
|
|
191
|
-
this.
|
|
191
|
+
this.watchOnceFields()
|
|
192
192
|
},
|
|
193
193
|
|
|
194
194
|
methods: {
|
|
@@ -252,6 +252,10 @@ export default {
|
|
|
252
252
|
this.$router.push({ query })
|
|
253
253
|
},
|
|
254
254
|
|
|
255
|
+
getChipValue (value) {
|
|
256
|
+
return Array.isArray(value) ? value.join(', ') : value
|
|
257
|
+
},
|
|
258
|
+
|
|
255
259
|
removeFilter ({ name }) {
|
|
256
260
|
const query = { ...this.$route.query }
|
|
257
261
|
|
|
@@ -266,8 +270,23 @@ export default {
|
|
|
266
270
|
this.search = search || ''
|
|
267
271
|
|
|
268
272
|
for (const key in filters) {
|
|
269
|
-
this.$set(this.filters, key, parseValue(filters[key]))
|
|
273
|
+
this.$set(this.filters, key, parseValue(this.normalizeValues(filters[key], this.fields[key]?.multiple)))
|
|
270
274
|
}
|
|
275
|
+
},
|
|
276
|
+
|
|
277
|
+
normalizeValues (value, isMultiple) {
|
|
278
|
+
if (Array.isArray(value)) return value
|
|
279
|
+
|
|
280
|
+
return isMultiple ? [value] : value
|
|
281
|
+
},
|
|
282
|
+
|
|
283
|
+
watchOnceFields () {
|
|
284
|
+
const watchOnce = this.$watch('fields', values => {
|
|
285
|
+
if (Object.keys(values).length) {
|
|
286
|
+
this.updateValues()
|
|
287
|
+
watchOnce()
|
|
288
|
+
}
|
|
289
|
+
})
|
|
271
290
|
}
|
|
272
291
|
}
|
|
273
292
|
}
|
package/src/helpers/filters.js
CHANGED
package/src/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { version } from '../package.json'
|
|
2
2
|
|
|
3
|
+
import QasActionsMenu from './components/actions-menu/QasActionsMenu'
|
|
3
4
|
import QasAppBar from './components/app-bar/QasAppBar'
|
|
4
5
|
import QasAppMenu from './components/app-menu/QasAppMenu'
|
|
5
6
|
import QasAppsMenu from './components/apps-menu/QasAppsMenu'
|
|
@@ -37,7 +38,6 @@ import QasResizer from './components/resizer/QasResizer'
|
|
|
37
38
|
import QasSearchBox from './components/search-box/QasSearchBox'
|
|
38
39
|
import QasSelect from './components/select/QasSelect'
|
|
39
40
|
import QasSelectList from './components/select-list/QasSelectList'
|
|
40
|
-
import QasSettingsMenu from './components/settings-menu/QasSettingsMenu'
|
|
41
41
|
import QasSignaturePad from './components/signature-pad/QasSignaturePad'
|
|
42
42
|
import QasSignatureUploader from './components/signature-uploader/QasSignatureUploader'
|
|
43
43
|
import QasSingleView from './components/single-view/QasSingleView'
|
|
@@ -73,6 +73,7 @@ export {
|
|
|
73
73
|
NotifyError,
|
|
74
74
|
NotifySuccess,
|
|
75
75
|
|
|
76
|
+
QasActionsMenu,
|
|
76
77
|
QasAppBar,
|
|
77
78
|
QasAppMenu,
|
|
78
79
|
QasAppsMenu,
|
|
@@ -110,7 +111,6 @@ export {
|
|
|
110
111
|
QasSearchBox,
|
|
111
112
|
QasSelect,
|
|
112
113
|
QasSelectList,
|
|
113
|
-
QasSettingsMenu,
|
|
114
114
|
QasSignaturePad,
|
|
115
115
|
QasSignatureUploader,
|
|
116
116
|
QasSingleView,
|
|
@@ -132,6 +132,7 @@ export default {
|
|
|
132
132
|
NotifyError,
|
|
133
133
|
NotifySuccess,
|
|
134
134
|
|
|
135
|
+
QasActionsMenu,
|
|
135
136
|
QasAppBar,
|
|
136
137
|
QasAppMenu,
|
|
137
138
|
QasAppsMenu,
|
|
@@ -169,7 +170,6 @@ export default {
|
|
|
169
170
|
QasSearchBox,
|
|
170
171
|
QasSelect,
|
|
171
172
|
QasSelectList,
|
|
172
|
-
QasSettingsMenu,
|
|
173
173
|
QasSignaturePad,
|
|
174
174
|
QasSignatureUploader,
|
|
175
175
|
QasSingleView,
|
|
@@ -190,6 +190,7 @@ export default {
|
|
|
190
190
|
success: NotifySuccess
|
|
191
191
|
}
|
|
192
192
|
|
|
193
|
+
Vue.component('QasActionsMenu', QasActionsMenu)
|
|
193
194
|
Vue.component('QasAppBar', QasAppBar)
|
|
194
195
|
Vue.component('QasAppMenu', QasAppMenu)
|
|
195
196
|
Vue.component('QasAppsMenu', QasAppsMenu)
|
|
@@ -227,7 +228,6 @@ export default {
|
|
|
227
228
|
Vue.component('QasSearchBox', QasSearchBox)
|
|
228
229
|
Vue.component('QasSelect', QasSelect)
|
|
229
230
|
Vue.component('QasSelectList', QasSelectList)
|
|
230
|
-
Vue.component('QasSettingsMenu', QasSettingsMenu)
|
|
231
231
|
Vue.component('QasSignaturePad', QasSignaturePad)
|
|
232
232
|
Vue.component('QasSignatureUploader', QasSignatureUploader)
|
|
233
233
|
Vue.component('QasSingleView', QasSingleView)
|