Files
speckle-server/packages/frontend-2/components/form/json/NumberControlRenderer.vue
T
Chuck Driesler 3be53f6db5 WEB-1052 Create test automations (#2302)
* fighting migrations

* test automation type

* fix type in tests and add test

* split `storeAutomation` and `storeAutomationToken`

* add `createTestAutomation`

* fix test usage of `storeAutomation`

* do not trigger functions if automation is a test automation

* whoops

* create test automations, almost

* encryption keys on autoamation revisions are NOT optional

* function selection in create test automation step

* update tests, lint

* Align input stylings

Also update the general select input component so the placeholder text aligns with other inputs

* Explain test automation and tweak copy

* Update form components on parameters step

To align with the form component updates I made in previous commits in this branch

* create dialog enhancements

* test automation badges

---------

Co-authored-by: Benjamin Ottensten <benjamin.ottensten@gmail.com>
2024-05-31 16:33:15 +02:00

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>