Merge pull request 'propertly collect sum indicies' (#4) from schema-header into master

Reviewed-on: #4
This commit is contained in:
SethTrowbridge 2021-05-22 21:23:08 -04:00
commit 490019a27b

View File

@ -179,7 +179,9 @@ var Pivot =
{
for(let i=0; i<inColumnNames.length; i++)
{
N.Connect(Pivot.Schema, N.Create({Label:inColumnNames[i], Index:i}), inColumnTypes[i]);
let columnNode = N.Create({Label:inColumnNames[i], Index:i});
N.Connect(Pivot.Schema, columnNode, inColumnTypes[i]);
N.Connect(Pivot.Schema, columnNode, "all");
}
Pivot.Leaves = inRows.map(r => N.Create({Row:r}));
Pivot.Init = ()=>{};
@ -387,20 +389,21 @@ let ElForm = props =>
let used = N.Step(Pivot.Proto, "used")||[];
let unused = N.Step(Pivot.Schema, "label").filter( columnLabel => !N.Step(columnLabel, "used", false) );
let indicies = used.map(node=>node.Meta.Index);
let indiciesPivot = used.map(node=>node.Meta.Index);
let indiciesSum = (N.Step(Pivot.Schema, "sum")||[]).map(n=>n.Meta.Index);
var action;
if(indicies.length)
if(indiciesPivot.length)
{
action = h("div", null, [
h("span", null, "Build"),
h("button", {onClick:e=>
{
N.Disconnect(Pivot.Proto, null, "used");
Pivot.Create(indicies, [3, 4]);
Pivot.Create(indiciesPivot, indiciesSum);
Render();
}
}, indicies)
}, "Create Pivot")
]);
}
else