@bildvitta/quasar-ui-asteroid 3.4.0 → 3.5.0-beta.0

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,7 +1,7 @@
1
1
  {
2
2
  "name": "@bildvitta/quasar-ui-asteroid",
3
3
  "description": "Asteroid",
4
- "version": "3.4.0",
4
+ "version": "3.5.0-beta.0",
5
5
  "author": "Bild & Vitta <systemteam@bild.com.br>",
6
6
  "license": "MIT",
7
7
  "main": "dist/asteroid.cjs.min.js",
@@ -11,9 +11,10 @@ import QasCheckboxGroup from '../checkbox-group/QasCheckboxGroup.vue'
11
11
  import QasDateTimeInput from '../date-time-input/QasDateTimeInput.vue'
12
12
  import QasInput from '../input/QasInput.vue'
13
13
  import QasNumericInput from '../numeric-input/QasNumericInput.vue'
14
+ import QasOptionGroup from '../option-group/QasOptionGroup.vue'
14
15
  import QasPasswordInput from '../password-input/QasPasswordInput.vue'
15
- import QasUploader from '../uploader/QasUploader.vue'
16
16
  import QasSignatureUploader from '../signature-uploader/QasSignatureUploader.vue'
17
+ import QasUploader from '../uploader/QasUploader.vue'
17
18
 
18
19
  const attributesProfile = {
19
20
  maxLength: 'maxlength',
@@ -29,9 +30,10 @@ export default {
29
30
  QasDateTimeInput,
30
31
  QasInput,
31
32
  QasNumericInput,
33
+ QasOptionGroup,
32
34
  QasPasswordInput,
33
- QasUploader,
34
- QasSignatureUploader
35
+ QasSignatureUploader,
36
+ QasUploader
35
37
  },
36
38
 
37
39
  inheritAttrs: false,
@@ -77,7 +79,6 @@ export default {
77
79
  maxFiles,
78
80
  useIso,
79
81
  useLazyLoading,
80
- useSearch,
81
82
  useStrengthChecker
82
83
  } = this.formattedField
83
84
 
@@ -138,14 +139,14 @@ export default {
138
139
 
139
140
  boolean: { is: 'q-toggle', label, ...error },
140
141
  checkbox: { is: 'qas-checkbox-group', label, options, ...error },
141
- radio: { is: 'q-option-group', label, options, type: 'radio', ...error },
142
+ radio: { is: 'qas-option-group', label, options },
142
143
 
143
144
  upload: { is: 'qas-uploader', accept, autoUpload: true, entity, label, multiple, readonly, maxFiles, ...error },
144
145
  editor: { is: 'q-editor', toolbar, ...error },
145
146
 
146
147
  'signature-uploader': { is: 'qas-signature-uploader', entity, uploadLabel: label, ...error },
147
148
 
148
- select: { is: 'qas-select', entity, name, multiple, options, useSearch, useLazyLoading, ...input }
149
+ select: { is: 'qas-select', entity, name, multiple, options, useLazyLoading, ...input }
149
150
  }
150
151
 
151
152
  return { ...(profiles[type] || profiles.default), ...this.$attrs }
@@ -27,7 +27,7 @@
27
27
 
28
28
  <q-form v-else class="q-gutter-y-md q-pa-md" @submit.prevent="filter()">
29
29
  <div v-for="(field, index) in fields" :key="index">
30
- <qas-field v-model="filters[field.name]" :data-cy="`filters-${field.name}-field`" dense :field="field" />
30
+ <qas-field v-model="filters[field.name]" :data-cy="`filters-${field.name}-field`" dense :field="field" v-bind="fieldsProps[field.name]" />
31
31
  </div>
32
32
 
33
33
  <div class="text-right">
@@ -78,6 +78,11 @@ export default {
78
78
  type: String
79
79
  },
80
80
 
81
+ fieldsProps: {
82
+ default: () => ({}),
83
+ type: Object
84
+ },
85
+
81
86
  useFilterButton: {
82
87
  default: true,
83
88
  type: Boolean
@@ -9,6 +9,12 @@ props:
9
9
  required: true
10
10
  type: String
11
11
 
12
+ fields-props:
13
+ desc: Propriedade para repassar propriedades para cada campo individualmente.
14
+ default: {}
15
+ type: Object
16
+ examples: ["{ name: { dense: true, onClick: () => alert('Estou sendo clicado') } }"]
17
+
12
18
  search-placeholder:
13
19
  desc: Placeholder do campo de busca.
14
20
  default: Pesquisar...
@@ -0,0 +1,54 @@
1
+ <template>
2
+ <q-option-group v-model="model" :options="options" v-bind="attributes">
3
+ <template v-for="(_, name) in $slots" #[name]="context">
4
+ <slot :name="name" v-bind="context || {}" />
5
+ </template>
6
+ </q-option-group>
7
+ </template>
8
+
9
+ <script>
10
+ export default {
11
+ name: 'QasOptionGroup',
12
+
13
+ inheritAttrs: false,
14
+
15
+ props: {
16
+ options: {
17
+ default: () => [],
18
+ type: Array
19
+ },
20
+
21
+ type: {
22
+ type: String,
23
+ default: 'radio',
24
+ validator: value => ['radio', 'checkbox', 'toggle'].includes(value)
25
+ },
26
+
27
+ modelValue: {
28
+ default: '',
29
+ type: [String, Number, Array, Boolean]
30
+ }
31
+ },
32
+
33
+ emits: ['update:modelValue'],
34
+
35
+ computed: {
36
+ attributes () {
37
+ return {
38
+ ...this.$attrs,
39
+ inline: !this.$qas.screen.isSmall
40
+ }
41
+ },
42
+
43
+ model: {
44
+ get () {
45
+ return this.modelValue
46
+ },
47
+
48
+ set (value) {
49
+ return this.$emit('update:modelValue', value)
50
+ }
51
+ }
52
+ }
53
+ }
54
+ </script>
@@ -0,0 +1,30 @@
1
+ type: component
2
+
3
+ meta:
4
+ desc: Componente wrapper do [QOptionGroup](https://quasar.dev/vue-components/option-group#introduction).
5
+
6
+ props:
7
+ options:
8
+ desc: Opções contendo objetos com chaves "label" e "value".
9
+ default: []
10
+ type: Array
11
+
12
+ model-value:
13
+ desc: Model do componente, usado para v-model.
14
+ default: []
15
+ type: [String, Number, Array, Boolean]
16
+ examples: [v-model"value"]
17
+ model: true
18
+
19
+ type:
20
+ desc: Tipo de componente, podendo ser radio, checkbox ou toggle.
21
+ default: 'radio'
22
+ type: String
23
+
24
+ events:
25
+ '@update:model-value -> function (value)':
26
+ desc: Dispara toda vez que o model é atualizado, também utilizado para v-model.
27
+ params:
28
+ value:
29
+ desc: Novo valor do v-model
30
+ type: String
@@ -68,10 +68,6 @@ export default {
68
68
  valueKey: {
69
69
  default: '',
70
70
  type: String
71
- },
72
-
73
- useSearch: {
74
- type: Boolean
75
71
  }
76
72
  },
77
73
 
@@ -112,7 +108,7 @@ export default {
112
108
  },
113
109
 
114
110
  isSearchable () {
115
- return this.useSearch || this.useLazyLoading
111
+ return this.hasFuse || this.useLazyLoading
116
112
  },
117
113
 
118
114
  defaultOptions () {
@@ -127,6 +123,17 @@ export default {
127
123
  return this.mx_isFetching || this.$attrs.loading
128
124
  },
129
125
 
126
+ hasFuse () {
127
+ /*
128
+ * quantidade de option que precisa ter para o fuse funcionar automaticamente
129
+ * sem necessidade de passar prop manualmente
130
+ */
131
+ const autoFuseQuantity = 10
132
+ const hasAutoFuseSearch = this.options.length >= autoFuseQuantity && !this.useLazyLoading
133
+
134
+ return hasAutoFuseSearch
135
+ },
136
+
130
137
  model: {
131
138
  get () {
132
139
  return this.modelValue
@@ -147,7 +154,7 @@ export default {
147
154
  handler () {
148
155
  if (this.useLazyLoading && this.mx_hasFilteredOptions) return
149
156
 
150
- if (this.fuse) this.setFuse()
157
+ if (this.fuse || this.hasFuse) this.setFuse()
151
158
 
152
159
  this.mx_filteredOptions = this.defaultOptions
153
160
  },
@@ -163,7 +170,7 @@ export default {
163
170
 
164
171
  methods: {
165
172
  setFuse () {
166
- if (this.useSearch) {
173
+ if (this.hasFuse) {
167
174
  this.fuse = new Fuse(this.defaultOptions, this.defaultFuseOptions)
168
175
  }
169
176
  },
@@ -173,7 +180,7 @@ export default {
173
180
  await this.mx_filterOptionsByStore(value)
174
181
  }
175
182
 
176
- if (!this.useLazyLoading && this.useSearch) {
183
+ if (!this.useLazyLoading && this.hasFuse) {
177
184
  this.filterOptionsByFuse(value)
178
185
  }
179
186
 
@@ -71,10 +71,6 @@ props:
71
71
  type: String
72
72
  examples: [value-key="uuid"]
73
73
 
74
- use-search:
75
- desc: Controla se vai ou não ter campo de busca no select.
76
- type: Boolean
77
-
78
74
  use-lazy-loading:
79
75
  desc: Controla a busca pela store "fetchFieldOptions".
80
76
  default: false
@@ -1,3 +1,3 @@
1
- $button-font-size: 0.875rem;
1
+ $button-font-size: 1rem;
2
2
  $button-line-height: 1.5rem;
3
- $button-font-weight: 500;
3
+ $button-font-weight: 600;
@@ -9,48 +9,48 @@
9
9
 
10
10
  // headings
11
11
  $h1: (
12
- size: 6rem,
13
- line-height: 6rem,
12
+ size: 3rem,
13
+ line-height: 1.5rem,
14
14
  letter-spacing: 0,
15
15
  weight: 800,
16
16
  margin: 0
17
17
  );
18
18
 
19
19
  $h2: (
20
- size: 3.75rem,
21
- line-height: 3.75rem,
20
+ size: 2rem,
21
+ line-height: 1.5rem,
22
22
  letter-spacing: 0,
23
23
  weight: 700,
24
24
  margin: 0
25
25
  );
26
26
 
27
27
  $h3: (
28
- size: 3rem,
29
- line-height: 2.5rem,
28
+ size: 1.5rem,
29
+ line-height: 1.5rem,
30
30
  letter-spacing: 0,
31
- weight: 600,
31
+ weight: 700,
32
32
  margin: 0
33
33
  );
34
34
 
35
35
  $h4: (
36
- size: 2.125rem,
37
- line-height: 2.5rem,
36
+ size: 1.125rem,
37
+ line-height: 1.5rem,
38
38
  letter-spacing: 0,
39
- weight: 800,
39
+ weight: 600,
40
40
  margin: 0
41
41
  );
42
42
 
43
43
  $h5: (
44
- size: 1.5rem,
45
- line-height: 2rem,
44
+ size: 1rem,
45
+ line-height: 1.5rem,
46
46
  letter-spacing: 0,
47
- weight: 700,
47
+ weight: 600,
48
48
  margin: 0
49
49
  );
50
50
 
51
51
  $h6: (
52
- size: 1.25rem,
53
- line-height: 2rem,
52
+ size: 0.875rem,
53
+ line-height: 1.5rem,
54
54
  letter-spacing: 0,
55
55
  weight: 600,
56
56
  margin: 0
@@ -59,14 +59,14 @@ $h6: (
59
59
  // subtitles
60
60
  $subtitle1: (
61
61
  size: 1rem,
62
- line-height: 1.75rem,
62
+ line-height: 1.5rem,
63
63
  letter-spacing: 0,
64
- weight: 700
64
+ weight: 600
65
65
  );
66
66
 
67
67
  $subtitle2: (
68
68
  size: 0.875rem,
69
- line-height: 1.375rem,
69
+ line-height: 1.5rem,
70
70
  letter-spacing: 0,
71
71
  weight: 600
72
72
  );
@@ -76,20 +76,20 @@ $body1: (
76
76
  size: 1rem,
77
77
  line-height: 1.5rem,
78
78
  letter-spacing: 0,
79
- weight: 500
79
+ weight: 400
80
80
  );
81
81
 
82
82
  $body2: (
83
83
  size: 0.875rem,
84
- line-height: 1.25rem,
84
+ line-height: 1.5rem,
85
85
  letter-spacing: 0,
86
86
  weight: 400
87
87
  );
88
88
 
89
89
  // overline
90
90
  $overline: (
91
- size: 0.75rem,
92
- line-height: 2rem,
91
+ size: 0.875rem,
92
+ line-height: 1.5rem,
93
93
  letter-spacing: 0.25rem,
94
94
  weight: 600
95
95
  );
@@ -97,9 +97,9 @@ $overline: (
97
97
  // caption
98
98
  $caption: (
99
99
  size: 0.75rem,
100
- line-height: 1.25rem,
100
+ line-height: 1.5rem,
101
101
  letter-spacing: 0,
102
- weight: 700
102
+ weight: 600
103
103
  );
104
104
 
105
105
  $headings: (
package/src/vue-plugin.js CHANGED
@@ -29,6 +29,7 @@ import QasListView from './components/list-view/QasListView.vue'
29
29
  import QasMap from './components/map/QasMap.vue'
30
30
  import QasNestedFields from './components/nested-fields/QasNestedFields.vue'
31
31
  import QasNumericInput from './components/numeric-input/QasNumericInput.vue'
32
+ import QasOptionGroup from './components/option-group/QasOptionGroup.vue'
32
33
  import QasPageHeader from './components/page-header/QasPageHeader.vue'
33
34
  import QasPasswordInput from './components/password-input/QasPasswordInput.vue'
34
35
  import QasPasswordStrengthChecker from './components/password-strength-checker/QasPasswordStrengthChecker.vue'
@@ -99,6 +100,7 @@ function install (app) {
99
100
  app.component('QasMap', QasMap)
100
101
  app.component('QasNestedFields', QasNestedFields)
101
102
  app.component('QasNumericInput', QasNumericInput)
103
+ app.component('QasOptionGroup', QasOptionGroup)
102
104
  app.component('QasPageHeader', QasPageHeader)
103
105
  app.component('QasPasswordInput', QasPasswordInput)
104
106
  app.component('QasPasswordStrengthChecker', QasPasswordStrengthChecker)
@@ -170,6 +172,7 @@ export {
170
172
  QasMap,
171
173
  QasNestedFields,
172
174
  QasNumericInput,
175
+ QasOptionGroup,
173
176
  QasPageHeader,
174
177
  QasPasswordInput,
175
178
  QasPasswordStrengthChecker,