vue-laravel-crud 1.6.16 → 1.6.19

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.
@@ -12532,7 +12532,7 @@ Plugin.install = function (Vue, options) {
12532
12532
 
12533
12533
  if (typeof window !== 'undefined' && window.Vue) {
12534
12534
  window.Vue.use(Plugin);
12535
- }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-e80d091a]:last-child,\ntr td[data-v-e80d091a]:first-child {\n width: 1%;\n white-space: nowrap; }\n\n.crud-pagination[data-v-e80d091a] {\n display: flex;\n align-items: center;\n width: 100%;\n justify-content: center;\n margin-top: 1rem; }\n\n.crud-header[data-v-e80d091a] {\n display: flex;\n justify-content: space-between;\n max-height: 3rem; }\n .crud-header[data-v-e80d091a] .crud-title[data-v-e80d091a] {\n margin: 0; }\n .crud-header[data-v-e80d091a] .crud-search[data-v-e80d091a] {\n max-width: 15rem; }\n .crud-header[data-v-e80d091a] .crud-search[data-v-e80d091a] .btn[data-v-e80d091a] {\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-e80d091a] .crud-search[data-v-e80d091a] .btn[data-v-e80d091a].open[data-v-e80d091a] {\n border-top-right-radius: 0;\n border-bottom-right-radius: 0; }\n .crud-header[data-v-e80d091a] .table-options[data-v-e80d091a] {\n margin-bottom: 1rem;\n display: flex;\n align-items: center;\n justify-content: flex-end; }\n\n.custom-control[data-v-e80d091a] {\n position: relative; }\n\n@media (min-width: 992px) {\n .table[data-v-e80d091a] {\n table-layout: auto; }\n .table[data-v-e80d091a] tbody[data-v-e80d091a] td[data-v-e80d091a] {\n overflow: scroll;\n -ms-overflow-style: none;\n /* IE and Edge */\n scrollbar-width: none;\n /* Firefox */ }\n .table[data-v-e80d091a] tbody[data-v-e80d091a] td[data-v-e80d091a]::-webkit-scrollbar {\n display: none; } }\n";
12535
+ }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-373bb24e]:last-child,\ntr td[data-v-373bb24e]:first-child {\n width: 1%;\n white-space: nowrap; }\n\n.crud-pagination[data-v-373bb24e] {\n display: flex;\n align-items: center;\n width: 100%;\n justify-content: center;\n margin-top: 1rem; }\n\n.crud-header[data-v-373bb24e] {\n display: flex;\n justify-content: space-between;\n max-height: 3rem; }\n .crud-header[data-v-373bb24e] .crud-title[data-v-373bb24e] {\n margin: 0; }\n .crud-header[data-v-373bb24e] .crud-search[data-v-373bb24e] {\n max-width: 15rem; }\n .crud-header[data-v-373bb24e] .crud-search[data-v-373bb24e] .btn[data-v-373bb24e] {\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-373bb24e] .crud-search[data-v-373bb24e] .btn[data-v-373bb24e].open[data-v-373bb24e] {\n border-top-right-radius: 0;\n border-bottom-right-radius: 0; }\n .crud-header[data-v-373bb24e] .table-options[data-v-373bb24e] {\n margin-bottom: 1rem;\n display: flex;\n align-items: center;\n justify-content: flex-end; }\n\n.custom-control[data-v-373bb24e] {\n position: relative; }\n\n@media (min-width: 992px) {\n .table[data-v-373bb24e] {\n table-layout: auto; }\n .table[data-v-373bb24e] tbody[data-v-373bb24e] td[data-v-373bb24e] {\n overflow: scroll;\n -ms-overflow-style: none;\n /* IE and Edge */\n scrollbar-width: none;\n /* Firefox */ }\n .table[data-v-373bb24e] tbody[data-v-373bb24e] td[data-v-373bb24e]::-webkit-scrollbar {\n display: none; } }\n";
12536
12536
  n(css, {});function normalizeComponent (
12537
12537
  scriptExports,
12538
12538
  render,
@@ -13012,7 +13012,11 @@ n(css, {});function normalizeComponent (
13012
13012
  if (this.ajax) {
13013
13013
  this.fetchItems();
13014
13014
  } else {
13015
- this.items = this.models;
13015
+ if (this.grouped) {
13016
+ this.groupItems(this.models);
13017
+ } else {
13018
+ this.items = this.models;
13019
+ }
13016
13020
  this.pagination.total = this.items.length;
13017
13021
  this.firstLoad = true;
13018
13022
  }
@@ -13059,7 +13063,10 @@ n(css, {});function normalizeComponent (
13059
13063
  var filter = [];
13060
13064
  this.forceRecomputeCounter;
13061
13065
  this.internalFilters.forEach(function (f) {
13062
- if (f.value) filter.push([f.column, f.op, f.value]);
13066
+ if (f.value) {
13067
+ var colname = f.column.replace("_sort", "").replace("_from", "").replace("_to", "");
13068
+ filter.push([colname, f.op, f.value]);
13069
+ }
13063
13070
  });
13064
13071
  return filter;
13065
13072
  },
@@ -13227,19 +13234,23 @@ n(css, {});function normalizeComponent (
13227
13234
  return item.selected = true;
13228
13235
  });
13229
13236
  } else {
13230
- this.selectedItems = [];
13231
13237
  this.selectedItems.forEach(function (item) {
13232
13238
  return item.selected = false;
13233
13239
  });
13240
+ this.items.forEach(function (item) {
13241
+ return item.selected = false;
13242
+ });
13243
+ this.selectedItems = [];
13234
13244
  }
