@bildvitta/quasar-ui-asteroid 2.14.0 → 3.0.0-alpha.1

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 (188) hide show
  1. package/dist/api/QasBox.json +16 -0
  2. package/dist/api/QasBreakline.json +32 -0
  3. package/dist/api/QasBtn.json +15 -0
  4. package/dist/api/QasDebugger.json +13 -0
  5. package/dist/asteroid.cjs.css +1 -1
  6. package/dist/asteroid.cjs.js +6762 -1400
  7. package/dist/asteroid.cjs.min.js +2 -2
  8. package/dist/asteroid.esm.css +1 -1
  9. package/dist/asteroid.esm.js +6764 -1405
  10. package/dist/asteroid.esm.min.js +2 -2
  11. package/dist/asteroid.umd.css +1 -1
  12. package/dist/asteroid.umd.js +6760 -1405
  13. package/dist/asteroid.umd.min.js +2 -2
  14. package/dist/vetur/asteroid-attributes.json +16 -0
  15. package/dist/vetur/asteroid-tags.json +19 -0
  16. package/package.json +41 -56
  17. package/src/assets/logo-modular.svg +1 -1
  18. package/src/asteroid.js +1 -0
  19. package/src/components/actions/QasActions.vue +45 -0
  20. package/src/components/actions-menu/QasActionsMenu.vue +8 -19
  21. package/src/components/alert/QasAlert.vue +90 -0
  22. package/src/components/app-bar/QasAppBar.vue +16 -13
  23. package/src/components/app-menu/QasAppMenu.vue +10 -7
  24. package/src/components/avatar/QasAvatar.vue +7 -3
  25. package/src/components/box/QasBox.vue +12 -4
  26. package/src/components/box/QasBox.yml +13 -0
  27. package/src/components/breakline/QasBreakline.vue +37 -0
  28. package/src/components/breakline/QasBreakline.yml +25 -0
  29. package/src/components/btn/QasBtn.vue +27 -24
  30. package/src/components/btn/QasBtn.yml +12 -0
  31. package/src/components/card/QasCard.vue +29 -21
  32. package/src/components/checkbox-group/QasCheckboxGroup.vue +31 -17
  33. package/src/components/copy/QasCopy.vue +22 -11
  34. package/src/components/date-time-input/QasDateTimeInput.vue +16 -26
  35. package/src/components/debugger/QasDebugger.vue +2 -0
  36. package/src/components/debugger/QasDebugger.yml +10 -0
  37. package/src/components/delete/QasDelete.vue +28 -15
  38. package/src/components/dialog/QasDialog.vue +71 -67
  39. package/src/components/dialog-router/QasDialogRouter.vue +12 -4
  40. package/src/components/field/QasField.vue +16 -19
  41. package/src/components/filters/QasFilters.vue +31 -24
  42. package/src/components/form-generator/QasFormGenerator.vue +13 -15
  43. package/src/components/form-view/QasFormView.vue +117 -66
  44. package/src/components/gallery/QasGallery.vue +39 -26
  45. package/src/components/grid-generator/QasGridGenerator.vue +12 -6
  46. package/src/components/index.js +0 -0
  47. package/src/components/input/QasInput.vue +38 -36
  48. package/src/components/label/QasLabel.vue +14 -15
  49. package/src/components/layout/QasLayout.vue +13 -21
  50. package/src/components/list-items/QasListItems.vue +16 -8
  51. package/src/components/list-view/QasListView.vue +31 -28
  52. package/src/components/map/QasMap.vue +15 -25
  53. package/src/components/nested-fields/QasNestedFields.vue +39 -36
  54. package/src/components/numeric-input/QasNumericInput.vue +24 -21
  55. package/src/components/page-header/QasPageHeader.vue +19 -10
  56. package/src/components/password-input/QasPasswordInput.vue +20 -18
  57. package/src/components/password-strength-checker/QasPasswordStrengthChecker.vue +52 -31
  58. package/src/components/profile/QasProfile.vue +14 -12
  59. package/src/components/resizer/QasResizer.vue +1 -1
  60. package/src/components/search-box/QasSearchBox.vue +36 -20
  61. package/src/components/select/QasSelect.vue +41 -44
  62. package/src/components/select-list/QasSelectList.vue +64 -51
  63. package/src/components/signature-pad/QasSignaturePad.vue +57 -41
  64. package/src/components/signature-uploader/QasSignatureUploader.vue +15 -13
  65. package/src/components/single-view/QasSingleView.vue +31 -17
  66. package/src/components/sortable/QasSortable.vue +45 -27
  67. package/src/components/table-generator/QasTableGenerator.vue +95 -22
  68. package/src/components/tabs-generator/QasTabsGenerator.vue +36 -24
  69. package/src/components/text-truncate/QasTextTruncate.vue +25 -17
  70. package/src/components/transfer/QasTransfer.vue +57 -53
  71. package/src/components/uploader/QasUploader.vue +169 -48
  72. package/src/css/background.scss +1 -1
  73. package/src/css/border.scss +7 -6
  74. package/src/css/design-system.scss +0 -43
  75. package/src/css/fonts.scss +2 -28
  76. package/src/css/opacity.scss +0 -4
  77. package/src/css/set-brand.scss +15 -0
  78. package/src/css/transitions.scss +1 -1
  79. package/src/helpers/add-counter-suffix.js +3 -0
  80. package/src/helpers/{base64ToBlob.js → base-64-to-blob.js} +0 -0
  81. package/src/helpers/{constructObject.js → construct-object.js} +0 -0
  82. package/src/helpers/filter-object.js +8 -6
  83. package/src/helpers/filters.js +2 -3
  84. package/src/helpers/get-slot-children-text.js +15 -0
  85. package/src/helpers/{greatestCommonDivisor.js → greatest-common-divisor.js} +0 -0
  86. package/src/helpers/images.js +28 -0
  87. package/src/helpers/index.js +11 -59
  88. package/src/helpers/{isLocalDevelopment.js → is-local-development.js} +0 -0
  89. package/src/helpers/scroll-on-grap.js +61 -0
  90. package/src/index.cjs.js +1 -0
  91. package/src/index.esm.js +4 -0
  92. package/src/index.scss +19 -21
  93. package/src/index.umd.js +2 -0
  94. package/src/mixins/context.js +1 -1
  95. package/src/mixins/dialog-router.js +17 -0
  96. package/src/mixins/form.js +4 -12
  97. package/src/mixins/generator.js +14 -14
  98. package/src/mixins/index.js +2 -8
  99. package/src/mixins/password.js +73 -11
  100. package/src/mixins/screen.js +8 -6
  101. package/src/mixins/view.js +57 -20
  102. package/src/plugins/Dialog.js +14 -0
  103. package/src/plugins/NotifySuccess.js +3 -3
  104. package/src/plugins/index.js +4 -2
  105. package/src/store/history.js +43 -0
  106. package/src/store/index.js +1 -0
  107. package/src/vue-plugin.js +185 -0
  108. package/.babelrc +0 -12
  109. package/.storybook/main.js +0 -35
  110. package/.storybook/preview.js +0 -26
  111. package/debug.log +0 -1
  112. package/index.js +0 -4
  113. package/jest-setup.js +0 -1
  114. package/jest.config.json +0 -22
  115. package/postcss.config.js +0 -5
  116. package/src/components/Introduction.stories.mdx +0 -12
  117. package/src/components/actions-menu/QasActionsMenu.stories.js +0 -73
  118. package/src/components/app-bar/QasAppBar.stories.js +0 -84
  119. package/src/components/app-menu/QasAppMenu.stories.js +0 -66
  120. package/src/components/apps-menu/QasAppsMenu.spec.js +0 -58
  121. package/src/components/apps-menu/QasAppsMenu.stories.js +0 -54
  122. package/src/components/apps-menu/QasAppsMenu.vue +0 -48
  123. package/src/components/avatar/QasAvatar.spec.js +0 -14
  124. package/src/components/avatar/QasAvatar.stories.js +0 -52
  125. package/src/components/box/QasBox.spec.js +0 -18
  126. package/src/components/box/QasBox.stories.js +0 -35
  127. package/src/components/break-line/QasBreakLine.stories.js +0 -57
  128. package/src/components/break-line/QasBreakLine.vue +0 -52
  129. package/src/components/btn/QasBtn.stories.js +0 -45
  130. package/src/components/btn-actions/QasBtnActions.stories.js +0 -77
  131. package/src/components/btn-actions/QasBtnActions.vue +0 -54
  132. package/src/components/card/QasCard.stories.js +0 -126
  133. package/src/components/checkbox-group/QasCheckboxGroup.stories.js +0 -59
  134. package/src/components/copy/QasCopy.stories.js +0 -41
  135. package/src/components/date-time-input/QasDateTimeInput.stories.js +0 -67
  136. package/src/components/debugger/QasDebugger.stories.js +0 -33
  137. package/src/components/delete/QasDelete.stories.js +0 -80
  138. package/src/components/dialog/QasDialog.stories.js +0 -139
  139. package/src/components/dialog-router/QasDialogRouter.stories.js +0 -38
  140. package/src/components/field/QasField.stories.js +0 -181
  141. package/src/components/filters/QasFilters.stories.js +0 -121
  142. package/src/components/form-generator/QasFormGenerator.stories.js +0 -115
  143. package/src/components/form-view/QasFormView.stories.js +0 -236
  144. package/src/components/gallery/QasGallery.stories.js +0 -91
  145. package/src/components/grid-generator/QasGridGenerator.stories.js +0 -138
  146. package/src/components/input/QasInput.stories.js +0 -78
  147. package/src/components/label/QasLabel.stories.js +0 -60
  148. package/src/components/layout/QasLayout.stories.js +0 -104
  149. package/src/components/list-items/QasListItems.stories.js +0 -130
  150. package/src/components/list-view/QasListView.stories.js +0 -168
  151. package/src/components/map/QasMap.stories.js +0 -75
  152. package/src/components/nested-fields/QasNestedFields.stories.js +0 -255
  153. package/src/components/numeric-input/QasNumericInput.stories.js +0 -92
  154. package/src/components/page-header/QasPageHeader.stories.js +0 -61
  155. package/src/components/password-input/QasPasswordInput.stories.js +0 -76
  156. package/src/components/password-strength-checker/QasPasswordStrengthChecker.stories.js +0 -54
  157. package/src/components/profile/QasProfile.stories.js +0 -131
  158. package/src/components/resizer/QasResizer.stories.js +0 -43
  159. package/src/components/search-box/QasSearchBox.stories.js +0 -111
  160. package/src/components/select/QasSelect.stories.js +0 -113
  161. package/src/components/select-list/QasSelectList.stories.js +0 -153
  162. package/src/components/signature-pad/QasSignaturePad.stories.js +0 -51
  163. package/src/components/signature-uploader/QasSignatureUploader.stories.js +0 -69
  164. package/src/components/single-view/QasSingleView.stories.js +0 -130
  165. package/src/components/sortable/QasSortable.stories.js +0 -80
  166. package/src/components/table-generator/QasTableGenerator.stories.js +0 -116
  167. package/src/components/tabs-generator/QasTabsGenerator.stories.js +0 -145
  168. package/src/components/text-truncate/QasTextTruncate.stories.js +0 -55
  169. package/src/components/tip/QasTip.stories.js +0 -57
  170. package/src/components/tip/QasTip.vue +0 -68
  171. package/src/components/tooltip/QasTooltip.stories.js +0 -63
  172. package/src/components/tooltip/QasTooltip.vue +0 -81
  173. package/src/components/transfer/QasTransfer.stories.js +0 -118
  174. package/src/components/uploader/QasCustomUploader.vue +0 -121
  175. package/src/components/uploader/QasUploader.stories.js +0 -139
  176. package/src/directives/Test.js +0 -13
  177. package/src/helpers/historyHandler.js +0 -52
  178. package/src/helpers/label.js +0 -3
  179. package/src/index.js +0 -249
  180. package/src/mixins/map-markers.js +0 -26
  181. package/src/mixins/unsaved-changes.js +0 -24
  182. package/src/mixins/uploader.js +0 -30
  183. package/src/mocks/json/user.json +0 -27
  184. package/src/mocks/json/users-new.json +0 -23
  185. package/src/mocks/json/users.json +0 -97
  186. package/src/mocks/storeModule.js +0 -71
  187. package/src/pages/Forbidden.vue +0 -6
  188. package/src/pages/NotFound.vue +0 -6
