@mythpe/quasar-ui-qui 0.0.23 → 0.0.24-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 (69) hide show
  1. package/index.d.ts +17 -0
  2. package/package.json +14 -9
  3. package/src/boot/register.ts +14 -0
  4. package/src/components/form/MAvatarViewer.vue +324 -0
  5. package/src/components/form/MBtn.vue +271 -93
  6. package/src/components/form/MCheckbox.vue +123 -0
  7. package/src/components/form/MColor.vue +122 -0
  8. package/src/components/form/MDate.vue +47 -0
  9. package/src/components/form/MEditor.vue +285 -0
  10. package/src/components/form/MEmail.vue +40 -0
  11. package/src/components/form/MField.vue +142 -0
  12. package/src/components/form/MFile.vue +209 -0
  13. package/src/components/form/MForm.vue +83 -0
  14. package/src/components/form/MHidden.vue +83 -0
  15. package/src/components/form/MHiddenInput.vue +55 -0
  16. package/src/components/form/MInput.vue +178 -0
  17. package/src/components/form/MInputFieldControl.vue +27 -0
  18. package/src/components/form/MInputLabel.vue +35 -0
  19. package/src/components/form/MMobile.vue +37 -0
  20. package/src/components/form/MPicker.vue +310 -0
  21. package/src/components/form/MRadio.vue +175 -0
  22. package/src/components/form/MSelect.vue +343 -0
  23. package/src/components/form/MTime.vue +45 -0
  24. package/src/components/form/index.ts +51 -0
  25. package/src/components/grid/MBlock.vue +40 -18
  26. package/src/components/grid/MCol.vue +11 -15
  27. package/src/components/grid/MColumn.vue +8 -0
  28. package/src/components/grid/MContainer.vue +22 -13
  29. package/src/components/grid/MHelpRow.vue +9 -12
  30. package/src/components/grid/MRow.vue +31 -10
  31. package/src/components/grid/index.ts +16 -0
  32. package/src/components/index.ts +12 -0
  33. package/src/components/transition/MFadeTransition.vue +27 -0
  34. package/src/components/transition/MFadeXTransition.vue +26 -0
  35. package/src/components/transition/MTransition.vue +41 -0
  36. package/src/components/transition/index.ts +13 -0
  37. package/src/components/typography/MTypingString.vue +8 -0
  38. package/src/components/typography/index.ts +11 -0
  39. package/src/composable/index.ts +12 -0
  40. package/src/composable/useBindInput.ts +209 -0
  41. package/src/composable/useError.ts +11 -0
  42. package/src/composable/useMyth.ts +294 -0
  43. package/src/composable/useValue.ts +12 -0
  44. package/src/index.common.js +19 -1
  45. package/src/index.esm.js +18 -3
  46. package/src/index.js +19 -0
  47. package/src/index.sass +8 -26
  48. package/src/index.ts +18 -4
  49. package/src/index.umd.js +16 -2
  50. package/src/style/m-container.sass +13 -0
  51. package/src/style/main.sass +42 -0
  52. package/src/types/api-helpers.d.ts +120 -0
  53. package/src/types/components.d.ts +682 -28
  54. package/src/types/dt.d.ts +142 -0
  55. package/src/types/index.d.ts +153 -1
  56. package/src/types/lodash.d.ts +26 -0
  57. package/src/types/quasar-helpers.d.ts +7 -0
  58. package/src/types/theme.d.ts +12 -0
  59. package/src/utils/Helpers.ts +321 -0
  60. package/src/utils/Str.ts +210 -0
  61. package/src/utils/index.ts +13 -0
  62. package/src/utils/myth.ts +90 -0
  63. package/src/utils/vee-rules.ts +32 -0
  64. package/src/utils/vue-plugin.ts +122 -0
  65. package/tsconfig.json +9 -13
  66. package/src/myth.ts +0 -30
  67. package/src/types/myth.ts +0 -42
  68. package/src/vue-plugin.ts +0 -41
  69. package/types.d.ts +0 -1
