@bildvitta/quasar-ui-asteroid 2.12.4 → 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 -0
  6. package/dist/asteroid.cjs.js +9154 -0
  7. package/dist/asteroid.cjs.min.js +6 -0
  8. package/dist/asteroid.esm.css +1 -0
  9. package/dist/asteroid.esm.js +9145 -0
  10. package/dist/asteroid.esm.min.js +6 -0
  11. package/dist/asteroid.umd.css +1 -0
  12. package/dist/asteroid.umd.js +9148 -0
  13. package/dist/asteroid.umd.min.js +6 -0
  14. package/dist/vetur/asteroid-attributes.json +30 -0
  15. package/dist/vetur/asteroid-tags.json +29 -0
  16. package/package.json +42 -56
  17. package/src/assets/logo-modular.svg +1 -0
  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 +59 -61
  23. package/src/components/app-menu/QasAppMenu.vue +128 -41
  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 +22 -25
  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 +81 -0
  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 +125 -0
  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 +43 -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 +3 -4
  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 -57
  88. package/src/helpers/is-local-development.js +3 -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 +18 -20
  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 -88
  119. package/src/components/app-menu/QasAppMenu.stories.js +0 -62
  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/decimal-input/QasDecimalInput.stories.js +0 -82
  138. package/src/components/decimal-input/QasDecimalInput.vue +0 -92
  139. package/src/components/delete/QasDelete.stories.js +0 -80
  140. package/src/components/dialog/QasDialog.stories.js +0 -139
  141. package/src/components/dialog-router/QasDialogRouter.stories.js +0 -38
  142. package/src/components/field/QasField.stories.js +0 -181
  143. package/src/components/filters/QasFilters.stories.js +0 -121
  144. package/src/components/form-generator/QasFormGenerator.stories.js +0 -115
  145. package/src/components/form-view/QasFormView.stories.js +0 -236
  146. package/src/components/gallery/QasGallery.stories.js +0 -91
  147. package/src/components/grid-generator/QasGridGenerator.stories.js +0 -138
  148. package/src/components/input/QasInput.stories.js +0 -78
  149. package/src/components/label/QasLabel.stories.js +0 -60
  150. package/src/components/list-items/QasListItems.stories.js +0 -130
  151. package/src/components/list-view/QasListView.stories.js +0 -168
  152. package/src/components/map/QasMap.stories.js +0 -75
  153. package/src/components/nested-fields/QasNestedFields.stories.js +0 -255
  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 -245
  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
@@ -0,0 +1,45 @@
1
+ <template>
2
+ <div :class="classes">
3
+ <div class="col-12 col-sm-auto">
4
+ <slot name="secondary" />
5
+ </div>
6
+
7
+ <div class="col-12 col-sm-auto">
8
+ <slot name="primary" />
9
+ </div>
10
+ </div>
11
+ </template>
12
+
13
+ <script>
14
+ import { screenMixin } from '../../mixins'
15
+
16
+ export default {
17
+ name: 'QasActions',
18
+
19
+ mixins: [screenMixin],
20
+
21
+ props: {
22
+ align: {
23
+ default: 'end',
24
+ type: String,
25
+ validator: value => ['start', 'around', 'between', 'center', 'end'].includes(value)
26
+ },
27
+
28
+ gutter: {
29
+ default: 'md',
30
+ type: String,
31
+ validator: value => ['xs', 'sm', 'md', 'lg', 'xl'].includes(value)
32
+ }
33
+ },
34
+
35
+ computed: {
36
+ classes () {
37
+ return [
38
+ `justify-${this.align}`,
39
+ `q-col-gutter-${this.gutter}`,
40
+ this.mx_isSmall ? 'column reverse' : 'row'
41
+ ]
42
+ }
43
+ }
44
+ }
45
+ </script>
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <qas-btn class="qas-actions-menu" color="primary" v-bind="$attrs" hide-mobile-label :icon="icon" :label="labelValue" outline v-on="$listeners">
2
+ <qas-btn class="qas-actions-menu" color="primary" hide-label-on-small-screen :icon="icon" :label="label" outline>
3
3
  <q-menu class="qas-actions-menu__menu">
