quasar-factory-lib 0.0.87 → 0.0.88

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
@@ -5,6 +5,7 @@
5
5
  "pinia": "^3.0.1",
6
6
  "quasar": "^2.18.0",
7
7
  "vue": "^3.5.11",
8
+ "vue-draggable-plus": "^0.6.0",
8
9
  "vue-i18n": "^10.0.4"
9
10
  },
10
11
  "description": "Quasar Library",
@@ -97,6 +98,6 @@
97
98
  "release": "standard-version"
98
99
  },
99
100
  "type": "module",
100
- "version": "0.0.87",
101
+ "version": "0.0.88",
101
102
  "author": ""
102
103
  }
@@ -1,7 +1,4 @@
1
1
  <template lang="">
2
- <!-- eslint-disable-file vue/no-v-model-argument -->
3
- <!-- eslint-disable vue/no-v-model-argument -->
4
- <!-- eslint-disable vue/no-use-v-if-with-v-for -->
5
2
  <div>
6
3
  <q-table
7
4
  v-if="!showSkeleton"
@@ -128,6 +125,7 @@ import TableSlotGrid from './components/TableSlotGrid.vue'
128
125
  import TableFilter from './components/TableFilter.vue'
129
126
  import TableSkeleton from './components/TableSkeleton.vue'
130
127
  import CardListSkeleton from './components/CardListSkeleton.vue'
128
+ import {useDraggable} from 'vue-draggable-plus'
131
129
 
