@mythpe/quasar-ui-qui 0.3.1 → 0.3.2

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.3.1",
3
+ "version": "0.3.2",
4
4
  "description": "MyTh Quasar UI Kit App Extension",
5
5
  "author": {
6
6
  "name": "MyTh Ahmed Faiz",
@@ -13,7 +13,7 @@
13
13
  import type { MInputProps as Props, MInputSlots } from '../../types'
14
14
  import { reactive, toValue, useTemplateRef } from 'vue'
15
15
  import { useField } from 'vee-validate'
16
- import { useBindInput } from '../../composable'
16
+ import { useBindInput, useMyth } from '../../composable'
17
17
  import type { QField, QInput } from 'quasar'
18
18
 
19
19
  type P = {
@@ -48,7 +48,7 @@ const inputScope = useField<Props['modelValue']>(() => props.name, inputRules, {
48
48
  ...toValue<any>(props.fieldOptions)
49
49
  })
50
50
  const { value, errorMessage, handleChange, handleBlur } = inputScope
51
-
51
+ const { colorStyle } = useMyth()
52
52
  const listeners = {
53
53
  blur: (v: any) => handleBlur(v, !0),
54
54
  'update:modelValue': (v: Props['modelValue']) => handleChange(v, !!errorMessage.value)
@@ -82,13 +82,13 @@ defineOptions({
82
82
  >
83
83
  <template #prepend>
84
84
  <div
85
- :style="`width: 20px; height: 20px; background-color: ${value};`"
85
+ :style="`width: 20px; height: 20px; ${colorStyle(value,!0)}`"
86
86
  class="m-input__color-preview"
87
87
  />
88
88
  </template>
89
89
  <template
90
- #append
91
90
  v-if="!viewMode && !readonly && !disable"
91
+ #append
92
92
  >
93
93
  <q-icon
94
94
  class="cursor-pointer"
@@ -99,7 +99,10 @@ defineOptions({
99
99
  transition-hide="scale"
100
100
  transition-show="scale"
101
101
  >
102
- <q-color v-model="value" />
102
+ <q-color
103
+ v-model="value"
104
+ :name="name"
105
+ />
103
106
  </q-popup-proxy>
104
107
  </q-icon>
105
108
  </template>
@@ -0,0 +1,6 @@
1
+ export const useColor = () => {
2
+ const toColors = (color: any) => {
3
+
4
+ }
5
+ return { toColors }
6
+ }
@@ -10,7 +10,7 @@ import { useI18n } from 'vue-i18n'
10
10
  import type { RouteLocationNormalizedLoaded } from 'vue-router'
11
11
  import { useRoute } from 'vue-router'
12
12
  import type { QDialogOptions, QDialogProps, QNotifyCreateOptions } from 'quasar'
13
- import { copyToClipboard, extend, useQuasar } from 'quasar'
13
+ import { colors, copyToClipboard, extend, useQuasar } from 'quasar'
14
14
  import { Helpers, MythKey, type MythType, Str, veeRules } from '../utils'
15
15
  import type { MDtColumn, MDtHeadersParameter, ParseHeaderOptions, Vue3MAlertMessage, Vue3MAlertMessageOptions, Vue3MConfirmMessage } from '../types'
16
16
  import { computed, inject } from 'vue'
@@ -277,6 +277,20 @@ export const useMyth = () => {
277
277
  })
278
278
  }
279
279
  const isSmall = computed(() => q.screen.lt.md)
280
+ const colorStyle = (value: any, bg: boolean = false) => {
281
+ if (!value) {
282
+ return ''
283
+ }
284
+ if (!value.startsWith('#')) {
285
+ value = colors.getPaletteColor(value)
286
+ }
287
+ const attr = bg ? 'background-color: ' : 'color: '
288
+ if (value === 'transparent') {
289
+ return `${attr} transparent;`
290
+ }
291
+ return `${attr} ${value};`
292
+ }
293
+
280
294
  return {
281
295
  __,
282
296
  getPageTitle,
@@ -291,6 +305,7 @@ export const useMyth = () => {
291
305
  ...Str,
292
306
  veeRules,
293
307
  isSmall,
308
+ colorStyle,
294
309
  ...plugin
295
310
  }
296
311
  }