4
4
  <q-list class="qas-actions-menu__list" separator>
5
5
  <slot v-for="(item, key) in list" :item="item" :name="key">
@@ -18,7 +18,7 @@
18
18
  </template>
19
19
 
20
20
  <script>
21
- import QasBtn from '../btn/QasBtn'
21
+ import QasBtn from '../btn/QasBtn.vue'
22
22
 
23
23
  export default {
24
24
  name: 'QasActionsMenu',
@@ -28,23 +28,19 @@ export default {
28
28
  },
29
29
 
30
30
  props: {
31
+ icon: {
32
+ default: 'o_settings',
33
+ type: String
34
+ },
35
+
31
36
  label: {
32
- default: 'Settings',
37
+ default: 'Configurações',
33
38
  type: String
34
39
  },
35
40
 
36
41
  list: {
37
42
  default: () => ({}),
38
43
  type: Object
39
- },
40
-
41
- hideLabel: {
42
- type: Boolean
43
- },
44
-
45
- icon: {
46
- default: 'o_settings',
47
- type: String
48
44
  }
49
45
  },
50
46
 
@@ -55,12 +51,6 @@ export default {
55
51
  item.handler(filtered)
56
52
  }
57
53
  }
58
- },
59
-
60
- computed: {
61
- labelValue () {
62
- return this.hideLabel ? '' : this.label
63
- }
64
54
  }
65
55
  }
66
56
  </script>
@@ -70,7 +60,6 @@ export default {
70
60
  &__list {
71
61
  width: 265px;
72
62
  z-index: 1;
73
-
74
63
  }
75
64
  }
76
65
  </style>
@@ -0,0 +1,90 @@
1
+ <template>
2
+ <div v-if="model" class="q-pa-lg qas-alert relative-position rounded-borders" :class="classes">
3
+ <qas-btn class="absolute-top-right q-mr-md q-mt-sm" :color="color" dense flat icon="o_close" rounded @click="close" />
4
+
5
+ <div class="q-gutter-md q-mr-lg">
6
+ <slot name="header">
7
+ <h5 v-if="title" class="text-bold text-h5">{{ title }}</h5>
8
+ </slot>
9
+
10
+ <slot>
11
+ <qas-breakline tag="p" :text="text" />
12
+ </slot>
13
+ </div>
14
+ </div>
15
+ </template>
16
+
17
+ <script>
18
+ import QasBreakline from '../breakline/QasBreakline.vue'
19
+ import QasBtn from '../btn/QasBtn.vue'
20
+
21
+ export default {
22
+ name: 'QasAlert',
23
+
24
+ components: {
25
+ QasBreakline,
26
+ QasBtn
27
+ },
28
+
29
+ props: {
30
+ color: {
31
+ default: 'primary',
32
+ type: String
33
+ },
34
+
35
+ modelValue: {
36
+ default: true,
37
+ type: Boolean
38
+ },
39
+
40
+ text: {
41
+ default: '',
42
+ type: String
43
+ },
44
+
45
+ title: {
46
+ default: '',
47
+ type: String
48
+ }
49
+ },
50
+
51
+ emits: ['update:modelValue'],
52
+
53
+ data () {
54
+ return {
55
+ model: true
56
+ }
57
+ },
58
+
59
+ computed: {
60
+ classes () {
61
+ return {
62
+ [`text-${this.color}`]: true,
63
+ [`bg-${this.color}-contrast`]: ['primary', 'secondary'].includes(this.color)
64
+ }
65
+ }
66
+ },
67
+
68
+ watch: {
69
+ modelValue: {
70
+ handler (value) {
71
+ this.model = value
72
+ },
73
+ immediate: true
74
+ }
75
+ },
76
+
77
+ methods: {
78
+ close () {
79
+ this.$emit('update:modelValue', false)
80
+ }
81
+ }
82
+ }
83
+ </script>
84
+
85
+ <style lang="scss">
86
+ .qas-alert {
87
+ border-style: solid;
88
+ border-width: 0 10px;
89
+ }
90
+ </style>
@@ -1,82 +1,76 @@
1
1
  <template>
