vue-laravel-crud 1.5.7 → 1.5.9

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.
@@ -11878,7 +11878,7 @@ var InfiniteLoading = /*@__PURE__*/getDefaultExportFromCjs(vueInfiniteLoadingExp
11878
11878
 
11879
11879
  var e=[],t=[];function n(n,r){if(n&&"undefined"!=typeof document){var a,s=!0===r.prepend?"prepend":"append",d=!0===r.singleTag,i="string"==typeof r.container?document.querySelector(r.container):document.getElementsByTagName("head")[0];if(d){var u=e.indexOf(i);-1===u&&(u=e.push(i)-1,t[u]={}),a=t[u]&&t[u][s]?t[u][s]:t[u][s]=c();}else a=c();65279===n.charCodeAt(0)&&(n=n.substring(1)),a.styleSheet?a.styleSheet.cssText+=n:a.appendChild(document.createTextNode(n));}function c(){var e=document.createElement("style");if(e.setAttribute("type","text/css"),r.attributes)for(var t=Object.keys(r.attributes),n=0;n<t.length;n++)e.setAttribute(t[n],r.attributes[t[n]]);var a="prepend"===s?"afterbegin":"beforeend";return i.insertAdjacentElement(a,e),e}}
11880
11880
 
11881
- var css = "tr td[data-v-9f4fbca3]:last-child,\ntr td[data-v-9f4fbca3]:first-child {\n width: 1%;\n white-space: nowrap; }\n\n.crud-pagination[data-v-9f4fbca3] {\n display: flex;\n justify-content: center; }\n\n.crud-header[data-v-9f4fbca3] {\n display: flex;\n justify-content: space-between;\n max-height: 3rem; }\n .crud-header[data-v-9f4fbca3] .crud-title[data-v-9f4fbca3] {\n margin: 0; }\n .crud-header[data-v-9f4fbca3] .crud-search[data-v-9f4fbca3] {\n max-width: 15rem; }\n .crud-header[data-v-9f4fbca3] .crud-search[data-v-9f4fbca3] .btn[data-v-9f4fbca3] {\n border-top-left-radius: 0;\n border-bottom-left-radius: 0;\n border-top-right-radius: 0.375rem;\n border-bottom-right-radius: 0.375rem; }\n .crud-header[data-v-9f4fbca3] .crud-search[data-v-9f4fbca3] .btn[data-v-9f4fbca3].open[data-v-9f4fbca3] {\n border-top-right-radius: 0;\n border-bottom-right-radius: 0; }\n .crud-header[data-v-9f4fbca3] .table-options[data-v-9f4fbca3] {\n margin-bottom: 1rem;\n display: flex;\n align-items: center;\n justify-content: flex-end; }\n\n.custom-control[data-v-9f4fbca3] {\n position: relative;\n top: -15px; }\n\n@media (min-width: 992px) {\n .table[data-v-9f4fbca3] {\n table-layout: auto; }\n .table[data-v-9f4fbca3] tbody[data-v-9f4fbca3] td[data-v-9f4fbca3] {\n overflow: scroll;\n -ms-overflow-style: none;\n /* IE and Edge */\n scrollbar-width: none;\n /* Firefox */ }\n .table[data-v-9f4fbca3] tbody[data-v-9f4fbca3] td[data-v-9f4fbca3]::-webkit-scrollbar {\n display: none; } }\n";
11881
+ var css = "tr td[data-v-d1f59823]:last-child,\ntr td[data-v-d1f59823]:first-child {\n width: 1%;\n white-space: nowrap; }\n\n.crud-pagination[data-v-d1f59823] {\n display: flex;\n justify-content: center; }\n\n.crud-header[data-v-d1f59823] {\n display: flex;\n justify-content: space-between;\n max-height: 3rem; }\n .crud-header[data-v-d1f59823] .crud-title[data-v-d1f59823] {\n margin: 0; }\n .crud-header[data-v-d1f59823] .crud-search[data-v-d1f59823] {\n max-width: 15rem; }\n .crud-header[data-v-d1f59823] .crud-search[data-v-d1f59823] .btn[data-v-d1f59823] {\n border-top-left-radius: 0;\n border-bottom-left-radius: 0;\n border-top-right-radius: 0.375rem;\n border-bottom-right-radius: 0.375rem; }\n .crud-header[data-v-d1f59823] .crud-search[data-v-d1f59823] .btn[data-v-d1f59823].open[data-v-d1f59823] {\n border-top-right-radius: 0;\n border-bottom-right-radius: 0; }\n .crud-header[data-v-d1f59823] .table-options[data-v-d1f59823] {\n margin-bottom: 1rem;\n display: flex;\n align-items: center;\n justify-content: flex-end; }\n\n.custom-control[data-v-d1f59823] {\n position: relative;\n top: -15px; }\n\n@media (min-width: 992px) {\n .table[data-v-d1f59823] {\n table-layout: auto; }\n .table[data-v-d1f59823] tbody[data-v-d1f59823] td[data-v-d1f59823] {\n overflow: scroll;\n -ms-overflow-style: none;\n /* IE and Edge */\n scrollbar-width: none;\n /* Firefox */ }\n .table[data-v-d1f59823] tbody[data-v-d1f59823] td[data-v-d1f59823]::-webkit-scrollbar {\n display: none; } }\n";
11882
11882
  n(css, {});
11883
11883
 
11884
11884
  function normalizeComponent (
@@ -12011,7 +12011,9 @@ const _sfc_main = {
12011
12011
  MODE_CUSTOM: 3
12012
12012
  },
12013
12013
  infiniteScrollKey: 1,
12014
- optionsLoaded: false
12014
+ optionsLoaded: false,
12015
+ isMobile: false,
12016
+ refreshing: false
12015
12017
  };
12016
12018
  },
