awesomplete-vue-webpack-component
Awesomplete wrapper for Vue and webpack
Awesomplete Vue webpack Component (AVWC) is an Awesomplete VueJS wrapper component that assumes webpack bundling. AVWC accepts comma-separated strings, arrays, or Promise-returning functions as its data source allowing developer flexibility for source implementation, and supports setting/overriding Awesomplete properties via VueJS component structure. AVWC also has a few additional features over core Awesomplete.
Getting Started
Install
npm install awesomplete-vue-webpack-component
Configure usage of the component with VueJS
; Vue;
Use in VueJS .vue SFC file
Webpack configuration must include vue-, style-, and css- loaders
AVWC uses single-file component (.vue) design, and automatically imports the Awesomplete CSS.
module: rules: test: /\.css$/ use: `style-loader` `css-loader` test: /\.vue$/ use: `vue-loader`
For webpack 4+/compatiable vue-loader, VueLoaderPlugin usage is assumed to be configured correctly
Supported Props
The following props are recognized by AVWC.
Required
Prop | Type | Notes |
---|---|---|
fill-list |
|
Awesomplete-compatible set of options |
Optional
Awesomplete properties
Prop | Type | Notes |
---|---|---|
auto-first |
Boolean | Awesomplete's autoFirst property |
max-items |
Number |
|
min-chars |
Number |
|
Awesomplete functions
Prop | Type | Notes |
---|---|---|
container |
Function | Override Awesomplete's container function |
filter |
Function | Override Awesomplete's filter function |
item |
Function | Override Awesomplete's item function |
replace |
Function |
|
sort |
|
Override Awesomplete's sort function |
AVWC properties
Prop | Type | Notes |
---|---|---|
clear-on-close |
Boolean |
|
css-class |
String | One or more CSS classes to add to the Awesomplete block |
dropdown |
Boolean |
|
drop-down-css-class |
String | One or more CSS classes to add to the drop-down button |
initial-text |
String |
|
initial-text-evaluate |
Boolean |
|
initial-text-select |
|
|
input-css-class |
String | One or more CSS classes to add to the text input element |
ms-throttle |
Number |
|
placeholder |
|
|
replace-selection-with |
String |
|
striped |
Boolean | Add a .striped CSS class to Awesomplete with a default striping color scheme applied |
Emitted events
Awesomplete events
All five currently existing Awesomplete events are mapped to the VueJS event emitter without the awesomplete- prefix
Awesomplete Event | AVWC Emitted Event |
---|---|
awesomplete-close |
close |
awesomplete-highlight |
highlight |
awesomplete-open |
open |
awesomplete-select |
select |
awesomplete-selectcomplete |
selectcomplete |
Object references
AVWC emits objects as events after initialization
Emitted Event | Description |
---|---|
awesomplete-object | The Awesomplete object |
ref-input | The text input element |
ref-dropdown-button | The dropdown button (only when dropdown is enabled) |
Styling
AVWC provides CSS classes on its UI elements
- AVWC is wrapped in a
<span />
with an.avwc-container
class - The input element has an
.avwc-entry
class - The drop-down button has an
.avwc-dropdown
class
Additionally, as noted above, the following props can be used to set additional CSS classes on each UI element
css-class
drop-down-css-class
input-css-class
License
Awesomplete Vue webpack Component is released under the MIT License. See License file for more details.
Contributing
Pull requests will be considered provided they follow existing code's styling, and are well commented.