Web Component: j-Flow
j-Flow
- jComponent
v19|v20 - identifiers can't contain
__char
Configuration:
width{Number}a width of Flow designer, default:6000height{Number}a height of Flow designer, default:6000grid{Number}a size of background grid, default:25paddingX{Number}internal padding, default:6curvedlines{Boolean}enables curved lines, default:falseinfopath{String}a path to variable/method, response:{ zoom: Number, selected: Object }undopath{String}a path to variable/method, response is Object arrayredopath{String}a path to variable/method, response is Object arrayondrop{String}a path to methodfn(dropmeta, grid)onmake{String}a path to methodfn(el, com), it's executed when the component is creatingondone{String}a path to methodfn(el, com), it's executed when the component is createdonmove{String}a path to methodfn(el, com/group, type), it's executed when the component/group is movingonremove{String}a path to methodfn(el, com), it's executed when the component is removedonconnect{String}a path to methodfn(meta), it's executed when the two components are connectedondisconnect{String}a path to methodfn(meta), it's executed when the two components are disconnected- NEW
onpause{String}a path to methodfn(path, is), it's executed when the output/input is paused steplines{Boolean}enables step lines (default:false)animationradius{Number}animation radius in pixels (default:5)contextmenu{String}a path tofunction(e, type, component/meta)(type can bemap,component,connection,group)dblclick{String}a path tofunction(component)outputoffsetX{Number}a default X offset for output point (default:10)outputoffsetY{Number}a default Y offset for output point (default:12)inputoffsetX{Number}a default X offset for input point (default:10)inputoffsetY{Number}a default Y offset for input point (default:12)snapping{Number}snapping in pixels (default:0= disabled)multiple{Boolean}enables multiple selecting of the component (default:true)history{Number}a count of steps in the undo/redo history (default:100)animationlimit{Number}a maximum count of dots for all animations (default:100)animationlimitconnection{Number}a maximum count of dots per connection (default:5)allowpause{Boolean}allows pausing on outputs/inputs (default:true)markers{Boolean}adds arrow markers to the connection (default:true)
Commands:
flow.refreshrecalculates positionsflow.selected.disconnectdisconnects selected connectionflow.selected.removeremoves selected componentflow.selected.clearremoves selected component or connectionflow.zoomperforms zoom, argument:type(can be:in,out,resetorpercentage{Number}), second optional argument:percentageflow.undoperforms undo stepflow.redoperforms redo stepflow.resetresets editorflow.components.addadds a new component, argument:component_declarationflow.components.findfinds a component, argument:component_idflow.cleancleans data and non-exist connectionsflow.traffic(componentid__outputid,{ count: 3, speed: 3, limit: 20, delay: 50, reverse: false })loads animationreverseanimation can be enabled by adding_as a starting char of identifier_componentid__outputid
- NEW
flow.groups.findfinds a group, argument:group_id - NEW
flow.checka new faster alternative to theflow.refreshcommand - NEW
flow.findfinds a component or group, argument:component_idorgroup_id
Adding a new component:
- the component automatically creates ID of component
connectionsis{Object}
// Component declaration
var component = {
x: 100,
y: 50,
html: 'Component test',
outputs: ['1 output name', '2 output name'],
// or
// outputs: [{ id: 'A', name: 'A output name' }, { id: 'B', name: 'B output name', color: '#FF8E37' }],
connections: { '0': [{ id: '0002', index: '2', disabled: false }] }, // Look to the connection object below
// or
// connections: { 'A': [{ id: '0002', index: 'B', disabled: false }] },
actions: { select: true, move: true, disabled: false, remove: true, connect: true }
};
// Appends component
CMD('flow.components.add', component);
// Connection object
// connections: { '0': [CONNECTION_OBJECT1, CONNECTION_OBJECT2, CONNECTION_OBJECT3] }
{
id: 'TARGET_ID_COMPONENT',
index: '0', // An input index or index id, must be string!!!
disabled: false // Optional, it's the connection disabled? Disabled connection can't be removed
}
Flow output:
- returns
Objectwhich keys areIDof components
{
'F1562743923216': { x: 1, y: 1, connections: [], ... },
'F1562743965303': { x: 1, y: 1, connections: [], ... },
// Contains paused endpoints
paused: { 'input__COMPONENTID__INDEXID': 1, 'output__COMPONENTID__INDEXID': 1 },
// Contains groups
groups: [{ id: 'GroupID', name: 'Name', x: 100, y: 100, width: 100, height: 100, background: 'rgba(0,0,0,0.1)', color: '#000', border: 'rgba(0,0,0,0.1)' }, ...];
}
Good to know:
- each component (in the Flow) contains
f-COMPONENTNAMEclass selectableclass in the component element enables copying text and disables movingconnectionssupportstype:"transform"with dashed line
Author
- Peter Širka petersirka@gmail.com
- License
Created
10. july 2019
Updated
05. march 2025
jComponent library
19 | 20
Version
v1
License
https://www.totaljs.com/license/
Dark mode
Yes
Responsive
Yes
Author
Peter Širka
Email
petersirka@gmail.com

