@mythpe/quasar-ui-qui 0.0.47 → 0.0.49

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 (37) hide show
  1. package/package.json +1 -1
  2. package/src/components/datatable/MDatatable.vue +66 -70
  3. package/src/components/datatable/MDtBtn.vue +13 -13
  4. package/src/components/form/MBtn.vue +8 -155
  5. package/src/components/form/MCkeditor.vue +2 -2
  6. package/src/components/form/MEditor.vue +2 -4
  7. package/src/components/form/MField.vue +2 -6
  8. package/src/components/form/MFile.vue +6 -4
  9. package/src/components/form/MMobile.vue +3 -3
  10. package/src/components/form/MOptions.vue +1 -3
  11. package/src/components/form/MOtp.vue +1 -3
  12. package/src/components/form/MPicker.vue +8 -11
  13. package/src/components/form/MRadio.vue +4 -7
  14. package/src/components/form/MSelect.vue +3 -5
  15. package/src/components/form/MToggle.vue +3 -6
  16. package/src/components/form/MUploader.vue +8 -10
  17. package/src/components/grid/MBlock.vue +14 -4
  18. package/src/components/grid/MContainer.vue +10 -5
  19. package/src/components/grid/MRow.vue +5 -4
  20. package/src/components/modal/MDialog.vue +2 -2
  21. package/src/components/modal/MModalMenu.vue +4 -5
  22. package/src/components/modal/MTooltip.vue +2 -2
  23. package/src/components/parials/MUploaderItem.vue +5 -6
  24. package/src/composable/useBindInput.ts +12 -11
  25. package/src/composable/useMyth.ts +7 -16
  26. package/src/types/components.d.ts +5 -2
  27. package/src/types/index.d.ts +1 -4
  28. package/src/types/install-options.d.ts +15 -5
  29. package/src/types/myth-api.ts +36 -0
  30. package/src/types/plugin-props-option.d.ts +1 -11
  31. package/src/types/theme.d.ts +47 -0
  32. package/src/utils/const.ts +1 -0
  33. package/src/utils/createMyth.ts +42 -0
  34. package/src/utils/index.ts +3 -2
  35. package/src/utils/vue-plugin.ts +7 -3
  36. package/src/plugin/defineOptions.ts +0 -38
  37. package/src/utils/myth.ts +0 -112
@@ -10,166 +10,17 @@
10
10
  lang="ts"
11
11
  setup
12
12
  >
13
- import type { MBtnProps as Props } from '../../types'
13
+ import type { ButtonLoadingOptions, MBtnProps as Props } from '../../types'
14
14
  import { computed } from 'vue'
15
- import { myth } from '../../utils'
16
15
  import { useBindInput, useMyth } from '../../composable'
17
16
  import type { QBtnProps } from 'quasar'
18
17
 
