diff --git a/index.html b/index.html index 1d9966b..6ebb739 100755 --- a/index.html +++ b/index.html @@ -1,113 +1,478 @@ +
+ + + - \ No newline at end of file + let buttonUnmodify = h("span", { + className:"Icon Modify remove", + onClick:e=> + { + Pivot.Unmodify(N.Step(node, "ModifyAt", false)[0]); + Render(); + } + }, "Unmodify"); + + return h("div", {className:"Node"}, [ + h("div", {className:cx(nodeBase, "Upper")}, [ + h("div", {className:label}, [ + h("span", {className:"Icon Expand"}, "+"), + h("span", {className:"Name"}, (node.Meta.Label || "a node")+" "+node.ID.Walk), + h("span", {className: icon}), + N.Step(node, "ModifyAt") ? buttonUnmodify : buttonModify + ] ), + h("div", {className:"Table"}, (node.Meta.Row || []).map( cell => h("div", {className:"Cell"}, cell)) ) + ]), + h("div", {className:"Nodes"}, N.Step(node, "Hierarchy").map(child=>h(ElNode, {node:child, depth:depth+1})) ) + ]); +}; +let ElPivot = ({pivot}) => +{ + return h("div", {style:{display:"inline-block", width:"500px"}}, [ + h("button", {onClick:e=>{Pivot.Delete(pivot);Render();}}, "delete?"), + h(ElModifiers, {node:pivot}), + h(ElNode, {node:pivot, depth:0}) + ]); +}; +let ElModifiers = ({node}) => +{ + let modifiers = N.Step(node, "Modifier") || []; + + return h("div", null, [ + h("strong", null, "modifiers"), + ...modifiers.map( m => h("span", {onClick:e=> + { + Pivot.Unmodify(m); + Render(); + } + }, "modifier")) + ]); +}; +let ElRoot = props => +{ + return h("div", null, [ + h("h3", null, "tree view"), + h(ElModifiers, {node:Pivot.Root}), + h("button", { onClick:e=> + { + AddNewPivot(); + } + }, "add new pivot"), + ...N.Step(Pivot.Root, "Pivot").map(pivot=>h(ElPivot, {pivot})) + ]) +}; +let Render = () => render(h(ElRoot), document.querySelector("#app")); +Render(); + +