quasar-factory-lib 0.0.87 → 0.0.89

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.89",
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,11 @@ export default defineComponent({
232
230
  'onUpdateSelected',
233
231
  'setLineRemainingQty',
234
232
  'setLineNoStock',
235
- 'onDoneLineMaintenanceTasks'
233
+ 'onDoneLineMaintenanceTasks',
234
+ 'reprintSULabel',
235
+ 'onDragStart',
236
+ 'onDragUpdate',
237
+ 'onDragEnd'
236
238
  ],
237
239
  data () {
238
240
  return {
@@ -249,7 +251,12 @@ export default defineComponent({
249
251
  pageSize: 20,
250
252
  filteredRows: [] as object [] | [],
251
253
  showAdvancedFilter: false,
252
- advancedFiltersData: {}
254
+ advancedFiltersData: {},
255
+ tableRef: null,
256
+ draggableInstance: null,
257
+ disabled: false,
258
+ enableDragAndDrop: false,
259
+ dragAndDropDelay: 0
253
260
  }
254
261
  },
255
262
  computed: {
@@ -260,7 +267,6 @@ export default defineComponent({
260
267
  return !this.smallDevice || this.showSearch
261
268
  },
262
269
  showGridHeader () {
263
- // return this.selectionType === 'multiple'
264
270
  return this.selectionType === 'multiple' || this.showAdvancedFilter
265
271
  },
266
272
  getTableSkeletonVisibility () {
@@ -284,16 +290,59 @@ export default defineComponent({
284
290
  rows (val) {
285
291
  this.rowsData = val
286
292
  },
287
- showAdvancedFilter (val: boolean) {
293
+ showAdvancedFilter (val: boolean): void {
288
294
  if (!val) {
289
295
  this.advancedFiltersData = {}
290
296
  }
297
+ },
298
+ enableDragAndDrop (val): void {
299
+ if (val) {
300
+ this.enableDragAndDropFunc()
301
+ }
302
+ },
303
+ smallDevice (val): void {
304
+ if(val) {
305
+ this.dragAndDropDelay = 200
306
+ } else {
307
+ this.dragAndDropDelay = 0
308
+ }
291
309
  }
292
310
  },
293
311
  mounted () {
294
312
  this.getAdvancedFilterColumns()
295
313
  },
296
314
  methods: {
315
+ enableDragAndDropFunc (): void {
316
+ this.dragAndDropDelay = this.smallDevice ? 200: 0
317
+ if (this.smallDevice) {
318
+ this.tableRef = document.querySelector('.q-table__grid-content')
319
+ } else {
320
+ this.tableRef = document.querySelector('.q-table tbody')
321
+ }
322
+ const self = this
323
+ if (this.tableRef) {
324
+ this.draggableInstance = useDraggable(this.tableRef, this.rows, {
325
+ animation: 100,
326
+ delay: self.dragAndDropDelay,
327
+
328
+ onStart (e) {
329
+ // console.log('start')
330
+ self.$emit('onDragStart', e)
331
+ },
332
+ onUpdate (e) {
333
+ // console.log(e, 'onUpdate')
334
+ const {oldIndex, newIndex} = e
335
+ console.log(oldIndex, newIndex, self.rows)
336
+ self.rowsData = [...self.rows]
337
+ self.$emit('onDragUpdate', e)
338
+ },
339
+ onEnd(e) {
340
+ // console.log(e, 'end drag')
341
+ self.$emit('onDragEnd', e)
342
+ }
343
+ })
344
+ }
345
+ },
297
346
  getSelectedString (val: number): string {
298
347
  const rowsSelectedLength = val
299
348
  if (rowsSelectedLength === 0) {
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <q-badge
3
- class="cursor-pointer"
3
+ class="cursor-pointer q-pt-xs q-pb-xs"
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
@@ -165,7 +166,8 @@ export default {
165
166
  'onUpdateBasicCheckboxValue',
166
167
  'onClickButton',
167
168
  'onUpdateCustomizedCheckboxValue',
168
- 'onClickIconToolTip'
169
+ 'onClickIconToolTip',
170
+ 'modifyPriorityOrder'
169
171
  ],
170
172
  data () {
171
173
  return {
@@ -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
@@ -203,7 +203,8 @@ export default {
203
203
  'onClickButton',
204
204
  'onUpdateCustomizedCheckboxValue',
205
205
  'onClickIcon',
206
- 'onClickIconToolTip'
206
+ 'onClickIconToolTip',
207
+ 'modifyPriorityOrder'
207
208
  ],
208
209
  data () {
209
210
  return {
@@ -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
@@ -49,13 +50,25 @@
49
50
  @on-update-basic-checkbox-value="onUpdateBasicCheckboxValue"
50
51
  @on-update-customized-checkbox-value="onUpdateCustomizedCheckboxValue"
51
52
  @on-click-button="setItemNotFound"
53
+ @on-drag-start="(args) => {
54
+ console.log(args, 'start')
55
+ }"
56
+ @on-drag-update="(args) => {
57
+ console.log(args, 'update')
58
+ }"
59
+ @on-drag-end="(args) => {
60
+ console.log(args, 'end')
61
+ }"
52
62
  />
53
63
  <q-page-sticky
54
64
  v-if="smallDevice"
55
65
  position="bottom"
56
66
  expand
57
67
  >
58
- <q-btn class="full-width" color="accent" icon="arrow_forward" />
68
+ <q-btn
69
+ class="full-width"
70
+ color="black"
71
+ square/>
59
72
  </q-page-sticky>
60
73
  </q-page>
61
74
  </q-page-container>
@@ -87,7 +100,16 @@ export default {
87
100
  tabletMaxWidth: 1100,
88
101
  store: tableStore(),
89
102
  tableStyle: '',
90
- columns: [{
103
+ columns: [
104
+ {
105
+ name: 'drag-and-drop',
106
+ required: true,
107
+ label: 'Drag and drop',
108
+ align: 'left',
109
+ sortable: true,
110
+ type: 'string',
111
+ },
112
+ {
91
113
  name: 'name',
92
114
  required: true,
93
115
  label: 'Dessert (100g serving)',
@@ -110,7 +132,8 @@ export default {
110
132
  align: 'left',
111
133
  sortable: true,
112
134
  showBasicCheckbox: true,
113
- type: 'boolean'
135
+ type: 'boolean',
136
+ checkBoxDataCy: 'checkbox'
114
137
  },
115
138
  {
116
139
  name: 'booleanIcon',
@@ -349,6 +372,174 @@ export default {
349
372
  sodium: 54,
350
373
  calcium: '12%',
351
374
  iron: '6%'
375
+ },
376
+ {
377
+ id: 10,
378
+ name: 'Frozen Yogurt',
379
+ booleanIcon: true,
380
+ available: true,
381
+ calories: 159,
382
+ fat: 6.0,
383
+ carbs: 24,
384
+ checked: false,
385
+ protein: 4.0,
386
+ sodium: 87,
387
+ calcium: '14%',
388
+ iron: '1%'
389
+ },
390
+ {
391
+ id: 11,
392
+ name: 'Ice cream sandwich',
393
+ booleanIcon: true,
394
+ available: false,
395
+ calories: 237,
396
+ fat: 9.0,
397
+ carbs: 37,
398
+ checked: false,
399
+ protein: 4.3,
400
+ sodium: 129,
401
+ calcium: '8%',
402
+ iron: '1%'
403
+ },
404
+ {
405
+ id: 12,
406
+ name: 'Eclair',
407
+ booleanIcon: true,
408
+ available: true,
409
+ calories: 262,
410
+ fat: 16.0,
411
+ carbs: 23,
412
+ checked: false,
413
+ protein: 6.0,
414
+ sodium: 337,
415
+ calcium: '6%',
416
+ iron: '7%'
417
+ },
418
+ {
419
+ id: 13,
420
+ name: 'Cupcake',
421
+ booleanIcon: false,
422
+ available: false,
423
+ calories: 305,
424
+ fat: 3.7,
425
+ carbs: 67,
426
+ checked: false,
427
+ protein: 4.3,
428
+ sodium: 413,
429
+ calcium: '3%',
430
+ iron: '8%'
431
+ },
432
+ {
433
+ id: 14,
434
+ name: 'Gingerbread',
435
+ booleanIcon: true,
436
+ available: true,
437
+ calories: 356,
438
+ fat: 16.0,
439
+ carbs: 49,
440
+ checked: false,
441
+ protein: 3.9,
442
+ sodium: 327,
443
+ calcium: '7%',
444
+ iron: '16%'
445
+ },
446
+ {
447
+ id: 15,
448
+ name: 'Jelly bean',
449
+ booleanIcon: false,
450
+ available: false,
451
+ calories: 375,
452
+ fat: 0.0,
453
+ carbs: 94,
454
+ checked: true,
455
+ protein: 0.0,
456
+ sodium: 50,
457
+ calcium: '0%',
458
+ iron: '0%'
459
+ },
460
+ {
461
+ id: 16,
462
+ name: 'Lollipop',
463
+ booleanIcon: true,
464
+ available: true,
465
+ calories: 392,
466
+ fat: 0.2,
467
+ carbs: 98,
468
+ checked: false,
469
+ protein: 0,
470
+ sodium: 38,
471
+ calcium: '0%',
472
+ iron: '2%'
473
+ },
474
+ {
475
+ id: 17,
476
+ name: 'Honeycomb',
477
+ booleanIcon: true,
478
+ available: false,
479
+ calories: 408,
480
+ fat: 3.2,
481
+ carbs: 87,
482
+ checked: true,
483
+ protein: 6.5,
484
+ sodium: 562,
485
+ calcium: '0%',
486
+ iron: '45%'
487
+ },
488
+ {
489
+ id: 18,
490
+ name: 'Donut',
491
+ booleanIcon: true,
492
+ available: true,
493
+ calories: 452,
494
+ fat: 25.0,
495
+ carbs: 51,
496
+ checked: false,
497
+ protein: 4.9,
498
+ sodium: 326,
499
+ calcium: '2%',
500
+ iron: '22%'
501
+ },
502
+ {
503
+ id: 19,
504
+ name: 'KitKat',
505
+ booleanIcon: false,
506
+ available: false,
507
+ calories: 518,
508
+ fat: 26.0,
509
+ carbs: 65,
510
+ checked: true,
511
+ protein: 7,
512
+ sodium: 54,
513
+ calcium: '12%',
514
+ iron: '6%'
515
+ },
516
+ {
517
+ id: 20,
518
+ name: 'KitKat',
519
+ booleanIcon: false,
520
+ available: false,
521
+ calories: 518,
522
+ fat: 26.0,
523
+ carbs: 65,
524
+ checked: true,
525
+ protein: 7,
526
+ sodium: 54,
527
+ calcium: '12%',
528
+ iron: '6%'
529
+ },
530
+ {
531
+ id: 21,
532
+ name: 'KitKat',
533
+ booleanIcon: false,
534
+ available: false,
535
+ calories: 518,
536
+ fat: 26.0,
537
+ carbs: 65,
538
+ checked: true,
539
+ protein: 7,
540
+ sodium: 54,
541
+ calcium: '12%',
542
+ iron: '6%'
352
543
  }
353
544
  ],
354
545
  showSkeleton: false,
@@ -387,6 +578,9 @@ export default {
387
578
  setTimeout(()=> {
388
579
  this.showSkeleton = false
389
580
  this.rows = this.rowsData
581
+ this.$nextTick(() =>{
582
+ this.$refs.table.enableDragAndDrop = true
583
+ })
390
584
  }, 1000)
391
585
  },
392
586
  onUpdateBasicCheckboxValue (rows: object []) {