@mythpe/quasar-ui-qui 0.0.26-dev → 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 (54) hide show
  1. package/index.d.ts +0 -4
  2. package/package.json +2 -1
  3. package/src/components/datatable/MDatatable.vue +2305 -0
  4. package/src/components/datatable/MDtAvatar.vue +49 -0
  5. package/src/components/datatable/MDtBtn.vue +153 -0
  6. package/src/components/datatable/MDtContextmenuItems.vue +54 -0
  7. package/src/components/datatable/index.ts +6 -0
  8. package/src/components/form/MAvatarViewer.vue +6 -3
  9. package/src/components/form/MAxios.vue +7 -4
  10. package/src/components/form/MCheckbox.vue +33 -9
  11. package/src/components/form/MDate.vue +4 -1
  12. package/src/components/form/MEmail.vue +4 -1
  13. package/src/components/form/MField.vue +4 -1
  14. package/src/components/form/MFile.vue +5 -2
  15. package/src/components/form/MForm.vue +4 -1
  16. package/src/components/form/MHiddenInput.vue +4 -1
  17. package/src/components/form/MInput.vue +1 -1
  18. package/src/components/form/MInputLabel.vue +4 -1
  19. package/src/components/form/MMobile.vue +4 -1
  20. package/src/components/form/MOptions.vue +255 -0
  21. package/src/components/form/MOtp.vue +292 -0
  22. package/src/components/form/MRadio.vue +5 -2
  23. package/src/components/form/MSelect.vue +4 -1
  24. package/src/components/form/MTime.vue +4 -1
  25. package/src/components/form/MToggle.vue +211 -0
  26. package/src/components/form/MUploader.vue +511 -0
  27. package/src/components/form/index.ts +9 -1
  28. package/src/components/grid/MColumn.vue +4 -1
  29. package/src/components/grid/MHelpRow.vue +5 -1
  30. package/src/components/index.ts +3 -0
  31. package/src/components/modal/MDialog.vue +58 -0
  32. package/src/components/modal/MModalMenu.vue +62 -0
  33. package/src/components/modal/MTooltip.vue +39 -0
  34. package/src/components/modal/index.ts +5 -0
  35. package/src/components/parials/UploaderItem.vue +298 -0
  36. package/src/components/parials/index.ts +3 -0
  37. package/src/components/transition/MTransition.vue +4 -1
  38. package/src/composable/useBindInput.ts +1 -1
  39. package/src/composable/useMyth.ts +20 -11
  40. package/src/index.sass +2 -1
  41. package/src/style/main.sass +104 -0
  42. package/src/style/print.sass +14 -0
  43. package/src/style/transition.sass +40 -0
  44. package/src/types/api-helpers.d.ts +11 -72
  45. package/src/types/components.d.ts +411 -105
  46. package/src/types/index.d.ts +5 -139
  47. package/src/types/install-options.d.ts +19 -0
  48. package/src/types/m-datatable.d.ts +316 -0
  49. package/src/types/m-geolocation.d.ts +16 -0
  50. package/src/types/m-helpers.d.ts +97 -0
  51. package/src/types/plugin-props-option.d.ts +301 -0
  52. package/src/utils/myth.ts +15 -1
  53. package/src/utils/vue-plugin.ts +34 -2
  54. package/src/types/dt.d.ts +0 -144
