@mythpe/quasar-ui-qui 0.0.33 → 0.0.34
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/index.d.ts +17 -0
- package/package.json +1 -1
- package/src/composable/useBindInput.ts +7 -7
- package/types.d.ts +4 -0
package/index.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* MyTh Ahmed Faiz Copyright © 2016-2024 All rights reserved.
|
|
3
|
+
* Email: mythpe@gmail.com
|
|
4
|
+
* Mobile: +966590470092
|
|
5
|
+
* Website: https://www.4myth.com
|
|
6
|
+
* Github: https://github.com/mythpe
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
export * from './src/types'
|
|
10
|
+
|
|
11
|
+
export * from './src/components'
|
|
12
|
+
export * from './src/composable'
|
|
13
|
+
export * from './src/utils'
|
|
14
|
+
|
|
15
|
+
import * as Plugin from './src/utils/vue-plugin'
|
|
16
|
+
|
|
17
|
+
export default Plugin
|
package/package.json
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import type { MaybeRefOrGetter } from 'vue'
|
|
2
|
-
import { computed, ref, toValue } from 'vue'
|
|
2
|
+
import { computed, ref, toValue, useAttrs } from 'vue'
|
|
3
3
|
import { useI18n } from 'vue-i18n'
|
|
4
4
|
import { useMyth } from './useMyth'
|
|
5
|
-
import { useSplitAttrs } from 'quasar'
|
|
6
5
|
import { myth } from '../utils'
|
|
7
6
|
import { camelCase, kebabCase, snakeCase, uniq } from 'lodash'
|
|
8
7
|
import type { PropsContext as UiOpt } from '../types/plugin-props-option'
|
|
@@ -12,7 +11,8 @@ type OptsContext = { choose?: boolean; };
|
|
|
12
11
|
export const useBindInput = <P extends G = G> (Props: MaybeRefOrGetter<P>, key: keyof UiOpt, Opts: MaybeRefOrGetter<OptsContext> = {}) => {
|
|
13
12
|
const { messages, locale } = useI18n({ useScope: 'global' })
|
|
14
13
|
const { __ } = useMyth()
|
|
15
|
-
const { attributes } = useSplitAttrs()
|
|
14
|
+
// const { attributes } = useSplitAttrs()
|
|
15
|
+
const attributes = useAttrs()
|
|
16
16
|
const props = toValue<P>(Props)
|
|
17
17
|
const opts = toValue<OptsContext>(Opts)
|
|
18
18
|
const getProp = computed(() => (k: string) => {
|
|
@@ -50,7 +50,7 @@ export const useBindInput = <P extends G = G> (Props: MaybeRefOrGetter<P>, key:
|
|
|
50
50
|
})
|
|
51
51
|
const getPlaceholder = computed<string | undefined>(() => {
|
|
52
52
|
const replace = computed(() => {
|
|
53
|
-
const val = props.useChoice !== undefined ? props.useChoice : (attributes.
|
|
53
|
+
const val = props.useChoice !== undefined ? props.useChoice : (attributes.useChoice !== undefined ? attributes.useChoice : opts?.choose)
|
|
54
54
|
if (typeof val === 'string' && val?.length > 0) {
|
|
55
55
|
return val
|
|
56
56
|
}
|
|
@@ -175,7 +175,7 @@ export const useBindInput = <P extends G = G> (Props: MaybeRefOrGetter<P>, key:
|
|
|
175
175
|
|
|
176
176
|
// eslint-disable-next-line no-labels
|
|
177
177
|
mainFor: for (const c of cases) {
|
|
178
|
-
for (const b of [attributes
|
|
178
|
+
for (const b of [attributes, props]) {
|
|
179
179
|
if (c in b && (b[c] === !0 || b[c] === '')) {
|
|
180
180
|
rules[snakeCase(k)] = b[c] === !0 || b[c] === '' ? !0 : b[c]
|
|
181
181
|
// eslint-disable-next-line no-labels
|
|
@@ -185,7 +185,7 @@ export const useBindInput = <P extends G = G> (Props: MaybeRefOrGetter<P>, key:
|
|
|
185
185
|
}
|
|
186
186
|
}
|
|
187
187
|
|
|
188
|
-
const mobile = attributes
|
|
188
|
+
const mobile = attributes?.mobile !== undefined ? attributes.mobile : props.mobile
|
|
189
189
|
if (mobile !== undefined && mobile !== false) {
|
|
190
190
|
const defLen = 10
|
|
191
191
|
rules.digits = typeof mobile === 'boolean' ? defLen : (mobile || defLen)
|
|
@@ -194,7 +194,7 @@ export const useBindInput = <P extends G = G> (Props: MaybeRefOrGetter<P>, key:
|
|
|
194
194
|
})
|
|
195
195
|
const attrs = computed(() => ({
|
|
196
196
|
...props,
|
|
197
|
-
...attributes
|
|
197
|
+
...attributes,
|
|
198
198
|
...mergedTheme.value
|
|
199
199
|
}))
|
|
200
200
|
return {
|