@mythpe/quasar-ui-qui 0.3.24 → 0.3.26

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.3.24",
3
+ "version": "0.3.26",
4
4
  "description": "MyTh Quasar UI Kit App Extension",
5
5
  "author": {
6
6
  "name": "MyTh Ahmed Faiz",
@@ -407,13 +407,13 @@ const onInvalidSubmit: InvalidSubmissionHandler = ({ errors }) => {
407
407
  }
408
408
  }
409
409
  const defaultSubmitItem = handleSubmit.withControlled(onSuccess, onInvalidSubmit)
410
- const imageColumnsProp = computed<string[]>(() => toValue(props.imageColumns || []))
411
- const urlColumnsProp = computed<string[]>(() => toValue(props.urlColumns || []))
412
- const colorColumnsProp = computed<string[]>(() => toValue(props.colorColumns || []))
413
- const sarColumnsProp = computed<string[]>(() => toValue(props.sarColumns || []))
414
- const copyColumnsProp = computed<string[]>(() => toValue(props.copyColumns || []))
415
- const descColumnsProp = computed<string[]>(() => toValue(props.descColumns || []))
416
- const noWrapBtnProp = computed(() => getProp.value('noWrapBtn'))
410
+ const computedImageColumns = computed<string[]>(() => toValue(props.imageColumns || []))
411
+ const computedUrlColumns = computed<string[]>(() => toValue(props.urlColumns || []))
412
+ const computedColorColumns = computed<string[]>(() => toValue(props.colorColumns || []))
413
+ const computedSarColumns = computed<string[]>(() => toValue(props.sarColumns || []))
414
+ const computedCopyColumns = computed<string[]>(() => toValue(props.copyColumns || []))
415
+ const computedDescColumns = computed<string[]>(() => toValue(props.descColumns || []))
416
+ const computedNoWrapBtn = computed(() => getProp.value('noWrapBtn'))
417
417
  const wrapCellsRef = ref<boolean>(!1)
