@mythpe/quasar-ui-qui 0.3.23 → 0.3.25
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 +1 -1
- package/src/components/datatable/MDatatable.vue +32 -32
- package/src/components/datatable/MDtCopyColumn.vue +10 -1
- package/src/components/datatable/MDtSarColumn.vue +25 -3
- package/src/components/form/MOptions.vue +3 -0
- package/src/components/form/MSelect.vue +1 -1
- package/src/components/sar/MSarString.vue +3 -5
- package/src/types/m-datatable.d.ts +3 -0
package/package.json
CHANGED
|
@@ -407,13 +407,13 @@ const onInvalidSubmit: InvalidSubmissionHandler = ({ errors }) => {
|
|
|
407
407
|
}
|
|
408
408
|
}
|
|
409
409
|
const defaultSubmitItem = handleSubmit.withControlled(onSuccess, onInvalidSubmit)
|
|
410
|
-
const
|
|
411
|
-
const
|
|
412
|
-
const
|
|
413
|
-
const
|
|
414
|
-
const
|
|
415
|
-
const
|
|
416
|
-
const
|
|
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="
|
|
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,33 @@ defineExpose({
|
|
|
642
642
|
@click="openImageDialog(col.value)"
|
|
643
643
|
/>
|
|
644
644
|
</template>
|
|
645
|
-
<template v-else-if="
|
|
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="
|
|
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="
|
|
658
|
+
<template v-else-if="computedSarColumns.indexOf(col.name) !== -1">
|
|
659
659
|
<MDtSarColumn
|
|
660
660
|
v-if="col.value !== undefined && col.value !== null"
|
|
661
661
|
:value="col.value"
|
|
662
662
|
/>
|
|
663
663
|
</template>
|
|
664
|
-
<template v-else-if="
|
|
664
|
+
<template v-else-if="computedCopyColumns.indexOf(col.name) !== -1">
|
|
665
665
|
<MDtCopyColumn
|
|
666
666
|
v-if="col.value !== undefined && col.value !== null"
|
|
667
667
|
:label="col.value"
|
|
668
|
-
:value="col.
|
|
668
|
+
:value="col.copyValue && typeof col.copyValue === 'function' ? col.copyValue(iTempProps.row) : iTempProps.row[col.field || col.name]"
|
|
669
669
|
/>
|
|
670
670
|
</template>
|
|
671
|
-
<template v-else-if="
|
|
671
|
+
<template v-else-if="computedDescColumns.indexOf(col.name) !== -1">
|
|
672
672
|
<MDtDescColumn :value="col.value" />
|
|
673
673
|
</template>
|
|
674
674
|
<template v-else-if="col.name === controlKey">
|
|
@@ -1151,7 +1151,7 @@ defineExpose({
|
|
|
1151
1151
|
</MDtBtn>
|
|
1152
1152
|
<!-- Wrap Btn -->
|
|
1153
1153
|
<MDtBtn
|
|
1154
|
-
v-if="!
|
|
1154
|
+
v-if="!computedNoWrapBtn"
|
|
1155
1155
|
:icon="`ion-ios-${!wrapCellsRef ? 'grid' : 'list'}`"
|
|
1156
1156
|
flat
|
|
1157
1157
|
tooltip="myth.datatable.wrapBtn"
|
|
@@ -1317,7 +1317,7 @@ defineExpose({
|
|
|
1317
1317
|
</slot>
|
|
1318
1318
|
</template>
|
|
1319
1319
|
<template
|
|
1320
|
-
v-for="imageCol in
|
|
1320
|
+
v-for="imageCol in computedImageColumns"
|
|
1321
1321
|
:key="`a-image-body-cell-${imageCol}`"
|
|
1322
1322
|
#[`body-cell-${imageCol}`]="imageColProps"
|
|
1323
1323
|
>
|
|
@@ -1332,7 +1332,7 @@ defineExpose({
|
|
|
1332
1332
|
</q-td>
|
|
1333
1333
|
</template>
|
|
1334
1334
|
<template
|
|
1335
|
-
v-for="u in
|
|
1335
|
+
v-for="u in computedUrlColumns"
|
|
1336
1336
|
:key="`a-u-body-cell-${u}`"
|
|
1337
1337
|
#[`body-cell-${u}`]="urlProps"
|
|
1338
1338
|
>
|
|
@@ -1345,7 +1345,7 @@ defineExpose({
|
|
|
1345
1345
|
</q-td>
|
|
1346
1346
|
</template>
|
|
1347
1347
|
<template
|
|
1348
|
-
v-for="cc in
|
|
1348
|
+
v-for="cc in computedColorColumns"
|
|
1349
1349
|
:key="`a-cc-body-cell-${cc}`"
|
|
1350
1350
|
#[`body-cell-${cc}`]="ccProps"
|
|
1351
1351
|
>
|
|
@@ -1357,32 +1357,32 @@ defineExpose({
|
|
|
1357
1357
|
</q-td>
|
|
1358
1358
|
</template>
|
|
1359
1359
|
<template
|
|
1360
|
-
v-for="
|
|
1361
|
-
:key="`
|
|
1362
|
-
#[`body-cell-${
|
|
1360
|
+
v-for="sarCell in computedSarColumns"
|
|
1361
|
+
:key="`sarCell-body-cell-${sarCell}`"
|
|
1362
|
+
#[`body-cell-${sarCell}`]="sarCellProps"
|
|
1363
1363
|
>
|
|
1364
|
-
<q-td :props="
|
|
1364
|
+
<q-td :props="sarCellProps">
|
|
1365
1365
|
<MDtSarColumn
|
|
1366
|
-
|
|
1367
|
-
|
|
1366
|
+
:copy="computedCopyColumns.includes(sarCellProps.col.name)"
|
|
1367
|
+
v-if="sarCellProps.row[sarCellProps.col.field] !== undefined && sarCellProps.row[sarCellProps.col.field] !== null"
|
|
1368
|
+
:value="sarCellProps.row[sarCellProps.col.field]"
|
|
1368
1369
|
/>
|
|
1369
1370
|
</q-td>
|
|
1370
1371
|
</template>
|
|
1371
1372
|
<template
|
|
1372
|
-
v-for="
|
|
1373
|
-
:key="`
|
|
1374
|
-
#[`body-cell-${
|
|
1373
|
+
v-for="copyCell in computedCopyColumns.filter(e => !computedSarColumns.includes(e))"
|
|
1374
|
+
:key="`copyCell-body-cell-${copyCell}`"
|
|
1375
|
+
#[`body-cell-${copyCell}`]="copyCellProps"
|
|
1375
1376
|
>
|
|
1376
|
-
<q-td :props="
|
|
1377
|
+
<q-td :props="copyCellProps">
|
|
1377
1378
|
<MDtCopyColumn
|
|
1378
|
-
|
|
1379
|
-
:
|
|
1380
|
-
:value="copyColumnProps.row[copyColumnProps.col.field]"
|
|
1379
|
+
:label="copyCellProps.col.copyLabel && typeof copyCellProps.col.copyLabel === 'function' ? copyCellProps.col.copyLabel(copyCellProps.row) : copyCellProps.row[copyCellProps.col.copyLabel || copyCellProps.col.field]"
|
|
1380
|
+
:value="copyCellProps.col.copyValue && typeof copyCellProps.col.copyValue === 'function' ? copyCellProps.col.copyValue(copyCellProps.row) : copyCellProps.row[copyCellProps.col.copyValue || copyCellProps.col.field]"
|
|
1381
1381
|
/>
|
|
1382
1382
|
</q-td>
|
|
1383
1383
|
</template>
|
|
1384
1384
|
<template
|
|
1385
|
-
v-for="cdd in
|
|
1385
|
+
v-for="cdd in computedDescColumns"
|
|
1386
1386
|
:key="`a-cdd-body-cell-${cdd}`"
|
|
1387
1387
|
#[`body-cell-${cdd}`]="descColumnProps"
|
|
1388
1388
|
>
|
|
@@ -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
|
-
|
|
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
|
|
34
|
+
class="row justify-center items-center"
|
|
27
35
|
v-bind="$attrs"
|
|
28
36
|
>
|
|
29
|
-
<
|
|
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>
|
|
@@ -149,6 +149,9 @@ const customViewModeValue = computed(() => {
|
|
|
149
149
|
}
|
|
150
150
|
const opt = options.value?.find((e) => {
|
|
151
151
|
const k = props.optionValue === undefined ? 'value' : (typeof props.optionValue === 'function' ? props.optionValue(e) : props.optionValue)
|
|
152
|
+
if (props.type === 'checkbox') {
|
|
153
|
+
return value.value?.includes?.(e[k]) || e[k] === value.value
|
|
154
|
+
}
|
|
152
155
|
return e[k] === value.value
|
|
153
156
|
})
|
|
154
157
|
if (opt) {
|
|
@@ -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?:
|
|
17
|
+
text?: MSarStringProps['text'];
|
|
17
18
|
string?: boolean;
|
|
18
19
|
}
|
|
19
20
|
|
|
20
|
-
const 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 {
|