Removes obsolete parts
This commit is contained in:
parent
0931914ae4
commit
306ddb70c0
|
@ -1,11 +1,6 @@
|
||||||
open BsReform;
|
open BsReform;
|
||||||
open Antd.Grid;
|
open Antd.Grid;
|
||||||
|
|
||||||
type shape = (array(float), array(float));
|
|
||||||
|
|
||||||
[@bs.module "./editor/main.js"]
|
|
||||||
external getPdfFromUserInput: string => shape = "get_pdf_from_user_input";
|
|
||||||
|
|
||||||
module FormConfig = [%lenses type state = {guesstimatorString: string}];
|
module FormConfig = [%lenses type state = {guesstimatorString: string}];
|
||||||
|
|
||||||
module Form = ReForm.Make(FormConfig);
|
module Form = ReForm.Make(FormConfig);
|
||||||
|
@ -32,49 +27,15 @@ module FieldString = {
|
||||||
|
|
||||||
module Styles = {
|
module Styles = {
|
||||||
open Css;
|
open Css;
|
||||||
let rows =
|
|
||||||
style([
|
|
||||||
selector(
|
|
||||||
">.ant-col:first-child",
|
|
||||||
[paddingLeft(em(0.25)), paddingRight(em(0.125))],
|
|
||||||
),
|
|
||||||
selector(
|
|
||||||
">.ant-col:last-child",
|
|
||||||
[paddingLeft(em(0.125)), paddingRight(em(0.25))],
|
|
||||||
),
|
|
||||||
selector(
|
|
||||||
">.ant-col:not(:first-child):not(:last-child)",
|
|
||||||
[paddingLeft(em(0.125)), paddingRight(em(0.125))],
|
|
||||||
),
|
|
||||||
]);
|
|
||||||
let parent =
|
|
||||||
style([
|
|
||||||
selector(".ant-input-number", [width(`percent(100.))]),
|
|
||||||
selector(".anticon", [verticalAlign(`zero)]),
|
|
||||||
]);
|
|
||||||
let form = style([backgroundColor(hex("eee")), padding(em(1.))]);
|
|
||||||
let dist = style([padding(em(1.))]);
|
let dist = style([padding(em(1.))]);
|
||||||
let spacer = style([marginTop(em(1.))]);
|
let spacer = style([marginTop(em(1.))]);
|
||||||
let groupA =
|
|
||||||
style([
|
|
||||||
selector(
|
|
||||||
".ant-input-number-input",
|
|
||||||
[backgroundColor(hex("fff7db"))],
|
|
||||||
),
|
|
||||||
]);
|
|
||||||
let groupB =
|
|
||||||
style([
|
|
||||||
selector(
|
|
||||||
".ant-input-number-input",
|
|
||||||
[backgroundColor(hex("eaf4ff"))],
|
|
||||||
),
|
|
||||||
]);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
module DemoDist = {
|
module DemoDist = {
|
||||||
[@react.component]
|
[@react.component]
|
||||||
let make = (~guesstimatorString: string) => {
|
let make = (~guesstimatorString: string) => {
|
||||||
let (ys, xs) = getPdfFromUserInput("normal(1, 1) / normal(10, 1)");
|
let (ys, xs) =
|
||||||
|
DistEditor.getPdfFromUserInput("normal(1, 1) / normal(10, 1)");
|
||||||
let continuous: DistTypes.xyShape = {xs, ys};
|
let continuous: DistTypes.xyShape = {xs, ys};
|
||||||
<Antd.Card title={"Distribution" |> E.ste}>
|
<Antd.Card title={"Distribution" |> E.ste}>
|
||||||
<div className=Styles.spacer />
|
<div className=Styles.spacer />
|
||||||
|
@ -85,7 +46,6 @@ module DemoDist = {
|
||||||
|
|
||||||
[@react.component]
|
[@react.component]
|
||||||
let make = () => {
|
let make = () => {
|
||||||
let (reloader, setRealoader) = React.useState(() => 1);
|
|
||||||
let reform =
|
let reform =
|
||||||
Form.use(
|
Form.use(
|
||||||
~validationStrategy=OnDemand,
|
~validationStrategy=OnDemand,
|
||||||
|
@ -95,11 +55,6 @@ let make = () => {
|
||||||
(),
|
(),
|
||||||
);
|
);
|
||||||
|
|
||||||
let onSubmit = e => {
|
|
||||||
e->ReactEvent.Synthetic.preventDefault;
|
|
||||||
reform.submit();
|
|
||||||
};
|
|
||||||
|
|
||||||
let demoDist =
|
let demoDist =
|
||||||
React.useMemo1(
|
React.useMemo1(
|
||||||
() => {
|
() => {
|
||||||
|
@ -110,26 +65,14 @@ let make = () => {
|
||||||
[|reform.state.values.guesstimatorString|],
|
[|reform.state.values.guesstimatorString|],
|
||||||
);
|
);
|
||||||
|
|
||||||
let onRealod = _ => {
|
<div>
|
||||||
setRealoader(_ => reloader + 1);
|
|
||||||
};
|
|
||||||
|
|
||||||
<div className=Styles.parent>
|
|
||||||
<div className=Styles.spacer />
|
<div className=Styles.spacer />
|
||||||
demoDist
|
demoDist
|
||||||
<div className=Styles.spacer />
|
<div className=Styles.spacer />
|
||||||
<Antd.Card
|
<Antd.Card title={"Distribution Form" |> E.ste}>
|
||||||
title={"Distribution Form" |> E.ste}
|
|
||||||
extra={
|
|
||||||
<Antd.Button
|
|
||||||
icon=Antd.IconName.reload
|
|
||||||
shape=`circle
|
|
||||||
onClick=onRealod
|
|
||||||
/>
|
|
||||||
}>
|
|
||||||
<Form.Provider value=reform>
|
<Form.Provider value=reform>
|
||||||
<Antd.Form onSubmit>
|
<Antd.Form>
|
||||||
<Row _type=`flex className=Styles.rows>
|
<Row _type=`flex>
|
||||||
<Col span=12>
|
<Col span=12>
|
||||||
<FieldString
|
<FieldString
|
||||||
field=FormConfig.GuesstimatorString
|
field=FormConfig.GuesstimatorString
|
||||||
|
@ -137,10 +80,6 @@ let make = () => {
|
||||||
/>
|
/>
|
||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
<Antd.Button
|
|
||||||
_type=`primary icon=Antd.IconName.reload onClick=onRealod>
|
|
||||||
{"Update Distribution" |> E.ste}
|
|
||||||
</Antd.Button>
|
|
||||||
</Antd.Form>
|
</Antd.Form>
|
||||||
</Form.Provider>
|
</Form.Provider>
|
||||||
</Antd.Card>
|
</Antd.Card>
|
||||||
|
|
3
src/components/editor/DistEditor.re
Normal file
3
src/components/editor/DistEditor.re
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
[@bs.module "./main.js"]
|
||||||
|
external getPdfFromUserInput: string => (array(float), array(float)) =
|
||||||
|
"get_pdf_from_user_input";
|
Loading…
Reference in New Issue
Block a user