tweaking...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2019-07-01 04:47:31 +03:00
parent 2028adef0e
commit 3634d40252
2 changed files with 52 additions and 14 deletions

View File

@ -181,6 +181,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.items.DisplayFocusedPath, //browser.items.DisplayFocusedPath,
//null,
function(make){ function(make){
make(['list', 'of', 'text']) make(['list', 'of', 'text'])
make.group( make.group(
@ -253,7 +254,15 @@ requirejs([
}, },
//browser.items.DisplayItemInfo, //browser.items.DisplayItemInfo,
//browser.items.makeDisplayItem('Simple message...'),
//browser.items.makeDisplayConfirm(null,
// function(){ console.log('OK') },
// function(){ console.log('Cancel') }),
{ {
headerButtons: [
['c', 'collapse: "*"'],
['e', 'expand: "*"'],
],
itemButtons: [ itemButtons: [
['&ndash;', ['&ndash;',
'buttonAction: item button focused -- example button action...'], 'buttonAction: item button focused -- example button action...'],
@ -263,6 +272,12 @@ requirejs([
'ToggleCollapse', 'ToggleCollapse',
'ToggleDisabled', 'ToggleDisabled',
], ],
/*
footerButtons: [
['save'],
['cancel'],
],
//*/
}) })
dialog.container = $('.container').first()[0] dialog.container = $('.container').first()[0]

View File

@ -277,6 +277,26 @@ Items.EditablePinnedList = function(values){}
// NOTE: when re-using these options.id needs to be set so as not to // NOTE: when re-using these options.id needs to be set so as not to
// overwrite existing instances data and handlers... // overwrite existing instances data and handlers...
// Make item generator...
//
Items.makeDisplayItem = function(text, options){
var args = [...arguments]
return function(make, options){
make(...args) } }
// Make confirm item generator...
//
// XXX see how this relates to Item.Confirm(..)
Items.makeDisplayConfirm = function(message, accept, reject){
return this.makeDisplayItem(message, {
buttons: [
...[reject instanceof Function ?
['Cancel', reject]
: []],
...[accept instanceof Function ?
['OK', accept]
: []], ], }) }
// Focused item path... // Focused item path...
// //
// XXX add search/filter field... // XXX add search/filter field...
@ -294,10 +314,8 @@ Items.DisplayFocusedPath = function(make, options){
// indicator... // indicator...
var e = make('CURRENT_PATH', { var e = make('CURRENT_PATH', {
id: tag, id: tag,
cls: 'path', cls: 'path',
buttons: options.headerButtons })
|| (dialog.options || {}).headerButtons
|| [], })
.last() .last()
// event handlers... // event handlers...
dialog dialog
@ -333,9 +351,7 @@ Items.DisplayItemInfo = function(make, options){
var e = make('INFO', { var e = make('INFO', {
id: tag, id: tag,
cls: 'info', cls: 'info',
buttons: options.footerButtons })
|| (dialog.options || {}).footerButtons
|| [], })
.last() .last()
// event handlers... // event handlers...
dialog dialog
@ -1388,6 +1404,7 @@ var BaseBrowserPrototype = {
if(value instanceof BaseBrowser){ if(value instanceof BaseBrowser){
var item = value var item = value
item.parent = this item.parent = this
item.section = section
// normal item... // normal item...
} else { } else {
@ -1436,7 +1453,10 @@ var BaseBrowserPrototype = {
// item template... // item template...
(options.itemTemplate || {})[opts.value] || {}, (options.itemTemplate || {})[opts.value] || {},
opts, opts,
{ parent: this }) {
parent: this,
section,
})
// XXX do we need both this and the above ref??? // XXX do we need both this and the above ref???
item.children instanceof BaseBrowser item.children instanceof BaseBrowser
@ -3656,8 +3676,7 @@ var updateElemClass = function(action, cls, handler){
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
var HTMLBrowserClassPrototype = { var HTMLBrowserClassPrototype = {
__proto__: BaseBrowser, __proto__: BaseBrowser, }
}
// XXX render of nested lists does not affect the parent list(s)... // XXX render of nested lists does not affect the parent list(s)...
// ...need to render lists and items both as a whole or independently... // ...need to render lists and items both as a whole or independently...
@ -3803,9 +3822,6 @@ var HTMLBrowserPrototype = {
// ] // ]
// //
headerButtons: [ headerButtons: [
// XXX TEST...
['c', 'collapse: "*"'],
['e', 'expand: "*"'],
], ],
itemButtons: [ itemButtons: [
], ],
@ -4267,6 +4283,7 @@ var HTMLBrowserPrototype = {
if(options.hidden && !options.renderHidden){ if(options.hidden && !options.renderHidden){
return null return null
} }
var section = item.section || options.section
// helpers... // helpers...
// XXX we need to more carefully test the value to avoid name clashes... // XXX we need to more carefully test the value to avoid name clashes...
@ -4410,7 +4427,13 @@ var HTMLBrowserPrototype = {
// buttons... // buttons...
var button_keys = {} var button_keys = {}
// XXX migrate button inheritance... // XXX migrate button inheritance...
var buttons = (item.buttons || options.itemButtons || []) var buttons = (item.buttons
|| (section == 'header'
&& (options.headerButtons || []))
|| (section == 'footer'
&& (options.footerButtons || []))
|| options.itemButtons
|| [])
// resolve buttons from library... // resolve buttons from library...
.map(function(button){ .map(function(button){
return button instanceof Array ? return button instanceof Array ?