@@ -1,22 +1,24 @@
1
1
  <template>
2
- <div>
3
- <q-field v-model="model" v-bind="$attrs">
4
- <template #control="{ emitValue, floatingLabel, id, value: modelValue }">
5
- <input v-show="floatingLabel" :id="id" ref="input" class="q-field__input" :model-value="modelValue" @input="emitValue($event.target.value)">
6
- </template>
7
- </q-field>
8
- </div>
2
+ <q-field v-model="model">
3
+ <template #control="{ emitValue, floatingLabel, id, value }">
4
+ <input v-show="floatingLabel" :id="id" ref="input" class="q-field__input" :model-value="value" @input="emitValue($event.target.value)">
5
+ </template>
6
+ </q-field>
9
7
  </template>
10
8
 
11
9
  <script>
10
+ import AutoNumeric from 'autonumeric'
11
+
12
12
  const defaultModes = {
13
- integer: ['commaDecimalCharDotSeparator', 'integer'],
14
13
  decimal: 'commaDecimalCharDotSeparator',
15
- percent: 'percentageEU2dec',
16
- money: 'Brazilian'
14
+ integer: ['commaDecimalCharDotSeparator', 'integer'],
15
+ money: 'Brazilian',
16
+ percent: 'percentageEU2dec'
17
17
  }