2
- <q-toolbar class="qas-toolbar">
3
- <q-ajax-bar color="white" position="top" size="2px" />
2
+ <q-header class="bg-white qas-app-bar shadow-primary" height-hint="70">
3
+ <q-toolbar class="qas-app-bar__toolbar" color="bg-white">
4
+ <q-ajax-bar color="white" position="top" size="2px" />
4
5
 
5
- <q-btn dense flat icon="o_menu" round @click="toggleMenuDrawer" />
6
+ <q-btn color="grey-7" dense flat icon="o_menu" round @click="toggleMenuDrawer" />
6
7
 
7
- <q-toolbar-title class="flex">
8
- <div class="cursor-pointer" @click="goToRoot">
9
- <img v-if="brand" :alt="title" class="q-mr-sm qas-toolbar__brand" :src="brand">
10
- <span v-if="title" class="text-bold text-primary-contrast text-subtitle1 text-uppercase">{{ title }}</span>
11
- <q-badge v-if="hasDevelopmentBadge" align="middle" class="q-ml-sm" color="negative" :label="developmentBadgeLabel" />
8
+ <q-toolbar-title class="flex">
9
+ <div class="cursor-pointer" @click="goToRoot">
10
+ <img v-if="brand" :alt="title" class="q-mr-sm qas-app-bar__brand" :src="brand">
11
+ <span v-if="showTitle" class="text-bold text-grey-9 text-subtitle1 text-uppercase">{{ title }}</span>
12
+ <q-badge v-if="hasDevelopmentBadge" align="middle" class="q-ml-sm" color="negative" :label="developmentBadgeLabel" />
13
+ </div>
14
+ </q-toolbar-title>
15
+
16
+ <div v-if="hasNotifications" class="q-mr-md">
17
+ <q-btn class="q-mr-md" dense icon="o_notifications" round unelevated>
18
+ <q-badge v-if="notifications" color="red" floating>{{ notifications.count }}</q-badge>
19
+ </q-btn>
12
20
  </div>
13
- </q-toolbar-title>
14
21
 
15
- <!-- TODO: Notificações. -->
16
- <div v-if="hasNotifications" class="q-mr-md">
17
- <q-btn class="q-mr-md" dense icon="o_notifications" round unelevated>
18
- <q-badge v-if="notifications" color="red" floating>{{ notifications.count }}</q-badge>
19
- </q-btn>
20
- </div>
22
+ <div class="items-center no-wrap q-gutter-md row">
23
+ <slot name="tools" />
21
24
 
22
- <qas-apps-menu v-if="hasApps" :apps="apps" class="q-mr-md" />
25
+ <div v-if="isAuth" class="cursor-pointer items-center q-mr-sm qas-app-bar__user rounded-borders row text-grey-9" :title="user.name || user.givenName">
26
+ <qas-avatar class="rounded-borders-left" color="white" dark :image="user.photo" rounded size="42px" text-color="primary" :title="user.name || user.givenName" />
23
27
 
24
- <div class="items-center no-wrap q-gutter-md row">
25
- <slot name="tools" />
28
+ <div class="q-px-sm qas-app-bar__user-data qs-lh-lg text-caption">
29
+ <div class="ellipsis">{{ user.name || user.givenName }}</div>
30
+ <div class="ellipsis text-bold">{{ user.email }}</div>
31
+ </div>
26
32
 
