vue-laravel-crud 1.5.6 → 1.5.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.
@@ -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-72049f4e]:last-child,\ntr td[data-v-72049f4e]:first-child {\n width: 1%;\n white-space: nowrap; }\n\n.crud-pagination[data-v-72049f4e] {\n display: flex;\n justify-content: center; }\n\n.crud-header[data-v-72049f4e] {\n display: flex;\n justify-content: space-between;\n max-height: 3rem; }\n .crud-header[data-v-72049f4e] .crud-title[data-v-72049f4e] {\n margin: 0; }\n .crud-header[data-v-72049f4e] .crud-search[data-v-72049f4e] {\n max-width: 15rem; }\n .crud-header[data-v-72049f4e] .crud-search[data-v-72049f4e] .btn[data-v-72049f4e] {\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-72049f4e] .crud-search[data-v-72049f4e] .btn[data-v-72049f4e].open[data-v-72049f4e] {\n border-top-right-radius: 0;\n border-bottom-right-radius: 0; }\n .crud-header[data-v-72049f4e] .table-options[data-v-72049f4e] {\n margin-bottom: 1rem;\n display: flex;\n align-items: center;\n justify-content: flex-end; }\n\n.custom-control[data-v-72049f4e] {\n position: relative;\n top: -15px; }\n\n@media (min-width: 992px) {\n .table[data-v-72049f4e] {\n table-layout: auto; }\n .table[data-v-72049f4e] tbody[data-v-72049f4e] td[data-v-72049f4e] {\n overflow: scroll;\n -ms-overflow-style: none;\n /* IE and Edge */\n scrollbar-width: none;\n /* Firefox */ }\n .table[data-v-72049f4e] tbody[data-v-72049f4e] td[data-v-72049f4e]::-webkit-scrollbar {\n display: none; } }\n";
11881
+ var css = "tr td[data-v-a63589d7]:last-child,\ntr td[data-v-a63589d7]:first-child {\n width: 1%;\n white-space: nowrap; }\n\n.crud-pagination[data-v-a63589d7] {\n display: flex;\n justify-content: center; }\n\n.crud-header[data-v-a63589d7] {\n display: flex;\n justify-content: space-between;\n max-height: 3rem; }\n .crud-header[data-v-a63589d7] .crud-title[data-v-a63589d7] {\n margin: 0; }\n .crud-header[data-v-a63589d7] .crud-search[data-v-a63589d7] {\n max-width: 15rem; }\n .crud-header[data-v-a63589d7] .crud-search[data-v-a63589d7] .btn[data-v-a63589d7] {\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-a63589d7] .crud-search[data-v-a63589d7] .btn[data-v-a63589d7].open[data-v-a63589d7] {\n border-top-right-radius: 0;\n border-bottom-right-radius: 0; }\n .crud-header[data-v-a63589d7] .table-options[data-v-a63589d7] {\n margin-bottom: 1rem;\n display: flex;\n align-items: center;\n justify-content: flex-end; }\n\n.custom-control[data-v-a63589d7] {\n position: relative;\n top: -15px; }\n\n@media (min-width: 992px) {\n .table[data-v-a63589d7] {\n table-layout: auto; }\n .table[data-v-a63589d7] tbody[data-v-a63589d7] td[data-v-a63589d7] {\n overflow: scroll;\n -ms-overflow-style: none;\n /* IE and Edge */\n scrollbar-width: none;\n /* Firefox */ }\n .table[data-v-a63589d7] tbody[data-v-a63589d7] td[data-v-a63589d7]::-webkit-scrollbar {\n display: none; } }\n";
11882
11882
  n(css, {});
11883
11883
 
11884
11884
  function normalizeComponent (
@@ -12011,7 +12011,8 @@ const _sfc_main = {
12011
12011
  MODE_CUSTOM: 3
12012
12012
  },
12013
12013
  infiniteScrollKey: 1,
12014
- optionsLoaded: false
12014
+ optionsLoaded: false,
12015
+ isMobile: false
12015
12016
  };
12016
12017
  },
