vue-laravel-crud 1.8.3 → 1.8.5

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.
@@ -12311,7 +12311,7 @@ var ItemCard = __component__$1.exports;
12311
12311
 
12312
12312
  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}}
12313
12313
 
12314
- var css = "tr td[data-v-6e210e48]:last-child,\ntr td[data-v-6e210e48]:first-child {\n width: 1%;\n white-space: nowrap; }\n\n.crud-pagination[data-v-6e210e48] {\n display: flex;\n align-items: center;\n width: 100%;\n justify-content: center;\n margin-top: 1rem; }\n\n.crud-header[data-v-6e210e48] {\n display: flex;\n justify-content: space-between;\n max-height: 3rem; }\n .crud-header[data-v-6e210e48] .crud-title[data-v-6e210e48] {\n margin: 0; }\n .crud-header[data-v-6e210e48] .crud-search[data-v-6e210e48] {\n max-width: 15rem; }\n .crud-header[data-v-6e210e48] .crud-search[data-v-6e210e48] .btn[data-v-6e210e48] {\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-6e210e48] .crud-search[data-v-6e210e48] .btn[data-v-6e210e48].open[data-v-6e210e48] {\n border-top-right-radius: 0;\n border-bottom-right-radius: 0; }\n .crud-header[data-v-6e210e48] .table-options[data-v-6e210e48] {\n margin-bottom: 1rem;\n display: flex;\n align-items: center;\n justify-content: flex-end; }\n\n.custom-control[data-v-6e210e48] {\n position: relative; }\n\n@media (min-width: 992px) {\n .table[data-v-6e210e48] {\n table-layout: auto; }\n .table[data-v-6e210e48] tbody[data-v-6e210e48] td[data-v-6e210e48] {\n overflow: scroll;\n -ms-overflow-style: none;\n /* IE and Edge */\n scrollbar-width: none;\n /* Firefox */ }\n .table[data-v-6e210e48] tbody[data-v-6e210e48] td[data-v-6e210e48]::-webkit-scrollbar {\n display: none; } }\n\n.kanban-board[data-v-6e210e48] {\n display: flex;\n gap: 1rem;\n overflow-x: auto;\n padding: 1rem; }\n\n.kanban-column[data-v-6e210e48] {\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-6e210e48] {\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-6e210e48] {\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-6e210e48] {\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";
12314
+ var css = "tr td[data-v-77ea2533]:last-child,\ntr td[data-v-77ea2533]:first-child {\n width: 1%;\n white-space: nowrap; }\n\n.crud-pagination[data-v-77ea2533] {\n display: flex;\n align-items: center;\n width: 100%;\n justify-content: center;\n margin-top: 1rem; }\n\n.crud-header[data-v-77ea2533] {\n display: flex;\n justify-content: space-between;\n max-height: 3rem; }\n .crud-header[data-v-77ea2533] .crud-title[data-v-77ea2533] {\n margin: 0; }\n .crud-header[data-v-77ea2533] .crud-search[data-v-77ea2533] {\n max-width: 15rem; }\n .crud-header[data-v-77ea2533] .crud-search[data-v-77ea2533] .btn[data-v-77ea2533] {\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-77ea2533] .crud-search[data-v-77ea2533] .btn[data-v-77ea2533].open[data-v-77ea2533] {\n border-top-right-radius: 0;\n border-bottom-right-radius: 0; }\n .crud-header[data-v-77ea2533] .table-options[data-v-77ea2533] {\n margin-bottom: 1rem;\n display: flex;\n align-items: center;\n justify-content: flex-end; }\n\n.custom-control[data-v-77ea2533] {\n position: relative; }\n\n@media (min-width: 992px) {\n .table[data-v-77ea2533] {\n table-layout: auto; }\n .table[data-v-77ea2533] tbody[data-v-77ea2533] td[data-v-77ea2533] {\n overflow: scroll;\n -ms-overflow-style: none;\n /* IE and Edge */\n scrollbar-width: none;\n /* Firefox */ }\n .table[data-v-77ea2533] tbody[data-v-77ea2533] td[data-v-77ea2533]::-webkit-scrollbar {\n display: none; } }\n\n.kanban-board[data-v-77ea2533] {\n display: flex;\n gap: 1rem;\n overflow-x: auto;\n padding: 1rem; }\n\n.kanban-column[data-v-77ea2533] {\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-77ea2533] {\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-77ea2533] {\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-77ea2533] {\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";
12315
12315
  n(css, {});
12316
12316
 
12317
12317
  const _sfc_main = {
@@ -12629,6 +12629,10 @@ const _sfc_main = {
12629
12629
  type: String,
12630
12630
  default: ""
12631
12631
  },
12632
+ groupedSplit: {
12633
+ type: Boolean,
12634
+ default: false
12635
+ },
12632
12636
  draggableGroup: {
12633
12637
  type: String,
12634
12638
  default: "people"
@@ -12751,6 +12755,12 @@ const _sfc_main = {
12751
12755
  }
12752
12756
  };
12753
12757
  },
