mirror of
https://github.com/abhinavxd/libredesk.git
synced 2026-09-23 02:53:32 +00:00
5b6a58fba0
- new vue app for serving live chat widget, created subdirectories inside frontend dir `main` and `widget` - vite changes for both main app and widget app. - new backend live chat channel - apis for live chat widget
48 lines
1.4 KiB
Vue
48 lines
1.4 KiB
Vue
<script setup>
|
|
import { computed } from 'vue'
|
|
import AutoFormLabel from './AutoFormLabel.vue'
|
|
import { beautifyObjectName } from './utils'
|
|
import {
|
|
FormControl,
|
|
FormDescription,
|
|
FormField,
|
|
FormItem,
|
|
FormMessage
|
|
} from '../form'
|
|
import { Input } from '../input'
|
|
import { Textarea } from '../textarea'
|
|
|
|
const props = defineProps({
|
|
fieldName: { type: String, required: true },
|
|
label: { type: String, required: false },
|
|
required: { type: Boolean, required: false },
|
|
config: { type: Object, required: false },
|
|
disabled: { type: Boolean, required: false }
|
|
})
|
|
const inputComponent = computed(() => (props.config?.component === 'textarea' ? Textarea : Input))
|
|
</script>
|
|
|
|
<template>
|
|
<FormField v-slot="slotProps" :name="fieldName">
|
|
<FormItem v-bind="$attrs">
|
|
<AutoFormLabel v-if="!config?.hideLabel" :required="required">
|
|
{{ config?.label || beautifyObjectName(label ?? fieldName) }}
|
|
</AutoFormLabel>
|
|
<FormControl>
|
|
<slot v-bind="slotProps">
|
|
<component
|
|
:is="inputComponent"
|
|
type="text"
|
|
v-bind="{ ...slotProps.componentField, ...config?.inputProps }"
|
|
:disabled="disabled"
|
|
/>
|
|
</slot>
|
|
</FormControl>
|
|
<FormDescription v-if="config?.description">
|
|
{{ config.description }}
|
|
</FormDescription>
|
|
<FormMessage />
|
|
</FormItem>
|
|
</FormField>
|
|
</template>
|