19
- // const props = withDefaults(defineProps<Props>(), {
20
- // /**
21
- // * Size in CSS units, including unit name or standard size name (xs|sm|md|lg|xl)
22
- // */
23
- // size: undefined,
24
- // /**
25
- // * 1) Define the button native type attribute (submit, reset, button) or 2) render component with <a> tag so you can access events even if disable or 3) Use 'href' prop and specify 'type' as a media tag
26
- // * Default value: 'button'
27
- // */
28
- // type: undefined,
29
- // /**
30
- // * Equivalent to Vue Router <router-link> 'to' property; Superseded by 'href' prop if used
31
- // */
32
- // to: undefined,
33
- // /**
34
- // * Equivalent to Vue Router <router-link> 'replace' property; Superseded by 'href' prop if used
35
- // */
36
- // replace: undefined,
37
- // /**
38
- // * Native <a> link href attribute; Has priority over the 'to' and 'replace' props
39
- // */
40
- // href: undefined,
41
- // /**
42
- // * Native <a> link target attribute; Use it only with 'to' or 'href' props
43
- // */
44
- // target: undefined,
45
- // /**
46
- // * The text that will be shown on the button
47
- // */
48
- // label: undefined,
49
- // /**
50
- // * Icon name following Quasar convention; Make sure you have the icon library installed unless you are using 'img:' prefix; If 'none' (Str) is used as value then no icon is rendered (but screen real estate will still be used for it)
51
- // */
52
- // icon: undefined,
53
- // /**
54
- // * Icon name following Quasar convention; Make sure you have the icon library installed unless you are using 'img:' prefix; If 'none' (Str) is used as value then no icon is rendered (but screen real estate will still be used for it)
55
- // */
56
- // iconRight: undefined,
57
- // /**
58
- // * Use 'outline' design
59
- // */
60
- // outline: undefined,
61
- // /**
62
- // * Use 'flat' design
63
- // */
64
- // flat: undefined,
65
- // /**
66
- // * Remove shadow
67
- // */
68
- // unelevated: undefined,
69
- // /**
70
- // * Applies a more prominent border-radius for a squared shape button
71
- // */
72
- // rounded: undefined,
73
- // /**
74
- // * Use 'push' design
75
- // */
76
- // push: undefined,
77
- // /**
78
- // * Removes border-radius so borders are squared
79
- // */
80
- // square: undefined,
81
- // /**
82
- // * Applies a glossy effect
83
- // */
84
- // glossy: undefined,
85
- // /**
86
- // * Makes button size and shape to fit a Floating Action Button
87
- // */
88
- // fab: undefined,
89
- // /**
90
- // * Makes button size and shape to fit a small Floating Action Button
91
- // */
92
- // fabMini: undefined,
93
- // /**
94
- // * Apply custom padding (vertical [horizontal]); Size in CSS units, including unit name or standard size name (none|xs|sm|md|lg|xl); Also removes the min width and height when set
95
- // */
96
- // padding: undefined,
97
- // /**
98
- // * Color name for component from the Quasar Color Palette
99
- // */
100
- // color: 'primary',
101
- // /**
102
- // * Overrides text color (if needed); Color name from the Quasar Color Palette
103
- // */
104
- // textColor: undefined,
105
- // /**
106
- // * Avoid turning label text into caps (which happens by default)
107
- // */
108
- // noCaps: undefined,
109
- // /**
110
- // * Avoid label text wrapping
111
- // */
112
- // noWrap: undefined,
113
- // /**
114
- // * Dense mode; occupies less space
115
- // */
116
- // dense: undefined,
117
- // /**
118
- // * Configure material ripple (disable it by setting it to 'false' or supply a config object)
119
- // * Default value: true
120
- // */
121
- // ripple: undefined,
122
- // /**
123
- // * Tabindex HTML attribute value
124
- // */
125
- // tabindex: undefined,
126
- // /**
127
- // * Label or content alignment
128
- // * Default value: 'center'
129
- // */
130
- // align: undefined,
131
- // /**
132
- // * Stack icon and label vertically instead of on same line (like it is by default)
133
- // */
134
- // stack: undefined,
135
- // /**
136
- // * When used on flexbox parent, button will stretch to parent's height
137
- // */
138
- // stretch: undefined,
139
- // /**
140
- // * Put button into loading state (displays a QSpinner -- can be overridden by using a 'loading' slot)
141
- // * Default value: null
142
- // */
143
- // loading: undefined,
144
- // /**
145
- // * Put component in disabled mode
146
- // */
147
- // disable: undefined,
148
- // /**
149
- // * Makes a circle shaped button
150
- // */
151
- // round: undefined,
152
- // /**
153
- // * Percentage (0.0 < x < 100.0); To be used along 'loading' prop; Display a progress bar on the background
154
- // */
155
- // percentage: undefined,
156
- // /**
157
- // * Progress bar on the background should have dark color; To be used along with 'percentage' and 'loading' props
158
- // */
159
- // darkPercentage: undefined,
160
- // /**
161
- // * Emitted when the component is clicked
162
- // * @param evt JS event object; If you are using route navigation ('to'/'replace' props) and you want to cancel navigation then call evt.preventDefault() synchronously in your event handler
163
- // * @param go Available ONLY if you are using route navigation ('to'/'replace' props); When you need to control the time at which the component should trigger the route navigation then call evt.preventDefault() synchronously and then call this function at your convenience; Useful if you have async work to be done before the actual route navigation or if you want to redirect somewhere else
164
- // */
165
- // onClick: undefined
166
- // })
167
18
  const props = defineProps<Props>()
