vue-laravel-crud 1.6.15 → 1.6.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.
@@ -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-2a26c95b]:last-child,\ntr td[data-v-2a26c95b]:first-child {\n width: 1%;\n white-space: nowrap; }\n\n.crud-pagination[data-v-2a26c95b] {\n display: flex;\n align-items: center;\n width: 100%;\n justify-content: center;\n margin-top: 1rem; }\n\n.crud-header[data-v-2a26c95b] {\n display: flex;\n justify-content: space-between;\n max-height: 3rem; }\n .crud-header[data-v-2a26c95b] .crud-title[data-v-2a26c95b] {\n margin: 0; }\n .crud-header[data-v-2a26c95b] .crud-search[data-v-2a26c95b] {\n max-width: 15rem; }\n .crud-header[data-v-2a26c95b] .crud-search[data-v-2a26c95b] .btn[data-v-2a26c95b] {\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-2a26c95b] .crud-search[data-v-2a26c95b] .btn[data-v-2a26c95b].open[data-v-2a26c95b] {\n border-top-right-radius: 0;\n border-bottom-right-radius: 0; }\n .crud-header[data-v-2a26c95b] .table-options[data-v-2a26c95b] {\n margin-bottom: 1rem;\n display: flex;\n align-items: center;\n justify-content: flex-end; }\n\n.custom-control[data-v-2a26c95b] {\n position: relative; }\n\n@media (min-width: 992px) {\n .table[data-v-2a26c95b] {\n table-layout: auto; }\n .table[data-v-2a26c95b] tbody[data-v-2a26c95b] td[data-v-2a26c95b] {\n overflow: scroll;\n -ms-overflow-style: none;\n /* IE and Edge */\n scrollbar-width: none;\n /* Firefox */ }\n .table[data-v-2a26c95b] tbody[data-v-2a26c95b] td[data-v-2a26c95b]::-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-98af7782]:last-child,\ntr td[data-v-98af7782]:first-child {\n width: 1%;\n white-space: nowrap; }\n\n.crud-pagination[data-v-98af7782] {\n display: flex;\n align-items: center;\n width: 100%;\n justify-content: center;\n margin-top: 1rem; }\n\n.crud-header[data-v-98af7782] {\n display: flex;\n justify-content: space-between;\n max-height: 3rem; }\n .crud-header[data-v-98af7782] .crud-title[data-v-98af7782] {\n margin: 0; }\n .crud-header[data-v-98af7782] .crud-search[data-v-98af7782] {\n max-width: 15rem; }\n .crud-header[data-v-98af7782] .crud-search[data-v-98af7782] .btn[data-v-98af7782] {\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-98af7782] .crud-search[data-v-98af7782] .btn[data-v-98af7782].open[data-v-98af7782] {\n border-top-right-radius: 0;\n border-bottom-right-radius: 0; }\n .crud-header[data-v-98af7782] .table-options[data-v-98af7782] {\n margin-bottom: 1rem;\n display: flex;\n align-items: center;\n justify-content: flex-end; }\n\n.custom-control[data-v-98af7782] {\n position: relative; }\n\n@media (min-width: 992px) {\n .table[data-v-98af7782] {\n table-layout: auto; }\n .table[data-v-98af7782] tbody[data-v-98af7782] td[data-v-98af7782] {\n overflow: scroll;\n -ms-overflow-style: none;\n /* IE and Edge */\n scrollbar-width: none;\n /* Firefox */ }\n .table[data-v-98af7782] tbody[data-v-98af7782] td[data-v-98af7782]::-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
  }
@@ -13220,20 +13224,21 @@ n(css, {});function normalizeComponent (
13220
13224
  this.onSelect();
13221
13225
  console.debug("Selected Items", this.selectedItems);
13222
13226
  },
