From e8950cebe86f8c314687ccce0f60ba553f987115 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Sat, 11 Jan 2020 23:48:36 +0300 Subject: [PATCH] fixes and cleanup.... Signed-off-by: Alex A. Naanou --- ui (gen4)/features/examples.js | 21 +++++++++------------ ui (gen4)/features/ui-widgets.js | 5 +++-- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/ui (gen4)/features/examples.js b/ui (gen4)/features/examples.js index e142fa57..ab7a92cf 100755 --- a/ui (gen4)/features/examples.js +++ b/ui (gen4)/features/examples.js @@ -922,8 +922,7 @@ var ExampleUIActions = actions.Actions({ widgets.makeUIDialog(function(spec, callback){ var that = this var d0 = {} - var d1 = {} - var d2 = {} + var b1, b2 return browse.makeLister(null, function(path, make){ make([ @@ -941,22 +940,20 @@ var ExampleUIActions = actions.Actions({ //make.field.Toggle('Toggle: ', 'on') make.field.Toggle('Toggle: ', d0) - // XXX test callback... - make.batch([ + make.batch(b1 = b1 || [ '---', [['X', 'Y']], {title: 'foo', value: 123}, - Object.assign(d1, - {type: 'field.Toggle', title: 'Batch toggle 1: '}), + {type: 'field.Toggle', title: 'Batch toggle 1: '}, ]) - // XXX test callback... - make.field.batch([ + make.field.batch(b2 = b2 || [ '---', ['X', 'Y'], - {title: 'foo', value: 123}, - Object.assign(d2, - {type: 'Toggle', title: 'Batch toggle 2: '}), - ]) + {type: 'Toggle', title: 'foo', values: ['1','2','3'], list: false}, + {type: 'Toggle', title: 'Batch toggle 2: '}, + ], function(){ + console.log('---', ...arguments) + }) }, { cls: 'table-view', diff --git a/ui (gen4)/features/ui-widgets.js b/ui (gen4)/features/ui-widgets.js index a6a1afa4..b639bf64 100755 --- a/ui (gen4)/features/ui-widgets.js +++ b/ui (gen4)/features/ui-widgets.js @@ -1045,6 +1045,7 @@ 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 need to make this handle updates correctly... browse.items.makeSubContext('field', function(title, value, options){ // parse arguments... @@ -1086,6 +1087,7 @@ browse.items.makeSubContext('field', // - a way to define defaults -- global options? // - access to the .app -- should be configurable... // - default methods .showEditableList(..) / .showList(..) on make(..) +// XXX need to make this handle updates correctly... browse.items.field.Toggle = function(title, options){ var that = this @@ -1102,8 +1104,6 @@ function(title, options){ Object.assign( options, { - type: 'toggle', - open: function(evt){ // XXX CONTEXT... var actions = options.app || that.app @@ -1221,6 +1221,7 @@ function(title, options){ // XXX should this also take batch options??? +// XXX need to make this handle updates correctly... browse.items.batch = function(spec, callback){ var that = this