mirror of
https://github.com/Donkie/Spoolman.git
synced 2026-10-22 01:52:17 -05:00
Most of the world writes 1,75 rather than 1.75, and `<input type="number">` only accepts the separator the browser locale dictates: everything else it reports as an empty value. A user typing a comma therefore watched a weight or a diameter silently come out blank or, once the separator was dropped, a hundred times too large. The same input type also accepts "e", "+" and "-" anywhere in the text, since they are legal exponent syntax, and then reports the whole value as empty too, so "1e" read back as nothing at all. Numeric fields are now text inputs with `inputmode="decimal"`, guarded by a shared `numericInput` action that filters at the keystroke: both separators go in, letters cannot, and a pasted "12,5 g" is cleaned rather than refused. Reading is centralised in `parseDecimal`, which takes either separator and returns null instead of NaN for text that is not a number, so an unset field stays distinguishable from a real 0. What the parent, and the API, receive is always canonical. The typed separator stays on screen: each field keeps a draft of the text and gives it up only when the value moves somewhere that text no longer means, so storing 1.5 does not rewrite a typed "1,5" between keystrokes. Arrow-key stepping, which was native to the old input type, is now the component's own. Covers the spool/filament/vendor inspectors, the add-spool modal (whose price box was a bare text input accepting anything at all), extra fields of every numeric type, the extra-field editor's order box and the low-stock threshold.