From 249fa17cef4a23d5ea932894ba563fa09cff30ea Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Sun, 22 Dec 2019 04:01:14 +0300 Subject: [PATCH] revisions and tweaks... Signed-off-by: Alex A. Naanou --- ui (gen4)/features/examples.js | 14 ++++++++++++-- ui (gen4)/features/ui-widgets.js | 16 ++++++++-------- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/ui (gen4)/features/examples.js b/ui (gen4)/features/examples.js index 89c99e4b..359b2ecf 100755 --- a/ui (gen4)/features/examples.js +++ b/ui (gen4)/features/examples.js @@ -941,9 +941,19 @@ var ExampleUIActions = actions.Actions({ // XXX need more testing... make.batch([ + '---', + [['X', 'Y']], + // XXX this does not show the correct value... + {title: 'foo', value: 123}, + {type: 'field.Toggle', title: 'Batch toggle: '}, + ]) + make.field.batch([ + // XXX this does not do the right thing... + '---', ['X', 'Y'], - {text: 'foo', value: 123}, - {type: 'field.Toggle', text: 'Batch toggle: '}, + // XXX this does not show the correct value... + {title: 'foo', value: 123}, + {type: 'Toggle', title: 'Batch toggle: '}, ]) }, { diff --git a/ui (gen4)/features/ui-widgets.js b/ui (gen4)/features/ui-widgets.js index 34cba6cc..4ce2c67d 100755 --- a/ui (gen4)/features/ui-widgets.js +++ b/ui (gen4)/features/ui-widgets.js @@ -980,6 +980,7 @@ module.Dialogs = core.ImageGridFeatures.Feature({ // XXX move this to browse.js/browse2.js??? // ...there seems to be no way to make this generic... // XXX think of a better name... (???) +// XXX should the client be able to override shorthands??? browse.items.makeSubContext = function(name, obj){ // arse args... var args = [...arguments].slice(1) @@ -998,10 +999,15 @@ browse.items.makeSubContext = function(name, obj){ func ? // NOTE: we always call func(..) in the root context... function(){ - return func.call(that, ...arguments) } + // XXX should the client be able to override shorthands??? + var shorthands = (that.dialog.options || {}).elementShorthand || {} + return arguments[0] in shorthands ? + that.call(that, ...arguments) + : func.call(that, ...arguments) } + //return func.call(that, ...arguments) } : this instanceof Function ? function(){ - return root.call(this, ...arguments) } + return that.call(this, ...arguments) } : {} nested.__proto__ = this @@ -1018,7 +1024,6 @@ browse.items.makeSubContext = function(name, obj){ return this[name] } - // XXX EXPERIMENT... // XXX Q: should we add an ImageGrid context to make(..)??? // ...something like .app for making it generic-ish for example... @@ -1051,7 +1056,6 @@ browse.items.makeSubContext('field', ], options) }) - // // .field.Toggle(title, value[, options]) // .field.Toggle(title, options) @@ -1202,11 +1206,7 @@ function(title, options){ : 'off' } }))) } - // XXX like .makeEditor(..) but local to make(..) (i.e. generic)... -// XXX should we have a batch callback??? -// ...otherwise what's the point in this? -//browse.items.makeEditor = browse.items.batch = function(spec, callback){ var that = this