1d2a594f0a
* chore: upgrade TS 5.2 -> 5.7.3 * vite dts fix * lint fix * resolutions fix * ui comp build fix * precommit fix? * latest eslint version * autoloader fix * undo unnecessary viewer change * eslint fixes fe2 + trying disabled type linting * lint fixes
45 lines
1.1 KiB
Vue
45 lines
1.1 KiB
Vue
<template>
|
|
<FormTextInput
|
|
:name="fieldName"
|
|
:disabled="!control.enabled"
|
|
:model-value="control.data + ''"
|
|
:rules="validator"
|
|
:label="control.label"
|
|
color="foundation"
|
|
type="number"
|
|
step="any"
|
|
size="lg"
|
|
show-label
|
|
:show-required="isRequired"
|
|
:placeholder="appliedOptions['placeholder']"
|
|
:help="control.description"
|
|
: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) => {
|
|
// Convert to number, if possible
|
|
const num = parseFloat(val)
|
|
return isNaN(num) ? undefined : num
|
|
}
|
|
})
|
|
</script>
|