@mythpe/quasar-ui-qui 0.4.24 → 0.4.25

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.4.24",
3
+ "version": "0.4.25",
4
4
  "description": "MyTh Quasar UI Kit App Extension",
5
5
  "author": {
6
6
  "name": "MyTh Ahmed Faiz",
@@ -212,7 +212,7 @@ const {
212
212
  const $q = useQuasar()
213
213
  const $router = useRouter()
214
214
  const { te } = useI18n({ useScope: 'global' })
215
- const useFormContext = useForm<any, any>()
215
+ const useFormContext = useForm<any, any>({ initialValues: {} })
216
216
  const { resetForm: resetDialogForm, handleSubmit } = useFormContext
217
217
 
218
218
  const {
@@ -329,7 +329,7 @@ const {
329
329
 
330
330
  watch(defaultItem, (v) => {
331
331
  resetDialogForm({ values: { ...v || {} } }, { force: !0 })
332
- }, { immediate: !0, deep: !0 })
332
+ }, { immediate: !1, deep: !0 })
333
333
 
334
334
  watch(() => getRows.value, (v) => emit('update:rows', v), { deep: !0 })
335
335
  watch([
@@ -463,10 +463,6 @@ const onLockSearch = () => {
463
463
  searchColumnsRef.value = !lockSearch.value ? [lockValueProp.value] : tempSearch.value
464
464
  // lockSearch.value = !lockSearch.value
465
465
  }
466
- onMounted(() => {
467
- wrapCellsRef.value = getProp.value('wrapCells') ?? !1
468
- refresh()
469
- })
470
466
  watch(loading, v => {
471
467
  if (pluginOptions.value?.dt?.useQuasarLoading) {
472
468
  if (v) {
@@ -519,7 +515,16 @@ const showIfContext = (contextBtn: GenericMDtBtn): boolean => {
519
515
  }
520
516
  return !1
521
517
  }
522
- const tooSmall = computed(() => props.tooSmall === 0 ? false : ($q.screen.height < (props.tooSmall || 600)))
518
+ const tooSmallComputed = computed(() => props.tooSmall === 0 ? false : ($q.screen.height < (props.tooSmall || 600)))
519
+
520
+ onMounted(() => {
521
+ wrapCellsRef.value = getProp.value('wrapCells') ?? !1
522
+ refresh()
523
+ // setTimeout(() => {
524
+ // filterForm.value = {}
525
+ // console.log('filterForm.value', filterForm.value)
526
+ // }, 600)
527
+ })
523
528
  defineOptions({
524
529
  name: 'MDatatable',
525
530
  inheritAttrs: !1
@@ -572,7 +577,7 @@ defineExpose({
572
577
  'm-datatable-component',
573
578
  {
574
579
  'm-datatable-component__fixed': fixed === undefined ? ( pluginOptions?.datatable?.fixed === undefined ? undefined : pluginOptions.datatable?.fixed) : fixed,
575
- 'm-datatable-component__too_small': tooSmall,
580
+ 'm-datatable-component__too_small': tooSmallComputed,
576
581
  'm-datatable-component__fab': hasAddBtn && (addFabBtn === undefined ? !!pluginOptions.datatable?.addFabBtn : addFabBtn),
577
582
  }]"
578
583
  >
@@ -1093,10 +1098,9 @@ defineExpose({
1093
1098
  @before-show="beforeCloseFilterDialog"
1094
1099
  >
1095
1100
  <q-card
1101
+ :style="`max-width: 600px; width: ${$q.screen.width}px`"
1096
1102
  flat
1097
- fstyle="$q.screen.gt.sm?`width: ${Math.ceil($q.screen.width/2)}px` : undefined"
1098
1103
  square
1099
- style="max-width: 700px"
1100
1104
  >
1101
1105
  <MContainer class="q-pa-lg">
1102
1106
  <q-toolbar :class="{'q-pa-none': isSmall}">
@@ -1118,10 +1122,7 @@ defineExpose({
1118
1122
  />
1119
1123
  </MContainer>
1120
1124
  </MCol>
1121
- <MCol
1122
- class="q-pt-lg"
1123
- col="12"
1124
- >
1125
+ <MCol col="12">
1125
1126
  <MRow class="justify-between">
1126
1127
  <MBtn
1127
1128
  v-close-popup
@@ -1244,7 +1245,7 @@ defineExpose({
1244
1245
  >
1245
1246
  <q-card style="min-width: 250px; max-width: 900px">
1246
1247
  <q-card-section>
1247
- <div class="text-body1 q-mb-md">
1248
+ <div class="text-body1 q-mb-xs">
1248
1249
  {{ __('myth.datatable.columnsToShow') }}
1249
1250
  </div>
1250
1251
  <div class="text-body2">
@@ -1252,19 +1253,23 @@ defineExpose({
1252
1253
  {{ __('myth.datatable.columnsToShowCaption') }}
1253
1254
  </div>
1254
1255
  </q-card-section>
1256
+ <q-separator />
1255
1257
  <q-card-section>
1256
- <template
1257
- v-for="h in getHeaders"
1258
- :key="h.name"
1259
- >
1260
- <q-checkbox
1261
- v-model="visibleHeaders"
1262
- :disable="visibleHeaders.length < 2 && visibleHeaders.indexOf(h.name) !== -1"
1263
- :label="h.label"
1264
- :val="h.name"
1265
- />
1266
- </template>
1258
+ <div class="row justify-between">
1259
+ <template
1260
+ v-for="h in getHeaders"
1261
+ :key="h.name"
1262
+ >
1263
+ <q-checkbox
1264
+ v-model="visibleHeaders"
1265
+ :disable="visibleHeaders.length < 2 && visibleHeaders.indexOf(h.name) !== -1"
1266
+ :label="h.label"
1267
+ :val="h.name"
1268
+ />
1269
+ </template>
1270
+ </div>
1267
1271
  </q-card-section>
1272
+ <q-separator />
1268
1273
  <q-card-section>
1269
1274
  <MBtn
1270
1275
  v-if="$q.screen.gt.xs"
@@ -12,7 +12,7 @@
12
12
  >
13
13
 
14
14
  import type { MAxiosProps as Props, MSelectModelEmit, MSelectSlots } from '../../types'
15
- import { computed, onMounted, toValue, useTemplateRef, watch } from 'vue'
15
+ import { computed, onMounted, ref, toValue, useTemplateRef, watch } from 'vue'
16
16
  import { useFieldValue, useSetFieldValue } from 'vee-validate'
17
17
  import MSelect from './MSelect.vue'
18
18
  import { useMyth } from '../../composable'
@@ -37,16 +37,16 @@ type P = {
37
37
  }
38
38
 
39
39
  const props = withDefaults(defineProps<P>(), {
40
- name: () => '',
40
+ name: '',
41
41
  label: undefined,
42
42
  placeholder: undefined,
43
- viewMode: () => !1,
43
+ viewMode: !1,
44
44
  viewModeValue: undefined,
45
45
  service: undefined,
46
46
  guest: undefined,
47
47
  requestWith: undefined,
48
48
  params: () => () => ({}),
49
- lazy: () => !1,
49
+ lazy: !1,
50
50
  useChoice: undefined,
51
51
  byId: undefined,
52
52
  searchLength: undefined,
@@ -69,6 +69,9 @@ const isGuest = computed(() => {
69
69
  return v !== undefined && v !== null && v !== !1
70
70
  })
71
71
  const getSearchLength = computed(() => {
72
+ if (props.lazy) {
73
+ return -1
74
+ }
72
75
  if (props.searchLength === undefined || props.searchLength === null) {
73
76
  return 3
74
77
  }
@@ -129,8 +132,18 @@ const prepare = async (fromWatch = !1, merge = {}) => {
129
132
  }
130
133
  })
131
134
  }
135
+ const isFocus = ref(!1)
132
136
  const listeners = {
137
+ focus () {
138
+ isFocus.value = !0
139
+ },
140
+ blur () {
141
+ isFocus.value = !1
142
+ },
133
143
  'update:search': (val: any) => {
144
+ if (!val && isFocus.value) {
145
+ return
146
+ }
134
147
  if (!val && fieldValue.value) {
135
148
  return
136
149
  }
@@ -13,7 +13,7 @@
13
13
 
14
14
  import { useField } from 'vee-validate'
15
15
  import type { MSelectProps as Props } from '../../types'
16
- import { computed, reactive, toValue, useTemplateRef } from 'vue'
16
+ import { computed, reactive, ref, toValue, useTemplateRef } from 'vue'
17
17
  import { useBindInput, useMyth } from '../../composable'
18
18
  import { QField, QSelect, type QSelectSlots, useQuasar } from 'quasar'
19
19
 
@@ -161,8 +161,15 @@ const onDoneOptions = () => {
161
161
  e?.updateInputValue('', !0)
162
162
  e?.hidePopup()
163
163
  }
164
+ const isFocus = ref(!1)
164
165
  const listeners = {
165
- blur: (v: any) => handleBlur(v, !0),
166
+ focus () {
167
+ isFocus.value = !0
168
+ },
169
+ blur (v: any) {
170
+ isFocus.value = !1
171
+ handleBlur(v, !0)
172
+ },
166
173
  'update:modelValue': (v: Props['modelValue']) => {
167
174
  handleChange(v, !!errorMessage.value)
168
175
  if (!props.emitValue) {
@@ -269,7 +276,7 @@ defineOptions({
269
276
  useChips: getProp('useChips') === !0 && !multiple ? !1 : getProp('useChips'),
270
277
  multiple,
271
278
  mapOptions,
272
- loading: viewMode ? !1 : loading,
279
+ loading: viewMode || isFocus ? !1 : loading,
273
280
  useInput,
274
281
  autocomplete: getAutocompleteAttribute || undefined,
275
282
  clearable: viewMode ? !1 : clearable,
@@ -348,7 +355,10 @@ defineOptions({
348
355
  v-if="loading && !noLoading"
349
356
  #selected
350
357
  >
351
- <q-skeleton width="60%" />
358
+ <q-skeleton
359
+ v-if="!isFocus"
360
+ width="60%"
361
+ />
352
362
  </template>
353
363
  <template
354
364
  v-if="multiple"
@@ -57,7 +57,7 @@ export const useDtHelpers = (options: MaybeRefOrGetter<MDatatableProps>) => {
57
57
  } = useMyth()
58
58
  const props = toValue(options)
59
59
  const getRows = ref<MDtItem[]>([])
60
- const defaultItem = computed(() => props.defaultItem)
60
+ const defaultItem = computed(() => toValue(props.defaultItem))
61
61
  const getTableTitle = computed(() => {
62
62
  if (props.title) {
63
63
  if (te(props.title)) {