vue-laravel-crud 1.8.0 → 1.8.2
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 -31
- package/dist/vue-laravel-crud.min.js +2 -2
- package/dist/vue-laravel-crud.ssr.js +61 -31
- package/package.json +1 -1
- package/src/vue-laravel-crud.vue +152 -104
|
@@ -12724,7 +12724,7 @@ var _sfc_render$1 = function render() {
|
|
|
12724
12724
|
};
|
|
12725
12725
|
var _sfc_staticRenderFns$1 = [];
|
|
12726
12726
|
var __component__$1 = /*#__PURE__*/normalizeComponent(_sfc_main$1, _sfc_render$1, _sfc_staticRenderFns$1, false, null, null, null, null);
|
|
12727
|
-
var ItemCard = __component__$1.exports;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-
|
|
12727
|
+
var ItemCard = __component__$1.exports;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-5b1677f8]:last-child,\ntr td[data-v-5b1677f8]:first-child {\n width: 1%;\n white-space: nowrap; }\n\n.crud-pagination[data-v-5b1677f8] {\n display: flex;\n align-items: center;\n width: 100%;\n justify-content: center;\n margin-top: 1rem; }\n\n.crud-header[data-v-5b1677f8] {\n display: flex;\n justify-content: space-between;\n max-height: 3rem; }\n .crud-header[data-v-5b1677f8] .crud-title[data-v-5b1677f8] {\n margin: 0; }\n .crud-header[data-v-5b1677f8] .crud-search[data-v-5b1677f8] {\n max-width: 15rem; }\n .crud-header[data-v-5b1677f8] .crud-search[data-v-5b1677f8] .btn[data-v-5b1677f8] {\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-5b1677f8] .crud-search[data-v-5b1677f8] .btn[data-v-5b1677f8].open[data-v-5b1677f8] {\n border-top-right-radius: 0;\n border-bottom-right-radius: 0; }\n .crud-header[data-v-5b1677f8] .table-options[data-v-5b1677f8] {\n margin-bottom: 1rem;\n display: flex;\n align-items: center;\n justify-content: flex-end; }\n\n.custom-control[data-v-5b1677f8] {\n position: relative; }\n\n@media (min-width: 992px) {\n .table[data-v-5b1677f8] {\n table-layout: auto; }\n .table[data-v-5b1677f8] tbody[data-v-5b1677f8] td[data-v-5b1677f8] {\n overflow: scroll;\n -ms-overflow-style: none;\n /* IE and Edge */\n scrollbar-width: none;\n /* Firefox */ }\n .table[data-v-5b1677f8] tbody[data-v-5b1677f8] td[data-v-5b1677f8]::-webkit-scrollbar {\n display: none; } }\n\n.kanban-board[data-v-5b1677f8] {\n display: flex;\n gap: 1rem;\n overflow-x: auto;\n padding: 1rem; }\n\n.kanban-column[data-v-5b1677f8] {\n background: #f4f5f7;\n border-radius: 8px;\n width: 300px;\n display: flex;\n flex-direction: column;\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); }\n\n.kanban-column-header[data-v-5b1677f8] {\n font-weight: bold;\n padding: 0.5rem;\n background: #dfe1e6;\n border-radius: 8px 8px 0 0;\n text-align: center; }\n\n.kanban-column-body[data-v-5b1677f8] {\n padding: 0.5rem;\n min-height: 100px;\n background: #ffffff;\n border-radius: 0 0 8px 8px;\n display: flex;\n flex-direction: column;\n gap: 0.5rem; }\n\n.kanban-card[data-v-5b1677f8] {\n background: #ffffff;\n border-radius: 4px;\n padding: 1rem;\n box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);\n cursor: grab; }\n";
|
|
12728
12728
|
n(css, {});var _sfc_main = {
|
|
12729
12729
|
name: "VueLaravelCrud",
|
|
12730
12730
|
components: {
|
|
@@ -13181,7 +13181,7 @@ n(css, {});var _sfc_main = {
|
|
|
13181
13181
|
return this.paginationIndexStart + this.pagination.per_page;
|
|
13182
13182
|
},
|
|
13183
13183
|
finalFilters: function finalFilters() {
|
|
13184
|
-
return [].concat(_toConsumableArray$1(this.filters), _toConsumableArray$1(this.filter), _toConsumableArray$1(this.internalFilter), _toConsumableArray$1(this.sortFilter));
|
|
13184
|
+
return [].concat(_toConsumableArray$1(this.filters), _toConsumableArray$1(this.filter), _toConsumableArray$1(this.internalFilter), _toConsumableArray$1(this.sortFilter), _toConsumableArray$1(this.groupFilter));
|
|
13185
13185
|
},
|
|
13186
13186
|
sortFilter: function sortFilter() {
|
|
13187
13187
|
if (this.showPrincipalSortBtn) {
|
|
@@ -13194,6 +13194,13 @@ n(css, {});var _sfc_main = {
|
|
|
13194
13194
|
return [];
|
|
13195
13195
|
}
|
|
13196
13196
|
},
|
|
13197
|
+
groupFilter: function groupFilter() {
|
|
13198
|
+
if (this.grouped && this.groupedAttribute) {
|
|
13199
|
+
return [['', 'GROUPBY', this.groupedAttribute]];
|
|
13200
|
+
} else {
|
|
13201
|
+
return [];
|
|
13202
|
+
}
|
|
13203
|
+
},
|
|
13197
13204
|
internalFilter: function internalFilter() {
|
|
13198
13205
|
var filter = [];
|
|
13199
13206
|
this.forceRecomputeCounter;
|
|
@@ -13600,7 +13607,8 @@ n(css, {});var _sfc_main = {
|
|
|
13600
13607
|
_this12.makePagination(response.data);
|
|
13601
13608
|
var items = response.data.data;
|
|
13602
13609
|
if (_this12.grouped) {
|
|
13603
|
-
_this12.
|
|
13610
|
+
_this12.items = items;
|
|
13611
|
+
// this.groupItems(items, concat);
|
|
13604
13612
|
} else {
|
|
13605
13613
|
if (concat) {
|
|
13606
13614
|
_this12.items = _this12.items.concat(items);
|
|
@@ -14719,7 +14727,7 @@ var _sfc_render = function render() {
|
|
|
14719
14727
|
return _vm.toggleDisplayMode();
|
|
14720
14728
|
}
|
|
14721
14729
|
}
|
|
14722
|
-
}, [_vm.displayMode == _vm.displayModes.MODE_TABLE ? _c('b-icon-card-list') : _vm.
|
|
14730
|
+
}, [_vm.displayMode == _vm.displayModes.MODE_TABLE ? _c('b-icon-card-list') : _vm.displayMode == _vm.displayModes.MODE_CARDS ? _c('b-icon-table') : _vm._e()], 1) : _vm._e(), _vm.showSearch ? _c('div', {
|
|
14723
14731
|
staticClass: "crud-search m-0"
|
|
14724
14732
|
}, [_c('b-input-group', [_c('b-input-group-prepend', [_c('b-button', {
|
|
14725
14733
|
class: {
|
|
@@ -15101,7 +15109,7 @@ var _sfc_render = function render() {
|
|
|
15101
15109
|
})], 2);
|
|
15102
15110
|
}), 0)], 1), !_vm.loading && _vm.items && _vm.items.length == 0 && !_vm.infiniteScroll ? _c('p', {
|
|
15103
15111
|
staticClass: "p-3"
|
|
15104
|
-
}, [_vm._v(" " + _vm._s(_vm.messageEmptyResults) + " ")]) : _vm._e()]) : _vm.
|
|
15112
|
+
}, [_vm._v(" " + _vm._s(_vm.messageEmptyResults) + " ")]) : _vm._e()]) : _vm.displayMode == _vm.displayModes.MODE_CARDS ? _c('div', [_c('draggable', {
|
|
15105
15113
|
attrs: {
|
|
15106
15114
|
"group": _vm.draggableGroup,
|
|
15107
15115
|
"draggable": _vm.orderable ? '.item' : '.none',
|
|
@@ -15174,33 +15182,55 @@ var _sfc_render = function render() {
|
|
|
15174
15182
|
})], 2);
|
|
15175
15183
|
}), 0)], 1), !_vm.loading && _vm.items && _vm.items.length == 0 && !_vm.infiniteScroll ? _c('p', {
|
|
15176
15184
|
staticClass: "p-3"
|
|
15177
|
-
}, [_vm._v(" " + _vm._s(_vm.messageEmptyResults) + " ")]) : _vm._e()], 1) : _vm.
|
|
15185
|
+
}, [_vm._v(" " + _vm._s(_vm.messageEmptyResults) + " ")]) : _vm._e()], 1) : _vm.displayMode == _vm.displayModes.MODE_KANBAN ? _c('div', [_vm._v(" " + _vm._s(JSON.stringify(_vm.items)) + " "), _vm._l(_vm.items, function (column, colIndex) {
|
|
15178
15186
|
return _c('div', {
|
|
15179
|
-
key:
|
|
15180
|
-
staticClass: "
|
|
15181
|
-
}, [
|
|
15182
|
-
|
|
15183
|
-
|
|
15184
|
-
|
|
15185
|
-
|
|
15186
|
-
|
|
15187
|
-
|
|
15188
|
-
|
|
15189
|
-
|
|
15190
|
-
|
|
15191
|
-
|
|
15192
|
-
|
|
15193
|
-
|
|
15194
|
-
|
|
15195
|
-
|
|
15196
|
-
|
|
15197
|
-
|
|
15187
|
+
key: colIndex,
|
|
15188
|
+
staticClass: "kanban-column"
|
|
15189
|
+
}, [_c('div', {
|
|
15190
|
+
staticClass: "kanban-column-header"
|
|
15191
|
+
}, [_vm._v(" " + _vm._s(colIndex) + " ")]), _vm._v(" " + _vm._s(JSON.stringify(column)) + " "), _c('draggable', {
|
|
15192
|
+
staticClass: "kanban-column-body",
|
|
15193
|
+
attrs: {
|
|
15194
|
+
"group": "kanban"
|
|
15195
|
+
},
|
|
15196
|
+
on: {
|
|
15197
|
+
"end": _vm.onDragEnd
|
|
15198
|
+
},
|
|
15199
|
+
model: {
|
|
15200
|
+
value: column.items,
|
|
15201
|
+
callback: function callback($$v) {
|
|
15202
|
+
_vm.$set(column, "items", $$v);
|
|
15203
|
+
},
|
|
15204
|
+
expression: "column.items"
|
|
15205
|
+
}
|
|
15206
|
+
}, _vm._l(_vm.itemsList, function (item, index) {
|
|
15207
|
+
return _c('div', {
|
|
15208
|
+
key: index,
|
|
15209
|
+
staticClass: "item"
|
|
15210
|
+
}, [_vm._t("card", function () {
|
|
15211
|
+
return _vm._l(_vm.itemsList, function (item, index) {
|
|
15212
|
+
return _c('ItemCard', {
|
|
15213
|
+
key: index,
|
|
15214
|
+
attrs: {
|
|
15215
|
+
"item": item,
|
|
15216
|
+
"columns": _vm.columns,
|
|
15217
|
+
"index": index,
|
|
15218
|
+
"cardClass": _vm.cardClass,
|
|
15219
|
+
"cardHideFooter": _vm.cardHideFooter,
|
|
15220
|
+
"itemValue": _vm.itemValue,
|
|
15221
|
+
"getStateValue": _vm.getStateValue,
|
|
15222
|
+
"getArrayValue": _vm.getArrayValue,
|
|
15223
|
+
"showItem": _vm.showItem,
|
|
15224
|
+
"updateItem": _vm.updateItem,
|
|
15225
|
+
"removeItem": _vm.removeItem
|
|
15226
|
+
}
|
|
15227
|
+
});
|
|
15198
15228
|
});
|
|
15199
|
-
}
|
|
15200
|
-
|
|
15201
|
-
|
|
15202
|
-
})],
|
|
15203
|
-
}),
|
|
15229
|
+
}, {
|
|
15230
|
+
"item": item
|
|
15231
|
+
})], 2);
|
|
15232
|
+
}), 0)], 1);
|
|
15233
|
+
})], 2) : _vm.displayMode == _vm.displayModes.MODE_CUSTOM ? _c('div', [_c('div', {
|
|
15204
15234
|
class: _vm.listContainerClass
|
|
15205
15235
|
}, [!_vm.loading && _vm.items && _vm.items.length == 0 && !_vm.infiniteScroll ? _c('p', {
|
|
15206
15236
|
staticClass: "p-3"
|
|
@@ -15481,7 +15511,7 @@ var _sfc_render = function render() {
|
|
|
15481
15511
|
}) : _vm._e()], 2) : _vm._e()], 1);
|
|
15482
15512
|
};
|
|
15483
15513
|
var _sfc_staticRenderFns = [];
|
|
15484
|
-
var __component__ = /*#__PURE__*/normalizeComponent(_sfc_main, _sfc_render, _sfc_staticRenderFns, false, null, "
|
|
15514
|
+
var __component__ = /*#__PURE__*/normalizeComponent(_sfc_main, _sfc_render, _sfc_staticRenderFns, false, null, "5b1677f8", null, null);
|
|
15485
15515
|
var component$1 = __component__.exports;// Import vue component
|
|
15486
15516
|
|
|
15487
15517
|
// Default export is installable instance of component.
|
package/package.json
CHANGED
package/src/vue-laravel-crud.vue
CHANGED
|
@@ -18,7 +18,7 @@ export default /*#__PURE__*/ {
|
|
|
18
18
|
data() {
|
|
19
19
|
return {
|
|
20
20
|
|
|
21
|
-
crudUuid:"",
|
|
21
|
+
crudUuid: "",
|
|
22
22
|
moment: moment,
|
|
23
23
|
loading: false,
|
|
24
24
|
firstLoad: false,
|
|
@@ -387,7 +387,7 @@ export default /*#__PURE__*/ {
|
|
|
387
387
|
|
|
388
388
|
mounted() {
|
|
389
389
|
const now = Math.floor(Date.now() / 1000);
|
|
390
|
-
this.crudUuid = ''+now;
|
|
390
|
+
this.crudUuid = '' + now;
|
|
391
391
|
this.isMobile = window.matchMedia("(max-width: 1024px)").matches;
|
|
392
392
|
|
|
393
393
|
// Agregar un oyente de eventos para actualizar isMobile cuando cambia el tamaño de la pantalla
|
|
@@ -411,12 +411,12 @@ export default /*#__PURE__*/ {
|
|
|
411
411
|
if (fieldName === primaryKey) {
|
|
412
412
|
continue; // Salta este campo
|
|
413
413
|
}
|
|
414
|
-
|
|
415
|
-
console.debug("debug field",field);
|
|
414
|
+
|
|
415
|
+
console.debug("debug field", field);
|
|
416
416
|
|
|
417
417
|
if (field.type === 'relation') {
|
|
418
418
|
// Si es una relación, inicializa como un objeto vacío.
|
|
419
|
-
console.debug("Relation",field);
|
|
419
|
+
console.debug("Relation", field);
|
|
420
420
|
|
|
421
421
|
if (this.vuexInitRelations == true || (Array.isArray(this.vuexInitRelations) && this.vuexInitRelations.includes(fieldName))) {
|
|
422
422
|
itemDefault[fieldName] = {};
|
|
@@ -425,35 +425,35 @@ export default /*#__PURE__*/ {
|
|
|
425
425
|
} else {
|
|
426
426
|
|
|
427
427
|
|
|
428
|
-
|
|
428
|
+
console.debug("Field", field);
|
|
429
429
|
|
|
430
430
|
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
431
|
+
// Si no tiene un valor por defecto definido, inicializa según su tipo
|
|
432
|
+
/*switch (field.constructor.name) {
|
|
433
|
+
case 'StringField':
|
|
434
|
+
itemDefault[fieldName] = '';
|
|
435
|
+
break;
|
|
436
|
+
case 'NumberField':
|
|
437
|
+
itemDefault[fieldName] = 0;
|
|
438
|
+
break;
|
|
439
|
+
// Agrega más casos según los tipos de campos que uses en tu modelo
|
|
440
|
+
default:
|
|
441
441
|
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
442
|
+
console.debug("Undefined constructor ",fieldName,field.constructor.name);
|
|
443
|
+
// Tipo de campo no reconocido, puedes manejarlo de acuerdo a tus necesidades
|
|
444
|
+
itemDefault[fieldName] = null;
|
|
445
|
+
}*/
|
|
446
446
|
|
|
447
447
|
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
448
|
+
if (typeof field.value === 'function') {
|
|
449
|
+
itemDefault[fieldName] = field.value();
|
|
450
|
+
} else if (field.value) {
|
|
451
|
+
itemDefault[fieldName] = field.value;
|
|
452
|
+
} else {
|
|
453
|
+
itemDefault[fieldName] = null;
|
|
454
|
+
}
|
|
455
|
+
|
|
455
456
|
|
|
456
|
-
|
|
457
457
|
}
|
|
458
458
|
}
|
|
459
459
|
|
|
@@ -506,7 +506,8 @@ export default /*#__PURE__*/ {
|
|
|
506
506
|
...this.filters,
|
|
507
507
|
...this.filter,
|
|
508
508
|
...this.internalFilter,
|
|
509
|
-
...this.sortFilter
|
|
509
|
+
...this.sortFilter,
|
|
510
|
+
...this.groupFilter
|
|
510
511
|
];
|
|
511
512
|
},
|
|
512
513
|
sortFilter() {
|
|
@@ -521,6 +522,15 @@ export default /*#__PURE__*/ {
|
|
|
521
522
|
}
|
|
522
523
|
|
|
523
524
|
},
|
|
525
|
+
|
|
526
|
+
groupFilter() {
|
|
527
|
+
if (this.grouped && this.groupedAttribute) {
|
|
528
|
+
return [['', 'GROUPBY', this.groupedAttribute]];
|
|
529
|
+
} else {
|
|
530
|
+
return [];
|
|
531
|
+
}
|
|
532
|
+
},
|
|
533
|
+
|
|
524
534
|
internalFilter() {
|
|
525
535
|
let filter = [];
|
|
526
536
|
this.forceRecomputeCounter;
|
|
@@ -761,23 +771,23 @@ export default /*#__PURE__*/ {
|
|
|
761
771
|
},
|
|
762
772
|
|
|
763
773
|
updateData(data, allowCreate = true) {
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
774
|
+
// Convertir this.items a un mapa para acceso rápido por id
|
|
775
|
+
const itemsMap = new Map(this.items.map(item => [item.id, item]));
|
|
776
|
+
|
|
777
|
+
// Recorrer cada elemento de data
|
|
778
|
+
data.forEach(newItem => {
|
|
779
|
+
if (itemsMap.has(newItem.id)) {
|
|
780
|
+
// Actualizar el item existente
|
|
781
|
+
const existingItem = itemsMap.get(newItem.id);
|
|
782
|
+
Object.assign(existingItem, newItem);
|
|
783
|
+
} else if (allowCreate) {
|
|
784
|
+
// Agregar el nuevo item si allowCreate es true
|
|
785
|
+
this.items.push(newItem);
|
|
786
|
+
}
|
|
787
|
+
});
|
|
778
788
|
|
|
779
|
-
|
|
780
|
-
|
|
789
|
+
// Convertir el mapa de vuelta a un array, si es necesario
|
|
790
|
+
this.items = Array.from(itemsMap.values());
|
|
781
791
|
},
|
|
782
792
|
showItem(id, itemIndex = null) {
|
|
783
793
|
if (itemIndex == null) {
|
|
@@ -818,7 +828,7 @@ export default /*#__PURE__*/ {
|
|
|
818
828
|
|
|
819
829
|
refresh() {
|
|
820
830
|
this.$emit("refresh", {});
|
|
821
|
-
|
|
831
|
+
|
|
822
832
|
if (this.infiniteScroll) {
|
|
823
833
|
this.pagination.current_page = 1;
|
|
824
834
|
this.infiniteScrollKey++;
|
|
@@ -882,7 +892,7 @@ export default /*#__PURE__*/ {
|
|
|
882
892
|
this.loading = false;
|
|
883
893
|
this.firstLoad = true;
|
|
884
894
|
},
|
|
885
|
-
fetchItemsLocal(){
|
|
895
|
+
fetchItemsLocal() {
|
|
886
896
|
if (this.grouped) {
|
|
887
897
|
this.groupItems(this.models);
|
|
888
898
|
} else {
|
|
@@ -894,8 +904,8 @@ export default /*#__PURE__*/ {
|
|
|
894
904
|
|
|
895
905
|
},
|
|
896
906
|
fetchItems(page = 1, concat = false) {
|
|
897
|
-
|
|
898
|
-
|
|
907
|
+
|
|
908
|
+
|
|
899
909
|
this.$emit("beforeFetch", {});
|
|
900
910
|
if (this.useVuexORM) {
|
|
901
911
|
return this.fetchItemsVuex(page, concat);
|
|
@@ -903,7 +913,7 @@ export default /*#__PURE__*/ {
|
|
|
903
913
|
|
|
904
914
|
|
|
905
915
|
if (!this.ajax) {
|
|
906
|
-
return this.fetchItemsLocal(page,concat);
|
|
916
|
+
return this.fetchItemsLocal(page, concat);
|
|
907
917
|
}
|
|
908
918
|
|
|
909
919
|
this.loading = true;
|
|
@@ -919,7 +929,8 @@ export default /*#__PURE__*/ {
|
|
|
919
929
|
this.makePagination(response.data);
|
|
920
930
|
let items = response.data.data;
|
|
921
931
|
if (this.grouped) {
|
|
922
|
-
this.
|
|
932
|
+
this.items = items;
|
|
933
|
+
// this.groupItems(items, concat);
|
|
923
934
|
} else {
|
|
924
935
|
if (concat) {
|
|
925
936
|
this.items = this.items.concat(items);
|
|
@@ -1058,8 +1069,8 @@ export default /*#__PURE__*/ {
|
|
|
1058
1069
|
await this.model.$delete(ids);
|
|
1059
1070
|
|
|
1060
1071
|
} else {
|
|
1061
|
-
let result = await this.model.api().delete(this.apiUrl + "/" + this.modelName+'/bulk-destroy'
|
|
1062
|
-
params: { ids: ids},
|
|
1072
|
+
let result = await this.model.api().delete(this.apiUrl + "/" + this.modelName + '/bulk-destroy', {
|
|
1073
|
+
params: { ids: ids },
|
|
1063
1074
|
delete: ids
|
|
1064
1075
|
});
|
|
1065
1076
|
|
|
@@ -1072,7 +1083,7 @@ export default /*#__PURE__*/ {
|
|
|
1072
1083
|
return;
|
|
1073
1084
|
}
|
|
1074
1085
|
}
|
|
1075
|
-
|
|
1086
|
+
|
|
1076
1087
|
this.toastSuccess("Elemento eliminados.");
|
|
1077
1088
|
},
|
|
1078
1089
|
deleteItem(id, index) {
|
|
@@ -1132,7 +1143,7 @@ export default /*#__PURE__*/ {
|
|
|
1132
1143
|
await this.model.$delete(id);
|
|
1133
1144
|
|
|
1134
1145
|
} else {
|
|
1135
|
-
let result = await this.model.api().delete(this.apiUrl + "/" + this.modelName+'/' + id, {
|
|
1146
|
+
let result = await this.model.api().delete(this.apiUrl + "/" + this.modelName + '/' + id, {
|
|
1136
1147
|
delete: 1
|
|
1137
1148
|
});
|
|
1138
1149
|
|
|
@@ -1179,7 +1190,7 @@ export default /*#__PURE__*/ {
|
|
|
1179
1190
|
}
|
|
1180
1191
|
},
|
|
1181
1192
|
|
|
1182
|
-
showExportModal(){
|
|
1193
|
+
showExportModal() {
|
|
1183
1194
|
this.$refs["modal-export"].show();
|
|
1184
1195
|
},
|
|
1185
1196
|
|
|
@@ -1216,7 +1227,7 @@ export default /*#__PURE__*/ {
|
|
|
1216
1227
|
},
|
|
1217
1228
|
|
|
1218
1229
|
|
|
1219
|
-
showImportModal(){
|
|
1230
|
+
showImportModal() {
|
|
1220
1231
|
this.$refs["modal-import"].show();
|
|
1221
1232
|
},
|
|
1222
1233
|
importItems() {
|
|
@@ -1295,19 +1306,19 @@ export default /*#__PURE__*/ {
|
|
|
1295
1306
|
|
|
1296
1307
|
if (this.vuexLocalforage) {
|
|
1297
1308
|
|
|
1298
|
-
if(this.markDirty){
|
|
1309
|
+
if (this.markDirty) {
|
|
1299
1310
|
this.item.dirty = true;
|
|
1300
1311
|
}
|
|
1301
1312
|
|
|
1302
1313
|
if (this.item.id) {
|
|
1303
|
-
|
|
1304
|
-
result = await this.model.$create({ data:this.item});
|
|
1305
|
-
console.debug("save item 4", this.item,result);
|
|
1314
|
+
|
|
1315
|
+
result = await this.model.$create({ data: this.item });
|
|
1316
|
+
console.debug("save item 4", this.item, result);
|
|
1306
1317
|
create = false;
|
|
1307
1318
|
} else {
|
|
1308
1319
|
|
|
1309
|
-
result = await this.model.$create({ data:this.item});
|
|
1310
|
-
console.debug("save item 5", this.item,result);
|
|
1320
|
+
result = await this.model.$create({ data: this.item });
|
|
1321
|
+
console.debug("save item 5", this.item, result);
|
|
1311
1322
|
create = true;
|
|
1312
1323
|
}
|
|
1313
1324
|
|
|
@@ -1316,7 +1327,7 @@ export default /*#__PURE__*/ {
|
|
|
1316
1327
|
let jsondata = this.item.$toJson();
|
|
1317
1328
|
console.debug("save item 2", this.item, jsondata);
|
|
1318
1329
|
if (this.item.id) {
|
|
1319
|
-
result = await this.model.api().put(this.apiUrl + "/" + this.modelName+'/' + this.item.id, jsondata);
|
|
1330
|
+
result = await this.model.api().put(this.apiUrl + "/" + this.modelName + '/' + this.item.id, jsondata);
|
|
1320
1331
|
create = false;
|
|
1321
1332
|
} else {
|
|
1322
1333
|
result = await this.model.api().post(this.apiUrl + "/" + this.modelName, jsondata);
|
|
@@ -1751,7 +1762,7 @@ export default /*#__PURE__*/ {
|
|
|
1751
1762
|
<b-button variant="info" @click="refresh()"><b-icon-arrow-clockwise></b-icon-arrow-clockwise></b-button>
|
|
1752
1763
|
<b-button variant="info" @click="toggleDisplayMode()" :disabled="loading" v-if="displayModeToggler">
|
|
1753
1764
|
<b-icon-card-list v-if="displayMode == displayModes.MODE_TABLE"></b-icon-card-list>
|
|
1754
|
-
<b-icon-table v-if="displayMode == displayModes.MODE_CARDS"></b-icon-table>
|
|
1765
|
+
<b-icon-table v-else-if="displayMode == displayModes.MODE_CARDS"></b-icon-table>
|
|
1755
1766
|
</b-button>
|
|
1756
1767
|
|
|
1757
1768
|
<div class="crud-search m-0" v-if="showSearch">
|
|
@@ -1878,7 +1889,6 @@ export default /*#__PURE__*/ {
|
|
|
1878
1889
|
<span>{{ item.crudgrouplabel }}</span>
|
|
1879
1890
|
</th>
|
|
1880
1891
|
|
|
1881
|
-
|
|
1882
1892
|
<slot name="row" v-bind:item="item" v-else>
|
|
1883
1893
|
<td v-for="(column, indexc) in columns" :key="indexc" :scope="column.prop == 'id' ? 'row' : ''">
|
|
1884
1894
|
<slot :name="'cell-' + column.prop" v-bind:item="item" v-bind:index="index" v-bind:itemindex="index"
|
|
@@ -1952,7 +1962,7 @@ export default /*#__PURE__*/ {
|
|
|
1952
1962
|
</p>
|
|
1953
1963
|
</div>
|
|
1954
1964
|
|
|
1955
|
-
<div v-if="displayMode == displayModes.MODE_CARDS">
|
|
1965
|
+
<div v-else-if="displayMode == displayModes.MODE_CARDS">
|
|
1956
1966
|
<draggable v-model="items" :group="draggableGroup" :draggable="orderable ? '.item' : '.none'" @start="drag = true"
|
|
1957
1967
|
@end="drag = false" @sort="onSort()" @add="onDraggableAdded($event)" @change="onDraggableChange($event)"
|
|
1958
1968
|
:options="draggableOptions">
|
|
@@ -1960,23 +1970,12 @@ export default /*#__PURE__*/ {
|
|
|
1960
1970
|
:cols="{ default: 12 / colLg, 1400: 12 / colXl, 1200: 12 / colLg, 1000: 12 / colMd, 700: 12 / colSm, 400: 12 / colXs }"
|
|
1961
1971
|
:gutter="{ default: '15px', 700: '15px' }">
|
|
1962
1972
|
<div v-for="(item, index) in itemsList" v-bind:key="index" class="item">
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
:index="index"
|
|
1970
|
-
:cardClass="cardClass"
|
|
1971
|
-
:cardHideFooter="cardHideFooter"
|
|
1972
|
-
:itemValue="itemValue"
|
|
1973
|
-
:getStateValue="getStateValue"
|
|
1974
|
-
:getArrayValue="getArrayValue"
|
|
1975
|
-
:showItem="showItem"
|
|
1976
|
-
:updateItem="updateItem"
|
|
1977
|
-
:removeItem="removeItem"
|
|
1978
|
-
/>
|
|
1979
|
-
</slot>
|
|
1973
|
+
<slot name="card" v-bind:item="item">
|
|
1974
|
+
<ItemCard v-for="(item, index) in itemsList" :key="index" :item="item" :columns="columns" :index="index"
|
|
1975
|
+
:cardClass="cardClass" :cardHideFooter="cardHideFooter" :itemValue="itemValue"
|
|
1976
|
+
:getStateValue="getStateValue" :getArrayValue="getArrayValue" :showItem="showItem"
|
|
1977
|
+
:updateItem="updateItem" :removeItem="removeItem" />
|
|
1978
|
+
</slot>
|
|
1980
1979
|
</div>
|
|
1981
1980
|
</masonry>
|
|
1982
1981
|
</draggable>
|
|
@@ -1987,29 +1986,35 @@ export default /*#__PURE__*/ {
|
|
|
1987
1986
|
|
|
1988
1987
|
</div>
|
|
1989
1988
|
|
|
1990
|
-
<div v-if="displayMode == displayModes.MODE_KANBAN">
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
:
|
|
2007
|
-
|
|
2008
|
-
|
|
1989
|
+
<div v-else-if="displayMode == displayModes.MODE_KANBAN">
|
|
1990
|
+
{{ JSON.stringify(items) }}
|
|
1991
|
+
|
|
1992
|
+
<div v-for="(column, colIndex) in items" :key="colIndex" class="kanban-column">
|
|
1993
|
+
<div class="kanban-column-header">
|
|
1994
|
+
{{ colIndex }}
|
|
1995
|
+
</div>
|
|
1996
|
+
|
|
1997
|
+
{{ JSON.stringify(column) }}
|
|
1998
|
+
|
|
1999
|
+
|
|
2000
|
+
<draggable v-model="column.items" group="kanban" class="kanban-column-body" @end="onDragEnd">
|
|
2001
|
+
|
|
2002
|
+
<div v-for="(item, index) in itemsList" v-bind:key="index" class="item">
|
|
2003
|
+
<slot name="card" v-bind:item="item">
|
|
2004
|
+
<ItemCard v-for="(item, index) in itemsList" :key="index" :item="item" :columns="columns" :index="index"
|
|
2005
|
+
:cardClass="cardClass" :cardHideFooter="cardHideFooter" :itemValue="itemValue"
|
|
2006
|
+
:getStateValue="getStateValue" :getArrayValue="getArrayValue" :showItem="showItem"
|
|
2007
|
+
:updateItem="updateItem" :removeItem="removeItem" />
|
|
2008
|
+
</slot>
|
|
2009
|
+
</div>
|
|
2010
|
+
|
|
2011
|
+
</draggable>
|
|
2012
|
+
|
|
2009
2013
|
</div>
|
|
2014
|
+
|
|
2010
2015
|
</div>
|
|
2011
2016
|
|
|
2012
|
-
<div v-if="displayMode == displayModes.MODE_CUSTOM">
|
|
2017
|
+
<div v-else-if="displayMode == displayModes.MODE_CUSTOM">
|
|
2013
2018
|
<div :class="listContainerClass">
|
|
2014
2019
|
<p v-if="!loading && items && items.length == 0 && !infiniteScroll" class="p-3">
|
|
2015
2020
|
{{ messageEmptyResults }}
|
|
@@ -2193,4 +2198,47 @@ tr td:first-child {
|
|
|
2193
2198
|
}
|
|
2194
2199
|
}
|
|
2195
2200
|
}
|
|
2201
|
+
|
|
2202
|
+
|
|
2203
|
+
.kanban-board {
|
|
2204
|
+
display: flex;
|
|
2205
|
+
gap: 1rem;
|
|
2206
|
+
overflow-x: auto;
|
|
2207
|
+
padding: 1rem;
|
|
2208
|
+
}
|
|
2209
|
+
|
|
2210
|
+
.kanban-column {
|
|
2211
|
+
background: #f4f5f7;
|
|
2212
|
+
border-radius: 8px;
|
|
2213
|
+
width: 300px;
|
|
2214
|
+
display: flex;
|
|
2215
|
+
flex-direction: column;
|
|
2216
|
+
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
|
2217
|
+
}
|
|
2218
|
+
|
|
2219
|
+
.kanban-column-header {
|
|
2220
|
+
font-weight: bold;
|
|
2221
|
+
padding: 0.5rem;
|
|
2222
|
+
background: #dfe1e6;
|
|
2223
|
+
border-radius: 8px 8px 0 0;
|
|
2224
|
+
text-align: center;
|
|
2225
|
+
}
|
|
2226
|
+
|
|
2227
|
+
.kanban-column-body {
|
|
2228
|
+
padding: 0.5rem;
|
|
2229
|
+
min-height: 100px;
|
|
2230
|
+
background: #ffffff;
|
|
2231
|
+
border-radius: 0 0 8px 8px;
|
|
2232
|
+
display: flex;
|
|
2233
|
+
flex-direction: column;
|
|
2234
|
+
gap: 0.5rem;
|
|
2235
|
+
}
|
|
2236
|
+
|
|
2237
|
+
.kanban-card {
|
|
2238
|
+
background: #ffffff;
|
|
2239
|
+
border-radius: 4px;
|
|
2240
|
+
padding: 1rem;
|
|
2241
|
+
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
|
|
2242
|
+
cursor: grab;
|
|
2243
|
+
}
|
|
2196
2244
|
</style>
|