From a0119492b63d27325dee3f33049a737591ddd04e Mon Sep 17 00:00:00 2001 From: Thomas Date: Thu, 8 Jun 2023 15:04:37 +0200 Subject: [PATCH] update docs --- readme.md | 99 ++++++++++++++++++++++++++++--------------------------- 1 file changed, 51 insertions(+), 48 deletions(-) diff --git a/readme.md b/readme.md index 24a7348..c8a69da 100644 --- a/readme.md +++ b/readme.md @@ -75,53 +75,56 @@ You can pass additionnal parameters with `data-server-params` and choose the met Options can be either passed to the constructor (eg: optionName) or in data-option-name format. -| Name | Type | Description | -| -------------------- | ---------------------------------------------- | ----------------------------------------------------------------------------------------------- | -| allowNew | Boolean | Allows creation of new tags | -| showAllSuggestions | Boolean | Show all suggestions even if they don't match. Disables validation. | -| badgeStyle | String | Color of the badge (color can be configured per option as well) | -| allowClear | Boolean | Show a clear icon | -| clearEnd | Boolean | Place clear icon at the end | -| selected | Array \| String | A comma separated list of selected values | -| regex | String | Regex for new tags | -| separator | Array \| String | A list (pipe separated) of characters that should act as separator (default is using enter key) | -| max | Number | Limit to a maximum of tags (0 = no limit) | -| placeholder | String | Provides a placeholder if none are provided as the first empty option | -| clearLabel | String | Text as clear tooltip | -| searchLabel | String | Default placeholder | -| keepOpen | Boolean | Keep suggestions open after selection, clear on focus out | -| allowSame | Boolean | Allow same tags used multiple times | -| baseClass | String | Customize the class applied to badges | -| addOnBlur | Boolean | Add new tags on blur (only if allowNew is enabled) | -| showDisabled | Boolean | Show disabled tags | -| hideNativeValidation | Boolean | Hide native validation tooltips | -| suggestionsThreshold | Number | Number of chars required to show suggestions | -| maximumItems | Number | Maximum number of items to display | -| autoselectFirst | Boolean | Always select the first item | -| updateOnSelect | Boolean | Update input value on selection (doesn't play nice with autoselectFirst) | -| highlightTyped | Boolean | Highlight matched part of the suggestion | -| fullWidth | Boolean | Match the width on the input field | -| fixed | Boolean | Use fixed positioning (solve overflow issues) | -| activeClasses | Array | By default: ["bg-primary", "text-white"] | -| labelField | String | Key for the label | -| valueField | String | Key for the value | -| queryParam | String | Name of the param passed to endpoint (query by default) | -| server | String | Endpoint for data provider | -| serverMethod | String | HTTP request method for data provider, default is GET | -| serverParams | String \| Object | Parameters to pass along to the server | -| fetchOptions | Object | Any other fetch options (https://developer.mozilla.org/en-US/docs/Web/API/fetch#syntax) | -| liveServer | Boolean | Should the endpoint be called each time on input | -| noCache | Boolean | Prevent caching by appending a timestamp | -| debounceTime | Number | Debounce time for live server | -| notFoundMessage | String | Display a no suggestions found message. Leave empty to disable | -| onRenderItem | [RenderCallback](#RenderCallback) | Callback function that returns the suggestion | -| onSelectItem | [ItemCallback](#ItemCallback) | Callback function to call on selection | -| onClearItem | [ValueCallback](#ValueCallback) | Callback function to call on clear | -| onCreateItem | [CreateCallback](#CreateCallback) | Callback function when an item is created | -| onBlur | [EventCallback](#EventCallback) | Callback function on blur | -| onFocus | [EventCallback](#EventCallback) | Callback function on focus | -| onCanAdd | [AddCallback](#AddCallback) | Callback function to validate item. Return false to show validation message. | -| onServerResponse | [ServerCallback](#ServerCallback) | Callback function to process server response. Must return a Promise | +| Name | Type | Description | +| -------------------- | ---------------------------------------------- | ------------------------------------------------------------------------------------------------------- | +| allowNew | Boolean | Allows creation of new tags | +| showAllSuggestions | Boolean | Show all suggestions even if they don't match. Disables validation. | +| badgeStyle | String | Color of the badge (color can be configured per option as well) | +| allowClear | Boolean | Show a clear icon | +| clearEnd | Boolean | Place clear icon at the end | +| selected | Array \| String | A comma separated list of selected values | +| regex | String | Regex for new tags | +| separator | Array \| String | A list (pipe separated) of characters that should act as separator (default is using enter key) | +| max | Number | Limit to a maximum of tags (0 = no limit) | +| placeholder | String | Provides a placeholder if none are provided as the first empty option | +| clearLabel | String | Text as clear tooltip | +| searchLabel | String | Default placeholder | +| keepOpen | Boolean | Keep suggestions open after selection, clear on focus out | +| allowSame | Boolean | Allow same tags used multiple times | +| baseClass | String | Customize the class applied to badges | +| addOnBlur | Boolean | Add new tags on blur (only if allowNew is enabled) | +| showDisabled | Boolean | Show disabled tags | +| hideNativeValidation | Boolean | Hide native validation tooltips | +| suggestionsThreshold | Number | Number of chars required to show suggestions | +| maximumItems | Number | Maximum number of items to display | +| autoselectFirst | Boolean | Always select the first item | +| updateOnSelect | Boolean | Update input value on selection (doesn't play nice with autoselectFirst) | +| highlightTyped | Boolean | Highlight matched part of the suggestion | +| fullWidth | Boolean | Match the width on the input field | +| fixed | Boolean | Use fixed positioning (solve overflow issues) | +| fuzzy | Boolean | Fuzzy search | +| activeClasses | Array | By default: ["bg-primary", "text-white"] | +| labelField | String | Key for the label | +| valueField | String | Key for the value | +| searchFields | Array | Key for the search | +| queryParam | String | Name of the param passed to endpoint (query by default) | +| server | String | Endpoint for data provider | +| serverMethod | String | HTTP request method for data provider, default is GET | +| serverParams | String \| Object | Parameters to pass along to the server. You can specify a "related" key with the id of a related field. | +| serverDataKey | String | By default: data | +| fetchOptions | Object | Any other fetch options (https://developer.mozilla.org/en-US/docs/Web/API/fetch#syntax) | +| liveServer | Boolean | Should the endpoint be called each time on input | +| noCache | Boolean | Prevent caching by appending a timestamp | +| debounceTime | Number | Debounce time for live server | +| notFoundMessage | String | Display a no suggestions found message. Leave empty to disable | +| onRenderItem | [RenderCallback](#RenderCallback) | Callback function that returns the suggestion | +| onSelectItem | [ItemCallback](#ItemCallback) | Callback function to call on selection | +| onClearItem | [ValueCallback](#ValueCallback) | Callback function to call on clear | +| onCreateItem | [CreateCallback](#CreateCallback) | Callback function when an item is created | +| onBlur | [EventCallback](#EventCallback) | Callback function on blur | +| onFocus | [EventCallback](#EventCallback) | Callback function on focus | +| onCanAdd | [AddCallback](#AddCallback) | Callback function to validate item. Return false to show validation message. | +| onServerResponse | [ServerCallback](#ServerCallback) | Callback function to process server response. Must return a Promise | To know more about these features, check the demo! @@ -260,4 +263,4 @@ They will be updated upon release of a new version. If you want to test your changes, simply run `npm start` and test in `demo.html` (feel free to add new test cases). -For scss updates, apply changes to scss files. They need to be compiled manually since they are not meant to be used by themselves. \ No newline at end of file +For scss updates, apply changes to scss files. They need to be compiled manually since they are not meant to be used by themselves.