From 3a50359ee7a04a1e3ec4182746f1d32ae2491597 Mon Sep 17 00:00:00 2001 From: Cristian Necula Date: Wed, 20 Mar 2019 12:57:47 +0200 Subject: [PATCH 1/3] (patch) cancel _onSuggestionChanged debouncer The suggestions popup is not hidden when `show-results-on-focus` is used and the user tabs through the inputs fast enough (or keeps tab pressed). --- paper-autocomplete-suggestions.html | 1 + 1 file changed, 1 insertion(+) diff --git a/paper-autocomplete-suggestions.html b/paper-autocomplete-suggestions.html index 2207901..8674919 100644 --- a/paper-autocomplete-suggestions.html +++ b/paper-autocomplete-suggestions.html @@ -889,6 +889,7 @@ * Hides the suggestions popup */ hideSuggestions: function () { + this.cancelDebouncer('_onSuggestionChanged'); setTimeout(function () { this._hideSuggestionsWrapper(); }.bind(this), 0); From ddd5286deb2978791e342e4f09fa9183484c24b4 Mon Sep 17 00:00:00 2001 From: Cristian Necula Date: Wed, 5 Jun 2019 15:40:54 +0300 Subject: [PATCH 2/3] (major) upgrade to polymer 3 --- .bowerrc | 3 - .eslintrc | 3 + .gitignore | 2 + README.md | 14 +- analysis.json | 3430 ++++++ bower.json | 95 - demo/account-autocomplete.html | 175 - demo/account-autocomplete.js | 173 + demo/index.html | 229 +- demo/paper-autocomplete-suggestions-demo.html | 29 +- index.html | 4 +- package.json | 70 +- paper-autocomplete-suggestions.html | 983 -- paper-autocomplete-suggestions.js | 979 ++ paper-autocomplete.html | 760 -- paper-autocomplete.js | 719 ++ polymer.json | 6 + test/.eslintrc | 2 + test/index.html | 4 +- test/paper-autocomplete_test_local.html | 25 +- ...-autocomplete_test_local_customsource.html | 25 +- test/paper-autocomplete_test_multi.html | 18 +- wct.conf.js | 10 +- yarn.lock | 9578 +++++++++++++++++ 24 files changed, 15122 insertions(+), 2214 deletions(-) delete mode 100644 .bowerrc create mode 100644 analysis.json delete mode 100755 bower.json delete mode 100644 demo/account-autocomplete.html create mode 100644 demo/account-autocomplete.js delete mode 100644 paper-autocomplete-suggestions.html create mode 100644 paper-autocomplete-suggestions.js delete mode 100644 paper-autocomplete.html create mode 100644 paper-autocomplete.js create mode 100644 polymer.json create mode 100644 yarn.lock diff --git a/.bowerrc b/.bowerrc deleted file mode 100644 index 0d944e5..0000000 --- a/.bowerrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "registry": "https://bower.herokuapp.com" -} diff --git a/.eslintrc b/.eslintrc index 820e4a6..46b4841 100644 --- a/.eslintrc +++ b/.eslintrc @@ -6,6 +6,9 @@ "globals": { "Polymer": false }, + "parserOptions": { + "sourceType": "module" + }, "rules": { "comma-spacing": 2, "eol-last": 2, diff --git a/.gitignore b/.gitignore index 990d9d9..6cdf8e0 100644 --- a/.gitignore +++ b/.gitignore @@ -52,3 +52,5 @@ demo_components build/ .eslintcache + +/coverage diff --git a/README.md b/README.md index dee98c5..2522a8d 100644 --- a/README.md +++ b/README.md @@ -3,20 +3,16 @@ # paper-autocomplete -> Autocomplete component compatible with Polymer 1.x and 2.x +> Autocomplete component compatible with Polymer 3.x [![Published on webcomponents.org](https://img.shields.io/badge/webcomponents.org-published-blue.svg)](https://www.webcomponents.org/element/ellipticaljs/paper-autocomplete) [![Sauce Test Status](https://saucelabs.com/browser-matrix/jhuesos.svg)](https://saucelabs.com/u/jhuesos) -`paper-autocomplete` extends earlier efforts such as this -[https://github.com/rodo1111/paper-input-autocomplete](https://github.com/rodo1111/paper-input-autocomplete) to provide +`paper-autocomplete` extends earlier efforts such as this +[https://github.com/rodo1111/paper-input-autocomplete](https://github.com/rodo1111/paper-input-autocomplete) to provide keyboard support, remote binding and results scrolling. -# About Polymer 1.x and 2.x Compatibility -From version `3.x.x`, this component work with both Polymer 1.7+ or Polymer 2.0+ Please take a look to the -[MIGRATION.md](./MIGRATION.md) file that contains more information. - # Installation ``` bash @@ -39,13 +35,13 @@ bower install paper-autocomplete http://ellipticaljs.github.io/paper-autocomplete/ -**Important: The demos only work with browers which are ES2015/ES6 compatible.**. This component is compatible with older +**Important: The demos only work with browers which are ES2015/ES6 compatible.**. This component is compatible with older browsers as well, but the code need to be transpiled to ES5. `polymer build` and `polymer serve` can do that for you. This code from this page is not transpiled. # Want to contribute? -Check out our [Contributing guide](./CONTRIBUTING.md)! +Check out our [Contributing guide](./CONTRIBUTING.md)! # For Developers diff --git a/analysis.json b/analysis.json new file mode 100644 index 0000000..6b79ce7 --- /dev/null +++ b/analysis.json @@ -0,0 +1,3430 @@ +{ + "schema_version": "1.0.0", + "elements": [ + { + "description": "`paper-autocomplete-suggestions`\n\n*From v4.x.x, this component only works with Polymer 3.**\n\n [![Published on webcomponents.org](https://img.shields.io/badge/webcomponents.org-published-blue.svg)](https://www.webcomponents.org/element/ellipticaljs/paper-autocomplete)\n\n Allows to add autocomplete capabilities to any input field. This is desirable when you have an input field with custom\n logic and you just want to add the feature to help users with the selection. If you want to use it in combination with\n a regular ``, you can use ``.\n\n Example:\n ```\n
\n \n\n \n
\n ```\n\n It is **important to provide both `textProperty` and `valueProperty` when working with a custom search function and\n or custom templates.** They are needed to keep the component accessible and for the events (e.g. onSelect) to keep\n working.\n\n ### About Polymer 1.x and 2.x Compatibility\n From version `3.x.x`, this component work with both Polymer 1.7+ or Polymer 2.0+ Please take a look to the\n [MIGRATION.md](./MIGRATION.md) file that contains more information.\n\n ### Custom search\n This component has the public method `queryFn` that is called in each key stroke and it is responsible to query\n all items in the `source` and returns only those items that matches certain filtering criteria. By default, this\n component search for items that start with the recent query (case insensitive).\n You can override this behavior providing your own query function, as long as these two requirements are fulfill:\n\n - The query function is synchronous.\n - The API is respected and the method always return an Array.\n\n The template use to render each suggestion depends on the structure of each object that this method returns. For the\n default template, each suggestion should follow this object structure:\n\n ```\n {\n text: objText,\n value: objValue\n }\n ```\n\n This function is only used when a local data source is used. When using a `remoteDataSource` user is responsible of\n doing the search and specify suggestions manually.\n\n ### Custom templates\n A template for each suggestion can be provided, but for now, there are limitations in the way you can customize\n the template. Please read the the following sections carefully.\n In order to set your own template, you need to add a `