From 421d155586c54f1689f570c375709fb8423ab8bb Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Tue, 5 Oct 2021 20:41:21 +0100 Subject: [PATCH] Add some docs to autoComplete widget --- .../src/js/ui/common/autoComplete.js | 31 ++++++++++++------- .../src/js/ui/common/typedInput.js | 2 +- 2 files changed, 20 insertions(+), 13 deletions(-) diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/common/autoComplete.js b/packages/node_modules/@node-red/editor-client/src/js/ui/common/autoComplete.js index d66cd26a0..6f1ac1aa1 100644 --- a/packages/node_modules/@node-red/editor-client/src/js/ui/common/autoComplete.js +++ b/packages/node_modules/@node-red/editor-client/src/js/ui/common/autoComplete.js @@ -1,10 +1,27 @@ (function($) { /** + * Attach to an to provide auto-complete + * + * $("#node-red-text").autoComplete({ + * search: function(value) { return ['a','b','c'] } + * }) + * * options: * - * methods: + * search : function(value, [done]) + * A function that is passed the current contents of the input whenever + * it changes. + * The function must either return auto-complete options, or pass them + * to the optional 'done' parameter. + * If the function signature includes 'done', it must be used * + * The auto-complete options should be an array of objects in the form: + * { + * value: String : the value to insert if selected + * label: String|DOM Element : the label to display in the dropdown. + * } + * */ $.widget( "nodered.autoComplete", { @@ -93,16 +110,6 @@ if (this.completionMenuShown) { this.menu.hide(); } - }, - // disable: function(val) { - // if(val === undefined || !!val ) { - // - // } else { - // this.uiSelect.attr("disabled", null); //remove attr - // } - // }, - // enable: function() { - // this.uiSelect.attr("disabled", null); //remove attr - // }, + } }); })(jQuery); diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/common/typedInput.js b/packages/node_modules/@node-red/editor-client/src/js/ui/common/typedInput.js index 9b0c6f54c..5a85ecbe2 100644 --- a/packages/node_modules/@node-red/editor-client/src/js/ui/common/typedInput.js +++ b/packages/node_modules/@node-red/editor-client/src/js/ui/common/typedInput.js @@ -89,8 +89,8 @@ return matches; } } - // This is a hand-generated list of completions for the core nodes (based on the node help html). + // This is a hand-generated list of completions for the core nodes (based on the node help html). var msgCompletions = [ { value: "payload" }, { value: "req", source: ["http in"]},