# j-Properties

> Składnik wykorzystuje składniki j-DatePicker, j-TimePicker, j-Directory, j-Emoji, j-ColorPicker i j-FaIcons.

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

Składnik wykorzystuje składniki `j-DatePicker`, `j-TimePicker`, `j-Directory`, `j-Emoji`, `j-ColorPicker` i `j-FaIcons`.

__Konfiguracja__:

- `dateformat` {String} format daty (default: `yyyy-MM-dd`)
- `timeformat` {String} format czasu (default: `HH:mm`)
- `datetimeformat` {String} format daty/czasu (default: `yyyy-MM-dd HH:mm`)
- `height` {Liczba} wysokość elementu (default: `undefined`)
- `parent` {String} jQuery selektor dla automatycznego ustawienia wysokości (może być `window`, `parent` lub `custom`)
- `margin` {Liczba} marginesy pionowe (default: `0`)
- `change` {String} trasa do metody `method(item, replace_text(new_text))` (wykonane, jeśli niektóre wartości są zmienione) i argument `replace_text` jest opcjonalny
- `scrollbar` {Boolean} umożliwia skręcanie (default: `true`)
- `visibleY` {Boolean} wyświetla pasek skręcania (default: `true`)

__Deklaracja danych__:

```javascript
var form = [];
form.push({ group: 'Personal', label: 'First name', name: 'user.firstname', type: 'string', value: 'Peter', transform: 'capitalize' });
form.push({ group: 'Personal', label: 'Last name', name: 'user.lastname', type: 'string', value: 'Širka', placeholder: 'String' });
form.push({ group: 'Personal', label: 'Age', name: 'user.age', type: 'number', value: 33, min: 30 });
form.push({ group: 'Personal', label: 'Birth date', name: 'user.birth', type: 'date', value: NOW });
form.push({ group: 'Additional', label: 'Newsletter', name: 'user.newsletter', type: 'bool', value: true });
form.push({ group: 'Additional', label: 'City', name: 'user.city', type: 'list', value: 2, items: 'items', dirsearch: 'Search city', dircustom: true });
form.push({ group: 'Additional', label: 'Color', name: 'user.color', type: 'color', value: '#e73323' });
form.push({ group: 'Additional', label: 'Icon', name: 'user.icon', type: 'fontawesome', value: 'ti ti-home' });
form.push({ group: 'Additional', label: 'Emoji', name: 'user.emoji', type: 'emoji', value: '', show: 'n => n.age === 33' });
```

__Właściwości danych w deklaracji danych__:
- `name` {String} identyfikator elementu (wymagany)
- `label` {String} etykietę (wymagane)
- `group` {String} nazwa grupy (wymagane)
- `type` {String} jeden typ (wymagany)
- `placeholder` {String} jeden posiadacz miejsca (tylko niewielu typów wspiera)
- `transform` {String} dla typu `string` tylko, może zawierać `capitalize`, `uppercase`, `lowercase` lub `slug`
- `maxlength` {Liczba} dla typu `string` tylko
- `validate` {RegExp/String} dla typu `string` tylko, może zawierać `email`, `phone` lub `url`
- `min` {Liczba} dla typu `number` tylko
- `max` {Liczba} dla typu `number` tylko
- `inc` {Number/String} zwiększa wartość według wartości, do której `number` lub `date` (może zawierać `1 day` lub `-1 day`Typ tylko
- `required` {Boolean} dla typu `string`, `number` lub `date`
- `dirsearch` {String/Boolean} miejsce dla typu `list` tylko, boolean nie może wyszukać
- `dircustom` {Boolean} umożliwia przydzieloną wartość tylko dla typu `list`
- `dirkey` {String} nazwa kluczowa dla etykiety/nazwa, ukierunkowana tylko na typ `list` (default: `name`)
- `dirvalue` {String} nazwa kluczowa dla wartości, przeznaczona tylko dla typu `list` (default: `id`)
- Adres URL `detail` {String} do uzyskania danych dla typu `list`, na przykład: `/users/{0}/` i `{0}` zostaną zastąpione wartością z listy
- elementy `items` {Object Array/String} dla typu `list` tylko, pasek może zawierać ścieżkę do `Array` lub `URL address` do wyszukiwania
- `show` {Arrow function}, przykład: `data => data.KEY === 'SOMETHING'` --> pokaże element, jeśli warunek będzie ważny

__Dozwolone typy w danych__:

- `string`
- `bool`
- `number`
- `date`
- `list`
- `color`
- `emoji`
- `fontawesome`

__Zaginione typy__:

- `datetime`
- `time`
- `file`
- `months`

### Trwałe mody

```html
<ui-component name="properties" path="form" config="parent:window">
	<script type="text/html">
		[
			{ group: 'Personal', label: 'First name', name: 'firstname', type: 'string', transform: 'capitalize' },
			{ group: 'Personal', label: 'Last name', name: 'lastname', type: 'string', placeholder: 'String' },
			...
			...
			...
			{ group: 'Additional', label: 'Emoji', name: 'emoji', type: 'emoji', show: 'n => n.age === 33' }
		]
	</script>
</ui-component>

<script>
	var form = { firstname: 'John', lastname: 'Connor' };
</script>
```

### Dobrze wiedzieć

Składnik rozszerza Array poprzez dodanie:

- Pole `invalid` {Boolean} określa, czy `value` jest nieważny (default: `undefined`)
- Pole `changed` {Boolean} określa, czy `value` został zmieniony (default: `undefined`)
- `prev` {???} zawiera wartość początkową

Użyj go z `<ui-component name="properties">`Gdy element nie jest jeszcze ładowany, jComponent Pobierz go po pierwszym użyciu z adresu `DEF.fallback` (Wydaje się Componentator Autor: Peter Širka Źródło: Componentator Zestaw składników, licencja MIT.

```html example.html
<ui-component name="LAZY directory"></ui-component>
<ui-component name="LAZY colorpicker"></ui-component>
<ui-component name="LAZY faicons"></ui-component>
<ui-component name="LAZY datepicker"></ui-component>
<ui-component name="LAZY timepicker"></ui-component>
<ui-component name="LAZY emoji"></ui-component>

<div style="width:400px;float:right">
	<ui-component name="properties" path="form" config="parent:window"></ui-component>
</div>

<script>
	var items = [{ id: 2, name: 'Banská Bystrica' }, { id: 3, name: 'Bratislava' }];
	var form = [];
	form.push({ group: 'Personal', label: 'First name', name: 'firstname', type: 'string', value: 'Peter', transform: 'capitalize' });
	form.push({ group: 'Personal', label: 'Last name', name: 'lastname', type: 'string', value: 'Širka', placeholder: 'String' });
	form.push({ group: 'Personal', label: 'Age', name: 'age', type: 'number', value: 33, min: 30 });
	form.push({ group: 'Personal', label: 'Birth date', name: 'birth', type: 'date', value: NOW });
	form.push({ group: 'Additional', label: 'Newsletter', name: 'newsletter', type: 'bool', value: true });
	form.push({ group: 'Additional', label: 'City', name: 'city', type: 'list', value: 2, items: 'items', dirsearch: 'Search city', dircustom: true });
	form.push({ group: 'Additional', label: 'Color', name: 'color', type: 'color', value: '#e73323' });
	form.push({ group: 'Additional', label: 'Icon', name: 'icon', type: 'fontawesome', value: 'ti ti-home' });
	form.push({ group: 'Additional', label: 'Emoji', name: 'emoji', type: 'emoji', value: '', show: 'n => n.age === 33' });
</script>
```
