# j-Properties2

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

Framework: jcomponent20
Product: jComponent 20 (jcomponent@20)
Language: pl
Content-SHA256: 12b36eac5df1249878129ae835502e6969643fc905f8e3bf2ad3da796d10ac9d
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-Icons`.


__Konfiguracja__:

- `dateformat {String}` w formacie daty (default: `yyyy-MM-dd`)
- `timeformat {String}` w formacie czasu (default: `HH:mm`)
- `datetimeformat {String}` w formacie daty/czasu (default: `yyyy-MM-dd HH:mm`)
- `change {String}` jest drogą do metody `method(item, replace_text(new_text))` (wykonane, jeśli niektóre wartości są zmienione) i argument `replace_text` jest opcjonalny
- Wzmacniacz `modalalign {String}` dla okien modalnych (default: `center`)
- `style {Number}` obsługuje nowy styl `2` podobnie jak ustawienia `iOS` (default: `1`)
- `validation {Boolean}` umożliwia weryfikację wymaganych pól (default: `true`)
- `defaultgroup {String}` - domyślna nazwa grupy (default: `Default`)

__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)
- `note {String}` mała notatka pod kontrolą
- `type {String}` typu (wymagane)
- `placeholder {String}` jeden posiadacz (tylko niewielu typów wspiera)
- `transform {String}` dla typu `string` może zawierać tylko `capitalize`, `uppercase`, `lowercase` lub `slug`
- `maxlength {Number}` dla typu `string` tylko
- `validate {RegExp/String}` tylko dla typu `string`, może zawierać `email`, `phone` lub `url`
- `min {Number}` dla typu `number` tylko
- `max {Number}` dla typu `number` tylko
- `inc {Number/String}` wzrost wartości według wartości, której celem jest `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 zaburza wyszukiwania
- `dircustom {Boolean}` umożliwia przydzieloną wartość tylko dla typu `list`
- `dirkey {String}` jest nazwą kluczową dla etykiety/nazwa, przeznaczona tylko dla typu `list` (default: `name`)
- `dirvalue {String}` to nazwa kluczowa dla wartości, przeznaczona tylko dla typu `list` (default: `id`)
- Adres URL `detail {String}` do uzyskania danych dla typu `list`, przykład: `/users/{0}/` i `{0}` zostaną zastąpione wartością z listy
- Elementy `items {Object Array/String}` dla typu `list` mogą zawierać ścieżkę do `Array` lub `URL address` do wyszukiwania
- `show {Arrow function}`, przykład: `data => data.KEY === 'SOMETHING'` --> pokaże, czy warunek będzie ważny
- Ikonę `icon {String}` Total, może zawierać kolor np. `ti ti-home #00000`
- `ricon {String}` Ikony prawego czcionka lub tekst np. `!HTML text`
- `riconclick {String}` Droga do metody `function(item, set(new_val))`
- `camouflage {Boolean}` tylko dla typu `string`
- `monospace {Boolean}` używa monopolu

__Dozwolone typy w danych__:

- `string`
- `bool`
- `number`
- `date`
- `list`
- `color`
- `emoji`
- `fontawesome`
- `exec` (można wykonać metodę `exec`)
- `text` (wartość odczytu)
- `menu` (jest podobny do listy, ale składnik będzie wykonywać `j-Menu`)

__Zaginione typy__:

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

### 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="properties2">`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>
<ui-component name="LAZY menu"></ui-component>

<div style="width:600px;padding:20px;background-color:#F0F0F0">

	<ui-component name="properties2" path="form" class="m"></ui-component>
	<ui-component name="properties2" path="form2" config="style:2" class="m"></ui-component>

	<!-- PERSISTENT MODE -->
	<ui-component name="properties2" path="form3" config="style:2">
		<script type="text/plain">
			[
				{ group: 'Personal', name: 'First name', id: 'firstname', type: 'string',transform: 'capitalize', note: 'Type your name' },
				{ group: 'Personal', name: 'Last name', id: 'lastname', type: 'string', placeholder: 'String' },
				{ group: 'Personal', name: 'Token', id: 'token', type: 'string', placeholder: 'String', camouflage: true }
			]
		</script>
	</ui-component>

</div>

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

	var form2 = [];
	form2.push({ group: 'Personal', name: 'First name', id: 'firstname', type: 'string', value: 'Peter', transform: 'capitalize', note: 'Type your name' });
	form2.push({ group: 'Personal', name: 'Last name', id: 'lastname', type: 'string', value: 'Širka', placeholder: 'String' });
	form2.push({ group: 'Personal', name: 'Age', id: 'age', type: 'number', value: 33, min: 30 });
	form2.push({ group: 'Personal', name: 'Birth date', id: 'birth', type: 'date', value: NOW });
	form2.push({ group: 'Additional', name: 'Newsletter', id: 'newsletter', type: 'bool', value: true });
	form2.push({ group: 'Additional', name: 'City', id: 'city', type: 'list', value: 2, items: 'items', dirsearch: 'Search city', dircustom: true });
	form2.push({ group: 'Additional', name: 'Color', id: 'color', type: 'color', value: '#e73323' });
	form2.push({ group: 'Additional', name: 'Icon', id: 'icon', type: 'fontawesome', value: 'ti ti-home' });
	form2.push({ group: 'Additional', name: 'Emoji', id: 'emoji', type: 'emoji', value: '', show: 'n => n.age === 33' });
	form2.push({ group: 'Additional', name: 'Exec', exec: 'myexec', type: 'exec', value: 'Some text to exec' });
	form2.push({ group: 'Additional', name: 'Readonly', id: 'something', type: 'text', value: 'Readonly value', icon: 'ti ti-home #000' });

	var form3 = {};
	form3.firstname = 'Peter';
	form3.lastname = 'Širka';
	form3.token = GUID(30);

	function myexec(item, el) {
		console.log(item, el);
	}

</script>
```