13235
13245
  this.onSelect();
13236
13246
  console.debug("toggle all", this.selectedItems);
13247
+ this.$forceUpdate();
13237
13248
  },
13238
13249
  unSelectItem: function unSelectItem(item) {
13250
+ item.selected = false;
13239
13251
  this.selectedItems = this.selectedItems.filter(function (e) {
13240
13252
  return e.id != item.id;
13241
13253
  });
13242
- item.selected = false;
13243
13254
  },
13244
13255
  selectItem: function selectItem() {
13245
13256
  var _this6 = this;
@@ -13251,7 +13262,6 @@ n(css, {});function normalizeComponent (
13251
13262
  this.selectedItems = this.selectedItems.filter(function (e) {
13252
13263
  return e.id != _this6.item.id;
13253
13264
  });
13254
- this.item.selected = false;
13255
13265
  } else {
13256
13266
  this.item.selected = true;
13257
13267
  this.selectedItems.push(this.item);
@@ -13411,36 +13421,7 @@ n(css, {});function normalizeComponent (
13411
13421
  _this11.makePagination(response.data);
13412
13422
  var items = response.data.data;
13413
13423
  if (_this11.grouped) {
13414
- var itemswithgroup = [];
13415
- var lastcomparevalue = null;
13416
- var compareattr = _this11.groupedAttribute;
13417
- var groupLabelPre = _this11.groupedLabelPre;
13418
- var groupLabelAfter = _this11.groupedLabelAfter;
13419
- items.forEach(function (item, key) {
13420
- if (Array.isArray(item)) {
13421
- itemswithgroup.push({
13422
- label: groupLabelPre + key + groupLabelAfter,
13423
- group: true
13424
- });
13425
- item.forEach(function (sitem) {
13426
- itemswithgroup.push(sitem);
13427
- });
13428
- } else {
13429
- if (lastcomparevalue != item[compareattr]) {
13430
- lastcomparevalue = item[compareattr];
13431
- itemswithgroup.push({
13432
- crudgrouplabel: groupLabelPre + lastcomparevalue + groupLabelAfter,
13433
- crudgroup: true
13434
- });
13435
- }
13436
- itemswithgroup.push(item);
13437
- }
13438
- });
13439
- if (concat) {
13440
- _this11.items = _this11.items.concat(itemswithgroup);
13441
- } else {
13442
- _this11.items = itemswithgroup;
13443
- }
13424
+ _this11.groupItems(items, concat);
13444
13425
  } else {
13445
13426
  if (concat) {
13446
13427
  _this11.items = _this11.items.concat(items);
@@ -13459,6 +13440,39 @@ n(css, {});function normalizeComponent (
13459
13440
  _this11.fetchError = true;
13460
13441
  });
13461
13442
  },
13443
+ groupItems: function groupItems(items) {
13444
+ var concat = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
13445
+ var itemswithgroup = [];
13446
+ var lastcomparevalue = null;
13447
+ var compareattr = this.groupedAttribute;
13448
+ var groupLabelPre = this.groupedLabelPre;
13449
+ var groupLabelAfter = this.groupedLabelAfter;
13450
+ items.forEach(function (item, key) {
13451
+ if (Array.isArray(item)) {
13452
+ itemswithgroup.push({
13453
+ label: groupLabelPre + key + groupLabelAfter,
13454
+ group: true
13455
+ });
13456
+ item.forEach(function (sitem) {
13457
+ itemswithgroup.push(sitem);
13458
+ });
13459
+ } else {
13460
+ if (lastcomparevalue != item[compareattr]) {
13461
+ lastcomparevalue = item[compareattr];
13462
+ itemswithgroup.push({
13463
+ crudgrouplabel: groupLabelPre + lastcomparevalue + groupLabelAfter,
13464
+ crudgroup: true
13465
+ });
13466
+ }
13467
+ itemswithgroup.push(item);
13468
+ }
13469
+ });
13470
+ if (concat) {
13471
+ this.items = this.items.concat(itemswithgroup);
13472
+ } else {
13473
+ this.items = itemswithgroup;
13474
+ }
13475
+ },
13462
13476
  removeItem: function removeItem(id, index) {
13463
13477
  var _this12 = this;
13464
13478
  this.$bvModal.msgBoxConfirm(this.messageRemoveConfirm, {
@@ -15048,7 +15062,7 @@ var _sfc_render = function render() {
15048
15062
  }) : _vm._e()], 2)], 1);
15049
15063
  };
