j-Flow
- Os identificadores não podem conter
__
Configuração:
width {Number}uma largura de Flow designer, padrão:6000height {Number}uma altura de Flow designer, padrão:6000grid {Number}um tamanho da rede de fundo, padrão:25- Padrão interno
paddingX {Number}, padrão:6 curvedlines {Boolean}permite linhas curvas, padrão:falseinfopath {String}um caminho para variável/metodo, resposta:{ zoom: Number, selected: Object }undopath {String}um caminho para variável/metodo, a resposta é Objet Arrayredopath {String}um caminho para variável/metodo, a resposta é Objet Arrayondrop {String}um caminho para o métodofn(dropmeta, grid)onmake {String}um caminho para o métodofn(el, com), é executado quando o componente é criadoondone {String}um caminho para o métodofn(el, com), é executado quando o componente é criadoonmove {String}um caminho para o métodofn(el, com/group, type), é executado quando o componente/grupo está em movimentoonremove {String}um caminho para o métodofn(el, com), é executado quando o componente é removidoonconnect {String}um caminho para o métodofn(meta), é executado quando os dois componentes são conectadosondisconnect {String}um caminho para o métodofn(meta), é executado quando os dois componentes são desconectados- NEW
onpause {String}um caminho para o métodofn(path, is), ele é executado quando a saída / entrada é interrompida steplines {Boolean}permite linhas de passo (default:false)- Rádio de animação
animationradius {Number}em pixels (default:5) contextmenu {String}um caminho parafunction(e, type, component/meta)(o tipo pode sermap,component,connection,group)dblclick {String}um caminho parafunction(component)outputoffsetX {Number}uma despensa X padrão para o ponto de saída (default:10)outputoffsetY {Number}uma despensa Y padrão para o ponto de saída (default:12)inputoffsetX {Number}um desempenho X padrão para o ponto de entrada (default:10)inputoffsetY {Number}uma despensa Y padrão para o ponto de entrada (default:12)snapping {Number}em pixels (default:0= desativado)multiple {Boolean}permite a seleção múltipla do componente (default:true)history {Number}um número de passos na história de undo/redo (default:100)animationlimit {Number}- Número máximo de pontos para todas as animações (default:100)animationlimitconnection {Number}- Número máximo de pontos por conexão (default:5)allowpause {Boolean}permite a pausa nas saídas / entradas (default:true)markers {Boolean}adiciona marcadores de fogo à conexão (default:true)
Comando:
flow.refreshrecalculam as posiçõesflow.selected.disconnectDesconecta a conexão selecionadaflow.selected.removeremove o componente selecionadoflow.selected.clearremove o componente selecionado ou a conexãoflow.zoomExercício do zoom, argumento:type(O que pode ser:in,out,resetoupercentage {Number}2) O segundo argumento opcional:percentageflow.undofaz um passoflow.redofaz o passoflow.reseté um editorflow.components.addadiciona um novo componente, argumento:component_declarationflow.components.findencontra um componente, argumento:component_idflow.cleanlimpa dados e conexões não existentesflow.traffic(componentid__outputid, { count: 3, speed: 3, limit: 20, delay: 50, reverse: false })carrega animação- A animação
reversepode ser ativada adicionando o_como um carrinho de início do identificador_componentid__outputid.
- A animação
- NEW
flow.groups.findencontra um grupo, argumento:group_id - NEW
flow.checkuma nova alternativa mais rápida ao comandoflow.refresh - NEW
flow.findencontra um componente ou grupo, argumento:component_idougroup_id
Adicionar um novo componente:
- O componente cria automaticamente o ID do componente
connectionsÉ{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
}Fluxo de saída:
- Retornar
Objectque chaves sãoIDde componentes
{
'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)' }, ...];
}Bom para saber:
- Cada componente (no fluxo) contém uma classe de
f-COMPONENTNAME - A classe
selectableno elemento componente permite copiar texto e desabilitar o movimento connectionssuporta otype:"transform"com linha
Use-o com <ui-component name="flow">Quando o componente ainda não está carregado, jComponent Descarrega-o no primeiro uso do endereço DEF.fallback (a partir do Componentator CDN por padrão). autor: Peter Širka. fonte: o Componentator Reserva de componentes, licença MIT.
<style>
.toolbar { margin-bottom: 10px; }
.toolbar button { min-width: 26px; height: 24px; background-color: transparent; border: 0; font-size: 12px; color: gray; }
.toolbar button span { margin-left: 3px; }
.toolbar button[name="remove"] { color: red !important; }
.toolbar button:disabled { color: #C0C0C0 !important; cursor: not-allowed; }
.toolbar button:hover { color: black; }
.toolbar button:first-child { border-left: 0; }
</style>
<div class="toolbar">
<button is="is-button" path="floweditor.undo" config="enabled:value && value.length > 0;click:floweditor_undo" disabled="disabled"><i class="ti ti-undo"></i></button>
<button is="is-button" path="floweditor.redo" config="enabled:value && value.length > 0;click:floweditor_redo" disabled="disabled"><i class="ti ti-redo"></i></button>
<button is="is-button" path="floweditor.info.selected" config="enabled;click:floweditor_remove" name="remove" disabled="disabled"><i class="ti ti-trash"></i></button>
</div>
<ui-component name="flow" path="flowmodel" config="width:6000;height:6000;grid:26;infopath:floweditor.info;undopath:floweditor.undo;redopath:floweditor.redo"></ui-component>
<script>
var flowmodel = {
groups: [{ id: 'G12345', name: 'My group', x: 50, y: 50, width: 300, height: 300 }],
'F1562743923216': { x: 100, y: 150, html: 'Component 1', outputs: ['Done', 'Error'], connections: { '0': [{ id: 'F1562743965303', index: '2', disabled: false }] }},
'F1562743965303': { x: 500, y: 250, html: 'Component 2', inputs: ['1', '2', '3'] }
};
var floweditor = {};
function floweditor_undo() {
CMD('flow.undo');
}
function floweditor_redo() {
CMD('flow.redo');
}
function floweditor_remove() {
CMD('flow.selected.clear');
}
// Extend buttons for using Web components
customElements.define('is-button', class extends HTMLButtonElement {
constructor() {
super();
setTimeout(NEWUIBIND, 2, this);
}
}, { extends: 'button' });
</script>