@bildvitta/quasar-ui-asteroid 3.17.0-beta.9 → 3.17.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 (58) hide show
  1. package/package.json +3 -2
  2. package/src/assets/sounds/nave-notification.mp3 +0 -0
  3. package/src/components/app-menu/QasAppMenu.vue +73 -15
  4. package/src/components/app-menu/QasAppMenu.yml +5 -5
  5. package/src/components/app-user/QasAppUser.vue +49 -40
  6. package/src/components/avatar/QasAvatar.vue +7 -8
  7. package/src/components/badge/QasBadge.vue +3 -29
  8. package/src/components/board-generator/QasBoardGenerator.vue +442 -40
  9. package/src/components/board-generator/QasBoardGenerator.yml +107 -12
  10. package/src/components/card/QasCard.vue +13 -4
  11. package/src/components/chart-view/QasChartView.vue +56 -3
  12. package/src/components/chart-view/QasChartView.yml +6 -0
  13. package/src/components/checkbox/QasCheckbox.vue +67 -11
  14. package/src/components/checkbox/QasCheckbox.yml +18 -0
  15. package/src/components/copy/QasCopy.vue +12 -2
  16. package/src/components/copy/QasCopy.yml +8 -0
  17. package/src/components/expansion-item/QasExpansionItem.vue +108 -76
  18. package/src/components/expansion-item/QasExpansionItem.yml +38 -10
  19. package/src/components/field/QasField.vue +1 -1
  20. package/src/components/form-generator/QasFormGenerator.vue +23 -10
  21. package/src/components/form-generator/QasFormGenerator.yml +2 -2
  22. package/src/components/grabbable/QasGrabbable.vue +14 -6
  23. package/src/components/grabbable/QasGrabbable.yml +4 -0
  24. package/src/components/grid-generator/QasGridGenerator.vue +3 -3
  25. package/src/components/grid-generator/QasGridGenerator.yml +2 -2
  26. package/src/components/grid-item/QasGridItem.vue +1 -1
  27. package/src/components/header/QasHeader.vue +11 -9
  28. package/src/components/infinite-scroll/QasInfiniteScroll.vue +16 -17
  29. package/src/components/infinite-scroll/QasInfiniteScroll.yml +7 -0
  30. package/src/components/list-view/QasListView.vue +16 -2
  31. package/src/components/list-view/QasListView.yml +9 -0
  32. package/src/components/radio/QasRadio.vue +24 -5
  33. package/src/components/radio/QasRadio.yml +6 -0
  34. package/src/components/select/QasSelect.vue +11 -2
  35. package/src/components/select/QasSelect.yml +1 -1
  36. package/src/components/select-filter/QasSelectFilter.vue +65 -0
  37. package/src/components/select-filter/QasSelectFilter.yml +36 -0
  38. package/src/components/stepper/QasStepper.vue +50 -3
  39. package/src/components/stepper-form-view/QasStepperFormView.vue +6 -4
  40. package/src/components/stepper-form-view/QasStepperFormView.yml +1 -1
  41. package/src/components/table-generator/QasTableGenerator.vue +3 -0
  42. package/src/components/text-truncate/QasTextTruncate.vue +77 -14
  43. package/src/components/text-truncate/QasTextTruncate.yml +14 -3
  44. package/src/components/uploader/QasUploader.vue +70 -24
  45. package/src/components/uploader/QasUploader.yml +15 -1
  46. package/src/components/welcome/QasWelcome.vue +8 -0
  47. package/src/components/welcome/QasWelcome.yml +3 -0
  48. package/src/composables/index.js +3 -1
  49. package/src/composables/private/index.js +1 -0
  50. package/src/composables/private/use-auth-user.js +20 -0
  51. package/src/composables/private/use-generator.js +20 -5
  52. package/src/composables/use-default-filters.js +106 -0
  53. package/src/composables/use-notifications.js +14 -0
  54. package/src/composables/use-query-cache.js +1 -1
  55. package/src/helpers/set-scroll-on-grab.js +9 -1
  56. package/src/shared/badge-config.js +29 -0
  57. package/src/vue-plugin.js +3 -0
  58. package/src/components/app-menu/private/PvAppMenuHelpChat.vue +0 -222
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bildvitta/quasar-ui-asteroid",
3
3
  "description": "Asteroid",
4
- "version": "3.17.0-beta.9",
4
+ "version": "3.17.0",
5
5
  "author": "Bild & Vitta <systemteam@bild.com.br>",
6
6
  "license": "MIT",
7
7
  "main": "dist/asteroid.cjs.min.js",
@@ -50,11 +50,12 @@
50
50
  "date-fns": "^2.30.0",
51
51
  "debug": "^4.3.4",
52
52
  "fuse.js": "^6.6.2",
53
+ "gleap": "^14.2.7",
53
54
  "humps": "^2.0.1",
