elem -> topology only...
+ (from_path
+ && i < from
+ // only for nested...
+ && elem && elem.children
+ // only sub-path...
+ && path.cmp(from_path.slice(0, path.length))) ?
+ [ renderer.renderNestedBlank(nested(), i, context) ]
+ // out of range -> skip...
+ : ((from != null && i < from)
+ || (to != null && i >= to)) ?
+ []
+ // inline...
+ : elem == null ?
+ // NOTE: here we are forcing rendering of the
+ // inline browser/list, i.e. ignoring
+ // options.skipNested for inline stuff...
+ [ renderer.renderGroup(nested(true), context) ]
+ // nested...
+ : elem.children ?
+ [ renderer.renderNested(
+ renderer.renderNestedHeader(elem, i, context),
+ nested(),
+ elem,
+ context) ]
+ // normal elem...
+ : [ renderer.renderItem(elem, i, context) ] ) },
+ 'render',
+ function(_, i, p, options, context){
+ return [options, renderer, context] },
+ options, context)
+
+ // finalize depending on render mode...
+ return (!options.nonFinalized && context.root === this) ?
+ // root context -> render list and return this...
+ renderer.renderFinalize(null, items, null, context)
+ // nested context -> return item list...
+ : items } },
// Events...
@@ -3381,6 +3415,25 @@ var updateElemClass = function(action, cls, handler){
var HTMLBrowserClassPrototype = {
__proto__: BaseBrowser,
+
+ // XXX move this into the browser2.js
+ // -> .options.defaultHeader
+ // -> Browser.PATH_HEADER
+ // XXX add search/filter field...
+ // XXX add
+ PATH_HEADER: function(make, options){
+ make('CURRENT_PATH', {
+ id: 'current_path',
+ cls: 'path',
+ buttons: (options || {}).headerButtons
+ || (this.options || {}).headerButtons
+ || [],
+ })
+ this.focus(function(){
+ var e = this.get({id: 'current_path'}, {section: 'header'})
+ e.value = this.pathArray
+ this.renderItem(e) })
+ },
}
// XXX render of nested lists does not affect the parent list(s)...
@@ -3395,6 +3448,9 @@ var HTMLBrowserPrototype = {
options: {
__proto__: BaseBrowser.prototype.options,
+ // XXX not used...
+ defaultHeader: 'PATH_HEADER',
+
// for more docs see:
// https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView
//
@@ -3730,9 +3786,9 @@ var HTMLBrowserPrototype = {
//
// or same as .renderList(..)
//
- renderFinalize: function(items, context){
+ renderFinalize: function(header, items, footer, context){
var that = this
- var d = this.renderList(items, context)
+ var d = this.renderList(header, items, footer, context)
var options = context.options || this.options || {}
// wrap the list (nested list) of nodes in a div...
@@ -3789,9 +3845,12 @@ var HTMLBrowserPrototype = {
//
// ...
//
+ //
+ //
+ // ...
//
//
- renderList: function(items, context){
+ renderList: function(header, items, footer, context){
var that = this
var options = context.options || this.options || {}
@@ -3804,8 +3863,9 @@ var HTMLBrowserPrototype = {
function(evt){ evt.stopPropagation() })
// header...
- options.hideListHeader
- || dialog.appendChild(this.renderListHeader(context))
+ header
+ && !options.hideListHeader
+ && dialog.appendChild(this.renderListHeader(header, context))
// list...
var list = document.createElement('div')
@@ -3820,30 +3880,35 @@ var HTMLBrowserPrototype = {
: item) })
dialog.appendChild(list)
+ // footer...
+ footer
+ && !options.hideListFooter
+ && dialog.appendChild(this.renderListFooter(footer, context))
+
return dialog
},
//
// Foramt:
//
- //
dir
- // ...
- //
dir
+ //
+ //
//
//
// XXX populate this...
// XXX make this an item???
- renderListHeader: function(context){
- var header = document.createElement('div')
- header.classList.add('path', 'v-block')
-
- // XXX path/search...
- var dir = document.createElement('div')
- dir.classList.add('dir', 'cur')
- dir.setAttribute('tabindex', '0')
- header.appendChild(dir)
-
- return header
- },
+ renderListHeader: function(items, context){
+ var elem = this.renderList(null, items, null, context).firstChild
+ // XXX should we replace 'list' or add 'header'
+ elem.classList.add('header')
+ return elem },
+ renderListFooter: function(items, context){
+ var elem = this.renderList(null, items, null, context).firstChild
+ // XXX should we replace 'list' or add 'footer'
+ elem.classList.add('footer')
+ return elem },
//
// Format:
//
@@ -4377,6 +4442,18 @@ var HTMLBrowserPrototype = {
// Filtering/search mode...
// XXX
+
+ /*/ XXX this should only work on root...
+ __init__: function(func, options){
+ var args = [...arguments]
+ options = args[args.length-1] instanceof Function ?
+ {}
+ : args[args.length-1]
+ ;(args[1] instanceof Function)
+ && this.constructor[options.defaultHeader]
+ && args.unshift(this.constructor[options.defaultHeader])
+ return object.parent(HTMLBrowserPrototype.__init__, this).call(this, ...args) },
+ //*/
}
@@ -4416,7 +4493,7 @@ var TextBrowserPrototype = {
// NOTE: we do not need .renderGroup(..) here as a group is not
// visible in text...
- renderList: function(items, options){
+ renderList: function(header, items, footer, options){
var that = this
return this.renderNested(null, items, null, null, options)
.join('\n') },