# j-Dockable

> Dockovatelná složka očekává řadu objektů.

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

- Práce pouze s `+v18`
- Podporuje dotyk
- pohyblivý
- Odstranitelné


__Konfigurace__:

- `style {Number}` `1` spodní panel bude plná šířka, `2` spodní panely budou mezi levým a pravým panelem
- `parent {String}` Výběr jquery v důsledku výšky kontejneru (default: `window`)
- `margin {Number}` a spodní marže (předvolené: `0`)
- __NEW__ `reoffsetresize {Boolean}` Všechny plovoucí panely budou opětovně vypnuty v souladu s rozměrem okna `main` (předvolené: `false`)

Komponenta `dockable` očekává `Array` objektů.

```javascript
// Component declaration
var panel = {

	// Component ID
	id: 'PANEL_ID',

	// Positioning
	// You can define specific display size and if the display size is not specified then the window tries to find a size for larger display
	html: 'THE CONTENT OF PANEL', // or can be raw HTMLElement

	offset: { x: 200, y: 100, width: 600, height: 400, minwidth: 200, minheight: 200, maxwidth: 1000, maxheight: 1000, dockminwidth: 200, dockminheight: 200, dockmaxwidth: 400, dockmaxheight: 400 }, // minwidth, maxwidth, maxheight, minheight, dockminheight, dockminwidth, dockmaxheight, dockmaxwidth are optional

	// Default settings
	actions: { move: true, close: true, hide: true, resize: true, autosave: false, resizeX: true, resizeY: true },
	// GOOD TO KNOW:
	// "undefined" close or "close:false" and "hide:true" doesn't destroy the instance of panel (it will be hidden only)

	// A window title
	title: 'Title for the panel',

	// Handlers (optional):
	destroy: function() {
		// @el {jQuery} a content of the window
		// @this {Instance}

		// is executed when the window is destroyed
	},

	make: function(el) {

		// @el {jQuery} a content of the window
		// @this {Instance}

		// this.meta {Object} a reference to window object
		// this.element {jQuery} a content element of the window
		// this.container {jQuery} a main content element of the window
		// this.main {Object} a reference to "Windows" component
		// this.width {Number} a width of window
		// this.height {Number} a height of the content of the window
		// this.x {Number} offset X
		// this.y {Number} offset Y

		// Methods:
		// this.setsize(width, height);
		// this.setcommand(cmd); Allowed commands: "close", "maximize", "resetmaximize", "togglemaximize", "minimize", "resetminimize", "toggleminimize", "resize", "move", "focus"
		// this.setoffset(x, y);

		// is executed when the window is making
	},

	data: function(type, data, el) {

		// @type {String}
		// @data {Object}
		// @el {jQuery} a content element of the window
		// @this {Instance}

		// is executed when data are sent via SETTER('windows', 'send', 'TYPE', 'DATA')
	},

	resize: function(width, height, el, x, y) {

		// @width {Number}
		// @height {Number}
		// @el {jQuery} a content of the window
		// @this {Instance}

		// is executed when the window is resized
	},

	move: function(x, y, el) {

		// @x {Number}
		// @y {Number}
		// @el {jQuery} a content of the window
		// @this {Instance}

		// is executed when the window is moved
	},

	service: function(counter, el) {

		// @counter {Number} count of calls
		// @el {jQuery} a content of the window
		// @this {Instance}

		// the component will execute this handler each 5 seconds
	}
};

PUSH('panels', panel);
```

__Metody__:

- `component.finditem(panel_id)` nalezne konkrétní panel podle `ID`
- __NEW__ `component.show(panel_id)` zobrazuje panel
- __NEW__ `component.hide(panel_id)` ukrývá panel
- __NEW__ `component.toggle(panel_id)` přichází do panelu

Použijte ji s `<ui-component name="dockable">`Pokud je součástka ještě nezačleněna, jComponent Stáhnout ji na první použití z adresy `DEF.fallback` a) The Componentator CDN dle předvolby. autor: Peter Širka. zdroj: Componentator Výrobce je autorizován, MIT licence.

```html example.html
<style>
	body{padding:0;margin:0;overflow:hidden;}
</style>

<ui-component name="dockable" path="mypanels">

	<div class="padding">
		YOUR CONTENT
	</div>

</ui-component>

<script>

	var mypanels = [];

	mypanels.push({
		id: 'A',
		offset: { x: 200, y: 100, width: 250, height: 400, minwidth: 200, minheight: 200, docked: 'left' },
		title: 'Components',
		html: '<div class="padding">Lorem ipsum dolor sit amet.</div>',
		actions: { move: true, resize: true, close: false, dockable: 'left right bottom' }
	});

	mypanels.push({
		id: 'B',
		offset: { x: 600, y: 300, width: 250, height: 400, minwidth: 200, minheight: 200, docked: 'right' },
		title: 'Properties',
		html: '<div class="padding">Lorem ipsum dolor sit amet.</div>',
		actions: { move: true, resize: true, close: true, dockable: 'left right bottom' }
	});

	mypanels.push({
		id: 'C',
		offset: { x: 600, y: 300, width: 300, height: 200, minwidth: 200, minheight: 200, docked: 'bottom' },
		title: 'Console',
		html: '<div class="padding">Lorem ipsum dolor sit amet.</div>',
		actions: { move: true, resize: true, close: true, dockable: 'right bottom' }
	});

</script>
```
