vue-laravel-crud 1.4.15 → 1.4.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 +56 -39
- package/dist/vue-laravel-crud.min.js +2 -2
- package/dist/vue-laravel-crud.ssr.js +67 -50
- package/package.json +1 -1
- package/src/vue-laravel-crud.vue +32 -17
|
@@ -17305,7 +17305,7 @@ var moment$1 = {
|
|
|
17305
17305
|
})));
|
|
17306
17306
|
} (moment$1));
|
|
17307
17307
|
|
|
17308
|
-
var moment = momentExports;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-
|
|
17308
|
+
var moment = momentExports;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-818372ed]:last-child,\ntr td[data-v-818372ed]:first-child {\n width: 1%;\n white-space: nowrap; }\n\n.crud-pagination[data-v-818372ed] {\n display: flex;\n justify-content: center; }\n\n.crud-header[data-v-818372ed] {\n display: flex;\n justify-content: space-between;\n max-height: 3rem; }\n .crud-header[data-v-818372ed] .crud-title[data-v-818372ed] {\n margin: 0; }\n .crud-header[data-v-818372ed] .crud-search[data-v-818372ed] {\n max-width: 15rem; }\n .crud-header[data-v-818372ed] .crud-search[data-v-818372ed] .btn[data-v-818372ed] {\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-818372ed] .crud-search[data-v-818372ed] .btn[data-v-818372ed].open[data-v-818372ed] {\n border-top-right-radius: 0;\n border-bottom-right-radius: 0; }\n .crud-header[data-v-818372ed] .table-options[data-v-818372ed] {\n margin-bottom: 1rem;\n display: flex;\n align-items: center;\n justify-content: flex-end; }\n\n.custom-control[data-v-818372ed] {\n position: relative;\n top: -15px; }\n\n@media (min-width: 992px) {\n .table[data-v-818372ed] {\n table-layout: auto; }\n .table[data-v-818372ed] tbody[data-v-818372ed] td[data-v-818372ed] {\n overflow: scroll;\n -ms-overflow-style: none;\n /* IE and Edge */\n scrollbar-width: none;\n /* Firefox */ }\n .table[data-v-818372ed] tbody[data-v-818372ed] td[data-v-818372ed]::-webkit-scrollbar {\n display: none; } }\n";
|
|
17309
17309
|
n(css, {});function normalizeComponent (
|
|
17310
17310
|
scriptExports,
|
|
17311
17311
|
render,
|
|
@@ -17404,14 +17404,13 @@ n(css, {});function normalizeComponent (
|
|
|
17404
17404
|
},
|
|
17405
17405
|
data: function data() {
|
|
17406
17406
|
return {
|
|
17407
|
-
|
|
17408
|
-
forceRecomputeCounter: 0,
|
|
17409
|
-
filtersVisible: false,
|
|
17407
|
+
moment: moment,
|
|
17410
17408
|
loading: false,
|
|
17409
|
+
item: {
|
|
17410
|
+
id: null
|
|
17411
|
+
},
|
|
17411
17412
|
items: [],
|
|
17412
17413
|
selectedItems: [],
|
|
17413
|
-
moment: moment,
|
|
17414
|
-
displaySearch: false,
|
|
17415
17414
|
pagination: {
|
|
17416
17415
|
current_page: 1,
|
|
17417
17416
|
last_page: 1,
|
|
@@ -17420,12 +17419,13 @@ n(css, {});function normalizeComponent (
|
|
|
17420
17419
|
per_page: 20,
|
|
17421
17420
|
total: 0
|
|
17422
17421
|
},
|
|
17422
|
+
displaySearch: false,
|
|
17423
17423
|
itemDefault: null,
|
|
17424
17424
|
filters: [],
|
|
17425
|
+
filtersVisible: false,
|
|
17426
|
+
filterSidebarOpen: false,
|
|
17425
17427
|
internalFilters: [],
|
|
17426
|
-
|
|
17427
|
-
id: null
|
|
17428
|
-
},
|
|
17428
|
+
forceRecomputeCounter: 0,
|
|
17429
17429
|
displayModes: {
|
|
17430
17430
|
MODE_TABLE: 1,
|
|
17431
17431
|
MODE_CARDS: 2,
|
|
@@ -17866,7 +17866,11 @@ n(css, {});function normalizeComponent (
|
|
|
17866
17866
|
this.$bvModal.show("modal-show-item-" + this.modelName);
|
|
17867
17867
|
},
|
|
17868
17868
|
createItem: function createItem() {
|
|
17869
|
-
|
|
17869
|
+
if (this.useVuexORM) {
|
|
17870
|
+
this.item = new this.model();
|
|
17871
|
+
} else {
|
|
17872
|
+
this.item = JSON.parse(JSON.stringify(this.itemDefault));
|
|
17873
|
+
}
|
|
17870
17874
|
this.onSelect();
|
|
17871
17875
|
this.$bvModal.show("modal-form-item-" + this.modelName);
|
|
17872
17876
|
},
|
|
@@ -18120,36 +18124,37 @@ n(css, {});function normalizeComponent (
|
|
|
18120
18124
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
18121
18125
|
while (1) switch (_context3.prev = _context3.next) {
|
|
18122
18126
|
case 0:
|
|
18127
|
+
console.debug("save item 1", _this14.item);
|
|
18123
18128
|
jsondata = _this14.item.$toJson();
|
|
18124
|
-
console.debug("save item ", _this14.item, jsondata);
|
|
18129
|
+
console.debug("save item 2", _this14.item, jsondata);
|
|
18125
18130
|
if (!_this14.item.id) {
|
|
18126
|
-
_context3.next =
|
|
18131
|
+
_context3.next = 10;
|
|
18127
18132
|
break;
|
|
18128
18133
|
}
|
|
18129
|
-
_context3.next =
|
|
18134
|
+
_context3.next = 7;
|
|
18130
18135
|
return _this14.model.api().put('/' + _this14.item.id, jsondata);
|
|
18131
|
-
case
|
|
18136
|
+
case 7:
|
|
18132
18137
|
result = _context3.sent;
|
|
18133
|
-
_context3.next =
|
|
18138
|
+
_context3.next = 13;
|
|
18134
18139
|
break;
|
|
18135
|
-
case
|
|
18136
|
-
_context3.next =
|
|
18140
|
+
case 10:
|
|
18141
|
+
_context3.next = 12;
|
|
18137
18142
|
return _this14.model.api().post('', jsondata);
|
|
18138
|
-
case 11:
|
|
18139
|
-
result = _context3.sent;
|
|
18140
18143
|
case 12:
|
|
18144
|
+
result = _context3.sent;
|
|
18145
|
+
case 13:
|
|
18141
18146
|
result.response.status;
|
|
18142
18147
|
if (!result.response.data.error) {
|
|
18143
|
-
_context3.next =
|
|
18148
|
+
_context3.next = 17;
|
|
18144
18149
|
break;
|
|
18145
18150
|
}
|
|
18146
18151
|
_this14.toastError(result.response.data.error);
|
|
18147
18152
|
return _context3.abrupt("return");
|
|
18148
|
-
case
|
|
18153
|
+
case 17:
|
|
18149
18154
|
result.save();
|
|
18150
18155
|
if (_this14.refreshAfterSave) _this14.refresh();
|
|
18151
18156
|
_this14.toastSuccess("Elemento Modificado");
|
|
18152
|
-
case
|
|
18157
|
+
case 20:
|
|
18153
18158
|
case "end":
|
|
18154
18159
|
return _context3.stop();
|
|
18155
18160
|
}
|
|
@@ -19107,7 +19112,7 @@ var _sfc_render = function render() {
|
|
|
19107
19112
|
on: {
|
|
19108
19113
|
"submit": _vm.saveItem
|
|
19109
19114
|
}
|
|
19110
|
-
}, [_vm._t("form", function () {
|
|
19115
|
+
}, [_vm.item ? _vm._t("form", function () {
|
|
19111
19116
|
return [_c('b-form-group', {
|
|
19112
19117
|
attrs: {
|
|
19113
19118
|
"label": "Nombre:",
|
|
@@ -19129,7 +19134,7 @@ var _sfc_render = function render() {
|
|
|
19129
19134
|
})], 1)];
|
|
19130
19135
|
}, {
|
|
19131
19136
|
"item": _vm.item
|
|
19132
|
-
}), _c('b-button', {
|
|
19137
|
+
}) : _vm._e(), _c('b-button', {
|
|
19133
19138
|
attrs: {
|
|
19134
19139
|
"block": "",
|
|
19135
19140
|
"type": "submit",
|
|
@@ -19140,29 +19145,30 @@ var _sfc_render = function render() {
|
|
|
19140
19145
|
attrs: {
|
|
19141
19146
|
"small": ""
|
|
19142
19147
|
}
|
|
19143
|
-
}) : _vm._e(), _vm._v(_vm._s(_vm.messageSave) + " ")], 1)], 2)] : _vm._e(), !_vm.validate ? [_vm._t("form", function () {
|
|
19144
|
-
return
|
|
19145
|
-
|
|
19146
|
-
|
|
19147
|
-
|
|
19148
|
-
|
|
19149
|
-
|
|
19150
|
-
|
|
19151
|
-
|
|
19152
|
-
|
|
19153
|
-
|
|
19154
|
-
},
|
|
19155
|
-
model: {
|
|
19156
|
-
value: _vm.item.title,
|
|
19157
|
-
callback: function callback($$v) {
|
|
19158
|
-
_vm.$set(_vm.item, "title", $$v);
|
|
19148
|
+
}) : _vm._e(), _vm._v(_vm._s(_vm.messageSave) + " ")], 1)], 2)] : _vm._e(), !_vm.validate ? [_vm.item ? _vm._t("form", function () {
|
|
19149
|
+
return _vm._l(_vm.item, function (value, key) {
|
|
19150
|
+
return _c('b-form-group', {
|
|
19151
|
+
key: key,
|
|
19152
|
+
attrs: {
|
|
19153
|
+
"label": key
|
|
19154
|
+
}
|
|
19155
|
+
}, [_c('b-form-input', {
|
|
19156
|
+
attrs: {
|
|
19157
|
+
"type": "text",
|
|
19158
|
+
"required": ""
|
|
19159
19159
|
},
|
|
19160
|
-
|
|
19161
|
-
|
|
19162
|
-
|
|
19160
|
+
model: {
|
|
19161
|
+
value: _vm.item[key],
|
|
19162
|
+
callback: function callback($$v) {
|
|
19163
|
+
_vm.$set(_vm.item, key, $$v);
|
|
19164
|
+
},
|
|
19165
|
+
expression: "item[key]"
|
|
19166
|
+
}
|
|
19167
|
+
})], 1);
|
|
19168
|
+
});
|
|
19163
19169
|
}, {
|
|
19164
19170
|
"item": _vm.item
|
|
19165
|
-
}), _c('b-button', {
|
|
19171
|
+
}) : _vm._e(), _c('b-button', {
|
|
19166
19172
|
attrs: {
|
|
19167
19173
|
"block": "",
|
|
19168
19174
|
"type": "submit",
|
|
@@ -19186,16 +19192,27 @@ var _sfc_render = function render() {
|
|
|
19186
19192
|
"title": _vm.title,
|
|
19187
19193
|
"no-close-on-backdrop": ""
|
|
19188
19194
|
}
|
|
19189
|
-
}, [_vm._t("show", function () {
|
|
19190
|
-
return [_c('
|
|
19191
|
-
|
|
19192
|
-
|
|
19195
|
+
}, [_vm.item ? _vm._t("show", function () {
|
|
19196
|
+
return [_c('b-list-group', _vm._l(_vm.item, function (value, key) {
|
|
19197
|
+
return _c('b-list-group-item', {
|
|
19198
|
+
key: key
|
|
19199
|
+
}, [_c('b-row', [_c('b-col', {
|
|
19200
|
+
staticClass: "font-weight-bold",
|
|
19201
|
+
attrs: {
|
|
19202
|
+
"cols": "4"
|
|
19203
|
+
}
|
|
19204
|
+
}, [_vm._v(_vm._s(key))]), _c('b-col', {
|
|
19205
|
+
attrs: {
|
|
19206
|
+
"cols": "8"
|
|
19207
|
+
}
|
|
19208
|
+
}, [_vm._v(_vm._s(JSON.stringify(value)))])], 1)], 1);
|
|
19209
|
+
}), 1)];
|
|
19193
19210
|
}, {
|
|
19194
19211
|
"item": _vm.item
|
|
19195
|
-
})], 2)], 1);
|
|
19212
|
+
}) : _vm._e()], 2)], 1);
|
|
19196
19213
|
};
|
|
19197
19214
|
var _sfc_staticRenderFns = [];
|
|
19198
|
-
var __component__ = /*#__PURE__*/normalizeComponent(_sfc_main, _sfc_render, _sfc_staticRenderFns, false, null, "
|
|
19215
|
+
var __component__ = /*#__PURE__*/normalizeComponent(_sfc_main, _sfc_render, _sfc_staticRenderFns, false, null, "818372ed", null, null);
|
|
19199
19216
|
var component$1 = __component__.exports;// Import vue component
|
|
19200
19217
|
|
|
19201
19218
|
// Default export is installable instance of component.
|
package/package.json
CHANGED
package/src/vue-laravel-crud.vue
CHANGED
|
@@ -10,14 +10,13 @@ export default /*#__PURE__*/ {
|
|
|
10
10
|
},
|
|
11
11
|
data() {
|
|
12
12
|
return {
|
|
13
|
-
|
|
14
|
-
forceRecomputeCounter: 0,
|
|
15
|
-
filtersVisible: false,
|
|
13
|
+
moment: moment,
|
|
16
14
|
loading: false,
|
|
15
|
+
item: {
|
|
16
|
+
id: null,
|
|
17
|
+
},
|
|
17
18
|
items: [],
|
|
18
19
|
selectedItems: [],
|
|
19
|
-
moment: moment,
|
|
20
|
-
displaySearch: false,
|
|
21
20
|
pagination: {
|
|
22
21
|
current_page: 1,
|
|
23
22
|
last_page: 1,
|
|
@@ -26,12 +25,14 @@ export default /*#__PURE__*/ {
|
|
|
26
25
|
per_page: 20,
|
|
27
26
|
total: 0,
|
|
28
27
|
},
|
|
28
|
+
displaySearch: false,
|
|
29
29
|
itemDefault: null,
|
|
30
30
|
filters: [],
|
|
31
|
+
filtersVisible: false,
|
|
32
|
+
filterSidebarOpen: false,
|
|
31
33
|
internalFilters: [],
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
},
|
|
34
|
+
forceRecomputeCounter: 0,
|
|
35
|
+
|
|
35
36
|
displayModes: {
|
|
36
37
|
MODE_TABLE: 1,
|
|
37
38
|
MODE_CARDS: 2,
|
|
@@ -489,7 +490,11 @@ export default /*#__PURE__*/ {
|
|
|
489
490
|
this.$bvModal.show("modal-show-item-" + this.modelName);
|
|
490
491
|
},
|
|
491
492
|
createItem() {
|
|
492
|
-
|
|
493
|
+
if (this.useVuexORM) {
|
|
494
|
+
this.item = new this.model();
|
|
495
|
+
} else {
|
|
496
|
+
this.item = JSON.parse(JSON.stringify(this.itemDefault));
|
|
497
|
+
}
|
|
493
498
|
this.onSelect();
|
|
494
499
|
this.$bvModal.show("modal-form-item-" + this.modelName);
|
|
495
500
|
},
|
|
@@ -645,7 +650,7 @@ export default /*#__PURE__*/ {
|
|
|
645
650
|
delete: 1
|
|
646
651
|
});
|
|
647
652
|
|
|
648
|
-
console.debug("delete item vuex",result);
|
|
653
|
+
console.debug("delete item vuex", result);
|
|
649
654
|
let responseStatus = result.response.status;
|
|
650
655
|
|
|
651
656
|
if (result.response.data.error) {
|
|
@@ -714,10 +719,13 @@ export default /*#__PURE__*/ {
|
|
|
714
719
|
return ops.join(", ");
|
|
715
720
|
},
|
|
716
721
|
async saveItemVuex(event = null) {
|
|
722
|
+
|
|
723
|
+
console.debug("save item 1", this.item);
|
|
724
|
+
|
|
717
725
|
let jsondata = this.item.$toJson();
|
|
718
726
|
|
|
719
727
|
|
|
720
|
-
console.debug("save item ", this.item, jsondata);
|
|
728
|
+
console.debug("save item 2", this.item, jsondata);
|
|
721
729
|
let result;
|
|
722
730
|
|
|
723
731
|
if (this.item.id) {
|
|
@@ -1308,7 +1316,7 @@ export default /*#__PURE__*/ {
|
|
|
1308
1316
|
<b-overlay :show="loading" rounded="sm">
|
|
1309
1317
|
<template v-if="validate">
|
|
1310
1318
|
<form @submit="saveItem">
|
|
1311
|
-
<slot name="form" v-bind:item="item">
|
|
1319
|
+
<slot name="form" v-bind:item="item" v-if="item">
|
|
1312
1320
|
<b-form-group label="Nombre:" description="Nombre ">
|
|
1313
1321
|
<b-form-input v-model="item.title" type="text" required placeholder="Nombre"></b-form-input>
|
|
1314
1322
|
</b-form-group>
|
|
@@ -1319,9 +1327,9 @@ export default /*#__PURE__*/ {
|
|
|
1319
1327
|
</form>
|
|
1320
1328
|
</template>
|
|
1321
1329
|
<template v-if="!validate">
|
|
1322
|
-
<slot name="form" v-bind:item="item">
|
|
1323
|
-
<b-form-group label="
|
|
1324
|
-
<b-form-input v-model="item
|
|
1330
|
+
<slot name="form" v-bind:item="item" v-if="item">
|
|
1331
|
+
<b-form-group :label="key" v-for="(value, key) in item" :key="key">
|
|
1332
|
+
<b-form-input v-model="item[key]" type="text" required ></b-form-input>
|
|
1325
1333
|
</b-form-group>
|
|
1326
1334
|
</slot>
|
|
1327
1335
|
<b-button block type="submit" variant="success" :disabled="loading" @click="saveItem()">
|
|
@@ -1331,8 +1339,15 @@ export default /*#__PURE__*/ {
|
|
|
1331
1339
|
</b-overlay>
|
|
1332
1340
|
</b-modal>
|
|
1333
1341
|
<b-modal :id="'modal-show-item-' + modelName" hide-footer size="xl" :title="title" no-close-on-backdrop>
|
|
1334
|
-
<slot name="show" v-bind:item="item">
|
|
1335
|
-
<
|
|
1342
|
+
<slot name="show" v-bind:item="item" v-if="item">
|
|
1343
|
+
<b-list-group>
|
|
1344
|
+
<b-list-group-item v-for="(value, key) in item" :key="key">
|
|
1345
|
+
<b-row>
|
|
1346
|
+
<b-col cols="4" class="font-weight-bold">{{ key }}</b-col>
|
|
1347
|
+
<b-col cols="8">{{ JSON.stringify(value) }}</b-col>
|
|
1348
|
+
</b-row>
|
|
1349
|
+
</b-list-group-item>
|
|
1350
|
+
</b-list-group>
|
|
1336
1351
|
</slot>
|
|
1337
1352
|
</b-modal>
|
|
1338
1353
|
</div>
|