some refactoring...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2019-06-29 20:11:15 +03:00
parent 944243ea4b
commit af73385a87
2 changed files with 51 additions and 35 deletions

View File

@ -172,7 +172,7 @@ requirejs([
// XXX split this into several dialogues, show each and then combine...
dialog = browser.Browser(
browser.Browser.PATH_HEADER,
browser.Browser.PATH_DISPLAY,
function(make){
make(['list', 'of', 'text'])
make.group(
@ -242,7 +242,7 @@ requirejs([
return make(i) }))
},
browser.Browser.INFO_FOOTER,
browser.Browser.INFO_DISPLAY,
{
itemButtons: [
['&ndash;',

View File

@ -3423,39 +3423,54 @@ var updateElemClass = function(action, cls, handler){
var HTMLBrowserClassPrototype = {
__proto__: BaseBrowser,
// XXX move this into the browser2.js
// -> .options.defaultHeader
// -> Browser.PATH_HEADER
// Headers...
//
// Item path...
// XXX add search/filter field...
// XXX add
PATH_HEADER: function(make, options){
make('CURRENT_PATH', {
id: 'header_current_path',
// XXX add path navigation...
PATH_DISPLAY: function(make, options){
// indicator...
var e = make('CURRENT_PATH', {
id: 'item_path_display',
cls: 'path',
buttons: (options || {}).headerButtons
|| (this.options || {}).headerButtons
|| [], })
this.focus(function(){
var e = this.get({id: 'header_current_path'}, {section: 'header'})
.last()
// event handlers...
this
.off('*', 'item_path_display')
.on('focus',
function(){
e.value = this.pathArray
this.renderItem(e) }) },
this.renderItem(e) },
'item_path_display') },
// Footers...
//
// Item info...
// XXX use focused element...
// XXX add on mouse over...
INFO_FOOTER: function(make, options){
make('INFO', {
id: 'footer_info',
INFO_DISPLAY: function(make, options){
// indicator...
var e = make('INFO', {
id: 'item_info_display',
cls: 'info',
buttons: (options || {}).footerButtons
|| (this.options || {}).footerButtons
|| [], })
this.focus(function(){
.last()
// event handlers...
this
.off('*', 'item_info_display')
.on('focus',
function(){
var focused = this.focused
var e = this.get({id: 'footer_info'}, {section: 'footer'})
e.value = focused.info
|| focused.alt
|| '&nbsp;'
this.renderItem(e) })
},
this.renderItem(e) },
'item_info_display') },
}
// XXX render of nested lists does not affect the parent list(s)...
@ -3470,8 +3485,9 @@ var HTMLBrowserPrototype = {
options: {
__proto__: BaseBrowser.prototype.options,
// XXX not used...
defaultHeader: 'PATH_HEADER',
// XXX not used yet...
//defaultHeader: 'PATH_DISPLAY',
//defaultFooter: 'INFO_DISPLAY',
// for more docs see:
// https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView