@mythpe/quasar-ui-qui 0.2.29 → 0.2.30
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 +21 -1
- package/src/components/form/MInput.vue +5 -8
- package/src/components/sar/MSarIcon.vue +1 -1
- package/src/components/sar/{MSarCol.vue → MSarString.vue} +10 -26
- package/src/components/sar/index.ts +2 -1
- package/src/plugin/defineAsyncComponents.ts +1 -2
- package/src/style/m-input.sass +0 -7
- package/src/types/components.d.ts +3 -6
- package/src/types/m-datatable.d.ts +4 -0
package/package.json
CHANGED
|
@@ -79,6 +79,7 @@ type Props = {
|
|
|
79
79
|
backIcon?: MDatatableProps['backIcon'];
|
|
80
80
|
urlColumns?: MDatatableProps['urlColumns'];
|
|
81
81
|
colorColumns?: MDatatableProps['colorColumns'];
|
|
82
|
+
sarColumns?: MDatatableProps['sarColumns'];
|
|
82
83
|
}
|
|
83
84
|
|
|
84
85
|
const props = withDefaults(defineProps<Props>(), {
|
|
@@ -141,7 +142,8 @@ const props = withDefaults(defineProps<Props>(), {
|
|
|
141
142
|
noBackBtn: !1,
|
|
142
143
|
backIcon: undefined,
|
|
143
144
|
urlColumns: () => ([]),
|
|
144
|
-
colorColumns: () => ([])
|
|
145
|
+
colorColumns: () => ([]),
|
|
146
|
+
sarColumns: () => ([])
|
|
145
147
|
})
|
|
146
148
|
|
|
147
149
|
interface Emits {
|
|
@@ -372,6 +374,7 @@ const onInvalidSubmit: InvalidSubmissionHandler = ({ errors }) => {
|
|
|
372
374
|
const defaultSubmitItem = handleSubmit.withControlled(onSuccess, onInvalidSubmit)
|
|
373
375
|
const urlColumnsProp = computed<string[]>(() => toValue(props.urlColumns) || [])
|
|
374
376
|
const colorColumnsProp = computed<string[]>(() => toValue(props.colorColumns) || [])
|
|
377
|
+
const sarColumnsProp = computed<string[]>(() => toValue(props.sarColumns) || [])
|
|
375
378
|
onMounted(() => refresh())
|
|
376
379
|
watch(loading, v => {
|
|
377
380
|
if (pluginOptions.value?.dt?.useQuasarLoading) {
|
|
@@ -623,6 +626,14 @@ defineExpose({
|
|
|
623
626
|
</div>
|
|
624
627
|
</div>
|
|
625
628
|
</template>
|
|
629
|
+
<template v-else-if="sarColumnsProp.indexOf(col.name) !== -1">
|
|
630
|
+
<div
|
|
631
|
+
v-if="!!col.value"
|
|
632
|
+
class="row q-gutter-lg justify-center items-center"
|
|
633
|
+
>
|
|
634
|
+
<MSarString :text="col.value||'0.00'" />
|
|
635
|
+
</div>
|
|
636
|
+
</template>
|
|
626
637
|
<template v-else-if="col.name === controlKey">
|
|
627
638
|
<MRow
|
|
628
639
|
class="m--dt-context_menu_items"
|
|
@@ -1235,6 +1246,15 @@ defineExpose({
|
|
|
1235
1246
|
</div>
|
|
1236
1247
|
</q-td>
|
|
1237
1248
|
</template>
|
|
1249
|
+
<template
|
|
1250
|
+
v-for="sr in sarColumnsProp"
|
|
1251
|
+
:key="`a-sr-${sr}`"
|
|
1252
|
+
#[`body-cell-${sr}`]="srProps"
|
|
1253
|
+
>
|
|
1254
|
+
<q-td :props="srProps">
|
|
1255
|
+
<MSarString :text="srProps.row[sr]||'0.00'" />
|
|
1256
|
+
</q-td>
|
|
1257
|
+
</template>
|
|
1238
1258
|
|
|
1239
1259
|
<template
|
|
1240
1260
|
v-for="slotName in getSlots"
|
|
@@ -15,6 +15,7 @@ import { computed, reactive, toValue, useTemplateRef } from 'vue'
|
|
|
15
15
|
import { QField, QInput, type QInputSlots } from 'quasar'
|
|
16
16
|
import { useBindInput, useMyth } from '../../composable'
|
|
17
17
|
import type { MInputProps as Props } from '../../types'
|
|
18
|
+
import { MSarString } from '../sar'
|
|
18
19
|
|
|
19
20
|
interface P {
|
|
20
21
|
name: Props['name'];
|
|
@@ -108,7 +109,6 @@ const sarValue = computed<string | null>(() => {
|
|
|
108
109
|
if (value.value?.toString?.()?.length) {
|
|
109
110
|
v = value.value
|
|
110
111
|
}
|
|
111
|
-
console.log(v)
|
|
112
112
|
return v || null
|
|
113
113
|
})
|
|
114
114
|
defineExpose<typeof scopes & { input: typeof input }>({ input, ...scopes })
|
|
@@ -205,13 +205,10 @@ defineOptions({
|
|
|
205
205
|
>
|
|
206
206
|
<slot name="control">
|
|
207
207
|
<MInputFieldControl>
|
|
208
|
-
<
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
</div>
|
|
213
|
-
<!--<MSarCol :text="!!viewModeValue?.toString?.()?.length ? viewModeValue : ( !!value?.toString?.()?.length ? value : undefined )" />-->
|
|
214
|
-
</template>
|
|
208
|
+
<MSarString
|
|
209
|
+
v-if="sar"
|
|
210
|
+
:text="sarValue"
|
|
211
|
+
/>
|
|
215
212
|
<template v-else>
|
|
216
213
|
{{ viewModeValue ?? value }}
|
|
217
214
|
</template>
|
|
@@ -15,7 +15,7 @@ const noDefault = defineModel<boolean>('noDefault', { required: !1, default: !1
|
|
|
15
15
|
const props = defineProps<Props>()
|
|
16
16
|
const getSize = computed<Props['size']>(() => noDefault.value ? props.size : props.size || '100%')
|
|
17
17
|
defineOptions({
|
|
18
|
-
name: '
|
|
18
|
+
name: 'MSarString',
|
|
19
19
|
inheritAttrs: !1
|
|
20
20
|
})
|
|
21
21
|
</script>
|
|
@@ -14,22 +14,14 @@ import { useMyth } from '../../composable'
|
|
|
14
14
|
|
|
15
15
|
interface Props {
|
|
16
16
|
text?: any;
|
|
17
|
-
size?: string | number;
|
|
18
|
-
iconSize?: string | number;
|
|
19
17
|
string?: boolean;
|
|
20
|
-
append?: boolean;
|
|
21
18
|
}
|
|
22
19
|
|
|
23
20
|
const props = withDefaults(defineProps<Props>(), {
|
|
24
21
|
text: undefined,
|
|
25
|
-
|
|
26
|
-
iconSize: 17,
|
|
27
|
-
string: !1,
|
|
28
|
-
append: !1
|
|
22
|
+
string: !1
|
|
29
23
|
})
|
|
30
24
|
|
|
31
|
-
const getSize = computed<number>(() => parseInt(props.size?.toString?.() || '0') || 0)
|
|
32
|
-
// const getIconSize = computed<number>(() => parseInt(props.iconSize?.toString?.() || '0') || 0)
|
|
33
25
|
const { te } = useI18n({ useScope: 'global' })
|
|
34
26
|
const { __, formatMoney } = useMyth()
|
|
35
27
|
const getText = computed<string | undefined>(() => {
|
|
@@ -41,36 +33,28 @@ const getText = computed<string | undefined>(() => {
|
|
|
41
33
|
return props.text
|
|
42
34
|
}
|
|
43
35
|
if (props.string) {
|
|
44
|
-
return te(`labels.${text}`) ? __(`labels.${text}`) : __(text)
|
|
36
|
+
return te(`labels.${text}`) ? __(`labels.${text}`) : (te(text) ? __(text) : text)
|
|
45
37
|
}
|
|
46
38
|
const v = isNaN(text) ? text : formatMoney(text)
|
|
47
39
|
return v !== null && v !== undefined ? (v?.toString?.() || v) : undefined
|
|
48
40
|
})
|
|
49
41
|
|
|
50
42
|
defineOptions({
|
|
51
|
-
name: '
|
|
43
|
+
name: 'MSarString',
|
|
52
44
|
inheritAttrs: !1
|
|
53
45
|
})
|
|
54
46
|
</script>
|
|
55
47
|
|
|
56
48
|
<template>
|
|
57
49
|
<div
|
|
58
|
-
|
|
50
|
+
class="m--sar-col"
|
|
59
51
|
v-bind="$attrs"
|
|
60
52
|
>
|
|
61
|
-
<
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
<slot
|
|
66
|
-
|
|
67
|
-
v-if="text !== undefined && text !== null"
|
|
68
|
-
:style="`font-size: ${getSize}px;`"
|
|
69
|
-
class="flex flex-center m--sar-col__text"
|
|
70
|
-
v-text="getText"
|
|
71
|
-
/>
|
|
72
|
-
</slot>
|
|
73
|
-
<!--<MSarSvg :size="getIconSize" />-->
|
|
74
|
-
</MRow>
|
|
53
|
+
<span>
|
|
54
|
+
<MSarIcon v-if="!$q.lang.rtl" />
|
|
55
|
+
<span :class="{'q-pr-xs': $q.lang.rtl, 'q-pl-xs': !$q.lang.rtl}">{{ getText }}</span>
|
|
56
|
+
<MSarIcon v-if="$q.lang.rtl" />
|
|
57
|
+
<slot />
|
|
58
|
+
</span>
|
|
75
59
|
</div>
|
|
76
60
|
</template>
|
|
@@ -58,7 +58,6 @@ export const defineAsyncComponents = function (app: App) {
|
|
|
58
58
|
app.component('MDtContextmenuItems', defineAsyncComponent(() => import('../components/datatable/MDtContextmenuItems.vue')))
|
|
59
59
|
|
|
60
60
|
// Utils.
|
|
61
|
-
// app.component('MSarCol', defineAsyncComponent(() => import('../components/util/sar/MSarSvg.vue')))
|
|
62
|
-
// app.component('MSarSvg', defineAsyncComponent(() => import('../components/util/sar/MSarSvg.vue')))
|
|
63
61
|
app.component('MSarIcon', defineAsyncComponent(() => import('../components/sar/MSarIcon.vue')))
|
|
62
|
+
app.component('MSarString', defineAsyncComponent(() => import('../components/sar/MSarString.vue')))
|
|
64
63
|
}
|
package/src/style/m-input.sass
CHANGED
|
@@ -988,15 +988,12 @@ export interface MSarIconSlots {
|
|
|
988
988
|
default: () => VNode[]
|
|
989
989
|
}
|
|
990
990
|
|
|
991
|
-
export type
|
|
992
|
-
size?: string | number;
|
|
993
|
-
iconSize?: string | number;
|
|
991
|
+
export type MSarStringProps = {
|
|
994
992
|
text?: any;
|
|
995
993
|
string?: boolean;
|
|
996
|
-
append?: boolean;
|
|
997
994
|
}
|
|
998
995
|
|
|
999
|
-
export interface
|
|
996
|
+
export interface MSarStringSlots {
|
|
1000
997
|
default: () => VNode[]
|
|
1001
998
|
}
|
|
1002
999
|
|
|
@@ -1058,7 +1055,7 @@ declare module '@vue/runtime-core' {
|
|
|
1058
1055
|
MDtContextmenuItems: GlobalComponentConstructor<MDtContextmenuItemsProps, MDtContextmenuItemsSlots>;
|
|
1059
1056
|
|
|
1060
1057
|
// Utils.
|
|
1061
|
-
// MSarCol: GlobalComponentConstructor<MSarColProps, MSarColSlots>;
|
|
1062
1058
|
MSarIcon: GlobalComponentConstructor<MSarIconProps, MSarIconSlots>;
|
|
1059
|
+
MSarString: GlobalComponentConstructor<MSarStringProps, MSarStringSlots>;
|
|
1063
1060
|
}
|
|
1064
1061
|
}
|
|
@@ -305,6 +305,10 @@ export type MDatatableProps<I extends GenericFormValues = GenericFormValues> = O
|
|
|
305
305
|
* Names of color pattern columns in the table.
|
|
306
306
|
*/
|
|
307
307
|
colorColumns?: MaybeRefOrGetter<string[]>;
|
|
308
|
+
/**
|
|
309
|
+
* Names of SAR columns in the table.
|
|
310
|
+
*/
|
|
311
|
+
sarColumns?: MaybeRefOrGetter<string[]>;
|
|
308
312
|
}
|
|
309
313
|
|
|
310
314
|
export interface MDtAvatarProps extends QAvatarProps {
|