@bildvitta/quasar-ui-asteroid 3.16.1 → 3.17.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.
Files changed (50) hide show
  1. package/package.json +1 -1
  2. package/src/components/badge/QasBadge.vue +51 -3
  3. package/src/components/badge/QasBadge.yml +29 -2
  4. package/src/components/box/QasBox.vue +26 -3
  5. package/src/components/box/QasBox.yml +16 -0
  6. package/src/components/card/QasCard.vue +38 -25
  7. package/src/components/chart-view/QasChartView.vue +13 -13
  8. package/src/components/{checkbox-group/QasCheckboxGroup.vue → checkbox/QasCheckbox.vue} +34 -12
  9. package/src/components/date-time-input/QasDateTimeInput.vue +13 -3
  10. package/src/components/field/QasField.vue +18 -13
  11. package/src/components/filters/QasFilters.vue +16 -7
  12. package/src/components/filters/private/PvFiltersButton.vue +2 -1
  13. package/src/components/form-generator/QasFormGenerator.vue +62 -26
  14. package/src/components/form-generator/QasFormGenerator.yml +21 -2
  15. package/src/components/gallery-card/QasGalleryCard.vue +10 -3
  16. package/src/components/grid-generator/QasGridGenerator.vue +22 -13
  17. package/src/components/grid-generator/QasGridGenerator.yml +18 -2
  18. package/src/components/grid-item/QasGridItem.vue +89 -0
  19. package/src/components/grid-item/QasGridItem.yml +22 -0
  20. package/src/components/header/QasHeader.vue +106 -0
  21. package/src/components/header/QasHeader.yml +45 -0
  22. package/src/components/info/QasInfo.vue +155 -0
  23. package/src/components/info/QasInfo.yml +34 -0
  24. package/src/components/input/QasInput.vue +48 -3
  25. package/src/components/input/QasInput.yml +10 -0
  26. package/src/components/nested-fields/QasNestedFields.vue +58 -47
  27. package/src/components/nested-fields/QasNestedFields.yml +5 -0
  28. package/src/components/numeric-input/QasNumericInput.vue +38 -3
  29. package/src/components/numeric-input/QasNumericInput.yml +10 -0
  30. package/src/components/page-header/QasPageHeader.vue +5 -5
  31. package/src/components/page-header/QasPageHeader.yml +2 -2
  32. package/src/components/radio/QasRadio.vue +43 -0
  33. package/src/components/radio/QasRadio.yml +5 -0
  34. package/src/components/search-input/QasSearchInput.vue +7 -19
  35. package/src/components/select/QasSelect.vue +82 -10
  36. package/src/components/table-generator/QasTableGenerator.vue +2 -5
  37. package/src/components/tabs-generator/QasTabsGenerator.vue +3 -1
  38. package/src/components/toggle/QasToggle.vue +14 -0
  39. package/src/components/toggle/QasToggle.yml +5 -0
  40. package/src/composables/private/use-generator.js +9 -1
  41. package/src/css/components/checkbox.scss +2 -0
  42. package/src/css/components/field.scss +59 -2
  43. package/src/css/components/radio.scss +3 -1
  44. package/src/css/components/toggle.scss +3 -1
  45. package/src/helpers/get-placeholder.js +19 -0
  46. package/src/helpers/index.js +1 -0
  47. package/src/vue-plugin.js +18 -6
  48. package/src/components/header-actions/QasHeaderActions.vue +0 -76
  49. package/src/components/header-actions/QasHeaderActions.yml +0 -38
  50. /package/src/components/{checkbox-group/QasCheckboxGroup.yml → checkbox/QasCheckbox.yml} +0 -0
@@ -1,8 +1,9 @@
1
1
  <template>
2
- <div class="qas-filter-input">
3
- <qas-input ref="input" v-model="model" v-bind="$attrs" class="bg-white rounded-borders-sm" data-cy="search-input" :debounce="debounce" dense hide-bottom-space input-class="ellipsis text-grey-8" inputmode="search" type="search">
2
+ <qas-box class="qas-search-input" :use-spacing="false">
3
+ <qas-input ref="input" v-model="model" class="qas-search-input__input" v-bind="$attrs" data-cy="search-input" :debounce="debounce" dense hide-bottom-space input-class="ellipsis text-grey-8" inputmode="search" outlined type="search">
4
4
  <template #prepend>
