ForgeKomponensek
hu

Komponensek

j-Dashboard

jComponent 20 · jcomponent@20 component Példa betöltve a jComponent 20-szal
  • Mobil eszközök támogatása
  • Támogatja a érintést
  • Mozgás
  • Sárkány
  • visszavonható

Az összetevő a Array objektumokat várja.

konfiguráció:

  • axisX {Number}: X-sávú hálózat mérete (default: 12)
  • axisY {Number} a Y-sávok hálózati mérete (default: 144)
  • padding {Number} a widgetek között (default: 10)
  • delay {Number} Init késés (default: 200)
  • serviceinterval {Number} egy szolgáltatási intervallum (default: 5000)
  • ondrop {String} egy út a módszer function(meta) {}, akkor fut, ha valaki dob egy elemet a területen
    • meta.x X hálózati pozíció
    • meta.y és hálózati pozíció
    • meta.el elemek
    • meta.pageX
    • meta.pageY
    • meta.offsetX
    • meta.offsetY
    • meta.target
    • meta.d A megjelenítés módja xs, sm, md vagy lg
  • A noemitresize megakadályozza a resize módszer teljesítését az összes nemes komponensben (default: false)
  • parent {String} - A minimális magasságot meghatározó szülőtartály (default: null)
  • margin {Number} egy felső/alatti margin a parent opció (előzetes: 0)
  • minsizexs {Number} minimális oszlop/cseppméret extra kis kijelzőkhez (előzetes: 2)
  • minsizesm {Number} minimális oszlop/csepp méret kis kijelzőkhez (default: 2)
  • minsizemd {Number} a mediun kijelzők minimális oszlop/cseppmérete (default: 1)
  • minsizelg {Number} - A nagy kijelzők minimális oszlop/cseppmérete (default: 1)
  • iconsettings {String} beállítások ikon
  • iconremove {String} eltávolítása ikon
  • change {String} a function(type, id) módszerhez vezető út (amelyet akkor hajt végre, ha a lemez move vagy remove változást kap)
  • animation {Number} animációs stílus:
    • 1 átláthatóság
    • 2 Nagy méretű a normális
    • 3 Kis méretű a normális (default)
    • 4 forgatás
    • 5 X pozíció megváltoztatása
    • 6 pozíció megváltoztatása
  • grid {Boolean} renders háttérhálózat (default: false)
  • NEW: reanimate {Boolean} lehetővé teszi az animációt a változó widgetekhez (default: false)
// 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);

módszerek:

  • A SETTER('dashboard/send', id, body) adatokat küld minden olyan widgetnek, amely tartalmazza a data delegátust
    • id {String}
      • A null minden összetevőhöz küldik
      • A @component a komponens nevének megfelelően küldi az egyes összetevőket
      • A string egy adott komponensre küldi az azonosító szerint
  • A SETTER('dashboard/call', method_name, [a], [b], [c], [d]) egy módszert futtat minden widgetben
  • A RETURN('dashboard/pixel') a pixel mérete (kvárta)
  • A RETURN('dashboard/display') visszatér az aktuális kijelző szélességéhez

Jó tudni:

  • Az összetevő osztályokat ad a testhez:
    • A d_colNUMBER meghatározza az elvégzett oszlopok számát, például a d_col2
    • A d_rowNUMBER meghatározza az elvégzett sorok számát, például a d_row3
    • d_square A komponens ugyanaz a szélessége / magassága
    • d_vertical a komponens csak 1 lépés széles és több mint 1 lépcső magasság
    • d_horizontal a komponens csak 1 lépés magasság és több mint 1 lépcső szélesség

Használja a <ui-component name="dashboard">Amennyiben a készülék még nem tölthető le, jComponent letöltés az első felhasználásra a címről DEF.fallback (Azt a Componentator A szerző: Peter Širka. forrás: a Componentator Az összetevők raktár, MIT licenc.

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>