132
130
  export default defineComponent({
133
131
  components: {
@@ -232,7 +230,8 @@ export default defineComponent({
232
230
  'onUpdateSelected',
233
231
  'setLineRemainingQty',
234
232
  'setLineNoStock',
235
- 'onDoneLineMaintenanceTasks'
233
+ 'onDoneLineMaintenanceTasks',
234
+ 'reprintSULabel'
236
235
  ],
237
236
  data () {
238
237
  return {
@@ -249,7 +248,12 @@ export default defineComponent({
249
248
  pageSize: 20,
250
249
  filteredRows: [] as object [] | [],
251
250
  showAdvancedFilter: false,
252
- advancedFiltersData: {}
251
+ advancedFiltersData: {},
252
+ tableRef: null,
253
+ draggableInstance: null,
254
+ disabled: false,
255
+ enableDragAndDrop: false,
256
+ dragAndDropDelay: 0
253
257
  }
254
258
  },
255
259
  computed: {
@@ -260,7 +264,6 @@ export default defineComponent({
260
264
  return !this.smallDevice || this.showSearch
261
265
  },
262
266
  showGridHeader () {
263
- // return this.selectionType === 'multiple'
264
267
  return this.selectionType === 'multiple' || this.showAdvancedFilter
265
268
  },
266
269
  getTableSkeletonVisibility () {
@@ -284,16 +287,56 @@ export default defineComponent({
284
287
  rows (val) {
285
288
  this.rowsData = val
286
289
  },
287
- showAdvancedFilter (val: boolean) {
290
+ showAdvancedFilter (val: boolean): void {
288
291
  if (!val) {
289
292
  this.advancedFiltersData = {}
290
293
  }
294
+ },
295
+ enableDragAndDrop (val): void {
296
+ if (val) {
297
+ this.enableDragAndDropFunc()
298
+ }
299
+ },
300
+ smallDevice (val): void {
301
+ if(val) {
302
+ this.dragAndDropDelay = 200
303
+ } else {
304
+ this.dragAndDropDelay = 0
305
+ }
291
306
  }
292
307
  },
293
308
  mounted () {
294
309
  this.getAdvancedFilterColumns()
295
310
  },
296
311
  methods: {
312
+ enableDragAndDropFunc (): void {
313
+ this.dragAndDropDelay = this.smallDevice ? 200: 0
314
+ if (this.smallDevice) {
315
+ this.tableRef = document.querySelector('.q-table__grid-content')
316
+ } else {
317
+ this.tableRef = document.querySelector('.q-table tbody')
318
+ }
319
+ const self = this
320
+ if (this.tableRef) {
321
+ this.draggableInstance = useDraggable(this.tableRef, this.rows, {
322
+ animation: 100,
323
+ delay: self.dragAndDropDelay,
324
+
325
+ onStart () {
326
+ console.log('start')
327
+ },
328
+ onUpdate (e) {
329
+ console.log(e, 'onUpdate')
330
+ const {oldIndex, newIndex} = e
331
+ console.log(oldIndex, newIndex, self.rows)
332
+ self.rowsData = [...self.rows]
333
+ },
334
+ onEnd(e) {
335
+ console.log(e, 'end drag')
336
+ }
337
+ })
338
+ }
339
+ },
297
340
  getSelectedString (val: number): string {
298
341
  const rowsSelectedLength = val
299
342
  if (rowsSelectedLength === 0) {
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <q-badge
3
- class="cursor-pointer"
3
+ class="cursor-pointer q-pt-sm q-pb-sm"
4
4
  :data-cy="'badge' + dataCy"
5
5
  :class="badgeColor"
6
6
  :text-color="badgeTextColor"
@@ -12,6 +12,7 @@
12
12
  option-value="name"
13
13
  options-cover
14
14
  class="columns-selector"
15
+ data-cy="columns-selector"
15
16
  options-selected-class="addicional-visible-columns"
16
17
  @update:model-value="onSelectVisibleColumns"
17
18
  >
@@ -19,6 +20,7 @@
19
20
  <q-item
20
21
  v-bind="scope.itemProps"
21
22
  :class="scope.opt.required ? 'required-table-columns' : ''"
23
+ :data-cy="'column-option-'+scope.opt.name"
22
24
  >
23
25
  <q-item-section>
24
26
  <q-item-label>{{ scope.opt.label }}</q-item-label>
@@ -10,6 +10,7 @@
10
10
  <q-checkbox
11
11
  v-model="tablePropsData.selected"
12
12
  size="sm"
13
+ :data-cy="'checkbox-' + tablePropsData.key"
13
14
  />
14
15
  </q-td>
15
16
  <q-td
@@ -59,7 +60,7 @@
59
60
  <BasicCheckBox
60
61
  v-if="col.showBasicCheckbox"
61
62
  :table-props="tablePropsData"
62
- :data-cy="col.checkBoxDataCy + '-' + tablePropsData.row.id || ''"
63
+ :data-cy="col.checkBoxDataCy + '-' + tablePropsData.row[col.name] +tablePropsData.row.id || ''"
63
64
  :model="tablePropsData.row[col.name]"
64
65
  @check-box-emit="(val: object) => {
65
66
  tablePropsData.row[col.name] = val
@@ -19,7 +19,7 @@
19
19
  <q-card-section class="q-py-sm">
20
20
  <q-checkbox
21
21
  :data-cy="'checkbox-' + tablePropsData.row.id"
22
- size="sm"
22
+ size="md"
23
23
  v-if="selectionType != 'none'"
24
24
  v-model="tablePropsData.selected"
25
25
  dense
@@ -8,8 +8,9 @@
8
8
  <q-checkbox
9
9
  v-if="selectionType == 'multiple'"
10
10
  v-model="tablePropsData.selected"
11
- size="sm"
11
+ :size="smallDevice? 'md' : 'sm'"
12
12
  class="float-left"
13
+ data-cy="select-all-checkbox"
13
14
  />
14
15
  </q-th>
15
16
  <q-th
@@ -17,6 +18,7 @@
17
18
  v-if="!smallDevice"
18
19
  :key="col.name"
19
20
  :props="tablePropsData"
21
+ :data-cy="col.name"
20
22
  >
21
23
  {{ col.label }}
22
24
  </q-th>
@@ -92,5 +92,8 @@
92
92
  }
93
93
  .my-table .q-table__top {
94
94
  padding: 0 4px;
95
+ }
96
+ .my-table tr:first-child th:first-child {
97
+ padding-left: 8px !important;
95
98
  }
96
99
  }
@@ -7,4 +7,7 @@
7
7
  .table-header .my-table .q-checkbox{
8
8
  float: left;
9
9
  }
10
+ [data-cy="advanced-filters-button"] {
11
+ padding-left: 6px;
12
+ }
10
13
  }
@@ -18,7 +18,7 @@
18
18
  @on-click-btn-menu="toogleColumnsSelectorVisibility">
19
19
  </TaskNavBar>
20
20
  <TableRowsCounter :counterJson="[
21
- { qty: 1, title: 'Total', dataCy: 'datacy', extraClasses: 'class'}
21
+ { qty: rows.length, title: 'Total', dataCy: 'total', extraClasses: 'class'}
22
22
  ]"/>
23
23
  </div>
24
24
  </q-header>
@@ -41,6 +41,7 @@
41
41
  :small-device="smallDevice"
42
42
  :store="store"
43
43
  :table-style="tableStyle"
44
+ :selectionType="'multiple'"
44
45
  :show-skeleton="showSkeleton"
45
46
  @on-select-visible-columns="(columns) => {
46
47
  store.visiblecolumns = columns
@@ -55,7 +56,10 @@
55
56
  position="bottom"
56
57
  expand
57
58
  >
58
- <q-btn class="full-width" color="accent" icon="arrow_forward" />
59
+ <q-btn
60
+ class="full-width"
61
+ color="black"
62
+ square/>
59
63
  </q-page-sticky>
60
64
  </q-page>
61
65
  </q-page-container>
@@ -87,7 +91,16 @@ export default {
87
91
  tabletMaxWidth: 1100,
88
92
  store: tableStore(),
89
93
  tableStyle: '',
90
- columns: [{
94
+ columns: [
95
+ {
96
+ name: 'drag-and-drop',
97
+ required: true,
98
+ label: 'Drag and drop',
99
+ align: 'left',
100
+ sortable: true,
101
+ type: 'string',
102
+ },
103
+ {
91
104
  name: 'name',
92
105
  required: true,
93
106
  label: 'Dessert (100g serving)',
@@ -110,7 +123,8 @@ export default {
110
123
  align: 'left',
111
124
  sortable: true,
112
125
  showBasicCheckbox: true,
113
- type: 'boolean'
126
+ type: 'boolean',
127
+ checkBoxDataCy: 'checkbox'
114
128
  },
115
129
  {
116
130
  name: 'booleanIcon',
@@ -349,6 +363,174 @@ export default {
349
363
  sodium: 54,
350
364
  calcium: '12%',
351
365
  iron: '6%'
366
+ },
367
+ {
368
+ id: 10,
369
+ name: 'Frozen Yogurt',
370
+ booleanIcon: true,
371
+ available: true,
372
+ calories: 159,
373
+ fat: 6.0,
374
+ carbs: 24,
375
+ checked: false,
376
+ protein: 4.0,
377
+ sodium: 87,
378
+ calcium: '14%',
379
+ iron: '1%'
380
+ },
381
+ {
382
+ id: 11,
383
+ name: 'Ice cream sandwich',
384
+ booleanIcon: true,
385
+ available: false,
386
+ calories: 237,
387
+ fat: 9.0,
388
+ carbs: 37,
389
+ checked: false,
390
+ protein: 4.3,
391
+ sodium: 129,
392
+ calcium: '8%',
393
+ iron: '1%'
394
+ },
395
+ {
396
+ id: 12,
397
+ name: 'Eclair',
398
+ booleanIcon: true,
399
+ available: true,
400
+ calories: 262,
401
+ fat: 16.0,
402
+ carbs: 23,
403
+ checked: false,
404
+ protein: 6.0,
405
+ sodium: 337,
406
+ calcium: '6%',
407
+ iron: '7%'
408
+ },
409
+ {
410
+ id: 13,
411
+ name: 'Cupcake',
412
+ booleanIcon: false,
413
+ available: false,
414
+ calories: 305,
415
+ fat: 3.7,
416
+ carbs: 67,
417
+ checked: false,
418
+ protein: 4.3,
419
+ sodium: 413,
420
+ calcium: '3%',
421
+ iron: '8%'
422
+ },
423
+ {
424
+ id: 14,
425
+ name: 'Gingerbread',
426
+ booleanIcon: true,
427
+ available: true,
428
+ calories: 356,
429
+ fat: 16.0,
430
+ carbs: 49,
431
+ checked: false,
432
+ protein: 3.9,
433
+ sodium: 327,
434
+ calcium: '7%',
435
+ iron: '16%'
436
+ },
437
+ {
438
+ id: 15,
439
+ name: 'Jelly bean',
440
+ booleanIcon: false,
441
+ available: false,
442
+ calories: 375,
443
+ fat: 0.0,
444
+ carbs: 94,
445
+ checked: true,
446
+ protein: 0.0,
447
+ sodium: 50,
448
+ calcium: '0%',
449
+ iron: '0%'
450
+ },
451
+ {
452
+ id: 16,
453
+ name: 'Lollipop',
454
+ booleanIcon: true,
455
+ available: true,
456
+ calories: 392,
457
+ fat: 0.2,
458
+ carbs: 98,
459
+ checked: false,
460
+ protein: 0,
461
+ sodium: 38,
462
+ calcium: '0%',
463
+ iron: '2%'
464
+ },
465
+ {
466
+ id: 17,
467
+ name: 'Honeycomb',
468
+ booleanIcon: true,
469
+ available: false,
470
+ calories: 408,
471
+ fat: 3.2,
472
+ carbs: 87,
473
+ checked: true,
474
+ protein: 6.5,
475
+ sodium: 562,
476
+ calcium: '0%',
477
+ iron: '45%'
478
+ },
479
+ {
480
+ id: 18,
481
+ name: 'Donut',
482
+ booleanIcon: true,
483
+ available: true,
484
+ calories: 452,
485
+ fat: 25.0,
486
+ carbs: 51,
487
+ checked: false,
488
+ protein: 4.9,
489
+ sodium: 326,
490
+ calcium: '2%',
491
+ iron: '22%'
492
+ },
493
+ {
494
+ id: 19,
495
+ name: 'KitKat',
496
+ booleanIcon: false,
497
+ available: false,
498
+ calories: 518,
499
+ fat: 26.0,
500
+ carbs: 65,
501
+ checked: true,
502
+ protein: 7,
503
+ sodium: 54,
504
+ calcium: '12%',
505
+ iron: '6%'
506
+ },
507
+ {
508
+ id: 20,
509
+ name: 'KitKat',
510
+ booleanIcon: false,
511
+ available: false,
512
+ calories: 518,
513
+ fat: 26.0,
514
+ carbs: 65,
515
+ checked: true,
516
+ protein: 7,
517
+ sodium: 54,
518
+ calcium: '12%',
519
+ iron: '6%'
520
+ },
521
+ {
522
+ id: 21,
523
+ name: 'KitKat',
524
+ booleanIcon: false,
525
+ available: false,
526
+ calories: 518,
527
+ fat: 26.0,
528
+ carbs: 65,
529
+ checked: true,
530
+ protein: 7,
531
+ sodium: 54,
532
+ calcium: '12%',
533
+ iron: '6%'
352
534
  }
353
535
  ],
354
536
  showSkeleton: false,
@@ -387,6 +569,9 @@ export default {
387
569
  setTimeout(()=> {
388
570
  this.showSkeleton = false
389
571
  this.rows = this.rowsData
572
+ this.$nextTick(() =>{
573
+ this.$refs.table.enableDragAndDrop = true
574
+ })
390
575
  }, 1000)
391
576
  },
392
577
  onUpdateBasicCheckboxValue (rows: object []) {