@@ -0,0 +1,49 @@
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 { useMyth } from '../../composable'
15
+
16
+ interface Props {
17
+ width?: string | undefined
18
+ src?: string | undefined
19
+ href?: string | undefined;
20
+ }
21
+
22
+ withDefaults(defineProps<Props>(), {
23
+ width: '50px',
24
+ src: undefined,
25
+ href: undefined
26
+ })
27
+ const { openWindow } = useMyth()
28
+ defineOptions({
29
+ name: 'MDtAvatar',
30
+ inheritAttrs: !1
31
+ })
32
+ </script>
33
+
34
+ <template>
35
+ <q-avatar
36
+ rounded
37
+ v-bind="$attrs"
38
+ >
39
+ <q-img
40
+ v-if="src"
41
+ :height="width"
42
+ :src="src"
43
+ :width="width"
44
+ class="cursor-pointer"
45
+ fit="contain"
46
+ @click="openWindow(Boolean(href) ? href: src)"
47
+ />
48
+ </q-avatar>
49
+ </template>
@@ -0,0 +1,153 @@
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 { computed } from 'vue'
15
+ import { useMyth } from '../../composable'
16
+
17
+ interface Props {
18
+ show?: boolean | undefined;
19
+ update?: boolean | undefined;
20
+ destroy?: boolean | undefined;
21
+ tooltip?: string | null | undefined;
22
+ color?: string | undefined;
23
+ icon?: string | undefined;
24
+ listItem?: boolean | undefined;
25
+ label?: string | undefined;
26
+ round?: boolean | undefined;
27
+ dense?: boolean | undefined;
28
+ fabMini?: boolean | undefined;
29
+ }
30
+
31
+ const props = withDefaults(defineProps<Props>(), {
32
+ show: undefined,
33
+ update: undefined,
34
+ destroy: undefined,
35
+ color: undefined,
36
+ icon: undefined,
37
+ tooltip: undefined,
38
+ listItem: undefined,
39
+ label: undefined,
40
+ round: undefined,
41
+ dense: undefined,
42
+ fabMini: undefined
43
+ })
44
+ type Events = {
45
+ (e: 'click', evt: Event): void;
46
+ }
47
+ const emit = defineEmits<Events>()
48
+
49
+ const hasTooltip = computed(() => !!props.tooltip || !!props.show || !!props.update || !!props.destroy)
50
+ const { __, mOptions } = useMyth()
51
+ const getTooltip = computed(() => {
52
+ if (props.tooltip !== undefined) {
53
+ return props.tooltip ? __(props.tooltip) : props.tooltip
54
+ } else if (props.show) {
55
+ return __('labels.show')
56
+ } else if (props.update) {
57
+ return __('labels.update')
58
+ } else if (props.destroy) {
59
+ return __('labels.destroy')
60
+ }
61
+ return props.tooltip
62
+ })
63
+ const getIcon = computed(() => {
64
+ if (props.show) {
65
+ return 'ion-ios-eye'
66
+ } else if (props.update) {
67
+ return 'ion-ios-create'
68
+ } else if (props.destroy) {
69
+ return 'ion-ios-trash'
70
+ }
71
+ return props.icon
72
+ })
73
+ const getColor = computed<string | undefined>(() => {
74
+ if (props.color !== undefined) {
75
+ return props.color
76
+ }
77
+ if (props.show) {
78
+ return mOptions.value?.dt?.contextmenu?.btnStyle?.showColor
79
+ } else if (props.update) {
80
+ return mOptions.value?.dt?.contextmenu?.btnStyle?.updateColor
81
+ } else if (props.destroy) {
82
+ return mOptions.value?.dt?.contextmenu?.btnStyle?.destroyColor
83
+ }
84
+ return props.color
85
+ })
86
+ // const getLabel = computed(() => {
87
+ // if (props.label) {
88
+ // return __(props.label)
89
+ // } else if (props.show) {
90
+ // return __('labels.show')
91
+ // } else if (props.update) {
92
+ // return __('labels.update')
93
+ // } else if (props.destroy) {
94
+ // return __('labels.destroy')
95
+ // }
96
+ // return props.label
97
+ // })
98
+
99
+ defineOptions({
100
+ name: 'MDtBtn',
101
+ inheritAttrs: !1
102
+ })
103
+ </script>
104
+
105
+ <template>
106
+ <q-item
107
+ v-if="listItem"
108
+ v-close-popup
109
+ clickable
110
+ v-bind="{...mOptions.dt?.MDtBtn?.item?.props,...$attrs}"
111
+ @click="emit('click',$event)"
112
+ >
113
+ <q-item-section
114
+ side
115
+ v-bind="mOptions.dt?.MDtBtn?.item?.avatarProps"
116
+ >
117
+ <q-icon
118
+ :color="getColor"
119
+ :name="getIcon"
120
+ v-bind="mOptions.dt?.MDtBtn?.item?.iconProps"
121
+ />
122
+ </q-item-section>
123
+ <q-item-section v-bind="mOptions.dt?.MDtBtn?.item?.labelSectionProps">
124
+ <q-item-label v-bind="mOptions.dt?.MDtBtn?.item?.itemLabelProps">
125
+ <slot>
126
+ {{ label ? __(label) : label }}
127
+ </slot>
128
+ </q-item-label>
129
+ </q-item-section>
130
+ </q-item>
131
+ <q-btn
132
+ v-else
133
+ v-bind="{
134
+ ...mOptions.dt?.MDtBtn?.btn?.props,
135
+ ...$attrs,
136
+ fabMini: fabMini !== undefined ? fabMini : ( mOptions.dt?.btn?.fabMini !== undefined ? mOptions.dt.btn.fabMini : label === undefined),
137
+ round: round !== undefined ? round : ( mOptions.dt?.btn?.round !== undefined ? mOptions.dt.btn.round : label === undefined),
138
+ dense: dense !== undefined ? dense : ( mOptions.dt?.btn?.dense !== undefined ? mOptions.dt.btn.dense : label === undefined),
139
+ label: label !== undefined ? __(label) : label,
140
+ icon: getIcon,
141
+ color: getColor
142
+ }"
143
+ @click="emit('click',$event)"
144
+ >
145
+ <q-tooltip
146
+ v-if="hasTooltip"
147
+ class="m--dt-btn-tooltip"
148
+ >
149
+ {{ getTooltip }}
150
+ </q-tooltip>
151
+ <slot />
152
+ </q-btn>
153
+ </template>
@@ -0,0 +1,54 @@
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 { MDatatableDialogsOptions, MDatatableProps } from '../../types'
15
+ import { computed, UnwrapRef } from 'vue'
16
+ import { useMyth } from '../../composable'
17
+
18
+ interface Props {
19
+ items: MDatatableProps['contextItems'],
20
+ item: UnwrapRef<MDatatableDialogsOptions['item']>,
21
+ index: UnwrapRef<MDatatableDialogsOptions['index']>,
22
+ displayMode?: 'icon' | 'item'
23
+ }
24
+
25
+ const props = withDefaults(defineProps<Props>(), {
26
+ items: () => ([]),
27
+ item: undefined,
28
+ index: undefined,
29
+ displayMode: () => 'icon'
30
+ })
31
+ const itemMode = computed(() => props.displayMode === 'item')
32
+ const { __ } = useMyth()
33
+ defineOptions({ name: 'MDtContextmenuItems', inheritAttrs: !1 })
34
+ </script>
35
+
36
+ <template>
37
+ <template v-if="item !== undefined && index !== undefined">
38
+ <template
39
+ v-for="(m,i) in items"
40
+ :key="`MDtContextmenuItems-i${i}`"
41
+ >
42
+ <MDtBtn
43
+ v-if="typeof m.showIf === 'function' ? m.showIf(item,index) : m.showIf"
44
+ :[m.name]="!0"
45
+ :label="itemMode && m.label === undefined ? __(m.tooltip || m.attr?.label || m.attr?.tooltip ||m.name) : (m.label !== undefined ? __(m.label || m.name) :
46
+ undefined)"
47
+ :list-item="itemMode"
48
+ :tooltip="m.tooltip !== undefined ? m.tooltip : (m.label === undefined ? m.name : undefined)"
49
+ v-bind="m.attr"
50
+ @click="m.click ? m.click(item,index) : undefined"
51
+ />
52
+ </template>
53
+ </template>
54
+ </template>
@@ -0,0 +1,6 @@
1
+ import MDatatable from './MDatatable.vue'
2
+ import MDtAvatar from './MDtAvatar.vue'
3
+ import MDtBtn from './MDtBtn.vue'
4
+ import MDtContextmenuItems from './MDtContextmenuItems.vue'
5
+
6
+ export { MDatatable, MDtAvatar, MDtBtn, MDtContextmenuItems }
@@ -6,7 +6,10 @@
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 { computed, nextTick, onBeforeUnmount, ref, useTemplateRef, watch } from 'vue'
11
14
 
