vue-laravel-crud 1.4.14 → 1.4.15
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 +61 -21
- package/dist/vue-laravel-crud.min.js +1 -1
- package/dist/vue-laravel-crud.ssr.js +172 -86
- package/package.json +1 -1
- package/src/vue-laravel-crud.vue +75 -57
|
@@ -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-
|
|
17020
|
+
var css = "tr td[data-v-1f4fa85d]:last-child,\ntr td[data-v-1f4fa85d]:first-child {\n width: 1%;\n white-space: nowrap; }\n\n.crud-pagination[data-v-1f4fa85d] {\n display: flex;\n justify-content: center; }\n\n.crud-header[data-v-1f4fa85d] {\n display: flex;\n justify-content: space-between;\n max-height: 3rem; }\n .crud-header[data-v-1f4fa85d] .crud-title[data-v-1f4fa85d] {\n margin: 0; }\n .crud-header[data-v-1f4fa85d] .crud-search[data-v-1f4fa85d] {\n max-width: 15rem; }\n .crud-header[data-v-1f4fa85d] .crud-search[data-v-1f4fa85d] .btn[data-v-1f4fa85d] {\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-1f4fa85d] .crud-search[data-v-1f4fa85d] .btn[data-v-1f4fa85d].open[data-v-1f4fa85d] {\n border-top-right-radius: 0;\n border-bottom-right-radius: 0; }\n .crud-header[data-v-1f4fa85d] .table-options[data-v-1f4fa85d] {\n margin-bottom: 1rem;\n display: flex;\n align-items: center;\n justify-content: flex-end; }\n\n.custom-control[data-v-1f4fa85d] {\n position: relative;\n top: -15px; }\n\n@media (min-width: 992px) {\n .table[data-v-1f4fa85d] {\n table-layout: auto; }\n .table[data-v-1f4fa85d] tbody[data-v-1f4fa85d] td[data-v-1f4fa85d] {\n overflow: scroll;\n -ms-overflow-style: none;\n /* IE and Edge */\n scrollbar-width: none;\n /* Firefox */ }\n .table[data-v-1f4fa85d] tbody[data-v-1f4fa85d] td[data-v-1f4fa85d]::-webkit-scrollbar {\n display: none; } }\n";
|
|
17021
17021
|
n(css, {});
|
|
17022
17022
|
|
|
17023
17023
|
function normalizeComponent (
|
|
@@ -17372,7 +17372,10 @@ const _sfc_main = {
|
|
|
17372
17372
|
}
|
|
17373
17373
|
},
|
|
17374
17374
|
mounted() {
|
|
17375
|
-
if (this.useVuexORM)
|
|
17375
|
+
if (this.useVuexORM) {
|
|
17376
|
+
//this.useVuexORM = true;
|
|
17377
|
+
this.item = new this.model();
|
|
17378
|
+
} else {
|
|
17376
17379
|
this.item = this.model;
|
|
17377
17380
|
this.itemDefault = JSON.parse(JSON.stringify(this.item));
|
|
17378
17381
|
}
|
|
@@ -17408,10 +17411,6 @@ const _sfc_main = {
|
|
|
17408
17411
|
paginationIndexEnd() {
|
|
17409
17412
|
return this.paginationIndexStart + this.pagination.per_page;
|
|
17410
17413
|
},
|
|
17411
|
-
/* filteredItems() {
|
|
17412
|
-
return this.items;
|
|
17413
|
-
},*/
|
|
17414
|
-
|
|
17415
17414
|
finalFilters() {
|
|
17416
17415
|
return [...this.filters, ...this.filter, ...this.internalFilter];
|
|
17417
17416
|
},
|
|
@@ -17673,7 +17672,7 @@ const _sfc_main = {
|
|
|
17673
17672
|
this.loading = false;
|
|
17674
17673
|
});
|
|
17675
17674
|
},
|
|
17676
|
-
removeItem
|
|
17675
|
+
removeItem(id, index) {
|
|
17677
17676
|
this.$bvModal.msgBoxConfirm(this.messageRemoveConfirm, {
|
|
17678
17677
|
size: "sm",
|
|
17679
17678
|
buttonSize: "sm",
|
|
@@ -17683,21 +17682,39 @@ const _sfc_main = {
|
|
|
17683
17682
|
centered: true
|
|
17684
17683
|
}).then(value => {
|
|
17685
17684
|
if (value) {
|
|
17686
|
-
this.
|
|
17687
|
-
axios.delete(this.apiUrl + "/" + this.modelName + "/" + id).then(response => {
|
|
17688
|
-
this.items.splice(index, 1);
|
|
17689
|
-
this.toastSuccess("Elemento eliminado.");
|
|
17690
|
-
this.loading = false;
|
|
17691
|
-
}).catch(error => {
|
|
17692
|
-
this.toastError(error);
|
|
17693
|
-
this.loading = false;
|
|
17694
|
-
});
|
|
17685
|
+
this.deleteItem(id, index);
|
|
17695
17686
|
}
|
|
17696
17687
|
}).catch(error => {
|
|
17697
17688
|
this.toastError(error);
|
|
17698
17689
|
this.loading = false;
|
|
17699
17690
|
});
|
|
17700
17691
|
},
|
|
17692
|
+
deleteItem(id, index) {
|
|
17693
|
+
if (this.useVuexORM) {
|
|
17694
|
+
return this.deleteItemVuex(id, index);
|
|
17695
|
+
}
|
|
17696
|
+
this.loading = true;
|
|
17697
|
+
axios.delete(this.apiUrl + "/" + this.modelName + "/" + id).then(response => {
|
|
17698
|
+
this.items.splice(index, 1);
|
|
17699
|
+
this.toastSuccess("Elemento eliminado.");
|
|
17700
|
+
this.loading = false;
|
|
17701
|
+
}).catch(error => {
|
|
17702
|
+
this.toastError(error);
|
|
17703
|
+
this.loading = false;
|
|
17704
|
+
});
|
|
17705
|
+
},
|
|
17706
|
+
async deleteItemVuex(id, index) {
|
|
17707
|
+
let result = await this.model.api().delete('/' + id, {
|
|
17708
|
+
delete: 1
|
|
17709
|
+
});
|
|
17710
|
+
console.debug("delete item vuex", result);
|
|
17711
|
+
result.response.status;
|
|
17712
|
+
if (result.response.data.error) {
|
|
17713
|
+
this.toastError(result.response.data.error);
|
|
17714
|
+
return;
|
|
17715
|
+
}
|
|
17716
|
+
this.toastSuccess("Elemento eliminado.");
|
|
17717
|
+
},
|
|
17701
17718
|
saveSort() {
|
|
17702
17719
|
if (this.orderable) {
|
|
17703
17720
|
this.loading = true;
|
|
@@ -17751,6 +17768,26 @@ const _sfc_main = {
|
|
|
17751
17768
|
});
|
|
17752
17769
|
return ops.join(", ");
|
|
17753
17770
|
},
|
|
17771
|
+
async saveItemVuex() {
|
|
17772
|
+
let jsondata = this.item.$toJson();
|
|
17773
|
+
console.debug("save item ", this.item, jsondata);
|
|
17774
|
+
let result;
|
|
17775
|
+
if (this.item.id) {
|
|
17776
|
+
result = await this.model.api().put('/' + this.item.id, jsondata);
|
|
17777
|
+
} else {
|
|
17778
|
+
result = await this.model.api().post('', jsondata);
|
|
17779
|
+
}
|
|
17780
|
+
result.response.status;
|
|
17781
|
+
if (result.response.data.error) {
|
|
17782
|
+
this.toastError(result.response.data.error);
|
|
17783
|
+
return;
|
|
17784
|
+
//throw new Error('Something is wrong.')
|
|
17785
|
+
}
|
|
17786
|
+
|
|
17787
|
+
result.save();
|
|
17788
|
+
if (this.refreshAfterSave) this.refresh();
|
|
17789
|
+
this.toastSuccess("Elemento Modificado");
|
|
17790
|
+
},
|
|
17754
17791
|
async saveItem() {
|
|
17755
17792
|
let event = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
17756
17793
|
this.loading = true;
|
|
@@ -17759,6 +17796,9 @@ const _sfc_main = {
|
|
|
17759
17796
|
} else {
|
|
17760
17797
|
if (event) event.preventDefault();
|
|
17761
17798
|
}
|
|
17799
|
+
if (this.useVuexORM) {
|
|
17800
|
+
return this.saveItemVuex();
|
|
17801
|
+
}
|
|
17762
17802
|
if (this.item.id) {
|
|
17763
17803
|
axios.put(this.apiUrl + "/" + this.modelName + "/" + this.item.id, this.item).then(response => {
|
|
17764
17804
|
if (this.hideModalAfterSave) {
|
|
@@ -17976,7 +18016,7 @@ var _sfc_render = function render() {
|
|
|
17976
18016
|
callback: function ($$v) {
|
|
17977
18017
|
_vm.$set(_vm.internalFilterByProp(column.prop + '_from'), "value", $$v);
|
|
17978
18018
|
},
|
|
17979
|
-
expression: "\n
|
|
18019
|
+
expression: "\n internalFilterByProp(column.prop + '_from').value\n "
|
|
17980
18020
|
}
|
|
17981
18021
|
})], 1), _c('div', {
|
|
17982
18022
|
staticClass: "col-6"
|
|
@@ -17992,7 +18032,7 @@ var _sfc_render = function render() {
|
|
|
17992
18032
|
callback: function ($$v) {
|
|
17993
18033
|
_vm.$set(_vm.internalFilterByProp(column.prop + '_to'), "value", $$v);
|
|
17994
18034
|
},
|
|
17995
|
-
expression: "\n
|
|
18035
|
+
expression: "\n internalFilterByProp(column.prop + '_to').value\n "
|
|
17996
18036
|
}
|
|
17997
18037
|
})], 1)])]) : column.type == 'state' ? _c('div', {
|
|
17998
18038
|
staticClass: "form-group"
|
|
@@ -18264,7 +18304,7 @@ var _sfc_render = function render() {
|
|
|
18264
18304
|
callback: function ($$v) {
|
|
18265
18305
|
_vm.$set(_vm.internalFilterByProp(column.prop + '_from'), "value", $$v);
|
|
18266
18306
|
},
|
|
18267
|
-
expression: "\n
|
|
18307
|
+
expression: "\n internalFilterByProp(column.prop + '_from').value\n "
|
|
18268
18308
|
}
|
|
18269
18309
|
})], 1), _c('div', {
|
|
18270
18310
|
staticClass: "col-6"
|
|
@@ -18280,7 +18320,7 @@ var _sfc_render = function render() {
|
|
|
18280
18320
|
callback: function ($$v) {
|
|
18281
18321
|
_vm.$set(_vm.internalFilterByProp(column.prop + '_to'), "value", $$v);
|
|
18282
18322
|
},
|
|
18283
|
-
expression: "\n
|
|
18323
|
+
expression: "\n internalFilterByProp(column.prop + '_to').value\n "
|
|
18284
18324
|
}
|
|
18285
18325
|
})], 1)]) : column.type == 'state' ? _c('select', {
|
|
18286
18326
|
directives: [{
|
|
@@ -18755,7 +18795,7 @@ var _sfc_render = function render() {
|
|
|
18755
18795
|
})], 2)], 1);
|
|
18756
18796
|
};
|
|
18757
18797
|
var _sfc_staticRenderFns = [];
|
|
18758
|
-
var __component__ = /*#__PURE__*/normalizeComponent(_sfc_main, _sfc_render, _sfc_staticRenderFns, false, null, "
|
|
18798
|
+
var __component__ = /*#__PURE__*/normalizeComponent(_sfc_main, _sfc_render, _sfc_staticRenderFns, false, null, "1f4fa85d", null, null);
|
|
18759
18799
|
var component = __component__.exports;
|
|
18760
18800
|
|
|
18761
18801
|
// Import vue component
|