@bildvitta/quasar-ui-asteroid 3.10.0-beta.7 → 3.10.0-beta.8

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.10.0-beta.7",
4
+ "version": "3.10.0-beta.8",
5
5
  "author": "Bild & Vitta <systemteam@bild.com.br>",
6
6
  "license": "MIT",
7
7
  "main": "dist/asteroid.cjs.min.js",
@@ -12,8 +12,7 @@
12
12
  "src"
13
13
  ],
14
14
  "scripts": {
15
- "build": "npx rollup -c",
16
- "dev": "cd dev && npm i && npm run dev && cd .."
15
+ "build": "npx rollup -c --bundleConfigAsCjs"
17
16
  },
18
17
  "publishConfig": {
19
18
  "access": "public",
@@ -28,34 +27,33 @@
28
27
  "components"
29
28
  ],
30
29
  "devDependencies": {
31
- "@rollup/plugin-json": "^4.1.0",
32
- "@rollup/plugin-replace": "^3.0.1",
33
- "@rollup/plugin-url": "^6.1.0",
34
- "@vue/compiler-sfc": "^3.2.31",
35
- "autoprefixer": "^10.4.2",
36
- "core-js": "^3.20.2",
37
- "postcss": "^8.4.5",
38
- "quasar": "^2.11.10",
39
- "rimraf": "^3.0.2",
40
- "rollup": "^2.66.0",
30
+ "@rollup/plugin-json": "^6.0.0",
31
+ "@rollup/plugin-replace": "^5.0.2",
32
+ "@rollup/plugin-url": "^8.0.1",
33
+ "@vue/compiler-sfc": "^3.3.4",
34
+ "autoprefixer": "^10.4.14",
35
+ "core-js": "^3.30.2",
36
+ "postcss": "^8.4.24",
37
+ "quasar": "^2.12.0",
38
+ "rimraf": "^5.0.1",
39
+ "rollup": "^3.23.1",
41
40
  "rollup-plugin-local-resolve": "^1.0.7",
42
- "rollup-plugin-scss": "^3.0.0",
43
- "rollup-plugin-terser": "^7.0.2",
41
+ "rollup-plugin-scss": "^4.0.0",
44
42
  "rollup-plugin-vue": "^6.0.0",
45
- "sass": "^1.49.0"
43
+ "sass": "^1.62.1"
46
44
  },
47
45
  "dependencies": {
48
46
  "@bildvitta/store-adapter": "^1.0.0",
49
- "@fawmi/vue-google-maps": "^0.9.4",
50
- "autonumeric": "^4.6.0",
51
- "axios": "^0.21.1",
52
- "date-fns": "^2.28.0",
53
- "fuse.js": "^6.5.3",
47
+ "@fawmi/vue-google-maps": "^0.9.79",
48
+ "autonumeric": "^4.9.0",
49
+ "axios": "^1.4.0",
50
+ "date-fns": "^2.30.0",
51
+ "fuse.js": "^6.6.2",
54
52
  "humps": "^2.0.1",
55
53
  "lodash-es": "^4.17.21",
56
54
  "pica": "^9.0.1",
57
- "signature_pad": "^4.0.1",
58
- "sortablejs": "^1.14.0"
55
+ "signature_pad": "^4.1.5",
56
+ "sortablejs": "^1.15.0"
59
57
  },
60
58
  "browserslist": [
61
59
  "defaults"
@@ -233,7 +233,7 @@ export default {
233
233
  if (this.useDateOnly) return this.validateDateOnly(value)
234
234
  if (this.useTimeOnly) return this.validateTimeOnly(value)
235
235
 
236
- const [date, time] = value?.split(' ')
236
+ const [date, time] = value?.split(' ') || []
237
237
 
238
238
  return this.validateDateOnly(date) || this.validateTimeOnly(time)
239
239
  },
@@ -4,7 +4,7 @@
4
4
  <div v-if="showSearch" class="col-12 col-md-6">
5
5
  <slot :filter="filter" name="search">
6
6
  <q-form v-if="useSearch" @submit.prevent="filter()">
7
- <qas-search-input v-model="search" :placeholder="searchPlaceholder" :use-search-on-type="useSearchOnType" @filter="filter()" @update:model-value="onSearch">
7
+ <qas-search-input v-model="search" :placeholder="searchPlaceholder" :use-search-on-type="useSearchOnType" @clear="clearSearch" @filter="filter()" @update:model-value="onSearch">
8
8
  <template v-if="showFilterButton" #after-clear>
9
9
  <slot :context="mx_context" :filter="filter" :filters="activeFilters" name="filter-button" :remove-filter="removeFilter">
10
10
  <pv-filters-button v-if="useFilterButton" ref="filtersButton" v-model="filters" v-bind="filterButtonProps" />
@@ -1,4 +1,3 @@
1
-
2
1
  <template>
3
2
  <div class="qas-gallery">
4
3
  <div class="q-col-gutter-md row">
@@ -27,7 +27,7 @@
27
27
  <script>
28
28
  import { QInfiniteScroll } from 'quasar'
29
29
  import Fuse from 'fuse.js'
30
-
30
+ import fuseConfig from '../../shared/fuse-config'
31
31
  import QasBox from '../box/QasBox.vue'
32
32
  import { searchFilterMixin } from '../../mixins'
33
33
 
@@ -139,8 +139,7 @@ export default {
139
139
 
140
140
  defaultFuseOptions () {
141
141
  return {
142
- ignoreLocation: true,
143
-
142
+ ...fuseConfig,
144
143
  ...this.fuseOptions
145
144
  }
146
145
  },
@@ -29,7 +29,7 @@ props:
29
29
  examples: ["{ keys: ['label'] }"]
30
30
  default:
31
31
  ignoreLocation: true
32
- threshold: 0.6
32
+ threshold: 0.4
33
33
 
34
34
  height:
35
35
  desc: Define altura do box quando a lista não está vazia.
@@ -29,8 +29,10 @@
29
29
  </template>
30
30
 
31
31
  <script>
32
+ import { uid } from 'quasar'
32
33
  import { searchFilterMixin } from '../../mixins'
33
34
  import Fuse from 'fuse.js'
35
+ import fuseConfig from '../../shared/fuse-config'
34
36
 
35
37
  export default {
36
38
  name: 'QasSelect',
@@ -69,21 +71,25 @@ export default {
69
71
  }
70
72
  },
71
73
 
72
- emits: ['update:modelValue'],
74
+ emits: ['popup-hide', 'popup-show', 'update:modelValue', 'virtual-scroll'],
73
75
 
74
76
  data () {
75
77
  return {
76
- fuse: null
78
+ fuse: null,
79
+ isPopupContentOpen: false
77
80
  }
78
81
  },
79
82
 
80
83
  computed: {
81
84
  attributes () {
82
85
  return {
86
+ class: 'qas-select',
83
87
  clearable: this.isSearchable,
84
88
  emitValue: true,
85
89
  mapOptions: true,
86
90
  outlined: true,
91
+ popupContentClass: this.popupContentClass,
92
+
87
93
  ...this.$attrs,
88
94
 
89
95
  error: this.hasError,
@@ -91,14 +97,20 @@ export default {
91
97
  loading: this.hasLoading,
92
98
  options: this.mx_filteredOptions,
93
99
  useInput: this.isSearchable,
100
+
94
101
  ...(this.isSearchable && { onFilter: this.onFilter }),
95
- ...(this.useLazyLoading && { onVirtualScroll: this.mx_onVirtualScroll })
102
+
103
+ ...(this.useLazyLoading && {
104
+ onPopupHide: this.onPopupHide,
105
+ onPopupShow: this.onPopupShow,
106
+ onVirtualScroll: this.mx_onVirtualScroll
107
+ })
96
108
  }
97
109
  },
98
110
 
99
111
  defaultFuseOptions () {
100
112
  return {
101
- ignoreLocation: true,
113
+ ...fuseConfig,
102
114
  keys: ['label', 'value'],
103
115
 
104
116
  ...this.fuseOptions
@@ -139,6 +151,10 @@ export default {
139
151
  set (value) {
140
152
  this.$emit('update:modelValue', value)
141
153
  }
154
+ },
155
+
156
+ popupContentClass () {
157
+ return `qas-select__popup-content-${uid()}`
142
158
  }
143
159
  },
144
160
 
@@ -162,6 +178,7 @@ export default {
162
178
 
163
179
  created () {
164
180
  this.setSearchMethod()
181
+ this.setIsFetchingWatcher()
165
182
  },
166
183
 
167
184
  methods: {
@@ -192,6 +209,30 @@ export default {
192
209
  this.mx_filteredOptions = this.mx_getNormalizedFuseResults(results)
193
210
  },
194
211
 
212
+ onPopupHide () {
213
+ this.isPopupContentOpen = false
214
+ this.$emit('popup-hide')
215
+ },
216
+
217
+ onPopupShow () {
218
+ this.isPopupContentOpen = true
219
+ this.$emit('popup-show')
220
+
221
+ if (this.mx_isFetching) {
222
+ this.togglePopupContentClass(true)
223
+ }
224
+ },
225
+
226
+ setIsFetchingWatcher () {
227
+ if (this.useLazyLoading) {
228
+ this.$watch('mx_isFetching', value => {
229
+ if (!this.isPopupContentOpen) return
230
+
231
+ this.togglePopupContentClass(value)
232
+ })
233
+ }
234
+ },
235
+
195
236
  setLazyLoading () {
196
237
  this.mx_setCachedOptions('options')
197
238
 
@@ -202,7 +243,33 @@ export default {
202
243
  if (this.useLazyLoading) return this.setLazyLoading()
203
244
 
204
245
  if (this.hasFuse) this.setFuse()
246
+ },
247
+
248
+ async togglePopupContentClass (force) {
249
+ await this.$nextTick()
250
+
251
+ const popupContentElement = document.querySelector(`.${this.popupContentClass}`)
252
+
253
+ if (popupContentElement) {
254
+ popupContentElement.classList.toggle('qas-select__is-fetching', force)
255
+ }
205
256
  }
206
257
  }
207
258
  }
208
259
  </script>
260
+
261
+ <style lang="scss">
262
+ .qas-select {
263
+ &__is-fetching {
264
+ cursor: not-allowed !important;
265
+
266
+ .q-virtual-scroll__content {
267
+ pointer-events: none;
268
+
269
+ .q-item {
270
+ color: $grey-6;
271
+ }
272
+ }
273
+ }
274
+ }
275
+ </style>
@@ -27,7 +27,7 @@ props:
27
27
  default:
28
28
  ignoreLocation: true
29
29
  keys: [label, value]
30
- threshold: 0.6
30
+ threshold: 0.4
31
31
 
32
32
  label-key:
33
33
  desc: O componente internamente espera receber na propriedade "options" um array de objeto contendo "label" e "value", caso o seu objeto não tenha "label" mas um "name" por exemplo, você pode definir esta prop "label-key" como "name".
@@ -77,21 +77,19 @@ export default {
77
77
 
78
78
  mx_hasFilteredOptions () {
79
79
  return !!this.mx_filteredOptions.length
80
- },
81
-
82
- mx_isMultiple () {
83
- return this.$attrs.multiple || this.$attrs.multiple === ''
84
80
  }
85
81
  },
86
82
 
87
83
  watch: {
88
- lazyLoadingProps: {
89
- handler (value, oldValue) {
90
- if (isEqual(value, oldValue)) return
84
+ 'lazyLoadingProps.params': {
85
+ handler (newParams, oldParams) {
86
+ if (isEqual(newParams, oldParams)) return
87
+
88
+ this.mx_cachedOptions = []
91
89
 
92
90
  this.mx_filterOptionsByStore('')
93
91
 
94
- this.$emit('update:modelValue', this.mx_isMultiple ? [] : '')
92
+ this.$emit('update:modelValue', undefined)
95
93
  }
96
94
  }
97
95
  },
@@ -126,7 +124,8 @@ export default {
126
124
  }
127
125
  },
128
126
 
129
- async mx_onVirtualScroll ({ index, ref }) {
127
+ async mx_onVirtualScroll (details) {
128
+ const { index, ref } = details
130
129
  const lastIndex = this.mx_filteredOptions.length - 1
131
130
 
132
131
  if (index === lastIndex && this.mx_canFetchOptions()) {
@@ -137,6 +136,8 @@ export default {
137
136
  ref.refresh(lastIndex)
138
137
  })
139
138
  }
139
+
140
+ this.$emit('virtual-scroll', details)
140
141
  },
141
142
 
142
143
  async mx_loadMoreOptions () {
@@ -0,0 +1,4 @@
1
+ export default {
2
+ ignoreLocation: true,
3
+ threshold: 0.4
4
+ }