# j-Dashboard

> Il componente si aspetta una serie di oggetti.

Framework: jcomponent20
Product: jComponent 20 (jcomponent@20)
Language: it
Content-SHA256: cac706e66f2cb9849118be53373b75a54a1e55256175da6ee3b86d90d80d157b
Snapshot: c0700e321579725c5cf4f5ace1ad7d2866d1b4f93c24a63c0b41b6b7998e976c
Sources: components@910ed1a86f6e72b4f031d3ad0dc7844f9fc5cb8e
Review: not-recorded

- Supporto per dispositivi mobili
- Sostenere il tocco
- Movimento
- Draghiamo
- Rifiutato

Il componente si aspetta `Array` di oggetti.

__Configurazione__:

- `axisX {Number}` di una griglia di assi X (default: `12`)
- `axisY {Number}`: una dimensione della rete dell'asse Y (default: `144`)
- `padding {Number}` un pacchetto tra i widget (default: `10`)
- `delay {Number}` Il ritorno (default) `200`)
- `serviceinterval {Number}` un intervallo di servizio (default: `5000`)
- `ondrop {String}` è un percorso per il metodo `function(meta) {}`, viene eseguito se qualcuno mette un elemento nella zona
	- Posizione di rete `meta.x` X
	- `meta.y` e posizione di rete
	- `meta.el` Elementi di taglio
	- `meta.pageX`
	- `meta.pageY`
	- `meta.offsetX`
	- `meta.offsetY`
	- `meta.target`
	- `meta.d` Una mostra di moda `xs`, `sm`, `md` o `lg`
- `noemitresize` disabilita l'esecuzione del metodo `resize` in tutti i componenti nestati (default: `false`)
- `parent {String}` un contenitore parentale che stabilisce una altezza minima (default: `null`)
- `margin {Number}` una margina superiore/bottom per l'opzione `parent` (default: `0`)
- `minsizexs {Number}`: dimensioni minime di colonna/roga per schermi extra piccoli (default: `2`)
- `minsizesm {Number}`: dimensioni minime di colonna/roga per schermi piccoli (default: `2`)
- `minsizemd {Number}`: dimensioni minime di colonna/roga per i display mediun (default: `1`)
- `minsizelg {Number}`: dimensioni minime di colonna/roga per schermi grandi (default: `1`)
- Icone di `iconsettings {String}`
- `iconremove {String}` Rimuovere l'icona
- `change {String}` un percorso al metodo `function(type, id)` (eseguito se il dashboard capisce un cambiamento `move` o `remove`)
- Stile di animazione `animation {Number}`:
	- `1` di opacità
	- `2` Scala da grande a normale
	- `3` Scala da piccola a normale (__default__)
	- Rotazione di `4`
	- `5` cambiamento di posizione X
	- `6` cambiamento di posizione Y
- Render di sfondo `grid {Boolean}` (default: `false`)
- __NEW__: `reanimate {Boolean}` consente l'animazione per cambiare widget (default: `false`)

