vue-laravel-crud 1.7.20 → 1.8.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 +159 -80
- package/dist/vue-laravel-crud.min.js +3 -3
- package/dist/vue-laravel-crud.ssr.js +155 -78
- package/package.json +1 -1
- package/src/ItemCard.vue +65 -0
- package/src/vue-laravel-crud.vue +47 -65
|
@@ -12532,8 +12532,7 @@ Plugin.install = function (Vue, options) {
|
|
|
12532
12532
|
|
|
12533
12533
|
if (typeof window !== 'undefined' && window.Vue) {
|
|
12534
12534
|
window.Vue.use(Plugin);
|
|
12535
|
-
}
|
|
12536
|
-
n(css, {});function normalizeComponent (
|
|
12535
|
+
}function normalizeComponent (
|
|
12537
12536
|
scriptExports,
|
|
12538
12537
|
render,
|
|
12539
12538
|
staticRenderFns,
|
|
@@ -12624,12 +12623,115 @@ n(css, {});function normalizeComponent (
|
|
|
12624
12623
|
exports: scriptExports,
|
|
12625
12624
|
options: options
|
|
12626
12625
|
}
|
|
12627
|
-
}var _sfc_main = {
|
|
12626
|
+
}var _sfc_main$1 = {
|
|
12627
|
+
props: {
|
|
12628
|
+
item: Object,
|
|
12629
|
+
columns: Array,
|
|
12630
|
+
index: Number,
|
|
12631
|
+
itemClass: {
|
|
12632
|
+
type: String,
|
|
12633
|
+
default: 'item'
|
|
12634
|
+
},
|
|
12635
|
+
cardClass: String,
|
|
12636
|
+
cardHideFooter: Boolean,
|
|
12637
|
+
itemValue: Function,
|
|
12638
|
+
getStateValue: Function,
|
|
12639
|
+
getArrayValue: Function,
|
|
12640
|
+
showItem: Function,
|
|
12641
|
+
updateItem: Function,
|
|
12642
|
+
removeItem: Function
|
|
12643
|
+
}
|
|
12644
|
+
};
|
|
12645
|
+
var _sfc_render$1 = function render() {
|
|
12646
|
+
var _vm = this,
|
|
12647
|
+
_c = _vm._self._c;
|
|
12648
|
+
return _c('div', {
|
|
12649
|
+
class: _vm.itemClass
|
|
12650
|
+
}, [_c('b-card', {
|
|
12651
|
+
staticClass: "mb-2 card-crud",
|
|
12652
|
+
class: _vm.cardClass,
|
|
12653
|
+
attrs: {
|
|
12654
|
+
"title": _vm.item.title,
|
|
12655
|
+
"tag": "article",
|
|
12656
|
+
"hide-footer": _vm.cardHideFooter
|
|
12657
|
+
},
|
|
12658
|
+
scopedSlots: _vm._u([{
|
|
12659
|
+
key: "footer",
|
|
12660
|
+
fn: function fn() {
|
|
12661
|
+
return [_c('b-button-group', [_vm._t("rowAction", function () {
|
|
12662
|
+
return [_c('b-button', {
|
|
12663
|
+
attrs: {
|
|
12664
|
+
"variant": "primary"
|
|
12665
|
+
},
|
|
12666
|
+
on: {
|
|
12667
|
+
"click": function click($event) {
|
|
12668
|
+
return _vm.showItem(_vm.item.id, _vm.index);
|
|
12669
|
+
}
|
|
12670
|
+
}
|
|
12671
|
+
}, [_c('b-icon-eye')], 1), _c('b-button', {
|
|
12672
|
+
attrs: {
|
|
12673
|
+
"variant": "secondary"
|
|
12674
|
+
},
|
|
12675
|
+
on: {
|
|
12676
|
+
"click": function click($event) {
|
|
12677
|
+
return _vm.updateItem(_vm.item.id, _vm.index);
|
|
12678
|
+
}
|
|
12679
|
+
}
|
|
12680
|
+
}, [_c('b-icon-pencil')], 1), _c('b-button', {
|
|
12681
|
+
attrs: {
|
|
12682
|
+
"variant": "danger"
|
|
12683
|
+
},
|
|
12684
|
+
on: {
|
|
12685
|
+
"click": function click($event) {
|
|
12686
|
+
return _vm.removeItem(_vm.item.id, _vm.index);
|
|
12687
|
+
}
|
|
12688
|
+
}
|
|
12689
|
+
}, [_c('b-icon-trash')], 1)];
|
|
12690
|
+
}, {
|
|
12691
|
+
"item": _vm.item,
|
|
12692
|
+
"index": _vm.index,
|
|
12693
|
+
"showItem": _vm.showItem,
|
|
12694
|
+
"updateItem": _vm.updateItem,
|
|
12695
|
+
"removeItem": _vm.removeItem
|
|
12696
|
+
})], 2)];
|
|
12697
|
+
},
|
|
12698
|
+
proxy: true
|
|
12699
|
+
}], null, true)
|
|
12700
|
+
}, [_vm._t("card", function () {
|
|
12701
|
+
return _vm._l(_vm.columns, function (column, indexc) {
|
|
12702
|
+
return _c('div', {
|
|
12703
|
+
key: indexc
|
|
12704
|
+
}, [column.type !== 'actions' ? _c('b-card-text', [_vm._v(" " + _vm._s(column.label) + ": "), _vm._t('cell-' + column.prop, function () {
|
|
12705
|
+
return [column.type === 'boolean' ? _c('span', [_vm.itemValue(column, _vm.item) ? _c('b-badge', {
|
|
12706
|
+
attrs: {
|
|
12707
|
+
"variant": "success"
|
|
12708
|
+
}
|
|
12709
|
+
}, [_c('b-icon-check-circle')], 1) : _c('b-badge', {
|
|
12710
|
+
attrs: {
|
|
12711
|
+
"variant": "danger"
|
|
12712
|
+
}
|
|
12713
|
+
}, [_c('b-icon-x-circle')], 1)], 1) : column.type === 'date' ? _c('span', [_vm._v(" " + _vm._s(_vm.itemValue(column, _vm.item)) + " ")]) : column.type === 'state' ? _c('span', [_vm._v(" " + _vm._s(_vm.getStateValue(_vm.itemValue(column, _vm.item), column.options)) + " ")]) : column.type === 'array' ? _c('span', [_vm._v(" " + _vm._s(_vm.getArrayValue(_vm.itemValue(column, _vm.item), column.displayProp, column.options)) + " ")]) : _c('span', [_vm._v(" " + _vm._s(_vm.itemValue(column, _vm.item)) + " ")])];
|
|
12714
|
+
}, {
|
|
12715
|
+
"item": _vm.item,
|
|
12716
|
+
"index": _vm.index,
|
|
12717
|
+
"itemindex": _vm.index,
|
|
12718
|
+
"columnindex": indexc
|
|
12719
|
+
})], 2) : _vm._e()], 1);
|
|
12720
|
+
});
|
|
12721
|
+
}, {
|
|
12722
|
+
"item": _vm.item
|
|
12723
|
+
})], 2)], 1);
|
|
12724
|
+
};
|
|
12725
|
+
var _sfc_staticRenderFns$1 = [];
|
|
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-ce8ebda1]:last-child,\ntr td[data-v-ce8ebda1]:first-child {\n width: 1%;\n white-space: nowrap; }\n\n.crud-pagination[data-v-ce8ebda1] {\n display: flex;\n align-items: center;\n width: 100%;\n justify-content: center;\n margin-top: 1rem; }\n\n.crud-header[data-v-ce8ebda1] {\n display: flex;\n justify-content: space-between;\n max-height: 3rem; }\n .crud-header[data-v-ce8ebda1] .crud-title[data-v-ce8ebda1] {\n margin: 0; }\n .crud-header[data-v-ce8ebda1] .crud-search[data-v-ce8ebda1] {\n max-width: 15rem; }\n .crud-header[data-v-ce8ebda1] .crud-search[data-v-ce8ebda1] .btn[data-v-ce8ebda1] {\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-ce8ebda1] .crud-search[data-v-ce8ebda1] .btn[data-v-ce8ebda1].open[data-v-ce8ebda1] {\n border-top-right-radius: 0;\n border-bottom-right-radius: 0; }\n .crud-header[data-v-ce8ebda1] .table-options[data-v-ce8ebda1] {\n margin-bottom: 1rem;\n display: flex;\n align-items: center;\n justify-content: flex-end; }\n\n.custom-control[data-v-ce8ebda1] {\n position: relative; }\n\n@media (min-width: 992px) {\n .table[data-v-ce8ebda1] {\n table-layout: auto; }\n .table[data-v-ce8ebda1] tbody[data-v-ce8ebda1] td[data-v-ce8ebda1] {\n overflow: scroll;\n -ms-overflow-style: none;\n /* IE and Edge */\n scrollbar-width: none;\n /* Firefox */ }\n .table[data-v-ce8ebda1] tbody[data-v-ce8ebda1] td[data-v-ce8ebda1]::-webkit-scrollbar {\n display: none; } }\n";
|
|
12728
|
+
n(css, {});var _sfc_main = {
|
|
12628
12729
|
name: "VueLaravelCrud",
|
|
12629
12730
|
components: {
|
|
12630
12731
|
draggable: draggable,
|
|
12631
12732
|
InfiniteLoading: InfiniteLoading,
|
|
12632
|
-
VueMasonry: Plugin
|
|
12733
|
+
VueMasonry: Plugin,
|
|
12734
|
+
ItemCard: ItemCard
|
|
12633
12735
|
},
|
|
12634
12736
|
data: function data() {
|
|
12635
12737
|
return {
|
|
@@ -12660,7 +12762,8 @@ n(css, {});function normalizeComponent (
|
|
|
12660
12762
|
displayModes: {
|
|
12661
12763
|
MODE_TABLE: 1,
|
|
12662
12764
|
MODE_CARDS: 2,
|
|
12663
|
-
MODE_CUSTOM: 3
|
|
12765
|
+
MODE_CUSTOM: 3,
|
|
12766
|
+
MODE_KANBAN: 4
|
|
12664
12767
|
},
|
|
12665
12768
|
infiniteScrollKey: 1,
|
|
12666
12769
|
optionsLoaded: false,
|
|
@@ -13442,7 +13545,7 @@ n(css, {});function normalizeComponent (
|
|
|
13442
13545
|
case 9:
|
|
13443
13546
|
_this11.model.deleteAll();
|
|
13444
13547
|
_context.next = 12;
|
|
13445
|
-
return _this11.model.api().get(
|
|
13548
|
+
return _this11.model.api().get(_this11.apiUrl + "/" + _this11.modelName, {
|
|
13446
13549
|
params: {
|
|
13447
13550
|
page: page,
|
|
13448
13551
|
limit: _this11.pagination.perPage,
|
|
@@ -13658,7 +13761,7 @@ n(css, {});function normalizeComponent (
|
|
|
13658
13761
|
break;
|
|
13659
13762
|
case 6:
|
|
13660
13763
|
_context3.next = 8;
|
|
13661
|
-
return _this17.model.api().delete('/bulk-destroy', {
|
|
13764
|
+
return _this17.model.api().delete(_this17.apiUrl + "/" + _this17.modelName + '/bulk-destroy', {
|
|
13662
13765
|
params: {
|
|
13663
13766
|
ids: ids
|
|
13664
13767
|
},
|
|
@@ -13755,7 +13858,7 @@ n(css, {});function normalizeComponent (
|
|
|
13755
13858
|
break;
|
|
13756
13859
|
case 5:
|
|
13757
13860
|
_context5.next = 7;
|
|
13758
|
-
return _this20.model.api().delete('/' + id, {
|
|
13861
|
+
return _this20.model.api().delete(_this20.apiUrl + "/" + _this20.modelName + '/' + id, {
|
|
13759
13862
|
delete: 1
|
|
13760
13863
|
});
|
|
13761
13864
|
case 7:
|
|
@@ -13959,7 +14062,7 @@ n(css, {});function normalizeComponent (
|
|
|
13959
14062
|
break;
|
|
13960
14063
|
}
|
|
13961
14064
|
_context6.next = 25;
|
|
13962
|
-
return _this25.model.api().put('/' + _this25.item.id, jsondata);
|
|
14065
|
+
return _this25.model.api().put(_this25.apiUrl + "/" + _this25.modelName + '/' + _this25.item.id, jsondata);
|
|
13963
14066
|
case 25:
|
|
13964
14067
|
result = _context6.sent;
|
|
13965
14068
|
create = false;
|
|
@@ -13967,7 +14070,7 @@ n(css, {});function normalizeComponent (
|
|
|
13967
14070
|
break;
|
|
13968
14071
|
case 29:
|
|
13969
14072
|
_context6.next = 31;
|
|
13970
|
-
return _this25.model.api().post(
|
|
14073
|
+
return _this25.model.api().post(_this25.apiUrl + "/" + _this25.modelName, jsondata);
|
|
13971
14074
|
case 31:
|
|
13972
14075
|
result = _context6.sent;
|
|
13973
14076
|
create = true;
|
|
@@ -15047,83 +15150,57 @@ var _sfc_render = function render() {
|
|
|
15047
15150
|
return _c('div', {
|
|
15048
15151
|
key: index,
|
|
15049
15152
|
staticClass: "item"
|
|
15050
|
-
}, [
|
|
15051
|
-
|
|
15052
|
-
|
|
15053
|
-
|
|
15054
|
-
|
|
15055
|
-
"tag": "article",
|
|
15056
|
-
"hideFooter": _vm.cardHideFooter
|
|
15057
|
-
},
|
|
15058
|
-
scopedSlots: _vm._u([{
|
|
15059
|
-
key: "footer",
|
|
15060
|
-
fn: function fn() {
|
|
15061
|
-
return [_c('b-button-group', [_vm._t("rowAction", function () {
|
|
15062
|
-
return [_c('b-button', {
|
|
15063
|
-
attrs: {
|
|
15064
|
-
"variant": "primary"
|
|
15065
|
-
},
|
|
15066
|
-
on: {
|
|
15067
|
-
"click": function click($event) {
|
|
15068
|
-
return _vm.showItem(item.id, index);
|
|
15069
|
-
}
|
|
15070
|
-
}
|
|
15071
|
-
}, [_c('b-icon-eye')], 1), _c('b-button', {
|
|
15072
|
-
attrs: {
|
|
15073
|
-
"variant": "secondary"
|
|
15074
|
-
},
|
|
15075
|
-
on: {
|
|
15076
|
-
"click": function click($event) {
|
|
15077
|
-
return _vm.updateItem(item.id, index);
|
|
15078
|
-
}
|
|
15079
|
-
}
|
|
15080
|
-
}, [_c('b-icon-pencil')], 1), _c('b-button', {
|
|
15081
|
-
attrs: {
|
|
15082
|
-
"variant": "danger"
|
|
15083
|
-
},
|
|
15084
|
-
on: {
|
|
15085
|
-
"click": function click($event) {
|
|
15086
|
-
return _vm.removeItem(item.id, index);
|
|
15087
|
-
}
|
|
15088
|
-
}
|
|
15089
|
-
}, [_c('b-icon-trash')], 1)];
|
|
15090
|
-
}, {
|
|
15153
|
+
}, [_vm._t("card", function () {
|
|
15154
|
+
return _vm._l(_vm.itemsList, function (item, index) {
|
|
15155
|
+
return _c('ItemCard', {
|
|
15156
|
+
key: index,
|
|
15157
|
+
attrs: {
|
|
15091
15158
|
"item": item,
|
|
15159
|
+
"columns": _vm.columns,
|
|
15092
15160
|
"index": index,
|
|
15161
|
+
"cardClass": _vm.cardClass,
|
|
15162
|
+
"cardHideFooter": _vm.cardHideFooter,
|
|
15163
|
+
"itemValue": _vm.itemValue,
|
|
15164
|
+
"getStateValue": _vm.getStateValue,
|
|
15165
|
+
"getArrayValue": _vm.getArrayValue,
|
|
15093
15166
|
"showItem": _vm.showItem,
|
|
15094
15167
|
"updateItem": _vm.updateItem,
|
|
15095
15168
|
"removeItem": _vm.removeItem
|
|
15096
|
-
}
|
|
15097
|
-
}
|
|
15098
|
-
proxy: true
|
|
15099
|
-
}], null, true)
|
|
15100
|
-
}, [_vm._t("card", function () {
|
|
15101
|
-
return _vm._l(_vm.columns, function (column, indexc) {
|
|
15102
|
-
return _c('div', {
|
|
15103
|
-
key: indexc
|
|
15104
|
-
}, [column.type != 'actions' ? _c('b-card-text', [_vm._v(_vm._s(column.label) + ": "), _vm._t('cell-' + column.prop, function () {
|
|
15105
|
-
return [column.type == 'boolean' ? _c('span', [_vm.itemValue(column, item) == 'true' || _vm.itemValue(column, item) == 1 || _vm.itemValue(column, item) == '1' ? _c('b-badge', {
|
|
15106
|
-
attrs: {
|
|
15107
|
-
"variant": "success"
|
|
15108
|
-
}
|
|
15109
|
-
}, [_c('b-icon-check-circle')], 1) : _vm._e(), !_vm.itemValue(column, item) || _vm.itemValue(column, item) == '0' || _vm.itemValue(column, item) == 'false' ? _c('b-badge', {
|
|
15110
|
-
attrs: {
|
|
15111
|
-
"variant": "danger"
|
|
15112
|
-
}
|
|
15113
|
-
}, [_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)) + " ")])];
|
|
15114
|
-
}, {
|
|
15115
|
-
"item": item,
|
|
15116
|
-
"index": index,
|
|
15117
|
-
"itemindex": index,
|
|
15118
|
-
"columnindex": indexc
|
|
15119
|
-
})], 2) : _vm._e()], 1);
|
|
15169
|
+
}
|
|
15170
|
+
});
|
|
15120
15171
|
});
|
|
15121
15172
|
}, {
|
|
15122
15173
|
"item": item
|
|
15123
|
-
})], 2)
|
|
15174
|
+
})], 2);
|
|
15124
15175
|
}), 0)], 1), !_vm.loading && _vm.items && _vm.items.length == 0 && !_vm.infiniteScroll ? _c('p', {
|
|
15125
15176
|
staticClass: "p-3"
|
|
15126
|
-
}, [_vm._v(" " + _vm._s(_vm.messageEmptyResults) + " ")]) : _vm._e()], 1) : _vm._e(), _vm.displayMode == _vm.displayModes.
|
|
15177
|
+
}, [_vm._v(" " + _vm._s(_vm.messageEmptyResults) + " ")]) : _vm._e()], 1) : _vm._e(), _vm.displayMode == _vm.displayModes.MODE_KANBAN ? _c('div', _vm._l(_vm.itemsList, function (item, index) {
|
|
15178
|
+
return _c('div', {
|
|
15179
|
+
key: index,
|
|
15180
|
+
staticClass: "item"
|
|
15181
|
+
}, [_vm._t("card", function () {
|
|
15182
|
+
return _vm._l(_vm.itemsList, function (item, index) {
|
|
15183
|
+
return _c('ItemCard', {
|
|
15184
|
+
key: index,
|
|
15185
|
+
attrs: {
|
|
15186
|
+
"item": item,
|
|
15187
|
+
"columns": _vm.columns,
|
|
15188
|
+
"index": index,
|
|
15189
|
+
"cardClass": _vm.cardClass,
|
|
15190
|
+
"cardHideFooter": _vm.cardHideFooter,
|
|
15191
|
+
"itemValue": _vm.itemValue,
|
|
15192
|
+
"getStateValue": _vm.getStateValue,
|
|
15193
|
+
"getArrayValue": _vm.getArrayValue,
|
|
15194
|
+
"showItem": _vm.showItem,
|
|
15195
|
+
"updateItem": _vm.updateItem,
|
|
15196
|
+
"removeItem": _vm.removeItem
|
|
15197
|
+
}
|
|
15198
|
+
});
|
|
15199
|
+
});
|
|
15200
|
+
}, {
|
|
15201
|
+
"item": item
|
|
15202
|
+
})], 2);
|
|
15203
|
+
}), 0) : _vm._e(), _vm.displayMode == _vm.displayModes.MODE_CUSTOM ? _c('div', [_c('div', {
|
|
15127
15204
|
class: _vm.listContainerClass
|
|
15128
15205
|
}, [!_vm.loading && _vm.items && _vm.items.length == 0 && !_vm.infiniteScroll ? _c('p', {
|
|
15129
15206
|
staticClass: "p-3"
|
|
@@ -15404,7 +15481,7 @@ var _sfc_render = function render() {
|
|
|
15404
15481
|
}) : _vm._e()], 2) : _vm._e()], 1);
|
|
15405
15482
|
};
|
|
15406
15483
|
var _sfc_staticRenderFns = [];
|
|
15407
|
-
var __component__ = /*#__PURE__*/normalizeComponent(_sfc_main, _sfc_render, _sfc_staticRenderFns, false, null, "
|
|
15484
|
+
var __component__ = /*#__PURE__*/normalizeComponent(_sfc_main, _sfc_render, _sfc_staticRenderFns, false, null, "ce8ebda1", null, null);
|
|
15408
15485
|
var component$1 = __component__.exports;// Import vue component
|
|
15409
15486
|
|
|
15410
15487
|
// Default export is installable instance of component.
|
package/package.json
CHANGED
package/src/ItemCard.vue
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="itemClass">
|
|
3
|
+
<b-card :title="item.title" tag="article" class="mb-2 card-crud" :class="cardClass" :hide-footer="cardHideFooter">
|
|
4
|
+
<slot name="card" v-bind:item="item">
|
|
5
|
+
<div v-for="(column, indexc) in columns" :key="indexc">
|
|
6
|
+
<b-card-text v-if="column.type !== 'actions'">
|
|
7
|
+
{{ column.label }}:
|
|
8
|
+
<slot :name="'cell-' + column.prop" v-bind:item="item" v-bind:index="index" v-bind:itemindex="index"
|
|
9
|
+
v-bind:columnindex="indexc">
|
|
10
|
+
<span v-if="column.type === 'boolean'">
|
|
11
|
+
<b-badge variant="success" v-if="itemValue(column, item)"><b-icon-check-circle></b-icon-check-circle></b-badge>
|
|
12
|
+
<b-badge variant="danger" v-else><b-icon-x-circle></b-icon-x-circle></b-badge>
|
|
13
|
+
</span>
|
|
14
|
+
<span v-else-if="column.type === 'date'">
|
|
15
|
+
{{ itemValue(column, item) }}
|
|
16
|
+
</span>
|
|
17
|
+
<span v-else-if="column.type === 'state'">
|
|
18
|
+
{{ getStateValue(itemValue(column, item), column.options) }}
|
|
19
|
+
</span>
|
|
20
|
+
<span v-else-if="column.type === 'array'">
|
|
21
|
+
{{ getArrayValue(itemValue(column, item), column.displayProp, column.options) }}
|
|
22
|
+
</span>
|
|
23
|
+
<span v-else>
|
|
24
|
+
{{ itemValue(column, item) }}
|
|
25
|
+
</span>
|
|
26
|
+
</slot>
|
|
27
|
+
</b-card-text>
|
|
28
|
+
</div>
|
|
29
|
+
</slot>
|
|
30
|
+
<template v-slot:footer>
|
|
31
|
+
<b-button-group>
|
|
32
|
+
<slot name="rowAction" v-bind:item="item" v-bind:index="index" v-bind:showItem="showItem"
|
|
33
|
+
v-bind:updateItem="updateItem" v-bind:removeItem="removeItem">
|
|
34
|
+
<b-button variant="primary" @click="showItem(item.id, index)"><b-icon-eye></b-icon-eye></b-button>
|
|
35
|
+
<b-button variant="secondary" @click="updateItem(item.id, index)"><b-icon-pencil></b-icon-pencil></b-button>
|
|
36
|
+
<b-button variant="danger" @click="removeItem(item.id, index)"><b-icon-trash></b-icon-trash></b-button>
|
|
37
|
+
</slot>
|
|
38
|
+
</b-button-group>
|
|
39
|
+
</template>
|
|
40
|
+
</b-card>
|
|
41
|
+
</div>
|
|
42
|
+
</template>
|
|
43
|
+
|
|
44
|
+
<script>
|
|
45
|
+
export default {
|
|
46
|
+
props: {
|
|
47
|
+
item: Object,
|
|
48
|
+
columns: Array,
|
|
49
|
+
index: Number,
|
|
50
|
+
itemClass: {
|
|
51
|
+
type: String,
|
|
52
|
+
default: 'item',
|
|
53
|
+
},
|
|
54
|
+
cardClass: String,
|
|
55
|
+
cardHideFooter: Boolean,
|
|
56
|
+
itemValue: Function,
|
|
57
|
+
getStateValue: Function,
|
|
58
|
+
getArrayValue: Function,
|
|
59
|
+
showItem: Function,
|
|
60
|
+
updateItem: Function,
|
|
61
|
+
removeItem: Function,
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
</script>
|
|
65
|
+
|
package/src/vue-laravel-crud.vue
CHANGED
|
@@ -3,6 +3,7 @@ import draggable from "vuedraggable";
|
|
|
3
3
|
import moment from "moment";
|
|
4
4
|
import InfiniteLoading from 'vue-infinite-loading';
|
|
5
5
|
import VueMasonry from 'vue-masonry-css'
|
|
6
|
+
import ItemCard from "./ItemCard.vue";
|
|
6
7
|
|
|
7
8
|
|
|
8
9
|
|
|
@@ -11,7 +12,8 @@ export default /*#__PURE__*/ {
|
|
|
11
12
|
components: {
|
|
12
13
|
draggable,
|
|
13
14
|
InfiniteLoading,
|
|
14
|
-
VueMasonry
|
|
15
|
+
VueMasonry,
|
|
16
|
+
ItemCard
|
|
15
17
|
},
|
|
16
18
|
data() {
|
|
17
19
|
return {
|
|
@@ -46,6 +48,7 @@ export default /*#__PURE__*/ {
|
|
|
46
48
|
MODE_TABLE: 1,
|
|
47
49
|
MODE_CARDS: 2,
|
|
48
50
|
MODE_CUSTOM: 3,
|
|
51
|
+
MODE_KANBAN: 4
|
|
49
52
|
},
|
|
50
53
|
infiniteScrollKey: 1,
|
|
51
54
|
optionsLoaded: false,
|
|
@@ -859,7 +862,7 @@ export default /*#__PURE__*/ {
|
|
|
859
862
|
} else {
|
|
860
863
|
this.model.deleteAll();
|
|
861
864
|
|
|
862
|
-
result = await this.model.api().get(
|
|
865
|
+
result = await this.model.api().get(this.apiUrl + "/" + this.modelName, {
|
|
863
866
|
params: {
|
|
864
867
|
page: page,
|
|
865
868
|
limit: this.pagination.perPage,
|
|
@@ -1055,7 +1058,7 @@ export default /*#__PURE__*/ {
|
|
|
1055
1058
|
await this.model.$delete(ids);
|
|
1056
1059
|
|
|
1057
1060
|
} else {
|
|
1058
|
-
let result = await this.model.api().delete('/bulk-destroy' , {
|
|
1061
|
+
let result = await this.model.api().delete(this.apiUrl + "/" + this.modelName+'/bulk-destroy' , {
|
|
1059
1062
|
params: { ids: ids},
|
|
1060
1063
|
delete: ids
|
|
1061
1064
|
});
|
|
@@ -1129,7 +1132,7 @@ export default /*#__PURE__*/ {
|
|
|
1129
1132
|
await this.model.$delete(id);
|
|
1130
1133
|
|
|
1131
1134
|
} else {
|
|
1132
|
-
let result = await this.model.api().delete('/' + id, {
|
|
1135
|
+
let result = await this.model.api().delete(this.apiUrl + "/" + this.modelName+'/' + id, {
|
|
1133
1136
|
delete: 1
|
|
1134
1137
|
});
|
|
1135
1138
|
|
|
@@ -1313,10 +1316,10 @@ export default /*#__PURE__*/ {
|
|
|
1313
1316
|
let jsondata = this.item.$toJson();
|
|
1314
1317
|
console.debug("save item 2", this.item, jsondata);
|
|
1315
1318
|
if (this.item.id) {
|
|
1316
|
-
result = await this.model.api().put('/' + this.item.id, jsondata);
|
|
1319
|
+
result = await this.model.api().put(this.apiUrl + "/" + this.modelName+'/' + this.item.id, jsondata);
|
|
1317
1320
|
create = false;
|
|
1318
1321
|
} else {
|
|
1319
|
-
result = await this.model.api().post(
|
|
1322
|
+
result = await this.model.api().post(this.apiUrl + "/" + this.modelName, jsondata);
|
|
1320
1323
|
create = true;
|
|
1321
1324
|
}
|
|
1322
1325
|
|
|
@@ -1956,67 +1959,24 @@ export default /*#__PURE__*/ {
|
|
|
1956
1959
|
<masonry
|
|
1957
1960
|
:cols="{ default: 12 / colLg, 1400: 12 / colXl, 1200: 12 / colLg, 1000: 12 / colMd, 700: 12 / colSm, 400: 12 / colXs }"
|
|
1958
1961
|
:gutter="{ default: '15px', 700: '15px' }">
|
|
1959
|
-
|
|
1960
1962
|
<div v-for="(item, index) in itemsList" v-bind:key="index" class="item">
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
</span>
|
|
1978
|
-
<span v-else-if="column.type == 'date'">
|
|
1979
|
-
{{ itemValue(column, item) }}
|
|
1980
|
-
</span>
|
|
1981
|
-
<span v-else-if="column.type == 'state'">
|
|
1982
|
-
{{
|
|
1983
|
-
getStateValue(itemValue(column, item), column.options)
|
|
1984
|
-
}}
|
|
1985
|
-
</span>
|
|
1986
|
-
<span v-else-if="column.type == 'array'">
|
|
1987
|
-
{{
|
|
1988
|
-
getArrayValue(
|
|
1989
|
-
itemValue(column, item),
|
|
1990
|
-
column.displayProp,
|
|
1991
|
-
column.options
|
|
1992
|
-
)
|
|
1993
|
-
}}
|
|
1994
|
-
</span>
|
|
1995
|
-
<span v-else>
|
|
1996
|
-
{{ itemValue(column, item) }}
|
|
1997
|
-
</span>
|
|
1998
|
-
</slot>
|
|
1999
|
-
</b-card-text>
|
|
2000
|
-
</div>
|
|
1963
|
+
<slot name="card" v-bind:item="item">
|
|
1964
|
+
<ItemCard
|
|
1965
|
+
v-for="(item, index) in itemsList"
|
|
1966
|
+
:key="index"
|
|
1967
|
+
:item="item"
|
|
1968
|
+
:columns="columns"
|
|
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
|
+
/>
|
|
2001
1979
|
</slot>
|
|
2002
|
-
|
|
2003
|
-
<template v-slot:footer>
|
|
2004
|
-
<b-button-group>
|
|
2005
|
-
<slot name="rowAction" v-bind:item="item" v-bind:index="index" v-bind:showItem="showItem"
|
|
2006
|
-
v-bind:updateItem="updateItem" v-bind:removeItem="removeItem">
|
|
2007
|
-
<b-button variant="primary" @click="showItem(item.id, index)">
|
|
2008
|
-
<b-icon-eye></b-icon-eye>
|
|
2009
|
-
</b-button>
|
|
2010
|
-
<b-button variant="secondary" @click="updateItem(item.id, index)">
|
|
2011
|
-
<b-icon-pencil></b-icon-pencil>
|
|
2012
|
-
</b-button>
|
|
2013
|
-
<b-button variant="danger" @click="removeItem(item.id, index)">
|
|
2014
|
-
<b-icon-trash></b-icon-trash>
|
|
2015
|
-
</b-button>
|
|
2016
|
-
</slot>
|
|
2017
|
-
</b-button-group>
|
|
2018
|
-
</template>
|
|
2019
|
-
</b-card>
|
|
2020
1980
|
</div>
|
|
2021
1981
|
</masonry>
|
|
2022
1982
|
</draggable>
|
|
@@ -2027,6 +1987,28 @@ export default /*#__PURE__*/ {
|
|
|
2027
1987
|
|
|
2028
1988
|
</div>
|
|
2029
1989
|
|
|
1990
|
+
<div v-if="displayMode == displayModes.MODE_KANBAN">
|
|
1991
|
+
<div v-for="(item, index) in itemsList" v-bind:key="index" class="item">
|
|
1992
|
+
<slot name="card" v-bind:item="item">
|
|
1993
|
+
<ItemCard
|
|
1994
|
+
v-for="(item, index) in itemsList"
|
|
1995
|
+
:key="index"
|
|
1996
|
+
:item="item"
|
|
1997
|
+
:columns="columns"
|
|
1998
|
+
:index="index"
|
|
1999
|
+
:cardClass="cardClass"
|
|
2000
|
+
:cardHideFooter="cardHideFooter"
|
|
2001
|
+
:itemValue="itemValue"
|
|
2002
|
+
:getStateValue="getStateValue"
|
|
2003
|
+
:getArrayValue="getArrayValue"
|
|
2004
|
+
:showItem="showItem"
|
|
2005
|
+
:updateItem="updateItem"
|
|
2006
|
+
:removeItem="removeItem"
|
|
2007
|
+
/>
|
|
2008
|
+
</slot>
|
|
2009
|
+
</div>
|
|
2010
|
+
</div>
|
|
2011
|
+
|
|
2030
2012
|
<div v-if="displayMode == displayModes.MODE_CUSTOM">
|
|
2031
2013
|
<div :class="listContainerClass">
|
|
2032
2014
|
<p v-if="!loading && items && items.length == 0 && !infiniteScroll" class="p-3">
|