@bildvitta/quasar-ui-asteroid 3.20.0-beta.1 → 3.20.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bildvitta/quasar-ui-asteroid",
3
3
  "description": "Asteroid",
4
- "version": "3.20.0-beta.1",
4
+ "version": "3.20.0-beta.2",
5
5
  "author": "Bild & Vitta <systemteam@bild.com.br>",
6
6
  "license": "MIT",
7
7
  "main": "./src/asteroid.js",
@@ -86,6 +86,10 @@ const props = defineProps({
86
86
  type: String
87
87
  },
88
88
 
89
+ useDropdownAlways: {
90
+ type: Boolean
91
+ },
92
+
89
93
  useLabel: {
90
94
  default: true,
91
95
  type: Boolean
@@ -209,7 +213,13 @@ const formattedList = computed(() => {
209
213
  */
210
214
  const payload = { dropdownList: {}, buttonsList: {} }
211
215
 
212
- if ((!hasSplitName.value || screen.isSmall) && !isSingle.value) {
216
+ /**
217
+ * Se a prop "useDropdownAlways" for true, significa que sempre usaremos o dropdown,
218
+ * mesmo que tenha apenas 1 item na lista ou que não tenha splitName.
219
+ * Também se não tiver splitName e a tela for pequena (mobile/tablet) e não for
220
+ * single, usaremos o dropdown.
221
+ */
222
+ if (props.useDropdownAlways || ((!hasSplitName.value || screen.isSmall) && !isSingle.value)) {
213
223
  const { buttonsList } = useOptionsActions({ color: DEFAULT_COLOR, props })
214
224
 
215
225
  payload.buttonsList = buttonsList.value
@@ -49,6 +49,11 @@ props:
49
49
  type: String
50
50
  examples: [visibility]
51
51
 
52
+ use-dropdown-always:
53
+ desc: Força o uso do dropdown mesmo caso tenha apenas 1 item na lista de ações.
54
+ default: false
55
+ type: Boolean
56
+
52
57
  use-tooltip:
53
58
  desc: Controla se vai ter o tooltip caso passe nas regras de exibição de tooltip
54
59
 
@@ -36,6 +36,14 @@
36
36
  </component>
37
37
  </q-td>
38
38
  </template>
39
+
40
+ <template v-for="(column, index) in columnsWithTooltip" :key="index" #[`header-cell-${column.name}`]="context">
41
+ <q-th :props="context">
42
+ {{ context.col.label }}
43
+
44
+ <qas-tip class="q-pl-xs" :text="column.tooltip" />
45
+ </q-th>
46
+ </template>
39
47
  </q-table>
40
48
 
41
49
  <qas-empty-result-text v-if="!hasResults" />
@@ -45,9 +53,10 @@
45
53
  <script>
46
54
  import PvTableGeneratorTd from './private/PvTableGeneratorTd.vue'
47
55
  import QasBox from '../box/QasBox.vue'
56
+ import QasCheckbox from '../checkbox/QasCheckbox.vue'
48
57
  import QasEmptyResultText from '../empty-result-text/QasEmptyResultText.vue'
49
58
  import QasHeader from '../header/QasHeader.vue'
50
- import QasCheckbox from '../checkbox/QasCheckbox.vue'
59
+ import QasTip from '../tip/QasTip.vue'
51
60
 
52
61
  import { isEmpty, humanize, setScrollOnGrab, setScrollGradient } from '../../helpers'
53
62
 
@@ -61,7 +70,8 @@ export default {
61
70
  QasBox,
62
71
  QasEmptyResultText,
63
72
  QasHeader,
64
- QasCheckbox
73
+ QasCheckbox,
74
+ QasTip
65
75
  },
66
76
 
67
77
  provide () {
@@ -70,7 +80,7 @@ export default {
70
80
  * @see QasBtn.vue - Injetando os valores padrões para o QasBtn.
71
81
  */
72
82
  btnPropsDefaults: {
73
- size: 'md'
83
+ size: 'sm'
74
84
  }
75
85
  }
76
86
  },
@@ -146,6 +156,10 @@ export default {
146
156
  default: true
147
157
  },
148
158
 
159
+ useMultiline: {
160
+ type: Boolean
161
+ },
162
+
149
163
  useObjectSelectedModel: {
150
164
  type: Boolean
151
165
  },
@@ -287,7 +301,11 @@ export default {
287
301
  * caso tenha a prop "actionsMenuProps" é adicionado automaticamente a coluna "actions" como ultimo item
288
302
  */
289
303
  normalizedColumns () {
290
- return this.hasActionsMenu ? [...this.columns, { name: 'actions' }] : this.columns
304
+ return this.hasActionsMenu ? [...this.columns, { name: 'actions', label: 'Ações' }] : this.columns
305
+ },
306
+
307
+ columnsWithTooltip () {
308
+ return this.normalizedColumns.filter(column => column.tooltip)
291
309
  },
292
310
 
293
311
  hasFields () {
@@ -301,6 +319,10 @@ export default {
301
319
 
302
320
  const mappedResults = results.map((result, index) => {
303
321
  for (const key in result) {
322
+ if (this.fields[key]?.type === 'object') {
323
+ continue
324
+ }
325
+
304
326
  const humanizedResult = humanize(this.fields[key], result[key])
305
327
  const formattedResult = isEmpty({ value: humanizedResult }) ? this.emptyResultText : humanizedResult
306
328
 
@@ -322,7 +344,8 @@ export default {
322
344
  return {
323
345
  'qas-table-generator--mobile': this.$qas.screen.isSmall,
324
346
  'qas-table-generator--sticky-header': this.useStickyHeader,
325
- 'qas-table-generator--has-actions': this.hasActionsMenu
347
+ 'qas-table-generator--has-actions': this.hasActionsMenu,
348
+ 'qas-table-generator--multiline': this.useMultiline
326
349
  }
327
350
  },
328
351
 
@@ -539,7 +562,7 @@ export default {
539
562
  }
540
563
 
541
564
  th {
542
- @include set-typography($subtitle1);
565
+ @include set-typography($subtitle2);
543
566
 
544
567
  color: $grey-10;
545
568
 
@@ -554,18 +577,10 @@ export default {
554
577
  }
555
578
  }
556
579
 
557
- border: 0 !important;
558
- padding-bottom: 0;
580
+ padding-bottom: var(--qas-spacing-sm);;
559
581
  padding-left: 0;
560
582
  padding-top: 0;
561
-
562
- &:not(:last-child) {
563
- padding-right: var(--qas-spacing-md);
564
- }
565
-
566
- &:last-child {
567
- padding-right: 0;
568
- }
583
+ padding-right: var(--qas-spacing-md);
569
584
  }
570
585
 
571
586
  td,
@@ -576,7 +591,7 @@ export default {
576
591
  }
577
592
 
578
593
  td {
579
- @include set-typography($body1);
594
+ @include set-typography($body2);
580
595
 
581
596
  height: 40px;
582
597
  padding-bottom: var(--qas-spacing-sm);
@@ -584,14 +599,7 @@ export default {
584
599
  padding-top: var(--qas-spacing-sm);
585
600
  position: relative;
586
601
  z-index: 0;
587
-
588
- &:not(:last-child) {
589
- padding-right: var(--qas-spacing-md);
590
- }
591
-
592
- &:last-child {
593
- padding-right: 0;
594
- }
602
+ padding-right: var(--qas-spacing-md);
595
603
 
596
604
  &::before {
597
605
  position: absolute;
@@ -648,18 +656,22 @@ export default {
648
656
  }
649
657
  }
650
658
 
659
+ &--multiline {
660
+ @media (min-width: $breakpoint-sm) {
661
+ .q-table td {
662
+ *:not(.qas-btn, .qas-btn *, .q-badge, .q-badge *){
663
+ white-space: normal;
664
+ overflow-wrap: anywhere;
665
+ }
666
+ }
667
+ }
668
+ }
669
+
651
670
  .q-table__container {
652
671
  margin-left: calc(var(--qas-spacing-md) * -1);
653
672
  margin-right: calc(var(--qas-spacing-md) * -1);
654
673
  }
655
674
 
656
- &--has-actions {
657
- td:last-child #{$root}__td-item {
658
- display: flex;
659
- justify-content: flex-end;
660
- }
661
- }
662
-
663
675
  &--mobile {
664
676
  margin: 0 -10px;
665
677
 
@@ -99,6 +99,11 @@ props:
99
99
  default: true
100
100
  type: Boolean
101
101
 
102
+ use-multiline:
103
+ desc: Usado para permitir que o conteúdo da célula quebre linha (não permite scroll na tabela a partir de tablet).
104
+ default: false
105
+ type: Boolean
106
+
102
107
  use-object-selected-model:
103
108
  desc: Usado para definir o modelo de seleção como um array de objeto ao invés de um array de string.
104
109
  default: false
@@ -21,12 +21,15 @@
21
21
  </div>
22
22
 
23
23
  <qas-btn class="q-ml-sm qas-toggle-visibility__button" :icon />
24
+
25
+ <qas-tooltip :text="tooltipText" />
24
26
  </div>
25
27
  </div>
26
28
  </template>
27
29
 
28
30
  <script setup>
29
31
  import QasBtn from '../btn/QasBtn.vue'
32
+ import QasTooltip from '../tooltip/QasTooltip.vue'
30
33
 
31
34
  import { useToggleVisibility } from '../../composables/private'
32
35
 
@@ -54,6 +57,16 @@ const props = defineProps({
54
57
  width: {
55
58
  type: String,
56
59
  default: '140px'
60
+ },
61
+
62
+ visibleTooltip: {
63
+ type: String,
64
+ default: 'Ocultar conteúdo'
65
+ },
66
+
67
+ hiddenTooltip: {
68
+ type: String,
69
+ default: 'Visualizar conteúdo'
57
70
  }
58
71
  })
59
72
 
@@ -64,6 +77,7 @@ const {
64
77
 
65
78
  const icon = computed(() => isVisible.value ? 'sym_r_visibility' : 'sym_r_visibility_off')
66
79
  const style = computed(() => ({ width: props.width }))
80
+ const tooltipText = computed(() => isVisible.value ? props.visibleTooltip : props.hiddenTooltip)
67
81
  </script>
68
82
 
69
83
  <style lang="scss">
@@ -25,6 +25,16 @@ props:
25
25
  default: '140px'
26
26
  type: String
27
27
 
28
+ visible-tooltip:
29
+ desc: Texto do tooltip exibido quando o conteúdo está visível.
30
+ default: 'Ocultar conteúdo'
31
+ type: String
32
+
33
+ hidden-tooltip:
34
+ desc: Texto do tooltip exibido quando o conteúdo está oculto.
35
+ default: 'Exibir conteúdo'
36
+ type: String
37
+
28
38
  slots:
29
39
  default:
30
40
  desc: Slot para inserir conteúdo a ser oculto/exibido.
@@ -1,10 +1,12 @@
1
1
  <template>
2
2
  <q-tooltip v-bind="tooltipProps" class="bg-grey-10 text-caption">
3
- {{ props.text }}
3
+ <qas-breakline :text="props.text" />
4
4
  </q-tooltip>
5
5
  </template>
6
6
 
7
7
  <script setup>
8
+ import QasBreakline from '../breakline/QasBreakline.vue'
9
+
8
10
  defineOptions({ name: 'QasTooltip' })
9
11
 
10
12
  const props = defineProps({
@@ -18,6 +20,7 @@ const props = defineProps({
18
20
  const tooltipProps = {
19
21
  anchor: 'center right',
20
22
  self: 'center left',
21
- offset: [5, 5]
23
+ offset: [5, 5],
24
+ maxWidth: '300px'
22
25
  }
23
26
  </script>
@@ -14,7 +14,7 @@
14
14
  padding: var(--qas-spacing-xs) var(--qas-spacing-md) !important;
15
15
 
16
16
  .q-icon {
17
- font-size: 16px !important;
17
+ font-size: 18fpx !important;
18
18
  }
19
19
 
20
20
  &.qas-btn--icon-only.qas-btn--primary,
@@ -88,6 +88,8 @@ function formatCompanyDocument (value) {
88
88
  }
89
89
 
90
90
  function formatDocument (value) {
91
+ if (!value) return ''
92
+
91
93
  return value.length < 12
92
94
  ? formatPersonalDocument(value)
93
95
  : formatCompanyDocument(value)