ForgeComponente
ro

Componente

j-Flow

jComponent 20 · jcomponent@20 component Exemplu încărcat cu jComponent 20
  • Identificatorii nu pot conține __

Configurarea:

  • width {Number} o lățime a proiectantului de flux, standard: 6000
  • height {Number} o înălțime a proiectantului de flux, standard: 6000
  • grid {Number} o dimensiune a rețelei de fundal, standard: 25
  • paddingX {Number} Padding intern, standard: 6
  • curvedlines {Boolean} permite liniile curvate, standard: false
  • infopath {String} o cale spre variabil/metodă, răspuns: { zoom: Number, selected: Object }
  • undopath {String} este o cale spre variabilă/metodă, răspunsul este aria obiectului
  • redopath {String} este o cale spre variabilă/metodă, răspunsul este aria obiectului
  • ondrop {String} este o cale spre metoda fn(dropmeta, grid)
  • onmake {String} este o cale spre metoda fn(el, com), se execută atunci când componenta este creată
  • ondone {String} este o cale spre metoda fn(el, com), se execută atunci când componenta este creată
  • onmove {String} este o cale spre metoda fn(el, com/group, type), se execută atunci când componenta/grupul se mișcă
  • onremove {String} este o cale spre metoda fn(el, com), se execută atunci când componenta este îndepărtată
  • onconnect {String} este o cale spre metoda fn(meta), se execută atunci când cele două componente sunt conectate
  • ondisconnect {String} este o cale spre metoda fn(meta), se execută atunci când cele două componente sunt dezconectate
  • NEW onpause {String} o cale către metoda fn(path, is), este executată atunci când ieșirea / intrarea este întreruptă
  • steplines {Boolean} permite liniile de pas (default: false)
  • Radiul de animație animationradius {Number} în pixeli (default: 5)
  • contextmenu {String} o cale la function(e, type, component/meta) (tipul poate fi map, component, connection, group)
  • dblclick {String} - un drum spre function(component)
  • outputoffsetX {Number} este un defect X pentru punctul de ieșire (default: 10)
  • outputoffsetY {Number} un offset standard Y pentru punctul de ieșire (default: 12)
  • inputoffsetX {Number} este un defect X pentru punctul de intrare (default: 10)
  • inputoffsetY {Number} este un offset standard Y pentru punctul de intrare (default: 12)
  • snapping {Number} în pixeli (default: 0 = dezactivat)
  • multiple {Boolean} permite selectarea multiplă a componentei (default: true)
  • history {Number} este un număr de pași în istoria undo/redo (default: 100)
  • animationlimit {Number} - numărul maxim de puncte pentru toate animațiile (default: 100)
  • animationlimitconnection {Number} - un număr maxim de puncte pe conexiune (default: 5)
  • allowpause {Boolean} permite pauzele pe ieșiri / intrări (default: true)
  • markers {Boolean} adaugă marcatori de stradă la conexiune (default: true)

comandă:

  • flow.refresh recalculă pozițiile
  • flow.selected.disconnect dezconectează conexiunea selectată
  • flow.selected.remove îndepărtează componentul selectat
  • flow.selected.clear îndepărtează componenta sau conexiunea selectată
  • flow.zoom Se face zoom, argumentul: type (Pentru a fi : in, out, reset sau percentage {Number}Al doilea argument opțional: percentage
  • flow.undo se desfășoară
  • flow.redo este o etapă de pregătire
  • flow.reset editare
  • flow.components.add adaugă un nou component, argument: component_declaration
  • flow.components.find găsește un component, argument: component_id
  • flow.clean curăță datele și conexiunile neexistente
  • flow.traffic(componentid__outputid, { count: 3, speed: 3, limit: 20, delay: 50, reverse: false }) încărcătura animație
    • Animația reverse poate fi activată prin adăugarea _ ca un șarpe de plecare a identificatorului _componentid__outputid.
  • NEW flow.groups.find găsește un grup, argument: group_id
  • NEW flow.check este o nouă alternativă mai rapidă la comanda flow.refresh
  • NEW flow.find găsește o componentă sau grup, argument: component_id sau group_id

Adăugarea unui nou component:

  • Componentul creează automat ID-ul componentei
  • connections este {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
}

Fluxul de ieșire:

  • returnează Object care sunt cheile ID ale componentelor
{
	'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)' }, ...];
}

bine să știi:

  • Fiecare componentă (în flux) conține clasa f-COMPONENTNAME
  • Clasa selectable în elementul component permite copierea textului și interzice mișcarea
  • connections susține type:"transform" cu linie

Utilizați-l cu <ui-component name="flow">Când componenta nu este încă încărcată, jComponent Descărcați-l la prima utilizare de la adresa DEF.fallback (în cazul Componentator Autor: Peter Širka. sursă: Componentator Componente de stocare, MIT licență.

example.html
<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>