Skip to content

Instantly share code, notes, and snippets.

@bentayloruk
Last active June 13, 2017 15:33
Show Gist options
  • Save bentayloruk/575e24b620235ae8bf04da3c7d9105bf to your computer and use it in GitHub Desktop.
Save bentayloruk/575e24b620235ae8bf04da3c7d9105bf to your computer and use it in GitHub Desktop.
module ReactQueryBuilder
open Fable.Core
open Fable.Import
open Fable.Import.React
open Fable.Core.JsInterop
open Fable.Helpers.React.Props
open System
// TODO
// * Can we have Pojo properties be uppercase, but lowercase in JS generation? Cosmetic.
type Name = string
type Label = string
[<Pojo>]
type Field = {
name : Name
label : Label }
[<StringEnum>]
type CombinatorName = And | Or
[<Pojo>]
type Combinator = {
name : CombinatorName
label : Label }
type internal IQueryBuilderProp =
inherit IHTMLProp
type QueryBuilderProps =
| Fields of Field array
| Combinators of Combinator array
interface IQueryBuilderProp
let QueryBuilder = importDefault<ComponentClass<obj>> "react-querybuilder"
let inline queryBuilder (htmlProps: IHTMLProp list) = Fable.Helpers.React.from QueryBuilder (keyValueList CaseRules.LowerFirst htmlProps) []
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment