@mythpe/quasar-ui-qui 0.0.26 → 0.0.27-dev

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.
Files changed (92) hide show
  1. package/index.d.ts +13 -0
  2. package/package.json +15 -8
  3. package/src/boot/register.ts +14 -0
  4. package/src/components/datatable/MDatatable.vue +2305 -0
  5. package/src/components/datatable/MDtAvatar.vue +49 -0
  6. package/src/components/datatable/MDtBtn.vue +153 -0
  7. package/src/components/datatable/MDtContextmenuItems.vue +54 -0
  8. package/src/components/datatable/index.ts +6 -0
  9. package/src/components/form/MAvatarViewer.vue +327 -0
  10. package/src/components/form/MAxios.vue +144 -0
  11. package/src/components/form/MBtn.vue +271 -93
  12. package/src/components/form/MCheckbox.vue +150 -0
  13. package/src/components/form/MColor.vue +122 -0
  14. package/src/components/form/MDate.vue +50 -0
  15. package/src/components/form/MEditor.vue +285 -0
  16. package/src/components/form/MEmail.vue +43 -0
  17. package/src/components/form/MField.vue +148 -0
  18. package/src/components/form/MFile.vue +215 -0
  19. package/src/components/form/MForm.vue +89 -0
  20. package/src/components/form/MHidden.vue +86 -0
  21. package/src/components/form/MHiddenInput.vue +58 -0
  22. package/src/components/form/MInput.vue +178 -0
  23. package/src/components/form/MInputFieldControl.vue +27 -0
  24. package/src/components/form/MInputLabel.vue +38 -0
  25. package/src/components/form/MMobile.vue +43 -0
  26. package/src/components/form/MOptions.vue +255 -0
  27. package/src/components/form/MOtp.vue +292 -0
  28. package/src/components/form/MPassword.vue +73 -0
  29. package/src/components/form/MPicker.vue +313 -0
  30. package/src/components/form/MRadio.vue +181 -0
  31. package/src/components/form/MSelect.vue +352 -0
  32. package/src/components/form/MTime.vue +48 -0
  33. package/src/components/form/MToggle.vue +211 -0
  34. package/src/components/form/MUploader.vue +511 -0
  35. package/src/components/form/index.ts +63 -0
  36. package/src/components/grid/MBlock.vue +39 -18
  37. package/src/components/grid/MCol.vue +11 -15
  38. package/src/components/grid/MColumn.vue +12 -1
  39. package/src/components/grid/MContainer.vue +22 -13
  40. package/src/components/grid/MHelpRow.vue +13 -12
  41. package/src/components/grid/MRow.vue +31 -10
  42. package/src/components/grid/index.ts +16 -0
  43. package/src/components/index.ts +15 -0
  44. package/src/components/modal/MDialog.vue +58 -0
  45. package/src/components/modal/MModalMenu.vue +62 -0
  46. package/src/components/modal/MTooltip.vue +39 -0
  47. package/src/components/modal/index.ts +5 -0
  48. package/src/components/parials/UploaderItem.vue +298 -0
  49. package/src/components/parials/index.ts +3 -0
  50. package/src/components/transition/MFadeTransition.vue +27 -0
  51. package/src/components/transition/MFadeXTransition.vue +26 -0
  52. package/src/components/transition/MTransition.vue +44 -0
  53. package/src/components/transition/index.ts +13 -0
  54. package/src/components/typography/MTypingString.vue +8 -0
  55. package/src/components/typography/index.ts +11 -0
  56. package/src/composable/index.ts +12 -0
  57. package/src/composable/useBindInput.ts +209 -0
  58. package/src/composable/useError.ts +11 -0
  59. package/src/composable/useMyth.ts +311 -0
  60. package/src/composable/useValue.ts +12 -0
  61. package/src/index.common.js +19 -1
  62. package/src/index.esm.js +18 -3
  63. package/src/index.js +19 -0
  64. package/src/index.sass +9 -26
  65. package/src/index.ts +18 -4
  66. package/src/index.umd.js +17 -2
  67. package/src/style/m-container.sass +13 -0
  68. package/src/style/main.sass +146 -0
  69. package/src/style/print.sass +14 -0
  70. package/src/style/transition.sass +40 -0
  71. package/src/types/api-helpers.d.ts +62 -0
  72. package/src/types/components.d.ts +1075 -27
  73. package/src/types/index.d.ts +21 -1
  74. package/src/types/install-options.d.ts +19 -0
  75. package/src/types/lodash.d.ts +26 -0
  76. package/src/types/m-datatable.d.ts +316 -0
  77. package/src/types/m-geolocation.d.ts +16 -0
  78. package/src/types/m-helpers.d.ts +97 -0
  79. package/src/types/plugin-props-option.d.ts +301 -0
  80. package/src/types/quasar-helpers.d.ts +7 -0
  81. package/src/types/theme.d.ts +12 -0
  82. package/src/utils/Helpers.ts +293 -0
  83. package/src/utils/Str.ts +211 -0
  84. package/src/utils/index.ts +13 -0
  85. package/src/utils/myth.ts +109 -0
  86. package/src/utils/vee-rules.ts +32 -0
  87. package/src/utils/vue-plugin.ts +161 -0
  88. package/tsconfig.json +9 -13
  89. package/src/myth.ts +0 -30
  90. package/src/types/myth.ts +0 -42
  91. package/src/vue-plugin.ts +0 -41
  92. package/types.d.ts +0 -1
