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

View File

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