diff --git a/CHANGELOG.md b/CHANGELOG.md index c9aa4c9..0948a8b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). -## 0.2.0 - UNRELEASED +## 0.2.0 - 2017-07-03 ### Added @@ -18,7 +18,6 @@ and this project adheres to [Semantic Versioning](http://semver.org/). * Remove the `is-selected` class to the suggestions on refresh. - ## 0.1.0 - 2017-06-25 First version with basic features diff --git a/README.md b/README.md index 1b2d1d5..97f4905 100644 --- a/README.md +++ b/README.md @@ -94,7 +94,6 @@ As you can see, the constructor of the class `Suggestions` needs two arguments: * `DatalistSource`: Get the source from the `` element associated to the input. * `AjaxSource`: Get the source from an ajax request returning a json with the data. -* `Source`: To assign the data by yourself. Example with ajax: @@ -107,35 +106,14 @@ const suggestions = new Suggestions( ); ``` -Example assigning the data directly: - -```js -import {Suggestions, Source} from 'pw-suggestions'; - -const suggestions = new Suggestions( - document.getElementById('my-input'), - new Source([ - { - label: 'Option 1', - value: 'option-1', - },{ - label: 'Option 2', - value: 'option-2', - } - ]) -); -``` - All sources have the following options: Name | Type | Description -----|------|------------ **parent** | `Node` | The parent node in which the suggestions are inserted in the DOM. By default is `document.body` unless `DatalistSource` that uses the parent element of the `` element. **suggestions.render** | `function` | A function to customize the html of each suggestion. -**suggestions.search** | `function` | A function to generate the text used to filter the result. **suggestions.label** | `string` | The object key used to generate the label of the suggestion. By default is `label`. **suggestions.value** | `string` | The object key used to generate the value of the suggestion. By default is `value`. -**group.render** | `function` | A function to customize the html of each group of suggestions. **group.label** | `string` | The object key used to generate the label of the group of suggestion. By default is `label`. Example: diff --git a/package.json b/package.json index ace3a98..46fd72f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pw-suggestions", - "version": "0.1.0", + "version": "0.2.0", "description": "Javascript to provide autocomplete/suggestions in inputs", "main": "index.js", "scripts": {