j-Detail
Ten element może przekazać wartości z modelu. obsługuje mapowanie w linii - zobacz kod źródłowy przykładu.
Konfiguracja:
dateformat {String}w formacie daty (default:DEF.dateformat)datetimeformat {String}w formacie daty/czasu (default:DEF.dateformat + ' ' + DEF.timeformat)numberformat {Number}- standardowy format liczby (default: empty)small {Boolean}umożliwia mniejsze projektowanie (default:false)- Styl składowy
style {Number}(default:1), wspiera styl2,3(minimalny) i4(nowoczesny) defaultgroup {String}- domyślna nazwa grupy (default:Default)notnull {Boolean}Wskaźnik wartości nullable (default):false)track {String}może zawierać ścieżki podzielone przez komę, ta nieruchomość będzie obserwować tylko zmiany w wyciągniętych kluczy
Deklaracja danych:
var model = { firstname: 'Peter', lastname: 'Širka', age: 33 };
var items = [{ id: 2, name: 'Banská Bystrica' }, { id: 3, name: 'Bratislava' }];
var form = [];
// The below values will be binded automatically from the "model" (according to the "path" field) because they contain "path" field
form.push({ group: 'Personal', label: 'First name', path: 'firstname', type: 'string', value: model, note: 'This is first name' });
form.push({ group: 'Personal', label: 'Last name', path: 'lastname', type: 'string', value: model, placeholder: 'String' });
form.push({ group: 'Personal', label: 'Age', path: 'age', type: 'number', value: model });
// The below values will be binded from "value" key
form.push({ group: 'Personal', label: 'Birth date', type: 'date', value: NOW });
form.push({ group: 'Additional', label: 'Newsletter', type: 'bool', value: true });
form.push({ group: 'Additional', label: 'City', type: 'list', value: 2, items: 'items' });
form.push({ group: 'Additional', label: 'Color', type: 'color', value: '#e73323' });
form.push({ group: 'Additional', label: 'Icon', type: 'fontawesome', value: 'fas fa-home' });Właściwości danych w deklaracji danych:
group {String}nazwa grupy (wymagane)label {String}etykietę (wymagane)type {String}typu (wymagane)note {String}- mała notka poniżej wartości- Numer
format {String}np.2lub format datydd.MM.yyyy - Adres URL
detail {String}do uzyskania danych dla typulist, przykład:/users/{0}/i{0}zostaną zastąpione wartością z listy - Elementy
items {Object Array/String}dla typulistmogą zawierać ścieżkę doArraylubURL addressdo wyszukiwania value {Object}wartość lub model z wartościami (wówczas wymagany jestpath)path {String}- droga do wartości w modelu (valuemusi zawierać model)template {String}A Tangular szablon (pracuje tylko ztype:'template'i{{ value }}zawiera wartość surową, a{{ item }}zawiera cały element)empty {String}Wartość pusta, gdy wartość jest zerowalna (default:---)show {String}Funkcja warunkowavalue.type === 'company'Wyjaśnij, czy oceniany stan jesttrue- NEW
autoformat {Boolean}umożliwia automatyczny format dlaemail, lubphones, i tylko dla typustring(default:false) - NEW
colorize {Boolean}koloruje wartość z wyjątkiem typówlist,coloriicon - NEW
plus {String}dodaje wartość do końca wartości renderowanej dla typównumberistring
Dozwolone typy w danych:
stringboolnumberdatedatetimelistcoloremojifontawesomepasswordtemplate
Dobrze wiedzieć:
- Jeśli grupa zawiera tylko jeden z nich, nazwa grupy nie zostanie przekazana.
Użyj go z <ui-component name="detail">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.
<div style="width:500px">
<ui-component name="detail" path="form"></ui-component>
<br />
<div>-- OR --</div>
<br />
<ui-component name="detail" path="model" config="style:2">
<script type="text/plain">
[
{ name: 'First name', path: 'firstname', type: 'string' },
{ name: 'Last name', path: 'lastname', type: 'string' },
{ name: 'Age', path: 'age', type: 'number' }
]
</script>
</ui-component>
<br />
<div>-- OR FILTERED --</div>
<br />
<ui-component name="detail" path="model" config="style:3">
<script type="text/plain">
[
// Will be displayed, look to show condition ("value" means "model")
{ name: 'First name', path: 'firstname', type: 'string', show: 'value.type==1' },
{ name: 'Last name', path: 'lastname', type: 'string', show: 'value.type==1' },
// Won't be displayed, look to show condition ("value" means "model")
{ name: 'Age', path: 'age', type: 'number', show: 'value.type==2' }
]
</script>
</ui-component>
<br />
<ui-component name="detail" path="model" config="style:4">
<script type="text/plain">
[
// Will be displayed, look to show condition ("value" means "model")
{ name: 'First name', path: 'firstname', type: 'string', show: 'value.type==1' },
{ name: 'Last name', path: 'lastname', type: 'string', show: 'value.type==1' },
// Won't be displayed, look to show condition ("value" means "model")
{ name: 'Age', path: 'age', type: 'number', show: 'value.type==2' }
]
</script>
</ui-component>
</div>
<script>
var model = { firstname: 'Peter', lastname: 'Širka', age: 33, type: 1 };
var items = [{ id: 2, name: 'Banská Bystrica' }, { id: 3, name: 'Bratislava' }];
var form = [];
// The below values will be binded automatically from the "model" (according to the "path" field) because they contain "path" field
form.push({ group: 'Personal', label: 'First name', path: 'firstname', type: 'string', value: model, note: 'This is first name' });
form.push({ group: 'Personal', label: 'Last name', path: 'lastname', type: 'string', value: model, placeholder: 'String' });
form.push({ group: 'Personal', label: 'Age', path: 'age', type: 'number', value: model });
// The below values will be binded from "value" key
form.push({ group: 'Personal', label: 'Birth date', type: 'date', value: NOW });
form.push({ group: 'Additional', label: 'Newsletter', type: 'bool', value: true });
form.push({ group: 'Additional', label: 'City', type: 'list', value: 2, items: 'items' });
form.push({ group: 'Additional', label: 'Color', type: 'color', value: '#e73323' });
form.push({ group: 'Additional', label: 'Icon', type: 'fontawesome', value: 'ti ti-home' });
</script>