-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Updates to bindings for XYZ axes, Treemap, Pie, and Cell components #59
Changes from 7 commits
d4cfcbd
4553b69
d9c2068
0e07da3
602f743
a2359bb
db7dbb6
527b615
edcbe31
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,49 +8,155 @@ external make: | |
~allowDataOverflow: bool=?, | ||
~allowDecimals: bool=?, | ||
~allowDuplicatedCategory: bool=?, | ||
~axisLine: 'axisLine=?, | ||
~axisLine: | ||
[@mel.unwrap] [ | ||
| `Bool(bool) | ||
| `Obj(Js.t({..})) | ||
] | ||
=?, | ||
~className: string=?, | ||
~dataKey: string=?, | ||
~dataKey: | ||
[@mel.unwrap] [ | ||
| `Str(string) | ||
| `Int(int) | ||
| `Fn('dataObj => 'data) | ||
] | ||
=?, | ||
~domain: array('domain)=?, | ||
~height: int=?, | ||
~hide: bool=?, | ||
~interval: AxisInterval.t=?, | ||
~label: 'label=?, | ||
~label: | ||
[@mel.unwrap] [ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we maybe replace some of those types in https://github.com/ahrefs/melange-recharts/blob/master/src/Utils.re#L135 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd like to tackle this in another PR but I think this is a great suggestion. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. PR open: #60 |
||
| `Str(string) | ||
| `Int(int) | ||
| `Float(float) | ||
| `Component(React.element) | ||
| `Obj(Js.t({..})) | ||
] | ||
=?, | ||
~minTickGap: int=?, | ||
~mirror: bool=?, | ||
~name: string=?, | ||
~onClick: (Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, | ||
~onMouseDown: (Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, | ||
~name: | ||
[@mel.unwrap] [ | ||
| `Str(string) | ||
| `Int(int) | ||
| `Float(float) | ||
] | ||
=?, | ||
~onClick: (. Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, | ||
~onMouseDown: | ||
(. Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, | ||
~onMouseEnter: | ||
(Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, | ||
~onMouseLeave: (Js.t({..}), React.Event.Mouse.t) => unit=?, | ||
~onMouseMove: (Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, | ||
~onMouseOut: (Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, | ||
~onMouseOver: (Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, | ||
~onMouseUp: (Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, | ||
(. Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, | ||
~onMouseLeave: (. Js.t({..}), React.Event.Mouse.t) => unit=?, | ||
~onMouseMove: | ||
(. Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, | ||
~onMouseOut: | ||
(. Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, | ||
~onMouseOver: | ||
(. Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, | ||
~onMouseUp: (. Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, | ||
~orientation: | ||
[ | ||
| `bottom | ||
| `top | ||
] | ||
=?, | ||
~padding: paddingHorizontal=?, | ||
~range: array(int)=?, | ||
~reversed: bool=?, | ||
~scale: scale=?, | ||
~stroke: string=?, | ||
~style: ReactDOM.Style.t=?, | ||
~tick: 'tick=?, | ||
~tick: | ||
[@mel.unwrap] [ | ||
| `Obj(Js.t({..})) | ||
| `Component(React.element) | ||
| `Bool(bool) | ||
| `Fn('tick => React.element) | ||
] | ||
=?, | ||
~tickCount: int=?, | ||
~tickFormatter: 'tickFormatter=?, | ||
~tickLine: 'tickLine=?, | ||
~tickFormatter: (. 'tick, int) => string=?, | ||
~tickLine: | ||
[@mel.unwrap] [ | ||
| `Bool(bool) | ||
| `Obj(Js.t({..})) | ||
] | ||
=?, | ||
~tickMargin: int=?, | ||
~ticks: array('ticks)=?, | ||
~tickSize: int=?, | ||
~tickSize: | ||
[@mel.unwrap] [ | ||
| `Float(float) | ||
| `Int(int) | ||
] | ||
=?, | ||
~transform: string=?, | ||
~unit: string=?, | ||
~width: int=?, | ||
~xAxisId: string=? | ||
) => | ||
React.element = | ||
"XAxis"; | ||
|
||
let makeProps = (~interval=?) => | ||
makeProps(~interval=?interval->AxisInterval.encodeOpt); | ||
let makeProps = | ||
( | ||
~interval=?, | ||
~onClick=?, | ||
~onMouseDown=?, | ||
~onMouseEnter=?, | ||
~onMouseLeave=?, | ||
~onMouseMove=?, | ||
~onMouseOut=?, | ||
~onMouseOver=?, | ||
~onMouseUp=?, | ||
~tickFormatter=?, | ||
) => | ||
makeProps( | ||
~interval=?interval |> AxisInterval.encodeOpt, | ||
~onClick=? | ||
onClick | ||
|> Option.map(onClick => (. payload, event) => onClick(payload, event)), | ||
~onMouseDown=? | ||
onMouseDown | ||
|> Option.map(onMouseDown => | ||
(. payload, event) => onMouseDown(payload, event) | ||
), | ||
~onMouseEnter=? | ||
onMouseEnter | ||
|> Option.map(onMouseEnter => | ||
(. payload, event) => onMouseEnter(payload, event) | ||
), | ||
~onMouseLeave=? | ||
onMouseLeave | ||
|> Option.map(onMouseLeave => | ||
(. payload, event) => onMouseLeave(payload, event) | ||
), | ||
~onMouseMove=? | ||
onMouseMove | ||
|> Option.map(onMouseMove => | ||
(. payload, event) => onMouseMove(payload, event) | ||
), | ||
~onMouseOut=? | ||
onMouseOut | ||
|> Option.map(onMouseOut => | ||
(. payload, event) => onMouseOut(payload, event) | ||
), | ||
~onMouseOver=? | ||
onMouseOver | ||
|> Option.map(onMouseOver => | ||
(. payload, event) => onMouseOver(payload, event) | ||
), | ||
~onMouseUp=? | ||
onMouseUp | ||
|> Option.map(onMouseUp => | ||
(. payload, event) => onMouseUp(payload, event) | ||
), | ||
~tickFormatter=? | ||
tickFormatter | ||
|> Option.map(tickFormatter => | ||
(. tick, index) => tickFormatter(tick, index) | ||
), | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can add something along the lines of the PR description in one line ("Improve bindings for XYZ axes, Treemap, Pie and Cell components"), with a link to the PR for those interested on details.
I would also add "Breaking" before it.
example.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done