27
- <div v-if="isAuth" class="cursor-pointer items-center q-mr-sm qas-toolbar__user rounded-borders row" :title="user.name || user.givenName">
28
- <qas-avatar class="rounded-borders-left" color="white" dark :image="user.photo" rounded size="42px" text-color="primary" :title="user.name || user.givenName" />
33
+ <q-menu anchor="bottom end" class="shadow-primary" max-height="400px" :offset="[0, 5]" self="top end">
34
+ <div class="qas-app-bar__user-menu">
35
+ <div class="q-pa-lg text-center">
36
+ <button class="unset" @click="goToProfile">
37
+ <qas-avatar :image="user.photo" size="145px" :title="user.name || user.givenName" />
38
+ </button>
29
39
 
30
- <div class="q-px-sm qas-toolbar__user-data qs-lh-lg text-caption">
31
- <div class="ellipsis">{{ user.name || user.givenName }}</div>
32
- <div class="ellipsis text-bold">{{ user.email }}</div>
33
- </div>
40
+ <div class="ellipsis q-mt-lg qs-lh-sm text-bold text-subtitle1">{{ user.name || user.givenName }}</div>
41
+ <div class="ellipsis q-mt-xs text-caption">{{ user.email }}</div>
34
42
 
35
- <q-menu anchor="bottom end" content-class="shadow-primary" max-height="400px" :offset="[0, 5]" self="top end">
36
- <div class="qas-toolbar__user-menu">
37
- <div class="q-pa-lg text-center">
38
- <button class="unset" @click="goToProfile">
39
- <qas-avatar :image="user.photo" size="145px" :title="user.name || user.givenName" />
40
- </button>
43
+ <div class="q-mt-sm">
44
+ <qas-btn flat icon="o_edit" label="Editar" :to="user.to" />
45
+ </div>
41
46
 
42
- <div class="ellipsis q-mt-lg qs-lh-sm text-bold text-subtitle1">{{ user.name || user.givenName }}</div>
43
- <div class="ellipsis q-mt-xs text-caption">{{ user.email }}</div>
47
+ <div class="q-mt-sm">
48
+ <qas-btn v-close-popup class="q-px-lg q-py-xs" dense icon="o_exit_to_app" label="Sair" outline @click="signOut" />
49
+ </div>
44
50
 
45
- <div class="q-mt-sm">
46
- <qas-btn flat icon="o_edit" label="Editar" :to="user.to" />
51
+ <slot name="user" :user="user" />
47
52
  </div>
48
-
49
- <div class="q-mt-sm">
50
- <qas-btn v-close-popup class="q-px-lg q-py-xs" dense icon="o_exit_to_app" label="Sair" outline @click="signOut" />
51
- </div>
52
-
53
- <slot name="user" :user="user" />
54
53
  </div>
55
- </div>
56
- </q-menu>
54
+ </q-menu>
55
+ </div>
57
56
  </div>
58
- </div>
59
- </q-toolbar>
57
+ </q-toolbar>
58
+ </q-header>
60
59
  </template>
61
60
 
62
61
  <script>
63
- import QasAppsMenu from '../apps-menu/QasAppsMenu'
64
- import QasAvatar from '../avatar/QasAvatar'
65
- import QasBtn from '../btn/QasBtn'
62
+ import QasAvatar from '../avatar/QasAvatar.vue'
63
+ import QasBtn from '../btn/QasBtn.vue'
66
64
 
