jsonforms

JSON forms deletes ".0" in number field


I'm using JSON Forms in my project.

Problem For "number"-typed field I want to type in values like 1.05, but when I type "1." the field shows an error, and then, when I type "1.0", the ".0" part is deleted. Which setting can I use to make validation/autofix "on change", not "on input"? Or any other work around?

I've tried different options of ajv as well as removing ajv and @change hook completely but to no avail.

Forms:

<json-forms
    :schema="schema"
    :uischema="null"
    :data="localData"
    :renderers="renderers"
    :ajv="ajv"
    @change="(evt) => localData = evt.data"
/>

Schema:

{
   "type": "object",
   "default": {},
   "properties": {
      "nir": {
         "type": "number",
         "title": "NIR"
      },
      "rgb": {
        "type": "number",
        "title": "RGB"
      }
  }

AJV:

ajv: Ajv = createAjv(
    {
        useDefaults: true,
        multipleOfPrecision: 2,
    }
);

Solution

  • Turned out the problem was in the renderers I was using: @jsonforms/vue-vuetify". Had to copy there render and fix the error.