@@ -0,0 +1,178 @@
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
+ <script
10
+ lang="ts"
11
+ setup
12
+ >
13
+
14
+ import { useField } from 'vee-validate'
15
+ import { computed, reactive, toValue, useTemplateRef } from 'vue'
16
+ import type { MInputProps as Props } from '../../types'
17
+ import { QField, QInput, type QInputSlots } from 'quasar'
18
+ import { useBindInput, useMyth } from '../../composable'
19
+ import { myth } from '../../utils'
20
+
21
+ const props = withDefaults(defineProps<Props>(), {
22
+ name: () => '',
23
+ fillMask: undefined,
24
+ reverseFillMask: undefined,
25
+ unmaskedValue: undefined,
26
+ error: undefined,
27
+ noErrorIcon: undefined,
28
+ reactiveRules: undefined,
29
+ lazyRules: undefined,
30
+ stackLabel: undefined,
31
+ hideHint: undefined,
32
+ dark: undefined,
33
+ loading: undefined,
34
+ clearable: undefined,
35
+ filled: undefined,
36
+ outlined: undefined,
37
+ borderless: undefined,
38
+ standout: undefined,
39
+ labelSlot: undefined,
40
+ bottomSlots: undefined,
41
+ hideBottomSpace: undefined,
42
+ counter: undefined,
43
+ rounded: undefined,
44
+ square: undefined,
45
+ dense: undefined,
46
+ itemAligned: undefined,
47
+ disable: undefined,
48
+ readonly: undefined,
49
+ autofocus: undefined,
50
+ autogrow: undefined,
51
+ viewMode: undefined,
52
+ auto: undefined,
53
+ col: undefined,
54
+ xs: undefined,
55
+ sm: undefined,
56
+ md: undefined,
57
+ lg: undefined,
58
+ xl: undefined,
59
+ required: undefined,
60
+ autocomplete: undefined,
61
+ topLabel: undefined,
62
+ mobile: undefined,
63
+ email: undefined,
64
+ float: undefined
65
+ })
66
+ defineModel<Props['modelValue']>({ required: !1, default: undefined })
67
+ const { __ } = useMyth()
68
+ const options = computed(() => myth.props.value)
69
+ const helper = useBindInput<Props>(() => props, 'input')
70
+ const { attrs, hasTopLabel, getLabel, getPlaceholder, getAutocompleteAttribute, inputRules } = helper
71
+ const inputScope = useField<Props['modelValue']>(() => props.name, inputRules, {
72
+ syncVModel: !0,
73
+ label: getLabel,
74
+ ...toValue<any>(props.fieldOptions)
75
+ })
76
+ const { value, errorMessage, handleChange, handleBlur } = inputScope
77
+ const listeners = {
78
+ blur: (v: any) => handleBlur(v, !0),
79
+ 'update:modelValue': (v: Props['modelValue']) => handleChange(v, !!errorMessage.value)
80
+ }
81
+ const input = useTemplateRef<InstanceType<typeof QInput> | InstanceType<typeof QField>>('input')
82
+ const scopes = reactive(inputScope)
83
+ defineExpose<typeof scopes & { input: typeof input }>({ input, ...scopes })
84
+ defineOptions({
85
+ name: 'MInput',
86
+ inheritAttrs: !1
87
+ })
88
+ </script>
89
+
90
+ <template>
91
+ <MCol
92
+ :auto="auto"
93
+ :class="[$attrs.class,{'m--input__required':inputRules?.required!==undefined,'m--input__error':!!errorMessage,'m--input__view':viewMode}]"
94
+ :col="col"
95
+ :lg="lg"
96
+ :md="md"
97
+ :name="name"
98
+ :sm="sm"
99
+ :xs="xs"
100
+ >
101
+ <slot
102
+ name="top-input"
103
+ v-bind="scopes"
104
+ />
105
+ <slot
106
+ name="top-label"
107
+ v-bind="scopes"
108
+ >
109
+ <MInputLabel
110
+ v-if="hasTopLabel"
111
+ :field="scopes"
112
+ >
113
+ <MHelpRow
114
+ :text="help"
115
+ tooltip
116
+ />
117
+ </MInputLabel>
118
+ </slot>
119
+ <slot name="caption">
120
+ <div
121
+ v-if="!!caption"
122
+ class="m--input__caption"
123
+ >
124
+ {{ __(caption) }}
125
+ </div>
126
+ </slot>
127
+ <component
128
+ :is="viewMode ? QField : QInput"
129
+ ref="input"
130
+ v-bind="{
131
+ ...( viewMode ? options.field : {} ),
132
+ ...$props,
133
+ ...attrs as any,
134
+ ...( viewMode ? { stackLabel: !0 } : {} ),
135
+ autocomplete:getAutocompleteAttribute,
136
+ clearable:viewMode?!1:clearable,
137
+ error:!!errorMessage,
138
+ errorMessage,
139
+ hint:__(hint),
140
+ label:hasTopLabel?undefined:getLabel,
141
+ modelValue:value,
142
+ placeholder:getPlaceholder
143
+ }"
144
+ v-on="listeners"
145
+ >
146
+ <template
147
+ v-for="(_,slot) in $slots as Readonly<QInputSlots>"
148
+ :key="slot"
149
+ #[slot]
150
+ >
151
+ <slot :name="slot" />
152
+ </template>
153
+ <template
154
+ v-if="viewMode"
155
+ #control
156
+ >
157
+ <slot name="control">
158
+ <MInputFieldControl>
159
+ {{ viewModeValue ?? value }}
160
+ </MInputFieldControl>
161
+ </slot>
162
+ </template>
163
+ </component>
164
+ <slot
165
+ name="help"
166
+ v-bind="scopes"
167
+ >
168
+ <MHelpRow
169
+ v-if="!hasTopLabel"
170
+ :text="help"
171
+ />
172
+ </slot>
173
+ <slot
174
+ name="bottom-input"
175
+ v-bind="scopes"
176
+ />
177
+ </MCol>
178
+ </template>
@@ -0,0 +1,27 @@
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
+ <script
10
+ lang="ts"
11
+ setup
12
+ >
13
+ defineOptions({
14
+ name: 'MInputFieldControl',
15
+ inheritAttrs: !1
16
+ })
17
+ </script>
18
+
19
+ <template>
20
+ <div
21
+ class="self-center full-width no-outline ellipsis"
22
+ tabindex="0"
23
+ v-bind="$attrs"
24
+ >
25
+ <slot />
26
+ </div>
27
+ </template>
@@ -0,0 +1,38 @@
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
+ <script
10
+ lang="ts"
11
+ setup
12
+ >
13
+
14
+ import type { MInputLabelProps as Props } from '../../types'
15
+ import { useMyth } from '../../composable'
16
+
17
+ const { __ } = useMyth()
18
+ defineProps<Props>()
19
+ defineOptions({
20
+ name: 'MInputLabel',
21
+ inheritAttrs: !1
22
+ })
23
+ </script>
24
+
25
+ <template>
26
+ <div
27
+ :class="{
28
+ 'row items-center m--input__top-label' : !0,
29
+ 'm--input__top-label__invalid' : !field?.meta?.valid && field?.meta?.dirty
30
+ }"
31
+ v-bind="$attrs"
32
+ >
33
+ <div class="m--input__top-label__content">
34
+ {{ label !== undefined ? __(label) : field?.label }}
35
+ </div>
36
+ <slot />
37
+ </div>
38
+ </template>
@@ -0,0 +1,43 @@
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
+ <script
10
+ lang="ts"
11
+ setup
12
+ >
13
+ import type { MInputProps as Props, MInputSlots } from '../../types'
14
+ import { useTemplateRef } from 'vue'
15
+ import MInput from './MInput.vue'
16
+ import { myth } from '../../utils'
17
+
18
+ const modelValue = defineModel<Props['modelValue']>({ required: !1, default: undefined })
19
+ const input = useTemplateRef<InstanceType<typeof MInput>>('input')
20
+ const { props: options } = myth
21
+ defineExpose<{ input: typeof input }>({ input })
22
+ defineOptions({
23
+ name: 'MMobile',
24
+ inheritAttrs: !1
25
+ })
26
+ </script>
27
+
28
+ <template>
29
+ <MInput
30
+ ref="input"
31
+ v-model="modelValue"
32
+ type="tel"
33
+ v-bind="{...options.mobile as any,...$attrs}"
34
+ >
35
+ <template
36
+ v-for="(_,slot) in $slots as Readonly<MInputSlots>"
37
+ :key="slot"
38
+ #[slot]
39
+ >
40
+ <slot :name="slot" />
41
+ </template>
42
+ </MInput>
43
+ </template>
@@ -0,0 +1,255 @@
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
+ <script
10
+ lang="ts"
11
+ setup
12
+ >
13
+
14
+ import { useField } from 'vee-validate'
15
+ import type { MOptionsOptionContext, MOptionsProps as Props } from '../../types'
16
+ import { reactive, toValue, useTemplateRef } from 'vue'
17
+ import { QField, QOptionGroup, type QOptionGroupSlots } from 'quasar'
18
+ import { useBindInput, useMyth } from '../../composable'
19
+ import { myth } from '../../utils'
20
+
21
+ type P = {
22
+ name: Props['name'];
23
+ auto?: Props['auto'];
24
+ col?: Props['col'];
25
+ xs?: Props['xs'];
26
+ sm?: Props['sm'];
27
+ md?: Props['md'];
28
+ lg?: Props['lg'];
29
+ xl?: Props['xl'];
30
+ label?: Props['label'];
31
+ caption?: Props['caption'];
32
+ hint?: Props['hint'];
33
+ placeholder?: Props['placeholder'];
34
+ help?: Props['help'];
35
+ required?: Props['required'];
36
+ rules?: Props['rules'];
37
+ viewMode?: Props['viewMode'];
38
+ viewModeValue?: Props['viewModeValue'];
39
+ topLabel?: Props['topLabel'];
40
+ color?: Props['color'];
41
+ type?: Props['type'];
42
+ keepColor?: Props['keepColor'];
43
+ service?: Props['service'];
44
+ fullWidth?: Props['fullWidth'];
45
+ fitWidth?: Props['fullWidth'];
46
+ fieldOptions?: Props['fieldOptions'];
47
+ }
48
+
49
+ const props = withDefaults(defineProps<P>(), {
50
+ name: () => '',
51
+ auto: undefined,
52
+ col: undefined,
53
+ xs: undefined,
54
+ sm: undefined,
55
+ md: undefined,
56
+ lg: undefined,
57
+ xl: undefined,
58
+ label: undefined,
59
+ caption: undefined,
60
+ hint: undefined,
61
+ placeholder: undefined,
62
+ help: undefined,
63
+ required: undefined,
64
+ rules: undefined,
65
+ viewMode: () => !1,
66
+ viewModeValue: undefined,
67
+ topLabel: undefined,
68
+ color: () => 'primary',
69
+ type: 'radio',
70
+ keepColor: undefined,
71
+ service: undefined,
72
+ fullWidth: () => !1,
73
+ fitWidth: () => !1,
74
+ fieldOptions: undefined
75
+ })
76
+ defineModel<Props['modelValue']>({ required: !1, default: undefined })
77
+ const loading = defineModel<Props['loading']>('loading', { required: !1, default: !1 })
78
+ const options = defineModel<MOptionsOptionContext[]>('options', { required: !1, default: undefined })
79
+ const helper = useBindInput<P>(() => props, 'options')
80
+ const { getLabel, inputRules, getProp } = helper
81
+ const inputScope = useField<Props['modelValue']>(() => props.name, inputRules, {
82
+ syncVModel: !0,
83
+ label: getLabel,
84
+ ...toValue<any>(props.fieldOptions)
85
+ })
86
+ const { value, errorMessage, handleChange, handleBlur } = inputScope
87
+
88
+ const listeners = {
89
+ blur: (v: any) => handleBlur(v, !0),
90
+ 'update:modelValue': (v: Props['modelValue']) => handleChange(v, !!errorMessage.value)
91
+ }
92
+ const input = useTemplateRef<InstanceType<typeof QField> | InstanceType<typeof QOptionGroup>>('input')
93
+ const scopes = reactive(inputScope)
94
+ defineExpose<typeof scopes & { input: typeof input }>({ input, ...scopes })
95
+ const { alertError, __ } = useMyth()
96
+ const { props: pluginProps } = myth
97
+ const fetchData = async () => {
98
+ if (props.service) {
99
+ loading.value = !0
100
+ try {
101
+ const { _data } = await props.service()
102
+ options.value = _data as any
103
+ } catch (e: any) {
104
+ alertError(e?._message || e?.message || 'Failed to fetch data')
105
+ } finally {
106
+ loading.value = !1
107
+ }
108
+ }
109
+ }
110
+ fetchData()
111
+ defineOptions({
112
+ name: 'MOptions',
113
+ inheritAttrs: !1
114
+ })
115
+ </script>
116
+
117
+ <template>
118
+ <MCol
119
+ :auto="auto"
120
+ :class="[$attrs.class,{'m--input__required':inputRules?.required!==undefined,'m--input__error':!!errorMessage,'m--input__view':viewMode}]"
121
+ :col="col"
122
+ :lg="lg"
123
+ :md="md"
124
+ :name="name"
125
+ :sm="sm"
126
+ :xs="xs"
127
+ >
128
+ <slot
129
+ name="top-input"
130
+ v-bind="scopes"
131
+ />
132
+ <slot name="top-label">
133
+ <MInputLabel
134
+ v-if="!!getLabel"
135
+ :field="scopes"
136
+ >
137
+ <MHelpRow
138
+ v-if="!!help"
139
+ :text="help"
140
+ tooltip
141
+ />
142
+ <MTransition>
143
+ <q-spinner-dots
144
+ v-if="loading"
145
+ color="primary"
146
+ size="25px"
147
+ />
148
+ </MTransition>
149
+ </MInputLabel>
150
+ </slot>
151
+ <slot name="caption">
152
+ <div
153
+ v-if="!!caption"
154
+ class="m--input__caption"
155
+ >
156
+ {{ __(caption) }}
157
+ </div>
158
+ </slot>
159
+ <MTransition>
160
+ <div
161
+ v-if="!!errorMessage"
162
+ class="text-negative text-caption"
163
+ >
164
+ <q-icon
165
+ v-if="!!errorMessage"
166
+ color="negative"
167
+ name="ion-ios-information-circle-outline"
168
+ size="20px"
169
+ />
170
+ {{ errorMessage }}
171
+ </div>
172
+ </MTransition>
173
+ <component
174
+ :is="viewMode ? QField : QOptionGroup"
175
+ ref="input"
176
+ :class="{'m--options': !0, 'm--options__full_width': fullWidth, 'm--options__fit_width': fitWidth }"
177
+ :color="!!errorMessage ? 'negative' : getProp('color')"
178
+ :error="viewMode ? !!errorMessage : undefined"
179
+ :error-message="viewMode ? errorMessage : undefined"
180
+ :hint="viewMode ? __(hint) : undefined"
181
+ :keep-color="!!errorMessage ? !0 : getProp('keepColor')"
182
+ :label="getLabel"
183
+ :model-value="value"
184
+ :options="options"
185
+ :type="viewMode ? undefined : type"
186
+ v-bind="{ ...pluginProps.options as any,...( viewMode ? pluginProps.field : {} ), ...$attrs, ...( viewMode ? { stackLabel: !0 } : {} ) }"
187
+ v-on="listeners"
188
+ >
189
+ <template
190
+ v-for="(_,slot) in $slots as Readonly<QOptionGroupSlots>"
191
+ :key="slot"
192
+ #[slot]="inputSlot"
193
+ >
194
+ <slot
195
+ :name="slot"
196
+ v-bind="inputSlot || {}"
197
+ />
198
+ </template>
199
+ <template
200
+ v-if="viewMode"
201
+ #control
202
+ >
203
+ <slot name="control">
204
+ <MInputFieldControl>
205
+ {{ viewModeValue ?? value }}
206
+ </MInputFieldControl>
207
+ </slot>
208
+ </template>
209
+ </component>
210
+ <slot
211
+ name="help"
212
+ v-bind="scopes"
213
+ >
214
+ <MHelpRow
215
+ v-if="!getLabel"
216
+ :text="help"
217
+ />
218
+ </slot>
219
+ <slot
220
+ name="bottom-input"
221
+ v-bind="scopes"
222
+ />
223
+ <slot
224
+ :options="options"
225
+ v-bind="scopes"
226
+ />
227
+ </MCol>
228
+ </template>
229
+
230
+ <style lang="sass">
231
+ $c: calc(100% / 3)
232
+
233
+ .m--options
234
+ .q-checkbox__inner,
235
+ .q-radio__inner,
236
+ .q-toggle__inner
237
+ align-self: flex-start
238
+
239
+ &__full_width
240
+ > div
241
+ .q-checkbox,
242
+ .q-radio,
243
+ .q-toggle,
244
+ .q-checkbox__label,
245
+ .q-radio__label,
246
+ .q-toggle__label
247
+ width: 100%
248
+
249
+ &__fit_width
250
+ margin-left: 0
251
+
252
+ > div
253
+ width: calc(100% / 3)
254
+ margin-left: 0
255
+ </style>