vue-laravel-crud 1.3.15 → 1.3.17
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 +75 -90
- package/dist/vue-laravel-crud.min.js +2 -2
- package/dist/vue-laravel-crud.ssr.js +113 -106
- package/package.json +1 -1
- package/src/vue-laravel-crud.vue +81 -76
|
@@ -5783,6 +5783,10 @@ var script = /*#__PURE__*/{
|
|
|
5783
5783
|
type: String,
|
|
5784
5784
|
default: ""
|
|
5785
5785
|
},
|
|
5786
|
+
hideModalAfterSave: {
|
|
5787
|
+
type: Boolean,
|
|
5788
|
+
default: true
|
|
5789
|
+
},
|
|
5786
5790
|
refreshAfterSave: {
|
|
5787
5791
|
type: Boolean,
|
|
5788
5792
|
default: true
|
|
@@ -6122,6 +6126,7 @@ var script = /*#__PURE__*/{
|
|
|
6122
6126
|
},
|
|
6123
6127
|
|
|
6124
6128
|
refresh() {
|
|
6129
|
+
this.$emit("refresh", {});
|
|
6125
6130
|
this.fetchItems();
|
|
6126
6131
|
},
|
|
6127
6132
|
|
|
@@ -6139,7 +6144,6 @@ var script = /*#__PURE__*/{
|
|
|
6139
6144
|
},
|
|
6140
6145
|
|
|
6141
6146
|
fetchItems(page = 1) {
|
|
6142
|
-
|
|
6143
6147
|
this.loading = true;
|
|
6144
6148
|
axios.get(this.apiUrl + "/" + this.modelName, {
|
|
6145
6149
|
params: {
|
|
@@ -6184,6 +6188,7 @@ var script = /*#__PURE__*/{
|
|
|
6184
6188
|
}
|
|
6185
6189
|
|
|
6186
6190
|
this.loading = false;
|
|
6191
|
+
this.$emit("afterFetch", {});
|
|
6187
6192
|
}).catch(error => {
|
|
6188
6193
|
//console.debug(error);
|
|
6189
6194
|
this.toastError(error);
|
|
@@ -6192,42 +6197,34 @@ var script = /*#__PURE__*/{
|
|
|
6192
6197
|
},
|
|
6193
6198
|
|
|
6194
6199
|
removeItem: function (id, index) {
|
|
6195
|
-
|
|
6196
|
-
|
|
6197
|
-
this.$bvModal.msgBoxConfirm(_this.messageRemoveConfirm, {
|
|
6200
|
+
this.$bvModal.msgBoxConfirm(this.messageRemoveConfirm, {
|
|
6198
6201
|
size: "sm",
|
|
6199
6202
|
buttonSize: "sm",
|
|
6200
6203
|
okVariant: "danger",
|
|
6201
|
-
okTitle:
|
|
6204
|
+
okTitle: this.messageRemove,
|
|
6202
6205
|
cancelTitle: "NO",
|
|
6203
6206
|
centered: true
|
|
6204
6207
|
}).then(value => {
|
|
6205
6208
|
if (value) {
|
|
6206
|
-
|
|
6207
|
-
axios.delete(
|
|
6208
|
-
|
|
6209
|
-
|
|
6210
|
-
|
|
6211
|
-
|
|
6212
|
-
|
|
6213
|
-
|
|
6214
|
-
_this.toastError(error);
|
|
6215
|
-
|
|
6216
|
-
_this.loading = false;
|
|
6209
|
+
this.loading = true;
|
|
6210
|
+
axios.delete(this.apiUrl + "/" + this.modelName + "/" + id).then(response => {
|
|
6211
|
+
this.items.splice(index, 1);
|
|
6212
|
+
this.toastSuccess("Elemento eliminado.");
|
|
6213
|
+
this.loading = false;
|
|
6214
|
+
}).catch(error => {
|
|
6215
|
+
this.toastError(error);
|
|
6216
|
+
this.loading = false;
|
|
6217
6217
|
});
|
|
6218
6218
|
}
|
|
6219
6219
|
}).catch(error => {
|
|
6220
|
-
|
|
6221
|
-
|
|
6222
|
-
_this.loading = false;
|
|
6220
|
+
this.toastError(error);
|
|
6221
|
+
this.loading = false;
|
|
6223
6222
|
});
|
|
6224
6223
|
},
|
|
6225
6224
|
|
|
6226
6225
|
saveSort() {
|
|
6227
6226
|
if (this.orderable) {
|
|
6228
|
-
|
|
6229
|
-
|
|
6230
|
-
_this.loading = true;
|
|
6227
|
+
this.loading = true;
|
|
6231
6228
|
let order = [];
|
|
6232
6229
|
this.items.forEach((v, k) => {
|
|
6233
6230
|
order.push({
|
|
@@ -6235,20 +6232,17 @@ var script = /*#__PURE__*/{
|
|
|
6235
6232
|
order: v[this.orderProp]
|
|
6236
6233
|
});
|
|
6237
6234
|
});
|
|
6238
|
-
axios.post(this.apiUrl + "/" +
|
|
6235
|
+
axios.post(this.apiUrl + "/" + this.modelName + "/sort", {
|
|
6239
6236
|
order: order
|
|
6240
|
-
}).then(
|
|
6237
|
+
}).then(response => {
|
|
6241
6238
|
response.data;
|
|
6242
|
-
|
|
6243
|
-
|
|
6244
|
-
|
|
6245
|
-
|
|
6246
|
-
_this.loading = false;
|
|
6247
|
-
}).catch(function (error) {
|
|
6239
|
+
this.toastSuccess("Orden Actualizado");
|
|
6240
|
+
if (this.refreshAfterSave) this.refresh();
|
|
6241
|
+
this.loading = false;
|
|
6242
|
+
}).catch(error => {
|
|
6248
6243
|
//console.debug(error);
|
|
6249
|
-
|
|
6250
|
-
|
|
6251
|
-
_this.loading = false;
|
|
6244
|
+
this.toastError(error);
|
|
6245
|
+
this.loading = false;
|
|
6252
6246
|
});
|
|
6253
6247
|
}
|
|
6254
6248
|
},
|
|
@@ -6287,9 +6281,7 @@ var script = /*#__PURE__*/{
|
|
|
6287
6281
|
},
|
|
6288
6282
|
|
|
6289
6283
|
async saveItem(event = null) {
|
|
6290
|
-
|
|
6291
|
-
|
|
6292
|
-
_this.loading = true;
|
|
6284
|
+
this.loading = true;
|
|
6293
6285
|
|
|
6294
6286
|
if (this.validate) {
|
|
6295
6287
|
this.messageDefaultValidationError;
|
|
@@ -6298,89 +6290,82 @@ var script = /*#__PURE__*/{
|
|
|
6298
6290
|
}
|
|
6299
6291
|
|
|
6300
6292
|
if (this.item.id) {
|
|
6301
|
-
axios.put(this.apiUrl + "/" +
|
|
6302
|
-
|
|
6293
|
+
axios.put(this.apiUrl + "/" + this.modelName + "/" + this.item.id, this.item).then(response => {
|
|
6294
|
+
if (this.hideModalAfterSave) {
|
|
6295
|
+
this.$bvModal.hide("modal-form-item-" + this.modelName);
|
|
6296
|
+
}
|
|
6303
6297
|
|
|
6304
6298
|
let itemSv = response.data;
|
|
6305
|
-
|
|
6306
|
-
|
|
6307
|
-
|
|
6308
|
-
|
|
6309
|
-
|
|
6310
|
-
|
|
6311
|
-
|
|
6312
|
-
|
|
6313
|
-
|
|
6314
|
-
}).catch(function (error) {
|
|
6315
|
-
_this.toastError(error);
|
|
6316
|
-
|
|
6317
|
-
_this.loading = false;
|
|
6299
|
+
let itemIndex = this.items.findIndex(item => item.id == this.item.id);
|
|
6300
|
+
this.items[itemIndex] = itemSv;
|
|
6301
|
+
this.item = itemSv;
|
|
6302
|
+
this.loading = false;
|
|
6303
|
+
if (this.refreshAfterSave) this.refresh();
|
|
6304
|
+
this.toastSuccess("Elemento Modificado");
|
|
6305
|
+
}).catch(error => {
|
|
6306
|
+
this.toastError(error);
|
|
6307
|
+
this.loading = false;
|
|
6318
6308
|
});
|
|
6319
6309
|
} else {
|
|
6320
6310
|
if (this.createMultipart) {
|
|
6321
6311
|
const formData = new FormData();
|
|
6322
|
-
Object.keys(
|
|
6323
|
-
if (
|
|
6324
|
-
|
|
6325
|
-
let files = _this.item[key];
|
|
6312
|
+
Object.keys(this.item).forEach(key => {
|
|
6313
|
+
if (this.item[key][0] && this.item[key][0].name) {
|
|
6314
|
+
let files = this.item[key];
|
|
6326
6315
|
|
|
6327
6316
|
for (var x = 0; x < files.length; x++) {
|
|
6328
|
-
formData.append(key + "[]",
|
|
6317
|
+
formData.append(key + "[]", this.item[key][x], this.item[key][x].name);
|
|
6329
6318
|
}
|
|
6330
|
-
} else formData.append(key,
|
|
6319
|
+
} else formData.append(key, this.item[key]);
|
|
6331
6320
|
});
|
|
6332
|
-
axios.post(this.apiUrl + "/" +
|
|
6333
|
-
|
|
6321
|
+
axios.post(this.apiUrl + "/" + this.modelName, formData).then(response => {
|
|
6322
|
+
this.loading = false;
|
|
6334
6323
|
|
|
6335
|
-
|
|
6324
|
+
if (this.hideModalAfterSave) {
|
|
6325
|
+
this.$bvModal.hide("modal-form-item-" + this.modelName);
|
|
6326
|
+
}
|
|
6336
6327
|
|
|
6337
6328
|
if (response.data.success) {
|
|
6338
6329
|
if (response.data.message) {
|
|
6339
|
-
|
|
6330
|
+
this.toastSuccess(response.data.message);
|
|
6340
6331
|
}
|
|
6341
6332
|
|
|
6342
6333
|
return;
|
|
6343
6334
|
}
|
|
6344
6335
|
|
|
6345
6336
|
let itemSv = response.data;
|
|
6346
|
-
|
|
6347
|
-
|
|
6348
|
-
|
|
6349
|
-
|
|
6350
|
-
|
|
6351
|
-
|
|
6352
|
-
|
|
6353
|
-
}).catch(function (error) {
|
|
6354
|
-
_this.toastError(error);
|
|
6355
|
-
|
|
6356
|
-
_this.loading = false;
|
|
6337
|
+
this.items.push(itemSv);
|
|
6338
|
+
this.item = itemSv;
|
|
6339
|
+
if (this.refreshAfterSave) this.refresh();
|
|
6340
|
+
this.toastSuccess("Elemento Creado");
|
|
6341
|
+
}).catch(error => {
|
|
6342
|
+
this.toastError(error);
|
|
6343
|
+
this.loading = false;
|
|
6357
6344
|
});
|
|
6358
6345
|
} else {
|
|
6359
|
-
axios.post(this.apiUrl + "/" +
|
|
6360
|
-
|
|
6346
|
+
axios.post(this.apiUrl + "/" + this.modelName, this.item).then(response => {
|
|
6347
|
+
this.loading = false;
|
|
6361
6348
|
|
|
6362
|
-
|
|
6349
|
+
if (this.hideModalAfterSave) {
|
|
6350
|
+
this.$bvModal.hide("modal-form-item-" + this.modelName);
|
|
6351
|
+
}
|
|
6363
6352
|
|
|
6364
6353
|
if (response.data.success) {
|
|
6365
6354
|
if (response.data.message) {
|
|
6366
|
-
|
|
6355
|
+
this.toastSuccess(response.data.message);
|
|
6367
6356
|
}
|
|
6368
6357
|
|
|
6369
6358
|
return;
|
|
6370
6359
|
}
|
|
6371
6360
|
|
|
6372
6361
|
let itemSv = response.data;
|
|
6373
|
-
|
|
6374
|
-
|
|
6375
|
-
|
|
6376
|
-
|
|
6377
|
-
|
|
6378
|
-
|
|
6379
|
-
|
|
6380
|
-
}).catch(function (error) {
|
|
6381
|
-
_this.toastError(error);
|
|
6382
|
-
|
|
6383
|
-
_this.loading = false;
|
|
6362
|
+
this.items.push(itemSv);
|
|
6363
|
+
this.item = itemSv;
|
|
6364
|
+
if (this.refreshAfterSave) this.refresh();
|
|
6365
|
+
this.toastSuccess("Elemento Creado");
|
|
6366
|
+
}).catch(error => {
|
|
6367
|
+
this.toastError(error);
|
|
6368
|
+
this.loading = false;
|
|
6384
6369
|
});
|
|
6385
6370
|
}
|
|
6386
6371
|
}
|
|
@@ -7441,8 +7426,8 @@ var __vue_staticRenderFns__ = [];
|
|
|
7441
7426
|
|
|
7442
7427
|
const __vue_inject_styles__ = function (inject) {
|
|
7443
7428
|
if (!inject) return;
|
|
7444
|
-
inject("data-v-
|
|
7445
|
-
source: "tr td[data-v-
|
|
7429
|
+
inject("data-v-18175b74_0", {
|
|
7430
|
+
source: "tr td[data-v-18175b74]:first-child,tr td[data-v-18175b74]:last-child{width:1%;white-space:nowrap}.crud-pagination[data-v-18175b74]{display:flex;justify-content:center}.crud-header[data-v-18175b74]{display:flex;justify-content:space-between;max-height:3rem}.crud-header .crud-title[data-v-18175b74]{margin:0}.crud-header .crud-search[data-v-18175b74]{max-width:15rem}.crud-header .crud-search .btn[data-v-18175b74]{border-top-left-radius:0;border-bottom-left-radius:0;border-top-right-radius:.375rem;border-bottom-right-radius:.375rem}.crud-header .crud-search .btn.open[data-v-18175b74]{border-top-right-radius:0;border-bottom-right-radius:0}.crud-header .table-options[data-v-18175b74]{margin-bottom:1rem;display:flex;align-items:center;justify-content:flex-end}.custom-control[data-v-18175b74]{position:relative;top:-15px}@media (min-width:992px){.table[data-v-18175b74]{table-layout:auto}.table tbody td[data-v-18175b74]{overflow:scroll;-ms-overflow-style:none;scrollbar-width:none}.table tbody td[data-v-18175b74]::-webkit-scrollbar{display:none}}",
|
|
7446
7431
|
map: undefined,
|
|
7447
7432
|
media: undefined
|
|
7448
7433
|
});
|
|
@@ -7450,7 +7435,7 @@ const __vue_inject_styles__ = function (inject) {
|
|
|
7450
7435
|
/* scoped */
|
|
7451
7436
|
|
|
7452
7437
|
|
|
7453
|
-
const __vue_scope_id__ = "data-v-
|
|
7438
|
+
const __vue_scope_id__ = "data-v-18175b74";
|
|
7454
7439
|
/* module identifier */
|
|
7455
7440
|
|
|
7456
7441
|
const __vue_module_identifier__ = undefined;
|