diff --git a/ui (gen4)/features/filesystem.js b/ui (gen4)/features/filesystem.js index c5963802..de261747 100755 --- a/ui (gen4)/features/filesystem.js +++ b/ui (gen4)/features/filesystem.js @@ -2880,6 +2880,7 @@ module.FileSystemWriterUI = core.ImageGridFeatures.Feature({ tag: 'ui-fs-writer', depends: [ + 'ui-editor', 'ui-fs-loader', 'fs-writer', ], diff --git a/ui (gen4)/features/meta.js b/ui (gen4)/features/meta.js index 9f5bc48a..721f7475 100755 --- a/ui (gen4)/features/meta.js +++ b/ui (gen4)/features/meta.js @@ -176,6 +176,7 @@ core.ImageGridFeatures.Feature('imagegrid-testing', [ //----------------------------------------------------- testing --- + 'ui-editor', 'experiments', '-tests', diff --git a/ui (gen4)/features/ui-widgets.js b/ui (gen4)/features/ui-widgets.js index 9b868d0d..99e62829 100755 --- a/ui (gen4)/features/ui-widgets.js +++ b/ui (gen4)/features/ui-widgets.js @@ -958,9 +958,100 @@ module.Dialogs = core.ImageGridFeatures.Feature({ var EditorActions = actions.Actions({ - __editor_item_constructors__: { + // format: + // { + // : function(id, make, options){}, + // ... + // } + // + __editor_fields__: { + // generic field... + // + // options format: + // { + // // NOTE: if this is not set then the id is used... + // title: , + // + // value: | , + // editable: , + // + // list: | , + // list_button: , + // + // doc: | , + // + // // callback called when value is changed... + // // XXX should this check/normalize/... + // set: , + // + // ... + // } + // + // XXX we need: + // - id + // - dialog ref (make.dialog) + // - actions ref (this) + // - make + // - options + // - initial value + // - history + // - callback + // XXX Q: when do we get the data??? + field: function(actions, make, options){ + console.log('>>>>', options.type, make, options) + }, + + text: function(actions, make, options){ + this.field(actions, make, + Object.assign( + { + type: 'text', + }, + options)) + }, + select: function(actions, make, options){ + this.field(actions, make, + Object.assign( + { + type: 'select', + }, + options)) + }, + + // XXX todo: + // - date + // - ... }, + // + // spec format: + // [ + // , + // + // { + // type: + // ... + // }, + // + // ... + // ] + // + // XXX does this need a callback??? + makeEditorBlock: ['- Interface/', + function(spec, make){ + var that = this + // XXX revise... + var fields = this.__editor_fields__ + || EditorActions.__editor_fields__ + || {} + ;(spec || []) + .map(function(field){ + field instanceof Object ? + fields[field.type](that, make, field) + : make(field) }) + return make }], + + // XXX the callback is called to get initial data and to update/save it... makeEditor: ['- Interface/', makeUIDialog(function(spec, callback){ // XXX @@ -979,9 +1070,6 @@ module.Editor = core.ImageGridFeatures.Feature({ ], actions: EditorActions, - - handlers: [ - ], })