Skip to content

Commit

Permalink
Change width to a float type
Browse files Browse the repository at this point in the history
  • Loading branch information
mschindlerMM committed Dec 11, 2023
1 parent 9228781 commit d0b8682
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
4 changes: 4 additions & 0 deletions ELM_CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Elm Changelog

## [20.0.0]

- Convert width from an `Int` to a `Float` type on the `ColumnSettings` and `ColumnState`. This fixes an issue where a column with a float width would fail the ColumnState decoder.

## [19.0.0]

- Added `flex`, `pivot`, `pivotIndex`, `rowGroupIndex`, `sort`, and `sortIndex` to `ColumnSettings`
Expand Down
2 changes: 1 addition & 1 deletion elm.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "mercurymedia/elm-ag-grid",
"summary": "AgGrid integration for Elm",
"license": "MIT",
"version": "19.0.0",
"version": "20.0.0",
"exposed-modules": [
"AgGrid.ContextMenu",
"AgGrid.Expression",
Expand Down
10 changes: 5 additions & 5 deletions src/AgGrid.elm
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ type alias ColumnSettings =
, valueGetter : Maybe String
, valueParser : Maybe String
, valueSetter : Maybe String
, width : Maybe Int
, width : Maybe Float
, wrapHeaderText : Bool
}

Expand All @@ -365,7 +365,7 @@ type alias ColumnState =
, rowGroupIndex : Maybe Int
, sort : Maybe String
, sortIndex : Maybe Int
, width : Int
, width : Float
}


Expand Down Expand Up @@ -1129,7 +1129,7 @@ columnDefEncoder gridConfig columnDef =
, ( "width"
, case columnDef.settings.width of
Just width ->
Json.Encode.int width
Json.Encode.float width

Nothing ->
Json.Encode.null
Expand All @@ -1152,7 +1152,7 @@ columnStateDecoder =
|> DecodePipeline.optional "rowGroupIndex" (Decode.nullable Decode.int) Nothing
|> DecodePipeline.optional "sort" (Decode.nullable Decode.string) Nothing
|> DecodePipeline.optional "sortIndex" (Decode.nullable Decode.int) Nothing
|> DecodePipeline.required "width" Decode.int
|> DecodePipeline.required "width" Decode.float


{-| Decoder for the current column states.
Expand Down Expand Up @@ -1208,7 +1208,7 @@ columnStateEncoder columnState =
, ( "rowGroupIndex", encodeMaybe Json.Encode.int columnState.rowGroupIndex )
, ( "sort", encodeMaybe Json.Encode.string columnState.sort )
, ( "sortIndex", encodeMaybe Json.Encode.int columnState.sortIndex )
, ( "width", Json.Encode.int columnState.width )
, ( "width", Json.Encode.float columnState.width )
]


Expand Down

0 comments on commit d0b8682

Please sign in to comment.