From 5df8d26ef7eadf22fb97229895f734160cb43aef Mon Sep 17 00:00:00 2001 From: Joost Kaptein Date: Fri, 29 Nov 2024 13:27:13 +0000 Subject: [PATCH 1/5] add aggregate header suppression --- src/AgGrid.fs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/AgGrid.fs b/src/AgGrid.fs index eb2c120..c58b603 100644 --- a/src/AgGrid.fs +++ b/src/AgGrid.fs @@ -762,6 +762,8 @@ type AgGrid<'row> = static member inline aggFunc(v: AggregateFunction) = columnDefProp<'row, 'value> ("aggFunc" ==> v.AggregateText) static member inline rowGroup(v: bool) = columnDefProp<'row, 'value> ("rowGroup" ==> v) + static member inline suppressAggFuncInHeader(v:bool) = columnDefProp<'row, 'value> ("suppressAggFuncInHeader" ==> v) + [] type AgGrid<'row> = static member inline rowGroupPanelShow(v: RowGroupPanelShow) = From 21688db076a15c34768aa8eab73da6dcdd91b870 Mon Sep 17 00:00:00 2001 From: Joost Kaptein Date: Wed, 4 Dec 2024 16:01:28 +0000 Subject: [PATCH 2/5] features for row grouping --- src/AgGrid.fs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/AgGrid.fs b/src/AgGrid.fs index c58b603..aaa5336 100644 --- a/src/AgGrid.fs +++ b/src/AgGrid.fs @@ -716,6 +716,16 @@ type AgGrid<'row> = icon: obj option//HtmlElement } + type IGroupCellRendererParams<'row, 'value> = { + suppressCount: bool + suppressDoubleClickExpand: bool + checkBox: bool + innerRenderer: ICellRendererParams<'row, 'value> -> ReactElement + innerRendererParams: obj array + totalValueGetter: string + } + + [] type BuiltInMenuItem = | AutoSizeAll @@ -763,6 +773,8 @@ type AgGrid<'row> = static member inline rowGroup(v: bool) = columnDefProp<'row, 'value> ("rowGroup" ==> v) static member inline suppressAggFuncInHeader(v:bool) = columnDefProp<'row, 'value> ("suppressAggFuncInHeader" ==> v) + static member inline GroupCellRendererParams(v: IGroupCellRendererParams<'row, 'value>) = + columnDefProp<'row, 'value> ("cellRendererParams" ==> v) [] type AgGrid<'row> = @@ -772,6 +784,9 @@ type AgGrid<'row> = static member inline groupDisplayType(v: RowGroupingDisplayType) = agGridProp<'row> ("groupDisplayType", v.RowGroupingDisplayTypeText) + static member inline autoGroupColumnDef(values: IColumnDefProp<'row, 'value> seq) = + agGridProp ("autoGroupColumnDef", values |> unbox<_ seq> |> createObj) + static member inline pivotMode(v: bool) = agGridProp<'row> ("pivotMode", v) static member inline getDataPath( v: 'row -> string array) = agGridProp<'row> ("getDataPath", v) @@ -789,4 +804,4 @@ type AgGrid<'row> = | BuiltIn builtInItemName -> box builtInItemName.BuiltInMenuItemText | Custom customMenuItem -> box customMenuItem |] - ) + ) \ No newline at end of file From 0abd6eaa6604059730860451ecaccded3d4191d3 Mon Sep 17 00:00:00 2001 From: Joost Kaptein Date: Wed, 4 Dec 2024 16:02:30 +0000 Subject: [PATCH 3/5] add getRowHeight --- src/AgGrid.fs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/AgGrid.fs b/src/AgGrid.fs index aaa5336..b6715ee 100644 --- a/src/AgGrid.fs +++ b/src/AgGrid.fs @@ -58,6 +58,12 @@ type IColumn = { getColId: unit -> string } [] type IColumnDefProp<'row, 'value> = interface end +type IRowHeightParameters<'row> = { + data: 'row option + RowNode: IRowNode<'row> + api: IGridApi<'row> +} + let columnDefProp<'row, 'value> = unbox> // Although the AG Grid docs suggest that this should have two type params, we only give it one so that column defs @@ -506,6 +512,9 @@ type AgGrid<'row> = static member inline defaultColDef(defaults: IColumnDefProp<'row, 'value> seq) = agGridProp<'row> ("defaultColDef", defaults |> unbox<_ seq> |> createObj) + static member inline getRowHeight(v: IRowHeightParameters<'row> -> int option) = agGridProp<'row> ("getRowHeight", v) + + static member onColumnGroupOpened(callback: _ -> unit) = // This can't be inline otherwise Fable produces invalid JS let onColumnGroupOpened = fun ev -> From dd75d59b81f203a625aebcc3a6f56b96dc6b0cef Mon Sep 17 00:00:00 2001 From: Joost Kaptein Date: Wed, 4 Dec 2024 16:51:26 +0000 Subject: [PATCH 4/5] simple code review feedback (whitespace etc) --- src/AgGrid.fs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/AgGrid.fs b/src/AgGrid.fs index b6715ee..a716cc7 100644 --- a/src/AgGrid.fs +++ b/src/AgGrid.fs @@ -60,7 +60,7 @@ type IColumnDefProp<'row, 'value> = interface end type IRowHeightParameters<'row> = { data: 'row option - RowNode: IRowNode<'row> + node: IRowNode<'row> api: IGridApi<'row> } @@ -514,7 +514,6 @@ type AgGrid<'row> = static member inline getRowHeight(v: IRowHeightParameters<'row> -> int option) = agGridProp<'row> ("getRowHeight", v) - static member onColumnGroupOpened(callback: _ -> unit) = // This can't be inline otherwise Fable produces invalid JS let onColumnGroupOpened = fun ev -> @@ -734,7 +733,6 @@ type AgGrid<'row> = totalValueGetter: string } - [] type BuiltInMenuItem = | AutoSizeAll From 047da18cad17440ae9d78add23d009fd557d8a54 Mon Sep 17 00:00:00 2001 From: Joost Kaptein Date: Wed, 4 Dec 2024 17:06:00 +0000 Subject: [PATCH 5/5] rename GroupCellRendererParams to cellRendererParams --- src/AgGrid.fs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/AgGrid.fs b/src/AgGrid.fs index a716cc7..1074354 100644 --- a/src/AgGrid.fs +++ b/src/AgGrid.fs @@ -780,7 +780,8 @@ type AgGrid<'row> = static member inline rowGroup(v: bool) = columnDefProp<'row, 'value> ("rowGroup" ==> v) static member inline suppressAggFuncInHeader(v:bool) = columnDefProp<'row, 'value> ("suppressAggFuncInHeader" ==> v) - static member inline GroupCellRendererParams(v: IGroupCellRendererParams<'row, 'value>) = + + static member inline cellRendererParams(v: IGroupCellRendererParams<'row, 'value>) = columnDefProp<'row, 'value> ("cellRendererParams" ==> v) [] @@ -811,4 +812,4 @@ type AgGrid<'row> = | BuiltIn builtInItemName -> box builtInItemName.BuiltInMenuItemText | Custom customMenuItem -> box customMenuItem |] - ) \ No newline at end of file + )