12758
+ isSplitGroups() {
12759
+ if (this.groupedSplit) {
12760
+ return true;
12761
+ }
12762
+ return this.displayMode == this.displayModes.MODE_KANBAN;
12763
+ },
12754
12764
  itemsList() {
12755
12765
  const items = this.ajax ? this.items : this.items.slice(this.paginationIndexStart, this.paginationIndexEnd);
12756
12766
  if (this.masonrySort && !this.isMobile) {
@@ -13081,6 +13091,7 @@ const _sfc_main = {
13081
13091
  } else {
13082
13092
  this.model.deleteAll();
13083
13093
  result = await this.model.api().get(this.apiUrl + "/" + this.modelName, {
13094
+ dataKey: 'data',
13084
13095
  params: {
13085
13096
  page: page,
13086
13097
  limit: this.pagination.perPage,
@@ -13127,7 +13138,7 @@ const _sfc_main = {
13127
13138
  let items = response.data.data;
13128
13139
  if (this.grouped) {
13129
13140
  //this.items = items;
13130
- this.groupItems(items, concat);
13141
+ this.groupItems(items, concat, this.isSplitGroups);
13131
13142
  } else {
13132
13143
  if (concat) {
13133
13144
  this.items = this.items.concat(items);
@@ -13146,36 +13157,44 @@ const _sfc_main = {
13146
13157
  this.fetchError = true;
13147
13158
  });
13148
13159
  },
13149
- groupItems(items, concat = false) {
13150
- let itemswithgroup = [];
13151
- let lastcomparevalue = null;
13152
- let compareattr = this.groupedAttribute;
13153
- let groupLabelPre = this.groupedLabelPre;
13154
- let groupLabelAfter = this.groupedLabelAfter;
13155
- items.forEach((item, key) => {
13156
- if (Array.isArray(item)) {
13157
- itemswithgroup.push({
13158
- label: groupLabelPre + key + groupLabelAfter,
13159
- group: true
13160
- });
13161
- item.forEach(sitem => {
13162
- itemswithgroup.push(sitem);
13160
+ groupItems(items, concat = false, splitGroups = false) {
13161
+ const groupedAttribute = this.groupedAttribute;
13162
+ const groupLabelPre = this.groupedLabelPre || '';
13163
+ const groupLabelAfter = this.groupedLabelAfter || '';
13164
+ const itemsWithGroup = [];
13165
+
13166
+ // Usamos un objeto para agrupar los elementos por groupedAttribute
13167
+ const groupedMap = items.reduce((acc, item) => {
13168
+ const groupKey = item[groupedAttribute] || 'undefined';
13169
+ if (!acc[groupKey]) {
13170
+ acc[groupKey] = [];
13171
+ }
13172
+ acc[groupKey].push(item);
13173
+ return acc;
13174
+ }, {});
13175
+ if (splitGroups) {
13176
+ // Dividimos los grupos en arrays separados
13177
+ this.items = Object.entries(groupedMap).map(([groupKey, groupItems]) => ({
13178
+ groupKey,
13179
+ groupLabel: groupLabelPre + groupKey + groupLabelAfter,
13180
+ items: groupItems
13181
+ }));
13182
+ } else {
13183
+ // Creamos la estructura agrupada en un solo array
13184
+ for (const [groupKey, groupItems] of Object.entries(groupedMap)) {
13185
+ itemsWithGroup.push({
13186
+ crudgrouplabel: groupLabelPre + groupKey + groupLabelAfter,
13187
+ crudgroup: true
13163
13188
  });
13189
+ itemsWithGroup.push(...groupItems);
13190
+ }
13191
+
13192
+ // Decidimos si concatenar o reemplazar los items existentes
13193
+ if (concat) {
13194
+ this.items = this.items.concat(itemsWithGroup);
13164
13195
  } else {
13165
- if (lastcomparevalue != item[compareattr]) {
13166
- lastcomparevalue = item[compareattr];
13167
- itemswithgroup.push({
13168
- crudgrouplabel: groupLabelPre + lastcomparevalue + groupLabelAfter,
13169
- crudgroup: true
13170
- });
13171
- }
13172
- itemswithgroup.push(item);
13196
+ this.items = itemsWithGroup;
13173
13197
  }
13174
- });
13175
- if (concat) {
13176
- this.items = this.items.concat(itemswithgroup);
13177
- } else {
13178
- this.items = itemswithgroup;
13179
13198
  }
13180
13199
  },
13181
13200
  removeItem(id, index) {
@@ -14460,29 +14479,26 @@ var _sfc_render = function render() {
14460
14479
  700: '15px'
14461
14480
  }
14462
14481
  }
14463
- }, _vm._l(_vm.itemsList, function (item, index) {
14482
+ }, _vm._l(_vm.itemsList, function (item, itemIndex) {
14464
14483
  return _c('div', {
14465
- key: index,
14484
+ key: itemIndex,
14466
14485
  staticClass: "item"
14467
14486
  }, [_vm._t("card", function () {
14468
- return _vm._l(_vm.itemsList, function (item, index) {
14469
- return _c('ItemCard', {
14470
- key: index,
14471
- attrs: {
14472
- "item": item,
14473
- "columns": _vm.columns,
14474
- "index": index,
14475
- "cardClass": _vm.cardClass,
14476
- "cardHideFooter": _vm.cardHideFooter,
14477
- "itemValue": _vm.itemValue,
14478
- "getStateValue": _vm.getStateValue,
14479
- "getArrayValue": _vm.getArrayValue,
14480
- "showItem": _vm.showItem,
14481
- "updateItem": _vm.updateItem,
14482
- "removeItem": _vm.removeItem
14483
- }
14484
- });
14485
- });
14487
+ return [_c('ItemCard', {
14488
+ attrs: {
14489
+ "item": item,
14490
+ "columns": _vm.columns,
14491
+ "index": itemIndex,
14492
+ "cardClass": _vm.cardClass,
14493
+ "cardHideFooter": _vm.cardHideFooter,
14494
+ "itemValue": _vm.itemValue,
14495
+ "getStateValue": _vm.getStateValue,
14496
+ "getArrayValue": _vm.getArrayValue,
14497
+ "showItem": _vm.showItem,
14498
+ "updateItem": _vm.updateItem,
14499
+ "removeItem": _vm.removeItem
14500
+ }
14501
+ })];
14486
14502
  }, {
14487
14503
  "item": item
14488
14504
  })], 2);
@@ -14494,7 +14510,7 @@ var _sfc_render = function render() {
14494
14510
  staticClass: "kanban-column"
14495
14511
  }, [_c('div', {
14496
14512
  staticClass: "kanban-column-header"
14497
- }, [_vm._v(" " + _vm._s(colIndex) + " ")]), _vm._v(" " + _vm._s(JSON.stringify(column)) + " "), _c('draggable', {
14513
+ }, [_vm._v(" " + _vm._s(column.groupLabel) + " ")]), _vm._v(" " + _vm._s(JSON.stringify(column)) + " "), _c('draggable', {
14498
14514
  staticClass: "kanban-column-body",
14499
14515
  attrs: {
14500
14516
  "group": "kanban"
@@ -14509,29 +14525,27 @@ var _sfc_render = function render() {
14509
14525
  },
14510
14526
  expression: "column.items"
14511
14527
  }
14512
- }, _vm._l(_vm.itemsList, function (item, index) {
14528
+ }, _vm._l(column.items, function (item, itemIndex) {
14513
14529
  return _c('div', {
14514
- key: index,
14530
+ key: itemIndex,
14515
14531
  staticClass: "item"
14516
14532
  }, [_vm._t("card", function () {
14517
- return _vm._l(_vm.itemsList, function (item, index) {
14518
- return _c('ItemCard', {
14519
- key: index,
14520
- attrs: {
14521
- "item": item,
14522
- "columns": _vm.columns,
14523
- "index": index,
14524
- "cardClass": _vm.cardClass,
14525
- "cardHideFooter": _vm.cardHideFooter,
14526
- "itemValue": _vm.itemValue,
14527
- "getStateValue": _vm.getStateValue,
14528
- "getArrayValue": _vm.getArrayValue,
14529
- "showItem": _vm.showItem,
14530
- "updateItem": _vm.updateItem,
14531
- "removeItem": _vm.removeItem
14532
- }
14533
- });
14534
- });
14533
+ return [_c('ItemCard', {
14534
+ key: itemIndex,
14535
+ attrs: {
14536
+ "item": item,
14537
+ "columns": _vm.columns,
14538
+ "index": _vm.index,
14539
+ "cardClass": _vm.cardClass,
14540
+ "cardHideFooter": _vm.cardHideFooter,
14541
+ "itemValue": _vm.itemValue,
14542
+ "getStateValue": _vm.getStateValue,
14543
+ "getArrayValue": _vm.getArrayValue,
14544
+ "showItem": _vm.showItem,
14545
+ "updateItem": _vm.updateItem,
14546
+ "removeItem": _vm.removeItem
14547
+ }
14548
+ })];
14535
14549
  }, {
14536
14550
  "item": item
14537
14551
  })], 2);
@@ -14817,7 +14831,7 @@ var _sfc_render = function render() {
14817
14831
  }) : _vm._e()], 2) : _vm._e()], 1);
14818
14832
  };
14819
14833
  var _sfc_staticRenderFns = [];
14820
- var __component__ = /*#__PURE__*/normalizeComponent(_sfc_main, _sfc_render, _sfc_staticRenderFns, false, null, "6e210e48", null, null);
14834
+ var __component__ = /*#__PURE__*/normalizeComponent(_sfc_main, _sfc_render, _sfc_staticRenderFns, false, null, "77ea2533", null, null);
14821
14835
  var component = __component__.exports;
14822
14836
 
14823
14837
  // Import vue component