418
418
  const onSearchEnter = () => {
419
419
  if (loading.value) {
@@ -633,7 +633,7 @@ defineExpose({
633
633
  :auto="col.name !== controlKey"
634
634
  :class="`overflow-hidden ${col.name === controlKey ? 'text-right col-12 q-pb-xs' : ''}`"
635
635
  >
636
- <template v-if="imageColumnsProp.indexOf(col.name) !== -1">
636
+ <template v-if="computedImageColumns.indexOf(col.name) !== -1">
637
637
  <MDtImageColumn
638
638
  v-if="col.value !== undefined && col.value !== null"
639
639
  :image-mode="getProp('imageMode')"
@@ -642,33 +642,35 @@ defineExpose({
642
642
  @click="openImageDialog(col.value)"
643
643
  />
644
644
  </template>
645
- <template v-else-if="urlColumnsProp.indexOf(col.name) !== -1">
645
+ <template v-else-if="computedUrlColumns.indexOf(col.name) !== -1">
646
646
  <MDtUrlColumn
647
647
  v-if="col.value !== undefined && col.value !== null"
648
648
  :value="col.value"
649
649
  @click="openWindow(col.value)"
650
650
  />
651
651
  </template>
652
- <template v-else-if="colorColumnsProp.indexOf(col.name) !== -1">
652
+ <template v-else-if="computedColorColumns.indexOf(col.name) !== -1">
653
653
  <MDtColorColumn
654
654
  v-if="col.value !== undefined && col.value !== null"
655
655
  :value="col.value"
656
656
  />
657
657
  </template>
658
- <template v-else-if="sarColumnsProp.indexOf(col.name) !== -1">
658
+ <template v-else-if="computedSarColumns.indexOf(col.name) !== -1">
659
659
  <MDtSarColumn
660
660
  v-if="col.value !== undefined && col.value !== null"
661
+ :copy="computedCopyColumns.includes(col.name)"
662
+ :copy-value="col.copyValue && typeof col.copyValue === 'function' ? col.copyValue(iTempProps.row) : iTempProps.row[col.copyValue || col.field]"
661
663
  :value="col.value"
662
664
  />
663
665
  </template>
664
- <template v-else-if="copyColumnsProp.indexOf(col.name) !== -1">
666
+ <template v-else-if="computedCopyColumns.indexOf(col.name) !== -1">
665
667
  <MDtCopyColumn
666
668
  v-if="col.value !== undefined && col.value !== null"
667
669
  :label="col.value"
668
- :value="col.copyValue && typeof col.copyValue === 'function' ? col.copyValue(iTempProps.row) : col.value"
670
+ :value="col.copyValue && typeof col.copyValue === 'function' ? col.copyValue(iTempProps.row) : iTempProps.row[col.copyValue || col.field]"
669
671
  />
670
672
  </template>
671
- <template v-else-if="descColumnsProp.indexOf(col.name) !== -1">
673
+ <template v-else-if="computedDescColumns.indexOf(col.name) !== -1">
672
674
  <MDtDescColumn :value="col.value" />
673
675
  </template>
674
676
  <template v-else-if="col.name === controlKey">
@@ -1151,7 +1153,7 @@ defineExpose({
1151
1153
  </MDtBtn>
1152
1154
  <!-- Wrap Btn -->
1153
1155
  <MDtBtn
1154
- v-if="!noWrapBtnProp"
1156
+ v-if="!computedNoWrapBtn"
1155
1157
  :icon="`ion-ios-${!wrapCellsRef ? 'grid' : 'list'}`"
1156
1158
  flat
1157
1159
  tooltip="myth.datatable.wrapBtn"
@@ -1317,7 +1319,7 @@ defineExpose({
1317
1319
  </slot>
1318
1320
  </template>
1319
1321
  <template
1320
- v-for="imageCol in imageColumnsProp"
1322
+ v-for="imageCol in computedImageColumns"
1321
1323
  :key="`a-image-body-cell-${imageCol}`"
1322
1324
  #[`body-cell-${imageCol}`]="imageColProps"
1323
1325
  >
@@ -1332,7 +1334,7 @@ defineExpose({
1332
1334
  </q-td>
1333
1335
  </template>
1334
1336
  <template
1335
- v-for="u in urlColumnsProp"
1337
+ v-for="u in computedUrlColumns"
1336
1338
  :key="`a-u-body-cell-${u}`"
1337
1339
  #[`body-cell-${u}`]="urlProps"
1338
1340
  >
@@ -1345,7 +1347,7 @@ defineExpose({
1345
1347
  </q-td>
1346
1348
  </template>
1347
1349
  <template
1348
- v-for="cc in colorColumnsProp"
1350
+ v-for="cc in computedColorColumns"
1349
1351
  :key="`a-cc-body-cell-${cc}`"
1350
1352
  #[`body-cell-${cc}`]="ccProps"
1351
1353
  >
@@ -1357,32 +1359,33 @@ defineExpose({
1357
1359
  </q-td>
1358
1360
  </template>
1359
1361
  <template
1360
- v-for="sr in sarColumnsProp"
1361
- :key="`a-sr-body-cell-${sr}`"
1362
- #[`body-cell-${sr}`]="srProps"
1362
+ v-for="sarCell in computedSarColumns"
1363
+ :key="`sarCell-body-cell-${sarCell}`"
1364
+ #[`body-cell-${sarCell}`]="sarCellProps"
1363
1365
  >
1364
- <q-td :props="srProps">
1366
+ <q-td :props="sarCellProps">
1365
1367
  <MDtSarColumn
1366
- v-if="srProps.row[srProps.col.field] !== undefined && srProps.row[srProps.col.field] !== null"
1367
- :value="srProps.row[srProps.col.field]"
1368
+ v-if="sarCellProps.row[sarCellProps.col.field] !== undefined && sarCellProps.row[sarCellProps.col.field] !== null"
1369
+ :copy="computedCopyColumns.includes(sarCellProps.col.name)"
1370
+ :copy-value="sarCellProps.col.copyValue && typeof sarCellProps.col.copyValue === 'function' ? sarCellProps.col.copyValue(sarCellProps.row) : sarCellProps.row[sarCellProps.col.copyValue || sarCellProps.col.field]"
1371
+ :value="sarCellProps.row[sarCellProps.col.field]"
1368
1372
  />
1369
1373
  </q-td>
1370
1374
  </template>
1371
1375
  <template
1372
- v-for="cp in copyColumnsProp"
1373
- :key="`a-cp-body-cell-${cp}`"
1374
- #[`body-cell-${cp}`]="copyColumnProps"
1376
+ v-for="copyCell in computedCopyColumns.filter(e => !computedSarColumns.includes(e))"
1377
+ :key="`copyCell-body-cell-${copyCell}`"
1378
+ #[`body-cell-${copyCell}`]="copyCellProps"
1375
1379
  >
1376
- <q-td :props="copyColumnProps">
1380
+ <q-td :props="copyCellProps">
1377
1381
  <MDtCopyColumn
1378
- v-if="copyColumnProps.row[copyColumnProps.col.field] !== undefined && copyColumnProps.row[copyColumnProps.col.field] !== null"
1379
- :label="copyColumnProps.row[copyColumnProps.col.field]"
1380
- :value="copyColumnProps.col.copyValue && typeof copyColumnProps.col.copyValue === 'function' ? copyColumnProps.col.copyValue(copyColumnProps.row) : copyColumnProps.row[copyColumnProps.col.copyValue || copyColumnProps.col.field]"
1382
+ :label="copyCellProps.col.copyLabel && typeof copyCellProps.col.copyLabel === 'function' ? copyCellProps.col.copyLabel(copyCellProps.row) : copyCellProps.row[copyCellProps.col.copyLabel || copyCellProps.col.field]"
1383
+ :value="copyCellProps.col.copyValue && typeof copyCellProps.col.copyValue === 'function' ? copyCellProps.col.copyValue(copyCellProps.row) : copyCellProps.row[copyCellProps.col.copyValue || copyCellProps.col.field]"
1381
1384
  />
1382
1385
  </q-td>
1383
1386
  </template>
1384
1387
  <template
1385
- v-for="cdd in descColumnsProp"
1388
+ v-for="cdd in computedDescColumns"
1386
1389
  :key="`a-cdd-body-cell-${cdd}`"
1387
1390
  #[`body-cell-${cdd}`]="descColumnProps"
1388
1391
  >
@@ -10,11 +10,13 @@
10
10
 
11
11
  import { useMyth } from '../../composable'
12
12
  import type { MDtCopyColumnProps } from '../../types'
13
+ import MDtSarColumn from './MDtSarColumn.vue'
13
14
 
14
15
  interface Props {
15
16
  label?: MDtCopyColumnProps['label'];
16
17
  value?: MDtCopyColumnProps['value'];
17
18
  width?: MDtCopyColumnProps['width'];
19
+ sar?: MDtCopyColumnProps['sar'];
18
20
  }
19
21
 
20
22
  defineProps<Props>()
@@ -27,6 +29,7 @@ defineOptions({
27
29
 
28
30
  <template>
29
31
  <MRow
32
+ v-if="!!value"
30
33
  class="items-center justify-center"
31
34
  v-bind="$attrs"
32
35
  >
@@ -43,7 +46,13 @@ defineOptions({
43
46
  size="sm"
44
47
  @click="() => !!value ? copyText(value) : null"
45
48
  />
46
- {{ label ?? '' }}
49
+ <MDtSarColumn
50
+ v-if="!!sar"
51
+ :value="label ?? ''"
52
+ />
53
+ <template v-else>
54
+ {{ label ?? '' }}
55
+ </template>
47
56
  <q-tooltip>
48
57
  {{ value }}
49
58
  </q-tooltip>
@@ -9,12 +9,20 @@
9
9
  <script lang="ts" setup>
10
10
 
11
11
  import type { MDtSarColumnProps } from '../../types'
12
+ import MSarString from '../../components/sar/MSarString.vue'
13
+ import { useMyth } from '../../composable'
14
+ import { computed } from 'vue'
12
15
 
13
16
  interface Props {
14
17
  value?: MDtSarColumnProps['value'];
18
+ copyValue?: MDtSarColumnProps['copyValue'];
19
+ copy?: boolean;
15
20
  }
16
21
 
17
- defineProps<Props>()
22
+ const props = defineProps<Props>()
23
+ const { __, copyText } = useMyth()
24
+ const val = computed(() => props.value || '0.00')
25
+ const inputValue = computed(() => (props.copyValue || props.value) || '0.00')
18
26
  defineOptions({
19
27
  name: 'MDtSarColumn',
20
28
  inheritAttrs: !1
@@ -23,10 +31,24 @@ defineOptions({
23
31
 
24
32
  <template>
25
33
  <div
26
- class="row q-gutter-lg justify-center items-center"
34
+ class="row justify-center items-center"
27
35
  v-bind="$attrs"
28
36
  >
29
- <MSarString :text="value || '0.00'" />
37
+ <q-btn
38
+ v-if="!!copy && !!inputValue"
39
+ dense
40
+ flat
41
+ icon="ion-copy"
42
+ round
43
+ class="q-mr-xs"
44
+ size="sm"
45
+ @click="() => copyText(inputValue)"
46
+ >
47
+ <q-tooltip>
48
+ {{ __('labels.copy') }}
49
+ </q-tooltip>
50
+ </q-btn>
51
+ <MSarString :text="val" />
30
52
  <slot />
31
53
  </div>
32
54
  </template>
@@ -11,16 +11,14 @@ import { useI18n } from 'vue-i18n'
11
11
  import { computed } from 'vue'
12
12
  import { useMyth } from '../../composable'
13
13
  import { useQuasar } from 'quasar'
14
+ import type { MSarStringProps } from '../../types'
14
15
 
15
16
  interface Props {
16
- text?: any;
17
+ text?: MSarStringProps['text'];
17
18
  string?: boolean;
18
19
  }
19
20
 
20
- const props = withDefaults(defineProps<Props>(), {
21
- text: undefined,
22
- string: !1
23
- })
21
+ const props = defineProps<Props>()
24
22
 
25
23
  const $q = useQuasar()
26
24
  const { te } = useI18n({ useScope: 'global' })
@@ -381,6 +381,7 @@ export interface MDtCopyColumnProps {
381
381
  label?: any;
382
382
  value?: any;
383
383
  width?: string | number;
384
+ sar?: boolean;
384
385
  }
385
386
 
386
387
  export interface MDtCopyColumnSlots {
@@ -416,6 +417,8 @@ export interface MDtImageColumnSlots {
416
417
 
417
418
  export interface MDtSarColumnProps {
418
419
  value?: any;
420
+ copy?: boolean;
421
+ copyValue?: boolean;
419
422
  }
420
423
 
421
424
  export interface MDtSarColumnSlots {