vue-laravel-crud 1.4.19 → 1.4.21

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.
@@ -17017,7 +17017,7 @@ var moment = momentExports;
17017
17017
 
17018
17018
  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}}
17019
17019
 
17020
- var css = "tr td[data-v-e945a530]:last-child,\ntr td[data-v-e945a530]:first-child {\n width: 1%;\n white-space: nowrap; }\n\n.crud-pagination[data-v-e945a530] {\n display: flex;\n justify-content: center; }\n\n.crud-header[data-v-e945a530] {\n display: flex;\n justify-content: space-between;\n max-height: 3rem; }\n .crud-header[data-v-e945a530] .crud-title[data-v-e945a530] {\n margin: 0; }\n .crud-header[data-v-e945a530] .crud-search[data-v-e945a530] {\n max-width: 15rem; }\n .crud-header[data-v-e945a530] .crud-search[data-v-e945a530] .btn[data-v-e945a530] {\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-e945a530] .crud-search[data-v-e945a530] .btn[data-v-e945a530].open[data-v-e945a530] {\n border-top-right-radius: 0;\n border-bottom-right-radius: 0; }\n .crud-header[data-v-e945a530] .table-options[data-v-e945a530] {\n margin-bottom: 1rem;\n display: flex;\n align-items: center;\n justify-content: flex-end; }\n\n.custom-control[data-v-e945a530] {\n position: relative;\n top: -15px; }\n\n@media (min-width: 992px) {\n .table[data-v-e945a530] {\n table-layout: auto; }\n .table[data-v-e945a530] tbody[data-v-e945a530] td[data-v-e945a530] {\n overflow: scroll;\n -ms-overflow-style: none;\n /* IE and Edge */\n scrollbar-width: none;\n /* Firefox */ }\n .table[data-v-e945a530] tbody[data-v-e945a530] td[data-v-e945a530]::-webkit-scrollbar {\n display: none; } }\n";
17020
+ var css = "tr td[data-v-c72d8320]:last-child,\ntr td[data-v-c72d8320]:first-child {\n width: 1%;\n white-space: nowrap; }\n\n.crud-pagination[data-v-c72d8320] {\n display: flex;\n justify-content: center; }\n\n.crud-header[data-v-c72d8320] {\n display: flex;\n justify-content: space-between;\n max-height: 3rem; }\n .crud-header[data-v-c72d8320] .crud-title[data-v-c72d8320] {\n margin: 0; }\n .crud-header[data-v-c72d8320] .crud-search[data-v-c72d8320] {\n max-width: 15rem; }\n .crud-header[data-v-c72d8320] .crud-search[data-v-c72d8320] .btn[data-v-c72d8320] {\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-c72d8320] .crud-search[data-v-c72d8320] .btn[data-v-c72d8320].open[data-v-c72d8320] {\n border-top-right-radius: 0;\n border-bottom-right-radius: 0; }\n .crud-header[data-v-c72d8320] .table-options[data-v-c72d8320] {\n margin-bottom: 1rem;\n display: flex;\n align-items: center;\n justify-content: flex-end; }\n\n.custom-control[data-v-c72d8320] {\n position: relative;\n top: -15px; }\n\n@media (min-width: 992px) {\n .table[data-v-c72d8320] {\n table-layout: auto; }\n .table[data-v-c72d8320] tbody[data-v-c72d8320] td[data-v-c72d8320] {\n overflow: scroll;\n -ms-overflow-style: none;\n /* IE and Edge */\n scrollbar-width: none;\n /* Firefox */ }\n .table[data-v-c72d8320] tbody[data-v-c72d8320] td[data-v-c72d8320]::-webkit-scrollbar {\n display: none; } }\n";
17021
17021
  n(css, {});
17022
17022
 
