@mythpe/quasar-ui-qui 0.1.57 → 0.1.58
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
package/src/boot/register.ts
CHANGED
|
@@ -7,8 +7,9 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import { boot } from 'quasar/wrappers'
|
|
10
|
-
import
|
|
10
|
+
import { install } from '../utils'
|
|
11
|
+
import type { InstallOptions } from '../types'
|
|
11
12
|
|
|
12
13
|
export default boot(({ app }) => {
|
|
13
|
-
app.use(
|
|
14
|
+
app.use(install, {} as InstallOptions)
|
|
14
15
|
})
|
|
@@ -24,8 +24,8 @@ const props = withDefaults(defineProps<Props>(), {
|
|
|
24
24
|
append: !1
|
|
25
25
|
})
|
|
26
26
|
|
|
27
|
-
const { te
|
|
28
|
-
const { __,
|
|
27
|
+
const { te } = useI18n({ useScope: 'global' })
|
|
28
|
+
const { __, formatMoney } = useMyth()
|
|
29
29
|
const getText = computed<string | undefined>(() => {
|
|
30
30
|
if (!props.text?.toString().length) {
|
|
31
31
|
return props.text
|
|
@@ -37,7 +37,7 @@ const getText = computed<string | undefined>(() => {
|
|
|
37
37
|
if (props.string) {
|
|
38
38
|
return te(`labels.${text}`) ? __(`labels.${text}`) : __(text)
|
|
39
39
|
}
|
|
40
|
-
const v =
|
|
40
|
+
const v = formatMoney(text)
|
|
41
41
|
|
|
42
42
|
return v !== null && v !== undefined ? (v?.toString?.() || v) : undefined
|
|
43
43
|
})
|
package/src/utils/Helpers.ts
CHANGED
|
@@ -303,24 +303,16 @@ export const Helpers = {
|
|
|
303
303
|
}
|
|
304
304
|
return `//${path}`
|
|
305
305
|
},
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
if (
|
|
309
|
-
|
|
310
|
-
const def = prefix ? (value + ` ${prefix}`) : value
|
|
311
|
-
if (!text) {
|
|
312
|
-
return def
|
|
313
|
-
}
|
|
314
|
-
const after: string = (text.split?.('.')[1] || '')?.toString() || ''
|
|
315
|
-
if (!after) {
|
|
316
|
-
return def
|
|
317
|
-
}
|
|
318
|
-
if (after?.length === 1) {
|
|
319
|
-
value = `${value}0`
|
|
320
|
-
}
|
|
321
|
-
return value?.toString() + (prefix ? ` ${prefix}` : '')
|
|
306
|
+
formatMoney (value: any = '', suffix: string = ''): string {
|
|
307
|
+
let numValue = typeof value !== 'number' ? parseFloat(value) : value
|
|
308
|
+
if (isNaN(numValue)) {
|
|
309
|
+
numValue = 0.00
|
|
322
310
|
}
|
|
323
|
-
|
|
311
|
+
const formattedValue = numValue.toLocaleString('en-US', {
|
|
312
|
+
minimumFractionDigits: 2,
|
|
313
|
+
maximumFractionDigits: 2
|
|
314
|
+
})
|
|
315
|
+
return `${formattedValue} ${suffix}`.trim()
|
|
324
316
|
},
|
|
325
317
|
calculateAspectRatio: (width: number | string, height: number | string): [number, string] => {
|
|
326
318
|
width = Number(width)
|
package/src/utils/vue-plugin.ts
CHANGED
|
@@ -23,7 +23,6 @@ import { MythKey } from './const'
|
|
|
23
23
|
function install (app: App, options: InstallOptions) {
|
|
24
24
|
const myth = createMyth(options)
|
|
25
25
|
app.provide(MythKey, myth)
|
|
26
|
-
// defineOptions(options)
|
|
27
26
|
if (options?.asyncComponents) {
|
|
28
27
|
defineAsyncComponents(app)
|
|
29
28
|
} else {
|