15050
15064
  var _sfc_staticRenderFns = [];
15051
- var __component__ = /*#__PURE__*/normalizeComponent(_sfc_main, _sfc_render, _sfc_staticRenderFns, false, null, "e80d091a", null, null);
15065
+ var __component__ = /*#__PURE__*/normalizeComponent(_sfc_main, _sfc_render, _sfc_staticRenderFns, false, null, "373bb24e", null, null);
15052
15066
  var component$1 = __component__.exports;// Import vue component
15053
15067
 
15054
15068
  // Default export is installable instance of component.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue-laravel-crud",
3
- "version": "1.6.16",
3
+ "version": "1.6.19",
4
4
  "description": "",
5
5
  "homepage": "https://github.com/clonixdev/vue-laravel-crud",
6
6
  "main": "dist/vue-laravel-crud.ssr.js",
@@ -419,7 +419,13 @@ export default /*#__PURE__*/ {
419
419
  if (this.ajax) {
420
420
  this.fetchItems();
421
421
  } else {
422
- this.items = this.models;
422
+
423
+ if (this.grouped) {
424
+ this.groupItems(this.models);
425
+ } else {
426
+ this.items = this.models;
427
+ }
428
+
423
429
  this.pagination.total = this.items.length;
424
430
  this.firstLoad = true;
425
431
  }
@@ -480,7 +486,15 @@ export default /*#__PURE__*/ {
480
486
  let filter = [];
481
487
  this.forceRecomputeCounter;
482
488
  this.internalFilters.forEach((f) => {
483
- if (f.value) filter.push([f.column, f.op, f.value]);
489
+
490
+
491
+
492
+ if (f.value){
493
+
494
+ let colname = f.column.replace("_sort","").replace("_from","").replace("_to","");
495
+
496
+ filter.push([colname, f.op, f.value]);
497
+ }
484
498
  });
485
499
  return filter;
486
500
  },
@@ -657,21 +671,29 @@ export default /*#__PURE__*/ {
657
671
  (item) => item.selected = true
658
672
  );
659
673
  }else{
660
- this.selectedItems = [];
661
674
  this.selectedItems.forEach(
662
675
  (item) => item.selected = false
663
676
  );
677
+ this.items.forEach(
678
+ (item) => item.selected = false
679
+ );
680
+ this.selectedItems = [];
681
+
664
682
  }
665
683
 
666
684
  this.onSelect();
667
685
 
668
686
  console.debug("toggle all",this.selectedItems);
687
+ this.$forceUpdate();
669
688
  },
670
689
  unSelectItem(item){
690
+
691
+ item.selected = false;
692
+
671
693
  this.selectedItems = this.selectedItems.filter(
672
694
  (e) => e.id != item.id
673
695
  );
674
- item.selected = false;
696
+
675
697
  },
676
698
  selectItem() {
677
699
  let sitem = this.selectedItems.find((e) => e.id == this.item.id);
@@ -680,7 +702,6 @@ export default /*#__PURE__*/ {
680
702
  this.selectedItems = this.selectedItems.filter(
681
703
  (e) => e.id != this.item.id
682
704
  );
683
- this.item.selected = false;
684
705
  } else {
685
706
  this.item.selected = true;
686
707
  this.selectedItems.push(this.item);
@@ -817,7 +838,30 @@ export default /*#__PURE__*/ {
817
838
  this.makePagination(response.data);
818
839
  let items = response.data.data;
819
840
  if (this.grouped) {
820
- let itemswithgroup = [];
841
+ this.groupItems(items,concat);
842
+ } else {
843
+ if (concat) {
844
+ this.items = this.items.concat(items);
845
+ } else {
846
+ this.items = items;
847
+ }
848
+ }
849
+
850
+ this.loading = false;
851
+ this.firstLoad = true;
852
+ this.$emit("afterFetch", {});
853
+ })
854
+ .catch((error) => {
855
+ //console.debug(error);
856
+ this.toastError(error);
857
+ this.loading = false;
858
+ this.firstLoad = true;
859
+ this.fetchError = true;
860
+ });
861
+ },
862
+
863
+ groupItems(items,concat = false){
864
+ let itemswithgroup = [];
821
865
  let lastcomparevalue = null;
822
866
  let compareattr = this.groupedAttribute;
823
867
  let groupLabelPre = this.groupedLabelPre;
@@ -848,25 +892,6 @@ export default /*#__PURE__*/ {
848
892
  } else {
849
893
  this.items = itemswithgroup;
850
894
  }
851
- } else {
852
- if (concat) {
853
- this.items = this.items.concat(items);
854
- } else {
855
- this.items = items;
856
- }
857
- }
858
-
859
- this.loading = false;
860
- this.firstLoad = true;
861
- this.$emit("afterFetch", {});
862
- })
863
- .catch((error) => {
864
- //console.debug(error);
865
- this.toastError(error);
866
- this.loading = false;
867
- this.firstLoad = true;
868
- this.fetchError = true;
869
- });
870
895
  },
871
896
  removeItem(id, index) {
872
897
  this.$bvModal