17023
17023
  function normalizeComponent (
@@ -17373,12 +17373,12 @@ const _sfc_main = {
17373
17373
  },
17374
17374
  mounted() {
17375
17375
  if (this.useVuexORM) {
17376
- //this.useVuexORM = true;
17377
17376
  this.item = new this.model();
17378
17377
  } else {
17379
17378
  this.item = this.model;
17380
17379
  this.itemDefault = JSON.parse(JSON.stringify(this.item));
17381
17380
  }
17381
+ console.debug("crud mounted columns", this.columns);
17382
17382
  this.internalFilters = [];
17383
17383
  this.setupFilters();
17384
17384
  if (this.ajax) {
@@ -17892,30 +17892,40 @@ const _sfc_main = {
17892
17892
  if (event) event.preventDefault();
17893
17893
  },
17894
17894
  toastError(error) {
17895
- console.warn(error);
17896
- let errormsg = "";
17897
- if (error.response) {
17898
- if (error.response.data && error.response.data.message) {
17899
- errormsg = error.response.data.message;
17900
- } else if (error.response.data && error.response.data.error) {
17901
- errormsg = error.response.data.error;
17902
- } else if (error.response.data && error.response.data.errors) {
17903
- errormsg = error.response.data.errors;
17904
- } else if (error.response.data) {
17905
- errormsg = error.response.data;
17895
+ let error_message = "Ha ocurrido un error";
17896
+ if (typeof error === "string") {
17897
+ error_message = error;
17898
+ } else if (error.response) {
17899
+ // handle API errors
17900
+ if (error.response.status === 401) {
17901
+ error_message = "No estás autorizado para realizar esta acción";
17902
+ } else if (error.response.status === 404) {
17903
+ error_message = "El recurso solicitado no se encontró";
17904
+ } else if (error.response.status >= 400 && error.response.status < 500) {
17905
+ error_message = "Hubo un problema con la solicitud realizada";
17906
+ } else if (error.response.status >= 500) {
17907
+ error_message = "El servidor no pudo procesar la solicitud";
17906
17908
  }
17907
- } else if (error.message) {
17908
- errormsg = error.message;
17909
- } else if (error) {
17910
- if (typeof error === "string" || myVar instanceof String) {
17911
- errormsg = error;
17912
- } else {
17913
- errormsg = "Error: Hubo un problema procesando la solicitud.";
17909
+ if (error.response.data) {
17910
+ if (typeof error.response.data === "object") {
17911
+ if (error.response.data.message) {
17912
+ error_message = error.response.data.message;
17913
+ } else if (error.response.data.errors) {
17914
+ let errors = error.response.data.errors;
17915
+ error_message = Object.values(errors)[0][0];
17916
+ }
17917
+ } else if (typeof error.response.data === "string") {
17918
+ error_message = error.response.data;
17919
+ }
17914
17920
  }
17915
- } else {
17916
- errormsg = "Error: Hubo un problema procesando la solicitud.";
17921
+ } else if (error.request) {
17922
+ // handle network errors
17923
+ error_message = "No se pudo conectar con el servidor. Verifique su conexión a Internet.";
17924
+ } else if (error.message) {
17925
+ // handle other errors
17926
+ error_message = error.message;
17917
17927
  }
17918
- this.$bvToast.toast(errormsg, {
17928
+ this.$bvToast.toast(error_message, {
17919
17929
  title: `Error`,
17920
17930
  toaster: "b-toaster-bottom-right",
17921
17931
  variant: "danger",
@@ -18492,11 +18502,11 @@ var _sfc_render = function render() {
18492
18502
  return _vm.onRowClick(item, index);
18493
18503
  }
18494
18504
  }
18495
- }, [item.group ? [_c('th', {
18505
+ }, [item.group ? _c('th', {
18496
18506
  attrs: {
18497
18507
  "colspan": _vm.columns.length
18498
18508
  }
18499
- }, [_c('span', [_vm._v(_vm._s(item.label))])])] : [_vm._t("row", function () {
18509
+ }, [_c('span', [_vm._v(_vm._s(item.label))])]) : _vm._t("row", function () {
18500
18510
  return _vm._l(_vm.columns, function (column, indexc) {
18501
18511
  return _c('td', {
18502
18512
  key: indexc,
@@ -18570,7 +18580,7 @@ var _sfc_render = function render() {
18570
18580
  });
18571
18581
  }, {
18572
18582
  "item": item
18573
- })]], 2);
18583
+ })], 2);
18574
18584
  }), 0)], 1), _vm.items.length == 0 ? _c('p', {
18575
18585
  staticClass: "p-3"
18576
18586
  }, [_vm._v(" " + _vm._s(_vm.messageEmptyResults) + " ")]) : _vm._e()]) : _vm._e(), _vm.displayMode == _vm.displayModes.MODE_CARDS ? _c('div', [_vm.items.length == 0 ? _c('p', {
@@ -18831,7 +18841,7 @@ var _sfc_render = function render() {
18831
18841
  }) : _vm._e()], 2)], 1);
18832
18842
  };
18833
18843
  var _sfc_staticRenderFns = [];
18834
- var __component__ = /*#__PURE__*/normalizeComponent(_sfc_main, _sfc_render, _sfc_staticRenderFns, false, null, "e945a530", null, null);
18844
+ var __component__ = /*#__PURE__*/normalizeComponent(_sfc_main, _sfc_render, _sfc_staticRenderFns, false, null, "c72d8320", null, null);
18835
18845
  var component = __component__.exports;
18836
18846
 
18837
18847
  // Import vue component