@bildvitta/quasar-ui-asteroid 3.0.0-beta.2 → 3.0.0-beta.20

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.
Files changed (173) hide show
  1. package/dist/api/QasActionsMenu.json +15 -15
  2. package/dist/api/QasAppBar.json +4 -8
  3. package/dist/api/QasAppMenu.json +11 -7
  4. package/dist/api/QasBtn.json +8 -4
  5. package/dist/api/QasCard.json +17 -13
  6. package/dist/api/QasCheckboxGroup.json +8 -8
  7. package/dist/api/QasCopy.json +4 -4
  8. package/dist/api/QasDateTimeInput.json +16 -16
  9. package/dist/api/QasDelete.json +17 -17
  10. package/dist/api/QasDialog.json +24 -20
  11. package/dist/api/QasFilters.json +14 -14
  12. package/dist/api/QasFormGenerator.json +57 -26
  13. package/dist/api/QasFormView.json +115 -87
  14. package/dist/api/QasGallery.json +4 -4
  15. package/dist/api/QasGridGenerator.json +40 -39
  16. package/dist/api/QasInput.json +13 -13
  17. package/dist/api/QasListItems.json +18 -17
  18. package/dist/api/QasListView.json +67 -53
  19. package/dist/api/QasNestedFields.json +45 -35
  20. package/dist/api/QasNumericInput.json +31 -12
  21. package/dist/api/QasPageHeader.json +7 -7
  22. package/dist/api/QasPasswordInput.json +13 -13
  23. package/dist/api/QasPasswordStrengthChecker.json +12 -12
  24. package/dist/api/QasProfile.json +5 -5
  25. package/dist/api/QasResizer.json +11 -11
  26. package/dist/api/QasSearchBox.json +90 -8
  27. package/dist/api/QasSelect.json +92 -25
  28. package/dist/api/QasSelectList.json +16 -14
  29. package/dist/api/QasSignaturePad.json +1 -1
  30. package/dist/api/QasSignatureUploader.json +9 -9
  31. package/dist/api/QasSingleView.json +52 -43
  32. package/dist/api/QasSortable.json +20 -20
  33. package/dist/api/QasTableGenerator.json +5 -5
  34. package/dist/api/QasTabsGenerator.json +5 -2
  35. package/dist/api/QasTransfer.json +9 -9
  36. package/dist/api/QasUploader.json +22 -17
  37. package/dist/asteroid.cjs.css +1 -1
  38. package/dist/asteroid.cjs.js +3904 -3102
  39. package/dist/asteroid.cjs.min.js +2 -2
  40. package/dist/asteroid.esm.css +1 -1
  41. package/dist/asteroid.esm.js +3908 -3106
  42. package/dist/asteroid.esm.min.js +2 -2
  43. package/dist/asteroid.umd.css +1 -1
  44. package/dist/asteroid.umd.js +3907 -3106
  45. package/dist/asteroid.umd.min.js +2 -2
  46. package/dist/vetur/asteroid-attributes.json +387 -303
  47. package/dist/vetur/asteroid-tags.json +129 -108
  48. package/package.json +1 -1
  49. package/src/assets/gear.svg +27 -0
  50. package/src/components/actions/QasActions.vue +1 -5
  51. package/src/components/actions-menu/QasActionsMenu.vue +4 -10
  52. package/src/components/actions-menu/QasActionsMenu.yml +15 -15
  53. package/src/components/app-bar/QasAppBar.vue +18 -14
  54. package/src/components/app-bar/QasAppBar.yml +4 -8
  55. package/src/components/app-menu/QasAppMenu.vue +8 -7
  56. package/src/components/app-menu/QasAppMenu.yml +11 -7
  57. package/src/components/avatar/QasAvatar.vue +0 -4
  58. package/src/components/box/QasBox.vue +1 -1
  59. package/src/components/btn/QasBtn.vue +11 -15
  60. package/src/components/btn/QasBtn.yml +7 -3
  61. package/src/components/card/QasCard.vue +18 -9
  62. package/src/components/card/QasCard.yml +17 -13
  63. package/src/components/checkbox-group/QasCheckboxGroup.yml +9 -8
  64. package/src/components/copy/QasCopy.vue +1 -1
  65. package/src/components/copy/QasCopy.yml +4 -3
  66. package/src/components/date-time-input/QasDateTimeInput.vue +39 -41
  67. package/src/components/date-time-input/QasDateTimeInput.yml +16 -16
  68. package/src/components/delete/QasDelete.vue +15 -1
  69. package/src/components/delete/QasDelete.yml +15 -15
  70. package/src/components/dialog/QasDialog.vue +28 -9
  71. package/src/components/dialog/QasDialog.yml +22 -18
  72. package/src/components/dialog-router/QasDialogRouter.vue +1 -1
  73. package/src/components/field/QasField.vue +15 -14
  74. package/src/components/filters/QasFilters.vue +30 -13
  75. package/src/components/filters/QasFilters.yml +14 -14
  76. package/src/components/form-generator/QasFormGenerator.vue +87 -12
  77. package/src/components/form-generator/QasFormGenerator.yml +32 -18
  78. package/src/components/form-view/QasFormView.vue +142 -60
  79. package/src/components/form-view/QasFormView.yml +91 -67
  80. package/src/components/gallery/QasGallery.vue +4 -8
  81. package/src/components/gallery/QasGallery.yml +4 -4
  82. package/src/components/grid-generator/QasGridGenerator.vue +23 -7
  83. package/src/components/grid-generator/QasGridGenerator.yml +29 -27
  84. package/src/components/input/QasInput.vue +37 -21
  85. package/src/components/input/QasInput.yml +13 -13
  86. package/src/components/layout/QasLayout.vue +4 -0
  87. package/src/components/list-items/QasListItems.vue +16 -24
  88. package/src/components/list-items/QasListItems.yml +14 -15
  89. package/src/components/list-view/QasListView.vue +48 -20
  90. package/src/components/list-view/QasListView.yml +58 -46
  91. package/src/components/map/QasMap.vue +5 -5
  92. package/src/components/nested-fields/QasNestedFields.vue +29 -21
  93. package/src/components/nested-fields/QasNestedFields.yml +35 -28
  94. package/src/components/numeric-input/QasNumericInput.vue +45 -27
  95. package/src/components/numeric-input/QasNumericInput.yml +26 -12
  96. package/src/components/page-header/QasPageHeader.vue +14 -11
  97. package/src/components/page-header/QasPageHeader.yml +4 -4
  98. package/src/components/password-input/QasPasswordInput.vue +17 -16
  99. package/src/components/password-input/QasPasswordInput.yml +11 -11
  100. package/src/components/password-strength-checker/QasPasswordStrengthChecker.yml +10 -10
  101. package/src/components/profile/QasProfile.vue +3 -6
  102. package/src/components/profile/QasProfile.yml +5 -5
  103. package/src/components/resizer/QasResizer.vue +1 -1
  104. package/src/components/resizer/QasResizer.yml +6 -5
  105. package/src/components/search-box/QasSearchBox.vue +138 -42
  106. package/src/components/search-box/QasSearchBox.yml +74 -7
  107. package/src/components/select/QasSelect.vue +63 -53
  108. package/src/components/select/QasSelect.yml +68 -17
  109. package/src/components/select-list/QasSelectList.vue +13 -32
  110. package/src/components/select-list/QasSelectList.yml +13 -14
  111. package/src/components/signature-pad/QasSignaturePad.vue +1 -1
  112. package/src/components/signature-pad/QasSignaturePad.yml +1 -1
  113. package/src/components/signature-uploader/QasSignatureUploader.vue +13 -14
  114. package/src/components/signature-uploader/QasSignatureUploader.yml +9 -9
  115. package/src/components/single-view/QasSingleView.vue +24 -8
  116. package/src/components/single-view/QasSingleView.yml +45 -38
  117. package/src/components/sortable/QasSortable.yml +17 -17
  118. package/src/components/table-generator/QasTableGenerator.vue +14 -6
  119. package/src/components/table-generator/QasTableGenerator.yml +5 -5
  120. package/src/components/tabs-generator/QasTabsGenerator.vue +2 -2
  121. package/src/components/tabs-generator/QasTabsGenerator.yml +2 -2
  122. package/src/components/text-truncate/QasTextTruncate.vue +2 -5
  123. package/src/components/transfer/QasTransfer.vue +5 -7
  124. package/src/components/transfer/QasTransfer.yml +9 -9
  125. package/src/components/uploader/QasUploader.vue +63 -16
  126. package/src/components/uploader/QasUploader.yml +17 -12
  127. package/src/composables/index.js +1 -1
  128. package/src/composables/{useHistory.js → use-history.js} +0 -0
  129. package/src/css/components/base.scss +3 -0
  130. package/src/css/components/field.scss +4 -0
  131. package/src/css/components/index.scss +4 -0
  132. package/src/css/components/radio.scss +3 -0
  133. package/src/css/components/tabs.scss +3 -0
  134. package/src/css/mixins/index.scss +1 -0
  135. package/src/css/{set-brand.scss → mixins/set-brand.scss} +0 -0
  136. package/src/css/{background.scss → utils/background.scss} +0 -0
  137. package/src/css/{border-radius.scss → utils/border-radius.scss} +0 -0
  138. package/src/css/{border.scss → utils/border.scss} +0 -0
  139. package/src/css/{container.scss → utils/container.scss} +0 -0
  140. package/src/css/{fonts.scss → utils/fonts.scss} +0 -0
  141. package/src/css/utils/index.scss +9 -0
  142. package/src/css/{line-height.scss → utils/line-height.scss} +0 -0
  143. package/src/css/{opacity.scss → utils/opacity.scss} +0 -0
  144. package/src/css/{text.scss → utils/text.scss} +0 -0
  145. package/src/css/{unset.scss → utils/unset.scss} +0 -0
  146. package/src/css/variables/button.scss +3 -0
  147. package/src/css/variables/index.scss +3 -0
  148. package/src/css/variables/shadow.scss +33 -0
  149. package/src/css/variables/typography.scss +139 -0
  150. package/src/helpers/camelize-fields-name.js +15 -0
  151. package/src/helpers/filters.js +2 -0
  152. package/src/helpers/get-normalized-options.js +20 -0
  153. package/src/helpers/handle-process.js +13 -0
  154. package/src/helpers/index.js +3 -0
  155. package/src/index.scss +11 -12
  156. package/src/mixins/generator.js +10 -2
  157. package/src/mixins/index.js +3 -3
  158. package/src/mixins/search-filter.js +227 -0
  159. package/src/mixins/view.js +35 -13
  160. package/src/pages/ErrorComponent.vue +56 -0
  161. package/src/pages/Forbidden.vue +21 -5
  162. package/src/pages/NotFound.vue +21 -5
  163. package/src/pages/ServerError.vue +25 -0
  164. package/src/pages/Unauthorized.vue +28 -0
  165. package/src/plugins/index.js +4 -2
  166. package/src/plugins/logger/Logger.js +44 -0
  167. package/src/plugins/logger/Logger.yml +9 -0
  168. package/src/plugins/screen/Screen.js +5 -0
  169. package/src/vue-plugin.js +6 -3
  170. package/src/assets/logo-modular.svg +0 -1
  171. package/src/css/design-system.scss +0 -18
  172. package/src/css/shadow.scss +0 -7
  173. package/src/mixins/screen.js +0 -34
