@bildvitta/quasar-ui-asteroid 2.13.0 → 2.15.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bildvitta/quasar-ui-asteroid",
3
- "version": "2.13.0",
3
+ "version": "2.15.0",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "scripts": {
@@ -30,6 +30,10 @@ export default {
30
30
  description: 'Controls drawer menu visibility.'
31
31
  },
32
32
 
33
+ title: {
34
+ description: 'Title for displaying inside "modules" as label when is in development (local).'
35
+ },
36
+
33
37
  // Events
34
38
  input: {
35
39
  description: 'Fires when opening or closing the drawer menu.'
@@ -7,12 +7,12 @@
7
7
  Você está no modulo:
8
8
  </div>
9
9
 
10
- <qas-select v-model="module" :options="modules" @input="redirectHandler(currentModelOption)" />
10
+ <qas-select v-model="module" :options="defaultModules" @input="redirectHandler(currentModelOption)" />
11
11
  </div>
12
12
 
13
13
  <q-list class="text-grey-9 text-weight-medium">
14
14
  <template v-for="(header, index) in items">
15
- <q-expansion-item v-if="hasChildren(header)" :key="header.label" :ref="`item-${index}`" :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)" :active-class="activeItemClassesSecondary">
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
16
  <q-item v-for="(item, itemIndex) in header.children" :key="itemIndex" v-ripple :active-class="activeItemClasses" clickable :to="item.to">
17
17
  <q-item-section v-if="item.icon" avatar>
18
18
  <q-icon :name="item.icon" />
@@ -44,6 +44,7 @@
44
44
 
45
45
  <script>
46
46
  import { screenMixin } from '../../mixins'
47
+ import { isLocalDevelopment } from '../../helpers'
47
48
 
48
49
  export default {
49
50
  name: 'QasAppMenu',
@@ -66,14 +67,14 @@ export default {
66
67
  type: Boolean
67
68
  },
68
69
 
70
+ title: {
71
+ default: '',
72
+ type: String
73
+ },
74
+
69
75
  modules: {
70
76
  default: () => [],
71
77
  type: Array
72
- },
73
-
74
- currentModule: {
75
- default: '',
76
- type: String
77
78
  }
78
79
  },
79
80
 
@@ -94,6 +95,22 @@ export default {
94
95
  return 'text-primary bg-secondary-contrast'
95
96
  },
96
97
 
98
+ defaultModules () {
99
+ if (!isLocalDevelopment()) return this.modules
100
+
101
+ const defaultModules = [...this.modules]
102
+ const { host, protocol } = window.location
103
+ const value = `${protocol}//${host}`
104
+
105
+ // if app is in development mode (local) it's added a default module
106
+ defaultModules.unshift({
107
+ label: `Localhost ${this.title ? `(${this.title})` : ''}`,
108
+ value
109
+ })
110
+
111
+ return defaultModules
112
+ },
113
+
97
114
  model: {
98
115
  get () {
99
116
  return this.value
@@ -105,11 +122,17 @@ export default {
105
122
  },
106
123
 
107
124
  currentModelOption () {
108
- return this.modules.find(module => module?.value === this.module)
125
+ return this.defaultModules.find(module => module?.value === this.module)
109
126
  },
110
127
 
111
128
  displayModuleSection () {
112
- return !this.isMini && this.modules.length
129
+ return !this.isMini && this.defaultModules.length
130
+ },
131
+
132
+ currentModule () {
133
+ const hostname = window.location.hostname
134
+
135
+ return this.defaultModules.find(module => module?.value.includes(hostname))?.value
113
136
  }
114
137
  },
115
138
 
@@ -142,9 +165,9 @@ export default {
142
165
  this.isMini = value
143
166
  },
144
167
 
145
- redirectHandler ({ path }) {
146
- if (!path.includes(window.location.host)) {
147
- window.location.href = path
168
+ redirectHandler ({ value }) {
169
+ if (!value.includes(window.location.host)) {
170
+ window.location.href = value
148
171
  }
149
172
  },
150
173
 
@@ -89,9 +89,7 @@ Default.args = {
89
89
  value: 'test-2',
90
90
  path: 'https://google.com'
91
91
  }
92
- ],
93
-
94
- currentModule: 'test'
92
+ ]
95
93
  },
96
94
 
97
95
  appBarProps: {
@@ -5,7 +5,7 @@
5
5
  </slot>
6
6
 
7
7
  <slot name="app-menu">
8
- <qas-app-menu v-model="menuDrawer" v-bind="appMenuProps" v-on="appMenuEvents" />
8
+ <qas-app-menu v-model="menuDrawer" v-bind="defaultAppMenuProps" v-on="appMenuEvents" />
9
9
  </slot>
10
10
 
11
11
  <slot>
@@ -61,11 +61,16 @@ export default {
61
61
  }
62
62
  },
63
63
 
64
- watch: {
65
- $route () {
66
- console.log('chamado no layout')
67
- },
64
+ computed: {
65
+ defaultAppMenuProps () {
66
+ return {
67
+ ...this.appMenuProps,
68
+ title: this.appBarProps?.title
69
+ }
70
+ }
71
+ },
68
72
 
73
+ watch: {
69
74
  value: {
70
75
  handler (value) {
71
76
  this.menuDrawer = value
@@ -38,7 +38,12 @@ export default {
38
38
 
39
39
  redirectKey: {
40
40
  control: null,
41
- description: 'Key to define the id redirect.'
41
+ description: 'Item key that will be the value of the redirect.'
42
+ },
43
+
44
+ paramKey: {
45
+ control: null,
46
+ description: 'Redirect parameter key.'
42
47
  },
43
48
 
44
49
  useIconRedirect: {
@@ -44,6 +44,11 @@ export default {
44
44
  type: String
45
45
  },
46
46
 
47
+ paramKey: {
48
+ default: 'id',
49
+ type: String
50
+ },
51
+
47
52
  to: {
48
53
  default: () => ({}),
49
54
  type: Object
@@ -61,7 +66,7 @@ export default {
61
66
 
62
67
  getRedirectPayload (item) {
63
68
  return {
64
- params: { [this.redirectKey]: item[this.redirectKey] },
69
+ params: { [this.paramKey]: item[this.redirectKey] },
65
70
  ...this.to
66
71
  }
67
72
  }
@@ -9,7 +9,7 @@
9
9
  <script>
10
10
  import { greatestCommonDivisor } from '../../helpers'
11
11
 
12
- const baseURL = 'https://d17ouzaofz81f3.cloudfront.net/'
12
+ const baseURL = 'https://image-resize.nave.dev/'
13
13
 
14
14
  export default {
15
15
  name: 'QasResizer',
@@ -79,7 +79,6 @@ export default {
79
79
  // overrides "__addFiles" from quasar
80
80
  async __addFiles (event, files = []) {
81
81
  const filesToUpload = event?.target?.files || files
82
- this.files = []
83
82
  this.isAddingFiles = true
84
83
 
85
84
  const filesPromise = []
@@ -97,7 +97,7 @@ function handleMasks (value) {
97
97
  // Labels
98
98
  function humanize (field = {}, value) {
99
99
  if (!value) return value
100
-
100
+
101
101
  const mappedMasks = handleMasks(value)
102
102
 
103
103
  if (mappedMasks[field.mask]) {
@@ -1,8 +1,9 @@
1
1
  import base64ToBlob from './base64ToBlob.js'
2
+ import constructObject from './constructObject.js'
2
3
  import filterObject from './filter-object.js'
3
4
  import greatestCommonDivisor from './greatestCommonDivisor.js'
5
+ import isLocalDevelopment from './isLocalDevelopment.js'
4
6
  import { history, handleHistory } from './historyHandler.js'
5
- import constructObject from './constructObject.js'
6
7
 
7
8
  import {
8
9
  asset,
@@ -53,5 +54,6 @@ export {
53
54
 
54
55
  base64ToBlob,
55
56
  filterObject,
56
- greatestCommonDivisor
57
+ greatestCommonDivisor,
58
+ isLocalDevelopment
57
59
  }
@@ -0,0 +1,3 @@
1
+ export default function () {
2
+ return ['localhost', '127.0.0.1'].includes(window.location.hostname)
3
+ }