From 3c9599069707ca6571f2b2450c1e39d80661f7d9 Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Wed, 27 Oct 2021 16:52:52 +0100 Subject: [PATCH 001/234] Move website from Google Analytics to Plausible --- _includes/footer.html | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/_includes/footer.html b/_includes/footer.html index b0307c24..563c0db3 100644 --- a/_includes/footer.html +++ b/_includes/footer.html @@ -38,22 +38,6 @@ - - + From 44a268bd6c4efbadf9fc23c7543395a198f592aa Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Wed, 27 Oct 2021 16:53:25 +0100 Subject: [PATCH 002/234] Add missing autoComplete docs --- docs/api/ui/autoComplete/index.md | 315 ++++++++++++++++++++++++++++++ 1 file changed, 315 insertions(+) create mode 100644 docs/api/ui/autoComplete/index.md diff --git a/docs/api/ui/autoComplete/index.md b/docs/api/ui/autoComplete/index.md new file mode 100644 index 00000000..8d7625d9 --- /dev/null +++ b/docs/api/ui/autoComplete/index.md @@ -0,0 +1,315 @@ +--- +layout: docs-api +toc: toc-api-ui.html +title: AutoComplete +slug: + - url: "/docs/api/ui" + label: "ui" + - 'autocomplete' +--- + +__Since 2.1.0__ + +Adds auto-complete functionality to an `` element. + + - [Options](#options) + - [Methods](#methods) + - [Examples](#examples) + +
+
+
+

Options

+ + +
search
+
+
+

Methods

+ + +
destroy
+
+
+
+

Events

+

Types

+
+
+ +### Options + +#### search( value, [done]) + +Type: function + +A function that is called when the input value changes that should return a list +of possible completions. + +The function can take one or two arguments: + + - `value` - the current value of the ``. + - `done` - an optional callback function that will be called with the completions. + +If the function has two arguments, it *must* call `done` with the results rather +than return them. This allows the function to do asynchronous work to generate the +completions. + +The returns list of completions must be an array of objects of the form: + +```javascript + { + value: "", // The value to insert if selected + label: ""|DOMElement // The label to display in the dropdown + } +``` + +The `label` can be a DOMElement. This can be used to provide a customised display +of the completion - for example, including more contextual information. + + +### Methods + +#### destroy( ) + +Remove auto-complete functionality from an ``. + +```javascript +$(".input").autoComplete('destroy'); +``` + + +### Examples + +#### Auto-complete on plain `` + +```html + +``` + +```javascript +// View the page source to see the full list of animals used in +// this example +let animals = ["Aardvark","Alligator","Alpaca","Anaconda","Ant","Antelope", + "Carp","Cat","Caterpillar","Catfish","Cheetah","Chicken", + "Deer","Dinosaur","Dog","Dolphin","Donkey","Dove" ]; + +$("#node-input-example1").autoComplete({ + search: function(val) { + var matches = []; + animals.forEach(v => { + var i = v.toLowerCase().indexOf(val.toLowerCase()); + if (i > -1) { + matches.push({ + value: v, + label: v, + i: i + }) + } + }); + matches.sort(function(A,B){return A.i-B.i}) + return matches + } +}) +``` + +
+

Pick an animal

+ +
+ +#### Asynchronous search + +```html + +``` + +```javascript +// View the page source to see the full list of animals used in +// this example +let animals = ["Aardvark","Alligator","Alpaca","Anaconda","Ant","Antelope", + "Carp","Cat","Caterpillar","Catfish","Cheetah","Chicken", + "Deer","Dinosaur","Dog","Dolphin","Donkey","Dove" ]; + +$("#node-input-example2").autoComplete({ + search: function(val, done) { + var matches = []; + animals.forEach(v => { + var i = v.toLowerCase().indexOf(val.toLowerCase()); + if (i > -1) { + matches.push({ + value: v, + label: v, + i: i + }) + } + }); + matches.sort(function(A,B){return A.i-B.i}) + // Simulate asynchronous work by using setTimout + // to delay response by 1 second + setTimeout(function() { + done(matches); + },1000) + } +}) +``` + + +
+

Pick an animal

+ +
+ +#### Custom result labels + +```html + +``` + +```javascript +// View the page source to see the full list of animals used in +// this example +let animals = ["Aardvark","Alligator","Alpaca","Anaconda","Ant","Antelope", + "Carp","Cat","Caterpillar","Catfish","Cheetah","Chicken", + "Deer","Dinosaur","Dog","Dolphin","Donkey","Dove" ]; + +$("#node-input-example3").autoComplete({ + search: function(val) { + var matches = []; + animals.forEach(v => { + var i = v.toLowerCase().indexOf(val.toLowerCase()); + if (i > -1) { + var pre = v.substring(0,i); + var matchedVal = v.substring(i,i+val.length); + var post = v.substring(i+val.length) + + var el = $('
',{style:"white-space:nowrap"}); + $('').text(pre).appendTo(el); + $('',{style:"font-weight: bold, color:red"}).text(matchedVal).appendTo(el); + $('').text(post).appendTo(el); + + matches.push({ + value: v, + label: el, + i:i + }) + } + }) + matches.sort(function(A,B){return A.i-B.i}) + return matches + } +}) +``` + +
+

Pick an animal

+ +
+ + + + + + + + + + From b6bbb2c143d26571980b922745c0da2c61a106ec Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Thu, 28 Oct 2021 09:50:58 +0100 Subject: [PATCH 003/234] Fix menu-dropdown on small screens --- _includes/footer.html | 8 ++++++++ _includes/toc-about-survey.html | 2 +- _includes/toc-about.html | 2 +- _includes/toc-api-admin.html | 2 +- _includes/toc-api-context.html | 2 +- _includes/toc-api-hooks.html | 2 +- _includes/toc-api-library.html | 2 +- _includes/toc-api-modules.html | 2 +- _includes/toc-api-storage.html | 2 +- _includes/toc-api-ui.html | 2 +- _includes/toc-api.html | 2 +- _includes/toc-creating-nodes.html | 2 +- _includes/toc-developing-flows.html | 2 +- _includes/toc-developing.html | 2 +- _includes/toc-editor-guide.html | 2 +- _includes/toc-user-guide.html | 2 +- css/docs.css | 10 +++++++--- 17 files changed, 30 insertions(+), 18 deletions(-) diff --git a/_includes/footer.html b/_includes/footer.html index 563c0db3..35f128cb 100644 --- a/_includes/footer.html +++ b/_includes/footer.html @@ -38,6 +38,14 @@
+ diff --git a/_includes/toc-about-survey.html b/_includes/toc-about-survey.html index 29a6a0b4..a03537cc 100644 --- a/_includes/toc-about-survey.html +++ b/_includes/toc-about-survey.html @@ -1,5 +1,5 @@