@@ -0,0 +1,343 @@
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 lang="ts" setup>
10
+
11
+ import { useField } from 'vee-validate'
12
+ import type { MSelectProps as Props } from '../../types'
13
+ import { computed, reactive, ref, toValue } from 'vue'
14
+ import { useBindInput, useMyth } from '../../composable'
15
+ import { QField, QSelect, type QSelectSlots } from 'quasar'
16
+ import { myth } from '../../utils'
17
+
18
+ type P = {
19
+ name: Props['name'];
20
+ auto?: Props['auto'];
21
+ col?: Props['col'];
22
+ xs?: Props['xs'];
23
+ sm?: Props['sm'];
24
+ md?: Props['md'];
25
+ lg?: Props['lg'];
26
+ xl?: Props['xl'];
27
+ label?: Props['label'];
28
+ caption?: Props['caption'];
29
+ hint?: Props['hint'];
30
+ placeholder?: Props['placeholder'];
31
+ help?: Props['help'];
32
+ stackLabel?: Props['stackLabel'];
33
+ required?: Props['required'];
34
+ rules?: Props['rules'];
35
+ viewMode?: Props['viewMode'];
36
+ viewModeValue?: Props['viewModeValue'];
37
+ autocomplete?: Props['autocomplete'];
38
+ topLabel?: Props['topLabel'];
39
+ behavior?: Props['behavior'];
40
+ emitValue?: Props['emitValue'];
41
+ useInput?: Props['useInput'];
42
+ mapOptions?: Props['mapOptions'];
43
+ loading?: Props['loading'];
44
+ multiple?: Props['multiple'];
45
+ options?: Props['options'];
46
+ optionLabel?: Props['optionLabel'];
47
+ optionValue?: Props['optionValue'];
48
+ noFilter?: Props['noFilter'];
49
+ hideEmptyList?: Props['hideEmptyList'];
50
+ readonly?: Props['readonly'];
51
+ useChips?: Props['useChips'];
52
+ searchLength?: Props['searchLength'];
53
+ axiosMode?: Props['axiosMode'];
54
+ hideSelected?: Props['hideSelected'];
55
+ onFilter?: Props['onFilter'];
56
+ fieldOptions?: Props['fieldOptions'];
57
+ clearable?: Props['clearable'];
58
+ useChoice?: Props['useChoice'];
59
+ }
60
+
61
+ const props = withDefaults(defineProps<P>(), {
62
+ name: () => '',
63
+ auto: undefined,
64
+ col: undefined,
65
+ xs: undefined,
66
+ sm: undefined,
67
+ md: undefined,
68
+ lg: undefined,
69
+ xl: undefined,
70
+ label: undefined,
71
+ caption: undefined,
72
+ hint: undefined,
73
+ placeholder: undefined,
74
+ help: undefined,
75
+ stackLabel: undefined,
76
+ required: undefined,
77
+ rules: undefined,
78
+ viewMode: () => !1,
79
+ viewModeValue: undefined,
80
+ autocomplete: undefined,
81
+ topLabel: undefined,
82
+ behavior: undefined,
83
+ emitValue: () => !0,
84
+ useInput: () => !0,
85
+ mapOptions: () => !0,
86
+ loading: undefined,
87
+ multiple: undefined,
88
+ options: () => ([]),
89
+ optionLabel: () => 'label',
90
+ optionValue: () => 'value',
91
+ noFilter: undefined,
92
+ hideEmptyList: undefined,
93
+ readonly: undefined,
94
+ useChips: undefined,
95
+ searchLength: () => 1,
96
+ axiosMode: undefined,
97
+ hideSelected: undefined,
98
+ onFilter: undefined,
99
+ fieldOptions: undefined,
100
+ clearable: undefined,
101
+ useChoice: undefined
102
+ })
103
+ defineModel<Props['modelValue']>({ required: !1, default: undefined })
104
+
105
+ type Emits = {
106
+ (e: 'model', value: { value: any; model: object | null }): void;
107
+ }
108
+ const emit = defineEmits<Emits>()
109
+
110
+ const { __ } = useMyth()
111
+ const { props: pluginOptions, themeInput } = myth
112
+ const helper = useBindInput<P & Props>(() => props, 'select', () => ({ choose: !0 }))
113
+ const { hasTopLabel, getLabel, getPlaceholder, getAutocompleteAttribute, inputRules, getProp } = helper
114
+ const inputScope = useField<Props['modelValue']>(() => props.name, inputRules, {
115
+ syncVModel: !0,
116
+ label: getLabel,
117
+ ...toValue<any>(props.fieldOptions)
118
+ })
119
+ const { value, errorMessage, handleChange, handleBlur } = inputScope
120
+ const minLength = computed(() => parseInt(props.searchLength?.toString()))
121
+ const search = defineModel<string>('search', { required: !1, default: '' })
122
+ const getOptions = computed(() => {
123
+ if (!props.axiosMode && !props.noFilter && search.value?.length >= minLength.value) {
124
+ return props.options.filter((v: any) => {
125
+ if (typeof v !== 'object') {
126
+ return v.toString().toLowerCase().indexOf(search.value) > -1
127
+ }
128
+ let labelKey = 'label'
129
+ if (props.optionLabel) {
130
+ labelKey = typeof props.optionLabel === 'function' ? props.optionLabel(v) : props.optionLabel
131
+ }
132
+ let valueKey = 'value'
133
+ if (props.optionValue) {
134
+ valueKey = typeof props.optionValue === 'function' ? props.optionValue(v) : props.optionValue
135
+ }
136
+ return v[labelKey]?.toString().toLowerCase().indexOf(search.value) > -1 || v[valueKey]?.toString().toLowerCase().indexOf(search.value) > -1
137
+ })
138
+ }
139
+ return props.options
140
+ })
141
+ const filterFn: Props['onFilter'] = (val: string, update, abortFn) => {
142
+ if (props.onFilter) {
143
+ return props.onFilter(val, update, abortFn)
144
+ }
145
+ update(() => void 0)
146
+ }
147
+ const onDoneOptions = () => {
148
+ const e = input.value as QSelect
149
+ e?.updateInputValue('', !0)
150
+ e?.hidePopup()
151
+ }
152
+ const listeners = {
153
+ blur: (v: any) => handleBlur(v, !0),
154
+ 'update:modelValue': (v: Props['modelValue']) => {
155
+ handleChange(v, !!errorMessage.value)
156
+ if (!props.emitValue) {
157
+ emit('model', { value: v, model: v })
158
+ } else {
159
+ const k = typeof props.optionValue === 'function' ? props.optionValue(v) : props.optionValue
160
+ const model = props.options.find(e => e[k] === v)
161
+ emit('model', { value: v, model: model ?? null })
162
+ }
163
+ },
164
+ inputValue: (v: string) => (search.value = v?.toString() || ''),
165
+ filter: filterFn
166
+ }
167
+ const input = ref<InstanceType<typeof QSelect | typeof QField> | null>(null)
168
+ const scopes = reactive(inputScope)
169
+ defineExpose<typeof scopes & { input: typeof input, onDoneOptions: typeof onDoneOptions }>({ input, ...scopes, onDoneOptions })
170
+ defineOptions({ name: 'MSelect', inheritAttrs: !1 })
171
+ </script>
172
+
173
+ <template>
174
+ <MCol
175
+ :auto="auto"
176
+ :class="[$attrs.class,{'m--input__required':inputRules?.required!==undefined,'m--input__is-top-label':hasTopLabel,'m--input__error':!!errorMessage,'m--input__view':viewMode}]"
177
+ :col="col"
178
+ :lg="lg"
179
+ :md="md"
180
+ :name="name"
181
+ :sm="sm"
182
+ :xs="xs"
183
+ >
184
+ <slot
185
+ name="top-input"
186
+ v-bind="scopes"
187
+ />
188
+ <slot name="top-label">
189
+ <MInputLabel
190
+ v-if="hasTopLabel"
191
+ :field="scopes"
192
+ >
193
+ <MHelpRow
194
+ :text="help"
195
+ tooltip
196
+ />
197
+ </MInputLabel>
198
+ </slot>
199
+ <slot name="caption">
200
+ <div
201
+ v-if="!!caption"
202
+ class="m--input__caption"
203
+ >
204
+ {{ __(caption) }}
205
+ </div>
206
+ </slot>
207
+ <component
208
+ :is="viewMode ? QField : QSelect"
209
+ ref="input"
210
+ :behavior="$q.platform.is.ios === !0 ? 'dialog' : behavior"
211
+ :emit-value="emitValue"
212
+ :error="!!errorMessage"
213
+ :error-message="errorMessage"
214
+ :hide-selected="hideSelected !== undefined ? hideSelected : search.length > 0"
215
+ :hint="__(hint)"
216
+ :label="viewMode && hasTopLabel ? undefined : (loading ? undefined : getPlaceholder)"
217
+ :model-value="value"
218
+ :option-label="optionLabel"
219
+ :option-value="optionValue"
220
+ :options="getOptions"
221
+ :readonly="readonly"
222
+ v-bind="{
223
+ ...pluginOptions.select as any,
224
+ ...( viewMode ? pluginOptions.field : {} ),
225
+ ...$attrs,
226
+ ...(viewMode ? { stackLabel: !0 } : { stackLabel: hasTopLabel ? !1 : (
227
+ themeInput.dense !== undefined ? themeInput.dense : getProp('dense')
228
+ ) } ),
229
+ useChips: getProp('useChips') === !0 && !multiple ? !1 : getProp('useChips'),
230
+ multiple,
231
+ mapOptions,
232
+ loading,
233
+ useInput,
234
+ autocomplete:getAutocompleteAttribute,
235
+ clearable: viewMode ? !1 : clearable
236
+ }"
237
+ v-on="listeners"
238
+ >
239
+ <template
240
+ v-if="!hideEmptyList"
241
+ #no-option
242
+ >
243
+ <slot name="no-option">
244
+ <q-item :dense="themeInput.dense !== undefined ? themeInput.dense : getProp('optionsDense')">
245
+ <q-item-section side>
246
+ <template v-if="loading">
247
+ <q-spinner color="primary" />
248
+ </template>
249
+ <template v-else-if="search?.length > 0">
250
+ <q-icon
251
+ color="warning"
252
+ name="ion-ios-warning"
253
+ />
254
+ </template>
255
+ <template v-else-if="!search?.length">
256
+ <q-icon name="ion-ios-search" />
257
+ </template>
258
+ <template v-else>
259
+ <q-icon name="ion-ios-information-circle-outline" />
260
+ </template>
261
+ </q-item-section>
262
+ <q-item-section>
263
+ <template v-if="loading">
264
+ <q-skeleton
265
+ type="text"
266
+ width="70%"
267
+ />
268
+ <q-skeleton
269
+ type="text"
270
+ width="50%"
271
+ />
272
+ </template>
273
+ <template v-else-if="!search?.length && useInput">
274
+ {{ __('myth.select.typeToSearch') }}
275
+ </template>
276
+ <template v-else-if="search?.length > 0">
277
+ {{ __('myth.select.noResult') }}
278
+ </template>
279
+ <template v-else>
280
+ {{ __('myth.select.noData') }}
281
+ </template>
282
+ </q-item-section>
283
+ </q-item>
284
+ </slot>
285
+ </template>
286
+ <template
287
+ v-if="loading"
288
+ #selected
289
+ >
290
+ <q-skeleton width="60%" />
291
+ </template>
292
+ <template
293
+ v-if="multiple"
294
+ #before-options
295
+ >
296
+ <MContainer>
297
+ <MRow class="items-center">
298
+ <MBtn
299
+ :label="__('done')"
300
+ flat
301
+ @click="onDoneOptions()"
302
+ />
303
+ </MRow>
304
+ </MContainer>
305
+ </template>
306
+
307
+ <template
308
+ v-for="(_,slot) in $slots as Readonly<QSelectSlots>"
309
+ :key="slot"
310
+ #[slot]="inputSlot"
311
+ >
312
+ <slot
313
+ :name="slot"
314
+ v-bind="inputSlot || {}"
315
+ />
316
+ </template>
317
+
318
+ <template
319
+ v-if="viewMode"
320
+ #control
321
+ >
322
+ <slot name="control">
323
+ <MInputFieldControl>
324
+ {{ viewModeValue ?? value }}
325
+ </MInputFieldControl>
326
+ </slot>
327
+ </template>
328
+ </component>
329
+ <slot
330
+ name="help"
331
+ v-bind="scopes"
332
+ >
333
+ <MHelpRow
334
+ v-if="!hasTopLabel"
335
+ :text="help"
336
+ />
337
+ </slot>
338
+ <slot
339
+ name="bottom-input"
340
+ v-bind="scopes"
341
+ />
342
+ </MCol>
343
+ </template>
@@ -0,0 +1,45 @@
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 lang="ts" setup>
10
+ import type { MInputSlots, MTimeProps as Props } from '../../types'
11
+ import { useTemplateRef } from 'vue'
12
+ import MPicker from './MPicker.vue'
13
+
14
+ type P = {
15
+ name: Props['name'];
16
+ rules?: Props['rules'];
17
+ }
18
+ withDefaults(defineProps<P>(), {
19
+ name: () => '',
20
+ rules: undefined
21
+ })
22
+ const modelValue = defineModel<Props['modelValue']>({ required: !1, default: undefined })
23
+ const input = useTemplateRef<InstanceType<typeof MPicker>>('input')
24
+ defineExpose<{ input: typeof input }>({ input })
25
+ defineOptions({
26
+ name: 'MTime',
27
+ inheritAttrs: !1
28
+ })
29
+ </script>
30
+
31
+ <template>
32
+ <MPicker
33
+ ref="input"
34
+ v-model="modelValue"
35
+ v-bind="{...$attrs,type:'time',name}"
36
+ >
37
+ <template
38
+ v-for="(_,slot) in $slots as Readonly<MInputSlots>"
39
+ :key="slot"
40
+ #[slot]
41
+ >
42
+ <slot :name="slot" />
43
+ </template>
44
+ </MPicker>
45
+ </template>
@@ -0,0 +1,51 @@
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
+ import MAvatarViewer from './MAvatarViewer.vue'
10
+ import MBtn from './MBtn.vue'
11
+ import MCheckbox from './MCheckbox.vue'
12
+ import MColor from './MColor.vue'
13
+ import MDate from './MDate.vue'
14
+ import MEditor from './MEditor.vue'
15
+ import MEmail from './MEmail.vue'
16
+ import MField from './MField.vue'
17
+ import MFile from './MFile.vue'
18
+ import MForm from './MForm.vue'
19
+ import MHidden from './MHidden.vue'
20
+ import MHiddenInput from './MHiddenInput.vue'
21
+ import MInput from './MInput.vue'
22
+ import MInputFieldControl from './MInputFieldControl.vue'
23
+ import MInputLabel from './MInputLabel.vue'
24
+ import MMobile from './MMobile.vue'
25
+ import MPicker from './MPicker.vue'
26
+ import MRadio from './MRadio.vue'
27
+ import MSelect from './MSelect.vue'
28
+ import MTime from './MTime.vue'
29
+
30
+ export {
31
+ MAvatarViewer,
32
+ MBtn,
33
+ MCheckbox,
34
+ MColor,
35
+ MDate,
36
+ MEditor,
37
+ MField,
38
+ MFile,
39
+ MForm,
40
+ MHidden,
41
+ MHiddenInput,
42
+ MEmail,
43
+ MInput,
44
+ MInputFieldControl,
45
+ MInputLabel,
46
+ MMobile,
47
+ MPicker,
48
+ MRadio,
49
+ MSelect,
50
+ MTime
51
+ }
@@ -1,22 +1,43 @@
1
- <script lang="ts" setup>
2
- import type { MBlockProps } from '../../types'
3
- import { computed } from 'vue'
4
- import MythOptions from '../../myth'
5
- import { extend } from 'quasar'
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
+ -->
6
8
 
