|
|
|
@ -28,7 +28,7 @@ function EditorControls(p) { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function EquationGroup(p) { |
|
|
|
|
const {equation,setEquation,data,arr,key,id} = p |
|
|
|
|
const {equation,setEquation,data,arr,id} = p |
|
|
|
|
|
|
|
|
|
const [myArr,setMyArr] = useState(arr) |
|
|
|
|
|
|
|
|
@ -67,7 +67,7 @@ function EquationGroup(p) { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function EquationOperator(p) { |
|
|
|
|
const {equation,setEquation,data,operator,key,id} = p |
|
|
|
|
const {equation,setEquation,operator,id} = p |
|
|
|
|
|
|
|
|
|
const [op,setOp] = useState(operator) |
|
|
|
|
|
|
|
|
@ -77,7 +77,7 @@ function EquationOperator(p) { |
|
|
|
|
setEquation(eqArr) |
|
|
|
|
},[op]) |
|
|
|
|
|
|
|
|
|
return <div style={{position:"relative",display:"inline-block",paddingLeft:"12px",paddingRight:"12px",paddingTop:"10px"}}><select style={{fontSize:"24px"}} value={op} defaultValue={operator} onChange={(ev)=>{setOp(ev.currentTarget.value)}}> |
|
|
|
|
return <div style={{position:"relative",display:"inline-block",paddingLeft:"12px",paddingRight:"12px",paddingTop:"10px"}}><select style={{fontSize:"24px"}} value={op} onChange={(ev)=>{setOp(ev.currentTarget.value)}}> |
|
|
|
|
{["+","-","×","÷","^"].map((sign)=><option key={sign} value={sign}>{sign}</option>)} |
|
|
|
|
</select> |
|
|
|
|
<EditorControls equation={equation} setEquation={setEquation} id={id}/> |
|
|
|
@ -85,7 +85,7 @@ function EquationOperator(p) { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function EquationValue(p) { |
|
|
|
|
const {equation,setEquation,data,val,key,id} = p |
|
|
|
|
const {equation,setEquation,data,val,id} = p |
|
|
|
|
|
|
|
|
|
const [item,setItem] = useState(val) |
|
|
|
|
|
|
|
|
@ -96,7 +96,7 @@ function EquationValue(p) { |
|
|
|
|
},[item]) |
|
|
|
|
|
|
|
|
|
return <div style={{position:"relative",display:"inline-block",border:"1px solid black",paddingTop:"16px"}}> |
|
|
|
|
<select value={item} defaultValue={val} onChange={(ev)=>{setItem(ev.currentTarget.value)}}> |
|
|
|
|
<select value={item} onChange={(ev)=>{setItem(ev.currentTarget.value)}}> |
|
|
|
|
{Object.keys(data).map((key)=><option key={key} value={key}>{key}</option>)} |
|
|
|
|
</select> |
|
|
|
|
<br/> |
|
|
|
@ -180,6 +180,8 @@ function Equation(p) { |
|
|
|
|
|
|
|
|
|
<br/><br/> |
|
|
|
|
<h1>{SolveEquation(equation).toFixed(2)}</h1> |
|
|
|
|
<br/><br/> |
|
|
|
|
{JSON.stringify(equation)} |
|
|
|
|
</> |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -192,7 +194,7 @@ function EditBox(p) { |
|
|
|
|
setVal(v) |
|
|
|
|
},[v]) |
|
|
|
|
|
|
|
|
|
return <input type="text" value={v} defaultValue={val} onChange={(ev)=>{setV(ev.currentTarget.value)}}/> |
|
|
|
|
return <input type="text" value={v} onChange={(ev)=>{setV(ev.currentTarget.value)}}/> |
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function ValueEditor(p) { |
|
|
|
|