@mythpe/quasar-ui-qui 0.1.5 → 0.1.8

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mythpe/quasar-ui-qui",
3
- "version": "0.1.5",
3
+ "version": "0.1.8",
4
4
  "description": "MyTh Quasar UI Kit App Extension",
5
5
  "author": {
6
6
  "name": "MyTh Ahmed Faiz",
@@ -42,12 +42,14 @@ interface P {
42
42
  captionProps?: Props['captionProps'];
43
43
  hint?: Props['hint'];
44
44
  hintProps?: Props['hintProps'];
45
- formErrors?: Props['formErrors'];
46
45
  help?: Props['help'];
47
46
  readonly?: Props['readonly'];
48
47
  loading?: Props['loading'];
49
48
  required?: Props['required'];
50
49
  rules?: Props['rules'];
50
+ contentClass?: Props['contentClass'];
51
+ emptyColor?: Props['emptyColor'];
52
+ btnLabel?: Props['btnLabel'];
51
53
  }
52
54
 
53
55
  const props = withDefaults(defineProps<P>(), {
@@ -66,7 +68,7 @@ const props = withDefaults(defineProps<P>(), {
66
68
  excel: !1,
67
69
  size: '100px',
68
70
  avatarText: undefined,
69
- fit: 'contain',
71
+ fit: undefined,
70
72
  clearable: undefined,
71
73
  label: undefined,
72
74
  rounded: undefined,
@@ -75,20 +77,22 @@ const props = withDefaults(defineProps<P>(), {
75
77
  hintProps: undefined,
76
78
  caption: undefined,
77
79
  captionProps: undefined,
78
- formErrors: () => ({}),
79
80
  help: undefined,
80
81
  readonly: !1,
81
82
  loading: !1,
82
83
  required: undefined,
83
- rules: () => ({})
84
+ rules: () => ({}),
85
+ contentClass: undefined,
86
+ emptyColor: 'grey-2',
87
+ btnLabel: 'choose_file'
84
88
  })
85
89
  type Emits = {
86
90
  (e: 'click', evt?: Event): void;
87
91
  }
88
92
  const emit = defineEmits<Emits>()
89
93
  const { __ } = useMyth()
90
- const { accepts } = useBindInput<any>(() => props, 'avatarViewer')
91
- const modelValueScope = useField<Props['modelValue']>(() => props.name, undefined, {
94
+ const { accepts, inputRules } = useBindInput<any>(() => props, 'avatarViewer')
95
+ const modelValueScope = useField<Props['modelValue']>(() => props.name, inputRules, {
92
96
  syncVModel: !0
93
97
  })
94
98
  const { value: modelValue, handleReset } = modelValueScope
@@ -196,7 +200,8 @@ defineOptions({
196
200
  :sm="sm"
197
201
  :xs="xs"
198
202
  >
199
- <MColumn class="items-center">
203
+ <MColumn :class="contentClass">
204
+ <slot name="top" />
200
205
  <MTransition>
201
206
  <div
202
207
  v-if="!!label"
@@ -237,7 +242,7 @@ defineOptions({
237
242
  </slot>
238
243
  <div
239
244
  key="avatar"
240
- :class="`rounded-borders q-mb-sm ${!!errorMessage ? 'q-pa-xs bg-negative' : ''}`"
245
+ :class="`rounded-borders q-mb-sm ${!!errorMessage ? 'q-pa-xs' : ''}`"
241
246
  >
242
247
  <q-skeleton
243
248
  v-if="loading"
@@ -246,16 +251,15 @@ defineOptions({
246
251
  />
247
252
  <q-avatar
248
253
  v-else
249
- :color="!!errorMessage ? 'negative' : ((!isLoaded || !hasSrc || isFile) ? 'primary' : undefined)"
254
+ :color="!!errorMessage ? 'negative' : ((!isLoaded || !hasSrc || isFile) ? emptyColor : undefined)"
250
255
  :icon="isFile ? 'o_description' : undefined"
251
- :rounded="rounded === undefined ? hasSrc : rounded"
256
+ :rounded="rounded"
252
257
  :size="size"
253
258
  text-color="white"
254
259
  >
255
260
  <q-img
256
261
  v-if="hasSrc && !isFile"
257
262
  :fit="fit"
258
- :height="size"
259
263
  :src="blobUrl || url"
260
264
  ratio="1"
261
265
  @error="isLoaded = !0"
@@ -277,7 +281,7 @@ defineOptions({
277
281
  <div
278
282
  v-if="!readonly"
279
283
  key="btn"
280
- class="q-mb-sm"
284
+ class="q-mt-lg"
281
285
  >
282
286
  <q-skeleton
283
287
  v-if="loading"
@@ -285,11 +289,11 @@ defineOptions({
285
289
  />
286
290
  <MBtn
287
291
  v-else
288
- :color="!hasSrc ? 'positive' : 'secondary'"
289
292
  :disable="!isLoaded && !!url"
290
- :icon="hasSrc ? 'ion-ios-close' : 'ion-ios-attach'"
291
- :label="__( 'labels.' + ( clearable && hasSrc ? 'remove' : ( !clearable && hasSrc ? 'change' : 'choose') ) )"
292
293
  :loading="loadingSrc"
294
+ icon="ion-ios-images"
295
+ :label="'labels.' + ( clearable ? ( hasSrc ? 'remove' : btnLabel ) : ( required ? ( hasSrc ? 'change' : btnLabel ) : btnLabel ) )"
296
+ outline
293
297
  @click="onClick"
294
298
  />
295
299
  </div>
@@ -111,7 +111,7 @@ const emit = defineEmits<Emits>()
111
111
 
112
112
  const { __, props: pluginOptions } = useMyth()
113
113
  const helper = useBindInput<P & Props>(() => props, 'select', () => ({ choose: !0 }))
114
- const { theme, hasTopLabel, getLabel, getPlaceholder, getAutocompleteAttribute, inputRules, getProp } = helper
114
+ const { theme, hasTopLabel, getLabel, getAutocompleteAttribute, inputRules, getProp } = helper
115
115
  const inputScope = useField<Props['modelValue']>(() => props.name, inputRules, {
116
116
  syncVModel: !0,
117
117
  label: getLabel,
@@ -239,8 +239,8 @@ defineOptions({
239
239
  autocomplete: getAutocompleteAttribute || undefined,
240
240
  clearable: viewMode ? !1 : clearable,
241
241
  hint: hint ? __(hint) : undefined,
242
- label: viewMode && hasTopLabel ? undefined : (loading ? undefined : getPlaceholder),
243
- modelValue: value,
242
+ label: viewMode && hasTopLabel ? undefined : (getLabel || undefined),
243
+ modelValue: value
244
244
  }"
245
245
  v-on="listeners"
246
246
  >
@@ -64,7 +64,7 @@ export const useBindInput = <P extends G = G> (Props: MaybeRefOrGetter<P>, key:
64
64
  })
65
65
  const getLabel = computed<string | undefined>(() => {
66
66
  const k = nameLabel.value
67
- if (k && k.indexOf('.*.')) {
67
+ if (k && k.indexOf('.*.') !== -1) {
68
68
  return __(k.split('.').pop()) || undefined
69
69
  }
70
70
  return k ? (__(k) || undefined) : undefined
@@ -1,4 +1,4 @@
1
- import type { QAvatarProps, QAvatarSlots, QImgProps } from 'quasar'
1
+ import type { NamedColor, QAvatarProps, QAvatarSlots, QImgProps } from 'quasar'
2
2
  import type { VNode } from 'vue'
3
3
  import type { InputErrorsContext, InputFormErrorsContext, InputRulesContext, MColProps } from '../components'
4
4
 
@@ -46,14 +46,6 @@ export interface MAvatarViewerProps extends QAvatarProps, MColProps {
46
46
  * The label that will appear above the image
47
47
  */
48
48
  label?: string;
49
- /**
50
- * List of error messages.
51
- */
52
- errors?: InputErrorsContext;
53
- /**
54
- * List of form errors.
55
- */
56
- formErrors?: InputFormErrorsContext;
57
49
  /**
58
50
  * Model of the component;
59
51
  * Must be FileList or Array if using 'multiple' prop;
@@ -103,6 +95,9 @@ export interface MAvatarViewerProps extends QAvatarProps, MColProps {
103
95
  * Input Validation Rules.
104
96
  */
105
97
  rules?: InputRulesContext;
98
+ contentClass?: string | string[] | Record<string, any>;
99
+ emptyColor?: NamedColor;
100
+ btnLabel?: string;
106
101
  }
107
102
 
108
103
  export interface MAvatarViewerSlots extends QAvatarSlots {