Skip to content

Commit

Permalink
chore(*): better types
Browse files Browse the repository at this point in the history
  • Loading branch information
Leopoldthecoder committed Apr 30, 2024
1 parent 179b12c commit a07f3c3
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
8 changes: 4 additions & 4 deletions packages/core/forms/src/composables/useAbstractFields.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { computed, ref, reactive } from 'vue'
import { computed, ref, reactive, type Ref } from 'vue'
import type { DebouncedFunc } from 'lodash-es'
import debounce from 'lodash-es/debounce'
import forEach from 'lodash-es/forEach'
Expand All @@ -11,9 +11,9 @@ import validators from '../generator/utils/validators'
import { slugifyFormID } from '../generator/utils/schema'

export default function useAbstractFields(params: {
model?: Record<string, any>,
schema: Record<string, any>,
formOptions?: Record<string, any>,
model?: Ref<Record<string, any>>,
schema: Ref<Record<string, any>>,
formOptions?: Ref<Record<string, any>>,
disabled?: boolean,
emitModelUpdated?: (data: {
value: any
Expand Down
4 changes: 2 additions & 2 deletions packages/core/forms/src/generator/fields/core/FieldInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ const props = defineProps({
},
formOptions: {
type: Object as PropType<Record<string, any>>,
default: () => undefined,
default: () => ({}),
},
model: {
type: Object as PropType<Record<string, any>>,
default: () => undefined,
default: () => ({}),
},
schema: {
type: Object as PropType<Record<string, any>>,
Expand Down
14 changes: 8 additions & 6 deletions packages/core/forms/src/generator/fields/core/FieldLabel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</template>

<script lang="ts" setup>
import type { PropType } from 'vue'
import { toRefs, type PropType } from 'vue'
import composables from '../../../composables'
const props = defineProps({
Expand All @@ -18,11 +18,11 @@ const props = defineProps({
},
formOptions: {
type: Object as PropType<Record<string, any>>,
default: () => undefined,
default: () => ({}),
},
model: {
type: Object as PropType<Record<string, any>>,
default: () => undefined,
default: () => ({}),
},
schema: {
type: Object as PropType<Record<string, any>>,
Expand All @@ -34,10 +34,12 @@ const props = defineProps({
},
})
const propsRefs = toRefs(props)
const { getFieldID, value: labelValue } = composables.useAbstractFields({
model: props.model,
schema: props.schema,
formOptions: props.formOptions,
model: propsRefs.model,
schema: propsRefs.schema,
formOptions: propsRefs.formOptions,
})
</script>

Expand Down

0 comments on commit a07f3c3

Please sign in to comment.