Repository: mathesar-foundation/mathesar

Issue:
Hide grouping separators by default in Number columns
## Current behavior

- We default to displaying grouping separators (e.g. `1,234`) in _all_ numbers.
- Users can turn off grouping separators by customizing their display options.
- This "on-by-default" behavior, feels a bit strange for columns like primary keys and years, where users typically don't see grouping separators.
- During import, Mathesar uses the `numeric` type by default -- even if all values within the import data can be cast to integers. @mathemancer explained that we made this decision early on in order to be flexible, and I think it's worth sticking with it. But it means that years don't get imported as integers by default, making it hard to take the approach were heading towards with the discussion in #1527.
- The back end does not set the grouping separator display option during import. It only gets set via the front end if the user manually adjust it.

## Desired behavior

- When the user has not configured any display options:
    - Columns with a UI type of "Number" will be rendered without grouping separators (regardless of their Postgres type). This means that the user will need to manually turn them on sometimes.
    - Columns with a UI type of "Money" will be rendered _with_ grouping separators. The user can turn them off if needed.




Discussion:
I think this makes sense.

We can improve our inference for integers once we have global inference (see https://github.com/centerofci/mathesar/issues/438). It may be worth revisiting this decision afterwards.

Resolving patch:
diff --git a/mathesar/api/serializers/shared_serializers.py b/mathesar/api/serializers/shared_serializers.py
--- a/mathesar/api/serializers/shared_serializers.py
+++ b/mathesar/api/serializers/shared_serializers.py
@@ -157,7 +157,7 @@ class AbstractNumberDisplayOptionSerializer(BaseDisplayOptionsSerializer):
         choices=['english', 'german', 'french', 'hindi', 'swiss']
     )
 
-    use_grouping = serializers.ChoiceField(required=False, choices=['true', 'false', 'auto'], default='auto')
+    use_grouping = serializers.ChoiceField(required=False, choices=['true', 'false'], default='false')
     """
     The choices here correspond to the options available for the `useGrouping`
     property within the [Intl API][1]. True and False are encoded as strings


Test patch:
diff --git a/mathesar/tests/api/test_column_api_display_options.py b/mathesar/tests/api/test_column_api_display_options.py
--- a/mathesar/tests/api/test_column_api_display_options.py
+++ b/mathesar/tests/api/test_column_api_display_options.py
@@ -33,7 +33,7 @@ def column_test_table_with_service_layer_options(patent_schema):
             'display_options': {
                 'show_as_percentage': True,
                 'number_format': "english",
-                "use_grouping": 'auto',
+                "use_grouping": 'true',
                 "minimum_fraction_digits": None,
                 "maximum_fraction_digits": None,
             }
@@ -122,7 +122,7 @@ def column_test_table_with_service_layer_options(patent_schema):
         {
             "show_as_percentage": False,
             'number_format': None,
-            'use_grouping': 'auto',
+            'use_grouping': 'false',
             "minimum_fraction_digits": None,
             "maximum_fraction_digits": None,
         },
@@ -149,14 +149,14 @@ def column_test_table_with_service_layer_options(patent_schema):
         {
             "show_as_percentage": True,
             'number_format': "english",
-            'use_grouping': 'auto',
+            'use_grouping': 'true',
             "minimum_fraction_digits": None,
             "maximum_fraction_digits": None,
         },
         {
             "show_as_percentage": True,
             'number_format': "english",
-            'use_grouping': 'auto',
+            'use_grouping': 'true',
             "minimum_fraction_digits": None,
             "maximum_fraction_digits": None,
         },
diff --git a/mathesar/tests/api/test_table_api.py b/mathesar/tests/api/test_table_api.py
--- a/mathesar/tests/api/test_table_api.py
+++ b/mathesar/tests/api/test_table_api.py
@@ -1166,7 +1166,7 @@ def test_table_patch_columns_display_options(create_data_types_table, client):
     table_name = 'patch_cols_one'
     table = create_data_types_table(table_name)
     column_data = _get_data_types_column_data(table)
-    display_options = {"use_grouping": "auto"}
+    display_options = {"use_grouping": "false"}
     column_data[0]['display_options'] = display_options
     body = {
         'columns': column_data
@@ -1185,7 +1185,7 @@ def test_table_patch_columns_invalid_display_options(create_data_types_table, cl
     table = create_data_types_table(table_name)
     column_data = _get_data_types_column_data(table)
     # despite its name, the last column is of type text
-    display_options = {"use_grouping": "auto"}
+    display_options = {"use_grouping": "false"}
 
     column_data[-1]['display_options'] = display_options
     body = {
@@ -1203,7 +1203,7 @@ def test_table_patch_columns_type_plus_display_options(create_data_types_table,
     table = create_data_types_table(table_name)
     column_data = _get_data_types_column_data(table)
     # despite its name, the last column is of type text
-    display_options = {"use_grouping": "auto"}
+    display_options = {"use_grouping": "false"}
     column_data[-1].update(
         {'type': PostgresType.NUMERIC.id, 'display_options': display_options}
     )
diff --git a/mathesar_ui/src/component-library/number-input/__tests__/NumberInput.test.ts b/mathesar_ui/src/component-library/number-input/__tests__/NumberInput.test.ts
--- a/mathesar_ui/src/component-library/number-input/__tests__/NumberInput.test.ts
+++ b/mathesar_ui/src/component-library/number-input/__tests__/NumberInput.test.ts
@@ -28,6 +28,7 @@ test.each([
   const { getByLabelText } = render(NumberInput, {
     locale,
     'aria-label': label,
+    useGrouping: true,
   });
   const input = getByLabelText(label) as HTMLInputElement;
   expect(input.value).toBe('');