67
65
  export default {
66
+ name: 'QasAppBar',
67
+
68
68
  components: {
69
- QasAppsMenu,
70
69
  QasAvatar,
71
70
  QasBtn
72
71
  },
73
72
 
74
73
  props: {
75
- apps: {
76
- default: () => [],
77
- type: Array
78
- },
79
-
80
74
  brand: {
81
75
  default: '',
82
76
  type: String
@@ -103,6 +97,8 @@ export default {
103
97
  }
104
98
  },
105
99
 
100
+ emits: ['sign-out', 'toggle-menu'],
101
+
106
102
  data () {
107
103
  return {
108
104
  menuDrawer: true
@@ -128,16 +124,16 @@ export default {
128
124
  return current ? hosts[current] : ''
129
125
  },
130
126
 
131
- hasApps () {
132
- return !!this.apps.length
133
- },
134
-
135
127
  hasDevelopmentBadge () {
136
128
  return !!this.developmentBadgeLabel
137
129
  },
138
130
 
139
131
  hasNotifications () {
140
132
  return !!Object.keys(this.notifications).length
133
+ },
134
+
135
+ showTitle () {
136
+ return this.title && !this.brand
141
137
  }
142
138
  },
143
139
 
@@ -162,18 +158,20 @@ export default {
162
158
  </script>
163
159
 
164
160
  <style lang="scss">
165
- .qas-toolbar {
166
- height: 70px;
161
+ .qas-app-bar {
162
+ &__toolbar {
163
+ height: 70px;
164
+ }
167
165
 
168
166
  &__brand {
169
167
  height: 24px;
170
- margin-right: map-get($space-sm, x);
168
+ margin-right: 8px;
171
169
  position: relative;
172
170
  top: 4px;
173
171
  }
174
172
 
175
173
  &__user {
176
- background-color: rgba(white, 0.1);
174
+ background-color: var(--qas-background-color);
177
175
  transition: background-color $generic-hover-transition;
178
176
 
179
177
  &:focus,
@@ -1,35 +1,55 @@
1
1
  <template>
2
- <q-drawer v-model="model" content-class="bg-primary-contrast" :mini="miniMode" :width="230" @before-hide="beforeHide">
3
- <q-list class="text-primary">
4
- <div v-for="(header, index) in items" :key="index">
5
- <q-expansion-item v-if="hasChildren(header)" :active-class="activeSecondaryItemClasses" :default-opened="shouldExpand(header)" expand-icon="o_keyboard_arrow_down" expand-separator :icon="header.icon" :label="header.label" :to="header.to">
6
- <q-item v-for="(item, itemIndex) in header.children" :key="itemIndex" v-ripple :active-class="activeItemClasses" clickable :to="item.to">
7
- <q-item-section v-if="item.icon" avatar>
8
- <q-icon :name="item.icon" />
9
- </q-item-section>
10
- <q-item-section>
11
- <q-item-label>{{ item.label }}</q-item-label>
12
- </q-item-section>
13
- </q-item>
14
- </q-expansion-item>
15
-
16
- <q-item v-else :key="index" v-ripple :active-class="activeItemClasses" clickable :to="header.to">
17
- <q-item-section v-if="header.icon" avatar>
18
- <q-icon :name="header.icon" />
19
- </q-item-section>
20
- <q-item-section>
21
- <q-item-label>{{ header.label }}</q-item-label>
22
- </q-item-section>
23
- </q-item>
2
+ <q-drawer v-model="model" class="qas-app-menu" :mini="miniMode" :width="230" @before-hide="beforeHide" @mini-state="setMiniState">
3
+ <div class="column flex full-height justify-between no-wrap overflow-x-hidden">
4
+ <div>
5
+ <div v-if="displayModuleSection" class="q-ma-md">
6
+ <div class="q-mb-sm text-caption text-grey-7 text-weight-medium">
7
+ Você está no modulo:
8
+ </div>
9
+
10
+ <qas-select v-model="module" :options="defaultModules" @update:model-value="redirectHandler(currentModelOption)" />
11
+ </div>
12
+
13
+ <q-list class="text-grey-9 text-weight-medium">
14
+ <template v-for="(header, index) in items">
15
+ <q-expansion-item v-if="hasChildren(header)" :key="header.label" :ref="`item-${index}`" :active-class="activeItemClassesSecondary" :default-opened="shouldExpand(header)" expand-icon="o_keyboard_arrow_down" expand-separator group="item" :icon="header.icon" :label="header.label" :to="header.to" @click="toggleItem(index)">
16
+ <q-item v-for="(item, itemIndex) in header.children" :key="itemIndex" v-ripple :active-class="activeItemClasses" clickable :to="item.to">
17
+ <q-item-section v-if="item.icon" avatar>
18
+ <q-icon :name="item.icon" />
19
+ </q-item-section>
20
+ <q-item-section>
21
+ <q-item-label>{{ item.label }}</q-item-label>
22
+ </q-item-section>
23
+ </q-item>
24
+ </q-expansion-item>
25
+
26
+ <q-item v-else :key="index" v-ripple :active-class="activeItemClasses" clickable :to="header.to">
27
+ <q-item-section v-if="header.icon" avatar>
28
+ <q-icon :name="header.icon" />
29
+ </q-item-section>
30
+ <q-item-section>
31
+ <q-item-label>{{ header.label }}</q-item-label>
32
+ </q-item-section>
33
+ </q-item>
34
+ </template>
35
+ </q-list>
24
36
  </div>
25
- </q-list>
37
+
38
+ <div class="q-mx-md">
39
+ <!-- TODO: O Modular não é o Asteroid, então não podemos manter esse logo aqui. -->
40
+ <img v-if="!isMini" alt="Modular" class="block q-mb-md q-mx-auto" src="../../assets/logo-modular.svg">
41
+ </div>
42
+ </div>
26
43
  </q-drawer>
27
44
  </template>
28
45
 
29
46
  <script>
30
47
  import { screenMixin } from '../../mixins'
48
+ import { isLocalDevelopment } from '../../helpers'
31
49
 
32
50
  export default {
51
+ name: 'QasAppMenu',
52
+
33
53
  mixins: [screenMixin],
34
54
 
35
55
  props: {
@@ -43,35 +63,88 @@ export default {
43
63
  type: Array
44
64
  },
45
65
 
46
- value: {
66
+ modelValue: {
47
67
  default: true,
48
68
  type: Boolean
69
+ },
70
+
71
+ title: {
72
+ default: '',
73
+ type: String
74
+ },
75
+
76
+ modules: {
77
+ default: () => [],
78
+ type: Array
49
79
  }
50
80
  },
51
81
 
82
+ emits: ['update:modelValue'],
83
+
52
84
  data () {
53
85
  return {
54
- miniMode: false
86
+ miniMode: false,
87
+ module: '',
88
+ isMini: false
55
89
  }
56
90
  },
57
91
 
58
92
  computed: {
59
93
  activeItemClasses () {
60
- return 'bg-primary text-primary-contrast'
94
+ return 'bg-primary-contrast text-primary text-weight-bold'
95
+ },
96
+
97
+ activeItemClassesSecondary () {
98
+ return 'text-primary bg-secondary-contrast'
61
99
  },
62
100
 
63
- activeSecondaryItemClasses () {
64
- return 'active bg-secondary-contrast text-primary-contrast'
101
+ defaultModules () {
102
+ if (!isLocalDevelopment()) return this.modules
103
+
104
+ const defaultModules = [...this.modules]
105
+ const { host, protocol } = window.location
106
+ const value = `${protocol}//${host}`
107
+
108
+ // if app is in development mode (local) it's added a default module
109
+ defaultModules.unshift({
110
+ label: `Localhost ${this.title ? `(${this.title})` : ''}`,
111
+ value
112
+ })
113
+
114
+ return defaultModules
65
115
  },
66
116
 
67
117
  model: {
68
118
  get () {
69
- return this.value
119
+ return this.modelValue
70
120
  },
71
121
 
72
122
  set (value) {
73
- return this.$emit('input', value)
123
+ return this.$emit('update:modelValue', value)
74
124
  }
125
+ },
126
+
127
+ currentModelOption () {
128
+ return this.defaultModules.find(module => module?.value === this.module)
129
+ },
130
+
131
+ displayModuleSection () {
132
+ return !this.isMini && this.defaultModules.length
133
+ },
134
+
135
+ currentModule () {
136
+ const hostname = window.location.hostname
137
+
138
+ return this.defaultModules.find(module => module?.value.includes(hostname))?.value
139
+ }
140
+ },
141
+
142
+ watch: {
143
+ currentModule: {
144
+ handler (value) {
145
+ this.module = value
146
+ },
147
+ immediate: true
75
148
  }
76
149
  },
77
150
 
@@ -81,29 +154,43 @@ export default {
81
154
  },
82
155
 
83
156
  shouldExpand ({ children, to }) {
84
- return children?.length && this.$route.matched.some(item => item.path === to.path)
157
+ return children?.length && this.$route.matched.some(item => item?.path === to?.path)
85
158
  },
86
159
 
87
160
  beforeHide () {
88
- if (this.$_isLarge) {
161
+ if (this.mx_isLarge) {
89
162
  this.model = true
90
163
  this.miniMode = !this.miniMode
91
164
  }
165
+ },
166
+
167
+ setMiniState (value) {
168
+ this.isMini = value
169
+ },
170
+
171
+ redirectHandler ({ value }) {
172
+ if (!value.includes(window.location.host)) {
173
+ window.location.href = value
174
+ }
175
+ },
176
+
177
+ toggleItem (index) {
178
+ const component = this.getComponent(index)
179
+
180
+ component?.to && this.isMini && component.toggle()
181
+ },
182
+
183
+ getComponent (index) {
184
+ return this.$refs[`item-${index}`]?.[0]
92
185
  }
93
186
  }
94
187
  }
95
188
  </script>
96
189
 
97
190
  <style lang="scss">
98
- .q-expansion-item {
99
- .active .q-expansion-item__toggle-icon {
100
- color: white !important;
101
- opacity: 1;
102
- }
103
-
104
- .q-expansion-item__toggle-icon {
105
- color: $primary;
106
- opacity: 0.2;
191
+ .qas-app-menu {
192
+ .q-expansion-item--expanded .q-item:not(&--active.q-item) {
193
+ background-color: $grey-1;
107
194
  }
108
195
  }
109
196
  </style>
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <q-avatar class="text-bold" :class="classes" rounded v-bind="$attrs" v-on="$listeners">
2
+ <q-avatar class="text-bold" :class="avatarClass" rounded>
3
3
  <q-img v-if="hasImage" :alt="title" :ratio="1" spinner-color="primary" spinner-size="16px" :src="image" @error="onImageLoadedError" />
4
4
  <template v-else-if="hasTitle">{{ firstLetter }}</template>
5
5
  <q-icon v-else :name="icon" />
@@ -8,6 +8,8 @@
8
8
 
9
9
  <script>
10
10
  export default {
11
+ name: 'QasAvatar',
12
+
11
13
  props: {
12
14
  color: {
13
15
  default: 'primary',
@@ -46,8 +48,10 @@ export default {
46
48
  },
47
49
 
48
50
  computed: {
49
- classes () {
50
- if (this.hasImage) return
51
+ avatarClass () {
52
+ if (this.hasImage) {
53
+ return null
54
+ }
51
55
 
52
56
  const contrastColor = this.textColor ? this.textColor : this.contrastColor
53
57
 
@@ -1,21 +1,29 @@
1
1
  <template>
2
- <div v-bind="$attrs" class="bg-white q-px-md q-py-lg rounded-borders" :class="boxClass" v-on="$listeners">
2
+ <div class="bg-white q-px-md q-py-lg rounded-borders" :class="boxClass">
3
3
  <slot />
4
4
  </div>
5
5
  </template>
6
6
 
7
7
  <script>
8
8
  export default {
9
+ name: 'QasBox',
10
+
9
11
  props: {
10
- // TODO: Alterar para o outlined e unelevated.
11
- formMode: {
12
+ outlined: {
13
+ type: Boolean
14
+ },
15
+
16
+ unelevated: {
12
17
  type: Boolean
13
18
  }
14
19
  },
15
20
 
16
21
  computed: {
17
22
  boxClass () {
18
- return this.formMode ? 'border-primary-contrast' : 'shadow-primary'
23
+ return {
24
+ 'border-primary-contrast': this.outlined,
25
+ 'shadow-primary': !this.unelevated
26
+ }
19
27
  }
20
28
  }
21
29
  }