1.2.0 • Published 3 years ago

doz-searchfield v1.2.0

Weekly downloads
2
License
MIT
Repository
github
Last release
3 years ago

doz-searchfield

A search field component for DOZ

Install

npm install doz-searchfield --save

Live here

Usage

Globally

import Doz from 'doz'
import 'doz-searchfield'

new Doz({
    root: '#app',
    template: `
        <doz-searchfield></doz-searchfield>
    `
})

Locally

import Doz from 'doz'
import DozSearchfield from 'doz-searchfield/lib'

Doz.component('my-wrapper', {
    components: {
        'also-a-custom-name': DozSearchfield
    },
    template() {
        return `
            <also-a-custom-name></also-a-custom-name>
        `
    }
});

new Doz({
    root: '#app',
    template: `
        <my-wrapper></my-wrapper>
    `
})

Props

NameDefaultDescription
nameInput name
valuevalue
show-buttonfalseIf true show search button
button-labelSearchSearch button label
placeholderSearch here...Input placeholder
button-classCSS button class
input-classCSS input class
input-idInput ID
show-clear-buttontrueShow clear button
typeahead0Chars number to start to searching, if 0 it's disabled
force-searchfalseForce search event if value is already searched

Events

NameArgsDescription
searchvalueTriggered when search
clearTriggered when clear value

Example

Doz.component('app-wrapper', {
    props: {
        log: ''
    },
    template() {
        return `
            <div>
                <doz-searchfield
                    d:on-search="$onSearch"
                    d:on-clear="$onClear"
                ></doz-searchfield>
                <p><strong>Log:</strong> ${this.props.log}</p>
            </div>
        `
    },

    $onSearch(value) {
        this.props.log = value;
    },

    $onClear() {
        this.props.log = '';
    }
});

Changelog

You can view the changelog here

License

DozSearchfield is open-sourced software licensed under the MIT license

Author

Fabio Ricali

1.2.0

3 years ago

1.1.7

4 years ago

1.1.6

5 years ago

1.1.5

5 years ago

1.1.4

6 years ago

1.1.3

6 years ago

1.1.2

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago