@burh/nuxt-core 1.0.370 → 1.0.372

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.
@@ -104,9 +104,12 @@
104
104
  v-model="city"
105
105
  placeholder="Cidade"
106
106
  filterable
107
+ remote
108
+ :remote-method="getCityList"
107
109
  :auto-complete="`${city}-new`"
108
110
  :error="errors[0]"
109
111
  :valid="errors.length ? true : false"
112
+ :loading="isSelectLoading"
110
113
  >
111
114
  <div class="text-center" slot="empty">
112
115
  <p class="small mb-2 mt-3">Nenhuma cidade encontrada</p>
@@ -200,6 +203,7 @@ export default {
200
203
  isActive(to) {
201
204
  if (!to) {
202
205
  this.resetFields();
206
+ this.cityList = [];
203
207
  }
204
208
  },
205
209
  userData(to) {
@@ -227,9 +231,8 @@ export default {
227
231
  cep: '',
228
232
  address: '',
229
233
  city: '',
230
-
231
234
  isEditing: false,
232
-
235
+ isSelectLoading: false,
233
236
  cityList: [],
234
237
  permissions: false,
235
238
  permessionsData: [
@@ -277,16 +280,30 @@ export default {
277
280
  title: message,
278
281
  });
279
282
  },
280
- async getCityList() {
281
- let cityList = await fetch('https://raw.githubusercontent.com/Skuth/cidades-com-estados-brasil/main/cidades.json')
282
- .then(res => res.json())
283
- .catch(() => {});
283
+ async getCityList(query) {
284
+ const getCityData = async ()=> {
285
+ return await fetch('https://raw.githubusercontent.com/Skuth/cidades-com-estados-brasil/main/cidades.json')
286
+ .then(res => res.json())
287
+ .catch(() => {});
288
+ };
284
289
 
285
- this.cityList = cityList.map(city => {
286
- return {
287
- value: `${city.city} / ${city.uf}`
288
- };
289
- });
290
+ if (query && query.length > 3) {
291
+ this.isSelectLoading = true;
292
+
293
+ let cityList = await getCityData();
294
+
295
+ cityList = cityList.filter(city => String(city.city).toLowerCase().startsWith(query.toLowerCase()));
296
+
297
+ this.cityList = cityList.map(city => {
298
+ return {
299
+ value: `${city.city} / ${city.uf}`
300
+ };
301
+ });
302
+
303
+ this.isSelectLoading = false;
304
+ } else if (this.cityList.length > 0 && query.length <= 3) {
305
+ this.cityList = [];
306
+ }
290
307
  },
291
308
  async checkZipcode() {
292
309
  await this.$services.company
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@burh/nuxt-core",
3
- "version": "1.0.370",
3
+ "version": "1.0.372",
4
4
  "description": "Design System and Components.",
5
5
  "author": "Burh",
6
6
  "scripts": {