vue-laravel-crud 1.6.3 → 1.6.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue-laravel-crud",
3
- "version": "1.6.3",
3
+ "version": "1.6.5",
4
4
  "description": "",
5
5
  "homepage": "https://github.com/clonixdev/vue-laravel-crud",
6
6
  "main": "dist/vue-laravel-crud.ssr.js",
@@ -2,7 +2,6 @@
2
2
  import draggable from "vuedraggable";
3
3
  import moment from "moment";
4
4
  import InfiniteLoading from 'vue-infinite-loading';
5
- import Vue from 'vue'
6
5
  import VueMasonry from 'vue-masonry-css'
7
6
 
8
7
 
@@ -175,6 +174,11 @@ export default /*#__PURE__*/ {
175
174
  type: Boolean,
176
175
  default: true,
177
176
  },
177
+ showPrincipalSortBtn: {
178
+ type: Boolean,
179
+ default: false,
180
+ },
181
+
178
182
  showHeader: {
179
183
  type: Boolean,
180
184
  default: true,
@@ -213,7 +217,7 @@ export default /*#__PURE__*/ {
213
217
  type: Number,
214
218
  },
215
219
  colXl: {
216
- default: 3,
220
+ default: 4,
217
221
  type: Number,
218
222
  },
219
223
 
@@ -334,6 +338,10 @@ export default /*#__PURE__*/ {
334
338
  default: 3,
335
339
  },
336
340
 
341
+ principalSortColumn: {
342
+ type: String,
343
+ default: "id",
344
+ },
337
345
  },
338
346
 
339
347
  mounted() {
@@ -441,9 +449,22 @@ export default /*#__PURE__*/ {
441
449
  return [
442
450
  ...this.filters,
443
451
  ...this.filter,
444
- ...this.internalFilter
452
+ ...this.internalFilter,
453
+ ...this.sortFilter
445
454
  ];
446
455
  },
456
+ sortFilter(){
457
+ if(this.showPrincipalSortBtn){
458
+ if(this.principalSort){
459
+ return [[this.principalSortColumn,'SORTASC','']];
460
+ }else{
461
+ return [[this.principalSortColumn,'SORTDESC','']];
462
+ }
463
+ }else{
464
+ return [];
465
+ }
466
+
467
+ },
447
468
  internalFilter() {
448
469
  let filter = [];
449
470
  this.forceRecomputeCounter;
@@ -468,6 +489,13 @@ export default /*#__PURE__*/ {
468
489
  // Actualizar isMobile cuando cambia el tamaño de la pantalla
469
490
  this.isMobile = window.matchMedia("(max-width: 1024px)").matches;
470
491
  },
492
+
493
+ togglePrincipalSort(){
494
+ this.principalSort = !this.principalSort;
495
+ setTimeout(() => {
496
+ this.refresh();
497
+ }, 1);
498
+ },
471
499
  infiniteHandler($state) {
472
500
 
473
501
 
@@ -1257,7 +1285,6 @@ export default /*#__PURE__*/ {
1257
1285
  <div class="crud">
1258
1286
  <div class="crud-header" v-if="showHeader">
1259
1287
  <h4 class="crud-title" v-if="showTitle">{{ title }}</h4>
1260
-
1261
1288
  <b-sidebar v-model="filterSidebarOpen" title="Filtrar" right shadow>
1262
1289
  <slot name="sidebarFilters" v-bind:createItem="createItem" v-bind:toggleDisplayMode="toggleDisplayMode"
1263
1290
  v-bind:loading="loading" v-bind:isColumnHasFilter="isColumnHasFilter" v-bind:setFilter="setFilter">
@@ -1357,14 +1384,15 @@ export default /*#__PURE__*/ {
1357
1384
  <slot name="tableActions" v-bind:createItem="createItem" v-bind:toggleDisplayMode="toggleDisplayMode"
1358
1385
  v-bind:loading="loading">
1359
1386
  <slot name="tableActionsPrepend" v-bind:loading="loading"> </slot>
1387
+ <b-button variant="success" v-if="showPrincipalSortBtn" @click="togglePrincipalSort()" :disabled="loading">
1388
+ <b-icon-sort-numeric-down v-if="principalSort"></b-icon-sort-numeric-down>
1389
+ <b-icon-sort-numeric-up v-else></b-icon-sort-numeric-up>
1390
+ </b-button>
1360
1391
  <b-button variant="success" v-if="showCreateBtn" @click="createItem()" :disabled="loading">
1361
1392
  <b-icon-plus></b-icon-plus>{{ messageNew }}
1362
1393
  </b-button>
1363
-
1364
1394
  <b-button v-if="enableFilters" @click="toggleFilters()">Filtros</b-button>
1365
-
1366
1395
  <b-button @click="refresh()"><b-icon-arrow-clockwise></b-icon-arrow-clockwise></b-button>
1367
-
1368
1396
  <b-button variant="info" @click="toggleDisplayMode()" :disabled="loading" v-if="displayModeToggler">
1369
1397
  <b-icon-card-list v-if="displayMode == displayModes.MODE_TABLE"></b-icon-card-list>
1370
1398
  <b-icon-table v-if="displayMode == displayModes.MODE_CARDS"></b-icon-table>
@@ -1563,7 +1591,7 @@ export default /*#__PURE__*/ {
1563
1591
  @start="drag = true" @end="drag = false" @sort="onSort()" @add="onDraggableAdded($event)"
1564
1592
  @change="onDraggableChange($event)" :options="draggableOptions">
1565
1593
  <masonry
1566
- :cols="{default: colLg, 1400: colXl, 1200: colLg, 1000: colMd, 700: colSm, 400: colXs}"
1594
+ :cols="{default: 12/colLg, 1400: 12/colXl, 1200: 12/colLg, 1000: 12/colMd, 700: 12/colSm, 400: 12/colXs}"
1567
1595
  :gutter="{default: '15px', 700: '15px'}"
1568
1596
  >
1569
1597