@mythpe/quasar-ui-qui 0.1.86 → 0.1.88

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.86",
3
+ "version": "0.1.88",
4
4
  "description": "MyTh Quasar UI Kit App Extension",
5
5
  "author": {
6
6
  "name": "MyTh Ahmed Faiz",
@@ -11,17 +11,21 @@
11
11
  setup
12
12
  >
13
13
  import type { MInputProps as Props, MInputSlots } from '../../types'
14
- import { computed, toValue, useTemplateRef } from 'vue'
14
+ import { computed, toValue, useAttrs, useTemplateRef } from 'vue'
15
15
  import MInput from './MInput.vue'
16
16
  import { useMyth } from '../../composable'
17
+ import { useFieldValue } from 'vee-validate'
17
18
 
18
19
  const { props: pluginOptions, mobileRule: mobile } = useMyth()
19
20
  const modelValue = defineModel<Props['modelValue']>({ required: !1, default: undefined })
21
+ const attrs = useAttrs()
22
+ const name = computed<string>(() => (attrs.name as string) || '')
20
23
  const input = useTemplateRef<InstanceType<typeof MInput>>('input')
24
+ const field = useFieldValue(name)
21
25
  const mobileLength = computed(() => {
22
26
  const final = toValue(mobile)
23
27
  if (typeof final === 'function') {
24
- return final(modelValue.value)
28
+ return final(field.value)
25
29
  }
26
30
  if (final === !0) {
27
31
  return 10
@@ -44,7 +48,7 @@ defineOptions({
44
48
  v-model="modelValue"
45
49
  v-bind="{
46
50
  type: 'tel',
47
- mobile: typeof mobile === 'function' ? mobile(modelValue) : (
51
+ mobile: typeof mobile === 'function' ? mobile(field) : (
48
52
  mobile !== !1 && mobile !== undefined && mobile !== null
49
53
  ),
50
54
  maxlength: mobileLength,
@@ -298,7 +298,7 @@ export type BaseInputFormProps = {
298
298
  /**
299
299
  * Mobile Rule.
300
300
  */
301
- mobile?: boolean | string | number | undefined;
301
+ mobile?: boolean | string | number | ((value: unknown) => number | undefined) | undefined;
302
302
  /**
303
303
  * Email Rule.
304
304
  */
@@ -2,6 +2,7 @@ import type { AxiosInstance } from 'axios'
2
2
  import type { HelpersStubSchema } from './api-helpers'
3
3
  import type { ThemeContext } from './theme'
4
4
  import type { MythComponentsProps } from './plugin-props-option'
5
+ import type { MInputProps } from './components'
5
6
 
6
7
  export interface ApiContext {
7
8
  url: string;
@@ -38,5 +39,5 @@ export interface MythApi {
38
39
  * Default is true.
39
40
  * The Length must be 10.
40
41
  */
41
- mobileRule?: boolean | string | number | ((value: unknown) => number | undefined);
42
+ mobileRule?: MInputProps['mobile'];
42
43
  }
@@ -48,7 +48,7 @@ export const Helpers = {
48
48
  if (Array.isArray(value) && value.length < 1) {
49
49
  formData.append(`${key}`, '')
50
50
  } else {
51
- this.appendArray(formData, value, k)
51
+ Helpers.appendArray(formData, value, k)
52
52
  }
53
53
  } else {
54
54
  if (value === !0) {