@mythpe/quasar-ui-qui 0.2.31 → 0.2.33

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.2.31",
3
+ "version": "0.2.33",
4
4
  "description": "MyTh Quasar UI Kit App Extension",
5
5
  "author": {
6
6
  "name": "MyTh Ahmed Faiz",
@@ -13,7 +13,7 @@
13
13
 
14
14
  import type { MAxiosProps as Props, MSelectModelEmit, MSelectSlots } from '../../types'
15
15
  import { computed, onMounted, toValue, useTemplateRef, watch } from 'vue'
16
- import { useSetFieldValue } from 'vee-validate'
16
+ import { useFieldValue, useSetFieldValue } from 'vee-validate'
17
17
  import MSelect from './MSelect.vue'
18
18
  import { useMyth } from '../../composable'
19
19
 
@@ -51,6 +51,7 @@ type Emits = {
51
51
  const emit = defineEmits<Emits>()
52
52
  const search = defineModel<string>('search', { required: !1, default: '' })
53
53
  const setFieldValue = useSetFieldValue(() => props.name)
54
+ const fieldValue = useFieldValue(() => props.name)
54
55
  const { alertError, api } = useMyth()
55
56
  const loading = defineModel<Props['loading']>('loading', { required: !1, default: !1 })
56
57
  const items = defineModel<Props['items']>('items', { required: !1, default: [] })
@@ -58,7 +59,7 @@ const isGuest = computed(() => {
58
59
  const v = toValue(props.guest)
59
60
  return v !== undefined && v !== null && v !== !1
60
61
  })
61
- const prepare = async (fromWatch = !1) => {
62
+ const prepare = async (fromWatch = !1, merge = {}) => {
62
63
  if (!props.service || loading.value) {
63
64
  return
64
65
  }
@@ -81,6 +82,7 @@ const prepare = async (fromWatch = !1) => {
81
82
  throw Error(`No service: ${props.service}`)
82
83
  }
83
84
  const params: any = {
85
+ ...merge,
84
86
  requestWith: undefined,
85
87
  search: search.value,
86
88
  itemsPerPage: -1,
@@ -116,6 +118,12 @@ const listeners = {
116
118
  onMounted(() => {
117
119
  if (!props.lazy) {
118
120
  prepare()
121
+ } else {
122
+ if (fieldValue.value) {
123
+ setTimeout(() => {
124
+ prepare(!1, { filter: { id: fieldValue.value } })
125
+ }, 300)
126
+ }
119
127
  }
120
128
  })
121
129
  watch(() => toValue(props.params), () => prepare(!0), { deep: !0 })
@@ -109,7 +109,11 @@ const sarValue = computed<string | null>(() => {
109
109
  if (value.value?.toString?.()?.length) {
110
110
  v = value.value
111
111
  }
112
- return v || null
112
+ try {
113
+ return formatMoney(v)
114
+ } catch (e) {
115
+ return '0.00'
116
+ }
113
117
  })
114
118
  defineExpose<typeof scopes & { input: typeof input }>({ input, ...scopes })
115
119
  defineOptions({