Skip to content

Commit

Permalink
DU for built in menu items
Browse files Browse the repository at this point in the history
  • Loading branch information
Larocceau committed Aug 16, 2024
1 parent dc48b67 commit 3c71122
Showing 1 changed file with 36 additions and 2 deletions.
38 changes: 36 additions & 2 deletions src/AgGrid.fs
Original file line number Diff line number Diff line change
Expand Up @@ -716,8 +716,42 @@ type AgGrid<'row> =
icon: obj //HtmlElement
}

[<RequireQualifiedAccess>]
type BuiltInMenuItem =
| AutoSizeAll
| ExpandAll
| ContractAll
| Copy
| CopyWithHeaders
| CopyWithGroupHeaders
| Cut
| Paste
| ResetColumns
| Export
| CsvExport
| ExcelExport
| ChartRange
| PivotChart

member this.BuiltInMenuItemText =
match this with
| AutoSizeAll -> "autoSizeAll"
| ExpandAll -> "expandAll"
| ContractAll -> "contractAll"
| Copy -> "copy"
| CopyWithHeaders -> "copyWithHeaders"
| CopyWithGroupHeaders -> "copyWithGroupHeaders"
| Cut -> "cut"
| Paste -> "paste"
| ResetColumns -> "resetColumns"
| Export -> "export"
| CsvExport -> "csvExport"
| ExcelExport -> "excelExport"
| ChartRange -> "chartRange"
| PivotChart -> "pivotChart"

type MenuItem =
| BuiltIn of string
| BuiltIn of BuiltInMenuItem
| Custom of MenuItemDef

/// See https://www.ag-grid.com/react-data-grid/grid-interface/#grid-api.
Expand Down Expand Up @@ -757,7 +791,7 @@ type AgGrid<'row> =
[|
for item in menuItems do
match item with
| BuiltIn builtInItemName -> box builtInItemName
| BuiltIn builtInItemName -> box builtInItemName.BuiltInMenuItemText
| Custom customMenuItem -> box customMenuItem
|]
)

0 comments on commit 3c71122

Please sign in to comment.