pivot deletion working
This commit is contained in:
parent
f6b438ddd8
commit
d855e86706
23
index.html
23
index.html
@ -172,14 +172,14 @@ var N =
|
|||||||
var Pivot =
|
var Pivot =
|
||||||
{
|
{
|
||||||
Leaves:{},
|
Leaves:{},
|
||||||
Root:N.Create({}),
|
Root:N.Create({Label:"All Pivots"}),
|
||||||
|
|
||||||
Init(inRows)
|
Init(inRows)
|
||||||
{
|
{
|
||||||
Pivot.Leaves = inRows.map(r => N.Create({Row:r}));
|
Pivot.Leaves = inRows.map(r => N.Create({Row:r}));
|
||||||
Pivot.Init = ()=>{};
|
Pivot.Init = ()=>{};
|
||||||
},
|
},
|
||||||
Pivot(inParent, inPivotIndicies, inSumIndicies, inDepth)
|
Pivot(inRoot, inParent, inPivotIndicies, inSumIndicies, inDepth)
|
||||||
{
|
{
|
||||||
//arguments:
|
//arguments:
|
||||||
// - a Node with leaf Nodes temporarily stored in its Meta.Leaves
|
// - a Node with leaf Nodes temporarily stored in its Meta.Leaves
|
||||||
@ -226,6 +226,7 @@ var Pivot =
|
|||||||
{
|
{
|
||||||
iterator = inLastBranch =>
|
iterator = inLastBranch =>
|
||||||
{
|
{
|
||||||
|
N.Connect(inRoot, inLastBranch, "Terminal");
|
||||||
inLastBranch.Meta.Leaves.forEach( inLeaf =>
|
inLastBranch.Meta.Leaves.forEach( inLeaf =>
|
||||||
{
|
{
|
||||||
// collect modifiers effecting leaves
|
// collect modifiers effecting leaves
|
||||||
@ -247,7 +248,7 @@ var Pivot =
|
|||||||
inLastBranch.ID.Walk = N.ID.Walk;
|
inLastBranch.ID.Walk = N.ID.Walk;
|
||||||
modifiers.forEach( inModifier => N.Connect(inModifier, inLastBranch, "ModifyUp") )
|
modifiers.forEach( inModifier => N.Connect(inModifier, inLastBranch, "ModifyUp") )
|
||||||
|
|
||||||
// also walk them up, but with a unique check connection
|
// also walk them up and connect, but with "check unique" enabled
|
||||||
N.Walk( inNode=>
|
N.Walk( inNode=>
|
||||||
{
|
{
|
||||||
modifiers.forEach( inModifier => N.Connect(inModifier, inNode, "ModifyUp", true) )
|
modifiers.forEach( inModifier => N.Connect(inModifier, inNode, "ModifyUp", true) )
|
||||||
@ -263,7 +264,7 @@ var Pivot =
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
iterator = child => Pivot.Pivot(child, inPivotIndicies, inSumIndicies, depth+1);
|
iterator = child => Pivot.Pivot(inRoot, child, inPivotIndicies, inSumIndicies, depth+1);
|
||||||
}
|
}
|
||||||
N.Step(inParent, "Hierarchy").forEach(iterator);
|
N.Step(inParent, "Hierarchy").forEach(iterator);
|
||||||
return inParent;
|
return inParent;
|
||||||
@ -274,10 +275,11 @@ var Pivot =
|
|||||||
|
|
||||||
let pivotRoot = N.Create({Label:"Pivot Root", Leaves:Pivot.Leaves});
|
let pivotRoot = N.Create({Label:"Pivot Root", Leaves:Pivot.Leaves});
|
||||||
N.Connect(Pivot.Root, pivotRoot, "Pivot");
|
N.Connect(Pivot.Root, pivotRoot, "Pivot");
|
||||||
return Pivot.Pivot(pivotRoot, inPivotIndicies, inSumIndicies);
|
return Pivot.Pivot(pivotRoot, pivotRoot, inPivotIndicies, inSumIndicies);
|
||||||
},
|
},
|
||||||
Delete(inRoot)
|
Delete(inRoot)
|
||||||
{
|
{
|
||||||
|
// disconnect modifiers
|
||||||
let check = N.Step(inRoot, "Modifier");
|
let check = N.Step(inRoot, "Modifier");
|
||||||
if(check)
|
if(check)
|
||||||
{
|
{
|
||||||
@ -286,6 +288,14 @@ var Pivot =
|
|||||||
Pivot.Unmodify(check[0]);
|
Pivot.Unmodify(check[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// disconnect terminal branches
|
||||||
|
N.Walk(()=>{}, inRoot, "Terminal", inNode=>{
|
||||||
|
N.Disconnect(inNode, null, "Hierarchy");
|
||||||
|
});
|
||||||
|
|
||||||
|
// disconnect from app
|
||||||
|
N.Disconnect(null, inRoot, "Pivot")
|
||||||
},
|
},
|
||||||
Modify(inNode)
|
Modify(inNode)
|
||||||
{
|
{
|
||||||
@ -461,6 +471,7 @@ let ElModifiers = ({node}) =>
|
|||||||
};
|
};
|
||||||
let ElRoot = props =>
|
let ElRoot = props =>
|
||||||
{
|
{
|
||||||
|
let pivots = N.Step(Pivot.Root, "Pivot")||[];
|
||||||
return h("div", null, [
|
return h("div", null, [
|
||||||
h("h3", null, "tree view"),
|
h("h3", null, "tree view"),
|
||||||
h(ElModifiers, {node:Pivot.Root}),
|
h(ElModifiers, {node:Pivot.Root}),
|
||||||
@ -469,7 +480,7 @@ let ElRoot = props =>
|
|||||||
AddNewPivot();
|
AddNewPivot();
|
||||||
}
|
}
|
||||||
}, "add new pivot"),
|
}, "add new pivot"),
|
||||||
...N.Step(Pivot.Root, "Pivot").map(pivot=>h(ElPivot, {pivot}))
|
pivots.map(pivot=>h(ElPivot, {pivot}))
|
||||||
])
|
])
|
||||||
};
|
};
|
||||||
let Render = () => render(h(ElRoot), document.querySelector("#app"));
|
let Render = () => render(h(ElRoot), document.querySelector("#app"));
|
||||||
|
Loading…
Reference in New Issue
Block a user