5
5
  <q-icon v-if="useSearchOnType" color="grey-8" name="sym_r_search" />
6
+
6
7
  <qas-btn v-else color="grey-10" icon="sym_r_search" variant="tertiary" @click="$emit('filter')" />
7
8
  </template>
8
9
 
@@ -12,7 +13,7 @@
12
13
  <slot name="after-clear" />
13
14
  </template>
14
15
  </qas-input>
15
- </div>
16
+ </qas-box>
16
17
  </template>
17
18
 
18
19
  <script>
@@ -78,22 +79,9 @@ export default {
78
79
  </script>
79
80
 
80
81
  <style lang="scss">
81
- .qas-filter-input {
82
- position: relative;
83
-
84
- .q-field {
85
- &--dense .q-field__prepend {
86
- padding-right: var(--qas-spacing-xs);
87
- }
88
-
89
- &--dense .q-field__append {
90
- padding-left: var(--qas-spacing-sm);
91
- }
92
-
93
- &__native {
94
- padding-bottom: var(--qas-spacing-sm);
95
- padding-top: var(--qas-spacing-sm);
96
- }
82
+ .qas-search-input {
83
+ .qas-search-input__input .q-field__control:before {
84
+ border: 0;
97
85
  }
98
86
  }
99
87
  </style>
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <q-select v-model="model" v-bind="attributes">
2
+ <q-select v-model="model" v-bind="attributes" class="qas-select" :class="componentClasses" no-error-icon :outlined="false">
3
3
  <template v-if="isSearchable" #prepend>
4
4
  <q-icon name="sym_r_search" />
5
5
  </template>
@@ -22,6 +22,14 @@
22
22
  </slot>
23
23
  </template>
24
24
 
25
+ <template v-if="attributes.useChips" #selected-item="{ opt, tabindex, index, removeAtIndex }">
26
+ <qas-badge removable :tabindex @remove="removeAtIndex(index)">
27
+ <div class="ellipsis" :title="opt.label">
28
+ {{ opt.label }}
29
+ </div>
30
+ </qas-badge>
31
+ </template>
32
+
25
33
  <template v-for="(_, name) in $slots" #[name]="context">
26
34
  <slot :name="name" v-bind="context || {}" />
27
35
  </template>
@@ -30,11 +38,12 @@
30
38
 
31
39
  <script>
32
40
  import { getRequiredLabel } from '../../helpers'
33
- import { uid } from 'quasar'
34
41
  import { searchFilterMixin } from '../../mixins'
35
- import Fuse from 'fuse.js'
36
42
  import fuseConfig from '../../shared/fuse-config'
37
43
 
44
+ import { uid } from 'quasar'
45
+ import Fuse from 'fuse.js'
46
+
38
47
  export default {
39
48
  name: 'QasSelect',
40
49
 
@@ -97,12 +106,15 @@ export default {
97
106
  computed: {
98
107
  attributes () {
99
108
  return {
100
- class: 'qas-select',
101
109
  clearable: this.isSearchable,
102
110
  emitValue: true,
103
111
  mapOptions: true,
104
112
  outlined: true,
105
- popupContentClass: this.popupContentClass,
113
+ dense: true,
114
+ dropdownIcon: 'sym_r_expand_more',
115
+ clearIcon: 'sym_r_close',
116
+ popupContentClass: `qas-select__menu ${this.popupContentClass}`,
117
+ useChips: this.isMultiple && this.isPopupContentOpen,
106
118
 
107
119
  ...this.$attrs,
108
120
 
@@ -115,11 +127,10 @@ export default {
115
127
 
116
128
  ...(this.isSearchable && { onFilter: this.onFilter }),
117
129
 
118
- ...(this.useLazyLoading && {
119
- onPopupHide: this.onPopupHide,
120
- onPopupShow: this.onPopupShow,
121
- onVirtualScroll: this.mx_onVirtualScroll
122
- })
130
+ onPopupHide: this.onPopupHide,
131
+ onPopupShow: this.onPopupShow,
132
+
133
+ ...(this.useLazyLoading && { onVirtualScroll: this.mx_onVirtualScroll })
123
134
  }
124
135
  },
125
136
 
@@ -174,6 +185,27 @@ export default {
174
185
 
175
186
  formattedLabel () {
176
187
  return getRequiredLabel({ label: this.label, required: this.required })
188
+ },
189
+
190
+ // redesign
191
+ componentClasses () {
192
+ return {
193
+ 'qas-select--has-icon': this.isSearchable || this.hasAppend,
194
+ 'qas-select--closed': !this.isPopupContentOpen,
195
+ 'qas-select--loading': this.hasLoading
196
+ }
197
+ },
198
+
199
+ isDisabled () {
200
+ return this.$attrs.disable || this.$attrs.disable === ''
201
+ },
202
+
203
+ isMultiple () {
204
+ return this.$attrs.multiple || this.$attrs.multiple === ''
205
+ },
206
+
207
+ hasAppend () {
208
+ return !!this.$slots.append
177
209
  }
178
210
  },
179
211
 
@@ -289,5 +321,45 @@ export default {
289
321
  }
290
322
  }
291
323
  }
324
+
325
+ &__menu {
326
+ .q-item {
327
+ font-weight: 400 !important;
328
+ }
329
+ }
330
+
331
+ &--closed {
332
+ .q-field__native span {
333
+ white-space: nowrap;
334
+ overflow: hidden;
335
+ text-overflow: ellipsis;
336
+ }
337
+
338
+ &:not(.qas-select--loading) {
339
+ .q-field__native .q-field__input {
340
+ position: absolute;
341
+ caret-color: transparent;
342
+ }
343
+ }
344
+ }
345
+
346
+ .q-field__prepend,
347
+ .q-field__append {
348
+ .q-icon {
349
+ color: $grey-8;
350
+ }
351
+ }
352
+
353
+ .q-field__focusable-action {
354
+ opacity: 1;
355
+ }
356
+
357
+ .q-chip {
358
+ font-size: 11px;
359
+ }
360
+
361
+ .q-chip__icon--remove {
362
+ opacity: 1;
363
+ }
292
364
  }
293
365
  </style>
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <component :is="parentComponent.is" v-bind="parentComponent.props">
2
+ <component :is="parentComponent.is">
3
3
  <q-table ref="table" class="bg-white qas-table-generator text-grey-8" v-bind="attributes">
4
4
  <template v-for="(_, name) in slots" #[name]="context">
5
5
  <slot :name="name" v-bind="context" />
@@ -226,10 +226,7 @@ export default {
226
226
 
227
227
  parentComponent () {
228
228
  return {
229
- is: this.useBox ? 'qas-box' : 'div',
230
- props: {
231
- class: this.useBox ? 'q-px-lg q-py-md' : ''
232
- }
229
+ is: this.useBox ? 'qas-box' : 'div'
233
230
  }
234
231
  }
235
232
  },
@@ -21,6 +21,8 @@
21
21
  <script setup>
22
22
  import QasStatus from '../status/QasStatus.vue'
23
23
 
24
+ import { decimal } from '../../helpers'
25
+
24
26
  import { computed } from 'vue'
25
27
  import { extend } from 'quasar'
26
28
 
@@ -87,7 +89,7 @@ function getFormattedLabel ({ label, counter, value }) {
87
89
 
88
90
  if (!normalizedCount) return label
89
91
 
90
- const countString = String(normalizedCount)
92
+ const countString = String(decimal(normalizedCount))
91
93
 
92
94
  return `${label} (${countString.padStart(2, '0')})`
93
95
  }
@@ -0,0 +1,14 @@
1
+ <template>
2
+ <q-toggle v-bind="attrs" dense />
3
+ </template>
4
+
5
+ <script setup>
6
+ import { useAttrs } from 'vue'
7
+
8
+ defineOptions({
9
+ name: 'QasToggle',
10
+ inheritAttrs: false
11
+ })
12
+
13
+ const attrs = useAttrs()
14
+ </script>
@@ -0,0 +1,5 @@
1
+ type: component
2
+
3
+ meta:
4
+ desc: Componente wrapper do QToggle.
5
+
@@ -75,12 +75,19 @@ export default function ({ props = {} }) {
75
75
  : _handleColumnsByField({ index, isGridGenerator })
76
76
  }
77
77
 
78
+ function getFieldSetColumnClass (column) {
79
+ if (!column) return 'col-12'
80
+
81
+ return typeof column === 'string' ? _getStringColumns(column) : _getBreakpoint(column)
82
+ }
83
+
78
84
  /**
79
85
  * @private
80
86
  */
81
87
  function _getStringColumns (columns) {
82
88
  return IRREGULAR_CLASSES.includes(columns) ? columns : `col-${columns}`
83
89
  }
90
+
84
91
  /**
85
92
  * @private
86
93
  */
@@ -167,6 +174,7 @@ export default function ({ props = {} }) {
167
174
  return {
168
175
  classes,
169
176
 
170
- getFieldClass
177
+ getFieldClass,
178
+ getFieldSetColumnClass
171
179
  }
172
180
  }
@@ -1,6 +1,8 @@
1
1
  .q-checkbox {
2
2
  &__label {
3
3
  @include set-typography($body1);
4
+
5
+ padding-left: var(--qas-spacing-sm) !important;
4
6
  }
5
7
 
6
8
  &.disabled {
@@ -1,14 +1,36 @@
1
1
  .q-field {
2
+ $root: &;
3
+
4
+ .q-field__append,
5
+ .q-field__prepend {
6
+ will-change: transform;
7
+ transition: transform var(--qas-generic-transition);
8
+ }
9
+
10
+ .q-field__label {
11
+ will-change: transform;
12
+ }
13
+
2
14
  &__label,
3
15
  &--dense &__label {
4
- @include set-typography($body1);
16
+ @include set-typography($body2);
17
+ }
18
+
19
+ &--dense {
20
+ .q-textarea {
21
+ height: 100%;
22
+ }
23
+
24
+ .q-icon {
25
+ font-size: 18px !important;
26
+ }
5
27
  }
6
28
 
7
29
  &__native,
8
30
  &__input,
9
31
  &--dense &__native,
10
32
  &--dense &__input {
11
- @include set-typography($body1);
33
+ @include set-typography($body2);
12
34
 
13
35
  color: $grey-10;
14
36
 
@@ -17,6 +39,41 @@
17
39
  }
18
40
  }
19
41
 
42
+ // Somente fields com label
43
+ &--float.q-field--labeled,
44
+ &--focused.q-field--labeled {
45
+ transition: transform var(--qas-generic-transition), font-size var(--qas-generic-transition);
46
+
47
+ .q-field__label {
48
+ transform: translateY(-10px) scale(0.85) !important;
49
+ }
50
+
51
+ .q-field__prepend {
52
+ transition: transform var(--qas-generic-transition);
53
+ transform: translateY(6px) !important;
54
+ }
55
+
56
+ .q-field__append {
57
+ transition: transform var(--qas-generic-transition);
58
+ transform: translateY(6px) !important;
59
+ }
60
+ }
61
+
62
+ .q-field__label {
63
+ transition: transform var(--qas-generic-transition), font-size var(--qas-generic-transition);
64
+ }
65
+
66
+ &--float.qas-numeric-input--has-icon,
67
+ &--focused.qas-numeric-input--has-icon,
68
+ &--float.qas-select--has-icon,
69
+ &--focused.qas-select--has-icon,
70
+ &--float.qas-input--has-icon,
71
+ &--focused.qas-input--has-icon {
72
+ .q-field__label {
73
+ transform: translate(-24px, -14px) scale(0.85) !important;
74
+ }
75
+ }
76
+
20
77
  &--outlined .q-field__control {
21
78
  background-color: white;
22
79
  border-radius: $generic-border-radius;
@@ -1,6 +1,8 @@
1
1
  .q-radio {
2
2
  &__label {
3
- @include set-typography($body1);
3
+ @include set-typography($body2);
4
+
5
+ padding-left: var(--qas-spacing-sm) !important;
4
6
  }
5
7
 
6
8
  &__inner::before {
@@ -1,6 +1,8 @@
1
1
  .q-toggle {
2
2
  &__label {
3
- @include set-typography($body1);
3
+ @include set-typography($body2);
4
+
5
+ padding-left: var(--qas-spacing-sm) !important;
4
6
  }
5
7
 
6
8
  &.disabled {
@@ -0,0 +1,19 @@
1
+ export default function getPlaceholder (type, defaultPlaceholder = 'Digite aqui...') {
2
+ const placeholders = {
3
+ 'company-document': '00.000.000/0000-00',
4
+ date: 'dd/mm/aaaa',
5
+ datetime: 'dd/mm/aaaa hh:mm',
6
+ decimal: '0,00',
7
+ email: 'seuemail@exemplo.com',
8
+ integer: '0',
9
+ money: 'R$ 0,00',
10
+ percent: '0,00%',
11
+ 'personal-document': '000.000.000-00',
12
+ phone: '(00) 00000-0000',
13
+ 'postal-code': '00000-000',
14
+ 'square-area': '0,00 m²',
15
+ time: 'hh:mm'
16
+ }
17
+
18
+ return placeholders[type] || defaultPlaceholder
19
+ }
@@ -18,6 +18,7 @@ export { default as isEmpty } from './is-empty.js'
18
18
  export { default as isLocalDevelopment } from './is-local-development.js'
19
19
  export { default as promiseHandler } from './promise-handler.js'
20
20
  export { default as setScrollOnGrab } from './set-scroll-on-grab.js'
21
+ export { default as getPlaceholder } from './get-placeholder.js'
21
22
 
22
23
  export * from './filters.js'
23
24
  export * from './images.js'
package/src/vue-plugin.js CHANGED
@@ -13,7 +13,7 @@ import QasBtn from './components/btn/QasBtn.vue'
13
13
  import QasBtnDropdown from './components/btn-dropdown/QasBtnDropdown.vue'
14
14
  import QasCard from './components/card/QasCard.vue'
15
15
  import QasCardImage from './components/card-image/QasCardImage.vue'
16
- import QasCheckboxGroup from './components/checkbox-group/QasCheckboxGroup.vue'
16
+ import QasCheckbox from './components/checkbox/QasCheckbox.vue'
17
17
  import QasCopy from './components/copy/QasCopy.vue'
18
18
  import QasDate from './components/date/QasDate.vue'
19
19
  import QasDateTimeInput from './components/date-time-input/QasDateTimeInput.vue'
@@ -32,9 +32,11 @@ import QasGallery from './components/gallery/QasGallery.vue'
32
32
  import QasGalleryCard from './components/gallery-card/QasGalleryCard.vue'
33
33
  import QasGrabbable from './components/grabbable/QasGrabbable.vue'
34
34
  import QasGridGenerator from './components/grid-generator/QasGridGenerator.vue'
35
- import QasHeaderActions from './components/header-actions/QasHeaderActions.vue'
35
+ import QasGridItem from './components/grid-item/QasGridItem.vue'
36
+ import QasHeader from './components/header/QasHeader.vue'
36
37
  import QasInfiniteScroll from './components/infinite-scroll/QasInfiniteScroll.vue'
37
38
  import QasInput from './components/input/QasInput.vue'
39
+ import QasInfo from './components/info/QasInfo.vue'
38
40
  import QasLabel from './components/label/QasLabel.vue'
39
41
  import QasLayout from './components/layout/QasLayout.vue'
40
42
  import QasListItems from './components/list-items/QasListItems.vue'
@@ -48,6 +50,7 @@ import QasPasswordInput from './components/password-input/QasPasswordInput.vue'
48
50
  import QasPasswordStrengthChecker from './components/password-strength-checker/QasPasswordStrengthChecker.vue'
49
51
  import QasProfile from './components/profile/QasProfile.vue'
50
52
  import QasResizer from './components/resizer/QasResizer.vue'
53
+ import QasRadio from './components/radio/QasRadio.vue'
51
54
  import QasSearchBox from './components/search-box/QasSearchBox.vue'
52
55
  import QasSearchInput from './components/search-input/QasSearchInput.vue'
53
56
  import QasSelect from './components/select/QasSelect.vue'
@@ -64,6 +67,7 @@ import QasTableGenerator from './components/table-generator/QasTableGenerator.vu
64
67
  import QasTabsGenerator from './components/tabs-generator/QasTabsGenerator.vue'
65
68
  import QasTextTruncate from './components/text-truncate/QasTextTruncate.vue'
66
69
  import QasTimeline from './components/timeline/QasTimeline.vue'
70
+ import QasToggle from './components/toggle/QasToggle.vue'
67
71
  import QasToggleVisibility from './components/toggle-visibility/QasToggleVisibility.vue'
68
72
  import QasTransfer from './components/transfer/QasTransfer.vue'
69
73
  import QasTreeGenerator from './components/tree-generator/QasTreeGenerator.vue'
@@ -107,7 +111,7 @@ async function install (app) {
107
111
  app.component('QasBtnDropdown', QasBtnDropdown)
108
112
  app.component('QasCard', QasCard)
109
113
  app.component('QasCardImage', QasCardImage)
110
- app.component('QasCheckboxGroup', QasCheckboxGroup)
114
+ app.component('QasCheckbox', QasCheckbox)
111
115
  app.component('QasCopy', QasCopy)
112
116
  app.component('QasDate', QasDate)
113
117
  app.component('QasDateTimeInput', QasDateTimeInput)
@@ -126,9 +130,11 @@ async function install (app) {
126
130
  app.component('QasGalleryCard', QasGalleryCard)
127
131
  app.component('QasGrabbable', QasGrabbable)
128
132
  app.component('QasGridGenerator', QasGridGenerator)
129
- app.component('QasHeaderActions', QasHeaderActions)
133
+ app.component('QasGridItem', QasGridItem)
134
+ app.component('QasHeader', QasHeader)
130
135
  app.component('QasInfiniteScroll', QasInfiniteScroll)
131
136
  app.component('QasInput', QasInput)
137
+ app.component('QasInfo', QasInfo)
132
138
  app.component('QasLabel', QasLabel)
133
139
  app.component('QasLayout', QasLayout)
134
140
  app.component('QasListItems', QasListItems)
@@ -142,6 +148,7 @@ async function install (app) {
142
148
  app.component('QasPasswordStrengthChecker', QasPasswordStrengthChecker)
143
149
  app.component('QasProfile', QasProfile)
144
150
  app.component('QasResizer', QasResizer)
151
+ app.component('QasRadio', QasRadio)
145
152
  app.component('QasSearchBox', QasSearchBox)
146
153
  app.component('QasSearchInput', QasSearchInput)
147
154
  app.component('QasSelect', QasSelect)
@@ -158,6 +165,7 @@ async function install (app) {
158
165
  app.component('QasTabsGenerator', QasTabsGenerator)
159
166
  app.component('QasTextTruncate', QasTextTruncate)
160
167
  app.component('QasTimeline', QasTimeline)
168
+ app.component('QasToggle', QasToggle)
161
169
  app.component('QasToggleVisibility', QasToggleVisibility)
162
170
  app.component('QasTransfer', QasTransfer)
163
171
  app.component('QasTreeGenerator', QasTreeGenerator)
@@ -203,7 +211,7 @@ export {
203
211
  QasBtn,
204
212
  QasBtnDropdown,
205
213
  QasCard,
206
- QasCheckboxGroup,
214
+ QasCheckbox,
207
215
  QasCopy,
208
216
  QasDate,
209
217
  QasDateTimeInput,
@@ -222,9 +230,11 @@ export {
222
230
  QasGalleryCard,
223
231
  QasGrabbable,
224
232
  QasGridGenerator,
225
- QasHeaderActions,
233
+ QasGridItem,
234
+ QasHeader,
226
235
  QasInfiniteScroll,
227
236
  QasInput,
237
+ QasInfo,
228
238
  QasLabel,
229
239
  QasLayout,
230
240
  QasListItems,
@@ -238,6 +248,7 @@ export {
238
248
  QasPasswordStrengthChecker,
239
249
  QasProfile,
240
250
  QasResizer,
251
+ QasRadio,
241
252
  QasSearchBox,
242
253
  QasSearchInput,
243
254
  QasSelect,
@@ -254,6 +265,7 @@ export {
254
265
  QasTabsGenerator,
255
266
  QasTextTruncate,
256
267
  QasTimeline,
268
+ QasToggle,
257
269
  QasToggleVisibility,
258
270
  QasTransfer,
259
271
  QasTreeGenerator,
@@ -1,76 +0,0 @@
1
- <template>
2
- <div class="justify-between no-wrap q-col-gutter-x-md row text-body1 text-grey-8" :class="containerClass">
3
- <div :class="leftClass">
4
- <slot name="left">
5
- {{ props.text }}
6
- </slot>
7
- </div>
8
-
9
- <div v-if="hasRightSide" class="justify-end row">
10
- <slot name="right">
11
- <qas-actions-menu v-if="hasDefaultActionsMenu" v-bind="props.actionsMenuProps" />
12
-
13
- <qas-btn v-if="hasDefaultButton" :use-label-on-small-screen="false" v-bind="props.buttonProps" />
14
- </slot>
15
- </div>
16
- </div>
17
- </template>
18
-
19
- <script setup>
20
- import { FlexAlign } from '../../enums/Align'
21
- import { Spacing } from '../../enums/Spacing'
22
- import { gutterValidator } from '../../helpers/private/gutter-validator'
23
-
24
- import { computed, useSlots } from 'vue'
25
-
26
- defineOptions({ name: 'QasHeaderActions' })
27
-
28
- const props = defineProps({
29
- actionsMenuProps: {
30
- type: Object,
31
- default: () => ({})
32
- },
33
-
34
- alignColumns: {
35
- default: FlexAlign.Center,
36
- type: String,
37
- validator: value => Object.values(FlexAlign).includes(value)
38
- },
39
-
40
- buttonProps: {
41
- default: () => ({}),
42
- type: Object
43
- },
44
-
45
- text: {
46
- type: String,
47
- default: ''
48
- },
49
-
50
- spacing: {
51
- default: Spacing.Xl,
52
- type: String,
53
- validator: gutterValidator
54
- }
55
- })
56
-
57
- const slots = useSlots()
58
-
59
- // computed
60
- const containerClass = computed(() => `items-${props.alignColumns} q-mb-${props.spacing}`)
61
-
62
- const leftClass = computed(() => {
63
- return {
64
- 'col-12': !hasRightSide.value
65
- }
66
- })
67
-
68
- const hasDefaultButton = computed(() => !!Object.keys(props.buttonProps).length)
69
- const hasDefaultActionsMenu = computed(() => !!Object.keys(props.actionsMenuProps).length)
70
-
71
- const hasRightSide = computed(() => {
72
- const hasRightSlot = !!slots.right
73
-
74
- return hasRightSlot || hasDefaultActionsMenu.value || hasDefaultButton.value
75
- })
76
- </script>
@@ -1,38 +0,0 @@
1
- type: component
2
-
3
- meta:
4
- desc: Componente para cabeçalho usado com alguma descrição e ação.
5
-
6
- props:
7
- actions-menu-props:
8
- desc: Propriedades do QasActionsMenu.
9
- default: {}
10
- type: Object
11
-
12
- align-columns:
13
- desc: Alinhamento vertical das colunas.
14
- default: center
15
- type: String
16
- examples: [start, center, end, between, around]
17
-
18
- button-props:
19
- desc: Propriedades do QasBtn.
20
- default: {}
21
- type: Object
22
-
23
- text:
24
- desc: Descrição da seção a esquerda.
25
- type: String
26
-
27
- spacing:
28
- desc: Espaçamento entre o componente e o conteúdo abaixo.
29
- default: xl
30
- type: String
31
- examples: [none, xs, sm, md, lg, xl, '2xl', '3xl', '4xl', '5xl']
32
-
33
- slots:
34
- left:
35
- desc: slot para acessar seção da esquerda (descrição).
36
-
37
- right:
38
- desc: slot para acessar seção da direita (ação).