12
15
  import MFile from './MFile.vue'
@@ -143,7 +146,7 @@ const onClick = (e?: Event) => {
143
146
  }
144
147
  loadingSrc.value = !0
145
148
  nextTick(() => {
146
- if (props.clearable && hasSrc.value && !props.required) {
149
+ if (hasSrc.value && !props.required) {
147
150
  onClearInput()
148
151
  handleReset()
149
152
  loadingSrc.value = !1
@@ -160,7 +163,7 @@ const onClick = (e?: Event) => {
160
163
  const onClearInput = () => {
161
164
  removeFile()
162
165
  handleRemoved(!0, !1)
163
- handleUrl(null, !1)
166
+ handleUrl(undefined, !1)
164
167
  }
165
168
  onBeforeUnmount(() => {
166
169
  revoke()
@@ -6,11 +6,14 @@
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
 
11
14
  import type { MAxiosProps as Props, MSelectModelEmit } from '../../types'
12
15
  import type { QSelectSlots } from 'quasar'
13
- import { computed, onMounted, ref, toValue, watch } from 'vue'
16
+ import { computed, onMounted, toValue, useTemplateRef, watch } from 'vue'
14
17
  import { useSetFieldValue } from 'vee-validate'
15
18
  import MSelect from './MSelect.vue'
16
19
  import { useMyth } from '../../composable'
@@ -61,7 +64,7 @@ const prepare = async (fromWatch = !1) => {
61
64
  return
62
65
  }
63
66
  const method = typeof props.service === 'string'
64
- ? (isGuest.value ? api.value[props.service].staticIndex : api.value[props.service].index)
67
+ ? (isGuest.value ? api.value[props.service]?.staticIndex : api.value[props.service]?.index)
65
68
  : props.service
66
69
  if (!method) {
67
70
  throw Error(`No service: ${props.service}`)
@@ -105,7 +108,7 @@ onMounted(() => {
105
108
  }
106
109
  })
107
110
  watch(props.params, () => prepare(!0), { deep: !0 })
108
- const input = ref<InstanceType<typeof MSelect> | null>(null)
111
+ const input = useTemplateRef<InstanceType<typeof MSelect>>('input')
109
112
  defineExpose<{ input: typeof input }>({ input })
110
113
  defineOptions({ name: 'MAxios', inheritAttrs: !1 })
111
114
  </script>
@@ -6,20 +6,44 @@
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 { useField } from 'vee-validate'
11
- import { computed, reactive, toValue, useTemplateRef } from 'vue'
14
+ import { reactive, toValue, useTemplateRef } from 'vue'
12
15
  import { useBindInput, useMyth } from '../../composable'
13
16
  import type { MCheckboxProps as Props } from '../../types'
14
17
  import { QCheckbox, QField } from 'quasar'
15
- import { myth } from '../../utils'
16
18
 
17
- const props = defineProps<Props>()
19
+ const props = withDefaults(defineProps<Props>(), {
20
+ name: '',
21
+ label: undefined,
22
+ toggleIndeterminate: undefined,
23
+ leftLabel: undefined,
24
+ keepColor: undefined,
25
+ dark: undefined,
26
+ dense: undefined,
27
+ disable: undefined,
28
+ viewMode: undefined,
29
+ auto: undefined,
30
+ col: undefined,
31
+ xs: undefined,
32
+ sm: undefined,
33
+ md: undefined,
34
+ lg: undefined,
35
+ xl: undefined,
36
+ required: undefined,
37
+ autocomplete: undefined,
38
+ mobile: undefined,
39
+ email: undefined,
40
+ float: undefined,
41
+ useChoice: undefined
42
+ })
18
43
  defineModel<Props['modelValue']>({ required: !1, default: undefined })
19
44
  const { __ } = useMyth()
20
45
  const helper = useBindInput<any>(() => props, 'checkbox')
21
46
  const { getLabel, attrs, inputRules } = helper
22
- const options = computed(() => myth.props.value)
23
47
  const inputScope = useField<Props['modelValue']>(() => props.name, inputRules, {
24
48
  syncVModel: !0,
25
49
  label: getLabel,
@@ -32,7 +56,7 @@ const { value, errorMessage, handleChange } = inputScope
32
56
  const listeners = {
33
57
  'update:modelValue': (v: Props['modelValue']) => handleChange(v, !!errorMessage.value)
34
58
  }
35
- const input = useTemplateRef<InstanceType<typeof QCheckbox> | null>('input')
59
+ const input = useTemplateRef<InstanceType<typeof QCheckbox>>('input')
36
60
  const scopes = reactive(inputScope)
37
61
  defineExpose<typeof scopes & { input: typeof input }>({ input, ...scopes })
38
62
  defineOptions({
@@ -71,12 +95,12 @@ defineOptions({
71
95
  />
72
96
  <MCol v-bind="colProps">
73
97
  <q-field
74
- :error="!!errorMessage"
75
- :error-message="errorMessage"
76
- :hint="__(hint)"
77
98
  v-bind="{
78
99
  ...$props,
79
100
  ...attrs,
101
+ error:!!errorMessage,
102
+ errorMessage,
103
+ hint:__(hint),
80
104
  borderless: !0,
81
105
  outlined: !1,
82
106
  stackLabel: !0
@@ -6,7 +6,10 @@
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 { MDateProps as Props, MInputSlots } from '../../types'
11
14
  import { useTemplateRef } from 'vue'
12
15
  import MPicker from './MPicker.vue'
@@ -6,7 +6,10 @@
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 { MInputProps as Props, MInputSlots } from '../../types'
11
14
  import { useTemplateRef } from 'vue'
12
15
  import MInput from './MInput.vue'
@@ -6,7 +6,10 @@
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
 
11
14
  import { useFieldError, useFieldValue } from 'vee-validate'
12
15
  import type { MFieldProps as Props } from '../../types'
@@ -6,12 +6,15 @@
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
 
11
14
  import { QField, QFile, QFileSlots } from 'quasar'
12
15
  import { useBindInput, useMyth } from '../../composable'
13
16
  import { useField } from 'vee-validate'
14
- import { defineProps, reactive, toValue, useTemplateRef } from 'vue'
17
+ import { reactive, toValue, useTemplateRef } from 'vue'
15
18
  import type { MFileProps as Props } from '../../types'
16
19
  import { myth } from '../../utils'
17
20
 
@@ -6,7 +6,10 @@
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 { InvalidSubmissionHandler, SubmissionContext, SubmissionHandler } from 'vee-validate'
11
14
  import { useForm } from 'vee-validate'
12
15
  import type { MFormProps as Props } from '../../types'
@@ -6,7 +6,10 @@
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
 
11
14
  import { useField } from 'vee-validate'
12
15
  import type { MHiddenInputProps as Props } from '../../types'
@@ -78,7 +78,7 @@ const listeners = {
78
78
  blur: (v: any) => handleBlur(v, !0),
79
79
  'update:modelValue': (v: Props['modelValue']) => handleChange(v, !!errorMessage.value)
80
80
  }
81
- const input = useTemplateRef<InstanceType<typeof QInput | typeof QField> | null>('input')
81
+ const input = useTemplateRef<InstanceType<typeof QInput> | InstanceType<typeof QField>>('input')
82
82
  const scopes = reactive(inputScope)
83
83
  defineExpose<typeof scopes & { input: typeof input }>({ input, ...scopes })
84
84
  defineOptions({
@@ -6,7 +6,10 @@
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
 
11
14
  import type { MInputLabelProps as Props } from '../../types'
12
15
  import { useMyth } from '../../composable'
@@ -6,7 +6,10 @@
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 { MInputProps as Props, MInputSlots } from '../../types'
11
14
  import { useTemplateRef } from 'vue'
12
15
  import MInput from './MInput.vue'