Giter VIP home page Giter VIP logo

Comments (6)

aeberhart avatar aeberhart commented on September 25, 2024

Thanks for catching this. The issue seems to be that we set the input type to number but do not specify a step property (which seems to default to 1).

https://www.w3schools.com/tags/att_input_type_number.asp
https://stackoverflow.com/questions/48892570/please-enter-a-valid-value-the-two-nearest-valid-value-is

We can fix this by introducing a method getInputStep, similar to getInputType or alternatively by setting step to any by default. This would probably make the up/down arrows disappear.

from json-schema-form.

ldamet avatar ldamet commented on September 25, 2024

Thanks for the quick response.

I did a test using the any step and it fixes the tooltip issue. I still have the up/down arrow (they increment/decrement by 1).

Maybe offering the possibility to configure the step if people want to benefit from validation and precise increment/decrement could be a nice feature.

from json-schema-form.

aeberhart avatar aeberhart commented on September 25, 2024

Excellent. Feel free to create a PR for this.
As for being able to configure this, it could look like this:

{
  "type": "number",
  "step": 0.1
}

I personally feel like a default of 1 is sufficient. Imagine you're entering a number 12.5 in 0.1 increments. That's a lot of clicks...

from json-schema-form.

ldamet avatar ldamet commented on September 25, 2024

I created a PR for the support of step. This is my first PR ever so please let me know If I need to change things or anything.
I didn't really find anywhere to document the step attribute.

from json-schema-form.

aeberhart avatar aeberhart commented on September 25, 2024

Thanks so much for your PR and welcome to the team! I made a small change to reuse the multipleOf (https://json-schema.org/understanding-json-schema/reference/numeric.html#multiples) instead of introducing "step". Reading the reference you provided (https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#step) it seems to me that this is the natural thing to do. This way, the example (https://dashjoin.github.io/#/example/multipleOf) also correctly increments by 11 and the form stays valid going from 88 to 99 etc.

from json-schema-form.

ldamet avatar ldamet commented on September 25, 2024

Great thank you! I didn't see the "multipleOf" applied to numbers, perfect use case.

Also thanks for this library :)

from json-schema-form.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.