vue-laravel-crud 1.6.27 → 1.7.0
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 +63 -25
|
@@ -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-2f35a88a]:last-child,\ntr td[data-v-2f35a88a]:first-child {\n width: 1%;\n white-space: nowrap; }\n\n.crud-pagination[data-v-2f35a88a] {\n display: flex;\n align-items: center;\n width: 100%;\n justify-content: center;\n margin-top: 1rem; }\n\n.crud-header[data-v-2f35a88a] {\n display: flex;\n justify-content: space-between;\n max-height: 3rem; }\n .crud-header[data-v-2f35a88a] .crud-title[data-v-2f35a88a] {\n margin: 0; }\n .crud-header[data-v-2f35a88a] .crud-search[data-v-2f35a88a] {\n max-width: 15rem; }\n .crud-header[data-v-2f35a88a] .crud-search[data-v-2f35a88a] .btn[data-v-2f35a88a] {\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-2f35a88a] .crud-search[data-v-2f35a88a] .btn[data-v-2f35a88a].open[data-v-2f35a88a] {\n border-top-right-radius: 0;\n border-bottom-right-radius: 0; }\n .crud-header[data-v-2f35a88a] .table-options[data-v-2f35a88a] {\n margin-bottom: 1rem;\n display: flex;\n align-items: center;\n justify-content: flex-end; }\n\n.custom-control[data-v-2f35a88a] {\n position: relative; }\n\n@media (min-width: 992px) {\n .table[data-v-2f35a88a] {\n table-layout: auto; }\n .table[data-v-2f35a88a] tbody[data-v-2f35a88a] td[data-v-2f35a88a] {\n overflow: scroll;\n -ms-overflow-style: none;\n /* IE and Edge */\n scrollbar-width: none;\n /* Firefox */ }\n .table[data-v-2f35a88a] tbody[data-v-2f35a88a] td[data-v-2f35a88a]::-webkit-scrollbar {\n display: none; } }\n";
|
|
12119
12119
|
n(css, {});
|
|
12120
12120
|
|
|
12121
12121
|
function normalizeComponent (
|
|
@@ -12300,6 +12300,10 @@ const _sfc_main = {
|
|
|
12300
12300
|
type: Boolean | Array,
|
|
12301
12301
|
default: true
|
|
12302
12302
|
},
|
|
12303
|
+
vuexLocalforage: {
|
|
12304
|
+
type: Boolean,
|
|
12305
|
+
default: false
|
|
12306
|
+
},
|
|
12303
12307
|
columns: {
|
|
12304
12308
|
type: Array,
|
|
12305
12309
|
default() {
|
|
@@ -12927,14 +12931,19 @@ const _sfc_main = {
|
|
|
12927
12931
|
async fetchItemsVuex(page = 1, concat = false) {
|
|
12928
12932
|
this.loading = true;
|
|
12929
12933
|
this.$emit("beforeFetch", {});
|
|
12930
|
-
|
|
12931
|
-
|
|
12932
|
-
|
|
12933
|
-
|
|
12934
|
-
|
|
12935
|
-
|
|
12936
|
-
|
|
12937
|
-
|
|
12934
|
+
let result;
|
|
12935
|
+
if (this.vuexLocalforage) {
|
|
12936
|
+
await this.model.$fetch();
|
|
12937
|
+
} else {
|
|
12938
|
+
this.model.deleteAll();
|
|
12939
|
+
result = await this.model.api().get('', {
|
|
12940
|
+
params: {
|
|
12941
|
+
page: page,
|
|
12942
|
+
limit: this.pagination.perPage,
|
|
12943
|
+
filters: JSON.stringify(this.finalFilters)
|
|
12944
|
+
}
|
|
12945
|
+
});
|
|
12946
|
+
}
|
|
12938
12947
|
let itemsResult = this.model.query().withAll().get();
|
|
12939
12948
|
//let itemsResult = result.entities[this.model.entity];
|
|
12940
12949
|
|
|
@@ -13137,15 +13146,19 @@ const _sfc_main = {
|
|
|
13137
13146
|
this.loading = false;
|
|
13138
13147
|
},
|
|
13139
13148
|
async deleteItemVuex(id, index) {
|
|
13140
|
-
|
|
13141
|
-
delete
|
|
13142
|
-
}
|
|
13143
|
-
|
|
13144
|
-
|
|
13145
|
-
|
|
13146
|
-
|
|
13147
|
-
|
|
13148
|
-
|
|
13149
|
+
if (this.vuexLocalforage) {
|
|
13150
|
+
await this.model.$delete(id);
|
|
13151
|
+
} else {
|
|
13152
|
+
let result = await this.model.api().delete('/' + id, {
|
|
13153
|
+
delete: 1
|
|
13154
|
+
});
|
|
13155
|
+
console.debug("delete item vuex", result);
|
|
13156
|
+
result.response.status;
|
|
13157
|
+
if (result.response.data.error) {
|
|
13158
|
+
this.toastError(result.response.data.error);
|
|
13159
|
+
this.loading = false;
|
|
13160
|
+
return;
|
|
13161
|
+
}
|
|
13149
13162
|
}
|
|
13150
13163
|
this.toastSuccess("Elemento eliminado.");
|
|
13151
13164
|
},
|
|
@@ -13213,7 +13226,7 @@ const _sfc_main = {
|
|
|
13213
13226
|
importItems() {
|
|
13214
13227
|
let formData = new FormData();
|
|
13215
13228
|
formData.append("file", this.fileImport);
|
|
13216
|
-
axios.post(this.apiUrl + "/" + this.modelName + "/
|
|
13229
|
+
axios.post(this.apiUrl + "/" + this.modelName + "/import", formData, {
|
|
13217
13230
|
headers: {
|
|
13218
13231
|
"Content-Type": "multipart/form-data"
|
|
13219
13232
|
}
|
|
@@ -13271,21 +13284,32 @@ const _sfc_main = {
|
|
|
13271
13284
|
console.debug("save item 2", this.item, jsondata);
|
|
13272
13285
|
let result;
|
|
13273
13286
|
let create = false;
|
|
13274
|
-
if (this.
|
|
13275
|
-
|
|
13276
|
-
|
|
13287
|
+
if (this.vuexLocalforage) {
|
|
13288
|
+
await this.model.$create(id);
|
|
13289
|
+
if (this.item.id) {
|
|
13290
|
+
result = await this.model.$update(this.item.id, jsondata);
|
|
13291
|
+
create = false;
|
|
13292
|
+
} else {
|
|
13293
|
+
result = await this.model.$create(this.item.id, jsondata);
|
|
13294
|
+
create = true;
|
|
13295
|
+
}
|
|
13277
13296
|
} else {
|
|
13278
|
-
|
|
13279
|
-
|
|
13280
|
-
|
|
13281
|
-
|
|
13282
|
-
|
|
13283
|
-
|
|
13284
|
-
|
|
13285
|
-
|
|
13286
|
-
|
|
13297
|
+
if (this.item.id) {
|
|
13298
|
+
result = await this.model.api().put('/' + this.item.id, jsondata);
|
|
13299
|
+
create = false;
|
|
13300
|
+
} else {
|
|
13301
|
+
result = await this.model.api().post('', jsondata);
|
|
13302
|
+
create = true;
|
|
13303
|
+
}
|
|
13304
|
+
result.response.status;
|
|
13305
|
+
if (result.response.data.error) {
|
|
13306
|
+
this.toastError(result.response.data.error);
|
|
13307
|
+
this.loading = false;
|
|
13308
|
+
return;
|
|
13309
|
+
//throw new Error('Something is wrong.')
|
|
13310
|
+
}
|
|
13311
|
+
result.save();
|
|
13287
13312
|
}
|
|
13288
|
-
result.save();
|
|
13289
13313
|
if (this.refreshAfterSave) this.refresh();
|
|
13290
13314
|
this.loading = false;
|
|
13291
13315
|
this.toastSuccess("Elemento Modificado");
|
|
@@ -14574,7 +14598,7 @@ var _sfc_render = function render() {
|
|
|
14574
14598
|
}) : _vm._e()], 2) : _vm._e()], 1);
|
|
14575
14599
|
};
|
|
14576
14600
|
var _sfc_staticRenderFns = [];
|
|
14577
|
-
var __component__ = /*#__PURE__*/normalizeComponent(_sfc_main, _sfc_render, _sfc_staticRenderFns, false, null, "
|
|
14601
|
+
var __component__ = /*#__PURE__*/normalizeComponent(_sfc_main, _sfc_render, _sfc_staticRenderFns, false, null, "2f35a88a", null, null);
|
|
14578
14602
|
var component = __component__.exports;
|
|
14579
14603
|
|
|
14580
14604
|
// Import vue component
|