@mythpe/quasar-ui-qui 0.2.83 → 0.2.84
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 +19 -1
- package/src/components/datatable/MDtCopyColumn.vue +9 -13
- package/src/components/datatable/MDtDescColumn.vue +53 -0
- package/src/composable/useMyth.ts +0 -1
- package/src/plugin/defineAsyncComponents.ts +1 -0
- package/src/types/components.d.ts +3 -0
- package/src/types/m-datatable.d.ts +15 -0
package/package.json
CHANGED
|
@@ -88,6 +88,7 @@ type Props = {
|
|
|
88
88
|
colorColumns?: MDatatableProps['colorColumns'];
|
|
89
89
|
sarColumns?: MDatatableProps['sarColumns'];
|
|
90
90
|
copyColumns?: MDatatableProps['copyColumns'];
|
|
91
|
+
descColumns?: MDatatableProps['descColumns'];
|
|
91
92
|
}
|
|
92
93
|
|
|
93
94
|
const props = withDefaults(defineProps<Props>(), {
|
|
@@ -154,7 +155,8 @@ const props = withDefaults(defineProps<Props>(), {
|
|
|
154
155
|
urlColumns: undefined,
|
|
155
156
|
colorColumns: undefined,
|
|
156
157
|
sarColumns: undefined,
|
|
157
|
-
copyColumns: undefined
|
|
158
|
+
copyColumns: undefined,
|
|
159
|
+
descColumns: undefined
|
|
158
160
|
})
|
|
159
161
|
|
|
160
162
|
interface Emits {
|
|
@@ -403,6 +405,7 @@ const urlColumnsProp = computed<string[]>(() => toValue(props.urlColumns || []))
|
|
|
403
405
|
const colorColumnsProp = computed<string[]>(() => toValue(props.colorColumns || []))
|
|
404
406
|
const sarColumnsProp = computed<string[]>(() => toValue(props.sarColumns || []))
|
|
405
407
|
const copyColumnsProp = computed<string[]>(() => toValue(props.copyColumns || []))
|
|
408
|
+
const descColumnsProp = computed<string[]>(() => toValue(props.descColumns || []))
|
|
406
409
|
onMounted(() => refresh())
|
|
407
410
|
watch(loading, v => {
|
|
408
411
|
if (pluginOptions.value?.dt?.useQuasarLoading) {
|
|
@@ -627,6 +630,9 @@ defineExpose({
|
|
|
627
630
|
:value="col.value"
|
|
628
631
|
/>
|
|
629
632
|
</template>
|
|
633
|
+
<template v-else-if="descColumnsProp.indexOf(col.name) !== -1">
|
|
634
|
+
<MDtDescColumn :value="col.value" />
|
|
635
|
+
</template>
|
|
630
636
|
<template v-else-if="col.name === controlKey">
|
|
631
637
|
<MRow
|
|
632
638
|
class="m-dt-context_menu_items"
|
|
@@ -1301,6 +1307,18 @@ defineExpose({
|
|
|
1301
1307
|
</q-td>
|
|
1302
1308
|
</template>
|
|
1303
1309
|
|
|
1310
|
+
<template
|
|
1311
|
+
v-for="cdd in descColumnsProp"
|
|
1312
|
+
:key="`a-cdd-body-cell-${cdd}`"
|
|
1313
|
+
#[`body-cell-${cdd}`]="descColumnProps"
|
|
1314
|
+
>
|
|
1315
|
+
<q-td :props="descColumnProps">
|
|
1316
|
+
<MDtDescColumn
|
|
1317
|
+
:value="descColumnProps.row[descColumnProps.col.field]"
|
|
1318
|
+
/>
|
|
1319
|
+
</q-td>
|
|
1320
|
+
</template>
|
|
1321
|
+
|
|
1304
1322
|
<template
|
|
1305
1323
|
v-for="slotName in getSlots"
|
|
1306
1324
|
:key="slotName"
|
|
@@ -34,24 +34,20 @@ defineOptions({
|
|
|
34
34
|
:style="`max-width: ${width ?? 150}px;`"
|
|
35
35
|
class="ellipsis"
|
|
36
36
|
>
|
|
37
|
+
<q-btn
|
|
38
|
+
v-if="!!value"
|
|
39
|
+
dense
|
|
40
|
+
flat
|
|
41
|
+
icon="ion-copy"
|
|
42
|
+
round
|
|
43
|
+
size="sm"
|
|
44
|
+
@click="() => !!value ? copyText(value) : null"
|
|
45
|
+
/>
|
|
37
46
|
{{ label ?? '' }}
|
|
38
47
|
<q-tooltip>
|
|
39
48
|
{{ value }}
|
|
40
49
|
</q-tooltip>
|
|
41
50
|
</div>
|
|
42
|
-
<q-btn
|
|
43
|
-
v-if="!!value"
|
|
44
|
-
dense
|
|
45
|
-
flat
|
|
46
|
-
icon="ion-copy"
|
|
47
|
-
round
|
|
48
|
-
size="sm"
|
|
49
|
-
@click="() => !!value ? copyText(value) : null"
|
|
50
|
-
>
|
|
51
|
-
<q-tooltip>
|
|
52
|
-
{{ __('labels.copy') }}
|
|
53
|
-
</q-tooltip>
|
|
54
|
-
</q-btn>
|
|
55
51
|
<slot />
|
|
56
52
|
</div>
|
|
57
53
|
</template>
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
- MyTh Ahmed Faiz Copyright © 2016-2025 All rights reserved.
|
|
3
|
+
- Email: mythpe@gmail.com
|
|
4
|
+
- Mobile: +966590470092
|
|
5
|
+
- Website: https://www.4myth.com
|
|
6
|
+
- Github: https://github.com/mythpe
|
|
7
|
+
-->
|
|
8
|
+
|
|
9
|
+
<script lang="ts" setup>
|
|
10
|
+
|
|
11
|
+
import type { MDtDescColumnProps } from '../../types'
|
|
12
|
+
import { useMyth } from '../../composable'
|
|
13
|
+
|
|
14
|
+
interface Props {
|
|
15
|
+
value?: MDtDescColumnProps['value'];
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
defineProps<Props>()
|
|
19
|
+
|
|
20
|
+
const { __, copyText } = useMyth()
|
|
21
|
+
|
|
22
|
+
defineOptions({
|
|
23
|
+
name: 'MDtDescColumn',
|
|
24
|
+
inheritAttrs: !1
|
|
25
|
+
})
|
|
26
|
+
</script>
|
|
27
|
+
|
|
28
|
+
<template>
|
|
29
|
+
<div
|
|
30
|
+
class="row q-gutter-md items-center justify-center"
|
|
31
|
+
v-bind="$attrs"
|
|
32
|
+
>
|
|
33
|
+
<div class="m-dt__max_desc">
|
|
34
|
+
<q-btn
|
|
35
|
+
v-if="!!value"
|
|
36
|
+
dense
|
|
37
|
+
flat
|
|
38
|
+
icon="ion-copy"
|
|
39
|
+
round
|
|
40
|
+
size="sm"
|
|
41
|
+
@click="() => !!value ? copyText(value) : null"
|
|
42
|
+
/>
|
|
43
|
+
{{ value ?? '' }}
|
|
44
|
+
<q-tooltip>
|
|
45
|
+
<div
|
|
46
|
+
class="text-body2"
|
|
47
|
+
v-text="value"
|
|
48
|
+
/>
|
|
49
|
+
</q-tooltip>
|
|
50
|
+
</div>
|
|
51
|
+
<slot />
|
|
52
|
+
</div>
|
|
53
|
+
</template>
|
|
@@ -59,6 +59,7 @@ export const defineAsyncComponents = function (app: App) {
|
|
|
59
59
|
app.component('MDtColorColumn', defineAsyncComponent(() => import('../components/datatable/MDtColorColumn.vue')))
|
|
60
60
|
app.component('MDtContextmenuItems', defineAsyncComponent(() => import('../components/datatable/MDtContextmenuItems.vue')))
|
|
61
61
|
app.component('MDtCopyColumn', defineAsyncComponent(() => import('../components/datatable/MDtCopyColumn.vue')))
|
|
62
|
+
app.component('MDtDescColumn', defineAsyncComponent(() => import('../components/datatable/MDtDescColumn.vue')))
|
|
62
63
|
app.component('MDtImageColumn', defineAsyncComponent(() => import('../components/datatable/MDtImageColumn.vue')))
|
|
63
64
|
app.component('MDtSarColumn', defineAsyncComponent(() => import('../components/datatable/MDtSarColumn.vue')))
|
|
64
65
|
app.component('MDtUrlColumn', defineAsyncComponent(() => import('../components/datatable/MDtUrlColumn.vue')))
|
|
@@ -21,6 +21,8 @@ import type {
|
|
|
21
21
|
MDtContextmenuItemsSlots,
|
|
22
22
|
MDtCopyColumnProps,
|
|
23
23
|
MDtCopyColumnSlots,
|
|
24
|
+
MDtDescColumnProps,
|
|
25
|
+
MDtDescColumnSlots,
|
|
24
26
|
MDtImageColumnProps,
|
|
25
27
|
MDtImageColumnSlots,
|
|
26
28
|
MDtSarColumnProps,
|
|
@@ -127,6 +129,7 @@ declare module '@vue/runtime-core' {
|
|
|
127
129
|
MDtColorColumn: GlobalComponentConstructor<MDtColorColumnProps, MDtColorColumnSlots>;
|
|
128
130
|
MDtContextmenuItems: GlobalComponentConstructor<MDtContextmenuItemsProps, MDtContextmenuItemsSlots>;
|
|
129
131
|
MDtCopyColumn: GlobalComponentConstructor<MDtCopyColumnProps, MDtCopyColumnSlots>;
|
|
132
|
+
MDtDescColumn: GlobalComponentConstructor<MDtDescColumnProps, MDtDescColumnSlots>;
|
|
130
133
|
MDtImageColumn: GlobalComponentConstructor<MDtImageColumnProps, MDtImageColumnSlots>;
|
|
131
134
|
MDtSarColumn: GlobalComponentConstructor<MDtSarColumnProps, MDtSarColumnSlots>;
|
|
132
135
|
MDtUrlColumn: GlobalComponentConstructor<MDtUrlColumnProps, MDtUrlColumnSlots>;
|
|
@@ -314,6 +314,10 @@ export type MDatatableProps<I extends GenericFormValues = GenericFormValues> = O
|
|
|
314
314
|
* Names of a text want to show copy btn
|
|
315
315
|
*/
|
|
316
316
|
copyColumns?: MaybeRefOrGetter<string[]>;
|
|
317
|
+
/**
|
|
318
|
+
* Names of a text want to show be truncate text
|
|
319
|
+
*/
|
|
320
|
+
descColumns?: MaybeRefOrGetter<string[]>;
|
|
317
321
|
}
|
|
318
322
|
|
|
319
323
|
export interface MDtAvatarProps extends QAvatarProps {
|
|
@@ -368,6 +372,17 @@ export interface MDtCopyColumnSlots {
|
|
|
368
372
|
default: () => VNode[];
|
|
369
373
|
}
|
|
370
374
|
|
|
375
|
+
export interface MDtDescColumnProps {
|
|
376
|
+
value?: any;
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
export interface MDtDescColumnSlots {
|
|
380
|
+
/**
|
|
381
|
+
* Default slot can be used for captions. See examples
|
|
382
|
+
*/
|
|
383
|
+
default: () => VNode[];
|
|
384
|
+
}
|
|
385
|
+
|
|
371
386
|
export interface MDtImageColumnProps {
|
|
372
387
|
imageMode?: MDatatableProps['imageMode'];
|
|
373
388
|
imageSize?: MDatatableProps['imageSize'];
|