Removes obsolete parts
This commit is contained in:
parent
0931914ae4
commit
306ddb70c0
|
@ -1,11 +1,6 @@
|
|||
open BsReform;
|
||||
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 Form = ReForm.Make(FormConfig);
|
||||
|
@ -32,49 +27,15 @@ module FieldString = {
|
|||
|
||||
module Styles = {
|
||||
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 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 = {
|
||||
[@react.component]
|
||||
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};
|
||||
<Antd.Card title={"Distribution" |> E.ste}>
|
||||
<div className=Styles.spacer />
|
||||
|
@ -85,7 +46,6 @@ module DemoDist = {
|
|||
|
||||
[@react.component]
|
||||
let make = () => {
|
||||
let (reloader, setRealoader) = React.useState(() => 1);
|
||||
let reform =
|
||||
Form.use(
|
||||
~validationStrategy=OnDemand,
|
||||
|
@ -95,11 +55,6 @@ let make = () => {
|
|||
(),
|
||||
);
|
||||
|
||||
let onSubmit = e => {
|
||||
e->ReactEvent.Synthetic.preventDefault;
|
||||
reform.submit();
|
||||
};
|
||||
|
||||
let demoDist =
|
||||
React.useMemo1(
|
||||
() => {
|
||||
|
@ -110,26 +65,14 @@ let make = () => {
|
|||
[|reform.state.values.guesstimatorString|],
|
||||
);
|
||||
|
||||
let onRealod = _ => {
|
||||
setRealoader(_ => reloader + 1);
|
||||
};
|
||||
|
||||
<div className=Styles.parent>
|
||||
<div>
|
||||
<div className=Styles.spacer />
|
||||
demoDist
|
||||
<div className=Styles.spacer />
|
||||
<Antd.Card
|
||||
title={"Distribution Form" |> E.ste}
|
||||
extra={
|
||||
<Antd.Button
|
||||
icon=Antd.IconName.reload
|
||||
shape=`circle
|
||||
onClick=onRealod
|
||||
/>
|
||||
}>
|
||||
<Antd.Card title={"Distribution Form" |> E.ste}>
|
||||
<Form.Provider value=reform>
|
||||
<Antd.Form onSubmit>
|
||||
<Row _type=`flex className=Styles.rows>
|
||||
<Antd.Form>
|
||||
<Row _type=`flex>
|
||||
<Col span=12>
|
||||
<FieldString
|
||||
field=FormConfig.GuesstimatorString
|
||||
|
@ -137,10 +80,6 @@ let make = () => {
|
|||
/>
|
||||
</Col>
|
||||
</Row>
|
||||
<Antd.Button
|
||||
_type=`primary icon=Antd.IconName.reload onClick=onRealod>
|
||||
{"Update Distribution" |> E.ste}
|
||||
</Antd.Button>
|
||||
</Antd.Form>
|
||||
</Form.Provider>
|
||||
</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