@mythpe/quasar-ui-qui 0.4.71 → 0.4.73

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.71",
3
+ "version": "0.4.73",
4
4
  "description": "MyTh Quasar UI Kit App Extension",
5
5
  "author": {
6
6
  "name": "MyTh Ahmed Faiz",
@@ -110,6 +110,7 @@ type Props = {
110
110
  wrapCells?: MDatatableProps['wrapCells'];
111
111
  tooSmall?: MDatatableProps['tooSmall'];
112
112
  color?: MDatatableProps['color'];
113
+ transformer?: MDatatableProps['transformer'];
113
114
  }
114
115
 
115
116
  const props = withDefaults(defineProps<Props>(), {
@@ -195,7 +196,8 @@ const props = withDefaults(defineProps<Props>(), {
195
196
  noExampleBtn: undefined,
196
197
  wrapCells: undefined,
197
198
  tooSmall: undefined,
198
- color: 'primary'
199
+ color: 'primary',
200
+ transformer: undefined
199
201
  })
200
202
 
201
203
  interface Emits {
@@ -229,7 +231,7 @@ const {
229
231
  const $q = useQuasar()
230
232
  const $router = useRouter()
231
233
  const { te } = useI18n({ useScope: 'global' })
232
- const useFormContext = useForm<any, any>({ initialValues: {} })
234
+ const useFormContext = useForm<any, any>()
233
235
  const { resetForm: resetDialogForm, handleSubmit } = useFormContext
234
236
 
235
237
  const {
@@ -348,10 +350,10 @@ const {
348
350
  }
349
351
  return !hasAction.value
350
352
  }) */
353
+
351
354
  watch(defaultItem, (v) => {
352
355
  resetDialogForm({ values: { ...v || {} } }, { force: !0 })
353
356
  }, { immediate: !1, deep: !0 })
354
- // watch(getRows, (v) => emit('update:rows', v), { deep: !0 })
355
357
  defineModel<any[]>('rows', { required: false, default: undefined })
356
358
  watch([
357
359
  () => toValue(props.visibleColumns),
@@ -401,9 +403,12 @@ const onSuccess: SubmissionHandler = async (form) => {
401
403
  requestWith: getRequestWith(isUpdateMode.value ? 'withUpdate' : 'withStore') || undefined
402
404
  }
403
405
  }
404
- const method = async () => isUpdateMode.value ? await apiServices.update(dialogItem.value?.id || '',
405
- form,
406
- _conf) : await apiServices.store(form, _conf)
406
+ if (props.transformer) {
407
+ form = props.transformer(form)
408
+ }
409
+ const method = async () => isUpdateMode.value
410
+ ? await apiServices.update(dialogItem.value?.id || '', form, _conf)
411
+ : await apiServices.store(form, _conf)
407
412
  try {
408
413
  const response: ApiInterface = await method()
409
414
  const { _message, _success, _data } = response
@@ -62,7 +62,7 @@ export const useDtHelpers = (options: MaybeRefOrGetter<MDatatableProps>, emit?:
62
62
  const getRows = computed<any>({
63
63
  get: () => {
64
64
  if (props.rows !== undefined && props.rows !== null) {
65
- return props.rows
65
+ return toValue(props.rows)
66
66
  }
67
67
  return rowsRef.value
68
68
  },
@@ -381,6 +381,10 @@ export type MDatatableProps<I extends GenericFormValues = GenericFormValues> = O
381
381
  * too small a screen size in px.
382
382
  */
383
383
  tooSmall?: number;
384
+ /**
385
+ * transformer for form data
386
+ */
387
+ transformer?: (formData: any) => any;
384
388
  }
385
389
 
386
390
  export interface MDtAvatarProps extends QAvatarProps {