18
18
 
19
19
  export default {
20
+ name: 'QasNumericInput',
21
+
20
22
  props: {
21
23
  allowNegative: {
22
24
  default: true,
@@ -44,19 +46,21 @@ export default {
44
46
  validator: value => ['integer', 'decimal', 'percent', 'money'].includes(value)
45
47
  },
46
48
 
47
- preset: {
48
- default: false,
49
- type: [Boolean, String]
50
- },
51
-
52
- value: {
49
+ modelValue: {
53
50
  default: '',
54
51
  validator (value) {
55
52
  return typeof value === 'number' || typeof value === 'string' || value === '' || value === null
56
53
  }
54
+ },
55
+
56
+ preset: {
57
+ default: false,
58
+ type: [Boolean, String]
57
59
  }
58
60
  },
59
61
 
62
+ emits: ['update:modelValue'],
63
+
60
64
  data () {
61
65
  return {
62
66
  autoNumeric: null
@@ -70,17 +74,16 @@ export default {
70
74
 
71
75
  model: {
72
76
  get () {
73
- return this.value
77
+ return this.modelValue
74
78
  },
75
79
 
76
80
  set () {
77
- this.$emit('input', this.autoNumeric.getNumber())
81
+ this.$emit('update:modelValue', this.autoNumeric.getNumber())
78
82
  }
79
83
  }
80
84
  },
81
85
 
82
86
  async created () {
83
- const AutoNumeric = (await import('autonumeric')).default
84
87
  const autoNumericPredefinedOptions = AutoNumeric.getPredefinedOptions()
85
88
 
86
89
  let option = this.preset || this.defaultMode
@@ -110,12 +113,12 @@ export default {
110
113
  Object.assign(options, this.autonumericProps)
111
114
 
112
115
  this.$nextTick(() => {
113
- this.$refs.input.value = this.value
116
+ this.$refs.input.value = this.modelValue
114
117
  this.autoNumeric = new AutoNumeric(this.$refs.input, options)
115
118
  })
116
119
  },
117
120
 
118
- beforeDestroy () {
121
+ beforeUnmount () {
119
122
  this.autoNumeric.remove()
120
123
  }
121
124
  }
@@ -6,28 +6,29 @@
6
6
  {{ title }}
7
7
  </q-toolbar-title>
8
8
 
9
- <q-breadcrumbs v-if="!noBreadcrumbs" class="text-caption text-grey-6">
10
- <q-breadcrumbs-el v-for="item in transformedBreadcrumbs" :key="item.label" :label="item.label" :to="item.route" />
9
+ <q-breadcrumbs v-if="useBreadcrumbs" class="text-caption" separator-color="grey-7">
10
+ <q-breadcrumbs-el v-for="(item, index) in transformedBreadcrumbs" :key="item.label" :class="getBreadcrumbsClass(index)" :label="item.label" :to="item.route" />
11
11
  </q-breadcrumbs>
12
12
  </div>
13
-
14
13
  <slot />
15
14
  </q-toolbar>
16
15
  </template>
17
16
 
18
17
  <script>
19
- import { castArray, get } from 'lodash'
20
- import { history, handleHistory } from '../../helpers/historyHandler'
18
+ import { castArray } from 'lodash-es'
19
+ import { history, getPreviousRoute } from '../../store/history'
21
20
 
22
21
  export default {
22
+ name: 'QasPageHeader',
23
+
23
24
  props: {
24
25
  breadcrumbs: {
25
26
  default: '',
26
27
  type: [Array, Boolean, String]
27
28
  },
28
29
 
29
- noBreadcrumbs: {
30
- default: false,
30
+ useBreadcrumbs: {
31
+ default: true,
31
32
  type: Boolean
32
33
  },
33
34
 
@@ -60,8 +61,10 @@ export default {
60
61
  item.route = { name: item.routeName }
61
62
  }
62
63
 
63
- if (this.$history && get(item, 'route.name')) {
64
- const previous = this.$history.find(history => history.name === item.route.name)
64
+ const historyList = history.list
65
+
66
+ if (historyList.length && item?.route?.name) {
67
+ const previous = historyList.find(history => history.name === item.route.name)
65
68
  item.route.query = previous ? previous.query : null
66
69
  }
67
70
 
@@ -72,7 +75,13 @@ export default {
72
75
 
73
76
  methods: {
74
77
  back () {
75
- this.$router.push(handleHistory().getPreviousRoute(this.$route))
78
+ this.$router.push(getPreviousRoute(this.$route))
79
+ },
80
+
81
+ getBreadcrumbsClass (index) {
82
+ const lastIndex = this.transformedBreadcrumbs.length - 1
83
+
84
+ return lastIndex === index ? 'text-grey-7' : 'text-primary'
76
85
  }
77
86
  },
78
87
 
@@ -1,17 +1,15 @@
1
1
  <template>
2
- <q-input ref="mask" v-model="model" v-bind="$attrs" bottom-slots :type="type" v-on="events">
3
- <template v-if="!hideStrengthChecker" #hint>
4
- <qas-password-strength-checker v-bind="$props" @password-success="onSuccess" />
5
- </template>
6
-
2
+ <q-input v-model="model" bottom-slots :type="type">
7
3
  <template #append>
8
4
  <q-icon class="cursor-pointer" :color="iconColor" :name="icon" @click="toggle" />
9
5
  </template>
10
6
 
11
- <slot v-for="(slot, key) in $slots" :slot="key" :name="key" />
7
+ <template v-for="(_, name) in $slots" #[name]="context">
8
+ <slot :name="name" v-bind="context || {}" />
9
+ </template>
12
10
 
13
- <template v-for="(slot, key) in $scopedSlots" :slot="key" slot-scope="scope">
14
- <slot :name="key" v-bind="scope" />
11
+ <template v-if="!hideStrengthChecker" #hint>
12
+ <qas-password-strength-checker v-bind="strengthCheckerProps" :password="model" />
15
13
  </template>
16
14
  </q-input>
17
15
  </template>
@@ -21,6 +19,8 @@ import passwordMixin from '../../mixins/password.js'
21
19
  import QasPasswordStrengthChecker from '../password-strength-checker/QasPasswordStrengthChecker.vue'
22
20
 
23
21
  export default {
22
+ name: 'QasPasswordInput',
23
+
24
24
  components: {
25
25
  QasPasswordStrengthChecker
26
26
  },
@@ -37,46 +37,48 @@ export default {
37
37
  default: 'primary'
38
38
  },
39
39
 
40
- value: {
40
+ modelValue: {
41
41
  type: String,
42
42
  default: ''
43
43
  }
44
44
  },
45
45
 
46
+ emits: ['update:modelValue'],
47
+
46
48
  data () {
47
49
  return {
50
+ key: 'error',
48
51
  toggleType: true
49
52
  }
50
53
  },
51
54
 
52
55
  computed: {
53
- events () {
54
- const { input, ...events } = this.$listeners
55
-
56
- return events
57
- },
58
-
59
56
  icon () {
60
57
  return this.toggleType ? 'o_visibility_off' : 'o_visibility'
61
58
  },
62
59
 
63
60
  model: {
64
61
  get () {
65
- return this.value
62
+ return this.modelValue
66
63
  },
67
64
 
68
65
  set (value) {
69
- return this.$emit('input', value)
66
+ return this.$emit('update:modelValue', value)
70
67
  }
71
68
  },
72
69
 
70
+ strengthCheckerProps () {
71
+ const { modelValue, ...props } = this.$props
72
+ return props
73
+ },
74
+
73
75
  type () {
74
76
  return this.toggleType ? 'password' : 'text'
75
77
  }
76
78
  },
77
79
 
78
80
  watch: {
79
- value () {
81
+ modelValue () {
80
82
  if (this.$attrs.error) {
81
83
  this.$attrs.error = false
82
84
  this.$attrs.errorMessage = ''
@@ -1,7 +1,9 @@
1
1
  <template>
2
2
  <div v-if="length">
3
- <q-linear-progress :color="option.color" rounded :track-color="trackColor" :value="option.progress" />
4
- <div class="q-mt-xs text-subtitle2" :class="option.textClass">{{ option.label }}</div>
3
+ <slot :level="level">
4
+ <q-linear-progress :color="level.color" :track-color="trackColor" :value="level.progress" />
5
+ <div class="text-caption" :class="level.textClass">{{ level.label }}</div>
6
+ </slot>
5
7
  </div>
6
8
  </template>
7
9
 
@@ -9,56 +11,75 @@
9
11
  import passwordMixin from '../../mixins/password.js'
10
12
 
11
13
  export default {
14
+ name: 'QasPasswordStrengthChecker',
15
+
12
16
  mixins: [passwordMixin],
13
17
 
14
18
  props: {
15
- trackColor: {
16
- default: 'blue-grey-1',
17
- type: String
19
+ modelValue: {
20
+ default: false,
21
+ type: Boolean
18
22
  },
19
23
 
20
- value: {
24
+ password: {
21
25
  default: '',
22
26
  type: String
23
27
  }
24
28
  },
25
29
 
30
+ emits: ['update:model-value'],
31
+
26
32
  computed: {
27
33
  length () {
28
- return (this.value || '').length
34
+ return this.password.length
29
35
  },
30
36
 
31
- option () {
32
- if (this.value.match(this.pattern)) {
33
- return {
34
- color: 'positive',
35
- label: 'Forte',
36
- progress: 1,
37
- textClass: 'text-positive'
38
- }
39
- }
37
+ level () {
38
+ return this.levelsValues[this.score]
39
+ },
40
40
 
41
- if (this.length >= this.weak) {
42
- return {
43
- color: 'warning',
44
- label: 'Fraca',
45
- progress: 0.5,
46
- textClass: 'text-warning'
47
- }
48
- }
41
+ levelsValues () {
42
+ return Object.values(this.levels)
43
+ },
44
+
45
+ score () {
46
+ let score = 0
47
+
48
+ if (this.length >= parseInt(this.minlength)) {
49
+ score += this.useLowercase
50
+ ? (this.password.match(/[a-z]/g) ? 1 : 0)
51
+ : 1
49
52
 
50
- return {
51
- color: 'negative',
52
- label: 'Muito fraca',
53
- progress: 0.25,
54
- textClass: 'text-negative'
53
+ score += this.useNumbers
54
+ ? (this.password.match(/[0-9]/g) ? 1 : 0)
55
+ : 1
56
+
57
+ score += this.useSpecial
58
+ ? (this.password.match(this.specials) ? 1 : 0)
59
+ : 1
60
+
61
+ score += this.useUppercase
62
+ ? (this.password.match(/[A-Z]/g) ? 1 : 0)
63
+ : 1
55
64
  }
65
+
66
+ return score
56
67
  }
57
68
  },
58
69
 
59
70
  watch: {
60
- isSuccess (value) {
61
- value && this.onSuccess()
71
+ password () {
72
+ this.emitValue()
73
+ }
74
+ },
75
+
76
+ created () {
77
+ this.emitValue()
78
+ },
79
+
80
+ methods: {
81
+ emitValue () {
82
+ this.$emit('update:model-value', this.score === 4)
62
83
  }
63
84
  }
64
85
  }
@@ -4,7 +4,7 @@
4
4
  <div class="col-lg-5 col-xs-12">
5
5
  <div class="no-wrap q-col-gutter-md" :class="directionClasses">
6
6
  <div class="justify-center lg:q-mb-none md:q-mr-lg row xs:q-mb-md">
7
- <qas-avatar :image="userAvatarImage" :size="getAvatarSize" :title="title" />
7
+ <qas-avatar :image="userAvatarImage" :size="avatarSize" :title="title" />
8
8
  </div>
9
9
  <slot>
10
10
  <h6 class="text-bold text-h6">{{ title }}</h6>
@@ -13,7 +13,11 @@
13
13
  </div>
14
14
  </div>
15
15
  <slot name="grid">
16
- <qas-grid-generator class="col-lg-7 col-xs-12 items-center" :columns="columns" :fields="filterObject(fields, list)" hide-empty-result :result="result" />
16
+ <qas-grid-generator class="col-lg-7 col-xs-12 items-center" :columns="columns" :fields="filterObject(fields, list)" hide-empty-result :result="result">
17
+ <template v-for="(_, name) in $slots" #[name]="context">
18
+ <slot :name="name" v-bind="context || {}" />
19
+ </template>
20
+ </qas-grid-generator>
17
21
  </slot>
18
22
  </div>
19
23
  </component>
@@ -23,11 +27,13 @@
23
27
  import filterObject from '../../helpers/filter-object'
24
28
  import screenMixin from '../../mixins/screen'
25
29
 
26
- import QasAvatar from '../avatar/QasAvatar'
27
- import QasBox from '../box/QasBox'
28
- import QasGridGenerator from '../grid-generator/QasGridGenerator'
30
+ import QasAvatar from '../avatar/QasAvatar.vue'
31
+ import QasBox from '../box/QasBox.vue'
32
+ import QasGridGenerator from '../grid-generator/QasGridGenerator.vue'
29
33
 
30
34
  export default {
35
+ name: 'QasProfile',
36
+
31
37
  components: {
32
38
  QasAvatar,
33
39
  QasBox,
@@ -47,10 +53,6 @@ export default {
47
53
  default: () => ({})
48
54
  },
49
55
 
50
- hideStatus: {
51
- type: Boolean
52
- },
53
-
54
56
  list: {
55
57
  type: Array,
56
58
  default: () => ([])
@@ -80,15 +82,15 @@ export default {
80
82
 
81
83
  computed: {
82
84
  directionClasses () {
83
- return this.$_untilMedium ? 'col' : 'row items-center'
85
+ return this.mx_untilMedium ? 'col' : 'row items-center'
84
86
  },
85
87
 
86
88
  userAvatarImage () {
87
89
  return this.result.image
88
90
  },
89
91
 
90
- getAvatarSize () {
91
- return this.$_isSmall ? '145px' : '188px'
92
+ avatarSize () {
93
+ return this.mx_isSmall ? '145px' : '188px'
92
94
  }
93
95
  },
94
96
 
@@ -40,7 +40,7 @@ export default {
40
40
 
41
41
  imageParameters () {
42
42
  const parameters = {
43
- bucket: this.$environment?.bucket,
43
+ bucket: process.env.BUCKET,
44
44
  key: this.source,
45
45
  edits: {}
46
46
  }
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <qas-box v-bind="$attrs">
2
+ <qas-box>
3
3
  <q-input v-model="search" clearable :disable="!list.length" outlined :placeholder="placeholder">
4
4
  <template #append>
5
5
  <q-icon color="primary" name="o_search" />
@@ -7,9 +7,9 @@
7
7
  </q-input>
8
8
 
9
9
  <div class="overflow-auto q-mt-xs relative-position" :style="contentStyle">
10
- <slot v-if="hasResults" :results="results" />
10
+ <slot v-if="hasResults" :results="normalizedResults" />
11
11
 
12
- <slot v-else-if="!hideEmptySlot" name="empty">
12
+ <slot v-else-if="useEmptySlot" name="empty-result">
13
13
  <div class="absolute-center text-center">
14
14
  <q-icon class="q-mb-sm text-center" color="primary" name="o_search" size="38px" />
15
15
  <div>Não há resultados disponíveis.</div>
@@ -20,11 +20,13 @@
20
20
  </template>
21
21
 
22
22
  <script>
23
- import QasBox from '../box/QasBox.vue'
24
-
25
23
  import Fuse from 'fuse.js'
26
24
 
25
+ import QasBox from '../box/QasBox.vue'
26
+
27
27
  export default {
28
+ name: 'QasSearchBox',
29
+
28
30
  components: {
29
31
  QasBox
30
32
  },
@@ -45,26 +47,29 @@ export default {
45
47
  type: String
46
48
  },
47
49
 
48
- hideEmptySlot: {
49
- type: Boolean
50
- },
51
-
52
50
  list: {
53
51
  default: () => [],
54
52
  type: Array
55
53
  },
56
54
 
55
+ modelValue: {
56
+ default: '',
57
+ type: String
58
+ },
59
+
57
60
  placeholder: {
58
61
  default: 'Pesquisar',
59
62
  type: String
60
63
  },
61
64
 
62
- value: {
63
- default: '',
64
- type: String
65
+ useEmptySlot: {
66
+ default: true,
67
+ type: Boolean
65
68
  }
66
69
  },
67
70
 
71
+ emits: ['empty-result', 'update:modelValue'],
72
+
68
73
  data () {
69
74
  return {
70
75
  fuse: null,
@@ -94,6 +99,10 @@ export default {
94
99
 
95
100
  hasResults () {
96
101
  return !!this.results.length
102
+ },
103
+
104
+ normalizedResults () {
105
+ return this.results.map(result => result?.item) || []
97
106
  }
98
107
  },
99
108
 
@@ -103,32 +112,39 @@ export default {
103
112
  },
104
113
 
105
114
  hasResults (value) {
106
- !value && this.$emit('emptyResult')
115
+ !value && this.$emit('empty-result')
107
116
  },
108
117
 
109
- list (value) {
110
- this.fuse.list = value
111
- this.setResults(this.search)
118
+ list: {
119
+ handler (value) {
120
+ this.fuse.list = value
121
+ this.setResults(this.search)
122
+ },
123
+
124
+ deep: true
112
125
  },
113
126
 
114
127
  search: {
115
128
  handler (value) {
116
129
  this.setResults(value)
117
- this.$emit('input', value)
130
+ this.$emit('update:modelValue', value)
118
131
  },
119
132
 
120
133
  immediate: true
121
134
  }
122
135
  },
123
136
 
124
- created () {
125
- this.search = this.value
137
+ async created () {
138
+ this.search = this.modelValue
126
139
  this.fuse = new Fuse(this.list, this.defaultFuseOptions)
140
+ this.setResults()
127
141
  },
128
142
 
129
143
  methods: {
130
144
  setResults (value) {
131
- this.results = value ? this.fuse.search(value) : this.list
145
+ this.results = value
146
+ ? this.fuse.search(value)
147
+ : this.list.map(listItem => ({ item: listItem }))
132
148
  }
133
149
  }
134
150
  }