168
- const { __ } = useMyth()
169
- const btnLoading = computed(() => myth.btnLoading.value)
19
+ const { __, theme } = useMyth()
20
+ const btnLoading = computed(() => theme.value.buttonLoading as ButtonLoadingOptions)
170
21
  const getLabel = computed<string | undefined>(() => props.label ? (__(props.label) ?? undefined) : undefined)
171
- const getSize = computed<string>(() => myth.btnLoading.value?.size || '20px')
172
- const getColor = computed<string | undefined>(() => myth.btnLoading.value?.color || undefined)
22
+ const getSize = computed<string | undefined>(() => btnLoading.value.size)
23
+ const getColor = computed<string | undefined>(() => btnLoading.value.color)
173
24
  const { attrs } = useBindInput<QBtnProps & { name: string }>(() => props, 'btn')
174
25
  defineOptions({
175
26
  name: 'MBtn',
@@ -180,9 +31,11 @@ defineOptions({
180
31
  <template>
181
32
  <q-btn
182
33
  v-bind="{
34
+ ariaLabel: getLabel,
35
+ ...$attrs,
183
36
  ...attrs,
37
+ ...theme.buttons,
184
38
  label: loading ? `${getLabel} ...` : getLabel,
185
- ariaLabel: 'ariaLabel' in attrs && attrs.ariaLabel ? __(attrs.ariaLabel) : getLabel
186
39
  }"
187
40
  >
188
41
  <template
@@ -120,7 +120,7 @@ const props = withDefaults(defineProps<P>(), {
120
120
  fieldOptions: undefined
121
121
  })
122
122
  defineModel<Props['modelValue']>({ required: !1, default: undefined })
123
- const { __, mOptions } = useMyth()
123
+ const { __, props: pluginOptions } = useMyth()
124
124
  const helper = useBindInput<any>(() => props, 'ckeditor')
125
125
  const { getLabel, inputRules } = helper
126
126
  const inputScope = useField<Props['modelValue']>(() => props.name, inputRules, {
@@ -389,7 +389,7 @@ defineOptions({
389
389
  :editor="ClassicEditor"
390
390
  :model-value="value || ''"
391
391
  :tag-name="tagName"
392
- v-bind="{...$attrs,...mOptions.ckeditor}"
392
+ v-bind="{...$attrs,...pluginOptions.ckeditor}"
393
393
  v-on="listeners"
394
394
  />
395
395
  <slot v-bind="scopes" />
@@ -15,7 +15,6 @@ import { useBindInput, useMyth } from '../../composable'
15
15
  import { useField } from 'vee-validate'
16
16
  import type { MEditorProps as Props } from '../../types'
17
17
  import { reactive, toValue, useTemplateRef } from 'vue'
18
- import { myth } from '../../utils'
19
18
 
20
19
  const $q = useQuasar()
21
20
  const _toolbar = [
@@ -176,8 +175,7 @@ const props = withDefaults(defineProps<P>(), {
176
175
  fieldOptions: undefined,
177
176
  useChoice: undefined
178
177
  })
179
- const { __ } = useMyth()
180
- const { props: pluginOptions, themeInput } = myth
178
+ const { __, props: pluginOptions, theme } = useMyth()
181
179
  defineModel<Props['modelValue']>({ required: !1, default: undefined })
182
180
  const helper = useBindInput<any>(() => props, 'editor')
183
181
  const { hasTopLabel, getLabel, getPlaceholder, inputRules } = helper
@@ -256,7 +254,7 @@ defineOptions({
256
254
  ...( viewMode ? pluginOptions.field : {} ),
257
255
  ...$attrs,
258
256
  ...( viewMode ? { stackLabel: !0 } : {} ),
259
- dense: themeInput.dense !== undefined ? themeInput.dense : $q.screen.lt.lg
257
+ dense: theme.inputs.dense !== undefined ? theme.inputs.dense : $q.screen.lt.lg
260
258
  }"
261
259
  v-on="listeners"
262
260
  />
@@ -17,7 +17,6 @@ import { useTemplateRef } from 'vue'
17
17
  import type { QFieldSlots } from 'quasar'
18
18
  import { QField } from 'quasar'
19
19
  import { useBindInput, useMyth } from '../../composable'
20
- import { myth } from '../../utils'
21
20
 
22
21
  type P = {
23
22
  name: Props['name'];
@@ -61,10 +60,9 @@ const props = withDefaults(defineProps<P>(), {
61
60
  clearable: undefined
62
61
  })
63
62
  const { __ } = useMyth()
64
- const { props: options } = myth
65
63
  const modelValue = defineModel<Props['modelValue']>({ required: !1, default: undefined })
66
64
  const helper = useBindInput<P>(() => props, 'input')
67
- const { hasTopLabel, getLabel, getPlaceholder, inputRules } = helper
65
+ const { hasTopLabel, getLabel, getPlaceholder, inputRules, attrs } = helper
68
66
  const value = useFieldValue(() => props.name)
69
67
  const errorMessage = useFieldError(() => props.name)
70
68
  const input = useTemplateRef<InstanceType<typeof QField>>('input')
@@ -109,10 +107,8 @@ defineOptions({
109
107
  <q-field
110
108
  ref="input"
111
109
  v-bind="{
112
- ...options.input as any,
113
- ...options.field as any,
114
110
  ...$attrs,
115
- ...myth.themeInput,
111
+ ...attrs as any,
116
112
  clearable: !1,
117
113
  stackLabel: !0,
118
114
  error:!!errorMessage,
@@ -17,7 +17,6 @@ import { useBindInput, useMyth } from '../../composable'
17
17
  import { useField } from 'vee-validate'
18
18
  import { reactive, toValue, useTemplateRef } from 'vue'
19
19
  import type { MFileProps as Props } from '../../types'
20
- import { myth } from '../../utils'
21
20
 
22
21
  interface P {
23
22
  name: Props['name'];
@@ -76,9 +75,8 @@ const props = withDefaults(defineProps<P>(), {
76
75
  })
77
76
  defineModel<Props['modelValue']>({ required: !1, default: undefined })
78
77
  const { __ } = useMyth()
79
- const { props: options } = myth
80
78
  const helper = useBindInput<P>(() => props, 'file', () => ({ choose: !0 }))
81
- const { hasTopLabel, getLabel, getPlaceholder, accepts, inputRules } = helper
79
+ const { hasTopLabel, getLabel, getPlaceholder, accepts, inputRules, attrs } = helper
82
80
  const inputScope = useField<Props['modelValue']>(() => props.name, inputRules, {
83
81
  syncVModel: !0,
84
82
  label: getLabel,
@@ -164,7 +162,11 @@ defineOptions({
164
162
  :hint="__(hint)"
165
163
  :label="hasTopLabel ? (viewMode ? undefined : getPlaceholder) : getLabel"
166
164
  :model-value="value"
167
- v-bind="{ ...options.file as any,...( viewMode ? options.field : {} ), ...$attrs, ...( viewMode ? { stackLabel: !0 } : {} ) }"
165
+ v-bind="{
166
+ ...$attrs,
167
+ ...attrs as any,
168
+ ...( viewMode ? { stackLabel: !0 } : {} )
169
+ }"
168
170
  v-on="listeners"
169
171
  >
170
172
  <template #prepend>
@@ -13,11 +13,11 @@
13
13
  import type { MInputProps as Props, MInputSlots } from '../../types'
14
14
  import { useTemplateRef } from 'vue'
15
15
  import MInput from './MInput.vue'
16
- import { myth } from '../../utils'
16
+ import { useMyth } from '../../composable'
17
17
 
18
+ const { props: pluginOptions } = useMyth()
18
19
  const modelValue = defineModel<Props['modelValue']>({ required: !1, default: undefined })
19
20
  const input = useTemplateRef<InstanceType<typeof MInput>>('input')
20
- const { props: options } = myth
21
21
  defineExpose<{ input: typeof input }>({ input })
22
22
  defineOptions({
23
23
  name: 'MMobile',
@@ -30,7 +30,7 @@ defineOptions({
30
30
  ref="input"
31
31
  v-model="modelValue"
32
32
  type="tel"
33
- v-bind="{...options.mobile as any,...$attrs}"
33
+ v-bind="{...pluginOptions.mobile as any,...$attrs}"
34
34
  >
35
35
  <template
36
36
  v-for="(_,slot) in $slots as Readonly<MInputSlots>"
@@ -16,7 +16,6 @@ import type { MOptionsOptionContext, MOptionsProps as Props } from '../../types'
16
16
  import { reactive, toValue, useTemplateRef } from 'vue'
17
17
  import { QField, QOptionGroup, type QOptionGroupSlots } from 'quasar'
18
18
  import { useBindInput, useMyth } from '../../composable'
19
- import { myth } from '../../utils'
20
19
 
21
20
  type P = {
22
21
  name: Props['name'];
@@ -92,8 +91,7 @@ const listeners = {
92
91
  const input = useTemplateRef<InstanceType<typeof QField> | InstanceType<typeof QOptionGroup>>('input')
93
92
  const scopes = reactive(inputScope)
94
93
  defineExpose<typeof scopes & { input: typeof input }>({ input, ...scopes })
95
- const { alertError, __ } = useMyth()
96
- const { props: pluginProps } = myth
94
+ const { alertError, __, props: pluginProps } = useMyth()
97
95
  const fetchData = async () => {
98
96
  if (props.service) {
99
97
  loading.value = !0
@@ -16,7 +16,6 @@ import { computed, nextTick, onBeforeUnmount, onBeforeUpdate, ref, watch, watchE
16
16
  import { date } from 'quasar'
17
17
  import type { MOtpProps as Props } from '../../types'
18
18
  import { useMyth } from '../../composable'
19
- import { myth } from '../../utils'
20
19
 
21
20
  export interface P {
22
21
  // modelValue?: Props['modelValue'];
@@ -36,8 +35,7 @@ type Emits = {
36
35
  (e: 'send'): void;
37
36
  }
38
37
  const emit = defineEmits<Emits>()
39
- const { __ } = useMyth()
40
- const { props: pluginOptions } = myth
38
+ const { __, props: pluginOptions } = useMyth()
41
39
  const props = withDefaults(defineProps<P>(), {
42
40
  // modelValue: undefined,
43
41
  inputLength: () => 6,
@@ -16,7 +16,6 @@ import { useBindInput, useMyth } from '../../composable'
16
16
  import { useField } from 'vee-validate'
17
17
  import type { QFieldSlots } from 'quasar'
18
18
  import { QDate, QField, QTime } from 'quasar'
19
- import { myth } from '../../utils'
20
19
 
21
20
  const defSeparator = ' - '
22
21
  const props = withDefaults(defineProps<Omit<Props, 'prefix'>>(), {
@@ -83,9 +82,7 @@ const props = withDefaults(defineProps<Omit<Props, 'prefix'>>(), {
83
82
  defineModel<Props['modelValue']>({ required: !1, default: undefined })
84
83
  const helper = useBindInput<Props>(() => props, 'picker', () => ({ choose: !0 }))
85
84
  const { hasTopLabel, getLabel, getPlaceholder, inputRules, getAutocompleteAttribute, getProp } = helper
86
- const { __ } = useMyth()
87
- const options = computed(() => myth.props.value)
88
- const theme = computed(() => myth.themeInput)
85
+ const { __, props: pluginOptions, theme } = useMyth()
89
86
  const inputScope = useField<Props['modelValue']>(() => props.name, inputRules, {
90
87
  syncVModel: !0,
91
88
  label: getLabel,
@@ -175,9 +172,9 @@ defineOptions({
175
172
  :hint="__(hint)"
176
173
  :label="hasTopLabel ? undefined : getLabel"
177
174
  v-bind="{
178
- ...options.input as any,
179
- ...options.field as any,
180
- ...theme,
175
+ ...pluginOptions.input as any,
176
+ ...pluginOptions.field as any,
177
+ ...theme.inputs,
181
178
  ...$attrs,
182
179
  autocomplete:getAutocompleteAttribute,
183
180
  stackLabel: !0
@@ -197,7 +194,7 @@ defineOptions({
197
194
  <template v-else>
198
195
  <div>
199
196
  <template v-if="value && Array.isArray(value)">
200
- {{ value.join(rangeSeparator || options.picker?.rangeSeparator || defSeparator) }}
197
+ {{ value.join(rangeSeparator || pluginOptions.picker?.rangeSeparator || defSeparator) }}
201
198
  </template>
202
199
  <template v-else>
203
200
  {{ value?.toString() }}
@@ -212,7 +209,7 @@ defineOptions({
212
209
  :icon="isDate ? 'ion-ios-calendar' : 'ion-ios-clock'"
213
210
  flat
214
211
  round
215
- v-bind="{...options?.pickerBtn, ...btnProps}"
212
+ v-bind="{...pluginOptions?.pickerBtn, ...btnProps}"
216
213
  >
217
214
  <q-popup-proxy
218
215
  cover
@@ -228,7 +225,7 @@ defineOptions({
228
225
  v-if="isDate"
229
226
  ref="dateElm"
230
227
  v-bind="{
231
- ...options.date as any,
228
+ ...pluginOptions.date as any,
232
229
  ...props,
233
230
  ...$attrs,
234
231
  todayBtn: getProp('todayBtn') === undefined ? !0 : getProp('todayBtn'),
@@ -261,7 +258,7 @@ defineOptions({
261
258
  ref="timeElm"
262
259
  v-bind="{
263
260
  ...$props,
264
- ...options.time,
261
+ ...pluginOptions.time,
265
262
  ...$attrs,
266
263
  mask:format,
267
264
  nowBtn: getProp('nowBtn') === undefined? !0 : getProp('nowBtn'),
@@ -15,7 +15,6 @@ import { reactive, toValue, useTemplateRef } from 'vue'
15
15
  import { useBindInput, useMyth } from '../../composable'
16
16
  import type { MRadioProps as Props } from '../../types'
17
17
  import { QField, QRadio } from 'quasar'
18
- import { myth } from '../../utils'
19
18
 
20
19
  type P = {
21
20
  auto?: Props['auto'];
@@ -75,8 +74,7 @@ const inputScope = useField<Props['modelValue']>(() => props.name, inputRules, {
75
74
  ...toValue<any>(props.fieldOptions)
76
75
  })
77
76
  const { value, errorMessage, handleChange } = inputScope
78
- const { __ } = useMyth()
79
- const { props: options } = myth
77
+ const { __, props: pluginOptions } = useMyth()
80
78
  const listeners = {
81
79
  'update:modelValue': (v: Props['modelValue']) => handleChange(v, !!errorMessage.value)
82
80
  }
@@ -123,10 +121,9 @@ defineOptions({
123
121
  :error-message="errorMessage"
124
122
  :hint="__(hint)"
125
123
  v-bind="{
126
- ...options.input as any,
127
- ...options.field,
124
+ ...pluginOptions.input as any,
125
+ ...pluginOptions.field,
128
126
  ...$attrs,
129
- ...myth.themeInput,
130
127
  borderless: !0,
131
128
  outlined: !1,
132
129
  stackLabel: !0
@@ -139,7 +136,7 @@ defineOptions({
139
136
  :model-value="value"
140
137
  :val="val"
141
138
  v-bind="{
142
- ...options.radio,
139
+ ...pluginOptions.radio,
143
140
  ...$attrs,
144
141
  dense: attrs.dense,
145
142
  checkedIcon: getProp('checkedIcon'),
@@ -16,7 +16,6 @@ import type { MSelectProps as Props } from '../../types'
16
16
  import { computed, reactive, toValue, useTemplateRef } from 'vue'
17
17
  import { useBindInput, useMyth } from '../../composable'
18
18
  import { QField, QSelect, type QSelectSlots } from 'quasar'
19
- import { myth } from '../../utils'
20
19
 
21
20
  type P = {
22
21
  name: Props['name'];
@@ -110,8 +109,7 @@ type Emits = {
110
109
  }
111
110
  const emit = defineEmits<Emits>()
112
111
 
113
- const { __ } = useMyth()
114
- const { props: pluginOptions, themeInput } = myth
112
+ const { __, props: pluginOptions, theme } = useMyth()
115
113
  const helper = useBindInput<P & Props>(() => props, 'select', () => ({ choose: !0 }))
116
114
  const { attrs, hasTopLabel, getLabel, getPlaceholder, getAutocompleteAttribute, inputRules, getProp } = helper
117
115
  const inputScope = useField<Props['modelValue']>(() => props.name, inputRules, {
@@ -231,7 +229,7 @@ defineOptions({
231
229
  options: getOptions,
232
230
  readonly: readonly,
233
231
  ...(viewMode ? { stackLabel: !0 } : { stackLabel: hasTopLabel ? !1 : (
234
- themeInput.dense !== undefined ? themeInput.dense : getProp('dense')
232
+ theme.inputs.dense !== undefined ? theme.inputs.dense : getProp('dense')
235
233
  ) } ),
236
234
  useChips: getProp('useChips') === !0 && !multiple ? !1 : getProp('useChips'),
237
235
  multiple,
@@ -250,7 +248,7 @@ defineOptions({
250
248
  #no-option
251
249
  >
252
250
  <slot name="no-option">
253
- <q-item :dense="themeInput.dense !== undefined ? themeInput.dense : getProp('optionsDense')">
251
+ <q-item :dense="theme.inputs.dense !== undefined ? theme.inputs.dense : getProp('optionsDense')">
254
252
  <q-item-section side>
255
253
  <template v-if="loading">
256
254
  <q-spinner color="primary" />
@@ -15,7 +15,6 @@ import { useField } from 'vee-validate'
15
15
  import type { MToggleProps as Props } from '../../types'
16
16
  import { useBindInput, useMyth } from '../../composable'
17
17
  import { QToggle } from 'quasar'
18
- import { myth } from '../../utils'
19
18
 
20
19
  interface P {
21
20
  auto?: Props['auto'];
@@ -97,9 +96,7 @@ const { value, errorMessage, handleChange } = inputScope
97
96
  const listeners = {
98
97
  'update:modelValue': (v: Props['modelValue']) => handleChange(v, !!errorMessage.value)
99
98
  }
100
-
101
- const { __ } = useMyth()
102
- const { props: pluginOptions, themeInput } = myth
99
+ const { __, props: pluginOptions, theme } = useMyth()
103
100
  const getLabel = computed<string | undefined>(() => {
104
101
  const def = undefined
105
102
  const v = value.value
@@ -172,7 +169,7 @@ defineOptions({
172
169
  ...$attrs,
173
170
  borderless: !0,
174
171
  outlined: !1,
175
- dense: themeInput.dense !== undefined ? themeInput.dense : getProp('dense')
172
+ dense: theme.inputs.dense !== undefined ? theme.inputs.dense : getProp('dense')
176
173
  }"
177
174
  >
178
175
  <q-toggle
@@ -185,7 +182,7 @@ defineOptions({
185
182
  v-bind="{
186
183
  ...pluginOptions.toggle,
187
184
  ...$attrs,
188
- dense: themeInput.dense !== undefined ? themeInput.dense : getProp('dense'),
185
+ dense: theme.inputs.dense !== undefined ? theme.inputs.dense : getProp('dense'),
189
186
  checkedIcon: getProp('checkedIcon'),
190
187
  uncheckedIcon: getProp('uncheckedIcon'),
191
188
  color: !!errorMessage ? 'negative' : getProp('color'),
@@ -10,7 +10,7 @@
10
10
  setup
11
11
  >
12
12
  import { QList, type QRejectedEntry, QUploader, type QUploaderFactoryObject } from 'quasar'
13
- import { computed, nextTick, reactive, useTemplateRef, watch } from 'vue'
13
+ import { computed, nextTick, useTemplateRef, watch } from 'vue'
14
14
  import { useBindInput, useError, useMyth, useValue } from '../../composable'
15
15
  import type { MUploaderMediaItem, MUploaderProps as Props, MUploaderXhrInfo } from '../../types'
16
16
  import { useFieldArray, useFieldValue, useFormValues, useResetForm } from 'vee-validate'
@@ -131,9 +131,7 @@ type Emits = {
131
131
  const emit = defineEmits<Emits>()
132
132
 
133
133
  type Form = Record<string, any>;
134
- const $myth = useMyth()
135
- const { alertError, alertSuccess, __ } = $myth
136
- const { mOptions, api, mAxios, baseUrl } = reactive($myth)
134
+ const { alertError, alertSuccess, __, api, props: pluginOptions } = useMyth()
137
135
  const fieldId = useFieldValue<string | undefined>('id')
138
136
  const modelIdProp = computed(() => props.modelId !== undefined ? props.modelId : fieldId.value)
139
137
  const modelValue = defineModel<Props['modelValue']>({ required: !1, default: undefined })
@@ -171,7 +169,7 @@ const setModelValue = async (value: Props['modelValue']) => {
171
169
  const uploader = useTemplateRef<InstanceType<typeof QUploader>>('uploader')
172
170
  const uploading = defineModel<boolean>('uploading', { required: !1, default: () => !1 })
173
171
  const { accepts } = useBindInput<any>(() => props, 'uploader')
174
- const iconsSizeProp = computed(() => mOptions.uploaderOptions?.iconsSize || props.iconsSize)
172
+ const iconsSizeProp = computed(() => pluginOptions.value.uploaderOptions?.iconsSize || props.iconsSize)
175
173
 
176
174
  /* Events Callback */
177
175
  const startUpload = async (files: readonly File[]): Promise<QUploaderFactoryObject> => {
@@ -181,7 +179,7 @@ const startUpload = async (files: readonly File[]): Promise<QUploaderFactoryObje
181
179
  return
182
180
  }
183
181
  try {
184
- const common = mAxios?.defaults?.headers.common || {}
182
+ const common = api.value.axios?.defaults?.headers.common || {}
185
183
  const headers: { name: string; value: string; }[] = []
186
184
  setErrors([])
187
185
  for (const i in common) {
@@ -223,17 +221,17 @@ const startUpload = async (files: readonly File[]): Promise<QUploaderFactoryObje
223
221
  formFields.push({ name: 'return', value: props.returnType })
224
222
  }
225
223
  const url: string = typeof props.service === 'string'
226
- ? api?.[props.service]?.getUploadAttachmentsUrl(modelIdProp.value)
224
+ ? api.value.services?.[props.service]?.getUploadAttachmentsUrl(modelIdProp.value)
227
225
  : props.service.getUploadAttachmentsUrl(modelIdProp.value)
228
226
  const resolveValue = {
229
- url: `${baseUrl}/${url}`,
227
+ url: `${api.value.url}/${url}`,
230
228
  method: 'POST',
231
229
  headers,
232
230
  formFields
233
231
  }
234
232
  emit('startUpload', {
235
233
  files,
236
- url: `${baseUrl}/${url}`,
234
+ url: `${api.value.url}/${url}`,
237
235
  method: 'POST',
238
236
  headers,
239
237
  formFields
@@ -338,7 +336,7 @@ defineOptions({
338
336
  :label="__(label)"
339
337
  :readonly="readonly"
340
338
  style="width: 100%;max-height: 450px;"
341
- v-bind="{...mOptions.uploader as any,...$attrs}"
339
+ v-bind="{...pluginOptions.uploader as any,...$attrs}"
342
340
  @failed="onError"
343
341
  @rejected="onReject"
344
342
  @uploaded="onFinishUpload"
@@ -12,30 +12,40 @@
12
12
  >
13
13
  import type { MBlockProps as Props } from '../../types'
14
14
  import { computed } from 'vue'
15
- import { myth } from '../../utils'
15
+ import { useMyth } from '../../composable'
16
16
 
17
17
  const props = withDefaults(defineProps<Props>(), {
18
18
  size: undefined,
19
19
  rounded: undefined,
20
20
  shadow: undefined
21
21
  })
22
+ const { theme, props: pluginOptions } = useMyth()
22
23
  const getSize = computed(() => {
23
24
  if (props.size !== undefined) {
24
25
  return props.size
25
26
  }
26
- return myth.props.value.block?.size || myth.size.value
27
+ if (pluginOptions.value.block?.size !== undefined) {
28
+ return pluginOptions.value.block?.size
29
+ }
30
+ return theme.value.size
27
31
  })
28
32
  const getRounded = computed(() => {
29
33
  if (props.rounded !== undefined) {
30
34
  return props.rounded
31
35
  }
32
- return myth.props.value.block?.rounded || myth.rounded.value
36
+ if (pluginOptions.value.block?.rounded !== undefined) {
37
+ return pluginOptions.value.block?.rounded
38
+ }
39
+ return theme.value.rounded
33
40
  })
34
41
  const getShadow = computed(() => {
35
42
  if (props.shadow !== undefined) {
36
43
  return props.shadow
37
44
  }
38
- return myth.props.value.block?.shadow || myth.shadow.value
45
+ if (pluginOptions.value.block?.shadow !== undefined) {
46
+ return pluginOptions.value.block?.shadow
47
+ }
48
+ return theme.value.shadow
39
49
  })
40
50
 
41
51
  defineOptions({