vue-laravel-crud 1.6.28 → 1.7.1
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 +57 -33
- package/dist/vue-laravel-crud.min.js +3 -3
- package/dist/vue-laravel-crud.ssr.js +76 -22
- package/package.json +1 -1
- package/src/vue-laravel-crud.vue +68 -30
|
@@ -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-53ba538f]:last-child,\ntr td[data-v-53ba538f]:first-child {\n width: 1%;\n white-space: nowrap; }\n\n.crud-pagination[data-v-53ba538f] {\n display: flex;\n align-items: center;\n width: 100%;\n justify-content: center;\n margin-top: 1rem; }\n\n.crud-header[data-v-53ba538f] {\n display: flex;\n justify-content: space-between;\n max-height: 3rem; }\n .crud-header[data-v-53ba538f] .crud-title[data-v-53ba538f] {\n margin: 0; }\n .crud-header[data-v-53ba538f] .crud-search[data-v-53ba538f] {\n max-width: 15rem; }\n .crud-header[data-v-53ba538f] .crud-search[data-v-53ba538f] .btn[data-v-53ba538f] {\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-53ba538f] .crud-search[data-v-53ba538f] .btn[data-v-53ba538f].open[data-v-53ba538f] {\n border-top-right-radius: 0;\n border-bottom-right-radius: 0; }\n .crud-header[data-v-53ba538f] .table-options[data-v-53ba538f] {\n margin-bottom: 1rem;\n display: flex;\n align-items: center;\n justify-content: flex-end; }\n\n.custom-control[data-v-53ba538f] {\n position: relative; }\n\n@media (min-width: 992px) {\n .table[data-v-53ba538f] {\n table-layout: auto; }\n .table[data-v-53ba538f] tbody[data-v-53ba538f] td[data-v-53ba538f] {\n overflow: scroll;\n -ms-overflow-style: none;\n /* IE and Edge */\n scrollbar-width: none;\n /* Firefox */ }\n .table[data-v-53ba538f] tbody[data-v-53ba538f] td[data-v-53ba538f]::-webkit-scrollbar {\n display: none; } }\n";
|
|
12536
12536
|
n(css, {});function normalizeComponent (
|
|
12537
12537
|
scriptExports,
|
|
12538
12538
|
render,
|
|
@@ -12715,6 +12715,10 @@ n(css, {});function normalizeComponent (
|
|
|
12715
12715
|
type: Boolean | Array,
|
|
12716
12716
|
default: true
|
|
12717
12717
|
},
|
|
12718
|
+
vuexLocalforage: {
|
|
12719
|
+
type: Boolean,
|
|
12720
|
+
default: false
|
|
12721
|
+
},
|
|
12718
12722
|
columns: {
|
|
12719
12723
|
type: Array,
|
|
12720
12724
|
default: function _default() {
|
|
@@ -13390,8 +13394,18 @@ n(css, {});function normalizeComponent (
|
|
|
13390
13394
|
page = _arguments.length > 0 && _arguments[0] !== undefined ? _arguments[0] : 1;
|
|
13391
13395
|
_this10.loading = true;
|
|
13392
13396
|
_this10.$emit("beforeFetch", {});
|
|
13393
|
-
_this10.
|
|
13397
|
+
if (!_this10.vuexLocalforage) {
|
|
13398
|
+
_context.next = 9;
|
|
13399
|
+
break;
|
|
13400
|
+
}
|
|
13394
13401
|
_context.next = 7;
|
|
13402
|
+
return _this10.model.$fetch();
|
|
13403
|
+
case 7:
|
|
13404
|
+
_context.next = 13;
|
|
13405
|
+
break;
|
|
13406
|
+
case 9:
|
|
13407
|
+
_this10.model.deleteAll();
|
|
13408
|
+
_context.next = 12;
|
|
13395
13409
|
return _this10.model.api().get('', {
|
|
13396
13410
|
params: {
|
|
13397
13411
|
page: page,
|
|
@@ -13399,8 +13413,9 @@ n(css, {});function normalizeComponent (
|
|
|
13399
13413
|
filters: JSON.stringify(_this10.finalFilters)
|
|
13400
13414
|
}
|
|
13401
13415
|
});
|
|
13402
|
-
case
|
|
13416
|
+
case 12:
|
|
13403
13417
|
result = _context.sent;
|
|
13418
|
+
case 13:
|
|
13404
13419
|
itemsResult = _this10.model.query().withAll().get(); //let itemsResult = result.entities[this.model.entity];
|
|
13405
13420
|
if (itemsResult) {
|
|
13406
13421
|
_this10.items = itemsResult;
|
|
@@ -13408,7 +13423,7 @@ n(css, {});function normalizeComponent (
|
|
|
13408
13423
|
console.debug("fetch page vuex ", itemsResult, page, _this10.items, result);
|
|
13409
13424
|
_this10.loading = false;
|
|
13410
13425
|
_this10.firstLoad = true;
|
|
13411
|
-
case
|
|
13426
|
+
case 18:
|
|
13412
13427
|
case "end":
|
|
13413
13428
|
return _context.stop();
|
|
13414
13429
|
}
|
|
@@ -13662,24 +13677,34 @@ n(css, {});function normalizeComponent (
|
|
|
13662
13677
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
13663
13678
|
while (1) switch (_context5.prev = _context5.next) {
|
|
13664
13679
|
case 0:
|
|
13665
|
-
|
|
13680
|
+
if (!_this18.vuexLocalforage) {
|
|
13681
|
+
_context5.next = 5;
|
|
13682
|
+
break;
|
|
13683
|
+
}
|
|
13684
|
+
_context5.next = 3;
|
|
13685
|
+
return _this18.model.$delete(id);
|
|
13686
|
+
case 3:
|
|
13687
|
+
_context5.next = 14;
|
|
13688
|
+
break;
|
|
13689
|
+
case 5:
|
|
13690
|
+
_context5.next = 7;
|
|
13666
13691
|
return _this18.model.api().delete('/' + id, {
|
|
13667
13692
|
delete: 1
|
|
13668
13693
|
});
|
|
13669
|
-
case
|
|
13694
|
+
case 7:
|
|
13670
13695
|
result = _context5.sent;
|
|
13671
13696
|
console.debug("delete item vuex", result);
|
|
13672
13697
|
result.response.status;
|
|
13673
13698
|
if (!result.response.data.error) {
|
|
13674
|
-
_context5.next =
|
|
13699
|
+
_context5.next = 14;
|
|
13675
13700
|
break;
|
|
13676
13701
|
}
|
|
13677
13702
|
_this18.toastError(result.response.data.error);
|
|
13678
13703
|
_this18.loading = false;
|
|
13679
13704
|
return _context5.abrupt("return");
|
|
13680
|
-
case
|
|
13705
|
+
case 14:
|
|
13681
13706
|
_this18.toastSuccess("Elemento eliminado.");
|
|
13682
|
-
case
|
|
13707
|
+
case 15:
|
|
13683
13708
|
case "end":
|
|
13684
13709
|
return _context5.stop();
|
|
13685
13710
|
}
|
|
@@ -13755,7 +13780,7 @@ n(css, {});function normalizeComponent (
|
|
|
13755
13780
|
var _this21 = this;
|
|
13756
13781
|
var formData = new FormData();
|
|
13757
13782
|
formData.append("file", this.fileImport);
|
|
13758
|
-
axios.post(this.apiUrl + "/" + this.modelName + "/
|
|
13783
|
+
axios.post(this.apiUrl + "/" + this.modelName + "/import", formData, {
|
|
13759
13784
|
headers: {
|
|
13760
13785
|
"Content-Type": "multipart/form-data"
|
|
13761
13786
|
}
|
|
@@ -13822,41 +13847,70 @@ n(css, {});function normalizeComponent (
|
|
|
13822
13847
|
jsondata = _this23.item.$toJson();
|
|
13823
13848
|
console.debug("save item 2", _this23.item, jsondata);
|
|
13824
13849
|
create = false;
|
|
13825
|
-
if (!_this23.
|
|
13826
|
-
_context6.next =
|
|
13850
|
+
if (!_this23.vuexLocalforage) {
|
|
13851
|
+
_context6.next = 21;
|
|
13827
13852
|
break;
|
|
13828
13853
|
}
|
|
13829
13854
|
_context6.next = 8;
|
|
13830
|
-
return _this23.model
|
|
13855
|
+
return _this23.model.$create(id);
|
|
13831
13856
|
case 8:
|
|
13857
|
+
if (!_this23.item.id) {
|
|
13858
|
+
_context6.next = 15;
|
|
13859
|
+
break;
|
|
13860
|
+
}
|
|
13861
|
+
_context6.next = 11;
|
|
13862
|
+
return _this23.model.$update(_this23.item.id, jsondata);
|
|
13863
|
+
case 11:
|
|
13832
13864
|
result = _context6.sent;
|
|
13833
13865
|
create = false;
|
|
13834
|
-
_context6.next =
|
|
13866
|
+
_context6.next = 19;
|
|
13835
13867
|
break;
|
|
13836
|
-
case
|
|
13837
|
-
_context6.next =
|
|
13868
|
+
case 15:
|
|
13869
|
+
_context6.next = 17;
|
|
13870
|
+
return _this23.model.$create(jsondata);
|
|
13871
|
+
case 17:
|
|
13872
|
+
result = _context6.sent;
|
|
13873
|
+
create = true;
|
|
13874
|
+
case 19:
|
|
13875
|
+
_context6.next = 38;
|
|
13876
|
+
break;
|
|
13877
|
+
case 21:
|
|
13878
|
+
if (!_this23.item.id) {
|
|
13879
|
+
_context6.next = 28;
|
|
13880
|
+
break;
|
|
13881
|
+
}
|
|
13882
|
+
_context6.next = 24;
|
|
13883
|
+
return _this23.model.api().put('/' + _this23.item.id, jsondata);
|
|
13884
|
+
case 24:
|
|
13885
|
+
result = _context6.sent;
|
|
13886
|
+
create = false;
|
|
13887
|
+
_context6.next = 32;
|
|
13888
|
+
break;
|
|
13889
|
+
case 28:
|
|
13890
|
+
_context6.next = 30;
|
|
13838
13891
|
return _this23.model.api().post('', jsondata);
|
|
13839
|
-
case
|
|
13892
|
+
case 30:
|
|
13840
13893
|
result = _context6.sent;
|
|
13841
13894
|
create = true;
|
|
13842
|
-
case
|
|
13895
|
+
case 32:
|
|
13843
13896
|
result.response.status;
|
|
13844
13897
|
if (!result.response.data.error) {
|
|
13845
|
-
_context6.next =
|
|
13898
|
+
_context6.next = 37;
|
|
13846
13899
|
break;
|
|
13847
13900
|
}
|
|
13848
13901
|
_this23.toastError(result.response.data.error);
|
|
13849
13902
|
_this23.loading = false;
|
|
13850
13903
|
return _context6.abrupt("return");
|
|
13851
|
-
case
|
|
13904
|
+
case 37:
|
|
13852
13905
|
result.save();
|
|
13906
|
+
case 38:
|
|
13853
13907
|
if (_this23.refreshAfterSave) _this23.refresh();
|
|
13854
13908
|
_this23.loading = false;
|
|
13855
13909
|
_this23.toastSuccess("Elemento Modificado");
|
|
13856
13910
|
if (_this23.hideModalAfterSave || create && _this23.hideModalAfterCreate || !create && _this23.hideModalAfterUpdate) {
|
|
13857
13911
|
_this23.$bvModal.hide("modal-form-item-" + _this23.modelName);
|
|
13858
13912
|
}
|
|
13859
|
-
case
|
|
13913
|
+
case 42:
|
|
13860
13914
|
case "end":
|
|
13861
13915
|
return _context6.stop();
|
|
13862
13916
|
}
|
|
@@ -15220,7 +15274,7 @@ var _sfc_render = function render() {
|
|
|
15220
15274
|
}) : _vm._e()], 2) : _vm._e()], 1);
|
|
15221
15275
|
};
|
|
15222
15276
|
var _sfc_staticRenderFns = [];
|
|
15223
|
-
var __component__ = /*#__PURE__*/normalizeComponent(_sfc_main, _sfc_render, _sfc_staticRenderFns, false, null, "
|
|
15277
|
+
var __component__ = /*#__PURE__*/normalizeComponent(_sfc_main, _sfc_render, _sfc_staticRenderFns, false, null, "53ba538f", null, null);
|
|
15224
15278
|
var component$1 = __component__.exports;// Import vue component
|
|
15225
15279
|
|
|
15226
15280
|
// Default export is installable instance of component.
|
package/package.json
CHANGED
package/src/vue-laravel-crud.vue
CHANGED
|
@@ -98,6 +98,10 @@ export default /*#__PURE__*/ {
|
|
|
98
98
|
type: Boolean | Array,
|
|
99
99
|
default: true,
|
|
100
100
|
},
|
|
101
|
+
vuexLocalforage: {
|
|
102
|
+
type: Boolean,
|
|
103
|
+
default: false,
|
|
104
|
+
},
|
|
101
105
|
|
|
102
106
|
columns: {
|
|
103
107
|
type: Array,
|
|
@@ -814,17 +818,26 @@ export default /*#__PURE__*/ {
|
|
|
814
818
|
this.loading = true;
|
|
815
819
|
this.$emit("beforeFetch", {});
|
|
816
820
|
|
|
817
|
-
|
|
821
|
+
let result;
|
|
818
822
|
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
823
|
+
if(this.vuexLocalforage){
|
|
824
|
+
await this.model.$fetch();
|
|
825
|
+
|
|
826
|
+
}else{
|
|
827
|
+
this.model.deleteAll();
|
|
828
|
+
|
|
829
|
+
result = await this.model.api().get('', {
|
|
830
|
+
params: {
|
|
831
|
+
page: page,
|
|
832
|
+
limit: this.pagination.perPage,
|
|
833
|
+
filters: JSON.stringify(this.finalFilters),
|
|
834
|
+
}
|
|
835
|
+
});
|
|
826
836
|
|
|
827
837
|
|
|
838
|
+
}
|
|
839
|
+
|
|
840
|
+
|
|
828
841
|
let itemsResult = this.model.query().withAll().get();
|
|
829
842
|
//let itemsResult = result.entities[this.model.entity];
|
|
830
843
|
|
|
@@ -1055,19 +1068,27 @@ export default /*#__PURE__*/ {
|
|
|
1055
1068
|
},
|
|
1056
1069
|
async deleteItemVuex(id, index) {
|
|
1057
1070
|
|
|
1058
|
-
|
|
1071
|
+
|
|
1072
|
+
if(this.vuexLocalforage){
|
|
1073
|
+
await this.model.$delete(id);
|
|
1074
|
+
|
|
1075
|
+
}else{
|
|
1076
|
+
let result = await this.model.api().delete('/' + id, {
|
|
1059
1077
|
delete: 1
|
|
1060
1078
|
});
|
|
1061
1079
|
|
|
1062
|
-
|
|
1063
|
-
|
|
1080
|
+
console.debug("delete item vuex", result);
|
|
1081
|
+
let responseStatus = result.response.status;
|
|
1064
1082
|
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1083
|
+
if (result.response.data.error) {
|
|
1084
|
+
this.toastError(result.response.data.error);
|
|
1085
|
+
this.loading = false;
|
|
1086
|
+
return;
|
|
1087
|
+
}
|
|
1069
1088
|
}
|
|
1070
1089
|
|
|
1090
|
+
|
|
1091
|
+
|
|
1071
1092
|
this.toastSuccess("Elemento eliminado.");
|
|
1072
1093
|
},
|
|
1073
1094
|
saveSort() {
|
|
@@ -1209,22 +1230,40 @@ export default /*#__PURE__*/ {
|
|
|
1209
1230
|
|
|
1210
1231
|
let create = false;
|
|
1211
1232
|
|
|
1212
|
-
if (this.item.id) {
|
|
1213
|
-
result = await this.model.api().put('/' + this.item.id, jsondata);
|
|
1214
|
-
create = false;
|
|
1215
|
-
} else {
|
|
1216
|
-
result = await this.model.api().post('', jsondata);
|
|
1217
|
-
create = true;
|
|
1218
|
-
}
|
|
1219
1233
|
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
this.
|
|
1224
|
-
|
|
1225
|
-
|
|
1234
|
+
if(this.vuexLocalforage){
|
|
1235
|
+
await this.model.$create(id);
|
|
1236
|
+
|
|
1237
|
+
if (this.item.id) {
|
|
1238
|
+
result = await this.model.$update(this.item.id, jsondata);
|
|
1239
|
+
create = false;
|
|
1240
|
+
} else {
|
|
1241
|
+
result = await this.model.$create(jsondata);
|
|
1242
|
+
create = true;
|
|
1243
|
+
}
|
|
1244
|
+
|
|
1245
|
+
}else{
|
|
1246
|
+
if (this.item.id) {
|
|
1247
|
+
result = await this.model.api().put('/' + this.item.id, jsondata);
|
|
1248
|
+
create = false;
|
|
1249
|
+
} else {
|
|
1250
|
+
result = await this.model.api().post('', jsondata);
|
|
1251
|
+
create = true;
|
|
1252
|
+
}
|
|
1253
|
+
|
|
1254
|
+
|
|
1255
|
+
let responseStatus = result.response.status;
|
|
1256
|
+
if (result.response.data.error) {
|
|
1257
|
+
this.toastError(result.response.data.error);
|
|
1258
|
+
this.loading = false;
|
|
1259
|
+
return;
|
|
1260
|
+
//throw new Error('Something is wrong.')
|
|
1261
|
+
}
|
|
1262
|
+
|
|
1263
|
+
result.save();
|
|
1226
1264
|
}
|
|
1227
|
-
|
|
1265
|
+
|
|
1266
|
+
|
|
1228
1267
|
if (this.refreshAfterSave) this.refresh();
|
|
1229
1268
|
this.loading = false;
|
|
1230
1269
|
this.toastSuccess("Elemento Modificado");
|
|
@@ -1233,7 +1272,6 @@ export default /*#__PURE__*/ {
|
|
|
1233
1272
|
this.$bvModal.hide("modal-form-item-" + this.modelName);
|
|
1234
1273
|
}
|
|
1235
1274
|
|
|
1236
|
-
|
|
1237
1275
|
},
|
|
1238
1276
|
|
|
1239
1277
|
async saveItemLocal(event = null) {
|