54
55
  "lodash-es": "^4.17.21",
55
56
  "pica": "^9.0.1",
56
57
  "signature_pad": "^4.1.5",
57
- "sortablejs": "^1.15.0"
58
+ "sortablejs": "^1.15.3"
58
59
  },
59
60
  "browserslist": [
60
61
  "defaults"
@@ -58,7 +58,9 @@
58
58
  </div>
59
59
  </div>
60
60
 
61
- <q-item v-else :key="index" :active="isActive(menuItem)" active-class="q-router-link--active" class="qas-app-menu__item" :to="getRouterRedirect(menuItem)">
61
+ <!-- quando tem children vazio, não deve mostrar label do item, e a label do item
62
+ não tem "to", então validar se tem "to" para mostrar o item -->
63
+ <q-item v-else-if="menuItem.to" :key="index" :active="isActive(menuItem)" active-class="q-router-link--active" class="qas-app-menu__item" :to="getRouterRedirect(menuItem)">
62
64
  <q-item-section v-if="menuItem.icon" avatar>
63
65
  <q-icon :name="menuItem.icon" />
64
66
  </q-item-section>
@@ -77,8 +79,8 @@
77
79
 
78
80
  <div v-if="showAppUser">
79
81
  <!-- Chat Ajuda -->
80
- <q-list v-if="helpChatLink" class="q-mt-xl">
81
- <q-item class="q-mb-md text-primary" clickable>
82
+ <q-list v-if="useChat" class="q-mt-xl">
83
+ <q-item class="q-mb-md text-primary" clickable @click="toggleChat">
82
84
  <q-item-section avatar>
83
85
  <q-icon name="sym_r_chat" />
84
86
  </q-item-section>
@@ -90,8 +92,6 @@
90
92
  </div>
91
93
  </q-item-label>
92
94
  </q-item-section>
93
-
94
- <pv-app-menu-help-chat :link="props.helpChatLink" :mini-brand="props.miniBrand" @update:model-value="setHasOpenedHelpChat" />
95
95
  </q-item>
96
96
  </q-list>
97
97
 
@@ -106,7 +106,6 @@
106
106
  </template>
107
107
 
108
108
  <script setup>
109
- import PvAppMenuHelpChat from './private/PvAppMenuHelpChat.vue'
110
109
  import PvAppMenuDropdown from './private/PvAppMenuDropdown.vue'
111
110
  import QasAppUser from '../app-user/QasAppUser.vue'
112
111
 
@@ -114,8 +113,12 @@ import useAppMenuDropdown from './composables/use-app-menu-dropdown'
114
113
  import useAppUser from './composables/use-app-user'
115
114
  import useDevelopmentBadge from './composables/use-development-badge'
116
115
  import { useScreen } from '../../composables'
116
+ import { useAuthUser } from '../../composables/private'
117
+
118
+ import { handleProcess } from '../../helpers'
117
119
 
118
- import { ref, computed, watch } from 'vue'
120
+ import Gleap from 'gleap'
121
+ import { ref, computed, watch, onMounted } from 'vue'
119
122
  import { useRouter } from 'vue-router'
120
123
 
121
124
  defineOptions({
@@ -136,11 +139,6 @@ const props = defineProps({
136
139
  type: String
137
140
  },
138
141
 
139
- helpChatLink: {
140
- type: String,
141
- default: ''
142
- },
143
-
144
142
  items: {
145
143
  default: () => [],
146
144
  type: Array
@@ -170,6 +168,10 @@ const props = defineProps({
170
168
  title: {
171
169
  default: '',
172
170
  type: String
171
+ },
172
+
173
+ useChat: {
174
+ type: Boolean
173
175
  }
174
176
  })
175
177
 
@@ -178,6 +180,8 @@ const emit = defineEmits(['sign-out', 'update:modelValue', 'toggle-notifications
178
180
  const screen = useScreen()
179
181
  const router = useRouter()
180
182
 
183
+ const { toggleChat } = useChatMenu()
184
+
181
185
  const rootRoute = router.hasRoute('Root') ? { name: 'Root' } : { path: '/' }
182
186
 
183
187
  const hasOpenedMenu = ref(false)
@@ -214,7 +218,7 @@ const isMiniMode = computed(() => {
214
218
  return screen.isLarge && isMini.value && !hasOpenedMenu.value && !hasOpenedHelpChat.value
215
219
  })
216
220
 
217
- const menuClasses = computed(() => ({ 'qas-app-menu__menu--spaced': !props.helpChatLink }))
221
+ const menuClasses = computed(() => ({ 'qas-app-menu__menu--spaced': !props.useChat }))
218
222
 
219
223
  const classes = computed(() => {
220
224
  return {
@@ -276,6 +280,9 @@ function hasSeparator (index) {
276
280
  }
277
281
 
278
282
  function isActive ({ to }) {
283
+ // quando o children vem vazio, "to" é "undefined", então precisa ser feito esta trativa.
284
+ if (!to) return false
285
+
279
286
  const currentPath = getNormalizedPath(router.currentRoute.value.path)
280
287
  const itemPath = typeof to === 'string' ? getNormalizedPath(to) : getPathFromObject(to)
281
288
 
@@ -296,8 +303,59 @@ function setHasOpenedMenu (value) {
296
303
  hasOpenedMenu.value = value
297
304
  }
298
305
 
299
- function setHasOpenedHelpChat (value) {
300
- hasOpenedHelpChat.value = value
306
+ // composables definitions
307
+ function useChatMenu () {
308
+ // composables
309
+ const { user, hasUser } = useAuthUser()
310
+
311
+ // consts
312
+ const isMeVersionTwo = process.env.ME_VERSION === 2
313
+
314
+ // hooks
315
+ onMounted(initializeChat)
316
+
317
+ // functions
318
+ function initializeChat () {
319
+ const gleapEnv = handleProcess(() => process.env.GLEAP)
320
+
321
+ if (!props.useChat || !gleapEnv || !hasUser.value) return
322
+
323
+ Gleap.initialize(gleapEnv)
324
+ Gleap.setLanguage('pt-BR')
325
+
326
+ const {
327
+ uuid,
328
+ name,
329
+ email,
330
+ callingCode,
331
+ phone,
332
+ companyLink,
333
+ companyLinksOptions,
334
+ mainCompanyOptions, // somente na v2
335
+ currentMainCompany // somente na v2
336
+ } = user.value
337
+
338
+ const companyId = isMeVersionTwo ? currentMainCompany : companyLink
339
+ const companyNameList = isMeVersionTwo ? mainCompanyOptions : companyLinksOptions
340
+ const companyName = companyNameList?.find(({ value }) => value === companyId)?.label
341
+
342
+ Gleap.identify(uuid, {
343
+ name,
344
+ email,
345
+ phone: `${callingCode || '55'}${phone}`,
346
+ companyId,
347
+ companyName
348
+ })
349
+ }
350
+
351
+ function toggleChat () {
352
+ Gleap.isOpened() ? Gleap.close() : Gleap.open()
353
+ }
354
+
355
+ return {
356
+ initializeChat,
357
+ toggleChat
358
+ }
301
359
  }
302
360
  </script>
303
361
 
@@ -15,11 +15,6 @@ props:
15
15
  type: String
16
16
  required: true
17
17
 
18
- help-chat-link:
19
- desc: Link para ser usado no iframe do chat, caso não passe nada, o chat não será exibido.
20
- type: String
21
- default: ''
22
-
23
18
  items:
24
19
  desc: Itens do menu.
25
20
  type: Array
@@ -49,6 +44,11 @@ props:
49
44
  desc: Título que vai ficar no label do select de módulos.
50
45
  type: String
51
46
 
47
+ use-chat:
48
+ desc: Componente para controlar se vai ter ou não o chat.
49
+ type: Boolean
50
+ default: true
51
+
52
52
  slots:
53
53
  user:
54
54
  desc: Slot para acessar o menu de usuário.
@@ -108,23 +108,29 @@ const props = defineProps({
108
108
  }
109
109
  })
110
110
 
111
+ // emits
111
112
  const emit = defineEmits(['sign-out', 'toggle-notifications'])
112
113
 
113
- // vindo direto do boot api.js
114
+ // globals
114
115
  const axios = inject('axios')
115
116
 
117
+ // composables
116
118
  const router = useRouter()
117
119
 
118
120
  const { isNotificationsEnabled, unreadNotificationsCount } = useNotifications()
119
121
 
120
122
  const { reset } = useQueryCache()
121
123
 
124
+ const { avatarNotificationCountProps } = useAvatarNotifications()
125
+
126
+ // refs
122
127
  const companiesModel = ref('')
123
128
  const loading = ref(false)
124
129
 
125
- const { avatarNotificationCountProps } = useAvatarNotifications()
130
+ // consts
131
+ const IS_ME_VERSION_2 = process.env.ME_VERSION === 2
126
132
 
127
- // computed
133
+ // computeds
128
134
  const defaultCompanyProps = computed(() => {
129
135
  return {
130
136
  loading: loading.value,
@@ -148,42 +154,7 @@ watch(() => props.companyProps.modelValue, value => {
148
154
  companiesModel.value = value
149
155
  }, { immediate: true })
150
156
 
151
- // composable
152
- function useAvatarNotifications () {
153
- const hasAnimated = ref(false)
154
-
155
- watch(() => unreadNotificationsCount.value, () => {
156
- hasAnimated.value = true
157
-
158
- setTimeout(() => {
159
- hasAnimated.value = false
160
- }, 1000)
161
- })
162
-
163
- const avatarNotificationCountProps = computed(() => {
164
- const classes = [
165
- 'qas-app-user__notification-avatar',
166
- 'animated',
167
- {
168
- rubberBand: hasAnimated.value
169
- }
170
- ]
171
-
172
- return {
173
- class: classes,
174
- color: 'red-14',
175
- size: 'xs',
176
- title: unreadNotificationsToString.value,
177
- useCropTitle: false
178
- }
179
- })
180
-
181
- return {
182
- avatarNotificationCountProps
183
- }
184
- }
185
-
186
- // métodos
157
+ // functions
187
158
  function signOut () {
188
159
  emit('sign-out')
189
160
  }
@@ -194,7 +165,10 @@ async function setCompanies (value) {
194
165
  loading.value = true
195
166
 
196
167
  try {
197
- await axios.patch('users/me', { companies: value })
168
+ await axios.patch('users/me', {
169
+ [IS_ME_VERSION_2 ? 'currentMainCompany' : 'companies']: value
170
+ })
171
+
198
172
  setTimeout(() => location.reload(), 1500)
199
173
 
200
174
  NotifySuccess('Vínculo alterado com sucesso.')
@@ -224,6 +198,41 @@ function onMenuHide () {
224
198
  function toggleNotificationsDrawer () {
225
199
  emit('toggle-notifications')
226
200
  }
201
+
202
+ // composables definitions
203
+ function useAvatarNotifications () {
204
+ const hasAnimated = ref(false)
205
+
206
+ watch(() => unreadNotificationsCount.value, () => {
207
+ hasAnimated.value = true
208
+
209
+ setTimeout(() => {
210
+ hasAnimated.value = false
211
+ }, 1000)
212
+ })
213
+
214
+ const avatarNotificationCountProps = computed(() => {
215
+ const classes = [
216
+ 'qas-app-user__notification-avatar',
217
+ 'animated',
218
+ {
219
+ rubberBand: hasAnimated.value
220
+ }
221
+ ]
222
+
223
+ return {
224
+ class: classes,
225
+ color: 'red-14',
226
+ size: 'xs',
227
+ title: unreadNotificationsToString.value,
228
+ useCropTitle: false
229
+ }
230
+ })
231
+
232
+ return {
233
+ avatarNotificationCountProps
234
+ }
235
+ }
227
236
  </script>
228
237
 
229
238
  <style lang="scss">
@@ -19,12 +19,7 @@ defineOptions({
19
19
  const props = defineProps({
20
20
  color: {
21
21
  type: String,
22
- default: AvatarColors.Primary,
23
- validator: value => {
24
- const availableColors = Object.values(AvatarColors)
25
-
26
- return availableColors.includes(value)
27
- }
22
+ default: AvatarColors.Primary
28
23
  },
29
24
 
30
25
  size: {
@@ -42,6 +37,11 @@ const props = defineProps({
42
37
  type: String
43
38
  },
44
39
 
40
+ textColor: {
41
+ default: '',
42
+ type: String
43
+ },
44
+
45
45
  title: {
46
46
  default: '',
47
47
  type: String
@@ -62,7 +62,6 @@ const attributes = computed(() => {
62
62
  rounded,
63
63
  square,
64
64
  fontSize,
65
- textColor,
66
65
  ...attributes
67
66
  } = attrs
68
67
 
@@ -76,7 +75,7 @@ const attributes = computed(() => {
76
75
  return {
77
76
  size: props.size,
78
77
  color: props.color,
79
- textColor: colors[props.color],
78
+ textColor: colors[props.color] || props.textColor,
80
79
  ...attributes
81
80
  }
82
81
  })
@@ -5,6 +5,8 @@
5
5
  </template>
6
6
 
7
7
  <script setup>
8
+ import { baseProps } from '../../shared/badge-config'
9
+
8
10
  import { computed } from 'vue'
9
11
 
10
12
  defineOptions({
@@ -12,35 +14,7 @@ defineOptions({
12
14
  inheritAttrs: false
13
15
  })
14
16
 
15
- const props = defineProps({
16
- color: {
17
- type: String,
18
- default: 'light-blue-2'
19
- },
20
-
21
- label: {
22
- type: String,
23
- default: ''
24
- },
25
-
26
- multiLine: {
27
- type: Boolean
28
- },
29
-
30
- textColor: {
31
- type: String,
32
- default: 'black'
33
- },
34
-
35
- removable: {
36
- type: Boolean
37
- },
38
-
39
- tabindex: {
40
- type: [String, Number],
41
- default: undefined
42
- }
43
- })
17
+ const props = defineProps(baseProps)
44
18
 
45
19
  const emit = defineEmits(['remove'])
46
20
  const model = defineModel({ type: Boolean, default: true })