j-UIBuilder
Tento komponent vykresľuje aplikáciu navrhnutú cez UI Builder. Aplikáciu môžete načítať cez path špecifikovanú v komponente alebo cez možnosť config.url. Cesta môže obsahovať adresu URL k schéme aplikácie JSON alebo objektu aplikácie (analyzovaný JSON).
Konfigurácia:
app {String}odkaz na metódu/premennú, kde bude uložená inštanciaappurl {String}odkaz na schému aplikácie (musí byť vo formátejson)css {Boolean}použije štýl aplikácie na aktuálny prvok (predvolené:true)id {String}prepíše ID aplikácie
Metódy:
component.load(data)metóda načítaappdo aktuálneho prvku
Vlastnosti:
component.appobsahuje inštanciuapp
Ako narábať s údajmi?
<ui-component name="uibuilder" ... config="app:myapphandler"></ui-component>
<script>
function myapphandler(app) {
// app.component {jComponent}
// app.schema {Object} uibuilder compiled design
// app.schema.inputs {Array Objects}
// app.schema.outputs {Array Objects}
// How to capture data?
app.on('output', function(meta) {
// meta.id {String} output identifier
// meta.data {Object} raw data from the builder
// meta.app {Object} app instance
// meta.instance {Object} which instance sent data?
// meta.instanceid {String} an instance identifier
// meta.component {Object} which component sent data?
// meta.componentid {String} a component identifier
// meta.err {String} optional, error handler (nullable)
// meta.output {String} an output name
// meta.note {String} optional, a note
// meta.ref {String} an internal reference
AJAX('POST /yourapi/', meta.data, function(response) {
// What next?
});
});
// How to inject data?
// Example
app.on('ready', function() {
// First, you must know input identifier
app.input('cidlm5caacg_load', { email: '@' }, console.log);
});
}
</script>Použite ho so <ui-component name="uibuilder">. Keď komponent ešte nie je načítaný, jComponent ho stiahne pri prvom použití z adresy v DEF.fallback (predvolene CDN Componentator). Autor: Peter Širka. Zdroj: úložisko komponentov Componentator, licencia MIT.
<ui-component name="uibuilder" config="url:https://cdn.componentator.com/uibuilder/demo/render/dashboard.json"></ui-component>