@@ -1,13 +1,13 @@
1
1
  <template>
2
- <q-select v-model="model" v-bind="attributes" @filter="filterOptions">
2
+ <q-select v-model="model" v-bind="attributes">
3
3
  <template #append>
4
4
  <slot name="append">
5
- <q-icon v-if="searchable" name="o_search" />
5
+ <q-icon v-if="isSearchable" name="o_search" />
6
6
  </slot>
7
7
  </template>
8
8
 
9
9
  <template #no-option>
10
- <slot name="no-option">
10
+ <slot v-if="!mx_isFetching" name="no-option">
11
11
  <q-item>
12
12
  <q-item-section class="text-grey">
13
13
  {{ noOptionLabel }}
@@ -16,6 +16,14 @@
16
16
  </slot>
17
17
  </template>
18
18
 
19
+ <template #after-options>
20
+ <slot v-if="mx_isFetching" name="after-options">
21
+ <div class="flex justify-center q-pb-sm">
22
+ <q-spinner-dots color="primary" size="20px" />
23
+ </div>
24
+ </slot>
25
+ </template>
26
+
19
27
  <template v-for="(_, name) in $slots" #[name]="context">
20
28
  <slot :name="name" v-bind="context || {}" />
21
29
  </template>
@@ -23,11 +31,14 @@
23
31
  </template>