```js
// Component declaration
var component = {

	// Component ID
	id: 'COMPONENT_ID',

	// Positioning
	// You can define specific display size and if the display size is not specified then the component tries to find a size for larger display
	offset: {
		xs: { x: 1, y: 1, width: 6, height: 6 }, // Number means the position in the grid, so e.g. width "2" takes "2" columns in X axis
		lg: { x: 1, y: 1, width: 6, height: 6 }
	},

	html: 'THE CONTENT OF COMPONENT', // or can be raw HTMLElement

	// Default settings
	actions: { move: true, remove: true, resize: true, resizeX: true, resizeY: true, resizeP: false, settings: true },
	// resizeP means: resize "proportionally"

	// Can disable header (default: true)
	header: true,

	// Can delay displaying (in "ms", default: config.delay)
	delay: 0,

	// A component title
	title: 'Title for the component',

	// Custom properties which will be assigned to the instance
	template: Object,
	config: Object,
	// reset: true, // NEW: reloads the component again
	// class: String // adds a class to the item

	make: function(exports, config, el) {

		// @exports {Object}
		// @config {Object}
		// @el {jQuery} a content of the component

		// Handlers (optional):
		exports.destroy = function() {
			// @el {jQuery} a content of the component
			// @this {Instance}

			// is executed when the component is destroyed
		};

		exports.data = function(data, el) {
			// @data {Object}
			// @this {Instance}
			// @el {jQuery} a content element of the component
			// It can be executed via SETTER('dashboard/send', ....)
		};

		exports.service = function(counter, el) {
			// @counter {Number} count of calls
			// @el {jQuery} a content of the component
			// @this {Instance}
			// dashboard will execute this handler each 5 seconds
		};

		exports.focus = function() {
			// Optional, when the "window" is focused the delegate will be executed
		};

		exports.resize = function(width, height, el, display) {
			// @width {Number}
			// @height {Number}
			// @el {jQuery} a content of the component
			// @display {String} a current display size "xs", "sm", "md" or "lg"
			// @this {Instance}
			// is executed when the component is resized
			// @this {Instance}
		};

		exports.settings = function(config, el, elbtn) {
			// @config {Object}
			// @el {jQuery} a content element of the component
			// @elbtn {jQuery} button element
			// is executed when the users clicks on the settings icon
		};

		exports.remove = function(remove) {
			// remove {Function} removes that widget
			remove();
		};

		exports.configure = function() {
			// is executed when the configuration is changed
		};

		// this.meta {Object} a reference to component object
		// this.element {jQuery} a content element of the component
		// this.container {jQuery} a main content element of the component
		// this.main {Object} a reference to Dashboard component
		// this.width {Number} a width of "this.element"
		// this.height {Number} a height of "this.element"
		// this.display {String} a current display size "xs", "sm", "md" or "lg"

		// is executed when the component is making
	}
};

PUSH('components', component);
```

__Metodi__:

- `SETTER('dashboard/send', id, body)` invia i dati a tutti i widget che contengono il delegato `data`
	- `id {String}`
		- `null` per tutti i componenti
		- `@component` viene inviato ai componenti specifici secondo il nome del componente
		- `string` viene inviato a un componente specifico secondo l'identificatore
- `SETTER('dashboard/call', method_name, [a], [b], [c], [d])` esegue un metodo in ogni widget
- `RETURN('dashboard/pixel')` restituisce una dimensione del pixel (quarto)
- `RETURN('dashboard/display')` ritorna una larghezza di display corrente

__Buono sapere__:

- Il componente aggiunge classi al corpo del componente:
	- `d_colNUMBER` determina il numero di colonne prese, ad esempio `d_col2`
	- `d_rowNUMBER` determina il numero di righe prese, ad esempio `d_row3`
	- `d_square` il componente ha la stessa larghezza/altezza
	- `d_vertical` il componente ha solo 1 passo di larghezza e più di 1 passo d'altezza
	- `d_horizontal` il componente ha solo 1 passo di altezza e più di 1 step di larghezza

Utilizzare con `<ui-component name="dashboard">`Quando il componente non è ancora caricato, jComponent Scarica il codice in prima utilizzazione dall'indirizzo `DEF.fallback` (Il Componentator La storia di Peter Širka.Fonte: il Componentator Ristorante dei componenti, licenza MIT.

```html example.html
<ui-component name="dashboard" path="components"></ui-component>
<script>

	var components = [];

	components.push({
		id: 'A',
		offset: { lg: { x: 0, y: 0, width: 4, height: 4 }},
		title: 'A',
		html: '<div class="padding">Lorem ipsum dolor sit amet.</div>',
		actions: { settings: true, remove: true, move: true, resize: true },
		make: function(exports, config, el) {

			// If you change some action "exports.actions" then execute:
			// exports.refresh();

			exports.data = function(data) {

			};

			exports.configure = function() {

			};

		}
	});

	components.push({
		id: 'B',
		offset: { lg: { x: 4, y: 0, width: 4, height: 4 }},
		title: 'B',
		html: '<div class="padding">Lorem ipsum dolor sit amet.</div>',
		actions: { settings: true, remove: true, move: true, resize: true }
	});
</script>
```
