@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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mythpe/quasar-ui-qui",
3
- "version": "0.1.57",
3
+ "version": "0.1.58",
4
4
  "description": "MyTh Quasar UI Kit App Extension",
5
5
  "author": {
6
6
  "name": "MyTh Ahmed Faiz",
@@ -7,8 +7,9 @@
7
7
  */
8
8
 
9
9
  import { boot } from 'quasar/wrappers'
10
- import Plugin from '../utils/vue-plugin'
10
+ import { install } from '../utils'
11
+ import type { InstallOptions } from '../types'
11
12
 
12
13
  export default boot(({ app }) => {
13
- app.use(Plugin)
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, n } = useI18n({ useScope: 'global' })
28
- const { __, toFixedFormatted } = useMyth()
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 = isNaN(text) ? toFixedFormatted(text || '') : toFixedFormatted(n(parseFloat(text || '0') || 0))
40
+ const v = formatMoney(text)
41
41
 
42
42
  return v !== null && v !== undefined ? (v?.toString?.() || v) : undefined
43
43
  })
@@ -303,24 +303,16 @@ export const Helpers = {
303
303
  }
304
304
  return `//${path}`
305
305
  },
306
- toFixedFormatted (value: any, prefix?: string) {
307
- value = value || '0.00'
308
- if (value) {
309
- const text: string = value?.toString() || ''
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
- return value
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)
@@ -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 {