24
32
 
25
33
  <script>
34
+ import { searchFilterMixin } from '../../mixins'
26
35
  import Fuse from 'fuse.js'
27
36
 
28
37
  export default {
29
38
  name: 'QasSelect',
30
39
 
40
+ mixins: [searchFilterMixin],
41
+
31
42
  props: {
32
43
  fuseOptions: {
33
44
  default: () => ({}),
@@ -41,7 +52,7 @@ export default {
41
52
 
42
53
  modelValue: {
43
54
  default: () => [],
44
- type: [Array, Object, String, Number]
55
+ type: [Array, Object, String, Number, Boolean]
45
56
  },
46
57
 
47
58
  noOptionLabel: {
@@ -54,13 +65,13 @@ export default {
54
65
  type: Array
55
66
  },
56
67
 
57
- searchable: {
58
- type: Boolean
59
- },
60
-
61
68
  valueKey: {
62
69
  default: '',
63
70
  type: String
71
+ },
72
+
73
+ useSearch: {
74
+ type: Boolean
64
75
  }
65
76
  },
66
77
 
@@ -68,7 +79,6 @@ export default {
68
79
 
69
80
  data () {
70
81
  return {
71
- filteredOptions: [],
72
82
  fuse: null
73
83
  }
74
84
  },
@@ -76,40 +86,45 @@ export default {
76
86
  computed: {
77
87
  attributes () {
78
88
  return {
79
- clearable: this.searchable,
89
+ clearable: this.isSearchable,
80
90
  emitValue: true,
81
91
  mapOptions: true,
82
92
  outlined: true,
83
-
84
93
  ...this.$attrs,
85
94
 
86
- options: this.filteredOptions,
87
- useInput: this.searchable
95
+ options: this.mx_filteredOptions,
96
+ useInput: this.isSearchable,
97
+ error: this.hasError,
98
+ loading: this.hasLoading,
99
+ ...(this.useLazyLoading && { onVirtualScroll: this.mx_onVirtualScroll }),
100
+ ...(this.isSearchable && { onFilter: this.onFilter })
88
101
  }
89
102
  },
90
103
 
91
104
  defaultFuseOptions () {
92
105
  return {
93
- distance: 100,
94
- includeScore: true,
106
+ ignoreLocation: true,
95
107
  keys: ['label', 'value'],
96
- location: 0,
97
- maxPatternLength: 32,
98
- minMatchCharLength: 1,
99
- shouldSort: true,
100
108
  threshold: 0.1,
101
- tokenize: true,
102
109
 
103
110
  ...this.fuseOptions
104
111
  }
105
112
  },
106
113
 
107
- formattedResult () {
108
- if (!this.labelKey && !this.valueKey) {
109
- return this.options
110
- }
114
+ isSearchable () {
115
+ return this.useSearch || this.useLazyLoading
116
+ },
117
+
118
+ defaultOptions () {
119
+ return this.mx_handleOptions(this.options)
120
+ },
111
121
 
112
- return this.options.map(item => this.renameKey(item))
122
+ hasError () {
123
+ return this.mx_hasFetchError || this.$attrs.error
124
+ },
125
+
126
+ hasLoading () {
127
+ return this.mx_isFetching || this.$attrs.loading
113
128
  },
114
129
 
115
130
  model: {
@@ -130,11 +145,11 @@ export default {
130
145
 
131
146
  options: {
132
147
  handler () {
133
- if (this.fuse) {
134
- this.fuse.list = this.formattedResult
135
- }
148
+ if (this.useLazyLoading && this.mx_hasFilteredOptions) return
149
+
150
+ if (this.fuse) this.setFuse()
136
151
 
137
- this.filteredOptions = this.formattedResult
152
+ this.mx_filteredOptions = this.defaultOptions
138
153
  },
139
154
 
140
155
  immediate: true
@@ -143,42 +158,37 @@ export default {
143
158
 
144
159
  created () {
145
160
  this.setFuse()
161
+ this.useLazyLoading && this.mx_setFetchOptions('')
146
162
  },
147
163
 
148
164
  methods: {
149
- filterOptions (value, update) {
150
- update(() => {
151
- if (!this.searchable) return
152
-
153
- if (value === '') {
154
- this.filteredOptions = this.formattedResult
155
- } else {
156
- const results = this.fuse.search(value)
157
- this.filteredOptions = results.map(item => item.item)
158
- }
159
- })
165
+ setFuse () {
166
+ if (this.useSearch) {
167
+ this.fuse = new Fuse(this.defaultOptions, this.defaultFuseOptions)
168
+ }
160
169
  },
161
170
 
162
- renameKey (item) {
163
- const mapKeys = {
164
- label: this.labelKey,
165
- value: this.valueKey
171
+ async onFilter (value, update) {
172
+ if (this.useLazyLoading && value !== this.mx_search) {
173
+ await this.mx_filterOptionsByStore(value)
166
174
  }
167
175
 
168
- for (const newKey in mapKeys) {
169
- if (!item.hasOwnProperty.call(newKey)) {
170
- item[newKey] = item[mapKeys[newKey]]
171
- delete item[mapKeys[newKey]]
172
- }
176
+ if (!this.useLazyLoading && this.useSearch) {
177
+ this.filterOptionsByFuse(value)
173
178
  }
174
179
 
175
- return item
180
+ update()
176
181
  },
177
182
 
178
- setFuse () {
179
- if (this.searchable) {
180
- this.fuse = new Fuse(this.options, this.defaultFuseOptions)
183
+ filterOptionsByFuse (value) {
184
+ if (value === '') {
185
+ this.mx_filteredOptions = this.defaultOptions
186
+ return
181
187
  }
188
+
189
+ const results = this.fuse.search(value)
190
+
191
+ this.mx_filteredOptions = this.mx_getNormalizedFuseResults(results)
182
192
  }
183
193
  }
184
194
  }
@@ -7,33 +7,55 @@ meta:
7
7
  desc: Componente para select que implementa o "QSelect" repassando propriedades, slots e eventos.
8
8
 
9
9
  props:
10
- model-value:
11
- desc: Model do componente.
12
- default: []
13
- type: [Array, Object, String, Number]
14
- examples: [v-model="value"]
10
+ entity:
11
+ desc: Entidade enviada para a action "fetchFieldOptions" (usar somente quando "useLazyLoading" estiver habilitada).
12
+ default: ''
13
+ type: String
14
+ examples: [users]
15
+
16
+ fetching:
17
+ desc: Usado para saber quando o componente está fazendo fetching (usar somente quando "useLazyLoading" estiver habilitada).
18
+ default: false
19
+ type: Boolean
15
20
  model: true
21
+ examples: [v-model:fetching="isFetching"]
16
22
 
17
23
  fuse-options:
18
24
  desc: Opções do Fuse.js (https://fusejs.io/api/options.html).
19
25
  type: Object
20
26
  debugger: true
21
27
  default:
22
- distance: 100
23
- includeScore: true
28
+ ignoreLocation: true
24
29
  keys: [label, value]
25
- location: 0
26
- maxPatternLength: 32
27
- minMatchCharLength: 1
28
- shouldSort: true
29
30
  threshold: 0.1
30
- tokenize: true
31
31
 
32
32
  label-key:
33
33
  desc: O componente internamente espera receber na propriedade "options" um array de objeto contendo "label" e "value", caso o seu objeto não tenha "label" mas um "name" por exemplo, você pode definir esta prop "label-key" como "name".
34
34
  type: String
35
35
  examples: [label-key="name"]
36
36
 
37
+ lazy-loading-props:
38
+ desc: Propriedades para o lazy loading (usar somente quando "useLazyLoading" estiver habilitada).
39
+ type: Object
40
+ debugger: true
41
+ default:
42
+ decamelizeFieldName: true
43
+ url: ''
44
+ params:
45
+ limit: 48
46
+
47
+ model-value:
48
+ desc: Model do componente.
49
+ default: []
50
+ type: [Array, Object, String, Number, Boolean]
51
+ examples: [v-model="value"]
52
+ model: true
53
+
54
+ name:
55
+ desc: Nome do campo a ser enviado para a action "fetchFieldOptions" (usar somente quando "useLazyLoading" estiver habilitada).
56
+ type: String
57
+ examples: [cities]
58
+
37
59
  no-option-label:
38
60
  desc: Rótulo padrão de quando os options estão vazios.
39
61
  default: Nenhum resultado foi encontrado.
@@ -44,19 +66,48 @@ props:
44
66
  default: []
45
67
  type: Array
46
68
 
47
- searchable:
48
- desc: Controla se vai ou não ter campo de busca no select.
49
- type: Boolean
50
-
51
69
  value-key:
52
70
  desc: O componente internamente espera receber na propriedade "options" um array de objeto contendo "label" e "value", caso o seu objeto não tenha "value" mas um "uuid" por exemplo, você pode definir esta prop "label-value" como "uuid".
53
71
  type: String
54
72
  examples: [value-key="uuid"]
55
73
 
74
+ use-search:
75
+ desc: Controla se vai ou não ter campo de busca no select.
76
+ type: Boolean
77
+
78
+ use-lazy-loading:
79
+ desc: Controla a busca pela store "fetchFieldOptions".
80
+ default: false
81
+ type: Boolean
82
+
56
83
  events:
57
84
  '@update:model-value -> function (value)':
58
85
  desc: Dispara toda vez que o model é atualizado, também utilizado para v-model.
59
86
  params:
60
87
  value:
61
88
  desc: Novo valor do v-model
62
- type: [Array, Object, String, Number]
89
+ type: [Array, Object, String, Number, Boolean]
90
+
91
+ '@update:fetching -> function (value)':
92
+ desc: Dispara toda vez que o campo de busca faz o fetch do lazy loading
93
+ params:
94
+ value:
95
+ desc: Novo valor do v-model:fetching
96
+ default: false
97
+ type: Boolean
98
+
99
+ '@fetch-options-success -> function (value)':
100
+ desc: Dispara toda vez que o campo de busca faz o fetch do lazy loading com sucesso.
101
+ params:
102
+ value:
103
+ desc: Valor retornado pela action "fetchFieldOptions"
104
+ default: {}
105
+ type: Object
106
+
107
+ '@fetch-options-error -> function (value)':
108
+ desc: Dispara toda vez que o campo de busca faz o fetch do lazy loading e cai em uma exceção.
109
+ params:
110
+ value:
111
+ desc: Valor retornado pela action "fetchFieldOptions"
112
+ default: {}
113
+ type: Object
@@ -6,7 +6,7 @@
6
6
  <slot v-bind="slotData" :item="result" name="item">
7
7
  <slot name="item-section" :result="result">
8
8
  <q-item-section class="items-start text-bold">
9
- <div :class="labelClass" @click="redirectRoute(result)">{{ result.label }}</div>
9
+ <div :class="labelClass" @click="onClickLabel({ item: result, index })">{{ result.label }}</div>
10
10
  </q-item-section>
11
11
  </slot>
12
12
 
@@ -24,7 +24,6 @@
24
24
 
25
25
  <script>
26
26
  import { sortBy } from 'lodash-es'
27
- import { screenMixin } from '../../mixins'
28
27
 
29
28
  import QasBtn from '../btn/QasBtn.vue'
30
29
  import QasSearchBox from '../search-box/QasSearchBox.vue'
@@ -37,8 +36,6 @@ export default {
37
36
  QasSearchBox
38
37
  },
39
38
 
40
- mixins: [screenMixin],
41
-
42
39
  props: {
43
40
  deleteOnly: {
44
41
  type: Boolean
@@ -59,26 +56,16 @@ export default {
59
56
  default: () => []
60
57
  },
61
58
 
62
- to: {
63
- default: () => ({}),
64
- type: Object
65
- },
66
-
67
- redirectKey: {
68
- default: 'uuid',
69
- type: String
70
- },
71
-
72
- paramKey: {
73
- default: 'id',
74
- type: String
59
+ useClickableLabel: {
60
+ type: Boolean
75
61
  }
76
62
  },
77
63
 
78
64
  emits: [
79
65
  'added',
80
- 'update:modelValue',
81
- 'removed'
66
+ 'click-label',
67
+ 'removed',
68
+ 'update:modelValue'
82
69
  ],
83
70
 
84
71
  data () {
@@ -90,12 +77,8 @@ export default {
90
77
  },
91
78
 
92
79
  computed: {
93
- isRedirectEnabled () {
94
- return Object.keys(this.to).length
95
- },
96
-
97
80
  labelClass () {
98
- return this.isRedirectEnabled ? 'cursor-pointer' : ''
81
+ return this.useClickableLabel && 'cursor-pointer'
99
82
  },
100
83
 
101
84
  slotData () {
@@ -124,6 +107,7 @@ export default {
124
107
  this.values = [...value]
125
108
  },
126
109
 
110
+ deep: true,
127
111
  immediate: true
128
112
  }
129
113
  },
@@ -144,9 +128,9 @@ export default {
144
128
  const isSelected = this.values.includes(value)
145
129
 
146
130
  return {
147
- dense: this.mx_isSmall,
148
- hideLabelOnSmallScreen: true,
149
- icon: !this.mx_isSmall ? undefined : isSelected ? 'o_close' : 'o_add',
131
+ dense: this.$qas.screen.isSmall,
132
+ useLabelOnSmallScreen: false,
133
+ icon: !this.$qas.screen.isSmall ? undefined : isSelected ? 'o_close' : 'o_add',
150
134
  label: isSelected ? 'Remover' : 'Adicionar',
151
135
  outline: isSelected,
152
136
  size: 'sm'
@@ -170,11 +154,8 @@ export default {
170
154
  })
171
155
  },
172
156
 
173
- redirectRoute (item) {
174
- return this.isRedirectEnabled && this.$router.push({
175
- params: { [this.paramKey]: item[this.redirectKey] },
176
- ...this.to
177
- })
157
+ onClickLabel ({ item, index }) {
158
+ this.useClickableLabel && this.$emit('click-label', { item, index })
178
159
  },
179
160
 
180
161
  remove (item) {
@@ -28,20 +28,9 @@ props:
28
28
  examples: [v-model="value"]
29
29
  model: true
30
30
 
31
- to:
32
- desc: 'Configuração do vue-router para enviar no $route.push({ ...to, params: {...} }).'
33
- default: Pesquisar
34
- type: String
35
-
36
- redirect-key:
37
- desc: Controla qual propriedade será a chave primaria para fazer o redirecionamento.
38
- default: uuid
39
- type: String
40
-
41
- param-key:
42
- desc: Controla qual parâmetro será enviado para rota.
43
- default: id
44
- type: String
31
+ use-clickable-label:
32
+ desc: Habilita "cursor-pointer" no label e evento "click-label".
33
+ type: Boolean
45
34
 
46
35
  slots:
47
36
  item:
@@ -98,6 +87,16 @@ events:
98
87
  desc: Item adicionado
99
88
  type: String
100
89
 
90
+ '@click-label -> function ({ item, index })':
91
+ desc: Dispara toda vez que o label do item é clicado **SE** a propriedade "useClickableLabel" for "true".
92
+ params:
93
+ item:
94
+ desc: Item clicado
95
+ type: Object
96
+ index:
97
+ desc: Posição do item
98
+ type: Number
99
+
101
100
  '@removed -> function (item, index)':
102
101
  desc: Dispara toda vez que um item é removido do v-model.
103
102
  params:
@@ -116,7 +116,7 @@ export default {
116
116
  <style lang="scss">
117
117
  .qas-signature-pad {
118
118
  &__canvas {
119
- border: 1px solid $grey-3;
119
+ border: 1px solid $separator-color;
120
120
  }
121
121
  }
122
122
  </style>
@@ -15,7 +15,7 @@ props:
15
15
  default: {}
16
16
  type: Object
17
17
 
18
- signature_options:
18
+ signature-options:
19
19
  desc: Opções da biblioteca signature_pad (https://github.com/szimek/signature_pad#options).
20
20
  default: {}
21
21
  type: Object
@@ -7,10 +7,10 @@
7
7
  <div v-if="uploadLabel" class="q-uploader__title">{{ uploadLabel }}</div>
8
8
  </div>
9
9
 
10
- <q-btn v-if="!readonly" dense flat icon="o_add" round @click="openDialog" />
10
+ <qas-btn v-if="!readonly" color="white" dense flat icon="o_add" round @click="openDialog" />
11
11
 
12
- <q-btn ref="forceUpload" class="hidden" @click="upload(scope)" />
13
- <q-btn ref="buttonCleanFiles" class="hidden" @click="scope.removeUploadedFiles" />
12
+ <qas-btn ref="forceUpload" class="hidden" @click="upload(scope)" />
13
+ <qas-btn ref="buttonCleanFiles" class="hidden" @click="scope.removeUploadedFiles" />
14
14
  </div>
15
15
  </template>
16
16
  </qas-uploader>
@@ -27,18 +27,18 @@
27
27
  </template>
28
28
 
29
29
  <template #actions>
30
- <q-btn class="full-width" color="primary" :disable="isEmpty" label="Salvar" no-caps @click="getSignatureData" />
31
- <q-btn class="full-width q-mt-sm" color="primary" flat label="Cancelar" no-caps @click="closeSignature" />
30
+ <qas-btn class="full-width" color="primary" :disable="isEmpty" label="Salvar" no-caps @click="getSignatureData" />
31
+ <qas-btn class="full-width q-mt-sm" color="primary" flat label="Cancelar" no-caps @click="closeSignature" />
32
32
  </template>
33
33
  </qas-dialog>
34
34
  </div>
35
35
  </template>
36
36
 
37
37
  <script>
38
+ import QasBtn from '../btn/QasBtn.vue'
38
39
  import QasDialog from '../dialog/QasDialog.vue'
39
40
  import QasUploader from '../uploader/QasUploader.vue'
40
41
  import QasSignaturePad from '../signature-pad/QasSignaturePad.vue'
41
- import { screenMixin } from '../../mixins'
42
42
  import { base64ToBlob } from '../../helpers'
43
43
  import { NotifyError } from '../../plugins'
44
44
 
@@ -46,13 +46,12 @@ export default {
46
46
  name: 'QasSignatureUploader',
47
47
 
48
48
  components: {
49
+ QasBtn,
49
50
  QasDialog,
50
51
  QasUploader,
51
52
  QasSignaturePad
52
53
  },
53
54
 
54
- mixins: [screenMixin],
55
-
56
55
  props: {
57
56
  dialogProps: {
58
57
  type: Object,
@@ -118,18 +117,18 @@ export default {
118
117
 
119
118
  signaturePadWidth () {
120
119
  const sizes = {
121
- [this.mx_isSmall]: { width: '100%' },
122
- [this.mx_isMedium]: { width: '570px' },
123
- [this.mx_isLarge]: { width: '350px' }
120
+ [this.$qas.screen.isSmall]: { width: '100%' },
121
+ [this.$qas.screen.isMedium]: { width: '570px' },
122
+ [this.$qas.screen.isLarge]: { width: '350px' }
124
123
  }
125
124
  return sizes.true
126
125
  },
127
126
 
128
127
  signaturePadHeight () {
129
128
  const sizes = {
130
- [this.mx_isSmall]: '250',
131
- [this.mx_isMedium]: '400',
132
- [this.mx_isLarge]: '250'
129
+ [this.$qas.screen.isSmall]: '250',
130
+ [this.$qas.screen.isMedium]: '400',
131
+ [this.$qas.screen.isLarge]: '250'
133
132
  }
134
133
 
135
134
  return sizes.true
@@ -9,8 +9,13 @@ props:
9
9
  type: Object
10
10
  default: { maxWidth: '620px' }
11
11
 
12
- upload-label:
13
- desc: Rótulo do uploader.
12
+ model-value:
13
+ desc: Model do componente, retorna url da imagem upada, usando para v-model.
14
+ type: String
15
+
16
+ readonly:
17
+ desc: Controla se o componente vai ser apenas para visualização ou pode também fazer upload.
18
+ default: image/png
14
19
  type: String
15
20
 
16
21
  signature-label:
@@ -18,18 +23,13 @@ props:
18
23
  default: {}
19
24
  type: Object
20
25
 
21
- model-value:
22
- desc: Model do componente, retorna url da imagem upada, usando para v-model.
23
- type: String
24
-
25
26
  type:
26
27
  desc: Tipo da imagem gerada.
27
28
  default: image/png
28
29
  type: String
29
30
 
30
- readonly:
31
- desc: Controla se o componente vai ser apenas para visualização ou pode também fazer upload.
32
- default: image/png
31
+ upload-label:
32
+ desc: Rótulo do uploader.
33
33
  type: String
34
34
 
35
35
  events:
@@ -9,8 +9,8 @@
9
9
  </template>
10
10
 
11
11
  <div v-else-if="!mx_isFetching" class="q-my-xl text-center">
12
- <q-icon class="q-mb-sm text-center" color="grey-6" name="o_search" size="38px" />
13
- <div class="text-grey-6">Nenhum item encontrado.</div>
12
+ <q-icon class="q-mb-sm text-center" color="grey-7" name="o_search" size="38px" />
13
+ <div class="text-grey-7">Nenhum item encontrado.</div>
14
14
  </div>
15
15
 
16
16
  <footer v-if="mx_hasFooterSlot">
@@ -66,7 +66,9 @@ export default {
66
66
 
67
67
  watch: {
68
68
  $route (to, from) {
69
- to.name === from.name && this.fetchSingle()
69
+ if (to.name === from.name) {
70
+ this.mx_fetchHandler({ id: this.id, url: this.url }, this.fetchSingle)
71
+ }
70
72
  },
71
73
 
72
74
  resultModel (value) {
@@ -75,19 +77,23 @@ export default {
75
77
  },
76
78
 
77
79
  created () {
78
- this.fetchSingle()
80
+ this.mx_fetchHandler({ id: this.id, url: this.url }, this.fetchSingle)
79
81
  },
80
82
 
81
83
  methods: {
82
- async fetchSingle (params = {}) {
84
+ async fetchSingle (externalPayload = {}) {
83
85
  this.mx_isFetching = true
84
86
 
85
87
  try {
86
- const response = await this.$store.dispatch(
87
- `${this.entity}/fetchSingle`,
88
- { id: this.id, url: this.url, params }
88
+ const payload = { id: this.id, url: this.url, ...externalPayload }
89
+
90
+ this.$qas.logger.group(
91
+ `QasSingleView - fetchSingle -> payload do parâmetro do ${this.entity}/fetchSingle`,
92
+ [payload]
89
93
  )
90
94
 
95
+ const response = await this.$store.dispatch(`${this.entity}/fetchSingle`, payload)
96
+
91
97
  const { errors, fields, metadata } = response.data
92
98
 
93
99
  this.mx_setErrors(errors)
@@ -100,10 +106,20 @@ export default {
100
106
  metadata: this.mx_metadata
101
107
  })
102
108
 
109
+ this.$qas.logger.group(
110
+ `QasSingleView - fetchSingle -> resposta da action ${this.entity}/fetchSingle`, [response]
111
+ )
112
+
103
113
  this.$emit('fetch-success', response)
104
114
  } catch (error) {
105
115
  this.mx_fetchError(error)
106
116
  this.$emit('fetch-error', error)
117
+
118
+ this.$qas.logger.group(
119
+ `QasSingleView - fetchSingle -> exceção da action ${this.entity}/fetchSingle`,
120
+ [error],
121
+ { error: true }
122
+ )
107
123
  } finally {
108
124
  this.mx_isFetching = false
109
125
  }