@mythpe/quasar-ui-qui 0.0.32 → 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/src/types/components.d.ts +6 -5
- package/src/utils/vue-plugin.ts +44 -97
- 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 {
|
|
@@ -550,11 +550,12 @@ export interface MSelectSlots extends QInputSlots, QFieldSlots, BaseInputsSlots
|
|
|
550
550
|
|
|
551
551
|
export interface MFileProps extends Omit<QFileProps, 'modelValue' | 'rules' | 'name' | 'label' | 'hint'>, Omit<BaseInputsProps, 'autocomplete'> {
|
|
552
552
|
accept?: string | undefined;
|
|
553
|
-
images?: boolean;
|
|
554
|
-
svg?: boolean;
|
|
555
|
-
video?: boolean;
|
|
556
|
-
pdf?: boolean;
|
|
557
|
-
excel?: boolean;
|
|
553
|
+
images?: boolean | string;
|
|
554
|
+
svg?: boolean | string;
|
|
555
|
+
video?: boolean | string;
|
|
556
|
+
pdf?: boolean | string;
|
|
557
|
+
excel?: boolean | string;
|
|
558
|
+
dragDrop?: boolean | undefined;
|
|
558
559
|
}
|
|
559
560
|
|
|
560
561
|
export interface MFileSlots extends QFileSlots, BaseInputsSlots {
|
package/src/utils/vue-plugin.ts
CHANGED
|
@@ -10,53 +10,8 @@ import type { App } from 'vue'
|
|
|
10
10
|
import { defineAsyncComponent } from 'vue'
|
|
11
11
|
import { name, version } from '../../package.json'
|
|
12
12
|
import { myth } from './myth'
|
|
13
|
-
import {
|
|
14
|
-
MAvatarViewer,
|
|
15
|
-
MAxios,
|
|
16
|
-
MBlock,
|
|
17
|
-
MCheckbox,
|
|
18
|
-
MCol,
|
|
19
|
-
MColor,
|
|
20
|
-
MColumn,
|
|
21
|
-
MContainer,
|
|
22
|
-
MDatatable,
|
|
23
|
-
MDate,
|
|
24
|
-
MDialog,
|
|
25
|
-
MDtAvatar,
|
|
26
|
-
MDtBtn,
|
|
27
|
-
MDtContextmenuItems,
|
|
28
|
-
MEditor,
|
|
29
|
-
MEmail,
|
|
30
|
-
MFadeTransition,
|
|
31
|
-
MFadeXTransition,
|
|
32
|
-
MField,
|
|
33
|
-
MFile,
|
|
34
|
-
MForm,
|
|
35
|
-
MHelpRow,
|
|
36
|
-
MHidden,
|
|
37
|
-
MHiddenInput,
|
|
38
|
-
MInput,
|
|
39
|
-
MInputFieldControl,
|
|
40
|
-
MInputLabel,
|
|
41
|
-
MMobile,
|
|
42
|
-
MModalMenu,
|
|
43
|
-
MOptions,
|
|
44
|
-
MOtp,
|
|
45
|
-
MPassword,
|
|
46
|
-
MPicker,
|
|
47
|
-
MRadio,
|
|
48
|
-
MRow,
|
|
49
|
-
MSelect,
|
|
50
|
-
MTime,
|
|
51
|
-
MToggle,
|
|
52
|
-
MTooltip,
|
|
53
|
-
MTransition,
|
|
54
|
-
MTypingString,
|
|
55
|
-
MUploader
|
|
56
|
-
} from '../components'
|
|
57
13
|
|
|
58
14
|
import type { InstallOptions } from '../types'
|
|
59
|
-
import { QSpinner } from 'quasar'
|
|
60
15
|
|
|
61
16
|
function install (app: App, options: InstallOptions = {}) {
|
|
62
17
|
if (options.rounded !== undefined) {
|
|
@@ -107,68 +62,60 @@ function install (app: App, options: InstallOptions = {}) {
|
|
|
107
62
|
// }
|
|
108
63
|
|
|
109
64
|
// Form.
|
|
110
|
-
app.component('MAvatarViewer', MAvatarViewer)
|
|
111
|
-
app.component('MAxios', MAxios)
|
|
112
|
-
|
|
113
|
-
app.component('
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
app.component('
|
|
119
|
-
app.component('
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
app.component('
|
|
124
|
-
app.component('
|
|
125
|
-
app.component('
|
|
126
|
-
app.component('
|
|
127
|
-
app.component('
|
|
128
|
-
app.component('
|
|
129
|
-
app.component('
|
|
130
|
-
app.component('
|
|
131
|
-
app.component('
|
|
132
|
-
app.component('
|
|
133
|
-
app.component('
|
|
134
|
-
app.component('
|
|
135
|
-
app.component('
|
|
136
|
-
app.component('
|
|
137
|
-
app.component('MOtp', MOtp)
|
|
138
|
-
app.component('MPassword', MPassword)
|
|
139
|
-
app.component('MPicker', MPicker)
|
|
140
|
-
app.component('MRadio', MRadio)
|
|
141
|
-
app.component('MSelect', MSelect)
|
|
142
|
-
app.component('MTime', MTime)
|
|
143
|
-
app.component('MToggle', MToggle)
|
|
144
|
-
app.component('MUploader', MUploader)
|
|
65
|
+
app.component('MAvatarViewer', defineAsyncComponent(() => import('../components/form/MAvatarViewer.vue')))
|
|
66
|
+
app.component('MAxios', defineAsyncComponent(() => import('../components/form/MAxios.vue')))
|
|
67
|
+
app.component('MBtn', defineAsyncComponent(() => import('../components/form/MBtn.vue')))
|
|
68
|
+
app.component('MCheckbox', defineAsyncComponent(() => import('../components/form/MCheckbox.vue')))
|
|
69
|
+
app.component('MCkeditor', defineAsyncComponent(() => import('../components/form/MCkeditor.vue')))
|
|
70
|
+
app.component('MColor', defineAsyncComponent(() => import('../components/form/MColor.vue')))
|
|
71
|
+
app.component('MDate', defineAsyncComponent(() => import('../components/form/MDate.vue')))
|
|
72
|
+
app.component('MEditor', defineAsyncComponent(() => import('../components/form/MEditor.vue')))
|
|
73
|
+
app.component('MEmail', defineAsyncComponent(() => import('../components/form/MEmail.vue')))
|
|
74
|
+
app.component('MField', defineAsyncComponent(() => import('../components/form/MField.vue')))
|
|
75
|
+
app.component('MFile', defineAsyncComponent(() => import('../components/form/MFile.vue')))
|
|
76
|
+
app.component('MForm', defineAsyncComponent(() => import('../components/form/MForm.vue')))
|
|
77
|
+
app.component('MHidden', defineAsyncComponent(() => import('../components/form/MHidden.vue')))
|
|
78
|
+
app.component('MHiddenInput', defineAsyncComponent(() => import('../components/form/MHiddenInput.vue')))
|
|
79
|
+
app.component('MInput', defineAsyncComponent(() => import('../components/form/MInput.vue')))
|
|
80
|
+
app.component('MInputFieldControl', defineAsyncComponent(() => import('../components/form/MInputFieldControl.vue')))
|
|
81
|
+
app.component('MInputLabel', defineAsyncComponent(() => import('../components/form/MInputLabel.vue')))
|
|
82
|
+
app.component('MMobile', defineAsyncComponent(() => import('../components/form/MMobile.vue')))
|
|
83
|
+
app.component('MOptions', defineAsyncComponent(() => import('../components/form/MOptions.vue')))
|
|
84
|
+
app.component('MOtp', defineAsyncComponent(() => import('../components/form/MOtp.vue')))
|
|
85
|
+
app.component('MPassword', defineAsyncComponent(() => import('../components/form/MPassword.vue')))
|
|
86
|
+
app.component('MPicker', defineAsyncComponent(() => import('../components/form/MPicker.vue')))
|
|
87
|
+
app.component('MRadio', defineAsyncComponent(() => import('../components/form/MRadio.vue')))
|
|
88
|
+
app.component('MSelect', defineAsyncComponent(() => import('../components/form/MSelect.vue')))
|
|
89
|
+
app.component('MTime', defineAsyncComponent(() => import('../components/form/MTime.vue')))
|
|
90
|
+
app.component('MToggle', defineAsyncComponent(() => import('../components/form/MToggle.vue')))
|
|
91
|
+
app.component('MUploader', defineAsyncComponent(() => import('../components/form/MUploader.vue')))
|
|
145
92
|
|
|
146
93
|
// Grid.
|
|
147
|
-
app.component('MBlock', MBlock)
|
|
148
|
-
app.component('MCol', MCol)
|
|
149
|
-
app.component('MColumn', MColumn)
|
|
150
|
-
app.component('MContainer', MContainer)
|
|
151
|
-
app.component('MHelpRow', MHelpRow)
|
|
152
|
-
app.component('MRow', MRow)
|
|
94
|
+
app.component('MBlock', defineAsyncComponent(() => import('../components/grid/MBlock.vue')))
|
|
95
|
+
app.component('MCol', defineAsyncComponent(() => import('../components/grid/MCol.vue')))
|
|
96
|
+
app.component('MColumn', defineAsyncComponent(() => import('../components/grid/MColumn.vue')))
|
|
97
|
+
app.component('MContainer', defineAsyncComponent(() => import('../components/grid/MContainer.vue')))
|
|
98
|
+
app.component('MHelpRow', defineAsyncComponent(() => import('../components/grid/MHelpRow.vue')))
|
|
99
|
+
app.component('MRow', defineAsyncComponent(() => import('../components/grid/MRow.vue')))
|
|
153
100
|
|
|
154
101
|
// Typography.
|
|
155
|
-
app.component('MTypingString', MTypingString)
|
|
102
|
+
app.component('MTypingString', defineAsyncComponent(() => import('../components/typography/MTypingString.vue')))
|
|
156
103
|
|
|
157
104
|
// Transitions.
|
|
158
|
-
app.component('MTransition', MTransition)
|
|
159
|
-
app.component('MFadeTransition', MFadeTransition)
|
|
160
|
-
app.component('MFadeXTransition', MFadeXTransition)
|
|
105
|
+
app.component('MTransition', defineAsyncComponent(() => import('../components/transition/MTransition.vue')))
|
|
106
|
+
app.component('MFadeTransition', defineAsyncComponent(() => import('../components/transition/MFadeTransition.vue')))
|
|
107
|
+
app.component('MFadeXTransition', defineAsyncComponent(() => import('../components/transition/MFadeXTransition.vue')))
|
|
161
108
|
|
|
162
109
|
// Modals.
|
|
163
|
-
app.component('MDialog', MDialog)
|
|
164
|
-
app.component('MModalMenu', MModalMenu)
|
|
165
|
-
app.component('MTooltip', MTooltip)
|
|
110
|
+
app.component('MDialog', defineAsyncComponent(() => import('../components/modal/MDialog.vue')))
|
|
111
|
+
app.component('MModalMenu', defineAsyncComponent(() => import('../components/modal/MModalMenu.vue')))
|
|
112
|
+
app.component('MTooltip', defineAsyncComponent(() => import('../components/modal/MTooltip.vue')))
|
|
166
113
|
|
|
167
114
|
// Datatable
|
|
168
|
-
app.component('MDatatable', MDatatable)
|
|
169
|
-
app.component('MDtAvatar', MDtAvatar)
|
|
170
|
-
app.component('MDtBtn', MDtBtn)
|
|
171
|
-
app.component('MDtContextmenuItems', MDtContextmenuItems)
|
|
115
|
+
app.component('MDatatable', defineAsyncComponent(() => import('../components/datatable/MDatatable.vue')))
|
|
116
|
+
app.component('MDtAvatar', defineAsyncComponent(() => import('../components/datatable/MDtAvatar.vue')))
|
|
117
|
+
app.component('MDtBtn', defineAsyncComponent(() => import('../components/datatable/MDtBtn.vue')))
|
|
118
|
+
app.component('MDtContextmenuItems', defineAsyncComponent(() => import('../components/datatable/MDtContextmenuItems.vue')))
|
|
172
119
|
}
|
|
173
120
|
|
|
174
121
|
export {
|