@bildvitta/quasar-ui-asteroid 2.11.0 → 2.12.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bildvitta/quasar-ui-asteroid",
3
- "version": "2.11.0",
3
+ "version": "2.12.2",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "scripts": {
@@ -1,14 +1,14 @@
1
- import QasSettingsMenu from './QasSettingsMenu.vue'
1
+ import QasActionsMenu from './QasActionsMenu.vue'
2
2
  import { Notify } from 'quasar'
3
3
 
4
4
  export default {
5
- component: QasSettingsMenu,
6
- title: 'Components/SettingsMenu',
5
+ component: QasActionsMenu,
6
+ title: 'Components/ActionsMenu',
7
7
 
8
8
  parameters: {
9
9
  docs: {
10
10
  description: {
11
- component: 'Settings menu.'
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: 'Settings list as an object containing `label`, `icon`, `props` and `handle` click event.'
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: { QasSettingsMenu },
52
+ components: { QasActionsMenu },
45
53
  props: Object.keys(argTypes),
46
54
  template:
47
- '<qas-settings-menu v-bind="$props" />'
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
- handle: () => Notify.create('Block clicked!'),
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
- handle: () => Notify.create('Delete clicked!'),
68
+ handler: () => Notify.create('Delete clicked!'),
61
69
  icon: 'o_delete',
62
70
  label: 'Delete'
63
71
  }
@@ -1,7 +1,7 @@
1
1
  <template>
2
- <qas-btn class="qas-settings-menu" color="primary" v-bind="$attrs" hide-mobile-label icon="o_settings" :label="label" outline v-on="$listeners">
3
- <q-menu class="qas-settings-menu__menu">
4
- <q-list class="qas-settings-menu__list" separator>
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
- // TODO: Alterar para "handler".
43
- if (typeof item.handle === 'function') {
44
- const { handle, ...filtered } = item
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-settings-menu {
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" padding>
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">
@@ -26,6 +26,10 @@ export default {
26
26
  description: 'Bypass [QDate](https://quasar.dev/vue-components/date) props.'
27
27
  },
28
28
 
29
+ gmt: {
30
+ description: 'Use GMT (Greenwich Mean Time) on date input'
31
+ },
32
+
29
33
  timeMask: {
30
34
  description: 'Mask string to parse and format time value.'
31
35
  },
@@ -20,6 +20,7 @@
20
20
 
21
21
  <script>
22
22
  import { date } from 'quasar'
23
+ import { date as dateFn } from '../../helpers/filters'
23
24
 
24
25
  export default {
25
26
  props: {
@@ -37,6 +38,10 @@ export default {
37
38
  type: Object
38
39
  },
39
40
 
41
+ gmt: {
42
+ type: Boolean
43
+ },
44
+
40
45
  timeMask: {
41
46
  default: 'HH:mm',
42
47
  type: String
@@ -155,6 +160,14 @@ export default {
155
160
  return ''
156
161
  }
157
162
 
163
+ if (this.dateOnly && !this.gmt) {
164
+ return dateFn(date.extractDate(value, this.maskDate), 'yyyy-MM-dd')
165
+ }
166
+
167
+ if (this.timeOnly && !this.gmt) {
168
+ return date.extractDate(value, 'HH:MM')
169
+ }
170
+
158
171
  return date.extractDate(value, this.maskDate).toISOString()
159
172
  },
160
173
 
@@ -70,7 +70,8 @@ export default {
70
70
  mask,
71
71
  pattern,
72
72
  maxFiles,
73
- searchable
73
+ searchable,
74
+ gmt
74
75
  } = this.formatedField
75
76
 
76
77
  // Default error attributes for Quasar.
@@ -91,10 +92,11 @@ export default {
91
92
  maxlength,
92
93
  minlength,
93
94
  suffix,
94
- prefix
95
+ prefix,
96
+ gmt
95
97
  }
96
98
 
97
- const datetimeInput = { is: 'qas-date-time-input', ...input }
99
+ const datetimeInput = { is: 'qas-date-time-input', gmt, ...input }
98
100
  const decimalInput = { is: 'qas-decimal-input', comma: true, fillMask: '0', reverseFillMask: true, ...input }
99
101
 
100
102
  // It'll generate a list of acceptable files extensions.
@@ -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 }} = "{{ handleChipValue(filterItem.value) }}"</q-chip>
45
45
  </div>
46
46
 
47
47
  <slot :context="context" :filter="filter" :filters="activeFilters" :removeFilter="removeFilter" />
@@ -188,7 +188,7 @@ export default {
188
188
 
189
189
  created () {
190
190
  this.fetchFilters()
191
- this.updateValues()
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/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)
@@ -5,12 +5,13 @@ export default {
5
5
 
6
6
  referencePoints.forEach((referencePoint, index) => {
7
7
  const { latitude, longitude, city, name, icon } = referencePoint
8
+ const isCreateOrEdit = !!this.$_mode
8
9
 
9
10
  referencePointsList.push({
10
11
  position: { lat: +latitude, lng: +longitude },
11
12
  title: name,
12
13
  description: city,
13
- draggable: !index && this.$_isEditMode,
14
+ draggable: !index && isCreateOrEdit,
14
15
  icon
15
16
  })
16
17
  })