12017
12019
  watch: {
@@ -12282,6 +12284,10 @@ const _sfc_main = {
12282
12284
  }
12283
12285
  },
12284
12286
  mounted() {
12287
+ this.isMobile = window.matchMedia("(max-width: 1024px)").matches;
12288
+
12289
+ // Agregar un oyente de eventos para actualizar isMobile cuando cambia el tamaño de la pantalla
12290
+ window.addEventListener("resize", this.handleResize);
12285
12291
  if (this.useVuexORM) {
12286
12292
  this.item = new this.model();
12287
12293
  const fields = this.model.fields();
@@ -12345,7 +12351,7 @@ const _sfc_main = {
12345
12351
  },
12346
12352
  itemsList() {
12347
12353
  const items = this.ajax ? this.items : this.items.slice(this.paginationIndexStart, this.paginationIndexEnd);
12348
- if (this.masonrySort) {
12354
+ if (this.masonrySort && !this.isMobile) {
12349
12355
  return this.rearrangeArray(items, this.masonryColumns);
12350
12356
  }
12351
12357
  return items;
@@ -12377,6 +12383,10 @@ const _sfc_main = {
12377
12383
  }
12378
12384
  },
12379
12385
  methods: {
12386
+ handleResize() {
12387
+ // Actualizar isMobile cuando cambia el tamaño de la pantalla
12388
+ this.isMobile = window.matchMedia("(max-width: 1024px)").matches;
12389
+ },
12380
12390
  infiniteHandler($state) {
12381
12391
  const hasNextPage = this.pagination.total > 0 && (!this.firstLoad || this.pagination.current_page * this.pagination.per_page <= this.pagination.total);
12382
12392
  console.debug("Has next page", hasNextPage, this.pagination);
@@ -12458,12 +12468,15 @@ const _sfc_main = {
12458
12468
  }
12459
12469
  },
12460
12470
  resetFilters() {
12471
+ let refresh = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
12461
12472
  this.internalFilters = [];
12462
12473
  this.setupFilters();
12463
12474
  this.forceRecomputeCounter++;
12464
- setTimeout(() => {
12465
- this.refresh();
12466
- }, 1);
12475
+ if (refresh) {
12476
+ setTimeout(() => {
12477
+ this.refresh();
12478
+ }, 1);
12479
+ }
12467
12480
  },
12468
12481
  toggleDisplayMode() {
12469
12482
  if (this.displayMode == this.displayModes.MODE_TABLE) this.displayMode = this.displayModes.MODE_CARDS;else if (this.displayMode == this.displayModes.MODE_CARDS) this.displayMode = this.displayModes.MODE_TABLE;
@@ -12576,6 +12589,7 @@ const _sfc_main = {
12576
12589
  }
12577
12590
  const fetchPromise = this.fetchItems(this.pagination.current_page);
12578
12591
  if (this.infiniteScroll && fetchPromise) {
12592
+ this.refreshing = true;
12579
12593
  fetchPromise.then(() => {
12580
12594
  const infiniteLoadingRef = this.$refs.infiniteLoading;
12581
12595
  if (infiniteLoadingRef) {
@@ -12583,6 +12597,7 @@ const _sfc_main = {
12583
12597
  } else {
12584
12598
  console.debug("infiniteLoadingRef not set");
12585
12599
  }
12600
+ this.refreshing = false;
12586
12601
  });
12587
12602
  }
12588
12603
  },
@@ -13066,6 +13081,10 @@ const _sfc_main = {
13066
13081
  };
13067
13082
  this.pagination = pagination;
13068
13083
  }
13084
+ },
13085
+ beforeDestroy() {
13086
+ // Eliminar el oyente de eventos al destruir el componente para evitar pérdidas de memoria
13087
+ window.removeEventListener("resize", this.handleResize);
13069
13088
  }
13070
13089
  };
13071
13090
  var _sfc_render = function render() {
@@ -13991,7 +14010,7 @@ var _sfc_render = function render() {
13991
14010
  }) : _vm._e()], 2)], 1);
13992
14011
  };
13993
14012
  var _sfc_staticRenderFns = [];
13994
- var __component__ = /*#__PURE__*/normalizeComponent(_sfc_main, _sfc_render, _sfc_staticRenderFns, false, null, "9f4fbca3", null, null);
14013
+ var __component__ = /*#__PURE__*/normalizeComponent(_sfc_main, _sfc_render, _sfc_staticRenderFns, false, null, "d1f59823", null, null);
13995
14014
  var component = __component__.exports;
13996
14015
 
13997
14016
  // Import vue component