vue-laravel-crud 1.7.5 → 1.7.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.
- package/dist/vue-laravel-crud.esm.js +79 -15
- package/dist/vue-laravel-crud.min.js +1 -1
- package/dist/vue-laravel-crud.ssr.js +79 -15
- package/package.json +1 -1
- package/src/vue-laravel-crud.vue +42 -12
|
@@ -12532,7 +12532,7 @@ Plugin.install = function (Vue, options) {
|
|
|
12532
12532
|
|
|
12533
12533
|
if (typeof window !== 'undefined' && window.Vue) {
|
|
12534
12534
|
window.Vue.use(Plugin);
|
|
12535
|
-
}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}}var css = "tr td[data-v-
|
|
12535
|
+
}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}}var css = "tr td[data-v-6fd1b6ca]:last-child,\ntr td[data-v-6fd1b6ca]:first-child {\n width: 1%;\n white-space: nowrap; }\n\n.crud-pagination[data-v-6fd1b6ca] {\n display: flex;\n align-items: center;\n width: 100%;\n justify-content: center;\n margin-top: 1rem; }\n\n.crud-header[data-v-6fd1b6ca] {\n display: flex;\n justify-content: space-between;\n max-height: 3rem; }\n .crud-header[data-v-6fd1b6ca] .crud-title[data-v-6fd1b6ca] {\n margin: 0; }\n .crud-header[data-v-6fd1b6ca] .crud-search[data-v-6fd1b6ca] {\n max-width: 15rem; }\n .crud-header[data-v-6fd1b6ca] .crud-search[data-v-6fd1b6ca] .btn[data-v-6fd1b6ca] {\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-6fd1b6ca] .crud-search[data-v-6fd1b6ca] .btn[data-v-6fd1b6ca].open[data-v-6fd1b6ca] {\n border-top-right-radius: 0;\n border-bottom-right-radius: 0; }\n .crud-header[data-v-6fd1b6ca] .table-options[data-v-6fd1b6ca] {\n margin-bottom: 1rem;\n display: flex;\n align-items: center;\n justify-content: flex-end; }\n\n.custom-control[data-v-6fd1b6ca] {\n position: relative; }\n\n@media (min-width: 992px) {\n .table[data-v-6fd1b6ca] {\n table-layout: auto; }\n .table[data-v-6fd1b6ca] tbody[data-v-6fd1b6ca] td[data-v-6fd1b6ca] {\n overflow: scroll;\n -ms-overflow-style: none;\n /* IE and Edge */\n scrollbar-width: none;\n /* Firefox */ }\n .table[data-v-6fd1b6ca] tbody[data-v-6fd1b6ca] td[data-v-6fd1b6ca]::-webkit-scrollbar {\n display: none; } }\n";
|
|
12536
12536
|
n(css, {});function normalizeComponent (
|
|
12537
12537
|
scriptExports,
|
|
12538
12538
|
render,
|
|
@@ -12633,6 +12633,7 @@ n(css, {});function normalizeComponent (
|
|
|
12633
12633
|
},
|
|
12634
12634
|
data: function data() {
|
|
12635
12635
|
return {
|
|
12636
|
+
crudUuid: string,
|
|
12636
12637
|
moment: moment,
|
|
12637
12638
|
loading: false,
|
|
12638
12639
|
firstLoad: false,
|
|
@@ -12666,7 +12667,8 @@ n(css, {});function normalizeComponent (
|
|
|
12666
12667
|
isMobile: false,
|
|
12667
12668
|
refreshing: false,
|
|
12668
12669
|
fetchError: false,
|
|
12669
|
-
principalSort: false
|
|
12670
|
+
principalSort: false,
|
|
12671
|
+
exportFormat: 'JSON'
|
|
12670
12672
|
};
|
|
12671
12673
|
},
|
|
12672
12674
|
watch: {
|
|
@@ -12981,6 +12983,7 @@ n(css, {});function normalizeComponent (
|
|
|
12981
12983
|
}
|
|
12982
12984
|
},
|
|
12983
12985
|
mounted: function mounted() {
|
|
12986
|
+
this.crudUuid = ''.now;
|
|
12984
12987
|
this.isMobile = window.matchMedia("(max-width: 1024px)").matches;
|
|
12985
12988
|
|
|
12986
12989
|
// Agregar un oyente de eventos para actualizar isMobile cuando cambia el tamaño de la pantalla
|
|
@@ -13787,6 +13790,9 @@ n(css, {});function normalizeComponent (
|
|
|
13787
13790
|
});
|
|
13788
13791
|
}
|
|
13789
13792
|
},
|
|
13793
|
+
showExportModal: function showExportModal() {
|
|
13794
|
+
this.$refs["modal-export"].show();
|
|
13795
|
+
},
|
|
13790
13796
|
exportItems: function exportItems() {
|
|
13791
13797
|
var _this22 = this;
|
|
13792
13798
|
if (this.useVuexORM) {
|
|
@@ -13811,7 +13817,7 @@ n(css, {});function normalizeComponent (
|
|
|
13811
13817
|
exportItems: exportItems
|
|
13812
13818
|
};
|
|
13813
13819
|
}
|
|
13814
|
-
params.format =
|
|
13820
|
+
params.format = this.exportFormat;
|
|
13815
13821
|
this.loading = true;
|
|
13816
13822
|
axios.get(this.apiUrl + "/" + this.modelName + "/export", {
|
|
13817
13823
|
params: params,
|
|
@@ -13824,6 +13830,9 @@ n(css, {});function normalizeComponent (
|
|
|
13824
13830
|
_this22.loading = false;
|
|
13825
13831
|
});
|
|
13826
13832
|
},
|
|
13833
|
+
showImportModal: function showImportModal() {
|
|
13834
|
+
this.$refs["modal-import"].show();
|
|
13835
|
+
},
|
|
13827
13836
|
importItems: function importItems() {
|
|
13828
13837
|
var _this23 = this;
|
|
13829
13838
|
var formData = new FormData();
|
|
@@ -13902,7 +13911,9 @@ n(css, {});function normalizeComponent (
|
|
|
13902
13911
|
break;
|
|
13903
13912
|
}
|
|
13904
13913
|
_context6.next = 7;
|
|
13905
|
-
return _this25.model.$update(_this25.item.id,
|
|
13914
|
+
return _this25.model.$update(_this25.item.id, {
|
|
13915
|
+
data: _this25.item
|
|
13916
|
+
});
|
|
13906
13917
|
case 7:
|
|
13907
13918
|
result = _context6.sent;
|
|
13908
13919
|
create = false;
|
|
@@ -13910,7 +13921,9 @@ n(css, {});function normalizeComponent (
|
|
|
13910
13921
|
break;
|
|
13911
13922
|
case 11:
|
|
13912
13923
|
_context6.next = 13;
|
|
13913
|
-
return _this25.model.$create(
|
|
13924
|
+
return _this25.model.$create({
|
|
13925
|
+
data: _this25.item
|
|
13926
|
+
});
|
|
13914
13927
|
case 13:
|
|
13915
13928
|
result = _context6.sent;
|
|
13916
13929
|
create = true;
|
|
@@ -14508,15 +14521,13 @@ var _sfc_render = function render() {
|
|
|
14508
14521
|
return [_vm._t("tableActionsPrepend", null, {
|
|
14509
14522
|
"loading": _vm.loading
|
|
14510
14523
|
}), _vm.showImport ? _c('b-button', {
|
|
14511
|
-
directives: [{
|
|
14512
|
-
name: "b-modal",
|
|
14513
|
-
rawName: "v-b-modal.modal-import",
|
|
14514
|
-
modifiers: {
|
|
14515
|
-
"modal-import": true
|
|
14516
|
-
}
|
|
14517
|
-
}],
|
|
14518
14524
|
attrs: {
|
|
14519
14525
|
"variant": "info"
|
|
14526
|
+
},
|
|
14527
|
+
on: {
|
|
14528
|
+
"click": function click($event) {
|
|
14529
|
+
return _vm.showImportModal();
|
|
14530
|
+
}
|
|
14520
14531
|
}
|
|
14521
14532
|
}, [_c('b-icon-cloud-upload'), _vm._v(_vm._s(_vm.messageImport) + " ")], 1) : _vm._e(), _vm.showExport ? _c('b-button', {
|
|
14522
14533
|
attrs: {
|
|
@@ -14524,7 +14535,7 @@ var _sfc_render = function render() {
|
|
|
14524
14535
|
},
|
|
14525
14536
|
on: {
|
|
14526
14537
|
"click": function click($event) {
|
|
14527
|
-
return _vm.
|
|
14538
|
+
return _vm.showExportModal();
|
|
14528
14539
|
}
|
|
14529
14540
|
}
|
|
14530
14541
|
}, [_c('b-icon-cloud-download'), _vm._v(_vm._s(_vm.messageExport) + " ")], 1) : _vm._e(), _vm.showPrincipalSortBtn ? _c('b-button', {
|
|
@@ -15277,7 +15288,6 @@ var _sfc_render = function render() {
|
|
|
15277
15288
|
}) : _vm._e()], 2), _vm.showImport ? _c('b-modal', {
|
|
15278
15289
|
ref: "modal-import",
|
|
15279
15290
|
attrs: {
|
|
15280
|
-
"id": "modal-import",
|
|
15281
15291
|
"title": "Importar",
|
|
15282
15292
|
"hide-footer": ""
|
|
15283
15293
|
}
|
|
@@ -15316,10 +15326,64 @@ var _sfc_render = function render() {
|
|
|
15316
15326
|
}, [_c('b-icon-cloud-upload'), _vm._v(" " + _vm._s(_vm.loading ? "Cargando..." : "Importar") + " ")], 1)], 1)], 1)];
|
|
15317
15327
|
}, {
|
|
15318
15328
|
"item": _vm.item
|
|
15329
|
+
}) : _vm._e()], 2) : _vm._e(), _vm.showExport ? _c('b-modal', {
|
|
15330
|
+
ref: "modal-export",
|
|
15331
|
+
attrs: {
|
|
15332
|
+
"title": "Exportar",
|
|
15333
|
+
"hide-footer": ""
|
|
15334
|
+
}
|
|
15335
|
+
}, [_vm.item ? _vm._t("export", function () {
|
|
15336
|
+
return [_c('b-overlay', {
|
|
15337
|
+
attrs: {
|
|
15338
|
+
"show": _vm.loading,
|
|
15339
|
+
"rounded": "sm"
|
|
15340
|
+
}
|
|
15341
|
+
}, [_vm.selectedItems.length ? _c('p', [_vm._v("Se exportará " + _vm._s(_vm.selectedItems.length) + " elementos.")]) : _c('p', [_vm._v("Se exportará la consulta actual.")]), _c('select', {
|
|
15342
|
+
directives: [{
|
|
15343
|
+
name: "model",
|
|
15344
|
+
rawName: "v-model",
|
|
15345
|
+
value: _vm.exportFormat,
|
|
15346
|
+
expression: "exportFormat"
|
|
15347
|
+
}],
|
|
15348
|
+
staticClass: "form-control",
|
|
15349
|
+
on: {
|
|
15350
|
+
"change": function change($event) {
|
|
15351
|
+
var $$selectedVal = Array.prototype.filter.call($event.target.options, function (o) {
|
|
15352
|
+
return o.selected;
|
|
15353
|
+
}).map(function (o) {
|
|
15354
|
+
var val = "_value" in o ? o._value : o.value;
|
|
15355
|
+
return val;
|
|
15356
|
+
});
|
|
15357
|
+
_vm.exportFormat = $event.target.multiple ? $$selectedVal : $$selectedVal[0];
|
|
15358
|
+
}
|
|
15359
|
+
}
|
|
15360
|
+
}, [_c('option', {
|
|
15361
|
+
attrs: {
|
|
15362
|
+
"value": "JSON"
|
|
15363
|
+
}
|
|
15364
|
+
}, [_vm._v("JSON")]), _c('option', {
|
|
15365
|
+
attrs: {
|
|
15366
|
+
"value": "XLSX"
|
|
15367
|
+
}
|
|
15368
|
+
}, [_vm._v("XLSX")])]), _c('div', {
|
|
15369
|
+
staticClass: "text-center mt-3"
|
|
15370
|
+
}, [_c('b-button', {
|
|
15371
|
+
attrs: {
|
|
15372
|
+
"variant": "info",
|
|
15373
|
+
"disabled": _vm.loading
|
|
15374
|
+
},
|
|
15375
|
+
on: {
|
|
15376
|
+
"click": function click($event) {
|
|
15377
|
+
return _vm.exportItems();
|
|
15378
|
+
}
|
|
15379
|
+
}
|
|
15380
|
+
}, [_c('b-icon-cloud-upload'), _vm._v(" " + _vm._s(_vm.loading ? "Cargando..." : "Exportar") + " ")], 1)], 1)])];
|
|
15381
|
+
}, {
|
|
15382
|
+
"item": _vm.item
|
|
15319
15383
|
}) : _vm._e()], 2) : _vm._e()], 1);
|
|
15320
15384
|
};
|
|
15321
15385
|
var _sfc_staticRenderFns = [];
|
|
15322
|
-
var __component__ = /*#__PURE__*/normalizeComponent(_sfc_main, _sfc_render, _sfc_staticRenderFns, false, null, "
|
|
15386
|
+
var __component__ = /*#__PURE__*/normalizeComponent(_sfc_main, _sfc_render, _sfc_staticRenderFns, false, null, "6fd1b6ca", null, null);
|
|
15323
15387
|
var component$1 = __component__.exports;// Import vue component
|
|
15324
15388
|
|
|
15325
15389
|
// Default export is installable instance of component.
|
package/package.json
CHANGED
package/src/vue-laravel-crud.vue
CHANGED
|
@@ -15,6 +15,8 @@ export default /*#__PURE__*/ {
|
|
|
15
15
|
},
|
|
16
16
|
data() {
|
|
17
17
|
return {
|
|
18
|
+
|
|
19
|
+
crudUuid: string,
|
|
18
20
|
moment: moment,
|
|
19
21
|
loading: false,
|
|
20
22
|
firstLoad: false,
|
|
@@ -51,7 +53,7 @@ export default /*#__PURE__*/ {
|
|
|
51
53
|
refreshing: false,
|
|
52
54
|
fetchError: false,
|
|
53
55
|
principalSort: false,
|
|
54
|
-
|
|
56
|
+
exportFormat: 'JSON',
|
|
55
57
|
};
|
|
56
58
|
},
|
|
57
59
|
watch: {
|
|
@@ -378,7 +380,8 @@ export default /*#__PURE__*/ {
|
|
|
378
380
|
},
|
|
379
381
|
|
|
380
382
|
mounted() {
|
|
381
|
-
|
|
383
|
+
const now = Math.floor(Date.now() / 1000);
|
|
384
|
+
this.crudUuid = ''.now;
|
|
382
385
|
this.isMobile = window.matchMedia("(max-width: 1024px)").matches;
|
|
383
386
|
|
|
384
387
|
// Agregar un oyente de eventos para actualizar isMobile cuando cambia el tamaño de la pantalla
|
|
@@ -1155,6 +1158,12 @@ export default /*#__PURE__*/ {
|
|
|
1155
1158
|
});
|
|
1156
1159
|
}
|
|
1157
1160
|
},
|
|
1161
|
+
|
|
1162
|
+
showExportModal(){
|
|
1163
|
+
this.$refs["modal-export"].show();
|
|
1164
|
+
},
|
|
1165
|
+
|
|
1166
|
+
|
|
1158
1167
|
exportItems() {
|
|
1159
1168
|
if (this.useVuexORM) {
|
|
1160
1169
|
return;
|
|
@@ -1166,17 +1175,13 @@ export default /*#__PURE__*/ {
|
|
|
1166
1175
|
|
|
1167
1176
|
let exportItems = true;
|
|
1168
1177
|
let params;
|
|
1169
|
-
|
|
1170
1178
|
let ids = this.selectedItems.map(it => it.id);
|
|
1171
|
-
|
|
1172
1179
|
if (ids.length) {
|
|
1173
1180
|
params = { ids: ids, exportItems: exportItems, };
|
|
1174
1181
|
} else {
|
|
1175
1182
|
params = { filters: JSON.stringify(this.finalFilters), exportItems: exportItems, };
|
|
1176
1183
|
}
|
|
1177
|
-
|
|
1178
|
-
params.format = 'JSON';
|
|
1179
|
-
|
|
1184
|
+
params.format = this.exportFormat;
|
|
1180
1185
|
this.loading = true;
|
|
1181
1186
|
axios
|
|
1182
1187
|
.get(this.apiUrl + "/" + this.modelName + "/export", { params: params, responseType: "blob", })
|
|
@@ -1190,6 +1195,10 @@ export default /*#__PURE__*/ {
|
|
|
1190
1195
|
});
|
|
1191
1196
|
},
|
|
1192
1197
|
|
|
1198
|
+
|
|
1199
|
+
showImportModal(){
|
|
1200
|
+
this.$refs["modal-import"].show();
|
|
1201
|
+
},
|
|
1193
1202
|
importItems() {
|
|
1194
1203
|
let formData = new FormData();
|
|
1195
1204
|
formData.append("file", this.fileImport);
|
|
@@ -1267,10 +1276,10 @@ export default /*#__PURE__*/ {
|
|
|
1267
1276
|
if (this.vuexLocalforage) {
|
|
1268
1277
|
|
|
1269
1278
|
if (this.item.id) {
|
|
1270
|
-
result = await this.model.$update(this.item.id, this.item);
|
|
1279
|
+
result = await this.model.$update(this.item.id,{ data:this.item});
|
|
1271
1280
|
create = false;
|
|
1272
1281
|
} else {
|
|
1273
|
-
result = await this.model.$create(this.item);
|
|
1282
|
+
result = await this.model.$create({ data:this.item});
|
|
1274
1283
|
create = true;
|
|
1275
1284
|
}
|
|
1276
1285
|
|
|
@@ -1695,10 +1704,10 @@ export default /*#__PURE__*/ {
|
|
|
1695
1704
|
v-bind:loading="loading">
|
|
1696
1705
|
<slot name="tableActionsPrepend" v-bind:loading="loading"> </slot>
|
|
1697
1706
|
|
|
1698
|
-
<b-button variant="info"
|
|
1707
|
+
<b-button variant="info" @click="showImportModal()" v-if="showImport">
|
|
1699
1708
|
<b-icon-cloud-upload></b-icon-cloud-upload>{{ messageImport }}
|
|
1700
1709
|
</b-button>
|
|
1701
|
-
<b-button variant="info" @click="
|
|
1710
|
+
<b-button variant="info" @click="showExportModal()" v-if="showExport">
|
|
1702
1711
|
<b-icon-cloud-download></b-icon-cloud-download>{{ messageExport }}
|
|
1703
1712
|
</b-button>
|
|
1704
1713
|
<b-button variant="info" v-if="showPrincipalSortBtn" @click="togglePrincipalSort()" :disabled="loading">
|
|
@@ -2066,7 +2075,7 @@ export default /*#__PURE__*/ {
|
|
|
2066
2075
|
</b-modal>
|
|
2067
2076
|
|
|
2068
2077
|
|
|
2069
|
-
<b-modal ref="modal-import"
|
|
2078
|
+
<b-modal ref="modal-import" title="Importar" hide-footer v-if="showImport">
|
|
2070
2079
|
<slot name="import" v-bind:item="item" v-if="item">
|
|
2071
2080
|
<b-overlay :show="loading" rounded="sm">
|
|
2072
2081
|
<b-form-file v-model="fileImport" :state="Boolean(fileImport)" browse-text="Explorar"
|
|
@@ -2081,6 +2090,27 @@ export default /*#__PURE__*/ {
|
|
|
2081
2090
|
</slot>
|
|
2082
2091
|
</b-modal>
|
|
2083
2092
|
|
|
2093
|
+
<b-modal ref="modal-export" title="Exportar" hide-footer v-if="showExport">
|
|
2094
|
+
<slot name="export" v-bind:item="item" v-if="item">
|
|
2095
|
+
<b-overlay :show="loading" rounded="sm">
|
|
2096
|
+
|
|
2097
|
+
<p v-if="selectedItems.length">Se exportará {{ selectedItems.length }} elementos.</p>
|
|
2098
|
+
<p v-else>Se exportará la consulta actual.</p>
|
|
2099
|
+
|
|
2100
|
+
<select class="form-control" v-model="exportFormat">
|
|
2101
|
+
<option value="JSON">JSON</option>
|
|
2102
|
+
<option value="XLSX">XLSX</option>
|
|
2103
|
+
</select>
|
|
2104
|
+
|
|
2105
|
+
<div class="text-center mt-3">
|
|
2106
|
+
<b-button variant="info" v-on:click="exportItems()" :disabled="loading">
|
|
2107
|
+
<b-icon-cloud-upload></b-icon-cloud-upload>
|
|
2108
|
+
{{ loading ? "Cargando..." : "Exportar" }}
|
|
2109
|
+
</b-button>
|
|
2110
|
+
</div>
|
|
2111
|
+
</b-overlay>
|
|
2112
|
+
</slot>
|
|
2113
|
+
</b-modal>
|
|
2084
2114
|
</div>
|
|
2085
2115
|
</template>
|
|
2086
2116
|
|