tweaking and fixing...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2019-09-09 23:07:50 +03:00
parent 08d781cde0
commit eec609c763

View File

@ -526,9 +526,16 @@ var BaseItemPrototype = {
r.indexOf(this) r.indexOf(this)
: undefined }, : undefined },
update: function(){
// XXX BUG: this does not work for nested header elements...
// to reproduce:
// dialog
// .get({children: true})
// .update()
// ...for some reason the affected element is removed from dom...
update: function(options){
this.parent this.parent
&& this.parent.render(this) && this.parent.render(this, options)
return this return this
}, },
@ -3182,24 +3189,26 @@ var BaseBrowserPrototype = {
__renderer__: TextRenderer, __renderer__: TextRenderer,
// XXX need: // XXX need:
// - section rendering... (DONE)
// - from/to/around/count support... // - from/to/around/count support...
// - ability to render separate items/sub-trees or lists of items... // - ability to render separate items/sub-trees or lists of items...
// ...pass the list to .walk(..), i.e. .walk(list/query, ...) // ...pass the list to .walk(..), i.e. .walk(list/query, ...)
// - buggy -- dialog.render(dialog.get({children: true})) broken...
// - need query support...
// XXX revise options handling... // XXX revise options handling...
// XXX doc... // XXX doc...
render: function(options, renderer){ render: function(options, renderer){
var that = this var that = this
// XXX args parsing... // args parsing...
// XXX // XXX
var args = [...arguments] var args = [...arguments]
// item list...
// XXX add support for item queries... // XXX add support for item queries...
var list = (args[0] instanceof BaseItem || args[0] instanceof Array) ? var list = (args[0] instanceof BaseItem || args[0] instanceof Array) ?
[args.shift()].flat() [args.shift()].flat()
: null : null
// item filter...
var filter var filter
// NOTE: these only apply to the 'items' section... // NOTE: these only apply to the 'items' section...
@ -3210,6 +3219,8 @@ var BaseBrowserPrototype = {
args.pop() args.pop()
: 0 : 0
var [options, renderer] = args
// XXX revise... // XXX revise...
options = Object.assign( options = Object.assign(
Object.create(this.options || {}), Object.create(this.options || {}),
@ -3244,7 +3255,7 @@ var BaseBrowserPrototype = {
// used as a means to calculate lengths of nested blocks rendered // used as a means to calculate lengths of nested blocks rendered
// via .render(..) // via .render(..)
var l var l
return ((render.root === this && section instanceof Array) ? return ((list == null && render.root === this && section instanceof Array) ?
// render list of sections... // render list of sections...
// //
// NOTE: we will only render the section list on the top // NOTE: we will only render the section list on the top
@ -3345,6 +3356,7 @@ var BaseBrowserPrototype = {
render.finalize(this instanceof Array ? render.finalize(this instanceof Array ?
{[section]: this} {[section]: this}
: this, options) : this, options)
// XXX should we call render.finalize(..) for list???
: this }) }, : this }) },
@ -4530,18 +4542,21 @@ module.HTMLRenderer = {
// XXX should this be optional??? // XXX should this be optional???
button_keys[k].click() } }) button_keys[k].click() } })
item.dom = elem /*/ XXX for some reason this messes up navigation...
// XXX for some reason this messes up navigation...
// to reproduce: // to reproduce:
// - select element with children // - select element with children
// - press right // - press right
// -> blur current elem // -> blur current elem
// -> next elem not selected... // -> next elem not selected...
//item.elem = elem item.elem = elem
/*/
item.dom = elem
//*/
return elem return elem
}, },
//
// Format: // Format:
// <div class="group"> // <div class="group">
// <!-- elements --> // <!-- elements -->
@ -4558,6 +4573,7 @@ module.HTMLRenderer = {
e.appendChild(item) }) e.appendChild(item) })
return e }, return e },
//
// Format: // Format:
// <div class="list"> // <div class="list">
// <!-- header element --> // <!-- header element -->