13223
- toggleAll: function toggleAll() {
13224
- if (this.selectedItems.length > 0) {
13225
- this.selectedItems = [];
13227
+ toggleAll: function toggleAll(value) {
13228
+ if (value) {
13229
+ this.selectedItems = this.items;
13226
13230
  this.selectedItems.forEach(function (item) {
13227
- return item.selected = false;
13231
+ return item.selected = true;
13228
13232
  });
13229
13233
  } else {
13230
- this.selectedItems = this.items;
13234
+ this.selectedItems = [];
13231
13235
  this.selectedItems.forEach(function (item) {
13232
- return item.selected = true;
13236
+ return item.selected = false;
13233
13237
  });
13234
13238
  }
13235
13239
  this.onSelect();
13236
13240
  console.debug("toggle all", this.selectedItems);
13241
+ this.$forceUpdate();
13237
13242
  },
13238
13243
  unSelectItem: function unSelectItem(item) {
13239
13244
  this.selectedItems = this.selectedItems.filter(function (e) {
@@ -13411,36 +13416,7 @@ n(css, {});function normalizeComponent (
13411
13416
  _this11.makePagination(response.data);
13412
13417
  var items = response.data.data;
13413
13418
  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
- }
13419
+ _this11.groupItems(items, concat);
13444
13420
  } else {
13445
13421
  if (concat) {
13446
13422
  _this11.items = _this11.items.concat(items);
@@ -13459,6 +13435,39 @@ n(css, {});function normalizeComponent (
13459
13435
  _this11.fetchError = true;
13460
13436
  });
13461
13437
  },
13438
+ groupItems: function groupItems(items) {
13439
+ var concat = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
13440
+ var itemswithgroup = [];
13441
+ var lastcomparevalue = null;
13442
+ var compareattr = this.groupedAttribute;
13443
+ var groupLabelPre = this.groupedLabelPre;
13444
+ var groupLabelAfter = this.groupedLabelAfter;
13445
+ items.forEach(function (item, key) {
13446
+ if (Array.isArray(item)) {
13447
+ itemswithgroup.push({
13448
+ label: groupLabelPre + key + groupLabelAfter,
13449
+ group: true
13450
+ });
13451
+ item.forEach(function (sitem) {
13452
+ itemswithgroup.push(sitem);
13453
+ });
13454
+ } else {
13455
+ if (lastcomparevalue != item[compareattr]) {
13456
+ lastcomparevalue = item[compareattr];
13457
+ itemswithgroup.push({
13458
+ crudgrouplabel: groupLabelPre + lastcomparevalue + groupLabelAfter,
13459
+ crudgroup: true
13460
+ });
13461
+ }
13462
+ itemswithgroup.push(item);
13463
+ }
13464
+ });
13465
+ if (concat) {
13466
+ this.items = this.items.concat(itemswithgroup);
13467
+ } else {
13468
+ this.items = itemswithgroup;
13469
+ }
13470
+ },
13462
13471
  removeItem: function removeItem(id, index) {
13463
13472
  var _this12 = this;
13464
13473
  this.$bvModal.msgBoxConfirm(this.messageRemoveConfirm, {
@@ -14557,7 +14566,7 @@ var _sfc_render = function render() {
14557
14566
  },
14558
14567
  on: {
14559
14568
  "change": function change($event) {
14560
- return _vm.toggleAll();
14569
+ return _vm.toggleAll($event);
14561
14570
  }
14562
14571
  }
14563
14572
  }) : column.type == 'select' ? _c('b-form-checkbox', {
@@ -14566,7 +14575,7 @@ var _sfc_render = function render() {
14566
14575
  },
14567
14576
  on: {
14568
14577
  "change": function change($event) {
14569
- return _vm.toggleAll();
14578
+ return _vm.toggleAll($event);
14570
14579
  }
14571
14580
  }
14572
14581
  }) : _c('input', {
@@ -14603,7 +14612,7 @@ var _sfc_render = function render() {
14603
14612
  },
14604
14613
  on: {
14605
14614
  "change": function change($event) {
14606
- return _vm.toggleAll();
14615
+ return _vm.toggleAll($event);
14607
14616
  }
14608
14617
  }
14609
14618
  })], 1) : _c('span', [_vm._v(_vm._s(column.label))]), _vm.sortable && column.type != 'select' && column.type != 'checkbox' && _vm.internalFilterByProp(column.prop + '_sort') ? _c('span', {
@@ -15048,7 +15057,7 @@ var _sfc_render = function render() {
15048
15057
  }) : _vm._e()], 2)], 1);
15049
15058
  };
15050
15059
  var _sfc_staticRenderFns = [];
15051
- var __component__ = /*#__PURE__*/normalizeComponent(_sfc_main, _sfc_render, _sfc_staticRenderFns, false, null, "2a26c95b", null, null);
15060
+ var __component__ = /*#__PURE__*/normalizeComponent(_sfc_main, _sfc_render, _sfc_staticRenderFns, false, null, "98af7782", null, null);
15052
15061
  var component$1 = __component__.exports;// Import vue component
