Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
});
var activatedFiles = new MapFilter({
source: activatedFilesSlots,
ruleEvents: 'targetChanged',
map: function(slot){
return slot.target;
}
});
var fileByType = new Split({
source: AppFile.files,
rule: 'data.type'
});
var Item = Node.subclass({
selected: Value.query(AppFile.matched, 'dataset').compute(function(node, dataset){
return (node.dataset || node.delegate) === dataset;
}),
template: resource('./template/type.tmpl'),
binding: {
type: function(node){
return node.caption || node.data.id;
},
count: function(node){
return count(node.dataset || node.delegate);
}
},
action: {
select: function(){
AppFile.matched.setDataset(this.dataset || this.delegate);
}
select: function(){
AppFile.matched.setDataset(this.dataset || this.delegate);
}
}
function coord(name){
return function(node){
return node[name] && node[name].toFixed(2);
};
}
var GraphNode = Node.subclass({
matched: false,
template: resource('./template/node.tmpl'),
binding: {
x: coord('x'),
y: coord('y'),
type: 'data:',
hasSelected: Value.query('parentNode.selection.itemCount').as(Boolean),
matched: Value.query(File.matched, 'dataset')
.pipe('itemsChanged', function(dataset){
return basis.array((dataset || File.all).getItems());
})
.compute(function(node, matched){
return matched.indexOf(node.target) !== -1;
})
},
action: {
hover: function(){
fileInfoPopup.setDelegate(this);
},
unhover: function(){
fileInfoPopup.setDelegate();
}
},