filters cleanup
This commit is contained in:
parent
fffd9a062d
commit
e228f20943
59
index.html
59
index.html
@ -144,12 +144,20 @@ let ElemTopic = props =>
|
|||||||
|
|
||||||
let ElemTree = ({tree}) =>
|
let ElemTree = ({tree}) =>
|
||||||
{
|
{
|
||||||
let activeItems = tree.Active.map( a=>h("button", {key:a.ID, onClick:e=>App.Update.Select(a, tree)}, a.Display) )
|
let activeItems = tree.Active.map( a=>{
|
||||||
|
return h("button", {disabled:a.Parent?false:true, key:a.ID, onClick:e=>App.Update.Select(a, tree)}, a.Display )
|
||||||
|
})
|
||||||
return h("div", {},
|
return h("div", {},
|
||||||
[
|
[
|
||||||
h("h3", {key:"title"}, tree.Display),
|
h("h3", {key:"title"}, tree.Display),
|
||||||
h("div", {key:"list"}, activeItems),
|
h("div", {key:"filters-active"}, [
|
||||||
h(ElemTreeNode, {key:"tree", node:tree.Root, tree:tree}),
|
h("strong", {key:"label"}, "Showing:"),
|
||||||
|
h("span", {key:"list"}, activeItems)
|
||||||
|
]),
|
||||||
|
h("div", {key:"filters-browse"}, [
|
||||||
|
h("strong", {key:"label"}, "Available:"),
|
||||||
|
h(ElemTreeNode, {key:"tree", node:tree.Root, tree:tree})
|
||||||
|
])
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
let ElemTreeNode = ({node, tree}) =>
|
let ElemTreeNode = ({node, tree}) =>
|
||||||
@ -170,14 +178,16 @@ let ElemTreeNode = ({node, tree}) =>
|
|||||||
attributes = {onClick:e=>{ e.stopPropagation(); App.Update.Interact(node); }};
|
attributes = {onClick:e=>{ e.stopPropagation(); App.Update.Interact(node); }};
|
||||||
parts.unshift(h("span", null, node.Open?"-":"+"));
|
parts.unshift(h("span", null, node.Open?"-":"+"));
|
||||||
}
|
}
|
||||||
if(inButton)
|
|
||||||
{
|
|
||||||
parts.push(
|
parts.push(
|
||||||
h("button",
|
h("button",
|
||||||
{ onClick:e=>{ e.stopPropagation(); App.Update.Select(node, tree); } },
|
{
|
||||||
|
disabled: (!inButton&&node.Active) ? true : false,
|
||||||
|
onClick:e=>{ e.stopPropagation(); App.Update.Select(node, tree); }
|
||||||
|
},
|
||||||
node.Active?"remove":"add")
|
node.Active?"remove":"add")
|
||||||
);
|
);
|
||||||
}
|
|
||||||
return h("div", attributes, parts);
|
return h("div", attributes, parts);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -427,30 +437,33 @@ var App = {
|
|||||||
let index = _.indexOf(inTree.Active, c);
|
let index = _.indexOf(inTree.Active, c);
|
||||||
inTree.Active.splice( index, 1 );
|
inTree.Active.splice( index, 1 );
|
||||||
c.Active = false;
|
c.Active = false;
|
||||||
|
};
|
||||||
|
let add = a =>
|
||||||
|
{
|
||||||
|
a.Active = true;
|
||||||
|
inTree.Active.push(a);
|
||||||
|
};
|
||||||
|
let itr = n=>
|
||||||
|
{
|
||||||
|
if(n.Active)
|
||||||
|
{
|
||||||
|
clear(n);
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
if(inNode.Active)
|
if(inNode.Active)
|
||||||
{
|
{
|
||||||
clear(inNode);
|
clear(inNode);
|
||||||
|
if(inTree.Active.length == 0)
|
||||||
|
{
|
||||||
|
add(inTree.Root);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Node.IterateUp(inNode, n=>
|
Node.IterateUp(inNode, itr);
|
||||||
{
|
Node.IterateDown(inNode, itr);
|
||||||
if(n.Active)
|
add(inNode);
|
||||||
{
|
|
||||||
clear(n);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
Node.IterateDown(inNode, n=>
|
|
||||||
{
|
|
||||||
if(n.Active)
|
|
||||||
{
|
|
||||||
clear(n);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
inNode.Active = true;
|
|
||||||
inTree.Active.push(inNode);
|
|
||||||
}
|
}
|
||||||
App.Render();
|
App.Render();
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user