vue-laravel-crud 1.5.4 → 1.5.6
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 +45 -19
- package/dist/vue-laravel-crud.min.js +4 -4
- package/dist/vue-laravel-crud.ssr.js +226 -126
- package/package.json +1 -1
- package/src/vue-laravel-crud.vue +313 -272
|
@@ -11878,7 +11878,7 @@ var InfiniteLoading = /*@__PURE__*/getDefaultExportFromCjs(vueInfiniteLoadingExp
|
|
|
11878
11878
|
|
|
11879
11879
|
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}}
|
|
11880
11880
|
|
|
11881
|
-
var css = "tr td[data-v-
|
|
11881
|
+
var css = "tr td[data-v-72049f4e]:last-child,\ntr td[data-v-72049f4e]:first-child {\n width: 1%;\n white-space: nowrap; }\n\n.crud-pagination[data-v-72049f4e] {\n display: flex;\n justify-content: center; }\n\n.crud-header[data-v-72049f4e] {\n display: flex;\n justify-content: space-between;\n max-height: 3rem; }\n .crud-header[data-v-72049f4e] .crud-title[data-v-72049f4e] {\n margin: 0; }\n .crud-header[data-v-72049f4e] .crud-search[data-v-72049f4e] {\n max-width: 15rem; }\n .crud-header[data-v-72049f4e] .crud-search[data-v-72049f4e] .btn[data-v-72049f4e] {\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-72049f4e] .crud-search[data-v-72049f4e] .btn[data-v-72049f4e].open[data-v-72049f4e] {\n border-top-right-radius: 0;\n border-bottom-right-radius: 0; }\n .crud-header[data-v-72049f4e] .table-options[data-v-72049f4e] {\n margin-bottom: 1rem;\n display: flex;\n align-items: center;\n justify-content: flex-end; }\n\n.custom-control[data-v-72049f4e] {\n position: relative;\n top: -15px; }\n\n@media (min-width: 992px) {\n .table[data-v-72049f4e] {\n table-layout: auto; }\n .table[data-v-72049f4e] tbody[data-v-72049f4e] td[data-v-72049f4e] {\n overflow: scroll;\n -ms-overflow-style: none;\n /* IE and Edge */\n scrollbar-width: none;\n /* Firefox */ }\n .table[data-v-72049f4e] tbody[data-v-72049f4e] td[data-v-72049f4e]::-webkit-scrollbar {\n display: none; } }\n";
|
|
11882
11882
|
n(css, {});
|
|
11883
11883
|
|
|
11884
11884
|
function normalizeComponent (
|
|
@@ -12010,7 +12010,8 @@ const _sfc_main = {
|
|
|
12010
12010
|
MODE_CARDS: 2,
|
|
12011
12011
|
MODE_CUSTOM: 3
|
|
12012
12012
|
},
|
|
12013
|
-
infiniteScrollKey: 1
|
|
12013
|
+
infiniteScrollKey: 1,
|
|
12014
|
+
optionsLoaded: false
|
|
12014
12015
|
};
|
|
12015
12016
|
},
|
|
12016
12017
|
watch: {
|
|
@@ -12322,6 +12323,7 @@ const _sfc_main = {
|
|
|
12322
12323
|
this.items = this.models;
|
|
12323
12324
|
this.pagination.total = this.items.length;
|
|
12324
12325
|
}
|
|
12326
|
+
this.loadOptions();
|
|
12325
12327
|
},
|
|
12326
12328
|
computed: {
|
|
12327
12329
|
itemValue() {
|
|
@@ -12357,6 +12359,9 @@ const _sfc_main = {
|
|
|
12357
12359
|
return prop => {
|
|
12358
12360
|
return this.internalFilters.find(inf => inf.column == prop);
|
|
12359
12361
|
};
|
|
12362
|
+
},
|
|
12363
|
+
columnOptions() {
|
|
12364
|
+
return column => {};
|
|
12360
12365
|
}
|
|
12361
12366
|
},
|
|
12362
12367
|
methods: {
|
|
@@ -12739,6 +12744,9 @@ const _sfc_main = {
|
|
|
12739
12744
|
order: v[this.orderProp]
|
|
12740
12745
|
});
|
|
12741
12746
|
});
|
|
12747
|
+
if (!this.ajax) {
|
|
12748
|
+
return;
|
|
12749
|
+
}
|
|
12742
12750
|
axios.post(this.apiUrl + "/" + this.modelName + "/sort", {
|
|
12743
12751
|
order: order
|
|
12744
12752
|
}).then(response => {
|
|
@@ -12754,16 +12762,23 @@ const _sfc_main = {
|
|
|
12754
12762
|
}
|
|
12755
12763
|
},
|
|
12756
12764
|
getArrayValue(value, displayProp) {
|
|
12765
|
+
let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
12757
12766
|
if (!Array.isArray(value)) return "N/A";
|
|
12767
|
+
let values = [];
|
|
12768
|
+
let valuesFinal = [];
|
|
12758
12769
|
if (value.length > 0) {
|
|
12759
12770
|
if (typeof value[0] === "object" && displayProp) {
|
|
12760
|
-
|
|
12771
|
+
values = value.map(vv => vv[displayProp]);
|
|
12761
12772
|
} else {
|
|
12762
|
-
|
|
12773
|
+
values = value.join(",");
|
|
12763
12774
|
}
|
|
12764
12775
|
} else {
|
|
12765
12776
|
return "";
|
|
12766
12777
|
}
|
|
12778
|
+
values.forEach(val => {
|
|
12779
|
+
valuesFinal.push(this.getStateValue(val, options));
|
|
12780
|
+
});
|
|
12781
|
+
return values.join(",");
|
|
12767
12782
|
},
|
|
12768
12783
|
getStateValue(value, options) {
|
|
12769
12784
|
if (!options) {
|
|
@@ -12834,6 +12849,21 @@ const _sfc_main = {
|
|
|
12834
12849
|
this.toastSuccess("Elemento Modificado");
|
|
12835
12850
|
this.loading = false;
|
|
12836
12851
|
},
|
|
12852
|
+
async loadOptions() {
|
|
12853
|
+
for (let i = 0; i < this.columns.length; i++) {
|
|
12854
|
+
const column = this.columns[i];
|
|
12855
|
+
if (column.options instanceof Promise) {
|
|
12856
|
+
// Si las opciones son una función (promesa), esperar y actualizar
|
|
12857
|
+
const options = await column.options;
|
|
12858
|
+
this.$set(this.columns, i, {
|
|
12859
|
+
...column,
|
|
12860
|
+
options
|
|
12861
|
+
});
|
|
12862
|
+
console.debug("Options promise", this.columns);
|
|
12863
|
+
}
|
|
12864
|
+
}
|
|
12865
|
+
this.optionsLoaded = true;
|
|
12866
|
+
},
|
|
12837
12867
|
async saveItem() {
|
|
12838
12868
|
let event = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
12839
12869
|
this.loading = true;
|
|
@@ -13118,9 +13148,7 @@ var _sfc_render = function render() {
|
|
|
13118
13148
|
}
|
|
13119
13149
|
})], 1)])]) : column.type == 'state' ? _c('div', {
|
|
13120
13150
|
staticClass: "form-group"
|
|
13121
|
-
}, [_c('label', [_vm._v(_vm._s(column.label))]), _c('
|
|
13122
|
-
staticClass: "d-none"
|
|
13123
|
-
}, [_vm._v(_vm._s(column.options))]), _c('select', {
|
|
13151
|
+
}, [_c('label', [_vm._v(_vm._s(column.label))]), _vm.optionsLoaded ? _c('select', {
|
|
13124
13152
|
directives: [{
|
|
13125
13153
|
name: "model",
|
|
13126
13154
|
rawName: "v-model",
|
|
@@ -13152,11 +13180,9 @@ var _sfc_render = function render() {
|
|
|
13152
13180
|
"value": option.id ? option.id : option.value
|
|
13153
13181
|
}
|
|
13154
13182
|
}, [_vm._v(" " + _vm._s(option.text ? option.text : option.label ? option.label : "") + " ")]);
|
|
13155
|
-
})], 2)]) : column.type == 'array' ? _c('div', {
|
|
13183
|
+
})], 2) : _vm._e()]) : column.type == 'array' ? _c('div', {
|
|
13156
13184
|
staticClass: "form-group"
|
|
13157
|
-
}, [_c('label', [_vm._v(_vm._s(column.label))]), _c('
|
|
13158
|
-
staticClass: "d-none"
|
|
13159
|
-
}, [_vm._v(_vm._s(column.options))]), _c('select', {
|
|
13185
|
+
}, [_c('label', [_vm._v(_vm._s(column.label))]), _vm.optionsLoaded ? _c('select', {
|
|
13160
13186
|
directives: [{
|
|
13161
13187
|
name: "model",
|
|
13162
13188
|
rawName: "v-model",
|
|
@@ -13188,7 +13214,7 @@ var _sfc_render = function render() {
|
|
|
13188
13214
|
"value": option.id ? option.id : option.value
|
|
13189
13215
|
}
|
|
13190
13216
|
}, [_vm._v(" " + _vm._s(option.text ? option.text : option.label ? option.label : "") + " ")]);
|
|
13191
|
-
}) : _vm._e()], 2)]) : _c('div', {
|
|
13217
|
+
}) : _vm._e()], 2) : _vm._e()]) : _c('div', {
|
|
13192
13218
|
staticClass: "form-group"
|
|
13193
13219
|
}, [_c('label', [_vm._v(_vm._s(column.label))]), _c('input', {
|
|
13194
13220
|
directives: [{
|
|
@@ -13384,7 +13410,7 @@ var _sfc_render = function render() {
|
|
|
13384
13410
|
callback: function ($$v) {
|
|
13385
13411
|
_vm.$set(_vm.internalFilterByProp(column.prop + '_from'), "value", $$v);
|
|
13386
13412
|
},
|
|
13387
|
-
expression: "internalFilterByProp(column.prop + '_from').value\n
|
|
13413
|
+
expression: "internalFilterByProp(column.prop + '_from').value\n "
|
|
13388
13414
|
}
|
|
13389
13415
|
})], 1), _c('div', {
|
|
13390
13416
|
staticClass: "col-6"
|
|
@@ -13401,9 +13427,9 @@ var _sfc_render = function render() {
|
|
|
13401
13427
|
callback: function ($$v) {
|
|
13402
13428
|
_vm.$set(_vm.internalFilterByProp(column.prop + '_to'), "value", $$v);
|
|
13403
13429
|
},
|
|
13404
|
-
expression: "internalFilterByProp(column.prop + '_to').value\n
|
|
13430
|
+
expression: "internalFilterByProp(column.prop + '_to').value\n "
|
|
13405
13431
|
}
|
|
13406
|
-
})], 1)]) : column.type == 'state' ? _c('select', {
|
|
13432
|
+
})], 1)]) : column.type == 'state' && _vm.optionsLoaded ? _c('select', {
|
|
13407
13433
|
directives: [{
|
|
13408
13434
|
name: "model",
|
|
13409
13435
|
rawName: "v-model",
|
|
@@ -13438,7 +13464,7 @@ var _sfc_render = function render() {
|
|
|
13438
13464
|
"value": option.id
|
|
13439
13465
|
}
|
|
13440
13466
|
}, [_vm._v(" " + _vm._s(option.text ? option.text : option.label ? option.label : "") + " ")]);
|
|
13441
|
-
})], 2) : column.type == 'array' ? _c('select', {
|
|
13467
|
+
})], 2) : column.type == 'array' && _vm.optionsLoaded ? _c('select', {
|
|
13442
13468
|
directives: [{
|
|
13443
13469
|
name: "model",
|
|
13444
13470
|
rawName: "v-model",
|
|
@@ -13595,7 +13621,7 @@ var _sfc_render = function render() {
|
|
|
13595
13621
|
},
|
|
13596
13622
|
expression: "item.selected"
|
|
13597
13623
|
}
|
|
13598
|
-
})], 1) : column.type == 'state' ? _c('span', [_vm._v(" " + _vm._s(_vm.getStateValue(_vm.itemValue(column, item), column.options)) + " ")]) : column.type == 'array' ? _c('span', [_vm._v(" " + _vm._s(_vm.getArrayValue(_vm.itemValue(column, item), column.displayProp)) + " ")]) : _c('span', [_vm._v(" " + _vm._s(_vm.itemValue(column, item)) + " ")])];
|
|
13624
|
+
})], 1) : column.type == 'state' && _vm.optionsLoaded ? _c('span', [_vm._v(" " + _vm._s(_vm.getStateValue(_vm.itemValue(column, item), column.options)) + " ")]) : column.type == 'array' && _vm.optionsLoaded ? _c('span', [_vm._v(" " + _vm._s(_vm.getArrayValue(_vm.itemValue(column, item), column.displayProp, column.options)) + " ")]) : _c('span', [_vm._v(" " + _vm._s(_vm.itemValue(column, item)) + " ")])];
|
|
13599
13625
|
}, {
|
|
13600
13626
|
"item": item,
|
|
13601
13627
|
"index": index,
|
|
@@ -13748,7 +13774,7 @@ var _sfc_render = function render() {
|
|
|
13748
13774
|
attrs: {
|
|
13749
13775
|
"variant": "danger"
|
|
13750
13776
|
}
|
|
13751
|
-
}, [_c('b-icon-x-circle')], 1) : _vm._e()], 1) : column.type == 'date' ? _c('span', [_vm._v(" " + _vm._s(_vm.itemValue(column, item)) + " ")]) : column.type == 'state' ? _c('span', [_vm._v(" " + _vm._s(_vm.getStateValue(_vm.itemValue(column, item), column.options)) + " ")]) : column.type == 'array' ? _c('span', [_vm._v(" " + _vm._s(_vm.getArrayValue(_vm.itemValue(column, item), column.displayProp)) + " ")]) : _c('span', [_vm._v(" " + _vm._s(_vm.itemValue(column, item)) + " ")])];
|
|
13777
|
+
}, [_c('b-icon-x-circle')], 1) : _vm._e()], 1) : column.type == 'date' ? _c('span', [_vm._v(" " + _vm._s(_vm.itemValue(column, item)) + " ")]) : column.type == 'state' ? _c('span', [_vm._v(" " + _vm._s(_vm.getStateValue(_vm.itemValue(column, item), column.options)) + " ")]) : column.type == 'array' ? _c('span', [_vm._v(" " + _vm._s(_vm.getArrayValue(_vm.itemValue(column, item), column.displayProp, column.options)) + " ")]) : _c('span', [_vm._v(" " + _vm._s(_vm.itemValue(column, item)) + " ")])];
|
|
13752
13778
|
}, {
|
|
13753
13779
|
"item": item,
|
|
13754
13780
|
"index": index,
|
|
@@ -13943,7 +13969,7 @@ var _sfc_render = function render() {
|
|
|
13943
13969
|
}) : _vm._e()], 2)], 1);
|
|
13944
13970
|
};
|
|
13945
13971
|
var _sfc_staticRenderFns = [];
|
|
13946
|
-
var __component__ = /*#__PURE__*/normalizeComponent(_sfc_main, _sfc_render, _sfc_staticRenderFns, false, null, "
|
|
13972
|
+
var __component__ = /*#__PURE__*/normalizeComponent(_sfc_main, _sfc_render, _sfc_staticRenderFns, false, null, "72049f4e", null, null);
|
|
13947
13973
|
var component = __component__.exports;
|
|
13948
13974
|
|
|
13949
13975
|
// Import vue component
|