7
- interface Props {
8
- size?: MBlockProps['size'];
9
- rounded?: MBlockProps['rounded'];
10
- shadow?: MBlockProps['shadow'];
11
- }
9
+ <script
10
+ lang="ts"
11
+ setup
12
+ >
13
+ import type { MBlockProps as Props } from '../../types'
14
+ import { computed } from 'vue'
15
+ import { myth } from '../../utils'
12
16
 
13
17
  const props = withDefaults(defineProps<Props>(), {
14
- size: 'md',
15
- rounded: !1,
16
- shadow: 'none'
18
+ size: undefined,
19
+ rounded: undefined,
20
+ shadow: undefined
21
+ })
22
+ const getSize = computed(() => {
23
+ if (props.size !== undefined) {
24
+ return props.size
25
+ }
26
+ return myth.props.value.block?.size || myth.size.value
17
27
  })
18
- const block = computed(() => MythOptions.options.value.block ?? {})
19
- const options = computed<Props>(() => extend(!0, { ...props }, block.value))
28
+ const getRounded = computed(() => {
29
+ if (props.rounded !== undefined) {
30
+ return props.rounded
31
+ }
32
+ return myth.props.value.block?.rounded || myth.rounded.value
33
+ })
34
+ const getShadow = computed(() => {
35
+ if (props.shadow !== undefined) {
36
+ return props.shadow
37
+ }
38
+ return myth.props.value.block?.shadow || myth.shadow.value
39
+ })
40
+
20
41
  defineOptions({
21
42
  name: 'MBlock',
22
43
  inheritAttrs: !1
@@ -27,12 +48,13 @@ defineOptions({
27
48
  <div
28
49
  :class="{
29
50
  'm---block' : !0,
30
- [`q-pa-${options.size}`] : options.size && options.size !== 'none',
31
- 'rounded-borders' : options.rounded === !0,
32
- [`shadow-${options.shadow}`] : options.shadow && options.shadow !== 'none'
51
+ [`q-pa-${getSize}`] : getSize && getSize !== 'none',
52
+ 'rounded-borders' : getRounded === !0,
53
+ [`shadow-${getShadow||''}`] : getShadow && getShadow !== 'none'
33
54
  }"
34
55
  v-bind="$attrs"
35
56
  >
57
+ {{ getRounded }}
36
58
  <slot />
37
59
  </div>
38
60
  </template>
@@ -1,21 +1,18 @@
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
+
1
9
  <script
2
10
  lang="ts"
3
11
  setup
4
12
  >
5
13
  import { computed } from 'vue'
6
14
  import { uniq } from 'lodash'
7
- import type { MColProps } from '../../types'
8
-
9
- interface Props {
10
- name?: MColProps['name']
11
- auto?: MColProps['auto']
12
- col?: MColProps['col']
13
- xs?: MColProps['xs']
14
- sm?: MColProps['sm']
15
- md?: MColProps['md']
16
- lg?: MColProps['lg']
17
- xl?: MColProps['xl']
18
- }
15
+ import type { MColProps as Props } from '../../types'
19
16
 
20
17
  const props = defineProps<Props>()
21
18
  const classes = computed(() => {
@@ -45,8 +42,8 @@ const classes = computed(() => {
45
42
  list.push('col')
46
43
  }
47
44
  return uniq(list)
48
- // return list
49
45
  })
46
+
50
47
  defineOptions({
51
48
  name: 'MCol',
52
49
  inheritAttrs: !1
@@ -56,8 +53,7 @@ defineOptions({
56
53
  <template>
57
54
  <div
58
55
  :class="classes"
59
- :data-input-name="name??undefined"
60
- v-bind="$attrs"
56
+ v-bind="{...$attrs,':data-input-name': name??undefined}"
61
57
  >
62
58
  <slot />
63
59
  </div>
@@ -1,3 +1,11 @@
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
+
1
9
  <script lang="ts" setup>
2
10
  defineOptions({
3
11
  name: 'MColumn',
@@ -6,24 +6,33 @@
6
6
  - Github: https://github.com/mythpe
7
7
  -->
8
8
 
9
- <script lang="ts" setup>
9
+ <script
10
+ lang="ts"
11
+ setup
12
+ >
10
13
  import type { MContainerProps } from '../../types'
11
- import MythOptions from '../../myth'
14
+ import { myth } from '../../utils'
12
15
  import { computed } from 'vue'
13
16
 
14
- interface Props {
15
- size?: MContainerProps['size'];
16
- fluid?: MContainerProps['fluid'];
17
- dense?: MContainerProps['dense'];
18
- }
19
-
20
- const props = defineProps<Props>()
21
- const styles = computed(() => MythOptions.options.value?.style ?? {})
17
+ const props = withDefaults(defineProps<MContainerProps>(), {
18
+ size: undefined,
19
+ dense: !1,
20
+ fluid: undefined
21
+ })
22
22
  const sizeProp = computed(() => {
23
23
  if (props.size !== undefined) {
24
24
  return props.size
25
25
  }
26
- return styles.value.gutters
26
+ if (myth.props.value.container?.size !== undefined) {
27
+ return myth.props.value.container?.size
28
+ }
29
+ return myth.size.value
30
+ })
31
+ const fluidProp = computed(() => {
32
+ if (props.fluid !== undefined) {
33
+ return props.fluid
34
+ }
35
+ return myth.fluid.value === !0
27
36
  })
28
37
  defineOptions({
29
38
  name: 'MContainer',
@@ -35,8 +44,8 @@ defineOptions({
35
44
  <div
36
45
  :class="{
37
46
  'm--container' : !0,
38
- 'm--container__fluid' : (fluid !== !1 && fluid !== undefined) || (styles.fluid === !0 && (fluid !== !1 && fluid !== undefined)),
39
- 'm--container__dense' : dense !== !1 && dense !== undefined,
47
+ 'm--container__fluid' : fluidProp === !0,
48
+ 'm--container__dense' : dense === !0,
40
49
  [`q-pa-${sizeProp||''}`]: sizeProp && sizeProp !== 'none'
41
50
  }"
42
51
  v-bind="$attrs"
@@ -10,17 +10,11 @@
10
10
  lang="ts"
11
11
  setup
12
12
  >
13
- import { useI18n } from 'vue-i18n'
13
+ import { useMyth } from '../../composable'
14
+ import type { MHelpRowProps } from '../../types'
14
15
 
15
- interface Props {
16
- text?: string | undefined;
17
- icon?: string | undefined;
18
- tooltip?: boolean | undefined;
19
- }
20
-
21
- defineProps<Props>()
22
- const { t, te } = useI18n({ useScope: 'global' })
23
- const __ = (s: any) => !s ? '' : te(`attributes.${s}`) ? t(`attributes.${s}`) : te(s) ? t(s) : s
16
+ defineProps<MHelpRowProps>()
17
+ const { __ } = useMyth()
24
18
  defineOptions({
25
19
  name: 'MHelpRow',
26
20
  inheritAttrs: !1
@@ -28,11 +22,14 @@ defineOptions({
28
22
  </script>
29
23
 
30
24
  <template>
31
- <div class="row">
25
+ <div
26
+ v-if="text || tooltip"
27
+ class="row"
28
+ >
32
29
  <div class="col-auto">
33
30
  <q-icon
31
+ :class="{'cursor-pointer': !!tooltip}"
34
32
  :left="!!text && !tooltip"
35
- class="cursor-pointer"
36
33
  name="ion-ios-information-circle-outline"
37
34
  size="19px"
38
35
  >