vue-laravel-crud 1.6.21 → 1.6.23
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/dist/vue-laravel-crud.esm.js +157 -8
- package/dist/vue-laravel-crud.min.js +3 -3
- package/dist/vue-laravel-crud.ssr.js +265 -111
- package/package.json +1 -1
- package/src/vue-laravel-crud.vue +315 -184
|
@@ -12115,7 +12115,7 @@ if (typeof window !== 'undefined' && window.Vue) {
|
|
|
12115
12115
|
|
|
12116
12116
|
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}}
|
|
12117
12117
|
|
|
12118
|
-
var css = "tr td[data-v-
|
|
12118
|
+
var css = "tr td[data-v-7a09dc1e]:last-child,\ntr td[data-v-7a09dc1e]:first-child {\n width: 1%;\n white-space: nowrap; }\n\n.crud-pagination[data-v-7a09dc1e] {\n display: flex;\n align-items: center;\n width: 100%;\n justify-content: center;\n margin-top: 1rem; }\n\n.crud-header[data-v-7a09dc1e] {\n display: flex;\n justify-content: space-between;\n max-height: 3rem; }\n .crud-header[data-v-7a09dc1e] .crud-title[data-v-7a09dc1e] {\n margin: 0; }\n .crud-header[data-v-7a09dc1e] .crud-search[data-v-7a09dc1e] {\n max-width: 15rem; }\n .crud-header[data-v-7a09dc1e] .crud-search[data-v-7a09dc1e] .btn[data-v-7a09dc1e] {\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-7a09dc1e] .crud-search[data-v-7a09dc1e] .btn[data-v-7a09dc1e].open[data-v-7a09dc1e] {\n border-top-right-radius: 0;\n border-bottom-right-radius: 0; }\n .crud-header[data-v-7a09dc1e] .table-options[data-v-7a09dc1e] {\n margin-bottom: 1rem;\n display: flex;\n align-items: center;\n justify-content: flex-end; }\n\n.custom-control[data-v-7a09dc1e] {\n position: relative; }\n\n@media (min-width: 992px) {\n .table[data-v-7a09dc1e] {\n table-layout: auto; }\n .table[data-v-7a09dc1e] tbody[data-v-7a09dc1e] td[data-v-7a09dc1e] {\n overflow: scroll;\n -ms-overflow-style: none;\n /* IE and Edge */\n scrollbar-width: none;\n /* Firefox */ }\n .table[data-v-7a09dc1e] tbody[data-v-7a09dc1e] td[data-v-7a09dc1e]::-webkit-scrollbar {\n display: none; } }\n";
|
|
12119
12119
|
n(css, {});
|
|
12120
12120
|
|
|
12121
12121
|
function normalizeComponent (
|
|
@@ -12462,6 +12462,14 @@ const _sfc_main = {
|
|
|
12462
12462
|
type: String,
|
|
12463
12463
|
default: "Nuevo"
|
|
12464
12464
|
},
|
|
12465
|
+
messageImport: {
|
|
12466
|
+
type: String,
|
|
12467
|
+
default: "Importar"
|
|
12468
|
+
},
|
|
12469
|
+
messageExport: {
|
|
12470
|
+
type: String,
|
|
12471
|
+
default: "Exportar"
|
|
12472
|
+
},
|
|
12465
12473
|
messageEmptyResults: {
|
|
12466
12474
|
type: String,
|
|
12467
12475
|
default: "No se han encontrado resultados"
|
|
@@ -12541,6 +12549,14 @@ const _sfc_main = {
|
|
|
12541
12549
|
bulkDelete: {
|
|
12542
12550
|
type: Boolean,
|
|
12543
12551
|
default: false
|
|
12552
|
+
},
|
|
12553
|
+
showImport: {
|
|
12554
|
+
type: Boolean,
|
|
12555
|
+
default: false
|
|
12556
|
+
},
|
|
12557
|
+
showExport: {
|
|
12558
|
+
type: Boolean,
|
|
12559
|
+
default: false
|
|
12544
12560
|
}
|
|
12545
12561
|
},
|
|
12546
12562
|
mounted() {
|
|
@@ -13160,6 +13176,58 @@ const _sfc_main = {
|
|
|
13160
13176
|
});
|
|
13161
13177
|
}
|
|
13162
13178
|
},
|
|
13179
|
+
exportItems() {
|
|
13180
|
+
if (this.useVuexORM) {
|
|
13181
|
+
return;
|
|
13182
|
+
}
|
|
13183
|
+
if (!this.ajax) {
|
|
13184
|
+
return;
|
|
13185
|
+
}
|
|
13186
|
+
let exportItems = true;
|
|
13187
|
+
let params;
|
|
13188
|
+
let ids = this.selectedItems.map(it => it.id);
|
|
13189
|
+
if (ids.length) {
|
|
13190
|
+
params = {
|
|
13191
|
+
ids: ids,
|
|
13192
|
+
exportItems: exportItems
|
|
13193
|
+
};
|
|
13194
|
+
} else {
|
|
13195
|
+
params = {
|
|
13196
|
+
filters: JSON.stringify(this.finalFilters),
|
|
13197
|
+
exportItems: exportItems
|
|
13198
|
+
};
|
|
13199
|
+
}
|
|
13200
|
+
this.loading = true;
|
|
13201
|
+
axios.delete(this.apiUrl + "/" + this.modelName + "/export", {
|
|
13202
|
+
params: params
|
|
13203
|
+
}).then(response => {
|
|
13204
|
+
this.downloadBlobResponse(response, extension);
|
|
13205
|
+
this.loading = false;
|
|
13206
|
+
}).catch(error => {
|
|
13207
|
+
this.toastError(error);
|
|
13208
|
+
this.loading = false;
|
|
13209
|
+
});
|
|
13210
|
+
},
|
|
13211
|
+
importItems() {
|
|
13212
|
+
let formData = new FormData();
|
|
13213
|
+
formData.append("file", this.fileImport);
|
|
13214
|
+
axios.post(this.apiUrl + "/" + this.modelName + "/impport", formData, {
|
|
13215
|
+
headers: {
|
|
13216
|
+
"Content-Type": "multipart/form-data"
|
|
13217
|
+
}
|
|
13218
|
+
}).then(response => {
|
|
13219
|
+
if (response && response.data && response.data.success == true) {
|
|
13220
|
+
this.$refs["modal-import"].hide();
|
|
13221
|
+
this.toastSuccess("Datos Importados con Éxito");
|
|
13222
|
+
this.$refs["crud"].refresh();
|
|
13223
|
+
} else {
|
|
13224
|
+
this.toastError("No se pudo importar los datos.");
|
|
13225
|
+
}
|
|
13226
|
+
}).catch(error => {
|
|
13227
|
+
console.error(error);
|
|
13228
|
+
this.toastError(error);
|
|
13229
|
+
});
|
|
13230
|
+
},
|
|
13163
13231
|
getArrayValue(value, displayProp, options = []) {
|
|
13164
13232
|
if (!Array.isArray(value)) return "N/A";
|
|
13165
13233
|
let values = [];
|
|
@@ -13419,6 +13487,25 @@ const _sfc_main = {
|
|
|
13419
13487
|
appendToast: true
|
|
13420
13488
|
});
|
|
13421
13489
|
},
|
|
13490
|
+
downloadBlobResponse(response, extension = null) {
|
|
13491
|
+
const url = window.URL.createObjectURL(new Blob([response.data]));
|
|
13492
|
+
const link = document.createElement("a");
|
|
13493
|
+
link.href = url;
|
|
13494
|
+
let contentdisposition = response.headers['content-disposition'];
|
|
13495
|
+
let filename = "Export";
|
|
13496
|
+
if (contentdisposition) {
|
|
13497
|
+
filename = contentdisposition.split('filename=')[1].split('.')[0];
|
|
13498
|
+
filename = filename.replace('_', '');
|
|
13499
|
+
filename = filename.replace('"', '');
|
|
13500
|
+
extension = contentdisposition.split('.')[1].split(';')[0];
|
|
13501
|
+
extension = extension.replace('_', '');
|
|
13502
|
+
extension = extension.replace('"', '');
|
|
13503
|
+
}
|
|
13504
|
+
console.debug("DOWNLOAD ", filename, extension);
|
|
13505
|
+
link.setAttribute("download", filename + '.' + extension);
|
|
13506
|
+
document.body.appendChild(link);
|
|
13507
|
+
link.click();
|
|
13508
|
+
},
|
|
13422
13509
|
onChangeFilter(event) {
|
|
13423
13510
|
this.forceRecomputeCounter++;
|
|
13424
13511
|
console.debug("Filters debug ", this.finalFilters, this.internalFilter, this.internalFilters, this.filter, this.filters);
|
|
@@ -13528,7 +13615,7 @@ var _sfc_render = function render() {
|
|
|
13528
13615
|
callback: function ($$v) {
|
|
13529
13616
|
_vm.$set(_vm.internalFilterByProp(column.prop + '_from'), "value", $$v);
|
|
13530
13617
|
},
|
|
13531
|
-
expression: "internalFilterByProp(column.prop + '_from').value\n
|
|
13618
|
+
expression: "internalFilterByProp(column.prop + '_from').value\n "
|
|
13532
13619
|
}
|
|
13533
13620
|
})], 1), _c('div', {
|
|
13534
13621
|
staticClass: "col-6"
|
|
@@ -13544,7 +13631,7 @@ var _sfc_render = function render() {
|
|
|
13544
13631
|
callback: function ($$v) {
|
|
13545
13632
|
_vm.$set(_vm.internalFilterByProp(column.prop + '_to'), "value", $$v);
|
|
13546
13633
|
},
|
|
13547
|
-
expression: "internalFilterByProp(column.prop + '_to').value\n
|
|
13634
|
+
expression: "internalFilterByProp(column.prop + '_to').value\n "
|
|
13548
13635
|
}
|
|
13549
13636
|
})], 1)])]) : column.type == 'state' ? _c('div', {
|
|
13550
13637
|
staticClass: "form-group"
|
|
@@ -13673,7 +13760,27 @@ var _sfc_render = function render() {
|
|
|
13673
13760
|
}, [_vm._t("tableActions", function () {
|
|
13674
13761
|
return [_vm._t("tableActionsPrepend", null, {
|
|
13675
13762
|
"loading": _vm.loading
|
|
13676
|
-
}), _vm.
|
|
13763
|
+
}), _vm.showImport ? _c('b-button', {
|
|
13764
|
+
directives: [{
|
|
13765
|
+
name: "b-modal",
|
|
13766
|
+
rawName: "v-b-modal.modal-import",
|
|
13767
|
+
modifiers: {
|
|
13768
|
+
"modal-import": true
|
|
13769
|
+
}
|
|
13770
|
+
}],
|
|
13771
|
+
attrs: {
|
|
13772
|
+
"variant": "info"
|
|
13773
|
+
}
|
|
13774
|
+
}, [_c('b-icon-cloud-upload'), _vm._v(_vm._s(_vm.messageImport) + " ")], 1) : _vm._e(), _vm.showExport ? _c('b-button', {
|
|
13775
|
+
attrs: {
|
|
13776
|
+
"variant": "info"
|
|
13777
|
+
},
|
|
13778
|
+
on: {
|
|
13779
|
+
"click": function ($event) {
|
|
13780
|
+
return _vm.exportItems();
|
|
13781
|
+
}
|
|
13782
|
+
}
|
|
13783
|
+
}, [_c('b-icon-cloud-download'), _vm._v(_vm._s(_vm.messageExport) + " ")], 1) : _vm._e(), _vm.showPrincipalSortBtn ? _c('b-button', {
|
|
13677
13784
|
attrs: {
|
|
13678
13785
|
"variant": "info",
|
|
13679
13786
|
"disabled": _vm.loading
|
|
@@ -13835,7 +13942,7 @@ var _sfc_render = function render() {
|
|
|
13835
13942
|
callback: function ($$v) {
|
|
13836
13943
|
_vm.$set(_vm.internalFilterByProp(column.prop + '_from'), "value", $$v);
|
|
13837
13944
|
},
|
|
13838
|
-
expression: "internalFilterByProp(column.prop + '_from').value\n
|
|
13945
|
+
expression: "internalFilterByProp(column.prop + '_from').value\n "
|
|
13839
13946
|
}
|
|
13840
13947
|
})], 1), _c('div', {
|
|
13841
13948
|
staticClass: "col-6"
|
|
@@ -13852,7 +13959,7 @@ var _sfc_render = function render() {
|
|
|
13852
13959
|
callback: function ($$v) {
|
|
13853
13960
|
_vm.$set(_vm.internalFilterByProp(column.prop + '_to'), "value", $$v);
|
|
13854
13961
|
},
|
|
13855
|
-
expression: "internalFilterByProp(column.prop + '_to').value\n
|
|
13962
|
+
expression: "internalFilterByProp(column.prop + '_to').value\n "
|
|
13856
13963
|
}
|
|
13857
13964
|
})], 1)]) : column.type == 'state' && _vm.optionsLoaded ? _c('select', {
|
|
13858
13965
|
directives: [{
|
|
@@ -14420,10 +14527,52 @@ var _sfc_render = function render() {
|
|
|
14420
14527
|
}), 1)];
|
|
14421
14528
|
}, {
|
|
14422
14529
|
"item": _vm.item
|
|
14423
|
-
}) : _vm._e()], 2)
|
|
14530
|
+
}) : _vm._e()], 2), _vm.showImport ? _c('b-modal', {
|
|
14531
|
+
ref: "modal-import",
|
|
14532
|
+
attrs: {
|
|
14533
|
+
"id": "modal-import",
|
|
14534
|
+
"title": "Importar",
|
|
14535
|
+
"hide-footer": ""
|
|
14536
|
+
}
|
|
14537
|
+
}, [_vm.item ? _vm._t("import", function () {
|
|
14538
|
+
return [_c('b-overlay', {
|
|
14539
|
+
attrs: {
|
|
14540
|
+
"show": _vm.loading,
|
|
14541
|
+
"rounded": "sm"
|
|
14542
|
+
}
|
|
14543
|
+
}, [_c('b-form-file', {
|
|
14544
|
+
attrs: {
|
|
14545
|
+
"state": Boolean(_vm.fileImport),
|
|
14546
|
+
"browse-text": "Explorar",
|
|
14547
|
+
"placeholder": "Importar...",
|
|
14548
|
+
"drop-placeholder": "Arrastrar Archivo aquí..."
|
|
14549
|
+
},
|
|
14550
|
+
model: {
|
|
14551
|
+
value: _vm.fileImport,
|
|
14552
|
+
callback: function ($$v) {
|
|
14553
|
+
_vm.fileImport = $$v;
|
|
14554
|
+
},
|
|
14555
|
+
expression: "fileImport"
|
|
14556
|
+
}
|
|
14557
|
+
}), _c('div', {
|
|
14558
|
+
staticClass: "text-center mt-3"
|
|
14559
|
+
}, [_c('b-button', {
|
|
14560
|
+
attrs: {
|
|
14561
|
+
"variant": "info",
|
|
14562
|
+
"disabled": _vm.loading
|
|
14563
|
+
},
|
|
14564
|
+
on: {
|
|
14565
|
+
"click": function ($event) {
|
|
14566
|
+
return _vm.importItems();
|
|
14567
|
+
}
|
|
14568
|
+
}
|
|
14569
|
+
}, [_c('b-icon-cloud-upload'), _vm._v(" " + _vm._s(_vm.loading ? "Cargando..." : "Importar") + " ")], 1)], 1)], 1)];
|
|
14570
|
+
}, {
|
|
14571
|
+
"item": _vm.item
|
|
14572
|
+
}) : _vm._e()], 2) : _vm._e()], 1);
|
|
14424
14573
|
};
|
|
14425
14574
|
var _sfc_staticRenderFns = [];
|
|
14426
|
-
var __component__ = /*#__PURE__*/normalizeComponent(_sfc_main, _sfc_render, _sfc_staticRenderFns, false, null, "
|
|
14575
|
+
var __component__ = /*#__PURE__*/normalizeComponent(_sfc_main, _sfc_render, _sfc_staticRenderFns, false, null, "7a09dc1e", null, null);
|
|
14427
14576
|
var component = __component__.exports;
|
|
14428
14577
|
|
|
14429
14578
|
// Import vue component
|