From d976860a680f887dd3b58616c23a7dec5a71b488 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Mon, 23 Dec 2019 06:46:50 +0300 Subject: [PATCH 1/3] notes... Signed-off-by: Alex A. Naanou --- ui (gen4)/features/ui-widgets.js | 1 + 1 file changed, 1 insertion(+) diff --git a/ui (gen4)/features/ui-widgets.js b/ui (gen4)/features/ui-widgets.js index 4ce2c67d..807a85eb 100755 --- a/ui (gen4)/features/ui-widgets.js +++ b/ui (gen4)/features/ui-widgets.js @@ -1039,6 +1039,7 @@ browse.items.makeSubContext = function(name, obj){ // XXX Q: should title/value args be optional??? // ...and should we break the make(..) convention of passing an arg // array for multiple .text blocks, i.e. make([title, value], ...)?? +// XXX parse arguments... browse.items.makeSubContext('field', function(title, value, options){ options = options || {} From 6e4c8e18d582d07f7886e2a2907883a36cf9c9d4 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Mon, 23 Dec 2019 19:11:45 +0300 Subject: [PATCH 2/3] make.field(..) refining + docs... Signed-off-by: Alex A. Naanou --- ui (gen4)/features/ui-widgets.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/ui (gen4)/features/ui-widgets.js b/ui (gen4)/features/ui-widgets.js index 807a85eb..28d9c95d 100755 --- a/ui (gen4)/features/ui-widgets.js +++ b/ui (gen4)/features/ui-widgets.js @@ -1025,6 +1025,11 @@ browse.items.makeSubContext = function(name, obj){ // XXX EXPERIMENT... +// +// .field(title[, options]) +// .field(title, value[, options]) +// +// // XXX Q: should we add an ImageGrid context to make(..)??? // ...something like .app for making it generic-ish for example... // ....a different approach to this would be to create a list editor @@ -1039,10 +1044,16 @@ browse.items.makeSubContext = function(name, obj){ // XXX Q: should title/value args be optional??? // ...and should we break the make(..) convention of passing an arg // array for multiple .text blocks, i.e. make([title, value], ...)?? -// XXX parse arguments... browse.items.makeSubContext('field', function(title, value, options){ - options = options || {} + // parse arguments... + var args = [...arguments].slice(1) + value = (args[0] instanceof Function + || !(args[0] instanceof Object)) ? + args.shift() + : undefined + options = args.shift() || {} + value = value || options.value Object.assign( options, { From ca6253115ca5c3dae53aa1b6ea9c6c580da776cf Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Tue, 24 Dec 2019 19:39:33 +0300 Subject: [PATCH 3/3] cleanup and notes/docs... Signed-off-by: Alex A. Naanou --- ui (gen4)/features/ui-widgets.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/ui (gen4)/features/ui-widgets.js b/ui (gen4)/features/ui-widgets.js index 28d9c95d..56e83f82 100755 --- a/ui (gen4)/features/ui-widgets.js +++ b/ui (gen4)/features/ui-widgets.js @@ -1030,6 +1030,10 @@ browse.items.makeSubContext = function(name, obj){ // .field(title, value[, options]) // // +// NOTE: essentially make.field(..) is almost identical to make(..), the +// later is needed to provide context for field items and a transparent +// fallback for make(..) calls from within their context... +// // XXX Q: should we add an ImageGrid context to make(..)??? // ...something like .app for making it generic-ish for example... // ....a different approach to this would be to create a list editor @@ -1039,11 +1043,6 @@ browse.items.makeSubContext = function(name, obj){ // ...this can be problematic as the wrapper is external to the browser... // - as a sub-path... // ...this is hard without side-effects... -// XXX Q: do we actually need .field(..), it does everything make(..) -// does already??? -// XXX Q: should title/value args be optional??? -// ...and should we break the make(..) convention of passing an arg -// array for multiple .text blocks, i.e. make([title, value], ...)?? browse.items.makeSubContext('field', function(title, value, options){ // parse arguments...