15053
15062
 
15054
15063
  // 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.15",
3
+ "version": "1.6.17",
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
  }
@@ -647,23 +653,26 @@ export default /*#__PURE__*/ {
647
653
  this.onSelect();
648
654
  console.debug("Selected Items",this.selectedItems);
649
655
  },
650
- toggleAll() {
651
- if (this.selectedItems.length > 0) {
652
- this.selectedItems = [];
653
- this.selectedItems.forEach(
654
- (item) => item.selected = false
655
- );
656
- } else {
656
+ toggleAll(value) {
657
+
658
+
659
+ if(value){
657
660
  this.selectedItems = this.items;
658
661
 
659
662
  this.selectedItems.forEach(
660
663
  (item) => item.selected = true
661
664
  );
665
+ }else{
666
+ this.selectedItems = [];
667
+ this.selectedItems.forEach(
668
+ (item) => item.selected = false
669
+ );
662
670
  }
663
671
 
664
672
  this.onSelect();
665
673
 
666
674
  console.debug("toggle all",this.selectedItems);
675
+ this.$forceUpdate();
667
676
  },
668
677
  unSelectItem(item){
669
678
  this.selectedItems = this.selectedItems.filter(
@@ -815,7 +824,30 @@ export default /*#__PURE__*/ {
815
824
  this.makePagination(response.data);
816
825
  let items = response.data.data;
817
826
  if (this.grouped) {
818
- let itemswithgroup = [];
827
+ this.groupItems(items,concat);
828
+ } else {
829
+ if (concat) {
830
+ this.items = this.items.concat(items);
831
+ } else {
832
+ this.items = items;
833
+ }
834
+ }
835
+
836
+ this.loading = false;
837
+ this.firstLoad = true;
838
+ this.$emit("afterFetch", {});
839
+ })
840
+ .catch((error) => {
841
+ //console.debug(error);
842
+ this.toastError(error);
843
+ this.loading = false;
844
+ this.firstLoad = true;
845
+ this.fetchError = true;
846
+ });
847
+ },
848
+
849
+ groupItems(items,concat = false){
850
+ let itemswithgroup = [];
819
851
  let lastcomparevalue = null;
820
852
  let compareattr = this.groupedAttribute;
821
853
  let groupLabelPre = this.groupedLabelPre;
@@ -846,25 +878,6 @@ export default /*#__PURE__*/ {
846
878
  } else {
847
879
  this.items = itemswithgroup;
848
880
  }
849
- } else {
850
- if (concat) {
851
- this.items = this.items.concat(items);
852
- } else {
853
- this.items = items;
854
- }
855
- }
856
-
857
- this.loading = false;
858
- this.firstLoad = true;
859
- this.$emit("afterFetch", {});
860
- })
861
- .catch((error) => {
862
- //console.debug(error);
863
- this.toastError(error);
864
- this.loading = false;
865
- this.firstLoad = true;
866
- this.fetchError = true;
867
- });
868
881
  },
869
882
  removeItem(id, index) {
870
883
  this.$bvModal
@@ -1589,10 +1602,10 @@ export default /*#__PURE__*/ {
1589
1602
  </option>
1590
1603
  </select>
1591
1604
 
1592
- <b-form-checkbox v-else-if="column.type == 'checkbox'" name="select-all" @change="toggleAll()">
1605
+ <b-form-checkbox v-else-if="column.type == 'checkbox'" name="select-all" @change="toggleAll($event)">
1593
1606
  </b-form-checkbox>
1594
1607
 
1595
- <b-form-checkbox v-else-if="column.type == 'select'" name="select-all" @change="toggleAll()">
1608
+ <b-form-checkbox v-else-if="column.type == 'select'" name="select-all" @change="toggleAll($event)">
1596
1609
  </b-form-checkbox>
1597
1610
 
1598
1611
  <input v-else class="form-control form-control-md p-2"
@@ -1602,7 +1615,7 @@ export default /*#__PURE__*/ {
1602
1615
  </div>
1603
1616
  </slot>
1604
1617
  <span v-else-if="column.type == 'select'">
1605
- <b-form-checkbox name="select-all" @change="toggleAll()"></b-form-checkbox>
1618
+ <b-form-checkbox name="select-all" @change="toggleAll($event)"></b-form-checkbox>
1606
1619
  </span>
1607
1620
  <span v-else>{{ column.label }}</span>
1608
1621