Add forms demo page

This commit is contained in:
Mert Sincan 2024-10-23 05:05:27 +01:00
parent 9f8003ad9d
commit 4929f978f2
24 changed files with 3002 additions and 22 deletions

View file

@ -0,0 +1,43 @@
<template>
<component :is="component" :id :name class="w-full" />
</template>
<script>
import * as PrimeVue from 'primevue/primevue';
export default {
name: 'DynamicFormControl',
props: {
as: {
type: String,
default: 'InputText'
},
schema: null,
defaultValue: {
default: ''
}
},
inject: {
$fcDynamicForm: {
default: undefined
},
$fcDynamicFormField: {
default: undefined
}
},
created() {
this.$fcDynamicForm?.addField(this.name, this.schema, this.defaultValue);
},
computed: {
id() {
return this.$fcDynamicFormField?.$props.groupId;
},
name() {
return this.$fcDynamicFormField?.$props.name;
},
component() {
return PrimeVue[this.as] ?? this.as;
}
}
};
</script>