j-Folder
Il componente può rendere un contenuto come il browser di file. path deve essere nel modulo per esempio Directory/Directory/File.
Configurazione:
up {String}un'etichetta per il pulsante Up (default:..)delimiter {String}un delimitore per la strada (default:/)root {String}un'etichetta per il primo elemento nel panno di pane (default:Root)scrollbar {Boolean}consente la barra di scorrimento personalizzata (default:true)scrollbarY {Boolean}mostra Y scrollbar sempre (default:false)delimiter {String}un delimitore per la strada (default:/)options {String}un percorso per il metodofunction(item, el)(l'utente deve fare clic sul pulsante destro)click {String}un percorso a variabile o metodofunction(item)(l'utente deve fare clic sull'articolo)checked {String}un percorso a variabile o metodofunction(checked_items, component)(l'utente deve controllare la scatola)browse {String}IMPORTANT: un percorso verso il metodofunction(path, next(ARRAY), [item])che deve restituire un contenuto per il componenteparent {String}opzionale, un contenitore con altezza fissa, può esserewindowValore di default:component.element()margin {Number}opzionale, una margina superiore/bottom insieme (default:0)drop {String}opzionale, un percorso verso il metodo che verrà eseguito se un file sarà tagliatokey {String}opzionale, un nome chiave per la creazione del percorso (default:name)raw {Boolean}opzionale, disabilita la codifica HTMLname(default:false)- NEW:
contextmenu {String}opzionale, un percorso per il metodofunction(item, el, e)(quando un utente mostra il menu di contesto)
function fn_browser(path, next, item) {
// @path {String} paths divided according to the "config.delimiter"
// @next {Function(Array)} importat: this function expects array with items
// @item {Object} can be null
var arr = [];
// Object for array:
// obj.name {String} a label/name
// obj.checkbox {Boolean} enables checkbox (default: false)
// obj.checked {Boolean} item will be checked
// obj.icon {String} a icon for item
// obj.type {Number} determines a type of item (1: directory, other: file)
// obj.classname {String} adds a CSS class onto "label" element
// Good to know:
// Only directories can be drilled
// Example:
arr.push({ name: 'Node.js', checkbox: true, type: 1, icon: 'folder' });
arr.push({ name: 'Client-Side', checkbox: true, type: 1, icon: 'folder' });
next(arr);
// next(array, noscroll);
}Utilizzare con <ui-component name="folder">Quando il componente non è ancora caricato, jComponent Scarica il codice in prima utilizzazione dall'indirizzo DEF.fallback (Il Componentator La storia di Peter Širka.Fonte: il Componentator Ristorante dei componenti, licenza MIT.
<div class="container">
<br />
<ui-component name="folder" path="currentpath" config="browse:fn_browse;checked:fn_checked;click:fn_click" style="height:500px"></ui-component>
<br />
</div>
<script>
var currentpath = 'Frameworks/Node.js';
function fn_browse(path, next, item) {
var arr = [];
switch (path) {
case 'Frameworks':
arr.push({ name: 'Node.js', checkbox: true, type: 1, icon: 'folder' });
arr.push({ name: 'Client-Side', checkbox: true, type: 1, icon: 'folder' });
break;
case 'Frameworks/Node.js':
arr.push({ name: 'Total.js', checkbox: true, checked: true, icon: 'file' });
arr.push({ name: 'Express.js', checkbox: true, icon: 'file' });
arr.push({ name: 'Koa.js', checkbox: true, icon: 'file' });
arr.push({ name: 'Meteor.js', checkbox: true, icon: 'file' });
break;
case 'Frameworks/Client-Side':
arr.push({ name: 'React', checkbox: true, icon: 'file' });
arr.push({ name: 'Vue', checkbox: true, icon: 'file' });
arr.push({ name: 'jComponent', checkbox: true, checked: true, icon: 'file' });
arr.push({ name: 'Angular.js', checkbox: true, icon: 'file' });
arr.push({ name: 'jQuery', checkbox: true, icon: 'file' });
break;
default:
arr.push({ name: 'Frameworks', checkbox: true, type: 1, icon: 'folder' });
arr.push({ name: 'Item 1', checkbox: true, icon: 'file' });
arr.push({ name: 'Item 2', checkbox: true, icon: 'file' });
arr.push({ name: 'Item 3', checkbox: true, icon: 'file' });
break;
}
next(arr);
}
function fn_click(item) {
console.log('click', item);
}
function fn_checked(arr) {
console.log('checked', arr);
}
</script>