GEOLYTIX / xyz

An open source javascript framework for spatial data and application interfaces.
MIT License
87 stars 25 forks source link

UI elements input formatter #1322

Closed cityremade closed 3 months ago

cityremade commented 3 months ago

This pr is work in progress which builds on https://github.com/GEOLYTIX/xyz/pull/1310 and must not be merged before.

Numeric input element now includes formatting for prettiefied numbers; .numericFormatter() now moved from mapp.ui.elements to mapp.utils; Review + refactor for mapp.utils.numericFormatter; Removing dependency on entry; Simplifying defaults; Numeric entries will now get "formatter": "toLocaleString" by default. In order to disable it set "formatter": false;

sonarcloud[bot] commented 3 months ago

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

simon-leech commented 3 months ago

@cityremade A few issues here -

  1. On initial load of a filter the greater than and less than boxes on the sliders are empty. image

  2. When I drag the sliders to move them - the numbers aren't formatted in localeString. image

  3. When I then clear the filter and open it up again - the greater than and less than values are both the same but they are formatted? image

simon-leech commented 3 months ago

@cityremade Just did another quick test - the numbers are now showing in the slider on initial load 😄 However ,they aren't formatted. The formatting is only applied when you close the filter and re-open it

cityremade commented 3 months ago

Here are some examples I've been testing with:


                    "title": "numeric field",
                    "field": "numeric_field",
                    "filter": {
                      "type": "numeric"
                    },
                    "type": "numeric",
                    "edit":
                    {
                        "min": 0,
                        "max": 100,
                        "placeholder": "Number between 0 and 100"
                    }
                },
                {
                    "title": "numeric field non-edit",
                    "field": "_numeric_field",
                    "fieldfx": "numeric_field",
                    "type": "numeric",
                    "inline": true
                },
                {
                    "title": "integer field",
                    "field": "integer_field",
                    "type": "integer",
                    "edit": true,
                    "formatter": false,
                    "filter": {
                      "type": "integer"
                    }
                },
                {
                    "title": "range numeric",
                    "field": "range_numeric",
                    "type": "numeric",
                    "edit":
                    {
                        "range": true
                    }
                },
                {
                    "title": "input formatter",
                    "field": "input_formatter",
                    "type": "numeric",
                    "edit": true
                }```
RobAndrewHurst commented 3 months ago

Putting back into draft.