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