12017
12018
  watch: {
@@ -12271,9 +12272,21 @@ const _sfc_main = {
12271
12272
  clone: false
12272
12273
  };
12273
12274
  }
12275
+ },
12276
+ masonrySort: {
12277
+ type: Boolean,
12278
+ default: false
12279
+ },
12280
+ masonryColumns: {
12281
+ type: Number,
12282
+ default: 3
12274
12283
  }
12275
12284
  },
12276
12285
  mounted() {
12286
+ this.isMobile = window.matchMedia("(max-width: 1024px)").matches;
12287
+
12288
+ // Agregar un oyente de eventos para actualizar isMobile cuando cambia el tamaño de la pantalla
12289
+ window.addEventListener("resize", this.handleResize);
12277
12290
  if (this.useVuexORM) {
12278
12291
  this.item = new this.model();
12279
12292
  const fields = this.model.fields();
@@ -12336,7 +12349,11 @@ const _sfc_main = {
12336
12349
  };
12337
12350
  },
12338
12351
  itemsList() {
12339
- return this.ajax ? this.items : this.items.slice(this.paginationIndexStart, this.paginationIndexEnd);
12352
+ const items = this.ajax ? this.items : this.items.slice(this.paginationIndexStart, this.paginationIndexEnd);
12353
+ if (this.masonrySort && !this.isMobile) {
12354
+ return this.rearrangeArray(items, this.masonryColumns);
12355
+ }
12356
+ return items;
12340
12357
  },
12341
12358
  paginationIndexStart() {
12342
12359
  return (this.pagination.current_page - 1) * this.pagination.per_page;
@@ -12365,6 +12382,10 @@ const _sfc_main = {
12365
12382
  }
12366
12383
  },
12367
12384
  methods: {
12385
+ handleResize() {
12386
+ // Actualizar isMobile cuando cambia el tamaño de la pantalla
12387
+ this.isMobile = window.matchMedia("(max-width: 1024px)").matches;
12388
+ },
12368
12389
  infiniteHandler($state) {
12369
12390
  const hasNextPage = this.pagination.total > 0 && (!this.firstLoad || this.pagination.current_page * this.pagination.per_page <= this.pagination.total);
12370
12391
  console.debug("Has next page", hasNextPage, this.pagination);
@@ -12380,6 +12401,16 @@ const _sfc_main = {
12380
12401
  $state.complete();
12381
12402
  }
12382
12403
  },
12404
+ rearrangeArray(originalArray) {
12405
+ let columns = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 3;
12406
+ const rearrangedArray = [];
12407
+ for (let i = 0; i < columns; i++) {
12408
+ for (let j = i; j < originalArray.length; j += columns) {
12409
+ rearrangedArray.push(originalArray[j]);
12410
+ }
12411
+ }
12412
+ return rearrangedArray;
12413
+ },
12383
12414
  onDraggableAdded(event) {
12384
12415
  this.$emit("draggableAdded", event);
12385
12416
  },
@@ -13044,6 +13075,10 @@ const _sfc_main = {
13044
13075
  };
13045
13076
  this.pagination = pagination;
13046
13077
  }
13078
+ },
13079
+ beforeDestroy() {
13080
+ // Eliminar el oyente de eventos al destruir el componente para evitar pérdidas de memoria
13081
+ window.removeEventListener("resize", this.handleResize);
13047
13082
  }
13048
13083
  };
13049
13084
  var _sfc_render = function render() {
@@ -13969,7 +14004,7 @@ var _sfc_render = function render() {
13969
14004
  }) : _vm._e()], 2)], 1);
13970
14005
  };
13971
14006
  var _sfc_staticRenderFns = [];
13972
- var __component__ = /*#__PURE__*/normalizeComponent(_sfc_main, _sfc_render, _sfc_staticRenderFns, false, null, "72049f4e", null, null);
14007
+ var __component__ = /*#__PURE__*/normalizeComponent(_sfc_main, _sfc_render, _sfc_staticRenderFns, false, null, "a63589d7", null, null);
13973
14008
  var component = __component__.exports;
13974
14009
 
13975
14010
  // Import vue component