@mythpe/quasar-ui-qui 0.4.46 → 0.4.48

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": "@mythpe/quasar-ui-qui",
3
- "version": "0.4.46",
3
+ "version": "0.4.48",
4
4
  "description": "MyTh Quasar UI Kit App Extension",
5
5
  "author": {
6
6
  "name": "MyTh Ahmed Faiz",
@@ -653,27 +653,27 @@ defineExpose({
653
653
  @update:selected="onUpdateSelectedItems"
654
654
  @virtual-scroll="endReach ? onScroll : undefined"
655
655
  >
656
- <template #item="iTempProps">
656
+ <template #item="itemProps">
657
657
  <slot
658
658
  :dt="datatableItemsScope"
659
659
  :form="useFormContext"
660
660
  name="item"
661
- v-bind="iTempProps"
661
+ v-bind="itemProps"
662
662
  >
663
663
  <div
664
- :style="iTempProps.selected ? 'transform: scale(0.95);' : ''"
664
+ :style="itemProps.selected ? 'transform: scale(0.95);' : ''"
665
665
  class="q-pa-xs col-xs-12 col-sm-6 col-md-4 col-lg-3 grid-style-transition"
666
666
  >
667
667
  <q-card
668
- :class="iTempProps.selected ? ($q.dark.isActive ? 'bg-grey-9' : 'bg-grey-2') : ''"
668
+ :class="itemProps.selected ? ($q.dark.isActive ? 'bg-grey-9' : 'bg-grey-2') : ''"
669
669
  >
670
- <template v-if="getShowSelection || iTempProps.colsMap[controlKey] !== undefined">
670
+ <template v-if="getShowSelection || itemProps.colsMap[controlKey] !== undefined">
671
671
  <div class="m-datatable-card-control-header">
672
672
  <MRow class="items-center justify-between">
673
673
  <div class="q-px-md">
674
674
  <q-checkbox
675
675
  v-if="getShowSelection"
676
- v-model="iTempProps.selected"
676
+ v-model="itemProps.selected"
677
677
  dense
678
678
  />
679
679
  </div>
@@ -681,7 +681,7 @@ defineExpose({
681
681
  <MDtBtn
682
682
  flat
683
683
  icon="ion-ios-more"
684
- @click="onRowContextmenu($event,iTempProps.row,iTempProps.rowIndex)"
684
+ @click="onRowContextmenu($event,itemProps.row,itemProps.rowIndex)"
685
685
  />
686
686
  </div>
687
687
  </MRow>
@@ -690,7 +690,7 @@ defineExpose({
690
690
  </template>
691
691
  <MContainer :fluid="!1">
692
692
  <template
693
- v-for="col in iTempProps.cols"
693
+ v-for="col in itemProps.cols"
694
694
  :key="col.name"
695
695
  >
696
696
  <MRow
@@ -711,8 +711,8 @@ defineExpose({
711
711
  <MDtCopyColumn
712
712
  v-if="col.value !== undefined && col.value !== null"
713
713
  :align="col.align as any || undefined"
714
- :label="col.value"
715
- :value="col.copyValue && typeof col.copyValue === 'function' ? col.copyValue(iTempProps.row) : iTempProps.row[col.copyValue || col.field]"
714
+ :label="col.copyLabel && typeof col.copyLabel === 'function' ? () => col.copyLabel(itemProps.row) : itemProps.row[col.copyLabel || col.field]"
715
+ :value="col.copyValue && typeof col.copyValue === 'function' ? () => col.copyValue(itemProps.row) : itemProps.row[col.copyValue || col.field]"
716
716
  />
717
717
  </template>
718
718
  <template v-else-if="computedImageColumns.indexOf(col.name) !== -1">
@@ -728,7 +728,7 @@ defineExpose({
728
728
  <MDtUrlColumn
729
729
  v-if="col.value !== undefined && col.value !== null"
730
730
  :copy="computedCopyColumns.includes(col.name)"
731
- :copy-value="col.copyValue && typeof col.copyValue === 'function' ? col.copyValue(iTempProps.row) : iTempProps.row[col.copyValue || col.field]"
731
+ :copy-value="col.copyValue && typeof col.copyValue === 'function' ? () => col.copyValue(itemProps.row) : itemProps.row[col.copyValue || col.field]"
732
732
  :value="col.value"
733
733
  @click="openWindow(col.value)"
734
734
  />
@@ -745,7 +745,7 @@ defineExpose({
745
745
  v-if="col.value !== undefined && col.value !== null"
746
746
  :align="col.align as any"
747
747
  :copy="computedCopyColumns.includes(col.name)"
748
- :copy-value="col.copyValue && typeof col.copyValue === 'function' ? col.copyValue(iTempProps.row) : iTempProps.row[col.copyValue || col.field]"
748
+ :copy-value="col.copyValue && typeof col.copyValue === 'function' ? () => col.copyValue(itemProps.row) : itemProps.row[col.copyValue || col.field]"
749
749
  :string="col.field.includes('_to_string') || col.field.includes('ToString')"
750
750
  :value="col.value"
751
751
  />
@@ -764,8 +764,8 @@ defineExpose({
764
764
  >
765
765
  <!--Grid-->
766
766
  <MDtContextmenuItems
767
- :index="iTempProps.rowIndex"
768
- :item="iTempProps.row"
767
+ :index="itemProps.rowIndex"
768
+ :item="itemProps.row"
769
769
  :items="contextmenuItems"
770
770
  />
771
771
  </MRow>
@@ -774,7 +774,7 @@ defineExpose({
774
774
  <div class="m-datatable-card-value">
775
775
  <slot
776
776
  :name="`card-cell-${col.name}`"
777
- v-bind="iTempProps"
777
+ v-bind="itemProps"
778
778
  >
779
779
  {{ col.value }}
780
780
  </slot>
@@ -1167,7 +1167,7 @@ defineExpose({
1167
1167
  name="bottom-search"
1168
1168
  />
1169
1169
  </MRow>
1170
- <template v-if="hasSelectedItem && contextmenuItems.length > 0">
1170
+ <template v-if="hasSelectedItem && contextmenuItems.length > 0 && getShowSelection">
1171
1171
  <MRow gutter="sm">
1172
1172
  <!--<MDtBtn-->
1173
1173
  <!-- v-if="hasUpdateBtn && isSingleSelectedItem"-->
@@ -1393,8 +1393,8 @@ defineExpose({
1393
1393
  <q-td :props="copyCellProps">
1394
1394
  <MDtCopyColumn
1395
1395
  :align="copyCellProps.col.align as any || undefined"
1396
- :label="copyCellProps.col.copyLabel && typeof copyCellProps.col.copyLabel === 'function' ? copyCellProps.col.copyLabel(copyCellProps.row) : copyCellProps.row[copyCellProps.col.copyLabel || copyCellProps.col.field]"
1397
- :value="copyCellProps.col.copyValue && typeof copyCellProps.col.copyValue === 'function' ? copyCellProps.col.copyValue(copyCellProps.row) : copyCellProps.row[copyCellProps.col.copyValue || copyCellProps.col.field]"
1396
+ :label="copyCellProps.col.copyLabel && typeof copyCellProps.col.copyLabel === 'function' ? () => copyCellProps.col.copyLabel(copyCellProps.row) : copyCellProps.row[copyCellProps.col.copyLabel || copyCellProps.col.field]"
1397
+ :value="copyCellProps.col.copyValue && typeof copyCellProps.col.copyValue === 'function' ? () => copyCellProps.col.copyValue(copyCellProps.row) : copyCellProps.row[copyCellProps.col.copyValue || copyCellProps.col.field]"
1398
1398
  />
1399
1399
  </q-td>
1400
1400
  </template>
@@ -1407,7 +1407,7 @@ defineExpose({
1407
1407
  <MDtUrlColumn
1408
1408
  v-if="urlProps.row[urlProps.col.field] !== undefined && urlProps.row[urlProps.col.field] !== null"
1409
1409
  :copy="computedCopyColumns.includes(urlProps.col.name)"
1410
- :copy-value="urlProps.col.copyValue && typeof urlProps.col.copyValue === 'function' ? urlProps.col.copyValue(urlProps.row) : urlProps.row[urlProps.col.copyValue || urlProps.col.field]"
1410
+ :copy-value="urlProps.col.copyValue && typeof urlProps.col.copyValue === 'function' ? () => urlProps.col.copyValue(urlProps.row) : urlProps.row[urlProps.col.copyValue || urlProps.col.field]"
1411
1411
  :value="urlProps.row[urlProps.col.field]"
1412
1412
  @click="openWindow(urlProps.row[urlProps.col.field])"
1413
1413
  />
@@ -1451,7 +1451,7 @@ defineExpose({
1451
1451
  v-if="sarCellProps.row[sarCellProps.col.field] !== undefined && sarCellProps.row[sarCellProps.col.field] !== null"
1452
1452
  :align="sarCellProps.col.align as any"
1453
1453
  :copy="computedCopyColumns.includes(sarCellProps.col.name)"
1454
- :copy-value="sarCellProps.col.copyValue && typeof sarCellProps.col.copyValue === 'function' ? sarCellProps.col.copyValue(sarCellProps.row) : sarCellProps.row[sarCellProps.col.copyValue || sarCellProps.col.field]"
1454
+ :copy-value="sarCellProps.col.copyValue && typeof sarCellProps.col.copyValue === 'function' ? () => sarCellProps.col.copyValue(sarCellProps.row) : sarCellProps.row[sarCellProps.col.copyValue || sarCellProps.col.field]"
1455
1455
  :string="sarCellProps.col.field.includes('_to_string') || sarCellProps.col.field.includes('ToString')"
1456
1456
  :value="sarCellProps.row[sarCellProps.col.field]"
1457
1457
  />
@@ -30,6 +30,22 @@ const map = {
30
30
  right: 'end'
31
31
  }
32
32
  const getAlign = computed(() => props.align ? map[props.align] || undefined : undefined)
33
+ const getLabel = computed(() => {
34
+ if (typeof props.label === 'function') return props.label()
35
+ return props.label
36
+ })
37
+ const getValue = computed(() => {
38
+ if (typeof props.value === 'function') return props.value()
39
+ return props.value
40
+ })
41
+ const onCopy = () => {
42
+ if (getValue.value) {
43
+ const v = typeof getValue.value === 'function' ? getValue.value() : getValue.value
44
+ if (v) {
45
+ copyText(v)
46
+ }
47
+ }
48
+ }
33
49
  defineOptions({
34
50
  name: 'MDtCopyColumn',
35
51
  inheritAttrs: !1
@@ -38,7 +54,7 @@ defineOptions({
38
54
 
39
55
  <template>
40
56
  <MRow
41
- v-if="!!value"
57
+ v-if="!!getValue"
42
58
  :class="`items-center justify-${getAlign}`"
43
59
  v-bind="$attrs"
44
60
  >
@@ -47,23 +63,23 @@ defineOptions({
47
63
  class="ellipsis"
48
64
  >
49
65
  <q-btn
50
- v-if="!!value"
66
+ v-if="!!getValue"
51
67
  dense
52
68
  flat
53
69
  icon="ion-copy"
54
70
  round
55
71
  size="sm"
56
- @click="() => !!value ? copyText(value) : null"
72
+ @click="onCopy()"
57
73
  />
58
74
  <MDtSarColumn
59
75
  v-if="!!sar"
60
- :value="label || ''"
76
+ :value="getLabel || ''"
61
77
  />
62
78
  <template v-else>
63
- {{ label || '' }}
79
+ {{ getLabel || '' }}
64
80
  </template>
65
81
  <q-tooltip>
66
- {{ tooltip || value }}
82
+ {{ tooltip || getValue }}
67
83
  </q-tooltip>
68
84
  </div>
69
85
  <slot />
@@ -32,6 +32,14 @@ const map = {
32
32
  right: 'end'
33
33
  }
34
34
  const getAlign = computed(() => props.align ? map[props.align] || undefined : undefined)
35
+ const onCopy = () => {
36
+ if (inputValue.value) {
37
+ const v = typeof inputValue.value === 'function' ? inputValue.value() : inputValue.value
38
+ if (v) {
39
+ copyText(v)
40
+ }
41
+ }
42
+ }
35
43
  defineOptions({
36
44
  name: 'MDtSarColumn',
37
45
  inheritAttrs: !1
@@ -51,7 +59,7 @@ defineOptions({
51
59
  icon="ion-copy"
52
60
  round
53
61
  size="sm"
54
- @click="() => copyText(inputValue)"
62
+ @click="onCopy()"
55
63
  >
56
64
  <q-tooltip>
57
65
  {{ __('labels.copy') }}