c12c470d13
* feat(fe2): prevent automation param validation until submit * minor fix * fix for empty string being accepted as a valid value
41 lines
1015 B
Vue
41 lines
1015 B
Vue
<template>
|
|
<FormTextInput
|
|
:name="fieldName"
|
|
:disabled="!control.enabled"
|
|
:model-value="control.data"
|
|
:rules="validator"
|
|
:label="control.label"
|
|
:placeholder="appliedOptions['placeholder']"
|
|
:help="control.description"
|
|
:show-required="isRequired"
|
|
color="foundation"
|
|
show-label
|
|
size="lg"
|
|
:validate-on-value-update="validateOnValueUpdate"
|
|
@update:model-value="handleChange"
|
|
/>
|
|
</template>
|
|
<script setup lang="ts">
|
|
import { type ControlElement } from '@jsonforms/core'
|
|
import { rendererProps, useJsonFormsControl } from '@jsonforms/vue'
|
|
import { useJsonRendererBaseSetup } from '~/lib/form/composables/jsonRenderers'
|
|
|
|
const props = defineProps({
|
|
...rendererProps<ControlElement>()
|
|
})
|
|
|
|
const {
|
|
handleChange,
|
|
control,
|
|
validator,
|
|
appliedOptions,
|
|
fieldName,
|
|
validateOnValueUpdate,
|
|
isRequired
|
|
} = useJsonRendererBaseSetup(useJsonFormsControl(props), {
|
|
onChangeValueConverter(val: string) {
|
|
return val?.length > 0 ? val : undefined
|
|
}
|
|
})
|
|
</script>
|